@herbertgao/pi-extensions 2026.11.2 → 2026.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +13 -13
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +12 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +109 -16
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +33 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +72 -17
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +5 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +16 -7
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +7 -5
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +92 -0
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +92 -0
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +12 -10
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +1 -1
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/agent-record-entry.ts +22 -6
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +9 -4
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +167 -7
- package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +8 -4
- package/node_modules/@narumitw/pi-btw/CHANGELOG.md +259 -0
- package/node_modules/@narumitw/pi-btw/package.json +6 -5
- package/node_modules/@narumitw/pi-caffeinate/CHANGELOG.md +70 -0
- package/node_modules/@narumitw/pi-caffeinate/package.json +5 -4
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +48 -0
- package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +64 -5
- package/node_modules/pi-commandcode-provider/README.md +44 -18
- package/node_modules/pi-commandcode-provider/RELEASE.md +25 -0
- package/node_modules/pi-commandcode-provider/index.ts +222 -42
- package/node_modules/pi-commandcode-provider/package.json +9 -8
- package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +6 -13
- package/node_modules/pi-commandcode-provider/scripts/typecheck-entrypoint.mjs +88 -0
- package/node_modules/pi-commandcode-provider/src/api-key.ts +67 -10
- package/node_modules/pi-commandcode-provider/src/auth-server.ts +33 -24
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +9 -2
- package/node_modules/pi-commandcode-provider/src/cost.ts +29 -43
- package/node_modules/pi-commandcode-provider/src/diagnostics.ts +215 -0
- package/node_modules/pi-commandcode-provider/src/oauth.ts +41 -7
- package/node_modules/pi-commandcode-provider/src/pricing.ts +5 -3
- package/node_modules/pi-commandcode-provider/src/quota-command.ts +1 -1
- package/node_modules/pi-commandcode-provider/src/routing.ts +166 -0
- package/node_modules/pi-commandcode-provider/src/runtime.ts +23 -10
- package/node_modules/pi-commandcode-provider/src/transport.ts +82 -85
- package/node_modules/pi-commandcode-provider/src/types.ts +20 -39
- package/node_modules/pi-commandcode-provider/src/usage.ts +1 -1
- package/node_modules/pi-lens/CHANGELOG-USER.md +31 -0
- package/node_modules/pi-lens/CHANGELOG.md +178 -0
- package/node_modules/pi-lens/README.md +2 -1
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/node_modules/pi-lens/dist/{chunk-3O5EII3W.js → chunk-2VZ3VN3N.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-SDFKOLSF.js → chunk-3HTZDY3C.js} +8 -6
- package/node_modules/pi-lens/dist/{chunk-A5GRLYPZ.js → chunk-3NPWO5UO.js} +7 -13
- package/node_modules/pi-lens/dist/{chunk-AGGUWKRK.js → chunk-47UCC4MM.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-4ENEJHF4.js +198 -0
- package/node_modules/pi-lens/dist/{chunk-WXUDRAG6.js → chunk-5GEYJJHG.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-HHR7WGCI.js → chunk-5YSEQHJN.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-L3CLUGDY.js → chunk-6GPB3JLL.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-5F3XF3SX.js → chunk-7R5GZIA6.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-CUDD35TW.js → chunk-7UTSNTWM.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-DYRZGUMA.js → chunk-7YTRG6YW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-JZRP4DGP.js → chunk-AACN5GNE.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6FIRFP6A.js → chunk-C3YRO3EU.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
- package/node_modules/pi-lens/dist/{chunk-BBET6HD6.js → chunk-CDFJF5YD.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-NSPVR3FN.js → chunk-CJS6WE66.js} +17 -19
- package/node_modules/pi-lens/dist/{chunk-6YUNI7B5.js → chunk-CM6BDY4E.js} +14 -60
- package/node_modules/pi-lens/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
- package/node_modules/pi-lens/dist/chunk-DGKFWQK4.js +23 -0
- package/node_modules/pi-lens/dist/{chunk-VOP4PJKA.js → chunk-E65WJVI5.js} +7 -9
- package/node_modules/pi-lens/dist/{chunk-TV6RXRYH.js → chunk-EKNYSXFB.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-4LL2VRNY.js → chunk-EY6LY2HO.js} +16 -18
- package/node_modules/pi-lens/dist/{chunk-MC6VB2E5.js → chunk-F6BEQWAK.js} +17 -5
- package/node_modules/pi-lens/dist/{chunk-R2QQC33W.js → chunk-FGNSESAC.js} +12 -14
- package/node_modules/pi-lens/dist/{chunk-OC7VWJBZ.js → chunk-FRUBVFXV.js} +35 -37
- package/node_modules/pi-lens/dist/{chunk-7CGIDRIK.js → chunk-G22UNQID.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-L4NEVZ4T.js → chunk-GQTQUNCG.js} +25 -27
- package/node_modules/pi-lens/dist/{chunk-ZKLTNLAW.js → chunk-H3BVMK47.js} +6 -6
- package/node_modules/pi-lens/dist/chunk-H6FLQ5NW.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-2ZE3AUJQ.js → chunk-HEA3EM23.js} +13 -15
- package/node_modules/pi-lens/dist/{chunk-CZL44WFN.js → chunk-HSOBIN22.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PKSUMEPT.js → chunk-HYSKJMZK.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-VN3L2JWZ.js → chunk-IICERRFF.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-O4N5BQ3T.js → chunk-IILEH3ZC.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-WC6WRNQT.js → chunk-J3Q2NYJR.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-SFLHSL5R.js → chunk-JUZ67QZQ.js} +18 -7
- package/node_modules/pi-lens/dist/chunk-KR5VGMVT.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-UHHLR2VY.js → chunk-KV6GQOGN.js} +38 -41
- package/node_modules/pi-lens/dist/{chunk-HUAM7QG3.js → chunk-KXMJLOZF.js} +25 -23
- package/node_modules/pi-lens/dist/{chunk-BUZIQDFS.js → chunk-L4Y3ROKQ.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-JBP7KESM.js → chunk-L6WBJGQS.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-35WKJWO5.js → chunk-L7O774U7.js} +14 -14
- package/node_modules/pi-lens/dist/{chunk-BOPDQ7AZ.js → chunk-LAHHGNAY.js} +19 -21
- package/node_modules/pi-lens/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-5T5A6YAJ.js → chunk-LWOM6LVS.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-JYLOYTZD.js → chunk-MKPDIAZH.js} +5 -1
- package/node_modules/pi-lens/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
- package/node_modules/pi-lens/dist/{chunk-BQG2QFVO.js → chunk-MQ4PPCJB.js} +21 -29
- package/node_modules/pi-lens/dist/{chunk-HXFUTMX2.js → chunk-MRLH4MYU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-XOMGO63G.js → chunk-N56BNAA6.js} +19 -21
- package/node_modules/pi-lens/dist/{chunk-7MAD5ZAY.js → chunk-N5CEGQPG.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-ZFORSIED.js → chunk-NCLO6E6N.js} +13 -33
- package/node_modules/pi-lens/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-I22THIHI.js → chunk-NMUSOZ2D.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-4NBWFYWW.js → chunk-NOWH2VA2.js} +8 -33
- package/node_modules/pi-lens/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
- package/node_modules/pi-lens/dist/{chunk-OZWXLJMX.js → chunk-OSEKJEUU.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-2BKUFQKR.js → chunk-OUYAUXAT.js} +405 -181
- package/node_modules/pi-lens/dist/{chunk-JPRDTY5S.js → chunk-PBZNYHMM.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-JE6HKLC7.js → chunk-PIIUNJIT.js} +2 -4
- package/node_modules/pi-lens/dist/{chunk-ZZDIOAAJ.js → chunk-PRHYIA6X.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-4W52ZKZX.js → chunk-PXQ45SGD.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-Q6JQKWPK.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-PIQQM32Y.js → chunk-QB7T2PHK.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-QJJKOHLH.js +57 -0
- package/node_modules/pi-lens/dist/{chunk-6LJOJ6EO.js → chunk-QP33NKYC.js} +14 -16
- package/node_modules/pi-lens/dist/{chunk-DIWK3LBC.js → chunk-QVBOXT3L.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-IYVYZQRL.js → chunk-RNJFRXEN.js} +5 -7
- package/node_modules/pi-lens/dist/{chunk-G6JKM4O7.js → chunk-RNXOWDM6.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-5RNB4HVK.js → chunk-RTFMDIKV.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-XWIME22V.js → chunk-SIQHOB6P.js} +11 -13
- package/node_modules/pi-lens/dist/{chunk-T2S3FNNJ.js → chunk-SLSMJPEF.js} +41 -42
- package/node_modules/pi-lens/dist/chunk-T5QSLSMM.js +50 -0
- package/node_modules/pi-lens/dist/chunk-TGQDAG4B.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-6GMGEKQN.js → chunk-THYHUIDR.js} +39 -12
- package/node_modules/pi-lens/dist/{chunk-WMDUT4KH.js → chunk-TMNUTMT5.js} +72 -89
- package/node_modules/pi-lens/dist/{chunk-7TNILKGY.js → chunk-TOE2RRCS.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-TYHPVE5H.js +25 -0
- package/node_modules/pi-lens/dist/chunk-UAKO2M6B.js +73 -0
- package/node_modules/pi-lens/dist/chunk-UC5AXW5Z.js +20 -0
- package/node_modules/pi-lens/dist/chunk-UTJP6WOS.js +28 -0
- package/node_modules/pi-lens/dist/{chunk-FRLAUP2B.js → chunk-UXTQ3QPD.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-4QG55RRC.js → chunk-V2WDBOLZ.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-FHEV6T4L.js → chunk-V67D6TMU.js} +8 -10
- package/node_modules/pi-lens/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
- package/node_modules/pi-lens/dist/{chunk-KZ4ALBCH.js → chunk-VO4JFPTV.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-GIRBSBGL.js → chunk-VWLSU3XV.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-2453RRJ2.js → chunk-W5E72HJA.js} +59 -22
- package/node_modules/pi-lens/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SP4TFY5F.js → chunk-WSSLVMDA.js} +11 -13
- package/node_modules/pi-lens/dist/{chunk-PPKECBPP.js → chunk-WTB4GKMH.js} +10 -1
- package/node_modules/pi-lens/dist/{chunk-X35S7HSB.js → chunk-X5BJ3G2P.js} +41 -30
- package/node_modules/pi-lens/dist/{chunk-X66YJ2SS.js → chunk-XKFO2SZV.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-OWTG6UMO.js → chunk-XLAI7UYY.js} +75 -22
- package/node_modules/pi-lens/dist/{chunk-4B2YFN4U.js → chunk-XO756WE5.js} +45 -33
- package/node_modules/pi-lens/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
- package/node_modules/pi-lens/dist/{chunk-XYLC35E4.js → chunk-YOXCCJDF.js} +517 -308
- package/node_modules/pi-lens/dist/{chunk-O2ARHQKF.js → chunk-ZCQBNPRH.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-ZD4KVFXI.js +234 -0
- package/node_modules/pi-lens/dist/{chunk-LSFXZLPW.js → chunk-ZDMFGACN.js} +184 -235
- package/node_modules/pi-lens/dist/{chunk-4BKU7PV3.js → chunk-ZMMHHXSW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-OY7WZI7Q.js → chunk-ZPM7ZIFL.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-R4QWJQ2H.js → chunk-ZVCDHYWZ.js} +9 -11
- package/node_modules/pi-lens/dist/{chunk-RZG472YW.js → chunk-ZZN74OGD.js} +83 -46
- package/node_modules/pi-lens/dist/{chunk-BHWW6FAX.js → chunk-ZZSJAR76.js} +37 -19
- package/node_modules/pi-lens/dist/index.js +4910 -4218
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +12 -17
- package/node_modules/pi-lens/dist/mcp/cli.js +41 -42
- package/node_modules/pi-lens/dist/mcp/server.js +1451 -648
- package/node_modules/pi-lens/dist/mcp/worker.js +59 -60
- package/node_modules/pi-lens/dist/probes/installer.js +17 -19
- package/node_modules/pi-lens/docs/agent-tools.md +40 -8
- package/node_modules/pi-lens/docs/analysisall.md +1 -1
- package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +7 -5
- package/node_modules/pi-lens/docs/configuration.md +51 -9
- package/node_modules/pi-lens/docs/defect-shapes.md +52 -3
- package/node_modules/pi-lens/docs/environment-variables.md +18 -1
- package/node_modules/pi-lens/docs/features.md +12 -5
- package/node_modules/pi-lens/docs/globalconfig.md +11 -3
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +9 -2
- package/node_modules/pi-lens/docs/invariants/session-telemetry.md +2 -2
- package/node_modules/pi-lens/docs/language-coverage.md +1 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +57 -35
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +4 -1
- package/node_modules/pi-lens/docs/merge-queue-rollout.md +10 -8
- package/node_modules/pi-lens/docs/module-report-read-symbol.md +34 -23
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +11 -1
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +3 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +15 -7
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +13 -0
- package/node_modules/pi-lens/docs/public-api-stability.md +39 -5
- package/node_modules/pi-lens/docs/release-qa-baseline.md +7 -4
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +11 -2
- package/node_modules/pi-lens/docs/servercapabilities.md +3 -1
- package/node_modules/pi-lens/docs/settings.md +2 -2
- package/node_modules/pi-lens/docs/word-index.md +3 -2
- package/node_modules/pi-lens/package.json +8 -3
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- package/node_modules/pi-lens/scripts/download-grammars.js +3 -2
- package/node_modules/pi-lens/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/node_modules/pi-provider-qoder/dist/index.js +473 -62
- package/node_modules/pi-provider-qoder/package.json +1 -1
- package/node_modules/pi-web-access/CHANGELOG.md +22 -0
- package/node_modules/pi-web-access/README.md +31 -12
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/dist/index.js +673 -308
- package/node_modules/pi-web-access/dist/mcp-cli.js +666 -309
- package/node_modules/pi-web-access/gemini-search.ts +12 -4
- package/node_modules/pi-web-access/github-api.ts +1 -1
- package/node_modules/pi-web-access/github-extract.ts +3 -2
- package/node_modules/pi-web-access/index.ts +7 -3
- package/node_modules/pi-web-access/mcp-tool-definitions.ts +1 -1
- package/node_modules/pi-web-access/outcrawl.ts +204 -0
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/sofya.ts +201 -0
- package/node_modules/pi-web-access/utils.ts +16 -6
- package/node_modules/pi-web-access/web-tool-core.ts +4 -0
- package/package.json +16 -14
- package/node_modules/pi-commandcode-provider/src/converters.ts +0 -477
- package/node_modules/pi-commandcode-provider/src/core.ts +0 -836
- package/node_modules/pi-commandcode-provider/src/json-schema.ts +0 -417
- package/node_modules/pi-commandcode-provider/src/transcript.ts +0 -56
- package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +0 -31
- package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +0 -27
- package/node_modules/pi-lens/dist/chunk-447YZL4S.js +0 -25
- package/node_modules/pi-lens/dist/chunk-565VRUP4.js +0 -136
- package/node_modules/pi-lens/dist/chunk-57X2CDRX.js +0 -49
- package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +0 -27
- package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +0 -58
- package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +0 -22
- package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +0 -89
- package/node_modules/pi-lens/dist/chunk-U3AS2FR6.js +0 -106
- package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +0 -27
- package/node_modules/pi-lens/dist/chunk-WQV6BI4Q.js +0 -48
- package/node_modules/pi-lens/dist/chunk-YHGYAEFH.js +0 -443
- package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +0 -74
- package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +0 -30
|
@@ -20,7 +20,7 @@ export interface TemporaryPricing {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const PRICING_SOURCE_URL = "https://commandcode.ai/docs/resources/pricing-limits"
|
|
23
|
-
export const PRICING_LAST_VERIFIED = "2026-
|
|
23
|
+
export const PRICING_LAST_VERIFIED = "2026-11-04"
|
|
24
24
|
|
|
25
25
|
export const ZERO_MODEL_COST: CommandCodeModelCost = {
|
|
26
26
|
input: 0,
|
|
@@ -39,12 +39,15 @@ export const ZERO_MODEL_COST: CommandCodeModelCost = {
|
|
|
39
39
|
*/
|
|
40
40
|
export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
|
|
41
41
|
// Free models
|
|
42
|
+
// Free while the stealth preview lasts; no fixed expiry is published.
|
|
43
|
+
"stealth/crouton-alpha": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
42
44
|
"poolside/laguna-s-2.1-free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
43
45
|
"stealth/glyph-cluster:free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
44
46
|
// Free while capacity lasts; no fixed expiry is published.
|
|
45
47
|
"reflection/beam:free": { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
46
48
|
|
|
47
49
|
// Open and open-weight models
|
|
50
|
+
"inclusionai/ling-3.1-flash-1019": { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
|
|
48
51
|
"ornith/ornith-1.5-122b": { input: 0.16, output: 0.64, cacheRead: 0.02, cacheWrite: 0 },
|
|
49
52
|
"inclusionai/ling-3.1-flash": { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
|
|
50
53
|
"mistral/mistral-large-4": { input: 1.36, output: 4.18, cacheRead: 0.14, cacheWrite: 0 },
|
|
@@ -365,6 +368,5 @@ export const MODEL_COSTS: Readonly<Record<string, CommandCodeModelCost>> = {
|
|
|
365
368
|
},
|
|
366
369
|
}
|
|
367
370
|
|
|
368
|
-
//
|
|
369
|
-
// publishes a promotion end date, so tests fail when it needs review.
|
|
371
|
+
// Dated promotions only; remove an entry when the model leaves the API.
|
|
370
372
|
export const TEMPORARY_PRICING: readonly TemporaryPricing[] = []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfiguredApiKey } from "./api-key.ts"
|
|
2
|
-
import { pickCommandCodeApiKey } from "./
|
|
2
|
+
import { pickCommandCodeApiKey } from "./api-key.ts"
|
|
3
3
|
import { fetchCommandCodeQuota, redactValue } from "./quota.ts"
|
|
4
4
|
import { formatQuota } from "./quota-format.ts"
|
|
5
5
|
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Persistent endpoint choices carried forward from #158 by @patlux.
|
|
2
|
+
import { randomUUID } from "node:crypto"
|
|
3
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises"
|
|
4
|
+
import { basename, dirname } from "node:path"
|
|
5
|
+
import type { CommandCodeApi, CommandCodeModel } from "./models.ts"
|
|
6
|
+
|
|
7
|
+
export type EndpointChoice = "auto" | "responses" | "chat-completions"
|
|
8
|
+
export type EndpointOverrides = Readonly<Record<string, EndpointChoice>>
|
|
9
|
+
|
|
10
|
+
export function isEndpointChoice(value: unknown): value is EndpointChoice {
|
|
11
|
+
return value === "auto" || value === "responses" || value === "chat-completions"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function parseEndpointOverrides(value: unknown): EndpointOverrides {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
16
|
+
throw new Error("Routing configuration must be an object with version: 1 and models")
|
|
17
|
+
}
|
|
18
|
+
if (
|
|
19
|
+
!Object.hasOwn(value, "version") ||
|
|
20
|
+
!("version" in value) ||
|
|
21
|
+
value.version !== 1 ||
|
|
22
|
+
!Object.hasOwn(value, "models") ||
|
|
23
|
+
!("models" in value)
|
|
24
|
+
) {
|
|
25
|
+
throw new Error("Unsupported routing configuration version")
|
|
26
|
+
}
|
|
27
|
+
const models = value.models
|
|
28
|
+
if (typeof models !== "object" || models === null || Array.isArray(models)) {
|
|
29
|
+
throw new Error("Routing models must be an object")
|
|
30
|
+
}
|
|
31
|
+
const entries = Object.entries(models)
|
|
32
|
+
if (entries.some(([id, choice]) => !id || id !== id.trim() || !isEndpointChoice(choice))) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"Routing choices must be auto, responses, or chat-completions with exact model IDs",
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
// fromEntries defines own properties, including __proto__, without mutating the prototype.
|
|
38
|
+
// Explicit auto and an absent entry must have the same status and persistence semantics.
|
|
39
|
+
return Object.fromEntries(
|
|
40
|
+
entries.filter(
|
|
41
|
+
(entry): entry is [string, EndpointChoice] =>
|
|
42
|
+
isEndpointChoice(entry[1]) && entry[1] !== "auto",
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function readRoutingFile(path: string): Promise<Buffer | undefined> {
|
|
48
|
+
try {
|
|
49
|
+
return await readFile(path)
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return undefined
|
|
52
|
+
// Never surface OS errors, local paths, JSON excerpts, or arbitrary file contents.
|
|
53
|
+
throw new Error("Could not read commandcode-routing.json in the agent directory")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function loadEndpointOverrides(path: string): Promise<EndpointOverrides> {
|
|
58
|
+
const raw = await readRoutingFile(path)
|
|
59
|
+
if (raw === undefined) return {}
|
|
60
|
+
try {
|
|
61
|
+
return parseEndpointOverrides(JSON.parse(raw.toString("utf8")))
|
|
62
|
+
} catch {
|
|
63
|
+
throw new Error("Invalid commandcode-routing.json in the agent directory")
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function endpointChoiceForModel(
|
|
68
|
+
modelId: string,
|
|
69
|
+
overrides: EndpointOverrides,
|
|
70
|
+
): EndpointChoice {
|
|
71
|
+
return Object.hasOwn(overrides, modelId) ? overrides[modelId] : "auto"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function resolveEndpoint(
|
|
75
|
+
model: CommandCodeModel,
|
|
76
|
+
overrides: EndpointOverrides,
|
|
77
|
+
): CommandCodeApi {
|
|
78
|
+
const choice = endpointChoiceForModel(model.id, overrides)
|
|
79
|
+
if (choice === "auto") return model.api
|
|
80
|
+
if (model.api === "anthropic-messages") {
|
|
81
|
+
throw new Error("Claude models require Anthropic Messages; use auto")
|
|
82
|
+
}
|
|
83
|
+
if (choice === "responses" && model.api !== "openai-responses") {
|
|
84
|
+
throw new Error(
|
|
85
|
+
"The current catalog does not advertise Responses for this model; refresh the catalog or use auto",
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
return choice === "responses" ? "openai-responses" : "openai-completions"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Preserve host/user compatibility only when it is tagged for the actual wire.
|
|
92
|
+
* Unknown or stale wire metadata must be replaced, never merged across wires.
|
|
93
|
+
*/
|
|
94
|
+
export function compatForEndpoint<T>(
|
|
95
|
+
model: CommandCodeModel | undefined,
|
|
96
|
+
wire: CommandCodeApi,
|
|
97
|
+
fallback: T,
|
|
98
|
+
forModel: (model: CommandCodeModel) => T,
|
|
99
|
+
): T {
|
|
100
|
+
if (!model) return fallback
|
|
101
|
+
if (
|
|
102
|
+
fallback !== null &&
|
|
103
|
+
typeof fallback === "object" &&
|
|
104
|
+
Object.hasOwn(fallback, "commandCodeWire") &&
|
|
105
|
+
"commandCodeWire" in fallback &&
|
|
106
|
+
fallback.commandCodeWire === wire
|
|
107
|
+
)
|
|
108
|
+
return fallback
|
|
109
|
+
return forModel({ ...model, api: wire })
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Explicit command write only. Startup reads never rewrite or back up the file.
|
|
113
|
+
* A malformed file is preserved before replacement; unreadable files are not overwritten.
|
|
114
|
+
* Writes within one host are serialized by the command; separate hosts are not coordinated.
|
|
115
|
+
*/
|
|
116
|
+
export async function saveEndpointChoice(
|
|
117
|
+
path: string,
|
|
118
|
+
modelId: string,
|
|
119
|
+
choice: EndpointChoice,
|
|
120
|
+
): Promise<{
|
|
121
|
+
overrides: EndpointOverrides
|
|
122
|
+
backupFile?: string
|
|
123
|
+
}> {
|
|
124
|
+
if (!modelId || modelId !== modelId.trim() || !isEndpointChoice(choice)) {
|
|
125
|
+
throw new Error("Invalid endpoint choice or model ID")
|
|
126
|
+
}
|
|
127
|
+
const raw = await readRoutingFile(path)
|
|
128
|
+
let overrides: Record<string, EndpointChoice> = {}
|
|
129
|
+
let invalid = false
|
|
130
|
+
if (raw !== undefined) {
|
|
131
|
+
try {
|
|
132
|
+
overrides = { ...parseEndpointOverrides(JSON.parse(raw.toString("utf8"))) }
|
|
133
|
+
} catch {
|
|
134
|
+
invalid = true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (choice === "auto") delete overrides[modelId]
|
|
138
|
+
else
|
|
139
|
+
Object.defineProperty(overrides, modelId, {
|
|
140
|
+
value: choice,
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
writable: true,
|
|
144
|
+
})
|
|
145
|
+
const temporary = `${path}.${randomUUID()}.tmp`
|
|
146
|
+
const backup = invalid ? `${path}.invalid-${randomUUID()}.bak` : undefined
|
|
147
|
+
try {
|
|
148
|
+
await mkdir(dirname(path), { recursive: true })
|
|
149
|
+
await writeFile(temporary, JSON.stringify({ version: 1, models: overrides }, null, 2) + "\n", {
|
|
150
|
+
encoding: "utf8",
|
|
151
|
+
mode: 0o600,
|
|
152
|
+
flag: "wx",
|
|
153
|
+
})
|
|
154
|
+
// If the backup fails, leave the original file untouched and do not install the new one.
|
|
155
|
+
if (backup && raw !== undefined) await writeFile(backup, raw, { mode: 0o600, flag: "wx" })
|
|
156
|
+
await rename(temporary, path)
|
|
157
|
+
return { overrides, ...(backup ? { backupFile: basename(backup) } : {}) }
|
|
158
|
+
} catch {
|
|
159
|
+
throw new Error(
|
|
160
|
+
"Could not save commandcode-routing.json in the agent directory; check file permissions",
|
|
161
|
+
)
|
|
162
|
+
} finally {
|
|
163
|
+
// Cleanup must not replace the sanitized error with an OS message containing local paths.
|
|
164
|
+
await rm(temporary, { force: true }).catch(() => {})
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CommandCodeModel, LoadCommandCodeModelsResult } from "./models.ts"
|
|
2
|
+
import { redactCommandCodeErrorText } from "./overflow.ts"
|
|
2
3
|
|
|
3
4
|
export interface CommandCodeUi {
|
|
4
5
|
notify(message: string, type?: "info" | "warning" | "error"): void
|
|
@@ -7,6 +8,8 @@ export interface CommandCodeUi {
|
|
|
7
8
|
export interface CommandCodeCommandContext {
|
|
8
9
|
ui: CommandCodeUi
|
|
9
10
|
waitForIdle?: () => Promise<void>
|
|
11
|
+
/** Currently selected model, when the host exposes one to command handlers. */
|
|
12
|
+
model?: { provider: string; id: string }
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
export interface CommandCodeRuntimeApi<
|
|
@@ -30,14 +33,17 @@ export interface CommandCodeRuntimeOptions<TProviderConfig> {
|
|
|
30
33
|
/** Cached catalog only; resolves to an empty list when no valid cache exists. */
|
|
31
34
|
loadCachedModels: () => Promise<readonly CommandCodeModel[]>
|
|
32
35
|
createProviderConfig: (models: readonly CommandCodeModel[]) => TProviderConfig
|
|
33
|
-
getTransport?: () => "unknown" | "provider"
|
|
36
|
+
getTransport?: () => "unknown" | "provider"
|
|
37
|
+
/** Reset the latest transport status on an explicit catalog refresh. */
|
|
38
|
+
resetTransport?: () => void
|
|
39
|
+
getDiagnostics?: (model: CommandCodeCommandContext["model"]) => string
|
|
34
40
|
getStreamWarning?: () => string | undefined
|
|
35
41
|
now?: () => number
|
|
36
42
|
logWarning?: (message: string) => void
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
export interface CommandCodeRuntimeStatus {
|
|
40
|
-
transport: "unknown" | "provider"
|
|
46
|
+
transport: "unknown" | "provider"
|
|
41
47
|
source: LoadCommandCodeModelsResult["source"]
|
|
42
48
|
modelCount: number
|
|
43
49
|
lastSuccess?: number
|
|
@@ -71,15 +77,13 @@ function redactUrl(value: string): string {
|
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Diagnostics drop URL query strings and fragments entirely, then apply the
|
|
82
|
+
* same credential redaction as error messages so both surfaces agree.
|
|
83
|
+
*/
|
|
74
84
|
export function redactDiagnosticText(value: string): string {
|
|
75
85
|
const redactedUrls = value.replace(/https?:\/\/[^\s)]+/gi, (match) => redactUrl(match))
|
|
76
|
-
return redactedUrls
|
|
77
|
-
.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, `Bearer ${REDACTED}`)
|
|
78
|
-
.replace(/\b(?:user|cc)_[A-Za-z0-9_-]{8,}\b/gi, REDACTED)
|
|
79
|
-
.replace(/\b(?:api[-_ ]?key|token|secret|password)\s*[=:]\s*[^\s,;)]+/gi, (match) => {
|
|
80
|
-
const separator = match.match(/\s*[=:]\s*/)?.[0] ?? "="
|
|
81
|
-
return `${match.slice(0, match.indexOf(separator))}${separator}${REDACTED}`
|
|
82
|
-
})
|
|
86
|
+
return redactCommandCodeErrorText(redactedUrls)
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
export function redactEndpoint(value: string): string {
|
|
@@ -287,10 +291,17 @@ export class CommandCodeRuntime<TProviderConfig, TContext extends CommandCodeCom
|
|
|
287
291
|
}
|
|
288
292
|
|
|
289
293
|
private registerCommands(): void {
|
|
294
|
+
this.pi.registerCommand("commandcode-diagnostics", {
|
|
295
|
+
description: "Show a content-free support report (no prompts, keys or local paths)",
|
|
296
|
+
handler: async (_args, ctx) => {
|
|
297
|
+
ctx.ui.notify(this.options.getDiagnostics?.(ctx.model) ?? "Diagnostics unavailable", "info")
|
|
298
|
+
},
|
|
299
|
+
})
|
|
290
300
|
this.pi.registerCommand("commandcode-refresh", {
|
|
291
301
|
description: "Refresh the Command Code model catalog",
|
|
292
302
|
handler: async (_args, ctx) => {
|
|
293
303
|
await ctx.waitForIdle?.()
|
|
304
|
+
this.options.resetTransport?.()
|
|
294
305
|
const result = await this.refresh()
|
|
295
306
|
if (result.refreshed) {
|
|
296
307
|
ctx.ui.notify(
|
|
@@ -311,7 +322,9 @@ export class CommandCodeRuntime<TProviderConfig, TContext extends CommandCodeCom
|
|
|
311
322
|
handler: async (_args, ctx) => {
|
|
312
323
|
const status = this.getStatus()
|
|
313
324
|
ctx.ui.notify(
|
|
314
|
-
formatCommandCodeStatus(status),
|
|
325
|
+
[formatCommandCodeStatus(status), this.options.getDiagnostics?.(ctx.model)]
|
|
326
|
+
.filter(Boolean)
|
|
327
|
+
.join("\n"),
|
|
315
328
|
status.warning || status.streamWarning ? "warning" : "info",
|
|
316
329
|
)
|
|
317
330
|
},
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
import { redactCommandCodeErrorText } from "./overflow.ts"
|
|
1
2
|
import type {
|
|
2
|
-
AssistantMessageEvent,
|
|
3
3
|
AssistantMessageEventStreamLike,
|
|
4
4
|
ContextLike,
|
|
5
5
|
ModelLike,
|
|
6
6
|
StreamOptions,
|
|
7
7
|
} from "./types.ts"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// Carries Patrick Wozniak's Provider API entitlement policy from PR #164.
|
|
10
|
+
export type CommandCodeTransport = "unknown" | "provider"
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
const PROVIDER_ACCESS_REQUIRED =
|
|
13
|
+
"Command Code Provider API access is required (403 upgrade_required). The Go plan does not include API use. Use a plan with documented Provider API access and retry. If you changed accounts, sign in again. See https://commandcode.ai/docs/provider."
|
|
14
|
+
|
|
15
|
+
interface TransportDependencies<
|
|
16
|
+
TModel extends ModelLike,
|
|
17
|
+
TContext extends ContextLike,
|
|
18
|
+
TReasoning extends string,
|
|
19
|
+
> {
|
|
12
20
|
createStream: () => AssistantMessageEventStreamLike
|
|
13
21
|
streamProvider: (
|
|
14
|
-
model:
|
|
15
|
-
context:
|
|
16
|
-
options?: StreamOptions,
|
|
17
|
-
) => AssistantMessageEventStreamLike
|
|
18
|
-
streamGenerate: (
|
|
19
|
-
model: ModelLike,
|
|
20
|
-
context: ContextLike,
|
|
21
|
-
options?: StreamOptions,
|
|
22
|
+
model: TModel,
|
|
23
|
+
context: TContext,
|
|
24
|
+
options?: StreamOptions<TModel, TReasoning>,
|
|
22
25
|
) => AssistantMessageEventStreamLike
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -28,7 +31,6 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
28
31
|
|
|
29
32
|
async function isUpgradeRequired(response: Response): Promise<boolean> {
|
|
30
33
|
if (response.status !== 403) return false
|
|
31
|
-
|
|
32
34
|
try {
|
|
33
35
|
const body: unknown = await response.clone().json()
|
|
34
36
|
if (!isRecord(body)) return false
|
|
@@ -39,108 +41,103 @@ async function isUpgradeRequired(response: Response): Promise<boolean> {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
export function createCommandCodeTransportRouter
|
|
44
|
+
export function createCommandCodeTransportRouter<
|
|
45
|
+
TModel extends ModelLike = ModelLike,
|
|
46
|
+
TContext extends ContextLike = ContextLike,
|
|
47
|
+
TReasoning extends string = string,
|
|
48
|
+
>(deps: TransportDependencies<TModel, TContext, TReasoning>) {
|
|
43
49
|
let transport: CommandCodeTransport = "unknown"
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
function pipe(
|
|
47
|
-
source: AssistantMessageEventStreamLike,
|
|
48
|
-
target: AssistantMessageEventStreamLike,
|
|
49
|
-
): Promise<void> {
|
|
50
|
-
return (async () => {
|
|
51
|
-
for await (const event of source) target.push(event)
|
|
52
|
-
})()
|
|
53
|
-
}
|
|
50
|
+
let generation = 0
|
|
54
51
|
|
|
55
52
|
return {
|
|
56
|
-
getTransport(): CommandCodeTransport
|
|
57
|
-
return transport
|
|
58
|
-
},
|
|
59
|
-
|
|
53
|
+
getTransport: (): CommandCodeTransport => transport,
|
|
60
54
|
reset(): void {
|
|
55
|
+
generation += 1
|
|
61
56
|
transport = "unknown"
|
|
62
|
-
apiKey = undefined
|
|
63
57
|
},
|
|
64
|
-
|
|
65
58
|
stream(
|
|
66
|
-
model:
|
|
67
|
-
context:
|
|
68
|
-
options?: StreamOptions,
|
|
59
|
+
model: TModel,
|
|
60
|
+
context: TContext,
|
|
61
|
+
options?: StreamOptions<TModel, TReasoning>,
|
|
69
62
|
): AssistantMessageEventStreamLike {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const requestApiKey = options?.apiKey
|
|
75
|
-
if (transport === "generate") return deps.streamGenerate(model, context, options)
|
|
76
|
-
|
|
63
|
+
// Status describes the latest attempt, not a stale success or an assumed
|
|
64
|
+
// entitlement. Neither a new key nor a catalog refresh caches a denial.
|
|
65
|
+
const requestGeneration = ++generation
|
|
66
|
+
transport = "unknown"
|
|
77
67
|
const output = deps.createStream()
|
|
78
68
|
let upgradeRequired = false
|
|
69
|
+
let terminal = false
|
|
79
70
|
const fetchImpl = options?.fetch ?? fetch
|
|
80
|
-
const providerOptions: StreamOptions = {
|
|
71
|
+
const providerOptions: StreamOptions<TModel, TReasoning> = {
|
|
81
72
|
...options,
|
|
82
73
|
fetch: async (input, init) => {
|
|
83
74
|
const response = await fetchImpl(input, init)
|
|
84
75
|
if (await isUpgradeRequired(response)) upgradeRequired = true
|
|
85
76
|
return response
|
|
86
77
|
},
|
|
87
|
-
onResponse:
|
|
88
|
-
if (upgradeRequired) return
|
|
89
|
-
await options?.onResponse?.(response, responseModel)
|
|
90
|
-
},
|
|
78
|
+
// Keep onResponse intact: diagnostics must observe denied HTTP status.
|
|
91
79
|
}
|
|
92
|
-
|
|
93
80
|
const run = async () => {
|
|
94
|
-
const providerStream = deps.streamProvider(model, context, providerOptions)
|
|
95
|
-
|
|
96
81
|
try {
|
|
97
|
-
for await (const event of
|
|
98
|
-
if (
|
|
99
|
-
|
|
82
|
+
for await (const event of deps.streamProvider(model, context, providerOptions)) {
|
|
83
|
+
if (upgradeRequired) continue
|
|
84
|
+
if (event.type === "done") {
|
|
85
|
+
terminal = true
|
|
86
|
+
if (generation === requestGeneration) transport = "provider"
|
|
87
|
+
}
|
|
88
|
+
if (event.type === "error") {
|
|
89
|
+
terminal = true
|
|
90
|
+
output.push({
|
|
91
|
+
...event,
|
|
92
|
+
error: {
|
|
93
|
+
...event.error,
|
|
94
|
+
errorMessage: redactCommandCodeErrorText(event.error.errorMessage ?? ""),
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
} else {
|
|
100
98
|
output.push(event)
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
} catch (error) {
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
// upgrade_required response permits generate fallback.
|
|
102
|
+
// Hosts may emit an error event or reject the iterator after a 403.
|
|
103
|
+
// Only the inspected entitlement response gets the static message.
|
|
107
104
|
if (!upgradeRequired) throw error
|
|
108
105
|
}
|
|
109
|
-
|
|
110
|
-
if (upgradeRequired) {
|
|
111
|
-
if (apiKey === requestApiKey) transport = "generate"
|
|
112
|
-
await pipe(deps.streamGenerate(model, context, options), output)
|
|
113
|
-
}
|
|
114
|
-
output.end()
|
|
106
|
+
if (upgradeRequired) throw new Error(PROVIDER_ACCESS_REQUIRED)
|
|
115
107
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
run()
|
|
109
|
+
.catch((error: unknown) => {
|
|
110
|
+
if (terminal) return
|
|
111
|
+
const reason = options?.signal?.aborted ? "aborted" : "error"
|
|
112
|
+
let message = PROVIDER_ACCESS_REQUIRED
|
|
113
|
+
if (!upgradeRequired) {
|
|
114
|
+
const detail = error instanceof Error ? error.message : String(error)
|
|
115
|
+
message = redactCommandCodeErrorText(detail)
|
|
116
|
+
}
|
|
117
|
+
output.push({
|
|
118
|
+
type: "error",
|
|
119
|
+
reason,
|
|
120
|
+
error: {
|
|
121
|
+
role: "assistant",
|
|
122
|
+
content: [],
|
|
123
|
+
api: model.api,
|
|
124
|
+
provider: model.provider,
|
|
125
|
+
model: model.id,
|
|
126
|
+
usage: {
|
|
127
|
+
input: 0,
|
|
128
|
+
output: 0,
|
|
129
|
+
cacheRead: 0,
|
|
130
|
+
cacheWrite: 0,
|
|
131
|
+
totalTokens: 0,
|
|
132
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
133
|
+
},
|
|
134
|
+
stopReason: reason,
|
|
135
|
+
errorMessage: message,
|
|
136
|
+
timestamp: Date.now(),
|
|
135
137
|
},
|
|
136
|
-
|
|
137
|
-
errorMessage: message,
|
|
138
|
-
timestamp: Date.now(),
|
|
139
|
-
},
|
|
138
|
+
})
|
|
140
139
|
})
|
|
141
|
-
output.end()
|
|
142
|
-
})
|
|
143
|
-
|
|
140
|
+
.finally(() => output.end())
|
|
144
141
|
return output
|
|
145
142
|
},
|
|
146
143
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/** JSON values carried by parsed wire events and tool-call arguments. */
|
|
2
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject
|
|
3
|
+
export type JsonObject = { [key: string]: JsonValue }
|
|
4
|
+
|
|
5
|
+
export type StopReason = "stop" | "length" | "toolUse" | "deferred"
|
|
2
6
|
export type ErrorReason = "error" | "aborted"
|
|
3
7
|
export type TerminalReason = StopReason | ErrorReason
|
|
4
8
|
|
|
@@ -34,7 +38,7 @@ export interface ToolCallContent {
|
|
|
34
38
|
type: "toolCall"
|
|
35
39
|
id: string
|
|
36
40
|
name: string
|
|
37
|
-
arguments:
|
|
41
|
+
arguments: JsonObject
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export type AssistantContent = TextContent | ThinkingContent | ToolCallContent
|
|
@@ -42,11 +46,11 @@ export type AssistantContent = TextContent | ThinkingContent | ToolCallContent
|
|
|
42
46
|
export interface AssistantMessageLike {
|
|
43
47
|
role: "assistant"
|
|
44
48
|
content: AssistantContent[]
|
|
45
|
-
api:
|
|
49
|
+
api: string
|
|
46
50
|
provider: string
|
|
47
51
|
model: string
|
|
48
52
|
usage: Usage
|
|
49
|
-
stopReason: TerminalReason
|
|
53
|
+
stopReason: TerminalReason | "pending"
|
|
50
54
|
errorMessage?: string
|
|
51
55
|
timestamp: number
|
|
52
56
|
}
|
|
@@ -68,7 +72,7 @@ export interface ModelCost extends ModelCostRates {
|
|
|
68
72
|
|
|
69
73
|
export interface ModelLike {
|
|
70
74
|
id: string
|
|
71
|
-
api:
|
|
75
|
+
api: string
|
|
72
76
|
provider: string
|
|
73
77
|
maxTokens: number
|
|
74
78
|
cost: ModelCost
|
|
@@ -108,34 +112,26 @@ export interface ProviderResponseInfo {
|
|
|
108
112
|
headers: Record<string, string>
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
export interface StreamOptions
|
|
115
|
+
export interface StreamOptions<
|
|
116
|
+
TModel extends ModelLike = ModelLike,
|
|
117
|
+
TReasoning extends string = string,
|
|
118
|
+
> {
|
|
112
119
|
apiKey?: string
|
|
113
120
|
signal?: AbortSignal
|
|
114
|
-
headers?: Record<string, string>
|
|
121
|
+
headers?: Record<string, string | null>
|
|
115
122
|
fetch?: typeof fetch
|
|
116
123
|
maxTokens?: number
|
|
117
124
|
temperature?: number
|
|
118
125
|
sessionId?: string
|
|
119
126
|
/** Resolved pi thinking level; forwarded only through the model's map. */
|
|
120
|
-
reasoning?:
|
|
121
|
-
onPayload?: (payload: unknown, model:
|
|
122
|
-
onResponse?: (response: ProviderResponseInfo, model:
|
|
123
|
-
/**
|
|
124
|
-
* HTTP request timeout in milliseconds.
|
|
125
|
-
* Applied per-attempt; on timeout the request is retried if retries remain.
|
|
126
|
-
*/
|
|
127
|
+
reasoning?: TReasoning
|
|
128
|
+
onPayload?: (payload: unknown, model: TModel) => unknown | Promise<unknown>
|
|
129
|
+
onResponse?: (response: ProviderResponseInfo, model: TModel) => void | Promise<void>
|
|
130
|
+
/** Forwarded to the native host; it owns timeout and retry semantics. */
|
|
127
131
|
timeoutMs?: number
|
|
128
|
-
/**
|
|
129
|
-
* Maximum retry attempts for transient HTTP errors (429, 5xx).
|
|
130
|
-
* Default: 0 (pi agent-level retry handles visible retries when unset).
|
|
131
|
-
*/
|
|
132
|
+
/** Native provider retry budget, separate from the host agent's retries. */
|
|
132
133
|
maxRetries?: number
|
|
133
|
-
/**
|
|
134
|
-
* Maximum delay in milliseconds to wait for a retry when the server requests
|
|
135
|
-
* a long wait via Retry-After. If the server's requested delay exceeds this
|
|
136
|
-
* value, the request fails immediately. Default: 60000 (60 seconds).
|
|
137
|
-
* Set to 0 to disable the cap.
|
|
138
|
-
*/
|
|
134
|
+
/** Native provider Retry-After limit; no extension-owned retry loop exists. */
|
|
139
135
|
maxRetryDelayMs?: number
|
|
140
136
|
}
|
|
141
137
|
|
|
@@ -195,18 +191,3 @@ export interface AssistantMessageEventStreamLike extends AsyncIterable<Assistant
|
|
|
195
191
|
push(event: AssistantMessageEvent): void
|
|
196
192
|
end(): void
|
|
197
193
|
}
|
|
198
|
-
|
|
199
|
-
export interface CoreDependencies {
|
|
200
|
-
createStream: () => AssistantMessageEventStreamLike
|
|
201
|
-
calculateCost: (model: ModelLike, usage: Usage, atMs?: number) => void
|
|
202
|
-
apiBase?: string
|
|
203
|
-
fetchImpl?: typeof fetch
|
|
204
|
-
authPaths?: readonly string[]
|
|
205
|
-
env?: NodeJS.ProcessEnv
|
|
206
|
-
cwd?: () => string
|
|
207
|
-
now?: () => number
|
|
208
|
-
uuid?: () => string
|
|
209
|
-
homeDir?: () => string
|
|
210
|
-
/** Injectable delay for retry backoff. Defaults to setTimeout. */
|
|
211
|
-
delay?: (ms: number, signal: AbortSignal) => Promise<void>
|
|
212
|
-
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { getConfiguredApiKey } from "./api-key.ts"
|
|
17
|
-
import { pickCommandCodeApiKey } from "./
|
|
17
|
+
import { pickCommandCodeApiKey } from "./api-key.ts"
|
|
18
18
|
import { fetchCommandCodeQuota } from "./quota.ts"
|
|
19
19
|
import type {
|
|
20
20
|
CommandCodeQuota,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# User changelog
|
|
2
|
+
|
|
3
|
+
## [4.4.9] - 2026-11-05
|
|
4
|
+
|
|
5
|
+
3 features, 29 fixes, 8 other changes.
|
|
6
|
+
|
|
7
|
+
Full notes: https://github.com/apmantza/pi-lens/releases/tag/v4.4.9
|
|
8
|
+
|
|
9
|
+
## [4.4.8] - 2026-11-01
|
|
10
|
+
|
|
11
|
+
1 feature, 28 fixes, 6 other changes.
|
|
12
|
+
|
|
13
|
+
Full notes: https://github.com/apmantza/pi-lens/releases/tag/v4.4.8
|
|
14
|
+
|
|
15
|
+
## [4.4.7] - 2026-10-29
|
|
16
|
+
|
|
17
|
+
2 features, 21 fixes.
|
|
18
|
+
|
|
19
|
+
Full notes: https://github.com/apmantza/pi-lens/releases/tag/v4.4.7
|
|
20
|
+
|
|
21
|
+
## [4.4.6] - 2026-10-27
|
|
22
|
+
|
|
23
|
+
6 fixes, 2 other changes.
|
|
24
|
+
|
|
25
|
+
Full notes: https://github.com/apmantza/pi-lens/releases/tag/v4.4.6
|
|
26
|
+
|
|
27
|
+
## [4.4.5] - 2026-10-25
|
|
28
|
+
|
|
29
|
+
3 features, 67 fixes, 7 other changes.
|
|
30
|
+
|
|
31
|
+
Full notes: https://github.com/apmantza/pi-lens/releases/tag/v4.4.5
|