@voltro/ai 0.84.0 → 0.85.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.
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,69 @@ 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;
112
111
  }>, 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>;
112
+ readonly _tag: Schema.Literal<"toolResult">;
113
+ readonly id: Schema.String;
114
+ readonly name: Schema.String;
115
+ readonly output: Schema.optional<Schema.Unknown>;
116
+ readonly error: Schema.optional<Schema.String>;
118
117
  }>, 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>;
118
+ readonly _tag: Schema.Literal<"source">;
119
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
120
+ readonly id: Schema.String;
121
+ readonly url: Schema.optional<Schema.String>;
122
+ readonly title: Schema.optional<Schema.String>;
123
+ readonly mediaType: Schema.optional<Schema.String>;
124
+ readonly filename: Schema.optional<Schema.String>;
126
125
  /** Provider-owned citation attribution; not normalized or interpreted. */
127
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
126
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
128
127
  }>, Schema.Struct<{
129
- _tag: Schema.Literal<["file"]>;
130
- mediaType: typeof Schema.String;
131
- data: typeof Schema.String;
128
+ readonly _tag: Schema.Literal<"file">;
129
+ readonly mediaType: Schema.String;
130
+ readonly data: Schema.String;
132
131
  /** Metadata for this file, not the whole model step. */
133
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
132
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
134
133
  }>, Schema.Struct<{
135
- _tag: Schema.Literal<["stepMetadata"]>;
136
- step: Schema.filter<typeof Schema.Int>;
137
- providerMetadata: typeof Schema.Unknown;
134
+ readonly _tag: Schema.Literal<"stepMetadata">;
135
+ readonly step: Schema.Int;
136
+ readonly providerMetadata: Schema.Unknown;
138
137
  }>, Schema.Struct<{
139
- _tag: Schema.Literal<["message"]>;
140
- role: typeof Schema.String;
141
- content: typeof Schema.String;
138
+ readonly _tag: Schema.Literal<"message">;
139
+ readonly role: Schema.String;
140
+ readonly content: Schema.String;
142
141
  }>, 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;
142
+ readonly _tag: Schema.Literal<"error">;
143
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
144
+ readonly message: Schema.String;
145
+ readonly retryable: Schema.Boolean;
147
146
  }>, 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>;
147
+ readonly _tag: Schema.Literal<"done">;
148
+ readonly finishReason: Schema.String;
149
+ readonly usage: Schema.Struct<{
150
+ readonly inputTokens: Schema.optional<Schema.Number>;
151
+ readonly outputTokens: Schema.optional<Schema.Number>;
152
+ readonly totalTokens: Schema.optional<Schema.Number>;
154
153
  }>;
155
154
  }>]>;
156
155
 
157
156
  export declare type AgentEvent = typeof AgentEvent.Type;
158
157
 
159
- export declare interface AgentExecutor<S extends Schema.Schema.Any = DefaultAgentInputSchema> {
158
+ export declare interface AgentExecutor<S extends Schema.Top = DefaultAgentInputSchema> {
160
159
  readonly _brand: typeof EXECUTOR_BRAND;
161
160
  readonly descriptor: AgentDescriptor<S>;
162
161
  readonly config: AgentExecutorConfig<AgentInput<S>>;
@@ -202,10 +201,10 @@ export declare interface AgentExecutorConfig<Input = {
202
201
  }
203
202
 
204
203
  /** 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>;
204
+ export declare type AgentInput<S extends Schema.Top> = Schema.Schema.Type<S>;
206
205
 
207
206
  /** The agent's input schema (default `{ prompt: string }`). */
208
- export declare const agentInputSchema: (desc: AnyAgentDescriptor) => Schema.Schema.Any;
207
+ export declare const agentInputSchema: (desc: AnyAgentDescriptor) => Schema.Top;
209
208
 
210
209
  export declare interface AgentMessage {
211
210
  readonly id: string;
@@ -223,19 +222,16 @@ export declare interface AgentMessage {
223
222
  export declare type AgentMessageRole = 'user' | 'assistant' | 'system' | 'tool';
224
223
 
225
224
  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
- }]>>;
225
+ readonly id: Schema.String;
226
+ readonly threadId: Schema.String;
227
+ readonly role: Schema.String;
228
+ readonly content: Schema.String;
229
+ readonly streaming: Schema.Boolean;
230
+ readonly order: Schema.Number;
231
+ readonly stepOrder: Schema.Number;
232
+ readonly parts: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
233
+ readonly type: Schema.String;
234
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
239
235
  }>;
240
236
 
241
237
  export declare const agentMessagesTable: Table<typeof AGENT_MESSAGES_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
@@ -246,25 +242,22 @@ export declare const agentMessagesTable: Table<typeof AGENT_MESSAGES_TABLE, Reco
246
242
  * so "what the server serves" and "what the client is typed for" can't drift.
247
243
  */
248
244
  export declare const agentRouteDescriptors: (desc: AnyAgentDescriptor) => {
249
- send: ActionProcedureDescriptor<`${string}.send`, Schema.Schema.Any, Schema.Struct<{
250
- text: typeof Schema.String;
245
+ send: ActionProcedureDescriptor<`${string}.send`, Schema.Top, Schema.Struct<{
246
+ readonly text: Schema.String;
251
247
  }>, typeof AgentThreadAccessDenied>;
252
248
  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
- }]>>;
249
+ readonly threadId: Schema.String;
250
+ }>, Schema.$Array<Schema.Struct<{
251
+ readonly id: Schema.String;
252
+ readonly threadId: Schema.String;
253
+ readonly role: Schema.String;
254
+ readonly content: Schema.String;
255
+ readonly streaming: Schema.Boolean;
256
+ readonly order: Schema.Number;
257
+ readonly stepOrder: Schema.Number;
258
+ readonly parts: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
259
+ readonly type: Schema.String;
260
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
268
261
  }>>, typeof AgentThreadAccessDenied>;
269
262
  };
270
263
 
@@ -293,11 +286,9 @@ export declare class AgentThreadAccessDenied extends AgentThreadAccessDenied_bas
293
286
  get message(): string;
294
287
  }
295
288
 
296
- declare const AgentThreadAccessDenied_base: Schema.TaggedErrorClass<AgentThreadAccessDenied, "AgentThreadAccessDenied", {
297
- readonly _tag: Schema.tag<"AgentThreadAccessDenied">;
298
- } & {
299
- threadId: typeof Schema.String;
300
- }>;
289
+ declare const AgentThreadAccessDenied_base: Schema.Class<AgentThreadAccessDenied, Schema.TaggedStruct<"AgentThreadAccessDenied", {
290
+ readonly threadId: Schema.String;
291
+ }>, YieldableError>;
301
292
 
302
293
  export declare const agentThreadsTable: Table<typeof AGENT_THREADS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
303
294
 
@@ -315,25 +306,21 @@ export declare type AiBudgetError = AiBudgetExceeded | AiBudgetInvalidInput | Ai
315
306
  export declare class AiBudgetExceeded extends AiBudgetExceeded_base {
316
307
  }
317
308
 
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
- }>;
309
+ declare const AiBudgetExceeded_base: Schema.Class<AiBudgetExceeded, Schema.TaggedStruct<"AiBudgetExceeded", {
310
+ readonly tenantId: Schema.NullOr<Schema.String>;
311
+ readonly limitUsd: Schema.Number;
312
+ readonly spentUsd: Schema.Number;
313
+ readonly attemptedUsd: Schema.Number;
314
+ }>, YieldableError>;
326
315
 
327
316
  /** Invalid caller configuration, without echoing the supplied value. */
328
317
  export declare class AiBudgetInvalidInput extends AiBudgetInvalidInput_base {
329
318
  }
330
319
 
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
- }>;
320
+ declare const AiBudgetInvalidInput_base: Schema.Class<AiBudgetInvalidInput, Schema.TaggedStruct<"AiBudgetInvalidInput", {
321
+ readonly field: Schema.Literals<readonly ["limitUsd", "addUsd", "since", "reservationId", "tenantId"]>;
322
+ readonly message: Schema.String;
323
+ }>, YieldableError>;
337
324
 
338
325
  export declare interface AiBudgetReservation {
339
326
  readonly reservationId: string;
@@ -346,12 +333,10 @@ export declare interface AiBudgetReservation {
346
333
  export declare class AiBudgetReservationConflict extends AiBudgetReservationConflict_base {
347
334
  }
348
335
 
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
- }>;
336
+ declare const AiBudgetReservationConflict_base: Schema.Class<AiBudgetReservationConflict, Schema.TaggedStruct<"AiBudgetReservationConflict", {
337
+ readonly reason: Schema.Literals<readonly ["identity-bound", "already-released"]>;
338
+ readonly message: Schema.String;
339
+ }>, YieldableError>;
355
340
 
356
341
  /** Receipt and release tombstone. A receipt and its counter change commit together. */
357
342
  export declare const aiBudgetReservationsTable: Table<typeof AI_BUDGET_RESERVATIONS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
@@ -376,21 +361,21 @@ export declare type AiCallEvidence = typeof AiCallEvidenceSchema.Type;
376
361
  /** Allowlisted consumption evidence, never a provider response or SDK error.
377
362
  * Completeness describes the three token counters, not billing completeness. */
378
363
  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"]>;
364
+ readonly provider: Schema.String;
365
+ readonly model: Schema.String;
366
+ readonly usage: Schema.Struct<{
367
+ readonly inputTokens: Schema.optional<Schema.Number>;
368
+ readonly outputTokens: Schema.optional<Schema.Number>;
369
+ readonly totalTokens: Schema.optional<Schema.Number>;
370
+ readonly completeness: Schema.Literals<readonly ["complete", "partial", "unknown"]>;
386
371
  }>;
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>>;
372
+ readonly cost: Schema.Union<readonly [Schema.Struct<{
373
+ readonly status: Schema.Literal<"actual">;
374
+ readonly source: Schema.Literal<"gateway">;
375
+ readonly usd: Schema.Number;
391
376
  }>, Schema.Struct<{
392
- status: Schema.Literal<["unknown"]>;
393
- source: Schema.Literal<["unreported"]>;
377
+ readonly status: Schema.Literal<"unknown">;
378
+ readonly source: Schema.Literal<"unreported">;
394
379
  }>]>;
395
380
  }>;
396
381
 
@@ -411,30 +396,28 @@ export declare interface AiCallLog {
411
396
  export declare class AiError extends AiError_base {
412
397
  }
413
398
 
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"]>;
399
+ declare const AiError_base: Schema.Class<AiError, Schema.TaggedStruct<"AiError", {
400
+ readonly reason: Schema.Literals<readonly ["generation", "decode"]>;
401
+ readonly message: Schema.String;
402
+ readonly evidence: Schema.optional<Schema.Struct<{
403
+ readonly provider: Schema.String;
404
+ readonly model: Schema.String;
405
+ readonly usage: Schema.Struct<{
406
+ readonly inputTokens: Schema.optional<Schema.Number>;
407
+ readonly outputTokens: Schema.optional<Schema.Number>;
408
+ readonly totalTokens: Schema.optional<Schema.Number>;
409
+ readonly completeness: Schema.Literals<readonly ["complete", "partial", "unknown"]>;
427
410
  }>;
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>>;
411
+ readonly cost: Schema.Union<readonly [Schema.Struct<{
412
+ readonly status: Schema.Literal<"actual">;
413
+ readonly source: Schema.Literal<"gateway">;
414
+ readonly usd: Schema.Number;
432
415
  }>, Schema.Struct<{
433
- status: Schema.Literal<["unknown"]>;
434
- source: Schema.Literal<["unreported"]>;
416
+ readonly status: Schema.Literal<"unknown">;
417
+ readonly source: Schema.Literal<"unreported">;
435
418
  }>]>;
436
419
  }>>;
437
- }>;
420
+ }>, YieldableError>;
438
421
 
439
422
  /**
440
423
  * The one way a CAUGHT provider failure becomes an `AiError`.
@@ -495,7 +478,7 @@ export declare type AiProviderOptions = Record<string, Record<string, AiJsonValu
495
478
  export declare class AiService extends AiService_base {
496
479
  }
497
480
 
498
- declare const AiService_base: Context.TagClass<AiService, "@voltro/AiService", AiServiceImpl>;
481
+ declare const AiService_base: Context.ServiceClass<AiService, "@voltro/AiService", AiServiceImpl>;
499
482
 
500
483
  export declare interface AiServiceImpl {
501
484
  readonly generateText: (options: GenerateTextOptions) => Effect.Effect<GenerateTextResult, AiError>;
@@ -618,10 +601,10 @@ export declare const aiUsageTable: Table<typeof AI_USAGE_TABLE, Record<string, C
618
601
  export declare type AnthropicModel = 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001' | (string & {});
619
602
 
620
603
  /** A descriptor of any input shape — for the type-erased runtime helpers. */
621
- export declare type AnyAgentDescriptor = AgentDescriptor<Schema.Schema.Any>;
604
+ export declare type AnyAgentDescriptor = AgentDescriptor<Schema.Top>;
622
605
 
623
606
  /** An executor of any input shape — for the type-erased runtime helpers. */
624
- export declare type AnyAgentExecutor = AgentExecutor<Schema.Schema.Any>;
607
+ export declare type AnyAgentExecutor = AgentExecutor<Schema.Top>;
625
608
 
626
609
  /** A heterogeneous tool — the shape `buildSdkTools` / `runAssistant` consume.
627
610
  * `defineTool` keeps full input typing on its `execute`/`handler` body, then
@@ -631,11 +614,11 @@ export declare type AnyAgentExecutor = AgentExecutor<Schema.Schema.Any>;
631
614
  export declare interface AnyTool {
632
615
  readonly name: string;
633
616
  readonly description: string;
634
- readonly input: Schema.Schema.Any;
617
+ readonly input: Schema.Top;
635
618
  /** See `ToolDef.inputJsonSchema` — a foreign parameter schema shown to the
636
619
  * model in place of a rendered `input`. */
637
620
  readonly inputJsonSchema?: Record<string, unknown>;
638
- readonly output?: Schema.Schema.Any;
621
+ readonly output?: Schema.Top;
639
622
  readonly execute?: (input: never) => Effect.Effect<unknown, never, unknown>;
640
623
  readonly handler?: ToolHandler<never, unknown>;
641
624
  readonly timeoutMs?: number;
@@ -726,8 +709,8 @@ export declare const appToolDecision: (descriptor: AppToolDescriptor, policy: Ap
726
709
  export declare interface AppToolDescriptor {
727
710
  readonly kind: 'query' | 'mutation' | 'action' | string;
728
711
  readonly name: string;
729
- readonly input: Schema.Schema.Any;
730
- readonly output?: Schema.Schema.Any;
712
+ readonly input: Schema.Top;
713
+ readonly output?: Schema.Top;
731
714
  readonly exposeAsTool?: ExposeAsToolLike;
732
715
  /**
733
716
  * Presence of the descriptor's `requiresApproval:` policy — read as a BOOLEAN
@@ -840,6 +823,9 @@ export declare interface ConsumeOptions {
840
823
  readonly fromSeq?: number;
841
824
  /** Tail poll interval in ms while the producer is still running (default 50). */
842
825
  readonly pollMs?: number;
826
+ /** Maximum idle polling interval. Default 1000ms. Local persisted appends
827
+ * wake consumers immediately; remote replicas are observed by polling. */
828
+ readonly maxPollMs?: number;
843
829
  /** End the consumer if no new event arrives for this long AND the producer
844
830
  * hasn't finished — a safety valve against a crashed producer that never
845
831
  * marked done. Default: undefined (wait indefinitely). */
@@ -890,21 +876,21 @@ export declare interface CopilotProposal {
890
876
  * `generateObject({ schema: CopilotProposalSchema })`). Mirrors
891
877
  * {@link CopilotProposal}. */
892
878
  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;
879
+ readonly table: Schema.String;
880
+ readonly columns: Schema.optional<Schema.$Array<Schema.String>>;
881
+ readonly filters: Schema.optional<Schema.$Array<Schema.Struct<{
882
+ readonly column: Schema.String;
883
+ readonly op: Schema.Literals<readonly ["eq", "neq", "gt", "gte", "lt", "lte", "contains", "in"]>;
884
+ readonly value: Schema.Unknown;
899
885
  }>>>;
900
- orderBy: Schema.optional<Schema.Struct<{
901
- column: typeof Schema.String;
902
- direction: Schema.optional<Schema.Literal<["asc", "desc"]>>;
886
+ readonly orderBy: Schema.optional<Schema.Struct<{
887
+ readonly column: Schema.String;
888
+ readonly direction: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
903
889
  }>>;
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>;
890
+ readonly limit: Schema.optional<Schema.Number>;
891
+ readonly aggregate: Schema.optional<Schema.Struct<{
892
+ readonly fn: Schema.Literals<readonly ["count", "sum", "avg", "min", "max"]>;
893
+ readonly column: Schema.optional<Schema.String>;
908
894
  }>>;
909
895
  }>;
910
896
 
@@ -913,12 +899,10 @@ export declare const CopilotProposalSchema: Schema.Struct<{
913
899
  export declare class CopilotRejected extends CopilotRejected_base {
914
900
  }
915
901
 
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
- }>;
902
+ declare const CopilotRejected_base: Schema.Class<CopilotRejected, Schema.TaggedStruct<"CopilotRejected", {
903
+ readonly reason: Schema.Literals<readonly ["unknown-table", "unknown-column", "bad-op", "bad-aggregate", "empty"]>;
904
+ readonly detail: Schema.String;
905
+ }>, YieldableError>;
922
906
 
923
907
  export declare interface CopilotSchema {
924
908
  readonly tables: ReadonlyArray<CopilotSchemaTable>;
@@ -1054,7 +1038,7 @@ export declare const DEFAULT_INFERENCE_POLL_MS = 250;
1054
1038
  export declare const DEFAULT_INFERENCE_RETENTION_HOURS: number;
1055
1039
 
1056
1040
  declare const DEFAULT_INPUT: Schema.Struct<{
1057
- prompt: typeof Schema.String;
1041
+ readonly prompt: Schema.String;
1058
1042
  }>;
1059
1043
 
1060
1044
  /** The default judge threshold when a judge is configured without one. */
@@ -1101,7 +1085,7 @@ export { defaultSettingsMiddleware }
1101
1085
  * })
1102
1086
  * ```
1103
1087
  */
1104
- export declare const defineAgent: <S extends Schema.Schema.Any = DefaultAgentInputSchema>(config: {
1088
+ export declare const defineAgent: <S extends Schema.Top = DefaultAgentInputSchema>(config: {
1105
1089
  readonly name: string;
1106
1090
  readonly input?: S;
1107
1091
  } & AgentAccessOptions) => AgentDescriptor<S>;
@@ -1123,7 +1107,7 @@ export declare const defineAgent: <S extends Schema.Schema.Any = DefaultAgentInp
1123
1107
  * })
1124
1108
  * ```
1125
1109
  */
1126
- export declare const defineAgentExecutor: <S extends Schema.Schema.Any = DefaultAgentInputSchema>(descriptor: AgentDescriptor<S>, config: AgentExecutorConfig<AgentInput<S>>) => AgentExecutor<S>;
1110
+ export declare const defineAgentExecutor: <S extends Schema.Top = DefaultAgentInputSchema>(descriptor: AgentDescriptor<S>, config: AgentExecutorConfig<AgentInput<S>>) => AgentExecutor<S>;
1127
1111
 
1128
1112
  export declare interface DefinedPrompt extends PromptDefinition {
1129
1113
  /** Content digest of `template` + `system`. The version. */
@@ -1185,9 +1169,9 @@ export declare const defineRealtimeSession: (options: RealtimeSessionOptions) =>
1185
1169
  export declare const defineTool: <A, I, O>(def: {
1186
1170
  readonly name: string;
1187
1171
  readonly description: string;
1188
- readonly input: Schema.Schema<A, I>;
1172
+ readonly input: Schema.Codec<A, I>;
1189
1173
  readonly inputJsonSchema?: Record<string, unknown>;
1190
- readonly output?: Schema.Schema.Any;
1174
+ readonly output?: Schema.Top;
1191
1175
  readonly execute?: (input: A) => Effect.Effect<O, never, unknown>;
1192
1176
  readonly handler?: ToolHandler<A, O>;
1193
1177
  readonly timeoutMs?: number;
@@ -1630,7 +1614,7 @@ export declare interface GenerateObjectOptions<A, I> {
1630
1614
  /** Effect Schema the model output must satisfy. Converted to JSON
1631
1615
  * Schema for the SDK, then decoded back through this schema so the
1632
1616
  * result carries branded types + refinements (not just JSON shape). */
1633
- readonly schema: Schema.Schema<A, I>;
1617
+ readonly schema: Schema.Codec<A, I>;
1634
1618
  readonly prompt: string;
1635
1619
  readonly system?: string;
1636
1620
  readonly provider?: ProviderConfig;
@@ -1683,7 +1667,7 @@ export declare interface GenerateObjectWithToolsOptions<A, I> {
1683
1667
  /** Effect Schema the FINAL object must satisfy. The model runs the tool
1684
1668
  * loop, then emits one object matching this schema; it is decoded back
1685
1669
  * through the schema so refinements/brands hold. */
1686
- readonly schema: Schema.Schema<A, I>;
1670
+ readonly schema: Schema.Codec<A, I>;
1687
1671
  readonly prompt: string;
1688
1672
  readonly system?: string;
1689
1673
  readonly provider?: ProviderConfig;
@@ -2205,14 +2189,12 @@ export declare const mcpCallTool: (transport: McpTransport, server: string, tool
2205
2189
  export declare class McpError extends McpError_base {
2206
2190
  }
2207
2191
 
2208
- declare const McpError_base: Schema.TaggedErrorClass<McpError, "McpError", {
2209
- readonly _tag: Schema.tag<"McpError">;
2210
- } & {
2192
+ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpError", {
2211
2193
  /** 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
- }>;
2194
+ readonly server: Schema.String;
2195
+ readonly reason: Schema.Literals<readonly ["transport", "protocol", "bounds", "policy"]>;
2196
+ readonly message: Schema.String;
2197
+ }>, YieldableError>;
2216
2198
 
2217
2199
  /** The MCP handshake: `initialize`, then the `notifications/initialized` the
2218
2200
  * spec requires before any other request. */
@@ -2498,13 +2480,22 @@ export declare interface MediaUsage {
2498
2480
  readonly totalTokens: number | undefined;
2499
2481
  }
2500
2482
 
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;
2483
+ export declare interface MemoryResumableStreamOptions {
2484
+ /** Completed payload retention. Default seven days; active readers defer eviction. */
2485
+ readonly retentionMs?: number;
2486
+ /** Clock for retention; defaults to Date.now. */
2487
+ readonly now?: () => number;
2488
+ }
2489
+
2490
+ export declare interface MemoryResumableStreamStore extends ResumableStreamStore {
2491
+ /** Release payloads and election tombstones at the end of the owner's lifetime.
2492
+ * Stop producers/consumers first. A disposed store cannot be reused. */
2493
+ readonly dispose: Effect.Effect<void>;
2494
+ }
2495
+
2496
+ /** Single-process store. Completed payloads expire; election tombstones remain
2497
+ * until dispose so an expired replay cannot start a second paid producer. */
2498
+ export declare const memoryResumableStreamStore: (opts?: MemoryResumableStreamOptions) => MemoryResumableStreamStore;
2508
2499
 
2509
2500
  export declare type MessagePart = {
2510
2501
  readonly type: 'text';
@@ -2715,7 +2706,7 @@ export declare type OpenAIModel = 'gpt-5.5' | 'gpt-4o' | 'gpt-4o-mini' | (string
2715
2706
  /** The JSON Schema a `generateObject` output schema renders to. Exported
2716
2707
  * because an OFFLOADED inference has to store it: a JavaScript Schema object
2717
2708
  * 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>;
2709
+ export declare const outputJsonSchema: (schema: Schema.Top, fn: string) => Effect.Effect<Record<string, unknown>, AiError>;
2719
2710
 
2720
2711
  /**
2721
2712
  * Pull the first JSON-RPC message out of a Streamable-HTTP response body.
@@ -2786,13 +2777,11 @@ export declare const promptDigest: (prompt: string) => string;
2786
2777
  export declare class PromptRenderError extends PromptRenderError_base {
2787
2778
  }
2788
2779
 
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
- }>;
2780
+ declare const PromptRenderError_base: Schema.Class<PromptRenderError, Schema.TaggedStruct<"PromptRenderError", {
2781
+ readonly promptId: Schema.String;
2782
+ readonly missing: Schema.$Array<Schema.String>;
2783
+ readonly message: Schema.String;
2784
+ }>, YieldableError>;
2796
2785
 
2797
2786
  export declare const PROMPTS_TABLE = "_voltro_prompts";
2798
2787
 
@@ -3072,81 +3061,81 @@ export declare interface ReadRecorder<S extends QueryableStore> {
3072
3061
 
3073
3062
  /** Browser-safe input allowlist. Session configuration and provider credentials
3074
3063
  * 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>;
3064
+ export declare const RealtimeClientEvent: Schema.Union<readonly [Schema.Struct<{
3065
+ readonly type: Schema.Literal<"input-audio-append">;
3066
+ readonly audio: Schema.String;
3078
3067
  }>, Schema.Struct<{
3079
- type: Schema.Literal<["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
3068
+ readonly type: Schema.Literals<readonly ["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
3080
3069
  }>, 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;
3070
+ readonly type: Schema.Literal<"conversation-item-create">;
3071
+ readonly item: Schema.Struct<{
3072
+ readonly type: Schema.Literal<"text-message">;
3073
+ readonly role: Schema.Literal<"user">;
3074
+ readonly text: Schema.String;
3086
3075
  }>;
3087
3076
  }>, 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>>;
3077
+ readonly type: Schema.Literal<"conversation-item-truncate">;
3078
+ readonly itemId: Schema.String;
3079
+ readonly contentIndex: Schema.Number;
3080
+ readonly audioEndMs: Schema.Number;
3092
3081
  }>]>;
3093
3082
 
3094
3083
  export declare type RealtimeClientEvent = typeof RealtimeClientEvent.Type;
3095
3084
 
3096
3085
  /** Safe, normalized server events. No raw provider payload, client secret,
3097
3086
  * arbitrary conversation item or provider error message crosses this surface. */
3098
- export declare const RealtimeServerEvent: Schema.Union<[Schema.Struct<{
3099
- type: Schema.Literal<["ready"]>;
3087
+ export declare const RealtimeServerEvent: Schema.Union<readonly [Schema.Struct<{
3088
+ readonly type: Schema.Literal<"ready">;
3100
3089
  }>, Schema.Struct<{
3101
- type: Schema.Literal<["session-created"]>;
3102
- sessionId: Schema.optional<typeof Schema.String>;
3090
+ readonly type: Schema.Literal<"session-created">;
3091
+ readonly sessionId: Schema.optional<Schema.String>;
3103
3092
  }>, Schema.Struct<{
3104
- type: Schema.Literal<["session-updated"]>;
3093
+ readonly type: Schema.Literal<"session-updated">;
3105
3094
  }>, Schema.Struct<{
3106
- type: Schema.Literal<["speech-started", "speech-stopped"]>;
3107
- itemId: Schema.optional<typeof Schema.String>;
3095
+ readonly type: Schema.Literals<readonly ["speech-started", "speech-stopped"]>;
3096
+ readonly itemId: Schema.optional<Schema.String>;
3108
3097
  }>, Schema.Struct<{
3109
- type: Schema.Literal<["audio-committed"]>;
3110
- itemId: Schema.optional<typeof Schema.String>;
3111
- previousItemId: Schema.optional<typeof Schema.String>;
3098
+ readonly type: Schema.Literal<"audio-committed">;
3099
+ readonly itemId: Schema.optional<Schema.String>;
3100
+ readonly previousItemId: Schema.optional<Schema.String>;
3112
3101
  }>, Schema.Struct<{
3113
- itemId: typeof Schema.String;
3114
- type: Schema.Literal<["conversation-item-added"]>;
3102
+ readonly itemId: Schema.String;
3103
+ readonly type: Schema.Literal<"conversation-item-added">;
3115
3104
  }>, Schema.Struct<{
3116
- transcript: typeof Schema.String;
3117
- itemId: typeof Schema.String;
3118
- type: Schema.Literal<["input-transcription-completed"]>;
3105
+ readonly transcript: Schema.String;
3106
+ readonly itemId: Schema.String;
3107
+ readonly type: Schema.Literal<"input-transcription-completed">;
3119
3108
  }>, Schema.Struct<{
3120
- type: Schema.Literal<["response-created"]>;
3121
- responseId: typeof Schema.String;
3109
+ readonly type: Schema.Literal<"response-created">;
3110
+ readonly responseId: Schema.String;
3122
3111
  }>, Schema.Struct<{
3123
- type: Schema.Literal<["response-done"]>;
3124
- responseId: typeof Schema.String;
3125
- status: typeof Schema.String;
3112
+ readonly type: Schema.Literal<"response-done">;
3113
+ readonly responseId: Schema.String;
3114
+ readonly status: Schema.String;
3126
3115
  }>, 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"]>;
3116
+ readonly itemId: Schema.String;
3117
+ readonly responseId: Schema.String;
3118
+ readonly type: Schema.Literals<readonly ["output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"]>;
3130
3119
  }>, 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"]>;
3120
+ readonly delta: Schema.String;
3121
+ readonly itemId: Schema.String;
3122
+ readonly responseId: Schema.String;
3123
+ readonly type: Schema.Literal<"audio-delta">;
3135
3124
  }>, 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"]>;
3125
+ readonly delta: Schema.String;
3126
+ readonly itemId: Schema.String;
3127
+ readonly responseId: Schema.String;
3128
+ readonly type: Schema.Literals<readonly ["text-delta", "audio-transcript-delta"]>;
3140
3129
  }>, 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"]>;
3130
+ readonly text: Schema.optional<Schema.String>;
3131
+ readonly itemId: Schema.String;
3132
+ readonly responseId: Schema.String;
3133
+ readonly type: Schema.Literal<"text-done">;
3145
3134
  }>, 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"]>;
3135
+ readonly transcript: Schema.optional<Schema.String>;
3136
+ readonly itemId: Schema.String;
3137
+ readonly responseId: Schema.String;
3138
+ readonly type: Schema.Literal<"audio-transcript-done">;
3150
3139
  }>]>;
3151
3140
 
3152
3141
  export declare type RealtimeServerEvent = typeof RealtimeServerEvent.Type;
@@ -3221,10 +3210,10 @@ export declare const recordReads: <S extends QueryableStore>(store: S) => ReadRe
3221
3210
  /**
3222
3211
  * Redis-backed resumable-stream store — the production "resumable via
3223
3212
  * 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
3213
+ * (`RPUSH` to append, bounded `LRANGE` pages to read past a verified cursor;
3214
+ * failed writes leaving sequence holes fall back to paged filtering). Exactly
3215
+ * ONE producer appends, elected by `claimProducer` = `SET … NX`. TTL (default
3216
+ * 1h) evicts finished/abandoned streams without a
3228
3217
  * sweep. A drop-in for `dataStoreResumableStreamStore` against the same
3229
3218
  * `ResumableStreamStore` interface.
3230
3219
  */
@@ -3518,6 +3507,7 @@ export declare interface ResumableStreamOptions {
3518
3507
  /** Replay events past this `seq` before tailing (a reconnect cursor). */
3519
3508
  readonly fromSeq?: number;
3520
3509
  readonly pollMs?: number;
3510
+ readonly maxPollMs?: number;
3521
3511
  readonly idleTimeoutMs?: number;
3522
3512
  }
3523
3513
 
@@ -3537,8 +3527,10 @@ export declare interface ResumableStreamStore {
3537
3527
  readonly claimProducer: (streamId: string) => Effect.Effect<boolean>;
3538
3528
  /** Append one event at its `seq`. Producer-only. */
3539
3529
  readonly append: (streamId: string, ev: SeqEvent) => Effect.Effect<void>;
3530
+ /** Persist a source chunk in bounded bulk operations when supported. */
3531
+ readonly appendMany?: (streamId: string, events: ReadonlyArray<SeqEvent>) => Effect.Effect<void>;
3540
3532
  /** Persisted events with `seq > afterSeq`, ascending. */
3541
- readonly read: (streamId: string, afterSeq: number) => Effect.Effect<ReadonlyArray<SeqEvent>>;
3533
+ readonly read: (streamId: string, afterSeq: number, limit?: number) => Effect.Effect<ReadonlyArray<SeqEvent>>;
3542
3534
  /** Mark the stream complete — the producer reached a terminal event. */
3543
3535
  readonly markDone: (streamId: string) => Effect.Effect<void>;
3544
3536
  /** Whether the producer has finished (all events are persisted). */
@@ -3553,6 +3545,7 @@ export declare const resumableStreamText: (args: {
3553
3545
  readonly options: StreamTextOptions;
3554
3546
  readonly fromSeq?: number;
3555
3547
  readonly pollMs?: number;
3548
+ readonly maxPollMs?: number;
3556
3549
  readonly idleTimeoutMs?: number;
3557
3550
  }) => Stream.Stream<SeqEvent>;
3558
3551
 
@@ -3808,60 +3801,60 @@ export declare interface SemanticUsage {
3808
3801
  * client bundle.
3809
3802
  */
3810
3803
  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;
3804
+ readonly seq: Schema.Number;
3805
+ readonly event: Schema.Union<readonly [Schema.Struct<{
3806
+ readonly _tag: Schema.Literal<"token">;
3807
+ readonly text: Schema.String;
3815
3808
  }>, Schema.Struct<{
3816
- _tag: Schema.Literal<["reasoning"]>;
3817
- text: typeof Schema.String;
3809
+ readonly _tag: Schema.Literal<"reasoning">;
3810
+ readonly text: Schema.String;
3818
3811
  }>, Schema.Struct<{
3819
- _tag: Schema.Literal<["toolCall"]>;
3820
- id: typeof Schema.String;
3821
- name: typeof Schema.String;
3822
- input: typeof Schema.Unknown;
3812
+ readonly _tag: Schema.Literal<"toolCall">;
3813
+ readonly id: Schema.String;
3814
+ readonly name: Schema.String;
3815
+ readonly input: Schema.Unknown;
3823
3816
  }>, 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>;
3817
+ readonly _tag: Schema.Literal<"toolResult">;
3818
+ readonly id: Schema.String;
3819
+ readonly name: Schema.String;
3820
+ readonly output: Schema.optional<Schema.Unknown>;
3821
+ readonly error: Schema.optional<Schema.String>;
3829
3822
  }>, 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>;
3823
+ readonly _tag: Schema.Literal<"source">;
3824
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
3825
+ readonly id: Schema.String;
3826
+ readonly url: Schema.optional<Schema.String>;
3827
+ readonly title: Schema.optional<Schema.String>;
3828
+ readonly mediaType: Schema.optional<Schema.String>;
3829
+ readonly filename: Schema.optional<Schema.String>;
3837
3830
  /** Provider-owned citation attribution; not normalized or interpreted. */
3838
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
3831
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
3839
3832
  }>, Schema.Struct<{
3840
- _tag: Schema.Literal<["file"]>;
3841
- mediaType: typeof Schema.String;
3842
- data: typeof Schema.String;
3833
+ readonly _tag: Schema.Literal<"file">;
3834
+ readonly mediaType: Schema.String;
3835
+ readonly data: Schema.String;
3843
3836
  /** Metadata for this file, not the whole model step. */
3844
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
3837
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
3845
3838
  }>, Schema.Struct<{
3846
- _tag: Schema.Literal<["stepMetadata"]>;
3847
- step: Schema.filter<typeof Schema.Int>;
3848
- providerMetadata: typeof Schema.Unknown;
3839
+ readonly _tag: Schema.Literal<"stepMetadata">;
3840
+ readonly step: Schema.Int;
3841
+ readonly providerMetadata: Schema.Unknown;
3849
3842
  }>, Schema.Struct<{
3850
- _tag: Schema.Literal<["message"]>;
3851
- role: typeof Schema.String;
3852
- content: typeof Schema.String;
3843
+ readonly _tag: Schema.Literal<"message">;
3844
+ readonly role: Schema.String;
3845
+ readonly content: Schema.String;
3853
3846
  }>, 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;
3847
+ readonly _tag: Schema.Literal<"error">;
3848
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
3849
+ readonly message: Schema.String;
3850
+ readonly retryable: Schema.Boolean;
3858
3851
  }>, 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>;
3852
+ readonly _tag: Schema.Literal<"done">;
3853
+ readonly finishReason: Schema.String;
3854
+ readonly usage: Schema.Struct<{
3855
+ readonly inputTokens: Schema.optional<Schema.Number>;
3856
+ readonly outputTokens: Schema.optional<Schema.Number>;
3857
+ readonly totalTokens: Schema.optional<Schema.Number>;
3865
3858
  }>;
3866
3859
  }>]>;
3867
3860
  }>;
@@ -4144,18 +4137,18 @@ export declare const toModelInfo: (e: GatewayLanguageModelEntry) => GatewayModel
4144
4137
  * CLI discovery path passes the real `AppContext`, which is a superset.
4145
4138
  *
4146
4139
  * `runtime` is the caller's ambient Effect `Runtime`. When present, tool
4147
- * bodies are run through it (`Runtime.runPromise(runtime)(eff)`) instead of
4140
+ * bodies are run through it (`Effect.runPromiseWith(runtime)(eff)`) instead of
4148
4141
  * bare `Effect.runPromise`, so a body may `yield*` any service the caller's
4149
4142
  * runtime carries — `JiraService`, the data store layer, `HttpClient`, … —
4150
4143
  * rather than being limited to `R = never`. The agent loop
4151
- * (`streamText`/`runAssistant`) captures `yield* Effect.runtime()` and threads
4144
+ * (`streamText`/`runAssistant`) captures `yield* Effect.context<never>()` and threads
4152
4145
  * it here; without a runtime, behaviour is unchanged. */
4153
4146
  export declare interface ToolContext {
4154
4147
  readonly store: unknown;
4155
4148
  readonly request?: {
4156
4149
  readonly subject?: unknown;
4157
4150
  };
4158
- readonly runtime?: Runtime.Runtime<unknown>;
4151
+ readonly runtime?: Context.Context<never>;
4159
4152
  /** SDK tool-call identity for this execution, not a durable application idempotency key. */
4160
4153
  readonly invocationId?: string;
4161
4154
  /** Cancellation from either the caller's turn or SDK invocation; Promise handlers must pass it to their I/O. */
@@ -4165,7 +4158,7 @@ export declare interface ToolContext {
4165
4158
  export declare interface ToolDef<A, I, O> {
4166
4159
  readonly name: string;
4167
4160
  readonly description: string;
4168
- readonly input: Schema.Schema<A, I>;
4161
+ readonly input: Schema.Codec<A, I>;
4169
4162
  /**
4170
4163
  * A ready-made JSON Schema for the tool's parameters, used INSTEAD of
4171
4164
  * rendering `input`.
@@ -4180,7 +4173,7 @@ export declare interface ToolDef<A, I, O> {
4180
4173
  readonly inputJsonSchema?: Record<string, unknown>;
4181
4174
  /** Optional result schema. When set, `buildSdkTools` decodes the body's
4182
4175
  * output through it before handing the value back to the model. */
4183
- readonly output?: Schema.Schema.Any;
4176
+ readonly output?: Schema.Top;
4184
4177
  /** Inline body: returns an Effect. May declare service deps on the R
4185
4178
  * channel — they are provided by the caller's runtime
4186
4179
  * (`ctx.runtime`) at execution time. */
@@ -4299,42 +4292,40 @@ export declare type TranscriptionSource =
4299
4292
  export declare class TranscriptionStreamError extends TranscriptionStreamError_base {
4300
4293
  }
4301
4294
 
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
- }>;
4295
+ declare const TranscriptionStreamError_base: Schema.Class<TranscriptionStreamError, Schema.TaggedStruct<"TranscriptionStreamError", {
4296
+ readonly reason: Schema.Literals<readonly ["input", "unsupported", "provider", "cancelled"]>;
4297
+ readonly message: Schema.String;
4298
+ }>, YieldableError>;
4308
4299
 
4309
4300
  /** 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"]>;
4301
+ export declare const TranscriptionStreamEvent: Schema.Union<readonly [Schema.Struct<{
4302
+ readonly delta: Schema.String;
4303
+ readonly id: Schema.optional<Schema.String>;
4304
+ readonly type: Schema.Literal<"transcript-delta">;
4314
4305
  }>, 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"]>;
4306
+ readonly text: Schema.String;
4307
+ readonly startSecond: Schema.optional<Schema.Number>;
4308
+ readonly durationInSeconds: Schema.optional<Schema.Number>;
4309
+ readonly channelIndex: Schema.optional<Schema.Number>;
4310
+ readonly id: Schema.optional<Schema.String>;
4311
+ readonly type: Schema.Literal<"transcript-partial">;
4321
4312
  }>, 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"]>;
4313
+ readonly text: Schema.String;
4314
+ readonly startSecond: Schema.optional<Schema.Number>;
4315
+ readonly endSecond: Schema.optional<Schema.Number>;
4316
+ readonly channelIndex: Schema.optional<Schema.Number>;
4317
+ readonly id: Schema.optional<Schema.String>;
4318
+ readonly type: Schema.Literal<"transcript-final">;
4328
4319
  }>, 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;
4320
+ readonly type: Schema.Literal<"finish">;
4321
+ readonly text: Schema.String;
4322
+ readonly segments: Schema.$Array<Schema.Struct<{
4323
+ readonly text: Schema.String;
4324
+ readonly start: Schema.Number;
4325
+ readonly end: Schema.Number;
4335
4326
  }>>;
4336
- language: Schema.optional<typeof Schema.String>;
4337
- durationSec: Schema.optional<typeof Schema.Number>;
4327
+ readonly language: Schema.optional<Schema.String>;
4328
+ readonly durationSec: Schema.optional<Schema.Number>;
4338
4329
  }>]>;
4339
4330
 
4340
4331
  export declare type TranscriptionStreamEvent = typeof TranscriptionStreamEvent.Type;