@builder.io/ai-utils 0.67.0 → 0.68.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.67.0",
3
+ "version": "0.68.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/events.d.ts CHANGED
@@ -528,7 +528,7 @@ export declare const ReviewSubmittedV1: {
528
528
  eventName: "review.submitted";
529
529
  version: "1";
530
530
  };
531
- export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
531
+ export type BotMentionGitHubExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
532
532
  projectId: string;
533
533
  repoFullName: string;
534
534
  prNumber: number;
@@ -554,10 +554,148 @@ export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr
554
554
  }, {
555
555
  projectId: string;
556
556
  }, 1>;
557
- export declare const BotMentionExternalPrV1: {
557
+ export declare const BotMentionGitHubExternalPrV1: {
558
558
  eventName: "bot.mention.external-pr";
559
559
  version: "1";
560
560
  };
561
+ /**
562
+ * Common fields shared by all four bot-mention PR events.
563
+ *
564
+ * Extracting this base makes the future consolidation into a single
565
+ * `bot.mention.pr` event straightforward: the unified type will be
566
+ * `BaseBotMentionEventData & { provider: ..., ...providerSpecificOptionals }`.
567
+ */
568
+ export type BaseBotMentionEventData = {
569
+ /** Fusion project ID resolved from PR metadata */
570
+ projectId: string;
571
+ /** Fusion branch name resolved from PR metadata */
572
+ branchName: string;
573
+ /** Raw comment body that triggered the bot mention */
574
+ comment: string;
575
+ commentLink?: string;
576
+ /** Dedup lock key — composite of comment ID and delivery ID */
577
+ commentIdStr: string;
578
+ userName?: string;
579
+ /** Provider-specific user ID as string (for credits / analytics) */
580
+ gitUserId?: string;
581
+ /** Commenter email when available from the provider (preferred for user resolution) */
582
+ userEmail?: string;
583
+ /** Original webhook delivery ID — passed through for logging */
584
+ webhookEventId: string;
585
+ };
586
+ /**
587
+ * Emitted when @builderio-bot is mentioned on a Fusion (internal) GitHub PR comment.
588
+ * Pre-flight checks (project existence, installation token, GitHub App rights) have
589
+ * already passed before this event is published. The heavy work — container
590
+ * provisioning and AI processing — is handled asynchronously by the subscriber.
591
+ */
592
+ export type BotMentionGitHubInternalPrV1 = FusionEventVariant<"bot.mention.github-internal-pr", BaseBotMentionEventData & {
593
+ provider: "github";
594
+ repoFullName: string;
595
+ prNumber: number;
596
+ /** Numeric GitHub comment ID (for reaction / reply threading) */
597
+ commentNumericId?: number;
598
+ commentType: "issue" | "pr";
599
+ /** GitHub Enterprise hostname, if applicable */
600
+ hostname?: string;
601
+ /** For review comments: the comment being replied to */
602
+ inReplyToCommentId?: number;
603
+ /** For review comments: unified diff context */
604
+ diffHunk?: string;
605
+ /** For review comments: file path */
606
+ filePath?: string;
607
+ /** For review comments: first line of the comment range */
608
+ startLine?: number;
609
+ /** For review comments: last line of the comment range */
610
+ endLine?: number;
611
+ /** For review comments: reply target comment ID */
612
+ replyToCommentId?: number;
613
+ }, {
614
+ projectId: string;
615
+ }, 1>;
616
+ export declare const BotMentionGitHubInternalPrV1: {
617
+ eventName: "bot.mention.github-internal-pr";
618
+ version: "1";
619
+ };
620
+ /**
621
+ * Emitted when @builderio-bot is mentioned on a GitLab MR comment.
622
+ * Pre-flight checks have already passed before this event is published.
623
+ * Container provisioning and AI processing happen asynchronously in the subscriber.
624
+ */
625
+ export type BotMentionGitLabPrV1 = FusionEventVariant<"bot.mention.gitlab-pr", BaseBotMentionEventData & {
626
+ provider: "gitlab";
627
+ /** GitLab numeric project ID (needed to re-fetch token and post comments) */
628
+ gitlabProjectId: number;
629
+ /** GitLab MR IID */
630
+ mrId: number;
631
+ /**
632
+ * Thread discussion ID for threaded replies.
633
+ * GitLab sends this as a hex SHA string (e.g. "6a9c1750b37d..."),
634
+ * not a number — used only in URL interpolation.
635
+ */
636
+ discussionId?: string;
637
+ /** GitLab Enterprise hostname, if applicable */
638
+ hostname?: string;
639
+ }, {
640
+ projectId: string;
641
+ }, 1>;
642
+ export declare const BotMentionGitLabPrV1: {
643
+ eventName: "bot.mention.gitlab-pr";
644
+ version: "1";
645
+ };
646
+ /**
647
+ * Emitted when @builderio-bot is mentioned on a Bitbucket PR comment.
648
+ * Pre-flight checks have already passed before this event is published.
649
+ */
650
+ export type BotMentionBitbucketPrV1 = FusionEventVariant<"bot.mention.bitbucket-pr", BaseBotMentionEventData & {
651
+ provider: "bitbucket";
652
+ /** e.g. "workspace/repo" */
653
+ repositorySlug: string;
654
+ workspace?: string;
655
+ pullRequestId: number;
656
+ /** Numeric Bitbucket comment ID — used as parentCommentId for reply threading */
657
+ parentCommentId?: number;
658
+ /** PR browser URL (links.html.href from the pullrequest payload) */
659
+ pullRequestUrl?: string;
660
+ /** PR title from the pullrequest payload */
661
+ pullRequestTitle?: string;
662
+ /** PR description from the pullrequest payload */
663
+ pullRequestDescription?: string;
664
+ }, {
665
+ projectId: string;
666
+ }, 1>;
667
+ export declare const BotMentionBitbucketPrV1: {
668
+ eventName: "bot.mention.bitbucket-pr";
669
+ version: "1";
670
+ };
671
+ /**
672
+ * Emitted when @builderio-bot is mentioned on an Azure DevOps PR comment.
673
+ * Pre-flight checks have already passed before this event is published.
674
+ */
675
+ export type BotMentionAzurePrV1 = FusionEventVariant<"bot.mention.azure-pr", BaseBotMentionEventData & {
676
+ provider: "azure";
677
+ azureOrg: string;
678
+ azureProject: string;
679
+ pullRequestId: number;
680
+ /** Repository ID extracted from comment links */
681
+ repositoryId: string;
682
+ /** Thread link URL — used for reply threading and thread context */
683
+ threadLink: string;
684
+ /**
685
+ * The actual Azure DevOps REST URL of the pull request
686
+ * (event.resource.url or pullRequest.url from the webhook payload).
687
+ * Distinct from commentLink which is the comment resource URL.
688
+ */
689
+ pullRequestUrl?: string;
690
+ /** PR description from the pullrequest payload */
691
+ pullRequestDescription?: string;
692
+ }, {
693
+ projectId: string;
694
+ }, 1>;
695
+ export declare const BotMentionAzurePrV1: {
696
+ eventName: "bot.mention.azure-pr";
697
+ version: "1";
698
+ };
561
699
  export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
562
700
  sessionId?: string;
563
701
  sessionType?: string;
@@ -1030,7 +1168,7 @@ export declare const ClientDevtoolsToolResultV1: {
1030
1168
  eventName: "client.devtools.tool.result";
1031
1169
  version: "1";
1032
1170
  };
1033
- 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 | BotMentionExternalPrV1 | ReviewSubmittedV1 | PrReviewRequestedV1 | FigmaDecodeJobV1 | ProjectSnapshotRefreshV1 | ProjectSnapshotCapturedV1 | ProjectSnapshotCreatedV1 | ProjectSnapshotFailedV1 | ProjectSnapshotReadyCheckV1 | ProjectSnapshotPodWatchV1;
1171
+ 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;
1034
1172
  export interface ModelPermissionRequiredEvent {
1035
1173
  type: "assistant.model.permission.required";
1036
1174
  data: {
package/src/events.js CHANGED
@@ -14,10 +14,26 @@ export const ReviewSubmittedV1 = {
14
14
  eventName: "review.submitted",
15
15
  version: "1",
16
16
  };
17
- export const BotMentionExternalPrV1 = {
17
+ export const BotMentionGitHubExternalPrV1 = {
18
18
  eventName: "bot.mention.external-pr",
19
19
  version: "1",
20
20
  };
21
+ export const BotMentionGitHubInternalPrV1 = {
22
+ eventName: "bot.mention.github-internal-pr",
23
+ version: "1",
24
+ };
25
+ export const BotMentionGitLabPrV1 = {
26
+ eventName: "bot.mention.gitlab-pr",
27
+ version: "1",
28
+ };
29
+ export const BotMentionBitbucketPrV1 = {
30
+ eventName: "bot.mention.bitbucket-pr",
31
+ version: "1",
32
+ };
33
+ export const BotMentionAzurePrV1 = {
34
+ eventName: "bot.mention.azure-pr",
35
+ version: "1",
36
+ };
21
37
  export const ClientDevtoolsSessionStartedEvent = {
22
38
  eventName: "client.devtools.session.started",
23
39
  version: "1",