@herbertgao/pi-extensions 2026.11.11 → 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 (258) hide show
  1. package/CHANGELOG.md +20 -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 +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/pi-antigravity/README.md +58 -9
  36. package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
  37. package/node_modules/pi-antigravity/package.json +15 -6
  38. package/node_modules/pi-antigravity/src/client/client.ts +63 -14
  39. package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
  40. package/node_modules/pi-antigravity/src/client/index.ts +1 -0
  41. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
  42. package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
  43. package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
  44. package/node_modules/pi-antigravity/src/image/image.ts +16 -2
  45. package/node_modules/pi-antigravity/src/index.ts +145 -2
  46. package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
  47. package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
  48. package/node_modules/pi-antigravity/src/models/models.ts +126 -14
  49. package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
  50. package/node_modules/pi-antigravity/src/types/types.ts +30 -1
  51. package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
  52. package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
  53. package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
  54. package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
  55. package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
  56. package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
  57. package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
  58. package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
  59. package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
  60. package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
  61. package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
  62. package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
  63. package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
  64. package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
  65. package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
  66. package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
  67. package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
  68. package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
  69. package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
  70. package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
  71. package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
  72. package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
  73. package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
  74. package/node_modules/pi-antigravity/tsconfig.json +2 -2
  75. package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
  76. package/node_modules/pi-commandcode-provider/README.md +2 -2
  77. package/node_modules/pi-commandcode-provider/package.json +1 -1
  78. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
  79. package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
  80. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  81. package/node_modules/pi-lens/CHANGELOG.md +172 -0
  82. package/node_modules/pi-lens/README.md +103 -217
  83. package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  84. package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  85. package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  86. package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  87. package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  88. package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  89. package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  90. package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  91. package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  92. package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  93. package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  94. package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  95. package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  96. package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
  97. package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  98. package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  99. package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  100. package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  101. package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  102. package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  103. package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  105. package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  106. package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  107. package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  108. package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  109. package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  110. package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  111. package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  112. package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  113. package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  114. package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  115. package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  116. package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  117. package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  118. package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  119. package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  120. package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  121. package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  122. package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
  123. package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  124. package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
  125. package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  126. package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  127. package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  128. package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  129. package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  130. package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  131. package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  132. package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  133. package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
  134. package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  135. package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  136. package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  137. package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  138. package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  139. package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  140. package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  141. package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
  142. package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  143. package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  144. package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
  145. package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
  146. package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  147. package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  148. package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  149. package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  150. package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  151. package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  152. package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  153. package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  154. package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  155. package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  156. package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
  157. package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  158. package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  159. package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  160. package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  161. package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  162. package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  163. package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  164. package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  165. package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  166. package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  167. package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  168. package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  169. package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  170. package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  171. package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
  172. package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  173. package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
  174. package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  175. package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  176. package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  177. package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  178. package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  179. package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  180. package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  181. package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  182. package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  183. package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  184. package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  185. package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  186. package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  187. package/node_modules/pi-lens/dist/index.js +6508 -5413
  188. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
  189. package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
  190. package/node_modules/pi-lens/dist/mcp/server.js +602 -345
  191. package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
  192. package/node_modules/pi-lens/dist/probes/installer.js +19 -17
  193. package/node_modules/pi-lens/docs/architecture.md +113 -0
  194. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
  195. package/node_modules/pi-lens/docs/ci.md +18 -4
  196. package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
  197. package/node_modules/pi-lens/docs/dependencies.md +10 -10
  198. package/node_modules/pi-lens/docs/features.md +3 -3
  199. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
  200. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
  201. package/node_modules/pi-lens/docs/language-coverage.md +39 -0
  202. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
  203. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  204. package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
  205. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
  206. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
  207. package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
  208. package/node_modules/pi-lens/docs/prose-standard.md +112 -0
  209. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  210. package/node_modules/pi-lens/docs/usage.md +50 -0
  211. package/node_modules/pi-lens/package.json +1 -1
  212. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  213. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  214. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  215. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  217. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  218. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  219. package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  220. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  221. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  222. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  223. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  224. package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  225. package/node_modules/pi-web-access/CHANGELOG.md +29 -0
  226. package/node_modules/pi-web-access/README.md +35 -15
  227. package/node_modules/pi-web-access/anysearch.ts +7 -3
  228. package/node_modules/pi-web-access/autom.ts +196 -0
  229. package/node_modules/pi-web-access/cloro.ts +254 -0
  230. package/node_modules/pi-web-access/curator-page.ts +7 -1
  231. package/node_modules/pi-web-access/curator-server.ts +3 -0
  232. package/node_modules/pi-web-access/dist/index.js +12931 -12111
  233. package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
  234. package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
  235. package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
  236. package/node_modules/pi-web-access/duckduckgo.ts +11 -3
  237. package/node_modules/pi-web-access/extract.ts +60 -4
  238. package/node_modules/pi-web-access/gemini-search.ts +25 -5
  239. package/node_modules/pi-web-access/index.ts +9 -1
  240. package/node_modules/pi-web-access/package.json +2 -2
  241. package/node_modules/pi-web-access/page-query.ts +12 -3
  242. package/node_modules/pi-web-access/specstream.ts +276 -0
  243. package/node_modules/pi-web-access/tool-activation.ts +21 -6
  244. package/node_modules/pi-web-access/utils.ts +4 -0
  245. package/node_modules/pi-web-access/video-extract.ts +2 -2
  246. package/node_modules/pi-web-access/web-tool-core.ts +24 -5
  247. package/node_modules/pi-web-access/youtube-extract.ts +2 -2
  248. package/package.json +10 -7
  249. package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
  250. package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
  251. package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
  252. package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
  253. package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
  254. package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
  255. package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
  256. package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
  257. package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
  258. package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
@@ -0,0 +1,35 @@
1
+ # Reader guarantees
2
+
3
+ The reader uses Google's crawler. It does not contact the origin directly, execute page scripts, download files, extract PDFs, or reconstruct missing article text. A closed HTML document or a complete saved page does not prove full article coverage.
4
+
5
+ ## Contract and regression checks
6
+
7
+ Run `yarn check` for the offline gate. The two reader scripts are included in TypeScript, ESLint, Prettier, and the default test chain.
8
+
9
+ | Guarantee | Regression check | Owner |
10
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------- |
11
+ | Unsafe caller URLs are rejected before credential lookup or progress. Search uses the same URL predicate, plus a best-effort DNS filter before contacting origins. | `scenarioGuards`; foundations URL policy cases; search citations tests | `utils/address.ts` |
12
+ | URL credentials and recognized credential carriers are redacted on rendered surfaces. Ordinary diagnostic values and JSON structure survive. Exact caller/service URL echoes in page content are redacted before the page is shown or saved. Arbitrary secrets in page text are not promised filtered. | `scenarioSecrets`; foundations redaction and JSON cases | `utils/security.ts`, `web-fetch.ts` |
13
+ | Malformed credentials cannot appear in parser errors or retained causes. | Foundations credential cases | `client/client.ts` |
14
+ | Third-party text has valid UTF-16. Metadata is bounded and single-line; page bodies retain their line structure. | Foundations text, metadata, and body cases | `utils/text.ts` |
15
+ | Relative redirects resolve normally. Explicit private, credential-bearing, or non-HTTP destinations fail closed. Only destinations reported by Google are visible; intermediate redirects and remote DNS are not independently checked. | `scenarioRedirects`; foundations URL policy | `web-fetch.ts` |
16
+ | One shared ten-second network deadline and at most ten Google requests bound retrieval. Endpoint failover is transport-only. The caller's abort is respected. | `scenarioAlternateOnSecondEndpoint`; deadline and abort cases | `web-fetch.ts` |
17
+ | Recovery retains a useful original when live or optional representation reads fail. At most one publisher representation URL is selected. | `scenarioRecovery`, `scenarioAlternate`, `scenarioPdf` | `web-fetch.ts` |
18
+ | HTML work is bounded before parsing: 2,000,000 characters, 50,000 markup tokens, 128 nested elements. Script strings and comments do not count as nested markup. Independent blocks avoid repeated prefix joins. | Foundations size, node, depth, script/comment, and many-block cases | `document.ts`, `markdown.ts` |
19
+ | Inspection uses an owned DOM, substantive content regions, and body evidence for access-wall judgments. A heading alone does not prove a wall or a JavaScript shell. | Foundations inspection and real-page fixtures; `scenarioStatusArticle` | `inspect.ts`, `markdown.ts` |
20
+ | XML, SVG, Markdown, and text are not silently emptied as HTML. PDF refusal uses the reported media type, URL suffix, or line-start signature rather than prose mentioning a signature. | Foundations media cases; `scenarioDetection`, `scenarioPdf` | `media.ts`, `markdown.ts`, `web-fetch.ts` |
21
+ | Source completeness, content assessment, and output truncation remain separate. Publisher metadata is labeled as publisher claims. Omitted publisher sections are noted. | `scenarioTruncatedCopy`; foundations MDN cases | `inspect.ts`, `mdn.ts`, `web-fetch.ts` |
22
+ | Returned text plus serialized details share the configured character cap. Provenance and the saved-page footer count too. Small budgets can omit older attempt details; the omission count is explicit and doctor retains the bounded full history. | `scenarioReadablePage`, `scenarioBudget`, `scenarioLongFence`; live smoke cap checks | Feature entrypoint and formatter |
23
+ | A page that does not fit is saved whole to a private temp file named in the answer and in `details.fullOutputPath`. A budget too small to answer leaves no file behind, and a failed save is reported in the answer without losing the page. Pages beyond the conversion limits are refused with Google's unconverted HTML saved. Raw mode returns the crawled source whatever its size and saves it without the provenance header. | `scenarioReadablePage`, `scenarioBudgetFailure`, `scenarioUnconverted` | `save.ts`, feature entrypoint |
24
+ | Cut-off or unavailable Wikipedia articles and raw GitHub files recover only through a copy that names the requested article or file. Advertised, MDN, Wikipedia and GitHub copies share one representation contract. | `scenarioWikipedia`, `scenarioGithubRaw` | `sites.ts`, `web-fetch.ts` |
25
+ | Successful degraded reads and failures leave sanitized diagnostics. | Deadline/degraded diagnostics cases | Reader and `diagnostics/` |
26
+
27
+ Search caches expire after ten minutes and skip known secret-bearing keys or values. Client lookup caches use token digests rather than raw access tokens as keys.
28
+
29
+ The response stream is capped at 5,000,000 bytes. Limits are refusals, not claims that a page is complete.
30
+
31
+ ## Live check
32
+
33
+ After `/login antigravity`, run `yarn smoke:fetch`. It exercises Example.com, GitHub Docs, and an old MDN URL, checks the complete output cap, and checks that a saved page can be read without network or credentials. Wrong page text is a failure. Explicit retrieval failures explaining a degraded copy and an unobserved canonical alias are warnings. Upstream availability warnings produce exit code 2; an alias-only warning does not. Exit code 2 means live coverage was insufficient; a passing offline gate does not replace this check.
34
+
35
+ The saved fixture data comes from the existing main-branch corpus. Its provenance is listed in `scripts/fixtures/web-fetch/README.md`. The branch's registered-tool suite remains the implementation contract; main's incompatible reader suite is not imported.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-antigravity",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Personal Antigravity / Cloud Code Assist provider for Pi Coding Agent",
5
5
  "author": "Rahul Arya",
6
6
  "license": "MIT",
@@ -25,6 +25,7 @@
25
25
  "files": [
26
26
  "LICENSE",
27
27
  "README.md",
28
+ "docs/reader-guarantees.md",
28
29
  "src",
29
30
  "tsconfig.json"
30
31
  ],
@@ -34,12 +35,13 @@
34
35
  },
35
36
  "scripts": {
36
37
  "typecheck": "tsc --noEmit",
37
- "lint": "eslint src",
38
+ "lint": "eslint src scripts/test-web-fetch.ts scripts/test-reader-foundations.ts scripts/smoke-fetch-policy.ts",
38
39
  "lint:fix": "eslint src --fix",
39
40
  "format": "prettier --write .",
40
41
  "format:check": "prettier --check .",
41
42
  "security-check": "node scripts/run-ts.mjs scripts/security-check.ts",
42
- "test": "node scripts/run-ts.mjs scripts/test-sanitize-text.ts && node scripts/run-ts.mjs scripts/test-model-routing.ts && node scripts/run-ts.mjs scripts/test-model-discovery.ts && node scripts/run-ts.mjs scripts/test-usage-formatter.ts && node scripts/run-ts.mjs scripts/test-stream-sse.ts && node scripts/run-ts.mjs scripts/test-stream-header-deadline.ts && node scripts/run-ts.mjs scripts/test-http-proxy.ts && node scripts/run-ts.mjs scripts/test-oauth-fetch.ts && node scripts/run-ts.mjs scripts/test-image-gen.ts && node scripts/run-ts.mjs scripts/test-native-images.ts && node scripts/run-ts.mjs scripts/test-transcript-context.ts && node scripts/run-ts.mjs scripts/test-accounts.ts && node scripts/run-ts.mjs scripts/test-search.ts && node scripts/run-ts.mjs scripts/test-search-citations.ts && node scripts/run-ts.mjs scripts/test-extra-tools-toggle.ts && node scripts/run-ts.mjs scripts/test-provider-registration.ts && node scripts/run-ts.mjs scripts/test-stream-recovery.ts",
43
+ "test": "node scripts/run-ts.mjs scripts/test-sanitize-text.ts && node scripts/run-ts.mjs scripts/test-model-routing.ts && node scripts/run-ts.mjs scripts/test-model-discovery.ts && node scripts/run-ts.mjs scripts/test-usage-formatter.ts && node scripts/run-ts.mjs scripts/test-model-pricing.ts && node scripts/run-ts.mjs scripts/test-stream-sse.ts && node scripts/run-ts.mjs scripts/test-stream-header-deadline.ts && node scripts/run-ts.mjs scripts/test-http-proxy.ts && node scripts/run-ts.mjs scripts/test-oauth-fetch.ts && node scripts/run-ts.mjs scripts/test-image-gen.ts && node scripts/run-ts.mjs scripts/test-native-images.ts && node scripts/run-ts.mjs scripts/test-transcript-context.ts && node scripts/run-ts.mjs scripts/test-accounts.ts && node scripts/run-ts.mjs scripts/test-search.ts && node scripts/run-ts.mjs scripts/test-search-citations.ts && node scripts/run-ts.mjs scripts/test-web-fetch.ts && node scripts/run-ts.mjs scripts/test-reader-foundations.ts && node scripts/run-ts.mjs scripts/test-extra-tools-toggle.ts && node scripts/run-ts.mjs scripts/test-fetch-tool-toggle.ts && node scripts/run-ts.mjs scripts/test-provider-registration.ts && node scripts/run-ts.mjs scripts/test-stream-recovery.ts && node scripts/run-ts.mjs scripts/test-enterprise-and-capacity.ts",
44
+ "smoke:fetch": "node scripts/run-ts.mjs scripts/smoke-web-fetch.mjs",
43
45
  "smoke:tools": "node scripts/run-ts.mjs scripts/smoke-tool-schema.ts",
44
46
  "smoke:models": "node scripts/run-ts.mjs scripts/smoke-all-models.mjs",
45
47
  "audit": "yarn npm audit --environment production --recursive && yarn npm audit --severity high --all --recursive",
@@ -49,6 +51,7 @@
49
51
  "extensions": [
50
52
  "./src/index.ts",
51
53
  "./src/features/google-search.ts",
54
+ "./src/features/read-url-content.ts",
52
55
  "./src/features/generate-image.ts"
53
56
  ]
54
57
  },
@@ -58,21 +61,27 @@
58
61
  "typebox": "*"
59
62
  },
60
63
  "devDependencies": {
61
- "@earendil-works/pi-ai": "^0.86.1",
62
- "@earendil-works/pi-coding-agent": "^0.86.1",
64
+ "@earendil-works/pi-ai": "^1.5.0",
65
+ "@earendil-works/pi-coding-agent": "^1.5.0",
63
66
  "@eslint/js": "^10.0.1",
64
67
  "@types/node": "^26.6.2",
68
+ "@types/turndown": "^5.0.6",
65
69
  "eslint": "^10.11.0",
66
70
  "eslint-config-prettier": "^10.1.8",
67
71
  "globals": "^17.7.0",
68
72
  "prettier": "^3.9.8",
73
+ "typebox": "^1.3.27",
69
74
  "typescript": "^6.0.3",
70
75
  "typescript-eslint": "^8.64.0"
71
76
  },
72
77
  "dependencies": {
78
+ "@mixmark-io/domino": "^2.2.0",
79
+ "turndown": "^7.2.4",
80
+ "turndown-plugin-gfm": "^1.0.2",
73
81
  "undici": "^8.12.3"
74
82
  },
75
83
  "resolutions": {
76
- "undici": "8.12.3"
84
+ "undici": "8.12.3",
85
+ "minimatch": "11.0.3"
77
86
  }
78
87
  }
@@ -60,10 +60,10 @@ export function endpointCandidates(): string[] {
60
60
  return explicit ? [assertSafeApiBaseUrl(explicit)] : ENDPOINT_FALLBACKS;
61
61
  }
62
62
 
63
- // Catalog visibility is gated on this version. 1.2.4 hides Gemini 4 Argon;
64
- // 1.4.0 is aligned with the current official agy CLI release (#93, #94, #97).
63
+ // Catalog visibility is gated on this version. 1.2.4 hides Gemini 4 Argon.
64
+ // 1.5.5 matches the current official agy CLI release (#122, #123).
65
65
  const DEFAULT_USER_AGENT =
66
- "antigravity/cli/1.4.0 (aidev_client; os_type=linux; arch=amd64; cl=982146307; auth_method=consumer)";
66
+ "antigravity/cli/1.5.5 (aidev_client; os_type=linux; arch=amd64; cl=982146307; auth_method=consumer)";
67
67
 
68
68
  /** Default User-Agent matching pure Antigravity CLI wire fingerprint. */
69
69
  export function defaultUserAgent(): string {
@@ -84,7 +84,7 @@ export function jsonOrTextError(text: string): string {
84
84
  const parsed = JSON.parse(text) as {
85
85
  error?: { message?: string; status?: string; code?: number };
86
86
  };
87
- if (parsed.error?.message) return parsed.error.message;
87
+ if (typeof parsed.error?.message === "string") return parsed.error.message;
88
88
  } catch {
89
89
  // not JSON
90
90
  }
@@ -96,14 +96,19 @@ export function parseApiKey(apiKeyRaw: string | undefined): AntigravityApiKey {
96
96
  throw new Error("No Antigravity OAuth credentials. Run /login antigravity.");
97
97
  }
98
98
  try {
99
- const parsed = JSON.parse(apiKeyRaw) as Partial<AntigravityApiKey>;
100
- if (!parsed.token || !parsed.projectId) throw new Error("missing token or projectId");
99
+ const parsed: unknown = JSON.parse(apiKeyRaw);
100
+ if (
101
+ !isRecord(parsed) ||
102
+ typeof parsed.token !== "string" ||
103
+ !/^[\x21-\x7e]+$/.test(parsed.token) ||
104
+ typeof parsed.projectId !== "string" ||
105
+ !/^[\x21-\x7e]+$/.test(parsed.projectId)
106
+ )
107
+ throw new Error("missing token or projectId");
101
108
  return { token: parsed.token, projectId: parsed.projectId };
102
- } catch (error) {
103
- throw new Error(
104
- `Invalid Antigravity credentials. Run /login antigravity. (${safeError(error)})`,
105
- { cause: error },
106
- );
109
+ } catch {
110
+ // JSON parser errors can quote the credential input. Do not retain that cause.
111
+ throw new Error("Invalid Antigravity credentials. Run /login antigravity.");
107
112
  }
108
113
  }
109
114
 
@@ -409,7 +414,7 @@ export function mergeAvailableModelsResults(
409
414
  const mergedModels: Record<string, unknown> = {};
410
415
  let defaultAgentModelId: string | undefined;
411
416
  let defaultAgentModel: string | undefined;
412
- let agentModelSorts: AvailableModelsRaw["agentModelSorts"];
417
+ const agentModelSortsSources: Array<NonNullable<AvailableModelsRaw["agentModelSorts"]>> = [];
413
418
  let lastEndpoint = "";
414
419
  let lastStatus = 0;
415
420
 
@@ -438,7 +443,9 @@ export function mergeAvailableModelsResults(
438
443
  defaultAgentModel = data.defaultAgentModel;
439
444
  }
440
445
  if (isRecord(data) && Array.isArray(data.agentModelSorts)) {
441
- agentModelSorts = data.agentModelSorts as AvailableModelsRaw["agentModelSorts"];
446
+ agentModelSortsSources.push(
447
+ data.agentModelSorts as NonNullable<AvailableModelsRaw["agentModelSorts"]>,
448
+ );
442
449
  }
443
450
  }
444
451
 
@@ -455,11 +462,53 @@ export function mergeAvailableModelsResults(
455
462
  models: mergedModels as AvailableModelsRaw["models"],
456
463
  defaultAgentModelId,
457
464
  defaultAgentModel,
458
- agentModelSorts,
465
+ agentModelSorts: mergeAgentModelSorts(agentModelSortsSources),
459
466
  },
460
467
  };
461
468
  }
462
469
 
470
+ /**
471
+ * Union the curated `agentModelSorts` recommendation lists from every endpoint.
472
+ * New models roll out on the daily/sandbox endpoints before production (e.g.
473
+ * Gemini 4 Carbon, #123); a last-endpoint-wins merge lets the production list
474
+ * hide models the other endpoints already recommend, while the merged `models`
475
+ * dictionary above is a union. Sorts are matched by `displayName` and groups by
476
+ * position; first-seen order wins so the primary endpoint keeps its ranking.
477
+ */
478
+ function mergeAgentModelSorts(
479
+ sources: Array<NonNullable<AvailableModelsRaw["agentModelSorts"]>>,
480
+ ): AvailableModelsRaw["agentModelSorts"] {
481
+ if (sources.length === 0) return undefined;
482
+ const seen = new Set<string>();
483
+ const merged: Array<{ displayName?: unknown; groups: Array<{ modelIds: string[] }> }> = [];
484
+ for (const sorts of sources) {
485
+ for (const sort of sorts) {
486
+ if (!isRecord(sort)) continue;
487
+ const displayName = typeof sort.displayName === "string" ? sort.displayName : undefined;
488
+ let target = merged.find((entry) => entry.displayName === displayName);
489
+ if (!target) {
490
+ target = { ...(displayName !== undefined ? { displayName } : {}), groups: [] };
491
+ merged.push(target);
492
+ }
493
+ const groups = Array.isArray(sort.groups) ? sort.groups : [];
494
+ groups.forEach((group, index) => {
495
+ let targetGroup = target.groups[index];
496
+ if (!targetGroup) {
497
+ targetGroup = { modelIds: [] };
498
+ target.groups[index] = targetGroup;
499
+ }
500
+ const modelIds = isRecord(group) && Array.isArray(group.modelIds) ? group.modelIds : [];
501
+ for (const id of modelIds) {
502
+ if (typeof id !== "string" || !id || seen.has(id)) continue;
503
+ seen.add(id);
504
+ targetGroup.modelIds.push(id);
505
+ }
506
+ });
507
+ }
508
+ }
509
+ return merged.length > 0 ? merged : undefined;
510
+ }
511
+
463
512
  /**
464
513
  * Merge fetchAvailableModels across endpoint candidates so daily/sandbox-only
465
514
  * models appear alongside production catalog entries.
@@ -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
+ }