@builder.io/ai-utils 0.100.2 → 0.103.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.100.2",
3
+ "version": "0.103.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -4542,6 +4542,11 @@ export interface FusionConfig {
4542
4542
  /** If true, nuke and re-clone the git repo during init, overwriting the existing repo */
4543
4543
  rebuildGit?: boolean;
4544
4544
  mode?: Mode;
4545
+ /**
4546
+ * Combines with the backup modes: try to repair a corrupt git object database
4547
+ * before backing up, instead of failing on the first unreadable object.
4548
+ */
4549
+ attemptCorruptGitRecovery?: boolean;
4545
4550
  autoDetectDevServer?: boolean;
4546
4551
  autoDetectDevServerPatterns?: string[];
4547
4552
  /**
@@ -4670,7 +4675,7 @@ export interface LoadHistoryResult {
4670
4675
  updatedUnixTime: number;
4671
4676
  turns: CodegenTurn[];
4672
4677
  }
4673
- 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" | "snapshot-backup-restore";
4678
+ 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" | "snapshot-backup-restore" | "git-corruption-recovery";
4674
4679
  export interface InitStatusLog {
4675
4680
  id: number;
4676
4681
  timestamp: string;
package/src/events.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface AssistantCompletionResultEvent {
16
16
  resolveId?: string;
17
17
  }
18
18
  export interface AssistantError {
19
+ code?: string;
19
20
  message: string;
20
21
  status?: number;
21
22
  actions?: AssistantMessageAction[];
package/src/index.d.ts CHANGED
@@ -23,4 +23,5 @@ export * from "./design-systems.js";
23
23
  export * from "./editor-ai.js";
24
24
  export * from "./realtime.js";
25
25
  export * from "./embeddings.js";
26
+ export * from "./mcp-servers.js";
26
27
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
package/src/index.js CHANGED
@@ -23,4 +23,5 @@ export * from "./design-systems.js";
23
23
  export * from "./editor-ai.js";
24
24
  export * from "./realtime.js";
25
25
  export * from "./embeddings.js";
26
+ export * from "./mcp-servers.js";
26
27
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ export declare const McpServerRecordSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ ownerId: z.ZodString;
5
+ type: z.ZodLiteral<"url">;
6
+ url: z.ZodString;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ provider: z.ZodOptional<z.ZodString>;
10
+ clientName: z.ZodOptional<z.ZodString>;
11
+ createDate: z.ZodNumber;
12
+ updatedAt: z.ZodOptional<z.ZodNumber>;
13
+ tokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
14
+ requiresOAuth: z.ZodOptional<z.ZodBoolean>;
15
+ disabled: z.ZodOptional<z.ZodBoolean>;
16
+ isBuiltinConfiguration: z.ZodOptional<z.ZodBoolean>;
17
+ }, z.core.$strip>;
18
+ export type McpServerRecord = z.infer<typeof McpServerRecordSchema>;
19
+ export declare const McpServersListResponseSchema: z.ZodObject<{
20
+ servers: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodString;
22
+ ownerId: z.ZodString;
23
+ type: z.ZodLiteral<"url">;
24
+ url: z.ZodString;
25
+ name: z.ZodString;
26
+ description: z.ZodOptional<z.ZodString>;
27
+ provider: z.ZodOptional<z.ZodString>;
28
+ clientName: z.ZodOptional<z.ZodString>;
29
+ createDate: z.ZodNumber;
30
+ updatedAt: z.ZodOptional<z.ZodNumber>;
31
+ tokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
32
+ requiresOAuth: z.ZodOptional<z.ZodBoolean>;
33
+ disabled: z.ZodOptional<z.ZodBoolean>;
34
+ isBuiltinConfiguration: z.ZodOptional<z.ZodBoolean>;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>;
37
+ export type McpServersListResponse = z.infer<typeof McpServersListResponseSchema>;
38
+ export declare const McpServersDeleteRequestSchema: z.ZodObject<{
39
+ serverIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ serverUrl: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ export type McpServersDeleteRequest = z.infer<typeof McpServersDeleteRequestSchema>;
43
+ export declare const McpServersDeleteResponseSchema: z.ZodObject<{
44
+ deletedServerIds: z.ZodArray<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ export type McpServersDeleteResponse = z.infer<typeof McpServersDeleteResponseSchema>;
47
+ export declare const McpServersDisableRequestSchema: z.ZodObject<{
48
+ serverIds: z.ZodArray<z.ZodString>;
49
+ disabled: z.ZodBoolean;
50
+ }, z.core.$strip>;
51
+ export type McpServersDisableRequest = z.infer<typeof McpServersDisableRequestSchema>;
52
+ export declare const McpServersDisableResponseSchema: z.ZodObject<{
53
+ updatedServerIds: z.ZodArray<z.ZodString>;
54
+ }, z.core.$strip>;
55
+ export type McpServersDisableResponse = z.infer<typeof McpServersDisableResponseSchema>;
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ // Deliberately excludes authorizationToken, refreshToken, tokenType, and oauthMetadata:
3
+ // this is a general-purpose management API any org member can call, so credentials
4
+ // that could be replayed against the third-party server never leave the backend.
5
+ export const McpServerRecordSchema = z
6
+ .object({
7
+ id: z.string(),
8
+ ownerId: z.string(),
9
+ type: z.literal("url"),
10
+ url: z.string(),
11
+ name: z.string(),
12
+ description: z.string().optional(),
13
+ provider: z.string().optional(),
14
+ clientName: z.string().optional(),
15
+ createDate: z.number(),
16
+ updatedAt: z.number().optional(),
17
+ tokenExpiresAt: z.number().nullish(),
18
+ requiresOAuth: z.boolean().optional(),
19
+ disabled: z.boolean().optional(),
20
+ isBuiltinConfiguration: z.boolean().optional(),
21
+ })
22
+ .meta({ title: "McpServerRecord" });
23
+ export const McpServersListResponseSchema = z
24
+ .object({
25
+ servers: z.array(McpServerRecordSchema),
26
+ })
27
+ .meta({ title: "McpServersListResponse" });
28
+ // `serverUrl` mirrors the legacy disconnect-by-url Firestore query.
29
+ export const McpServersDeleteRequestSchema = z
30
+ .object({
31
+ serverIds: z.array(z.string()).optional(),
32
+ serverUrl: z.string().optional(),
33
+ })
34
+ .meta({ title: "McpServersDeleteRequest" });
35
+ export const McpServersDeleteResponseSchema = z
36
+ .object({
37
+ deletedServerIds: z.array(z.string()),
38
+ })
39
+ .meta({ title: "McpServersDeleteResponse" });
40
+ export const McpServersDisableRequestSchema = z
41
+ .object({
42
+ serverIds: z.array(z.string()).min(1),
43
+ disabled: z.boolean(),
44
+ })
45
+ .meta({ title: "McpServersDisableRequest" });
46
+ export const McpServersDisableResponseSchema = z
47
+ .object({
48
+ updatedServerIds: z.array(z.string()),
49
+ })
50
+ .meta({ title: "McpServersDisableResponse" });
package/src/projects.d.ts CHANGED
@@ -334,6 +334,23 @@ export interface CodegenSetLastCommit {
334
334
  lastCommitHash: GitSnapshot;
335
335
  clearSecondaryVolumeId: boolean;
336
336
  }
337
+ /**
338
+ * A run that ended on an unreadable git object database.
339
+ *
340
+ * Reported by the container rather than inferred by the service: a backup-mode
341
+ * launch is only ever observed as a machine that started and exited, so from
342
+ * the outside a corrupt repo and a clean backup look the same.
343
+ */
344
+ export declare const GitCorruptionReportSchema: z.ZodObject<{
345
+ at: z.ZodNumber;
346
+ error: z.ZodString;
347
+ repoPath: z.ZodOptional<z.ZodString>;
348
+ emptyObjects: z.ZodOptional<z.ZodNumber>;
349
+ recoveryAttempted: z.ZodOptional<z.ZodBoolean>;
350
+ recoveryRefetched: z.ZodOptional<z.ZodBoolean>;
351
+ devToolsVersion: z.ZodOptional<z.ZodString>;
352
+ }, z.core.$strip>;
353
+ export type GitCorruptionReport = z.infer<typeof GitCorruptionReportSchema>;
337
354
  export interface CodegenRuntimeStatus {
338
355
  projectId: string;
339
356
  branchName: string;
@@ -341,6 +358,7 @@ export interface CodegenRuntimeStatus {
341
358
  clearSecondaryVolumeId?: boolean;
342
359
  lastServerState?: LaunchServerState;
343
360
  lastServerVersion?: string;
361
+ gitCorruption?: GitCorruptionReport;
344
362
  }
345
363
  export interface BackupGitRepoResultValid {
346
364
  success: true;
@@ -587,6 +605,12 @@ export interface BranchSharedData {
587
605
  lastServerState?: LaunchServerState | null;
588
606
  lastServerStateDate?: number | null;
589
607
  lastServerVersion?: string | null;
608
+ /**
609
+ * Last run that died on a corrupt git object database, cleared the next time
610
+ * the branch initializes cleanly. A volume in this state can never produce a
611
+ * deletion-safe backup, so the cleanup cron will never reclaim it.
612
+ */
613
+ gitCorruption?: GitCorruptionReport | null;
590
614
  name?: string;
591
615
  hidden?: boolean;
592
616
  createdBy?: string;
@@ -2413,6 +2437,9 @@ export interface MemorySummary extends Pick<MemoryData, (typeof MEMORY_SUMMARY_F
2413
2437
  export interface GetProjectMemoriesResult {
2414
2438
  memories: MemorySummary[];
2415
2439
  }
2440
+ export interface GetFusionPrivateKeyResult {
2441
+ id: string;
2442
+ }
2416
2443
  interface BaseSendMessageMessage {
2417
2444
  }
2418
2445
  export interface ValidatingBranchMessage extends BaseSendMessageMessage {
@@ -2602,6 +2629,8 @@ export declare const ProjectHostingSchema: z.ZodObject<{
2602
2629
  skip: "skip";
2603
2630
  }>>;
2604
2631
  configUpdatedAt: z.ZodOptional<z.ZodNumber>;
2632
+ originLockPendingAt: z.ZodOptional<z.ZodString>;
2633
+ originLockedAt: z.ZodOptional<z.ZodString>;
2605
2634
  }, z.core.$strip>;
2606
2635
  export type ProjectHosting = z.infer<typeof ProjectHostingSchema>;
2607
2636
  /**
@@ -3177,6 +3206,7 @@ export declare const DeploySchema: z.ZodObject<{
3177
3206
  uploading: "uploading";
3178
3207
  }>;
3179
3208
  netlifyDeployId: z.ZodOptional<z.ZodString>;
3209
+ netlifyOriginLockCodeSha: z.ZodOptional<z.ZodString>;
3180
3210
  url: z.ZodOptional<z.ZodString>;
3181
3211
  migrationApplied: z.ZodOptional<z.ZodBoolean>;
3182
3212
  error: z.ZodOptional<z.ZodString>;
@@ -3414,6 +3444,14 @@ export declare const ReserveSlugResponseSchema: z.ZodObject<{
3414
3444
  slug: z.ZodString;
3415
3445
  }, z.core.$strip>;
3416
3446
  export type ReserveSlugResponse = z.infer<typeof ReserveSlugResponseSchema>;
3447
+ export declare const CheckOrgSuffixAvailableRequestSchema: z.ZodObject<{
3448
+ suffix: z.ZodString;
3449
+ }, z.core.$strip>;
3450
+ export type CheckOrgSuffixAvailableRequest = z.infer<typeof CheckOrgSuffixAvailableRequestSchema>;
3451
+ export declare const CheckOrgSuffixAvailableResponseSchema: z.ZodObject<{
3452
+ available: z.ZodBoolean;
3453
+ }, z.core.$strip>;
3454
+ export type CheckOrgSuffixAvailableResponse = z.infer<typeof CheckOrgSuffixAvailableResponseSchema>;
3417
3455
  export declare const GoldenSnapshotRefreshRequestSchema: z.ZodObject<{
3418
3456
  sourceCommitSha: z.ZodString;
3419
3457
  }, z.core.$strict>;
@@ -4406,6 +4444,8 @@ export declare const ProjectTemplateSchema: z.ZodObject<{
4406
4444
  skip: "skip";
4407
4445
  }>>;
4408
4446
  configUpdatedAt: z.ZodOptional<z.ZodNumber>;
4447
+ originLockPendingAt: z.ZodOptional<z.ZodString>;
4448
+ originLockedAt: z.ZodOptional<z.ZodString>;
4409
4449
  }, z.core.$strip>>;
4410
4450
  }, z.core.$strip>;
4411
4451
  export type ProjectTemplate = z.infer<typeof ProjectTemplateSchema>;
package/src/projects.js CHANGED
@@ -107,6 +107,23 @@ export const EXAMPLE_OR_STARTER_REPOS = [
107
107
  AGENT_NATIVE_STARTER_REPO,
108
108
  ];
109
109
  export const EXAMPLE_OR_STARTER_REPOS_URLS = EXAMPLE_OR_STARTER_REPOS.map((repo) => `https://github.com/${repo}`);
110
+ /**
111
+ * A run that ended on an unreadable git object database.
112
+ *
113
+ * Reported by the container rather than inferred by the service: a backup-mode
114
+ * launch is only ever observed as a machine that started and exited, so from
115
+ * the outside a corrupt repo and a clean backup look the same.
116
+ */
117
+ export const GitCorruptionReportSchema = z.object({
118
+ /** When the run failed — not when the objects were damaged. */
119
+ at: z.number(),
120
+ error: z.string().max(2000),
121
+ repoPath: z.string().max(500).optional(),
122
+ emptyObjects: z.number().int().nonnegative().max(1000000).optional(),
123
+ recoveryAttempted: z.boolean().optional(),
124
+ recoveryRefetched: z.boolean().optional(),
125
+ devToolsVersion: z.string().max(100).optional(),
126
+ });
110
127
  /** Fields shared by every {@link ProjectSkill} variant. */
111
128
  const ProjectSkillBaseShape = {
112
129
  key: z.string().meta({
@@ -1256,6 +1273,12 @@ export const ProjectHostingSchema = z.object({
1256
1273
  configUpdatedAt: z.number().optional().meta({
1257
1274
  description: "Epoch ms of the last change to a hosting field that requires a redeploy. Compare against `lastDeployAt`.",
1258
1275
  }),
1276
+ originLockPendingAt: z.string().optional().meta({
1277
+ description: "ISO timestamp when origin-lock activation began. Route reconcilers preserve the header until activation completes.",
1278
+ }),
1279
+ originLockedAt: z.string().optional().meta({
1280
+ description: "ISO timestamp of the first successful origin-locked deploy. Absent means activation has not completed.",
1281
+ }),
1259
1282
  });
1260
1283
  /**
1261
1284
  * Mask of the hosting sub-fields a client may write via `PATCH`. Everything
@@ -1450,6 +1473,9 @@ export const DeploySchema = z.object({
1450
1473
  }),
1451
1474
  status: DeployStatusSchema,
1452
1475
  netlifyDeployId: z.string().optional(),
1476
+ netlifyOriginLockCodeSha: z.string().optional().meta({
1477
+ description: "Origin-lock edge-function SHA declared when the persisted Netlify deploy was created.",
1478
+ }),
1453
1479
  url: z.string().optional(),
1454
1480
  migrationApplied: z.boolean().optional().meta({
1455
1481
  description: "Whether Drizzle migrations were applied during this deploy. Absent when no migration ran.",
@@ -1778,6 +1804,12 @@ export const ReserveSlugRequestSchema = z.object({
1778
1804
  export const ReserveSlugResponseSchema = z.object({
1779
1805
  slug: z.string(),
1780
1806
  });
1807
+ export const CheckOrgSuffixAvailableRequestSchema = z.object({
1808
+ suffix: z.string().min(1),
1809
+ });
1810
+ export const CheckOrgSuffixAvailableResponseSchema = z.object({
1811
+ available: z.boolean(),
1812
+ });
1781
1813
  const gitCommitHashSchema = z
1782
1814
  .string()
1783
1815
  .regex(/^[0-9a-f]{7,40}$/i, "Must be a valid git commit hash (7–40 hex chars)");
@@ -18,6 +18,16 @@ export const PUBLISH_AGENT_SKILLS_INFO = [
18
18
  name: "create-page",
19
19
  description: "Create a new page in the Builder CMS space. Use when the user asks to create, add, or scaffold a new page.",
20
20
  },
21
+ {
22
+ id: "publish-agent-skill-scaffold-site",
23
+ name: "scaffold-site",
24
+ description: "Plan and scaffold a site's information architecture from a CSV, sitemap, or existing-site URL, with a review step before implementation.",
25
+ },
26
+ {
27
+ id: "publish-agent-skill-import-records",
28
+ name: "import-records",
29
+ description: "Import records from an attached CSV into an existing Builder model, with column mapping and a row preview before execution.",
30
+ },
21
31
  ];
22
32
  export const PublishAgentSessionCursorSchema = z
23
33
  .object({