owenloop 0.4.1 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +58 -31
- package/bin/owenloop.mjs +2 -2
- package/dist/packages/work/src/agent/brief.d.ts +172 -0
- package/dist/packages/work/src/agent/brief.js +193 -0
- package/dist/packages/work/src/agent/loop.d.ts +135 -0
- package/dist/packages/work/src/agent/loop.js +542 -0
- package/dist/packages/work/src/agent/workdir.d.ts +210 -0
- package/dist/packages/work/src/agent/workdir.js +319 -0
- package/dist/packages/work/src/bundle/cache.d.ts +90 -0
- package/dist/packages/work/src/bundle/cache.js +324 -0
- package/dist/packages/work/src/bundle/fetch.d.ts +85 -0
- package/dist/packages/work/src/bundle/fetch.js +325 -0
- package/dist/packages/work/src/bundle/types.d.ts +160 -0
- package/dist/packages/work/src/bundle/types.js +1 -0
- package/dist/packages/work/src/credentials/owenloop.d.ts +11 -0
- package/dist/packages/work/src/credentials/owenloop.js +28 -0
- package/dist/packages/work/src/credentials/reader.d.ts +36 -0
- package/dist/packages/work/src/credentials/reader.js +32 -0
- package/dist/packages/work/src/credentials/resolve.d.ts +19 -0
- package/dist/packages/work/src/credentials/resolve.js +56 -0
- package/dist/packages/work/src/exec/loop.d.ts +29 -0
- package/dist/packages/work/src/exec/loop.js +215 -0
- package/dist/packages/work/src/exec/receipt.d.ts +38 -0
- package/dist/packages/work/src/exec/receipt.js +21 -0
- package/dist/packages/work/src/exec/runner.d.ts +65 -0
- package/dist/packages/work/src/exec/runner.js +185 -0
- package/dist/packages/work/src/harness/child-env.d.ts +100 -0
- package/dist/packages/work/src/harness/child-env.js +127 -0
- package/dist/packages/work/src/harness/claude.d.ts +128 -0
- package/dist/packages/work/src/harness/claude.js +635 -0
- package/dist/packages/work/src/harness/codex.d.ts +110 -0
- package/dist/packages/work/src/harness/codex.js +896 -0
- package/dist/packages/work/src/harness/contract.d.ts +283 -0
- package/dist/packages/work/src/harness/contract.js +32 -0
- package/dist/packages/work/src/harness/fake.d.ts +59 -0
- package/dist/packages/work/src/harness/fake.js +90 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.d.ts +108 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.js +344 -0
- package/dist/packages/work/src/harness/permissions.d.ts +62 -0
- package/dist/packages/work/src/harness/permissions.js +93 -0
- package/dist/packages/work/src/harness/registry.d.ts +47 -0
- package/dist/packages/work/src/harness/registry.js +45 -0
- package/dist/packages/work/src/harness/session-store.d.ts +163 -0
- package/dist/packages/work/src/harness/session-store.js +319 -0
- package/dist/packages/work/src/harness/types.d.ts +29 -0
- package/dist/packages/work/src/harness/types.js +14 -0
- package/dist/packages/work/src/harnesses.d.ts +38 -0
- package/dist/packages/work/src/harnesses.js +38 -0
- package/dist/packages/work/src/hold/loop.d.ts +36 -0
- package/dist/packages/work/src/hold/loop.js +23 -0
- package/dist/packages/work/src/hold/mcp.d.ts +55 -0
- package/dist/packages/work/src/hold/mcp.js +149 -0
- package/dist/packages/work/src/hub/client.d.ts +22 -0
- package/dist/packages/work/src/hub/client.js +78 -0
- package/dist/packages/work/src/hub/types.d.ts +290 -0
- package/dist/packages/work/src/hub/types.js +28 -0
- package/dist/packages/work/src/lease/loop.d.ts +94 -0
- package/dist/packages/work/src/lease/loop.js +277 -0
- package/dist/packages/work/src/main.d.ts +1 -0
- package/dist/packages/work/src/main.js +48 -0
- package/dist/packages/work/src/mcp/server.d.ts +125 -0
- package/dist/packages/work/src/mcp/server.js +320 -0
- package/dist/packages/work/src/roles/agent-run.d.ts +118 -0
- package/dist/packages/work/src/roles/agent-run.js +447 -0
- package/dist/packages/work/src/roles/exec.d.ts +40 -0
- package/dist/packages/work/src/roles/exec.js +203 -0
- package/dist/packages/work/src/roles/hold.d.ts +68 -0
- package/dist/packages/work/src/roles/hold.js +324 -0
- package/dist/packages/work/src/roles/join.d.ts +18 -0
- package/dist/packages/work/src/roles/join.js +204 -0
- package/dist/packages/work/src/roles/lint.d.ts +59 -0
- package/dist/packages/work/src/roles/lint.js +200 -0
- package/dist/packages/work/src/roles/prepare.d.ts +1 -0
- package/dist/packages/work/src/roles/prepare.js +249 -0
- package/dist/packages/work/src/roles/release.d.ts +48 -0
- package/dist/packages/work/src/roles/release.js +137 -0
- package/dist/packages/work/src/roles/sessions.d.ts +61 -0
- package/dist/packages/work/src/roles/sessions.js +180 -0
- package/dist/packages/work/src/roles/settings.d.ts +6 -0
- package/dist/packages/work/src/roles/settings.js +66 -0
- package/dist/packages/work/src/roles/shift.d.ts +12 -0
- package/dist/packages/work/src/roles/shift.js +228 -0
- package/dist/packages/work/src/roles/signals.d.ts +55 -0
- package/dist/packages/work/src/roles/signals.js +62 -0
- package/dist/packages/work/src/settings/provision.d.ts +21 -0
- package/dist/packages/work/src/settings/provision.js +47 -0
- package/dist/packages/work/src/settings/settings.d.ts +120 -0
- package/dist/packages/work/src/settings/settings.js +116 -0
- package/dist/packages/work/src/shift/client.d.ts +24 -0
- package/dist/packages/work/src/shift/client.js +124 -0
- package/dist/packages/work/src/shift/loop.d.ts +120 -0
- package/dist/packages/work/src/shift/loop.js +468 -0
- package/dist/packages/work/src/shift/protocol.d.ts +91 -0
- package/dist/packages/work/src/shift/protocol.js +24 -0
- package/dist/packages/work/src/shift/routing.d.ts +35 -0
- package/dist/packages/work/src/shift/routing.js +50 -0
- package/dist/packages/work/src/shift/runtime.d.ts +43 -0
- package/dist/packages/work/src/shift/runtime.js +274 -0
- package/dist/packages/work/src/shift/server.d.ts +23 -0
- package/dist/packages/work/src/shift/server.js +716 -0
- package/dist/packages/work/src/shift/spawn.d.ts +86 -0
- package/dist/packages/work/src/shift/spawn.js +100 -0
- package/dist/packages/work/src/shift/state.d.ts +77 -0
- package/dist/packages/work/src/shift/state.js +162 -0
- package/dist/packages/work/src/usage.d.ts +6 -0
- package/dist/packages/work/src/usage.js +175 -0
- package/dist/{cli.d.ts → src/cli.d.ts} +18 -3
- package/dist/{cli.js → src/cli.js} +770 -114
- package/dist/{credentials.d.ts → src/credentials.d.ts} +18 -12
- package/dist/{credentials.js → src/credentials.js} +14 -12
- package/dist/{defs.js → src/defs.js} +36 -36
- package/dist/{engine.d.ts → src/engine.d.ts} +8 -8
- package/dist/{engine.js → src/engine.js} +14 -14
- package/dist/{hub.d.ts → src/hub.d.ts} +205 -10
- package/dist/{hub.js → src/hub.js} +370 -12
- package/dist/{index.d.ts → src/index.d.ts} +1 -1
- package/dist/{index.js → src/index.js} +1 -1
- package/dist/{mcp → src/mcp}/serve.d.ts +5 -4
- package/dist/{mcp → src/mcp}/serve.js +168 -31
- package/dist/{mcp → src/mcp}/server.d.ts +6 -9
- package/dist/{mcp → src/mcp}/server.js +6 -9
- package/dist/{model.js → src/model.js} +1 -1
- package/dist/{types.d.ts → src/types.d.ts} +18 -18
- package/dist/{util.d.ts → src/util.d.ts} +3 -2
- package/dist/{util.js → src/util.js} +3 -2
- package/dist/{owenwork.d.ts → src/work-settings.d.ts} +22 -22
- package/dist/{owenwork.js → src/work-settings.js} +27 -27
- package/docs/authoring.md +93 -53
- package/docs/cli.md +597 -76
- package/docs/design.md +33 -33
- package/docs/embedding.md +10 -9
- package/examples/workflows/{command-worker.yaml → command-executor.yaml} +15 -15
- package/examples/workflows/compile-dev-playbook.yaml +338 -0
- package/examples/workflows/judges/gate-sharpness.md +39 -0
- package/examples/workflows/judges/security.md +34 -0
- package/package.json +17 -8
- /package/dist/{add.d.ts → src/add.d.ts} +0 -0
- /package/dist/{add.js → src/add.js} +0 -0
- /package/dist/{defs.d.ts → src/defs.d.ts} +0 -0
- /package/dist/{factory.d.ts → src/factory.d.ts} +0 -0
- /package/dist/{factory.js → src/factory.js} +0 -0
- /package/dist/{lock.d.ts → src/lock.d.ts} +0 -0
- /package/dist/{lock.js → src/lock.js} +0 -0
- /package/dist/{model.d.ts → src/model.d.ts} +0 -0
- /package/dist/{paths.d.ts → src/paths.d.ts} +0 -0
- /package/dist/{paths.js → src/paths.js} +0 -0
- /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
- /package/dist/{schema.js → src/schema.js} +0 -0
- /package/dist/{store.d.ts → src/store.d.ts} +0 -0
- /package/dist/{store.js → src/store.js} +0 -0
- /package/dist/{types.js → src/types.js} +0 -0
- /package/dist/{untar.d.ts → src/untar.d.ts} +0 -0
- /package/dist/{untar.js → src/untar.js} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { AgentEvent, DeliverArgs, HarnessAdapter } from './contract.ts';
|
|
2
|
+
/** The adapter id. Matches the `"codex"` key in `harness-versions.json`, so the
|
|
3
|
+
* worker can use one string for both the version pin and the adapter lookup. */
|
|
4
|
+
export declare const HARNESS_ID = "codex";
|
|
5
|
+
/**
|
|
6
|
+
* The resume-failure signature, in ONE place.
|
|
7
|
+
*
|
|
8
|
+
* Observed verbatim on 0.146.0: `no rollout found for thread id <uuid>` with
|
|
9
|
+
* code `-32600`. The `thread not found` alternative is defensive against a
|
|
10
|
+
* wording change.
|
|
11
|
+
*
|
|
12
|
+
* Matching `-32600` ALONE would be actively wrong, and that is measured, not
|
|
13
|
+
* assumed: the same code and no other comes back for an unknown method name
|
|
14
|
+
* (`unknown variant '<method>'`) and for a missing required param
|
|
15
|
+
* (`missing field 'threadId'`). A client that read bare `-32600` as
|
|
16
|
+
* "thread is gone" would answer a typo in a method name by throwing away a live
|
|
17
|
+
* thread and cold-replaying the entire step.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RESUME_UNAVAILABLE_MESSAGE_RE: RegExp;
|
|
20
|
+
/** The JSON-RPC code the resume failure rides. Never sufficient on its own. */
|
|
21
|
+
export declare const RESUME_UNAVAILABLE_CODE = -32600;
|
|
22
|
+
/** True only when BOTH the code and the message say "I do not know this thread". */
|
|
23
|
+
export declare function isResumeMiss(err: unknown): boolean;
|
|
24
|
+
/** One entry in `config.mcp_servers`. */
|
|
25
|
+
export interface McpServerSpec {
|
|
26
|
+
command: string;
|
|
27
|
+
args: string[];
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the `thread/start` params. PURE — exported for tests.
|
|
32
|
+
*
|
|
33
|
+
* Takes `DeliverArgs`, not `StartArgs`, because it never reads `brief` and Phase
|
|
34
|
+
* 4's `deliver` needs the identical mapping (`StartArgs` is assignable to
|
|
35
|
+
* `DeliverArgs`, so every `start` call site is unaffected).
|
|
36
|
+
*
|
|
37
|
+
* Deliberately unmapped, so a reader sees intent rather than oversight:
|
|
38
|
+
* - `permissions.tools` / `permissions.disallowedTools`: 0.146.0 has no
|
|
39
|
+
* per-thread built-in-tool allow-list; the sandbox and the approval policy
|
|
40
|
+
* are the levers it does have.
|
|
41
|
+
* - `permissions.maxTurns`: no `thread/start` or `turn/start` equivalent.
|
|
42
|
+
* - `permissions.effort`: not a `ThreadStartParams` field — it is a
|
|
43
|
+
* `turn/start` param, so it lands in `buildTurnStartParams`.
|
|
44
|
+
* - every `extensions` key other than `mcpServers`, `codexConfig` and
|
|
45
|
+
* `sandbox`: those are the other harness's frontmatter concepts (`hooks`,
|
|
46
|
+
* `memory`, `skills`, `background`, `isolation`, `color`, `initialPrompt`).
|
|
47
|
+
* Unknown keys are ignored silently; `owenloop work lint` is where an unknown key
|
|
48
|
+
* gets warned about.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildThreadStartParams(args: DeliverArgs, onEvent?: (e: AgentEvent) => void): Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Build the `turn/start` params. PURE — exported for tests.
|
|
53
|
+
*
|
|
54
|
+
* `input` is an ARRAY of `UserInput`; the text variant is `{type:'text', text}`.
|
|
55
|
+
* A bare string is the natural wrong guess and the server rejects it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildTurnStartParams(threadId: string, text: string, effort?: string): Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Build the `thread/resume` params. PURE — exported for tests.
|
|
60
|
+
*
|
|
61
|
+
* `base` is the resolved `thread/start` params from the session map when this
|
|
62
|
+
* process started the thread. `ThreadResumeParams` accepts `approvalPolicy`,
|
|
63
|
+
* `sandbox`, `model` and `config`, and a resumed thread that does not re-supply
|
|
64
|
+
* them reverts to the server's defaults.
|
|
65
|
+
*
|
|
66
|
+
* PHASE 4 CLOSED CONTRACT OBSERVATION 1. `deliver`'s third argument used to carry
|
|
67
|
+
* only `cwd` and `owenloopMcp`, so a resume in a different process from the start
|
|
68
|
+
* (the normal case for a re-offered step) had nothing to rebuild `approvalPolicy`
|
|
69
|
+
* / `sandbox` / `model` from and silently reverted to server defaults. It now
|
|
70
|
+
* carries the normalized `StepPermissions`, so this function derives the SAME
|
|
71
|
+
* params `buildThreadStartParams` would, and `args` WINS over `base` on every
|
|
72
|
+
* key — `base` only fills in what a `DeliverArgs` cannot express.
|
|
73
|
+
*
|
|
74
|
+
* The owenloop mount is ALWAYS re-supplied. Without it the resumed agent has no
|
|
75
|
+
* `submit` tool — a silent, total failure.
|
|
76
|
+
*/
|
|
77
|
+
export declare function buildThreadResumeParams(threadId: string, args: DeliverArgs, base?: Record<string, unknown>, onEvent?: (e: AgentEvent) => void): Record<string, unknown>;
|
|
78
|
+
/** The turn-end shape `mapNotification` reports for a `turn/completed` frame. */
|
|
79
|
+
export interface TurnOutcome {
|
|
80
|
+
status: string;
|
|
81
|
+
turnId: string | undefined;
|
|
82
|
+
error: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Read a `turn/completed` frame's outcome. PURE — exported for tests.
|
|
86
|
+
* Returns `undefined` for anything that is not a `turn/completed`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function readTurnCompleted(method: string, params: unknown): TurnOutcome | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Map one server→client notification to an `AgentEvent`.
|
|
91
|
+
*
|
|
92
|
+
* PURE and TOTAL — this is the function the recorded fixture replays through, so
|
|
93
|
+
* it must never throw on a shape it has not seen. `undefined` means "not worth
|
|
94
|
+
* surfacing"; nothing may depend on any particular progress line existing.
|
|
95
|
+
*
|
|
96
|
+
* `thread/started` maps to nothing on purpose: `start` emits `{kind:'started'}`
|
|
97
|
+
* itself from the `thread/start` RESPONSE, so the token is captured even if the
|
|
98
|
+
* notification ordering changes.
|
|
99
|
+
*/
|
|
100
|
+
export declare function mapNotification(method: string, params: unknown): AgentEvent | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Read an `mcpServer/startupStatus/updated` frame for the owenloop mount's
|
|
103
|
+
* FAILURE only. PURE — exported for tests.
|
|
104
|
+
*
|
|
105
|
+
* Gates on an explicit `'failed'`, never on the absence of a `'ready'`: absence
|
|
106
|
+
* of a notification is not proof of failure, and gating on ever seeing `'ready'`
|
|
107
|
+
* would deadlock the moment the notification is renamed.
|
|
108
|
+
*/
|
|
109
|
+
export declare function readOwenloopMountFailure(method: string, params: unknown): string | undefined;
|
|
110
|
+
export declare const codexAdapter: HarnessAdapter;
|