@sensigo/realm 0.32.0 → 0.34.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.
- package/dist/engine/abandon-run.d.ts.map +1 -1
- package/dist/engine/abandon-run.js +17 -9
- package/dist/engine/abandon-run.js.map +1 -1
- package/dist/engine/apply-resume.d.ts +11 -2
- package/dist/engine/apply-resume.d.ts.map +1 -1
- package/dist/engine/apply-resume.js +15 -4
- package/dist/engine/apply-resume.js.map +1 -1
- package/dist/engine/eligibility.d.ts +20 -2
- package/dist/engine/eligibility.d.ts.map +1 -1
- package/dist/engine/eligibility.js +46 -24
- package/dist/engine/eligibility.js.map +1 -1
- package/dist/engine/execution-loop.d.ts +29 -5
- package/dist/engine/execution-loop.d.ts.map +1 -1
- package/dist/engine/execution-loop.js +1152 -90
- package/dist/engine/execution-loop.js.map +1 -1
- package/dist/engine/gate-timing.d.ts +17 -0
- package/dist/engine/gate-timing.d.ts.map +1 -0
- package/dist/engine/gate-timing.js +19 -0
- package/dist/engine/gate-timing.js.map +1 -0
- package/dist/engine/reclaim-step.d.ts +8 -0
- package/dist/engine/reclaim-step.d.ts.map +1 -1
- package/dist/engine/reclaim-step.js +48 -3
- package/dist/engine/reclaim-step.js.map +1 -1
- package/dist/engine/run-health.d.ts +1 -1
- package/dist/engine/run-health.d.ts.map +1 -1
- package/dist/engine/run-health.js +100 -2
- package/dist/engine/run-health.js.map +1 -1
- package/dist/engine/settlement.d.ts +56 -7
- package/dist/engine/settlement.d.ts.map +1 -1
- package/dist/engine/settlement.js +690 -37
- package/dist/engine/settlement.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/store/json-file-store.d.ts +6 -4
- package/dist/store/json-file-store.d.ts.map +1 -1
- package/dist/store/json-file-store.js +26 -9
- package/dist/store/json-file-store.js.map +1 -1
- package/dist/store/store-interface.d.ts +11 -8
- package/dist/store/store-interface.d.ts.map +1 -1
- package/dist/types/response-envelope.d.ts +16 -0
- package/dist/types/response-envelope.d.ts.map +1 -1
- package/dist/types/run-record.d.ts +132 -3
- package/dist/types/run-record.d.ts.map +1 -1
- package/dist/types/settlement.d.ts +164 -11
- package/dist/types/settlement.d.ts.map +1 -1
- package/dist/types/workflow-definition.d.ts +113 -32
- package/dist/types/workflow-definition.d.ts.map +1 -1
- package/dist/types/workflow-definition.js +20 -0
- package/dist/types/workflow-definition.js.map +1 -1
- package/dist/workflow/diagnostics.d.ts +1 -1
- package/dist/workflow/diagnostics.d.ts.map +1 -1
- package/dist/workflow/diagnostics.js +3 -0
- package/dist/workflow/diagnostics.js.map +1 -1
- package/dist/workflow/structured-output-eligibility.d.ts +81 -0
- package/dist/workflow/structured-output-eligibility.d.ts.map +1 -0
- package/dist/workflow/structured-output-eligibility.js +359 -0
- package/dist/workflow/structured-output-eligibility.js.map +1 -0
- package/dist/workflow/yaml-loader.d.ts.map +1 -1
- package/dist/workflow/yaml-loader.js +145 -2
- package/dist/workflow/yaml-loader.js.map +1 -1
- package/package.json +1 -1
|
@@ -72,6 +72,54 @@ export interface TraceNormalizationSummary {
|
|
|
72
72
|
*/
|
|
73
73
|
foreign_lines_preserved?: number;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Issue #236 (L0 prevention layer) — the observables-only disclosure vocabulary for a
|
|
77
|
+
* `structured_output: 'strict'`-declared step's attempt. Deliberately carries NO `applied`
|
|
78
|
+
* field (unwitnessable — a silently-stripping proxy could accept `strict` on the wire and never
|
|
79
|
+
* honor it; `sent` only ever claims "realm placed strict on the request handed to the SDK", never
|
|
80
|
+
* that the API enforced it). Per-attempt: a retry-configured step's evidence array can carry a
|
|
81
|
+
* different value per attempt. `requested` is always `true` when this object is present at all —
|
|
82
|
+
* it exists ONLY on a step that declared `structured_output: 'strict'`.
|
|
83
|
+
*/
|
|
84
|
+
export interface StructuredOutputMeta {
|
|
85
|
+
/** Always `true` — this object's mere presence already implies it; kept explicit so a reader
|
|
86
|
+
* never has to special-case "object present but requested:false". */
|
|
87
|
+
requested: true;
|
|
88
|
+
/** Whether realm actually placed `strict: true` on the request it handed to the SDK for the
|
|
89
|
+
* attempt THIS diagnostics object describes. Absent on a synthesized stamp (`external_agent`)
|
|
90
|
+
* where no request was ever made by realm at all. */
|
|
91
|
+
sent?: boolean;
|
|
92
|
+
/** Caveat codes from `assessStructuredOutputEligibility`'s `eligible_with_caveats` verdict —
|
|
93
|
+
* present only when `sent` is `true` and the schema carried caveats (never on an `ineligible`
|
|
94
|
+
* attempt, where strict was never sent at all). */
|
|
95
|
+
caveats?: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Why `sent` is `false` (absent when `sent` is `true`):
|
|
98
|
+
* - `gate_ineligible` — the Phase-B verdict was `ineligible`; strict was never attempted.
|
|
99
|
+
* - `api_rejected_schema` — a live 400 on a strict-carrying request; realm dropped strict and
|
|
100
|
+
* retried once.
|
|
101
|
+
* - `grammar_unavailable` — a live 503 whose message matched Anthropic's captured
|
|
102
|
+
* grammar-compilation-unavailable text.
|
|
103
|
+
* - `service_unavailable` — a live 503 that did NOT match the grammar text (a generic overload
|
|
104
|
+
* — fail-safe default label for any non-matching 503).
|
|
105
|
+
* - `provider_unsupported` — the configured LLM provider does not implement `callStepWithMeta`
|
|
106
|
+
* (a third-party `--provider-module` that only implements the base `callStep`).
|
|
107
|
+
* - `unsupported_context_tools` — the step declares `tools` (G6 — v1 never supports strict on
|
|
108
|
+
* a tools-bearing step).
|
|
109
|
+
* - `external_agent` — the step declared `structured_output: 'strict'` but was driven by
|
|
110
|
+
* something other than `realm agent` (e.g. an external agent calling `execute_step` over
|
|
111
|
+
* MCP directly) — no `stepMeta.structuredOutput` was ever attached, so realm cannot know
|
|
112
|
+
* whether strict was honored at all.
|
|
113
|
+
*/
|
|
114
|
+
downgrade_reason?: 'gate_ineligible' | 'api_rejected_schema' | 'grammar_unavailable' | 'service_unavailable' | 'provider_unsupported' | 'unsupported_context_tools' | 'external_agent';
|
|
115
|
+
/** The raw API error message, when a live 400/503 drove a downgrade — attached verbatim,
|
|
116
|
+
* never rewritten, so an operator can compare against Anthropic's own documented error text. */
|
|
117
|
+
api_message?: string;
|
|
118
|
+
/** Whether the model's output arrived via the submit tool (`tool_use.input`, pre-parsed) or as
|
|
119
|
+
* extracted text — the standing dodge detector (design record R-B): a schema shaped to make
|
|
120
|
+
* the model prefer a text answer over the strict-constrained tool would show up here. */
|
|
121
|
+
submission_channel?: 'tool' | 'text';
|
|
122
|
+
}
|
|
75
123
|
/** Diagnostic metadata captured during step execution. Written once; read by inspect. */
|
|
76
124
|
export interface StepDiagnostics {
|
|
77
125
|
/** Rough token count estimate: Math.ceil(JSON.stringify(input).length / 4) */
|
|
@@ -100,6 +148,9 @@ export interface StepDiagnostics {
|
|
|
100
148
|
* even one that previously accrued rejections, carries only `validation_rejections` here.
|
|
101
149
|
*/
|
|
102
150
|
settled_by_default?: boolean;
|
|
151
|
+
/** Issue #236 — disclosure for a `structured_output: 'strict'`-declared step's attempt. See
|
|
152
|
+
* {@link StructuredOutputMeta}. Absent on a step that never declared `structured_output`. */
|
|
153
|
+
structured_output?: StructuredOutputMeta;
|
|
103
154
|
}
|
|
104
155
|
export interface EvidenceSnapshot {
|
|
105
156
|
step_id: string;
|
|
@@ -120,6 +171,21 @@ export interface EvidenceSnapshot {
|
|
|
120
171
|
* This is an evidence integrity field: it records exactly what the human read.
|
|
121
172
|
*/
|
|
122
173
|
gate_message?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Issue #279 (increment 2, PR-D; design record D-5): unenforced attribution passthrough for a
|
|
176
|
+
* gate resolution — the caller-supplied identity of whoever made this gate choice, when
|
|
177
|
+
* supplied. RECORDED, not enforced (D-5: the bearer-gateId-as-sole-credential model stays the
|
|
178
|
+
* authority; no arm reads this field). Present only on `gate_response` evidence entries whose
|
|
179
|
+
* caller supplied `respondedBy`/`responded_by`.
|
|
180
|
+
*/
|
|
181
|
+
responded_by?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Issue #291 (D1 §5 / [F12]): present only on a `gate_response` snapshot minted by
|
|
184
|
+
* `applyExpireGate` — discriminates WHICH enforce-clock disposition produced this snapshot,
|
|
185
|
+
* for the late-response envelope strings to read. `responded_by` on the SAME snapshot is
|
|
186
|
+
* always the literal `'timeout'` when this field is present (never a human identity).
|
|
187
|
+
*/
|
|
188
|
+
resolution?: 'expired_default' | 'expired_abort';
|
|
123
189
|
/** Diagnostic metadata. Present on snapshots captured after Week 7. */
|
|
124
190
|
diagnostics?: StepDiagnostics;
|
|
125
191
|
/** Name of the agent profile active at this step, if any. */
|
|
@@ -217,6 +283,32 @@ export interface PendingGate {
|
|
|
217
283
|
* The CLI reads the message for the chosen key and posts it to the thread.
|
|
218
284
|
*/
|
|
219
285
|
resolution_messages?: Record<string, string>;
|
|
286
|
+
/**
|
|
287
|
+
* Issue #291 (mint-time freeze, F2 — the definition-drift-livelock cure): the gate's own
|
|
288
|
+
* `GateConfig` timeout/notify fields, denormalized into the RECORD at mint
|
|
289
|
+
* (execution-loop.ts's gate-open site — the `ClaimRecord.deadline`/#302 uniform-epoch-freeze
|
|
290
|
+
* precedent). Every enactment/notification/read-side surface reads THESE fields, never the
|
|
291
|
+
* workflow definition's `gate:` block — a definition edited after this gate opened (new
|
|
292
|
+
* `choices`, a changed `default_choice`) never applies to an already-open gate. A gate minted
|
|
293
|
+
* before this feature shipped (or by an old binary that silently ignored these `gate:`
|
|
294
|
+
* sub-keys) has NONE of these fields — grandfathered: finding-silent, reminder-silent, never
|
|
295
|
+
* enacted (R-d).
|
|
296
|
+
*/
|
|
297
|
+
/** ISO-8601 deadline = `opened_at + gate.timeout_seconds`. Absent = no enforce clock (the gate
|
|
298
|
+
* never expires — grandfathered or the author declared no `timeout_seconds`). */
|
|
299
|
+
expires_at?: string;
|
|
300
|
+
/** Frozen copy of `gate.on_expiry`. Present only when `expires_at` is (a `timeout_seconds` with
|
|
301
|
+
* no `on_expiry` is LEGAL finding-only mode: `expires_at` present, this absent). */
|
|
302
|
+
on_expiry?: 'settle_default' | 'abort';
|
|
303
|
+
/** Frozen copy of `gate.default_choice`. Present iff `on_expiry === 'settle_default'`. */
|
|
304
|
+
default_choice?: string;
|
|
305
|
+
/** Frozen copy of `gate.reminder_seconds` — the authored notify clock. Standalone-legal
|
|
306
|
+
* (present without `expires_at` = a pure-notify gate). Absent = no authored reminder (the
|
|
307
|
+
* operator's `reminderIntervalMs` config, if any, is the fallback — record-keyed precedence). */
|
|
308
|
+
reminder_seconds?: number;
|
|
309
|
+
/** Frozen copy of `gate.reminder_max`, defaulted to 3 at mint when `reminder_seconds` is
|
|
310
|
+
* present and the author declared no explicit value. Absent iff `reminder_seconds` is. */
|
|
311
|
+
reminder_max?: number;
|
|
220
312
|
}
|
|
221
313
|
/**
|
|
222
314
|
* Derived phase of a workflow run. Always computed from the four step sets and run state;
|
|
@@ -322,6 +414,27 @@ export type SkipDetail = {
|
|
|
322
414
|
*/
|
|
323
415
|
| {
|
|
324
416
|
kind: 'gate_cancelled_by_abort';
|
|
417
|
+
/**
|
|
418
|
+
* Issue #279 (increment 2, PR-D; design record §5 D-4): the cancelled gate's `gate_id` —
|
|
419
|
+
* additive, so pre-PR-D cancel records (which lack this field) remain valid; the settle_gate
|
|
420
|
+
* `run_terminal` envelope's cancelled-variant discriminator binds by skip-detail PRESENCE for
|
|
421
|
+
* those (N10), and by `gate_id` equality once this field is populated.
|
|
422
|
+
*/
|
|
423
|
+
gate_id?: string;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Issue #291 (F9, day-one gate_id): stamped on a gate's OWN step by `applyExpireGate`'s abort
|
|
427
|
+
* disposition — the enforce clock expired and no human responded, so the run aborted per the
|
|
428
|
+
* workflow's declared `on_expiry: 'abort'`. Distinct from `gate_cancelled_by_abort` (a
|
|
429
|
+
* DIFFERENT step's handler-abort cancelling this gate) — that would falsely claim "cancelled
|
|
430
|
+
* when '<other step>' aborted the run" for what is actually a timeout. `gate_id` is REQUIRED
|
|
431
|
+
* (not optional, unlike the cancelled variant's grandfathered-record allowance) — this kind
|
|
432
|
+
* was born with the field, so the run_terminal envelope's third discriminated variant binds by
|
|
433
|
+
* id equality from birth, never by presence alone.
|
|
434
|
+
*/
|
|
435
|
+
| {
|
|
436
|
+
kind: 'gate_expired';
|
|
437
|
+
gate_id: string;
|
|
325
438
|
};
|
|
326
439
|
export interface RunRecord {
|
|
327
440
|
id: string;
|
|
@@ -467,12 +580,28 @@ export interface RunRecord {
|
|
|
467
580
|
* membership in the SAME atomic write) — it exists so a hand-authored fixture / an external
|
|
468
581
|
* store's own divergent history cannot wedge the predicate.
|
|
469
582
|
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
583
|
+
* Issue #279 (increment 2, PR-C): `outcome` gains `'gate'` — a resolved human-gate entry
|
|
584
|
+
* (`settleGateArms`'s APPLY writes `outcome: 'gate'` LITERALLY; `toSettledOutcome`'s own
|
|
585
|
+
* `SettleStepOutcome` domain stays untouched — a `settle_step` delta can never produce a
|
|
586
|
+
* `'gate'` entry, only `settle_gate` can). `choice` is set IFF `outcome === 'gate'` — the
|
|
587
|
+
* human's resolved choice, mirrored from `SettleGateDelta.choice`.
|
|
588
|
+
*
|
|
589
|
+
* Shipped in v0.32.0 (PR-B migrated the three seal sites to `settleStep`) — the "dormant until
|
|
590
|
+
* PR-B" framing below is stale for the `'complete'|'fail'|'skip'` outcomes; `'gate'` itself
|
|
591
|
+
* stays dormant until PR-D migrates the gate-resolution site.
|
|
472
592
|
*/
|
|
473
593
|
settled?: Record<string, {
|
|
474
594
|
token: string | null;
|
|
475
|
-
outcome: 'complete' | 'fail' | 'skip';
|
|
595
|
+
outcome: 'complete' | 'fail' | 'skip' | 'gate';
|
|
596
|
+
choice?: string;
|
|
597
|
+
/**
|
|
598
|
+
* Issue #291 (D1 §5, carried; the module-local `SettledEntry` alias in settlement.ts
|
|
599
|
+
* projects THIS field): present, and only ever `'timeout'`, on a `'gate'` entry written by
|
|
600
|
+
* `applyExpireGate`'s settle_default disposition — attributes the resolution to the enforce
|
|
601
|
+
* clock rather than a human. Absent = a human resolved it (backward-clean: every pre-#291
|
|
602
|
+
* `'gate'` entry lacks this field). Never set by any other arm.
|
|
603
|
+
*/
|
|
604
|
+
resolved_by?: 'timeout';
|
|
476
605
|
}>;
|
|
477
606
|
/**
|
|
478
607
|
* Issue #279 (increment 1, PR-A): the record-as-outbox finalizer ledger, keyed by finalizer step
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-record.d.ts","sourceRoot":"","sources":["../../src/types/run-record.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CACrE;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,0EAA0E;AAC1E,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gCAAgC,EAAE,MAAM,CAAC;IACzC,0B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AM,CACd,MAAM,EACN;QACE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;QAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;;;WAMG;QACH,WAAW,CAAC,EAAE,SAAS,CAAC;KACzB,CACF,CAAC;IACF;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CAAC,EAAE,MAAM,CACvB,MAAM,EACN;QACE,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;QACtD,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CACF,CAAC;CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EvidenceSnapshot } from './run-record.js';
|
|
1
|
+
import type { EvidenceSnapshot, PendingGate } from './run-record.js';
|
|
2
2
|
/** The three outcomes a `settle_step` delta's caller can report for the step being settled —
|
|
3
3
|
* mirrors the THREE seal call sites (:2560 complete, :2220 fail, :1784 handler-abort) this
|
|
4
4
|
* increment's transform is bound to by line (design record §3). */
|
|
@@ -70,24 +70,159 @@ export interface MarkFinalizerDelta {
|
|
|
70
70
|
result: MarkFinalizerResult;
|
|
71
71
|
evidence: EvidenceSnapshot;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Opens a human gate on a claimed step (issue #279, increment 2, PR-C; design record
|
|
75
|
+
* `design-d5-increment2.md` §2/§3 `openGateArms`). `pendingGate` is carried VERBATIM into
|
|
76
|
+
* `RunRecord.pending_gate` — the transform never re-derives or re-shapes it; the caller (the
|
|
77
|
+
* migrated gate-open site, PR-D) builds the full {@link PendingGate} object (gate_id, choices,
|
|
78
|
+
* preview, etc.) exactly as the legacy `store.update()` call at execution-loop.ts:2956-2995 does
|
|
79
|
+
* today. `claimToken` is compared the same absent≡absent way `SettleStepDelta.claimToken` is.
|
|
80
|
+
*/
|
|
81
|
+
export interface OpenGateDelta {
|
|
82
|
+
kind: 'open_gate';
|
|
83
|
+
step: string;
|
|
84
|
+
claimToken?: string;
|
|
85
|
+
pendingGate: PendingGate;
|
|
86
|
+
evidence: EvidenceSnapshot[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Resolves an open gate with a human's choice (issue #279, increment 2, PR-C; design record §2/§3
|
|
90
|
+
* `settleGateArms`). Fenced by `gateId` ONLY — zero claim arms (§3's own note: "fence = gateId
|
|
91
|
+
* ONLY (L20)"), since a gate's authority is bearer-gateId-credentialed (D-5: RECORDED, not
|
|
92
|
+
* enforced — `respondedBy` below is an evidence passthrough, read by no arm).
|
|
93
|
+
*/
|
|
94
|
+
export interface SettleGateDelta {
|
|
95
|
+
kind: 'settle_gate';
|
|
96
|
+
gateId: string;
|
|
97
|
+
choice: string;
|
|
98
|
+
/** Unenforced attribution passthrough (design record D-5, pedestal fold) — flows into the
|
|
99
|
+
* gate_response evidence snapshot the migrated caller (PR-D) builds; no arm in this file ever
|
|
100
|
+
* reads it. Omit when the caller has no attribution to record. */
|
|
101
|
+
respondedBy?: string;
|
|
102
|
+
evidence: EvidenceSnapshot[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Records a guard step's evaluated outcome (issue #279, increment 2, PR-C; design record §2/§3
|
|
106
|
+
* `settleGuardArms`). Guards are never claimed (`eligibility.ts:418` — `findEligibleGuardSteps`
|
|
107
|
+
* has no claim concept), so this delta carries no `claimToken` at all — fence = ⊥. `evidence` is
|
|
108
|
+
* SINGULAR (the `MarkFinalizerDelta` precedent — one guard evaluation, one evidence snapshot),
|
|
109
|
+
* unlike `SettleStepDelta.evidence`'s array.
|
|
110
|
+
*
|
|
111
|
+
* `resolutionError` is REQUIRED when `outcome === 'resolution_error'`; `abort` is REQUIRED when
|
|
112
|
+
* `outcome === 'abort'` — a violation of either throws a plain contract-violation `Error` in the
|
|
113
|
+
* transform (the `settlement.ts:228-234` precedent), never a `WorkflowError` (a caller-programming
|
|
114
|
+
* error, not a predicate outcome).
|
|
115
|
+
*/
|
|
116
|
+
export interface SettleGuardDelta {
|
|
117
|
+
kind: 'settle_guard';
|
|
118
|
+
step: string;
|
|
119
|
+
outcome: 'pass' | 'resolution_error' | 'abort';
|
|
120
|
+
evidence: EvidenceSnapshot;
|
|
121
|
+
/** REQUIRED iff `outcome === 'resolution_error'` — feeds the terminal_reason string minted at
|
|
122
|
+
* execution-loop.ts:3671 ("Guard step '<s>' failed: unresolvable path '<p>'"). */
|
|
123
|
+
resolutionError?: {
|
|
124
|
+
condition: string;
|
|
125
|
+
unresolvable_path: string;
|
|
126
|
+
};
|
|
127
|
+
/** REQUIRED iff `outcome === 'abort'` — mirrors `RunRecord.aborted_at`'s shipped shape
|
|
128
|
+
* (`run-record.ts:426-430`, the `GuardConditionResult` object array — NOT `string[]`; a
|
|
129
|
+
* record defect in an earlier design draft, corrected at the PR-C prompt audit). `step_id` on
|
|
130
|
+
* the eventual `aborted_at` payload is always `delta.step` — never carried separately here. */
|
|
131
|
+
abort?: {
|
|
132
|
+
conditions: Array<{
|
|
133
|
+
condition: string;
|
|
134
|
+
resolved_value: unknown;
|
|
135
|
+
passed: boolean;
|
|
136
|
+
}>;
|
|
137
|
+
abort_message?: string;
|
|
138
|
+
};
|
|
139
|
+
/** Forensic-only provenance (design record §2, lane-B steal 2 — the K8s `observedGeneration`
|
|
140
|
+
* analogue): the run version this guard's conditions were evaluated AGAINST, so a stale-
|
|
141
|
+
* predicate refusal is self-explaining (evaluated-at vs refused-at). Read by no arm. */
|
|
142
|
+
evaluatedAtVersion?: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Enacts a gate's frozen enforce-clock disposition once it has expired unresolved (issue #291;
|
|
146
|
+
* design record `plans/issue-291/design-d2.md` [F1]/[F2]/[F3] `applyExpireGate`). Fenced by
|
|
147
|
+
* `gateId` ONLY — same fencing shape as {@link SettleGateDelta} (a gate's authority is
|
|
148
|
+
* bearer-gateId-credentialed) — so a stale/duplicate expire attempt for a gate that has since
|
|
149
|
+
* been superseded (resolved by a human, or already expired by a racing enactment point) NOOPs or
|
|
150
|
+
* refuses rather than silently expiring the WRONG (newer) gate. Carries no caller-supplied
|
|
151
|
+
* `evidence`, unlike every other delta kind: the disposition (and therefore the evidence shape)
|
|
152
|
+
* is decided INSIDE `applyExpireGate` itself by reading the frozen `PendingGate` fields — the
|
|
153
|
+
* `applyAbortEdge` cancel-gate precedent (settlement.ts) for a transform building its own
|
|
154
|
+
* evidence via `captureEvidence` rather than a caller-supplied array.
|
|
155
|
+
*/
|
|
156
|
+
export interface ExpireGateDelta {
|
|
157
|
+
kind: 'expire_gate';
|
|
158
|
+
gateId: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Releases a claim without settling the step (issue #279, increment 2, PR-C; design record §2/§3
|
|
162
|
+
* `releaseStepArms`) — the shared shape behind BOTH the capability-block release
|
|
163
|
+
* (execution-loop.ts:2453-2529) and the compensating un-claim (execution-loop.ts:1607-1635).
|
|
164
|
+
* NEVER terminal, writes NO `settled` entry — the step returns to eligible.
|
|
165
|
+
*/
|
|
166
|
+
export interface ReleaseStepDelta {
|
|
167
|
+
kind: 'release_step';
|
|
168
|
+
step: string;
|
|
169
|
+
claimToken?: string;
|
|
170
|
+
/** Optional-additive capability-block marker merge (execution-loop.ts:2461-2475 semantics). */
|
|
171
|
+
capabilityBlock?: {
|
|
172
|
+
requirement: {
|
|
173
|
+
kind: 'handler' | 'adapter';
|
|
174
|
+
name: string;
|
|
175
|
+
};
|
|
176
|
+
code: string;
|
|
177
|
+
};
|
|
178
|
+
/** Optional-additive evidence append (execution-loop.ts:679 semantics — the compensating
|
|
179
|
+
* un-claim's own audit snapshot). Absent for a capability-block release, which appends its
|
|
180
|
+
* evidence via `allEvidence` at the migrated call site instead (PR-D concern). */
|
|
181
|
+
evidence?: EvidenceSnapshot[];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The delta kinds `RunStore.settleStep` accepts (design record §1/§2). A concrete discriminated
|
|
185
|
+
* union — no structural intersections, no duck-typing.
|
|
186
|
+
*
|
|
187
|
+
* **Union-openness contract (issue #279, increment 2, PR-C — design record §2, angles fold 1):**
|
|
188
|
+
* this union is OPEN — kinds may be added in future minors (e.g. the increment-3 per-gate-timeout
|
|
189
|
+
* candidate on the design record's residuals list). A RE-IMPLEMENTING store (a multi-statement
|
|
190
|
+
* backend, e.g. a future Postgres store's `settleStepForTenant`) MUST refuse-loud (throw a
|
|
191
|
+
* contract-violation error) on an unrecognized `kind` — NEVER default-arm it. Silently applying an
|
|
192
|
+
* unrecognized kind's fields under a generic/default case is actively dangerous: `SettleGateDelta`
|
|
193
|
+
* has no `step` field at all, so a default-arm implementation reading `delta.step` would silently
|
|
194
|
+
* mis-write (write `undefined` as a step name) rather than crash where the bug is introduced.
|
|
195
|
+
*/
|
|
196
|
+
export type SettlementDelta = SettleStepDelta | LeaseFinalizerDelta | MarkFinalizerDelta | OpenGateDelta | SettleGateDelta | SettleGuardDelta | ReleaseStepDelta | ExpireGateDelta;
|
|
76
197
|
/**
|
|
77
198
|
* Every refusal/noop literal `applySettlement`/`settleStep` can RETURN as `SettlementResult.reason`
|
|
78
199
|
* (design record §7, the full table MINUS `drain_pending`) — `drain_pending` is the PR-B purge
|
|
79
200
|
* guard's own THROWN `STATE_RUN_BUSY` builder reason, never a `settleStep` return value, so it is
|
|
80
201
|
* deliberately excluded from this type (a `settleStep` implementation must never construct it).
|
|
81
202
|
*/
|
|
82
|
-
export type SettlementRefusalReason = 'already_settled' | 'already_leased' | 'already_marked' | 'already_settled_by_other' | 'settled_outcome_divergence' | 'run_terminal' | 'claim_lost' | 'gate_mismatch' | 'run_not_terminal' | 'ledger_not_pending' | 'lease_held' | 'lease_lost' | 'rank_blocked' | 'not_eligible'
|
|
203
|
+
export type SettlementRefusalReason = 'already_settled' | 'already_leased' | 'already_marked' | 'already_released' | 'already_open' | 'already_settled_by_other' | 'settled_outcome_divergence' | 'run_terminal' | 'claim_lost' | 'gate_mismatch' | 'run_not_terminal' | 'ledger_not_pending' | 'lease_held' | 'lease_lost' | 'rank_blocked' | 'not_eligible' | 'gate_choice_conflict' | 'choice_not_eligible' | 'gate_open_wait'
|
|
204
|
+
/** expire_gate only: `now < fresh.pending_gate.expires_at` — the enactment attempt is
|
|
205
|
+
* premature (arm-verified with the injectable `now`, never trusted from the caller). */
|
|
206
|
+
| 'not_expired'
|
|
207
|
+
/** expire_gate only: the gate's `expires_at` is present (so an expire delta was constructed
|
|
208
|
+
* at all) but `on_expiry` is absent — finding-only mode. Arm-level refusal, before APPLY;
|
|
209
|
+
* never enacted, only ever disclosed. */
|
|
210
|
+
| 'no_disposition'
|
|
211
|
+
/** settle_gate only ([F3] shape c): the live gate this delta targets has expired unresolved —
|
|
212
|
+
* a WRITE-FREE refusal (checked under the lock, before `choice_not_eligible`) so the caller
|
|
213
|
+
* can issue the caller-composed `expire_gate` delta as ITS OWN settleStep and compose the
|
|
214
|
+
* honest envelope from the enactment result, rather than resolving with a human choice that
|
|
215
|
+
* arrived after the enforce clock already won. */
|
|
216
|
+
| 'gate_expired_pending';
|
|
83
217
|
/**
|
|
84
218
|
* The ok-shaped NOOP subset of {@link SettlementRefusalReason} (design record §7: "ok-shaped
|
|
85
219
|
* NOOP" — envelope-calm, `context_hint` never `report_to_user`, I15). L1's "routine same-run
|
|
86
220
|
* fan-out produces ZERO refusals" acceptance sentence is stated against the NON-noop subset: a
|
|
87
|
-
* same-token retry landing as one of these
|
|
88
|
-
*
|
|
221
|
+
* same-token retry landing as one of these is an idempotent no-op, never counted as a refusal.
|
|
222
|
+
* L13/L21 discriminate on this sub-union explicitly. `already_released` (release_step) and
|
|
223
|
+
* `already_open` (open_gate) joined in increment 2, PR-C — design record §2/§7.
|
|
89
224
|
*/
|
|
90
|
-
export type SettlementNoopReason = 'already_settled' | 'already_leased' | 'already_marked';
|
|
225
|
+
export type SettlementNoopReason = 'already_settled' | 'already_leased' | 'already_marked' | 'already_released' | 'already_open';
|
|
91
226
|
/**
|
|
92
227
|
* Result of applying one {@link SettlementDelta} against fresh state (design record §2, normative
|
|
93
228
|
* — final-gate F5).
|
|
@@ -106,9 +241,12 @@ export type SettlementNoopReason = 'already_settled' | 'already_leased' | 'alrea
|
|
|
106
241
|
export type SettlementResult = {
|
|
107
242
|
applied: true;
|
|
108
243
|
run: import('./run-record.js').RunRecord;
|
|
109
|
-
/** Whether THIS apply caused the terminal false→true edge
|
|
110
|
-
*
|
|
111
|
-
*
|
|
244
|
+
/** Whether THIS apply caused the terminal false→true edge. `settle_step`, `settle_gate`
|
|
245
|
+
* (resolution-completes), and `settle_guard` (pass-completes) can all terminalize (issue
|
|
246
|
+
* #279, increment 2, PR-C; design record §2/§4) — a `lease_finalizer`/`mark_finalizer`
|
|
247
|
+
* delta's `isTerminal(fresh)` precondition means the run was already terminal both before
|
|
248
|
+
* and after, so it is always `false` for those two kinds; `open_gate`/`release_step` never
|
|
249
|
+
* terminalize by construction (design record §4.1). */
|
|
112
250
|
transitioned: boolean;
|
|
113
251
|
/** The current pending finalizer set on `run.finalizer_ledger`, by ascending `rank` —
|
|
114
252
|
* a convenience snapshot so a caller can decide whether to invoke the drain verb without
|
|
@@ -120,5 +258,20 @@ export type SettlementResult = {
|
|
|
120
258
|
applied: false;
|
|
121
259
|
reason: SettlementRefusalReason;
|
|
122
260
|
run: import('./run-record.js').RunRecord;
|
|
261
|
+
/** Present ONLY when `reason === 'already_open'` — the LIVE `pending_gate`, rendered
|
|
262
|
+
* VERBATIM (issue #279, increment 2, PR-C; design record §3 `openGateArms`: "D-1: LIVE
|
|
263
|
+
* gate wins, rendered VERBATIM"). Read by no other arm; a caller (PR-D) surfaces it as the
|
|
264
|
+
* NOOP's own data. */
|
|
265
|
+
gate?: PendingGate;
|
|
266
|
+
/** Present ONLY when `reason === 'gate_choice_conflict'` — the choice that already won
|
|
267
|
+
* (issue #279, increment 2, PR-C; design record §3 `settleGateArms`). */
|
|
268
|
+
winningChoice?: string;
|
|
269
|
+
/** Present ONLY when `reason === 'choice_not_eligible'` — the gate's valid choices (issue
|
|
270
|
+
* #279, increment 2, PR-C; design record §3 `settleGateArms`). */
|
|
271
|
+
choices?: string[];
|
|
272
|
+
/** Present ONLY when `reason === 'settled_outcome_divergence'` — a human-readable
|
|
273
|
+
* description of the persisted membership that conflicts with the delta's own outcome
|
|
274
|
+
* (issue #279, increment 2, PR-C; design record §3 `settleGuardArms`). */
|
|
275
|
+
persisted?: string;
|
|
123
276
|
};
|
|
124
277
|
//# sourceMappingURL=settlement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../../src/types/settlement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../../src/types/settlement.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAErE;;oEAEoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,iBAAiB,CAAC;IAC3B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;gFAC4E;IAC5E,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B;;;kFAG8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;gGAC4F;IAC5F,KAAK,CAAC,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;;uBAGuB;AACvB,M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,aAAa;AACf;;0CAE0C;GACxC,gBAAgB;AAClB;;;;mDAImD;GACjD,sBAAsB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAC9B,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAEhG;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gBAAgB,GACxB;IACE,OAAO,EAAE,IAAI,CAAC;IACd,GAAG,EAAE,OAAO,iBAAiB,EAAE,SAAS,CAAC;IACzC;;;;;4DAKwD;IACxD,YAAY,EAAE,OAAO,CAAC;IACtB;;;;0EAIsE;IACtE,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,uBAAuB,CAAC;IAChC,GAAG,EAAE,OAAO,iBAAiB,EAAE,SAAS,CAAC;IACzC;;;2BAGuB;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;8EAC0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;uEACmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;+EAE2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -3,9 +3,13 @@ export type ExecutionMode = 'auto' | 'agent' | 'guard' | 'finalizer';
|
|
|
3
3
|
/**
|
|
4
4
|
* Terminal outcome(s) a finalizer step matches. `execution: finalizer` steps run at the
|
|
5
5
|
* run's terminal transition (a workflow-level try/catch/finally): `complete` = success,
|
|
6
|
-
* `fail`/`abort` = catch, `always` = finally
|
|
6
|
+
* `fail`/`abort` = catch, `always` = finally, `completed_with_failed_steps` = a `complete`
|
|
7
|
+
* seal that still carries `failed_steps` (issue #302 — author-opt-in; fires IN ADDITION to
|
|
8
|
+
* `complete`/`always` on that specific seal shape; never fires on a clean complete or on a pure
|
|
9
|
+
* fail/abort seal — see `docs/reference/yaml-schema.md`'s `execution: finalizer` trigger table).
|
|
10
|
+
* OR-membership when given as an array.
|
|
7
11
|
*/
|
|
8
|
-
export type FinalizerTrigger = 'complete' | 'fail' | 'abort' | 'always';
|
|
12
|
+
export type FinalizerTrigger = 'complete' | 'fail' | 'abort' | 'always' | 'completed_with_failed_steps';
|
|
9
13
|
export interface ProtocolConfig {
|
|
10
14
|
/** Override for the generated quick-start paragraph. */
|
|
11
15
|
quick_start?: string;
|
|
@@ -105,6 +109,93 @@ export interface RetryConfig {
|
|
|
105
109
|
* posture as KNOWN_STEP_KEYS/KNOWN_WORKFLOW_KEYS (issue #144/#169).
|
|
106
110
|
*/
|
|
107
111
|
export declare const KNOWN_RETRY_KEYS: readonly ["max_attempts", "backoff", "base_delay_ms", "max_delay_ms", "on_timeout", "total_timeout_seconds"];
|
|
112
|
+
/**
|
|
113
|
+
* Gate configuration — choices available to the human reviewer, plus (issue #291) the authored
|
|
114
|
+
* enforce clock (`timeout_seconds`/`on_expiry`/`default_choice`) and the authored notify clock
|
|
115
|
+
* (`reminder_seconds`/`reminder_max`). See `docs/reference/yaml-schema.md`'s `structured_output`-
|
|
116
|
+
* adjacent `## Gate timeout` section for the full authoring/enactment/disclosure contract; the
|
|
117
|
+
* loader (`yaml-loader.ts`) is the normative validator for every field below.
|
|
118
|
+
*/
|
|
119
|
+
export interface GateConfig {
|
|
120
|
+
choices?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Slack user ID or handle of the person responsible for resolving this gate.
|
|
123
|
+
* Used for notification targeting and escalation.
|
|
124
|
+
* Optional — notifications work without it.
|
|
125
|
+
* Example: '@mihai.lupu' or 'U012AB3CD'
|
|
126
|
+
*/
|
|
127
|
+
owner?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Developer-authored template string presented to the human reviewer when this gate opens.
|
|
130
|
+
* Supports {{ context.resources.STEP.FIELD }} and {{ run.params.FIELD }} references.
|
|
131
|
+
* Resolved from run data at gate-open time. Fail-fast: unresolvable references cause
|
|
132
|
+
* a stop error rather than opening a gate with broken placeholder text.
|
|
133
|
+
* When absent, the Slack path falls back to formatGatePreviewForSlack(preview)
|
|
134
|
+
* and the MCP path falls back to step.prompt resolution (existing behavior).
|
|
135
|
+
*/
|
|
136
|
+
message?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Per-choice messages posted to the Slack thread when the gate resolves via Slack.
|
|
139
|
+
* Keys must match entries in `choices`. Values are plain text (not mrkdwn templates).
|
|
140
|
+
* Optional — when absent or when a choice has no entry, the generic fallback is used.
|
|
141
|
+
* Example:
|
|
142
|
+
* resolution_messages:
|
|
143
|
+
* send: "✅ Incident report sent to #incidents."
|
|
144
|
+
* reject: "❌ Draft discarded. Run will not continue."
|
|
145
|
+
*/
|
|
146
|
+
resolution_messages?: Record<string, string>;
|
|
147
|
+
/**
|
|
148
|
+
* Issue #291 — the authored ENFORCE clock: seconds after gate-open after which the gate is
|
|
149
|
+
* eligible for level-triggered enactment. Positive integer (E2, same convention as
|
|
150
|
+
* `timeout_seconds`/`retry.total_timeout_seconds`). Frozen into `PendingGate.expires_at` at
|
|
151
|
+
* mint (never re-read from the definition — kills the definition-drift livelock). A
|
|
152
|
+
* `timeout_seconds` with no `on_expiry` is LEGAL — finding-only mode: the run-health
|
|
153
|
+
* `gate_expired_awaiting_drive` finding fires, but no enactment point ever disposes it.
|
|
154
|
+
*/
|
|
155
|
+
timeout_seconds?: number;
|
|
156
|
+
/**
|
|
157
|
+
* Issue #291 — the disposition enacted once `timeout_seconds` elapses and no human has
|
|
158
|
+
* responded. `'settle_default'` resolves the gate with `default_choice` (REQUIRED alongside
|
|
159
|
+
* this value — a load-time hard error otherwise); `'abort'` aborts the run with skip-detail
|
|
160
|
+
* kind `'gate_expired'`. Absent (with `timeout_seconds` present) = finding-only mode: never
|
|
161
|
+
* enacted, only disclosed.
|
|
162
|
+
*/
|
|
163
|
+
on_expiry?: 'settle_default' | 'abort';
|
|
164
|
+
/**
|
|
165
|
+
* Issue #291 — the choice enacted on expiry when `on_expiry: 'settle_default'`. REQUIRED iff
|
|
166
|
+
* `on_expiry: 'settle_default'` (a load-time hard error otherwise); validated at load time
|
|
167
|
+
* against the step's own effective (static) choice set, exactly like a human's submitted
|
|
168
|
+
* choice is validated at resolve time. Dead-config warn when present without
|
|
169
|
+
* `on_expiry: 'settle_default'`.
|
|
170
|
+
*/
|
|
171
|
+
default_choice?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Issue #291 — the authored NOTIFY clock: seconds between reminder occurrences while the gate
|
|
174
|
+
* is unresolved. Positive integer (E2). NOTIFY-ONLY: zero settlement authority — a reminder
|
|
175
|
+
* due/overdue is NEVER a run-health finding (the enforce/notify clocks never cross). Frozen
|
|
176
|
+
* into `PendingGate.reminder_seconds` at mint (record-keyed precedence over the operator's
|
|
177
|
+
* `reminderIntervalMs` config — author-declares doctrine). Standalone-legal: does NOT require
|
|
178
|
+
* `timeout_seconds` (a pure-notify gate). Dead-config warn when
|
|
179
|
+
* `reminder_seconds >= timeout_seconds` (the first occurrence would never fire before expiry).
|
|
180
|
+
*/
|
|
181
|
+
reminder_seconds?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Issue #291 — the repetition cap on the authored reminder cycle (Camunda `R<n>` precedent).
|
|
184
|
+
* Positive integer (E2). Default 3 when `reminder_seconds` is declared and this is absent.
|
|
185
|
+
* Reminders stop at whichever comes first: `reminder_max` occurrences, or (when
|
|
186
|
+
* `timeout_seconds` is also declared) the gate's expiry — the LAST occurrence at/after expiry
|
|
187
|
+
* carries the switched "expired — will enact <disposition>" wording instead of a plain
|
|
188
|
+
* reminder.
|
|
189
|
+
*/
|
|
190
|
+
reminder_max?: number;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Every key GateConfig declares. Used by the YAML loader (issue #291) to warn when a `gate:`
|
|
194
|
+
* block declares a key that isn't recognized (misspelling, or a stale field) — same non-breaking
|
|
195
|
+
* posture as KNOWN_STEP_KEYS/KNOWN_RETRY_KEYS (issues #144/#169/#140). This is the FIRST gate
|
|
196
|
+
* sub-key validation the loader has ever had (previously zero gate sub-keys were checked at all).
|
|
197
|
+
*/
|
|
198
|
+
export declare const KNOWN_GATE_KEYS: readonly ["choices", "owner", "message", "resolution_messages", "timeout_seconds", "on_expiry", "default_choice", "reminder_seconds", "reminder_max"];
|
|
108
199
|
/**
|
|
109
200
|
* Controls when a step becomes eligible based on its dependencies' outcomes.
|
|
110
201
|
* Default: 'all_success'.
|
|
@@ -307,35 +398,7 @@ export interface StepDefinition {
|
|
|
307
398
|
*/
|
|
308
399
|
use_template?: string;
|
|
309
400
|
/** Gate configuration — choices available to the human reviewer. */
|
|
310
|
-
gate?:
|
|
311
|
-
choices?: string[];
|
|
312
|
-
/**
|
|
313
|
-
* Slack user ID or handle of the person responsible for resolving this gate.
|
|
314
|
-
* Used for notification targeting and escalation.
|
|
315
|
-
* Optional — notifications work without it.
|
|
316
|
-
* Example: '@mihai.lupu' or 'U012AB3CD'
|
|
317
|
-
*/
|
|
318
|
-
owner?: string;
|
|
319
|
-
/**
|
|
320
|
-
* Developer-authored template string presented to the human reviewer when this gate opens.
|
|
321
|
-
* Supports {{ context.resources.STEP.FIELD }} and {{ run.params.FIELD }} references.
|
|
322
|
-
* Resolved from run data at gate-open time. Fail-fast: unresolvable references cause
|
|
323
|
-
* a stop error rather than opening a gate with broken placeholder text.
|
|
324
|
-
* When absent, the Slack path falls back to formatGatePreviewForSlack(preview)
|
|
325
|
-
* and the MCP path falls back to step.prompt resolution (existing behavior).
|
|
326
|
-
*/
|
|
327
|
-
message?: string;
|
|
328
|
-
/**
|
|
329
|
-
* Per-choice messages posted to the Slack thread when the gate resolves via Slack.
|
|
330
|
-
* Keys must match entries in `choices`. Values are plain text (not mrkdwn templates).
|
|
331
|
-
* Optional — when absent or when a choice has no entry, the generic fallback is used.
|
|
332
|
-
* Example:
|
|
333
|
-
* resolution_messages:
|
|
334
|
-
* send: "✅ Incident report sent to #incidents."
|
|
335
|
-
* reject: "❌ Draft discarded. Run will not continue."
|
|
336
|
-
*/
|
|
337
|
-
resolution_messages?: Record<string, string>;
|
|
338
|
-
};
|
|
401
|
+
gate?: GateConfig;
|
|
339
402
|
/** Name of the agent profile for this step. Only valid on execution: 'agent' steps. */
|
|
340
403
|
agent_profile?: string;
|
|
341
404
|
/**
|
|
@@ -361,6 +424,24 @@ export interface StepDefinition {
|
|
|
361
424
|
* Default: 30 (applied at runtime).
|
|
362
425
|
*/
|
|
363
426
|
tool_timeout?: number;
|
|
427
|
+
/**
|
|
428
|
+
* Issue #236 (L0 prevention layer) — author opt-in to Anthropic grammar-constrained
|
|
429
|
+
* ("strict") decoding for this step's submit tool. Only valid on `execution: 'agent'` steps
|
|
430
|
+
* (mirrors `output_schema`'s agent-only rule). The literal `'strict'` is the only accepted
|
|
431
|
+
* value (a union of one, kept as a string rather than boolean so a future non-Anthropic
|
|
432
|
+
* strict mode can add a sibling literal without a breaking type change).
|
|
433
|
+
*
|
|
434
|
+
* Governed by `assessStructuredOutputEligibility` (core) against the step's EFFECTIVE schema
|
|
435
|
+
* (`output_schema ?? input_schema`): an `ineligible` verdict is a LOADER ERROR at authoring
|
|
436
|
+
* time (`loadWorkflowFrom*`, `validate`, `register`, `create_workflow`) — the API provably
|
|
437
|
+
* rejects some legal schemas (a 400) and silently weakens others (an unsupported keyword is
|
|
438
|
+
* dropped from the grammar with no error), so realm never lets an author ship a schema the
|
|
439
|
+
* gate already knows is unsafe. At runtime the SAME verdict is re-derived (never persisted —
|
|
440
|
+
* self-healing under API drift) and a fallback ladder additionally degrades loudly on a live
|
|
441
|
+
* 400/503 the gate could not have predicted. See `docs/reference/yaml-schema.md`'s
|
|
442
|
+
* `structured_output` section for the full gate table and the runtime disclosure vocabulary.
|
|
443
|
+
*/
|
|
444
|
+
structured_output?: 'strict';
|
|
364
445
|
}
|
|
365
446
|
/**
|
|
366
447
|
* Every key StepDefinition declares (it has no runtime-only fields — everything on a step is
|
|
@@ -369,7 +450,7 @@ export interface StepDefinition {
|
|
|
369
450
|
* `allowed_from_states`/`produces_state` scalar state-machine fields) is otherwise silently
|
|
370
451
|
* dropped with no signal to the author.
|
|
371
452
|
*/
|
|
372
|
-
export declare const KNOWN_STEP_KEYS: readonly ["description", "execution", "depends_on", "trigger_rule", "when", "abort_unless", "abort_message", "on_outcome", "idempotent", "uses_service", "service_method", "operation", "input_map", "handler", "config", "input_schema", "output_schema", "trace_schema", "trace_validation_mode", "preconditions", "trust", "timeout_seconds", "retry", "validation_exhaustion", "instructions", "prompt", "display", "use_template", "gate", "agent_profile", "tools", "max_tool_calls", "max_fan_out", "tool_timeout"];
|
|
453
|
+
export declare const KNOWN_STEP_KEYS: readonly ["description", "execution", "depends_on", "trigger_rule", "when", "abort_unless", "abort_message", "on_outcome", "idempotent", "uses_service", "service_method", "operation", "input_map", "handler", "config", "input_schema", "output_schema", "trace_schema", "trace_validation_mode", "preconditions", "trust", "timeout_seconds", "retry", "validation_exhaustion", "instructions", "prompt", "display", "use_template", "gate", "agent_profile", "tools", "max_tool_calls", "max_fan_out", "tool_timeout", "structured_output"];
|
|
373
454
|
export interface WorkflowDefinition {
|
|
374
455
|
id: string;
|
|
375
456
|
name: string;
|