@builder.io/ai-utils 0.76.2 → 0.77.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.76.2",
3
+ "version": "0.77.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -203,6 +203,7 @@ export type GrepSearchToolInput = z.infer<typeof GrepSearchToolInputSchema>;
203
203
  export declare const SkillToolInputSchema: z.ZodObject<{
204
204
  skill: z.ZodString;
205
205
  args: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ userInvoked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
206
207
  }, z.core.$strip>;
207
208
  export type SkillToolInput = z.infer<typeof SkillToolInputSchema>;
208
209
  export declare const GetRuleToolInputSchema: z.ZodObject<{
@@ -836,6 +837,8 @@ export declare const ProposedConfigSchema: z.ZodObject<{
836
837
  createdAt: z.ZodNumber;
837
838
  updatedAt: z.ZodNumber;
838
839
  ownerId: z.ZodString;
840
+ userInitiated: z.ZodBoolean;
841
+ autoApply: z.ZodBoolean;
839
842
  state: z.ZodEnum<{
840
843
  "code-change-required": "code-change-required";
841
844
  "empty-project": "empty-project";
@@ -1380,6 +1383,12 @@ export declare const EnsurePRToolInputSchema: z.ZodObject<{
1380
1383
  draft: z.ZodOptional<z.ZodBoolean>;
1381
1384
  }, z.core.$strip>;
1382
1385
  export type EnsurePRToolInput = z.infer<typeof EnsurePRToolInputSchema>;
1386
+ export declare const EnableDatabaseToolInputSchema: z.ZodObject<{
1387
+ purpose: z.ZodOptional<z.ZodString>;
1388
+ }, z.core.$strip>;
1389
+ export type EnableDatabaseToolInput = z.infer<typeof EnableDatabaseToolInputSchema>;
1390
+ /** Non-technical line surfaced in the run summary after EnableDatabase succeeds. */
1391
+ export declare function formatDatabaseEnabledUserSummary(purpose?: string): string;
1383
1392
  export declare const ConnectMCPToolInputSchema: z.ZodObject<{
1384
1393
  name: z.ZodString;
1385
1394
  url: z.ZodOptional<z.ZodString>;
@@ -1410,6 +1419,7 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1410
1419
  Skill: z.ZodObject<{
1411
1420
  skill: z.ZodString;
1412
1421
  args: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1422
+ userInvoked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1413
1423
  }, z.core.$strip>;
1414
1424
  GetStyleInspiration: z.ZodObject<{
1415
1425
  url: z.ZodString;
@@ -1960,6 +1970,9 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1960
1970
  builder_user_id: z.ZodOptional<z.ZodString>;
1961
1971
  draft: z.ZodOptional<z.ZodBoolean>;
1962
1972
  }, z.core.$strip>;
1973
+ EnableDatabase: z.ZodObject<{
1974
+ purpose: z.ZodOptional<z.ZodString>;
1975
+ }, z.core.$strip>;
1963
1976
  GenerateDesignSystemAgentMd: z.ZodObject<{}, z.core.$strip>;
1964
1977
  }, z.core.$strip>;
1965
1978
  export type CodeGenToolMap = z.infer<typeof CodeGenToolMapSchema>;
@@ -1977,6 +1990,7 @@ export declare const CodeGenToolsSchema: z.ZodEnum<{
1977
1990
  DevServerLogs: "DevServerLogs";
1978
1991
  DevServerRestart: "DevServerRestart";
1979
1992
  Edit: "Edit";
1993
+ EnableDatabase: "EnableDatabase";
1980
1994
  EnsurePR: "EnsurePR";
1981
1995
  EnterPlanMode: "EnterPlanMode";
1982
1996
  EscalateToPlanner: "EscalateToPlanner";
@@ -2700,6 +2714,7 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
2700
2714
  DevServerLogs: "DevServerLogs";
2701
2715
  DevServerRestart: "DevServerRestart";
2702
2716
  Edit: "Edit";
2717
+ EnableDatabase: "EnableDatabase";
2703
2718
  EnsurePR: "EnsurePR";
2704
2719
  EnterPlanMode: "EnterPlanMode";
2705
2720
  EscalateToPlanner: "EscalateToPlanner";
@@ -2884,7 +2899,7 @@ export type CodeGenInputOptions = z.infer<typeof CodeGenInputOptionsSchema> & {
2884
2899
  */
2885
2900
  _mcpClientWrapperFactory?: (realClient: any) => any;
2886
2901
  };
2887
- export type CodeGenErrorCodes = "credits-limit-daily" | "credits-limit-monthly" | "credits-limit-user" | "credits-limit-other" | "cli-genetic-error" | "git-update-error" | "prompt-too-long" | "context-too-long" | "abrupt-end" | "unknown" | "failed-recover-state" | "completion-expired" | "ask-to-continue" | "bad-initial-url" | "bad-smart-export-payload" | "invalid-last-message" | "corrupted-session" | "privacy-mode-key-required" | "privacy-mode-key-invalid" | "cli-network-error" | "model-restricted-too-large" | "org-no-models-enabled" | "assertion" | "rate-limit" | "unknown-design-system";
2902
+ export type CodeGenErrorCodes = "credits-limit-daily" | "credits-limit-monthly" | "credits-limit-user" | "credits-limit-other" | "cli-genetic-error" | "git-update-error" | "prompt-too-long" | "context-too-long" | "abrupt-end" | "unknown" | "failed-recover-state" | "completion-expired" | "ask-to-continue" | "bad-initial-url" | "bad-smart-export-payload" | "invalid-last-message" | "corrupted-session" | "privacy-mode-key-required" | "privacy-mode-key-invalid" | "privacy-mode-key-mismatch" | "cli-network-error" | "invalid-credentials" | "model-restricted-too-large" | "org-no-models-enabled" | "assertion" | "rate-limit" | "unknown-design-system";
2888
2903
  export interface CodegenUsage {
2889
2904
  total: number;
2890
2905
  fast: number;
@@ -3687,6 +3702,25 @@ export interface GetSessionTurnsResult {
3687
3702
  sessionMode?: SessionMode;
3688
3703
  hasPlanToApply?: boolean;
3689
3704
  metadata?: Record<string, any>;
3705
+ /** SHA-256(JWK) of the key this session is encrypted with. Presence ⟹ private. */
3706
+ encryptKeyHash?: string;
3707
+ /** Org requires new sessions to be private; derived per-request, not stored. */
3708
+ privacyModeRequired?: boolean;
3709
+ }
3710
+ /**
3711
+ * Body for `POST /codegen/settings`. All context is optional; the server
3712
+ * resolves settings for the narrowest scope it can, falling back to org.
3713
+ */
3714
+ export declare const CodegenSettingsRequestSchema: z.ZodObject<{
3715
+ sessionId: z.ZodOptional<z.ZodString>;
3716
+ projectName: z.ZodOptional<z.ZodString>;
3717
+ branchName: z.ZodOptional<z.ZodString>;
3718
+ repoHash: z.ZodOptional<z.ZodString>;
3719
+ }, z.core.$strip>;
3720
+ export type CodegenSettingsRequest = z.infer<typeof CodegenSettingsRequestSchema>;
3721
+ /** Load-independent client settings. v1 carries only the privacy gate. */
3722
+ export interface CodegenSettingsResult {
3723
+ privacyModeRequired?: boolean;
3690
3724
  }
3691
3725
  export interface CodegenFeedback {
3692
3726
  id: string;
@@ -4774,5 +4808,10 @@ export interface SessionData {
4774
4808
  numUserMessages: number;
4775
4809
  numNormalUserMessages: number;
4776
4810
  metadata?: Record<string, any>;
4811
+ /**
4812
+ * SHA-256(JWK) of the encryption key this session is encrypted with.
4813
+ * Presence makes the session private (sticky — no downgrade to plaintext).
4814
+ */
4815
+ encryptKeyHash?: string;
4777
4816
  }
4778
4817
  export {};
package/src/codegen.js CHANGED
@@ -157,6 +157,9 @@ export const SkillToolInputSchema = z
157
157
  args: z.string().nullish().meta({
158
158
  description: "Optional invocation arguments; forwarded with the skill body in the tool result.",
159
159
  }),
160
+ userInvoked: z.boolean().nullish().meta({
161
+ description: "Set to true when the user explicitly mentioned or requested this skill by name in their message (including slash commands). Set to false or omit when invoking proactively based on context.",
162
+ }),
160
163
  })
161
164
  .meta({ title: "SkillToolInput" });
162
165
  export const GetRuleToolInputSchema = z
@@ -433,7 +436,7 @@ export const AskUserQuestionSchema = z
433
436
  description: 'Very short label displayed as a chip/tag (max 12 chars). Examples: "Auth method", "Library", "Approach".',
434
437
  }),
435
438
  options: z.array(AskUserQuestionOptionSchema).min(2).max(4).meta({
436
- description: "The available choices for this question. Must have 2-4 options. Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). There should be no 'Other' option, that will be provided automatically.",
439
+ description: "The available choices for this question. Must have 2-4 options. Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). Provide only concrete, substantive choices. Do NOT add a free-form / catch-all option such as 'Other', 'Custom', 'Something else', 'Let me specify', 'None of these', etc. — the UI always appends an implicit 'Other' option that lets the user type a custom answer, so adding your own would create a duplicate that cannot accept input.",
437
440
  }),
438
441
  multiSelect: z.boolean().optional().meta({
439
442
  description: "Set to true to allow the user to select multiple options instead of just one. Use when choices are not mutually exclusive.",
@@ -1022,6 +1025,8 @@ export const ProposedConfigSchema = z
1022
1025
  createdAt: z.number(),
1023
1026
  updatedAt: z.number(),
1024
1027
  ownerId: z.string(),
1028
+ userInitiated: z.boolean(),
1029
+ autoApply: z.boolean(),
1025
1030
  state: ExitStateSchema.meta({
1026
1031
  description: "Configuration state from Exit tool",
1027
1032
  }),
@@ -1482,6 +1487,21 @@ export const EnsurePRToolInputSchema = z
1482
1487
  }),
1483
1488
  })
1484
1489
  .meta({ title: "EnsurePRToolInput" });
1490
+ export const EnableDatabaseToolInputSchema = z
1491
+ .object({
1492
+ purpose: z.string().optional().meta({
1493
+ description: "Brief non-technical note about what data will be stored (e.g. 'contact form submissions'). Used in the user-facing summary.",
1494
+ }),
1495
+ })
1496
+ .meta({ title: "EnableDatabaseToolInput" });
1497
+ /** Non-technical line surfaced in the run summary after EnableDatabase succeeds. */
1498
+ export function formatDatabaseEnabledUserSummary(purpose) {
1499
+ const trimmed = purpose === null || purpose === void 0 ? void 0 : purpose.trim();
1500
+ if (trimmed) {
1501
+ return `Spun up a database to store ${trimmed}.`;
1502
+ }
1503
+ return "Spun up a database for this project.";
1504
+ }
1485
1505
  export const ConnectMCPToolInputSchema = z
1486
1506
  .object({
1487
1507
  name: z.string().meta({
@@ -1559,6 +1579,7 @@ export const CodeGenToolMapSchema = z.object({
1559
1579
  PullPrototype: PullPrototypeToolInputSchema,
1560
1580
  ConnectMCP: ConnectMCPToolInputSchema,
1561
1581
  EnsurePR: EnsurePRToolInputSchema,
1582
+ EnableDatabase: EnableDatabaseToolInputSchema,
1562
1583
  GenerateDesignSystemAgentMd: GenerateDesignSystemAgentMdInputSchema,
1563
1584
  });
1564
1585
  export const CodeGenToolsSchema = CodeGenToolMapSchema.keyof().meta({
@@ -1957,6 +1978,18 @@ export const GenerateUserMessageSchema = z
1957
1978
  }),
1958
1979
  })
1959
1980
  .meta({ title: "GenerateUserMessage" });
1981
+ /**
1982
+ * Body for `POST /codegen/settings`. All context is optional; the server
1983
+ * resolves settings for the narrowest scope it can, falling back to org.
1984
+ */
1985
+ export const CodegenSettingsRequestSchema = z
1986
+ .object({
1987
+ sessionId: z.string().optional(),
1988
+ projectName: z.string().optional(),
1989
+ branchName: z.string().optional(),
1990
+ repoHash: z.string().optional(),
1991
+ })
1992
+ .meta({ title: "CodegenSettingsRequest" });
1960
1993
  /**
1961
1994
  * Request for generating a commit message via LLM
1962
1995
  */
package/src/events.d.ts CHANGED
@@ -1253,7 +1253,18 @@ export declare const ClientDevtoolsBuildFailedV1: {
1253
1253
  eventName: "client.devtools.build.failed";
1254
1254
  version: "1";
1255
1255
  };
1256
- export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | ClientDevtoolsBuildCompletedV1 | ClientDevtoolsBuildUploadedV1 | ClientDevtoolsBuildFailedV1 | 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;
1256
+ export type McpPrototypePulledV1 = FusionEventVariant<"mcp.prototype.pulled", {
1257
+ projectId: string;
1258
+ branchName: string;
1259
+ prototypeUrl: string;
1260
+ }, {
1261
+ projectId: string;
1262
+ }, 1>;
1263
+ export declare const McpPrototypePulledV1: {
1264
+ eventName: "mcp.prototype.pulled";
1265
+ version: "1";
1266
+ };
1267
+ export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | ClientDevtoolsBuildCompletedV1 | ClientDevtoolsBuildUploadedV1 | ClientDevtoolsBuildFailedV1 | 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 | McpPrototypePulledV1;
1257
1268
  export interface ModelPermissionRequiredEvent {
1258
1269
  type: "assistant.model.permission.required";
1259
1270
  data: {
package/src/events.js CHANGED
@@ -154,3 +154,7 @@ export const ClientDevtoolsBuildFailedV1 = {
154
154
  eventName: "client.devtools.build.failed",
155
155
  version: "1",
156
156
  };
157
+ export const McpPrototypePulledV1 = {
158
+ eventName: "mcp.prototype.pulled",
159
+ version: "1",
160
+ };
package/src/projects.d.ts CHANGED
@@ -229,6 +229,7 @@ export type GitConfigs = Record<string, GitConfig>;
229
229
  export declare const EXAMPLE_REPOS: string[];
230
230
  export declare const STARTER_REPO = "BuilderIO/fusion-starter";
231
231
  export declare const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
232
+ export declare const AGENT_NATIVE_STARTER_REPO = "BuilderIO/builder-agent-native-starter";
232
233
  export declare const EXAMPLE_OR_STARTER_REPOS: string[];
233
234
  export declare const EXAMPLE_OR_STARTER_REPOS_URLS: string[];
234
235
  export interface GitBackupUploadUrlResult {
@@ -1028,6 +1029,8 @@ export interface CreateProjectOptions {
1028
1029
  autoApplySetup?: boolean;
1029
1030
  templateId?: string;
1030
1031
  useInternalHost?: boolean;
1032
+ /** Store branches in the standalone `branches` collection vs embedded in the project doc. */
1033
+ useBranchesCollection?: boolean;
1031
1034
  }
1032
1035
  export interface BuilderMyContext {
1033
1036
  success: boolean;
@@ -1606,4 +1609,23 @@ export declare const GetDeploysResponseSchema: z.ZodObject<{
1606
1609
  }, z.core.$strip>>;
1607
1610
  }, z.core.$strip>;
1608
1611
  export type GetDeploysResponse = z.infer<typeof GetDeploysResponseSchema>;
1612
+ export declare const CloneProjectOptionsSchema: z.ZodObject<{
1613
+ sourceProjectId: z.ZodString;
1614
+ sourceBranchName: z.ZodDefault<z.ZodString>;
1615
+ newProjectName: z.ZodOptional<z.ZodString>;
1616
+ intent: z.ZodEnum<{
1617
+ clone: "clone";
1618
+ duplicate: "duplicate";
1619
+ }>;
1620
+ userEmail: z.ZodOptional<z.ZodString>;
1621
+ useKube: z.ZodDefault<z.ZodBoolean>;
1622
+ useBranchesCollection: z.ZodDefault<z.ZodBoolean>;
1623
+ }, z.core.$strip>;
1624
+ export type CloneProjectOptions = z.infer<typeof CloneProjectOptionsSchema>;
1625
+ export declare const DuplicateBranchOptionsSchema: z.ZodObject<{
1626
+ projectId: z.ZodString;
1627
+ sourceBranchName: z.ZodString;
1628
+ friendlyName: z.ZodOptional<z.ZodString>;
1629
+ }, z.core.$strip>;
1630
+ export type DuplicateBranchOptions = z.infer<typeof DuplicateBranchOptionsSchema>;
1609
1631
  export {};
package/src/projects.js CHANGED
@@ -36,10 +36,12 @@ 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 AGENT_NATIVE_STARTER_REPO = "BuilderIO/builder-agent-native-starter";
39
40
  export const EXAMPLE_OR_STARTER_REPOS = [
40
41
  ...EXAMPLE_REPOS,
41
42
  STARTER_REPO,
42
43
  DSI_PREVIEW_REPO,
44
+ AGENT_NATIVE_STARTER_REPO,
43
45
  ];
44
46
  export const EXAMPLE_OR_STARTER_REPOS_URLS = EXAMPLE_OR_STARTER_REPOS.map((repo) => `https://github.com/${repo}`);
45
47
  export const checkIsNewBranch = (branch) => {
@@ -507,3 +509,49 @@ export const GetDeploysRequestSchema = z.object({
507
509
  export const GetDeploysResponseSchema = z.object({
508
510
  deploys: z.array(DeployListItemSchema),
509
511
  });
512
+ export const CloneProjectOptionsSchema = z.object({
513
+ sourceProjectId: z.string().min(1).meta({
514
+ description: "Project to clone from.",
515
+ }),
516
+ sourceBranchName: z.string().min(1).default("main").meta({
517
+ description: "Branch to seed the clone's branch from.",
518
+ }),
519
+ newProjectName: z.string().min(1).max(200).optional().meta({
520
+ description: 'Name for the new project. Defaults to "{source} (cloned)" for clones.',
521
+ }),
522
+ intent: z.enum(["clone", "duplicate"]).meta({
523
+ description: '"clone": public example/starter → caller\'s space (always full backup, ' +
524
+ 'isExample, name suffixed). "duplicate": copy one of the caller\'s own ' +
525
+ "projects. Required.",
526
+ }),
527
+ userEmail: z
528
+ .string()
529
+ .optional()
530
+ .meta({
531
+ description: "Attributes the new project to a concrete user when the request has no " +
532
+ "user session (e.g. API-key auth). Resolved to a user id that must " +
533
+ "belong to the caller's org; without it a no-session request can't be " +
534
+ "attributed and project creation fails with 401.",
535
+ }),
536
+ useKube: z.boolean().default(false).meta({
537
+ description: "Whether to provision on cloud-v2 (Kubernetes). Defaults to false.",
538
+ }),
539
+ useBranchesCollection: z
540
+ .boolean()
541
+ .default(false)
542
+ .meta({
543
+ description: "Whether the new project stores branches in the standalone `branches` " +
544
+ "collection rather than embedded in the project doc. Defaults to false.",
545
+ }),
546
+ });
547
+ export const DuplicateBranchOptionsSchema = z.object({
548
+ projectId: z.string().min(1).meta({
549
+ description: "Project that owns the branch being duplicated.",
550
+ }),
551
+ sourceBranchName: z.string().min(1).meta({
552
+ description: "Branch to duplicate.",
553
+ }),
554
+ friendlyName: z.string().max(200).optional().meta({
555
+ description: "Optional friendly (display) name for the new branch.",
556
+ }),
557
+ });