@copylee/dsh-computer-use 0.2.1 → 0.4.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.
@@ -8,6 +8,8 @@ export interface Settings {
8
8
  overlay: boolean;
9
9
  overlayLabel: string;
10
10
  hostWindow: HostWindowMode;
11
+ /** Card opacity in percent while controlling (it turns opaque when the pointer rests on it). */
12
+ cardOpacity: number;
11
13
  maxLongEdge: number;
12
14
  maxPixels: number;
13
15
  jpegQuality: number;
@@ -17,7 +19,10 @@ export interface Settings {
17
19
  pauseOnUserInput: boolean;
18
20
  /** How long the keyboard must be quiet before resuming. */
19
21
  userIdleMs: number;
22
+ /** How text is entered: stream = paste block by block, type = key by key, paste = at once. */
23
+ typingMode: TypingMode;
20
24
  }
25
+ export type TypingMode = 'stream' | 'type' | 'paste';
21
26
  export interface WindowInfo extends WindowLike {
22
27
  hwnd: number;
23
28
  pid: number;
@@ -122,6 +127,18 @@ export declare class Computer {
122
127
  settle(signal: AbortSignal): Promise<void>;
123
128
  windowAt(point: Point): Promise<WindowInfo | undefined>;
124
129
  windows(): Promise<WindowInfo[]>;
130
+ /** Windows when control started (hwnd -> minimized), and windows brought back from the tray since. */
131
+ private before;
132
+ private readonly fromTray;
133
+ /** Remember the window layout at the start of a task, to tell what the agent opened or restored. */
134
+ noteStart(): Promise<void>;
135
+ noteFromTray(hwnd: number): void;
136
+ /** How a window relates to the layout before the task: opened by the agent, or restored from minimized / tray. */
137
+ origin(win: WindowInfo): 'opened' | 'minimized' | 'tray' | undefined;
138
+ /** Programs running without any visible window (closed to the system tray); `tray` = has a tray icon. */
139
+ backgroundApps(): Promise<Array<WindowInfo & {
140
+ tray: boolean;
141
+ }>>;
125
142
  cursor(): Promise<Point>;
126
143
  /** Short description of the frontmost window, for result text. */
127
144
  describeForeground(): Promise<string>;
@@ -132,6 +149,15 @@ export declare class Computer {
132
149
  static statusOf(input: ActionInput): string;
133
150
  /** Run one action. Returns text plus an image for screenshot/zoom. */
134
151
  run(input: ActionInput, call: CallContext): Promise<ActionOutcome>;
152
+ /**
153
+ * Enter text the way the settings ask. Long text is pasted (literally: typing
154
+ * Markdown key by key trips editors' auto-formatting); in stream mode block
155
+ * by block so the user watches it appear. Between pieces the user can pause
156
+ * (Esc / typing); if another window comes to the front meanwhile, stop.
157
+ */
158
+ private enterText;
159
+ /** Run `step` per piece; between pieces yield to the user and make sure the target window is still in front. */
160
+ private pieces;
135
161
  /** Release a mouse button left down by an aborted run. */
136
162
  releaseHeld(): Promise<void>;
137
163
  /**
@@ -1,12 +1,7 @@
1
- /**
2
- * @copylee/dsh-computer-use host bundle: Claude-style computer use for the
3
- * Windows desktop — screenshots in, mouse and keyboard out, per-app grants
4
- * through DSH approvals, and an orange "DeepSeek is using your computer"
5
- * overlay that a physical Esc dismisses.
6
- */
7
1
  import type { Context } from '@deepseek-ai/cordis';
8
2
  import z from '@deepseek-ai/schemastery';
9
3
  import { type AccessMode } from './access.js';
4
+ import { type TypingMode } from './computer.js';
10
5
  import { type HostWindowMode } from './overlay.js';
11
6
  export { DEFAULTS, ENTRY_ID, resolveConfig } from './settings.js';
12
7
  export declare const name = "@copylee/dsh-computer-use";
@@ -16,6 +11,7 @@ export interface Config {
16
11
  overlay?: boolean;
17
12
  overlayLabel?: string;
18
13
  hostWindow?: HostWindowMode;
14
+ cardOpacity?: number;
19
15
  /** @deprecated replaced by hostWindow: 'minimize' */
20
16
  minimizeHostWindow?: boolean;
21
17
  autoScreenshot?: boolean;
@@ -26,6 +22,7 @@ export interface Config {
26
22
  blockedApps?: string[];
27
23
  pauseOnUserInput?: boolean;
28
24
  userIdleMs?: number;
25
+ typingMode?: TypingMode;
29
26
  }
30
27
  export declare const Config: z<Config>;
31
28
  export declare function apply(ctx: Context, config?: Config): void;
@@ -4,11 +4,23 @@ export interface CancellableAgent {
4
4
  kind: 'user';
5
5
  }): void;
6
6
  }
7
- export type HostWindowMode = 'card' | 'minimize' | 'keep';
7
+ export type HostWindowMode = 'pet' | 'card' | 'minimize' | 'keep';
8
+ /** The slice of a DSH assistant-stream frame the progress card reads. */
9
+ export interface StreamFrame {
10
+ type: string;
11
+ chunk?: {
12
+ type: string;
13
+ text?: string;
14
+ name?: string;
15
+ };
16
+ }
17
+ /** Markdown reduced to one plain line for the progress card. */
18
+ export declare function plainLine(text: string): string;
8
19
  export interface OverlaySettings {
9
20
  overlay: boolean;
10
21
  overlayLabel: string;
11
22
  hostWindow: HostWindowMode;
23
+ cardOpacity: number;
12
24
  userIdleMs: number;
13
25
  }
14
26
  interface DisplayRow {
@@ -41,6 +53,22 @@ export declare class OverlayController {
41
53
  private idleTimer;
42
54
  private hostWindows;
43
55
  private stopping;
56
+ /** Progress card lines: the reply as it streams, and what the agent is doing. */
57
+ private streamAgent;
58
+ private text;
59
+ private thinking;
60
+ /** Recent steps (tool actions), oldest first. */
61
+ private steps;
62
+ /** Whether the agent is thinking now (newer than the last step). */
63
+ private thinkingLatest;
64
+ private freshAttempt;
65
+ private pushTimer;
66
+ /** An instruction the user typed into the progress card. */
67
+ onMessage: ((agent: CancellableAgent, text: string) => void) | undefined;
68
+ /** Called when control starts (before the first action), e.g. to remember the window layout. */
69
+ onStart: (() => Promise<void>) | undefined;
70
+ /** Opacity the card was last given, to apply setting changes while it floats. */
71
+ private cardOpacity;
44
72
  /** Paused by Esc or the pill; actions wait until resumed. */
45
73
  paused: boolean;
46
74
  /** When the user last typed on the physical keyboard while the overlay was up (ms epoch). */
@@ -62,12 +90,25 @@ export declare class OverlayController {
62
90
  /** Called before every action: shows the overlay once and updates its status line. */
63
91
  begin(agent: CancellableAgent | undefined, status: string): Promise<void>;
64
92
  status(status: string): Promise<void>;
93
+ /** One more step on the card's timeline. */
94
+ private step;
95
+ /** Live model output (DSH agent/assistant-stream) for the progress card. */
96
+ stream(agent: unknown, frame: StreamFrame): void;
97
+ /** A tool of another plugin started (computer-use tools report their own steps). */
98
+ toolStarted(agent: unknown, name: string, detail: string): void;
99
+ private schedulePush;
65
100
  /** Agent finished (idle), was cancelled, or the plugin is stopping. */
66
101
  end(agent?: CancellableAgent): Promise<void>;
67
102
  private stop;
68
103
  private armIdle;
69
104
  /** Card: shrink the DSH window to an always-on-top corner card; minimize: get it out of the way. */
70
105
  private shrinkHost;
106
+ /**
107
+ * Pet mode minimizes DeepSeek Harness; if the user opens it again while the
108
+ * agent works, it floats as the see-through card instead of covering the
109
+ * screen (the agent neither sees nor clicks it).
110
+ */
111
+ private cardIfShown;
71
112
  private restoreHost;
72
113
  }
73
114
  export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Split text for streamed entry: paste block by block so the user watches it
3
+ * appear, while each block still goes in literally (typing Markdown key by key
4
+ * into Typora / Obsidian / Word trips their auto-formatting).
5
+ *
6
+ * Blocks end after a blank-line separator, never inside a ``` / ~~~ fence and
7
+ * never inside a paragraph (a half-pasted **bold** or link may not re-render).
8
+ * Joining the blocks gives back the original text exactly.
9
+ */
10
+ export declare function splitBlocks(text: string, minChars?: number): string[];
11
+ /** Pieces of at most ~`size` characters, broken after whitespace where possible (for paced typing). */
12
+ export declare function typingPieces(text: string, size?: number): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copylee/dsh-computer-use",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
5
5
  "type": "module",
6
6
  "author": "copylee",
@@ -31,6 +31,7 @@
31
31
  "lib/types/**/*.d.ts",
32
32
  "helper/CuHelper.cs",
33
33
  "helper/deepseek-white.png",
34
+ "helper/deepseek-black.png",
34
35
  "cordis.patch.yml",
35
36
  "README.md",
36
37
  "LICENSE"