fix(background-agent): use session.prompt() instead of promptAsync()

prompt() waits for AI response, ensuring message is actually processed.
Added response logging to debug if message delivery works.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-11 17:58:27 +09:00
parent e74cc82bcf
commit b422e2f94f

View File

@@ -214,19 +214,19 @@ export class BackgroundManager {
const duration = this.formatDuration(task.startedAt, task.completedAt) const duration = this.formatDuration(task.startedAt, task.completedAt)
const toolCalls = task.progress?.toolCalls ?? 0 const toolCalls = task.progress?.toolCalls ?? 0
const toastMessage = `Background task completed: ${task.description} (${duration}, ${toolCalls} tools). Use background_result with taskId="${task.id}"` const message = `Background task "${task.description}" completed in ${duration} with ${toolCalls} tool calls. Use background_result tool with taskId="${task.id}" to get the full result.`
log("[background-agent] Notifying via toast:", task.id) log("[background-agent] Sending message to parent session:", task.parentSessionID)
this.client.tui.showToast({ this.client.session.prompt({
path: { id: task.parentSessionID },
body: { body: {
message: toastMessage, parts: [{ type: "text", text: message }],
variant: "success",
}, },
}).then(() => { }).then((result) => {
log("[background-agent] Toast notification sent successfully") log("[background-agent] Message sent, response:", result.data ? "success" : result.error)
}).catch((error) => { }).catch((error) => {
log("[background-agent] Failed to send toast:", error) log("[background-agent] Failed to send message:", error)
}) })
} }