mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-06 23:44:36 +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.
15 lines
626 B
JSON
15 lines
626 B
JSON
{
|
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
"name": "pi-codemode-agent-example",
|
|
"main": "src/index.ts",
|
|
"compatibility_date": "2026-04-22",
|
|
"durable_objects": {
|
|
"bindings": [
|
|
{ "name": "SESSION", "class_name": "Session" },
|
|
// The sandbox class lives in its own Worker. `script_name` is what puts scripts in a different
|
|
// isolate; binding a class exported from this Worker would run them on the session's thread.
|
|
{ "name": "CODEMODE_SANDBOX", "class_name": "CodemodeSandbox", "script_name": "pi-codemode-sandbox" }
|
|
]
|
|
},
|
|
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["Session"] }]
|
|
}
|