Repository navigation
refactor(agent): extract the embedded gateway and mcp composition out of agent.ts - #2034
Merged
Merged
Conversation
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (2)
🛟 Help
|
Tonours
marked this pull request as ready for review
October 23, 2026 12:17
PMerlet
approved these changes
Oct 23, 2026
PMerlet
left a comment
Member
There was a problem hiding this comment.
Approved after /validator run 2034-20261023145047-PMerlet: nothing blocking posted, 0 preferential or code style, 0 suppressed below all.
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.

Moves the embedded Gateway, MCP and API wiring out of
AgentintoEmbeddedServices. Pure move: no behavior, signature or startup-order change.fixes PRD-1543
What
packages/agent/src/embedded-services.ts(new, 350 lines)addGateway,mountAiMcpServer,addBff, plusprepareGateway,setRootHandlers,logGatewayRoutes,warnIfMcpExemptFromIpWhitelist,initializeMcpServerand the alias-mixing messages, copied verbatimpackages/agent/src/agent.ts(915 to 636 lines)Why
agent.tstook a commit on every Gateway ticket (17 in 90 days). Follow-up promised in the R1 review (PRD-1542).FrameworkMounterexposessetMcpCallback,setGatewayCallback,setBffCallback,getInProcessDispatcheras protected, soAgenthands the service late-bound arrows (handler => this.setMcpCallback(handler)), never a method captured with.bind:agent.test.tsspies onsetMcpCallbackon the instance after construction and must keep seeing the calls.start(),stop()andrestart()keep the exact same sequence; only the receiver of each call changes.How to test
yarn workspace @forestadmin/agent testgit diff --stat origin/main -- packages/agent/testnpx tsc --noEmit -p packages/agentnpx eslinton both files36294f5vs baselinee98f1bd(main), embedded agent on a real stack:gateway-alias-mixing(7 addGateway/alias mixes) andgateway-api-rename(cli, bff, gateway, boot mounts)git diff origin/main -- packages/agent/src/index.tsDefinition of Done
General
Security