fix: resolve TypeScript build errors in AI agent files

Fix const assertion on ternary, unused parameter, and readonly array
assignment that caused tsc to fail during pnpm build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-28 22:23:06 +01:00
parent 690dd6d841
commit 06e42b182e
2 changed files with 3 additions and 3 deletions

View File

@@ -85,7 +85,7 @@ export function useAiAgent() {
...m,
actions: m.actions.map(a =>
a.label.includes(toolId.slice(-6))
? { ...a, status: (isError ? 'error' : 'done') as const, label: formatToolResult(a.tool, result) }
? { ...a, status: isError ? 'error' as const : 'done' as const, label: formatToolResult(a.tool, result) }
: a,
),
}))
@@ -144,7 +144,7 @@ function isWriteTool(name: string): boolean {
return WRITE_TOOLS.has(name)
}
function extractPathFromArgs(toolName: string, args: Record<string, unknown>): string | null {
function extractPathFromArgs(_toolName: string, args: Record<string, unknown>): string | null {
if (args.path && typeof args.path === 'string') return args.path
if (args.source_path && typeof args.source_path === 'string') return args.source_path
return null

View File

@@ -309,7 +309,7 @@ export async function runAgentLoop(
let response: AnthropicMessage
try {
response = await callAnthropicAgent(messages, systemPrompt, model, AGENT_TOOLS)
response = await callAnthropicAgent(messages, systemPrompt, model, AGENT_TOOLS as unknown as unknown[])
} catch (err) {
callbacks.onError(err instanceof Error ? err.message : 'Unknown error')
return