Skip to content

Commit 65de7dc

Browse files
committed
fix(emergent): strict build — cast LLM-origin args to ForgeToolInput
1 parent 6630291 commit 65de7dc

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/emergent/wrapForgeTool.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* through the optional `log` callback.
1717
*/
1818

19-
import type { ITool } from '../core/tools/ITool.js';
20-
import { ForgeToolMetaTool } from './ForgeToolMetaTool.js';
19+
import type { ITool, ToolExecutionContext } from '../core/tools/ITool.js';
20+
import { ForgeToolMetaTool, type ForgeToolInput } from './ForgeToolMetaTool.js';
2121
import { validateForgeShape } from './ForgeShapeValidator.js';
2222
import { inferSchemaFromTestCases } from './ForgeSchemaInference.js';
2323

@@ -228,7 +228,15 @@ export function wrapForgeTool(options: WrapForgeToolOptions): ITool {
228228
},
229229
};
230230
try {
231-
const r = await raw.execute(fixed, patched as never);
231+
// Cast is intentional: the wrapper's job is to normalize
232+
// arbitrary LLM output into something the engine can handle.
233+
// By this point `fixed` is shape-validated enough to run; TS
234+
// cannot statically prove it matches every ForgeToolInput
235+
// field because the source is untyped LLM output.
236+
const r = await raw.execute(
237+
fixed as unknown as ForgeToolInput,
238+
patched as unknown as ToolExecutionContext,
239+
);
232240
const out = r.output as { verdict?: { approved?: boolean; confidence?: number; reasoning?: string }; testResults?: unknown; result?: unknown; error?: unknown } | undefined;
233241
const verdict = out?.verdict ?? {};
234242
// Judge confidence is the judge's score for whether the tool is

0 commit comments

Comments
 (0)