@copylee/dsh-computer-use 0.8.8 → 0.10.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/helper/CuHelper.cs +657 -23
- package/lib/client.js +325 -4
- package/lib/index.js +931 -74
- package/lib/native-worker.js +41 -8
- package/lib/types/access.d.ts +5 -0
- package/lib/types/client/composer-pill.d.ts +19 -0
- package/lib/types/computer.d.ts +78 -12
- package/lib/types/coords.d.ts +12 -0
- package/lib/types/diagnostics.d.ts +71 -0
- package/lib/types/index.d.ts +7 -1
- package/lib/types/routes.d.ts +13 -5
- package/lib/types/sessions.d.ts +58 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -28,6 +28,32 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let react = require("react");
|
|
30
30
|
react = __toESM(react, 1);
|
|
31
|
+
//#region lib/types/coords.js
|
|
32
|
+
/** Output size together with which limit (`longEdge`, `pixels`, or neither) actually constrained it. */
|
|
33
|
+
function describeScreenshotSize(display, limits) {
|
|
34
|
+
const { width, height } = display;
|
|
35
|
+
const edgeScale = limits.maxLongEdge / Math.max(width, height);
|
|
36
|
+
const pixelScale = Math.sqrt(limits.maxPixels / (width * height));
|
|
37
|
+
const scale = Math.min(1, edgeScale, pixelScale);
|
|
38
|
+
const limitedBy = scale >= 1 ? "none" : pixelScale < edgeScale ? "pixels" : "longEdge";
|
|
39
|
+
const outWidth = Math.max(1, Math.round(width * scale));
|
|
40
|
+
const outHeight = Math.max(1, Math.round(height * scale));
|
|
41
|
+
return {
|
|
42
|
+
width: outWidth,
|
|
43
|
+
height: outHeight,
|
|
44
|
+
megapixels: Math.round(outWidth * outHeight / 1e4) / 100,
|
|
45
|
+
limitedBy
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Lower-cost screenshot budget for quick confirmation shots (~30–40% fewer bytes). */
|
|
49
|
+
function compactLimits(budget) {
|
|
50
|
+
return {
|
|
51
|
+
maxLongEdge: Math.max(640, Math.min(budget.maxLongEdge, Math.round(budget.maxLongEdge * .78))),
|
|
52
|
+
maxPixels: Math.max(3e5, Math.min(budget.maxPixels, Math.round(budget.maxPixels * .58))),
|
|
53
|
+
jpegQuality: Math.max(45, Math.min(budget.jpegQuality, budget.jpegQuality - 8))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
31
57
|
//#region lib/types/browser-host.js
|
|
32
58
|
function httpOrigin(value) {
|
|
33
59
|
try {
|
|
@@ -41,11 +67,14 @@ window.__ModuleLoader__.load({
|
|
|
41
67
|
const ENTRY_ID = "copylee-computer-use";
|
|
42
68
|
const DEFAULTS = {
|
|
43
69
|
accessMode: "per-app",
|
|
70
|
+
sessionMode: "off",
|
|
71
|
+
defaultSessionEnabled: false,
|
|
44
72
|
overlay: true,
|
|
45
73
|
overlayLabel: "DeepSeek Harness",
|
|
46
74
|
hostWindow: "pet",
|
|
47
75
|
cardOpacity: 80,
|
|
48
76
|
autoScreenshot: true,
|
|
77
|
+
autoScreenshotDetail: "standard",
|
|
49
78
|
settleMs: 400,
|
|
50
79
|
maxLongEdge: 1366,
|
|
51
80
|
maxPixels: 115e4,
|
|
@@ -66,14 +95,18 @@ window.__ModuleLoader__.load({
|
|
|
66
95
|
return typeof value === "number" && Number.isFinite(value) ? Math.min(max, Math.max(min, Math.round(value))) : DEFAULTS[key];
|
|
67
96
|
};
|
|
68
97
|
const bool = (key) => typeof out[key] === "boolean" ? out[key] : DEFAULTS[key];
|
|
98
|
+
const sessionMode = out.sessionMode === "off" || out.sessionMode === "on" || out.sessionMode === "always" ? out.sessionMode : out.defaultSessionEnabled === true ? "on" : DEFAULTS.sessionMode;
|
|
69
99
|
return {
|
|
70
100
|
harnessUrl: typeof out.harnessUrl === "string" ? httpOrigin(out.harnessUrl.trim()) : void 0,
|
|
71
101
|
accessMode: out.accessMode === "allow-all" || out.accessMode === "per-app" ? out.accessMode : DEFAULTS.accessMode,
|
|
102
|
+
sessionMode,
|
|
103
|
+
defaultSessionEnabled: sessionMode !== "off",
|
|
72
104
|
overlay: bool("overlay"),
|
|
73
105
|
overlayLabel: typeof out.overlayLabel === "string" && out.overlayLabel.trim() !== "" ? out.overlayLabel.trim().slice(0, 40) : DEFAULTS.overlayLabel,
|
|
74
106
|
hostWindow: out.hostWindow === "pet" || out.hostWindow === "card" || out.hostWindow === "minimize" || out.hostWindow === "keep" ? out.hostWindow : out.minimizeHostWindow === true ? "minimize" : DEFAULTS.hostWindow,
|
|
75
107
|
cardOpacity: num("cardOpacity", 30, 100),
|
|
76
108
|
autoScreenshot: bool("autoScreenshot"),
|
|
109
|
+
autoScreenshotDetail: out.autoScreenshotDetail === "compact" || out.autoScreenshotDetail === "standard" ? out.autoScreenshotDetail : DEFAULTS.autoScreenshotDetail,
|
|
77
110
|
settleMs: num("settleMs", 0, 5e3),
|
|
78
111
|
maxLongEdge: num("maxLongEdge", 640, 3840),
|
|
79
112
|
maxPixels: num("maxPixels", 3e5, 8e6),
|
|
@@ -218,6 +251,196 @@ window.__ModuleLoader__.load({
|
|
|
218
251
|
} }, hint ? `${name(accent)} · ${hint}` : name(accent)));
|
|
219
252
|
}
|
|
220
253
|
//#endregion
|
|
254
|
+
//#region lib/types/client/composer-pill.js
|
|
255
|
+
/**
|
|
256
|
+
* Per-session computer-use toggle pill rendered in the conversation composer's
|
|
257
|
+
* left tool row (`conversation.input.left`). Clicking turns computer-use tools
|
|
258
|
+
* and system-prompt guidance on or off for the current session without restart.
|
|
259
|
+
*/
|
|
260
|
+
const SESSION_ROUTE = "/api/dsh-computer-use/session";
|
|
261
|
+
const STYLE_ID = "copylee-computer-use-composer-pill";
|
|
262
|
+
const h$3 = react.createElement;
|
|
263
|
+
/** Client-side cache so switching between sessions does not flash stale state. */
|
|
264
|
+
const cache = /* @__PURE__ */ new Map();
|
|
265
|
+
/** Remember whether Settings hides the pill ("总是开启" mode) so remounts do not flash it. */
|
|
266
|
+
let cachedHidden;
|
|
267
|
+
const PILL_CSS = `
|
|
268
|
+
.cl-cu-pill {
|
|
269
|
+
display: inline-flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
gap: 5px;
|
|
272
|
+
height: 28px;
|
|
273
|
+
padding: 0 10px;
|
|
274
|
+
border-radius: 999px;
|
|
275
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, .28));
|
|
276
|
+
background: transparent;
|
|
277
|
+
color: var(--dsw-alias-label-secondary, #666);
|
|
278
|
+
font-size: 12px;
|
|
279
|
+
line-height: 1;
|
|
280
|
+
font-weight: 500;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
white-space: nowrap;
|
|
283
|
+
flex: none;
|
|
284
|
+
transition: background-color .12s, border-color .12s, color .12s, opacity .12s;
|
|
285
|
+
}
|
|
286
|
+
.cl-cu-pill:hover:not(:disabled) {
|
|
287
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, .08));
|
|
288
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
289
|
+
}
|
|
290
|
+
.cl-cu-pill[data-active="true"] {
|
|
291
|
+
border-color: color-mix(in srgb, ${ACCENT} 55%, transparent);
|
|
292
|
+
background: color-mix(in srgb, ${ACCENT} 12%, transparent);
|
|
293
|
+
color: ${ACCENT};
|
|
294
|
+
}
|
|
295
|
+
.cl-cu-pill[data-active="true"]:hover:not(:disabled) {
|
|
296
|
+
background: color-mix(in srgb, ${ACCENT} 18%, transparent);
|
|
297
|
+
}
|
|
298
|
+
.cl-cu-pill:focus-visible {
|
|
299
|
+
outline: 2px solid ${ACCENT};
|
|
300
|
+
outline-offset: 2px;
|
|
301
|
+
}
|
|
302
|
+
.cl-cu-pill:disabled {
|
|
303
|
+
opacity: .55;
|
|
304
|
+
cursor: default;
|
|
305
|
+
}
|
|
306
|
+
.cl-cu-pill-dot {
|
|
307
|
+
width: 6px;
|
|
308
|
+
height: 6px;
|
|
309
|
+
border-radius: 999px;
|
|
310
|
+
background: currentColor;
|
|
311
|
+
flex: none;
|
|
312
|
+
}
|
|
313
|
+
`;
|
|
314
|
+
function ensureStyle() {
|
|
315
|
+
if (typeof document === "undefined") return;
|
|
316
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
317
|
+
const style = document.createElement("style");
|
|
318
|
+
style.id = STYLE_ID;
|
|
319
|
+
style.textContent = PILL_CSS;
|
|
320
|
+
document.head.appendChild(style);
|
|
321
|
+
}
|
|
322
|
+
function isZh() {
|
|
323
|
+
if (typeof document === "undefined") return true;
|
|
324
|
+
return (document.documentElement.lang || navigator.language || "zh").toLowerCase().startsWith("zh");
|
|
325
|
+
}
|
|
326
|
+
function MonitorIcon() {
|
|
327
|
+
return h$3("svg", {
|
|
328
|
+
width: 14,
|
|
329
|
+
height: 14,
|
|
330
|
+
viewBox: "0 0 16 16",
|
|
331
|
+
fill: "none",
|
|
332
|
+
stroke: "currentColor",
|
|
333
|
+
strokeWidth: 1.4,
|
|
334
|
+
strokeLinecap: "round",
|
|
335
|
+
strokeLinejoin: "round",
|
|
336
|
+
"aria-hidden": "true"
|
|
337
|
+
}, h$3("rect", {
|
|
338
|
+
x: 1.75,
|
|
339
|
+
y: 2.5,
|
|
340
|
+
width: 12.5,
|
|
341
|
+
height: 8.5,
|
|
342
|
+
rx: 1.5
|
|
343
|
+
}), h$3("path", { d: "M5.5 13.5h5M8 11v2.5" }));
|
|
344
|
+
}
|
|
345
|
+
function createComposerPill(subscribeSettings) {
|
|
346
|
+
return function ComposerPill(props) {
|
|
347
|
+
const sessionId = typeof props?.sessionId === "string" && props.sessionId.trim() !== "" ? props.sessionId : void 0;
|
|
348
|
+
const [enabled, setEnabled] = react.useState(() => sessionId ? cache.get(sessionId) ?? false : false);
|
|
349
|
+
const [hidden, setHidden] = react.useState(() => cachedHidden === true);
|
|
350
|
+
const [ready, setReady] = react.useState(() => sessionId ? cache.has(sessionId) && cachedHidden !== void 0 : false);
|
|
351
|
+
const [busy, setBusy] = react.useState(false);
|
|
352
|
+
react.useEffect(() => {
|
|
353
|
+
ensureStyle();
|
|
354
|
+
}, []);
|
|
355
|
+
const fetchState = react.useCallback(async (id, cancelled) => {
|
|
356
|
+
try {
|
|
357
|
+
const res = await fetch(`${SESSION_ROUTE}?sessionId=${encodeURIComponent(id)}`, {
|
|
358
|
+
credentials: "same-origin",
|
|
359
|
+
cache: "no-store"
|
|
360
|
+
});
|
|
361
|
+
if (!res.ok) return;
|
|
362
|
+
const body = await res.json();
|
|
363
|
+
if (cancelled.current) return;
|
|
364
|
+
const value = body.enabled === true;
|
|
365
|
+
const hidePill = body.alwaysOn === true || body.showPill === false;
|
|
366
|
+
cache.set(id, value);
|
|
367
|
+
cachedHidden = hidePill;
|
|
368
|
+
setEnabled(value);
|
|
369
|
+
setHidden(hidePill);
|
|
370
|
+
setReady(true);
|
|
371
|
+
} catch {
|
|
372
|
+
if (!cancelled.current) setReady(true);
|
|
373
|
+
}
|
|
374
|
+
}, []);
|
|
375
|
+
react.useEffect(() => {
|
|
376
|
+
if (!sessionId) return;
|
|
377
|
+
const cancelled = { current: false };
|
|
378
|
+
if (cache.has(sessionId) && cachedHidden !== void 0) {
|
|
379
|
+
setEnabled(cache.get(sessionId));
|
|
380
|
+
setHidden(cachedHidden);
|
|
381
|
+
setReady(true);
|
|
382
|
+
} else {
|
|
383
|
+
setEnabled(false);
|
|
384
|
+
setReady(false);
|
|
385
|
+
}
|
|
386
|
+
fetchState(sessionId, cancelled);
|
|
387
|
+
const unsub = subscribeSettings?.(() => {
|
|
388
|
+
fetchState(sessionId, cancelled);
|
|
389
|
+
});
|
|
390
|
+
return () => {
|
|
391
|
+
cancelled.current = true;
|
|
392
|
+
unsub?.();
|
|
393
|
+
};
|
|
394
|
+
}, [sessionId, fetchState]);
|
|
395
|
+
if (!sessionId || hidden || !ready && cachedHidden !== false) return null;
|
|
396
|
+
const zh = isZh();
|
|
397
|
+
const label = zh ? "电脑控制" : "Computer";
|
|
398
|
+
const title = enabled ? zh ? "当前会话已开启电脑控制,点击关闭" : "Computer use is enabled for this session (click to disable)" : zh ? "当前会话未开启电脑控制,点击开启" : "Computer use is disabled for this session (click to enable)";
|
|
399
|
+
const toggle = async () => {
|
|
400
|
+
if (busy) return;
|
|
401
|
+
const next = !enabled;
|
|
402
|
+
setBusy(true);
|
|
403
|
+
setEnabled(next);
|
|
404
|
+
cache.set(sessionId, next);
|
|
405
|
+
try {
|
|
406
|
+
const res = await fetch(SESSION_ROUTE, {
|
|
407
|
+
method: "POST",
|
|
408
|
+
credentials: "same-origin",
|
|
409
|
+
headers: { "content-type": "application/json" },
|
|
410
|
+
body: JSON.stringify({
|
|
411
|
+
sessionId,
|
|
412
|
+
enabled: next
|
|
413
|
+
})
|
|
414
|
+
});
|
|
415
|
+
if (!res.ok) throw new Error("toggle failed");
|
|
416
|
+
const settled = (await res.json()).enabled === true;
|
|
417
|
+
cache.set(sessionId, settled);
|
|
418
|
+
setEnabled(settled);
|
|
419
|
+
} catch {
|
|
420
|
+
cache.set(sessionId, !next);
|
|
421
|
+
setEnabled(!next);
|
|
422
|
+
} finally {
|
|
423
|
+
setBusy(false);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
return h$3("button", {
|
|
427
|
+
type: "button",
|
|
428
|
+
className: "cl-cu-pill",
|
|
429
|
+
"data-active": enabled ? "true" : "false",
|
|
430
|
+
"aria-pressed": enabled,
|
|
431
|
+
"aria-label": title,
|
|
432
|
+
title,
|
|
433
|
+
disabled: busy || !ready,
|
|
434
|
+
onClick: () => {
|
|
435
|
+
toggle();
|
|
436
|
+
}
|
|
437
|
+
}, h$3(MonitorIcon, null), h$3("span", null, label), enabled ? h$3("span", {
|
|
438
|
+
className: "cl-cu-pill-dot",
|
|
439
|
+
"aria-hidden": "true"
|
|
440
|
+
}) : null);
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
221
444
|
//#region lib/types/client/nav-icon.js
|
|
222
445
|
/**
|
|
223
446
|
* Give the "电脑控制" row in the DSH settings navigation a mouse-pointer icon
|
|
@@ -694,6 +917,7 @@ window.__ModuleLoader__.load({
|
|
|
694
917
|
const STATUS_ROUTE = "/api/dsh-computer-use/status";
|
|
695
918
|
const SCREENSHOTS_ROUTE = "/api/dsh-computer-use/screenshots";
|
|
696
919
|
const SCREENSHOTS_CLEAN_ROUTE = "/api/dsh-computer-use/screenshots/clean";
|
|
920
|
+
const DIAGNOSTICS_ROUTE = "/api/dsh-computer-use/diagnostics";
|
|
697
921
|
const mb = (bytes) => `${(bytes / 1048576).toFixed(1)} MB`;
|
|
698
922
|
const PREVIEW_ROUTE = "/api/dsh-computer-use/preview";
|
|
699
923
|
const h = react.createElement;
|
|
@@ -701,6 +925,7 @@ window.__ModuleLoader__.load({
|
|
|
701
925
|
const s = resolveConfig(value);
|
|
702
926
|
return {
|
|
703
927
|
accessMode: s.accessMode,
|
|
928
|
+
sessionMode: s.sessionMode,
|
|
704
929
|
blockedApps: s.blockedApps.join("\n"),
|
|
705
930
|
overlay: s.overlay,
|
|
706
931
|
overlayLabel: s.overlayLabel,
|
|
@@ -711,6 +936,7 @@ window.__ModuleLoader__.load({
|
|
|
711
936
|
pauseOnUserInput: s.pauseOnUserInput,
|
|
712
937
|
userIdleMs: String(s.userIdleMs),
|
|
713
938
|
autoScreenshot: s.autoScreenshot,
|
|
939
|
+
autoScreenshotDetail: s.autoScreenshotDetail,
|
|
714
940
|
settleMs: String(s.settleMs),
|
|
715
941
|
maxLongEdge: String(s.maxLongEdge),
|
|
716
942
|
maxMegapixels: String(Math.round(s.maxPixels / 1e4) / 100),
|
|
@@ -734,6 +960,8 @@ window.__ModuleLoader__.load({
|
|
|
734
960
|
function valuesFrom(d) {
|
|
735
961
|
return {
|
|
736
962
|
accessMode: d.accessMode,
|
|
963
|
+
sessionMode: d.sessionMode,
|
|
964
|
+
defaultSessionEnabled: d.sessionMode !== "off",
|
|
737
965
|
blockedApps: d.blockedApps.split(/[\n,,]/).map((item) => item.trim()).filter(Boolean),
|
|
738
966
|
overlay: d.overlay,
|
|
739
967
|
overlayLabel: d.overlayLabel.trim() || DEFAULTS.overlayLabel,
|
|
@@ -744,6 +972,7 @@ window.__ModuleLoader__.load({
|
|
|
744
972
|
pauseOnUserInput: d.pauseOnUserInput,
|
|
745
973
|
userIdleMs: Math.round(Number(d.userIdleMs)),
|
|
746
974
|
autoScreenshot: d.autoScreenshot,
|
|
975
|
+
autoScreenshotDetail: d.autoScreenshotDetail,
|
|
747
976
|
settleMs: Math.round(Number(d.settleMs)),
|
|
748
977
|
maxLongEdge: Math.round(Number(d.maxLongEdge)),
|
|
749
978
|
maxPixels: Math.round(Number(d.maxMegapixels) * 1e6),
|
|
@@ -1096,9 +1325,50 @@ window.__ModuleLoader__.load({
|
|
|
1096
1325
|
});
|
|
1097
1326
|
}
|
|
1098
1327
|
};
|
|
1328
|
+
const exportDiagnostics = async () => {
|
|
1329
|
+
try {
|
|
1330
|
+
const response = await fetch(DIAGNOSTICS_ROUTE, {
|
|
1331
|
+
credentials: "same-origin",
|
|
1332
|
+
cache: "no-store"
|
|
1333
|
+
});
|
|
1334
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1335
|
+
const text = await response.text();
|
|
1336
|
+
const blob = new Blob([text], { type: "text/plain;charset=utf-8" });
|
|
1337
|
+
const url = URL.createObjectURL(blob);
|
|
1338
|
+
const a = document.createElement("a");
|
|
1339
|
+
a.href = url;
|
|
1340
|
+
a.download = `dsh-computer-use-diagnostics-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.txt`;
|
|
1341
|
+
document.body.appendChild(a);
|
|
1342
|
+
a.click();
|
|
1343
|
+
a.remove();
|
|
1344
|
+
URL.revokeObjectURL(url);
|
|
1345
|
+
setMessage({
|
|
1346
|
+
kind: "ok",
|
|
1347
|
+
text: "已导出脱敏诊断报告(不含输入文本、剪贴板和截图)"
|
|
1348
|
+
});
|
|
1349
|
+
} catch (error) {
|
|
1350
|
+
setMessage({
|
|
1351
|
+
kind: "error",
|
|
1352
|
+
text: `导出诊断失败:${error.message}`
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1099
1356
|
if (!loaded) return h("div", { style: S.page }, "加载中…");
|
|
1100
1357
|
const primary = status?.displays.find((d) => d.primary) ?? status?.displays[0];
|
|
1101
1358
|
const helperOk = status?.helper === "ready";
|
|
1359
|
+
const limitLabel = (by) => by === "pixels" ? "受限于总像素上限" : by === "longEdge" ? "受限于最长边" : "未缩放";
|
|
1360
|
+
const draftMaxEdge = Number(draft.maxLongEdge);
|
|
1361
|
+
const draftMaxPixels = Number(draft.maxMegapixels) * 1e6;
|
|
1362
|
+
const draftQuality = Number(draft.jpegQuality);
|
|
1363
|
+
const liveShot = primary && Number.isFinite(draftMaxEdge) && draftMaxEdge >= 640 && Number.isFinite(draftMaxPixels) && draftMaxPixels >= 3e5 ? describeScreenshotSize(primary, {
|
|
1364
|
+
maxLongEdge: Math.round(draftMaxEdge),
|
|
1365
|
+
maxPixels: Math.round(draftMaxPixels)
|
|
1366
|
+
}) : primary?.shot;
|
|
1367
|
+
const liveCompactShot = primary && Number.isFinite(draftMaxEdge) && draftMaxEdge >= 640 && Number.isFinite(draftMaxPixels) && draftMaxPixels >= 3e5 ? describeScreenshotSize(primary, compactLimits({
|
|
1368
|
+
maxLongEdge: Math.round(draftMaxEdge),
|
|
1369
|
+
maxPixels: Math.round(draftMaxPixels),
|
|
1370
|
+
jpegQuality: Number.isFinite(draftQuality) ? Math.round(draftQuality) : DEFAULTS.jpegQuality
|
|
1371
|
+
})) : primary?.compactShot;
|
|
1102
1372
|
return h("div", { style: S.page }, h("style", null, selectCss), h("div", null, h("h2", { style: S.title }, "电脑控制"), h("p", { style: S.subtitle }, "让 AI 看屏幕、点鼠标、敲键盘操控这台 Windows 电脑。操控时屏幕四周泛起橙色光晕;按 Esc 暂停 / 继续,点提示条上的“停止”结束本轮。")), view === void 0 ? h("div", { style: S.error }, "没有找到本插件的设置项(插件可能未启用)。") : null, view !== void 0 && !writable ? h("div", { style: S.error }, "当前设置为只读。") : null, h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "运行状态"), h("div", { style: S.statusLine }, h("span", { style: {
|
|
1103
1373
|
...S.dot,
|
|
1104
1374
|
background: status === null ? "#999" : helperOk ? "#2a2" : "#d33"
|
|
@@ -1114,7 +1384,35 @@ window.__ModuleLoader__.load({
|
|
|
1114
1384
|
onClick: () => {
|
|
1115
1385
|
refreshStatus();
|
|
1116
1386
|
}
|
|
1117
|
-
}, "刷新状态"), h("
|
|
1387
|
+
}, "刷新状态"), h("button", {
|
|
1388
|
+
type: "button",
|
|
1389
|
+
style: S.secondary,
|
|
1390
|
+
onClick: () => {
|
|
1391
|
+
exportDiagnostics();
|
|
1392
|
+
}
|
|
1393
|
+
}, "导出诊断报告"), h("span", { style: S.hint }, "预览 4 秒:按已保存的设置显示光晕与提示条/进度卡片;诊断报告已脱敏,不含输入文本与截图。"))), h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "授权"), h("div", { style: S.label }, "会话启用方式", h(Select, {
|
|
1394
|
+
label: "会话启用方式",
|
|
1395
|
+
disabled,
|
|
1396
|
+
value: draft.sessionMode,
|
|
1397
|
+
options: [
|
|
1398
|
+
{
|
|
1399
|
+
value: "off",
|
|
1400
|
+
label: "按会话开启(默认关闭,推荐)"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
value: "on",
|
|
1404
|
+
label: "新会话默认开启(保留输入框开关)"
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
value: "always",
|
|
1408
|
+
label: "总是开启(所有会话启用,隐藏输入框开关)"
|
|
1409
|
+
}
|
|
1410
|
+
],
|
|
1411
|
+
onChange: (value) => edit("sessionMode", value)
|
|
1412
|
+
}), h("span", { style: {
|
|
1413
|
+
...S.hint,
|
|
1414
|
+
fontWeight: 400
|
|
1415
|
+
} }, draft.sessionMode === "always" ? "所有会话始终开启电脑控制,不再在输入框左下角显示「电脑控制」胶囊按钮,界面更简洁。" : draft.sessionMode === "on" ? "新会话默认开启电脑控制;仍会在输入框左下角显示「电脑控制」胶囊,可针对单个会话关闭或用 /cu 切换。" : "普通对话默认不加载桌面工具与系统提示;需要在输入框左下角点击「电脑控制」胶囊或输入 /cu on 为当前会话按需开启,子代理自动继承。")), h("div", { style: S.label }, "授权方式", h(Select, {
|
|
1118
1416
|
label: "授权方式",
|
|
1119
1417
|
disabled,
|
|
1120
1418
|
value: draft.accessMode,
|
|
@@ -1261,11 +1559,26 @@ window.__ModuleLoader__.load({
|
|
|
1261
1559
|
onChange: (value) => edit("userIdleMs", value)
|
|
1262
1560
|
}))), h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "截图"), h(ToggleRow, {
|
|
1263
1561
|
title: "操作后自动回传截图",
|
|
1264
|
-
hint: "省去模型再截一次图的一轮调用;关闭可省 token
|
|
1562
|
+
hint: "省去模型再截一次图的一轮调用;关闭可省 token。画面未变化时自动跳过重复图片。",
|
|
1265
1563
|
checked: draft.autoScreenshot,
|
|
1266
1564
|
disabled,
|
|
1267
1565
|
onChange: (value) => edit("autoScreenshot", value)
|
|
1268
|
-
}), h("div", { style: S.
|
|
1566
|
+
}), h("div", { style: S.label }, "自动回传截图清晰度", h(Select, {
|
|
1567
|
+
label: "自动回传截图清晰度",
|
|
1568
|
+
disabled: disabled || !draft.autoScreenshot,
|
|
1569
|
+
value: draft.autoScreenshotDetail,
|
|
1570
|
+
options: [{
|
|
1571
|
+
value: "standard",
|
|
1572
|
+
label: "标准(与下方分辨率一致)"
|
|
1573
|
+
}, {
|
|
1574
|
+
value: "compact",
|
|
1575
|
+
label: "紧凑(自动降一档,省约 30%–40% 字节)"
|
|
1576
|
+
}],
|
|
1577
|
+
onChange: (value) => edit("autoScreenshotDetail", value)
|
|
1578
|
+
}), h("span", { style: {
|
|
1579
|
+
...S.hint,
|
|
1580
|
+
fontWeight: 400
|
|
1581
|
+
} }, "紧凑档只降低操作后的自动确认截图;模型显式调用 screenshot / zoom 时仍保持标准清晰度。")), h("div", { style: S.grid2 }, h(NumberField, {
|
|
1269
1582
|
label: "操作后至少等待(之后画面静止即截图,最多约 2.5 秒)",
|
|
1270
1583
|
unit: "毫秒",
|
|
1271
1584
|
value: draft.settleMs,
|
|
@@ -1293,7 +1606,7 @@ window.__ModuleLoader__.load({
|
|
|
1293
1606
|
error: errors.jpegQuality,
|
|
1294
1607
|
disabled,
|
|
1295
1608
|
onChange: (value) => edit("jpegQuality", value)
|
|
1296
|
-
})), h("p", { style: S.hint }, "截图越大越清晰、点得越准,但每张图消耗的 token
|
|
1609
|
+
})), liveShot ? h("p", { style: S.hint }, `当前主屏实际输出:${liveShot.width}×${liveShot.height}(${liveShot.megapixels} MP,${limitLabel(liveShot.limitedBy)})${liveCompactShot ? `;紧凑档:${liveCompactShot.width}×${liveCompactShot.height}(${liveCompactShot.megapixels} MP)` : ""}。最长边与总像素上限同时生效,取更紧的一项。`) : h("p", { style: S.hint }, "截图越大越清晰、点得越准,但每张图消耗的 token 也越多。最长边与总像素上限同时生效,取更紧的一项;默认值(最长边 1366、1.15 百万像素)适合大多数模型。")), h(SkillsCard, { S }), h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "截图缓存"), h("p", { style: S.hint }, cache === null ? cacheBusy ? "正在统计…" : "无法统计截图缓存。" : !cache.ok ? `统计失败:${cache.error ?? ""}` : `本插件的截图共 ${cache.count} 张,占用 ${mb(cache.bytes)};其中 ${cache.orphans} 张(${mb(cache.orphanBytes)})所属会话已删除,可以安全清理。`), h("p", { style: S.hint }, "截图作为附件保存在会话历史里。仍在会话中的截图不会被删除:删除后继续那个会话会直接报错。删除会话后,它留下的截图会在启动 DeepSeek Harness 几分钟后及之后每 12 小时自动清理,也可以在这里立即清理。"), h("div", { style: S.actions }, h("button", {
|
|
1297
1610
|
type: "button",
|
|
1298
1611
|
style: {
|
|
1299
1612
|
...S.secondary,
|
|
@@ -1341,6 +1654,14 @@ window.__ModuleLoader__.load({
|
|
|
1341
1654
|
order: 61,
|
|
1342
1655
|
label: () => "电脑控制"
|
|
1343
1656
|
}, () => h(ComputerUseSection, { ctx })));
|
|
1657
|
+
const ComposerPill = createComposerPill((listener) => ctx.remote.$on?.("settings/document-updated", (ns) => {
|
|
1658
|
+
if (ns === "copylee-computer-use") listener();
|
|
1659
|
+
}));
|
|
1660
|
+
ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
1661
|
+
name: "conversation.input.left",
|
|
1662
|
+
id: ENTRY_ID,
|
|
1663
|
+
order: 40
|
|
1664
|
+
}, (props) => h(ComposerPill, props)));
|
|
1344
1665
|
}
|
|
1345
1666
|
//#endregion
|
|
1346
1667
|
exports.apply = apply;
|