Build Orchestrator API - #64158
Open
Isabel Duan (iisaduan) wants to merge 1 commit into
Open
Conversation
Isabel Duan (iisaduan)
requested review from
Andrew Branch (andrewbranch)
and
a balanced review from Copilot
September 3, 2026 21:54
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Host routing, configuration refresh, watch lifecycle, and clean-result handling contain blocking correctness issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds the Build Orchestrator API for building and cleaning project graphs through sync and async clients.
Changes:
- Adds selective build, reference-build, clean, and reference-clean operations.
- Exposes orchestration through the API protocol and clients.
- Adds virtual filesystem deletion support and integration tests.
File summaries
| File | Description |
|---|---|
tsc/internal/project/session.go |
Exposes the default library path. |
tsc/internal/execute/build/orchestrator.go |
Implements reusable build and clean orchestration. |
tsc/internal/execute/build/clean_test.go |
Tests server-side cleaning behavior. |
tsc/internal/api/session.go |
Handles Build Orchestrator API requests. |
tsc/internal/api/proto.go |
Defines orchestration protocol types. |
tsc/internal/api/callbackfs.go |
Adds delegated file removal. |
packages/typescript/src/api/async/api.ts |
Adds the asynchronous client API. |
packages/typescript/src/api/sync/api.ts |
Adds the generated synchronous client API. |
packages/typescript/src/api/proto.generated.ts |
Adds generated protocol declarations. |
packages/typescript/src/api/fs.ts |
Exposes the removeFile callback. |
packages/typescript/test/async/api.test.ts |
Tests asynchronous orchestration. |
packages/typescript/test/sync/api.test.ts |
Tests synchronous orchestration. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 12
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+243
to
+245
| async createBuildOrchestrator(host: ClientSpawnOptions, rootNames: readonly string[], defaultOptions: ParsedCommandLine): Promise<BuildOrchestrator> { | ||
| await this.ensureInitialized(); | ||
| const orchestratorResponse = await this.client.apiRequest("createBuildOrchestrator", { hostOptions: host, rootNames, defaultOptions }); |
| s.buildMu.Lock() | ||
| defer s.buildMu.Unlock() | ||
| return &BuildResponse{ | ||
| ExitStatus: s.buildOrchestrators[params.BuildOrchestratorID].Build(ctx, string(params.Project)).Status, |
Comment on lines
289
to
291
| if o.opts.Command.CompilerOptions.Watch.IsTrue() { | ||
| o.Watch(ctx) | ||
| result.Watcher = o |
Comment on lines
+304
to
+306
| o.rangeTasks(order, func(path tspath.Path, task *BuildTask) { | ||
| task.resetStatus() | ||
| }) |
Comment on lines
+322
to
+324
| if !o.graphGenerated { | ||
| o.GenerateGraph(nil) | ||
| } |
Comment on lines
+337
to
+340
| if onlyReferences { | ||
| if project == "" { | ||
| return tsc.ExitStatusInvalidProject_OutputsSkipped | ||
| } |
Comment on lines
+349
to
+351
| if task.resolved == nil { | ||
| reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.File_0_not_found, task.config)) | ||
| continue |
Comment on lines
+432
to
+434
| if err := o.host.FS().Remove(outputFile); err != nil { | ||
| reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Failed_to_delete_file_0, outputFile)) | ||
| return false |
| private initialized: boolean = false; | ||
| private activeSnapshots: Set<Snapshot> = new Set(); | ||
| private latestSnapshot: Snapshot | undefined; | ||
| private buildOrchestrators: Map<number, BuildOrchestrator> = new Map(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3B of #63875
full description in progress
This PR implements what, in TS<6, was called the
SolutionBuilder. In TS7.1, it will now be called theBuildOrchestrator.Usage example:
notes:
SolutionBuilderHost, so no need to create and pass an extra hostSolutionBuilderandSolutionBuilderWithWatch, both modes can be used throughCreateBuildOrchestrator(), and you can activate watch by creating with watch options.