Inline JavaScript resolves dynamic import() from / instead of the working directory
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4.6k
- Forks
- 251
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 34
Description
Inline execute / evaluate code cannot import a package installed in the VM's working directory.
Repro
const vm = await AgentOs.create({ permissions: { network: "allow" } });
await vm.javascript.npm.install(["zod"]); // installs to /workspace/node_modules
await vm.javascript.evaluate(`import("zod").then(() => "ok")`);
Actual
Cannot resolve module 'zod' (imported from '/[agentos-evaluation.js]'). The inline importer path is /[agentos-evaluation.js], /[agentos-inline.js], or /<entry>.js, so resolution starts at /. TypeScript static imports (rewritten to require) do resolve, so the two paths disagree.
Expected
Match node -e: inline code resolves bare specifiers from the working directory.
Workaround
Pass filePath: "/workspace/main.mjs", or run a file with executeFile.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the javascript.evaluate and execute inline-code entry points, then compare dynamic import resolution with static imports and executeFile. Reproduce the issue with a package installed in /workspace; done means bare imports resolve from the working directory like node -e, without requiring filePath.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100