Skip to content

AI-native design editor. Open-source Figma alternative.

fix: run release tooling and the Harness companion on Node.js 26 (#1443)

Marc Went456af22a2652
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 850f1a795..4f106d0a0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -61,7 +61,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v7
with:
- node-version: 24.x
+ node-version: 26.x
- uses: ./.pipeline/.github/actions/setup-bun
with:
cache-scope: desktop
@@ -128,7 +128,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v7
with:
- node-version: 24.x
+ node-version: 26.x
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
@@ -211,7 +211,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v7
with:
- node-version: 24.x
+ node-version: 26.x
registry-url: https://registry.npmjs.org/
- uses: ./.pipeline/.github/actions/setup-bun
with:
diff --git a/bun.lock b/bun.lock
index 287e087d1..cecbed25d 100644
--- a/bun.lock
+++ b/bun.lock
@@ -475,6 +475,7 @@
"@ai-sdk/harness-pi": "1.0.140",
"@ai-sdk/sandbox-just-bash": "1.0.138",
"@earendil-works/pi-tui": "0.85.1",
+ "amaro": "1.2.2",
},
"devDependencies": {
"@types/bun": "^1.3.14",
@@ -2686,6 +2687,8 @@
"alien-signals": ["[email protected]", "", {}, "sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g=="],
+ "amaro": ["[email protected]", "", {}, "sha512-H1ReZZ8Te6HHaWAy9171A/iWkGZOusKCtdzmh6EnTgluiNiAV9OSmUIN5rZI1TZnw6+NAUNz+n6pAWoJAHhRIQ=="],
+
"ansi-colors": ["[email protected]", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="],
"ansi-escapes": ["[email protected]", "", { "dependencies": { "environment": "^1.0.0" } }, "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg=="],
diff --git a/changes/1443/fixed.md b/changes/1443/fixed.md
new file mode 100644
index 000000000..25aaa8f09
--- /dev/null
+++ b/changes/1443/fixed.md
@@ -0,0 +1 @@
+- The Harness companion loads Pi's MCP adapter on Node.js 26 instead of failing on its TypeScript sources.
diff --git a/packages/harness/package.json b/packages/harness/package.json
index d5adda34e..f08005769 100644
--- a/packages/harness/package.json
+++ b/packages/harness/package.json
@@ -36,7 +36,8 @@
"@ai-sdk/harness": "1.0.138",
"@ai-sdk/harness-pi": "1.0.140",
"@ai-sdk/sandbox-just-bash": "1.0.138",
- "@earendil-works/pi-tui": "0.85.1"
+ "@earendil-works/pi-tui": "0.85.1",
+ "amaro": "1.2.2"
},
"devDependencies": {
"@types/bun": "^1.3.14",
diff --git a/packages/harness/src/typescript-dependencies.ts b/packages/harness/src/typescript-dependencies.ts
index 983ffbe3d..378ea3202 100644
--- a/packages/harness/src/typescript-dependencies.ts
+++ b/packages/harness/src/typescript-dependencies.ts
@@ -1,33 +1,29 @@
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
+import { transformSync } from 'amaro'
+
/**
* `@ai-sdk/harness-pi` imports `pi-mcp-adapter`, which publishes TypeScript sources, and Node
- * refuses to strip types under `node_modules`. Strip them for TypeScript dependencies only, so
- * Pi sessions with MCP servers start under Node; Bun runs TypeScript itself.
+ * refuses to strip types under `node_modules`. Transform them for TypeScript dependencies only, so
+ * Pi sessions with MCP servers start under Node; Bun runs TypeScript itself. The adapter uses
+ * parameter properties, which need Amaro's transform mode: Node 26 only strips types.
*/
export function loadTypeScriptDependencies(): void {
if (process.versions.bun) return
- // Read at runtime so Node versions without these APIs still start the companion.
- const { registerHooks, stripTypeScriptTypes } = process.getBuiltinModule('node:module')
- if (typeof registerHooks !== 'function' || typeof stripTypeScriptTypes !== 'function') return
+ // Read at runtime so Node versions without module hooks still start the companion.
+ const { registerHooks } = process.getBuiltinModule('node:module')
+ if (typeof registerHooks !== 'function') return
registerHooks({
load(url, context, nextLoad) {
if (!url.startsWith('file:') || !url.endsWith('.ts') || !url.includes('/node_modules/')) {
return nextLoad(url, context)
}
const source = readFileSync(fileURLToPath(url), 'utf8')
- // The first call announces the experimental API on stderr, which reads as a problem in hosts.
- const emitWarning = process.emitWarning.bind(process)
- process.emitWarning = () => undefined
- try {
- return {
- format: 'module',
- source: stripTypeScriptTypes(source, { mode: 'transform' }),
- shortCircuit: true
- }
- } finally {
- process.emitWarning = emitWarning
+ return {
+ format: 'module',
+ source: transformSync(source, { mode: 'transform' }).code,
+ shortCircuit: true
}
}
})
diff --git a/packages/harness/tests/typescript-dependencies.test.ts b/packages/harness/tests/typescript-dependencies.test.ts
index 2b82d17e3..1e8e7b14d 100644
--- a/packages/harness/tests/typescript-dependencies.test.ts
+++ b/packages/harness/tests/typescript-dependencies.test.ts
@@ -5,11 +5,11 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
const hook = join(import.meta.dir, '../src/typescript-dependencies.ts')
-// The hook needs Node's module hooks and type stripping, which older Node versions lack.
+// The hook needs Node's synchronous module hooks, which older Node versions lack.
const nodeSupportsHook =
spawnSync('node', [
'-e',
- "const m = require('node:module'); process.exit(typeof m.registerHooks === 'function' && typeof m.stripTypeScriptTypes === 'function' && process.features.typescript ? 0 : 1)"
+ "process.exit(typeof require('node:module').registerHooks === 'function' ? 0 : 1)"
]).status === 0
function importUnderNode(register: boolean) {
@@ -18,7 +18,10 @@ function importUnderNode(register: boolean) {
const dependency = join(root, 'node_modules', 'typed-dependency')
mkdirSync(dependency, { recursive: true })
writeFileSync(join(dependency, 'package.json'), '{"type":"module","exports":"./index.ts"}')
- writeFileSync(join(dependency, 'index.ts'), 'export const value: number = 42\n')
+ writeFileSync(
+ join(dependency, 'index.ts'),
+ 'class Box { constructor(readonly value: number) {} }\nexport const { value } = new Box(42)\n'
+ )
const script = [
register
? `const { loadTypeScriptDependencies } = await import(${JSON.stringify(hook)})`