@builder.io/ai-utils 0.73.0 → 0.74.1

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.73.0",
3
+ "version": "0.74.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
@@ -18,11 +18,36 @@ export declare const BuilderConfigDatabaseSchema: z.ZodObject<{
18
18
  schemaDir: z.ZodDefault<z.ZodString>;
19
19
  }, z.core.$strip>;
20
20
  export type BuilderConfigDatabase = z.infer<typeof BuilderConfigDatabaseSchema>;
21
+ /** `hosting` block in `builder.config.json` — see First Class Hosting spec. */
22
+ export declare const BuilderConfigHostingEnvironmentSchema: z.ZodObject<{
23
+ build: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
24
+ prod: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ }, z.core.$strip>;
26
+ export type BuilderConfigHostingEnvironment = z.infer<typeof BuilderConfigHostingEnvironmentSchema>;
27
+ export declare const BuilderConfigHostingSchema: z.ZodObject<{
28
+ buildCommand: z.ZodOptional<z.ZodString>;
29
+ nodeVersion: z.ZodOptional<z.ZodString>;
30
+ buildOutputDir: z.ZodOptional<z.ZodString>;
31
+ environment: z.ZodOptional<z.ZodObject<{
32
+ build: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
33
+ prod: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>;
36
+ export type BuilderConfigHosting = z.infer<typeof BuilderConfigHostingSchema>;
21
37
  export declare const BuilderConfigSchema: z.ZodObject<{
22
38
  database: z.ZodOptional<z.ZodObject<{
23
39
  kind: z.ZodLiteral<"postgres">;
24
40
  migrations: z.ZodLiteral<"drizzle">;
25
41
  schemaDir: z.ZodDefault<z.ZodString>;
26
42
  }, z.core.$strip>>;
43
+ hosting: z.ZodOptional<z.ZodObject<{
44
+ buildCommand: z.ZodOptional<z.ZodString>;
45
+ nodeVersion: z.ZodOptional<z.ZodString>;
46
+ buildOutputDir: z.ZodOptional<z.ZodString>;
47
+ environment: z.ZodOptional<z.ZodObject<{
48
+ build: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
+ prod: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>>;
27
52
  }, z.core.$strip>;
28
53
  export type BuilderConfig = z.infer<typeof BuilderConfigSchema>;
@@ -17,6 +17,18 @@ export const BuilderConfigDatabaseSchema = z.object({
17
17
  migrations: z.literal("drizzle"),
18
18
  schemaDir: z.string().default("drizzle"),
19
19
  });
20
+ /** `hosting` block in `builder.config.json` — see First Class Hosting spec. */
21
+ export const BuilderConfigHostingEnvironmentSchema = z.object({
22
+ build: z.record(z.string(), z.string()).optional(),
23
+ prod: z.record(z.string(), z.string()).optional(),
24
+ });
25
+ export const BuilderConfigHostingSchema = z.object({
26
+ buildCommand: z.string().optional(),
27
+ nodeVersion: z.string().optional(),
28
+ buildOutputDir: z.string().optional(),
29
+ environment: BuilderConfigHostingEnvironmentSchema.optional(),
30
+ });
20
31
  export const BuilderConfigSchema = z.object({
21
32
  database: BuilderConfigDatabaseSchema.optional(),
33
+ hosting: BuilderConfigHostingSchema.optional(),
22
34
  });
package/src/codegen.d.ts CHANGED
@@ -28,6 +28,11 @@ export declare const ProjectFileSchema: z.ZodObject<{
28
28
  virtual: z.ZodOptional<z.ZodBoolean>;
29
29
  }, z.core.$strip>;
30
30
  export type ProjectFile = z.infer<typeof ProjectFileSchema>;
31
+ export declare const CustomAgentInfoSchema: z.ZodObject<{
32
+ name: z.ZodString;
33
+ description: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ export type CustomAgentInfo = z.infer<typeof CustomAgentInfoSchema>;
31
36
  export declare const CustomInstructionSchema: z.ZodObject<{
32
37
  id: z.ZodString;
33
38
  name: z.ZodString;
@@ -45,11 +50,16 @@ export declare const CustomInstructionSchema: z.ZodObject<{
45
50
  disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
46
51
  userInvocable: z.ZodOptional<z.ZodBoolean>;
47
52
  scope: z.ZodOptional<z.ZodEnum<{
53
+ builtin: "builtin";
48
54
  plugin: "plugin";
49
55
  project: "project";
50
56
  user: "user";
51
57
  }>>;
52
58
  pluginName: z.ZodOptional<z.ZodString>;
59
+ ownedAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
+ name: z.ZodString;
61
+ description: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>>>;
53
63
  }, z.core.$strip>;
54
64
  export type CustomInstruction = z.infer<typeof CustomInstructionSchema>;
55
65
  /** Reasoning effort level for LLM completions. */
@@ -64,11 +74,6 @@ export declare const ReasoningEffortSchema: z.ZodEnum<{
64
74
  xhigh: "xhigh";
65
75
  }>;
66
76
  export type ReasoningEffort = z.infer<typeof ReasoningEffortSchema>;
67
- export declare const CustomAgentInfoSchema: z.ZodObject<{
68
- name: z.ZodString;
69
- description: z.ZodOptional<z.ZodString>;
70
- }, z.core.$strip>;
71
- export type CustomAgentInfo = z.infer<typeof CustomAgentInfoSchema>;
72
77
  /** Per-agent model overrides. String = fixed model, string[] = round-robin. */
73
78
  export declare const AgentModelOverridesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
74
79
  export type AgentModelOverrides = z.infer<typeof AgentModelOverridesSchema>;
@@ -1295,6 +1300,28 @@ export declare const SubmitPRReviewToolInputSchema: z.ZodObject<{
1295
1300
  }>>;
1296
1301
  }, z.core.$strip>;
1297
1302
  export type SubmitPRReviewToolInput = z.infer<typeof SubmitPRReviewToolInputSchema>;
1303
+ /**
1304
+ * AddComment - a generic, UI-only tool for attaching a typed comment to the
1305
+ * session. It never posts anywhere external; the service only validates the
1306
+ * call and the dev-tools CLI emits a `comment-added` step from the tool input
1307
+ * so the UI can render it. The `type` discriminates how the UI renders the
1308
+ * comment (e.g. `"code-review"`), and `metadata` carries type-specific fields.
1309
+ *
1310
+ * Example (code-review skill):
1311
+ * addComment({
1312
+ * type: "code-review",
1313
+ * content: "Unawaited async call will fail in serverless",
1314
+ * metadata: { filePath: "src/x.ts", startLine: 264, endLine: 264, severity: "high" }
1315
+ * })
1316
+ */
1317
+ export declare const AddCommentToolInputSchema: z.ZodObject<{
1318
+ type: z.ZodString;
1319
+ content: z.ZodString;
1320
+ metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1321
+ }, z.core.$strip>;
1322
+ export type AddCommentToolInput = Omit<z.infer<typeof AddCommentToolInputSchema>, "metadata"> & {
1323
+ metadata?: AddedCommentMetadata;
1324
+ };
1298
1325
  export declare const ResolveQACommentsToolInputSchema: z.ZodObject<{
1299
1326
  thread_node_ids: z.ZodArray<z.ZodString>;
1300
1327
  }, z.core.$strip>;
@@ -1639,6 +1666,11 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1639
1666
  looks_good: "looks_good";
1640
1667
  }>>;
1641
1668
  }, z.core.$strip>;
1669
+ AddComment: z.ZodObject<{
1670
+ type: z.ZodString;
1671
+ content: z.ZodString;
1672
+ metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
1673
+ }, z.core.$strip>;
1642
1674
  ProposeConfig: z.ZodObject<{
1643
1675
  config: z.ZodObject<{
1644
1676
  projectOverview: z.ZodObject<{
@@ -1930,6 +1962,7 @@ export declare const CodeGenToolMapSchema: z.ZodObject<{
1930
1962
  }, z.core.$strip>;
1931
1963
  export type CodeGenToolMap = z.infer<typeof CodeGenToolMapSchema>;
1932
1964
  export declare const CodeGenToolsSchema: z.ZodEnum<{
1965
+ AddComment: "AddComment";
1933
1966
  AddMemory: "AddMemory";
1934
1967
  Agent: "Agent";
1935
1968
  ArchiveBranch: "ArchiveBranch";
@@ -2424,11 +2457,16 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
2424
2457
  disableModelInvocation: z.ZodOptional<z.ZodBoolean>;
2425
2458
  userInvocable: z.ZodOptional<z.ZodBoolean>;
2426
2459
  scope: z.ZodOptional<z.ZodEnum<{
2460
+ builtin: "builtin";
2427
2461
  plugin: "plugin";
2428
2462
  project: "project";
2429
2463
  user: "user";
2430
2464
  }>>;
2431
2465
  pluginName: z.ZodOptional<z.ZodString>;
2466
+ ownedAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
2467
+ name: z.ZodString;
2468
+ description: z.ZodOptional<z.ZodString>;
2469
+ }, z.core.$strip>>>;
2432
2470
  }, z.core.$strip>>>;
2433
2471
  customAgents: z.ZodOptional<z.ZodArray<z.ZodObject<{
2434
2472
  name: z.ZodString;
@@ -2649,6 +2687,7 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
2649
2687
  }, z.core.$strip>>;
2650
2688
  recommendedRoot: z.ZodOptional<z.ZodString>;
2651
2689
  enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2690
+ AddComment: "AddComment";
2652
2691
  AddMemory: "AddMemory";
2653
2692
  Agent: "Agent";
2654
2693
  ArchiveBranch: "ArchiveBranch";
@@ -3194,6 +3233,37 @@ export interface GenerateCompletionStepGit {
3194
3233
  pendingValidation: boolean;
3195
3234
  unmergedFiles: string[];
3196
3235
  }
3236
+ /**
3237
+ * A typed comment added to the session via the generic `AddComment` tool. The
3238
+ * `commentType` mirrors the tool's `type` field (e.g. `"code-review"`) and
3239
+ * drives how the UI renders it; `metadata` carries type-specific fields (for
3240
+ * code review: `filePath`, `startLine`, optional `endLine`, optional
3241
+ * `severity`).
3242
+ */
3243
+ export interface AddedCommentOriginalSnippet {
3244
+ filePath: string;
3245
+ startLine: number;
3246
+ endLine: number;
3247
+ lines: string[];
3248
+ }
3249
+ export interface AddedCommentMetadata extends Record<string, unknown> {
3250
+ originalSnippet?: AddedCommentOriginalSnippet;
3251
+ }
3252
+ export interface AddedComment {
3253
+ commentType: string;
3254
+ content: string;
3255
+ metadata?: AddedCommentMetadata;
3256
+ }
3257
+ /**
3258
+ * Emitted when a comment is added via the `AddComment` tool. The UI renders the
3259
+ * comment based on its `commentType`. No external posting happens for this
3260
+ * event — it is UI-only.
3261
+ */
3262
+ export interface GenerateCompletionStepCommentAdded {
3263
+ type: "comment-added";
3264
+ id: string;
3265
+ comment: AddedComment;
3266
+ }
3197
3267
  export interface GenerateCompletionStepClose {
3198
3268
  type: "close";
3199
3269
  }
@@ -3216,7 +3286,7 @@ export interface CustomInstructionDefinition {
3216
3286
  glob?: string;
3217
3287
  isSkill?: boolean;
3218
3288
  userInvocable?: boolean;
3219
- scope?: "project" | "user" | "plugin";
3289
+ scope?: "project" | "user" | "plugin" | "builtin";
3220
3290
  pluginName?: string;
3221
3291
  }
3222
3292
  export interface GenerateCompletionStepSession {
@@ -3313,7 +3383,7 @@ export interface GenerateCompletionStepUpdateSetupValue {
3313
3383
  };
3314
3384
  reason: string;
3315
3385
  }
3316
- export type GenerateCompletionStep = GenerateCompletionStepThinking | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepLocalMCPAuthComplete | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepIde;
3386
+ export type GenerateCompletionStep = GenerateCompletionStepThinking | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepLocalMCPAuthComplete | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepCommentAdded | GenerateCompletionStepIde;
3317
3387
  export interface ApplyActionsResult {
3318
3388
  filePath: string;
3319
3389
  addedLines: number;
@@ -4029,6 +4099,8 @@ export interface FusionConfig {
4029
4099
  checkCommand?: string;
4030
4100
  setupCommand?: string;
4031
4101
  validateCommand?: string;
4102
+ /** Production build command for hosting deploy pods (default: npm run build). */
4103
+ buildCommand?: string;
4032
4104
  fusionServerPort?: number;
4033
4105
  autoPush?: AutoPushMode;
4034
4106
  lockFile?: {
@@ -4514,6 +4586,22 @@ export interface ValidateCommandResultFailure {
4514
4586
  code: number | null;
4515
4587
  output: string;
4516
4588
  }
4589
+ export type BuildCommandState = ValidateCommandState;
4590
+ export type BuildCommandResult = BuildCommandResultSuccess | BuildCommandResultAborted | BuildCommandResultFailure;
4591
+ export interface BuildCommandResultSuccess {
4592
+ status: "success";
4593
+ command: string;
4594
+ }
4595
+ export interface BuildCommandResultAborted {
4596
+ status: "aborted";
4597
+ command: string | undefined;
4598
+ }
4599
+ export interface BuildCommandResultFailure {
4600
+ status: "failure";
4601
+ command: string;
4602
+ code?: number;
4603
+ output: string;
4604
+ }
4517
4605
  export interface ConfigureDevOrchestratorUpdates {
4518
4606
  devCommand: boolean;
4519
4607
  setupCommand: boolean;
package/src/codegen.js CHANGED
@@ -22,6 +22,12 @@ export const ProjectFileSchema = z
22
22
  virtual: z.boolean().optional(),
23
23
  })
24
24
  .meta({ title: "ProjectFile" });
25
+ export const CustomAgentInfoSchema = z
26
+ .object({
27
+ name: z.string(),
28
+ description: z.string().optional(),
29
+ })
30
+ .meta({ title: "CustomAgentInfo" });
25
31
  export const CustomInstructionSchema = z
26
32
  .object({
27
33
  id: z.string(),
@@ -38,28 +44,31 @@ export const CustomInstructionSchema = z
38
44
  userInvocable: z.boolean().optional(),
39
45
  /**
40
46
  * Where this instruction was discovered. Drives precedence on name
41
- * collision: `project` > `user` > `plugin`. Set by the discovery loader,
42
- * not by the parsed file itself.
47
+ * collision: `project` > `user` > `plugin` > `builtin`. Set by the
48
+ * discovery loader, not by the parsed file itself. `builtin` marks
49
+ * product-level skills shipped with dev-tools.
43
50
  */
44
- scope: z.enum(["project", "user", "plugin"]).optional(),
51
+ scope: z.enum(["project", "user", "plugin", "builtin"]).optional(),
45
52
  /**
46
53
  * Name of the plugin that contributed this instruction, if any. Set by
47
54
  * the plugin loader (Phase 2); always `undefined` for project-level and
48
55
  * user-level standalone files (Phase 1).
49
56
  */
50
57
  pluginName: z.string().optional(),
58
+ /**
59
+ * Subagents owned by this skill (name + description only). When the skill
60
+ * is invoked, the service registers these into the available agents so the
61
+ * model can spawn them within the same request's agent loop. The CLI holds
62
+ * the full agent definitions; only the metadata travels here. Used by
63
+ * built-in skills (e.g. `code-review`).
64
+ */
65
+ ownedAgents: z.array(CustomAgentInfoSchema).optional(),
51
66
  })
52
67
  .meta({ title: "CustomInstruction" });
53
68
  /** Reasoning effort level for LLM completions. */
54
69
  export const ReasoningEffortSchema = z
55
70
  .enum(["auto", "none", "minimal", "low", "medium", "high", "xhigh", "max"])
56
71
  .meta({ title: "ReasoningEffort" });
57
- export const CustomAgentInfoSchema = z
58
- .object({
59
- name: z.string(),
60
- description: z.string().optional(),
61
- })
62
- .meta({ title: "CustomAgentInfo" });
63
72
  /** Per-agent model overrides. String = fixed model, string[] = round-robin. */
64
73
  export const AgentModelOverridesSchema = z
65
74
  .record(z.string(), z.union([z.string(), z.array(z.string())]))
@@ -1329,6 +1338,36 @@ export const SubmitPRReviewToolInputSchema = z
1329
1338
  verdict: ReviewVerdictSchema.optional(),
1330
1339
  })
1331
1340
  .meta({ title: "SubmitPRReviewToolInput" });
1341
+ /**
1342
+ * AddComment - a generic, UI-only tool for attaching a typed comment to the
1343
+ * session. It never posts anywhere external; the service only validates the
1344
+ * call and the dev-tools CLI emits a `comment-added` step from the tool input
1345
+ * so the UI can render it. The `type` discriminates how the UI renders the
1346
+ * comment (e.g. `"code-review"`), and `metadata` carries type-specific fields.
1347
+ *
1348
+ * Example (code-review skill):
1349
+ * addComment({
1350
+ * type: "code-review",
1351
+ * content: "Unawaited async call will fail in serverless",
1352
+ * metadata: { filePath: "src/x.ts", startLine: 264, endLine: 264, severity: "high" }
1353
+ * })
1354
+ */
1355
+ export const AddCommentToolInputSchema = z
1356
+ .object({
1357
+ type: z.string().min(1).meta({
1358
+ description: "Comment category that drives how the UI renders it, e.g. 'code-review'",
1359
+ }),
1360
+ content: z.string().min(1).meta({
1361
+ description: "The comment body (plain text or markdown)",
1362
+ }),
1363
+ // `looseObject` (not `z.record`) so the JSON schema emits
1364
+ // `additionalProperties` rather than `propertyNames`, which OpenAI's strict
1365
+ // tool-schema mode rejects.
1366
+ metadata: z.looseObject({}).optional().meta({
1367
+ description: "Type-specific fields. For 'code-review': filePath (string), startLine (number), endLine (number, optional), severity ('high' | 'medium' | 'low'), and originalSnippet when available",
1368
+ }),
1369
+ })
1370
+ .meta({ title: "AddCommentToolInput" });
1332
1371
  export const ResolveQACommentsToolInputSchema = z
1333
1372
  .object({
1334
1373
  thread_node_ids: z.array(z.string()).meta({
@@ -1488,6 +1527,7 @@ export const CodeGenToolMapSchema = z.object({
1488
1527
  ReadMcpResource: ReadMcpResourceToolInputSchema,
1489
1528
  RecordFrame: RecordFrameToolInputSchema,
1490
1529
  SubmitPRReview: SubmitPRReviewToolInputSchema,
1530
+ AddComment: AddCommentToolInputSchema,
1491
1531
  ProposeConfig: ProposeConfigToolInputSchema,
1492
1532
  UpdateSetupValue: UpdateSetupValueToolInputSchema,
1493
1533
  Exit: ExitToolInputSchema,
package/src/events.d.ts CHANGED
@@ -1221,7 +1221,41 @@ export declare const ClientDevtoolsToolResultV1: {
1221
1221
  eventName: "client.devtools.tool.result";
1222
1222
  version: "1";
1223
1223
  };
1224
- export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | 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;
1224
+ export type ClientDevtoolsBuildCompletedV1 = FusionEventVariant<"client.devtools.build.completed", {
1225
+ deployId: string;
1226
+ projectId: string;
1227
+ }, {
1228
+ projectId: string;
1229
+ deployId: string;
1230
+ }, 1>;
1231
+ export declare const ClientDevtoolsBuildCompletedV1: {
1232
+ eventName: "client.devtools.build.completed";
1233
+ version: "1";
1234
+ };
1235
+ export type ClientDevtoolsBuildUploadedV1 = FusionEventVariant<"client.devtools.build.uploaded", {
1236
+ deployId: string;
1237
+ projectId: string;
1238
+ }, {
1239
+ projectId: string;
1240
+ deployId: string;
1241
+ }, 1>;
1242
+ export declare const ClientDevtoolsBuildUploadedV1: {
1243
+ eventName: "client.devtools.build.uploaded";
1244
+ version: "1";
1245
+ };
1246
+ export type ClientDevtoolsBuildFailedV1 = FusionEventVariant<"client.devtools.build.failed", {
1247
+ deployId: string;
1248
+ projectId: string;
1249
+ error: string;
1250
+ }, {
1251
+ projectId: string;
1252
+ deployId: string;
1253
+ }, 1>;
1254
+ export declare const ClientDevtoolsBuildFailedV1: {
1255
+ eventName: "client.devtools.build.failed";
1256
+ version: "1";
1257
+ };
1258
+ 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;
1225
1259
  export interface ModelPermissionRequiredEvent {
1226
1260
  type: "assistant.model.permission.required";
1227
1261
  data: {
package/src/events.js CHANGED
@@ -142,3 +142,15 @@ export const ClientDevtoolsToolResultV1 = {
142
142
  eventName: "client.devtools.tool.result",
143
143
  version: "1",
144
144
  };
145
+ export const ClientDevtoolsBuildCompletedV1 = {
146
+ eventName: "client.devtools.build.completed",
147
+ version: "1",
148
+ };
149
+ export const ClientDevtoolsBuildUploadedV1 = {
150
+ eventName: "client.devtools.build.uploaded",
151
+ version: "1",
152
+ };
153
+ export const ClientDevtoolsBuildFailedV1 = {
154
+ eventName: "client.devtools.build.failed",
155
+ version: "1",
156
+ };
package/src/projects.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { BuilderConfigHosting } from "./builder-config.js";
2
3
  import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
3
4
  import { type EnvironmentVariable, type SetupDependency } from "./common-schemas";
4
5
  import type { FileOverride, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap, GenerateCompletionStep, ReviewEffort } from "./codegen";
@@ -1294,8 +1295,11 @@ export declare const DeployStatusSchema: z.ZodEnum<{
1294
1295
  uploading: "uploading";
1295
1296
  }>;
1296
1297
  export type DeployStatus = z.infer<typeof DeployStatusSchema>;
1298
+ /** Deploy statuses that are terminal — never transitioned out of. */
1299
+ export declare const TERMINAL_DEPLOY_STATUSES: Set<"building" | "canceled" | "deploying" | "failed" | "live" | "queued" | "uploading">;
1297
1300
  export declare const ProjectHostingBuildConfigSchema: z.ZodObject<{
1298
1301
  buildCommand: z.ZodOptional<z.ZodString>;
1302
+ buildOutputDir: z.ZodOptional<z.ZodString>;
1299
1303
  nodeVersion: z.ZodOptional<z.ZodString>;
1300
1304
  }, z.core.$strip>;
1301
1305
  export type ProjectHostingBuildConfig = z.infer<typeof ProjectHostingBuildConfigSchema>;
@@ -1310,6 +1314,7 @@ export declare const ProjectHostingSchema: z.ZodObject<{
1310
1314
  url: z.ZodOptional<z.ZodString>;
1311
1315
  buildConfig: z.ZodOptional<z.ZodObject<{
1312
1316
  buildCommand: z.ZodOptional<z.ZodString>;
1317
+ buildOutputDir: z.ZodOptional<z.ZodString>;
1313
1318
  nodeVersion: z.ZodOptional<z.ZodString>;
1314
1319
  }, z.core.$strip>>;
1315
1320
  environment: z.ZodOptional<z.ZodObject<{
@@ -1353,6 +1358,7 @@ export declare const DeploySchema: z.ZodObject<{
1353
1358
  ownerId: z.ZodString;
1354
1359
  checkoutBranch: z.ZodOptional<z.ZodString>;
1355
1360
  deployBranchId: z.ZodOptional<z.ZodString>;
1361
+ deployBranchName: z.ZodOptional<z.ZodString>;
1356
1362
  devBranchId: z.ZodOptional<z.ZodString>;
1357
1363
  status: z.ZodEnum<{
1358
1364
  building: "building";
@@ -1445,4 +1451,142 @@ export declare const DeployArtifactManifestSchema: z.ZodObject<{
1445
1451
  functions: z.ZodRecord<z.ZodString, z.ZodString>;
1446
1452
  }, z.core.$strip>;
1447
1453
  export type DeployArtifactManifest = z.infer<typeof DeployArtifactManifestSchema>;
1454
+ /**
1455
+ * Per-deploy overrides passed from ai-services to the deploy pod's build-and-upload endpoint.
1456
+ */
1457
+ export declare const BuildConfigOverridesSchema: z.ZodObject<{
1458
+ buildCommand: z.ZodOptional<z.ZodString>;
1459
+ buildOutputDir: z.ZodOptional<z.ZodString>;
1460
+ nodeVersion: z.ZodOptional<z.ZodString>;
1461
+ environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1462
+ }, z.core.$strip>;
1463
+ export type BuildConfigOverrides = z.infer<typeof BuildConfigOverridesSchema>;
1464
+ /** Map a repo `builder.config.json` hosting block to deploy-pod overrides (build scope only). */
1465
+ export declare function builderConfigHostingToBuildOverrides(hosting: BuilderConfigHosting | undefined): BuildConfigOverrides;
1466
+ /**
1467
+ * Merge repo file config with Firestore/UI overrides. Firestore wins on key conflicts.
1468
+ */
1469
+ export declare function mergeBuildConfigOverrides(fromFile: BuildConfigOverrides, fromFirestore: BuildConfigOverrides | undefined): BuildConfigOverrides;
1470
+ /** True when merged hosting build config includes at least one build setting. */
1471
+ export declare function hasResolvableHostingBuildConfig(overrides?: BuildConfigOverrides): boolean;
1472
+ /**
1473
+ * Request body for `POST /_builder.io/api/build-and-upload` on the deploy pod.
1474
+ */
1475
+ export declare const BuildAndUploadRequestSchema: z.ZodObject<{
1476
+ projectId: z.ZodString;
1477
+ deployId: z.ZodString;
1478
+ gcsManifestUploadUrl: z.ZodString;
1479
+ gcsArtifactUploadUrl: z.ZodString;
1480
+ buildConfigOverrides: z.ZodOptional<z.ZodObject<{
1481
+ buildCommand: z.ZodOptional<z.ZodString>;
1482
+ buildOutputDir: z.ZodOptional<z.ZodString>;
1483
+ nodeVersion: z.ZodOptional<z.ZodString>;
1484
+ environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1485
+ }, z.core.$strip>>;
1486
+ }, z.core.$strip>;
1487
+ export type BuildAndUploadRequest = z.infer<typeof BuildAndUploadRequestSchema>;
1488
+ export declare const ReserveSlugRequestSchema: z.ZodObject<{
1489
+ projectId: z.ZodString;
1490
+ slug: z.ZodString;
1491
+ }, z.core.$strip>;
1492
+ export type ReserveSlugRequest = z.infer<typeof ReserveSlugRequestSchema>;
1493
+ export declare const ReserveSlugResponseSchema: z.ZodObject<{
1494
+ slug: z.ZodString;
1495
+ }, z.core.$strip>;
1496
+ export type ReserveSlugResponse = z.infer<typeof ReserveSlugResponseSchema>;
1497
+ export declare const DeployRequestSchema: z.ZodObject<{
1498
+ projectId: z.ZodString;
1499
+ checkoutBranch: z.ZodOptional<z.ZodString>;
1500
+ }, z.core.$strip>;
1501
+ export type DeployRequest = z.infer<typeof DeployRequestSchema>;
1502
+ export declare const DeployResponseSchema: z.ZodObject<{
1503
+ deployId: z.ZodString;
1504
+ status: z.ZodEnum<{
1505
+ building: "building";
1506
+ canceled: "canceled";
1507
+ deploying: "deploying";
1508
+ failed: "failed";
1509
+ live: "live";
1510
+ queued: "queued";
1511
+ uploading: "uploading";
1512
+ }>;
1513
+ }, z.core.$strip>;
1514
+ export type DeployResponse = z.infer<typeof DeployResponseSchema>;
1515
+ export declare const GetDeploysRequestSchema: z.ZodObject<{
1516
+ projectId: z.ZodString;
1517
+ deployId: z.ZodOptional<z.ZodString>;
1518
+ }, z.core.$strip>;
1519
+ export type GetDeploysRequest = z.infer<typeof GetDeploysRequestSchema>;
1520
+ export declare const GetDeploysResponseSchema: z.ZodObject<{
1521
+ deploys: z.ZodArray<z.ZodObject<{
1522
+ id: z.ZodString;
1523
+ status: z.ZodEnum<{
1524
+ building: "building";
1525
+ canceled: "canceled";
1526
+ deploying: "deploying";
1527
+ failed: "failed";
1528
+ live: "live";
1529
+ queued: "queued";
1530
+ uploading: "uploading";
1531
+ }>;
1532
+ url: z.ZodOptional<z.ZodString>;
1533
+ error: z.ZodOptional<z.ZodString>;
1534
+ createdAt: z.ZodNumber;
1535
+ completedAt: z.ZodOptional<z.ZodNumber>;
1536
+ }, z.core.$strip>>;
1537
+ }, z.core.$strip>;
1538
+ export type GetDeploysResponse = z.infer<typeof GetDeploysResponseSchema>;
1539
+ export declare const UpdateHostingRequestSchema: z.ZodObject<{
1540
+ projectId: z.ZodString;
1541
+ customDomain: z.ZodOptional<z.ZodString>;
1542
+ buildCommand: z.ZodOptional<z.ZodString>;
1543
+ autoDeploy: z.ZodOptional<z.ZodBoolean>;
1544
+ environment: z.ZodOptional<z.ZodObject<{
1545
+ build: z.ZodOptional<z.ZodArray<z.ZodObject<{
1546
+ key: z.ZodString;
1547
+ value: z.ZodString;
1548
+ isSecret: z.ZodBoolean;
1549
+ placeholder: z.ZodOptional<z.ZodBoolean>;
1550
+ explanation: z.ZodOptional<z.ZodString>;
1551
+ }, z.core.$strip>>>;
1552
+ prod: z.ZodOptional<z.ZodArray<z.ZodObject<{
1553
+ key: z.ZodString;
1554
+ value: z.ZodString;
1555
+ isSecret: z.ZodBoolean;
1556
+ placeholder: z.ZodOptional<z.ZodBoolean>;
1557
+ explanation: z.ZodOptional<z.ZodString>;
1558
+ }, z.core.$strip>>>;
1559
+ }, z.core.$strip>>;
1560
+ deleteEnvironmentVariableKeys: z.ZodOptional<z.ZodObject<{
1561
+ build: z.ZodOptional<z.ZodArray<z.ZodString>>;
1562
+ prod: z.ZodOptional<z.ZodArray<z.ZodString>>;
1563
+ }, z.core.$strip>>;
1564
+ }, z.core.$strip>;
1565
+ export type UpdateHostingRequest = z.infer<typeof UpdateHostingRequestSchema>;
1566
+ export declare const UpdateHostingResponseSchema: z.ZodObject<{
1567
+ slug: z.ZodOptional<z.ZodString>;
1568
+ customDomain: z.ZodOptional<z.ZodString>;
1569
+ buildConfig: z.ZodOptional<z.ZodObject<{
1570
+ buildCommand: z.ZodOptional<z.ZodString>;
1571
+ buildOutputDir: z.ZodOptional<z.ZodString>;
1572
+ nodeVersion: z.ZodOptional<z.ZodString>;
1573
+ }, z.core.$strip>>;
1574
+ environment: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1575
+ build: z.ZodOptional<z.ZodArray<z.ZodObject<{
1576
+ key: z.ZodString;
1577
+ value: z.ZodString;
1578
+ isSecret: z.ZodBoolean;
1579
+ placeholder: z.ZodOptional<z.ZodBoolean>;
1580
+ explanation: z.ZodOptional<z.ZodString>;
1581
+ }, z.core.$strip>>>;
1582
+ prod: z.ZodOptional<z.ZodArray<z.ZodObject<{
1583
+ key: z.ZodString;
1584
+ value: z.ZodString;
1585
+ isSecret: z.ZodBoolean;
1586
+ placeholder: z.ZodOptional<z.ZodBoolean>;
1587
+ explanation: z.ZodOptional<z.ZodString>;
1588
+ }, z.core.$strip>>>;
1589
+ }, z.core.$strip>>>;
1590
+ }, z.core.$strip>;
1591
+ export type UpdateHostingResponse = z.infer<typeof UpdateHostingResponseSchema>;
1448
1592
  export {};
package/src/projects.js CHANGED
@@ -200,8 +200,15 @@ export const DeployStatusSchema = z.enum([
200
200
  "failed",
201
201
  "canceled",
202
202
  ]);
203
+ /** Deploy statuses that are terminal — never transitioned out of. */
204
+ export const TERMINAL_DEPLOY_STATUSES = new Set([
205
+ "live",
206
+ "failed",
207
+ "canceled",
208
+ ]);
203
209
  export const ProjectHostingBuildConfigSchema = z.object({
204
210
  buildCommand: z.string().optional(),
211
+ buildOutputDir: z.string().optional(),
205
212
  nodeVersion: z.string().optional(),
206
213
  });
207
214
  /**
@@ -271,6 +278,9 @@ export const DeploySchema = z.object({
271
278
  deployBranchId: z.string().optional().meta({
272
279
  description: 'Fusion branch id of the ephemeral hidden deploy branch (`type: "deploy"`) that ran the build.',
273
280
  }),
281
+ deployBranchName: z.string().optional().meta({
282
+ description: 'Fusion branch name of the ephemeral hidden deploy branch (`type: "deploy"`) that ran the build.',
283
+ }),
274
284
  devBranchId: z.string().optional().meta({
275
285
  description: "Fusion dev branch's id (unset if we are deploying project default branch)",
276
286
  }),
@@ -357,3 +367,153 @@ export const DeployArtifactManifestSchema = z.object({
357
367
  description: "serverless function name → sha256 hash",
358
368
  }),
359
369
  });
370
+ /**
371
+ * Per-deploy overrides passed from ai-services to the deploy pod's build-and-upload endpoint.
372
+ */
373
+ export const BuildConfigOverridesSchema = z.object({
374
+ buildCommand: z.string().optional(),
375
+ buildOutputDir: z.string().optional(),
376
+ nodeVersion: z.string().optional(),
377
+ /**
378
+ * Flat key-value map for the deploy pod. Firestore/API layers store
379
+ * `EnvironmentVariable[]`; convert at the boundary before building overrides.
380
+ */
381
+ environment: z.record(z.string(), z.string()).optional(),
382
+ });
383
+ function trimOptionalString(value) {
384
+ if (value === undefined) {
385
+ return undefined;
386
+ }
387
+ const trimmed = value.trim();
388
+ return trimmed || undefined;
389
+ }
390
+ /** Pick a string override: Firestore wins when the key is present (including ""). */
391
+ function pickBuildConfigString(firestore, file) {
392
+ if (firestore !== undefined) {
393
+ return trimOptionalString(firestore);
394
+ }
395
+ return trimOptionalString(file);
396
+ }
397
+ /** Map a repo `builder.config.json` hosting block to deploy-pod overrides (build scope only). */
398
+ export function builderConfigHostingToBuildOverrides(hosting) {
399
+ var _a;
400
+ if (!hosting) {
401
+ return {};
402
+ }
403
+ const buildEnv = (_a = hosting.environment) === null || _a === void 0 ? void 0 : _a.build;
404
+ const buildCommand = trimOptionalString(hosting.buildCommand);
405
+ const buildOutputDir = trimOptionalString(hosting.buildOutputDir);
406
+ const nodeVersion = trimOptionalString(hosting.nodeVersion);
407
+ return {
408
+ ...(buildCommand ? { buildCommand } : {}),
409
+ ...(buildOutputDir ? { buildOutputDir } : {}),
410
+ ...(nodeVersion ? { nodeVersion } : {}),
411
+ ...(buildEnv && Object.keys(buildEnv).length > 0
412
+ ? { environment: buildEnv }
413
+ : {}),
414
+ };
415
+ }
416
+ /**
417
+ * Merge repo file config with Firestore/UI overrides. Firestore wins on key conflicts.
418
+ */
419
+ export function mergeBuildConfigOverrides(fromFile, fromFirestore) {
420
+ const firestore = fromFirestore !== null && fromFirestore !== void 0 ? fromFirestore : {};
421
+ const merged = {};
422
+ const buildCommand = pickBuildConfigString(firestore.buildCommand, fromFile.buildCommand);
423
+ if (buildCommand) {
424
+ merged.buildCommand = buildCommand;
425
+ }
426
+ const buildOutputDir = pickBuildConfigString(firestore.buildOutputDir, fromFile.buildOutputDir);
427
+ if (buildOutputDir) {
428
+ merged.buildOutputDir = buildOutputDir;
429
+ }
430
+ const nodeVersion = pickBuildConfigString(firestore.nodeVersion, fromFile.nodeVersion);
431
+ if (nodeVersion) {
432
+ merged.nodeVersion = nodeVersion;
433
+ }
434
+ const fileEnv = fromFile.environment;
435
+ const firestoreEnv = firestore.environment;
436
+ if (fileEnv !== undefined || firestoreEnv !== undefined) {
437
+ const environment = { ...fileEnv, ...firestoreEnv };
438
+ if (Object.keys(environment).length > 0) {
439
+ merged.environment = environment;
440
+ }
441
+ }
442
+ return merged;
443
+ }
444
+ /** True when merged hosting build config includes at least one build setting. */
445
+ export function hasResolvableHostingBuildConfig(overrides) {
446
+ var _a, _b, _c;
447
+ if (!overrides) {
448
+ return false;
449
+ }
450
+ if ((_a = overrides.buildCommand) === null || _a === void 0 ? void 0 : _a.trim()) {
451
+ return true;
452
+ }
453
+ if ((_b = overrides.buildOutputDir) === null || _b === void 0 ? void 0 : _b.trim()) {
454
+ return true;
455
+ }
456
+ if ((_c = overrides.nodeVersion) === null || _c === void 0 ? void 0 : _c.trim()) {
457
+ return true;
458
+ }
459
+ if (overrides.environment && Object.keys(overrides.environment).length > 0) {
460
+ return true;
461
+ }
462
+ return false;
463
+ }
464
+ /**
465
+ * Request body for `POST /_builder.io/api/build-and-upload` on the deploy pod.
466
+ */
467
+ export const BuildAndUploadRequestSchema = z.object({
468
+ projectId: z.string(),
469
+ deployId: z.string(),
470
+ gcsManifestUploadUrl: z.string().url(),
471
+ gcsArtifactUploadUrl: z.string().url(),
472
+ buildConfigOverrides: BuildConfigOverridesSchema.optional(),
473
+ });
474
+ export const ReserveSlugRequestSchema = z.object({
475
+ projectId: z.string(),
476
+ slug: z.string(),
477
+ });
478
+ export const ReserveSlugResponseSchema = z.object({
479
+ slug: z.string(),
480
+ });
481
+ export const DeployRequestSchema = z.object({
482
+ projectId: z.string(),
483
+ checkoutBranch: z.string().optional(),
484
+ });
485
+ export const DeployResponseSchema = z.object({
486
+ deployId: z.string(),
487
+ status: DeployStatusSchema,
488
+ });
489
+ export const GetDeploysRequestSchema = z.object({
490
+ projectId: z.string(),
491
+ deployId: z.string().optional(),
492
+ });
493
+ export const GetDeploysResponseSchema = z.object({
494
+ deploys: z.array(DeployListItemSchema),
495
+ });
496
+ export const UpdateHostingRequestSchema = z.object({
497
+ projectId: z.string(),
498
+ customDomain: z.string().optional(),
499
+ buildCommand: z.string().optional(),
500
+ autoDeploy: z.boolean().optional(),
501
+ environment: z
502
+ .object({
503
+ build: z.array(EnvironmentVariableSchema).optional(),
504
+ prod: z.array(EnvironmentVariableSchema).optional(),
505
+ })
506
+ .optional(),
507
+ deleteEnvironmentVariableKeys: z
508
+ .object({
509
+ build: z.array(z.string()).optional(),
510
+ prod: z.array(z.string()).optional(),
511
+ })
512
+ .optional(),
513
+ });
514
+ export const UpdateHostingResponseSchema = z.object({
515
+ slug: z.string().optional(),
516
+ customDomain: z.string().optional(),
517
+ buildConfig: ProjectHostingBuildConfigSchema.optional(),
518
+ environment: ProjectHostingSchema.shape.environment.optional(),
519
+ });