@herbertgao/pi-extensions 2026.11.10 → 2026.11.12

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 (296) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +10 -10
  3. package/THIRD_PARTY_NOTICES.md +3 -3
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +16 -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 +73 -47
  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 +79 -18
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +0 -5
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +18 -4
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
  19. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  20. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +12 -0
  21. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  22. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  23. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +4 -2
  24. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +2 -2
  25. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
  26. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.md +12 -1
  27. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.native.md +4 -0
  28. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
  29. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +13 -505
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/distill.md +1 -1
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/document.md +3 -1
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/foundations.md +44 -0
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
  37. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live-setup.md +1 -1
  38. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +26 -12
  39. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
  40. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
  41. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +9 -37
  42. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/onboard.md +7 -6
  43. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/overdrive.md +2 -2
  44. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/quieter.md +1 -1
  45. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
  46. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/visualize.md +1 -1
  47. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  48. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  49. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +69 -16
  50. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +55 -7
  51. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +51 -22
  52. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  53. package/node_modules/@herbertgao/pi-subagents/README.md +27 -9
  54. package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +11 -11
  55. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  56. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +13 -0
  57. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +51 -32
  58. package/node_modules/@herbertgao/pi-subagents/src/default-agents.ts +7 -0
  59. package/node_modules/@herbertgao/pi-subagents/src/index.ts +334 -893
  60. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +4 -1
  61. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +13 -0
  62. package/node_modules/@herbertgao/pi-subagents/src/schedule-store.ts +18 -13
  63. package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +25 -5
  64. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +215 -69
  65. package/node_modules/@herbertgao/pi-subagents/src/types.ts +17 -0
  66. package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +9 -0
  67. package/node_modules/@herbertgao/pi-subagents/src/ui/agents-menu.ts +705 -0
  68. package/node_modules/@herbertgao/pi-subagents/src/ui/settings-menu.ts +361 -0
  69. package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +1 -1
  70. package/node_modules/pi-antigravity/README.md +58 -9
  71. package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
  72. package/node_modules/pi-antigravity/package.json +15 -6
  73. package/node_modules/pi-antigravity/src/client/client.ts +63 -14
  74. package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
  75. package/node_modules/pi-antigravity/src/client/index.ts +1 -0
  76. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
  77. package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
  78. package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
  79. package/node_modules/pi-antigravity/src/image/image.ts +16 -2
  80. package/node_modules/pi-antigravity/src/index.ts +145 -2
  81. package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
  82. package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
  83. package/node_modules/pi-antigravity/src/models/models.ts +126 -14
  84. package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
  85. package/node_modules/pi-antigravity/src/types/types.ts +30 -1
  86. package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
  87. package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
  88. package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
  89. package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
  90. package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
  91. package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
  92. package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
  93. package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
  94. package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
  95. package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
  96. package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
  97. package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
  98. package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
  99. package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
  100. package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
  101. package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
  102. package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
  103. package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
  104. package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
  105. package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
  106. package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
  107. package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
  108. package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
  109. package/node_modules/pi-antigravity/tsconfig.json +2 -2
  110. package/node_modules/pi-commandcode-provider/CHANGELOG.md +21 -1
  111. package/node_modules/pi-commandcode-provider/README.md +2 -2
  112. package/node_modules/pi-commandcode-provider/index.ts +2 -1
  113. package/node_modules/pi-commandcode-provider/package.json +5 -4
  114. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
  115. package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
  116. package/node_modules/pi-commandcode-provider/src/pricing.ts +8 -1
  117. package/node_modules/pi-commandcode-provider/src/responses-compat.ts +137 -0
  118. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  119. package/node_modules/pi-lens/CHANGELOG.md +172 -0
  120. package/node_modules/pi-lens/README.md +103 -217
  121. package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  122. package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  123. package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  124. package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  125. package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  126. package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  127. package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  128. package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  129. package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  130. package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  131. package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  132. package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  133. package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  134. package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
  135. package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  136. package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  137. package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  138. package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  139. package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  140. package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  141. package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  142. package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  143. package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  144. package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  145. package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  146. package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  147. package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  148. package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  149. package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  150. package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  151. package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  152. package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  153. package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  154. package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  155. package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  156. package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  157. package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  158. package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  159. package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  160. package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
  161. package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  162. package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
  163. package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  164. package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  165. package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  166. package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  167. package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  168. package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  169. package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  170. package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  171. package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
  172. package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  173. package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  174. package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  175. package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  176. package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  177. package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  178. package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  179. package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
  180. package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  181. package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  182. package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
  183. package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
  184. package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  185. package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  186. package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  187. package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  188. package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  189. package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  190. package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  191. package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  192. package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  193. package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  194. package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
  195. package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  196. package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  197. package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  198. package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  199. package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  200. package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  201. package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  202. package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  203. package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  204. package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  205. package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  206. package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  207. package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  208. package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  209. package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
  210. package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  211. package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
  212. package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  213. package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  214. package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  215. package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  216. package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  217. package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  218. package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  219. package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  220. package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  221. package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  222. package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  223. package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  224. package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  225. package/node_modules/pi-lens/dist/index.js +6508 -5413
  226. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
  227. package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
  228. package/node_modules/pi-lens/dist/mcp/server.js +602 -345
  229. package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
  230. package/node_modules/pi-lens/dist/probes/installer.js +19 -17
  231. package/node_modules/pi-lens/docs/architecture.md +113 -0
  232. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
  233. package/node_modules/pi-lens/docs/ci.md +18 -4
  234. package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
  235. package/node_modules/pi-lens/docs/dependencies.md +10 -10
  236. package/node_modules/pi-lens/docs/features.md +3 -3
  237. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
  238. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
  239. package/node_modules/pi-lens/docs/language-coverage.md +39 -0
  240. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
  241. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  242. package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
  243. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
  244. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
  245. package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
  246. package/node_modules/pi-lens/docs/prose-standard.md +112 -0
  247. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  248. package/node_modules/pi-lens/docs/usage.md +50 -0
  249. package/node_modules/pi-lens/package.json +1 -1
  250. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  251. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  252. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  253. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  254. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  255. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  256. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  257. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  258. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  259. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  260. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  261. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  262. package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  263. package/node_modules/pi-web-access/CHANGELOG.md +29 -0
  264. package/node_modules/pi-web-access/README.md +35 -15
  265. package/node_modules/pi-web-access/anysearch.ts +7 -3
  266. package/node_modules/pi-web-access/autom.ts +196 -0
  267. package/node_modules/pi-web-access/cloro.ts +254 -0
  268. package/node_modules/pi-web-access/curator-page.ts +7 -1
  269. package/node_modules/pi-web-access/curator-server.ts +3 -0
  270. package/node_modules/pi-web-access/dist/index.js +12931 -12111
  271. package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
  272. package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
  273. package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
  274. package/node_modules/pi-web-access/duckduckgo.ts +11 -3
  275. package/node_modules/pi-web-access/extract.ts +60 -4
  276. package/node_modules/pi-web-access/gemini-search.ts +25 -5
  277. package/node_modules/pi-web-access/index.ts +9 -1
  278. package/node_modules/pi-web-access/package.json +2 -2
  279. package/node_modules/pi-web-access/page-query.ts +12 -3
  280. package/node_modules/pi-web-access/specstream.ts +276 -0
  281. package/node_modules/pi-web-access/tool-activation.ts +21 -6
  282. package/node_modules/pi-web-access/utils.ts +4 -0
  283. package/node_modules/pi-web-access/video-extract.ts +2 -2
  284. package/node_modules/pi-web-access/web-tool-core.ts +24 -5
  285. package/node_modules/pi-web-access/youtube-extract.ts +2 -2
  286. package/package.json +11 -8
  287. package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
  288. package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
  289. package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
  290. package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
  291. package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
  292. package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
  293. package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
  294. package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
  295. package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
  296. package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
@@ -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.
@@ -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
  }