@builder.io/ai-utils 0.66.2 → 0.68.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.66.2",
3
+ "version": "0.68.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -2687,6 +2687,7 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
2687
2687
  Write: "Write";
2688
2688
  }>>>;
2689
2689
  enabledMCPs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2690
+ skippedMCPs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2690
2691
  skipFileDiff: z.ZodOptional<z.ZodBoolean>;
2691
2692
  interruptActiveTask: z.ZodOptional<z.ZodBoolean>;
2692
2693
  localMCPTools: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -3482,6 +3483,7 @@ export declare const GenerateUserMessageSchema: z.ZodObject<{
3482
3483
  updateLastCommits: z.ZodOptional<z.ZodBoolean>;
3483
3484
  }, z.core.$strip>>;
3484
3485
  enabledMCPs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3486
+ skippedMCPs: z.ZodOptional<z.ZodArray<z.ZodString>>;
3485
3487
  sessionMode: z.ZodOptional<z.ZodEnum<{
3486
3488
  "auto-planning": "auto-planning";
3487
3489
  "deep-research": "deep-research";
@@ -3522,6 +3524,7 @@ export interface UserInput {
3522
3524
  agentModelOverrides?: AgentModelOverrides;
3523
3525
  category?: CodeGenCategory;
3524
3526
  enabledMCPs?: string[];
3527
+ skippedMCPs?: string[];
3525
3528
  /** @deprecated */
3526
3529
  repair?: boolean;
3527
3530
  }
@@ -3989,6 +3992,12 @@ export interface FusionConfig {
3989
3992
  browserAutomationInstructions?: string;
3990
3993
  /** Whether this branch is for a code review - affects enabled agents and tools */
3991
3994
  branchType?: BranchType;
3995
+ /**
3996
+ * When set, launch.ts hydrates `.builder/figma/<...>` from the corresponding
3997
+ * GCS frame manifest before the agent starts. Only used on
3998
+ * `branchType === "design-system-indexing"` branches.
3999
+ */
4000
+ figmaDecodeJobId?: string;
3992
4001
  featureBranch?: string;
3993
4002
  aiBranch?: string;
3994
4003
  /** Whether this is a fork PR - affects git operations (read-only, can't push) */
package/src/codegen.js CHANGED
@@ -1761,6 +1761,9 @@ export const CodeGenInputOptionsSchema = z
1761
1761
  recommendedRoot: z.string().optional(),
1762
1762
  enabledTools: z.array(CodeGenToolsSchema).optional(),
1763
1763
  enabledMCPs: z.array(z.string()).optional(),
1764
+ skippedMCPs: z.array(z.string()).optional().meta({
1765
+ description: "Per-message denylist of MCP server ids to skip. Skipped servers are not mounted or connected for this message and will not trigger an `mcp-auth-required` event. Tokens and org-level enabled state are untouched; this is purely message-scoped.",
1766
+ }),
1764
1767
  skipFileDiff: z.boolean().optional(),
1765
1768
  interruptActiveTask: z.boolean().optional().meta({
1766
1769
  description: "When true, the agent should interrupt its current task to handle this message immediately, rather than finishing the current task first.",
@@ -1858,6 +1861,9 @@ export const GenerateUserMessageSchema = z
1858
1861
  autoPush: AutoPushModeSchema.optional(),
1859
1862
  syncChanges: SyncChangesFromRemoteSchema.optional(),
1860
1863
  enabledMCPs: z.array(z.string()).optional(),
1864
+ skippedMCPs: z.array(z.string()).optional().meta({
1865
+ description: "Per-message denylist of MCP server names to skip. Skipped servers are not mounted or connected for this message and will not trigger an `mcp-auth-required` event. Tokens and org-level enabled state are untouched; this is purely message-scoped.",
1866
+ }),
1861
1867
  sessionMode: SessionModeSchema.optional(),
1862
1868
  queue: z.boolean().optional(),
1863
1869
  agentType: z.string().optional().meta({
@@ -1,4 +1,16 @@
1
1
  import { z } from "zod";
2
+ export interface FigmaHydrationFile {
3
+ /** Relative path to write under `.builder/figma/`. */
4
+ localPath: string;
5
+ downloadUrl: string;
6
+ contentType: string;
7
+ }
8
+ export interface FigmaHydrationResponse {
9
+ jobId: string;
10
+ status: "pending" | "processing" | "complete" | "error";
11
+ manifest: import("./events.js").FigmaFrameManifest | null;
12
+ files: FigmaHydrationFile[];
13
+ }
2
14
  export type GenerateDesignSystemAttachmentKind = "fig" | "image" | "pdf" | "text";
3
15
  export interface GenerateDesignSystemFormFields {
4
16
  /**
@@ -6,6 +18,7 @@ export interface GenerateDesignSystemFormFields {
6
18
  * the uploaded `.fig` filenames.
7
19
  */
8
20
  projectName?: string;
21
+ devToolsVersion?: string;
9
22
  /**
10
23
  * Optional map of filename → page/frame GUIDs to restrict indexing.
11
24
  * GUIDs are file-local, so they must be scoped per attachment.
@@ -21,8 +34,13 @@ export interface GenerateDesignSystemRequest extends GenerateDesignSystemFormFie
21
34
  }
22
35
  export interface GenerateDesignSystemResponse {
23
36
  projectId: string;
24
- branchName: string;
25
- branchUrl: string;
37
+ /**
38
+ * Decode job id. The .fig file is decoded asynchronously in the
39
+ * `ai-queue-subscribers` worker. Clients should listen on the
40
+ * `figmaDecodeJobs/{jobId}` Firestore document for progress and the
41
+ * resolved `branchName` / `branchUrl`.
42
+ */
43
+ jobId: string;
26
44
  }
27
45
  export interface GenerateDesignSystemErrorResponse {
28
46
  error: string | Record<string, unknown>;
@@ -39,6 +57,7 @@ export declare const GENERATE_DESIGN_SYSTEM_MIN_ATTACHMENTS = 1;
39
57
  */
40
58
  export declare const generateDesignSystemBodySchema: z.ZodObject<{
41
59
  projectName: z.ZodOptional<z.ZodString>;
60
+ devToolsVersion: z.ZodOptional<z.ZodString>;
42
61
  selection: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
43
62
  }, z.core.$strip>;
44
63
  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 = 200 * 1024 * 1024;
2
+ export const GENERATE_DESIGN_SYSTEM_MAX_FILE_BYTES = 2 * 1024 * 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,6 +11,7 @@ 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
+ devToolsVersion: z.string().trim().min(1).max(64).optional(),
14
15
  selection: z
15
16
  .preprocess((v) => {
16
17
  if (typeof v !== "string")
package/src/events.d.ts CHANGED
@@ -528,7 +528,7 @@ export declare const ReviewSubmittedV1: {
528
528
  eventName: "review.submitted";
529
529
  version: "1";
530
530
  };
531
- export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
531
+ export type BotMentionGitHubExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
532
532
  projectId: string;
533
533
  repoFullName: string;
534
534
  prNumber: number;
@@ -554,10 +554,148 @@ export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr
554
554
  }, {
555
555
  projectId: string;
556
556
  }, 1>;
557
- export declare const BotMentionExternalPrV1: {
557
+ export declare const BotMentionGitHubExternalPrV1: {
558
558
  eventName: "bot.mention.external-pr";
559
559
  version: "1";
560
560
  };
561
+ /**
562
+ * Common fields shared by all four bot-mention PR events.
563
+ *
564
+ * Extracting this base makes the future consolidation into a single
565
+ * `bot.mention.pr` event straightforward: the unified type will be
566
+ * `BaseBotMentionEventData & { provider: ..., ...providerSpecificOptionals }`.
567
+ */
568
+ export type BaseBotMentionEventData = {
569
+ /** Fusion project ID resolved from PR metadata */
570
+ projectId: string;
571
+ /** Fusion branch name resolved from PR metadata */
572
+ branchName: string;
573
+ /** Raw comment body that triggered the bot mention */
574
+ comment: string;
575
+ commentLink?: string;
576
+ /** Dedup lock key — composite of comment ID and delivery ID */
577
+ commentIdStr: string;
578
+ userName?: string;
579
+ /** Provider-specific user ID as string (for credits / analytics) */
580
+ gitUserId?: string;
581
+ /** Commenter email when available from the provider (preferred for user resolution) */
582
+ userEmail?: string;
583
+ /** Original webhook delivery ID — passed through for logging */
584
+ webhookEventId: string;
585
+ };
586
+ /**
587
+ * Emitted when @builderio-bot is mentioned on a Fusion (internal) GitHub PR comment.
588
+ * Pre-flight checks (project existence, installation token, GitHub App rights) have
589
+ * already passed before this event is published. The heavy work — container
590
+ * provisioning and AI processing — is handled asynchronously by the subscriber.
591
+ */
592
+ export type BotMentionGitHubInternalPrV1 = FusionEventVariant<"bot.mention.github-internal-pr", BaseBotMentionEventData & {
593
+ provider: "github";
594
+ repoFullName: string;
595
+ prNumber: number;
596
+ /** Numeric GitHub comment ID (for reaction / reply threading) */
597
+ commentNumericId?: number;
598
+ commentType: "issue" | "pr";
599
+ /** GitHub Enterprise hostname, if applicable */
600
+ hostname?: string;
601
+ /** For review comments: the comment being replied to */
602
+ inReplyToCommentId?: number;
603
+ /** For review comments: unified diff context */
604
+ diffHunk?: string;
605
+ /** For review comments: file path */
606
+ filePath?: string;
607
+ /** For review comments: first line of the comment range */
608
+ startLine?: number;
609
+ /** For review comments: last line of the comment range */
610
+ endLine?: number;
611
+ /** For review comments: reply target comment ID */
612
+ replyToCommentId?: number;
613
+ }, {
614
+ projectId: string;
615
+ }, 1>;
616
+ export declare const BotMentionGitHubInternalPrV1: {
617
+ eventName: "bot.mention.github-internal-pr";
618
+ version: "1";
619
+ };
620
+ /**
621
+ * Emitted when @builderio-bot is mentioned on a GitLab MR comment.
622
+ * Pre-flight checks have already passed before this event is published.
623
+ * Container provisioning and AI processing happen asynchronously in the subscriber.
624
+ */
625
+ export type BotMentionGitLabPrV1 = FusionEventVariant<"bot.mention.gitlab-pr", BaseBotMentionEventData & {
626
+ provider: "gitlab";
627
+ /** GitLab numeric project ID (needed to re-fetch token and post comments) */
628
+ gitlabProjectId: number;
629
+ /** GitLab MR IID */
630
+ mrId: number;
631
+ /**
632
+ * Thread discussion ID for threaded replies.
633
+ * GitLab sends this as a hex SHA string (e.g. "6a9c1750b37d..."),
634
+ * not a number — used only in URL interpolation.
635
+ */
636
+ discussionId?: string;
637
+ /** GitLab Enterprise hostname, if applicable */
638
+ hostname?: string;
639
+ }, {
640
+ projectId: string;
641
+ }, 1>;
642
+ export declare const BotMentionGitLabPrV1: {
643
+ eventName: "bot.mention.gitlab-pr";
644
+ version: "1";
645
+ };
646
+ /**
647
+ * Emitted when @builderio-bot is mentioned on a Bitbucket PR comment.
648
+ * Pre-flight checks have already passed before this event is published.
649
+ */
650
+ export type BotMentionBitbucketPrV1 = FusionEventVariant<"bot.mention.bitbucket-pr", BaseBotMentionEventData & {
651
+ provider: "bitbucket";
652
+ /** e.g. "workspace/repo" */
653
+ repositorySlug: string;
654
+ workspace?: string;
655
+ pullRequestId: number;
656
+ /** Numeric Bitbucket comment ID — used as parentCommentId for reply threading */
657
+ parentCommentId?: number;
658
+ /** PR browser URL (links.html.href from the pullrequest payload) */
659
+ pullRequestUrl?: string;
660
+ /** PR title from the pullrequest payload */
661
+ pullRequestTitle?: string;
662
+ /** PR description from the pullrequest payload */
663
+ pullRequestDescription?: string;
664
+ }, {
665
+ projectId: string;
666
+ }, 1>;
667
+ export declare const BotMentionBitbucketPrV1: {
668
+ eventName: "bot.mention.bitbucket-pr";
669
+ version: "1";
670
+ };
671
+ /**
672
+ * Emitted when @builderio-bot is mentioned on an Azure DevOps PR comment.
673
+ * Pre-flight checks have already passed before this event is published.
674
+ */
675
+ export type BotMentionAzurePrV1 = FusionEventVariant<"bot.mention.azure-pr", BaseBotMentionEventData & {
676
+ provider: "azure";
677
+ azureOrg: string;
678
+ azureProject: string;
679
+ pullRequestId: number;
680
+ /** Repository ID extracted from comment links */
681
+ repositoryId: string;
682
+ /** Thread link URL — used for reply threading and thread context */
683
+ threadLink: string;
684
+ /**
685
+ * The actual Azure DevOps REST URL of the pull request
686
+ * (event.resource.url or pullRequest.url from the webhook payload).
687
+ * Distinct from commentLink which is the comment resource URL.
688
+ */
689
+ pullRequestUrl?: string;
690
+ /** PR description from the pullrequest payload */
691
+ pullRequestDescription?: string;
692
+ }, {
693
+ projectId: string;
694
+ }, 1>;
695
+ export declare const BotMentionAzurePrV1: {
696
+ eventName: "bot.mention.azure-pr";
697
+ version: "1";
698
+ };
561
699
  export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
562
700
  sessionId?: string;
563
701
  sessionType?: string;
@@ -896,6 +1034,69 @@ export interface SendMessageToOrgAgentInput {
896
1034
  */
897
1035
  autoCreateProject?: boolean;
898
1036
  }
1037
+ export type FigmaDecodeJobV1 = FusionEventVariant<"figma.decode.job", {
1038
+ jobId: string;
1039
+ projectId: string;
1040
+ projectName: string;
1041
+ figmaName: string;
1042
+ /**
1043
+ * GCS object paths (relative to the configured bucket) of every attachment
1044
+ * uploaded for this job. The worker streams these back down, runs
1045
+ * `figProcessor.extract()` on the `.fig` entries, and forwards the rest as
1046
+ * `FileUpload` attachments to the agent's initial message.
1047
+ */
1048
+ attachmentGcsPaths: Array<{
1049
+ kind: "fig" | "image" | "pdf" | "text";
1050
+ originalName: string;
1051
+ gcsPath: string;
1052
+ mimetype: string;
1053
+ size: number;
1054
+ }>;
1055
+ devToolsVersion?: string;
1056
+ }, {}, 1>;
1057
+ export declare const FigmaDecodeJobV1: {
1058
+ eventName: "figma.decode.job";
1059
+ version: "1";
1060
+ };
1061
+ export interface FigmaDecodeJobDoc {
1062
+ jobId: string;
1063
+ ownerId: string;
1064
+ userId?: string;
1065
+ superuser?: Superuser;
1066
+ projectId: string;
1067
+ projectName: string;
1068
+ figmaName: string;
1069
+ status: "pending" | "processing" | "complete" | "error";
1070
+ framesProcessed: number;
1071
+ totalFrames: number;
1072
+ manifestGcsPath: string | null;
1073
+ branchName: string | null;
1074
+ branchUrl: string | null;
1075
+ error: string | null;
1076
+ createdAt: number;
1077
+ updatedAt: number;
1078
+ }
1079
+ export interface FigmaFrameManifestEntry {
1080
+ index: number;
1081
+ frameName: string;
1082
+ htmlGcsPath: string;
1083
+ screenshotGcsPath: string | null;
1084
+ htmlSizeBytes: number;
1085
+ }
1086
+ export interface FigmaFrameAsset {
1087
+ /** Bucket-relative GCS path. */
1088
+ gcsPath: string;
1089
+ /** Relative path under `.builder/figma/` (e.g. `images/abc123.png`). */
1090
+ localPath: string;
1091
+ contentType: string;
1092
+ }
1093
+ export interface FigmaFrameManifest {
1094
+ jobId: string;
1095
+ figmaName: string;
1096
+ frames: FigmaFrameManifestEntry[];
1097
+ /** Raster assets referenced by frame HTML via relative `images/…` URLs. */
1098
+ assets?: FigmaFrameAsset[];
1099
+ }
899
1100
  export type PrReviewRequestedV1 = FusionEventVariant<"pr.review.requested", {
900
1101
  repoFullName: string;
901
1102
  repoHtmlUrl?: string;
@@ -967,7 +1168,7 @@ export declare const ClientDevtoolsToolResultV1: {
967
1168
  eventName: "client.devtools.tool.result";
968
1169
  version: "1";
969
1170
  };
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;
1171
+ 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 | BotMentionGitHubExternalPrV1 | BotMentionGitHubInternalPrV1 | BotMentionGitLabPrV1 | BotMentionBitbucketPrV1 | BotMentionAzurePrV1 | ReviewSubmittedV1 | PrReviewRequestedV1 | FigmaDecodeJobV1 | ProjectSnapshotRefreshV1 | ProjectSnapshotCapturedV1 | ProjectSnapshotCreatedV1 | ProjectSnapshotFailedV1 | ProjectSnapshotReadyCheckV1 | ProjectSnapshotPodWatchV1;
971
1172
  export interface ModelPermissionRequiredEvent {
972
1173
  type: "assistant.model.permission.required";
973
1174
  data: {
package/src/events.js CHANGED
@@ -14,10 +14,26 @@ export const ReviewSubmittedV1 = {
14
14
  eventName: "review.submitted",
15
15
  version: "1",
16
16
  };
17
- export const BotMentionExternalPrV1 = {
17
+ export const BotMentionGitHubExternalPrV1 = {
18
18
  eventName: "bot.mention.external-pr",
19
19
  version: "1",
20
20
  };
21
+ export const BotMentionGitHubInternalPrV1 = {
22
+ eventName: "bot.mention.github-internal-pr",
23
+ version: "1",
24
+ };
25
+ export const BotMentionGitLabPrV1 = {
26
+ eventName: "bot.mention.gitlab-pr",
27
+ version: "1",
28
+ };
29
+ export const BotMentionBitbucketPrV1 = {
30
+ eventName: "bot.mention.bitbucket-pr",
31
+ version: "1",
32
+ };
33
+ export const BotMentionAzurePrV1 = {
34
+ eventName: "bot.mention.azure-pr",
35
+ version: "1",
36
+ };
21
37
  export const ClientDevtoolsSessionStartedEvent = {
22
38
  eventName: "client.devtools.session.started",
23
39
  version: "1",
@@ -106,6 +122,10 @@ export const TimelineRecordingReadyV1 = {
106
122
  eventName: "timeline.recording.ready",
107
123
  version: "1",
108
124
  };
125
+ export const FigmaDecodeJobV1 = {
126
+ eventName: "figma.decode.job",
127
+ version: "1",
128
+ };
109
129
  export const PrReviewRequestedV1 = {
110
130
  eventName: "pr.review.requested",
111
131
  version: "1",
package/src/projects.js CHANGED
@@ -36,7 +36,11 @@ export const EXAMPLE_REPOS = [
36
36
  ];
37
37
  export const STARTER_REPO = "BuilderIO/fusion-starter";
38
38
  export const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
39
- export const EXAMPLE_OR_STARTER_REPOS = [...EXAMPLE_REPOS, STARTER_REPO];
39
+ export const EXAMPLE_OR_STARTER_REPOS = [
40
+ ...EXAMPLE_REPOS,
41
+ STARTER_REPO,
42
+ DSI_PREVIEW_REPO,
43
+ ];
40
44
  export const EXAMPLE_OR_STARTER_REPOS_URLS = EXAMPLE_OR_STARTER_REPOS.map((repo) => `https://github.com/${repo}`);
41
45
  export const checkIsNewBranch = (branch) => {
42
46
  return "projectId" in branch;
@@ -105,6 +105,8 @@ export interface AddDesignSystemInput {
105
105
  gitOriginUrl: string | undefined;
106
106
  gitRelativePath: string | undefined;
107
107
  cliArgs: string[];
108
+ projectId?: string;
109
+ branchName?: string;
108
110
  }
109
111
  export interface UpdateDesignSystemInput {
110
112
  id: string;
@@ -133,6 +135,8 @@ export interface DesignSystem {
133
135
  gitRelativePath: string | undefined;
134
136
  cliArgs: string[];
135
137
  source: "custom" | "auto";
138
+ projectId?: string;
139
+ branchName?: string;
136
140
  }
137
141
  export interface DisplayDesignSystem extends DesignSystem {
138
142
  docCount: number;