refactor: migrate delegate_task to task tool with metadata fixes

- Rename delegate_task tool to task across codebase (100 files)
- Update model references: claude-opus-4-6 → 4-5, gpt-5.3-codex → 5.2-codex
- Add tool-metadata-store to restore metadata overwritten by fromPlugin()
- Add session ID polling for BackgroundManager task sessions
- Await async ctx.metadata() calls in tool executors
- Add ses_ prefix guard to getMessageDir for performance
- Harden BackgroundManager with idle deferral and error handling
- Fix duplicate task key in sisyphus-junior test object literals
- Fix unawaited showOutputToUser in ast_grep_replace
- Fix background=true → run_in_background=true in ultrawork prompt
- Fix duplicate task/task references in docs and comments
This commit is contained in:
YeonGyu-Kim
2026-02-06 16:01:54 +09:00
parent 202e0d1613
commit b30a131690
78 changed files with 1182 additions and 403 deletions
+9 -8
View File
@@ -4,9 +4,11 @@ import { runSg } from "./cli"
import { formatSearchResult, formatReplaceResult } from "./utils"
import type { CliLanguage } from "./types"
function showOutputToUser(context: unknown, output: string): void {
const ctx = context as { metadata?: (input: { metadata: { output: string } }) => void }
ctx.metadata?.({ metadata: { output } })
async function showOutputToUser(context: unknown, output: string): Promise<void> {
const ctx = context as {
metadata?: (input: { metadata: { output: string } }) => void | Promise<void>
}
await ctx.metadata?.({ metadata: { output } })
}
function getEmptyResultHint(pattern: string, lang: CliLanguage): string | null {
@@ -65,11 +67,11 @@ export const ast_grep_search: ToolDefinition = tool({
}
}
showOutputToUser(context, output)
await showOutputToUser(context, output)
return output
} catch (e) {
const output = `Error: ${e instanceof Error ? e.message : String(e)}`
showOutputToUser(context, output)
await showOutputToUser(context, output)
return output
}
},
@@ -99,14 +101,13 @@ export const ast_grep_replace: ToolDefinition = tool({
updateAll: args.dryRun === false,
})
const output = formatReplaceResult(result, args.dryRun !== false)
showOutputToUser(context, output)
await showOutputToUser(context, output)
return output
} catch (e) {
const output = `Error: ${e instanceof Error ? e.message : String(e)}`
showOutputToUser(context, output)
await showOutputToUser(context, output)
return output
}
},
})