@code-yeongyu/senpi-codemode 2026.7.25-2
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 +250 -0
- package/LICENSE +22 -0
- package/README.md +161 -0
- package/package.json +58 -0
- package/src/bridge/http-server.ts +236 -0
- package/src/bridge/protocol.ts +198 -0
- package/src/bridge/reserved.ts +9 -0
- package/src/bridges/agent-bridge.ts +197 -0
- package/src/bridges/output-bridge.ts +96 -0
- package/src/bridges/schema-injection.ts +3 -0
- package/src/codemode/runtime.ts +258 -0
- package/src/codemode/tools.ts +106 -0
- package/src/completion/handler.ts +192 -0
- package/src/completion/tool-bridge.ts +55 -0
- package/src/config/settings.ts +215 -0
- package/src/extension/runtime-factory.ts +114 -0
- package/src/extension/session-manager-proxy.ts +116 -0
- package/src/extension/session-manager.ts +215 -0
- package/src/host-sdk.ts +1 -0
- package/src/index.ts +181 -0
- package/src/interpreters/detect.ts +161 -0
- package/src/kernels/jl/kernel.ts +37 -0
- package/src/kernels/jl/prelude.jl +283 -0
- package/src/kernels/jl/runner.jl +327 -0
- package/src/kernels/js/context-manager.ts +296 -0
- package/src/kernels/js/inline-worker-entry.js +23 -0
- package/src/kernels/js/inline-worker.ts +15 -0
- package/src/kernels/js/kernel-contract.ts +38 -0
- package/src/kernels/js/local-module-loader.ts +108 -0
- package/src/kernels/js/prelude.ts +15 -0
- package/src/kernels/js/rewrite-imports.ts +164 -0
- package/src/kernels/js/run-queue.ts +82 -0
- package/src/kernels/js/worker-core.d.ts +18 -0
- package/src/kernels/js/worker-core.js +94 -0
- package/src/kernels/js/worker-entry.js +23 -0
- package/src/kernels/js/worker-host.ts +117 -0
- package/src/kernels/js/worker-indirect-eval.js +88 -0
- package/src/kernels/js/worker-runtime.js +401 -0
- package/src/kernels/py/kernel-contract.ts +32 -0
- package/src/kernels/py/kernel.ts +290 -0
- package/src/kernels/py/prelude.py +954 -0
- package/src/kernels/py/process.ts +119 -0
- package/src/kernels/py/transport.ts +237 -0
- package/src/kernels/rb/kernel.ts +26 -0
- package/src/kernels/rb/prelude.rb +270 -0
- package/src/kernels/rb/runner.rb +204 -0
- package/src/kernels/shared/subprocess-contract.ts +22 -0
- package/src/kernels/shared/subprocess-kernel.ts +266 -0
- package/src/kernels/shared/subprocess-process.ts +174 -0
- package/src/kernels/shared/subprocess-queue.ts +101 -0
- package/src/kernels/shared/subprocess-run.ts +98 -0
- package/src/output/output-meta.ts +89 -0
- package/src/output/streaming-output.ts +296 -0
- package/src/prompt/eval-prompt.ts +319 -0
- package/src/timeouts/bridge-timeout.ts +16 -0
- package/src/timeouts/idle-timeout.ts +84 -0
- package/src/tool/cell-handler.ts +279 -0
- package/src/tool/eval-tool.ts +285 -0
- package/src/tool/image.ts +274 -0
- package/src/tool/json-tree.ts +247 -0
- package/src/tool/render.ts +876 -0
- package/src/tool/status-events.ts +12 -0
- package/src/tool/types.ts +114 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
## [2026.7.25-2] - 2026-07-25
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
## [2026.7.25] - 2026-07-25
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
### Removed
|
|
38
|
+
|
|
39
|
+
## [2026.7.24] - 2026-07-24
|
|
40
|
+
|
|
41
|
+
### Breaking Changes
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
### Removed
|
|
50
|
+
|
|
51
|
+
## [2026.7.23] - 2026-07-23
|
|
52
|
+
|
|
53
|
+
### Breaking Changes
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Added the GPT-only Code Mode runtime with `exec` and `wait` tools, plus model-aware GPT eval routing ([#301](https://github.com/code-yeongyu/senpi/pull/301)).
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
### Removed
|
|
64
|
+
|
|
65
|
+
## [2026.7.22-2] - 2026-07-22
|
|
66
|
+
|
|
67
|
+
### Breaking Changes
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
### Removed
|
|
76
|
+
|
|
77
|
+
## [2026.7.22] - 2026-07-22
|
|
78
|
+
|
|
79
|
+
### Breaking Changes
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
### Removed
|
|
88
|
+
|
|
89
|
+
## [2026.7.20-2] - 2026-07-20
|
|
90
|
+
|
|
91
|
+
### Breaking Changes
|
|
92
|
+
|
|
93
|
+
### Added
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
|
|
97
|
+
### Fixed
|
|
98
|
+
|
|
99
|
+
### Removed
|
|
100
|
+
|
|
101
|
+
## [2026.7.20] - 2026-07-20
|
|
102
|
+
|
|
103
|
+
### Breaking Changes
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
|
|
107
|
+
### Changed
|
|
108
|
+
|
|
109
|
+
### Fixed
|
|
110
|
+
|
|
111
|
+
- Fixed the Python kernel's `tool.<name>()` proxy injecting an omp-only `i` ("py prelude") intent field into every bridged tool call. Senpi tool schemas never declare `i`, so strict tools (`additionalProperties: false`, e.g. `web_search`) rejected every eval-bridged call with `Validation failed for tool …: must not have additional properties`. Args now pass through verbatim, matching the JS/Ruby/Julia preludes.
|
|
112
|
+
|
|
113
|
+
### Removed
|
|
114
|
+
|
|
115
|
+
## [2026.7.17-5] - 2026-07-17
|
|
116
|
+
|
|
117
|
+
### Breaking Changes
|
|
118
|
+
|
|
119
|
+
### Added
|
|
120
|
+
|
|
121
|
+
### Changed
|
|
122
|
+
- Changed the Kimi K-series eval prompt dialect to make eval-first, whole-step parallel batching the default: strong positive emphasis now directs multi-call work into one `eval` cell, parallelizes independent calls, handles failures in-kernel, and returns distilled facts.
|
|
123
|
+
|
|
124
|
+
### Fixed
|
|
125
|
+
|
|
126
|
+
### Removed
|
|
127
|
+
|
|
128
|
+
## [2026.7.17-4] - 2026-07-17
|
|
129
|
+
|
|
130
|
+
### Breaking Changes
|
|
131
|
+
|
|
132
|
+
### Added
|
|
133
|
+
|
|
134
|
+
### Changed
|
|
135
|
+
|
|
136
|
+
### Fixed
|
|
137
|
+
|
|
138
|
+
### Removed
|
|
139
|
+
|
|
140
|
+
## [2026.7.17-3] - 2026-07-17
|
|
141
|
+
|
|
142
|
+
### Breaking Changes
|
|
143
|
+
|
|
144
|
+
### Added
|
|
145
|
+
|
|
146
|
+
### Changed
|
|
147
|
+
|
|
148
|
+
### Fixed
|
|
149
|
+
|
|
150
|
+
### Removed
|
|
151
|
+
|
|
152
|
+
## [2026.7.17-2] - 2026-07-17
|
|
153
|
+
|
|
154
|
+
### Added
|
|
155
|
+
|
|
156
|
+
- Added a host-sizing note to the `eval` prompt: the extension now passes a preformatted host line (platform, arch, CPU model, core count) at registration so the prompt tells the model to size `parallel(thunks)` pools to the local cores and keep shell commands platform-appropriate.
|
|
157
|
+
- Added model-aware eval-first batching emphasis: the `eval` tool description and its system-prompt guideline now render in a dialect selected by the active model id (Claude/GLM, OpenAI, Kimi, and a maximum-emphasis default fallback), re-registering on `model_select` so mid-session model switches pick up the matching dialect.
|
|
158
|
+
|
|
159
|
+
### Changed
|
|
160
|
+
|
|
161
|
+
### Fixed
|
|
162
|
+
|
|
163
|
+
## [2026.7.17] - 2026-07-17
|
|
164
|
+
|
|
165
|
+
### Added
|
|
166
|
+
|
|
167
|
+
### Changed
|
|
168
|
+
|
|
169
|
+
### Fixed
|
|
170
|
+
|
|
171
|
+
- Fixed `eval` tool calls rendering duplicate stacked boxes after a result arrived; the pending, running, and completed states now update in one in-place frame ([#223](https://github.com/code-yeongyu/senpi/pull/223)).
|
|
172
|
+
|
|
173
|
+
## [2026.7.16-3] - 2026-07-16
|
|
174
|
+
|
|
175
|
+
### Added
|
|
176
|
+
|
|
177
|
+
### Changed
|
|
178
|
+
|
|
179
|
+
### Fixed
|
|
180
|
+
|
|
181
|
+
## [2026.7.16-2] - 2026-07-16
|
|
182
|
+
|
|
183
|
+
### Added
|
|
184
|
+
|
|
185
|
+
### Changed
|
|
186
|
+
|
|
187
|
+
### Fixed
|
|
188
|
+
|
|
189
|
+
## [2026.7.16] - 2026-07-16
|
|
190
|
+
|
|
191
|
+
### Added
|
|
192
|
+
|
|
193
|
+
### Changed
|
|
194
|
+
|
|
195
|
+
### Fixed
|
|
196
|
+
|
|
197
|
+
## [2026.7.14-3] - 2026-07-14
|
|
198
|
+
|
|
199
|
+
### Added
|
|
200
|
+
|
|
201
|
+
### Changed
|
|
202
|
+
|
|
203
|
+
### Fixed
|
|
204
|
+
|
|
205
|
+
## [2026.7.14-2] - 2026-07-14
|
|
206
|
+
|
|
207
|
+
### Added
|
|
208
|
+
|
|
209
|
+
### Changed
|
|
210
|
+
|
|
211
|
+
### Fixed
|
|
212
|
+
|
|
213
|
+
## [2026.7.14] - 2026-07-14
|
|
214
|
+
|
|
215
|
+
### Added
|
|
216
|
+
|
|
217
|
+
### Changed
|
|
218
|
+
|
|
219
|
+
- Improved the `eval` prompt instructions and reuse-chain examples to teach persistent-state reuse, batch file processing, and parallel session-tool fan-out within a single cell.
|
|
220
|
+
|
|
221
|
+
### Fixed
|
|
222
|
+
|
|
223
|
+
## [2026.7.13] - 2026-07-13
|
|
224
|
+
|
|
225
|
+
### Added
|
|
226
|
+
|
|
227
|
+
- Added the source-only `@code-yeongyu/senpi-codemode` workspace package scaffold.
|
|
228
|
+
- Added codemode settings loading, interpreter detection, prompt generation, loopback bridge helpers, and persistent JS/Python/Ruby/Julia kernel building blocks.
|
|
229
|
+
- Added structured kernel status events from the bridge through TUI rendering.
|
|
230
|
+
- Added `agent()` and `output()` bridges that delegate through configured task-tool contracts.
|
|
231
|
+
- Added bounded streaming output with session-adjacent spill files and plain-path notices.
|
|
232
|
+
- Added eval render parity for highlighted cells, status rows, task progress, JSON displays, truncation warnings, and image fallbacks.
|
|
233
|
+
- Added JavaScript import rewriting for persistent eval cells.
|
|
234
|
+
|
|
235
|
+
### Changed
|
|
236
|
+
|
|
237
|
+
- Activated the exported extension factory so the bundled package registers and reconfigures the persistent-kernel `eval` tool in Senpi sessions.
|
|
238
|
+
- Improved `eval` TUI rendering with streaming status and timing, bounded expandable previews, width-safe ANSI/CJK/emoji reflow, nested tool-call state, and terminal-aware image fallbacks.
|
|
239
|
+
- Re-register the eval prompt and schema at session start after settings, interpreter availability, and active task-tool names resolve.
|
|
240
|
+
- Recorded the completed oh-my-pi eval-port provenance for this extension; task delegation and artifact handling follow Senpi extension boundaries.
|
|
241
|
+
|
|
242
|
+
### Fixed
|
|
243
|
+
|
|
244
|
+
- Prevented image MIME labels from injecting terminal control sequences through eval text fallbacks.
|
|
245
|
+
- Fixed eval cancellation and timeout handling across JavaScript, Python, Ruby, and Julia kernels: aborts now interrupt active work, unresponsive subprocesses escalate to bounded hard termination, queued Python cells cannot execute after cancellation, persistent Python state survives graceful interrupts, timeout/death durations remain truthful, and late bridge or retired-process output cannot keep an eval hung or contaminate the next cell.
|
|
246
|
+
- Fixed the bundled `eval` extension failing to load in packaged installs: `completion/handler.ts` imported peer symbols via the monorepo source path `../../../ai/src/*`, which only resolves inside the workspace and threw `Cannot find module` once packed. It now imports from the `@earendil-works/pi-ai/compat` package entry, so `eval` loads in the shipped Node package.
|
|
247
|
+
- Fixed a temporal-dead-zone crash in the `eval` tool: subprocess kernels (py/rb/jl) emit their `ready` frame synchronously during kernel startup, which invoked the message handler before the `kernel` binding initialized and crashed the whole agent process. The self-referential binding is now hoisted so startup frames no longer throw.
|
|
248
|
+
- Fixed cell-output misattribution on reused persistent kernels: `getKernel` now rebinds the per-cell `onMessage` on every call, so a second (and later) cell's streamed `text`/`display`/`log` output is delivered to that cell instead of the previous one.
|
|
249
|
+
- Fixed the Ruby kernel corrupting its JSONL protocol channel: user `puts`/`print` output is now captured via a redirected `$stdout` and emitted as `text` frames instead of being written directly onto the shared stdout stream.
|
|
250
|
+
- Fixed the Ruby kernel raising `ArgumentError: unknown keywords` on Ruby 3.0+ (e.g. CI's Ruby 3.x, while local Ruby 2.6 masked it): `env()`/`read()`/`write()` passed braceless string-keyed hashes to `__senpi_emit_status`, which Ruby 3 parses as keyword arguments against its `force:` keyword parameter instead of the positional `fields` hash. The field hashes are now wrapped in explicit braces so status emission and final-expression auto-display work identically across Ruby 2.6–3.4.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner (upstream pi-mono)
|
|
4
|
+
Copyright (c) 2026 Yeongyu Kim and senpi contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# @code-yeongyu/senpi-codemode
|
|
2
|
+
|
|
3
|
+
`@code-yeongyu/senpi-codemode` is Senpi's source-only Code Mode extension. It
|
|
4
|
+
registers persistent-kernel `eval` for every eligible model and GPT-only
|
|
5
|
+
`exec`/`wait` cells for bounded JavaScript orchestration. `eval` owns one
|
|
6
|
+
persistent kernel per enabled language and re-registers at session start after
|
|
7
|
+
configuration, interpreter availability, and active task-tool names are known.
|
|
8
|
+
|
|
9
|
+
## Capabilities
|
|
10
|
+
|
|
11
|
+
- Persistent JavaScript, Python, Ruby, and Julia cells. State survives later
|
|
12
|
+
cells in the same language until reset, restart, or session disposal.
|
|
13
|
+
- Loopback, bearer-authenticated kernel bridge with bounded JSONL frames.
|
|
14
|
+
- Structured status events for file operations, environment access, phases,
|
|
15
|
+
bridge activity, and delegated task progress.
|
|
16
|
+
- Bounded streaming output with head/tail previews, column clamping, and
|
|
17
|
+
session-adjacent spill files for large streams.
|
|
18
|
+
- TUI and HTML-export rendering for syntax-highlighted cells, status rows,
|
|
19
|
+
task progress, structured display values, truncation warnings, and image
|
|
20
|
+
fallbacks.
|
|
21
|
+
- JavaScript import rewriting for supported local modules and package imports
|
|
22
|
+
in the persistent Node.js worker.
|
|
23
|
+
- GPT Code Mode `exec`/`wait` cells use fresh JavaScript workers, can compose
|
|
24
|
+
active tools through `tools.<name>(args)`, and never replace `eval`.
|
|
25
|
+
|
|
26
|
+
## Kernels
|
|
27
|
+
|
|
28
|
+
| Language | Default | Runtime | Notes |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| `js` | enabled | Node.js worker | Requires Node.js 24 or newer; supports top-level `await` and `return`. |
|
|
31
|
+
| `py` | enabled | `python3` or `python` | Optional interpreter detected at session start. |
|
|
32
|
+
| `rb` | disabled | `ruby` | Optional interpreter detected at session start. |
|
|
33
|
+
| `jl` | disabled | `julia` | Optional interpreter detected at session start. |
|
|
34
|
+
|
|
35
|
+
A missing optional interpreter removes that language from the session's `eval`
|
|
36
|
+
schema; it is not an installation failure.
|
|
37
|
+
|
|
38
|
+
## Settings
|
|
39
|
+
|
|
40
|
+
Configuration is loaded in this order:
|
|
41
|
+
|
|
42
|
+
1. `.senpi/codemode.json` in the session working directory
|
|
43
|
+
2. `~/.senpi/agent/codemode.json`
|
|
44
|
+
3. Built-in defaults
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"languages": {
|
|
49
|
+
"py": true,
|
|
50
|
+
"js": true,
|
|
51
|
+
"rb": false,
|
|
52
|
+
"jl": false
|
|
53
|
+
},
|
|
54
|
+
"cellTimeoutSeconds": 30,
|
|
55
|
+
"parallelPoolWidth": 4,
|
|
56
|
+
"taskTools": {
|
|
57
|
+
"task": "task",
|
|
58
|
+
"output": "task_output"
|
|
59
|
+
},
|
|
60
|
+
"outputSink": {
|
|
61
|
+
"headBytes": 20480,
|
|
62
|
+
"maxColumns": 768
|
|
63
|
+
},
|
|
64
|
+
"statusEvents": true
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| Key | Default | Effect |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| `languages` | `py`/`js` enabled; `rb`/`jl` disabled | Selects desired languages before interpreter detection. |
|
|
71
|
+
| `cellTimeoutSeconds` | `30` | Idle timeout for one cell unless the call supplies `timeout`. |
|
|
72
|
+
| `parallelPoolWidth` | `4` | Maximum concurrent `parallel()` thunks. |
|
|
73
|
+
| `taskTools.task` | `"task"` | Registered tool name used by `agent()`. |
|
|
74
|
+
| `taskTools.output` | `"task_output"` | Registered tool name used by `output()`. |
|
|
75
|
+
| `outputSink.headBytes` | `20480` | Bytes retained from the beginning of a middle-truncated preview; `0` disables it. |
|
|
76
|
+
| `outputSink.maxColumns` | `768` | Maximum rendered output columns; `0` disables column clamping. |
|
|
77
|
+
| `statusEvents` | `true` | Enables kernel status-event forwarding and rendering. |
|
|
78
|
+
|
|
79
|
+
`SENPI_CODEMODE_PY`, `SENPI_CODEMODE_JS`, `SENPI_CODEMODE_RB`, and
|
|
80
|
+
`SENPI_CODEMODE_JL` override the corresponding file setting. `1` or `true`
|
|
81
|
+
enables; `0` or `false` disables. Any other value leaves the file setting in
|
|
82
|
+
effect.
|
|
83
|
+
|
|
84
|
+
Malformed JSON or invalid settings fall back to defaults with a warning.
|
|
85
|
+
|
|
86
|
+
## Cell helpers
|
|
87
|
+
|
|
88
|
+
Python, JavaScript, Ruby, and Julia expose the same conceptual helpers. Python,
|
|
89
|
+
Ruby, and Julia use trailing keyword options; JavaScript uses one trailing
|
|
90
|
+
options object and asynchronous helpers are `await`-able.
|
|
91
|
+
|
|
92
|
+
| Helper | Contract |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `display(value)` | Emits text, structured JSON, markdown, or supported image display data. |
|
|
95
|
+
| `print(value, ...)` | Emits text output. |
|
|
96
|
+
| `read(path, offset?, limit?)` | Reads text with 1-indexed line slicing. `local://` paths resolve under the session artifact root. |
|
|
97
|
+
| `write(path, content)` | Creates parent directories and writes text. `local://` paths persist in the session artifact root. |
|
|
98
|
+
| `env(key?, value?)` | Reads all kernel environment values, one value, or sets one value. |
|
|
99
|
+
| `tool.<name>(args)` / `tools.<name>(args)` | Invokes an active Senpi tool through the normal `pi.executeTool` pipeline. `tools` is the GPT Code Mode spelling. |
|
|
100
|
+
| `completion(prompt, model?, system?, schema?)` | Requests a one-shot host completion; `schema` asks the host to parse structured output. |
|
|
101
|
+
| `agent(prompt, ...)` | Delegates to the configured active `taskTools.task` tool. Supports background handles and structured JSON results. |
|
|
102
|
+
| `output(ids, format?, offset?, limit?)` | Delegates transcript retrieval to the configured active `taskTools.output` tool. |
|
|
103
|
+
| `parallel(thunks)` | Runs thunks through the configured bounded pool while preserving input order. |
|
|
104
|
+
| `pipeline(items, ...stages)` | Applies stages left to right with a barrier between stages. |
|
|
105
|
+
| `log(message)` / `phase(title)` | Emits progress text and starts a status phase. |
|
|
106
|
+
|
|
107
|
+
`agent()` is available only when the configured task tool is active in the
|
|
108
|
+
session. `output()` similarly requires the configured task-output tool. Missing
|
|
109
|
+
tools produce a clear availability error instead of importing an orchestration
|
|
110
|
+
package. `agent()` delegates through the tool contract, so task-engine
|
|
111
|
+
permissions, progress updates, and transcripts remain owned by that engine.
|
|
112
|
+
`isolated`, `apply`, and `merge` are accepted for compatibility but emit a
|
|
113
|
+
warning because this task-engine integration has no isolation model.
|
|
114
|
+
|
|
115
|
+
## Output and artifacts
|
|
116
|
+
|
|
117
|
+
Cell output is streamed while the cell runs. Large streams spill to an absolute
|
|
118
|
+
file after the default 50 KiB threshold. With a session file such as
|
|
119
|
+
`/path/session.jsonl`, artifacts live in `/path/session-artifacts/`; sessions
|
|
120
|
+
without a file use a unique temporary directory. Truncated results include a
|
|
121
|
+
plain-path notice such as `[Full output: /absolute/path/eval-….log]`.
|
|
122
|
+
|
|
123
|
+
## Deliberate differences from oh-my-pi
|
|
124
|
+
|
|
125
|
+
- There is no `budget` helper.
|
|
126
|
+
- There is no `artifact://` protocol. Spill references are ordinary absolute
|
|
127
|
+
file paths.
|
|
128
|
+
- `agent()` and `output()` compose registered task tools through
|
|
129
|
+
`pi.executeTool`; this package does not import a task-engine workspace
|
|
130
|
+
package.
|
|
131
|
+
- Task transcript formats are limited to full (`raw`) and trailing (`tail`)
|
|
132
|
+
output. Query, JSON, and stripped metadata formats are task-engine concerns.
|
|
133
|
+
|
|
134
|
+
## Security and lifecycle
|
|
135
|
+
|
|
136
|
+
Kernels run locally with the invoking user's permissions. The bridge listens on
|
|
137
|
+
loopback only and authenticates each session with a random bearer token.
|
|
138
|
+
Session generations fence retired kernels and callbacks; each cell settles once
|
|
139
|
+
across completion, errors, cancellation, timeout, bridge failure, or a kernel
|
|
140
|
+
crash.
|
|
141
|
+
|
|
142
|
+
GPT Code Mode is not an additional sandbox: it uses the same Node worker trust
|
|
143
|
+
boundary as JavaScript `eval`. Its separate cell lifecycle exists so a yielded
|
|
144
|
+
`exec` can be observed or terminated with `wait` without affecting persistent
|
|
145
|
+
`eval` kernels. `eval`, `exec`, and `wait` are excluded from the nested tool
|
|
146
|
+
namespace to prevent recursive Code Mode execution.
|
|
147
|
+
|
|
148
|
+
## Validation
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd packages/senpi-codemode
|
|
152
|
+
npm test
|
|
153
|
+
|
|
154
|
+
cd ../..
|
|
155
|
+
npm run check
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Direct real-surface QA drivers live in `scripts/qa-*.ts`: kernel cells
|
|
159
|
+
(`qa-py-cell.ts`, `qa-js-cell.ts`, `qa-rb-cell.ts`, `qa-jl-cell.ts`), end-to-end
|
|
160
|
+
extension execution (`qa-e2e-eval.ts`, `qa-gpt-code-mode.ts`), and renderer output
|
|
161
|
+
(`qa-render-dump.ts`).
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
+
"version": "2026.7.25-2",
|
|
4
|
+
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"types": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src",
|
|
14
|
+
"README.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "npx tsx ../../node_modules/vitest/dist/cli.js --run test/",
|
|
20
|
+
"clean": "node -e \"\"",
|
|
21
|
+
"build": "node -e \"\""
|
|
22
|
+
},
|
|
23
|
+
"pi": {
|
|
24
|
+
"extensions": [
|
|
25
|
+
"./src/index.ts"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@babel/parser": "7.29.7",
|
|
33
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@^2026.7.25-2",
|
|
34
|
+
"typebox": "1.1.38"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@code-yeongyu/senpi": "*"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@code-yeongyu/senpi": "2026.7.25-2"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"senpi",
|
|
44
|
+
"pi",
|
|
45
|
+
"extension",
|
|
46
|
+
"codemode"
|
|
47
|
+
],
|
|
48
|
+
"author": "Yeongyu Kim",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/code-yeongyu/senpi.git",
|
|
53
|
+
"directory": "packages/senpi-codemode"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=24.0.0"
|
|
57
|
+
}
|
|
58
|
+
}
|