diff --git a/packages/durable/CHANGELOG.md b/packages/durable/CHANGELOG.md index a913ce222..cf45dd551 100644 --- a/packages/durable/CHANGELOG.md +++ b/packages/durable/CHANGELOG.md @@ -123,6 +123,7 @@ - Fixed a commit that Storage rejects after adopting it (a failed JSONL reclaim) publishing nothing: it is published and its waits resolve before the Session fails, so a replica built from `subscribeCommits()` stays equal to Storage and `pi.durable.tasks.active` stays balanced. - Fixed a throwing telemetry adapter (a commit's `pi.durable.entry` or `pi.durable.submission` event, `pi.durable.tasks.active`) rejecting a durable commit and leaving the views and the scheduler without it: it is reported as `host_error` with callback `"telemetry"`, and the commit resolves. A throwing report metric or report event is dropped. - Fixed a host that crashes during a model request resending it forever, adding an aborted entry each time: the interrupted request is a failed attempt under the retry policy, and the run ends with `runFailure` reason `interrupted` once no retry is left; other work cut off `restartLimit` times ends instead of keeping its conversation busy ([#11139](https://github.com/earendil-works/pi/issues/11139)) +- Fixed the Code Mode extension loading pi-codemode's WASM QuickJS runtime (`quickjs-wasi`) although it only runs scripts in the sandbox the host passes: it imports `toCodemodeIdentifier` from `@earendil-works/pi-codemode/declarations` instead of `/portable` ([#11254](https://github.com/earendil-works/pi/issues/11254)) ## [1.4.0] - 2026-10-21 diff --git a/packages/durable/src/codemode/codemode.ts b/packages/durable/src/codemode/codemode.ts index dba1d1e57..2b308e2da 100644 --- a/packages/durable/src/codemode/codemode.ts +++ b/packages/durable/src/codemode/codemode.ts @@ -37,13 +37,13 @@ import { type Context, copyJson, type JsonValue } from "@earendil-works/chord"; import { ownedSlice } from "@earendil-works/chord/delta"; import type { TextContent } from "@earendil-works/pi-ai"; -import { - type CodemodeHostCall, - type CodemodeOutcome, - type CodemodeResult, - type CodemodeRun, - type CodemodeSandboxBase, - toCodemodeIdentifier, +import { toCodemodeIdentifier } from "@earendil-works/pi-codemode/declarations"; +import type { + CodemodeHostCall, + CodemodeOutcome, + CodemodeResult, + CodemodeRun, + CodemodeSandboxBase, } from "@earendil-works/pi-codemode/portable"; import { CODEMODE_SOURCE_GRAMMAR, parseCodemodeSource } from "@earendil-works/pi-codemode/source"; import { type Static, Type } from "typebox"; diff --git a/packages/durable/test/codemode-imports.test.ts b/packages/durable/test/codemode-imports.test.ts new file mode 100644 index 000000000..df74da0e2 --- /dev/null +++ b/packages/durable/test/codemode-imports.test.ts @@ -0,0 +1,11 @@ +import { expect, test, vi } from "vitest"; +import { createCodemodeExtension } from "../src/codemode/codemode.ts"; + +// The extension runs scripts in the sandbox the host passes, so loading it must not load the WASM VM (#11254). +vi.mock("quickjs-wasi", () => { + throw new Error("the Code Mode extension loaded quickjs-wasi"); +}); + +test("the Code Mode extension loads without pi-codemode's WASM runtime", () => { + expect(createCodemodeExtension).toBeTypeOf("function"); +});