@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.
Files changed (235) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +13 -13
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +12 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +109 -16
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +33 -5
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +72 -17
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +5 -1
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +16 -7
  13. package/node_modules/@herbertgao/pi-cc-extensions/package.json +7 -5
  14. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +92 -0
  15. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +92 -0
  16. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  17. package/node_modules/@herbertgao/pi-subagents/README.md +12 -10
  18. package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +1 -1
  19. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  20. package/node_modules/@herbertgao/pi-subagents/src/agent-record-entry.ts +22 -6
  21. package/node_modules/@herbertgao/pi-subagents/src/index.ts +9 -4
  22. package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +167 -7
  23. package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +8 -4
  24. package/node_modules/@narumitw/pi-btw/CHANGELOG.md +259 -0
  25. package/node_modules/@narumitw/pi-btw/package.json +6 -5
  26. package/node_modules/@narumitw/pi-caffeinate/CHANGELOG.md +70 -0
  27. package/node_modules/@narumitw/pi-caffeinate/package.json +5 -4
  28. package/node_modules/pi-commandcode-provider/CHANGELOG.md +48 -0
  29. package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +64 -5
  30. package/node_modules/pi-commandcode-provider/README.md +44 -18
  31. package/node_modules/pi-commandcode-provider/RELEASE.md +25 -0
  32. package/node_modules/pi-commandcode-provider/index.ts +222 -42
  33. package/node_modules/pi-commandcode-provider/package.json +9 -8
  34. package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +6 -13
  35. package/node_modules/pi-commandcode-provider/scripts/typecheck-entrypoint.mjs +88 -0
  36. package/node_modules/pi-commandcode-provider/src/api-key.ts +67 -10
  37. package/node_modules/pi-commandcode-provider/src/auth-server.ts +33 -24
  38. package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +1 -1
  39. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +9 -2
  40. package/node_modules/pi-commandcode-provider/src/cost.ts +29 -43
  41. package/node_modules/pi-commandcode-provider/src/diagnostics.ts +215 -0
  42. package/node_modules/pi-commandcode-provider/src/oauth.ts +41 -7
  43. package/node_modules/pi-commandcode-provider/src/pricing.ts +5 -3
  44. package/node_modules/pi-commandcode-provider/src/quota-command.ts +1 -1
  45. package/node_modules/pi-commandcode-provider/src/routing.ts +166 -0
  46. package/node_modules/pi-commandcode-provider/src/runtime.ts +23 -10
  47. package/node_modules/pi-commandcode-provider/src/transport.ts +82 -85
  48. package/node_modules/pi-commandcode-provider/src/types.ts +20 -39
  49. package/node_modules/pi-commandcode-provider/src/usage.ts +1 -1
  50. package/node_modules/pi-lens/CHANGELOG-USER.md +31 -0
  51. package/node_modules/pi-lens/CHANGELOG.md +178 -0
  52. package/node_modules/pi-lens/README.md +2 -1
  53. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -1
  54. package/node_modules/pi-lens/dist/{chunk-3O5EII3W.js → chunk-2VZ3VN3N.js} +2 -2
  55. package/node_modules/pi-lens/dist/{chunk-SDFKOLSF.js → chunk-3HTZDY3C.js} +8 -6
  56. package/node_modules/pi-lens/dist/{chunk-A5GRLYPZ.js → chunk-3NPWO5UO.js} +7 -13
  57. package/node_modules/pi-lens/dist/{chunk-AGGUWKRK.js → chunk-47UCC4MM.js} +1 -1
  58. package/node_modules/pi-lens/dist/chunk-4ENEJHF4.js +198 -0
  59. package/node_modules/pi-lens/dist/{chunk-WXUDRAG6.js → chunk-5GEYJJHG.js} +10 -12
  60. package/node_modules/pi-lens/dist/{chunk-HHR7WGCI.js → chunk-5YSEQHJN.js} +3 -3
  61. package/node_modules/pi-lens/dist/{chunk-L3CLUGDY.js → chunk-6GPB3JLL.js} +3 -3
  62. package/node_modules/pi-lens/dist/{chunk-5F3XF3SX.js → chunk-7R5GZIA6.js} +6 -6
  63. package/node_modules/pi-lens/dist/{chunk-CUDD35TW.js → chunk-7UTSNTWM.js} +4 -4
  64. package/node_modules/pi-lens/dist/{chunk-DYRZGUMA.js → chunk-7YTRG6YW.js} +2 -2
  65. package/node_modules/pi-lens/dist/{chunk-JZRP4DGP.js → chunk-AACN5GNE.js} +2 -2
  66. package/node_modules/pi-lens/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
  67. package/node_modules/pi-lens/dist/{chunk-6FIRFP6A.js → chunk-C3YRO3EU.js} +10 -12
  68. package/node_modules/pi-lens/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
  69. package/node_modules/pi-lens/dist/{chunk-BBET6HD6.js → chunk-CDFJF5YD.js} +1 -1
  70. package/node_modules/pi-lens/dist/{chunk-NSPVR3FN.js → chunk-CJS6WE66.js} +17 -19
  71. package/node_modules/pi-lens/dist/{chunk-6YUNI7B5.js → chunk-CM6BDY4E.js} +14 -60
  72. package/node_modules/pi-lens/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
  73. package/node_modules/pi-lens/dist/chunk-DGKFWQK4.js +23 -0
  74. package/node_modules/pi-lens/dist/{chunk-VOP4PJKA.js → chunk-E65WJVI5.js} +7 -9
  75. package/node_modules/pi-lens/dist/{chunk-TV6RXRYH.js → chunk-EKNYSXFB.js} +8 -10
  76. package/node_modules/pi-lens/dist/{chunk-4LL2VRNY.js → chunk-EY6LY2HO.js} +16 -18
  77. package/node_modules/pi-lens/dist/{chunk-MC6VB2E5.js → chunk-F6BEQWAK.js} +17 -5
  78. package/node_modules/pi-lens/dist/{chunk-R2QQC33W.js → chunk-FGNSESAC.js} +12 -14
  79. package/node_modules/pi-lens/dist/{chunk-OC7VWJBZ.js → chunk-FRUBVFXV.js} +35 -37
  80. package/node_modules/pi-lens/dist/{chunk-7CGIDRIK.js → chunk-G22UNQID.js} +14 -16
  81. package/node_modules/pi-lens/dist/{chunk-L4NEVZ4T.js → chunk-GQTQUNCG.js} +25 -27
  82. package/node_modules/pi-lens/dist/{chunk-ZKLTNLAW.js → chunk-H3BVMK47.js} +6 -6
  83. package/node_modules/pi-lens/dist/chunk-H6FLQ5NW.js +28 -0
  84. package/node_modules/pi-lens/dist/{chunk-2ZE3AUJQ.js → chunk-HEA3EM23.js} +13 -15
  85. package/node_modules/pi-lens/dist/{chunk-CZL44WFN.js → chunk-HSOBIN22.js} +2 -2
  86. package/node_modules/pi-lens/dist/{chunk-PKSUMEPT.js → chunk-HYSKJMZK.js} +3 -3
  87. package/node_modules/pi-lens/dist/{chunk-VN3L2JWZ.js → chunk-IICERRFF.js} +5 -5
  88. package/node_modules/pi-lens/dist/{chunk-O4N5BQ3T.js → chunk-IILEH3ZC.js} +8 -10
  89. package/node_modules/pi-lens/dist/{chunk-WC6WRNQT.js → chunk-J3Q2NYJR.js} +2 -2
  90. package/node_modules/pi-lens/dist/{chunk-SFLHSL5R.js → chunk-JUZ67QZQ.js} +18 -7
  91. package/node_modules/pi-lens/dist/chunk-KR5VGMVT.js +25 -0
  92. package/node_modules/pi-lens/dist/{chunk-UHHLR2VY.js → chunk-KV6GQOGN.js} +38 -41
  93. package/node_modules/pi-lens/dist/{chunk-HUAM7QG3.js → chunk-KXMJLOZF.js} +25 -23
  94. package/node_modules/pi-lens/dist/{chunk-BUZIQDFS.js → chunk-L4Y3ROKQ.js} +3 -3
  95. package/node_modules/pi-lens/dist/{chunk-JBP7KESM.js → chunk-L6WBJGQS.js} +1 -1
  96. package/node_modules/pi-lens/dist/{chunk-35WKJWO5.js → chunk-L7O774U7.js} +14 -14
  97. package/node_modules/pi-lens/dist/{chunk-BOPDQ7AZ.js → chunk-LAHHGNAY.js} +19 -21
  98. package/node_modules/pi-lens/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
  99. package/node_modules/pi-lens/dist/{chunk-5T5A6YAJ.js → chunk-LWOM6LVS.js} +33 -34
  100. package/node_modules/pi-lens/dist/{chunk-JYLOYTZD.js → chunk-MKPDIAZH.js} +5 -1
  101. package/node_modules/pi-lens/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
  102. package/node_modules/pi-lens/dist/{chunk-BQG2QFVO.js → chunk-MQ4PPCJB.js} +21 -29
  103. package/node_modules/pi-lens/dist/{chunk-HXFUTMX2.js → chunk-MRLH4MYU.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-XOMGO63G.js → chunk-N56BNAA6.js} +19 -21
  105. package/node_modules/pi-lens/dist/{chunk-7MAD5ZAY.js → chunk-N5CEGQPG.js} +14 -16
  106. package/node_modules/pi-lens/dist/{chunk-ZFORSIED.js → chunk-NCLO6E6N.js} +13 -33
  107. package/node_modules/pi-lens/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
  108. package/node_modules/pi-lens/dist/{chunk-I22THIHI.js → chunk-NMUSOZ2D.js} +10 -12
  109. package/node_modules/pi-lens/dist/{chunk-4NBWFYWW.js → chunk-NOWH2VA2.js} +8 -33
  110. package/node_modules/pi-lens/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
  111. package/node_modules/pi-lens/dist/{chunk-OZWXLJMX.js → chunk-OSEKJEUU.js} +2 -2
  112. package/node_modules/pi-lens/dist/{chunk-2BKUFQKR.js → chunk-OUYAUXAT.js} +405 -181
  113. package/node_modules/pi-lens/dist/{chunk-JPRDTY5S.js → chunk-PBZNYHMM.js} +8 -10
  114. package/node_modules/pi-lens/dist/{chunk-JE6HKLC7.js → chunk-PIIUNJIT.js} +2 -4
  115. package/node_modules/pi-lens/dist/{chunk-ZZDIOAAJ.js → chunk-PRHYIA6X.js} +6 -6
  116. package/node_modules/pi-lens/dist/{chunk-4W52ZKZX.js → chunk-PXQ45SGD.js} +2 -2
  117. package/node_modules/pi-lens/dist/chunk-Q6JQKWPK.js +25 -0
  118. package/node_modules/pi-lens/dist/{chunk-PIQQM32Y.js → chunk-QB7T2PHK.js} +2 -2
  119. package/node_modules/pi-lens/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
  120. package/node_modules/pi-lens/dist/chunk-QJJKOHLH.js +57 -0
  121. package/node_modules/pi-lens/dist/{chunk-6LJOJ6EO.js → chunk-QP33NKYC.js} +14 -16
  122. package/node_modules/pi-lens/dist/{chunk-DIWK3LBC.js → chunk-QVBOXT3L.js} +8 -10
  123. package/node_modules/pi-lens/dist/{chunk-IYVYZQRL.js → chunk-RNJFRXEN.js} +5 -7
  124. package/node_modules/pi-lens/dist/{chunk-G6JKM4O7.js → chunk-RNXOWDM6.js} +10 -10
  125. package/node_modules/pi-lens/dist/{chunk-5RNB4HVK.js → chunk-RTFMDIKV.js} +1 -1
  126. package/node_modules/pi-lens/dist/{chunk-XWIME22V.js → chunk-SIQHOB6P.js} +11 -13
  127. package/node_modules/pi-lens/dist/{chunk-T2S3FNNJ.js → chunk-SLSMJPEF.js} +41 -42
  128. package/node_modules/pi-lens/dist/chunk-T5QSLSMM.js +50 -0
  129. package/node_modules/pi-lens/dist/chunk-TGQDAG4B.js +88 -0
  130. package/node_modules/pi-lens/dist/{chunk-6GMGEKQN.js → chunk-THYHUIDR.js} +39 -12
  131. package/node_modules/pi-lens/dist/{chunk-WMDUT4KH.js → chunk-TMNUTMT5.js} +72 -89
  132. package/node_modules/pi-lens/dist/{chunk-7TNILKGY.js → chunk-TOE2RRCS.js} +1 -1
  133. package/node_modules/pi-lens/dist/chunk-TYHPVE5H.js +25 -0
  134. package/node_modules/pi-lens/dist/chunk-UAKO2M6B.js +73 -0
  135. package/node_modules/pi-lens/dist/chunk-UC5AXW5Z.js +20 -0
  136. package/node_modules/pi-lens/dist/chunk-UTJP6WOS.js +28 -0
  137. package/node_modules/pi-lens/dist/{chunk-FRLAUP2B.js → chunk-UXTQ3QPD.js} +4 -4
  138. package/node_modules/pi-lens/dist/{chunk-4QG55RRC.js → chunk-V2WDBOLZ.js} +10 -12
  139. package/node_modules/pi-lens/dist/{chunk-FHEV6T4L.js → chunk-V67D6TMU.js} +8 -10
  140. package/node_modules/pi-lens/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
  141. package/node_modules/pi-lens/dist/{chunk-KZ4ALBCH.js → chunk-VO4JFPTV.js} +2 -2
  142. package/node_modules/pi-lens/dist/{chunk-GIRBSBGL.js → chunk-VWLSU3XV.js} +3 -3
  143. package/node_modules/pi-lens/dist/{chunk-2453RRJ2.js → chunk-W5E72HJA.js} +59 -22
  144. package/node_modules/pi-lens/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
  145. package/node_modules/pi-lens/dist/{chunk-SP4TFY5F.js → chunk-WSSLVMDA.js} +11 -13
  146. package/node_modules/pi-lens/dist/{chunk-PPKECBPP.js → chunk-WTB4GKMH.js} +10 -1
  147. package/node_modules/pi-lens/dist/{chunk-X35S7HSB.js → chunk-X5BJ3G2P.js} +41 -30
  148. package/node_modules/pi-lens/dist/{chunk-X66YJ2SS.js → chunk-XKFO2SZV.js} +33 -34
  149. package/node_modules/pi-lens/dist/{chunk-OWTG6UMO.js → chunk-XLAI7UYY.js} +75 -22
  150. package/node_modules/pi-lens/dist/{chunk-4B2YFN4U.js → chunk-XO756WE5.js} +45 -33
  151. package/node_modules/pi-lens/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
  152. package/node_modules/pi-lens/dist/{chunk-XYLC35E4.js → chunk-YOXCCJDF.js} +517 -308
  153. package/node_modules/pi-lens/dist/{chunk-O2ARHQKF.js → chunk-ZCQBNPRH.js} +2 -2
  154. package/node_modules/pi-lens/dist/chunk-ZD4KVFXI.js +234 -0
  155. package/node_modules/pi-lens/dist/{chunk-LSFXZLPW.js → chunk-ZDMFGACN.js} +184 -235
  156. package/node_modules/pi-lens/dist/{chunk-4BKU7PV3.js → chunk-ZMMHHXSW.js} +1 -1
  157. package/node_modules/pi-lens/dist/{chunk-OY7WZI7Q.js → chunk-ZPM7ZIFL.js} +6 -6
  158. package/node_modules/pi-lens/dist/{chunk-R4QWJQ2H.js → chunk-ZVCDHYWZ.js} +9 -11
  159. package/node_modules/pi-lens/dist/{chunk-RZG472YW.js → chunk-ZZN74OGD.js} +83 -46
  160. package/node_modules/pi-lens/dist/{chunk-BHWW6FAX.js → chunk-ZZSJAR76.js} +37 -19
  161. package/node_modules/pi-lens/dist/index.js +4910 -4218
  162. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +12 -17
  163. package/node_modules/pi-lens/dist/mcp/cli.js +41 -42
  164. package/node_modules/pi-lens/dist/mcp/server.js +1451 -648
  165. package/node_modules/pi-lens/dist/mcp/worker.js +59 -60
  166. package/node_modules/pi-lens/dist/probes/installer.js +17 -19
  167. package/node_modules/pi-lens/docs/agent-tools.md +40 -8
  168. package/node_modules/pi-lens/docs/analysisall.md +1 -1
  169. package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +7 -5
  170. package/node_modules/pi-lens/docs/configuration.md +51 -9
  171. package/node_modules/pi-lens/docs/defect-shapes.md +52 -3
  172. package/node_modules/pi-lens/docs/environment-variables.md +18 -1
  173. package/node_modules/pi-lens/docs/features.md +12 -5
  174. package/node_modules/pi-lens/docs/globalconfig.md +11 -3
  175. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +9 -2
  176. package/node_modules/pi-lens/docs/invariants/session-telemetry.md +2 -2
  177. package/node_modules/pi-lens/docs/language-coverage.md +1 -0
  178. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +57 -35
  179. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +4 -1
  180. package/node_modules/pi-lens/docs/merge-queue-rollout.md +10 -8
  181. package/node_modules/pi-lens/docs/module-report-read-symbol.md +34 -23
  182. package/node_modules/pi-lens/docs/pi-lens-fixer.md +11 -1
  183. package/node_modules/pi-lens/docs/pi-lens-investigator.md +3 -0
  184. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +15 -7
  185. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +1 -1
  186. package/node_modules/pi-lens/docs/pi-lens-subagent.md +13 -0
  187. package/node_modules/pi-lens/docs/public-api-stability.md +39 -5
  188. package/node_modules/pi-lens/docs/release-qa-baseline.md +7 -4
  189. package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +11 -2
  190. package/node_modules/pi-lens/docs/servercapabilities.md +3 -1
  191. package/node_modules/pi-lens/docs/settings.md +2 -2
  192. package/node_modules/pi-lens/docs/word-index.md +3 -2
  193. package/node_modules/pi-lens/package.json +8 -3
  194. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
  195. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
  196. package/node_modules/pi-lens/scripts/download-grammars.js +3 -2
  197. package/node_modules/pi-lens/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
  198. package/node_modules/pi-provider-qoder/dist/index.js +473 -62
  199. package/node_modules/pi-provider-qoder/package.json +1 -1
  200. package/node_modules/pi-web-access/CHANGELOG.md +22 -0
  201. package/node_modules/pi-web-access/README.md +31 -12
  202. package/node_modules/pi-web-access/curator-page.ts +5 -1
  203. package/node_modules/pi-web-access/curator-server.ts +2 -0
  204. package/node_modules/pi-web-access/dist/index.js +673 -308
  205. package/node_modules/pi-web-access/dist/mcp-cli.js +666 -309
  206. package/node_modules/pi-web-access/gemini-search.ts +12 -4
  207. package/node_modules/pi-web-access/github-api.ts +1 -1
  208. package/node_modules/pi-web-access/github-extract.ts +3 -2
  209. package/node_modules/pi-web-access/index.ts +7 -3
  210. package/node_modules/pi-web-access/mcp-tool-definitions.ts +1 -1
  211. package/node_modules/pi-web-access/outcrawl.ts +204 -0
  212. package/node_modules/pi-web-access/package.json +2 -2
  213. package/node_modules/pi-web-access/sofya.ts +201 -0
  214. package/node_modules/pi-web-access/utils.ts +16 -6
  215. package/node_modules/pi-web-access/web-tool-core.ts +4 -0
  216. package/package.json +16 -14
  217. package/node_modules/pi-commandcode-provider/src/converters.ts +0 -477
  218. package/node_modules/pi-commandcode-provider/src/core.ts +0 -836
  219. package/node_modules/pi-commandcode-provider/src/json-schema.ts +0 -417
  220. package/node_modules/pi-commandcode-provider/src/transcript.ts +0 -56
  221. package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +0 -31
  222. package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +0 -27
  223. package/node_modules/pi-lens/dist/chunk-447YZL4S.js +0 -25
  224. package/node_modules/pi-lens/dist/chunk-565VRUP4.js +0 -136
  225. package/node_modules/pi-lens/dist/chunk-57X2CDRX.js +0 -49
  226. package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +0 -27
  227. package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +0 -58
  228. package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +0 -22
  229. package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +0 -89
  230. package/node_modules/pi-lens/dist/chunk-U3AS2FR6.js +0 -106
  231. package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +0 -27
  232. package/node_modules/pi-lens/dist/chunk-WQV6BI4Q.js +0 -48
  233. package/node_modules/pi-lens/dist/chunk-YHGYAEFH.js +0 -443
  234. package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +0 -74
  235. package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +0 -30
@@ -5,7 +5,10 @@
5
5
  * https://api.commandcode.ai/provider/v1
6
6
  */
7
7
 
8
- import { AssistantMessageEventStream } from "@earendil-works/pi-ai"
8
+ import {
9
+ createAssistantMessageEventStream,
10
+ type AssistantMessageEventStream,
11
+ } from "@earendil-works/pi-ai"
9
12
  import * as piAiCompat from "@earendil-works/pi-ai/compat"
10
13
  import { streamSimple as streamNativeProvider } from "@earendil-works/pi-ai/compat"
11
14
  import {
@@ -15,11 +18,16 @@ import {
15
18
  type ProviderConfig,
16
19
  } from "@earendil-works/pi-coding-agent"
17
20
  import { join } from "node:path"
21
+ import { readFile } from "node:fs/promises"
22
+ import * as hostPackage from "@earendil-works/pi-coding-agent"
23
+ import { createRequestDiagnostics, formatDiagnostics, priceStatus } from "./src/diagnostics.ts"
18
24
 
19
- import { getConfiguredApiKey } from "./src/api-key.ts"
20
- import { pickCommandCodeApiKey, withResolvedCommandCodeApiKey } from "./src/converters.ts"
21
- import { createStreamCommandCode } from "./src/core.ts"
22
- import { calculateCommandCodeCost, commandCodeCostRatesAt } from "./src/cost.ts"
25
+ import {
26
+ getConfiguredApiKey,
27
+ pickCommandCodeApiKey,
28
+ withResolvedCommandCodeApiKey,
29
+ } from "./src/api-key.ts"
30
+ import { commandCodeNativeCostRatesAt } from "./src/cost.ts"
23
31
  import {
24
32
  apiForModelId,
25
33
  baseUrlForModel,
@@ -40,8 +48,16 @@ import { MODEL_COSTS, ZERO_MODEL_COST } from "./src/pricing.ts"
40
48
  import { registerCommandCodeQuota } from "./src/quota-command.ts"
41
49
  import { normalizeCommandCodeResponsesResponse } from "./src/responses-stream.ts"
42
50
  import { createCommandCodeRuntime } from "./src/runtime.ts"
51
+ import {
52
+ compatForEndpoint,
53
+ endpointChoiceForModel,
54
+ isEndpointChoice,
55
+ loadEndpointOverrides,
56
+ resolveEndpoint,
57
+ saveEndpointChoice,
58
+ type EndpointOverrides,
59
+ } from "./src/routing.ts"
43
60
  import { createCommandCodeUsageProvider, type UsageProvider } from "./src/usage.ts"
44
- import { transcriptReadersFrom, withTranscriptPromptAndTools } from "./src/transcript.ts"
45
61
  import { createCommandCodeTransportRouter } from "./src/transport.ts"
46
62
 
47
63
  const COMMAND_CODE_API = "commandcode-custom"
@@ -111,7 +127,22 @@ function commandCodeHeaders(): Record<string, string> | undefined {
111
127
  */
112
128
  type CommandCodeProviderConfig = ProviderConfig & { usage?: UsageProvider }
113
129
 
114
- type CommandCodeModelCompat = NonNullable<ProviderConfig["models"]>[number]["compat"]
130
+ type NativeModel = Parameters<typeof streamNativeProvider>[0]
131
+ type HostContext = Parameters<typeof streamNativeProvider>[1]
132
+ type HostReasoning = NonNullable<
133
+ NonNullable<Parameters<typeof streamNativeProvider>[2]>["reasoning"]
134
+ >
135
+ // Host-specific passthrough flags may be absent from Pi's declarations.
136
+ type CommandCodeModelCompat = NonNullable<NativeModel["compat"]> & {
137
+ supportsToolReferences?: boolean
138
+ // OMP's completions encoder requires this opt-in; Pi ignores the extra flag.
139
+ // Verified in @oh-my-pi/pi-ai 18.16.0, src/providers/openai-completions.ts.
140
+ replayReasoningContent?: boolean
141
+ // Private registration metadata, preserved through host/user compat overlays.
142
+ commandCodeWire?: CommandCodeApi
143
+ }
144
+ // OMP exposes sparse authored/user overrides here; Pi uses `compat`.
145
+ type HostModel = NativeModel & { compatConfig?: CommandCodeModelCompat }
115
146
 
116
147
  /**
117
148
  * Compatibility flags per wire. Chat Completions mirrors what the Provider API
@@ -140,6 +171,7 @@ function compatForModel(model: CommandCodeModel): CommandCodeModelCompat {
140
171
  supportsStore: false,
141
172
  supportsDeveloperRole: false,
142
173
  supportsReasoningEffort: MODEL_EFFORTS[model.id] !== undefined,
174
+ replayReasoningContent: model.reasoning,
143
175
  maxTokensField: "max_tokens",
144
176
  }
145
177
  }
@@ -159,7 +191,7 @@ function createProviderConfig(
159
191
  headers,
160
192
  // Same alpha endpoints and credentials as the /commandcode-quota command.
161
193
  usage: createCommandCodeUsageProvider({
162
- apiBase: legacyApiBase(apiBase),
194
+ apiBase: quotaApiBase(apiBase),
163
195
  headers,
164
196
  }),
165
197
  oauth: {
@@ -176,20 +208,54 @@ function createProviderConfig(
176
208
  reasoning: model.reasoning,
177
209
  ...(thinkingMetadataForModel(model.id) ?? {}),
178
210
  input: [...inputModalitiesForModel(model.id)],
179
- cost: MODEL_COSTS[model.id] ?? ZERO_MODEL_COST,
211
+ // Registration hands mutable metadata to the host, never the readonly catalog.
212
+ cost: {
213
+ ...(MODEL_COSTS[model.id] ?? ZERO_MODEL_COST),
214
+ tiers: MODEL_COSTS[model.id]?.tiers?.map((tier) => ({ ...tier })),
215
+ },
180
216
  contextWindow: model.contextWindow,
181
217
  maxTokens: model.maxTokens,
182
218
  headers,
183
- compat: compatForModel(model),
219
+ compat: { ...compatForModel(model), commandCodeWire: model.api },
184
220
  })),
185
221
  }
186
222
  }
187
223
 
188
- function legacyApiBase(providerApiBase: string): string {
224
+ function quotaApiBase(providerApiBase: string): string {
189
225
  return providerApiBase.replace(/\/provider\/v1\/?$/, "")
190
226
  }
191
227
 
192
228
  export default async function (pi: ExtensionAPI) {
229
+ let pluginVersion = "unknown"
230
+ try {
231
+ const packageData: unknown = JSON.parse(
232
+ await readFile(new URL("./package.json", import.meta.url), "utf8"),
233
+ )
234
+ if (
235
+ typeof packageData === "object" &&
236
+ packageData !== null &&
237
+ "version" in packageData &&
238
+ typeof packageData.version === "string"
239
+ )
240
+ pluginVersion = packageData.version
241
+ } catch {
242
+ // Optional support metadata must not prevent loading the provider.
243
+ }
244
+ const hostVersion =
245
+ "VERSION" in hostPackage && typeof hostPackage.VERSION === "string"
246
+ ? hostPackage.VERSION
247
+ : "unknown"
248
+ const diagnostics = createRequestDiagnostics()
249
+ const warnedPrices = new Set<string>()
250
+ pi.on("before_agent_start", (_event, ctx) => {
251
+ if (ctx.model?.provider !== "commandcode" || warnedPrices.has(ctx.model.id)) return
252
+ if (priceStatus(ctx.model.id) === "known") return
253
+ warnedPrices.add(ctx.model.id)
254
+ ctx.ui.notify(
255
+ "Command Code display price is unknown or needs review. A zero estimate does not mean free usage; check /commandcode-diagnostics.",
256
+ "warning",
257
+ )
258
+ })
193
259
  // Hosts may select their built-in Command Code model before loading extensions.
194
260
  // Rebind that stale selection to our registered transport before the first turn.
195
261
  pi.on("session_start", async (_event, ctx) => {
@@ -204,60 +270,123 @@ export default async function (pi: ExtensionAPI) {
204
270
  const modelsTimeoutMs = getModelsTimeoutMs()
205
271
  const modelsCachePath =
206
272
  process.env.COMMANDCODE_MODELS_CACHE ?? join(getAgentDir(), "commandcode-models.json")
207
- const streamGenerate = createStreamCommandCode({
208
- createStream: () => new AssistantMessageEventStream(),
209
- calculateCost: calculateCommandCodeCost,
210
- apiBase: legacyApiBase(apiBase),
211
- })
212
273
  const resolveStreamOptions = (options?: Parameters<typeof streamNativeProvider>[2]) =>
213
274
  withResolvedCommandCodeApiKey(options, getConfiguredApiKey())
214
- // The provider transport delegates to pi-ai, which reads the transcript
215
- // itself. The generate transport builds its own request body and needs the
216
- // flat prompt and tool fields that pi 0.86+ no longer passes.
217
- const transcriptReaders = transcriptReadersFrom(piAiCompat)
218
275
  // The host dispatches every Command Code model through one custom api id, so
219
276
  // the wire each model answers on is resolved here from the catalog that
220
277
  // `createProviderConfig` registered. Unknown ids fall back to the id rule.
221
- const modelApis = new Map<string, CommandCodeApi>()
222
- const resolveModelApi = (modelId: string): CommandCodeApi =>
223
- modelApis.get(modelId) ?? apiForModelId(modelId)
278
+ const catalogModels = new Map<string, CommandCodeModel>()
279
+ const routingPath = join(getAgentDir(), "commandcode-routing.json")
280
+ let routing: EndpointOverrides = {}
281
+ let routingWarning: string | undefined
282
+ try {
283
+ routing = await loadEndpointOverrides(routingPath)
284
+ } catch (error) {
285
+ routingWarning = `${error instanceof Error ? error.message : "Invalid commandcode-routing.json"}; using catalog routing. Use /commandcode-endpoint <model-id> auto|responses|chat-completions to repair it explicitly.`
286
+ console.error(`[commandcode] routing warning: ${routingWarning}`)
287
+ }
288
+ const resolveModelApi = (modelId: string): CommandCodeApi => {
289
+ const model = catalogModels.get(modelId)
290
+ return model ? resolveEndpoint(model, routing) : apiForModelId(modelId)
291
+ }
292
+ pi.on("before_agent_start", (_event, ctx) => {
293
+ if (routingWarning && ctx.model?.provider === "commandcode") {
294
+ ctx.ui.notify(routingWarning, "warning")
295
+ }
296
+ })
297
+ // waitForIdle is not a lock: serialize command writes within this host so
298
+ // simultaneous callers cannot overwrite one another's unrelated choices.
299
+ let routingWrite = Promise.resolve()
300
+ pi.registerCommand("commandcode-endpoint", {
301
+ description: "Choose a persistent model endpoint: <model-id> auto|responses|chat-completions",
302
+ handler: async (args, ctx) => {
303
+ const [modelId, choice, extra] = args.trim().split(/\s+/)
304
+ if (!modelId || !isEndpointChoice(choice) || extra) {
305
+ ctx.ui.notify(
306
+ "Usage: /commandcode-endpoint <catalog-model-id> auto|responses|chat-completions",
307
+ "warning",
308
+ )
309
+ return
310
+ }
311
+ await ctx.waitForIdle()
312
+ routingWrite = routingWrite
313
+ .catch(() => {})
314
+ .then(async () => {
315
+ try {
316
+ // A refresh can finish while the command is waiting for the current turn.
317
+ const model = catalogModels.get(modelId)
318
+ if (!model) {
319
+ ctx.ui.notify(
320
+ "Unknown catalog model; refresh the catalog or use a listed model ID",
321
+ "warning",
322
+ )
323
+ return
324
+ }
325
+ resolveEndpoint(model, { [model.id]: choice })
326
+ const saved = await saveEndpointChoice(routingPath, model.id, choice)
327
+ routing = saved.overrides
328
+ routingWarning = undefined
329
+ ctx.ui.notify(
330
+ `Command Code endpoint for ${model.id}: ${resolveModelApi(model.id)} (${choice === "auto" ? "catalog" : "user override"}). Applies to the next request and survives refresh/restart.` +
331
+ (saved.backupFile
332
+ ? ` Invalid routing choices were replaced; previous contents saved as ${saved.backupFile} in the agent directory.`
333
+ : ""),
334
+ saved.backupFile ? "warning" : "info",
335
+ )
336
+ } catch (error) {
337
+ ctx.ui.notify(
338
+ error instanceof Error ? error.message : "Could not save routing configuration",
339
+ "error",
340
+ )
341
+ }
342
+ })
343
+ await routingWrite
344
+ },
345
+ })
346
+ // Diagnostic for /commandcode-status: reflects the most recent Responses
347
+ // request, so a one-off malformed stream does not stick until restart.
224
348
  let streamWarning: string | undefined
225
- const transport = createCommandCodeTransportRouter({
226
- createStream: () => new AssistantMessageEventStream(),
349
+ const transport = createCommandCodeTransportRouter<HostModel, HostContext, HostReasoning>({
350
+ createStream: createAssistantMessageEventStream,
227
351
  streamProvider: (model, context, options) => {
228
352
  const wire = resolveModelApi(model.id)
353
+ const catalogModel = catalogModels.get(model.id)
229
354
  const resolvedOptions: Parameters<typeof streamNativeProvider>[2] =
230
355
  resolveStreamOptions(options)
231
356
  const nativeOptions =
232
357
  wire === "openai-responses"
233
358
  ? {
234
359
  ...resolvedOptions,
235
- fetch: async (...args: Parameters<typeof fetch>) =>
236
- normalizeCommandCodeResponsesResponse(
360
+ fetch: async (...args: Parameters<typeof fetch>) => {
361
+ streamWarning = undefined
362
+ return normalizeCommandCodeResponsesResponse(
237
363
  await (resolvedOptions?.fetch ?? fetch)(...args),
238
364
  (warning) => {
239
365
  streamWarning = warning
240
366
  },
241
- ),
367
+ )
368
+ },
242
369
  }
243
370
  : resolvedOptions
244
371
  return streamNativeProvider(
245
372
  {
246
373
  ...model,
247
374
  api: wire,
248
- cost: commandCodeCostRatesAt(model.id, model.cost),
249
- compat: model.compatConfig ?? model.compat,
375
+ // Native hosts receive mutable tiers without owning the readonly catalog.
376
+ cost: commandCodeNativeCostRatesAt(model.id, model.cost),
377
+ // Preserve same-wire host/user settings, but replace unknown/stale
378
+ // compatibility metadata rather than merge flags across wires.
379
+ compat: compatForEndpoint(
380
+ catalogModel,
381
+ wire,
382
+ model.compatConfig ?? model.compat,
383
+ compatForModel,
384
+ ),
250
385
  },
251
386
  context,
252
387
  nativeOptions,
253
388
  )
254
389
  },
255
- streamGenerate: (model, context, options) =>
256
- streamGenerate(
257
- model,
258
- withTranscriptPromptAndTools(context, transcriptReaders),
259
- resolveStreamOptions(options),
260
- ),
261
390
  })
262
391
 
263
392
  // pi dispatches the main chat through the registered provider, but sibling
@@ -267,8 +396,19 @@ export default async function (pi: ExtensionAPI) {
267
396
  // custom api there so those calls reach the same transport. The registry
268
397
  // resolves no credentials for extension providers, so fall back to the
269
398
  // configured key when the caller passes none or a placeholder.
270
- const compatStream: CompatStreamFunction = (model, context, options) =>
271
- transport.stream(model, context, resolveStreamOptions(options)) as AssistantMessageEventStream
399
+ const measuredStream = (
400
+ model: Parameters<typeof transport.stream>[0],
401
+ context: Parameters<typeof transport.stream>[1],
402
+ options?: Parameters<typeof streamNativeProvider>[2],
403
+ ) =>
404
+ diagnostics.stream(
405
+ transport.stream,
406
+ createAssistantMessageEventStream,
407
+ model,
408
+ context,
409
+ resolveStreamOptions(options),
410
+ )
411
+ const compatStream: CompatStreamFunction = measuredStream
272
412
  registerCompatApiProvider(compatStream)
273
413
 
274
414
  pi.on("message_end", async (event, ctx) => {
@@ -278,7 +418,7 @@ export default async function (pi: ExtensionAPI) {
278
418
  })
279
419
 
280
420
  registerCommandCodeQuota(pi, {
281
- apiBase: legacyApiBase(apiBase),
421
+ apiBase: quotaApiBase(apiBase),
282
422
  headers: commandCodeHeaders(),
283
423
  })
284
424
 
@@ -294,11 +434,51 @@ export default async function (pi: ExtensionAPI) {
294
434
  }),
295
435
  loadCachedModels: () => loadCachedCommandCodeModels(modelsCachePath),
296
436
  createProviderConfig: (models) => {
297
- for (const model of models) modelApis.set(model.id, model.api)
298
- return createProviderConfig(models, apiBase, transport.stream)
437
+ catalogModels.clear()
438
+ for (const model of models) catalogModels.set(model.id, model)
439
+ return createProviderConfig(models, apiBase, measuredStream)
440
+ },
441
+ getDiagnostics: (model) => {
442
+ let route = "not selected"
443
+ if (model?.provider === "commandcode") {
444
+ try {
445
+ route = `${transport.getTransport()}/${resolveModelApi(model.id)}`
446
+ } catch {
447
+ route = "invalid routing configuration"
448
+ }
449
+ }
450
+ let endpointStatus = "model endpoint: no Command Code model selected"
451
+ if (model?.provider === "commandcode") {
452
+ const choice = endpointChoiceForModel(model.id, routing)
453
+ try {
454
+ if (catalogModels.has(model.id)) {
455
+ const source = choice === "auto" ? "catalog" : "user override"
456
+ endpointStatus = `model endpoint: ${resolveModelApi(model.id)} (${choice}; ${source})`
457
+ } else {
458
+ endpointStatus = `model endpoint: ${resolveModelApi(model.id)} (id-rule fallback; model absent from catalog, stored choices ignored)`
459
+ }
460
+ } catch {
461
+ endpointStatus = "model endpoint: invalid choice for the current catalog; use auto"
462
+ }
463
+ }
464
+ return [
465
+ formatDiagnostics({
466
+ pluginVersion,
467
+ host: compatApiProviderRegistrar() ? "pi" : "omp-compatible",
468
+ hostVersion,
469
+ modelId: model?.provider === "commandcode" ? model.id : undefined,
470
+ route,
471
+ request: diagnostics.snapshot(),
472
+ }),
473
+ endpointStatus,
474
+ routingWarning,
475
+ ]
476
+ .filter(Boolean)
477
+ .join("\n")
299
478
  },
300
479
  getTransport: transport.getTransport,
301
- getStreamWarning: () => streamWarning,
480
+ resetTransport: transport.reset,
481
+ getStreamWarning: () => [routingWarning, streamWarning].filter(Boolean).join("\n") || undefined,
302
482
  })
303
483
 
304
484
  pi.on("session_shutdown", () => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-commandcode-provider",
3
- "version": "0.7.11",
3
+ "version": "0.8.0",
4
4
  "description": "pi custom provider for Command Code API (commandcode.ai)",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -29,8 +29,9 @@
29
29
  "LICENSE"
30
30
  ],
31
31
  "scripts": {
32
- "test": "npm run typecheck && node --test tests/test-release.mjs tests/test-pi-child-cleanup.mjs && tsx tests/test-package-manifest.ts && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-abort.ts && tsx tests/test-overflow.ts && tsx tests/test-stream.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-retry.ts && tsx tests/test-transport.ts && node tests/test-pi-isolated.mjs && node tests/test-pi-authenticated.mjs && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs",
32
+ "test": "npm run typecheck && npm run test:diagnostics && npm run test:routing && node --test tests/test-release.mjs tests/test-maintenance-alert.mjs tests/test-pi-child-cleanup.mjs tests/test-entrypoint-typecheck.mjs tests/test-host-protocol-helpers.mjs && tsx tests/test-package-manifest.ts && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts && node tests/test-pi-isolated.mjs && node tests/test-pi-authenticated.mjs && node tests/test-pi-local.mjs && node tests/test-omp-compat.mjs && node tests/test-host-protocols.mjs && node tests/test-endpoint-routing.mjs",
33
33
  "typecheck": "tsc --noEmit",
34
+ "typecheck:entrypoint": "node scripts/typecheck-entrypoint.mjs",
34
35
  "format:check": "prettier --check '**/*.{ts,mjs,json,md}'",
35
36
  "format": "prettier --write '**/*.{ts,mjs,json,md}'",
36
37
  "pi:isolated": "node scripts/pi-isolated.mjs",
@@ -40,29 +41,29 @@
40
41
  "sync:commandcode-catalog": "tsx .github/scripts/check-commandcode-model-metadata.ts command-code@latest --write",
41
42
  "test:quota": "tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts",
42
43
  "test:usage": "tsx tests/test-usage.ts",
43
- "test:unit": "tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-abort.ts && tsx tests/test-overflow.ts && tsx tests/test-stream.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-retry.ts && tsx tests/test-transport.ts",
44
+ "test:unit": "npm run test:diagnostics && npm run test:routing && tsx tests/test-api-key.ts && tsx tests/test-pure-functions.ts && tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts && tsx tests/test-runtime.ts && tsx tests/test-pricing.ts && tsx tests/test-pricing-check.ts && tsx tests/test-cost.ts && tsx tests/test-oauth.ts && tsx tests/test-overflow.ts && tsx tests/test-quota.ts && tsx tests/test-quota-command.ts && tsx tests/test-usage.ts && tsx tests/test-transport.ts",
44
45
  "test:api-key": "tsx tests/test-api-key.ts",
45
46
  "test:models": "tsx tests/test-models.ts && tsx tests/test-model-metadata-check.ts",
47
+ "test:diagnostics": "tsx tests/test-diagnostics.ts",
48
+ "test:routing": "tsx tests/test-routing.ts",
49
+ "test:routing-hosts": "node tests/test-endpoint-routing.mjs",
46
50
  "test:runtime": "tsx tests/test-runtime.ts",
47
51
  "test:pricing": "tsx tests/test-pricing.ts",
48
52
  "test:pricing-check": "tsx tests/test-pricing-check.ts",
49
53
  "test:oauth": "tsx tests/test-oauth.ts",
50
- "test:abort": "tsx tests/test-abort.ts",
51
54
  "test:overflow": "tsx tests/test-overflow.ts",
52
- "test:stream": "tsx tests/test-stream.ts",
53
- "test:retry": "tsx tests/test-retry.ts",
54
55
  "test:transport": "tsx tests/test-transport.ts",
55
56
  "test:pi-isolated": "node tests/test-pi-isolated.mjs",
56
57
  "test:pi-authenticated": "node tests/test-pi-authenticated.mjs",
57
58
  "test:pi-local": "node tests/test-pi-local.mjs",
59
+ "test:host-protocols": "node --test tests/test-host-protocol-helpers.mjs && node tests/test-host-protocols.mjs",
58
60
  "test:smoke": "node tests/test-smoke.mjs",
59
61
  "test:release": "node --test tests/test-release.mjs",
60
62
  "test:release-package": "node tests/test-release-package.mjs",
61
63
  "test:e2e:live": "node tests/test-live-e2e.mjs",
62
- "test:e2e:live:go": "node scripts/live-e2e-profile.mjs go",
63
64
  "test:e2e:live:goat": "node scripts/live-e2e-profile.mjs goat",
64
65
  "test:e2e:live:provider": "node scripts/live-e2e-profile.mjs provider",
65
- "test:e2e:live:all": "node scripts/live-e2e-profile.mjs go goat",
66
+ "test:e2e:live:all": "node scripts/live-e2e-profile.mjs goat provider",
66
67
  "test:cost": "tsx tests/test-cost.ts"
67
68
  },
68
69
  "pi": {
@@ -11,19 +11,16 @@ const profiles = process.argv.slice(2)
11
11
 
12
12
  if (
13
13
  profiles.length === 0 ||
14
- profiles.some((profile) => profile !== "go" && profile !== "goat" && profile !== "provider")
14
+ profiles.some((profile) => profile !== "goat" && profile !== "provider")
15
15
  ) {
16
- console.error("Usage: node scripts/live-e2e-profile.mjs <go|goat|provider> [go|goat|provider]")
16
+ console.error(
17
+ "Usage: node scripts/live-e2e-profile.mjs <goat|provider> [goat|provider] (Go has no Provider API access)",
18
+ )
17
19
  process.exit(2)
18
20
  }
19
21
 
20
22
  async function credentialFor(profile) {
21
- const prefix =
22
- profile === "go"
23
- ? "COMMANDCODE_E2E_GO"
24
- : profile === "goat"
25
- ? "COMMANDCODE_E2E_GOAT"
26
- : "COMMANDCODE_E2E_PROVIDER"
23
+ const prefix = profile === "goat" ? "COMMANDCODE_E2E_GOAT" : "COMMANDCODE_E2E_PROVIDER"
27
24
  const direct = process.env[`${prefix}_API_KEY`]?.trim()
28
25
  const file = process.env[`${prefix}_API_KEY_FILE`]
29
26
 
@@ -40,11 +37,7 @@ async function credentialFor(profile) {
40
37
 
41
38
  function runProfile(profile, apiKey) {
42
39
  const modelVariable =
43
- profile === "go"
44
- ? "COMMANDCODE_E2E_GO_MODEL"
45
- : profile === "goat"
46
- ? "COMMANDCODE_E2E_GOAT_MODEL"
47
- : "COMMANDCODE_E2E_PROVIDER_MODEL"
40
+ profile === "goat" ? "COMMANDCODE_E2E_GOAT_MODEL" : "COMMANDCODE_E2E_PROVIDER_MODEL"
48
41
  const model =
49
42
  process.env[modelVariable] ??
50
43
  (profile === "goat" ? "xai/grok-4.6" : "deepseek/deepseek-v4-flash")
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ /** Check the entrypoint against an installed Pi host, without installing private peers. */
3
+ import { readFileSync } from "node:fs"
4
+ import { dirname, resolve } from "node:path"
5
+ import { fileURLToPath } from "node:url"
6
+ import ts from "typescript"
7
+
8
+ const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..")
9
+
10
+ function installedHostEntry(hostDir) {
11
+ try {
12
+ const manifest = JSON.parse(readFileSync(resolve(hostDir, "package.json"), "utf8"))
13
+ if (
14
+ manifest?.name !== "@earendil-works/pi-coding-agent" ||
15
+ typeof manifest.types !== "string" ||
16
+ !manifest.types.endsWith(".d.ts")
17
+ )
18
+ throw new Error("Expected an installed Pi package with a declaration entrypoint")
19
+ return resolve(hostDir, manifest.types)
20
+ } catch (error) {
21
+ throw new Error(`Cannot read installed Pi declarations: ${error.message}`)
22
+ }
23
+ }
24
+
25
+ export function entrypointProgram(hostDir, root = repoRoot) {
26
+ const configPath = resolve(root, "tsconfig.entrypoint.json")
27
+ const config = ts.readConfigFile(configPath, ts.sys.readFile)
28
+ if (config.error) return { diagnostics: [config.error] }
29
+ const parsed = ts.parseJsonConfigFileContent(config.config, ts.sys, root)
30
+ if (parsed.errors.length) return { diagnostics: parsed.errors }
31
+
32
+ // A path is required when Pi is installed globally (as in CI). Otherwise use
33
+ // locally resolvable optional peers. Never substitute ambient host stubs.
34
+ const hostEntry = hostDir
35
+ ? installedHostEntry(hostDir)
36
+ : ts.resolveModuleName(
37
+ "@earendil-works/pi-coding-agent",
38
+ resolve(root, "index.ts"),
39
+ parsed.options,
40
+ ts.sys,
41
+ ).resolvedModule?.resolvedFileName
42
+ if (!hostEntry || !ts.sys.fileExists(hostEntry)) {
43
+ throw new Error(
44
+ "Pi declarations not found. Pass its installed package directory: npm run typecheck:entrypoint -- /path/to/@earendil-works/pi-coding-agent",
45
+ )
46
+ }
47
+ const resolveAi = (specifier) => {
48
+ const entry = ts.resolveModuleName(specifier, hostEntry, parsed.options, ts.sys).resolvedModule
49
+ ?.resolvedFileName
50
+ if (!entry || !/\.d\.[cm]?ts$/.test(entry)) {
51
+ throw new Error(`Installed Pi does not expose declarations for ${specifier}`)
52
+ }
53
+ return entry
54
+ }
55
+ const options = {
56
+ ...parsed.options,
57
+ paths: {
58
+ "@earendil-works/pi-coding-agent": [hostEntry],
59
+ "@earendil-works/pi-ai": [resolveAi("@earendil-works/pi-ai")],
60
+ "@earendil-works/pi-ai/compat": [resolveAi("@earendil-works/pi-ai/compat")],
61
+ },
62
+ }
63
+ const program = ts.createProgram(parsed.fileNames, options)
64
+ return { program, diagnostics: ts.getPreEmitDiagnostics(program) }
65
+ }
66
+
67
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
68
+ try {
69
+ if (process.argv.length > 3)
70
+ throw new Error("Expected at most one installed Pi package directory")
71
+ const { diagnostics } = entrypointProgram(process.argv[2])
72
+ if (diagnostics.length) {
73
+ console.error(
74
+ ts.formatDiagnosticsWithColorAndContext(diagnostics, {
75
+ getCanonicalFileName: (path) => path,
76
+ getCurrentDirectory: () => repoRoot,
77
+ getNewLine: () => "\n",
78
+ }),
79
+ )
80
+ process.exitCode = 1
81
+ } else {
82
+ console.log("[typecheck:entrypoint] PASS — index.ts and host-boundary contracts")
83
+ }
84
+ } catch (error) {
85
+ console.error(`[typecheck:entrypoint] FAIL — ${error.message}`)
86
+ process.exitCode = 1
87
+ }
88
+ }