mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Fix task completion events (#1981)
* Fix task completion events * Create polite-singers-greet.md --------- Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
This commit is contained in:
parent
1f36694e2d
commit
599d451bd1
4 changed files with 17 additions and 10 deletions
5
.changeset/polite-singers-greet.md
Normal file
5
.changeset/polite-singers-greet.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Fix task completion events
|
||||
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -13024,6 +13024,7 @@
|
|||
"resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
|
||||
"integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
|
|
|
|||
|
|
@ -3202,6 +3202,9 @@ export class Cline extends EventEmitter<ClineEvents> {
|
|||
false,
|
||||
)
|
||||
|
||||
telemetryService.captureTaskCompleted(this.taskId)
|
||||
this.emit("taskCompleted", this.taskId, this.getTokenUsage())
|
||||
|
||||
await this.ask(
|
||||
"command",
|
||||
removeClosingTag("command", command),
|
||||
|
|
@ -3233,9 +3236,10 @@ export class Cline extends EventEmitter<ClineEvents> {
|
|||
|
||||
if (command) {
|
||||
if (lastMessage && lastMessage.ask !== "command") {
|
||||
// Haven't sent a command message yet so
|
||||
// first send completion_result then command.
|
||||
// Haven't sent a command message yet so first send completion_result then command.
|
||||
await this.say("completion_result", result, undefined, false)
|
||||
telemetryService.captureTaskCompleted(this.taskId)
|
||||
this.emit("taskCompleted", this.taskId, this.getTokenUsage())
|
||||
}
|
||||
|
||||
// Complete command message.
|
||||
|
|
@ -3257,11 +3261,10 @@ export class Cline extends EventEmitter<ClineEvents> {
|
|||
commandResult = execCommandResult
|
||||
} else {
|
||||
await this.say("completion_result", result, undefined, false)
|
||||
telemetryService.captureTaskCompleted(this.taskId)
|
||||
this.emit("taskCompleted", this.taskId, this.getTokenUsage())
|
||||
}
|
||||
|
||||
telemetryService.captureTaskCompleted(this.taskId)
|
||||
this.emit("taskCompleted", this.taskId, this.getTokenUsage())
|
||||
|
||||
if (this.parentTask) {
|
||||
const didApprove = await askFinishSubTaskApproval()
|
||||
|
||||
|
|
|
|||
|
|
@ -27,15 +27,13 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
|
|||
cline.on("taskUnpaused", () => this.emit("taskUnpaused", cline.taskId))
|
||||
cline.on("taskAskResponded", () => this.emit("taskAskResponded", cline.taskId))
|
||||
cline.on("taskAborted", () => this.emit("taskAborted", cline.taskId))
|
||||
cline.on("taskSpawned", (taskId) => this.emit("taskSpawned", cline.taskId, taskId))
|
||||
cline.on("taskSpawned", (childTaskId) => this.emit("taskSpawned", cline.taskId, childTaskId))
|
||||
cline.on("taskCompleted", (_, usage) => this.emit("taskCompleted", cline.taskId, usage))
|
||||
cline.on("taskTokenUsageUpdated", (_, usage) => this.emit("taskTokenUsageUpdated", cline.taskId, usage))
|
||||
this.emit("taskCreated", cline.taskId)
|
||||
})
|
||||
|
||||
this.on("message", ({ taskId, action, message }) => {
|
||||
// if (message.type === "say") {
|
||||
// console.log("message", { taskId, action, message })
|
||||
// }
|
||||
|
||||
if (action === "created") {
|
||||
this.history.add(taskId, message)
|
||||
} else if (action === "updated") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue