tycono 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/src/engine/llm-adapter.ts +9 -2
- package/src/api/src/routes/speech.ts +19 -8
- package/src/web/dist/assets/{index-LMXc0zuE.js → index-BSryh72N.js} +2 -2
- package/src/web/dist/assets/index-DdHzlGw8.css +1 -0
- package/src/web/dist/assets/{preview-app-DcorIk-N.js → preview-app-Bl6BvDdj.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/src/web/dist/assets/index-Dtjw8aGI.css +0 -1
package/package.json
CHANGED
|
@@ -230,7 +230,7 @@ export class ClaudeCliProvider implements LLMProvider {
|
|
|
230
230
|
async chat(
|
|
231
231
|
systemPrompt: string,
|
|
232
232
|
messages: LLMMessage[],
|
|
233
|
-
|
|
233
|
+
tools?: ToolDefinition[],
|
|
234
234
|
signal?: AbortSignal,
|
|
235
235
|
): Promise<LLMResponse> {
|
|
236
236
|
// Build user message from messages array
|
|
@@ -239,13 +239,20 @@ export class ClaudeCliProvider implements LLMProvider {
|
|
|
239
239
|
.map(m => typeof m.content === 'string' ? m.content : m.content.filter(c => c.type === 'text').map(c => (c as { type: 'text'; text: string }).text).join(''))
|
|
240
240
|
.join('\n');
|
|
241
241
|
|
|
242
|
+
// When tools are requested, enable claude's built-in Read/Grep/Glob
|
|
243
|
+
const useTools = tools && tools.length > 0;
|
|
244
|
+
|
|
242
245
|
return new Promise((resolve, reject) => {
|
|
243
246
|
const args = [
|
|
244
247
|
'-p',
|
|
245
248
|
'--system-prompt', systemPrompt,
|
|
246
249
|
'--model', this.model,
|
|
247
|
-
'--max-turns', '1',
|
|
250
|
+
'--max-turns', useTools ? '3' : '1',
|
|
248
251
|
'--output-format', 'text',
|
|
252
|
+
...(useTools ? [
|
|
253
|
+
'--tools', 'Read,Grep,Glob',
|
|
254
|
+
'--dangerously-skip-permissions',
|
|
255
|
+
] : []),
|
|
249
256
|
userText,
|
|
250
257
|
];
|
|
251
258
|
|
|
@@ -612,14 +612,25 @@ ANTI-PATTERNS (never do these):
|
|
|
612
612
|
|
|
613
613
|
const provider = getLLM();
|
|
614
614
|
|
|
615
|
-
//
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
615
|
+
// ClaudeCliProvider now supports tools via built-in Read/Grep/Glob
|
|
616
|
+
// For ClaudeCliProvider: tools are handled internally by claude CLI (no custom tool loop needed)
|
|
617
|
+
// For AnthropicProvider: use custom AKB tool loop via chatWithTools()
|
|
618
|
+
const isAnthropicProvider = provider instanceof AnthropicProvider;
|
|
619
|
+
|
|
620
|
+
let raw: string;
|
|
621
|
+
let totalUsage: { inputTokens: number; outputTokens: number };
|
|
622
|
+
|
|
623
|
+
if (isAnthropicProvider) {
|
|
624
|
+
// Anthropic SDK: custom AKB tool loop
|
|
625
|
+
const result = await chatWithTools(provider, systemPrompt, [{ role: 'user', content: historyText }], true);
|
|
626
|
+
raw = result.text;
|
|
627
|
+
totalUsage = result.totalUsage;
|
|
628
|
+
} else {
|
|
629
|
+
// ClaudeCliProvider: claude CLI handles tool loop internally (Read/Grep/Glob)
|
|
630
|
+
const result = await provider.chat(systemPrompt, [{ role: 'user', content: historyText }], AKB_TOOLS);
|
|
631
|
+
raw = result.content.filter(c => c.type === 'text').map(c => (c as { type: 'text'; text: string }).text).join('');
|
|
632
|
+
totalUsage = result.usage;
|
|
633
|
+
}
|
|
623
634
|
|
|
624
635
|
const cleaned = raw.replace(/^["']|["']$/g, '');
|
|
625
636
|
|