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