Surface the isolated/execution-context signal to guest (TypeScript/polyglot) AppHosts
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
A TypeScript (guest/polyglot) AppHost has no way to know it was launched in isolated mode. With `aspire run --isolated`, the .NET launcher consumes the flag (`DotNetAppHostProject` sets `DcpPublisher__RandomizePorts`), but the guest launcher (`GuestAppHostProject`) never surfaces `context.Isolated` to the JS/TS builder — the guest gets no signal at all.
As a result, a TypeScript AppHost can't branch its behavior on isolated vs. primary (dynamic vs. pinned ports, ephemeral vs. data volumes, container lifetime, etc.). Our current workaround is a heuristic unrelated to Aspire: we detect a linked git worktree by checking whether `.git` is a *file* vs a *directory*, with an `AI_STUDIO_EPHEMERAL=1/0` env override on top. It's brittle and only coincidentally correlates with isolation.
### Describe the solution you'd like
Surface the execution context to the polyglot/TypeScript `createBuilder` surface — at minimum `Isolated`, ideally `IsRunMode`/`IsPublishMode`/operation — so guest AppHosts can make the same decisions a C# AppHost makes via `DistributedApplicationExecutionContext`.
Lighter alternative if full context projection is heavy: have Aspire always set an env var in isolated mode (e.g. `ASPIRE_ISOLATED=1`) that guest AppHosts can read.
### Additional context
Aspire CLI 13.4.6, TypeScript AppHost (`apphost.mts`), macOS. Possibly related: #17456 (`ValueProviderContext.ExecutionContext`) and the polyglot projection work in #16110.
Contributor guide
Research direction
Start by tracing how DotNetAppHostProject consumes context.Isolated and how GuestAppHostProject invokes the TypeScript/polyglot createBuilder surface. Review the related execution-context issue #17456 and polyglot projection work #16110, then define how isolated and run/publish state should be exposed before validating the guest AppHost behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100