[js_repl] paths for node module resolution can be specified for js_repl (#11944)

# External (non-OpenAI) Pull Request Requirements

In `js_repl` mode, module resolution currently starts from
`js_repl_kernel.js`, which is written to a per-kernel temp dir. This
effectively means that bare imports will not resolve.

This PR adds a new config option, `js_repl_node_module_dirs`, which is a
list of dirs that are used (in order) to resolve a bare import. If none
of those work, the current working directory of the thread is used.

For example:
```toml
js_repl_node_module_dirs = [
    "/path/to/node_modules/",
    "/other/path/to/node_modules/",
]
```
This commit is contained in:
aaronl-openai
2026-02-17 23:29:49 -08:00
committed by GitHub
parent 57f4e37539
commit f600453699
8 changed files with 461 additions and 45 deletions

View File

@@ -331,6 +331,13 @@
"include_apply_patch_tool": {
"type": "boolean"
},
"js_repl_node_module_dirs": {
"description": "Ordered list of directories to search for Node modules in `js_repl`.",
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
},
"js_repl_node_path": {
"$ref": "#/definitions/AbsolutePathBuf"
},
@@ -1518,6 +1525,13 @@
"description": "System instructions.",
"type": "string"
},
"js_repl_node_module_dirs": {
"description": "Ordered list of directories to search for Node modules in `js_repl`.",
"items": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": "array"
},
"js_repl_node_path": {
"allOf": [
{