@opencode/ai 0.0.0-dev-1297 → 0.0.0-dev-1298

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.
@@ -32,10 +32,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
32
32
  readonly endSeconds: number;
33
33
  readonly speaker?: string | undefined;
34
34
  };
35
- } | {
36
- readonly type: "generation-queued";
37
- readonly id: string;
38
- readonly position?: number | undefined;
39
35
  } | {
40
36
  readonly type: "generation-progress";
41
37
  readonly id: string;
@@ -98,10 +94,6 @@ export declare const GoogleTranscription: {
98
94
  readonly endSeconds: number;
99
95
  readonly speaker?: string | undefined;
100
96
  };
101
- } | {
102
- readonly type: "generation-queued";
103
- readonly id: string;
104
- readonly position?: number | undefined;
105
97
  } | {
106
98
  readonly type: "generation-progress";
107
99
  readonly id: string;
@@ -61,15 +61,15 @@ const HailuoFile = Schema.Struct({
61
61
  base_resp: BaseResp,
62
62
  });
63
63
  const STATUS = {
64
- queued: "queued",
64
+ queued: "running",
65
65
  running: "running",
66
66
  succeeded: "completed",
67
67
  failed: "failed",
68
68
  cancelled: "cancelled",
69
69
  };
70
70
  const HAILUO_STATUS = {
71
- Preparing: "queued",
72
- Queueing: "queued",
71
+ Preparing: "running",
72
+ Queueing: "running",
73
73
  Processing: "running",
74
74
  Success: "completed",
75
75
  Fail: "failed",
@@ -155,19 +155,19 @@ const hailuoFromRequest = Effect.fn("MiniMaxHailuoVideo.fromRequest")(function*
155
155
  // ---------------------------------------------------------------------------
156
156
  const decodeStart = route.decodeStarted(StartResponse, (value) => ({
157
157
  token: value.task_id,
158
- snapshot: { id: value.task_id, status: "queued" },
158
+ snapshot: { id: value.task_id, status: "running" },
159
159
  }));
160
160
  const decodeTask = route.decodeJson(TaskResponse);
161
161
  const decodeStatus = Effect.fn("MiniMaxVideo.decodeStatus")(function* (response, context) {
162
162
  const output = yield* decodeTask(response);
163
163
  const task = output.value.task ?? output.value;
164
- return { id: context.token, status: MediaProtocol.status(STATUS, task.status ?? "") };
164
+ return { id: context.token, ...MediaProtocol.status(STATUS, task.status ?? "") };
165
165
  });
166
166
  const decodeResult = Effect.fn("MiniMaxVideo.decodeResult")(function* (response, context) {
167
167
  const output = yield* decodeTask(response);
168
168
  const task = output.value.task ?? output.value;
169
- const status = MediaProtocol.status(STATUS, task.status ?? "");
170
- if (status === "queued" || status === "running")
169
+ const status = MediaProtocol.state(STATUS, task.status ?? "");
170
+ if (status === "running")
171
171
  return yield* output.pending(context.token);
172
172
  if (status === "failed")
173
173
  return yield* failed(output, route.name, task.error?.code ?? undefined, task.error?.message ?? undefined);
@@ -206,23 +206,23 @@ const decodeHailuoStart = Effect.fn("MiniMaxHailuoVideo.decodeStart")(function*
206
206
  const taskID = output.value.task_id ?? "";
207
207
  if (taskID === "")
208
208
  return yield* output.invalid(`${hailuoRoute.name} returned no task_id`);
209
- return { token: taskID, snapshot: { id: taskID, status: "queued" } };
209
+ return { token: taskID, snapshot: { id: taskID, status: "running" } };
210
210
  });
211
211
  const decodeHailuoTask = hailuoRoute.decodeJson(HailuoTask);
212
212
  const decodeHailuoStatus = Effect.fn("MiniMaxHailuoVideo.decodeStatus")(function* (response, context) {
213
213
  const output = yield* decodeHailuoTask(response);
214
214
  const status = MediaProtocol.status(HAILUO_STATUS, output.value.status ?? "");
215
215
  // A failed task also carries its reason in `base_resp`; any other non-zero code is a failed read.
216
- const error = status === "failed" ? undefined : baseError(output, output.value.base_resp);
216
+ const error = status.reason === "failed" ? undefined : baseError(output, output.value.base_resp);
217
217
  if (error)
218
218
  return yield* error;
219
- return { id: context.token, status };
219
+ return { id: context.token, ...status };
220
220
  });
221
221
  const decodeHailuoFile = hailuoRoute.decodeJson(HailuoFile);
222
222
  const decodeHailuoResult = Effect.fn("MiniMaxHailuoVideo.decodeResult")(function* (response, context) {
223
223
  const output = yield* decodeHailuoTask(response);
224
224
  const task = output.value;
225
- const status = MediaProtocol.status(HAILUO_STATUS, task.status ?? "");
225
+ const status = MediaProtocol.state(HAILUO_STATUS, task.status ?? "");
226
226
  const error = baseError(output, task.base_resp);
227
227
  if (status === "failed")
228
228
  return yield* error ?? failed(output, hailuoRoute.name, undefined, undefined);
@@ -58,10 +58,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
58
58
  readonly type: "image";
59
59
  readonly index: number;
60
60
  readonly image: Media.Asset;
61
- } | {
62
- readonly type: "generation-queued";
63
- readonly id: string;
64
- readonly position?: number | undefined;
65
61
  } | {
66
62
  readonly type: "generation-progress";
67
63
  readonly id: string;
@@ -113,10 +109,6 @@ export declare const OpenAIImages: {
113
109
  readonly type: "image";
114
110
  readonly index: number;
115
111
  readonly image: Media.Asset;
116
- } | {
117
- readonly type: "generation-queued";
118
- readonly id: string;
119
- readonly position?: number | undefined;
120
112
  } | {
121
113
  readonly type: "generation-progress";
122
114
  readonly id: string;
@@ -25,10 +25,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
25
25
  readonly startSeconds: number;
26
26
  readonly endSeconds: number;
27
27
  }[];
28
- } | {
29
- readonly type: "generation-queued";
30
- readonly id: string;
31
- readonly position?: number | undefined;
32
28
  } | {
33
29
  readonly type: "generation-progress";
34
30
  readonly id: string;
@@ -75,10 +71,6 @@ export declare const OpenAISpeech: {
75
71
  readonly startSeconds: number;
76
72
  readonly endSeconds: number;
77
73
  }[];
78
- } | {
79
- readonly type: "generation-queued";
80
- readonly id: string;
81
- readonly position?: number | undefined;
82
74
  } | {
83
75
  readonly type: "generation-progress";
84
76
  readonly id: string;
@@ -69,10 +69,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
69
69
  readonly endSeconds: number;
70
70
  readonly speaker?: string | undefined;
71
71
  };
72
- } | {
73
- readonly type: "generation-queued";
74
- readonly id: string;
75
- readonly position?: number | undefined;
76
72
  } | {
77
73
  readonly type: "generation-progress";
78
74
  readonly id: string;
@@ -135,10 +131,6 @@ export declare const OpenAITranscription: {
135
131
  readonly endSeconds: number;
136
132
  readonly speaker?: string | undefined;
137
133
  };
138
- } | {
139
- readonly type: "generation-queued";
140
- readonly id: string;
141
- readonly position?: number | undefined;
142
134
  } | {
143
135
  readonly type: "generation-progress";
144
136
  readonly id: string;
@@ -30,7 +30,7 @@ const Job = Schema.Struct({
30
30
  // 3. Status
31
31
  // ---------------------------------------------------------------------------
32
32
  const STATUS = {
33
- pending: "queued",
33
+ pending: "running",
34
34
  in_progress: "running",
35
35
  completed: "completed",
36
36
  failed: "failed",
@@ -79,18 +79,18 @@ const resolution = (value) => (/^\dk$/.test(value) ? value.toUpperCase() : value
79
79
  // ---------------------------------------------------------------------------
80
80
  const decodeStart = route.decodeStarted(StartResponse, (value) => ({
81
81
  token: value.id,
82
- snapshot: { id: value.id, status: MediaProtocol.status(STATUS, value.status ?? "pending") },
82
+ snapshot: { id: value.id, ...MediaProtocol.status(STATUS, value.status ?? "pending") },
83
83
  }));
84
84
  const decodeJob = route.decodeJson(Job);
85
85
  const decodeStatus = Effect.fn("OpenRouterVideo.decodeStatus")(function* (response, context) {
86
86
  const output = yield* decodeJob(response);
87
- return { id: context.token, status: MediaProtocol.status(STATUS, output.value.status) };
87
+ return { id: context.token, ...MediaProtocol.status(STATUS, output.value.status) };
88
88
  });
89
89
  const decodeResult = Effect.fn("OpenRouterVideo.decodeResult")(function* (response, context) {
90
90
  const output = yield* decodeJob(response);
91
91
  const job = output.value;
92
- const status = MediaProtocol.status(STATUS, job.status);
93
- if (status === "queued" || status === "running")
92
+ const status = MediaProtocol.state(STATUS, job.status);
93
+ if (status === "running")
94
94
  return yield* output.pending(context.token);
95
95
  if (status === "failed") {
96
96
  const message = `${route.name} generation failed${job.error ? `: ${job.error}` : ""}`;
@@ -46,7 +46,7 @@ const Task = Schema.Struct({
46
46
  service_tier: optionalNull(Schema.String),
47
47
  });
48
48
  const STATUS = {
49
- queued: "queued",
49
+ queued: "running",
50
50
  running: "running",
51
51
  succeeded: "completed",
52
52
  failed: "failed",
@@ -127,18 +127,18 @@ const make = (provider) => {
127
127
  });
128
128
  const decodeStart = route.decodeStarted(StartResponse, (value) => ({
129
129
  token: value.id,
130
- snapshot: { id: value.id, status: "queued" },
130
+ snapshot: { id: value.id, status: "running" },
131
131
  }));
132
132
  const decodeTask = route.decodeJson(Task);
133
133
  const decodeStatus = Effect.fn("SeedanceVideo.decodeStatus")(function* (response, context) {
134
134
  const output = yield* decodeTask(response);
135
- return { id: context.token, status: MediaProtocol.status(STATUS, output.value.status) };
135
+ return { id: context.token, ...MediaProtocol.status(STATUS, output.value.status) };
136
136
  });
137
137
  const decodeResult = Effect.fn("SeedanceVideo.decodeResult")(function* (response, context) {
138
138
  const output = yield* decodeTask(response);
139
139
  const task = output.value;
140
- const status = MediaProtocol.status(STATUS, task.status);
141
- if (status === "queued" || status === "running")
140
+ const status = MediaProtocol.state(STATUS, task.status);
141
+ if (status === "running")
142
142
  return yield* output.pending(context.token);
143
143
  if (status === "failed") {
144
144
  const code = task.error?.code ?? undefined;
@@ -87,13 +87,16 @@ const fraction = (progress) => progress !== undefined && progress !== null && pr
87
87
  const decodeVideoStatus = route.decodeJson(VideoStatus);
88
88
  const decodeStatus = Effect.fn("XAIVideo.decodeStatus")(function* (response, context) {
89
89
  const output = yield* decodeVideoStatus(response);
90
- const status = MediaProtocol.status(STATUS, output.value.status);
91
- return { id: context.token, status, progress: fraction(output.value.progress) };
90
+ return {
91
+ id: context.token,
92
+ ...MediaProtocol.status(STATUS, output.value.status),
93
+ progress: fraction(output.value.progress),
94
+ };
92
95
  });
93
96
  const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, context) {
94
97
  const output = yield* decodeVideoStatus(response);
95
98
  const decoded = output.value;
96
- const status = MediaProtocol.status(STATUS, decoded.status);
99
+ const status = MediaProtocol.state(STATUS, decoded.status);
97
100
  if (status === "running")
98
101
  return yield* output.pending(context.token);
99
102
  if (status === "failed") {
package/dist/public.d.ts CHANGED
@@ -10,7 +10,7 @@ export type { AnswerFor, AnswersFor, DecisionInput, DecisionMediaPartInput, Deci
10
10
  export { EmbeddingModel, EmbeddingModelSchema, EmbeddingResponse, EmbeddingUsage, EmbeddingValue } from "./embedding.js";
11
11
  export type { EmbeddingInputType, EmbeddingModelOptions, EmbeddingModelRoute, EmbeddingOptions, EmbeddingRequest, EmbeddingRequestInput, EmbeddingValueInput, } from "./embedding.js";
12
12
  export { Media } from "./media.js";
13
- export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
13
+ export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Reason as GenerationReason, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
14
14
  export type { ExecutableTool, Tool, ToolExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolModelOutputInput, ToolOptions, ToolSchema, ToolToModelOutput, } from "./tool.js";
15
15
  export type { LLM } from "./llm.js";
16
16
  export type { LLMLoopInput, LLMRequestInput } from "./llm.js";
@@ -1,6 +1,6 @@
1
1
  import { Duration, Effect, Schema, type Stream } from "effect";
2
2
  import { HttpClientResponse } from "effect/http";
3
- import type { Snapshot, Status } from "../generation.js";
3
+ import type { Reason, Snapshot } from "../generation.js";
4
4
  import { Media } from "../media.js";
5
5
  import type { AuthInput } from "./auth.js";
6
6
  import { AIError, AuthenticationError, type HttpContext, InvalidRequestError, ProviderID, ProviderInternalError, RateLimitError } from "../schema/index.js";
@@ -148,7 +148,7 @@ export declare const identity: (input: {
148
148
  body: string;
149
149
  http: HttpContext;
150
150
  invalid: (message: string, cause?: unknown) => AIError;
151
- ended: (status: Exclude<Status, "queued" | "running" | "completed">, message: string, failure?: Failure) => AIError;
151
+ ended: (reason: Reason, message: string, failure?: Failure) => AIError;
152
152
  pending: (id: string) => AIError;
153
153
  contentPolicy: (message: string) => AIError;
154
154
  }, AIError, never>;
@@ -157,7 +157,7 @@ export declare const identity: (input: {
157
157
  body: string;
158
158
  http: HttpContext;
159
159
  invalid: (message: string, cause?: unknown) => AIError;
160
- ended: (status: Exclude<Status, "queued" | "running" | "completed">, message: string, failure?: Failure) => AIError;
160
+ ended: (reason: Reason, message: string, failure?: Failure) => AIError;
161
161
  pending: (id: string) => AIError;
162
162
  contentPolicy: (message: string) => AIError;
163
163
  value: A;
@@ -172,8 +172,12 @@ export declare const identity: (input: {
172
172
  unsupported: (operation: string, message: string) => AIError;
173
173
  };
174
174
  export type Identity = ReturnType<typeof identity>;
175
+ /** A provider status in package terms: still running, completed, or the reason it ended in `error`. */
176
+ export type State = "running" | "completed" | Reason;
175
177
  /** Map a provider status string through the protocol's table; unknown values keep the generation running. */
176
- export declare const status: (table: Readonly<Record<string, Status>>, raw: string) => Status;
178
+ export declare const state: (table: Readonly<Record<string, State>>, raw: string) => State;
179
+ /** The snapshot `status` and `reason` for a provider status string. */
180
+ export declare const status: (table: Readonly<Record<string, State>>, raw: string) => Pick<Snapshot, "status" | "reason">;
177
181
  /** Map a provider error code through the protocol's table; missing or unmapped codes are `ProviderInternal`. */
178
182
  export declare const failure: (table: Readonly<Record<string, Failure>>, code: string | number | undefined) => Failure;
179
183
  /** A `url` asset whose provider-declared retention window starts now. */
@@ -42,7 +42,7 @@ export const identity = (input) => {
42
42
  });
43
43
  /**
44
44
  * Read a text body while retaining the original payload and HTTP context on every downstream error. `invalid` is a
45
- * malformed provider document; `ended` is a generation that reached a terminal status without output (`failed`
45
+ * malformed provider document; `ended` is a generation that ended in `error` without output (reason `failed`
46
46
  * carries the provider's classification, defaulting to `ProviderInternal`; `cancelled`/`expired` mean the result
47
47
  * will never exist); `pending` is a `result()` read before the generation finished, which is caller misuse;
48
48
  * `contentPolicy` is a moderated result.
@@ -54,8 +54,8 @@ export const identity = (input) => {
54
54
  body,
55
55
  http,
56
56
  invalid: (message, cause) => new AIError({ reason: new InvalidProviderOutputError({ route: input.id, message, body, http, cause }) }),
57
- ended: (status, message, failure = "ProviderInternal") => new AIError({
58
- reason: status === "failed"
57
+ ended: (reason, message, failure = "ProviderInternal") => new AIError({
58
+ reason: reason === "failed"
59
59
  ? new FAILURES[failure]({ message, body, http })
60
60
  : new InvalidRequestError({ message, body, http }),
61
61
  }),
@@ -110,7 +110,14 @@ export const identity = (input) => {
110
110
  };
111
111
  };
112
112
  /** Map a provider status string through the protocol's table; unknown values keep the generation running. */
113
- export const status = (table, raw) => Object.hasOwn(table, raw) ? table[raw] : "running";
113
+ export const state = (table, raw) => Object.hasOwn(table, raw) ? table[raw] : "running";
114
+ /** The snapshot `status` and `reason` for a provider status string. */
115
+ export const status = (table, raw) => {
116
+ const mapped = state(table, raw);
117
+ if (mapped === "running" || mapped === "completed")
118
+ return { status: mapped };
119
+ return { status: "error", reason: mapped };
120
+ };
114
121
  /** Map a provider error code through the protocol's table; missing or unmapped codes are `ProviderInternal`. */
115
122
  export const failure = (table, code) => code !== undefined && Object.hasOwn(table, code) ? table[code] : "ProviderInternal";
116
123
  /** A `url` asset whose provider-declared retention window starts now. */
@@ -18,10 +18,6 @@ export declare const SpeechClient: {
18
18
  readonly startSeconds: number;
19
19
  readonly endSeconds: number;
20
20
  }[];
21
- } | {
22
- readonly type: "generation-queued";
23
- readonly id: string;
24
- readonly position?: number | undefined;
25
21
  } | {
26
22
  readonly type: "generation-progress";
27
23
  readonly id: string;
@@ -68,6 +64,10 @@ export declare const SpeechClient: {
68
64
  readonly startSeconds: number;
69
65
  readonly endSeconds: number;
70
66
  }[];
67
+ } | {
68
+ readonly type: "generation-progress";
69
+ readonly id: string;
70
+ readonly progress?: number | undefined;
71
71
  } | {
72
72
  readonly type: "finish";
73
73
  readonly audio: import("./media.js").Asset;
@@ -97,7 +97,7 @@ export declare const SpeechClient: {
97
97
  readonly [x: string]: unknown;
98
98
  };
99
99
  } | undefined;
100
- } | import("./generation.js").Observation, import("./public.js").AIError, SpeechClientService>;
100
+ }, import("./public.js").AIError, SpeechClientService>;
101
101
  readonly start: (request: SpeechRequest) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./public.js").AIError, SpeechClientService>;
102
102
  readonly resume: (model: import("./speech.js").SpeechModel<{
103
103
  readonly [x: string]: unknown;
package/dist/speech.d.ts CHANGED
@@ -186,10 +186,6 @@ export declare const SpeechFinishEvent: Schema.Struct<{
186
186
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
187
187
  }>;
188
188
  declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
189
- readonly type: Schema.tag<"generation-queued">;
190
- readonly id: Schema.String;
191
- readonly position: Schema.optional<Schema.Number>;
192
- }>, Schema.Struct<{
193
189
  readonly type: Schema.tag<"generation-progress">;
194
190
  readonly id: Schema.String;
195
191
  readonly progress: Schema.optional<Schema.Number>;
@@ -258,10 +254,6 @@ declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.S
258
254
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
259
255
  }>]>;
260
256
  export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
261
- readonly type: Schema.tag<"generation-queued">;
262
- readonly id: Schema.String;
263
- readonly position: Schema.optional<Schema.Number>;
264
- }>, Schema.Struct<{
265
257
  readonly type: Schema.tag<"generation-progress">;
266
258
  readonly id: Schema.String;
267
259
  readonly progress: Schema.optional<Schema.Number>;
@@ -330,7 +322,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
330
322
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
331
323
  }>]> & {
332
324
  readonly tag: "type";
333
- readonly discriminants: readonly ["generation-queued", "generation-progress", "audio-delta", "timestamps", "finish"];
325
+ readonly discriminants: readonly ["generation-progress", "audio-delta", "timestamps", "finish"];
334
326
  readonly cases: {
335
327
  "audio-delta": Schema.Struct<{
336
328
  readonly type: Schema.tag<"audio-delta">;
@@ -395,11 +387,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
395
387
  readonly id: Schema.String;
396
388
  readonly progress: Schema.optional<Schema.Number>;
397
389
  }>;
398
- "generation-queued": Schema.Struct<{
399
- readonly type: Schema.tag<"generation-queued">;
400
- readonly id: Schema.String;
401
- readonly position: Schema.optional<Schema.Number>;
402
- }>;
403
390
  timestamps: Schema.Struct<{
404
391
  readonly type: Schema.tag<"timestamps">;
405
392
  readonly items: Schema.$Array<Schema.Struct<{
@@ -419,10 +406,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
419
406
  readonly startSeconds: number;
420
407
  readonly endSeconds: number;
421
408
  }[];
422
- } | {
423
- readonly type: "generation-queued";
424
- readonly id: string;
425
- readonly position?: number | undefined;
426
409
  } | {
427
410
  readonly type: "generation-progress";
428
411
  readonly id: string;
@@ -470,12 +453,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
470
453
  }[];
471
454
  }, {
472
455
  readonly type: Keys;
473
- }> | Extract<{
474
- readonly type: "generation-queued";
475
- readonly id: string;
476
- readonly position?: number | undefined;
477
- }, {
478
- readonly type: Keys;
479
456
  }> | Extract<{
480
457
  readonly type: "generation-progress";
481
458
  readonly id: string;
@@ -554,11 +531,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
554
531
  readonly id: string;
555
532
  readonly progress?: number | undefined;
556
533
  };
557
- "generation-queued": (u: unknown) => u is {
558
- readonly type: "generation-queued";
559
- readonly id: string;
560
- readonly position?: number | undefined;
561
- };
562
534
  timestamps: (u: unknown) => u is {
563
535
  readonly type: "timestamps";
564
536
  readonly items: readonly {
@@ -569,7 +541,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
569
541
  };
570
542
  };
571
543
  readonly match: {
572
- <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
544
+ <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "timestamps"]: (value: {
573
545
  readonly "audio-delta": Schema.Struct<{
574
546
  readonly type: Schema.tag<"audio-delta">;
575
547
  readonly chunk: Schema.Uint8Array;
@@ -633,11 +605,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
633
605
  readonly id: Schema.String;
634
606
  readonly progress: Schema.optional<Schema.Number>;
635
607
  }>;
636
- readonly "generation-queued": Schema.Struct<{
637
- readonly type: Schema.tag<"generation-queued">;
638
- readonly id: Schema.String;
639
- readonly position: Schema.optional<Schema.Number>;
640
- }>;
641
608
  readonly timestamps: Schema.Struct<{
642
609
  readonly type: Schema.tag<"timestamps">;
643
610
  readonly items: Schema.$Array<Schema.Struct<{
@@ -656,10 +623,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
656
623
  readonly startSeconds: number;
657
624
  readonly endSeconds: number;
658
625
  }[];
659
- } | {
660
- readonly type: "generation-queued";
661
- readonly id: string;
662
- readonly position?: number | undefined;
663
626
  } | {
664
627
  readonly type: "generation-progress";
665
628
  readonly id: string;
@@ -693,8 +656,8 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
693
656
  readonly [x: string]: unknown;
694
657
  };
695
658
  } | undefined;
696
- }, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
697
- <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
659
+ }, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "timestamps"]>>;
660
+ <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "timestamps"]: (value: {
698
661
  readonly "audio-delta": Schema.Struct<{
699
662
  readonly type: Schema.tag<"audio-delta">;
700
663
  readonly chunk: Schema.Uint8Array;
@@ -758,11 +721,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
758
721
  readonly id: Schema.String;
759
722
  readonly progress: Schema.optional<Schema.Number>;
760
723
  }>;
761
- readonly "generation-queued": Schema.Struct<{
762
- readonly type: Schema.tag<"generation-queued">;
763
- readonly id: Schema.String;
764
- readonly position: Schema.optional<Schema.Number>;
765
- }>;
766
724
  readonly timestamps: Schema.Struct<{
767
725
  readonly type: Schema.tag<"timestamps">;
768
726
  readonly items: Schema.$Array<Schema.Struct<{
@@ -781,10 +739,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
781
739
  readonly startSeconds: number;
782
740
  readonly endSeconds: number;
783
741
  }[];
784
- } | {
785
- readonly type: "generation-queued";
786
- readonly id: string;
787
- readonly position?: number | undefined;
788
742
  } | {
789
743
  readonly type: "generation-progress";
790
744
  readonly id: string;
@@ -818,7 +772,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
818
772
  readonly [x: string]: unknown;
819
773
  };
820
774
  } | undefined;
821
- }) => import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
775
+ }) => import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "timestamps"]>>;
822
776
  };
823
777
  readonly matchOrElse: {
824
778
  <Handlers, OrElse>(value: {
@@ -831,10 +785,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
831
785
  readonly startSeconds: number;
832
786
  readonly endSeconds: number;
833
787
  }[];
834
- } | {
835
- readonly type: "generation-queued";
836
- readonly id: string;
837
- readonly position?: number | undefined;
838
788
  } | {
839
789
  readonly type: "generation-progress";
840
790
  readonly id: string;
@@ -908,11 +858,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
908
858
  readonly id: string;
909
859
  readonly progress?: number | undefined;
910
860
  }) => any) | undefined;
911
- readonly "generation-queued"?: ((value: {
912
- readonly type: "generation-queued";
913
- readonly id: string;
914
- readonly position?: number | undefined;
915
- }) => any) | undefined;
916
861
  readonly timestamps?: ((value: {
917
862
  readonly type: "timestamps";
918
863
  readonly items: readonly {
@@ -921,7 +866,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
921
866
  readonly endSeconds: number;
922
867
  }[];
923
868
  }) => any) | undefined;
924
- } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
869
+ } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
925
870
  readonly type: "audio-delta";
926
871
  readonly chunk: Uint8Array<ArrayBufferLike>;
927
872
  }, {
@@ -935,12 +880,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
935
880
  }[];
936
881
  }, {
937
882
  readonly type: keyof Handlers;
938
- }> | Exclude<{
939
- readonly type: "generation-queued";
940
- readonly id: string;
941
- readonly position?: number | undefined;
942
- }, {
943
- readonly type: keyof Handlers;
944
883
  }> | Exclude<{
945
884
  readonly type: "generation-progress";
946
885
  readonly id: string;
@@ -1019,11 +958,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1019
958
  readonly id: string;
1020
959
  readonly progress?: number | undefined;
1021
960
  }) => any) | undefined;
1022
- readonly "generation-queued"?: ((value: {
1023
- readonly type: "generation-queued";
1024
- readonly id: string;
1025
- readonly position?: number | undefined;
1026
- }) => any) | undefined;
1027
961
  readonly timestamps?: ((value: {
1028
962
  readonly type: "timestamps";
1029
963
  readonly items: readonly {
@@ -1032,7 +966,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1032
966
  readonly endSeconds: number;
1033
967
  }[];
1034
968
  }) => any) | undefined;
1035
- } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
969
+ } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
1036
970
  readonly type: "audio-delta";
1037
971
  readonly chunk: Uint8Array<ArrayBufferLike>;
1038
972
  }, {
@@ -1046,12 +980,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1046
980
  }[];
1047
981
  }, {
1048
982
  readonly type: keyof Handlers;
1049
- }> | Exclude<{
1050
- readonly type: "generation-queued";
1051
- readonly id: string;
1052
- readonly position?: number | undefined;
1053
- }, {
1054
- readonly type: keyof Handlers;
1055
983
  }> | Exclude<{
1056
984
  readonly type: "generation-progress";
1057
985
  readonly id: string;
@@ -1099,10 +1027,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1099
1027
  readonly startSeconds: number;
1100
1028
  readonly endSeconds: number;
1101
1029
  }[];
1102
- } | {
1103
- readonly type: "generation-queued";
1104
- readonly id: string;
1105
- readonly position?: number | undefined;
1106
1030
  } | {
1107
1031
  readonly type: "generation-progress";
1108
1032
  readonly id: string;
@@ -1140,11 +1064,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1140
1064
  };
1141
1065
  } & {
1142
1066
  is: {
1143
- generationQueued: (u: unknown) => u is {
1144
- readonly type: "generation-queued";
1145
- readonly id: string;
1146
- readonly position?: number | undefined;
1147
- };
1148
1067
  generationProgress: (u: unknown) => u is {
1149
1068
  readonly type: "generation-progress";
1150
1069
  readonly id: string;
package/dist/speech.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
- import { ProgressEvent, QueuedEvent } from "./generation.js";
2
+ import { ProgressEvent } from "./generation.js";
3
3
  import { Media } from "./media.js";
4
4
  import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
5
5
  import { MediaRoute } from "./route/media.js";
@@ -70,7 +70,6 @@ export const SpeechFinishEvent = Schema.Struct({
70
70
  providerMetadata: Schema.optional(ProviderMetadata),
71
71
  }).annotate({ identifier: "Speech.Event.Finish" });
72
72
  const speechEventTagged = Schema.Union([
73
- QueuedEvent,
74
73
  ProgressEvent,
75
74
  SpeechAudioDeltaEvent,
76
75
  SpeechTimestampsEvent,
@@ -78,7 +77,6 @@ const speechEventTagged = Schema.Union([
78
77
  ]).pipe(Schema.toTaggedUnion("type"));
79
78
  export const SpeechEvent = Object.assign(speechEventTagged, {
80
79
  is: {
81
- generationQueued: speechEventTagged.guards["generation-queued"],
82
80
  generationProgress: speechEventTagged.guards["generation-progress"],
83
81
  audioDelta: speechEventTagged.guards["audio-delta"],
84
82
  timestamps: speechEventTagged.guards.timestamps,