@spine-event-engine/server 2.0.0-snapshot.22 → 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 (199) hide show
  1. package/README.md +104 -7
  2. package/REFERENCE.md +272 -31
  3. package/dist/agent/agent-admission.d.ts +80 -0
  4. package/dist/agent/agent-admission.d.ts.map +1 -0
  5. package/dist/agent/agent-admission.js +127 -0
  6. package/dist/agent/agent-admission.js.map +1 -0
  7. package/dist/agent/agent-ai-binding.d.ts +24 -0
  8. package/dist/agent/agent-ai-binding.d.ts.map +1 -0
  9. package/dist/agent/agent-ai-binding.js +48 -0
  10. package/dist/agent/agent-ai-binding.js.map +1 -0
  11. package/dist/agent/agent-ai-runtime.d.ts +76 -0
  12. package/dist/agent/agent-ai-runtime.d.ts.map +1 -0
  13. package/dist/agent/agent-ai-runtime.js +1269 -0
  14. package/dist/agent/agent-ai-runtime.js.map +1 -0
  15. package/dist/agent/agent-execution-capacity.d.ts +43 -0
  16. package/dist/agent/agent-execution-capacity.d.ts.map +1 -0
  17. package/dist/agent/agent-execution-capacity.js +147 -0
  18. package/dist/agent/agent-execution-capacity.js.map +1 -0
  19. package/dist/agent/agent-execution-fault.d.ts +18 -0
  20. package/dist/agent/agent-execution-fault.d.ts.map +1 -0
  21. package/dist/agent/agent-execution-fault.js +31 -0
  22. package/dist/agent/agent-execution-fault.js.map +1 -0
  23. package/dist/agent/agent-execution-session.d.ts +103 -0
  24. package/dist/agent/agent-execution-session.d.ts.map +1 -0
  25. package/dist/agent/agent-execution-session.js +238 -0
  26. package/dist/agent/agent-execution-session.js.map +1 -0
  27. package/dist/agent/agent-history.d.ts +148 -0
  28. package/dist/agent/agent-history.d.ts.map +1 -0
  29. package/dist/agent/agent-history.js +340 -0
  30. package/dist/agent/agent-history.js.map +1 -0
  31. package/dist/agent/agent-interaction-audit.d.ts +58 -0
  32. package/dist/agent/agent-interaction-audit.d.ts.map +1 -0
  33. package/dist/agent/agent-interaction-audit.js +114 -0
  34. package/dist/agent/agent-interaction-audit.js.map +1 -0
  35. package/dist/agent/agent-interaction-events.d.ts +40 -0
  36. package/dist/agent/agent-interaction-events.d.ts.map +1 -0
  37. package/dist/agent/agent-interaction-events.js +129 -0
  38. package/dist/agent/agent-interaction-events.js.map +1 -0
  39. package/dist/agent/agent-mcp-budget.d.ts +125 -0
  40. package/dist/agent/agent-mcp-budget.d.ts.map +1 -0
  41. package/dist/agent/agent-mcp-budget.js +566 -0
  42. package/dist/agent/agent-mcp-budget.js.map +1 -0
  43. package/dist/agent/agent-mcp-host.d.ts +125 -0
  44. package/dist/agent/agent-mcp-host.d.ts.map +1 -0
  45. package/dist/agent/agent-mcp-host.js +15 -0
  46. package/dist/agent/agent-mcp-host.js.map +1 -0
  47. package/dist/agent/agent-mcp-runtime.d.ts +199 -0
  48. package/dist/agent/agent-mcp-runtime.d.ts.map +1 -0
  49. package/dist/agent/agent-mcp-runtime.js +621 -0
  50. package/dist/agent/agent-mcp-runtime.js.map +1 -0
  51. package/dist/agent/agent-model-selection.d.ts +129 -0
  52. package/dist/agent/agent-model-selection.d.ts.map +1 -0
  53. package/dist/agent/agent-model-selection.js +342 -0
  54. package/dist/agent/agent-model-selection.js.map +1 -0
  55. package/dist/agent/agent-read-runtime.d.ts +70 -0
  56. package/dist/agent/agent-read-runtime.d.ts.map +1 -0
  57. package/dist/agent/agent-read-runtime.js +320 -0
  58. package/dist/agent/agent-read-runtime.js.map +1 -0
  59. package/dist/agent/agent-revisions.d.ts +35 -0
  60. package/dist/agent/agent-revisions.d.ts.map +1 -0
  61. package/dist/agent/agent-revisions.js +133 -0
  62. package/dist/agent/agent-revisions.js.map +1 -0
  63. package/dist/agent/agent-scheduler.d.ts +99 -0
  64. package/dist/agent/agent-scheduler.d.ts.map +1 -0
  65. package/dist/agent/agent-scheduler.js +398 -0
  66. package/dist/agent/agent-scheduler.js.map +1 -0
  67. package/dist/bus/command-bus.d.ts +62 -0
  68. package/dist/bus/command-bus.d.ts.map +1 -1
  69. package/dist/bus/command-bus.js +51 -2
  70. package/dist/bus/command-bus.js.map +1 -1
  71. package/dist/bus/event-bus.d.ts +101 -2
  72. package/dist/bus/event-bus.d.ts.map +1 -1
  73. package/dist/bus/event-bus.js +74 -13
  74. package/dist/bus/event-bus.js.map +1 -1
  75. package/dist/bus/saved-dispatcher-binding.d.ts +53 -0
  76. package/dist/bus/saved-dispatcher-binding.d.ts.map +1 -0
  77. package/dist/bus/saved-dispatcher-binding.js +27 -0
  78. package/dist/bus/saved-dispatcher-binding.js.map +1 -0
  79. package/dist/context/bounded-context.d.ts +45 -12
  80. package/dist/context/bounded-context.d.ts.map +1 -1
  81. package/dist/context/bounded-context.js +306 -86
  82. package/dist/context/bounded-context.js.map +1 -1
  83. package/dist/context/entity-inbox.d.ts.map +1 -1
  84. package/dist/context/entity-inbox.js +21 -7
  85. package/dist/context/entity-inbox.js.map +1 -1
  86. package/dist/context/local-inbox-handoff.d.ts +1 -0
  87. package/dist/context/local-inbox-handoff.d.ts.map +1 -1
  88. package/dist/context/local-inbox-handoff.js +31 -1
  89. package/dist/context/local-inbox-handoff.js.map +1 -1
  90. package/dist/context/projection-handoff.d.ts.map +1 -1
  91. package/dist/context/projection-handoff.js +2 -0
  92. package/dist/context/projection-handoff.js.map +1 -1
  93. package/dist/context/tenant-index.d.ts +25 -0
  94. package/dist/context/tenant-index.d.ts.map +1 -1
  95. package/dist/context/tenant-index.js +45 -1
  96. package/dist/context/tenant-index.js.map +1 -1
  97. package/dist/delivery/delivery-monitor.d.ts +12 -9
  98. package/dist/delivery/delivery-monitor.d.ts.map +1 -1
  99. package/dist/delivery/delivery-monitor.js +15 -9
  100. package/dist/delivery/delivery-monitor.js.map +1 -1
  101. package/dist/delivery/delivery-ports.d.ts +6 -13
  102. package/dist/delivery/delivery-ports.d.ts.map +1 -1
  103. package/dist/delivery/delivery-run-control.d.ts +15 -0
  104. package/dist/delivery/delivery-run-control.d.ts.map +1 -1
  105. package/dist/delivery/delivery-run-control.js.map +1 -1
  106. package/dist/delivery/delivery-supervisor.d.ts +33 -5
  107. package/dist/delivery/delivery-supervisor.d.ts.map +1 -1
  108. package/dist/delivery/delivery-supervisor.js +150 -22
  109. package/dist/delivery/delivery-supervisor.js.map +1 -1
  110. package/dist/delivery/delivery.d.ts.map +1 -1
  111. package/dist/delivery/delivery.js +128 -54
  112. package/dist/delivery/delivery.js.map +1 -1
  113. package/dist/delivery/inbox-storage.d.ts +8 -11
  114. package/dist/delivery/inbox-storage.d.ts.map +1 -1
  115. package/dist/delivery/inbox-storage.js +33 -76
  116. package/dist/delivery/inbox-storage.js.map +1 -1
  117. package/dist/delivery/inbox.d.ts +9 -12
  118. package/dist/delivery/inbox.d.ts.map +1 -1
  119. package/dist/delivery/inbox.js +10 -13
  120. package/dist/delivery/inbox.js.map +1 -1
  121. package/dist/delivery/reception-observation.d.ts +56 -0
  122. package/dist/delivery/reception-observation.d.ts.map +1 -0
  123. package/dist/delivery/reception-observation.js +67 -0
  124. package/dist/delivery/reception-observation.js.map +1 -0
  125. package/dist/entity/entity.d.ts +82 -3
  126. package/dist/entity/entity.d.ts.map +1 -1
  127. package/dist/entity/entity.js +121 -22
  128. package/dist/entity/entity.js.map +1 -1
  129. package/dist/handler/generated-handler-registry.js +8 -3
  130. package/dist/handler/generated-handler-registry.js.map +1 -1
  131. package/dist/handler/handler-metadata.d.ts +17 -1
  132. package/dist/handler/handler-metadata.d.ts.map +1 -1
  133. package/dist/handler/handler-metadata.js +10 -4
  134. package/dist/handler/handler-metadata.js.map +1 -1
  135. package/dist/index.d.ts +2 -2
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +1 -1
  138. package/dist/index.js.map +1 -1
  139. package/dist/repository/commit-fence.d.ts +11 -0
  140. package/dist/repository/commit-fence.d.ts.map +1 -1
  141. package/dist/repository/commit-fence.js +13 -0
  142. package/dist/repository/commit-fence.js.map +1 -1
  143. package/dist/repository/repository.d.ts +221 -13
  144. package/dist/repository/repository.d.ts.map +1 -1
  145. package/dist/repository/repository.js +2323 -134
  146. package/dist/repository/repository.js.map +1 -1
  147. package/dist/runtime/runtime.d.ts +11 -0
  148. package/dist/runtime/runtime.d.ts.map +1 -1
  149. package/dist/runtime/runtime.js +13 -0
  150. package/dist/runtime/runtime.js.map +1 -1
  151. package/dist/runtime/signal-metadata.d.ts.map +1 -1
  152. package/dist/runtime/signal-metadata.js +3 -10
  153. package/dist/runtime/signal-metadata.js.map +1 -1
  154. package/dist/runtime/signal-publisher.d.ts +14 -30
  155. package/dist/runtime/signal-publisher.d.ts.map +1 -1
  156. package/dist/runtime/signal-publisher.js +75 -47
  157. package/dist/runtime/signal-publisher.js.map +1 -1
  158. package/dist/runtime/standalone-handler-runtime.d.ts +7 -0
  159. package/dist/runtime/standalone-handler-runtime.d.ts.map +1 -1
  160. package/dist/runtime/standalone-handler-runtime.js +118 -11
  161. package/dist/runtime/standalone-handler-runtime.js.map +1 -1
  162. package/dist/server/environment-delivery-worker.d.ts.map +1 -1
  163. package/dist/server/environment-delivery-worker.js +305 -5
  164. package/dist/server/environment-delivery-worker.js.map +1 -1
  165. package/dist/server/managed-server-application.d.ts +2 -2
  166. package/dist/server/managed-server-application.d.ts.map +1 -1
  167. package/dist/server/managed-server-application.js +467 -177
  168. package/dist/server/managed-server-application.js.map +1 -1
  169. package/dist/server/node-coordinator.d.ts +14 -0
  170. package/dist/server/node-coordinator.d.ts.map +1 -1
  171. package/dist/server/node-coordinator.js +266 -45
  172. package/dist/server/node-coordinator.js.map +1 -1
  173. package/dist/server/server-log.d.ts.map +1 -1
  174. package/dist/server/server-log.js +4 -0
  175. package/dist/server/server-log.js.map +1 -1
  176. package/dist/server/server.d.ts +9 -0
  177. package/dist/server/server.d.ts.map +1 -1
  178. package/dist/server/server.js +33 -8
  179. package/dist/server/server.js.map +1 -1
  180. package/dist/services/spine-services.d.ts.map +1 -1
  181. package/dist/services/spine-services.js +200 -72
  182. package/dist/services/spine-services.js.map +1 -1
  183. package/dist/stand/event-origin-filter.d.ts +16 -0
  184. package/dist/stand/event-origin-filter.d.ts.map +1 -0
  185. package/dist/stand/event-origin-filter.js +124 -0
  186. package/dist/stand/event-origin-filter.js.map +1 -0
  187. package/dist/stand/subscription-observer.d.ts.map +1 -1
  188. package/dist/stand/subscription-observer.js +7 -0
  189. package/dist/stand/subscription-observer.js.map +1 -1
  190. package/dist/stand/subscription-runtime.d.ts +18 -1
  191. package/dist/stand/subscription-runtime.d.ts.map +1 -1
  192. package/dist/stand/subscription-runtime.js +32 -4
  193. package/dist/stand/subscription-runtime.js.map +1 -1
  194. package/dist/testing/index.d.ts +57 -1
  195. package/dist/testing/index.d.ts.map +1 -1
  196. package/dist/testing/index.js +88 -1
  197. package/dist/testing/index.js.map +1 -1
  198. package/dist/tsconfig.tsbuildinfo +1 -1
  199. package/package.json +15 -13
@@ -0,0 +1,129 @@
1
+ import { type Any } from "@bufbuild/protobuf/wkt";
2
+ import type { MessageSchema } from "@spine-event-engine/core";
3
+ import { type AiControl, type AiRegistry, type AiScope, type ModelRef } from "@spine-event-engine/ai";
4
+ import { backendDefinition, selectDeployment } from "@spine-event-engine/ai/spi/runtime";
5
+ import { AiModelKind, type ModelPreference } from "@spine-event-engine/proto/agent";
6
+ import { type TenantId } from "@spine-event-engine/proto";
7
+ import { type AgentAcceptedInvocation, type AgentSelectedModel } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
8
+ import type { RepositoryAiOptions } from "../repository/repository.js";
9
+ interface AgentModelSelectionAccess {
10
+ /**
11
+ * Builds the authorization scope from immutable accepted signal facts.
12
+ *
13
+ * @param accepted Accepted original signal and recipient.
14
+ * @param state Generated Agent state descriptor.
15
+ * @param tenantId Delivery tenant, or undefined for a single-tenant Bounded Context.
16
+ * @returns Typed actor, Agent, tenant, and source scope.
17
+ */
18
+ scope(accepted: AgentAcceptedInvocation, state: MessageSchema, tenantId?: TenantId): AiScope;
19
+ /**
20
+ * Returns each model kind required by the repository's capabilities.
21
+ *
22
+ * @param registry Effective deployment registry.
23
+ * @param repository Repository models and selection policy.
24
+ * @param scope Authenticated accepted-invocation scope.
25
+ * @param preferences Claim-time per-instance selections.
26
+ * @param signal Cancellation signal for this execution.
27
+ * @param deadlineEpochMs Absolute invocation deadline.
28
+ * @param sourceMessage Detached original accepted payload when selection is required.
29
+ * @returns Selected, authorized deployments by available kind.
30
+ */
31
+ select(registry: AiRegistry, repository: RepositoryAiOptions, scope: AiScope, preferences: readonly ModelPreference[], signal: AbortSignal, deadlineEpochMs: number | undefined, sourceMessage?: Any): Promise<readonly AgentSelectedModel[]>;
32
+ /**
33
+ * Resolves one kind through instance, repository, and Bounded Context precedence.
34
+ *
35
+ * @param registry Effective deployment registry.
36
+ * @param repository Repository models and selection policy.
37
+ * @param scope Authenticated accepted-invocation scope.
38
+ * @param preferences Claim-time per-instance selections.
39
+ * @param signal Cancellation signal for this execution.
40
+ * @param deadlineEpochMs Absolute invocation deadline.
41
+ * @param kind Generation or decision kind to resolve.
42
+ * @param sourceMessage Detached original accepted payload when selection is required.
43
+ * @returns Authorized deployment and nonsecret connection identity.
44
+ */
45
+ selectKind(registry: AiRegistry, repository: RepositoryAiOptions, scope: AiScope, preferences: readonly ModelPreference[], signal: AbortSignal, deadlineEpochMs: number | undefined, kind: "generation" | "decision", sourceMessage?: Any): Promise<AgentSelectedModel>;
46
+ /**
47
+ * Resolves and copies one explicit model from the accepted payload.
48
+ *
49
+ * @param registry Effective registry and hook bound.
50
+ * @param repository Repository selection policy.
51
+ * @param scope Accepted source and actor.
52
+ * @param signal Invocation cancellation.
53
+ * @param deadlineEpochMs Absolute invocation deadline.
54
+ * @param kind Generation or decision kind.
55
+ * @param sourceMessage Detached source supplied by the runner.
56
+ * @returns A validated explicit model or absence.
57
+ */
58
+ resolveOverride(registry: AiRegistry, repository: RepositoryAiOptions, scope: AiScope, signal: AbortSignal, deadlineEpochMs: number | undefined, kind: "generation" | "decision", sourceMessage?: Any): Promise<ModelRef | undefined>;
59
+ /**
60
+ * Finds and authorizes a registered deployment before identity resolution.
61
+ *
62
+ * @param registry Effective registry and hook bound.
63
+ * @param repository Repository selection policy.
64
+ * @param scope Accepted source and actor.
65
+ * @param preferences Claim-time per-instance selections.
66
+ * @param signal Invocation cancellation.
67
+ * @param deadlineEpochMs Absolute invocation deadline.
68
+ * @param kind Generation or decision kind.
69
+ * @param sourceMessage Original accepted payload.
70
+ * @returns A registered authorized deployment.
71
+ */
72
+ deployment(registry: AiRegistry, repository: RepositoryAiOptions, scope: AiScope, preferences: readonly ModelPreference[], signal: AbortSignal, deadlineEpochMs: number | undefined, kind: "generation" | "decision", sourceMessage?: Any): Promise<ReturnType<typeof selectDeployment>>;
73
+ /**
74
+ * Checks a concrete or inherited selection with repository policy.
75
+ *
76
+ * @param registry Effective registry and hook bound.
77
+ * @param repository Repository selection policy.
78
+ * @param scope Accepted source and actor.
79
+ * @param reference Selected deployment or inheritance.
80
+ * @param signal Invocation cancellation.
81
+ * @param deadlineEpochMs Absolute invocation deadline.
82
+ * @returns When the selection is authorized.
83
+ */
84
+ authorizeSelection(registry: AiRegistry, repository: RepositoryAiOptions, scope: AiScope, reference: ModelRef | undefined, signal: AbortSignal, deadlineEpochMs: number | undefined): Promise<void>;
85
+ /**
86
+ * Calls a hook only while active and races its bounded cancellation.
87
+ *
88
+ * @typeParam Value Callback result.
89
+ * @param registry Effective registry and hook bound.
90
+ * @param signal Invocation cancellation.
91
+ * @param deadlineEpochMs Absolute invocation deadline.
92
+ * @param callback Hook receiving a bounded linked control.
93
+ * @returns A result produced before cancellation or expiry.
94
+ */
95
+ invokeHook<Value>(registry: AiRegistry, signal: AbortSignal, deadlineEpochMs: number | undefined, callback: (control: AiControl) => Value | Promise<Value>): Promise<Value>;
96
+ /**
97
+ * Resolves and authorizes the selected backend's nonsecret identity.
98
+ *
99
+ * @param backend Factory-proven selected backend callbacks.
100
+ * @param scope Authenticated accepted-invocation scope.
101
+ * @param signal Cancellation signal for this execution.
102
+ * @param deadlineEpochMs Absolute invocation deadline.
103
+ * @returns Validated connection identity for the selected backend.
104
+ */
105
+ connection(backend: ReturnType<typeof backendDefinition>, scope: AiScope, signal: AbortSignal, deadlineEpochMs: number | undefined): Promise<NonNullable<AgentSelectedModel["connection"]>>;
106
+ /**
107
+ * Converts a deployment role to its generated enum value.
108
+ *
109
+ * @param kind Registered generation or decision role.
110
+ * @returns Corresponding generated model kind.
111
+ */
112
+ kind(kind: "generation" | "decision"): AiModelKind;
113
+ /**
114
+ * Awaits a selection hook under cancellation and the invocation deadline.
115
+ *
116
+ * @typeParam Value Hook result type.
117
+ * @param work Hook result or pending callback promise.
118
+ * @param signal Cancellation signal for this execution.
119
+ * @param deadlineEpochMs Absolute invocation deadline.
120
+ * @returns Hook value if it settles before cancellation or expiry.
121
+ */
122
+ awaitHook<Value>(work: Value | Promise<Value>, signal: AbortSignal, deadlineEpochMs: number | undefined): Promise<Value>;
123
+ }
124
+ /**
125
+ * Selects and authenticates each available model kind at execution start.
126
+ */
127
+ export declare const AgentModelSelection: AgentModelSelectionAccess;
128
+ export {};
129
+ //# sourceMappingURL=agent-model-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-model-selection.d.ts","sourceRoot":"","sources":["../../src/agent/agent-model-selection.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EAEjB,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAIL,WAAW,EAIX,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAC;AACnC,O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,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,KAAK,CAAC,CAAC;CACnB;AAuBD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,yBA2YhC,CAAC"}
@@ -0,0 +1,342 @@
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 { clone, create } from "@bufbuild/protobuf";
15
+ import { AnySchema } from "@bufbuild/protobuf/wkt";
16
+ import { AnyMessages, Time, TypeUrls, Validate } from "@spine-event-engine/core";
17
+ import { ModelRef as ModelRefFactory, } from "@spine-event-engine/ai";
18
+ import { backendDefinition, registryOptions, selectDeployment, } from "@spine-event-engine/ai/spi/runtime";
19
+ import { AiAccountIdentitySchema, AiConnectionIdentitySchema, AiEndpointIdentitySchema, AiModelKind, AiProviderModelNameSchema as ModelNameSchema, AiProviderNameSchema, ModelRefSchema, } from "@spine-event-engine/proto/agent";
20
+ import { CommandIdSchema, EventIdSchema, MessageIdSchema, ActorContextSchema, TenantIdSchema, } from "@spine-event-engine/proto";
21
+ import { AgentSelectedModelSchema, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
22
+ import { AgentExecutionFault } from "./agent-execution-fault.js";
23
+ /**
24
+ * Copies every accepted-scope identity before passing it to an application callback.
25
+ *
26
+ * @param scope Original accepted actor, tenant, Agent and source facts.
27
+ * @returns Detached scope with independent nested Protobuf values.
28
+ */
29
+ const copyScope = (scope) => ({
30
+ actor: clone(ActorContextSchema, scope.actor),
31
+ tenant: scope.tenant.kind === "tenant"
32
+ ? { kind: "tenant", id: clone(TenantIdSchema, scope.tenant.id) }
33
+ : { kind: "single-tenant" },
34
+ agent: clone(MessageIdSchema, scope.agent),
35
+ source: clone(MessageIdSchema, scope.source),
36
+ });
37
+ /**
38
+ * Chooses the earliest configured callback or invocation deadline.
39
+ *
40
+ * @param registry Effective callback policy.
41
+ * @param invocationDeadline Accepted invocation deadline, when configured.
42
+ * @returns Absolute callback deadline, or undefined when no ceiling applies.
43
+ */
44
+ const selectionHookDeadline = (registry, invocationDeadline) => {
45
+ const hookTimeoutMs = registryOptions(registry).hookTimeoutMs;
46
+ const hookDeadline = hookTimeoutMs === undefined ? undefined : Time.currentTimeMillis() + hookTimeoutMs;
47
+ return invocationDeadline === undefined
48
+ ? hookDeadline
49
+ : hookDeadline === undefined
50
+ ? invocationDeadline
51
+ : Math.min(invocationDeadline, hookDeadline);
52
+ };
53
+ /**
54
+ * Selects and authenticates each available model kind at execution start.
55
+ */
56
+ export const AgentModelSelection = Object.freeze({
57
+ /**
58
+ * Constructs the accepted actor, tenant, Agent and source authorization scope.
59
+ *
60
+ * @param accepted Original accepted signal and typed recipient.
61
+ * @param state Generated Agent state descriptor.
62
+ * @param tenantId Delivery tenant, if this Bounded Context is tenant-scoped.
63
+ * @returns Scope passed to identity and authorization callbacks.
64
+ */
65
+ scope(accepted, state, tenantId) {
66
+ const recipient = accepted.recipientId;
67
+ if (recipient === undefined)
68
+ throw new Error("Agent selection requires the typed recipient.");
69
+ const signal = accepted.signal;
70
+ if (signal.case !== "command" && signal.case !== "event")
71
+ throw new Error("Agent selection requires its original source signal.");
72
+ const sourceId = signal.case === "command"
73
+ ? signal.value.id === undefined
74
+ ? undefined
75
+ : AnyMessages.pack(CommandIdSchema, signal.value.id)
76
+ : signal.value.id === undefined
77
+ ? undefined
78
+ : AnyMessages.pack(EventIdSchema, signal.value.id);
79
+ if (sourceId === undefined)
80
+ throw new Error("Agent selection requires the source ID.");
81
+ const payloadType = signal.value.message?.typeUrl;
82
+ if (payloadType === undefined || payloadType.trim().length === 0)
83
+ throw new Error("Agent selection requires the source payload type.");
84
+ const actor = accepted.actor;
85
+ if (actor === undefined)
86
+ throw new Error("Agent selection requires the accepted actor.");
87
+ return {
88
+ actor,
89
+ tenant: tenantId === undefined ? { kind: "single-tenant" } : { kind: "tenant", id: tenantId },
90
+ agent: create(MessageIdSchema, { id: recipient, typeUrl: TypeUrls.derive(state) }),
91
+ source: create(MessageIdSchema, {
92
+ id: sourceId,
93
+ typeUrl: payloadType,
94
+ }),
95
+ };
96
+ },
97
+ /**
98
+ * Resolves, authorizes and records one selected deployment for each available kind.
99
+ *
100
+ * @param registry Effective deployment registry.
101
+ * @param repository Repository models and selection policy.
102
+ * @param scope Authenticated accepted-invocation scope.
103
+ * @param preferences Claim-time per-instance selections.
104
+ * @param signal Cancellation signal for this execution.
105
+ * @param deadlineEpochMs Absolute invocation deadline.
106
+ * @param sourceMessage Detached original accepted payload when selection is required.
107
+ * @returns Selected deployments for kinds used by the repository.
108
+ */
109
+ async select(registry, repository, scope, preferences, signal, deadlineEpochMs, sourceMessage) {
110
+ const selected = [];
111
+ for (const kind of ["generation", "decision"]) {
112
+ if (!repository.models.some((model) => model.definition.kind === kind))
113
+ continue;
114
+ selected.push(await this.selectKind(registry, repository, scope, preferences, signal, deadlineEpochMs, kind, sourceMessage));
115
+ }
116
+ return selected;
117
+ },
118
+ /**
119
+ * Resolves a deployment through normal precedence and checks authenticated identity.
120
+ *
121
+ * @param registry Effective deployment registry.
122
+ * @param repository Repository models and selection policy.
123
+ * @param scope Authenticated accepted-invocation scope.
124
+ * @param preferences Claim-time per-instance selections.
125
+ * @param signal Cancellation signal for this execution.
126
+ * @param deadlineEpochMs Absolute invocation deadline.
127
+ * @param kind Generation or decision kind to select.
128
+ * @param sourceMessage Detached original accepted payload when selection is required.
129
+ * @returns Chosen deployment and validated connection identity.
130
+ */
131
+ async selectKind(registry, repository, scope, preferences, signal, deadlineEpochMs, kind, sourceMessage) {
132
+ const registration = await this.deployment(registry, repository, scope, preferences, signal, deadlineEpochMs, kind, sourceMessage);
133
+ const connection = await this.connection(backendDefinition(registration), scope, signal, deadlineEpochMs);
134
+ return create(AgentSelectedModelSchema, {
135
+ kind: this.kind(kind),
136
+ model: registration.ref,
137
+ connection,
138
+ });
139
+ },
140
+ /**
141
+ * Finds a deployment and checks a concrete resolver choice before identity work.
142
+ *
143
+ * @param registry Effective registry and hook bound.
144
+ * @param repository Repository selection policy.
145
+ * @param scope Accepted source and actor.
146
+ * @param preferences Claim-time per-instance selections.
147
+ * @param signal Invocation cancellation.
148
+ * @param deadlineEpochMs Absolute invocation deadline.
149
+ * @param kind Generation or decision kind.
150
+ * @param sourceMessage Original accepted payload.
151
+ * @returns A registered authorized deployment.
152
+ */
153
+ async deployment(registry, repository, scope, preferences, signal, deadlineEpochMs, kind, sourceMessage) {
154
+ const override = await this.resolveOverride(registry, repository, scope, signal, deadlineEpochMs, kind, sourceMessage);
155
+ const normal = this.selection(registry, repository, preferences, kind);
156
+ const registration = selectDeployment(registry, {
157
+ ...normal,
158
+ ...(override === undefined ? {} : { instancePreference: override }),
159
+ });
160
+ if (override !== undefined)
161
+ await this.authorizeSelection(registry, repository, scope, override, signal, deadlineEpochMs);
162
+ return registration;
163
+ },
164
+ /**
165
+ * Resolves and copies one explicit model from the accepted payload.
166
+ *
167
+ * @param registry Effective registry and hook bound.
168
+ * @param repository Repository selection policy.
169
+ * @param scope Accepted source and actor.
170
+ * @param signal Invocation cancellation.
171
+ * @param deadlineEpochMs Absolute invocation deadline.
172
+ * @param kind Generation or decision kind.
173
+ * @param sourceMessage Detached source supplied by the runner.
174
+ * @returns A validated explicit model or absence.
175
+ */
176
+ async resolveOverride(registry, repository, scope, signal, deadlineEpochMs, kind, sourceMessage) {
177
+ if (repository.resolveModel === undefined)
178
+ return undefined;
179
+ if (sourceMessage === undefined)
180
+ throw new Error("Agent selection requires source payload.");
181
+ const result = await this.invokeHook(registry, signal, deadlineEpochMs, (control) => repository.resolveModel?.(kind, copyScope(scope), clone(AnySchema, sourceMessage), control));
182
+ if (result === undefined)
183
+ return undefined;
184
+ Validate.check(ModelRefSchema, result);
185
+ return ModelRefFactory.of(result.name?.value ?? "", result.revision?.value ?? "");
186
+ },
187
+ /**
188
+ * Checks a concrete or inherited selection with the repository policy.
189
+ *
190
+ * @param registry Effective registry and hook bound.
191
+ * @param repository Repository selection policy.
192
+ * @param scope Accepted source and actor.
193
+ * @param reference Selected deployment or inherited preference.
194
+ * @param signal Invocation cancellation.
195
+ * @param deadlineEpochMs Absolute invocation deadline.
196
+ * @returns When selection is authorized.
197
+ */
198
+ async authorizeSelection(registry, repository, scope, reference, signal, deadlineEpochMs) {
199
+ if (repository.authorizeSelection === undefined)
200
+ return;
201
+ const allowed = await this.invokeHook(registry, signal, deadlineEpochMs, (control) => repository.authorizeSelection?.(scope, reference, control));
202
+ if (allowed !== true)
203
+ throw new Error("Agent model selection is unauthorized.");
204
+ },
205
+ /**
206
+ * Calls a hook only while active and races its bounded cancellation.
207
+ *
208
+ * @typeParam Value Callback result.
209
+ * @param registry Effective registry and hook bound.
210
+ * @param signal Invocation cancellation.
211
+ * @param deadlineEpochMs Absolute invocation deadline.
212
+ * @param callback Hook receiving a linked bounded control.
213
+ * @returns A result produced before cancellation or expiry.
214
+ */
215
+ async invokeHook(registry, signal, deadlineEpochMs, callback) {
216
+ const deadline = selectionHookDeadline(registry, deadlineEpochMs);
217
+ if (signal.aborted)
218
+ throw new Error("Agent model selection cancelled.");
219
+ if (deadline !== undefined && deadline <= Time.currentTimeMillis())
220
+ throw new Error("Agent model selection expired.");
221
+ const controller = new AbortController();
222
+ const linked = AbortSignal.any([signal, controller.signal]);
223
+ const timer = deadline === undefined
224
+ ? undefined
225
+ : setTimeout(() => {
226
+ controller.abort();
227
+ }, Math.max(0, deadline - Time.currentTimeMillis()));
228
+ try {
229
+ return await this.awaitHook(callback({
230
+ signal: linked,
231
+ ...(deadline === undefined ? {} : { deadlineEpochMs: deadline }),
232
+ }), linked, deadline);
233
+ }
234
+ finally {
235
+ if (timer !== undefined)
236
+ clearTimeout(timer);
237
+ controller.abort();
238
+ }
239
+ },
240
+ /**
241
+ * Builds the accepted deployment precedence from repository and claim-time facts.
242
+ *
243
+ * @param registry Effective deployment registry.
244
+ * @param repository Repository models and selection policy.
245
+ * @param preferences Claim-time per-instance selections.
246
+ * @param kind Generation or decision kind to select.
247
+ * @returns Inputs for the registry's normal selection path.
248
+ */
249
+ selection(registry, repository, preferences, kind) {
250
+ const preference = preferences.find((item) => item.kind === this.kind(kind));
251
+ const instancePreference = preference?.selection.case === "model" ? preference.selection.value : undefined;
252
+ return {
253
+ kind,
254
+ models: repository.models,
255
+ ...(instancePreference === undefined ? {} : { instancePreference }),
256
+ ...(repository.defaultModels?.[kind] === undefined
257
+ ? {}
258
+ : { repositoryDefault: repository.defaultModels[kind] }),
259
+ ...(registryOptions(registry).defaultModels[kind] === undefined
260
+ ? {}
261
+ : { contextDefault: registryOptions(registry).defaultModels[kind] }),
262
+ ...(repository.allowedModels?.[kind] === undefined
263
+ ? {}
264
+ : { allowedModels: repository.allowedModels[kind] }),
265
+ };
266
+ },
267
+ /**
268
+ * Resolves a connection identity within the deadline. An explicit use denial
269
+ * becomes a safe terminal execution fault before the Agent handler runs.
270
+ *
271
+ * @param backend Factory-proven selected backend callbacks.
272
+ * @param scope Authenticated accepted-invocation scope.
273
+ * @param signal Cancellation signal for this execution.
274
+ * @param deadlineEpochMs Absolute invocation deadline.
275
+ * @returns Validated nonsecret connection identity.
276
+ */
277
+ async connection(backend, scope, signal, deadlineEpochMs) {
278
+ if (signal.aborted)
279
+ throw new Error("Agent model selection cancelled.");
280
+ if (deadlineEpochMs !== undefined && deadlineEpochMs <= Time.currentTimeMillis())
281
+ throw new Error("Agent model selection expired.");
282
+ const control = { signal, ...(deadlineEpochMs === undefined ? {} : { deadlineEpochMs }) };
283
+ const identity = await this.awaitHook(backend.resolveIdentity(scope, control), signal, deadlineEpochMs);
284
+ signal.throwIfAborted();
285
+ if (deadlineEpochMs !== undefined && deadlineEpochMs <= Time.currentTimeMillis())
286
+ throw new Error("Agent model selection expired.");
287
+ const allowed = await this.awaitHook(backend.authorizeUse(scope, identity, control), signal, deadlineEpochMs);
288
+ if (!allowed)
289
+ throw new AgentExecutionFault("MODEL_USE_DENIED", "Selected Agent model use was denied.");
290
+ const connection = create(AiConnectionIdentitySchema, {
291
+ provider: create(AiProviderNameSchema, { value: identity.provider }),
292
+ account: create(AiAccountIdentitySchema, { value: identity.account }),
293
+ endpoint: create(AiEndpointIdentitySchema, { value: identity.endpoint }),
294
+ model: create(ModelNameSchema, { value: identity.model }),
295
+ });
296
+ Validate.check(AiConnectionIdentitySchema, connection);
297
+ return connection;
298
+ },
299
+ /**
300
+ * Converts a registered deployment role to the generated closed enum.
301
+ *
302
+ * @param kind Registered generation or decision role.
303
+ * @returns Matching generated model kind.
304
+ */
305
+ kind(kind) {
306
+ return kind === "generation" ? AiModelKind.GENERATION : AiModelKind.DECISION;
307
+ },
308
+ /**
309
+ * Bounds a connection or authorization hook even if its callback ignores cancellation.
310
+ *
311
+ * @typeParam Value Hook result type.
312
+ * @param work Hook result or pending callback promise.
313
+ * @param signal Cancellation signal for this execution.
314
+ * @param deadlineEpochMs Absolute invocation deadline.
315
+ * @returns Hook value if it settles before cancellation or expiry.
316
+ */
317
+ awaitHook(work, signal, deadlineEpochMs) {
318
+ const remaining = deadlineEpochMs === undefined ? undefined : deadlineEpochMs - Time.currentTimeMillis();
319
+ if (signal.aborted)
320
+ return Promise.reject(new Error("Agent model selection cancelled."));
321
+ if (remaining !== undefined && remaining <= 0)
322
+ return Promise.reject(new Error("Agent model selection expired."));
323
+ return new Promise((resolve, reject) => {
324
+ const abort = () => {
325
+ if (timer !== undefined)
326
+ clearTimeout(timer);
327
+ reject(new Error("Agent model selection cancelled."));
328
+ };
329
+ const timer = remaining === undefined ? undefined : setTimeout(abort, remaining);
330
+ signal.addEventListener("abort", abort, { once: true });
331
+ Promise.resolve(work)
332
+ .then(resolve, reject)
333
+ .finally(() => {
334
+ if (timer !== undefined)
335
+ clearTimeout(timer);
336
+ signal.removeEventListener("abort", abort);
337
+ })
338
+ .catch(() => undefined);
339
+ });
340
+ },
341
+ });
342
+ //# sourceMappingURL=agent-model-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-model-selection.js","sourceRoot":"","sources":["../../src/agent/agent-model-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAY,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEjF,OAAO,EACL,QAAQ,IAAI,eAAe,GAK5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,WAAW,EACX,yBAAyB,IAAI,eAAe,EAC5C,oBAAoB,EACpB,cAAc,GAEf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,GAEf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,GAGzB,MAAM,+EAA+E,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC,CAAC;IAC9C,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7C,MAAM,EACJ,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;QAC5B,CAAC,CAAC,EA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AG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { type MessageShape } from "@bufbuild/protobuf";
2
+ import { type MessageSchema } from "@spine-event-engine/core";
3
+ import { type Query } from "@spine-event-engine/proto/client";
4
+ import { type AgentExecutionRecord } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
5
+ import { type AgentExecutionCapacity, type AgentHistoryPage, type AgentHistoryView } from "@spine-event-engine/storage/provider";
6
+ import type { HistoryRead } from "@spine-event-engine/ai";
7
+ import type { AgentHistoryScope } from "./agent-history.js";
8
+ interface ReadSession {
9
+ /**
10
+ * Returns the current fenced execution record.
11
+ *
12
+ * @returns The execution record.
13
+ */
14
+ record(): AgentExecutionRecord;
15
+ /**
16
+ * Persists a change to the fenced execution record.
17
+ *
18
+ * @param change Applies the read evidence to the current record.
19
+ * @returns The updated execution record.
20
+ */
21
+ update(change: (record: AgentExecutionRecord) => AgentExecutionRecord): Promise<AgentExecutionRecord>;
22
+ /**
23
+ * Returns the configured journal capacity.
24
+ *
25
+ * @returns The execution capacity limits.
26
+ */
27
+ capacity(): AgentExecutionCapacity;
28
+ }
29
+ /**
30
+ * Reuses complete indexed pages under one handler's fenced journal.
31
+ */
32
+ export declare class AgentReadRuntime {
33
+ #private;
34
+ private readonly session;
35
+ private readonly handlerOrdinal;
36
+ /**
37
+ * Creates a read sequencer for one handler invocation.
38
+ *
39
+ * @param session Fenced execution journal for this invocation.
40
+ * @param handlerOrdinal Ordinal of the handler within the accepted delivery.
41
+ */
42
+ constructor(session: ReadSession, handlerOrdinal: number);
43
+ /**
44
+ * Returns one saved page or persists a live page before the handler sees it.
45
+ *
46
+ * @param scope Accepted Agent instance for this read.
47
+ * @param view History view selected by the handler.
48
+ * @param request Requested page and cursor.
49
+ * @param live Performs the live read when no saved page exists.
50
+ * @param maxBytes Maximum size of a live history page.
51
+ * @returns The saved or newly persisted page.
52
+ */
53
+ history(scope: AgentHistoryScope, view: AgentHistoryView, request: HistoryRead, live: () => Promise<AgentHistoryPage>, maxBytes: number | undefined): Promise<AgentHistoryPage>;
54
+ /**
55
+ * Returns saved typed projection states or persists a live query result.
56
+ *
57
+ * @typeParam Schema Schema of each returned projection state.
58
+ * @param schema Projection state schema.
59
+ * @param query Typed query to replay or execute.
60
+ * @param live Performs the live query when no saved result exists.
61
+ * @returns The saved or newly persisted projection states.
62
+ */
63
+ query<Schema extends MessageSchema>(schema: Schema, query: Query, live: () => Promise<readonly MessageShape<Schema>[]>): Promise<readonly MessageShape<Schema>[]>;
64
+ /**
65
+ * Rejects omitted saved reads after all handler methods have returned.
66
+ */
67
+ finish(): void;
68
+ }
69
+ export {};
70
+ //# sourceMappingURL=agent-read-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-read-runtime.d.ts","sourceRoot":"","sources":["../../src/agent/agent-read-runtime.ts"],"names":[],"mappings":"AAcA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAQL,KAAK,oBAAoB,EAE1B,MAAM,+EAA+E,CAAC;AACvF,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,UAAU,WAAW;IACnB;;;;OAIG;IACH,MAAM,IAAI,oBAAoB,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CACJ,MAAM,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,oBAAoB,GAC7D,OAAO,CAAC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