@builder.io/ai-utils 0.38.3 → 0.39.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,25 +1,25 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.38.3",
3
+ "version": "0.39.0",
4
4
  "description": "Builder.io AI utils",
5
+ "files": [
6
+ "src"
7
+ ],
5
8
  "type": "module",
6
9
  "main": "src/index.js",
7
10
  "types": "src/index.d.ts",
8
11
  "exports": {
9
12
  ".": {
10
- "import": "./src/index.js",
11
- "types": "./src/index.d.ts"
13
+ "types": "./src/index.d.ts",
14
+ "import": "./src/index.js"
12
15
  },
13
16
  "./src/connectivity/node": {
14
- "import": "./src/connectivity/node.js",
15
- "types": "./src/connectivity/node.d.ts"
17
+ "types": "./src/connectivity/node.d.ts",
18
+ "import": "./src/connectivity/node.js"
16
19
  },
17
20
  "./src/connectivity/browser": {
18
- "import": "./src/connectivity/browser.js",
19
- "types": "./src/connectivity/browser.d.ts"
21
+ "types": "./src/connectivity/browser.d.ts",
22
+ "import": "./src/connectivity/browser.js"
20
23
  }
21
- },
22
- "files": [
23
- "src"
24
- ]
24
+ }
25
25
  }
package/src/codegen.d.ts CHANGED
@@ -169,16 +169,17 @@ export interface ScoreMemoriesToolInput {
169
169
  outcome: "worked" | "failed" | "partial" | "unknown";
170
170
  memory_scores: Record<string, "worked" | "failed" | "partial" | "unknown">;
171
171
  }
172
- export interface AskUserQuestionToolInput {
173
- questions: {
174
- question: string;
175
- header: string;
176
- options: {
177
- label: string;
178
- description: string;
179
- }[];
180
- multiSelect?: boolean;
172
+ export interface AskUserQuestion {
173
+ question: string;
174
+ header: string;
175
+ options: {
176
+ label: string;
177
+ description: string;
181
178
  }[];
179
+ multiSelect?: boolean;
180
+ }
181
+ export interface AskUserQuestionToolInput {
182
+ questions: AskUserQuestion[];
182
183
  answers?: Record<string, string>;
183
184
  }
184
185
  export interface AgentToolInput {
@@ -310,6 +311,27 @@ export interface TimelineRecording {
310
311
  debugInfo?: string;
311
312
  }>;
312
313
  }
314
+ export interface CompileRecordingToolInput {
315
+ caption: string;
316
+ recording_caption: string;
317
+ summary?: string;
318
+ comments?: PRReviewComment[];
319
+ }
320
+ export interface TimelineSubmissionMetadata {
321
+ prNumber?: number;
322
+ repoFullName?: string;
323
+ hostname?: string;
324
+ prHeadSha?: string;
325
+ checkRunId?: number;
326
+ recordingCaption?: string;
327
+ summary?: string;
328
+ comments?: PRReviewComment[];
329
+ projectId?: string;
330
+ branchName?: string;
331
+ ownerId?: string;
332
+ configId?: string;
333
+ containerUrl?: string;
334
+ }
313
335
  /**
314
336
  * Configuration values proposed by the setup analyzer agent
315
337
  */
@@ -595,7 +617,7 @@ export interface ArchiveBranchToolInput {
595
617
  builder_user_id: string;
596
618
  reason?: string;
597
619
  }
598
- /** Comment for PR review - used by both SubmitPRReview and SubmitRecording */
620
+ /** Comment for PR review - used by SubmitPRReview and CompileRecording */
599
621
  export interface PRReviewComment {
600
622
  file_path: string;
601
623
  line: number;
@@ -612,14 +634,6 @@ export interface SubmitPRReviewToolInput {
612
634
  comments?: PRReviewComment[];
613
635
  risk_level?: "high" | "medium" | "low";
614
636
  }
615
- /** SubmitRecording - Visual verification with recording (posted as separate review) */
616
- export interface SubmitRecordingToolInput {
617
- gif_id: string;
618
- timeline_id?: string;
619
- recording_caption: string;
620
- summary?: string;
621
- comments?: PRReviewComment[];
622
- }
623
637
  export interface ResolveQACommentsToolInput {
624
638
  thread_node_ids: string[];
625
639
  }
@@ -684,8 +698,8 @@ export interface CodeGenToolMap {
684
698
  ExitPlanMode: ExitPlanModeToolInput;
685
699
  ReadMcpResource: ReadMcpResourceToolInput;
686
700
  RecordFrame: RecordFrameToolInput;
701
+ CompileRecording: CompileRecordingToolInput;
687
702
  SubmitPRReview: SubmitPRReviewToolInput;
688
- SubmitRecording: SubmitRecordingToolInput;
689
703
  ProposeConfig: ProposeConfigToolInput;
690
704
  UpdateSetupValue: UpdateSetupValueToolInput;
691
705
  Exit: ExitToolInput;
@@ -706,6 +720,7 @@ export interface CodeGenToolMap {
706
720
  ReadBranch: ReadBranchToolInput;
707
721
  ArchiveBranch: ArchiveBranchToolInput;
708
722
  RunningAgents: RunningAgentsToolInput;
723
+ IDEDiagnostics: IDEDiagnosticsToolInput;
709
724
  }
710
725
  export type CodeGenTools = keyof CodeGenToolMap;
711
726
  export type AllCodeGenTools = CodeGenTools | "web_search";
@@ -1078,10 +1093,12 @@ export interface SuggestedActionBuildError extends SuggestedActionBase {
1078
1093
  export type SuggestedAction = SuggestedActionBuildError;
1079
1094
  export interface GenerateCompletionStepWaitForInput {
1080
1095
  type: "wait-for-input";
1096
+ id: string;
1081
1097
  state: GenerateCompletionState;
1082
1098
  suggestion?: SuggestedAction;
1083
1099
  sessionMode: SessionMode;
1084
1100
  hasPlanToApply: boolean;
1101
+ modelOverride?: string;
1085
1102
  }
1086
1103
  export type GenerateCompletionStepBuilderAction = GenerateCompletionStepBuilderActionRefresh | GenerateCompletionStepBuilderActionOpenPath | GenerateCompletionStepBuilderActionMCPConnect;
1087
1104
  export interface GenerateCompletionStepBuilderActionRefresh {
@@ -1190,14 +1207,16 @@ export interface GenerateCompletionStepSession {
1190
1207
  fusionConfig: FusionConfig | undefined;
1191
1208
  hasBrowserAutomation: boolean;
1192
1209
  customInstructions: CustomInstructionDefinition[];
1210
+ hasPlanToApply: boolean;
1193
1211
  }
1194
1212
  export interface GenerateCompletionStepMetadata {
1195
1213
  type: "metadata";
1196
1214
  [key: string]: unknown;
1197
1215
  }
1216
+ export type MessageQueue = Pick<GenerateUserMessage, "idempotencyKey" | "displayPrompt" | "user">[];
1198
1217
  export interface GenerateCompletionStepMessageQueue {
1199
1218
  type: "message-queue";
1200
- queue: Pick<GenerateUserMessage, "idempotencyKey" | "displayPrompt" | "user">[];
1219
+ queue: MessageQueue;
1201
1220
  }
1202
1221
  export interface GenerateCompletionStepServerToolResult {
1203
1222
  type: "server_tool_result";
@@ -1223,6 +1242,31 @@ export interface GenerateCompletionStepTerminals {
1223
1242
  type: "terminals";
1224
1243
  terminals: CodegenApiTerminal[];
1225
1244
  }
1245
+ export interface IdeContext {
1246
+ ideName: string;
1247
+ file: string | null;
1248
+ line: number | null;
1249
+ column: number | null;
1250
+ selection: string | null;
1251
+ }
1252
+ export interface DiagnosticEntry {
1253
+ file: string;
1254
+ severity: string;
1255
+ message: string;
1256
+ line: number;
1257
+ source: string | null;
1258
+ }
1259
+ export interface IDEDiagnosticsToolInput {
1260
+ file_path?: string;
1261
+ }
1262
+ export interface DiagnosticsResponse {
1263
+ ideName: string;
1264
+ diagnostics: DiagnosticEntry[];
1265
+ }
1266
+ export interface GenerateCompletionStepIde {
1267
+ type: "ide";
1268
+ context: IdeContext | null;
1269
+ }
1226
1270
  export interface GenerateCompletionStepProposeConfig {
1227
1271
  type: "propose_config";
1228
1272
  config: SetupAnalysisValues;
@@ -1247,9 +1291,7 @@ export interface GenerateCompletionStepUpdateSetupValue {
1247
1291
  };
1248
1292
  reason: string;
1249
1293
  }
1250
- export type GenerateCompletionStep = {
1251
- timestamp?: number;
1252
- } & (GenerateCompletionStepPlanning | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue);
1294
+ export type GenerateCompletionStep = GenerateCompletionStepPlanning | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepIde;
1253
1295
  export interface ApplyActionsResult {
1254
1296
  filePath: string;
1255
1297
  addedLines: number;
@@ -1721,6 +1763,7 @@ export interface MCPServerDefinition {
1721
1763
  args?: string[];
1722
1764
  env?: Record<string, string>;
1723
1765
  envFile?: string;
1766
+ retries?: number;
1724
1767
  }
1725
1768
  export type MCPServerConfig = Record<string, MCPServerDefinition>;
1726
1769
  export interface FusionConfig {
@@ -2318,3 +2361,8 @@ export interface CommitMessageResponse {
2318
2361
  /** Optional extended description */
2319
2362
  body?: string;
2320
2363
  }
2364
+ export interface TodoItem {
2365
+ content: string;
2366
+ status: "pending" | "in_progress" | "completed";
2367
+ id: string;
2368
+ }
@@ -1,4 +1,4 @@
1
- import dns from "dns";
1
+ import dns from "node:dns";
2
2
  import { mapNodeErrorToConnectivityCode } from "../error-codes.js";
3
3
  const { resolve4, resolve6 } = dns.promises;
4
4
  const DEFAULT_TIMEOUT_MS = 10000;
package/src/events.d.ts CHANGED
@@ -472,15 +472,39 @@ export declare const AiTaskFailedEvent: {
472
472
  eventName: "ai.task.failed";
473
473
  version: "1";
474
474
  };
475
- export type GitPrCreatedEvent = FusionEventVariant<"git.pr.created", {
476
- prNumber?: number;
477
- repo?: string;
478
- branch?: string;
475
+ export type GitPrCreatedV1 = FusionEventVariant<"git.pr.created", {
476
+ projectId: string;
477
+ branchName: string;
478
+ branchId?: string;
479
+ provider: "github" | "gitlab" | "bitbucket" | "azure";
480
+ prNumber?: number | string;
479
481
  }, {}, 1>;
480
- export declare const GitPrCreatedEvent: {
482
+ export declare const GitPrCreatedV1: {
481
483
  eventName: "git.pr.created";
482
484
  version: "1";
483
485
  };
486
+ export type GitPrClosedV1 = FusionEventVariant<"git.pr.closed", {
487
+ projectId: string;
488
+ branchName: string;
489
+ branchId?: string;
490
+ provider: "github" | "gitlab" | "bitbucket" | "azure";
491
+ prNumber?: number | string;
492
+ }, {}, 1>;
493
+ export declare const GitPrClosedV1: {
494
+ eventName: "git.pr.closed";
495
+ version: "1";
496
+ };
497
+ export type GitPrMergedV1 = FusionEventVariant<"git.pr.merged", {
498
+ projectId: string;
499
+ branchName: string;
500
+ branchId?: string;
501
+ provider: "github" | "gitlab" | "bitbucket" | "azure";
502
+ prNumber?: number | string;
503
+ }, {}, 1>;
504
+ export declare const GitPrMergedV1: {
505
+ eventName: "git.pr.merged";
506
+ version: "1";
507
+ };
484
508
  export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
485
509
  sessionId?: string;
486
510
  sessionType?: string;
@@ -609,6 +633,76 @@ export declare const GitWebhooksRegisterV1: {
609
633
  eventName: "git.webhooks.register";
610
634
  version: "1";
611
635
  };
636
+ export type FusionProjectSettingsUpdatedV1 = FusionEventVariant<"fusion.project.settings.updated", {
637
+ projectId: string;
638
+ changedFields: string[];
639
+ }, {}, 1>;
640
+ export declare const FusionProjectSettingsUpdatedV1: {
641
+ eventName: "fusion.project.settings.updated";
642
+ version: "1";
643
+ };
644
+ export type FusionBranchCreatedV1 = FusionEventVariant<"fusion.branch.created", {
645
+ projectId: string;
646
+ branchName: string;
647
+ branchFriendlyName?: string;
648
+ actor: string;
649
+ }, {
650
+ projectId: string;
651
+ branchName: string;
652
+ }, 1>;
653
+ export declare const FusionBranchCreatedV1: {
654
+ eventName: "fusion.branch.created";
655
+ version: "1";
656
+ };
657
+ export type FusionBranchContainerStartedV1 = FusionEventVariant<"fusion.branch.container-started", {
658
+ projectId: string;
659
+ branchName: string;
660
+ url: string;
661
+ }, {
662
+ projectId: string;
663
+ branchName: string;
664
+ }, 1>;
665
+ export declare const FusionBranchContainerStartedV1: {
666
+ eventName: "fusion.branch.container-started";
667
+ version: "1";
668
+ };
669
+ export type FusionBranchMessageSentV1 = FusionEventVariant<"fusion.branch.message-sent", {
670
+ projectId: string;
671
+ branchName: string;
672
+ }, {
673
+ projectId: string;
674
+ branchName: string;
675
+ }, 1>;
676
+ export declare const FusionBranchMessageSentV1: {
677
+ eventName: "fusion.branch.message-sent";
678
+ version: "1";
679
+ };
680
+ export type FusionBranchFailedV1 = FusionEventVariant<"fusion.branch.failed", {
681
+ projectId: string;
682
+ branchName?: string;
683
+ error: string;
684
+ phase: string;
685
+ }, {
686
+ projectId: string;
687
+ branchName?: string;
688
+ }, 1>;
689
+ export declare const FusionBranchFailedV1: {
690
+ eventName: "fusion.branch.failed";
691
+ version: "1";
692
+ };
693
+ export type VideoRecordingCompletedV1 = FusionEventVariant<"video.recording.completed", {
694
+ recordingId: string;
695
+ videoUrl: string;
696
+ thumbnailUrl?: string;
697
+ projectId: string | null;
698
+ branchName: string | null;
699
+ }, {
700
+ recordingId: string;
701
+ }, 1>;
702
+ export declare const VideoRecordingCompletedV1: {
703
+ eventName: "video.recording.completed";
704
+ version: "1";
705
+ };
612
706
  export interface SendMessageToOrgAgentInput {
613
707
  agentBranchName?: string;
614
708
  agentProjectId?: string;
@@ -629,7 +723,7 @@ export interface SendMessageToOrgAgentInput {
629
723
  */
630
724
  autoCreateProject?: boolean;
631
725
  }
632
- export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | GitPrCreatedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1;
726
+ export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionBranchContainerStartedV1 | FusionBranchMessageSentV1 | FusionBranchFailedV1;
633
727
  export interface ModelPermissionRequiredEvent {
634
728
  type: "assistant.model.permission.required";
635
729
  data: {
package/src/events.js CHANGED
@@ -6,10 +6,18 @@ export const AiTaskFailedEvent = {
6
6
  eventName: "ai.task.failed",
7
7
  version: "1",
8
8
  };
9
- export const GitPrCreatedEvent = {
9
+ export const GitPrCreatedV1 = {
10
10
  eventName: "git.pr.created",
11
11
  version: "1",
12
12
  };
13
+ export const GitPrClosedV1 = {
14
+ eventName: "git.pr.closed",
15
+ version: "1",
16
+ };
17
+ export const GitPrMergedV1 = {
18
+ eventName: "git.pr.merged",
19
+ version: "1",
20
+ };
13
21
  export const ClientDevtoolsSessionStartedEvent = {
14
22
  eventName: "client.devtools.session.started",
15
23
  version: "1",
@@ -46,3 +54,27 @@ export const GitWebhooksRegisterV1 = {
46
54
  eventName: "git.webhooks.register",
47
55
  version: "1",
48
56
  };
57
+ export const FusionProjectSettingsUpdatedV1 = {
58
+ eventName: "fusion.project.settings.updated",
59
+ version: "1",
60
+ };
61
+ export const FusionBranchCreatedV1 = {
62
+ eventName: "fusion.branch.created",
63
+ version: "1",
64
+ };
65
+ export const FusionBranchContainerStartedV1 = {
66
+ eventName: "fusion.branch.container-started",
67
+ version: "1",
68
+ };
69
+ export const FusionBranchMessageSentV1 = {
70
+ eventName: "fusion.branch.message-sent",
71
+ version: "1",
72
+ };
73
+ export const FusionBranchFailedV1 = {
74
+ eventName: "fusion.branch.failed",
75
+ version: "1",
76
+ };
77
+ export const VideoRecordingCompletedV1 = {
78
+ eventName: "video.recording.completed",
79
+ version: "1",
80
+ };
package/src/projects.d.ts CHANGED
@@ -338,7 +338,7 @@ export interface SetupScriptDependency {
338
338
  script: string;
339
339
  }
340
340
  export type FusionExecutionEnvironment = "containerized" | "container-less" | "cloud" | "cloud-v2";
341
- export type AgentType = "setup-project" | "project-configuration" | "org-agent";
341
+ export type AgentType = "setup-project" | "project-configuration" | "org-agent" | "code-review-orchestrator";
342
342
  export interface PartialBranchData {
343
343
  name?: string;
344
344
  createdBy: string;
@@ -706,6 +706,10 @@ export interface Project {
706
706
  orgAgentConfig?: OrgAgentConfig;
707
707
  /** When true, the project is hidden from normal project listings */
708
708
  hidden?: boolean;
709
+ /** Status of the auto-setup process */
710
+ autoSetupStatus?: "idle" | "running" | "needs-input" | "completed" | "error";
711
+ /** True only when the user has explicitly chosen auto-setup via the UI; never set by backend infrastructure */
712
+ userInitiatedAutoSetup?: boolean;
709
713
  /** When true, automatically apply verified setup configuration when the setup agent completes */
710
714
  autoApplySetup?: boolean;
711
715
  }
package/src/proxy.js CHANGED
@@ -20,7 +20,9 @@ export function getProxyConfig({ devServerUrl, proxyOrigin, proxyDefaultOrigin,
20
20
  try {
21
21
  parsedUrl = new URL(devServerUrl);
22
22
  }
23
- catch (_a) { }
23
+ catch (_a) {
24
+ // intentionally empty
25
+ }
24
26
  }
25
27
  if (!proxyOrigin && parsedUrl) {
26
28
  if (isLocalhost(parsedUrl.hostname)) {