@copylee/dsh-computer-use 0.10.0 → 0.12.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 +31 -9
- package/helper/CuHelper.cs +848 -76
- package/lib/client.js +360 -100
- package/lib/index.js +860 -59
- package/lib/types/access.d.ts +2 -0
- package/lib/types/cdp.d.ts +55 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/select.d.ts +1 -1
- package/lib/types/client/window-refs.d.ts +37 -0
- package/lib/types/computer.d.ts +32 -2
- package/lib/types/diagnostics.d.ts +7 -0
- package/lib/types/helper-client.d.ts +1 -0
- package/lib/types/index.d.ts +12 -3
- package/lib/types/macros.d.ts +30 -0
- package/lib/types/overlay.d.ts +26 -2
- package/lib/types/routes.d.ts +8 -1
- package/lib/types/target.d.ts +4 -0
- package/lib/types/tools.d.ts +3 -0
- package/lib/types/update-check.d.ts +15 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -72,6 +72,7 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
overlay: true,
|
|
73
73
|
overlayLabel: "DeepSeek Harness",
|
|
74
74
|
hostWindow: "pet",
|
|
75
|
+
petSize: "standard",
|
|
75
76
|
cardOpacity: 80,
|
|
76
77
|
autoScreenshot: true,
|
|
77
78
|
autoScreenshotDetail: "standard",
|
|
@@ -81,10 +82,16 @@ window.__ModuleLoader__.load({
|
|
|
81
82
|
jpegQuality: 70,
|
|
82
83
|
blockedApps: [],
|
|
83
84
|
pauseOnUserInput: true,
|
|
85
|
+
reportUserActions: true,
|
|
84
86
|
userIdleMs: 1500,
|
|
85
87
|
typingMode: "stream",
|
|
86
88
|
quickSteps: false,
|
|
87
|
-
nativeHelper: true
|
|
89
|
+
nativeHelper: true,
|
|
90
|
+
elementFirstClick: true,
|
|
91
|
+
restorePointer: false,
|
|
92
|
+
protectPasswords: true,
|
|
93
|
+
windowChangeGuard: true,
|
|
94
|
+
cdpPort: 0
|
|
88
95
|
};
|
|
89
96
|
/** Unwrap `.volatile()` refs (`{ get() }`) and fall back to defaults for bad values. */
|
|
90
97
|
function resolveConfig(raw) {
|
|
@@ -104,6 +111,7 @@ window.__ModuleLoader__.load({
|
|
|
104
111
|
overlay: bool("overlay"),
|
|
105
112
|
overlayLabel: typeof out.overlayLabel === "string" && out.overlayLabel.trim() !== "" ? out.overlayLabel.trim().slice(0, 40) : DEFAULTS.overlayLabel,
|
|
106
113
|
hostWindow: out.hostWindow === "pet" || out.hostWindow === "card" || out.hostWindow === "minimize" || out.hostWindow === "keep" ? out.hostWindow : out.minimizeHostWindow === true ? "minimize" : DEFAULTS.hostWindow,
|
|
114
|
+
petSize: out.petSize === "compact" || out.petSize === "standard" || out.petSize === "detailed" ? out.petSize : DEFAULTS.petSize,
|
|
107
115
|
cardOpacity: num("cardOpacity", 30, 100),
|
|
108
116
|
autoScreenshot: bool("autoScreenshot"),
|
|
109
117
|
autoScreenshotDetail: out.autoScreenshotDetail === "compact" || out.autoScreenshotDetail === "standard" ? out.autoScreenshotDetail : DEFAULTS.autoScreenshotDetail,
|
|
@@ -112,9 +120,15 @@ window.__ModuleLoader__.load({
|
|
|
112
120
|
maxPixels: num("maxPixels", 3e5, 8e6),
|
|
113
121
|
jpegQuality: num("jpegQuality", 30, 100),
|
|
114
122
|
pauseOnUserInput: bool("pauseOnUserInput"),
|
|
123
|
+
reportUserActions: bool("reportUserActions"),
|
|
115
124
|
userIdleMs: num("userIdleMs", 300, 1e4),
|
|
116
125
|
quickSteps: bool("quickSteps"),
|
|
117
126
|
nativeHelper: bool("nativeHelper"),
|
|
127
|
+
elementFirstClick: bool("elementFirstClick"),
|
|
128
|
+
restorePointer: bool("restorePointer"),
|
|
129
|
+
protectPasswords: bool("protectPasswords"),
|
|
130
|
+
windowChangeGuard: bool("windowChangeGuard"),
|
|
131
|
+
cdpPort: num("cdpPort", 0, 65535),
|
|
118
132
|
typingMode: out.typingMode === "stream" || out.typingMode === "type" || out.typingMode === "paste" ? out.typingMode : DEFAULTS.typingMode,
|
|
119
133
|
blockedApps: Array.isArray(out.blockedApps) ? out.blockedApps.filter((item) => typeof item === "string" && item.trim() !== "") : []
|
|
120
134
|
};
|
|
@@ -319,7 +333,7 @@ window.__ModuleLoader__.load({
|
|
|
319
333
|
style.textContent = PILL_CSS;
|
|
320
334
|
document.head.appendChild(style);
|
|
321
335
|
}
|
|
322
|
-
function isZh() {
|
|
336
|
+
function isZh$1() {
|
|
323
337
|
if (typeof document === "undefined") return true;
|
|
324
338
|
return (document.documentElement.lang || navigator.language || "zh").toLowerCase().startsWith("zh");
|
|
325
339
|
}
|
|
@@ -393,7 +407,7 @@ window.__ModuleLoader__.load({
|
|
|
393
407
|
};
|
|
394
408
|
}, [sessionId, fetchState]);
|
|
395
409
|
if (!sessionId || hidden || !ready && cachedHidden !== false) return null;
|
|
396
|
-
const zh = isZh();
|
|
410
|
+
const zh = isZh$1();
|
|
397
411
|
const label = zh ? "电脑控制" : "Computer";
|
|
398
412
|
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
413
|
const toggle = async () => {
|
|
@@ -507,13 +521,16 @@ window.__ModuleLoader__.load({
|
|
|
507
521
|
const h$2 = react.createElement;
|
|
508
522
|
/** Menu appearance and fixed-position behavior follow dsh-free-search / dsh-proxy. */
|
|
509
523
|
const selectCss = `
|
|
510
|
-
|
|
511
|
-
.dshcu-select:
|
|
512
|
-
.dshcu-select:
|
|
513
|
-
.dshcu-select:
|
|
514
|
-
.dshcu-
|
|
515
|
-
.dshcu-
|
|
516
|
-
.dshcu-
|
|
524
|
+
@keyframes dshcu-menu-in{from{opacity:0;transform:translateY(-4px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
|
|
525
|
+
.dshcu-select{box-sizing:border-box;width:100%;height:36px;padding:0 12px;display:flex;align-items:center;gap:8px;text-align:left;border:1px solid var(--dsw-alias-border-l4,rgba(127,127,127,.28));border-radius:var(--dsw-radius-md,9px);background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;font:inherit;font-size:13px;cursor:pointer;transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease}
|
|
526
|
+
.dshcu-select:hover:not(:disabled){border-color:color-mix(in srgb,var(--cl-accent,#D97757) 55%,var(--dsw-alias-border-l3,#888));background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.05))}
|
|
527
|
+
.dshcu-select:focus-visible,.dshcu-select[aria-expanded=true]{outline:none;border-color:var(--cl-accent,#D97757);box-shadow:0 0 0 3px color-mix(in srgb,var(--cl-accent,#D97757) 20%,transparent)}
|
|
528
|
+
.dshcu-select:disabled{opacity:.48;cursor:default}
|
|
529
|
+
.dshcu-select svg{flex:none;transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
530
|
+
.dshcu-menu{position:fixed;z-index:1100;box-sizing:border-box;padding:5px;overflow-y:auto;overscroll-behavior:contain;border-radius:var(--dsw-radius-lg,12px);border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.18));background:var(--dsw-menu-surface-fill,var(--dsw-alias-bg-layer-1,#fff));color:var(--dsw-alias-label-primary,#222);backdrop-filter:var(--dsw-menu-backdrop-filter,none);box-shadow:var(--dsw-elevation-prominent,0 12px 32px rgba(0,0,0,.16),0 2px 6px rgba(0,0,0,.06));animation:dshcu-menu-in .14s cubic-bezier(.22,1,.36,1)}
|
|
531
|
+
.dshcu-option{display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 10px;box-sizing:border-box;border-radius:var(--dsw-radius-md,8px);font-size:13px;line-height:20px;cursor:pointer;user-select:none;transition:background-color .12s ease,color .12s ease}
|
|
532
|
+
.dshcu-option[data-active=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.11))}
|
|
533
|
+
.dshcu-option[aria-selected=true]{font-weight:500;color:var(--cl-accent,#D97757)}
|
|
517
534
|
`;
|
|
518
535
|
function Select({ options, value, disabled, label, onChange }) {
|
|
519
536
|
const id = react.useId();
|
|
@@ -906,6 +923,115 @@ window.__ModuleLoader__.load({
|
|
|
906
923
|
}, "刷新"), note === null ? null : h$1("span", { style: note.kind === "ok" ? S.ok : S.error }, note.text)), dir ? h$1("p", { style: S.hint }, `保存位置:${dir}(每个应用一个 .md 文件,也可以直接用编辑器改)。删除内置技能后,新建同名技能即可重新启用。`) : null);
|
|
907
924
|
}
|
|
908
925
|
//#endregion
|
|
926
|
+
//#region lib/types/client/window-refs.js
|
|
927
|
+
/**
|
|
928
|
+
* Composer `@` reference source for running Windows application windows.
|
|
929
|
+
* Uses DSH's optional `inputTriggers` service (`ctx.inject(['inputTriggers'])`)
|
|
930
|
+
* and queries the passive read-only `/api/dsh-computer-use/windows` endpoint
|
|
931
|
+
* without ever lighting up the overlay or focusing any window.
|
|
932
|
+
*/
|
|
933
|
+
const WINDOWS_ROUTE = "/api/dsh-computer-use/windows";
|
|
934
|
+
const SOURCE_NAME = "copylee-computer-use:windows";
|
|
935
|
+
const REF_PREFIX = "cu-window:";
|
|
936
|
+
function isZh() {
|
|
937
|
+
if (typeof document === "undefined") return true;
|
|
938
|
+
return (document.documentElement.lang || navigator.language || "zh").toLowerCase().startsWith("zh");
|
|
939
|
+
}
|
|
940
|
+
function formatRefText(win) {
|
|
941
|
+
return `[窗口: ${win.title.replace(/[\r\n\]]+/g, " ").trim().slice(0, 80)} | exe=${win.exe} | hwnd=${win.hwnd} | pid=${win.pid}]`;
|
|
942
|
+
}
|
|
943
|
+
function parseWindowRef(ref) {
|
|
944
|
+
if (!ref.startsWith(REF_PREFIX)) return void 0;
|
|
945
|
+
const parts = ref.slice(10).split("|");
|
|
946
|
+
const hwnd = Number.parseInt(parts[0] ?? "", 10);
|
|
947
|
+
const pid = Number.parseInt(parts[1] ?? "", 10);
|
|
948
|
+
if (!Number.isFinite(hwnd) || !Number.isFinite(pid)) return void 0;
|
|
949
|
+
return {
|
|
950
|
+
hwnd,
|
|
951
|
+
pid,
|
|
952
|
+
exe: decodeURIComponent(parts[2] ?? ""),
|
|
953
|
+
title: decodeURIComponent(parts[3] ?? "")
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function registerWindowReferenceSource(scope) {
|
|
957
|
+
const triggers = scope.inputTriggers;
|
|
958
|
+
if (typeof triggers?.registerSource !== "function") return;
|
|
959
|
+
const zh = isZh();
|
|
960
|
+
const section = zh ? "运行中的窗口" : "Running windows";
|
|
961
|
+
scope.effect(() => triggers.registerSource({
|
|
962
|
+
trigger: "@",
|
|
963
|
+
name: SOURCE_NAME,
|
|
964
|
+
showGroupTitle: false,
|
|
965
|
+
lexicon: () => [],
|
|
966
|
+
subscribeLexicon: () => () => {},
|
|
967
|
+
async candidates(_session, request) {
|
|
968
|
+
if (request?.quoted || request?.drilled) return [];
|
|
969
|
+
const narrowed = (request?.query ?? "").trim().replace(/^(窗口|应用|win|window|app)\s*[::]\s*/i, "");
|
|
970
|
+
try {
|
|
971
|
+
const res = await fetch(`${WINDOWS_ROUTE}?q=${encodeURIComponent(narrowed)}`, {
|
|
972
|
+
credentials: "same-origin",
|
|
973
|
+
cache: "no-store",
|
|
974
|
+
...request?.signal ? { signal: request.signal } : {}
|
|
975
|
+
});
|
|
976
|
+
if (!res.ok) return [];
|
|
977
|
+
const body = await res.json();
|
|
978
|
+
return (Array.isArray(body.windows) ? body.windows : []).map((win) => {
|
|
979
|
+
const shortTitle = win.title.slice(0, 48);
|
|
980
|
+
const ref = `${REF_PREFIX}${win.hwnd}|${win.pid}|${encodeURIComponent(win.exe)}|${encodeURIComponent(shortTitle)}`;
|
|
981
|
+
return {
|
|
982
|
+
name: shortTitle,
|
|
983
|
+
label: `${shortTitle}`,
|
|
984
|
+
description: `${win.exe}${win.minimized ? zh ? " · 已最小化" : " · minimized" : ""}`,
|
|
985
|
+
icon: "window",
|
|
986
|
+
section,
|
|
987
|
+
value: {
|
|
988
|
+
kind: "cu-window",
|
|
989
|
+
ref,
|
|
990
|
+
win
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
});
|
|
994
|
+
} catch {
|
|
995
|
+
return [];
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
onPick(pick) {
|
|
999
|
+
const value = pick?.candidate?.value;
|
|
1000
|
+
if (value?.kind !== "cu-window" || !value.ref || !value.win) return { text: "" };
|
|
1001
|
+
const label = value.win.title.slice(0, 32) || value.win.exe;
|
|
1002
|
+
return { insert: {
|
|
1003
|
+
source: SOURCE_NAME,
|
|
1004
|
+
ref: value.ref,
|
|
1005
|
+
label,
|
|
1006
|
+
appearance: "file",
|
|
1007
|
+
clipboardText: formatRefText(value.win)
|
|
1008
|
+
} };
|
|
1009
|
+
},
|
|
1010
|
+
codec: {
|
|
1011
|
+
clipboardText: (ref) => {
|
|
1012
|
+
const parsed = parseWindowRef(ref);
|
|
1013
|
+
return parsed ? formatRefText(parsed) : ref;
|
|
1014
|
+
},
|
|
1015
|
+
async serialize(ref, signal) {
|
|
1016
|
+
const parsed = parseWindowRef(ref);
|
|
1017
|
+
if (!parsed) return ref;
|
|
1018
|
+
try {
|
|
1019
|
+
const res = await fetch(WINDOWS_ROUTE, {
|
|
1020
|
+
credentials: "same-origin",
|
|
1021
|
+
cache: "no-store",
|
|
1022
|
+
...signal ? { signal } : {}
|
|
1023
|
+
});
|
|
1024
|
+
if (res.ok) {
|
|
1025
|
+
const live = (await res.json()).windows?.find((w) => w.hwnd === parsed.hwnd && w.pid === parsed.pid);
|
|
1026
|
+
if (live) return formatRefText(live);
|
|
1027
|
+
}
|
|
1028
|
+
} catch {}
|
|
1029
|
+
return formatRefText(parsed);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}), "computer-use: @window reference source");
|
|
1033
|
+
}
|
|
1034
|
+
//#endregion
|
|
909
1035
|
//#region lib/types/client/index.js
|
|
910
1036
|
/**
|
|
911
1037
|
* Browser half: the "电脑控制" (Computer use) section in Settings. It reads the
|
|
@@ -918,6 +1044,7 @@ window.__ModuleLoader__.load({
|
|
|
918
1044
|
const SCREENSHOTS_ROUTE = "/api/dsh-computer-use/screenshots";
|
|
919
1045
|
const SCREENSHOTS_CLEAN_ROUTE = "/api/dsh-computer-use/screenshots/clean";
|
|
920
1046
|
const DIAGNOSTICS_ROUTE = "/api/dsh-computer-use/diagnostics";
|
|
1047
|
+
const UPDATE_ROUTE = "/api/dsh-computer-use/update";
|
|
921
1048
|
const mb = (bytes) => `${(bytes / 1048576).toFixed(1)} MB`;
|
|
922
1049
|
const PREVIEW_ROUTE = "/api/dsh-computer-use/preview";
|
|
923
1050
|
const h = react.createElement;
|
|
@@ -930,17 +1057,24 @@ window.__ModuleLoader__.load({
|
|
|
930
1057
|
overlay: s.overlay,
|
|
931
1058
|
overlayLabel: s.overlayLabel,
|
|
932
1059
|
hostWindow: s.hostWindow,
|
|
1060
|
+
petSize: s.petSize,
|
|
933
1061
|
cardOpacity: s.cardOpacity,
|
|
934
1062
|
typingMode: s.typingMode,
|
|
935
1063
|
quickSteps: s.quickSteps,
|
|
936
1064
|
pauseOnUserInput: s.pauseOnUserInput,
|
|
1065
|
+
reportUserActions: s.reportUserActions,
|
|
937
1066
|
userIdleMs: String(s.userIdleMs),
|
|
938
1067
|
autoScreenshot: s.autoScreenshot,
|
|
939
1068
|
autoScreenshotDetail: s.autoScreenshotDetail,
|
|
940
1069
|
settleMs: String(s.settleMs),
|
|
941
1070
|
maxLongEdge: String(s.maxLongEdge),
|
|
942
1071
|
maxMegapixels: String(Math.round(s.maxPixels / 1e4) / 100),
|
|
943
|
-
jpegQuality: String(s.jpegQuality)
|
|
1072
|
+
jpegQuality: String(s.jpegQuality),
|
|
1073
|
+
elementFirstClick: s.elementFirstClick,
|
|
1074
|
+
restorePointer: s.restorePointer,
|
|
1075
|
+
protectPasswords: s.protectPasswords,
|
|
1076
|
+
windowChangeGuard: s.windowChangeGuard,
|
|
1077
|
+
cdpPort: String(s.cdpPort)
|
|
944
1078
|
};
|
|
945
1079
|
}
|
|
946
1080
|
/** Range-checked numbers; returns field errors keyed by Draft field. */
|
|
@@ -955,6 +1089,7 @@ window.__ModuleLoader__.load({
|
|
|
955
1089
|
check("maxLongEdge", 640, 3840);
|
|
956
1090
|
check("maxMegapixels", .3, 8);
|
|
957
1091
|
check("jpegQuality", 30, 100);
|
|
1092
|
+
check("cdpPort", 0, 65535);
|
|
958
1093
|
return errors;
|
|
959
1094
|
}
|
|
960
1095
|
function valuesFrom(d) {
|
|
@@ -966,49 +1101,94 @@ window.__ModuleLoader__.load({
|
|
|
966
1101
|
overlay: d.overlay,
|
|
967
1102
|
overlayLabel: d.overlayLabel.trim() || DEFAULTS.overlayLabel,
|
|
968
1103
|
hostWindow: d.hostWindow,
|
|
1104
|
+
petSize: d.petSize,
|
|
969
1105
|
cardOpacity: d.cardOpacity,
|
|
970
1106
|
typingMode: d.typingMode,
|
|
971
1107
|
quickSteps: d.quickSteps,
|
|
972
1108
|
pauseOnUserInput: d.pauseOnUserInput,
|
|
1109
|
+
reportUserActions: d.reportUserActions,
|
|
973
1110
|
userIdleMs: Math.round(Number(d.userIdleMs)),
|
|
974
1111
|
autoScreenshot: d.autoScreenshot,
|
|
975
1112
|
autoScreenshotDetail: d.autoScreenshotDetail,
|
|
976
1113
|
settleMs: Math.round(Number(d.settleMs)),
|
|
977
1114
|
maxLongEdge: Math.round(Number(d.maxLongEdge)),
|
|
978
1115
|
maxPixels: Math.round(Number(d.maxMegapixels) * 1e6),
|
|
979
|
-
jpegQuality: Math.round(Number(d.jpegQuality))
|
|
1116
|
+
jpegQuality: Math.round(Number(d.jpegQuality)),
|
|
1117
|
+
elementFirstClick: d.elementFirstClick,
|
|
1118
|
+
restorePointer: d.restorePointer,
|
|
1119
|
+
protectPasswords: d.protectPasswords,
|
|
1120
|
+
windowChangeGuard: d.windowChangeGuard,
|
|
1121
|
+
cdpPort: Math.round(Number(d.cdpPort))
|
|
980
1122
|
};
|
|
981
1123
|
}
|
|
1124
|
+
const settingsCss = `
|
|
1125
|
+
@keyframes dshcu-fade-in{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:translateY(0)}}
|
|
1126
|
+
.dshcu-card{display:grid;gap:14px;padding:18px 20px;border-radius:var(--dsw-radius-lg,14px);border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.2));background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.025));transition:border-color .18s ease,box-shadow .18s ease}
|
|
1127
|
+
.dshcu-card:hover{border-color:var(--dsw-alias-border-l3,rgba(127,127,127,.3))}
|
|
1128
|
+
.dshcu-row{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:8px 10px;margin:0 -10px;border-radius:10px;transition:background-color .14s ease}
|
|
1129
|
+
.dshcu-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.055))}
|
|
1130
|
+
.dshcu-divider{height:1px;background:var(--dsw-alias-border-l2,rgba(127,127,127,.14));margin:2px 0}
|
|
1131
|
+
.dshcu-switch{position:relative;flex:0 0 auto;width:42px;height:24px;border-radius:999px;border:none;padding:2px;cursor:pointer;background:var(--dsw-alias-border-l3,rgba(127,127,127,.35));transition:background-color .2s cubic-bezier(.22,1,.36,1),box-shadow .18s ease,opacity .15s}
|
|
1132
|
+
.dshcu-switch[aria-checked=true]{background:${ACCENT}}
|
|
1133
|
+
.dshcu-switch:hover:not(:disabled){box-shadow:0 0 0 3px color-mix(in srgb,${ACCENT} 16%,transparent)}
|
|
1134
|
+
.dshcu-switch:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,${ACCENT} 34%,transparent)}
|
|
1135
|
+
.dshcu-switch:disabled{opacity:.45;cursor:default}
|
|
1136
|
+
.dshcu-switch-thumb{display:block;width:20px;height:20px;border-radius:999px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.22);transform:translateX(0);transition:transform .24s cubic-bezier(.34,1.56,.64,1),width .14s ease,margin-left .14s ease}
|
|
1137
|
+
.dshcu-switch[aria-checked=true] .dshcu-switch-thumb{background:${ACCENT_INK};transform:translateX(18px)}
|
|
1138
|
+
.dshcu-switch:active:not(:disabled) .dshcu-switch-thumb{width:24px}
|
|
1139
|
+
.dshcu-switch[aria-checked=true]:active:not(:disabled) .dshcu-switch-thumb{margin-left:-4px}
|
|
1140
|
+
.dshcu-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:7px 14px;font-size:13px;font-weight:500;border-radius:var(--dsw-radius-md,9px);border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.28));background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;cursor:pointer;transition:background-color .15s ease,border-color .15s ease,transform .12s cubic-bezier(.22,1,.36,1),box-shadow .15s ease,opacity .15s}
|
|
1141
|
+
.dshcu-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.09));border-color:color-mix(in srgb,${ACCENT} 45%,var(--dsw-alias-border-l3,rgba(127,127,127,.4)));transform:translateY(-0.5px)}
|
|
1142
|
+
.dshcu-btn:active:not(:disabled){transform:translateY(0) scale(.975)}
|
|
1143
|
+
.dshcu-btn:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,${ACCENT} 25%,transparent)}
|
|
1144
|
+
.dshcu-btn:disabled{opacity:.48;cursor:default}
|
|
1145
|
+
.dshcu-btn-primary{border-color:${ACCENT};background:${ACCENT};color:${ACCENT_INK}}
|
|
1146
|
+
.dshcu-btn-primary:hover:not(:disabled){background:color-mix(in srgb,${ACCENT} 88%,#fff);border-color:${ACCENT};box-shadow:0 3px 10px color-mix(in srgb,${ACCENT} 28%,transparent)}
|
|
1147
|
+
.dshcu-input{box-sizing:border-box;width:100%;padding:8px 11px;font-size:13px;border-radius:var(--dsw-radius-md,9px);border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.28));background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;transition:border-color .16s ease,box-shadow .16s ease,background-color .16s ease}
|
|
1148
|
+
.dshcu-input:hover:not(:disabled){border-color:var(--dsw-alias-border-l3,rgba(127,127,127,.45))}
|
|
1149
|
+
.dshcu-input:focus{outline:none;border-color:${ACCENT};box-shadow:0 0 0 3px color-mix(in srgb,${ACCENT} 18%,transparent)}
|
|
1150
|
+
.dshcu-badge{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;font-size:12px;font-weight:500;border-radius:999px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.22));background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.06));color:var(--dsw-alias-label-secondary,#666)}
|
|
1151
|
+
.dshcu-metric-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,${ACCENT} 6%,transparent);border:1px solid color-mix(in srgb,${ACCENT} 18%,transparent);font-size:12px;line-height:1.5}
|
|
1152
|
+
.dshcu-toast{animation:dshcu-fade-in .18s ease}
|
|
1153
|
+
`;
|
|
982
1154
|
const S = {
|
|
983
1155
|
page: {
|
|
984
1156
|
display: "grid",
|
|
985
|
-
gap:
|
|
1157
|
+
gap: 18,
|
|
986
1158
|
maxWidth: 880,
|
|
987
|
-
paddingBottom:
|
|
1159
|
+
paddingBottom: 40,
|
|
988
1160
|
color: "var(--dsw-alias-label-primary, inherit)"
|
|
989
1161
|
},
|
|
990
1162
|
title: {
|
|
991
1163
|
margin: 0,
|
|
992
|
-
fontSize:
|
|
993
|
-
fontWeight:
|
|
1164
|
+
fontSize: 21,
|
|
1165
|
+
fontWeight: 650,
|
|
1166
|
+
letterSpacing: "-0.01em"
|
|
994
1167
|
},
|
|
995
1168
|
subtitle: {
|
|
996
1169
|
margin: "6px 0 0",
|
|
997
1170
|
fontSize: 13,
|
|
998
|
-
lineHeight: 1.
|
|
1171
|
+
lineHeight: 1.65,
|
|
999
1172
|
color: "var(--dsw-alias-label-secondary, #666)"
|
|
1000
1173
|
},
|
|
1001
1174
|
card: {
|
|
1002
1175
|
display: "grid",
|
|
1003
1176
|
gap: 14,
|
|
1004
|
-
padding:
|
|
1005
|
-
borderRadius: "var(--dsw-radius-lg,
|
|
1006
|
-
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.
|
|
1177
|
+
padding: "18px 20px",
|
|
1178
|
+
borderRadius: "var(--dsw-radius-lg, 14px)",
|
|
1179
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.2))"
|
|
1180
|
+
},
|
|
1181
|
+
cardHeader: {
|
|
1182
|
+
display: "flex",
|
|
1183
|
+
alignItems: "center",
|
|
1184
|
+
justifyContent: "space-between",
|
|
1185
|
+
gap: 10
|
|
1007
1186
|
},
|
|
1008
1187
|
cardTitle: {
|
|
1009
1188
|
margin: 0,
|
|
1010
1189
|
fontSize: 15,
|
|
1011
|
-
fontWeight: 600
|
|
1190
|
+
fontWeight: 600,
|
|
1191
|
+
letterSpacing: "-0.01em"
|
|
1012
1192
|
},
|
|
1013
1193
|
hint: {
|
|
1014
1194
|
margin: 0,
|
|
@@ -1020,32 +1200,33 @@ window.__ModuleLoader__.load({
|
|
|
1020
1200
|
display: "grid",
|
|
1021
1201
|
gap: 6,
|
|
1022
1202
|
fontSize: 13,
|
|
1023
|
-
fontWeight: 500
|
|
1203
|
+
fontWeight: 500,
|
|
1204
|
+
alignContent: "start"
|
|
1024
1205
|
},
|
|
1025
1206
|
grid2: {
|
|
1026
1207
|
display: "grid",
|
|
1027
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(
|
|
1208
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
|
|
1028
1209
|
gap: 14
|
|
1029
1210
|
},
|
|
1030
1211
|
input: {
|
|
1031
1212
|
boxSizing: "border-box",
|
|
1032
1213
|
width: "100%",
|
|
1033
|
-
padding: "8px
|
|
1214
|
+
padding: "8px 11px",
|
|
1034
1215
|
fontSize: 13,
|
|
1035
|
-
borderRadius: "var(--dsw-radius-md,
|
|
1036
|
-
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.
|
|
1216
|
+
borderRadius: "var(--dsw-radius-md, 9px)",
|
|
1217
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.28))",
|
|
1037
1218
|
background: "transparent",
|
|
1038
1219
|
color: "inherit"
|
|
1039
1220
|
},
|
|
1040
1221
|
toggleRow: {
|
|
1041
1222
|
display: "flex",
|
|
1042
|
-
gap:
|
|
1043
|
-
alignItems: "
|
|
1223
|
+
gap: 16,
|
|
1224
|
+
alignItems: "center",
|
|
1044
1225
|
justifyContent: "space-between"
|
|
1045
1226
|
},
|
|
1046
1227
|
toggleText: {
|
|
1047
1228
|
display: "grid",
|
|
1048
|
-
gap:
|
|
1229
|
+
gap: 3,
|
|
1049
1230
|
fontSize: 13,
|
|
1050
1231
|
fontWeight: 500
|
|
1051
1232
|
},
|
|
@@ -1059,14 +1240,14 @@ window.__ModuleLoader__.load({
|
|
|
1059
1240
|
},
|
|
1060
1241
|
actions: {
|
|
1061
1242
|
display: "flex",
|
|
1062
|
-
gap:
|
|
1243
|
+
gap: 8,
|
|
1063
1244
|
alignItems: "center",
|
|
1064
1245
|
flexWrap: "wrap"
|
|
1065
1246
|
},
|
|
1066
1247
|
primary: {
|
|
1067
1248
|
padding: "7px 16px",
|
|
1068
1249
|
fontSize: 13,
|
|
1069
|
-
borderRadius: "var(--dsw-radius-md,
|
|
1250
|
+
borderRadius: "var(--dsw-radius-md, 9px)",
|
|
1070
1251
|
border: `1px solid ${ACCENT}`,
|
|
1071
1252
|
background: ACCENT,
|
|
1072
1253
|
color: ACCENT_INK,
|
|
@@ -1075,8 +1256,8 @@ window.__ModuleLoader__.load({
|
|
|
1075
1256
|
secondary: {
|
|
1076
1257
|
padding: "7px 14px",
|
|
1077
1258
|
fontSize: 13,
|
|
1078
|
-
borderRadius: "var(--dsw-radius-md,
|
|
1079
|
-
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.
|
|
1259
|
+
borderRadius: "var(--dsw-radius-md, 9px)",
|
|
1260
|
+
border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.28))",
|
|
1080
1261
|
background: "transparent",
|
|
1081
1262
|
color: "inherit",
|
|
1082
1263
|
cursor: "pointer"
|
|
@@ -1085,7 +1266,9 @@ window.__ModuleLoader__.load({
|
|
|
1085
1266
|
display: "flex",
|
|
1086
1267
|
gap: 8,
|
|
1087
1268
|
alignItems: "center",
|
|
1088
|
-
|
|
1269
|
+
flexWrap: "wrap",
|
|
1270
|
+
fontSize: 13,
|
|
1271
|
+
fontWeight: 500
|
|
1089
1272
|
},
|
|
1090
1273
|
dot: {
|
|
1091
1274
|
width: 8,
|
|
@@ -1098,34 +1281,15 @@ window.__ModuleLoader__.load({
|
|
|
1098
1281
|
return h("button", {
|
|
1099
1282
|
type: "button",
|
|
1100
1283
|
role: "switch",
|
|
1284
|
+
className: "dshcu-switch",
|
|
1101
1285
|
"aria-checked": checked,
|
|
1102
1286
|
"aria-label": label,
|
|
1103
1287
|
disabled,
|
|
1104
|
-
onClick: () => onChange(!checked)
|
|
1105
|
-
|
|
1106
|
-
flex: "0 0 auto",
|
|
1107
|
-
width: 40,
|
|
1108
|
-
height: 22,
|
|
1109
|
-
borderRadius: 11,
|
|
1110
|
-
border: "none",
|
|
1111
|
-
padding: 2,
|
|
1112
|
-
cursor: disabled ? "default" : "pointer",
|
|
1113
|
-
background: checked ? ACCENT : "var(--dsw-alias-border-l3, rgba(127,127,127,.35))",
|
|
1114
|
-
opacity: disabled ? .5 : 1,
|
|
1115
|
-
transition: "background .15s"
|
|
1116
|
-
}
|
|
1117
|
-
}, h("span", { style: {
|
|
1118
|
-
display: "block",
|
|
1119
|
-
width: 18,
|
|
1120
|
-
height: 18,
|
|
1121
|
-
borderRadius: 9,
|
|
1122
|
-
background: checked ? ACCENT_INK : "#fff",
|
|
1123
|
-
transform: checked ? "translateX(18px)" : "none",
|
|
1124
|
-
transition: "transform .15s"
|
|
1125
|
-
} }));
|
|
1288
|
+
onClick: () => onChange(!checked)
|
|
1289
|
+
}, h("span", { className: "dshcu-switch-thumb" }));
|
|
1126
1290
|
}
|
|
1127
1291
|
function ToggleRow({ title, hint, checked, disabled, onChange }) {
|
|
1128
|
-
return h("div", {
|
|
1292
|
+
return h("div", { className: "dshcu-row" }, h("div", { style: S.toggleText }, title, h("span", { style: {
|
|
1129
1293
|
...S.hint,
|
|
1130
1294
|
fontWeight: 400
|
|
1131
1295
|
} }, hint)), h(Switch, {
|
|
@@ -1141,7 +1305,7 @@ window.__ModuleLoader__.load({
|
|
|
1141
1305
|
gap: 8,
|
|
1142
1306
|
alignItems: "center"
|
|
1143
1307
|
} }, h("input", {
|
|
1144
|
-
|
|
1308
|
+
className: "dshcu-input",
|
|
1145
1309
|
inputMode: "decimal",
|
|
1146
1310
|
value,
|
|
1147
1311
|
disabled,
|
|
@@ -1169,6 +1333,8 @@ window.__ModuleLoader__.load({
|
|
|
1169
1333
|
const [cache, setCache] = react.useState(null);
|
|
1170
1334
|
const [cacheBusy, setCacheBusy] = react.useState(false);
|
|
1171
1335
|
const [cacheNote, setCacheNote] = react.useState(null);
|
|
1336
|
+
const [updateBusy, setUpdateBusy] = react.useState(false);
|
|
1337
|
+
const [updateInfo, setUpdateInfo] = react.useState(null);
|
|
1172
1338
|
const load = react.useCallback(async (reset) => {
|
|
1173
1339
|
try {
|
|
1174
1340
|
const result = await ctx.remote.settings.describe();
|
|
@@ -1353,6 +1519,24 @@ window.__ModuleLoader__.load({
|
|
|
1353
1519
|
});
|
|
1354
1520
|
}
|
|
1355
1521
|
};
|
|
1522
|
+
const checkUpdate = async () => {
|
|
1523
|
+
setUpdateBusy(true);
|
|
1524
|
+
try {
|
|
1525
|
+
const response = await fetch(UPDATE_ROUTE, {
|
|
1526
|
+
credentials: "same-origin",
|
|
1527
|
+
cache: "no-store"
|
|
1528
|
+
});
|
|
1529
|
+
setUpdateInfo(await response.json());
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
setUpdateInfo({
|
|
1532
|
+
current: status?.version ?? "0.0.0",
|
|
1533
|
+
hasUpdate: false,
|
|
1534
|
+
error: error.message
|
|
1535
|
+
});
|
|
1536
|
+
} finally {
|
|
1537
|
+
setUpdateBusy(false);
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1356
1540
|
if (!loaded) return h("div", { style: S.page }, "加载中…");
|
|
1357
1541
|
const primary = status?.displays.find((d) => d.primary) ?? status?.displays[0];
|
|
1358
1542
|
const helperOk = status?.helper === "ready";
|
|
@@ -1369,28 +1553,39 @@ window.__ModuleLoader__.load({
|
|
|
1369
1553
|
maxPixels: Math.round(draftMaxPixels),
|
|
1370
1554
|
jpegQuality: Number.isFinite(draftQuality) ? Math.round(draftQuality) : DEFAULTS.jpegQuality
|
|
1371
1555
|
})) : primary?.compactShot;
|
|
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 暂停 /
|
|
1556
|
+
return h("div", { style: S.page }, h("style", null, selectCss + settingsCss), 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", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, h("div", { style: S.statusLine }, h("span", { style: {
|
|
1373
1557
|
...S.dot,
|
|
1374
|
-
background: status === null ? "#999" : helperOk ? "#
|
|
1375
|
-
|
|
1558
|
+
background: status === null ? "#999" : helperOk ? "#22c55e" : "#ef4444",
|
|
1559
|
+
boxShadow: helperOk ? "0 0 0 3px rgba(34,197,94,.2)" : void 0
|
|
1560
|
+
} }), status === null ? "无法获取状态" : helperOk ? status.controlling ? "正在操控电脑" : "控制引擎就绪" : `控制组件不可用:${status.error ?? ""}`, status?.version ? h("span", { className: "dshcu-badge" }, `v${status.version}`) : null, primary ? h("span", { className: "dshcu-badge" }, `${primary.width}×${primary.height} · ${Math.round(primary.dpi / 96 * 100)}%`) : null, status && status.displays.length > 1 ? h("span", { className: "dshcu-badge" }, `${status.displays.length} 块显示器`) : null)), updateInfo ? h("p", {
|
|
1561
|
+
className: "dshcu-toast",
|
|
1562
|
+
style: updateInfo.error ? S.error : updateInfo.hasUpdate ? S.ok : S.hint
|
|
1563
|
+
}, updateInfo.error ? `检查更新失败:${updateInfo.error}` : updateInfo.hasUpdate ? `发现新版本 v${updateInfo.latest}(当前 v${updateInfo.current},来源 ${updateInfo.source}),可在「插件」页更新。` : `已是最新版本 v${updateInfo.current}(${updateInfo.source ?? "npm"})。`) : null, h("div", { style: S.actions }, h("button", {
|
|
1376
1564
|
type: "button",
|
|
1377
|
-
|
|
1565
|
+
className: "dshcu-btn dshcu-btn-primary",
|
|
1378
1566
|
onClick: () => {
|
|
1379
1567
|
preview();
|
|
1380
1568
|
}
|
|
1381
|
-
}, "
|
|
1569
|
+
}, "预览浮层效果"), h("button", {
|
|
1382
1570
|
type: "button",
|
|
1383
|
-
|
|
1571
|
+
className: "dshcu-btn",
|
|
1384
1572
|
onClick: () => {
|
|
1385
1573
|
refreshStatus();
|
|
1386
1574
|
}
|
|
1387
1575
|
}, "刷新状态"), h("button", {
|
|
1388
1576
|
type: "button",
|
|
1389
|
-
|
|
1577
|
+
className: "dshcu-btn",
|
|
1578
|
+
disabled: updateBusy,
|
|
1579
|
+
onClick: () => {
|
|
1580
|
+
checkUpdate();
|
|
1581
|
+
}
|
|
1582
|
+
}, updateBusy ? "检查中…" : "检查更新"), h("button", {
|
|
1583
|
+
type: "button",
|
|
1584
|
+
className: "dshcu-btn",
|
|
1390
1585
|
onClick: () => {
|
|
1391
1586
|
exportDiagnostics();
|
|
1392
1587
|
}
|
|
1393
|
-
}, "导出诊断报告"), h("
|
|
1588
|
+
}, "导出诊断报告")), h("p", { style: S.hint }, "预览 4 秒:按已保存的设置显示光晕、进度卡片尺寸与按钮悬停效果;诊断报告已脱敏,不含输入文本与截图。")), h("section", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, h("h3", { style: S.cardTitle }, "会话与安全护栏")), h("div", { style: S.grid2 }, h("div", { style: S.label }, "会话启用方式", h(Select, {
|
|
1394
1589
|
label: "会话启用方式",
|
|
1395
1590
|
disabled,
|
|
1396
1591
|
value: draft.sessionMode,
|
|
@@ -1405,20 +1600,20 @@ window.__ModuleLoader__.load({
|
|
|
1405
1600
|
},
|
|
1406
1601
|
{
|
|
1407
1602
|
value: "always",
|
|
1408
|
-
label: "
|
|
1603
|
+
label: "总是开启(隐藏输入框开关)"
|
|
1409
1604
|
}
|
|
1410
1605
|
],
|
|
1411
1606
|
onChange: (value) => edit("sessionMode", value)
|
|
1412
1607
|
}), h("span", { style: {
|
|
1413
1608
|
...S.hint,
|
|
1414
1609
|
fontWeight: 400
|
|
1415
|
-
} }, draft.sessionMode === "always" ? "
|
|
1610
|
+
} }, draft.sessionMode === "always" ? "所有会话始终开启,隐藏输入框左下角「电脑控制」胶囊按钮。" : draft.sessionMode === "on" ? "新会话默认开启,保留输入框胶囊并支持 /cu 随时关闭。" : "普通对话不加载桌面工具;通过输入框胶囊或 /cu on 按需开启。")), h("div", { style: S.label }, "授权方式", h(Select, {
|
|
1416
1611
|
label: "授权方式",
|
|
1417
1612
|
disabled,
|
|
1418
1613
|
value: draft.accessMode,
|
|
1419
1614
|
options: [{
|
|
1420
1615
|
value: "per-app",
|
|
1421
|
-
label: "
|
|
1616
|
+
label: "按应用授权(每会话批准)"
|
|
1422
1617
|
}, {
|
|
1423
1618
|
value: "allow-all",
|
|
1424
1619
|
label: "全部允许(不弹审批)"
|
|
@@ -1427,10 +1622,22 @@ window.__ModuleLoader__.load({
|
|
|
1427
1622
|
}), h("span", { style: {
|
|
1428
1623
|
...S.hint,
|
|
1429
1624
|
fontWeight: 400
|
|
1430
|
-
} }, "
|
|
1625
|
+
} }, "完全权限或自动审查模式自动批准;DSH 自身窗口永远受保护。"))), h("div", { className: "dshcu-divider" }), h(ToggleRow, {
|
|
1626
|
+
title: "密码框硬保护",
|
|
1627
|
+
hint: "检测 UIA IsPassword 与 Win32 ES_PASSWORD 结构位:脱敏内容为 [password],拒绝自动输入密码。",
|
|
1628
|
+
checked: draft.protectPasswords,
|
|
1629
|
+
disabled,
|
|
1630
|
+
onChange: (value) => edit("protectPasswords", value)
|
|
1631
|
+
}), h(ToggleRow, {
|
|
1632
|
+
title: "窗口位移 / 遮挡防误点",
|
|
1633
|
+
hint: "坐标点击前核对前台窗口自上次截图后是否移动/缩放或被新弹窗遮挡,发生变化时阻止盲点。",
|
|
1634
|
+
checked: draft.windowChangeGuard,
|
|
1635
|
+
disabled,
|
|
1636
|
+
onChange: (value) => edit("windowChangeGuard", value)
|
|
1637
|
+
}), h("div", { className: "dshcu-divider" }), h("label", { style: S.label }, "禁止操控的应用", h("textarea", {
|
|
1638
|
+
className: "dshcu-input",
|
|
1431
1639
|
style: {
|
|
1432
|
-
|
|
1433
|
-
minHeight: 72,
|
|
1640
|
+
minHeight: 68,
|
|
1434
1641
|
resize: "vertical"
|
|
1435
1642
|
},
|
|
1436
1643
|
value: draft.blockedApps,
|
|
@@ -1441,14 +1648,14 @@ window.__ModuleLoader__.load({
|
|
|
1441
1648
|
}), h("span", { style: {
|
|
1442
1649
|
...S.hint,
|
|
1443
1650
|
fontWeight: 400
|
|
1444
|
-
} }, "1Password、Bitwarden、KeePass
|
|
1445
|
-
title: "
|
|
1446
|
-
hint: "
|
|
1651
|
+
} }, "1Password、Bitwarden、KeePass 等密码管理器始终内置禁止;命令解释器无法通过 open_application 启动。"))), h("section", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, h("h3", { style: S.cardTitle }, "操控外观与进度卡片")), h(ToggleRow, {
|
|
1652
|
+
title: "橙色光晕与协作光标",
|
|
1653
|
+
hint: "屏幕边缘光晕与 Codex 风格滑行光标;点击落点后短暂可进截图供模型核对。",
|
|
1447
1654
|
checked: draft.overlay,
|
|
1448
1655
|
disabled,
|
|
1449
1656
|
onChange: (value) => edit("overlay", value)
|
|
1450
1657
|
}), h("div", { style: S.grid2 }, h("label", { style: S.label }, "提示条名称", h("input", {
|
|
1451
|
-
|
|
1658
|
+
className: "dshcu-input",
|
|
1452
1659
|
value: draft.overlayLabel,
|
|
1453
1660
|
disabled,
|
|
1454
1661
|
maxLength: 40,
|
|
@@ -1456,7 +1663,7 @@ window.__ModuleLoader__.load({
|
|
|
1456
1663
|
}), h("span", { style: {
|
|
1457
1664
|
...S.hint,
|
|
1458
1665
|
fontWeight: 400
|
|
1459
|
-
} }, `显示为“${draft.overlayLabel.trim() || DEFAULTS.overlayLabel}
|
|
1666
|
+
} }, `显示为“${draft.overlayLabel.trim() || DEFAULTS.overlayLabel} 正在操控”`)), h("div", { style: S.label }, "DeepSeek Harness 窗口", h(Select, {
|
|
1460
1667
|
label: "DeepSeek Harness 窗口",
|
|
1461
1668
|
disabled,
|
|
1462
1669
|
value: draft.hostWindow,
|
|
@@ -1482,7 +1689,29 @@ window.__ModuleLoader__.load({
|
|
|
1482
1689
|
}), h("span", { style: {
|
|
1483
1690
|
...S.hint,
|
|
1484
1691
|
fontWeight: 400
|
|
1485
|
-
} }, draft.hostWindow === "pet" ? "
|
|
1692
|
+
} }, draft.hostWindow === "pet" ? "支持拖动、按钮悬停提示、暂停/停止与输入新指令;正文输出时自动切回对话。" : "操控结束或正文开始输出时,恢复 DSH 窗口。")), h("div", { style: S.label }, "迷你进度卡片尺寸", h(Select, {
|
|
1693
|
+
label: "迷你进度卡片尺寸",
|
|
1694
|
+
disabled: disabled || draft.hostWindow !== "pet",
|
|
1695
|
+
value: draft.petSize,
|
|
1696
|
+
options: [
|
|
1697
|
+
{
|
|
1698
|
+
value: "compact",
|
|
1699
|
+
label: "紧凑小卡片(最省视野 · 单行动作)"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
value: "standard",
|
|
1703
|
+
label: "标准卡片(单行思考 + 操作进度,推荐)"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
value: "detailed",
|
|
1707
|
+
label: "详情大卡片(双行思考 + 3 步时间线)"
|
|
1708
|
+
}
|
|
1709
|
+
],
|
|
1710
|
+
onChange: (value) => edit("petSize", value)
|
|
1711
|
+
}), h("span", { style: {
|
|
1712
|
+
...S.hint,
|
|
1713
|
+
fontWeight: 400
|
|
1714
|
+
} }, draft.petSize === "compact" ? "约 320px 宽,只展示当前动作与控制按钮;点展开可临时看详情。" : draft.petSize === "detailed" ? "约 484px 宽,默认展示双行思考与最近 3 步时间线(展开可达 8 步)。" : "约 420px 宽,平衡视野与信息量,展开可查看多行思考与 5 步时间线。")), h("div", { style: S.label }, "悬浮卡片透明度", h(Select, {
|
|
1486
1715
|
label: "悬浮卡片透明度",
|
|
1487
1716
|
disabled: disabled || draft.hostWindow !== "card" && draft.hostWindow !== "pet",
|
|
1488
1717
|
value: String(draft.cardOpacity),
|
|
@@ -1516,7 +1745,7 @@ window.__ModuleLoader__.load({
|
|
|
1516
1745
|
}), h("span", { style: {
|
|
1517
1746
|
...S.hint,
|
|
1518
1747
|
fontWeight: 400
|
|
1519
|
-
} }, "
|
|
1748
|
+
} }, "鼠标停在卡片上会自动变不透明,方便阅读和点击;AI 截图永远看不到卡片。")), h("div", { style: S.label }, "文字输入方式", h(Select, {
|
|
1520
1749
|
label: "文字输入方式",
|
|
1521
1750
|
disabled,
|
|
1522
1751
|
value: draft.typingMode,
|
|
@@ -1538,26 +1767,51 @@ window.__ModuleLoader__.load({
|
|
|
1538
1767
|
}), h("span", { style: {
|
|
1539
1768
|
...S.hint,
|
|
1540
1769
|
fontWeight: 400
|
|
1541
|
-
} }, "
|
|
1542
|
-
title: "操作时不深度思考(Beta)",
|
|
1543
|
-
hint: "试验功能,一般不用开。开始操作电脑后,本轮改用模型的最低思考强度,每一步快约 1 秒;任务开头的规划和之后的对话仍按会话里选的思考强度。代价:不思考时模型更容易出错、多走几步,本轮的回复文字会整段出现而不是逐字流出。目前只在 DeepSeek 官方模型上有效。",
|
|
1544
|
-
checked: draft.quickSteps,
|
|
1545
|
-
disabled,
|
|
1546
|
-
onChange: (value) => edit("quickSteps", value)
|
|
1547
|
-
})), h("section", { style: S.card }, h("h3", { style: S.cardTitle }, "让出控制"), h(ToggleRow, {
|
|
1770
|
+
} }, "短文字逐字打出;长文本流式按段落粘贴,防止编辑器自动补全打乱排版。")))), h("section", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, h("h3", { style: S.cardTitle }, "交互接管与操控体验")), h(ToggleRow, {
|
|
1548
1771
|
title: "检测到你在操作时暂停",
|
|
1549
|
-
hint: "
|
|
1772
|
+
hint: "你打字、点击鼠标或滚动滚轮时 AI 等你停手;你切换了窗口时 AI 先重新看屏幕。纯鼠标移动不会误触。",
|
|
1550
1773
|
checked: draft.pauseOnUserInput,
|
|
1551
1774
|
disabled,
|
|
1552
1775
|
onChange: (value) => edit("pauseOnUserInput", value)
|
|
1553
|
-
}), h(
|
|
1776
|
+
}), h(ToggleRow, {
|
|
1777
|
+
title: "向 AI 反馈我的接管操作",
|
|
1778
|
+
hint: "将你接管时点击的控件名称、坐标与窗口(脱敏,绝不记录输入明文与密码)告诉 AI,让它理解你的意图而不是覆盖你的操作。",
|
|
1779
|
+
checked: draft.reportUserActions,
|
|
1780
|
+
disabled: disabled || !draft.pauseOnUserInput,
|
|
1781
|
+
onChange: (value) => edit("reportUserActions", value)
|
|
1782
|
+
}), h(ToggleRow, {
|
|
1783
|
+
title: "坐标点击优先后台控件触发",
|
|
1784
|
+
hint: "坐标左键点击命中原生按钮、复选框或标签页时,优先走后台 UIA 语义触发,不移动真实鼠标也不抢焦点。",
|
|
1785
|
+
checked: draft.elementFirstClick,
|
|
1786
|
+
disabled,
|
|
1787
|
+
onChange: (value) => edit("elementFirstClick", value)
|
|
1788
|
+
}), h(ToggleRow, {
|
|
1789
|
+
title: "物理点击后还原鼠标位置",
|
|
1790
|
+
hint: "需要真实物理点击时,点击完成后立即把你的鼠标指针还原到原来的位置。",
|
|
1791
|
+
checked: draft.restorePointer,
|
|
1792
|
+
disabled,
|
|
1793
|
+
onChange: (value) => edit("restorePointer", value)
|
|
1794
|
+
}), h(ToggleRow, {
|
|
1795
|
+
title: "操作时不深度思考(Beta)",
|
|
1796
|
+
hint: "试验功能:开始操作电脑后降低本轮思考强度(每步快约 1 秒),目前仅在 DeepSeek 官方模型生效。",
|
|
1797
|
+
checked: draft.quickSteps,
|
|
1798
|
+
disabled,
|
|
1799
|
+
onChange: (value) => edit("quickSteps", value)
|
|
1800
|
+
}), h("div", { className: "dshcu-divider" }), h("div", { style: S.grid2 }, h(NumberField, {
|
|
1554
1801
|
label: "停手多久后继续",
|
|
1555
1802
|
unit: "毫秒",
|
|
1556
1803
|
value: draft.userIdleMs,
|
|
1557
1804
|
error: errors.userIdleMs,
|
|
1558
1805
|
disabled: disabled || !draft.pauseOnUserInput,
|
|
1559
1806
|
onChange: (value) => edit("userIdleMs", value)
|
|
1560
|
-
})
|
|
1807
|
+
}), h(NumberField, {
|
|
1808
|
+
label: "可选 Chromium CDP 端口(0=自动探测 9222/9229)",
|
|
1809
|
+
unit: "端口",
|
|
1810
|
+
value: draft.cdpPort,
|
|
1811
|
+
error: errors.cdpPort,
|
|
1812
|
+
disabled,
|
|
1813
|
+
onChange: (value) => edit("cdpPort", value)
|
|
1814
|
+
}))), h("section", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, h("h3", { style: S.cardTitle }, "截图与清晰度")), h(ToggleRow, {
|
|
1561
1815
|
title: "操作后自动回传截图",
|
|
1562
1816
|
hint: "省去模型再截一次图的一轮调用;关闭可省 token。画面未变化时自动跳过重复图片。",
|
|
1563
1817
|
checked: draft.autoScreenshot,
|
|
@@ -1579,7 +1833,7 @@ window.__ModuleLoader__.load({
|
|
|
1579
1833
|
...S.hint,
|
|
1580
1834
|
fontWeight: 400
|
|
1581
1835
|
} }, "紧凑档只降低操作后的自动确认截图;模型显式调用 screenshot / zoom 时仍保持标准清晰度。")), h("div", { style: S.grid2 }, h(NumberField, {
|
|
1582
|
-
label: "
|
|
1836
|
+
label: "操作后至少等待(画面静止即截图)",
|
|
1583
1837
|
unit: "毫秒",
|
|
1584
1838
|
value: draft.settleMs,
|
|
1585
1839
|
error: errors.settleMs,
|
|
@@ -1606,26 +1860,26 @@ window.__ModuleLoader__.load({
|
|
|
1606
1860
|
error: errors.jpegQuality,
|
|
1607
1861
|
disabled,
|
|
1608
1862
|
onChange: (value) => edit("jpegQuality", value)
|
|
1609
|
-
})), liveShot ? h("
|
|
1863
|
+
})), liveShot ? h("div", { className: "dshcu-metric-bar" }, h("strong", null, `主屏实际输出 ${liveShot.width}×${liveShot.height}`), h("span", { style: S.hint }, `${liveShot.megapixels} MP · ${limitLabel(liveShot.limitedBy)}${liveCompactShot ? ` | 紧凑档 ${liveCompactShot.width}×${liveCompactShot.height}(${liveCompactShot.megapixels} MP)` : ""}`)) : h("p", { style: S.hint }, "截图越大越清晰、点得越准,但每张图消耗的 token 也越多。最长边与总像素上限同时生效,取更紧的一项。")), h(SkillsCard, { S }), h("section", { className: "dshcu-card" }, h("div", { style: S.cardHeader }, 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 }, "仍在会话中的截图不会被删除。已删除会话留下的截图会在启动几分钟后及每 12 小时自动清理,也可以在此立即清理。"), h("div", { style: S.actions }, h("button", {
|
|
1610
1864
|
type: "button",
|
|
1611
|
-
|
|
1612
|
-
...S.secondary,
|
|
1613
|
-
opacity: cacheBusy || !cache?.orphans ? .5 : 1
|
|
1614
|
-
},
|
|
1865
|
+
className: "dshcu-btn",
|
|
1615
1866
|
disabled: cacheBusy || !cache?.orphans,
|
|
1616
1867
|
onClick: () => {
|
|
1617
1868
|
cleanCache();
|
|
1618
1869
|
}
|
|
1619
1870
|
}, "清理已删除会话的截图"), h("button", {
|
|
1620
1871
|
type: "button",
|
|
1621
|
-
|
|
1872
|
+
className: "dshcu-btn",
|
|
1622
1873
|
disabled: cacheBusy,
|
|
1623
1874
|
onClick: () => {
|
|
1624
1875
|
refreshCache();
|
|
1625
1876
|
}
|
|
1626
|
-
}, cacheBusy ? "统计中…" : "重新统计"), cacheNote === null ? null : h("span", {
|
|
1877
|
+
}, cacheBusy ? "统计中…" : "重新统计"), cacheNote === null ? null : h("span", {
|
|
1878
|
+
className: "dshcu-toast",
|
|
1879
|
+
style: cacheNote.kind === "ok" ? S.ok : S.error
|
|
1880
|
+
}, cacheNote.text))), h("div", { style: S.actions }, h("button", {
|
|
1627
1881
|
type: "button",
|
|
1628
|
-
|
|
1882
|
+
className: "dshcu-btn",
|
|
1629
1883
|
disabled,
|
|
1630
1884
|
onClick: () => {
|
|
1631
1885
|
setDraft(draftFrom({}));
|
|
@@ -1634,11 +1888,14 @@ window.__ModuleLoader__.load({
|
|
|
1634
1888
|
}
|
|
1635
1889
|
}, "恢复默认"), saving ? h("span", { style: S.hint }, "保存中…") : dirty && invalid ? h("span", { style: S.error }, "有数值超出范围,改好后自动保存") : failed === draft && dirty ? h("button", {
|
|
1636
1890
|
type: "button",
|
|
1637
|
-
|
|
1891
|
+
className: "dshcu-btn",
|
|
1638
1892
|
onClick: () => {
|
|
1639
1893
|
setFailed(null);
|
|
1640
1894
|
}
|
|
1641
|
-
}, "重试保存") : null, message === null || dirty && invalid ? null : h("span", {
|
|
1895
|
+
}, "重试保存") : null, message === null || dirty && invalid ? null : h("span", {
|
|
1896
|
+
className: "dshcu-toast",
|
|
1897
|
+
style: message.kind === "ok" ? S.ok : S.error
|
|
1898
|
+
}, message.text)), h(AccentPicker, null));
|
|
1642
1899
|
}
|
|
1643
1900
|
const inject = [
|
|
1644
1901
|
"slots",
|
|
@@ -1662,6 +1919,9 @@ window.__ModuleLoader__.load({
|
|
|
1662
1919
|
id: ENTRY_ID,
|
|
1663
1920
|
order: 40
|
|
1664
1921
|
}, (props) => h(ComposerPill, props)));
|
|
1922
|
+
ctx.inject?.(["inputTriggers"], (scope) => {
|
|
1923
|
+
registerWindowReferenceSource(scope);
|
|
1924
|
+
});
|
|
1665
1925
|
}
|
|
1666
1926
|
//#endregion
|
|
1667
1927
|
exports.apply = apply;
|