Skip to content

Duplicate @earendil-works/pi-ai install splits the API provider registry (pi-coding-agent ships npm-shrinkwrap.json with no integrity) #5653

@yoyofield

Description

@yoyofield

What happened?

Installing both @earendil-works/pi-ai and @earendil-works/pi-coding-agent as direct deps puts two identical copies of pi-ai on disk — one hoisted, one nested under pi-coding-agent. Since the API provider registry is a module-level Map, the two copies are separate module instances with separate registries. A provider I register through the hoisted copy is invisible to the agent loop, which imports pi-ai through the nested copy. Stream dispatch then fails with:

No API provider registered for api: <my-api>

and the agent session ends in ~120ms with empty output.

Cause: the published pi-coding-agent tarball ships an npm-shrinkwrap.json whose nested pi-ai entry has no integrity field, so npm won't dedupe it against the hoisted copy even though the bytes are identical.

Steps to reproduce

package.json with both as direct deps, then:

npm install
find node_modules -type d -name pi-ai -path "*@earendil-works*"
#  node_modules/@earendil-works/pi-ai
#  node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-ai
diff -rq node_modules/@earendil-works/pi-ai \
         node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-ai
# no output — the two copies are byte-identical

npm 10.9.8, node 22.22.3.

Expected behavior

One deduped pi-ai, so registerApiProvider and the agent loop share one registry. Fix options: don't ship a published npm-shrinkwrap.json from a library, or give its entries integrity hashes so npm can dedupe. Happy to PR if useful.

Version

0.79.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions