Skip to content

Importing typebox/schema fails #6512

Description

@RWOverdijk

What happened?

I am trying to make an extension to learn how pi works, and I keep running into this issue:

Failed to load extension: Cannot find module '/Users/spiderclam/.local/share/mise/installs/node/26.5.0/lib/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/index.mjs/schema'

I feel like pi is doing something with the path maybe? I tried adding a package.json in the extension dir as well, same result.

My goal with this is defining a config schema, that's all. The reason I suspect something in pi, is because the docs mention typebox as an import path. So maybe something is being replaced to make this work?

ETA: https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/extensions/loader.ts#L47 yeah, this is a bit funky. Maybe this should be changed? I understand the flexibility it offers, and I assume you have a way for me to disable that behavior, but it's unexpected.

Steps to reproduce

New project dir, and then make:

.pi/extensions/pi-my-first-extension/index.ts

with a package.json and typebox installed.

In which I do:

import Schema from "typebox/schema";

Running pi now gives me:

Cannot find module '/Users/spiderclam/.local/share/mise/installs/node/26.5.0/lib/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/index.mjs/schema'

Expected behavior

No error

Version

0.80.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-actionThis issue has been rejected after triage

    Type

    No type

    Fields

    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