Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Typed provider errors: stop regex-matching error text in core (#2068)

Regan Bell1b2d07e99bc4
diff --git a/package-lock.json b/package-lock.json
index 6683c716f..bff12bb78 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,8 +18,8 @@
"@aws-sdk/client-sts": "^3.1075.0",
"@aws-sdk/credential-provider-node": "^3.972.70",
"@aws-sdk/s3-request-presigner": "^3.1061.0",
- "@earendil-works/pi-ai": "0.82.0",
- "@earendil-works/pi-coding-agent": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.5/earendil-works-pi-coding-agent-0.82.0-qm-security.5.tgz",
+ "@earendil-works/pi-ai": "https://github.com/yc-software/qm/releases/download/vendored-pi-ai-0.82.0-qm.1/earendil-works-pi-ai-0.82.0-qm.1.tgz",
+ "@earendil-works/pi-coding-agent": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.6/earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz",
"@fly/sprites": "0.2.3",
"@openai/codex": "0.156.1",
"@opencode-ai/plugin": "1.18.31",
@@ -54,6 +54,7 @@
"@types/pg": "^8.11.10",
"@types/tar-stream": "^3.1.4",
"@yc-software/qm": "file:./cli",
+ "devbar.sh": "1.1.0",
"esbuild": "0.28.1",
"eslint": "^10.4.1",
"globals": "^17.6.0",
@@ -63,8 +64,7 @@
"oxlint": "^1.74.0",
"prettier": "3.9.1",
"typescript": "^5.8.2",
- "typescript-eslint": "^8.61.0",
- "devbar.sh": "1.1.0"
+ "typescript-eslint": "^8.61.0"
},
"engines": {
"node": ">=24.15.0",
@@ -944,8 +944,8 @@
},
"node_modules/@earendil-works/pi-ai": {
"version": "0.82.0",
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.82.0.tgz",
- "integrity": "sha512-8MvW9+zno13sXDuT2kFMnWeTNUufUhPeZDRVO+igGoBRCDWgn7Xh2FkRQI1mRuet6QhF4ENQuLYdIAOyG6BhNw==",
+ "resolved": "https://github.com/yc-software/qm/releases/download/vendored-pi-ai-0.82.0-qm.1/earendil-works-pi-ai-0.82.0-qm.1.tgz",
+ "integrity": "sha512-VT+6Nyyb702PjYM4K/31eUaWyr9HQTMi1ysldrQoT7Nm6qNPT4uh0P7skNtKIAJ+XF8WNKSIKpADwdxEna7Cbg==",
"license": "MIT",
"dependencies": {
"@anthropic-ai/sdk": "0.91.1",
@@ -1009,9 +1009,8 @@
},
"node_modules/@earendil-works/pi-coding-agent": {
"version": "0.82.0",
- "resolved": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.5/earendil-works-pi-coding-agent-0.82.0-qm-security.5.tgz",
- "integrity": "sha512-8aI19QEosokMfkYWCkAv2mqKK94yXF+ftZ43Z2nfsRzwA1uVBwiNIZXd3Ydn902YCoKX17nKqhVddmhyi6ZZYQ==",
- "hasShrinkwrap": true,
+ "resolved": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.6/earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz",
+ "integrity": "sha512-daMBZR+s0cxaEnbzJrx5q+btIu/jExgSWdBuEuzdqdrT5VQuGoPgqRx2ttTgHjYCK5ImIHSHo9ssOsI8FQLJ7A==",
"license": "MIT",
"dependencies": {
"@earendil-works/pi-agent-core": "^0.82.0",
@@ -1043,1538 +1042,264 @@
"@mariozechner/clipboard": "0.3.9"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@anthropic-ai/sdk": {
- "version": "0.91.1",
- "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.91.1.tgz",
- "integrity": "sha512-LAmu761tSN9r66ixvmciswUj/ZC+1Q4iAfpedTfSVLeswRwnY3n2Nb6Tsk+cLPP28aLOPWeMgIuTuCcMC6W/iw==",
- "license": "MIT",
- "dependencies": {
- "json-schema-to-ts": "^3.1.1"
- },
- "bin": {
- "anthropic-ai-sdk": "bin/cli"
- },
- "peerDependencies": {
- "zod": "^3.25.0 || ^4.0.0"
- },
- "peerDependenciesMeta": {
- "zod": {
- "optional": true
- }
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-crypto/crc32": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz",
- "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/util": "^5.2.0",
- "@aws-sdk/types": "^3.222.0",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=16.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-crypto/sha256-browser": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz",
- "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/sha256-js": "^5.2.0",
- "@aws-crypto/supports-web-crypto": "^5.2.0",
- "@aws-crypto/util": "^5.2.0",
- "@aws-sdk/types": "^3.222.0",
- "@aws-sdk/util-locate-window": "^3.0.0",
- "@smithy/util-utf8": "^2.0.0",
- "tslib": "^2.6.2"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-crypto/sha256-js": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz",
- "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/util": "^5.2.0",
- "@aws-sdk/types": "^3.222.0",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=16.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-crypto/supports-web-crypto": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz",
- "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==",
- "license": "Apache-2.0",
- "dependencies": {
- "tslib": "^2.6.2"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-crypto/util": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz",
- "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/types": "^3.222.0",
- "@smithy/util-utf8": "^2.0.0",
- "tslib": "^2.6.2"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/client-bedrock-runtime": {
- "version": "3.1048.0",
- "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.1048.0.tgz",
- "integrity": "sha512-u+NT61JZEkRFtpL0CAw1N1dwxnaLgwVXQl/zjJxTGgLyS/jTIdg2SdoEoCTHxgDyCnqa1HEi9QOoE9/pYRNpOQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/sha256-browser": "5.2.0",
- "@aws-crypto/sha256-js": "5.2.0",
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/credential-provider-node": "^3.972.42",
- "@aws-sdk/eventstream-handler-node": "^3.972.16",
- "@aws-sdk/middleware-eventstream": "^3.972.12",
- "@aws-sdk/middleware-websocket": "^3.972.19",
- "@aws-sdk/token-providers": "3.1048.0",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/fetch-http-handler": "^5.4.2",
- "@smithy/node-http-handler": "^4.7.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/core": {
- "version": "3.974.11",
- "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.974.11.tgz",
- "integrity": "sha512-QpnINq5FZH6EOaDEkmHdT7eUunbvD27pDNQypaWjFyYz7Zl1q3UCMQErBZxpmfGfI7MvI2TlK8KTkgNpv8b1ug==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/types": "^3.973.8",
- "@aws-sdk/xml-builder": "^3.972.24",
- "@aws/lambda-invoke-store": "^0.2.2",
- "@smithy/core": "^3.24.2",
- "@smithy/signature-v4": "^5.4.2",
- "@smithy/types": "^4.14.1",
- "bowser": "^2.11.0",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-env": {
- "version": "3.972.37",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.972.37.tgz",
- "integrity": "sha512-/jpPvEh6f7ntmIzf7dNxoNX6Q8vt8UpesCjbW6mFfk4V1NW6bIy9qxcQ6WbA8As5yQhsZOe+xeNd4xHX8kdY2Q==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-http": {
- "version": "3.972.39",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.972.39.tgz",
- "integrity": "sha512-pIgTpisWyWg7X1bUbzSjuUYosYTD0Ghz2M0hkSTmb3a6i3qV3uU+NYJPI/E2XSC0HcsZh5rsLPzeXrkb2DS0Cg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/fetch-http-handler": "^5.4.2",
- "@smithy/node-http-handler": "^4.7.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-ini": {
- "version": "3.972.41",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.972.41.tgz",
- "integrity": "sha512-u2tyjaxJJzW8UtW4SM1ZcPMDwO6y+kV+llvou+Adts0FAKyzes5jG4izQN+KX3yE8ZROpS5y1LJ//xL2iSf76w==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/credential-provider-env": "^3.972.37",
- "@aws-sdk/credential-provider-http": "^3.972.39",
- "@aws-sdk/credential-provider-login": "^3.972.41",
- "@aws-sdk/credential-provider-process": "^3.972.37",
- "@aws-sdk/credential-provider-sso": "^3.972.41",
- "@aws-sdk/credential-provider-web-identity": "^3.972.41",
- "@aws-sdk/nested-clients": "^3.997.9",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/credential-provider-imds": "^4.3.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-login": {
- "version": "3.972.41",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-login/-/credential-provider-login-3.972.41.tgz",
- "integrity": "sha512-0LBitxXiAiaE5nlFPfpNIww/8FRY/I7WIndWsc9GmNFOM7cE1wNpVNQEGEk9Outg5l8xl+3vybxFyUy4l9q/LQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/nested-clients": "^3.997.9",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-node": {
- "version": "3.972.42",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.972.42.tgz",
- "integrity": "sha512-D4oon2zbqqsWOJUM99Gm3/ZyJ0IJvTXVN3PyloGb3kQEyI36fjCZheZj422lAgTWWd6TSHgiImLt3RIaLdv3dQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/credential-provider-env": "^3.972.37",
- "@aws-sdk/credential-provider-http": "^3.972.39",
- "@aws-sdk/credential-provider-ini": "^3.972.41",
- "@aws-sdk/credential-provider-process": "^3.972.37",
- "@aws-sdk/credential-provider-sso": "^3.972.41",
- "@aws-sdk/credential-provider-web-identity": "^3.972.41",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/credential-provider-imds": "^4.3.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-process": {
- "version": "3.972.37",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.972.37.tgz",
- "integrity": "sha512-7nVaHBUaWIddASYfVaA9O4D5ZVjewU3sCol9WqZPGfW0nR+0WqE0xHZnD/U2L33PlOB8KNXGKZ6wOES/QijKzg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-sso": {
- "version": "3.972.41",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.972.41.tgz",
- "integrity": "sha512-IOWAWEHe5LkjSKkkUUX9ciV6Y1scHTsnfEkdt5yyC4Slrc7AGbkLPrpntjqh18ksJAMOaVhoBsO8p2WyTcY2wQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/nested-clients": "^3.997.9",
- "@aws-sdk/token-providers": "3.1048.0",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/credential-provider-web-identity": {
- "version": "3.972.41",
- "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.972.41.tgz",
- "integrity": "sha512-mbACk9Yypa8nm4iGZLs0PofOXEcTDOUw6wDnsPXNDNSd2WNXs1tSo+6nc/fh0jLYdfVZThhBL98PHW4aXFsG5A==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/nested-clients": "^3.997.9",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/eventstream-handler-node": {
- "version": "3.972.16",
- "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.972.16.tgz",
- "integrity": "sha512-yedpPgKftqjU5SlPFHfqWpOw6xSCRieWRG1euWOlXn4WJxt2VX92VprCa2PpSOXjVCAeK6dTjW9eJRXVig9yGA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/middleware-eventstream": {
- "version": "3.972.12",
- "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-eventstream/-/middleware-eventstream-3.972.12.tgz",
- "integrity": "sha512-tHTHHCHNrq6XklQvlzHBDJG4Iuhh7NVPRdtmvP+nHFA+5sxPlIDzlAHHgfoYHGvT3NXP1yVP/L5c3opUn6T3Qg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/middleware-websocket": {
- "version": "3.972.19",
- "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.972.19.tgz",
- "integrity": "sha512-mkEhOGYozqKQkbFaVrjwr0faiwwZza1v5/jSY6Tucm3bD+uKTazIUH/4Yo6aMnQD2ua2W9cMP6s8mvwTcjtqHw==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/fetch-http-handler": "^5.4.2",
- "@smithy/signature-v4": "^5.4.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">= 14.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/nested-clients": {
- "version": "3.997.9",
- "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.9.tgz",
- "integrity": "sha512-jPR3rnmRI4hWYyzfmTGBr7NblMp8QYYeflHXba1H6+7CGrWVqWKQzaXFQ4qbExqPRsXN3T3L3JxFhr6aouXUGQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/sha256-browser": "5.2.0",
- "@aws-crypto/sha256-js": "5.2.0",
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/signature-v4-multi-region": "^3.996.27",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/fetch-http-handler": "^5.4.2",
- "@smithy/node-http-handler": "^4.7.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/signature-v4-multi-region": {
- "version": "3.996.27",
- "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.996.27.tgz",
- "integrity": "sha512-0Phbz4t6HI3D3skxvG2uI+VWU034/nSIw1T8d+FPzzQG9EQTrw94o9mOKO2Gv3n3Oc8P7JD7RAUxkoneLWv5Eg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/signature-v4": "^5.4.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/token-providers": {
- "version": "3.1048.0",
- "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.1048.0.tgz",
- "integrity": "sha512-k0y/GcuesuSfWyUM0WamrGyeZmltRYaPbHO82UDA6mZ/doB+FOHKutikPAtSXMn/hDz970cF+iRuuiYO9VEbAA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-sdk/core": "^3.974.11",
- "@aws-sdk/nested-clients": "^3.997.9",
- "@aws-sdk/types": "^3.973.8",
- "@smithy/core": "^3.24.2",
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/types": {
- "version": "3.973.8",
- "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.973.8.tgz",
- "integrity": "sha512-gjlAdtHMbtR9X5iIhVUvbVcy55KnznpC6bkDUWW9z915bi0ckdUr5cjf16Kp6xq0bP5HBD2xzgbL9F9Quv5vUw==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/types": "^4.14.1",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/util-locate-window": {
- "version": "3.965.5",
- "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.965.5.tgz",
- "integrity": "sha512-WhlJNNINQB+9qtLtZJcpQdgZw3SCDCpXdUJP7cToGwHbCWCnRckGlc6Bx/OhWwIYFNAn+FIydY8SZ0QmVu3xTQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws-sdk/xml-builder": {
- "version": "3.972.24",
- "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.972.24.tgz",
- "integrity": "sha512-V8z5YcDPfsvzrBlj0xR1vhRtocblhYbqdreCJB/voGd4Sr5zjNAeWxexbnqVtskTJe0vFb5KMqbSL++ePl+zRw==",
- "license": "Apache-2.0",
- "dependencies": {
- "@nodable/entities": "2.1.0",
- "@smithy/types": "^4.14.1",
- "fast-xml-parser": "5.7.3",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=20.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@aws/lambda-invoke-store": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/@aws/lambda-invoke-store/-/lambda-invoke-store-0.2.4.tgz",
- "integrity": "sha512-iY8yvjE0y651BixKNPgmv1WrQc+GZ142sb0z4gYnChDDY2YqI4P/jsSopBWrKfAt7LOJAkOXt7rC/hms+WclQQ==",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@babel/runtime": {
- "version": "7.29.2",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
- "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-agent-core": {
- "version": "0.82.0",
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.82.0.tgz",
- "license": "MIT",
- "dependencies": {
- "@earendil-works/pi-ai": "^0.82.0",
- "diff": "8.0.4",
- "ignore": "7.0.5",
- "typebox": "1.1.38",
- "yaml": "2.9.0"
- },
- "engines": {
- "node": ">=22.19.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-ai": {
- "version": "0.82.0",
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.82.0.tgz",
- "license": "MIT",
- "dependencies": {
- "@anthropic-ai/sdk": "0.91.1",
- "@aws-sdk/client-bedrock-runtime": "3.1048.0",
- "@google/genai": "1.52.0",
- "@mistralai/mistralai": "2.2.6",
- "@opentelemetry/api": "1.9.0",
- "@smithy/node-http-handler": "4.7.3",
- "http-proxy-agent": "7.0.2",
- "https-proxy-agent": "7.0.6",
- "openai": "6.26.0",
- "partial-json": "0.1.7",
- "typebox": "1.1.38"
- },
- "bin": {
- "pi-ai": "dist/cli.js"
- },
- "engines": {
- "node": ">=22.19.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-tui": {
- "version": "0.82.0",
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.82.0.tgz",
- "license": "MIT",
- "dependencies": {
- "get-east-asian-width": "1.6.0",
- "marked": "18.0.5"
- },
- "engines": {
- "node": ">=22.19.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@google/genai": {
- "version": "1.52.0",
- "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.52.0.tgz",
- "integrity": "sha512-gwSvbpiN/17O9TbsqSsE/OzZcpv5Fo4RQjdngGgogtuB9RsyJ8ZHhX5KjHj1bp5N9snN2eK8LDGXSaWW2hof8Q==",
- "hasInstallScript": true,
- "license": "Apache-2.0",
- "dependencies": {
- "google-auth-library": "^10.3.0",
- "p-retry": "^4.6.2",
- "protobufjs": "^7.5.4",
- "ws": "^8.18.0"
- },
- "engines": {
- "node": ">=20.0.0"
- },
- "peerDependencies": {
- "@modelcontextprotocol/sdk": "^1.25.2"
- },
- "peerDependenciesMeta": {
- "@modelcontextprotocol/sdk": {
- "optional": true
- }
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard/-/clipboard-0.3.9.tgz",
- "integrity": "sha512-ABnA53mdfkGZwOFUdZNv2S0CWGO/EIuPj8Vv9xmBFmSYg/qFc7ihO6q5FcQjvoE67kZpWkEc4AhD6B/os04yuA==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">= 10"
- },
- "optionalDependencies": {
- "@mariozechner/clipboard-darwin-arm64": "0.3.9",
- "@mariozechner/clipboard-darwin-universal": "0.3.9",
- "@mariozechner/clipboard-darwin-x64": "0.3.9",
- "@mariozechner/clipboard-linux-arm64-gnu": "0.3.9",
- "@mariozechner/clipboard-linux-arm64-musl": "0.3.9",
- "@mariozechner/clipboard-linux-riscv64-gnu": "0.3.9",
- "@mariozechner/clipboard-linux-x64-gnu": "0.3.9",
- "@mariozechner/clipboard-linux-x64-musl": "0.3.9",
- "@mariozechner/clipboard-win32-arm64-msvc": "0.3.9",
- "@mariozechner/clipboard-win32-x64-msvc": "0.3.9"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-arm64": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-arm64/-/clipboard-darwin-arm64-0.3.9.tgz",
- "integrity": "sha512-BfgV7vCEWZwJwZJw03r6bP5+tf0iI/ANuQYCxi9RNn7FrWB3yzGuMKCrNLRl6V761vXRdL8+OqZ0wd4TqlsNOQ==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-universal": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-universal/-/clipboard-darwin-universal-0.3.9.tgz",
- "integrity": "sha512-BGGR4iA9Z2shAjI65eI5xtyb3LYNlDW9X3gxKxDbqtbnREohsrqznov6zpKoIrsRWpzlYVEdKphS7ksJ0/ndSQ==",
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-x64": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-x64/-/clipboard-darwin-x64-0.3.9.tgz",
- "integrity": "sha512-4kURmCbS6nt8uYhtmWpUcJWyPHfmAr5dTpXD1nO3pIfa+TSQ9DbrGOYCKH+aEFW47XhQ4Vp8ZTszie+wfFvDKg==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-arm64-gnu": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-arm64-gnu/-/clipboard-linux-arm64-gnu-0.3.9.tgz",
- "integrity": "sha512-g59OkUGP2DDfCOIKypHeYgv2M55u/cKvXa5dSxFbEJ34XvIQMdcVmpKCkGUro3ZgefXiGVdwguvTMQGpHWzIXw==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-arm64-musl": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-arm64-musl/-/clipboard-linux-arm64-musl-0.3.9.tgz",
- "integrity": "sha512-AGuJdgKsmJdm4Pych7kv3sqe591ERRaAHW3xjLooiFzn8J+PxUyof++7YZrB5Y5tpnTO+K18Og3taj2NpluCRQ==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-riscv64-gnu": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-riscv64-gnu/-/clipboard-linux-riscv64-gnu-0.3.9.tgz",
- "integrity": "sha512-DXBEAiuMpk7dhS1a9NzNxVAFi1vaKoPu7rQNgY8LIDLGrK3lnIp3nT10DUum+PKVJoJppIP+NAA8IZe4DMNDPw==",
- "cpu": [
- "riscv64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-x64-gnu": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-x64-gnu/-/clipboard-linux-x64-gnu-0.3.9.tgz",
- "integrity": "sha512-WORrMLd6EpElEME7JRKfSaY34nW1P5LbdgK5YNCS1ncG2LqmITsSMEJ8nh2mpvxb3TxqbOOKgY7k9eMJYlW9Mw==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-x64-musl": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-x64-musl/-/clipboard-linux-x64-musl-0.3.9.tgz",
- "integrity": "sha512-/DHn+1DrfL6oRaPPWXaOKvonFFrni666fxd+zFqiQEfvBH0tsHVWjq9iqBk0oDp0qaPA72lIMy5BptxISBEhZQ==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-win32-arm64-msvc": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-win32-arm64-msvc/-/clipboard-win32-arm64-msvc-0.3.9.tgz",
- "integrity": "sha512-O5FHD3ErkMwMhNzAfu3ggy0ug4z7btZuoQgwwxlzPrwV2bxlD6WDpqBY4NCgICAgZdDKdp+loUEKVAVt8aYnhQ==",
- "cpu": [
- "arm64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-win32-x64-msvc": {
- "version": "0.3.9",
- "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-win32-x64-msvc/-/clipboard-win32-x64-msvc-0.3.9.tgz",
- "integrity": "sha512-ihQC3EufqEY81vhXBgVBtK4prL+wc62zJsSvxrgz7K1hsdt6OObz6v9p3Rn1OG3GJksTTKMJF0u/guMISHPhSA==",
- "cpu": [
- "x64"
- ],
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@mistralai/mistralai": {
- "version": "2.2.6",
- "resolved": "https://registry.npmjs.org/@mistralai/mistralai/-/mistralai-2.2.6.tgz",
- "integrity": "sha512-W8pX7zHxjJvMIpw8JMxeJEleapXX0Q9NPszdNzqkM3MIEoIGPObdodujj+WHteXEvGfaP/AMwlNyRfEzSY6dQQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@opentelemetry/semantic-conventions": "^1.40.0",
- "ws": "^8.18.0",
- "zod": "^3.25.0 || ^4.0.0",
- "zod-to-json-schema": "^3.25.0"
- },
- "peerDependencies": {
- "@opentelemetry/api": "^1.9.0"
- },
- "peerDependenciesMeta": {
- "@opentelemetry/api": {
- "optional": true
- }
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@nodable/entities": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz",
- "integrity": "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/nodable"
- }
- ],
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@opentelemetry/api": {
- "version": "1.9.0",
- "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
- "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@opentelemetry/semantic-conventions": {
- "version": "1.41.1",
- "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.41.1.tgz",
- "integrity": "sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA==",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=14"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/aspromise": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
- "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/base64": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
- "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/codegen": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz",
- "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/eventemitter": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz",
- "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/fetch": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz",
- "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==",
- "license": "BSD-3-Clause",
- "dependencies": {
- "@protobufjs/aspromise": "^1.1.1"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/float": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
- "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/path": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
- "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/pool": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
- "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@protobufjs/utf8": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz",
- "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@silvia-odwyer/photon-node": {
- "version": "0.3.4",
- "resolved": "https://registry.npmjs.org/@silvia-odwyer/photon-node/-/photon-node-0.3.4.tgz",
- "integrity": "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA==",
- "license": "Apache-2.0"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/core": {
- "version": "3.24.3",
- "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.24.3.tgz",
- "integrity": "sha512-Ep/7tPamGY8mgESE3LyLKtxJyy6U52WWAqr/3wial47Sj4u3PiIF73AOGI27UyLy9duTkhZbgzodOfLV4TduZg==",
- "license": "Apache-2.0",
- "dependencies": {
- "@aws-crypto/crc32": "5.2.0",
- "@smithy/types": "^4.14.2",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/credential-provider-imds": {
- "version": "4.3.3",
- "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.3.3.tgz",
- "integrity": "sha512-I2Bti0DKFo2IJyN28ijCsx51BAumEYR4/1yZ1FXyBygy9MqbnMqCev4JPth/MbpRfBSRAX35hITSnAdJRo1u5w==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/core": "^3.24.3",
- "@smithy/types": "^4.14.2",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/fetch-http-handler": {
- "version": "5.4.3",
- "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.4.3.tgz",
- "integrity": "sha512-F+DRf8IJazRJgYog2A/yJK7eYVc0rqTlRzO+5ZxjJd4WkZoKz0IJRncf7G6t1pdVT3kryJcwuTFhN1c5m6N47A==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/core": "^3.24.3",
- "@smithy/types": "^4.14.2",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/is-array-buffer": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz",
- "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==",
- "license": "Apache-2.0",
- "dependencies": {
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=14.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/node-http-handler": {
- "version": "4.7.3",
- "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.7.3.tgz",
- "integrity": "sha512-/jPhevcTFPMVl6KNjbaI47iOg1zxC7IsnX4PQDGVZKMFceOXtB8IEYaB7a9VvkP/3oC60WzTeKocvSI7vLT0vA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/core": "^3.24.3",
- "@smithy/types": "^4.14.2",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/signature-v4": {
- "version": "5.4.3",
- "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.4.3.tgz",
- "integrity": "sha512-53+75QuPl6DL+ct6vVEB51FDO5oulXr20TPV46VvJZg76lIlXNWfxi8j+G2V/t0I2qxCBOa3vX/8bmjrpFVo9g==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/core": "^3.24.3",
- "@smithy/types": "^4.14.2",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/types": {
- "version": "4.14.2",
- "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.14.2.tgz",
- "integrity": "sha512-P+otAxbV4CqBybp7EkcJCrig63yE2E7PuNVOmilVMRcx/O+QDzGULTrKsq4DV13gSfak9ObPrWaHl/9bL5YcWw==",
- "license": "Apache-2.0",
- "dependencies": {
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/util-buffer-from": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz",
- "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/is-array-buffer": "^2.2.0",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=14.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@smithy/util-utf8": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz",
- "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==",
- "license": "Apache-2.0",
- "dependencies": {
- "@smithy/util-buffer-from": "^2.2.0",
- "tslib": "^2.6.2"
- },
- "engines": {
- "node": ">=14.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/@types/node": {
- "version": "22.19.19",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.19.tgz",
- "integrity": "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==",
- "license": "MIT",
- "dependencies": {
- "undici-types": "~6.21.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/agent-base": {
- "version": "7.1.4",
- "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
- "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
- "license": "MIT",
- "engines": {
- "node": ">= 14"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/balanced-match": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
- "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
- "license": "MIT",
- "engines": {
- "node": "18 || 20 || >=22"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/base64-js": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
- "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/bignumber.js": {
- "version": "9.3.1",
- "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz",
- "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==",
- "license": "MIT",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/bowser": {
- "version": "2.14.1",
- "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.14.1.tgz",
- "integrity": "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/brace-expansion": {
- "version": "5.0.12",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
- "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
- "license": "MIT",
- "dependencies": {
- "balanced-match": "^4.0.2"
- },
- "engines": {
- "node": "20 || >=22"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/buffer-equal-constant-time": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
- "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/chalk": {
- "version": "5.6.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
- "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
- "license": "MIT",
- "engines": {
- "node": "^12.17.0 || ^14.13 || >=16.0.0"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/cross-spawn": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
- "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
- "license": "MIT",
- "dependencies": {
- "path-key": "^3.1.0",
- "shebang-command": "^2.0.0",
- "which": "^2.0.1"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/data-uri-to-buffer": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
- "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
- "license": "MIT",
- "engines": {
- "node": ">= 12"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/debug": {
- "version": "4.4.3",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
- "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
- "license": "MIT",
- "dependencies": {
- "ms": "^2.1.3"
- },
- "engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/diff": {
- "version": "8.0.4",
- "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz",
- "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==",
- "license": "BSD-3-Clause",
- "engines": {
- "node": ">=0.3.1"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/ecdsa-sig-formatter": {
- "version": "1.0.11",
- "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
- "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "safe-buffer": "^5.0.1"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/extend": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
- "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/fast-xml-builder": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.2.0.tgz",
- "integrity": "sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/NaturalIntelligence"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "path-expression-matcher": "^1.5.0",
- "xml-naming": "^0.1.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/fast-xml-parser": {
- "version": "5.7.3",
- "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.7.3.tgz",
- "integrity": "sha512-C0AaNuC+mscy6vrAQKAc/rMq+zAPHodfHGZu4sGVehvAQt/JLG1O5zEcYcXSY5zSqr4YVgxsB+pHXTq0i7eDlg==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/NaturalIntelligence"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "@nodable/entities": "^2.1.0",
- "fast-xml-builder": "^1.1.7",
- "path-expression-matcher": "^1.5.0",
- "strnum": "^2.2.3"
- },
- "bin": {
- "fxparser": "src/cli/cli.js"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/fetch-blob": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
- "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/jimmywarting"
- },
- {
- "type": "paypal",
- "url": "https://paypal.me/jimmywarting"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "node-domexception": "^1.0.0",
- "web-streams-polyfill": "^3.0.3"
- },
- "engines": {
- "node": "^12.20 || >= 14.13"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/formdata-polyfill": {
- "version": "4.0.10",
- "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
- "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
- "license": "MIT",
- "dependencies": {
- "fetch-blob": "^3.1.2"
- },
- "engines": {
- "node": ">=12.20.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/gaxios": {
- "version": "7.1.4",
- "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.4.tgz",
- "integrity": "sha512-bTIgTsM2bWn3XklZISBTQX7ZSddGW+IO3bMdGaemHZ3tbqExMENHLx6kKZ/KlejgrMtj8q7wBItt51yegqalrA==",
- "license": "Apache-2.0",
- "dependencies": {
- "extend": "^3.0.2",
- "https-proxy-agent": "^7.0.1",
- "node-fetch": "^3.3.2"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/gcp-metadata": {
- "version": "8.1.2",
- "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-8.1.2.tgz",
- "integrity": "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==",
- "license": "Apache-2.0",
- "dependencies": {
- "gaxios": "^7.0.0",
- "google-logging-utils": "^1.0.0",
- "json-bigint": "^1.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/get-east-asian-width": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
- "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/glob": {
- "version": "13.0.6",
- "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
- "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "minimatch": "^10.2.2",
- "minipass": "^7.1.3",
- "path-scurry": "^2.0.2"
- },
- "engines": {
- "node": "18 || 20 || >=22"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/google-auth-library": {
- "version": "10.6.2",
- "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.6.2.tgz",
- "integrity": "sha512-e27Z6EThmVNNvtYASwQxose/G57rkRuaRbQyxM2bvYLLX/GqWZ5chWq2EBoUchJbCc57eC9ArzO5wMsEmWftCw==",
- "license": "Apache-2.0",
- "dependencies": {
- "base64-js": "^1.3.0",
- "ecdsa-sig-formatter": "^1.0.11",
- "gaxios": "^7.1.4",
- "gcp-metadata": "8.1.2",
- "google-logging-utils": "1.1.3",
- "jws": "^4.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/google-logging-utils": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.3.tgz",
- "integrity": "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA==",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=14"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/graceful-fs": {
- "version": "4.2.11",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
- "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
- "license": "ISC"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/highlight.js": {
- "version": "10.7.3",
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
- "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
- "license": "BSD-3-Clause",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/hosted-git-info": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.3.tgz",
- "integrity": "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg==",
- "license": "ISC",
- "dependencies": {
- "lru-cache": "^11.1.0"
- },
- "engines": {
- "node": "^20.17.0 || >=22.9.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/http-proxy-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
- "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
- "license": "MIT",
- "dependencies": {
- "agent-base": "^7.1.0",
- "debug": "^4.3.4"
- },
- "engines": {
- "node": ">= 14"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/https-proxy-agent": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
- "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-agent-core": {
+ "version": "0.82.0",
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.82.0.tgz",
"license": "MIT",
"dependencies": {
- "agent-base": "^7.1.2",
- "debug": "4"
+ "@earendil-works/pi-ai": "^0.82.0",
+ "diff": "8.0.4",
+ "ignore": "7.0.5",
+ "typebox": "1.1.38",
+ "yaml": "2.9.0"
},
"engines": {
- "node": ">= 14"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/ignore": {
- "version": "7.0.5",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
- "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
- "license": "MIT",
- "engines": {
- "node": ">= 4"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/isexe": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
- "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
- "license": "ISC"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/jiti": {
- "version": "2.7.0",
- "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
- "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
- "license": "MIT",
- "bin": {
- "jiti": "lib/jiti-cli.mjs"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/json-bigint": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
- "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
- "license": "MIT",
- "dependencies": {
- "bignumber.js": "^9.0.0"
+ "node": ">=22.19.0"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/json-schema-to-ts": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz",
- "integrity": "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@earendil-works/pi-tui": {
+ "version": "0.82.0",
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.82.0.tgz",
"license": "MIT",
- "dependencies": {
- "@babel/runtime": "^7.18.3",
- "ts-algebra": "^2.0.0"
+ "dependencies": {
+ "get-east-asian-width": "1.6.0",
+ "marked": "18.0.5"
},
"engines": {
- "node": ">=16"
+ "node": ">=22.19.0"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/jwa": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
- "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard/-/clipboard-0.3.9.tgz",
+ "integrity": "sha512-ABnA53mdfkGZwOFUdZNv2S0CWGO/EIuPj8Vv9xmBFmSYg/qFc7ihO6q5FcQjvoE67kZpWkEc4AhD6B/os04yuA==",
"license": "MIT",
- "dependencies": {
- "buffer-equal-constant-time": "^1.0.1",
- "ecdsa-sig-formatter": "1.0.11",
- "safe-buffer": "^5.0.1"
+ "optional": true,
+ "engines": {
+ "node": ">= 10"
+ },
+ "optionalDependencies": {
+ "@mariozechner/clipboard-darwin-arm64": "0.3.9",
+ "@mariozechner/clipboard-darwin-universal": "0.3.9",
+ "@mariozechner/clipboard-darwin-x64": "0.3.9",
+ "@mariozechner/clipboard-linux-arm64-gnu": "0.3.9",
+ "@mariozechner/clipboard-linux-arm64-musl": "0.3.9",
+ "@mariozechner/clipboard-linux-riscv64-gnu": "0.3.9",
+ "@mariozechner/clipboard-linux-x64-gnu": "0.3.9",
+ "@mariozechner/clipboard-linux-x64-musl": "0.3.9",
+ "@mariozechner/clipboard-win32-arm64-msvc": "0.3.9",
+ "@mariozechner/clipboard-win32-x64-msvc": "0.3.9"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/jws": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
- "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-arm64": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-arm64/-/clipboard-darwin-arm64-0.3.9.tgz",
+ "integrity": "sha512-BfgV7vCEWZwJwZJw03r6bP5+tf0iI/ANuQYCxi9RNn7FrWB3yzGuMKCrNLRl6V761vXRdL8+OqZ0wd4TqlsNOQ==",
+ "cpu": [
+ "arm64"
+ ],
"license": "MIT",
- "dependencies": {
- "jwa": "^2.0.1",
- "safe-buffer": "^5.0.1"
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/long": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
- "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
- "license": "Apache-2.0"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/lru-cache": {
- "version": "11.4.0",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.4.0.tgz",
- "integrity": "sha512-W+R+kFL4HgVxONq2bhXPi3bGpzGe/yEhVOp233qw9wCRtgncJ15P3bC+e4zZMu4Cq7d+WAJjXGW0uUkifhcatA==",
- "license": "BlueOak-1.0.0",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-universal": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-universal/-/clipboard-darwin-universal-0.3.9.tgz",
+ "integrity": "sha512-BGGR4iA9Z2shAjI65eI5xtyb3LYNlDW9X3gxKxDbqtbnREohsrqznov6zpKoIrsRWpzlYVEdKphS7ksJ0/ndSQ==",
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
"engines": {
- "node": "20 || >=22"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/marked": {
- "version": "18.0.5",
- "resolved": "https://registry.npmjs.org/marked/-/marked-18.0.5.tgz",
- "integrity": "sha512-S6GcvALHg6K4ohtu4E7x0a1AqhAjp6cV8KhLSyN9qVapnzJkusVBxZRcIU9AeYsbe6P1hKDusSbEOzGyyuce6w==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-darwin-x64": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-darwin-x64/-/clipboard-darwin-x64-0.3.9.tgz",
+ "integrity": "sha512-4kURmCbS6nt8uYhtmWpUcJWyPHfmAr5dTpXD1nO3pIfa+TSQ9DbrGOYCKH+aEFW47XhQ4Vp8ZTszie+wfFvDKg==",
+ "cpu": [
+ "x64"
+ ],
"license": "MIT",
- "bin": {
- "marked": "bin/marked.js"
- },
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
"engines": {
- "node": ">= 20"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/minimatch": {
- "version": "10.2.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
- "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "brace-expansion": "^5.0.5"
- },
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-arm64-gnu": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-arm64-gnu/-/clipboard-linux-arm64-gnu-0.3.9.tgz",
+ "integrity": "sha512-g59OkUGP2DDfCOIKypHeYgv2M55u/cKvXa5dSxFbEJ34XvIQMdcVmpKCkGUro3ZgefXiGVdwguvTMQGpHWzIXw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
"engines": {
- "node": "18 || 20 || >=22"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/minipass": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
- "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
- "license": "BlueOak-1.0.0",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-arm64-musl": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-arm64-musl/-/clipboard-linux-arm64-musl-0.3.9.tgz",
+ "integrity": "sha512-AGuJdgKsmJdm4Pych7kv3sqe591ERRaAHW3xjLooiFzn8J+PxUyof++7YZrB5Y5tpnTO+K18Og3taj2NpluCRQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
"engines": {
- "node": ">=16 || 14 >=14.17"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/node-domexception": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
- "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
- "deprecated": "Use your platform's native DOMException instead",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/jimmywarting"
- },
- {
- "type": "github",
- "url": "https://paypal.me/jimmywarting"
- }
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-riscv64-gnu": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-riscv64-gnu/-/clipboard-linux-riscv64-gnu-0.3.9.tgz",
+ "integrity": "sha512-DXBEAiuMpk7dhS1a9NzNxVAFi1vaKoPu7rQNgY8LIDLGrK3lnIp3nT10DUum+PKVJoJppIP+NAA8IZe4DMNDPw==",
+ "cpu": [
+ "riscv64"
],
"license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
"engines": {
- "node": ">=10.5.0"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/node-fetch": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
- "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-x64-gnu": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-x64-gnu/-/clipboard-linux-x64-gnu-0.3.9.tgz",
+ "integrity": "sha512-WORrMLd6EpElEME7JRKfSaY34nW1P5LbdgK5YNCS1ncG2LqmITsSMEJ8nh2mpvxb3TxqbOOKgY7k9eMJYlW9Mw==",
+ "cpu": [
+ "x64"
+ ],
"license": "MIT",
- "dependencies": {
- "data-uri-to-buffer": "^4.0.0",
- "fetch-blob": "^3.1.4",
- "formdata-polyfill": "^4.0.10"
- },
+ "optional": true,
+ "os": [
+ "linux"
+ ],
"engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/node-fetch"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/openai": {
- "version": "6.26.0",
- "resolved": "https://registry.npmjs.org/openai/-/openai-6.26.0.tgz",
- "integrity": "sha512-zd23dbWTjiJ6sSAX6s0HrCZi41JwTA1bQVs0wLQPZ2/5o2gxOJA5wh7yOAUgwYybfhDXyhwlpeQf7Mlgx8EOCA==",
- "license": "Apache-2.0",
- "bin": {
- "openai": "bin/cli"
- },
- "peerDependencies": {
- "ws": "^8.18.0",
- "zod": "^3.25 || ^4.0"
- },
- "peerDependenciesMeta": {
- "ws": {
- "optional": true
- },
- "zod": {
- "optional": true
- }
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-linux-x64-musl": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-linux-x64-musl/-/clipboard-linux-x64-musl-0.3.9.tgz",
+ "integrity": "sha512-/DHn+1DrfL6oRaPPWXaOKvonFFrni666fxd+zFqiQEfvBH0tsHVWjq9iqBk0oDp0qaPA72lIMy5BptxISBEhZQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/p-retry": {
- "version": "4.6.2",
- "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
- "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-win32-arm64-msvc": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-win32-arm64-msvc/-/clipboard-win32-arm64-msvc-0.3.9.tgz",
+ "integrity": "sha512-O5FHD3ErkMwMhNzAfu3ggy0ug4z7btZuoQgwwxlzPrwV2bxlD6WDpqBY4NCgICAgZdDKdp+loUEKVAVt8aYnhQ==",
+ "cpu": [
+ "arm64"
+ ],
"license": "MIT",
- "dependencies": {
- "@types/retry": "0.12.0",
- "retry": "^0.13.1"
- },
+ "optional": true,
+ "os": [
+ "win32"
+ ],
"engines": {
- "node": ">=8"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/p-retry/node_modules/@types/retry": {
- "version": "0.12.0",
- "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",
- "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/partial-json": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/partial-json/-/partial-json-0.1.7.tgz",
- "integrity": "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/path-expression-matcher": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz",
- "integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/NaturalIntelligence"
- }
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@mariozechner/clipboard-win32-x64-msvc": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@mariozechner/clipboard-win32-x64-msvc/-/clipboard-win32-x64-msvc-0.3.9.tgz",
+ "integrity": "sha512-ihQC3EufqEY81vhXBgVBtK4prL+wc62zJsSvxrgz7K1hsdt6OObz6v9p3Rn1OG3GJksTTKMJF0u/guMISHPhSA==",
+ "cpu": [
+ "x64"
],
"license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
"engines": {
- "node": ">=14.0.0"
+ "node": ">= 10"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/path-key": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
- "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
- "license": "MIT",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/@silvia-odwyer/photon-node": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@silvia-odwyer/photon-node/-/photon-node-0.3.4.tgz",
+ "integrity": "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/diff": {
+ "version": "8.0.4",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz",
+ "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==",
+ "license": "BSD-3-Clause",
"engines": {
- "node": ">=8"
+ "node": ">=0.3.1"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/path-scurry": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
- "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==",
- "license": "BlueOak-1.0.0",
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/graceful-fs": {
+ "version": "4.2.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+ "license": "ISC"
+ },
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/highlight.js": {
+ "version": "10.7.3",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
+ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/hosted-git-info": {
+ "version": "9.0.3",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.3.tgz",
+ "integrity": "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg==",
+ "license": "ISC",
"dependencies": {
- "lru-cache": "^11.0.0",
- "minipass": "^7.1.2"
+ "lru-cache": "^11.1.0"
},
"engines": {
- "node": "18 || 20 || >=22"
+ "node": "^20.17.0 || >=22.9.0"
+ }
+ },
+ "node_modules/@earendil-works/pi-coding-agent/node_modules/marked": {
+ "version": "18.0.5",
+ "resolved": "https://registry.npmjs.org/marked/-/marked-18.0.5.tgz",
+ "integrity": "sha512-S6GcvALHg6K4ohtu4E7x0a1AqhAjp6cV8KhLSyN9qVapnzJkusVBxZRcIU9AeYsbe6P1hKDusSbEOzGyyuce6w==",
+ "license": "MIT",
+ "bin": {
+ "marked": "bin/marked.js"
},
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
+ "engines": {
+ "node": ">= 20"
}
},
"node_modules/@earendil-works/pi-coding-agent/node_modules/proper-lockfile": {
@@ -2597,235 +1322,18 @@
"node": ">= 4"
}
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/protobufjs": {
- "version": "7.6.5",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.5.tgz",
- "integrity": "sha512-/FPD0nUc9jH6rfFjji9IBqOz4pcSE3CsT1m7Ep6Mdb0LxSUMj8hgl6GomOvZzpNpAqqGaXA0P3VSrZLFzIhQrw==",
- "hasInstallScript": true,
- "license": "BSD-3-Clause",
- "dependencies": {
- "@protobufjs/aspromise": "^1.1.2",
- "@protobufjs/base64": "^1.1.2",
- "@protobufjs/codegen": "^2.0.5",
- "@protobufjs/eventemitter": "^1.1.1",
- "@protobufjs/fetch": "^1.1.1",
- "@protobufjs/float": "^1.0.2",
- "@protobufjs/path": "^1.1.2",
- "@protobufjs/pool": "^1.1.0",
- "@protobufjs/utf8": "^1.1.1",
- "@types/node": ">=13.7.0",
- "long": "^5.3.2"
- },
- "engines": {
- "node": ">=12.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/retry": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
- "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
- "license": "MIT",
- "engines": {
- "node": ">= 4"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/semver": {
- "version": "7.8.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz",
- "integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==",
- "license": "ISC",
- "bin": {
- "semver": "bin/semver.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/shebang-command": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
- "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
- "license": "MIT",
- "dependencies": {
- "shebang-regex": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/shebang-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
- "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/@earendil-works/pi-coding-agent/node_modules/signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"license": "ISC"
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/strnum": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.3.0.tgz",
- "integrity": "sha512-ums3KNd42PGyx5xaoVTO1mjU1bH3NpY4vsrVlnv9PNGqQj8wd7rJ6nEypLrJ7z5vxK5RP0yMLo6J/Gsm62DI5Q==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/NaturalIntelligence"
- }
- ],
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/ts-algebra": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz",
- "integrity": "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/tslib": {
- "version": "2.8.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
- "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
- "license": "0BSD"
- },
"node_modules/@earendil-works/pi-coding-agent/node_modules/typebox": {
"version": "1.1.38",
"resolved": "https://registry.npmjs.org/typebox/-/typebox-1.1.38.tgz",
"integrity": "sha512-pZ0aQPmMmXoUvSbeuWf/Hzsc+avNw/Zd6VeE8CFgkVGWyuHPJvqeJJDeJqLve+K70LvjYIoleGcoJHPT17cWoA==",
"license": "MIT"
},
- "node_modules/@earendil-works/pi-coding-agent/node_modules/undici": {
- "version": "8.10.2",
- "resolved": "https://registry.npmjs.org/undici/-/undici-8.10.2.tgz",
- "integrity": "sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ==",
- "license": "MIT",
- "engines": {
- "node": ">=22.19.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/undici-types": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
- "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
- "license": "MIT"
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/web-streams-polyfill": {
- "version": "3.3.3",
- "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
- "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
- "license": "MIT",
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/which": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
- "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
- "license": "ISC",
- "dependencies": {
- "isexe": "^2.0.0"
- },
- "bin": {
- "node-which": "bin/node-which"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/ws": {
- "version": "8.21.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
- "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
- "license": "MIT",
- "engines": {
- "node": ">=10.0.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": ">=5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/xml-naming": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.1.0.tgz",
- "integrity": "sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/NaturalIntelligence"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=16.0.0"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/yaml": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
- "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
- "license": "ISC",
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/eemeli"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/zod": {
- "version": "3.25.76",
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
- "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
- "license": "MIT",
- "funding": {
- "url": "https://github.com/sponsors/colinhacks"
- }
- },
- "node_modules/@earendil-works/pi-coding-agent/node_modules/zod-to-json-schema": {
- "version": "3.25.2",
- "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz",
- "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==",
- "license": "ISC",
- "peerDependencies": {
- "zod": "^3.25.28 || ^4"
- }
- },
"node_modules/@emnapi/core": {
"version": "2.0.0-alpha.5",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-alpha.5.tgz",
@@ -8199,7 +6707,6 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
"integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
@@ -8502,7 +7009,6 @@
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 4"
@@ -8644,7 +7150,6 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
"integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
- "dev": true,
"license": "MIT",
"bin": {
"jiti": "lib/jiti-cli.mjs"
@@ -10631,7 +9136,8 @@
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
"integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/secure-json-parse": {
"version": "4.1.0",
diff --git a/package.json b/package.json
index 1e56d7061..bca065fe2 100644
--- a/package.json
+++ b/package.json
@@ -74,8 +74,8 @@
"@aws-sdk/client-sts": "^3.1075.0",
"@aws-sdk/credential-provider-node": "^3.972.70",
"@aws-sdk/s3-request-presigner": "^3.1061.0",
- "@earendil-works/pi-ai": "0.82.0",
- "@earendil-works/pi-coding-agent": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.5/earendil-works-pi-coding-agent-0.82.0-qm-security.5.tgz",
+ "@earendil-works/pi-ai": "https://github.com/yc-software/qm/releases/download/vendored-pi-ai-0.82.0-qm.1/earendil-works-pi-ai-0.82.0-qm.1.tgz",
+ "@earendil-works/pi-coding-agent": "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.6/earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz",
"@fly/sprites": "0.2.3",
"@openai/codex": "0.156.1",
"@opencode-ai/plugin": "1.18.31",
@@ -118,7 +118,8 @@
},
"undici": "8.10.2",
"ip-address": "10.7.2",
- "protobufjs": "7.6.5"
+ "protobufjs": "7.6.5",
+ "@earendil-works/pi-ai": "$@earendil-works/pi-ai"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
diff --git a/plugins/web-ui/src/model-connect.ts b/plugins/web-ui/src/model-connect.ts
index 61785faf3..a0f2baab8 100644
--- a/plugins/web-ui/src/model-connect.ts
+++ b/plugins/web-ui/src/model-connect.ts
@@ -1,5 +1,5 @@
import { html, render, nothing, type TemplateResult } from "lit";
-import { api } from "./core-bridge";
+import { api, ApiError } from "./core-bridge";
import { errMessage } from "../../chassis/src/errors";
import { brandMark, brandName } from "./ui";
import { appState } from "./shell-state";
@@ -192,14 +192,20 @@ async function load(): Promise<void> {
paint();
}
+const API_ERROR_COPY: Record<string, string> = {
+ invalid_api_key: "That API key was rejected — check it and try again.",
+ oauth_start_failed: "Sign-in didn't complete. Try again — the code may have expired.",
+ oauth_poll_failed: "Sign-in didn't complete. Try again — the code may have expired.",
+ oauth_complete_failed: "Sign-in didn't complete. Try again — the code may have expired.",
+};
+
+// Classifies from the route's structured `error` code, or fetch's spec'd TypeError / TimeoutError; never the text.
function friendly(e: unknown): string {
- const raw = errMessage(e);
- if (/invalid_api_key|rejected this API key/i.test(raw)) return "That API key was rejected — check it and try again.";
- if (/oauth_start_failed|oauth_poll_failed|oauth_complete_failed/i.test(raw))
- return "Sign-in didn't complete. Try again — the code may have expired.";
- if (/network|fetch failed|timeout/i.test(raw))
+ const code = e instanceof ApiError ? (e.body as { error?: unknown } | null)?.error : undefined;
+ if (typeof code === "string" && API_ERROR_COPY[code]) return API_ERROR_COPY[code];
+ if (e instanceof TypeError || (e instanceof Error && e.name === "TimeoutError"))
return "Couldn't reach the sign-in service. Check your connection and try again.";
- return raw;
+ return errMessage(e);
}
async function afterConnect(provider: "anthropic" | "openai"): Promise<void> {
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.ts
index 60cd319f9..f28673b5f 100644
--- a/src/core/orchestrator.ts
+++ b/src/core/orchestrator.ts
@@ -167,7 +167,15 @@ import {
import { errMessage, reportFailure, swallow, swallowAs } from "../util/errors.ts";
import { isObj } from "../util/objects.ts";
import { absoluteAppLinks, headSlice, jsonbSafeStringify } from "../util/text.ts";
-import { NonRetryableTurnError, TitleRejected, turnFailureMessage, type TurnFailurePayload } from "./turn-error.ts";
+import {
+ isModelBudget,
+ isNonRetryable,
+ NonRetryableTurnError,
+ ProviderTurnError,
+ TitleRejected,
+ turnFailureMessage,
+ type TurnFailurePayload,
+} from "./turn-error.ts";
import { personKey, samePerson } from "../directory/person.ts";
import { sleep } from "../util/async.ts";
import { hashId } from "../util/crypto.ts";
@@ -4594,17 +4602,18 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
});
return { status: "refused", sessionId: session.id, reason: err.message };
}
+ const budget = isModelBudget(err) && !input.cancel?.aborted;
deps.errors?.record(
{
category: "turn",
- code: "error",
- message: errMessage(err),
+ code: budget ? "model_budget" : "error",
+ message: err instanceof ProviderTurnError ? err.raw : errMessage(err),
scopeLabel: scopeId,
sessionId: session.id,
},
err,
);
- if ((err instanceof NonRetryableTurnError || input.finalAttempt) && !input.cancel?.aborted) {
+ if ((isNonRetryable(err) || input.finalAttempt) && !input.cancel?.aborted) {
const mirrorFailureEntry = async (entry: SessionEntry | undefined): Promise<void> => {
if (!entry) return;
await deps.sessions
@@ -4627,6 +4636,13 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
.then(mirrorFailureEntry)
.catch(swallowAs("orchestrator: terminal turn failure record", undefined));
}
+ if (budget)
+ return {
+ status: "refused",
+ sessionId: session.id,
+ reason: turnFailureMessage(err),
+ refusalKind: "model_budget",
+ };
throw err;
} finally {
if (input.runId) deps.turnStream?.end(input.runId);
diff --git a/src/core/turn-error.ts b/src/core/turn-error.ts
index 9f316475a..dde94681c 100644
--- a/src/core/turn-error.ts
+++ b/src/core/turn-error.ts
@@ -7,10 +7,33 @@ export class NonRetryableTurnError extends Error {
}
}
+export type ProviderErrorCode =
+ | "model_budget"
+ | "rate_limit"
+ | "refusal"
+ | "auth"
+ | "context_too_long"
+ | "not_found"
+ | "model_unavailable"
+ | "bad_request"
+ | "transient"
+ | "unknown";
+
export class ProviderTurnError extends Error {
- constructor(message: string) {
+ readonly code: ProviderErrorCode;
+ readonly retryable: boolean;
+ readonly status?: number;
+ readonly raw: string;
+ constructor(
+ message: string,
+ info: { code: ProviderErrorCode; retryable: boolean; status?: number | undefined; raw: string },
+ ) {
super(message);
this.name = "ProviderTurnError";
+ this.code = info.code;
+ this.retryable = info.retryable;
+ if (info.status !== undefined) this.status = info.status;
+ this.raw = info.raw;
}
}
@@ -27,7 +50,19 @@ export type TurnFailurePayload = { kind: "turn_failure"; message: string; runId?
const GENERIC_TURN_FAILURE = "That turn failed and couldn't be completed. The details are in the operator error log.";
+export const MODEL_BUDGET_TEXT =
+ "This workspace has used up its model budget, so I can't run until it resets. An admin can raise the limit.";
+
+export function isNonRetryable(err: unknown): boolean {
+ return err instanceof NonRetryableTurnError || (err instanceof ProviderTurnError && !err.retryable);
+}
+
+export function isModelBudget(err: unknown): err is ProviderTurnError {
+ return err instanceof ProviderTurnError && err.code === "model_budget";
+}
+
export function turnFailureMessage(err: unknown): string {
+ if (isModelBudget(err)) return MODEL_BUDGET_TEXT;
return (err instanceof NonRetryableTurnError || err instanceof ProviderTurnError) && err.message.trim()
? err.message
: GENERIC_TURN_FAILURE;
diff --git a/src/delivery/run-result-delivery.ts b/src/delivery/run-result-delivery.ts
index ec060fcd0..a55a3b246 100644
--- a/src/delivery/run-result-delivery.ts
+++ b/src/delivery/run-result-delivery.ts
@@ -77,7 +77,7 @@ export function runResultDelivery(
if (
surface === "slack" &&
run.result?.status === "refused" &&
- run.result.refusalKind === "security_quarantine" &&
+ (run.result.refusalKind === "security_quarantine" || run.result.refusalKind === "model_budget") &&
run.request.addressed
) {
return { destination, text: standaloneFailureText(run.result)!, provenance, idempotencyKey };
diff --git a/src/harness/codex-harness.ts b/src/harness/codex-harness.ts
index 47e2de34b..af5741995 100644
--- a/src/harness/codex-harness.ts
+++ b/src/harness/codex-harness.ts
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { createHash } from "node:crypto";
import { CONFIG_DEFAULTS, type Config } from "../config.ts";
-import { NonRetryableTurnError } from "../core/turn-error.ts";
+import { NonRetryableTurnError, ProviderTurnError, type ProviderErrorCode } from "../core/turn-error.ts";
import { DEFAULT_CODEX_MODEL_ID, modelSupportedByHarness } from "../model/pi-models.ts";
import { startSignalPoll, type RunSignalStore } from "../runs/run-signal-store.ts";
import type { TaskStatus, TaskStore } from "../tasks/task-store.ts";
@@ -77,7 +77,12 @@ export function codexHarnessConfigOptions(config: Config): CodexHarnessOptions {
}
type CodexItem = Record<string, unknown> & { type: string };
-type CodexTurn = { id: string; status: string; error?: { message?: string } | null; items?: CodexItem[] };
+type CodexTurn = {
+ id: string;
+ status: string;
+ error?: { message?: string; codexErrorInfo?: CodexErrorInfo | null } | null;
+ items?: CodexItem[];
+};
const CODEX_TERMINAL_TURN_STATUSES = new Set(["completed", "failed", "interrupted", "cancelled", "canceled"]);
function isCodexThreadStart(value: unknown): value is { thread: { id: string }; model?: string } {
@@ -167,16 +172,38 @@ type StartingRuntime = {
};
const CODEX_START_TIMEOUT_MS = 30_000;
-const CODEX_NON_RETRYABLE_PATTERN =
- /\b(?:401|402|403)\b|unauthoriz|forbidden|invalid[_ -]?api[_ -]?key|incorrect api key|authentication (?:error|failed)|missing bearer|missing (?:api key|credentials)|not logged in|codex login|insufficient[_ -]?quota|exceeded your current quota|billing|credit(?: balance| limit)|out of credits|credits_depleted|must be verified|model[_ -]?not[_ -]?found|does not exist or you do not have access|unsupported[_ -]?model/i;
+// Codex app-server TurnError.codexErrorInfo (protocol v2, codex-cli 0.156.1). Strings and single-key
+// objects; HTTP-backed variants carry httpStatusCode.
+type CodexErrorInfo = string | Record<string, { httpStatusCode?: number | null } | undefined>;
-export function codexNonRetryable(message: string): boolean {
- return CODEX_NON_RETRYABLE_PATTERN.test(message);
-}
+const CODEX_ERROR_CODES: Record<string, ProviderErrorCode> = {
+ contextWindowExceeded: "context_too_long",
+ sessionBudgetExceeded: "model_budget",
+ usageLimitExceeded: "rate_limit",
+ rateLimitExceeded: "rate_limit",
+ serverOverloaded: "transient",
+ internalServerError: "transient",
+ httpConnectionFailed: "transient",
+ responseStreamConnectionFailed: "transient",
+ responseStreamDisconnected: "transient",
+ responseTooManyFailedAttempts: "transient",
+ cyberPolicy: "refusal",
+ misalignmentPolicyViolation: "refusal",
+ unauthorized: "auth",
+ badRequest: "bad_request",
+};
-export function codexProviderFailure(message: string): Error {
+/** Classifies a Codex failure from codexErrorInfo only; the message text is carried, never matched. */
+export function codexProviderFailure(message: string, info?: CodexErrorInfo | null): ProviderTurnError {
const safe = redactSecrets(message);
- return codexNonRetryable(safe) ? new NonRetryableTurnError(safe) : new Error(safe);
+ const variant = typeof info === "string" || !info ? info || undefined : Object.keys(info)[0];
+ const detail = info && typeof info === "object" && variant ? info[variant] : undefined;
+ const status = detail?.httpStatusCode ?? undefined;
+ let code: ProviderErrorCode = (variant && CODEX_ERROR_CODES[variant]) || "unknown";
+ if (code === "transient" && (status === 401 || status === 403)) code = "auth";
+ if (code === "transient" && status === 429) code = "rate_limit";
+ const retryable = code === "rate_limit" || code === "transient" || (code === "unknown" && variant !== "badRequest");
+ return new ProviderTurnError(safe, { code, retryable, status, raw: safe });
}
export function codexChildToolAllowed(name: string, args?: unknown): boolean {
return nativeChildToolAllowed(name, args);
@@ -1314,7 +1341,7 @@ export function createCodexHarness(opts: CodexHarnessOptions = {}): Harness {
});
}
if (result.status === "failed" && !state.stopped && !ref.runtimeHandoff)
- throw codexProviderFailure(result.error?.message ?? "Codex turn failed");
+ throw codexProviderFailure(result.error?.message ?? "Codex turn failed", result.error?.codexErrorInfo);
if (state.stopped || turn.cancel?.aborted) {
if (turn.cancel?.aborted) runtimeCleanupRequested = true;
await saveStoppedReply();
diff --git a/src/harness/history-summary.ts b/src/harness/history-summary.ts
index a44fb34e9..2ab8da6ef 100644
--- a/src/harness/history-summary.ts
+++ b/src/harness/history-summary.ts
@@ -3,6 +3,7 @@ import type { Api, Model } from "@earendil-works/pi-ai";
import { contextSummaryPayload } from "../sessions/session-store.ts";
import type { SessionEntry } from "../types.ts";
import { compactTranscript, validateCompactSummary } from "./context-compaction.ts";
+import { providerTurnError } from "./provider-error.ts";
type StreamFn = NonNullable<Parameters<typeof generateSummary>[9]>;
@@ -42,6 +43,7 @@ export async function summarizeHistory(
async (summaryModel, context, options) => {
const stream = await streamFn(summaryModel, context, options);
const result = await stream.result();
+ if (result.stopReason === "error") throw providerTurnError(result);
if (result.stopReason !== "stop") {
throw new Error(
`Compaction did not complete (${result.stopReason}): ${result.errorMessage ?? "incomplete summary"}`,
diff --git a/src/harness/mock-harness.ts b/src/harness/mock-harness.ts
index 8befbc9d6..62b9a399c 100644
--- a/src/harness/mock-harness.ts
+++ b/src/harness/mock-harness.ts
@@ -7,7 +7,7 @@ import {
type HarnessTurnResult,
} from "./harness.ts";
import { classifyScopeLabel } from "../classify/scope-classifier.ts";
-import { NonRetryableTurnError, TitleRejected } from "../core/turn-error.ts";
+import { NonRetryableTurnError, ProviderTurnError, TitleRejected } from "../core/turn-error.ts";
import { NeedsApproval } from "../tools/primitives.ts";
import { deterministicCompactSummary, estimateHistoryTokens } from "./context-compaction.ts";
import { countTokens } from "../util/tokens.ts";
@@ -229,6 +229,13 @@ export function createMockHarness(): Harness {
await turn.tools.post(msg);
resumePostSessions.set(turn.session.id, `${msg} (repost)`);
throw new Error("boom: simulated fault before the post's tool result landed");
+ } else if (command0 === "!over-budget") {
+ throw new ProviderTurnError("Model provider API error (budget_exceeded): ExceededBudget", {
+ code: "model_budget",
+ retryable: false,
+ status: 429,
+ raw: '429: {"message":"ExceededBudget: Team=team-a over 1d budget.","type":"budget_exceeded"}',
+ });
} else if (command0.startsWith("!post-then-boom ")) {
const rest = cmd.slice(cmd.indexOf("!post-then-boom ") + "!post-then-boom ".length);
const bar = rest.indexOf("|");
diff --git a/src/harness/pi-harness.ts b/src/harness/pi-harness.ts
index 02f5c3eb4..d3ecd9677 100644
--- a/src/harness/pi-harness.ts
+++ b/src/harness/pi-harness.ts
@@ -24,8 +24,6 @@ import {
import {
calculateCost,
InMemoryCredentialStore,
- isContextOverflow,
- isRetryableAssistantError,
type Api,
type AssistantMessage,
type Context,
@@ -63,6 +61,7 @@ import type {
} from "../sessions/session-store.ts";
import { tapeEntryMirrorRecord } from "../sessions/session-store.ts";
import { NonRetryableTurnError, ProviderTurnError, TitleRejected } from "../core/turn-error.ts";
+import { providerTurnError } from "./provider-error.ts";
import { MAX_LLM_REQUEST_BYTES } from "../core/attachments.ts";
import { asError, swallow, swallowAs } from "../util/errors.ts";
import {
@@ -83,7 +82,11 @@ import {
codexProviderModelId,
} from "../model/pi-models.ts";
import { customModelsJson, customProvidersVersion } from "../model/custom-providers.ts";
-import { modelGatewayRequest, type ModelGatewayTransportConfig } from "../model/provider-endpoints.ts";
+import {
+ GatewayModelUnavailableError,
+ modelGatewayRequest,
+ type ModelGatewayTransportConfig,
+} from "../model/provider-endpoints.ts";
import {
defineHarness,
promptEnvelopeWithoutHistory,
@@ -948,61 +951,33 @@ export function textFromContent(content: unknown): string {
type AssistantTextSession = Pick<AgentSession, "getLastAssistantText" | "messages">;
-function parseProviderError(message: string): { type: string; message: string } | null {
- const jsonAt = message.indexOf("{");
- if (jsonAt < 0) return null;
- try {
- const parsed = JSON.parse(message.slice(jsonAt)) as {
- type?: unknown;
- message?: unknown;
- error?: { type?: unknown; message?: unknown };
- };
- const body = parsed.error && typeof parsed.error === "object" ? parsed.error : parsed;
- const providerMessage = typeof body.message === "string" ? body.message.trim() : "";
- const providerType = typeof body.type === "string" ? body.type.trim() : "";
- return providerMessage || providerType ? { type: providerType, message: providerMessage } : null;
- } catch (e) {
- swallow("pi: assistant error json parse", e);
- return null;
- }
-}
-
-function formatPiAssistantError(raw: string | undefined): string {
- const message = raw?.trim();
- if (!message) return "Pi agent stopped with an error";
- const provider = parseProviderError(message);
- if (!provider?.message) return message;
- return provider.type
- ? `Model provider API error (${provider.type}): ${provider.message}`
- : `Model provider API error: ${provider.message}`;
-}
-
-const TRANSIENT_PROVIDER_ERROR_TYPES = new Set(["overloaded_error", "api_error", "rate_limit_error", "timeout_error"]);
-
-function piErrorRetryable(failed: AssistantMessage): boolean {
- const providerType = failed.errorMessage ? parseProviderError(failed.errorMessage)?.type : undefined;
- if (providerType && !TRANSIENT_PROVIDER_ERROR_TYPES.has(providerType)) return false;
- return isRetryableAssistantError(failed) && !isContextOverflow(failed);
-}
-
function piFailedAssistant(session: AssistantTextSession): AssistantMessage | undefined {
const lastAssistant = [...session.messages].reverse().find((m) => m.role === "assistant") as
AssistantMessage | undefined;
return lastAssistant?.stopReason === "error" ? lastAssistant : undefined;
}
-function piAssistantError(session: AssistantTextSession): string | null {
- const failed = piFailedAssistant(session);
- return failed ? formatPiAssistantError(failed.errorMessage) : null;
+function lastInputTokens(session: AssistantTextSession, failed: AssistantMessage): number | undefined {
+ const ok = [...session.messages]
+ .reverse()
+ .find((m) => m !== failed && m.role === "assistant" && (m as AssistantMessage).stopReason !== "error") as
+ AssistantMessage | undefined;
+ const u = ok?.usage;
+ return u ? u.input + u.cacheRead + u.cacheWrite : undefined;
}
-function piAssistantFailure(session: AssistantTextSession): Error | null {
+function piAssistantFailure(session: AssistantTextSession): ProviderTurnError | null {
const failed = piFailedAssistant(session);
if (!failed) return null;
- const message = formatPiAssistantError(failed.errorMessage);
- return piErrorRetryable(failed) ? new ProviderTurnError(message) : new NonRetryableTurnError(message);
+ const contextWindow = (
+ failed.model ? (resolveModel(failed.model) as { contextWindow?: number } | undefined) : undefined
+ )?.contextWindow;
+ return providerTurnError(failed, { contextWindow, lastInputTokens: lastInputTokens(session, failed) });
}
+/** Codes that retry the turn on the configured fallback model. */
+const FALLBACK_CODES = new Set(["refusal", "model_unavailable"]);
+
export function piLastAssistantTextOrThrow(session: AssistantTextSession): string | undefined {
const err = piAssistantFailure(session);
if (err) throw err;
@@ -1025,16 +1000,9 @@ export function piTurnError(session: AssistantTextSession, thrown: unknown, mess
return thrown instanceof Error ? thrown : new Error(String(thrown));
}
-const PROVIDER_REFUSAL_PATTERN =
- /violate Anthropic(?:'|’)?s (?:Terms of Service|usage policy)|under Anthropic(?:'|’)?s usage policy|refusals-and-fallback|reduce refusals for your users by configuring a fallback model|the model refused to complete the request|gateway model is unavailable/i;
-
-export function isProviderRefusal(message: string | undefined): boolean {
- return !!message && PROVIDER_REFUSAL_PATTERN.test(message);
-}
-
export function providerRefusalError(session: AssistantTextSession, messagesBefore?: number): string | null {
- const err = piAssistantError(messagesSince(session, messagesBefore));
- return err && isProviderRefusal(err) ? err : null;
+ const err = piAssistantFailure(messagesSince(session, messagesBefore));
+ return err && FALLBACK_CODES.has(err.code) ? err.message : null;
}
export const REFUSAL_FALLBACK_MODEL_IDS = ["claude-opus-5", "claude-sonnet-5"] as const;
@@ -1096,7 +1064,7 @@ export function emptyEndingNote(opts: {
if (opts.pollFire) return null;
const calls = opts.ref.modelCalls ?? 0;
if (calls === 0) return null;
- if (piAssistantError(opts.session)) return null;
+ if (piFailedAssistant(opts.session)) return null;
if ((opts.session.getLastAssistantText() ?? "").trim()) return null;
if (opts.turnWallClockMs > 0 && opts.turnWallClockMs - opts.elapsedMs < EMPTY_ENDING_MIN_BUDGET_MS) return null;
return EMPTY_ENDING_NOTE;
@@ -1311,7 +1279,7 @@ export async function buildModelRuntime(
options: wireModelId(routed, model, async () => {
await modelGateway?.refresh?.();
const current = modelGatewayRequest(modelGateway, model);
- if (!current) throw new Error(`Gateway model is unavailable: ${model.id}`);
+ if (!current) throw new GatewayModelUnavailableError(model.id);
return current.target;
}),
};
@@ -1411,8 +1379,10 @@ export async function probeModel(
)
.result();
signal.throwIfAborted();
+ if (response.stopReason === "aborted") throw new DOMException("Model verification was aborted", "AbortError");
+ if (response.stopReason === "error") throw providerTurnError(response);
if (response.stopReason !== "stop" || !response.content.some((part) => part.type === "text" && part.text.trim()))
- throw new Error(response.errorMessage || "Model verification did not produce a completed text response");
+ throw new Error("Model verification did not produce a completed text response");
}
const FAST_MODE_BETA = "fast-mode-2026-02-01";
@@ -2412,7 +2382,7 @@ export function createPiHarness(opts?: PiHarnessOptions): Harness {
if (!userAborted && !cancelAbortRejection) {
const turnErr = piTurnError(entry.agentSession, err, messagesBefore);
let recovered = false;
- if (isProviderRefusal(turnErr.message)) {
+ if (turnErr instanceof ProviderTurnError && FALLBACK_CODES.has(turnErr.code)) {
try {
recovered = await attemptRefusalFallback(turnErr.message);
} catch (e) {
@@ -2597,8 +2567,8 @@ export function createPiHarness(opts?: PiHarnessOptions): Harness {
(id) => !!resolveModel(id),
);
if (
- !(error instanceof Error) ||
- !isProviderRefusal(error.message) ||
+ !(error instanceof ProviderTurnError) ||
+ error.code !== "refusal" ||
!fallbackId ||
!resolveModel(fallbackId)
)
diff --git a/src/harness/provider-error.ts b/src/harness/provider-error.ts
new file mode 100644
index 000000000..a062ae582
--- /dev/null
+++ b/src/harness/provider-error.ts
@@ -0,0 +1,67 @@
+import type { AssistantMessage } from "@earendil-works/pi-ai";
+import { ProviderTurnError, type ProviderErrorCode } from "../core/turn-error.ts";
+
+// Classifies a failed pi-ai AssistantMessage from structured fields only: providerError (HTTP status
+// plus the provider's documented error type/code, from our vendored pi-ai, see vendor/pi-ai/) and
+// rawStopReason. errorMessage is never inspected; it is carried as `raw` for the operator log.
+
+const AUTH_TYPES = new Set(["authentication_error", "permission_error", "invalid_api_key"]);
+const TRANSIENT_TYPES = new Set(["overloaded_error", "api_error", "timeout_error"]);
+const CONTEXT_CODES = new Set(["context_length_exceeded"]);
+const QUOTA_CODES = new Set(["insufficient_quota"]);
+const NOT_FOUND_CODES = new Set(["model_not_found"]);
+const RETRYABLE_CODES = new Set<ProviderErrorCode>(["rate_limit", "transient", "unknown"]);
+
+/** Last known prompt size vs. the model's window, for Anthropic's untyped over-window 400. */
+export interface ContextUsage {
+ contextWindow?: number | undefined;
+ lastInputTokens?: number | undefined;
+}
+
+// Anthropic documents prompt-too-long only as a generic 400 invalid_request_error; we call it
+// context_too_long when the last known input already filled this share of the window.
+const NEAR_WINDOW_RATIO = 0.9;
+
+function nearWindow(usage: ContextUsage | undefined): boolean {
+ const { contextWindow, lastInputTokens } = usage ?? {};
+ return !!contextWindow && !!lastInputTokens && lastInputTokens >= contextWindow * NEAR_WINDOW_RATIO;
+}
+
+function providerErrorCode(failed: AssistantMessage, usage?: ContextUsage): ProviderErrorCode {
+ if (failed.rawStopReason === "refusal") return "refusal";
+ const { status, type, code } = failed.providerError ?? {};
+ if (type === "model_unavailable") return "model_unavailable";
+ if (type === "request_too_large" || status === 413) return "context_too_long";
+ if (type === "invalid_request_error" && status === 400 && nearWindow(usage)) return "context_too_long";
+ if (type === "budget_exceeded" || (code && QUOTA_CODES.has(code))) return "model_budget";
+ if (code && CONTEXT_CODES.has(code)) return "context_too_long";
+ if ((type && AUTH_TYPES.has(type)) || status === 401 || status === 403) return "auth";
+ if (type === "rate_limit_error" || status === 429) return "rate_limit";
+ if (type === "not_found_error" || (code && NOT_FOUND_CODES.has(code)) || status === 404) return "not_found";
+ if ((type && TRANSIENT_TYPES.has(type)) || status === 408 || status === 409 || (status ?? 0) >= 500)
+ return "transient";
+ if (type === "invalid_request_error" || status === 400 || status === 422) return "bad_request";
+ return "unknown";
+}
+
+function providerBodyMessage(body: unknown): string | undefined {
+ if (!body || typeof body !== "object") return undefined;
+ const record = body as { message?: unknown; error?: unknown };
+ const nested = record.error && typeof record.error === "object" ? (record.error as { message?: unknown }) : record;
+ return typeof nested.message === "string" && nested.message.trim() ? nested.message.trim() : undefined;
+}
+
+export function providerTurnError(failed: AssistantMessage, usage?: ContextUsage): ProviderTurnError {
+ const raw = failed.errorMessage?.trim() ?? "";
+ const code = providerErrorCode(failed, usage);
+ const status = failed.providerError?.status;
+ const type = failed.providerError?.type;
+ const bodyMessage = providerBodyMessage(failed.providerError?.body);
+ const message = bodyMessage
+ ? `Model provider API error${type ? ` (${type})` : ""}: ${bodyMessage}`
+ : raw || "Pi agent stopped with an error";
+ // A failure with no HTTP response or stop reason (network drop, stream cut) stays "unknown" but retryable.
+ const retryable =
+ RETRYABLE_CODES.has(code) && !(code === "unknown" && (status !== undefined || failed.rawStopReason));
+ return new ProviderTurnError(message, { code, retryable, status, raw });
+}
diff --git a/src/model/model-verification.ts b/src/model/model-verification.ts
index dfe2e0a6e..bf7e5c6b9 100644
--- a/src/model/model-verification.ts
+++ b/src/model/model-verification.ts
@@ -1,9 +1,10 @@
import { createHmac, scrypt } from "node:crypto";
import { probeModel } from "../harness/pi-harness.ts";
+import { ProviderTurnError, type ProviderErrorCode } from "../core/turn-error.ts";
import { modelFromOverlay } from "./pi-models.ts";
import type { ModelOverlay } from "./model-overlay.ts";
import type { ModelCredentialStore } from "./model-credential-store.ts";
-import type { ModelGatewayTransportConfig } from "./provider-endpoints.ts";
+import { GatewayModelUnavailableError, type ModelGatewayTransportConfig } from "./provider-endpoints.ts";
export class ModelVerificationError extends Error {
readonly code: string;
@@ -19,40 +20,36 @@ interface ModelVerificationContext {
}
export type ModelVerifier = (spec: ModelOverlay) => Promise<ModelVerificationContext>;
+const VERIFICATION_FAILURES: Record<string, string> = {
+ timeout: "Verification timed out. Try again; the model was not enabled.",
+ access_denied: "The serving credential cannot access this model. Check its provider permissions.",
+ quota_or_rate_limit: "The provider reports a quota, billing, or rate limit. Resolve it and verify again.",
+ model_unavailable: "The provider could not serve this model ID. Check the ID and credential access.",
+ unsupported_configuration: "The provider rejected this configuration. Check the template and fast-mode capability.",
+ provider_failure: "The provider did not complete the verification request. Try again or check provider status.",
+};
+
+const VERIFICATION_CODES: Record<ProviderErrorCode, keyof typeof VERIFICATION_FAILURES> = {
+ auth: "access_denied",
+ model_budget: "quota_or_rate_limit",
+ rate_limit: "quota_or_rate_limit",
+ not_found: "model_unavailable",
+ model_unavailable: "model_unavailable",
+ bad_request: "unsupported_configuration",
+ context_too_long: "unsupported_configuration",
+ refusal: "provider_failure",
+ transient: "provider_failure",
+ unknown: "provider_failure",
+};
+
+/** Maps a probe failure from structured signals only: ProviderTurnError.code or an abort/timeout error's name. */
export function verificationFailure(error: unknown): ModelVerificationError {
if (error instanceof ModelVerificationError) return error;
- const text = error instanceof Error ? error.message : "";
- if (/timeout|aborted|aborterror/i.test(text))
- return new ModelVerificationError("timeout", "Verification timed out. Try again; the model was not enabled.");
- if (/401|403|unauthori[sz]ed|forbidden|permission|authentication|(?:invalid|incorrect).api.key/i.test(text))
- return new ModelVerificationError(
- "access_denied",
- "The serving credential cannot access this model. Check its provider permissions.",
- );
- if (/429|quota|rate.limit|billing|credit|resource.exhausted/i.test(text))
- return new ModelVerificationError(
- "quota_or_rate_limit",
- "The provider reports a quota, billing, or rate limit. Resolve it and verify again.",
- );
- if (/404|not.found|does not exist|model.*unavailable/i.test(text))
- return new ModelVerificationError(
- "model_unavailable",
- "The provider could not serve this model ID. Check the ID and credential access.",
- );
- if (/\b5\d\d\b/.test(text))
- return new ModelVerificationError(
- "provider_failure",
- "The provider is temporarily unable to complete verification. Try again later.",
- );
- if (/400|422|unsupported|invalid.*(parameter|request)|not.supported/i.test(text))
- return new ModelVerificationError(
- "unsupported_configuration",
- "The provider rejected this configuration. Check the template and fast-mode capability.",
- );
- return new ModelVerificationError(
- "provider_failure",
- "The provider did not complete the verification request. Try again or check provider status.",
- );
+ let code = "provider_failure";
+ if (error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) code = "timeout";
+ else if (error instanceof GatewayModelUnavailableError) code = "model_unavailable";
+ else if (error instanceof ProviderTurnError) code = VERIFICATION_CODES[error.code];
+ return new ModelVerificationError(code, VERIFICATION_FAILURES[code]!);
}
export function createModelVerifier(input: {
diff --git a/src/model/provider-endpoints.ts b/src/model/provider-endpoints.ts
index f13064776..0222397a2 100644
--- a/src/model/provider-endpoints.ts
+++ b/src/model/provider-endpoints.ts
@@ -74,6 +74,18 @@ export function providerBaseUrl(provider: string): string | undefined {
return (PROVIDER_IDS as readonly string[]).includes(provider) ? configured[provider as ProviderId] : undefined;
}
+/** Our own signal that the gateway has no route for a model id; typed so callers never match its text. */
+export class GatewayModelUnavailableError extends Error {
+ // Read by the vendored pi-ai's extractProviderError when this is thrown mid-stream, so the failed
+ // message carries providerError {status: 404, type: "model_unavailable"}.
+ readonly status = 404;
+ readonly type = "model_unavailable";
+ constructor(modelId: string) {
+ super(`Gateway model is unavailable: ${modelId}`);
+ this.name = "GatewayModelUnavailableError";
+ }
+}
+
export function modelGatewayRequest<T extends { id: string; baseUrl: string; api?: string }>(
config: ModelGatewayTransportConfig | undefined,
model: T,
@@ -81,7 +93,7 @@ export function modelGatewayRequest<T extends { id: string; baseUrl: string; api
const target = config?.models[model.id];
if (!target || !config) {
if (isGatewayModelId(model.id) || config?.reservedModelIds?.has(model.id))
- throw new Error(`Gateway model is unavailable: ${model.id}`);
+ throw new GatewayModelUnavailableError(model.id);
return undefined;
}
return {
diff --git a/src/runs/worker.ts b/src/runs/worker.ts
index 8845f8645..fb3315654 100644
--- a/src/runs/worker.ts
+++ b/src/runs/worker.ts
@@ -4,7 +4,7 @@ import type { ErrorLog } from "../admin/error-log.ts";
import { conversationScope } from "../resolution/resolution-service.ts";
import type { TurnResult } from "../types.ts";
import type { Orchestrator } from "../core/orchestrator.ts";
-import { NonRetryableTurnError, turnFailureMessage } from "../core/turn-error.ts";
+import { isNonRetryable, NonRetryableTurnError, turnFailureMessage } from "../core/turn-error.ts";
import { resolveTurnOrigin } from "../core/turn-origin.ts";
import { errorParks, type Run, type RunStore } from "./run-store.ts";
import { errMessage, errorAlreadyReported, reportFailure, swallow } from "../util/errors.ts";
@@ -110,7 +110,7 @@ export async function processRun(
err,
);
await deps.runs.fail(run.id, token, turnFailureMessage(err), {
- retry: !(err instanceof NonRetryableTurnError),
+ retry: !isNonRetryable(err),
retryAfterMs: retryDelay(run.errorAttempts),
});
throw err;
diff --git a/src/types.ts b/src/types.ts
index 4c93ba989..3a1af014c 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -790,7 +790,7 @@ export interface TurnResult {
reply?: string;
reactions?: string[];
reason?: string;
- refusalKind?: "security_quarantine" | "session_busy";
+ refusalKind?: "security_quarantine" | "session_busy" | "model_budget";
adminUrl?: string;
runId?: string;
steered?: true;
diff --git a/test/codex-harness.test.ts b/test/codex-harness.test.ts
index f8ca7bbbe..c7bf3464e 100644
--- a/test/codex-harness.test.ts
+++ b/test/codex-harness.test.ts
@@ -16,7 +16,6 @@ import { dirname, join } from "node:path";
import { createRequire } from "node:module";
import {
codexChildEnv,
- codexNonRetryable,
codexProviderFailure,
codexUsageTotals,
codexChildToolAllowed,
@@ -31,7 +30,7 @@ import {
import type { HarnessLlmRequestRecord, HarnessTurnInput } from "../src/harness/harness.ts";
import { harnessToolContext } from "../src/harness/harness-shared.ts";
import { createMemoryRunSignalStore } from "../src/runs/run-signal-store.ts";
-import { NonRetryableTurnError } from "../src/core/turn-error.ts";
+import { NonRetryableTurnError, ProviderTurnError } from "../src/core/turn-error.ts";
import type { ScopeId, Session, SessionEntry } from "../src/types.ts";
import { createMemoryTaskStore } from "../src/tasks/memory-task-store.ts";
import { CodexAppServer } from "../src/harness/codex-app-server.ts";
@@ -1462,58 +1461,28 @@ test("cancelling one Codex setup does not kill another active turn", async (t) =
assert.equal((await first).reply, "FIRST-OK");
});
-test("Codex classifies deterministic provider failures as terminal and leaves transient ones retryable", () => {
- const terminal = [
- "Codex 401: Incorrect API key provided",
- "Codex app-server exited (1): stream error: unauthorized",
- "You exceeded your current quota, please check your plan and billing details",
- "The model `gpt-5.6-sol` does not exist or you do not have access to it",
- "Not logged in. Run `codex login` to authenticate.",
- "Codex -32000: invalid_api_key",
- "403 Forbidden",
- "HTTP 402 Payment Required",
- "Your organization must be verified to stream this model",
- "unexpected status 401 Unauthorized: Missing bearer or basic authentication in header",
- "You've reached your workspace credit limit",
- "Your workspace is out of credits. Ask your workspace owner to add more.",
- "workspace_owner_credits_depleted",
+test("Codex classifies failures from codexErrorInfo, never from message text", () => {
+ const cases: Array<[Parameters<typeof codexProviderFailure>[1], string, boolean, number?]> = [
+ ["contextWindowExceeded", "context_too_long", false],
+ ["sessionBudgetExceeded", "model_budget", false],
+ ["usageLimitExceeded", "rate_limit", true],
+ ["rateLimitExceeded", "rate_limit", true],
+ ["serverOverloaded", "transient", true],
+ ["unauthorized", "auth", false],
+ ["cyberPolicy", "refusal", false],
+ ["badRequest", "bad_request", false],
+ ["other", "unknown", true],
+ [null, "unknown", true],
+ [{ httpConnectionFailed: { httpStatusCode: 502 } }, "transient", true, 502],
+ [{ responseStreamConnectionFailed: { httpStatusCode: 401 } }, "auth", false, 401],
+ [{ responseTooManyFailedAttempts: { httpStatusCode: 429 } }, "rate_limit", true, 429],
];
- for (const message of terminal) {
- assert.equal(codexNonRetryable(message), true, message);
- assert.ok(codexProviderFailure(message) instanceof NonRetryableTurnError, message);
+ for (const [info, code, retryable, status] of cases) {
+ // The text says "401 invalid_api_key" every time; only codexErrorInfo decides.
+ const err = codexProviderFailure("Codex 401: invalid_api_key", info);
+ assert.ok(err instanceof ProviderTurnError);
+ assert.deepEqual([err.code, err.retryable, err.status], [code, retryable, status], JSON.stringify(info));
}
-
- const transient = [
- "Rate limit reached for gpt-5.6-sol, please retry",
- "429 Too Many Requests",
- "The server had an error while processing your request",
- "socket hang up",
- "Codex app-server exited (null): ECONNRESET",
- "Codex turn failed",
- "rate_limit_reached",
- "You've hit your usage limit for gpt-5.6-sol",
- "workspace_member_usage_limit_reached",
- "407 Proxy Authentication Required",
- ];
- for (const message of transient) {
- assert.equal(codexNonRetryable(message), false, message);
- assert.ok(!(codexProviderFailure(message) instanceof NonRetryableTurnError), message);
- }
-});
-
-test("Codex never classifies its own infrastructure failures as terminal", () => {
- const ours = [
- "permission denied for table session_entries",
- "EACCES: permission denied, open '/data/tape/x.jsonl'",
- "Codex app-server exited (1): thread panicked at src/client.rs:403:9",
- "Codex app-server exited (1): WARN retrying request: 401 Unauthorized (attempt 1); INFO recovered",
- "connect ECONNREFUSED 127.0.0.1:403",
- ];
- for (const message of ours) {
- assert.ok(codexProviderFailure(message) instanceof Error, message);
- }
- assert.equal(codexProviderFailure("Codex turn failed").message, "Codex turn failed");
- assert.ok(!(codexProviderFailure("socket hang up") instanceof NonRetryableTurnError));
assert.equal(
codexProviderFailure("401 access_token=provider-secret-123456").message.includes("provider-secret"),
false,
@@ -1549,7 +1518,7 @@ rl.on("line", (line) => {
mode === "startRejected"
? `return send({ id: msg.id, error: { code: 401, message: "Incorrect API key provided" } });`
: `send({ id: msg.id, result: { turn: { id: "turn-fail", status: "inProgress", items: [] } } });
- return send({ method: "turn/completed", params: { threadId: "thread-fail", turn: { id: "turn-fail", status: "failed", error: { message: "You exceeded your current quota" }, items: [] } } });`
+ return send({ method: "turn/completed", params: { threadId: "thread-fail", turn: { id: "turn-fail", status: "failed", error: { message: "You exceeded your current quota", codexErrorInfo: "unauthorized" }, items: [] } } });`
}
}
if (msg.method === "turn/interrupt") return send({ id: msg.id, result: {} });
@@ -1561,7 +1530,7 @@ rl.on("line", (line) => {
}
for (const mode of ["turnFailed", "startRejected"] as const) {
- test(`Codex parks the run on a provider auth/quota failure (${mode}) instead of burning retries`, async (t) => {
+ test(`Codex classifies a ${mode} provider failure structurally`, async (t) => {
const dir = mkdtempSync(join(tmpdir(), "qm-codex-fail-test-"));
const harness = createCodexHarness({
binaryPath: failingProviderCodexBinary(dir, mode),
@@ -1585,7 +1554,10 @@ for (const mode of ["turnFailed", "startRejected"] as const) {
emit: async (entry) => ({ ...entry, sessionId: "fail-session", seq: 1, createdAt: Date.now() }) as SessionEntry,
recordModelCall: () => {},
}),
- (error: unknown) => error instanceof NonRetryableTurnError,
+ (error: unknown) =>
+ error instanceof ProviderTurnError &&
+ // turn/completed carries codexErrorInfo; a bare JSON-RPC rejection has no structured cause.
+ (mode === "turnFailed" ? error.code === "auth" && !error.retryable : error.code === "unknown"),
);
});
}
diff --git a/test/history-summary.test.ts b/test/history-summary.test.ts
index cabfb1c60..cadf01d02 100644
--- a/test/history-summary.test.ts
+++ b/test/history-summary.test.ts
@@ -8,6 +8,7 @@ import { getRequiredModel } from "../src/model/pi-models.ts";
import { createContextSummaryPayload } from "../src/sessions/session-store.ts";
import { zeroUsage } from "../src/harness/replay.ts";
import type { SessionEntry } from "../src/types.ts";
+import { ProviderTurnError } from "../src/core/turn-error.ts";
const model = getRequiredModel("claude-opus-5");
const summary = "## Goal\nInvestigate migration failures.\n## Constraints & Preferences\nDo not change production.";
@@ -88,7 +89,14 @@ test("repeated compaction separates the latest summary and only summarizes its u
});
});
-for (const stopReason of ["length", "aborted", "error", "toolUse"] as const) {
+test("compaction rejects a provider error as a typed ProviderTurnError", async () => {
+ await assert.rejects(
+ summarizeHistory([], model, () => response("partial summary", "error")),
+ (err: unknown) => err instanceof ProviderTurnError,
+ );
+});
+
+for (const stopReason of ["length", "aborted", "toolUse"] as const) {
test(`compaction rejects ${stopReason} even when partial text exists`, async () => {
await assert.rejects(
summarizeHistory([], model, () => response("partial summary", stopReason)),
diff --git a/test/model-verification.test.ts b/test/model-verification.test.ts
index 7a1988f0b..e984631f5 100644
--- a/test/model-verification.test.ts
+++ b/test/model-verification.test.ts
@@ -28,6 +28,8 @@ import {
} from "../src/model/model-verification.ts";
import { setModelOverlays, resolveModel, modelUnavailableReason } from "../src/model/pi-models.ts";
import type { StoredModelOverlay } from "../src/model/model-overlay-store.ts";
+import { ProviderTurnError, type ProviderErrorCode } from "../src/core/turn-error.ts";
+import { GatewayModelUnavailableError } from "../src/model/provider-endpoints.ts";
const verified: ModelVerifier = async () => ({ fingerprint: "test-context", probe: async () => {} });
afterEach(() => setModelOverlays([]));
@@ -53,7 +55,13 @@ test("failed probes never publish new models or replace previously verified defi
const store = createModelOverlayStore(createMemoryMap(), undefined, async () => ({
fingerprint: "context",
probe: async () => {
- if (fail) throw Error("403 secret-credential-value");
+ if (fail)
+ throw new ProviderTurnError("secret-credential-value", {
+ code: "auth",
+ status: 403,
+ retryable: false,
+ raw: "",
+ });
},
}));
await store.upsert(spec, "admin");
@@ -124,20 +132,26 @@ test("a changed serving context during a probe is not certified", async () => {
assert.deepEqual(await store.statuses(), []);
});
-test("provider errors are actionable without exposing raw provider text", () => {
- for (const [raw, code] of [
- ["401 secret", "access_denied"],
- ["403 secret", "access_denied"],
- ["404 secret", "model_unavailable"],
- ["429 secret", "quota_or_rate_limit"],
- ["400 unsupported secret", "unsupported_configuration"],
- ["timeout secret", "timeout"],
- ["500 secret", "provider_failure"],
- ]) {
- const error = verificationFailure(new Error(raw));
- assert.equal(error.code, code);
- assert.doesNotMatch(error.message, /secret/);
- assert.ok(error instanceof ModelVerificationError);
+test("probe failures map from structured codes and error names, never provider text", () => {
+ const typed = (code: ProviderErrorCode, status?: number) =>
+ new ProviderTurnError("secret", { code, status, retryable: false, raw: "secret 401 429 timeout" });
+ for (const [error, code] of [
+ [typed("auth", 401), "access_denied"],
+ [typed("not_found", 404), "model_unavailable"],
+ [typed("rate_limit", 429), "quota_or_rate_limit"],
+ [typed("model_budget", 429), "quota_or_rate_limit"],
+ [typed("bad_request", 400), "unsupported_configuration"],
+ [typed("transient", 503), "provider_failure"],
+ [typed("unknown"), "provider_failure"],
+ [new DOMException("secret", "TimeoutError"), "timeout"],
+ [new DOMException("secret", "AbortError"), "timeout"],
+ [new GatewayModelUnavailableError("secret"), "model_unavailable"],
+ [new Error("401 timeout 429 secret"), "provider_failure"],
+ ] as const) {
+ const failure = verificationFailure(error);
+ assert.equal(failure.code, code);
+ assert.doesNotMatch(failure.message, /secret/);
+ assert.ok(failure instanceof ModelVerificationError);
}
});
@@ -314,7 +328,7 @@ test("a failed recheck of the saved definition removes its prior certification",
const store = createModelOverlayStore(createMemoryMap(), undefined, async () => ({
fingerprint: "context",
probe: async () => {
- if (fail) throw Error("403");
+ if (fail) throw new ProviderTurnError("403", { code: "auth", status: 403, retryable: false, raw: "" });
},
}));
await store.upsert(spec, "admin");
diff --git a/test/orchestrator.test.ts b/test/orchestrator.test.ts
index 7d3b0625b..75e83258a 100644
--- a/test/orchestrator.test.ts
+++ b/test/orchestrator.test.ts
@@ -1,6 +1,7 @@
import "./support/auto-fake-sprites.ts";
import { test } from "node:test";
import assert from "node:assert/strict";
+import { MODEL_BUDGET_TEXT } from "../src/core/turn-error.ts";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
@@ -4099,6 +4100,25 @@ test("repeated terminal failures keep failing loudly — history is never rewrit
);
});
+test("an exhausted model budget refuses the turn with a plain explanation instead of failing or retrying", async () => {
+ const { app, runs, errors } = freshApp();
+ const t1 = await app.turn(dm("hello"));
+ assert.equal(t1.status, "ok");
+
+ const refused = await app.turn(dm("!over-budget", { idempotencyKey: "over-budget-1" }));
+ assert.equal(refused.status, "refused");
+ assert.equal(refused.refusalKind, "model_budget");
+ assert.equal(refused.reason, MODEL_BUDGET_TEXT);
+ assert.equal(await runs.activeForThread("dm:U1:t1"), null, "nothing is requeued to hit the same limit again");
+
+ const found = await app.getSession(t1.sessionId!);
+ const failures = found!.entries.filter((e) => turnFailure(e));
+ assert.equal(failures.length, 1, "the explanation survives a reload");
+ assert.equal(turnFailure(failures[0]!)!.message, MODEL_BUDGET_TEXT);
+ const logged = (await errors.list()).find((e) => e.category === "turn" && e.code === "model_budget");
+ assert.match(logged!.message, /ExceededBudget: Team=team-a over 1d budget/, "operators keep the gateway's detail");
+});
+
test("a RETRYABLE error that exhausts its budget leaves one durable turn_failure record — no dead air", async () => {
const { app, runs, errors } = freshApp();
const t1 = await app.turn(dm("hello"));
diff --git a/test/pi-dependency-security.test.ts b/test/pi-dependency-security.test.ts
index 015d437cf..fb1f5d4f3 100644
--- a/test/pi-dependency-security.test.ts
+++ b/test/pi-dependency-security.test.ts
@@ -6,7 +6,7 @@ import test from "node:test";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
const piCodingAgentTarball =
- "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.5/earendil-works-pi-coding-agent-0.82.0-qm-security.5.tgz";
+ "https://github.com/yc-software/qm/releases/download/vendored-pi-coding-agent-0.82.0-security.6/earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz";
function installedVersion(path: string): string {
const manifestUrl = new URL(`../node_modules/${path}/package.json`, import.meta.url);
diff --git a/test/pi-harness-fast-mode.test.ts b/test/pi-harness-fast-mode.test.ts
index b2755dd1d..963531a9e 100644
--- a/test/pi-harness-fast-mode.test.ts
+++ b/test/pi-harness-fast-mode.test.ts
@@ -283,7 +283,7 @@ function responsesReply(text: string, usage: Record<string, unknown>, serviceTie
]);
}
-function anthropicReply(text: string, usage: Record<string, unknown>): Response {
+function anthropicReply(text: string, usage: Record<string, unknown>, stopReason = "end_turn"): Response {
return sse([
{
type: "message_start",
@@ -294,7 +294,7 @@ function anthropicReply(text: string, usage: Record<string, unknown>): Response
{ type: "content_block_stop", index: 0 },
{
type: "message_delta",
- delta: { stop_reason: "end_turn" },
+ delta: { stop_reason: stopReason },
usage: { output_tokens: usage.output_tokens as number },
},
{ type: "message_stop" },
@@ -435,16 +435,7 @@ test("gateway-routed Claude requests carry neither the binding beta nor block_bi
test("a refusal fallback prices each step on its actual model and tier", async () => {
const { rows, payloads } = await runTurn("refusal-fallback-pricing", "claude-sonnet-5", true, (_payload, index) =>
index === 0
- ? new Response(
- JSON.stringify({
- type: "error",
- error: {
- type: "api_error",
- message: "Output blocked by content filtering policy: this would violate Anthropic's usage policy.",
- },
- }),
- { status: 400, headers: { "content-type": "application/json" } },
- )
+ ? anthropicReply("", ANTHROPIC_WIRE_USAGE, "refusal")
: anthropicReply("recovered", ANTHROPIC_WIRE_USAGE),
);
assert.equal(payloads.length, 2);
@@ -459,7 +450,7 @@ test("a refusal fallback prices each step on its actual model and tier", async (
[1, "claude-opus-5"],
],
);
- assertUsd(rows[0]!.usage!.costUsd, 0);
+ assertUsd(rows[0]!.usage!.costUsd, 0.03); // a stop_reason refusal is a billed 200 response
assertUsd(rows[1]!.usage!.costUsd, 0.15);
});
@@ -480,24 +471,13 @@ for (const gateway of [true, false]) {
});
}
-const USAGE_POLICY_REFUSAL =
- "This request triggered restrictions on violative cyber content and was blocked under Anthropic's Usage Policy. To learn more, see https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback.";
-
-test("a current Usage Policy refusal retries on the admin-configured fallback runtime", async () => {
+test("a stop_reason refusal retries on the admin-configured fallback runtime", async () => {
const { payloads } = await runTurn(
"refusal-configured-fallback",
"claude-sonnet-5",
false,
(_payload, index) =>
- index === 0
- ? new Response(
- JSON.stringify({ type: "error", error: { type: "invalid_request_error", message: USAGE_POLICY_REFUSAL } }),
- {
- status: 400,
- headers: { "content-type": "application/json" },
- },
- )
- : responsesReply("recovered", ASTRA_WIRE_USAGE),
+ index === 0 ? anthropicReply("", ANTHROPIC_WIRE_USAGE, "refusal") : responsesReply("recovered", ASTRA_WIRE_USAGE),
false,
{ resolveFallbackRuntime: () => ({ modelId: "gpt-6-sol", effortLevel: "low" }) },
);
@@ -506,8 +486,8 @@ test("a current Usage Policy refusal retries on the admin-configured fallback ru
assert.equal((payloads[1]?.reasoning as { effort?: string } | undefined)?.effort, "low");
});
-test("an unavailable gateway model retries on the configured fallback instead of failing the turn", async () => {
- const { payloads } = await runTurn(
+test("an unavailable gateway model fails the turn without fallback (no structured signal)", async () => {
+ const outcome = await runTurn(
"unavailable-configured-fallback",
"claude-sonnet-5",
false,
@@ -523,11 +503,11 @@ test("an unavailable gateway model retries on the configured fallback instead of
},
resolveFallbackRuntime: () => ({ modelId: "gpt-6-sol", effortLevel: "low" }),
},
+ ).then(
+ ({ payloads }) => payloads,
+ () => [],
);
- assert.deepEqual(
- payloads.map((p) => p.model),
- ["gpt-6-sol"],
- );
+ assert.deepEqual(outcome, []);
});
test("compaction retries a refused summary on the configured fallback model", async () => {
@@ -543,13 +523,7 @@ test("compaction retries a refused summary on the configured fallback model", as
const payload = JSON.parse(String(init?.body ?? "{}")) as Record<string, unknown>;
models.push(payload.model);
return models.length === 1
- ? new Response(
- JSON.stringify({ type: "error", error: { type: "invalid_request_error", message: USAGE_POLICY_REFUSAL } }),
- {
- status: 400,
- headers: { "content-type": "application/json" },
- },
- )
+ ? anthropicReply("", ANTHROPIC_WIRE_USAGE, "refusal")
: responsesReply("summary of the work", ASTRA_WIRE_USAGE);
}) as typeof globalThis.fetch;
try {
diff --git a/test/pi-harness-goal-provider-failure.test.ts b/test/pi-harness-goal-provider-failure.test.ts
index ceadad8f5..a86abb44c 100644
--- a/test/pi-harness-goal-provider-failure.test.ts
+++ b/test/pi-harness-goal-provider-failure.test.ts
@@ -2,7 +2,7 @@ import { test } from "node:test";
import assert from "node:assert/strict";
import { createGoalRecord, latestGoalRecord } from "../src/harness/goal.ts";
import { createPiHarness } from "../src/harness/pi-harness.ts";
-import { NonRetryableTurnError } from "../src/core/turn-error.ts";
+import { ProviderTurnError } from "../src/core/turn-error.ts";
import type { HarnessTurnInput } from "../src/harness/harness.ts";
import type { NewEntry } from "../src/sessions/session-store.ts";
import type { SessionEntry } from "../src/types.ts";
@@ -65,7 +65,7 @@ test("an active goal stops continuing once a model round fails at the provider",
);
assert.equal(requests, 1, "a failed round must not be re-prompted by the goal loop");
assert.ok(
- "error" in outcome && outcome.error instanceof NonRetryableTurnError,
+ "error" in outcome && outcome.error instanceof ProviderTurnError && !outcome.error.retryable,
"the turn fails with the provider error",
);
assert.match((outcome as { error: Error }).error.message, /credit balance is too low/);
@@ -75,7 +75,7 @@ test("an active goal stops continuing once a model round fails at the provider",
}
});
-function textStream(text: string): Response {
+function textStream(text: string, stopReason = "end_turn"): Response {
const event = (name: string, data: unknown) => `event: ${name}\ndata: ${JSON.stringify(data)}\n\n`;
return new Response(
event("message_start", {
@@ -99,7 +99,7 @@ function textStream(text: string): Response {
event("content_block_stop", { type: "content_block_stop", index: 0 }) +
event("message_delta", {
type: "message_delta",
- delta: { stop_reason: "end_turn" },
+ delta: { stop_reason: stopReason },
usage: { output_tokens: 3 },
}) +
event("message_stop", { type: "message_stop" }),
@@ -117,17 +117,7 @@ test("a refused goal round falls back to another model and the goal keeps going"
const model = (JSON.parse(String(init?.body ?? "{}")) as { model: string }).model;
models.push(model);
if (models.length >= 5) controller.abort();
- if (models.length >= 2 && model === models[0])
- return new Response(
- JSON.stringify({
- type: "error",
- error: {
- type: "invalid_request_error",
- message: "API integrators: you can reduce refusals for your users by configuring a fallback model",
- },
- }),
- { status: 400, headers: { "content-type": "application/json" } },
- );
+ if (models.length >= 2 && model === models[0]) return textStream("", "refusal");
return textStream(`reply ${models.length}`);
}) as typeof globalThis.fetch;
try {
@@ -155,16 +145,7 @@ test("a goal never falls back to a model that already refused in the same turn",
const latest = JSON.stringify(request.messages.at(-1));
if (models.length === 1 || latest.includes("could not answer this request"))
return textStream(`reply ${models.length}`);
- return new Response(
- JSON.stringify({
- type: "error",
- error: {
- type: "invalid_request_error",
- message: "API integrators: you can reduce refusals for your users by configuring a fallback model",
- },
- }),
- { status: 400, headers: { "content-type": "application/json" } },
- );
+ return textStream("", "refusal");
}) as typeof globalThis.fetch;
try {
const outcome = await harness.turns.runTurn(goalTurn("goal-refusal-alternation", controller.signal, entries)).then(
@@ -174,7 +155,7 @@ test("a goal never falls back to a model that already refused in the same turn",
const [primary, refused, fallback, refusedAgain] = models;
assert.deepEqual([refused, refusedAgain], [primary, fallback]);
assert.equal(models.length, 4, "the turn ends instead of bouncing back to the model that already refused");
- assert.ok("error" in outcome && outcome.error instanceof NonRetryableTurnError);
+ assert.ok("error" in outcome && outcome.error instanceof ProviderTurnError && !outcome.error.retryable);
assert.equal(latestGoalRecord(entries)?.status, "active");
} finally {
globalThis.fetch = realFetch;
diff --git a/test/pi-harness-oneshot.test.ts b/test/pi-harness-oneshot.test.ts
index 44b698963..e91ba6193 100644
--- a/test/pi-harness-oneshot.test.ts
+++ b/test/pi-harness-oneshot.test.ts
@@ -11,7 +11,6 @@ import {
oneShot,
parseDetectVerdict,
piHarnessConfigOptions,
- isProviderRefusal,
piLastAssistantTextOrThrow,
piTurnError,
providerRefusalError,
@@ -32,7 +31,7 @@ import { modelGatewayRequest } from "../src/model/provider-endpoints.ts";
import { reconstructMessagesFromHistory } from "../src/harness/replay.ts";
import type { SessionEntry } from "../src/types.ts";
import { testConfig } from "./support/test-config.ts";
-import { NonRetryableTurnError, ProviderTurnError, turnFailureMessage } from "../src/core/turn-error.ts";
+import { ProviderTurnError, turnFailureMessage } from "../src/core/turn-error.ts";
function countTempDirs(prefix: string): number {
return readdirSync(tmpdir()).filter((name) => name.startsWith(prefix)).length;
@@ -578,20 +577,30 @@ test("Pi assistant error messages fail the turn instead of becoming a blank repl
assert.throws(() => piLastAssistantTextOrThrow(session), /provider quota exhausted/);
});
-test("Pi provider JSON errors are surfaced as readable chat errors", () => {
- const session = {
+type FailedFields = { errorMessage?: string; providerError?: unknown; rawStopReason?: string };
+const failedSession = (...messages: FailedFields[]) =>
+ ({
getLastAssistantText: () => undefined,
- messages: [
- {
- role: "assistant",
- stopReason: "error",
- errorMessage:
- '400 {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low."},"request_id":"req_123"}',
- content: [],
- },
- ],
- } as unknown as Parameters<typeof piLastAssistantTextOrThrow>[0];
-
+ messages: messages.map((m) => ({ role: "assistant", stopReason: "error", content: [], ...m })),
+ }) as unknown as Parameters<typeof piTurnError>[0];
+const overloaded = {
+ errorMessage: "529 Overloaded",
+ providerError: {
+ status: 529,
+ type: "overloaded_error",
+ body: { type: "error", error: { type: "overloaded_error", message: "Overloaded" } },
+ },
+};
+
+test("Pi provider errors are surfaced from the structured body as readable chat errors", () => {
+ const session = failedSession({
+ errorMessage: "400 Your credit balance is too low.",
+ providerError: {
+ status: 400,
+ type: "invalid_request_error",
+ body: { type: "error", error: { type: "invalid_request_error", message: "Your credit balance is too low." } },
+ },
+ });
assert.throws(
() => piLastAssistantTextOrThrow(session),
/Model provider API error \(invalid_request_error\): Your credit balance is too low\./,
@@ -599,52 +608,33 @@ test("Pi provider JSON errors are surfaced as readable chat errors", () => {
});
test("piTurnError recovers the session's structured error when the agent loop rejects generically", () => {
- const session = {
- getLastAssistantText: () => undefined,
- messages: [
- {
- role: "assistant",
- stopReason: "error",
- errorMessage: '{"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}',
- content: [],
- },
- ],
- } as unknown as Parameters<typeof piTurnError>[0];
-
- const err = piTurnError(session, new Error("An unknown error occurred"));
+ const err = piTurnError(failedSession(overloaded), new Error("An unknown error occurred"));
assert.match(err.message, /Model provider API error \(overloaded_error\): Overloaded/);
});
-test("transient Pi provider errors stay retryable and keep their message for the final failure", () => {
- const failed = (errorMessage: string) =>
- ({
- getLastAssistantText: () => undefined,
- messages: [{ role: "assistant", stopReason: "error", errorMessage, content: [] }],
- }) as unknown as Parameters<typeof piTurnError>[0];
-
- for (const errorMessage of [
- '529 {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}',
- '500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}}',
- "429 rate limit exceeded",
- "fetch failed",
- ]) {
- const err = piTurnError(failed(errorMessage), new Error("An unknown error occurred"));
- assert.ok(err instanceof ProviderTurnError, errorMessage);
- assert.ok(!(err instanceof NonRetryableTurnError), errorMessage);
+test("Pi retryability comes from status and type, never errorMessage", () => {
+ const retryable: FailedFields[] = [
+ overloaded,
+ { errorMessage: "500", providerError: { status: 500, type: "api_error" } },
+ { errorMessage: "429", providerError: { status: 429 } },
+ { errorMessage: "fetch failed" },
+ ];
+ for (const fields of retryable) {
+ const err = piTurnError(failedSession(fields), new Error("x"));
+ assert.ok(err instanceof ProviderTurnError && err.retryable, JSON.stringify(fields));
assert.equal(turnFailureMessage(err), err.message);
- assert.throws(() => piLastAssistantTextOrThrow(failed(errorMessage)), ProviderTurnError);
+ assert.throws(() => piLastAssistantTextOrThrow(failedSession(fields)), ProviderTurnError);
}
-
- for (const errorMessage of [
- '400 {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low."}}',
- "429 insufficient_quota",
- '400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 215003 tokens > 200000 maximum"}}',
- "prompt is too long: 215003 tokens > 200000 maximum",
- '400 {"type":"error","error":{"type":"invalid_request_error","message":"thinking.budget_tokens must be at least 1500"}}',
- '400 {"type":"invalid_request_error","message":"max_tokens must be at most 50000"}',
- '429 {"type":"error","error":{"type":"rate_limit_error","message":"quota exceeded"}}',
- ]) {
- assert.ok(piTurnError(failed(errorMessage), new Error("x")) instanceof NonRetryableTurnError, errorMessage);
+ const terminal: FailedFields[] = [
+ { errorMessage: "429 overloaded, retry", providerError: { status: 429, code: "insufficient_quota" } },
+ { errorMessage: "rate limit", providerError: { status: 400, type: "invalid_request_error" } },
+ { errorMessage: "503", providerError: { status: 400, code: "context_length_exceeded" } },
+ { errorMessage: "overloaded", providerError: { status: 401, type: "authentication_error" } },
+ { errorMessage: "network error", rawStopReason: "refusal" },
+ ];
+ for (const fields of terminal) {
+ const err = piTurnError(failedSession(fields), new Error("x"));
+ assert.ok(err instanceof ProviderTurnError && !err.retryable, JSON.stringify(fields));
}
});
@@ -659,18 +649,7 @@ test("piTurnError falls back to the thrown error when the session has no structu
});
test("piTurnError ignores a PRIOR turn's stale error when nothing new was appended this prompt", () => {
- const session = {
- getLastAssistantText: () => undefined,
- messages: [
- {
- role: "assistant",
- stopReason: "error",
- errorMessage: '{"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}',
- content: [],
- },
- ],
- } as unknown as Parameters<typeof piTurnError>[0];
-
+ const session = failedSession(overloaded);
const err = piTurnError(session, new Error("socket hang up"), 1);
assert.equal(err.message, "socket hang up");
const recovered = piTurnError(session, new Error("An unknown error occurred"), 0);
@@ -915,31 +894,50 @@ test("resolveConfiguredModelId: known ids pass through, unknown ids fall back to
assert.equal(resolveConfiguredModelId("claude-dropped-by-pi-ai", "claude-opus-4-8"), "claude-opus-4-8");
});
-test("isProviderRefusal matches Anthropic's ToS-refusal wording and nothing else", () => {
- assert.equal(
- isProviderRefusal(
- "Anthropic API error (invalid_request_error): This request was blocked as it seems to violate Anthropic's Terms of Service restrictions on reverse engineering or duplicating model outputs. To learn more, visit https://www.anthropic.com/legal/commercial-terms. API integrators: you can reduce refusals for your users by configuring a fallback model — see https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback.",
- ),
- true,
- );
- assert.equal(isProviderRefusal("This request seems to violate Anthropic’s usage policy."), true);
- assert.equal(
- isProviderRefusal(
- "This request triggered restrictions on violative cyber content and was blocked under Anthropic's Usage Policy. To learn more, see https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback.",
- ),
- true,
- );
- assert.equal(isProviderRefusal("The model refused to complete the request"), true);
- assert.equal(isProviderRefusal("Gateway model is unavailable: claude-opus-5-5"), true);
- assert.equal(isProviderRefusal("Anthropic API error (overloaded_error): Overloaded"), false);
- assert.equal(isProviderRefusal("prompt is too long: 250000 tokens > 200000 maximum"), false);
- assert.equal(isProviderRefusal(undefined), false);
+test("Pi provider errors are classified once into a typed code from structured fields", () => {
+ const classify = (fields: FailedFields) => piTurnError(failedSession(fields), new Error("x")) as ProviderTurnError;
+ const budget = classify({
+ errorMessage: "429: Budget has been exceeded! Limit=$1000.00",
+ providerError: {
+ status: 429,
+ type: "budget_exceeded",
+ code: "400",
+ body: { message: "Budget has been exceeded! Limit=$1000.00", type: "budget_exceeded" },
+ },
+ });
+ assert.deepEqual([budget.code, budget.status, budget.retryable], ["model_budget", 429, false]);
+ assert.match(budget.raw, /Limit=\$1000\.00/, "the gateway's full text is kept for operators");
+ assert.match(budget.message, /Budget has been exceeded/);
+ const cases: Array<[FailedFields, string, number | undefined]> = [
+ [{ providerError: { status: 429, type: "rate_limit_error" } }, "rate_limit", 429],
+ [{ providerError: { status: 401, type: "authentication_error" } }, "auth", 401],
+ [{ providerError: { status: 403 } }, "auth", 403],
+ [{ providerError: { status: 400, code: "context_length_exceeded" } }, "context_too_long", 400],
+ [{ providerError: { status: 529, type: "overloaded_error" } }, "transient", 529],
+ [{ rawStopReason: "refusal" }, "refusal", undefined],
+ // Anthropic documents prompt-too-long only as a 400 invalid_request_error, so it is a bad_request, not context_too_long.
+ [
+ {
+ errorMessage: "prompt is too long: 250000 tokens > 200000 maximum",
+ providerError: { status: 400, type: "invalid_request_error" },
+ },
+ "bad_request",
+ 400,
+ ],
+ [{ errorMessage: "The model refused to complete the request" }, "unknown", undefined],
+ ];
+ for (const [fields, code, status] of cases) {
+ const err = classify(fields);
+ assert.equal(err.code, code, JSON.stringify(fields));
+ assert.equal(err.status, status, JSON.stringify(fields));
+ }
});
test("providerRefusalError finds this prompt's refusal but never a prior turn's", () => {
const refusalMsg = {
role: "assistant",
stopReason: "error",
+ rawStopReason: "refusal",
errorMessage:
"This request was blocked as it seems to violate Anthropic's Terms of Service restrictions on reverse engineering or duplicating model outputs.",
content: [],
diff --git a/test/provider-error.test.ts b/test/provider-error.test.ts
new file mode 100644
index 000000000..b54cb9ac2
--- /dev/null
+++ b/test/provider-error.test.ts
@@ -0,0 +1,121 @@
+import assert from "node:assert/strict";
+import { createServer } from "node:http";
+import test from "node:test";
+import type { AssistantMessage, Model } from "@earendil-works/pi-ai";
+import { stream } from "@earendil-works/pi-ai/api/openai-completions";
+import { providerTurnError } from "../src/harness/provider-error.ts";
+
+test("vendored pi-ai keeps a LiteLLM 429 budget_exceeded as structured providerError", async (t) => {
+ const body = {
+ error: {
+ message: "Budget has been exceeded! Current cost: 5.1, Max budget: 5.0",
+ type: "budget_exceeded",
+ param: null,
+ code: "400",
+ },
+ };
+ const server = createServer((_req, res) => {
+ res.writeHead(429, { "content-type": "application/json" });
+ res.end(JSON.stringify(body));
+ });
+ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
+ t.after(() => server.close());
+ const { port } = server.address() as { port: number };
+ const model = {
+ id: "litellm-model",
+ name: "litellm-model",
+ api: "openai-completions",
+ provider: "litellm",
+ baseUrl: `http://127.0.0.1:${port}/v1`,
+ reasoning: false,
+ input: ["text"],
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
+ contextWindow: 1000,
+ maxTokens: 100,
+ } as Model<"openai-completions">;
+
+ const failed = await stream(
+ model,
+ { messages: [{ role: "user", content: "hi", timestamp: 0 }] },
+ {
+ apiKey: "test-key",
+ maxRetries: 0,
+ },
+ ).result();
+
+ assert.equal(failed.stopReason, "error");
+ assert.deepEqual(failed.providerError, { status: 429, type: "budget_exceeded", code: "400", body: body.error });
+ assert.match(failed.errorMessage ?? "", /^429: /, "errorMessage keeps stock pi-ai formatting");
+ const err = providerTurnError(failed);
+ assert.deepEqual([err.code, err.status, err.retryable], ["model_budget", 429, false]);
+});
+
+test("providerTurnError maps documented status, type and code without reading errorMessage", () => {
+ const failed = (providerError: AssistantMessage["providerError"], rawStopReason?: string) =>
+ ({
+ role: "assistant",
+ stopReason: "error",
+ errorMessage: "429 budget refusal timeout",
+ providerError,
+ rawStopReason,
+ }) as AssistantMessage;
+ for (const [message, code, retryable] of [
+ [failed({ status: 429, type: "budget_exceeded" }), "model_budget", false],
+ [failed({ status: 429, code: "insufficient_quota" }), "model_budget", false],
+ [failed({ status: 400, code: "context_length_exceeded" }), "context_too_long", false],
+ [failed({ status: 401, type: "authentication_error" }), "auth", false],
+ [failed({ status: 429, type: "rate_limit_error" }), "rate_limit", true],
+ [failed({ status: 404, type: "not_found_error" }), "not_found", false],
+ [failed({ status: 404, code: "model_not_found" }), "not_found", false],
+ [failed({ status: 400, type: "invalid_request_error" }), "bad_request", false],
+ [failed({ status: 422 }), "bad_request", false],
+ [failed({ status: 529, type: "overloaded_error" }), "transient", true],
+ [failed({ status: 503, type: "invalid_request_error" }), "transient", true],
+ [failed(undefined, "refusal"), "refusal", false],
+ [failed(undefined), "unknown", true],
+ ] as const) {
+ const error = providerTurnError(message);
+ assert.equal(error.code, code);
+ assert.equal(error.retryable, retryable);
+ assert.equal(error.raw, "429 budget refusal timeout");
+ }
+});
+
+function failedWith(providerError: AssistantMessage["providerError"]): AssistantMessage {
+ return {
+ role: "assistant",
+ content: [],
+ api: "anthropic-messages",
+ provider: "anthropic",
+ model: "claude-sonnet-5",
+ usage: {
+ input: 0,
+ output: 0,
+ cacheRead: 0,
+ cacheWrite: 0,
+ totalTokens: 0,
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
+ },
+ stopReason: "error",
+ errorMessage: "irrelevant text",
+ timestamp: 0,
+ ...(providerError ? { providerError } : {}),
+ } as AssistantMessage;
+}
+
+test("gateway model_unavailable is its own code so the turn falls back", () => {
+ assert.equal(providerTurnError(failedWith({ status: 404, type: "model_unavailable" })).code, "model_unavailable");
+});
+
+test("over-window prompts classify as context_too_long from structured signals", () => {
+ assert.equal(providerTurnError(failedWith({ status: 413, type: "request_too_large" })).code, "context_too_long");
+ const anthropic400 = failedWith({ status: 400, type: "invalid_request_error" });
+ assert.equal(
+ providerTurnError(anthropic400, { contextWindow: 200_000, lastInputTokens: 195_000 }).code,
+ "context_too_long",
+ );
+ assert.equal(
+ providerTurnError(anthropic400, { contextWindow: 200_000, lastInputTokens: 20_000 }).code,
+ "bad_request",
+ );
+});
diff --git a/test/run-result-delivery.test.ts b/test/run-result-delivery.test.ts
index ca1534bd4..7b35d56f4 100644
--- a/test/run-result-delivery.test.ts
+++ b/test/run-result-delivery.test.ts
@@ -125,6 +125,15 @@ test("runResultDelivery still posts a surface-spine turn's FAILURE note", () =>
assert.equal(runResultDelivery(spine)?.text, "⚠️ I couldn't finish that turn: something went wrong on my end");
});
+test("runResultDelivery recovers an addressed model-budget refusal with its explanation", () => {
+ const reason = "This workspace has used up its model budget, so I can't run until it resets.";
+ const spine = run({ result: { status: "refused", refusalKind: "model_budget", reason } });
+ spine.request = { ...spine.request, surfaceTools: true, addressed: true };
+ assert.equal(runResultDelivery(spine)?.text, reason);
+ spine.request = { ...spine.request, addressed: false, origin: { kind: "ambient" } };
+ assert.equal(runResultDelivery(spine), null);
+});
+
test("runResultDelivery recovers a security quarantine without exposing its internal reason", () => {
const d = runResultDelivery(
run({
diff --git a/vendor/pi-ai/README.md b/vendor/pi-ai/README.md
new file mode 100644
index 000000000..36d7f59dd
--- /dev/null
+++ b/vendor/pi-ai/README.md
@@ -0,0 +1,28 @@
+# Vendored pi-ai 0.82.0 (qm.1)
+
+qm installs `@earendil-works/pi-ai` from the GitHub release
+[`vendored-pi-ai-0.82.0-qm.1`](https://github.com/yc-software/qm/releases/tag/vendored-pi-ai-0.82.0-qm.1),
+built from stock npm 0.82.0 plus `provider-error.patch` (dist only; version unchanged; not sent upstream).
+
+Why: stock pi-ai folds a provider HTTP failure into the display string `errorMessage`, so qm had to
+parse text to tell a budget cap from a rate limit. The patch keeps the structured data next to it:
+
+- `AssistantMessage.providerError?: { status?, type?, code?, body? }`, from the SDK error, in the
+ error path of openai-completions, openai-responses, azure-openai-responses, openai-codex-responses,
+ anthropic-messages, google-generative-ai, google-vertex, mistral-conversations and
+ bedrock-converse-stream (`extractProviderError` in `dist/utils/error-body.js`).
+- `AssistantMessage.rawStopReason?: string` when a stop/finish reason maps to `stopReason: "error"`
+ (anthropic-messages, openai-completions, bedrock-converse-stream), e.g. Anthropic `refusal`.
+
+`errorMessage` is byte-for-byte what stock 0.82.0 produces.
+
+The vendored pi-coding-agent (`vendored-pi-coding-agent-0.82.0-security.6`) is security.5 with only its
+`npm-shrinkwrap.json` pi-ai entry repointed at this tarball, so there is one pi-ai in the tree; the root
+`overrides` entry enforces the same.
+
+Rebuild (both are byte-reproducible and verify their inputs' SHA-256):
+
+ vendor/pi-ai/build.sh # earendil-works-pi-ai-0.82.0-qm.1.tgz
+ vendor/pi-ai/repack-coding-agent.sh # earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz
+
+Drop this directory when qm upgrades past 0.82.0 to a pi-ai that exposes equivalent fields.
diff --git a/vendor/pi-ai/build.sh b/vendor/pi-ai/build.sh
new file mode 100755
index 000000000..3186002bc
--- /dev/null
+++ b/vendor/pi-ai/build.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# Rebuilds the vendored pi-ai tarball: stock npm 0.82.0 + provider-error.patch.
+# Output: earendil-works-pi-ai-0.82.0-qm.1.tgz in the current directory.
+set -euo pipefail
+here="$(cd "$(dirname "$0")" && pwd)"
+work="$(mktemp -d)"
+trap 'rm -rf "$work"' EXIT
+curl -fsSL -o "$work/stock.tgz" https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.82.0.tgz
+echo "761e2492dab7bf5601143d005b9f82ec9000338d02d06f737b6574e057fd61c3 $work/stock.tgz" | sha256sum -c -
+tar xzf "$work/stock.tgz" -C "$work"
+git -C "$work/package" apply -p1 "$here/provider-error.patch"
+npm pack --silent "$work/package" --pack-destination "$work" >/dev/null
+mv "$work/earendil-works-pi-ai-0.82.0.tgz" ./earendil-works-pi-ai-0.82.0-qm.1.tgz
+sha256sum earendil-works-pi-ai-0.82.0-qm.1.tgz
diff --git a/vendor/pi-ai/provider-error.patch b/vendor/pi-ai/provider-error.patch
new file mode 100644
index 000000000..8b8bad6f2
--- /dev/null
+++ b/vendor/pi-ai/provider-error.patch
@@ -0,0 +1,302 @@
+--- a/dist/api/anthropic-messages.js
++++ b/dist/api/anthropic-messages.js
+@@ -1,3 +1,4 @@
++import { extractProviderError } from "../utils/error-body.js";
+ import Anthropic from "@anthropic-ai/sdk";
+ import { calculateCost } from "../models.js";
+ import { splitDeferredTools } from "../utils/deferred-tools.js";
+@@ -531,6 +532,8 @@
+ if (stopReasonResult.errorMessage) {
+ output.errorMessage = stopReasonResult.errorMessage;
+ }
++ if (stopReasonResult.stopReason === "error")
++ output.rawStopReason = event.delta.stop_reason;
+ }
+ // Only update usage fields if present (not null).
+ // Preserves input_tokens from message_start when proxies omit it in message_delta.
+@@ -579,6 +582,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/azure-openai-responses.js
++++ b/dist/api/azure-openai-responses.js
+@@ -1,6 +1,6 @@
+ import { AzureOpenAI } from "openai";
+ import { clampThinkingLevel } from "../models.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { headersToRecord } from "../utils/headers.js";
+ import { getProviderEnvValue } from "../utils/provider-env.js";
+@@ -107,6 +107,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatAzureOpenAIError(error);
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/bedrock-converse-stream.js
++++ b/dist/api/bedrock-converse-stream.js
+@@ -3,7 +3,7 @@
+ import { HttpProxyAgent } from "http-proxy-agent";
+ import { HttpsProxyAgent } from "https-proxy-agent";
+ import { calculateCost } from "../models.js";
+-import { normalizeProviderError } from "../utils/error-body.js";
++import { normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { providerHeadersToRecord } from "../utils/headers.js";
+ import { parseStreamingJson } from "../utils/json-parse.js";
+@@ -164,6 +164,8 @@
+ if (errorMessage) {
+ output.errorMessage = errorMessage;
+ }
++ if (stopReason === "error")
++ output.rawStopReason = item.messageStop.stopReason;
+ }
+ else if (item.metadata) {
+ handleMetadata(item.metadata, model, output);
+@@ -201,6 +203,9 @@
+ }
+ output.stopReason = options.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatBedrockError(error);
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/google-generative-ai.js
++++ b/dist/api/google-generative-ai.js
+@@ -1,6 +1,6 @@
+ import { GoogleGenAI, } from "@google/genai";
+ import { calculateCost, clampThinkingLevel } from "../models.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { providerHeadersToRecord } from "../utils/headers.js";
+ import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
+@@ -212,6 +212,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatProviderError(normalizeProviderError(error));
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/google-vertex.js
++++ b/dist/api/google-vertex.js
+@@ -1,6 +1,6 @@
+ import { GoogleGenAI, ResourceScope, ThinkingLevel, } from "@google/genai";
+ import { calculateCost, clampThinkingLevel } from "../models.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { providerHeadersToRecord } from "../utils/headers.js";
+ import { getProviderEnvValue } from "../utils/provider-env.js";
+@@ -221,6 +221,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatProviderError(normalizeProviderError(error));
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/mistral-conversations.js
++++ b/dist/api/mistral-conversations.js
+@@ -1,3 +1,4 @@
++import { extractProviderError } from "../utils/error-body.js";
+ import { Mistral } from "@mistralai/mistralai";
+ import { calculateCost, clampThinkingLevel } from "../models.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+@@ -52,6 +53,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatMistralError(error);
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/openai-codex-responses.js
++++ b/dist/api/openai-codex-responses.js
+@@ -11,7 +11,7 @@
+ import { combineAbortSignals } from "../utils/abort-signals.js";
+ import { splitDeferredTools } from "../utils/deferred-tools.js";
+ import { appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, formatThrownValue, } from "../utils/diagnostics.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { headersToRecord } from "../utils/headers.js";
+ import { resolveHttpProxyUrlForTarget } from "../utils/node-http-proxy.js";
+@@ -340,6 +340,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatProviderError(normalizeProviderError(error));
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/api/openai-completions.js
++++ b/dist/api/openai-completions.js
+@@ -1,6 +1,6 @@
+ import OpenAI from "openai";
+ import { calculateCost, clampThinkingLevel } from "../models.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { shortHash } from "../utils/hash.js";
+ import { headersToRecord } from "../utils/headers.js";
+@@ -331,6 +331,8 @@
+ if (finishReasonResult.errorMessage) {
+ output.errorMessage = finishReasonResult.errorMessage;
+ }
++ if (finishReasonResult.stopReason === "error")
++ output.rawStopReason = choice.finish_reason;
+ hasFinishReason = true;
+ }
+ if (choice.delta) {
+@@ -450,6 +452,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatProviderError(normalizeProviderError(error));
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ // Some providers via OpenRouter give additional information in this field.
+ // normalizeProviderError already stringifies the parsed body (error.error)
+ // into errorMessage, so only append the raw metadata when it is not already
+--- a/dist/api/openai-responses.js
++++ b/dist/api/openai-responses.js
+@@ -1,7 +1,7 @@
+ import OpenAI from "openai";
+ import { clampThinkingLevel } from "../models.js";
+ import { splitDeferredTools } from "../utils/deferred-tools.js";
+-import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
++import { formatProviderError, normalizeProviderError, extractProviderError } from "../utils/error-body.js";
+ import { AssistantMessageEventStream } from "../utils/event-stream.js";
+ import { headersToRecord } from "../utils/headers.js";
+ import { getProviderEnvValue } from "../utils/provider-env.js";
+@@ -136,6 +136,9 @@
+ }
+ output.stopReason = options?.signal?.aborted ? "aborted" : "error";
+ output.errorMessage = formatOpenAIResponsesError(error);
++ const providerError = extractProviderError(error);
++ if (providerError)
++ output.providerError = providerError;
+ stream.push({ type: "error", reason: output.stopReason, error: output });
+ stream.end();
+ }
+--- a/dist/types.d.ts
++++ b/dist/types.d.ts
+@@ -288,8 +288,19 @@
+ usage: Usage;
+ stopReason: StopReason;
+ errorMessage?: string;
++ /** qm patch: structured provider HTTP failure (status, error type/code, parsed body). errorMessage is unchanged. */
++ providerError?: ProviderErrorInfo;
++ /** qm patch: the provider's raw stop/finish reason when it mapped to stopReason "error" (e.g. Anthropic "refusal"). */
++ rawStopReason?: string;
+ timestamp: number;
+ }
++/** qm patch: structured provider HTTP failure kept alongside errorMessage. */
++export interface ProviderErrorInfo {
++ status?: number;
++ type?: string;
++ code?: string;
++ body?: unknown;
++}
+ export interface ToolResultMessage<TDetails = any> {
+ role: "toolResult";
+ toolCallId: string;
+--- a/dist/utils/error-body.d.ts
++++ b/dist/utils/error-body.d.ts
+@@ -19,6 +19,9 @@
+ * - no prefix: `"<status>: <body>"`
+ * - prefix: `"<prefix> (<status>): <body>"`
+ */
++/** qm patch: structured provider failure; see AssistantMessage.providerError. */
++export declare function extractProviderError(error: unknown): ProviderErrorInfo | undefined;
++import type { ProviderErrorInfo } from "../types.js";
+ export declare function formatProviderError(norm: NormalizedProviderError, prefix?: string): string;
+ export declare function truncateErrorText(text: string, maxChars: number): string;
+ export declare function safeJsonStringify(value: unknown): string;
+--- a/dist/utils/error-body.js
++++ b/dist/utils/error-body.js
+@@ -29,6 +29,61 @@
+ };
+ }
+ /**
++ * qm patch (vendored-pi-ai-0.82.0-qm.1): structured copy of a provider HTTP
++ * failure, kept next to errorMessage so callers can classify failures without
++ * parsing display text. Returns undefined when the error carries neither an
++ * HTTP status nor a response body (e.g. a plain network or abort error).
++ */
++export function extractProviderError(error) {
++ if (!(error instanceof Error))
++ return undefined;
++ const sdkError = error;
++ const status = extractStatus(sdkError);
++ const body = pickBodyValue(sdkError);
++ if (status === undefined && body === undefined)
++ return undefined;
++ const nested = isRecord(body) && isRecord(body.error) ? body.error : undefined;
++ const type = firstString(sdkError.type, nested?.type, isRecord(body) && body.type !== "error" ? body.type : undefined);
++ const code = firstString(status === undefined ? undefined : sdkError.code, nested?.code, isRecord(body) ? body.code : undefined);
++ const result = {};
++ if (status !== undefined)
++ result.status = status;
++ if (type !== undefined)
++ result.type = type;
++ if (code !== undefined)
++ result.code = code;
++ if (body !== undefined)
++ result.body = body;
++ return result;
++}
++function pickBodyValue(error) {
++ if (isNonEmptyObject(error.error))
++ return error.error;
++ const raw = typeof error.body === "string" ? error.body : error.$response?.body;
++ if (isNonEmptyObject(raw))
++ return raw;
++ if (typeof raw !== "string" || raw.trim().length === 0)
++ return undefined;
++ try {
++ return JSON.parse(raw);
++ }
++ catch {
++ return truncateErrorText(raw.trim(), MAX_PROVIDER_ERROR_BODY_CHARS);
++ }
++}
++function isRecord(value) {
++ return typeof value === "object" && value !== null && !Array.isArray(value);
++}
++function firstString(...values) {
++ for (const value of values) {
++ if (typeof value === "string" && value.length > 0)
++ return value;
++ if (typeof value === "number")
++ return String(value);
++ }
++ return undefined;
++}
++/**
+ * Probe the HTTP status, first numeric hit wins, in SDK-field order:
+ * `statusCode` (Mistral) → `status` (`openai`, `@google/genai`) →
+ * `$metadata.httpStatusCode` (Bedrock) → `$response.statusCode` (Bedrock).
diff --git a/vendor/pi-ai/repack-coding-agent.sh b/vendor/pi-ai/repack-coding-agent.sh
new file mode 100755
index 000000000..03b955922
--- /dev/null
+++ b/vendor/pi-ai/repack-coding-agent.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Repackages the vendored pi-coding-agent (security.5 -> security.6) so its npm-shrinkwrap
+# pins pi-ai to the qm.1 tarball instead of stock npm. Only npm-shrinkwrap.json changes.
+set -euo pipefail
+base=https://github.com/yc-software/qm/releases/download
+work="$(mktemp -d)"
+trap 'rm -rf "$work"' EXIT
+curl -fsSL -o "$work/src.tgz" "$base/vendored-pi-coding-agent-0.82.0-security.5/earendil-works-pi-coding-agent-0.82.0-qm-security.5.tgz"
+echo "6d5ae8ee0c5c8c7d92fef0e6b1573d136292587027d9328f334ce0693b9e90fc $work/src.tgz" | sha256sum -c -
+curl -fsSL -o "$work/pi-ai.tgz" "$base/vendored-pi-ai-0.82.0-qm.1/earendil-works-pi-ai-0.82.0-qm.1.tgz"
+echo "fee4e2e6df462d76a63f2ce957d126738e281238694bdbaa12d677d130aae1ef $work/pi-ai.tgz" | sha256sum -c -
+tar xzf "$work/src.tgz" -C "$work"
+node -e '
+const fs = require("node:fs");
+const [file, url, tgz] = process.argv.slice(1);
+const integrity = "sha512-" + require("node:crypto").createHash("sha512").update(fs.readFileSync(tgz)).digest("base64");
+const lock = JSON.parse(fs.readFileSync(file, "utf8"));
+Object.assign(lock.packages["node_modules/@earendil-works/pi-ai"], { resolved: url, integrity });
+fs.writeFileSync(file, JSON.stringify(lock, null, "\t") + "\n");
+' "$work/package/npm-shrinkwrap.json" "$base/vendored-pi-ai-0.82.0-qm.1/earendil-works-pi-ai-0.82.0-qm.1.tgz" "$work/pi-ai.tgz"
+npm pack --silent "$work/package" --pack-destination "$work" >/dev/null
+mv "$work/earendil-works-pi-coding-agent-0.82.0.tgz" ./earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz
+sha256sum earendil-works-pi-coding-agent-0.82.0-qm-security.6.tgz