@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
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @agenticprimitives/orchestration
2
2
 
3
+ > Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)
4
+
3
5
  The Ring-0 **agentic orchestration core**: the intent → plan → execute → observe loop, the `Planner` and
4
6
  `ToolInvoker` ports, and a deterministic rule-based planner. A first-party app expresses a **goal**; this
5
7
  package plans which tools compose to satisfy it and runs them through an injected invoker — the web never
@@ -0,0 +1,127 @@
1
+ import type { Intent, Plan, ToolSpec } from './types.js';
2
+ /** Spec 367 §4 — the violation codes. Each names the field at fault and the recovery it allows. */
3
+ export type AdmissionCode = 'REQUIRED_ROLE_UNRESOLVED' | 'RESOURCE_SCOPE_MISMATCH' | 'CAPABILITY_UNAVAILABLE' | 'UNSUPPORTED_BINDING_SOURCE' | 'DEPENDENCY_NOT_SATISFIED' | 'OUTCOME_NOT_ESTABLISHED' | 'BRANCH_UNDECIDABLE' | 'QUESTION_NOT_ANSWERED' | 'EXTERNAL_EXECUTOR_ACT' | 'OUTCOME_NOT_ENTAILED' | 'OUTCOME_BOUND_EXCEEDED' | 'OUTCOME_DISCLOSURE';
4
+ export interface AdmissionViolation {
5
+ code: AdmissionCode;
6
+ /** The sentence a planner is re-planned with, and a person is refused with. */
7
+ message: string;
8
+ stepIndex?: number;
9
+ toolId?: string;
10
+ /** The argument or plan field at fault, when there is one. */
11
+ field?: string;
12
+ /** What may fix it: re-plan the means, ask the person, resolve the binding, or refuse. */
13
+ /** `continue` (spec 421 W1): the plan read what the act needs and stopped — the loop appends `plan.continue` itself. */
14
+ recovery: 'replan' | 'ask' | 'resolve' | 'refuse' | 'continue';
15
+ }
16
+ export type AdmissionVerdict = {
17
+ admitted: true;
18
+ } | {
19
+ admitted: false;
20
+ violations: AdmissionViolation[];
21
+ };
22
+ export interface AdmissionInput {
23
+ intent: Intent;
24
+ plan: Plan;
25
+ tools: ToolSpec[];
26
+ }
27
+ /** One rule. Pure over its input and whatever deps it closed over; returns the violations it found. */
28
+ export type AdmissionRule = (input: AdmissionInput) => Promise<AdmissionViolation[]> | AdmissionViolation[];
29
+ export interface PlanAdmission {
30
+ admit(input: AdmissionInput): Promise<AdmissionVerdict>;
31
+ }
32
+ /** Compose rules into the port. Every rule runs; the verdict carries every violation, so a re-plan is
33
+ * told everything at once rather than one thing per round. */
34
+ export declare function planAdmission(rules: readonly AdmissionRule[]): PlanAdmission;
35
+ /** Letters only — "Missio Nexus", "missio-nexus" and the label of `missionexus.org` are one word to a person. */
36
+ export declare const squash: (s: string) => string;
37
+ /**
38
+ * AN INSTRUCTION IS ANSWERED BY AN ACT. A tool that declares a capability declares the verbs that name it
39
+ * (`ToolSpec.verbs`). A sentence that OPENS with one of those verbs is an instruction, and a plan for it
40
+ * that contains no capability-bearing step is a read pretending to act — the plan that told a person
41
+ * "nothing was sent" about a payment they asked for. Which act is not judged here (a message and a
42
+ * payment both open with "send"); that a step ACTS is.
43
+ */
44
+ /** What a tool ESTABLISHES (spec 367 §6), with the declared default: a read establishes who was meant; an act
45
+ * establishes its outcome unless its contract says it only submits. */
46
+ export declare function outcomeClassOf(t: ToolSpec): 'lookup' | 'submission' | 'authoritative';
47
+ export declare const instructionNeedsAct: AdmissionRule;
48
+ /** A step that consumes `{ $ref: name }` must follow a step that provides `ref: name` (spec 367 §4:
49
+ * typed unresolved dependencies — a later step may depend on an earlier one, never on nothing). */
50
+ export declare const dependenciesProvided: AdmissionRule;
51
+ /**
52
+ * Spec 370 P3 — a branch must be DECIDABLE and an edge must point BACKWARD. `when.ref` names a result an
53
+ * earlier step binds (`ref`); `after` names ids of earlier steps. A branch on a result nobody produces would
54
+ * be decided by absence — which is a guess dressed as a condition — and an edge to a later step is a cycle.
55
+ */
56
+ export declare const branchesDecidable: AdmissionRule;
57
+ export declare const questionAnsweredByRead: AdmissionRule;
58
+ /** A step naming a tool this agent does not expose. Without this rule the loop hard-throws `unknown_tool` and the
59
+ * run dies with a raw error and no recovery. As an admission rule it is a RE-PLAN, not a refusal: a missing
60
+ * capability is exactly what one more planning round — told which tools the agent has — can fix (the model that
61
+ * named `calendar.events.list` on a game persona recovers to a tool it offers, or to an honest "I don't have a
62
+ * calendar"). If the re-plan names an unexposed tool again, the loop's second-admission path makes it terminal
63
+ * with this same sentence. Recovery `refuse` would skip that round and is wrong here — a missing capability is
64
+ * not something no re-plan can fix. */
65
+ export declare const capabilitiesAvailable: AdmissionRule;
66
+ /** A PLACEHOLDER IS NOT AN ARGUMENT. "<UNKNOWN>", "TBD", "n/a" inside a step is a value the person would be
67
+ * asked to sign over. Omit the argument and it is asked for; a placeholder is refused. */
68
+ export declare const noPlaceholders: AdmissionRule;
69
+ /** The numbers a sentence states: digits (1,250.50 · 12.5 · $3) and the plain number words. */
70
+ export declare function numbersSaid(sentence: string): number[];
71
+ /**
72
+ * AN ACT NEVER CARRIES A NUMBER THE PERSON DID NOT SAY. "Pay nathan.treasury back for the hymnals" names no amount; the
73
+ * planner wrote 12.50, and only the balance check stopped a mandate for a sum she never said (act laboratory,
74
+ * 2026-09-28). A numeric argument of an ACT step whose value is not among the sentence's numbers is dropped — and the
75
+ * step then asks for it, as a missing argument always does. Reads are not held to this (a limit on a listing is not
76
+ * something anyone signs). Deterministic: numbers are compared by value, never by a model.
77
+ */
78
+ export declare const numbersFromTheWords: AdmissionRule;
79
+ /**
80
+ * ONE PARTY IS NOT BOTH SIDES OF AN ACT. "Pay nathan.treasury back for the hymnals" was planned with nathan.treasury as
81
+ * payee AND payer (act laboratory, 2026-09-28) — a mandate for the payee's own authority. The ontology declares each
82
+ * party argument's side (`PARTY_ROLES`: acting · counterparty · context); an acting argument that names the same party as
83
+ * a counterparty argument of the same step came from nowhere the person said. The ACTING one is dropped (recovery `ask`):
84
+ * the declared default then fills it and says why, or the person is asked. `sideOf` is the ontology's, supplied by the app.
85
+ */
86
+ export declare function partiesDistinct(sideOf: (capability: string, arg: string) => 'acting' | 'counterparty' | 'context' | undefined): AdmissionRule;
87
+ /**
88
+ * THE ACTING PARTY IS THE PERSON'S TO NAME. When she names no paying account the declared default decides it and says why
89
+ * (spec 363); a planner that writes one anyway ("my treasury", the payee itself) replaces that decision with words she
90
+ * never said — and the harness then asks her which treasury she meant by words that were not hers (act laboratory,
91
+ * 2026-09-28). An ACTING argument (the ontology's side, `sideOf`) with no word of its own in the sentence — words inside
92
+ * the counterparty's value do not count, nor filler like "my" — is dropped (recovery `ask`): decided or asked for.
93
+ * An address is left alone (it arrives from a surface or a resolved turn, never from a planner's paraphrase).
94
+ */
95
+ export declare function actingPartyFromTheWords(sideOf: (capability: string, arg: string) => 'acting' | 'counterparty' | 'context' | undefined): AdmissionRule;
96
+ /**
97
+ * THE KIND THE PERSON NAMED IS THE KIND CHARTERED. Asked to "start a team … under Missio Nexus" where no team tool was
98
+ * offered, the planner chartered an ORGANIZATION (act laboratory, 2026-09-28) — the nearest kind, which the tool's own
99
+ * description forbids in prose. Here it is a rule: `kinds` (the app's chartering capabilities and the words for each —
100
+ * its noun and its name suffix) — a step chartering kind A when the sentence names kind B and never A is re-planned
101
+ * with the reason; if nothing charters B, the plan says so rather than making the nearest thing. Dotted names
102
+ * ("missio-nexus.org") are not words the person used for a kind.
103
+ */
104
+ export declare function kindNamedIsChartered(kinds: ReadonlyArray<{
105
+ capability: string;
106
+ noun: string;
107
+ words: readonly string[];
108
+ }>): AdmissionRule;
109
+ /**
110
+ * THE SUBJECT THE SENTENCE NAMES MUST BE IN THE STEP. A tool that declares a `subject` argument (spec 366)
111
+ * is answered by the agent that argument names. When the sentence contains the name of an agent the asker
112
+ * KNOWS — from their own links, supplied by the harness, never guessed from the directory — and the step
113
+ * leaves the subject empty, the step would run against the addressee's own records and answer for the
114
+ * wrong agent. That is the Missio Nexus incident, as a rule.
115
+ */
116
+ export declare function subjectNamedInAsk(knownNames: (intent: Intent) => Promise<Array<{
117
+ name: string;
118
+ agent: string;
119
+ }>>): AdmissionRule;
120
+ /**
121
+ * Spec 379 (appendix M4) — AN OUTSIDE AGENT MAY ANSWER, NEVER ACT. A step whose `executor` is outside this
122
+ * deployment (the caller says which — an https card URL, an address not served here) may run only a
123
+ * tool that exercises no capability: its answer is an observation. A value-moving or record-changing
124
+ * step aimed at an outside agent is refused at admission, before any planner or verifier spends anything.
125
+ */
126
+ export declare function externalExecutorsReadOnly(isExternal: (executor: string) => boolean): AdmissionRule;
127
+ //# sourceMappingURL=admission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.d.ts","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGzD,mGAAmG;AACnG,MAAM,MAAM,aAAa,GACrB,0BAA0B,GAC1B,yBAAyB,GACzB,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,yBAA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AAE,CAAC,CAAC,GAAG,aAAa,CAsBhI;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,aAAa,CAWlG"}
@@ -0,0 +1,355 @@
1
+ import { CONTINUE_STEP_ID } from './types.js';
2
+ /** Compose rules into the port. Every rule runs; the verdict carries every violation, so a re-plan is
3
+ * told everything at once rather than one thing per round. */
4
+ export function planAdmission(rules) {
5
+ return {
6
+ async admit(input) {
7
+ const violations = (await Promise.all(rules.map((r) => r(input)))).flat();
8
+ return violations.length ? { admitted: false, violations } : { admitted: true };
9
+ },
10
+ };
11
+ }
12
+ const lc = (s) => s.trim().toLowerCase();
13
+ /** Letters only — "Missio Nexus", "missio-nexus" and the label of `missionexus.org` are one word to a person. */
14
+ export const squash = (s) => lc(s).replace(/[^a-z0-9]+/g, '');
15
+ /** The imperative opening of a sentence, with the polite wrappers stripped: "please send…", "can you pay…",
16
+ * "i want to create…" all open with the verb. A question ("who did I send money to") does not. */
17
+ function imperativeOf(goal) {
18
+ return lc(goal).replace(/^(please\s+|can you\s+|could you\s+|would you\s+|i want to\s+|i'd like to\s+|i would like to\s+|go ahead and\s+)+/, '');
19
+ }
20
+ /**
21
+ * AN INSTRUCTION IS ANSWERED BY AN ACT. A tool that declares a capability declares the verbs that name it
22
+ * (`ToolSpec.verbs`). A sentence that OPENS with one of those verbs is an instruction, and a plan for it
23
+ * that contains no capability-bearing step is a read pretending to act — the plan that told a person
24
+ * "nothing was sent" about a payment they asked for. Which act is not judged here (a message and a
25
+ * payment both open with "send"); that a step ACTS is.
26
+ */
27
+ /** What a tool ESTABLISHES (spec 367 §6), with the declared default: a read establishes who was meant; an act
28
+ * establishes its outcome unless its contract says it only submits. */
29
+ export function outcomeClassOf(t) {
30
+ return t.establishes ?? (t.capability ? 'authoritative' : 'lookup');
31
+ }
32
+ export const instructionNeedsAct = ({ intent, plan, tools }) => {
33
+ const opening = imperativeOf(intent.goal);
34
+ const acts = tools.filter((t) => t.capability && t.verbs?.length);
35
+ // "TELL ME about…" / "message me when…" is the person asking HER OWN AGENT, not an instruction to reach someone: the
36
+ // verb's object is the speaker. A question in that form was refused as an unperformed act ("Tell me about the
37
+ // articles in my library" → plan messaging.direct.send — live 2026-09-21). "tell melissa" still claims the verb.
38
+ const selfDirected = (v) => new RegExp(`^${lc(v).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} (me|us)\\b`).test(opening);
39
+ // A clause may carry the verb too (spec 421): "read my latest message AND REPLY to whoever sent it" instructs a reply.
40
+ const clauses = [opening, ...opening.split(/\s*[—–;:,]\s*|\s+(?:and then|then|and)\s+/).slice(1)];
41
+ const claims = (t) => !!t.verbs?.some((v) => clauses.some((c) => (c === lc(v) || c.startsWith(`${lc(v)} `)) && !new RegExp(`^${lc(v).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} (me|us)\\b`).test(c)));
42
+ const named = acts.filter(claims);
43
+ if (!named.length)
44
+ return [];
45
+ const byId = new Map(tools.map((t) => [t.id, t]));
46
+ // A READ MAY CLAIM THE VERB TOO (spec 379): "ask the clock what time it is" opens with "ask", which an
47
+ // invitation act also claims. When a lookup in the plan declares that verb, the read IS what was
48
+ // instructed — consulting an outside agent — and the plan discharges the sentence by doing it.
49
+ if (plan.steps.some((s) => { const t = byId.get(s.toolId); return !!t && !t.capability && claims(t); }))
50
+ return [];
51
+ // The outcome rule (§6), not a "last tool" rule: a lookup may precede the act (who is "my daughter"), and
52
+ // a notification may follow it. What may not happen is a plan whose every step only ESTABLISHES WHO WAS
53
+ // MEANT — a lookup cannot discharge an instruction, however well it went.
54
+ const canDischarge = plan.steps.some((s) => { const t = byId.get(s.toolId); return !!t && outcomeClassOf(t) !== 'lookup'; });
55
+ if (canDischarge)
56
+ return [];
57
+ // Spec 421 W1 — A PLAN THAT READS AND THEN CONTINUES has deferred the act, not skipped it: the act is planned from what
58
+ // the reads return, and that continuation plan is admitted by this same rule before anything in it runs.
59
+ if (plan.steps[plan.steps.length - 1]?.toolId === CONTINUE_STEP_ID)
60
+ return [];
61
+ const canContinue = tools.some((t) => t.id === CONTINUE_STEP_ID);
62
+ // With continuation on and something READ, the plan has gathered what the act needs and stopped short: the recovery is to
63
+ // continue from what it reads (deterministic — the harness does not wait for a model to notice the option).
64
+ const readSomething = plan.steps.some((s) => { const t = byId.get(s.toolId); return !!t && !t.capability; });
65
+ return [{
66
+ code: 'OUTCOME_NOT_ESTABLISHED', recovery: canContinue && readSomething ? 'continue' : 'replan',
67
+ message: `"${intent.goal}" is an instruction (it opens with ${named.map((t) => `"${t.verbs[0]}"`).join(' / ')}) and every step in the plan only looks something up (${plan.steps.map((s) => s.toolId).join(', ') || 'nothing'}) — a lookup cannot establish that it was done. Plan the capability that performs it — ${named.map((t) => t.id).join(' or ')} — and pass the person's words as its arguments; it resolves who is meant itself.${canContinue ? ` If its arguments are in something you must read first (a message, a record), plan that read and end the plan with ${CONTINUE_STEP_ID}: you will be shown what it returned and plan the act from it.` : ''}`,
68
+ }];
69
+ };
70
+ /** A step that consumes `{ $ref: name }` must follow a step that provides `ref: name` (spec 367 §4:
71
+ * typed unresolved dependencies — a later step may depend on an earlier one, never on nothing). */
72
+ export const dependenciesProvided = ({ plan }) => {
73
+ const out = [];
74
+ const provided = new Set();
75
+ plan.steps.forEach((s, i) => {
76
+ const refs = new Set();
77
+ const walk = (v) => {
78
+ if (!v || typeof v !== 'object')
79
+ return;
80
+ if (Array.isArray(v)) {
81
+ v.forEach(walk);
82
+ return;
83
+ }
84
+ const o = v;
85
+ if (typeof o.$ref === 'string')
86
+ refs.add(o.$ref.split('.')[0]);
87
+ if (typeof o.$forEach === 'string')
88
+ refs.add(o.$forEach.split('.')[0]);
89
+ Object.values(o).forEach(walk);
90
+ };
91
+ walk(s.args);
92
+ // The fan-out form (spec 358 W4): `forEach: { ref: 'roster.members' }` names the enumerating step by ref.
93
+ const fe = s.forEach;
94
+ if (fe && typeof fe.ref === 'string')
95
+ refs.add(fe.ref.split('.')[0]);
96
+ for (const r of refs)
97
+ if (!provided.has(r))
98
+ out.push({ code: 'DEPENDENCY_NOT_SATISFIED', recovery: 'replan', stepIndex: i, toolId: s.toolId, field: r, message: `step ${i + 1} (${s.toolId}) uses "${r}" before any step provides it — order the step that produces "${r}" first, or drop the reference.` });
99
+ if (s.ref)
100
+ provided.add(s.ref);
101
+ });
102
+ return out;
103
+ };
104
+ /**
105
+ * Spec 370 P3 — a branch must be DECIDABLE and an edge must point BACKWARD. `when.ref` names a result an
106
+ * earlier step binds (`ref`); `after` names ids of earlier steps. A branch on a result nobody produces would
107
+ * be decided by absence — which is a guess dressed as a condition — and an edge to a later step is a cycle.
108
+ */
109
+ export const branchesDecidable = ({ plan }) => {
110
+ const out = [];
111
+ const provided = new Set();
112
+ const ids = new Set();
113
+ plan.steps.forEach((s, i) => {
114
+ const w = s.when;
115
+ if (w && (typeof w.ref !== 'string' || !provided.has(w.ref.split('.')[0]))) {
116
+ out.push({ code: 'BRANCH_UNDECIDABLE', recovery: 'replan', stepIndex: i, toolId: s.toolId, field: 'when', message: `step ${i + 1} (${s.toolId}) branches on "${String(w.ref ?? '')}", which no earlier step produces — bind the producing step with $ref first, or drop the condition.` });
117
+ }
118
+ for (const id of s.after ?? []) {
119
+ if (typeof id !== 'string' || !ids.has(id))
120
+ out.push({ code: 'BRANCH_UNDECIDABLE', recovery: 'replan', stepIndex: i, toolId: s.toolId, field: 'after', message: `step ${i + 1} (${s.toolId}) waits for "${String(id)}", which is not an earlier step's id.` });
121
+ }
122
+ if (s.ref)
123
+ provided.add(s.ref);
124
+ ids.add(s.id ?? `s${i}`);
125
+ });
126
+ return out;
127
+ };
128
+ /**
129
+ * Spec 371 — THE QUESTION MUST BE ANSWERED BY THE READ THAT ANSWERS IT. A read declares the fact words a
130
+ * question uses to name what it establishes (`answers`: "balance", "how much"). When the sentence names
131
+ * such a fact and an exposed tool answers it, a plan without that tool is answering something else — a
132
+ * survey of receipts for a balance question. The rule reads declarations only, and it says which tool.
133
+ */
134
+ /**
135
+ * WHAT SOMEBODY SAID, NOT WHAT WAS ATTACHED TO IT. An ask on the A2A surface carries its material in the
136
+ * same string as its sentence — a card table sends the seat's view, a mystery sends the character's whole
137
+ * night — and this rule strips punctuation before matching, so `"holds":["the register key"]` inside that
138
+ * payload reads exactly like the word "holds" in a question about money.
139
+ *
140
+ * Live, that cost a murder mystery 39% of its moments: `treasury.balance.read` answers "holds", a character
141
+ * carrying a clue has `holds` in her view, and every such ask was refused with "use treasury.balance.read
142
+ * for that" — a balance tool demanded of a woman in mourning in a hotel. The plan was right, the sentence
143
+ * never mentioned money, and `replanning: false` made it terminal, so the character simply went quiet.
144
+ *
145
+ * A tool's `answers` words are how a PERSON names what they want. A serialized object is not something
146
+ * anyone said, so it is removed before the sentence is read.
147
+ */
148
+ const SENTENCE_ONLY = (goal) => {
149
+ let out = '';
150
+ let depth = 0;
151
+ for (const ch of goal) {
152
+ if (ch === '{' || ch === '[') {
153
+ depth++;
154
+ continue;
155
+ }
156
+ if (ch === '}' || ch === ']') {
157
+ if (depth > 0)
158
+ depth--;
159
+ continue;
160
+ }
161
+ if (depth === 0)
162
+ out += ch;
163
+ }
164
+ return out;
165
+ };
166
+ export const questionAnsweredByRead = ({ intent, plan, tools }) => {
167
+ // An INSTRUCTION names the thing it acts on: "add dave to my contacts" names "my contacts" because the contact invite
168
+ // changes them — refusing it for "a survey" (act laboratory, 2026-09-28) turned a valid act into a refusal. The rule
169
+ // guards a QUESTION answered by the wrong read; a plan that ACTS is not answering a question.
170
+ const byId = new Map(tools.map((t) => [t.id, t]));
171
+ if (plan.steps.some((s) => byId.get(s.toolId)?.capability))
172
+ return [];
173
+ const goal = ` ${lc(SENTENCE_ONLY(intent.goal)).replace(/[^a-z0-9]+/g, ' ')} `;
174
+ const out = [];
175
+ const inPlan = new Set(plan.steps.map((s) => s.toolId));
176
+ for (const t of tools) {
177
+ if (!t.answers?.length || inPlan.has(t.id))
178
+ continue;
179
+ const named = t.answers.find((w) => goal.includes(` ${lc(w).replace(/[^a-z0-9]+/g, ' ')} `));
180
+ if (!named)
181
+ continue;
182
+ out.push({ code: 'QUESTION_NOT_ANSWERED', recovery: 'replan', toolId: t.id, field: named, message: `the sentence asks about "${named}", which ${t.id} answers, and the plan does not use it — use ${t.id} for that, not a survey of other records.` });
183
+ }
184
+ return out;
185
+ };
186
+ /** A step naming a tool this agent does not expose. Without this rule the loop hard-throws `unknown_tool` and the
187
+ * run dies with a raw error and no recovery. As an admission rule it is a RE-PLAN, not a refusal: a missing
188
+ * capability is exactly what one more planning round — told which tools the agent has — can fix (the model that
189
+ * named `calendar.events.list` on a game persona recovers to a tool it offers, or to an honest "I don't have a
190
+ * calendar"). If the re-plan names an unexposed tool again, the loop's second-admission path makes it terminal
191
+ * with this same sentence. Recovery `refuse` would skip that round and is wrong here — a missing capability is
192
+ * not something no re-plan can fix. */
193
+ export const capabilitiesAvailable = ({ plan, tools }) => {
194
+ const ids = new Set(tools.map((t) => t.id));
195
+ return plan.steps.flatMap((s, i) => ids.has(s.toolId) ? [] : [{ code: 'CAPABILITY_UNAVAILABLE', recovery: 'replan', stepIndex: i, toolId: s.toolId, message: `step ${i + 1} names "${s.toolId}", which this agent does not offer — choose among: ${[...ids].join(', ')}.` }]);
196
+ };
197
+ /** A PLACEHOLDER IS NOT AN ARGUMENT. "<UNKNOWN>", "TBD", "n/a" inside a step is a value the person would be
198
+ * asked to sign over. Omit the argument and it is asked for; a placeholder is refused. */
199
+ export const noPlaceholders = ({ plan }) => plan.steps.flatMap((s, i) => Object.entries(s.args)
200
+ .filter(([, v]) => typeof v === 'string' && /^<.*>$|^(unknown|tbd|n\/a|null|undefined|placeholder)$/i.test(v.trim()))
201
+ .map(([k, v]) => ({ code: 'UNSUPPORTED_BINDING_SOURCE', recovery: 'ask', stepIndex: i, toolId: s.toolId, field: k, message: `step ${i + 1} (${s.toolId}) carries a placeholder for "${k}" (${String(v)}); omit an argument the sentence did not give, and it will be asked for.` })));
202
+ const NUMBER_WORDS = { zero: 0, one: 1, a: 1, an: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10, eleven: 11, twelve: 12, fifteen: 15, twenty: 20, thirty: 30, forty: 40, fifty: 50, hundred: 100 };
203
+ /** The numbers a sentence states: digits (1,250.50 · 12.5 · $3) and the plain number words. */
204
+ export function numbersSaid(sentence) {
205
+ const out = [...sentence.replace(/(\d),(\d{3})/g, '$1$2').matchAll(/\d+(?:\.\d+)?/g)].map((m) => Number(m[0]));
206
+ for (const w of lc(sentence).split(/[^a-z]+/))
207
+ if (w in NUMBER_WORDS && w !== 'a' && w !== 'an')
208
+ out.push(NUMBER_WORDS[w]);
209
+ // "a dollar", "an usdc" — one, only where a unit follows.
210
+ if (/\ban?\s+(?:dollar|buck|usdc)\b/i.test(sentence))
211
+ out.push(1);
212
+ return out;
213
+ }
214
+ const NUMERIC = /^\s*\$?\d+(?:\.\d+)?\s*$/;
215
+ /**
216
+ * AN ACT NEVER CARRIES A NUMBER THE PERSON DID NOT SAY. "Pay nathan.treasury back for the hymnals" names no amount; the
217
+ * planner wrote 12.50, and only the balance check stopped a mandate for a sum she never said (act laboratory,
218
+ * 2026-09-28). A numeric argument of an ACT step whose value is not among the sentence's numbers is dropped — and the
219
+ * step then asks for it, as a missing argument always does. Reads are not held to this (a limit on a listing is not
220
+ * something anyone signs). Deterministic: numbers are compared by value, never by a model.
221
+ */
222
+ export const numbersFromTheWords = ({ intent, plan, tools }) => {
223
+ const byId = new Map(tools.map((t) => [t.id, t]));
224
+ const said = numbersSaid(SENTENCE_ONLY(intent.goal));
225
+ return plan.steps.flatMap((s, i) => (byId.get(s.toolId)?.capability ? Object.entries(s.args) : [])
226
+ .filter(([, v]) => (typeof v === 'number' && Number.isFinite(v)) || (typeof v === 'string' && NUMERIC.test(v)))
227
+ .filter(([, v]) => { const n = Number(String(v).replace(/[$\s]/g, '')); return !said.some((x) => Math.abs(x - n) < 1e-9); })
228
+ .map(([k, v]) => ({ code: 'UNSUPPORTED_BINDING_SOURCE', recovery: 'ask', stepIndex: i, toolId: s.toolId, field: k, message: `step ${i + 1} (${s.toolId}) carries ${k} = ${String(v)}, a number the sentence does not state; omit it and it will be asked for.` })));
229
+ };
230
+ /**
231
+ * ONE PARTY IS NOT BOTH SIDES OF AN ACT. "Pay nathan.treasury back for the hymnals" was planned with nathan.treasury as
232
+ * payee AND payer (act laboratory, 2026-09-28) — a mandate for the payee's own authority. The ontology declares each
233
+ * party argument's side (`PARTY_ROLES`: acting · counterparty · context); an acting argument that names the same party as
234
+ * a counterparty argument of the same step came from nowhere the person said. The ACTING one is dropped (recovery `ask`):
235
+ * the declared default then fills it and says why, or the person is asked. `sideOf` is the ontology's, supplied by the app.
236
+ */
237
+ export function partiesDistinct(sideOf) {
238
+ return ({ plan, tools }) => {
239
+ const byId = new Map(tools.map((t) => [t.id, t]));
240
+ return plan.steps.flatMap((s, i) => {
241
+ const cap = byId.get(s.toolId)?.capability?.id;
242
+ if (!cap)
243
+ return [];
244
+ const named = Object.entries(s.args).filter(([, v]) => typeof v === 'string' && v.trim()).map(([k, v]) => ({ k, v: squash(String(v)), side: sideOf(cap, k) }));
245
+ return named.filter((a) => a.side === 'acting' && named.some((b) => b.side === 'counterparty' && b.v === a.v))
246
+ .map((a) => ({ code: 'UNSUPPORTED_BINDING_SOURCE', recovery: 'ask', stepIndex: i, toolId: s.toolId, field: a.k, message: `step ${i + 1} (${s.toolId}) names the same party as ${a.k} and as its counterparty; the ${a.k} was not said — omit it and it will be decided or asked for.` }));
247
+ });
248
+ };
249
+ }
250
+ const FILLER = new Set(['my', 'our', 'the', 'a', 'an', 'your', 'his', 'her', 'their', 'from', 'of', 'account', 'me', 'mine']);
251
+ /** Words that name THE ROOM (the agent asked) — a planner writing them for an acting party is not inventing one; the resolver
252
+ * turns them into the room (spec 418 §12 "us"). */
253
+ const ROOM_WORDS = new Set(['us', 'we', 'our', 'ours', 'ourselves', 'self', 'itself', 'this agent', 'the agent', 'this organization', 'this org', 'the organization', 'the org', 'this team', 'the team', 'this household', 'this workspace']);
254
+ const wordsOf = (v) => lc(v).split(/[^a-z0-9]+/).filter((w) => w && !FILLER.has(w));
255
+ /**
256
+ * THE ACTING PARTY IS THE PERSON'S TO NAME. When she names no paying account the declared default decides it and says why
257
+ * (spec 363); a planner that writes one anyway ("my treasury", the payee itself) replaces that decision with words she
258
+ * never said — and the harness then asks her which treasury she meant by words that were not hers (act laboratory,
259
+ * 2026-09-28). An ACTING argument (the ontology's side, `sideOf`) with no word of its own in the sentence — words inside
260
+ * the counterparty's value do not count, nor filler like "my" — is dropped (recovery `ask`): decided or asked for.
261
+ * An address is left alone (it arrives from a surface or a resolved turn, never from a planner's paraphrase).
262
+ */
263
+ export function actingPartyFromTheWords(sideOf) {
264
+ return ({ intent, plan, tools }) => {
265
+ const byId = new Map(tools.map((t) => [t.id, t]));
266
+ return plan.steps.flatMap((s, i) => {
267
+ const cap = byId.get(s.toolId)?.capability?.id;
268
+ if (!cap)
269
+ return [];
270
+ const strArgs = Object.entries(s.args).filter((e) => typeof e[1] === 'string' && !!e[1].trim());
271
+ let sentence = ` ${lc(SENTENCE_ONLY(intent.goal))} `;
272
+ for (const [k, v] of strArgs)
273
+ if (sideOf(cap, k) === 'counterparty')
274
+ sentence = sentence.split(lc(v)).join(' ');
275
+ const said = new Set(wordsOf(sentence));
276
+ return strArgs.filter(([k, v]) => sideOf(cap, k) === 'acting' && !/^0x[0-9a-f]{40}$/i.test(v.trim()) && !ROOM_WORDS.has(lc(v).trim()) && !wordsOf(v).some((w) => said.has(w)))
277
+ .map(([k, v]) => ({ code: 'UNSUPPORTED_BINDING_SOURCE', recovery: 'ask', stepIndex: i, toolId: s.toolId, field: k, message: `step ${i + 1} (${s.toolId}) names ${k} "${v}", which the sentence does not; omit it and it will be decided or asked for.` }));
278
+ });
279
+ };
280
+ }
281
+ /**
282
+ * THE KIND THE PERSON NAMED IS THE KIND CHARTERED. Asked to "start a team … under Missio Nexus" where no team tool was
283
+ * offered, the planner chartered an ORGANIZATION (act laboratory, 2026-09-28) — the nearest kind, which the tool's own
284
+ * description forbids in prose. Here it is a rule: `kinds` (the app's chartering capabilities and the words for each —
285
+ * its noun and its name suffix) — a step chartering kind A when the sentence names kind B and never A is re-planned
286
+ * with the reason; if nothing charters B, the plan says so rather than making the nearest thing. Dotted names
287
+ * ("missio-nexus.org") are not words the person used for a kind.
288
+ */
289
+ export function kindNamedIsChartered(kinds) {
290
+ const byCap = new Map(kinds.map((k) => [k.capability, k]));
291
+ return ({ intent, plan }) => {
292
+ const sentence = ` ${lc(SENTENCE_ONLY(intent.goal)).replace(/\S+\.[a-z0-9-]+\S*/g, ' ').replace(/[^a-z0-9]+/g, ' ')} `;
293
+ const said = (k) => k.words.some((w) => sentence.includes(` ${lc(w)} `) || sentence.includes(` ${lc(w)}s `));
294
+ return plan.steps.flatMap((s, i) => {
295
+ const mine = byCap.get(s.toolId);
296
+ if (!mine || said(mine))
297
+ return [];
298
+ const named = kinds.filter((k) => k.capability !== mine.capability && said(k));
299
+ return named.length ? [{ code: 'OUTCOME_NOT_ESTABLISHED', recovery: 'replan', stepIndex: i, toolId: s.toolId, message: `the sentence asks for a ${named[0].noun}; ${s.toolId} charters a ${mine.noun}. Use the tool that charters a ${named[0].noun}; if none is offered here, say this agent cannot — never charter the nearest kind.` }] : [];
300
+ });
301
+ };
302
+ }
303
+ /**
304
+ * THE SUBJECT THE SENTENCE NAMES MUST BE IN THE STEP. A tool that declares a `subject` argument (spec 366)
305
+ * is answered by the agent that argument names. When the sentence contains the name of an agent the asker
306
+ * KNOWS — from their own links, supplied by the harness, never guessed from the directory — and the step
307
+ * leaves the subject empty, the step would run against the addressee's own records and answer for the
308
+ * wrong agent. That is the Missio Nexus incident, as a rule.
309
+ */
310
+ export function subjectNamedInAsk(knownNames) {
311
+ return async ({ intent, plan, tools }) => {
312
+ const byId = new Map(tools.map((t) => [t.id, t]));
313
+ const candidates = plan.steps.map((s, i) => ({ s, i, tool: byId.get(s.toolId) }))
314
+ .filter(({ s, tool }) => tool?.subject && !String(s.args[tool.subject] ?? '').trim());
315
+ if (!candidates.length)
316
+ return [];
317
+ const goal = squash(intent.goal);
318
+ const names = (await knownNames(intent).catch(() => [])).filter((n) => n.name && !/^0x[0-9a-f]{40}$/i.test(n.name));
319
+ const named = names.filter((n) => {
320
+ const full = squash(n.name);
321
+ const label = squash(n.name.split('.')[0] ?? '');
322
+ return (full.length >= 4 && goal.includes(full)) || (label.length >= 4 && goal.includes(label));
323
+ })
324
+ // The agent BEING ASKED is the room: an empty subject there already means it ("what is Missio Nexus's balance", asked
325
+ // at missio-nexus.org, was refused for leaving the account empty — 2026-09-28).
326
+ .filter((n) => String(n.agent).toLowerCase() !== String(intent.context?.addressee ?? '').toLowerCase());
327
+ if (!named.length)
328
+ return [];
329
+ return candidates.map(({ s, i, tool }) => ({
330
+ code: 'REQUIRED_ROLE_UNRESOLVED', recovery: 'resolve', stepIndex: i, toolId: s.toolId, field: tool.subject,
331
+ message: `the ask names ${named.map((n) => `"${n.name}"`).join(' / ')} and step ${i + 1} (${s.toolId}) names no ${tool.subject}; pass the name the person used as "${tool.subject}".`,
332
+ }));
333
+ };
334
+ }
335
+ /**
336
+ * Spec 379 (appendix M4) — AN OUTSIDE AGENT MAY ANSWER, NEVER ACT. A step whose `executor` is outside this
337
+ * deployment (the caller says which — an https card URL, an address not served here) may run only a
338
+ * tool that exercises no capability: its answer is an observation. A value-moving or record-changing
339
+ * step aimed at an outside agent is refused at admission, before any planner or verifier spends anything.
340
+ */
341
+ export function externalExecutorsReadOnly(isExternal) {
342
+ return ({ plan, tools }) => {
343
+ const out = [];
344
+ plan.steps.forEach((st, i) => {
345
+ const ex = st.executor;
346
+ if (typeof ex !== 'string' || !ex || !isExternal(ex))
347
+ return;
348
+ const tool = tools.find((t) => t.id === st.toolId);
349
+ if (tool?.capability)
350
+ out.push({ code: 'EXTERNAL_EXECUTOR_ACT', recovery: 'refuse', stepIndex: i, toolId: st.toolId, field: 'executor', message: `step ${i + 1} (${st.toolId}) exercises ${tool.capability.id} and names ${ex} to run it — an outside agent may answer a question, never perform an act; run the step here or drop it.` });
351
+ });
352
+ return out;
353
+ };
354
+ }
355
+ //# sourceMappingURL=admission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.js","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAyC9C;+DAC+D;AAC/D,MAAM,UAAU,aAAa,CAAC,KAA+B;IAC3D,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,KAAK;YACf,MAAM,UAAU,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1E,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClF,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACjD,iHAAiH;AACjH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAE9E;mGACmG;AACnG,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mHAAmH,EAAE,EAAE,CAAC,CAAC;AACnJ,CAAC;AAED;;;;;;GAMG;AACH;wEACwE;AACxE,MAAM,UAAU,cAAc,CAAC,CAAW;IAC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AC,MAAM,CAAC,CAAC;YACnD,IAAI,IAAI,EAAE,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,eAAe,IAAI,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,0GAA0G,EAAE,CAAC,CAAC;QAC7U,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { StructuredCallLike } from './selection.js';
2
+ export declare const ANSWER_QUALITY_JUDGE: {
3
+ name: string;
4
+ kind: "model";
5
+ };
6
+ /** The rubric: each a statement the judge gives P(true) for. Stable ids — a changed rubric is a new judge name (J5). */
7
+ export declare const ANSWER_QUALITY_RUBRIC: ReadonlyArray<{
8
+ id: string;
9
+ statement: string;
10
+ }>;
11
+ export interface AnswerQualityV1 {
12
+ judge: typeof ANSWER_QUALITY_JUDGE;
13
+ /** P(true) per rubric question. */
14
+ scores: Record<string, number>;
15
+ /** Their mean — the quality number a comparison reads. */
16
+ score: number;
17
+ ms: number;
18
+ error?: string;
19
+ }
20
+ /** Judge one answer. The answer is truncated to `maxChars` (the judge reads a bounded state). */
21
+ export declare function judgeAnswerQuality(input: {
22
+ request: string;
23
+ skillCard: string;
24
+ answer: string;
25
+ maxChars?: number;
26
+ }, call: StructuredCallLike): Promise<AnswerQualityV1>;
27
+ export declare const ANSWER_PREFERENCE_JUDGE: {
28
+ name: string;
29
+ kind: "model";
30
+ };
31
+ export interface AnswerPreferenceV1 {
32
+ judge: typeof ANSWER_PREFERENCE_JUDGE;
33
+ preference: Record<string, number>;
34
+ permutations: {
35
+ asked: number;
36
+ answered: number;
37
+ };
38
+ ms: number;
39
+ error?: string;
40
+ }
41
+ export declare function judgeAnswerPreference(input: {
42
+ request: string;
43
+ skillCard: string;
44
+ answers: Record<string, string>;
45
+ maxChars?: number;
46
+ }, call: StructuredCallLike): Promise<AnswerPreferenceV1>;
47
+ export declare const OUTCOME_CHECK_JUDGE: {
48
+ name: string;
49
+ kind: "model";
50
+ };
51
+ /** One scoring unit: a single class (`id` = its IRI), or an alternative group (`id` = `alternative:<group>`). */
52
+ export interface OutcomeUnitV1 {
53
+ id: string;
54
+ members: string[];
55
+ requested: number;
56
+ delivered: number;
57
+ counted: boolean;
58
+ required?: true;
59
+ }
60
+ export interface OutcomeCheckV1 {
61
+ judge: typeof OUTCOME_CHECK_JUDGE;
62
+ classes: Record<string, number>;
63
+ requested: Record<string, number>;
64
+ units?: OutcomeUnitV1[];
65
+ score: number;
66
+ ms: number;
67
+ error?: string;
68
+ }
69
+ export declare function judgeOutcomeDelivered(input: {
70
+ request: string;
71
+ answer: string;
72
+ expected: ReadonlyArray<{
73
+ iri: string;
74
+ label: string;
75
+ required?: boolean;
76
+ alternative?: string;
77
+ }>;
78
+ maxChars?: number;
79
+ }, call: StructuredCallLike): Promise<OutcomeCheckV1>;
80
+ //# sourceMappingURL=answer-quality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-quality.d.ts","sourceRoot":"","sources":["../src/answer-quality.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAO,MAAM,oBAAoB;;;CAAiE,CAAC;AAEnG,wHAAwH;AACxH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAMlF,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,oBAAoB,CAAC;IACnC,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM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