@agenticprimitives/orchestration 0.0.0-alpha.1 → 0.0.0-alpha.11

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 (114) hide show
  1. package/README.md +2 -0
  2. package/dist/admission.d.ts +127 -0
  3. package/dist/admission.d.ts.map +1 -0
  4. package/dist/admission.js +355 -0
  5. package/dist/admission.js.map +1 -0
  6. package/dist/answer-quality.d.ts +80 -0
  7. package/dist/answer-quality.d.ts.map +1 -0
  8. package/dist/answer-quality.js +97 -0
  9. package/dist/answer-quality.js.map +1 -0
  10. package/dist/artifacts.d.ts +137 -0
  11. package/dist/artifacts.d.ts.map +1 -0
  12. package/dist/artifacts.js +232 -0
  13. package/dist/artifacts.js.map +1 -0
  14. package/dist/authority.d.ts +465 -0
  15. package/dist/authority.d.ts.map +1 -0
  16. package/dist/authority.js +2 -0
  17. package/dist/authority.js.map +1 -0
  18. package/dist/conformance.d.ts +66 -0
  19. package/dist/conformance.d.ts.map +1 -0
  20. package/dist/conformance.js +140 -0
  21. package/dist/conformance.js.map +1 -0
  22. package/dist/derivation.d.ts +21 -0
  23. package/dist/derivation.d.ts.map +1 -0
  24. package/dist/derivation.js +31 -0
  25. package/dist/derivation.js.map +1 -0
  26. package/dist/durable.d.ts +44 -0
  27. package/dist/durable.d.ts.map +1 -0
  28. package/dist/durable.js +15 -0
  29. package/dist/durable.js.map +1 -0
  30. package/dist/export-port.d.ts +13 -0
  31. package/dist/export-port.d.ts.map +1 -0
  32. package/dist/export-port.js +2 -0
  33. package/dist/export-port.js.map +1 -0
  34. package/dist/flow-trace.d.ts +105 -0
  35. package/dist/flow-trace.d.ts.map +1 -0
  36. package/dist/flow-trace.js +60 -0
  37. package/dist/flow-trace.js.map +1 -0
  38. package/dist/index.d.ts +37 -4
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +44 -3
  41. package/dist/index.js.map +1 -1
  42. package/dist/input.d.ts +165 -0
  43. package/dist/input.d.ts.map +1 -0
  44. package/dist/input.js +33 -0
  45. package/dist/input.js.map +1 -0
  46. package/dist/intent.d.ts +37 -0
  47. package/dist/intent.d.ts.map +1 -0
  48. package/dist/intent.js +46 -0
  49. package/dist/intent.js.map +1 -0
  50. package/dist/judgment.d.ts +131 -0
  51. package/dist/judgment.d.ts.map +1 -0
  52. package/dist/judgment.js +249 -0
  53. package/dist/judgment.js.map +1 -0
  54. package/dist/loop.d.ts +155 -6
  55. package/dist/loop.d.ts.map +1 -1
  56. package/dist/loop.js +905 -32
  57. package/dist/loop.js.map +1 -1
  58. package/dist/metrics.d.ts +35 -0
  59. package/dist/metrics.d.ts.map +1 -0
  60. package/dist/metrics.js +98 -0
  61. package/dist/metrics.js.map +1 -0
  62. package/dist/outcome.d.ts +223 -0
  63. package/dist/outcome.d.ts.map +1 -0
  64. package/dist/outcome.js +325 -0
  65. package/dist/outcome.js.map +1 -0
  66. package/dist/plan-digest.d.ts +6 -0
  67. package/dist/plan-digest.d.ts.map +1 -0
  68. package/dist/plan-digest.js +35 -0
  69. package/dist/plan-digest.js.map +1 -0
  70. package/dist/planner-wire.d.ts +11 -0
  71. package/dist/planner-wire.d.ts.map +1 -0
  72. package/dist/planner-wire.js +53 -0
  73. package/dist/planner-wire.js.map +1 -0
  74. package/dist/planner.d.ts +51 -0
  75. package/dist/planner.d.ts.map +1 -1
  76. package/dist/planner.js +74 -0
  77. package/dist/planner.js.map +1 -1
  78. package/dist/reconcile.d.ts +41 -0
  79. package/dist/reconcile.d.ts.map +1 -0
  80. package/dist/reconcile.js +20 -0
  81. package/dist/reconcile.js.map +1 -0
  82. package/dist/record.d.ts +238 -0
  83. package/dist/record.d.ts.map +1 -0
  84. package/dist/record.js +116 -0
  85. package/dist/record.js.map +1 -0
  86. package/dist/regression.d.ts +109 -0
  87. package/dist/regression.d.ts.map +1 -0
  88. package/dist/regression.js +97 -0
  89. package/dist/regression.js.map +1 -0
  90. package/dist/selection.d.ts +334 -0
  91. package/dist/selection.d.ts.map +1 -0
  92. package/dist/selection.js +481 -0
  93. package/dist/selection.js.map +1 -0
  94. package/dist/spans.d.ts +262 -0
  95. package/dist/spans.d.ts.map +1 -0
  96. package/dist/spans.js +589 -0
  97. package/dist/spans.js.map +1 -0
  98. package/dist/tool-invoker.d.ts +61 -3
  99. package/dist/tool-invoker.d.ts.map +1 -1
  100. package/dist/tool-invoker.js +26 -1
  101. package/dist/tool-invoker.js.map +1 -1
  102. package/dist/trace-context.d.ts +26 -0
  103. package/dist/trace-context.d.ts.map +1 -0
  104. package/dist/trace-context.js +59 -0
  105. package/dist/trace-context.js.map +1 -0
  106. package/dist/trace-facts.d.ts +84 -0
  107. package/dist/trace-facts.d.ts.map +1 -0
  108. package/dist/trace-facts.js +82 -0
  109. package/dist/trace-facts.js.map +1 -0
  110. package/dist/types.d.ts +265 -3
  111. package/dist/types.d.ts.map +1 -1
  112. package/dist/types.js +4 -0
  113. package/dist/types.js.map +1 -1
  114. package/package.json +19 -7
@@ -0,0 +1,465 @@
1
+ import type { ToolObservationV1 } from './tool-invoker.js';
2
+ import type { Intent, PlanStep, ToolSpec } from './types.js';
3
+ import type { StepRiskClass } from '@agenticprimitives/tool-policy';
4
+ /** What the caller presented as its authority. OPAQUE to the loop — it is handed to the verifier and
5
+ * never inspected here. A `delegation` wire, a session leaf, anything the verifier understands. */
6
+ export interface MandatePresentation {
7
+ /** A stable reference the receipt carries (normally the delegation hash). */
8
+ ref: string;
9
+ /** The wire itself. The loop passes it through untouched. */
10
+ wire: unknown;
11
+ }
12
+ /** A step as the authority layer sees it: the plan's step joined to its tool's DECLARATION. Capability and
13
+ * risk come from the tool, not the plan — a planner cannot lower a risk by describing a step differently. */
14
+ export interface ResolvedStep {
15
+ runRef: string;
16
+ stepRef: string;
17
+ index: number;
18
+ step: PlanStep;
19
+ tool: ToolSpec;
20
+ /** Args with `{ $ref }` placeholders resolved. */
21
+ args: Record<string, unknown>;
22
+ /** The capability the step exercises, from `tool.capability`, with `resource` and `authority` read out
23
+ * of args. `authority` is the party whose mandate this step needs — the payer, the parent — when that
24
+ * is not the resource itself. */
25
+ capability: {
26
+ id: string;
27
+ action: string;
28
+ resource?: string;
29
+ authority?: string;
30
+ };
31
+ /** `tool-policy.StepRiskClass` — informational when the tool declares no capability. */
32
+ risk: StepRiskClass;
33
+ /** Present when the risk class demands one (medium+). Defaults to `${runRef}:${stepRef}`. */
34
+ idempotencyKey?: string;
35
+ }
36
+ export interface StepAuthorityRequest {
37
+ intent: Intent;
38
+ presented: MandatePresentation | null;
39
+ step: ResolvedStep;
40
+ /** Whether this check follows an approval. A verifier may not need to know; a receipt does. */
41
+ afterApproval: boolean;
42
+ /** Spec 408 §2.3 — the digest of the plan this run is executing (`planDigest`), computed by the loop
43
+ * once per admitted plan. A mandate that binds a plan is judged against it on every step. */
44
+ planDigest?: string;
45
+ }
46
+ /** An UNSATISFIED condition attached to the authority. Not a UI prompt. */
47
+ export interface Obligation {
48
+ kind: 'second-party-approval' | 'quorum' | 'fresh-authorization' | 'disclosure' | (string & {});
49
+ dischargeableBy: {
50
+ role?: string;
51
+ agents?: string[];
52
+ threshold?: number;
53
+ };
54
+ /** What imposed it, by reference — the caveat, the policy, the risk class. */
55
+ imposedBy: string;
56
+ }
57
+ export interface DecisionReason {
58
+ code: string;
59
+ message: string;
60
+ }
61
+ /** Inspectable evidence for the receipt. Shape mirrors `delegation.DecisionEvidence` so an adapter can
62
+ * pass it straight through. */
63
+ export interface DecisionEvidence {
64
+ mandateRef: string;
65
+ intentDigest: string;
66
+ evaluatedAt: number;
67
+ verdicts: Array<{
68
+ enforcer: string;
69
+ allowed: boolean;
70
+ reason?: string;
71
+ }>;
72
+ /** Spec 383 — the authority chain the leaf descends from, verified whole by the verifier (structural mirror
73
+ * of `delegation.AuthorityChainV1`): every grant by reference, leaf first; the accountability root; the
74
+ * acting agent. A receipt three hops away names each actor and grant from this, never from the last link. */
75
+ chain?: {
76
+ profile: string;
77
+ links: Array<{
78
+ ref: string;
79
+ delegator: string;
80
+ delegate: string;
81
+ parentRef: string | null;
82
+ }>;
83
+ accountabilityRoot: string;
84
+ actingAgent: string;
85
+ depth: number;
86
+ chainDigest: string;
87
+ };
88
+ }
89
+ export type MandateDecision = {
90
+ decision: 'allow';
91
+ obligations: Obligation[];
92
+ evidence: DecisionEvidence;
93
+ } | {
94
+ decision: 'approval-required';
95
+ obligations: Obligation[];
96
+ evidence: DecisionEvidence;
97
+ } | {
98
+ decision: 'deny';
99
+ reasons: DecisionReason[];
100
+ evidence: DecisionEvidence;
101
+ };
102
+ export interface MandateVerifier {
103
+ verify(req: StepAuthorityRequest): Promise<MandateDecision>;
104
+ }
105
+ /** Policy: WHAT RULES govern exercising authority the mandate grants. Distinct from the mandate (what was
106
+ * granted) and from approval (what remains unsatisfied). Returns obligations to ADD; it never removes one
107
+ * the verifier attached. */
108
+ export interface PolicyEvaluator {
109
+ evaluate(req: StepAuthorityRequest & {
110
+ decision: MandateDecision;
111
+ }): Promise<{
112
+ obligations: Obligation[];
113
+ }>;
114
+ }
115
+ export interface ApprovalRequest {
116
+ runRef: string;
117
+ stepRef: string;
118
+ intent: Intent;
119
+ step: ResolvedStep;
120
+ obligations: Obligation[];
121
+ /** The evidence the verifier produced — so the approver sees the EFFECTIVE authority, never a summary. */
122
+ evidence: DecisionEvidence;
123
+ }
124
+ export type ApprovalOutcome = {
125
+ status: 'discharged';
126
+ records: string[];
127
+ } | {
128
+ status: 'refused';
129
+ by?: string;
130
+ reason?: string;
131
+ } | {
132
+ status: 'pending';
133
+ resumeToken: string;
134
+ prompt?: import('./input.js').InputRequestV1;
135
+ };
136
+ /** Discharge obligations. A durable implementation checkpoints and returns `pending`; the run suspends and
137
+ * resumes later — through the verifier AGAIN, because an approval is an input to it, not a bypass. */
138
+ export interface ApprovalPort {
139
+ request(req: ApprovalRequest): Promise<ApprovalOutcome>;
140
+ }
141
+ export type StepReceiptStatus = 'authorized' | 'executed' | 'failed' | 'denied' | 'cancelled' | 'compensated' | 'suspended' | 'authority-required' | 'skipped';
142
+ /** The loop's record of one step. A sink turns it into signed evidence (`service-agent.ExecutionReceiptV2`,
143
+ * `verification-receipts`); the loop only guarantees the binding is complete. */
144
+ /**
145
+ * Spec 367 §5 — THE EXECUTION BINDING: what the operation was admitted AS, pinned onto its receipt so the
146
+ * executor cannot silently substitute a different organization, treasury, recipient or operation after
147
+ * admission. Evidence only (capability-architecture §8 invariant 13): no gate reads it.
148
+ */
149
+ export interface ExecutionBindingV1 {
150
+ /** keccak256 of the ExecutionIntent (goal + context) this step served. */
151
+ intentDigest: string;
152
+ /** The person the run acts for, and the role they act in when the harness knows it. */
153
+ principal?: string;
154
+ actingRole?: string;
155
+ /** The agent this step is ABOUT (the tool's `subject` argument, resolved), when it declares one. */
156
+ subject?: string;
157
+ /** The resource the capability acts on and whose authority it spends, read from the resolved args. */
158
+ resource?: string;
159
+ authority?: string;
160
+ /** The outcome class this step was expected to establish (`ToolSpec.establishes`). */
161
+ expectedOutcome: import('./types.js').OutcomeClass;
162
+ /** The stable logical operation identity — a retry must locate THIS, never perform it again (§8). */
163
+ operationId: string;
164
+ /** WHERE each bound party came from (spec 367 §3): the person's words, application context, a decision rule, memory, the resolver. */
165
+ argSources?: Record<string, 'said' | 'context' | 'standing' | 'decision' | 'memory' | 'resolver' | 'disclosed'>;
166
+ /** Spec 367 §8 — the causal chain across agents. `inResponseTo` on the receiver's receipt names the request
167
+ * it answered (R → S); `delegatedTo` on the sender's names the answer it got back (S → T). Never circular. */
168
+ correlation?: {
169
+ inResponseTo?: {
170
+ agent: string;
171
+ operationId: string;
172
+ runRef: string;
173
+ stepRef: string;
174
+ };
175
+ delegatedTo?: {
176
+ agent: string;
177
+ runRef: string;
178
+ };
179
+ };
180
+ /** Spec 383 (ADR-0052 roles) — WHO IS ACTING, FOR WHOM, and who started it: the actor context of this hop,
181
+ * so a receipt reads "alice's agent, for Missio Nexus, run at runtime-c3s0.svc". `rootPrincipal` is the
182
+ * person the run acts for; `originatingAgent` the agent that started the overall task (the requester of
183
+ * a routed step, else the principal's own agent); `actingAgent` the agent whose harness ran this hop.
184
+ * The accountability root — whose authority was spent — is the verified chain's root delegator, on the
185
+ * decision's evidence, never restated here. Evidence only; no gate reads it. */
186
+ /** Spec 383 W2 — the STANDING this hop ran under, as a named link: for whom (`subject`), by whom
187
+
188
+ * (`principal`), the relation the receiver derived, and — for a steward — the stewardship wire it verified,
189
+
190
+ * by digest. Evidence beside the mandate chain; no verifier reads it. */
191
+ standing?: {
192
+ relation: 'self' | 'steward' | 'member' | 'none';
193
+ subject: string;
194
+ principal: string;
195
+ because: string;
196
+ wireRef?: string;
197
+ };
198
+ actor?: {
199
+ rootPrincipal?: string;
200
+ originatingAgent?: string;
201
+ actingAgent: string;
202
+ /** Spec 397 — the hop came THROUGH A HOST as the person: the registered client and the template whose wire
203
+ * admitted it (`ask-as-me`), or whose standing wire the step's mandate was derived from (`act-as-me`). Ids only. */
204
+ via?: {
205
+ client: string;
206
+ template: string;
207
+ };
208
+ };
209
+ }
210
+ export interface StepReceipt {
211
+ /** Spec 367 §5 — the admitted binding this step ran under. */
212
+ binding?: ExecutionBindingV1;
213
+ /** Spec 421 W2 — per argument of an ACT, whether its value was in her words or only in what the run read (and whether
214
+ * that was untrusted). Evidence for audit and the signing card; no verifier reads it. */
215
+ derivation?: Record<string, import('./derivation.js').ArgDerivationV1>;
216
+ /** Spec 360 — what followed the act, per declared effect. `ok:false` is a disclosure that failed while
217
+ * the act stood: visible evidence, never a reason to unwind the step (the loop isolates the throw). */
218
+ effects?: Array<{
219
+ produces: string;
220
+ ok: boolean;
221
+ error?: string;
222
+ }>;
223
+ runRef: string;
224
+ stepRef: string;
225
+ index: number;
226
+ toolId: string;
227
+ capability?: {
228
+ id: string;
229
+ action: string;
230
+ resource?: string;
231
+ };
232
+ risk: ResolvedStep['risk'];
233
+ status: StepReceiptStatus;
234
+ /** From the verifier. Absent for informational steps (nothing was verified — and that is recorded). */
235
+ authority?: {
236
+ presentedRef: string | null;
237
+ decision: MandateDecision;
238
+ afterApproval: boolean;
239
+ };
240
+ /**
241
+ * Spec 363 W6 — WHAT THIS STEP DECIDED FOR THE PERSON, and on what basis.
242
+ *
243
+ * A receipt already says what authorized an act. It said nothing about the choices made on the way to
244
+ * it: which of six accounts paid, which Sarah was meant. Those were decided by rules over modelled
245
+ * facts, and a run that can be audited for its authority but not its DECISIONS is half-legible —
246
+ * "why did it pay from that one" was answerable only by re-deriving it and hoping nothing had changed.
247
+ *
248
+ * Display and audit only. No verifier reads it, and recording a decision grants nothing: the mandate
249
+ * still decided what may happen (spec 363 §2).
250
+ */
251
+ decisions?: Array<{
252
+ /** The decision point (`payment.sourceAccount`). */
253
+ point: string;
254
+ /** The rule that answered (`marked-primary-payer`). */
255
+ ruleId: string;
256
+ /** The argument it filled. */
257
+ arg: string;
258
+ /** What it chose. */
259
+ chose: string;
260
+ /** The rule's own words — never composed. */
261
+ because: string;
262
+ }>;
263
+ approvalRecords?: string[];
264
+ idempotencyKey?: string;
265
+ inputDigest?: string;
266
+ /** The step's arguments AS PLANNED (resolved against earlier results only, before names became addresses). A resume
267
+ * compares a replayed step against this: a replay never re-resolves names, so it cannot reproduce `inputDigest` for a
268
+ * step whose argument was a name ("missio nexus") — and refusing it broke every resume past such a step. */
269
+ planArgsDigest?: string;
270
+ outputDigest?: string;
271
+ /** Spec 410 §2 — WHAT THE ADAPTER SAW, beside the output digest: which end committed this and what it can
272
+ * show. `attests` is the one word a stranger reads first; only `confirmed` may be called "verified at commit". */
273
+ observation?: ToolObservationV1;
274
+ attests?: ToolObservationV1['outcome'];
275
+ /** Spec 410 §3 — this attempt found the operation already done and DID NOT ACT; the observation is the
276
+ * reconcile's. A retry after a lost response leaves this, never a second effect. */
277
+ reconciled?: true;
278
+ error?: string;
279
+ /** Spec 350 §3.4 — set when `status === 'suspended'` because the tool asked the person for something: the
280
+ * kind of prompt and, for a signature, what must be signed by whom. Never the answers. */
281
+ pendingInput?: {
282
+ kind: 'data' | 'signature' | 'confirmation' | 'commitment' | 'authority';
283
+ digest?: string;
284
+ signer?: string;
285
+ fields?: string[];
286
+ };
287
+ /** Spec 354 §4.5 — the playbook (skill/archetype) that shaped this step: canonical id + version +
288
+ * content commitment (the definition digest). Absent when the agent runs the bare harness (no
289
+ * archetype assigned). Names WHICH PROCEDURE the step followed — the behavior dimension of the
290
+ * receipt chain, verifiable against the corpus. Grants nothing; a playbook is never authority. */
291
+ skillRef?: {
292
+ skillId: string;
293
+ version: string;
294
+ commitment: string;
295
+ };
296
+ /** Spec 414 A1 — the SKILL.md contract that governed THIS step (finer than the playbook): canonical id, version
297
+ * and the contract's content digest, as the compiled definition says its tool came from. Grants nothing. */
298
+ skill?: {
299
+ id: string;
300
+ version: string;
301
+ contractDigest: string;
302
+ };
303
+ startedAt: number;
304
+ completedAt: number;
305
+ }
306
+ export interface ReceiptSink {
307
+ record(receipt: StepReceipt): Promise<void>;
308
+ }
309
+ /** Spec 390 W3 — every event carries WHEN (ms since the epoch), stamped by the loop as it emits, so the
310
+ * authority stages, the planner's call and the outcome can be projected as spans AFTER the fact from the
311
+ * record alone (no inline instrumentation). Optional on the type because records written before this
312
+ * wave carry none; a projection that needs two stamps and has one emits nothing for that stage. */
313
+ export type RunEventStamp = {
314
+ at?: number;
315
+ };
316
+ export type RunEvent = RunEventStamp & ({
317
+ type: 'RunStarted';
318
+ runRef: string;
319
+ intent: Intent;
320
+ presentedRef: string | null;
321
+ } | {
322
+ type: 'PlanCreated';
323
+ runRef: string;
324
+ steps: number;
325
+ rationale?: string;
326
+ }
327
+ /** Spec 367 W1 — admission refused the plan; `replanning` says whether one more plan will be tried. */
328
+ | {
329
+ type: 'PlanRefused';
330
+ runRef: string;
331
+ violations: Array<{
332
+ code: string;
333
+ message: string;
334
+ stepIndex?: number;
335
+ toolId?: string;
336
+ }>;
337
+ replanning: boolean;
338
+ } | {
339
+ type: 'StepProposed';
340
+ runRef: string;
341
+ stepRef: string;
342
+ toolId: string;
343
+ risk: ResolvedStep['risk'];
344
+ } | {
345
+ type: 'MandateChecked';
346
+ runRef: string;
347
+ stepRef: string;
348
+ decision: MandateDecision['decision'];
349
+ afterApproval: boolean;
350
+ } | {
351
+ type: 'MandateDenied';
352
+ runRef: string;
353
+ stepRef: string;
354
+ reasons: DecisionReason[];
355
+ } | {
356
+ type: 'ApprovalRequested';
357
+ runRef: string;
358
+ stepRef: string;
359
+ obligations: Obligation[];
360
+ } | {
361
+ type: 'ApprovalDischarged';
362
+ runRef: string;
363
+ stepRef: string;
364
+ records: string[];
365
+ } | {
366
+ type: 'ApprovalRefused';
367
+ runRef: string;
368
+ stepRef: string;
369
+ reason?: string;
370
+ } | {
371
+ type: 'RunSuspended';
372
+ runRef: string;
373
+ stepRef: string;
374
+ resumeToken: string;
375
+ } | {
376
+ type: 'ToolInvoked';
377
+ runRef: string;
378
+ stepRef: string;
379
+ toolId: string;
380
+ ok: boolean;
381
+ }
382
+ /** Spec 370 P1 — a completed step's recorded outcome stood in for running it again (a resume). */
383
+ | {
384
+ type: 'StepReplayed';
385
+ runRef: string;
386
+ stepRef: string;
387
+ toolId: string;
388
+ }
389
+ /** Spec 370 P3 — a declared branch was not taken: the step's `when` did not hold. */
390
+ | {
391
+ type: 'StepSkipped';
392
+ runRef: string;
393
+ stepRef: string;
394
+ toolId: string;
395
+ because: string;
396
+ } | {
397
+ type: 'StepCompensated';
398
+ runRef: string;
399
+ stepRef: string;
400
+ by: string;
401
+ ok: boolean;
402
+ } | {
403
+ type: 'ReceiptCreated';
404
+ runRef: string;
405
+ stepRef: string;
406
+ status: StepReceiptStatus;
407
+ }
408
+ /** Spec 360 — a declared effect could not be discharged. Its OWN fact: the step it followed stands. */
409
+ | {
410
+ type: 'EffectFailed';
411
+ runRef: string;
412
+ stepRef: string;
413
+ error: string;
414
+ } | {
415
+ type: 'RunCompleted';
416
+ runRef: string;
417
+ } | {
418
+ type: 'RunFailed';
419
+ runRef: string;
420
+ error: string;
421
+ });
422
+ export type RunEventSink = (event: RunEvent) => void;
423
+ /**
424
+ * WHAT FOLLOWS A SUCCESSFUL STEP — spec 360. The playbook DECLARES a consequence (a payment leaves a
425
+ * receipt the parties hold); this discharges it.
426
+ *
427
+ * The loop stays domain-free: it knows THAT a definition declared an effect and WHEN to discharge it. It
428
+ * does not know what a PaymentReceipt is, who a payee is, or where a record lives — the app binds that,
429
+ * exactly as it binds invokers.
430
+ *
431
+ * MAY NOT FAIL THE STEP. The act already happened, possibly on chain. A receipt that could un-do a
432
+ * payment would be worse than no receipt, so the loop isolates a throw here and records it as its own
433
+ * fact: the step stays `executed`, and the failure to disclose is reported separately.
434
+ */
435
+ export interface EffectSink {
436
+ discharge(e: {
437
+ runRef: string;
438
+ stepRef: string;
439
+ /** The effect as the definition declared it. Opaque to the loop beyond being passed through. */
440
+ effect: unknown;
441
+ step: ResolvedStep;
442
+ /** What the invoker returned — the receipt is built from THIS, never from model prose. */
443
+ result: unknown;
444
+ receipt: StepReceipt;
445
+ }): Promise<void>;
446
+ }
447
+ export interface OrchestrationPorts {
448
+ /** REQUIRED once any tool declares a capability. A run that reaches such a step without one fails closed. */
449
+ mandateVerifier?: MandateVerifier;
450
+ policyEvaluator?: PolicyEvaluator;
451
+ approvalPort?: ApprovalPort;
452
+ /** Every step emits a receipt; absent ⇒ receipts are kept on the RunResult only. */
453
+ receiptSink?: ReceiptSink;
454
+ /** Spec 360 — discharges a playbook's declared consequences after a step succeeds. Absent ⇒ declared
455
+ * effects are not discharged, and that is visible: the promise is in the definition either way. */
456
+ effectSink?: EffectSink;
457
+ /** Spec 367 W1 — judges the plan's SHAPE before any step runs (the verifier judges authority). Absent ⇒
458
+ * every well-formed plan is executed, which is the behaviour every run had before the port existed. */
459
+ planAdmission?: import('./admission.js').PlanAdmission;
460
+ /** Spec 410 §3 — asked before every non-read step whether THIS operation already happened (reconcile → verify →
461
+ * act). Absent ⇒ no reconcile, the behaviour every run had before the port existed. */
462
+ reconcile?: import('./reconcile.js').ReconcilePort;
463
+ events?: RunEventSink;
464
+ }
465
+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aAAa,CAAC,EAAE,OAAO,gBAAgB,EAAE,aAAa,CAAC;IACvD;4FACwF;IACxF,SAAS,CAAC,EAAE,OAAO,gBAAgB,EAAE,aAAa,CAAC;IACnD,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authority.js","sourceRoot":"","sources":["../src/authority.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import type { AdmissionRule, AdmissionViolation } from './admission.js';
2
+ import type { ToolSpec } from './types.js';
3
+ /** What the ontology says an outcome class entails — the shape `@agenticprimitives/ontology` exports. */
4
+ export interface OutcomeClassView {
5
+ class: string;
6
+ label: string;
7
+ entails: ReadonlyArray<{
8
+ capability: string;
9
+ carries?: readonly string[];
10
+ bound?: string;
11
+ }>;
12
+ bounds: Readonly<Record<string, {
13
+ arg: string;
14
+ kind: 'amount' | 'named';
15
+ }>>;
16
+ /** The words that name this outcome (the ontology's), for `classifyOpenIntent`. */
17
+ words?: readonly string[];
18
+ /** How each bound is read off a sentence (the ontology's). */
19
+ reads?: Readonly<Record<string, {
20
+ kind: 'money';
21
+ } | {
22
+ kind: 'after';
23
+ prepositions: readonly string[];
24
+ }>>;
25
+ }
26
+ /**
27
+ * Spec 410 §6 — THE ASK'S CLASSIFIER, rendered from the ontology: does this sentence name an OPEN intent of a published
28
+ * outcome class? Matched on the class's own words, whole and case-insensitive; the bounds read the way the class says
29
+ * they are read. Deterministic — the same sentence classifies the same way on every run, so the stated outcome the
30
+ * mandate digests is stable across a resume. Null for every closed intent ("pay alice 10"), which is judged by nothing
31
+ * here. A sentence that names two classes is not classified: one outcome per ask.
32
+ */
33
+ export declare function classifyOpenIntent(goal: string, classes: ReadonlyArray<OutcomeClassView>): StatedOutcomeV1 | null;
34
+ /** What an open intent states: `intent.constraints.outcome`. */
35
+ export interface StatedOutcomeV1 {
36
+ /** The outcome class IRI or CURIE (`apint:OrganizedGathering`). */
37
+ class: string;
38
+ /** The bounds the sentence stated, by the class's bound keys (`{ budget: 2000, venue: 'the hall' }`). */
39
+ bounds?: Record<string, string | number>;
40
+ }
41
+ export declare function statedOutcomeOf(intent: {
42
+ constraints?: Record<string, unknown>;
43
+ }): StatedOutcomeV1 | null;
44
+ /**
45
+ * The rule. `lookup` resolves an outcome class IRI to what it entails (the ontology's `outcomeClassOf`); a class
46
+ * the ontology does not publish entails NOTHING, so every consequential step under it is refused — a refusal
47
+ * that names the unknown class, never a silent pass.
48
+ */
49
+ export declare function outcomeConformance(lookup: (classIri: string) => OutcomeClassView | null): AdmissionRule;
50
+ /** For a caller that wants the split the spec names: what stays offered and what was refused. */
51
+ export declare function conformEffects(input: {
52
+ intent: {
53
+ constraints?: Record<string, unknown>;
54
+ };
55
+ plan: {
56
+ steps: Array<{
57
+ toolId: string;
58
+ args: Record<string, unknown>;
59
+ }>;
60
+ };
61
+ tools: ToolSpec[];
62
+ }, lookup: (classIri: string) => OutcomeClassView | null): {
63
+ offered: number[];
64
+ refused: AdmissionViolation[];
65
+ };
66
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../src/conformance.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,yGAAyG;AACzG,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5F,MAAM,EAAE,QAAQ,CAAC,MAA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