feat(background-task): disable tools in child sessions
Background task tool이 child session을 생성할 때 background_task, background_output, background_cancel 도구를 자동으로 비활성화합니다. OpenCode Task tool 패턴과 동일하게 무한 재귀 호출을 방지합니다. - manager.ts: promptAsync 호출 시 tools 설정 추가 - index.ts: 불필요한 agent 레벨 disable 설정 제거 (manager에서 처리) - notification: tool calls 카운트 제거 (정확하게 트래킹되지 않음) 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -77,6 +77,11 @@ export class BackgroundManager {
|
||||
path: { id: sessionID },
|
||||
body: {
|
||||
agent: input.agent,
|
||||
tools: {
|
||||
background_task: false,
|
||||
background_output: false,
|
||||
background_cancel: false,
|
||||
},
|
||||
parts: [{ type: "text", text: input.prompt }],
|
||||
},
|
||||
}).catch((error) => {
|
||||
@@ -215,7 +220,6 @@ export class BackgroundManager {
|
||||
|
||||
private notifyParentSession(task: BackgroundTask): void {
|
||||
const duration = this.formatDuration(task.startedAt, task.completedAt)
|
||||
const toolCalls = task.progress?.toolCalls ?? 0
|
||||
|
||||
log("[background-agent] notifyParentSession called for task:", task.id)
|
||||
|
||||
@@ -232,7 +236,7 @@ export class BackgroundManager {
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
const message = `[BACKGROUND TASK COMPLETED] Task "${task.description}" finished in ${duration} (${toolCalls} tool calls). Use background_output with task_id="${task.id}" to get results.`
|
||||
const message = `[BACKGROUND TASK COMPLETED] Task "${task.description}" finished in ${duration}. Use background_output with task_id="${task.id}" to get results.`
|
||||
|
||||
const mainSessionID = getMainSessionID()
|
||||
if (!mainSessionID) {
|
||||
|
||||
@@ -206,14 +206,12 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
config.agent.explore.tools = {
|
||||
...config.agent.explore.tools,
|
||||
omo_task: false,
|
||||
background_task: false,
|
||||
};
|
||||
}
|
||||
if (config.agent.librarian) {
|
||||
config.agent.librarian.tools = {
|
||||
...config.agent.librarian.tools,
|
||||
omo_task: false,
|
||||
background_task: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user