@builder.io/dev-tools 1.21.10-dev.202601270922.8e39b4484 → 1.21.11-dev.202601271108.1da3cea5e

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,6 +1,6 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import { type Credentials } from "./credentials";
3
- import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, SuggestedActionBuildError, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, FolderWatchEvent, MCPServerConfig, CodegenApiCreateTerminal, SyncChangesFromRemote, SearchFilesOptions, SearchFilesResult, SearchFileTreeOptions, SearchFileTreeResult, ExplorationMetadataToolInput, CodegenAbortOptions, MessageUpdateOptions, GitRepoContext, SystemReminderObj } from "$/ai-utils";
3
+ import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, SuggestedActionBuildError, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, FolderWatchEvent, MCPServerConfig, CodegenApiCreateTerminal, SyncChangesFromRemote, SearchFilesOptions, SearchFilesResult, SearchFileTreeOptions, SearchFileTreeResult, ExplorationMetadataToolInput, CodegenAbortOptions, MessageUpdateOptions, SystemReminderObj } from "$/ai-utils";
4
4
  import { type FusionContext, type ToolResolution } from "./code-tools";
5
5
  import { type SubAgent } from "./utils/agent-discovery";
6
6
  import EventEmitter from "node:events";
@@ -12,12 +12,6 @@ export interface SyncChangesFromBranches {
12
12
  allowUnrelatedHistory: boolean;
13
13
  fastForward: "never" | "required" | "auto";
14
14
  requestRefresh?: boolean;
15
- /**
16
- * When true, compute the remote branch per-repo using #getRemoteBranch(ctx)
17
- * instead of using the passed branches array. This handles multi-repo
18
- * scenarios where each repo may have a different feature branch.
19
- */
20
- syncRemoteBranch?: boolean;
21
15
  }
22
16
  export interface SessionContext {
23
17
  sessionId: string;
@@ -53,6 +47,8 @@ export interface CodeGenSessionOptionsBase {
53
47
  enabledTools?: (keyof CodeGenToolMap)[];
54
48
  modelOverride?: string;
55
49
  skipFileDiff?: boolean;
50
+ agentType?: string;
51
+ includeMemories?: boolean;
56
52
  }
57
53
  export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase {
58
54
  sessionOrCompletionId?: string;
@@ -61,11 +57,17 @@ export interface CodeGenSessionOptionsInitialUrl extends CodeGenSessionOptionsBa
61
57
  initialUrl: string;
62
58
  }
63
59
  export type CodeGenSessionOptions = CodeGenSessionOptionsSession | CodeGenSessionOptionsInitialUrl;
64
- export interface SpawnAgentResult {
60
+ export type SpawnAgentResult = SpawnAgentResultSuccess | SpawnAgentResultFailed;
61
+ export interface SpawnAgentResultSuccess {
65
62
  success: boolean;
66
63
  response: string;
67
64
  metadata: ExplorationMetadataToolInput;
68
65
  lastTurn?: CodegenTurn;
66
+ sessionId: string;
67
+ }
68
+ export interface SpawnAgentResultFailed {
69
+ success: false;
70
+ response: string;
69
71
  }
70
72
  export type CodeGenEventEmitter = EventEmitter<{
71
73
  step: [GenerateCompletionStep];
@@ -75,12 +77,7 @@ export declare class CodeGenSession {
75
77
  #private;
76
78
  constructor(options: CodeGenSessionOptions);
77
79
  get fusionConfig(): FusionConfig | undefined;
78
- /** Returns the first git-enabled folder for backwards compatibility */
79
80
  get gitEnabledFolder(): WorkspaceFolder | undefined;
80
- /** Returns all git-enabled folders */
81
- get gitEnabledFolders(): WorkspaceFolder[];
82
- /** Returns runtime git repo contexts for all enabled repos */
83
- get gitRepoContexts(): readonly GitRepoContext[];
84
81
  get workingDirectory(): string;
85
82
  getSessionMode(): SessionMode;
86
83
  switchSessionMode(newMode: SessionMode): Promise<void>;
@@ -97,21 +94,6 @@ export declare class CodeGenSession {
97
94
  loadMoreTurns(): Promise<CodegenTurn[]>;
98
95
  setCustomInstructions(instructions: CustomInstruction[]): Promise<void>;
99
96
  setCustomAgents(agents: SubAgent[]): Promise<void>;
100
- /**
101
- * Spawn a named custom agent by ID or name
102
- * @param agentNameOrId - The agent's name or ID
103
- * @param options - Additional spawning options
104
- * @returns SpawnAgentResult
105
- */
106
- spawnNamedAgent(agentName: string | undefined, options: {
107
- prompt: string;
108
- user: UserSource;
109
- onStep?: (step: GenerateCompletionStep, subagent_type: string) => void;
110
- signal?: AbortSignal;
111
- maxCompletions?: number;
112
- sessionId?: string;
113
- mcpServers?: boolean;
114
- }): Promise<SpawnAgentResult>;
115
97
  pushRepoV2(repoInfo: {
116
98
  repoFullName: string;
117
99
  repoUrl: string;
@@ -134,8 +116,8 @@ export declare class CodeGenSession {
134
116
  /**
135
117
  * Get the current commit hash
136
118
  */
137
- getCurrentCommitHash(branchName?: string, repoPath?: string): Promise<string | undefined>;
138
- getCurrentBranch(repoPath?: string): Promise<string>;
119
+ getCurrentCommitHash(branchName?: string): Promise<string | undefined>;
120
+ getCurrentBranch(): Promise<string>;
139
121
  /**
140
122
  * Get the feature branch name
141
123
  */
@@ -144,7 +126,7 @@ export declare class CodeGenSession {
144
126
  * Get the AI branch name
145
127
  */
146
128
  getAiBranch(): string;
147
- git(args: string[], opts?: string | Partial<RunCommandOptions>): Promise<string>;
129
+ git(args: string[], opts?: string | RunCommandOptions): Promise<string>;
148
130
  setDebug(debug: boolean): void;
149
131
  createTerminal(options?: CodegenApiCreateTerminal): Promise<CodegenApiTerminal>;
150
132
  emitTerminals(): void;
@@ -194,12 +176,11 @@ export declare class CodeGenSession {
194
176
  searchFileTree(options: SearchFileTreeOptions): Promise<SearchFileTreeResult>;
195
177
  collectRepoMetrics(opts?: {
196
178
  rootPath?: string;
197
- folderName?: string;
198
179
  }): Promise<RepoMetrics>;
199
180
  getSessionId(): string;
200
181
  getSpaceId(): string | undefined;
201
182
  revertToCommitHash(commitHash: string): Promise<void>;
202
- resetToCommitHash(commitHash: string): Promise<void>;
183
+ resetToCommitHash(commitHash: string, requestRefresh?: boolean): Promise<void>;
203
184
  /**
204
185
  * Core function to restore the codebase to a state that matches a predicate.
205
186
  * This is the main function that handles both git-based and file-based restoration.
@@ -264,22 +245,29 @@ export declare class CodeGenSession {
264
245
  state: "installed" | "not-installed" | "install-failed" | "install-aborted";
265
246
  shouldProceed: boolean;
266
247
  }>;
267
- spawnAgent(options: {
248
+ getNamedAgentConfig(agentName: string | undefined, signal?: AbortSignal): Promise<{
249
+ success: true;
250
+ options: CodeGenSessionOptions;
251
+ resetAfterRun: boolean;
268
252
  subagent_type: string;
253
+ } | {
254
+ success: false;
255
+ response: string;
256
+ }>;
257
+ /**
258
+ * Spawn a named custom agent by ID or name
259
+ * @param agentNameOrId - The agent's name or ID
260
+ * @param options - Additional spawning options
261
+ * @returns SpawnAgentResult
262
+ */
263
+ spawnNamedAgent(agentName: string | undefined, options: {
269
264
  prompt: string;
270
265
  user: UserSource;
271
- onStep?: (step: GenerateCompletionStep, subagent_type: string) => void;
272
- signal?: AbortSignal;
266
+ signal: AbortSignal;
273
267
  maxCompletions?: number;
274
268
  sessionId?: string;
269
+ resume?: string;
275
270
  mcpServers?: boolean;
276
- tools?: string[];
277
- model?: string;
278
- mode?: CodeGenMode;
279
- includeMemories?: boolean;
280
- needDevServer?: boolean;
281
- needValidation?: boolean;
282
- systemPrompt?: string;
283
271
  }): Promise<SpawnAgentResult>;
284
272
  setProxyOrigin(proxySrc: string | undefined): void;
285
273
  getTurns(): CodegenTurn[];
@@ -323,7 +311,6 @@ export declare class CodeGenSession {
323
311
  manualCommit(options: {
324
312
  add: string;
325
313
  commitMessage: string;
326
- folderName?: string;
327
314
  }): Promise<boolean>;
328
315
  getLastSuggestedAction(): SuggestedActionBuildError | undefined;
329
316
  connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): () => void;
@@ -331,12 +318,12 @@ export declare class CodeGenSession {
331
318
  waitUntilBlockingPendingPromises(): Promise<void>;
332
319
  waitUntilIdle(): Promise<void>;
333
320
  waitForEventLoop(): Promise<void>;
334
- commitWorkInProgress(lastTurn: CodegenTurn, changedFiles: string[]): Promise<string | false>;
321
+ commitWorkInProgress(lastTurn: CodegenTurn, changedFiles: string[]): Promise<string | false | undefined>;
335
322
  getChangesReport(): Promise<{
336
323
  diff: string;
337
324
  files: string[];
338
325
  } | undefined>;
339
- isCleanWorkTree(repoPath?: string): Promise<boolean>;
326
+ isCleanWorkTree(): Promise<boolean>;
340
327
  /**
341
328
  * Resolves a workspace file path to its actual file system path
342
329
  * @param filePath A file path that may include a workspace prefix (e.g., "workspace1/path/to/file.js")
@@ -380,33 +367,23 @@ export declare class CodeGenSession {
380
367
  * @param gitRef - The git reference (branch, commit, tag) - defaults to parent branch
381
368
  * @returns The file content at that reference, or null if not found
382
369
  */
383
- getFileAtRef(filePath: string, gitRef?: string, repoPathOverride?: string): Promise<string | null>;
370
+ getFileAtRef(filePath: string, gitRef?: string): Promise<string | null>;
384
371
  /**
385
372
  * Gets the diff information for a single file including full content
386
- * @param args - Either an options object or a file path string (legacy)
387
- * @param opts.path - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx') or relative
388
- * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path)
373
+ * @param filePath - The file path to get diff for
389
374
  * @returns Object with oldContent (from parent branch) and newContent (current)
390
375
  */
391
- getSingleFileDiff(args: {
392
- path: string;
393
- folderName?: string;
394
- } | string): Promise<{
376
+ getSingleFileDiff(filePath: string): Promise<{
395
377
  oldContent: string | null;
396
378
  newContent: string | null;
397
379
  action: "create" | "update" | "delete";
398
380
  }>;
399
381
  /**
400
382
  * Discards changes for a specific file by creating a revert commit
401
- * @param args - Either an options object or a file path string (legacy)
402
- * @param opts.filePath - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx')
403
- * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path)
383
+ * @param filePath - The file path to discard changes for
404
384
  * @returns success status, commit hash for reverting, and optional error message
405
385
  */
406
- discardFileChanges(args: {
407
- filePath: string;
408
- folderName?: string;
409
- } | string): Promise<{
386
+ discardFileChanges(filePath: string): Promise<{
410
387
  success: boolean;
411
388
  commitHash?: string;
412
389
  error?: string;
@@ -414,12 +391,10 @@ export declare class CodeGenSession {
414
391
  /**
415
392
  * Reverts a discard commit using git revert
416
393
  * @param commitHash - The commit hash to revert
417
- * @param folderName - Optional folder name to target specific repo (more efficient)
418
394
  * @returns success status and optional error message
419
395
  */
420
396
  revertDiscard(options: {
421
397
  commitHash: string;
422
- folderName?: string;
423
398
  }): Promise<{
424
399
  success: boolean;
425
400
  error?: string;
@@ -481,13 +456,11 @@ export declare class CodeGenSession {
481
456
  * @param numberOfContextLines - Optional number of context lines to include in the diff
482
457
  * @param includeFilesOnly - If true, only return filePath and action properties
483
458
  * @param filePaths - Optional array of file paths to limit the diff to specific files
484
- * @param folderName - Optional folder name to specify which repo to get diff from
485
459
  */
486
- getDiffFromRemote({ numberOfContextLines, includeFilesOnly, filePaths, folderName, }: {
460
+ getDiffFromRemote({ numberOfContextLines, includeFilesOnly, filePaths, }: {
487
461
  numberOfContextLines?: number;
488
462
  includeFilesOnly?: boolean;
489
463
  filePaths?: Array<string>;
490
- folderName?: string;
491
464
  }): Promise<ApplyActionsResult[]>;
492
465
  /**
493
466
  * Get git diff based on the specified mode
@@ -495,14 +468,12 @@ export declare class CodeGenSession {
495
468
  * @param numberOfContextLines - Optional number of context lines to include in the diff (e.g., 999 for -U999)
496
469
  * @param includeFilesOnly - If true, only return filePath and action properties
497
470
  * @param filePaths - Optional array of file paths to limit the diff to specific files
498
- * @param folderName - Optional folder name to specify which repo to get diff from
499
471
  */
500
- getDiff({ mode, numberOfContextLines, includeFilesOnly, filePaths, folderName, }: {
472
+ getDiff({ mode, numberOfContextLines, includeFilesOnly, filePaths, }: {
501
473
  mode: "remote-parent-branch" | "remote-current-branch";
502
474
  numberOfContextLines?: number;
503
475
  includeFilesOnly?: boolean;
504
476
  filePaths?: Array<string>;
505
- folderName?: string;
506
477
  }): Promise<{
507
478
  state: "error" | "success";
508
479
  diff?: ApplyActionsResult[];
@@ -511,7 +482,6 @@ export declare class CodeGenSession {
511
482
  /**
512
483
  * Get the default branch name from remote repository
513
484
  * Falls back to checking common default branch names
514
- * @param repoPath - Optional repo path to check default branch for
515
485
  */
516
486
  private getDefaultBranch;
517
487
  /**
@@ -519,7 +489,6 @@ export declare class CodeGenSession {
519
489
  * @param numberOfContextLines - Optional number of context lines to include in the diff
520
490
  * @param includeFilesOnly - If true, only return filePath and action properties
521
491
  * @param filePaths - Optional array of file paths to limit the diff to specific files
522
- * @param folderName - Optional folder name to specify which repo to get diff from
523
492
  */
524
493
  private getDiffFromParentBranch;
525
494
  }
@@ -14,11 +14,12 @@ export interface SubAgent {
14
14
  includeMemories?: boolean;
15
15
  needDevServer?: boolean;
16
16
  needValidation?: boolean;
17
+ resetAfterRun?: boolean;
17
18
  }
18
19
  /**
19
20
  * Resolves model shortcut to full model name
20
- * @param modelOrShortcut - Model name or shortcut
21
- * @returns Resolved model name or undefined
21
+ * @param modelOrShortcut - Model name or shortcut (or "inherit" to use parent model)
22
+ * @returns Resolved model name or undefined (undefined means inherit from parent)
22
23
  */
23
24
  export declare function resolveModelShortcut(modelOrShortcut?: string): string | undefined;
24
25
  /**
@@ -1,7 +1,7 @@
1
1
  import type { DevToolsSys } from "../../core";
2
2
  import { type Credentials } from "../credentials";
3
3
  export { getCustomInstructions } from "./rules-discovery";
4
- import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, WorkspaceFolder, EnvironmentVariable, PushChangesArgs, GenerateCompletionStepDevServerState, FusionConfig, GenerateCompletionStepGit } from "$/ai-utils";
4
+ import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, EnvironmentVariable, PushChangesArgs, GenerateCompletionStepDevServerState, FusionConfig, GenerateCompletionStepGit, WorkspaceFolder } from "$/ai-utils";
5
5
  import type { SessionContext } from "../codegen";
6
6
  import type { DevServerOrchestrator } from "../launch/dev-server-orchestrator";
7
7
  export declare const DEFAULT_MAX_COMPLETIONS = 30;
@@ -80,7 +80,7 @@ export declare function moveArrayElement<T>(arr: T[], old_index: number, new_ind
80
80
  export declare function canCollapseWorkspace(workspace: WorkspaceConfiguration | undefined): boolean;
81
81
  export declare function computeRecommendedRootDir(workspace: WorkspaceConfiguration | undefined): string;
82
82
  export declare const getEnvironmentVariablesPrompt: (envs: EnvironmentVariable[]) => string;
83
- export declare function generateGitStatusReminder(gitStatus: GenerateCompletionStepGit, gitEnabledFolders: WorkspaceFolder[], context: {
83
+ export declare function generateGitStatusReminder(gitStatus: GenerateCompletionStepGit, gitEnabledFolder: WorkspaceFolder | undefined, context: {
84
84
  trigger: "session-start" | "sync-success" | "push-success" | "pull-success";
85
85
  syncedBranches?: string[];
86
86
  pushedToRemote?: boolean;
@@ -17,7 +17,7 @@ export declare const NUMBER_TYPES: string[];
17
17
  export declare const BOOLEAN_TYPES: string[];
18
18
  export declare const ARRAY_TYPES: string[];
19
19
  export declare const OBJECT_TYPES: string[];
20
- export declare function getPrimitiveType(t: string): "string" | "number" | "boolean" | "object" | "array";
20
+ export declare function getPrimitiveType(t: string): "string" | "boolean" | "object" | "number" | "array";
21
21
  export declare function removeQuotes(text: string): string;
22
22
  export declare const resolveType: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string[] | undefined;
23
23
  export declare const typeToString: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string;
@@ -19,7 +19,7 @@ export declare function clone<T>(obj: T): T;
19
19
  export declare function shouldSkipFolder(sys: DevToolsSys, skipFolders: Set<string>, fileName: string): boolean;
20
20
  export declare function getPackageManager(): string;
21
21
  export declare function isWindows(): boolean;
22
- export declare function builderNpxPackage(): "@builder.io/agent" | "\"@builder.io/dev-tools\"" | "builder.io";
22
+ export declare function builderNpxPackage(): "builder.io" | "@builder.io/agent" | "\"@builder.io/dev-tools\"";
23
23
  /**
24
24
  * Sanitizes a component name for use in filesystem paths by replacing invalid characters with underscores
25
25
  * @param name The component name to sanitize