@copylee/dsh-computer-use 0.2.2 → 0.5.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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * "应用技能" card: the per-app notes the agent keeps (see ../skills.ts). The
3
+ * user can read, edit, add and delete them here; built-in skills can be
4
+ * overridden and restored.
5
+ */
6
+ import * as React from 'react';
7
+ export declare function SkillsCard({ S }: {
8
+ S: Record<string, React.CSSProperties>;
9
+ }): React.ReactElement;
@@ -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;
@@ -125,6 +127,18 @@ export declare class Computer {
125
127
  settle(signal: AbortSignal): Promise<void>;
126
128
  windowAt(point: Point): Promise<WindowInfo | undefined>;
127
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
+ }>>;
128
142
  cursor(): Promise<Point>;
129
143
  /** Short description of the frontmost window, for result text. */
130
144
  describeForeground(): Promise<string>;
@@ -1,9 +1,3 @@
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';
@@ -17,6 +11,7 @@ export interface Config {
17
11
  overlay?: boolean;
18
12
  overlayLabel?: string;
19
13
  hostWindow?: HostWindowMode;
14
+ cardOpacity?: number;
20
15
  /** @deprecated replaced by hostWindow: 'minimize' */
21
16
  minimizeHostWindow?: boolean;
22
17
  autoScreenshot?: boolean;
@@ -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 {};
@@ -8,10 +8,12 @@ import type { Settings } from './computer.js';
8
8
  import type { HelperLike } from './helper-client.js';
9
9
  import type { OverlayController } from './overlay.js';
10
10
  import type { ScreenshotCache } from './screenshots.js';
11
+ import type { SkillStore } from './skills.js';
11
12
  export declare const STATUS_ROUTE = "/api/dsh-computer-use/status";
12
13
  export declare const PREVIEW_ROUTE = "/api/dsh-computer-use/preview";
13
14
  export declare const SCREENSHOTS_ROUTE = "/api/dsh-computer-use/screenshots";
14
15
  export declare const SCREENSHOTS_CLEAN_ROUTE = "/api/dsh-computer-use/screenshots/clean";
16
+ export declare const SKILLS_ROUTE = "/api/dsh-computer-use/skills";
15
17
  type Handler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
16
18
  export interface StatusBody {
17
19
  ok: true;
@@ -33,4 +35,6 @@ export declare function previewRoute(helper: HelperLike, settings: () => Setting
33
35
  export declare function screenshotsRoute(cache: ScreenshotCache): Handler;
34
36
  /** Delete orphaned screenshots now. */
35
37
  export declare function screenshotsCleanRoute(cache: ScreenshotCache): Handler;
38
+ /** App skills for the settings page: GET lists them; POST { op: 'save' | 'delete' | 'reset', ... } changes one. */
39
+ export declare function skillsRoute(skills: SkillStore): Handler;
36
40
  export {};
@@ -0,0 +1,59 @@
1
+ import { type WindowLike } from './access.js';
2
+ /** Notes longer than this must be condensed before more is added. */
3
+ export declare const SKILL_MAX_CHARS = 4000;
4
+ export interface Skill {
5
+ id: string;
6
+ app: string;
7
+ /** Names / exe names this skill applies to. */
8
+ match: string[];
9
+ summary: string;
10
+ content: string;
11
+ source: 'builtin' | 'user';
12
+ /** A user file replaces a built-in skill of the same id. */
13
+ overrides: boolean;
14
+ updatedAt: number;
15
+ }
16
+ export interface SkillInput {
17
+ app: string;
18
+ match?: string[];
19
+ summary?: string;
20
+ content: string;
21
+ }
22
+ interface Parsed {
23
+ app: string;
24
+ match: string[];
25
+ summary: string;
26
+ content: string;
27
+ disabled: boolean;
28
+ }
29
+ export declare function skillId(app: string): string;
30
+ export declare function parseSkill(text: string, fallbackApp: string): Parsed;
31
+ export declare function formatSkill(skill: {
32
+ app: string;
33
+ match: string[];
34
+ summary: string;
35
+ content: string;
36
+ }, disabled?: boolean): string;
37
+ export declare class SkillStore {
38
+ private readonly builtinDir;
39
+ readonly userDir: string;
40
+ constructor(builtinDir: string, userDir?: string);
41
+ private load;
42
+ /** Every active skill, user files first in precedence, sorted by app name. */
43
+ list(): Skill[];
44
+ get(id: string): Skill | undefined;
45
+ /** The skill for an app by name, or for a window by its executable. */
46
+ find(name: string, win?: WindowLike): Skill | undefined;
47
+ /** One line per skill for the system prompt. */
48
+ catalog(): string;
49
+ save(input: SkillInput, id?: string): Skill;
50
+ append(app: string, text: string, extra?: {
51
+ match?: string[];
52
+ summary?: string;
53
+ }): Skill;
54
+ /** Delete a user skill; a built-in one is hidden by a disabled override. */
55
+ remove(id: string): void;
56
+ /** Drop the user's override so the built-in skill applies again. */
57
+ reset(id: string): void;
58
+ }
59
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
2
2
  import { defineTool } from '@deepseek-ai/dsh-tools';
3
+ import { type SkillStore } from './skills.js';
3
4
  import { Computer, type CallContext, type Shot } from './computer.js';
4
5
  type ToolDefinition = ReturnType<typeof defineTool>;
5
6
  export interface ToolHost {
@@ -8,6 +9,8 @@ export interface ToolHost {
8
9
  saveImage(shot: Shot, name: string): Promise<ImageAttachmentRef>;
9
10
  /** Build the per-call context (session, agent, vision support). */
10
11
  context(exec: unknown): Promise<CallContext>;
12
+ /** Per-app notes the agent keeps (optional: tests run without). */
13
+ skills?: SkillStore;
11
14
  }
12
15
  export declare function createTools(host: ToolHost): ToolDefinition[];
13
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copylee/dsh-computer-use",
3
- "version": "0.2.2",
3
+ "version": "0.5.0",
4
4
  "description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
5
5
  "type": "module",
6
6
  "author": "copylee",
@@ -31,6 +31,8 @@
31
31
  "lib/types/**/*.d.ts",
32
32
  "helper/CuHelper.cs",
33
33
  "helper/deepseek-white.png",
34
+ "helper/deepseek-black.png",
35
+ "helper/skills/*.md",
34
36
  "cordis.patch.yml",
35
37
  "README.md",
36
38
  "LICENSE"