@herbertgao/pi-extensions 2026.10.19 → 2026.11.0

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 (261) hide show
  1. package/README.md +19 -4
  2. package/THIRD_PARTY_NOTICES.md +53 -2
  3. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  4. package/node_modules/@herbertgao/pi-subagents/README.md +142 -45
  5. package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +17 -7
  6. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  7. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +111 -59
  8. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +135 -117
  9. package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +41 -14
  10. package/node_modules/@herbertgao/pi-subagents/src/index.ts +110 -19
  11. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +8 -0
  12. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +31 -0
  13. package/node_modules/@tintinweb/pi-tasks/CHANGELOG.md +270 -0
  14. package/node_modules/@tintinweb/pi-tasks/CONTRIBUTING.md +67 -0
  15. package/node_modules/@tintinweb/pi-tasks/CUSTOMIZING.md +289 -0
  16. package/node_modules/@tintinweb/pi-tasks/LICENSE +21 -0
  17. package/node_modules/@tintinweb/pi-tasks/README.md +417 -0
  18. package/node_modules/@tintinweb/pi-tasks/SECURITY.md +107 -0
  19. package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.d.ts +64 -0
  20. package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.js +129 -0
  21. package/node_modules/@tintinweb/pi-tasks/dist/index.d.ts +17 -0
  22. package/node_modules/@tintinweb/pi-tasks/dist/index.js +1338 -0
  23. package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.d.ts +29 -0
  24. package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.js +121 -0
  25. package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.d.ts +39 -0
  26. package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.js +61 -0
  27. package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.d.ts +48 -0
  28. package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.js +68 -0
  29. package/node_modules/@tintinweb/pi-tasks/dist/task-paths.d.ts +44 -0
  30. package/node_modules/@tintinweb/pi-tasks/dist/task-paths.js +60 -0
  31. package/node_modules/@tintinweb/pi-tasks/dist/task-sort.d.ts +23 -0
  32. package/node_modules/@tintinweb/pi-tasks/dist/task-sort.js +69 -0
  33. package/node_modules/@tintinweb/pi-tasks/dist/task-store.d.ts +61 -0
  34. package/node_modules/@tintinweb/pi-tasks/dist/task-store.js +397 -0
  35. package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.d.ts +16 -0
  36. package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.js +51 -0
  37. package/node_modules/@tintinweb/pi-tasks/dist/types.d.ts +36 -0
  38. package/node_modules/@tintinweb/pi-tasks/dist/types.js +4 -0
  39. package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.d.ts +15 -0
  40. package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.js +140 -0
  41. package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.d.ts +69 -0
  42. package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.js +278 -0
  43. package/node_modules/@tintinweb/pi-tasks/package.json +57 -0
  44. package/node_modules/@tintinweb/pi-tasks/src/auto-clear.ts +134 -0
  45. package/node_modules/@tintinweb/pi-tasks/src/index.ts +1417 -0
  46. package/node_modules/@tintinweb/pi-tasks/src/process-tracker.ts +140 -0
  47. package/node_modules/@tintinweb/pi-tasks/src/reminder-cadence.ts +90 -0
  48. package/node_modules/@tintinweb/pi-tasks/src/task-glyphs.ts +110 -0
  49. package/node_modules/@tintinweb/pi-tasks/src/task-paths.ts +65 -0
  50. package/node_modules/@tintinweb/pi-tasks/src/task-sort.ts +90 -0
  51. package/node_modules/@tintinweb/pi-tasks/src/task-store.ts +402 -0
  52. package/node_modules/@tintinweb/pi-tasks/src/tasks-config.ts +77 -0
  53. package/node_modules/@tintinweb/pi-tasks/src/types.ts +40 -0
  54. package/node_modules/@tintinweb/pi-tasks/src/ui/settings-menu.ts +174 -0
  55. package/node_modules/@tintinweb/pi-tasks/src/ui/task-widget.ts +325 -0
  56. package/node_modules/pi-commandcode-provider/CHANGELOG.md +330 -0
  57. package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +192 -0
  58. package/node_modules/pi-commandcode-provider/LICENSE +21 -0
  59. package/node_modules/pi-commandcode-provider/README.md +243 -0
  60. package/node_modules/pi-commandcode-provider/RELEASE.md +194 -0
  61. package/node_modules/pi-commandcode-provider/index.ts +309 -0
  62. package/node_modules/pi-commandcode-provider/package.json +91 -0
  63. package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +87 -0
  64. package/node_modules/pi-commandcode-provider/scripts/pi-authenticated.mjs +50 -0
  65. package/node_modules/pi-commandcode-provider/scripts/pi-isolated.mjs +79 -0
  66. package/node_modules/pi-commandcode-provider/src/api-key.ts +69 -0
  67. package/node_modules/pi-commandcode-provider/src/auth-server.ts +229 -0
  68. package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +28 -0
  69. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +260 -0
  70. package/node_modules/pi-commandcode-provider/src/converters.ts +477 -0
  71. package/node_modules/pi-commandcode-provider/src/core.ts +836 -0
  72. package/node_modules/pi-commandcode-provider/src/cost.ts +76 -0
  73. package/node_modules/pi-commandcode-provider/src/json-schema.ts +417 -0
  74. package/node_modules/pi-commandcode-provider/src/models.ts +515 -0
  75. package/node_modules/pi-commandcode-provider/src/oauth.ts +229 -0
  76. package/node_modules/pi-commandcode-provider/src/overflow.ts +120 -0
  77. package/node_modules/pi-commandcode-provider/src/pricing.ts +370 -0
  78. package/node_modules/pi-commandcode-provider/src/quota-command.ts +66 -0
  79. package/node_modules/pi-commandcode-provider/src/quota-format.ts +143 -0
  80. package/node_modules/pi-commandcode-provider/src/quota-types.ts +47 -0
  81. package/node_modules/pi-commandcode-provider/src/quota.ts +357 -0
  82. package/node_modules/pi-commandcode-provider/src/responses-stream.ts +249 -0
  83. package/node_modules/pi-commandcode-provider/src/runtime.ts +330 -0
  84. package/node_modules/pi-commandcode-provider/src/transcript.ts +56 -0
  85. package/node_modules/pi-commandcode-provider/src/transport.ts +147 -0
  86. package/node_modules/pi-commandcode-provider/src/types.ts +212 -0
  87. package/node_modules/pi-commandcode-provider/src/usage.ts +261 -0
  88. package/node_modules/pi-lens/CHANGELOG.md +149 -0
  89. package/node_modules/pi-lens/README.md +12 -2
  90. package/node_modules/pi-lens/config/markdownlint/run-no-fix.mjs +36 -0
  91. package/node_modules/pi-lens/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
  92. package/node_modules/pi-lens/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
  93. package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +31 -0
  94. package/node_modules/pi-lens/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
  95. package/node_modules/pi-lens/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
  96. package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +27 -0
  97. package/node_modules/pi-lens/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
  98. package/node_modules/pi-lens/dist/chunk-447YZL4S.js +25 -0
  99. package/node_modules/pi-lens/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
  100. package/node_modules/pi-lens/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  101. package/node_modules/pi-lens/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
  102. package/node_modules/pi-lens/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
  103. package/node_modules/pi-lens/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
  104. package/node_modules/pi-lens/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
  105. package/node_modules/pi-lens/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  106. package/node_modules/pi-lens/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
  107. package/node_modules/pi-lens/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
  108. package/node_modules/pi-lens/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
  109. package/node_modules/pi-lens/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
  110. package/node_modules/pi-lens/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
  111. package/node_modules/pi-lens/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
  112. package/node_modules/pi-lens/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
  113. package/node_modules/pi-lens/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
  114. package/node_modules/pi-lens/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  115. package/node_modules/pi-lens/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
  116. package/node_modules/pi-lens/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
  117. package/node_modules/pi-lens/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
  118. package/node_modules/pi-lens/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
  119. package/node_modules/pi-lens/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
  120. package/node_modules/pi-lens/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
  121. package/node_modules/pi-lens/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
  122. package/node_modules/pi-lens/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
  123. package/node_modules/pi-lens/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
  124. package/node_modules/pi-lens/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
  125. package/node_modules/pi-lens/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  126. package/node_modules/pi-lens/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
  127. package/node_modules/pi-lens/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
  128. package/node_modules/pi-lens/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
  129. package/node_modules/pi-lens/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
  130. package/node_modules/pi-lens/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
  131. package/node_modules/pi-lens/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
  132. package/node_modules/pi-lens/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  133. package/node_modules/pi-lens/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
  134. package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +27 -0
  135. package/node_modules/pi-lens/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
  136. package/node_modules/pi-lens/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  137. package/node_modules/pi-lens/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
  138. package/node_modules/pi-lens/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  139. package/node_modules/pi-lens/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
  140. package/node_modules/pi-lens/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
  141. package/node_modules/pi-lens/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
  142. package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +58 -0
  143. package/node_modules/pi-lens/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
  144. package/node_modules/pi-lens/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
  145. package/node_modules/pi-lens/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
  146. package/node_modules/pi-lens/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
  147. package/node_modules/pi-lens/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
  148. package/node_modules/pi-lens/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
  149. package/node_modules/pi-lens/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
  150. package/node_modules/pi-lens/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
  151. package/node_modules/pi-lens/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
  152. package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +22 -0
  153. package/node_modules/pi-lens/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
  154. package/node_modules/pi-lens/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
  155. package/node_modules/pi-lens/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  156. package/node_modules/pi-lens/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
  157. package/node_modules/pi-lens/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
  158. package/node_modules/pi-lens/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
  159. package/node_modules/pi-lens/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
  160. package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +89 -0
  161. package/node_modules/pi-lens/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
  162. package/node_modules/pi-lens/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
  163. package/node_modules/pi-lens/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
  164. package/node_modules/pi-lens/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
  165. package/node_modules/pi-lens/dist/chunk-PKLB2XJL.js +8 -0
  166. package/node_modules/pi-lens/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
  167. package/node_modules/pi-lens/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  168. package/node_modules/pi-lens/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
  169. package/node_modules/pi-lens/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
  170. package/node_modules/pi-lens/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  171. package/node_modules/pi-lens/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
  172. package/node_modules/pi-lens/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
  173. package/node_modules/pi-lens/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
  174. package/node_modules/pi-lens/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
  175. package/node_modules/pi-lens/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  176. package/node_modules/pi-lens/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
  177. package/node_modules/pi-lens/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
  178. package/node_modules/pi-lens/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  179. package/node_modules/pi-lens/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
  180. package/node_modules/pi-lens/dist/chunk-UYXV5NIS.js +20 -0
  181. package/node_modules/pi-lens/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  182. package/node_modules/pi-lens/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
  183. package/node_modules/pi-lens/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
  184. package/node_modules/pi-lens/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  185. package/node_modules/pi-lens/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
  186. package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +27 -0
  187. package/node_modules/pi-lens/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  188. package/node_modules/pi-lens/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
  189. package/node_modules/pi-lens/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  190. package/node_modules/pi-lens/dist/chunk-WXUDRAG6.js +24 -0
  191. package/node_modules/pi-lens/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
  192. package/node_modules/pi-lens/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
  193. package/node_modules/pi-lens/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
  194. package/node_modules/pi-lens/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
  195. package/node_modules/pi-lens/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
  196. package/node_modules/pi-lens/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
  197. package/node_modules/pi-lens/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
  198. package/node_modules/pi-lens/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
  199. package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +74 -0
  200. package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +30 -0
  201. package/node_modules/pi-lens/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
  202. package/node_modules/pi-lens/dist/index.js +6993 -5396
  203. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -10
  204. package/node_modules/pi-lens/dist/mcp/cli.js +44 -42
  205. package/node_modules/pi-lens/dist/mcp/server.js +1627 -504
  206. package/node_modules/pi-lens/dist/mcp/worker.js +62 -61
  207. package/node_modules/pi-lens/dist/probes/installer.js +20 -19
  208. package/node_modules/pi-lens/docs/adr/0003-git-guard-latch-writer.md +11 -6
  209. package/node_modules/pi-lens/docs/agent-tools.md +18 -8
  210. package/node_modules/pi-lens/docs/alignment-families.md +29 -0
  211. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +6 -4
  212. package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +126 -0
  213. package/node_modules/pi-lens/docs/configuration.md +99 -3
  214. package/node_modules/pi-lens/docs/defect-shapes.md +55 -12
  215. package/node_modules/pi-lens/docs/engineering-principles.md +27 -2
  216. package/node_modules/pi-lens/docs/features.md +2 -2
  217. package/node_modules/pi-lens/docs/invariants/git-guard-host.md +7 -3
  218. package/node_modules/pi-lens/docs/invariants/language-config.md +15 -4
  219. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +16 -2
  220. package/node_modules/pi-lens/docs/invariants/paths-os.md +4 -2
  221. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +119 -39
  222. package/node_modules/pi-lens/docs/merge-queue-rollout.md +1 -1
  223. package/node_modules/pi-lens/docs/pi-lens-fixer.md +24 -17
  224. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +20 -11
  225. package/node_modules/pi-lens/docs/pi-lens-monitor.md +9 -0
  226. package/node_modules/pi-lens/docs/pi-lens-orchestration.md +4 -1
  227. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +5 -5
  228. package/node_modules/pi-lens/docs/pi-lens-subagent.md +6 -3
  229. package/node_modules/pi-lens/docs/public-api-stability.md +18 -2
  230. package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +10 -0
  231. package/node_modules/pi-lens/docs/settings.md +10 -6
  232. package/node_modules/pi-lens/docs/word-index.md +17 -5
  233. package/node_modules/pi-lens/package.json +5 -3
  234. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  235. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  236. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  237. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  238. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  239. package/node_modules/pi-lens/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  240. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  241. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  242. package/node_modules/pi-lens/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  243. package/node_modules/pi-provider-qoder/README.md +22 -0
  244. package/node_modules/pi-provider-qoder/dist/index.js +370 -11
  245. package/node_modules/pi-provider-qoder/package.json +5 -2
  246. package/package.json +11 -8
  247. package/node_modules/@tifan/pi-preferred-thinking/README.md +0 -54
  248. package/node_modules/@tifan/pi-preferred-thinking/package.json +0 -43
  249. package/node_modules/@tifan/pi-preferred-thinking/src/index.ts +0 -236
  250. package/node_modules/pi-lens/dist/chunk-46TNM7XZ.js +0 -88
  251. package/node_modules/pi-lens/dist/chunk-72OKUXSD.js +0 -31
  252. package/node_modules/pi-lens/dist/chunk-7GLOLOSH.js +0 -57
  253. package/node_modules/pi-lens/dist/chunk-AKUUMGD5.js +0 -26
  254. package/node_modules/pi-lens/dist/chunk-ASUXV767.js +0 -22
  255. package/node_modules/pi-lens/dist/chunk-CTADOKYM.js +0 -25
  256. package/node_modules/pi-lens/dist/chunk-JJ2RRESP.js +0 -58
  257. package/node_modules/pi-lens/dist/chunk-LSC3VADM.js +0 -23
  258. package/node_modules/pi-lens/dist/chunk-SHLDT3OI.js +0 -27
  259. package/node_modules/pi-lens/dist/chunk-UF7RTZSO.js +0 -27
  260. package/node_modules/pi-lens/dist/chunk-W4WP2ERB.js +0 -30
  261. package/node_modules/pi-lens/dist/chunk-YES5CACN.js +0 -73
@@ -0,0 +1,477 @@
1
+ import { createHash } from "node:crypto"
2
+ import { existsSync, readFileSync } from "node:fs"
3
+ import { homedir } from "node:os"
4
+ import { join } from "node:path"
5
+
6
+ import type { MessageLike, StopReason, ToolLike } from "./types.ts"
7
+ import { geminiSafeJsonSchema, toJsonSchema } from "./json-schema.ts"
8
+
9
+ export { toJsonSchema } from "./json-schema.ts"
10
+
11
+ export function isRecord(value: unknown): value is Record<string, unknown> {
12
+ return typeof value === "object" && value !== null && !Array.isArray(value)
13
+ }
14
+
15
+ export function stringValue(value: unknown): string | undefined {
16
+ return typeof value === "string" ? value : undefined
17
+ }
18
+
19
+ export function recordArray(value: unknown): readonly Record<string, unknown>[] {
20
+ if (!Array.isArray(value)) return []
21
+ return value.filter(isRecord)
22
+ }
23
+
24
+ export function recordOrEmpty(value: unknown): Record<string, unknown> {
25
+ if (isRecord(value)) return value
26
+ if (typeof value === "string") {
27
+ try {
28
+ const parsed: unknown = JSON.parse(value)
29
+ if (isRecord(parsed)) return parsed
30
+ } catch {
31
+ // Some providers stream incomplete JSON argument fragments.
32
+ }
33
+ }
34
+ return {}
35
+ }
36
+
37
+ export function numberValue(value: unknown): number | undefined {
38
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined
39
+ }
40
+
41
+ function defaultAuthPaths(home: string): string[] {
42
+ return [
43
+ join(home, ".commandcode", "auth.json"),
44
+ join(home, ".omp", "agent", "auth.json"),
45
+ join(home, ".pi", "agent", "auth.json"),
46
+ ]
47
+ }
48
+
49
+ function apiKeyFromCredentialRecord(value: unknown): string | undefined {
50
+ if (!isRecord(value)) return undefined
51
+
52
+ const type = stringValue(value.type)
53
+ if (type === "api") return stringValue(value.key)
54
+ if (type === "oauth") return stringValue(value.access)
55
+
56
+ return stringValue(value.key) ?? stringValue(value.access)
57
+ }
58
+
59
+ function imageParts(value: unknown): readonly Record<string, unknown>[] {
60
+ if (isRecord(value)) return value.type === "image" ? [value] : []
61
+ return recordArray(value).filter((part) => part.type === "image")
62
+ }
63
+
64
+ function imageContentError(role: string): Error {
65
+ return new Error(`Selected Command Code model does not support image content in ${role}`)
66
+ }
67
+
68
+ export function assertTextOnlyMessages(messages?: readonly MessageLike[]): void {
69
+ for (const message of messages ?? []) {
70
+ if (message.role !== "toolResult" && imageParts(message.content).length > 0) {
71
+ throw imageContentError(`${message.role} messages`)
72
+ }
73
+ }
74
+ }
75
+
76
+ function imageToCommandCode(part: Record<string, unknown>): Record<string, string> {
77
+ const data = stringValue(part.data)
78
+ const mimeType = stringValue(part.mimeType)
79
+ if (!data || !mimeType)
80
+ throw new Error("Invalid image content: expected base64 data and mimeType")
81
+
82
+ return {
83
+ type: "image",
84
+ image: `data:${mimeType};base64,${data}`,
85
+ mimeType,
86
+ }
87
+ }
88
+
89
+ function userContentToCommandCode(content: unknown, allowImages: boolean): unknown {
90
+ if (typeof content === "string") return content
91
+
92
+ return recordArray(content).flatMap((part) => {
93
+ if (part.type === "text") return [{ type: "text", text: stringValue(part.text) ?? "" }]
94
+ if (part.type === "image") {
95
+ if (!allowImages) throw imageContentError("user messages")
96
+ return [imageToCommandCode(part)]
97
+ }
98
+ return []
99
+ })
100
+ }
101
+
102
+ export function getApiKey(
103
+ options: {
104
+ env?: NodeJS.ProcessEnv
105
+ authPaths?: readonly string[]
106
+ homeDir?: () => string
107
+ } = {},
108
+ ): string | undefined {
109
+ const env = options.env ?? process.env
110
+ if (env.COMMAND_CODE_API_KEY) return env.COMMAND_CODE_API_KEY
111
+ if (env.COMMANDCODE_API_KEY) return env.COMMANDCODE_API_KEY
112
+
113
+ const home = options.homeDir?.() ?? homedir()
114
+ const authPaths = options.authPaths ?? defaultAuthPaths(home)
115
+
116
+ for (const authPath of authPaths) {
117
+ try {
118
+ if (!existsSync(authPath)) continue
119
+ const parsed: unknown = JSON.parse(readFileSync(authPath, "utf-8"))
120
+ if (!isRecord(parsed)) continue
121
+
122
+ // Legacy: direct apiKey or commandcode field.
123
+ const apiKey = stringValue(parsed.apiKey)
124
+ if (apiKey) return apiKey
125
+ const commandcode = stringValue(parsed.commandcode)
126
+ if (commandcode) return commandcode
127
+
128
+ // pi stores OAuth credentials as {"commandcode": {"type":"oauth","access":"..."}}.
129
+ // The official Command Code CLI stores API credentials under "command-code".
130
+ const providerKey =
131
+ apiKeyFromCredentialRecord(parsed.commandcode) ??
132
+ apiKeyFromCredentialRecord(parsed["command-code"])
133
+ if (providerKey) return providerKey
134
+ } catch {
135
+ // Ignore malformed or unreadable auth files.
136
+ }
137
+ }
138
+
139
+ return undefined
140
+ }
141
+
142
+ // Hosts such as OMP may pass a literal env-var name as the "resolved" registry
143
+ // key instead of the actual credential. Treat those as unresolved.
144
+ export const COMMAND_CODE_PLACEHOLDER_KEYS = new Set([
145
+ "$COMMAND_CODE_API_KEY",
146
+ "COMMAND_CODE_API_KEY",
147
+ "$COMMANDCODE_API_KEY",
148
+ "COMMANDCODE_API_KEY",
149
+ ])
150
+
151
+ function usableCommandCodeApiKey(value: string | undefined): string | undefined {
152
+ const trimmed = typeof value === "string" ? value.trim() : undefined
153
+ if (!trimmed) return undefined
154
+ if (COMMAND_CODE_PLACEHOLDER_KEYS.has(trimmed)) return undefined
155
+ return trimmed
156
+ }
157
+
158
+ /**
159
+ * Pick the real API key from a host registry value and/or the env/auth-file
160
+ * fallback, never returning a literal placeholder or an empty/whitespace value.
161
+ * Pure/testable.
162
+ */
163
+ export function pickCommandCodeApiKey(
164
+ registryKey: string | undefined,
165
+ hostKey: string | undefined,
166
+ ): string | undefined {
167
+ return usableCommandCodeApiKey(registryKey) ?? usableCommandCodeApiKey(hostKey)
168
+ }
169
+
170
+ /**
171
+ * Replace a host-supplied placeholder (or missing key) with the configured
172
+ * fallback. Used for both registerProvider and the Provider API stream path.
173
+ */
174
+ export function withResolvedCommandCodeApiKey<T extends { apiKey?: string }>(
175
+ options: T | undefined,
176
+ configuredKey: string | undefined,
177
+ ): T | { apiKey?: string } {
178
+ const apiKey = pickCommandCodeApiKey(options?.apiKey, configuredKey)
179
+ if (options && apiKey === options.apiKey) return options
180
+ return { ...options, apiKey }
181
+ }
182
+
183
+ export function textContent(message: { content?: unknown }): string {
184
+ if (typeof message.content === "string") return message.content
185
+ if (message.content === null || message.content === undefined) return ""
186
+ if (!Array.isArray(message.content)) {
187
+ try {
188
+ return JSON.stringify(message.content) ?? String(message.content)
189
+ } catch {
190
+ return String(message.content)
191
+ }
192
+ }
193
+
194
+ return recordArray(message.content)
195
+ .filter((part) => part.type === "text")
196
+ .map((part) => stringValue(part.text) ?? "")
197
+ .join("\n")
198
+ }
199
+
200
+ export function getEnvironmentInfo(): string {
201
+ return `${process.platform}-${process.arch}, Node.js ${process.version}`
202
+ }
203
+
204
+ export function toolsToJson(tools?: readonly ToolLike[], modelId?: string): unknown[] {
205
+ if (!tools) return []
206
+ const geminiSafe = modelId !== undefined && modelId.startsWith("google/gemini-")
207
+ return tools.map((tool) => {
208
+ const schema = tool.parameters ? toJsonSchema(tool.parameters) : {}
209
+ return {
210
+ type: "function",
211
+ name: tool.name,
212
+ description: tool.description,
213
+ input_schema: geminiSafe ? geminiSafeJsonSchema(schema) : schema,
214
+ }
215
+ })
216
+ }
217
+
218
+ interface ToolCallState {
219
+ callIds: ReadonlySet<string>
220
+ resultIds: ReadonlySet<string>
221
+ }
222
+
223
+ /**
224
+ * Bound for tool-call ids on the `/alpha/generate` wire (#141).
225
+ *
226
+ * Hosts store Responses tool-call ids compounded as `<call_id>|<item_id>`
227
+ * (73 characters for the observed `call_<32hex>|fc_<32hex>` shape). The
228
+ * generate backend rejects `call_id` values longer than 64 characters with
229
+ * `400 input[N].call_id`, so compound ids must be shortened before sending.
230
+ * The mapping is deterministic per request and shared by calls and results,
231
+ * so pairing is preserved and distinct ids never collide.
232
+ */
233
+ const GENERATE_TOOL_CALL_ID_LIMIT = 64
234
+
235
+ function generateToolCallIdHash(value: string): string {
236
+ return createHash("sha256").update(value, "utf8").digest("hex").slice(0, 8)
237
+ }
238
+
239
+ function shortenGenerateToolCallId(value: string): string {
240
+ if (value.length <= GENERATE_TOOL_CALL_ID_LIMIT) return value
241
+ const suffix = generateToolCallIdHash(value)
242
+ const head = value.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+$/, "")
243
+ const keep = GENERATE_TOOL_CALL_ID_LIMIT - suffix.length - 1
244
+ const truncated = head.slice(0, Math.max(0, keep)).replace(/_+$/, "")
245
+ // Fall back to the raw hash when sanitizing leaves nothing usable.
246
+ return truncated ? `${truncated}_${suffix}` : suffix
247
+ }
248
+
249
+ /**
250
+ * Map every tool-call id referenced in this request to its generate-wire
251
+ * form. Short ids are reserved first and pass through unchanged; overlong
252
+ * ids are shortened deterministically, and on collision receive the next
253
+ * free `_<hash>` suffix so every distinct id still maps to a distinct value.
254
+ */
255
+ function generateToolCallIdMap(messages?: readonly MessageLike[]): Map<string, string> {
256
+ const referenced = new Set<string>()
257
+ for (const message of messages ?? []) {
258
+ if (message.role === "assistant") {
259
+ for (const content of recordArray(message.content)) {
260
+ if (content.type === "toolCall") {
261
+ const id = stringValue(content.id)
262
+ if (id) referenced.add(id)
263
+ }
264
+ }
265
+ } else if (message.role === "toolResult" && message.toolCallId) {
266
+ referenced.add(message.toolCallId)
267
+ }
268
+ }
269
+
270
+ const used = new Set<string>()
271
+ const mapped = new Map<string, string>()
272
+ // Reserve existing short ids before any long id can claim their wire value.
273
+ for (const id of referenced) {
274
+ if (id.length <= GENERATE_TOOL_CALL_ID_LIMIT) {
275
+ mapped.set(id, id)
276
+ used.add(id)
277
+ }
278
+ }
279
+ for (const id of referenced) {
280
+ if (mapped.has(id)) continue
281
+ let candidate = shortenGenerateToolCallId(id)
282
+ if (used.has(candidate)) {
283
+ const base = candidate.replace(/_+$/, "")
284
+ let attempt = 0
285
+ do {
286
+ const suffix = generateToolCallIdHash(`${id}#${attempt}`)
287
+ const keep = GENERATE_TOOL_CALL_ID_LIMIT - suffix.length - 1
288
+ const head = base.slice(0, Math.max(0, keep)).replace(/_+$/, "")
289
+ candidate = head ? `${head}_${suffix}` : suffix
290
+ attempt += 1
291
+ } while (used.has(candidate))
292
+ }
293
+ mapped.set(id, candidate)
294
+ used.add(candidate)
295
+ }
296
+ return mapped
297
+ }
298
+
299
+ function toolCallState(messages?: readonly MessageLike[]): ToolCallState {
300
+ const callIds = new Set<string>()
301
+ const resultIds = new Set<string>()
302
+
303
+ for (const message of messages ?? []) {
304
+ if (message.role === "assistant") {
305
+ for (const content of recordArray(message.content)) {
306
+ if (content.type === "toolCall") {
307
+ const id = stringValue(content.id)
308
+ if (id) callIds.add(id)
309
+ }
310
+ }
311
+ } else if (message.role === "toolResult" && message.toolCallId) {
312
+ resultIds.add(message.toolCallId)
313
+ }
314
+ }
315
+
316
+ return { callIds, resultIds }
317
+ }
318
+
319
+ export function messagesToCC(
320
+ messages?: readonly MessageLike[],
321
+ options: { allowImages?: boolean } = {},
322
+ ): unknown[] {
323
+ const allowImages = options.allowImages ?? false
324
+ if (!allowImages) assertTextOnlyMessages(messages)
325
+
326
+ const out: unknown[] = []
327
+ const { callIds, resultIds } = toolCallState(messages)
328
+ const wireIds = generateToolCallIdMap(messages)
329
+ const wireId = (id: string): string => wireIds.get(id) ?? id
330
+
331
+ const rawMessages = messages ?? []
332
+ for (let i = 0; i < rawMessages.length; i++) {
333
+ const message = rawMessages[i]
334
+ if (message.role === "user" || message.role === "developer") {
335
+ // Hosts such as OMP steer the agent by injecting developer-role messages
336
+ // (advisor notes, reminders, nudges) mid-conversation. /alpha/generate
337
+ // only accepts user, assistant, and tool roles, so degrade the role to
338
+ // user instead of dropping the message. Content and chronological
339
+ // position are preserved; system-prompt hoisting would change semantics.
340
+ out.push({
341
+ role: "user",
342
+ content: userContentToCommandCode(message.content, allowImages),
343
+ })
344
+ } else if (message.role === "assistant") {
345
+ const parts: unknown[] = []
346
+ const missingResults: unknown[] = []
347
+ for (const content of recordArray(message.content)) {
348
+ if (content.type === "text") {
349
+ parts.push({ type: "text", text: stringValue(content.text) ?? "" })
350
+ } else if (content.type === "thinking") {
351
+ // The official Command Code CLI replays prior assistant reasoning as
352
+ // `reasoning` parts (toWireMessages), and dropping it leaves the model
353
+ // unable to see its own earlier thinking on follow-up turns.
354
+ parts.push({ type: "reasoning", text: stringValue(content.thinking) ?? "" })
355
+ } else if (content.type === "toolCall") {
356
+ const rawToolCallId = stringValue(content.id) ?? ""
357
+ const toolName = stringValue(content.name) ?? ""
358
+ if (!rawToolCallId) continue
359
+ const toolCallId = wireId(rawToolCallId)
360
+ parts.push({
361
+ type: "tool-call",
362
+ toolCallId,
363
+ toolName,
364
+ input: recordOrEmpty(content.arguments),
365
+ })
366
+ if (!resultIds.has(rawToolCallId)) {
367
+ missingResults.push({
368
+ type: "tool-result",
369
+ toolCallId,
370
+ toolName,
371
+ output: {
372
+ type: "error-text",
373
+ value: "No result — the tool call did not complete (interrupted or lost).",
374
+ },
375
+ })
376
+ }
377
+ }
378
+ }
379
+ if (parts.length > 0) out.push({ role: "assistant", content: parts })
380
+ if (missingResults.length > 0) out.push({ role: "tool", content: missingResults })
381
+ } else if (message.role === "toolResult") {
382
+ const pendingImages: Record<string, string>[] = []
383
+ let j = i
384
+ for (; j < rawMessages.length && rawMessages[j].role === "toolResult"; j++) {
385
+ const toolMsg = rawMessages[j]
386
+ if (!toolMsg.toolCallId || !callIds.has(toolMsg.toolCallId)) continue
387
+ const images = imageParts(toolMsg.content)
388
+ const text = textContent(toolMsg)
389
+ const outputText =
390
+ text ||
391
+ (images.length > 0 && !allowImages
392
+ ? "[Image omitted: model does not support images]"
393
+ : "")
394
+ out.push({
395
+ role: "tool",
396
+ content: [
397
+ {
398
+ type: "tool-result",
399
+ toolCallId: wireId(toolMsg.toolCallId),
400
+ toolName: toolMsg.toolName,
401
+ output: toolMsg.isError
402
+ ? { type: "error-text", value: outputText }
403
+ : { type: "text", value: outputText },
404
+ },
405
+ ],
406
+ })
407
+
408
+ if (images.length > 0 && allowImages) {
409
+ pendingImages.push(...images.map(imageToCommandCode))
410
+ }
411
+ }
412
+ i = j - 1
413
+
414
+ if (pendingImages.length > 0) {
415
+ out.push({
416
+ role: "user",
417
+ content: pendingImages,
418
+ })
419
+ }
420
+ }
421
+ }
422
+ return out
423
+ }
424
+
425
+ export function parseStreamEventLine(line: string): unknown | undefined {
426
+ let trimmed = line.trim()
427
+ if (!trimmed || trimmed.startsWith(":") || trimmed.startsWith("event:")) return undefined
428
+ if (trimmed.startsWith("data:")) trimmed = trimmed.slice(5).trim()
429
+ if (!trimmed || trimmed === "[DONE]") return undefined
430
+
431
+ try {
432
+ const parsed: unknown = JSON.parse(trimmed)
433
+ return parsed
434
+ } catch {
435
+ return undefined
436
+ }
437
+ }
438
+
439
+ export function mapFinishReason(reason: unknown): StopReason {
440
+ if (reason === "tool-calls") return "toolUse"
441
+ if (
442
+ reason === "length" ||
443
+ reason === "max_tokens" ||
444
+ reason === "max-tokens" ||
445
+ reason === "max_output_tokens"
446
+ ) {
447
+ return "length"
448
+ }
449
+ return "stop"
450
+ }
451
+
452
+ function promptPartToText(value: unknown, depth = 0): string {
453
+ if (depth > 10) return ""
454
+ if (typeof value === "string") return value
455
+ if (Array.isArray(value))
456
+ return value
457
+ .map((v) => promptPartToText(v, depth + 1))
458
+ .filter(Boolean)
459
+ .join("\n")
460
+ if (!isRecord(value)) return ""
461
+ const text = stringValue(value.text)
462
+ if (text) return text
463
+ const content = promptPartToText(value.content, depth + 1)
464
+ if (content) return content
465
+ return ""
466
+ }
467
+
468
+ export function systemPromptToText(value: unknown): string {
469
+ if (value === undefined || value === null) return ""
470
+ if (typeof value === "string") return value
471
+ if (Array.isArray(value))
472
+ return value
473
+ .map((v) => promptPartToText(v, 0))
474
+ .filter(Boolean)
475
+ .join("\n\n")
476
+ return promptPartToText(value, 0)
477
+ }