@builder.io/ai-utils 0.41.0 → 0.42.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 +1 -1
- package/src/codegen.d.ts +57 -8
- package/src/events.d.ts +50 -10
- package/src/events.js +8 -4
- package/src/organization.d.ts +9 -6
- package/src/projects.d.ts +1 -1
package/package.json
CHANGED
package/src/codegen.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface CustomAgentDefinition {
|
|
|
49
49
|
model?: string;
|
|
50
50
|
roundRobinModels?: string[];
|
|
51
51
|
mode?: CodeGenMode;
|
|
52
|
-
position?:
|
|
52
|
+
position?: CodeGenPosition;
|
|
53
53
|
needDevServer?: boolean;
|
|
54
54
|
needValidation?: boolean;
|
|
55
55
|
includeMemories?: boolean;
|
|
@@ -264,6 +264,25 @@ export interface ReportTestOutcomeToolInput {
|
|
|
264
264
|
outcome: TestOutcome;
|
|
265
265
|
summary: string;
|
|
266
266
|
details?: string;
|
|
267
|
+
test_case_id?: string;
|
|
268
|
+
evidence_frame_count?: number;
|
|
269
|
+
failure_category?: TestCaseFailureCategory;
|
|
270
|
+
failure_detail?: string;
|
|
271
|
+
console_errors?: string;
|
|
272
|
+
network_failures?: string;
|
|
273
|
+
steps_attempted?: string;
|
|
274
|
+
urls_tested?: string[];
|
|
275
|
+
}
|
|
276
|
+
export type TestCaseFailureCategory = "env_issue" | "creds_missing" | "needs_user_input" | "server_not_ready" | "feature_not_reachable" | "timeout" | "assertion_failed" | "unexpected_error" | "not_applicable";
|
|
277
|
+
export interface RegisterTestPlanToolInput {
|
|
278
|
+
mode: "quick" | "thorough";
|
|
279
|
+
test_cases: Array<{
|
|
280
|
+
id: string;
|
|
281
|
+
description: string;
|
|
282
|
+
expected_outcome: string;
|
|
283
|
+
priority: "critical" | "high" | "medium" | "low";
|
|
284
|
+
source?: string;
|
|
285
|
+
}>;
|
|
267
286
|
}
|
|
268
287
|
export type TimelineEventCategory = "navigation" | "interaction" | "assertion" | "error" | "milestone" | "code-change" | "observation";
|
|
269
288
|
export interface TimelineEvent {
|
|
@@ -710,6 +729,7 @@ export interface CodeGenToolMap {
|
|
|
710
729
|
ReportUIIssue: ReportUIIssueToolInput;
|
|
711
730
|
ReportIssue: ReportIssueToolInput;
|
|
712
731
|
ReportTestOutcome: ReportTestOutcomeToolInput;
|
|
732
|
+
RegisterTestPlan: RegisterTestPlanToolInput;
|
|
713
733
|
VerifySetupCommand: VerifySetupCommandToolInput;
|
|
714
734
|
VerifyDevCommand: VerifyDevCommandToolInput;
|
|
715
735
|
VerifyDevServer: VerifyDevServerToolInput;
|
|
@@ -730,7 +750,7 @@ export type AllCodeGenTools = CodeGenTools | "web_search";
|
|
|
730
750
|
export type SessionMode = "planning" | "normal" | "auto-planning" | "deep-research";
|
|
731
751
|
export type CodeGenMode = "quality" | "quality-v3" | "quality-v4" | "quality-v4-agent";
|
|
732
752
|
export type QueueMode = "next-turn" | "until-idle";
|
|
733
|
-
export type BaseCodeGenPosition = "fusion" | "editor-ai" | "repo-indexing" | "cli" | "create-app-firebase" | "create-app-lovable" | "builder-code-panel" | "dsi-mcp";
|
|
753
|
+
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";
|
|
734
754
|
export type CodeGenPosition = BaseCodeGenPosition | `${BaseCodeGenPosition}-agent`;
|
|
735
755
|
export interface RepoIndexingConfig {
|
|
736
756
|
designSystems: string[];
|
|
@@ -743,7 +763,7 @@ export interface LocalMCPTools {
|
|
|
743
763
|
}
|
|
744
764
|
export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `setup-agent` | `background-${string}` | `indexing-${string}`;
|
|
745
765
|
export interface CodeGenInputOptions {
|
|
746
|
-
position:
|
|
766
|
+
position: CodeGenPosition;
|
|
747
767
|
eventName?: string;
|
|
748
768
|
sessionId: string;
|
|
749
769
|
codeGenMode?: CodeGenMode;
|
|
@@ -787,6 +807,11 @@ export interface CodeGenInputOptions {
|
|
|
787
807
|
enabledTools?: CodeGenTools[];
|
|
788
808
|
enabledMCPs?: string[];
|
|
789
809
|
skipFileDiff?: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* When true, the agent should interrupt its current task to handle this
|
|
812
|
+
* message immediately, rather than finishing the current task first.
|
|
813
|
+
*/
|
|
814
|
+
interruptActiveTask?: boolean;
|
|
790
815
|
/**
|
|
791
816
|
* Local MCP tool definitions from stdio servers (CLI-side only)
|
|
792
817
|
* These tools will be executed on the client side and passed through from the server
|
|
@@ -828,6 +853,7 @@ export interface CodeGenInputOptions {
|
|
|
828
853
|
projectId?: string;
|
|
829
854
|
branchName?: string;
|
|
830
855
|
repoHash?: string;
|
|
856
|
+
repoBranch?: string;
|
|
831
857
|
/**
|
|
832
858
|
* Server-side branch.agentType cached from middleware Firestore lookup.
|
|
833
859
|
* Used to avoid redundant getBranch calls for billing exemption checks.
|
|
@@ -914,6 +940,7 @@ export interface RankedResult {
|
|
|
914
940
|
}
|
|
915
941
|
export interface GenerateCompletionStepThinking {
|
|
916
942
|
type: "thinking";
|
|
943
|
+
content: string;
|
|
917
944
|
}
|
|
918
945
|
export interface FileInfo {
|
|
919
946
|
filePath: string;
|
|
@@ -925,10 +952,6 @@ export interface GenerateCompletionStepUserInput {
|
|
|
925
952
|
prompt: string;
|
|
926
953
|
files: FileInfo[];
|
|
927
954
|
}
|
|
928
|
-
export interface GenerateCompletionStepPlanning {
|
|
929
|
-
type: "planning";
|
|
930
|
-
content: string;
|
|
931
|
-
}
|
|
932
955
|
export interface GenerateCompletionStepUser {
|
|
933
956
|
type: "user";
|
|
934
957
|
displayPrompt: string | undefined;
|
|
@@ -1294,7 +1317,7 @@ export interface GenerateCompletionStepUpdateSetupValue {
|
|
|
1294
1317
|
};
|
|
1295
1318
|
reason: string;
|
|
1296
1319
|
}
|
|
1297
|
-
export type GenerateCompletionStep =
|
|
1320
|
+
export type GenerateCompletionStep = GenerateCompletionStepThinking | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue | GenerateCompletionStepIde;
|
|
1298
1321
|
export interface ApplyActionsResult {
|
|
1299
1322
|
filePath: string;
|
|
1300
1323
|
addedLines: number;
|
|
@@ -2337,6 +2360,7 @@ export interface LaunchInitializeSessionOptions {
|
|
|
2337
2360
|
sessionId?: string;
|
|
2338
2361
|
customInstructions?: CustomInstruction[];
|
|
2339
2362
|
privacyMode?: PrivacyMode;
|
|
2363
|
+
forceSessionReload?: boolean;
|
|
2340
2364
|
}
|
|
2341
2365
|
/**
|
|
2342
2366
|
* Request for generating a commit message via LLM
|
|
@@ -2369,3 +2393,28 @@ export interface TodoItem {
|
|
|
2369
2393
|
status: "pending" | "in_progress" | "completed";
|
|
2370
2394
|
id: string;
|
|
2371
2395
|
}
|
|
2396
|
+
export interface SessionData {
|
|
2397
|
+
lastCompletionId: string | undefined;
|
|
2398
|
+
ownerId: string;
|
|
2399
|
+
initialUrl?: string;
|
|
2400
|
+
contentOrProjectId?: string;
|
|
2401
|
+
createdAt: number;
|
|
2402
|
+
createdBy?: string;
|
|
2403
|
+
updatedAt: number;
|
|
2404
|
+
lastUpdatedBy?: string;
|
|
2405
|
+
beforeCommit?: GitSnapshot;
|
|
2406
|
+
title?: string;
|
|
2407
|
+
id: string;
|
|
2408
|
+
sessionMode: SessionMode;
|
|
2409
|
+
projectId: string | undefined;
|
|
2410
|
+
branchName: string | undefined;
|
|
2411
|
+
repoHash: string | undefined;
|
|
2412
|
+
repoBranch: string | undefined;
|
|
2413
|
+
description?: string;
|
|
2414
|
+
hasPlanToApply?: boolean;
|
|
2415
|
+
cost: number;
|
|
2416
|
+
totalCompletions: number;
|
|
2417
|
+
numUserMessages: number;
|
|
2418
|
+
numNormalUserMessages: number;
|
|
2419
|
+
metadata?: Record<string, any>;
|
|
2420
|
+
}
|
package/src/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BuilderContent, BuilderElement } from "@builder.io/sdk";
|
|
2
2
|
import type { AssistantMessage, AssistantMessageAction } from "./messages.js";
|
|
3
3
|
import type { AssistantSettings } from "./settings.js";
|
|
4
|
-
import type { ExitState, UserSource } from "./codegen.js";
|
|
4
|
+
import type { ExitState, UserSource, CodeGenPosition } from "./codegen.js";
|
|
5
5
|
import type { FileUpload } from "./messages.js";
|
|
6
6
|
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void;
|
|
7
7
|
export type BuilderAssistantEvent = AssistantCompletionResultEvent | AssistantErrorEvent | AssistantStreamErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppMessageEditCustomInstructionsEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptSubmitEvent | AppReadyEvent | AppSettingsSetEvent | AppThreadNewEvent | AssistantStatsEvent | AssistantThemeEvent | BuilderEditorAuthEvent | BuilderEditorStateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ModelUndoEvent | ModelRedoEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageCompletedEvent | ThreadMessageCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageFeedbackEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent | AppAcceptChangeEvent | AppAcceptRejectEvent | AssistantTrackEvent | AssistantEditorAuthMessage | AppAttachmentTemplateEvent | AppPasteSmartExportEvent | ThreadMessageRetryEvent | AppFigmaImportEvent | AppWebImportEvent | AppMcpServersEvent | AssistantContentInitialEvent | ThreadMessageSummaryEvent | ThreadMessageSummaryCodegenDeltaEvent | ThreadMessageThinkingDeltaEvent | AssistantHeartbeatEvent | ShowUpgradeDialogEvent | AssistantFusionSuggestionEvent | AppNavigateToFusionEvent | ModelPermissionRequiredEvent | ModelPermissionResponseEvent;
|
|
@@ -505,6 +505,44 @@ export declare const GitPrMergedV1: {
|
|
|
505
505
|
eventName: "git.pr.merged";
|
|
506
506
|
version: "1";
|
|
507
507
|
};
|
|
508
|
+
export type ReviewSubmittedV1 = FusionEventVariant<"review.submitted", {
|
|
509
|
+
projectId: string;
|
|
510
|
+
branchName: string;
|
|
511
|
+
repoFullName: string;
|
|
512
|
+
prNumber: number;
|
|
513
|
+
commitSha: string;
|
|
514
|
+
/** Firestore doc ID (deterministic — config.id or generated upfront) */
|
|
515
|
+
reviewDocId: string;
|
|
516
|
+
/** GitHub review ID (empty string for clean reviews) */
|
|
517
|
+
reviewId: string;
|
|
518
|
+
/** Session ID for cost tracking (empty if unavailable) */
|
|
519
|
+
sessionId: string;
|
|
520
|
+
summary: string;
|
|
521
|
+
/** Whether this review includes a visual recording */
|
|
522
|
+
hasRecording?: boolean;
|
|
523
|
+
/** Recording URL if hasRecording is true */
|
|
524
|
+
recordingUrl?: string;
|
|
525
|
+
/** Posted comments from GitHub API */
|
|
526
|
+
postedComments: Array<{
|
|
527
|
+
id: number;
|
|
528
|
+
node_id: string;
|
|
529
|
+
thread_node_id: string;
|
|
530
|
+
path: string;
|
|
531
|
+
line: number | null;
|
|
532
|
+
start_line?: number | null;
|
|
533
|
+
body: string;
|
|
534
|
+
}>;
|
|
535
|
+
riskLevel: "high" | "medium" | "low";
|
|
536
|
+
totalIssuesSubmitted: number;
|
|
537
|
+
issuesPosted: number;
|
|
538
|
+
issuesHigh: number;
|
|
539
|
+
issuesMedium: number;
|
|
540
|
+
issuesDropped: number;
|
|
541
|
+
}, {}, 1>;
|
|
542
|
+
export declare const ReviewSubmittedV1: {
|
|
543
|
+
eventName: "review.submitted";
|
|
544
|
+
version: "1";
|
|
545
|
+
};
|
|
508
546
|
export type BotMentionExternalPrV1 = FusionEventVariant<"bot.mention.external-pr", {
|
|
509
547
|
projectId: string;
|
|
510
548
|
repoFullName: string;
|
|
@@ -639,6 +677,7 @@ export declare const CodegenCompletionV1: {
|
|
|
639
677
|
version: "1";
|
|
640
678
|
};
|
|
641
679
|
export type CodegenUserPromptV1 = FusionEventVariant<"codegen.user.prompt", {
|
|
680
|
+
position: CodeGenPosition;
|
|
642
681
|
completionId: string;
|
|
643
682
|
role?: string;
|
|
644
683
|
projectId?: string;
|
|
@@ -678,7 +717,8 @@ export type FusionBranchCreatedV1 = FusionEventVariant<"fusion.branch.created",
|
|
|
678
717
|
projectId: string;
|
|
679
718
|
branchName: string;
|
|
680
719
|
branchFriendlyName?: string;
|
|
681
|
-
|
|
720
|
+
createdBy: string;
|
|
721
|
+
actor?: string;
|
|
682
722
|
}, {
|
|
683
723
|
projectId: string;
|
|
684
724
|
branchName: string;
|
|
@@ -687,7 +727,7 @@ export declare const FusionBranchCreatedV1: {
|
|
|
687
727
|
eventName: "fusion.branch.created";
|
|
688
728
|
version: "1";
|
|
689
729
|
};
|
|
690
|
-
export type
|
|
730
|
+
export type FusionContainerStartedV1 = FusionEventVariant<"fusion.container.started", {
|
|
691
731
|
projectId: string;
|
|
692
732
|
branchName: string;
|
|
693
733
|
url: string;
|
|
@@ -695,26 +735,26 @@ export type FusionBranchContainerStartedV1 = FusionEventVariant<"fusion.branch.c
|
|
|
695
735
|
projectId: string;
|
|
696
736
|
branchName: string;
|
|
697
737
|
}, 1>;
|
|
698
|
-
export declare const
|
|
699
|
-
eventName: "fusion.
|
|
738
|
+
export declare const FusionContainerStartedV1: {
|
|
739
|
+
eventName: "fusion.container.started";
|
|
700
740
|
version: "1";
|
|
701
741
|
};
|
|
702
|
-
export type
|
|
742
|
+
export type FusionContainerFailedV1 = FusionEventVariant<"fusion.container.failed", {
|
|
703
743
|
projectId: string;
|
|
704
744
|
branchName: string;
|
|
745
|
+
error: string;
|
|
705
746
|
}, {
|
|
706
747
|
projectId: string;
|
|
707
748
|
branchName: string;
|
|
708
749
|
}, 1>;
|
|
709
|
-
export declare const
|
|
710
|
-
eventName: "fusion.
|
|
750
|
+
export declare const FusionContainerFailedV1: {
|
|
751
|
+
eventName: "fusion.container.failed";
|
|
711
752
|
version: "1";
|
|
712
753
|
};
|
|
713
754
|
export type FusionBranchFailedV1 = FusionEventVariant<"fusion.branch.failed", {
|
|
714
755
|
projectId: string;
|
|
715
756
|
branchName?: string;
|
|
716
757
|
error: string;
|
|
717
|
-
phase: string;
|
|
718
758
|
}, {
|
|
719
759
|
projectId: string;
|
|
720
760
|
branchName?: string;
|
|
@@ -756,7 +796,7 @@ export interface SendMessageToOrgAgentInput {
|
|
|
756
796
|
*/
|
|
757
797
|
autoCreateProject?: boolean;
|
|
758
798
|
}
|
|
759
|
-
export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 |
|
|
799
|
+
export type FusionEvent = AiTaskCompletedEvent | AiTaskFailedEvent | ClientDevtoolsSessionStartedEvent | ClientDevtoolsSessionIdleEventV1 | FusionProjectCreatedV1 | SetupAgentCompletedV1 | GitPrMergedV1 | GitPrCreatedV1 | GitPrClosedV1 | ForceSetupAgentV1 | ClawMessageSentV1 | CodegenCompletionV1 | CodegenUserPromptV1 | GitWebhooksRegisterV1 | FusionProjectSettingsUpdatedV1 | VideoRecordingCompletedV1 | FusionBranchCreatedV1 | FusionContainerStartedV1 | FusionContainerFailedV1 | FusionBranchFailedV1 | BotMentionExternalPrV1 | ReviewSubmittedV1;
|
|
760
800
|
export interface ModelPermissionRequiredEvent {
|
|
761
801
|
type: "assistant.model.permission.required";
|
|
762
802
|
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 ReviewSubmittedV1 = {
|
|
22
|
+
eventName: "review.submitted",
|
|
23
|
+
version: "1",
|
|
24
|
+
};
|
|
21
25
|
export const BotMentionExternalPrV1 = {
|
|
22
26
|
eventName: "bot.mention.external-pr",
|
|
23
27
|
version: "1",
|
|
@@ -66,12 +70,12 @@ export const FusionBranchCreatedV1 = {
|
|
|
66
70
|
eventName: "fusion.branch.created",
|
|
67
71
|
version: "1",
|
|
68
72
|
};
|
|
69
|
-
export const
|
|
70
|
-
eventName: "fusion.
|
|
73
|
+
export const FusionContainerStartedV1 = {
|
|
74
|
+
eventName: "fusion.container.started",
|
|
71
75
|
version: "1",
|
|
72
76
|
};
|
|
73
|
-
export const
|
|
74
|
-
eventName: "fusion.
|
|
77
|
+
export const FusionContainerFailedV1 = {
|
|
78
|
+
eventName: "fusion.container.failed",
|
|
75
79
|
version: "1",
|
|
76
80
|
};
|
|
77
81
|
export const FusionBranchFailedV1 = {
|
package/src/organization.d.ts
CHANGED
|
@@ -54,8 +54,14 @@ export interface FallbackTokensPrivate {
|
|
|
54
54
|
token: string;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
export type
|
|
58
|
-
export type
|
|
57
|
+
export type FusionWebhookEvent = "background.agent.started" | "background.agent.completed" | "background.agent.error";
|
|
58
|
+
export type FusionWebhookEvents = ["all"] | FusionWebhookEvent[];
|
|
59
|
+
export interface FusionWebhook {
|
|
60
|
+
id: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
url: string;
|
|
63
|
+
events: FusionWebhookEvents;
|
|
64
|
+
}
|
|
59
65
|
interface OrganizationSettings {
|
|
60
66
|
attribution?: string[];
|
|
61
67
|
visualEditorAiStyleInspirationURL?: string;
|
|
@@ -94,10 +100,7 @@ interface OrganizationSettings {
|
|
|
94
100
|
ticketAssessmentPrompt?: string;
|
|
95
101
|
ticketAssessmentModel?: string;
|
|
96
102
|
ticketAssessmentDailyLimit?: number;
|
|
97
|
-
|
|
98
|
-
url?: string;
|
|
99
|
-
events?: BackgroundAgentsWebhookEvents;
|
|
100
|
-
};
|
|
103
|
+
fusionWebhooks?: FusionWebhook[];
|
|
101
104
|
}
|
|
102
105
|
interface RoleOptions {
|
|
103
106
|
read?: boolean;
|
package/src/projects.d.ts
CHANGED
|
@@ -754,7 +754,7 @@ export interface OrganizationPrivate {
|
|
|
754
754
|
createdAt: number;
|
|
755
755
|
updatedAt: number;
|
|
756
756
|
fallbackTokens?: FallbackTokensPrivate;
|
|
757
|
-
|
|
757
|
+
fusionWebhookSecrets?: Record<string, string>;
|
|
758
758
|
}
|
|
759
759
|
export interface CreateProjectOptions {
|
|
760
760
|
name?: string;
|