@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.7

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 (422) hide show
  1. package/README.md +38 -352
  2. package/dist/cli.js +13757 -12857
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +1362 -1056
  5. package/dist/index.js +16038 -16162
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +1447 -1375
  8. package/dist/server.js +11254 -10921
  9. package/dist/server.js.map +4 -4
  10. package/dist/server.meta.json +1 -1
  11. package/dist/src/auth-method-labels.d.ts +3 -0
  12. package/dist/src/auth-method-labels.d.ts.map +1 -0
  13. package/dist/src/auth-method-labels.js +5 -0
  14. package/dist/src/auth-method-labels.js.map +1 -0
  15. package/dist/src/cli.d.ts +3 -1
  16. package/dist/src/cli.d.ts.map +1 -1
  17. package/dist/src/cli.js +98 -12
  18. package/dist/src/cli.js.map +1 -1
  19. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
  20. package/dist/src/common-auth-embedded/claustrum/consumer.js +134 -2
  21. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
  22. package/dist/src/common-auth-embedded/claustrum/custody.js +17 -0
  23. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  24. package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  25. package/dist/src/common-auth-embedded/claustrum/index.d.ts +3 -2
  26. package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
  27. package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  28. package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
  29. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  30. package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
  31. package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  32. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
  33. package/dist/src/common-auth-embedded/pi-slot/lock.js +7 -3
  34. package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
  35. package/dist/src/common-auth-embedded/quota/codec.js +2 -1
  36. package/dist/src/common-auth-embedded/quota/format.d.ts +40 -3
  37. package/dist/src/common-auth-embedded/quota/format.js +196 -43
  38. package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
  39. package/dist/src/common-auth-embedded/quota/index.js +2 -2
  40. package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
  41. package/dist/src/common-auth-embedded/quota/map.js +36 -1
  42. package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
  43. package/dist/src/common-auth-embedded/quota/merge.js +21 -5
  44. package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
  45. package/dist/src/common-auth-embedded/quota/projection.js +3 -1
  46. package/dist/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  47. package/dist/src/common-auth-embedded/setup/command-error.js +79 -0
  48. package/dist/src/common-auth-embedded/setup/command-runner.js +143 -0
  49. package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
  50. package/dist/src/common-auth-embedded/setup/command.js +271 -0
  51. package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
  52. package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
  53. package/dist/src/common-auth-embedded/setup/detect.js +224 -0
  54. package/dist/src/common-auth-embedded/setup/enroll.js +82 -0
  55. package/dist/src/common-auth-embedded/setup/index.d.ts +6 -0
  56. package/dist/src/common-auth-embedded/setup/index.js +5 -0
  57. package/dist/src/common-auth-embedded/setup/paths.js +33 -0
  58. package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  59. package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
  60. package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
  61. package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
  62. package/dist/src/common-auth-embedded/setup/register.js +136 -0
  63. package/dist/src/common-auth-embedded/setup/types.d.ts +150 -0
  64. package/dist/src/common-auth-embedded/source-output.json +265 -101
  65. package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
  66. package/dist/src/common-auth-embedded/store/pool.js +0 -1
  67. package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  68. package/dist/src/common-auth-embedded/store/refresh-lock.js +0 -1
  69. package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
  70. package/dist/src/common-auth-embedded/store/schema.js +3 -2
  71. package/dist/src/ga/rpc/protocol.d.ts +4 -7
  72. package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
  73. package/dist/src/ga/rpc/protocol.js +5 -13
  74. package/dist/src/ga/rpc/protocol.js.map +1 -1
  75. package/dist/src/ga/server/auth.d.ts +8 -3
  76. package/dist/src/ga/server/auth.d.ts.map +1 -1
  77. package/dist/src/ga/server/auth.js +25 -9
  78. package/dist/src/ga/server/auth.js.map +1 -1
  79. package/dist/src/ga/server/index.d.ts +39 -12
  80. package/dist/src/ga/server/index.d.ts.map +1 -1
  81. package/dist/src/ga/server/index.js +218 -55
  82. package/dist/src/ga/server/index.js.map +1 -1
  83. package/dist/src/ga/server/pool-login.d.ts +22 -0
  84. package/dist/src/ga/server/pool-login.d.ts.map +1 -0
  85. package/dist/src/ga/server/pool-login.js +150 -0
  86. package/dist/src/ga/server/pool-login.js.map +1 -0
  87. package/dist/src/ga/tui/host-ga.d.ts +2 -5
  88. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  89. package/dist/src/ga/tui/host-ga.js +54 -52
  90. package/dist/src/ga/tui/host-ga.js.map +1 -1
  91. package/dist/src/plugin/accounts.d.ts +1 -1
  92. package/dist/src/plugin/accounts.d.ts.map +1 -1
  93. package/dist/src/plugin/accounts.js +1 -0
  94. package/dist/src/plugin/accounts.js.map +1 -1
  95. package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  96. package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  97. package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
  98. package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
  99. package/dist/src/plugin/command-apply.d.ts +2 -2
  100. package/dist/src/plugin/command-apply.d.ts.map +1 -1
  101. package/dist/src/plugin/command-apply.js +3 -10
  102. package/dist/src/plugin/command-apply.js.map +1 -1
  103. package/dist/src/plugin/commands.d.ts +1 -0
  104. package/dist/src/plugin/commands.d.ts.map +1 -1
  105. package/dist/src/plugin/commands.js +2 -2
  106. package/dist/src/plugin/commands.js.map +1 -1
  107. package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
  108. package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  109. package/dist/src/plugin/config/operator-settings-schema.js +0 -5
  110. package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
  111. package/dist/src/plugin/config/schema.d.ts +0 -7
  112. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  113. package/dist/src/plugin/config/schema.js +2 -44
  114. package/dist/src/plugin/config/schema.js.map +1 -1
  115. package/dist/src/plugin/config/writer.d.ts +1 -1
  116. package/dist/src/plugin/config/writer.js +1 -1
  117. package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
  118. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
  119. package/dist/src/plugin/fetch/retry-state.js +0 -6
  120. package/dist/src/plugin/fetch/retry-state.js.map +1 -1
  121. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  122. package/dist/src/plugin/fetch-interceptor.js +0 -3
  123. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  124. package/dist/src/plugin/fetch-routing.d.ts +0 -16
  125. package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
  126. package/dist/src/plugin/fetch-routing.js +0 -49
  127. package/dist/src/plugin/fetch-routing.js.map +1 -1
  128. package/dist/src/plugin/ga-location-services.d.ts +14 -9
  129. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  130. package/dist/src/plugin/ga-location-services.js +124 -43
  131. package/dist/src/plugin/ga-location-services.js.map +1 -1
  132. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  133. package/dist/src/plugin/gemini-dump.js +2 -5
  134. package/dist/src/plugin/gemini-dump.js.map +1 -1
  135. package/dist/src/plugin/google-origin.d.ts +7 -0
  136. package/dist/src/plugin/google-origin.d.ts.map +1 -0
  137. package/dist/src/plugin/google-origin.js +14 -0
  138. package/dist/src/plugin/google-origin.js.map +1 -0
  139. package/dist/src/plugin/index.d.ts.map +1 -1
  140. package/dist/src/plugin/index.js +18 -7
  141. package/dist/src/plugin/index.js.map +1 -1
  142. package/dist/src/plugin/logging-utils.d.ts.map +1 -1
  143. package/dist/src/plugin/logging-utils.js +2 -5
  144. package/dist/src/plugin/logging-utils.js.map +1 -1
  145. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  146. package/dist/src/plugin/oauth-methods.js +0 -33
  147. package/dist/src/plugin/oauth-methods.js.map +1 -1
  148. package/dist/src/plugin/operator-settings.d.ts +1 -1
  149. package/dist/src/plugin/operator-settings.d.ts.map +1 -1
  150. package/dist/src/plugin/operator-settings.js +1 -8
  151. package/dist/src/plugin/operator-settings.js.map +1 -1
  152. package/dist/src/plugin/quota.d.ts +11 -7
  153. package/dist/src/plugin/quota.d.ts.map +1 -1
  154. package/dist/src/plugin/quota.js +128 -102
  155. package/dist/src/plugin/quota.js.map +1 -1
  156. package/dist/src/plugin/request.d.ts +6 -5
  157. package/dist/src/plugin/request.d.ts.map +1 -1
  158. package/dist/src/plugin/request.js +95 -180
  159. package/dist/src/plugin/request.js.map +1 -1
  160. package/dist/src/plugin/server.d.ts.map +1 -1
  161. package/dist/src/plugin/server.js +60 -53
  162. package/dist/src/plugin/server.js.map +1 -1
  163. package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
  164. package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  165. package/dist/src/plugin/shared/advisory-repository.js +91 -0
  166. package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
  167. package/dist/src/plugin/shared/request-services.d.ts +27 -26
  168. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  169. package/dist/src/plugin/shared/request-services.js +244 -245
  170. package/dist/src/plugin/shared/request-services.js.map +1 -1
  171. package/dist/src/plugin/shared/runtime.js +4 -2
  172. package/dist/src/plugin/shared/runtime.js.map +1 -1
  173. package/dist/src/plugin/shared/vault-request-credentials.d.ts +16 -4
  174. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  175. package/dist/src/plugin/shared/vault-request-credentials.js +44 -7
  176. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  177. package/dist/src/plugin/storage.d.ts +2 -2
  178. package/dist/src/plugin/storage.d.ts.map +1 -1
  179. package/dist/src/plugin/storage.js.map +1 -1
  180. package/dist/src/plugin/vault-custody.d.ts +14 -1
  181. package/dist/src/plugin/vault-custody.d.ts.map +1 -1
  182. package/dist/src/plugin/vault-custody.js +203 -44
  183. package/dist/src/plugin/vault-custody.js.map +1 -1
  184. package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
  185. package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  186. package/dist/src/plugin/vault-quota-outcome.js +47 -0
  187. package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
  188. package/dist/src/quota-presentation.d.ts +29 -1
  189. package/dist/src/quota-presentation.d.ts.map +1 -1
  190. package/dist/src/quota-presentation.js +52 -17
  191. package/dist/src/quota-presentation.js.map +1 -1
  192. package/dist/src/setup.d.ts +15 -0
  193. package/dist/src/setup.d.ts.map +1 -0
  194. package/dist/src/setup.js +320 -0
  195. package/dist/src/setup.js.map +1 -0
  196. package/dist/src/sidebar-projection.d.ts +5 -1
  197. package/dist/src/sidebar-projection.d.ts.map +1 -1
  198. package/dist/src/sidebar-projection.js +6 -2
  199. package/dist/src/sidebar-projection.js.map +1 -1
  200. package/dist/src/sidebar-state.d.ts +1 -1
  201. package/dist/src/sidebar-state.d.ts.map +1 -1
  202. package/dist/src/sidebar-state.js +19 -1
  203. package/dist/src/sidebar-state.js.map +1 -1
  204. package/dist/src/tui/quota-layout.d.ts +94 -0
  205. package/dist/src/tui/quota-layout.d.ts.map +1 -0
  206. package/dist/src/tui/quota-layout.js +139 -0
  207. package/dist/src/tui/quota-layout.js.map +1 -0
  208. package/dist/src/tui/route-layout.d.ts +8 -0
  209. package/dist/src/tui/route-layout.d.ts.map +1 -0
  210. package/dist/src/tui/route-layout.js +36 -0
  211. package/dist/src/tui/route-layout.js.map +1 -0
  212. package/dist/src/tui.d.ts.map +1 -1
  213. package/dist/src/tui.js +120 -127
  214. package/dist/src/tui.js.map +1 -1
  215. package/dist/tui-build-map.json +66 -37
  216. package/dist/tui-ga-build-map.json +66 -37
  217. package/dist/types/src/auth-method-labels.d.ts +3 -0
  218. package/dist/types/src/auth-method-labels.d.ts.map +1 -0
  219. package/dist/types/src/cli.d.ts +3 -1
  220. package/dist/types/src/cli.d.ts.map +1 -1
  221. package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  222. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +142 -0
  223. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +207 -0
  224. package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
  225. package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  226. package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  227. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
  228. package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  229. package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  230. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
  231. package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  232. package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  233. package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  234. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  235. package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  236. package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  237. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  238. package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
  239. package/dist/types/src/common-auth-embedded/quota/format.d.ts +40 -3
  240. package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
  241. package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
  242. package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
  243. package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
  244. package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
  245. package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
  246. package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  247. package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
  248. package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  249. package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  250. package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
  251. package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
  252. package/dist/types/src/common-auth-embedded/setup/index.d.ts +6 -0
  253. package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  254. package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
  255. package/dist/types/src/common-auth-embedded/setup/types.d.ts +150 -0
  256. package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
  257. package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  258. package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
  259. package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
  260. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  261. package/dist/types/src/ga/server/auth.d.ts +8 -3
  262. package/dist/types/src/ga/server/auth.d.ts.map +1 -1
  263. package/dist/types/src/ga/server/index.d.ts +39 -12
  264. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  265. package/dist/types/src/ga/server/pool-login.d.ts +22 -0
  266. package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
  267. package/dist/types/src/plugin/accounts.d.ts +1 -1
  268. package/dist/types/src/plugin/accounts.d.ts.map +1 -1
  269. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  270. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  271. package/dist/types/src/plugin/command-apply.d.ts +2 -2
  272. package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
  273. package/dist/types/src/plugin/commands.d.ts +1 -0
  274. package/dist/types/src/plugin/commands.d.ts.map +1 -1
  275. package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
  276. package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  277. package/dist/types/src/plugin/config/schema.d.ts +0 -7
  278. package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
  279. package/dist/types/src/plugin/config/writer.d.ts +1 -1
  280. package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
  281. package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
  282. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
  283. package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
  284. package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
  285. package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
  286. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  287. package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
  288. package/dist/types/src/plugin/google-origin.d.ts +7 -0
  289. package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
  290. package/dist/types/src/plugin/index.d.ts.map +1 -1
  291. package/dist/types/src/plugin/logging-utils.d.ts.map +1 -1
  292. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
  293. package/dist/types/src/plugin/operator-settings.d.ts +1 -1
  294. package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
  295. package/dist/types/src/plugin/quota.d.ts +11 -7
  296. package/dist/types/src/plugin/quota.d.ts.map +1 -1
  297. package/dist/types/src/plugin/request.d.ts +6 -5
  298. package/dist/types/src/plugin/request.d.ts.map +1 -1
  299. package/dist/types/src/plugin/server.d.ts.map +1 -1
  300. package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
  301. package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  302. package/dist/types/src/plugin/shared/request-services.d.ts +27 -26
  303. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  304. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +16 -4
  305. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  306. package/dist/types/src/plugin/storage.d.ts +2 -2
  307. package/dist/types/src/plugin/storage.d.ts.map +1 -1
  308. package/dist/types/src/plugin/vault-custody.d.ts +14 -1
  309. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
  310. package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
  311. package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  312. package/dist/types/src/setup.d.ts +15 -0
  313. package/dist/types/src/setup.d.ts.map +1 -0
  314. package/dist/types/src/sidebar-state.d.ts +1 -1
  315. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  316. package/package.json +5 -4
  317. package/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
  318. package/src/common-auth-embedded/claustrum/consumer.js +134 -2
  319. package/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
  320. package/src/common-auth-embedded/claustrum/custody.js +17 -0
  321. package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  322. package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  323. package/src/common-auth-embedded/claustrum/index.d.ts +3 -2
  324. package/src/common-auth-embedded/claustrum/index.js +5 -3
  325. package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  326. package/src/common-auth-embedded/claustrum/insula.js +152 -0
  327. package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  328. package/src/common-auth-embedded/claustrum/roster.js +33 -3
  329. package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  330. package/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
  331. package/src/common-auth-embedded/pi-slot/lock.js +7 -3
  332. package/src/common-auth-embedded/quota/codec.d.ts +2 -0
  333. package/src/common-auth-embedded/quota/codec.js +2 -1
  334. package/src/common-auth-embedded/quota/format.d.ts +40 -3
  335. package/src/common-auth-embedded/quota/format.js +196 -43
  336. package/src/common-auth-embedded/quota/index.d.ts +4 -4
  337. package/src/common-auth-embedded/quota/index.js +2 -2
  338. package/src/common-auth-embedded/quota/map.d.ts +11 -0
  339. package/src/common-auth-embedded/quota/map.js +36 -1
  340. package/src/common-auth-embedded/quota/merge.d.ts +3 -1
  341. package/src/common-auth-embedded/quota/merge.js +21 -5
  342. package/src/common-auth-embedded/quota/projection.d.ts +2 -1
  343. package/src/common-auth-embedded/quota/projection.js +3 -1
  344. package/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  345. package/src/common-auth-embedded/setup/command-error.js +79 -0
  346. package/src/common-auth-embedded/setup/command-runner.js +143 -0
  347. package/src/common-auth-embedded/setup/command.d.ts +3 -0
  348. package/src/common-auth-embedded/setup/command.js +271 -0
  349. package/src/common-auth-embedded/setup/config-write.js +60 -0
  350. package/src/common-auth-embedded/setup/detect.d.ts +6 -0
  351. package/src/common-auth-embedded/setup/detect.js +224 -0
  352. package/src/common-auth-embedded/setup/enroll.js +82 -0
  353. package/src/common-auth-embedded/setup/index.d.ts +6 -0
  354. package/src/common-auth-embedded/setup/index.js +5 -0
  355. package/src/common-auth-embedded/setup/paths.js +33 -0
  356. package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  357. package/src/common-auth-embedded/setup/process-fence.js +270 -0
  358. package/src/common-auth-embedded/setup/prompts.js +26 -0
  359. package/src/common-auth-embedded/setup/register.d.ts +11 -0
  360. package/src/common-auth-embedded/setup/register.js +136 -0
  361. package/src/common-auth-embedded/setup/types.d.ts +150 -0
  362. package/src/common-auth-embedded/source-output.json +265 -101
  363. package/src/common-auth-embedded/store/pool.d.ts +1 -1
  364. package/src/common-auth-embedded/store/pool.js +0 -1
  365. package/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  366. package/src/common-auth-embedded/store/refresh-lock.js +0 -1
  367. package/src/common-auth-embedded/store/schema.d.ts +2 -0
  368. package/src/common-auth-embedded/store/schema.js +3 -2
  369. package/src/sidebar-state.ts +19 -2
  370. package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
  371. package/src/tui-compiled/common-auth-embedded/quota/format.js +196 -43
  372. package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
  373. package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
  374. package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
  375. package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
  376. package/src/tui-compiled/quota-presentation.js +42 -9
  377. package/src/tui-compiled/sidebar-state.js +15 -1
  378. package/src/tui-compiled/tui/quota-layout.js +378 -0
  379. package/src/tui-compiled/tui/route-layout.js +30 -0
  380. package/src/tui-compiled/tui.js +271 -371
  381. package/src/tui-ga-compiled/host-ga.js +93 -90
  382. package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
  383. package/src/tui-ga-compiled/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
  384. package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
  385. package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
  386. package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  387. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +196 -43
  388. package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
  389. package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
  390. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +378 -0
  391. package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
  392. package/src/tui-ga-raw/host-ga.tsx +102 -92
  393. package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
  394. package/src/tui-ga-raw/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
  395. package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
  396. package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
  397. package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  398. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +196 -43
  399. package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
  400. package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
  401. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +391 -0
  402. package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
  403. package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
  404. package/src/tui-raw/common-auth-embedded/quota/format.js +196 -43
  405. package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
  406. package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
  407. package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
  408. package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
  409. package/src/tui-raw/quota-presentation.js +42 -9
  410. package/src/tui-raw/sidebar-state.js +15 -1
  411. package/src/tui-raw/tui/quota-layout.tsx +391 -0
  412. package/src/tui-raw/tui/route-layout.js +30 -0
  413. package/src/tui-raw/tui.tsx +218 -272
  414. package/src/tui.tsx +218 -272
  415. package/dist/src/tui/vault-setup.d.ts +0 -98
  416. package/dist/src/tui/vault-setup.d.ts.map +0 -1
  417. package/dist/src/tui/vault-setup.js +0 -198
  418. package/dist/src/tui/vault-setup.js.map +0 -1
  419. package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
  420. package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
  421. package/dist/types/src/quota-presentation.d.ts +0 -18
  422. package/dist/types/src/quota-presentation.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import crypto from 'node:crypto';
2
- import { applyAgyNativeGenerationConfig, getAgyNativeModel, isGeminiArgonModel, isRetiredAgyModel, } from '@cortexkit/antigravity-auth-core';
3
- import { ANTIGRAVITY_DEFAULT_PROJECT_ID, ANTIGRAVITY_ENDPOINT, CLAUDE_DESCRIPTION_PROMPT, CLAUDE_TOOL_SYSTEM_INSTRUCTION, EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION, EMPTY_SCHEMA_PLACEHOLDER_NAME, GEMINI_CLI_ENDPOINT, getRandomizedHeaders, SKIP_THOUGHT_SIGNATURE, } from '../constants';
2
+ import { applyAgyNativeGenerationConfig, getAgyNativeModel, isGeminiArgonModel, isRetiredAgyModel, maskSensitiveIdentifier, redactProjectIdText, } from '@cortexkit/antigravity-auth-core';
3
+ import { ANTIGRAVITY_DEFAULT_PROJECT_ID, ANTIGRAVITY_ENDPOINT, CLAUDE_DESCRIPTION_PROMPT, CLAUDE_TOOL_SYSTEM_INSTRUCTION, EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION, EMPTY_SCHEMA_PLACEHOLDER_NAME, getRandomizedHeaders, SKIP_THOUGHT_SIGNATURE, } from '../constants';
4
4
  import { buildAgyAgentRequestMetadata, createAgyRequestSessionContext, orderAgyRequestPayloadInPlace, } from './agy-request-metadata';
5
5
  import { cacheSignature, getCachedSignature, } from './cache';
6
6
  import { getKeepThinking } from './config';
@@ -8,12 +8,13 @@ import { createStreamingTransformer, transformSseLine, transformStreamingPayload
8
8
  import { DEBUG_MESSAGE_PREFIX, isDebugTuiEnabled, logAntigravityDebugResponse, logCacheStats, } from './debug';
9
9
  import { buildFingerprintHeaders, generateFingerprint, getSessionFingerprint, } from './fingerprint';
10
10
  import { appendGeminiDumpResponseText, createGeminiDumpResponseTransform, noteGeminiDumpResponse, } from './gemini-dump';
11
+ import { isCanonicalGoogleOrigin } from "./google-origin.js";
11
12
  import { createLogger } from './logger';
12
13
  import { detectErrorType } from './recovery';
13
14
  import { applyToolPairingFixes, cleanJSONSchemaForAntigravity, deepFilterThinkingBlocks, extractThinkingConfig, extractUsageFromSsePayload, extractUsageMetadata, extractVariantThinkingConfig, fixToolResponseGrouping, injectParameterSignatures, injectToolHardeningInstruction, isThinkingCapableModel, normalizeThinkingConfig, parseAntigravityApiBody, resolveThinkingConfig, rewriteAntigravityPreviewAccessError, transformThinkingParts, validateAndFixClaudeToolPairing, } from './request-helpers';
14
15
  import { defaultSignatureStore } from './stores/signature-store';
15
16
  import { analyzeConversationState, closeToolLoopForThinking, needsThinkingRecovery, } from './thinking-recovery';
16
- import { appendClaudeThinkingHint, applyGeminiTransforms, buildImageGenerationConfig, computeClaudeMaxOutputTokens, isClaudeModel, isClaudeThinkingModel, isGemini3Model, isImageGenerationModel, resolveModelForHeaderStyle, } from './transform';
17
+ import { appendClaudeThinkingHint, applyGeminiTransforms, buildImageGenerationConfig, computeClaudeMaxOutputTokens, isClaudeModel, isClaudeThinkingModel, isGemini3Model, isImageGenerationModel, resolveAntigravityModel, } from './transform';
17
18
  import { sanitizeCrossModelPayloadInPlace } from './transform/cross-model-sanitizer';
18
19
  const log = createLogger('request');
19
20
  const PLUGIN_SESSION_ID = `-${crypto.randomUUID()}`;
@@ -112,10 +113,7 @@ function getAgyMaxOutputTokens(model) {
112
113
  }
113
114
  return undefined;
114
115
  }
115
- function applyAgyGenerationDefaults(model, generationConfig, headerStyle) {
116
- if (headerStyle !== 'antigravity') {
117
- return;
118
- }
116
+ function applyAgyGenerationDefaults(model, generationConfig) {
119
117
  if (getAgyNativeModel(model)) {
120
118
  applyAgyNativeGenerationConfig(model, generationConfig);
121
119
  return;
@@ -1039,15 +1037,14 @@ export function fetchInputToUrl(input) {
1039
1037
  * interceptor entirely.
1040
1038
  */
1041
1039
  export function isGenerativeLanguageRequest(input) {
1042
- return fetchInputToUrl(input).includes('generativelanguage.googleapis.com');
1040
+ return isCanonicalGoogleOrigin(fetchInputToUrl(input));
1043
1041
  }
1044
- function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId, endpointOverride, headerStyle = 'antigravity', forceThinkingRecovery = false, options) {
1042
+ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId, endpointOverride, forceThinkingRecovery = false, options) {
1045
1043
  const baseInit = { ...init };
1046
1044
  const headers = new Headers(init?.headers ?? {});
1047
1045
  let resolvedProjectId = projectId?.trim() || '';
1048
1046
  let toolDebugMissing = 0;
1049
1047
  const toolDebugSummaries = [];
1050
- let toolDebugPayload;
1051
1048
  let sessionId;
1052
1049
  let needsSignedThinkingWarmup = false;
1053
1050
  let thinkingRecoveryMessage;
@@ -1056,7 +1053,7 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1056
1053
  request: input,
1057
1054
  init: { ...baseInit, headers },
1058
1055
  streaming: false,
1059
- headerStyle,
1056
+ headerStyle: 'antigravity',
1060
1057
  };
1061
1058
  }
1062
1059
  headers.set('Authorization', `Bearer ${accessToken}`);
@@ -1069,8 +1066,10 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1069
1066
  headers.delete('x-opencode-parent-session-id');
1070
1067
  // Strip x-goog-user-project header to prevent 403 auth/license conflicts.
1071
1068
  // This header is added by OpenCode/AI SDK and can force project-level checks
1072
- // that are not required for Antigravity/Gemini CLI OAuth requests.
1069
+ // that are not required for Antigravity OAuth requests.
1073
1070
  headers.delete('x-goog-user-project');
1071
+ headers.delete('X-Goog-Api-Client');
1072
+ headers.delete('Client-Metadata');
1074
1073
  const urlString = fetchInputToUrl(input);
1075
1074
  const match = urlString.match(/\/models\/([^:]+):(\w+)/);
1076
1075
  if (!match) {
@@ -1078,15 +1077,15 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1078
1077
  request: input,
1079
1078
  init: { ...baseInit, headers },
1080
1079
  streaming: false,
1081
- headerStyle,
1080
+ headerStyle: 'antigravity',
1082
1081
  };
1083
1082
  }
1084
1083
  const [, rawModel = '', rawAction = ''] = match;
1085
1084
  const requestedModel = rawModel;
1086
- const resolved = resolveModelForHeaderStyle(rawModel, headerStyle);
1085
+ const resolved = resolveAntigravityModel(rawModel);
1087
1086
  let effectiveModel = resolved.actualModel;
1088
1087
  const streaming = rawAction === STREAM_ACTION;
1089
- const defaultEndpoint = headerStyle === 'gemini-cli' ? GEMINI_CLI_ENDPOINT : ANTIGRAVITY_ENDPOINT;
1088
+ const defaultEndpoint = ANTIGRAVITY_ENDPOINT;
1090
1089
  const baseEndpoint = endpointOverride ?? defaultEndpoint;
1091
1090
  const transformedUrl = `${baseEndpoint}/v1internal:${rawAction}${streaming ? '?alt=sse' : ''}`;
1092
1091
  const isClaude = isClaudeModel(resolved.actualModel);
@@ -1106,15 +1105,13 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1106
1105
  ...parsedBody,
1107
1106
  model: effectiveModel,
1108
1107
  };
1109
- if (headerStyle === 'antigravity') {
1110
- if (typeof wrappedBody.userAgent !== 'string' ||
1111
- !wrappedBody.userAgent) {
1112
- wrappedBody.userAgent = 'antigravity';
1113
- }
1114
- if (typeof wrappedBody.requestType !== 'string' ||
1115
- !wrappedBody.requestType) {
1116
- wrappedBody.requestType = 'agent';
1117
- }
1108
+ if (typeof wrappedBody.userAgent !== 'string' ||
1109
+ !wrappedBody.userAgent) {
1110
+ wrappedBody.userAgent = 'antigravity';
1111
+ }
1112
+ if (typeof wrappedBody.requestType !== 'string' ||
1113
+ !wrappedBody.requestType) {
1114
+ wrappedBody.requestType = 'agent';
1118
1115
  }
1119
1116
  // Some callers may already send an Antigravity-wrapped body.
1120
1117
  // We still need to sanitize Claude thinking blocks (remove cache_control)
@@ -1161,34 +1158,26 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1161
1158
  // Step 3: Apply tool pairing fixes (ID assignment, response matching, orphan recovery)
1162
1159
  applyToolPairingFixes(req, true);
1163
1160
  }
1164
- if (headerStyle === 'antigravity') {
1165
- sanitizeRequestPayloadForAntigravity(req);
1166
- stripUnsupportedAntigravityFields(req);
1167
- configureAntigravityToolCalling(req, effectiveModel);
1168
- normalizeNativeFunctionResponseRoles(req);
1169
- }
1161
+ sanitizeRequestPayloadForAntigravity(req);
1162
+ stripUnsupportedAntigravityFields(req);
1163
+ configureAntigravityToolCalling(req, effectiveModel);
1164
+ normalizeNativeFunctionResponseRoles(req);
1170
1165
  }
1171
- // AGY rejects every request that ends with a model turn. Enforce this at
1172
- // the final wire boundary because host races, recovery, or sanitization can
1173
- // otherwise leave a model/assistant entry last. Claude fallback transports
1174
- // have the same assistant-prefill restriction.
1175
- if (headerStyle === 'antigravity' || isClaude) {
1176
- for (const req of requestObjects) {
1177
- if (Array.isArray(req.contents)) {
1178
- const contents = req.contents;
1179
- const lastContent = contents[contents.length - 1];
1180
- if (lastContent?.role === 'model' ||
1181
- lastContent?.role === 'assistant') {
1182
- contents.push({ role: 'user', parts: [{ text: '[Continue]' }] });
1183
- }
1166
+ for (const req of requestObjects) {
1167
+ if (Array.isArray(req.contents)) {
1168
+ const contents = req.contents;
1169
+ const lastContent = contents[contents.length - 1];
1170
+ if (lastContent?.role === 'model' ||
1171
+ lastContent?.role === 'assistant') {
1172
+ contents.push({ role: 'user', parts: [{ text: '[Continue]' }] });
1184
1173
  }
1185
- if (Array.isArray(req.messages)) {
1186
- const messages = req.messages;
1187
- const lastMessage = messages[messages.length - 1];
1188
- if (lastMessage?.role === 'model' ||
1189
- lastMessage?.role === 'assistant') {
1190
- messages.push({ role: 'user', parts: [{ text: '[Continue]' }] });
1191
- }
1174
+ }
1175
+ if (Array.isArray(req.messages)) {
1176
+ const messages = req.messages;
1177
+ const lastMessage = messages[messages.length - 1];
1178
+ if (lastMessage?.role === 'model' ||
1179
+ lastMessage?.role === 'assistant') {
1180
+ messages.push({ role: 'user', parts: [{ text: '[Continue]' }] });
1192
1181
  }
1193
1182
  }
1194
1183
  }
@@ -1207,7 +1196,7 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1207
1196
  }
1208
1197
  const wireRequest = requestObjects.at(-1);
1209
1198
  if (wireRequest) {
1210
- if (headerStyle === 'antigravity') {
1199
+ {
1211
1200
  const generationConfig = wireRequest.generationConfig;
1212
1201
  const config = generationConfig &&
1213
1202
  typeof generationConfig === 'object' &&
@@ -1223,18 +1212,12 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1223
1212
  wireRequest.labels = metadata.labels;
1224
1213
  orderAgyRequestPayloadInPlace(wireRequest);
1225
1214
  }
1226
- else {
1227
- wireRequest.sessionId = signatureSessionKey;
1228
- }
1229
1215
  }
1230
- body = safeStringify(headerStyle === 'antigravity'
1231
- ? orderAntigravityEnvelope(wrappedBody)
1232
- : wrappedBody);
1216
+ body = safeStringify(orderAntigravityEnvelope(wrappedBody));
1233
1217
  }
1234
1218
  else {
1235
1219
  const requestPayload = { ...parsedBody };
1236
- if (headerStyle === 'antigravity' &&
1237
- isImageGenerationModel(effectiveModel) &&
1220
+ if (isImageGenerationModel(effectiveModel) &&
1238
1221
  isOpenCodeTitleGenerationRequest(requestPayload)) {
1239
1222
  // OpenCode runs title generation through the active model. Route that
1240
1223
  // text-only helper call away from image generation to avoid consuming
@@ -1245,7 +1228,8 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1245
1228
  }
1246
1229
  const rawGenerationConfig = requestPayload.generationConfig;
1247
1230
  const extraBody = requestPayload.extra_body;
1248
- const variantConfig = extractVariantThinkingConfig(requestPayload.providerOptions, rawGenerationConfig);
1231
+ const variantConfig = options?.variant ??
1232
+ extractVariantThinkingConfig(requestPayload.providerOptions, rawGenerationConfig);
1249
1233
  const isGemini3 = effectiveModel.toLowerCase().includes('gemini-3');
1250
1234
  wire.logger.debug(`[ThinkingResolution] rawModel=${rawModel} resolvedModel=${effectiveModel} resolvedTier=${tierThinkingLevel ?? 'none'} variantLevel=${variantConfig?.thinkingLevel ?? 'none'} variantBudget=${variantConfig?.thinkingBudget ?? 'none'} providerOptions.google=${JSON.stringify(requestPayload.providerOptions?.google ?? null)} generationConfig.thinkingConfig=${JSON.stringify(rawGenerationConfig?.thinkingConfig ?? null)}`);
1251
1235
  // providerOptions belongs to the host AI SDK and is only used above to
@@ -1260,7 +1244,7 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1260
1244
  .replace(/-preview-customtools$/i, '')
1261
1245
  .replace(/-preview$/i, '')
1262
1246
  .replace(/-(minimal|low|medium|high)$/i, '');
1263
- const variantResolved = resolveModelForHeaderStyle(`${variantModelBase}-${variantConfig.thinkingLevel}`, headerStyle);
1247
+ const variantResolved = resolveAntigravityModel(`${variantModelBase}-${variantConfig.thinkingLevel}`);
1264
1248
  effectiveModel = variantResolved.actualModel;
1265
1249
  tierThinkingBudget = variantResolved.thinkingBudget;
1266
1250
  tierThinkingLevel =
@@ -1290,7 +1274,9 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1290
1274
  // Resolve thinking configuration based on user settings and model capabilities
1291
1275
  // Image generation models don't support thinking - skip thinking config entirely
1292
1276
  const isImageModel = isImageGenerationModel(effectiveModel);
1293
- const userThinkingConfig = isImageModel
1277
+ // A catalog selection owns thinking; body settings may be host defaults
1278
+ // for a different effort and must not disable the selected effort.
1279
+ const userThinkingConfig = isImageModel || options?.variant
1294
1280
  ? undefined
1295
1281
  : extractThinkingConfig(requestPayload, rawGenerationConfig, extraBody);
1296
1282
  const hasAssistantHistory = Array.isArray(requestPayload.contents) &&
@@ -1356,16 +1342,7 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1356
1342
  const thinkingBudget = tierThinkingBudget ?? normalizedThinking.thinkingBudget;
1357
1343
  // Build thinking config based on model type
1358
1344
  let thinkingConfig;
1359
- if (isClaudeThinking && headerStyle !== 'antigravity') {
1360
- // Claude-on-Gemini fallback uses snake_case keys.
1361
- thinkingConfig = {
1362
- include_thoughts: normalizedThinking.includeThoughts ?? true,
1363
- ...(typeof thinkingBudget === 'number' && thinkingBudget > 0
1364
- ? { thinking_budget: thinkingBudget }
1365
- : {}),
1366
- };
1367
- }
1368
- else if (tierThinkingLevel) {
1345
+ if (tierThinkingLevel) {
1369
1346
  // Gemini 3 uses thinkingLevel string (low/medium/high)
1370
1347
  thinkingConfig = {
1371
1348
  includeThoughts: normalizedThinking.includeThoughts,
@@ -1384,13 +1361,13 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1384
1361
  }
1385
1362
  if (rawGenerationConfig) {
1386
1363
  rawGenerationConfig.thinkingConfig = thinkingConfig;
1387
- applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig, headerStyle);
1364
+ applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig);
1388
1365
  if (isClaudeThinking &&
1389
1366
  typeof thinkingBudget === 'number' &&
1390
1367
  thinkingBudget > 0) {
1391
1368
  const currentMax = (rawGenerationConfig.maxOutputTokens ??
1392
1369
  rawGenerationConfig.max_output_tokens);
1393
- if (headerStyle === 'antigravity' && !currentMax) {
1370
+ if (!currentMax) {
1394
1371
  rawGenerationConfig.maxOutputTokens = 64000;
1395
1372
  }
1396
1373
  else if (!currentMax || currentMax <= thinkingBudget) {
@@ -1410,22 +1387,19 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1410
1387
  if (isClaudeThinking &&
1411
1388
  typeof thinkingBudget === 'number' &&
1412
1389
  thinkingBudget > 0) {
1413
- generationConfig.maxOutputTokens =
1414
- headerStyle === 'antigravity'
1415
- ? 64000
1416
- : computeClaudeMaxOutputTokens(thinkingBudget);
1390
+ generationConfig.maxOutputTokens = 64000;
1417
1391
  }
1418
- applyAgyGenerationDefaults(effectiveModel, generationConfig, headerStyle);
1392
+ applyAgyGenerationDefaults(effectiveModel, generationConfig);
1419
1393
  requestPayload.generationConfig = generationConfig;
1420
1394
  }
1421
1395
  }
1422
1396
  else if (rawGenerationConfig?.thinkingConfig) {
1423
1397
  delete rawGenerationConfig.thinkingConfig;
1424
- applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig, headerStyle);
1398
+ applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig);
1425
1399
  requestPayload.generationConfig = rawGenerationConfig;
1426
1400
  }
1427
1401
  else if (rawGenerationConfig) {
1428
- applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig, headerStyle);
1402
+ applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig);
1429
1403
  requestPayload.generationConfig = rawGenerationConfig;
1430
1404
  }
1431
1405
  } // End of else block for non-image models
@@ -1440,36 +1414,6 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1440
1414
  requestPayload.systemInstruction = requestPayload.system_instruction;
1441
1415
  delete requestPayload.system_instruction;
1442
1416
  }
1443
- if (headerStyle !== 'antigravity') {
1444
- // Gemini CLI accepts explicit cachedContent references. Normalize its
1445
- // snake_case aliases only on that transport; agy relies on implicit
1446
- // prefix caching and does not send any of these fields.
1447
- const cachedContentFromExtra = typeof requestPayload.extra_body === 'object' &&
1448
- requestPayload.extra_body
1449
- ? (requestPayload.extra_body
1450
- .cached_content ??
1451
- requestPayload.extra_body
1452
- .cachedContent)
1453
- : undefined;
1454
- const cachedContent = requestPayload.cached_content ??
1455
- requestPayload.cachedContent ??
1456
- cachedContentFromExtra;
1457
- if (cachedContent) {
1458
- requestPayload.cachedContent = cachedContent;
1459
- }
1460
- delete requestPayload.cached_content;
1461
- if (requestPayload.extra_body &&
1462
- typeof requestPayload.extra_body === 'object') {
1463
- delete requestPayload.extra_body
1464
- .cached_content;
1465
- delete requestPayload.extra_body
1466
- .cachedContent;
1467
- if (Object.keys(requestPayload.extra_body)
1468
- .length === 0) {
1469
- delete requestPayload.extra_body;
1470
- }
1471
- }
1472
- }
1473
1417
  // Normalize tools. For Claude models, keep full function declarations (names + schemas).
1474
1418
  const hasTools = Array.isArray(requestPayload.tools) && requestPayload.tools.length > 0;
1475
1419
  if (hasTools) {
@@ -1597,12 +1541,6 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1597
1541
  toolDebugMissing = geminiResult.toolDebugMissing;
1598
1542
  toolDebugSummaries.push(...geminiResult.toolDebugSummaries);
1599
1543
  }
1600
- try {
1601
- toolDebugPayload = JSON.stringify(requestPayload.tools);
1602
- }
1603
- catch {
1604
- toolDebugPayload = undefined;
1605
- }
1606
1544
  // Apply Claude tool hardening (ported from LLM-API-Key-Proxy)
1607
1545
  // Injects parameter signatures into descriptions and adds system instruction
1608
1546
  // Can be disabled via config.claude_tool_hardening = false to reduce context size
@@ -1756,31 +1694,25 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1756
1694
  wire.signatures.signatureStore.delete(signatureSessionKey);
1757
1695
  }
1758
1696
  }
1759
- // AGY rejects every request that ends with a model turn. Enforce this at
1760
- // the final wire boundary because host races, recovery, or sanitization can
1761
- // otherwise leave a model/assistant entry last. Claude fallback transports
1762
- // have the same assistant-prefill restriction.
1763
- if (headerStyle === 'antigravity' || isClaude) {
1764
- if (Array.isArray(requestPayload.contents)) {
1765
- const lastContent = requestPayload.contents[requestPayload.contents.length - 1];
1766
- if (lastContent?.role === 'model' ||
1767
- lastContent?.role === 'assistant') {
1768
- requestPayload.contents.push({
1769
- role: 'user',
1770
- parts: [{ text: '[Continue]' }],
1771
- });
1772
- }
1697
+ if (Array.isArray(requestPayload.contents)) {
1698
+ const lastContent = requestPayload.contents[requestPayload.contents.length - 1];
1699
+ if (lastContent?.role === 'model' ||
1700
+ lastContent?.role === 'assistant') {
1701
+ requestPayload.contents.push({
1702
+ role: 'user',
1703
+ parts: [{ text: '[Continue]' }],
1704
+ });
1773
1705
  }
1774
- if (Array.isArray(requestPayload.messages)) {
1775
- const lastMessage = requestPayload.messages[requestPayload.messages.length - 1];
1776
- if (lastMessage?.role === 'model' ||
1777
- lastMessage?.role === 'assistant') {
1778
- ;
1779
- requestPayload.messages.push({
1780
- role: 'user',
1781
- parts: [{ text: '[Continue]' }],
1782
- });
1783
- }
1706
+ }
1707
+ if (Array.isArray(requestPayload.messages)) {
1708
+ const lastMessage = requestPayload.messages[requestPayload.messages.length - 1];
1709
+ if (lastMessage?.role === 'model' ||
1710
+ lastMessage?.role === 'assistant') {
1711
+ ;
1712
+ requestPayload.messages.push({
1713
+ role: 'user',
1714
+ parts: [{ text: '[Continue]' }],
1715
+ });
1784
1716
  }
1785
1717
  }
1786
1718
  if ('model' in requestPayload) {
@@ -1788,7 +1720,7 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1788
1720
  }
1789
1721
  stripInjectedDebugFromRequestPayload(requestPayload);
1790
1722
  sanitizeRequestPayloadForAntigravity(requestPayload);
1791
- if (headerStyle === 'antigravity') {
1723
+ {
1792
1724
  const generationConfig = requestPayload.generationConfig;
1793
1725
  const config = generationConfig &&
1794
1726
  typeof generationConfig === 'object' &&
@@ -1818,36 +1750,25 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1818
1750
  // a fresh random project each request busts the prompt cache and
1819
1751
  // fragments server-side quota/session state. ensureProjectContext
1820
1752
  // already floors empty cases to this default; this is defense in depth.
1821
- const effectiveProjectId = projectId?.trim() ||
1822
- (headerStyle === 'antigravity' ? ANTIGRAVITY_DEFAULT_PROJECT_ID : '');
1753
+ const effectiveProjectId = projectId?.trim() || ANTIGRAVITY_DEFAULT_PROJECT_ID;
1823
1754
  resolvedProjectId = effectiveProjectId;
1824
1755
  // Keep internal signature-cache identity separate from AGY wire session metadata.
1825
1756
  sessionId = signatureSessionKey;
1826
- const agyMetadata = headerStyle === 'antigravity'
1827
- ? buildAgyAgentRequestMetadata(options?.agySession ?? DEFAULT_AGY_REQUEST_SESSION, requestPayload, effectiveModel, options?.agyRequestTimestamp)
1828
- : null;
1757
+ const agyMetadata = buildAgyAgentRequestMetadata(options?.agySession ?? DEFAULT_AGY_REQUEST_SESSION, requestPayload, effectiveModel, options?.agyRequestTimestamp);
1829
1758
  requestPayload.sessionId = agyMetadata?.sessionId ?? signatureSessionKey;
1830
1759
  if (agyMetadata) {
1831
1760
  requestPayload.labels = agyMetadata.labels;
1832
1761
  orderAgyRequestPayloadInPlace(requestPayload);
1833
1762
  }
1834
- const wrappedBody = headerStyle === 'antigravity'
1835
- ? {
1836
- project: effectiveProjectId,
1837
- requestId: agyMetadata?.requestId,
1838
- request: requestPayload,
1839
- model: effectiveModel,
1840
- userAgent: 'antigravity',
1841
- requestType: 'agent',
1842
- }
1843
- : {
1844
- project: effectiveProjectId,
1845
- model: effectiveModel,
1846
- request: requestPayload,
1847
- };
1848
- body = safeStringify(headerStyle === 'antigravity'
1849
- ? orderAntigravityEnvelope(wrappedBody)
1850
- : wrappedBody);
1763
+ const wrappedBody = {
1764
+ project: effectiveProjectId,
1765
+ requestId: agyMetadata?.requestId,
1766
+ request: requestPayload,
1767
+ model: effectiveModel,
1768
+ userAgent: 'antigravity',
1769
+ requestType: 'agent',
1770
+ };
1771
+ body = safeStringify(orderAntigravityEnvelope(wrappedBody));
1851
1772
  }
1852
1773
  }
1853
1774
  catch {
@@ -1870,9 +1791,9 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1870
1791
  headers.set('anthropic-beta', interleavedHeader);
1871
1792
  }
1872
1793
  }
1873
- if (headerStyle === 'antigravity') {
1794
+ {
1874
1795
  // Use randomized headers as the fallback pool for Antigravity mode
1875
- const selectedHeaders = getRandomizedHeaders('antigravity', requestedModel);
1796
+ const selectedHeaders = getRandomizedHeaders();
1876
1797
  // Antigravity mode: Match Antigravity Manager behavior
1877
1798
  // AM only sends User-Agent on content requests — no X-Goog-Api-Client, no Client-Metadata header
1878
1799
  // (ideType=ANTIGRAVITY goes in request body metadata via project.ts, not as a header)
@@ -1881,15 +1802,6 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1881
1802
  headers.set('User-Agent', fingerprintHeaders['User-Agent'] || selectedHeaders['User-Agent']);
1882
1803
  headers.set('Accept-Encoding', 'gzip');
1883
1804
  }
1884
- else {
1885
- // Gemini CLI mode: match official google-gemini/gemini-cli User-Agent format
1886
- const geminiCliHeaders = getRandomizedHeaders('gemini-cli', requestedModel);
1887
- headers.set('User-Agent', geminiCliHeaders['User-Agent']);
1888
- if (geminiCliHeaders['X-Goog-Api-Client'])
1889
- headers.set('X-Goog-Api-Client', geminiCliHeaders['X-Goog-Api-Client']);
1890
- if (geminiCliHeaders['Client-Metadata'])
1891
- headers.set('Client-Metadata', geminiCliHeaders['Client-Metadata']);
1892
- }
1893
1805
  return {
1894
1806
  request: transformedUrl,
1895
1807
  init: {
@@ -1905,9 +1817,8 @@ function prepareAntigravityRequestIn(wire, input, init, accessToken, projectId,
1905
1817
  sessionId,
1906
1818
  toolDebugMissing,
1907
1819
  toolDebugSummary: toolDebugSummaries.slice(0, 20).join(' | '),
1908
- toolDebugPayload,
1909
1820
  needsSignedThinkingWarmup,
1910
- headerStyle,
1821
+ headerStyle: 'antigravity',
1911
1822
  thinkingRecoveryMessage,
1912
1823
  };
1913
1824
  }
@@ -1985,7 +1896,7 @@ export function buildThinkingWarmupBody(bodyText, isClaudeThinking) {
1985
1896
  * For streaming SSE responses, uses TransformStream for true real-time incremental streaming.
1986
1897
  * Thinking/reasoning tokens are transformed and forwarded immediately as they arrive.
1987
1898
  */
1988
- async function transformAntigravityResponseIn(wire, response, streaming, debugContext, requestedModel, projectId, endpoint, effectiveModel, sessionId, toolDebugMissing, toolDebugSummary, toolDebugPayload, debugLines, dumpContext) {
1899
+ async function transformAntigravityResponseIn(wire, response, streaming, debugContext, requestedModel, projectId, endpoint, effectiveModel, sessionId, toolDebugMissing, toolDebugSummary, debugLines, dumpContext) {
1989
1900
  const contentType = response.headers.get('content-type') ?? '';
1990
1901
  const isJsonResponse = contentType.includes('application/json');
1991
1902
  const isEventStreamResponse = contentType.includes('text/event-stream');
@@ -2071,12 +1982,16 @@ async function transformAntigravityResponseIn(wire, response, streaming, debugCo
2071
1982
  }
2072
1983
  // Inject Debug Info
2073
1984
  if (errorBody?.error) {
2074
- const rawErrorMessage = typeof errorBody.error.message === 'string' &&
1985
+ const upstreamErrorMessage = typeof errorBody.error.message === 'string' &&
2075
1986
  errorBody.error.message.length > 0
2076
1987
  ? errorBody.error.message
2077
1988
  : 'Unknown error';
1989
+ const rawErrorMessage = redactProjectIdText(upstreamErrorMessage, [
1990
+ projectId ?? '',
1991
+ ]);
2078
1992
  const errorType = detectErrorType(rawErrorMessage);
2079
- const debugInfo = `\n\n[Debug Info]\nRequested Model: ${requestedModel || 'Unknown'}\nEffective Model: ${effectiveModel || 'Unknown'}\nProject: ${projectId || 'Unknown'}\nEndpoint: ${endpoint || 'Unknown'}\nStatus: ${response.status}\nRequest ID: ${headers.get('x-request-id') || 'N/A'}${toolDebugMissing !== undefined ? `\nTool Debug Missing: ${toolDebugMissing}` : ''}${toolDebugSummary ? `\nTool Debug Summary: ${toolDebugSummary}` : ''}${toolDebugPayload ? `\nTool Debug Payload: ${toolDebugPayload}` : ''}`;
1993
+ const safeProjectId = maskSensitiveIdentifier(projectId) || 'Unknown';
1994
+ const debugInfo = `\n\n[Debug Info]\nRequested Model: ${requestedModel || 'Unknown'}\nEffective Model: ${effectiveModel || 'Unknown'}\nProject: ${safeProjectId}\nEndpoint: ${endpoint || 'Unknown'}\nStatus: ${response.status}\nRequest ID: ${headers.get('x-request-id') || 'N/A'}${toolDebugMissing !== undefined ? `\nTool Debug Missing: ${toolDebugMissing}` : ''}${toolDebugSummary ? `\nTool Debug Summary: ${toolDebugSummary}` : ''}`;
2080
1995
  const injectedDebug = debugText ? `\n\n${debugText}` : '';
2081
1996
  errorBody.error.message = rawErrorMessage + debugInfo + injectedDebug;
2082
1997
  // Check if this is a recoverable thinking error - throw to trigger retry