@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
package/dist/tools/types.d.ts
CHANGED
|
@@ -42,7 +42,91 @@ export interface SubagentRunOptions {
|
|
|
42
42
|
description?: string;
|
|
43
43
|
model?: string;
|
|
44
44
|
signal?: AbortSignal;
|
|
45
|
+
/**
|
|
46
|
+
* `worktree`: run in a fresh worktree beside the project, so its edits
|
|
47
|
+
* cannot collide with the parent's. Kept afterwards only if it changed
|
|
48
|
+
* something.
|
|
49
|
+
*/
|
|
50
|
+
isolation?: "worktree";
|
|
51
|
+
/**
|
|
52
|
+
* Hand the subagent the computer_* tools. Only honoured where the parent
|
|
53
|
+
* conversation has Computer Use switched on; never inherited otherwise.
|
|
54
|
+
*/
|
|
55
|
+
computer?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export type BackgroundTaskStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
58
|
+
/** One background task as tools and frontends see it. */
|
|
59
|
+
export interface BackgroundTaskView {
|
|
60
|
+
id: string;
|
|
61
|
+
agentType: string;
|
|
62
|
+
description: string;
|
|
63
|
+
status: BackgroundTaskStatus;
|
|
64
|
+
queuedAt: number;
|
|
65
|
+
startedAt?: number;
|
|
66
|
+
endedAt?: number;
|
|
67
|
+
turns: number;
|
|
68
|
+
usage: {
|
|
69
|
+
inputTokens: number;
|
|
70
|
+
outputTokens: number;
|
|
71
|
+
};
|
|
72
|
+
/** What it is doing right now, while it runs: the title of its current tool. */
|
|
73
|
+
activity?: string;
|
|
74
|
+
/** Its final message, once it has completed. */
|
|
75
|
+
result?: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
/** Where its edits were kept, when it ran in a worktree and changed something. */
|
|
78
|
+
worktree?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Put away by the person: an ended task they no longer want listed over the
|
|
81
|
+
* composer. Still there to open and follow up; a follow-up brings it back.
|
|
82
|
+
*/
|
|
83
|
+
dismissed?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Subagents that run on while the conversation goes on, their results read
|
|
87
|
+
* back in when they end. Lent only where something can deliver a result that
|
|
88
|
+
* arrives after the turn that asked for it has finished.
|
|
89
|
+
*/
|
|
90
|
+
export interface BackgroundTaskHost {
|
|
91
|
+
start(opts: SubagentRunOptions): BackgroundTaskView;
|
|
92
|
+
get(id: string): BackgroundTaskView | undefined;
|
|
93
|
+
list(): BackgroundTaskView[];
|
|
94
|
+
stop(id: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Message a task: read at its next gap while it runs; for one that has
|
|
97
|
+
* ended, a new run that continues its conversation. Stopped tasks refuse.
|
|
98
|
+
*/
|
|
99
|
+
send(id: string, message: string): "interjected" | "resumed" | "unknown" | "stopped" | "busy";
|
|
100
|
+
/** Put an ended task away from the list over the composer. */
|
|
101
|
+
dismiss(id: string): boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface WorktreeStartOptions {
|
|
104
|
+
/** What the new session is for; also what the worktree is named after. */
|
|
105
|
+
task: string;
|
|
106
|
+
/** ASCII name for the directory and branch when the task has none. */
|
|
107
|
+
slug?: string;
|
|
108
|
+
type?: "feat" | "fix" | "chore" | "docs";
|
|
109
|
+
/** The first message of the new session. */
|
|
110
|
+
prompt: string;
|
|
45
111
|
}
|
|
112
|
+
export interface WorktreeStartResult {
|
|
113
|
+
sessionId: string;
|
|
114
|
+
path: string;
|
|
115
|
+
kind: "git" | "clone";
|
|
116
|
+
branch?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* What a frontend lends the engine to host a worktree session: given the
|
|
120
|
+
* session asking and what it asked for, make the worktree and start the
|
|
121
|
+
* session there. The engine cannot do this itself — sessions belong to
|
|
122
|
+
* whichever frontend holds them.
|
|
123
|
+
*/
|
|
124
|
+
export type WorktreeLauncher = (request: WorktreeStartOptions & {
|
|
125
|
+
from: {
|
|
126
|
+
cwd: string;
|
|
127
|
+
sessionId: string;
|
|
128
|
+
};
|
|
129
|
+
}) => Promise<WorktreeStartResult>;
|
|
46
130
|
export interface SubagentRunResult {
|
|
47
131
|
text: string;
|
|
48
132
|
turns: number;
|
|
@@ -57,7 +141,15 @@ export interface ToolHost {
|
|
|
57
141
|
listSubagentTypes(): Array<{
|
|
58
142
|
name: string;
|
|
59
143
|
description: string;
|
|
144
|
+
readOnly?: boolean;
|
|
145
|
+
isolation?: "worktree";
|
|
60
146
|
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Subagents that run in the background. Absent where a result that arrives
|
|
149
|
+
* after the turn has ended would reach nobody — headless runs, subagents —
|
|
150
|
+
* and the task tool then runs the work in the foreground instead.
|
|
151
|
+
*/
|
|
152
|
+
backgroundTasks?: BackgroundTaskHost;
|
|
61
153
|
/** Shared, session-scoped scratch state (the todo list lives here). */
|
|
62
154
|
state: Map<string, unknown>;
|
|
63
155
|
/**
|
|
@@ -70,6 +162,12 @@ export interface ToolHost {
|
|
|
70
162
|
* layer still never imports the agent.
|
|
71
163
|
*/
|
|
72
164
|
resolvePath?(input: string, access: "read" | "write"): string;
|
|
165
|
+
/**
|
|
166
|
+
* Make a worktree beside the project and start a new session in it with a
|
|
167
|
+
* prompt, returning at once. Absent where no frontend can host a second
|
|
168
|
+
* session (headless, the terminal UI, subagents).
|
|
169
|
+
*/
|
|
170
|
+
startWorktree?(opts: WorktreeStartOptions): Promise<WorktreeStartResult>;
|
|
73
171
|
}
|
|
74
172
|
export interface Tool {
|
|
75
173
|
name: string;
|
|
@@ -81,8 +179,22 @@ export interface Tool {
|
|
|
81
179
|
* Anything that mutates state or reaches the network should leave this off.
|
|
82
180
|
*/
|
|
83
181
|
readOnly?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Changes nothing, so plan mode lets it run — but unlike `readOnly` it still
|
|
184
|
+
* goes through the permission prompt. For tools whose reading is itself the
|
|
185
|
+
* thing to approve: a screenshot of another app shows whatever is in it.
|
|
186
|
+
*/
|
|
187
|
+
observes?: boolean;
|
|
84
188
|
/** Safe to run concurrently with other tools in the same assistant turn. */
|
|
85
189
|
concurrencySafe?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The same question asked of one call, for a tool whose answer depends on
|
|
192
|
+
* its input. Consulted only when `concurrencySafe` is not already true; it
|
|
193
|
+
* receives the raw, unvalidated input, so it must tolerate anything. The
|
|
194
|
+
* host says what the call would actually do here — a background task
|
|
195
|
+
* where none can be offered runs in the foreground, for instance.
|
|
196
|
+
*/
|
|
197
|
+
concurrencySafeFor?(input: unknown, host: ToolHost): boolean;
|
|
86
198
|
/**
|
|
87
199
|
* Mutates only this session's own scratch state — no file, no command, no
|
|
88
200
|
* network, nothing that outlives the process.
|
package/dist/tools/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AA4OA,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,QAAkC;IACvE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,QAAgB,EAAE,IAAY,EAAE,OAAgB;IACxE,MAAM,OAAO,GAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,IAAI,OAAO;QAAE,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAkB;IAC/C,OAAO,MAAM,CAAC,OAAO;SAClB,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worktrees: a sibling copy of a project for a task that runs beside another.
|
|
3
|
+
*
|
|
4
|
+
* Two sessions in one checkout edit the same files. A worktree gives the
|
|
5
|
+
* second one its own tree next to the first — `OHarness/` and
|
|
6
|
+
* `OHarness-fix-tmp-writes/` — so neither sees the other's half-made edits.
|
|
7
|
+
*
|
|
8
|
+
* A git repository gets a real `git worktree` on a branch of its own, based on
|
|
9
|
+
* the remote's default branch. A plain directory gets a copy-on-write clone,
|
|
10
|
+
* and its changes are tracked by a **shadow repository** kept under the user
|
|
11
|
+
* directory: nothing is written into the folder that would not have been
|
|
12
|
+
* there anyway, and "apply back" is a diff against the moment it was made.
|
|
13
|
+
*
|
|
14
|
+
* Every worktree made here is recorded in `worktrees.json`, so the app can
|
|
15
|
+
* show it under the project it came from and offer the way out of it.
|
|
16
|
+
*/
|
|
17
|
+
export type WorktreeKind = "git" | "clone";
|
|
18
|
+
export type BranchType = "feat" | "fix" | "chore" | "docs";
|
|
19
|
+
export declare const BRANCH_TYPES: readonly BranchType[];
|
|
20
|
+
export interface Worktree {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: WorktreeKind;
|
|
23
|
+
/** The worktree's own root. */
|
|
24
|
+
path: string;
|
|
25
|
+
/**
|
|
26
|
+
* Where sessions in it run. The root, unless the project was a folder
|
|
27
|
+
* inside a larger repository — then the same folder inside the worktree.
|
|
28
|
+
*/
|
|
29
|
+
cwd: string;
|
|
30
|
+
/** The project directory it was made from. */
|
|
31
|
+
source: string;
|
|
32
|
+
/** git: the main worktree of the repository. */
|
|
33
|
+
repo?: string;
|
|
34
|
+
/** git: the branch created for it. */
|
|
35
|
+
branch?: string;
|
|
36
|
+
/** git: what the branch started from, by name (`origin/main`, `HEAD`). */
|
|
37
|
+
baseRef?: string;
|
|
38
|
+
/** The commit it started from: the base commit, or the shadow's baseline. */
|
|
39
|
+
base?: string;
|
|
40
|
+
/** clone: the shadow repository tracking it. */
|
|
41
|
+
shadow?: string;
|
|
42
|
+
task: string;
|
|
43
|
+
slug: string;
|
|
44
|
+
type: BranchType;
|
|
45
|
+
createdAt: number;
|
|
46
|
+
}
|
|
47
|
+
export interface WorktreeStatus {
|
|
48
|
+
exists: boolean;
|
|
49
|
+
/** Changed paths, as `git status --porcelain` lists them. */
|
|
50
|
+
changes: string[];
|
|
51
|
+
/** git: commits on the branch since it started. */
|
|
52
|
+
commits: number;
|
|
53
|
+
/** Whether finishing it loses nothing: no changes and no commits. */
|
|
54
|
+
clean: boolean;
|
|
55
|
+
}
|
|
56
|
+
export type FinishAction = "remove" | "discard" | "commit" | "push" | "merge" | "apply";
|
|
57
|
+
export interface FinishResult {
|
|
58
|
+
action: FinishAction;
|
|
59
|
+
/** Whether the worktree is gone afterwards. */
|
|
60
|
+
removed: boolean;
|
|
61
|
+
message: string;
|
|
62
|
+
/** push: where to open a pull request, when the remote is known. */
|
|
63
|
+
url?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface CreateOptions {
|
|
66
|
+
task: string;
|
|
67
|
+
/** The name's tail. Derived from the task when it is left out. */
|
|
68
|
+
slug?: string;
|
|
69
|
+
type?: BranchType;
|
|
70
|
+
/** git: start from this instead of the remote's default branch. */
|
|
71
|
+
base?: string;
|
|
72
|
+
/** Skip `git fetch` (tests, offline). */
|
|
73
|
+
fetch?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A directory- and branch-safe name from free text: lowercase ASCII words
|
|
77
|
+
* joined by hyphens, at most 40 characters, cut at a word boundary.
|
|
78
|
+
*
|
|
79
|
+
* Returns "" when nothing ASCII is left — a title written in Chinese, say —
|
|
80
|
+
* so the caller can ask for a slug instead of inventing a meaningless one.
|
|
81
|
+
*/
|
|
82
|
+
export declare function slugify(text: string): string;
|
|
83
|
+
/** The branch type a task reads as. `feat` unless it says otherwise. */
|
|
84
|
+
export declare function branchType(task: string): BranchType;
|
|
85
|
+
export declare function listWorktrees(): Promise<Worktree[]>;
|
|
86
|
+
/** The worktree a directory belongs to: its root, its session cwd, or anything inside. */
|
|
87
|
+
export declare function findWorktree(dir: string): Promise<Worktree | undefined>;
|
|
88
|
+
/**
|
|
89
|
+
* The name a worktree for this task would get, without making it — what a
|
|
90
|
+
* dialog shows before the person confirms.
|
|
91
|
+
*/
|
|
92
|
+
export declare function previewWorktree(projectDir: string, opts: {
|
|
93
|
+
task: string;
|
|
94
|
+
slug?: string;
|
|
95
|
+
type?: BranchType;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
kind: WorktreeKind;
|
|
98
|
+
path: string;
|
|
99
|
+
branch?: string;
|
|
100
|
+
slug: string;
|
|
101
|
+
type: BranchType;
|
|
102
|
+
}>;
|
|
103
|
+
export declare function createWorktree(projectDir: string, opts: CreateOptions): Promise<Worktree>;
|
|
104
|
+
export declare function worktreeStatus(one: Worktree): Promise<WorktreeStatus>;
|
|
105
|
+
/** `git@github.com:a/b.git` or `https://github.com/a/b(.git)` → `https://github.com/a/b`. */
|
|
106
|
+
export declare function webUrl(remote: string): string | undefined;
|
|
107
|
+
export declare function finishWorktree(one: Worktree, action: FinishAction, opts?: {
|
|
108
|
+
message?: string;
|
|
109
|
+
}): Promise<FinishResult>;
|