@builder.io/ai-utils 0.64.0 → 0.65.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
@@ -6,6 +6,11 @@ export interface GenerateDesignSystemFormFields {
6
6
  * the uploaded `.fig` filenames.
7
7
  */
8
8
  projectName?: string;
9
+ /**
10
+ * Optional map of filename → page/frame GUIDs to restrict indexing.
11
+ * GUIDs are file-local, so they must be scoped per attachment.
12
+ */
13
+ selection?: Record<string, string[]>;
9
14
  }
10
15
  export interface GenerateDesignSystemRequest extends GenerateDesignSystemFormFields {
11
16
  /**
@@ -34,5 +39,6 @@ export declare const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
34
39
  */
35
40
  export declare const generateDesignSystemBodySchema: z.ZodObject<{
36
41
  projectName: z.ZodOptional<z.ZodString>;
42
+ selection: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
37
43
  }, z.core.$strip>;
38
44
  export type GenerateDesignSystemBody = z.infer<typeof generateDesignSystemBodySchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 100 * 1024 * 1024;
2
+ export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 200 * 1024 * 1024;
3
3
  export const GENERATE_DESIGN_SYSTEM_MAX_ATTACHMENTS = 50;
4
4
  export const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
5
5
  /**
@@ -11,4 +11,19 @@ export const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
11
11
  */
12
12
  export const generateDesignSystemBodySchema = z.object({
13
13
  projectName: z.string().trim().min(1).max(200).optional(),
14
+ selection: z
15
+ .preprocess((v) => {
16
+ if (typeof v !== "string")
17
+ return v;
18
+ const trimmed = v.trim();
19
+ if (!trimmed)
20
+ return undefined;
21
+ try {
22
+ return JSON.parse(trimmed);
23
+ }
24
+ catch (_a) {
25
+ return v;
26
+ }
27
+ }, z.record(z.string(), z.array(z.string().min(1)).max(10000)))
28
+ .optional(),
14
29
  });
package/src/events.d.ts CHANGED
@@ -804,6 +804,52 @@ export declare const ProjectSnapshotFailedV1: {
804
804
  eventName: "project.snapshot.failed";
805
805
  version: "1";
806
806
  };
807
+ /**
808
+ * Internal event used to poll whether a VolumeSnapshot has become ready
809
+ * without blocking a Pub/Sub handler for up to 10 minutes.
810
+ * The consumer (`handleSnapshotReadyCheckV1`) checks once, then either
811
+ * finalises (ready / timeout) or re-emits this event — each message
812
+ * completes in seconds.
813
+ */
814
+ export type ProjectSnapshotReadyCheckV1 = FusionEventVariant<"project.snapshot.ready.check", {
815
+ projectId: string;
816
+ triggerEventId: string;
817
+ snapshotName: string;
818
+ gitSha: string;
819
+ /** Pod start time — used to compute durationMs in ProjectSnapshotCreatedV1. */
820
+ startedAtMs: number;
821
+ /** When the VolumeSnapshot was created — used to compute the readiness timeout. */
822
+ capturedAtMs: number;
823
+ timeoutMs: number;
824
+ }, {
825
+ projectId: string;
826
+ }, 1>;
827
+ export declare const ProjectSnapshotReadyCheckV1: {
828
+ eventName: "project.snapshot.ready.check";
829
+ version: "1";
830
+ };
831
+ /**
832
+ * Internal event used to poll a snapshot pod's status without blocking a
833
+ * Pub/Sub handler for 45 minutes. The consumer (`handleSnapshotPodWatchV1`)
834
+ * checks the pod once, then either finalises the snapshot (terminal state) or
835
+ * re-emits this event (still running) — each message completes in seconds.
836
+ */
837
+ export type ProjectSnapshotPodWatchV1 = FusionEventVariant<"project.snapshot.pod.watch", {
838
+ projectId: string;
839
+ triggerEventId: string;
840
+ namespace: string;
841
+ podName: string;
842
+ source: "pr.merged" | "project.snapshot.refresh";
843
+ gitSha?: string;
844
+ startedAtMs: number;
845
+ timeoutMs: number;
846
+ }, {
847
+ projectId: string;
848
+ }, 1>;
849
+ export declare const ProjectSnapshotPodWatchV1: {
850
+ eventName: "project.snapshot.pod.watch";
851
+ version: "1";
852
+ };
807
853
  export type VideoRecordingCompletedV1 = FusionEventVariant<"video.recording.completed", {
808
854
  recordingId: string;
809
855
  videoUrl: string;
@@ -921,7 +967,7 @@ export declare const ClientDevtoolsToolResultV1: {
921
967
  eventName: "client.devtools.tool.result";
922
968
  version: "1";
923
969
  };
924
- export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | TimelineRecordingReadyV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionExternalPrV1 | ReviewSubmittedV1 | PrReviewRequestedV1 | ProjectSnapshotRefreshV1 | ProjectSnapshotCapturedV1 | ProjectSnapshotCreatedV1 | ProjectSnapshotFailedV1;
970
+ export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | TimelineRecordingReadyV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionExternalPrV1 | ReviewSubmittedV1 | PrReviewRequestedV1 | ProjectSnapshotRefreshV1 | ProjectSnapshotCapturedV1 | ProjectSnapshotCreatedV1 | ProjectSnapshotFailedV1 | ProjectSnapshotReadyCheckV1 | ProjectSnapshotPodWatchV1;
925
971
  export interface ModelPermissionRequiredEvent {
926
972
  type: "assistant.model.permission.required";
927
973
  data: {
package/src/events.js CHANGED
@@ -90,6 +90,14 @@ export const ProjectSnapshotFailedV1 = {
90
90
  eventName: "project.snapshot.failed",
91
91
  version: "1",
92
92
  };
93
+ export const ProjectSnapshotReadyCheckV1 = {
94
+ eventName: "project.snapshot.ready.check",
95
+ version: "1",
96
+ };
97
+ export const ProjectSnapshotPodWatchV1 = {
98
+ eventName: "project.snapshot.pod.watch",
99
+ version: "1",
100
+ };
93
101
  export const VideoRecordingCompletedV1 = {
94
102
  eventName: "video.recording.completed",
95
103
  version: "1",