feat(types): export BrandJson / AdagentsJson from public surface#1740
Merged
Conversation
The `wellknown-schemas.generated.ts` module emits inferred types from the
canonical Zod schemas for brand.json and adagents.json, but those exports
were unreachable from any public entry point — adopters had to deep-import
a `dist/` path or hand-roll interfaces that drift from the spec (which is
exactly what bit adcp#4512: a pre-unify `BrandDefinition` snapshot missed
13+ fields added by the schema bump).
Re-export `BrandJson`, `AdagentsJson`, `BrandJsonSchema`, `AdagentsJsonSchema`
from `src/lib/types/index.ts` so consumers can derive their server-side
types directly from the schema:
import type { BrandJson } from '@adcp/sdk';
type BrandJsonHousePortfolio = Extract<BrandJson, { brands: unknown[] }>;
type BrandDefinition = BrandJsonHousePortfolio['brands'][number];
Closes #1739.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per dx-expert review of #1740: the BrandJson union is a common foot-gun (adopters assume `.brands` exists unconditionally — it's only one of three union arms). A short worked example in the curated TYPE-SUMMARY makes the discriminant key visible and shows the `Extract<BrandJson, ...>` recipe for narrowing to the portfolio shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docs/TYPE-SUMMARY.md is regenerated by scripts/generate-agent-docs.ts on every CI run; manually appended content gets wiped. Move the Well-Known Files section (added in b78b173 for #1740 / closes #1739) into the generator so it survives regeneration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
bokelley
added a commit
that referenced
this pull request
May 17, 2026
…#1798) The wellknown-schemas.generated.ts module emits BrandJson / AdagentsJson (inferred types) and BrandJsonSchema / AdagentsJsonSchema (runtime Zod validators) for the brand.json and adagents.json well-known formats, but at 7.1.0-7.2.0 those exports were unreachable from `@adcp/sdk` — only `@adcp/sdk/types` and `@adcp/sdk/testing` carried them. Consumers doing `import type { BrandJson } from '@adcp/sdk'` (e.g. adcontextprotocol/adcp server/src/types.ts:1, see adcp#4604) failed with `TS2305: Module '"@adcp/sdk"' has no exported member 'BrandJson'`. #1740 fixed this in src/lib/types/index.ts (the sub-barrel) and the main barrel picks it up transitively via `export * from './types'`. This change pins the contract explicitly at src/lib/index.ts so it is visible at the top-level public API surface and not dependent on the sub-barrel's wildcard re-export, plus adds a smoke test asserting both the runtime exports and the .d.ts type declarations resolve from dist/lib/index.{js,d.ts}. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
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.
Summary
BrandJson,AdagentsJson,BrandJsonSchema,AdagentsJsonSchemafromsrc/lib/types/index.tsso they flow through the@adcp/sdkroot entry.The
wellknown-schemas.generated.tsmodule already emits these inferred types from the canonical Zod schemas, but every public entry point omitted them. Consumers wanting a typed brand.json shape had to either deep-importdist/lib/types/wellknown-schemas.generated(fragile across SDK versions) or hand-roll an interface that drifts from the spec — exactly what bitadcontextprotocol/adcp#4512, where a pre-unifyBrandDefinitionsnapshot was missing 13+ fields added by the schema unify commit, causing/api/brands/resolveto return an emptybrand_manifest.With this PR, server code can derive its types directly from the spec:
Test plan
npm run buildsucceeds;dist/lib/types/index.d.tsnow containsexport type { BrandJson, AdagentsJson }and the two schema re-exports.npx tsc --noEmitclean.npm run format:checkclean.🤖 Generated with Claude Code