deeper-cli 1.2.1 → 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/dist/cli/index.js +10 -9
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/chat-repl.ts +10 -9
package/dist/cli/index.js
CHANGED
|
@@ -11464,12 +11464,12 @@ async function startRepl(opts) {
|
|
|
11464
11464
|
for (const tc of tcs) {
|
|
11465
11465
|
const tool = tools.find((t) => t.name === tc.name);
|
|
11466
11466
|
if (!tool) {
|
|
11467
|
-
lh.push({ role: "tool", content: `Error: unknown ${tc.name}`, tool_call_id: tc.id });
|
|
11467
|
+
lh.push({ role: "tool", content: `Error: unknown ${tc.name}`, tool_call_id: tc.id, name: tc.name });
|
|
11468
11468
|
continue;
|
|
11469
11469
|
}
|
|
11470
11470
|
const s2 = TOOL_SAFETY_MAP[tc.name] || "safe";
|
|
11471
11471
|
if (s2 === "dangerous") {
|
|
11472
|
-
lh.push({ role: "tool", content: "Skipped", tool_call_id: tc.id });
|
|
11472
|
+
lh.push({ role: "tool", content: "Skipped", tool_call_id: tc.id, name: tc.name });
|
|
11473
11473
|
continue;
|
|
11474
11474
|
}
|
|
11475
11475
|
try {
|
|
@@ -11479,10 +11479,10 @@ async function startRepl(opts) {
|
|
|
11479
11479
|
const r2 = await tool.execute(tc.args, ac.signal);
|
|
11480
11480
|
clearTimeout(timer);
|
|
11481
11481
|
const txt = sanitize(r2.output || "").slice(0, TOOL_RESULT_MAX);
|
|
11482
|
-
lh.push({ role: "tool", content: r2.success ? txt : `Error: ${r2.error}`, tool_call_id: tc.id });
|
|
11482
|
+
lh.push({ role: "tool", content: r2.success ? txt : `Error: ${r2.error}`, tool_call_id: tc.id, name: tc.name });
|
|
11483
11483
|
GS.tc++;
|
|
11484
11484
|
} catch (e) {
|
|
11485
|
-
lh.push({ role: "tool", content: `Error: ${e instanceof Error ? e.message : String(e)}`, tool_call_id: tc.id });
|
|
11485
|
+
lh.push({ role: "tool", content: `Error: ${e instanceof Error ? e.message : String(e)}`, tool_call_id: tc.id, name: tc.name });
|
|
11486
11486
|
}
|
|
11487
11487
|
}
|
|
11488
11488
|
trimHistory(lh, 20);
|
|
@@ -12249,10 +12249,10 @@ async function runLoop(opts, history, tools, toolDefs, confirm) {
|
|
|
12249
12249
|
}
|
|
12250
12250
|
async function execTool(tc, tools, opts, confirm) {
|
|
12251
12251
|
const tool = tools.find((t) => t.name === tc.name);
|
|
12252
|
-
if (!tool) return { role: "tool", content: `Error: unknown tool ${tc.name}`, tool_call_id: tc.id };
|
|
12252
|
+
if (!tool) return { role: "tool", content: `Error: unknown tool ${tc.name}`, tool_call_id: tc.id, name: tc.name };
|
|
12253
12253
|
const vResult = validator.validate(tool, tc.args);
|
|
12254
12254
|
if (!vResult.success) {
|
|
12255
|
-
return { role: "tool", content: `Error: ${vResult.error}`, tool_call_id: tc.id };
|
|
12255
|
+
return { role: "tool", content: `Error: ${vResult.error}`, tool_call_id: tc.id, name: tc.name };
|
|
12256
12256
|
}
|
|
12257
12257
|
const s = TOOL_SAFETY_MAP[tc.name] || "safe";
|
|
12258
12258
|
const toolName = tc.name;
|
|
@@ -12266,7 +12266,7 @@ async function execTool(tc, tools, opts, confirm) {
|
|
|
12266
12266
|
const ok = await confirm(`\u6267\u884C ${toolName}?`);
|
|
12267
12267
|
if (!ok) {
|
|
12268
12268
|
O(G(" \u8DF3\u8FC7\n"));
|
|
12269
|
-
return { role: "tool", content: "User skipped", tool_call_id: tc.id };
|
|
12269
|
+
return { role: "tool", content: "User skipped", tool_call_id: tc.id, name: tc.name };
|
|
12270
12270
|
}
|
|
12271
12271
|
O("\r" + A2.d + " " + A2.R + A2.c + tSyms[0] + A2.R + A2.G + " " + toolName + A2.R + " ");
|
|
12272
12272
|
}
|
|
@@ -12353,7 +12353,7 @@ async function execTool(tc, tools, opts, confirm) {
|
|
|
12353
12353
|
xmemory.storeEpisodic(`\u4FEE\u6539\u4E86\u6587\u4EF6: ${brief}`, ["file", "modified"], 6);
|
|
12354
12354
|
}
|
|
12355
12355
|
}
|
|
12356
|
-
return { role: "tool", content: text, tool_call_id: tc.id };
|
|
12356
|
+
return { role: "tool", content: text, tool_call_id: tc.id, name: tc.name };
|
|
12357
12357
|
} catch (e) {
|
|
12358
12358
|
stopToolAnim();
|
|
12359
12359
|
const em = e instanceof Error ? e.message : String(e);
|
|
@@ -12361,7 +12361,7 @@ async function execTool(tc, tools, opts, confirm) {
|
|
|
12361
12361
|
O("\r" + " ".repeat(process5.stdout.columns || 80) + "\r");
|
|
12362
12362
|
O(r(" \u2717") + G(` ${tc.name} ${em.slice(0, 60)}
|
|
12363
12363
|
`));
|
|
12364
|
-
return { role: "tool", content: `Error: ${em}`, tool_call_id: tc.id };
|
|
12364
|
+
return { role: "tool", content: `Error: ${em}`, tool_call_id: tc.id, name: tc.name };
|
|
12365
12365
|
}
|
|
12366
12366
|
}
|
|
12367
12367
|
function buildMsgs(history) {
|
|
@@ -12441,6 +12441,7 @@ ${globalRules}` });
|
|
|
12441
12441
|
function: { name: t.name, arguments: JSON.stringify(t.arguments) }
|
|
12442
12442
|
}));
|
|
12443
12443
|
if (m.tool_call_id) e.tool_call_id = m.tool_call_id;
|
|
12444
|
+
if (m.name) e.name = m.name;
|
|
12444
12445
|
r2.push(e);
|
|
12445
12446
|
}
|
|
12446
12447
|
return r2;
|