@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
@@ -1,417 +0,0 @@
1
- function isRecord(value: unknown): value is Record<string, unknown> {
2
- return typeof value === "object" && value !== null && !Array.isArray(value)
3
- }
4
-
5
- function stringValue(value: unknown): string | undefined {
6
- return typeof value === "string" ? value : undefined
7
- }
8
-
9
- function booleanValue(value: unknown): boolean | undefined {
10
- return typeof value === "boolean" ? value : undefined
11
- }
12
-
13
- type JsonSchemaValue = boolean | Record<string, unknown>
14
-
15
- const JSON_SCHEMA_TYPES = new Set([
16
- "array",
17
- "boolean",
18
- "integer",
19
- "null",
20
- "number",
21
- "object",
22
- "string",
23
- ])
24
-
25
- const LEGACY_KINDS = new Set([
26
- "any",
27
- "array",
28
- "boolean",
29
- "enum",
30
- "integer",
31
- "intersect",
32
- "intersection",
33
- "literal",
34
- "never",
35
- "null",
36
- "nullable",
37
- "number",
38
- "object",
39
- "optional",
40
- "string",
41
- "undefined",
42
- "union",
43
- "unknown",
44
- ])
45
-
46
- const LEGACY_FIELDS = new Set([
47
- "element",
48
- "kind",
49
- "inner",
50
- "optional",
51
- "value",
52
- "values",
53
- "variants",
54
- "wrapped",
55
- ])
56
-
57
- const SCHEMA_MAP_FIELDS = new Set([
58
- "$defs",
59
- "definitions",
60
- "dependentSchemas",
61
- "patternProperties",
62
- "properties",
63
- ])
64
-
65
- const SCHEMA_ARRAY_FIELDS = new Set(["allOf", "anyOf", "oneOf", "prefixItems"])
66
-
67
- const SCHEMA_VALUE_FIELDS = new Set([
68
- "additionalItems",
69
- "additionalProperties",
70
- "contains",
71
- "contentSchema",
72
- "else",
73
- "if",
74
- "items",
75
- "not",
76
- "propertyNames",
77
- "then",
78
- "unevaluatedItems",
79
- "unevaluatedProperties",
80
- ])
81
-
82
- const SCHEMA_KEYWORDS = new Set([
83
- "$anchor",
84
- "$comment",
85
- "$defs",
86
- "$dynamicAnchor",
87
- "$dynamicRef",
88
- "$id",
89
- "$ref",
90
- "$schema",
91
- "$vocabulary",
92
- "additionalItems",
93
- "additionalProperties",
94
- "allOf",
95
- "anyOf",
96
- "const",
97
- "contains",
98
- "contentEncoding",
99
- "contentMediaType",
100
- "contentSchema",
101
- "default",
102
- "definitions",
103
- "dependentRequired",
104
- "dependentSchemas",
105
- "description",
106
- "else",
107
- "enum",
108
- "examples",
109
- "exclusiveMaximum",
110
- "exclusiveMinimum",
111
- "format",
112
- "if",
113
- "items",
114
- "maxContains",
115
- "maxItems",
116
- "maxLength",
117
- "maxProperties",
118
- "maximum",
119
- "minContains",
120
- "minItems",
121
- "minLength",
122
- "minProperties",
123
- "minimum",
124
- "multipleOf",
125
- "not",
126
- "oneOf",
127
- "pattern",
128
- "patternProperties",
129
- "prefixItems",
130
- "properties",
131
- "propertyNames",
132
- "readOnly",
133
- "required",
134
- "title",
135
- "type",
136
- "unevaluatedItems",
137
- "unevaluatedProperties",
138
- "uniqueItems",
139
- "writeOnly",
140
- ])
141
-
142
- function stringArray(value: unknown): string[] | undefined {
143
- if (!Array.isArray(value)) return undefined
144
- const values = value.filter((item): item is string => typeof item === "string")
145
- return values.length === value.length ? values : undefined
146
- }
147
-
148
- function validSchemaType(value: unknown): boolean {
149
- if (typeof value === "string") return JSON_SCHEMA_TYPES.has(value)
150
- if (!Array.isArray(value) || value.length === 0) return false
151
- return value.every((item) => typeof item === "string" && JSON_SCHEMA_TYPES.has(item))
152
- }
153
-
154
- function legacyKind(schema: Record<string, unknown>): string | undefined {
155
- const explicitKind = stringValue(schema.kind)?.toLowerCase()
156
- if (explicitKind && LEGACY_KINDS.has(explicitKind)) return explicitKind
157
-
158
- const type = stringValue(schema.type)
159
- const normalized = type?.toLowerCase()
160
- if (!normalized || !LEGACY_KINDS.has(normalized)) return undefined
161
- if (!validSchemaType(type) || Object.keys(schema).some((key) => LEGACY_FIELDS.has(key))) {
162
- return normalized
163
- }
164
- return undefined
165
- }
166
-
167
- function looksLikeJsonSchema(schema: Record<string, unknown>): boolean {
168
- if (Object.keys(schema).length === 0) return true
169
- if (schema.type !== undefined && !validSchemaType(schema.type)) return false
170
- return Object.keys(schema).some((key) => SCHEMA_KEYWORDS.has(key))
171
- }
172
-
173
- function isOptionalSchema(schema: unknown): boolean {
174
- if (!isRecord(schema)) return false
175
- if (booleanValue(schema.optional) === true) return true
176
-
177
- const kind = legacyKind(schema)
178
- if (kind === "optional") return true
179
- if (kind !== "union") return false
180
-
181
- const variants = Array.isArray(schema.variants)
182
- ? schema.variants
183
- : Array.isArray(schema.anyOf)
184
- ? schema.anyOf
185
- : []
186
- return variants.some((variant) => legacyKind(isRecord(variant) ? variant : {}) === "undefined")
187
- }
188
-
189
- function schemaValue(value: unknown, seen: WeakSet<object>): JsonSchemaValue {
190
- if (typeof value === "boolean") return value
191
- if (!isRecord(value)) return {}
192
- return convertSchema(value, seen)
193
- }
194
-
195
- function setSchemaProperty(target: Record<string, unknown>, key: string, value: unknown): void {
196
- Object.defineProperty(target, key, {
197
- configurable: true,
198
- enumerable: true,
199
- value,
200
- writable: true,
201
- })
202
- }
203
-
204
- function schemaMap(value: unknown, seen: WeakSet<object>): Record<string, unknown> {
205
- if (!isRecord(value)) return {}
206
- const out: Record<string, unknown> = {}
207
- for (const [key, item] of Object.entries(value)) {
208
- setSchemaProperty(out, key, schemaValue(item, seen))
209
- }
210
- return out
211
- }
212
-
213
- function schemaArray(value: unknown, seen: WeakSet<object>): unknown[] {
214
- if (!Array.isArray(value)) return []
215
- return value.map((item) => schemaValue(item, seen))
216
- }
217
-
218
- function isSchemaValue(value: unknown): value is JsonSchemaValue {
219
- return typeof value === "boolean" || isRecord(value)
220
- }
221
-
222
- function copySchemaObject(
223
- source: Record<string, unknown>,
224
- seen: WeakSet<object>,
225
- legacy: boolean,
226
- forcedType?: string,
227
- ): JsonSchemaValue {
228
- const out: Record<string, unknown> = {}
229
-
230
- for (const [key, value] of Object.entries(source)) {
231
- if (legacy && LEGACY_FIELDS.has(key)) continue
232
- if (key === "nullable" || (forcedType !== undefined && key === "type")) continue
233
-
234
- if (key === "required") {
235
- const required = stringArray(value)
236
- if (required) out.required = required
237
- } else if (SCHEMA_MAP_FIELDS.has(key)) {
238
- out[key] = schemaMap(value, seen)
239
- } else if (SCHEMA_ARRAY_FIELDS.has(key)) {
240
- out[key] = schemaArray(value, seen)
241
- } else if (SCHEMA_VALUE_FIELDS.has(key)) {
242
- out[key] =
243
- Array.isArray(value) && key === "items"
244
- ? schemaArray(value, seen)
245
- : schemaValue(value, seen)
246
- } else {
247
- out[key] = value
248
- }
249
- }
250
-
251
- if (forcedType !== undefined) out.type = forcedType
252
- if (booleanValue(source.nullable) === true) return makeNullable(out)
253
- return out
254
- }
255
-
256
- function makeNullable(schema: Record<string, unknown>): Record<string, unknown> {
257
- const type = schema.type
258
- if (typeof type === "string") {
259
- if (type === "null") return schema
260
- return { ...schema, type: [type, "null"] }
261
- }
262
- if (Array.isArray(type) && !type.includes("null")) {
263
- return { ...schema, type: [...type, "null"] }
264
- }
265
- if (Array.isArray(schema.anyOf)) {
266
- return { ...schema, anyOf: [...schema.anyOf, { type: "null" }] }
267
- }
268
- return { anyOf: [schema, { type: "null" }] }
269
- }
270
-
271
- function legacyVariants(schema: Record<string, unknown>): unknown[] {
272
- if (Array.isArray(schema.variants)) return schema.variants
273
- if (Array.isArray(schema.anyOf)) return schema.anyOf
274
- return []
275
- }
276
-
277
- function convertLegacySchema(
278
- source: Record<string, unknown>,
279
- kind: string,
280
- seen: WeakSet<object>,
281
- ): JsonSchemaValue {
282
- if (kind === "optional") return schemaValue(source.wrapped ?? source.inner, seen)
283
- if (kind === "nullable") {
284
- const wrapped = schemaValue(source.wrapped ?? source.inner, seen)
285
- return typeof wrapped === "boolean" ? wrapped : makeNullable(wrapped)
286
- }
287
- if (kind === "undefined" || kind === "never" || kind === "any" || kind === "unknown") return {}
288
-
289
- if (kind === "union" || kind === "intersect" || kind === "intersection") {
290
- const variants = legacyVariants(source)
291
- .map((variant) => schemaValue(variant, seen))
292
- .filter(
293
- (variant) =>
294
- isSchemaValue(variant) &&
295
- (typeof variant === "boolean" || Object.keys(variant).length > 0),
296
- )
297
- if (variants.length === 0) return copySchemaObject(source, seen, true)
298
- if (variants.length === 1) return variants[0] ?? {}
299
-
300
- const out = copySchemaObject(source, seen, true)
301
- if (typeof out !== "boolean") out[kind === "union" ? "anyOf" : "allOf"] = variants
302
- return out
303
- }
304
-
305
- if (kind === "object") {
306
- const converted = copySchemaObject(source, seen, true, "object")
307
- if (typeof converted === "boolean") return converted
308
- const out = converted
309
- const sourceProperties = isRecord(source.properties) ? source.properties : undefined
310
- if (!sourceProperties) return out
311
-
312
- const properties: Record<string, unknown> = {}
313
- const optional = stringArray(source.optional) ?? []
314
- for (const [key, value] of Object.entries(sourceProperties)) {
315
- setSchemaProperty(properties, key, schemaValue(value, seen))
316
- }
317
- out.properties = properties
318
-
319
- const explicitRequired = stringArray(source.required)
320
- const required =
321
- explicitRequired ??
322
- Object.entries(sourceProperties)
323
- .filter(([key, value]) => !optional.includes(key) && !isOptionalSchema(value))
324
- .map(([key]) => key)
325
- if (required.length > 0) out.required = required
326
- else delete out.required
327
- return out
328
- }
329
-
330
- if (kind === "array") {
331
- const converted = copySchemaObject(source, seen, true, "array")
332
- if (typeof converted === "boolean") return converted
333
- const out = converted
334
- if (!("items" in source) && "element" in source) out.items = schemaValue(source.element, seen)
335
- return out
336
- }
337
-
338
- if (kind === "enum") {
339
- const converted = copySchemaObject(source, seen, true)
340
- if (typeof converted === "boolean") return converted
341
- const out = converted
342
- if (!("enum" in out) && Array.isArray(source.values)) out.enum = source.values
343
- return out
344
- }
345
-
346
- if (kind === "literal") {
347
- const converted = copySchemaObject(source, seen, true)
348
- if (typeof converted === "boolean") return converted
349
- const out = converted
350
- if (!("const" in out) && "value" in source) out.const = source.value
351
- return out
352
- }
353
-
354
- const scalarType =
355
- kind === "string" ||
356
- kind === "number" ||
357
- kind === "boolean" ||
358
- kind === "integer" ||
359
- kind === "null"
360
- ? kind
361
- : undefined
362
- return scalarType ? copySchemaObject(source, seen, true, scalarType) : {}
363
- }
364
-
365
- function convertSchema(source: Record<string, unknown>, seen: WeakSet<object>): JsonSchemaValue {
366
- if (seen.has(source)) return {}
367
- seen.add(source)
368
- try {
369
- const kind = legacyKind(source)
370
- if (kind) return convertLegacySchema(source, kind, seen)
371
- if (!looksLikeJsonSchema(source)) return {}
372
- return copySchemaObject(source, seen, false)
373
- } finally {
374
- seen.delete(source)
375
- }
376
- }
377
-
378
- export function toJsonSchema(schema: unknown): unknown {
379
- if (typeof schema === "boolean") return schema
380
- if (!isRecord(schema)) return {}
381
- return convertSchema(schema, new WeakSet<object>())
382
- }
383
-
384
- /**
385
- * Normalize nullable type arrays for Gemini's generate transport (#99).
386
- * The gateway can turn these into any_of with sibling fields, which Vertex
387
- * rejects. Use a single type plus nullable, omit null defaults, and leave
388
- * genuine multi-type unions and required fields unchanged.
389
- */
390
- export function geminiSafeJsonSchema(schema: unknown): unknown {
391
- if (Array.isArray(schema)) return schema.map(geminiSafeJsonSchema)
392
- if (!isRecord(schema)) return schema
393
- const out: Record<string, unknown> = {}
394
- for (const [key, value] of Object.entries(schema)) {
395
- if (key === "default" && value === null) continue
396
- // Literal values (const, enum, defaults, examples) are data, not schemas.
397
- const converted =
398
- SCHEMA_MAP_FIELDS.has(key) && isRecord(value)
399
- ? Object.fromEntries(
400
- Object.entries(value).map(([name, child]) => [name, geminiSafeJsonSchema(child)]),
401
- )
402
- : SCHEMA_ARRAY_FIELDS.has(key) || SCHEMA_VALUE_FIELDS.has(key)
403
- ? geminiSafeJsonSchema(value)
404
- : value
405
- setSchemaProperty(out, key, converted)
406
- }
407
- const type = out.type
408
- if (Array.isArray(type)) {
409
- const entries = type.filter((entry): entry is string => typeof entry === "string")
410
- const nonNull = entries.filter((entry) => entry !== "null")
411
- if (entries.length === type.length && entries.includes("null") && nonNull.length === 1) {
412
- out.type = nonNull[0]
413
- out.nullable = true
414
- }
415
- }
416
- return out
417
- }
@@ -1,56 +0,0 @@
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
- }
@@ -1,31 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- calcCyclomaticComplexity,
4
- functionFactProvider
5
- } from "./chunk-6YUNI7B5.js";
6
- import "./chunk-7TNILKGY.js";
7
- import "./chunk-5W3R6LFT.js";
8
- import "./chunk-BHWW6FAX.js";
9
- import "./chunk-Z54ZSOBZ.js";
10
- import "./chunk-HHR7WGCI.js";
11
- import "./chunk-HKIL6DCL.js";
12
- import "./chunk-PPKECBPP.js";
13
- import "./chunk-JYLOYTZD.js";
14
- import "./chunk-JZRP4DGP.js";
15
- import "./chunk-WMDUT4KH.js";
16
- import "./chunk-G5GV2Q7K.js";
17
- import "./chunk-X35S7HSB.js";
18
- import "./chunk-SQC7K3SP.js";
19
- import "./chunk-JE6HKLC7.js";
20
- import "./chunk-2453RRJ2.js";
21
- import "./chunk-WQV6BI4Q.js";
22
- import "./chunk-S26LC76R.js";
23
- import "./chunk-565VRUP4.js";
24
- import "./chunk-VLQ7UKZH.js";
25
- import "./chunk-LJDODBBZ.js";
26
- import "./chunk-GMROJJRN.js";
27
- import "./chunk-NXL4FFQQ.js";
28
- export {
29
- calcCyclomaticComplexity,
30
- functionFactProvider
31
- };
@@ -1,27 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- RustClient,
4
- resetRustAvailability,
5
- rustClient
6
- } from "./chunk-4W52ZKZX.js";
7
- import "./chunk-BUZIQDFS.js";
8
- import "./chunk-JBP7KESM.js";
9
- import "./chunk-JZRP4DGP.js";
10
- import "./chunk-WMDUT4KH.js";
11
- import "./chunk-AWQWXSW4.js";
12
- import "./chunk-X35S7HSB.js";
13
- import "./chunk-SQC7K3SP.js";
14
- import "./chunk-JE6HKLC7.js";
15
- import "./chunk-2453RRJ2.js";
16
- import "./chunk-WQV6BI4Q.js";
17
- import "./chunk-S26LC76R.js";
18
- import "./chunk-565VRUP4.js";
19
- import "./chunk-VLQ7UKZH.js";
20
- import "./chunk-LJDODBBZ.js";
21
- import "./chunk-GMROJJRN.js";
22
- import "./chunk-NXL4FFQQ.js";
23
- export {
24
- RustClient,
25
- resetRustAvailability,
26
- rustClient
27
- };
@@ -1,25 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- getSourceFiles,
4
- getSourceFilesAsync
5
- } from "./chunk-BBET6HD6.js";
6
- import "./chunk-G6JKM4O7.js";
7
- import "./chunk-O2ARHQKF.js";
8
- import "./chunk-WMDUT4KH.js";
9
- import "./chunk-QYF5S6P6.js";
10
- import "./chunk-G5GV2Q7K.js";
11
- import "./chunk-X35S7HSB.js";
12
- import "./chunk-SQC7K3SP.js";
13
- import "./chunk-JE6HKLC7.js";
14
- import "./chunk-2453RRJ2.js";
15
- import "./chunk-WQV6BI4Q.js";
16
- import "./chunk-S26LC76R.js";
17
- import "./chunk-565VRUP4.js";
18
- import "./chunk-VLQ7UKZH.js";
19
- import "./chunk-LJDODBBZ.js";
20
- import "./chunk-GMROJJRN.js";
21
- import "./chunk-NXL4FFQQ.js";
22
- export {
23
- getSourceFiles,
24
- getSourceFilesAsync
25
- };
@@ -1,136 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- createNdjsonLogger,
4
- getGlobalPiLensLogDir,
5
- getMaxLogSizeMB,
6
- getTurnId,
7
- isTestMode
8
- } from "./chunk-VLQ7UKZH.js";
9
- import {
10
- normalizeLoggedPath
11
- } from "./chunk-GMROJJRN.js";
12
-
13
- // dist/clients/latency-logger.js
14
- import * as path from "node:path";
15
- var LATENCY_LOG_DIR = getGlobalPiLensLogDir();
16
- var LATENCY_LOG_FILE = path.join(LATENCY_LOG_DIR, "latency.log");
17
- var writer = createNdjsonLogger({
18
- filePath: LATENCY_LOG_FILE,
19
- maxBytes: getMaxLogSizeMB() * 1024 * 1024
20
- });
21
- var RECENT_PHASE_CAP = 5;
22
- var recentPhases = [];
23
- var LAST_PHASE_EXCLUDED = /* @__PURE__ */ new Set([
24
- "loop_block",
25
- "lsp_typescript_project_identity",
26
- "advisory_provenance_decision",
27
- "authoritative_content_attachment_decision",
28
- "agent_end_deferred_mutation_drain",
29
- "agent_end_deferred_mutation_requeue",
30
- "session_end_bus_rollup",
31
- "cache_usage_summary",
32
- "test_runner_failed_target_state",
33
- "turn_end_test_selection",
34
- "lsp_aux_wait_outcome",
35
- "tool_set_mutation",
36
- "tool_set_decision",
37
- "availability_decision",
38
- "finding_dead_path_drop",
39
- "finding_stale_line_demote",
40
- "finding_path_stat_budget_exhausted",
41
- "lsp_scanner_coverage_gap",
42
- "lsp_notify_resync_deferred",
43
- "lsp_notify_write_late_landed",
44
- "lsp_notify_stall_cpu_busy",
45
- "degradation_ledger",
46
- "path_attribution_verified_rollup",
47
- "concurrent_session_bind_rollup",
48
- "auxiliary_readiness",
49
- "lsp_empty_first_publish_held",
50
- "lsp_diagnostics_fence",
51
- "lsp_rules_refreshed",
52
- "read_guard_conversation_read",
53
- "read_widening_note",
54
- "session_handoff_slot",
55
- "session_handoff_adopt",
56
- "session_store_action",
57
- "session_end_fence_rollup",
58
- "session_handoff_turn_state",
59
- "format_late_resync_chained",
60
- "lsp_created_import_scan_rollup"
61
- ]);
62
- var liveBrackets = /* @__PURE__ */ new Map();
63
- var closedBrackets = [];
64
- function phaseStarted(phase) {
65
- const token = { phase, startedAt: (/* @__PURE__ */ new Date()).toISOString() };
66
- liveBrackets.set(token, true);
67
- return token;
68
- }
69
- function phaseFinished(token) {
70
- if (!liveBrackets.delete(token))
71
- return;
72
- closedBrackets = [
73
- {
74
- phase: token.phase,
75
- startedAt: token.startedAt,
76
- closedAt: (/* @__PURE__ */ new Date()).toISOString()
77
- },
78
- ...closedBrackets
79
- ].slice(0, RECENT_PHASE_CAP);
80
- }
81
- var oncePerSessionPhases = /* @__PURE__ */ new Set();
82
- var sessionRecordSeq = 0;
83
- function mintSessionRecordId() {
84
- sessionRecordSeq += 1;
85
- return `${process.pid.toString(36)}-${Date.now().toString(36)}-${sessionRecordSeq.toString(36)}`;
86
- }
87
- var sessionRecordId = mintSessionRecordId();
88
- function currentSessionRecordId() {
89
- return sessionRecordId;
90
- }
91
- function claimKey(phase, scope) {
92
- return `${phase}\0${scope}`;
93
- }
94
- function claimPhaseOncePerSession(phase, scope) {
95
- const key = claimKey(phase, scope);
96
- if (oncePerSessionPhases.has(key))
97
- return false;
98
- oncePerSessionPhases.add(key);
99
- return true;
100
- }
101
- function releasePhaseClaim(phase, scope) {
102
- oncePerSessionPhases.delete(claimKey(phase, scope));
103
- }
104
- function logLatency(entry) {
105
- const ts = (/* @__PURE__ */ new Date()).toISOString();
106
- if (entry.type === "phase" && entry.phase && !LAST_PHASE_EXCLUDED.has(entry.phase)) {
107
- recentPhases = [
108
- {
109
- phase: entry.phase,
110
- ts,
111
- ...entry.toolName !== void 0 && { toolName: entry.toolName },
112
- ...entry.metadata !== void 0 && { metadata: entry.metadata }
113
- },
114
- ...recentPhases
115
- ].slice(0, RECENT_PHASE_CAP);
116
- }
117
- if (isTestMode()) {
118
- return;
119
- }
120
- writer.log({
121
- ...entry,
122
- ts,
123
- pid: process.pid,
124
- turnId: entry.turnId ?? getTurnId(),
125
- filePath: normalizeLoggedPath(entry.filePath)
126
- });
127
- }
128
-
129
- export {
130
- phaseStarted,
131
- phaseFinished,
132
- currentSessionRecordId,
133
- claimPhaseOncePerSession,
134
- releasePhaseClaim,
135
- logLatency
136
- };