@copylee/dsh-computer-use 0.7.2 → 0.7.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/README.md CHANGED
@@ -84,7 +84,7 @@ dsh plugin --profile web add @copylee/dsh-computer-use@latest
84
84
  | 操作后自动截图 | 开 | 关闭可省 token,但模型需要自己截图 |
85
85
  | 等待稳定 | 400 ms | 动作后至少等这么久,之后画面静止即截图(最多约 2.5 秒) |
86
86
  | 截图最长边 / 总像素 / JPEG 质量 | 1366 / 1.15MP / 70 | 越大越清晰、越费 token |
87
- | 操作时不深度思考 | 关 | 开启后,正在操作电脑的那几轮请求(看截图、决定下一步)改用模型的最低思考强度,每一步更快;任务开头的规划和其他对话仍按会话里选的思考强度。模型不提供可调的思考强度时不起作用 |
87
+ | 操作时不深度思考(Beta) | 关 | 试验功能,一般不用开。开始操作电脑后,本轮改用模型的最低思考强度,每一步快约 1 秒;下一轮恢复会话里选的思考强度。不思考时模型更容易出错、多走几步;工具参数写坏时会自动重发那一步,为此本轮的回复文字整段出现而不是逐字流出。目前只在 DeepSeek 官方模型上有效 |
88
88
  | 检测到你在操作时让出控制 | 开 | 键盘输入暂停、窗口被切换时重新看屏幕 |
89
89
  | 文字输入方式 | 流式 | 流式(长文本逐段出现)/ 逐字输入(最像打字,最慢)/ 一次粘贴(最快) |
90
90
  | 键盘静止多久后恢复 | 1500 ms | |
package/lib/client.js CHANGED
@@ -1228,8 +1228,8 @@ window.__ModuleLoader__.load({
1228
1228
  ...S.hint,
1229
1229
  fontWeight: 400
1230
1230
  } }, "短文字都会逐字打出来。长文本逐字输入在 Typora、Obsidian、Word 等编辑器里可能被自动补全括号、自动续列表打乱;流式按段落粘贴,既看得到过程又不会乱。")))), h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "速度"), h(ToggleRow, {
1231
- title: "操作时不深度思考",
1232
- hint: "正在操作电脑的那几轮(看截图、决定下一步点哪里)改用模型的最低思考强度,每一步明显更快、动作更连贯;任务开头的规划和其他对话仍按会话里选的思考强度。模型不支持调整思考强度时不起作用。",
1231
+ title: "操作时不深度思考(Beta)",
1232
+ hint: "试验功能,一般不用开。开始操作电脑后,本轮改用模型的最低思考强度,每一步快约 1 秒;任务开头的规划和之后的对话仍按会话里选的思考强度。代价:不思考时模型更容易出错、多走几步,本轮的回复文字会整段出现而不是逐字流出。目前只在 DeepSeek 官方模型上有效。",
1233
1233
  checked: draft.quickSteps,
1234
1234
  disabled,
1235
1235
  onChange: (value) => edit("quickSteps", value)
package/lib/index.js CHANGED
@@ -2208,6 +2208,26 @@ function lowestEffort(efforts) {
2208
2208
  const pick = LOWEST.find((id) => ids.has(id));
2209
2209
  return pick === void 0 ? void 0 : efforts.find((effort) => String(effort.id).toLowerCase() === pick).id;
2210
2210
  }
2211
+ /**
2212
+ * Without deliberation the model now and then writes a tool call whose
2213
+ * arguments are not valid JSON, which the adapter raises as
2214
+ * MALFORMED_RESPONSE and which would end the turn. Such a reply is thrown
2215
+ * away and asked for again. The reply is held back until it is complete, as
2216
+ * events already passed on could not be taken back.
2217
+ */
2218
+ async function* retryMalformed(run, attempts = 3) {
2219
+ for (let attempt = 1;; attempt++) {
2220
+ const events = [];
2221
+ try {
2222
+ for await (const event of run()) events.push(event);
2223
+ } catch (error) {
2224
+ if (attempt < attempts && error?.code === "MALFORMED_RESPONSE") continue;
2225
+ throw error;
2226
+ }
2227
+ yield* events;
2228
+ return;
2229
+ }
2230
+ }
2211
2231
  //#endregion
2212
2232
  //#region lib/types/routes.js
2213
2233
  const STATUS_ROUTE = "/api/dsh-computer-use/status";
@@ -8946,8 +8966,8 @@ const Config = z.object({
8946
8966
  "en-US": { $description: "How text is entered" }
8947
8967
  }),
8948
8968
  quickSteps: z.boolean().default(false).volatile().i18n({
8949
- "zh-CN": { $description: "操作电脑的那几轮请求用模型的最低思考强度(每步更快);其余请求沿用会话的思考强度" },
8950
- "en-US": { $description: "Use the model's lowest reasoning effort for the requests in the middle of operating the computer (faster steps); other requests keep the session's effort" }
8969
+ "zh-CN": { $description: "(Beta)操作电脑的那一轮用模型的最低思考强度(每步更快);其余沿用会话的思考强度" },
8970
+ "en-US": { $description: "(Beta) Use the model's lowest reasoning effort for the requests in the middle of operating the computer (faster steps); other requests keep the session's effort" }
8951
8971
  }),
8952
8972
  autoScreenshot: z.boolean().default(true).volatile().i18n({
8953
8973
  "zh-CN": { $description: "每次操作后自动回传截图(省去一轮调用)" },
@@ -9114,7 +9134,8 @@ function apply(ctx, config = {}) {
9114
9134
  reasoningEffort: effort
9115
9135
  });
9116
9136
  lowered.add(copy);
9117
- yield* llmCtx.llm.stream(copy);
9137
+ const llm = llmCtx.llm;
9138
+ yield* retryMalformed(() => llm.stream(copy));
9118
9139
  })();
9119
9140
  }), { global: true }), "computer-use: quick steps");
9120
9141
  });
@@ -22,3 +22,11 @@ export declare function isOperating(messages: readonly unknown[], ownTools: Read
22
22
  export declare function lowestEffort(efforts: readonly {
23
23
  id: string;
24
24
  }[] | undefined): string | undefined;
25
+ /**
26
+ * Without deliberation the model now and then writes a tool call whose
27
+ * arguments are not valid JSON, which the adapter raises as
28
+ * MALFORMED_RESPONSE and which would end the turn. Such a reply is thrown
29
+ * away and asked for again. The reply is held back until it is complete, as
30
+ * events already passed on could not be taken back.
31
+ */
32
+ export declare function retryMalformed<T>(run: () => AsyncIterable<T>, attempts?: number): AsyncGenerator<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copylee/dsh-computer-use",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
5
5
  "type": "module",
6
6
  "author": "copylee",