@builder.io/ai-utils 0.44.5 → 0.45.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.44.5",
3
+ "version": "0.45.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -747,7 +747,8 @@ export type AllCodeGenTools = CodeGenTools | "web_search";
747
747
  export type SessionMode = "planning" | "normal" | "auto-planning" | "deep-research";
748
748
  export type CodeGenMode = "quality" | "quality-v3" | "quality-v4" | "quality-v4-agent";
749
749
  export type QueueMode = "next-turn" | "until-idle";
750
- export type BaseCodeGenPosition = "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" | "unknown" | "dsi-mcp";
750
+ 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", "unknown", "dsi-mcp"];
751
+ export type BaseCodeGenPosition = (typeof BASE_CODEGEN_POSITIONS)[number];
751
752
  export type CodeGenPosition = BaseCodeGenPosition | `${BaseCodeGenPosition}-agent`;
752
753
  export interface RepoIndexingConfig {
753
754
  designSystems: string[];
@@ -955,6 +956,7 @@ export interface GenerateCompletionStepUserInput {
955
956
  }
956
957
  export interface GenerateCompletionStepUser {
957
958
  type: "user";
959
+ previousId: string | undefined;
958
960
  displayPrompt: string | undefined;
959
961
  attachments?: Array<Attachment>;
960
962
  id?: string;
@@ -962,6 +964,7 @@ export interface GenerateCompletionStepUser {
962
964
  role: "user" | "agent";
963
965
  idempotencyKey?: string;
964
966
  compacting: boolean;
967
+ sessionMode: SessionMode;
965
968
  }
966
969
  export interface GenerateCompletionStepFile {
967
970
  type: "file";
@@ -1395,8 +1398,12 @@ export interface GenerateUserMessage {
1395
1398
  agentType?: string;
1396
1399
  /** Enable AddQAReview tool for QA PR review branches */
1397
1400
  enableQAReviewTool?: boolean;
1401
+ /** Per-message reasoning effort override */
1402
+ reasoning?: ReasoningEffort;
1398
1403
  /** @deprecated */
1399
1404
  repair?: boolean;
1405
+ /** Force compaction of the conversation before generating the next completion */
1406
+ forceCompact?: boolean;
1400
1407
  }
1401
1408
  export interface UserInput {
1402
1409
  userMessage: GenerateUserMessage | undefined;
@@ -1411,6 +1418,7 @@ export interface UserInput {
1411
1418
  user: UserSource;
1412
1419
  patchFusionConfig?: Partial<FusionConfig> | undefined;
1413
1420
  modelOverride?: string;
1421
+ reasoning?: ReasoningEffort;
1414
1422
  agentModelOverrides?: AgentModelOverrides;
1415
1423
  category?: CodeGenCategory;
1416
1424
  enabledMCPs?: string[];
@@ -1532,11 +1540,13 @@ export interface GenerateCodeEventPing {
1532
1540
  export interface GenerateCodeEventUser {
1533
1541
  type: "user";
1534
1542
  id: string;
1543
+ previousId: string | undefined;
1535
1544
  displayPrompt: string | undefined;
1536
1545
  user: UserSource;
1546
+ compacting: boolean;
1547
+ sessionMode: SessionMode;
1537
1548
  /** @deprecated */
1538
1549
  role: "user" | "agent";
1539
- compacting: boolean;
1540
1550
  }
1541
1551
  export interface MCPClientStatus {
1542
1552
  status: "ok" | "error" | "disabled" | "auth_required" | "auth_error";
package/src/codegen.js CHANGED
@@ -1 +1,17 @@
1
- export {};
1
+ export const BASE_CODEGEN_POSITIONS = [
2
+ "fusion",
3
+ "editor-ai",
4
+ "repo-indexing",
5
+ "cli",
6
+ "create-app-firebase",
7
+ "create-app-lovable",
8
+ "builder-code-panel",
9
+ "setup-project",
10
+ "code-review-orchestrator",
11
+ "project-configuration",
12
+ "org-agent",
13
+ "browser-testing",
14
+ "projects-scheduler-memory-extraction",
15
+ "unknown",
16
+ "dsi-mcp",
17
+ ];
package/src/events.d.ts CHANGED
@@ -395,6 +395,8 @@ export interface ThreadMessageCompleted extends AssistantMessage {
395
395
  platformId: string;
396
396
  threadId: string;
397
397
  commitId?: string;
398
+ creditsUsed?: number;
399
+ model?: string;
398
400
  }
399
401
  export interface ThreadRunStepDeltaEvent {
400
402
  type: "assistant.thread.run.step.delta";
@@ -452,26 +454,6 @@ export type FusionEventVariant<EventName extends string, ExtraData extends Recor
452
454
  eventName: EventName;
453
455
  };
454
456
  };
455
- export type AiTaskCompletedEvent = FusionEventVariant<"ai.task.completed", {
456
- durationMs?: number;
457
- success: boolean;
458
- }, {
459
- taskId: string;
460
- }, 1>;
461
- export declare const AiTaskCompletedEvent: {
462
- eventName: "ai.task.completed";
463
- version: "1";
464
- };
465
- export type AiTaskFailedEvent = FusionEventVariant<"ai.task.failed", {
466
- durationMs?: number;
467
- error: string;
468
- }, {
469
- taskId: string;
470
- }, 1>;
471
- export declare const AiTaskFailedEvent: {
472
- eventName: "ai.task.failed";
473
- version: "1";
474
- };
475
457
  export type GitPrCreatedV1 = FusionEventVariant<"git.pr.created", {
476
458
  projectId: string;
477
459
  branchName: string;
@@ -594,6 +576,8 @@ export type ClientDevtoolsSessionIdleEventV1 = FusionEventVariant<"client.devtoo
594
576
  sessionMode?: string;
595
577
  gifId?: string;
596
578
  planContent?: string;
579
+ completionId?: string;
580
+ credits?: number;
597
581
  }, {
598
582
  projectId?: string;
599
583
  branchName?: string;
@@ -867,7 +851,7 @@ export declare const ClientDevtoolsToolResultV1: {
867
851
  eventName: "client.devtools.tool.result";
868
852
  version: "1";
869
853
  };
870
- export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionExternalPrV1 | ReviewSubmittedV1 | PrReviewRequestedV1;
854
+ export type FusionEvent = ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | ClientDevtoolsToolCallRequestV1 | ClientDevtoolsToolCallV1 | ClientDevtoolsToolResultV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionExternalPrV1 | ReviewSubmittedV1 | PrReviewRequestedV1;
871
855
  export interface ModelPermissionRequiredEvent {
872
856
  type: "assistant.model.permission.required";
873
857
  data: {
package/src/events.js CHANGED
@@ -1,11 +1,3 @@
1
- export const AiTaskCompletedEvent = {
2
- eventName: "ai.task.completed",
3
- version: "1",
4
- };
5
- export const AiTaskFailedEvent = {
6
- eventName: "ai.task.failed",
7
- version: "1",
8
- };
9
1
  export const GitPrCreatedV1 = {
10
2
  eventName: "git.pr.created",
11
3
  version: "1",
package/src/messages.d.ts CHANGED
@@ -224,7 +224,7 @@ export interface UserMessageParam {
224
224
  /**
225
225
  * The contents of the user message.
226
226
  */
227
- content: string | (ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemToolResult)[];
227
+ content: string | ContentUserMessageItem[];
228
228
  responseId?: string;
229
229
  /**
230
230
  * The role of the messages author, in this case `user`.
@@ -232,6 +232,7 @@ export interface UserMessageParam {
232
232
  role: "user";
233
233
  id?: string;
234
234
  }
235
+ export type ContentUserMessageItem = ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemToolResult;
235
236
  export type AssistantMessageAction = "new-chat";
236
237
  export interface AssistantMessageParam {
237
238
  /**