builder.io 1.6.56 → 1.6.58
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/cli/index.cjs +509 -503
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +67 -66
- package/server/index.mjs +67 -66
- package/types/_tests_/workspace.e2e.d.ts +1 -0
- package/types/cli/code-tools.d.ts +15 -0
- package/types/cli/codegen.d.ts +87 -3
- package/types/cli/index.d.ts +2 -0
- package/types/cli/launch/helpers.d.ts +1 -0
- package/types/cli/launch.d.ts +2 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,9 +31,24 @@ export interface ToolContext extends Partial<FusionContext> {
|
|
|
31
31
|
files: ProjectFile[];
|
|
32
32
|
emitter: EventEmitter<{
|
|
33
33
|
step: [GenerateCompletionStep];
|
|
34
|
+
idle: [];
|
|
34
35
|
}>;
|
|
35
36
|
signal: AbortSignal | undefined;
|
|
36
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>;
|
|
37
52
|
}
|
|
38
53
|
export declare function resolveToolCalls(toolContext: ToolContext, toolCalls: LLMToolCalls[]): Promise<ContentMessageItemToolResult[]>;
|
|
39
54
|
interface RipgrepMatch {
|
package/types/cli/codegen.d.ts
CHANGED
|
@@ -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;
|
|
@@ -134,16 +142,20 @@ export declare class CodeGenSession {
|
|
|
134
142
|
getCurrentState(): GenerateCompletionState;
|
|
135
143
|
getLastTurn(): CodegenTurn | undefined;
|
|
136
144
|
getNextUrl(): string | undefined;
|
|
137
|
-
getNextMessage():
|
|
145
|
+
getNextMessage(): {
|
|
146
|
+
shouldWait: boolean;
|
|
147
|
+
promise: Promise<GenerateUserMessage | undefined>;
|
|
148
|
+
};
|
|
138
149
|
sendFeedback(feedback: Partial<CodegenFeedback>): Promise<void>;
|
|
139
150
|
lastTurnHasChanges(): Promise<boolean>;
|
|
140
151
|
sendMessage(message: GenerateUserMessage, immediate?: boolean): Promise<void>;
|
|
141
152
|
getTurns(): CodegenTurn[];
|
|
142
153
|
getSessionContext(): SessionContext;
|
|
143
|
-
abort(): Promise<boolean>;
|
|
154
|
+
abort(cleanCurrentMessage?: boolean): Promise<boolean>;
|
|
144
155
|
stopEventLoop(): Promise<void>;
|
|
145
156
|
close(): Promise<void>;
|
|
146
|
-
connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void):
|
|
157
|
+
connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): () => void;
|
|
158
|
+
waitUntilIdle(): Promise<void>;
|
|
147
159
|
waitForEventLoop(): Promise<void>;
|
|
148
160
|
agentCompletion(userMessage: GenerateUserMessage, signal: AbortSignal | undefined, onStep: (step: GenerateCompletionStep) => void): Promise<void>;
|
|
149
161
|
commitWorkInProgress(lastTurn: CodegenTurn): Promise<string | undefined>;
|
|
@@ -152,8 +164,80 @@ export declare class CodeGenSession {
|
|
|
152
164
|
*/
|
|
153
165
|
hasChanges(): boolean;
|
|
154
166
|
isCleanWorkTree(): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Resolves a workspace file path to its actual file system path
|
|
169
|
+
* @param filePath A file path that may include a workspace prefix (e.g., "workspace1/path/to/file.js")
|
|
170
|
+
* @returns The actual file system path and the workspace folder it belongs to
|
|
171
|
+
*/
|
|
172
|
+
resolveWorkspacePath(filePath: string): {
|
|
173
|
+
resolvedPath: string;
|
|
174
|
+
workspaceFolder?: WorkspaceFolder;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Converts an absolute path back to a workspace-relative path if applicable
|
|
178
|
+
* @param absolutePath An absolute file system path
|
|
179
|
+
* @returns The workspace-relative path with appropriate prefix
|
|
180
|
+
*/
|
|
181
|
+
toWorkspaceRelativePath(absolutePath: string): string;
|
|
182
|
+
/**
|
|
183
|
+
* Reads a file from the workspace
|
|
184
|
+
* @param filePath A file path that may include a workspace prefix
|
|
185
|
+
* @returns The file content or null if the file doesn't exist
|
|
186
|
+
*/
|
|
187
|
+
readFile(filePath: string): Promise<string | null>;
|
|
188
|
+
/**
|
|
189
|
+
* Reads a file from the workspace synchronously
|
|
190
|
+
* @param filePath A file path that may include a workspace prefix
|
|
191
|
+
* @returns The file content or null if the file doesn't exist
|
|
192
|
+
*/
|
|
193
|
+
readFileSync(filePath: string): string | null;
|
|
194
|
+
/**
|
|
195
|
+
* Writes content to a file in the workspace
|
|
196
|
+
* @param filePath A file path that may include a workspace prefix
|
|
197
|
+
* @param content The content to write
|
|
198
|
+
* @returns True if the write was successful, false otherwise
|
|
199
|
+
*/
|
|
200
|
+
writeFile(filePath: string, content: string | Uint8Array): Promise<boolean>;
|
|
201
|
+
/**
|
|
202
|
+
* Checks if a file exists in the workspace
|
|
203
|
+
* @param filePath A file path that may include a workspace prefix
|
|
204
|
+
* @returns True if the file exists, false otherwise
|
|
205
|
+
*/
|
|
206
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
207
|
+
/**
|
|
208
|
+
* Lists files in a directory in the workspace
|
|
209
|
+
* @param dirPath A directory path that may include a workspace prefix
|
|
210
|
+
* @returns Array of file names in the directory or empty array if directory doesn't exist
|
|
211
|
+
*/
|
|
212
|
+
listDir(dirPath: string): Promise<string[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Get stats for a file in the workspace
|
|
215
|
+
* @param filePath A file path that may include a workspace prefix
|
|
216
|
+
* @returns The file stats or null if the file doesn't exist
|
|
217
|
+
*/
|
|
218
|
+
stat(filePath: string): Promise<{
|
|
219
|
+
isDirectory: () => boolean;
|
|
220
|
+
isFile: () => boolean;
|
|
221
|
+
} | null>;
|
|
222
|
+
/**
|
|
223
|
+
* Deletes a file from the workspace
|
|
224
|
+
* @param filePath A file path that may include a workspace prefix
|
|
225
|
+
* @returns True if the delete was successful, false otherwise
|
|
226
|
+
*/
|
|
227
|
+
deleteFile(filePath: string): Promise<boolean>;
|
|
155
228
|
}
|
|
156
229
|
export declare function transformStream(body: ReadableStream<Uint8Array> | null): AsyncGenerator<string, void, unknown>;
|
|
157
230
|
export declare function getUserContext(sys: DevToolsSys): Promise<UserContext>;
|
|
158
231
|
export declare function makeAsyncIterator<T>(): readonly [AsyncGenerator<T, void, void>, (event: T) => void, () => void];
|
|
159
232
|
export declare function isServerResponding(url: string, maxRetries?: number, retryDelay?: number): Promise<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* Loads a workspace configuration from a JSON file
|
|
235
|
+
* @param sys DevToolsSys instance
|
|
236
|
+
* @param workspaceFile Path to the workspace JSON file
|
|
237
|
+
* @returns The workspace configuration and working directory
|
|
238
|
+
*/
|
|
239
|
+
export declare function loadWorkspace(sys: DevToolsSys, workspaceFile: string): Promise<{
|
|
240
|
+
workspace: WorkspaceConfiguration;
|
|
241
|
+
workingDirectory: string;
|
|
242
|
+
}>;
|
|
243
|
+
export declare function keepAlive(): () => void;
|
package/types/cli/index.d.ts
CHANGED
package/types/cli/launch.d.ts
CHANGED
|
@@ -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;
|