Skip to content

Commit 83cd453

Browse files
committed
refactor(features): update background agent manager
Update background agent manager with latest configuration changes. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent 2957e8b commit 83cd453

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/features/background-agent/manager.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export class BackgroundManager {
128128
agent: input.agent,
129129
tools: {
130130
task: false,
131-
background_task: false,
132131
call_omo_agent: false,
133132
},
134133
parts: [{ type: "text", text: input.prompt }],
@@ -192,6 +191,42 @@ export class BackgroundManager {
192191
return undefined
193192
}
194193

194+
/**
195+
* Register an external task (e.g., from sisyphus_task) for notification tracking.
196+
* This allows tasks created by external tools to receive the same toast/prompt notifications.
197+
*/
198+
registerExternalTask(input: {
199+
taskId: string
200+
sessionID: string
201+
parentSessionID: string
202+
description: string
203+
agent?: string
204+
}): BackgroundTask {
205+
const task: BackgroundTask = {
206+
id: input.taskId,
207+
sessionID: input.sessionID,
208+
parentSessionID: input.parentSessionID,
209+
parentMessageID: "",
210+
description: input.description,
211+
prompt: "",
212+
agent: input.agent || "sisyphus_task",
213+
status: "running",
214+
startedAt: new Date(),
215+
progress: {
216+
toolCalls: 0,
217+
lastUpdate: new Date(),
218+
},
219+
}
220+
221+
this.tasks.set(task.id, task)
222+
subagentSessions.add(input.sessionID)
223+
this.startPolling()
224+
225+
log("[background-agent] Registered external task:", { taskId: task.id, sessionID: input.sessionID })
226+
227+
return task
228+
}
229+
195230
private async checkSessionTodos(sessionID: string): Promise<boolean> {
196231
try {
197232
const response = await this.client.session.todo({

0 commit comments

Comments
 (0)