mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
For durable code mode: a host can rerun a script after a restart and get the same calls with the same arguments. start() runs the script with a virtual clock (startedAt, then each result's time, never backwards), randomness from a seed, UTC, no WeakRef/FinalizationRegistry, and the run's own tools and globals; every call goes to onCall with the VM's call id, and the host answers with run.deliver(seq, now, id, outcome). The VM applies results strictly in seq order whatever the transport does, reports its fingerprint (engine versions, prelude hash, limits) before the script runs, the calls issued after each result (onIdle), and the result it was processing when the script ended (result.during). Rejections can carry properties for the script's Error. execute() is unchanged.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/**
|
|
* Sandboxes that need no Node built-ins: `InlineCodemodeSandbox` runs the VM on the calling thread
|
|
* and `RemoteCodemodeSandbox` runs it in another isolate. Neither imports `node:*` modules, so this
|
|
* entry works in Cloudflare Workers, Durable Objects, and browsers. `CodemodeSandbox`, which uses
|
|
* worker threads, stays in the main entry.
|
|
*/
|
|
export { toCodemodeIdentifier } from "./identifier.ts";
|
|
export { CodemodeSandboxBase } from "./runtime/execution.ts";
|
|
export {
|
|
DEFAULT_INTERRUPT_BUDGET,
|
|
InlineCodemodeSandbox,
|
|
type InlineCodemodeSandboxOptions,
|
|
} from "./runtime/inline.ts";
|
|
export {
|
|
MAX_OUTPUT_CHARS,
|
|
MAX_OUTPUT_ITEMS,
|
|
MAX_STORE_TOTAL_CHARS,
|
|
MAX_STORE_VALUE_CHARS,
|
|
} from "./runtime/prelude-source.ts";
|
|
export type { HostToWorkerMessage, VmStartData, WorkerToHostMessage } from "./runtime/protocol.ts";
|
|
export {
|
|
type CodemodeRemote,
|
|
type CodemodeRemoteExchange,
|
|
type CodemodeRemoteMessage,
|
|
type CodemodeRemoteReply,
|
|
type CodemodeRemoteRequest,
|
|
type CodemodeServeOptions,
|
|
RemoteCodemodeSandbox,
|
|
type RemoteCodemodeSandboxOptions,
|
|
serveCodemodeRemote,
|
|
} from "./runtime/remote.ts";
|
|
export type {
|
|
CodemodeCall,
|
|
CodemodeCallStatus,
|
|
CodemodeDeclaredGlobal,
|
|
CodemodeDeclaredTool,
|
|
CodemodeDuring,
|
|
CodemodeError,
|
|
CodemodeErrorKind,
|
|
CodemodeExecuteOptions,
|
|
CodemodeHostCall,
|
|
CodemodeJsonSchema,
|
|
CodemodeOutcome,
|
|
CodemodeOutputItem,
|
|
CodemodeResult,
|
|
CodemodeRun,
|
|
CodemodeRunOptions,
|
|
CodemodeSandboxBaseOptions,
|
|
CodemodeStoreWrites,
|
|
CodemodeTool,
|
|
CodemodeToolContext,
|
|
} from "./types.ts";
|
|
export type { CodemodeWasmModule } from "./wasm.ts";
|