@builder.io/ai-utils 0.22.3 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.22.3",
3
+ "version": "0.23.0",
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;
@@ -425,7 +426,7 @@ export interface CodeGenInputOptions {
425
426
  rerankFiles?: number;
426
427
  toolResults?: ContentMessageItemToolResult[];
427
428
  attachments?: Attachment[];
428
- beforeCommit?: string;
429
+ beforeCommit?: GitSnapshot;
429
430
  workingDirectory?: string;
430
431
  includeRelevantMemories?: boolean;
431
432
  encryptKey?: string;
@@ -840,7 +841,7 @@ export interface CustomInstructionDefinition {
840
841
  export interface GenerateCompletionStepSession {
841
842
  type: "session";
842
843
  title: string | undefined;
843
- beforeCommit: string | undefined;
844
+ beforeCommit: GitSnapshot | undefined;
844
845
  createdUnixTime: number;
845
846
  updatedUnixTime: number;
846
847
  id: string;
@@ -914,13 +915,18 @@ export interface UserSourceBase {
914
915
  jobs?: string[];
915
916
  permissions?: UserSourcePermission[];
916
917
  }
918
+ /** All integration sources: Slack, Teams, Jira, Linear, and git providers (GitHub, GitLab, Azure, Bitbucket). */
917
919
  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.) */
920
+ source: "slack" | "teams" | "jira" | "linear" | "github" | "gitlab" | "azure" | "bitbucket";
921
+ /** User ID from the external platform (Slack user ID, GitHub user id, etc.) */
920
922
  userId?: string;
921
923
  userName?: string;
922
924
  userEmail?: string;
923
925
  photoURL?: string;
926
+ /** Resolved Builder user ID for attribution/credits */
927
+ builderUserId?: string;
928
+ /** Optional link (e.g. comment/PR URL) for git provider sources */
929
+ link?: string;
924
930
  }
925
931
  export interface UserSourceBuilder extends UserSourceBase {
926
932
  source: "builder.io";
@@ -929,31 +935,10 @@ export interface UserSourceBuilder extends UserSourceBase {
929
935
  userEmail?: string;
930
936
  photoURL?: string;
931
937
  }
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
938
  export interface UserSourceAgent extends UserSourceBase {
954
939
  source: "agent";
955
940
  }
956
- export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceGithub | UserSourceGitlab | UserSourceAzure | UserSourceBitbucket | UserSourceAgent;
941
+ export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceAgent;
957
942
  export interface GenerateUserMessage {
958
943
  idempotencyKey?: string;
959
944
  user?: UserSource;
@@ -1016,9 +1001,9 @@ export interface CodegenTurn {
1016
1001
  sentiment: "positive" | "negative" | "undo" | undefined;
1017
1002
  applyResults: ApplyActionsResult[];
1018
1003
  userMessage: GenerateUserMessage | undefined;
1019
- beforeCommit: string | undefined;
1020
- afterCommit: string | undefined;
1021
- lastCommit: string | undefined;
1004
+ beforeCommit: GitSnapshot | undefined;
1005
+ afterCommit: GitSnapshot | undefined;
1006
+ lastCommit: GitSnapshot | undefined;
1022
1007
  cachedToolResults?: ContentMessageItemToolResult[];
1023
1008
  autoContinue: boolean;
1024
1009
  }
@@ -1028,7 +1013,7 @@ export interface GetSessionTurnsResult {
1028
1013
  lastCompletionId: string | undefined;
1029
1014
  sessionId: string;
1030
1015
  initialUrl: string | undefined;
1031
- beforeCommit: string | undefined;
1016
+ beforeCommit: GitSnapshot | undefined;
1032
1017
  title: string | undefined;
1033
1018
  createdUnixTime: number | undefined;
1034
1019
  updatedUnixTime: number | undefined;
@@ -1042,8 +1027,8 @@ export interface CodegenFeedback {
1042
1027
  feedbackSentiment?: string;
1043
1028
  framework?: string;
1044
1029
  acceptedLines?: number;
1045
- beforeCommit?: string;
1046
- afterCommit?: string;
1030
+ beforeCommit?: GitSnapshot;
1031
+ afterCommit?: GitSnapshot;
1047
1032
  linesOfCodeAdded?: number;
1048
1033
  linesOfCodeRemoved?: number;
1049
1034
  commitFailed?: boolean;
@@ -1055,9 +1040,9 @@ export interface CodegenFinalize {
1055
1040
  projectId?: string;
1056
1041
  branchName?: string;
1057
1042
  userCompletionId?: string;
1058
- beforeCommit?: string;
1059
- afterCommit?: string;
1060
- lastCommit?: string;
1043
+ beforeCommit?: GitSnapshot;
1044
+ afterCommit?: GitSnapshot;
1045
+ lastCommit?: GitSnapshot;
1061
1046
  commitFailed?: boolean;
1062
1047
  metadata?: Record<string, any>;
1063
1048
  }
@@ -1487,7 +1472,7 @@ export interface LoadWholeSessionOptions {
1487
1472
  export interface LoadWholeSessionResult {
1488
1473
  sessionId: string;
1489
1474
  title: string | undefined;
1490
- beforeCommit: string | undefined;
1475
+ beforeCommit: GitSnapshot | undefined;
1491
1476
  createdUnixTime: number;
1492
1477
  updatedUnixTime: number;
1493
1478
  addedTurns: number;
@@ -1496,7 +1481,7 @@ export interface LoadWholeSessionResult {
1496
1481
  export interface LoadHistoryResult {
1497
1482
  sessionId: string;
1498
1483
  title: string | undefined;
1499
- beforeCommit: string | undefined;
1484
+ beforeCommit: GitSnapshot | undefined;
1500
1485
  createdUnixTime: number;
1501
1486
  updatedUnixTime: number;
1502
1487
  turns: CodegenTurn[];
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.
@@ -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,7 +336,7 @@ 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;
@@ -354,6 +355,7 @@ export type EntityState = "active" | "deleted" | "archived";
354
355
  export interface PrInfo {
355
356
  prNumber: number;
356
357
  prUrl: string;
358
+ status: PRStatus;
357
359
  }
358
360
  /**
359
361
  * Metadata stored in branches for integration tracking and PR description generation.
@@ -398,7 +400,7 @@ interface BranchSharedData {
398
400
  secondaryVolumeId?: string | null;
399
401
  volumeName?: string | null;
400
402
  gitAiBranch?: string | null;
401
- lastCommitHash?: string | null;
403
+ lastCommitHash?: GitSnapshot | null;
402
404
  lastCommitDate?: number | null;
403
405
  lastServerState?: LaunchServerState | null;
404
406
  lastServerStateDate?: number | null;
@@ -448,6 +450,8 @@ interface BranchSharedData {
448
450
  /** Whether the branch has unpushed changes (ahead > 0 or dirty working directory) */
449
451
  hasUnpushedChanges?: boolean;
450
452
  screenshot?: string | null;
453
+ /** Screenshots indexed by normalized href (without query params, fragments, protocol) */
454
+ screenshots?: Record<string, string>;
451
455
  }
452
456
  /**
453
457
  * fields that are required in the new branch format, but optional in the legacy branch format.