@builder.io/ai-utils 0.105.0 → 0.107.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/codegen.d.ts +12 -0
- package/src/codegen.js +16 -0
- package/src/common-schemas.d.ts +5 -0
- package/src/common-schemas.js +12 -0
- package/src/credits.d.ts +10 -0
- package/src/credits.js +9 -0
- package/src/events.d.ts +40 -1
- package/src/events.js +8 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/organization.d.ts +1 -0
- package/src/projects.d.ts +1412 -134
- package/src/projects.js +56 -5
- package/src/projects.test.js +1 -4
- package/src/realtime.d.ts +4 -3
- package/src/realtime.js +11 -2
- package/src/realtime.spec.js +14 -1
- package/src/repo-indexing.d.ts +4 -0
- package/src/single-tenancy.d.ts +17 -4
- package/src/single-tenancy.js +10 -3
- package/src/system-one.d.ts +4 -0
- package/src/system-one.js +7 -0
- package/src/system-one.spec.js +5 -1
package/src/projects.js
CHANGED
|
@@ -399,6 +399,14 @@ export const ShapeSessionSchema = z.object({
|
|
|
399
399
|
assembledAt: z.string().optional(),
|
|
400
400
|
resolvedAt: z.string().optional(),
|
|
401
401
|
});
|
|
402
|
+
/**
|
|
403
|
+
* Stored shape of the top-level `shapeSessions/{projectId}` Firestore
|
|
404
|
+
* collection: a `ShapeSession` plus the `projectId` it belongs to, since the
|
|
405
|
+
* doc ID alone isn't visible once the doc is loaded into memory.
|
|
406
|
+
*/
|
|
407
|
+
export const ShapeSessionDocSchema = ShapeSessionSchema.extend({
|
|
408
|
+
projectId: z.string(),
|
|
409
|
+
});
|
|
402
410
|
export const InitialPromptSchema = z.object({
|
|
403
411
|
id: z.string(),
|
|
404
412
|
projectId: z.string(),
|
|
@@ -769,6 +777,9 @@ export const ProjectSettingsSchema = z
|
|
|
769
777
|
authPassword: z.string().optional().meta({
|
|
770
778
|
description: "Password for sites requiring authentication.",
|
|
771
779
|
}),
|
|
780
|
+
branchBrowser: z.boolean().optional().meta({
|
|
781
|
+
description: "Run a headed Chrome inside every cloud branch container, which the agent drives from scripts over DevTools.",
|
|
782
|
+
}),
|
|
772
783
|
})
|
|
773
784
|
.optional()
|
|
774
785
|
.meta({
|
|
@@ -896,9 +907,6 @@ export const ProjectSettingsSchema = z
|
|
|
896
907
|
})
|
|
897
908
|
.optional()
|
|
898
909
|
.meta({ description: "Password-protect the preview URL." }),
|
|
899
|
-
shapeSession: ShapeSessionSchema.optional().meta({
|
|
900
|
-
description: "@internal Guided-onboarding questionnaire issued for this project.",
|
|
901
|
-
}),
|
|
902
910
|
})
|
|
903
911
|
.meta({ title: "ProjectSettings" });
|
|
904
912
|
/**
|
|
@@ -922,7 +930,6 @@ const INTERNAL_PROJECT_SETTINGS_MASK = {
|
|
|
922
930
|
commitInstructions: true,
|
|
923
931
|
skipCommandSecurity: true,
|
|
924
932
|
autoCloseBranchOnMerge: true,
|
|
925
|
-
shapeSession: true,
|
|
926
933
|
};
|
|
927
934
|
/**
|
|
928
935
|
* Runtime schema for the client-writable subset of {@link Project.settings},
|
|
@@ -2018,7 +2025,13 @@ export const HostingDomainSchema = z.object({
|
|
|
2018
2025
|
description: "When `routeError` was last set.",
|
|
2019
2026
|
}),
|
|
2020
2027
|
servingConfirmedAt: z.number().optional().meta({
|
|
2021
|
-
description: "When the domain was confirmed serving over HTTPS: stamped by the serving-check loop once `https://<domain>/` answers over TLS through a Builder route (or by a healthy route recreate on deploy/repair). Definitive 'serving confirmed' signal for the UI's third setup step, distinct from cert issuance (`status: active`).",
|
|
2028
|
+
description: "When the domain was confirmed serving over HTTPS: stamped by the serving-check loop once `https://<domain>/` answers over TLS through a Builder route (or by a healthy route recreate on deploy/repair on an `active` domain). Definitive 'serving confirmed' signal for the UI's third setup step, distinct from cert issuance (`status: active`). Never set while `provisioning`.",
|
|
2029
|
+
}),
|
|
2030
|
+
certIssue: z.string().optional().meta({
|
|
2031
|
+
description: "Non-fatal, user-facing reason Google's latest certificate domain-authorization attempt failed while the domain is `provisioning` (e.g. the `_acme-challenge` CNAME wasn't found). Google keeps retrying, so `status` stays `provisioning`; this drives a warning on the HTTPS step instead of a silent spinner. Cleared when an attempt stops failing or the cert is issued.",
|
|
2032
|
+
}),
|
|
2033
|
+
certIssueAt: z.number().optional().meta({
|
|
2034
|
+
description: "When `certIssue` was last set.",
|
|
2022
2035
|
}),
|
|
2023
2036
|
createdBy: z.string(),
|
|
2024
2037
|
});
|
|
@@ -2311,3 +2324,41 @@ export const CreateProjectTemplateFromProjectOptionsSchema = z
|
|
|
2311
2324
|
export const CreateProjectTemplateFromProjectResponseSchema = z.object({
|
|
2312
2325
|
template: ProjectTemplateSchema.pick({ id: true, name: true }),
|
|
2313
2326
|
});
|
|
2327
|
+
export const ListProjectTemplatesOptionsSchema = z.object({
|
|
2328
|
+
id: z.string().min(1).optional(),
|
|
2329
|
+
});
|
|
2330
|
+
export const ListProjectTemplatesResponseSchema = z.object({
|
|
2331
|
+
templates: z.array(ProjectTemplateSchema),
|
|
2332
|
+
});
|
|
2333
|
+
export const UpdateProjectTemplateOptionsSchema = z.object({
|
|
2334
|
+
id: z.string().min(1),
|
|
2335
|
+
updates: ProjectTemplateOverridesSchema,
|
|
2336
|
+
});
|
|
2337
|
+
export const UpdateProjectTemplateResponseSchema = z.object({
|
|
2338
|
+
template: ProjectTemplateSchema,
|
|
2339
|
+
});
|
|
2340
|
+
export const DeleteProjectTemplateOptionsSchema = z.object({
|
|
2341
|
+
id: z.string().min(1),
|
|
2342
|
+
});
|
|
2343
|
+
export const DeleteProjectTemplateResponseSchema = z.object({
|
|
2344
|
+
deleted: z.boolean(),
|
|
2345
|
+
});
|
|
2346
|
+
export const ReorderProjectTemplatesOptionsSchema = z.object({
|
|
2347
|
+
orders: z
|
|
2348
|
+
.array(z.object({ id: z.string().min(1), order: z.number().int() }))
|
|
2349
|
+
.min(1),
|
|
2350
|
+
});
|
|
2351
|
+
export const ReorderProjectTemplatesResponseSchema = z.object({
|
|
2352
|
+
updatedIds: z.array(z.string()),
|
|
2353
|
+
});
|
|
2354
|
+
/**
|
|
2355
|
+
* `id` is omitted when a built-in (non-Firestore-backed) template becomes the
|
|
2356
|
+
* org default, so this just needs to clear `isDefault` on the owner's stored
|
|
2357
|
+
* templates without pointing it at a new one.
|
|
2358
|
+
*/
|
|
2359
|
+
export const SetDefaultProjectTemplateOptionsSchema = z.object({
|
|
2360
|
+
id: z.string().min(1).optional(),
|
|
2361
|
+
});
|
|
2362
|
+
export const SetDefaultProjectTemplateResponseSchema = z.object({
|
|
2363
|
+
defaultId: z.string().nullable(),
|
|
2364
|
+
});
|
package/src/projects.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { AGENT_NATIVE_STARTER_REPO, getAgentNativeRootPackageJsonWriteError, getManagedDatabasePackageJsonError, getProjectState, GetShapeQuestionnaireOptionsSchema, InitialPromptSchema, isProjectDeleted, matchesAgentNativeStarter, ProjectHostingExternalSchema, ProjectHostingSchema, ProjectSettingsExternalSchema,
|
|
2
|
+
import { AGENT_NATIVE_STARTER_REPO, getAgentNativeRootPackageJsonWriteError, getManagedDatabasePackageJsonError, getProjectState, GetShapeQuestionnaireOptionsSchema, InitialPromptSchema, isProjectDeleted, matchesAgentNativeStarter, ProjectHostingExternalSchema, ProjectHostingSchema, ProjectSettingsExternalSchema, ProjectTemplateOverridesSchema, ShapeSessionSchema, SubmitShapeAnswersOptionsSchema, } from "./projects";
|
|
3
3
|
describe("project hosting schemas", () => {
|
|
4
4
|
it("accepts the canonical published branch route", () => {
|
|
5
5
|
expect(ProjectHostingSchema.parse({ publishedBranchId: "branch-live" })).toEqual({ publishedBranchId: "branch-live" });
|
|
@@ -55,9 +55,6 @@ describe("guided onboarding project settings", () => {
|
|
|
55
55
|
};
|
|
56
56
|
it("parses a snapshotted questionnaire session", () => {
|
|
57
57
|
expect(ShapeSessionSchema.parse(shapeSession)).toEqual(shapeSession);
|
|
58
|
-
expect(ProjectSettingsSchema.parse({ shapeSession })).toEqual({
|
|
59
|
-
shapeSession,
|
|
60
|
-
});
|
|
61
58
|
});
|
|
62
59
|
it("requires a dated catalog version", () => {
|
|
63
60
|
expect(() => ShapeSessionSchema.parse({
|
package/src/realtime.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const BUILDER_REALTIME_MODEL: "gpt-live-1";
|
|
3
3
|
export declare const BUILDER_REALTIME_LEGACY_MODEL: "gpt-realtime-2.1";
|
|
4
|
-
export declare const BUILDER_REALTIME_DELEGATED_MODEL: "gpt-
|
|
4
|
+
export declare const BUILDER_REALTIME_DELEGATED_MODEL: "gpt-6-luna";
|
|
5
|
+
export declare const BUILDER_REALTIME_DELEGATED_MODEL_LEGACY: "gpt-5.6-luna";
|
|
5
6
|
export declare const BUILDER_REALTIME_MAX_SDP_LENGTH = 256000;
|
|
6
7
|
export declare const BUILDER_REALTIME_MAX_SESSION_BYTES = 64000;
|
|
7
8
|
export declare const OpenAIRealtimeFunctionToolSchema: z.ZodObject<{
|
|
@@ -153,7 +154,7 @@ export declare const OpenAILiveSessionConfigSchema: z.ZodObject<{
|
|
|
153
154
|
delegation: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
154
155
|
type: z.ZodLiteral<"responses">;
|
|
155
156
|
responses: z.ZodObject<{
|
|
156
|
-
model: z.ZodLiteral<"gpt-5.6-luna">;
|
|
157
|
+
model: z.ZodUnion<readonly [z.ZodLiteral<"gpt-6-luna">, z.ZodLiteral<"gpt-5.6-luna">]>;
|
|
157
158
|
instructions: z.ZodOptional<z.ZodString>;
|
|
158
159
|
tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
159
160
|
type: z.ZodLiteral<"function">;
|
|
@@ -212,7 +213,7 @@ export declare const BuilderRealtimeSessionRequestSchema: z.ZodObject<{
|
|
|
212
213
|
delegation: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
213
214
|
type: z.ZodLiteral<"responses">;
|
|
214
215
|
responses: z.ZodObject<{
|
|
215
|
-
model: z.ZodLiteral<"gpt-5.6-luna">;
|
|
216
|
+
model: z.ZodUnion<readonly [z.ZodLiteral<"gpt-6-luna">, z.ZodLiteral<"gpt-5.6-luna">]>;
|
|
216
217
|
instructions: z.ZodOptional<z.ZodString>;
|
|
217
218
|
tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
218
219
|
type: z.ZodLiteral<"function">;
|
package/src/realtime.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const BUILDER_REALTIME_MODEL = "gpt-live-1";
|
|
3
3
|
export const BUILDER_REALTIME_LEGACY_MODEL = "gpt-realtime-2.1";
|
|
4
|
-
export const BUILDER_REALTIME_DELEGATED_MODEL = "gpt-
|
|
4
|
+
export const BUILDER_REALTIME_DELEGATED_MODEL = "gpt-6-luna";
|
|
5
|
+
export const BUILDER_REALTIME_DELEGATED_MODEL_LEGACY = "gpt-5.6-luna";
|
|
5
6
|
export const BUILDER_REALTIME_MAX_SDP_LENGTH = 256000;
|
|
6
7
|
export const BUILDER_REALTIME_MAX_SESSION_BYTES = 64000;
|
|
7
8
|
const utf8ByteLength = (value) => new TextEncoder().encode(value).length;
|
|
@@ -154,8 +155,16 @@ const OpenAILiveToolSchema = z.union([
|
|
|
154
155
|
OpenAIRealtimeFunctionToolSchema,
|
|
155
156
|
z.object({ type: z.literal("web_search") }),
|
|
156
157
|
]);
|
|
158
|
+
const RealtimeDelegatedModelSchema = z
|
|
159
|
+
.union([
|
|
160
|
+
z.literal(BUILDER_REALTIME_DELEGATED_MODEL),
|
|
161
|
+
z.literal(BUILDER_REALTIME_DELEGATED_MODEL_LEGACY),
|
|
162
|
+
])
|
|
163
|
+
.overwrite((model) => model === BUILDER_REALTIME_DELEGATED_MODEL_LEGACY
|
|
164
|
+
? BUILDER_REALTIME_DELEGATED_MODEL
|
|
165
|
+
: model);
|
|
157
166
|
const OpenAILiveResponsesDelegationSchema = z.object({
|
|
158
|
-
model:
|
|
167
|
+
model: RealtimeDelegatedModelSchema,
|
|
159
168
|
instructions: z.string().max(32000).optional(),
|
|
160
169
|
tools: z.array(OpenAILiveToolSchema).max(32).optional(),
|
|
161
170
|
tool_choice: z
|
package/src/realtime.spec.js
CHANGED
|
@@ -17,7 +17,7 @@ describe("BuilderRealtimeSessionRequestSchema", () => {
|
|
|
17
17
|
delegation: {
|
|
18
18
|
type: "responses",
|
|
19
19
|
responses: {
|
|
20
|
-
model: "gpt-
|
|
20
|
+
model: "gpt-6-luna",
|
|
21
21
|
tools: [
|
|
22
22
|
{
|
|
23
23
|
type: "function",
|
|
@@ -32,12 +32,25 @@ describe("BuilderRealtimeSessionRequestSchema", () => {
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
expect(result.session).toMatchObject({
|
|
35
|
+
model: "gpt-live-1",
|
|
36
|
+
delegation: {
|
|
37
|
+
type: "responses",
|
|
38
|
+
responses: { model: "gpt-6-luna" },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
it("normalizes the legacy delegated model name", () => {
|
|
43
|
+
const result = OpenAILiveSessionConfigSchema.parse({
|
|
35
44
|
model: "gpt-live-1",
|
|
36
45
|
delegation: {
|
|
37
46
|
type: "responses",
|
|
38
47
|
responses: { model: "gpt-5.6-luna" },
|
|
39
48
|
},
|
|
40
49
|
});
|
|
50
|
+
expect(result.delegation).toEqual({
|
|
51
|
+
type: "responses",
|
|
52
|
+
responses: { model: "gpt-6-luna" },
|
|
53
|
+
});
|
|
41
54
|
});
|
|
42
55
|
it("accepts a bounded audio session with tools", () => {
|
|
43
56
|
var _a;
|
package/src/repo-indexing.d.ts
CHANGED
|
@@ -149,6 +149,10 @@ export interface DesignSystem {
|
|
|
149
149
|
* have no code to detect from, and whenever the agent couldn't tell.
|
|
150
150
|
*/
|
|
151
151
|
framework?: DesignSystemFramework;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated Prefer checking DisplayDesignSystem.docCount instead of relying on
|
|
154
|
+
* "in-progress" or "completed".
|
|
155
|
+
*/
|
|
152
156
|
status: "in-progress" | "completed" | "failed";
|
|
153
157
|
scope: DesignSystemScope;
|
|
154
158
|
deprecated: boolean;
|
package/src/single-tenancy.d.ts
CHANGED
|
@@ -56,7 +56,13 @@ export interface PrivateLinkEndpoint {
|
|
|
56
56
|
*/
|
|
57
57
|
export interface VpcAwsPrivateLink extends VpcConnectionBase {
|
|
58
58
|
type: "aws-privatelink";
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The region the customer's Endpoint Service lives in, as embedded in each
|
|
61
|
+
* `endpoints[].serviceName`. May differ from {@link BUILDER_AWS_REGION}: the
|
|
62
|
+
* interface endpoints always live in Builder's region and reach a remote
|
|
63
|
+
* service via cross-region PrivateLink (`service_region` in aws-vpc-module).
|
|
64
|
+
* Every endpoint in one config shares this region.
|
|
65
|
+
*/
|
|
60
66
|
awsRegion: string;
|
|
61
67
|
endpoints: PrivateLinkEndpoint[];
|
|
62
68
|
/**
|
|
@@ -219,11 +225,18 @@ export interface SingleTenancyDerivedNames {
|
|
|
219
225
|
privateLinkEndpointIps?: Record<string, string[]>;
|
|
220
226
|
}
|
|
221
227
|
/**
|
|
222
|
-
* The
|
|
223
|
-
*
|
|
224
|
-
* Service in another region is
|
|
228
|
+
* The region Builder's PrivateLink interface endpoints run in. Keep in sync with
|
|
229
|
+
* the `aws` provider region in packages/terraform/main.tf. A customer's Endpoint
|
|
230
|
+
* Service in another region is still reachable via cross-region PrivateLink (the
|
|
231
|
+
* endpoint names it through `service_region`); this constant is only the
|
|
232
|
+
* *consumer* region where our endpoints and their pinned IPs live.
|
|
225
233
|
*/
|
|
226
234
|
export declare const BUILDER_AWS_REGION = "us-east-1";
|
|
235
|
+
/**
|
|
236
|
+
* AWS region id (e.g. `us-east-1`, `eu-west-2`, `ap-southeast-3`). Used to
|
|
237
|
+
* validate a config's declared service region for cross-region PrivateLink.
|
|
238
|
+
*/
|
|
239
|
+
export declare const AWS_REGION_RE: RegExp;
|
|
227
240
|
/**
|
|
228
241
|
* AWS-generated VPC Endpoint Service name: `com.amazonaws.vpce.<region>.vpce-svc-<id>`.
|
|
229
242
|
* The id is 8 or 17 hex chars — AWS resource ids are never a length in between.
|
package/src/single-tenancy.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
* Service in another region is
|
|
2
|
+
* The region Builder's PrivateLink interface endpoints run in. Keep in sync with
|
|
3
|
+
* the `aws` provider region in packages/terraform/main.tf. A customer's Endpoint
|
|
4
|
+
* Service in another region is still reachable via cross-region PrivateLink (the
|
|
5
|
+
* endpoint names it through `service_region`); this constant is only the
|
|
6
|
+
* *consumer* region where our endpoints and their pinned IPs live.
|
|
5
7
|
*/
|
|
6
8
|
export const BUILDER_AWS_REGION = "us-east-1";
|
|
9
|
+
/**
|
|
10
|
+
* AWS region id (e.g. `us-east-1`, `eu-west-2`, `ap-southeast-3`). Used to
|
|
11
|
+
* validate a config's declared service region for cross-region PrivateLink.
|
|
12
|
+
*/
|
|
13
|
+
export const AWS_REGION_RE = /^[a-z]{2}-[a-z]+-\d$/;
|
|
7
14
|
/**
|
|
8
15
|
* AWS-generated VPC Endpoint Service name: `com.amazonaws.vpce.<region>.vpce-svc-<id>`.
|
|
9
16
|
* The id is 8 or 17 hex chars — AWS resource ids are never a length in between.
|
package/src/system-one.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const SYSTEM_ONE_DEFAULT_MODEL = "jev-latest";
|
|
3
|
+
export declare const SystemOneAvailabilityResponseSchema: z.ZodObject<{
|
|
4
|
+
enabled: z.ZodBoolean;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type SystemOneAvailabilityResponse = z.infer<typeof SystemOneAvailabilityResponseSchema>;
|
|
3
7
|
export declare const SystemOneRequestSchema: z.ZodObject<{
|
|
4
8
|
state: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>;
|
|
5
9
|
model: z.ZodDefault<z.ZodString>;
|
package/src/system-one.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const SYSTEM_ONE_DEFAULT_MODEL = "jev-latest";
|
|
3
|
+
export const SystemOneAvailabilityResponseSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
enabled: z.boolean(),
|
|
6
|
+
})
|
|
7
|
+
.meta({
|
|
8
|
+
description: "Response for GET /agent-native/jev/v1/status.",
|
|
9
|
+
});
|
|
3
10
|
const SystemOneValueSchema = z.union([
|
|
4
11
|
z.string(),
|
|
5
12
|
z.record(z.string(), z.unknown()),
|
package/src/system-one.spec.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { SYSTEM_ONE_DEFAULT_MODEL, SystemOneRequestSchema, SystemOneResponseSchema, } from "./system-one";
|
|
2
|
+
import { SYSTEM_ONE_DEFAULT_MODEL, SystemOneAvailabilityResponseSchema, SystemOneRequestSchema, SystemOneResponseSchema, } from "./system-one";
|
|
3
3
|
describe("System One schemas", () => {
|
|
4
|
+
it("validates Builder availability responses", () => {
|
|
5
|
+
expect(SystemOneAvailabilityResponseSchema.parse({ enabled: true })).toEqual({ enabled: true });
|
|
6
|
+
expect(() => SystemOneAvailabilityResponseSchema.parse({ enabled: "true" })).toThrow();
|
|
7
|
+
});
|
|
4
8
|
it("defaults the model and validates each question type", () => {
|
|
5
9
|
const request = SystemOneRequestSchema.parse({
|
|
6
10
|
state: { ticket: "export failed" },
|