@copylee/dsh-computer-use 0.1.2 → 0.1.4

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.
@@ -4,39 +4,68 @@ export interface CancellableAgent {
4
4
  kind: 'user';
5
5
  }): void;
6
6
  }
7
+ export type HostWindowMode = 'card' | 'minimize' | 'keep';
7
8
  export interface OverlaySettings {
8
9
  overlay: boolean;
9
10
  overlayLabel: string;
10
- minimizeHostWindow: boolean;
11
+ hostWindow: HostWindowMode;
12
+ userIdleMs: number;
11
13
  }
14
+ interface DisplayRow {
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ workX: number;
20
+ workY: number;
21
+ workWidth: number;
22
+ workHeight: number;
23
+ primary: boolean;
24
+ dpi: number;
25
+ }
26
+ /** Card rectangle in the bottom-right corner of a display's work area. */
27
+ export declare function cardRect(display: DisplayRow): {
28
+ x: number;
29
+ y: number;
30
+ width: number;
31
+ height: number;
32
+ };
12
33
  export declare class OverlayController {
13
34
  private readonly helper;
14
35
  private readonly settings;
15
36
  private readonly log;
37
+ /** Absolute path of the pill icon (PNG). */
38
+ private readonly iconPath;
16
39
  private agent;
17
40
  private visible;
18
41
  private idleTimer;
19
- private minimizedHost;
42
+ private hostWindows;
20
43
  private stopping;
21
- constructor(helper: HelperLike, settings: () => OverlaySettings, log: (message: string) => void);
44
+ /** Paused by Esc or the pill; actions wait until resumed. */
45
+ paused: boolean;
22
46
  /** When the user last typed on the physical keyboard while the overlay was up (ms epoch). */
23
47
  lastUserInput: number;
48
+ constructor(helper: HelperLike, settings: () => OverlaySettings, log: (message: string) => void,
49
+ /** Absolute path of the pill icon (PNG). */
50
+ iconPath?: string);
51
+ /** The agent currently driving the computer, if any. */
52
+ get controller(): CancellableAgent | undefined;
24
53
  /** Did the user type after `since`? */
25
54
  userTypedSince(since: number): boolean;
26
55
  /**
27
- * If the user is typing, pause until the keyboard has been quiet for
28
- * `idleMs`. Throws after `maxMs` so the model can tell the user. Returns
29
- * whether it had to wait.
56
+ * Hold the next action while the user has paused (Esc) or is typing.
57
+ * Returns whether it had to wait, so the caller can re-check the screen.
30
58
  */
31
- waitForUserIdle(signal: AbortSignal, idleMs: number, maxMs?: number): Promise<boolean>;
32
- /** The agent currently driving the computer, if any. */
33
- get controller(): CancellableAgent | undefined;
59
+ yieldToUser(signal: AbortSignal, waitForTyping: boolean): Promise<boolean>;
34
60
  /** Called before every action: shows the overlay once and updates its status line. */
35
61
  begin(agent: CancellableAgent | undefined, status: string): Promise<void>;
62
+ status(status: string): Promise<void>;
36
63
  /** Agent finished (idle), was cancelled, or the plugin is stopping. */
37
64
  end(agent?: CancellableAgent): Promise<void>;
38
65
  private stop;
39
66
  private armIdle;
40
- private minimizeHost;
67
+ /** Card: shrink the DSH window to an always-on-top corner card; minimize: get it out of the way. */
68
+ private shrinkHost;
41
69
  private restoreHost;
42
70
  }
71
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Small HTTP bridge for the settings page: live status (helper, displays,
3
+ * resulting screenshot size) and a short overlay preview.
4
+ */
5
+ import type { IncomingMessage, ServerResponse } from 'node:http';
6
+ import { type Display } from './coords.js';
7
+ import type { Settings } from './computer.js';
8
+ import type { HelperLike } from './helper-client.js';
9
+ import type { OverlayController } from './overlay.js';
10
+ export declare const STATUS_ROUTE = "/api/dsh-computer-use/status";
11
+ export declare const PREVIEW_ROUTE = "/api/dsh-computer-use/preview";
12
+ type Handler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
13
+ export interface StatusBody {
14
+ ok: true;
15
+ platform: string;
16
+ helper: 'ready' | 'error';
17
+ error?: string;
18
+ displays: Array<Display & {
19
+ shot: {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ }>;
24
+ controlling: boolean;
25
+ }
26
+ export declare function statusRoute(helper: HelperLike, settings: () => Settings, overlay: OverlayController): Handler;
27
+ /** Show the overlay for a few seconds so the user can see how it looks (skipped while an agent is controlling). */
28
+ export declare function previewRoute(helper: HelperLike, settings: () => Settings, overlay: OverlayController, iconPath: string): Handler;
29
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Plugin settings shared by the host and the settings page: defaults and the
3
+ * tolerant reader for the Loader entry config. No schemastery here so the
4
+ * browser bundle stays small.
5
+ */
6
+ import type { Settings } from './computer.js';
7
+ /** The Loader entry id (settings namespace); see cordis.patch.yml. */
8
+ export declare const ENTRY_ID = "copylee-computer-use";
9
+ export declare const DEFAULTS: Settings;
10
+ /** Unwrap `.volatile()` refs (`{ get() }`) and fall back to defaults for bad values. */
11
+ export declare function resolveConfig(raw: unknown): Settings;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@copylee/dsh-computer-use",
3
- "version": "0.1.2",
4
- "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek 正在使用你的电脑”,按 Esc 立即停止。",
3
+ "version": "0.1.4",
4
+ "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
5
5
  "type": "module",
6
6
  "author": "copylee",
7
7
  "repository": {
@@ -19,12 +19,18 @@
19
19
  "types": "./lib/types/index.d.ts",
20
20
  "default": "./lib/index.js"
21
21
  },
22
+ "./client": {
23
+ "types": "./lib/types/client/index.d.ts",
24
+ "default": "./lib/client.js"
25
+ },
22
26
  "./package.json": "./package.json"
23
27
  },
24
28
  "files": [
25
29
  "lib/index.js",
30
+ "lib/client.js",
26
31
  "lib/types/**/*.d.ts",
27
32
  "helper/CuHelper.cs",
33
+ "helper/deepseek-white.png",
28
34
  "cordis.patch.yml",
29
35
  "README.md",
30
36
  "LICENSE"
@@ -38,6 +44,15 @@
38
44
  },
39
45
  "engines": {
40
46
  "dsh": ">=0.2.0-rc.2"
47
+ },
48
+ "client": {
49
+ "inject": [
50
+ "@deepseek-ai/dsh-client-connection",
51
+ "@deepseek-ai/dsh-api-remotes",
52
+ "@deepseek-ai/dsh-client-ui-settings",
53
+ "@deepseek-ai/dsh-client-locale"
54
+ ],
55
+ "platform": "web"
41
56
  }
42
57
  },
43
58
  "scripts": {
@@ -69,7 +84,8 @@
69
84
  ],
70
85
  "peerDependencies": {
71
86
  "@deepseek-ai/cordis": ">=4.0.0 <5",
72
- "@deepseek-ai/schemastery": ">=3.18.0 <4"
87
+ "@deepseek-ai/schemastery": ">=3.18.0 <4",
88
+ "react": ">=18.2.0 <19"
73
89
  },
74
90
  "peerDependenciesMeta": {
75
91
  "@deepseek-ai/cordis": {
@@ -77,17 +93,23 @@
77
93
  },
78
94
  "@deepseek-ai/schemastery": {
79
95
  "optional": true
96
+ },
97
+ "react": {
98
+ "optional": true
80
99
  }
81
100
  },
82
101
  "devDependencies": {
83
102
  "@deepseek-ai/cordis": "4.0.4",
84
103
  "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
85
104
  "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
105
+ "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
86
106
  "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
87
107
  "@deepseek-ai/dsh-session": "0.2.0-rc.2",
88
108
  "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
89
109
  "@deepseek-ai/schemastery": "3.18.4",
90
110
  "@types/node": "^22.20.0",
111
+ "@types/react": "~18.3.31",
112
+ "react": "^18.3.1",
91
113
  "tsdown": "^0.22.2",
92
114
  "typescript": "^6.0.3",
93
115
  "vitest": "^4.1.8"