@copylee/dsh-computer-use 0.16.1 → 0.17.0
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 +1 -1
- package/helper/Capture.cs +25 -0
- package/helper/Native.cs +1 -0
- package/helper/Overlay.cs +874 -34
- package/helper/Program.cs +4 -1
- package/lib/client.js +8 -4
- package/lib/index.js +88 -10
- package/lib/types/computer.d.ts +3 -0
- package/lib/types/overlay.d.ts +19 -1
- package/package.json +1 -1
package/helper/Program.cs
CHANGED
|
@@ -173,6 +173,7 @@ namespace DshComputerUse
|
|
|
173
173
|
case "displays": return Screen2.Displays();
|
|
174
174
|
case "screenshot": return Screen2.Capture(r);
|
|
175
175
|
case "settle": return Screen2.Settle(r);
|
|
176
|
+
case "frame_delta": return Screen2.FrameDelta(r);
|
|
176
177
|
case "cursor": { Native.POINT p; Native.GetCursorPos(out p); return Pt(p.X, p.Y); }
|
|
177
178
|
case "move":
|
|
178
179
|
using (new PassThrough())
|
|
@@ -236,7 +237,9 @@ namespace DshComputerUse
|
|
|
236
237
|
case "window_card": CardLayer.SetOpacity(Args.Int(r, "opacity", 100)); return Windows.Card(new IntPtr(Convert.ToInt64(r["hwnd"])), Args.Int(r, "x", 0), Args.Int(r, "y", 0), Args.Int(r, "width", 0), Args.Int(r, "height", 0));
|
|
237
238
|
case "window_uncard": return Windows.Uncard(new IntPtr(Convert.ToInt64(r["hwnd"])));
|
|
238
239
|
case "overlay_status": Overlay.Status(Args.Str(r, "status", "")); return null;
|
|
239
|
-
case "pet_update": Overlay.PetUpdate(Args.Str(r, "thinking", ""), Args.Str(r, "reply", ""), Args.Strs(r, "steps")); return null;
|
|
240
|
+
case "pet_update": Overlay.PetUpdate(Args.Str(r, "thinking", ""), Args.Str(r, "reply", ""), Args.Strs(r, "steps"), Args.Int(r, "total", 0)); return null;
|
|
241
|
+
case "pet_debug": Overlay.BarDebug(Args.Bool(r, "menu", false), Args.Str(r, "hover", "")); return null;
|
|
242
|
+
case "click_fx": Overlay.MarkResult(Args.Int(r, "x", 0), Args.Int(r, "y", 0), Args.Str(r, "button", "left"), Args.Int(r, "count", 1), Args.Str(r, "label", "")); return null;
|
|
240
243
|
case "pet_finish": Overlay.Finish(Args.Int(r, "holdMs", 4000)); return null;
|
|
241
244
|
case "overlay_hide": Overlay.Hide(); return null;
|
|
242
245
|
default: throw new Exception("unknown command: " + cmd);
|
package/lib/client.js
CHANGED
|
@@ -72,7 +72,7 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
overlay: true,
|
|
73
73
|
overlayLabel: "DeepSeek Harness",
|
|
74
74
|
hostWindow: "pet",
|
|
75
|
-
petSize: "
|
|
75
|
+
petSize: "bar",
|
|
76
76
|
cardOpacity: 80,
|
|
77
77
|
autoScreenshot: true,
|
|
78
78
|
autoScreenshotDetail: "standard",
|
|
@@ -115,7 +115,7 @@ window.__ModuleLoader__.load({
|
|
|
115
115
|
overlay: bool("overlay"),
|
|
116
116
|
overlayLabel: typeof out.overlayLabel === "string" && out.overlayLabel.trim() !== "" ? out.overlayLabel.trim().slice(0, 40) : DEFAULTS.overlayLabel,
|
|
117
117
|
hostWindow: out.hostWindow === "pet" || out.hostWindow === "card" || out.hostWindow === "minimize" || out.hostWindow === "keep" ? out.hostWindow : out.minimizeHostWindow === true ? "minimize" : DEFAULTS.hostWindow,
|
|
118
|
-
petSize: out.petSize === "compact" || out.petSize === "standard" || out.petSize === "detailed" ? out.petSize : DEFAULTS.petSize,
|
|
118
|
+
petSize: out.petSize === "bar" || out.petSize === "compact" || out.petSize === "standard" || out.petSize === "detailed" ? out.petSize : DEFAULTS.petSize,
|
|
119
119
|
cardOpacity: num("cardOpacity", 30, 100),
|
|
120
120
|
autoScreenshot: bool("autoScreenshot"),
|
|
121
121
|
autoScreenshotDetail: out.autoScreenshotDetail === "compact" || out.autoScreenshotDetail === "standard" ? out.autoScreenshotDetail : DEFAULTS.autoScreenshotDetail,
|
|
@@ -1888,13 +1888,17 @@ window.__ModuleLoader__.load({
|
|
|
1888
1888
|
disabled: disabled || draft.hostWindow !== "pet",
|
|
1889
1889
|
value: draft.petSize,
|
|
1890
1890
|
options: [
|
|
1891
|
+
{
|
|
1892
|
+
value: "bar",
|
|
1893
|
+
label: "顶部胶囊(一行思考 + 最近两步,推荐)"
|
|
1894
|
+
},
|
|
1891
1895
|
{
|
|
1892
1896
|
value: "compact",
|
|
1893
1897
|
label: "紧凑小卡片(最省视野 · 单行动作)"
|
|
1894
1898
|
},
|
|
1895
1899
|
{
|
|
1896
1900
|
value: "standard",
|
|
1897
|
-
label: "标准卡片(单行思考 +
|
|
1901
|
+
label: "标准卡片(单行思考 + 操作进度)"
|
|
1898
1902
|
},
|
|
1899
1903
|
{
|
|
1900
1904
|
value: "detailed",
|
|
@@ -1905,7 +1909,7 @@ window.__ModuleLoader__.load({
|
|
|
1905
1909
|
}), h("span", { style: {
|
|
1906
1910
|
...S.hint,
|
|
1907
1911
|
fontWeight: 400
|
|
1908
|
-
} }, draft.petSize === "compact" ? "约 320px 宽,只展示当前动作与控制按钮;点展开可临时看详情。" : draft.petSize === "detailed" ? "约 484px 宽,默认展示双行思考与最近 3 步时间线(展开可达 8 步)。" : "约 420px 宽,平衡视野与信息量,展开可查看多行思考与 5 步时间线。")), h("div", { style: S.label }, "悬浮卡片透明度", h(Select, {
|
|
1912
|
+
} }, draft.petSize === "bar" ? "屏幕顶部居中的胶囊:思考时图标上出现 … 气泡;⋯ 菜单里有暂停、跳过等待、展开、输入新指令;橙色按钮停止控制。可拖动。" : draft.petSize === "compact" ? "约 320px 宽,只展示当前动作与控制按钮;点展开可临时看详情。" : draft.petSize === "detailed" ? "约 484px 宽,默认展示双行思考与最近 3 步时间线(展开可达 8 步)。" : "约 420px 宽,平衡视野与信息量,展开可查看多行思考与 5 步时间线。")), h("div", { style: S.label }, "悬浮卡片透明度", h(Select, {
|
|
1909
1913
|
label: "悬浮卡片透明度",
|
|
1910
1914
|
disabled: disabled || draft.hostWindow !== "card" && draft.hostWindow !== "pet",
|
|
1911
1915
|
value: String(draft.cardOpacity),
|
package/lib/index.js
CHANGED
|
@@ -1128,6 +1128,13 @@ const TOOL_NAMES = {
|
|
|
1128
1128
|
web_fetch: "读取网页",
|
|
1129
1129
|
todo_write: "更新待办"
|
|
1130
1130
|
};
|
|
1131
|
+
/**
|
|
1132
|
+
* Reply text hands focus back to DeepSeek Harness only once it keeps streaming on its own:
|
|
1133
|
+
* this long after the first reply character with no reasoning or tool call in between, and
|
|
1134
|
+
* at least REPLY_HANDOFF_CHARS long. A sentence or two before the next tool call does not
|
|
1135
|
+
* flip the window back and forth. A reply this long hands over at once.
|
|
1136
|
+
*/
|
|
1137
|
+
const REPLY_HANDOFF_MS = 2200;
|
|
1131
1138
|
/** How long the "done" card stays up after a run (longer while the pointer rests on it). */
|
|
1132
1139
|
const FINISH_HOLD_MS = 4e3;
|
|
1133
1140
|
/**
|
|
@@ -1184,8 +1191,12 @@ var OverlayController = class {
|
|
|
1184
1191
|
reply = "";
|
|
1185
1192
|
/** Recent steps (tool actions), oldest first. */
|
|
1186
1193
|
steps = [];
|
|
1194
|
+
/** Steps this run in all (the list keeps only the last few). */
|
|
1195
|
+
stepTotal = 0;
|
|
1187
1196
|
resume;
|
|
1188
1197
|
pushTimer;
|
|
1198
|
+
/** Pending hand-back to DSH while a reply streams (see REPLY_HANDOFF_MS). */
|
|
1199
|
+
replyTimer;
|
|
1189
1200
|
/** An instruction the user typed into the progress card. */
|
|
1190
1201
|
onMessage;
|
|
1191
1202
|
/** Called when control starts (before the first action), e.g. to remember the window layout. */
|
|
@@ -1210,6 +1221,7 @@ var OverlayController = class {
|
|
|
1210
1221
|
if (event.event === "stop") this.stopControl(event.reason ?? "user");
|
|
1211
1222
|
else if (event.event === "skip_wait") this.skipActiveWaits();
|
|
1212
1223
|
else if (event.event === "pause") this.paused = true;
|
|
1224
|
+
else if (event.event === "open_host") this.openHost();
|
|
1213
1225
|
else if (event.event === "resume") this.paused = false;
|
|
1214
1226
|
else if (event.event === "user_input") {
|
|
1215
1227
|
this.lastUserInput = Date.now();
|
|
@@ -1353,6 +1365,7 @@ var OverlayController = class {
|
|
|
1353
1365
|
await this.starting;
|
|
1354
1366
|
if (agent && this.stoppedAgents.has(agent)) throw new Error(CONTROL_STOPPED_MESSAGE);
|
|
1355
1367
|
if (agent) this.agent = agent;
|
|
1368
|
+
this.cancelReplyHandoff();
|
|
1356
1369
|
if (!this.controlAbort || this.controlAbort.signal.aborted) this.controlAbort = new AbortController();
|
|
1357
1370
|
this.reply = "";
|
|
1358
1371
|
this.armIdle();
|
|
@@ -1403,6 +1416,7 @@ var OverlayController = class {
|
|
|
1403
1416
|
if (settings.overlay || pet) {
|
|
1404
1417
|
if (this.streamAgent !== agent) this.thinking = "";
|
|
1405
1418
|
this.steps = status ? [status] : [];
|
|
1419
|
+
this.stepTotal = this.steps.length;
|
|
1406
1420
|
await this.helper.call("overlay_show", {
|
|
1407
1421
|
label: pet ? `${settings.overlayLabel || "DeepSeek Harness"} 正在操控` : `${settings.overlayLabel || "DeepSeek Harness"} 正在操控你的电脑`,
|
|
1408
1422
|
status,
|
|
@@ -1432,6 +1446,7 @@ var OverlayController = class {
|
|
|
1432
1446
|
const line = plainLine(text).trim();
|
|
1433
1447
|
if (line === "" || this.steps.at(-1) === line) return;
|
|
1434
1448
|
this.steps = [...this.steps, line].slice(-8);
|
|
1449
|
+
this.stepTotal++;
|
|
1435
1450
|
this.schedulePush();
|
|
1436
1451
|
}
|
|
1437
1452
|
/** Live model output (DSH agent/assistant-stream) for the progress card. */
|
|
@@ -1444,6 +1459,7 @@ var OverlayController = class {
|
|
|
1444
1459
|
this.steps = [];
|
|
1445
1460
|
}
|
|
1446
1461
|
if (frame.type === "start") {
|
|
1462
|
+
this.cancelReplyHandoff();
|
|
1447
1463
|
this.thinking = "";
|
|
1448
1464
|
this.reply = "";
|
|
1449
1465
|
if (this.visible && agent === this.agent) this.helper.call("overlay_phase", { phase: "llm" }).catch(() => {});
|
|
@@ -1459,21 +1475,42 @@ var OverlayController = class {
|
|
|
1459
1475
|
if (this.settings().hostWindow === "pet") {
|
|
1460
1476
|
this.reply = plainLine(this.reply + chunk.text).slice(-300);
|
|
1461
1477
|
this.schedulePush();
|
|
1462
|
-
if (this.reply.length >= 260) this.end(this.agent, true).catch((error) => this.log(`reply handoff: ${String(error)}`));
|
|
1463
|
-
return;
|
|
1464
1478
|
}
|
|
1465
|
-
|
|
1479
|
+
this.replyChars += chunk.text.length;
|
|
1480
|
+
if (this.replyChars >= 260) this.handOffReply();
|
|
1481
|
+
else if (!this.replyTimer && chunk.text.trim()) {
|
|
1482
|
+
this.replyTimer = setTimeout(() => {
|
|
1483
|
+
this.replyTimer = void 0;
|
|
1484
|
+
if (this.replyChars >= 40) this.handOffReply();
|
|
1485
|
+
else this.replyChars = 0;
|
|
1486
|
+
}, REPLY_HANDOFF_MS);
|
|
1487
|
+
this.replyTimer.unref?.();
|
|
1488
|
+
}
|
|
1466
1489
|
}
|
|
1467
1490
|
return;
|
|
1468
1491
|
}
|
|
1492
|
+
this.cancelReplyHandoff();
|
|
1469
1493
|
if (chunk.type !== "reasoning-delta" || !chunk.text) return;
|
|
1470
1494
|
if (this.thinking === "" && this.visible && agent === this.agent) this.helper.call("overlay_phase", { phase: "" }).catch(() => {});
|
|
1471
1495
|
this.reply = "";
|
|
1472
1496
|
this.thinking = plainLine(this.thinking + chunk.text).slice(-300);
|
|
1473
1497
|
this.schedulePush();
|
|
1474
1498
|
}
|
|
1499
|
+
replyChars = 0;
|
|
1500
|
+
cancelReplyHandoff() {
|
|
1501
|
+
if (this.replyTimer) clearTimeout(this.replyTimer);
|
|
1502
|
+
this.replyTimer = void 0;
|
|
1503
|
+
this.replyChars = 0;
|
|
1504
|
+
}
|
|
1505
|
+
handOffReply() {
|
|
1506
|
+
this.cancelReplyHandoff();
|
|
1507
|
+
const agent = this.agent;
|
|
1508
|
+
if (!agent || !this.visible || this.paused || this.stopping) return;
|
|
1509
|
+
this.end(agent, true).catch((error) => this.log(`reply handoff: ${String(error)}`));
|
|
1510
|
+
}
|
|
1475
1511
|
/** A tool of another plugin started (computer-use tools report their own steps). */
|
|
1476
1512
|
toolStarted(agent, name, detail) {
|
|
1513
|
+
if (agent === this.agent) this.cancelReplyHandoff();
|
|
1477
1514
|
if (agent !== this.streamAgent) return;
|
|
1478
1515
|
if (this.visible && agent === this.agent) {
|
|
1479
1516
|
this.armIdle();
|
|
@@ -1493,7 +1530,8 @@ var OverlayController = class {
|
|
|
1493
1530
|
this.helper.call("pet_update", {
|
|
1494
1531
|
thinking: this.thinking.trim(),
|
|
1495
1532
|
...this.reply.trim() ? { reply: this.reply.trim() } : {},
|
|
1496
|
-
steps: this.steps
|
|
1533
|
+
steps: this.steps,
|
|
1534
|
+
total: this.stepTotal
|
|
1497
1535
|
}).catch(() => {});
|
|
1498
1536
|
}, 80);
|
|
1499
1537
|
this.pushTimer.unref?.();
|
|
@@ -1507,6 +1545,7 @@ var OverlayController = class {
|
|
|
1507
1545
|
if (this.unusedTimer) clearTimeout(this.unusedTimer);
|
|
1508
1546
|
this.unusedTimer = void 0;
|
|
1509
1547
|
this.otherTools = 0;
|
|
1548
|
+
this.cancelReplyHandoff();
|
|
1510
1549
|
this.agent = void 0;
|
|
1511
1550
|
this.paused = false;
|
|
1512
1551
|
if (this.waitSkippers.size > 0) {
|
|
@@ -1701,6 +1740,19 @@ var OverlayController = class {
|
|
|
1701
1740
|
this.log(`host window card: ${String(error)}`);
|
|
1702
1741
|
}
|
|
1703
1742
|
}
|
|
1743
|
+
/** The card's menu asked for DeepSeek Harness: bring it back as the see-through corner card. */
|
|
1744
|
+
async openHost() {
|
|
1745
|
+
if (!this.visible) return;
|
|
1746
|
+
try {
|
|
1747
|
+
for (const win of this.hostWindows.filter((win) => win.mode === "minimize")) await this.helper.call("window_cmd", {
|
|
1748
|
+
hwnd: win.hwnd,
|
|
1749
|
+
op: "restore"
|
|
1750
|
+
});
|
|
1751
|
+
await this.cardIfShown();
|
|
1752
|
+
} catch (error) {
|
|
1753
|
+
this.log(`open host: ${String(error)}`);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1704
1756
|
async restoreHost() {
|
|
1705
1757
|
const windows = this.hostWindows;
|
|
1706
1758
|
this.hostWindows = [];
|
|
@@ -1792,6 +1844,9 @@ const UNCHANGED_TEXT = "The screen looks exactly as in your previous screenshot:
|
|
|
1792
1844
|
const TARGET_WAIT_MS = 3e3;
|
|
1793
1845
|
/** Pause between looks while waiting for a control or a window. */
|
|
1794
1846
|
const POLL_MS = 200;
|
|
1847
|
+
/** wait until: give up early once the screen and window text have been still this long. */
|
|
1848
|
+
const WAIT_STILL_MS = 6e3;
|
|
1849
|
+
const WAIT_STILL_WINDOW_MS = 15e3;
|
|
1795
1850
|
/** Same-spot click warning window (2 minutes) and radius (±24 physical pixels). */
|
|
1796
1851
|
const REPEAT_WINDOW_MS = 12e4;
|
|
1797
1852
|
const REPEAT_RADIUS_PX = 24;
|
|
@@ -2667,6 +2722,18 @@ var Computer = class Computer {
|
|
|
2667
2722
|
const textWindow = kind === "text" ? await this.foreground() : void 0;
|
|
2668
2723
|
if (kind === "text" && !textWindow) throw new Error("No foreground window to observe for text.");
|
|
2669
2724
|
const textTab = textWindow && isBrowser(textWindow) ? (await readBrowserTab(this.helper, textWindow))?.tab : void 0;
|
|
2725
|
+
const stillMs = kind === "window" ? WAIT_STILL_WINDOW_MS : WAIT_STILL_MS;
|
|
2726
|
+
const watchRect = await this.settleRect().catch(() => void 0);
|
|
2727
|
+
let lastMotion = started;
|
|
2728
|
+
let lastText;
|
|
2729
|
+
const noteMotion = async () => {
|
|
2730
|
+
if (!watchRect) return;
|
|
2731
|
+
const delta = await this.helper.call("frame_delta", {
|
|
2732
|
+
...watchRect,
|
|
2733
|
+
key: "wait"
|
|
2734
|
+
}, 3e3).catch(() => void 0);
|
|
2735
|
+
if (!delta || typeof delta.changed !== "number" || delta.changed >= .002) lastMotion = Date.now();
|
|
2736
|
+
};
|
|
2670
2737
|
const present = async () => {
|
|
2671
2738
|
if (textWindow) {
|
|
2672
2739
|
const limit = Math.max(100, Math.min(1500, timeout - (Date.now() - started)));
|
|
@@ -2678,6 +2745,8 @@ var Computer = class Computer {
|
|
|
2678
2745
|
}, limit + 1500).catch(() => void 0);
|
|
2679
2746
|
if (!result || result.hwnd !== textWindow.hwnd || result.pid !== textWindow.pid || result.source === "none") return void 0;
|
|
2680
2747
|
if (textTab && (await readBrowserTab(this.helper, textWindow))?.tab !== textTab) return void 0;
|
|
2748
|
+
if (lastText !== void 0 && result.text !== lastText) lastMotion = Date.now();
|
|
2749
|
+
lastText = result.text;
|
|
2681
2750
|
const found = result.text.toLowerCase().includes(needle);
|
|
2682
2751
|
return !found && result.truncated && gone ? void 0 : found;
|
|
2683
2752
|
}
|
|
@@ -2710,6 +2779,11 @@ var Computer = class Computer {
|
|
|
2710
2779
|
await this.settle(signal);
|
|
2711
2780
|
return text;
|
|
2712
2781
|
}
|
|
2782
|
+
await noteMotion();
|
|
2783
|
+
if (found !== void 0 && Date.now() - lastMotion >= stillMs && !wait?.skipped()) {
|
|
2784
|
+
const what = `${kind === "window" ? "window" : kind === "text" ? "text" : "control"} "${subject}"`;
|
|
2785
|
+
return `Stopped waiting after ${((Date.now() - started) / 1e3).toFixed(1)}s: the screen has not changed for ${Math.round(stillMs / 1e3)}s and ${what} ${gone ? "is still there" : "has not appeared"}. The page has most likely finished — check the screenshot instead of waiting again; ${gone ? "this text may be a permanent part of the page (a button or label), so it never disappears." : "it may be worded differently or never appear."}`;
|
|
2786
|
+
}
|
|
2713
2787
|
if (Date.now() - started >= timeout) {
|
|
2714
2788
|
const near = !gone && kind === "target" && suggestions.length ? ` Controls there now: ${suggestions.map((name) => `"${name.slice(0, 40)}"`).join(", ")}.` : "";
|
|
2715
2789
|
throw new Error(`Timed out after ${Math.round(timeout / 1e3)}s waiting for ${kind === "window" ? "window" : kind === "text" ? "text" : "control"} "${subject}" to ${gone ? "disappear" : "appear"}.${near}`);
|
|
@@ -4152,7 +4226,7 @@ const DEFAULTS = {
|
|
|
4152
4226
|
overlay: true,
|
|
4153
4227
|
overlayLabel: "DeepSeek Harness",
|
|
4154
4228
|
hostWindow: "pet",
|
|
4155
|
-
petSize: "
|
|
4229
|
+
petSize: "bar",
|
|
4156
4230
|
cardOpacity: 80,
|
|
4157
4231
|
autoScreenshot: true,
|
|
4158
4232
|
autoScreenshotDetail: "standard",
|
|
@@ -4195,7 +4269,7 @@ function resolveConfig(raw) {
|
|
|
4195
4269
|
overlay: bool("overlay"),
|
|
4196
4270
|
overlayLabel: typeof out.overlayLabel === "string" && out.overlayLabel.trim() !== "" ? out.overlayLabel.trim().slice(0, 40) : DEFAULTS.overlayLabel,
|
|
4197
4271
|
hostWindow: out.hostWindow === "pet" || out.hostWindow === "card" || out.hostWindow === "minimize" || out.hostWindow === "keep" ? out.hostWindow : out.minimizeHostWindow === true ? "minimize" : DEFAULTS.hostWindow,
|
|
4198
|
-
petSize: out.petSize === "compact" || out.petSize === "standard" || out.petSize === "detailed" ? out.petSize : DEFAULTS.petSize,
|
|
4272
|
+
petSize: out.petSize === "bar" || out.petSize === "compact" || out.petSize === "standard" || out.petSize === "detailed" ? out.petSize : DEFAULTS.petSize,
|
|
4199
4273
|
cardOpacity: num("cardOpacity", 30, 100),
|
|
4200
4274
|
autoScreenshot: bool("autoScreenshot"),
|
|
4201
4275
|
autoScreenshotDetail: out.autoScreenshotDetail === "compact" || out.autoScreenshotDetail === "standard" ? out.autoScreenshotDetail : DEFAULTS.autoScreenshotDetail,
|
|
@@ -11284,7 +11358,7 @@ const actionProperties = {
|
|
|
11284
11358
|
},
|
|
11285
11359
|
gone: {
|
|
11286
11360
|
type: "boolean",
|
|
11287
|
-
description: "wait until: wait for it to disappear instead."
|
|
11361
|
+
description: "wait until: wait for it to disappear instead (never a label that is always on the page). Ends early once the screen is still for 6s."
|
|
11288
11362
|
},
|
|
11289
11363
|
region: {
|
|
11290
11364
|
type: "array",
|
|
@@ -12259,19 +12333,23 @@ const Config = z.object({
|
|
|
12259
12333
|
"en-US": { $description: "What to do with the DeepSeek Harness window while controlling (restored afterwards)" }
|
|
12260
12334
|
}),
|
|
12261
12335
|
petSize: z.union([
|
|
12336
|
+
z.const("bar").i18n({
|
|
12337
|
+
"zh-CN": { $description: "顶部胶囊(图标 + 一行滚动思考 + 最近两步,推荐)" },
|
|
12338
|
+
"en-US": { $description: "Top bar (icon, one scrolling line of reasoning, the last two steps; recommended)" }
|
|
12339
|
+
}),
|
|
12262
12340
|
z.const("compact").i18n({
|
|
12263
12341
|
"zh-CN": { $description: "紧凑小卡片(最省视野,单行当前操作)" },
|
|
12264
12342
|
"en-US": { $description: "Compact (minimal footprint, current action line only)" }
|
|
12265
12343
|
}),
|
|
12266
12344
|
z.const("standard").i18n({
|
|
12267
|
-
"zh-CN": { $description: "标准卡片(单行思考 +
|
|
12268
|
-
"en-US": { $description: "Standard (one-line thinking + action breadcrumb
|
|
12345
|
+
"zh-CN": { $description: "标准卡片(单行思考 + 操作进度)" },
|
|
12346
|
+
"en-US": { $description: "Standard card (one-line thinking + action breadcrumb)" }
|
|
12269
12347
|
}),
|
|
12270
12348
|
z.const("detailed").i18n({
|
|
12271
12349
|
"zh-CN": { $description: "详情大卡片(双行思考 + 最近 3 步时间线)" },
|
|
12272
12350
|
"en-US": { $description: "Detailed (two-line thinking + recent 3-step timeline)" }
|
|
12273
12351
|
})
|
|
12274
|
-
]).default("
|
|
12352
|
+
]).default("bar").volatile().i18n({
|
|
12275
12353
|
"zh-CN": { $description: "迷你进度卡片尺寸与默认展示的信息量" },
|
|
12276
12354
|
"en-US": { $description: "Size and default information density of the mini progress card" }
|
|
12277
12355
|
}),
|
package/lib/types/computer.d.ts
CHANGED
|
@@ -164,6 +164,9 @@ export interface OcrResult extends Partial<WindowInfo> {
|
|
|
164
164
|
}
|
|
165
165
|
/** Text returned instead of an identical screenshot. */
|
|
166
166
|
export declare const UNCHANGED_TEXT = "The screen looks exactly as in your previous screenshot: the action had no visible effect.";
|
|
167
|
+
/** wait until: give up early once the screen and window text have been still this long. */
|
|
168
|
+
export declare const WAIT_STILL_MS = 6000;
|
|
169
|
+
export declare const WAIT_STILL_WINDOW_MS = 15000;
|
|
167
170
|
/** Longest adaptive wait for the screen to settle after an action. */
|
|
168
171
|
export declare const MAX_SETTLE_MS = 2500;
|
|
169
172
|
export declare class Computer {
|
package/lib/types/overlay.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface CancellableAgent {
|
|
|
5
5
|
}): void;
|
|
6
6
|
}
|
|
7
7
|
export type HostWindowMode = 'pet' | 'card' | 'minimize' | 'keep';
|
|
8
|
-
export type PetCardSize = 'compact' | 'standard' | 'detailed';
|
|
8
|
+
export type PetCardSize = 'bar' | 'compact' | 'standard' | 'detailed';
|
|
9
9
|
/** Sanitized semantic summary of a physical user takeover action during computer control. */
|
|
10
10
|
export interface UserActionEvent {
|
|
11
11
|
at: number;
|
|
@@ -32,6 +32,15 @@ export interface StreamFrame {
|
|
|
32
32
|
}
|
|
33
33
|
/** Markdown reduced to one plain line for the progress card. */
|
|
34
34
|
export declare function plainLine(text: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Reply text hands focus back to DeepSeek Harness only once it keeps streaming on its own:
|
|
37
|
+
* this long after the first reply character with no reasoning or tool call in between, and
|
|
38
|
+
* at least REPLY_HANDOFF_CHARS long. A sentence or two before the next tool call does not
|
|
39
|
+
* flip the window back and forth. A reply this long hands over at once.
|
|
40
|
+
*/
|
|
41
|
+
export declare const REPLY_HANDOFF_MS = 2200;
|
|
42
|
+
export declare const REPLY_HANDOFF_CHARS = 40;
|
|
43
|
+
export declare const REPLY_HANDOFF_LONG = 260;
|
|
35
44
|
export interface OverlaySettings {
|
|
36
45
|
harnessUrl?: string | undefined;
|
|
37
46
|
overlay: boolean;
|
|
@@ -107,8 +116,12 @@ export declare class OverlayController {
|
|
|
107
116
|
private reply;
|
|
108
117
|
/** Recent steps (tool actions), oldest first. */
|
|
109
118
|
private steps;
|
|
119
|
+
/** Steps this run in all (the list keeps only the last few). */
|
|
120
|
+
private stepTotal;
|
|
110
121
|
private resume;
|
|
111
122
|
private pushTimer;
|
|
123
|
+
/** Pending hand-back to DSH while a reply streams (see REPLY_HANDOFF_MS). */
|
|
124
|
+
private replyTimer;
|
|
112
125
|
/** An instruction the user typed into the progress card. */
|
|
113
126
|
onMessage: ((agent: CancellableAgent, text: string) => void) | undefined;
|
|
114
127
|
/** Called when control starts (before the first action), e.g. to remember the window layout. */
|
|
@@ -159,6 +172,9 @@ export declare class OverlayController {
|
|
|
159
172
|
private step;
|
|
160
173
|
/** Live model output (DSH agent/assistant-stream) for the progress card. */
|
|
161
174
|
stream(agent: unknown, frame: StreamFrame): void;
|
|
175
|
+
private replyChars;
|
|
176
|
+
private cancelReplyHandoff;
|
|
177
|
+
private handOffReply;
|
|
162
178
|
/** A tool of another plugin started (computer-use tools report their own steps). */
|
|
163
179
|
toolStarted(agent: unknown, name: string, detail: string): void;
|
|
164
180
|
private schedulePush;
|
|
@@ -195,6 +211,8 @@ export declare class OverlayController {
|
|
|
195
211
|
* screen (the agent neither sees nor clicks it).
|
|
196
212
|
*/
|
|
197
213
|
private cardIfShown;
|
|
214
|
+
/** The card's menu asked for DeepSeek Harness: bring it back as the see-through corner card. */
|
|
215
|
+
private openHost;
|
|
198
216
|
private restoreHost;
|
|
199
217
|
}
|
|
200
218
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copylee/dsh-computer-use",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
|
|
5
5
|
"icon": "assets/icon.svg",
|
|
6
6
|
"type": "module",
|