builder.io 1.6.57 → 1.6.59

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -35,6 +35,20 @@ export interface ToolContext extends Partial<FusionContext> {
35
35
  }>;
36
36
  signal: AbortSignal | undefined;
37
37
  workingDirectory: string;
38
+ resolveWorkspacePath: (path: string) => string;
39
+ workspaceFolders: Array<{
40
+ path: string;
41
+ name?: string;
42
+ }>;
43
+ readFile: (filePath: string) => Promise<string | null>;
44
+ writeFile: (filePath: string, content: string | Uint8Array) => Promise<boolean>;
45
+ deleteFile: (filePath: string) => Promise<boolean>;
46
+ fileExists: (filePath: string) => Promise<boolean>;
47
+ listDir: (dirPath: string) => Promise<string[]>;
48
+ stat: (filePath: string) => Promise<{
49
+ isDirectory: () => boolean;
50
+ isFile: () => boolean;
51
+ } | null>;
38
52
  }
39
53
  export declare function resolveToolCalls(toolContext: ToolContext, toolCalls: LLMToolCalls[]): Promise<ContentMessageItemToolResult[]>;
40
54
  interface RipgrepMatch {
@@ -31,6 +31,13 @@ export interface SessionContext {
31
31
  createdUnixTime: number;
32
32
  updatedUnixTime: number;
33
33
  }
34
+ export interface WorkspaceFolder {
35
+ path: string;
36
+ name?: string;
37
+ }
38
+ export interface WorkspaceConfiguration {
39
+ folders: WorkspaceFolder[];
40
+ }
34
41
  export interface CodeGenSessionOptionsBase {
35
42
  sys: DevToolsSys;
36
43
  credentials: Credentials;
@@ -40,6 +47,7 @@ export interface CodeGenSessionOptionsBase {
40
47
  builtInCustomInstructions?: CustomInstruction[];
41
48
  fusionContext?: FusionContext;
42
49
  workingDirectory?: string;
50
+ workspace?: WorkspaceConfiguration;
43
51
  }
44
52
  export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase {
45
53
  sessionOrCompletionId?: string;
@@ -55,6 +63,7 @@ export declare class CodeGenSession {
55
63
  initializeSession(): Promise<void>;
56
64
  setRepoUrl(repoUrl: string): void;
57
65
  setPrUrl(prUrl: string): void;
66
+ prExists(): boolean;
58
67
  pushRepo(repoFullName: string, githubToken: string): Promise<{
59
68
  success: boolean;
60
69
  error: string;
@@ -136,7 +145,7 @@ export declare class CodeGenSession {
136
145
  getNextUrl(): string | undefined;
137
146
  getNextMessage(): {
138
147
  shouldWait: boolean;
139
- promise: Promise<GenerateUserMessage>;
148
+ promise: Promise<GenerateUserMessage | undefined>;
140
149
  };
141
150
  sendFeedback(feedback: Partial<CodegenFeedback>): Promise<void>;
142
151
  lastTurnHasChanges(): Promise<boolean>;
@@ -156,8 +165,80 @@ export declare class CodeGenSession {
156
165
  */
157
166
  hasChanges(): boolean;
158
167
  isCleanWorkTree(): Promise<boolean>;
168
+ /**
169
+ * Resolves a workspace file path to its actual file system path
170
+ * @param filePath A file path that may include a workspace prefix (e.g., "workspace1/path/to/file.js")
171
+ * @returns The actual file system path and the workspace folder it belongs to
172
+ */
173
+ resolveWorkspacePath(filePath: string): {
174
+ resolvedPath: string;
175
+ workspaceFolder?: WorkspaceFolder;
176
+ };
177
+ /**
178
+ * Converts an absolute path back to a workspace-relative path if applicable
179
+ * @param absolutePath An absolute file system path
180
+ * @returns The workspace-relative path with appropriate prefix
181
+ */
182
+ toWorkspaceRelativePath(absolutePath: string): string;
183
+ /**
184
+ * Reads a file from the workspace
185
+ * @param filePath A file path that may include a workspace prefix
186
+ * @returns The file content or null if the file doesn't exist
187
+ */
188
+ readFile(filePath: string): Promise<string | null>;
189
+ /**
190
+ * Reads a file from the workspace synchronously
191
+ * @param filePath A file path that may include a workspace prefix
192
+ * @returns The file content or null if the file doesn't exist
193
+ */
194
+ readFileSync(filePath: string): string | null;
195
+ /**
196
+ * Writes content to a file in the workspace
197
+ * @param filePath A file path that may include a workspace prefix
198
+ * @param content The content to write
199
+ * @returns True if the write was successful, false otherwise
200
+ */
201
+ writeFile(filePath: string, content: string | Uint8Array): Promise<boolean>;
202
+ /**
203
+ * Checks if a file exists in the workspace
204
+ * @param filePath A file path that may include a workspace prefix
205
+ * @returns True if the file exists, false otherwise
206
+ */
207
+ fileExists(filePath: string): Promise<boolean>;
208
+ /**
209
+ * Lists files in a directory in the workspace
210
+ * @param dirPath A directory path that may include a workspace prefix
211
+ * @returns Array of file names in the directory or empty array if directory doesn't exist
212
+ */
213
+ listDir(dirPath: string): Promise<string[]>;
214
+ /**
215
+ * Get stats for a file in the workspace
216
+ * @param filePath A file path that may include a workspace prefix
217
+ * @returns The file stats or null if the file doesn't exist
218
+ */
219
+ stat(filePath: string): Promise<{
220
+ isDirectory: () => boolean;
221
+ isFile: () => boolean;
222
+ } | null>;
223
+ /**
224
+ * Deletes a file from the workspace
225
+ * @param filePath A file path that may include a workspace prefix
226
+ * @returns True if the delete was successful, false otherwise
227
+ */
228
+ deleteFile(filePath: string): Promise<boolean>;
159
229
  }
160
230
  export declare function transformStream(body: ReadableStream<Uint8Array> | null): AsyncGenerator<string, void, unknown>;
161
231
  export declare function getUserContext(sys: DevToolsSys): Promise<UserContext>;
162
232
  export declare function makeAsyncIterator<T>(): readonly [AsyncGenerator<T, void, void>, (event: T) => void, () => void];
163
233
  export declare function isServerResponding(url: string, maxRetries?: number, retryDelay?: number): Promise<boolean>;
234
+ /**
235
+ * Loads a workspace configuration from a JSON file
236
+ * @param sys DevToolsSys instance
237
+ * @param workspaceFile Path to the workspace JSON file
238
+ * @returns The workspace configuration and working directory
239
+ */
240
+ export declare function loadWorkspace(sys: DevToolsSys, workspaceFile: string): Promise<{
241
+ workspace: WorkspaceConfiguration;
242
+ workingDirectory: string;
243
+ }>;
244
+ export declare function keepAlive(): () => void;
@@ -45,4 +45,6 @@ export interface CLIArgs {
45
45
  builderPublicKey?: string;
46
46
  /** Builder user ID, used for authentication. */
47
47
  builderUserId?: string;
48
+ /** Path to workspace configuration file */
49
+ workspace?: string;
48
50
  }
@@ -34,6 +34,7 @@ export type LaunchStatus = {
34
34
  error?: string | undefined;
35
35
  current?: string | undefined;
36
36
  expected?: string | undefined;
37
+ elapsedTime?: number;
37
38
  };
38
39
  gitUser?: {
39
40
  configured?: boolean;
@@ -1,5 +1,6 @@
1
1
  import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
2
  import type { CLIArgs } from "./index";
3
+ import { type WorkspaceConfiguration } from "./codegen";
3
4
  import { type CommitMode } from "./code-tools";
4
5
  /**
5
6
  * Large random-ish port number that is unlikely to be used
@@ -48,6 +49,7 @@ export interface FusionConfig {
48
49
  projectId?: string;
49
50
  checkCommand?: string;
50
51
  workingDirectory: string;
52
+ workspace?: WorkspaceConfiguration | string;
51
53
  authenticateProxy: boolean;
52
54
  allowedCommands: string[];
53
55
  commitMode: CommitMode;