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/LICENSE +21 -0
- 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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xxccdl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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;
|