builder.io 1.6.75 → 1.6.77

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,4 +1,4 @@
1
- import type { CodeGenTools, ContentMessageItemToolResult, GenerateCompletionStep, ProjectFile } from "$/ai-utils";
1
+ import type { CodeGenTools, CommitMode, ContentMessageItemToolResult, GenerateCompletionStep, ProjectFile } from "$/ai-utils";
2
2
  import type { DevToolsSys } from "../core";
3
3
  import { type ChildProcessByStdio } from "child_process";
4
4
  import type { RunCommandCtx } from "./codegen";
@@ -14,7 +14,6 @@ export interface ToolResolution {
14
14
  isError: boolean;
15
15
  title?: string;
16
16
  }
17
- export type CommitMode = "commits" | "draft-prs" | "prs";
18
17
  export interface FusionContext {
19
18
  commandCtx?: RunCommandCtx;
20
19
  checkCommand?: string;
@@ -1,8 +1,8 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import { type Credentials } from "./credentials";
3
- import type { CodegenFeedback, CodegenTurn, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext } from "$/ai-utils";
3
+ import type { CodegenFeedback, CodegenTurn, CommitMode, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder } from "$/ai-utils";
4
4
  import prettier from "prettier";
5
- import { type CommitMode, type FusionContext } from "./code-tools";
5
+ import { type FusionContext } from "./code-tools";
6
6
  export interface RunCommandCtx {
7
7
  command: string;
8
8
  state: "running" | "stopped";
@@ -31,13 +31,6 @@ 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
- }
41
34
  export interface CodeGenSessionOptionsBase {
42
35
  sys: DevToolsSys;
43
36
  credentials: Credentials;
@@ -71,13 +64,18 @@ export declare class CodeGenSession {
71
64
  error: string;
72
65
  details?: undefined;
73
66
  } | {
74
- success: boolean;
75
- error: string;
76
- details: string;
77
- } | {
67
+ output: string;
68
+ upToDate: boolean;
69
+ createdBranch: boolean;
70
+ setUpToStream: boolean;
71
+ status: GenerateCompletionStepGit | null;
78
72
  success: boolean;
79
73
  error?: undefined;
80
74
  details?: undefined;
75
+ } | {
76
+ success: boolean;
77
+ error: string;
78
+ details: string;
81
79
  }>;
82
80
  createPR(...args: [
83
81
  {
@@ -87,6 +85,11 @@ export declare class CodeGenSession {
87
85
  projectId: string;
88
86
  }
89
87
  ] | [string, string, string, string]): Promise<{
88
+ output: string;
89
+ upToDate: boolean;
90
+ createdBranch: boolean;
91
+ setUpToStream: boolean;
92
+ status: GenerateCompletionStepGit | null;
90
93
  success: boolean;
91
94
  prUrl: any;
92
95
  prNumber: any;
@@ -96,12 +99,16 @@ export declare class CodeGenSession {
96
99
  success: boolean;
97
100
  error: string;
98
101
  details: unknown;
99
- prUrl?: undefined;
100
- prNumber?: undefined;
101
102
  }>;
102
103
  getCommitMode(): CommitMode | undefined;
103
104
  setCommitMode(commitMode: CommitMode): void;
104
- pushChanges(pullFirst?: boolean): Promise<void>;
105
+ pushChanges(pullFirst?: boolean): Promise<{
106
+ output: string;
107
+ upToDate: boolean;
108
+ createdBranch: boolean;
109
+ setUpToStream: boolean;
110
+ status: GenerateCompletionStepGit | null;
111
+ }>;
105
112
  hasChangesRelativeToRemote(): Promise<boolean>;
106
113
  pullLatestFromRemote(): Promise<void>;
107
114
  /**
@@ -51,4 +51,8 @@ export interface CLIArgs {
51
51
  jsonOutput?: boolean;
52
52
  /** Local mode */
53
53
  local?: boolean;
54
+ /** Inlined to builder.config.json file */
55
+ configJson?: string;
56
+ /** Server URL */
57
+ serverUrl?: string;
54
58
  }
@@ -0,0 +1,92 @@
1
+ import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
+ import { EventEmitter } from "events";
3
+ import type { FusionConfig } from "$/ai-utils";
4
+ export declare enum InitState {
5
+ IDLE = "IDLE",
6
+ CHECKING_DIRECTORIES = "CHECKING_DIRECTORIES",
7
+ CONFIGURING_GIT_REPO = "CONFIGURING_GIT_REPO",
8
+ CONFIGURING_GIT_USER = "CONFIGURING_GIT_USER",
9
+ INSTALLING_DEPENDENCIES = "INSTALLING_DEPENDENCIES",
10
+ STASHING_CHANGES = "STASHING_CHANGES",
11
+ COMPLETED = "COMPLETED",
12
+ FAILED = "FAILED",
13
+ CANCELLED = "CANCELLED"
14
+ }
15
+ export interface InitConfig {
16
+ fusionConfig: FusionConfig;
17
+ retryDelayMs?: number;
18
+ maxRetryDelayMs?: number;
19
+ sys: DevToolsSys;
20
+ debug?: boolean;
21
+ }
22
+ export interface InitStatus {
23
+ state: InitState;
24
+ progress: number;
25
+ message: string;
26
+ error?: string;
27
+ metadata?: Record<string, any>;
28
+ }
29
+ export interface OperationLogEntry {
30
+ id: string;
31
+ operation: string;
32
+ state: InitState;
33
+ startTime: number;
34
+ endTime?: number;
35
+ duration?: number;
36
+ status: "started" | "completed" | "failed" | "aborted";
37
+ error?: string;
38
+ metadata?: Record<string, any>;
39
+ }
40
+ export interface InitStateMachineEvents {
41
+ status: (status: InitStatus) => void;
42
+ operation: (entry: OperationLogEntry) => void;
43
+ error: (error: string, state: InitState) => void;
44
+ complete: (success: boolean, finalState: InitState) => void;
45
+ abort: (state: InitState) => void;
46
+ }
47
+ export interface TypedEventEmitter {
48
+ on<K extends keyof InitStateMachineEvents>(event: K, listener: InitStateMachineEvents[K]): this;
49
+ off<K extends keyof InitStateMachineEvents>(event: K, listener: InitStateMachineEvents[K]): this;
50
+ emit<K extends keyof InitStateMachineEvents>(event: K, ...args: Parameters<InitStateMachineEvents[K]>): boolean;
51
+ }
52
+ export declare class InitStateMachine extends EventEmitter implements TypedEventEmitter {
53
+ private currentState;
54
+ private config;
55
+ private retryCount;
56
+ private metadata;
57
+ private abortController;
58
+ private activeChildProcesses;
59
+ private readonly baseRetryDelay;
60
+ private readonly maxRetryDelay;
61
+ private readonly execAsync;
62
+ private operationLog;
63
+ private operationCounter;
64
+ private readonly repositories;
65
+ constructor(config: InitConfig);
66
+ private updateStatus;
67
+ private sanitizeError;
68
+ private delay;
69
+ private calculateRetryDelay;
70
+ private executeWithRetry;
71
+ private getProgress;
72
+ private checkAborted;
73
+ private checkDirectories;
74
+ private isGitConfigured;
75
+ private getGitRemoteUrl;
76
+ private sanitizeGitRemoteUrl;
77
+ private cloneRepository;
78
+ private configureGitRepos;
79
+ private configureGitUser;
80
+ private installDependencies;
81
+ private stashChanges;
82
+ execute(signal?: AbortSignal): Promise<boolean>;
83
+ getCurrentState(): InitState;
84
+ getMetadata(): Record<string, any>;
85
+ getOperationLog(): OperationLogEntry[];
86
+ cleanup(): Promise<void>;
87
+ private startOperation;
88
+ private completeOperation;
89
+ private failOperation;
90
+ private abortOperation;
91
+ private getPerformanceStats;
92
+ }
@@ -0,0 +1,5 @@
1
+ import type { FusionConfig } from "$/ai-utils";
2
+ import type { LaunchArgs } from "../launch";
3
+ import type { InitArgs } from "../launch-init";
4
+ import type { DevToolsSys } from "types";
5
+ export declare function getFusionConfig(sys: DevToolsSys, args: LaunchArgs & InitArgs): Promise<FusionConfig>;
@@ -0,0 +1,13 @@
1
+ import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
+ import type { CLIArgs } from "./index";
3
+ export interface InitArgs extends CLIArgs {
4
+ repoFullName?: string;
5
+ branchName?: string;
6
+ githubToken?: string;
7
+ installCommand?: string;
8
+ dockerImageType?: "fusion-starter" | "node";
9
+ }
10
+ export declare function runLaunchInitCommandV2({ args, sys, }: {
11
+ sys: DevToolsSys;
12
+ args: InitArgs;
13
+ }): Promise<number>;
@@ -1,13 +1,10 @@
1
1
  import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
2
  import type { CLIArgs } from "./index";
3
- import { type WorkspaceConfiguration } from "./codegen";
4
- import { type CommitMode } from "./code-tools";
5
3
  /**
6
4
  * Large random-ish port number that is unlikely to be used
7
5
  */
8
6
  export declare const PROXY_PORT = 48752;
9
7
  export interface LaunchArgs extends CLIArgs {
10
- cwdAgent?: string;
11
8
  /** Project ID for the dev server. Only needed when running in a remote container. */
12
9
  projectId?: string;
13
10
  /** Silent mode for launch command */
@@ -20,6 +17,8 @@ export interface LaunchArgs extends CLIArgs {
20
17
  command?: string;
21
18
  /** Dev server command to execute (shorthand) */
22
19
  c?: string;
20
+ /** Dev server URL to proxy to (alternative to command + port) */
21
+ serverUrl?: string;
23
22
  /** Use development server instead of production for launch command */
24
23
  dev?: boolean;
25
24
  /** Skip browser auto-open (flag form) */
@@ -58,17 +57,6 @@ export interface LaunchArgs extends CLIArgs {
58
57
  */
59
58
  local?: boolean;
60
59
  }
61
- export interface FusionConfig {
62
- command: string;
63
- projectId?: string;
64
- checkCommand?: string;
65
- workingDirectory: string;
66
- workspace?: WorkspaceConfiguration | string;
67
- authenticateProxy: boolean;
68
- allowedCommands: string[];
69
- commitMode: CommitMode;
70
- serverUrl: string;
71
- }
72
60
  export declare function runFusionCommand({ sys, args, }: {
73
61
  sys: DevToolsSys;
74
62
  args: LaunchArgs;