@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/types/access.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export declare class AccessControl {
|
|
|
36
36
|
isGranted(session: string, win: WindowLike): boolean;
|
|
37
37
|
/** Names from `names` the session has not been granted yet (aliases count). */
|
|
38
38
|
missing(session: string, names: readonly string[]): string[];
|
|
39
|
+
/** Remove matching app grants (or all grants when `name` is "all" / "*"). Returns revoked entries. */
|
|
40
|
+
revoke(session: string, name: string): string[];
|
|
39
41
|
forget(session: string): void;
|
|
40
42
|
/**
|
|
41
43
|
* Why input may not go to `win`, or undefined when it may. `action` is a
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface CdpTarget {
|
|
2
|
+
id: string;
|
|
3
|
+
type: string;
|
|
4
|
+
title: string;
|
|
5
|
+
url: string;
|
|
6
|
+
webSocketDebuggerUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CdpDomElement {
|
|
9
|
+
role: string;
|
|
10
|
+
name: string;
|
|
11
|
+
selector: string;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
value?: string;
|
|
17
|
+
editable?: boolean;
|
|
18
|
+
password?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CdpSnapshot {
|
|
21
|
+
port: number;
|
|
22
|
+
title: string;
|
|
23
|
+
url: string;
|
|
24
|
+
elements: CdpDomElement[];
|
|
25
|
+
}
|
|
26
|
+
/** Probe candidate localhost debugging ports and return the first matching visible page target. */
|
|
27
|
+
export declare function findCdpTarget(options?: {
|
|
28
|
+
ports?: readonly number[];
|
|
29
|
+
titleHint?: string;
|
|
30
|
+
harnessUrl?: string;
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
port: number;
|
|
34
|
+
target: CdpTarget;
|
|
35
|
+
} | undefined>;
|
|
36
|
+
/** Execute one CDP `Runtime.evaluate` returning JSON on a debugger WebSocket URL. */
|
|
37
|
+
export declare function evalCdpJson<T>(wsUrl: string, expression: string, timeoutMs?: number): Promise<T | undefined>;
|
|
38
|
+
/** Read visible interactive DOM controls from a local CDP-enabled browser tab. */
|
|
39
|
+
export declare function readCdpElements(options?: {
|
|
40
|
+
ports?: readonly number[];
|
|
41
|
+
titleHint?: string;
|
|
42
|
+
harnessUrl?: string;
|
|
43
|
+
}): Promise<CdpSnapshot | undefined>;
|
|
44
|
+
/** Read visible innerText from a local CDP-enabled browser tab (excluding password inputs). */
|
|
45
|
+
export declare function readCdpText(options?: {
|
|
46
|
+
ports?: readonly number[];
|
|
47
|
+
titleHint?: string;
|
|
48
|
+
harnessUrl?: string;
|
|
49
|
+
tail?: number;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
port: number;
|
|
52
|
+
title: string;
|
|
53
|
+
url: string;
|
|
54
|
+
text: string;
|
|
55
|
+
} | undefined>;
|
|
@@ -15,6 +15,10 @@ interface NamespaceView {
|
|
|
15
15
|
}
|
|
16
16
|
interface ClientContext {
|
|
17
17
|
effect(execute: () => (() => void) | void, label?: string): void;
|
|
18
|
+
inject?(deps: string[], callback: (scope: {
|
|
19
|
+
effect(fn: () => (() => void) | void, label?: string): void;
|
|
20
|
+
inputTriggers?: unknown;
|
|
21
|
+
}) => void): void;
|
|
18
22
|
slots: {
|
|
19
23
|
inject(name: string, register: () => unknown): void;
|
|
20
24
|
register(meta: Record<string, unknown>, render: (props: unknown) => unknown): unknown;
|
|
@@ -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
|
+
export declare const selectCss = "\n@keyframes dshcu-menu-in{from{opacity:0;transform:translateY(-4px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}\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,.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}\n.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))}\n.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)}\n.dshcu-select:disabled{opacity:.48;cursor:default}\n.dshcu-select svg{flex:none;transition:transform .2s cubic-bezier(.22,1,.36,1)}\n.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)}\n.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}\n.dshcu-option[data-active=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.11))}\n.dshcu-option[aria-selected=true]{font-weight:500;color:var(--cl-accent,#D97757)}\n";
|
|
4
4
|
export declare function Select<V extends string>({ options, value, disabled, label, onChange }: {
|
|
5
5
|
options: {
|
|
6
6
|
value: V;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer `@` reference source for running Windows application windows.
|
|
3
|
+
* Uses DSH's optional `inputTriggers` service (`ctx.inject(['inputTriggers'])`)
|
|
4
|
+
* and queries the passive read-only `/api/dsh-computer-use/windows` endpoint
|
|
5
|
+
* without ever lighting up the overlay or focusing any window.
|
|
6
|
+
*/
|
|
7
|
+
interface InputTriggersLike {
|
|
8
|
+
registerSource?(source: {
|
|
9
|
+
trigger: string;
|
|
10
|
+
name: string;
|
|
11
|
+
showGroupTitle?: boolean;
|
|
12
|
+
lexicon?: () => unknown[];
|
|
13
|
+
subscribeLexicon?: (session: unknown, listener: () => void) => () => void;
|
|
14
|
+
candidates: (session: unknown, request?: {
|
|
15
|
+
query?: string;
|
|
16
|
+
quoted?: boolean;
|
|
17
|
+
drilled?: boolean;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}) => Promise<unknown[]>;
|
|
20
|
+
onPick: (pick: {
|
|
21
|
+
candidate?: {
|
|
22
|
+
value?: unknown;
|
|
23
|
+
label?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
};
|
|
26
|
+
}) => unknown;
|
|
27
|
+
codec?: {
|
|
28
|
+
clipboardText?: (ref: string) => string;
|
|
29
|
+
serialize?: (ref: string, signal?: AbortSignal) => Promise<string>;
|
|
30
|
+
};
|
|
31
|
+
}): () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function registerWindowReferenceSource(scope: {
|
|
34
|
+
effect(fn: () => (() => void) | void, label?: string): void;
|
|
35
|
+
inputTriggers?: InputTriggersLike;
|
|
36
|
+
}): void;
|
|
37
|
+
export {};
|
package/lib/types/computer.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type BrowserTab } from './browser-host.js';
|
|
|
3
3
|
import { type Display, type Point, type ScreenshotDetail, type Size } from './coords.js';
|
|
4
4
|
import type { HelperLike } from './helper-client.js';
|
|
5
5
|
import { type UiElement } from './target.js';
|
|
6
|
-
import type { CancellableAgent, HostWindowMode, OverlayController } from './overlay.js';
|
|
6
|
+
import type { CancellableAgent, HostWindowMode, OverlayController, PetCardSize } from './overlay.js';
|
|
7
7
|
export type AutoScreenshotDetail = 'standard' | 'compact';
|
|
8
8
|
export type SessionMode = 'off' | 'on' | 'always';
|
|
9
9
|
export interface Settings {
|
|
@@ -18,6 +18,8 @@ export interface Settings {
|
|
|
18
18
|
overlay: boolean;
|
|
19
19
|
overlayLabel: string;
|
|
20
20
|
hostWindow: HostWindowMode;
|
|
21
|
+
/** Size tier for the mini progress card: compact, standard, or detailed. */
|
|
22
|
+
petSize: PetCardSize;
|
|
21
23
|
/** Card opacity in percent while controlling (it turns opaque when the pointer rests on it). */
|
|
22
24
|
cardOpacity: number;
|
|
23
25
|
maxLongEdge: number;
|
|
@@ -27,8 +29,10 @@ export interface Settings {
|
|
|
27
29
|
/** Detail tier for automatic post-action screenshots: standard or compact (smaller/cheaper). */
|
|
28
30
|
autoScreenshotDetail: AutoScreenshotDetail;
|
|
29
31
|
settleMs: number;
|
|
30
|
-
/** Pause while the user types
|
|
32
|
+
/** Pause while the user types or clicks physically. */
|
|
31
33
|
pauseOnUserInput: boolean;
|
|
34
|
+
/** Feed sanitized summaries of user physical clicks/scrolls/typing back to the model when the user intervenes. */
|
|
35
|
+
reportUserActions: boolean;
|
|
32
36
|
/** How long the keyboard must be quiet before resuming. */
|
|
33
37
|
userIdleMs: number;
|
|
34
38
|
/** How text is entered: stream = paste block by block, type = key by key, paste = at once. */
|
|
@@ -37,6 +41,16 @@ export interface Settings {
|
|
|
37
41
|
quickSteps: boolean;
|
|
38
42
|
/** Run screenshots, display / window queries and idle input in-process through DSH's koffi instead of the C# helper. */
|
|
39
43
|
nativeHelper: boolean;
|
|
44
|
+
/** Try background UIA semantic click at coordinate before falling back to a physical pointer click. */
|
|
45
|
+
elementFirstClick: boolean;
|
|
46
|
+
/** Restore the user's physical mouse position right after a physical click. */
|
|
47
|
+
restorePointer: boolean;
|
|
48
|
+
/** Refuse automated typing into password fields (UIA IsPassword / Win32 ES_PASSWORD) and mask values. */
|
|
49
|
+
protectPasswords: boolean;
|
|
50
|
+
/** Guard coordinate clicks/drags when the foreground window moved/resized or is occluded since the last screenshot. */
|
|
51
|
+
windowChangeGuard: boolean;
|
|
52
|
+
/** Optional local Chromium remote debugging port for CDP fast-lane (0 = auto-probe 9222/9229 on demand). */
|
|
53
|
+
cdpPort: number;
|
|
40
54
|
}
|
|
41
55
|
export type TypingMode = 'stream' | 'type' | 'paste';
|
|
42
56
|
export interface WindowInfo extends WindowLike {
|
|
@@ -89,6 +103,8 @@ export interface ActionInput {
|
|
|
89
103
|
force?: boolean;
|
|
90
104
|
/** Screenshot detail: 'high' uses full configured limits; 'low' uses a compact budget for quick checks. */
|
|
91
105
|
detail?: ScreenshotDetail;
|
|
106
|
+
/** type: select all (Ctrl+A) before entering replacement text. */
|
|
107
|
+
replace?: boolean;
|
|
92
108
|
}
|
|
93
109
|
export interface ActionOutcome {
|
|
94
110
|
text: string;
|
|
@@ -173,6 +189,10 @@ export declare class Computer {
|
|
|
173
189
|
freshShot(detail?: ScreenshotDetail): Promise<Shot | 'unchanged'>;
|
|
174
190
|
/** The foreground window as of the model's latest look at the screen. */
|
|
175
191
|
private seen;
|
|
192
|
+
/** Snapshot of the foreground window geometry captured during the latest screenshot/marks look. */
|
|
193
|
+
private lastShotWindow;
|
|
194
|
+
/** Most recent Set-of-Marks element list so `target: "#12"` resolves directly. */
|
|
195
|
+
private lastMarks;
|
|
176
196
|
/** The latest foreground window that was not DeepSeek Harness itself. */
|
|
177
197
|
private lastTarget;
|
|
178
198
|
/** A new turn starts: the user may have rearranged things while chatting. */
|
|
@@ -234,6 +254,12 @@ export declare class Computer {
|
|
|
234
254
|
elements(where?: 'window' | 'popups', hwnd?: number): Promise<UiElement[]>;
|
|
235
255
|
/** Read visible text and physical bounding boxes via built-in Windows OCR. */
|
|
236
256
|
ocr(hwnd?: number): Promise<OcrResult>;
|
|
257
|
+
/** Capture a Set-of-Marks annotated screenshot and cache indexed elements so `target: "#N"` works directly. */
|
|
258
|
+
marks(hwnd?: number, max?: number): Promise<{
|
|
259
|
+
window: Partial<WindowInfo>;
|
|
260
|
+
elements: UiElement[];
|
|
261
|
+
shot: Shot;
|
|
262
|
+
}>;
|
|
237
263
|
/**
|
|
238
264
|
* Look for a named control in the window, then its popups, and when the UIA
|
|
239
265
|
* tree is empty or sparse (<= 20 controls, e.g. canvas/WebView/game/custom
|
|
@@ -258,6 +284,10 @@ export declare class Computer {
|
|
|
258
284
|
private namedClickPoint;
|
|
259
285
|
/** wait with `until`: done as soon as the window or control is there (or gone). */
|
|
260
286
|
private waitUntil;
|
|
287
|
+
/** Drain buffered physical user actions and format them in screenshot coordinates for the model. */
|
|
288
|
+
drainUserActionNotes(): Promise<string>;
|
|
289
|
+
/** Format physical user takeover actions into concise screenshot-coordinate context for the model. */
|
|
290
|
+
private formatUserActions;
|
|
261
291
|
/** Run one action. Returns text plus an image for screenshot/zoom. */
|
|
262
292
|
run(input: ActionInput, call: CallContext): Promise<ActionOutcome>;
|
|
263
293
|
/**
|
|
@@ -33,6 +33,7 @@ export interface DiagnosticSnapshot {
|
|
|
33
33
|
defaultSessionEnabled: boolean;
|
|
34
34
|
overlay: boolean;
|
|
35
35
|
hostWindow: Settings['hostWindow'];
|
|
36
|
+
petSize: Settings['petSize'];
|
|
36
37
|
cardOpacity: number;
|
|
37
38
|
typingMode: Settings['typingMode'];
|
|
38
39
|
quickSteps: boolean;
|
|
@@ -43,8 +44,14 @@ export interface DiagnosticSnapshot {
|
|
|
43
44
|
maxPixels: number;
|
|
44
45
|
jpegQuality: number;
|
|
45
46
|
pauseOnUserInput: boolean;
|
|
47
|
+
reportUserActions: boolean;
|
|
46
48
|
userIdleMs: number;
|
|
47
49
|
nativeHelper: boolean;
|
|
50
|
+
elementFirstClick: boolean;
|
|
51
|
+
restorePointer: boolean;
|
|
52
|
+
protectPasswords: boolean;
|
|
53
|
+
windowChangeGuard: boolean;
|
|
54
|
+
cdpPort: number;
|
|
48
55
|
blockedAppsCount: number;
|
|
49
56
|
hasCustomHarnessUrl: boolean;
|
|
50
57
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import type { Context } from '@deepseek-ai/cordis';
|
|
|
2
2
|
import z from '@deepseek-ai/schemastery';
|
|
3
3
|
import { type AccessMode } from './access.js';
|
|
4
4
|
import { type AutoScreenshotDetail, type SessionMode, type TypingMode } from './computer.js';
|
|
5
|
-
import { type HostWindowMode } from './overlay.js';
|
|
6
|
-
/** Parse `/cu [on|off|toggle|status|reset]` arguments into an action. */
|
|
7
|
-
export declare function parseCuCommand(rawInput: string): 'on' | 'off' | 'toggle' | 'status' | 'reset' | 'invalid';
|
|
5
|
+
import { type HostWindowMode, type PetCardSize } from './overlay.js';
|
|
6
|
+
/** Parse `/cu [on|off|toggle|status|reset|stop|revoke <app>]` arguments into an action. */
|
|
7
|
+
export declare function parseCuCommand(rawInput: string): 'on' | 'off' | 'toggle' | 'status' | 'reset' | 'stop' | 'revoke' | 'invalid';
|
|
8
|
+
/** Extract the app name argument after `/cu revoke ...` (empty means all granted apps). */
|
|
9
|
+
export declare function parseCuRevokeTarget(rawInput: string): string;
|
|
8
10
|
export { DEFAULTS, ENTRY_ID, resolveConfig } from './settings.js';
|
|
9
11
|
export declare const name = "@copylee/dsh-computer-use";
|
|
10
12
|
export declare const inject: string[];
|
|
@@ -17,6 +19,7 @@ export interface Config {
|
|
|
17
19
|
overlay?: boolean;
|
|
18
20
|
overlayLabel?: string;
|
|
19
21
|
hostWindow?: HostWindowMode;
|
|
22
|
+
petSize?: PetCardSize;
|
|
20
23
|
cardOpacity?: number;
|
|
21
24
|
/** @deprecated replaced by hostWindow: 'minimize' */
|
|
22
25
|
minimizeHostWindow?: boolean;
|
|
@@ -28,10 +31,16 @@ export interface Config {
|
|
|
28
31
|
jpegQuality?: number;
|
|
29
32
|
blockedApps?: string[];
|
|
30
33
|
pauseOnUserInput?: boolean;
|
|
34
|
+
reportUserActions?: boolean;
|
|
31
35
|
userIdleMs?: number;
|
|
32
36
|
typingMode?: TypingMode;
|
|
33
37
|
quickSteps?: boolean;
|
|
34
38
|
nativeHelper?: boolean;
|
|
39
|
+
elementFirstClick?: boolean;
|
|
40
|
+
restorePointer?: boolean;
|
|
41
|
+
protectPasswords?: boolean;
|
|
42
|
+
windowChangeGuard?: boolean;
|
|
43
|
+
cdpPort?: number;
|
|
35
44
|
}
|
|
36
45
|
export declare const Config: z<Config>;
|
|
37
46
|
export declare function apply(ctx: Context, config?: Config): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ActionInput } from './computer.js';
|
|
2
|
+
export declare const MAX_MACRO_ACTIONS = 30;
|
|
3
|
+
export interface ActionMacro {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
app?: string;
|
|
7
|
+
description: string;
|
|
8
|
+
params: string[];
|
|
9
|
+
actions: ActionInput[];
|
|
10
|
+
updatedAt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface MacroInput {
|
|
13
|
+
name: string;
|
|
14
|
+
app?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
actions: ActionInput[];
|
|
17
|
+
}
|
|
18
|
+
export declare function macroId(name: string): string;
|
|
19
|
+
/** Collect `{{param}}` placeholder names referenced across macro actions. */
|
|
20
|
+
export declare function extractMacroParams(actions: readonly ActionInput[]): string[];
|
|
21
|
+
/** Substitute `{{param}}` placeholders into a fresh copy of `actions`. */
|
|
22
|
+
export declare function renderMacroActions(actions: readonly ActionInput[], params?: Record<string, string | number | boolean>): ActionInput[];
|
|
23
|
+
export declare class MacroStore {
|
|
24
|
+
readonly dir: string;
|
|
25
|
+
constructor(dir?: string);
|
|
26
|
+
list(): ActionMacro[];
|
|
27
|
+
get(nameOrId: string): ActionMacro | undefined;
|
|
28
|
+
save(input: MacroInput): ActionMacro;
|
|
29
|
+
remove(nameOrId: string): boolean;
|
|
30
|
+
}
|
package/lib/types/overlay.d.ts
CHANGED
|
@@ -5,6 +5,22 @@ export interface CancellableAgent {
|
|
|
5
5
|
}): void;
|
|
6
6
|
}
|
|
7
7
|
export type HostWindowMode = 'pet' | 'card' | 'minimize' | 'keep';
|
|
8
|
+
export type PetCardSize = 'compact' | 'standard' | 'detailed';
|
|
9
|
+
/** Sanitized semantic summary of a physical user takeover action during computer control. */
|
|
10
|
+
export interface UserActionEvent {
|
|
11
|
+
at: number;
|
|
12
|
+
kind: 'click' | 'double_click' | 'scroll' | 'type';
|
|
13
|
+
button?: 'left' | 'right' | 'middle';
|
|
14
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
exe?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
password?: boolean;
|
|
22
|
+
keys?: number;
|
|
23
|
+
}
|
|
8
24
|
/** The slice of a DSH assistant-stream frame the progress card reads. */
|
|
9
25
|
export interface StreamFrame {
|
|
10
26
|
type: string;
|
|
@@ -21,6 +37,7 @@ export interface OverlaySettings {
|
|
|
21
37
|
overlay: boolean;
|
|
22
38
|
overlayLabel: string;
|
|
23
39
|
hostWindow: HostWindowMode;
|
|
40
|
+
petSize: PetCardSize;
|
|
24
41
|
cardOpacity: number;
|
|
25
42
|
userIdleMs: number;
|
|
26
43
|
}
|
|
@@ -89,13 +106,20 @@ export declare class OverlayController {
|
|
|
89
106
|
private cardOpacity;
|
|
90
107
|
/** Paused by Esc or the pill; actions wait until resumed. */
|
|
91
108
|
paused: boolean;
|
|
92
|
-
/** When the user last typed
|
|
109
|
+
/** When the user last typed or clicked physically while the overlay was up (ms epoch). */
|
|
93
110
|
lastUserInput: number;
|
|
94
|
-
/** Which physical key that was
|
|
111
|
+
/** Which physical key/action that was, for the log. */
|
|
95
112
|
private lastUserKey;
|
|
113
|
+
/** Bounded sanitized ring buffer of physical user actions since the model last saw them. */
|
|
114
|
+
private userActions;
|
|
96
115
|
constructor(helper: HelperLike, settings: () => OverlaySettings, log: (message: string) => void,
|
|
97
116
|
/** Absolute path of the pill icon (PNG). */
|
|
98
117
|
iconPath?: string);
|
|
118
|
+
private recordUserAction;
|
|
119
|
+
/** Whether the user has performed physical mouse/keyboard actions not yet reported to the model. */
|
|
120
|
+
hasUserActions(): boolean;
|
|
121
|
+
/** Return and clear buffered user takeover actions so the model receives them once. */
|
|
122
|
+
drainUserActions(): UserActionEvent[];
|
|
99
123
|
/** The agent currently driving the computer, if any. */
|
|
100
124
|
get controller(): CancellableAgent | undefined;
|
|
101
125
|
/** Did the user type after `since`? */
|
package/lib/types/routes.d.ts
CHANGED
|
@@ -18,9 +18,12 @@ export declare const SCREENSHOTS_CLEAN_ROUTE = "/api/dsh-computer-use/screenshot
|
|
|
18
18
|
export declare const SKILLS_ROUTE = "/api/dsh-computer-use/skills";
|
|
19
19
|
export declare const SESSION_ROUTE = "/api/dsh-computer-use/session";
|
|
20
20
|
export declare const DIAGNOSTICS_ROUTE = "/api/dsh-computer-use/diagnostics";
|
|
21
|
+
export declare const UPDATE_ROUTE = "/api/dsh-computer-use/update";
|
|
22
|
+
export declare const WINDOWS_ROUTE = "/api/dsh-computer-use/windows";
|
|
21
23
|
type Handler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
22
24
|
export interface StatusBody {
|
|
23
25
|
ok: true;
|
|
26
|
+
version: string;
|
|
24
27
|
platform: string;
|
|
25
28
|
helper: 'ready' | 'error';
|
|
26
29
|
error?: string;
|
|
@@ -30,7 +33,7 @@ export interface StatusBody {
|
|
|
30
33
|
}>;
|
|
31
34
|
controlling: boolean;
|
|
32
35
|
}
|
|
33
|
-
export declare function statusRoute(helper: HelperLike, settings: () => Settings, overlay: OverlayController): Handler;
|
|
36
|
+
export declare function statusRoute(helper: HelperLike, settings: () => Settings, overlay: OverlayController, pluginVersion?: string): Handler;
|
|
34
37
|
/** Show the overlay for a few seconds so the user can see how it looks (skipped while an agent is controlling). */
|
|
35
38
|
export declare function previewRoute(helper: HelperLike, settings: () => Settings, overlay: OverlayController, iconPath: string): Handler;
|
|
36
39
|
/** Screenshot cache size and how much of it is orphaned. */
|
|
@@ -45,4 +48,8 @@ export declare function sessionRoute(gate: SessionGate, settings: () => Settings
|
|
|
45
48
|
export declare function diagnosticsRoute(helper: HelperLike & {
|
|
46
49
|
available?: boolean;
|
|
47
50
|
}, settings: () => Settings, diagnostics: DiagnosticsLog, pluginVersion: string): Handler;
|
|
51
|
+
/** Check npmjs & npmmirror concurrently for a newer plugin version. */
|
|
52
|
+
export declare function updateRoute(pluginVersion: string): Handler;
|
|
53
|
+
/** Passive read-only window list for `@窗口` composer references (never triggers overlay or focus). */
|
|
54
|
+
export declare function windowsRoute(helper: HelperLike): Handler;
|
|
48
55
|
export {};
|
package/lib/types/target.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export interface UiElement {
|
|
|
17
17
|
focusable?: boolean;
|
|
18
18
|
/** True for web contenteditable composers (ProseMirror/tiptap/CodeMirror...). */
|
|
19
19
|
editable?: boolean;
|
|
20
|
+
/** True when the control is a password field (UIA IsPassword or Win32 ES_PASSWORD). */
|
|
21
|
+
password?: boolean;
|
|
22
|
+
/** 1-based Set-of-Marks badge number when returned by `ui_elements({ marks: true })`. */
|
|
23
|
+
mark?: number;
|
|
20
24
|
/** Internal UIA identity used to verify a live named target before dispatch. */
|
|
21
25
|
runtimeId?: string;
|
|
22
26
|
windowHwnd?: number;
|
package/lib/types/tools.d.ts
CHANGED
|
@@ -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 MacroStore } from './macros.js';
|
|
3
4
|
import { type SkillStore } from './skills.js';
|
|
4
5
|
import { Computer, type CallContext, type Shot } from './computer.js';
|
|
5
6
|
type ToolDefinition = ReturnType<typeof defineTool>;
|
|
@@ -11,6 +12,8 @@ export interface ToolHost {
|
|
|
11
12
|
context(exec: unknown): Promise<CallContext>;
|
|
12
13
|
/** Per-app notes the agent keeps (optional: tests run without). */
|
|
13
14
|
skills?: SkillStore;
|
|
15
|
+
/** Saved replayable action macros (optional: tests run without). */
|
|
16
|
+
macros?: MacroStore;
|
|
14
17
|
}
|
|
15
18
|
export declare function createTools(host: ToolHost): ToolDefinition[];
|
|
16
19
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concurrent plugin update check probing both npmjs and npmmirror so users in
|
|
3
|
+
* mainland China and overseas both get fast, reliable latest-version feedback.
|
|
4
|
+
*/
|
|
5
|
+
export interface UpdateCheckResult {
|
|
6
|
+
current: string;
|
|
7
|
+
latest?: string;
|
|
8
|
+
hasUpdate: boolean;
|
|
9
|
+
source?: 'npmjs' | 'npmmirror';
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Compare two semver strings (major.minor.patch); returns >0 when `a > b`. */
|
|
13
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
14
|
+
/** Race npmjs & npmmirror concurrently and return the highest valid version found. */
|
|
15
|
+
export declare function checkForUpdate(current: string, fetchImpl?: typeof fetch, timeoutMs?: number): Promise<UpdateCheckResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copylee/dsh-computer-use",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "DeepSeek Harness Computer Use 插件(Windows):让 AI 看屏幕、点鼠标、敲键盘操控电脑;控制时屏幕泛起橙色光晕并显示“DeepSeek Harness 正在操控你的电脑”,按 Esc 暂停 / 继续。",
|
|
5
5
|
"icon": "assets/icon.svg",
|
|
6
6
|
"type": "module",
|