deeper-cli 1.2.0 → 1.2.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeper-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "DeeperCode - 一句话生成完整项目的 AI Agentic CLI 工具",
5
5
  "type": "module",
6
6
  "bin": {
@@ -135,9 +135,9 @@ export async function startRepl(opts: ReplOptions): Promise<void> {
135
135
  lh.push({ role: 'assistant', content: fc || null, reasoning_content: th || undefined, tool_calls: tcs.map(t => ({ id: t.id, name: t.name, arguments: { ...t.args } })) });
136
136
  for (const tc of tcs) {
137
137
  const tool = tools.find(t => t.name === tc.name);
138
- if (!tool) { lh.push({ role: 'tool', content: `Error: unknown ${tc.name}`, tool_call_id: tc.id }); continue; }
138
+ if (!tool) { lh.push({ role: 'tool', content: `Error: unknown ${tc.name}`, tool_call_id: tc.id, name: tc.name }); continue; }
139
139
  const s2 = TOOL_SAFETY_MAP[tc.name] || 'safe';
140
- if (s2 === 'dangerous') { lh.push({ role: 'tool', content: 'Skipped', tool_call_id: tc.id }); continue; }
140
+ if (s2 === 'dangerous') { lh.push({ role: 'tool', content: 'Skipped', tool_call_id: tc.id, name: tc.name }); continue; }
141
141
  try {
142
142
  const ac = new AbortController();
143
143
  const timeout = TOOL_TIMEOUT_MAP[tc.name] || DEFAULT_TOOL_TIMEOUT;
@@ -145,9 +145,9 @@ export async function startRepl(opts: ReplOptions): Promise<void> {
145
145
  const r = await tool.execute(tc.args, ac.signal);
146
146
  clearTimeout(timer);
147
147
  const txt = sanitize(r.output || '').slice(0, TOOL_RESULT_MAX);
148
- lh.push({ role: 'tool', content: r.success ? txt : `Error: ${(r as any).error}`, tool_call_id: tc.id });
148
+ lh.push({ role: 'tool', content: r.success ? txt : `Error: ${(r as any).error}`, tool_call_id: tc.id, name: tc.name });
149
149
  GS.tc++;
150
- } catch (e: unknown) { lh.push({ role: 'tool', content: `Error: ${e instanceof Error ? e.message : String(e)}`, tool_call_id: tc.id }); }
150
+ } catch (e: unknown) { lh.push({ role: 'tool', content: `Error: ${e instanceof Error ? e.message : String(e)}`, tool_call_id: tc.id, name: tc.name }); }
151
151
  }
152
152
  trimHistory(lh, 20); continue;
153
153
  }
@@ -759,11 +759,11 @@ async function execTool(
759
759
  confirm?: (msg: string) => Promise<boolean>,
760
760
  ): Promise<Message> {
761
761
  const tool = tools.find(t => t.name === tc.name);
762
- if (!tool) return { role: 'tool', content: `Error: unknown tool ${tc.name}`, tool_call_id: tc.id };
762
+ if (!tool) return { role: 'tool', content: `Error: unknown tool ${tc.name}`, tool_call_id: tc.id, name: tc.name };
763
763
 
764
764
  const vResult = validator.validate(tool, tc.args);
765
765
  if (!vResult.success) {
766
- return { role: 'tool', content: `Error: ${vResult.error}`, tool_call_id: tc.id };
766
+ return { role: 'tool', content: `Error: ${vResult.error}`, tool_call_id: tc.id, name: tc.name };
767
767
  }
768
768
 
769
769
  const s = TOOL_SAFETY_MAP[tc.name] || 'safe';
@@ -776,7 +776,7 @@ async function execTool(
776
776
  const prefix = s === 'dangerous' ? '⛔' : '⚠';
777
777
  O(y(` ${prefix}确认? `));
778
778
  const ok = await confirm(`执行 ${toolName}?`);
779
- if (!ok) { O(G(' 跳过\n')); return { role: 'tool', content: 'User skipped', tool_call_id: tc.id }; }
779
+ if (!ok) { O(G(' 跳过\n')); return { role: 'tool', content: 'User skipped', tool_call_id: tc.id, name: tc.name }; }
780
780
  O('\r' + A.d + ' ' + A.R + A.c + tSyms[0] + A.R + A.G + ' ' + toolName + A.R + ' ');
781
781
  }
782
782
 
@@ -855,13 +855,13 @@ async function execTool(
855
855
  }
856
856
  }
857
857
 
858
- return { role: 'tool', content: text, tool_call_id: tc.id };
858
+ return { role: 'tool', content: text, tool_call_id: tc.id, name: tc.name };
859
859
  } catch (e: unknown) {
860
860
  stopToolAnim();
861
861
  const em = e instanceof Error ? e.message : String(e);
862
862
  Oflush(); O('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
863
863
  O(r(' ✗') + G(` ${tc.name} ${em.slice(0, 60)}\n`));
864
- return { role: 'tool', content: `Error: ${em}`, tool_call_id: tc.id };
864
+ return { role: 'tool', content: `Error: ${em}`, tool_call_id: tc.id, name: tc.name };
865
865
  }
866
866
  }
867
867
 
@@ -945,6 +945,7 @@ After writing or editing code files, ALWAYS verify the changes:
945
945
  id: t.id, type: 'function', function: { name: t.name, arguments: JSON.stringify(t.arguments) },
946
946
  }));
947
947
  if (m.tool_call_id) e.tool_call_id = m.tool_call_id;
948
+ if (m.name) e.name = m.name;
948
949
  r.push(e);
949
950
  }
950
951
  return r;