Repository navigation
perf(acp): add SDK-free subpath exports for strategies, discovery and MCP config - #41
Merged
Merged
Conversation
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.
Why
PwrAgent's headless owner (the Outpost) reads the built-in strategy table, runs local discovery and normalizes MCP server configs at start. Those helpers were reachable only through the root bundle, which imports
@agentclientprotocol/sdkat top level. That costs about 27-31 ms of cold module loading on every owner start, before any ACP connection exists.What
Three subpath exports that never import the SDK:
@pwrdrvr/agent-acp/strategiesBUILT_IN_ACP_STRATEGIES,strategyById,strategyByBackendId,buildStrategyTable, the four strategies,buildAcpBackendId,defaultQuirks, strategy types@pwrdrvr/agent-acp/discovery@pwrdrvr/agent-acp/mcp-server-confignormalizeAcpMcpServerConfig(s)and the config types (SDK types only, erased at build)tsup builds them as separate entries; shared code lands in chunks, so a subpath loads none of the root bundle. The root entry is unchanged. Minor changeset.
Test
test/subpath-entries.test.tsis an oracle: it loads the built package by name in a fresh Node process with amodule.registerHooksresolve hook, and asserts that no resolved URL is in the SDK. The root entry is the control and must load the SDK. Mutatingsrc/entries/discovery.tsto re-export from../indexfails the discovery case.pnpm build && pnpm typecheck && pnpm test && pnpm lint:boundaries && pnpm lint:deps && pnpm lint:licensespass locally.