@builder.io/ai-utils 0.81.3 → 0.83.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.
@@ -0,0 +1,82 @@
1
+ import { z } from "zod";
2
+ export declare const BUILDER_EMBEDDING_MODEL = "builder-multimodal-embedding";
3
+ export declare const BUILDER_EMBEDDING_DIMENSIONS = 1024;
4
+ export declare const BUILDER_EMBEDDING_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
5
+ export declare const BuilderEmbeddingImageSchema: z.ZodObject<{
6
+ mimeType: z.ZodEnum<{
7
+ "image/gif": "image/gif";
8
+ "image/jpeg": "image/jpeg";
9
+ "image/png": "image/png";
10
+ "image/webp": "image/webp";
11
+ }>;
12
+ data: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export declare const BuilderEmbeddingInputSchema: z.ZodObject<{
15
+ text: z.ZodOptional<z.ZodString>;
16
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
17
+ mimeType: z.ZodEnum<{
18
+ "image/gif": "image/gif";
19
+ "image/jpeg": "image/jpeg";
20
+ "image/png": "image/png";
21
+ "image/webp": "image/webp";
22
+ }>;
23
+ data: z.ZodString;
24
+ }, z.core.$strip>>>;
25
+ }, z.core.$strip>;
26
+ export declare const BuilderEmbeddingsRequestSchema: z.ZodObject<{
27
+ model: z.ZodDefault<z.ZodEnum<{
28
+ auto: "auto";
29
+ "builder-multimodal-embedding": "builder-multimodal-embedding";
30
+ }>>;
31
+ inputType: z.ZodDefault<z.ZodEnum<{
32
+ document: "document";
33
+ query: "query";
34
+ }>>;
35
+ inputs: z.ZodArray<z.ZodObject<{
36
+ text: z.ZodOptional<z.ZodString>;
37
+ images: z.ZodDefault<z.ZodArray<z.ZodObject<{
38
+ mimeType: z.ZodEnum<{
39
+ "image/gif": "image/gif";
40
+ "image/jpeg": "image/jpeg";
41
+ "image/png": "image/png";
42
+ "image/webp": "image/webp";
43
+ }>;
44
+ data: z.ZodString;
45
+ }, z.core.$strip>>>;
46
+ }, z.core.$strip>>;
47
+ source: z.ZodOptional<z.ZodObject<{
48
+ appId: z.ZodOptional<z.ZodString>;
49
+ feature: z.ZodOptional<z.ZodString>;
50
+ resourceId: z.ZodOptional<z.ZodString>;
51
+ userId: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>>;
53
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
54
+ }, z.core.$strip>;
55
+ export type BuilderEmbeddingsRequestInput = z.input<typeof BuilderEmbeddingsRequestSchema>;
56
+ export type BuilderEmbeddingsRequest = z.output<typeof BuilderEmbeddingsRequestSchema>;
57
+ export declare const BuilderEmbeddingsResponseSchema: z.ZodObject<{
58
+ id: z.ZodString;
59
+ object: z.ZodLiteral<"list">;
60
+ model: z.ZodObject<{
61
+ publicId: z.ZodLiteral<"builder-multimodal-embedding">;
62
+ provider: z.ZodLiteral<"voyage">;
63
+ providerModel: z.ZodLiteral<"voyage-multimodal-3.5">;
64
+ version: z.ZodLiteral<"3.5">;
65
+ dimensions: z.ZodLiteral<1024>;
66
+ }, z.core.$strip>;
67
+ inputType: z.ZodEnum<{
68
+ document: "document";
69
+ query: "query";
70
+ }>;
71
+ data: z.ZodArray<z.ZodObject<{
72
+ object: z.ZodLiteral<"embedding">;
73
+ index: z.ZodNumber;
74
+ embedding: z.ZodArray<z.ZodNumber>;
75
+ }, z.core.$strip>>;
76
+ usage: z.ZodObject<{
77
+ textTokens: z.ZodNumber;
78
+ imagePixels: z.ZodNumber;
79
+ totalTokens: z.ZodNumber;
80
+ }, z.core.$strip>;
81
+ }, z.core.$strip>;
82
+ export type BuilderEmbeddingsResponse = z.infer<typeof BuilderEmbeddingsResponseSchema>;
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ export const BUILDER_EMBEDDING_MODEL = "builder-multimodal-embedding";
3
+ export const BUILDER_EMBEDDING_DIMENSIONS = 1024;
4
+ export const BUILDER_EMBEDDING_IMAGE_MIME_TYPES = [
5
+ "image/png",
6
+ "image/jpeg",
7
+ "image/webp",
8
+ "image/gif",
9
+ ];
10
+ const MAX_IMAGE_BASE64_LENGTH = 14000000;
11
+ const MAX_REQUEST_BASE64_LENGTH = 24000000;
12
+ const MAX_REQUEST_TEXT_LENGTH = 256000;
13
+ export const BuilderEmbeddingImageSchema = z.object({
14
+ mimeType: z.enum(BUILDER_EMBEDDING_IMAGE_MIME_TYPES),
15
+ data: z
16
+ .string()
17
+ .min(1)
18
+ .max(MAX_IMAGE_BASE64_LENGTH)
19
+ .regex(/^[A-Za-z0-9+/]*={0,2}$/, "Image data must be raw base64."),
20
+ });
21
+ export const BuilderEmbeddingInputSchema = z
22
+ .object({
23
+ text: z.string().trim().min(1).max(32000).optional(),
24
+ images: z.array(BuilderEmbeddingImageSchema).max(6).default([]),
25
+ })
26
+ .superRefine((input, ctx) => {
27
+ if (!input.text && input.images.length === 0) {
28
+ ctx.addIssue({
29
+ code: "custom",
30
+ message: "Each input must contain text, an image, or both.",
31
+ });
32
+ }
33
+ });
34
+ export const BuilderEmbeddingsRequestSchema = z
35
+ .object({
36
+ model: z.enum(["auto", BUILDER_EMBEDDING_MODEL]).default("auto"),
37
+ inputType: z.enum(["query", "document"]).default("document"),
38
+ inputs: z.array(BuilderEmbeddingInputSchema).min(1).max(32),
39
+ source: z
40
+ .object({
41
+ appId: z.string().max(100).optional(),
42
+ feature: z.string().max(100).optional(),
43
+ resourceId: z.string().max(200).optional(),
44
+ userId: z.string().max(200).optional(),
45
+ })
46
+ .optional(),
47
+ metadata: z.record(z.string().max(100), z.string().max(1000)).optional(),
48
+ })
49
+ .superRefine((request, ctx) => {
50
+ var _a;
51
+ var _b;
52
+ let base64Length = 0;
53
+ let textLength = 0;
54
+ for (const input of request.inputs) {
55
+ textLength += (_b = (_a = input.text) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
56
+ for (const image of input.images)
57
+ base64Length += image.data.length;
58
+ }
59
+ if (base64Length > MAX_REQUEST_BASE64_LENGTH) {
60
+ ctx.addIssue({
61
+ code: "too_big",
62
+ maximum: MAX_REQUEST_BASE64_LENGTH,
63
+ origin: "string",
64
+ inclusive: true,
65
+ message: "Combined image data is too large.",
66
+ path: ["inputs"],
67
+ });
68
+ }
69
+ if (textLength > MAX_REQUEST_TEXT_LENGTH) {
70
+ ctx.addIssue({
71
+ code: "too_big",
72
+ maximum: MAX_REQUEST_TEXT_LENGTH,
73
+ origin: "string",
74
+ inclusive: true,
75
+ message: "Combined text input is too large.",
76
+ path: ["inputs"],
77
+ });
78
+ }
79
+ })
80
+ .meta({
81
+ description: "Request body for POST /agent-native/embeddings/v1/embeddings.",
82
+ });
83
+ export const BuilderEmbeddingsResponseSchema = z.object({
84
+ id: z.string(),
85
+ object: z.literal("list"),
86
+ model: z.object({
87
+ publicId: z.literal(BUILDER_EMBEDDING_MODEL),
88
+ provider: z.literal("voyage"),
89
+ providerModel: z.literal("voyage-multimodal-3.5"),
90
+ version: z.literal("3.5"),
91
+ dimensions: z.literal(BUILDER_EMBEDDING_DIMENSIONS),
92
+ }),
93
+ inputType: z.enum(["query", "document"]),
94
+ data: z.array(z.object({
95
+ object: z.literal("embedding"),
96
+ index: z.number().int().nonnegative(),
97
+ embedding: z
98
+ .array(z.number().finite())
99
+ .length(BUILDER_EMBEDDING_DIMENSIONS),
100
+ })),
101
+ usage: z.object({
102
+ textTokens: z.number().int().nonnegative(),
103
+ imagePixels: z.number().int().nonnegative(),
104
+ totalTokens: z.number().int().nonnegative(),
105
+ }),
106
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { BUILDER_EMBEDDING_MODEL, BuilderEmbeddingsRequestSchema, } from "./embeddings";
3
+ describe("BuilderEmbeddingsRequestSchema", () => {
4
+ it("accepts retrieval text and multimodal inputs", () => {
5
+ var _a;
6
+ const parsed = BuilderEmbeddingsRequestSchema.parse({
7
+ model: BUILDER_EMBEDDING_MODEL,
8
+ inputType: "document",
9
+ inputs: [
10
+ { text: "A product launch slide" },
11
+ {
12
+ text: "A warm editorial campaign",
13
+ images: [{ mimeType: "image/png", data: "aGVsbG8=" }],
14
+ },
15
+ ],
16
+ });
17
+ expect(parsed.inputs).toHaveLength(2);
18
+ expect((_a = parsed.inputs[1]) === null || _a === void 0 ? void 0 : _a.images).toHaveLength(1);
19
+ });
20
+ it("rejects empty inputs and data URLs", () => {
21
+ expect(() => BuilderEmbeddingsRequestSchema.parse({ inputs: [{}] })).toThrow(/text, an image, or both/);
22
+ expect(() => BuilderEmbeddingsRequestSchema.parse({
23
+ inputs: [
24
+ {
25
+ images: [
26
+ {
27
+ mimeType: "image/png",
28
+ data: "data:image/png;base64,aGVsbG8=",
29
+ },
30
+ ],
31
+ },
32
+ ],
33
+ })).toThrow(/raw base64/);
34
+ });
35
+ it("rejects unsupported image formats and oversized batches", () => {
36
+ expect(() => BuilderEmbeddingsRequestSchema.parse({
37
+ inputs: [{ images: [{ mimeType: "image/svg+xml", data: "PHN2Zz4=" }] }],
38
+ })).toThrow();
39
+ expect(() => BuilderEmbeddingsRequestSchema.parse({
40
+ inputs: Array.from({ length: 33 }, () => ({ text: "text" })),
41
+ })).toThrow();
42
+ });
43
+ });
package/src/index.d.ts CHANGED
@@ -19,4 +19,7 @@ export * from "./connectivity/types.js";
19
19
  export * from "./connectivity/classify.js";
20
20
  export * from "./single-tenancy.js";
21
21
  export * from "./design-systems.js";
22
+ export * from "./editor-ai.js";
23
+ export * from "./realtime.js";
24
+ export * from "./embeddings.js";
22
25
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
package/src/index.js CHANGED
@@ -19,4 +19,7 @@ export * from "./connectivity/types.js";
19
19
  export * from "./connectivity/classify.js";
20
20
  export * from "./single-tenancy.js";
21
21
  export * from "./design-systems.js";
22
+ export * from "./editor-ai.js";
23
+ export * from "./realtime.js";
24
+ export * from "./embeddings.js";
22
25
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
package/src/messages.d.ts CHANGED
@@ -93,6 +93,14 @@ export interface MCPServerURLDefinition {
93
93
  serverId: string;
94
94
  disabled: boolean;
95
95
  clientName?: string;
96
+ /**
97
+ * Per-server opt-in to the LLM-driven `mcp__<name>__authenticate` flow,
98
+ * independent of the `codegen-tool-mcp-authenticate` LD flag. Set on the
99
+ * Firestore `mcpServers` doc to roll the tool out to one server at a time;
100
+ * the LD flag remains the org-wide switch. Either being true opts the
101
+ * server in, so the flag can still turn it on everywhere at once.
102
+ */
103
+ useAuthenticateTool?: boolean;
96
104
  }
97
105
  export interface MCPServerToolConfiguration {
98
106
  allowed_tools?: Array<string> | null;
@@ -119,6 +127,13 @@ export interface MCPServerDoc<TCreateDate = unknown, TLegacyTokenExpiresAt = nev
119
127
  disabled?: boolean;
120
128
  clientName: string | undefined;
121
129
  tool_configuration?: MCPServerToolConfiguration | null;
130
+ /**
131
+ * Opt this server in to the LLM-driven `mcp__<name>__authenticate` tool
132
+ * instead of the blocking `mcp-auth-required` event, without turning on the
133
+ * org-wide `codegen-tool-mcp-authenticate` LD flag. Lets a single MCP server
134
+ * ship on the tool path ahead of the rest.
135
+ */
136
+ useAuthenticateTool?: boolean;
122
137
  oauthMetadata?: MCPServerOAuthMetadata | null;
123
138
  authorizationToken?: string;
124
139
  refreshToken?: string | null;
@@ -1,5 +1,11 @@
1
1
  import type { PrivacyMode, ReviewEffort } from "./codegen";
2
2
  import type { EnvironmentVariable } from "./common-schemas";
3
+ export interface GitlabEnterpriseSetupValue {
4
+ host: string;
5
+ secondaryHost?: string;
6
+ setupType: "oauth" | "pat";
7
+ clientId?: string;
8
+ }
3
9
  export interface GithubEnterpriseSetupValue {
4
10
  host: string;
5
11
  clientId: string;
@@ -19,6 +25,8 @@ export interface GitlabEnterprisePATValue {
19
25
  host: string;
20
26
  botUsername: string;
21
27
  secondaryHost?: string;
28
+ createdBy?: string;
29
+ createdAt?: number;
22
30
  }
23
31
  export interface GitlabCloudFallbackToken {
24
32
  token: string;
@@ -79,6 +87,7 @@ interface OrganizationSettings {
79
87
  isUserPluginIntegrationRequestGranted?: boolean;
80
88
  shopify?: boolean;
81
89
  githubEnterpriseSetupValue?: GithubEnterpriseSetupValue;
90
+ gitlabEnterpriseSetupValue?: GitlabEnterpriseSetupValue;
82
91
  gitlabEnterprisePAT?: GitlabEnterprisePATValue;
83
92
  gitlabCloudFallbackToken?: GitlabCloudFallbackToken;
84
93
  azureCloudFallbackToken?: AzureCloudFallbackToken;
package/src/projects.d.ts CHANGED
@@ -153,7 +153,7 @@ export interface ReadyMessage extends BaseMessage {
153
153
  }
154
154
  export type MachineState = "unknown" | "created" | "starting" | "started" | "stopping" | "stopped" | "suspending" | "suspended" | "replacing" | "destroying" | "destroyed" | "not-found" | "running" | "failed";
155
155
  export type FlyVolumeState = "unknown" | "creating" | "created" | "extending" | "restoring" | "enabling_remote_export" | "hydrating" | "recovering" | "scheduling_destroy" | "pending_destroy" | "failed";
156
- export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" | "git-auth-failed-folder-added-by" | "git-auth-failed-folder-created-by" | "git-auth-failed-repo-not-found" | "git-auth-failed-repo-renamed" | "git-auth-failed-folder-server-token" | "git-auth-failed-root-repo-server-token" | "git-auth-failed-ghes-unreachable";
156
+ export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" | "git-auth-failed-folder-added-by" | "git-auth-failed-folder-created-by" | "git-auth-failed-repo-not-found" | "git-auth-failed-repo-renamed" | "git-auth-failed-folder-server-token" | "git-auth-failed-root-repo-server-token" | "git-auth-failed-ghes-unreachable" | "git-auth-reauth-required";
157
157
  /**
158
158
  * Git provider types for diagnostics.
159
159
  */
@@ -909,12 +909,6 @@ export interface Project {
909
909
  deletedAt?: InMigrationDateNullable;
910
910
  /** User ID of whoever deleted the project. */
911
911
  deletedBy?: string;
912
- /**
913
- * When true, branches are stored in the standalone `branches` collection
914
- * instead of embedded in project.branches field.
915
- * Defaults to false for backwards compatibility with existing projects.
916
- */
917
- useBranchesCollection?: boolean;
918
912
  /** When true, the project is in code-only mode */
919
913
  codeOnlyMode?: boolean;
920
914
  /**
@@ -1075,8 +1069,6 @@ export interface CreateProjectOptions {
1075
1069
  autoApplySetup?: boolean;
1076
1070
  templateId?: string;
1077
1071
  useInternalHost?: boolean;
1078
- /** Store branches in the standalone `branches` collection vs embedded in the project doc. */
1079
- useBranchesCollection?: boolean;
1080
1072
  /** @internal Read-only source repo cloned to bootstrap the project. Carried through to Firestore. */
1081
1073
  templateRepoUrl?: string;
1082
1074
  /** @internal First-class hosting config copied from the template. Carried through to Firestore. */
@@ -1728,7 +1720,6 @@ export declare const CloneProjectOptionsSchema: z.ZodObject<{
1728
1720
  }>;
1729
1721
  userEmail: z.ZodOptional<z.ZodString>;
1730
1722
  useKube: z.ZodDefault<z.ZodBoolean>;
1731
- useBranchesCollection: z.ZodDefault<z.ZodBoolean>;
1732
1723
  }, z.core.$strip>;
1733
1724
  export type CloneProjectOptions = z.infer<typeof CloneProjectOptionsSchema>;
1734
1725
  export declare const DuplicateBranchOptionsSchema: z.ZodObject<{
package/src/projects.js CHANGED
@@ -640,13 +640,6 @@ export const CloneProjectOptionsSchema = z.object({
640
640
  useKube: z.boolean().default(false).meta({
641
641
  description: "Whether to provision on cloud-v2 (Kubernetes). Defaults to false.",
642
642
  }),
643
- useBranchesCollection: z
644
- .boolean()
645
- .default(false)
646
- .meta({
647
- description: "Whether the new project stores branches in the standalone `branches` " +
648
- "collection rather than embedded in the project doc. Defaults to false.",
649
- }),
650
643
  });
651
644
  export const DuplicateBranchOptionsSchema = z.object({
652
645
  projectId: z.string().min(1).meta({
package/src/proxy.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface ProxyConfig {
20
20
  *
21
21
  * `proxyDestination` is always passed through unchanged.
22
22
  */
23
- export declare function getProxyConfig({ devServerUrl, proxyOrigin, proxyDefaultOrigin, proxyDestination }: ProxyConfig): {
23
+ export declare function getProxyConfig({ devServerUrl, proxyOrigin, proxyDefaultOrigin, proxyDestination, }: ProxyConfig): {
24
24
  proxyOrigin: string | undefined;
25
25
  proxyDefaultOrigin: string | undefined;
26
26
  proxyDestination: string | undefined;
@@ -0,0 +1,232 @@
1
+ import { z } from "zod";
2
+ export declare const BUILDER_REALTIME_MODEL: "gpt-realtime-2.1";
3
+ export declare const BUILDER_REALTIME_MAX_SDP_LENGTH = 256000;
4
+ export declare const BUILDER_REALTIME_MAX_SESSION_BYTES = 64000;
5
+ export declare const OpenAIRealtimeFunctionToolSchema: z.ZodObject<{
6
+ type: z.ZodLiteral<"function">;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ strict: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>;
12
+ export type OpenAIRealtimeFunctionTool = z.infer<typeof OpenAIRealtimeFunctionToolSchema>;
13
+ export declare const OpenAIRealtimeMcpToolSchema: z.ZodObject<{
14
+ type: z.ZodLiteral<"mcp">;
15
+ server_label: z.ZodString;
16
+ server_url: z.ZodOptional<z.ZodURL>;
17
+ server_description: z.ZodOptional<z.ZodString>;
18
+ authorization: z.ZodOptional<z.ZodString>;
19
+ allowed_tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
20
+ require_approval: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
21
+ always: "always";
22
+ never: "never";
23
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
24
+ }, z.core.$strip>;
25
+ export type OpenAIRealtimeMcpTool = z.infer<typeof OpenAIRealtimeMcpToolSchema>;
26
+ export declare const OpenAIRealtimeToolSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
27
+ type: z.ZodLiteral<"function">;
28
+ name: z.ZodString;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
31
+ strict: z.ZodOptional<z.ZodBoolean>;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ type: z.ZodLiteral<"mcp">;
34
+ server_label: z.ZodString;
35
+ server_url: z.ZodOptional<z.ZodURL>;
36
+ server_description: z.ZodOptional<z.ZodString>;
37
+ authorization: z.ZodOptional<z.ZodString>;
38
+ allowed_tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
39
+ require_approval: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
40
+ always: "always";
41
+ never: "never";
42
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
43
+ }, z.core.$strip>], "type">;
44
+ export type OpenAIRealtimeTool = z.infer<typeof OpenAIRealtimeToolSchema>;
45
+ /**
46
+ * The subset of OpenAI's Realtime session configuration accepted by Builder
47
+ * Connect. Zod objects intentionally strip unknown keys before this config is
48
+ * forwarded to OpenAI.
49
+ */
50
+ export declare const OpenAIRealtimeSessionConfigSchema: z.ZodObject<{
51
+ type: z.ZodLiteral<"realtime">;
52
+ model: z.ZodLiteral<"gpt-realtime-2.1">;
53
+ output_modalities: z.ZodTuple<[z.ZodLiteral<"audio">], null>;
54
+ instructions: z.ZodOptional<z.ZodString>;
55
+ audio: z.ZodOptional<z.ZodObject<{
56
+ input: z.ZodOptional<z.ZodObject<{
57
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
58
+ noise_reduction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
59
+ type: z.ZodEnum<{
60
+ far_field: "far_field";
61
+ near_field: "near_field";
62
+ }>;
63
+ }, z.core.$strip>>>;
64
+ transcription: z.ZodOptional<z.ZodNullable<z.ZodObject<{
65
+ model: z.ZodLiteral<"gpt-4o-mini-transcribe">;
66
+ language: z.ZodOptional<z.ZodString>;
67
+ prompt: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strip>>>;
69
+ turn_detection: z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
+ type: z.ZodEnum<{
71
+ semantic_vad: "semantic_vad";
72
+ server_vad: "server_vad";
73
+ }>;
74
+ threshold: z.ZodOptional<z.ZodNumber>;
75
+ prefix_padding_ms: z.ZodOptional<z.ZodNumber>;
76
+ silence_duration_ms: z.ZodOptional<z.ZodNumber>;
77
+ idle_timeout_ms: z.ZodOptional<z.ZodNumber>;
78
+ eagerness: z.ZodOptional<z.ZodEnum<{
79
+ auto: "auto";
80
+ high: "high";
81
+ low: "low";
82
+ medium: "medium";
83
+ }>>;
84
+ create_response: z.ZodOptional<z.ZodBoolean>;
85
+ interrupt_response: z.ZodOptional<z.ZodBoolean>;
86
+ }, z.core.$strip>>>;
87
+ }, z.core.$strip>>;
88
+ output: z.ZodOptional<z.ZodObject<{
89
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
90
+ voice: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
91
+ id: z.ZodString;
92
+ }, z.core.$strip>]>>;
93
+ speed: z.ZodOptional<z.ZodNumber>;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>>;
96
+ tools: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
97
+ type: z.ZodLiteral<"function">;
98
+ name: z.ZodString;
99
+ description: z.ZodOptional<z.ZodString>;
100
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
101
+ strict: z.ZodOptional<z.ZodBoolean>;
102
+ }, z.core.$strip>, z.ZodObject<{
103
+ type: z.ZodLiteral<"mcp">;
104
+ server_label: z.ZodString;
105
+ server_url: z.ZodOptional<z.ZodURL>;
106
+ server_description: z.ZodOptional<z.ZodString>;
107
+ authorization: z.ZodOptional<z.ZodString>;
108
+ allowed_tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
109
+ require_approval: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
110
+ always: "always";
111
+ never: "never";
112
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
113
+ }, z.core.$strip>], "type">>>;
114
+ tool_choice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
115
+ auto: "auto";
116
+ none: "none";
117
+ required: "required";
118
+ }>, z.ZodObject<{
119
+ type: z.ZodLiteral<"function">;
120
+ name: z.ZodString;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ type: z.ZodLiteral<"mcp">;
123
+ server_label: z.ZodString;
124
+ name: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>]>>;
126
+ max_output_tokens: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inf">, z.ZodNumber]>>;
127
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodObject<{
128
+ id: z.ZodString;
129
+ version: z.ZodOptional<z.ZodString>;
130
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
131
+ }, z.core.$strip>>>;
132
+ tracing: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>>;
133
+ truncation: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
134
+ auto: "auto";
135
+ disabled: "disabled";
136
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
137
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
138
+ }, z.core.$strip>;
139
+ export type OpenAIRealtimeSessionConfig = z.infer<typeof OpenAIRealtimeSessionConfigSchema>;
140
+ export declare const BuilderRealtimeSessionRequestSchema: z.ZodObject<{
141
+ sdp: z.ZodString;
142
+ session: z.ZodObject<{
143
+ type: z.ZodLiteral<"realtime">;
144
+ model: z.ZodLiteral<"gpt-realtime-2.1">;
145
+ output_modalities: z.ZodTuple<[z.ZodLiteral<"audio">], null>;
146
+ instructions: z.ZodOptional<z.ZodString>;
147
+ audio: z.ZodOptional<z.ZodObject<{
148
+ input: z.ZodOptional<z.ZodObject<{
149
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
150
+ noise_reduction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
151
+ type: z.ZodEnum<{
152
+ far_field: "far_field";
153
+ near_field: "near_field";
154
+ }>;
155
+ }, z.core.$strip>>>;
156
+ transcription: z.ZodOptional<z.ZodNullable<z.ZodObject<{
157
+ model: z.ZodLiteral<"gpt-4o-mini-transcribe">;
158
+ language: z.ZodOptional<z.ZodString>;
159
+ prompt: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>>>;
161
+ turn_detection: z.ZodOptional<z.ZodNullable<z.ZodObject<{
162
+ type: z.ZodEnum<{
163
+ semantic_vad: "semantic_vad";
164
+ server_vad: "server_vad";
165
+ }>;
166
+ threshold: z.ZodOptional<z.ZodNumber>;
167
+ prefix_padding_ms: z.ZodOptional<z.ZodNumber>;
168
+ silence_duration_ms: z.ZodOptional<z.ZodNumber>;
169
+ idle_timeout_ms: z.ZodOptional<z.ZodNumber>;
170
+ eagerness: z.ZodOptional<z.ZodEnum<{
171
+ auto: "auto";
172
+ high: "high";
173
+ low: "low";
174
+ medium: "medium";
175
+ }>>;
176
+ create_response: z.ZodOptional<z.ZodBoolean>;
177
+ interrupt_response: z.ZodOptional<z.ZodBoolean>;
178
+ }, z.core.$strip>>>;
179
+ }, z.core.$strip>>;
180
+ output: z.ZodOptional<z.ZodObject<{
181
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
182
+ voice: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
183
+ id: z.ZodString;
184
+ }, z.core.$strip>]>>;
185
+ speed: z.ZodOptional<z.ZodNumber>;
186
+ }, z.core.$strip>>;
187
+ }, z.core.$strip>>;
188
+ tools: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
189
+ type: z.ZodLiteral<"function">;
190
+ name: z.ZodString;
191
+ description: z.ZodOptional<z.ZodString>;
192
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
193
+ strict: z.ZodOptional<z.ZodBoolean>;
194
+ }, z.core.$strip>, z.ZodObject<{
195
+ type: z.ZodLiteral<"mcp">;
196
+ server_label: z.ZodString;
197
+ server_url: z.ZodOptional<z.ZodURL>;
198
+ server_description: z.ZodOptional<z.ZodString>;
199
+ authorization: z.ZodOptional<z.ZodString>;
200
+ allowed_tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
201
+ require_approval: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
202
+ always: "always";
203
+ never: "never";
204
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
205
+ }, z.core.$strip>], "type">>>;
206
+ tool_choice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
207
+ auto: "auto";
208
+ none: "none";
209
+ required: "required";
210
+ }>, z.ZodObject<{
211
+ type: z.ZodLiteral<"function">;
212
+ name: z.ZodString;
213
+ }, z.core.$strip>, z.ZodObject<{
214
+ type: z.ZodLiteral<"mcp">;
215
+ server_label: z.ZodString;
216
+ name: z.ZodOptional<z.ZodString>;
217
+ }, z.core.$strip>]>>;
218
+ max_output_tokens: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inf">, z.ZodNumber]>>;
219
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodObject<{
220
+ id: z.ZodString;
221
+ version: z.ZodOptional<z.ZodString>;
222
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
223
+ }, z.core.$strip>>>;
224
+ tracing: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>>;
225
+ truncation: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
226
+ auto: "auto";
227
+ disabled: "disabled";
228
+ }>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
229
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
230
+ }, z.core.$strip>;
231
+ }, z.core.$strip>;
232
+ export type BuilderRealtimeSessionRequest = z.infer<typeof BuilderRealtimeSessionRequestSchema>;