@zhongqian97-code/ecode 0.5.34 → 0.5.35
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/index.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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",
|