@herbertgao/pi-extensions 2026.10.19 → 2026.11.1

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 (288) hide show
  1. package/CHANGELOG.md +759 -0
  2. package/README.md +21 -6
  3. package/THIRD_PARTY_NOTICES.md +53 -2
  4. package/extensions/clef.mjs +1 -1
  5. package/node_modules/@herbertgao/pi-agency/CHANGELOG.md +19 -0
  6. package/node_modules/@herbertgao/pi-agency/package.json +4 -2
  7. package/node_modules/@herbertgao/pi-agency/src/index.ts +1 -1
  8. package/node_modules/@herbertgao/pi-bark/CHANGELOG.md +52 -0
  9. package/node_modules/@herbertgao/pi-bark/package.json +2 -1
  10. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +207 -0
  11. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +7 -5
  12. package/node_modules/@herbertgao/pi-cc-extensions/README.md +10 -7
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +20 -0
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +61 -6
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +11 -16
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +60 -11
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +29 -11
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +54 -6
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +23 -5
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +52 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/package.json +5 -4
  22. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +13 -0
  23. package/node_modules/@herbertgao/pi-impeccable/package.json +2 -1
  24. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  25. package/node_modules/@herbertgao/pi-subagents/README.md +142 -45
  26. package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +17 -7
  27. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  28. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +111 -59
  29. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +135 -117
  30. package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +41 -14
  31. package/node_modules/@herbertgao/pi-subagents/src/index.ts +110 -19
  32. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +8 -0
  33. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +31 -0
  34. package/node_modules/@herbertgao/sol-pi/CHANGELOG.md +84 -0
  35. package/node_modules/@herbertgao/sol-pi/README.md +3 -3
  36. package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +4 -4
  37. package/node_modules/@herbertgao/sol-pi/agents-install.md +3 -3
  38. package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +1 -1
  39. package/node_modules/@herbertgao/sol-pi/package.json +2 -1
  40. package/node_modules/@tintinweb/pi-tasks/CHANGELOG.md +270 -0
  41. package/node_modules/@tintinweb/pi-tasks/CONTRIBUTING.md +67 -0
  42. package/node_modules/@tintinweb/pi-tasks/CUSTOMIZING.md +289 -0
  43. package/node_modules/@tintinweb/pi-tasks/LICENSE +21 -0
  44. package/node_modules/@tintinweb/pi-tasks/README.md +417 -0
  45. package/node_modules/@tintinweb/pi-tasks/SECURITY.md +107 -0
  46. package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.d.ts +64 -0
  47. package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.js +129 -0
  48. package/node_modules/@tintinweb/pi-tasks/dist/index.d.ts +17 -0
  49. package/node_modules/@tintinweb/pi-tasks/dist/index.js +1338 -0
  50. package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.d.ts +29 -0
  51. package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.js +121 -0
  52. package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.d.ts +39 -0
  53. package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.js +61 -0
  54. package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.d.ts +48 -0
  55. package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.js +68 -0
  56. package/node_modules/@tintinweb/pi-tasks/dist/task-paths.d.ts +44 -0
  57. package/node_modules/@tintinweb/pi-tasks/dist/task-paths.js +60 -0
  58. package/node_modules/@tintinweb/pi-tasks/dist/task-sort.d.ts +23 -0
  59. package/node_modules/@tintinweb/pi-tasks/dist/task-sort.js +69 -0
  60. package/node_modules/@tintinweb/pi-tasks/dist/task-store.d.ts +61 -0
  61. package/node_modules/@tintinweb/pi-tasks/dist/task-store.js +397 -0
  62. package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.d.ts +16 -0
  63. package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.js +51 -0
  64. package/node_modules/@tintinweb/pi-tasks/dist/types.d.ts +36 -0
  65. package/node_modules/@tintinweb/pi-tasks/dist/types.js +4 -0
  66. package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.d.ts +15 -0
  67. package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.js +140 -0
  68. package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.d.ts +69 -0
  69. package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.js +278 -0
  70. package/node_modules/@tintinweb/pi-tasks/package.json +57 -0
  71. package/node_modules/@tintinweb/pi-tasks/src/auto-clear.ts +134 -0
  72. package/node_modules/@tintinweb/pi-tasks/src/index.ts +1417 -0
  73. package/node_modules/@tintinweb/pi-tasks/src/process-tracker.ts +140 -0
  74. package/node_modules/@tintinweb/pi-tasks/src/reminder-cadence.ts +90 -0
  75. package/node_modules/@tintinweb/pi-tasks/src/task-glyphs.ts +110 -0
  76. package/node_modules/@tintinweb/pi-tasks/src/task-paths.ts +65 -0
  77. package/node_modules/@tintinweb/pi-tasks/src/task-sort.ts +90 -0
  78. package/node_modules/@tintinweb/pi-tasks/src/task-store.ts +402 -0
  79. package/node_modules/@tintinweb/pi-tasks/src/tasks-config.ts +77 -0
  80. package/node_modules/@tintinweb/pi-tasks/src/types.ts +40 -0
  81. package/node_modules/@tintinweb/pi-tasks/src/ui/settings-menu.ts +174 -0
  82. package/node_modules/@tintinweb/pi-tasks/src/ui/task-widget.ts +325 -0
  83. package/node_modules/pi-commandcode-provider/CHANGELOG.md +330 -0
  84. package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +192 -0
  85. package/node_modules/pi-commandcode-provider/LICENSE +21 -0
  86. package/node_modules/pi-commandcode-provider/README.md +243 -0
  87. package/node_modules/pi-commandcode-provider/RELEASE.md +194 -0
  88. package/node_modules/pi-commandcode-provider/index.ts +309 -0
  89. package/node_modules/pi-commandcode-provider/package.json +91 -0
  90. package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +87 -0
  91. package/node_modules/pi-commandcode-provider/scripts/pi-authenticated.mjs +50 -0
  92. package/node_modules/pi-commandcode-provider/scripts/pi-isolated.mjs +79 -0
  93. package/node_modules/pi-commandcode-provider/src/api-key.ts +69 -0
  94. package/node_modules/pi-commandcode-provider/src/auth-server.ts +229 -0
  95. package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +28 -0
  96. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +260 -0
  97. package/node_modules/pi-commandcode-provider/src/converters.ts +477 -0
  98. package/node_modules/pi-commandcode-provider/src/core.ts +836 -0
  99. package/node_modules/pi-commandcode-provider/src/cost.ts +76 -0
  100. package/node_modules/pi-commandcode-provider/src/json-schema.ts +417 -0
  101. package/node_modules/pi-commandcode-provider/src/models.ts +515 -0
  102. package/node_modules/pi-commandcode-provider/src/oauth.ts +229 -0
  103. package/node_modules/pi-commandcode-provider/src/overflow.ts +120 -0
  104. package/node_modules/pi-commandcode-provider/src/pricing.ts +370 -0
  105. package/node_modules/pi-commandcode-provider/src/quota-command.ts +66 -0
  106. package/node_modules/pi-commandcode-provider/src/quota-format.ts +143 -0
  107. package/node_modules/pi-commandcode-provider/src/quota-types.ts +47 -0
  108. package/node_modules/pi-commandcode-provider/src/quota.ts +357 -0
  109. package/node_modules/pi-commandcode-provider/src/responses-stream.ts +249 -0
  110. package/node_modules/pi-commandcode-provider/src/runtime.ts +330 -0
  111. package/node_modules/pi-commandcode-provider/src/transcript.ts +56 -0
  112. package/node_modules/pi-commandcode-provider/src/transport.ts +147 -0
  113. package/node_modules/pi-commandcode-provider/src/types.ts +212 -0
  114. package/node_modules/pi-commandcode-provider/src/usage.ts +261 -0
  115. package/node_modules/pi-lens/CHANGELOG.md +149 -0
  116. package/node_modules/pi-lens/README.md +12 -2
  117. package/node_modules/pi-lens/config/markdownlint/run-no-fix.mjs +36 -0
  118. package/node_modules/pi-lens/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
  119. package/node_modules/pi-lens/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
  120. package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +31 -0
  121. package/node_modules/pi-lens/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
  122. package/node_modules/pi-lens/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
  123. package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +27 -0
  124. package/node_modules/pi-lens/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
  125. package/node_modules/pi-lens/dist/chunk-447YZL4S.js +25 -0
  126. package/node_modules/pi-lens/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
  127. package/node_modules/pi-lens/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  128. package/node_modules/pi-lens/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
  129. package/node_modules/pi-lens/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
  130. package/node_modules/pi-lens/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
  131. package/node_modules/pi-lens/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
  132. package/node_modules/pi-lens/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  133. package/node_modules/pi-lens/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
  134. package/node_modules/pi-lens/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
  135. package/node_modules/pi-lens/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
  136. package/node_modules/pi-lens/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
  137. package/node_modules/pi-lens/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
  138. package/node_modules/pi-lens/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
  139. package/node_modules/pi-lens/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
  140. package/node_modules/pi-lens/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
  141. package/node_modules/pi-lens/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  142. package/node_modules/pi-lens/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
  143. package/node_modules/pi-lens/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
  144. package/node_modules/pi-lens/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
  145. package/node_modules/pi-lens/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
  146. package/node_modules/pi-lens/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
  147. package/node_modules/pi-lens/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
  148. package/node_modules/pi-lens/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
  149. package/node_modules/pi-lens/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
  150. package/node_modules/pi-lens/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
  151. package/node_modules/pi-lens/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
  152. package/node_modules/pi-lens/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  153. package/node_modules/pi-lens/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
  154. package/node_modules/pi-lens/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
  155. package/node_modules/pi-lens/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
  156. package/node_modules/pi-lens/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
  157. package/node_modules/pi-lens/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
  158. package/node_modules/pi-lens/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
  159. package/node_modules/pi-lens/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  160. package/node_modules/pi-lens/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
  161. package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +27 -0
  162. package/node_modules/pi-lens/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
  163. package/node_modules/pi-lens/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  164. package/node_modules/pi-lens/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
  165. package/node_modules/pi-lens/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  166. package/node_modules/pi-lens/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
  167. package/node_modules/pi-lens/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
  168. package/node_modules/pi-lens/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
  169. package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +58 -0
  170. package/node_modules/pi-lens/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
  171. package/node_modules/pi-lens/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
  172. package/node_modules/pi-lens/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
  173. package/node_modules/pi-lens/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
  174. package/node_modules/pi-lens/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
  175. package/node_modules/pi-lens/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
  176. package/node_modules/pi-lens/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
  177. package/node_modules/pi-lens/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
  178. package/node_modules/pi-lens/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
  179. package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +22 -0
  180. package/node_modules/pi-lens/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
  181. package/node_modules/pi-lens/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
  182. package/node_modules/pi-lens/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  183. package/node_modules/pi-lens/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
  184. package/node_modules/pi-lens/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
  185. package/node_modules/pi-lens/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
  186. package/node_modules/pi-lens/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
  187. package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +89 -0
  188. package/node_modules/pi-lens/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
  189. package/node_modules/pi-lens/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
  190. package/node_modules/pi-lens/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
  191. package/node_modules/pi-lens/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
  192. package/node_modules/pi-lens/dist/chunk-PKLB2XJL.js +8 -0
  193. package/node_modules/pi-lens/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
  194. package/node_modules/pi-lens/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  195. package/node_modules/pi-lens/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
  196. package/node_modules/pi-lens/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
  197. package/node_modules/pi-lens/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  198. package/node_modules/pi-lens/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
  199. package/node_modules/pi-lens/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
  200. package/node_modules/pi-lens/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
  201. package/node_modules/pi-lens/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
  202. package/node_modules/pi-lens/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  203. package/node_modules/pi-lens/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
  204. package/node_modules/pi-lens/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
  205. package/node_modules/pi-lens/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  206. package/node_modules/pi-lens/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
  207. package/node_modules/pi-lens/dist/chunk-UYXV5NIS.js +20 -0
  208. package/node_modules/pi-lens/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  209. package/node_modules/pi-lens/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
  210. package/node_modules/pi-lens/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
  211. package/node_modules/pi-lens/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  212. package/node_modules/pi-lens/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
  213. package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +27 -0
  214. package/node_modules/pi-lens/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  215. package/node_modules/pi-lens/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
  216. package/node_modules/pi-lens/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  217. package/node_modules/pi-lens/dist/chunk-WXUDRAG6.js +24 -0
  218. package/node_modules/pi-lens/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
  219. package/node_modules/pi-lens/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
  220. package/node_modules/pi-lens/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
  221. package/node_modules/pi-lens/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
  222. package/node_modules/pi-lens/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
  223. package/node_modules/pi-lens/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
  224. package/node_modules/pi-lens/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
  225. package/node_modules/pi-lens/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
  226. package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +74 -0
  227. package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +30 -0
  228. package/node_modules/pi-lens/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
  229. package/node_modules/pi-lens/dist/index.js +6993 -5396
  230. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -10
  231. package/node_modules/pi-lens/dist/mcp/cli.js +44 -42
  232. package/node_modules/pi-lens/dist/mcp/server.js +1627 -504
  233. package/node_modules/pi-lens/dist/mcp/worker.js +62 -61
  234. package/node_modules/pi-lens/dist/probes/installer.js +20 -19
  235. package/node_modules/pi-lens/docs/adr/0003-git-guard-latch-writer.md +11 -6
  236. package/node_modules/pi-lens/docs/agent-tools.md +18 -8
  237. package/node_modules/pi-lens/docs/alignment-families.md +29 -0
  238. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +6 -4
  239. package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +126 -0
  240. package/node_modules/pi-lens/docs/configuration.md +99 -3
  241. package/node_modules/pi-lens/docs/defect-shapes.md +55 -12
  242. package/node_modules/pi-lens/docs/engineering-principles.md +27 -2
  243. package/node_modules/pi-lens/docs/features.md +2 -2
  244. package/node_modules/pi-lens/docs/invariants/git-guard-host.md +7 -3
  245. package/node_modules/pi-lens/docs/invariants/language-config.md +15 -4
  246. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +16 -2
  247. package/node_modules/pi-lens/docs/invariants/paths-os.md +4 -2
  248. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +119 -39
  249. package/node_modules/pi-lens/docs/merge-queue-rollout.md +1 -1
  250. package/node_modules/pi-lens/docs/pi-lens-fixer.md +24 -17
  251. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +20 -11
  252. package/node_modules/pi-lens/docs/pi-lens-monitor.md +9 -0
  253. package/node_modules/pi-lens/docs/pi-lens-orchestration.md +4 -1
  254. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +5 -5
  255. package/node_modules/pi-lens/docs/pi-lens-subagent.md +6 -3
  256. package/node_modules/pi-lens/docs/public-api-stability.md +18 -2
  257. package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +10 -0
  258. package/node_modules/pi-lens/docs/settings.md +10 -6
  259. package/node_modules/pi-lens/docs/word-index.md +17 -5
  260. package/node_modules/pi-lens/package.json +5 -3
  261. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  262. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  263. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  264. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  265. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  266. package/node_modules/pi-lens/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  267. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  268. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  269. package/node_modules/pi-lens/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  270. package/node_modules/pi-provider-qoder/README.md +22 -0
  271. package/node_modules/pi-provider-qoder/dist/index.js +375 -12
  272. package/node_modules/pi-provider-qoder/package.json +5 -2
  273. package/package.json +17 -13
  274. package/node_modules/@tifan/pi-preferred-thinking/README.md +0 -54
  275. package/node_modules/@tifan/pi-preferred-thinking/package.json +0 -43
  276. package/node_modules/@tifan/pi-preferred-thinking/src/index.ts +0 -236
  277. package/node_modules/pi-lens/dist/chunk-46TNM7XZ.js +0 -88
  278. package/node_modules/pi-lens/dist/chunk-72OKUXSD.js +0 -31
  279. package/node_modules/pi-lens/dist/chunk-7GLOLOSH.js +0 -57
  280. package/node_modules/pi-lens/dist/chunk-AKUUMGD5.js +0 -26
  281. package/node_modules/pi-lens/dist/chunk-ASUXV767.js +0 -22
  282. package/node_modules/pi-lens/dist/chunk-CTADOKYM.js +0 -25
  283. package/node_modules/pi-lens/dist/chunk-JJ2RRESP.js +0 -58
  284. package/node_modules/pi-lens/dist/chunk-LSC3VADM.js +0 -23
  285. package/node_modules/pi-lens/dist/chunk-SHLDT3OI.js +0 -27
  286. package/node_modules/pi-lens/dist/chunk-UF7RTZSO.js +0 -27
  287. package/node_modules/pi-lens/dist/chunk-W4WP2ERB.js +0 -30
  288. package/node_modules/pi-lens/dist/chunk-YES5CACN.js +0 -73
@@ -0,0 +1,330 @@
1
+ import type { CommandCodeModel, LoadCommandCodeModelsResult } from "./models.ts"
2
+
3
+ export interface CommandCodeUi {
4
+ notify(message: string, type?: "info" | "warning" | "error"): void
5
+ }
6
+
7
+ export interface CommandCodeCommandContext {
8
+ ui: CommandCodeUi
9
+ waitForIdle?: () => Promise<void>
10
+ }
11
+
12
+ export interface CommandCodeRuntimeApi<
13
+ TProviderConfig,
14
+ TContext extends CommandCodeCommandContext,
15
+ > {
16
+ registerProvider(name: string, config: TProviderConfig): void
17
+ registerCommand(
18
+ name: string,
19
+ options: {
20
+ description: string
21
+ handler: (args: string, ctx: TContext) => Promise<void>
22
+ },
23
+ ): void
24
+ }
25
+
26
+ export interface CommandCodeRuntimeOptions<TProviderConfig> {
27
+ endpoint: string
28
+ cachePath: string
29
+ loadModels: (signal: AbortSignal) => Promise<LoadCommandCodeModelsResult>
30
+ /** Cached catalog only; resolves to an empty list when no valid cache exists. */
31
+ loadCachedModels: () => Promise<readonly CommandCodeModel[]>
32
+ createProviderConfig: (models: readonly CommandCodeModel[]) => TProviderConfig
33
+ getTransport?: () => "unknown" | "provider" | "generate"
34
+ getStreamWarning?: () => string | undefined
35
+ now?: () => number
36
+ logWarning?: (message: string) => void
37
+ }
38
+
39
+ export interface CommandCodeRuntimeStatus {
40
+ transport: "unknown" | "provider" | "generate"
41
+ source: LoadCommandCodeModelsResult["source"]
42
+ modelCount: number
43
+ lastSuccess?: number
44
+ lastAttempt?: number
45
+ cachePath: string
46
+ endpoint: string
47
+ warning?: string
48
+ streamWarning?: string
49
+ refreshing: boolean
50
+ }
51
+
52
+ export interface CommandCodeRefreshResult {
53
+ refreshed: boolean
54
+ source: CommandCodeRuntimeStatus["source"]
55
+ modelCount: number
56
+ warning?: string
57
+ }
58
+
59
+ const REDACTED = "[redacted]"
60
+
61
+ function errorMessage(error: unknown): string {
62
+ return error instanceof Error ? error.message : String(error)
63
+ }
64
+
65
+ function redactUrl(value: string): string {
66
+ try {
67
+ const url = new URL(value)
68
+ return `${url.protocol}//${url.host}${url.pathname}`
69
+ } catch {
70
+ return REDACTED
71
+ }
72
+ }
73
+
74
+ export function redactDiagnosticText(value: string): string {
75
+ 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
+ })
83
+ }
84
+
85
+ export function redactEndpoint(value: string): string {
86
+ return redactUrl(value)
87
+ }
88
+
89
+ function formatTimestamp(timestamp: number | undefined): string {
90
+ return timestamp === undefined ? "never" : new Date(timestamp).toISOString()
91
+ }
92
+
93
+ export function formatCommandCodeStatus(status: CommandCodeRuntimeStatus): string {
94
+ const lines = [
95
+ `transport: ${status.transport}`,
96
+ `source: ${status.source}`,
97
+ `model count: ${status.modelCount}`,
98
+ `last success: ${formatTimestamp(status.lastSuccess)}`,
99
+ `last attempt: ${formatTimestamp(status.lastAttempt)}`,
100
+ `cache path: ${status.cachePath}`,
101
+ `endpoint: ${redactEndpoint(status.endpoint)}`,
102
+ `refresh: ${status.refreshing ? "in progress" : "idle"}`,
103
+ ]
104
+
105
+ lines.push(`warning: ${status.warning ? redactDiagnosticText(status.warning) : "none"}`)
106
+ if (status.streamWarning) {
107
+ lines.push(`stream warning: ${redactDiagnosticText(status.streamWarning)}`)
108
+ }
109
+ return lines.join("\n")
110
+ }
111
+
112
+ export class CommandCodeRuntime<TProviderConfig, TContext extends CommandCodeCommandContext> {
113
+ private readonly now: () => number
114
+ private readonly logWarning: (message: string) => void
115
+ private status: CommandCodeRuntimeStatus
116
+ private providerRegistered = false
117
+ private refreshPromise: Promise<CommandCodeRefreshResult> | undefined
118
+ private readonly shutdown = new AbortController()
119
+
120
+ constructor(
121
+ private readonly pi: CommandCodeRuntimeApi<TProviderConfig, TContext>,
122
+ private readonly options: CommandCodeRuntimeOptions<TProviderConfig>,
123
+ ) {
124
+ this.now = options.now ?? Date.now
125
+ // Direct console output corrupts the host TUI; warnings remain in /commandcode-status.
126
+ this.logWarning = options.logWarning ?? (() => {})
127
+ const initialStatus: CommandCodeRuntimeStatus = {
128
+ transport: "unknown",
129
+ source: "empty",
130
+ modelCount: 0,
131
+ cachePath: options.cachePath,
132
+ endpoint: options.endpoint,
133
+ refreshing: false,
134
+ }
135
+ this.status = { ...initialStatus }
136
+ }
137
+
138
+ getStatus(): CommandCodeRuntimeStatus {
139
+ return {
140
+ ...this.status,
141
+ transport: this.options.getTransport?.() ?? "unknown",
142
+ streamWarning: this.options.getStreamWarning?.(),
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Registers the cached catalog immediately and refreshes it in the
148
+ * background so host startup does not wait for the network. Without a
149
+ * valid cache the live refresh is awaited so models are available at once.
150
+ */
151
+ async initialize(): Promise<void> {
152
+ this.registerCommands()
153
+
154
+ const cached = await this.options.loadCachedModels()
155
+ if (cached.length === 0) {
156
+ await this.refresh()
157
+ return
158
+ }
159
+
160
+ this.pi.registerProvider("commandcode", this.options.createProviderConfig(cached))
161
+ this.providerRegistered = true
162
+ this.status = {
163
+ ...this.status,
164
+ source: "cache",
165
+ modelCount: cached.length,
166
+ lastSuccess: this.now(),
167
+ }
168
+ void this.refresh()
169
+ }
170
+
171
+ /** Aborts any background refresh so a stopping host does not wait for the network. */
172
+ dispose(): void {
173
+ this.shutdown.abort(new Error("Command Code provider shut down"))
174
+ }
175
+
176
+ refresh(): Promise<CommandCodeRefreshResult> {
177
+ if (this.refreshPromise) return this.refreshPromise
178
+
179
+ const refreshPromise = this.refreshCatalog().finally(() => {
180
+ if (this.refreshPromise === refreshPromise) this.refreshPromise = undefined
181
+ })
182
+ this.refreshPromise = refreshPromise
183
+ return refreshPromise
184
+ }
185
+
186
+ private async refreshCatalog(): Promise<CommandCodeRefreshResult> {
187
+ this.status = {
188
+ ...this.status,
189
+ lastAttempt: this.now(),
190
+ refreshing: true,
191
+ }
192
+
193
+ try {
194
+ const loaded = await this.options.loadModels(this.shutdown.signal)
195
+ const warning = loaded.warning ? redactDiagnosticText(loaded.warning) : undefined
196
+
197
+ const shouldRegister =
198
+ !this.providerRegistered ||
199
+ loaded.source === "live" ||
200
+ (this.status.modelCount === 0 && loaded.models.length > 0)
201
+
202
+ if (shouldRegister) {
203
+ this.pi.registerProvider("commandcode", this.options.createProviderConfig(loaded.models))
204
+ this.providerRegistered = true
205
+
206
+ if (loaded.models.length === 0) {
207
+ const preservedWarning = warning ?? "Model catalog refresh returned no models"
208
+ this.status = {
209
+ ...this.status,
210
+ source: loaded.source,
211
+ modelCount: 0,
212
+ warning: preservedWarning,
213
+ refreshing: false,
214
+ }
215
+ this.warn(preservedWarning)
216
+ return {
217
+ refreshed: false,
218
+ source: loaded.source,
219
+ modelCount: 0,
220
+ warning: preservedWarning,
221
+ }
222
+ }
223
+
224
+ this.status = {
225
+ ...this.status,
226
+ source: loaded.source,
227
+ modelCount: loaded.models.length,
228
+ lastSuccess: this.now(),
229
+ warning,
230
+ refreshing: false,
231
+ }
232
+ if (warning) this.warn(warning)
233
+ return {
234
+ refreshed: true,
235
+ source: loaded.source,
236
+ modelCount: loaded.models.length,
237
+ warning,
238
+ }
239
+ }
240
+
241
+ const preservedWarning = warning ?? "Model catalog refresh returned no models"
242
+ this.status = {
243
+ ...this.status,
244
+ warning: preservedWarning,
245
+ refreshing: false,
246
+ }
247
+ this.warn(preservedWarning)
248
+ return {
249
+ refreshed: false,
250
+ source: this.status.source,
251
+ modelCount: this.status.modelCount,
252
+ warning: preservedWarning,
253
+ }
254
+ } catch (error) {
255
+ if (this.shutdown.signal.aborted) {
256
+ this.status = { ...this.status, refreshing: false }
257
+ return {
258
+ refreshed: false,
259
+ source: this.status.source,
260
+ modelCount: this.status.modelCount,
261
+ }
262
+ }
263
+ const warning = redactDiagnosticText(
264
+ `Could not refresh the Command Code model catalog: ${errorMessage(error)}`,
265
+ )
266
+ this.status = {
267
+ ...this.status,
268
+ warning,
269
+ refreshing: false,
270
+ }
271
+ this.warn(warning)
272
+ return {
273
+ refreshed: false,
274
+ source: this.status.source,
275
+ modelCount: this.status.modelCount,
276
+ warning,
277
+ }
278
+ }
279
+ }
280
+
281
+ private warn(message: string): void {
282
+ try {
283
+ this.logWarning(redactDiagnosticText(message))
284
+ } catch {
285
+ // Diagnostics must never make a catalog refresh fail.
286
+ }
287
+ }
288
+
289
+ private registerCommands(): void {
290
+ this.pi.registerCommand("commandcode-refresh", {
291
+ description: "Refresh the Command Code model catalog",
292
+ handler: async (_args, ctx) => {
293
+ await ctx.waitForIdle?.()
294
+ const result = await this.refresh()
295
+ if (result.refreshed) {
296
+ ctx.ui.notify(
297
+ `Command Code model catalog refreshed (${result.modelCount} models from ${result.source}).`,
298
+ "info",
299
+ )
300
+ } else {
301
+ ctx.ui.notify(
302
+ `Command Code model catalog unchanged (${result.modelCount} models remain available).${result.warning ? ` ${result.warning}` : ""}`,
303
+ "warning",
304
+ )
305
+ }
306
+ },
307
+ })
308
+
309
+ this.pi.registerCommand("commandcode-status", {
310
+ description: "Show redacted Command Code provider diagnostics",
311
+ handler: async (_args, ctx) => {
312
+ const status = this.getStatus()
313
+ ctx.ui.notify(
314
+ formatCommandCodeStatus(status),
315
+ status.warning || status.streamWarning ? "warning" : "info",
316
+ )
317
+ },
318
+ })
319
+ }
320
+ }
321
+
322
+ export function createCommandCodeRuntime<
323
+ TProviderConfig,
324
+ TContext extends CommandCodeCommandContext,
325
+ >(
326
+ pi: CommandCodeRuntimeApi<TProviderConfig, TContext>,
327
+ options: CommandCodeRuntimeOptions<TProviderConfig>,
328
+ ): CommandCodeRuntime<TProviderConfig, TContext> {
329
+ return new CommandCodeRuntime(pi, options)
330
+ }
@@ -0,0 +1,56 @@
1
+ import { isRecord } from "./converters.ts"
2
+ import type { ContextLike, MessageLike, ToolLike } from "./types.ts"
3
+
4
+ /**
5
+ * pi 0.86+ hands providers a TranscriptContext: the system prompt and tool
6
+ * declarations live in `role: "system"` transcript messages instead of the
7
+ * top-level `systemPrompt` and `tools` fields. pi-ai exports readers that
8
+ * replay those messages into the current prompt and tool set.
9
+ */
10
+ export interface TranscriptReaders {
11
+ getCurrentTools: (messages: readonly MessageLike[]) => readonly ToolLike[]
12
+ getCurrentSystemPrompt: (messages: readonly MessageLike[]) => string
13
+ }
14
+
15
+ function isToolLike(value: unknown): value is ToolLike {
16
+ return isRecord(value) && typeof value.name === "string"
17
+ }
18
+
19
+ /**
20
+ * Resolve the readers from a pi-ai module at runtime. Oh My Pi's bundled pi-ai
21
+ * lacks them, and a named import of a missing export fails extension loading.
22
+ */
23
+ export function transcriptReadersFrom(module: object): TranscriptReaders | undefined {
24
+ const getCurrentTools: unknown = Reflect.get(module, "getCurrentTools")
25
+ const getCurrentSystemPrompt: unknown = Reflect.get(module, "getCurrentSystemPrompt")
26
+ if (typeof getCurrentTools !== "function" || typeof getCurrentSystemPrompt !== "function") {
27
+ return undefined
28
+ }
29
+ return {
30
+ getCurrentTools: (messages) => {
31
+ const tools: unknown = getCurrentTools(messages)
32
+ return Array.isArray(tools) ? tools.filter(isToolLike) : []
33
+ },
34
+ getCurrentSystemPrompt: (messages) => {
35
+ const prompt: unknown = getCurrentSystemPrompt(messages)
36
+ return typeof prompt === "string" ? prompt : ""
37
+ },
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Fill the flat `systemPrompt` and `tools` fields that the generate transport
43
+ * sends. Hosts that still pass them (Oh My Pi, pi before 0.86) are unchanged.
44
+ */
45
+ export function withTranscriptPromptAndTools(
46
+ context: ContextLike,
47
+ readers: TranscriptReaders | undefined,
48
+ ): ContextLike {
49
+ if (!readers || context.systemPrompt !== undefined || context.tools !== undefined) return context
50
+ const messages = context.messages ?? []
51
+ return {
52
+ ...context,
53
+ systemPrompt: readers.getCurrentSystemPrompt(messages),
54
+ tools: readers.getCurrentTools(messages),
55
+ }
56
+ }
@@ -0,0 +1,147 @@
1
+ import type {
2
+ AssistantMessageEvent,
3
+ AssistantMessageEventStreamLike,
4
+ ContextLike,
5
+ ModelLike,
6
+ StreamOptions,
7
+ } from "./types.ts"
8
+
9
+ export type CommandCodeTransport = "unknown" | "provider" | "generate"
10
+
11
+ interface TransportDependencies {
12
+ createStream: () => AssistantMessageEventStreamLike
13
+ streamProvider: (
14
+ model: ModelLike,
15
+ context: ContextLike,
16
+ options?: StreamOptions,
17
+ ) => AssistantMessageEventStreamLike
18
+ streamGenerate: (
19
+ model: ModelLike,
20
+ context: ContextLike,
21
+ options?: StreamOptions,
22
+ ) => AssistantMessageEventStreamLike
23
+ }
24
+
25
+ function isRecord(value: unknown): value is Record<string, unknown> {
26
+ return typeof value === "object" && value !== null && !Array.isArray(value)
27
+ }
28
+
29
+ async function isUpgradeRequired(response: Response): Promise<boolean> {
30
+ if (response.status !== 403) return false
31
+
32
+ try {
33
+ const body: unknown = await response.clone().json()
34
+ if (!isRecord(body)) return false
35
+ const error = isRecord(body.error) ? body.error : body
36
+ return error.code === "upgrade_required"
37
+ } catch {
38
+ return false
39
+ }
40
+ }
41
+
42
+ export function createCommandCodeTransportRouter(deps: TransportDependencies) {
43
+ let transport: CommandCodeTransport = "unknown"
44
+ let apiKey: string | undefined
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
+ }
54
+
55
+ return {
56
+ getTransport(): CommandCodeTransport {
57
+ return transport
58
+ },
59
+
60
+ reset(): void {
61
+ transport = "unknown"
62
+ apiKey = undefined
63
+ },
64
+
65
+ stream(
66
+ model: ModelLike,
67
+ context: ContextLike,
68
+ options?: StreamOptions,
69
+ ): AssistantMessageEventStreamLike {
70
+ if (options?.apiKey !== apiKey) {
71
+ apiKey = options?.apiKey
72
+ transport = "unknown"
73
+ }
74
+ const requestApiKey = options?.apiKey
75
+ if (transport === "generate") return deps.streamGenerate(model, context, options)
76
+
77
+ const output = deps.createStream()
78
+ let upgradeRequired = false
79
+ const fetchImpl = options?.fetch ?? fetch
80
+ const providerOptions: StreamOptions = {
81
+ ...options,
82
+ fetch: async (input, init) => {
83
+ const response = await fetchImpl(input, init)
84
+ if (await isUpgradeRequired(response)) upgradeRequired = true
85
+ return response
86
+ },
87
+ onResponse: async (response, responseModel) => {
88
+ if (upgradeRequired) return
89
+ await options?.onResponse?.(response, responseModel)
90
+ },
91
+ }
92
+
93
+ const run = async () => {
94
+ const providerStream = deps.streamProvider(model, context, providerOptions)
95
+
96
+ try {
97
+ for await (const event of providerStream) {
98
+ if (!upgradeRequired) {
99
+ if (apiKey === requestApiKey) transport = "provider"
100
+ output.push(event)
101
+ }
102
+ }
103
+ } catch (error) {
104
+ // Defense in depth for adapters whose iterators reject after HTTP errors;
105
+ // current Pi/OMP adapters emit error events instead. Only an inspected
106
+ // upgrade_required response permits generate fallback.
107
+ if (!upgradeRequired) throw error
108
+ }
109
+
110
+ if (upgradeRequired) {
111
+ if (apiKey === requestApiKey) transport = "generate"
112
+ await pipe(deps.streamGenerate(model, context, options), output)
113
+ }
114
+ output.end()
115
+ }
116
+
117
+ run().catch((error: unknown) => {
118
+ const message = error instanceof Error ? error.message : String(error)
119
+ output.push({
120
+ type: "error",
121
+ reason: "error",
122
+ error: {
123
+ role: "assistant",
124
+ content: [],
125
+ api: model.api,
126
+ provider: model.provider,
127
+ model: model.id,
128
+ usage: {
129
+ input: 0,
130
+ output: 0,
131
+ cacheRead: 0,
132
+ cacheWrite: 0,
133
+ totalTokens: 0,
134
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
135
+ },
136
+ stopReason: "error",
137
+ errorMessage: message,
138
+ timestamp: Date.now(),
139
+ },
140
+ })
141
+ output.end()
142
+ })
143
+
144
+ return output
145
+ },
146
+ }
147
+ }