Skip to content

perf(acp): add SDK-free subpath exports for strategies, discovery and MCP config - #41

Merged
Harold Hunt (huntharo) merged 2 commits into
mainfrom
perf/acp-sdk-free-subpaths
Nov 11, 2026
Merged

Harold Hunt (huntharo) merged 2 commits into
mainfrom
perf/acp-sdk-free-subpaths

Conversation

@huntharo

Copy link
Copy Markdown
Contributor

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/sdk at 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:

Subpath Exports
@pwrdrvr/agent-acp/strategies BUILT_IN_ACP_STRATEGIES, strategyById, strategyByBackendId, buildStrategyTable, the four strategies, buildAcpBackendId, defaultQuirks, strategy types
@pwrdrvr/agent-acp/discovery local discovery, the allowlist, the registry service and registry types
@pwrdrvr/agent-acp/mcp-server-config normalizeAcpMcpServerConfig(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.ts is an oracle: it loads the built package by name in a fresh Node process with a module.registerHooks resolve hook, and asserts that no resolved URL is in the SDK. The root entry is the control and must load the SDK. Mutating src/entries/discovery.ts to re-export from ../index fails the discovery case.

pnpm build && pnpm typecheck && pnpm test && pnpm lint:boundaries && pnpm lint:deps && pnpm lint:licenses pass locally.

@huntharo
Harold Hunt (huntharo) merged commit 2363ba2 into main Nov 11, 2026
2 checks passed
@huntharo
Harold Hunt (huntharo) deleted the perf/acp-sdk-free-subpaths branch November 11, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant