@takboo/dsh-coopanion 0.4.21 → 0.4.22

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/README.md CHANGED
@@ -59,7 +59,7 @@
59
59
  打开侧边栏 **插件 → 添加插件**,在「包名或地址」中填入:
60
60
 
61
61
  ```text
62
- @takboo/dsh-coopanion@0.4.21
62
+ @takboo/dsh-coopanion@0.4.22
63
63
  ```
64
64
 
65
65
  点击安装,完成后启用 `dsh-coopanion`,再完全退出并重新打开 Harness。
@@ -71,7 +71,7 @@
71
71
  使用 **Desktop 自带的 `dsh` 命令**。先启动 Desktop 一次完成初始化,完全退出应用后执行:
72
72
 
73
73
  ```bash
74
- dsh plugin --profile desktop add @takboo/dsh-coopanion@0.4.21
74
+ dsh plugin --profile desktop add @takboo/dsh-coopanion@0.4.22
75
75
  ```
76
76
 
77
77
  完成后重新打开 Desktop。其他 profile 的安装方法见[使用指南](docs/usage.md#通过-dsh-命令行安装)。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": 1,
3
- "commit": "810789948475c42deb8333333510fa25b4e3ed7e",
3
+ "commit": "ca3bab64ab1751dfbb4841c05c3e9e843738be83",
4
4
  "dirty": false,
5
- "productDigest": "8eabee6ab2c719a3ccad94f9dac2ece5bd581286bf42080abfffdf50a2e7aa0a"
5
+ "productDigest": "4f7f1995ab4b7e56c5a3c0584d264a1857258a9f86dfda60440ea387c6150877"
6
6
  }
package/dist/index.js CHANGED
@@ -1019,7 +1019,7 @@ var PetModel = class {
1019
1019
  if (old) this.remove(old);
1020
1020
  }
1021
1021
  const project = session.header.cwd ? basename(session.header.cwd) : "\u672A\u6307\u5B9A\u9879\u76EE";
1022
- item = { id: session.id, label: project, project, cwd: session.header.cwd ?? "", prompt: "", createdAt: session.header.createdAt, updatedAt: session.header.createdAt, mood: "idle", text: ready, reply: "", replyId: "", unread: 0, revision: 0, active: false, streaming: false, speechId: "" };
1022
+ item = { id: session.id, label: project, project, cwd: session.header.cwd ?? "", prompt: "", createdAt: session.header.createdAt, updatedAt: session.header.createdAt, mood: "idle", text: ready, reply: "", replyId: "", unread: 0, revision: 0, active: false, streaming: false, speechId: "", speechRevision: 0 };
1023
1023
  this.sessions.set(session.id, item);
1024
1024
  this.tasks.set(session.id, { completion: new CompletionTracker(), ended: -1, seq: -1, turn: 0, active: false, tools: /* @__PURE__ */ new Map(), approvals: /* @__PURE__ */ new Set(), questions: /* @__PURE__ */ new Set(), requests: /* @__PURE__ */ new Set(), celebrateUntil: 0 });
1025
1025
  this.selected ??= session.id;
@@ -1066,8 +1066,16 @@ var PetModel = class {
1066
1066
  }
1067
1067
  const chunk = frame.chunk;
1068
1068
  if (chunk.type === "text-delta" || chunk.type === "block-end" && chunk.block.type === "text") {
1069
- if (chunk.type === "text-delta") stream.blocks.set(chunk.index, ((stream.blocks.get(chunk.index) ?? "") + chunk.text).slice(0, 1200));
1070
- else if (chunk.block.type === "text") stream.blocks.set(chunk.index, chunk.block.text.slice(0, 1200));
1069
+ const previousBlock = stream.blocks.get(chunk.index) ?? "";
1070
+ if (chunk.type === "text-delta") {
1071
+ stream.blocks.set(chunk.index, (previousBlock + chunk.text).slice(0, 1200));
1072
+ if (chunk.text.trim()) item.speechRevision++;
1073
+ } else if (chunk.block.type === "text") {
1074
+ const block = chunk.block.text.slice(0, 1200);
1075
+ stream.blocks.set(chunk.index, block);
1076
+ const text = block.trim();
1077
+ if (text && text !== previousBlock.trim()) item.speechRevision++;
1078
+ }
1071
1079
  stream.text = [...stream.blocks.entries()].sort(([a], [b]) => a - b).map(([, text]) => text).join("\n").slice(0, 1200);
1072
1080
  if (stream.text.trim()) {
1073
1081
  if (!task.tools.size && !task.approvals.size) this.present(item, "talking", "\u6B63\u5728\u7EC4\u7EC7\u56DE\u590D\u2026");
@@ -1314,7 +1322,7 @@ var PetModel = class {
1314
1322
  snapshot() {
1315
1323
  const item = this.selected ? this.sessions.get(this.selected) : void 0;
1316
1324
  this.settle();
1317
- return { mood: item?.mood ?? "idle", text: item?.text ?? ready, sessionId: item?.id ?? null, revision: item?.revision ?? 0, active: item?.active ?? false, streaming: item?.streaming ?? false, speechId: item?.speechId ?? "", results: [...this.results.values()].map((r) => ({ ...r })), sessions: [...this.sessions.values()].map((s) => ({ ...s })) };
1325
+ return { mood: item?.mood ?? "idle", text: item?.text ?? ready, sessionId: item?.id ?? null, revision: item?.revision ?? 0, active: item?.active ?? false, streaming: item?.streaming ?? false, speechId: item?.speechId ?? "", speechRevision: item?.speechRevision ?? 0, results: [...this.results.values()].map((r) => ({ ...r })), sessions: [...this.sessions.values()].map((s) => ({ ...s })) };
1318
1326
  }
1319
1327
  };
1320
1328
  function toolLabel(name2) {