@builder.io/ai-utils 0.105.0 → 0.106.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 +1 -0
- package/src/codegen.js +3 -0
- package/src/events.d.ts +40 -1
- package/src/events.js +8 -0
- package/src/projects.d.ts +1397 -134
- package/src/projects.js +46 -4
- 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/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(),
|
|
@@ -896,9 +904,6 @@ export const ProjectSettingsSchema = z
|
|
|
896
904
|
})
|
|
897
905
|
.optional()
|
|
898
906
|
.meta({ description: "Password-protect the preview URL." }),
|
|
899
|
-
shapeSession: ShapeSessionSchema.optional().meta({
|
|
900
|
-
description: "@internal Guided-onboarding questionnaire issued for this project.",
|
|
901
|
-
}),
|
|
902
907
|
})
|
|
903
908
|
.meta({ title: "ProjectSettings" });
|
|
904
909
|
/**
|
|
@@ -922,7 +927,6 @@ const INTERNAL_PROJECT_SETTINGS_MASK = {
|
|
|
922
927
|
commitInstructions: true,
|
|
923
928
|
skipCommandSecurity: true,
|
|
924
929
|
autoCloseBranchOnMerge: true,
|
|
925
|
-
shapeSession: true,
|
|
926
930
|
};
|
|
927
931
|
/**
|
|
928
932
|
* Runtime schema for the client-writable subset of {@link Project.settings},
|
|
@@ -2311,3 +2315,41 @@ export const CreateProjectTemplateFromProjectOptionsSchema = z
|
|
|
2311
2315
|
export const CreateProjectTemplateFromProjectResponseSchema = z.object({
|
|
2312
2316
|
template: ProjectTemplateSchema.pick({ id: true, name: true }),
|
|
2313
2317
|
});
|
|
2318
|
+
export const ListProjectTemplatesOptionsSchema = z.object({
|
|
2319
|
+
id: z.string().min(1).optional(),
|
|
2320
|
+
});
|
|
2321
|
+
export const ListProjectTemplatesResponseSchema = z.object({
|
|
2322
|
+
templates: z.array(ProjectTemplateSchema),
|
|
2323
|
+
});
|
|
2324
|
+
export const UpdateProjectTemplateOptionsSchema = z.object({
|
|
2325
|
+
id: z.string().min(1),
|
|
2326
|
+
updates: ProjectTemplateOverridesSchema,
|
|
2327
|
+
});
|
|
2328
|
+
export const UpdateProjectTemplateResponseSchema = z.object({
|
|
2329
|
+
template: ProjectTemplateSchema,
|
|
2330
|
+
});
|
|
2331
|
+
export const DeleteProjectTemplateOptionsSchema = z.object({
|
|
2332
|
+
id: z.string().min(1),
|
|
2333
|
+
});
|
|
2334
|
+
export const DeleteProjectTemplateResponseSchema = z.object({
|
|
2335
|
+
deleted: z.boolean(),
|
|
2336
|
+
});
|
|
2337
|
+
export const ReorderProjectTemplatesOptionsSchema = z.object({
|
|
2338
|
+
orders: z
|
|
2339
|
+
.array(z.object({ id: z.string().min(1), order: z.number().int() }))
|
|
2340
|
+
.min(1),
|
|
2341
|
+
});
|
|
2342
|
+
export const ReorderProjectTemplatesResponseSchema = z.object({
|
|
2343
|
+
updatedIds: z.array(z.string()),
|
|
2344
|
+
});
|
|
2345
|
+
/**
|
|
2346
|
+
* `id` is omitted when a built-in (non-Firestore-backed) template becomes the
|
|
2347
|
+
* org default, so this just needs to clear `isDefault` on the owner's stored
|
|
2348
|
+
* templates without pointing it at a new one.
|
|
2349
|
+
*/
|
|
2350
|
+
export const SetDefaultProjectTemplateOptionsSchema = z.object({
|
|
2351
|
+
id: z.string().min(1).optional(),
|
|
2352
|
+
});
|
|
2353
|
+
export const SetDefaultProjectTemplateResponseSchema = z.object({
|
|
2354
|
+
defaultId: z.string().nullable(),
|
|
2355
|
+
});
|
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/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" },
|