@builder.io/ai-utils 0.18.0 → 0.18.2

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/src/projects.d.ts CHANGED
@@ -1,13 +1,5 @@
1
- import type {
2
- FileOverride,
3
- EnvironmentVariable,
4
- LaunchServerState,
5
- LaunchServerStatus,
6
- BranchBackup,
7
- CommitMode,
8
- CustomInstruction,
9
- CustomAgentDefinition,
10
- } from "./codegen";
1
+ import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition } from "./codegen";
2
+ import type { FallbackTokensPrivate } from "./organization";
11
3
  /**
12
4
  * Temporary type for date fields during migration.
13
5
  * Handles both old (string) and new (number) formats.
@@ -20,291 +12,162 @@ export type InMigrationDate = string | number;
20
12
  */
21
13
  export type InMigrationDateNullable = InMigrationDate | null | undefined;
22
14
  export interface ConfigStatus {
23
- isReady: boolean;
24
- lastUpdated: string;
25
- [key: string]: unknown;
15
+ isReady: boolean;
16
+ lastUpdated: string;
17
+ [key: string]: unknown;
26
18
  }
27
19
  interface BaseMessage {
28
- timestamp: string;
20
+ timestamp: string;
29
21
  }
30
22
  export interface InitializingMessage extends BaseMessage {
31
- state: "initializing";
32
- message: string;
23
+ state: "initializing";
24
+ message: string;
33
25
  }
34
26
  export interface FetchingGithubTokenMessage extends BaseMessage {
35
- state: "fetchingGithubToken";
36
- message: string;
27
+ state: "fetchingGithubToken";
28
+ message: string;
37
29
  }
38
30
  export interface FetchingFusionKeyMessage extends BaseMessage {
39
- state: "fetchingFusionKey";
40
- message: string;
31
+ state: "fetchingFusionKey";
32
+ message: string;
41
33
  }
42
34
  export interface CheckingAppMessage extends BaseMessage {
43
- state: "checkingApp";
44
- message: string;
35
+ state: "checkingApp";
36
+ message: string;
45
37
  }
46
38
  export interface CleaningUpAppMessage extends BaseMessage {
47
- state: "cleaningUpApp";
48
- message: string;
39
+ state: "cleaningUpApp";
40
+ message: string;
49
41
  }
50
42
  export interface CreatingAppMessage extends BaseMessage {
51
- state: "creatingApp";
52
- message: string;
43
+ state: "creatingApp";
44
+ message: string;
53
45
  }
54
46
  export interface CheckingIPMessage extends BaseMessage {
55
- state: "checkingIP";
56
- message: string;
47
+ state: "checkingIP";
48
+ message: string;
57
49
  }
58
50
  export interface AllocatingIPMessage extends BaseMessage {
59
- state: "allocatingIP";
60
- message: string;
51
+ state: "allocatingIP";
52
+ message: string;
61
53
  }
62
54
  export interface CheckingMachineMessage extends BaseMessage {
63
- state: "checkingMachine";
64
- message: string;
55
+ state: "checkingMachine";
56
+ message: string;
65
57
  }
66
58
  export interface CheckingVolumeMessage extends BaseMessage {
67
- state: "checkingVolume";
68
- message: string;
59
+ state: "checkingVolume";
60
+ message: string;
69
61
  }
70
62
  export interface ForkingVolumeMessage extends BaseMessage {
71
- state: "forkingVolume";
72
- message: string;
63
+ state: "forkingVolume";
64
+ message: string;
73
65
  }
74
66
  export interface RetryingWithNewRegionMessage extends BaseMessage {
75
- state: "retryingWithNewRegion";
76
- message: string;
67
+ state: "retryingWithNewRegion";
68
+ message: string;
77
69
  }
78
70
  export interface WaitingBeforePollingMessage extends BaseMessage {
79
- state: "waitingBeforePolling";
80
- message: string;
71
+ state: "waitingBeforePolling";
72
+ message: string;
81
73
  }
82
74
  export interface PollingMachineStatusMessage extends BaseMessage {
83
- state: "pollingMachineStatus";
84
- message: string;
75
+ state: "pollingMachineStatus";
76
+ message: string;
85
77
  }
86
78
  export interface WarningStateMessage extends BaseMessage {
87
- state: "warning";
88
- message: string;
89
- errors?: string[];
79
+ state: "warning";
80
+ message: string;
81
+ errors?: string[];
90
82
  }
91
83
  export interface PingMessage extends BaseMessage {
92
- type: "ping";
84
+ type: "ping";
93
85
  }
94
86
  export interface PlainMessage extends BaseMessage {
95
- message: string;
87
+ message: string;
96
88
  }
97
89
  export interface DebugMessage extends BaseMessage {
98
- type: "debug";
99
- message: string;
100
- lockInfo?: any;
101
- error?: string;
90
+ type: "debug";
91
+ message: string;
92
+ lockInfo?: any;
93
+ error?: string;
102
94
  }
103
95
  export interface ErrorMessage extends BaseMessage {
104
- type: "error";
105
- error: string;
106
- details?: any;
107
- message?: string;
108
- code?: string;
96
+ type: "error";
97
+ error: string;
98
+ details?: any;
99
+ message?: string;
100
+ code?: string;
109
101
  }
110
102
  export interface InfoMessage extends BaseMessage {
111
- type: "info";
112
- message: string;
103
+ type: "info";
104
+ message: string;
113
105
  }
114
106
  export interface WarningMessage extends BaseMessage {
115
- type: "warning";
116
- message: string;
117
- errors?: string[];
107
+ type: "warning";
108
+ message: string;
109
+ errors?: string[];
118
110
  }
119
111
  export interface MachineStatusMessage extends BaseMessage {
120
- type: "machineStatus";
121
- status:
122
- | "unknown"
123
- | "created"
124
- | "starting"
125
- | "started"
126
- | "stopping"
127
- | "stopped"
128
- | "suspending"
129
- | "suspended"
130
- | "replacing"
131
- | "destroying"
132
- | "destroyed"
133
- | "not-found"
134
- | "running"
135
- | "failed";
112
+ type: "machineStatus";
113
+ status: "unknown" | "created" | "starting" | "started" | "stopping" | "stopped" | "suspending" | "suspended" | "replacing" | "destroying" | "destroyed" | "not-found" | "running" | "failed";
136
114
  }
137
115
  export interface LogsMessage extends BaseMessage {
138
- type: "logs";
139
- logs: string[];
116
+ type: "logs";
117
+ logs: string[];
140
118
  }
141
119
  export interface ConfigStatusMessage extends BaseMessage {
142
- type: "configStatus";
143
- configStatus: ConfigStatus;
120
+ type: "configStatus";
121
+ configStatus: ConfigStatus;
144
122
  }
145
123
  export interface AppCreatedMessage extends BaseMessage {
146
- state: "appCreated";
147
- message: string;
148
- appName: string;
124
+ state: "appCreated";
125
+ message: string;
126
+ appName: string;
149
127
  }
150
128
  export interface MachineCreatedMessage extends BaseMessage {
151
- state: "machineCreated";
152
- message: string;
153
- machineId: string;
129
+ state: "machineCreated";
130
+ message: string;
131
+ machineId: string;
154
132
  }
155
133
  export interface IpAllocatedMessage extends BaseMessage {
156
- state: "ipAllocated";
157
- message: string;
134
+ state: "ipAllocated";
135
+ message: string;
158
136
  }
159
137
  export interface VolumeForkedMessage extends BaseMessage {
160
- state: "volumeForked";
161
- message: string;
162
- volumeId: string;
138
+ state: "volumeForked";
139
+ message: string;
140
+ volumeId: string;
163
141
  }
164
142
  export interface ReadyMessage extends BaseMessage {
165
- state: "ready";
166
- message: string;
167
- url: string;
168
- status?: LaunchServerStatus;
169
- }
170
- export type MachineState =
171
- | "unknown"
172
- | "created"
173
- | "starting"
174
- | "started"
175
- | "stopping"
176
- | "stopped"
177
- | "suspending"
178
- | "suspended"
179
- | "replacing"
180
- | "destroying"
181
- | "destroyed"
182
- | "not-found"
183
- | "running"
184
- | "failed";
185
- export type FlyVolumeState =
186
- | "unknown"
187
- | "creating"
188
- | "created"
189
- | "extending"
190
- | "restoring"
191
- | "enabling_remote_export"
192
- | "hydrating"
193
- | "recovering"
194
- | "scheduling_destroy"
195
- | "pending_destroy"
196
- | "failed";
197
- export type GitAuthErrorCode =
198
- | "git-auth-failed"
199
- | "git-auth-failed-root-repo"
200
- | "git-auth-failed-folder-added-by"
201
- | "git-auth-failed-folder-created-by"
202
- | "git-auth-failed-repo-not-found"
203
- | "git-auth-failed-repo-renamed"
204
- | "git-auth-failed-folder-server-token"
205
- | "git-auth-failed-root-repo-server-token"
206
- | "git-auth-failed-ghes-unreachable";
207
- export type EnsureContainerErrorCode =
208
- | "FAILED_TO_START_MACHINE_ERROR"
209
- | "FLY_APP_CHECK_ERROR"
210
- | "FLY_CAPACITY_ERROR"
211
- | "FLY_PERMISSIONS_TOKEN_ERROR"
212
- | "FLY_VOLUME_CREATE_ERROR"
213
- | "FLY_VOLUME_FORK_ERROR"
214
- | "FLY_VOLUME_DELETE_RECENTLY_FORKED_ERROR"
215
- | "FLY_MACHINE_CREATE_ERROR"
216
- | "FLY_VOLUME_CHECK_ERROR"
217
- | "FLY_NON_MOUNTABLE_VOLUME_ERROR"
218
- | "FLY_DEPRECATED_REGION_ERROR"
219
- | "FLY_VOLUME_NOT_FOUND"
220
- | "FLY_MACHINE_LIMIT_ERROR"
221
- | "KUBE_CAPACITY_ERROR"
222
- | "KUBE_PERMISSIONS_ERROR"
223
- | "KUBE_POD_LIMIT_ERROR"
224
- | "KUBE_RESOURCE_QUOTA_ERROR"
225
- | "KUBE_NAMESPACE_CHECK_ERROR"
226
- | "KUBE_PVC_CREATE_ERROR"
227
- | "KUBE_PVC_CHECK_ERROR"
228
- | "KUBE_POD_CREATE_ERROR"
229
- | "KUBE_SERVICE_CREATE_ERROR"
230
- | "KUBE_INGRESS_CREATE_ERROR"
231
- | "KUBE_POD_FAILED_TO_START_ERROR"
232
- | "ensure-checking-existing-machines"
233
- | "found-multiple-failed-machine"
234
- | "maximun-retries-machine-creation"
235
- | GitAuthErrorCode
236
- | "unknown"
237
- | "project-bad-state"
238
- | "project-not-found"
239
- | "project-deleted"
240
- | "project-branch-not-found"
241
- | "project-branch-deleted"
242
- | "project-branch-no-session-id"
243
- | "project-repo-full-name-not-found"
244
- | "project-org-not-found"
245
- | "invalid-project-repo-url-already-in-use"
246
- | "no-available-regions"
247
- | "invalid-backup-without-volume-id"
248
- | "missing-app-with-machine-or-volume"
249
- | "update-branch-info-in-firebase"
250
- | "update-branch-app-name-in-firebase"
251
- | `machine-status-polling-${MachineState}`
252
- | `machine-image-exited-immediately`
253
- | `volume-not-found-${FlyVolumeState}`
254
- | "trying-to-remove-used-volume"
255
- | "missing-container-url"
256
- | "timeout"
257
- | "fatal:zod-validation-error"
258
- | `fatal:${string}`;
143
+ state: "ready";
144
+ message: string;
145
+ url: string;
146
+ status?: LaunchServerStatus;
147
+ }
148
+ export type MachineState = "unknown" | "created" | "starting" | "started" | "stopping" | "stopped" | "suspending" | "suspended" | "replacing" | "destroying" | "destroyed" | "not-found" | "running" | "failed";
149
+ export type FlyVolumeState = "unknown" | "creating" | "created" | "extending" | "restoring" | "enabling_remote_export" | "hydrating" | "recovering" | "scheduling_destroy" | "pending_destroy" | "failed";
150
+ export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" | "git-auth-failed-folder-added-by" | "git-auth-failed-folder-created-by" | "git-auth-failed-repo-not-found" | "git-auth-failed-repo-renamed" | "git-auth-failed-folder-server-token" | "git-auth-failed-root-repo-server-token" | "git-auth-failed-ghes-unreachable";
151
+ export type EnsureContainerErrorCode = "FAILED_TO_START_MACHINE_ERROR" | "FLY_APP_CHECK_ERROR" | "FLY_CAPACITY_ERROR" | "FLY_PERMISSIONS_TOKEN_ERROR" | "FLY_VOLUME_CREATE_ERROR" | "FLY_VOLUME_FORK_ERROR" | "FLY_VOLUME_DELETE_RECENTLY_FORKED_ERROR" | "FLY_MACHINE_CREATE_ERROR" | "FLY_VOLUME_CHECK_ERROR" | "FLY_NON_MOUNTABLE_VOLUME_ERROR" | "FLY_DEPRECATED_REGION_ERROR" | "FLY_VOLUME_NOT_FOUND" | "FLY_MACHINE_LIMIT_ERROR" | "KUBE_CAPACITY_ERROR" | "KUBE_PERMISSIONS_ERROR" | "KUBE_POD_LIMIT_ERROR" | "KUBE_RESOURCE_QUOTA_ERROR" | "KUBE_NAMESPACE_CHECK_ERROR" | "KUBE_PVC_CREATE_ERROR" | "KUBE_PVC_CHECK_ERROR" | "KUBE_POD_CREATE_ERROR" | "KUBE_SERVICE_CREATE_ERROR" | "KUBE_INGRESS_CREATE_ERROR" | "KUBE_POD_FAILED_TO_START_ERROR" | "ensure-checking-existing-machines" | "found-multiple-failed-machine" | "maximun-retries-machine-creation" | GitAuthErrorCode | "unknown" | "project-bad-state" | "project-not-found" | "project-deleted" | "project-branch-not-found" | "project-branch-deleted" | "project-branch-no-session-id" | "project-repo-full-name-not-found" | "project-org-not-found" | "invalid-project-repo-url-already-in-use" | "no-available-regions" | "invalid-backup-without-volume-id" | "missing-app-with-machine-or-volume" | "update-branch-info-in-firebase" | "update-branch-app-name-in-firebase" | `machine-status-polling-${MachineState}` | `machine-image-exited-immediately` | `volume-not-found-${FlyVolumeState}` | "trying-to-remove-used-volume" | "missing-container-url" | "timeout" | "fatal:zod-validation-error" | `fatal:${string}`;
259
152
  export interface ErrorStateMessage extends BaseMessage {
260
- state: "error";
261
- message: string;
262
- error: string;
263
- code: EnsureContainerErrorCode;
264
- causeError: string;
153
+ state: "error";
154
+ message: string;
155
+ error: string;
156
+ code: EnsureContainerErrorCode;
157
+ causeError: string;
265
158
  }
266
159
  export interface CleanupCompletedMessage extends BaseMessage {
267
- state: "cleanupCompleted";
268
- message: string;
160
+ state: "cleanupCompleted";
161
+ message: string;
269
162
  }
270
163
  /**
271
164
  * Messages sent by the container orchestrator.
272
165
  */
273
- export type ProjectsChunkMessage =
274
- | InitializingMessage
275
- | FetchingGithubTokenMessage
276
- | FetchingFusionKeyMessage
277
- | CheckingAppMessage
278
- | CleaningUpAppMessage
279
- | CreatingAppMessage
280
- | CheckingIPMessage
281
- | AllocatingIPMessage
282
- | CheckingMachineMessage
283
- | CheckingVolumeMessage
284
- | ForkingVolumeMessage
285
- | RetryingWithNewRegionMessage
286
- | WaitingBeforePollingMessage
287
- | PollingMachineStatusMessage
288
- | WarningStateMessage
289
- | PingMessage
290
- | DebugMessage
291
- | ErrorMessage
292
- | InfoMessage
293
- | WarningMessage
294
- | MachineStatusMessage
295
- | LogsMessage
296
- | ConfigStatusMessage
297
- | AppCreatedMessage
298
- | MachineCreatedMessage
299
- | IpAllocatedMessage
300
- | VolumeForkedMessage
301
- | ReadyMessage
302
- | ErrorStateMessage
303
- | CleanupCompletedMessage;
166
+ export type ProjectsChunkMessage = InitializingMessage | FetchingGithubTokenMessage | FetchingFusionKeyMessage | CheckingAppMessage | CleaningUpAppMessage | CreatingAppMessage | CheckingIPMessage | AllocatingIPMessage | CheckingMachineMessage | CheckingVolumeMessage | ForkingVolumeMessage | RetryingWithNewRegionMessage | WaitingBeforePollingMessage | PollingMachineStatusMessage | WarningStateMessage | PingMessage | DebugMessage | ErrorMessage | InfoMessage | WarningMessage | MachineStatusMessage | LogsMessage | ConfigStatusMessage | AppCreatedMessage | MachineCreatedMessage | IpAllocatedMessage | VolumeForkedMessage | ReadyMessage | ErrorStateMessage | CleanupCompletedMessage;
304
167
  export interface GitConfig {
305
- url: string;
306
- provider: "github" | "bitbucket" | "gitlab" | "azure" | "unknown";
307
- token: string | undefined;
168
+ url: string;
169
+ provider: "github" | "bitbucket" | "gitlab" | "azure" | "unknown";
170
+ token: string | undefined;
308
171
  }
309
172
  export type GitConfigs = Record<string, GitConfig>;
310
173
  export declare const EXAMPLE_REPOS: string[];
@@ -312,248 +175,245 @@ export declare const STARTER_REPO = "BuilderIO/fusion-starter";
312
175
  export declare const EXAMPLE_OR_STARTER_REPOS: string[];
313
176
  export declare const EXAMPLE_OR_STARTER_REPOS_URLS: string[];
314
177
  export interface GitBackupUploadUrlResult {
315
- signedUrl: string;
316
- filePath: string;
317
- expiresAt: string;
178
+ signedUrl: string;
179
+ filePath: string;
180
+ expiresAt: string;
318
181
  }
319
182
  export interface GitBackupUploadUrlOptions {
320
- projectId: string;
321
- branchName: string;
322
- size: number;
323
- partial: boolean;
324
- contentMd5: string;
183
+ projectId: string;
184
+ branchName: string;
185
+ size: number;
186
+ partial: boolean;
187
+ contentMd5: string;
325
188
  }
326
189
  export interface GitBackupDownloadUrlOptions {
327
- spaceId: string;
328
- projectId: string;
329
- branchName: string;
330
- partial: boolean;
190
+ spaceId: string;
191
+ projectId: string;
192
+ branchName: string;
193
+ partial: boolean;
331
194
  }
332
195
  export type ForcedBackup = "offline-full" | "offline" | undefined;
333
196
  export interface GitBackupRecordOptions {
334
- projectId: string;
335
- branchName: string;
336
- size: number;
337
- gitBranchName: string;
338
- initialBranch: string;
339
- initialCommitHash: string | undefined;
340
- lastCommitHash: string;
341
- partial: boolean;
342
- empty: boolean;
343
- status: "completed";
344
- contentMd5?: string;
345
- repoUrl: string;
346
- version: "v1" | "v2";
347
- forced: ForcedBackup;
348
- metadata?: Record<string, string | string[] | undefined>;
197
+ projectId: string;
198
+ branchName: string;
199
+ size: number;
200
+ gitBranchName: string;
201
+ initialBranch: string;
202
+ initialCommitHash: string | undefined;
203
+ lastCommitHash: string;
204
+ partial: boolean;
205
+ empty: boolean;
206
+ status: "completed";
207
+ contentMd5?: string;
208
+ repoUrl: string;
209
+ version: "v1" | "v2";
210
+ forced: ForcedBackup;
211
+ metadata?: Record<string, string | string[] | undefined>;
349
212
  }
350
213
  export interface GitBackupRecordResult {
351
- success: boolean;
214
+ success: boolean;
352
215
  }
353
216
  export interface CodegenSetLastCommit {
354
- projectId: string;
355
- branchName: string;
356
- lastCommitHash: string;
357
- clearSecondaryVolumeId: boolean;
217
+ projectId: string;
218
+ branchName: string;
219
+ lastCommitHash: string;
220
+ clearSecondaryVolumeId: boolean;
358
221
  }
359
222
  export interface CodegenRuntimeStatus {
360
- projectId: string;
361
- branchName: string;
362
- lastCommitHash?: string;
363
- clearSecondaryVolumeId?: boolean;
364
- lastServerState?: LaunchServerState;
365
- lastServerVersion?: string;
223
+ projectId: string;
224
+ branchName: string;
225
+ lastCommitHash?: string;
226
+ clearSecondaryVolumeId?: boolean;
227
+ lastServerState?: LaunchServerState;
228
+ lastServerVersion?: string;
366
229
  }
367
230
  export interface BackupGitRepoResultValid {
368
- success: true;
369
- partial: boolean;
370
- repoUrl: string;
371
- empty: boolean;
372
- lastCommitHash: string;
373
- backupRef: string | undefined;
231
+ success: true;
232
+ partial: boolean;
233
+ repoUrl: string;
234
+ empty: boolean;
235
+ lastCommitHash: string;
236
+ backupRef: string | undefined;
374
237
  }
375
238
  export interface BackupGitRepoResultInvalid {
376
- success: false;
377
- reason: "project_removed";
378
- }
379
- export type BackupGitRepoResult =
380
- | BackupGitRepoResultValid
381
- | BackupGitRepoResultInvalid;
382
- export type ShutdownResponse =
383
- | {
384
- success: true;
385
- message: string;
386
- skipped: boolean;
387
- reason: string;
388
- }
389
- | {
390
- success: false;
391
- message?: string;
392
- skipped?: boolean;
393
- reason?: string;
394
- error?: Error;
395
- }
396
- | BackupGitRepoResult;
239
+ success: false;
240
+ reason: "project_removed";
241
+ }
242
+ export type BackupGitRepoResult = BackupGitRepoResultValid | BackupGitRepoResultInvalid;
243
+ export type ShutdownResponse = {
244
+ success: true;
245
+ message: string;
246
+ skipped: boolean;
247
+ reason: string;
248
+ } | {
249
+ success: false;
250
+ message?: string;
251
+ skipped?: boolean;
252
+ reason?: string;
253
+ error?: Error;
254
+ } | BackupGitRepoResult;
397
255
  export type ShutdownResponseSerialized = Omit<ShutdownResponse, "error"> & {
398
- error?: string;
256
+ error?: string;
399
257
  };
400
258
  export type SetupDependency = SetupMiseDependency | SetupScriptDependency;
401
259
  export interface SetupMiseDependency {
402
- key: string;
403
- type: "mise";
404
- tool: string;
405
- version?: string;
260
+ key: string;
261
+ type: "mise";
262
+ tool: string;
263
+ version?: string;
406
264
  }
407
265
  export interface SetupScriptDependency {
408
- key: string;
409
- type: "script";
410
- name: string;
411
- script: string;
412
- }
413
- export type FusionExecutionEnvironment =
414
- | "containerized"
415
- | "container-less"
416
- | "cloud"
417
- | "cloud-v2";
266
+ key: string;
267
+ type: "script";
268
+ name: string;
269
+ script: string;
270
+ }
271
+ export type FusionExecutionEnvironment = "containerized" | "container-less" | "cloud" | "cloud-v2";
418
272
  export interface PartialBranchData {
419
- name?: string;
420
- createdBy: string;
421
- friendlyName: string;
422
- isDefault: boolean;
423
- isPublic: boolean;
424
- lockedFusionEnvironment?: FusionExecutionEnvironment;
425
- metadata?: BranchMetadata;
426
- backup?: BranchBackup;
427
- gitAiBranch?: string | null;
428
- lastCommitHash?: string | null;
429
- lastCommitDate?: number | null;
430
- commitMode?: CommitMode;
431
- useHomeDir?: boolean;
432
- checkoutBranch?: string | null;
433
- /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
434
- isFork?: boolean | null;
435
- cloneFrom?: {
436
- projectId: string;
437
- branchName: string;
438
- };
273
+ name?: string;
274
+ createdBy: string;
275
+ friendlyName: string;
276
+ isDefault: boolean;
277
+ isPublic: boolean;
278
+ lockedFusionEnvironment?: FusionExecutionEnvironment;
279
+ metadata?: BranchMetadata;
280
+ backup?: BranchBackup;
281
+ gitAiBranch?: string | null;
282
+ lastCommitHash?: string | null;
283
+ lastCommitDate?: number | null;
284
+ commitMode?: CommitMode;
285
+ useHomeDir?: boolean;
286
+ checkoutBranch?: string | null;
287
+ /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
288
+ isFork?: boolean | null;
289
+ cloneFrom?: {
290
+ projectId: string;
291
+ branchName: string;
292
+ };
439
293
  }
440
294
  export type EntityState = "active" | "deleted" | "archived";
295
+ /**
296
+ * PR information for a single repository
297
+ */
298
+ export interface PrInfo {
299
+ prNumber: number;
300
+ prUrl: string;
301
+ }
441
302
  /**
442
303
  * Metadata stored in branches for integration tracking and PR description generation.
443
304
  * This type documents the integration context that can be attached to a branch.
444
305
  */
445
306
  export interface BranchMetadata {
446
- /** How the branch was created (e.g., "slack", "jira", "api", "cli") */
447
- createdVia?: string;
448
- /** JIRA issue key (e.g., "PROJ-123") - used to link back to the JIRA ticket in PR descriptions */
449
- jiraIssueKey?: string;
450
- /** JIRA cloud ID - UUID identifier for the Atlassian cloud instance */
451
- jiraCloudId?: string;
452
- /** JIRA site name - the subdomain used in the JIRA URL (e.g., "mycompany" for mycompany.atlassian.net) */
453
- jiraSiteName?: string;
454
- /** JIRA issue ID - internal JIRA identifier */
455
- jiraIssueId?: string;
456
- /** Slack team/workspace ID - used to ensure deep links open in the correct workspace for multi-workspace users */
457
- slackTeamId?: string;
458
- /** Slack channel ID - used to link back to the Slack thread in PR descriptions */
459
- slackChannelId?: string;
460
- /** Slack thread timestamp - used to construct the Slack thread URL */
461
- slackThreadTs?: string;
462
- [key: string]: unknown;
307
+ /** How the branch was created (e.g., "slack", "jira", "api", "cli") */
308
+ createdVia?: string;
309
+ /** JIRA issue key (e.g., "PROJ-123") - used to link back to the JIRA ticket in PR descriptions */
310
+ jiraIssueKey?: string;
311
+ /** JIRA cloud ID - UUID identifier for the Atlassian cloud instance */
312
+ jiraCloudId?: string;
313
+ /** JIRA site name - the subdomain used in the JIRA URL (e.g., "mycompany" for mycompany.atlassian.net) */
314
+ jiraSiteName?: string;
315
+ /** JIRA issue ID - internal JIRA identifier */
316
+ jiraIssueId?: string;
317
+ /** Slack team/workspace ID - used to ensure deep links open in the correct workspace for multi-workspace users */
318
+ slackTeamId?: string;
319
+ /** Slack channel ID - used to link back to the Slack thread in PR descriptions */
320
+ slackChannelId?: string;
321
+ /** Slack thread timestamp - used to construct the Slack thread URL */
322
+ slackThreadTs?: string;
323
+ [key: string]: unknown;
463
324
  }
464
325
  export type PRStatus = "open" | "closed" | "merged" | "draft" | "approved";
465
326
  interface BranchSharedData {
466
- appName?: string | null;
467
- prNumber?: number | null;
468
- prUrl?: string | null;
469
- prStatus?: PRStatus;
470
- machineId?: string | null;
471
- lastMachineIdRemovedAt?: number | null;
472
- volumeId?: string | null;
473
- secondaryVolumeId?: string | null;
474
- volumeName?: string | null;
475
- gitAiBranch?: string | null;
476
- lastCommitHash?: string | null;
477
- lastCommitDate?: number | null;
478
- lastServerState?: LaunchServerState | null;
479
- lastServerStateDate?: number | null;
480
- lastServerVersion?: string | null;
481
- name?: string;
482
- agentType?: string | null;
483
- createdBy?: string;
484
- isPublic?: boolean;
485
- isDefault?: boolean;
486
- friendlyName?: string;
487
- useHomeDir?: boolean;
488
- useCloudHomeDir?: boolean;
489
- ipv4?: {
490
- address: string | null;
491
- allocated: boolean | null;
492
- } | null;
493
- ipv6?: {
494
- address: string | null;
495
- allocated: boolean | null;
496
- } | null;
497
- backup?: BranchBackup;
498
- metadata?: BranchMetadata;
499
- needsCleanup?: boolean;
500
- /** @deprecated Use `state` field instead. Kept for backwards compatibility. */
501
- deleted?: boolean;
502
- /** MIGRATION: accepts both string and number during migration period */
503
- deletedAt?: InMigrationDateNullable;
504
- deletedBy?: string;
505
- kubePodName?: string | null;
506
- kubeNamespace?: string | null;
507
- kubePvcName?: string | null;
508
- kubeHostname?: string | null;
509
- checkoutBranch?: string | null;
510
- /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
511
- isFork?: boolean | null;
512
- vscodeTunnelUrl?: string | null;
513
- vscodeTunnelName?: string | null;
514
- vscodeTunnelExpiresAt?: string | null;
515
- commitMode?: CommitMode;
516
- /** Timestamp when an AI agent started activity on this branch, null when inactive (in milliseconds since epoch) */
517
- lastAgentActivityAt?: number | null;
518
- /** Timestamp of last activity on this branch - includes both agent and user activity (in milliseconds since epoch) */
519
- lastActivityAt?: number;
327
+ appName?: string | null;
328
+ prNumber?: number | null;
329
+ prUrl?: string | null;
330
+ prInfoByFolder?: Record<string, PrInfo> | null;
331
+ prStatus?: PRStatus;
332
+ machineId?: string | null;
333
+ lastMachineIdRemovedAt?: number | null;
334
+ volumeId?: string | null;
335
+ secondaryVolumeId?: string | null;
336
+ volumeName?: string | null;
337
+ gitAiBranch?: string | null;
338
+ lastCommitHash?: string | null;
339
+ lastCommitDate?: number | null;
340
+ lastServerState?: LaunchServerState | null;
341
+ lastServerStateDate?: number | null;
342
+ lastServerVersion?: string | null;
343
+ name?: string;
344
+ agentType?: string | null;
345
+ createdBy?: string;
346
+ isPublic?: boolean;
347
+ isDefault?: boolean;
348
+ friendlyName?: string;
349
+ useHomeDir?: boolean;
350
+ useCloudHomeDir?: boolean;
351
+ ipv4?: {
352
+ address: string | null;
353
+ allocated: boolean | null;
354
+ } | null;
355
+ ipv6?: {
356
+ address: string | null;
357
+ allocated: boolean | null;
358
+ } | null;
359
+ backup?: BranchBackup;
360
+ metadata?: BranchMetadata;
361
+ needsCleanup?: boolean;
362
+ /** @deprecated Use `state` field instead. Kept for backwards compatibility. */
363
+ deleted?: boolean;
364
+ /** MIGRATION: accepts both string and number during migration period */
365
+ deletedAt?: InMigrationDateNullable;
366
+ deletedBy?: string;
367
+ kubePodName?: string | null;
368
+ kubeNamespace?: string | null;
369
+ kubePvcName?: string | null;
370
+ kubeHostname?: string | null;
371
+ checkoutBranch?: string | null;
372
+ /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
373
+ isFork?: boolean | null;
374
+ vscodeTunnelUrl?: string | null;
375
+ vscodeTunnelName?: string | null;
376
+ vscodeTunnelExpiresAt?: string | null;
377
+ commitMode?: CommitMode;
378
+ /** Timestamp when an AI agent started activity on this branch, null when inactive (in milliseconds since epoch) */
379
+ lastAgentActivityAt?: number | null;
380
+ /** Timestamp of last activity on this branch - includes both agent and user activity (in milliseconds since epoch) */
381
+ lastActivityAt?: number;
520
382
  }
521
383
  /**
522
384
  * fields that are required in the new branch format, but optional in the legacy branch format.
523
385
  */
524
386
  interface RequiredBranchSharedData {
525
- /** The state of the branch. Use `isBranchDeleted()` helper for backwards-compatible checks. */
526
- state: EntityState;
527
- lockedFusionEnvironment: FusionExecutionEnvironment;
528
- id: string;
529
- sessionId: string;
530
- /** MIGRATION: accepts both string and number during migration period */
531
- createdAt: InMigrationDate;
532
- /** MIGRATION: accepts both string and number during migration period */
533
- updatedAt: InMigrationDate;
534
- lastUpdatedAt: number;
387
+ /** The state of the branch. Use `isBranchDeleted()` helper for backwards-compatible checks. */
388
+ state: EntityState;
389
+ lockedFusionEnvironment: FusionExecutionEnvironment;
390
+ id: string;
391
+ sessionId: string;
392
+ /** MIGRATION: accepts both string and number during migration period */
393
+ createdAt: InMigrationDate;
394
+ /** MIGRATION: accepts both string and number during migration period */
395
+ updatedAt: InMigrationDate;
396
+ lastUpdatedAt: number;
535
397
  }
536
398
  /**
537
399
  * LegacyBranch represents branch data as stored in the nested project.branches field.
538
400
  * This type does NOT include projectId or legacyId as those don't exist in the legacy format.
539
401
  */
540
- export interface LegacyBranch
541
- extends BranchSharedData,
542
- Partial<RequiredBranchSharedData> {
543
- preRecoveryData?: Partial<LegacyBranch> & {
544
- recoveryDate: Date;
545
- };
402
+ export interface LegacyBranch extends BranchSharedData, Partial<RequiredBranchSharedData> {
403
+ preRecoveryData?: Partial<LegacyBranch> & {
404
+ recoveryDate: Date;
405
+ };
546
406
  }
547
407
  /**
548
408
  * NewBranch represents branch data as stored in the standalone branches collection.
549
409
  * Extends LegacyBranch with required projectId, name, and optional legacyId fields.
550
410
  */
551
411
  export interface NewBranch extends BranchSharedData, RequiredBranchSharedData {
552
- ownerId: string;
553
- projectId: string;
554
- name: string;
555
- /** Legacy ID for mapping to project.branches[branchName] format: ${projectId}-${branchName} */
556
- legacyId: string;
412
+ ownerId: string;
413
+ projectId: string;
414
+ name: string;
415
+ /** Legacy ID for mapping to project.branches[branchName] format: ${projectId}-${branchName} */
416
+ legacyId: string;
557
417
  }
558
418
  /**
559
419
  * Branch is a union type that can represent either a legacy branch or a new branch.
@@ -564,140 +424,141 @@ export declare const checkIsNewBranch: (branch: Branch) => branch is NewBranch;
564
424
  export type CpuKind = "performance" | "standard" | "shared";
565
425
  export type MachineAutoStop = "stop" | "off" | "suspend";
566
426
  export interface ProjectRolePermissions {
567
- view?: boolean;
568
- editCode?: boolean;
569
- sendPullRequests?: boolean;
570
- createBranches?: boolean;
571
- modifyMcpServers?: boolean;
572
- modifyWorkflowIntegrations?: boolean;
573
- modifyProjectSettings?: boolean;
427
+ view?: boolean;
428
+ editCode?: boolean;
429
+ sendPullRequests?: boolean;
430
+ createBranches?: boolean;
431
+ modifyMcpServers?: boolean;
432
+ modifyWorkflowIntegrations?: boolean;
433
+ modifyProjectSettings?: boolean;
574
434
  }
575
435
  export interface ProjectAccessControl {
576
- roles: Record<string, ProjectRolePermissions | null>;
577
- users: Record<string, ProjectRolePermissions>;
436
+ roles: Record<string, ProjectRolePermissions | null>;
437
+ users: Record<string, ProjectRolePermissions>;
578
438
  }
579
439
  export interface Project {
580
- id: string;
581
- name: string;
582
- ownerId: string;
583
- repoFullName: string | undefined;
584
- repoProvider: string;
585
- repoProtocol: string | undefined;
586
- repoDescription?: string;
587
- repoPrivate: boolean;
588
- repoUrl: string | undefined;
589
- /** MIGRATION: accepts both string and number during migration period */
590
- createdDate: InMigrationDate;
591
- /** MIGRATION: accepts both string and number during migration period */
592
- updatedAt: InMigrationDate;
593
- pinned?: boolean;
594
- archived?: boolean;
595
- createdBy: string;
596
- checkRunCounts?: Record<string, number>;
597
- repoAddedBy?: string;
598
- pipelineCounts?: Record<string, number>;
599
- needSetup?: boolean;
600
- projectType?: "app" | "repo-indexing";
601
- domains?: string[];
602
- accessMode?: "public" | "private";
603
- projectAccess?: ProjectAccessControl;
604
- settings: {
605
- isNativeApp?: boolean;
606
- autoDetectDevServer?: boolean;
607
- autoDetectDevServerPatterns?: string[];
608
- fusionEnvironment?: FusionExecutionEnvironment;
609
- devServerPort?: number;
610
- devServerUrl?: string;
611
- refreshPreview?: boolean;
612
- installCommand?: string;
613
- validateCommand?: string;
614
- proxyOrigin?: string;
615
- proxyDefaultOrigin?: string;
616
- gitBranchNamingStrategy?: "ai-session" | "branch-name" | "custom";
617
- setupDependencies?: SetupDependency[];
618
- gitBranchNamingCustom?: string;
619
- askUserForBranchName?: boolean;
620
- devServerCommand?: string;
621
- cpuKind?: CpuKind;
622
- cpus?: 1 | 2 | 4;
623
- memory?: 2048 | 4096 | 8192 | 16384;
624
- /** @deprecated */
625
- memoryLimit?: 1024 | 2048 | 4096 | 8192 | 16384;
626
- autoStop?: MachineAutoStop;
627
- mainBranchName?: string;
628
- minMachinesRunning?: number;
629
- volumeSize?: 5 | 10 | 12 | 15 | 20;
630
- includePath?: string;
631
- includePatterns?: string[];
632
- environmentVariables?: EnvironmentVariable[];
633
- fileOverrides?: FileOverride[];
634
- customInstructions?: CustomInstruction[];
635
- customAgents?: CustomAgentDefinition[];
636
- commitMode?: CommitMode;
637
- defaultBranchType?: "shared" | "private";
638
- dockerImagePath?: string;
639
- nodeVersion?: string;
640
- designSystems?: string[];
641
- useNI?: boolean;
642
- folders?: Array<{
643
- name: string;
644
- remoteUrl: string;
645
- mainBranchName?: string;
646
- includePath?: string;
647
- addedBy?: string;
648
- repoProvider?: string;
649
- repoProtocol?: string;
650
- }>;
651
- agentsMD?: string;
652
- initializationCommand?: string;
653
- repoSubpath?: string;
654
- recommendedRoot?: string;
655
- https?: boolean;
656
- localHttpsDomain?: string;
657
- browserAutomation?: {
658
- backgroundAgents?: boolean;
659
- instructions?: string;
660
- authUser?: string;
661
- authPassword?: string;
662
- };
663
- qaBot?: boolean;
664
- httpsServerKeyPath?: string;
665
- httpsServerCertPath?: string;
666
- httpsServerCaPath?: string;
667
- httpsServerKeyContent?: string;
668
- httpsServerCertContent?: string;
669
- httpsServerCaContent?: string;
670
- httpsServerPfx?: string;
671
- httpsServerPassphrase?: string;
672
- httpsServerSecureProtocol?: string;
673
- httpsServerSecureOptions?: number;
674
- httpsServerCiphers?: string;
675
- httpsServerHonorCipherOrder?: boolean;
676
- httpsServerRequestCert?: boolean;
677
- httpsServerRejectUnauthorized?: boolean;
678
- };
679
- screenshot: string | null;
680
- isExample?: boolean;
681
- isPublic?: boolean;
682
- snapshotVolume?: {
683
- volumeId: string;
684
- appName: string;
685
- createdAt: number;
686
- };
687
- isFromUserTemplate?: boolean;
688
- templateId?: string | null;
689
- localPath?: string | null;
690
- /** The state of the project. Use `isProjectDeleted()` helper for backwards-compatible checks. */
691
- state?: EntityState;
692
- /** MIGRATION: accepts both string and number during migration period */
693
- deletedAt?: InMigrationDateNullable;
694
- deletedBy?: string;
695
- /**
696
- * When true, branches are stored in the standalone `branches` collection
697
- * instead of embedded in project.branches field.
698
- * Defaults to false for backwards compatibility with existing projects.
699
- */
700
- useBranchesCollection?: boolean;
440
+ id: string;
441
+ name: string;
442
+ ownerId: string;
443
+ repoFullName: string | undefined;
444
+ repoProvider: string;
445
+ repoProtocol: string | undefined;
446
+ repoDescription?: string;
447
+ repoPrivate: boolean;
448
+ repoUrl: string | undefined;
449
+ /** MIGRATION: accepts both string and number during migration period */
450
+ createdDate: InMigrationDate;
451
+ /** MIGRATION: accepts both string and number during migration period */
452
+ updatedAt: InMigrationDate;
453
+ pinned?: boolean;
454
+ archived?: boolean;
455
+ createdBy: string;
456
+ checkRunCounts?: Record<string, number>;
457
+ repoAddedBy?: string;
458
+ pipelineCounts?: Record<string, number>;
459
+ needSetup?: boolean;
460
+ projectType?: "app" | "repo-indexing";
461
+ domains?: string[];
462
+ accessMode?: "public" | "private";
463
+ projectAccess?: ProjectAccessControl;
464
+ settings: {
465
+ isNativeApp?: boolean;
466
+ autoDetectDevServer?: boolean;
467
+ autoDetectDevServerPatterns?: string[];
468
+ fusionEnvironment?: FusionExecutionEnvironment;
469
+ devServerPort?: number;
470
+ devServerUrl?: string;
471
+ refreshPreview?: boolean;
472
+ installCommand?: string;
473
+ validateCommand?: string;
474
+ proxyOrigin?: string;
475
+ proxyDefaultOrigin?: string;
476
+ gitBranchNamingStrategy?: "ai-session" | "branch-name" | "custom";
477
+ setupDependencies?: SetupDependency[];
478
+ gitBranchNamingCustom?: string;
479
+ askUserForBranchName?: boolean;
480
+ devServerCommand?: string;
481
+ cpuKind?: CpuKind;
482
+ cpus?: 1 | 2 | 4;
483
+ memory?: 2048 | 4096 | 8192 | 16384;
484
+ /** @deprecated */
485
+ memoryLimit?: 1024 | 2048 | 4096 | 8192 | 16384;
486
+ autoStop?: MachineAutoStop;
487
+ mainBranchName?: string;
488
+ minMachinesRunning?: number;
489
+ volumeSize?: 5 | 10 | 12 | 15 | 20;
490
+ includePath?: string;
491
+ includePatterns?: string[];
492
+ environmentVariables?: EnvironmentVariable[];
493
+ fileOverrides?: FileOverride[];
494
+ customInstructions?: CustomInstruction[];
495
+ customAgents?: CustomAgentDefinition[];
496
+ commitMode?: CommitMode;
497
+ defaultBranchType?: "shared" | "private";
498
+ dockerImagePath?: string;
499
+ nodeVersion?: string;
500
+ designSystems?: string[];
501
+ useNI?: boolean;
502
+ folders?: Array<{
503
+ name: string;
504
+ remoteUrl: string;
505
+ mainBranchName?: string;
506
+ includePath?: string;
507
+ addedBy?: string;
508
+ repoProvider?: string;
509
+ repoProtocol?: string;
510
+ enableGit?: boolean;
511
+ }>;
512
+ agentsMD?: string;
513
+ initializationCommand?: string;
514
+ repoSubpath?: string;
515
+ recommendedRoot?: string;
516
+ https?: boolean;
517
+ localHttpsDomain?: string;
518
+ browserAutomation?: {
519
+ backgroundAgents?: boolean;
520
+ instructions?: string;
521
+ authUser?: string;
522
+ authPassword?: string;
523
+ };
524
+ qaBot?: boolean;
525
+ httpsServerKeyPath?: string;
526
+ httpsServerCertPath?: string;
527
+ httpsServerCaPath?: string;
528
+ httpsServerKeyContent?: string;
529
+ httpsServerCertContent?: string;
530
+ httpsServerCaContent?: string;
531
+ httpsServerPfx?: string;
532
+ httpsServerPassphrase?: string;
533
+ httpsServerSecureProtocol?: string;
534
+ httpsServerSecureOptions?: number;
535
+ httpsServerCiphers?: string;
536
+ httpsServerHonorCipherOrder?: boolean;
537
+ httpsServerRequestCert?: boolean;
538
+ httpsServerRejectUnauthorized?: boolean;
539
+ };
540
+ screenshot: string | null;
541
+ isExample?: boolean;
542
+ isPublic?: boolean;
543
+ snapshotVolume?: {
544
+ volumeId: string;
545
+ appName: string;
546
+ createdAt: number;
547
+ };
548
+ isFromUserTemplate?: boolean;
549
+ templateId?: string | null;
550
+ localPath?: string | null;
551
+ /** The state of the project. Use `isProjectDeleted()` helper for backwards-compatible checks. */
552
+ state?: EntityState;
553
+ /** MIGRATION: accepts both string and number during migration period */
554
+ deletedAt?: InMigrationDateNullable;
555
+ deletedBy?: string;
556
+ /**
557
+ * When true, branches are stored in the standalone `branches` collection
558
+ * instead of embedded in project.branches field.
559
+ * Defaults to false for backwards compatibility with existing projects.
560
+ */
561
+ useBranchesCollection?: boolean;
701
562
  }
702
563
  /**
703
564
  * Get the state of a branch, checking `state` first and falling back to `deleted` for backwards compatibility.
@@ -721,31 +582,32 @@ export declare const isBranchArchived: (branch: Branch) => boolean;
721
582
  */
722
583
  export declare const isProjectDeleted: (project: Project) => boolean;
723
584
  export interface ProjectWithBranches extends Project {
724
- branches: Record<string, Branch>;
585
+ branches: Record<string, Branch>;
725
586
  }
726
587
  export interface OrganizationPrivate {
727
- ownerId: string;
728
- id: string;
729
- installs?: {
730
- ids: number[];
731
- host: string;
732
- }[];
733
- createdAt: number;
734
- updatedAt: number;
588
+ ownerId: string;
589
+ id: string;
590
+ installs?: {
591
+ ids: number[];
592
+ host: string;
593
+ }[];
594
+ createdAt: number;
595
+ updatedAt: number;
596
+ fallbackTokens?: FallbackTokensPrivate;
735
597
  }
736
598
  export interface CreateProjectOptions {
737
- name?: string;
738
- repoFullName: string;
739
- repoProvider: string;
740
- repoProtocol?: string;
741
- repoDescription?: string;
742
- repoPrivate: boolean;
743
- repoUrl: string;
744
- needSetup: boolean;
745
- domains?: string[];
746
- settings?: Partial<Project["settings"]>;
747
- isPublic?: boolean;
748
- isExample?: boolean;
749
- templateId?: string;
599
+ name?: string;
600
+ repoFullName: string;
601
+ repoProvider: string;
602
+ repoProtocol?: string;
603
+ repoDescription?: string;
604
+ repoPrivate: boolean;
605
+ repoUrl: string;
606
+ needSetup: boolean;
607
+ domains?: string[];
608
+ settings?: Partial<Project["settings"]>;
609
+ isPublic?: boolean;
610
+ isExample?: boolean;
611
+ templateId?: string;
750
612
  }
751
613
  export {};