@builder.io/ai-utils 0.52.0 → 0.53.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.52.0",
3
+ "version": "0.53.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
@@ -21,5 +21,8 @@
21
21
  "types": "./src/connectivity/browser.d.ts",
22
22
  "import": "./src/connectivity/browser.js"
23
23
  }
24
+ },
25
+ "dependencies": {
26
+ "zod": "^4.4.3"
24
27
  }
25
28
  }
package/src/codegen.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  import type { Attachment, ContentMessageItemToolResult } from "./messages";
2
3
  import type { BuilderContent } from "./completion";
3
4
  import type { Options as PrettierOptions } from "prettier";
@@ -36,7 +37,13 @@ export interface CustomInstruction {
36
37
  userInvocable?: boolean;
37
38
  }
38
39
  /** Reasoning effort level for LLM completions. */
39
- export type ReasoningEffort = "low" | "medium" | "high" | "minimal";
40
+ export declare const ReasoningEffortSchema: z.ZodEnum<{
41
+ low: "low";
42
+ medium: "medium";
43
+ high: "high";
44
+ minimal: "minimal";
45
+ }>;
46
+ export type ReasoningEffort = z.infer<typeof ReasoningEffortSchema>;
40
47
  export interface CustomAgentInfo {
41
48
  name: string;
42
49
  description?: string;
@@ -652,6 +659,16 @@ export interface SendMessageToolInput {
652
659
  * Default to false (text) for all text-originated messages.
653
660
  */
654
661
  voice_response?: boolean;
662
+ /**
663
+ * Builder.io user ID this message is from / should be attributed to. Only
664
+ * allowed when channel_id is 'builder/branch/{project_id}/{branch_name}'.
665
+ * When set, the message is delivered to the target branch as coming from
666
+ * this user (role 'user') instead of from the agent. Use whenever the
667
+ * message represents user feedback/intent that should be assigned to
668
+ * someone — even if it was composed, summarized, or merged from multiple
669
+ * people.
670
+ */
671
+ from_user_id?: string;
655
672
  }
656
673
  export interface SpawnBranchToolInput {
657
674
  project_id: string;
@@ -662,6 +679,7 @@ export interface SpawnBranchToolInput {
662
679
  session_mode?: "normal" | "planning" | "deep-research";
663
680
  model?: "auto" | "opus" | "sonnet" | "haiku";
664
681
  attachment_urls?: string[];
682
+ git_base_branch?: string;
665
683
  }
666
684
  export interface CreateProjectToolInput {
667
685
  repo_url: string;
@@ -928,10 +946,13 @@ export interface CodeGenInputOptions {
928
946
  * @internal - Set by middleware, not by clients
929
947
  */
930
948
  branchAgentTypeChecked?: boolean;
949
+ /** Immediate parent session id when this completion runs inside a sub-agent. */
950
+ parentSessionId?: string;
931
951
  /**
932
- * The parent session ID, used to roll up sub-agent costs into the parent session's extraCost.
952
+ * Root session of the agent tree. Sub-agents inherit this from their parent
953
+ * so cost rolls up to the root in one hop, regardless of nesting depth.
933
954
  */
934
- parentSessionId?: string;
955
+ mainSessionId?: string;
935
956
  /** @deprecated */
936
957
  prevId?: string;
937
958
  /** @deprecated */
@@ -2077,6 +2098,7 @@ export interface InitState {
2077
2098
  }[];
2078
2099
  }
2079
2100
  export type LaunchServerState = "initial" | "init-running" | "init-complete" | "ready" | "active-session" | "init-error" | "session-error" | "error" | "closing";
2101
+ export type LaunchServerPhase = "state-created" | "server-starting" | "server-error" | "server-listening" | "dev-server-configured" | "dev-server-error" | "setup-command-waiting" | "setup-command-error" | "launch-server-setup" | "websocket-ready" | "state-ready" | "editor-url-building" | "editor-url-ready" | "editor-ready" | "launch-error";
2080
2102
  export interface LaunchServerStatus {
2081
2103
  status: "ok";
2082
2104
  state: LaunchServerState;
@@ -2085,12 +2107,17 @@ export interface LaunchServerStatus {
2085
2107
  isFinalState: boolean;
2086
2108
  httpServerState?: HttpServerState;
2087
2109
  editorReady: boolean;
2110
+ editorReadyAt?: number;
2111
+ editorReadySource?: string;
2088
2112
  initState?: InitState;
2089
2113
  initStatusLogs?: InitStatusLog[];
2090
2114
  errorMessage?: string;
2091
2115
  devToolsVersion: string;
2092
2116
  lastRequestTime: number;
2093
2117
  startTime: number;
2118
+ processId: number;
2119
+ launchPhase?: LaunchServerPhase;
2120
+ launchPhaseUpdatedAt?: number;
2094
2121
  machine?: MachineConfig;
2095
2122
  projectId?: string;
2096
2123
  detectedServerUrl?: string;
@@ -2126,12 +2153,17 @@ export interface FusionStatus {
2126
2153
  setupState: SetupCommandState | undefined;
2127
2154
  devState: DevCommandState | undefined;
2128
2155
  editorReady: boolean;
2156
+ editorReadyAt: number | undefined;
2157
+ editorReadySource: string | undefined;
2129
2158
  httpServerState: HttpServerState | undefined;
2130
2159
  initState: InitState | undefined;
2131
2160
  errorMessage: string | undefined;
2132
2161
  devToolsVersion: string;
2133
2162
  idleTime: number;
2134
2163
  upTime: number;
2164
+ processId: number;
2165
+ launchPhase: LaunchServerPhase | undefined;
2166
+ launchPhaseUpdatedAt: number | undefined;
2135
2167
  machine: MachineConfig | undefined;
2136
2168
  projectId: string | undefined;
2137
2169
  detectedServerUrl: string | undefined;
@@ -2507,8 +2539,16 @@ export interface SessionData {
2507
2539
  cost: number;
2508
2540
  /** Cost from tools (e.g. WebSearch LLM calls) and sub-agent roll-ups. Total session cost = cost + extraCost. */
2509
2541
  extraCost?: number;
2510
- /** If set, this session is a sub-agent of the given parent session. Used to avoid double-counting in aggregations. */
2542
+ /** Immediate parent when this session is a sub-agent. */
2511
2543
  parentSessionId?: string;
2544
+ /**
2545
+ * Root of the agent tree this session belongs to. Sub-agents inherit
2546
+ * `mainSessionId` from their parent so cost can roll up directly to the
2547
+ * top in one hop, regardless of nesting depth.
2548
+ */
2549
+ mainSessionId?: string;
2550
+ /** Agent role (e.g. "code-review-orchestrator", "browser-testing"). */
2551
+ position?: string;
2512
2552
  /** Credits from tools (e.g. WebSearch LLM calls) and sub-agent roll-ups. Total session credits = per-completion tokenCreditsUsed + extraCreditsConsumed. */
2513
2553
  extraCreditsConsumed?: number;
2514
2554
  totalCompletions: number;
package/src/codegen.js CHANGED
@@ -1,3 +1,8 @@
1
+ import { z } from "zod";
2
+ /** Reasoning effort level for LLM completions. */
3
+ export const ReasoningEffortSchema = z
4
+ .enum(["low", "medium", "high", "minimal"])
5
+ .meta({ title: "ReasoningEffort" });
1
6
  export const BASE_CODEGEN_POSITIONS = [
2
7
  "fusion",
3
8
  "editor-ai",
@@ -84,6 +84,8 @@ interface OrganizationSettings {
84
84
  fusionShareableUrlSuffix?: string;
85
85
  autoDetectDevServerPatterns?: string[];
86
86
  environmentVariables?: EnvironmentVariable[];
87
+ projectsUseGithubServerToken?: boolean;
88
+ prAuthoringMode?: "" | "prefer-user" | "always-bot" | "always-user";
87
89
  fusionPrLabel?: string;
88
90
  fusionPrQuietMode?: boolean;
89
91
  runInPty?: boolean;
package/src/projects.d.ts CHANGED
@@ -367,6 +367,13 @@ export interface PartialBranchData {
367
367
  type?: BranchType | null;
368
368
  /** Auto-assigned category based on the user prompt (feature, fix, research, other) */
369
369
  category?: BranchCategory | null;
370
+ /**
371
+ * Optional short words derived from the user prompt, used opportunistically
372
+ * by `generateBranchName` to make the auto-generated branch name human-readable
373
+ * (e.g. ["add", "user", "settings"] → "add-user-settings-x1y2z3a4"). A random
374
+ * suffix is appended to prevent collisions. Ignored when `name` is provided.
375
+ */
376
+ nameWords?: string[];
370
377
  cloneFrom?: {
371
378
  projectId: string;
372
379
  branchName: string;