@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/embed.js ADDED
@@ -0,0 +1,41 @@
1
+ import { aiGenerationError as e } from "./api.js";
2
+ import { embeddingProviderFromEnv as t, resolveEmbeddingModel as n } from "./embeddingProvider.js";
3
+ import { cosineSimilarity as r, embed as i, embedMany as a } from "ai";
4
+ import { Effect as o } from "effect";
5
+ //#region src/embed.ts
6
+ var s = (r, a) => o.tryPromise({
7
+ try: async (e) => {
8
+ let o = a ?? t();
9
+ l(o.expectedDimensions);
10
+ let s = await n(o), c = await i({
11
+ model: s,
12
+ value: r,
13
+ abortSignal: e,
14
+ ...o.providerOptions === void 0 ? {} : { providerOptions: o.providerOptions }
15
+ });
16
+ return u(c.embedding, o.expectedDimensions, 0), c.embedding;
17
+ },
18
+ catch: (t) => e(t)
19
+ }), c = (r, i) => o.tryPromise({
20
+ try: async (e) => {
21
+ let o = i ?? t();
22
+ l(o.expectedDimensions);
23
+ let s = await n(o), c = await a({
24
+ model: s,
25
+ values: [...r],
26
+ abortSignal: e,
27
+ ...o.providerOptions === void 0 ? {} : { providerOptions: o.providerOptions }
28
+ });
29
+ if (c.embeddings.length !== r.length) throw Error(`embedMany: expected ${r.length} vectors, received ${c.embeddings.length}`);
30
+ return c.embeddings.forEach((e, t) => u(e, o.expectedDimensions, t)), c.embeddings;
31
+ },
32
+ catch: (t) => e(t)
33
+ }), l = (e) => {
34
+ if (e !== void 0 && (!Number.isSafeInteger(e) || e <= 0)) throw Error("embedding expectedDimensions must be a positive safe integer");
35
+ }, u = (e, t, n) => {
36
+ if (!Array.isArray(e)) throw Error(`embedding ${n}: expected a vector array`);
37
+ if (t !== void 0 && e.length !== t) throw Error(`embedding ${n}: expected ${t} dimensions, received ${e.length}`);
38
+ if (e.length === 0 || e.some((e) => !Number.isFinite(e))) throw Error(`embedding ${n}: expected a non-empty vector of finite numbers`);
39
+ }, d = (e, t) => r([...e], [...t]);
40
+ //#endregion
41
+ export { d as cosineSimilarity, s as embed, c as embedMany };
@@ -0,0 +1,51 @@
1
+ import { createGateway as e, gateway as t } from "@ai-sdk/gateway";
2
+ //#region src/embeddingProvider.ts
3
+ var n = (e, t) => ({
4
+ specificationVersion: "v4",
5
+ provider: "mock",
6
+ modelId: e,
7
+ maxEmbeddingsPerCall: 2048,
8
+ supportsParallelCalls: !0,
9
+ doEmbed: async ({ values: e }) => ({
10
+ embeddings: e.map((e) => r(e, t)),
11
+ usage: { tokens: e.reduce((e, t) => e + t.length, 0) },
12
+ warnings: []
13
+ })
14
+ }), r = (e, t) => {
15
+ let n = Array(t);
16
+ for (let r = 0; r < t; r++) {
17
+ let t = 2166136261 ^ r * 16777619;
18
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
19
+ n[r] = (t >>> 0) / 4294967295 * 2 - 1;
20
+ }
21
+ return n;
22
+ }, i = async (r) => {
23
+ switch (r.name) {
24
+ case "mock": return n(r.model, r.mockDim ?? 8);
25
+ case "openai": return (await a("@ai-sdk/openai", "openai")).openai.textEmbeddingModel(r.model);
26
+ case "voyage": return (await a("voyage-ai-provider", "voyage")).voyage.textEmbeddingModel(r.model);
27
+ case "cohere": return (await a("@ai-sdk/cohere", "cohere")).cohere.textEmbeddingModel(r.model);
28
+ case "gateway": return (r.apiKey !== void 0 || r.baseURL !== void 0 ? e({
29
+ ...r.apiKey === void 0 ? {} : { apiKey: r.apiKey },
30
+ ...r.baseURL === void 0 ? {} : { baseURL: r.baseURL }
31
+ }) : t).embeddingModel(r.model);
32
+ }
33
+ }, a = async (e, t) => {
34
+ try {
35
+ return await import(
36
+ /* @vite-ignore */
37
+ e
38
+ );
39
+ } catch {
40
+ throw Error(`embedding provider '${t}' needs the '${e}' package — install it (pnpm add ${e}) or use AI_EMBED_PROVIDER=mock for tests/demos.`);
41
+ }
42
+ }, o = (e = process.env) => {
43
+ let t = (e.AI_EMBED_PROVIDER ?? "mock").toLowerCase(), n = t === "openai" ? "text-embedding-3-small" : t === "voyage" ? "voyage-3" : t === "cohere" ? "embed-english-v3.0" : t === "gateway" ? "openai/text-embedding-3-small" : "mock", r = e.AI_EMBED_MODEL ?? n, i = e.AI_EMBED_MOCK_DIM === void 0 ? void 0 : Number(e.AI_EMBED_MOCK_DIM);
44
+ return {
45
+ name: t,
46
+ model: r,
47
+ ...i !== void 0 && Number.isFinite(i) ? { mockDim: i } : {}
48
+ };
49
+ };
50
+ //#endregion
51
+ export { o as embeddingProviderFromEnv, r as hashToVector, i as resolveEmbeddingModel };
package/dist/eval.js ADDED
@@ -0,0 +1,130 @@
1
+ import { providerFromEnv as e } from "./provider.js";
2
+ import { generateObject as t } from "./api.js";
3
+ import { Effect as n, Schema as r } from "effect";
4
+ //#region src/eval.ts
5
+ var i = (e) => {
6
+ if (e.name.trim() === "") throw Error("defineEval: name must be non-empty");
7
+ if (e.cases.length === 0) throw Error(`defineEval "${e.name}": at least one case is required`);
8
+ let t = /* @__PURE__ */ new Set();
9
+ for (let n of e.cases) {
10
+ if (n.id.trim() === "") throw Error(`defineEval "${e.name}": every case needs a non-empty id`);
11
+ if (t.has(n.id)) throw Error(`defineEval "${e.name}": duplicate case id "${n.id}"`);
12
+ t.add(n.id);
13
+ }
14
+ let n = e.judge?.threshold;
15
+ if (n !== void 0 && (n < 0 || n > 1)) throw Error(`defineEval "${e.name}": judge.threshold must be within 0..1 (got ${n})`);
16
+ return {
17
+ ...e,
18
+ __eval: !0
19
+ };
20
+ }, a = (e) => typeof e == "object" && !!e && "__eval" in e && e.__eval === !0, o = (e, t) => {
21
+ let n = [], r = e.text;
22
+ for (let i of t) switch (i.kind) {
23
+ case "contains": {
24
+ let e = i.caseInsensitive ? r.toLowerCase() : r, t = i.caseInsensitive ? i.value.toLowerCase() : i.value;
25
+ e.includes(t) || n.push({
26
+ assertion: i,
27
+ detail: `output does not contain "${i.value}"`
28
+ });
29
+ break;
30
+ }
31
+ case "notContains": {
32
+ let e = i.caseInsensitive ? r.toLowerCase() : r, t = i.caseInsensitive ? i.value.toLowerCase() : i.value;
33
+ e.includes(t) && n.push({
34
+ assertion: i,
35
+ detail: `output unexpectedly contains "${i.value}"`
36
+ });
37
+ break;
38
+ }
39
+ case "matches": {
40
+ let e;
41
+ try {
42
+ e = new RegExp(i.pattern, i.flags);
43
+ } catch (e) {
44
+ n.push({
45
+ assertion: i,
46
+ detail: `invalid pattern /${i.pattern}/: ${e.message}`
47
+ });
48
+ break;
49
+ }
50
+ e.test(r) || n.push({
51
+ assertion: i,
52
+ detail: `output does not match /${i.pattern}/`
53
+ });
54
+ break;
55
+ }
56
+ case "equals":
57
+ (i.trim ? r.trim() : r) !== (i.trim ? i.value.trim() : i.value) && n.push({
58
+ assertion: i,
59
+ detail: "output is not equal to the expected value"
60
+ });
61
+ break;
62
+ case "maxLatencyMs":
63
+ e.latencyMs > i.value && n.push({
64
+ assertion: i,
65
+ detail: `latency ${e.latencyMs}ms exceeds ${i.value}ms`
66
+ });
67
+ break;
68
+ case "nonEmpty": r.trim() === "" && n.push({
69
+ assertion: i,
70
+ detail: "output is empty"
71
+ });
72
+ }
73
+ return n;
74
+ }, s = .7, c = (e, t, n, r, i) => {
75
+ let a = o(t, [...n, ...e.assert ?? []]), s = r?.threshold ?? .7, c = i === void 0 || i.score >= s;
76
+ return {
77
+ id: e.id,
78
+ pass: a.length === 0 && c,
79
+ assertionFailures: a,
80
+ ...i === void 0 ? {} : { judge: i },
81
+ output: t
82
+ };
83
+ }, l = async (e, t) => {
84
+ let n = [];
85
+ for (let r of e.cases) {
86
+ let i = await t.replay({
87
+ case: r,
88
+ def: e
89
+ }), a = e.judge !== void 0 && t.judge !== void 0 ? await t.judge({
90
+ case: r,
91
+ output: i,
92
+ config: e.judge
93
+ }) : void 0;
94
+ n.push(c(r, i, e.assert ?? [], e.judge, a));
95
+ }
96
+ let r = n.filter((e) => !e.pass).length;
97
+ return {
98
+ name: e.name,
99
+ ok: r === 0,
100
+ passed: n.length - r,
101
+ failed: r,
102
+ cases: n,
103
+ ...t.branchId === void 0 ? {} : { branch: { id: t.branchId } }
104
+ };
105
+ }, u = r.Struct({
106
+ pass: r.Boolean,
107
+ score: r.Number,
108
+ reason: r.String
109
+ }), d = (e, t, n) => [
110
+ "You are grading an AI assistant response against a rubric. Respond with a JSON",
111
+ "object { pass: boolean, score: number (0..1), reason: string }. Score 1 is a",
112
+ "perfect response, 0 is unusable. Be strict: a plausible-sounding but wrong or",
113
+ "incomplete answer scores low.",
114
+ "",
115
+ `RUBRIC:\n${n.rubric}`,
116
+ ...e.golden === void 0 ? [] : ["", `REFERENCE (the previously-accepted answer):\n${e.golden}`],
117
+ ...e.input.prompt === "" ? [] : ["", `USER PROMPT:\n${e.input.prompt}`],
118
+ "",
119
+ `CANDIDATE RESPONSE (to grade):\n${t.text}`
120
+ ].join("\n"), f = async ({ case: r, output: i, config: a }) => await n.runPromise(t({
121
+ schema: u,
122
+ prompt: d(r, i, a),
123
+ provider: e()
124
+ }).pipe(n.map((e) => e.object), n.catch((e) => n.succeed({
125
+ pass: !1,
126
+ score: 0,
127
+ reason: `judge failed: ${e.message}`
128
+ }))));
129
+ //#endregion
130
+ export { s as DEFAULT_JUDGE_THRESHOLD, i as defineEval, o as evaluateAssertions, a as isEvalDefinition, f as llmJudge, l as runEval, c as scoreCase };
package/dist/events.d.ts CHANGED
@@ -1,63 +1,66 @@
1
1
  import { Schema } from 'effect';
2
+ import { YieldableError } from 'effect/Cause';
2
3
 
3
4
  /** Error taxonomy. `retryable` on the event drives client/agent retry. */
4
- export declare const AgentErrorCode: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
5
+ export declare const AgentErrorCode: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
5
6
 
6
7
  export declare type AgentErrorCode = typeof AgentErrorCode.Type;
7
8
 
8
- export declare const AgentEvent: Schema.Union<[Schema.Struct<{
9
- _tag: Schema.Literal<["token"]>;
10
- text: typeof Schema.String;
9
+ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
10
+ readonly _tag: Schema.Literal<"token">;
11
+ readonly text: Schema.String;
11
12
  }>, Schema.Struct<{
12
- _tag: Schema.Literal<["reasoning"]>;
13
- text: typeof Schema.String;
13
+ readonly _tag: Schema.Literal<"reasoning">;
14
+ readonly text: Schema.String;
14
15
  }>, Schema.Struct<{
15
- _tag: Schema.Literal<["toolCall"]>;
16
- id: typeof Schema.String;
17
- name: typeof Schema.String;
18
- input: typeof Schema.Unknown;
16
+ readonly _tag: Schema.Literal<"toolCall">;
17
+ readonly id: Schema.String;
18
+ readonly name: Schema.String;
19
+ readonly input: Schema.Unknown;
20
+ /** Present when the caller must execute this pending call. */
21
+ readonly execution: Schema.optional<Schema.Literal<"client">>;
19
22
  }>, Schema.Struct<{
20
- _tag: Schema.Literal<["toolResult"]>;
21
- id: typeof Schema.String;
22
- name: typeof Schema.String;
23
- output: Schema.optional<typeof Schema.Unknown>;
24
- error: Schema.optional<typeof Schema.String>;
23
+ readonly _tag: Schema.Literal<"toolResult">;
24
+ readonly id: Schema.String;
25
+ readonly name: Schema.String;
26
+ readonly output: Schema.optional<Schema.Unknown>;
27
+ readonly error: Schema.optional<Schema.String>;
25
28
  }>, Schema.Struct<{
26
- _tag: Schema.Literal<["source"]>;
27
- sourceType: Schema.Literal<["url", "document"]>;
28
- id: typeof Schema.String;
29
- url: Schema.optional<typeof Schema.String>;
30
- title: Schema.optional<typeof Schema.String>;
31
- mediaType: Schema.optional<typeof Schema.String>;
32
- filename: Schema.optional<typeof Schema.String>;
29
+ readonly _tag: Schema.Literal<"source">;
30
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
31
+ readonly id: Schema.String;
32
+ readonly url: Schema.optional<Schema.String>;
33
+ readonly title: Schema.optional<Schema.String>;
34
+ readonly mediaType: Schema.optional<Schema.String>;
35
+ readonly filename: Schema.optional<Schema.String>;
33
36
  /** Provider-owned citation attribution; not normalized or interpreted. */
34
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
37
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
35
38
  }>, Schema.Struct<{
36
- _tag: Schema.Literal<["file"]>;
37
- mediaType: typeof Schema.String;
38
- data: typeof Schema.String;
39
+ readonly _tag: Schema.Literal<"file">;
40
+ readonly mediaType: Schema.String;
41
+ readonly data: Schema.String;
39
42
  /** Metadata for this file, not the whole model step. */
40
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
43
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
41
44
  }>, Schema.Struct<{
42
- _tag: Schema.Literal<["stepMetadata"]>;
43
- step: Schema.filter<typeof Schema.Int>;
44
- providerMetadata: typeof Schema.Unknown;
45
+ readonly _tag: Schema.Literal<"stepMetadata">;
46
+ readonly step: Schema.Int;
47
+ readonly providerMetadata: Schema.Unknown;
45
48
  }>, Schema.Struct<{
46
- _tag: Schema.Literal<["message"]>;
47
- role: typeof Schema.String;
48
- content: typeof Schema.String;
49
+ readonly _tag: Schema.Literal<"message">;
50
+ readonly role: Schema.String;
51
+ readonly content: Schema.String;
49
52
  }>, Schema.Struct<{
50
- _tag: Schema.Literal<["error"]>;
51
- code: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
52
- message: typeof Schema.String;
53
- retryable: typeof Schema.Boolean;
53
+ readonly _tag: Schema.Literal<"error">;
54
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
55
+ readonly message: Schema.String;
56
+ readonly retryable: Schema.Boolean;
54
57
  }>, Schema.Struct<{
55
- _tag: Schema.Literal<["done"]>;
56
- finishReason: typeof Schema.String;
57
- usage: Schema.Struct<{
58
- inputTokens: Schema.optional<typeof Schema.Number>;
59
- outputTokens: Schema.optional<typeof Schema.Number>;
60
- totalTokens: Schema.optional<typeof Schema.Number>;
58
+ readonly _tag: Schema.Literal<"done">;
59
+ readonly finishReason: Schema.String;
60
+ readonly usage: Schema.Struct<{
61
+ readonly inputTokens: Schema.optional<Schema.Number>;
62
+ readonly outputTokens: Schema.optional<Schema.Number>;
63
+ readonly totalTokens: Schema.optional<Schema.Number>;
61
64
  }>;
62
65
  }>]>;
63
66
 
@@ -65,81 +68,81 @@ export declare type AgentEvent = typeof AgentEvent.Type;
65
68
 
66
69
  /** Browser-safe input allowlist. Session configuration and provider credentials
67
70
  * belong to the server, never to events received from the browser. */
68
- export declare const RealtimeClientEvent: Schema.Union<[Schema.Struct<{
69
- type: Schema.Literal<["input-audio-append"]>;
70
- audio: Schema.filter<typeof Schema.String>;
71
+ export declare const RealtimeClientEvent: Schema.Union<readonly [Schema.Struct<{
72
+ readonly type: Schema.Literal<"input-audio-append">;
73
+ readonly audio: Schema.String;
71
74
  }>, Schema.Struct<{
72
- type: Schema.Literal<["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
75
+ readonly type: Schema.Literals<readonly ["input-audio-commit", "input-audio-clear", "response-create", "response-cancel"]>;
73
76
  }>, Schema.Struct<{
74
- type: Schema.Literal<["conversation-item-create"]>;
75
- item: Schema.Struct<{
76
- type: Schema.Literal<["text-message"]>;
77
- role: Schema.Literal<["user"]>;
78
- text: typeof Schema.String;
77
+ readonly type: Schema.Literal<"conversation-item-create">;
78
+ readonly item: Schema.Struct<{
79
+ readonly type: Schema.Literal<"text-message">;
80
+ readonly role: Schema.Literal<"user">;
81
+ readonly text: Schema.String;
79
82
  }>;
80
83
  }>, Schema.Struct<{
81
- type: Schema.Literal<["conversation-item-truncate"]>;
82
- itemId: typeof Schema.String;
83
- contentIndex: Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>;
84
- audioEndMs: Schema.filter<Schema.filter<typeof Schema.Number>>;
84
+ readonly type: Schema.Literal<"conversation-item-truncate">;
85
+ readonly itemId: Schema.String;
86
+ readonly contentIndex: Schema.Number;
87
+ readonly audioEndMs: Schema.Number;
85
88
  }>]>;
86
89
 
87
90
  export declare type RealtimeClientEvent = typeof RealtimeClientEvent.Type;
88
91
 
89
92
  /** Safe, normalized server events. No raw provider payload, client secret,
90
93
  * arbitrary conversation item or provider error message crosses this surface. */
91
- export declare const RealtimeServerEvent: Schema.Union<[Schema.Struct<{
92
- type: Schema.Literal<["ready"]>;
94
+ export declare const RealtimeServerEvent: Schema.Union<readonly [Schema.Struct<{
95
+ readonly type: Schema.Literal<"ready">;
93
96
  }>, Schema.Struct<{
94
- type: Schema.Literal<["session-created"]>;
95
- sessionId: Schema.optional<typeof Schema.String>;
97
+ readonly type: Schema.Literal<"session-created">;
98
+ readonly sessionId: Schema.optional<Schema.String>;
96
99
  }>, Schema.Struct<{
97
- type: Schema.Literal<["session-updated"]>;
100
+ readonly type: Schema.Literal<"session-updated">;
98
101
  }>, Schema.Struct<{
99
- type: Schema.Literal<["speech-started", "speech-stopped"]>;
100
- itemId: Schema.optional<typeof Schema.String>;
102
+ readonly type: Schema.Literals<readonly ["speech-started", "speech-stopped"]>;
103
+ readonly itemId: Schema.optional<Schema.String>;
101
104
  }>, Schema.Struct<{
102
- type: Schema.Literal<["audio-committed"]>;
103
- itemId: Schema.optional<typeof Schema.String>;
104
- previousItemId: Schema.optional<typeof Schema.String>;
105
+ readonly type: Schema.Literal<"audio-committed">;
106
+ readonly itemId: Schema.optional<Schema.String>;
107
+ readonly previousItemId: Schema.optional<Schema.String>;
105
108
  }>, Schema.Struct<{
106
- itemId: typeof Schema.String;
107
- type: Schema.Literal<["conversation-item-added"]>;
109
+ readonly itemId: Schema.String;
110
+ readonly type: Schema.Literal<"conversation-item-added">;
108
111
  }>, Schema.Struct<{
109
- transcript: typeof Schema.String;
110
- itemId: typeof Schema.String;
111
- type: Schema.Literal<["input-transcription-completed"]>;
112
+ readonly transcript: Schema.String;
113
+ readonly itemId: Schema.String;
114
+ readonly type: Schema.Literal<"input-transcription-completed">;
112
115
  }>, Schema.Struct<{
113
- type: Schema.Literal<["response-created"]>;
114
- responseId: typeof Schema.String;
116
+ readonly type: Schema.Literal<"response-created">;
117
+ readonly responseId: Schema.String;
115
118
  }>, Schema.Struct<{
116
- type: Schema.Literal<["response-done"]>;
117
- responseId: typeof Schema.String;
118
- status: typeof Schema.String;
119
+ readonly type: Schema.Literal<"response-done">;
120
+ readonly responseId: Schema.String;
121
+ readonly status: Schema.String;
119
122
  }>, Schema.Struct<{
120
- itemId: typeof Schema.String;
121
- responseId: typeof Schema.String;
122
- type: Schema.Literal<["output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"]>;
123
+ readonly itemId: Schema.String;
124
+ readonly responseId: Schema.String;
125
+ readonly type: Schema.Literals<readonly ["output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"]>;
123
126
  }>, Schema.Struct<{
124
- delta: Schema.filter<typeof Schema.String>;
125
- itemId: typeof Schema.String;
126
- responseId: typeof Schema.String;
127
- type: Schema.Literal<["audio-delta"]>;
127
+ readonly delta: Schema.String;
128
+ readonly itemId: Schema.String;
129
+ readonly responseId: Schema.String;
130
+ readonly type: Schema.Literal<"audio-delta">;
128
131
  }>, Schema.Struct<{
129
- delta: typeof Schema.String;
130
- itemId: typeof Schema.String;
131
- responseId: typeof Schema.String;
132
- type: Schema.Literal<["text-delta", "audio-transcript-delta"]>;
132
+ readonly delta: Schema.String;
133
+ readonly itemId: Schema.String;
134
+ readonly responseId: Schema.String;
135
+ readonly type: Schema.Literals<readonly ["text-delta", "audio-transcript-delta"]>;
133
136
  }>, Schema.Struct<{
134
- text: Schema.optional<typeof Schema.String>;
135
- itemId: typeof Schema.String;
136
- responseId: typeof Schema.String;
137
- type: Schema.Literal<["text-done"]>;
137
+ readonly text: Schema.optional<Schema.String>;
138
+ readonly itemId: Schema.String;
139
+ readonly responseId: Schema.String;
140
+ readonly type: Schema.Literal<"text-done">;
138
141
  }>, Schema.Struct<{
139
- transcript: Schema.optional<typeof Schema.String>;
140
- itemId: typeof Schema.String;
141
- responseId: typeof Schema.String;
142
- type: Schema.Literal<["audio-transcript-done"]>;
142
+ readonly transcript: Schema.optional<Schema.String>;
143
+ readonly itemId: Schema.String;
144
+ readonly responseId: Schema.String;
145
+ readonly type: Schema.Literal<"audio-transcript-done">;
143
146
  }>]>;
144
147
 
145
148
  export declare type RealtimeServerEvent = typeof RealtimeServerEvent.Type;
@@ -156,60 +159,62 @@ export declare type RealtimeServerEvent = typeof RealtimeServerEvent.Type;
156
159
  * client bundle.
157
160
  */
158
161
  export declare const SeqEvent: Schema.Struct<{
159
- seq: typeof Schema.Number;
160
- event: Schema.Union<[Schema.Struct<{
161
- _tag: Schema.Literal<["token"]>;
162
- text: typeof Schema.String;
162
+ readonly seq: Schema.Number;
163
+ readonly event: Schema.Union<readonly [Schema.Struct<{
164
+ readonly _tag: Schema.Literal<"token">;
165
+ readonly text: Schema.String;
163
166
  }>, Schema.Struct<{
164
- _tag: Schema.Literal<["reasoning"]>;
165
- text: typeof Schema.String;
167
+ readonly _tag: Schema.Literal<"reasoning">;
168
+ readonly text: Schema.String;
166
169
  }>, Schema.Struct<{
167
- _tag: Schema.Literal<["toolCall"]>;
168
- id: typeof Schema.String;
169
- name: typeof Schema.String;
170
- input: typeof Schema.Unknown;
170
+ readonly _tag: Schema.Literal<"toolCall">;
171
+ readonly id: Schema.String;
172
+ readonly name: Schema.String;
173
+ readonly input: Schema.Unknown;
174
+ /** Present when the caller must execute this pending call. */
175
+ readonly execution: Schema.optional<Schema.Literal<"client">>;
171
176
  }>, Schema.Struct<{
172
- _tag: Schema.Literal<["toolResult"]>;
173
- id: typeof Schema.String;
174
- name: typeof Schema.String;
175
- output: Schema.optional<typeof Schema.Unknown>;
176
- error: Schema.optional<typeof Schema.String>;
177
+ readonly _tag: Schema.Literal<"toolResult">;
178
+ readonly id: Schema.String;
179
+ readonly name: Schema.String;
180
+ readonly output: Schema.optional<Schema.Unknown>;
181
+ readonly error: Schema.optional<Schema.String>;
177
182
  }>, Schema.Struct<{
178
- _tag: Schema.Literal<["source"]>;
179
- sourceType: Schema.Literal<["url", "document"]>;
180
- id: typeof Schema.String;
181
- url: Schema.optional<typeof Schema.String>;
182
- title: Schema.optional<typeof Schema.String>;
183
- mediaType: Schema.optional<typeof Schema.String>;
184
- filename: Schema.optional<typeof Schema.String>;
183
+ readonly _tag: Schema.Literal<"source">;
184
+ readonly sourceType: Schema.Literals<readonly ["url", "document"]>;
185
+ readonly id: Schema.String;
186
+ readonly url: Schema.optional<Schema.String>;
187
+ readonly title: Schema.optional<Schema.String>;
188
+ readonly mediaType: Schema.optional<Schema.String>;
189
+ readonly filename: Schema.optional<Schema.String>;
185
190
  /** Provider-owned citation attribution; not normalized or interpreted. */
186
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
191
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
187
192
  }>, Schema.Struct<{
188
- _tag: Schema.Literal<["file"]>;
189
- mediaType: typeof Schema.String;
190
- data: typeof Schema.String;
193
+ readonly _tag: Schema.Literal<"file">;
194
+ readonly mediaType: Schema.String;
195
+ readonly data: Schema.String;
191
196
  /** Metadata for this file, not the whole model step. */
192
- providerMetadata: Schema.optional<typeof Schema.Unknown>;
197
+ readonly providerMetadata: Schema.optional<Schema.Unknown>;
193
198
  }>, Schema.Struct<{
194
- _tag: Schema.Literal<["stepMetadata"]>;
195
- step: Schema.filter<typeof Schema.Int>;
196
- providerMetadata: typeof Schema.Unknown;
199
+ readonly _tag: Schema.Literal<"stepMetadata">;
200
+ readonly step: Schema.Int;
201
+ readonly providerMetadata: Schema.Unknown;
197
202
  }>, Schema.Struct<{
198
- _tag: Schema.Literal<["message"]>;
199
- role: typeof Schema.String;
200
- content: typeof Schema.String;
203
+ readonly _tag: Schema.Literal<"message">;
204
+ readonly role: Schema.String;
205
+ readonly content: Schema.String;
201
206
  }>, Schema.Struct<{
202
- _tag: Schema.Literal<["error"]>;
203
- code: Schema.Literal<["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
204
- message: typeof Schema.String;
205
- retryable: typeof Schema.Boolean;
207
+ readonly _tag: Schema.Literal<"error">;
208
+ readonly code: Schema.Literals<readonly ["provider", "tool", "timeout", "cancelled", "decode", "internal"]>;
209
+ readonly message: Schema.String;
210
+ readonly retryable: Schema.Boolean;
206
211
  }>, Schema.Struct<{
207
- _tag: Schema.Literal<["done"]>;
208
- finishReason: typeof Schema.String;
209
- usage: Schema.Struct<{
210
- inputTokens: Schema.optional<typeof Schema.Number>;
211
- outputTokens: Schema.optional<typeof Schema.Number>;
212
- totalTokens: Schema.optional<typeof Schema.Number>;
212
+ readonly _tag: Schema.Literal<"done">;
213
+ readonly finishReason: Schema.String;
214
+ readonly usage: Schema.Struct<{
215
+ readonly inputTokens: Schema.optional<Schema.Number>;
216
+ readonly outputTokens: Schema.optional<Schema.Number>;
217
+ readonly totalTokens: Schema.optional<Schema.Number>;
213
218
  }>;
214
219
  }>]>;
215
220
  }>;
@@ -220,42 +225,40 @@ export declare type SeqEvent = typeof SeqEvent.Type;
220
225
  export declare class TranscriptionStreamError extends TranscriptionStreamError_base {
221
226
  }
222
227
 
223
- declare const TranscriptionStreamError_base: Schema.TaggedErrorClass<TranscriptionStreamError, "TranscriptionStreamError", {
224
- readonly _tag: Schema.tag<"TranscriptionStreamError">;
225
- } & {
226
- reason: Schema.Literal<["input", "unsupported", "provider", "cancelled"]>;
227
- message: typeof Schema.String;
228
- }>;
228
+ declare const TranscriptionStreamError_base: Schema.Class<TranscriptionStreamError, Schema.TaggedStruct<"TranscriptionStreamError", {
229
+ readonly reason: Schema.Literals<readonly ["input", "unsupported", "provider", "cancelled"]>;
230
+ readonly message: Schema.String;
231
+ }>, YieldableError>;
229
232
 
230
233
  /** Partial text is replaceable, delta text is append-only, and final text seals a segment. */
231
- export declare const TranscriptionStreamEvent: Schema.Union<[Schema.Struct<{
232
- delta: typeof Schema.String;
233
- id: Schema.optional<typeof Schema.String>;
234
- type: Schema.Literal<["transcript-delta"]>;
234
+ export declare const TranscriptionStreamEvent: Schema.Union<readonly [Schema.Struct<{
235
+ readonly delta: Schema.String;
236
+ readonly id: Schema.optional<Schema.String>;
237
+ readonly type: Schema.Literal<"transcript-delta">;
235
238
  }>, Schema.Struct<{
236
- text: typeof Schema.String;
237
- startSecond: Schema.optional<typeof Schema.Number>;
238
- durationInSeconds: Schema.optional<typeof Schema.Number>;
239
- channelIndex: Schema.optional<typeof Schema.Number>;
240
- id: Schema.optional<typeof Schema.String>;
241
- type: Schema.Literal<["transcript-partial"]>;
239
+ readonly text: Schema.String;
240
+ readonly startSecond: Schema.optional<Schema.Number>;
241
+ readonly durationInSeconds: Schema.optional<Schema.Number>;
242
+ readonly channelIndex: Schema.optional<Schema.Number>;
243
+ readonly id: Schema.optional<Schema.String>;
244
+ readonly type: Schema.Literal<"transcript-partial">;
242
245
  }>, Schema.Struct<{
243
- text: typeof Schema.String;
244
- startSecond: Schema.optional<typeof Schema.Number>;
245
- endSecond: Schema.optional<typeof Schema.Number>;
246
- channelIndex: Schema.optional<typeof Schema.Number>;
247
- id: Schema.optional<typeof Schema.String>;
248
- type: Schema.Literal<["transcript-final"]>;
246
+ readonly text: Schema.String;
247
+ readonly startSecond: Schema.optional<Schema.Number>;
248
+ readonly endSecond: Schema.optional<Schema.Number>;
249
+ readonly channelIndex: Schema.optional<Schema.Number>;
250
+ readonly id: Schema.optional<Schema.String>;
251
+ readonly type: Schema.Literal<"transcript-final">;
249
252
  }>, Schema.Struct<{
250
- type: Schema.Literal<["finish"]>;
251
- text: typeof Schema.String;
252
- segments: Schema.Array$<Schema.Struct<{
253
- text: typeof Schema.String;
254
- start: typeof Schema.Number;
255
- end: typeof Schema.Number;
253
+ readonly type: Schema.Literal<"finish">;
254
+ readonly text: Schema.String;
255
+ readonly segments: Schema.$Array<Schema.Struct<{
256
+ readonly text: Schema.String;
257
+ readonly start: Schema.Number;
258
+ readonly end: Schema.Number;
256
259
  }>>;
257
- language: Schema.optional<typeof Schema.String>;
258
- durationSec: Schema.optional<typeof Schema.Number>;
260
+ readonly language: Schema.optional<Schema.String>;
261
+ readonly durationSec: Schema.optional<Schema.Number>;
259
262
  }>]>;
260
263
 
261
264
  export declare type TranscriptionStreamEvent = typeof TranscriptionStreamEvent.Type;