pi-mono/apps/p2/plugins/codemode/contract.ts
Mario Zechner 05dc8d239d feat: add apps/p2 (imported from pi-private at 7dadff697)
p2 (Pi Mobile on Chord v2) moves from pi-private into pi as one commit. Root scripts that loop all workspaces
use --if-present; npm test, ./test.sh and the release script cover packages/* only (p2: cd apps/p2 && npm test);
sync-versions also updates apps' workspace pins.
2026-11-03 13:39:06 +00:00

15 lines
853 B
TypeScript

import { local } from "@p2/app/v1";
/**
* Heap cap of each script's QuickJS VM. Keep it constant across restarts: the limit is part of the VM's fingerprint,
* which Durable records when a script starts, and a script interrupted by a restart resumes only on a VM with the same
* fingerprint. A changed limit makes every interrupted script end with "the sandbox changed" instead of resuming.
*/
export const CODEMODE_MEMORY_LIMIT_BYTES = 256 * 1024 * 1024;
/**
* The worker's code mode sandbox (host-internal): one per worker, closed when the plugin is removed or the worker
* stops; a reload opens a new one and drains the old one in the background (its scripts run on). Each running script
* holds one worker thread; closing aborts them.
*/
export const CodemodeRuntime = local("p2.codemode-runtime", { version: 2, params: {}, members: {} });