@builder.io/ai-utils 0.87.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.87.1",
3
+ "version": "0.88.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
@@ -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>;
@@ -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;
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;
@@ -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
@@ -1610,6 +1610,15 @@ export interface ProjectDatabase {
1610
1610
  role: string;
1611
1611
  /** @internal Plaintext credential — Firestore IAM enforces access. Never serialize to client responses. */
1612
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;
1613
1622
  /** Database name (white-labeled to "main"); needed to build connection URIs. */
1614
1623
  database: string;
1615
1624
  region: string;