@voltro/ai 0.84.0 → 0.86.0

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 (61) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +5 -151
  3. package/dist/agent.d.ts +34 -41
  4. package/dist/agent.js +64 -2
  5. package/dist/agentConstants.js +4 -0
  6. package/dist/agentExecutor.js +51 -0
  7. package/dist/api.js +199 -0
  8. package/dist/appTools.js +80 -0
  9. package/dist/budget.js +201 -0
  10. package/dist/callEvidence.js +51 -0
  11. package/dist/copilot.js +126 -0
  12. package/dist/cost.js +242 -0
  13. package/dist/embed.js +41 -0
  14. package/dist/embeddingProvider.js +51 -0
  15. package/dist/eval.js +130 -0
  16. package/dist/events.d.ts +171 -168
  17. package/dist/events.js +81 -2
  18. package/dist/executableModalities.js +13 -0
  19. package/dist/gateway.js +58 -0
  20. package/dist/gatewayCatalog.js +47 -0
  21. package/dist/gatewayMedia.js +88 -0
  22. package/dist/index.d.ts +328 -326
  23. package/dist/index.js +42 -2581
  24. package/dist/inferenceDispatch.js +493 -0
  25. package/dist/inferenceQueue.js +96 -0
  26. package/dist/jsonOutputValidation.js +27 -0
  27. package/dist/mcpClient.js +332 -0
  28. package/dist/mcpTools.js +80 -0
  29. package/dist/media.js +182 -0
  30. package/dist/mediaBytes.js +19 -0
  31. package/dist/mediaCall.js +13 -0
  32. package/dist/mediaTaskProvider.js +16 -0
  33. package/dist/middleware.js +32 -0
  34. package/dist/observe.js +52 -0
  35. package/dist/prompts.js +103 -0
  36. package/dist/provider.js +303 -0
  37. package/dist/realtimeEvent.js +97 -0
  38. package/dist/realtimeSession.js +154 -0
  39. package/dist/rerank.js +61 -0
  40. package/dist/resumableStream.js +321 -0
  41. package/dist/retrieveReranked.js +16 -0
  42. package/dist/runAndPersist.js +148 -0
  43. package/dist/semanticCache.js +66 -0
  44. package/dist/speechProvider.js +16 -0
  45. package/dist/streamRegistry.js +14 -0
  46. package/dist/streamText.js +170 -0
  47. package/dist/streamTranscribe.js +74 -0
  48. package/dist/streamWakeups.js +44 -0
  49. package/dist/structuredEvidence.js +48 -0
  50. package/dist/test.js +1 -1
  51. package/dist/threads.js +92 -0
  52. package/dist/tools.js +68 -0
  53. package/dist/transcribe.js +64 -0
  54. package/dist/transcriptionEvent.js +46 -0
  55. package/dist/workflow.d.ts +12 -10
  56. package/dist/workflow.js +117 -112
  57. package/package.json +6 -6
  58. package/dist/agentDescriptor-DuxvWGDi.js +0 -63
  59. package/dist/agentEvent-BuXA7sRt.js +0 -152
  60. package/dist/inferenceQueue-BmtEm3YI.js +0 -1061
  61. package/dist/provider-BnemgE4D.js +0 -409
package/dist/index.d.ts CHANGED
@@ -21,7 +21,6 @@ import { PluginMediaPersistCapability } from '@voltro/protocol';
21
21
  import { PluginMediaPersistMetadata } from '@voltro/protocol';
22
22
  import { QueryDescriptor } from '@voltro/database';
23
23
  import { QueryProcedureDescriptor } from '@voltro/protocol';
24
- import { Runtime } from 'effect';
25
24
  import { Schema } from 'effect';
26
25
  import { SchemaTable } from '@voltro/database';
27
26
  import { SemanticCacheShape } from '@voltro/cache';
@@ -81,7 +80,7 @@ export declare const agentActor: (subjectId: string | null) => {
81
80
  readonly via: "agent";
82
81
  };
83
82
 
84
- export declare interface AgentDescriptor<S extends Schema.Schema.Any = DefaultAgentInputSchema> {
83
+ export declare interface AgentDescriptor<S extends Schema.Top = DefaultAgentInputSchema> {
85
84
  readonly _brand: typeof AGENT_DESCRIPTOR_BRAND;
86
85
  /** Wire id → rpc tags `<name>.send` / `<name>.messages`. */
87
86
  readonly name: string;
@@ -94,69 +93,71 @@ export declare interface AgentDescriptor<S extends Schema.Schema.Any = DefaultAg
94
93
  }
95
94
 
96
95
  /** Error taxonomy. `retryable` on the event drives client/agent retry. */
97
- export declare const AgentErrorCode: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
96
+ export declare const AgentErrorCode: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
98
97
 
99
98
  export declare type AgentErrorCode = typeof AgentErrorCode.Type;
100
99
 
101
- export declare const AgentEvent: Schema.Union<[Schema.Struct<{
102
- _tag: Schema.Literal<["token"]>;
103
- text: typeof Schema.String;
100
+ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
101
+ readonly _tag: Schema.Literal<"token">;
102
+ readonly text: Schema.String;
104
103
  }>, Schema.Struct<{
105
- _tag: Schema.Literal<["reasoning"]>;
106
- text: typeof Schema.String;
104
+ readonly _tag: Schema.Literal<"reasoning">;
105
+ readonly text: Schema.String;
107
106
  }>, Schema.Struct<{
108
- _tag: Schema.Literal<["toolCall"]>;
109
- id: typeof Schema.String;
110
- name: typeof Schema.String;
111
- input: typeof Schema.Unknown;
107
+ readonly _tag: Schema.Literal<"toolCall">;
108
+ readonly id: Schema.String;
109
+ readonly name: Schema.String;
110
+ readonly input: Schema.Unknown;
111
+ /** Present when the caller must execute this pending call. */
112
+ readonly execution: Schema.optional<Schema.Literal<"client">>;
112
113
  }>, Schema.Struct<{
113
- _tag: Schema.Literal<["toolResult"]>;
114
- id: typeof Schema.String;
115
- name: typeof Schema.String;
116
- output: Schema.optional<typeof Schema.Unknown>;
117
- error: Schema.optional<typeof Schema.String>;
114
+ readonly _tag: Schema.Literal<"toolResult">;
115
+ readonly id: Schema.String;
116
+ readonly name: Schema.String;
117
+ readonly output: Schema.optional<Schema.Unknown>;
118
+ readonly error: Schema.optional<Schema.String>;
118
119
  }>, Schema.Struct<{
119
- _tag: Schema.Literal<["source"]>;
120
- sourceType: Schema.Literal<["url", "document"]>;
121
- id: typeof Schema.String;
122
- url: Schema.optional<typeof Schema.String>;
123
- title: Schema.optional<typeof Schema.String>;
124
- mediaType: Schema.optional<typeof Schema.String>;
125
- filename: Schema.optional<typeof Schema.String>;
120
+ readonly _tag: Schema.Literal<"source">;
121
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
122
+ readonly id: Schema.String;
123
+ readonly url: Schema.optional<Schema.String>;
124
+ readonly title: Schema.optional<Schema.String>;
125
+ readonly mediaType: Schema.optional<Schema.String>;
126
+ readonly filename: Schema.optional<Schema.String>;
126
127
  /** Provider-owned citation attribution; not normalized or interpreted. */
127
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
128
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
128
129
  }>, Schema.Struct<{
129
- _tag: Schema.Literal<["file"]>;
130
- mediaType: typeof Schema.String;
131
- data: typeof Schema.String;
130
+ readonly _tag: Schema.Literal<"file">;
131
+ readonly mediaType: Schema.String;
132
+ readonly data: Schema.String;
132
133
  /** Metadata for this file, not the whole model step. */
133
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
134
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
134
135
  }>, Schema.Struct<{
135
- _tag: Schema.Literal<["stepMetadata"]>;
136
- step: Schema.filter<typeof Schema.Int>;
137
- providerMetadata: typeof Schema.Unknown;
136
+ readonly _tag: Schema.Literal<"stepMetadata">;
137
+ readonly step: Schema.Int;
138
+ readonly providerMetadata: Schema.Unknown;
138
139
  }>, Schema.Struct<{
139
- _tag: Schema.Literal<["message"]>;
140
- role: typeof Schema.String;
141
- content: typeof Schema.String;
140
+ readonly _tag: Schema.Literal<"message">;
141
+ readonly role: Schema.String;
142
+ readonly content: Schema.String;
142
143
  }>, Schema.Struct<{
143
- _tag: Schema.Literal<["error"]>;
144
- code: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
145
- message: typeof Schema.String;
146
- retryable: typeof Schema.Boolean;
144
+ readonly _tag: Schema.Literal<"error">;
145
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
146
+ readonly message: Schema.String;
147
+ readonly retryable: Schema.Boolean;
147
148
  }>, Schema.Struct<{
148
- _tag: Schema.Literal<["done"]>;
149
- finishReason: typeof Schema.String;
150
- usage: Schema.Struct<{
151
- inputTokens: Schema.optional<typeof Schema.Number>;
152
- outputTokens: Schema.optional<typeof Schema.Number>;
153
- totalTokens: Schema.optional<typeof Schema.Number>;
149
+ readonly _tag: Schema.Literal<"done">;
150
+ readonly finishReason: Schema.String;
151
+ readonly usage: Schema.Struct<{
152
+ readonly inputTokens: Schema.optional<Schema.Number>;
153
+ readonly outputTokens: Schema.optional<Schema.Number>;
154
+ readonly totalTokens: Schema.optional<Schema.Number>;
154
155
  }>;
155
156
  }>]>;
156
157
 
157
158
  export declare type AgentEvent = typeof AgentEvent.Type;
158
159
 
159
- export declare interface AgentExecutor<S extends Schema.Schema.Any = DefaultAgentInputSchema> {
160
+ export declare interface AgentExecutor<S extends Schema.Top = DefaultAgentInputSchema> {
160
161
  readonly _brand: typeof EXECUTOR_BRAND;
161
162
  readonly descriptor: AgentDescriptor<S>;
162
163
  readonly config: AgentExecutorConfig<AgentInput<S>>;
@@ -202,10 +203,10 @@ export declare interface AgentExecutorConfig<Input = {
202
203
  }
203
204
 
204
205
  /** The decoded input an agent's executor sees, derived from its schema. */
205
- export declare type AgentInput<S extends Schema.Schema.Any> = Schema.Schema.Type<S>;
206
+ export declare type AgentInput<S extends Schema.Top> = Schema.Schema.Type<S>;
206
207
 
207
208
  /** The agent's input schema (default `{ prompt: string }`). */
208
- export declare const agentInputSchema: (desc: AnyAgentDescriptor) => Schema.Schema.Any;
209
+ export declare const agentInputSchema: (desc: AnyAgentDescriptor) => Schema.Top;
209
210
 
210
211
  export declare interface AgentMessage {
211
212
  readonly id: string;
@@ -223,19 +224,16 @@ export declare interface AgentMessage {
223
224
  export declare type AgentMessageRole = 'user' | 'assistant' | 'system' | 'tool';
224
225
 
225
226
  export declare const agentMessageSchema: Schema.Struct<{
226
- id: typeof Schema.String;
227
- threadId: typeof Schema.String;
228
- role: typeof Schema.String;
229
- content: typeof Schema.String;
230
- streaming: typeof Schema.Boolean;
231
- order: typeof Schema.Number;
232
- stepOrder: typeof Schema.Number;
233
- parts: Schema.Array$<Schema.TypeLiteral<{
234
- type: typeof Schema.String;
235
- }, readonly [{
236
- readonly key: typeof Schema.String;
237
- readonly value: typeof Schema.Unknown;
238
- }]>>;
227
+ readonly id: Schema.String;
228
+ readonly threadId: Schema.String;
229
+ readonly role: Schema.String;
230
+ readonly content: Schema.String;
231
+ readonly streaming: Schema.Boolean;
232
+ readonly order: Schema.Number;
233
+ readonly stepOrder: Schema.Number;
234
+ readonly parts: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
235
+ readonly type: Schema.String;
236
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
239
237
  }>;
240
238
 
241
239
  export declare const agentMessagesTable: Table<typeof AGENT_MESSAGES_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
@@ -246,25 +244,22 @@ export declare const agentMessagesTable: Table<typeof AGENT_MESSAGES_TABLE, Reco
246
244
  * so "what the server serves" and "what the client is typed for" can't drift.
247
245
  */
248
246
  export declare const agentRouteDescriptors: (desc: AnyAgentDescriptor) => {
249
- send: ActionProcedureDescriptor<`${string}.send`, Schema.Schema.Any, Schema.Struct<{
250
- text: typeof Schema.String;
247
+ send: ActionProcedureDescriptor<`${string}.send`, Schema.Top, Schema.Struct<{
248
+ readonly text: Schema.String;
251
249
  }>, typeof AgentThreadAccessDenied>;
252
250
  messages: QueryProcedureDescriptor<`${string}.messages`, Schema.Struct<{
253
- threadId: typeof Schema.String;
254
- }>, Schema.Array$<Schema.Struct<{
255
- id: typeof Schema.String;
256
- threadId: typeof Schema.String;
257
- role: typeof Schema.String;
258
- content: typeof Schema.String;
259
- streaming: typeof Schema.Boolean;
260
- order: typeof Schema.Number;
261
- stepOrder: typeof Schema.Number;
262
- parts: Schema.Array$<Schema.TypeLiteral<{
263
- type: typeof Schema.String;
264
- }, readonly [{
265
- readonly key: typeof Schema.String;
266
- readonly value: typeof Schema.Unknown;
267
- }]>>;
251
+ readonly threadId: Schema.String;
252
+ }>, Schema.$Array<Schema.Struct<{
253
+ readonly id: Schema.String;
254
+ readonly threadId: Schema.String;
255
+ readonly role: Schema.String;
256
+ readonly content: Schema.String;
257
+ readonly streaming: Schema.Boolean;
258
+ readonly order: Schema.Number;
259
+ readonly stepOrder: Schema.Number;
260
+ readonly parts: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
261
+ readonly type: Schema.String;
262
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
268
263
  }>>, typeof AgentThreadAccessDenied>;
269
264
  };
270
265
 
@@ -293,11 +288,9 @@ export declare class AgentThreadAccessDenied extends AgentThreadAccessDenied_bas
293
288
  get message(): string;
294
289
  }
295
290
 
296
- declare const AgentThreadAccessDenied_base: Schema.TaggedErrorClass<AgentThreadAccessDenied, "AgentThreadAccessDenied", {
297
- readonly _tag: Schema.tag<"AgentThreadAccessDenied">;
298
- } & {
299
- threadId: typeof Schema.String;
300
- }>;
291
+ declare const AgentThreadAccessDenied_base: Schema.Class<AgentThreadAccessDenied, Schema.TaggedStruct<"AgentThreadAccessDenied", {
292
+ readonly threadId: Schema.String;
293
+ }>, YieldableError>;
301
294
 
302
295
  export declare const agentThreadsTable: Table<typeof AGENT_THREADS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
303
296
 
@@ -315,25 +308,21 @@ export declare type AiBudgetError = AiBudgetExceeded | AiBudgetInvalidInput | Ai
315
308
  export declare class AiBudgetExceeded extends AiBudgetExceeded_base {
316
309
  }
317
310
 
318
- declare const AiBudgetExceeded_base: Schema.TaggedErrorClass<AiBudgetExceeded, "AiBudgetExceeded", {
319
- readonly _tag: Schema.tag<"AiBudgetExceeded">;
320
- } & {
321
- tenantId: Schema.NullOr<typeof Schema.String>;
322
- limitUsd: typeof Schema.Number;
323
- spentUsd: typeof Schema.Number;
324
- attemptedUsd: typeof Schema.Number;
325
- }>;
311
+ declare const AiBudgetExceeded_base: Schema.Class<AiBudgetExceeded, Schema.TaggedStruct<"AiBudgetExceeded", {
312
+ readonly tenantId: Schema.NullOr<Schema.String>;
313
+ readonly limitUsd: Schema.Number;
314
+ readonly spentUsd: Schema.Number;
315
+ readonly attemptedUsd: Schema.Number;
316
+ }>, YieldableError>;
326
317
 
327
318
  /** Invalid caller configuration, without echoing the supplied value. */
328
319
  export declare class AiBudgetInvalidInput extends AiBudgetInvalidInput_base {
329
320
  }
330
321
 
331
- declare const AiBudgetInvalidInput_base: Schema.TaggedErrorClass<AiBudgetInvalidInput, "AiBudgetInvalidInput", {
332
- readonly _tag: Schema.tag<"AiBudgetInvalidInput">;
333
- } & {
334
- field: Schema.Literal<["limitUsd", "addUsd", "since", "reservationId", "tenantId"]>;
335
- message: typeof Schema.String;
336
- }>;
322
+ declare const AiBudgetInvalidInput_base: Schema.Class<AiBudgetInvalidInput, Schema.TaggedStruct<"AiBudgetInvalidInput", {
323
+ readonly field: Schema.Literals<readonly ["limitUsd", "addUsd", "since", "reservationId", "tenantId"]>;
324
+ readonly message: Schema.String;
325
+ }>, YieldableError>;
337
326
 
338
327
  export declare interface AiBudgetReservation {
339
328
  readonly reservationId: string;
@@ -346,12 +335,10 @@ export declare interface AiBudgetReservation {
346
335
  export declare class AiBudgetReservationConflict extends AiBudgetReservationConflict_base {
347
336
  }
348
337
 
349
- declare const AiBudgetReservationConflict_base: Schema.TaggedErrorClass<AiBudgetReservationConflict, "AiBudgetReservationConflict", {
350
- readonly _tag: Schema.tag<"AiBudgetReservationConflict">;
351
- } & {
352
- reason: Schema.Literal<["identity-bound", "already-released"]>;
353
- message: typeof Schema.String;
354
- }>;
338
+ declare const AiBudgetReservationConflict_base: Schema.Class<AiBudgetReservationConflict, Schema.TaggedStruct<"AiBudgetReservationConflict", {
339
+ readonly reason: Schema.Literals<readonly ["identity-bound", "already-released"]>;
340
+ readonly message: Schema.String;
341
+ }>, YieldableError>;
355
342
 
356
343
  /** Receipt and release tombstone. A receipt and its counter change commit together. */
357
344
  export declare const aiBudgetReservationsTable: Table<typeof AI_BUDGET_RESERVATIONS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
@@ -376,21 +363,21 @@ export declare type AiCallEvidence = typeof AiCallEvidenceSchema.Type;
376
363
  /** Allowlisted consumption evidence, never a provider response or SDK error.
377
364
  * Completeness describes the three token counters, not billing completeness. */
378
365
  export declare const AiCallEvidenceSchema: Schema.Struct<{
379
- provider: typeof Schema.String;
380
- model: typeof Schema.String;
381
- usage: Schema.Struct<{
382
- inputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
383
- outputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
384
- totalTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
385
- completeness: Schema.Literal<["complete", "partial", "unknown"]>;
366
+ readonly provider: Schema.String;
367
+ readonly model: Schema.String;
368
+ readonly usage: Schema.Struct<{
369
+ readonly inputTokens: Schema.optional<Schema.Number>;
370
+ readonly outputTokens: Schema.optional<Schema.Number>;
371
+ readonly totalTokens: Schema.optional<Schema.Number>;
372
+ readonly completeness: Schema.Literals<readonly ["complete", "partial", "unknown"]>;
386
373
  }>;
387
- cost: Schema.Union<[Schema.Struct<{
388
- status: Schema.Literal<["actual"]>;
389
- source: Schema.Literal<["gateway"]>;
390
- usd: Schema.filter<Schema.filter<typeof Schema.Number>>;
374
+ readonly cost: Schema.Union<readonly [Schema.Struct<{
375
+ readonly status: Schema.Literal<"actual">;
376
+ readonly source: Schema.Literal<"gateway">;
377
+ readonly usd: Schema.Number;
391
378
  }>, Schema.Struct<{
392
- status: Schema.Literal<["unknown"]>;
393
- source: Schema.Literal<["unreported"]>;
379
+ readonly status: Schema.Literal<"unknown">;
380
+ readonly source: Schema.Literal<"unreported">;
394
381
  }>]>;
395
382
  }>;
396
383
 
@@ -411,30 +398,28 @@ export declare interface AiCallLog {
411
398
  export declare class AiError extends AiError_base {
412
399
  }
413
400
 
414
- declare const AiError_base: Schema.TaggedErrorClass<AiError, "AiError", {
415
- readonly _tag: Schema.tag<"AiError">;
416
- } & {
417
- reason: Schema.Literal<["generation", "decode"]>;
418
- message: typeof Schema.String;
419
- evidence: Schema.optional<Schema.Struct<{
420
- provider: typeof Schema.String;
421
- model: typeof Schema.String;
422
- usage: Schema.Struct<{
423
- inputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
424
- outputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
425
- totalTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
426
- completeness: Schema.Literal<["complete", "partial", "unknown"]>;
401
+ declare const AiError_base: Schema.Class<AiError, Schema.TaggedStruct<"AiError", {
402
+ readonly reason: Schema.Literals<readonly ["generation", "decode"]>;
403
+ readonly message: Schema.String;
404
+ readonly evidence: Schema.optional<Schema.Struct<{
405
+ readonly provider: Schema.String;
406
+ readonly model: Schema.String;
407
+ readonly usage: Schema.Struct<{
408
+ readonly inputTokens: Schema.optional<Schema.Number>;
409
+ readonly outputTokens: Schema.optional<Schema.Number>;
410
+ readonly totalTokens: Schema.optional<Schema.Number>;
411
+ readonly completeness: Schema.Literals<readonly ["complete", "partial", "unknown"]>;
427
412
  }>;
428
- cost: Schema.Union<[Schema.Struct<{
429
- status: Schema.Literal<["actual"]>;
430
- source: Schema.Literal<["gateway"]>;
431
- usd: Schema.filter<Schema.filter<typeof Schema.Number>>;
413
+ readonly cost: Schema.Union<readonly [Schema.Struct<{
414
+ readonly status: Schema.Literal<"actual">;
415
+ readonly source: Schema.Literal<"gateway">;
416
+ readonly usd: Schema.Number;
432
417
  }>, Schema.Struct<{
433
- status: Schema.Literal<["unknown"]>;
434
- source: Schema.Literal<["unreported"]>;
418
+ readonly status: Schema.Literal<"unknown">;
419
+ readonly source: Schema.Literal<"unreported">;
435
420
  }>]>;
436
421
  }>>;
437
- }>;
422
+ }>, YieldableError>;
438
423
 
439
424
  /**
440
425
  * The one way a CAUGHT provider failure becomes an `AiError`.
@@ -495,7 +480,7 @@ export declare type AiProviderOptions = Record<string, Record<string, AiJsonValu
495
480
  export declare class AiService extends AiService_base {
496
481
  }
497
482
 
498
- declare const AiService_base: Context.TagClass<AiService, "@voltro/AiService", AiServiceImpl>;
483
+ declare const AiService_base: Context.ServiceClass<AiService, "@voltro/AiService", AiServiceImpl>;
499
484
 
500
485
  export declare interface AiServiceImpl {
501
486
  readonly generateText: (options: GenerateTextOptions) => Effect.Effect<GenerateTextResult, AiError>;
@@ -618,10 +603,10 @@ export declare const aiUsageTable: Table<typeof AI_USAGE_TABLE, Record<string, C
618
603
  export declare type AnthropicModel = 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001' | (string & {});
619
604
 
620
605
  /** A descriptor of any input shape — for the type-erased runtime helpers. */
621
- export declare type AnyAgentDescriptor = AgentDescriptor<Schema.Schema.Any>;
606
+ export declare type AnyAgentDescriptor = AgentDescriptor<Schema.Top>;
622
607
 
623
608
  /** An executor of any input shape — for the type-erased runtime helpers. */
624
- export declare type AnyAgentExecutor = AgentExecutor<Schema.Schema.Any>;
609
+ export declare type AnyAgentExecutor = AgentExecutor<Schema.Top>;
625
610
 
626
611
  /** A heterogeneous tool — the shape `buildSdkTools` / `runAssistant` consume.
627
612
  * `defineTool` keeps full input typing on its `execute`/`handler` body, then
@@ -631,13 +616,15 @@ export declare type AnyAgentExecutor = AgentExecutor<Schema.Schema.Any>;
631
616
  export declare interface AnyTool {
632
617
  readonly name: string;
633
618
  readonly description: string;
634
- readonly input: Schema.Schema.Any;
619
+ readonly input: Schema.Top;
635
620
  /** See `ToolDef.inputJsonSchema` — a foreign parameter schema shown to the
636
621
  * model in place of a rendered `input`. */
637
622
  readonly inputJsonSchema?: Record<string, unknown>;
638
- readonly output?: Schema.Schema.Any;
623
+ readonly output?: Schema.Top;
639
624
  readonly execute?: (input: never) => Effect.Effect<unknown, never, unknown>;
640
625
  readonly handler?: ToolHandler<never, unknown>;
626
+ /** Client tools return a pending call to the caller; never run on the server. */
627
+ readonly execution?: 'server' | 'client';
641
628
  readonly timeoutMs?: number;
642
629
  }
643
630
 
@@ -726,8 +713,8 @@ export declare const appToolDecision: (descriptor: AppToolDescriptor, policy: Ap
726
713
  export declare interface AppToolDescriptor {
727
714
  readonly kind: 'query' | 'mutation' | 'action' | string;
728
715
  readonly name: string;
729
- readonly input: Schema.Schema.Any;
730
- readonly output?: Schema.Schema.Any;
716
+ readonly input: Schema.Top;
717
+ readonly output?: Schema.Top;
731
718
  readonly exposeAsTool?: ExposeAsToolLike;
732
719
  /**
733
720
  * Presence of the descriptor's `requiresApproval:` policy — read as a BOOLEAN
@@ -840,6 +827,9 @@ export declare interface ConsumeOptions {
840
827
  readonly fromSeq?: number;
841
828
  /** Tail poll interval in ms while the producer is still running (default 50). */
842
829
  readonly pollMs?: number;
830
+ /** Maximum idle polling interval. Default 1000ms. Local persisted appends
831
+ * wake consumers immediately; remote replicas are observed by polling. */
832
+ readonly maxPollMs?: number;
843
833
  /** End the consumer if no new event arrives for this long AND the producer
844
834
  * hasn't finished — a safety valve against a crashed producer that never
845
835
  * marked done. Default: undefined (wait indefinitely). */
@@ -890,21 +880,21 @@ export declare interface CopilotProposal {
890
880
  * `generateObject({ schema: CopilotProposalSchema })`). Mirrors
891
881
  * {@link CopilotProposal}. */
892
882
  export declare const CopilotProposalSchema: Schema.Struct<{
893
- table: typeof Schema.String;
894
- columns: Schema.optional<Schema.Array$<typeof Schema.String>>;
895
- filters: Schema.optional<Schema.Array$<Schema.Struct<{
896
- column: typeof Schema.String;
897
- op: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte", "contains", "in"]>;
898
- value: typeof Schema.Unknown;
883
+ readonly table: Schema.String;
884
+ readonly columns: Schema.optional<Schema.$Array<Schema.String>>;
885
+ readonly filters: Schema.optional<Schema.$Array<Schema.Struct<{
886
+ readonly column: Schema.String;
887
+ readonly op: Schema.Literals<readonly ["eq", "neq", "gt", "gte", "lt", "lte", "contains", "in"]>;
888
+ readonly value: Schema.Unknown;
899
889
  }>>>;
900
- orderBy: Schema.optional<Schema.Struct<{
901
- column: typeof Schema.String;
902
- direction: Schema.optional<Schema.Literal<["asc", "desc"]>>;
890
+ readonly orderBy: Schema.optional<Schema.Struct<{
891
+ readonly column: Schema.String;
892
+ readonly direction: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
903
893
  }>>;
904
- limit: Schema.optional<typeof Schema.Number>;
905
- aggregate: Schema.optional<Schema.Struct<{
906
- fn: Schema.Literal<["count", "sum", "avg", "min", "max"]>;
907
- column: Schema.optional<typeof Schema.String>;
894
+ readonly limit: Schema.optional<Schema.Number>;
895
+ readonly aggregate: Schema.optional<Schema.Struct<{
896
+ readonly fn: Schema.Literals<readonly ["count", "sum", "avg", "min", "max"]>;
897
+ readonly column: Schema.optional<Schema.String>;
908
898
  }>>;
909
899
  }>;
910
900
 
@@ -913,12 +903,10 @@ export declare const CopilotProposalSchema: Schema.Struct<{
913
903
  export declare class CopilotRejected extends CopilotRejected_base {
914
904
  }
915
905
 
916
- declare const CopilotRejected_base: Schema.TaggedErrorClass<CopilotRejected, "CopilotRejected", {
917
- readonly _tag: Schema.tag<"CopilotRejected">;
918
- } & {
919
- reason: Schema.Literal<["unknown-table", "unknown-column", "bad-op", "bad-aggregate", "empty"]>;
920
- detail: typeof Schema.String;
921
- }>;
906
+ declare const CopilotRejected_base: Schema.Class<CopilotRejected, Schema.TaggedStruct<"CopilotRejected", {
907
+ readonly reason: Schema.Literals<readonly ["unknown-table", "unknown-column", "bad-op", "bad-aggregate", "empty"]>;
908
+ readonly detail: Schema.String;
909
+ }>, YieldableError>;
922
910
 
923
911
  export declare interface CopilotSchema {
924
912
  readonly tables: ReadonlyArray<CopilotSchemaTable>;
@@ -1054,7 +1042,7 @@ export declare const DEFAULT_INFERENCE_POLL_MS = 250;
1054
1042
  export declare const DEFAULT_INFERENCE_RETENTION_HOURS: number;
1055
1043
 
1056
1044
  declare const DEFAULT_INPUT: Schema.Struct<{
1057
- prompt: typeof Schema.String;
1045
+ readonly prompt: Schema.String;
1058
1046
  }>;
1059
1047
 
1060
1048
  /** The default judge threshold when a judge is configured without one. */
@@ -1101,7 +1089,7 @@ export { defaultSettingsMiddleware }
1101
1089
  * })
1102
1090
  * ```
1103
1091
  */
1104
- export declare const defineAgent: <S extends Schema.Schema.Any = DefaultAgentInputSchema>(config: {
1092
+ export declare const defineAgent: <S extends Schema.Top = DefaultAgentInputSchema>(config: {
1105
1093
  readonly name: string;
1106
1094
  readonly input?: S;
1107
1095
  } & AgentAccessOptions) => AgentDescriptor<S>;
@@ -1123,7 +1111,7 @@ export declare const defineAgent: <S extends Schema.Schema.Any = DefaultAgentInp
1123
1111
  * })
1124
1112
  * ```
1125
1113
  */
1126
- export declare const defineAgentExecutor: <S extends Schema.Schema.Any = DefaultAgentInputSchema>(descriptor: AgentDescriptor<S>, config: AgentExecutorConfig<AgentInput<S>>) => AgentExecutor<S>;
1114
+ export declare const defineAgentExecutor: <S extends Schema.Top = DefaultAgentInputSchema>(descriptor: AgentDescriptor<S>, config: AgentExecutorConfig<AgentInput<S>>) => AgentExecutor<S>;
1127
1115
 
1128
1116
  export declare interface DefinedPrompt extends PromptDefinition {
1129
1117
  /** Content digest of `template` + `system`. The version. */
@@ -1185,11 +1173,13 @@ export declare const defineRealtimeSession: (options: RealtimeSessionOptions) =>
1185
1173
  export declare const defineTool: <A, I, O>(def: {
1186
1174
  readonly name: string;
1187
1175
  readonly description: string;
1188
- readonly input: Schema.Schema<A, I>;
1176
+ readonly input: Schema.Codec<A, I>;
1189
1177
  readonly inputJsonSchema?: Record<string, unknown>;
1190
- readonly output?: Schema.Schema.Any;
1178
+ readonly output?: Schema.Top;
1191
1179
  readonly execute?: (input: A) => Effect.Effect<O, never, unknown>;
1192
1180
  readonly handler?: ToolHandler<A, O>;
1181
+ /** Client tools return a pending call to the caller; never run on the server. */
1182
+ readonly execution?: "server" | "client";
1193
1183
  readonly timeoutMs?: number;
1194
1184
  }) => AnyTool;
1195
1185
 
@@ -1630,7 +1620,7 @@ export declare interface GenerateObjectOptions<A, I> {
1630
1620
  /** Effect Schema the model output must satisfy. Converted to JSON
1631
1621
  * Schema for the SDK, then decoded back through this schema so the
1632
1622
  * result carries branded types + refinements (not just JSON shape). */
1633
- readonly schema: Schema.Schema<A, I>;
1623
+ readonly schema: Schema.Codec<A, I>;
1634
1624
  readonly prompt: string;
1635
1625
  readonly system?: string;
1636
1626
  readonly provider?: ProviderConfig;
@@ -1683,7 +1673,7 @@ export declare interface GenerateObjectWithToolsOptions<A, I> {
1683
1673
  /** Effect Schema the FINAL object must satisfy. The model runs the tool
1684
1674
  * loop, then emits one object matching this schema; it is decoded back
1685
1675
  * through the schema so refinements/brands hold. */
1686
- readonly schema: Schema.Schema<A, I>;
1676
+ readonly schema: Schema.Codec<A, I>;
1687
1677
  readonly prompt: string;
1688
1678
  readonly system?: string;
1689
1679
  readonly provider?: ProviderConfig;
@@ -2205,14 +2195,12 @@ export declare const mcpCallTool: (transport: McpTransport, server: string, tool
2205
2195
  export declare class McpError extends McpError_base {
2206
2196
  }
2207
2197
 
2208
- declare const McpError_base: Schema.TaggedErrorClass<McpError, "McpError", {
2209
- readonly _tag: Schema.tag<"McpError">;
2210
- } & {
2198
+ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpError", {
2211
2199
  /** The app-chosen namespace of the server, never a server-supplied string. */
2212
- server: typeof Schema.String;
2213
- reason: Schema.Literal<["transport", "protocol", "bounds", "policy"]>;
2214
- message: typeof Schema.String;
2215
- }>;
2200
+ readonly server: Schema.String;
2201
+ readonly reason: Schema.Literals<readonly ["transport", "protocol", "bounds", "policy"]>;
2202
+ readonly message: Schema.String;
2203
+ }>, YieldableError>;
2216
2204
 
2217
2205
  /** The MCP handshake: `initialize`, then the `notifications/initialized` the
2218
2206
  * spec requires before any other request. */
@@ -2498,13 +2486,22 @@ export declare interface MediaUsage {
2498
2486
  readonly totalTokens: number | undefined;
2499
2487
  }
2500
2488
 
2501
- /**
2502
- * Single-process resumable-stream store. Holds each stream's log in memory —
2503
- * perfect for dev, tests, and single-node self-host. A multi-node deployment
2504
- * needs `dataStoreResumableStreamStore` (or a Redis backend) so every node
2505
- * shares the log and the producer election.
2506
- */
2507
- export declare const memoryResumableStreamStore: () => ResumableStreamStore;
2489
+ export declare interface MemoryResumableStreamOptions {
2490
+ /** Completed payload retention. Default seven days; active readers defer eviction. */
2491
+ readonly retentionMs?: number;
2492
+ /** Clock for retention; defaults to Date.now. */
2493
+ readonly now?: () => number;
2494
+ }
2495
+
2496
+ export declare interface MemoryResumableStreamStore extends ResumableStreamStore {
2497
+ /** Release payloads and election tombstones at the end of the owner's lifetime.
2498
+ * Stop producers/consumers first. A disposed store cannot be reused. */
2499
+ readonly dispose: Effect.Effect<void>;
2500
+ }
2501
+
2502
+ /** Single-process store. Completed payloads expire; election tombstones remain
2503
+ * until dispose so an expired replay cannot start a second paid producer. */
2504
+ export declare const memoryResumableStreamStore: (opts?: MemoryResumableStreamOptions) => MemoryResumableStreamStore;
2508
2505
 
2509
2506
  export declare type MessagePart = {
2510
2507
  readonly type: 'text';
@@ -2513,6 +2510,7 @@ export declare type MessagePart = {
2513
2510
  readonly type: 'tool';
2514
2511
  readonly toolCallId: string;
2515
2512
  readonly toolName: string;
2513
+ readonly execution?: 'client';
2516
2514
  /** 'input-available' once the model emitted args; 'output-available' once the tool ran. */
2517
2515
  readonly state: 'input-available' | 'output-available' | 'output-error';
2518
2516
  readonly input?: unknown;
@@ -2715,7 +2713,7 @@ export declare type OpenAIModel = 'gpt-5.5' | 'gpt-4o' | 'gpt-4o-mini' | (string
2715
2713
  /** The JSON Schema a `generateObject` output schema renders to. Exported
2716
2714
  * because an OFFLOADED inference has to store it: a JavaScript Schema object
2717
2715
  * cannot be journaled, and its JSON rendering can. */
2718
- export declare const outputJsonSchema: (schema: Schema.Schema.Any, fn: string) => Effect.Effect<Record<string, unknown>, AiError>;
2716
+ export declare const outputJsonSchema: (schema: Schema.Top, fn: string) => Effect.Effect<Record<string, unknown>, AiError>;
2719
2717
 
2720
2718
  /**
2721
2719
  * Pull the first JSON-RPC message out of a Streamable-HTTP response body.
@@ -2786,13 +2784,11 @@ export declare const promptDigest: (prompt: string) => string;
2786
2784
  export declare class PromptRenderError extends PromptRenderError_base {
2787
2785
  }
2788
2786
 
2789
- declare const PromptRenderError_base: Schema.TaggedErrorClass<PromptRenderError, "PromptRenderError", {
2790
- readonly _tag: Schema.tag<"PromptRenderError">;
2791
- } & {
2792
- promptId: typeof Schema.String;
2793
- missing: Schema.Array$<typeof Schema.String>;
2794
- message: typeof Schema.String;
2795
- }>;
2787
+ declare const PromptRenderError_base: Schema.Class<PromptRenderError, Schema.TaggedStruct<"PromptRenderError", {
2788
+ readonly promptId: Schema.String;
2789
+ readonly missing: Schema.$Array<Schema.String>;
2790
+ readonly message: Schema.String;
2791
+ }>, YieldableError>;
2796
2792
 
2797
2793
  export declare const PROMPTS_TABLE = "_voltro_prompts";
2798
2794
 
@@ -3072,81 +3068,81 @@ export declare interface ReadRecorder<S extends QueryableStore> {
3072
3068
 
3073
3069
  /** Browser-safe input allowlist. Session configuration and provider credentials
3074
3070
  * belong to the server, never to events received from the browser. */
3075
- export declare const RealtimeClientEvent: Schema.Union<[Schema.Struct<{
3076
- type: Schema.Literal<["input-audio-append"]>;
3077
- audio: Schema.filter<typeof Schema.String>;
3071
+ export declare const RealtimeClientEvent: Schema.Union<readonly [Schema.Struct<{
3072
+ readonly type: Schema.Literal<"input-audio-append">;
3073
+ readonly audio: Schema.String;
3078
3074
  }>, Schema.Struct<{
3079
- type: Schema.Literal<["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
3075
+ readonly type: Schema.Literals<readonly ["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
3080
3076
  }>, Schema.Struct<{
3081
- type: Schema.Literal<["conversation-item-create"]>;
3082
- item: Schema.Struct<{
3083
- type: Schema.Literal<["text-message"]>;
3084
- role: Schema.Literal<["user"]>;
3085
- text: typeof Schema.String;
3077
+ readonly type: Schema.Literal<"conversation-item-create">;
3078
+ readonly item: Schema.Struct<{
3079
+ readonly type: Schema.Literal<"text-message">;
3080
+ readonly role: Schema.Literal<"user">;
3081
+ readonly text: Schema.String;
3086
3082
  }>;
3087
3083
  }>, Schema.Struct<{
3088
- type: Schema.Literal<["conversation-item-truncate"]>;
3089
- itemId: typeof Schema.String;
3090
- contentIndex: Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>;
3091
- audioEndMs: Schema.filter<Schema.filter<typeof Schema.Number>>;
3084
+ readonly type: Schema.Literal<"conversation-item-truncate">;
3085
+ readonly itemId: Schema.String;
3086
+ readonly contentIndex: Schema.Number;
3087
+ readonly audioEndMs: Schema.Number;
3092
3088
  }>]>;
3093
3089
 
3094
3090
  export declare type RealtimeClientEvent = typeof RealtimeClientEvent.Type;
3095
3091
 
3096
3092
  /** Safe, normalized server events. No raw provider payload, client secret,
3097
3093
  * arbitrary conversation item or provider error message crosses this surface. */
3098
- export declare const RealtimeServerEvent: Schema.Union<[Schema.Struct<{
3099
- type: Schema.Literal<["ready"]>;
3094
+ export declare const RealtimeServerEvent: Schema.Union<readonly [Schema.Struct<{
3095
+ readonly type: Schema.Literal<"ready">;
3100
3096
  }>, Schema.Struct<{
3101
- type: Schema.Literal<["session-created"]>;
3102
- sessionId: Schema.optional<typeof Schema.String>;
3097
+ readonly type: Schema.Literal<"session-created">;
3098
+ readonly sessionId: Schema.optional<Schema.String>;
3103
3099
  }>, Schema.Struct<{
3104
- type: Schema.Literal<["session-updated"]>;
3100
+ readonly type: Schema.Literal<"session-updated">;
3105
3101
  }>, Schema.Struct<{
3106
- type: Schema.Literal<["speech-started", "speech-stopped"]>;
3107
- itemId: Schema.optional<typeof Schema.String>;
3102
+ readonly type: Schema.Literals<readonly ["speech-started", "speech-stopped"]>;
3103
+ readonly itemId: Schema.optional<Schema.String>;
3108
3104
  }>, Schema.Struct<{
3109
- type: Schema.Literal<["audio-committed"]>;
3110
- itemId: Schema.optional<typeof Schema.String>;
3111
- previousItemId: Schema.optional<typeof Schema.String>;
3105
+ readonly type: Schema.Literal<"audio-committed">;
3106
+ readonly itemId: Schema.optional<Schema.String>;
3107
+ readonly previousItemId: Schema.optional<Schema.String>;
3112
3108
  }>, Schema.Struct<{
3113
- itemId: typeof Schema.String;
3114
- type: Schema.Literal<["conversation-item-added"]>;
3109
+ readonly itemId: Schema.String;
3110
+ readonly type: Schema.Literal<"conversation-item-added">;
3115
3111
  }>, Schema.Struct<{
3116
- transcript: typeof Schema.String;
3117
- itemId: typeof Schema.String;
3118
- type: Schema.Literal<["input-transcription-completed"]>;
3112
+ readonly transcript: Schema.String;
3113
+ readonly itemId: Schema.String;
3114
+ readonly type: Schema.Literal<"input-transcription-completed">;
3119
3115
  }>, Schema.Struct<{
3120
- type: Schema.Literal<["response-created"]>;
3121
- responseId: typeof Schema.String;
3116
+ readonly type: Schema.Literal<"response-created">;
3117
+ readonly responseId: Schema.String;
3122
3118
  }>, Schema.Struct<{
3123
- type: Schema.Literal<["response-done"]>;
3124
- responseId: typeof Schema.String;
3125
- status: typeof Schema.String;
3119
+ readonly type: Schema.Literal<"response-done">;
3120
+ readonly responseId: Schema.String;
3121
+ readonly status: Schema.String;
3126
3122
  }>, Schema.Struct<{
3127
- itemId: typeof Schema.String;
3128
- responseId: typeof Schema.String;
3129
- type: Schema.Literal<["output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"]>;
3123
+ readonly itemId: Schema.String;
3124
+ readonly responseId: Schema.String;
3125
+ readonly type: Schema.Literals<readonly ["output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"]>;
3130
3126
  }>, Schema.Struct<{
3131
- delta: Schema.filter<typeof Schema.String>;
3132
- itemId: typeof Schema.String;
3133
- responseId: typeof Schema.String;
3134
- type: Schema.Literal<["audio-delta"]>;
3127
+ readonly delta: Schema.String;
3128
+ readonly itemId: Schema.String;
3129
+ readonly responseId: Schema.String;
3130
+ readonly type: Schema.Literal<"audio-delta">;
3135
3131
  }>, Schema.Struct<{
3136
- delta: typeof Schema.String;
3137
- itemId: typeof Schema.String;
3138
- responseId: typeof Schema.String;
3139
- type: Schema.Literal<["text-delta", "audio-transcript-delta"]>;
3132
+ readonly delta: Schema.String;
3133
+ readonly itemId: Schema.String;
3134
+ readonly responseId: Schema.String;
3135
+ readonly type: Schema.Literals<readonly ["text-delta", "audio-transcript-delta"]>;
3140
3136
  }>, Schema.Struct<{
3141
- text: Schema.optional<typeof Schema.String>;
3142
- itemId: typeof Schema.String;
3143
- responseId: typeof Schema.String;
3144
- type: Schema.Literal<["text-done"]>;
3137
+ readonly text: Schema.optional<Schema.String>;
3138
+ readonly itemId: Schema.String;
3139
+ readonly responseId: Schema.String;
3140
+ readonly type: Schema.Literal<"text-done">;
3145
3141
  }>, Schema.Struct<{
3146
- transcript: Schema.optional<typeof Schema.String>;
3147
- itemId: typeof Schema.String;
3148
- responseId: typeof Schema.String;
3149
- type: Schema.Literal<["audio-transcript-done"]>;
3142
+ readonly transcript: Schema.optional<Schema.String>;
3143
+ readonly itemId: Schema.String;
3144
+ readonly responseId: Schema.String;
3145
+ readonly type: Schema.Literal<"audio-transcript-done">;
3150
3146
  }>]>;
3151
3147
 
3152
3148
  export declare type RealtimeServerEvent = typeof RealtimeServerEvent.Type;
@@ -3221,10 +3217,10 @@ export declare const recordReads: <S extends QueryableStore>(store: S) => ReadRe
3221
3217
  /**
3222
3218
  * Redis-backed resumable-stream store — the production "resumable via
3223
3219
  * Redis-Replay" path. The append-only log is a Redis LIST per `streamId`
3224
- * (`RPUSH` to append, `LRANGE afterSeq -1` to read the tail past a cursor — the
3225
- * list index lines up with the 1-based `seq` because exactly ONE producer
3226
- * appends, elected by `claimProducer` = `SET … NX`). Multi-node correct + the
3227
- * fastest backend; TTL (default 1h) evicts finished/abandoned streams without a
3220
+ * (`RPUSH` to append, bounded `LRANGE` pages to read past a verified cursor;
3221
+ * failed writes leaving sequence holes fall back to paged filtering). Exactly
3222
+ * ONE producer appends, elected by `claimProducer` = `SET … NX`. TTL (default
3223
+ * 1h) evicts finished/abandoned streams without a
3228
3224
  * sweep. A drop-in for `dataStoreResumableStreamStore` against the same
3229
3225
  * `ResumableStreamStore` interface.
3230
3226
  */
@@ -3518,6 +3514,7 @@ export declare interface ResumableStreamOptions {
3518
3514
  /** Replay events past this `seq` before tailing (a reconnect cursor). */
3519
3515
  readonly fromSeq?: number;
3520
3516
  readonly pollMs?: number;
3517
+ readonly maxPollMs?: number;
3521
3518
  readonly idleTimeoutMs?: number;
3522
3519
  }
3523
3520
 
@@ -3537,8 +3534,10 @@ export declare interface ResumableStreamStore {
3537
3534
  readonly claimProducer: (streamId: string) => Effect.Effect<boolean>;
3538
3535
  /** Append one event at its `seq`. Producer-only. */
3539
3536
  readonly append: (streamId: string, ev: SeqEvent) => Effect.Effect<void>;
3537
+ /** Persist a source chunk in bounded bulk operations when supported. */
3538
+ readonly appendMany?: (streamId: string, events: ReadonlyArray<SeqEvent>) => Effect.Effect<void>;
3540
3539
  /** Persisted events with `seq > afterSeq`, ascending. */
3541
- readonly read: (streamId: string, afterSeq: number) => Effect.Effect<ReadonlyArray<SeqEvent>>;
3540
+ readonly read: (streamId: string, afterSeq: number, limit?: number) => Effect.Effect<ReadonlyArray<SeqEvent>>;
3542
3541
  /** Mark the stream complete — the producer reached a terminal event. */
3543
3542
  readonly markDone: (streamId: string) => Effect.Effect<void>;
3544
3543
  /** Whether the producer has finished (all events are persisted). */
@@ -3553,6 +3552,7 @@ export declare const resumableStreamText: (args: {
3553
3552
  readonly options: StreamTextOptions;
3554
3553
  readonly fromSeq?: number;
3555
3554
  readonly pollMs?: number;
3555
+ readonly maxPollMs?: number;
3556
3556
  readonly idleTimeoutMs?: number;
3557
3557
  }) => Stream.Stream<SeqEvent>;
3558
3558
 
@@ -3808,60 +3808,62 @@ export declare interface SemanticUsage {
3808
3808
  * client bundle.
3809
3809
  */
3810
3810
  export declare const SeqEvent: Schema.Struct<{
3811
- seq: typeof Schema.Number;
3812
- event: Schema.Union<[Schema.Struct<{
3813
- _tag: Schema.Literal<["token"]>;
3814
- text: typeof Schema.String;
3811
+ readonly seq: Schema.Number;
3812
+ readonly event: Schema.Union<readonly [Schema.Struct<{
3813
+ readonly _tag: Schema.Literal<"token">;
3814
+ readonly text: Schema.String;
3815
3815
  }>, Schema.Struct<{
3816
- _tag: Schema.Literal<["reasoning"]>;
3817
- text: typeof Schema.String;
3816
+ readonly _tag: Schema.Literal<"reasoning">;
3817
+ readonly text: Schema.String;
3818
3818
  }>, Schema.Struct<{
3819
- _tag: Schema.Literal<["toolCall"]>;
3820
- id: typeof Schema.String;
3821
- name: typeof Schema.String;
3822
- input: typeof Schema.Unknown;
3819
+ readonly _tag: Schema.Literal<"toolCall">;
3820
+ readonly id: Schema.String;
3821
+ readonly name: Schema.String;
3822
+ readonly input: Schema.Unknown;
3823
+ /** Present when the caller must execute this pending call. */
3824
+ readonly execution: Schema.optional<Schema.Literal<"client">>;
3823
3825
  }>, Schema.Struct<{
3824
- _tag: Schema.Literal<["toolResult"]>;
3825
- id: typeof Schema.String;
3826
- name: typeof Schema.String;
3827
- output: Schema.optional<typeof Schema.Unknown>;
3828
- error: Schema.optional<typeof Schema.String>;
3826
+ readonly _tag: Schema.Literal<"toolResult">;
3827
+ readonly id: Schema.String;
3828
+ readonly name: Schema.String;
3829
+ readonly output: Schema.optional<Schema.Unknown>;
3830
+ readonly error: Schema.optional<Schema.String>;
3829
3831
  }>, Schema.Struct<{
3830
- _tag: Schema.Literal<["source"]>;
3831
- sourceType: Schema.Literal<["url", "document"]>;
3832
- id: typeof Schema.String;
3833
- url: Schema.optional<typeof Schema.String>;
3834
- title: Schema.optional<typeof Schema.String>;
3835
- mediaType: Schema.optional<typeof Schema.String>;
3836
- filename: Schema.optional<typeof Schema.String>;
3832
+ readonly _tag: Schema.Literal<"source">;
3833
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
3834
+ readonly id: Schema.String;
3835
+ readonly url: Schema.optional<Schema.String>;
3836
+ readonly title: Schema.optional<Schema.String>;
3837
+ readonly mediaType: Schema.optional<Schema.String>;
3838
+ readonly filename: Schema.optional<Schema.String>;
3837
3839
  /** Provider-owned citation attribution; not normalized or interpreted. */
3838
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
3840
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
3839
3841
  }>, Schema.Struct<{
3840
- _tag: Schema.Literal<["file"]>;
3841
- mediaType: typeof Schema.String;
3842
- data: typeof Schema.String;
3842
+ readonly _tag: Schema.Literal<"file">;
3843
+ readonly mediaType: Schema.String;
3844
+ readonly data: Schema.String;
3843
3845
  /** Metadata for this file, not the whole model step. */
3844
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
3846
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
3845
3847
  }>, Schema.Struct<{
3846
- _tag: Schema.Literal<["stepMetadata"]>;
3847
- step: Schema.filter<typeof Schema.Int>;
3848
- providerMetadata: typeof Schema.Unknown;
3848
+ readonly _tag: Schema.Literal<"stepMetadata">;
3849
+ readonly step: Schema.Int;
3850
+ readonly providerMetadata: Schema.Unknown;
3849
3851
  }>, Schema.Struct<{
3850
- _tag: Schema.Literal<["message"]>;
3851
- role: typeof Schema.String;
3852
- content: typeof Schema.String;
3852
+ readonly _tag: Schema.Literal<"message">;
3853
+ readonly role: Schema.String;
3854
+ readonly content: Schema.String;
3853
3855
  }>, Schema.Struct<{
3854
- _tag: Schema.Literal<["error"]>;
3855
- code: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
3856
- message: typeof Schema.String;
3857
- retryable: typeof Schema.Boolean;
3856
+ readonly _tag: Schema.Literal<"error">;
3857
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
3858
+ readonly message: Schema.String;
3859
+ readonly retryable: Schema.Boolean;
3858
3860
  }>, Schema.Struct<{
3859
- _tag: Schema.Literal<["done"]>;
3860
- finishReason: typeof Schema.String;
3861
- usage: Schema.Struct<{
3862
- inputTokens: Schema.optional<typeof Schema.Number>;
3863
- outputTokens: Schema.optional<typeof Schema.Number>;
3864
- totalTokens: Schema.optional<typeof Schema.Number>;
3861
+ readonly _tag: Schema.Literal<"done">;
3862
+ readonly finishReason: Schema.String;
3863
+ readonly usage: Schema.Struct<{
3864
+ readonly inputTokens: Schema.optional<Schema.Number>;
3865
+ readonly outputTokens: Schema.optional<Schema.Number>;
3866
+ readonly totalTokens: Schema.optional<Schema.Number>;
3865
3867
  }>;
3866
3868
  }>]>;
3867
3869
  }>;
@@ -4144,18 +4146,18 @@ export declare const toModelInfo: (e: GatewayLanguageModelEntry) => GatewayModel
4144
4146
  * CLI discovery path passes the real `AppContext`, which is a superset.
4145
4147
  *
4146
4148
  * `runtime` is the caller's ambient Effect `Runtime`. When present, tool
4147
- * bodies are run through it (`Runtime.runPromise(runtime)(eff)`) instead of
4149
+ * bodies are run through it (`Effect.runPromiseWith(runtime)(eff)`) instead of
4148
4150
  * bare `Effect.runPromise`, so a body may `yield*` any service the caller's
4149
4151
  * runtime carries — `JiraService`, the data store layer, `HttpClient`, … —
4150
4152
  * rather than being limited to `R = never`. The agent loop
4151
- * (`streamText`/`runAssistant`) captures `yield* Effect.runtime()` and threads
4153
+ * (`streamText`/`runAssistant`) captures `yield* Effect.context<never>()` and threads
4152
4154
  * it here; without a runtime, behaviour is unchanged. */
4153
4155
  export declare interface ToolContext {
4154
4156
  readonly store: unknown;
4155
4157
  readonly request?: {
4156
4158
  readonly subject?: unknown;
4157
4159
  };
4158
- readonly runtime?: Runtime.Runtime<unknown>;
4160
+ readonly runtime?: Context.Context<never>;
4159
4161
  /** SDK tool-call identity for this execution, not a durable application idempotency key. */
4160
4162
  readonly invocationId?: string;
4161
4163
  /** Cancellation from either the caller's turn or SDK invocation; Promise handlers must pass it to their I/O. */
@@ -4165,7 +4167,7 @@ export declare interface ToolContext {
4165
4167
  export declare interface ToolDef<A, I, O> {
4166
4168
  readonly name: string;
4167
4169
  readonly description: string;
4168
- readonly input: Schema.Schema<A, I>;
4170
+ readonly input: Schema.Codec<A, I>;
4169
4171
  /**
4170
4172
  * A ready-made JSON Schema for the tool's parameters, used INSTEAD of
4171
4173
  * rendering `input`.
@@ -4180,13 +4182,15 @@ export declare interface ToolDef<A, I, O> {
4180
4182
  readonly inputJsonSchema?: Record<string, unknown>;
4181
4183
  /** Optional result schema. When set, `buildSdkTools` decodes the body's
4182
4184
  * output through it before handing the value back to the model. */
4183
- readonly output?: Schema.Schema.Any;
4185
+ readonly output?: Schema.Top;
4184
4186
  /** Inline body: returns an Effect. May declare service deps on the R
4185
4187
  * channel — they are provided by the caller's runtime
4186
4188
  * (`ctx.runtime`) at execution time. */
4187
4189
  readonly execute?: (input: A) => Effect.Effect<O, never, unknown>;
4188
4190
  /** File-convention body: receives `ctx`, returns Effect or Promise. */
4189
4191
  readonly handler?: ToolHandler<A, O>;
4192
+ /** Client tools return a pending call to the caller; never run on the server. */
4193
+ readonly execution?: 'server' | 'client';
4190
4194
  /** Per-call deadline; the tool fails with a timeout error past it. */
4191
4195
  readonly timeoutMs?: number;
4192
4196
  }
@@ -4299,42 +4303,40 @@ export declare type TranscriptionSource =
4299
4303
  export declare class TranscriptionStreamError extends TranscriptionStreamError_base {
4300
4304
  }
4301
4305
 
4302
- declare const TranscriptionStreamError_base: Schema.TaggedErrorClass<TranscriptionStreamError, "TranscriptionStreamError", {
4303
- readonly _tag: Schema.tag<"TranscriptionStreamError">;
4304
- } & {
4305
- reason: Schema.Literal<["input", "unsupported", "provider", "cancelled"]>;
4306
- message: typeof Schema.String;
4307
- }>;
4306
+ declare const TranscriptionStreamError_base: Schema.Class<TranscriptionStreamError, Schema.TaggedStruct<"TranscriptionStreamError", {
4307
+ readonly reason: Schema.Literals<readonly ["input", "unsupported", "provider", "cancelled"]>;
4308
+ readonly message: Schema.String;
4309
+ }>, YieldableError>;
4308
4310
 
4309
4311
  /** Partial text is replaceable, delta text is append-only, and final text seals a segment. */
4310
- export declare const TranscriptionStreamEvent: Schema.Union<[Schema.Struct<{
4311
- delta: typeof Schema.String;
4312
- id: Schema.optional<typeof Schema.String>;
4313
- type: Schema.Literal<["transcript-delta"]>;
4312
+ export declare const TranscriptionStreamEvent: Schema.Union<readonly [Schema.Struct<{
4313
+ readonly delta: Schema.String;
4314
+ readonly id: Schema.optional<Schema.String>;
4315
+ readonly type: Schema.Literal<"transcript-delta">;
4314
4316
  }>, Schema.Struct<{
4315
- text: typeof Schema.String;
4316
- startSecond: Schema.optional<typeof Schema.Number>;
4317
- durationInSeconds: Schema.optional<typeof Schema.Number>;
4318
- channelIndex: Schema.optional<typeof Schema.Number>;
4319
- id: Schema.optional<typeof Schema.String>;
4320
- type: Schema.Literal<["transcript-partial"]>;
4317
+ readonly text: Schema.String;
4318
+ readonly startSecond: Schema.optional<Schema.Number>;
4319
+ readonly durationInSeconds: Schema.optional<Schema.Number>;
4320
+ readonly channelIndex: Schema.optional<Schema.Number>;
4321
+ readonly id: Schema.optional<Schema.String>;
4322
+ readonly type: Schema.Literal<"transcript-partial">;
4321
4323
  }>, Schema.Struct<{
4322
- text: typeof Schema.String;
4323
- startSecond: Schema.optional<typeof Schema.Number>;
4324
- endSecond: Schema.optional<typeof Schema.Number>;
4325
- channelIndex: Schema.optional<typeof Schema.Number>;
4326
- id: Schema.optional<typeof Schema.String>;
4327
- type: Schema.Literal<["transcript-final"]>;
4324
+ readonly text: Schema.String;
4325
+ readonly startSecond: Schema.optional<Schema.Number>;
4326
+ readonly endSecond: Schema.optional<Schema.Number>;
4327
+ readonly channelIndex: Schema.optional<Schema.Number>;
4328
+ readonly id: Schema.optional<Schema.String>;
4329
+ readonly type: Schema.Literal<"transcript-final">;
4328
4330
  }>, Schema.Struct<{
4329
- type: Schema.Literal<["finish"]>;
4330
- text: typeof Schema.String;
4331
- segments: Schema.Array$<Schema.Struct<{
4332
- text: typeof Schema.String;
4333
- start: typeof Schema.Number;
4334
- end: typeof Schema.Number;
4331
+ readonly type: Schema.Literal<"finish">;
4332
+ readonly text: Schema.String;
4333
+ readonly segments: Schema.$Array<Schema.Struct<{
4334
+ readonly text: Schema.String;
4335
+ readonly start: Schema.Number;
4336
+ readonly end: Schema.Number;
4335
4337
  }>>;
4336
- language: Schema.optional<typeof Schema.String>;
4337
- durationSec: Schema.optional<typeof Schema.Number>;
4338
+ readonly language: Schema.optional<Schema.String>;
4339
+ readonly durationSec: Schema.optional<Schema.Number>;
4338
4340
  }>]>;
4339
4341
 
4340
4342
  export declare type TranscriptionStreamEvent = typeof TranscriptionStreamEvent.Type;