owenloop 0.5.24 → 0.5.25
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 +7 -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 +22 -1
- package/docs/design.md +27 -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,13 @@ 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.25](https://github.com/typicalday/owenloop/compare/v0.5.24...v0.5.25) (2026-08-23)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **engine:** scope native judges to workflow modifiers ([#295](https://github.com/typicalday/owenloop/issues/295)) ([d1cb9d5](https://github.com/typicalday/owenloop/commit/d1cb9d5f711b7ea5ed545202a0d2e37189ba1d06))
|
|
13
|
+
|
|
7
14
|
## [0.5.24](https://github.com/typicalday/owenloop/compare/v0.5.23...v0.5.24) (2026-08-23)
|
|
8
15
|
|
|
9
16
|
|
package/dist/src/defs.js
CHANGED
|
@@ -39,7 +39,7 @@ const RAW_PRODUCE_KEYS = ['name', 'schema', 'judges', 'maxAttempts', 'maxSchemaF
|
|
|
39
39
|
* fields, so it gets its own allowlist rather than folding into
|
|
40
40
|
* RAW_PRODUCE_KEYS (§27 unknown-key rejection). */
|
|
41
41
|
const RAW_GROUP_KEYS = ['group', 'mode', 'of'];
|
|
42
|
-
const RAW_JUDGE_KEYS = ['name', 'body', 'bodyFile', 'model', 'inputs', 'cadence', 'maxRunsPerDay', 'executor', 'command', 'spec', 'capabilities'];
|
|
42
|
+
const RAW_JUDGE_KEYS = ['name', 'body', 'bodyFile', 'model', 'inputs', 'cadence', 'maxRunsPerDay', 'executor', 'command', 'spec', 'capabilities', 'modifiers'];
|
|
43
43
|
/** Keys valid on a normal (non-calls:, non-include:) step entry. */
|
|
44
44
|
const RAW_STEP_KEYS = [
|
|
45
45
|
'name', 'consumes', 'produces', 'generates', 'invalidates', 'cadence',
|
|
@@ -371,6 +371,10 @@ function parseJudges(v, ctx, baseDir) {
|
|
|
371
371
|
assertAuthoredCapability(cap, `judge '${name}'.capabilities`);
|
|
372
372
|
judge.capabilities = caps;
|
|
373
373
|
}
|
|
374
|
+
if (raw.modifiers !== undefined) {
|
|
375
|
+
// Keep the raw YAML object isolated from the compiled definition.
|
|
376
|
+
judge.modifiers = [...parseModifiers(raw.modifiers, `judge '${name}'.modifiers`)];
|
|
377
|
+
}
|
|
374
378
|
return judge;
|
|
375
379
|
});
|
|
376
380
|
}
|
|
@@ -791,7 +795,16 @@ function prefixStep(step, prefix, defInputs = []) {
|
|
|
791
795
|
// map
|
|
792
796
|
raw = `${stem}[$${p.binder}]${p.suffix}`;
|
|
793
797
|
}
|
|
794
|
-
|
|
798
|
+
const result = { ...p, stem, raw };
|
|
799
|
+
// Includes are independent materializations. Judge declarations carry
|
|
800
|
+
// optional scope arrays, which must not alias between child/aliases.
|
|
801
|
+
if (p.judges !== undefined) {
|
|
802
|
+
result.judges = p.judges.map((judge) => ({
|
|
803
|
+
...judge,
|
|
804
|
+
...(judge.modifiers !== undefined ? { modifiers: [...judge.modifiers] } : {}),
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
795
808
|
};
|
|
796
809
|
const newProduces = step.produces.map(prefixProduce);
|
|
797
810
|
const newGenerates = step.generates ? step.generates.map(prefixProduce) : undefined;
|
|
@@ -836,6 +849,8 @@ function prefixStep(step, prefix, defInputs = []) {
|
|
|
836
849
|
result.effect = newEffect;
|
|
837
850
|
if (newJudges !== undefined)
|
|
838
851
|
result.judges = newJudges;
|
|
852
|
+
if (step.judgeModifiers !== undefined)
|
|
853
|
+
result.judgeModifiers = [...step.judgeModifiers];
|
|
839
854
|
if (newOnCancel !== undefined)
|
|
840
855
|
result.onCancel = newOnCancel;
|
|
841
856
|
if (newWorkdirFrom !== undefined)
|
|
@@ -1040,6 +1055,8 @@ function synthesizeJudgeSteps(producerStepName, pat, producerConsumeStems, produ
|
|
|
1040
1055
|
step.command = j.command;
|
|
1041
1056
|
if (j.spec !== undefined)
|
|
1042
1057
|
step.spec = j.spec;
|
|
1058
|
+
if (j.modifiers !== undefined)
|
|
1059
|
+
step.judgeModifiers = [...j.modifiers];
|
|
1043
1060
|
return step;
|
|
1044
1061
|
});
|
|
1045
1062
|
}
|
|
@@ -1580,6 +1597,34 @@ export function validateDef(def) {
|
|
|
1580
1597
|
if (!l.consumes.some((c) => c.mode === 'plain' && c.stem === judgedStem)) {
|
|
1581
1598
|
errors.push(`judge step '${l.name}' does not consume its judged stem '${judgedStem}'`);
|
|
1582
1599
|
}
|
|
1600
|
+
// A direct/in-memory WorkflowDef can bypass parse+synthesis, so keep the
|
|
1601
|
+
// compiled carrier fail-closed: it must exactly mirror the authored judge
|
|
1602
|
+
// declaration it represents (including true absence for unconditional).
|
|
1603
|
+
const marker = '.judges.';
|
|
1604
|
+
const markerIndex = l.name.lastIndexOf(marker);
|
|
1605
|
+
const judgeName = markerIndex === -1 ? l.name : l.name.slice(markerIndex + marker.length);
|
|
1606
|
+
const owner = def.steps
|
|
1607
|
+
.flatMap((candidate) => candidate.produces)
|
|
1608
|
+
.find((produce) => produce.kind === 'singleton' && produce.stem === judgedStem);
|
|
1609
|
+
const authored = owner?.judges?.find((judge) => judge.name === judgeName);
|
|
1610
|
+
if (authored === undefined) {
|
|
1611
|
+
errors.push(`judge step '${l.name}' has no matching judge declaration on produce '${judgedStem}'`);
|
|
1612
|
+
}
|
|
1613
|
+
else {
|
|
1614
|
+
const expected = authored.modifiers;
|
|
1615
|
+
const actual = l.judgeModifiers;
|
|
1616
|
+
const sameScope = expected === undefined
|
|
1617
|
+
? actual === undefined
|
|
1618
|
+
: actual !== undefined && expected.length === actual.length && expected.every((value, i) => value === actual[i]);
|
|
1619
|
+
if (!sameScope) {
|
|
1620
|
+
errors.push(`judge step '${l.name}' judgeModifiers must match the scope declared for judge '${judgeName}' on '${judgedStem}'`);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
for (const l of def.steps) {
|
|
1625
|
+
if (l.judges === undefined && l.judgeModifiers !== undefined) {
|
|
1626
|
+
errors.push(`step '${l.name}' sets judgeModifiers but is not a synthesized judge step`);
|
|
1627
|
+
}
|
|
1583
1628
|
}
|
|
1584
1629
|
// G25-VALIDATE: declarative exclusive produce-groups per-def rules.
|
|
1585
1630
|
for (const l of def.steps) {
|
|
@@ -1642,6 +1687,36 @@ export function validateDef(def) {
|
|
|
1642
1687
|
// "defs without `modifiers:` run exactly as today". Opting into the
|
|
1643
1688
|
// new routing vocabulary is what turns the stricter rule on.
|
|
1644
1689
|
const declaredModifiers = new Set(def.modifiers ?? []);
|
|
1690
|
+
// J24 modifier scopes are authored only on judge declarations. Validate the
|
|
1691
|
+
// vocabulary here, where the complete definition is available, rather than
|
|
1692
|
+
// letting an unknown scope silently make a gate disappear at runtime.
|
|
1693
|
+
for (const step of def.steps) {
|
|
1694
|
+
for (const produce of step.produces) {
|
|
1695
|
+
for (const judge of produce.judges ?? []) {
|
|
1696
|
+
if (judge.modifiers === undefined)
|
|
1697
|
+
continue;
|
|
1698
|
+
if (judge.modifiers.length === 0) {
|
|
1699
|
+
errors.push(`judge '${judge.name}' on produce '${produce.stem}' has an empty modifiers list`);
|
|
1700
|
+
}
|
|
1701
|
+
const seen = new Set();
|
|
1702
|
+
for (const modifier of judge.modifiers) {
|
|
1703
|
+
if (modifier.trim().length === 0 || /\s/.test(modifier) || modifier.includes(MODIFIER_SEPARATOR)) {
|
|
1704
|
+
errors.push(`judge '${judge.name}' on produce '${produce.stem}' has malformed modifier '${modifier}'`);
|
|
1705
|
+
}
|
|
1706
|
+
if (seen.has(modifier)) {
|
|
1707
|
+
errors.push(`judge '${judge.name}' on produce '${produce.stem}' lists modifier '${modifier}' more than once`);
|
|
1708
|
+
}
|
|
1709
|
+
seen.add(modifier);
|
|
1710
|
+
if (declaredModifiers.size === 0) {
|
|
1711
|
+
errors.push(`judge '${judge.name}' on produce '${produce.stem}' scopes modifiers but workflow '${def.name}' declares no modifiers:`);
|
|
1712
|
+
}
|
|
1713
|
+
else if (!declaredModifiers.has(modifier)) {
|
|
1714
|
+
errors.push(`judge '${judge.name}' on produce '${produce.stem}' modifier '${modifier}' is not in workflow '${def.name}'.modifiers (${[...declaredModifiers].join(', ')})`);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1645
1720
|
const modifierBinds = [];
|
|
1646
1721
|
for (const l of def.steps) {
|
|
1647
1722
|
for (const p of l.produces) {
|
|
@@ -1669,6 +1744,15 @@ export function validateDef(def) {
|
|
|
1669
1744
|
if (modifierBinds.length > 1) {
|
|
1670
1745
|
errors.push(`workflow '${def.name}' binds modifier more than once: ${modifierBinds.map((b) => `'${b.step}.${b.artifact}'`).join(', ')}`);
|
|
1671
1746
|
}
|
|
1747
|
+
if (modifierBinds.length === 1) {
|
|
1748
|
+
const { boundArtifact, downstream } = modifierBoundDownstreamSteps(def);
|
|
1749
|
+
for (const step of def.steps) {
|
|
1750
|
+
const hasScopedJudge = step.produces.some((produce) => produce.judges?.some((judge) => judge.modifiers !== undefined));
|
|
1751
|
+
if (hasScopedJudge && !downstream.has(step.name)) {
|
|
1752
|
+
errors.push(`step '${step.name}' produces modifier-scoped judges but is not strictly downstream of artifact '${boundArtifact?.raw ?? modifierBinds[0].artifact}' bound to modifier`);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1672
1756
|
for (const l of def.steps) {
|
|
1673
1757
|
if (l.escalation === undefined)
|
|
1674
1758
|
continue;
|
|
@@ -1922,8 +2006,14 @@ function consumesProducedPattern(consume, produce) {
|
|
|
1922
2006
|
}
|
|
1923
2007
|
return consume.mode !== 'plain' && consume.suffix === produce.suffix;
|
|
1924
2008
|
}
|
|
1925
|
-
/**
|
|
1926
|
-
|
|
2009
|
+
/**
|
|
2010
|
+
* Find the one modifier-binding artifact (when present) and every step that
|
|
2011
|
+
* is strictly downstream of it. The binding step itself is deliberately not
|
|
2012
|
+
* in the result: a sibling output could otherwise commit before the bind.
|
|
2013
|
+
*
|
|
2014
|
+
* This preserves the exact map-suffix matching used by the routing lint.
|
|
2015
|
+
*/
|
|
2016
|
+
function modifierBoundDownstreamSteps(def) {
|
|
1927
2017
|
let bindingStep;
|
|
1928
2018
|
let boundArtifact;
|
|
1929
2019
|
for (const step of def.steps) {
|
|
@@ -1935,29 +2025,34 @@ function unroutedCapabilityWarnings(def) {
|
|
|
1935
2025
|
}
|
|
1936
2026
|
}
|
|
1937
2027
|
if (bindingStep === undefined || boundArtifact === undefined)
|
|
1938
|
-
return
|
|
1939
|
-
|
|
1940
|
-
// exempt, but its unbound sibling outputs must not make a branch downstream.
|
|
1941
|
-
const reachedSteps = new Set([bindingStep.name]);
|
|
2028
|
+
return { downstream: new Set() };
|
|
2029
|
+
const downstream = new Set();
|
|
1942
2030
|
const reachedArtifacts = [boundArtifact];
|
|
1943
2031
|
let changed = true;
|
|
1944
2032
|
while (changed) {
|
|
1945
2033
|
changed = false;
|
|
1946
2034
|
for (const step of def.steps) {
|
|
1947
|
-
if (
|
|
2035
|
+
if (step.name === bindingStep.name || downstream.has(step.name))
|
|
1948
2036
|
continue;
|
|
1949
2037
|
if (!step.consumes.some((consume) => reachedArtifacts.some((produce) => consumesProducedPattern(consume, produce))))
|
|
1950
2038
|
continue;
|
|
1951
|
-
|
|
2039
|
+
downstream.add(step.name);
|
|
1952
2040
|
reachedArtifacts.push(...step.produces);
|
|
1953
2041
|
changed = true;
|
|
1954
2042
|
}
|
|
1955
2043
|
}
|
|
2044
|
+
return { bindingStep, boundArtifact, downstream };
|
|
2045
|
+
}
|
|
2046
|
+
/** Warn when routed work can run before the artifact that writes the modifier. */
|
|
2047
|
+
function unroutedCapabilityWarnings(def) {
|
|
2048
|
+
const { bindingStep, boundArtifact, downstream } = modifierBoundDownstreamSteps(def);
|
|
2049
|
+
if (bindingStep === undefined || boundArtifact === undefined)
|
|
2050
|
+
return [];
|
|
1956
2051
|
const warnings = [];
|
|
1957
2052
|
for (const step of def.steps) {
|
|
1958
2053
|
if (step.capabilities === undefined || step.capabilities.length === 0)
|
|
1959
2054
|
continue;
|
|
1960
|
-
if (
|
|
2055
|
+
if (step.name === bindingStep.name || downstream.has(step.name))
|
|
1961
2056
|
continue;
|
|
1962
2057
|
warnings.push(`step '${step.name}' declares capabilities (${step.capabilities.join(', ')}) but is not downstream of artifact '${boundArtifact.raw}' bound to modifier`);
|
|
1963
2058
|
}
|
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
|
@@ -566,6 +566,27 @@ capability in the resulting judge list just as it does for an ordinary step
|
|
|
566
566
|
producer nor judge supplies capabilities, the judge remains capability-silent,
|
|
567
567
|
and there is nothing to compose.
|
|
568
568
|
|
|
569
|
+
### Modifier-scoped judges
|
|
570
|
+
|
|
571
|
+
Workflow `modifiers:` still controls routing for every step. A native judge
|
|
572
|
+
may additionally opt into an exact subset of that declared vocabulary with
|
|
573
|
+
`modifiers: [deep]` on the judge entry. Omitting the key is fully compatible:
|
|
574
|
+
that judge is active for every run. A scoped judge is active only when the
|
|
575
|
+
instance's stored modifier exactly matches one listed name; an instance with no
|
|
576
|
+
current modifier activates no scoped judge. Per-step escalation does not change
|
|
577
|
+
this decision.
|
|
578
|
+
|
|
579
|
+
Every scope name must be a declared top-level modifier; empty, duplicate,
|
|
580
|
+
whitespace-containing, `:`-containing, unknown, and unscoped-workflow lists
|
|
581
|
+
are definition errors. A mixed panel is allowed: its unscoped judges remain
|
|
582
|
+
required at every modifier while scoped judges join only on matching runs. An
|
|
583
|
+
inactive judge creates no order, pending approval, receipt, or completion debt,
|
|
584
|
+
but an active judge keeps normal capability composition (for example
|
|
585
|
+
`review-rigor:deep`). If the workflow binds its modifier from an artifact,
|
|
586
|
+
every producer with a scoped judge must consume a path strictly downstream of
|
|
587
|
+
that binding artifact; a sibling output on the binder cannot safely use a
|
|
588
|
+
scoped judge because it could commit before the binding settles.
|
|
589
|
+
|
|
569
590
|
Author `x:` on the producer step, not on individual judge entries. Every native
|
|
570
591
|
judge synthesized from that producer inherits the producer's complete parsed
|
|
571
592
|
`x:` map. Each judge receives an independent deep clone, so runner-side
|
|
@@ -581,7 +602,7 @@ through the normal pipeline, with its own throttles (`cadence:`,
|
|
|
581
602
|
`report`, it lands `submitted` (not `green`) instead — schema-valid, but
|
|
582
603
|
waiting on sign-off. Each judge evaluates it and calls the *same*
|
|
583
604
|
`green`/`reject` verbs you already use, targeted at `report` — no new CLI
|
|
584
|
-
surface. Once every
|
|
605
|
+
surface. Once every active judge has approved the current version, `report`
|
|
585
606
|
goes `green`. A single reject sends it straight to `rejected` and re-arms
|
|
586
607
|
`researcher`; a rebuild starts every judge's ledger fresh, so a sibling
|
|
587
608
|
judge's earlier approval never carries over to a new version.
|
package/docs/design.md
CHANGED
|
@@ -724,7 +724,7 @@ this version yet.
|
|
|
724
724
|
- **Reads as OUTSTANDING for completion** — `OUTSTANDING_STATES = DEBT_STATES
|
|
725
725
|
∪ { submitted }` (§5). A workflow is not `done` while any artifact sits in
|
|
726
726
|
`submitted`, even though the producer itself has no further debt.
|
|
727
|
-
- Artifacts whose `produces` entry declares no `judges:` never enter
|
|
727
|
+
- Artifacts whose `produces` entry declares no active `judges:` never enter
|
|
728
728
|
`submitted` — a plain commit lands `green` exactly as before. This is fully
|
|
729
729
|
backward compatible: no judges declared, zero behavior change.
|
|
730
730
|
|
|
@@ -744,6 +744,8 @@ named `${producerStep}.${producedStem}.judges.${judgeName}`. Each judge step:
|
|
|
744
744
|
- `judges: <judgedStem>` — the marker field that makes it a judge (mirrors
|
|
745
745
|
`calls:`'s marker-field pattern), read by both layers:
|
|
746
746
|
`eligibleFirings`/`applyOutcome` (model.ts) and `green()` (engine.ts).
|
|
747
|
+
- `judgeModifiers?: string[]` — the internal compiled carrier for the
|
|
748
|
+
authored judge's optional scope; it is not a general conditional-step key.
|
|
747
749
|
- The producer step's complete parsed `x:` extension carrier is deep-cloned
|
|
748
750
|
onto every synthesized judge. Judge entries do not author their own `x:`;
|
|
749
751
|
inheritance happens after the producer has been fully parsed. Every judge
|
|
@@ -773,7 +775,7 @@ sign-off ledger, present only while relevant (`undefined` once an artifact is
|
|
|
773
775
|
`green`/`rejected` cleanly, cleared on every reject/retry/fresh-submit).
|
|
774
776
|
|
|
775
777
|
- **Judge approve**: `approvals[judgeName] = artifact.version`. If every
|
|
776
|
-
|
|
778
|
+
active judge name now maps to the artifact's *current* version, the
|
|
777
779
|
artifact transitions `submitted → green`. Otherwise it stays `submitted`
|
|
778
780
|
with a partial ledger.
|
|
779
781
|
- **Judge reject**: any single reject wins immediately —
|
|
@@ -913,6 +915,7 @@ steps:
|
|
|
913
915
|
model: strong # optional, per-judge model
|
|
914
916
|
inputs: true # optional, default false — judge also
|
|
915
917
|
# reads the producer's inputs (question)
|
|
918
|
+
modifiers: [deep] # optional exact workflow-modifier scope
|
|
916
919
|
maxAttempts: 8 # optional, §6 — overrides the step default below
|
|
917
920
|
# just for `report`; absent caps still inherit
|
|
918
921
|
maxAttempts: 5 # producer's cap (default for every produce on this step)
|
|
@@ -933,6 +936,22 @@ steps:
|
|
|
933
936
|
inputs, for criteria that need "what was asked for" as context.
|
|
934
937
|
- `cadence:` / `maxRunsPerDay:` — optional throttles, same meaning as on
|
|
935
938
|
steps; firing is event-driven (on submit), the throttles just cap the rate.
|
|
939
|
+
- `modifiers:` — optional non-empty set of exact workflow modifier names. The
|
|
940
|
+
names must be declared in the workflow's top-level `modifiers:` vocabulary.
|
|
941
|
+
Unscoped judges stay unconditional; a scoped judge is inactive without a
|
|
942
|
+
matching stored instance modifier. `activeJudgesForStem(def, stem, modifier)`
|
|
943
|
+
is the shared derivation used by eligibility, pending status, producer and
|
|
944
|
+
verdict commits, rejection, groups, terminal timing, and model checking.
|
|
945
|
+
Inactive judges create no order, approval ledger slot, routing receipt, or
|
|
946
|
+
completion debt.
|
|
947
|
+
|
|
948
|
+
When a definition binds `modifier` from a produced artifact, scoped-judge
|
|
949
|
+
producers must be strictly downstream of that artifact under the same exact
|
|
950
|
+
consume/produce matching used by routing lint. This rules out the binder itself
|
|
951
|
+
and sibling branches, which might commit before the stored modifier is known.
|
|
952
|
+
Definitions with no modifier bind remain valid: their instance modifier is
|
|
953
|
+
chosen at create time (or absent), and active judge orders retain ordinary
|
|
954
|
+
capability composition.
|
|
936
955
|
|
|
937
956
|
See `examples/workflows/judged-research.yaml` for a runnable end-to-end
|
|
938
957
|
example (mirrors this shape exactly, plus `examples/workflows/judges/rigor.md`
|
|
@@ -1147,6 +1166,12 @@ at `create` time. `CheckOptions.assumeProvided` (library level, when calling
|
|
|
1147
1166
|
library default is unchanged by the CLI change below, and is what the
|
|
1148
1167
|
`modelCheck` unit tests calling it directly still rely on.
|
|
1149
1168
|
|
|
1169
|
+
`CheckOptions.modifier` selects one concrete stored-modifier variant for the
|
|
1170
|
+
pure checker. Call `modelCheck(def, { modifier: 'deep', assumeProvided: true })`
|
|
1171
|
+
for each declared variant; inactive synthesized judge steps are omitted from
|
|
1172
|
+
that variant's dead/unreached accounting, while active judges are checked
|
|
1173
|
+
normally.
|
|
1174
|
+
|
|
1150
1175
|
`owenloop check` (the CLI command), however, now defaults to
|
|
1151
1176
|
`assumeProvided: true` — seedOwed inputs are seeded green by default,
|
|
1152
1177
|
modeling "the operator already ran `provide` at `create`." This dissolves
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owenloop",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "Deterministic rails for agentic workflows. Declare steps and dependencies; the engine guarantees order, redoes what changes invalidate, and stops what keeps failing — instead of hoping the agent follows through.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "typicalday",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owenloop",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "Claude Code driver for owenloop — cross-harness shift and conduct skills driven by the owenloop CLI, plus one hub control-plane MCP server backing an author skill and a fallback worker, for conducting and authoring workflows against your hosted owenloop server.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Typical Day"
|