hiveagents-runtime 0.0.0-stage → 0.1.0-beta.3

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 (115) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +89 -2
  3. package/dist/adapter-kit.d.ts +37 -0
  4. package/dist/adapter-kit.js +34 -0
  5. package/dist/adapter-kit.js.map +1 -0
  6. package/dist/agent-Bj5YPrO7.d.ts +169 -0
  7. package/dist/agent-D6OXR7UF.js +24 -0
  8. package/dist/agent-D6OXR7UF.js.map +1 -0
  9. package/dist/agent-readiness-KSGNKTGK.js +19 -0
  10. package/dist/agent-readiness-KSGNKTGK.js.map +1 -0
  11. package/dist/capture-runtime-GP6NZ2ee.d.ts +54 -0
  12. package/dist/chunk-2RK74GCA.js +2397 -0
  13. package/dist/chunk-2RK74GCA.js.map +1 -0
  14. package/dist/chunk-3TIYA3K5.js +55 -0
  15. package/dist/chunk-3TIYA3K5.js.map +1 -0
  16. package/dist/chunk-6FIXXWNM.js +1 -0
  17. package/dist/chunk-6FIXXWNM.js.map +1 -0
  18. package/dist/chunk-6XIJW65Q.js +52 -0
  19. package/dist/chunk-6XIJW65Q.js.map +1 -0
  20. package/dist/chunk-7LDQKJKI.js +248 -0
  21. package/dist/chunk-7LDQKJKI.js.map +1 -0
  22. package/dist/chunk-CPN4DOXH.js +115 -0
  23. package/dist/chunk-CPN4DOXH.js.map +1 -0
  24. package/dist/chunk-DAXPAV2L.js +810 -0
  25. package/dist/chunk-DAXPAV2L.js.map +1 -0
  26. package/dist/chunk-DQEMIGKC.js +291 -0
  27. package/dist/chunk-DQEMIGKC.js.map +1 -0
  28. package/dist/chunk-DZFFGUIA.js +81 -0
  29. package/dist/chunk-DZFFGUIA.js.map +1 -0
  30. package/dist/chunk-EEUYQFCP.js +106 -0
  31. package/dist/chunk-EEUYQFCP.js.map +1 -0
  32. package/dist/chunk-G6JV7WV6.js +521 -0
  33. package/dist/chunk-G6JV7WV6.js.map +1 -0
  34. package/dist/chunk-GFVYNPLS.js +118 -0
  35. package/dist/chunk-GFVYNPLS.js.map +1 -0
  36. package/dist/chunk-GS5U3KUN.js +201 -0
  37. package/dist/chunk-GS5U3KUN.js.map +1 -0
  38. package/dist/chunk-HB7FBSH2.js +960 -0
  39. package/dist/chunk-HB7FBSH2.js.map +1 -0
  40. package/dist/chunk-HZFZX5A3.js +21 -0
  41. package/dist/chunk-HZFZX5A3.js.map +1 -0
  42. package/dist/chunk-J7VAYJKM.js +595 -0
  43. package/dist/chunk-J7VAYJKM.js.map +1 -0
  44. package/dist/chunk-NCNSHOF7.js +52 -0
  45. package/dist/chunk-NCNSHOF7.js.map +1 -0
  46. package/dist/chunk-RH5A5U7G.js +202 -0
  47. package/dist/chunk-RH5A5U7G.js.map +1 -0
  48. package/dist/chunk-RX3XZENU.js +385 -0
  49. package/dist/chunk-RX3XZENU.js.map +1 -0
  50. package/dist/chunk-RXU2Q2HF.js +49 -0
  51. package/dist/chunk-RXU2Q2HF.js.map +1 -0
  52. package/dist/chunk-TG7NTMTR.js +208 -0
  53. package/dist/chunk-TG7NTMTR.js.map +1 -0
  54. package/dist/chunk-TWGEYWMO.js +1217 -0
  55. package/dist/chunk-TWGEYWMO.js.map +1 -0
  56. package/dist/chunk-UZPDDQVJ.js +2910 -0
  57. package/dist/chunk-UZPDDQVJ.js.map +1 -0
  58. package/dist/chunk-WMKO5XOE.js +601 -0
  59. package/dist/chunk-WMKO5XOE.js.map +1 -0
  60. package/dist/chunk-WOQBVJH5.js +175 -0
  61. package/dist/chunk-WOQBVJH5.js.map +1 -0
  62. package/dist/chunk-WVT5SEKC.js +581 -0
  63. package/dist/chunk-WVT5SEKC.js.map +1 -0
  64. package/dist/cli.d.ts +1 -0
  65. package/dist/cli.js +26 -0
  66. package/dist/cli.js.map +1 -0
  67. package/dist/errors-BNHvvjn9.d.ts +98 -0
  68. package/dist/execution-halt-B8G0fOKS.d.ts +12 -0
  69. package/dist/execution-types-ClYYqPQP.d.ts +239 -0
  70. package/dist/host-ledger-VPRWVVOS.js +25 -0
  71. package/dist/host-ledger-VPRWVVOS.js.map +1 -0
  72. package/dist/hosted-runtime.d.ts +168 -0
  73. package/dist/hosted-runtime.js +858 -0
  74. package/dist/hosted-runtime.js.map +1 -0
  75. package/dist/index-B86C6VAD.d.ts +41 -0
  76. package/dist/index.d.ts +344 -0
  77. package/dist/index.js +8825 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/memory-items-BSTC0_R0.d.ts +28 -0
  80. package/dist/memory-tools.d.ts +222 -0
  81. package/dist/memory-tools.js +923 -0
  82. package/dist/memory-tools.js.map +1 -0
  83. package/dist/orchestration/dynamic.d.ts +854 -0
  84. package/dist/orchestration/dynamic.js +3150 -0
  85. package/dist/orchestration/dynamic.js.map +1 -0
  86. package/dist/orchestration/graph.d.ts +11 -0
  87. package/dist/orchestration/graph.js +9 -0
  88. package/dist/orchestration/graph.js.map +1 -0
  89. package/dist/orchestration/index.d.ts +2385 -0
  90. package/dist/orchestration/index.js +6409 -0
  91. package/dist/orchestration/index.js.map +1 -0
  92. package/dist/orchestration/log.d.ts +301 -0
  93. package/dist/orchestration/log.js +3058 -0
  94. package/dist/orchestration/log.js.map +1 -0
  95. package/dist/orchestration/memory.d.ts +711 -0
  96. package/dist/orchestration/memory.js +27 -0
  97. package/dist/orchestration/memory.js.map +1 -0
  98. package/dist/provider-DX5Mf0uq.d.ts +151 -0
  99. package/dist/routing/index.d.ts +29 -0
  100. package/dist/routing/index.js +386 -0
  101. package/dist/routing/index.js.map +1 -0
  102. package/dist/routing/learning/index.d.ts +433 -0
  103. package/dist/routing/learning/index.js +2502 -0
  104. package/dist/routing/learning/index.js.map +1 -0
  105. package/dist/runtime-BSjrnxeF.d.ts +283 -0
  106. package/dist/runtime-OISPXS4I.js +19 -0
  107. package/dist/runtime-OISPXS4I.js.map +1 -0
  108. package/dist/store-types-2YdceOMy.d.ts +78 -0
  109. package/dist/types-BB7KqceP.d.ts +52 -0
  110. package/dist/types-CIqkKXix.d.ts +86 -0
  111. package/dist/types-DTFc1qO6.d.ts +1065 -0
  112. package/dist/types-DYex3p7_.d.ts +88 -0
  113. package/docs/licenses/ruflo-memory-MIT.txt +21 -0
  114. package/docs/releases/0.1.0-beta.3.md +13 -0
  115. package/package.json +114 -4
@@ -0,0 +1,283 @@
1
+ import { R as RuntimeCaptureOptions, A as AgentLogCaptureBinding } from './capture-runtime-GP6NZ2ee.js';
2
+ import { A as AdapterStreamItem, e as ExecAdapter } from './provider-DX5Mf0uq.js';
3
+ import { G as ContextSourceReport, H as ContextPolicy, P as ProviderId, I as EnforcementReport, J as PermissionIntent, b as TransportKind, j as ApplicationTool, M as ModelInfo, t as SessionPersistence, K as SafetyEnvelope, v as CapabilityStatus, S as SessionRef, f as SessionIdentity, q as AgentInput, N as InteractionRequest, Q as InteractionResponse, V as InterruptReceipt, W as SteerReceipt, L as LaunchTarget, X as SupportLevel, Y as CapabilityEvidenceSource, Z as BuiltinProviderId, C as CapabilitySupport, d as AgentOptions, _ as RuntimeMemoryDefault } from './types-DTFc1qO6.js';
4
+
5
+ interface ContextTranslation {
6
+ args: string[];
7
+ unsupported: string[];
8
+ warnings: string[];
9
+ report: ContextSourceReport;
10
+ }
11
+ declare function normalizeContextPolicy(policy?: ContextPolicy): Required<ContextPolicy>;
12
+ declare function translateContext(provider: ProviderId, requested?: ContextPolicy): ContextTranslation;
13
+
14
+ interface PermissionTranslation {
15
+ args: string[];
16
+ report: EnforcementReport;
17
+ }
18
+ declare function translatePermissions(provider: ProviderId, requested: PermissionIntent, transport?: TransportKind): PermissionTranslation;
19
+
20
+ interface BrokerDecision {
21
+ decision: string;
22
+ [key: string]: unknown;
23
+ }
24
+ interface BrokerBinding {
25
+ interactionId: string;
26
+ provider: ProviderId;
27
+ transportEpoch: string;
28
+ providerRequestId?: string | number;
29
+ method: string;
30
+ sessionId: string;
31
+ turnId?: string;
32
+ itemId?: string;
33
+ payloadDigest: string;
34
+ }
35
+ interface InteractionHandle {
36
+ binding: Readonly<BrokerBinding>;
37
+ availableDecisions: readonly string[];
38
+ signal: AbortSignal;
39
+ }
40
+ /**
41
+ * A settlement that answered the provider with a decision other than the one
42
+ * requested (an acceptance the policy refused, written as a decline). The wire
43
+ * is settled, so the interaction is resolved; respond() then throws `refusal`
44
+ * so the caller learns its own decision was not applied.
45
+ */
46
+ interface SettledWithRefusal {
47
+ refusal: Error;
48
+ }
49
+ interface RegisterInteraction {
50
+ providerRequestId?: string | number;
51
+ method: string;
52
+ sessionId: string;
53
+ turnId?: string;
54
+ itemId?: string;
55
+ payload: unknown;
56
+ /**
57
+ * The settlement acts on `payload` by reference (Claude's `allow` hands the
58
+ * presented tool input back as `updatedInput`). The broker then re-digests
59
+ * the payload before settling and refuses a decision whose payload changed
60
+ * after it was presented: an approval covers exactly what was shown.
61
+ */
62
+ bindPayload?: boolean;
63
+ availableDecisions: readonly string[];
64
+ settle(response: BrokerDecision): Promise<void | SettledWithRefusal>;
65
+ }
66
+ /**
67
+ * Exactly-once settlement for provider interactions. Live entries exist only
68
+ * while an interaction is pending or resolving; once settled or expired the
69
+ * entry (and the settle closure that retains the provider payload) is
70
+ * released, and a bounded tombstone keeps the typed distinction between
71
+ * «already resolved», «expired» and «unknown» for late responses.
72
+ */
73
+ declare class InteractionBroker {
74
+ #private;
75
+ /** Upper bound on remembered settled ids; the oldest are forgotten first. */
76
+ static readonly MAX_TOMBSTONES = 4096;
77
+ constructor(options: {
78
+ provider: ProviderId;
79
+ epoch: string;
80
+ });
81
+ /** Interactions still pending or resolving (observability and leak tests). */
82
+ get size(): number;
83
+ register(input: RegisterInteraction): InteractionHandle;
84
+ respond(interactionId: string, response: BrokerDecision): Promise<void>;
85
+ expire(interactionId: string, reason?: string): boolean;
86
+ /** Retire a turn/session without cancelling a sibling thread on the same transport. */
87
+ expireScope(sessionId: string, turnId?: string): void;
88
+ /**
89
+ * Rotates the transport epoch and retires every live entry, including one
90
+ * whose settlement is in flight: its respond() then reports expiry instead
91
+ * of «resolved», since the old transport can no longer confirm delivery.
92
+ * The settle closure itself is never called twice.
93
+ */
94
+ expireAll(nextEpoch: string): void;
95
+ }
96
+
97
+ /**
98
+ * Adapter-level liveness of a control session, mirroring the Codex thread
99
+ * registry: 'unknown' means the provider may still hold the session (a
100
+ * persisted session whose transport died) and a reconcile is required before
101
+ * any further turn; 'failed' is terminal (the session died with its process).
102
+ */
103
+ type ControlSessionState = 'active' | 'unknown' | 'failed' | 'closed';
104
+ interface ControlTurnRequest {
105
+ input: AgentInput;
106
+ signal?: AbortSignal;
107
+ timeoutMs?: number;
108
+ outputSchema?: Record<string, unknown>;
109
+ /** Reaches the provider's interaction broker; absent means "no handler". */
110
+ onInteraction?: (request: InteractionRequest) => Promise<InteractionResponse>;
111
+ providerParams?: Record<string, unknown>;
112
+ }
113
+ /**
114
+ * One in-flight turn. `stream` carries the same items an exec adapter's
115
+ * `stream()` produces, so `Session` projects both transports through one code
116
+ * path. `steer` is present only on providers whose negotiated capabilities
117
+ * include steering.
118
+ */
119
+ interface ControlTurnHandle {
120
+ readonly stream: AsyncIterable<AdapterStreamItem>;
121
+ interrupt(reason?: string): Promise<InterruptReceipt>;
122
+ steer?(input: AgentInput): Promise<SteerReceipt>;
123
+ }
124
+ interface ControlForkRequest {
125
+ signal?: AbortSignal;
126
+ timeoutMs?: number;
127
+ model?: ModelInfo;
128
+ name?: string;
129
+ }
130
+ /**
131
+ * The seam `Session` drives for a control transport. A registration supplies
132
+ * one of these per session; the runtime core never imports adapter internals.
133
+ */
134
+ interface ControlSessionHandle {
135
+ /** Epoch every SessionRef and interaction binding minted for this session carries. */
136
+ readonly transportEpoch: string;
137
+ /** Known at open time when the provider mints ids eagerly (Codex threads); Claude confirms on the first turn. */
138
+ readonly identity: SessionIdentity | undefined;
139
+ state(): ControlSessionState;
140
+ startTurn(request: ControlTurnRequest): Promise<ControlTurnHandle>;
141
+ respond(interactionId: string, response: InteractionResponse): Promise<void>;
142
+ fork(request: ControlForkRequest): Promise<ControlSessionHandle>;
143
+ close(): Promise<void>;
144
+ /** Optional: re-establish a session left 'unknown' by a transport death. */
145
+ reconcile?(): Promise<ControlSessionState>;
146
+ }
147
+ interface ControlSessionRequest {
148
+ /** Host callbacks require explicit control transport gates. */
149
+ tools?: readonly ApplicationTool[];
150
+ model: ModelInfo;
151
+ cwd: string;
152
+ persistence: SessionPersistence;
153
+ env: NodeJS.ProcessEnv;
154
+ /** Immutable authority for this session; a factory may narrow it, never widen it. */
155
+ envelope: SafetyEnvelope;
156
+ capabilities: Record<string, CapabilityStatus>;
157
+ /** Dynamic tools stay gated behind this even when control is enabled. */
158
+ experimentalApi: boolean;
159
+ context?: ContextPolicy;
160
+ instructions?: string;
161
+ effort?: string;
162
+ /** The session must bill the CLI login; factories pin what their CLI lets a config redirect. */
163
+ requireSubscription?: boolean;
164
+ /** Pinned provider executable resolved during readiness. */
165
+ executablePath?: string;
166
+ resume?: SessionRef;
167
+ providerOptions?: Record<string, unknown>;
168
+ }
169
+ type ControlSessionFactory = (request: ControlSessionRequest) => Promise<ControlSessionHandle>;
170
+ /**
171
+ * Projects a public `InteractionResponse` onto the broker's decision record.
172
+ * The broker validates the decision against what the provider advertised, so
173
+ * an unmapped spelling fails there rather than being invented here.
174
+ */
175
+ declare function toBrokerResponse(response: InteractionResponse): BrokerDecision;
176
+
177
+ declare const RUNTIME_ADAPTER_VERSION = "0.1.0-beta.3";
178
+ type ExecTransportToken = 'claudeExecV1' | 'codexExecV1' | (string & {});
179
+ type ControlTransportToken = 'claudeControlV1' | 'codexAppServerV1' | (string & {});
180
+ type TransportToken = ExecTransportToken | ControlTransportToken;
181
+ declare const EXEC_TRANSPORT_TOKENS: Readonly<Record<BuiltinProviderId, ExecTransportToken>>;
182
+ declare const CONTROL_TRANSPORTS: Readonly<Record<BuiltinProviderId, {
183
+ token: ControlTransportToken;
184
+ packageName: string;
185
+ }>>;
186
+ interface ExecAdapterRegistration {
187
+ adapter: ExecAdapter;
188
+ token?: ExecTransportToken;
189
+ adapterVersion?: string;
190
+ /** Rebuilds the adapter bound to a pinned executable (constructor `target`). */
191
+ withTarget?: (target: LaunchTarget) => ExecAdapter;
192
+ }
193
+ /**
194
+ * A control adapter registers itself with data, never by the core importing
195
+ * adapter internals: verdicts, versions, and evidence source are supplied here.
196
+ */
197
+ interface ControlAdapterRegistration {
198
+ token: ControlTransportToken;
199
+ provider: ProviderId;
200
+ packageName: string;
201
+ adapterVersion: string;
202
+ capabilityVerdicts: Readonly<Record<string, SupportLevel>>;
203
+ evidenceSource: CapabilityEvidenceSource;
204
+ sdkVersion?: string;
205
+ protocolVersion?: string;
206
+ /**
207
+ * Opens a live control session. A registration may advertise verdicts for
208
+ * discovery without shipping one; `openSession` then fails with a typed
209
+ * error naming the gap rather than pretending the transport is usable.
210
+ */
211
+ createSession?: ControlSessionFactory;
212
+ }
213
+ declare function controlSessionUnavailableMessage(provider: ProviderId): string;
214
+ declare function controlUnavailableMessage(provider: ProviderId): string;
215
+ declare class AdapterRegistry {
216
+ #private;
217
+ registerExec(registration: ExecAdapterRegistration): void;
218
+ registerControl(registration: ControlAdapterRegistration): void;
219
+ execRegistration(provider: ProviderId): ExecAdapterRegistration | undefined;
220
+ control(provider: ProviderId): ControlAdapterRegistration | undefined;
221
+ requireControl(provider: ProviderId): ControlAdapterRegistration;
222
+ providers(): ProviderId[];
223
+ tokens(): TransportToken[];
224
+ }
225
+ interface ExperimentalGates {
226
+ control: boolean;
227
+ api: boolean;
228
+ }
229
+ /** Both gates default to false and neither implies the other. */
230
+ declare function experimentalGates(options: {
231
+ experimentalControl?: boolean;
232
+ experimentalApi?: boolean;
233
+ } | undefined): ExperimentalGates;
234
+ declare function assertExperimentalApiEnabled(gates: ExperimentalGates, provider: ProviderId): void;
235
+
236
+ interface ProviderRegistration {
237
+ apiVersion: 1;
238
+ id: ProviderId;
239
+ exec: ExecAdapterRegistration & {
240
+ token: string;
241
+ adapterVersion: string;
242
+ withTarget(target: LaunchTarget): ExecAdapter;
243
+ };
244
+ modelCatalog: readonly ModelInfo[];
245
+ resolveModel(nativeId: string): ModelInfo;
246
+ execCapabilities?: Readonly<Record<string, CapabilitySupport>>;
247
+ translateContext(requested?: ContextPolicy): ContextTranslation;
248
+ translatePermissions(requested: PermissionIntent, transport: TransportKind): PermissionTranslation;
249
+ validateOptions(options: Readonly<AgentOptions>, transport: TransportKind): void;
250
+ control?: ControlAdapterRegistration;
251
+ }
252
+
253
+ interface RuntimeOptions {
254
+ providers?: readonly ProviderRegistration[];
255
+ adapters?: ExecAdapter[];
256
+ controlAdapters?: ControlAdapterRegistration[];
257
+ /** Explicit required metadata capture; absent preserves ordinary standalone behavior. */
258
+ capture?: RuntimeCaptureOptions;
259
+ /**
260
+ * Memory for every Agent built on this Runtime, unless the Agent sets its own `memory` or
261
+ * `memory: false`. `scope` runs once per Agent (and once per candidate model when routing
262
+ * digests a definition); the rest is validated when each Agent is built.
263
+ */
264
+ memory?: RuntimeMemoryDefault;
265
+ }
266
+ declare class Runtime {
267
+ #private;
268
+ constructor(options?: RuntimeOptions);
269
+ get registry(): AdapterRegistry;
270
+ bindLogCapture(): AgentLogCaptureBinding | undefined;
271
+ /** The memory every Agent of this Runtime gets unless it says otherwise. */
272
+ memoryDefault(): RuntimeMemoryDefault | undefined;
273
+ registration(provider: ProviderId): ProviderRegistration;
274
+ resolveModel(requested: string): ModelInfo;
275
+ models(provider?: ProviderId): Promise<ModelInfo[]>;
276
+ adapter(provider: ProviderId): ExecAdapter;
277
+ adapterWithTarget(provider: ProviderId, target: LaunchTarget): ExecAdapter;
278
+ controlRegistration(provider: ProviderId): ControlAdapterRegistration | undefined;
279
+ providers(): ProviderId[];
280
+ }
281
+ declare const defaultRuntime: Runtime;
282
+
283
+ export { AdapterRegistry as A, type BrokerBinding as B, type ControlSessionHandle as C, translatePermissions as D, EXEC_TRANSPORT_TOKENS as E, InteractionBroker as I, type ProviderRegistration as P, Runtime as R, type TransportToken as T, type ControlAdapterRegistration as a, type BrokerDecision as b, CONTROL_TRANSPORTS as c, type ContextTranslation as d, type ControlForkRequest as e, type ControlSessionFactory as f, type ControlSessionRequest as g, type ControlSessionState as h, type ControlTransportToken as i, type ControlTurnHandle as j, type ControlTurnRequest as k, type ExecAdapterRegistration as l, type ExecTransportToken as m, type ExperimentalGates as n, type InteractionHandle as o, type PermissionTranslation as p, RUNTIME_ADAPTER_VERSION as q, type RuntimeOptions as r, assertExperimentalApiEnabled as s, controlSessionUnavailableMessage as t, controlUnavailableMessage as u, defaultRuntime as v, experimentalGates as w, normalizeContextPolicy as x, toBrokerResponse as y, translateContext as z };
@@ -0,0 +1,19 @@
1
+ import {
2
+ Runtime,
3
+ defaultRuntime
4
+ } from "./chunk-2RK74GCA.js";
5
+ import "./chunk-J7VAYJKM.js";
6
+ import "./chunk-G6JV7WV6.js";
7
+ import "./chunk-6FIXXWNM.js";
8
+ import "./chunk-TWGEYWMO.js";
9
+ import "./chunk-GS5U3KUN.js";
10
+ import "./chunk-EEUYQFCP.js";
11
+ import "./chunk-RX3XZENU.js";
12
+ import "./chunk-7LDQKJKI.js";
13
+ import "./chunk-NCNSHOF7.js";
14
+ import "./chunk-TG7NTMTR.js";
15
+ export {
16
+ Runtime,
17
+ defaultRuntime
18
+ };
19
+ //# sourceMappingURL=runtime-OISPXS4I.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,78 @@
1
+ import { L as LogPosition, a as LogDraft, P as PayloadReference, R as RunIdentity } from './types-BB7KqceP.js';
2
+
3
+ interface LogSourceDescriptor {
4
+ readonly format: 1;
5
+ readonly sourceId: string;
6
+ readonly systemId: string;
7
+ }
8
+ interface LogEntry extends LogPosition {
9
+ readonly format: 1;
10
+ readonly requestId: string;
11
+ readonly ordinal: number;
12
+ readonly previousDigest: string;
13
+ readonly record: LogDraft;
14
+ }
15
+ /** Trusted content verification only. This port grants no execution or retention authority. */
16
+ interface LogPayloadVerifier {
17
+ verify(reference: PayloadReference, options?: {
18
+ signal?: AbortSignal;
19
+ }): Promise<{
20
+ readonly kind: 'verified' | 'missing' | 'corrupt';
21
+ readonly reference: PayloadReference;
22
+ }>;
23
+ }
24
+ interface LogStoreOptions {
25
+ readonly databasePath: string;
26
+ readonly systemId: string;
27
+ readonly busyTimeoutMs?: number;
28
+ readonly maxPending?: number;
29
+ readonly supportedSchemas?: readonly Readonly<{
30
+ id: string;
31
+ version: number;
32
+ }>[];
33
+ readonly payloadVerifier?: LogPayloadVerifier;
34
+ }
35
+ /** A cursor is private DATA, neither a capability nor an independent whole-history proof. */
36
+ interface LogCursor {
37
+ readonly format: 1;
38
+ readonly filterDigest: string;
39
+ readonly after: LogPosition;
40
+ readonly through: LogPosition;
41
+ }
42
+ interface LogQuery {
43
+ readonly generation?: number;
44
+ readonly runId?: string;
45
+ readonly agentId?: string;
46
+ readonly limit?: number;
47
+ readonly cursor?: LogCursor;
48
+ }
49
+ interface LogPage {
50
+ readonly source: LogSourceDescriptor;
51
+ readonly through: LogPosition;
52
+ readonly items: readonly LogEntry[];
53
+ readonly scanned: number;
54
+ readonly nextCursor?: LogCursor;
55
+ }
56
+ type ReconstructionIssue = 'RUN_NOT_FOUND' | 'UNKNOWN_SCHEMA' | 'UNRESOLVED_CAUSAL_REFERENCE' | 'PAYLOAD_UNVERIFIED' | 'PAYLOAD_MISSING' | 'PAYLOAD_CORRUPT' | 'LOG_CORRUPT';
57
+ /** Completeness refers ONLY to captured history at `through`, never operational resume or success. */
58
+ interface RunReconstruction {
59
+ readonly scope: 'captured-history';
60
+ readonly kind: 'complete' | 'incomplete' | 'corrupt';
61
+ readonly identity: RunIdentity;
62
+ readonly through?: LogPosition;
63
+ readonly eventCount: number;
64
+ readonly issues: readonly ReconstructionIssue[];
65
+ }
66
+ declare const prepared: unique symbol;
67
+ /** Opaque preverified DATA. Reusable only with its original binding after rollback/ACK loss. */
68
+ interface PreparedLogCommit {
69
+ readonly [prepared]: true;
70
+ }
71
+ type LogStoreErrorCode = 'INVALID_INPUT' | 'INTEGRITY' | 'STORAGE' | 'CLOSED' | 'BUSY' | 'REQUEST_CONFLICT' | 'PAYLOAD_UNAVAILABLE' | 'TRANSACTION_REQUIRED' | 'UNSUPPORTED_RUNTIME';
72
+ declare class LogStoreError extends Error {
73
+ readonly code: LogStoreErrorCode;
74
+ constructor(code: LogStoreErrorCode);
75
+ }
76
+ declare function isLogStoreError(value: unknown): value is LogStoreError;
77
+
78
+ export { type LogSourceDescriptor as L, type PreparedLogCommit as P, type RunReconstruction as R, type LogStoreOptions as a, type LogQuery as b, type LogPage as c, type LogCursor as d, type LogEntry as e, type LogPayloadVerifier as f, LogStoreError as g, type LogStoreErrorCode as h, type ReconstructionIssue as i, isLogStoreError as j };
@@ -0,0 +1,52 @@
1
+ type LogJsonValue = null | boolean | number | string | readonly LogJsonValue[] | {
2
+ readonly [key: string]: LogJsonValue;
3
+ };
4
+ interface LogPosition {
5
+ readonly sourceId: string;
6
+ readonly sequence: number;
7
+ readonly digest: string;
8
+ }
9
+ interface RunIdentity {
10
+ readonly systemId: string;
11
+ readonly generation: number;
12
+ readonly runId: string;
13
+ readonly agentId: string;
14
+ readonly harness: Readonly<{
15
+ id: string;
16
+ version: string;
17
+ digest: string;
18
+ }>;
19
+ }
20
+ interface PayloadReference {
21
+ readonly sourceId: string;
22
+ readonly systemId: string;
23
+ readonly generation: number;
24
+ readonly digest: string;
25
+ readonly bytes: number;
26
+ readonly mediaType: 'application/json' | 'application/octet-stream';
27
+ }
28
+ interface LogDraft {
29
+ readonly identity: RunIdentity;
30
+ readonly schema: Readonly<{
31
+ id: string;
32
+ version: number;
33
+ }>;
34
+ readonly type: string;
35
+ readonly causal: readonly LogPosition[];
36
+ readonly payload: Readonly<{
37
+ inline: LogJsonValue;
38
+ }> | Readonly<{
39
+ artifact: PayloadReference;
40
+ }>;
41
+ }
42
+ interface LogCommit {
43
+ readonly requestId: string;
44
+ readonly records: readonly LogDraft[];
45
+ }
46
+ interface LogReceipt {
47
+ readonly first: LogPosition;
48
+ readonly head: LogPosition;
49
+ readonly count: number;
50
+ }
51
+
52
+ export type { LogPosition as L, PayloadReference as P, RunIdentity as R, LogDraft as a, LogReceipt as b, LogCommit as c, LogJsonValue as d };
@@ -0,0 +1,86 @@
1
+ import { b as TransportKind, c as AuthStatus, d as AgentOptions } from './types-DTFc1qO6.js';
2
+ import { R as Runtime } from './runtime-BSjrnxeF.js';
3
+
4
+ interface RoutingTask {
5
+ id: string;
6
+ version: string;
7
+ inputDigest: string;
8
+ tags?: readonly string[];
9
+ }
10
+ interface RoutingRule {
11
+ id: string;
12
+ allTags: readonly string[];
13
+ models: readonly string[];
14
+ }
15
+ interface AutoModelSelection {
16
+ mode: 'auto';
17
+ candidates?: readonly string[];
18
+ providers?: readonly string[];
19
+ allowUnverifiedModels?: boolean;
20
+ allowUnknownAuth?: boolean;
21
+ rules?: readonly RoutingRule[];
22
+ fallback?: string;
23
+ }
24
+ type RoutingAgentDefinition = Omit<AgentOptions, 'model'> & {
25
+ model: string | AutoModelSelection;
26
+ };
27
+ interface CreateAgentContext {
28
+ runtime: Runtime;
29
+ receipts: RoutingReceiptStore;
30
+ id?: string;
31
+ task?: RoutingTask;
32
+ sourceDigest?: string;
33
+ signal?: AbortSignal;
34
+ timeoutMs?: number;
35
+ }
36
+ type RoutingCandidateCode = 'READY' | 'NOT_NEEDED' | 'NOT_IN_RULE' | 'PROVIDER_NOT_ALLOWED' | 'MODEL_UNAVAILABLE' | 'MODEL_UNVERIFIED' | 'CLI_MISSING' | 'AUTH_REQUIRED' | 'AUTH_UNKNOWN' | 'SUBSCRIPTION_REQUIRED' | 'CLI_UNSUPPORTED' | 'POLICY_UNSUPPORTED' | 'PROBE_FAILED' | 'ABORTED' | 'TIMEOUT';
37
+ interface RoutingCandidate {
38
+ model: string;
39
+ provider: string;
40
+ modelId: string;
41
+ status: 'eligible' | 'excluded' | 'not-evaluated';
42
+ code: RoutingCandidateCode;
43
+ transport?: TransportKind;
44
+ fingerprintDigest?: string;
45
+ authState?: 'authenticated' | 'not-authenticated' | 'unknown';
46
+ authSource?: AuthStatus['source'];
47
+ }
48
+ interface RoutingSelected {
49
+ model: string;
50
+ provider: string;
51
+ modelId: string;
52
+ transport: TransportKind;
53
+ fingerprintDigest: string;
54
+ }
55
+ interface RoutingReceipt {
56
+ format: 1;
57
+ purpose: 'selection-proposal';
58
+ id: string;
59
+ createdAt: number;
60
+ configDigest: string;
61
+ taskDigest: string;
62
+ sourceDigest?: string;
63
+ policy: {
64
+ mode: 'fixed' | 'auto';
65
+ version: 'priority-v1';
66
+ ruleId?: string;
67
+ };
68
+ decision: 'selected' | 'abstained';
69
+ reason: 'FIXED' | 'PRIORITY' | 'RULE' | 'FALLBACK' | 'NO_CANDIDATES' | 'NO_ELIGIBLE_CANDIDATE' | 'NO_MATCHING_RULE' | 'ABORTED' | 'TIMEOUT';
70
+ candidates: readonly RoutingCandidate[];
71
+ nativeDispatches: 0;
72
+ selected?: RoutingSelected;
73
+ digest: string;
74
+ }
75
+ /** Implementations must atomically reject every existing ID, including identical proposals. */
76
+ interface RoutingReceiptStore {
77
+ save(receipt: RoutingReceipt): Promise<void>;
78
+ load(id: string): Promise<RoutingReceipt | undefined>;
79
+ }
80
+ declare class RoutingSelectionError extends Error {
81
+ readonly code: 'NO_ROUTE' | 'ABORTED' | 'TIMEOUT';
82
+ readonly receipt: RoutingReceipt;
83
+ constructor(code: 'NO_ROUTE' | 'ABORTED' | 'TIMEOUT', receipt: RoutingReceipt);
84
+ }
85
+
86
+ export { type AutoModelSelection as A, type CreateAgentContext as C, type RoutingAgentDefinition as R, type RoutingReceipt as a, type RoutingReceiptStore as b, type RoutingCandidate as c, type RoutingCandidateCode as d, type RoutingRule as e, type RoutingSelected as f, RoutingSelectionError as g, type RoutingTask as h };