@builder.io/ai-utils 0.23.1 → 0.23.3

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.23.1",
3
+ "version": "0.23.3",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/codegen.d.ts CHANGED
@@ -81,7 +81,7 @@ export interface DevServerControlInput {
81
81
  set_and_run_setup_command?: string | null;
82
82
  set_env_variable?: [string, string] | null;
83
83
  }
84
- export interface ServerLogsInput {
84
+ export interface DevServerLogsInput {
85
85
  }
86
86
  export interface BashToolInput {
87
87
  command?: string | null;
@@ -283,15 +283,154 @@ export interface UpdateSetupValueToolInput {
283
283
  };
284
284
  reason: string;
285
285
  }
286
- export interface VerifyInstallCommandToolInput {
286
+ export type ExitState = "verified" | "more-disk" | "more-memory" | "user-question" | "other";
287
+ export interface ExitToolInput {
288
+ state: ExitState;
289
+ summary: string;
290
+ questions?: Array<{
291
+ question: string;
292
+ context: string;
293
+ header?: string;
294
+ options?: Array<{
295
+ label: string;
296
+ description: string;
297
+ }>;
298
+ multiSelect?: boolean;
299
+ }>;
300
+ isMonorepo?: boolean;
301
+ isMicrofrontend?: boolean;
302
+ setupNeedsCredentials?: boolean;
303
+ devServerNeedsCredentials?: boolean;
304
+ }
305
+ /**
306
+ * Configuration proposed by the configuration agent, stored in Firebase
307
+ */
308
+ export interface ProposedConfig {
309
+ id: string;
310
+ projectId: string;
311
+ branchName: string;
312
+ createdAt: number;
313
+ updatedAt: number;
314
+ ownerId: string;
315
+ state: ExitState;
316
+ summary: string;
317
+ questions?: Array<{
318
+ question: string;
319
+ context: string;
320
+ whatYouTried?: string;
321
+ header?: string;
322
+ options?: Array<{
323
+ label: string;
324
+ description: string;
325
+ }>;
326
+ multiSelect?: boolean;
327
+ }>;
328
+ configuration: {
329
+ setupCommand: {
330
+ value: string | undefined;
331
+ verified: boolean;
332
+ elapsed?: number;
333
+ };
334
+ setupDependencies: {
335
+ value: SetupDependency[] | undefined;
336
+ verified: boolean;
337
+ };
338
+ devCommand: {
339
+ value: string | undefined;
340
+ verified: boolean;
341
+ elapsed?: number;
342
+ };
343
+ devServer: {
344
+ value: string | undefined;
345
+ verified: boolean;
346
+ };
347
+ validateCommand: {
348
+ value: string | undefined;
349
+ verified: boolean;
350
+ elapsed?: number;
351
+ };
352
+ appOrigin: {
353
+ value: string | undefined;
354
+ verified: boolean;
355
+ };
356
+ defaultOrigin: {
357
+ value: string | undefined;
358
+ verified: boolean;
359
+ };
360
+ environmentVariables: {
361
+ value: EnvironmentVariable[] | undefined;
362
+ verified: boolean;
363
+ };
364
+ autoDetectDevServer: {
365
+ value: boolean | undefined;
366
+ verified: boolean;
367
+ };
368
+ autoDetectDevServerPatterns: {
369
+ value: string[] | undefined;
370
+ verified: boolean;
371
+ };
372
+ };
373
+ sessionId: string;
374
+ orchestratorStates: {
375
+ setupState: SetupCommandState;
376
+ devState: DevCommandState;
377
+ httpServerState: HttpServerState;
378
+ validateState: ValidateCommandState;
379
+ };
380
+ peakDiskUsage?: number;
381
+ peakMemoryUsage?: number;
382
+ screenshotUrl?: string;
383
+ isMonorepo?: boolean;
384
+ isMicrofrontend?: boolean;
385
+ setupNeedsCredentials?: boolean;
386
+ devServerNeedsCredentials?: boolean;
387
+ }
388
+ /**
389
+ * Parameters for proposing a configuration to the backend
390
+ */
391
+ export interface ProposeConfigParams {
392
+ projectId: string;
393
+ branchName: string;
394
+ state: ExitState;
395
+ summary: string;
396
+ questions?: Array<{
397
+ question: string;
398
+ context: string;
399
+ whatYouTried?: string;
400
+ header?: string;
401
+ options?: Array<{
402
+ label: string;
403
+ description: string;
404
+ }>;
405
+ multiSelect?: boolean;
406
+ }>;
407
+ configuration: ProposedConfig["configuration"];
408
+ sessionId: string;
409
+ orchestratorStates: ProposedConfig["orchestratorStates"];
410
+ peakDiskUsage?: number;
411
+ peakMemoryUsage?: number;
412
+ screenshotUrl?: string;
413
+ isMonorepo?: boolean;
414
+ isMicrofrontend?: boolean;
415
+ setupNeedsCredentials?: boolean;
416
+ devServerNeedsCredentials?: boolean;
417
+ }
418
+ export interface VerifySetupCommandToolInput {
287
419
  command: string;
288
- timeout?: number;
420
+ dependencies?: Array<{
421
+ tool: string;
422
+ version?: string;
423
+ }>;
289
424
  }
290
- export interface VerifyDevServerToolInput {
425
+ export interface VerifyDevCommandToolInput {
291
426
  command: string;
292
- url: string;
293
- port: number;
294
- timeout?: number;
427
+ }
428
+ export interface VerifyDevServerToolInput {
429
+ autoDetect: boolean;
430
+ autoDetectPattern?: string;
431
+ hardcodedUrl?: string;
432
+ appOrigin: string;
433
+ defaultOrigin?: string;
295
434
  }
296
435
  export interface VerifyValidationScriptToolInput {
297
436
  command: string;
@@ -302,6 +441,13 @@ export interface VerifyRuntimeDependencyToolInput {
302
441
  version: string;
303
442
  source?: string;
304
443
  }
444
+ export interface SetEnvVariableToolInput {
445
+ key: string;
446
+ value: string;
447
+ secret?: boolean;
448
+ placeholder?: boolean;
449
+ explanation?: string;
450
+ }
305
451
  /** Comment for PR review - used by both SubmitPRReview and SubmitRecording */
306
452
  export interface PRReviewComment {
307
453
  file_path: string;
@@ -309,7 +455,7 @@ export interface PRReviewComment {
309
455
  start_line?: number;
310
456
  title: string;
311
457
  body: string;
312
- severity: "high" | "medium";
458
+ severity: "high" | "medium" | "low";
313
459
  debugInfo?: string;
314
460
  gif_id?: string;
315
461
  }
@@ -317,6 +463,7 @@ export interface PRReviewComment {
317
463
  export interface SubmitPRReviewToolInput {
318
464
  summary: string;
319
465
  comments?: PRReviewComment[];
466
+ risk_level?: "high" | "medium" | "low";
320
467
  }
321
468
  /** SubmitRecording - Visual verification with recording (posted as separate review) */
322
469
  export interface SubmitRecordingToolInput {
@@ -336,8 +483,9 @@ export interface ReportUIIssueToolInput {
336
483
  export interface ReportIssueToolInput {
337
484
  file_path: string;
338
485
  line: number;
486
+ start_line?: number;
339
487
  title: string;
340
- severity: "high" | "medium";
488
+ severity: "high" | "medium" | "low";
341
489
  body: string;
342
490
  }
343
491
  export interface CodeGenToolMap {
@@ -374,7 +522,7 @@ export interface CodeGenToolMap {
374
522
  Grep: GrepSearchToolInput;
375
523
  Glob: GlobSearchToolInput;
376
524
  DevServerControl: DevServerControlInput;
377
- ServerLogs: ServerLogsInput;
525
+ DevServerLogs: DevServerLogsInput;
378
526
  Revert: RevertToolInput;
379
527
  TodoRead: TodoReadToolInput;
380
528
  TodoWrite: TodoWriteToolInput;
@@ -389,13 +537,16 @@ export interface CodeGenToolMap {
389
537
  SubmitRecording: SubmitRecordingToolInput;
390
538
  ProposeConfig: ProposeConfigToolInput;
391
539
  UpdateSetupValue: UpdateSetupValueToolInput;
540
+ Exit: ExitToolInput;
392
541
  ResolveQAComments: ResolveQACommentsToolInput;
393
542
  ReportUIIssue: ReportUIIssueToolInput;
394
543
  ReportIssue: ReportIssueToolInput;
395
- VerifyInstallCommand: VerifyInstallCommandToolInput;
544
+ VerifySetupCommand: VerifySetupCommandToolInput;
545
+ VerifyDevCommand: VerifyDevCommandToolInput;
396
546
  VerifyDevServer: VerifyDevServerToolInput;
397
547
  VerifyValidationScript: VerifyValidationScriptToolInput;
398
548
  VerifyRuntimeDependency: VerifyRuntimeDependencyToolInput;
549
+ SetEnvVariable: SetEnvVariableToolInput;
399
550
  }
400
551
  export type CodeGenTools = keyof CodeGenToolMap;
401
552
  export type AllCodeGenTools = CodeGenTools | "web_search";
@@ -412,7 +563,7 @@ export interface LocalMCPTools {
412
563
  inputSchema?: any;
413
564
  serverName: string;
414
565
  }
415
- export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `background-${string}` | `indexing-${string}`;
566
+ export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `setup-agent` | `background-${string}` | `indexing-${string}`;
416
567
  export interface CodeGenInputOptions {
417
568
  position: string;
418
569
  eventName?: string;
@@ -905,9 +1056,24 @@ export interface GenerateCompletionStepUpdateSetupValue {
905
1056
  };
906
1057
  reason: string;
907
1058
  }
1059
+ export interface GenerateCompletionStepExit {
1060
+ type: "exit";
1061
+ state: ExitState;
1062
+ summary: string;
1063
+ questions: Array<{
1064
+ question: string;
1065
+ context: string;
1066
+ header?: string;
1067
+ options?: Array<{
1068
+ label: string;
1069
+ description: string;
1070
+ }>;
1071
+ multiSelect?: boolean;
1072
+ }>;
1073
+ }
908
1074
  export type GenerateCompletionStep = {
909
1075
  timestamp?: number;
910
- } & (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);
1076
+ } & (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 | GenerateCompletionStepExit);
911
1077
  export interface ApplyActionsResult {
912
1078
  filePath: string;
913
1079
  addedLines: number;
@@ -1318,6 +1484,8 @@ export interface EnvironmentVariable {
1318
1484
  key: string;
1319
1485
  value: string;
1320
1486
  isSecret: boolean;
1487
+ placeholder?: boolean;
1488
+ explanation?: string;
1321
1489
  }
1322
1490
  export interface FileOverride {
1323
1491
  /**
@@ -1356,7 +1524,7 @@ export interface FusionConfig {
1356
1524
  sessionId?: string;
1357
1525
  browserAutomationInstructions?: string;
1358
1526
  /** Whether this branch is for a code review - affects enabled agents and tools */
1359
- branchType?: "code-review";
1527
+ branchType?: "code-review" | "setup-project";
1360
1528
  featureBranch?: string;
1361
1529
  aiBranch?: string;
1362
1530
  /** Whether this is a fork PR - affects git operations (read-only, can't push) */
@@ -1462,6 +1630,8 @@ export interface FusionConfig {
1462
1630
  * Errors matching these patterns will not show the error popup.
1463
1631
  */
1464
1632
  errorIgnorePatterns?: string[];
1633
+ /** When true, sync the git working tree to the latest remote state during init */
1634
+ syncBranch?: boolean;
1465
1635
  /**
1466
1636
  * Maximum number of agent completions before pausing to ask the user to continue.
1467
1637
  * Read from project settings, with fallback to organization/space settings.
@@ -1496,7 +1666,7 @@ export interface LoadHistoryResult {
1496
1666
  updatedUnixTime: number;
1497
1667
  turns: CodegenTurn[];
1498
1668
  }
1499
- export type InitStateStep = "initial" | "init" | "validation" | "check-directories" | "create-directories" | "configure-git-repos" | "check-existing-git" | "update-remote-url" | "clone-repo" | "apply-partial-backup" | "configure-git-user" | "stash-changes" | "collect-repo-info" | "init-success" | "init-command" | "init-failed";
1669
+ export type InitStateStep = "initial" | "init" | "validation" | "check-directories" | "create-directories" | "configure-git-repos" | "check-existing-git" | "update-remote-url" | "clone-repo" | "apply-partial-backup" | "configure-git-user" | "stash-changes" | "collect-repo-info" | "init-success" | "init-command" | "init-failed" | "snapshot-git-sync";
1500
1670
  export interface InitStatusLog {
1501
1671
  id: number;
1502
1672
  timestamp: string;
@@ -1546,6 +1716,8 @@ export interface LaunchServerStatus {
1546
1716
  containerState: "idle" | "busy";
1547
1717
  containerStateTimestamp: number;
1548
1718
  activeOperations: number;
1719
+ diskUsage?: number;
1720
+ memoryUsage?: number;
1549
1721
  }
1550
1722
  /**
1551
1723
  * VS Code Tunnel status information
@@ -1589,6 +1761,10 @@ export interface FusionStatus {
1589
1761
  eventLoopDelays?: number[];
1590
1762
  /** Max memory pressure observed in the reporting period (0-1, where 1 is near OOM) */
1591
1763
  memoryPressure?: number;
1764
+ /** Current disk usage as a ratio (0-1, where 1 is full) */
1765
+ diskUsage?: number;
1766
+ /** Current memory usage as a ratio (0-1, where 1 is fully used) */
1767
+ memoryUsage?: number;
1592
1768
  }
1593
1769
  export interface FusionMetrics {
1594
1770
  counters: {
package/src/events.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface AssistantError {
15
15
  message: string;
16
16
  status?: number;
17
17
  actions?: AssistantMessageAction[];
18
+ details?: string;
18
19
  }
19
20
  export interface AssistantErrorEvent {
20
21
  type: "assistant.error";
package/src/messages.d.ts CHANGED
@@ -245,6 +245,10 @@ export interface AssistantMessageParam {
245
245
  * typically used when there is an error.
246
246
  */
247
247
  actions?: AssistantMessageAction[];
248
+ /**
249
+ * Technical details for expandable view in error messages.
250
+ */
251
+ details?: string;
248
252
  }
249
253
  export interface SystemMessage extends SystemMessageParam {
250
254
  id: string;
package/src/projects.d.ts CHANGED
@@ -326,6 +326,7 @@ export interface SetupScriptDependency {
326
326
  script: string;
327
327
  }
328
328
  export type FusionExecutionEnvironment = "containerized" | "container-less" | "cloud" | "cloud-v2";
329
+ export type AgentType = "setup-project" | "project-configuration";
329
330
  export interface PartialBranchData {
330
331
  name?: string;
331
332
  createdBy: string;
@@ -335,16 +336,18 @@ export interface PartialBranchData {
335
336
  lockedFusionEnvironment?: FusionExecutionEnvironment;
336
337
  metadata?: BranchMetadata;
337
338
  backup?: BranchBackup;
339
+ hidden?: boolean;
338
340
  gitAiBranch?: string | null;
339
341
  lastCommitHash?: GitSnapshot | null;
340
342
  lastCommitDate?: number | null;
341
343
  commitMode?: CommitMode;
342
344
  useHomeDir?: boolean;
345
+ agentType?: AgentType;
343
346
  checkoutBranch?: string | null;
344
347
  /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
345
348
  isFork?: boolean | null;
346
349
  /** Whether this branch is for a code review - affects enabled agents and tools*/
347
- type?: "code-review" | null;
350
+ type?: BranchType | null;
348
351
  cloneFrom?: {
349
352
  projectId: string;
350
353
  branchName: string;
@@ -390,6 +393,7 @@ export interface BranchReview {
390
393
  createdAt: number;
391
394
  updatedAt: number;
392
395
  }
396
+ export type BranchType = "code-review" | "setup-project";
393
397
  interface BranchSharedData {
394
398
  appName?: string | null;
395
399
  prNumber?: number | null;
@@ -408,7 +412,7 @@ interface BranchSharedData {
408
412
  lastServerStateDate?: number | null;
409
413
  lastServerVersion?: string | null;
410
414
  name?: string;
411
- agentType?: string | null;
415
+ hidden?: boolean;
412
416
  createdBy?: string;
413
417
  isPublic?: boolean;
414
418
  isDefault?: boolean;
@@ -455,7 +459,8 @@ interface BranchSharedData {
455
459
  /** Screenshots indexed by normalized href (without query params, fragments, protocol) */
456
460
  screenshots?: Record<string, string>;
457
461
  /** Whether this branch is for a code review - affects enabled agents and tools */
458
- type?: "code-review" | null;
462
+ type?: BranchType | null;
463
+ agentType?: AgentType | null;
459
464
  }
460
465
  /**
461
466
  * fields that are required in the new branch format, but optional in the legacy branch format.
@@ -604,6 +609,7 @@ export interface Project {
604
609
  enabled: boolean;
605
610
  instructions?: string;
606
611
  };
612
+ enableSnapshots?: boolean;
607
613
  postMergeMemories?: boolean;
608
614
  commitInstructions?: string;
609
615
  maxAgentCompletions?: number;