issue-285: declare host-provided typebox in peerDependencies #286
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!286
Loading…
Reference in a new issue
No description provided.
Delete branch "bug/issue-285/declare-host-provided-typebox-in-peerdependencies"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #285
Problem
Pi reported an extension-package warning on startup:
Per
docs/packages.md, host-provided packages (typeboxamong them) must be declared inpeerDependencieswith a"*"range, must not be bundled, and must not appear independencies. Pi supplies them to extensions through a virtual-module map (dist/bundle/chunks/virtual-modules-*.js→VIRTUAL_MODULES) and a jiti alias indist/core/extensions/loader.js, so a physical copy can bypass that mapping and load a second TypeBox instance — duplicate classes, registries and initialization work.Scope (wider than the single warning)
Straightening out the reported root manifest exposed four sub-manifests with the same violation, plus the lockfiles that record them:
package.jsontypebox"*":dependencies→peerDependenciesextensions/pr-comments/package.jsontypebox^1.3.6→ peer"*"(no other deps)extensions/forgejo/package.jsontypebox^1.3.6→ peer"*"(adm-zipstays a dependency)extensions/searxng/package.jsontypebox^1.3.19→ peer"*"(no other deps)extensions/victorialogs/package.jsontypebox^1.3.19→ peer"*"(no other deps)package-lock.json,extensions/pr-comments/package-lock.json,extensions/forgejo/package-lock.json"peer": trueon thetypeboxnodeextensions/searxng/bun.lock,extensions/victorialogs/bun.lock--lockfile-onlyoutput)README.mdtypeboxno longer described as a runtime dependency (:89, layout list:148–155)CHANGELOG.mdextensions/grillmealready used the correct pattern and is unchanged;README.md:148-155annotations for vision/penpot/searxng/victorialogs now read "typebox from the host".Per-file detail
package.json— the flagged manifest.dependencieskeeps the genuine runtime deps (adm-zip,dotenv,image-size,mongodb,pg,pgpass);peerDependenciesnow lists the three host-provided packages (@earendil-works/pi-coding-agent,@earendil-works/pi-tui,typebox). The two existing peers are untouched.extensions/pr-comments/package.json,extensions/searxng/package.json,extensions/victorialogs/package.json—typeboxwas the onlydependenciesentry, so the key is replaced bypeerDependencies(declaration order:peerDependenciesthendevDependencies). No other field changes;@earendil-works/pi-coding-agentstays adevDependency(it is a compile-time types import there, not a runtime one).extensions/forgejo/package.json—adm-zipstays independencies;typeboxmoves to a newpeerDependenciesblock.Lockfiles — deliberately minimal, not a whole-file rewrite. A plain
npm installunder npm 11 rewrites ~144 unrelated"peer": trueand"license"fields in the committedpackage-lock.json. That rewrite reproduces from the unmodified committed manifest, so it is tooling drift (the committed lock was produced by a different npm), not part of this change. The lock diffs therefore contain only the entries this change actually affects: the root package entry, and"peer": trueonnode_modules/typebox— verified byte-identical to npm 11's output for those nodes. The twobun.lockfiles carry bun's own canonical--lockfile-onlyresult (an 8-line move oftypeboxfromdependenciestopeerDependenciesin the workspace entry).README.md— theinstall:localdependency list now names the runtime deps and states the peers are declared, not bundled; the repository-layout annotations stop implying a private typebox copy is needed.Verification
HOST_PROVIDED_EXTENSION_PACKAGES ∩ dependencies) across every trackedpackage.json:okfor all 8 manifestsDefaultResourceLoader(~/.pi/agent/settings.jsonregistration) and readgetExtensions():warnings: 1—Host-provided extension packages must be declared in peerDependencies with a "*" range, not dependencies: typebox., at exactly the reported pathwarnings: 0 errors: 0, 15 extensions loadedrg1 tool,forgejo37,penpot21npm test— 976 tests, 975 pass / 0 fail / 1 skipped.typeboxstill resolves fromnode_modules(build/index.mjs, 1.3.13) andtypebox/valueresolves too:npm installauto-installs a root project's ownpeerDependencies. Confirmed independently byextensions/grillme, whose peer-only manifest already yields a physical 1.3.13.npm ci --dry-runclean at the root and inextensions/pr-comments+extensions/forgejo;bun install --frozen-lockfileexits 0 inextensions/searxngandextensions/victorialogsand leaves both locks untouched.~/.pi/agent/settings.jsonunchanged by the loader runs; no untracked files left behind.Notes / out of scope
docs/IMPLEMENTATION_PLAN.md:24describestypeboxas a "root dep" while recording issue-112. That line was accurate when written and is left as-is rather than rewritten as history.@earendil-works/pi-coding-agent@0.84.1,pi-tui@0.84.1). Pi only warns aboutdependencies, and the jiti alias wins at runtime, so this is left alone.originis an HTTPS URL with no credential helper; the branch was pushed over SSH (git@git.excelera.net:…). Local git config was not modified.