@builder.io/ai-utils 0.53.0 → 0.54.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.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -828,7 +828,13 @@ export interface GetLastBrowserTestToolInput {
828
828
  export type CodeGenTools = keyof CodeGenToolMap;
829
829
  export type AllCodeGenTools = CodeGenTools | "web_search";
830
830
  export type SessionMode = "planning" | "normal" | "auto-planning" | "deep-research";
831
- export type CodeGenMode = "quality" | "quality-v3" | "quality-v4" | "quality-v4-agent";
831
+ export type CodeGenMode = "quality" | "quality-v3" | "quality-v4"
832
+ /**
833
+ * @deprecated Use `quality-v4` instead. Kept for backwards compatibility
834
+ * with older dev-tools clients in the wild that may still request this mode
835
+ * for sub-agents. New code should not produce this value.
836
+ */
837
+ | "quality-v4-agent";
832
838
  export type QueueMode = "next-turn" | "until-idle";
833
839
  export declare const BASE_CODEGEN_POSITIONS: readonly ["fusion", "editor-ai", "repo-indexing", "cli", "create-app-firebase", "create-app-lovable", "builder-code-panel", "setup-project", "code-review-orchestrator", "project-configuration", "org-agent", "browser-testing", "projects-scheduler-memory-extraction", "builder-code", "unknown", "dsi-mcp"];
834
840
  export type BaseCodeGenPosition = (typeof BASE_CODEGEN_POSITIONS)[number];
@@ -946,10 +952,13 @@ export interface CodeGenInputOptions {
946
952
  * @internal - Set by middleware, not by clients
947
953
  */
948
954
  branchAgentTypeChecked?: boolean;
955
+ /** Immediate parent session id when this completion runs inside a sub-agent. */
956
+ parentSessionId?: string;
949
957
  /**
950
- * The parent session ID, used to roll up sub-agent costs into the parent session's extraCost.
958
+ * Root session of the agent tree. Sub-agents inherit this from their parent
959
+ * so cost rolls up to the root in one hop, regardless of nesting depth.
951
960
  */
952
- parentSessionId?: string;
961
+ mainSessionId?: string;
953
962
  /** @deprecated */
954
963
  prevId?: string;
955
964
  /** @deprecated */
@@ -2536,8 +2545,16 @@ export interface SessionData {
2536
2545
  cost: number;
2537
2546
  /** Cost from tools (e.g. WebSearch LLM calls) and sub-agent roll-ups. Total session cost = cost + extraCost. */
2538
2547
  extraCost?: number;
2539
- /** If set, this session is a sub-agent of the given parent session. Used to avoid double-counting in aggregations. */
2548
+ /** Immediate parent when this session is a sub-agent. */
2540
2549
  parentSessionId?: string;
2550
+ /**
2551
+ * Root of the agent tree this session belongs to. Sub-agents inherit
2552
+ * `mainSessionId` from their parent so cost can roll up directly to the
2553
+ * top in one hop, regardless of nesting depth.
2554
+ */
2555
+ mainSessionId?: string;
2556
+ /** Agent role (e.g. "code-review-orchestrator", "browser-testing"). */
2557
+ position?: string;
2541
2558
  /** Credits from tools (e.g. WebSearch LLM calls) and sub-agent roll-ups. Total session credits = per-completion tokenCreditsUsed + extraCreditsConsumed. */
2542
2559
  extraCreditsConsumed?: number;
2543
2560
  totalCompletions: number;
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;