@code-yeongyu/senpi-codemode 2026.10.8 → 2026.10.9
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 +20 -0
- package/README.md +51 -3
- package/package.json +4 -4
- package/src/bridge/http-server.ts +9 -1
- package/src/bridge/protocol.ts +4 -0
- package/src/bridges/eval-virtual-schemas.ts +1 -0
- package/src/environments/py-installer.ts +64 -4
- package/src/environments/python-environments.ts +85 -0
- package/src/environments/revision-store.ts +18 -3
- package/src/extension/bridge-tool-call.ts +2 -0
- package/src/extension/cell-kernel-tools.ts +28 -0
- package/src/extension/kernel-replacement.ts +20 -0
- package/src/extension/runtime-factory.ts +12 -0
- package/src/extension/session-manager-proxy.ts +6 -0
- package/src/extension/session-manager.ts +10 -2
- package/src/index.ts +1 -0
- package/src/kernels/jl/prelude.jl +6 -1
- package/src/kernels/js/context-manager.ts +15 -1
- package/src/kernels/js/local-module-loader.ts +9 -4
- package/src/kernels/js/worker-runtime.js +3 -1
- package/src/kernels/js/workpool.js +5 -2
- package/src/kernels/py/kernel.ts +8 -2
- package/src/kernels/py/prelude.py +112 -9
- package/src/kernels/py/transport.ts +13 -1
- package/src/kernels/rb/workpool.rb +7 -1
- package/src/kernels/shared/cell-source-at-start.ts +18 -0
- package/src/tool/cell-handler.ts +1 -1
- package/src/tool/eval-tool-options.ts +3 -0
- package/src/tool/load-cell.ts +73 -0
- package/src/tool/magic-cell-host.ts +65 -0
- package/src/tool/magic-cells.ts +65 -0
- package/src/tool/run-eval-cell.ts +30 -0
- package/src/tool/types.ts +27 -0
package/src/tool/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DEFAULT_RUN_BUDGET_SECONDS,
|
|
9
9
|
defaultCodemodeSettings,
|
|
10
10
|
} from "../config/settings.ts";
|
|
11
|
+
import type { KernelToolsCapability } from "../kernels/js/kernel-tools-types.ts";
|
|
11
12
|
import type { TruncationMeta } from "../output/output-meta.ts";
|
|
12
13
|
|
|
13
14
|
export const evalLanguageOrder = ["js", "py", "rb", "jl"] as const;
|
|
@@ -167,8 +168,29 @@ export interface EvalKernelRunInput {
|
|
|
167
168
|
readonly onMessage?: (message: KernelToHostMessage) => void;
|
|
168
169
|
/** Globals of the tools active when the cell was submitted; kernels without preludes ignore them. */
|
|
169
170
|
readonly kernelPreludes?: readonly KernelPreludeContribution[];
|
|
171
|
+
/**
|
|
172
|
+
* Python only: read when the cell starts running (not when it was queued), so a cell queued behind `%pip`
|
|
173
|
+
* sees the revision it published. `""` means no environment: the previous revision leaves the import path.
|
|
174
|
+
*/
|
|
175
|
+
readonly envRoot?: () => string;
|
|
176
|
+
/** The file a `%load` cell runs: tracebacks name it and its relative imports resolve from its directory. */
|
|
177
|
+
readonly sourceFile?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Called when the cell's turn comes in the kernel's queue, never earlier: what to run instead of `code` (a `%load`
|
|
180
|
+
* cell's file), or a refusal that settles the cell as failed in queue order.
|
|
181
|
+
*/
|
|
182
|
+
readonly resolveAtStart?: () => CellSourceAtStart;
|
|
183
|
+
/**
|
|
184
|
+
* Subprocess kernels attach this to the cell's host calls, and the host gives those calls the cell's kernel tools.
|
|
185
|
+
* A fresh secret per run, sent only to the kernel that runs the cell; never a model-visible id.
|
|
186
|
+
*/
|
|
187
|
+
readonly bridgeCellToken?: string;
|
|
170
188
|
}
|
|
171
189
|
|
|
190
|
+
export type CellSourceAtStart =
|
|
191
|
+
| { readonly ok: true; readonly code: string; readonly sourceFile?: string }
|
|
192
|
+
| { readonly ok: false; readonly message: string };
|
|
193
|
+
|
|
172
194
|
export interface KernelInterruptHandle {
|
|
173
195
|
/** Resolves once the kernel knows whether user state survived the interrupt. */
|
|
174
196
|
readonly stateRetained: Promise<boolean>;
|
|
@@ -205,6 +227,11 @@ export interface EvalKernelManager {
|
|
|
205
227
|
* Identity-checked, so releasing a superseded listener never unbinds a newer cell's listener.
|
|
206
228
|
*/
|
|
207
229
|
releaseKernelListener?(language: EvalLanguage, onMessage: (message: KernelToHostMessage) => void): void;
|
|
230
|
+
/**
|
|
231
|
+
* Binds a running cell's kernel-tools capability to the host calls that carry `token` (subprocess kernels reach
|
|
232
|
+
* the host over the bridge, outside the cell's async context). The returned release runs when the cell settles.
|
|
233
|
+
*/
|
|
234
|
+
bindCellKernelTools?(token: string, capability: KernelToolsCapability): () => void;
|
|
208
235
|
}
|
|
209
236
|
|
|
210
237
|
export type ExecuteTool = (
|