builder.io 1.6.135 → 1.6.136

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.
@@ -1,7 +1,8 @@
1
- import type { CodeGenTools, CommitMode, ContentMessageItemToolResult, FusionConfig, ProjectFile, WorkspaceFolder } from "$/ai-utils";
1
+ import type { CodeGenTools, CodegenTurn, CommitMode, ContentMessageItemToolResult, FusionConfig, ProjectFile, UserSource, WorkspaceFolder } from "$/ai-utils";
2
2
  import type { DevToolsSys } from "../core";
3
3
  import { type DevServerOrchestrator } from "./launch/dev-server-orchestrator";
4
4
  import type { CodeGenEventEmitter } from "./codegen";
5
+ import type { Credentials } from "./credentials";
5
6
  export interface LLMToolCalls {
6
7
  name: CodeGenTools;
7
8
  input: Record<string, any>;
@@ -22,11 +23,22 @@ export interface FusionContext {
22
23
  }
23
24
  export interface ToolContext extends Partial<FusionContext> {
24
25
  sys: DevToolsSys;
26
+ credentials: Credentials;
25
27
  files: ProjectFile[];
28
+ user: UserSource;
26
29
  emitter: CodeGenEventEmitter;
30
+ fusionConfig: FusionConfig | undefined;
27
31
  signal: AbortSignal | undefined;
28
32
  workingDirectory: string;
29
33
  allowedCommands: RegExp[];
34
+ restore: (options: {
35
+ location: "before" | "after";
36
+ predicate: (turn: CodegenTurn | null, index: number) => boolean;
37
+ dryRun?: boolean;
38
+ revert?: boolean;
39
+ forceReplay?: boolean;
40
+ debug?: string;
41
+ }) => Promise<string[] | null>;
30
42
  bashWorkingDirectory: string;
31
43
  filterText: (text: string) => string;
32
44
  resolveWorkspacePath: (path: string, forceWorkspace: boolean) => {
@@ -43,7 +55,7 @@ export interface ToolContext extends Partial<FusionContext> {
43
55
  writeFile: (filePath: string, content: string | Uint8Array) => Promise<boolean>;
44
56
  deleteFile: (filePath: string) => Promise<boolean>;
45
57
  fileExists: (filePath: string) => Promise<boolean>;
46
- listDir: (dirPath: string) => Promise<string[]>;
58
+ listDir: (dirPath: string, ignoreGlobs?: string[]) => Promise<string[]>;
47
59
  stat: (filePath: string) => Promise<{
48
60
  isDirectory: () => boolean;
49
61
  isFile: () => boolean;
@@ -1,6 +1,6 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import { type Credentials } from "./credentials";
3
- import type { CodegenFeedback, CodegenTurn, CommitMode, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult } from "$/ai-utils";
3
+ import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CommitMode, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode } from "$/ai-utils";
4
4
  import prettier from "prettier";
5
5
  import { type FusionContext } from "./code-tools";
6
6
  import EventEmitter from "node:events";
@@ -22,14 +22,13 @@ export interface CodeGenSessionOptionsBase {
22
22
  credentials: Credentials;
23
23
  position: string;
24
24
  maxTokens?: number;
25
- mode?: "quality" | "quality-v3";
25
+ mode: CodeGenMode;
26
26
  builtInCustomInstructions?: CustomInstruction[];
27
27
  fusionContext?: FusionContext;
28
28
  fusionConfig?: FusionConfig;
29
29
  workingDirectory?: string;
30
- workspace?: WorkspaceConfiguration;
31
30
  mcpServers?: boolean;
32
- enabledTools?: string;
31
+ enabledTools?: (keyof CodeGenToolMap)[];
33
32
  }
34
33
  export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase {
35
34
  sessionOrCompletionId?: string;
@@ -149,6 +148,7 @@ export declare class CodeGenSession {
149
148
  getAllFiles(): Promise<string[]>;
150
149
  getSessionId(): string;
151
150
  getSpaceId(): string | undefined;
151
+ revertToCommitHash(commitHash: string): Promise<void>;
152
152
  /**
153
153
  * Core function to restore the codebase to a state that matches a predicate.
154
154
  * This is the main function that handles both git-based and file-based restoration.
@@ -157,10 +157,11 @@ export declare class CodeGenSession {
157
157
  * @param dryRun If true, only simulate the restoration without making changes
158
158
  * @returns Array of file paths that were changed
159
159
  */
160
- restore({ location, predicate, dryRun, forceReplay, debug, }: {
160
+ restore({ location, predicate, revert, dryRun, forceReplay, debug, }: {
161
161
  location: "before" | "after";
162
162
  predicate: (turn: CodegenTurn | null, index: number) => boolean;
163
163
  dryRun?: boolean;
164
+ revert?: boolean;
164
165
  forceReplay?: boolean;
165
166
  debug?: string;
166
167
  }): Promise<string[] | null>;
@@ -264,7 +265,7 @@ export declare class CodeGenSession {
264
265
  * @param dirPath A directory path that may include a workspace prefix
265
266
  * @returns Array of file names in the directory or empty array if directory doesn't exist
266
267
  */
267
- listDir(dirPath: string): Promise<string[]>;
268
+ listDir(dirPath: string, ignoreGlobs?: string[]): Promise<string[]>;
268
269
  /**
269
270
  * Get stats for a file in the workspace
270
271
  * @param filePath A file path that may include a workspace prefix
@@ -70,6 +70,14 @@ export interface FigmaTokenMapper {
70
70
  export declare function figmaMapping<T extends BaseFigmaProps = FigmaProps>(_config: FigmaMappingWithKeyMapper<T> | FigmaMappingWithUrlMapper<T> | FigmaGenericMapper | FigmaTokenMapper): void;
71
71
  export declare function explicitFalse(value: any): any;
72
72
  export declare function html(strings: TemplateStringsArray, ...values: any[]): any;
73
+ /**
74
+ * A template string that represents the component code.
75
+ */
76
+ export declare function tmpl(strings: TemplateStringsArray, ...values: any[]): {
77
+ "@type": string;
78
+ strings: TemplateStringsArray;
79
+ values: any[];
80
+ };
73
81
  export interface ChildElement<P = any> {
74
82
  type: any;
75
83
  props: P;