@oharness/engine 0.9.2 → 0.10.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/dist/agent/agent.d.ts +207 -1
- package/dist/agent/agent.js +691 -55
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/background.d.ts +135 -0
- package/dist/agent/background.js +307 -0
- package/dist/agent/background.js.map +1 -0
- package/dist/agent/compaction.d.ts +7 -0
- package/dist/agent/compaction.js +11 -3
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/goal.d.ts +36 -0
- package/dist/agent/goal.js +71 -0
- package/dist/agent/goal.js.map +1 -0
- package/dist/agent/permissions.d.ts +6 -0
- package/dist/agent/permissions.js +2 -1
- package/dist/agent/permissions.js.map +1 -1
- package/dist/agent/session.d.ts +36 -0
- package/dist/agent/session.js +72 -0
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/store.d.ts +25 -0
- package/dist/agent/store.js +21 -0
- package/dist/agent/store.js.map +1 -1
- package/dist/agent/subagent.d.ts +12 -0
- package/dist/agent/subagent.js +11 -1
- package/dist/agent/subagent.js.map +1 -1
- package/dist/agent/workspace.d.ts +9 -0
- package/dist/agent/workspace.js +59 -5
- package/dist/agent/workspace.js.map +1 -1
- package/dist/auth/manager.d.ts +9 -0
- package/dist/auth/manager.js +67 -6
- package/dist/auth/manager.js.map +1 -1
- package/dist/auth/providers/account.js +5 -4
- package/dist/auth/providers/account.js.map +1 -1
- package/dist/browser/tools.js +3 -0
- package/dist/browser/tools.js.map +1 -1
- package/dist/computer/arbiter.d.ts +69 -0
- package/dist/computer/arbiter.js +128 -0
- package/dist/computer/arbiter.js.map +1 -0
- package/dist/computer/cua-driver.d.ts +115 -0
- package/dist/computer/cua-driver.js +453 -0
- package/dist/computer/cua-driver.js.map +1 -0
- package/dist/computer/helper-client.d.ts +78 -0
- package/dist/computer/helper-client.js +163 -0
- package/dist/computer/helper-client.js.map +1 -0
- package/dist/computer/index.d.ts +15 -0
- package/dist/computer/index.js +9 -0
- package/dist/computer/index.js.map +1 -0
- package/dist/computer/mode.d.ts +19 -0
- package/dist/computer/mode.js +42 -0
- package/dist/computer/mode.js.map +1 -0
- package/dist/computer/plugin.d.ts +24 -0
- package/dist/computer/plugin.js +17 -0
- package/dist/computer/plugin.js.map +1 -0
- package/dist/computer/policy.d.ts +29 -0
- package/dist/computer/policy.js +127 -0
- package/dist/computer/policy.js.map +1 -0
- package/dist/computer/session.d.ts +199 -0
- package/dist/computer/session.js +392 -0
- package/dist/computer/session.js.map +1 -0
- package/dist/computer/target.d.ts +187 -0
- package/dist/computer/target.js +31 -0
- package/dist/computer/target.js.map +1 -0
- package/dist/computer/tools.d.ts +8 -0
- package/dist/computer/tools.js +537 -0
- package/dist/computer/tools.js.map +1 -0
- package/dist/core/tokens.js +4 -0
- package/dist/core/tokens.js.map +1 -1
- package/dist/core/types.d.ts +16 -1
- package/dist/core/types.js.map +1 -1
- package/dist/harness.d.ts +76 -1
- package/dist/harness.js +178 -22
- package/dist/harness.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/transport.js +3 -0
- package/dist/mcp/transport.js.map +1 -1
- package/dist/providers/catalog.js +6 -0
- package/dist/providers/catalog.js.map +1 -1
- package/dist/providers/discovery.js +10 -2
- package/dist/providers/discovery.js.map +1 -1
- package/dist/providers/models-dev.js +1 -0
- package/dist/providers/models-dev.js.map +1 -1
- package/dist/providers/models-dev.json +114 -102
- package/dist/providers/piai.d.ts +16 -1
- package/dist/providers/piai.js +84 -7
- package/dist/providers/piai.js.map +1 -1
- package/dist/providers/types.d.ts +6 -0
- package/dist/providers/types.js.map +1 -1
- package/dist/runtime-plugins/cloud-connector.js +5 -0
- package/dist/runtime-plugins/cloud-connector.js.map +1 -1
- package/dist/schedule/scheduler.d.ts +38 -0
- package/dist/schedule/scheduler.js +101 -1
- package/dist/schedule/scheduler.js.map +1 -1
- package/dist/tools/builtin/bash.d.ts +6 -0
- package/dist/tools/builtin/bash.js +2 -1
- package/dist/tools/builtin/bash.js.map +1 -1
- package/dist/tools/builtin/recall.js +4 -0
- package/dist/tools/builtin/recall.js.map +1 -1
- package/dist/tools/builtin/routine.d.ts +9 -0
- package/dist/tools/builtin/routine.js +23 -2
- package/dist/tools/builtin/routine.js.map +1 -1
- package/dist/tools/builtin/task-control.d.ts +21 -0
- package/dist/tools/builtin/task-control.js +120 -0
- package/dist/tools/builtin/task-control.js.map +1 -0
- package/dist/tools/builtin/task.js +50 -9
- package/dist/tools/builtin/task.js.map +1 -1
- package/dist/tools/builtin/todo.d.ts +1 -1
- package/dist/tools/builtin/worktree.d.ts +10 -0
- package/dist/tools/builtin/worktree.js +52 -0
- package/dist/tools/builtin/worktree.js.map +1 -0
- package/dist/tools/define.d.ts +4 -1
- package/dist/tools/define.js +2 -0
- package/dist/tools/define.js.map +1 -1
- package/dist/tools/types.d.ts +112 -0
- package/dist/tools/types.js.map +1 -1
- package/dist/worktree/index.d.ts +109 -0
- package/dist/worktree/index.js +463 -0
- package/dist/worktree/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the computer tools need from whatever drives the machine.
|
|
3
|
+
*
|
|
4
|
+
* The engine holds no platform code. The desktop app supplies a target, which
|
|
5
|
+
* in practice is a native helper spoken to over stdio (`helper-client.ts`): a
|
|
6
|
+
* Swift binary on macOS and a Rust one on Windows, both answering the same
|
|
7
|
+
* protocol. Tests supply a fake.
|
|
8
|
+
*
|
|
9
|
+
* Units: every frame and point here is in the helper's screen coordinates —
|
|
10
|
+
* points on macOS, physical pixels on a per-monitor-DPI-aware Windows process.
|
|
11
|
+
* The engine never needs to know which: it maps a coordinate in a screenshot
|
|
12
|
+
* back through that screenshot's own `frame`, and the helper interprets the
|
|
13
|
+
* result in the unit it reported the frame in.
|
|
14
|
+
*/
|
|
15
|
+
export interface Rect {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w: number;
|
|
19
|
+
h: number;
|
|
20
|
+
}
|
|
21
|
+
export interface AppInfo {
|
|
22
|
+
name: string;
|
|
23
|
+
/** Bundle id on macOS (`com.apple.Notes`), lower-cased exe name on Windows (`notepad.exe`). */
|
|
24
|
+
id: string;
|
|
25
|
+
pid: number;
|
|
26
|
+
active: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface WindowInfo {
|
|
29
|
+
/** Opaque, stable for the window's lifetime. */
|
|
30
|
+
id: string;
|
|
31
|
+
pid: number;
|
|
32
|
+
app: string;
|
|
33
|
+
appId: string;
|
|
34
|
+
title?: string;
|
|
35
|
+
frame: Rect;
|
|
36
|
+
minimized?: boolean;
|
|
37
|
+
/** False for a window on another Space or desktop: still usable, just not visible. */
|
|
38
|
+
onScreen?: boolean;
|
|
39
|
+
focused?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface Shot {
|
|
42
|
+
/** Base64 image. */
|
|
43
|
+
data: string;
|
|
44
|
+
/** JPEG unless said otherwise; Cua Driver returns PNG. */
|
|
45
|
+
mimeType?: string;
|
|
46
|
+
/** Image size in pixels. */
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
/** Where the image sits on screen, in screen units. */
|
|
50
|
+
frame: Rect;
|
|
51
|
+
}
|
|
52
|
+
export interface AxNode {
|
|
53
|
+
/** Opaque, `w<window>.<n>`; valid until the window is read again. */
|
|
54
|
+
ref: string;
|
|
55
|
+
role: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
value?: string;
|
|
58
|
+
frame?: Rect;
|
|
59
|
+
actions?: string[];
|
|
60
|
+
depth: number;
|
|
61
|
+
/** A password field: its value is never returned and typing into it is redacted. */
|
|
62
|
+
secure?: boolean;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export type AxAction = "press" | "focus" | "setValue" | "expand" | "collapse" | "scrollIntoView" | "showMenu";
|
|
66
|
+
export type MouseButton = "left" | "right" | "middle";
|
|
67
|
+
export type ComputerInputEvent = {
|
|
68
|
+
type: "click";
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
button?: MouseButton;
|
|
72
|
+
count?: number;
|
|
73
|
+
modifiers?: string[];
|
|
74
|
+
} | {
|
|
75
|
+
type: "move";
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
} | {
|
|
79
|
+
type: "scroll";
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
dx: number;
|
|
83
|
+
dy: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "drag";
|
|
86
|
+
from: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
to: {
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
};
|
|
94
|
+
modifiers?: string[];
|
|
95
|
+
} | {
|
|
96
|
+
type: "key";
|
|
97
|
+
key: string;
|
|
98
|
+
modifiers?: string[];
|
|
99
|
+
} | {
|
|
100
|
+
type: "text";
|
|
101
|
+
text: string;
|
|
102
|
+
};
|
|
103
|
+
export interface ComputerPermissions {
|
|
104
|
+
/** Screenshots. Always true on Windows. */
|
|
105
|
+
screen: boolean;
|
|
106
|
+
/** Reading and acting on other apps. Always true on Windows. */
|
|
107
|
+
accessibility: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface HelperInfo {
|
|
110
|
+
platform: "darwin" | "win32";
|
|
111
|
+
version: string;
|
|
112
|
+
/** Whether pointer events can reach a window without raising it. */
|
|
113
|
+
background: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A refusal the model and the page can act on, rather than a stack trace.
|
|
117
|
+
*
|
|
118
|
+
* `code` is part of the helper protocol: both helpers raise the same codes.
|
|
119
|
+
*/
|
|
120
|
+
export declare class ComputerError extends Error {
|
|
121
|
+
readonly code: ComputerErrorCode;
|
|
122
|
+
readonly grant?: keyof ComputerPermissions;
|
|
123
|
+
constructor(code: ComputerErrorCode, message: string, grant?: keyof ComputerPermissions);
|
|
124
|
+
}
|
|
125
|
+
export type ComputerErrorCode =
|
|
126
|
+
/** An OS grant is missing (macOS TCC). */
|
|
127
|
+
"permission"
|
|
128
|
+
/** The action needs the real cursor/keyboard: call computer_take_control. */
|
|
129
|
+
| "needs_foreground"
|
|
130
|
+
/** The window belongs to an elevated (administrator) process on Windows. */
|
|
131
|
+
| "elevated"
|
|
132
|
+
/** A UAC prompt / secure desktop is up, or the screen is locked. */
|
|
133
|
+
| "secure_desktop" | "not_found" | "stale_ref" | "unsupported"
|
|
134
|
+
/** Another conversation, or the person, holds what this call needs. */
|
|
135
|
+
| "busy" | "refused" | "failed";
|
|
136
|
+
export interface ComputerTarget {
|
|
137
|
+
info(): Promise<HelperInfo>;
|
|
138
|
+
permissions(): Promise<ComputerPermissions>;
|
|
139
|
+
/** Show the OS prompt, or open the settings pane, for what is missing. */
|
|
140
|
+
requestPermissions(grant?: keyof ComputerPermissions): Promise<void>;
|
|
141
|
+
apps(): Promise<AppInfo[]>;
|
|
142
|
+
windows(opts?: {
|
|
143
|
+
pid?: number;
|
|
144
|
+
}): Promise<WindowInfo[]>;
|
|
145
|
+
screenshot(opts: {
|
|
146
|
+
window?: string;
|
|
147
|
+
display?: string;
|
|
148
|
+
maxWidth?: number;
|
|
149
|
+
}): Promise<Shot>;
|
|
150
|
+
axTree(opts: {
|
|
151
|
+
window: string;
|
|
152
|
+
depth?: number;
|
|
153
|
+
maxNodes?: number;
|
|
154
|
+
}): Promise<{
|
|
155
|
+
nodes: AxNode[];
|
|
156
|
+
truncated: boolean;
|
|
157
|
+
}>;
|
|
158
|
+
axAction(ref: string, action: AxAction, value?: string): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Choose an item from the app's menu bar by its path — ["File", "New Note"]
|
|
161
|
+
* — through accessibility, in the background. Optional: a layer without it
|
|
162
|
+
* leaves the agent to the keyboard shortcut.
|
|
163
|
+
*/
|
|
164
|
+
invokeMenu?(window: string, path: string[]): Promise<void>;
|
|
165
|
+
input(event: ComputerInputEvent, opts: {
|
|
166
|
+
window?: string;
|
|
167
|
+
foreground: boolean;
|
|
168
|
+
}): Promise<void>;
|
|
169
|
+
open(app: string): Promise<{
|
|
170
|
+
pid?: number;
|
|
171
|
+
}>;
|
|
172
|
+
frontmost(): Promise<{
|
|
173
|
+
pid: number;
|
|
174
|
+
appId: string;
|
|
175
|
+
window?: string;
|
|
176
|
+
}>;
|
|
177
|
+
/** Bring an app to the front; used to hand focus back after a takeover. */
|
|
178
|
+
activate(pid: number): Promise<void>;
|
|
179
|
+
/** Milliseconds since the person's last real (not injected) input event. */
|
|
180
|
+
idle(): Promise<number>;
|
|
181
|
+
/** Whether a screen point inside `window` is actually visible, not covered. */
|
|
182
|
+
pointVisible(window: string, x: number, y: number): Promise<boolean>;
|
|
183
|
+
clipboardRead(): Promise<string>;
|
|
184
|
+
clipboardWrite(text: string): Promise<void>;
|
|
185
|
+
close(): Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
export type ComputerTargetFactory = () => Promise<ComputerTarget>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the computer tools need from whatever drives the machine.
|
|
3
|
+
*
|
|
4
|
+
* The engine holds no platform code. The desktop app supplies a target, which
|
|
5
|
+
* in practice is a native helper spoken to over stdio (`helper-client.ts`): a
|
|
6
|
+
* Swift binary on macOS and a Rust one on Windows, both answering the same
|
|
7
|
+
* protocol. Tests supply a fake.
|
|
8
|
+
*
|
|
9
|
+
* Units: every frame and point here is in the helper's screen coordinates —
|
|
10
|
+
* points on macOS, physical pixels on a per-monitor-DPI-aware Windows process.
|
|
11
|
+
* The engine never needs to know which: it maps a coordinate in a screenshot
|
|
12
|
+
* back through that screenshot's own `frame`, and the helper interprets the
|
|
13
|
+
* result in the unit it reported the frame in.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A refusal the model and the page can act on, rather than a stack trace.
|
|
17
|
+
*
|
|
18
|
+
* `code` is part of the helper protocol: both helpers raise the same codes.
|
|
19
|
+
*/
|
|
20
|
+
export class ComputerError extends Error {
|
|
21
|
+
code;
|
|
22
|
+
grant;
|
|
23
|
+
constructor(code, message, grant) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = "ComputerError";
|
|
26
|
+
this.code = code;
|
|
27
|
+
if (grant)
|
|
28
|
+
this.grant = grant;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/computer/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAmFH;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,CAAoB;IACxB,KAAK,CAA6B;IAE3C,YAAY,IAAuB,EAAE,OAAe,EAAE,KAAiC;QACrF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tool } from "../tools/types.ts";
|
|
2
|
+
import type { ComputerUseSession } from "./session.ts";
|
|
3
|
+
export declare function createComputerTools(session: ComputerUseSession): Tool[];
|
|
4
|
+
/** `mod+shift+s` → key "s" with the platform's command key and shift. */
|
|
5
|
+
export declare function parseChord(chord: string, platform: "darwin" | "win32"): {
|
|
6
|
+
key: string;
|
|
7
|
+
modifiers: string[];
|
|
8
|
+
};
|