@herbertgao/pi-extensions 2026.11.4 → 2026.11.6

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 (207) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +9 -9
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +5 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +4 -4
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +6 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +22 -4
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +3 -3
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +22 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +5 -0
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +38 -6
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +2 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +4 -4
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +6 -6
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +4 -4
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +3 -2
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-mode.ts +465 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-scope.ts +44 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  23. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +2 -4
  24. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +3 -5
  25. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +2 -4
  26. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +3 -5
  27. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +10 -0
  28. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  29. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/asset-producer.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +4 -4
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +13 -7
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +2 -0
  37. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +5 -3
  38. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +2 -2
  39. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  40. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  41. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +39 -22
  42. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +43 -15
  43. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +357 -139
  44. package/node_modules/@narumitw/pi-btw/CHANGELOG.md +8 -0
  45. package/node_modules/@narumitw/pi-btw/README.md +1 -0
  46. package/node_modules/@narumitw/pi-btw/dist/chunks/bring-to-main-VMICX6GU.ts +450 -0
  47. package/node_modules/@narumitw/pi-btw/dist/chunks/bring-to-main-VMICX6GU.ts.map +7 -0
  48. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-6GO5M6UJ.ts +142 -0
  49. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-6GO5M6UJ.ts.map +7 -0
  50. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-E4LBFYRH.ts +452 -0
  51. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-E4LBFYRH.ts.map +7 -0
  52. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-FWW662MW.ts +329 -0
  53. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-FWW662MW.ts.map +7 -0
  54. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-TPDBHPLD.ts +614 -0
  55. package/node_modules/@narumitw/pi-btw/dist/chunks/chunk-TPDBHPLD.ts.map +7 -0
  56. package/node_modules/@narumitw/pi-btw/dist/chunks/fullscreen-ui-4MJ3HOFJ.ts +1400 -0
  57. package/node_modules/@narumitw/pi-btw/dist/chunks/fullscreen-ui-4MJ3HOFJ.ts.map +7 -0
  58. package/node_modules/@narumitw/pi-btw/dist/chunks/import-main-updates-XFSIED52.ts +79 -0
  59. package/node_modules/@narumitw/pi-btw/dist/chunks/import-main-updates-XFSIED52.ts.map +7 -0
  60. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts +328 -0
  61. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts.map +7 -0
  62. package/node_modules/@narumitw/pi-btw/dist/chunks/menu-SYMLQYWC.ts +15 -0
  63. package/node_modules/@narumitw/pi-btw/dist/chunks/menu-SYMLQYWC.ts.map +7 -0
  64. package/node_modules/@narumitw/pi-btw/dist/chunks/transcript-pager-D7XAJC65.ts +824 -0
  65. package/node_modules/@narumitw/pi-btw/dist/chunks/transcript-pager-D7XAJC65.ts.map +7 -0
  66. package/node_modules/@narumitw/pi-btw/dist/index.ts +111 -4497
  67. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  68. package/node_modules/@narumitw/pi-btw/package.json +2 -2
  69. package/node_modules/@narumitw/pi-btw/src/btw.ts +55 -30
  70. package/node_modules/pi-antigravity/README.md +6 -2
  71. package/node_modules/pi-antigravity/package.json +9 -5
  72. package/node_modules/pi-antigravity/src/features/generate-image.ts +9 -3
  73. package/node_modules/pi-antigravity/src/features/google-search.ts +3 -2
  74. package/node_modules/pi-antigravity/src/image/image.ts +42 -4
  75. package/node_modules/pi-antigravity/src/index.ts +3 -1
  76. package/node_modules/pi-antigravity/src/models/models.ts +27 -2
  77. package/node_modules/pi-antigravity/src/search/search.ts +7 -2
  78. package/node_modules/pi-antigravity/src/stream/stream.ts +91 -15
  79. package/node_modules/pi-antigravity/src/types/types.ts +2 -0
  80. package/node_modules/pi-antigravity/src/utils/util.ts +7 -0
  81. package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
  82. package/node_modules/pi-lens/CHANGELOG.md +80 -0
  83. package/node_modules/pi-lens/README.md +2 -0
  84. package/node_modules/pi-lens/dist/{chunk-CM6BDY4E.js → chunk-2ADRLTM2.js} +2 -2
  85. package/node_modules/pi-lens/dist/{chunk-XO756WE5.js → chunk-2LVJQU3I.js} +15 -14
  86. package/node_modules/pi-lens/dist/{chunk-W5E72HJA.js → chunk-3FRI5H4T.js} +13 -1
  87. package/node_modules/pi-lens/dist/{chunk-N5CEGQPG.js → chunk-3HM4BUHR.js} +11 -11
  88. package/node_modules/pi-lens/dist/{chunk-UAKO2M6B.js → chunk-3QWVOBZJ.js} +30 -30
  89. package/node_modules/pi-lens/dist/{chunk-QB7T2PHK.js → chunk-46TQJSUE.js} +3 -1
  90. package/node_modules/pi-lens/dist/{chunk-ZZN74OGD.js → chunk-4ITEFRDH.js} +3 -2
  91. package/node_modules/pi-lens/dist/{chunk-C3YRO3EU.js → chunk-4NCDHTFI.js} +6 -6
  92. package/node_modules/pi-lens/dist/{chunk-G22UNQID.js → chunk-6I44EDNQ.js} +10 -10
  93. package/node_modules/pi-lens/dist/{chunk-OUYAUXAT.js → chunk-6MDM5MQT.js} +169 -56
  94. package/node_modules/pi-lens/dist/{chunk-CDFJF5YD.js → chunk-7JX3RNG4.js} +1 -1
  95. package/node_modules/pi-lens/dist/{chunk-PIIUNJIT.js → chunk-7WJ55KBN.js} +1 -1
  96. package/node_modules/pi-lens/dist/{chunk-ZMMHHXSW.js → chunk-A5TEJZGJ.js} +1 -0
  97. package/node_modules/pi-lens/dist/{chunk-HEA3EM23.js → chunk-ALIZWXHZ.js} +8 -8
  98. package/node_modules/pi-lens/dist/{chunk-MQ4PPCJB.js → chunk-AON2QIJF.js} +32 -36
  99. package/node_modules/pi-lens/dist/{chunk-DGKFWQK4.js → chunk-B2YUE6YD.js} +7 -7
  100. package/node_modules/pi-lens/dist/{chunk-GQTQUNCG.js → chunk-B6HXETWY.js} +20 -20
  101. package/node_modules/pi-lens/dist/{chunk-KR5VGMVT.js → chunk-BDR5MEZY.js} +9 -9
  102. package/node_modules/pi-lens/dist/{chunk-MRLH4MYU.js → chunk-BGLS5SDN.js} +1 -1
  103. package/node_modules/pi-lens/dist/{chunk-PRHYIA6X.js → chunk-BRESRQBE.js} +4 -4
  104. package/node_modules/pi-lens/dist/{chunk-5GEYJJHG.js → chunk-C6AODRNU.js} +7 -7
  105. package/node_modules/pi-lens/dist/{chunk-ZZSJAR76.js → chunk-CTB5BAJI.js} +24 -11
  106. package/node_modules/pi-lens/dist/{chunk-IICERRFF.js → chunk-CYUJB552.js} +4 -4
  107. package/node_modules/pi-lens/dist/{chunk-THYHUIDR.js → chunk-CZAWWXP6.js} +1 -1
  108. package/node_modules/pi-lens/dist/{chunk-QJJKOHLH.js → chunk-DBS736MA.js} +27 -27
  109. package/node_modules/pi-lens/dist/{chunk-XLAI7UYY.js → chunk-DOUAWKLO.js} +8 -8
  110. package/node_modules/pi-lens/dist/{chunk-LAHHGNAY.js → chunk-DVRJBQOJ.js} +12 -12
  111. package/node_modules/pi-lens/dist/{chunk-KV6GQOGN.js → chunk-E4VXKTBR.js} +28 -28
  112. package/node_modules/pi-lens/dist/{chunk-XKFO2SZV.js → chunk-F6FT6BVQ.js} +26 -26
  113. package/node_modules/pi-lens/dist/{chunk-VWLSU3XV.js → chunk-FCQSZQAT.js} +1 -1
  114. package/node_modules/pi-lens/dist/{chunk-X5BJ3G2P.js → chunk-FOEPIX76.js} +1 -1
  115. package/node_modules/pi-lens/dist/{chunk-F6BEQWAK.js → chunk-GMC4ZGYR.js} +4 -4
  116. package/node_modules/pi-lens/dist/{chunk-TOE2RRCS.js → chunk-GTTMQ6XB.js} +1 -1
  117. package/node_modules/pi-lens/dist/{chunk-5YSEQHJN.js → chunk-GUGKKGG7.js} +1 -1
  118. package/node_modules/pi-lens/dist/{chunk-OSEKJEUU.js → chunk-GVWIU7M7.js} +1 -1
  119. package/node_modules/pi-lens/dist/{chunk-TMNUTMT5.js → chunk-H65TYP6V.js} +25 -4
  120. package/node_modules/pi-lens/dist/{chunk-7R5GZIA6.js → chunk-HILZE4BQ.js} +5 -4
  121. package/node_modules/pi-lens/dist/{chunk-HYSKJMZK.js → chunk-HSYFLOZY.js} +2 -2
  122. package/node_modules/pi-lens/dist/{chunk-V2WDBOLZ.js → chunk-I32RSMH6.js} +7 -7
  123. package/node_modules/pi-lens/dist/chunk-I74RQGKA.js +88 -0
  124. package/node_modules/pi-lens/dist/{chunk-RNXOWDM6.js → chunk-IDCTDKIA.js} +3 -3
  125. package/node_modules/pi-lens/dist/{chunk-TYHPVE5H.js → chunk-IK4YS3KC.js} +8 -8
  126. package/node_modules/pi-lens/dist/{chunk-ZCQBNPRH.js → chunk-IL6PIV33.js} +2 -2
  127. package/node_modules/pi-lens/dist/{chunk-6GPB3JLL.js → chunk-J6BR5XN2.js} +2 -2
  128. package/node_modules/pi-lens/dist/{chunk-UC5AXW5Z.js → chunk-JKOZ2Z4U.js} +6 -6
  129. package/node_modules/pi-lens/dist/{chunk-WSSLVMDA.js → chunk-JZQGRARR.js} +7 -7
  130. package/node_modules/pi-lens/dist/{chunk-7UTSNTWM.js → chunk-K6WIBVMK.js} +4 -3
  131. package/node_modules/pi-lens/dist/{chunk-QVBOXT3L.js → chunk-KDCIG23C.js} +6 -6
  132. package/node_modules/pi-lens/dist/{chunk-NOWH2VA2.js → chunk-KFRDFAOE.js} +4 -4
  133. package/node_modules/pi-lens/dist/{chunk-NMUSOZ2D.js → chunk-KJ3AHOCK.js} +6 -6
  134. package/node_modules/pi-lens/dist/{chunk-E65WJVI5.js → chunk-KSTQ4VXT.js} +5 -5
  135. package/node_modules/pi-lens/dist/{chunk-4ENEJHF4.js → chunk-MAD4QJTP.js} +9 -9
  136. package/node_modules/pi-lens/dist/{chunk-KXMJLOZF.js → chunk-NBM7PNBP.js} +7 -7
  137. package/node_modules/pi-lens/dist/{chunk-7YTRG6YW.js → chunk-NE4EFHJX.js} +1 -1
  138. package/node_modules/pi-lens/dist/{chunk-AACN5GNE.js → chunk-NPNFGYLV.js} +3 -1
  139. package/node_modules/pi-lens/dist/{chunk-H3BVMK47.js → chunk-OPFNQBS5.js} +5 -5
  140. package/node_modules/pi-lens/dist/{chunk-WTB4GKMH.js → chunk-OTSTS7L2.js} +11 -2
  141. package/node_modules/pi-lens/dist/{chunk-JUZ67QZQ.js → chunk-PTSA6QKL.js} +7 -7
  142. package/node_modules/pi-lens/dist/{chunk-ZPM7ZIFL.js → chunk-Q2VCKC3X.js} +3 -3
  143. package/node_modules/pi-lens/dist/{chunk-2VZ3VN3N.js → chunk-QHOTTC4A.js} +2 -2
  144. package/node_modules/pi-lens/dist/{chunk-L7O774U7.js → chunk-QL37SGTS.js} +105 -13
  145. package/node_modules/pi-lens/dist/{chunk-FRUBVFXV.js → chunk-QMV2APEH.js} +27 -27
  146. package/node_modules/pi-lens/dist/{chunk-L4Y3ROKQ.js → chunk-QSCZAP24.js} +3 -3
  147. package/node_modules/pi-lens/dist/{chunk-IILEH3ZC.js → chunk-QUPYLQA4.js} +4 -4
  148. package/node_modules/pi-lens/dist/{chunk-3NPWO5UO.js → chunk-QUQY3IME.js} +4 -4
  149. package/node_modules/pi-lens/dist/{chunk-FGNSESAC.js → chunk-QWTHFFU6.js} +8 -8
  150. package/node_modules/pi-lens/dist/{chunk-EKNYSXFB.js → chunk-RQRKIRFY.js} +5 -5
  151. package/node_modules/pi-lens/dist/{chunk-NCLO6E6N.js → chunk-S3WFVG5P.js} +14 -21
  152. package/node_modules/pi-lens/dist/{chunk-RTFMDIKV.js → chunk-SG2JQ2YP.js} +1 -1
  153. package/node_modules/pi-lens/dist/{chunk-VO4JFPTV.js → chunk-SJQUWQR6.js} +2 -2
  154. package/node_modules/pi-lens/dist/{chunk-SLSMJPEF.js → chunk-SKVNHCT5.js} +32 -32
  155. package/node_modules/pi-lens/dist/{chunk-3HTZDY3C.js → chunk-TJQSYX3J.js} +3 -3
  156. package/node_modules/pi-lens/dist/{chunk-RNJFRXEN.js → chunk-TLWFZ66Y.js} +3 -3
  157. package/node_modules/pi-lens/dist/{chunk-LWOM6LVS.js → chunk-TN5CWX5D.js} +26 -26
  158. package/node_modules/pi-lens/dist/{chunk-UTJP6WOS.js → chunk-TQHOKMVZ.js} +11 -11
  159. package/node_modules/pi-lens/dist/{chunk-N56BNAA6.js → chunk-TYHOEX4V.js} +15 -15
  160. package/node_modules/pi-lens/dist/{chunk-QP33NKYC.js → chunk-UNBRHPHJ.js} +10 -10
  161. package/node_modules/pi-lens/dist/{chunk-EY6LY2HO.js → chunk-UOO4D2TK.js} +11 -11
  162. package/node_modules/pi-lens/dist/{chunk-47UCC4MM.js → chunk-UY745U35.js} +1 -1
  163. package/node_modules/pi-lens/dist/{chunk-ZDMFGACN.js → chunk-V7F7JHS5.js} +71 -55
  164. package/node_modules/pi-lens/dist/{chunk-PBZNYHMM.js → chunk-VGTBLTPN.js} +4 -4
  165. package/node_modules/pi-lens/dist/{chunk-L6WBJGQS.js → chunk-VPFRU5IG.js} +1 -1
  166. package/node_modules/pi-lens/dist/{chunk-Q6JQKWPK.js → chunk-VS2L7QDI.js} +8 -8
  167. package/node_modules/pi-lens/dist/{chunk-PXQ45SGD.js → chunk-W4CUK5G6.js} +2 -2
  168. package/node_modules/pi-lens/dist/{chunk-MKPDIAZH.js → chunk-WAA63ZJV.js} +1 -1
  169. package/node_modules/pi-lens/dist/{chunk-J3Q2NYJR.js → chunk-WS3UFJOU.js} +1 -1
  170. package/node_modules/pi-lens/dist/{chunk-T5QSLSMM.js → chunk-XAFZJEXY.js} +16 -16
  171. package/node_modules/pi-lens/dist/{chunk-YOXCCJDF.js → chunk-XPGH5O74.js} +56 -46
  172. package/node_modules/pi-lens/dist/{chunk-UXTQ3QPD.js → chunk-Y3EHLUPL.js} +2 -2
  173. package/node_modules/pi-lens/dist/{chunk-HSOBIN22.js → chunk-YF4G5NN5.js} +2 -2
  174. package/node_modules/pi-lens/dist/{chunk-SIQHOB6P.js → chunk-YQA34KAF.js} +7 -7
  175. package/node_modules/pi-lens/dist/{chunk-V67D6TMU.js → chunk-YT2VR4SL.js} +4 -4
  176. package/node_modules/pi-lens/dist/{chunk-CJS6WE66.js → chunk-ZOPXB2KK.js} +11 -11
  177. package/node_modules/pi-lens/dist/{chunk-H6FLQ5NW.js → chunk-ZPFLHB3R.js} +11 -11
  178. package/node_modules/pi-lens/dist/{chunk-ZVCDHYWZ.js → chunk-ZZDVGCGG.js} +6 -6
  179. package/node_modules/pi-lens/dist/index.js +537 -269
  180. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +6 -6
  181. package/node_modules/pi-lens/dist/mcp/cli.js +32 -32
  182. package/node_modules/pi-lens/dist/mcp/server.js +109 -109
  183. package/node_modules/pi-lens/dist/mcp/worker.js +49 -49
  184. package/node_modules/pi-lens/dist/probes/installer.js +13 -13
  185. package/node_modules/pi-lens/docs/agent-guide.md +2 -1
  186. package/node_modules/pi-lens/docs/agent-tools.md +13 -2
  187. package/node_modules/pi-lens/docs/configuration.md +9 -4
  188. package/node_modules/pi-lens/docs/defect-shapes.md +15 -1
  189. package/node_modules/pi-lens/docs/features.md +11 -1
  190. package/node_modules/pi-lens/docs/globalconfig.md +13 -0
  191. package/node_modules/pi-lens/docs/invariants/language-config.md +9 -1
  192. package/node_modules/pi-lens/docs/language-coverage.md +66 -0
  193. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +66 -20
  194. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +17 -13
  195. package/node_modules/pi-lens/docs/pi-lens-fixer.md +8 -6
  196. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +5 -1
  197. package/node_modules/pi-lens/docs/pi-lens-release.md +3 -2
  198. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +52 -11
  199. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  200. package/node_modules/pi-lens/docs/settings.md +7 -4
  201. package/node_modules/pi-lens/docs/usage.md +1 -0
  202. package/node_modules/pi-lens/package.json +2 -2
  203. package/node_modules/pi-lens/scripts/download-grammars.js +10 -0
  204. package/node_modules/pi-lens/scripts/grammars.lock.json +7 -0
  205. package/node_modules/pi-lens/vendor/grammars/tree-sitter-groovy.wasm +0 -0
  206. package/package.json +7 -7
  207. package/node_modules/pi-lens/dist/chunk-TGQDAG4B.js +0 -88
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-btw",
3
- "version": "0.63.4",
3
+ "version": "0.63.5",
4
4
  "description": "Pi extension that adds a /btw side-question command.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "directory": "packages/pi-btw"
46
46
  },
47
47
  "dependencies": {
48
- "@narumitw/pi-tui-kit": "^0.69.0"
48
+ "@narumitw/pi-tui-kit": "^0.69.1"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@earendil-works/pi-ai": "*",
@@ -1,30 +1,19 @@
1
1
  import { type Api, clampThinkingLevel, getSupportedThinkingLevels, type Model } from "@earendil-works/pi-ai";
2
2
  import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
3
3
  import type { MenuContext, RunMenuResult } from "@narumitw/pi-tui-kit";
4
- import {
5
- type BtwBringToMainSegment,
6
- type BtwBringToMainSummary,
4
+ import type {
5
+ BtwBringToMainSegment,
6
+ BtwBringToMainSummary,
7
7
  BtwTextRangeSelector,
8
- type BtwTextRangeSelectorState,
9
- buildQuickBringToMainSegments,
10
- estimateBringToMainTokens,
11
- formatBtwBringToMain,
12
- getAnsweredTurns,
13
- summarizeBringToMain,
8
+ BtwTextRangeSelectorState,
14
9
  } from "./bring-to-main.js";
15
10
  import type { BtwDisplayModel } from "./conversation-chrome.js";
16
- import { type RunBtwFullscreen, runBtwFullscreen } from "./fullscreen-ui.js";
17
- import { importMainUpdates } from "./import-main-updates.js";
11
+ import type { RunBtwFullscreen } from "./fullscreen-ui.js";
12
+ import type { importMainUpdates } from "./import-main-updates.js";
18
13
  import { buildMainContextSnapshot, captureMainContextSource } from "./main-context-snapshot.js";
19
14
  import { registerBtwMainThreadUpdates } from "./main-thread-updates.js";
20
- import { pickMainEntry } from "./main-tree-picker.js";
21
- import {
22
- type BtwCommandMenuResult,
23
- type BtwResumeThreadSummary,
24
- runBtwMenuPreservingEditor,
25
- showBtwCommandMenu,
26
- showBtwCustomPreservingEditor,
27
- } from "./menu.js";
15
+ import type { pickMainEntry } from "./main-tree-picker.js";
16
+ import type { BtwCommandMenuResult, BtwResumeThreadSummary } from "./menu.js";
28
17
  import { type BtwSessionLifetime, registerBtwSessionLifetimes } from "./session-lifetime.js";
29
18
  import {
30
19
  type BtwSettings,
@@ -48,12 +37,7 @@ import {
48
37
  } from "./side-thread.js";
49
38
  import { sanitizeSingleLine } from "./text.js";
50
39
  import { type BtwMarkdownTransformers, prepareBtwTranscriptMarkdown } from "./transcript-markdown.js";
51
- import {
52
- BtwAnsweringView,
53
- type BtwThinkingControl,
54
- BtwTranscriptPager,
55
- type TranscriptPagerAction,
56
- } from "./transcript-pager.js";
40
+ import type { BtwThinkingControl, TranscriptPagerAction } from "./transcript-pager.js";
57
41
 
58
42
  export { buildConversationContext } from "./conversation-context.js";
59
43
  export {
@@ -206,13 +190,27 @@ export interface BtwExtensionDependencies {
206
190
  runFullscreen?: RunBtwFullscreen;
207
191
  }
208
192
 
193
+ const runFullscreenOnFirstUse: RunBtwFullscreen = async (ctx, run, options) => {
194
+ const { runBtwFullscreen } = await import("./fullscreen-ui.js");
195
+ if (ctx.signal?.aborted || options?.signal?.aborted || options?.canRestoreParent?.() === false) {
196
+ throw new DOMException("Pi BTW session ended", "AbortError");
197
+ }
198
+ return runBtwFullscreen(ctx, run, options);
199
+ };
200
+
201
+ const pickEntryOnFirstUse: typeof pickMainEntry = async (pi, ctx) => {
202
+ const { pickMainEntry } = await import("./main-tree-picker.js");
203
+ if (ctx.signal?.aborted) return { kind: "closed" };
204
+ return pickMainEntry(pi, ctx);
205
+ };
206
+
209
207
  export default function btw(pi: ExtensionAPI, dependencies: BtwExtensionDependencies = {}) {
210
208
  const showCommandMenu = dependencies.showCommandMenu ?? showCommandMenuForBtw;
211
- const pickEntry = dependencies.pickMainEntry ?? pickMainEntry;
209
+ const pickEntry = dependencies.pickMainEntry ?? pickEntryOnFirstUse;
212
210
  const loadSettings = dependencies.loadSettings ?? loadSettingsForCommand;
213
211
  const resolveModel = dependencies.resolveModel ?? resolveBtwModelForCommand;
214
212
  const runThread = dependencies.runThread ?? runBtwThread;
215
- const runFullscreen = dependencies.runFullscreen ?? runBtwFullscreen;
213
+ const runFullscreen = dependencies.runFullscreen ?? runFullscreenOnFirstUse;
216
214
  const subscribeMainThreadUpdates = registerBtwMainThreadUpdates(pi);
217
215
  const getLifetime = registerBtwSessionLifetimes(pi);
218
216
  const sessionThreads = new WeakMap<BtwSessionLifetime, Map<string, BtwThreadState>>();
@@ -391,6 +389,8 @@ async function showCommandMenuForBtw(
391
389
  ctx: ExtensionCommandContext,
392
390
  resumeThreads: readonly BtwResumeThreadSummary[],
393
391
  ): Promise<BtwCommandMenuResult> {
392
+ const { showBtwCommandMenu } = await import("./menu.js");
393
+ if (ctx.signal?.aborted) return "closed";
394
394
  return showBtwCommandMenu(ctx, {
395
395
  currentThinkingLevel: pi.getThinkingLevel(),
396
396
  resumeThreads,
@@ -530,7 +530,10 @@ export async function runBtwThread({
530
530
  if (ctx.signal?.aborted || action.kind === "close") return { kind: "closed" };
531
531
  if (action.kind === "importMainUpdates") {
532
532
  composerDraft = action.questionDraft;
533
- const result = await (dependencies.importUpdates ?? importMainUpdates)(thread, ctx);
533
+ const importUpdates =
534
+ dependencies.importUpdates ?? (await import("./import-main-updates.js")).importMainUpdates;
535
+ if (ctx.signal?.aborted) return { kind: "closed" };
536
+ const result = await importUpdates(thread, ctx);
534
537
  if (ctx.signal?.aborted || result === "close") return { kind: "closed" };
535
538
  continue;
536
539
  }
@@ -592,6 +595,18 @@ export async function chooseBringToMain(
592
595
  ctx: ExtensionCommandContext,
593
596
  dependencies: ChooseBringToMainDependencies = {},
594
597
  ): Promise<BtwBringToMainChoice> {
598
+ if (ctx.signal?.aborted) return { kind: "closed" };
599
+ const [
600
+ {
601
+ getAnsweredTurns,
602
+ buildQuickBringToMainSegments,
603
+ estimateBringToMainTokens,
604
+ formatBtwBringToMain,
605
+ summarizeBringToMain,
606
+ BtwTextRangeSelector,
607
+ },
608
+ { showBtwCustomPreservingEditor },
609
+ ] = await Promise.all([import("./bring-to-main.js"), import("./menu.js")]);
595
610
  if (ctx.signal?.aborted) return { kind: "closed" };
596
611
  const answered = getAnsweredTurns(thread.turns);
597
612
  if (answered.length === 0) return { kind: "back" };
@@ -701,7 +716,10 @@ async function showBringToMainPreview(
701
716
  draft: string,
702
717
  summary: BtwBringToMainSummary,
703
718
  ): Promise<BtwBringToMainPreviewAction> {
704
- const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
719
+ const [{ defineMenu, runMenu }, { runBtwMenuPreservingEditor }] = await Promise.all([
720
+ import("@narumitw/pi-tui-kit"),
721
+ import("./menu.js"),
722
+ ]);
705
723
  if (ctx.signal?.aborted) return { kind: "close" };
706
724
  let confirmed = false;
707
725
  const count = summary.messages === 1 ? "1 message" : `${summary.messages} messages`;
@@ -741,7 +759,10 @@ async function showBtwMenu(
741
759
  options: readonly string[],
742
760
  initialValue?: string,
743
761
  ): Promise<BtwMenuSelectorAction> {
744
- const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
762
+ const [{ defineMenu, runMenu }, { runBtwMenuPreservingEditor }] = await Promise.all([
763
+ import("@narumitw/pi-tui-kit"),
764
+ import("./menu.js"),
765
+ ]);
745
766
  if (ctx.signal?.aborted) return { kind: "close" };
746
767
  const items = options.map((label, index) => ({ id: `option-${index}`, label }));
747
768
  const initialIndex = initialValue === undefined ? -1 : options.indexOf(initialValue);
@@ -867,6 +888,8 @@ async function askThreadQuestion(
867
888
  ctx: ExtensionCommandContext,
868
889
  steering: BtwThreadSteeringControl,
869
890
  ) {
891
+ const { BtwAnsweringView } = await import("./transcript-pager.js");
892
+ if (ctx.signal?.aborted) return { kind: "aborted" as const };
870
893
  const createMarkdownTransformers = await prepareCurrentTranscriptMarkdown(thread, question, ctx);
871
894
  if (!createMarkdownTransformers || ctx.signal?.aborted) return { kind: "aborted" as const };
872
895
  return ctx.ui.custom<Awaited<ReturnType<typeof completeSideThreadTurn>>>((tui, theme, keybindings, done) => {
@@ -918,6 +941,8 @@ async function showThreadComposer(
918
941
  thinking: BtwThreadThinkingControl,
919
942
  model?: BtwDisplayModel,
920
943
  ): Promise<TranscriptPagerAction> {
944
+ const { BtwTranscriptPager } = await import("./transcript-pager.js");
945
+ if (ctx.signal?.aborted) return { kind: "close" };
921
946
  const createMarkdownTransformers = await prepareCurrentTranscriptMarkdown(thread, initialQuestion, ctx);
922
947
  if (!createMarkdownTransformers || ctx.signal?.aborted) return { kind: "close" };
923
948
  let statusLeaf: string | null | undefined;
@@ -4,6 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/pi-antigravity?logo=npm)](https://www.npmjs.com/package/pi-antigravity)
5
5
  [![license](https://img.shields.io/npm/l/pi-antigravity)](LICENSE)
6
6
  [![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-ea4aaa?logo=github)](https://github.com/sponsors/Rahularya01)
7
+ [![omp status](https://omppackages.com/badge/pi-antigravity.svg)](https://omppackages.com/packages/pi-antigravity)
7
8
 
8
9
  **pi-antigravity** is a [Pi Coding Agent](https://pi.dev) provider that lets Pi talk directly to Google Antigravity / Cloud Code Assist models — Gemini, plus the Claude and GPT-OSS models Antigravity also advertises. Sign in with Google, pick a model, and go. Under the hood it handles OAuth login, native streaming, model routing, and quota diagnostics itself, so it never shells out to an external Antigravity CLI.
9
10
 
@@ -192,15 +193,18 @@ All primary environment variables start with `ANTIGRAVITY_`. The legacy `NOAGY_`
192
193
  | `ANTIGRAVITY_CATALOG_REFRESH_INTERVAL_MS` | Override catalog refresh TTL in ms. Defaults to 4 hours (`14400000`). Set to `0` to always refresh. |
193
194
  | `ANTIGRAVITY_CLIENT_ID` | Use a custom Google OAuth client ID. |
194
195
  | `ANTIGRAVITY_CLIENT_SECRET` | Use a custom Google OAuth client secret. Keep it out of source control and shell history. |
196
+ | `ANTIGRAVITY_STREAM_STALL_TIMEOUT_MS` | Maximum silence between stream chunks; default `300000` ms. Set `0` to disable. |
197
+ | `ANTIGRAVITY_STREAM_HEADER_TIMEOUT_MS` | Response-header deadline; default `180000` ms. Set `0` to disable. |
195
198
  | `ANTIGRAVITY_NO_KEEPALIVE` | Set to `1` to skip the keep-alive connection pool. |
196
199
  | `ANTIGRAVITY_NO_PREWARM` | Set to `1` to skip the TLS pre-warm request made on the first Antigravity request. |
197
200
  | `ANTIGRAVITY_NO_EXTRA_TOOLS` | Set to `1` to stop registering the model-facing `google_search` and `generate_image` tools. The `/antigravity.search` and `/antigravity.image` commands stay available. |
198
201
  | `ANTIGRAVITY_NO_SEARCH_TOOL` | Set to `1` to skip only the `google_search` tool, e.g. when another extension provides web search. |
199
202
  | `ANTIGRAVITY_NO_IMAGE_TOOL` | Set to `1` to skip only the `generate_image` tool. |
203
+ | `ANTIGRAVITY_DEFER_TOOLS` | Set to `1` to register `google_search` and `generate_image` as deferred: they aren't declared to the model, but codemode scripts can call them and `tool_search` can load them. Needs `codemode` or `tool_search` active, e.g. `"defaultTools": ["+codemode"]`. Requires Pi 0.99.2+; older Pi keeps them direct. |
200
204
 
201
205
  `pi config` can disable each model-facing tool without disabling the provider. The package loads three extension resources: `src/index.ts` (provider, OAuth, and slash commands), `src/features/google-search.ts` (`google_search`), and `src/features/generate-image.ts` (`generate_image`). Turn off a feature resource there to stop registering that tool. `/antigravity.search` and `/antigravity.image` stay available from the provider extension.
202
206
 
203
- Environment variables still force a loaded tool off, including in scripts and headless runs. They cannot turn a resource back on after `pi config` disables it, because that file is not loaded. Either control is enough to hide the tool from the model. Run `/reload` after changing `pi config` or the environment in an active session; a new Pi process also picks the change up. A restart is not required when `/reload` succeeds.
207
+ Environment variables still force a loaded tool off, including in scripts and headless runs. They cannot turn a resource back on after `pi config` disables it, because that file is not loaded. Either control is enough to hide the tool from the model. Run `/reload` after changing `pi config`.
204
208
 
205
209
  By default, the provider tries `https://daily-cloudcode-pa.googleapis.com`, then the sandbox host, then `https://cloudcode-pa.googleapis.com`. Prefer the built-in OAuth client unless you have a reason to use your own credentials.
206
210
 
@@ -216,7 +220,7 @@ Provider requests reuse a keep-alive connection pool when the runtime supports i
216
220
  - **Paste (no extra setup):** Run `/login antigravity`, open the shown URL and complete Google sign-in in _any_ browser. When it redirects to `http://localhost:51121/oauth-callback?…` and fails to load, copy that full URL from the address bar and paste it into the prompt Pi shows. The code is single-use and expires quickly, so paste promptly.
217
221
  - **SSH tunnel (reusable):** From the machine with the browser, run `ssh -N -L 51121:127.0.0.1:51121 <user>@<server>` and keep it open, then run `/login antigravity` on the server. The redirect to `localhost:51121` tunnels through to the local callback automatically.
218
222
  - **OAuth callback will not start:** Ensure port `51121` is free and `ANTIGRAVITY_CALLBACK_HOST` is a permitted loopback address.
219
- - **Model is unavailable:** Run `/antigravity.models`; availability is account- and service-dependent.
223
+ - **Model is unavailable:** Run `/antigravity.refresh`, then select a model from the updated list. Availability is account- and service-dependent; a generic resource-exhausted response alone does not prove a model was retired. Discovery uses the backend's recommended model list when supplied, since the raw catalog can retain old runtime IDs. If a resumed session selects a model removed by discovery, select another model; static routes and compatibility fallbacks do not restore models absent from the refreshed catalog.
220
224
  - **Claude/GPT tool-call schema error:** Upgrade to the latest package release. The provider adapts Pi's JSON Schema tool definitions for the Cloud Code Assist custom-tool bridge.
221
225
  - **Quota or rate limit:** Run `/antigravity.usage`. A `429` response usually indicates quota or rate limiting; changing models may still draw from the same shared pool.
222
226
  - **Need a safe diagnostic:** `/antigravity.doctor` redacts recognized secrets from its error output. Still review output before sharing it publicly.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-antigravity",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Personal Antigravity / Cloud Code Assist provider for Pi Coding Agent",
5
5
  "author": "Rahul Arya",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "packageManager": "yarn@4.18.0+sha512.fcb8716fe7cd0eece141ffc18b92193a9df9204c1ba83189c288835223fc0bbe64af473bab0d5e9927a7daeb5caf2bb07eb2787cc9338ca040ea125f2a1f2f7e",
32
32
  "engines": {
33
- "node": ">=22.15.0"
33
+ "node": ">=22.19.0"
34
34
  },
35
35
  "scripts": {
36
36
  "typecheck": "tsc --noEmit",
@@ -39,7 +39,7 @@
39
39
  "format": "prettier --write .",
40
40
  "format:check": "prettier --check .",
41
41
  "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",
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
43
  "smoke:tools": "node scripts/run-ts.mjs scripts/smoke-tool-schema.ts",
44
44
  "smoke:models": "node scripts/run-ts.mjs scripts/smoke-all-models.mjs",
45
45
  "audit": "yarn npm audit --environment production --recursive && yarn npm audit --severity high --all --recursive",
@@ -54,7 +54,8 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@earendil-works/pi-ai": "*",
57
- "@earendil-works/pi-coding-agent": "*"
57
+ "@earendil-works/pi-coding-agent": "*",
58
+ "typebox": "*"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@earendil-works/pi-ai": "^0.86.1",
@@ -69,6 +70,9 @@
69
70
  "typescript-eslint": "^8.64.0"
70
71
  },
71
72
  "dependencies": {
72
- "undici": "^8.11.2"
73
+ "undici": "^8.12.3"
74
+ },
75
+ "resolutions": {
76
+ "undici": "8.12.3"
73
77
  }
74
78
  }
@@ -4,17 +4,18 @@
4
4
  * and `/antigravity.image` without registering `generate_image`.
5
5
  */
6
6
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
- import { StringEnum, Type } from "@earendil-works/pi-ai";
7
+ import { Type } from "typebox";
8
8
  import {
9
9
  DEFAULT_IMAGE_MODEL,
10
10
  generateAntigravityImage,
11
11
  IMAGE_ASPECT_RATIOS,
12
12
  } from "../image/index.js";
13
- import { isExtraToolEnabled } from "../utils/index.js";
13
+ import { extraToolExposure, isExtraToolEnabled } from "../utils/index.js";
14
14
 
15
15
  export default function (pi: ExtensionAPI): void {
16
16
  if (!isExtraToolEnabled("IMAGE")) return;
17
17
  pi.registerTool({
18
+ ...extraToolExposure(),
18
19
  name: "generate_image",
19
20
  label: "Generate image",
20
21
  description:
@@ -25,7 +26,12 @@ export default function (pi: ExtensionAPI): void {
25
26
  ],
26
27
  parameters: Type.Object({
27
28
  prompt: Type.String({ description: "Image description." }),
28
- aspectRatio: Type.Optional(StringEnum(IMAGE_ASPECT_RATIOS)),
29
+ aspectRatio: Type.Optional(
30
+ Type.Unsafe<(typeof IMAGE_ASPECT_RATIOS)[number]>({
31
+ type: "string",
32
+ enum: [...IMAGE_ASPECT_RATIOS],
33
+ }),
34
+ ),
29
35
  model: Type.Optional(
30
36
  Type.String({
31
37
  description: `Image model id. Default: ${DEFAULT_IMAGE_MODEL}.`,
@@ -4,13 +4,14 @@
4
4
  * and `/antigravity.search` without registering `google_search`.
5
5
  */
6
6
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
- import { Type } from "@earendil-works/pi-ai";
7
+ import { Type } from "typebox";
8
8
  import { executeAntigravitySearch } from "../search/index.js";
9
- import { isExtraToolEnabled, redactSecrets } from "../utils/index.js";
9
+ import { extraToolExposure, isExtraToolEnabled, redactSecrets } from "../utils/index.js";
10
10
 
11
11
  export default function (pi: ExtensionAPI): void {
12
12
  if (!isExtraToolEnabled("SEARCH")) return;
13
13
  pi.registerTool({
14
+ ...extraToolExposure(),
14
15
  name: "google_search",
15
16
  label: "Google Search",
16
17
  description:
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { mkdir, writeFile } from "node:fs/promises";
2
+ import { constants } from "node:fs";
3
+ import { lstat, mkdir, open, realpath } from "node:fs/promises";
3
4
  import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
4
5
  import {
5
6
  antigravityHeaders,
@@ -288,9 +289,45 @@ export function parseImageResponse(chunk: ImageStreamChunk): {
288
289
  return { images, text };
289
290
  }
290
291
 
291
- async function writeImage(filePath: string, image: GeneratedImage): Promise<string> {
292
- await mkdir(dirname(filePath), { recursive: true });
293
- await writeFile(filePath, Buffer.from(image.data, "base64"));
292
+ export async function writeImage(
293
+ filePath: string,
294
+ image: GeneratedImage,
295
+ cwd: string,
296
+ ): Promise<string> {
297
+ const root = await realpath(cwd);
298
+ const rel = relative(resolve(cwd), filePath);
299
+ if (!rel || rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) {
300
+ throw new Error("Image path must stay inside the working directory");
301
+ }
302
+ let parent = root;
303
+ for (const component of relative(resolve(cwd), dirname(filePath)).split(sep).filter(Boolean)) {
304
+ parent = join(parent, component);
305
+ try {
306
+ await mkdir(parent);
307
+ } catch (error) {
308
+ if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
309
+ }
310
+ const info = await lstat(parent);
311
+ if (info.isSymbolicLink() || !info.isDirectory())
312
+ throw new Error("Image path must not traverse symlinks");
313
+ }
314
+ const target = join(root, rel);
315
+ try {
316
+ if ((await lstat(target)).isSymbolicLink())
317
+ throw new Error("Image path must not follow symlinks");
318
+ } catch (error) {
319
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
320
+ }
321
+ const handle = await open(
322
+ target,
323
+ constants.O_WRONLY | constants.O_CREAT | constants.O_TRUNC | constants.O_NOFOLLOW,
324
+ 0o600,
325
+ );
326
+ try {
327
+ await handle.writeFile(Buffer.from(image.data, "base64"));
328
+ } finally {
329
+ await handle.close();
330
+ }
294
331
  return filePath;
295
332
  }
296
333
 
@@ -368,6 +405,7 @@ export async function generateAntigravityImage(
368
405
  result.images.length > 1 ? index : undefined,
369
406
  ),
370
407
  image,
408
+ options.cwd,
371
409
  ),
372
410
  );
373
411
  }
@@ -144,7 +144,9 @@ export default function (pi: ExtensionAPI): void {
144
144
  if (process.env.PI_OFFLINE !== undefined) return;
145
145
  if (typeof ctx.modelRegistry?.refresh !== "function") return;
146
146
  try {
147
- await ctx.modelRegistry.refresh({ providers: [PROVIDER_ID] });
147
+ const refresh = ctx.modelRegistry.refresh({ providers: [PROVIDER_ID] });
148
+ if (ctx.hasUI) void refresh.catch(() => {});
149
+ else await refresh;
148
150
  } catch {
149
151
  // Last-known-good catalog stays in place. Forced refreshes still report via the command.
150
152
  }
@@ -326,7 +326,18 @@ export function resetAntigravityCatalogForTests(): void {
326
326
 
327
327
  /** Resolve public model id + thinking effort to Antigravity runtime model id. */
328
328
  export function getAntigravityRequestModelId(modelId: string, effort: string | undefined): string {
329
- const r = currentRouting[modelId] ?? ANTIGRAVITY_ROUTING[modelId];
329
+ // A selected model can outlive a catalog refresh (for example in a resumed
330
+ // session). Do not resurrect a retired route from the bootstrap catalog.
331
+ if (
332
+ currentModels !== ANTIGRAVITY_MODELS &&
333
+ !currentRouting[modelId] &&
334
+ ANTIGRAVITY_ROUTING[modelId]
335
+ ) {
336
+ throw new Error(
337
+ `Antigravity model ${modelId} is absent from the current catalog. Next: run /antigravity.refresh and select an available model.`,
338
+ );
339
+ }
340
+ const r = currentRouting[modelId];
330
341
  if (!r) return modelId;
331
342
 
332
343
  if (effort === undefined || effort === "off") {
@@ -361,6 +372,19 @@ export function getAntigravityRequestModelId(modelId: string, effort: string | u
361
372
  * provide a fallback runtime model ID (e.g. Gemini 3.7 Flash) to maintain availability.
362
373
  */
363
374
  export function getFallbackRuntimeModel(runtimeModel: string, effort?: string): string | undefined {
375
+ const fallback = legacyFallbackRuntimeModel(runtimeModel, effort);
376
+ if (!fallback || currentModels === ANTIGRAVITY_MODELS) return fallback;
377
+ // Compatibility fallbacks are only valid while the backend still advertises
378
+ // their runtime ID. Never downgrade into a retired Flash generation.
379
+ return Object.values(currentRouting).some((route) =>
380
+ [route.off, route.defaultRequestId, ...Object.values(route.routing ?? {})].includes(fallback),
381
+ )
382
+ ? fallback
383
+ : undefined;
384
+ }
385
+
386
+ /** Return the legacy Flash downgrade candidate before checking current catalog availability. */
387
+ function legacyFallbackRuntimeModel(runtimeModel: string, effort?: string): string | undefined {
364
388
  if (runtimeModel.startsWith("gemini-3.8-flash-")) {
365
389
  return runtimeModel.replace("gemini-3.8-flash-", "gemini-3.7-flash-");
366
390
  }
@@ -368,7 +392,8 @@ export function getFallbackRuntimeModel(runtimeModel: string, effort?: string):
368
392
  return "gemini-3.7-flash-low";
369
393
  }
370
394
  if (runtimeModel === "gemini-3.7-flash-tiered") {
371
- return getAntigravityRequestModelId("gemini-3.6-flash", effort);
395
+ const route = currentRouting["gemini-3.6-flash"];
396
+ return route ? getAntigravityRequestModelId("gemini-3.6-flash", effort) : undefined;
372
397
  }
373
398
  if (runtimeModel.startsWith("gemini-3.7-flash-")) {
374
399
  return runtimeModel.replace("gemini-3.7-flash-", "gemini-3.6-flash-");
@@ -550,7 +550,12 @@ async function readPageTitle(response: Response): Promise<string> {
550
550
  * metadata address, and whatever comes back is shown to the model.
551
551
  */
552
552
  async function fetchPageTitle(url: string, signal?: AbortSignal): Promise<string> {
553
- if (!url || url.includes(GROUNDING_REDIRECT_HOST)) return "";
553
+ if (!url) return "";
554
+ try {
555
+ if (new URL(url).hostname === GROUNDING_REDIRECT_HOST) return "";
556
+ } catch {
557
+ return "";
558
+ }
554
559
  // One deadline for the whole chain, so extra hops cannot multiply the wait.
555
560
  const deadline = withDeadline(signal, SOURCE_ENRICH_TIMEOUT_MS);
556
561
  let current = url;
@@ -648,7 +653,7 @@ async function enrichSources(sources: SearchSource[], signal?: AbortSignal): Pro
648
653
 
649
654
  /** Keep a label from breaking out of its link slot or its list line. */
650
655
  function escapeLinkText(text: string): string {
651
- return text.replace(/[[\]]/g, "\\$&").replace(/\s+/g, " ");
656
+ return text.replace(/[\\[\]]/g, "\\$&").replace(/\s+/g, " ");
652
657
  }
653
658
 
654
659
  /** Encode characters that would close a Markdown link destination. */
@@ -1146,7 +1146,7 @@ function asToolCallArguments(args: Record<string, unknown> | undefined): ToolCal
1146
1146
  /** Default response-header deadline for streaming requests (see fetchWithHeaderDeadline). */
1147
1147
  const STREAM_HEADER_TIMEOUT_DEFAULT_MS = 180_000;
1148
1148
  /** Default mid-body stall deadline: abort when no SSE bytes arrive for this long. */
1149
- const STREAM_STALL_TIMEOUT_DEFAULT_MS = 120_000;
1149
+ const STREAM_STALL_TIMEOUT_DEFAULT_MS = 300_000;
1150
1150
 
1151
1151
  function envTimeoutMs(name: string, fallback: number): number {
1152
1152
  const raw = antigravityEnv(name);
@@ -1176,7 +1176,9 @@ export function streamStallTimeoutMs(): number {
1176
1176
  }
1177
1177
 
1178
1178
  function stallError(stallMs: number): Error {
1179
- return new Error(`stream stalled: no data for ${stallMs}ms`);
1179
+ // "timed out" is deliberate: pi's retryable provider-error pattern matches
1180
+ // it, so a mid-body stall auto-retries instead of dying as a terminal error.
1181
+ return new Error(`stream stalled: no data for ${stallMs}ms (timed out)`);
1180
1182
  }
1181
1183
 
1182
1184
  /**
@@ -1277,7 +1279,11 @@ export async function fetchWithHeaderDeadline(
1277
1279
  const timer =
1278
1280
  timeoutMs > 0
1279
1281
  ? setTimeout(
1280
- () => controller.abort(new Error(`no response headers within ${timeoutMs}ms`)),
1282
+ () =>
1283
+ controller.abort(
1284
+ // "timed out" keeps the message on pi's retryable-error list (see stallError).
1285
+ new Error(`no response headers within ${timeoutMs}ms (timed out)`),
1286
+ ),
1281
1287
  timeoutMs,
1282
1288
  )
1283
1289
  : undefined;
@@ -1358,6 +1364,9 @@ export async function streamResponse(
1358
1364
  }
1359
1365
 
1360
1366
  const responseData = chunk.response || chunk;
1367
+ // Record the model the gateway actually served (may differ from the requested runtime model).
1368
+ if (responseData.modelVersion) output.responseModel = responseData.modelVersion;
1369
+ if (responseData.responseId) output.responseId = responseData.responseId;
1361
1370
  const candidate = responseData.candidates?.[0];
1362
1371
 
1363
1372
  for (const part of candidate?.content?.parts || []) {
@@ -1511,6 +1520,34 @@ export async function streamResponse(
1511
1520
  return hasContent;
1512
1521
  }
1513
1522
 
1523
+ /**
1524
+ * Per-turn POST counter keyed on (pi session, requestIndex): nonce 0 is the
1525
+ * first-ever request for that turn, anything above is a retry — pi's
1526
+ * auto-retry, a manual /retry, or our own empty-response loop.
1527
+ */
1528
+ const turnRequestNonces = new Map<string, number>();
1529
+
1530
+ function nextRequestNonce(turnKey: string): number {
1531
+ const nonce = turnRequestNonces.get(turnKey) ?? 0;
1532
+ turnRequestNonces.set(turnKey, nonce + 1);
1533
+ if (turnRequestNonces.size > 64) {
1534
+ const oldest = turnRequestNonces.keys().next().value;
1535
+ if (oldest !== undefined) turnRequestNonces.delete(oldest);
1536
+ }
1537
+ return nonce;
1538
+ }
1539
+
1540
+ /**
1541
+ * Upstream identity for a retry POST. The backend keys its per-session state on
1542
+ * this int64, and a crashed stream can keep generating server-side while the
1543
+ * backend serializes later same-session requests behind it — the literal retry
1544
+ * then hangs almost deterministically even though a fresh request succeeds.
1545
+ * Every POST after the first for a turn therefore mints a fresh identity.
1546
+ */
1547
+ function retrySessionSeed(sessionId: string | undefined, nonce: number): string {
1548
+ return sessionId?.trim() ? `${sessionId}:r${nonce}` : `retry:${crypto.randomUUID()}`;
1549
+ }
1550
+
1514
1551
  export function streamAntigravity(
1515
1552
  model: Model<Api>,
1516
1553
  context: Context,
@@ -1559,6 +1596,15 @@ export function streamAntigravity(
1559
1596
 
1560
1597
  let requestHeaders = antigravityHeaders(creds.token);
1561
1598
 
1599
+ // Turn identity mirrors buildRequest's requestIndex (count of successful
1600
+ // assistant messages): it stays constant across retries of one turn and
1601
+ // changes the moment any turn succeeds.
1602
+ const turnKey = `${opts.sessionId ?? "anonymous"}:${
1603
+ context.messages?.filter(
1604
+ (m) => m.role === "assistant" && m.stopReason !== "error" && m.stopReason !== "aborted",
1605
+ ).length ?? 0
1606
+ }`;
1607
+
1562
1608
  let response: Response | undefined;
1563
1609
  let lastText = "";
1564
1610
  let received = false;
@@ -1575,21 +1621,46 @@ export function streamAntigravity(
1575
1621
  runtimeModel = runtimeCandidates[candIdx]!;
1576
1622
  setLastResolvedRuntimeModel(runtimeModel);
1577
1623
  recordStaticRouteDiagnostics(runtimeModel);
1578
- const body = JSON.stringify(buildRequest(model, context, projectId, opts, runtimeModel));
1579
-
1624
+ response = undefined;
1625
+ let lastEndpointError: Error | undefined;
1580
1626
  for (const endpoint of endpointCandidates()) {
1581
1627
  setLastEndpoint(endpoint);
1582
- response = await fetchWithHeaderDeadline(
1583
- `${endpoint}/v1internal:streamGenerateContent?alt=sse`,
1584
- {
1585
- method: "POST",
1586
- headers: requestHeaders,
1587
- body,
1588
- },
1589
- opts.signal,
1590
- streamHeaderTimeoutMs(),
1591
- streamStallTimeoutMs(),
1628
+ // Every POST after the first for this turn replays under a fresh
1629
+ // upstream session/trajectory so it cannot queue behind the crashed
1630
+ // attempt's server-side generation (see retrySessionSeed).
1631
+ const nonce = nextRequestNonce(turnKey);
1632
+ const body = JSON.stringify(
1633
+ buildRequest(
1634
+ model,
1635
+ context,
1636
+ projectId,
1637
+ nonce === 0
1638
+ ? opts
1639
+ : { ...opts, sessionId: retrySessionSeed(opts.sessionId, nonce) },
1640
+ runtimeModel,
1641
+ ),
1592
1642
  );
1643
+ try {
1644
+ response = await fetchWithHeaderDeadline(
1645
+ `${endpoint}/v1internal:streamGenerateContent?alt=sse`,
1646
+ {
1647
+ method: "POST",
1648
+ headers: requestHeaders,
1649
+ body,
1650
+ },
1651
+ opts.signal,
1652
+ streamHeaderTimeoutMs(),
1653
+ streamStallTimeoutMs(),
1654
+ );
1655
+ } catch (error) {
1656
+ // Caller cancellation is not an endpoint failure — propagate it. A
1657
+ // transport failure or our own header deadline abort means this
1658
+ // endpoint may be wedged; ENDPOINT_FALLBACKS exist for that, so
1659
+ // fall through instead of dying without trying them.
1660
+ if (opts.signal?.aborted) throw error;
1661
+ lastEndpointError = error instanceof Error ? error : new Error(String(error));
1662
+ continue;
1663
+ }
1593
1664
  setLastStatus(response.status);
1594
1665
  if (response.ok) break;
1595
1666
  lastText = await response.text();
@@ -1599,6 +1670,11 @@ export function streamAntigravity(
1599
1670
  if (![403, 404, 429, 500, 502, 503, 504].includes(response.status)) break;
1600
1671
  }
1601
1672
 
1673
+ // Every endpoint threw before sending headers: rethrow the original
1674
+ // transport error so its message (which pi classifies for auto-retry)
1675
+ // survives instead of being masked by the generic failure path below.
1676
+ if (!response && lastEndpointError !== undefined) throw lastEndpointError;
1677
+
1602
1678
  if (response?.ok) break;
1603
1679
  if (response?.status === 404) {
1604
1680
  if (candIdx + 1 < runtimeCandidates.length) {
@@ -155,6 +155,8 @@ export type StreamCandidate = {
155
155
  export type StreamResponseData = {
156
156
  candidates?: StreamCandidate[];
157
157
  usageMetadata?: StreamUsageMetadata;
158
+ modelVersion?: string;
159
+ responseId?: string;
158
160
  };
159
161
 
160
162
  export type StreamChunk = StreamResponseData & {