@opencode/ai 0.0.0-dev-70 → 0.0.0-dev-80

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 (57) hide show
  1. package/README.md +14 -10
  2. package/dist/decision.d.ts +22 -6
  3. package/dist/decision.js +15 -4
  4. package/dist/effect.d.ts +1 -1
  5. package/dist/effect.js +1 -1
  6. package/dist/image-client.d.ts +0 -9
  7. package/dist/image-client.js +0 -1
  8. package/dist/image.d.ts +0 -135
  9. package/dist/image.js +0 -3
  10. package/dist/index.d.ts +0 -72
  11. package/dist/media.d.ts +0 -7
  12. package/dist/media.js +0 -6
  13. package/dist/protocols/cartesia-speech.d.ts +0 -18
  14. package/dist/protocols/deepgram-speech.d.ts +0 -18
  15. package/dist/protocols/elevenlabs-speech.d.ts +0 -18
  16. package/dist/protocols/fal-images.js +1 -9
  17. package/dist/protocols/google-images.js +6 -33
  18. package/dist/protocols/google-speech.d.ts +0 -18
  19. package/dist/protocols/google-speech.js +0 -1
  20. package/dist/protocols/google-transcription.d.ts +0 -18
  21. package/dist/protocols/google-transcription.js +0 -1
  22. package/dist/protocols/google-video.js +1 -6
  23. package/dist/protocols/meta-images.d.ts +1 -1
  24. package/dist/protocols/meta-images.js +3 -12
  25. package/dist/protocols/openai-decisions.js +25 -5
  26. package/dist/protocols/openai-images.d.ts +0 -18
  27. package/dist/protocols/openai-images.js +3 -7
  28. package/dist/protocols/openai-speech.d.ts +0 -18
  29. package/dist/protocols/openai-speech.js +3 -4
  30. package/dist/protocols/openai-transcription.d.ts +0 -18
  31. package/dist/protocols/openai-transcription.js +3 -4
  32. package/dist/protocols/stability-images.js +0 -3
  33. package/dist/protocols/system-one.d.ts +2 -0
  34. package/dist/protocols/system-one.js +6 -4
  35. package/dist/protocols/utils/gemini-generate-content.d.ts +0 -2
  36. package/dist/protocols/utils/gemini-generate-content.js +3 -14
  37. package/dist/protocols/utils/image-sizing.d.ts +1 -4
  38. package/dist/protocols/utils/image-sizing.js +2 -8
  39. package/dist/protocols/utils/speech-stream.d.ts +0 -1
  40. package/dist/protocols/utils/speech-stream.js +0 -1
  41. package/dist/protocols/xai-images.js +1 -6
  42. package/dist/protocols/xai-video.js +10 -7
  43. package/dist/protocols/zai-images.js +0 -9
  44. package/dist/schema/events.d.ts +7 -0
  45. package/dist/schema/events.js +4 -0
  46. package/dist/speech-client.d.ts +0 -9
  47. package/dist/speech-client.js +0 -1
  48. package/dist/speech.d.ts +0 -135
  49. package/dist/speech.js +0 -3
  50. package/dist/transcription-client.d.ts +0 -9
  51. package/dist/transcription.d.ts +0 -135
  52. package/dist/transcription.js +0 -1
  53. package/dist/video-client.d.ts +0 -9
  54. package/dist/video-client.js +0 -1
  55. package/dist/video.d.ts +0 -135
  56. package/dist/video.js +0 -3
  57. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
1
  import { Effect, Schema } from "effect";
2
- import { DecisionResponse, } from "../decision.js";
2
+ import { DecisionResponse, DecisionUsage, } from "../decision.js";
3
3
  import { DecisionRoute } from "../route/decision.js";
4
4
  import { Endpoint } from "../route/endpoint.js";
5
5
  import { MediaProtocol } from "../route/media-protocol.js";
6
- import { AIError, UnsupportedOperationError, Usage, mergeJsonRecords } from "../schema/index.js";
6
+ import { AIError, UnsupportedOperationError, mergeJsonRecords } from "../schema/index.js";
7
7
  import { encodeJson } from "../utils/json.js";
8
8
  import { JsonObject, ProviderShared } from "./shared.js";
9
9
  export const DEFAULT_PATH = "/systemone";
@@ -27,6 +27,7 @@ const Answer = Schema.Union([
27
27
  const NativeUsage = Schema.StructWithRest(Schema.Struct({
28
28
  input_tokens: Schema.optional(Schema.Number),
29
29
  output_tokens: Schema.optional(Schema.Number),
30
+ cost: Schema.optional(Schema.Number),
30
31
  }), [JsonObject]);
31
32
  export const Response = Schema.Struct({
32
33
  model: Schema.String,
@@ -159,15 +160,16 @@ export const toResponse = (data, request, providerMetadataKey, invalid) => {
159
160
  answers: request.questions.map((question) => toAnswer(question, data.answers[question.name])),
160
161
  usage: data.usage === undefined
161
162
  ? undefined
162
- : new Usage({
163
+ : new DecisionUsage({
163
164
  inputTokens: data.usage.input_tokens,
164
165
  outputTokens: data.usage.output_tokens,
165
166
  totalTokens: ProviderShared.totalTokens(data.usage.input_tokens, data.usage.output_tokens, undefined),
166
- providerMetadata: { [providerMetadataKey]: data.usage },
167
+ cost: data.usage.cost,
167
168
  }),
168
169
  providerMetadata: {
169
170
  [providerMetadataKey]: {
170
171
  model: data.model,
172
+ ...(data.usage === undefined ? {} : { usage: data.usage }),
171
173
  ...(data.id === undefined ? {} : { responseId: data.id }),
172
174
  ...(data.provider === undefined ? {} : { provider: data.provider }),
173
175
  ...data.provider_metadata?.[providerMetadataKey],
@@ -52,8 +52,6 @@ export declare const blocked: (name: string, chunk: Chunk, frame: string) => AIE
52
52
  export declare const contentFiltered: (finishReason: string | undefined) => boolean;
53
53
  /** Callers check that the response produced no output: a policy stop after output is a partial result instead. */
54
54
  export declare const withheld: (name: string, chunk: Chunk, frame: string) => AIError | undefined;
55
- /** Any finish reason other than `STOP` means the output may be cut short, so it is surfaced rather than dropped. */
56
- export declare const notices: (name: string, state: Metadata) => ReadonlyArray<Media.Notice> | undefined;
57
55
  export declare const usage: (usage: UsageMetadata | undefined) => MediaUsage | undefined;
58
56
  export declare const providerMetadata: (state: Metadata) => ProviderMetadata;
59
57
  export declare const path: (model: string, mode: MediaProtocol.Mode) => string;
@@ -1,7 +1,7 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import { Media } from "../../media.js";
3
3
  import { Framing } from "../../route/framing.js";
4
- import { AIError, ContentPolicyError, ProviderID } from "../../schema/index.js";
4
+ import { AIError, ContentPolicyError, ProviderID, tokenUsage, } from "../../schema/index.js";
5
5
  import { ProviderShared } from "../shared.js";
6
6
  import { MediaInput } from "./media-input.js";
7
7
  const PROVIDER = ProviderID.make("google");
@@ -64,25 +64,14 @@ export const withheld = (name, chunk, frame) => {
64
64
  reason: new ContentPolicyError({ message: `${name} withheld its output (${finishReason})`, body: frame }),
65
65
  });
66
66
  };
67
- /** Any finish reason other than `STOP` means the output may be cut short, so it is surfaced rather than dropped. */
68
- export const notices = (name, state) => state.finishReason === undefined || state.finishReason === "STOP"
69
- ? undefined
70
- : [
71
- {
72
- type: contentFiltered(state.finishReason) ? "filtered" : "other",
73
- message: `${name} finished with ${state.finishReason}`,
74
- providerMetadata: { google: { finishReason: state.finishReason } },
75
- },
76
- ];
77
67
  export const usage = (usage) => usage === undefined
78
68
  ? undefined
79
- : {
80
- type: "tokens",
69
+ : tokenUsage({
81
70
  input: usage.promptTokenCount,
82
71
  output: usage.candidatesTokenCount,
83
72
  total: ProviderShared.totalTokens(usage.promptTokenCount, usage.candidatesTokenCount, usage.totalTokenCount),
84
73
  details: { google: usage },
85
- };
74
+ });
86
75
  export const providerMetadata = (state) => ({
87
76
  google: { finishReason: state.finishReason, modelVersion: state.modelVersion, responseId: state.responseId },
88
77
  });
@@ -1,5 +1,4 @@
1
1
  import { Effect } from "effect";
2
- import type { Media } from "../../media.js";
3
2
  import type { MediaProtocol } from "../../route/media-protocol.js";
4
3
  export interface Size {
5
4
  readonly width: number;
@@ -27,8 +26,6 @@ export declare const tier: (resolution: string) => number | undefined;
27
26
  export declare const fit: (shape: Shape, limits: Limits) => Size;
28
27
  /** The listed size closest to the shape: nearest aspect ratio first, then nearest pixel count. */
29
28
  export declare const nearest: (shape: Shape, sizes: ReadonlyArray<Size>) => Size;
30
- /** Reports a size more than 2% off the requested aspect or more than √2 per edge off the requested tier. */
31
- export declare const notice: (name: string, shape: Shape, size: Size) => Media.Notice | undefined;
32
- /** Free width and height that must honor the shape; a size that misses it fails instead of returning a notice. */
29
+ /** Free width and height that must honor the shape; a size that misses it fails. */
33
30
  export declare const exact: (route: MediaProtocol.Identity, shape: Shape, limits: Limits) => Effect.Effect<undefined, never, never> | Effect.Effect<never, import("../../effect.js").AIError, never> | Effect.Effect<Size, never, never>;
34
31
  export * as ImageSizing from "./image-sizing.js";
@@ -36,14 +36,7 @@ export const nearest = (shape, sizes) => {
36
36
  return sizeArea < bestArea ? size : best;
37
37
  });
38
38
  };
39
- /** Reports a size more than 2% off the requested aspect or more than √2 per edge off the requested tier. */
40
- export const notice = (name, shape, size) => {
41
- const requested = missed(shape, size);
42
- if (requested === undefined)
43
- return undefined;
44
- return { type: "other", message: `${name} doesn't offer ${requested}; used ${describe(size)}` };
45
- };
46
- /** Free width and height that must honor the shape; a size that misses it fails instead of returning a notice. */
39
+ /** Free width and height that must honor the shape; a size that misses it fails. */
47
40
  export const exact = (route, shape, limits) => {
48
41
  if (!isRequested(shape))
49
42
  return Effect.succeed(undefined);
@@ -53,6 +46,7 @@ export const exact = (route, shape, limits) => {
53
46
  return Effect.succeed(size);
54
47
  return Effect.fail(route.unsupported(shape.resolution === undefined ? "media.aspect" : "media.resolution", `${route.name} can't render ${requested}; the closest size it takes is ${describe(size)}. Change aspect or resolution, or set the size in providerOptions`));
55
48
  };
49
+ /** A size more than 2% off the requested aspect or more than √2 per edge off the requested tier. */
56
50
  const missed = (shape, size) => {
57
51
  const aspectMissed = shape.aspect !== undefined && Math.abs(Math.log(size.width / size.height / aspectRatio(shape))) > 0.02;
58
52
  const requestedTier = shape.resolution === undefined ? undefined : tier(shape.resolution);
@@ -42,7 +42,6 @@ export declare const finish: (route: MediaProtocol.Identity, state: Audio, outpu
42
42
  readonly mediaType: string | undefined;
43
43
  readonly info?: Media.Info;
44
44
  readonly usage?: MediaUsage;
45
- readonly notices?: ReadonlyArray<Media.Notice>;
46
45
  readonly providerMetadata?: ProviderMetadata;
47
46
  readonly detail?: string;
48
47
  }) => Effect.Effect<ReadonlyArray<SpeechEvent>, AIError>;
@@ -51,7 +51,6 @@ export const finish = (route, state, output) => {
51
51
  SpeechFinishEvent.make({
52
52
  audio: Media.bytes(concatBytes(state.chunks), output.mediaType, { info: output.info }),
53
53
  usage: output.usage,
54
- notices: output.notices,
55
54
  providerMetadata: output.providerMetadata,
56
55
  }),
57
56
  ]);
@@ -57,11 +57,9 @@ const fromRequest = Effect.fn("XAIImages.fromRequest")(function* (request) {
57
57
  // 6. Response decoding
58
58
  // ---------------------------------------------------------------------------
59
59
  const decodeDocument = route.decodeJson(XAIImageResponse);
60
- const decodeResponse = Effect.fn("XAIImages.decodeResponse")(function* (response, context) {
60
+ const decodeResponse = Effect.fn("XAIImages.decodeResponse")(function* (response) {
61
61
  const output = yield* decodeDocument(response);
62
62
  const decoded = output.value;
63
- const requested = context.request.resolution;
64
- const used = resolution(context.request);
65
63
  const images = yield* Effect.forEach(decoded.data, (item, index) => MediaInput.imageOutput(output.invalid, `${route.name} result ${index}`, item, item.mime_type ?? undefined, {
66
64
  providerMetadata: item.revised_prompt === undefined || item.revised_prompt === null
67
65
  ? undefined
@@ -73,9 +71,6 @@ const decodeResponse = Effect.fn("XAIImages.decodeResponse")(function* (response
73
71
  // provider metadata.
74
72
  return new ImageResponse({
75
73
  images,
76
- notices: requested === undefined || requested.toLowerCase() === used
77
- ? undefined
78
- : [{ type: "other", message: `${route.name} doesn't offer ${requested}; used ${used}` }],
79
74
  providerMetadata: decoded.usage === undefined ? undefined : { xai: { usage: decoded.usage } },
80
75
  });
81
76
  });
@@ -98,12 +98,10 @@ const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, con
98
98
  }
99
99
  if (status !== "completed")
100
100
  return yield* output.ended("expired", `${route.name} request ${context.token.requestID} expired`);
101
- // `respect_moderation: false` marks a filtered result; a URL may still be present, so report it as a notice.
102
- const notices = decoded.video?.respect_moderation === false
103
- ? [{ type: "moderated", message: `${route.name} flagged the generated video for moderation` }]
104
- : undefined;
101
+ // `respect_moderation: false` marks a filtered result; a URL may still be present, so only a missing one fails.
102
+ const moderated = decoded.video?.respect_moderation === false;
105
103
  const url = decoded.video?.url ?? undefined;
106
- if (url === undefined && notices !== undefined)
104
+ if (url === undefined && moderated)
107
105
  return yield* output.contentPolicy(`${route.name} withheld the video for moderation`);
108
106
  if (url === undefined)
109
107
  return yield* output.invalid(`${route.name} completed without a video URL`);
@@ -115,8 +113,13 @@ const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, con
115
113
  info: duration === undefined ? undefined : { durationSeconds: duration },
116
114
  }),
117
115
  ],
118
- notices,
119
- providerMetadata: { xai: { requestId: context.token.requestID, model: decoded.model ?? undefined } },
116
+ providerMetadata: {
117
+ xai: {
118
+ requestId: context.token.requestID,
119
+ model: decoded.model ?? undefined,
120
+ respectModeration: decoded.video?.respect_moderation ?? undefined,
121
+ },
122
+ },
120
123
  });
121
124
  });
122
125
  // ---------------------------------------------------------------------------
@@ -51,18 +51,9 @@ const decodeResponse = Effect.fn("ZAIImages.decodeResponse")(function* (response
51
51
  const decoded = output.value;
52
52
  if (decoded.data.length === 0)
53
53
  return yield* output.invalid(`${route.name} returned no images`);
54
- const filters = decoded.content_filter ?? [];
55
54
  return new ImageResponse({
56
55
  // Z.ai returns only URLs and no content type; the media type resolves when the asset is materialized.
57
56
  images: yield* Effect.forEach(decoded.data, (item) => MediaProtocol.expiringUrl(item.url, OUTPUT_RETENTION)),
58
- // Z.ai reports applied content filters alongside a successful result; surface them instead of dropping them.
59
- notices: filters.length === 0
60
- ? undefined
61
- : filters.map((filter) => ({
62
- type: "moderated",
63
- message: `${route.name} applied a content filter${filter.role === undefined ? "" : ` for ${filter.role}`}${filter.level === undefined ? "" : ` at level ${filter.level}`}`,
64
- providerMetadata: { zai: filter },
65
- })),
66
57
  providerMetadata: {
67
58
  zai: {
68
59
  created: decoded.created,
@@ -103,6 +103,13 @@ export declare const MediaUsage: Schema.Union<readonly [Schema.Struct<{
103
103
  readonly seconds: Schema.Number;
104
104
  }>]>;
105
105
  export type MediaUsage = Schema.Schema.Type<typeof MediaUsage>;
106
+ /** Token usage from a provider's counts. A usage object without any count is no usage, so it returns undefined. */
107
+ export declare const tokenUsage: (counts: {
108
+ readonly input?: number;
109
+ readonly output?: number;
110
+ readonly total?: number;
111
+ readonly details?: Record<string, unknown>;
112
+ }) => MediaUsage | undefined;
106
113
  declare const CompactionResponse_base: Schema.Class<CompactionResponse, Schema.Struct<{
107
114
  readonly replacement: Schema.$Array<typeof Message>;
108
115
  readonly usage: Schema.optional<typeof Usage>;
@@ -101,6 +101,10 @@ export const MediaUsage = Schema.Union([
101
101
  ])
102
102
  .pipe(Schema.toTaggedUnion("type"))
103
103
  .annotate({ identifier: "AI.MediaUsage" });
104
+ /** Token usage from a provider's counts. A usage object without any count is no usage, so it returns undefined. */
105
+ export const tokenUsage = (counts) => counts.input === undefined && counts.output === undefined && counts.total === undefined
106
+ ? undefined
107
+ : { type: "tokens", ...counts };
104
108
  /** A replacement context window, not an assistant message to append to prior history. */
105
109
  export class CompactionResponse extends Schema.Class("LLM.CompactionResponse")({
106
110
  replacement: Schema.Array(Message),
@@ -44,15 +44,6 @@ export declare const SpeechClient: {
44
44
  readonly [x: string]: unknown;
45
45
  } | undefined;
46
46
  } | undefined;
47
- readonly notices?: readonly {
48
- readonly type: "filtered" | "moderated" | "other";
49
- readonly message: string;
50
- readonly providerMetadata?: {
51
- readonly [x: string]: {
52
- readonly [x: string]: unknown;
53
- };
54
- } | undefined;
55
- }[] | undefined;
56
47
  readonly providerMetadata?: {
57
48
  readonly [x: string]: {
58
49
  readonly [x: string]: unknown;
@@ -13,7 +13,6 @@ export const SpeechClient = {
13
13
  SpeechFinishEvent.make({
14
14
  audio: response.audio,
15
15
  usage: response.usage,
16
- notices: response.notices,
17
16
  providerMetadata: response.providerMetadata,
18
17
  }),
19
18
  ],
package/dist/speech.d.ts CHANGED
@@ -120,11 +120,6 @@ declare const SpeechResponse_base: Schema.Class<SpeechResponse, Schema.Struct<{
120
120
  readonly type: Schema.Literal<"compute">;
121
121
  readonly seconds: Schema.Number;
122
122
  }>]>>;
123
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
124
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
125
- readonly message: Schema.String;
126
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
127
- }>>>;
128
123
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
129
124
  }>, {}>;
130
125
  export declare class SpeechResponse extends SpeechResponse_base {
@@ -194,11 +189,6 @@ export declare const SpeechFinishEvent: Schema.Struct<{
194
189
  readonly type: Schema.Literal<"compute">;
195
190
  readonly seconds: Schema.Number;
196
191
  }>]>>;
197
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
198
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
199
- readonly message: Schema.String;
200
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
201
- }>>>;
202
192
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
203
193
  }>;
204
194
  declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
@@ -271,11 +261,6 @@ declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.S
271
261
  readonly type: Schema.Literal<"compute">;
272
262
  readonly seconds: Schema.Number;
273
263
  }>]>>;
274
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
275
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
276
- readonly message: Schema.String;
277
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
278
- }>>>;
279
264
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
280
265
  }>]>;
281
266
  export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
@@ -348,11 +333,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
348
333
  readonly type: Schema.Literal<"compute">;
349
334
  readonly seconds: Schema.Number;
350
335
  }>]>>;
351
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
352
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
353
- readonly message: Schema.String;
354
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
355
- }>>>;
356
336
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
357
337
  }>]> & {
358
338
  readonly discriminants: readonly ["generation-queued", "generation-progress", "audio-delta", "timestamps", "finish"];
@@ -413,11 +393,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
413
393
  readonly type: Schema.Literal<"compute">;
414
394
  readonly seconds: Schema.Number;
415
395
  }>]>>;
416
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
417
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
418
- readonly message: Schema.String;
419
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
420
- }>>>;
421
396
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
422
397
  }>;
423
398
  "generation-progress": Schema.Struct<{
@@ -481,15 +456,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
481
456
  readonly [x: string]: unknown;
482
457
  } | undefined;
483
458
  } | undefined;
484
- readonly notices?: readonly {
485
- readonly type: "filtered" | "moderated" | "other";
486
- readonly message: string;
487
- readonly providerMetadata?: {
488
- readonly [x: string]: {
489
- readonly [x: string]: unknown;
490
- };
491
- } | undefined;
492
- }[] | undefined;
493
459
  readonly providerMetadata?: {
494
460
  readonly [x: string]: {
495
461
  readonly [x: string]: unknown;
@@ -545,15 +511,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
545
511
  readonly [x: string]: unknown;
546
512
  } | undefined;
547
513
  } | undefined;
548
- readonly notices?: readonly {
549
- readonly type: "filtered" | "moderated" | "other";
550
- readonly message: string;
551
- readonly providerMetadata?: {
552
- readonly [x: string]: {
553
- readonly [x: string]: unknown;
554
- };
555
- } | undefined;
556
- }[] | undefined;
557
514
  readonly providerMetadata?: {
558
515
  readonly [x: string]: {
559
516
  readonly [x: string]: unknown;
@@ -591,15 +548,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
591
548
  readonly [x: string]: unknown;
592
549
  } | undefined;
593
550
  } | undefined;
594
- readonly notices?: readonly {
595
- readonly type: "filtered" | "moderated" | "other";
596
- readonly message: string;
597
- readonly providerMetadata?: {
598
- readonly [x: string]: {
599
- readonly [x: string]: unknown;
600
- };
601
- } | undefined;
602
- }[] | undefined;
603
551
  readonly providerMetadata?: {
604
552
  readonly [x: string]: {
605
553
  readonly [x: string]: unknown;
@@ -696,11 +644,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
696
644
  readonly type: Schema.Literal<"compute">;
697
645
  readonly seconds: Schema.Number;
698
646
  }>]>>;
699
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
700
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
701
- readonly message: Schema.String;
702
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
703
- }>>>;
704
647
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
705
648
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
706
649
  readonly type: "audio-delta";
@@ -744,15 +687,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
744
687
  readonly [x: string]: unknown;
745
688
  } | undefined;
746
689
  } | undefined;
747
- readonly notices?: readonly {
748
- readonly type: "filtered" | "moderated" | "other";
749
- readonly message: string;
750
- readonly providerMetadata?: {
751
- readonly [x: string]: {
752
- readonly [x: string]: unknown;
753
- };
754
- } | undefined;
755
- }[] | undefined;
756
690
  readonly providerMetadata?: {
757
691
  readonly [x: string]: {
758
692
  readonly [x: string]: unknown;
@@ -829,11 +763,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
829
763
  readonly type: Schema.Literal<"compute">;
830
764
  readonly seconds: Schema.Number;
831
765
  }>]>>;
832
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
833
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
834
- readonly message: Schema.String;
835
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
836
- }>>>;
837
766
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
838
767
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
839
768
  readonly type: "audio-delta";
@@ -877,15 +806,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
877
806
  readonly [x: string]: unknown;
878
807
  } | undefined;
879
808
  } | undefined;
880
- readonly notices?: readonly {
881
- readonly type: "filtered" | "moderated" | "other";
882
- readonly message: string;
883
- readonly providerMetadata?: {
884
- readonly [x: string]: {
885
- readonly [x: string]: unknown;
886
- };
887
- } | undefined;
888
- }[] | undefined;
889
809
  readonly providerMetadata?: {
890
810
  readonly [x: string]: {
891
811
  readonly [x: string]: unknown;
@@ -964,11 +884,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
964
884
  readonly type: Schema.Literal<"compute">;
965
885
  readonly seconds: Schema.Number;
966
886
  }>]>>;
967
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
968
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
969
- readonly message: Schema.String;
970
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
971
- }>>>;
972
887
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
973
888
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
974
889
  readonly type: "audio-delta";
@@ -1012,15 +927,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1012
927
  readonly [x: string]: unknown;
1013
928
  } | undefined;
1014
929
  } | undefined;
1015
- readonly notices?: readonly {
1016
- readonly type: "filtered" | "moderated" | "other";
1017
- readonly message: string;
1018
- readonly providerMetadata?: {
1019
- readonly [x: string]: {
1020
- readonly [x: string]: unknown;
1021
- };
1022
- } | undefined;
1023
- }[] | undefined;
1024
930
  readonly providerMetadata?: {
1025
931
  readonly [x: string]: {
1026
932
  readonly [x: string]: unknown;
@@ -1068,15 +974,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1068
974
  readonly [x: string]: unknown;
1069
975
  } | undefined;
1070
976
  } | undefined;
1071
- readonly notices?: readonly {
1072
- readonly type: "filtered" | "moderated" | "other";
1073
- readonly message: string;
1074
- readonly providerMetadata?: {
1075
- readonly [x: string]: {
1076
- readonly [x: string]: unknown;
1077
- };
1078
- } | undefined;
1079
- }[] | undefined;
1080
977
  readonly providerMetadata?: {
1081
978
  readonly [x: string]: {
1082
979
  readonly [x: string]: unknown;
@@ -1153,11 +1050,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1153
1050
  readonly type: Schema.Literal<"compute">;
1154
1051
  readonly seconds: Schema.Number;
1155
1052
  }>]>>;
1156
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
1157
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
1158
- readonly message: Schema.String;
1159
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1160
- }>>>;
1161
1053
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1162
1054
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
1163
1055
  readonly type: "audio-delta";
@@ -1201,15 +1093,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1201
1093
  readonly [x: string]: unknown;
1202
1094
  } | undefined;
1203
1095
  } | undefined;
1204
- readonly notices?: readonly {
1205
- readonly type: "filtered" | "moderated" | "other";
1206
- readonly message: string;
1207
- readonly providerMetadata?: {
1208
- readonly [x: string]: {
1209
- readonly [x: string]: unknown;
1210
- };
1211
- } | undefined;
1212
- }[] | undefined;
1213
1096
  readonly providerMetadata?: {
1214
1097
  readonly [x: string]: {
1215
1098
  readonly [x: string]: unknown;
@@ -1257,15 +1140,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1257
1140
  readonly [x: string]: unknown;
1258
1141
  } | undefined;
1259
1142
  } | undefined;
1260
- readonly notices?: readonly {
1261
- readonly type: "filtered" | "moderated" | "other";
1262
- readonly message: string;
1263
- readonly providerMetadata?: {
1264
- readonly [x: string]: {
1265
- readonly [x: string]: unknown;
1266
- };
1267
- } | undefined;
1268
- }[] | undefined;
1269
1143
  readonly providerMetadata?: {
1270
1144
  readonly [x: string]: {
1271
1145
  readonly [x: string]: unknown;
@@ -1321,15 +1195,6 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1321
1195
  readonly [x: string]: unknown;
1322
1196
  } | undefined;
1323
1197
  } | undefined;
1324
- readonly notices?: readonly {
1325
- readonly type: "filtered" | "moderated" | "other";
1326
- readonly message: string;
1327
- readonly providerMetadata?: {
1328
- readonly [x: string]: {
1329
- readonly [x: string]: unknown;
1330
- };
1331
- } | undefined;
1332
- }[] | undefined;
1333
1198
  readonly providerMetadata?: {
1334
1199
  readonly [x: string]: {
1335
1200
  readonly [x: string]: unknown;
package/dist/speech.js CHANGED
@@ -53,7 +53,6 @@ export class SpeechResponse extends Schema.Class("Speech.Response")({
53
53
  audio: Media.AssetSchema,
54
54
  timestamps: Schema.optional(Schema.Array(SpeechTimestamp)),
55
55
  usage: Schema.optional(MediaUsage),
56
- notices: Schema.optional(Schema.Array(Media.Notice)),
57
56
  providerMetadata: Schema.optional(ProviderMetadata),
58
57
  }) {
59
58
  }
@@ -70,7 +69,6 @@ export const SpeechFinishEvent = Schema.Struct({
70
69
  type: Schema.tag("finish"),
71
70
  audio: Media.AssetSchema,
72
71
  usage: Schema.optional(MediaUsage),
73
- notices: Schema.optional(Schema.Array(Media.Notice)),
74
72
  providerMetadata: Schema.optional(ProviderMetadata),
75
73
  }).annotate({ identifier: "Speech.Event.Finish" });
76
74
  const speechEventTagged = Schema.Union([
@@ -99,7 +97,6 @@ const collectResponse = (events) => {
99
97
  audio: finish.audio,
100
98
  timestamps: timestamps.length === 0 ? undefined : timestamps,
101
99
  usage: finish.usage,
102
- notices: finish.notices,
103
100
  providerMetadata: finish.providerMetadata,
104
101
  }));
105
102
  };
@@ -59,15 +59,6 @@ export declare const TranscriptionClient: {
59
59
  readonly [x: string]: unknown;
60
60
  } | undefined;
61
61
  } | undefined;
62
- readonly notices?: readonly {
63
- readonly type: "filtered" | "moderated" | "other";
64
- readonly message: string;
65
- readonly providerMetadata?: {
66
- readonly [x: string]: {
67
- readonly [x: string]: unknown;
68
- };
69
- } | undefined;
70
- }[] | undefined;
71
62
  readonly providerMetadata?: {
72
63
  readonly [x: string]: {
73
64
  readonly [x: string]: unknown;