@herbertgao/pi-extensions 2026.11.11 → 2026.11.13

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 (262) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +13 -11
  3. package/THIRD_PARTY_NOTICES.md +3 -3
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +22 -15
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +22 -8
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +0 -29
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +5 -2
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -39
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +3 -2
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +0 -40
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +4 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +21 -3
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
  17. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  18. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
  19. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  20. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  21. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +2 -2
  22. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
  23. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
  24. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
  25. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +12 -504
  26. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
  27. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
  28. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
  29. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +5 -34
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +17 -18
  35. package/node_modules/@herbertgao/pi-inline-skill-commands/LICENSE +21 -0
  36. package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +33 -0
  37. package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +53 -0
  38. package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +213 -0
  39. package/node_modules/pi-antigravity/README.md +58 -9
  40. package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
  41. package/node_modules/pi-antigravity/package.json +15 -6
  42. package/node_modules/pi-antigravity/src/client/client.ts +63 -14
  43. package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
  44. package/node_modules/pi-antigravity/src/client/index.ts +1 -0
  45. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
  46. package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
  47. package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
  48. package/node_modules/pi-antigravity/src/image/image.ts +16 -2
  49. package/node_modules/pi-antigravity/src/index.ts +145 -2
  50. package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
  51. package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
  52. package/node_modules/pi-antigravity/src/models/models.ts +126 -14
  53. package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
  54. package/node_modules/pi-antigravity/src/types/types.ts +30 -1
  55. package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
  56. package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
  57. package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
  58. package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
  59. package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
  60. package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
  61. package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
  62. package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
  63. package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
  64. package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
  65. package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
  66. package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
  67. package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
  68. package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
  69. package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
  70. package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
  71. package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
  72. package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
  73. package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
  74. package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
  75. package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
  76. package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
  77. package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
  78. package/node_modules/pi-antigravity/tsconfig.json +2 -2
  79. package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
  80. package/node_modules/pi-commandcode-provider/README.md +2 -2
  81. package/node_modules/pi-commandcode-provider/package.json +1 -1
  82. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
  83. package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
  84. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  85. package/node_modules/pi-lens/CHANGELOG.md +172 -0
  86. package/node_modules/pi-lens/README.md +103 -217
  87. package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  88. package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  89. package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  90. package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  91. package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  92. package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  93. package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  94. package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  95. package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  96. package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  97. package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  98. package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  99. package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  100. package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
  101. package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  102. package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  103. package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  105. package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  106. package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  107. package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  108. package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  109. package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  110. package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  111. package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  112. package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  113. package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  114. package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  115. package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  116. package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  117. package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  118. package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  119. package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  120. package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  121. package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  122. package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  123. package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  124. package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  125. package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  126. package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
  127. package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  128. package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
  129. package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  130. package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  131. package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  132. package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  133. package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  134. package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  135. package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  136. package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  137. package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
  138. package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  139. package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  140. package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  141. package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  142. package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  143. package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  144. package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  145. package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
  146. package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  147. package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  148. package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
  149. package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
  150. package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  151. package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  152. package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  153. package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  154. package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  155. package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  156. package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  157. package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  158. package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  159. package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  160. package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
  161. package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  162. package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  163. package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  164. package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  165. package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  166. package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  167. package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  168. package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  169. package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  170. package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  171. package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  172. package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  173. package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  174. package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  175. package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
  176. package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  177. package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
  178. package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  179. package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  180. package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  181. package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  182. package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  183. package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  184. package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  185. package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  186. package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  187. package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  188. package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  189. package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  190. package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  191. package/node_modules/pi-lens/dist/index.js +6508 -5413
  192. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
  193. package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
  194. package/node_modules/pi-lens/dist/mcp/server.js +602 -345
  195. package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
  196. package/node_modules/pi-lens/dist/probes/installer.js +19 -17
  197. package/node_modules/pi-lens/docs/architecture.md +113 -0
  198. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
  199. package/node_modules/pi-lens/docs/ci.md +18 -4
  200. package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
  201. package/node_modules/pi-lens/docs/dependencies.md +10 -10
  202. package/node_modules/pi-lens/docs/features.md +3 -3
  203. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
  204. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
  205. package/node_modules/pi-lens/docs/language-coverage.md +39 -0
  206. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
  207. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  208. package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
  209. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
  210. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
  211. package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
  212. package/node_modules/pi-lens/docs/prose-standard.md +112 -0
  213. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  214. package/node_modules/pi-lens/docs/usage.md +50 -0
  215. package/node_modules/pi-lens/package.json +1 -1
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  217. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  218. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  219. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  220. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  221. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  222. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  223. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  224. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  225. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  226. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  227. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  228. package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  229. package/node_modules/pi-web-access/CHANGELOG.md +29 -0
  230. package/node_modules/pi-web-access/README.md +35 -15
  231. package/node_modules/pi-web-access/anysearch.ts +7 -3
  232. package/node_modules/pi-web-access/autom.ts +196 -0
  233. package/node_modules/pi-web-access/cloro.ts +254 -0
  234. package/node_modules/pi-web-access/curator-page.ts +7 -1
  235. package/node_modules/pi-web-access/curator-server.ts +3 -0
  236. package/node_modules/pi-web-access/dist/index.js +12931 -12111
  237. package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
  238. package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
  239. package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
  240. package/node_modules/pi-web-access/duckduckgo.ts +11 -3
  241. package/node_modules/pi-web-access/extract.ts +60 -4
  242. package/node_modules/pi-web-access/gemini-search.ts +25 -5
  243. package/node_modules/pi-web-access/index.ts +9 -1
  244. package/node_modules/pi-web-access/package.json +2 -2
  245. package/node_modules/pi-web-access/page-query.ts +12 -3
  246. package/node_modules/pi-web-access/specstream.ts +276 -0
  247. package/node_modules/pi-web-access/tool-activation.ts +21 -6
  248. package/node_modules/pi-web-access/utils.ts +4 -0
  249. package/node_modules/pi-web-access/video-extract.ts +2 -2
  250. package/node_modules/pi-web-access/web-tool-core.ts +24 -5
  251. package/node_modules/pi-web-access/youtube-extract.ts +2 -2
  252. package/package.json +13 -7
  253. package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
  254. package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
  255. package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
  256. package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
  257. package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
  258. package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
  259. package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
  260. package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
  261. package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
  262. package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
@@ -0,0 +1,213 @@
1
+ import { readFileSync } from "node:fs"
2
+ import {
3
+ CustomEditor,
4
+ DefaultResourceLoader,
5
+ getAgentDir,
6
+ SettingsManager,
7
+ stripFrontmatter,
8
+ type ExtensionAPI,
9
+ type ExtensionContext,
10
+ type Skill,
11
+ } from "@earendil-works/pi-coding-agent"
12
+ import type {
13
+ AutocompleteProvider,
14
+ EditorComponent,
15
+ } from "@earendil-works/pi-tui"
16
+
17
+ const MID_SKILL_TOKEN =
18
+ /(?:^|[\s\u3000\u00a0\u2007\u202f\u203f\u2060\ufeff,。!?;:、()【】《》「」『』([{<`])(\/[^\s/]*)$/
19
+ const MID_SKILL_COMMAND =
20
+ /(^|[\s\u3000\u00a0\u2007\u202f\u203f\u2060\ufeff,。!?;:、()【】《》「」『』([{<`])(\/skill:([a-z0-9-]{1,64}))(?=\s|$)/
21
+
22
+ type SkillDefinition = Pick<Skill, "name" | "filePath">
23
+ type SkillMap = ReadonlyMap<string, SkillDefinition>
24
+
25
+ interface TriggerableEditor extends EditorComponent {
26
+ getCursor?: () => { line: number; col: number }
27
+ isShowingAutocomplete?: () => boolean
28
+ tryTriggerAutocomplete?: () => void
29
+ inlineSkillCommandsTriggerInstalled?: boolean
30
+ }
31
+
32
+ export function extractMidSkillToken(
33
+ textBeforeCursor: string,
34
+ ): string | undefined {
35
+ const token = textBeforeCursor.match(MID_SKILL_TOKEN)?.[1]
36
+ if (!token) return undefined
37
+ const beforeToken = textBeforeCursor.slice(0, -token.length)
38
+ return beforeToken.trim() ? token : undefined
39
+ }
40
+
41
+ export function createMidSkillAutocompleteProvider(
42
+ current: AutocompleteProvider,
43
+ ): AutocompleteProvider {
44
+ return {
45
+ triggerCharacters: [
46
+ ...new Set([...(current.triggerCharacters ?? []), "/"]),
47
+ ],
48
+
49
+ async getSuggestions(lines, cursorLine, cursorCol, options) {
50
+ const currentLine = lines[cursorLine] ?? ""
51
+ const token = extractMidSkillToken(currentLine.slice(0, cursorCol))
52
+ if (!token) {
53
+ return current.getSuggestions(lines, cursorLine, cursorCol, options)
54
+ }
55
+
56
+ const nativeLine = `/${token.slice(1)}`
57
+ const nativeResult = await current.getSuggestions(
58
+ [nativeLine],
59
+ 0,
60
+ nativeLine.length,
61
+ options,
62
+ )
63
+ const items = (nativeResult?.items ?? []).filter((item) =>
64
+ item.value.startsWith("skill:"),
65
+ )
66
+ if (options.signal.aborted || items.length === 0) {
67
+ return options.signal.aborted
68
+ ? null
69
+ : current.getSuggestions(lines, cursorLine, cursorCol, options)
70
+ }
71
+ return { items, prefix: token }
72
+ },
73
+
74
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
75
+ const currentLine = lines[cursorLine] ?? ""
76
+ const beforeCursor = currentLine.slice(0, cursorCol)
77
+ if (
78
+ !item.value.startsWith("skill:") ||
79
+ extractMidSkillToken(beforeCursor) !== prefix
80
+ ) {
81
+ return current.applyCompletion(
82
+ lines,
83
+ cursorLine,
84
+ cursorCol,
85
+ item,
86
+ prefix,
87
+ )
88
+ }
89
+
90
+ const beforePrefix = beforeCursor.slice(0, -prefix.length)
91
+ const afterCursor = currentLine.slice(cursorCol)
92
+ const replacement = `/${item.value}`
93
+ const separator = /^\s/.test(afterCursor) ? "" : " "
94
+ return {
95
+ lines: lines.map((line, index) =>
96
+ index === cursorLine
97
+ ? beforePrefix + replacement + separator + afterCursor
98
+ : line,
99
+ ),
100
+ cursorLine,
101
+ cursorCol: beforePrefix.length + replacement.length + separator.length,
102
+ }
103
+ },
104
+
105
+ shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
106
+ return (
107
+ current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ??
108
+ true
109
+ )
110
+ },
111
+ }
112
+ }
113
+
114
+ export function expandMidSkillCommand(
115
+ text: string,
116
+ skills: SkillMap,
117
+ ): string | undefined {
118
+ const match = MID_SKILL_COMMAND.exec(text)
119
+ if (!match) return undefined
120
+
121
+ const boundary = match[1] ?? ""
122
+ const command = match[2] ?? ""
123
+ const commandIndex = match.index + boundary.length
124
+ const prefix = text.slice(0, commandIndex)
125
+ if (!prefix.trim()) return undefined
126
+
127
+ const skill = skills.get(match[3] ?? "")
128
+ if (!skill) return undefined
129
+
130
+ const content = stripFrontmatter(readFileSync(skill.filePath, "utf-8")).trim()
131
+ const args = text.slice(commandIndex + command.length).trim()
132
+ let expansion = `<skill name="${skill.name}" location="${skill.filePath}">\n${content}\n</skill>`
133
+ if (args) expansion += `\n\n${args}`
134
+ return prefix + expansion
135
+ }
136
+
137
+ export function wrapMidSkillTrigger<T extends EditorComponent>(editor: T): T {
138
+ const handleInput = editor.handleInput
139
+ editor.handleInput = function (this: TriggerableEditor, data) {
140
+ handleInput.call(this, data)
141
+ if (
142
+ !/^[a-zA-Z0-9\-_/]$/.test(data) ||
143
+ this.isShowingAutocomplete?.() ||
144
+ typeof this.tryTriggerAutocomplete !== "function"
145
+ ) {
146
+ return
147
+ }
148
+ const cursor = this.getCursor?.()
149
+ const currentLine = cursor
150
+ ? (this.getText().split("\n")[cursor.line] ?? "").slice(0, cursor.col)
151
+ : ""
152
+ if (extractMidSkillToken(currentLine) !== undefined) {
153
+ this.tryTriggerAutocomplete()
154
+ }
155
+ }
156
+ return editor
157
+ }
158
+
159
+ function installMidSkillTrigger(): void {
160
+ // SAFETY: CustomEditor has these runtime members; the private trigger is feature-checked before use.
161
+ const prototype = CustomEditor.prototype as unknown as TriggerableEditor
162
+ if (prototype.inlineSkillCommandsTriggerInstalled) return
163
+ wrapMidSkillTrigger(prototype)
164
+ prototype.inlineSkillCommandsTriggerInstalled = true
165
+ }
166
+
167
+ async function loadSessionSkills(ctx: ExtensionContext): Promise<SkillMap> {
168
+ const agentDir = getAgentDir()
169
+ const settingsManager = SettingsManager.create(ctx.cwd, agentDir, {
170
+ projectTrusted: ctx.isProjectTrusted(),
171
+ })
172
+ const loader = new DefaultResourceLoader({
173
+ cwd: ctx.cwd,
174
+ agentDir,
175
+ settingsManager,
176
+ noExtensions: true,
177
+ noPromptTemplates: true,
178
+ noThemes: true,
179
+ noContextFiles: true,
180
+ })
181
+ await loader.reload()
182
+ return new Map(loader.getSkills().skills.map((skill) => [skill.name, skill]))
183
+ }
184
+
185
+ export default function piInlineSkillCommands(pi: ExtensionAPI): void {
186
+ let skillsPromise: Promise<SkillMap> | undefined
187
+ installMidSkillTrigger()
188
+
189
+ const getSkills = (ctx: ExtensionContext): Promise<SkillMap> => {
190
+ skillsPromise ??= loadSessionSkills(ctx).catch((error: unknown) => {
191
+ if (ctx.hasUI) {
192
+ const message = error instanceof Error ? error.message : String(error)
193
+ ctx.ui.notify(`Inline skill commands: ${message}`, "error")
194
+ }
195
+ return new Map()
196
+ })
197
+ return skillsPromise
198
+ }
199
+
200
+ pi.on("session_start", (_event, ctx) => {
201
+ skillsPromise = undefined
202
+ void getSkills(ctx)
203
+ if (!ctx.hasUI) return
204
+
205
+ ctx.ui.addAutocompleteProvider(createMidSkillAutocompleteProvider)
206
+ })
207
+
208
+ pi.on("input", async (event, ctx) => {
209
+ if (!MID_SKILL_COMMAND.test(event.text)) return
210
+ const text = expandMidSkillCommand(event.text, await getSkills(ctx))
211
+ return text === undefined ? undefined : { action: "transform", text }
212
+ })
213
+ }
@@ -21,6 +21,7 @@ Want to equip Pi with MCP, web access, subagents, and todos? Install [`pi-essent
21
21
  - [Quick start](#quick-start)
22
22
  - [Authentication and credential safety](#authentication-and-credential-safety)
23
23
  - [Commands](#commands)
24
+ - [Tools](#tools)
24
25
  - [Models and routing](#models-and-routing)
25
26
  - [Configuration](#configuration)
26
27
  - [Troubleshooting](#troubleshooting)
@@ -28,6 +29,7 @@ Want to equip Pi with MCP, web access, subagents, and todos? Install [`pi-essent
28
29
 
29
30
  ## Requirements
30
31
 
32
+ - Node **22.19.0 or later**
31
33
  - Pi Coding Agent and Pi AI version **0.80.0 or later**
32
34
  - A Google account that can use the relevant Cloud Code Assist / Antigravity services
33
35
  - A browser to complete the Google sign-in. Same-machine is best (the browser hits the local callback automatically); on a remote/headless machine, complete sign-in anywhere and paste the resulting callback URL back into Pi (see [Troubleshooting](#troubleshooting)).
@@ -108,17 +110,51 @@ Review these permissions before approving access. If your credentials expire or
108
110
  | `/antigravity.usage` | Show the server-reported shared quota groups and reset times. |
109
111
  | `/antigravity.models` | List available runtime models, remaining shared-pool quota, and capabilities. |
110
112
  | `/antigravity.accounts` | List linked accounts; use `switch` or `remove` with an index or email to manage them. |
113
+ | `/antigravity.credits [on\|off]` | Check or toggle automatic fallback to AI credits when standard quotas are exhausted. |
111
114
  | `/antigravity.models all` | Include tab/chat models normally hidden from the model list. |
112
115
  | `/antigravity.refresh` | Force refresh the dynamic model catalog from Antigravity. |
113
116
  | `/antigravity.doctor` | Show sanitized provider diagnostics, including the endpoint, status, and resolved runtime model. |
114
117
  | `/antigravity.image <prompt>` | Generate an image via Antigravity and save it under `.pi/generated-images/`. Optional `--ratio 16:9`, `--model`, `--path`. |
115
118
  | `/antigravity.search <query>` | Search the web using Google Search Grounding via Antigravity. Optional `--thinking`, `--url <url>`. |
119
+ | `/antigravity.fetch <url>` | Read a public web page through the Antigravity fetch service and print it as markdown. Optional `--raw` keeps the crawled source. |
116
120
 
117
121
  Model availability, entitlement, quota groups, and resets are returned by the service and can differ by account. The quota percentage shown for a model can represent a shared pool, not a private per-model allowance.
118
122
 
119
- The extension also registers a `generate_image` tool the model can call. Images are written inside the project directory (default `.pi/generated-images/`). Image generation defaults to `gemini-3.1-flash-image`; model availability is account-dependent. Requests use the direct image endpoint, with the legacy streaming endpoint tried on HTTP 404. Existing model and endpoint fallbacks remain available.
123
+ ## Tools
120
124
 
121
- It also registers a `google_search` tool allowing models to perform real-time web search and URL analysis using Google Search Grounding over Cloud Code Assist. The default model is `gemini-3.5-flash-lite` (fallbacks: `gemini-3.1-flash-lite`, `gemini-3-flash`) and the default reply is a short evidence brief. It supports optional lead agent directives (`instruction`), specific target URLs (`urls`), and deep reasoning (`thinking: true` or `/antigravity.search --thinking`).
125
+ ### Image generation
126
+
127
+ The extension registers a `generate_image` tool the model can call. Images are written inside the project directory (default `.pi/generated-images/`). Image generation defaults to `gemini-3.1-flash-image`; model availability is account-dependent. Requests use the direct image endpoint, with the legacy streaming endpoint tried on HTTP 404. Existing model and endpoint fallbacks remain available.
128
+
129
+ The `generate_image` tool accepts an optional `referenceImages` array of project-relative paths. Reference images are sent to Google alongside the prompt; only include images you intend to upload. PNG, JPEG, WebP, and GIF are supported, with MIME types detected from file contents. Each reference must be at most 10 MB, and at most four references are sent. Paths must remain inside the working directory, including symlink targets. For example:
130
+
131
+ ```json
132
+ {
133
+ "prompt": "Design a deep bowl using the colors and artwork in these references",
134
+ "referenceImages": ["references/oatmeal.png", "references/plate.jpg"],
135
+ "path": "designs/bowl.png"
136
+ }
137
+ ```
138
+
139
+ Omit `referenceImages` (or pass `[]`) for text-only generation. `/antigravity.image` remains text-only; reference paths are supported by the tool, not the slash command.
140
+
141
+ ### Search
142
+
143
+ The `google_search` tool allows models to perform real-time web search and URL analysis using Google Search Grounding over Cloud Code Assist. The default model is `gemini-3.5-flash-lite` (fallbacks: `gemini-3.1-flash-lite`, `gemini-3-flash`) and the default reply is a short evidence brief. It supports optional lead agent directives (`instruction`), specific target URLs (`urls`), and deep reasoning (`thinking: true` or `/antigravity.search --thinking`).
144
+
145
+ ### Read a page
146
+
147
+ Use the reader when you already know the page URL; use `google_search` to find sources. The answer is Google's crawled copy and can be stale or incomplete. For login pages, interactive applications, and unsupported formats, use a browser or another permitted local tool. Check `/antigravity.doctor` after a failed or degraded read. The [reader guarantees](docs/reader-guarantees.md) map its limits to offline regression checks.
148
+
149
+ The `read_url_content` tool reads public pages. Fetching runs through Google's Cloud Code Assist endpoints, so the machine never contacts the target site. The character budget covers returned text and serialized details; small budgets may omit older attempt details, with an explicit omission count. `/antigravity.doctor` retains the bounded retrieval history. The tool resolves redirects with `v1internal:rewriteUri`, reads `v1internal:fetchFromTrawlerCache`, and retries with `liveFetch: true` when the cache is missing, clearly cut off, empty, or suspected to contain only a shell or access wall. A shared 10-second network deadline bounds redirects, endpoint failover, and recovery; useful content is retained if the deadline expires or recovery fails. Short readable fragments with unknown completeness do not trigger a retry. Endpoint failover is limited to transport failures; a read makes at most ten Google requests and tries at most one publisher representation URL. HTML conversion accepts at most 2,000,000 characters, 50,000 markup tokens, and 128 nested elements. More complex pages are not converted; Google's HTML is saved to a temp file instead.
150
+
151
+ Before converting HTML to Markdown, the tool reads page metadata, bounded JSON-LD matched to the article, and advertised alternate representations. If cache and live results are inadequate, it tries at most one same-origin Markdown or supported article-JSON representation, preferring the page language and then Markdown; a mismatched-language fallback updates the reported language and retrieval outcome. JSON recovery supports GitHub Docs article bodies and WordPress single-post responses with matching article identity. Inadequate MDN copies can use the publisher's same-origin `index.json` representation within the same one-representation budget. Cut-off Wikipedia articles use Wikipedia's parse API for the same article, and cut-off `raw.githubusercontent.com` files use the full line list from the matching GitHub file page; both are used only when they name the requested article or file. Wikipedia titles are matched the way MediaWiki does (first letter capitalized, redirects followed); revisions, queries, and special pages are not recovered. These copies are tried even when Google cannot serve the original URL. MDN's JSON may supply a canonical article URL within the same origin and locale's `/docs/` prefix; results report that redirect. Recovery requires verified publisher identity and complete supported article sections; if Google cuts only the later sidebar JSON, the source is still reported as incomplete. Unknown section types or a cut-off article body are not silently repaired. Results report the article URL, any alternate representation URL, retrieval attempts, and available title, author, publication date, modification date, and language. Structured data is parsed, never executed.
152
+
153
+ Conversion keeps headings, lists, links, code blocks, and data tables. Table grids are limited to 10,000 cells per page; nested or oversized grids are flattened without expanding their spans. It removes navigation and hidden decorations (a block named like chrome, such as `sidebar` or `menu`, is kept when it holds the article or most of the page's text), then selects a substantive `<main>`, `role="main"`, or `<article>` region, skipping empty placeholders. Source completeness, suspected content problems, and our own output truncation are reported separately. A closed HTML document is not proof that Google supplied the entire article. Empty results do not establish that the page requires JavaScript: Google's response may be cut off, blocked, or a shell.
154
+
155
+ Output is capped by `ANTIGRAVITY_WEB_FETCH_MAX_CHARS` (default 60000), including the provenance header and saved-page footer. A long URL is elided inside the header so provenance cannot take the page's share of the budget away. Page-controlled metadata is stripped of line breaks and bounded before it reaches the header. When a page does not fit, the tool returns its beginning and saves the full Markdown, with the provenance header, to a private temp file (`pi-url-*/page.md`, mode 0600), the same way Pi saves long tool output. The answer ends with the file path, and `details.fullOutputPath` holds it; the agent reads or searches that file instead of fetching again. Pages beyond the conversion limits are refused, and Google's unconverted HTML is saved to `page.html` for searching. Raw mode is not bound by those limits: it returns the crawled source as it is, so the page's size limits the answer, not the read. A raw page that does not fit is saved as the source alone, without the provenance header. If a page cannot be saved (for example, the temp directory is not writable), the answer says so and still shows the beginning. Temp files are not deleted automatically. Service responses over 5 MB are refused before parsing. A live 401/403 or other recovery failure keeps an already usable cached copy.
156
+
157
+ `/antigravity.fetch [--raw] <url>` exposes the same fetch interactively. Raw mode preserves the requested page's crawled source and does not substitute alternate representations. Literal private/local addresses, local hostnames, non-HTTP URLs, and URLs with embedded username/password are refused. Known sensitive query and fragment values, and token-shaped values, are redacted from provenance, progress messages, and errors, but remain part of the request sent to the fetch service. DNS names are resolved by Google's service rather than locally, so this check is a filter for obvious local/private targets, not a guarantee against every name that resolves internally. The service resolves the initial redirect chain, so local validation sees the final URI it reports rather than every remote hop: a final URI that names a private or local address fails closed and aborts the read, while a malformed one is ignored and the requested page is read. Explicit non-HTTP or credential-bearing redirects are refused. PDF URLs, PDF content types, and line-start PDF signatures within the first 1024 characters fail with guidance to download the URL directly and read the local file with an available PDF reader, subject to normal permissions. Alternate `.pdf` links are ignored rather than substituted. The tool itself does not download or extract PDFs. This remains a best-effort Google crawler tool, without a local HTTP or browser fallback, cookies, or login support.
122
158
 
123
159
  ### Native image API
124
160
 
@@ -137,11 +173,15 @@ The native API returns in-memory image/text blocks and does not save files. Inpu
137
173
 
138
174
  ## Models and routing
139
175
 
140
- After you sign in, the provider refreshes its catalog from Antigravity (`fetchAvailableModels`) and groups runtime thinking variants into public Pi model IDs. Newly enabled models — for example Gemini 4 Argon or a new Gemini Flash generation — become selectable after that refresh without waiting for an extension release. A last-known-good cache is kept for offline/cold start; the static table below is only the conservative fallback and a routing reference.
176
+ After you sign in, the provider refreshes its catalog from Antigravity (`fetchAvailableModels`) and groups runtime thinking variants into public Pi model IDs. Newly enabled models — for example Gemini 4 Argon or Gemini 4 Hydrogen — become selectable after that refresh without waiting for an extension release. A last-known-good cache is kept for offline/cold start; the static table below is only the conservative fallback and a routing reference.
141
177
 
142
178
  Gemini 4 Argon is advertised only when the client version is current and the account is entitled. After upgrading, run `/antigravity.refresh` (or start any session; print mode refreshes before the prompt) and select `antigravity/gemini-4-argon`. Updating the client version does not grant entitlement. Headless `pi -p` resolves `--model` before extensions run, so the first invocation after an upgrade can still print `Using custom model id`; the request is routed from the refreshed catalog, and the next invocation reads the persisted list.
143
179
 
144
- A successful refresh replaces the catalog with advertised models and routes, removing entries absent from all responding endpoints. Live capabilities and token limits override static defaults; grouped variants use the smallest advertised limits. Known thinking variants such as `gemini-3.8-flash-low` / `-medium` / `-high` become one public model. Unfamiliar suffixes and opaque IDs stay usable as exact runtime IDs when they pass the catalog filters.
180
+ Long sessions that switch providers are the highest-risk setup for tool-observation mimicry on Gemini 3.x. Foreign tool calls are flattened into `[Observation from ...]` text, and a model can imitate those logs instead of making a real tool call. Finish a task on one provider before switching.
181
+
182
+ A tier that answers with a generic resource-exhausted error is retried on the other Antigravity endpoints and then on a sibling tier of the same generation (`-low` can move to `-high` or `-medium`). A hard quota message that includes a reset time does not do this.
183
+
184
+ A successful refresh replaces the catalog with advertised models and routes, removing entries absent from all responding endpoints. Live capabilities and token limits override static defaults; grouped variants use the smallest advertised limits. Known thinking variants such as `gemini-4-hydrogen-low` / `-medium` / `-high` / `-xhigh` become one public model. Unfamiliar suffixes and opaque IDs stay usable as exact runtime IDs when they pass the catalog filters.
145
185
 
146
186
  Use `/antigravity.refresh` to bypass the four-hour cache, or `/antigravity.models` to view live availability and quota. Account/project changes and older cache formats trigger discovery on the next network-enabled refresh. Failed or unrecognized responses keep the last-known-good catalog; forced refreshes report the error. Arbitrary API schema changes can still require an extension update. `ANTIGRAVITY_USER_AGENT` overrides the default client fingerprint when a newer CLI version is required.
147
187
 
@@ -185,7 +225,11 @@ All primary environment variables start with `ANTIGRAVITY_`. The legacy `NOAGY_`
185
225
  <!-- prettier-ignore -->
186
226
  | Variable | Purpose |
187
227
  | --- | --- |
188
- | `ANTIGRAVITY_BASE_URL` | Override the API base URL. It must be HTTPS, contain no URL credentials, and target an allowed Google APIs host. |
228
+ | `ANTIGRAVITY_BASE_URL` | Override the API base URL. It must be HTTPS, contain no URL credentials, and target an allowed Google APIs host. Ignored for inference once Gemini Enterprise routing is active. |
229
+ | `ANTIGRAVITY_LOCATION` | `eu`, `us`, or `global`. `eu` and `us` send inference only to `businessaicode.<location>.rep.googleapis.com` and never fall back to the consumer `cloudcode-pa` hosts. Also read from `~/.gemini/antigravity-cli/settings.json` when that file stores `location`. |
230
+ | `ANTIGRAVITY_ENTERPRISE` | Set to `1` to force Gemini Enterprise routing, including `global` (`businessaicode.googleapis.com`). |
231
+ | `ANTIGRAVITY_ENTERPRISE_PROJECT` | Google Cloud project id for the selected Gemini Enterprise license. Required when enterprise routing is on. Also read from the CLI settings `project` / `projectId`. |
232
+ | `ANTIGRAVITY_USER_TIER` | License tier id required with enterprise routing. Also read from the CLI settings `userTier`. |
189
233
  | `ANTIGRAVITY_PROJECT_ID` | Use a specific Cloud Code Assist project ID instead of discovery or the stable account fallback. |
190
234
  | `ANTIGRAVITY_CALLBACK_HOST` | Bind OAuth callback to `127.0.0.1`, `::1`, or `localhost` only. Defaults to `127.0.0.1`. |
191
235
  | `ANTIGRAVITY_USER_AGENT` | Override the request user-agent. |
@@ -197,12 +241,15 @@ All primary environment variables start with `ANTIGRAVITY_`. The legacy `NOAGY_`
197
241
  | `ANTIGRAVITY_STREAM_HEADER_TIMEOUT_MS` | Response-header deadline; default `180000` ms. Set `0` to disable. |
198
242
  | `ANTIGRAVITY_NO_KEEPALIVE` | Set to `1` to skip the keep-alive connection pool. |
199
243
  | `ANTIGRAVITY_NO_PREWARM` | Set to `1` to skip the TLS pre-warm request made on the first Antigravity request. |
200
- | `ANTIGRAVITY_NO_EXTRA_TOOLS` | Set to `1` to stop registering the model-facing `google_search` and `generate_image` tools. The `/antigravity.search` and `/antigravity.image` commands stay available. |
244
+ | `ANTIGRAVITY_NO_EXTRA_TOOLS` | Set to `1` to stop registering the model-facing `google_search`, `read_url_content`, and `generate_image` tools. The `/antigravity.search`, `/antigravity.fetch`, and `/antigravity.image` commands stay available. |
245
+ | `ANTIGRAVITY_USE_CREDITS` | Set to `1` (or `0`) to explicitly enable (or disable) automatic AI credit overages when standard quota is depleted. Defaults to inheriting `useG1Credits` from `~/.gemini/antigravity-cli/settings.json` only when that file sets the flag. Otherwise credit overages stay off. |
201
246
  | `ANTIGRAVITY_NO_SEARCH_TOOL` | Set to `1` to skip only the `google_search` tool, e.g. when another extension provides web search. |
247
+ | `ANTIGRAVITY_NO_FETCH_TOOL` | Set to `1` to skip only the `read_url_content` tool, e.g. when another extension already fetches URLs. |
202
248
  | `ANTIGRAVITY_NO_IMAGE_TOOL` | Set to `1` to skip only the `generate_image` tool. |
203
- | `ANTIGRAVITY_DEFER_TOOLS` | Set to `1` to register `google_search` and `generate_image` as deferred: they aren't declared to the model, but codemode scripts can call them and `tool_search` can load them. Needs `codemode` or `tool_search` active, e.g. `"defaultTools": ["+codemode"]`. Requires Pi 0.99.2+; older Pi keeps them direct. |
249
+ | `ANTIGRAVITY_WEB_FETCH_MAX_CHARS` | Character budget for one `read_url_content` result. Defaults to 60000, roughly 15k tokens. |
250
+ | `ANTIGRAVITY_DEFER_TOOLS` | Set to `1` to register `google_search`, `read_url_content`, and `generate_image` as deferred: they aren't declared to the model, but codemode scripts can call them and `tool_search` can load them. Needs `codemode` or `tool_search` active, e.g. `"defaultTools": ["+codemode"]`. Requires Pi 0.99.2+; older Pi keeps them direct. |
204
251
 
205
- `pi config` can disable each model-facing tool without disabling the provider. The package loads three extension resources: `src/index.ts` (provider, OAuth, and slash commands), `src/features/google-search.ts` (`google_search`), and `src/features/generate-image.ts` (`generate_image`). Turn off a feature resource there to stop registering that tool. `/antigravity.search` and `/antigravity.image` stay available from the provider extension.
252
+ `pi config` can disable each model-facing tool without disabling the provider. The package loads four extension resources: `src/index.ts` (provider, OAuth, and slash commands), `src/features/google-search.ts` (`google_search`), `src/features/read-url-content.ts` (`read_url_content`), and `src/features/generate-image.ts` (`generate_image`). Turn off a feature resource there to stop registering that tool. `/antigravity.search`, `/antigravity.fetch`, and `/antigravity.image` stay available from the provider extension.
206
253
 
207
254
  Environment variables still force a loaded tool off, including in scripts and headless runs. They cannot turn a resource back on after `pi config` disables it, because that file is not loaded. Either control is enough to hide the tool from the model. Run `/reload` after changing `pi config`.
208
255
 
@@ -232,10 +279,12 @@ This repo uses [Yarn 4](https://yarnpkg.com/) via Corepack for install, scripts,
232
279
 
233
280
  ```bash
234
281
  corepack enable
235
- yarn install
282
+ yarn install --immutable
236
283
  yarn check
237
284
  ```
238
285
 
286
+ For an optional live fetch check, run `yarn smoke:fetch` after `/login antigravity`. It exercises the registered tool on three public URLs and checks that reading a saved page needs neither network nor credentials. Missing expected page text is a failure unless explicit retrieval failures explain a degraded copy, which is an upstream-availability warning. An unobserved MDN canonical alias is also a warning; when that alias is observed, redirect provenance is checked. It uses saved Pi credentials (`PI_AUTH_PATH` can select another auth file), leaves saved pages in the temp directory, and is excluded from `yarn check` and default CI. Exit codes: 0 for successful coverage, 1 for integration failures, 2 when upstream availability limits coverage, no page passes, or no saved page can be checked.
287
+
239
288
  Installs are hardened against common supply-chain attacks: lifecycle scripts are off, lockfile checksums must match the npm registry, and package versions younger than three days are rejected. Do not add a second registry or enable `enableScripts` without a review.
240
289
 
241
290
  The package declares its Pi extension in `package.json` under `pi.extensions`. See the [Pi package documentation](https://pi.dev/docs/latest/packages) for package installation, manifest, and gallery conventions.
@@ -0,0 +1,35 @@
1
+ # Reader guarantees
2
+
3
+ The reader uses Google's crawler. It does not contact the origin directly, execute page scripts, download files, extract PDFs, or reconstruct missing article text. A closed HTML document or a complete saved page does not prove full article coverage.
4
+
5
+ ## Contract and regression checks
6
+
7
+ Run `yarn check` for the offline gate. The two reader scripts are included in TypeScript, ESLint, Prettier, and the default test chain.
8
+
9
+ | Guarantee | Regression check | Owner |
10
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------- |
11
+ | Unsafe caller URLs are rejected before credential lookup or progress. Search uses the same URL predicate, plus a best-effort DNS filter before contacting origins. | `scenarioGuards`; foundations URL policy cases; search citations tests | `utils/address.ts` |
12
+ | URL credentials and recognized credential carriers are redacted on rendered surfaces. Ordinary diagnostic values and JSON structure survive. Exact caller/service URL echoes in page content are redacted before the page is shown or saved. Arbitrary secrets in page text are not promised filtered. | `scenarioSecrets`; foundations redaction and JSON cases | `utils/security.ts`, `web-fetch.ts` |
13
+ | Malformed credentials cannot appear in parser errors or retained causes. | Foundations credential cases | `client/client.ts` |
14
+ | Third-party text has valid UTF-16. Metadata is bounded and single-line; page bodies retain their line structure. | Foundations text, metadata, and body cases | `utils/text.ts` |
15
+ | Relative redirects resolve normally. Explicit private, credential-bearing, or non-HTTP destinations fail closed. Only destinations reported by Google are visible; intermediate redirects and remote DNS are not independently checked. | `scenarioRedirects`; foundations URL policy | `web-fetch.ts` |
16
+ | One shared ten-second network deadline and at most ten Google requests bound retrieval. Endpoint failover is transport-only. The caller's abort is respected. | `scenarioAlternateOnSecondEndpoint`; deadline and abort cases | `web-fetch.ts` |
17
+ | Recovery retains a useful original when live or optional representation reads fail. At most one publisher representation URL is selected. | `scenarioRecovery`, `scenarioAlternate`, `scenarioPdf` | `web-fetch.ts` |
18
+ | HTML work is bounded before parsing: 2,000,000 characters, 50,000 markup tokens, 128 nested elements. Script strings and comments do not count as nested markup. Independent blocks avoid repeated prefix joins. | Foundations size, node, depth, script/comment, and many-block cases | `document.ts`, `markdown.ts` |
19
+ | Inspection uses an owned DOM, substantive content regions, and body evidence for access-wall judgments. A heading alone does not prove a wall or a JavaScript shell. | Foundations inspection and real-page fixtures; `scenarioStatusArticle` | `inspect.ts`, `markdown.ts` |
20
+ | XML, SVG, Markdown, and text are not silently emptied as HTML. PDF refusal uses the reported media type, URL suffix, or line-start signature rather than prose mentioning a signature. | Foundations media cases; `scenarioDetection`, `scenarioPdf` | `media.ts`, `markdown.ts`, `web-fetch.ts` |
21
+ | Source completeness, content assessment, and output truncation remain separate. Publisher metadata is labeled as publisher claims. Omitted publisher sections are noted. | `scenarioTruncatedCopy`; foundations MDN cases | `inspect.ts`, `mdn.ts`, `web-fetch.ts` |
22
+ | Returned text plus serialized details share the configured character cap. Provenance and the saved-page footer count too. Small budgets can omit older attempt details; the omission count is explicit and doctor retains the bounded full history. | `scenarioReadablePage`, `scenarioBudget`, `scenarioLongFence`; live smoke cap checks | Feature entrypoint and formatter |
23
+ | A page that does not fit is saved whole to a private temp file named in the answer and in `details.fullOutputPath`. A budget too small to answer leaves no file behind, and a failed save is reported in the answer without losing the page. Pages beyond the conversion limits are refused with Google's unconverted HTML saved. Raw mode returns the crawled source whatever its size and saves it without the provenance header. | `scenarioReadablePage`, `scenarioBudgetFailure`, `scenarioUnconverted` | `save.ts`, feature entrypoint |
24
+ | Cut-off or unavailable Wikipedia articles and raw GitHub files recover only through a copy that names the requested article or file. Advertised, MDN, Wikipedia and GitHub copies share one representation contract. | `scenarioWikipedia`, `scenarioGithubRaw` | `sites.ts`, `web-fetch.ts` |
25
+ | Successful degraded reads and failures leave sanitized diagnostics. | Deadline/degraded diagnostics cases | Reader and `diagnostics/` |
26
+
27
+ Search caches expire after ten minutes and skip known secret-bearing keys or values. Client lookup caches use token digests rather than raw access tokens as keys.
28
+
29
+ The response stream is capped at 5,000,000 bytes. Limits are refusals, not claims that a page is complete.
30
+
31
+ ## Live check
32
+
33
+ After `/login antigravity`, run `yarn smoke:fetch`. It exercises Example.com, GitHub Docs, and an old MDN URL, checks the complete output cap, and checks that a saved page can be read without network or credentials. Wrong page text is a failure. Explicit retrieval failures explaining a degraded copy and an unobserved canonical alias are warnings. Upstream availability warnings produce exit code 2; an alias-only warning does not. Exit code 2 means live coverage was insufficient; a passing offline gate does not replace this check.
34
+
35
+ The saved fixture data comes from the existing main-branch corpus. Its provenance is listed in `scripts/fixtures/web-fetch/README.md`. The branch's registered-tool suite remains the implementation contract; main's incompatible reader suite is not imported.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-antigravity",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Personal Antigravity / Cloud Code Assist provider for Pi Coding Agent",
5
5
  "author": "Rahul Arya",
6
6
  "license": "MIT",
@@ -25,6 +25,7 @@
25
25
  "files": [
26
26
  "LICENSE",
27
27
  "README.md",
28
+ "docs/reader-guarantees.md",
28
29
  "src",
29
30
  "tsconfig.json"
30
31
  ],
@@ -34,12 +35,13 @@
34
35
  },
35
36
  "scripts": {
36
37
  "typecheck": "tsc --noEmit",
37
- "lint": "eslint src",
38
+ "lint": "eslint src scripts/test-web-fetch.ts scripts/test-reader-foundations.ts scripts/smoke-fetch-policy.ts",
38
39
  "lint:fix": "eslint src --fix",
39
40
  "format": "prettier --write .",
40
41
  "format:check": "prettier --check .",
41
42
  "security-check": "node scripts/run-ts.mjs scripts/security-check.ts",
42
- "test": "node scripts/run-ts.mjs scripts/test-sanitize-text.ts && node scripts/run-ts.mjs scripts/test-model-routing.ts && node scripts/run-ts.mjs scripts/test-model-discovery.ts && node scripts/run-ts.mjs scripts/test-usage-formatter.ts && node scripts/run-ts.mjs scripts/test-stream-sse.ts && node scripts/run-ts.mjs scripts/test-stream-header-deadline.ts && node scripts/run-ts.mjs scripts/test-http-proxy.ts && node scripts/run-ts.mjs scripts/test-oauth-fetch.ts && node scripts/run-ts.mjs scripts/test-image-gen.ts && node scripts/run-ts.mjs scripts/test-native-images.ts && node scripts/run-ts.mjs scripts/test-transcript-context.ts && node scripts/run-ts.mjs scripts/test-accounts.ts && node scripts/run-ts.mjs scripts/test-search.ts && node scripts/run-ts.mjs scripts/test-search-citations.ts && node scripts/run-ts.mjs scripts/test-extra-tools-toggle.ts && node scripts/run-ts.mjs scripts/test-provider-registration.ts && node scripts/run-ts.mjs scripts/test-stream-recovery.ts",
43
+ "test": "node scripts/run-ts.mjs scripts/test-sanitize-text.ts && node scripts/run-ts.mjs scripts/test-model-routing.ts && node scripts/run-ts.mjs scripts/test-model-discovery.ts && node scripts/run-ts.mjs scripts/test-usage-formatter.ts && node scripts/run-ts.mjs scripts/test-model-pricing.ts && node scripts/run-ts.mjs scripts/test-stream-sse.ts && node scripts/run-ts.mjs scripts/test-stream-header-deadline.ts && node scripts/run-ts.mjs scripts/test-http-proxy.ts && node scripts/run-ts.mjs scripts/test-oauth-fetch.ts && node scripts/run-ts.mjs scripts/test-image-gen.ts && node scripts/run-ts.mjs scripts/test-native-images.ts && node scripts/run-ts.mjs scripts/test-transcript-context.ts && node scripts/run-ts.mjs scripts/test-accounts.ts && node scripts/run-ts.mjs scripts/test-search.ts && node scripts/run-ts.mjs scripts/test-search-citations.ts && node scripts/run-ts.mjs scripts/test-web-fetch.ts && node scripts/run-ts.mjs scripts/test-reader-foundations.ts && node scripts/run-ts.mjs scripts/test-extra-tools-toggle.ts && node scripts/run-ts.mjs scripts/test-fetch-tool-toggle.ts && node scripts/run-ts.mjs scripts/test-provider-registration.ts && node scripts/run-ts.mjs scripts/test-stream-recovery.ts && node scripts/run-ts.mjs scripts/test-enterprise-and-capacity.ts",
44
+ "smoke:fetch": "node scripts/run-ts.mjs scripts/smoke-web-fetch.mjs",
43
45
  "smoke:tools": "node scripts/run-ts.mjs scripts/smoke-tool-schema.ts",
44
46
  "smoke:models": "node scripts/run-ts.mjs scripts/smoke-all-models.mjs",
45
47
  "audit": "yarn npm audit --environment production --recursive && yarn npm audit --severity high --all --recursive",
@@ -49,6 +51,7 @@
49
51
  "extensions": [
50
52
  "./src/index.ts",
51
53
  "./src/features/google-search.ts",
54
+ "./src/features/read-url-content.ts",
52
55
  "./src/features/generate-image.ts"
53
56
  ]
54
57
  },
@@ -58,21 +61,27 @@
58
61
  "typebox": "*"
59
62
  },
60
63
  "devDependencies": {
61
- "@earendil-works/pi-ai": "^0.86.1",
62
- "@earendil-works/pi-coding-agent": "^0.86.1",
64
+ "@earendil-works/pi-ai": "^1.5.0",
65
+ "@earendil-works/pi-coding-agent": "^1.5.0",
63
66
  "@eslint/js": "^10.0.1",
64
67
  "@types/node": "^26.6.2",
68
+ "@types/turndown": "^5.0.6",
65
69
  "eslint": "^10.11.0",
66
70
  "eslint-config-prettier": "^10.1.8",
67
71
  "globals": "^17.7.0",
68
72
  "prettier": "^3.9.8",
73
+ "typebox": "^1.3.27",
69
74
  "typescript": "^6.0.3",
70
75
  "typescript-eslint": "^8.64.0"
71
76
  },
72
77
  "dependencies": {
78
+ "@mixmark-io/domino": "^2.2.0",
79
+ "turndown": "^7.2.4",
80
+ "turndown-plugin-gfm": "^1.0.2",
73
81
  "undici": "^8.12.3"
74
82
  },
75
83
  "resolutions": {
76
- "undici": "8.12.3"
84
+ "undici": "8.12.3",
85
+ "minimatch": "11.0.3"
77
86
  }
78
87
  }
@@ -60,10 +60,10 @@ export function endpointCandidates(): string[] {
60
60
  return explicit ? [assertSafeApiBaseUrl(explicit)] : ENDPOINT_FALLBACKS;
61
61
  }
62
62
 
63
- // Catalog visibility is gated on this version. 1.2.4 hides Gemini 4 Argon;
64
- // 1.4.0 is aligned with the current official agy CLI release (#93, #94, #97).
63
+ // Catalog visibility is gated on this version. 1.2.4 hides Gemini 4 Argon.
64
+ // 1.5.5 matches the current official agy CLI release (#122, #123).
65
65
  const DEFAULT_USER_AGENT =
66
- "antigravity/cli/1.4.0 (aidev_client; os_type=linux; arch=amd64; cl=982146307; auth_method=consumer)";
66
+ "antigravity/cli/1.5.5 (aidev_client; os_type=linux; arch=amd64; cl=982146307; auth_method=consumer)";
67
67
 
68
68
  /** Default User-Agent matching pure Antigravity CLI wire fingerprint. */
69
69
  export function defaultUserAgent(): string {
@@ -84,7 +84,7 @@ export function jsonOrTextError(text: string): string {
84
84
  const parsed = JSON.parse(text) as {
85
85
  error?: { message?: string; status?: string; code?: number };
86
86
  };
87
- if (parsed.error?.message) return parsed.error.message;
87
+ if (typeof parsed.error?.message === "string") return parsed.error.message;
88
88
  } catch {
89
89
  // not JSON
90
90
  }
@@ -96,14 +96,19 @@ export function parseApiKey(apiKeyRaw: string | undefined): AntigravityApiKey {
96
96
  throw new Error("No Antigravity OAuth credentials. Run /login antigravity.");
97
97
  }
98
98
  try {
99
- const parsed = JSON.parse(apiKeyRaw) as Partial<AntigravityApiKey>;
100
- if (!parsed.token || !parsed.projectId) throw new Error("missing token or projectId");
99
+ const parsed: unknown = JSON.parse(apiKeyRaw);
100
+ if (
101
+ !isRecord(parsed) ||
102
+ typeof parsed.token !== "string" ||
103
+ !/^[\x21-\x7e]+$/.test(parsed.token) ||
104
+ typeof parsed.projectId !== "string" ||
105
+ !/^[\x21-\x7e]+$/.test(parsed.projectId)
106
+ )
107
+ throw new Error("missing token or projectId");
101
108
  return { token: parsed.token, projectId: parsed.projectId };
102
- } catch (error) {
103
- throw new Error(
104
- `Invalid Antigravity credentials. Run /login antigravity. (${safeError(error)})`,
105
- { cause: error },
106
- );
109
+ } catch {
110
+ // JSON parser errors can quote the credential input. Do not retain that cause.
111
+ throw new Error("Invalid Antigravity credentials. Run /login antigravity.");
107
112
  }
108
113
  }
109
114
 
@@ -409,7 +414,7 @@ export function mergeAvailableModelsResults(
409
414
  const mergedModels: Record<string, unknown> = {};
410
415
  let defaultAgentModelId: string | undefined;
411
416
  let defaultAgentModel: string | undefined;
412
- let agentModelSorts: AvailableModelsRaw["agentModelSorts"];
417
+ const agentModelSortsSources: Array<NonNullable<AvailableModelsRaw["agentModelSorts"]>> = [];
413
418
  let lastEndpoint = "";
414
419
  let lastStatus = 0;
415
420
 
@@ -438,7 +443,9 @@ export function mergeAvailableModelsResults(
438
443
  defaultAgentModel = data.defaultAgentModel;
439
444
  }
440
445
  if (isRecord(data) && Array.isArray(data.agentModelSorts)) {
441
- agentModelSorts = data.agentModelSorts as AvailableModelsRaw["agentModelSorts"];
446
+ agentModelSortsSources.push(
447
+ data.agentModelSorts as NonNullable<AvailableModelsRaw["agentModelSorts"]>,
448
+ );
442
449
  }
443
450
  }
444
451
 
@@ -455,11 +462,53 @@ export function mergeAvailableModelsResults(
455
462
  models: mergedModels as AvailableModelsRaw["models"],
456
463
  defaultAgentModelId,
457
464
  defaultAgentModel,
458
- agentModelSorts,
465
+ agentModelSorts: mergeAgentModelSorts(agentModelSortsSources),
459
466
  },
460
467
  };
461
468
  }
462
469
 
470
+ /**
471
+ * Union the curated `agentModelSorts` recommendation lists from every endpoint.
472
+ * New models roll out on the daily/sandbox endpoints before production (e.g.
473
+ * Gemini 4 Carbon, #123); a last-endpoint-wins merge lets the production list
474
+ * hide models the other endpoints already recommend, while the merged `models`
475
+ * dictionary above is a union. Sorts are matched by `displayName` and groups by
476
+ * position; first-seen order wins so the primary endpoint keeps its ranking.
477
+ */
478
+ function mergeAgentModelSorts(
479
+ sources: Array<NonNullable<AvailableModelsRaw["agentModelSorts"]>>,
480
+ ): AvailableModelsRaw["agentModelSorts"] {
481
+ if (sources.length === 0) return undefined;
482
+ const seen = new Set<string>();
483
+ const merged: Array<{ displayName?: unknown; groups: Array<{ modelIds: string[] }> }> = [];
484
+ for (const sorts of sources) {
485
+ for (const sort of sorts) {
486
+ if (!isRecord(sort)) continue;
487
+ const displayName = typeof sort.displayName === "string" ? sort.displayName : undefined;
488
+ let target = merged.find((entry) => entry.displayName === displayName);
489
+ if (!target) {
490
+ target = { ...(displayName !== undefined ? { displayName } : {}), groups: [] };
491
+ merged.push(target);
492
+ }
493
+ const groups = Array.isArray(sort.groups) ? sort.groups : [];
494
+ groups.forEach((group, index) => {
495
+ let targetGroup = target.groups[index];
496
+ if (!targetGroup) {
497
+ targetGroup = { modelIds: [] };
498
+ target.groups[index] = targetGroup;
499
+ }
500
+ const modelIds = isRecord(group) && Array.isArray(group.modelIds) ? group.modelIds : [];
501
+ for (const id of modelIds) {
502
+ if (typeof id !== "string" || !id || seen.has(id)) continue;
503
+ seen.add(id);
504
+ targetGroup.modelIds.push(id);
505
+ }
506
+ });
507
+ }
508
+ }
509
+ return merged.length > 0 ? merged : undefined;
510
+ }
511
+
463
512
  /**
464
513
  * Merge fetchAvailableModels across endpoint candidates so daily/sandbox-only
465
514
  * models appear alongside production catalog entries.