@sensigo/realm 0.41.0 → 0.43.0

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.
Files changed (41) hide show
  1. package/dist/adapters/gorgias-adapter.d.ts.map +1 -1
  2. package/dist/adapters/gorgias-adapter.js +39 -10
  3. package/dist/adapters/gorgias-adapter.js.map +1 -1
  4. package/dist/engine/execution-loop.d.ts.map +1 -1
  5. package/dist/engine/execution-loop.js +124 -21
  6. package/dist/engine/execution-loop.js.map +1 -1
  7. package/dist/engine/run-health.d.ts +1 -1
  8. package/dist/engine/run-health.d.ts.map +1 -1
  9. package/dist/engine/run-health.js +49 -4
  10. package/dist/engine/run-health.js.map +1 -1
  11. package/dist/index.d.ts +7 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +8 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/types/run-record.d.ts +11 -1
  16. package/dist/types/run-record.d.ts.map +1 -1
  17. package/dist/types/run-record.js.map +1 -1
  18. package/dist/types/workflow-definition.d.ts +146 -10
  19. package/dist/types/workflow-definition.d.ts.map +1 -1
  20. package/dist/types/workflow-definition.js +225 -0
  21. package/dist/types/workflow-definition.js.map +1 -1
  22. package/dist/types/workflow-error.d.ts +1 -1
  23. package/dist/types/workflow-error.d.ts.map +1 -1
  24. package/dist/types/workflow-error.js.map +1 -1
  25. package/dist/workflow/diagnostics.d.ts +41 -5
  26. package/dist/workflow/diagnostics.d.ts.map +1 -1
  27. package/dist/workflow/diagnostics.js +34 -6
  28. package/dist/workflow/diagnostics.js.map +1 -1
  29. package/dist/workflow/registrar.d.ts +42 -0
  30. package/dist/workflow/registrar.d.ts.map +1 -1
  31. package/dist/workflow/registrar.js +57 -0
  32. package/dist/workflow/registrar.js.map +1 -1
  33. package/dist/workflow/step-key-registry.d.ts +1258 -0
  34. package/dist/workflow/step-key-registry.d.ts.map +1 -0
  35. package/dist/workflow/step-key-registry.js +1217 -0
  36. package/dist/workflow/step-key-registry.js.map +1 -0
  37. package/dist/workflow/yaml-loader.d.ts +16 -0
  38. package/dist/workflow/yaml-loader.d.ts.map +1 -1
  39. package/dist/workflow/yaml-loader.js +581 -345
  40. package/dist/workflow/yaml-loader.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,3 +1,228 @@
1
+ // issue #508 (final correction): a `types/ -> workflow/` edge, added for `buildTrustRefusal`
2
+ // below — audit-verified to create no cycle (`diagnostics.ts` imports only from its own
3
+ // directory's `source-positions.ts`, which imports only `js-yaml`'s types; neither imports
4
+ // anything from this file).
5
+ import { closestKey } from '../workflow/diagnostics.js';
6
+ /**
7
+ * Every value `TrustLevel` declares — the step-level vocabulary. Single-sourced (issue #508):
8
+ * before this, the two-literal gate test (`=== 'human_confirmed' || === 'human_reviewed'`) was
9
+ * copied by hand at FOUR call sites (the engine's gate mint, the protocol generator ×2, the
10
+ * loader's gate-choices check), and NO site validated the value at all — `human_confrimed`,
11
+ * `Human_Confirmed`, `engine_delivered`, `""`, `123`, `null` all loaded clean and ran with no
12
+ * gate. See `classifyStepTrust`/`isGateTrust` below, and `docs/reference/yaml-schema.md`'s
13
+ * `## Trust levels` section for the authoring contract.
14
+ *
15
+ * **`as const satisfies readonly TrustLevel[]` is NORMATIVE, not stylistic.** An explicit
16
+ * `readonly TrustLevel[]` type annotation WIDENS the array's member type to the full `TrustLevel`
17
+ * union regardless of which literals are actually listed — under that annotation, the
18
+ * `Exclude<>`-based drift guards below type-check even with members missing, shipping dead.
19
+ * `as const` preserves the literal tuple type the guards need to see a real difference. This is
20
+ * the house pattern (`KNOWN_STEP_KEYS`/`KNOWN_RETRY_KEYS` above), and verified here by actually
21
+ * deleting a member and confirming a real compile error results (not merely asserted).
22
+ */
23
+ export const TRUST_LEVELS = [
24
+ 'auto',
25
+ 'human_confirmed',
26
+ 'human_reviewed',
27
+ ];
28
+ /** The subset of `TRUST_LEVELS` that actually opens a human gate — `'auto'` is the sole
29
+ * non-gating member of `TrustLevel`. Kept as its OWN array (not derived by filtering
30
+ * `TRUST_LEVELS` at the type level) so a single hardcoded `TRUST_LEVELS` collapse at the mint
31
+ * can never silently widen who gets gated — see `classifyStepTrust`'s arm-order comment for why
32
+ * the drift this guards against is a real, previously-considered mutant shape. */
33
+ export const GATE_TRUST_LEVELS = [
34
+ 'human_confirmed',
35
+ 'human_reviewed',
36
+ ];
37
+ /** Every value `ServiceTrust` declares — the `services: <name>: trust:` vocabulary. A DIFFERENT
38
+ * key from a step's own `trust:` (the dominant real-world confusion this PR's L1 refusal names
39
+ * directly — six of realm's nine shipped examples carried a `ServiceTrust` literal on a step).
40
+ * Minted here, single-sourced, so the loader's own Ajv enum (`yaml-loader.ts`) and this PR's
41
+ * service-trust-confusion refusal can never drift apart into a THIRD hardcoded copy. */
42
+ export const SERVICE_TRUST_LEVELS = [
43
+ 'engine_delivered',
44
+ 'engine_managed',
45
+ 'agent_provided',
46
+ ];
47
+ const _trustLevelsMissingCheck = true;
48
+ const _trustLevelsExtraCheck = true;
49
+ const _gateTrustSubsetCheck = true;
50
+ const _serviceTrustLevelsMissingCheck = true;
51
+ const _serviceTrustLevelsExtraCheck = true;
52
+ /**
53
+ * Classifies a step's declared `trust` value against its execution kind. `kind` is
54
+ * `ExecutionMode | undefined` because one real call site (`yaml-loader.ts`'s per-step walk) sees
55
+ * this before `execution` has been validated — a step with `execution: bogus` (or a missing
56
+ * `execution` at all) reaches trust classification before the malformed-kind error is the whole
57
+ * verdict, and `undefined` here must classify as harmlessly as an absent trust value: covered by
58
+ * the FIRST arm below.
59
+ *
60
+ * **Arm order is normative** (issue #508 design review, mutant (iii)): `GATE_TRUST_LEVELS`
61
+ * membership is tested BEFORE the `'auto'` shortcut on auto/agent. With the shortcut checked
62
+ * first, collapsing `GATE_TRUST_LEVELS` into `TRUST_LEVELS` (a plausible single-sourcing
63
+ * shortcut) would change NOTHING observable — 'auto' is caught by its own branch either way,
64
+ * and `TRUST_LEVELS` membership alone can never distinguish 'human_confirmed' from 'auto' when
65
+ * the shortcut already resolved it — making that mutation a GUARANTEED EQUIVALENT MUTANT rather
66
+ * than a real regression test. Testing `GATE_TRUST_LEVELS` first means the collapse is
67
+ * observable: `classifyStepTrust('auto', 'auto')` would flip from `'lawful_no_gate'` to
68
+ * `'gates'`, since `TRUST_LEVELS` (unlike `GATE_TRUST_LEVELS`) contains `'auto'`.
69
+ */
70
+ export function classifyStepTrust(kind, value) {
71
+ if (value === undefined)
72
+ return 'lawful_no_gate';
73
+ if (kind === 'auto' || kind === 'agent') {
74
+ if (GATE_TRUST_LEVELS.includes(value))
75
+ return 'gates';
76
+ if (value === 'auto')
77
+ return 'lawful_no_gate';
78
+ return 'refuse';
79
+ }
80
+ if (kind === 'finalizer') {
81
+ return value === 'auto' ? 'lawful_no_gate' : 'refuse';
82
+ }
83
+ // guard, and any kind outside the four (undefined, or a value the loader would itself refuse
84
+ // as an invalid `execution`) — trust is never meaningful there, declared or not.
85
+ return 'refuse';
86
+ }
87
+ /**
88
+ * Pure VALUE question — "is this a gate-opening literal" — for the two call sites that have no
89
+ * kind in scope at all: the engine's gate mint (`execution-loop.ts`, which only ever reaches a
90
+ * step whose kind already passed L1/L2, so the kind conjunct `classifyStepTrust` would add is
91
+ * inert there) and the loader's gate-choices-empty check (`yaml-loader.ts`, evaluated on a raw
92
+ * step object before this file's own kind-narrowing block). `classifyStepTrust` CONSUMES this
93
+ * function for its own 'gates' arm, so there remains exactly one membership fact — passing a
94
+ * fabricated kind to reach a single call site would not be single-sourcing, it would be lying to
95
+ * a parameter to get there.
96
+ */
97
+ export function isGateTrust(value) {
98
+ return GATE_TRUST_LEVELS.includes(value);
99
+ }
100
+ /**
101
+ * Renders a `trust` value into prose — the ONE rendering rule every trust-value message shares,
102
+ * exported so a NON-refusal disclosure (the protocol generator's guard/finalizer inert-trust
103
+ * note) can consume it too, rather than hand-rolling its own renderer that could drift from this
104
+ * one. `JSON.stringify`, unconditionally, no exceptions: `String()` makes `''` print as the
105
+ * unreadable `'trust: '` (reads as MISSING, not empty), `null` print as `'trust: null'`
106
+ * (indistinguishable from the three-character string `"null"`), and — worst — an ARRAY print as
107
+ * its own first element (`String(['a','b'])` is `'a,b'`; a value the author declared as a list is
108
+ * shown as if it were a scalar, with no sign anything was ever dropped).
109
+ */
110
+ export function renderTrustValue(value) {
111
+ return JSON.stringify(value);
112
+ }
113
+ function selectTrustRefusalArm(value) {
114
+ if (SERVICE_TRUST_LEVELS.includes(value))
115
+ return 'service';
116
+ if (value === 'human_notified')
117
+ return 'removed';
118
+ return 'generic';
119
+ }
120
+ function trustRefusalConsequence(surface) {
121
+ switch (surface) {
122
+ case 'load':
123
+ // No error-code mention: L1's throw carries `VALIDATION_WORKFLOW_SCHEMA` (yaml-loader.ts
124
+ // joins every load-time error into one `WorkflowError` under that single code) — never
125
+ // `VALIDATION_TRUST_VALUE`, which is exclusively L2's (execution-loop.ts's) code. Naming
126
+ // it here would be a claim this surface cannot back.
127
+ return ('refused at load: this workflow cannot create a run while the value is wrong, so no ' +
128
+ 'step of it — gated or not — ever executes under it');
129
+ case 'dispatch':
130
+ // No inline code mention either, but for the OPPOSITE reason: `error_code` is a real,
131
+ // separate, structured field on the envelope here (`VALIDATION_TRUST_VALUE`, set on the
132
+ // `WorkflowError` this text becomes the message of) — a reader with programmatic access
133
+ // already has it without parsing prose for it.
134
+ return ('refused at dispatch: no gate opens and this step does not run; this run is now ' +
135
+ 'parked, non-terminal, until the value is corrected, and any step depending on this ' +
136
+ "one returns 'blocked' in the meantime");
137
+ case 'finding':
138
+ // `RunHealthFinding` has no separate code field the way `dispatch`'s envelope does — the
139
+ // code is only ever visible if it is IN this string.
140
+ return 'the engine will refuse this step at dispatch (VALIDATION_TRUST_VALUE)';
141
+ case 'briefing':
142
+ // Same reasoning as `finding`: `ProtocolStep.agent_involvement` is a bare string, and this
143
+ // is a genuinely true prediction of what L2 will throw if the agent calls execute_step
144
+ // anyway — the code is real information, not decoration.
145
+ return ('calling execute_step here will be refused (VALIDATION_TRUST_VALUE): no gate opens ' +
146
+ 'and this step does not run; the run would then park, non-terminal, until the value ' +
147
+ "is corrected, with any step depending on this one returning 'blocked'");
148
+ }
149
+ }
150
+ /**
151
+ * The accepted-set / did-you-mean / remedy tail. `kind: 'finalizer'` is the ONE case that
152
+ * replaces this entirely with the finalizer's own kind clause — reachable only on
153
+ * `surface: 'load'` (see `buildTrustRefusal`'s own doc for why `dispatch`/`finding`/`briefing`
154
+ * never see a finalizer step at all): the generic accepted-set-plus-live-run-remedy text would
155
+ * wrongly imply the two human-gate literals are meaningful on a kind that can never gate.
156
+ */
157
+ function trustRefusalTail(kind, surface, didYouMean) {
158
+ if (kind === 'finalizer') {
159
+ return (`'trust' accepts ${TRUST_LEVELS.join(', ')}, and only 'auto' is meaningful on ` +
160
+ `execution: finalizer steps.`);
161
+ }
162
+ switch (surface) {
163
+ case 'load':
164
+ return (`A step's 'trust' accepts ${TRUST_LEVELS.join(', ')}.` +
165
+ (didYouMean !== undefined ? ` Did you mean '${didYouMean}'?` : '') +
166
+ ` Correct the value, then 'realm workflow register <path>' — any run of this ` +
167
+ `workflow picks up the corrected definition on its next attempt at this step.`);
168
+ case 'dispatch':
169
+ return (`A step's 'trust' accepts ${TRUST_LEVELS.join(', ')}.` +
170
+ (didYouMean !== undefined ? ` Did you mean '${didYouMean}'?` : '') +
171
+ ` Correct the value, then 'realm workflow register <path>' and retry this step — ` +
172
+ `this run picks up the corrected definition.`);
173
+ case 'finding':
174
+ return (`Accepts ${TRUST_LEVELS.join(', ')}` +
175
+ (didYouMean !== undefined ? `; did you mean '${didYouMean}'?` : '') +
176
+ ` — correct the value and 'realm workflow register <path>'.`);
177
+ case 'briefing':
178
+ return (`A step's 'trust' accepts ${TRUST_LEVELS.join(', ')}.` +
179
+ (didYouMean !== undefined ? ` Did you mean '${didYouMean}'?` : '') +
180
+ ` Do NOT call execute_step for it; report this to the user, who must correct the ` +
181
+ `workflow definition and re-register it.`);
182
+ }
183
+ }
184
+ /**
185
+ * The ONE trust-refusal message composer (issue #508 final correction). Four consumers —
186
+ * `yaml-loader.ts`'s load-time refusal (auto/agent, and the finalizer's own non-gate-literal
187
+ * branch), `execution-loop.ts`'s dispatch-time refusal, `run-health.ts`'s `trust_value_invalid`
188
+ * finding, and the protocol generator's pre-dispatch agent briefing — used to hand-compose this
189
+ * text independently, and every defect this issue's prior rounds found (arm divergence across
190
+ * surfaces, mixed bare/quoted value rendering, an array printing as its own first element, a
191
+ * grammar seam where a sentence-ending clause met a lowercase continuation) fell out of that
192
+ * duplication, not out of four separate bugs. This function is the single point where value
193
+ * rendering, arm selection, and the per-surface consequence sentence are assembled — no call site
194
+ * chooses an arm or renders a value on its own again.
195
+ *
196
+ * `kind` only changes the output when `kind === 'finalizer'` — and even then, only reachable on
197
+ * `surface: 'load'`. `dispatch`/`finding`/`briefing` are all scoped, structurally, to
198
+ * `findEligibleSteps`'s auto/agent-only population (see each call site's own comment for why),
199
+ * so a finalizer step's trust value can only ever reach this function through `yaml-loader.ts`'s
200
+ * load-time check. `kind: 'guard'` must never reach this function at all: a guard's blanket
201
+ * `trust` prohibition is a KIND prohibition (the key is the offense, the value is irrelevant),
202
+ * minted by the #517 registry walk, and structurally never routes through a value-refusal
203
+ * composer.
204
+ */
205
+ export function buildTrustRefusal(args) {
206
+ const { kind, value, step, surface } = args;
207
+ const arm = selectTrustRefusalArm(value);
208
+ // `closestKey` throws a TypeError on `null` — guarded by the `typeof` check, which also
209
+ // correctly excludes every other non-string value (123, [], {}) from the suggestion without a
210
+ // special case for each. Only the generic arm ever suggests: a service-trust value or the
211
+ // retired tombstone are exact membership matches, not near-misses.
212
+ const didYouMean = arm === 'generic' && typeof value === 'string' ? closestKey(value, TRUST_LEVELS) : undefined;
213
+ const rendered = renderTrustValue(value);
214
+ const armClause = arm === 'service'
215
+ ? `'trust: ${rendered}' is a SERVICE's trust level (declared under 'services: <name>: ` +
216
+ `trust:'), not a step's`
217
+ : arm === 'removed'
218
+ ? `'trust: ${rendered}' was removed (issue #508): it never triggered a notification, ` +
219
+ `it never opened a gate, and most workflows should simply delete the key`
220
+ : `'trust: ${rendered}' is not a recognized value`;
221
+ const prefix = surface === 'load' || surface === 'dispatch' ? `Step '${step}': ` : '';
222
+ const consequence = trustRefusalConsequence(surface);
223
+ const tail = trustRefusalTail(kind, surface, didYouMean);
224
+ return `${prefix}${armClause} — ${consequence}. ${tail}`;
225
+ }
1
226
  /**
2
227
  * Every key RetryConfig declares. Used by the YAML loader (issue #140) to warn when a `retry:`
3
228
  * block declares a key that isn't recognized (misspelling, or a stale field) — same non-breaking
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-definition.js","sourceRoot":"","sources":["../../src/types/workflow-definition.ts"],"names":[],"mappings":"AAuHA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc;IACd,SAAS;IACT,eAAe;IACf,cAAc;IACd,YAAY;IACZ,uBAAuB;CACf,CAAC;AAMX,MAAM,sBAAsB,GAE+C,IAAI,CAAC;AAChF,MAAM,oBAAoB,GAEyD,IAAI,CAAC;AAmFxF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS;IACT,OAAO;IACP,SAAS;IACT,qBAAqB;IACrB,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;CACN,CAAC;AAMX,MAAM,qBAAqB,GAE6C,IAAI,CAAC;AAC7E,MAAM,mBAAmB,GAEuD,IAAI,CAAC;AAmQrF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,WAAW;IACX,YAAY;IACZ,cAAc;IACd,MAAM;IACN,cAAc;IACd,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,eAAe;IACf,cAAc;IACd,uBAAuB;IACvB,eAAe;IACf,OAAO;IACP,iBAAiB;IACjB,OAAO;IACP,uBAAuB;IACvB,cAAc;IACd,QAAQ;IACR,SAAS;IACT,cAAc;IACd,MAAM;IACN,eAAe;IACf,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,qBAAqB;CACb,CAAC;AAQX,MAAM,qBAAqB,GAEiD,IAAI,CAAC;AACjF,MAAM,mBAAmB,GAE2D,IAAI,CAAC;AAoGzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI;IACJ,MAAM;IACN,aAAa;IACb,SAAS;IACT,eAAe;IACf,UAAU;IACV,UAAU;IACV,aAAa;IACb,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,iBAAiB;IACjB,SAAS;CACD,CAAC;AAEX;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,YAAY;IACZ,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,OAAO;IACP,OAAO;CACC,CAAC;AAWX,MAAM,yBAAyB,GAKvB,IAAI,CAAC;AACb,MAAM,uBAAuB,GAKrB,IAAI,CAAC;AACb,MAAM,yBAAyB,GAE4D,IAAI,CAAC"}
1
+ {"version":3,"file":"workflow-definition.js","sourceRoot":"","sources":["../../src/types/workflow-definition.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,wFAAwF;AACxF,2FAA2F;AAC3F,4BAA4B;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAiCxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,iBAAiB;IACjB,gBAAgB;CACwB,CAAC;AAE3C;;;;mFAImF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,gBAAgB;CACwB,CAAC;AAE3C;;;;yFAIyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,kBAAk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B,cAAc;IACd,QAAQ;IACR,SAAS;IACT,cAAc;IACd,MAAM;IACN,eAAe;IACf,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,qBAAqB;CACb,CAAC;AAQX,MAAM,qBAAqB,GAEiD,IAAI,CAAC;AACjF,MAAM,mBAAmB,GAE2D,IAAI,CAAC;AAoGzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI;IACJ,MAAM;IACN,aAAa;IACb,SAAS;IACT,eAAe;IACf,UAAU;IACV,UAAU;IACV,aAAa;IACb,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,iBAAiB;IACjB,SAAS;CACD,CAAC;AAEX;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,YAAY;IACZ,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,OAAO;IACP,OAAO;CACC,CAAC;AAWX,MAAM,yBAAyB,GAKvB,IAAI,CAAC;AACb,MAAM,uBAAuB,GAKrB,IAAI,CAAC;AACb,MAAM,yBAAyB,GAE4D,IAAI,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { LoaderWarning } from '../workflow/diagnostics.js';
2
2
  export type ErrorCategory = 'NETWORK' | 'SERVICE' | 'STATE' | 'VALIDATION' | 'ENGINE' | 'RESOURCE';
3
3
  export type AgentAction = 'report_to_user' | 'provide_input' | 'resolve_precondition' | 'stop' | 'wait_for_human' | 'wait_and_proceed';
4
- export type ErrorCode = 'NETWORK_TIMEOUT' | 'NETWORK_UNREACHABLE' | 'NETWORK_DNS_FAILED' | 'NETWORK_CONNECTION_RESET' | 'SERVICE_HTTP_4XX' | 'SERVICE_HTTP_5XX' | 'SERVICE_RATE_LIMITED' | 'SERVICE_AUTH_FAILED' | 'SERVICE_NOT_FOUND' | 'SERVICE_RESPONSE_INVALID' | 'SERVICE_UNEXPECTED_REDIRECT' | 'STATE_BLOCKED' | 'STATE_PRECONDITION_FAILED' | 'STATE_RUN_NOT_FOUND' | 'STATE_WORKFLOW_NOT_FOUND' | 'STATE_RUN_TERMINAL' | 'STATE_SNAPSHOT_MISMATCH' | 'STATE_RUN_LOCKED' | 'STATE_RUN_BUSY' | 'STATE_TRANSITION_DENIED' | 'STATE_RUN_RESURRECTED' | 'STATE_LEGACY_FORMAT' | 'STATE_STEP_ALREADY_CLAIMED' | 'STATE_STEP_NOT_ELIGIBLE' | 'STATE_STEP_ALREADY_SETTLED' | 'STATE_CLAIM_LOST' | 'STATE_RUN_DIVERGED' | 'STATE_RUN_ALREADY_ACTIVE' | 'STATE_IDEMPOTENCY_KEY_USED' | 'RUN_ABORTING' | 'VALIDATION_INPUT_SCHEMA' | 'VALIDATION_OUTPUT_SCHEMA' | 'VALIDATION_TRACE_SCHEMA' | 'VALIDATION_EXHAUSTED' | 'VALIDATION_WORKFLOW_SCHEMA' | 'VALIDATION_HASH_MISMATCH' | 'VALIDATION_QUOTE_NOT_FOUND' | 'VALIDATION_FIELD_UNKNOWN' | 'VALIDATION_FIELD_EXCLUDED' | 'VALIDATION_EMPTY_VALUE' | 'VALIDATION_BATCH_TOO_LARGE' | 'VALIDATION_BATCH_ITEMS' | 'STEP_HANDLER_ERROR' | 'ENGINE_INTERNAL' | 'ENGINE_STORE_FAILED' | 'ENGINE_ARTIFACT_DELETE_FAILED' | 'ENGINE_ADAPTER_FAILED' | 'ENGINE_ADAPTER_NOT_REGISTERED' | 'ENGINE_PROCESSOR_FAILED' | 'ENGINE_HANDLER_FAILED' | 'ENGINE_HANDLER_NOT_REGISTERED' | 'ENGINE_STEP_FAILED' | 'ENGINE_GATE_OPEN_FAILED' | 'GATE_MESSAGE_UNRESOLVABLE' | 'FILTER_UNKNOWN' | 'ADAPTER_OP_UNSUPPORTED' | 'ADAPTER_VALIDATION_FAILED' | 'ADAPTER_REQUEST_FAILED' | 'STEP_TIMEOUT' | 'STEP_ABORTED' | 'STEP_RETRY_EXHAUSTED' | 'STATE_STEP_PENDING' | 'STATE_SEAL_UNSTAMPED' | 'STATE_SEAL_ORPHANED' | 'STATE_SEAL_ERASED' | 'STATE_SEAL_UNKNOWN_ARM' | 'STATE_SEAL_INCOHERENT' | 'STATE_SEAL_REWRITTEN' | 'STEP_NOT_FOUND' | 'GUARD_RESOLUTION_ERROR' | 'INPUT_MAP_DEPTH_EXCEEDED' | 'INPUT_MAP_UNKNOWN_DIRECTIVE' | 'RESOURCE_FETCH_FAILED' | 'RESOURCE_TOO_LARGE' | 'RESOURCE_FORMAT_INVALID' | 'RESOURCE_NOT_ACCESSIBLE' | 'BUFFER_FULL' | 'TRACE_CAPABILITY_INCONSISTENT' | 'MCP_CONNECTION_FAILED' | 'MCP_TOOL_NOT_FOUND' | 'MCP_TOOL_NAME_COLLISION';
4
+ export type ErrorCode = 'NETWORK_TIMEOUT' | 'NETWORK_UNREACHABLE' | 'NETWORK_DNS_FAILED' | 'NETWORK_CONNECTION_RESET' | 'SERVICE_HTTP_4XX' | 'SERVICE_HTTP_5XX' | 'SERVICE_RATE_LIMITED' | 'SERVICE_AUTH_FAILED' | 'SERVICE_NOT_FOUND' | 'SERVICE_RESPONSE_INVALID' | 'SERVICE_UNEXPECTED_REDIRECT' | 'STATE_BLOCKED' | 'STATE_PRECONDITION_FAILED' | 'STATE_RUN_NOT_FOUND' | 'STATE_WORKFLOW_NOT_FOUND' | 'STATE_RUN_TERMINAL' | 'STATE_SNAPSHOT_MISMATCH' | 'STATE_RUN_LOCKED' | 'STATE_RUN_BUSY' | 'STATE_TRANSITION_DENIED' | 'STATE_RUN_RESURRECTED' | 'STATE_LEGACY_FORMAT' | 'STATE_STEP_ALREADY_CLAIMED' | 'STATE_STEP_NOT_ELIGIBLE' | 'STATE_STEP_ALREADY_SETTLED' | 'STATE_CLAIM_LOST' | 'STATE_RUN_DIVERGED' | 'STATE_RUN_ALREADY_ACTIVE' | 'STATE_IDEMPOTENCY_KEY_USED' | 'RUN_ABORTING' | 'VALIDATION_INPUT_SCHEMA' | 'VALIDATION_OUTPUT_SCHEMA' | 'VALIDATION_TRACE_SCHEMA' | 'VALIDATION_EXHAUSTED' | 'VALIDATION_WORKFLOW_SCHEMA' | 'VALIDATION_HASH_MISMATCH' | 'VALIDATION_QUOTE_NOT_FOUND' | 'VALIDATION_FIELD_UNKNOWN' | 'VALIDATION_FIELD_EXCLUDED' | 'VALIDATION_EMPTY_VALUE' | 'VALIDATION_BATCH_TOO_LARGE' | 'VALIDATION_BATCH_ITEMS' | 'VALIDATION_TRUST_VALUE' | 'STEP_HANDLER_ERROR' | 'ENGINE_INTERNAL' | 'ENGINE_STORE_FAILED' | 'ENGINE_ARTIFACT_DELETE_FAILED' | 'ENGINE_ADAPTER_FAILED' | 'ENGINE_ADAPTER_NOT_REGISTERED' | 'ENGINE_PROCESSOR_FAILED' | 'ENGINE_HANDLER_FAILED' | 'ENGINE_HANDLER_NOT_REGISTERED' | 'ENGINE_STEP_FAILED' | 'ENGINE_GATE_OPEN_FAILED' | 'GATE_MESSAGE_UNRESOLVABLE' | 'FILTER_UNKNOWN' | 'ADAPTER_OP_UNSUPPORTED' | 'ADAPTER_VALIDATION_FAILED' | 'ADAPTER_REQUEST_FAILED' | 'STEP_TIMEOUT' | 'STEP_ABORTED' | 'STEP_RETRY_EXHAUSTED' | 'STATE_STEP_PENDING' | 'STATE_SEAL_UNSTAMPED' | 'STATE_SEAL_ORPHANED' | 'STATE_SEAL_ERASED' | 'STATE_SEAL_UNKNOWN_ARM' | 'STATE_SEAL_INCOHERENT' | 'STATE_SEAL_REWRITTEN' | 'STEP_NOT_FOUND' | 'GUARD_RESOLUTION_ERROR' | 'INPUT_MAP_DEPTH_EXCEEDED' | 'INPUT_MAP_UNKNOWN_DIRECTIVE' | 'RESOURCE_FETCH_FAILED' | 'RESOURCE_TOO_LARGE' | 'RESOURCE_FORMAT_INVALID' | 'RESOURCE_NOT_ACCESSIBLE' | 'BUFFER_FULL' | 'TRACE_CAPABILITY_INCONSISTENT' | 'MCP_CONNECTION_FAILED' | 'MCP_TOOL_NOT_FOUND' | 'MCP_TOOL_NAME_COLLISION';
5
5
  export interface WorkflowErrorOptions {
6
6
  code: ErrorCode;
7
7
  category: ErrorCategory;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-error.d.ts","sourceRoot":"","sources":["../../src/types/workflow-error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnG,MAAM,MAAM,WAAW,GACnB,gBAAgB,GAChB,eAAe,GACf,sBAAsB,GACtB,MAAM,GACN,gBAAgB,GAChB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,SAAS,GAEjB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,0BAA0B,GAE1B,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,GACrB,mBAAmB,GACnB,0BAA0B,GAE1B,6BAA6B,GAE7B,eAAe,GACf,2BAA2B,GAC3B,qBAAqB,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,yBAAyB,GACzB,kBAAkB,GAIlB,gBAAgB,GAChB,yBAAyB,GAMzB,uBAAuB,GACvB,qBAAqB,GACrB,4BAA4B,GAC5B,yBAAyB,GAKzB,4BAA4B,GAG5B,kBAAkB,GAClB,oBAAoB,GACpB,0BAA0B,GAC1B,4BAA4B,GAC5B,cAAc,GAEd,yBAAyB,GACzB,0BAA0B,GAC1B,yBAAyB,GAIzB,sBAAsB,GACtB,4BAA4B,GAC5B,0BAA0B,GAC1B,4BAA4B,GAC5B,0BAA0B,GAC1B,2BAA2B,GAC3B,wBAAwB,GACxB,4BAA4B,GAC5B,wBAAwB,GACxB,oBAAoB,GAEpB,iBAAiB,GACjB,qBAAqB,GAIrB,+BAA+B,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 'RETRY_INERT_NON_AUTO' | 'UNKNOWN_VALIDATION_EXHAUSTION_KEY' | 'DEAD_VALIDATION_EXHAUSTION_CONFIG' | 'UNKNOWN_GATE_KEY' | 'DEAD_GATE_CONFIG';
8
8
  /**
9
- * A single structured diagnostic. `message` is the full human-readable text (matching, for every
10
- * unknown-key code, exactly what `renderLoaderWarning` would independently reconstruct from the
11
- * structured fields kept in sync by construction, not by convention: see `findUnknownKeys`
12
- * below). `scope`/`id`/`step`/`key`/`did_you_mean` are populated only by the unknown-key family;
13
- * other codes carry just `code`/`severity`/`message`.
9
+ * A single structured diagnostic. `message` is the full human-readable text, minted once at the
10
+ * source (`findUnknownKeys` below, for the unknown-key family) `renderLoaderWarning` never
11
+ * reconstructs it from the structured fields; it only ECHOES `message` verbatim, prefixed with
12
+ * `⚠ `. `scope`/`id`/`step`/`key`/`did_you_mean` are populated only by the unknown-key family and
13
+ * exist for consumers that want the PARTS (a machine reader, a different renderer), not for
14
+ * `renderLoaderWarning` to recompose from — that would risk a second, drifting copy of the same
15
+ * prose. Other codes carry just `code`/`severity`/`message`.
14
16
  */
15
17
  export interface LoaderWarning {
16
18
  code: WarningCode;
@@ -71,6 +73,30 @@ export declare function resolveSeverity(code: WarningCode, policy?: Record<Warni
71
73
  * deterministic, not alphabetical.
72
74
  */
73
75
  export declare function closestKey(key: string, allowList: readonly string[]): string | undefined;
76
+ /**
77
+ * The author-extension namespace (issue #559). A top-level key beginning `x-` is the AUTHOR's:
78
+ * realm carries it verbatim into the registered copy and never reads it — a place for YAML
79
+ * anchor hosts (e.g. a shared enum) and tooling notes. Docker Compose's `^x-` is the same
80
+ * mechanism, and its own docs direct anchors into it.
81
+ *
82
+ * `x-realm-` is reserved for realm's own future extension keys from the day the namespace
83
+ * opens — so a key in it is NOT an extension key and still refuses, with a message naming the
84
+ * reservation (OpenAPI reserved `x-oai-`/`x-oas-` only retroactively; realm does it up front).
85
+ *
86
+ * The reserved sub-namespace is matched in EVERY capitalization — `x-Realm-foo` and `x-REALM-foo`
87
+ * are NOT the author's keys (issue #582): the reservation exists so no case-variant can sit
88
+ * beside a future realm key, so it must not depend on the author's Shift key. The reservation is
89
+ * the PREFIX `x-realm-` (OpenAPI reserves `x-oai-` the same way): the dash-less word `x-realm` is
90
+ * the author's.
91
+ *
92
+ * Case-sensitive: `X-Foo` is not an extension key (OpenAPI's and Compose's `^x-` are lowercase).
93
+ * The dash is load-bearing: `xtra` is not one. A bare `x-` IS one — an empty extension name is
94
+ * still the author's; it renders as `x-` in the disclosure clause.
95
+ */
96
+ export declare const EXTENSION_KEY_PREFIX: "x-";
97
+ export declare const RESERVED_EXTENSION_PREFIX: "x-realm-";
98
+ /** True when `key` is the author's own extension key (see `EXTENSION_KEY_PREFIX`). */
99
+ export declare function isExtensionKey(key: string): boolean;
74
100
  /**
75
101
  * Finds every own-key of `obj` not present in `allowList` and returns one LoaderWarning per
76
102
  * offender. Pure — no printing, no throwing. Severity is resolved against DEFAULT_POLICY at
@@ -99,6 +125,16 @@ export declare function findUnknownKeys(obj: Record<string, unknown>, allowList:
99
125
  * position map declined to place) and produces exactly the pre-#392 warning.
100
126
  */
101
127
  positionOf?: (key: string) => SourcePosition | undefined;
128
+ /**
129
+ * Skips a key entirely (issue #559) — no allow-list check, no warning. Passed by the ONE
130
+ * top-level workflow-key site in yaml-loader.ts, where `x-` keys are the author's namespace.
131
+ * The step site deliberately does NOT pass it: step keys are the #417 consumption registry, a
132
+ * closed set where an inert key is a load error by ratified policy — there is no namespace at
133
+ * step level.
134
+ *
135
+ * Optional, so every existing caller compiles and behaves byte-identically.
136
+ */
137
+ isExtension?: (key: string) => boolean;
102
138
  }): LoaderWarning[];
103
139
  /**
104
140
  * The SINGLE source of the `⚠ ` line format — every printer (the core plain wrappers in
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/workflow/diagnostics.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EA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,CAAC,GAAG,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IACzD;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC,GACA,aAAa,EAAE,CA8BjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAE5D"}
@@ -91,12 +91,12 @@ export function closestKey(key, allowList) {
91
91
  /**
92
92
  * Builds the templated "unknown key" message text (everything after the `⚠ ` prefix).
93
93
  *
94
- * The position is spliced in HERE, at the mint, rather than at any render site (issue #392). Two
95
- * reasons. `renderLoaderWarning` is the single source of the `⚠ ` line format and stays
96
- * byte-untouched, so nothing downstream has to learn about positions. And the CLI's #170
97
- * substitution rewrites `— ignored` at print time for a refusing boundary inserting before that
98
- * anchor leaves it intact, whereas inserting after it would leave the two edits fighting over the
99
- * same span.
94
+ * The position is spliced in HERE, at the mint, rather than at any render site (issue #392):
95
+ * `renderLoaderWarning` is the single source of the `⚠ ` line format and stays byte-untouched, so
96
+ * nothing downstream has to learn about positions. (Issue #540 removed the one other reason this
97
+ * comment used to give a CLI print-time substitution that rewrote `— ignored` for a refusing
98
+ * boundary, and whose anchor this splice point had to land before. That substitution is gone;
99
+ * `— ignored` now renders unmodified everywhere. See `plans/issue-540/design-d2.md`.)
100
100
  *
101
101
  * The prose carries the START line only. A human reading an error wants somewhere to look, not a
102
102
  * range; the range lives on the structured channel where a span-editing agent can use it.
@@ -111,6 +111,32 @@ function renderUnknownKeyMessage(target, key, didYouMean, noun, line) {
111
111
  }
112
112
  return `${target}: unknown key '${key}'${at} — ignored (not a recognized ${noun} field).`;
113
113
  }
114
+ /**
115
+ * The author-extension namespace (issue #559). A top-level key beginning `x-` is the AUTHOR's:
116
+ * realm carries it verbatim into the registered copy and never reads it — a place for YAML
117
+ * anchor hosts (e.g. a shared enum) and tooling notes. Docker Compose's `^x-` is the same
118
+ * mechanism, and its own docs direct anchors into it.
119
+ *
120
+ * `x-realm-` is reserved for realm's own future extension keys from the day the namespace
121
+ * opens — so a key in it is NOT an extension key and still refuses, with a message naming the
122
+ * reservation (OpenAPI reserved `x-oai-`/`x-oas-` only retroactively; realm does it up front).
123
+ *
124
+ * The reserved sub-namespace is matched in EVERY capitalization — `x-Realm-foo` and `x-REALM-foo`
125
+ * are NOT the author's keys (issue #582): the reservation exists so no case-variant can sit
126
+ * beside a future realm key, so it must not depend on the author's Shift key. The reservation is
127
+ * the PREFIX `x-realm-` (OpenAPI reserves `x-oai-` the same way): the dash-less word `x-realm` is
128
+ * the author's.
129
+ *
130
+ * Case-sensitive: `X-Foo` is not an extension key (OpenAPI's and Compose's `^x-` are lowercase).
131
+ * The dash is load-bearing: `xtra` is not one. A bare `x-` IS one — an empty extension name is
132
+ * still the author's; it renders as `x-` in the disclosure clause.
133
+ */
134
+ export const EXTENSION_KEY_PREFIX = 'x-';
135
+ export const RESERVED_EXTENSION_PREFIX = 'x-realm-';
136
+ /** True when `key` is the author's own extension key (see `EXTENSION_KEY_PREFIX`). */
137
+ export function isExtensionKey(key) {
138
+ return (key.startsWith(EXTENSION_KEY_PREFIX) && !key.toLowerCase().startsWith(RESERVED_EXTENSION_PREFIX));
139
+ }
114
140
  /**
115
141
  * Finds every own-key of `obj` not present in `allowList` and returns one LoaderWarning per
116
142
  * offender. Pure — no printing, no throwing. Severity is resolved against DEFAULT_POLICY at
@@ -122,6 +148,8 @@ export function findUnknownKeys(obj, allowList, ctx) {
122
148
  const target = ctx.scope === 'workflow' ? `workflow '${ctx.id ?? '<unknown>'}'` : `step '${ctx.step}'`;
123
149
  const noun = ctx.noun ?? ctx.scope;
124
150
  for (const key of Object.keys(obj)) {
151
+ if (ctx.isExtension?.(key) === true)
152
+ continue;
125
153
  if (allowList.includes(key))
126
154
  continue;
127
155
  const did_you_mean = closestKey(key, allowList);
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.js","sourceRoot":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D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAgB;IAClD,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;AAC1B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { WorkflowDefinition } from '../types/workflow-definition.js';
2
+ import type { RunRecord } from '../types/run-record.js';
2
3
  export interface WorkflowRegistrar {
3
4
  /** Persist a WorkflowDefinition under its id, overwriting any previous registration. */
4
5
  register(definition: WorkflowDefinition): Promise<void>;
@@ -43,4 +44,45 @@ export declare class JsonWorkflowStore implements WorkflowRegistrar {
43
44
  }>;
44
45
  }>;
45
46
  }
47
+ /**
48
+ * Fetches the workflow definition a run-context resolution needs, wrapping a
49
+ * `STATE_WORKFLOW_NOT_FOUND` throw with the one-time-register remedy (issue #456) — the ONE
50
+ * chokepoint every run-context site (`respond`, `resume`, `replay`, `drain`, `agent --run-id`,
51
+ * and the MCP `submit_human_response`/`execute_step`/`append_trace` tools) calls, instead of each
52
+ * hand-wrapping its own raw `store.get(run.workflow_id)`.
53
+ *
54
+ * The `store` and `run` parameters are narrowed to exactly what this function uses
55
+ * (`Pick<WorkflowRegistrar, 'get'>` / `Pick<RunRecord, 'workflow_id'>`) — by necessity, not taste:
56
+ * `resolveRunAttach`'s own dependency type IS that narrower `Pick` (its test doubles are get-only,
57
+ * and a full `WorkflowRegistrar` parameter here would not compile at that call site). Every other
58
+ * caller passes a full registrar and a full run record, both structurally assignable to the
59
+ * narrower type.
60
+ *
61
+ * HEDGED reasoning, moved here from `run-attach.ts`'s inline comment (its call site now just
62
+ * points back here): this function genuinely cannot know WHY the workflow is missing. A wiped
63
+ * store, a different `$HOME`, and a run created from a file without `--register` all mint the
64
+ * identical `STATE_WORKFLOW_NOT_FOUND` from the registrar — so the remedy says "most often",
65
+ * never "because". Keyed on the stable error CODE, never on message text.
66
+ *
67
+ * PRECONDITION — run-context resolution ONLY. A by-id lookup with no run behind it (`start_run`,
68
+ * `start_run_batch`, `get_workflow_protocol`) must never call this: there the hedge would be
69
+ * false — "this run was created from a file without --register" presumes a run that does not
70
+ * exist yet.
71
+ *
72
+ * Every OTHER `WorkflowError` (e.g. `STATE_LEGACY_FORMAT`, which already carries its own correct
73
+ * "Re-register it with: …" remedy) passes through completely untouched, by identity — wrapping it
74
+ * would double-remedy. A non-`WorkflowError` throw also passes through untouched.
75
+ *
76
+ * issue #493 seam: if definition snapshots ever land on the run record, the snapshot-wins
77
+ * resolution order belongs INSIDE this function — every run-context caller updates for free.
78
+ *
79
+ * @param store Anything that can `.get()` a workflow by id.
80
+ * @param run The run whose `workflow_id` to resolve.
81
+ * @param opts `retryVerb` — the verb this call site's remedy should recommend retrying with
82
+ * (e.g. `'re-attach'`, `'respond again'`, `'resume again'`, `'replay again'`,
83
+ * `'drain again'`, or the MCP-neutral `'retry'`).
84
+ */
85
+ export declare function getWorkflowForRun(store: Pick<WorkflowRegistrar, 'get'>, run: Pick<RunRecord, 'workflow_id'>, opts: {
86
+ retryVerb: string;
87
+ }): Promise<WorkflowDefinition>;
46
88
  //# sourceMappingURL=registrar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/workflow/registrar.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAK1E,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8EAA8E;IAC9E,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrD,qCAAqC;IACrC,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IACzD,OAAO,CAAC,QAAQ,CAAC,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AC,IAAI,CAAC;IAOvD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgCpD,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAQ3C;;;;;;;;;;;;;;OAcG;IACG,mBAAmB,IAAI,OAAO,CAAC;QACnC,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,UAAU,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACpD,UAAU,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjD,CAAC;CAqBH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,EACrC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EACnC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAoB7B"}
@@ -89,4 +89,61 @@ export class JsonWorkflowStore {
89
89
  return { workflows, unreadable, mismatched };
90
90
  }
91
91
  }
92
+ /**
93
+ * Fetches the workflow definition a run-context resolution needs, wrapping a
94
+ * `STATE_WORKFLOW_NOT_FOUND` throw with the one-time-register remedy (issue #456) — the ONE
95
+ * chokepoint every run-context site (`respond`, `resume`, `replay`, `drain`, `agent --run-id`,
96
+ * and the MCP `submit_human_response`/`execute_step`/`append_trace` tools) calls, instead of each
97
+ * hand-wrapping its own raw `store.get(run.workflow_id)`.
98
+ *
99
+ * The `store` and `run` parameters are narrowed to exactly what this function uses
100
+ * (`Pick<WorkflowRegistrar, 'get'>` / `Pick<RunRecord, 'workflow_id'>`) — by necessity, not taste:
101
+ * `resolveRunAttach`'s own dependency type IS that narrower `Pick` (its test doubles are get-only,
102
+ * and a full `WorkflowRegistrar` parameter here would not compile at that call site). Every other
103
+ * caller passes a full registrar and a full run record, both structurally assignable to the
104
+ * narrower type.
105
+ *
106
+ * HEDGED reasoning, moved here from `run-attach.ts`'s inline comment (its call site now just
107
+ * points back here): this function genuinely cannot know WHY the workflow is missing. A wiped
108
+ * store, a different `$HOME`, and a run created from a file without `--register` all mint the
109
+ * identical `STATE_WORKFLOW_NOT_FOUND` from the registrar — so the remedy says "most often",
110
+ * never "because". Keyed on the stable error CODE, never on message text.
111
+ *
112
+ * PRECONDITION — run-context resolution ONLY. A by-id lookup with no run behind it (`start_run`,
113
+ * `start_run_batch`, `get_workflow_protocol`) must never call this: there the hedge would be
114
+ * false — "this run was created from a file without --register" presumes a run that does not
115
+ * exist yet.
116
+ *
117
+ * Every OTHER `WorkflowError` (e.g. `STATE_LEGACY_FORMAT`, which already carries its own correct
118
+ * "Re-register it with: …" remedy) passes through completely untouched, by identity — wrapping it
119
+ * would double-remedy. A non-`WorkflowError` throw also passes through untouched.
120
+ *
121
+ * issue #493 seam: if definition snapshots ever land on the run record, the snapshot-wins
122
+ * resolution order belongs INSIDE this function — every run-context caller updates for free.
123
+ *
124
+ * @param store Anything that can `.get()` a workflow by id.
125
+ * @param run The run whose `workflow_id` to resolve.
126
+ * @param opts `retryVerb` — the verb this call site's remedy should recommend retrying with
127
+ * (e.g. `'re-attach'`, `'respond again'`, `'resume again'`, `'replay again'`,
128
+ * `'drain again'`, or the MCP-neutral `'retry'`).
129
+ */
130
+ export async function getWorkflowForRun(store, run, opts) {
131
+ try {
132
+ return await store.get(run.workflow_id);
133
+ }
134
+ catch (err) {
135
+ if (err instanceof WorkflowError && err.code === 'STATE_WORKFLOW_NOT_FOUND') {
136
+ throw new WorkflowError(`${err.message} — most often this run was created from a file without --register. ` +
137
+ `Register the workflow (realm workflow register <file>) and ${opts.retryVerb}.`, {
138
+ code: err.code,
139
+ category: err.category,
140
+ agentAction: err.agentAction,
141
+ retryable: err.retryable,
142
+ details: err.details,
143
+ ...(err.warnings !== undefined ? { warnings: err.warnings } : {}),
144
+ });
145
+ }
146
+ throw err;
147
+ }
148
+ }
92
149
  //# sourceMappingURL=registrar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/workflow/registrar.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAW3D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACX,GAAG,CAAS;IAE7B,YAAY,OAAgB;QAC1B,IAAI,CAAC,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAA8B;QAC3C,MAAM,eAAe,CACnB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,EAAE,OAAO,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CACpC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,UAAkB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;QACtD,IAAI,GAAW,C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