ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
> Status: CURRENT (2026-08-24)
This is a decision guide for Agent Host service bootstrapping, not a running implementation diary.
accepted wart, or extension checklist changes.
inventories, review chronology, or details already obvious from the code.
agentHostBootstrap.ts, agentHostServices.ts, agentServiceFoundation.ts, agentServiceComposition.ts, agentHostContributions.ts, and their test graph.
Each Agent Host process has one primary process-local ServiceCollection and strict InstantiationService, owned by AgentHostRuntime. The closest VS Code analogy is the shared process bootstrap in src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts: concrete pre-DI foundations, local SyncDescriptor registrations, strict DI, root composition, then activation.
Scoped child instantiation services or service collections are allowed when an isolated lifetime or override scope genuinely needs them. They should inherit from the primary graph where possible, have an explicit owner, and must not create competing instances of primary runtime services.
The primary Agent Host graph does not use the global registerSingleton registry because tests and runtime-selected implementations need independent process-local roots. This does not prohibit using a child graph for a scoped subsystem.
These are the intended extension points for new work:
entry-activation placement categories;
outgoing-message behavior;
required independently of their direct consumers;
New services should follow these contracts. Do not add another exception merely because an existing exception looks convenient.
The items in Known warts are not target patterns. They remain because removing them requires a separate ownership or API refactoring. Each wart has an explicit exit condition; update this document when one is removed.
Bootstrap creates the pre-DI foundation, awaits telemetry, registers lazy descriptors, creates the strict instantiation service, composes AgentService, and finally activates contributions.
Tests use the same synchronous foundation, core registrations, and composition, but supply telemetry directly, apply typed overrides after registering core defaults, skip production host services, and use a mutable worktree seam whose default delegate is NullAgentHostWorktreeIsolation.
| If the object... | Put it in | Construction | |---|---|---| | must exist before DI, performs bootstrap I/O, or needs entry-point inputs | agentHostBootstrap.ts foundation | concrete instance registered during bootstrap | | is shared by production and AgentService tests | registerAgentHostCoreServices | local SyncDescriptor; tests must supply any required host-facing dependency override | | needs production environment, sandbox, SDK, plugin, or provider-host inputs | registerAgentHostHostServices | local descriptor or selected concrete null implementation | | needs a back-reference to AgentService | agentServiceComposition.ts | explicit callback seam | | observes or enriches chat turns, actions, hydration, or outgoing messages | chatContributions/ | implement IAgentHostChatContribution and register it in registerBuiltInChatContributions | | registers non-chat providers, handlers, listeners, or other disposable behavior after construction | agentHostContributions.ts | create and immediately register in its returned store | | starts transports, providers, recurring schedulers, or process listeners | entry point | activation after runtime creation |
IAgentHostProviderService is the core service that owns provider registration, routing, lifetime, and provider-wide diagnostics aggregation. A successful registerProvider call transfers disposal ownership to that service.
Place an object based on construction requirements and lifetime, not on which existing file first needs it.
decorated service parameter. A trailing non-service parameter is valid only when it has an optional/default value and the descriptor intentionally accepts that value; DI cannot supply a trailing static argument.
SyncDescriptor convention: static arguments precededecorated service dependencies.
supportsDelayedInstantiation. In Node it schedules constructionon a later macrotask, which makes startup failures and disposal timing nondeterministic. An eager descriptor is already lazy until first resolved.
registers behavior required independently of direct calls, resolve it at a named composition or activation site, explain why, and test the behavior.
AgentServiceCallbackAdapter.value;lazy resolution order is not fixed relative to adapter binding.
createInstance() for a class registered as a descriptor.imperative construction in the same commit.
The collection is created, populated, and dropped inside createAgentHostRuntime or createTestAgentService. It is never returned or handed to another component; InstantiationService keeps its reference private. That ownership boundary, rather than a runtime seal, makes post-bootstrap registration unavailable.
Dynamic feature registration belongs in a service-owned registry or the contribution phase, not in the service collection.
| Owner | Objects | |---|---| | foundation | concrete instances it constructs | | InstantiationService | descriptor-created services | | AgentService composition | callback-bound objects and AgentService | | contribution store | activation objects and registration disposables | | IAgentHostChatContributions | registered chat contribution instances and their scoped mementos | | entry point | transports, process listeners, providers, schedulers |
Never add a descriptor-created service to another DisposableStore. AgentHostRuntime tears phases down explicitly: contributions, composition, instantiation service, then foundation. Entry-point resources and logging are disposed outside the runtime.
A descriptor that is never resolved is never constructed and therefore never disposed. InstantiationService disposes only instances it creates.
createTestAgentService builds the shared foundation and core graph with typed overrides applied explicitly after the core defaults. Its returned AgentService disposes the whole test graph.
The test graph does not force construction of unused descriptors. Whole-graph dependency completeness and cycle freedom are checked statically in agentHostServices.test.ts.
The compatibility graph intentionally defaults to:
implementation;
NullAgentEditAttributionService, keeping telemetry attribution out of thedefault test graph;
Production and targeted graph tests still resolve the real implementations.
AgentServiceCallbackAdapterWhy it exists: callback-dependent services are constructed before AgentService, while session restore, server-tool operations, and changeset eviction are still owned by AgentService.
Cross-cutting turn behavior now belongs in IAgentHostChatContributions; do not add callbacks for behavior expressible through its lifecycle hooks.
Do not extend it by default: a new callback usually means another responsibility should move to a narrower owning service.
Exit condition: extract session operations/restoration, server-tool ownership, turn dispatch, and changeset eviction so consumers inject those owners directly. Contributions reduce the cross-cutting behavior that those services must own, but the remaining callback queries and commands need service owners rather than contribution hooks. Then delete the adapter and binder contract.
IAgentHostSessionTitleController, IAgentHostLocalCommands, and IAgentService are currently registered after the primary InstantiationService is created because they depend on composition-owned callbacks or objects.
Do not add another post-DI registration. Ordinary services belong in the descriptor lists or the pre-DI foundation.
Exit condition: the server-tool, session, and turn-dispatch extractions remove the callback cycles. Register the remaining services before constructing InstantiationService, with IAgentService as a descriptor.
AgentSideEffects registers its narrow sendTurnMessage/launch-kind host bridge after the chat contribution service is constructed.
Do not broaden this bridge for behavior that fits a contribution hook.
Exit condition: once turn admission and dispatch have injectable owners, inject those services into contributions directly and remove registerHost/getHost.
State manager, configuration, authentication, GitHub endpoint, proxy, and request services are concrete foundations.
Why they exist: some must precede telemetry; others have constructor shapes that are not descriptor-safe because non-service arguments follow decorated service arguments.
Exit condition: a service may move to agentHostServices.ts when its constructor has leading static arguments only and no pre-telemetry ordering requirement. Moving one is optional cleanup, not a prerequisite for adding unrelated services.
AgentService.setX(...) to fix ordinary ordering.AgentService or AgentSideEffects when an existing contribution hook fits.
registerSingleton for node Agent Host services. SyncDescriptor static-argument conventions.
resolution site and a behavior test.
mementos for per-chat or per-session state.