Skip to content

fix(deps): declare typebox as a host-provided peer dependency - #472

Open
nelo-onyiah wants to merge 1 commit into
ExaDev:mainfrom
nelo-onyiah:fix/455-typebox-peer
Open

nelo-onyiah wants to merge 1 commit into
ExaDev:mainfrom
nelo-onyiah:fix/455-typebox-peer

Conversation

@nelo-onyiah

Copy link
Copy Markdown

Summary

Fixes #455.

src/bridges/pi/extension.ts imports typebox directly, and Pi supplies that package to extensions: the loader maps the typebox specifier to Pi's own copy (VIRTUAL_MODULES in @earendil-works/pi-coding-agent). Because package.json listed it in dependencies, pnpm/npm installed a second physical copy at node_modules/agent-comms/node_modules/typebox, which shadows that mapping and makes Pi print this on every start:

Host-provided extension packages must be declared in peerDependencies with a "*" range, not dependencies: typebox.
Installed copies can bypass the extension loader and create duplicate runtime modules.

Changes

  • typebox moved from dependencies to peerDependencies with a "*" range, so Pi's own copy satisfies it. Pi's package docs list typebox as host-provided and require exactly this.
  • typebox pinned at 1.3.6 in devDependencies so the repo's own typecheck/build still resolve it. devDependencies are not installed for consumers, so no physical copy ships.
  • pnpm-lock.yaml regenerated.
  • src/test/pi-manifest-packed.integration.test.ts extended: fails if a host-provided package (the Pi docs' list) reappears in dependencies, and requires typebox to be a "*" peer.

Verification

  • pnpm exec vitest run src/test/pi-manifest-packed.integration.test.ts — 4 passed; reverting the manifest to the old shape fails the new test.
  • pnpm lint, pnpm typecheck — pass.
  • Full pnpm test after pnpm run build — the only two failures were web-console tests that need dist (they pass once built, as CI's Test job does).
  • Packed the tarball and installed it the way Pi does (npm install ... --omit=dev --legacy-peer-deps): manifest shows peerDependencies.typebox: "*", dependencies.typebox absent, and no typebox directory anywhere under node_modules.

No runtime behaviour changes: the pi bridge only ever resolved typebox through Pi's module mapping.

Pi supplies `typebox` to extensions and maps the specifier to its own
copy. Listing it in `dependencies` installed a second physical copy at
node_modules/agent-comms/node_modules/typebox, which shadows that
mapping and makes Pi warn on every start that host-provided packages
must be declared in peerDependencies (ExaDev#455).

Move it to `peerDependencies` with a `"*"` range so Pi's own copy
satisfies it, and keep the pinned version in `devDependencies` so local
builds and typechecks still resolve it. The pi bridge source ships in
the tarball and imports `typebox` only through Pi's mapping, so no
runtime dependency is lost.

Extend the packed-manifest test to fail if a host-provided package
reappears in `dependencies`.

Fixes ExaDev#455

This branch has not been deployed

No deployments
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.

typebox declared as a dependency breaks the Pi extension module mapping (host warning on every start)

1 participant