owenloop 0.5.24 → 0.5.26
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 +19 -0
- package/dist/packages/work/src/exec/loop.js +110 -6
- package/dist/packages/work/src/exec/payload.d.ts +107 -5
- package/dist/packages/work/src/exec/payload.js +222 -17
- package/dist/packages/work/src/exec/receipt.d.ts +12 -3
- package/dist/packages/work/src/exec/receipt.js +9 -9
- package/dist/packages/work/src/shift/loop.d.ts +76 -12
- package/dist/packages/work/src/shift/loop.js +157 -24
- package/dist/src/bundle/runtime.d.ts +1 -1
- package/dist/src/bundle/runtime.js +13 -0
- package/dist/src/defs.js +106 -11
- package/dist/src/engine.d.ts +2 -8
- package/dist/src/engine.js +40 -28
- package/dist/src/model.d.ts +12 -2
- package/dist/src/model.js +29 -22
- package/dist/src/order-resolver.js +1 -0
- package/dist/src/types.d.ts +8 -0
- package/docs/authoring.md +31 -1
- package/docs/bundles.md +66 -0
- package/docs/cli.md +6 -2
- package/docs/design.md +36 -5
- package/docs/routing.md +3 -2
- package/docs/wire-contracts.md +22 -1
- 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/dist/src/engine.d.ts
CHANGED
|
@@ -822,11 +822,11 @@ export declare class Engine {
|
|
|
822
822
|
* not a produce of the judge step's own (it has none). Judge-variant CAS
|
|
823
823
|
* (§4.6): the judged stem must still be `submitted` at the version this
|
|
824
824
|
* judge's run fingerprinted at claim time. Records the ledger slot; only
|
|
825
|
-
* flips `submitted → green` once every
|
|
825
|
+
* flips `submitted → green` once every active judge has signed the
|
|
826
826
|
* current version. Terminal is applied here (§4.8), not at producer
|
|
827
827
|
* commit, when the produce has judges.
|
|
828
828
|
* - a real run whose step is the artifact's actual producer — today's
|
|
829
|
-
* path, with one addition: if the produce
|
|
829
|
+
* path, with one addition: if the produce has active `judges:`, the
|
|
830
830
|
* commit lands `submitted` (not `green`), clears any stale `approvals`
|
|
831
831
|
* ledger from a prior submission (§4.4), and defers `terminal` to
|
|
832
832
|
* judge-approve time instead of applying it here.
|
|
@@ -1159,12 +1159,6 @@ export declare class Engine {
|
|
|
1159
1159
|
* not handled here. Returns undefined when no schema is declared (the default).
|
|
1160
1160
|
*/
|
|
1161
1161
|
private produceSchema;
|
|
1162
|
-
/**
|
|
1163
|
-
* §24: the declared judge names for `art`'s produce entry, or `[]` if none —
|
|
1164
|
-
* `judges:` is only ever valid on a singleton produce (Q3, enforced at parse
|
|
1165
|
-
* time), so unlike `produceSchema` there is no map-element case to handle.
|
|
1166
|
-
*/
|
|
1167
|
-
private declaredJudgeNames;
|
|
1168
1162
|
/**
|
|
1169
1163
|
* Open a run for commit: it must exist, be unclosed, and still hold its lease.
|
|
1170
1164
|
* The lease check rejects a zombie commit — a run that was reaped (its task
|
package/dist/src/engine.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* born-rejects the output instead of greening it.
|
|
11
11
|
*/
|
|
12
12
|
import { elementPath, parseElement, parseWorkdirFrom, sealPath, } from "./paths.js";
|
|
13
|
-
import { collectionStem, computeFingerprint, eligibleFirings, fingerprintMatches, groupBlockingWinner, isEscalated, isGreen, judgeNameOf, maintainDecisions, owedSchema, pendingOwed, plainConsumes, rejectionEpisode, requiredInputs, workflowDone, workflowStatus, } from "./model.js";
|
|
13
|
+
import { collectionStem, activeJudgesForStem, computeFingerprint, eligibleFirings, fingerprintMatches, groupBlockingWinner, isEscalated, isGreen, judgeNameOf, maintainDecisions, owedSchema, pendingOwed, plainConsumes, rejectionEpisode, requiredInputs, workflowDone, workflowStatus, } from "./model.js";
|
|
14
14
|
import { summarizeIssues, validateValue } from "./schema.js";
|
|
15
15
|
import { hashDef } from "./defs.js";
|
|
16
16
|
import { checkInterfaceCompatibility } from "./implements.js";
|
|
@@ -1506,7 +1506,7 @@ export class Engine {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
// Compute time facts for idle eligibility (clock-read boundary).
|
|
1508
1508
|
const timeFacts = this.computeTimeFacts(def, workflow, arts, now);
|
|
1509
|
-
const firings = eligibleFirings(def, arts, timeFacts);
|
|
1509
|
+
const firings = eligibleFirings(def, arts, timeFacts, { modifier });
|
|
1510
1510
|
const { selected, deferred } = this.applySchedule(workflow, def, firings, now, arts, capabilities, modifier, matchModes, capabilityMappings, capabilityRewrites);
|
|
1511
1511
|
const orders = [];
|
|
1512
1512
|
const allDeferred = [...deferred];
|
|
@@ -2100,17 +2100,17 @@ export class Engine {
|
|
|
2100
2100
|
* not a produce of the judge step's own (it has none). Judge-variant CAS
|
|
2101
2101
|
* (§4.6): the judged stem must still be `submitted` at the version this
|
|
2102
2102
|
* judge's run fingerprinted at claim time. Records the ledger slot; only
|
|
2103
|
-
* flips `submitted → green` once every
|
|
2103
|
+
* flips `submitted → green` once every active judge has signed the
|
|
2104
2104
|
* current version. Terminal is applied here (§4.8), not at producer
|
|
2105
2105
|
* commit, when the produce has judges.
|
|
2106
2106
|
* - a real run whose step is the artifact's actual producer — today's
|
|
2107
|
-
* path, with one addition: if the produce
|
|
2107
|
+
* path, with one addition: if the produce has active `judges:`, the
|
|
2108
2108
|
* commit lands `submitted` (not `green`), clears any stale `approvals`
|
|
2109
2109
|
* ledger from a prior submission (§4.4), and defers `terminal` to
|
|
2110
2110
|
* judge-approve time instead of applying it here.
|
|
2111
2111
|
*/
|
|
2112
2112
|
green(workflow, run, path, value, opts = {}) {
|
|
2113
|
-
const def = this.
|
|
2113
|
+
const { def, modifier } = this.instanceFor(workflow);
|
|
2114
2114
|
if (run === 'human') {
|
|
2115
2115
|
const result = this.store.tx(() => {
|
|
2116
2116
|
const arts = this.artMap(workflow);
|
|
@@ -2170,6 +2170,16 @@ export class Engine {
|
|
|
2170
2170
|
if (runStep?.judges) {
|
|
2171
2171
|
const judgedStem = runStep.judges;
|
|
2172
2172
|
const judged = arts.get(judgedStem);
|
|
2173
|
+
const activeJudges = activeJudgesForStem(def, judgedStem, modifier);
|
|
2174
|
+
if (!activeJudges.some((judge) => judge.name === judgeNameOf(runStep))) {
|
|
2175
|
+
this.releaseLeaseOnBornReject(workflow, run);
|
|
2176
|
+
this.settle(workflow, def);
|
|
2177
|
+
return {
|
|
2178
|
+
path: judgedStem,
|
|
2179
|
+
outcome: 'born-rejected',
|
|
2180
|
+
reason: `judge '${judgeNameOf(runStep)}' is inactive for the current workflow modifier`,
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2173
2183
|
const cas = this.judgeCasCheck(judged, judgedStem, r.fingerprint ?? {});
|
|
2174
2184
|
if (cas.moved) {
|
|
2175
2185
|
this.releaseLeaseOnBornReject(workflow, run);
|
|
@@ -2179,7 +2189,7 @@ export class Engine {
|
|
|
2179
2189
|
const art = judged; // judgeCasCheck guarantees submitted (non-null)
|
|
2180
2190
|
const jName = judgeNameOf(runStep);
|
|
2181
2191
|
const approvals = { ...(art.approvals ?? {}), [jName]: art.version };
|
|
2182
|
-
const judgeNames =
|
|
2192
|
+
const judgeNames = activeJudges.map((judge) => judge.name);
|
|
2183
2193
|
const allApproved = judgeNames.every((jn) => approvals[jn] === art.version);
|
|
2184
2194
|
if (allApproved) {
|
|
2185
2195
|
// §26: the last judge's approve is the moment this stem would go
|
|
@@ -2214,7 +2224,7 @@ export class Engine {
|
|
|
2214
2224
|
// human-bypass/judge-approve branches above): a losing sibling must be
|
|
2215
2225
|
// refused as 'group-rejected' without bumping the schema-stall counter,
|
|
2216
2226
|
// even when its value also happens to be schema-invalid.
|
|
2217
|
-
const judgeNames =
|
|
2227
|
+
const judgeNames = activeJudgesForStem(def, art.path, modifier).map((judge) => judge.name);
|
|
2218
2228
|
const hasJudges = judgeNames.length > 0;
|
|
2219
2229
|
if (!hasJudges) {
|
|
2220
2230
|
const groupCas = this.groupCasCheck(def, arts, art);
|
|
@@ -2264,7 +2274,7 @@ export class Engine {
|
|
|
2264
2274
|
this.settle(workflow, def);
|
|
2265
2275
|
return { path, outcome: 'schema-rejected', reason: text };
|
|
2266
2276
|
}
|
|
2267
|
-
// §24 §4.4/§4.8: when this produce
|
|
2277
|
+
// §24 §4.4/§4.8: when this produce has active judges, the commit lands
|
|
2268
2278
|
// `submitted` (not `green`) and the version bumps here — CAS re-arms on
|
|
2269
2279
|
// resubmission, not on judge-approve. `approvals` resets so a prior
|
|
2270
2280
|
// submission's sign-offs never leak onto a fresh version. Terminal is
|
|
@@ -2465,7 +2475,7 @@ export class Engine {
|
|
|
2465
2475
|
* (`parallel: 1`, a generous `reapTtl:` on slow judge steps).
|
|
2466
2476
|
*/
|
|
2467
2477
|
reject(workflow, path, by, text, requested) {
|
|
2468
|
-
const def = this.
|
|
2478
|
+
const { def, modifier } = this.instanceFor(workflow);
|
|
2469
2479
|
this.assertAuthority(def, by, path, 'reject');
|
|
2470
2480
|
// F4: a reject on an artifact produced by a `calls:` step is a verdict on
|
|
2471
2481
|
// the CHILD's work, not the parent's own — forward it. Detection: the
|
|
@@ -2499,10 +2509,21 @@ export class Engine {
|
|
|
2499
2509
|
this.assertBoundModifier(def, requested);
|
|
2500
2510
|
}
|
|
2501
2511
|
if (judgedStem !== undefined) {
|
|
2512
|
+
const task = this.store.getTask(workflow, by, '');
|
|
2513
|
+
if (!activeJudgesForStem(def, judgedStem, modifier).some((judge) => judge.name === judgeNameOf(judgeStep))) {
|
|
2514
|
+
if (task?.run) {
|
|
2515
|
+
this.releaseLeaseOnBornReject(workflow, task.run);
|
|
2516
|
+
releasedRun = task.run;
|
|
2517
|
+
}
|
|
2518
|
+
this.settle(workflow, def);
|
|
2519
|
+
return {
|
|
2520
|
+
outcome: 'born-rejected',
|
|
2521
|
+
reason: `judge '${judgeNameOf(judgeStep)}' is inactive for the current workflow modifier`,
|
|
2522
|
+
};
|
|
2523
|
+
}
|
|
2502
2524
|
// A judge's reject targets the judged stem, mirroring green()'s
|
|
2503
2525
|
// judge-approve branch (§24.4): CAS-guard against a stale verdict
|
|
2504
2526
|
// before applying it.
|
|
2505
|
-
const task = this.store.getTask(workflow, by, '');
|
|
2506
2527
|
const run = task?.run ? this.store.getRun(task.run) : undefined;
|
|
2507
2528
|
const cas = this.judgeCasCheck(art, judgedStem, run?.fingerprint ?? {});
|
|
2508
2529
|
if (cas.moved) {
|
|
@@ -2942,9 +2963,9 @@ export class Engine {
|
|
|
2942
2963
|
const wf = this.store.getWorkflow(workflow);
|
|
2943
2964
|
if (!wf)
|
|
2944
2965
|
throw new Error(`no such workflow instance: ${workflow}`);
|
|
2945
|
-
const def = this.
|
|
2966
|
+
const { def, modifier } = this.instanceFor(workflow);
|
|
2946
2967
|
const arts = this.artMap(workflow);
|
|
2947
|
-
const st = workflowStatus(def, arts);
|
|
2968
|
+
const st = workflowStatus(def, arts, { modifier });
|
|
2948
2969
|
// Enrich each debt with its producer's crash-step signal (the run log; the
|
|
2949
2970
|
// pure layer has no store). A map-step producer fires once per element, its
|
|
2950
2971
|
// run keyed by the consumed element path (e.g. "gather.source[0]"); a
|
|
@@ -3085,9 +3106,9 @@ export class Engine {
|
|
|
3085
3106
|
fireSettled(workflow) {
|
|
3086
3107
|
if (this.listeners.size === 0)
|
|
3087
3108
|
return;
|
|
3088
|
-
const def = this.
|
|
3109
|
+
const { def, modifier } = this.instanceFor(workflow);
|
|
3089
3110
|
const arts = this.artMap(workflow);
|
|
3090
|
-
const st = workflowStatus(def, arts);
|
|
3111
|
+
const st = workflowStatus(def, arts, { modifier });
|
|
3091
3112
|
this.fire({ type: 'settled', workflow, done: st.done, eligible: st.eligible.map((e) => e.step) });
|
|
3092
3113
|
}
|
|
3093
3114
|
/** Compute the TimeFacts bag for idle eligibility from the current store state. */
|
|
@@ -3428,14 +3449,17 @@ export class Engine {
|
|
|
3428
3449
|
childStatusSummary(childWf, visited) {
|
|
3429
3450
|
visited.add(childWf);
|
|
3430
3451
|
let childDef;
|
|
3452
|
+
let childModifier;
|
|
3431
3453
|
try {
|
|
3432
|
-
|
|
3454
|
+
const instance = this.instanceFor(childWf);
|
|
3455
|
+
childDef = instance.def;
|
|
3456
|
+
childModifier = instance.modifier;
|
|
3433
3457
|
}
|
|
3434
3458
|
catch {
|
|
3435
3459
|
return undefined;
|
|
3436
3460
|
}
|
|
3437
3461
|
const childArts = this.artMap(childWf);
|
|
3438
|
-
const cs = workflowStatus(childDef, childArts);
|
|
3462
|
+
const cs = workflowStatus(childDef, childArts, { modifier: childModifier });
|
|
3439
3463
|
let stalled = cs.debts.some((d) => d.stalled);
|
|
3440
3464
|
if (!stalled) {
|
|
3441
3465
|
for (const d of cs.debts) {
|
|
@@ -3590,18 +3614,6 @@ export class Engine {
|
|
|
3590
3614
|
const sp = step.produces.find((p) => p.kind === 'singleton' && p.stem === art.path);
|
|
3591
3615
|
return sp?.schema;
|
|
3592
3616
|
}
|
|
3593
|
-
/**
|
|
3594
|
-
* §24: the declared judge names for `art`'s produce entry, or `[]` if none —
|
|
3595
|
-
* `judges:` is only ever valid on a singleton produce (Q3, enforced at parse
|
|
3596
|
-
* time), so unlike `produceSchema` there is no map-element case to handle.
|
|
3597
|
-
*/
|
|
3598
|
-
declaredJudgeNames(def, art) {
|
|
3599
|
-
const step = def.steps.find((l) => l.name === art.producer);
|
|
3600
|
-
if (!step)
|
|
3601
|
-
return [];
|
|
3602
|
-
const sp = step.produces.find((p) => p.kind === 'singleton' && p.stem === art.path);
|
|
3603
|
-
return sp?.judges?.map((j) => j.name) ?? [];
|
|
3604
|
-
}
|
|
3605
3617
|
/**
|
|
3606
3618
|
* Open a run for commit: it must exist, be unclosed, and still hold its lease.
|
|
3607
3619
|
* The lease check rejects a zombie commit — a run that was reaped (its task
|
package/dist/src/model.d.ts
CHANGED
|
@@ -86,6 +86,12 @@ export declare function stepMode(step: StepDef): StepMode;
|
|
|
86
86
|
* one naming convention.
|
|
87
87
|
*/
|
|
88
88
|
export declare function judgeNameOf(step: StepDef): string;
|
|
89
|
+
/**
|
|
90
|
+
* The sole lifecycle authority for native-judge activation. A scope matches
|
|
91
|
+
* only the instance's stored modifier; per-offer escalation routing never
|
|
92
|
+
* participates here. Unknown/non-singleton stems intentionally fail closed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function activeJudgesForStem(def: WorkflowDef, stem: string, modifier?: string): NonNullable<ProducePattern['judges']>;
|
|
89
95
|
export declare function mapProduce(step: StepDef): ProducePattern | undefined;
|
|
90
96
|
/** All per-element outputs a map step owns for each input index. */
|
|
91
97
|
export declare function mapProduces(step: StepDef): ProducePattern[];
|
|
@@ -297,6 +303,7 @@ export declare function memberRetractFirings(def: WorkflowDef, arts: ArtifactMap
|
|
|
297
303
|
*/
|
|
298
304
|
export declare function eligibleFirings(def: WorkflowDef, arts: ArtifactMap, time?: TimeFacts, opts?: {
|
|
299
305
|
ignoreFreeze?: boolean;
|
|
306
|
+
modifier?: string;
|
|
300
307
|
}): Firing[];
|
|
301
308
|
/**
|
|
302
309
|
* Pure static predicate: can `step` EVER fire, under ANY search bounds?
|
|
@@ -412,7 +419,7 @@ export interface WorkflowStatus {
|
|
|
412
419
|
/**
|
|
413
420
|
* §24 §4.7: artifacts `submitted` (built, awaiting judge sign-off). Not a
|
|
414
421
|
* producer debt — the producer already discharged it — but still outstanding
|
|
415
|
-
* for done-ness. `pendingJudges` lists
|
|
422
|
+
* for done-ness. `pendingJudges` lists active judge names that have not
|
|
416
423
|
* yet approved the current version.
|
|
417
424
|
*/
|
|
418
425
|
pending: Array<{
|
|
@@ -448,7 +455,9 @@ export interface WorkflowStatus {
|
|
|
448
455
|
*/
|
|
449
456
|
export declare function workflowDone(def: WorkflowDef, arts: ArtifactMap): boolean;
|
|
450
457
|
/** Derive the operator view purely from artifact state (§17) — never stored. */
|
|
451
|
-
export declare function workflowStatus(def: WorkflowDef, arts: ArtifactMap
|
|
458
|
+
export declare function workflowStatus(def: WorkflowDef, arts: ArtifactMap, opts?: {
|
|
459
|
+
modifier?: string;
|
|
460
|
+
}): WorkflowStatus;
|
|
452
461
|
export { SETTLED_STATES };
|
|
453
462
|
/**
|
|
454
463
|
* Pure evaluation of a structured invariant predicate against artifact state.
|
|
@@ -532,6 +541,7 @@ export declare function settleInMemory(def: WorkflowDef, arts: Map<string, Artif
|
|
|
532
541
|
*/
|
|
533
542
|
export declare function applyOutcome(def: WorkflowDef, arts: Map<string, ArtifactData>, firing: Firing, outcome: CheckStep['outcome'], opts: {
|
|
534
543
|
maxCollectionSize: number;
|
|
544
|
+
modifier?: string;
|
|
535
545
|
}): Array<Map<string, ArtifactData>>;
|
|
536
546
|
/**
|
|
537
547
|
* Bounded reachability / liveness checker over a workflow definition.
|
package/dist/src/model.js
CHANGED
|
@@ -51,6 +51,17 @@ export function judgeNameOf(step) {
|
|
|
51
51
|
const idx = step.name.lastIndexOf(marker);
|
|
52
52
|
return idx === -1 ? step.name : step.name.slice(idx + marker.length);
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The sole lifecycle authority for native-judge activation. A scope matches
|
|
56
|
+
* only the instance's stored modifier; per-offer escalation routing never
|
|
57
|
+
* participates here. Unknown/non-singleton stems intentionally fail closed.
|
|
58
|
+
*/
|
|
59
|
+
export function activeJudgesForStem(def, stem, modifier) {
|
|
60
|
+
const owners = def.steps.flatMap((step) => step.produces.filter((produce) => produce.kind === 'singleton' && produce.stem === stem));
|
|
61
|
+
if (owners.length !== 1)
|
|
62
|
+
return [];
|
|
63
|
+
return (owners[0].judges ?? []).filter((judge) => judge.modifiers === undefined || (modifier !== undefined && judge.modifiers.includes(modifier)));
|
|
64
|
+
}
|
|
54
65
|
export function mapProduce(step) {
|
|
55
66
|
return step.produces.find((p) => p.kind === 'map');
|
|
56
67
|
}
|
|
@@ -730,7 +741,9 @@ export function eligibleFirings(def, arts, time, opts) {
|
|
|
730
741
|
if (step.judges) {
|
|
731
742
|
const judgedStem = step.judges;
|
|
732
743
|
const judged = arts.get(judgedStem);
|
|
733
|
-
|
|
744
|
+
const active = activeJudgesForStem(def, judgedStem, opts?.modifier);
|
|
745
|
+
if (active.some((judge) => judge.name === judgeNameOf(step))
|
|
746
|
+
&& judged && judged.acceptance === 'submitted' && groupBlockingWinner(def, arts, judgedStem) === undefined) {
|
|
734
747
|
const approvedVersion = judged.approvals?.[judgeNameOf(step)];
|
|
735
748
|
if (approvedVersion !== judged.version) {
|
|
736
749
|
firings.push({
|
|
@@ -1192,7 +1205,7 @@ export function workflowDone(def, arts) {
|
|
|
1192
1205
|
return ![...arts.values()].some((a) => OUTSTANDING_STATES.has(a.acceptance) && !(a.acceptance === 'owed' && satisfiedAtLeastOneMembers.has(a.path)));
|
|
1193
1206
|
}
|
|
1194
1207
|
/** Derive the operator view purely from artifact state (§17) — never stored. */
|
|
1195
|
-
export function workflowStatus(def, arts) {
|
|
1208
|
+
export function workflowStatus(def, arts, opts = {}) {
|
|
1196
1209
|
const debts = [];
|
|
1197
1210
|
for (const a of arts.values()) {
|
|
1198
1211
|
if (!DEBT_STATES.has(a.acceptance))
|
|
@@ -1236,7 +1249,7 @@ export function workflowStatus(def, arts) {
|
|
|
1236
1249
|
debts.push(entry);
|
|
1237
1250
|
}
|
|
1238
1251
|
debts.sort((x, y) => x.path.localeCompare(y.path));
|
|
1239
|
-
const eligible = eligibleFirings(def, arts);
|
|
1252
|
+
const eligible = eligibleFirings(def, arts, undefined, { modifier: opts.modifier });
|
|
1240
1253
|
const eligibleSteps = new Set(eligible.map((f) => f.step));
|
|
1241
1254
|
const blocked = [];
|
|
1242
1255
|
for (const step of def.steps) {
|
|
@@ -1252,22 +1265,13 @@ export function workflowStatus(def, arts) {
|
|
|
1252
1265
|
for (const a of arts.values()) {
|
|
1253
1266
|
if (a.acceptance !== 'submitted')
|
|
1254
1267
|
continue;
|
|
1255
|
-
const judgeNames =
|
|
1268
|
+
const judgeNames = activeJudgesForStem(def, a.path, opts.modifier).map((judge) => judge.name);
|
|
1256
1269
|
const pendingJudges = judgeNames.filter((jn) => a.approvals?.[jn] !== a.version);
|
|
1257
1270
|
pending.push({ path: a.path, version: a.version, pendingJudges });
|
|
1258
1271
|
}
|
|
1259
1272
|
pending.sort((x, y) => x.path.localeCompare(y.path));
|
|
1260
1273
|
return { done: workflowDone(def, arts), debts, eligible, blocked, pending, inFlight: [] };
|
|
1261
1274
|
}
|
|
1262
|
-
/** The declared judge names for a produce stem (empty if the stem has no judges). */
|
|
1263
|
-
function declaredJudgeNames(def, stem) {
|
|
1264
|
-
for (const step of def.steps) {
|
|
1265
|
-
const p = step.produces.find((pp) => pp.stem === stem && pp.kind === 'singleton');
|
|
1266
|
-
if (p?.judges)
|
|
1267
|
-
return p.judges.map((j) => j.name);
|
|
1268
|
-
}
|
|
1269
|
-
return [];
|
|
1270
|
-
}
|
|
1271
1275
|
function stepOwesSomething(def, step, arts) {
|
|
1272
1276
|
const mode = stepMode(step);
|
|
1273
1277
|
if (mode === 'map') {
|
|
@@ -1996,7 +2000,7 @@ function seedArts(def, assumeProvided = false) {
|
|
|
1996
2000
|
return settleInMemory(def, arts);
|
|
1997
2001
|
}
|
|
1998
2002
|
/** Internal: the eligible outcomes for a given firing. */
|
|
1999
|
-
function eligibleOutcomes(def, arts, firing) {
|
|
2003
|
+
function eligibleOutcomes(def, arts, firing, opts = {}) {
|
|
2000
2004
|
if (firing.modelTransition === 'member-retract') {
|
|
2001
2005
|
return ['retract'];
|
|
2002
2006
|
}
|
|
@@ -2017,7 +2021,7 @@ function eligibleOutcomes(def, arts, firing) {
|
|
|
2017
2021
|
if (judgedArt?.acceptance === 'submitted') {
|
|
2018
2022
|
const jName = judgeNameOf(step);
|
|
2019
2023
|
const approvals = { ...(judgedArt.approvals ?? {}), [jName]: judgedArt.version };
|
|
2020
|
-
const judgeNames =
|
|
2024
|
+
const judgeNames = activeJudgesForStem(def, judgedStem, opts.modifier).map((judge) => judge.name);
|
|
2021
2025
|
const allApproved = judgeNames.every((jn) => approvals[jn] === judgedArt.version);
|
|
2022
2026
|
if (allApproved && groupWouldReject(def, arts, judgedStem)) {
|
|
2023
2027
|
return ['group-reject', 'judge-reject'];
|
|
@@ -2056,7 +2060,7 @@ function eligibleOutcomes(def, arts, firing) {
|
|
|
2056
2060
|
// checker explores the real refusal path rather than an impossible green.
|
|
2057
2061
|
// A judged produce's actual green-moment is judge-approve (handled above),
|
|
2058
2062
|
// so this only applies to a plain (non-judged) producer output.
|
|
2059
|
-
const hasJudges =
|
|
2063
|
+
const hasJudges = activeJudgesForStem(def, outPath, opts.modifier).length > 0;
|
|
2060
2064
|
if (!hasJudges && outPath && groupWouldReject(def, arts, outPath)) {
|
|
2061
2065
|
outcomes.push('group-reject');
|
|
2062
2066
|
}
|
|
@@ -2216,7 +2220,7 @@ export function applyOutcome(def, arts, firing, outcome, opts) {
|
|
|
2216
2220
|
}
|
|
2217
2221
|
else {
|
|
2218
2222
|
const approvals = { ...(art.approvals ?? {}), [jName]: art.version };
|
|
2219
|
-
const judgeNames =
|
|
2223
|
+
const judgeNames = activeJudgesForStem(def, outPath, opts.modifier).map((judge) => judge.name);
|
|
2220
2224
|
const allApproved = judgeNames.every((jn) => approvals[jn] === art.version);
|
|
2221
2225
|
if (allApproved) {
|
|
2222
2226
|
const producerStep = def.steps.find((l) => l.produces.some((p) => p.stem === outPath && p.kind !== 'map'));
|
|
@@ -2238,7 +2242,7 @@ export function applyOutcome(def, arts, firing, outcome, opts) {
|
|
|
2238
2242
|
}
|
|
2239
2243
|
if (outcome === 'green') {
|
|
2240
2244
|
const fp = computeFingerprint(arts, firing.inputs);
|
|
2241
|
-
const hasJudges =
|
|
2245
|
+
const hasJudges = activeJudgesForStem(def, outPath, opts.modifier).length > 0;
|
|
2242
2246
|
const updated = {
|
|
2243
2247
|
...art,
|
|
2244
2248
|
acceptance: hasJudges ? 'submitted' : 'green',
|
|
@@ -2400,7 +2404,7 @@ export function modelCheck(def, opts = {}) {
|
|
|
2400
2404
|
report.stats.statesExplored++;
|
|
2401
2405
|
if (node.depth > depthReached)
|
|
2402
2406
|
depthReached = node.depth;
|
|
2403
|
-
const status = workflowStatus(def, node.arts);
|
|
2407
|
+
const status = workflowStatus(def, node.arts, { modifier: opts.modifier });
|
|
2404
2408
|
// ---- invariant checking -------------------------------------------------
|
|
2405
2409
|
// A state violates an invariant iff eval(when ?? ALWAYS_TRUE) && !eval(requires).
|
|
2406
2410
|
// Checked BEFORE the `done` continue so terminal properties ("when done,
|
|
@@ -2469,7 +2473,7 @@ export function modelCheck(def, opts = {}) {
|
|
|
2469
2473
|
// EVENTUAL_TIME_FACTS is classification-only: the timeless BFS below does
|
|
2470
2474
|
// not enqueue these future idle transitions or include time in its key.
|
|
2471
2475
|
if (firings.length === 0 && !status.done) {
|
|
2472
|
-
const eventualFirings = eligibleFirings(def, node.arts, EVENTUAL_TIME_FACTS, { ignoreFreeze: true });
|
|
2476
|
+
const eventualFirings = eligibleFirings(def, node.arts, EVENTUAL_TIME_FACTS, { ignoreFreeze: true, modifier: opts.modifier });
|
|
2473
2477
|
if (eventualFirings.length > 0) {
|
|
2474
2478
|
report.stallStates.push({ path: node.path });
|
|
2475
2479
|
}
|
|
@@ -2501,7 +2505,7 @@ export function modelCheck(def, opts = {}) {
|
|
|
2501
2505
|
if (firing.modelTransition !== 'member-retract') {
|
|
2502
2506
|
firedSteps.add(firing.step);
|
|
2503
2507
|
}
|
|
2504
|
-
const outcomes = eligibleOutcomes(def, node.arts, firing);
|
|
2508
|
+
const outcomes = eligibleOutcomes(def, node.arts, firing, { modifier: opts.modifier });
|
|
2505
2509
|
for (const outcome of outcomes) {
|
|
2506
2510
|
// Check state count before expanding
|
|
2507
2511
|
if (visited.size >= maxStates) {
|
|
@@ -2511,7 +2515,7 @@ export function modelCheck(def, opts = {}) {
|
|
|
2511
2515
|
const step = { step: firing.step, key: firing.key, outcome };
|
|
2512
2516
|
if (outcome === 'emit-seal')
|
|
2513
2517
|
report.collectionCapApplied = true;
|
|
2514
|
-
const successors = applyOutcome(def, node.arts, firing, outcome, { maxCollectionSize });
|
|
2518
|
+
const successors = applyOutcome(def, node.arts, firing, outcome, { maxCollectionSize, modifier: opts.modifier });
|
|
2515
2519
|
for (const suc of successors) {
|
|
2516
2520
|
const key = canonicalKey(def, suc);
|
|
2517
2521
|
if (!visited.has(key)) {
|
|
@@ -2535,6 +2539,9 @@ export function modelCheck(def, opts = {}) {
|
|
|
2535
2539
|
// Compute the reachability fixpoint once, not per dead step.
|
|
2536
2540
|
const reachable = reachableStems(def);
|
|
2537
2541
|
for (const l of def.steps) {
|
|
2542
|
+
if (l.judges && !activeJudgesForStem(def, l.judges, opts.modifier).some((judge) => judge.name === judgeNameOf(l))) {
|
|
2543
|
+
continue;
|
|
2544
|
+
}
|
|
2538
2545
|
if (firedSteps.has(l.name))
|
|
2539
2546
|
continue;
|
|
2540
2547
|
if (canEverFire(l, def, reachable)) {
|
|
@@ -114,6 +114,7 @@ export function defInstructionDigest(def) {
|
|
|
114
114
|
...(s.callsInterface !== undefined ? { callsInterface: s.callsInterface } : {}),
|
|
115
115
|
...(s.callsInputs !== undefined ? { callsInputs: s.callsInputs } : {}),
|
|
116
116
|
...(s.judges !== undefined ? { judges: s.judges } : {}),
|
|
117
|
+
...(s.judgeModifiers !== undefined ? { judgeModifiers: s.judgeModifiers } : {}),
|
|
117
118
|
...(s.groups !== undefined ? { groups: s.groups } : {}),
|
|
118
119
|
...(s.x !== undefined ? { x: s.x } : {}),
|
|
119
120
|
body: s.body,
|
package/dist/src/types.d.ts
CHANGED
|
@@ -492,6 +492,9 @@ export interface ProducePattern {
|
|
|
492
492
|
* empty list is not accepted (it would reopen the def-silent hole
|
|
493
493
|
* deliberately, which no author means to do). */
|
|
494
494
|
capabilities?: string[];
|
|
495
|
+
/** Optional exact-match workflow-modifier scope. An omitted scope keeps
|
|
496
|
+
* this native judge unconditional. */
|
|
497
|
+
modifiers?: string[];
|
|
495
498
|
}>;
|
|
496
499
|
}
|
|
497
500
|
/**
|
|
@@ -648,6 +651,9 @@ export interface StepDef {
|
|
|
648
651
|
callsInputs?: Record<string, string>;
|
|
649
652
|
/** §24 judges: marker naming the produce stem this synthesized step judges. Mirrors `calls?`. */
|
|
650
653
|
judges?: string;
|
|
654
|
+
/** §24 internal carrier for a synthesized native judge's modifier scope.
|
|
655
|
+
* Ordinary steps are never conditional on modifiers. */
|
|
656
|
+
judgeModifiers?: string[];
|
|
651
657
|
/** §26: declarative exclusive produce-groups spanning two or more of this step's own produces. */
|
|
652
658
|
groups?: GroupDef[];
|
|
653
659
|
/** §27.3: opaque step-level extension map (`x:`). Validated as a plain map at
|
|
@@ -864,6 +870,8 @@ export interface CheckOptions {
|
|
|
864
870
|
* to false, restoring the seedOwed-starts-owed behavior described above.
|
|
865
871
|
*/
|
|
866
872
|
assumeProvided?: boolean;
|
|
873
|
+
/** Select the stored workflow modifier variant for this pure check. */
|
|
874
|
+
modifier?: string;
|
|
867
875
|
}
|
|
868
876
|
/** The structured report produced by modelCheck. */
|
|
869
877
|
export interface CheckReport {
|
package/docs/authoring.md
CHANGED
|
@@ -320,6 +320,15 @@ modifier through `OWENLOOP_FEEDBACK`/`OWENLOOP_FEEDBACK_FILE` and
|
|
|
320
320
|
steps](bundles.md#consumed-inputs-for-command-steps) for the reader snippet and
|
|
321
321
|
the omitted-key rule.
|
|
322
322
|
|
|
323
|
+
The result travels the same way. A command step's accepted artifact is its whole
|
|
324
|
+
`CommandReceipt`; to put a value of its own inside it — the thing a downstream
|
|
325
|
+
`from: payload.value` bind reads — the command either prints an
|
|
326
|
+
`##owenloop:payload##` marker line on stdout, capped at 64 KiB, or writes the
|
|
327
|
+
same JSON to the path in `OWENLOOP_PAYLOAD_FILE`, capped at 24 MB. A definition
|
|
328
|
+
whose command writes that file must declare the `command-payload-file.v1`
|
|
329
|
+
runtime feature. See [`docs/bundles.md` § Returning a payload from a command
|
|
330
|
+
step](bundles.md#returning-a-payload-from-a-command-step).
|
|
331
|
+
|
|
323
332
|
## `capabilities:` — logical capability tags
|
|
324
333
|
|
|
325
334
|
`capabilities:` is an optional list of strings on a step naming what that step
|
|
@@ -566,6 +575,27 @@ capability in the resulting judge list just as it does for an ordinary step
|
|
|
566
575
|
producer nor judge supplies capabilities, the judge remains capability-silent,
|
|
567
576
|
and there is nothing to compose.
|
|
568
577
|
|
|
578
|
+
### Modifier-scoped judges
|
|
579
|
+
|
|
580
|
+
Workflow `modifiers:` still controls routing for every step. A native judge
|
|
581
|
+
may additionally opt into an exact subset of that declared vocabulary with
|
|
582
|
+
`modifiers: [deep]` on the judge entry. Omitting the key is fully compatible:
|
|
583
|
+
that judge is active for every run. A scoped judge is active only when the
|
|
584
|
+
instance's stored modifier exactly matches one listed name; an instance with no
|
|
585
|
+
current modifier activates no scoped judge. Per-step escalation does not change
|
|
586
|
+
this decision.
|
|
587
|
+
|
|
588
|
+
Every scope name must be a declared top-level modifier; empty, duplicate,
|
|
589
|
+
whitespace-containing, `:`-containing, unknown, and unscoped-workflow lists
|
|
590
|
+
are definition errors. A mixed panel is allowed: its unscoped judges remain
|
|
591
|
+
required at every modifier while scoped judges join only on matching runs. An
|
|
592
|
+
inactive judge creates no order, pending approval, receipt, or completion debt,
|
|
593
|
+
but an active judge keeps normal capability composition (for example
|
|
594
|
+
`review-rigor:deep`). If the workflow binds its modifier from an artifact,
|
|
595
|
+
every producer with a scoped judge must consume a path strictly downstream of
|
|
596
|
+
that binding artifact; a sibling output on the binder cannot safely use a
|
|
597
|
+
scoped judge because it could commit before the binding settles.
|
|
598
|
+
|
|
569
599
|
Author `x:` on the producer step, not on individual judge entries. Every native
|
|
570
600
|
judge synthesized from that producer inherits the producer's complete parsed
|
|
571
601
|
`x:` map. Each judge receives an independent deep clone, so runner-side
|
|
@@ -581,7 +611,7 @@ through the normal pipeline, with its own throttles (`cadence:`,
|
|
|
581
611
|
`report`, it lands `submitted` (not `green`) instead — schema-valid, but
|
|
582
612
|
waiting on sign-off. Each judge evaluates it and calls the *same*
|
|
583
613
|
`green`/`reject` verbs you already use, targeted at `report` — no new CLI
|
|
584
|
-
surface. Once every
|
|
614
|
+
surface. Once every active judge has approved the current version, `report`
|
|
585
615
|
goes `green`. A single reject sends it straight to `rejected` and re-arms
|
|
586
616
|
`researcher`; a rebuild starts every judge's ledger fresh, so a sibling
|
|
587
617
|
judge's earlier approval never carries over to a new version.
|
package/docs/bundles.md
CHANGED
|
@@ -107,6 +107,8 @@ This Owenloop release advertises exactly these feature identifiers:
|
|
|
107
107
|
|
|
108
108
|
- `harness-policy-enforcement.v1`
|
|
109
109
|
- `native-judge-policy-inheritance.v1`
|
|
110
|
+
- `neutral-approval-modes.v1`
|
|
111
|
+
- `command-payload-file.v1`
|
|
110
112
|
|
|
111
113
|
The running version comes from Owenloop's production `packageVersion()` source. A production build that cannot read a valid package version uses the `0.0.0` sentinel. The sentinel fails every declared `minVersion`, including `minVersion: "0.0.0"`, and the refusal tells the operator to install or upgrade Owenloop. The sentinel may still satisfy a feature-only declaration because feature support is evaluated independently.
|
|
112
114
|
|
|
@@ -298,6 +300,70 @@ run; only an accepted artifact with a declared bind can do that.
|
|
|
298
300
|
An agent prompt can read the same value as `${MODIFIER}`. Unknown placeholders
|
|
299
301
|
remain unchanged; when an order has no modifier, `${MODIFIER}` remains literal.
|
|
300
302
|
|
|
303
|
+
## Returning a payload from a command step
|
|
304
|
+
|
|
305
|
+
A command step's accepted artifact is its whole `CommandReceipt`. To put a value
|
|
306
|
+
of its own inside that receipt — the thing a downstream `from: payload.value`
|
|
307
|
+
bind reads — a command has two ways to say it, and it must pick exactly one.
|
|
308
|
+
|
|
309
|
+
| Transport | How | Ceiling |
|
|
310
|
+
| --- | --- | --- |
|
|
311
|
+
| stdout marker | print one line beginning `##owenloop:payload## ` followed by JSON | 64 KiB of JSON text (`PAYLOAD_MAX_BYTES`) |
|
|
312
|
+
| payload file | write JSON to the path in `OWENLOOP_PAYLOAD_FILE` | 24 MB (`PAYLOAD_FILE_MAX_BYTES`) |
|
|
313
|
+
|
|
314
|
+
The marker is the older channel and is unchanged. The file exists because the
|
|
315
|
+
marker's ceiling is a *transport* limit on a single stdout line, while the hub
|
|
316
|
+
has always stored an artifact above 64 KiB in object storage up to its own
|
|
317
|
+
25 MB cap. A result between those two numbers had nowhere to go: the runner
|
|
318
|
+
dropped the marker line and the step submitted a receipt with no payload.
|
|
319
|
+
|
|
320
|
+
`OWENLOOP_PAYLOAD_FILE` is set on **every** command spawn, not only when a
|
|
321
|
+
result is expected to be large, and it is always resolved rather than inherited
|
|
322
|
+
— a shift launched from inside another command step already carries its parent
|
|
323
|
+
order's value, and reading it would attribute one step's result to another. The
|
|
324
|
+
runner creates the private `0700` directory but **not** the file; the command
|
|
325
|
+
creates it, or leaves it absent.
|
|
326
|
+
|
|
327
|
+
```sh
|
|
328
|
+
# Either of these is a complete producer.
|
|
329
|
+
echo "##owenloop:payload## $(jq -nc '{value:"deep"}')"
|
|
330
|
+
jq -nc '{value:"deep"}' > "$OWENLOOP_PAYLOAD_FILE"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Rules a script can rely on:
|
|
334
|
+
|
|
335
|
+
- **Absent or empty means no payload.** A path that was never written, an empty
|
|
336
|
+
file, and a file holding only whitespace are all read as "this command
|
|
337
|
+
returned nothing", not as an error. That is what lets every existing
|
|
338
|
+
marker-only command keep working with the variable set.
|
|
339
|
+
- **Using both transports is refused by name.** If the file holds anything and a
|
|
340
|
+
marker line was also printed, neither is published: the receipt carries a
|
|
341
|
+
`payloadError` naming the conflict and both byte counts, and no `payload`.
|
|
342
|
+
Two statements of the result are a bug in the command, and picking one of them
|
|
343
|
+
would publish a value the author did not choose.
|
|
344
|
+
- **The reject directive works identically through either transport.** A payload
|
|
345
|
+
of the shape `{"reject":{"path":"...","text":"..."}}` sends the worker's
|
|
346
|
+
reject, from the file exactly as from the marker.
|
|
347
|
+
- **Over the cap is an error, not a truncation.** The size is taken from the
|
|
348
|
+
open descriptor before any bytes are read; over-cap produces a `payloadError`
|
|
349
|
+
naming the size and the cap, and no `payload`.
|
|
350
|
+
- **Anything that is not a regular file is an error.** A directory, a symbolic
|
|
351
|
+
link, or a device at that path produces a `payloadError` rather than being
|
|
352
|
+
read through. Only ENOENT is the ordinary absence.
|
|
353
|
+
- **The file lives only as long as the command.** It is in a private temp
|
|
354
|
+
directory that owenloop removes after the command exits, including when the
|
|
355
|
+
command is killed because the lease was lost. Write it during the run; do not
|
|
356
|
+
stash the path.
|
|
357
|
+
|
|
358
|
+
A definition whose command writes that file **must** declare the
|
|
359
|
+
`command-payload-file.v1` runtime feature. On a CLI that predates it the
|
|
360
|
+
variable is simply unset, and the natural defensive spelling
|
|
361
|
+
`> "${OWENLOOP_PAYLOAD_FILE:-/dev/null}"` then exits zero having written the
|
|
362
|
+
result to `/dev/null`. Nothing reports an error; the first sign of trouble is a
|
|
363
|
+
downstream bind failing at the hub, one step away from the cause. The feature
|
|
364
|
+
declaration moves that diagnosis to the bundle compatibility check, before any
|
|
365
|
+
order is offered.
|
|
366
|
+
|
|
301
367
|
## Working directory for command steps
|
|
302
368
|
|
|
303
369
|
An order carries a `workdir` when its step declared `workdir:` or
|
package/docs/cli.md
CHANGED
|
@@ -739,8 +739,12 @@ be parsed or the resolved value was invalid.
|
|
|
739
739
|
|
|
740
740
|
The helper prints the selected word as ordinary stdout. A command artifact is
|
|
741
741
|
submitted as the full `CommandReceipt`; if a workflow binds a field inside a
|
|
742
|
-
command payload, the command must
|
|
743
|
-
the
|
|
742
|
+
command payload, the command must return that payload and the bind must name
|
|
743
|
+
the field (for example, `from: payload.value`). A command returns a payload
|
|
744
|
+
either by printing an `##owenloop:payload##` JSON marker line, capped at 64 KiB,
|
|
745
|
+
or by writing the JSON to the path in `OWENLOOP_PAYLOAD_FILE`, capped at 24 MB.
|
|
746
|
+
Doing both is refused by name rather than resolved by precedence. See
|
|
747
|
+
[Returning a payload from a command step](bundles.md#returning-a-payload-from-a-command-step).
|
|
744
748
|
|
|
745
749
|
### `work agent-run` — the only Step Agent dispatcher
|
|
746
750
|
|