diff --git a/lib/prompts/tool.txt b/lib/prompts/tool.txt index d727a11..87149f4 100644 --- a/lib/prompts/tool.txt +++ b/lib/prompts/tool.txt @@ -36,7 +36,7 @@ You must use this tool in three specific scenarios. The rules for distillation ( Assistant: [Reads 'wrong_file.ts'] This file isn't relevant to the auth system. I'll remove it to clear the context. -[Uses prune with ids: ["noise", 5]] +[Uses prune with ids: ["noise", "5"]] @@ -46,11 +46,11 @@ I have analyzed the configuration. Here is the distillation: - 'db.ts' connects to mongo:27017. - The other 3 files were defaults. I have preserved the signals above, so I am now pruning the raw reads. -[Uses prune with ids: ["consolidation", 10, 11, 12, 13, 14]] +[Uses prune with ids: ["consolidation", "10", "11", "12", "13", "14"]] Assistant: [Runs tests, they pass] The tests passed. The feature is verified. -[Uses prune with ids: ["completion", 20, 21]] +[Uses prune with ids: ["completion", "20", "21"]] diff --git a/lib/strategies/prune-tool.ts b/lib/strategies/prune-tool.ts index d0a07ab..c162e08 100644 --- a/lib/strategies/prune-tool.ts +++ b/lib/strategies/prune-tool.ts @@ -32,12 +32,9 @@ export function createPruneTool( description: TOOL_DESCRIPTION, args: { ids: tool.schema.array( - tool.schema.union([ - tool.schema.enum(["completion", "noise", "consolidation"]), - tool.schema.number() - ]) + tool.schema.string() ).describe( - "First element is the reason ('completion', 'noise', 'consolidation'), followed by numeric IDs to prune" + "First element is the reason ('completion', 'noise', 'consolidation'), followed by numeric IDs as strings to prune" ), }, async execute(args, toolCtx) { @@ -56,7 +53,9 @@ export function createPruneTool( return "No valid pruning reason found. Use 'completion', 'noise', or 'consolidation' as the first element." } - const numericToolIds: number[] = args.ids.slice(1).filter((id): id is number => typeof id === "number") + const numericToolIds: number[] = args.ids.slice(1) + .map(id => parseInt(id, 10)) + .filter((n): n is number => !isNaN(n)) if (numericToolIds.length === 0) { return "No numeric IDs provided. Format: [reason, id1, id2, ...] where reason is 'completion', 'noise', or 'consolidation'." }