@spine-event-engine/ai 0.0.0-stage → 2.0.0-snapshot.24

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 (53) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +73 -2
  3. package/REFERENCE.md +238 -0
  4. package/dist/index.d.ts +31 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +26 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/internal/contracts.d.ts +648 -0
  9. package/dist/internal/contracts.d.ts.map +1 -0
  10. package/dist/internal/contracts.js +15 -0
  11. package/dist/internal/contracts.js.map +1 -0
  12. package/dist/internal/decision.d.ts +54 -0
  13. package/dist/internal/decision.d.ts.map +1 -0
  14. package/dist/internal/decision.js +197 -0
  15. package/dist/internal/decision.js.map +1 -0
  16. package/dist/internal/execution.d.ts +309 -0
  17. package/dist/internal/execution.d.ts.map +1 -0
  18. package/dist/internal/execution.js +143 -0
  19. package/dist/internal/execution.js.map +1 -0
  20. package/dist/internal/mcp-protocol.d.ts +282 -0
  21. package/dist/internal/mcp-protocol.d.ts.map +1 -0
  22. package/dist/internal/mcp-protocol.js +32 -0
  23. package/dist/internal/mcp-protocol.js.map +1 -0
  24. package/dist/internal/mcp.d.ts +36 -0
  25. package/dist/internal/mcp.d.ts.map +1 -0
  26. package/dist/internal/mcp.js +144 -0
  27. package/dist/internal/mcp.js.map +1 -0
  28. package/dist/internal/model.d.ts +103 -0
  29. package/dist/internal/model.d.ts.map +1 -0
  30. package/dist/internal/model.js +292 -0
  31. package/dist/internal/model.js.map +1 -0
  32. package/dist/internal/registration.d.ts +102 -0
  33. package/dist/internal/registration.d.ts.map +1 -0
  34. package/dist/internal/registration.js +65 -0
  35. package/dist/internal/registration.js.map +1 -0
  36. package/dist/internal/registry.d.ts +102 -0
  37. package/dist/internal/registry.d.ts.map +1 -0
  38. package/dist/internal/registry.js +250 -0
  39. package/dist/internal/registry.js.map +1 -0
  40. package/dist/internal/schema.d.ts +70 -0
  41. package/dist/internal/schema.d.ts.map +1 -0
  42. package/dist/internal/schema.js +329 -0
  43. package/dist/internal/schema.js.map +1 -0
  44. package/dist/spi/adapter.d.ts +11 -0
  45. package/dist/spi/adapter.d.ts.map +1 -0
  46. package/dist/spi/adapter.js +21 -0
  47. package/dist/spi/adapter.js.map +1 -0
  48. package/dist/spi/runtime.d.ts +10 -0
  49. package/dist/spi/runtime.d.ts.map +1 -0
  50. package/dist/spi/runtime.js +20 -0
  51. package/dist/spi/runtime.js.map +1 -0
  52. package/dist/tsconfig.tsbuildinfo +1 -0
  53. package/package.json +37 -3
@@ -0,0 +1,54 @@
1
+ import type { MessageShape } from "@bufbuild/protobuf";
2
+ import { type MessageSchema } from "@spine-event-engine/core";
3
+ import type { AiDecisionResult, AiValidationIssue } from "./contracts.js";
4
+ import type { AiModel } from "./model.js";
5
+ /**
6
+ * Decimal precision declared by a decision provider; absent means no rounding allowance.
7
+ */
8
+ export interface AiDistributionRounding {
9
+ /**
10
+ * Configured probability decimals for this contract.
11
+ */
12
+ readonly probabilityDecimals?: number;
13
+ /**
14
+ * Configured score decimals for this contract.
15
+ */
16
+ readonly scoreDecimals?: number;
17
+ }
18
+ /**
19
+ * Validated mapped output or local decision issues.
20
+ *
21
+ * @typeParam O - Output message descriptor.
22
+ */
23
+ export type AiDecisionAdmission<O extends MessageSchema> = {
24
+ /**
25
+ * Indicates the mapped result was admitted.
26
+ */
27
+ readonly ok: true;
28
+ /**
29
+ * Validated typed application output.
30
+ */
31
+ readonly value: MessageShape<O>;
32
+ } | {
33
+ /**
34
+ * Indicates local decision admission failed.
35
+ */
36
+ readonly ok: false;
37
+ /**
38
+ * Local validation defects.
39
+ */
40
+ readonly issues: readonly AiValidationIssue[];
41
+ };
42
+ /**
43
+ * Admits a decision without generating or correcting chat text.
44
+ *
45
+ * @typeParam I - Input message descriptor.
46
+ * @typeParam O - Output message descriptor.
47
+ * @param model Factory-created decision capability.
48
+ * @param result Provider decision result.
49
+ * @param input Validated application input.
50
+ * @param rounding Explicit provider distribution rounding allowance.
51
+ * @returns Validated mapped Protobuf output or issues.
52
+ */
53
+ export declare const admitDecision: <I extends MessageSchema, O extends MessageSchema>(model: AiModel<I, O>, result: AiDecisionResult, input: MessageShape<I>, rounding: AiDistributionRounding) => AiDecisionAdmission<O>;
54
+ //# sourceMappingURL=decision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/internal/decision.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAEV,gBAAgB,EAGhB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,aAAa,IACnD;IACE;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CACjC,GACD;IACE;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC/C,CAAC;AA6NN;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,aAAa,EAC5E,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,QAAQ,gBAAgB,EACxB,OAAO,YAAY,CAAC,CAAC,CAAC,EACtB,UAAU,sBAAsB,KAC/B,mBAAmB,CAAC,CAAC,CAYvB,CAAC"}
@@ -0,0 +1,197 @@
1
+ /*
2
+ * Copyright 2026, CodeMatters. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
+ * in compliance with the License. You may obtain a copy of the License at
6
+ *
7
+ * https://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
+ * or implied. See the License for the specific language governing permissions and limitations under
12
+ * the License.
13
+ */
14
+ import { Validate } from "@spine-event-engine/core";
15
+ import { isAiModel } from "./model.js";
16
+ /**
17
+ * @param path Question or distribution path. @param message Safe diagnostic. @returns Issue.
18
+ */
19
+ const invalid = (path, message) => {
20
+ return { code: "INVALID_DECISION", path, message };
21
+ };
22
+ /**
23
+ * @param value Candidate probability. @returns Whether it is finite and inside [0,1].
24
+ */
25
+ const probability = (value) => {
26
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
27
+ };
28
+ /**
29
+ * Checks full distribution identity, values and sum against explicit rounding.
30
+ *
31
+ * @param values Provider probabilities.
32
+ * @param keys Declared alternatives.
33
+ * @param path Question path.
34
+ * @param error Aggregate error from declared decimal rounding.
35
+ * @returns Local issues.
36
+ */
37
+ const distribution = (values, keys, path, error) => {
38
+ if (!values)
39
+ return [invalid(path, "Full distribution required")];
40
+ const actual = Object.keys(values);
41
+ if (actual.length !== keys.length || actual.some((key) => !keys.includes(key)))
42
+ return [invalid(path, "Distribution keys must match declared alternatives")];
43
+ const probabilities = actual.map((key) => values[key] ?? Number.NaN);
44
+ if (probabilities.some((value) => !probability(value)))
45
+ return [invalid(path, "Distribution probabilities must be finite and in [0,1]")];
46
+ const total = probabilities.reduce((sum, value) => sum + value, 0);
47
+ return Math.abs(total - 1) <= error
48
+ ? []
49
+ : [invalid(path, "Distribution sum exceeds rounding allowance")];
50
+ };
51
+ /**
52
+ * @param decimals Declared decimal places. @returns Half-unit rounding allowance.
53
+ */
54
+ const halfUnit = (decimals) => decimals === undefined ? 0 : 0.5 * 10 ** -decimals;
55
+ /**
56
+ * @param rounding Provider precision. @returns Checked precision.
57
+ */
58
+ const checkedRounding = (rounding) => {
59
+ for (const [name, decimals] of Object.entries(rounding))
60
+ if (!Number.isInteger(decimals) || decimals < 0 || decimals > 15)
61
+ throw new TypeError(`${name} must be an integer in [0,15]`);
62
+ return rounding;
63
+ };
64
+ /**
65
+ * Checks a choice or score against its reported distribution.
66
+ *
67
+ * @param answer Choice or score answer.
68
+ * @param keys Declared alternatives.
69
+ * @param rounding Provider precision.
70
+ * @param path Issue path.
71
+ * @returns Coherence issues.
72
+ */
73
+ const coherenceIssues = (answer, keys, rounding, path) => {
74
+ const values = answer.probabilities;
75
+ if (!values)
76
+ return [];
77
+ if (answer.type === "choice") {
78
+ const maximum = Math.max(...keys.map((key) => values[key] ?? -1));
79
+ return (values[answer.choice] ?? -1) >= maximum
80
+ ? []
81
+ : [invalid(path, "Chosen alternative must have maximal probability")];
82
+ }
83
+ const mean = keys.reduce((sum, key, index) => sum + index * (values[key] ?? 0), 0);
84
+ const error = keys.reduce((sum, _, index) => sum + index * halfUnit(rounding.probabilityDecimals), halfUnit(rounding.scoreDecimals));
85
+ return Math.abs(answer.score - mean) <= error + Number.EPSILON
86
+ ? []
87
+ : [invalid(path, "Score differs from probability-weighted mean")];
88
+ };
89
+ /**
90
+ * Checks confidence and any requested complete probability distribution.
91
+ *
92
+ * @param answer Choice or score answer.
93
+ * @param keys Declared alternatives.
94
+ * @param path Question path.
95
+ * @param rounding Provider precision.
96
+ * @param required Whether a distribution is required.
97
+ * @returns Confidence and distribution issues.
98
+ */
99
+ const answerDistributionIssues = (answer, keys, path, rounding, required) => {
100
+ const issues = [];
101
+ if (answer.confidence !== undefined && !probability(answer.confidence))
102
+ issues.push(invalid(path, "Confidence must be in [0,1]"));
103
+ if (answer.probabilities || required)
104
+ issues.push(...distribution(answer.probabilities, keys, path, keys.length * halfUnit(rounding.probabilityDecimals) + Number.EPSILON));
105
+ return issues;
106
+ };
107
+ /**
108
+ * Validates one answer against a declared question.
109
+ *
110
+ * @param answer Provider answer.
111
+ * @param question Declared question.
112
+ * @param path Question path.
113
+ * @param rounding Aggregate rounding allowance.
114
+ * @param requireProbabilities Whether full distributions are mandatory.
115
+ * @returns Local issues.
116
+ */
117
+ const answerIssues = (answer, question, path, rounding, requireProbabilities) => {
118
+ if (answer?.type !== question.type)
119
+ return [invalid(path, "Answer kind differs")];
120
+ if (answer.type === "boolean")
121
+ return probability(answer.probability) ? [] : [invalid(path, "Invalid boolean probability")];
122
+ if (question.type === "boolean")
123
+ return [invalid(path, "Answer kind differs")];
124
+ const keys = question.type === "choice"
125
+ ? Object.keys(question.criteria)
126
+ : question.criteria.map((_, index) => String(index));
127
+ const valueValid = answer.type === "choice"
128
+ ? keys.includes(answer.choice)
129
+ : typeof answer.score === "number" &&
130
+ Number.isFinite(answer.score) &&
131
+ answer.score >= 0 &&
132
+ answer.score <= keys.length - 1;
133
+ const issues = valueValid ? [] : [invalid(path, "Answer value is outside declared alternatives")];
134
+ issues.push(...answerDistributionIssues(answer, keys, path, rounding, requireProbabilities));
135
+ if (issues.length === 0)
136
+ issues.push(...coherenceIssues(answer, keys, rounding, path));
137
+ return issues;
138
+ };
139
+ /**
140
+ * Checks all answer IDs and declared question kinds.
141
+ *
142
+ * @param questions Declared IDs and kinds.
143
+ * @param result Provider answers.
144
+ * @param rounding Provider precision.
145
+ * @param required Whether full distributions are required.
146
+ * @returns Answer issues.
147
+ */
148
+ const answerSetIssues = (questions, result, rounding, required) => {
149
+ const answers = result.answers;
150
+ const IDs = Object.keys(questions);
151
+ if (Object.keys(answers).length !== IDs.length ||
152
+ Object.keys(answers).some((id) => !Object.hasOwn(questions, id)))
153
+ return [invalid("answers", "Answer IDs must match declared questions")];
154
+ return Object.entries(questions).flatMap(([id, question]) => answerIssues(answers[id], question, `answers.${id}`, rounding, required));
155
+ };
156
+ /**
157
+ * Maps admitted answers to a typed application output.
158
+ *
159
+ * @typeParam I - Input message descriptor.
160
+ * @typeParam O - Output message descriptor.
161
+ * @param definition Declared decision mapping.
162
+ * @param result Checked answers.
163
+ * @param input Typed facts.
164
+ * @returns Validated output or issues.
165
+ */
166
+ const mappedOutput = (definition, result, input) => {
167
+ const value = definition.mapping.toMessage(result, input);
168
+ const checked = Validate.message(definition.output, value);
169
+ if (!checked.valid)
170
+ return {
171
+ ok: false,
172
+ issues: checked.violations.map((entry) => invalid(entry.fieldPath?.fieldName.join(".") ?? "$", entry.message?.withPlaceholders ?? "Invalid output")),
173
+ };
174
+ const appIssues = definition.validation?.check(value, input) ?? [];
175
+ return appIssues.length ? { ok: false, issues: appIssues } : { ok: true, value };
176
+ };
177
+ /**
178
+ * Admits a decision without generating or correcting chat text.
179
+ *
180
+ * @typeParam I - Input message descriptor.
181
+ * @typeParam O - Output message descriptor.
182
+ * @param model Factory-created decision capability.
183
+ * @param result Provider decision result.
184
+ * @param input Validated application input.
185
+ * @param rounding Explicit provider distribution rounding allowance.
186
+ * @returns Validated mapped Protobuf output or issues.
187
+ */
188
+ export const admitDecision = (model, result, input, rounding) => {
189
+ const definition = model.definition;
190
+ if (!isAiModel(model) || definition.kind !== "decision")
191
+ throw new TypeError("Factory-created decision capability required");
192
+ const issues = answerSetIssues(definition.questions, result, checkedRounding(rounding), definition.requireProbabilities ?? false);
193
+ if (issues.length)
194
+ return { ok: false, issues };
195
+ return mappedOutput(definition, result, input);
196
+ };
197
+ //# sourceMappingURL=decision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../src/internal/decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,QAAQ,EAAsB,MAAM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EAAE;IAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACpC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU;QACrD,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,eAAe,CAC5B,UAAU,CAAC,SAAS,EACpB,MAAM,EACN,eAAe,CAAC,QAAQ,CAAC,EACzB,UAAU,CAAC,oBAAoB,IAAI,KAAK,CACzC,CAAC;IACF,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChD,OAAO,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC"}
@@ -0,0 +1,309 @@
1
+ import type { MessageShape } from "@bufbuild/protobuf";
2
+ import type { MessageSchema } from "@spine-event-engine/core";
3
+ import type { AgentAiOperationFailed, AgentToolCallFinished, AiOperationId, AiUsage, DecisionRequest, DecisionResponse, GenerationRequest, GenerationResponse, ToolResponse } from "@spine-event-engine/proto/agent";
4
+ import type { AiConnectionIdentity, AiControl, AiDecisionResult, AiFailure, AiLimits, AiModelDefinition, AiScope, AiValidationIssue } from "./contracts.js";
5
+ import type { AiMcpAdvertisedTool } from "./mcp-protocol.js";
6
+ /**
7
+ * One model-facing request already recorded against the signal budget.
8
+ */
9
+ export type AiAttemptRequest = {
10
+ /**
11
+ * Identifies a generation request.
12
+ */
13
+ readonly kind: "generation";
14
+ /**
15
+ * Actual model-facing generation content.
16
+ */
17
+ readonly content: GenerationRequest;
18
+ } | {
19
+ /**
20
+ * Identifies a non-generative decision request.
21
+ */
22
+ readonly kind: "decision";
23
+ /**
24
+ * Actual model-facing decision content.
25
+ */
26
+ readonly content: DecisionRequest;
27
+ };
28
+ /**
29
+ * One model-facing response journaled before result admission.
30
+ */
31
+ export type AiAttemptResponse = GenerationResponse | DecisionResponse;
32
+ /**
33
+ * Rejects a nonterminal tool proposal in incompatible conversation/event contexts.
34
+ *
35
+ * @param content Typed response or terminal System event.
36
+ */
37
+ export declare const assertAiOutcomeContext: (content: GenerationResponse | DecisionResponse | ToolResponse | AgentToolCallFinished | AgentAiOperationFailed) => void;
38
+ /**
39
+ * One persisted physical request identity and its reserved resource bounds.
40
+ */
41
+ export interface AiAttemptTicket {
42
+ /**
43
+ * Runtime-assigned attempt ID; one ticket admits at most one transport fetch.
44
+ */
45
+ readonly id: string;
46
+ /**
47
+ * Actual serialized provider request-body ceiling.
48
+ */
49
+ readonly maxInputBytes?: number;
50
+ /**
51
+ * Full reserved decoded response-body allowance.
52
+ */
53
+ readonly maxOutputBytes?: number;
54
+ /**
55
+ * Absolute deadline read through the runtime Time service.
56
+ */
57
+ readonly deadlineEpochMs?: number;
58
+ /**
59
+ * Cancellation and execution-fence loss signal.
60
+ */
61
+ readonly signal: AbortSignal;
62
+ }
63
+ /**
64
+ * Completed physical attempt returned from a durable journal without redispatch.
65
+ */
66
+ export interface AiAttemptReplay {
67
+ /**
68
+ * Distinguishes saved content from a new physical-attempt ticket.
69
+ */
70
+ readonly kind: "replay";
71
+ /**
72
+ * Original attempt identity retained for tool-call correlation.
73
+ */
74
+ readonly id: string;
75
+ /**
76
+ * Previously journaled bounded provider response.
77
+ */
78
+ readonly response: AiAttemptResponse;
79
+ /**
80
+ * Previously journaled local validation issues, when any.
81
+ */
82
+ readonly issues?: readonly AiValidationIssue[];
83
+ /**
84
+ * Original persisted failure and retryability matching the response diagnostic.
85
+ */
86
+ readonly failure?: AiFailure;
87
+ }
88
+ /**
89
+ * Fenced completion record for one physical model attempt.
90
+ */
91
+ export interface AiAttemptCompletion {
92
+ /**
93
+ * Previously allocated physical attempt identity.
94
+ */
95
+ readonly ticketId: string;
96
+ /**
97
+ * Complete measured response bytes; absent for an incomplete or unknown receipt.
98
+ */
99
+ readonly receivedBytes?: number;
100
+ /**
101
+ * Complete bounded provider and validation response content.
102
+ */
103
+ readonly response: AiAttemptResponse;
104
+ /**
105
+ * Actual bounded local validation issues, when applicable.
106
+ */
107
+ readonly issues?: readonly AiValidationIssue[];
108
+ /**
109
+ * Provider token counts; absent means unknown rather than zero.
110
+ */
111
+ readonly usage?: AiUsage;
112
+ }
113
+ /**
114
+ * Runtime admission of a generated ProtoJSON candidate.
115
+ */
116
+ export type AiCandidateAdmission = {
117
+ /**
118
+ * Indicates the output passed definitive local validation.
119
+ */
120
+ readonly ok: true;
121
+ /**
122
+ * Validated application output.
123
+ */
124
+ readonly value: MessageShape<MessageSchema>;
125
+ } | {
126
+ /**
127
+ * Indicates local output validation failed.
128
+ */
129
+ readonly ok: false;
130
+ /**
131
+ * Actual bounded issues available for correction.
132
+ */
133
+ readonly issues: readonly AiValidationIssue[];
134
+ };
135
+ /**
136
+ * Runtime-authorized tool call without a model-selected effect.
137
+ */
138
+ export interface AiToolInvocation {
139
+ /**
140
+ * Physical attempt whose recorded response proposed this call.
141
+ */
142
+ readonly ticketId: string;
143
+ /**
144
+ * Configured MCP server name.
145
+ */
146
+ readonly server: string;
147
+ /**
148
+ * Configured tool name within that server.
149
+ */
150
+ readonly tool: string;
151
+ /**
152
+ * Canonical JSON arguments validated against tool policy.
153
+ */
154
+ readonly argumentsJson: string;
155
+ /**
156
+ * Provider call ID used only to correlate the model continuation.
157
+ */
158
+ readonly providerCallId: string;
159
+ }
160
+ /**
161
+ * Runtime controls shared by optional model adapters and scripted backends.
162
+ */
163
+ export interface AiExecutionControl extends AiControl {
164
+ /**
165
+ * Reads Unix milliseconds through the runtime Time service.
166
+ *
167
+ * @returns Current Unix epoch milliseconds.
168
+ */
169
+ readonly nowEpochMs: () => number;
170
+ /**
171
+ * Checks whether the current execution fence still permits work.
172
+ *
173
+ * @returns Whether the current execution fence remains valid.
174
+ */
175
+ readonly hasAuthority: () => boolean;
176
+ /**
177
+ * Records the actual request and reserves one physical attempt.
178
+ *
179
+ * @param request Typed generation or decision content, including correction text.
180
+ * @returns Runtime-assigned ticket after the journal and budget barrier.
181
+ */
182
+ readonly beginAttempt: (request: AiAttemptRequest) => Promise<AiAttemptTicket | AiAttemptReplay>;
183
+ /**
184
+ * Records transport bytes against the existing attempt ticket.
185
+ *
186
+ * @param ticketId Runtime-assigned attempt ID.
187
+ * @param inputBytes Actual serialized provider request-body bytes.
188
+ * @param outputCredit Configured output allowance, if present.
189
+ * @returns Effective finite credit after the durable reservation barrier, if any.
190
+ */
191
+ readonly reserveTransport: (ticketId: string, inputBytes: number, outputCredit?: number) => Promise<number | undefined>;
192
+ /**
193
+ * Records a received platform chunk before parser delivery.
194
+ *
195
+ * @param ticketId Runtime-assigned attempt ID.
196
+ * @param bytes Actual received byte count for this chunk.
197
+ */
198
+ readonly onReceived: (ticketId: string, bytes: number) => void;
199
+ /**
200
+ * Records bounded response content and known receipt before output returns.
201
+ *
202
+ * @param completion Fenced response, usage, receipt, and local validation issues.
203
+ * @returns Completion of the durable journal barrier.
204
+ */
205
+ readonly finishAttempt: (completion: AiAttemptCompletion) => Promise<void>;
206
+ /**
207
+ * Persists a bounded safe diagnostic without finishing the attempt or operation.
208
+ *
209
+ * @param code Allowlisted failure category.
210
+ * @param retryableByNewSignal Whether a later accepted signal may retry.
211
+ * @returns Runtime-allocated checked failure and diagnostic reference.
212
+ */
213
+ readonly recordFailure: (code: AiFailure["code"], retryableByNewSignal: boolean) => Promise<AiFailure>;
214
+ /**
215
+ * Applies definitive Proto and application validation to a generation candidate.
216
+ *
217
+ * @param candidate Exact bounded provider text candidate.
218
+ * @param definition Registered typed generation capability.
219
+ * @param input Validated application facts for this invocation.
220
+ * @returns Admitted output or actual issues for a bounded Ax correction.
221
+ */
222
+ readonly admitGeneration: (candidate: string, definition: Readonly<AiModelDefinition<MessageSchema, MessageSchema>>, input: MessageShape<MessageSchema>) => AiCandidateAdmission | Promise<AiCandidateAdmission>;
223
+ /**
224
+ * Applies definitive answer, mapping, Proto, and application validation.
225
+ *
226
+ * @param result Provider's non-generative answers and rounding.
227
+ * @param definition Registered typed decision capability.
228
+ * @param input Validated application facts for this invocation.
229
+ * @param rounding Provider-declared decimal precision, if known.
230
+ * @returns Admitted mapped output or local issues; no chat correction.
231
+ */
232
+ readonly admitDecision: (result: AiDecisionResult, definition: Readonly<AiModelDefinition<MessageSchema, MessageSchema>>, input: MessageShape<MessageSchema>, rounding?: {
233
+ readonly probabilityDecimals?: number;
234
+ readonly scoreDecimals?: number;
235
+ }) => AiCandidateAdmission | Promise<AiCandidateAdmission>;
236
+ /**
237
+ * Executes one authorized tool call using runtime policy and identity.
238
+ *
239
+ * @param invocation Model request without an authoritative effect or tool-call ID.
240
+ * @returns Recorded bounded result or unresolved write outcome.
241
+ */
242
+ readonly callTool: (invocation: AiToolInvocation) => Promise<ToolResponse>;
243
+ }
244
+ /**
245
+ * One selected, authenticated request to an adapter-created backend.
246
+ */
247
+ export interface AiBackendExecution {
248
+ /**
249
+ * Exact discovered and allowlisted definitions prepared before model dispatch.
250
+ */
251
+ readonly advertisedTools?: readonly AiMcpAdvertisedTool[];
252
+ /**
253
+ * Invocation name supplied by the application handler.
254
+ */
255
+ readonly call: string;
256
+ /**
257
+ * Runtime-assigned logical operation spanning physical attempts.
258
+ */
259
+ readonly operationId: AiOperationId;
260
+ /**
261
+ * Trusted authenticated signal scope.
262
+ */
263
+ readonly scope: AiScope;
264
+ /**
265
+ * Identity established before connection and matched after it.
266
+ */
267
+ readonly identity: AiConnectionIdentity;
268
+ /**
269
+ * Opaque model handle returned by the trusted connection callback.
270
+ */
271
+ readonly model: unknown;
272
+ /**
273
+ * Registered typed capability and limits.
274
+ */
275
+ readonly definition: Readonly<AiModelDefinition<MessageSchema, MessageSchema> & {
276
+ readonly limits: AiLimits;
277
+ }>;
278
+ /**
279
+ * Validated application facts.
280
+ */
281
+ readonly input: MessageShape<MessageSchema>;
282
+ /**
283
+ * Fenced runtime budgets, journal, admission, and tool authority.
284
+ */
285
+ readonly control: AiExecutionControl;
286
+ }
287
+ /**
288
+ * Backend result without a fabricated runtime operation identity.
289
+ */
290
+ export type AiBackendOutcome = {
291
+ /**
292
+ * Indicates a typed application output was admitted.
293
+ */
294
+ readonly ok: true;
295
+ /**
296
+ * Definitively validated output.
297
+ */
298
+ readonly value: MessageShape<MessageSchema>;
299
+ } | {
300
+ /**
301
+ * Indicates no application output was admitted.
302
+ */
303
+ readonly ok: false;
304
+ /**
305
+ * Safe recorded operational failure.
306
+ */
307
+ readonly failure: AiFailure;
308
+ };
309
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/internal/execution.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB;IACE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC,GACD;IACE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;CACnC,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB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