@code-yeongyu/senpi-codemode 2026.10.9 → 2026.10.10-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +190 -0
- package/README.md +161 -11
- package/package.json +6 -5
- package/src/bridge/memory-protocol.ts +8 -1
- package/src/bridge/protocol.ts +9 -4
- package/src/bridge/reserved.ts +2 -0
- package/src/bridges/eval-environment-schemas.ts +52 -0
- package/src/bridges/eval-virtual-schemas.ts +11 -4
- package/src/bridges/reserved-dispatch.ts +13 -1
- package/src/config/executable-settings.json +5 -0
- package/src/config/project-trust.ts +51 -0
- package/src/config/settings-overrides.ts +2 -0
- package/src/environments/editable-check.ts +1 -1
- package/src/environments/js-environments.ts +208 -0
- package/src/environments/js-installer.ts +268 -0
- package/src/environments/js-revision-files.ts +91 -0
- package/src/environments/no-links.ts +132 -0
- package/src/environments/packages-install.ts +98 -0
- package/src/environments/project-resolves.ts +54 -0
- package/src/environments/py-environment.ts +7 -3
- package/src/environments/py-installer.ts +5 -1
- package/src/environments/python-environments.ts +1 -1
- package/src/environments/revision-store.ts +20 -4
- package/src/extension/bridge-tool-call.ts +5 -1
- package/src/extension/eval-notifier.ts +13 -2
- package/src/extension/kernel-registration.ts +7 -2
- package/src/extension/runtime-factory.ts +51 -13
- package/src/extension/runtime-info.ts +6 -2
- package/src/extension/session-cwd.ts +25 -9
- package/src/extension/session-manager-contract.ts +3 -0
- package/src/extension/session-manager.ts +20 -6
- package/src/index.ts +3 -2
- package/src/interpreters/detect.ts +34 -1
- package/src/kernels/AGENTS.md +2 -0
- package/src/kernels/jl/runner.jl +11 -22
- package/src/kernels/js/cell-dispatch.ts +44 -0
- package/src/kernels/js/cell-ownership.js +268 -0
- package/src/kernels/js/cell-run-context.js +89 -0
- package/src/kernels/js/context-manager.ts +46 -51
- package/src/kernels/js/control-frames.ts +24 -0
- package/src/kernels/js/group-signal-notice.js +117 -0
- package/src/kernels/js/host-entries.ts +62 -0
- package/src/kernels/js/inline-worker.ts +2 -0
- package/src/kernels/js/kernel-contract.ts +16 -1
- package/src/kernels/js/kernel-memory-bridge.ts +1 -1
- package/src/kernels/js/kernel-memory.ts +79 -0
- package/src/kernels/js/kernel-tools-registry.js +1 -0
- package/src/kernels/js/local-module-loader.ts +25 -6
- package/src/kernels/js/process-drain-scan.d.ts +8 -0
- package/src/kernels/js/process-drain-scan.js +28 -0
- package/src/kernels/js/process-entry.js +466 -0
- package/src/kernels/js/process-memory-host.ts +83 -0
- package/src/kernels/js/process-tree-host.ts +4 -8
- package/src/kernels/js/process-tree.d.ts +11 -0
- package/src/kernels/js/process-tree.js +55 -10
- package/src/kernels/js/process-worker.ts +298 -0
- package/src/kernels/js/rejection-reports.js +61 -0
- package/src/kernels/js/run-queue.ts +7 -0
- package/src/kernels/js/windows-tree-kill-host.ts +117 -0
- package/src/kernels/js/windows-tree-kill.d.ts +19 -0
- package/src/kernels/js/windows-tree-kill.js +100 -0
- package/src/kernels/js/worker-core.js +53 -8
- package/src/kernels/js/worker-cwd.js +46 -12
- package/src/kernels/js/worker-host.ts +9 -2
- package/src/kernels/js/worker-indirect-eval.js +37 -13
- package/src/kernels/js/worker-package-resolve.js +153 -0
- package/src/kernels/js/worker-require.d.ts +19 -0
- package/src/kernels/js/worker-require.js +52 -0
- package/src/kernels/js/worker-runtime.js +66 -13
- package/src/kernels/js/worker-shadow-guard.js +2 -6
- package/src/kernels/js/worker-shell-capture.js +9 -0
- package/src/kernels/js/worker-slot.ts +8 -0
- package/src/kernels/js/worker-startup.ts +49 -1
- package/src/kernels/js/worker-webview.js +15 -1
- package/src/kernels/py/host-cell.ts +8 -31
- package/src/kernels/py/prelude.py +69 -27
- package/src/kernels/py/process.ts +4 -0
- package/src/kernels/py/transport.ts +4 -0
- package/src/kernels/rb/runner.rb +9 -19
- package/src/kernels/sandbox/sandbox-cell.ts +141 -0
- package/src/kernels/sandbox/vendor/pi-codemode/VENDORED.md +1 -0
- package/src/kernels/sandbox/vendor/pi-codemode/runtime/host.ts +2 -2
- package/src/kernels/sandbox/vendor/pi-codemode/runtime/prelude-source.ts +14 -1
- package/src/kernels/sandbox/vendor/pi-codemode/runtime/worker.ts +4 -1
- package/src/kernels/sandbox/vendor/pi-codemode/types.ts +2 -0
- package/src/kernels/shared/bun-ffi.ts +24 -0
- package/src/kernels/shared/host-cell.ts +57 -0
- package/src/kernels/shared/kernel-memory-host.ts +30 -7
- package/src/kernels/shared/process-cpu.ts +7 -3
- package/src/kernels/shared/process-group-cpu.ts +6 -3
- package/src/kernels/shared/subprocess-kernel.ts +29 -3
- package/src/kernels/shared/subprocess-memory-globals.ts +101 -0
- package/src/kernels/shared/subprocess-process.ts +24 -2
- package/src/kernels/shared/subprocess-queue.ts +1 -0
- package/src/prompt/eval-prompt.ts +8 -1
- package/src/tool/AGENTS.md +1 -0
- package/src/tool/cell-handler.ts +12 -11
- package/src/tool/cell-reserved-dispatch.ts +1 -0
- package/src/tool/cell-runtime.ts +4 -2
- package/src/tool/detached-cell-contract.ts +3 -0
- package/src/tool/detached-cell-manager.ts +4 -8
- package/src/tool/detached-cell-notification.ts +11 -63
- package/src/tool/detached-cell-snapshot.ts +17 -0
- package/src/tool/detached-eval-result.ts +13 -7
- package/src/tool/detached-notification-queue.ts +1 -2
- package/src/tool/eval-request.ts +23 -1
- package/src/tool/eval-tool-options.ts +3 -0
- package/src/tool/eval-tool.ts +19 -5
- package/src/tool/interrupt-note.ts +4 -5
- package/src/tool/live-headline.ts +60 -0
- package/src/tool/load-cell.ts +18 -3
- package/src/tool/magic-cell-host.ts +60 -2
- package/src/tool/magic-cells.ts +12 -2
- package/src/tool/managed-cell.ts +0 -4
- package/src/tool/render-agent.ts +110 -0
- package/src/tool/render-blocks.ts +252 -0
- package/src/tool/render-call.ts +130 -0
- package/src/tool/render-cell.ts +165 -0
- package/src/tool/render-detail.ts +152 -0
- package/src/tool/render-live.ts +288 -0
- package/src/tool/render-result.ts +202 -0
- package/src/tool/render-status.ts +166 -0
- package/src/tool/render-tail.ts +139 -0
- package/src/tool/render.ts +3 -1069
- package/src/tool/run-eval-cell.ts +53 -16
- package/src/tool/runtime-label.ts +2 -1
- package/src/tool/types.ts +34 -3
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,196 @@
|
|
|
12
12
|
|
|
13
13
|
### Removed
|
|
14
14
|
|
|
15
|
+
## [2026.10.10-11] - 2026-10-09
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Replaced the plan-authored type assertions the F2 audit listed, in this package's production code and tests, with real types: `EvalKernel` now declares the optional `describeKernelTools` / `invokeKernelTool` capabilities, the JS `WorkerLike` carries an optional `pid`, `bun:ffi` is read through one shared `isBunFfi` guard, the sandbox `credits` buffer is typed as `Int32Array<SharedArrayBuffer>`, the gate allowlist is validated by the existing typebox `allowlistSchema`, and test fakes use `satisfies`, typed factories and narrowing guards instead of casts. No behavior change, except that a malformed base allowlist is now refused by the same schema the head allowlist already required. ([#3005](https://github.com/code-yeongyu/senpi/issues/3005))
|
|
24
|
+
- The bench judges `crash-queue-100` on Ruby and Julia by an absolute head budget instead of the head/base ratio: all 100 queued cells must run exactly once after one kernel replacement, with the head's median wall time under 820 ms (Ruby) or 2,700 ms (Julia). Their base never recovered from the crash, so the ratio compared a failure path with the real work. ([#3025](https://github.com/code-yeongyu/senpi/issues/3025))
|
|
25
|
+
- A streaming, queued or running eval row now shows the cell's code in a fixed-height block that scrolls upward as lines arrive: the newest line always stays visible, older lines fold into an "N earlier code lines" row counted inside the block, and once output or status events arrive they share the block's rows instead of growing it, so the row never grows the transcript at any terminal width. The header stays one row, keeping the live spinner and render-clock elapsed time (a queued cell keeps its queued badge). Once a cell finishes, errs or is cancelled, the collapsed row is one line (icon, summary, status and duration), and expanding it shows the full code, output and status events. ([#2933](https://github.com/code-yeongyu/senpi/issues/2933))
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Python cells use a C-backed FIFO and one combined stdout/stderr routing scope, reducing per-cell bookkeeping while retaining interpreter ownership, parked-cell callbacks, invocation scope, cancellation, and stale-descriptor fencing ([#3034](https://github.com/code-yeongyu/senpi/issues/3034)).
|
|
30
|
+
|
|
31
|
+
- Ruby and Julia cells below the host-read memory notice threshold and ceiling no longer walk all globals or serialize an unused memory payload. Above either threshold, successful and raised cells both collect the same bounded globals diagnostic, including when hysteresis suppresses the notice text. Stopping while a finished cell waits for that optional diagnostic now settles its completed result without globals and keeps kernel state. Current-footprint accounting and ceiling enforcement still run on every cell ([#3028](https://github.com/code-yeongyu/senpi/issues/3028)).
|
|
32
|
+
|
|
33
|
+
- Warm eval cells now recheck the session working directory synchronously instead of awaiting a filesystem thread-pool round trip. Every cell still refuses a deleted or non-directory cwd with the same error, and other filesystem errors still surface; kernel startup retains its asynchronous pre/post checks ([#3033](https://github.com/code-yeongyu/senpi/issues/3033)).
|
|
34
|
+
|
|
35
|
+
- When a Python, Ruby, Julia or process-isolated JavaScript kernel dies while a frame is being sent to it, the failed write (EPIPE) is reported as that kernel's error instead of surfacing as an unhandled error. Before, that unhandled error could end the host, or make a test run where every test passed exit 1 ([#3016](https://github.com/code-yeongyu/senpi/issues/3016)).
|
|
36
|
+
|
|
37
|
+
- On macOS and Linux, when a JavaScript eval cell ends or is interrupted, a process its child started and left behind (re-parented to init after the child exited, as with `(sleep 30 &)`) is now stopped too: every process group the kernel gave a cell child is signalled at retirement. The agent's own group is never signalled, nor a group whose leader exited and whose pid was since reused, and children the cell started with `detached: true` are left running ([#3020](https://github.com/code-yeongyu/senpi/issues/3020)).
|
|
38
|
+
|
|
39
|
+
- On Windows, ending a kernel's process tree (cell timeout, reset, shutdown) no longer uses `taskkill /T`: the tree is computed from creation times and each process is ended by pid, so an older, unrelated process holding a recycled parent pid is never killed ([#2999](https://github.com/code-yeongyu/senpi/issues/2999)).
|
|
40
|
+
|
|
41
|
+
- `tool_schema("eval:environments")` now documents the `packages.install(manager, requirements, {timeout?})` cell helper that shipped in #2877: the signature (Python spells the option `timeout=`, default 600 s), the managers per language (`pip` for Python; `bun`/`npm` for JavaScript), the receipt fields, cancellation by `stop`, and the `environment_install_timeout` error code it raises. A two-way contract test now keeps every `environment_*`/`eval_isolate_*` code the source raises documented in its owning entry. ([#3003](https://github.com/code-yeongyu/senpi/issues/3003))
|
|
42
|
+
|
|
43
|
+
- On macOS and Linux, a process started from a JavaScript eval cell with `node:child_process` or `Bun.spawn` now gets its own process group. A cell that later stops that job by its group (`kill -TERM -- -$PGID`) therefore no longer stops the agent itself. Named imports of `node:child_process`, `node:fs` and `node:path` in a cell now get the session cwd handling too. `Bun.$`, `exec`/`execFile` and the synchronous spawners (`spawnSync`, `execSync`, `execFileSync`, `Bun.spawnSync`, which keep the terminal) still share the agent's group, so a command there that signals a process group (including `pkill -g` and `killall`) prints a notice naming the agent's group. The notice is a warning only and never blocks the cell ([#2995](https://github.com/code-yeongyu/senpi/issues/2995)).
|
|
44
|
+
|
|
45
|
+
### Removed
|
|
46
|
+
|
|
47
|
+
## [2026.10.10-10] - 2026-10-09
|
|
48
|
+
|
|
49
|
+
### Breaking Changes
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
### Removed
|
|
58
|
+
|
|
59
|
+
## [2026.10.10-9] - 2026-10-08
|
|
60
|
+
|
|
61
|
+
### Breaking Changes
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
### Removed
|
|
70
|
+
|
|
71
|
+
## [2026.10.10-8] - 2026-10-08
|
|
72
|
+
|
|
73
|
+
### Breaking Changes
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- `packages.install(manager, requirements, {timeout?})` in JavaScript and Python cells installs through the same session environment as `%pip install` / `%bun add` / `%npm add` and returns the install receipt; a stop cancels it and the timeout (600 seconds by default) fails it with `environment_install_timeout`.
|
|
78
|
+
|
|
79
|
+
- `tool_schema("eval:environments")` and `tool_schema("eval:isolation")` document the package magics (`%pip`, `%bun`/`%npm`, `%environment`, `%load`) and isolated cells on demand, with the error codes each one raises. Nothing is added to the eval prompt or its input schema.
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- The eval timing benchmark's spike retry no longer waits for a load at or above its own refusal ceiling: the settle target is capped at 70, so a run whose calm load was near 80 cannot start its retries straight into another spike and burn them all in seconds. On a host whose normal load is above 70, each retry now waits the full 15 minutes and then retries anyway; the attempt's own spike checks still decide what is kept. ([#2922](https://github.com/code-yeongyu/senpi/issues/2922))
|
|
86
|
+
|
|
87
|
+
- The eval timing benchmark no longer throws away a whole multi-block run when the host's 1-minute load goes over 80 partway through: only the block that saw the spike is discarded and re-run (up to 3 retries, each after the load has fallen back under 70). A runtime failure in the same block is never discarded with the spike. A block that spikes on every attempt is labelled, making the run inconclusive rather than refused, and the other blocks still report. Re-run blocks are listed in the JSON report's `retriedBlocks`. ([#2909](https://github.com/code-yeongyu/senpi/issues/2909))
|
|
88
|
+
|
|
89
|
+
### Removed
|
|
90
|
+
|
|
91
|
+
## [2026.10.10-6] - 2026-10-07
|
|
92
|
+
|
|
93
|
+
### Breaking Changes
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
### Changed
|
|
98
|
+
|
|
99
|
+
### Fixed
|
|
100
|
+
|
|
101
|
+
### Removed
|
|
102
|
+
|
|
103
|
+
## [2026.10.10-5] - 2026-10-07
|
|
104
|
+
|
|
105
|
+
### Breaking Changes
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
### Changed
|
|
110
|
+
|
|
111
|
+
- A running, queued or detached eval row now leads with the cell's summary (or its first code line), then the language, state and elapsed time, on one line; the code is shown on expand. A call still streaming its arguments shows that row instead of the raw `eval code="..."` fallback. Completed rows are unchanged ([#2802](https://github.com/code-yeongyu/senpi/issues/2802)).
|
|
112
|
+
|
|
113
|
+
- A JavaScript cell may declare a name the kernel or platform already defines (`log`, `fetch`, `print`, `URL`, ...): the value persists for your later cells while the kernel and imported libraries keep the original, `delete <name>` restores it, and the cell notes the shadowing ([#2793](https://github.com/code-yeongyu/senpi/issues/2793)).
|
|
114
|
+
|
|
115
|
+
### Fixed
|
|
116
|
+
|
|
117
|
+
- A live eval row whose cell has no summary skips a first code line that holds only escape or control characters and leads with the next line that has content, instead of showing only an ellipsis ([#2850](https://github.com/code-yeongyu/senpi/issues/2850)).
|
|
118
|
+
|
|
119
|
+
- The `require` in a JavaScript cell carries `require.resolve`, `require.resolve.paths` and `require.cache` like Node's own `require`, and the call and `resolve` share one lookup, so they always name the same copy: builtins natively (including Bun's, such as `bun:sqlite`), then the project, then the managed package environment ([#2832](https://github.com/code-yeongyu/senpi/issues/2832)).
|
|
120
|
+
|
|
121
|
+
- A live eval row whose cell has no summary sanitizes its first code line before measuring it, so escape and control characters in that line never reach the one-line row ([#2839](https://github.com/code-yeongyu/senpi/issues/2839)).
|
|
122
|
+
|
|
123
|
+
- A live eval row stays one line in every terminal: its headline is measured and cut in screen cells, so a summary with wide characters (Korean, Chinese, Japanese, emoji) no longer wraps a narrow terminal, and a `peek`/`stop` call still streaming in renders `eval peek` instead of `eval peek undefined` ([#2831](https://github.com/code-yeongyu/senpi/issues/2831)).
|
|
124
|
+
|
|
125
|
+
- Stopping or timing out a JavaScript cell that awaits something that never settles (a promise, a `fetch` whose server never answers, a polling loop on timers, `Bun.sleep` or `node:timers/promises`, a loop of short `Bun.spawn` children) now keeps the worker and every global instead of restarting it. Stop ends the cell and everything it started: its timers are cleared, pending sleeps and `fetch` requests reject, and the sockets, servers, WebSockets, WebViews, nested workers and child processes it opened are closed; the result arrives once its children are gone. A stopped cell's own `catch`/`finally` can no longer print, call tools, start processes, schedule timers or open connections. An unhandled promise rejection no longer crashes the JavaScript kernel: it is reported on the running or next cell, naming the cell it came from, with bursts folded into one line; an uncaught exception still restarts the worker. A cell stopped during a `Bun.$` command still restarts the worker, as before ([#2788](https://github.com/code-yeongyu/senpi/issues/2788)).
|
|
126
|
+
|
|
127
|
+
- JavaScript cells can call `require(...)` and `createRequire(...)`: builtins, relative CommonJS and JSON files, and packages from the project or the managed package environment resolve as they do for `import` ([#2792](https://github.com/code-yeongyu/senpi/issues/2792)).
|
|
128
|
+
|
|
129
|
+
- A detached eval cell's completion notification now carries the same output its result would have shown in the foreground (head, tail, elision marker and full-output notice) instead of a 512-byte tail, and images the cell displayed are delivered with the notification ([#2789](https://github.com/code-yeongyu/senpi/issues/2789)).
|
|
130
|
+
|
|
131
|
+
### Removed
|
|
132
|
+
|
|
133
|
+
## [2026.10.10-4] - 2026-10-06
|
|
134
|
+
|
|
135
|
+
### Breaking Changes
|
|
136
|
+
|
|
137
|
+
### Added
|
|
138
|
+
|
|
139
|
+
### Changed
|
|
140
|
+
|
|
141
|
+
### Fixed
|
|
142
|
+
|
|
143
|
+
- A detached eval cell that waits for its kernel to start now says so (`waiting for the js kernel to be ready`) instead of `queued behind in the js kernel` with an empty predecessor ([#2790](https://github.com/code-yeongyu/senpi/issues/2790)).
|
|
144
|
+
|
|
145
|
+
- A stopped (or failed) detached cell's result and notification show its buffered output instead of the live `1/1 cells running` frame, so a cancelled cell no longer reads as still running. The kernel-state note now says plainly whether the kernel was restarted: `The JavaScript worker was not restarted; variables from earlier cells are kept.` instead of `... remains running; its existing variables are preserved.`, or `The JavaScript worker was restarted; variables from earlier cells are lost.` instead of `... was unresponsive to interrupt and was restarted ...` (the worker may have answered the interrupt and still needed a restart) ([#2791](https://github.com/code-yeongyu/senpi/issues/2791)).
|
|
146
|
+
|
|
147
|
+
- An isolated (`isolate: true`) eval cell's result names QuickJS as its runtime (`quickjs <version>, sandbox`) instead of the persistent kernel's Bun or Node runtime ([#2811](https://github.com/code-yeongyu/senpi/issues/2811)).
|
|
148
|
+
|
|
149
|
+
### Removed
|
|
150
|
+
|
|
151
|
+
## [2026.10.10-3] - 2026-10-06
|
|
152
|
+
|
|
153
|
+
### Breaking Changes
|
|
154
|
+
|
|
155
|
+
### Added
|
|
156
|
+
|
|
157
|
+
- An opt-in process-isolated JavaScript kernel (`isolation.js: "process"` or `SENPI_CODEMODE_JS_ISOLATION=process`) runs each JavaScript kernel in its own subprocess instead of a worker thread, so a kernel crash (`SIGSEGV`, out-of-memory, `process.exit`, an uncaught error) can no longer take down the host session; the next cell runs on a replacement child with a restart notice naming the crash. It isolates crashes, not hostile code: a cell is trusted as in worker mode, and hostile code belongs in `isolate: true` sandbox cells ([#2752](https://github.com/code-yeongyu/senpi/issues/2752) tracks hostile-cell isolation). The child runs on the host's own runtime, exits as soon as its host is gone (including `SIGKILL`), carries large output and `BigInt`/`undefined` values as worker mode does, and its frames carry a per-process token so stray output is never taken for a frame. The default stays `"worker"` and worker-mode behaviour is unchanged ([#2452](https://github.com/code-yeongyu/senpi/issues/2452)).
|
|
158
|
+
|
|
159
|
+
### Changed
|
|
160
|
+
|
|
161
|
+
- The README now documents every eval surface (helpers, magic cells, settings, JavaScript isolation modes and sandbox cells), and CI checks it against the helper census, so a new helper cannot ship undocumented ([#2787](https://github.com/code-yeongyu/senpi/pull/2787)).
|
|
162
|
+
|
|
163
|
+
### Fixed
|
|
164
|
+
|
|
165
|
+
### Removed
|
|
166
|
+
|
|
167
|
+
## [2026.10.10-2] - 2026-10-05
|
|
168
|
+
|
|
169
|
+
### Breaking Changes
|
|
170
|
+
|
|
171
|
+
### Added
|
|
172
|
+
|
|
173
|
+
- `@code-yeongyu/senpi-codemode/executable-settings.json` lists the settings that name an executable run at session start (today `languages.pyInterpreter`). senpi's project-trust check reads it, so a project codemode file that sets one asks for trust, and a test fails if a new free-form string setting is neither on the list nor marked as not naming an executable ([#2772](https://github.com/code-yeongyu/senpi/pull/2772)).
|
|
174
|
+
|
|
175
|
+
### Changed
|
|
176
|
+
|
|
177
|
+
### Fixed
|
|
178
|
+
|
|
179
|
+
- Settings that were accepted but did nothing now take effect ([#2763](https://github.com/code-yeongyu/senpi/issues/2763)): `kernelTools.enabled: false` makes JavaScript `tool(fn)` and Python `@tool` refuse with `tools_unavailable`; `languages.pyInterpreter` makes the Python kernel run exactly that executable (a path that does not answer makes Python unavailable, with a warning naming the setting; one named by a project's own settings file is honored only in a trusted project); `prompt.advertiseHelpers: true` adds one line pointing at `tool_schema('eval:helpers')` to the eval description. Settings-file warnings (an unknown key, a fallback to defaults) now reach the user as a notice, or on stderr without a UI.
|
|
180
|
+
|
|
181
|
+
### Removed
|
|
182
|
+
|
|
183
|
+
## [2026.10.10] - 2026-10-05
|
|
184
|
+
|
|
185
|
+
### Breaking Changes
|
|
186
|
+
|
|
187
|
+
### Added
|
|
188
|
+
|
|
189
|
+
- Isolated eval cells: with `sandbox.enabled`, `isolate: true` runs a JavaScript cell in a fresh QuickJS VM with no persistence and no ambient host (only `tools.*`, `print`, `display`), streaming output under a credit window. Off by default; the eval schema is unchanged until the setting is on.
|
|
190
|
+
- A JavaScript cell that is only `%bun add <package ...>` or `%npm add <package ...>` installs packages into a per-session managed environment without restarting the kernel; the next cell imports them by bare name, the project's `package.json` and `node_modules` are untouched, lifecycle scripts never run, and a failed or cancelled install leaves the previous packages active ([#2452](https://github.com/code-yeongyu/senpi/issues/2452)).
|
|
191
|
+
|
|
192
|
+
### Changed
|
|
193
|
+
|
|
194
|
+
### Fixed
|
|
195
|
+
|
|
196
|
+
- An isolated (`isolate: true`) cell whose QuickJS runtime is missing now fails with `eval_isolate_unavailable` before any of its code runs, instead of a module-resolution error that named a host path ([#2452](https://github.com/code-yeongyu/senpi/issues/2452)).
|
|
197
|
+
|
|
198
|
+
- `%bun add` over a package first installed from a local directory now works when the new archive's top directory is not `package/` (a GitHub-style `<repo>-<sha>.tgz`, or a plain `.tar`): its name is read from the archive's own top-level directory, so the old directory's links are removed before bun installs ([#2452](https://github.com/code-yeongyu/senpi/issues/2452)).
|
|
199
|
+
|
|
200
|
+
- A nested tool call that is denied inside an `eval` cell (a permission denial or another hook's block) now reaches the cell as the plain denial, without the `Expected parameters:` schema hint that made it read like an argument error; argument failures still get the hint ([#2700](https://github.com/code-yeongyu/senpi/issues/2700)). Thanks to @MoerAI ([#2755](https://github.com/code-yeongyu/senpi/pull/2755)).
|
|
201
|
+
- An `eval` run with an invalid `language` value (for example `"python"`, `""` or `null`) now gets its own error listing the enabled languages, instead of the "run requires language" message meant for an omitted one; `peek` and `stop` still need no language ([#1395](https://github.com/code-yeongyu/senpi/issues/1395)). Thanks to @MoerAI.
|
|
202
|
+
|
|
203
|
+
### Removed
|
|
204
|
+
|
|
15
205
|
## [2026.10.9] - 2026-10-04
|
|
16
206
|
|
|
17
207
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -59,6 +59,75 @@ task-tool names are known.
|
|
|
59
59
|
A missing optional interpreter removes that language from the session's `eval`
|
|
60
60
|
schema; it is not an installation failure.
|
|
61
61
|
|
|
62
|
+
### JavaScript process isolation
|
|
63
|
+
|
|
64
|
+
By default the JavaScript kernel runs as a worker thread on the host's own
|
|
65
|
+
runtime (`isolation.js: "worker"`). Setting `isolation.js: "process"` (or
|
|
66
|
+
`SENPI_CODEMODE_JS_ISOLATION=process`, which wins over the file) runs each
|
|
67
|
+
JavaScript kernel in its own subprocess instead, so a kernel crash (a native
|
|
68
|
+
`SIGSEGV`, an out-of-memory, `process.exit`, an uncaught error) cannot take down
|
|
69
|
+
the host session. The next cell runs on a replacement child, and its result
|
|
70
|
+
carries the restart notice and names the crash.
|
|
71
|
+
|
|
72
|
+
**Trust model.** Process mode isolates crashes, not hostile code. A cell runs in
|
|
73
|
+
the same process that talks to the host, so it can reach everything that process
|
|
74
|
+
holds, exactly as a worker-mode cell can. The frame token described below guards
|
|
75
|
+
only against accidental corruption of the channel. Hostile code belongs in
|
|
76
|
+
`isolate: true` sandbox cells. Hostile-cell isolation for process mode is tracked
|
|
77
|
+
in [#2752](https://github.com/code-yeongyu/senpi/issues/2752).
|
|
78
|
+
|
|
79
|
+
**Core dumps (Linux).** The kernel child marks itself non-dumpable at start
|
|
80
|
+
(`prctl(PR_SET_DUMPABLE, 0)`). A Linux system that pipes core dumps to
|
|
81
|
+
`systemd-coredump` or apport otherwise holds a crashed child until its dump is
|
|
82
|
+
read, which froze the cell for about 30 s; without the dump the crash is reported
|
|
83
|
+
at once, still naming its signal. Two side effects: no core file is written for a
|
|
84
|
+
crash of the kernel child itself, and a same-user debugger cannot attach to it
|
|
85
|
+
(`ptrace` needs a dumpable process). A cell's own subprocesses are unaffected,
|
|
86
|
+
because `exec` resets the flag. Set `SENPI_KERNEL_CORE_DUMPS=1` to keep dumps and
|
|
87
|
+
debugger access while debugging the kernel.
|
|
88
|
+
|
|
89
|
+
How it works:
|
|
90
|
+
|
|
91
|
+
- **Runtime.** The child runs on the host's own runtime: bun when senpi runs on
|
|
92
|
+
Bun, node otherwise. A compiled binary whose executable is neither falls back to
|
|
93
|
+
`bun` or `node` on `PATH`, preferring the host's kind. The badge names the
|
|
94
|
+
runtime that actually runs the child, for example `js (bun 1.4.x, process)`.
|
|
95
|
+
- **Frames.** The host writes a random token as the child's first line on fd 0,
|
|
96
|
+
and every frame the child sends carries it. The host parses only lines that
|
|
97
|
+
carry the token; any other line (a cell's raw fd write, a child process's
|
|
98
|
+
output) is delivered as text. Frames are written in full. Large text is split
|
|
99
|
+
below the 10 MiB frame limit, and a result too large to return fails its cell,
|
|
100
|
+
not the kernel. A `BigInt` or an `undefined` field reaches the host as it does
|
|
101
|
+
in worker mode.
|
|
102
|
+
- **File descriptors.** Under Bun, the control channel moves to a private
|
|
103
|
+
duplicate of fd 0, fd 0 becomes `/dev/null`, and fd 1 is re-pointed at a
|
|
104
|
+
pipe that a reader thread turns into `text` frames as it is written. The pipe is kept
|
|
105
|
+
blocking (a child that switches it to non-blocking is undone before every cell and around
|
|
106
|
+
every child process a cell starts),
|
|
107
|
+
so output is never held in memory while a cell is busy. A cell's direct
|
|
108
|
+
`process.stdout.write` or fd 1 write (or a child process inheriting fd 1)
|
|
109
|
+
arrives before that cell's result. In a bun child, raw fd 1 bytes are not
|
|
110
|
+
interleaved with `console` output in the order they were written. A node
|
|
111
|
+
child cannot move its fds: cell output shares the channel, and fd 0 is the
|
|
112
|
+
channel. If libc cannot be loaded through `bun:ffi`, a bun child runs
|
|
113
|
+
the same way and still starts; the first cell's stderr says why.
|
|
114
|
+
- **Lifetime.** The child exits as soon as its control channel closes. That
|
|
115
|
+
covers every way the host ends, including `SIGKILL`. A watchdog thread also
|
|
116
|
+
compares the parent pid with the one recorded at start, so a child whose cell
|
|
117
|
+
never yields (a busy loop, a blocking call) still ends with its host, including
|
|
118
|
+
under a Linux subreaper. A process-mode kernel never outlives its host.
|
|
119
|
+
- **Failed start.** There is no inline fallback in process mode. A failed start
|
|
120
|
+
settles the waiting cell with a capability-gap result naming the missing
|
|
121
|
+
runtime (`Install bun or node, or use isolation.js: "worker"`). The result's
|
|
122
|
+
memory reading is the child's process footprint.
|
|
123
|
+
|
|
124
|
+
The default stays `"worker"`, and worker-mode behaviour is unchanged.
|
|
125
|
+
|
|
126
|
+
To run the `environments` suites with bun children (the runtime the product
|
|
127
|
+
uses), run them under bun: `SENPI_CODEMODE_JS_ISOLATION=process bunx --bun vitest
|
|
128
|
+
run test/environments`. Under plain `vitest` the children follow the test
|
|
129
|
+
runner's runtime, which is node.
|
|
130
|
+
|
|
62
131
|
Python startup waits for the interpreter's `ready` event. It reports progress
|
|
63
132
|
through `stdlib-imports`, `runtime-init`, and `host-init`; advancing to the next
|
|
64
133
|
stage resets an inactivity guard rather than consuming a total startup budget.
|
|
@@ -67,6 +136,12 @@ Windows fresh-cache bootstrap p99 (30 samples). A stalled or failed start names
|
|
|
67
136
|
the last stage and retains the interpreter's diagnostic error. The low-level
|
|
68
137
|
`PythonKernel.start({ startupTimeoutMs })` override applies per stage.
|
|
69
138
|
|
|
139
|
+
Every `eval` run must explicitly select an enabled `language` (`js`, `py`, `rb`,
|
|
140
|
+
or `jl`); there is no default kernel, even when only one language is enabled.
|
|
141
|
+
Omitting `action` means `run`, so it also requires `language`. Control requests
|
|
142
|
+
with `action: "peek"` or `action: "stop"` use `cell_id` and do not require a
|
|
143
|
+
language.
|
|
144
|
+
|
|
70
145
|
### Session environment
|
|
71
146
|
|
|
72
147
|
Every kernel starts with the active session's `PI_*` environment — `PI_SESSION_ID`,
|
|
@@ -117,6 +192,35 @@ cannot be read fails the cell with a message naming the path as written
|
|
|
117
192
|
(`file not found: <path>`, `permission denied: <path>`); files over 8 MiB, and
|
|
118
193
|
anything that is not a regular file, are refused.
|
|
119
194
|
|
|
195
|
+
### JavaScript packages
|
|
196
|
+
|
|
197
|
+
A JavaScript cell whose only line is `%bun add <package ...>` or `%npm add <package ...>`
|
|
198
|
+
installs packages without restarting the kernel; the next cell imports them by bare name.
|
|
199
|
+
`%bun add` uses bun and `%npm add` uses npm; `environments.js.installer` (`bun`, `npm` or
|
|
200
|
+
`auto`: bun when it is on `PATH`, else npm) applies only where the magic names none, and the
|
|
201
|
+
kernel's own runtime never changes to get one.
|
|
202
|
+
|
|
203
|
+
In the default managed mode packages go into an environment revision under the session's
|
|
204
|
+
artifacts directory, never into the project's `package.json` or `node_modules`. With
|
|
205
|
+
`environments.managedRoot` set, every session using that root shares one revision chain: their
|
|
206
|
+
installs are serialized and each revision carries the packages installed before it.
|
|
207
|
+
A bare import resolves from the session directory's `node_modules` first and then from the
|
|
208
|
+
active revision, using each package's `exports` for `import` (ESM-only packages load), so the
|
|
209
|
+
project's own packages still win, and both win over Senpi's own dependencies (a package neither has may still load from Senpi's install). When a
|
|
210
|
+
newly added package is also in the project's `node_modules`, the result says
|
|
211
|
+
`environment_resolution_conflict` because the project copy resolves first.
|
|
212
|
+
|
|
213
|
+
Each install builds a new revision that carries the previous one forward (its `package.json`,
|
|
214
|
+
lockfile, and from `.npmrc` only `registry`, `@scope:registry`, `strict-ssl`, `ca` and `cafile`, rewritten as a regular file; credentials and every other key are dropped, and `bunfig.toml` is not carried)
|
|
215
|
+
and is published only when the installer succeeds; a failed or cancelled install, or one still
|
|
216
|
+
running when the session closes, leaves the previous revision active. Lifecycle scripts never run
|
|
217
|
+
(`--ignore-scripts`), installer flags are refused because the host picks the destination, and a
|
|
218
|
+
path-like package (`./pkg`, `file:../pkg`) is a path from the session directory. Package names
|
|
219
|
+
are split on whitespace; quoting is not supported. Error and installer text names the session directory as
|
|
220
|
+
`<cwd>`, the revision as `<root>`, the temp directory as `<tmp>`, the home directory as `~`, and an
|
|
221
|
+
absolute package path by its file name only. `%environment project` installs
|
|
222
|
+
into the session directory itself instead.
|
|
223
|
+
|
|
120
224
|
### Python packages
|
|
121
225
|
|
|
122
226
|
A Python cell whose only line is `%pip install <requirements>` installs packages
|
|
@@ -145,6 +249,19 @@ that project, with concurrent installs serialised by a lock. Setting
|
|
|
145
249
|
of `environment_install_failed`, `environment_install_cancelled`,
|
|
146
250
|
`environment_installer_unavailable` or `environment_resolution_conflict`.
|
|
147
251
|
|
|
252
|
+
### Isolated cells
|
|
253
|
+
|
|
254
|
+
With `sandbox.enabled: true`, a JavaScript call may pass `isolate: true`. The cell then runs in a fresh QuickJS VM (the vendored pi codemode runtime) instead of the persistent kernel:
|
|
255
|
+
|
|
256
|
+
- Nothing persists: globals from the kernel are not visible, and a global set in one isolated cell is gone in the next. `store()` throws `eval_isolate_no_state` and `load()` returns `undefined`.
|
|
257
|
+
- No ambient host: there is no `process`, `require`, file system, network, child processes or timers. The cell's only reach is `tools.<name>` (also `tool.<name>`; every active tool except `eval`, run through the same permission hooks as a direct call) plus `print`, `display`, `text` and `image`.
|
|
258
|
+
- `isolate: true` isolates the JavaScript, not the tools it calls: a tool keeps its normal reach. `tools.bash`, for example, runs a shell with the session's environment and files, under the same permission hooks as any other call.
|
|
259
|
+
- Output streams from the VM in frames under a 256 KiB credit window, so the VM never holds a large item; the host joins an item's frames before adding it to the result, and memory stays bounded by `sandbox.memoryMb`.
|
|
260
|
+
- It is a host entry in the JavaScript queue: it waits for earlier cells, Stop and the run budget end it, and the persistent kernel is never restarted for it.
|
|
261
|
+
- Limits: `sandbox.memoryMb` (default 64) and `sandbox.timeoutSeconds` (default 300). Failures are named: `eval_isolate_memory_limit`, `eval_isolate_timeout`, `eval_isolate_unresolved_promise` (a top-level promise that can never settle) and `eval_isolate_unavailable` (the runtime could not start).
|
|
262
|
+
|
|
263
|
+
While `sandbox.enabled` is `false` (the default) the `isolate` field is absent from the eval schema, and passing it is refused with `eval_isolate_invalid`, as are `isolate` with another language and `isolate` with `reset`.
|
|
264
|
+
|
|
148
265
|
## Settings
|
|
149
266
|
|
|
150
267
|
Configuration is loaded in this order:
|
|
@@ -206,7 +323,7 @@ Configuration is loaded in this order:
|
|
|
206
323
|
| `memory.retainedResultsMb` | `32` | In-memory byte budget (MiB) for the settled cells kept for `peek`/`list`, on top of the 32-cell count cap; the oldest go first and the newest is always kept. `0` keeps only the count cap. Env override: `SENPI_CODEMODE_RETAINED_RESULTS_MB` (a non-negative integer). |
|
|
207
324
|
| `memory.retainedImagesMb` | `256` | Disk budget (MiB) for settled-cell images. Images of settled cells (foreground and detached) are written as base64 files under `<session artifacts>/settled-images/` instead of staying in memory, and `peek` reads them back, so it returns the full result. Beyond the budget the oldest files are deleted first; an evicted cell's files are deleted with it; the directory is removed when the session ends. A `peek` whose image file is gone returns the text plus a one-line note. `0` keeps only the count cap. Env override: `SENPI_CODEMODE_RETAINED_IMAGES_MB` (a non-negative integer). |
|
|
208
325
|
| `memory.idleParkMinutes` | `0` | Off by default. When greater than 0, a kernel with no cell running or queued for this many minutes is closed to give its memory back, and the next cell for that language starts a fresh one; that cell's result says the kernel was restarted and every earlier global is lost. Applies to every language. |
|
|
209
|
-
| `languages.pyInterpreter` | unset | Explicit Python interpreter path. Unset keeps
|
|
326
|
+
| `languages.pyInterpreter` | unset | Explicit Python interpreter path: the Python kernel runs exactly that executable (a path with spaces is fine). A path that does not answer `--version` makes Python unavailable for the session, with a warning naming the setting. Unset keeps `PATH` detection. |
|
|
210
327
|
| `environments.managedRoot` | unset | Root directory for managed per-session environments; unset uses the session's default location. |
|
|
211
328
|
| `environments.autoProvision` | `true` | Lets installs provision a managed environment. `false` makes installs refuse with `environment_installer_unavailable`. |
|
|
212
329
|
| `environments.js.installer` | `auto` | Installer for the managed JavaScript environment: `auto`, `bun` or `npm`. |
|
|
@@ -216,16 +333,16 @@ Configuration is loaded in this order:
|
|
|
216
333
|
| `sandbox.memoryMb` | `64` | Memory cap (MiB) for a sandbox cell. Env override: `SENPI_CODEMODE_SANDBOX_MEMORY_MB` (a positive integer wins). |
|
|
217
334
|
| `sandbox.timeoutSeconds` | `300` | Time limit for a sandbox cell. |
|
|
218
335
|
| `prompt.advertiseHelpers` | `false` | When `true`, one pointer line to `tool_schema('eval:helpers')` is appended to the eval description. |
|
|
219
|
-
| `kernelTools.enabled` | `true` | Allows cells to define kernel tools
|
|
336
|
+
| `kernelTools.enabled` | `true` | Allows cells to define kernel tools. `false` makes JavaScript `tool(fn)` and Python `@tool` refuse with `tools_unavailable`, naming this setting. |
|
|
220
337
|
|
|
221
|
-
|
|
338
|
+
Every key in the table takes the effect its row describes.
|
|
222
339
|
|
|
223
340
|
`SENPI_CODEMODE_PY`, `SENPI_CODEMODE_JS`, `SENPI_CODEMODE_RB`, and
|
|
224
341
|
`SENPI_CODEMODE_JL` override the corresponding file setting. `1` or `true`
|
|
225
342
|
enables; `0` or `false` disables. Any other value leaves the file setting in
|
|
226
343
|
effect.
|
|
227
344
|
|
|
228
|
-
A top-level key this version does not know is ignored with one warning naming it, and the rest of the file still applies, so a settings file written for a newer senpi keeps working. Malformed JSON, or an invalid value or an unknown key inside a known setting, falls back to all defaults with a warning.
|
|
345
|
+
Settings problems reach the user as a notice in the interactive UI, or a `[senpi-codemode]` line on stderr without one. A top-level key this version does not know is ignored with one warning naming it, and the rest of the file still applies, so a settings file written for a newer senpi keeps working. Malformed JSON, or an invalid value or an unknown key inside a known setting, falls back to all defaults with a warning.
|
|
229
346
|
The detached-cell environment override uses the run-budget parser: a positive
|
|
230
347
|
base-10 integer wins over the file value; zero, negative, and malformed values
|
|
231
348
|
leave the file value in effect.
|
|
@@ -240,18 +357,22 @@ options object and asynchronous helpers are `await`-able.
|
|
|
240
357
|
| --- | --- |
|
|
241
358
|
| `display(value)` | Emits text, structured JSON, markdown, or image display data. Images reach the model only through `display`: pass a figure, raw image bytes (PNG/JPEG/GIF/WebP/BMP sniffed), a `data:` URL, a `Blob`-like or `Bun.Image` value, a marshalled tool result, or one of its `images[i]` frames. |
|
|
242
359
|
| `print(value, ...)` | Emits text output. |
|
|
360
|
+
| `text(value)` (rb, jl) | Emits `value` as one text item without separators (`print` joins its arguments and calls it). |
|
|
361
|
+
| `display_image(base64, mime_type)` (rb, jl) | Emits an image from base64 data; `mime_type` defaults to `image/png` (Ruby: `mime_type:` keyword). |
|
|
243
362
|
| `read(path, offset?, limit?)` | Reads text with 1-indexed line slicing. `local://` paths resolve under the session artifact root. |
|
|
244
363
|
| `write(path, content)` | Creates parent directories and writes text. `local://` paths persist in the session artifact root. |
|
|
245
364
|
| `env(key?, value?)` | Reads all kernel environment values, one value, or sets one value. Includes the session's `PI_*` values (see [Session environment](#session-environment)). |
|
|
246
365
|
| `tool.<name>(args)` | Invokes an active Senpi tool through the normal `pi.executeTool` pipeline and returns `{ text, images?, details?, hasError? }` in every kernel; image blocks arrive as `images[i] = { mimeType, dataBase64 }`. |
|
|
247
|
-
| `
|
|
366
|
+
| `packages.install(manager, requirements, {timeout?})` (js, py) | The `%pip install` (py, manager `"pip"`) or `%bun add` / `%npm add` (js, `"bun"` / `"npm"`) installer as a call: same session environment, receipt (`py`: manager, mode, root, revision, requested, resolved, changed; `js`: installer, mode, revision, added, shadowed), cancellation by `stop` and `environment_install_*` codes; `timeout` defaults to 600 seconds and fails with `environment_install_timeout`. Python: `packages.install("pip", [...], timeout=...)`. |
|
|
367
|
+
| `tool_schema(name?)` | Returns a tool's parameter schema without calling it; omit `name` to list tool names. Five virtual entries document codemode itself on demand and are never listed: `eval:wait`, `eval:helpers`, `eval:kernel-tools`, `eval:environments` (the `%pip`, `%bun`/`%npm`, `%environment` and `%load` magics, their results and error codes) and `eval:isolation` (`isolate: true` cells, their limits and error codes). |
|
|
368
|
+
| `require(specifier)`, `createRequire(path)` (js) | CommonJS loading inside a cell, resolved like `import`: builtins (with or without `node:`), relative files and JSON from the cell's directory, bare packages from the session's project and then its managed package environment (`%bun add`/`%npm add`). A missing module raises the runtime's own `MODULE_NOT_FOUND` error. Like Node's `require`, it carries `require.resolve` (the same lookup the call uses, so both name the same copy; builtins resolve to the runtime's own id), `require.resolve.paths` and `require.cache` (the runtime's CommonJS cache). |
|
|
248
369
|
| `tool(fn, metadata?)` (js) | Registers a named function as a kernel tool for in-process children. `metadata.name` registers it under that name instead of the function's; arguments are still passed in the function's parameter order. |
|
|
249
370
|
| `tool.defined()` / `tool.undefine(name)` (js) | List the kernel tools this kernel defines (sorted), and remove one (`true` if it existed). A descriptor taken before `undefine` can no longer be invoked. Both names are reserved: a kernel tool can't be registered as `defined` or `undefine` (`reserved_tool_name`), and a host tool with either name is shadowed in the `tool` namespace, so it can't be called from a JavaScript cell. |
|
|
250
371
|
| `@tool` / `@tool(name=, description=, schema=)` (py) | Registers a Python function as a kernel tool for in-process children; the schema is inferred from its type hints (`tool_schema("eval:kernel-tools")` lists the rules). Callbacks run while the kernel is idle or its cell is parked in a host call, never in the middle of a running computation. `tool.defined()` and `tool.undefine(name)` work as in JavaScript. Ruby and Julia kernels answer `tools_unavailable`. |
|
|
251
372
|
| `completion(prompt, model?, system?, schema?)` | Requests a one-shot host completion; `schema` asks the host to parse structured output. |
|
|
252
373
|
| `agent(prompt, ...)` | Delegates to the configured active `taskTools.task` tool. Supports background handles and structured JSON results. |
|
|
253
374
|
| `wait(handles, timeout?, mode?)` | Blocks the cell until the given handles settle (agent handle records, `handle()` views, completion handles, closed workpools, or saved `{kind, id, run_epoch}` references). `mode` is `all` (values in input order; the first failed, cancelled, or lost handle raises), `any` (`{index, ref, value}` of the first success), or `settled` (one outcome per input slot). `timeout` is wall-clock seconds from entry; on expiry `eval_wait_timeout` is raised and nothing is cancelled. Rides the bridge-call path, so the run budget pauses while parked. Agent and workpool handles need the host's `EvalHandleHost` capability (`eval_wait_unavailable` without it); completion handles always work. Julia extends `Base.wait` for handle views (`wait(handle(node))`). Details: `tool_schema("eval:wait")`. |
|
|
254
|
-
| `handle(node \| ref \| {pool_id})` | Returns a rich view: the legacy record's fields plus a non-enumerable `control` (Python: attribute on a `dict` subclass; Ruby: singleton method) with
|
|
375
|
+
| `handle(node \| ref \| {pool_id})` | Returns a rich view: the legacy record's fields plus a non-enumerable `control` (Python: attribute on a `dict` subclass; Ruby: singleton method) with `.status()`, `.output(format?, offset?, limit?)`, `.send(message)` (agent handles only), `.cancel()` (idempotent for that run epoch; never touches a successor run), and `.wait(timeout?)`. Every control call is fenced by owner, id, and `run_epoch` inside the task owner (`eval_handle_stale`, `eval_handle_forbidden`). `completion(prompt, handle: true)` returns such a view for a host completion. The `agent(..., handle: true)` record itself is unchanged. Details: `tool_schema("eval:helpers")`. |
|
|
255
376
|
| `workpool(agent, name, mode?, tools?)` | Creates a thin adapter over the normal host `workpool` tool; exposes `pool_id`, `push(items)`, `close()`, `inspect()`, and `cancel()`. JS awaits creation and operations. `tools` is a list of kernel-tool names this cell defined; the pool's workers may call exactly those, the host refuses any name the caller doesn't hold, and a value that isn't a list of names raises `invalid_tools`. Ruby and Julia define no kernel tools, so they have nothing to grant. |
|
|
256
377
|
| `output(ids, format?, offset?, limit?)` | Delegates transcript retrieval to the configured active `taskTools.output` tool. |
|
|
257
378
|
| `parallel(thunks)` | Runs thunks through the configured bounded pool while preserving input order. |
|
|
@@ -346,6 +467,10 @@ free; otherwise it settles `cancelled` with `eval_background_capacity_reached`,
|
|
|
346
467
|
listing the live cells and a stop-or-wait remedy. Cells that complete inside the
|
|
347
468
|
window return normally. Cancelling a queued cell never interrupts its predecessor.
|
|
348
469
|
Do not re-run a detached or queued cell; each detached cell completes as one notification.
|
|
470
|
+
The notification carries the same text the cell's result would have shown in the
|
|
471
|
+
foreground (the output sink's configured head, its tail, the middle-elision marker and
|
|
472
|
+
the full-output artifact notice), framed by the outcome line and the kernel-state note,
|
|
473
|
+
plus any images the cell displayed.
|
|
349
474
|
|
|
350
475
|
Queued steering also detaches an eligible interactive foreground call, including
|
|
351
476
|
one paused in a host tool bridge, without cancelling its computation. If the
|
|
@@ -386,11 +511,29 @@ Use `eval({ action: "peek", cell_id })` for its state and buffered output, or
|
|
|
386
511
|
`eval({ action: "stop", cell_id })` to cancel it. Stopping a queued cell removes it
|
|
387
512
|
without interrupting the active cell; kernel state is retained. Python running-cell stop interrupts the
|
|
388
513
|
existing kernel and preserves variables. JavaScript stop is cooperative first:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
514
|
+
Stop ends the cell and everything it started, not the kernel's variables. The
|
|
515
|
+
worker rejects the cell's pending bridge `tool.*` calls and releases the cell:
|
|
516
|
+
its timers are cleared (the globals and the `node:timers` module alike), its
|
|
517
|
+
pending `Bun.sleep`, `node:timers/promises` waits, `fetch` requests and file
|
|
518
|
+
reads reject with the interruption, and the sockets, servers, file streams,
|
|
519
|
+
`readline` interfaces, WebSockets, WebViews, nested workers and child processes
|
|
520
|
+
it opened are closed or terminated, whether made with a factory or a
|
|
521
|
+
constructor. A resource that will not close is reported on the cell output. The stop result arrives once those children are gone, and the
|
|
522
|
+
worker and every global from earlier cells survive. If the stopped cell's own
|
|
523
|
+
`catch`/`finally` still runs, it cannot print, call tools, start processes,
|
|
524
|
+
schedule timers or open connections. One boundary remains: code that resumes
|
|
525
|
+
because a later cell resolves a promise the stopped cell was awaiting runs
|
|
526
|
+
until it reaches an operation a stopped cell may no longer start (output, tool
|
|
527
|
+
calls, processes, timers, network, files, message channels, workers).
|
|
528
|
+
|
|
529
|
+
An unhandled promise rejection never crashes the JavaScript kernel; its
|
|
530
|
+
variables are kept, as in the Node REPL and Jupyter. The rejection is reported
|
|
531
|
+
on the cell that is running, or on the next cell, naming the cell that started
|
|
532
|
+
the work when it is known ("from cell <id>, after it was stopped"), with the
|
|
533
|
+
error message and the top of its stack. A burst becomes one report plus
|
|
534
|
+
"... and K more unhandled promise rejections". A fatal error (an uncaught
|
|
535
|
+
exception) still restarts the worker, and the result says variables are lost. Only a cell stopped during a `Bun.$` command costs
|
|
536
|
+
the worker VM. A worker blocked in a synchronous call (`Bun.spawnSync`,
|
|
394
537
|
`child_process.spawnSync`) cannot be stopped at all; after a 3 s termination
|
|
395
538
|
deadline a fresh worker replaces it, the cell output gains a stderr line naming
|
|
396
539
|
the blocked synchronous call, and the blocked call keeps running until it
|
|
@@ -443,6 +586,13 @@ original sizes, then a plain-path notice such as
|
|
|
443
586
|
package.
|
|
444
587
|
- Task transcript formats are limited to full (`raw`) and trailing (`tail`)
|
|
445
588
|
output. Query, JSON, and stripped metadata formats are task-engine concerns.
|
|
589
|
+
- There is no `pool.wait()`: a workpool's aggregate is delivered by the host after
|
|
590
|
+
`close()`, so a kernel never blocks on another engine's workers.
|
|
591
|
+
- There is no `code_mode_only` mode and no speculative cell execution; both are
|
|
592
|
+
deferred to a separate design (omo#9232) rather than approximated here.
|
|
593
|
+
- Kernels are never shared across owners: each session (and each in-process child
|
|
594
|
+
with its own eval tool) owns its kernels, and handles are fenced by owner, id and
|
|
595
|
+
run epoch.
|
|
446
596
|
|
|
447
597
|
## Security and lifecycle
|
|
448
598
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.10-11",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./src/index.ts",
|
|
10
|
-
"./package.json": "./package.json"
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./executable-settings.json": "./src/config/executable-settings.json"
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
13
14
|
"src",
|
|
@@ -32,15 +33,15 @@
|
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@babel/parser": "8.0.4",
|
|
35
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.10.
|
|
36
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.10.10-11",
|
|
36
37
|
"quickjs-wasi": "3.6.2",
|
|
37
38
|
"typebox": "1.3.34"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@code-yeongyu/senpi": "2026.10.
|
|
41
|
+
"@code-yeongyu/senpi": "2026.10.10-11"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@code-yeongyu/senpi": "2026.10.
|
|
44
|
+
"@code-yeongyu/senpi": "2026.10.10-11"
|
|
44
45
|
},
|
|
45
46
|
"keywords": [
|
|
46
47
|
"senpi",
|
|
@@ -24,7 +24,7 @@ export const kernelMemoryReportSchema = Type.Object({
|
|
|
24
24
|
approximate: Type.Optional(Type.Boolean()),
|
|
25
25
|
/** `liveBytes` was measured right after a full collection in this cell. */
|
|
26
26
|
gcRan: Type.Optional(Type.Boolean()),
|
|
27
|
-
/** Largest user globals, measured
|
|
27
|
+
/** Largest user globals, measured after collection or on demand when the host footprint reaches a threshold. */
|
|
28
28
|
globals: Type.Optional(Type.Array(kernelMemoryGlobalSchema, { maxItems: 8 })),
|
|
29
29
|
/** Host-set: live memory after collection reached the ceiling; the kernel restarts once its queue drains. */
|
|
30
30
|
overCeiling: Type.Optional(Type.Boolean()),
|
|
@@ -37,6 +37,8 @@ export const kernelMemoryReportSchema = Type.Object({
|
|
|
37
37
|
/** On-demand heap reading between cells (JS kernels): no cell runs and no collection is forced. */
|
|
38
38
|
export const kernelMemoryQueryHostToKernelSchemas = [
|
|
39
39
|
Type.Object({ type: Type.Literal("memory-query"), requestId: Type.String({ minLength: 1 }) }),
|
|
40
|
+
/** Ruby/Julia only: bounded, read-only globals sizing before the owning cell settles. */
|
|
41
|
+
Type.Object({ type: Type.Literal("memory-globals"), cellId: Type.String({ minLength: 1 }) }),
|
|
40
42
|
] as const;
|
|
41
43
|
|
|
42
44
|
export const kernelMemoryQueryKernelToHostSchemas = [
|
|
@@ -46,6 +48,11 @@ export const kernelMemoryQueryKernelToHostSchemas = [
|
|
|
46
48
|
liveBytes: Type.Integer({ minimum: 0 }),
|
|
47
49
|
measure: Type.Literal("heap"),
|
|
48
50
|
}),
|
|
51
|
+
Type.Object({
|
|
52
|
+
type: Type.Literal("memory-globals-result"),
|
|
53
|
+
cellId: Type.String({ minLength: 1 }),
|
|
54
|
+
globals: Type.Array(kernelMemoryGlobalSchema, { maxItems: 8 }),
|
|
55
|
+
}),
|
|
49
56
|
] as const;
|
|
50
57
|
|
|
51
58
|
export type KernelMemoryThresholds = Static<typeof kernelMemoryThresholdsSchema>;
|
package/src/bridge/protocol.ts
CHANGED
|
@@ -101,7 +101,7 @@ const hostToKernelMessageSchema = Type.Union([
|
|
|
101
101
|
const kernelStateSchema = Type.Union([Type.Literal("lost"), Type.Literal("restarted"), Type.Literal("not-run")]);
|
|
102
102
|
|
|
103
103
|
const kernelToHostMessageSchema = Type.Union([
|
|
104
|
-
Type.Object({ type: Type.Literal("ready") }),
|
|
104
|
+
Type.Object({ type: Type.Literal("ready"), memoryGlobals: Type.Optional(Type.Boolean()) }),
|
|
105
105
|
Type.Object({ type: Type.Literal("init-failed"), error: bridgeErrorSchema }),
|
|
106
106
|
Type.Object({
|
|
107
107
|
type: Type.Literal("text"),
|
|
@@ -237,10 +237,15 @@ export function parseBridgeJsonLine(line: string, options: BridgeFrameOptions =
|
|
|
237
237
|
export function decodeBridgeFrame(line: string, options: BridgeFrameOptions = {}): BridgeMessageDecodeResult {
|
|
238
238
|
const parsed = parseBridgeJsonLine(line, options);
|
|
239
239
|
if (!parsed.ok) return parsed;
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
return validateBridgeMessage(parsed.value);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Checks an already-parsed frame against the bridge schema (for transports that transform values before checking). */
|
|
244
|
+
export function validateBridgeMessage(value: unknown): BridgeMessageDecodeResult {
|
|
245
|
+
if (Value.Check(bridgeMessageSchema, value)) {
|
|
246
|
+
return { ok: true, message: value };
|
|
242
247
|
}
|
|
243
|
-
const firstError = Value.Errors(bridgeMessageSchema,
|
|
248
|
+
const firstError = Value.Errors(bridgeMessageSchema, value)[0];
|
|
244
249
|
const message = firstError ? `Invalid bridge message: ${firstError.message}` : "Invalid bridge message";
|
|
245
250
|
return { ok: false, error: { code: "invalid_message", message } };
|
|
246
251
|
}
|
package/src/bridge/reserved.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const RESERVED_HANDLE_OUTPUT_TOOL = "__handle_output__" as const;
|
|
|
15
15
|
export const RESERVED_HANDLE_SEND_TOOL = "__handle_send__" as const;
|
|
16
16
|
/** `handle(node).control.cancel()`: idempotent for its epoch; a successor run is never touched. */
|
|
17
17
|
export const RESERVED_HANDLE_CANCEL_TOOL = "__handle_cancel__" as const;
|
|
18
|
+
/** In-cell `packages.install(manager, requirements, {timeout?})`: the `%pip` / `%bun` / `%npm` installer as a call. */
|
|
19
|
+
export const RESERVED_PACKAGES_INSTALL_TOOL = "__packages_install__" as const;
|
|
18
20
|
/** Canonical oh-my-pi eval-timeout pause operation. */
|
|
19
21
|
export const TIMEOUT_PAUSE_OP = "timeout-pause" as const;
|
|
20
22
|
/** Canonical oh-my-pi eval-timeout resume operation. */
|