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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +253 -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
package/dist/index.js CHANGED
@@ -1,7 +1,48 @@
1
1
  // @agenticprimitives/orchestration — public API. The Ring-0 agentic loop: the intent→plan→execute→observe
2
2
  // model, the Planner + ToolInvoker PORTS, and `runIntent`. Pure leaf — no transport, no LLM SDK, no chain.
3
- // The LLM binding lives in `@agenticprimitives/orchestration-anthropic` (behind the Planner port). ADR-0044.
3
+ // The LLM bindings live in sibling adapters behind the Planner port (`orchestration-anthropic`,
4
+ // `orchestration-openai-compat`). ADR-0044, spec 377.
4
5
  export { PACKAGE_NAME, PACKAGE_STATUS, SPEC_REF, OrchestrationError } from './types.js';
5
- export { createRuleBasedPlanner } from './planner.js';
6
- export { runIntent } from './loop.js';
6
+ export { createRuleBasedPlanner, renderContinuation } from './planner.js';
7
+ export { deriveArgs, untrustedArgs } from './derivation.js';
8
+ // Spec 377 §2 — the plan-shape convention on a vendor's wire, shared by every LLM adapter.
9
+ export { wireNameFor, toolNameMap, planStepFromToolArgs } from './planner-wire.js';
10
+ export { isToolInvocationResult, observed, describeObservation } from './tool-invoker.js';
11
+ export { runIntent, RETRIEVAL_STEP_REF, CONTINUE_STEP_ID, CONTINUE_TOOL } from './loop.js';
12
+ export { planAdmission, externalExecutorsReadOnly, instructionNeedsAct, noPlaceholders, subjectNamedInAsk, dependenciesProvided, branchesDecidable, questionAnsweredByRead, numbersFromTheWords, numbersSaid, partiesDistinct, actingPartyFromTheWords, kindNamedIsChartered, capabilitiesAvailable, outcomeClassOf, squash as squashLabel } from './admission.js';
13
+ // Spec 350 §3.4 — a tool may ask the person for what it lacks; the run suspends with the prompt.
14
+ export { InputRequired, isInputRequired, inputsFor, dataFor, signatureFor, receiptPending } from './input.js';
15
+ export { TerminalDenial } from './durable.js';
16
+ // Spec 370 P6 — the run record and its replay (verdicts re-derived, tools never re-run).
17
+ export { recordOf, runMarks, replayingInvoker, replayRun, completedFromRecord } from './record.js';
18
+ // Spec 408 §2.3 — the digest of the plan as written, bound by a mandate and presented on every step.
19
+ export { planDigest, planStepAsWritten } from './plan-digest.js';
20
+ // Spec 381 — the run, exported: firewalled spans + the durable half for the vault. Pure projections of a record.
21
+ export { spansOf, assertFirewalled, otlpTracesOf, receiptDigest, provenanceOf, runProvenanceRecordKey, SPAN_ATTRIBUTE_ALLOWLIST, RUN_PROVENANCE_RECORD_PREFIX, provIds, traceIdOf, spanIdOf, PROV_ID_BASE, stageSpansOf, assertMetricsFirewalled } from './spans.js';
22
+ // Spec 390 W4 — the run as metrics: four instruments from one record, the OTLP metrics body beside the traces body.
23
+ export { metricsOf, otlpMetricsOf, STEP_DURATION_BOUNDS_MS } from './metrics.js';
24
+ // Spec 414 A1 — the trace from the door: door, model calls, variant, starting state, harness-capability engagements.
25
+ export { engagementsOf, variantDigestOf, plannerCapabilityOf, addUsage } from './trace-facts.js';
26
+ export { traceIdFor } from './spans.js';
27
+ // Spec 390 W2 — W3C Trace Context on the wire: parse, format, tracestate members. Correlation, never trust.
28
+ export { parseTraceparent, formatTraceparent, withTracestateMember, tracestateMember, traceContextOf } from './trace-context.js';
29
+ // Spec 391 — offloaded artifacts and fitted evidence: what outlives a turn is a reference; nothing is cut silently.
30
+ export { ARTIFACT_REF_TYPE, OFFLOAD_THRESHOLD_CHARS, SUMMARY_MAX_CHARS, RUN_ARTIFACT_RECORD_PREFIX, runArtifactRecordKey, isArtifactRef, canonicalJson, summarizeResult, offloadObservations, offloadRunResult, refsReachedBy, rehydrateObservations, fitEvidence, compactObservations, resultFactsOf, RETAINED_RESULT_KEYS } from './artifacts.js';
31
+ // Spec 387 W2 / spec 399 §4 — the flow trace: a run's story on its task, folded from RunEvents + the planner summary. Evidence, never authority.
32
+ export { buildFlowTrace, flowIdOf, referralOf, summarizeOutput } from './flow-trace.js';
33
+ // Spec 410 §3 — reconcile before every retry, per effect kind.
34
+ export { reconcileByTool } from './reconcile.js';
35
+ // Spec 410 §6 — conformance for open intents: what the stated outcome entails, before anything is offered.
36
+ export { outcomeConformance, conformEffects, statedOutcomeOf, classifyOpenIntent } from './conformance.js';
37
+ // Spec 415 A4 — skill selection by declared vocabulary (`skill-selection/rules`): chooses with a margin or holds.
38
+ export { selectByDeclaredUtterances, tokensOf, overlap, DEFAULT_DECLARED_SELECTION, groundInLexicon, decideFromGrounding, selectByOntology, selectByJudgment, DEFAULT_JUDGMENT_SELECTION, SELECTION_JUDGE, NEEDS_CLARIFICATION, NEEDS_SEVERAL, SELECTION_JUDGE_FAST, SELECTION_JUDGE_FAST_V3, SELECTION_JUDGE_LOGPROB, selectByOntologyFirst, foldSelectionAbstentions, calibrateByTemperature, conformalSetOf, OUTSIDE_DOMAIN, selectByOntologyThenJudgment, proposeFromGrounding, selectByProposalThenJudgment, DEFAULT_PROPOSAL, selectByFramedJudgment, DEFAULT_FRAMED_SELECTION, FRAMED_JUDGE } from './selection.js';
39
+ // Spec 414 §3.4 J1–J13 — the judgment capability: typed questions, a distribution per question, a declared decision rule.
40
+ export { judgeQuestions, judgeQuestionsAveraged, logprobChoiceDecisionModel, applyDecisionRule, explainAnswer, answerOf, outcomesOf, shapeOf, structuredCallDecisionModel, NOT_APPLICABLE } from './judgment.js';
41
+ // Spec 416 §4f — the inferred intent: the request read into the ontology's terms + what is known of the asker.
42
+ export { inferIntent, renderReading, skillCard } from './intent.js';
43
+ export { outcomeGraphOf, consumedClassesOf, edgesOf, edgeKey, edgeByParty, upstreamInputsOf, downstreamOf, absenceStatement, planOptionsAround, choosePlanAround, PLAN_CHOICE_JUDGE, planForPicked, OUTCOME_JUDGE_SELECTIVE, glossOf, planForOutcome, selectByOutcome, outcomeSteps, OUTCOME_JUDGE, DEFAULT_OUTCOME_PARAMS, DEFAULT_OUTCOME_BOUNDS } from './outcome.js';
44
+ // Spec 416 §4h — answer quality, judged by typed yes-no questions over (request, skill card, answer); numbers only.
45
+ export { judgeAnswerQuality, judgeOutcomeDelivered, OUTCOME_CHECK_JUDGE, ANSWER_QUALITY_JUDGE, ANSWER_QUALITY_RUBRIC, judgeAnswerPreference, ANSWER_PREFERENCE_JUDGE } from './answer-quality.js';
46
+ // Spec 420 §2 — goal regression over situations (pure; transitions and facts supplied).
47
+ export { checkPlan, completePlan, transitionsHold } from './regression.js';
7
48
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,2GAA2G;AAC3G,6GAA6G;AAE7G,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAYxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,2GAA2G;AAC3G,gGAAgG;AAChG,sDAAsD;AAEtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ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E,uBAAuB,EAAE,qBAAqB,EAAyD,wBAAwB,EAAE,sBAAsB,EAAE,cAAc,EAA8B,cAAc,EAAsI,4BAA4B,EAA4B,oBAAoB,EAAE,4BAA4B,EAAE,gBAAgB,EAAwF,sBAAsB,EAAE,wBAAwB,EAAE,YAAY,EAAgF,MAAM,gBAAgB,CAAC;AAChqC,0HAA0H;AAC1H,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAA2B,0BAA0B,EAA0B,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAA0J,MAAM,eAAe,CAAC;AAE1Z,+GAA+G;AAC/G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAqD,MAAM,aAAa,CAAC;AACvH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAwC,aAAa,EAAE,uBAAuB,EAAE,OAAO,EAAwB,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,sBAAsB,EAA+J,MAAM,cAAc,CAAC;AAElkB,oHAAoH;AACpH,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAA2C,oBAAoB,EAAE,qBAAqB,EAAwB,qBAAqB,EAAE,uBAAuB,EAA2B,MAAM,qBAAqB,CAAC;AAC1R,wFAAwF;AACxF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAsG,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,165 @@
1
+ import type { StepReceipt } from './authority.js';
2
+ export type InputFieldType = 'text' | 'address' | 'number' | 'boolean' | 'choice' | 'credential';
3
+ export interface InputFieldV1 {
4
+ name: string;
5
+ label: string;
6
+ type: InputFieldType;
7
+ required?: boolean;
8
+ /** For `choice`. `hint` is what a person needs to tell two candidates APART — a label alone
9
+ * ("Nathan") is not a choice, it is the same word four times. */
10
+ choices?: Array<{
11
+ value: string;
12
+ label: string;
13
+ hint?: string;
14
+ }>;
15
+ /** For `choice`: the listed candidates are not the only possible answers, so the surface MUST also let
16
+ * the person type one. Set whenever the question itself admits that what they want may not be listed —
17
+ * a prompt saying "give it in full" beside a radio list with no text box is a dead end with
18
+ * instructions. */
19
+ allowOther?: boolean;
20
+ /** For `text`: a regular-expression source the surface may validate against before submitting. */
21
+ pattern?: string;
22
+ hint?: string;
23
+ }
24
+ /** A follow-up the surface may offer when a question has no good answer among what is on hand — "ask
25
+ * them for a way to reach it". The surface PREFILLS it; it never sends it. A question that leads
26
+ * nowhere is a dead end, and the way out is usually another ask the person did not know to phrase. */
27
+ export interface InputSuggestionV1 {
28
+ label: string;
29
+ /** The ask to prefill, in the person's own voice. */
30
+ message: string;
31
+ }
32
+ /**
33
+ * Spec 374 — WHAT ANOTHER AGENT OWES THIS RUN. A step whose subject is another agent was sent there (spec
34
+ * 366); that agent could not finish it for this asker and parked it for its own steward. This run holds
35
+ * the record — a `Commitment` in spec 340's sense: debtor, creditor, content, conditions, its own
36
+ * lifecycle — and waits. Evidence of where the act stands; never authority for it: no gate reads it.
37
+ */
38
+ export interface CommitmentRefV1 {
39
+ /** The debtor's operation identity for this request — the correlation the answer will name. */
40
+ id: string;
41
+ /** Who owes the act (the subject's agent). */
42
+ debtor: string;
43
+ /** Who is owed it (the asker's agent). */
44
+ creditor: string;
45
+ content: {
46
+ capability: string;
47
+ args: Record<string, unknown>;
48
+ goal: string;
49
+ };
50
+ /** In words: "a steward of missio-nexus.org finishes it". */
51
+ conditions: string;
52
+ /** Spec 340 `CommitmentState`, the four this record can observe. `proposed` = asked and parked. */
53
+ state: 'proposed' | 'active' | 'discharged' | 'void';
54
+ /** The debtor's run, where the act actually waits. */
55
+ at: {
56
+ agent: string;
57
+ name?: string;
58
+ runRef: string;
59
+ };
60
+ }
61
+ export type InputRequestV1 = {
62
+ kind: 'data';
63
+ stepRef: string;
64
+ toolId: string;
65
+ prompt: string;
66
+ fields: InputFieldV1[];
67
+ suggest?: InputSuggestionV1;
68
+ /** Spec 385 — when this is an AMBIGUITY choice, the scope the answer confirms (word + capability + arg),
69
+ * so the trusted resume that supplies it can be remembered as a scoped preference. Display/memory only. */
70
+ scope?: {
71
+ word: string;
72
+ capability: string;
73
+ arg: string;
74
+ };
75
+ /** Spec 397 — the question is ANOTHER agent's (a routed step's target asked it): where it waits, and the step
76
+ * there the answer is for. The resume continues THAT run with the answer; this run only relays. */
77
+ at?: {
78
+ agent: string;
79
+ name?: string;
80
+ runRef: string;
81
+ stepRef?: string;
82
+ };
83
+ }
84
+ /** Spec 374 — the run waits on another agent's steward; only the debtor's answer resumes it. */
85
+ | {
86
+ kind: 'commitment';
87
+ stepRef: string;
88
+ toolId: string;
89
+ prompt: string;
90
+ commitment: CommitmentRefV1;
91
+ }
92
+ /** Spec 374 W2 — THE SUBJECT'S AUTHORITY REQUEST, RELAYED: the step was routed to another agent, which
93
+ * asked for a mandate the ASKER can grant (they steward it). The asker's surface mints it exactly as it
94
+ * would for a local step; on resume the mandate travels to the subject's parked run. `authority` is
95
+ * the receiver's own request, carried whole; `at` is where the step waits. */
96
+ | {
97
+ kind: 'authority';
98
+ stepRef: string;
99
+ toolId: string;
100
+ prompt: string;
101
+ authority: Record<string, unknown>;
102
+ at: {
103
+ agent: string;
104
+ name?: string;
105
+ runRef: string;
106
+ };
107
+ } | {
108
+ kind: 'signature';
109
+ stepRef: string;
110
+ toolId: string;
111
+ prompt: string;
112
+ /** The digest to sign, and who must sign it (the connected credential's address, or the SA it custodies). */
113
+ digest: string;
114
+ signer: string;
115
+ /** What is being signed, in the open — the surface shows it; the tool re-derives it on resume. */
116
+ payload?: unknown;
117
+ } | {
118
+ kind: 'confirmation';
119
+ stepRef: string;
120
+ toolId: string;
121
+ prompt: string;
122
+ summary: unknown;
123
+ };
124
+ /** What comes back. Keyed by the step that asked; a tool reads its own via `inputsFor`. */
125
+ export interface SuppliedInputV1 {
126
+ stepRef: string;
127
+ /** Answers to a `data` request, by field name. A `credential` field's value is the surface's own
128
+ * description of the connected credential, in whatever shape the tool documented. */
129
+ data?: Record<string, unknown>;
130
+ /** The answer to a `signature` request. `payload` echoes what was signed when the tool needs it back. */
131
+ signature?: {
132
+ digest: string;
133
+ signer: string;
134
+ signature: string;
135
+ payload?: unknown;
136
+ };
137
+ /** The answer to a `confirmation` request. */
138
+ confirmed?: boolean;
139
+ /** Spec 374 — the answer to a `commitment` request: what the debtor's agent delivered when its parked
140
+ * run finished. `outcome` is the debtor's word; `result` is the step's result when it answered. */
141
+ delivered?: {
142
+ outcome: 'answer' | 'refused' | 'error';
143
+ result?: unknown;
144
+ said?: string;
145
+ receipts?: unknown[];
146
+ runRef?: string;
147
+ };
148
+ }
149
+ /** Thrown by a tool invoker to suspend the run with a prompt. The loop recognises this class and ONLY this
150
+ * class — any other throw is a step failure. */
151
+ export declare class InputRequired extends Error {
152
+ readonly request: InputRequestV1;
153
+ constructor(request: InputRequestV1);
154
+ }
155
+ export declare function isInputRequired(e: unknown): e is InputRequired;
156
+ /** The inputs supplied for one step (a resume may answer several steps at once). */
157
+ export declare function inputsFor(supplied: readonly SuppliedInputV1[] | undefined, stepRef: string): SuppliedInputV1[];
158
+ /** The merged `data` answers for a step (later entries win). */
159
+ export declare function dataFor(supplied: readonly SuppliedInputV1[] | undefined, stepRef: string): Record<string, unknown>;
160
+ /** The supplied signature over `digest` for a step, if any. Case-insensitive on the digest. */
161
+ export declare function signatureFor(supplied: readonly SuppliedInputV1[] | undefined, stepRef: string, digest?: string): SuppliedInputV1['signature'] | undefined;
162
+ /** What a `suspended` receipt carries about the prompt — the kind and, for a signature, the digest; never
163
+ * the answers (those are the person's, and they arrive on the resume). */
164
+ export declare function receiptPending(req: InputRequestV1): NonNullable<StepReceipt['pendingInput']>;
165
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
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AAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE9D;AAED,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAE9G;AAED,gEAAgE;AAChE,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAElH;AAED,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,GAAG,SAAS,CAIzJ;AAED;2EAC2E;AAC3E,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAE5F"}
package/dist/input.js ADDED
@@ -0,0 +1,33 @@
1
+ /** Thrown by a tool invoker to suspend the run with a prompt. The loop recognises this class and ONLY this
2
+ * class — any other throw is a step failure. */
3
+ export class InputRequired extends Error {
4
+ request;
5
+ constructor(request) {
6
+ super(`input required: ${request.kind} for ${request.toolId} (${request.stepRef})`);
7
+ this.name = 'InputRequired';
8
+ this.request = request;
9
+ }
10
+ }
11
+ export function isInputRequired(e) {
12
+ return e instanceof InputRequired || (typeof e === 'object' && e !== null && e.name === 'InputRequired' && 'request' in e);
13
+ }
14
+ /** The inputs supplied for one step (a resume may answer several steps at once). */
15
+ export function inputsFor(supplied, stepRef) {
16
+ return (supplied ?? []).filter((s) => s.stepRef === stepRef);
17
+ }
18
+ /** The merged `data` answers for a step (later entries win). */
19
+ export function dataFor(supplied, stepRef) {
20
+ return Object.assign({}, ...inputsFor(supplied, stepRef).map((s) => s.data ?? {}));
21
+ }
22
+ /** The supplied signature over `digest` for a step, if any. Case-insensitive on the digest. */
23
+ export function signatureFor(supplied, stepRef, digest) {
24
+ return inputsFor(supplied, stepRef)
25
+ .map((s) => s.signature)
26
+ .find((s) => !!s && (digest === undefined || s.digest.toLowerCase() === digest.toLowerCase()));
27
+ }
28
+ /** What a `suspended` receipt carries about the prompt — the kind and, for a signature, the digest; never
29
+ * the answers (those are the person's, and they arrive on the resume). */
30
+ export function receiptPending(req) {
31
+ return { kind: req.kind, ...(req.kind === 'signature' ? { digest: req.digest, signer: req.signer } : {}), ...(req.kind === 'data' ? { fields: req.fields.map((f) => f.name) } : {}) };
32
+ }
33
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAyHA;iDACiD;AACjD,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,OAAO,CAAiB;IACjC,YAAY,OAAuB;QACjC,KAAK,CAAC,mBAAmB,OAAO,CAAC,IAAI,QAAQ,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;QACpF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,OAAO,CAAC,YAAY,aAAa,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAK,CAAuB,CAAC,IAAI,KAAK,eAAe,IAAI,SAAS,IAAI,CAAC,CAAC,CAAC;AACpJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,SAAS,CAAC,QAAgD,EAAE,OAAe;IACzF,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AAC/D,CAAC;AAED,gEAAgE;AAChE,MAAM,UAA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 /** What the agent knows about who is asking — gathered by the harness from what it already holds. Labels and ids only. */
3
+ export interface AskerContextV1 {
4
+ /** The asker's standing toward this agent. */
5
+ relation?: 'self' | 'steward' | 'member' | 'stranger';
6
+ /** Skills this asker used here recently, most frequent first (tool ids with counts). */
7
+ recentSkills?: ReadonlyArray<{
8
+ id: string;
9
+ times: number;
10
+ }>;
11
+ /** What the person's own agent remembers about them that bears on a request — short tags ("faith journey: new
12
+ * believer", "poker: intermediate"), never a record's text. Present only at the person's own agent. */
13
+ memoryTags?: readonly string[];
14
+ /** Spec 417 — domain classes the asker already HOLDS (class IRIs of their typed records, or a comparison's seeded
15
+ * state): a chain does not re-produce what is in hand. Classes only, never the records. */
16
+ heldClasses?: readonly string[];
17
+ }
18
+ export interface InferredIntentReadingV1 {
19
+ /** Classes the request's words name, with the term that named each. */
20
+ names: GroundingV1[];
21
+ /** Spec 418 D4 — the asker's OFFICE, from their memory tags grounded in the lexicon's role classes (a class that declares
22
+ * `uses`), with the capabilities that role typically uses: a prior the judge weighs, never a filter. */
23
+ offices?: Array<{
24
+ iri: string;
25
+ uses: string[];
26
+ }>;
27
+ /** Classes sharing a semantic cluster with a named one (not named themselves). */
28
+ near: string[];
29
+ asker?: AskerContextV1;
30
+ }
31
+ /** Read the request into the ontology's terms (and carry what is known of the asker). */
32
+ export declare function inferIntent(ask: string, candidates: ReadonlyArray<OntologyCandidateV1>, lexicon?: DomainLexiconV1, asker?: AskerContextV1): InferredIntentReadingV1;
33
+ /** The reading as the judge sees it — labels, not IRIs; short. */
34
+ export declare function renderReading(ask: string, reading: InferredIntentReadingV1, labelOf: (iri: string) => string): string;
35
+ /** A skill's CARD in the ontology's terms: one line of purpose, what it produces, what it is not for. */
36
+ export declare function skillCard(c: JudgmentCandidateV1): string;
37
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../src/intent.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,E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
1
+ import { groundInLexicon } from './selection.js';
2
+ /** Read the request into the ontology's terms (and carry what is known of the asker). */
3
+ export function inferIntent(ask, candidates, lexicon, asker) {
4
+ const names = groundInLexicon(ask, candidates, lexicon);
5
+ const named = new Set(names.map((g) => g.iri));
6
+ const clustersOf = new Map((lexicon ?? []).map((e) => [e.iri, e.clusters]));
7
+ const clusters = new Set([...named].flatMap((iri) => clustersOf.get(iri) ?? []));
8
+ const near = (lexicon ?? []).filter((e) => !named.has(e.iri) && e.clusters.some((c) => clusters.has(c))).map((e) => e.iri).sort();
9
+ // The asker's office: their memory tags grounded in the role classes only (a role word in the request is the request's).
10
+ const roles = (lexicon ?? []).filter((e) => e.uses?.length);
11
+ const offices = asker?.memoryTags?.length && roles.length
12
+ ? groundInLexicon(asker.memoryTags.join(' . '), [], roles).map((g) => ({ iri: g.iri, uses: [...(roles.find((e) => e.iri === g.iri)?.uses ?? [])] }))
13
+ : [];
14
+ return { names, near, ...(offices.length ? { offices } : {}), ...(asker ? { asker } : {}) };
15
+ }
16
+ /** The reading as the judge sees it — labels, not IRIs; short. */
17
+ export function renderReading(ask, reading, labelOf) {
18
+ const lines = [`Request: ${ask}`];
19
+ if (reading.names.length)
20
+ lines.push(`It names (domain terms): ${reading.names.map((g) => `${labelOf(g.iri)} ("${g.term}")`).join('; ')}.`);
21
+ else
22
+ lines.push('It names no term of this domain\'s vocabulary.');
23
+ if (reading.near.length)
24
+ lines.push(`Nearby in the domain: ${reading.near.slice(0, 8).map(labelOf).join(', ')}.`);
25
+ const a = reading.asker;
26
+ if (a?.relation)
27
+ lines.push(`Asked by: ${a.relation === 'self' ? 'the agent\'s own principal' : `a ${a.relation} of this agent`}.`);
28
+ if (a?.recentSkills?.length)
29
+ lines.push(`This asker recently used: ${a.recentSkills.slice(0, 4).map((s) => `${s.id} (${s.times}×)`).join(', ')}.`);
30
+ if (a?.memoryTags?.length)
31
+ lines.push(`Known about the asker: ${a.memoryTags.slice(0, 6).join('; ')}.`);
32
+ for (const o of reading.offices ?? [])
33
+ lines.push(`The asker's role: ${labelOf(o.iri)} — a role that typically uses ${o.uses.join(', ')}.`);
34
+ if (a?.heldClasses?.length)
35
+ lines.push(`The asker already holds: ${a.heldClasses.slice(0, 8).map(labelOf).join(', ')}.`);
36
+ return lines.join('\n');
37
+ }
38
+ /** A skill's CARD in the ontology's terms: one line of purpose, what it produces, what it is not for. */
39
+ export function skillCard(c) {
40
+ const purpose = c.description.split(/\bNOT for\b/i)[0].replace(/\s+/g, ' ').trim();
41
+ const oneLine = purpose.length > 180 ? `${purpose.slice(0, 177).replace(/\s+\S*$/, '')}…` : purpose;
42
+ const produces = (c.covers ?? []).map((k) => k.label).join(', ');
43
+ const notFor = (c.excludes ?? []).map((k) => k.label).join(', ');
44
+ return `${oneLine}${produces ? ` Produces: ${produces}.` : ''}${notFor ? ` Not for: ${notFor}.` : ''}`;
45
+ }
46
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../src/intent.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA2BjD,yFAAyF;AACzF,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,UAA8C,EAAE,OAAyB,EAAE,KAAsB;IACxI,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,QAAQ,GAAG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AAO,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;IACpG,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAc,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACzG,CAAC"}
@@ -0,0 +1,131 @@
1
+ import type { StructuredCallLike } from './selection.js';
2
+ export declare const NOT_APPLICABLE = "n/a";
3
+ export type JudgmentQuestionV1 = {
4
+ id: string;
5
+ kind: 'yes-no';
6
+ statement: string;
7
+ } | {
8
+ id: string;
9
+ kind: 'scale';
10
+ question: string; /** worst → best */
11
+ levels: ReadonlyArray<{
12
+ id: string;
13
+ describe: string;
14
+ }>;
15
+ notApplicable?: string;
16
+ } | {
17
+ id: string;
18
+ kind: 'choice';
19
+ question: string;
20
+ options: ReadonlyArray<{
21
+ id: string;
22
+ describe: string;
23
+ }>;
24
+ /** Outcomes that are not options — e.g. "ask the person", "needs several" — listed after the options, never
25
+ * shuffled or renamed. */
26
+ alsoOutcomes?: ReadonlyArray<{
27
+ id: string;
28
+ describe: string;
29
+ }>;
30
+ /** Describes when NONE of the options applies; present ⇒ `n/a` is an outcome. */ notApplicable?: string;
31
+ };
32
+ /** One question's answer: the normalised distribution over its outcomes, the top outcome, and how far it leads. */
33
+ export interface JudgmentAnswerV1 {
34
+ id: string;
35
+ kind: JudgmentQuestionV1['kind'];
36
+ distribution: Record<string, number>;
37
+ top: string;
38
+ /** P(top). */
39
+ confidence: number;
40
+ /** P(top) − P(runner-up). */
41
+ lead: number;
42
+ /** Scale only: the expected level index (0 = worst), over the applicable levels. */
43
+ expectedLevel?: number;
44
+ }
45
+ export interface JudgmentV1 {
46
+ /** The binding that decided (J3), e.g. `ap.decision-model.structured-call.v1`. */
47
+ judge: {
48
+ name: string;
49
+ kind: 'model' | 'mechanical' | 'human';
50
+ };
51
+ answers: Record<string, JudgmentAnswerV1>;
52
+ /** Questions the binding answered in a shape that could not be read as a distribution (J8: said, never guessed). */
53
+ unreadable: string[];
54
+ /** The binding failed outright (the provider refused, timed out, called nothing): no answers. */
55
+ error?: string;
56
+ /** For each unreadable question, the SHAPE of what came back (types and field names, never values) — so "malformed"
57
+ * can be diagnosed without recording anything the judge read or wrote. */
58
+ received?: Record<string, string>;
59
+ }
60
+ /** Raw distributions from a binding, per question id, before normalisation. */
61
+ export type RawDistributionsV1 = Record<string, Record<string, number>>;
62
+ /** THE DECISION-MODEL PORT (J13): a frozen state + typed questions in, one distribution per question out. A binding
63
+ * may add `received`: the shape of anything it could not read (never values). */
64
+ export interface DecisionModelPort {
65
+ readonly name: string;
66
+ readonly kind: 'model' | 'mechanical' | 'human';
67
+ decide(state: string, questions: ReadonlyArray<JudgmentQuestionV1>): Promise<{
68
+ distributions: RawDistributionsV1;
69
+ received?: Record<string, string>;
70
+ }>;
71
+ }
72
+ /** The shape of a value — types and field names only, never a value. */
73
+ export declare function shapeOf(v: unknown, depth?: number): string;
74
+ /** The outcomes a question admits, in order. */
75
+ export declare function outcomesOf(q: JudgmentQuestionV1): string[];
76
+ /** Normalise one raw distribution over a question's outcomes. Unknown keys and non-finite / negative values are
77
+ * dropped; an all-zero answer is unreadable (null). Deterministic tie-break by outcome order. */
78
+ export declare function answerOf(q: JudgmentQuestionV1, raw: Record<string, number> | undefined): JudgmentAnswerV1 | null;
79
+ /** Ask a decision model the questions about one state. A failed binding is `error`, never an answer (J8). */
80
+ export declare function judgeQuestions(state: string, questions: ReadonlyArray<JudgmentQuestionV1>, port: DecisionModelPort): Promise<JudgmentV1>;
81
+ /** THE DECLARED DECISION RULE over a choice/scale answer: take the top only when it is an option (not n/a), carries at
82
+ * least `floor`, and leads the runner-up (n/a included) by `margin`. Otherwise abstain, naming why. */
83
+ export interface DecisionRuleV1 {
84
+ floor: number;
85
+ margin: number;
86
+ }
87
+ export type DecisionV1 = {
88
+ decided: string;
89
+ } | {
90
+ decided: null;
91
+ because: 'not-applicable' | 'below-floor' | 'no-margin' | 'unreadable';
92
+ };
93
+ export declare function applyDecisionRule(answer: JudgmentAnswerV1 | undefined, rule: DecisionRuleV1): DecisionV1;
94
+ /** J10 — the explanation is COMPOSED from the numbers, never generated. */
95
+ export declare function explainAnswer(answer: JudgmentAnswerV1, label?: (outcome: string) => string): string;
96
+ /**
97
+ * A decision model bound to one forced structured call. The tool's schema has, per question, an array of
98
+ * `{outcome, p}` with `outcome` an enum of that question's outcomes — and NOTHING ELSE: no reason, no text (J10).
99
+ * `name` is recorded on every judgment (J3); it should change whenever the prompt or the model changes (J5).
100
+ */
101
+ export declare function structuredCallDecisionModel(call: StructuredCallLike, opts: {
102
+ name: string;
103
+ maxTokens?: number;
104
+ /** A `scratch` field, FIRST in the schema, where the model may reason before the numbers — for a model that does not
105
+ * reason internally (measured 2026-09-26: numbers-only cost Claude Haiku 12 points and its calibration; Gemini, which
106
+ * thinks, lost nothing). Discarded here, never returned, never recorded (J7, J10). */
107
+ privateReasoning?: boolean;
108
+ /** The questions go in the SYSTEM prompt and the state last, so the prefix is the same on every call for the same
109
+ * questions — what a provider's prompt cache keys on. (The default puts the state first.) */
110
+ stablePrefix?: boolean;
111
+ }): DecisionModelPort;
112
+ export interface AveragedJudgmentV1 extends JudgmentV1 {
113
+ /** How many permutations were asked and how many answered (an unanswered one is left out of the average, and said). */
114
+ permutations: {
115
+ asked: number;
116
+ answered: number;
117
+ };
118
+ }
119
+ export declare function judgeQuestionsAveraged(state: string, questions: ReadonlyArray<JudgmentQuestionV1>, port: DecisionModelPort, opts: {
120
+ permutations: number;
121
+ }): Promise<AveragedJudgmentV1>;
122
+ /** The host call: one letter among `letters`, each letter's reported log-probability. */
123
+ export type LogprobChoiceLike = (input: {
124
+ system: string;
125
+ user: string;
126
+ letters: readonly string[];
127
+ }) => Promise<Record<string, number>>;
128
+ export declare function logprobChoiceDecisionModel(choose: LogprobChoiceLike, opts: {
129
+ name: string;
130
+ }): DecisionModelPort;
131
+ //# sourceMappingURL=judgment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judgment.d.ts","sourceRoot":"","sources":["../src/judgment.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,mBAAmB;IAAC,MAAM,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACpJ;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvG;+BAC2B;IAC3B,YAAY,CAA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