@builder.io/ai-utils 0.22.3 → 0.23.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.22.3",
3
+ "version": "0.23.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/codegen.d.ts CHANGED
@@ -5,6 +5,7 @@ import type { UserContext } from "./mapping";
5
5
  import type { ForcedBackup, SetupDependency, GitDiagnostics } from "./projects";
6
6
  import type { Feature } from "./features";
7
7
  import type { CpuKind } from "./projects";
8
+ export type GitSnapshot = unknown;
8
9
  export type ImportType = "named" | "default";
9
10
  export interface ESMImport {
10
11
  importName: string;
@@ -332,6 +333,13 @@ export interface ReportUIIssueToolInput {
332
333
  description: string;
333
334
  debugInfo?: string;
334
335
  }
336
+ export interface ReportIssueToolInput {
337
+ file_path: string;
338
+ line: number;
339
+ title: string;
340
+ severity: "high" | "medium";
341
+ body: string;
342
+ }
335
343
  export interface CodeGenToolMap {
336
344
  view_path: ReadToolInput;
337
345
  glob_search: GlobSearchToolInput;
@@ -383,6 +391,7 @@ export interface CodeGenToolMap {
383
391
  UpdateSetupValue: UpdateSetupValueToolInput;
384
392
  ResolveQAComments: ResolveQACommentsToolInput;
385
393
  ReportUIIssue: ReportUIIssueToolInput;
394
+ ReportIssue: ReportIssueToolInput;
386
395
  VerifyInstallCommand: VerifyInstallCommandToolInput;
387
396
  VerifyDevServer: VerifyDevServerToolInput;
388
397
  VerifyValidationScript: VerifyValidationScriptToolInput;
@@ -425,7 +434,7 @@ export interface CodeGenInputOptions {
425
434
  rerankFiles?: number;
426
435
  toolResults?: ContentMessageItemToolResult[];
427
436
  attachments?: Attachment[];
428
- beforeCommit?: string;
437
+ beforeCommit?: GitSnapshot;
429
438
  workingDirectory?: string;
430
439
  includeRelevantMemories?: boolean;
431
440
  encryptKey?: string;
@@ -840,7 +849,7 @@ export interface CustomInstructionDefinition {
840
849
  export interface GenerateCompletionStepSession {
841
850
  type: "session";
842
851
  title: string | undefined;
843
- beforeCommit: string | undefined;
852
+ beforeCommit: GitSnapshot | undefined;
844
853
  createdUnixTime: number;
845
854
  updatedUnixTime: number;
846
855
  id: string;
@@ -914,13 +923,18 @@ export interface UserSourceBase {
914
923
  jobs?: string[];
915
924
  permissions?: UserSourcePermission[];
916
925
  }
926
+ /** All integration sources: Slack, Teams, Jira, Linear, and git providers (GitHub, GitLab, Azure, Bitbucket). */
917
927
  export interface UserSourceOther extends UserSourceBase {
918
- source: "slack" | "teams" | "jira" | "linear";
919
- /** User ID from the external platform (Slack user ID, Jira account ID, etc.) */
928
+ source: "slack" | "teams" | "jira" | "linear" | "github" | "gitlab" | "azure" | "bitbucket";
929
+ /** User ID from the external platform (Slack user ID, GitHub user id, etc.) */
920
930
  userId?: string;
921
931
  userName?: string;
922
932
  userEmail?: string;
923
933
  photoURL?: string;
934
+ /** Resolved Builder user ID for attribution/credits */
935
+ builderUserId?: string;
936
+ /** Optional link (e.g. comment/PR URL) for git provider sources */
937
+ link?: string;
924
938
  }
925
939
  export interface UserSourceBuilder extends UserSourceBase {
926
940
  source: "builder.io";
@@ -929,31 +943,10 @@ export interface UserSourceBuilder extends UserSourceBase {
929
943
  userEmail?: string;
930
944
  photoURL?: string;
931
945
  }
932
- export interface UserSourceGithub extends UserSourceBase {
933
- source: "github";
934
- userName: string;
935
- userEmail?: string;
936
- link?: string;
937
- }
938
- export interface UserSourceGitlab extends UserSourceBase {
939
- source: "gitlab";
940
- userName: string;
941
- link?: string;
942
- }
943
- export interface UserSourceAzure extends UserSourceBase {
944
- source: "azure";
945
- userName: string;
946
- link?: string;
947
- }
948
- export interface UserSourceBitbucket extends UserSourceBase {
949
- source: "bitbucket";
950
- userName: string;
951
- link?: string;
952
- }
953
946
  export interface UserSourceAgent extends UserSourceBase {
954
947
  source: "agent";
955
948
  }
956
- export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceGithub | UserSourceGitlab | UserSourceAzure | UserSourceBitbucket | UserSourceAgent;
949
+ export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceAgent;
957
950
  export interface GenerateUserMessage {
958
951
  idempotencyKey?: string;
959
952
  user?: UserSource;
@@ -1016,9 +1009,9 @@ export interface CodegenTurn {
1016
1009
  sentiment: "positive" | "negative" | "undo" | undefined;
1017
1010
  applyResults: ApplyActionsResult[];
1018
1011
  userMessage: GenerateUserMessage | undefined;
1019
- beforeCommit: string | undefined;
1020
- afterCommit: string | undefined;
1021
- lastCommit: string | undefined;
1012
+ beforeCommit: GitSnapshot | undefined;
1013
+ afterCommit: GitSnapshot | undefined;
1014
+ lastCommit: GitSnapshot | undefined;
1022
1015
  cachedToolResults?: ContentMessageItemToolResult[];
1023
1016
  autoContinue: boolean;
1024
1017
  }
@@ -1028,7 +1021,7 @@ export interface GetSessionTurnsResult {
1028
1021
  lastCompletionId: string | undefined;
1029
1022
  sessionId: string;
1030
1023
  initialUrl: string | undefined;
1031
- beforeCommit: string | undefined;
1024
+ beforeCommit: GitSnapshot | undefined;
1032
1025
  title: string | undefined;
1033
1026
  createdUnixTime: number | undefined;
1034
1027
  updatedUnixTime: number | undefined;
@@ -1042,8 +1035,8 @@ export interface CodegenFeedback {
1042
1035
  feedbackSentiment?: string;
1043
1036
  framework?: string;
1044
1037
  acceptedLines?: number;
1045
- beforeCommit?: string;
1046
- afterCommit?: string;
1038
+ beforeCommit?: GitSnapshot;
1039
+ afterCommit?: GitSnapshot;
1047
1040
  linesOfCodeAdded?: number;
1048
1041
  linesOfCodeRemoved?: number;
1049
1042
  commitFailed?: boolean;
@@ -1055,9 +1048,9 @@ export interface CodegenFinalize {
1055
1048
  projectId?: string;
1056
1049
  branchName?: string;
1057
1050
  userCompletionId?: string;
1058
- beforeCommit?: string;
1059
- afterCommit?: string;
1060
- lastCommit?: string;
1051
+ beforeCommit?: GitSnapshot;
1052
+ afterCommit?: GitSnapshot;
1053
+ lastCommit?: GitSnapshot;
1061
1054
  commitFailed?: boolean;
1062
1055
  metadata?: Record<string, any>;
1063
1056
  }
@@ -1362,6 +1355,8 @@ export interface FusionConfig {
1362
1355
  branchName?: string;
1363
1356
  sessionId?: string;
1364
1357
  browserAutomationInstructions?: string;
1358
+ /** Whether this branch is for a code review - affects enabled agents and tools */
1359
+ branchType?: "code-review";
1365
1360
  featureBranch?: string;
1366
1361
  aiBranch?: string;
1367
1362
  /** Whether this is a fork PR - affects git operations (read-only, can't push) */
@@ -1487,7 +1482,7 @@ export interface LoadWholeSessionOptions {
1487
1482
  export interface LoadWholeSessionResult {
1488
1483
  sessionId: string;
1489
1484
  title: string | undefined;
1490
- beforeCommit: string | undefined;
1485
+ beforeCommit: GitSnapshot | undefined;
1491
1486
  createdUnixTime: number;
1492
1487
  updatedUnixTime: number;
1493
1488
  addedTurns: number;
@@ -1496,7 +1491,7 @@ export interface LoadWholeSessionResult {
1496
1491
  export interface LoadHistoryResult {
1497
1492
  sessionId: string;
1498
1493
  title: string | undefined;
1499
- beforeCommit: string | undefined;
1494
+ beforeCommit: GitSnapshot | undefined;
1500
1495
  createdUnixTime: number;
1501
1496
  updatedUnixTime: number;
1502
1497
  turns: CodegenTurn[];
@@ -197,7 +197,7 @@ export interface AiCreditsRolloverInfo {
197
197
  }
198
198
  export type PaymentError = "failed" | "unpaid" | "incomplete" | "incomplete_expired";
199
199
  export interface CustomPlan extends SubscriptionInfo {
200
- organizationId: string;
200
+ ownerId: string;
201
201
  plan: keyof SubscriptionInfoMap;
202
202
  id: string;
203
203
  }
package/src/projects.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
2
- import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition } from "./codegen";
2
+ import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot } from "./codegen";
3
3
  import type { FallbackTokensPrivate } from "./organization";
4
4
  /**
5
5
  * Temporary type for date fields during migration.
@@ -236,7 +236,7 @@ export interface GitBackupUploadUrlOptions {
236
236
  contentMd5: string;
237
237
  }
238
238
  export interface GitBackupDownloadUrlOptions {
239
- spaceId: string;
239
+ ownerId: string;
240
240
  projectId: string;
241
241
  branchName: string;
242
242
  partial: boolean;
@@ -264,6 +264,7 @@ export interface RecordScreenshotOptions {
264
264
  branchName: string;
265
265
  completionId?: string;
266
266
  screenshotUrl: string;
267
+ href?: string;
267
268
  meta?: Record<string, any>;
268
269
  }
269
270
  export interface GitBackupRecordResult {
@@ -272,13 +273,13 @@ export interface GitBackupRecordResult {
272
273
  export interface CodegenSetLastCommit {
273
274
  projectId: string;
274
275
  branchName: string;
275
- lastCommitHash: string;
276
+ lastCommitHash: GitSnapshot;
276
277
  clearSecondaryVolumeId: boolean;
277
278
  }
278
279
  export interface CodegenRuntimeStatus {
279
280
  projectId: string;
280
281
  branchName: string;
281
- lastCommitHash?: string;
282
+ lastCommitHash?: GitSnapshot;
282
283
  clearSecondaryVolumeId?: boolean;
283
284
  lastServerState?: LaunchServerState;
284
285
  lastServerVersion?: string;
@@ -335,13 +336,15 @@ export interface PartialBranchData {
335
336
  metadata?: BranchMetadata;
336
337
  backup?: BranchBackup;
337
338
  gitAiBranch?: string | null;
338
- lastCommitHash?: string | null;
339
+ lastCommitHash?: GitSnapshot | null;
339
340
  lastCommitDate?: number | null;
340
341
  commitMode?: CommitMode;
341
342
  useHomeDir?: boolean;
342
343
  checkoutBranch?: string | null;
343
344
  /** Whether this branch is for a fork PR - affects git operations (read-only, can't push) */
344
345
  isFork?: boolean | null;
346
+ /** Whether this branch is for a code review - affects enabled agents and tools*/
347
+ type?: "code-review" | null;
345
348
  cloneFrom?: {
346
349
  projectId: string;
347
350
  branchName: string;
@@ -354,6 +357,7 @@ export type EntityState = "active" | "deleted" | "archived";
354
357
  export interface PrInfo {
355
358
  prNumber: number;
356
359
  prUrl: string;
360
+ status: PRStatus;
357
361
  }
358
362
  /**
359
363
  * Metadata stored in branches for integration tracking and PR description generation.
@@ -398,7 +402,7 @@ interface BranchSharedData {
398
402
  secondaryVolumeId?: string | null;
399
403
  volumeName?: string | null;
400
404
  gitAiBranch?: string | null;
401
- lastCommitHash?: string | null;
405
+ lastCommitHash?: GitSnapshot | null;
402
406
  lastCommitDate?: number | null;
403
407
  lastServerState?: LaunchServerState | null;
404
408
  lastServerStateDate?: number | null;
@@ -448,6 +452,10 @@ interface BranchSharedData {
448
452
  /** Whether the branch has unpushed changes (ahead > 0 or dirty working directory) */
449
453
  hasUnpushedChanges?: boolean;
450
454
  screenshot?: string | null;
455
+ /** Screenshots indexed by normalized href (without query params, fragments, protocol) */
456
+ screenshots?: Record<string, string>;
457
+ /** Whether this branch is for a code review - affects enabled agents and tools */
458
+ type?: "code-review" | null;
451
459
  }
452
460
  /**
453
461
  * fields that are required in the new branch format, but optional in the legacy branch format.
@@ -687,4 +695,16 @@ export interface CreateProjectOptions {
687
695
  isExample?: boolean;
688
696
  templateId?: string;
689
697
  }
698
+ export interface BuilderMyContext {
699
+ success: boolean;
700
+ projectId: string;
701
+ branchName: string;
702
+ branchId: string | null;
703
+ organizationId: string | null;
704
+ isEnterprise: boolean;
705
+ passwordProtection: {
706
+ enabled: boolean;
707
+ };
708
+ error?: string;
709
+ }
690
710
  export {};