types: export every public declaration from the package entry point - #378
Merged
Conversation
`types/index.ts` was a hand-maintained allowlist and had silently fallen 60
declarations behind the sources. It is copied verbatim into the published
TypeScript client and is its root export, so those declarations were
unreachable for consumers of `@microsoft/agent-host-protocol` -- not merely
undocumented. Verified against `origin/main`: importing `Customization`,
`McpServerState`, `Icon`, `SessionMetadata` or `CustomizationType` from the
entry point fails with `TS2305: has no exported member`.
The gaps were not obscure corners:
- the entire customization subsystem -- `Customization`, `CustomizationType`,
`ChildCustomization`, and every variant (`PluginCustomization`,
`DirectoryCustomization`, `AgentCustomization`, `SkillCustomization`,
`PromptCustomization`, `RuleCustomization`, `HookCustomization`,
`McpServerCustomization`), plus `CustomizationLoadState` and its variants
- the entire MCP-server state machine -- `McpServerState`, `McpServerStatus`,
`McpAuthRequiredReason`, and the five state variants
- 13 action types, including all four working-directory actions, all four
customization actions and all three MCP-server actions
- `Icon`, `ChatInteractivity`, `InputRequestResponsePart`,
`ToolCallContributor`, `SessionMetadata`, `JsonPrimitive`, `Implementation`
Replace the allowlist with `export *` from the per-channel shims, so the entry
point is complete by construction rather than by maintenance. The reducer block
stays explicit because the `reducers.ts` shim also re-exports
`softAssertNever`, an internal helper that should not be public.
`ChatAction` is declared twice with identical member sets -- once by hand in
`channels-chat/actions.ts`, once in `action-origin.generated.ts` -- so it is
named explicitly to resolve the `export *` ambiguity, preserving the generated
declaration the previous list exported. The duplicate declaration itself is
left alone; collapsing it is a source change unrelated to this packaging fix.
Add `scripts/public-api.test.ts`, which walks the canonical channel modules and
asserts every declaration is reachable from the entry point, with a small
justified withhold-list. It also asserts the reverse -- that nothing on the
withhold-list has become reachable -- so the list cannot go stale. Verified it
fails when a re-export is removed.
Also refresh four stale `workingDirectory` (singular) references in the
specification left over from the 0.7.0 rename to `workingDirectories`.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
July 31, 2026 23:31
roblourens
enabled auto-merge (squash)
July 31, 2026 23:31
dmitrivMS
approved these changes
Jul 31, 2026
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.
Problem
types/index.tsis a hand-maintained allowlist, and it had silently fallen 60 declarations behind the sources. That file is copied verbatim into the published TypeScript client and is its root export, so those declarations weren't merely undocumented — they were unreachable for anyone consuming@microsoft/agent-host-protocol.Verified against
main:The gaps weren't obscure corners:
Customization,CustomizationType,ChildCustomization, and every variant (PluginCustomization,DirectoryCustomization,AgentCustomization,SkillCustomization,PromptCustomization,RuleCustomization,HookCustomization,McpServerCustomization), plusCustomizationLoadStateand its four statesMcpServerState,McpServerStatus,McpAuthRequiredReason, and the five state variantsIcon,ChatInteractivity,InputRequestResponsePart,ToolCallContributor,SessionMetadata,JsonPrimitive,ImplementationFix
Replace the allowlist with
export *from the per-channel shims, so the entry point is complete by construction rather than by maintenance.Two deliberate exceptions:
reducers.tsshim also re-exportssoftAssertNever, an internal exhaustiveness helper that shouldn't be public.ChatActionis named explicitly. It's declared twice — by hand inchannels-chat/actions.tsand inaction-origin.generated.ts— with identical member sets, soexport *from both is ambiguous. Naming it preserves the generated declaration the previous list exported. The duplicate declaration itself is left alone; collapsing it is a source change unrelated to this packaging fix, and worth its own look.Guard
scripts/public-api.test.tswalks the canonical channel modules and asserts every declaration is reachable from the entry point, against a small justified withhold-list. It also asserts the reverse — that nothing on the withhold-list has become reachable — so the list can't quietly go stale.Verified it actually fails: removing a single
export *line makes it fail with the list of newly-unreachable declarations.Also included
Four stale
workingDirectory(singular) references indocs/specification/{chat,session}-channel.md, left over from the 0.7.0 rename toworkingDirectories. One of them still described the old "session-level default that chats override" model rather than the current "session-level set that chats restrict to a subset of".Compatibility
Purely additive — this only adds exports. No wire change, no change to any type, and no other client is affected (the Rust/Kotlin/Swift/Go generators read the channel modules directly and never consulted this barrel).
Verification
npm test— 381 pass (378 + 3 new), reducer branch coverage at 100%npm run generate— no driftmain(Written by Copilot)