@builder.io/ai-utils 0.39.0 → 0.41.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.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -60,6 +60,13 @@ export interface CustomAgentDefinition {
60
60
  filePath?: string;
61
61
  /** Default reasoning effort level for this agent type. Overrides the session default. */
62
62
  reasoning?: ReasoningEffort;
63
+ /**
64
+ * When true and the parent session has an explicit model override (e.g. set
65
+ * via org/project PR-reviewer settings), that model is used for this agent
66
+ * instead of the agent's own `model` / `roundRobinModels` defaults.
67
+ * Has no effect when no session-level model override is present.
68
+ */
69
+ inheritSessionModel?: boolean;
63
70
  }
64
71
  export type CodeGenFramework = "react" | "html" | "mitosis" | "react-native" | "angular" | "vue" | "svelte" | "qwik" | "solid" | "marko" | "swiftui" | "jetpack-compose" | "flutter";
65
72
  export type CodeGenStyleLibrary = "tailwind" | "tailwind-precise" | "emotion" | "styled-components" | "styled-jsx" | "react-native" | undefined;
@@ -190,9 +197,6 @@ export interface AgentToolInput {
190
197
  origin_channel_id?: string;
191
198
  attachmentUrls?: string[];
192
199
  }
193
- export interface ListDirToolInput {
194
- path: string;
195
- }
196
200
  export interface RevertToolInput {
197
201
  checkpoint_id: string;
198
202
  }
@@ -691,7 +695,6 @@ export interface CodeGenToolMap {
691
695
  TodoRead: TodoReadToolInput;
692
696
  TodoWrite: TodoWriteToolInput;
693
697
  BuilderEdit: BuilderEditToolInput;
694
- LS: ListDirToolInput;
695
698
  WebFetch: WebFetchToolInput;
696
699
  ExplorationMetadata: ExplorationMetadataToolInput;
697
700
  EnterPlanMode: EnterPlanModeToolInput;
package/src/events.d.ts CHANGED
@@ -505,6 +505,36 @@ export declare const GitPrMergedV1: {
505
505
  eventName: "git.pr.merged";
506
506
  version: "1";
507
507
  };
508
+ export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
509
+ projectId: string;
510
+ repoFullName: string;
511
+ prNumber: number;
512
+ comment: string;
513
+ commentLink?: string;
514
+ commentNumericId?: number;
515
+ commentIdStr: string;
516
+ deliveryId: string;
517
+ commentType: "issue" | "pr";
518
+ userName?: string;
519
+ gitUserId?: string;
520
+ hostname?: string;
521
+ prHeadRef?: string;
522
+ isFork?: boolean;
523
+ filePath?: string;
524
+ startLine?: number;
525
+ endLine?: number;
526
+ diffHunk?: string;
527
+ replyToCommentId?: number;
528
+ inReplyToCommentId?: number;
529
+ prTitle?: string;
530
+ authorAssociation?: string;
531
+ }, {
532
+ projectId: string;
533
+ }, 1>;
534
+ export declare const BotMentionExternalPrV1: {
535
+ eventName: "bot.mention.external-pr";
536
+ version: "1";
537
+ };
508
538
  export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
509
539
  sessionId?: string;
510
540
  sessionType?: string;
@@ -524,7 +554,10 @@ export type ClientDevtoolsSessionIdleEventV1 = FusionEventVariant<"client.devtoo
524
554
  branchName?: string;
525
555
  hasPlanToApply?: boolean;
526
556
  sessionMode?: string;
527
- }, {}, 1>;
557
+ }, {
558
+ projectId?: string;
559
+ branchName?: string;
560
+ }, 1>;
528
561
  export declare const ClientDevtoolsSessionIdleEventV1: {
529
562
  eventName: "client.devtools.session.idle";
530
563
  version: "1";
@@ -723,7 +756,7 @@ export interface SendMessageToOrgAgentInput {
723
756
  */
724
757
  autoCreateProject?: boolean;
725
758
  }
726
- export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionBranchContainerStartedV1 | FusionBranchMessageSentV1 | FusionBranchFailedV1;
759
+ export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionBranchContainerStartedV1 | FusionBranchMessageSentV1 | FusionBranchFailedV1 | BotMentionExternalPrV1;
727
760
  export interface ModelPermissionRequiredEvent {
728
761
  type: "assistant.model.permission.required";
729
762
  data: {
package/src/events.js CHANGED
@@ -18,6 +18,10 @@ export const GitPrMergedV1 = {
18
18
  eventName: "git.pr.merged",
19
19
  version: "1",
20
20
  };
21
+ export const BotMentionExternalPrV1 = {
22
+ eventName: "bot.mention.external-pr",
23
+ version: "1",
24
+ };
21
25
  export const ClientDevtoolsSessionStartedEvent = {
22
26
  eventName: "client.devtools.session.started",
23
27
  version: "1",
package/src/index.d.ts CHANGED
@@ -10,5 +10,6 @@ export * from "./organization.js";
10
10
  export * from "./features.js";
11
11
  export * from "./vscode-tunnel.js";
12
12
  export * from "./claw.js";
13
+ export * from "./kube-error.js";
13
14
  export * from "./connectivity/types.js";
14
15
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
package/src/index.js CHANGED
@@ -10,5 +10,6 @@ export * from "./organization.js";
10
10
  export * from "./features.js";
11
11
  export * from "./vscode-tunnel.js";
12
12
  export * from "./claw.js";
13
+ export * from "./kube-error.js";
13
14
  export * from "./connectivity/types.js";
14
15
  export { connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, } from "./connectivity/error-codes.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract the HTTP status code from a Kubernetes client error.
3
+ * ApiException (v1.x) uses numeric `.code`, but raw network errors (e.g. ECONNREFUSED)
4
+ * set `.code` to a string. This helper ensures we always return a number.
5
+ */
6
+ export declare function kubeErrorStatus(error: any): number;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Extract the HTTP status code from a Kubernetes client error.
3
+ * ApiException (v1.x) uses numeric `.code`, but raw network errors (e.g. ECONNREFUSED)
4
+ * set `.code` to a string. This helper ensures we always return a number.
5
+ */
6
+ export function kubeErrorStatus(error) {
7
+ var _a;
8
+ if (typeof error.code === "number")
9
+ return error.code;
10
+ if (typeof ((_a = error.response) === null || _a === void 0 ? void 0 : _a.statusCode) === "number")
11
+ return error.response.statusCode;
12
+ return 0;
13
+ }
@@ -54,6 +54,8 @@ export interface FallbackTokensPrivate {
54
54
  token: string;
55
55
  };
56
56
  }
57
+ export type BackgroundAgentsWebhookEvent = "started" | "completed" | "error";
58
+ export type BackgroundAgentsWebhookEvents = ["all"] | BackgroundAgentsWebhookEvent[];
57
59
  interface OrganizationSettings {
58
60
  attribution?: string[];
59
61
  visualEditorAiStyleInspirationURL?: string;
@@ -92,6 +94,10 @@ interface OrganizationSettings {
92
94
  ticketAssessmentPrompt?: string;
93
95
  ticketAssessmentModel?: string;
94
96
  ticketAssessmentDailyLimit?: number;
97
+ backgroundAgentsWebhook?: {
98
+ url?: string;
99
+ events?: BackgroundAgentsWebhookEvents;
100
+ };
95
101
  }
96
102
  interface RoleOptions {
97
103
  read?: boolean;
package/src/projects.d.ts CHANGED
@@ -405,6 +405,8 @@ export interface BranchMetadata {
405
405
  description?: string;
406
406
  /** Whether the branch is a cloned branch */
407
407
  isClonedBranch?: boolean;
408
+ /** Data passed in via /agents/run api that we echo in webhook response **/
409
+ webhookContext?: Record<string, unknown>;
408
410
  [key: string]: unknown;
409
411
  }
410
412
  export type PRStatus = "open" | "closed" | "merged" | "draft" | "approved";
@@ -675,6 +677,11 @@ export interface Project {
675
677
  httpsServerHonorCipherOrder?: boolean;
676
678
  httpsServerRequestCert?: boolean;
677
679
  httpsServerRejectUnauthorized?: boolean;
680
+ /**
681
+ * When true, this project is the preferred project for its connected repository.
682
+ * Agents will pick this project when asked to do something with the connected repository.
683
+ */
684
+ isPreferredForRepo?: boolean;
678
685
  };
679
686
  screenshot: string | null;
680
687
  isExample?: boolean;
@@ -747,6 +754,7 @@ export interface OrganizationPrivate {
747
754
  createdAt: number;
748
755
  updatedAt: number;
749
756
  fallbackTokens?: FallbackTokensPrivate;
757
+ backgroundAgentsWebhookSecret?: string;
750
758
  }
751
759
  export interface CreateProjectOptions {
752
760
  name?: string;