diff --git a/.oxlintrc.json b/.oxlintrc.json index 6911e41..3ae43c4 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -5,7 +5,8 @@ "correctness": "warn" }, "rules": { - "eslint/no-unused-vars": "error" + "eslint/no-unused-vars": "error", + "unicorn/no-nested-ternary": "error" }, "options": { "typeAware": true, diff --git a/src/agent/loop.ts b/src/agent/loop.ts index 2fba274..650d429 100644 --- a/src/agent/loop.ts +++ b/src/agent/loop.ts @@ -364,13 +364,13 @@ export class AgentLoop { if (response.content) await onProgress(response.content); const hint = response.toolCalls .map((tc) => { + let display = '' + const firstVal = Object.values(tc.arguments)[0]; - const display = - typeof firstVal === 'string' - ? firstVal.length > 40 - ? `"${firstVal.slice(0, 40)}…"` - : `"${firstVal}"` - : ''; + if (typeof firstVal === 'string') { + display = `"${firstVal.slice(0, 40) + (firstVal.length > 40 ? '…' : '')}"` + } + return `${tc.name}(${display})`; }) .join(', '); diff --git a/src/provider/index.ts b/src/provider/index.ts index 70a6dee..8b58203 100644 --- a/src/provider/index.ts +++ b/src/provider/index.ts @@ -146,17 +146,14 @@ export class LLMProvider { : undefined; try { + let toolChoice: 'required' | 'none' | 'auto' = 'auto' + if (opts.toolChoice === 'required' || opts.toolChoice === 'none') toolChoice = opts.toolChoice const result = await generateText({ model, messages: opts.messages as ModelMessage[], // biome-ignore lint/suspicious/noExplicitAny: AI SDK tools type is complex tools: aiTools as any, - toolChoice: - opts.toolChoice === 'required' - ? 'required' - : opts.toolChoice === 'none' - ? 'none' - : 'auto', + toolChoice, maxOutputTokens: maxTokens, temperature, stopWhen: stepCountIs(1),