@builder.io/ai-utils 0.23.2 → 0.24.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.23.2",
3
+ "version": "0.24.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/codegen.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface CustomAgentDefinition {
50
50
  }
51
51
  export type CodeGenFramework = "react" | "html" | "mitosis" | "react-native" | "angular" | "vue" | "svelte" | "qwik" | "solid" | "marko" | "swiftui" | "jetpack-compose" | "flutter";
52
52
  export type CodeGenStyleLibrary = "tailwind" | "tailwind-precise" | "emotion" | "styled-components" | "styled-jsx" | "react-native" | undefined;
53
- export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | "error" | "aborted" | "pause_turn" | "refusal" | "model_context_window_exceeded" | null;
53
+ export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | "error" | "aborted" | "pause_turn" | "refusal" | "compaction" | "model_context_window_exceeded" | null;
54
54
  export interface ReadToolInput {
55
55
  file_path: string;
56
56
  view_range?: [number, number];
@@ -64,6 +64,7 @@ export interface GrepSearchToolInput {
64
64
  query: string;
65
65
  include_glob?: string | null;
66
66
  exclude_glob?: string | null;
67
+ case_sensitive?: boolean | null;
67
68
  }
68
69
  export interface GetRuleToolInput {
69
70
  name: string;
@@ -81,7 +82,7 @@ export interface DevServerControlInput {
81
82
  set_and_run_setup_command?: string | null;
82
83
  set_env_variable?: [string, string] | null;
83
84
  }
84
- export interface ServerLogsInput {
85
+ export interface DevServerLogsInput {
85
86
  }
86
87
  export interface BashToolInput {
87
88
  command?: string | null;
@@ -214,6 +215,8 @@ export interface ExplorationMetadataToolInput {
214
215
  limit?: number;
215
216
  }[];
216
217
  }
218
+ export interface EnterPlanModeToolInput {
219
+ }
217
220
  export interface ExitPlanModeToolInput {
218
221
  plan: string;
219
222
  handled?: boolean;
@@ -283,15 +286,154 @@ export interface UpdateSetupValueToolInput {
283
286
  };
284
287
  reason: string;
285
288
  }
286
- export interface VerifyInstallCommandToolInput {
289
+ export type ExitState = "verified" | "more-disk" | "more-memory" | "user-question" | "other";
290
+ export interface ExitToolInput {
291
+ state: ExitState;
292
+ summary: string;
293
+ questions?: Array<{
294
+ question: string;
295
+ context: string;
296
+ header?: string;
297
+ options?: Array<{
298
+ label: string;
299
+ description: string;
300
+ }>;
301
+ multiSelect?: boolean;
302
+ }>;
303
+ isMonorepo?: boolean;
304
+ isMicrofrontend?: boolean;
305
+ setupNeedsCredentials?: boolean;
306
+ devServerNeedsCredentials?: boolean;
307
+ }
308
+ /**
309
+ * Configuration proposed by the configuration agent, stored in Firebase
310
+ */
311
+ export interface ProposedConfig {
312
+ id: string;
313
+ projectId: string;
314
+ branchName: string;
315
+ createdAt: number;
316
+ updatedAt: number;
317
+ ownerId: string;
318
+ state: ExitState;
319
+ summary: string;
320
+ questions?: Array<{
321
+ question: string;
322
+ context: string;
323
+ whatYouTried?: string;
324
+ header?: string;
325
+ options?: Array<{
326
+ label: string;
327
+ description: string;
328
+ }>;
329
+ multiSelect?: boolean;
330
+ }>;
331
+ configuration: {
332
+ setupCommand: {
333
+ value: string | undefined;
334
+ verified: boolean;
335
+ elapsed?: number;
336
+ };
337
+ setupDependencies: {
338
+ value: SetupDependency[] | undefined;
339
+ verified: boolean;
340
+ };
341
+ devCommand: {
342
+ value: string | undefined;
343
+ verified: boolean;
344
+ elapsed?: number;
345
+ };
346
+ devServer: {
347
+ value: string | undefined;
348
+ verified: boolean;
349
+ };
350
+ validateCommand: {
351
+ value: string | undefined;
352
+ verified: boolean;
353
+ elapsed?: number;
354
+ };
355
+ appOrigin: {
356
+ value: string | undefined;
357
+ verified: boolean;
358
+ };
359
+ defaultOrigin: {
360
+ value: string | undefined;
361
+ verified: boolean;
362
+ };
363
+ environmentVariables: {
364
+ value: EnvironmentVariable[] | undefined;
365
+ verified: boolean;
366
+ };
367
+ autoDetectDevServer: {
368
+ value: boolean | undefined;
369
+ verified: boolean;
370
+ };
371
+ autoDetectDevServerPatterns: {
372
+ value: string[] | undefined;
373
+ verified: boolean;
374
+ };
375
+ };
376
+ sessionId: string;
377
+ orchestratorStates: {
378
+ setupState: SetupCommandState;
379
+ devState: DevCommandState;
380
+ httpServerState: HttpServerState;
381
+ validateState: ValidateCommandState;
382
+ };
383
+ peakDiskUsage?: number;
384
+ peakMemoryUsage?: number;
385
+ screenshotUrl?: string;
386
+ isMonorepo?: boolean;
387
+ isMicrofrontend?: boolean;
388
+ setupNeedsCredentials?: boolean;
389
+ devServerNeedsCredentials?: boolean;
390
+ }
391
+ /**
392
+ * Parameters for proposing a configuration to the backend
393
+ */
394
+ export interface ProposeConfigParams {
395
+ projectId: string;
396
+ branchName: string;
397
+ state: ExitState;
398
+ summary: string;
399
+ questions?: Array<{
400
+ question: string;
401
+ context: string;
402
+ whatYouTried?: string;
403
+ header?: string;
404
+ options?: Array<{
405
+ label: string;
406
+ description: string;
407
+ }>;
408
+ multiSelect?: boolean;
409
+ }>;
410
+ configuration: ProposedConfig["configuration"];
411
+ sessionId: string;
412
+ orchestratorStates: ProposedConfig["orchestratorStates"];
413
+ peakDiskUsage?: number;
414
+ peakMemoryUsage?: number;
415
+ screenshotUrl?: string;
416
+ isMonorepo?: boolean;
417
+ isMicrofrontend?: boolean;
418
+ setupNeedsCredentials?: boolean;
419
+ devServerNeedsCredentials?: boolean;
420
+ }
421
+ export interface VerifySetupCommandToolInput {
422
+ command: string;
423
+ dependencies?: Array<{
424
+ tool: string;
425
+ version?: string;
426
+ }>;
427
+ }
428
+ export interface VerifyDevCommandToolInput {
287
429
  command: string;
288
- timeout?: number;
289
430
  }
290
431
  export interface VerifyDevServerToolInput {
291
- command: string;
292
- url: string;
293
- port: number;
294
- timeout?: number;
432
+ autoDetect: boolean;
433
+ autoDetectPattern?: string;
434
+ hardcodedUrl?: string;
435
+ appOrigin: string;
436
+ defaultOrigin?: string;
295
437
  }
296
438
  export interface VerifyValidationScriptToolInput {
297
439
  command: string;
@@ -302,6 +444,13 @@ export interface VerifyRuntimeDependencyToolInput {
302
444
  version: string;
303
445
  source?: string;
304
446
  }
447
+ export interface SetEnvVariableToolInput {
448
+ key: string;
449
+ value: string;
450
+ secret?: boolean;
451
+ placeholder?: boolean;
452
+ explanation?: string;
453
+ }
305
454
  /** Comment for PR review - used by both SubmitPRReview and SubmitRecording */
306
455
  export interface PRReviewComment {
307
456
  file_path: string;
@@ -309,7 +458,7 @@ export interface PRReviewComment {
309
458
  start_line?: number;
310
459
  title: string;
311
460
  body: string;
312
- severity: "high" | "medium";
461
+ severity: "high" | "medium" | "low";
313
462
  debugInfo?: string;
314
463
  gif_id?: string;
315
464
  }
@@ -317,6 +466,7 @@ export interface PRReviewComment {
317
466
  export interface SubmitPRReviewToolInput {
318
467
  summary: string;
319
468
  comments?: PRReviewComment[];
469
+ risk_level?: "high" | "medium" | "low";
320
470
  }
321
471
  /** SubmitRecording - Visual verification with recording (posted as separate review) */
322
472
  export interface SubmitRecordingToolInput {
@@ -338,7 +488,7 @@ export interface ReportIssueToolInput {
338
488
  line: number;
339
489
  start_line?: number;
340
490
  title: string;
341
- severity: "high" | "medium";
491
+ severity: "high" | "medium" | "low";
342
492
  body: string;
343
493
  }
344
494
  export interface CodeGenToolMap {
@@ -375,7 +525,7 @@ export interface CodeGenToolMap {
375
525
  Grep: GrepSearchToolInput;
376
526
  Glob: GlobSearchToolInput;
377
527
  DevServerControl: DevServerControlInput;
378
- ServerLogs: ServerLogsInput;
528
+ DevServerLogs: DevServerLogsInput;
379
529
  Revert: RevertToolInput;
380
530
  TodoRead: TodoReadToolInput;
381
531
  TodoWrite: TodoWriteToolInput;
@@ -383,6 +533,7 @@ export interface CodeGenToolMap {
383
533
  LS: ListDirToolInput;
384
534
  WebFetch: WebFetchToolInput;
385
535
  ExplorationMetadata: ExplorationMetadataToolInput;
536
+ EnterPlanMode: EnterPlanModeToolInput;
386
537
  ExitPlanMode: ExitPlanModeToolInput;
387
538
  ReadMcpResource: ReadMcpResourceToolInput;
388
539
  RecordFrame: RecordFrameToolInput;
@@ -390,13 +541,16 @@ export interface CodeGenToolMap {
390
541
  SubmitRecording: SubmitRecordingToolInput;
391
542
  ProposeConfig: ProposeConfigToolInput;
392
543
  UpdateSetupValue: UpdateSetupValueToolInput;
544
+ Exit: ExitToolInput;
393
545
  ResolveQAComments: ResolveQACommentsToolInput;
394
546
  ReportUIIssue: ReportUIIssueToolInput;
395
547
  ReportIssue: ReportIssueToolInput;
396
- VerifyInstallCommand: VerifyInstallCommandToolInput;
548
+ VerifySetupCommand: VerifySetupCommandToolInput;
549
+ VerifyDevCommand: VerifyDevCommandToolInput;
397
550
  VerifyDevServer: VerifyDevServerToolInput;
398
551
  VerifyValidationScript: VerifyValidationScriptToolInput;
399
552
  VerifyRuntimeDependency: VerifyRuntimeDependencyToolInput;
553
+ SetEnvVariable: SetEnvVariableToolInput;
400
554
  }
401
555
  export type CodeGenTools = keyof CodeGenToolMap;
402
556
  export type AllCodeGenTools = CodeGenTools | "web_search";
@@ -413,7 +567,7 @@ export interface LocalMCPTools {
413
567
  inputSchema?: any;
414
568
  serverName: string;
415
569
  }
416
- export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `background-${string}` | `indexing-${string}`;
570
+ export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `setup-agent` | `background-${string}` | `indexing-${string}`;
417
571
  export interface CodeGenInputOptions {
418
572
  position: string;
419
573
  eventName?: string;
@@ -906,9 +1060,24 @@ export interface GenerateCompletionStepUpdateSetupValue {
906
1060
  };
907
1061
  reason: string;
908
1062
  }
1063
+ export interface GenerateCompletionStepExit {
1064
+ type: "exit";
1065
+ state: ExitState;
1066
+ summary: string;
1067
+ questions: Array<{
1068
+ question: string;
1069
+ context: string;
1070
+ header?: string;
1071
+ options?: Array<{
1072
+ label: string;
1073
+ description: string;
1074
+ }>;
1075
+ multiSelect?: boolean;
1076
+ }>;
1077
+ }
909
1078
  export type GenerateCompletionStep = {
910
1079
  timestamp?: number;
911
- } & (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);
1080
+ } & (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);
912
1081
  export interface ApplyActionsResult {
913
1082
  filePath: string;
914
1083
  addedLines: number;
@@ -1319,6 +1488,8 @@ export interface EnvironmentVariable {
1319
1488
  key: string;
1320
1489
  value: string;
1321
1490
  isSecret: boolean;
1491
+ placeholder?: boolean;
1492
+ explanation?: string;
1322
1493
  }
1323
1494
  export interface FileOverride {
1324
1495
  /**
@@ -1357,7 +1528,7 @@ export interface FusionConfig {
1357
1528
  sessionId?: string;
1358
1529
  browserAutomationInstructions?: string;
1359
1530
  /** Whether this branch is for a code review - affects enabled agents and tools */
1360
- branchType?: "code-review";
1531
+ branchType?: "code-review" | "setup-project";
1361
1532
  featureBranch?: string;
1362
1533
  aiBranch?: string;
1363
1534
  /** Whether this is a fork PR - affects git operations (read-only, can't push) */
@@ -1549,6 +1720,8 @@ export interface LaunchServerStatus {
1549
1720
  containerState: "idle" | "busy";
1550
1721
  containerStateTimestamp: number;
1551
1722
  activeOperations: number;
1723
+ diskUsage?: number;
1724
+ memoryUsage?: number;
1552
1725
  }
1553
1726
  /**
1554
1727
  * VS Code Tunnel status information
@@ -1592,6 +1765,10 @@ export interface FusionStatus {
1592
1765
  eventLoopDelays?: number[];
1593
1766
  /** Max memory pressure observed in the reporting period (0-1, where 1 is near OOM) */
1594
1767
  memoryPressure?: number;
1768
+ /** Current disk usage as a ratio (0-1, where 1 is full) */
1769
+ diskUsage?: number;
1770
+ /** Current memory usage as a ratio (0-1, where 1 is fully used) */
1771
+ memoryUsage?: number;
1595
1772
  }
1596
1773
  export interface FusionMetrics {
1597
1774
  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,7 +609,7 @@ export interface Project {
604
609
  enabled: boolean;
605
610
  instructions?: string;
606
611
  };
607
- createSnapshot?: boolean;
612
+ enableSnapshots?: boolean;
608
613
  postMergeMemories?: boolean;
609
614
  commitInstructions?: string;
610
615
  maxAgentCompletions?: number;