builder.io 1.6.19 → 1.6.22
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 +2017 -410
- package/cli/index.cjs.map +4 -4
- package/cli/main.cjs +1 -1
- package/core/index.cjs +37 -37
- package/core/index.mjs +36 -36
- package/node/index.cjs +3 -3
- package/node/index.mjs +15 -15
- package/package.json +6 -2
- package/server/index.cjs +238 -173
- package/server/index.mjs +238 -173
- package/types/cli/code-server.d.ts +3 -0
- package/types/cli/code-tools.d.ts +11 -0
- package/types/cli/code.d.ts +41 -29
- package/types/cli/figma.d.ts +1 -0
- package/types/cli/index.d.ts +2 -2
- package/types/cli/indexing.d.ts +0 -8
- package/types/cli/io-service.d.ts +86 -0
- package/types/cli/report/figma-report.d.ts +3 -0
- package/types/cli/sync-utils.d.ts +2 -1
- package/types/common/dotenv.d.ts +1 -1
- package/types/common/dotenv.test.d.ts +1 -0
- package/types/common/test-utils.d.ts +3 -1
- package/types/server/builder-connect.d.ts +4 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/types.d.ts +14 -4
- package/vite/index.cjs +2 -2
- package/vite/index.mjs +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CodeGenTools, ContentMessageItemToolResult, ProjectFile } from "$/ai-utils";
|
|
2
|
+
import type { DevToolsSys } from "../core";
|
|
3
|
+
export interface LLMToolCalls {
|
|
4
|
+
name: CodeGenTools;
|
|
5
|
+
input: Record<string, any>;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveToolCalls(sys: DevToolsSys, toolCalls: LLMToolCalls[]): Promise<{
|
|
9
|
+
toolResults: ContentMessageItemToolResult[];
|
|
10
|
+
projectFiles: ProjectFile[];
|
|
11
|
+
}>;
|
package/types/cli/code.d.ts
CHANGED
|
@@ -2,48 +2,60 @@ import type { DevToolsSys } from "../types";
|
|
|
2
2
|
import type { CLIArgs } from "./index";
|
|
3
3
|
import { type Credentials } from "./credentials";
|
|
4
4
|
import { type Checkpoint } from "./incremental-tsc";
|
|
5
|
-
import type
|
|
5
|
+
import { type IOService } from "./io-service";
|
|
6
|
+
import type { ContentMessageItemToolResult, CustomInstruction, ProjectFile, UserContext } from "$/ai-utils";
|
|
7
|
+
import prettier from "prettier";
|
|
6
8
|
interface UndoState {
|
|
7
9
|
files: {
|
|
8
10
|
path: string;
|
|
9
|
-
content:
|
|
11
|
+
content: Uint8Array | null;
|
|
10
12
|
}[];
|
|
11
13
|
isAgent: boolean;
|
|
12
14
|
url: string | undefined;
|
|
15
|
+
toolResults: ContentMessageItemToolResult[];
|
|
13
16
|
}
|
|
14
|
-
interface
|
|
17
|
+
interface CodeGenSearchResponse {
|
|
18
|
+
ranked: RankedResult[];
|
|
19
|
+
relevantPaths: string[];
|
|
20
|
+
}
|
|
21
|
+
interface RankedResult {
|
|
22
|
+
filePath: string;
|
|
23
|
+
startIndex: number;
|
|
24
|
+
endIndex: number;
|
|
25
|
+
score: number;
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
type State = "initial-with-url" | "initial-without-url" | "success" | "success-just-text" | "abort" | "error";
|
|
29
|
+
export interface SessionContext {
|
|
15
30
|
sessionId: string;
|
|
16
31
|
undoStates: UndoState[];
|
|
17
32
|
selectedFilePaths: Map<string, number>;
|
|
33
|
+
customInstructions: CustomInstruction[];
|
|
34
|
+
userContext: UserContext;
|
|
35
|
+
prettierConfig: prettier.Config | null;
|
|
36
|
+
state: State;
|
|
37
|
+
}
|
|
38
|
+
export interface UserInput {
|
|
39
|
+
userPrompt: string;
|
|
40
|
+
sentiment: "positive" | "negative" | "undo";
|
|
41
|
+
files: ProjectFile[];
|
|
42
|
+
searchResponse: CodeGenSearchResponse | null;
|
|
43
|
+
rerankFiles?: number;
|
|
44
|
+
mostRelevantFile: string | null;
|
|
45
|
+
role: "user" | "agent";
|
|
18
46
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export interface ArtifactItem {
|
|
29
|
-
type: "file" | "text" | "delta" | "done" | "diff" | "request_file" | "thinking" | "user" | "continue";
|
|
30
|
-
id?: string;
|
|
31
|
-
content: string;
|
|
32
|
-
filePath?: string;
|
|
33
|
-
artifactTitle?: string;
|
|
34
|
-
actionTitle?: string;
|
|
35
|
-
synthetic?: boolean;
|
|
36
|
-
incomplete?: boolean;
|
|
37
|
-
nextUrl?: string;
|
|
38
|
-
actions?: ArtifactItem[];
|
|
39
|
-
stopReason?: "end" | "limit" | "error" | "max_tokens";
|
|
40
|
-
usage?: CodegenUsage;
|
|
47
|
+
export declare const runCodeCommand: (sys: DevToolsSys, subCommand: string, args: CLIArgs, io?: IOService) => Promise<void>;
|
|
48
|
+
export declare const createSessionContext: (sys: DevToolsSys) => Promise<SessionContext>;
|
|
49
|
+
export declare const runCodeGen: (sys: DevToolsSys, args: CLIArgs, io?: IOService) => Promise<void>;
|
|
50
|
+
interface InteractiveAnswer {
|
|
51
|
+
command: "exit" | undefined;
|
|
52
|
+
userPrompt: string | undefined;
|
|
53
|
+
feedback: "positive" | "negative" | "undo" | undefined;
|
|
41
54
|
}
|
|
42
|
-
export declare
|
|
43
|
-
export declare
|
|
44
|
-
export declare function agentCompletion(sys: DevToolsSys, credentials: Credentials, args: CLIArgs, userContext: UserContext, sessionContext: SessionContext, userPrompt: string, initialUrl: string | undefined, relevantFile: string | null | undefined, wasBad: boolean, baselineCheckpoint: Checkpoint): Promise<Checkpoint>;
|
|
55
|
+
export declare function getUserInput(sys: DevToolsSys, credentials: Credentials, args: CLIArgs, sessionContext: SessionContext, answer: InteractiveAnswer, signal: AbortSignal | undefined, io?: IOService): Promise<UserInput>;
|
|
56
|
+
export declare function agentCompletion(sys: DevToolsSys, credentials: Credentials, args: CLIArgs, sessionContext: SessionContext, userInput: UserInput, url: string | undefined, baselineCheckpoint: Checkpoint, signal: AbortSignal | undefined, io?: IOService): Promise<Checkpoint>;
|
|
45
57
|
export declare function createApp(userId: string, spaceId: string, privateKey: string, body: any): Promise<void>;
|
|
46
58
|
export declare function transformStream(body: ReadableStream<Uint8Array> | null): AsyncGenerator<string, void, unknown>;
|
|
47
|
-
export declare function checkProjectRoot(sys: DevToolsSys, interactive: boolean): Promise<
|
|
59
|
+
export declare function checkProjectRoot(sys: DevToolsSys, interactive: boolean, io?: IOService): Promise<void>;
|
|
48
60
|
export declare function getUserContext(sys: DevToolsSys): Promise<UserContext>;
|
|
49
61
|
export {};
|
package/types/cli/figma.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import type { CLIArgs } from ".";
|
|
3
3
|
export declare const runFigmaCommand: (sys: DevToolsSys, subCommand: string, args: CLIArgs) => Promise<void>;
|
|
4
|
+
export declare function askToInstallBuilder(sys: DevToolsSys, args: CLIArgs): Promise<void>;
|
package/types/cli/index.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export interface CLIArgs {
|
|
|
29
29
|
url?: string;
|
|
30
30
|
/** Prompt text for non-interactive mode */
|
|
31
31
|
prompt?: string;
|
|
32
|
-
/** Generation mode
|
|
33
|
-
mode?: "
|
|
32
|
+
/** Generation mode */
|
|
33
|
+
mode?: "fast" | "quality" | "quality-v3";
|
|
34
34
|
/** Working directory to run commands from */
|
|
35
35
|
cwd?: string;
|
|
36
36
|
/** Debug mode */
|
package/types/cli/indexing.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import type { CLIArgs } from "./index";
|
|
3
3
|
import { type Credentials } from "./credentials";
|
|
4
|
-
export interface ArtifactItem {
|
|
5
|
-
type: "shell" | "file" | "text" | "delta" | "done";
|
|
6
|
-
id?: string;
|
|
7
|
-
content: string;
|
|
8
|
-
filePath?: string;
|
|
9
|
-
artifactTitle?: string;
|
|
10
|
-
incomplete?: boolean;
|
|
11
|
-
}
|
|
12
4
|
export declare const runCodeIndexing: (_sys: DevToolsSys, _args: CLIArgs) => Promise<void>;
|
|
13
5
|
export declare const codeIndexing: (sys: DevToolsSys, credentials: Credentials) => Promise<void>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type SelectOptions, type ConfirmOptions, type TextOptions } from "@clack/prompts";
|
|
2
|
+
import { spinner } from "./spinner";
|
|
3
|
+
import type { WebSocket } from "ws";
|
|
4
|
+
export interface IOService {
|
|
5
|
+
log(str: string): void;
|
|
6
|
+
info(str: string): void;
|
|
7
|
+
warn(str: string): void;
|
|
8
|
+
error(str: string): void;
|
|
9
|
+
write(text: string): void;
|
|
10
|
+
writeMetadata(metadata: Record<string, any>): void;
|
|
11
|
+
confirm(options: ConfirmOptions): Promise<boolean | symbol>;
|
|
12
|
+
text(options: TextOptions): Promise<string | symbol>;
|
|
13
|
+
select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
|
|
14
|
+
createSpinner(): ReturnType<typeof spinner>;
|
|
15
|
+
isInteractive(): boolean;
|
|
16
|
+
isTTY(): boolean;
|
|
17
|
+
exit(code: number): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare class ConsoleIOService implements IOService {
|
|
20
|
+
log(str: string): void;
|
|
21
|
+
info(str: string): void;
|
|
22
|
+
warn(str: string): void;
|
|
23
|
+
error(str: string): void;
|
|
24
|
+
write(text: string): void;
|
|
25
|
+
writeMetadata(_: Record<string, any>): void;
|
|
26
|
+
confirm(options: ConfirmOptions): Promise<boolean | symbol>;
|
|
27
|
+
text(options: TextOptions): Promise<string | symbol>;
|
|
28
|
+
select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
|
|
29
|
+
createSpinner(): ReturnType<typeof spinner>;
|
|
30
|
+
isInteractive(): boolean;
|
|
31
|
+
isTTY(): boolean;
|
|
32
|
+
exit(code: number): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export interface BaseMessage {
|
|
35
|
+
type: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export interface LogMessage extends BaseMessage {
|
|
39
|
+
type: "log";
|
|
40
|
+
level: "info" | "warn" | "error";
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
export interface WriteMessage extends BaseMessage {
|
|
44
|
+
type: "write";
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SpinnerMessage extends BaseMessage {
|
|
48
|
+
type: "spinner";
|
|
49
|
+
status: "start" | "stop";
|
|
50
|
+
message: string;
|
|
51
|
+
code?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface PromptRequest extends BaseMessage {
|
|
54
|
+
type: "prompt";
|
|
55
|
+
promptType: "text" | "confirm" | "select";
|
|
56
|
+
options: any;
|
|
57
|
+
requestId: string;
|
|
58
|
+
}
|
|
59
|
+
export interface PromptResponse extends BaseMessage {
|
|
60
|
+
type: "prompt_response";
|
|
61
|
+
requestId: string;
|
|
62
|
+
value: any;
|
|
63
|
+
cancelled?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare class WebSocketIOService implements IOService {
|
|
66
|
+
private ws;
|
|
67
|
+
private promptCallbacks;
|
|
68
|
+
private messageQueue;
|
|
69
|
+
private isProcessing;
|
|
70
|
+
constructor(ws: WebSocket);
|
|
71
|
+
private sendMessage;
|
|
72
|
+
private prompt;
|
|
73
|
+
log(...args: any[]): void;
|
|
74
|
+
info(...args: any[]): void;
|
|
75
|
+
warn(...args: any[]): void;
|
|
76
|
+
error(...args: any[]): void;
|
|
77
|
+
write(text: string): void;
|
|
78
|
+
writeMetadata(metadata: Record<string, any>): void;
|
|
79
|
+
confirm(options: ConfirmOptions): Promise<boolean | symbol>;
|
|
80
|
+
text(options: TextOptions): Promise<string | symbol>;
|
|
81
|
+
select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
|
|
82
|
+
createSpinner(): ReturnType<typeof spinner>;
|
|
83
|
+
isInteractive(): boolean;
|
|
84
|
+
isTTY(): boolean;
|
|
85
|
+
exit(code: number): Promise<void>;
|
|
86
|
+
}
|
|
@@ -4,8 +4,9 @@ export declare function extractSignatureInfo(content: string): {
|
|
|
4
4
|
sessionKey?: string;
|
|
5
5
|
snippetId?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function getAllProjectFiles(basePath: string): Promise<string[]>;
|
|
7
|
+
export declare function getAllProjectFiles(basePath: string, globPattern?: string): Promise<string[]>;
|
|
8
8
|
export declare function findBuilderFiles(basePath: string, targetContentId: string, targetSessionKey: string): Promise<FileNode[]>;
|
|
9
|
+
export declare function filterNonImportantFiles(files: string[]): string[];
|
|
9
10
|
export declare function getIgnorePatterns(basePath: string): (path: string) => boolean;
|
|
10
11
|
export declare function watchDirectory(basePath: string, syncInfo: SyncInfo, onChange: (updatedSyncInfo: SyncInfo) => void): () => Promise<void>;
|
|
11
12
|
export declare function setupSyncServer(sys: DevToolsSys, initialSyncInfo?: SyncInfo): Promise<void>;
|
package/types/common/dotenv.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export declare function getDotEnvValue(sys: DevToolsSys, dotEnvFileNames: string
|
|
|
3
3
|
export declare function setDotEnvValue(sys: DevToolsSys, dotEnvFileNames: string[], envKey: string, envValue: string): Promise<EnvInfo>;
|
|
4
4
|
export declare function parseDotEnvFile(sys: DevToolsSys, envPath: string): Promise<Record<string, string> | null>;
|
|
5
5
|
export declare function parseDotEnvContent(envContent: string): Record<string, string>;
|
|
6
|
-
export declare function setDotEnvVar(sys: DevToolsSys, envPath: string, key: string, value: string): Promise<"create" | "update" | null>;
|
|
6
|
+
export declare function setDotEnvVar(sys: DevToolsSys, envPath: string, key: string, value: string): Promise<"create" | "update" | "permission-error" | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
export declare function codeEqual(sys: DevToolsSys, n: ts.Node | null | undefined | string, expectCode: string, removeComments?: boolean): Promise<void>;
|
|
4
|
-
export declare function createTestFsSys(rootDir: string
|
|
4
|
+
export declare function createTestFsSys(rootDir: string, options?: {
|
|
5
|
+
readOnlyPermissions?: boolean;
|
|
6
|
+
}): Promise<DevToolsSys>;
|
|
5
7
|
export declare function createTestMemSys(rootDir?: string): Promise<DevToolsSys>;
|
|
6
8
|
export declare function createRemixTestMemSys(rootDir?: string): Promise<DevToolsSys>;
|
|
7
9
|
export declare function createAngularTestMemSys(rootDir?: string): Promise<DevToolsSys>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { type DevToolsServerContext, type ConnectedBuilder, type ValidatedBuilder, type SPACE_KIND_VALUES } from "../types";
|
|
2
|
-
export declare function connectBuilder(ctx: DevToolsServerContext, publicApiKey: string, privateAuthKey: string, kind: SPACE_KIND_VALUES): Promise<ConnectedBuilder
|
|
2
|
+
export declare function connectBuilder(ctx: DevToolsServerContext, publicApiKey: string, privateAuthKey: string, kind: SPACE_KIND_VALUES): Promise<ConnectedBuilder | {
|
|
3
|
+
success: boolean;
|
|
4
|
+
pathname: string;
|
|
5
|
+
}>;
|
|
3
6
|
export declare function validateBuilder(ctx: DevToolsServerContext): Promise<ValidatedBuilder>;
|