@oharness/engine 0.9.3 → 0.11.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/acp/claude.d.ts +34 -0
- package/dist/acp/claude.js +122 -0
- package/dist/acp/claude.js.map +1 -0
- package/dist/acp/client.d.ts +193 -0
- package/dist/acp/client.js +279 -0
- package/dist/acp/client.js.map +1 -0
- package/dist/acp/runner.d.ts +80 -0
- package/dist/acp/runner.js +159 -0
- package/dist/acp/runner.js.map +1 -0
- package/dist/agent/agent.d.ts +258 -2
- package/dist/agent/agent.js +1010 -53
- 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/hooks.js +6 -6
- package/dist/agent/hooks.js.map +1 -1
- 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 +38 -0
- package/dist/agent/session.js +91 -2
- 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 +21 -0
- package/dist/agent/subagent.js +17 -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/index.d.ts +3 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/manager.d.ts +9 -0
- package/dist/auth/manager.js +71 -6
- package/dist/auth/manager.js.map +1 -1
- package/dist/auth/oauth.d.ts +33 -0
- package/dist/auth/oauth.js +59 -8
- package/dist/auth/oauth.js.map +1 -1
- package/dist/auth/providers/account.js +5 -4
- package/dist/auth/providers/account.js.map +1 -1
- package/dist/auth/providers/anthropic.d.ts +25 -5
- package/dist/auth/providers/anthropic.js +47 -6
- package/dist/auth/providers/anthropic.js.map +1 -1
- package/dist/auth/providers/chatgpt.d.ts +8 -0
- package/dist/auth/providers/chatgpt.js +180 -0
- package/dist/auth/providers/chatgpt.js.map +1 -0
- package/dist/auth/providers/openrouter.d.ts +2 -0
- package/dist/auth/providers/openrouter.js +101 -0
- package/dist/auth/providers/openrouter.js.map +1 -0
- package/dist/auth/types.d.ts +15 -0
- package/dist/auth/types.js.map +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/plugin.d.ts +6 -1
- package/dist/browser/plugin.js.map +1 -1
- package/dist/browser/session.d.ts +47 -0
- package/dist/browser/session.js +177 -2
- package/dist/browser/session.js.map +1 -1
- package/dist/browser/tools.js +142 -18
- 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 +174 -0
- package/dist/computer/cua-driver.js +597 -0
- package/dist/computer/cua-driver.js.map +1 -0
- package/dist/computer/helper-client.d.ts +80 -0
- package/dist/computer/helper-client.js +166 -0
- package/dist/computer/helper-client.js.map +1 -0
- package/dist/computer/index.d.ts +16 -0
- package/dist/computer/index.js +9 -0
- package/dist/computer/index.js.map +1 -0
- package/dist/computer/mode.d.ts +34 -0
- package/dist/computer/mode.js +52 -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 +228 -0
- package/dist/computer/session.js +493 -0
- package/dist/computer/session.js.map +1 -0
- package/dist/computer/target.d.ts +206 -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 +664 -0
- package/dist/computer/tools.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js.map +1 -1
- 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 +128 -1
- package/dist/harness.js +287 -30
- 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/manager.d.ts +15 -0
- package/dist/mcp/manager.js +28 -1
- package/dist/mcp/manager.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/catalog.json +14 -3
- package/dist/providers/discovery.js +10 -2
- package/dist/providers/discovery.js.map +1 -1
- package/dist/providers/models-dev.d.ts +15 -0
- package/dist/providers/models-dev.js +15 -0
- package/dist/providers/models-dev.js.map +1 -1
- package/dist/providers/models-dev.json +114 -102
- package/dist/providers/piai.d.ts +54 -2
- package/dist/providers/piai.js +154 -9
- package/dist/providers/piai.js.map +1 -1
- package/dist/providers/registry.d.ts +16 -1
- package/dist/providers/registry.js +42 -11
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/types.d.ts +6 -0
- package/dist/providers/types.js.map +1 -1
- package/dist/runtime-plugins/builtin/studio.d.ts +7 -0
- package/dist/runtime-plugins/builtin/studio.js +69 -4
- package/dist/runtime-plugins/builtin/studio.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 +8 -11
- 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/util/shell.d.ts +30 -0
- package/dist/util/shell.js +70 -0
- package/dist/util/shell.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
- package/skills/media-generation/SKILL.md +22 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Logger } from "../util/logger.ts";
|
|
2
|
+
import type { AppInfo, AxAction, AxNode, ComputerInputEvent, ComputerPermissions, ComputerTarget, DisplayInfo, HelperInfo, Rect, Shot, WindowInfo } from "./target.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A `ComputerTarget` backed by Cua Driver (github.com/trycua/cua, MIT).
|
|
5
|
+
*
|
|
6
|
+
* Cua Driver is the platform layer: ScreenCaptureKit and AX with SkyLight
|
|
7
|
+
* background input on macOS; UIA, MSAA, PostMessage and WGC on Windows. We
|
|
8
|
+
* drive its MCP server over stdio and keep everything above it — the tools
|
|
9
|
+
* the model sees, per-app approval, tiers, the arbiter — our own. The model
|
|
10
|
+
* never talks to Cua Driver directly: only this adapter does, and it calls a
|
|
11
|
+
* fixed handful of its 58 tools.
|
|
12
|
+
*
|
|
13
|
+
* How it is run matters:
|
|
14
|
+
*
|
|
15
|
+
* - Embedded (`CUA_DRIVER_EMBEDDED=1`) and spawned by the app itself, so
|
|
16
|
+
* macOS charges its TCC requests to OHarness and the person grants
|
|
17
|
+
* OHarness, not a second app. The driver never prompts in this mode; the
|
|
18
|
+
* host asks (see `requestPermissions`).
|
|
19
|
+
* - Telemetry and the update check off. Both default on, embedded or not.
|
|
20
|
+
* - `mcp --direct`: no daemon and no Cua cursor. The desktop app draws its
|
|
21
|
+
* own, per conversation, and keeps it out of captures.
|
|
22
|
+
*
|
|
23
|
+
* Coordinates: Cua takes pointer x/y in pixels of the window screenshot it
|
|
24
|
+
* last returned. The engine works in screen units (each screenshot's frame
|
|
25
|
+
* says where its pixels sit), so pointer events are mapped back through the
|
|
26
|
+
* last screenshot of that window here. Element frames already come in screen
|
|
27
|
+
* units.
|
|
28
|
+
*/
|
|
29
|
+
export interface CuaDriverOptions {
|
|
30
|
+
/** The cua-driver executable. */
|
|
31
|
+
path: string;
|
|
32
|
+
/** The host app's bundle id, for Cua's own identity checks. */
|
|
33
|
+
hostBundleId?: string;
|
|
34
|
+
/** Where the driver may keep state; telemetry is off either way. */
|
|
35
|
+
stateDir?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The Rego policy the driver enforces on every call: only the tools this
|
|
38
|
+
* adapter uses, and none that write files (desktop/computer-helper/cua/policy.rego).
|
|
39
|
+
*/
|
|
40
|
+
policyFile?: string;
|
|
41
|
+
logger?: Logger;
|
|
42
|
+
/**
|
|
43
|
+
* Ask the OS for Screen Recording or Accessibility. Embedded, the driver
|
|
44
|
+
* never prompts: the host app has to, as itself.
|
|
45
|
+
*/
|
|
46
|
+
requestPermissions?: (grant?: keyof ComputerPermissions) => Promise<void>;
|
|
47
|
+
/** Milliseconds since the person's last real input, from the host. */
|
|
48
|
+
idle?: () => Promise<number>;
|
|
49
|
+
/**
|
|
50
|
+
* Who a process is, asked live. Cua's running-app list is a snapshot that
|
|
51
|
+
* goes stale (see `apps`); this names the pids it is missing. Defaults to
|
|
52
|
+
* `lsappinfo` on macOS.
|
|
53
|
+
*/
|
|
54
|
+
appForPid?: (pid: number) => Promise<{
|
|
55
|
+
name: string;
|
|
56
|
+
id: string;
|
|
57
|
+
} | undefined>;
|
|
58
|
+
/** Whether a pid is still a process. Injectable for tests. */
|
|
59
|
+
alive?: (pid: number) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The monitors, from the host. Cua Driver only knows the main one, so
|
|
62
|
+
* without this the agent sees a single display.
|
|
63
|
+
*/
|
|
64
|
+
displays?: () => Promise<DisplayInfo[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Capture a display, or a region of one, as the host. Cua's desktop
|
|
67
|
+
* capture is the main display, whole; any other display, and any region of
|
|
68
|
+
* one, comes from here.
|
|
69
|
+
*/
|
|
70
|
+
captureDisplay?: (opts: {
|
|
71
|
+
display?: string;
|
|
72
|
+
region?: Rect;
|
|
73
|
+
maxWidth: number;
|
|
74
|
+
}) => Promise<Shot>;
|
|
75
|
+
/**
|
|
76
|
+
* A region of a window at full pixel density, from the host. Cua's own
|
|
77
|
+
* zoom stops at 500 px wide, which turns a strip across a window into a
|
|
78
|
+
* picture too small to read; it stays the fallback.
|
|
79
|
+
*/
|
|
80
|
+
captureWindow?: (opts: {
|
|
81
|
+
window: string;
|
|
82
|
+
region: Rect;
|
|
83
|
+
maxWidth: number;
|
|
84
|
+
}) => Promise<Shot>;
|
|
85
|
+
}
|
|
86
|
+
export declare class CuaDriverTarget implements ComputerTarget {
|
|
87
|
+
private readonly client;
|
|
88
|
+
private readonly opts;
|
|
89
|
+
private readonly pids;
|
|
90
|
+
private readonly shots;
|
|
91
|
+
private readonly refs;
|
|
92
|
+
/** The field typing goes to, per window, set by `axAction focus`. */
|
|
93
|
+
private readonly targets;
|
|
94
|
+
private appIds;
|
|
95
|
+
private version;
|
|
96
|
+
private constructor();
|
|
97
|
+
static start(opts: CuaDriverOptions): Promise<CuaDriverTarget>;
|
|
98
|
+
private call;
|
|
99
|
+
private refusal;
|
|
100
|
+
private pidOf;
|
|
101
|
+
/** Screen point → pixels of the last screenshot of this window, taking one if needed. */
|
|
102
|
+
private toWindowPixels;
|
|
103
|
+
info(): Promise<HelperInfo>;
|
|
104
|
+
permissions(): Promise<ComputerPermissions>;
|
|
105
|
+
requestPermissions(grant?: keyof ComputerPermissions): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* The running apps, checked against the live windows.
|
|
108
|
+
*
|
|
109
|
+
* Cua builds `list_apps` from NSWorkspace's runningApplications, which a
|
|
110
|
+
* process only keeps current by running its main run loop — and the driver,
|
|
111
|
+
* embedded and long-lived, does not. The list stays as it was when the
|
|
112
|
+
* driver started: an app launched since is missing, and one relaunched keeps
|
|
113
|
+
* its old, dead pid. Windows, from the window server, are live. So an entry
|
|
114
|
+
* whose process is gone is dropped, and a pid that owns a window but is not
|
|
115
|
+
* listed is named live — by bundle id, which is what tiers and approvals go
|
|
116
|
+
* by, so a browser opened after OHarness is still a browser.
|
|
117
|
+
*/
|
|
118
|
+
apps(): Promise<AppInfo[]>;
|
|
119
|
+
private reconcile;
|
|
120
|
+
windows(opts?: {
|
|
121
|
+
pid?: number;
|
|
122
|
+
}): Promise<WindowInfo[]>;
|
|
123
|
+
displays(): Promise<DisplayInfo[]>;
|
|
124
|
+
screenshot(opts: {
|
|
125
|
+
window?: string;
|
|
126
|
+
display?: string;
|
|
127
|
+
region?: Rect;
|
|
128
|
+
maxWidth?: number;
|
|
129
|
+
}): Promise<Shot>;
|
|
130
|
+
/**
|
|
131
|
+
* A region of a window through Cua's own zoom: cropped from a full-density
|
|
132
|
+
* capture, padded by a fifth on each side, at most 500 px wide. It reads
|
|
133
|
+
* the region in pixels of the last screenshot this connection took of the
|
|
134
|
+
* window, and a tree read since may have replaced that one, so a refusal
|
|
135
|
+
* for want of it takes a screenshot the same size and tries once more.
|
|
136
|
+
*/
|
|
137
|
+
private zoom;
|
|
138
|
+
axTree(opts: {
|
|
139
|
+
window: string;
|
|
140
|
+
depth?: number;
|
|
141
|
+
maxNodes?: number;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
nodes: AxNode[];
|
|
144
|
+
truncated: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
private refInfo;
|
|
147
|
+
/**
|
|
148
|
+
* Run an action on a ref, re-finding the element once if its token went
|
|
149
|
+
* stale. Any snapshot of a window — a screenshot included — supersedes the
|
|
150
|
+
* tokens of the one before, and the model reasonably reads the tree, looks
|
|
151
|
+
* at the window, then clicks.
|
|
152
|
+
*/
|
|
153
|
+
private onRef;
|
|
154
|
+
axAction(ref: string, action: AxAction, value?: string): Promise<void>;
|
|
155
|
+
input(event: ComputerInputEvent, opts: {
|
|
156
|
+
window?: string;
|
|
157
|
+
foreground: boolean;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
invokeMenu(window: string, path: string[]): Promise<void>;
|
|
160
|
+
open(app: string): Promise<{
|
|
161
|
+
pid?: number;
|
|
162
|
+
}>;
|
|
163
|
+
frontmost(): Promise<{
|
|
164
|
+
pid: number;
|
|
165
|
+
appId: string;
|
|
166
|
+
window?: string;
|
|
167
|
+
}>;
|
|
168
|
+
activate(pid: number): Promise<void>;
|
|
169
|
+
idle(): Promise<number>;
|
|
170
|
+
pointVisible(window: string, x: number, y: number): Promise<boolean>;
|
|
171
|
+
clipboardRead(): Promise<string>;
|
|
172
|
+
clipboardWrite(text: string): Promise<void>;
|
|
173
|
+
close(): Promise<void>;
|
|
174
|
+
}
|