@builder.io/ai-utils 0.87.0 → 0.88.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/builder-config.d.ts +22 -0
- package/src/builder-config.js +16 -0
- package/src/codegen.d.ts +26 -45
- package/src/codegen.js +5 -8
- package/src/events.d.ts +10 -0
- package/src/fusion-environment.d.ts +5 -0
- package/src/fusion-environment.js +16 -0
- package/src/fusion-environment.test.d.ts +1 -0
- package/src/fusion-environment.test.js +40 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/organization.d.ts +5 -1
- package/src/projects.d.ts +17 -0
package/package.json
CHANGED
package/src/builder-config.d.ts
CHANGED
|
@@ -34,6 +34,22 @@ export declare const BuilderConfigHostingSchema: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strip>>>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export type BuilderConfigHosting = z.infer<typeof BuilderConfigHostingSchema>;
|
|
37
|
+
/**
|
|
38
|
+
* `realtime` block in `builder.config.json` — selects the change-notification
|
|
39
|
+
* delivery transport. `"local"` (default) keeps sync on the app's own
|
|
40
|
+
* `/_agent-native/poll` + `/_agent-native/events`; `"hosted"` routes clients to
|
|
41
|
+
* the Builder Realtime Gateway. Read by the backend provisioning path only —
|
|
42
|
+
* it is never shipped to the browser (the client learns transport via the
|
|
43
|
+
* impersonal `window.__AGENT_NATIVE_CONFIG__` script). See the Agent-Native
|
|
44
|
+
* Realtime Sync spec.
|
|
45
|
+
*/
|
|
46
|
+
export declare const BuilderConfigRealtimeSchema: z.ZodObject<{
|
|
47
|
+
transport: z.ZodEnum<{
|
|
48
|
+
hosted: "hosted";
|
|
49
|
+
local: "local";
|
|
50
|
+
}>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type BuilderConfigRealtime = z.infer<typeof BuilderConfigRealtimeSchema>;
|
|
37
53
|
export declare const BuilderConfigSchema: z.ZodObject<{
|
|
38
54
|
database: z.ZodOptional<z.ZodObject<{
|
|
39
55
|
kind: z.ZodLiteral<"postgres">;
|
|
@@ -49,5 +65,11 @@ export declare const BuilderConfigSchema: z.ZodObject<{
|
|
|
49
65
|
prod: z.ZodCatch<z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodString>>>>;
|
|
50
66
|
}, z.core.$strip>>>;
|
|
51
67
|
}, z.core.$strip>>;
|
|
68
|
+
realtime: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
69
|
+
transport: z.ZodEnum<{
|
|
70
|
+
hosted: "hosted";
|
|
71
|
+
local: "local";
|
|
72
|
+
}>;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
52
74
|
}, z.core.$strip>;
|
|
53
75
|
export type BuilderConfig = z.infer<typeof BuilderConfigSchema>;
|
package/src/builder-config.js
CHANGED
|
@@ -57,7 +57,23 @@ export const BuilderConfigHostingSchema = z.object({
|
|
|
57
57
|
buildOutputDir: z.string().optional().catch(undefined),
|
|
58
58
|
environment: BuilderConfigHostingEnvironmentSchema.optional().catch(undefined),
|
|
59
59
|
});
|
|
60
|
+
/**
|
|
61
|
+
* `realtime` block in `builder.config.json` — selects the change-notification
|
|
62
|
+
* delivery transport. `"local"` (default) keeps sync on the app's own
|
|
63
|
+
* `/_agent-native/poll` + `/_agent-native/events`; `"hosted"` routes clients to
|
|
64
|
+
* the Builder Realtime Gateway. Read by the backend provisioning path only —
|
|
65
|
+
* it is never shipped to the browser (the client learns transport via the
|
|
66
|
+
* impersonal `window.__AGENT_NATIVE_CONFIG__` script). See the Agent-Native
|
|
67
|
+
* Realtime Sync spec.
|
|
68
|
+
*/
|
|
69
|
+
export const BuilderConfigRealtimeSchema = z.object({
|
|
70
|
+
transport: z.enum(["local", "hosted"]),
|
|
71
|
+
});
|
|
60
72
|
export const BuilderConfigSchema = z.object({
|
|
61
73
|
database: BuilderConfigDatabaseSchema.optional(),
|
|
62
74
|
hosting: BuilderConfigHostingSchema.optional(),
|
|
75
|
+
// `.catch(undefined)` (like the `hosting` fields): a malformed `realtime`
|
|
76
|
+
// block degrades to "no realtime" rather than failing the whole parse and
|
|
77
|
+
// discarding a valid `database` block.
|
|
78
|
+
realtime: BuilderConfigRealtimeSchema.optional().catch(undefined),
|
|
63
79
|
});
|
package/src/codegen.d.ts
CHANGED
|
@@ -2433,8 +2433,6 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2433
2433
|
planning: "planning";
|
|
2434
2434
|
}>>;
|
|
2435
2435
|
url: z.ZodOptional<z.ZodString>;
|
|
2436
|
-
diffActions: z.ZodOptional<z.ZodBoolean>;
|
|
2437
|
-
planningPrompt: z.ZodOptional<z.ZodBoolean>;
|
|
2438
2436
|
customInstructions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2439
2437
|
id: z.ZodString;
|
|
2440
2438
|
name: z.ZodString;
|
|
@@ -2485,7 +2483,6 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2485
2483
|
wasIncluded: z.ZodOptional<z.ZodBoolean>;
|
|
2486
2484
|
virtual: z.ZodOptional<z.ZodBoolean>;
|
|
2487
2485
|
}, z.core.$strip>>>;
|
|
2488
|
-
rerankFiles: z.ZodOptional<z.ZodNumber>;
|
|
2489
2486
|
toolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2490
2487
|
type: z.ZodLiteral<"tool_result">;
|
|
2491
2488
|
tool_use_id: z.ZodString;
|
|
@@ -2767,18 +2764,13 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2767
2764
|
maxAgentLoops: z.ZodOptional<z.ZodNumber>;
|
|
2768
2765
|
maxAgentTiming: z.ZodOptional<z.ZodNumber>;
|
|
2769
2766
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
2770
|
-
maxPages: z.ZodOptional<z.ZodNumber>;
|
|
2771
|
-
autoContinue: z.ZodOptional<z.ZodNumber>;
|
|
2772
2767
|
isManualContinue: z.ZodOptional<z.ZodBoolean>;
|
|
2773
|
-
llmSuggestions: z.ZodOptional<z.ZodBoolean>;
|
|
2774
|
-
conclusionText: z.ZodOptional<z.ZodBoolean>;
|
|
2775
2768
|
mcpServers: z.ZodOptional<z.ZodBoolean>;
|
|
2776
2769
|
pingEvents: z.ZodOptional<z.ZodBoolean>;
|
|
2777
2770
|
forceCompact: z.ZodOptional<z.ZodBoolean>;
|
|
2778
2771
|
hadPagination: z.ZodOptional<z.ZodBoolean>;
|
|
2779
2772
|
category: z.ZodOptional<z.ZodUnion<readonly [z.ZodTemplateLiteral<`repair-${string}`>, z.ZodLiteral<"user-normal">, z.ZodLiteral<"user-figma">, z.ZodLiteral<"user-pdf">, z.ZodLiteral<"user-image">, z.ZodLiteral<"setup-agent">, z.ZodTemplateLiteral<`background-${string}`>, z.ZodTemplateLiteral<`indexing-${string}`>]>>;
|
|
2780
2773
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2781
|
-
searchResponse: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
2782
2774
|
prettierConfig: z.ZodOptional<z.ZodCustom<PrettierOptions, PrettierOptions>>;
|
|
2783
2775
|
role: z.ZodOptional<z.ZodEnum<{
|
|
2784
2776
|
agent: "agent";
|
|
@@ -2874,6 +2866,8 @@ export declare const CodeGenInputOptionsSchema: z.ZodObject<{
|
|
|
2874
2866
|
export type CodeGenInputOptions = z.infer<typeof CodeGenInputOptionsSchema> & {
|
|
2875
2867
|
/** @internal Derived from BuilderEditorState.components for editor AI. */
|
|
2876
2868
|
_allowedComponentNames?: string[];
|
|
2869
|
+
/** @internal Derived from BuilderEditorState.components for editor AI. */
|
|
2870
|
+
_fieldShapeChecks?: FieldShapeCheck[];
|
|
2877
2871
|
/**
|
|
2878
2872
|
* Optional factory function to wrap the MCP client with custom behavior
|
|
2879
2873
|
* Used by Editor AI to add permission checks for model operations
|
|
@@ -2883,6 +2877,11 @@ export type CodeGenInputOptions = z.infer<typeof CodeGenInputOptionsSchema> & {
|
|
|
2883
2877
|
*/
|
|
2884
2878
|
_mcpClientWrapperFactory?: (realClient: any) => any;
|
|
2885
2879
|
};
|
|
2880
|
+
export interface FieldShapeCheck {
|
|
2881
|
+
component: string;
|
|
2882
|
+
input: string;
|
|
2883
|
+
subField: string;
|
|
2884
|
+
}
|
|
2886
2885
|
export type CodeGenErrorCodes = "credits-limit-daily" | "credits-limit-monthly" | "credits-limit-user" | "credits-limit-other" | "cli-genetic-error" | "git-update-error" | "prompt-too-long" | "context-too-long" | "abrupt-end" | "unknown" | "failed-recover-state" | "completion-expired" | "ask-to-continue" | "bad-initial-url" | "bad-smart-export-payload" | "invalid-last-message" | "corrupted-session" | "privacy-mode-key-required" | "privacy-mode-key-invalid" | "privacy-mode-key-mismatch" | "privacy-mode-validation-unavailable" | "cli-network-error" | "invalid-credentials" | "model-restricted-too-large" | "org-no-models-enabled" | "assertion" | "rate-limit" | "unknown-design-system";
|
|
2887
2886
|
export interface CodegenUsage {
|
|
2888
2887
|
total: number;
|
|
@@ -2915,38 +2914,6 @@ export interface ActionItem {
|
|
|
2915
2914
|
suggestions?: PromptSuggestion[];
|
|
2916
2915
|
errors?: string[];
|
|
2917
2916
|
}
|
|
2918
|
-
export interface RepoInfo {
|
|
2919
|
-
remoteUrl: string;
|
|
2920
|
-
defaultBranch: string;
|
|
2921
|
-
currentBranch: string;
|
|
2922
|
-
commit: string;
|
|
2923
|
-
}
|
|
2924
|
-
export interface CodebaseSearchOptions {
|
|
2925
|
-
repoInfo?: RepoInfo;
|
|
2926
|
-
query: string;
|
|
2927
|
-
selectedFiles?: string[];
|
|
2928
|
-
sessionId: string;
|
|
2929
|
-
files?: string[];
|
|
2930
|
-
packageJson?: string;
|
|
2931
|
-
limit?: number;
|
|
2932
|
-
includeContent?: boolean;
|
|
2933
|
-
}
|
|
2934
|
-
export interface CodebaseSearchResponse {
|
|
2935
|
-
id: string;
|
|
2936
|
-
relevantPaths: string[];
|
|
2937
|
-
grepQueries: string[];
|
|
2938
|
-
streamMeta: any;
|
|
2939
|
-
ranked: RankedResult[];
|
|
2940
|
-
}
|
|
2941
|
-
export interface RankedResult {
|
|
2942
|
-
index: number;
|
|
2943
|
-
filePath: string;
|
|
2944
|
-
startIndex: number;
|
|
2945
|
-
endIndex: number;
|
|
2946
|
-
score: number;
|
|
2947
|
-
id: string;
|
|
2948
|
-
content?: string;
|
|
2949
|
-
}
|
|
2950
2917
|
export interface GenerateCompletionStepThinking {
|
|
2951
2918
|
type: "thinking";
|
|
2952
2919
|
content: string;
|
|
@@ -3768,9 +3735,6 @@ export interface UserInput {
|
|
|
3768
3735
|
systemReminders: SystemReminder[];
|
|
3769
3736
|
attachments: Attachment[];
|
|
3770
3737
|
files: ProjectFile[];
|
|
3771
|
-
searchResponse: CodebaseSearchResponse | null;
|
|
3772
|
-
rerankFiles?: number;
|
|
3773
|
-
mostRelevantFile: string | null;
|
|
3774
3738
|
toolResults: ContentMessageItemToolResult[];
|
|
3775
3739
|
user: UserSource;
|
|
3776
3740
|
patchFusionConfig?: Partial<FusionConfig> | undefined;
|
|
@@ -4122,6 +4086,12 @@ export interface BranchBackup {
|
|
|
4122
4086
|
forced: ForcedBackup;
|
|
4123
4087
|
commitInRepoVerified?: "verified" | "not-found" | "unverified";
|
|
4124
4088
|
metadata?: Record<string, any>;
|
|
4089
|
+
/**
|
|
4090
|
+
* Paths of submodules / embedded git repos whose state the bundle cannot
|
|
4091
|
+
* reproduce. When non-empty the backup is restorable for the outer repo
|
|
4092
|
+
* but must not be treated as deletion-safe.
|
|
4093
|
+
*/
|
|
4094
|
+
changedSubmodules?: string[];
|
|
4125
4095
|
}
|
|
4126
4096
|
export interface CheckBackupDataResultValid {
|
|
4127
4097
|
state: "valid";
|
|
@@ -4141,15 +4111,26 @@ export interface CheckBackupDataResultStale {
|
|
|
4141
4111
|
message: string;
|
|
4142
4112
|
backup: BranchBackup;
|
|
4143
4113
|
}
|
|
4114
|
+
/**
|
|
4115
|
+
* The backup is otherwise valid but includes submodule changes the bundle
|
|
4116
|
+
* cannot reproduce (see BranchBackup.changedSubmodules). It can still be
|
|
4117
|
+
* restored, but the volume must be retained.
|
|
4118
|
+
*/
|
|
4119
|
+
export interface CheckBackupDataResultSubmoduleChanges {
|
|
4120
|
+
state: "submodule-changes";
|
|
4121
|
+
outcome: "submodule-changes";
|
|
4122
|
+
message: string;
|
|
4123
|
+
backup: BranchBackup;
|
|
4124
|
+
}
|
|
4144
4125
|
export interface CheckBackupDataResultInvalid {
|
|
4145
4126
|
state: "invalid";
|
|
4146
4127
|
outcome: "no-backup" | "error" | "not-completed" | "no-session-id" | "no-last-commit-hash" | "no-backup-file" | "empty-full-backup" | "no-vcpCodeGenEvent" | "commits-not-in-repo" | "no-after-commit" | "no-signed-url" | "no-git-branch-name" | "repo-url-mismatch" | "branch-uninitialized" | "unexpected-partial-backup" | "unexpected-full-backup" | "no-backup-keys";
|
|
4147
4128
|
message: string;
|
|
4148
4129
|
backup: BranchBackup | undefined;
|
|
4149
4130
|
}
|
|
4150
|
-
export type CheckBackupDataResult = CheckBackupDataResultValid | CheckBackupDataResultForcedBackup | CheckBackupDataResultStale | CheckBackupDataResultInvalid;
|
|
4131
|
+
export type CheckBackupDataResult = CheckBackupDataResultValid | CheckBackupDataResultForcedBackup | CheckBackupDataResultStale | CheckBackupDataResultSubmoduleChanges | CheckBackupDataResultInvalid;
|
|
4151
4132
|
export interface BackupMetadata {
|
|
4152
|
-
check: CheckBackupDataResultValid | CheckBackupDataResultStale | CheckBackupDataResultForcedBackup;
|
|
4133
|
+
check: CheckBackupDataResultValid | CheckBackupDataResultStale | CheckBackupDataResultForcedBackup | CheckBackupDataResultSubmoduleChanges;
|
|
4153
4134
|
downloadUrl: GitBackupDownloadUrlResult | undefined;
|
|
4154
4135
|
downloadUrlError?: string;
|
|
4155
4136
|
}
|
package/src/codegen.js
CHANGED
|
@@ -1616,6 +1616,11 @@ export const SessionModeSchema = z
|
|
|
1616
1616
|
.meta({ title: "SessionMode" });
|
|
1617
1617
|
export const CodeGenModeSchema = z
|
|
1618
1618
|
.enum([
|
|
1619
|
+
/**
|
|
1620
|
+
* @deprecated The legacy quality-v2 pipeline has been removed. Old
|
|
1621
|
+
* dev-tools clients that still request this mode are served `quality-v4`.
|
|
1622
|
+
* New code should not produce this value.
|
|
1623
|
+
*/
|
|
1619
1624
|
"quality",
|
|
1620
1625
|
"quality-v4",
|
|
1621
1626
|
/**
|
|
@@ -1909,8 +1914,6 @@ export const CodeGenInputOptionsSchema = z
|
|
|
1909
1914
|
codeGenMode: CodeGenModeSchema.optional(),
|
|
1910
1915
|
sessionMode: SessionModeSchema.optional(),
|
|
1911
1916
|
url: z.string().optional(),
|
|
1912
|
-
diffActions: z.boolean().optional(),
|
|
1913
|
-
planningPrompt: z.boolean().optional(),
|
|
1914
1917
|
customInstructions: z.array(CustomInstructionSchema).optional(),
|
|
1915
1918
|
customAgents: z.array(CustomAgentInfoSchema).optional(),
|
|
1916
1919
|
systemPromptOverride: z.union([z.string(), z.array(z.string())]).optional(),
|
|
@@ -1920,7 +1923,6 @@ export const CodeGenInputOptionsSchema = z
|
|
|
1920
1923
|
uiContextPrompt: z.string().optional(),
|
|
1921
1924
|
displayUserPrompt: z.string().optional(),
|
|
1922
1925
|
files: z.array(ProjectFileSchema).optional(),
|
|
1923
|
-
rerankFiles: z.number().optional(),
|
|
1924
1926
|
toolResults: z.array(ContentMessageItemToolResultSchema).optional(),
|
|
1925
1927
|
attachments: z.array(AttachmentSchema).optional(),
|
|
1926
1928
|
beforeCommit: GitSnapshotSchema.optional(),
|
|
@@ -1965,18 +1967,13 @@ export const CodeGenInputOptionsSchema = z
|
|
|
1965
1967
|
maxTokens: z.number().optional().meta({
|
|
1966
1968
|
description: "Maximum output tokens allowed in the LLM response. This will set the maximum token output for the LLM.",
|
|
1967
1969
|
}),
|
|
1968
|
-
maxPages: z.number().optional(),
|
|
1969
|
-
autoContinue: z.number().optional(),
|
|
1970
1970
|
isManualContinue: z.boolean().optional(),
|
|
1971
|
-
llmSuggestions: z.boolean().optional(),
|
|
1972
|
-
conclusionText: z.boolean().optional(),
|
|
1973
1971
|
mcpServers: z.boolean().optional(),
|
|
1974
1972
|
pingEvents: z.boolean().optional(),
|
|
1975
1973
|
forceCompact: z.boolean().optional(),
|
|
1976
1974
|
hadPagination: z.boolean().optional(),
|
|
1977
1975
|
category: CodeGenCategorySchema.optional(),
|
|
1978
1976
|
metadata: z.record(z.string(), z.any()).optional(),
|
|
1979
|
-
searchResponse: z.any().nullish(),
|
|
1980
1977
|
prettierConfig: z.custom().optional(),
|
|
1981
1978
|
// Role
|
|
1982
1979
|
role: z.enum(["user", "agent"]).optional(),
|
package/src/events.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AssistantMessage, AssistantMessageAction } from "./messages.js";
|
|
|
3
3
|
import type { AssistantSettings } from "./settings.js";
|
|
4
4
|
import type { ExitState, UserSource, CodeGenPosition, ReviewSeverity, ReviewVerdict } from "./codegen.js";
|
|
5
5
|
import type { FileUpload } from "./messages.js";
|
|
6
|
+
import type { BuilderConfigRealtime } from "./builder-config.js";
|
|
6
7
|
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void;
|
|
7
8
|
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;
|
|
8
9
|
export interface AssistantCompletionResultEvent {
|
|
@@ -1271,6 +1272,15 @@ export type ClientDevtoolsBuildUploadedV1 = FusionEventVariant<"client.devtools.
|
|
|
1271
1272
|
* directly in the handler and is not sent through the event.
|
|
1272
1273
|
*/
|
|
1273
1274
|
prodEnvFromBuilderConfig?: Record<string, string>;
|
|
1275
|
+
/**
|
|
1276
|
+
* `realtime.transport` from the same `builder.config.json` read. Sent from
|
|
1277
|
+
* the pod because the tree it built is the authoritative revision — the
|
|
1278
|
+
* service would otherwise have to re-resolve the deployed commit through
|
|
1279
|
+
* the git provider, which for template-backed projects can resolve against
|
|
1280
|
+
* a different repo. Absent from pods predating this field; the handler
|
|
1281
|
+
* falls back to reading the repo at the deployed commit.
|
|
1282
|
+
*/
|
|
1283
|
+
realtimeTransport?: BuilderConfigRealtime["transport"];
|
|
1274
1284
|
}, {
|
|
1275
1285
|
projectId: string;
|
|
1276
1286
|
deployId: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Branch, FusionExecutionEnvironment } from "./projects.js";
|
|
2
|
+
/** Upgrade legacy `cloud` to `cloud-v2` when kube is enabled. */
|
|
3
|
+
export declare function upgradeCloudForKube(environment: FusionExecutionEnvironment, useKube: boolean): FusionExecutionEnvironment;
|
|
4
|
+
/** Work branch whose fusion environment a new sibling branch should inherit. */
|
|
5
|
+
export declare function pickReferenceWorkBranch(branches: Branch[]): Branch | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getBranchState } from "./projects.js";
|
|
2
|
+
/** Upgrade legacy `cloud` to `cloud-v2` when kube is enabled. */
|
|
3
|
+
export function upgradeCloudForKube(environment, useKube) {
|
|
4
|
+
return environment === "cloud" && useKube ? "cloud-v2" : environment;
|
|
5
|
+
}
|
|
6
|
+
/** Work branch whose fusion environment a new sibling branch should inherit. */
|
|
7
|
+
export function pickReferenceWorkBranch(branches) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const activeWorkBranches = branches.filter((branch) => {
|
|
10
|
+
if (branch.type === "deploy" || branch.hidden) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return getBranchState(branch) === "active";
|
|
14
|
+
});
|
|
15
|
+
return ((_b = (_a = activeWorkBranches.find((branch) => branch.name === "development")) !== null && _a !== void 0 ? _a : activeWorkBranches.find((branch) => branch.isDefault)) !== null && _b !== void 0 ? _b : activeWorkBranches[0]);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { pickReferenceWorkBranch, upgradeCloudForKube, } from "./fusion-environment.js";
|
|
3
|
+
function branch(overrides) {
|
|
4
|
+
return {
|
|
5
|
+
id: `br-${overrides.name}`,
|
|
6
|
+
projectId: "project-1",
|
|
7
|
+
ownerId: "org-1",
|
|
8
|
+
isPublic: true,
|
|
9
|
+
...overrides,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
describe("upgradeCloudForKube", () => {
|
|
13
|
+
it("upgrades cloud when useKube is true", () => {
|
|
14
|
+
expect(upgradeCloudForKube("cloud", true)).toBe("cloud-v2");
|
|
15
|
+
});
|
|
16
|
+
it("leaves cloud-v2 unchanged", () => {
|
|
17
|
+
expect(upgradeCloudForKube("cloud-v2", false)).toBe("cloud-v2");
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("pickReferenceWorkBranch", () => {
|
|
21
|
+
it("prefers development over other work branches", () => {
|
|
22
|
+
var _a;
|
|
23
|
+
expect((_a = pickReferenceWorkBranch([
|
|
24
|
+
branch({ name: "feature-a", lockedFusionEnvironment: "cloud" }),
|
|
25
|
+
branch({ name: "development", lockedFusionEnvironment: "cloud-v2" }),
|
|
26
|
+
])) === null || _a === void 0 ? void 0 : _a.name).toBe("development");
|
|
27
|
+
});
|
|
28
|
+
it("ignores deploy and hidden branches", () => {
|
|
29
|
+
var _a;
|
|
30
|
+
expect((_a = pickReferenceWorkBranch([
|
|
31
|
+
branch({
|
|
32
|
+
name: "deploy-pod",
|
|
33
|
+
type: "deploy",
|
|
34
|
+
hidden: true,
|
|
35
|
+
lockedFusionEnvironment: "cloud",
|
|
36
|
+
}),
|
|
37
|
+
branch({ name: "development", lockedFusionEnvironment: "cloud-v2" }),
|
|
38
|
+
])) === null || _a === void 0 ? void 0 : _a.name).toBe("development");
|
|
39
|
+
});
|
|
40
|
+
});
|
package/src/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./codegen.js";
|
|
|
9
9
|
export * from "./codegen/investigation-context.js";
|
|
10
10
|
export * from "./diff-hunks.js";
|
|
11
11
|
export * from "./projects.js";
|
|
12
|
+
export * from "./fusion-environment.js";
|
|
12
13
|
export * from "./repo-indexing.js";
|
|
13
14
|
export * from "./organization.js";
|
|
14
15
|
export * from "./features.js";
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./codegen.js";
|
|
|
9
9
|
export * from "./codegen/investigation-context.js";
|
|
10
10
|
export * from "./diff-hunks.js";
|
|
11
11
|
export * from "./projects.js";
|
|
12
|
+
export * from "./fusion-environment.js";
|
|
12
13
|
export * from "./repo-indexing.js";
|
|
13
14
|
export * from "./organization.js";
|
|
14
15
|
export * from "./features.js";
|
package/src/organization.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PrivacyMode, ReviewEffort } from "./codegen";
|
|
1
|
+
import type { PrivacyMode, ReasoningEffort, ReviewEffort } from "./codegen";
|
|
2
2
|
import type { EnvironmentVariable } from "./common-schemas";
|
|
3
3
|
export interface GitlabEnterpriseSetupValue {
|
|
4
4
|
host: string;
|
|
@@ -103,6 +103,8 @@ interface OrganizationSettings {
|
|
|
103
103
|
fusionPrQuietMode?: boolean;
|
|
104
104
|
runInPty?: boolean;
|
|
105
105
|
maxAgentCompletions?: number;
|
|
106
|
+
defaultBackgroundAgentModel?: string;
|
|
107
|
+
defaultBackgroundAgentEffort?: ReasoningEffort;
|
|
106
108
|
privacyMode?: Pick<PrivacyMode, "mcpServers" | "redactUserMessages" | "redactLLMMessages"> & {
|
|
107
109
|
enabled?: boolean;
|
|
108
110
|
};
|
|
@@ -328,6 +330,7 @@ export interface FeatureMap {
|
|
|
328
330
|
agentCreditsRollover?: boolean;
|
|
329
331
|
selfHostedGitProviders?: boolean;
|
|
330
332
|
reviewAgent?: boolean;
|
|
333
|
+
hosting?: boolean;
|
|
331
334
|
}
|
|
332
335
|
export interface SubscriptionInfo {
|
|
333
336
|
price?: number;
|
|
@@ -420,6 +423,7 @@ export interface SubscriptionInfoMap {
|
|
|
420
423
|
"vcp:v1:level1": SubscriptionInfo;
|
|
421
424
|
"vcp:v1:level2": SubscriptionInfo;
|
|
422
425
|
"vcp:v1:enterprise": SubscriptionInfo;
|
|
426
|
+
"vcp:v2:enterprise": SubscriptionInfo;
|
|
423
427
|
"vcp:v2:level1": SubscriptionInfo;
|
|
424
428
|
"vcp:v2:level2": SubscriptionInfo;
|
|
425
429
|
"vcp:v3:level1": SubscriptionInfo;
|
package/src/projects.d.ts
CHANGED
|
@@ -283,6 +283,14 @@ export interface GitBackupRecordOptions {
|
|
|
283
283
|
forced: ForcedBackup;
|
|
284
284
|
metadata?: Record<string, string | string[] | undefined>;
|
|
285
285
|
folderName?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Paths of submodules / embedded git repos whose state the bundle cannot
|
|
288
|
+
* reproduce: gitlinks changed within the backed-up range, or inner repos
|
|
289
|
+
* with commits/changes that exist only on the volume. When non-empty the
|
|
290
|
+
* backup is restorable for the outer repo but must not be treated as
|
|
291
|
+
* deletion-safe.
|
|
292
|
+
*/
|
|
293
|
+
changedSubmodules?: string[];
|
|
286
294
|
}
|
|
287
295
|
export interface RecordScreenshotOptions {
|
|
288
296
|
projectId: string;
|
|
@@ -1602,6 +1610,15 @@ export interface ProjectDatabase {
|
|
|
1602
1610
|
role: string;
|
|
1603
1611
|
/** @internal Plaintext credential — Firestore IAM enforces access. Never serialize to client responses. */
|
|
1604
1612
|
password: string;
|
|
1613
|
+
/**
|
|
1614
|
+
* @internal Per-project HMAC secret for signing/verifying Realtime Gateway
|
|
1615
|
+
* subscribe tokens. Plaintext like `password`; Firestore IAM enforces access.
|
|
1616
|
+
* Never serialize to client responses. Absent on projects provisioned before
|
|
1617
|
+
* the Realtime Sync Gateway shipped — there is no backfill by design; such a
|
|
1618
|
+
* project gets its secret on its next deploy. See the Agent-Native Realtime
|
|
1619
|
+
* Sync spec.
|
|
1620
|
+
*/
|
|
1621
|
+
realtimeHmacSecret?: string;
|
|
1605
1622
|
/** Database name (white-labeled to "main"); needed to build connection URIs. */
|
|
1606
1623
|
database: string;
|
|
1607
1624
|
region: string;
|