owenloop 0.5.8 → 0.5.9
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 +25 -0
- package/README.md +4 -2
- package/dist/packages/work/src/agent/loop.d.ts +23 -8
- package/dist/packages/work/src/agent/loop.js +48 -6
- package/dist/packages/work/src/consumed-verifier.js +6 -17
- package/dist/packages/work/src/exec/loop.d.ts +1 -1
- package/dist/packages/work/src/exec/loop.js +181 -32
- package/dist/packages/work/src/exec/receipt.d.ts +7 -7
- package/dist/packages/work/src/exec/receipt.js +6 -6
- package/dist/packages/work/src/harness/claude.js +100 -0
- package/dist/packages/work/src/hub/client.d.ts +19 -4
- package/dist/packages/work/src/hub/client.js +7 -3
- package/dist/packages/work/src/hub/types.d.ts +84 -0
- package/dist/packages/work/src/main.js +1 -0
- package/dist/packages/work/src/roles/agent-run.js +19 -22
- package/dist/packages/work/src/roles/exec.js +2 -0
- package/dist/packages/work/src/roles/settings.js +2 -0
- package/dist/packages/work/src/roles/shift.js +14 -2
- package/dist/packages/work/src/roles/util.d.ts +1 -0
- package/dist/packages/work/src/roles/util.js +10 -0
- package/dist/packages/work/src/settings/hub-roster-cache.d.ts +68 -0
- package/dist/packages/work/src/settings/hub-roster-cache.js +370 -0
- package/dist/packages/work/src/settings/roster.d.ts +84 -0
- package/dist/packages/work/src/settings/roster.js +364 -5
- package/dist/packages/work/src/settings/serving.d.ts +17 -0
- package/dist/packages/work/src/settings/serving.js +79 -0
- package/dist/packages/work/src/settings/settings.d.ts +14 -1
- package/dist/packages/work/src/settings/settings.js +14 -0
- package/dist/packages/work/src/shift/loop.d.ts +108 -5
- package/dist/packages/work/src/shift/loop.js +299 -51
- package/dist/packages/work/src/shift/protocol.d.ts +7 -5
- package/dist/packages/work/src/shift/runtime.d.ts +15 -0
- package/dist/packages/work/src/shift/runtime.js +94 -4
- package/dist/packages/work/src/shift/server.js +2 -0
- package/dist/packages/work/src/shift/spawn.d.ts +17 -2
- package/dist/packages/work/src/shift/spawn.js +16 -13
- package/dist/packages/work/src/shift/state.d.ts +29 -2
- package/dist/packages/work/src/shift/state.js +45 -15
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +7 -1
- package/dist/packages/work/src/util/modifier-init.d.ts +7 -0
- package/dist/packages/work/src/util/modifier-init.js +73 -0
- package/dist/src/bundle/tar.d.ts +9 -4
- package/dist/src/bundle/tar.js +9 -4
- package/dist/src/capabilities.d.ts +6 -0
- package/dist/src/cli.d.ts +14 -1
- package/dist/src/cli.js +687 -75
- package/dist/src/config-dir.d.ts +1 -1
- package/dist/src/config-dir.js +1 -1
- package/dist/src/crypto/index.d.ts +1 -1
- package/dist/src/crypto/index.js +1 -1
- package/dist/src/crypto/org-root.d.ts +30 -12
- package/dist/src/crypto/org-root.js +162 -14
- package/dist/src/crypto/records.d.ts +2 -0
- package/dist/src/crypto/records.js +2 -0
- package/dist/src/defs.d.ts +6 -1
- package/dist/src/defs.js +203 -8
- package/dist/src/engine.d.ts +42 -7
- package/dist/src/engine.js +158 -16
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +2 -2
- package/dist/src/mcp/serve.d.ts +22 -0
- package/dist/src/mcp/serve.js +88 -8
- package/dist/src/model.d.ts +2 -0
- package/dist/src/model.js +32 -25
- package/dist/src/order-resolver.d.ts +1 -0
- package/dist/src/order-resolver.js +8 -1
- package/dist/src/schemas/index.d.ts +11 -0
- package/dist/src/schemas/order.v1.schema.json +7 -1
- package/dist/src/store.d.ts +5 -0
- package/dist/src/store.js +43 -8
- package/dist/src/types.d.ts +40 -3
- package/docs/authoring.md +90 -2
- package/docs/bundles.md +26 -2
- package/docs/cli.md +170 -28
- package/docs/crypto.md +19 -3
- package/docs/design.md +70 -1
- package/docs/routing.md +189 -34
- package/docs/shift-logs.md +20 -9
- package/docs/wire-contracts.md +50 -7
- package/examples/workflows/delivery.yaml +31 -14
- package/examples/workflows/ship.yaml +10 -2
- package/package.json +1 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.5.9](https://github.com/typicalday/owenloop/compare/v0.5.8...v0.5.9) (2026-08-19)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add --scope and --priority to owenloop start, default MCP scope to repo name ([#205](https://github.com/typicalday/owenloop/issues/205)) ([1270885](https://github.com/typicalday/owenloop/commit/12708856d837b6bba40c8294ad62d76940b3944a))
|
|
13
|
+
* add hub retry artifact controls ([#191](https://github.com/typicalday/owenloop/issues/191)) ([2afcaf6](https://github.com/typicalday/owenloop/commit/2afcaf6321ab952be7c7895e4e85907efd4965e5))
|
|
14
|
+
* bind artifact values to run modifier and meta, with deterministic init ([#200](https://github.com/typicalday/owenloop/issues/200)) ([ca7c402](https://github.com/typicalday/owenloop/commit/ca7c4026ff60816987dca43dfca492610dc43b09))
|
|
15
|
+
* declare cleanup steps for cancelled runs ([#204](https://github.com/typicalday/owenloop/issues/204)) ([bc3d1ef](https://github.com/typicalday/owenloop/commit/bc3d1ef94ca177cafa37c697709c26bef6d3a59d))
|
|
16
|
+
* **shift:** advertise serving capabilities ([#194](https://github.com/typicalday/owenloop/issues/194)) ([4ff4010](https://github.com/typicalday/owenloop/commit/4ff4010c57ba91c4b12cab812d0cbd2cc4b33b75))
|
|
17
|
+
* stamp matched crews on orders and resolve worker rosters from the stamp ([#193](https://github.com/typicalday/owenloop/issues/193)) ([aceae05](https://github.com/typicalday/owenloop/commit/aceae055d72eb54a0da8b5edb87b4ce3caddebe5))
|
|
18
|
+
* sync hub org rosters into the shift cache and merge them as the weakest layers ([#190](https://github.com/typicalday/owenloop/issues/190)) ([643e2fd](https://github.com/typicalday/owenloop/commit/643e2fdfe93c4b6d9dd80cd15a211c275b130918))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* carry the child command output tail into a payload reject ([#197](https://github.com/typicalday/owenloop/issues/197)) ([e3ee61f](https://github.com/typicalday/owenloop/commit/e3ee61fbc51598d883a310e33b84abafb399aa98))
|
|
24
|
+
* do not hold hub claims a shift cannot dispatch ([#209](https://github.com/typicalday/owenloop/issues/209)) ([5b61433](https://github.com/typicalday/owenloop/commit/5b61433cab384107f5cf126253e0fd1b3c62e0c2))
|
|
25
|
+
* escalate failed command diagnostics through ask ([#203](https://github.com/typicalday/owenloop/issues/203)) ([583d4c3](https://github.com/typicalday/owenloop/commit/583d4c34772d32035b7067abc71620bf46143acc))
|
|
26
|
+
* log claude adapter turn activity ([#188](https://github.com/typicalday/owenloop/issues/188)) ([c9ba76a](https://github.com/typicalday/owenloop/commit/c9ba76a8948dd5dc0733a204313374322f2fa22f))
|
|
27
|
+
* make the bind shorthand resolve a key path instead of the whole value ([#206](https://github.com/typicalday/owenloop/issues/206)) ([03ac38c](https://github.com/typicalday/owenloop/commit/03ac38ca2066cf6e23592f693e484601efdd6ebb))
|
|
28
|
+
* make the modifier vocabulary consistent across parse, start, and bind ([#210](https://github.com/typicalday/owenloop/issues/210)) ([afd33a6](https://github.com/typicalday/owenloop/commit/afd33a6d5f49525e3e7e65a8df481af6b53c1a55))
|
|
29
|
+
* reserve dispatch capacity for exec orders ([#207](https://github.com/typicalday/owenloop/issues/207)) ([91c6a66](https://github.com/typicalday/owenloop/commit/91c6a66869b5b2c06c9db228818c6bb19c7ede9e))
|
|
30
|
+
* **shift:** release exited workers and resweep braked steps ([#196](https://github.com/typicalday/owenloop/issues/196)) ([1b23815](https://github.com/typicalday/owenloop/commit/1b238153caf5d4dacdce7731c06b64830dbe15ce))
|
|
31
|
+
|
|
7
32
|
## [0.5.8](https://github.com/typicalday/owenloop/compare/v0.5.7...v0.5.8) (2026-08-17)
|
|
8
33
|
|
|
9
34
|
|
package/README.md
CHANGED
|
@@ -453,8 +453,10 @@ through the same small CLI (`create`, `tick`, `green`, `reject`, …).
|
|
|
453
453
|
[`docs/cli.md`](docs/cli.md) has the full command reference and a hand-driven
|
|
454
454
|
walkthrough of a pipeline — including a rejection knock-back and a stall —
|
|
455
455
|
and [`examples/workflows`](examples/workflows) has seventeen runnable defs, from a
|
|
456
|
-
minimal review loop
|
|
457
|
-
|
|
456
|
+
minimal review loop written to teach the wiring
|
|
457
|
+
([`delivery`](examples/workflows/delivery.yaml) — a four-step example, not the
|
|
458
|
+
production line) to a production-shaped pipeline
|
|
459
|
+
([`ship`](examples/workflows/ship.yaml)), a
|
|
458
460
|
collections-heavy research pipeline
|
|
459
461
|
([`research`](examples/workflows/research.yaml)), and a compiler that turns
|
|
460
462
|
live vendor docs into a new gate-checked def
|
|
@@ -7,7 +7,7 @@ import { type SessionRecord, type SessionTaskRef } from '../harness/session-stor
|
|
|
7
7
|
import { type CapabilityMatch } from './capability-model.ts';
|
|
8
8
|
import type { MergedRoster } from '../settings/roster.ts';
|
|
9
9
|
/** Discriminated result of one worker life; the role maps these to exit codes. */
|
|
10
|
-
export type AgentRunOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
|
|
10
|
+
export type AgentRunOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
|
|
11
11
|
/**
|
|
12
12
|
* Locate the normalized step spec for an order. Injected because the lookup is
|
|
13
13
|
* I/O (the verified workflow store) and because resolving the local definition
|
|
@@ -36,6 +36,21 @@ export interface AdapterResolution {
|
|
|
36
36
|
}
|
|
37
37
|
/** The two harness inputs are rank 1 (roster) and rank 3 (step definition). */
|
|
38
38
|
export type AdapterResolver = (chosenHarness: string | undefined, stepHarness: string | undefined) => AdapterResolution;
|
|
39
|
+
/** Outcome of turning a STAMPED crew name list into merged rosters. */
|
|
40
|
+
export type CrewRosterResolution = {
|
|
41
|
+
ok: true;
|
|
42
|
+
rosters: readonly MergedRoster[];
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
crew: string;
|
|
46
|
+
detail: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Turns the crews the HUB STAMPED on an order into merged rosters, in the
|
|
50
|
+
* stamped order. Injected by the role so the loop stays free of filesystem and
|
|
51
|
+
* environment reads.
|
|
52
|
+
*/
|
|
53
|
+
export type CrewRosterResolver = (crews: readonly string[]) => CrewRosterResolution;
|
|
39
54
|
/** Default confirm-phase cadence: one `get_order` per second. */
|
|
40
55
|
export declare const DEFAULT_CONFIRM_INTERVAL_MS = 1000;
|
|
41
56
|
/** Default confirm-phase bound: give the hub 15s to show the submit's outcome. */
|
|
@@ -70,12 +85,10 @@ export interface AgentRunLoopOptions {
|
|
|
70
85
|
loadStep: StepLoader;
|
|
71
86
|
resolveAdapter: AdapterResolver;
|
|
72
87
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* The Phase 1 crew selection is interim: Phase 2 replaces it with crews
|
|
76
|
-
* stamped by the hub on the order.
|
|
88
|
+
* Resolves the crews the hub stamped on the order. REQUIRED — this loop has
|
|
89
|
+
* no crew source other than the order's stamp.
|
|
77
90
|
*/
|
|
78
|
-
|
|
91
|
+
resolveCrewRosters: CrewRosterResolver;
|
|
79
92
|
/**
|
|
80
93
|
* Phase-1 availability is adapter-registry membership at the composition
|
|
81
94
|
* root. A real binary/credential probe needs new adapter-contract surface.
|
|
@@ -174,9 +187,11 @@ export type OrderRouting = {
|
|
|
174
187
|
} | {
|
|
175
188
|
kind: 'refused';
|
|
176
189
|
capabilities: readonly string[];
|
|
177
|
-
reason: 'harness-policy' | 'unresolvable-capability';
|
|
190
|
+
reason: 'harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability';
|
|
178
191
|
offered?: readonly string[];
|
|
179
192
|
stepHarness?: string;
|
|
193
|
+
crew?: string;
|
|
194
|
+
detail?: string;
|
|
180
195
|
} | {
|
|
181
196
|
kind: 'unrouted';
|
|
182
197
|
};
|
|
@@ -188,7 +203,7 @@ export type OrderRouting = {
|
|
|
188
203
|
* abstract rung with no meaning left, and reading it as a model id would put a
|
|
189
204
|
* literal `strong` on the wire to a vendor.
|
|
190
205
|
*/
|
|
191
|
-
export declare function resolveOrderRouting(packet: OrderPacket,
|
|
206
|
+
export declare function resolveOrderRouting(packet: OrderPacket, resolveCrewRosters: CrewRosterResolver, stepHarness: string | undefined, isAvailable: (harnessId: string) => boolean): OrderRouting;
|
|
192
207
|
/**
|
|
193
208
|
* Poll `get_order` at `intervalMs` for at most `graceMs`, answering ONE
|
|
194
209
|
* question: did the hub see the agent's `submit`?
|
|
@@ -124,12 +124,47 @@ function briefOwes(packet) {
|
|
|
124
124
|
* abstract rung with no meaning left, and reading it as a model id would put a
|
|
125
125
|
* literal `strong` on the wire to a vendor.
|
|
126
126
|
*/
|
|
127
|
-
export function resolveOrderRouting(packet,
|
|
127
|
+
export function resolveOrderRouting(packet, resolveCrewRosters, stepHarness, isAvailable) {
|
|
128
128
|
const capabilities = packet.capabilities ?? [];
|
|
129
129
|
if (capabilities.length === 0)
|
|
130
130
|
return { kind: 'unrouted' };
|
|
131
|
+
const stamp = packet.crews;
|
|
132
|
+
if (stamp === undefined) {
|
|
133
|
+
return {
|
|
134
|
+
kind: 'refused',
|
|
135
|
+
capabilities,
|
|
136
|
+
reason: 'unstamped-order',
|
|
137
|
+
detail: 'the order carries no crews field',
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (!Array.isArray(stamp) || stamp.length === 0) {
|
|
141
|
+
return {
|
|
142
|
+
kind: 'refused',
|
|
143
|
+
capabilities,
|
|
144
|
+
reason: 'unstamped-order',
|
|
145
|
+
detail: `unusable crews stamp (${JSON.stringify(stamp)})`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (stamp.some((crew) => typeof crew !== 'string' || crew.trim() === '')) {
|
|
149
|
+
return {
|
|
150
|
+
kind: 'refused',
|
|
151
|
+
capabilities,
|
|
152
|
+
reason: 'unstamped-order',
|
|
153
|
+
detail: `unusable crews stamp (${JSON.stringify(stamp)})`,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const resolved = resolveCrewRosters(stamp);
|
|
157
|
+
if (!resolved.ok) {
|
|
158
|
+
return {
|
|
159
|
+
kind: 'refused',
|
|
160
|
+
capabilities,
|
|
161
|
+
reason: 'unresolvable-crew',
|
|
162
|
+
crew: resolved.crew,
|
|
163
|
+
detail: resolved.detail,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
131
166
|
let firstHarnessPolicy;
|
|
132
|
-
for (const roster of rosters
|
|
167
|
+
for (const roster of resolved.rosters) {
|
|
133
168
|
// Preserve arbitrary capability names through the boundary between the
|
|
134
169
|
// provenance-bearing merged roster and the candidate-only selector.
|
|
135
170
|
const candidateRows = Object.create(null);
|
|
@@ -502,10 +537,7 @@ export function createAgentRunLoop(opts) {
|
|
|
502
537
|
* closures below. This const carries the narrowing across. */
|
|
503
538
|
const step = material;
|
|
504
539
|
// ---- ROUTING: select a roster candidate before resolving an adapter ----
|
|
505
|
-
|
|
506
|
-
// Phase 1's crew order is interim. Phase 2 replaces these locally supplied
|
|
507
|
-
// rosters with crew stamps the hub puts on each offer.
|
|
508
|
-
const routing = resolveOrderRouting(packet, opts.rosters, step.harness, opts.harnessAvailable);
|
|
540
|
+
const routing = resolveOrderRouting(packet, opts.resolveCrewRosters, step.harness, opts.harnessAvailable);
|
|
509
541
|
await reportResolution(routing);
|
|
510
542
|
if (routing.kind === 'refused') {
|
|
511
543
|
if (routing.reason === 'harness-policy') {
|
|
@@ -513,6 +545,16 @@ export function createAgentRunLoop(opts) {
|
|
|
513
545
|
`but its roster candidates offer [${(routing.offered ?? []).join(', ')}] — releasing`);
|
|
514
546
|
return releaseWith('incompatible-harness-policy', 'incompatible-harness-policy');
|
|
515
547
|
}
|
|
548
|
+
if (routing.reason === 'unstamped-order') {
|
|
549
|
+
opts.err(packet.crews === undefined
|
|
550
|
+
? `owenloop work agent-run: order ${order} was offered under capabilities [${routing.capabilities.join(', ')}] but carries NO crews stamp. This worker resolves crew rosters only from the hub's offer-time stamp; there is no fallback to the crews this shift was started with. The hub at ${opts.origin} must stamp crews on every capability-bearing order. Releasing.`
|
|
551
|
+
: `owenloop work agent-run: order ${order} was offered under capabilities [${routing.capabilities.join(', ')}] but carries an unusable crews stamp (${JSON.stringify(packet.crews)}). Expected a non-empty array of non-empty crew names. This worker resolves crew rosters only from the hub's offer-time stamp; there is no fallback to the crews this shift was started with. The hub at ${opts.origin} must stamp crews on every capability-bearing order. Releasing.`);
|
|
552
|
+
return releaseWith('unstamped-order', 'unstamped-order');
|
|
553
|
+
}
|
|
554
|
+
if (routing.reason === 'unresolvable-crew') {
|
|
555
|
+
opts.err(`owenloop work agent-run: order ${order} is stamped with crews [${packet.crews.join(', ')}], but crew '${routing.crew}' cannot be resolved on this machine: ${routing.detail}. Releasing.`);
|
|
556
|
+
return releaseWith('unresolvable-crew', 'unresolvable-crew');
|
|
557
|
+
}
|
|
516
558
|
opts.err(`owenloop work agent-run: no crew roster row for ${order} — the order's capabilities ` +
|
|
517
559
|
`[${routing.capabilities.join(', ')}] match neither an exact row nor a bare name row in 'roster'. ` +
|
|
518
560
|
`Add a candidate array for one of them and restart the shift. Releasing — this shift will not pick ` +
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { mergePolicyFloorWithLocal, } from "../../../src/crypto/policy-floor.js";
|
|
10
10
|
import { resolveArtifactPolicy, } from "../../../src/store/pre-commit-verifier.js";
|
|
11
|
-
import { loadRevocations,
|
|
11
|
+
import { loadRevocations, loadGrants, resolveOrgRoot, } from "../../../src/crypto/org-root.js";
|
|
12
12
|
import { verifyConsumed, } from "../../../src/crypto/verify-consumed.js";
|
|
13
13
|
import { validateProducer } from "../../../src/crypto/chain.js";
|
|
14
14
|
/** Missing-org-root warnings are intentionally latched once per order process-wide. */
|
|
@@ -97,25 +97,14 @@ export function createConsumedVerifier(args) {
|
|
|
97
97
|
let revocations;
|
|
98
98
|
try {
|
|
99
99
|
root = resolveOrgRoot(args.env);
|
|
100
|
-
grants =
|
|
100
|
+
grants = loadGrants(args.env);
|
|
101
101
|
revocations = loadRevocations(args.env);
|
|
102
102
|
}
|
|
103
103
|
catch (error) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (result !== undefined)
|
|
109
|
-
return result;
|
|
110
|
-
}
|
|
111
|
-
for (const owed of order.owes) {
|
|
112
|
-
if (owed.reasons.length === 0 && owed.proof === undefined)
|
|
113
|
-
continue;
|
|
114
|
-
const result = policyOutcome(order, opts.hardRule, policy, owed.path, { kind: 'unverifiable', reason }, warnings);
|
|
115
|
-
if (result !== undefined)
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
return { ok: true, order, warnings };
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
reason: `consumed artifact gate refusal for ${order.workflow}/${order.run} step '${order.step}': local producer trust material could not be loaded: ${errorText(error)}`,
|
|
107
|
+
};
|
|
119
108
|
}
|
|
120
109
|
const prerequisite = root.kind === 'absent'
|
|
121
110
|
? 'prerequisite: no org-root anchor is configured'
|
|
@@ -22,7 +22,7 @@ import type { SshProcessAdapter } from '../../../../src/crypto/ssh.ts';
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const CONSUMES_INLINE_MAX_BYTES = 65536;
|
|
24
24
|
/** Discriminated result of an exec run; the role maps these to exit codes. */
|
|
25
|
-
export type ExecOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'unresolved-instructions' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'submit-rejected' | 'submit-failed' | 'rejected' | 'judge-rejected' | 'judge-no-verdict' | 'reject-failed' | 'stopped';
|
|
25
|
+
export type ExecOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'unresolved-instructions' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'submit-rejected' | 'submit-failed' | 'command-failed' | 'ask-failed' | 'rejected' | 'judge-rejected' | 'judge-no-verdict' | 'reject-failed' | 'stopped';
|
|
26
26
|
export interface ExecLoopOptions {
|
|
27
27
|
hub: HubClient;
|
|
28
28
|
runner: CommandRunner;
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
* misroute, and no child process is started.
|
|
20
20
|
* 3. RUN + RACE — the runner shells the command out while the lease loop runs.
|
|
21
21
|
* Whichever settles first wins (plan decision 9):
|
|
22
|
-
* - an ordinary command settles
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* carries the command result.
|
|
22
|
+
* - an ordinary command settles ⇒ build a receipt. A payload reject is
|
|
23
|
+
* delivered FIRST (the hub refuses a reject once the claim has closed,
|
|
24
|
+
* and the last owed submit is what closes it). A successful command
|
|
25
|
+
* submits that receipt to every owed path; a failed command raises an
|
|
26
|
+
* operator question with the receipt as diagnostic context and submits
|
|
27
|
+
* nothing.
|
|
29
28
|
* - a judge command exits 0 ⇒ submit its receipt; a non-zero exit ⇒ send
|
|
30
29
|
* `reject` for `order.judge` without a receipt; signal or machinery
|
|
31
30
|
* failure ⇒ no verdict, leave the claim for the reap path.
|
|
@@ -72,6 +71,48 @@ export const CONSUMES_INLINE_MAX_BYTES = 65_536;
|
|
|
72
71
|
function errMsg(e) {
|
|
73
72
|
return e instanceof Error ? e.message : String(e);
|
|
74
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* The one predicate that decides both how child output is logged and whether
|
|
76
|
+
* its receipt may be submitted.
|
|
77
|
+
*
|
|
78
|
+
* runner.ts reports a signalled child with `exitCode: null`, so a separate
|
|
79
|
+
* signal check is unnecessary.
|
|
80
|
+
*/
|
|
81
|
+
function commandSucceeded(result) {
|
|
82
|
+
return result.exitCode === 0 && result.error === undefined;
|
|
83
|
+
}
|
|
84
|
+
/** How a command failed, as an English predicate. */
|
|
85
|
+
function describeCommandFailure(result) {
|
|
86
|
+
if (result.error !== undefined)
|
|
87
|
+
return `could not be run (${result.error})`;
|
|
88
|
+
if (result.signal !== undefined)
|
|
89
|
+
return `was killed by ${result.signal}`;
|
|
90
|
+
return `exited ${result.exitCode}`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Append the child's captured output to a payload reject reason when it gives
|
|
94
|
+
* the consumer diagnosis that the script's one-line reason cannot.
|
|
95
|
+
*
|
|
96
|
+
* A reject consumer receives only this text. The same `outputTail` already
|
|
97
|
+
* reaches the worker log through `relayChildOutput` and the receipt through
|
|
98
|
+
* `receipt.ts`, but a step that consumes a rejected artifact sees neither:
|
|
99
|
+
* a delivery builder otherwise learns only that local checks failed. Matching
|
|
100
|
+
* `relayChildOutput`'s trailing-newline trim makes the log and reject carry
|
|
101
|
+
* identical bytes, while the label prevents the child's words from being
|
|
102
|
+
* mistaken for the script's reason.
|
|
103
|
+
*
|
|
104
|
+
* Scripts normally print their `##owenloop:payload##` directive to stdout, so
|
|
105
|
+
* that marker remains in the tail just as it does in `relayChildOutput`.
|
|
106
|
+
* Stripping it here would duplicate the runner's bounded marker scanner. The
|
|
107
|
+
* runner caps the tail at 4 KiB, and a large final payload can crowd out its
|
|
108
|
+
* diagnostics; that pre-existing limit belongs in the runner, not this relay.
|
|
109
|
+
*/
|
|
110
|
+
function withCommandOutput(text, outputTail) {
|
|
111
|
+
const tail = outputTail.replace(/\n+$/, '');
|
|
112
|
+
if (tail === '')
|
|
113
|
+
return text;
|
|
114
|
+
return `${text}\n\n--- command output (last ${Buffer.byteLength(tail, 'utf8')} bytes) ---\n${tail}`;
|
|
115
|
+
}
|
|
75
116
|
/**
|
|
76
117
|
* Put the order's consumed inputs on `childEnv`, and return the temp DIRECTORY
|
|
77
118
|
* holding the overflow file — or `undefined` when the payload went inline.
|
|
@@ -141,6 +182,42 @@ function deliverConsumes(childEnv, consumes) {
|
|
|
141
182
|
throw e;
|
|
142
183
|
}
|
|
143
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Deliver the owed-artifact reason threads to a command child. The same
|
|
187
|
+
* inline-or-file collision rule as consumes applies: a nested command must
|
|
188
|
+
* never inherit stale feedback from its parent order.
|
|
189
|
+
*/
|
|
190
|
+
function deliverFeedback(childEnv, feedback) {
|
|
191
|
+
if (feedback === undefined) {
|
|
192
|
+
delete childEnv['OWENLOOP_FEEDBACK'];
|
|
193
|
+
delete childEnv['OWENLOOP_FEEDBACK_FILE'];
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
let json;
|
|
197
|
+
try {
|
|
198
|
+
json = JSON.stringify(feedback);
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
throw new Error(`cannot serialize the order's feedback for OWENLOOP_FEEDBACK: ${errMsg(e)}`);
|
|
202
|
+
}
|
|
203
|
+
if (Buffer.byteLength(json, 'utf8') <= CONSUMES_INLINE_MAX_BYTES) {
|
|
204
|
+
childEnv['OWENLOOP_FEEDBACK'] = json;
|
|
205
|
+
delete childEnv['OWENLOOP_FEEDBACK_FILE'];
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
const dir = mkdtempSync(join(tmpdir(), 'owenloop-consumes-'));
|
|
209
|
+
try {
|
|
210
|
+
const file = join(dir, 'feedback.json');
|
|
211
|
+
writeFileSync(file, json, { encoding: 'utf8', mode: 0o600 });
|
|
212
|
+
childEnv['OWENLOOP_FEEDBACK_FILE'] = file;
|
|
213
|
+
delete childEnv['OWENLOOP_FEEDBACK'];
|
|
214
|
+
return dir;
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
removeConsumesDir(dir);
|
|
218
|
+
throw e;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
144
221
|
/** Best-effort removal of an overflow directory; a cleanup failure never fails a step. */
|
|
145
222
|
function removeConsumesDir(dir) {
|
|
146
223
|
if (dir === undefined)
|
|
@@ -251,10 +328,15 @@ export function createExecLoop(opts) {
|
|
|
251
328
|
* Deliver a PAYLOAD reject before the owed submits, and say whether this
|
|
252
329
|
* worker is finished.
|
|
253
330
|
*
|
|
331
|
+
* Its text is the script's reason plus a labeled child-output tail. That
|
|
332
|
+
* tail makes a reject actionable for a consumer that never sees the receipt,
|
|
333
|
+
* where the runner's output would otherwise be the only diagnosis.
|
|
334
|
+
*
|
|
254
335
|
* The distinction from `issueReject` is the third outcome. A judge reject is
|
|
255
336
|
* always the end of the run; a payload reject may leave the claim open, and
|
|
256
|
-
* when it does the
|
|
257
|
-
* terminal `ExecOutcome` or the
|
|
337
|
+
* when it does the caller decides whether the command result may deliver
|
|
338
|
+
* owed receipts. So this returns either a terminal `ExecOutcome` or the
|
|
339
|
+
* sentinel `'continue'`.
|
|
258
340
|
*
|
|
259
341
|
* refused / threw → terminal. `issueReject` has already logged it and
|
|
260
342
|
* settled the lease. Nothing is submitted: a reject that
|
|
@@ -265,17 +347,19 @@ export function createExecLoop(opts) {
|
|
|
265
347
|
* the owed paths stay debts for the next firing.
|
|
266
348
|
* landed, still open → `'continue'`. The rejected path was not consumed
|
|
267
349
|
* here, so the claim and the consume fingerprint are
|
|
268
|
-
* both intact
|
|
350
|
+
* both intact. A successful command may submit its
|
|
351
|
+
* owed receipts; a failed command escalates instead.
|
|
269
352
|
*
|
|
270
353
|
* `closed` is read from the hub's own response rather than re-derived from the
|
|
271
354
|
* order, because the consumed-input test lives in the hub
|
|
272
355
|
* (`reject-artifact.ts` checks `runRow.fingerprint`, which is what the engine
|
|
273
356
|
* recorded at claim time — not what the def declares the step consumes).
|
|
274
357
|
*/
|
|
275
|
-
async function relayPayloadReject(path, text, owed) {
|
|
358
|
+
async function relayPayloadReject(path, text, outputTail, owed) {
|
|
359
|
+
const body = withCommandOutput(text, outputTail);
|
|
276
360
|
let res;
|
|
277
361
|
try {
|
|
278
|
-
res = await hub.reject({ workflow, run: runId, path, text });
|
|
362
|
+
res = await hub.reject({ workflow, run: runId, path, text: body });
|
|
279
363
|
}
|
|
280
364
|
catch (e) {
|
|
281
365
|
opts.err(`owenloop work exec: reject of ${path} failed: ${errMsg(e)}`);
|
|
@@ -298,7 +382,7 @@ export function createExecLoop(opts) {
|
|
|
298
382
|
await leasePromise;
|
|
299
383
|
return 'rejected';
|
|
300
384
|
}
|
|
301
|
-
opts.out(`owenloop work exec: rejected ${path} (not consumed by this firing) —
|
|
385
|
+
opts.out(`owenloop work exec: rejected ${path} (not consumed by this firing) — claim remains open`);
|
|
302
386
|
return 'continue';
|
|
303
387
|
}
|
|
304
388
|
/**
|
|
@@ -322,11 +406,12 @@ export function createExecLoop(opts) {
|
|
|
322
406
|
* schema-rejected — with no trace of what the child said. Reproducing the
|
|
323
407
|
* script by hand outside the engine was the only way to see its stderr.
|
|
324
408
|
*
|
|
325
|
-
* The success half matters because a non-judge command
|
|
326
|
-
*
|
|
327
|
-
* `merge-gate`
|
|
328
|
-
* relay, every deferral produced three identical log
|
|
329
|
-
* measured 40-minute case is recorded in
|
|
409
|
+
* The success half matters because a non-judge command can defer with exit 0
|
|
410
|
+
* and no payload. Failed commands now escalate through `ask`, but
|
|
411
|
+
* `merge-gate` still uses that exit-0 deferral on its `cadence: 2m`
|
|
412
|
+
* re-offer. Before this relay, every deferral produced three identical log
|
|
413
|
+
* lines and no reason; the measured 40-minute case is recorded in
|
|
414
|
+
* `src/config-dir.ts:19-26`.
|
|
330
415
|
*
|
|
331
416
|
* Silence is printed rather than skipped because "this gate printed nothing"
|
|
332
417
|
* is itself the diagnosis, and an absent line is indistinguishable from the
|
|
@@ -337,9 +422,9 @@ export function createExecLoop(opts) {
|
|
|
337
422
|
* 44 KiB per run. That cap is why no volume knob exists: a knob would let a
|
|
338
423
|
* machine silently reintroduce this exact bug. Each line is prefixed so the
|
|
339
424
|
* child's words are never mistaken for exec's own.
|
|
340
|
-
|
|
425
|
+
*/
|
|
341
426
|
function relayChildOutput(result, step) {
|
|
342
|
-
const succeeded = result
|
|
427
|
+
const succeeded = commandSucceeded(result);
|
|
343
428
|
// TWO CHANNELS ON PURPOSE, and this is not tidiness to be refactored away.
|
|
344
429
|
// `opts.err` is the channel a reader treats as trouble; routing a green
|
|
345
430
|
// step's routine output there would make every successful step look like a
|
|
@@ -350,12 +435,7 @@ export function createExecLoop(opts) {
|
|
|
350
435
|
write(`owenloop work exec: the command for step '${step}' succeeded; its output follows`);
|
|
351
436
|
}
|
|
352
437
|
else {
|
|
353
|
-
|
|
354
|
-
? `could not be run (${result.error})`
|
|
355
|
-
: result.signal !== undefined
|
|
356
|
-
? `was killed by ${result.signal}`
|
|
357
|
-
: `exited ${result.exitCode}`;
|
|
358
|
-
write(`owenloop work exec: the command for step '${step}' ${how}; its last output follows`);
|
|
438
|
+
write(`owenloop work exec: the command for step '${step}' ${describeCommandFailure(result)}; its last output follows`);
|
|
359
439
|
}
|
|
360
440
|
const tail = result.outputTail.replace(/\n+$/, '');
|
|
361
441
|
if (tail === '') {
|
|
@@ -365,8 +445,64 @@ export function createExecLoop(opts) {
|
|
|
365
445
|
for (const line of tail.split('\n'))
|
|
366
446
|
write(` | ${line}`);
|
|
367
447
|
}
|
|
368
|
-
/**
|
|
369
|
-
|
|
448
|
+
/** The operator-facing failure text shown by `owenloop inbox`. */
|
|
449
|
+
function failureQuestion(receipt, path, resolvedCommand) {
|
|
450
|
+
const head = `the command for step '${receipt.step}' ${describeCommandFailure(receipt)}, ` +
|
|
451
|
+
`so '${path}' was not produced and no receipt was submitted.\n` +
|
|
452
|
+
`command: ${resolvedCommand}\n` +
|
|
453
|
+
`exit code: ${receipt.exitCode ?? 'none'}` +
|
|
454
|
+
(receipt.signal !== undefined ? `, signal: ${receipt.signal}` : '') +
|
|
455
|
+
(receipt.error !== undefined ? `, error: ${receipt.error}` : '') +
|
|
456
|
+
`\noutput: ${receipt.stdoutBytes} stdout byte(s), ${receipt.stderrBytes} stderr byte(s), ` +
|
|
457
|
+
`hash ${receipt.outputHash}`;
|
|
458
|
+
return withCommandOutput(head, receipt.outputTail);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* A failed command does not green anything. Raise a question on its own owed
|
|
462
|
+
* path and retain the receipt as diagnostic context instead.
|
|
463
|
+
*/
|
|
464
|
+
async function escalateCommandFailure(receipt, order, resolvedCommand) {
|
|
465
|
+
// run() returns misroute when order.owes is empty, so this index is safe.
|
|
466
|
+
const path = order.owes[0].path;
|
|
467
|
+
const how = describeCommandFailure(receipt);
|
|
468
|
+
opts.err(`owenloop work exec: the command for step '${order.step}' ${how} — ` +
|
|
469
|
+
`no receipt will be submitted; escalating on ${path}`);
|
|
470
|
+
// ask closes the run, so one firing can raise only one question. The
|
|
471
|
+
// remaining owed paths stay debts for the next firing.
|
|
472
|
+
if (order.owes.length > 1) {
|
|
473
|
+
const rest = order.owes.slice(1).map((owe) => owe.path).join(', ');
|
|
474
|
+
opts.err(`owenloop work exec: ${order.owes.length - 1} other owed path(s) were not escalated ` +
|
|
475
|
+
`because ask closes the run: ${rest}`);
|
|
476
|
+
}
|
|
477
|
+
let res;
|
|
478
|
+
try {
|
|
479
|
+
res = await hub.ask({
|
|
480
|
+
workflow,
|
|
481
|
+
run: runId,
|
|
482
|
+
path,
|
|
483
|
+
question: failureQuestion(receipt, path, resolvedCommand),
|
|
484
|
+
context: JSON.stringify(receipt),
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
catch (e) {
|
|
488
|
+
opts.err(`owenloop work exec: ask on ${path} failed: ${errMsg(e)}`);
|
|
489
|
+
lease.stop('ask-failed');
|
|
490
|
+
await leasePromise;
|
|
491
|
+
return 'ask-failed';
|
|
492
|
+
}
|
|
493
|
+
if (res.ok !== true) {
|
|
494
|
+
opts.err(`owenloop work exec: ask on ${path} was refused: ${res.text}`);
|
|
495
|
+
lease.stop('ask-failed', res.closed === true ? { release: false } : undefined);
|
|
496
|
+
await leasePromise;
|
|
497
|
+
return 'ask-failed';
|
|
498
|
+
}
|
|
499
|
+
opts.out(`owenloop work exec: asked ${path} — the artifact is held for a human and nothing was greened`);
|
|
500
|
+
lease.stop('command-failed', res.closed === true ? { release: false } : undefined);
|
|
501
|
+
await leasePromise;
|
|
502
|
+
return 'command-failed';
|
|
503
|
+
}
|
|
504
|
+
/** Build the command receipt, then deliver, reject, or escalate it. */
|
|
505
|
+
async function deliverCommandResult(result, order, resolvedCommand) {
|
|
370
506
|
if (signalled) {
|
|
371
507
|
// The operator killed the work and the command settled before the lease
|
|
372
508
|
// (the release HTTP round-trip is slower than a TERM'd child dying), so
|
|
@@ -450,15 +586,18 @@ export function createExecLoop(opts) {
|
|
|
450
586
|
//
|
|
451
587
|
// `closed: false` — the rejected path was NOT consumed by this firing, so
|
|
452
588
|
// the claim is still open and the fingerprint has not moved. Fall through
|
|
453
|
-
//
|
|
589
|
+
// to the command-result gate: a success submits every owed path, while a
|
|
590
|
+
// failure escalates through ask and submits nothing.
|
|
454
591
|
//
|
|
455
592
|
// A REFUSED reject now submits nothing. That is the point: previously the
|
|
456
593
|
// receipt had already landed and greened a path whose gate had failed.
|
|
457
594
|
if (order.judge === undefined && parsedPayload.reject !== undefined) {
|
|
458
|
-
const rejected = await relayPayloadReject(parsedPayload.reject.path, parsedPayload.reject.text, order.owes.length);
|
|
595
|
+
const rejected = await relayPayloadReject(parsedPayload.reject.path, parsedPayload.reject.text, result.outputTail, order.owes.length);
|
|
459
596
|
if (rejected !== 'continue')
|
|
460
597
|
return rejected;
|
|
461
598
|
}
|
|
599
|
+
if (!commandSucceeded(result))
|
|
600
|
+
return escalateCommandFailure(receipt, order, resolvedCommand);
|
|
462
601
|
for (const owe of order.owes) {
|
|
463
602
|
let res;
|
|
464
603
|
try {
|
|
@@ -594,6 +733,7 @@ export function createExecLoop(opts) {
|
|
|
594
733
|
// no receipt — but it is not a guarantee to build on. Do not add work here
|
|
595
734
|
// that assumes the child is gone.
|
|
596
735
|
let consumesDir;
|
|
736
|
+
let feedbackDir;
|
|
597
737
|
try {
|
|
598
738
|
let cmd;
|
|
599
739
|
try {
|
|
@@ -618,6 +758,14 @@ export function createExecLoop(opts) {
|
|
|
618
758
|
childEnv['OWENLOOP_WORKFLOW'] = workflow;
|
|
619
759
|
childEnv['OWENLOOP_RUN'] = runId;
|
|
620
760
|
consumesDir = deliverConsumes(childEnv, order.consumes);
|
|
761
|
+
const feedback = order.owes
|
|
762
|
+
.filter((owe) => owe.reasons.length > 0)
|
|
763
|
+
.map((owe) => ({ path: owe.path, reasons: owe.reasons }));
|
|
764
|
+
feedbackDir = deliverFeedback(childEnv, feedback.length > 0 ? feedback : undefined);
|
|
765
|
+
if (order.modifier === undefined)
|
|
766
|
+
delete childEnv['OWENLOOP_MODIFIER'];
|
|
767
|
+
else
|
|
768
|
+
childEnv['OWENLOOP_MODIFIER'] = order.modifier;
|
|
621
769
|
// The order carries no workdir when the step declared neither `workdir:`
|
|
622
770
|
// nor `workdirFrom:` (the hub resolves `workdirFrom` and ships the
|
|
623
771
|
// result, so an absent field IS that signal). Substituting the shift's
|
|
@@ -655,7 +803,7 @@ export function createExecLoop(opts) {
|
|
|
655
803
|
cmd = runner.start(resolvedCommand, startOptions);
|
|
656
804
|
}
|
|
657
805
|
catch (e) {
|
|
658
|
-
return
|
|
806
|
+
return deliverCommandResult(machineryFailure(e), order, resolvedCommand);
|
|
659
807
|
}
|
|
660
808
|
running = cmd;
|
|
661
809
|
opts.out(`owenloop work exec: running ${workflow}/${runId} (step '${order.step}')`);
|
|
@@ -672,10 +820,11 @@ export function createExecLoop(opts) {
|
|
|
672
820
|
opts.err(`owenloop work exec: lease ${outcome.o} while the command ran — killed the command, no receipt submitted`);
|
|
673
821
|
return mapLeaseDuringRun(outcome.o);
|
|
674
822
|
}
|
|
675
|
-
return
|
|
823
|
+
return deliverCommandResult(outcome.r, order, resolvedCommand);
|
|
676
824
|
}
|
|
677
825
|
finally {
|
|
678
826
|
removeConsumesDir(consumesDir);
|
|
827
|
+
removeConsumesDir(feedbackDir);
|
|
679
828
|
}
|
|
680
829
|
}
|
|
681
830
|
function stop(reason) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The command receipt (C5, plan decision 8) — the
|
|
3
|
-
*
|
|
4
|
-
* verb has no failure channel,
|
|
5
|
-
* `
|
|
6
|
-
* exit uses `reject` instead
|
|
7
|
-
* Pure construction so it is trivially asserted in tests.
|
|
2
|
+
* The command receipt (C5, plan decision 8) — the artifact value exec submits
|
|
3
|
+
* only for a successful ordinary command and for a judge that exits 0. Because
|
|
4
|
+
* the hub `submit` verb has no failure channel, a failed ordinary command puts
|
|
5
|
+
* this same receipt in `hub.ask`'s diagnostic context and submits nothing. A
|
|
6
|
+
* non-zero judge exit uses `reject` instead, and signal-killed work submits
|
|
7
|
+
* neither. Pure construction so it is trivially asserted in tests.
|
|
8
8
|
*/
|
|
9
9
|
import { type ParsedPayload } from './payload.ts';
|
|
10
10
|
import type { CommandResult } from './runner.ts';
|
|
11
|
-
/**
|
|
11
|
+
/** A command's artifact value on success, or failure diagnostics in `hub.ask` context. */
|
|
12
12
|
export interface CommandReceipt {
|
|
13
13
|
kind: 'command-receipt';
|
|
14
14
|
command: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The command receipt (C5, plan decision 8) — the
|
|
3
|
-
*
|
|
4
|
-
* verb has no failure channel,
|
|
5
|
-
* `
|
|
6
|
-
* exit uses `reject` instead
|
|
7
|
-
* Pure construction so it is trivially asserted in tests.
|
|
2
|
+
* The command receipt (C5, plan decision 8) — the artifact value exec submits
|
|
3
|
+
* only for a successful ordinary command and for a judge that exits 0. Because
|
|
4
|
+
* the hub `submit` verb has no failure channel, a failed ordinary command puts
|
|
5
|
+
* this same receipt in `hub.ask`'s diagnostic context and submits nothing. A
|
|
6
|
+
* non-zero judge exit uses `reject` instead, and signal-killed work submits
|
|
7
|
+
* neither. Pure construction so it is trivially asserted in tests.
|
|
8
8
|
*/
|
|
9
9
|
import { parsePayloadLine } from "./payload.js";
|
|
10
10
|
/** Fold a raw `CommandResult` and its order context into the submitted receipt. */
|