owenloop 0.5.0 → 0.5.2
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 +67 -0
- package/README.md +144 -35
- package/bin/owenloop.mjs +49 -1
- package/dist/packages/work/src/agent/brief.d.ts +29 -4
- package/dist/packages/work/src/agent/brief.js +49 -4
- package/dist/packages/work/src/agent/capability-model.d.ts +123 -0
- package/dist/packages/work/src/agent/capability-model.js +148 -0
- package/dist/packages/work/src/agent/loop.d.ts +56 -7
- package/dist/packages/work/src/agent/loop.js +166 -9
- package/dist/packages/work/src/bundle/cache.d.ts +7 -5
- package/dist/packages/work/src/bundle/cache.js +20 -6
- package/dist/packages/work/src/bundle/fetch.d.ts +7 -5
- package/dist/packages/work/src/bundle/fetch.js +27 -7
- package/dist/packages/work/src/bundle/types.d.ts +8 -4
- package/dist/packages/work/src/consumed-verifier.d.ts +45 -0
- package/dist/packages/work/src/consumed-verifier.js +205 -0
- package/dist/packages/work/src/exec/instructions.d.ts +99 -0
- package/dist/packages/work/src/exec/instructions.js +323 -0
- package/dist/packages/work/src/exec/loop.d.ts +29 -1
- package/dist/packages/work/src/exec/loop.js +313 -35
- package/dist/packages/work/src/exec/payload.d.ts +29 -0
- package/dist/packages/work/src/exec/payload.js +54 -0
- package/dist/packages/work/src/exec/receipt.d.ts +9 -6
- package/dist/packages/work/src/exec/receipt.js +12 -1
- package/dist/packages/work/src/exec/runner.d.ts +7 -1
- package/dist/packages/work/src/exec/runner.js +84 -3
- package/dist/packages/work/src/harness/child-env.js +7 -0
- package/dist/packages/work/src/harness/claude.d.ts +20 -8
- package/dist/packages/work/src/harness/claude.js +260 -58
- package/dist/packages/work/src/harness/codex.d.ts +5 -4
- package/dist/packages/work/src/harness/codex.js +169 -41
- package/dist/packages/work/src/harness/contract.d.ts +36 -11
- package/dist/packages/work/src/harness/fake.js +1 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.js +7 -0
- package/dist/packages/work/src/harness/permissions.d.ts +16 -3
- package/dist/packages/work/src/harness/permissions.js +102 -13
- package/dist/packages/work/src/harness/session-store.d.ts +30 -10
- package/dist/packages/work/src/harness/session-store.js +317 -89
- package/dist/packages/work/src/hold/mcp.d.ts +25 -5
- package/dist/packages/work/src/hold/mcp.js +134 -12
- package/dist/packages/work/src/hub/client.d.ts +8 -1
- package/dist/packages/work/src/hub/client.js +15 -1
- package/dist/packages/work/src/hub/types.d.ts +137 -33
- package/dist/packages/work/src/hub/types.js +8 -10
- package/dist/packages/work/src/mcp/server.js +1 -1
- package/dist/packages/work/src/owenloop-bin.d.ts +1 -0
- package/dist/packages/work/src/owenloop-bin.js +18 -0
- package/dist/packages/work/src/roles/agent-run.d.ts +12 -6
- package/dist/packages/work/src/roles/agent-run.js +115 -34
- package/dist/packages/work/src/roles/exec.d.ts +8 -0
- package/dist/packages/work/src/roles/exec.js +27 -2
- package/dist/packages/work/src/roles/hold.d.ts +6 -0
- package/dist/packages/work/src/roles/hold.js +83 -13
- package/dist/packages/work/src/roles/lint.d.ts +3 -4
- package/dist/packages/work/src/roles/lint.js +41 -7
- package/dist/packages/work/src/roles/settings.js +19 -2
- package/dist/packages/work/src/roles/shift.d.ts +1 -0
- package/dist/packages/work/src/roles/shift.js +36 -2
- package/dist/packages/work/src/settings/settings.d.ts +70 -1
- package/dist/packages/work/src/settings/settings.js +90 -4
- package/dist/packages/work/src/shift/logretention.d.ts +253 -0
- package/dist/packages/work/src/shift/logretention.js +407 -0
- package/dist/packages/work/src/shift/logsink.d.ts +14 -0
- package/dist/packages/work/src/shift/logsink.js +98 -0
- package/dist/packages/work/src/shift/loop.d.ts +32 -4
- package/dist/packages/work/src/shift/loop.js +687 -166
- package/dist/packages/work/src/shift/protocol.d.ts +128 -1
- package/dist/packages/work/src/shift/protocol.js +14 -0
- package/dist/packages/work/src/shift/runtime.d.ts +16 -0
- package/dist/packages/work/src/shift/runtime.js +291 -5
- package/dist/packages/work/src/shift/server.d.ts +13 -0
- package/dist/packages/work/src/shift/server.js +61 -36
- package/dist/packages/work/src/shift/spawn.d.ts +115 -19
- package/dist/packages/work/src/shift/spawn.js +234 -30
- package/dist/packages/work/src/shift/state.d.ts +76 -49
- package/dist/packages/work/src/shift/state.js +350 -103
- package/dist/packages/work/src/shift/truncate.d.ts +35 -0
- package/dist/packages/work/src/shift/truncate.js +73 -0
- package/dist/packages/work/src/submit-proof.d.ts +61 -0
- package/dist/packages/work/src/submit-proof.js +119 -0
- package/dist/packages/work/src/submit-value.d.ts +48 -0
- package/dist/packages/work/src/submit-value.js +118 -0
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +11 -0
- package/dist/src/add.d.ts +64 -259
- package/dist/src/add.js +81 -615
- package/dist/src/archive.d.ts +97 -0
- package/dist/src/archive.js +591 -0
- package/dist/src/bundle/index.d.ts +64 -0
- package/dist/src/bundle/index.js +508 -0
- package/dist/src/bundle/manifest.d.ts +50 -0
- package/dist/src/bundle/manifest.js +435 -0
- package/dist/src/bundle/runtime.d.ts +26 -0
- package/dist/src/bundle/runtime.js +64 -0
- package/dist/src/bundle/tar.d.ts +62 -0
- package/dist/src/bundle/tar.js +238 -0
- package/dist/src/bundle/types.d.ts +105 -0
- package/dist/src/bundle/types.js +21 -0
- package/dist/src/capabilities.d.ts +93 -0
- package/dist/src/capabilities.js +101 -0
- package/dist/src/cli.d.ts +90 -20
- package/dist/src/cli.js +2421 -374
- package/dist/src/credentials.d.ts +4 -3
- package/dist/src/credentials.js +21 -19
- package/dist/src/crypto/allowed-signers.d.ts +68 -0
- package/dist/src/crypto/allowed-signers.js +307 -0
- package/dist/src/crypto/canonical.d.ts +8 -0
- package/dist/src/crypto/canonical.js +92 -0
- package/dist/src/crypto/chain.d.ts +65 -0
- package/dist/src/crypto/chain.js +377 -0
- package/dist/src/crypto/dsse.d.ts +209 -0
- package/dist/src/crypto/dsse.js +282 -0
- package/dist/src/crypto/enrollment.d.ts +78 -0
- package/dist/src/crypto/enrollment.js +186 -0
- package/dist/src/crypto/index.d.ts +48 -0
- package/dist/src/crypto/index.js +44 -0
- package/dist/src/crypto/keys.d.ts +258 -0
- package/dist/src/crypto/keys.js +908 -0
- package/dist/src/crypto/org-root.d.ts +33 -0
- package/dist/src/crypto/org-root.js +78 -0
- package/dist/src/crypto/origin-rules.d.ts +56 -0
- package/dist/src/crypto/origin-rules.js +143 -0
- package/dist/src/crypto/policy-floor.d.ts +98 -0
- package/dist/src/crypto/policy-floor.js +353 -0
- package/dist/src/crypto/records.d.ts +319 -0
- package/dist/src/crypto/records.js +168 -0
- package/dist/src/crypto/scope.d.ts +49 -0
- package/dist/src/crypto/scope.js +83 -0
- package/dist/src/crypto/ssh.d.ts +171 -0
- package/dist/src/crypto/ssh.js +396 -0
- package/dist/src/crypto/submission.d.ts +33 -0
- package/dist/src/crypto/submission.js +47 -0
- package/dist/src/crypto/trust-roots.d.ts +29 -0
- package/dist/src/crypto/trust-roots.js +39 -0
- package/dist/src/crypto/verify-consumed.d.ts +67 -0
- package/dist/src/crypto/verify-consumed.js +259 -0
- package/dist/src/crypto/verify-origin.d.ts +50 -0
- package/dist/src/crypto/verify-origin.js +151 -0
- package/dist/src/crypto/verify-publication.d.ts +60 -0
- package/dist/src/crypto/verify-publication.js +150 -0
- package/dist/src/defs.d.ts +24 -1
- package/dist/src/defs.js +335 -27
- package/dist/src/engine.d.ts +211 -6
- package/dist/src/engine.js +459 -59
- package/dist/src/factory.d.ts +16 -0
- package/dist/src/factory.js +16 -4
- package/dist/src/global-config.d.ts +59 -0
- package/dist/src/global-config.js +84 -0
- package/dist/src/hub.d.ts +102 -32
- package/dist/src/hub.js +147 -58
- package/dist/src/index.d.ts +19 -2
- package/dist/src/index.js +23 -2
- package/dist/src/install.d.ts +538 -0
- package/dist/src/install.js +1981 -0
- package/dist/src/lock.d.ts +15 -57
- package/dist/src/lock.js +251 -143
- package/dist/src/mcp/serve.d.ts +46 -22
- package/dist/src/mcp/serve.js +174 -44
- package/dist/src/mcp/server.js +12 -1
- package/dist/src/model.d.ts +51 -0
- package/dist/src/model.js +157 -1
- package/dist/src/order-resolver.d.ts +184 -0
- package/dist/src/order-resolver.js +252 -0
- package/dist/src/package-version.d.ts +10 -0
- package/dist/src/package-version.js +42 -0
- package/dist/src/paths.d.ts +14 -1
- package/dist/src/paths.js +18 -0
- package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
- package/dist/src/schemas/index.d.ts +1433 -0
- package/dist/src/schemas/index.js +31 -0
- package/dist/src/schemas/order.v1.schema.json +120 -0
- package/dist/src/schemas/origin.v1.schema.json +68 -0
- package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
- package/dist/src/schemas/publication.v1.schema.json +31 -0
- package/dist/src/schemas/revocation.v1.schema.json +39 -0
- package/dist/src/schemas/submission.v1.schema.json +61 -0
- package/dist/src/store/def-source.d.ts +52 -0
- package/dist/src/store/def-source.js +335 -0
- package/dist/src/store/index-file.d.ts +69 -0
- package/dist/src/store/index-file.js +151 -0
- package/dist/src/store/index.d.ts +27 -0
- package/dist/src/store/index.js +22 -0
- package/dist/src/store/ingestor.d.ts +43 -0
- package/dist/src/store/ingestor.js +211 -0
- package/dist/src/store/install.d.ts +228 -0
- package/dist/src/store/install.js +555 -0
- package/dist/src/store/instruction-source.d.ts +49 -0
- package/dist/src/store/instruction-source.js +298 -0
- package/dist/src/store/origin-evidence.d.ts +21 -0
- package/dist/src/store/origin-evidence.js +66 -0
- package/dist/src/store/pre-commit-verifier.d.ts +68 -0
- package/dist/src/store/pre-commit-verifier.js +418 -0
- package/dist/src/store/resolve.d.ts +138 -0
- package/dist/src/store/resolve.js +363 -0
- package/dist/src/store/types.d.ts +288 -0
- package/dist/src/store/types.js +356 -0
- package/dist/src/store.d.ts +33 -1
- package/dist/src/store.js +57 -4
- package/dist/src/types.d.ts +146 -12
- package/dist/src/untar.d.ts +8 -23
- package/dist/src/untar.js +10 -136
- package/docs/agent-runner.md +86 -0
- package/docs/authoring.md +64 -6
- package/docs/bundles.md +350 -0
- package/docs/cli.md +1298 -106
- package/docs/crypto.md +832 -0
- package/docs/design.md +342 -20
- package/docs/embedding.md +132 -25
- package/docs/shift-logs.md +642 -0
- package/docs/wire-contracts.md +395 -0
- package/package.json +6 -1
- package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
- package/plugins/claude-code/plugin/.mcp.json +14 -0
- package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
- package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
- package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
- package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
- package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
- package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
- package/plugins/codex/.agents/plugins/marketplace.json +21 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
- package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
- package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
- package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
- package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
- package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
- package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
|
@@ -1,77 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Two kinds, and BOTH are real local processes tracked by a live pid:
|
|
4
|
-
* - `exec` (default; absent `kind` for legacy records) — a detached
|
|
5
|
-
* `owenloop work exec` command child, tracked by `kill(pid, 0)`.
|
|
6
|
-
* - `agent-run` — a detached `owenloop work agent-run` child hosting the step
|
|
7
|
-
* agent itself, tracked exactly the same way.
|
|
8
|
-
*
|
|
9
|
-
* There is no pid-less kind any more. The removed `'agent'` kind recorded a
|
|
10
|
-
* stamped Step Agent file handed to an out-of-process Shift: no local
|
|
11
|
-
* child, a `0` sentinel pid, and a coarse TTL standing in for liveness. With
|
|
12
|
-
* the stamp path gone nothing produces such a record, so a leftover one on disk
|
|
13
|
-
* fails the pid probe and is reaped on the next reconcile — which is correct.
|
|
14
|
-
*
|
|
15
|
-
* `def/hash/step` are dispatch provenance (which cached def revision and step
|
|
16
|
-
* this child was dispatched for); they are absent for command orders. */
|
|
1
|
+
export declare const DEFAULT_RESERVATION_MAX_AGE_MS: number;
|
|
17
2
|
export interface ChildRecord {
|
|
18
3
|
workflow: string;
|
|
19
4
|
run: string;
|
|
20
|
-
/** The child's live pid. */
|
|
21
5
|
pid: number;
|
|
22
6
|
spawnedAt: number;
|
|
23
|
-
/** Dispatch kind; absent = `'exec'`
|
|
7
|
+
/** Dispatch kind; absent = `'exec'` for backward compatibility. */
|
|
24
8
|
kind?: 'exec' | 'agent-run';
|
|
25
9
|
def?: string;
|
|
26
10
|
hash?: string;
|
|
27
11
|
step?: string;
|
|
12
|
+
/** Present only between PID persistence and opening the child's start gate. */
|
|
13
|
+
gateToken?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ChildReservation {
|
|
16
|
+
recordType: 'reservation';
|
|
17
|
+
workflow: string;
|
|
18
|
+
run: string;
|
|
19
|
+
reservedAt: number;
|
|
20
|
+
token: string;
|
|
21
|
+
childKind: 'exec' | 'agent-run';
|
|
22
|
+
step?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ReservationRequest {
|
|
25
|
+
workflow: string;
|
|
26
|
+
run: string;
|
|
27
|
+
reservedAt: number;
|
|
28
|
+
childKind: 'exec' | 'agent-run';
|
|
29
|
+
step?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ReservedChild {
|
|
32
|
+
reservation: ChildReservation;
|
|
33
|
+
gatePath: string;
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
36
|
+
* Where this shift's `<run>.json` in-flight records live.
|
|
37
|
+
*
|
|
38
|
+
* ALWAYS ABSOLUTE. `--state-dir ./state` is a legal thing for an operator to
|
|
39
|
+
* type, and while only this process joined paths onto it the relative spelling
|
|
40
|
+
* was harmless. It stopped being harmless when the log-owner registry
|
|
41
|
+
* (`logretention.ts`) began WRITING this string into a file that a DIFFERENT
|
|
42
|
+
* shift process, with a DIFFERENT working directory, reads back and probes for
|
|
43
|
+
* `<run>.json`: `./state` resolved against the wrong cwd finds no record, the
|
|
44
|
+
* in-flight gate concludes the run finished, and a live worker's log is
|
|
45
|
+
* unlinked out from under it. `resolve()` here is what makes the writer, the
|
|
46
|
+
* reader and the probe agree on ONE spelling, and it is also what keeps
|
|
47
|
+
* `ownerClaimName`'s hash stable so one shift writes one claim file rather than
|
|
48
|
+
* one per cwd it was ever started from.
|
|
34
49
|
*/
|
|
35
50
|
export declare function resolveStateDir(env: Record<string, string | undefined>, override?: string): string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
51
|
+
/**
|
|
52
|
+
* The run id as it appears in a filename, with every character a path could
|
|
53
|
+
* misread replaced.
|
|
54
|
+
*
|
|
55
|
+
* EXPORTED because the worker log `<run>.log` correlates to the in-flight
|
|
56
|
+
* record `<run>.json` BY BASENAME. Two sanitizers would be two basenames, and
|
|
57
|
+
* the correlation an operator and a future uploader both rely on would silently
|
|
58
|
+
* stop holding for any run id containing an unusual character.
|
|
59
|
+
*/
|
|
60
|
+
export declare function safeRun(run: string): string;
|
|
61
|
+
/** Persist a child record atomically. State persistence is correctness-sensitive and throws on failure. */
|
|
62
|
+
export declare function writeChildRecord(stateDir: string, record: ChildRecord): void;
|
|
63
|
+
/** Create the durable capacity reservation and closed start gate before spawn. */
|
|
64
|
+
export declare function reserveChild(stateDir: string, request: ReservationRequest): ReservedChild;
|
|
65
|
+
export declare class ShiftStateRecordError extends Error {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
constructor(path: string, detail: string);
|
|
68
|
+
}
|
|
69
|
+
/** Read only PID-bearing records for status and compatibility callers. */
|
|
40
70
|
export declare function readChildRecords(stateDir: string): ChildRecord[];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
export declare function readChildReservations(stateDir: string): ChildReservation[];
|
|
72
|
+
/** Replace the matching reservation with a PID-bearing record before work starts. */
|
|
73
|
+
export declare function finalizeChildReservation(stateDir: string, reservation: ChildReservation, child: Omit<ChildRecord, 'workflow' | 'run' | 'gateToken'>): ChildRecord;
|
|
74
|
+
/** Open a child's gate only after the PID-bearing record is durable. */
|
|
75
|
+
export declare function startReservedChild(stateDir: string, record: ChildRecord): void;
|
|
76
|
+
/** Cancel a gated child and remove the matching reservation/record. */
|
|
77
|
+
export declare function cancelReservedChild(stateDir: string, reservation: ChildReservation): void;
|
|
45
78
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* foreign process at that pid is not ours to reap). Any other error ⇒ alive
|
|
50
|
-
* (conservative: don't reap on an ambiguous signal).
|
|
79
|
+
* Delete one run's in-flight state. A still-gated reservation or finalized child
|
|
80
|
+
* is cancelled first so an external run-ended signal cannot leave a worker gate
|
|
81
|
+
* behind that later opens without a capacity record.
|
|
51
82
|
*/
|
|
83
|
+
export declare function removeChildRecord(stateDir: string, run: string): void;
|
|
84
|
+
export type Liveness = (pid: number) => boolean;
|
|
52
85
|
export declare const defaultIsAlive: Liveness;
|
|
53
86
|
export interface Reconciliation {
|
|
54
|
-
/** Records whose child is still alive — these count as in-flight. */
|
|
55
87
|
live: ChildRecord[];
|
|
56
|
-
|
|
88
|
+
reserved: ChildReservation[];
|
|
57
89
|
reaped: ChildRecord[];
|
|
90
|
+
abandoned: ChildReservation[];
|
|
58
91
|
}
|
|
59
|
-
/** Injectable knobs for `reconcileInFlight` (all optional; real defaults). */
|
|
60
92
|
export interface ReconcileOptions {
|
|
61
|
-
/** pid liveness probe (default `defaultIsAlive`). */
|
|
62
93
|
isAlive?: Liveness;
|
|
94
|
+
now?: number;
|
|
95
|
+
reservationMaxAgeMs?: number;
|
|
63
96
|
}
|
|
64
97
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* so a
|
|
68
|
-
*
|
|
69
|
-
* Liveness is UNIFORM: every record names a real local child, so every record
|
|
70
|
-
* is live exactly while `kill(pid, 0)` says its pid is.
|
|
71
|
-
*
|
|
72
|
-
* Back-compat: the second positional arg still accepts a bare `Liveness`
|
|
73
|
-
* (pre-split callers passed `reconcileInFlight(dir, isAlive)`).
|
|
98
|
+
* Reconcile live children and durable reservations. Fresh reservations count as
|
|
99
|
+
* occupied capacity. An expired reservation is cancelled before its record is
|
|
100
|
+
* removed, so a child that was spawned but never finalized cannot begin work.
|
|
74
101
|
*/
|
|
75
102
|
export declare function reconcileInFlight(stateDir: string, arg?: Liveness | ReconcileOptions): Reconciliation;
|
|
76
|
-
/** Ensure the state
|
|
103
|
+
/** Ensure the state directory exists and is readable. Failure is fatal to dispatch safety. */
|
|
77
104
|
export declare function ensureStateDir(stateDir: string): void;
|