@zhongqian97-code/ecode 0.5.34 → 0.5.36
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.
|
@@ -1837,28 +1837,29 @@ ${prompt}` : prompt;
|
|
|
1837
1837
|
};
|
|
1838
1838
|
const executeToolCall = async (tc) => {
|
|
1839
1839
|
let result;
|
|
1840
|
-
|
|
1840
|
+
const toolName = tc.name.toLowerCase().trim();
|
|
1841
|
+
if (toolName === "bash") {
|
|
1841
1842
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1842
1843
|
result = await handleBashTool(tcArgs.command, bashDeps);
|
|
1843
|
-
} else if (
|
|
1844
|
+
} else if (toolName === "read") {
|
|
1844
1845
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1845
1846
|
result = await readFile3(tcArgs);
|
|
1846
|
-
} else if (
|
|
1847
|
+
} else if (toolName === "write") {
|
|
1847
1848
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1848
1849
|
result = await writeFile2(tcArgs);
|
|
1849
|
-
} else if (
|
|
1850
|
+
} else if (toolName === "edit") {
|
|
1850
1851
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1851
1852
|
result = await editFile(tcArgs);
|
|
1852
|
-
} else if (
|
|
1853
|
+
} else if (toolName === "glob") {
|
|
1853
1854
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1854
1855
|
result = await globFiles(tcArgs);
|
|
1855
|
-
} else if (
|
|
1856
|
+
} else if (toolName === "grep") {
|
|
1856
1857
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1857
1858
|
result = await grepFiles(tcArgs);
|
|
1858
|
-
} else if (
|
|
1859
|
+
} else if (toolName === "apply_patch") {
|
|
1859
1860
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1860
1861
|
result = await applyPatch(tcArgs);
|
|
1861
|
-
} else if (
|
|
1862
|
+
} else if (toolName === "todo") {
|
|
1862
1863
|
const tcArgs = JSON.parse(tc.arguments);
|
|
1863
1864
|
result = todo(tcArgs);
|
|
1864
1865
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
todo,
|
|
35
35
|
webFetch,
|
|
36
36
|
writeFile
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BRSZMOHF.js";
|
|
38
38
|
import {
|
|
39
39
|
createSessionMetadata,
|
|
40
40
|
generateTitle,
|
|
@@ -222,6 +222,9 @@ function readStdin() {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
// src/runtime/session.ts
|
|
226
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
227
|
+
|
|
225
228
|
// src/runtime/events.ts
|
|
226
229
|
var EventBus = class {
|
|
227
230
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -249,6 +252,7 @@ var EventBus = class {
|
|
|
249
252
|
};
|
|
250
253
|
|
|
251
254
|
// src/runtime/approvals.ts
|
|
255
|
+
import { randomUUID } from "crypto";
|
|
252
256
|
var ApprovalQueue = class {
|
|
253
257
|
pending = /* @__PURE__ */ new Map();
|
|
254
258
|
/**
|
|
@@ -256,7 +260,7 @@ var ApprovalQueue = class {
|
|
|
256
260
|
* 调用方 await 此 Promise,直到 resolve() 被外部调用。
|
|
257
261
|
*/
|
|
258
262
|
request(kind, prompt) {
|
|
259
|
-
const id =
|
|
263
|
+
const id = randomUUID();
|
|
260
264
|
const promise = new Promise((resolve2) => {
|
|
261
265
|
this.pending.set(id, {
|
|
262
266
|
meta: { id, kind, prompt },
|
|
@@ -323,7 +327,7 @@ var SessionRuntime = class {
|
|
|
323
327
|
_title = "New Session";
|
|
324
328
|
logger;
|
|
325
329
|
constructor(config2, opts = {}) {
|
|
326
|
-
this.id = opts.sessionId ??
|
|
330
|
+
this.id = opts.sessionId ?? randomUUID2();
|
|
327
331
|
this.config = config2;
|
|
328
332
|
this.llm = opts.llm ?? createProvider(resolveActiveProfile(config2));
|
|
329
333
|
this.model = config2.model;
|
|
@@ -402,7 +406,7 @@ var SessionRuntime = class {
|
|
|
402
406
|
var _a, _b, _c;
|
|
403
407
|
while (!signal.aborted) {
|
|
404
408
|
this._status = "thinking";
|
|
405
|
-
const messageId =
|
|
409
|
+
const messageId = randomUUID2();
|
|
406
410
|
const uiMsg = {
|
|
407
411
|
id: messageId,
|
|
408
412
|
role: "assistant",
|
|
@@ -489,7 +493,8 @@ var SessionRuntime = class {
|
|
|
489
493
|
* 其他工具:直接执行,不需要审批流程。
|
|
490
494
|
*/
|
|
491
495
|
async executeToolCall(tc, signal) {
|
|
492
|
-
const
|
|
496
|
+
const name = tc.name.toLowerCase().trim();
|
|
497
|
+
const args = tc.arguments;
|
|
493
498
|
try {
|
|
494
499
|
if (name === "bash") {
|
|
495
500
|
const parsed = JSON.parse(args);
|
|
@@ -897,6 +902,6 @@ Node.js 16/18 \u8BF7\u4F7F\u7528 --web \u6216 --pipe \u6A21\u5F0F\u3002
|
|
|
897
902
|
);
|
|
898
903
|
process.exit(1);
|
|
899
904
|
}
|
|
900
|
-
const { App, React, render } = await import("./ui-
|
|
905
|
+
const { App, React, render } = await import("./ui-QZG4SHLC.js");
|
|
901
906
|
render(React.createElement(App, { config: finalConfig, version: VERSION, autoMode, registry, trustedSkillDirs, initialMessages }));
|
|
902
907
|
}
|