mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Split the host into transport-independent execution logic and a VM driver, so the VM can run in a worker thread (CodemodeSandbox, unchanged), on the calling thread (InlineCodemodeSandbox), or in another isolate over RPC (RemoteCodemodeSandbox). Add the /portable entry without Node imports and the /cloudflare entry with CodemodeSandboxDurableObject, meant to be deployed as its own Worker so scripts never block the caller's thread. Scripts that compute without awaiting a tool are bounded by an interrupt budget, now also polled while draining promise jobs. examples/cloudflare shows the setup.
19 lines
791 B
TypeScript
19 lines
791 B
TypeScript
// Modules that only exist when cloudflare.ts is built by Wrangler. Consumers get the real
|
|
// declarations from @cloudflare/workers-types or `wrangler types`; these keep this repository's
|
|
// type check free of a Workers type dependency and are not published.
|
|
|
|
declare module "cloudflare:workers" {
|
|
export abstract class DurableObject<Env = unknown> {
|
|
protected ctx: unknown;
|
|
protected env: Env;
|
|
constructor(ctx: unknown, env: Env);
|
|
}
|
|
}
|
|
|
|
// A pattern, not the exact specifier: coding-agent declares "quickjs-wasi/quickjs.wasm" as a path
|
|
// for Bun, and an exact declaration takes precedence where both are visible. cloudflare.ts casts the
|
|
// import to the compiled module Wrangler actually produces.
|
|
declare module "*/quickjs.wasm" {
|
|
const module: unknown;
|
|
export default module;
|
|
}
|