@builder.io/ai-utils 0.80.0 → 0.81.1

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.80.0",
3
+ "version": "0.81.1",
4
4
  "description": "Builder.io AI utils",
5
5
  "files": [
6
6
  "src"
package/src/codegen.d.ts CHANGED
@@ -945,6 +945,8 @@ export declare const ProposedConfigSchema: z.ZodObject<{
945
945
  reason: z.ZodOptional<z.ZodString>;
946
946
  }, z.core.$strip>;
947
947
  }, z.core.$strip>;
948
+ appliedAt: z.ZodOptional<z.ZodString>;
949
+ appliedBy: z.ZodOptional<z.ZodString>;
948
950
  sessionId: z.ZodString;
949
951
  orchestratorStates: z.ZodObject<{
950
952
  setupState: z.ZodEnum<{
@@ -3225,6 +3227,33 @@ export interface GenerateCompletionStepDevServerState {
3225
3227
  proxyServerReachable: boolean;
3226
3228
  validateState: ValidateCommandState;
3227
3229
  }
3230
+ /**
3231
+ * Human-readable explanation of how each git-status decision was reached for a
3232
+ * single repo, computed once in the CLI so the debug logs and the web UI
3233
+ * (Merge-button tooltip + Fusion Debug Info) all read the same reasons. Rides
3234
+ * along on the emitted git step; never persisted to Firebase.
3235
+ */
3236
+ export interface GitStatusDiagnostics {
3237
+ /** One-line human summary of this repo's overall git state. */
3238
+ summary: string;
3239
+ /** Base/parent branch used for ahead-of-base (e.g. "origin/main"). */
3240
+ baseBranch?: string;
3241
+ /** Merge-base commit between HEAD and baseBranch, when resolved. */
3242
+ baseMergeBase?: string;
3243
+ /** True if a fetch-and-retry was needed to resolve the base ref. */
3244
+ baseRefFetched?: boolean;
3245
+ /** Why aheadOfBase is what it is, incl. the fail-open reason when undefined. */
3246
+ aheadOfBaseReason: string;
3247
+ /** The branch's own remote tracking branch used for ahead/behind. */
3248
+ remoteTrackingBranch?: string;
3249
+ canPushReason: string;
3250
+ canSyncReason: string;
3251
+ canPullReason: string;
3252
+ remoteReason: string;
3253
+ mergeConflictReason?: string;
3254
+ /** Why the Merge button is (or isn't) gated open, independent of the summary. */
3255
+ mergeReason: string;
3256
+ }
3228
3257
  export interface GenerateCompletionStepGit {
3229
3258
  type: "git";
3230
3259
  folderName?: string;
@@ -3238,6 +3267,21 @@ export interface GenerateCompletionStepGit {
3238
3267
  canSync: boolean;
3239
3268
  ahead: number;
3240
3269
  behind: number;
3270
+ /**
3271
+ * Commits on HEAD not yet in the base/parent branch (e.g. main). Distinct from
3272
+ * `ahead`, which counts commits ahead of this branch's own remote tracking
3273
+ * branch. `undefined` only when it could not be determined even after a
3274
+ * fetch-and-retry (rare) — consumers should fail open in that case.
3275
+ */
3276
+ aheadOfBase?: number;
3277
+ /**
3278
+ * True when HEAD's tree differs from the base/parent branch's tree (content
3279
+ * diff, not commit count). Squash-merge safe: after a squash merge, HEAD's
3280
+ * tree matches base's tree even though `aheadOfBase` commit-count stays >0.
3281
+ * `undefined` only when it could not be determined; consumers should fail
3282
+ * open (treat as `true`) in that case.
3283
+ */
3284
+ hasChangesAgainstBase?: boolean;
3241
3285
  commitMode: CommitMode;
3242
3286
  hasMergeConflict: boolean;
3243
3287
  currentCommit: string;
@@ -3245,6 +3289,11 @@ export interface GenerateCompletionStepGit {
3245
3289
  remoteBranch: string;
3246
3290
  pendingValidation: boolean;
3247
3291
  unmergedFiles: string[];
3292
+ /**
3293
+ * Human-readable "why" for each git decision above, used by CLI debug logs
3294
+ * and the web UI. Optional so older CLIs that don't emit it still typecheck.
3295
+ */
3296
+ diagnostics?: GitStatusDiagnostics;
3248
3297
  }
3249
3298
  /**
3250
3299
  * A typed comment added to the session via the generic `AddComment` tool. The
@@ -4544,6 +4593,13 @@ export interface SearchFilesOptions {
4544
4593
  contextBefore?: number;
4545
4594
  /** Include context lines after each match */
4546
4595
  contextAfter?: number;
4596
+ /**
4597
+ * Return one result per matching file instead of one per match line. `maxResults` then caps
4598
+ * distinct files rather than individual lines, so a query that hits many lines in a few files
4599
+ * can't crowd out other matching files. Match metadata (line/column/ content/context) is not
4600
+ * populated in this mode.
4601
+ */
4602
+ filesWithMatchesOnly?: boolean;
4547
4603
  }
4548
4604
  export interface SearchFileMatch {
4549
4605
  /** Relative file path */
@@ -4570,6 +4626,54 @@ export interface SearchFilesResult {
4570
4626
  filesWithMatches: number;
4571
4627
  /** Whether results were truncated */
4572
4628
  truncated: boolean;
4629
+ /**
4630
+ * True when ripgrep itself failed (spawn error, or exit code 2 or greater) rather than simply
4631
+ * finding no matches (exit code 1). Lets callers distinguish "search couldn't run" from "search
4632
+ * ran, found nothing".
4633
+ */
4634
+ searchError?: boolean;
4635
+ }
4636
+ /**
4637
+ * Request to derive a stable AST structural key for the JSX element at a source coordinate, used
4638
+ * to anchor a Fusion comment. See the "Fusion Comment Anchor Categorization" tech spec.
4639
+ */
4640
+ export interface DeriveCommentAnchorKeyOptions {
4641
+ /** Source file the commented element was captured from. */
4642
+ filePath: string;
4643
+ /** 1-indexed line of the element's opening tag (parsed from the captured `data-loc`). */
4644
+ line: number;
4645
+ /** Column of the opening tag, when known, to disambiguate multiple elements on one line. */
4646
+ col?: number;
4647
+ }
4648
+ export interface DeriveCommentAnchorKeyResult {
4649
+ /** `v1:<scope>/<tag>[<n>]/…`. Absent when the file has no JSX element at the coordinate. */
4650
+ structuralKey?: string;
4651
+ /** Nearest enclosing named component/function. */
4652
+ componentName?: string;
4653
+ /** `tag|sorted-static-attrs|static-text` — exact-match fallback when the key drifts. */
4654
+ sourceSignature?: string;
4655
+ }
4656
+ /**
4657
+ * Request to check whether a previously-anchored element still exists in the project source.
4658
+ * Pure/read-only — never writes back. See the tech spec for the read cascade.
4659
+ */
4660
+ export interface ResolveCommentAnchorOptions {
4661
+ /** File the element was last known to live in. */
4662
+ filePath?: string;
4663
+ /** Stable AST key from capture (primary match). */
4664
+ structuralKey?: string;
4665
+ /** Static signature from capture (fallback when the key drifted). */
4666
+ sourceSignature?: string;
4667
+ /** Tag name, used only for logging/heuristics. */
4668
+ tagName?: string;
4669
+ }
4670
+ export interface ResolveCommentAnchorResult {
4671
+ /** `present` → element still in source (caller maps to UNREACHABLE if not rendered); `absent` → ORPHANED. */
4672
+ state: "present" | "absent";
4673
+ /** The file the element was found in (may differ from the input on a move/rename). */
4674
+ filePath?: string;
4675
+ /** The current structural key (may differ from the input when the key drifted). */
4676
+ structuralKey?: string;
4573
4677
  }
4574
4678
  /**
4575
4679
  * Options for searching file tree (quick open functionality).
package/src/codegen.js CHANGED
@@ -1035,6 +1035,13 @@ export const ProposedConfigSchema = z
1035
1035
  summary: z.string().meta({ description: "Summary from Exit tool" }),
1036
1036
  questions: z.array(ProposedQuestionSchema).optional(),
1037
1037
  configuration: ProposedConfigurationSchema,
1038
+ // Application outcome — stamped by applyProposedConfigToProject
1039
+ appliedAt: z.string().optional().meta({
1040
+ description: "ISO timestamp of when this config was applied to the project",
1041
+ }),
1042
+ appliedBy: z.string().optional().meta({
1043
+ description: "User id that applied this config, or 'auto-apply' for the on-exit auto-apply path",
1044
+ }),
1038
1045
  // Metadata
1039
1046
  sessionId: z.string(),
1040
1047
  orchestratorStates: ProposedOrchestratorStatesSchema,
package/src/projects.d.ts CHANGED
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import type { BuilderConfigHosting } from "./builder-config.js";
3
3
  import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
4
4
  import { type EnvironmentVariable, type SetupDependency } from "./common-schemas";
5
- import type { FileOverride, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap, GenerateCompletionStep, ReviewEffort } from "./codegen";
5
+ import type { FileOverride, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap, GenerateCompletionStep, ReviewEffort, ExitState } from "./codegen";
6
6
  import type { FallbackTokensPrivate } from "./organization";
7
7
  /**
8
8
  * Temporary type for date fields during migration.
@@ -915,8 +915,12 @@ export interface Project {
915
915
  useBranchesCollection?: boolean;
916
916
  /** When true, the project is in code-only mode */
917
917
  codeOnlyMode?: boolean;
918
- /** When true, analysis detected a mobile-only app (no usable web dev server path) */
919
- mobileOnlyDetected?: boolean;
918
+ /**
919
+ * Why the project is in code-only mode: the setup-agent exit state that put it
920
+ * there (e.g. "mobile-project", "no-frontend"). Written by the propose-config
921
+ * apply path; null once setup verifies.
922
+ */
923
+ codeOnlyReason?: Exclude<ExitState, "verified"> | null;
920
924
  /** When true, this project is an org-level Claw agent */
921
925
  isOrgAgent?: boolean;
922
926
  /** Configuration for the org agent */
@@ -932,6 +936,8 @@ export interface Project {
932
936
  /** Settings related to Fusion first class hosting */
933
937
  hosting?: ProjectHosting;
934
938
  database?: ProjectDatabase;
939
+ /** @deprecated Use `codeOnlyReason` instead */
940
+ mobileOnlyDetected?: boolean;
935
941
  }
936
942
  export interface ProjectDatabase {
937
943
  ownerId: string;
@@ -1607,6 +1613,8 @@ export type DeployListItem = z.infer<typeof DeployListItemSchema>;
1607
1613
  export declare const DeployArtifactManifestSchema: z.ZodObject<{
1608
1614
  files: z.ZodRecord<z.ZodString, z.ZodString>;
1609
1615
  functions: z.ZodRecord<z.ZodString, z.ZodString>;
1616
+ functions_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1617
+ function_invocation_modes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1610
1618
  }, z.core.$strip>;
1611
1619
  export type DeployArtifactManifest = z.infer<typeof DeployArtifactManifestSchema>;
1612
1620
  /**
package/src/projects.js CHANGED
@@ -462,6 +462,20 @@ export const DeployArtifactManifestSchema = z.object({
462
462
  functions: z.record(z.string(), z.string()).meta({
463
463
  description: "serverless function name → sha256 hash",
464
464
  }),
465
+ // Netlify Functions v2 routing config: function name → config object.
466
+ // Kept as a loose record so ai-utils does not need to depend on the Netlify
467
+ // API package for the exact functionConfig schema.
468
+ functions_config: z
469
+ .record(z.string(), z.record(z.string(), z.unknown()))
470
+ .optional()
471
+ .meta({
472
+ description: "Netlify Functions v2 routing config per function name",
473
+ }),
474
+ // Lambda invocation mode per function: "stream" for v2 functions using
475
+ // awslambda.streamifyResponse bootstrap; absent/undefined means buffered.
476
+ function_invocation_modes: z.record(z.string(), z.string()).optional().meta({
477
+ description: 'Lambda invocation mode per function name (e.g. "stream" for v2 streaming functions)',
478
+ }),
465
479
  });
466
480
  /**
467
481
  * Per-deploy overrides passed from ai-services to the deploy pod's build-and-upload endpoint.
@@ -89,4 +89,31 @@ export interface UpdateSingleTenancyConfigOpts {
89
89
  importCustomRoutes?: boolean;
90
90
  dedicatedNodePool?: DedicatedNodePoolConfig | null;
91
91
  }
92
+ /** Status of a single provisioned VPC resource (bridge VPC, proxy VM, etc.). */
93
+ export interface SingleTenancyLiveCheck {
94
+ label?: string;
95
+ status?: "ok" | "missing" | "running" | "stopped" | "active" | "inactive" | "error" | "unknown";
96
+ details?: string;
97
+ resourceName?: string;
98
+ resourceType?: string;
99
+ }
100
+ /**
101
+ * Aggregated live status of the resources backing a VPC connection. Which
102
+ * checks are present depends on the connection type: peering configs report
103
+ * `bridgeVpc`/`proxyVm`/`peering`, network-attachment configs report
104
+ * `proxyVm`/`networkAttachment`.
105
+ */
106
+ export interface SingleTenancyLiveStatus {
107
+ bridgeVpc?: SingleTenancyLiveCheck;
108
+ proxyVm?: SingleTenancyLiveCheck;
109
+ peering?: SingleTenancyLiveCheck;
110
+ networkAttachment?: SingleTenancyLiveCheck;
111
+ }
112
+ /** Computed infrastructure resource names derived from a config id/type. */
113
+ export interface SingleTenancyDerivedNames {
114
+ bridgeVpcName?: string;
115
+ proxyVmName?: string;
116
+ bridgePeeringName?: string;
117
+ networkAttachmentName?: string;
118
+ }
92
119
  export {};