@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,150 @@
1
+ /**
2
+ * Gemini Enterprise routing.
3
+ *
4
+ * Consumer prompts stay on cloudcode-pa. A regional enterprise license (error
5
+ * #3501) must not fall back there: Google documents separate Business AI Code
6
+ * hosts, and a consumer URL both fails the license check and leaves the
7
+ * configured region. Inference is sent only to the host for the selected
8
+ * location, using the enterprise generate path:
9
+ * /v1beta/projects/{project}/locations/{location}:streamGenerateContent
10
+ * The body keeps the Gemini request fields and names the license tier. Unknown
11
+ * consumer envelope fields are dropped because the enterprise API rejects them.
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { homedir } from "node:os";
15
+ import { join } from "node:path";
16
+ import type { AntigravityGenerateRequest } from "../types/types.js";
17
+ import { antigravityEnv, isRecord } from "../utils/util.js";
18
+
19
+ const LOCATIONS = ["global", "us", "eu"] as const;
20
+ export type EnterpriseLocation = (typeof LOCATIONS)[number];
21
+
22
+ const PROJECT_ID = /^[a-z][a-z0-9-]{4,28}[a-z0-9]$/;
23
+ const USER_TIER = /^[a-z0-9][a-z0-9._-]{0,80}$/;
24
+
25
+ export type EnterpriseTarget = {
26
+ location: EnterpriseLocation;
27
+ projectId: string;
28
+ userTier: string;
29
+ host: string;
30
+ };
31
+
32
+ export function enterpriseHost(location: EnterpriseLocation): string {
33
+ if (location === "global") return "https://businessaicode.googleapis.com";
34
+ return `https://businessaicode.${location}.rep.googleapis.com`;
35
+ }
36
+
37
+ export function enterpriseStreamUrl(target: EnterpriseTarget): string {
38
+ const project = encodeURIComponent(target.projectId);
39
+ return `${target.host}/v1beta/projects/${project}/locations/${target.location}:streamGenerateContent?alt=sse`;
40
+ }
41
+
42
+ function truthy(value: string | undefined): boolean {
43
+ return !!value && ["1", "true", "yes", "on"].includes(value.trim().toLowerCase());
44
+ }
45
+
46
+ function stringField(record: Record<string, unknown> | undefined, key: string): string {
47
+ const value = record?.[key];
48
+ return typeof value === "string" ? value.trim() : "";
49
+ }
50
+
51
+ function readCliSettings(): Record<string, unknown> | undefined {
52
+ const path = join(homedir(), ".gemini", "antigravity-cli", "settings.json");
53
+ if (!existsSync(path)) return undefined;
54
+ try {
55
+ const parsed = JSON.parse(readFileSync(path, "utf8")) as unknown;
56
+ return isRecord(parsed) ? parsed : undefined;
57
+ } catch {
58
+ return undefined;
59
+ }
60
+ }
61
+
62
+ function licenseRecord(
63
+ settings: Record<string, unknown> | undefined,
64
+ ): Record<string, unknown> | undefined {
65
+ const license = settings?.selectedLicense ?? settings?.license;
66
+ return isRecord(license) ? license : undefined;
67
+ }
68
+
69
+ /**
70
+ * Resolve an explicit enterprise target, or undefined for the consumer path.
71
+ * `eu` / `us` (and `ANTIGRAVITY_ENTERPRISE=1`) never silently use cloudcode-pa.
72
+ */
73
+ export function resolveEnterpriseTarget(): EnterpriseTarget | undefined {
74
+ const settings = readCliSettings();
75
+ const license = licenseRecord(settings);
76
+ const forced = truthy(antigravityEnv("ENTERPRISE"));
77
+ const locationRaw = (
78
+ antigravityEnv("LOCATION") ||
79
+ stringField(settings, "location") ||
80
+ stringField(license, "location") ||
81
+ (forced ? process.env.GOOGLE_CLOUD_LOCATION || "global" : "")
82
+ )
83
+ .trim()
84
+ .toLowerCase();
85
+
86
+ if (locationRaw && !LOCATIONS.includes(locationRaw as EnterpriseLocation)) {
87
+ throw new Error("ANTIGRAVITY_LOCATION must be global, us, or eu. The prompt was not sent.");
88
+ }
89
+
90
+ const regional = locationRaw === "eu" || locationRaw === "us";
91
+ if (!regional && !forced) return undefined;
92
+
93
+ const location = (locationRaw || "global") as EnterpriseLocation;
94
+ const projectId =
95
+ antigravityEnv("ENTERPRISE_PROJECT")?.trim() ||
96
+ stringField(settings, "project") ||
97
+ stringField(settings, "projectId") ||
98
+ stringField(settings, "licenseProject") ||
99
+ stringField(license, "project") ||
100
+ stringField(license, "projectId");
101
+ const userTier =
102
+ antigravityEnv("USER_TIER")?.trim() ||
103
+ stringField(settings, "userTier") ||
104
+ stringField(settings, "entitlementTier") ||
105
+ stringField(license, "userTier") ||
106
+ stringField(license, "tier");
107
+
108
+ if (!PROJECT_ID.test(projectId)) {
109
+ throw new Error(
110
+ "Gemini Enterprise routing needs ANTIGRAVITY_ENTERPRISE_PROJECT set to the license's Google Cloud project id. Refusing to send this prompt to the consumer endpoint.",
111
+ );
112
+ }
113
+ if (!USER_TIER.test(userTier)) {
114
+ throw new Error(
115
+ "Gemini Enterprise routing needs ANTIGRAVITY_USER_TIER from the selected license (for example the tier id shown by agy). Refusing to send this prompt to the consumer endpoint.",
116
+ );
117
+ }
118
+
119
+ return { location, projectId, userTier, host: enterpriseHost(location) };
120
+ }
121
+
122
+ export function describeEnterpriseRouting(): string {
123
+ try {
124
+ const target = resolveEnterpriseTarget();
125
+ if (!target) return "consumer";
126
+ return `enterprise location=${target.location} host=${target.host} project=${target.projectId}`;
127
+ } catch (error) {
128
+ const message = error instanceof Error ? error.message : "invalid enterprise configuration";
129
+ return `enterprise misconfigured (${message})`;
130
+ }
131
+ }
132
+
133
+ /** Allowlisted enterprise generate body. Drops the consumer envelope. */
134
+ export function toEnterpriseGenerateBody(
135
+ payload: AntigravityGenerateRequest,
136
+ target: EnterpriseTarget,
137
+ ): Record<string, unknown> {
138
+ const request = payload.request;
139
+ const body: Record<string, unknown> = {
140
+ contents: request.contents,
141
+ aicode: { experience: payload.model },
142
+ entitlement: { userTier: target.userTier },
143
+ };
144
+ if (request.systemInstruction) body.systemInstruction = request.systemInstruction;
145
+ if (request.tools) body.tools = request.tools;
146
+ if (request.toolConfig) body.toolConfig = request.toolConfig;
147
+ if (request.generationConfig) body.generationConfig = request.generationConfig;
148
+ if (request.labels) body.labels = request.labels;
149
+ return body;
150
+ }
@@ -1 +1,2 @@
1
1
  export * from "./client.js";
2
+ export * from "./enterprise.js";
@@ -1,5 +1,6 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { redactSecrets, stripValidationUrls } from "../utils/security.js";
3
+ import { cleanText } from "../utils/text.js";
3
4
 
4
5
  export type DiagnosticsSnapshot = {
5
6
  status?: number;
@@ -13,6 +14,7 @@ export type DiagnosticsSnapshot = {
13
14
  maskedEmail?: string;
14
15
  tokenExpiry?: string;
15
16
  toolSchemaWarnings?: string;
17
+ fetchTrace?: string;
16
18
  };
17
19
 
18
20
  const storage = new AsyncLocalStorage<DiagnosticsSnapshot>();
@@ -53,6 +55,11 @@ export function getCurrentAvailableModels(): string | undefined {
53
55
  return currentBag().availableModels;
54
56
  }
55
57
 
58
+ /** The bounded fetch history survives a small model-facing details budget. */
59
+ export function setLastFetchTrace(trace: string): void {
60
+ currentBag().fetchTrace = cleanText(stripValidationUrls(redactSecrets(trace)), 6_000);
61
+ }
62
+
56
63
  export function setLastStatus(status: number | undefined): void {
57
64
  currentBag().status = status;
58
65
  }
@@ -3,7 +3,12 @@
3
3
  * Disable this extension resource in `pi config` to keep the Antigravity provider
4
4
  * and `/antigravity.image` without registering `generate_image`.
5
5
  */
6
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import { readFile, realpath } from "node:fs/promises";
7
+ import { isAbsolute, relative, resolve, sep } from "node:path";
8
+ import {
9
+ detectSupportedImageMimeTypeFromFile,
10
+ type ExtensionAPI,
11
+ } from "@earendil-works/pi-coding-agent";
7
12
  import { Type } from "typebox";
8
13
  import {
9
14
  DEFAULT_IMAGE_MODEL,
@@ -19,7 +24,7 @@ export default function (pi: ExtensionAPI): void {
19
24
  name: "generate_image",
20
25
  label: "Generate image",
21
26
  description:
22
- "Generate an image via Antigravity using the signed-in Google account. Saves under .pi/generated-images/ unless path is set.",
27
+ "Generate an image via Antigravity using the signed-in Google account, optionally guided by local reference images. Saves under .pi/generated-images/ unless path is set.",
23
28
  promptSnippet: "Generate images via Antigravity OAuth (Gemini image models)",
24
29
  promptGuidelines: [
25
30
  "Use generate_image when the user asks to create, draw, or generate an image.",
@@ -37,6 +42,14 @@ export default function (pi: ExtensionAPI): void {
37
42
  description: `Image model id. Default: ${DEFAULT_IMAGE_MODEL}.`,
38
43
  }),
39
44
  ),
45
+ referenceImages: Type.Optional(
46
+ Type.Array(
47
+ Type.String({
48
+ description: "Project-relative reference image path (PNG, JPEG, WebP, or GIF).",
49
+ }),
50
+ { description: "Reference images to send alongside the prompt." },
51
+ ),
52
+ ),
40
53
  path: Type.Optional(
41
54
  Type.String({
42
55
  description: "Project-relative file or directory to save the image.",
@@ -48,6 +61,46 @@ export default function (pi: ExtensionAPI): void {
48
61
  if (!apiKey) {
49
62
  throw new Error("No Antigravity credentials. Run /login antigravity first.");
50
63
  }
64
+ const inputImages = [];
65
+ const MAX_REFERENCE_IMAGES = 4;
66
+ const MAX_REFERENCE_BYTES = 10 * 1024 * 1024;
67
+ if (params.referenceImages && params.referenceImages.length > MAX_REFERENCE_IMAGES) {
68
+ throw new Error(`At most ${MAX_REFERENCE_IMAGES} reference images are allowed.`);
69
+ }
70
+ if (params.referenceImages?.length) {
71
+ const root = await realpath(ctx.cwd);
72
+ for (const imagePath of params.referenceImages) {
73
+ const target = await realpath(resolve(root, imagePath));
74
+ const rel = relative(root, target);
75
+ if (
76
+ isAbsolute(imagePath) ||
77
+ !rel ||
78
+ rel === ".." ||
79
+ rel.startsWith(`..${sep}`) ||
80
+ isAbsolute(rel)
81
+ ) {
82
+ throw new Error(
83
+ "Reference image paths must be project-relative and inside the working directory.",
84
+ );
85
+ }
86
+ const mimeType = await detectSupportedImageMimeTypeFromFile(target);
87
+ if (
88
+ !mimeType ||
89
+ !["image/png", "image/jpeg", "image/webp", "image/gif"].includes(mimeType)
90
+ ) {
91
+ throw new Error(
92
+ `Unsupported reference image: ${imagePath}. Use PNG, JPEG, WebP, or GIF.`,
93
+ );
94
+ }
95
+ const data = await readFile(target, { signal });
96
+ if (data.byteLength > MAX_REFERENCE_BYTES) {
97
+ throw new Error(
98
+ `Reference image is too large: ${imagePath}. Each reference must be at most 10 MB.`,
99
+ );
100
+ }
101
+ inputImages.push({ data: data.toString("base64"), mimeType });
102
+ }
103
+ }
51
104
  onUpdate?.({ content: [{ type: "text", text: "Generating image…" }], details: {} });
52
105
  const result = await generateAntigravityImage({
53
106
  apiKey,
@@ -56,6 +109,7 @@ export default function (pi: ExtensionAPI): void {
56
109
  aspectRatio: params.aspectRatio,
57
110
  model: params.model,
58
111
  path: params.path,
112
+ inputImages,
59
113
  signal,
60
114
  });
61
115
  const notes = result.text.join(" ").trim();
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Optional model-facing web fetch tool.
3
+ * Disable this extension resource in `pi config` to keep the Antigravity provider
4
+ * and `/antigravity.fetch` without registering `read_url_content`.
5
+ */
6
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
+ import { Type } from "typebox";
8
+ import { isExtraToolEnabled, redactSecrets } from "../utils/index.js";
9
+ import {
10
+ executeAntigravityWebFetch,
11
+ formatWebFetchHeader,
12
+ formatWebFetchResult,
13
+ resolveMaxChars,
14
+ discardSavedPage,
15
+ savePage,
16
+ savedPageNote,
17
+ type SavedPage,
18
+ validateFetchTarget,
19
+ withSavedCopy,
20
+ } from "../web-fetch/index.js";
21
+
22
+ export default function (pi: Pick<ExtensionAPI, "registerTool">): void {
23
+ if (!isExtraToolEnabled("FETCH")) return;
24
+ pi.registerTool({
25
+ name: "read_url_content",
26
+ label: "Read URL Content",
27
+ description:
28
+ "Read a public web page through Google's Antigravity crawler and return it as markdown. Use it for documentation, articles, changelogs, and standards pages when search snippets are not enough. The crawl runs on Google's side: no JavaScript execution, no cookies, and no pages behind a login — for those, ask the user to open the page in their browser.",
29
+ promptSnippet: "Read a public web page as markdown via the Antigravity crawler",
30
+ promptGuidelines: [
31
+ "Use read_url_content when you have a specific URL whose contents you need, instead of guessing from a search result summary.",
32
+ "One URL per call, and prefer the page that holds the answer over a site root or a category index.",
33
+ "Long pages return their beginning and save the full page to a local file; read or search that file instead of fetching the URL again.",
34
+ "It cannot log in, run JavaScript, or read local and private addresses, so do not use it for those.",
35
+ ],
36
+ parameters: Type.Object({
37
+ url: Type.String({ description: "Public http(s) URL to fetch." }),
38
+ }),
39
+ async execute(_toolCallId, params, signal, onUpdate, ctx) {
40
+ if (signal?.aborted) throw new Error("Web fetch aborted");
41
+ const maxChars = resolveMaxChars();
42
+ try {
43
+ const url = validateFetchTarget(params.url);
44
+ const apiKey = await ctx.modelRegistry.getApiKeyForProvider("antigravity");
45
+ if (!apiKey) throw new Error("No Antigravity credentials. Run /login antigravity first.");
46
+ if (signal?.aborted) throw new Error("Web fetch aborted");
47
+ onUpdate?.({
48
+ content: [{ type: "text", text: `Reading ${redactSecrets(url)}…` }],
49
+ details: {},
50
+ });
51
+ const result = await executeAntigravityWebFetch({ apiKey, url, signal });
52
+ if (signal?.aborted) throw new Error("Web fetch aborted");
53
+ const attempts: Array<{
54
+ source: string;
55
+ outcome: string;
56
+ url?: string;
57
+ stage?: string;
58
+ endpoint?: string;
59
+ }> = [...(result.attempts ?? [])];
60
+ const details = {
61
+ source: result.source,
62
+ bytes: result.bytes,
63
+ truncated: false,
64
+ partial: result.partial,
65
+ assessment: result.assessment,
66
+ representationUrl: result.representationUrl
67
+ ? redactSecrets(result.representationUrl)
68
+ : undefined,
69
+ attempts,
70
+ omittedAttempts: 0,
71
+ fullOutputPath: undefined as string | undefined,
72
+ };
73
+ const detailsBudget = Math.floor(maxChars * 0.4);
74
+ const size = () => JSON.stringify(details).length;
75
+ while (size() > detailsBudget && details.attempts.length > 1) {
76
+ details.attempts.shift();
77
+ details.omittedAttempts += 1;
78
+ }
79
+ if (size() > detailsBudget && details.attempts.length === 1) {
80
+ const last = details.attempts[0];
81
+ details.attempts = [{ source: last.source, stage: last.stage, outcome: last.outcome }];
82
+ }
83
+ if (size() > detailsBudget) details.representationUrl = undefined;
84
+ if (size() > detailsBudget && details.attempts.length) {
85
+ details.attempts = [];
86
+ details.omittedAttempts += 1;
87
+ }
88
+ const full = result.content;
89
+ const captured = { ...result, maxChars: maxChars - size() };
90
+ let footer = "";
91
+ let saved: SavedPage | undefined;
92
+ if (formatWebFetchHeader(captured).length + full.length > captured.maxChars) {
93
+ // Pi's convention for long tool output: show the start, keep the whole on disk.
94
+ saved = await savePage(formatWebFetchHeader(result) + full, "md");
95
+ footer = savedPageNote(saved, full.length);
96
+ if (saved.ok) details.fullOutputPath = saved.path;
97
+ details.truncated = true;
98
+ // The path is part of details too, so charge it before formatting.
99
+ captured.maxChars = maxChars - size();
100
+ }
101
+ let text: string;
102
+ try {
103
+ if (signal?.aborted) throw new Error("Web fetch aborted");
104
+ text = formatWebFetchResult(captured, footer);
105
+ } catch (error) {
106
+ // No answer will name the file, so leave none behind.
107
+ if (saved) await discardSavedPage(saved);
108
+ throw error;
109
+ }
110
+ return {
111
+ content: [{ type: "text", text }],
112
+ details,
113
+ };
114
+ } catch (caught) {
115
+ const error = await withSavedCopy(caught);
116
+ const msg = error instanceof Error ? error.message : String(error);
117
+ // Error causes can retain request objects and response text; keep only a redacted message.
118
+ const safe = redactSecrets(msg);
119
+ // eslint-disable-next-line preserve-caught-error -- the raw cause can retain request/response bodies
120
+ throw new Error(safe, { cause: new Error(safe) });
121
+ }
122
+ },
123
+ });
124
+ }
@@ -8,7 +8,9 @@ import {
8
8
  jsonOrTextError,
9
9
  parseApiKey,
10
10
  } from "../client/client.js";
11
+ import { resolveEnterpriseTarget } from "../client/enterprise.js";
11
12
  import { AntigravityRequestType, AntigravityUserAgent, GeminiRole } from "../types/enums.js";
13
+ import { isCreditsEnabled } from "../utils/credits.js";
12
14
  import { antigravityFetch } from "../utils/http.js";
13
15
  import { safeError } from "../utils/security.js";
14
16
  import { sanitizeText } from "../utils/util.js";
@@ -51,6 +53,7 @@ export type ImageGenerateRequest = {
51
53
  requestType: "image_gen";
52
54
  userAgent: "antigravity";
53
55
  requestId: string;
56
+ enabledCreditTypes?: string[];
54
57
  };
55
58
 
56
59
  export type ImageCommandArgs = {
@@ -63,6 +66,7 @@ export type ImageCommandArgs = {
63
66
  export type GenerateImageOptions = ImageCommandArgs & {
64
67
  apiKey: string;
65
68
  cwd: string;
69
+ inputImages?: GeneratedImage[];
66
70
  signal?: AbortSignal;
67
71
  };
68
72
 
@@ -178,7 +182,7 @@ export function buildImageGenerateRequest(
178
182
  aspectRatio: string,
179
183
  inputImages: GeneratedImage[] = [],
180
184
  ): ImageGenerateRequest {
181
- return {
185
+ const req: ImageGenerateRequest = {
182
186
  project: projectId,
183
187
  model,
184
188
  request: {
@@ -200,6 +204,10 @@ export function buildImageGenerateRequest(
200
204
  userAgent: AntigravityUserAgent.Antigravity,
201
205
  requestId: `image_gen/${Date.now()}/${randomUUID()}/1`,
202
206
  };
207
+ if (isCreditsEnabled()) {
208
+ req.enabledCreditTypes = ["GOOGLE_ONE_AI"];
209
+ }
210
+ return req;
203
211
  }
204
212
 
205
213
  function collectImagesFromParts(
@@ -333,11 +341,17 @@ export async function writeImage(
333
341
 
334
342
  /** Generates in-memory content shared by the native API and file-saving wrapper. */
335
343
  export async function generateAntigravityImageContent(
336
- options: Omit<GenerateImageOptions, "cwd" | "path"> & { inputImages?: GeneratedImage[] },
344
+ options: Omit<GenerateImageOptions, "cwd" | "path">,
337
345
  ): Promise<Omit<GenerateImageResult, "savedPaths">> {
338
346
  const prompt = options.prompt.trim();
339
347
  if (!prompt && !options.inputImages?.length)
340
348
  throw new Error("Image prompt or input image is required.");
349
+ const enterprise = resolveEnterpriseTarget();
350
+ if (enterprise) {
351
+ throw new Error(
352
+ `Image generation is not sent while Gemini Enterprise routing is active (location=${enterprise.location}). Google documents image generation on the global deployment only, and this extension does not upload prompts or reference images to a second host.`,
353
+ );
354
+ }
341
355
  if (prompt.length > MAX_PROMPT_CHARS) {
342
356
  throw new Error(`Image prompt is too long (max ${MAX_PROMPT_CHARS} characters).`);
343
357
  }
@@ -22,6 +22,19 @@ import { DEFAULT_ENDPOINT } from "./client/index.js";
22
22
  import { getLastDiagnostics, runWithDiagnostics } from "./diagnostics/index.js";
23
23
  import { generateAntigravityImage, parseImageCommandArgs } from "./image/index.js";
24
24
  import { executeAntigravitySearch, parseSearchCommandArgs } from "./search/index.js";
25
+ import {
26
+ executeAntigravityWebFetch,
27
+ discardSavedPage,
28
+ formatWebFetchHeader,
29
+ formatWebFetchResult,
30
+ looksLikeHtml,
31
+ parseFetchCommandArgs,
32
+ savePage,
33
+ savedPageNote,
34
+ type SavedPage,
35
+ withSavedCopy,
36
+ validateFetchTarget,
37
+ } from "./web-fetch/index.js";
25
38
  import {
26
39
  applyAntigravityCatalog,
27
40
  discoverAntigravityModels,
@@ -34,11 +47,19 @@ import {
34
47
  import { ANTIGRAVITY_API, streamAntigravity } from "./stream/index.js";
35
48
  import {
36
49
  fetchAccountUsage,
50
+ fetchRemainingCredits,
37
51
  formatModelsList,
38
52
  formatUsageSummary,
39
53
  resolveApiKeyFromContext,
40
54
  } from "./usage/index.js";
41
- import { redactSecrets, maskEmail } from "./utils/index.js";
55
+ import {
56
+ getCreditsStatus,
57
+ isCreditsEnabled,
58
+ setCreditsEnabled,
59
+ redactSecrets,
60
+ maskEmail,
61
+ } from "./utils/index.js";
62
+ import { describeEnterpriseRouting } from "./client/enterprise.js";
42
63
 
43
64
  /**
44
65
  * Pi's interactive `notify` writes into the chat transcript. `console.log` in that
@@ -246,6 +267,71 @@ export default function (pi: ExtensionAPI): void {
246
267
  },
247
268
  });
248
269
 
270
+ pi.registerCommand("antigravity.credits", {
271
+ description: "Check remaining AI credits or toggle overages (/antigravity.credits [on|off])",
272
+ handler: async (args, ctx) => {
273
+ const mode = args.trim().toLowerCase();
274
+ try {
275
+ if (mode === "on" || mode === "enable" || mode === "true" || mode === "1") {
276
+ setCreditsEnabled(true);
277
+ emitCommandOutput(
278
+ ctx,
279
+ "Antigravity AI credit overages: ENABLED.\nRequests will supply enabledCreditTypes: ['GOOGLE_ONE_AI'] to use credit balance when standard quota is exhausted.",
280
+ "info",
281
+ );
282
+ return;
283
+ }
284
+ if (mode === "off" || mode === "disable" || mode === "false" || mode === "0") {
285
+ setCreditsEnabled(false);
286
+ emitCommandOutput(
287
+ ctx,
288
+ "Antigravity AI credit overages: DISABLED.\nRequests will not tap into AI credits.",
289
+ "info",
290
+ );
291
+ return;
292
+ }
293
+
294
+ const apiKey = await resolveApiKeyFromContext(ctx);
295
+ const status = getCreditsStatus();
296
+
297
+ let creditsInfo: Awaited<ReturnType<typeof fetchRemainingCredits>> | undefined;
298
+ if (apiKey) {
299
+ try {
300
+ creditsInfo = await fetchRemainingCredits(apiKey);
301
+ } catch {
302
+ // best effort
303
+ }
304
+ }
305
+
306
+ const lines: string[] = [];
307
+ if (creditsInfo?.planLabel) {
308
+ lines.push(creditsInfo.planLabel);
309
+ }
310
+
311
+ if (creditsInfo?.availableCredits && creditsInfo.availableCredits.length > 0) {
312
+ for (const c of creditsInfo.availableCredits) {
313
+ const amt = c.creditAmount !== undefined ? c.creditAmount.toLocaleString() : "0";
314
+ const typ = c.creditType || "GOOGLE_ONE_AI";
315
+ lines.push(`Remaining AI Credits: ${amt} (${typ})`);
316
+ }
317
+ } else {
318
+ lines.push("Remaining AI Credits: 0 (or not reported by subscription)");
319
+ }
320
+
321
+ lines.push(`AI Credit Overages: ${status.enabled ? "ENABLED" : "DISABLED"}`);
322
+ lines.push("");
323
+ lines.push("Usage:");
324
+ lines.push(" /antigravity.credits on - Enable AI credits overage on quota exhaustion");
325
+ lines.push(" /antigravity.credits off - Disable AI credits overage");
326
+
327
+ emitCommandOutput(ctx, lines.join("\n"), "info");
328
+ } catch (error) {
329
+ const msg = error instanceof Error ? error.message : String(error);
330
+ emitCommandOutput(ctx, `Failed to query or update credit settings: ${msg}`, "error");
331
+ }
332
+ },
333
+ });
334
+
249
335
  pi.registerCommand("antigravity.refresh", {
250
336
  description: "Force refresh Antigravity dynamic model catalog",
251
337
  handler: async (_args, ctx) => {
@@ -313,12 +399,15 @@ export default function (pi: ExtensionAPI): void {
313
399
  `lastProjectId=${d.projectId || "none"}`,
314
400
  `linkedAccounts=${accounts.length || "none"}`,
315
401
  `activeAccount=${activeLabel || "none"}`,
402
+ `aiCreditOverages=${isCreditsEnabled() ? "enabled" : "disabled"}`,
403
+ `routing=${describeEnterpriseRouting()}`,
316
404
  ...(d.latencyMs !== undefined ? [`lastLatencyMs=${d.latencyMs}`] : []),
317
405
  `toolSchemaWarnings=${d.toolSchemaWarnings || "none"}`,
406
+ ...(d.fetchTrace ? [`lastFetch=${d.fetchTrace}`] : []),
318
407
  `lastError=${d.error ? redactSecrets(d.error) : "none"}`,
319
408
  "transport=native-streamSimple",
320
409
  "runtimeCli=not-used",
321
- "commands=/antigravity.usage /antigravity.models /antigravity.accounts /antigravity.refresh /antigravity.doctor /antigravity.image /antigravity.search",
410
+ "commands=/antigravity.usage /antigravity.models /antigravity.accounts /antigravity.credits /antigravity.refresh /antigravity.doctor /antigravity.image /antigravity.search /antigravity.fetch",
322
411
  ];
323
412
  emitCommandOutput(ctx, `Antigravity doctor\n${lines.join("\n")}`);
324
413
  },
@@ -401,4 +490,58 @@ export default function (pi: ExtensionAPI): void {
401
490
  }
402
491
  },
403
492
  });
493
+
494
+ pi.registerCommand("antigravity.fetch", {
495
+ description:
496
+ "Read a public web page via the Antigravity crawler (usage: /antigravity.fetch [--raw] <url>)",
497
+ handler: async (args, ctx) => {
498
+ const parsed = parseFetchCommandArgs(args || "");
499
+ if (!parsed.url) {
500
+ emitCommandOutput(ctx, "Usage: /antigravity.fetch [--raw] <url>", "warning");
501
+ return;
502
+ }
503
+ try {
504
+ const url = validateFetchTarget(parsed.url);
505
+ const apiKey = await resolveApiKeyFromContext(ctx);
506
+ if (!apiKey) {
507
+ emitCommandOutput(
508
+ ctx,
509
+ "No Antigravity credentials. Run /login antigravity first.",
510
+ "warning",
511
+ );
512
+ return;
513
+ }
514
+ if (ctx.hasUI) ctx.ui.notify("Reading page via Antigravity…", "info");
515
+ const result = await executeAntigravityWebFetch({
516
+ apiKey,
517
+ url,
518
+ raw: parsed.raw,
519
+ });
520
+ const whole = result.content;
521
+ let footer = "";
522
+ let saved: SavedPage | undefined;
523
+ if (formatWebFetchHeader(result).length + whole.length > (result.maxChars ?? 0)) {
524
+ // Raw output is the crawled source itself; converted output keeps its provenance.
525
+ saved = parsed.raw
526
+ ? await savePage(whole, looksLikeHtml(whole) ? "html" : "txt")
527
+ : await savePage(formatWebFetchHeader(result) + whole, "md");
528
+ footer = savedPageNote(saved, whole.length, "Open it to read the rest.");
529
+ }
530
+ try {
531
+ emitCommandOutput(ctx, formatWebFetchResult(result, footer));
532
+ } catch (error) {
533
+ if (saved) await discardSavedPage(saved);
534
+ throw error;
535
+ }
536
+ } catch (caught) {
537
+ const error = await withSavedCopy(caught);
538
+ const msg = error instanceof Error ? error.message : String(error);
539
+ const guidance = msg.replace(
540
+ "Do not retry this URL with read_url_content. If permitted, use an available download tool or terminal to download it directly, then read the local file with a PDF reader.",
541
+ "If you have permission, download the URL directly and open the local file with a PDF reader.",
542
+ );
543
+ emitCommandOutput(ctx, redactSecrets(guidance), "warning");
544
+ }
545
+ },
546
+ });
404
547
  }
@@ -6,10 +6,9 @@ import type {
6
6
  ModelsStoreEntry,
7
7
  RefreshModelsContext,
8
8
  } from "@earendil-works/pi-ai";
9
- import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
10
9
  import { getApiKey } from "../auth/index.js";
11
10
  import { DEFAULT_ENDPOINT, fetchAvailableModelsCatalog, parseApiKey } from "../client/index.js";
12
- import { ANTIGRAVITY_API } from "../types/types.js";
11
+ import { ANTIGRAVITY_API, type AntigravityModelConfig } from "../types/types.js";
13
12
  import { antigravityEnv, isRecord } from "../utils/util.js";
14
13
  import { buildAntigravityCatalog, resolvedCatalog, type AntigravityCatalog } from "./grouping.js";
15
14
  import {
@@ -78,7 +77,7 @@ export async function discoverAntigravityModels(
78
77
 
79
78
  export async function refreshAntigravityModels(
80
79
  context: RefreshModelsContext,
81
- ): Promise<ProviderModelConfig[]> {
80
+ ): Promise<AntigravityModelConfig[]> {
82
81
  const checkedAt = hydrateAntigravityCatalog(context.stored);
83
82
  const current = getCurrentAntigravityCatalog();
84
83
  if (!context.allowNetwork) return current.models;
@@ -167,7 +166,7 @@ function apiKeyFromCredential(credential: Credential | undefined): string | unde
167
166
  return undefined;
168
167
  }
169
168
 
170
- function toStoredModels(models: ProviderModelConfig[]): Model<Api>[] {
169
+ function toStoredModels(models: AntigravityModelConfig[]): Model<Api>[] {
171
170
  return models.map((model) => ({
172
171
  ...model,
173
172
  api: ANTIGRAVITY_API,