@builder.io/ai-utils 0.101.0 → 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.101.0",
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 {
@@ -3417,6 +3444,14 @@ export declare const ReserveSlugResponseSchema: z.ZodObject<{
3417
3444
  slug: z.ZodString;
3418
3445
  }, z.core.$strip>;
3419
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>;
3420
3455
  export declare const GoldenSnapshotRefreshRequestSchema: z.ZodObject<{
3421
3456
  sourceCommitSha: z.ZodString;
3422
3457
  }, z.core.$strict>;
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({
@@ -1787,6 +1804,12 @@ export const ReserveSlugRequestSchema = z.object({
1787
1804
  export const ReserveSlugResponseSchema = z.object({
1788
1805
  slug: z.string(),
1789
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
+ });
1790
1813
  const gitCommitHashSchema = z
1791
1814
  .string()
1792
1815
  .regex(/^[0-9a-f]{7,40}$/i, "Must be a valid git commit hash (7–40 hex chars)");