cf60e6df51
- Added a unified eval framework with parser grammar, backend interfaces, and JS/Python execution result types. - Added eval tool docs and updated prompts for fenced cells, `eval.py`/`eval.js`, and fallback behavior. - Replaced the built-in `python` tool with `eval` across registry, rendering, interactive modes, and tool settings. - Migrated Python execution runtime from `src/ipy` to `src/eval/py`, renamed state fields, and removed legacy introspection. - Refactored browser tooling from in-process VM helpers to worker-managed tab supervisors and protocol transport. - Added eval parser fallback and JS tool-bridge tests, updated imports, and removed obsolete python-mode suites.
22 lines
637 B
TypeScript
22 lines
637 B
TypeScript
import { parentPort } from "node:worker_threads";
|
|
import type { Transport, WorkerInbound, WorkerOutbound } from "./tab-protocol";
|
|
import { WorkerCore } from "./tab-worker";
|
|
|
|
if (!parentPort) throw new Error("tab-worker-entry: missing parentPort");
|
|
|
|
const transport: Transport = {
|
|
send(msg, transferList) {
|
|
parentPort!.postMessage(msg, transferList ?? []);
|
|
},
|
|
onMessage(handler) {
|
|
const wrap = (message: unknown): void => handler(message as WorkerOutbound | WorkerInbound);
|
|
parentPort!.on("message", wrap);
|
|
return () => parentPort!.off("message", wrap);
|
|
},
|
|
close() {
|
|
parentPort!.close();
|
|
},
|
|
};
|
|
|
|
new WorkerCore(transport);
|