@copylee/dsh-computer-use 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
- # 🖱️ dsh-computer-use
1
+ # dsh-computer-use
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@copylee/dsh-computer-use)](https://www.npmjs.com/package/@copylee/dsh-computer-use)
4
4
 
5
5
  让 DeepSeek Harness 直接操控你的 Windows 电脑:看屏幕、点鼠标、敲键盘,打开应用、切换窗口、读写剪贴板。控制期间屏幕四周会泛起**橙色光晕**,顶部出现“**DeepSeek Harness 正在操控你的电脑**”提示条,DeepSeek Harness 自己最小化,右下角换成一张**迷你进度卡片**,两行滚动显示 AI 的回复正文和思考 / 工具调用,让你同时看清操作过程和 AI 在想什么。按 **Esc** 暂停 / 继续,点“停止”结束本轮。
6
6
 
7
+ 仅支持 Windows。
8
+
9
+ ## 功能
10
+
7
11
  | 功能 | 说明 |
8
12
  |---|---|
9
13
  | 截图即坐标系 | 模型只用最近一张截图的像素坐标,DPI、缩放、多显示器偏移全部由插件换算,高分屏(200% 缩放)也点得准 |
@@ -12,7 +16,7 @@
12
16
  | 按应用授权 | 先 `request_access` 列出要操控的应用,经 DSH 原生审批后才能操作;也可改为“全部允许” |
13
17
  | 不会操作自己 | 永远拒绝向 DeepSeek Harness 自身窗口输入;常见密码管理器默认禁止,可再自定义禁用列表 |
14
18
  | 正在控制的提示 | 橙色光晕 + 胶囊提示条(显示当前动作),**不会出现在截图里** |
15
- | 迷你进度卡片(默认) | 操控期间 DeepSeek Harness 最小化,右下角显示一张半透明小卡片:标题行有 DeepSeek 图标和 ✎ 输入 / ⌃ 展开 / ⏸ 暂停 / ■ 停止 四个圆形按钮;第一行滚动显示回复正文(实时流式),第二行显示思考过程,或最近几步的小时间线(✓ 打开 Word › ✓ 输入正文 › 另存为)。点 ⌃ 展开成长卡片:多行回复、思考、最近 5 步时间线。点 ✎ 在卡片下方弹出输入框,AI 自动暂停,输入指令按 Enter 发送(与在 DSH 里插话一样,AI 下一步就会看到),Esc 取消。任务结束时卡片显示“已完成”几秒再消失(鼠标停在上面会一直保留)。卡片可拖动、跟随系统深浅色,AI 的截图里看不到它,点击也会穿透它。操控中你把 DSH 窗口打开,它会自动变成下面的半透明悬浮卡片,不会挡住 AI |
19
+ | 迷你进度卡片(默认) | 操控期间 DeepSeek Harness 最小化,右下角显示一张半透明小卡片:标题行有 DeepSeek 图标和“输入”“展开”“暂停”“停止”四个圆形按钮;第一行滚动显示回复正文(实时流式),第二行显示思考过程,或最近几步的小时间线(已完成的步骤打勾,如“打开 Word › 输入正文 › 另存为”)。点“展开”变成长卡片:多行回复、思考、最近 5 步时间线。点“输入”在卡片下方弹出输入框,AI 自动暂停,输入指令按 Enter 发送(与在 DSH 里插话一样,AI 下一步就会看到),Esc 取消。任务结束时卡片显示“已完成”几秒再消失(鼠标停在上面会一直保留)。卡片可拖动、跟随系统深浅色,AI 的截图里看不到它,点击也会穿透它。操控中你把 DSH 窗口打开,它会自动变成下面的半透明悬浮卡片,不会挡住 AI |
16
20
  | 悬浮卡片 | 操控期间 DeepSeek Harness 窗口缩成右下角置顶卡片,结束后自动恢复原尺寸、位置和最大化 / 最小化状态(也可选最小化或不动)。卡片只给你看:AI 的截图里看到的是卡片下面的内容(通过 Windows 放大镜接口截图时把卡片排除在外,不闪烁;该接口不可用时退回为截图瞬间让卡片透明约 20 毫秒),点击和滚动也直接穿透卡片,卡片不会挪位置。卡片默认 80% 不透明,可以透过它看清下面的操作过程;鼠标在卡片上停一下就变回不透明,方便阅读和点击(透明度可在设置里调) |
17
21
  | 暂停与停止 | 你亲手按 **Esc** 暂停(AI 停在下一步之前),再按 Esc 或点“继续”恢复,对话不会被中断;点“停止”才结束本轮。插件自己发出的 Esc 不会误触发 |
18
22
  | 你随时可以插手 | 你用键盘打字时 AI 自动暂停,停手 1.5 秒后继续(单按 Shift / Ctrl 等修饰键不算);你切换或打开了别的窗口,AI 下一步不会盲目执行,而是先看新截图再决定。你只是点进 DSH 卡片看对话时不算切换,AI 的按键会自动回到它正在操作的窗口。鼠标移动不会触发,避免误触 |
@@ -37,7 +41,7 @@ dsh plugin --profile web add @copylee/dsh-computer-use@latest
37
41
 
38
42
  > 如果之前装过其他 computer-use 插件或 skill(例如 `dsh-computer-use-win`、Hermes 的 computer-use skill),建议先停用,避免工具和说明互相冲突。
39
43
 
40
- ## 用法
44
+ ## 使用
41
45
 
42
46
  直接说要做什么就行,例如:
43
47
 
@@ -81,6 +85,7 @@ dsh plugin --profile web add @copylee/dsh-computer-use@latest
81
85
  | 文字输入方式 | 流式 | 流式(长文本逐段出现)/ 逐字输入(最像打字,最慢)/ 一次粘贴(最快) |
82
86
  | 键盘静止多久后恢复 | 1500 ms | |
83
87
  | 禁止操控的应用 | 空 | 名称或 exe,如 `alipay` |
88
+ | 强调色 | 陶土橙 | 陶土橙 / 蓝色 / 黑色,决定设置页主按钮和开关的颜色,与 copylee 的其他插件共用同一个选择。操控时的橙色光晕不随它变化 |
84
89
 
85
90
  ## 数据与隐私
86
91
 
@@ -115,15 +120,6 @@ pnpm pack:check
115
120
 
116
121
  本地联调:DSH 桌面版“添加插件”里填本仓库目录路径即可(以 link 方式安装),改完 `pnpm build` 后重启 DSH 生效。
117
122
 
118
- ### 发版
119
-
120
- 推送版本 tag 后,GitHub Actions(`.github/workflows/publish.yml`)通过 npm Trusted Publishing 自动发布并附带 provenance:
121
-
122
- ```bash
123
- # 先把 package.json 的 version 改成新版本并合并到 main
124
- git tag v0.1.1 && git push origin v0.1.1
125
- ```
126
-
127
- ## License
123
+ ## 许可证
128
124
 
129
125
  MIT
package/lib/client.js CHANGED
@@ -74,6 +74,137 @@ window.__ModuleLoader__.load({
74
74
  };
75
75
  }
76
76
  //#endregion
77
+ //#region lib/types/client/accent.js
78
+ /**
79
+ * The accent colour shared by the copylee DSH plugins (docs/ui-spec.md).
80
+ *
81
+ * One choice — terracotta orange by default, blue or black — is kept in the
82
+ * browser under a key every plugin reads, and painted as two CSS variables on
83
+ * `<body>`, where the Host keeps its own theme variables. A plugin's styles
84
+ * only ever write `var(--cl-accent)` / `var(--cl-accent-ink)`, so changing the
85
+ * colour in any plugin's settings recolours all of them at once.
86
+ *
87
+ * This file is identical in every plugin; change it in all of them together.
88
+ */
89
+ const ACCENTS = {
90
+ orange: {
91
+ name: "陶土橙",
92
+ accent: "#D97757",
93
+ ink: "#FFFFFF"
94
+ },
95
+ blue: {
96
+ name: "蓝色",
97
+ accent: "#3D63E6",
98
+ ink: "#FFFFFF"
99
+ },
100
+ black: {
101
+ name: "黑色",
102
+ accent: "var(--dsw-alias-label-primary, #1F1E1D)",
103
+ ink: "var(--dsw-alias-bg-base, #FFFFFF)"
104
+ }
105
+ };
106
+ const ACCENT_IDS = Object.keys(ACCENTS);
107
+ const DEFAULT_ACCENT = "orange";
108
+ /** Use these in styles; the fallbacks cover the moment before the first paint. */
109
+ const ACCENT = `var(--cl-accent, ${ACCENTS[DEFAULT_ACCENT].accent})`;
110
+ const ACCENT_INK = `var(--cl-accent-ink, ${ACCENTS[DEFAULT_ACCENT].ink})`;
111
+ const KEY = "copylee.dsh.accent";
112
+ const EVENT = "copylee-dsh-accent";
113
+ function isAccent(value) {
114
+ return typeof value === "string" && Object.hasOwn(ACCENTS, value);
115
+ }
116
+ /** The choice made in this browser, or null while none has been made. */
117
+ function storedAccent() {
118
+ try {
119
+ const stored = localStorage.getItem(KEY);
120
+ return isAccent(stored) ? stored : null;
121
+ } catch {
122
+ return null;
123
+ }
124
+ }
125
+ function readAccent() {
126
+ return storedAccent() ?? "orange";
127
+ }
128
+ function paint() {
129
+ const colors = ACCENTS[readAccent()];
130
+ document.body?.style.setProperty("--cl-accent", colors.accent);
131
+ document.body?.style.setProperty("--cl-accent-ink", colors.ink);
132
+ }
133
+ /** Choose the accent for every plugin. */
134
+ function writeAccent(accent) {
135
+ try {
136
+ localStorage.setItem(KEY, accent);
137
+ } catch {}
138
+ paint();
139
+ window.dispatchEvent(new Event(EVENT));
140
+ }
141
+ /** Paint the current accent and keep it current. Returns the undo for plugin disposal. */
142
+ function installAccent() {
143
+ if (typeof document === "undefined") return () => {};
144
+ paint();
145
+ if (document.body === null) document.addEventListener("DOMContentLoaded", paint, { once: true });
146
+ window.addEventListener(EVENT, paint);
147
+ window.addEventListener("storage", paint);
148
+ return () => {
149
+ window.removeEventListener(EVENT, paint);
150
+ window.removeEventListener("storage", paint);
151
+ };
152
+ }
153
+ function useAccent() {
154
+ const [accent, setAccent] = react.useState(readAccent);
155
+ react.useEffect(() => {
156
+ const sync = () => setAccent(readAccent());
157
+ window.addEventListener(EVENT, sync);
158
+ window.addEventListener("storage", sync);
159
+ return () => {
160
+ window.removeEventListener(EVENT, sync);
161
+ window.removeEventListener("storage", sync);
162
+ };
163
+ }, []);
164
+ return [accent, writeAccent];
165
+ }
166
+ /** A row of round swatches: one of them is always chosen. */
167
+ function AccentPicker({ label = "强调色", hint = "对 copylee 的全部插件生效", names }) {
168
+ const [accent, choose] = useAccent();
169
+ const h = react.createElement;
170
+ const name = (id) => names?.[id] ?? ACCENTS[id].name;
171
+ return h("div", { style: {
172
+ display: "flex",
173
+ alignItems: "center",
174
+ gap: 10,
175
+ fontSize: 13,
176
+ flexWrap: "wrap"
177
+ } }, h("span", { style: { fontWeight: 500 } }, label), h("span", {
178
+ role: "radiogroup",
179
+ "aria-label": label,
180
+ style: {
181
+ display: "inline-flex",
182
+ gap: 8
183
+ }
184
+ }, ...ACCENT_IDS.map((id) => h("button", {
185
+ key: id,
186
+ type: "button",
187
+ role: "radio",
188
+ "aria-checked": accent === id,
189
+ "aria-label": name(id),
190
+ title: name(id),
191
+ onClick: () => choose(id),
192
+ style: {
193
+ width: 18,
194
+ height: 18,
195
+ padding: 0,
196
+ borderRadius: "50%",
197
+ cursor: "pointer",
198
+ background: ACCENTS[id].accent,
199
+ border: "2px solid var(--dsw-alias-bg-base, #fff)",
200
+ boxShadow: accent === id ? "0 0 0 2px var(--dsw-alias-label-primary, #1F1E1D)" : "0 0 0 1px var(--dsw-alias-border-l2, rgba(127,127,127,.35))"
201
+ }
202
+ }))), h("span", { style: {
203
+ fontSize: 12,
204
+ color: "var(--dsw-alias-label-tertiary, #888)"
205
+ } }, `${name(accent)} · ${hint}`));
206
+ }
207
+ //#endregion
77
208
  //#region lib/types/client/nav-icon.js
78
209
  /**
79
210
  * Give the "电脑控制" row in the DSH settings navigation a mouse-pointer icon
@@ -140,7 +271,7 @@ window.__ModuleLoader__.load({
140
271
  const selectCss = `
141
272
  .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,.3));border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;font:inherit;font-size:13px;cursor:pointer}
142
273
  .dshcu-select:hover{border-color:var(--dsw-alias-border-l3,#888)}
143
- .dshcu-select:focus-visible,.dshcu-select[aria-expanded=true]{outline:2px solid var(--dsw-alias-state-business-primary,#2f7cff);outline-offset:2px}
274
+ .dshcu-select:focus-visible,.dshcu-select[aria-expanded=true]{outline:2px solid var(--cl-accent,#D97757);outline-offset:2px}
144
275
  .dshcu-select:disabled{opacity:.5;cursor:default}
145
276
  .dshcu-menu{position:fixed;z-index:1100;box-sizing:border-box;padding:4px;overflow-y:auto;overscroll-behavior:contain;border-radius:var(--dsw-radius-lg,12px);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 10px 32px rgba(0,0,0,.16),0 0 0 .5px rgba(0,0,0,.1))}
146
277
  .dshcu-option{display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 8px;box-sizing:border-box;border-radius:var(--dsw-radius-md,8px);font-size:13px;line-height:20px;cursor:pointer;user-select:none}
@@ -690,9 +821,9 @@ window.__ModuleLoader__.load({
690
821
  padding: "7px 16px",
691
822
  fontSize: 13,
692
823
  borderRadius: "var(--dsw-radius-md, 8px)",
693
- border: "1px solid #D97757",
694
- background: "#D97757",
695
- color: "#fff",
824
+ border: `1px solid ${ACCENT}`,
825
+ background: ACCENT,
826
+ color: ACCENT_INK,
696
827
  cursor: "pointer"
697
828
  },
698
829
  secondary: {
@@ -733,7 +864,7 @@ window.__ModuleLoader__.load({
733
864
  border: "none",
734
865
  padding: 2,
735
866
  cursor: disabled ? "default" : "pointer",
736
- background: checked ? "#D97757" : "var(--dsw-alias-border-l3, rgba(127,127,127,.35))",
867
+ background: checked ? ACCENT : "var(--dsw-alias-border-l3, rgba(127,127,127,.35))",
737
868
  opacity: disabled ? .5 : 1,
738
869
  transition: "background .15s"
739
870
  }
@@ -742,7 +873,7 @@ window.__ModuleLoader__.load({
742
873
  width: 18,
743
874
  height: 18,
744
875
  borderRadius: 9,
745
- background: "#fff",
876
+ background: checked ? ACCENT_INK : "#fff",
746
877
  transform: checked ? "translateX(18px)" : "none",
747
878
  transition: "transform .15s"
748
879
  } }));
@@ -1160,7 +1291,7 @@ window.__ModuleLoader__.load({
1160
1291
  setDirty(true);
1161
1292
  setMessage(null);
1162
1293
  }
1163
- }, "恢复默认"), dirty ? h("span", { style: S.hint }, "有未保存的修改") : null, message === null ? null : h("span", { style: message.kind === "ok" ? S.ok : S.error }, message.text)));
1294
+ }, "恢复默认"), dirty ? h("span", { style: S.hint }, "有未保存的修改") : null, message === null ? null : h("span", { style: message.kind === "ok" ? S.ok : S.error }, message.text)), h(AccentPicker, null));
1164
1295
  }
1165
1296
  const inject = [
1166
1297
  "slots",
@@ -1168,6 +1299,7 @@ window.__ModuleLoader__.load({
1168
1299
  "remote.settings"
1169
1300
  ];
1170
1301
  function apply(ctx) {
1302
+ ctx.effect(() => installAccent(), "computer-use: accent colour");
1171
1303
  ctx.effect(() => registerNavIcon("电脑控制"), "computer-use: settings nav icon");
1172
1304
  ctx.slots.inject("settings.section", () => ctx.slots.register({
1173
1305
  name: "settings.section",
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The accent colour shared by the copylee DSH plugins (docs/ui-spec.md).
3
+ *
4
+ * One choice — terracotta orange by default, blue or black — is kept in the
5
+ * browser under a key every plugin reads, and painted as two CSS variables on
6
+ * `<body>`, where the Host keeps its own theme variables. A plugin's styles
7
+ * only ever write `var(--cl-accent)` / `var(--cl-accent-ink)`, so changing the
8
+ * colour in any plugin's settings recolours all of them at once.
9
+ *
10
+ * This file is identical in every plugin; change it in all of them together.
11
+ */
12
+ import * as React from 'react';
13
+ export type Accent = 'orange' | 'blue' | 'black';
14
+ export declare const ACCENTS: Record<Accent, {
15
+ name: string;
16
+ accent: string;
17
+ ink: string;
18
+ }>;
19
+ export declare const ACCENT_IDS: Accent[];
20
+ export declare const DEFAULT_ACCENT: Accent;
21
+ /** Use these in styles; the fallbacks cover the moment before the first paint. */
22
+ export declare const ACCENT: string;
23
+ export declare const ACCENT_INK: string;
24
+ export declare function isAccent(value: unknown): value is Accent;
25
+ /** The choice made in this browser, or null while none has been made. */
26
+ export declare function storedAccent(): Accent | null;
27
+ export declare function readAccent(): Accent;
28
+ /** Choose the accent for every plugin. */
29
+ export declare function writeAccent(accent: Accent): void;
30
+ /** Paint the current accent and keep it current. Returns the undo for plugin disposal. */
31
+ export declare function installAccent(): () => void;
32
+ export declare function useAccent(): [Accent, (accent: Accent) => void];
33
+ /** A row of round swatches: one of them is always chosen. */
34
+ export declare function AccentPicker({ label, hint, names }: {
35
+ label?: string;
36
+ hint?: string;
37
+ /** Colour names in the page's language; the built-in ones are Chinese. */
38
+ names?: Partial<Record<Accent, string>>;
39
+ }): React.ReactElement;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  /** Menu appearance and fixed-position behavior follow dsh-free-search / dsh-proxy. */
3
- export declare const selectCss = "\n.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,.3));border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;font:inherit;font-size:13px;cursor:pointer}\n.dshcu-select:hover{border-color:var(--dsw-alias-border-l3,#888)}\n.dshcu-select:focus-visible,.dshcu-select[aria-expanded=true]{outline:2px solid var(--dsw-alias-state-business-primary,#2f7cff);outline-offset:2px}\n.dshcu-select:disabled{opacity:.5;cursor:default}\n.dshcu-menu{position:fixed;z-index:1100;box-sizing:border-box;padding:4px;overflow-y:auto;overscroll-behavior:contain;border-radius:var(--dsw-radius-lg,12px);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 10px 32px rgba(0,0,0,.16),0 0 0 .5px rgba(0,0,0,.1))}\n.dshcu-option{display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 8px;box-sizing:border-box;border-radius:var(--dsw-radius-md,8px);font-size:13px;line-height:20px;cursor:pointer;user-select:none}\n.dshcu-option[data-active=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}\n";
3
+ export declare const selectCss = "\n.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,.3));border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-3,transparent);color:inherit;font:inherit;font-size:13px;cursor:pointer}\n.dshcu-select:hover{border-color:var(--dsw-alias-border-l3,#888)}\n.dshcu-select:focus-visible,.dshcu-select[aria-expanded=true]{outline:2px solid var(--cl-accent,#D97757);outline-offset:2px}\n.dshcu-select:disabled{opacity:.5;cursor:default}\n.dshcu-menu{position:fixed;z-index:1100;box-sizing:border-box;padding:4px;overflow-y:auto;overscroll-behavior:contain;border-radius:var(--dsw-radius-lg,12px);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 10px 32px rgba(0,0,0,.16),0 0 0 .5px rgba(0,0,0,.1))}\n.dshcu-option{display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 8px;box-sizing:border-box;border-radius:var(--dsw-radius-md,8px);font-size:13px;line-height:20px;cursor:pointer;user-select:none}\n.dshcu-option[data-active=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}\n";
4
4
  export declare function Select<V extends string>({ options, value, disabled, label, onChange }: {
5
5
  options: {
6
6
  value: V;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copylee/dsh-computer-use",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
5
5
  "type": "module",
6
6
  "author": "copylee",