owenloop 0.5.9 → 0.5.10
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 +44 -0
- package/README.md +77 -37
- package/bin/owenloop.mjs +16 -1
- package/dist/packages/work/src/agent/loop.js +7 -0
- package/dist/packages/work/src/bundle/pull.d.ts +21 -0
- package/dist/packages/work/src/bundle/pull.js +118 -0
- package/dist/packages/work/src/exec/instructions.d.ts +4 -1
- package/dist/packages/work/src/exec/instructions.js +3 -0
- package/dist/packages/work/src/exec/loop.d.ts +1 -1
- package/dist/packages/work/src/exec/loop.js +92 -14
- package/dist/packages/work/src/harness/claude.js +16 -0
- package/dist/packages/work/src/harness/codex.d.ts +8 -0
- package/dist/packages/work/src/harness/codex.js +27 -1
- package/dist/packages/work/src/harness/contract.d.ts +9 -0
- package/dist/packages/work/src/roles/agent-run.js +38 -10
- package/dist/packages/work/src/roles/exec.js +25 -8
- package/dist/packages/work/src/shift/loop.js +118 -4
- package/dist/packages/work/src/shift/runtime.d.ts +3 -0
- package/dist/packages/work/src/shift/runtime.js +10 -1
- package/dist/packages/work/src/submit-proof.d.ts +11 -8
- package/dist/packages/work/src/submit-proof.js +11 -8
- package/dist/src/capabilities.d.ts +70 -6
- package/dist/src/capabilities.js +49 -6
- package/dist/src/capability-mapping-client.d.ts +29 -0
- package/dist/src/capability-mapping-client.js +160 -0
- package/dist/src/cli.d.ts +2 -2
- package/dist/src/cli.js +1196 -164
- package/dist/src/defs.d.ts +32 -1
- package/dist/src/defs.js +391 -79
- package/dist/src/engine.d.ts +62 -19
- package/dist/src/engine.js +180 -70
- package/dist/src/hub.d.ts +77 -0
- package/dist/src/hub.js +162 -0
- package/dist/src/implements.d.ts +56 -0
- package/dist/src/implements.js +790 -0
- package/dist/src/index.d.ts +8 -6
- package/dist/src/index.js +4 -3
- package/dist/src/mcp/serve.js +254 -45
- package/dist/src/mcp/server.d.ts +10 -7
- package/dist/src/mcp/server.js +53 -8
- package/dist/src/model.d.ts +46 -10
- package/dist/src/model.js +220 -74
- package/dist/src/store/def-source.d.ts +19 -0
- package/dist/src/store/def-source.js +87 -17
- package/dist/src/store/gc-recovery.d.ts +46 -0
- package/dist/src/store/gc-recovery.js +258 -0
- package/dist/src/store/gc.d.ts +94 -0
- package/dist/src/store/gc.js +562 -0
- package/dist/src/store/index.d.ts +3 -1
- package/dist/src/store/index.js +2 -0
- package/dist/src/store/install.d.ts +34 -5
- package/dist/src/store/install.js +73 -11
- package/dist/src/store/pre-commit-verifier.js +42 -2
- package/dist/src/store/snapshot-guard.d.ts +18 -0
- package/dist/src/store/snapshot-guard.js +94 -0
- package/dist/src/store.d.ts +64 -4
- package/dist/src/store.js +211 -8
- package/dist/src/types.d.ts +61 -17
- package/dist/src/util.js +4 -1
- package/docs/authoring.md +145 -8
- package/docs/bundles.md +19 -0
- package/docs/cli.md +270 -30
- package/docs/crypto.md +13 -7
- package/docs/design.md +107 -46
- package/docs/evals/mcp-charter-baseline.json +428 -0
- package/docs/mcp-charter-eval.md +124 -0
- package/docs/shift-logs.md +18 -0
- package/docs/wire-contracts.md +28 -7
- package/examples/workflows/compile-dev-playbook.yaml +1 -1
- package/examples/workflows/ship.yaml +28 -2
- package/package.json +2 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/claude-code/plugin/skills/author/SKILL.md +22 -0
- package/plugins/claude-code/plugin/skills/ephemeral/SKILL.md +95 -0
- package/plugins/claude-code/plugin/skills/graduate/SKILL.md +156 -0
- package/plugins/claude-code/plugin/skills/plan/SKILL.md +236 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +22 -0
- package/plugins/codex/plugins/owenloop/skills/ephemeral/SKILL.md +95 -0
- package/plugins/codex/plugins/owenloop/skills/graduate/SKILL.md +156 -0
- package/plugins/codex/plugins/owenloop/skills/plan/SKILL.md +236 -0
package/dist/src/engine.js
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
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, workflowStatus, } from "./model.js";
|
|
13
|
+
import { collectionStem, 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
|
-
import { applyCapabilityRewrites, claimMatches, composeCapabilities } from "./capabilities.js";
|
|
16
|
+
import { applyCapabilityMappings, applyCapabilityRewrites, claimMatches, composeCapabilities } from "./capabilities.js";
|
|
17
17
|
import { localMidnightMs, nowMs, randId } from "./util.js";
|
|
18
18
|
import { createDefInstructionSource, OrderResolver } from "./order-resolver.js";
|
|
19
19
|
const DEFAULT_REAP_TTL_MS = 2 * 60 * 60 * 1000; // 2h
|
|
@@ -197,7 +197,7 @@ export class Engine {
|
|
|
197
197
|
createInstance(defName, opts = {}) {
|
|
198
198
|
const def = this.resolveDef(defName);
|
|
199
199
|
const id = randId('wf');
|
|
200
|
-
this.store.
|
|
200
|
+
this.store.txWithWorkflowSnapshots(def, () => this.createInstanceInTx(defName, def, id, opts));
|
|
201
201
|
this.fire({ type: 'instance', workflow: id, def: defName });
|
|
202
202
|
this.fireSettled(id);
|
|
203
203
|
return id;
|
|
@@ -299,7 +299,9 @@ export class Engine {
|
|
|
299
299
|
// gate advance landed" (discard). Pure computation over the already-fetched
|
|
300
300
|
// `parentArts` — no extra in-tx store read (E2 busy_timeout GOTCHA-safe).
|
|
301
301
|
let seenGateFp;
|
|
302
|
-
const
|
|
302
|
+
const needsSnapshot = Symbol('needs-workflow-snapshot');
|
|
303
|
+
let snapshotDef;
|
|
304
|
+
const transactionBody = () => {
|
|
303
305
|
// 1. FRESH parent snapshot — re-read inside the write lock; never trust
|
|
304
306
|
// the caller's STEP-1 map.
|
|
305
307
|
const parentArts = this.artMap(parentWf);
|
|
@@ -327,13 +329,19 @@ export class Engine {
|
|
|
327
329
|
let created = false;
|
|
328
330
|
let childDef;
|
|
329
331
|
if (!child) {
|
|
332
|
+
// Resolving a new child's CAS def must happen before its coordinated
|
|
333
|
+
// transaction acquires SQLite. Return a read-only sentinel on the
|
|
334
|
+
// first pass; `run` resolves, locks/revalidates the bundle store, and
|
|
335
|
+
// then repeats every gate/child read under the guarded write tx.
|
|
336
|
+
if (snapshotDef === undefined)
|
|
337
|
+
return needsSnapshot;
|
|
330
338
|
const childId = randId('wf');
|
|
331
339
|
// WS-6: resolve IN THE PARENT'S SCOPE. `parentDef` is the parent's own
|
|
332
340
|
// §28 pin (defFor prefers `defSnapshot` over the live resolver), so a
|
|
333
341
|
// bare `calls:` from a def installed out of a CAS bundle binds to that
|
|
334
342
|
// same bundle's workflow — the version the parent was pinned against —
|
|
335
343
|
// and not to whatever a later install happened to name the same thing.
|
|
336
|
-
childDef =
|
|
344
|
+
childDef = snapshotDef;
|
|
337
345
|
// WS-6: and the resolved child must still be the PINNED one. See
|
|
338
346
|
// `callsPinViolation`.
|
|
339
347
|
const violation = callsPinViolation(parentDef, childDef, step.calls);
|
|
@@ -395,7 +403,22 @@ export class Engine {
|
|
|
395
403
|
if (created || provided.length > 0)
|
|
396
404
|
this.settle(child.id, childDef, now);
|
|
397
405
|
return { childId: child.id, created, provided };
|
|
398
|
-
}
|
|
406
|
+
};
|
|
407
|
+
const transact = () => snapshotDef === undefined
|
|
408
|
+
? this.store.tx(transactionBody)
|
|
409
|
+
: this.store.txWithWorkflowSnapshots(snapshotDef, transactionBody);
|
|
410
|
+
const run = () => {
|
|
411
|
+
let result = transact();
|
|
412
|
+
if (result !== needsSnapshot)
|
|
413
|
+
return result;
|
|
414
|
+
// Resolve optimistically outside both locks. The snapshot guard then
|
|
415
|
+
// revalidates this CAS provenance under add.lock before SQLite begins.
|
|
416
|
+
snapshotDef = this.resolveDef(step.calls, parentDef);
|
|
417
|
+
result = transact();
|
|
418
|
+
if (result === needsSnapshot)
|
|
419
|
+
throw new Error('internal error: guarded child provision requested no snapshot');
|
|
420
|
+
return result;
|
|
421
|
+
};
|
|
399
422
|
try {
|
|
400
423
|
return run();
|
|
401
424
|
}
|
|
@@ -469,7 +492,7 @@ export class Engine {
|
|
|
469
492
|
const freshDef = this.resolveDef(wf.def);
|
|
470
493
|
const newHash = hashDef(freshDef);
|
|
471
494
|
const previousHash = wf.defHash;
|
|
472
|
-
this.store.
|
|
495
|
+
this.store.txWithWorkflowSnapshots(freshDef, () => {
|
|
473
496
|
this.store.repinWorkflowDef(workflow, freshDef, newHash);
|
|
474
497
|
this.settle(workflow, freshDef);
|
|
475
498
|
});
|
|
@@ -490,11 +513,11 @@ export class Engine {
|
|
|
490
513
|
*/
|
|
491
514
|
static CHILD_OUTCOME_PIN_KEY = '__child_outcome_version__';
|
|
492
515
|
/**
|
|
493
|
-
* F4: the single
|
|
494
|
-
* calls: artifact currently resting on"
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
* to pin to).
|
|
516
|
+
* F4: the single verdict-time helper that computes "what child-outcome
|
|
517
|
+
* version is this calls: artifact currently resting on" for reject
|
|
518
|
+
* propagation and human skip. STEP 6 publication reads and stamps the version
|
|
519
|
+
* from its authoritative in-transaction snapshot instead. Returns undefined
|
|
520
|
+
* if no child has ever been spawned (nothing to pin to).
|
|
498
521
|
*/
|
|
499
522
|
childOutcomePin(parentWf, callsPath) {
|
|
500
523
|
const child = this.store.findChildByParent(parentWf, callsPath);
|
|
@@ -662,7 +685,8 @@ export class Engine {
|
|
|
662
685
|
* Called at the top of tick (outside any tx) and as cascade-up prompt.
|
|
663
686
|
* For each calls: step: spawn the child if gate is ready and no child exists;
|
|
664
687
|
* re-attach if it exists; re-provide if parent inputs moved; machine-green
|
|
665
|
-
* the parent artifact when the child's declared output is green
|
|
688
|
+
* the parent artifact when the child's declared output is green and the
|
|
689
|
+
* whole child workflow is done.
|
|
666
690
|
*/
|
|
667
691
|
maintainCalls(parentWf, def, now) {
|
|
668
692
|
if (this._inMaintainCalls.has(parentWf))
|
|
@@ -786,23 +810,25 @@ export class Engine {
|
|
|
786
810
|
// rearmCallsGreen). Under WAL + BEGIN IMMEDIATE no other connection can
|
|
787
811
|
// commit between that in-tx re-read and the write, so a cross-connection
|
|
788
812
|
// interleave — the parent gate advanced to a newer version, or the child
|
|
789
|
-
// outcome re-armed,
|
|
790
|
-
//
|
|
791
|
-
// deferring to the next tick.
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
//
|
|
813
|
+
// outcome re-armed, or the child's completion state changed, between
|
|
814
|
+
// this stale pre-read and the write — is caught in-tx and the pass aborts
|
|
815
|
+
// (helper returns false, nothing written), deferring to the next tick.
|
|
816
|
+
// The published value, whole-child done result, gate fingerprint, and
|
|
817
|
+
// child-outcome pin therefore always come from ONE atomic snapshot.
|
|
818
|
+
// commit/settled events fire only when the helper wrote, so an aborted
|
|
819
|
+
// pass is silent to listeners.
|
|
795
820
|
//
|
|
796
821
|
// Re-read after potential re-provide.
|
|
797
822
|
childArts = this.artMap(existingChild.id);
|
|
798
823
|
childOutcomeArt = childArts.get(childOutcomeStem);
|
|
824
|
+
const childIsDone = workflowDone(childDef, childArts);
|
|
799
825
|
const parentCallsArt = this.store.getArtifact(parentWf, callsStem);
|
|
800
826
|
// F2: don't machine-green over a schema-rejected debt — it needs a
|
|
801
827
|
// human `retry` (or a moved gate, handled by the guard above) before
|
|
802
828
|
// this step revisits it.
|
|
803
829
|
if (parentCallsArt?.acceptance === 'rejected')
|
|
804
830
|
continue;
|
|
805
|
-
if (isGreen(childOutcomeArt) && childOutcomeArt?.value !== undefined) {
|
|
831
|
+
if (isGreen(childOutcomeArt) && childOutcomeArt?.value !== undefined && childIsDone) {
|
|
806
832
|
const alreadyGreen = isGreen(parentCallsArt);
|
|
807
833
|
const sameValue = alreadyGreen && deepEqual(childOutcomeArt.value, parentCallsArt?.value);
|
|
808
834
|
// F4: version-pinning. Only machine-green when the child outcome's
|
|
@@ -823,11 +849,13 @@ export class Engine {
|
|
|
823
849
|
}
|
|
824
850
|
}
|
|
825
851
|
}
|
|
826
|
-
else if (!isGreen(childOutcomeArt) && isGreen(parentCallsArt) && parentCallsArt) {
|
|
827
|
-
// M2B-REARM: child
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
//
|
|
852
|
+
else if ((!isGreen(childOutcomeArt) || !childIsDone) && isGreen(parentCallsArt) && parentCallsArt) {
|
|
853
|
+
// M2B-REARM: the child outcome is no longer green (e.g. re-provide
|
|
854
|
+
// re-armed it), OR the outcome is green while the child still has
|
|
855
|
+
// outstanding work. Re-arm the parent mirror to owed so deep descent
|
|
856
|
+
// can keep driving the child and downstream re-runs only after the
|
|
857
|
+
// whole child completes. The cascade cannot detect either condition
|
|
858
|
+
// because a calls: step declares consumes: [].
|
|
831
859
|
if (this.rearmCallsGreen(parentWf, def, callsStem, existingChild.id, childOutcomeStem, now)) {
|
|
832
860
|
this.fire({ type: 'commit', workflow: parentWf, path: callsStem, action: 'retry' });
|
|
833
861
|
this.fireSettled(parentWf);
|
|
@@ -883,11 +911,18 @@ export class Engine {
|
|
|
883
911
|
const child = this.store.findChildByParent(parentWf, callsStem);
|
|
884
912
|
if (!child || child.id !== expectedChildId)
|
|
885
913
|
return false;
|
|
914
|
+
const childDef = this.defFor(child.id);
|
|
915
|
+
const currentChildOutcomeStem = childDef.outputs?.[0];
|
|
916
|
+
if (currentChildOutcomeStem !== childOutcomeStem)
|
|
917
|
+
return false;
|
|
886
918
|
const childArts = this.artMap(child.id);
|
|
887
|
-
const childOutcomeArt = childArts.get(
|
|
888
|
-
// Child re-armed between the pre-read and
|
|
919
|
+
const childOutcomeArt = childArts.get(currentChildOutcomeStem);
|
|
920
|
+
// Child re-armed, or still has outstanding work, between the pre-read and
|
|
921
|
+
// here → defer. Only this in-tx snapshot authorizes publication.
|
|
889
922
|
if (!childOutcomeArt || !isGreen(childOutcomeArt) || childOutcomeArt.value === undefined)
|
|
890
923
|
return false;
|
|
924
|
+
if (!workflowDone(childDef, childArts))
|
|
925
|
+
return false;
|
|
891
926
|
// Gate still ready, and the child still consistent with the gate values
|
|
892
927
|
// the fingerprint is about to claim (the heart of the fix).
|
|
893
928
|
if (!this.callsGateReady(parentArts, step))
|
|
@@ -919,11 +954,12 @@ export class Engine {
|
|
|
919
954
|
/**
|
|
920
955
|
* STEP 6 re-arm as the mirror-image atomic guard. maintainCalls' optimistic
|
|
921
956
|
* pre-read decides only WHETHER to call this; the parent artifact AND the
|
|
922
|
-
* child
|
|
923
|
-
* if the parent is still green AND the child
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* Returns true only when
|
|
957
|
+
* child definition/artifacts are re-read inside the write lock, and the
|
|
958
|
+
* re-arm happens only if the parent is still green AND either the child
|
|
959
|
+
* outcome is non-green or the whole child is unfinished in-tx. If the outcome
|
|
960
|
+
* is green and the child is done by then, this does nothing (returns false)
|
|
961
|
+
* and the next maintainCalls pass publishes normally. Returns true only when
|
|
962
|
+
* it wrote.
|
|
927
963
|
*/
|
|
928
964
|
rearmCallsGreen(parentWf, def, callsStem, expectedChildId, childOutcomeStem, now) {
|
|
929
965
|
return this.store.tx(() => {
|
|
@@ -933,19 +969,34 @@ export class Engine {
|
|
|
933
969
|
const child = this.store.findChildByParent(parentWf, callsStem);
|
|
934
970
|
if (!child || child.id !== expectedChildId)
|
|
935
971
|
return false;
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
if (
|
|
972
|
+
const childDef = this.defFor(child.id);
|
|
973
|
+
const currentChildOutcomeStem = childDef.outputs?.[0];
|
|
974
|
+
if (currentChildOutcomeStem !== childOutcomeStem)
|
|
939
975
|
return false;
|
|
976
|
+
const childArts = this.artMap(child.id);
|
|
977
|
+
const childOutcomeArt = childArts.get(currentChildOutcomeStem);
|
|
978
|
+
const childIsDone = workflowDone(childDef, childArts);
|
|
979
|
+
// Green outcome plus whole-child completion means the mirror is valid.
|
|
980
|
+
if (isGreen(childOutcomeArt) && childIsDone)
|
|
981
|
+
return false;
|
|
982
|
+
const childOutcomeGreenButUnfinished = isGreen(childOutcomeArt) && !childIsDone;
|
|
983
|
+
let fingerprint = artNow.fingerprint;
|
|
984
|
+
let reasonText = 'gate input moved: child re-running';
|
|
985
|
+
if (childOutcomeGreenButUnfinished) {
|
|
986
|
+
fingerprint = { ...(artNow.fingerprint ?? {}) };
|
|
987
|
+
delete fingerprint[Engine.CHILD_OUTCOME_PIN_KEY];
|
|
988
|
+
reasonText = 'called workflow is not done';
|
|
989
|
+
}
|
|
940
990
|
this.store.putArtifact({
|
|
941
991
|
...artNow,
|
|
942
992
|
acceptance: 'owed',
|
|
993
|
+
fingerprint,
|
|
943
994
|
reasons: [...artNow.reasons, {
|
|
944
995
|
at: nowMs(),
|
|
945
996
|
action: 'reopen',
|
|
946
997
|
kind: 'structural',
|
|
947
998
|
by: 'engine',
|
|
948
|
-
text:
|
|
999
|
+
text: reasonText,
|
|
949
1000
|
fromVersion: artNow.version,
|
|
950
1001
|
}],
|
|
951
1002
|
});
|
|
@@ -988,7 +1039,7 @@ export class Engine {
|
|
|
988
1039
|
tick(workflow, opts = {}) {
|
|
989
1040
|
// `capabilities` is passed through AS GIVEN — an omitted filter (undefined)
|
|
990
1041
|
// and an empty list are different claims. See `claimMatches`.
|
|
991
|
-
return this.tickInternal(workflow, opts.now ?? nowMs(), opts.deep ?? true, opts.capabilities, new Set(), 0, undefined, opts.matchModes ?? {}, opts.capabilityRewrites ?? {}, opts.crewStamps ?? {});
|
|
1042
|
+
return this.tickInternal(workflow, opts.now ?? nowMs(), opts.deep ?? true, opts.capabilities, new Set(), 0, undefined, opts.matchModes ?? {}, opts.capabilityMappings ?? {}, opts.capabilityRewrites ?? {}, opts.crewStamps ?? {});
|
|
992
1043
|
}
|
|
993
1044
|
/**
|
|
994
1045
|
* The recursive tick worker. Runs this instance's own maintain → reap →
|
|
@@ -1029,7 +1080,7 @@ export class Engine {
|
|
|
1029
1080
|
* edge it hangs from. The guard is silent (no debt/reasons/events), mirroring
|
|
1030
1081
|
* the abort discipline of `publishCallsGreen`/`provisionCallsChild`.
|
|
1031
1082
|
*/
|
|
1032
|
-
tickInternal(workflow, now, deep, capabilities, visited, depth, parentEdge, matchModes = {}, capabilityRewrites = {}, crewStamps = {}) {
|
|
1083
|
+
tickInternal(workflow, now, deep, capabilities, visited, depth, parentEdge, matchModes = {}, capabilityMappings = {}, capabilityRewrites = {}, crewStamps = {}) {
|
|
1033
1084
|
if (depth > this.maxCallDepth) {
|
|
1034
1085
|
throw new Error(`calls depth limit exceeded (maxCallDepth=${this.maxCallDepth}) ticking '${workflow}': `
|
|
1035
1086
|
+ `a calls: composition is deeper than the bound, which usually means a calls: cycle `
|
|
@@ -1078,11 +1129,11 @@ export class Engine {
|
|
|
1078
1129
|
// Compute time facts for idle eligibility (clock-read boundary).
|
|
1079
1130
|
const timeFacts = this.computeTimeFacts(def, workflow, arts, now);
|
|
1080
1131
|
const firings = eligibleFirings(def, arts, timeFacts);
|
|
1081
|
-
const { selected, deferred } = this.applySchedule(workflow, def, firings, now, arts, capabilities, modifier, matchModes, capabilityRewrites);
|
|
1132
|
+
const { selected, deferred } = this.applySchedule(workflow, def, firings, now, arts, capabilities, modifier, matchModes, capabilityMappings, capabilityRewrites);
|
|
1082
1133
|
const orders = [];
|
|
1083
1134
|
const allDeferred = [...deferred];
|
|
1084
1135
|
for (const f of selected) {
|
|
1085
|
-
const claimed = this.claim(workflow, def, f, arts, now, modifier, capabilityRewrites, crewStamps);
|
|
1136
|
+
const claimed = this.claim(workflow, def, f, arts, now, modifier, capabilityMappings, capabilityRewrites, crewStamps);
|
|
1086
1137
|
if (claimed === 'in-flight') {
|
|
1087
1138
|
const d = { step: f.step, key: f.key, inputs: f.inputs, outputs: f.outputs, reason: 'in-flight' };
|
|
1088
1139
|
if (f.index !== undefined)
|
|
@@ -1117,7 +1168,7 @@ export class Engine {
|
|
|
1117
1168
|
parentWf: workflow,
|
|
1118
1169
|
step,
|
|
1119
1170
|
callsStem: step.produces[0].stem,
|
|
1120
|
-
}, matchModes, capabilityRewrites, crewStamps);
|
|
1171
|
+
}, matchModes, capabilityMappings, capabilityRewrites, crewStamps);
|
|
1121
1172
|
// orders: flatten; each Order already carries its own `workflow`.
|
|
1122
1173
|
result.orders.push(...cr.orders);
|
|
1123
1174
|
// deferred: stamp child-originated entries with the child id, preserving
|
|
@@ -1189,9 +1240,11 @@ export class Engine {
|
|
|
1189
1240
|
* Per-step cadence + daily budget + parallel cap over the eligible firings.
|
|
1190
1241
|
*
|
|
1191
1242
|
* A2: `capabilities` is the tick caller's claim filter, matched against the
|
|
1192
|
-
* step's OFFERED capabilities — the authored list
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1243
|
+
* step's OFFERED capabilities — the authored list mapped onto the caller's
|
|
1244
|
+
* own capability names, composed with the modifier this firing will actually
|
|
1245
|
+
* be offered under (`wise` + `deep` → `wise:deep`), then rewritten by any
|
|
1246
|
+
* reroute the caller decided on, which is the same list the order will carry.
|
|
1247
|
+
* `claimMatches` owns the rule;
|
|
1195
1248
|
* see it for the four cases (no filter presented, capability-silent step,
|
|
1196
1249
|
* empty caller list, both non-empty) and for what `matchModes` changes.
|
|
1197
1250
|
* A firing this caller may not claim is deferred as `'capability-mismatch'`.
|
|
@@ -1205,7 +1258,7 @@ export class Engine {
|
|
|
1205
1258
|
* escalation authored every firing of a step composes identically, so this
|
|
1206
1259
|
* behaves exactly as a per-step filter would.
|
|
1207
1260
|
*/
|
|
1208
|
-
applySchedule(workflow, def, firings, now, arts, capabilities, modifier, matchModes, capabilityRewrites) {
|
|
1261
|
+
applySchedule(workflow, def, firings, now, arts, capabilities, modifier, matchModes, capabilityMappings, capabilityRewrites) {
|
|
1209
1262
|
const midnight = localMidnightMs(now);
|
|
1210
1263
|
const selected = [];
|
|
1211
1264
|
const deferred = [];
|
|
@@ -1221,13 +1274,14 @@ export class Engine {
|
|
|
1221
1274
|
continue;
|
|
1222
1275
|
// A2: caller capability filter vs. this firing's COMPOSED offer. Composed
|
|
1223
1276
|
// here, not authored, so a caller bound to `wise:deep` is judged against
|
|
1224
|
-
// what the order will actually carry — including
|
|
1277
|
+
// what the order will actually carry — including a mapping onto the org's
|
|
1278
|
+
// own capability vocabulary, including when `deep` came from the
|
|
1225
1279
|
// escalation rule rather than the run, and including a reroute the caller
|
|
1226
|
-
// decided on. The filter and `buildOrder` apply the same
|
|
1227
|
-
// the same order, so what is matched is always what gets stamped.
|
|
1280
|
+
// decided on. The filter and `buildOrder` apply the same three functions
|
|
1281
|
+
// in the same order, so what is matched is always what gets stamped.
|
|
1228
1282
|
const stepFirings = [];
|
|
1229
1283
|
for (const f of all) {
|
|
1230
|
-
const composed = composeCapabilities(step.capabilities, this.routingFor(step, f, arts, modifier).modifier);
|
|
1284
|
+
const composed = composeCapabilities(applyCapabilityMappings(step.capabilities, capabilityMappings), this.routingFor(step, f, arts, modifier).modifier);
|
|
1231
1285
|
const { offered } = applyCapabilityRewrites(composed, capabilityRewrites);
|
|
1232
1286
|
if (claimMatches(offered, capabilities, matchModes))
|
|
1233
1287
|
stepFirings.push(f);
|
|
@@ -1309,7 +1363,7 @@ export class Engine {
|
|
|
1309
1363
|
return this.staleness(task, now, ttl, maxLease) === 'fresh';
|
|
1310
1364
|
}
|
|
1311
1365
|
/** Claim a firing's lease via CAS, snapshot the fingerprint, open a run. */
|
|
1312
|
-
claim(workflow, def, f, arts, now, modifier, capabilityRewrites = {}, crewStamps = {}) {
|
|
1366
|
+
claim(workflow, def, f, arts, now, modifier, capabilityMappings = {}, capabilityRewrites = {}, crewStamps = {}) {
|
|
1313
1367
|
const existing = this.store.getTask(workflow, f.step, f.key);
|
|
1314
1368
|
if (existing && existing.status === 'claimed') {
|
|
1315
1369
|
const run = existing.run ? this.store.getRun(existing.run) : undefined;
|
|
@@ -1337,7 +1391,7 @@ export class Engine {
|
|
|
1337
1391
|
// `applySchedule` so the offer and the filter read the same function on the
|
|
1338
1392
|
// same in-tx `arts` snapshot; nothing between them can move.
|
|
1339
1393
|
const routing = this.routingFor(this.step(def, f.step), f, arts, modifier);
|
|
1340
|
-
const order = this.buildOrder(def, workflow, runId, f, arts, fp, routing, capabilityRewrites, crewStamps);
|
|
1394
|
+
const order = this.buildOrder(def, workflow, runId, f, arts, fp, routing, capabilityMappings, capabilityRewrites, crewStamps);
|
|
1341
1395
|
if (typeof order === 'object' && 'deferred' in order)
|
|
1342
1396
|
return order;
|
|
1343
1397
|
// One history record per rejection episode. Written HERE, not in
|
|
@@ -1371,7 +1425,7 @@ export class Engine {
|
|
|
1371
1425
|
* snapshot is registered under the digest (a side effect of `digestOf`),
|
|
1372
1426
|
* so the order stays resolvable after the live definition map changes.
|
|
1373
1427
|
*/
|
|
1374
|
-
buildOrder(def, workflow, runId, f, arts, consumedFingerprint, routing = {}, capabilityRewrites = {}, crewStamps = {}) {
|
|
1428
|
+
buildOrder(def, workflow, runId, f, arts, consumedFingerprint, routing = {}, capabilityMappings = {}, capabilityRewrites = {}, crewStamps = {}) {
|
|
1375
1429
|
const step = this.step(def, f.step);
|
|
1376
1430
|
const consumes = {};
|
|
1377
1431
|
for (const p of f.inputs) {
|
|
@@ -1463,12 +1517,17 @@ export class Engine {
|
|
|
1463
1517
|
// land, not the currently-committed one: `green()` writes
|
|
1464
1518
|
// `art.version + 1`, so that is the version a consumer will later see
|
|
1465
1519
|
// and check a submission proof against. Issued by the engine inside the
|
|
1466
|
-
// claim transaction and persisted with the
|
|
1467
|
-
//
|
|
1468
|
-
//
|
|
1469
|
-
//
|
|
1470
|
-
//
|
|
1471
|
-
//
|
|
1520
|
+
// claim transaction and persisted with the order.
|
|
1521
|
+
//
|
|
1522
|
+
// The target stays correct across every in-claim retry that does NOT
|
|
1523
|
+
// move the artifact — the schema reject and the artifact-bind reject in
|
|
1524
|
+
// `green()` leave the run open without bumping `version`. A judgment or
|
|
1525
|
+
// human reject also leaves the claim open, but it FOLLOWS a commit that
|
|
1526
|
+
// already bumped the artifact, so the frozen target is one behind from
|
|
1527
|
+
// that point on. `restampOwedTarget` re-stamps it at the reject site
|
|
1528
|
+
// for exactly that case; see its doc comment. A stale target that
|
|
1529
|
+
// escaped anyway fails the consumer's version check — a refusal, never
|
|
1530
|
+
// an admitted unverified value.
|
|
1472
1531
|
version: (a?.version ?? 0) + 1,
|
|
1473
1532
|
judgmentRejects: a?.judgmentRejects ?? 0,
|
|
1474
1533
|
schemaRejects: a?.schemaRejects ?? 0,
|
|
@@ -1490,16 +1549,20 @@ export class Engine {
|
|
|
1490
1549
|
};
|
|
1491
1550
|
if (f.index !== undefined)
|
|
1492
1551
|
order.index = f.index;
|
|
1493
|
-
// The routing snapshot of THIS offer. `capabilities` is the
|
|
1494
|
-
// absent on a capability-silent step, since there is
|
|
1495
|
-
//
|
|
1552
|
+
// The routing snapshot of THIS offer. `capabilities` is the mapped-then-
|
|
1553
|
+
// composed list — absent on a capability-silent step, since there is
|
|
1554
|
+
// nothing to map or compose onto. A mapping substitutes the org's own
|
|
1555
|
+
// capability name for the authored one before the modifier is attached, so
|
|
1556
|
+
// one entry covers every grade the step can be offered at; the authored
|
|
1557
|
+
// name stays recoverable through `defDigest`, which pins the def that wrote
|
|
1558
|
+
// it. `modifier` is stamped whenever the offer carries one, even for a
|
|
1496
1559
|
// capability-silent step, so the brief can surface the grade of service
|
|
1497
1560
|
// regardless of how the step routes; on an escalated offer it is the
|
|
1498
1561
|
// escalation target, and `escalated` marks it as such so the hub does not
|
|
1499
1562
|
// have to diff it against the run record. A claimed order is never
|
|
1500
1563
|
// recomposed: composition happens per offer, and this record is what the
|
|
1501
1564
|
// shift resolved against.
|
|
1502
|
-
const { offered, reroutedFrom } = applyCapabilityRewrites(composeCapabilities(step.capabilities, routing.modifier), capabilityRewrites);
|
|
1565
|
+
const { offered, reroutedFrom } = applyCapabilityRewrites(composeCapabilities(applyCapabilityMappings(step.capabilities, capabilityMappings), routing.modifier), capabilityRewrites);
|
|
1503
1566
|
if (offered.length > 0)
|
|
1504
1567
|
order.capabilities = offered;
|
|
1505
1568
|
const crews = [];
|
|
@@ -1855,7 +1918,7 @@ export class Engine {
|
|
|
1855
1918
|
});
|
|
1856
1919
|
this.fire({ type: 'commit', workflow, run, path: result.path, action: 'green', outcome: result.outcome });
|
|
1857
1920
|
if (result.outcome === 'born-rejected') {
|
|
1858
|
-
this.fire({ type: 'closed', workflow, run, outcome: '
|
|
1921
|
+
this.fire({ type: 'closed', workflow, run, outcome: 'released' });
|
|
1859
1922
|
}
|
|
1860
1923
|
this.fireSettled(workflow);
|
|
1861
1924
|
// M2B cascade-up prompt: if this workflow has a producedBy link, trigger parent maintainCalls.
|
|
@@ -1954,7 +2017,7 @@ export class Engine {
|
|
|
1954
2017
|
});
|
|
1955
2018
|
this.fire({ type: 'commit', workflow, run, path: stem, action: 'emit', outcome: result.outcome });
|
|
1956
2019
|
if (result.outcome === 'born-rejected') {
|
|
1957
|
-
this.fire({ type: 'closed', workflow, run, outcome: '
|
|
2020
|
+
this.fire({ type: 'closed', workflow, run, outcome: 'released' });
|
|
1958
2021
|
}
|
|
1959
2022
|
this.fireSettled(workflow);
|
|
1960
2023
|
return result;
|
|
@@ -1993,7 +2056,7 @@ export class Engine {
|
|
|
1993
2056
|
});
|
|
1994
2057
|
this.fire({ type: 'commit', workflow, run, path: result.path, action: 'seal', outcome: result.outcome });
|
|
1995
2058
|
if (result.outcome === 'born-rejected') {
|
|
1996
|
-
this.fire({ type: 'closed', workflow, run, outcome: '
|
|
2059
|
+
this.fire({ type: 'closed', workflow, run, outcome: 'released' });
|
|
1997
2060
|
}
|
|
1998
2061
|
this.fireSettled(workflow);
|
|
1999
2062
|
return result;
|
|
@@ -2102,6 +2165,12 @@ export class Engine {
|
|
|
2102
2165
|
approvals: undefined,
|
|
2103
2166
|
reasons: [...art.reasons, reason('reject', 'judgment', by, text, art.version, requested)],
|
|
2104
2167
|
});
|
|
2168
|
+
// The producer's claim survives this reject (settle() writes artifact rows
|
|
2169
|
+
// only), so its frozen target is now one behind the version the next
|
|
2170
|
+
// commit will land. `art` is the pre-write snapshot and a reject does not
|
|
2171
|
+
// bump `version`, so `art.version + 1` is the same expression buildOrder
|
|
2172
|
+
// stamps at issue.
|
|
2173
|
+
this.restampOwedTarget(workflow, art.producer, path, art.version + 1);
|
|
2105
2174
|
this.settle(workflow, def);
|
|
2106
2175
|
return { outcome: 'rejected' };
|
|
2107
2176
|
});
|
|
@@ -2113,7 +2182,7 @@ export class Engine {
|
|
|
2113
2182
|
...(result.outcome === 'born-rejected' ? { outcome: 'born-rejected' } : {}),
|
|
2114
2183
|
});
|
|
2115
2184
|
if (result.outcome === 'born-rejected' && releasedRun !== undefined) {
|
|
2116
|
-
this.fire({ type: 'closed', workflow, run: releasedRun, outcome: '
|
|
2185
|
+
this.fire({ type: 'closed', workflow, run: releasedRun, outcome: 'released' });
|
|
2117
2186
|
}
|
|
2118
2187
|
this.fireSettled(workflow);
|
|
2119
2188
|
return result;
|
|
@@ -2156,6 +2225,11 @@ export class Engine {
|
|
|
2156
2225
|
approvals: undefined,
|
|
2157
2226
|
reasons: [...childArt.reasons, reason('reject', 'judgment', `parent:${by}`, text, childArt.version, requested)],
|
|
2158
2227
|
});
|
|
2228
|
+
// Same stranding as the plain reject above, one instance down: the child's
|
|
2229
|
+
// producing step can hold an open claim in the CHILD workflow. The parent
|
|
2230
|
+
// `calls` artifact reopened below needs no re-stamp — a `calls:` step never
|
|
2231
|
+
// becomes a worker order (src/model.ts), so no claim owes it.
|
|
2232
|
+
this.restampOwedTarget(child.id, childArt.producer, childOutcomeStem, childArt.version + 1);
|
|
2159
2233
|
this.settle(child.id, childDef);
|
|
2160
2234
|
// Parent calls artifact → reopened to owed (not left rejected), pinned
|
|
2161
2235
|
// to the just-rejected child outcome version.
|
|
@@ -2380,7 +2454,10 @@ export class Engine {
|
|
|
2380
2454
|
step: r.step,
|
|
2381
2455
|
key: r.key ?? '',
|
|
2382
2456
|
status: 'idle',
|
|
2383
|
-
|
|
2457
|
+
// A public close hands back a real claimed lease. Count the churn so
|
|
2458
|
+
// pickup-window lapses and explicit holder releases are visible in
|
|
2459
|
+
// instance status; released runs still remain outside run budgets.
|
|
2460
|
+
attempts: outcome === 'released' ? task.attempts + 1 : task.attempts,
|
|
2384
2461
|
...(task.alarmAt !== undefined ? { alarmAt: task.alarmAt } : {}),
|
|
2385
2462
|
});
|
|
2386
2463
|
}
|
|
@@ -2823,15 +2900,48 @@ export class Engine {
|
|
|
2823
2900
|
});
|
|
2824
2901
|
}
|
|
2825
2902
|
/**
|
|
2826
|
-
*
|
|
2903
|
+
* Re-stamp the owed version target for `path` on any OPEN claim that owes it.
|
|
2904
|
+
*
|
|
2905
|
+
* The target frozen at claim issue is `committed + 1`. That stays correct for
|
|
2906
|
+
* every refusal that leaves the run open WITHOUT bumping the artifact (the
|
|
2907
|
+
* schema reject and the artifact-bind reject in `green()`). It goes stale for
|
|
2908
|
+
* a judgment/human reject, which is preceded by a commit that already bumped
|
|
2909
|
+
* the artifact and which leaves the SAME claim live to retry: the next commit
|
|
2910
|
+
* lands `committed + 1` from the new committed version, while the producer is
|
|
2911
|
+
* still signing the old number into its proof's `produced[].version`. The
|
|
2912
|
+
* proof row is then stored under a key the envelope does not name, and the
|
|
2913
|
+
* consumer's version check refuses the artifact.
|
|
2914
|
+
*
|
|
2915
|
+
* Matching is by owed path, not by task key, so it is correct for map
|
|
2916
|
+
* elements without re-deriving the binding key. Runs inside the caller's open
|
|
2917
|
+
* tx (plain store writes, no nested tx).
|
|
2918
|
+
*/
|
|
2919
|
+
restampOwedTarget(workflow, producer, path, target) {
|
|
2920
|
+
for (const task of this.store.listTasks(workflow)) {
|
|
2921
|
+
if (task.step !== producer || task.status !== 'claimed' || task.run === undefined)
|
|
2922
|
+
continue;
|
|
2923
|
+
// A closed run's next claim rebuilds the order from scratch and already
|
|
2924
|
+
// gets a fresh target, so only an open one can strand.
|
|
2925
|
+
const run = this.store.getRun(task.run);
|
|
2926
|
+
if (!run || run.outcome !== undefined)
|
|
2927
|
+
continue;
|
|
2928
|
+
this.store.restampOrderTarget(task.run, path, target);
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
/**
|
|
2932
|
+
* §12.2 born-reject lease release: close the run (`released`) and re-arm its
|
|
2827
2933
|
* task to `idle` so the firing is immediately re-claimable next tick. Runs
|
|
2828
2934
|
* inside the caller's open tx (plain store write, no nested tx). Unlike reap()
|
|
2829
|
-
* it does NOT bump attempts — a CAS-stale born-reject is not lease churn.
|
|
2935
|
+
* it does NOT bump attempts — a CAS-stale born-reject is not lease churn. For
|
|
2936
|
+
* the same reason the outcome is `released` and not `no_work`: the step never
|
|
2937
|
+
* ran, so the run must not spend the daily budget or restart the cadence
|
|
2938
|
+
* clock either. `no_work` is reserved for a step that DID run and had nothing
|
|
2939
|
+
* to produce, which is a firing and does spend both. The
|
|
2830
2940
|
* `closed` event is fired by the caller AFTER the tx commits (post-commit
|
|
2831
2941
|
* ordering), matching public close().
|
|
2832
2942
|
*/
|
|
2833
2943
|
releaseLeaseOnBornReject(workflow, run) {
|
|
2834
|
-
this.store.updateRun(run, { outcome: '
|
|
2944
|
+
this.store.updateRun(run, { outcome: 'released' });
|
|
2835
2945
|
const r = this.store.getRun(run);
|
|
2836
2946
|
if (!r)
|
|
2837
2947
|
return;
|
package/dist/src/hub.d.ts
CHANGED
|
@@ -537,6 +537,33 @@ export declare function computeServerDiff<T extends {
|
|
|
537
537
|
name: string;
|
|
538
538
|
hash: string;
|
|
539
539
|
}>(candidates: T[], server: Map<string, WorkflowSummary>, force: boolean): ServerDiff<T>;
|
|
540
|
+
/**
|
|
541
|
+
* One line of the hub's capability publish report — what the org's capability
|
|
542
|
+
* vocabulary looks like for the def that was just published, computed hub-side
|
|
543
|
+
* AFTER the write transaction.
|
|
544
|
+
*
|
|
545
|
+
* Mirrors `owenloop-service`'s `CapabilityPublishReportEntry`
|
|
546
|
+
* (`packages/hub-core/src/capability-publish-report.ts`). It is a WIRE shape
|
|
547
|
+
* read from the hub, not a local model: the hub verb is the enforcement of
|
|
548
|
+
* record and this is the client's narrowed copy of it.
|
|
549
|
+
*
|
|
550
|
+
* `authored` is emitted by the hub ONLY when a mapping changed the def author's
|
|
551
|
+
* spelling into a different org name (identity mappings are dropped by the
|
|
552
|
+
* hub's resolver), so its PRESENCE is a reliable signal that a non-identity
|
|
553
|
+
* mapping already exists for that authored name.
|
|
554
|
+
*/
|
|
555
|
+
export interface CapabilityPublishReportEntry {
|
|
556
|
+
/** The ORG name — what an operator would type into `capability bind`. */
|
|
557
|
+
capability: string;
|
|
558
|
+
/** The def author's spelling, present ONLY when a mapping changed it. */
|
|
559
|
+
authored?: string;
|
|
560
|
+
status: 'new' | 'shared' | 'bound';
|
|
561
|
+
/** `bound` only: the NAMES of the crews serving it today, sorted. */
|
|
562
|
+
crews?: string[];
|
|
563
|
+
/** Other def names resolving to this same org name, sorted. Present for
|
|
564
|
+
* `shared`, and also alongside `bound` when both facts hold. */
|
|
565
|
+
sharedWith?: string[];
|
|
566
|
+
}
|
|
540
567
|
/** Success shape of `POST /api/create_workflow`. */
|
|
541
568
|
export interface CreateWorkflowOk {
|
|
542
569
|
ok: true;
|
|
@@ -546,6 +573,16 @@ export interface CreateWorkflowOk {
|
|
|
546
573
|
/** `true` when the posted content's hash equals the latest stored version
|
|
547
574
|
* (server-side idempotent no-op) — no new version was minted. */
|
|
548
575
|
unchanged?: boolean;
|
|
576
|
+
/**
|
|
577
|
+
* The org capability vocabulary this def resolves to, as the hub computed it.
|
|
578
|
+
*
|
|
579
|
+
* `undefined` and `[]` are DIFFERENT answers and are deliberately kept apart:
|
|
580
|
+
* `undefined` is a hub older than the report (it sent no field at all), while
|
|
581
|
+
* `[]` is a current hub saying "this def authors no capabilities". A hub that
|
|
582
|
+
* sends the field sends it on every `ok:true` branch, the `unchanged:true`
|
|
583
|
+
* no-op included, so the distinction is reliable.
|
|
584
|
+
*/
|
|
585
|
+
capabilityReport?: CapabilityPublishReportEntry[];
|
|
549
586
|
}
|
|
550
587
|
/**
|
|
551
588
|
* `POST /api/create_workflow` returns HTTP 200 with `{ok:false,error}` on a
|
|
@@ -575,6 +612,46 @@ export declare function createWorkflowError(body: unknown): string | null;
|
|
|
575
612
|
* on any violation; the caller records it as a per-def failure.
|
|
576
613
|
*/
|
|
577
614
|
export declare function asCreateWorkflowOk(body: unknown, expectedName: string): CreateWorkflowOk;
|
|
615
|
+
/**
|
|
616
|
+
* The one human line a pusher reads after `owenloop push` / `owenloop install`.
|
|
617
|
+
*
|
|
618
|
+
* Deliberately a COPY of the hub's `capabilityPublishReportText`, not an import
|
|
619
|
+
* of it: the CLI does not depend on `owenloop-service`, and the wire contract
|
|
620
|
+
* that binds the two is the ENTRY SHAPE above, not the sentence. Empty string
|
|
621
|
+
* for a def that authors no capabilities, so the caller appends nothing rather
|
|
622
|
+
* than a dangling header.
|
|
623
|
+
*
|
|
624
|
+
* `authored → capability` whenever the hub reported an `authored` spelling —
|
|
625
|
+
* that arrow is how an operator sees a mapping took effect.
|
|
626
|
+
*
|
|
627
|
+
* Goes to STDERR. Stdout is the machine JSON.
|
|
628
|
+
*/
|
|
629
|
+
export declare function capabilityPublishReportText(entries: CapabilityPublishReportEntry[]): string;
|
|
630
|
+
/**
|
|
631
|
+
* Narrow `GET /api/capability_mappings`'s 200 body to a plain `authored → org`
|
|
632
|
+
* record. An EMPTY result is valid — that is "this def has no recorded
|
|
633
|
+
* mapping", not an error.
|
|
634
|
+
*
|
|
635
|
+
* TWO BODY SHAPES ARE ACCEPTED, because the shipped hub and this CLI arrived at
|
|
636
|
+
* the endpoint from opposite ends:
|
|
637
|
+
*
|
|
638
|
+
* - `{ mappings: { <authored>: <org>, … } }` — the compact map this module
|
|
639
|
+
* originally proposed. One def, one function from authored name.
|
|
640
|
+
* - `{ mappings: [ { defName, authored, target, … }, … ] }` — the ROW ARRAY
|
|
641
|
+
* `owenloop-service` ships, whose read is a console listing that may span
|
|
642
|
+
* every def and carries provenance columns this caller does not need.
|
|
643
|
+
*
|
|
644
|
+
* Both collapse to the same record. Tolerating both is deliberate and is not
|
|
645
|
+
* temporary compatibility scaffolding: the row array is the hub's answer to a
|
|
646
|
+
* broader question (`what has this org remapped, anywhere`) and will keep its
|
|
647
|
+
* shape, while an older hub that only ever spoke the compact map must not start
|
|
648
|
+
* failing. A caller reading one def passes `defName` so a hub that ignores the
|
|
649
|
+
* `?def=` filter cannot fold another def's rows into the answer — the array
|
|
650
|
+
* carries `defName` precisely so that check is possible.
|
|
651
|
+
*
|
|
652
|
+
* Neither shape's VALUES are ever echoed in an error, only the position.
|
|
653
|
+
*/
|
|
654
|
+
export declare function asCapabilityMappings(body: unknown, defName?: string): Record<string, string>;
|
|
578
655
|
/**
|
|
579
656
|
* Identity returned by `GET /api/whoami` (bearer auth, no RBAC verb — a 200
|
|
580
657
|
* proves the credential authenticates, not that it carries any particular
|