@cortexkit/opencode-antigravity-auth 1.1.0 → 2.0.1

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 (379) hide show
  1. package/README.md +225 -569
  2. package/dist/cli.js +4017 -0
  3. package/dist/cli.js.map +7 -0
  4. package/dist/index.d.ts +1 -3
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +20742 -14586
  7. package/dist/index.js.map +4 -4
  8. package/dist/src/antigravity/oauth.d.ts +1 -1
  9. package/dist/src/antigravity/oauth.js +1 -1
  10. package/dist/src/cli.d.ts +21 -0
  11. package/dist/src/cli.d.ts.map +1 -0
  12. package/dist/src/cli.js +237 -0
  13. package/dist/src/cli.js.map +1 -0
  14. package/dist/src/constants.d.ts +1 -1
  15. package/dist/src/constants.js +1 -1
  16. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -1
  17. package/dist/src/hooks/auto-update-checker/cache.js +13 -13
  18. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -1
  19. package/dist/src/hooks/auto-update-checker/checker.d.ts +1 -1
  20. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -1
  21. package/dist/src/hooks/auto-update-checker/checker.js +75 -51
  22. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -1
  23. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -1
  24. package/dist/src/hooks/auto-update-checker/constants.js +12 -12
  25. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -1
  26. package/dist/src/hooks/auto-update-checker/index.d.ts +6 -6
  27. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -1
  28. package/dist/src/hooks/auto-update-checker/index.js +17 -17
  29. package/dist/src/hooks/auto-update-checker/index.js.map +1 -1
  30. package/dist/src/hooks/auto-update-checker/logging.js +2 -2
  31. package/dist/src/hooks/auto-update-checker/logging.js.map +1 -1
  32. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -1
  33. package/dist/src/plugin/account-access.d.ts +99 -0
  34. package/dist/src/plugin/account-access.d.ts.map +1 -0
  35. package/dist/src/plugin/account-access.js +480 -0
  36. package/dist/src/plugin/account-access.js.map +1 -0
  37. package/dist/src/plugin/account-command-oauth.d.ts +34 -0
  38. package/dist/src/plugin/account-command-oauth.d.ts.map +1 -0
  39. package/dist/src/plugin/account-command-oauth.js +156 -0
  40. package/dist/src/plugin/account-command-oauth.js.map +1 -0
  41. package/dist/src/plugin/accounts.d.ts +7 -256
  42. package/dist/src/plugin/accounts.d.ts.map +1 -1
  43. package/dist/src/plugin/accounts.js +31 -1367
  44. package/dist/src/plugin/accounts.js.map +1 -1
  45. package/dist/src/plugin/agy-request-metadata.d.ts +1 -1
  46. package/dist/src/plugin/agy-request-metadata.js +1 -1
  47. package/dist/src/plugin/agy-transport.d.ts +1 -1
  48. package/dist/src/plugin/agy-transport.js +1 -1
  49. package/dist/src/plugin/auth-doctor.d.ts +6 -6
  50. package/dist/src/plugin/auth-doctor.d.ts.map +1 -1
  51. package/dist/src/plugin/auth-doctor.js +74 -66
  52. package/dist/src/plugin/auth-doctor.js.map +1 -1
  53. package/dist/src/plugin/auth-drift.d.ts +4 -4
  54. package/dist/src/plugin/auth-drift.d.ts.map +1 -1
  55. package/dist/src/plugin/auth-drift.js +15 -15
  56. package/dist/src/plugin/auth-drift.js.map +1 -1
  57. package/dist/src/plugin/auth-loader.d.ts +50 -0
  58. package/dist/src/plugin/auth-loader.d.ts.map +1 -0
  59. package/dist/src/plugin/auth-loader.js +225 -0
  60. package/dist/src/plugin/auth-loader.js.map +1 -0
  61. package/dist/src/plugin/auth.d.ts +1 -1
  62. package/dist/src/plugin/auth.js +1 -1
  63. package/dist/src/plugin/background-quota-refresh.d.ts +146 -0
  64. package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -0
  65. package/dist/src/plugin/background-quota-refresh.js +347 -0
  66. package/dist/src/plugin/background-quota-refresh.js.map +1 -0
  67. package/dist/src/plugin/cache/index.d.ts +1 -1
  68. package/dist/src/plugin/cache/index.d.ts.map +1 -1
  69. package/dist/src/plugin/cache/index.js +1 -1
  70. package/dist/src/plugin/cache/index.js.map +1 -1
  71. package/dist/src/plugin/cache/signature-cache.d.ts +1 -1
  72. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  73. package/dist/src/plugin/cache/signature-cache.js +23 -24
  74. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  75. package/dist/src/plugin/cache.d.ts +6 -5
  76. package/dist/src/plugin/cache.d.ts.map +1 -1
  77. package/dist/src/plugin/cache.js +21 -7
  78. package/dist/src/plugin/cache.js.map +1 -1
  79. package/dist/src/plugin/catalog.d.ts +23 -0
  80. package/dist/src/plugin/catalog.d.ts.map +1 -0
  81. package/dist/src/plugin/catalog.js +60 -0
  82. package/dist/src/plugin/catalog.js.map +1 -0
  83. package/dist/src/plugin/cli.d.ts +7 -7
  84. package/dist/src/plugin/cli.d.ts.map +1 -1
  85. package/dist/src/plugin/cli.js +62 -55
  86. package/dist/src/plugin/cli.js.map +1 -1
  87. package/dist/src/plugin/command-data.d.ts +329 -0
  88. package/dist/src/plugin/command-data.d.ts.map +1 -0
  89. package/dist/src/plugin/command-data.js +517 -0
  90. package/dist/src/plugin/command-data.js.map +1 -0
  91. package/dist/src/plugin/commands.d.ts +154 -0
  92. package/dist/src/plugin/commands.d.ts.map +1 -0
  93. package/dist/src/plugin/commands.js +746 -0
  94. package/dist/src/plugin/commands.js.map +1 -0
  95. package/dist/src/plugin/config/index.d.ts +2 -2
  96. package/dist/src/plugin/config/index.d.ts.map +1 -1
  97. package/dist/src/plugin/config/index.js +2 -2
  98. package/dist/src/plugin/config/index.js.map +1 -1
  99. package/dist/src/plugin/config/loader.d.ts +1 -1
  100. package/dist/src/plugin/config/loader.d.ts.map +1 -1
  101. package/dist/src/plugin/config/loader.js +18 -16
  102. package/dist/src/plugin/config/loader.js.map +1 -1
  103. package/dist/src/plugin/config/models.d.ts +2 -2
  104. package/dist/src/plugin/config/models.d.ts.map +1 -1
  105. package/dist/src/plugin/config/models.js +1 -1
  106. package/dist/src/plugin/config/models.js.map +1 -1
  107. package/dist/src/plugin/config/operator-settings-schema.d.ts +29 -0
  108. package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
  109. package/dist/src/plugin/config/operator-settings-schema.js +28 -0
  110. package/dist/src/plugin/config/operator-settings-schema.js.map +1 -0
  111. package/dist/src/plugin/config/schema.d.ts +23 -2
  112. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  113. package/dist/src/plugin/config/schema.js +109 -25
  114. package/dist/src/plugin/config/schema.js.map +1 -1
  115. package/dist/src/plugin/config/updater.d.ts.map +1 -1
  116. package/dist/src/plugin/config/updater.js +15 -15
  117. package/dist/src/plugin/config/updater.js.map +1 -1
  118. package/dist/src/plugin/config/writer.d.ts +34 -0
  119. package/dist/src/plugin/config/writer.d.ts.map +1 -0
  120. package/dist/src/plugin/config/writer.js +81 -0
  121. package/dist/src/plugin/config/writer.js.map +1 -0
  122. package/dist/src/plugin/core/streaming/index.d.ts +1 -1
  123. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -1
  124. package/dist/src/plugin/core/streaming/index.js +1 -1
  125. package/dist/src/plugin/core/streaming/index.js.map +1 -1
  126. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
  127. package/dist/src/plugin/core/streaming/transformer.js +85 -44
  128. package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
  129. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
  130. package/dist/src/plugin/debug.d.ts +10 -3
  131. package/dist/src/plugin/debug.d.ts.map +1 -1
  132. package/dist/src/plugin/debug.js +110 -47
  133. package/dist/src/plugin/debug.js.map +1 -1
  134. package/dist/src/plugin/dependencies.d.ts +129 -0
  135. package/dist/src/plugin/dependencies.d.ts.map +1 -0
  136. package/dist/src/plugin/dependencies.js +107 -0
  137. package/dist/src/plugin/dependencies.js.map +1 -0
  138. package/dist/src/plugin/errors.d.ts +27 -0
  139. package/dist/src/plugin/errors.d.ts.map +1 -1
  140. package/dist/src/plugin/errors.js +29 -3
  141. package/dist/src/plugin/errors.js.map +1 -1
  142. package/dist/src/plugin/event-handler.d.ts +53 -0
  143. package/dist/src/plugin/event-handler.d.ts.map +1 -0
  144. package/dist/src/plugin/event-handler.js +101 -0
  145. package/dist/src/plugin/event-handler.js.map +1 -0
  146. package/dist/src/plugin/fetch/retry-state.d.ts +61 -0
  147. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -0
  148. package/dist/src/plugin/fetch/retry-state.js +248 -0
  149. package/dist/src/plugin/fetch/retry-state.js.map +1 -0
  150. package/dist/src/plugin/fetch/warmup.d.ts +30 -0
  151. package/dist/src/plugin/fetch/warmup.d.ts.map +1 -0
  152. package/dist/src/plugin/fetch/warmup.js +76 -0
  153. package/dist/src/plugin/fetch/warmup.js.map +1 -0
  154. package/dist/src/plugin/fetch-interceptor.d.ts +59 -0
  155. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -0
  156. package/dist/src/plugin/fetch-interceptor.js +1399 -0
  157. package/dist/src/plugin/fetch-interceptor.js.map +1 -0
  158. package/dist/src/plugin/fetch-routing.d.ts +26 -0
  159. package/dist/src/plugin/fetch-routing.d.ts.map +1 -0
  160. package/dist/src/plugin/fetch-routing.js +99 -0
  161. package/dist/src/plugin/fetch-routing.js.map +1 -0
  162. package/dist/src/plugin/fingerprint.d.ts +1 -1
  163. package/dist/src/plugin/fingerprint.js +1 -1
  164. package/dist/src/plugin/gemini-dump.d.ts +5 -5
  165. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  166. package/dist/src/plugin/gemini-dump.js +109 -55
  167. package/dist/src/plugin/gemini-dump.js.map +1 -1
  168. package/dist/src/plugin/google-search-tool.d.ts +9 -0
  169. package/dist/src/plugin/google-search-tool.d.ts.map +1 -0
  170. package/dist/src/plugin/google-search-tool.js +56 -0
  171. package/dist/src/plugin/google-search-tool.js.map +1 -0
  172. package/dist/src/plugin/image-saver.d.ts.map +1 -1
  173. package/dist/src/plugin/image-saver.js +16 -16
  174. package/dist/src/plugin/image-saver.js.map +1 -1
  175. package/dist/src/plugin/index.d.ts +30 -0
  176. package/dist/src/plugin/index.d.ts.map +1 -0
  177. package/dist/src/plugin/index.js +411 -0
  178. package/dist/src/plugin/index.js.map +1 -0
  179. package/dist/src/plugin/killswitch.d.ts +94 -0
  180. package/dist/src/plugin/killswitch.d.ts.map +1 -0
  181. package/dist/src/plugin/killswitch.js +197 -0
  182. package/dist/src/plugin/killswitch.js.map +1 -0
  183. package/dist/src/plugin/lifecycle.d.ts +40 -0
  184. package/dist/src/plugin/lifecycle.d.ts.map +1 -0
  185. package/dist/src/plugin/lifecycle.js +73 -0
  186. package/dist/src/plugin/lifecycle.js.map +1 -0
  187. package/dist/src/plugin/logger.d.ts +10 -1
  188. package/dist/src/plugin/logger.d.ts.map +1 -1
  189. package/dist/src/plugin/logger.js +38 -12
  190. package/dist/src/plugin/logger.js.map +1 -1
  191. package/dist/src/plugin/logging-utils.d.ts +35 -1
  192. package/dist/src/plugin/logging-utils.d.ts.map +1 -1
  193. package/dist/src/plugin/logging-utils.js +98 -15
  194. package/dist/src/plugin/logging-utils.js.map +1 -1
  195. package/dist/src/plugin/model-registry.d.ts +1 -1
  196. package/dist/src/plugin/model-registry.js +1 -1
  197. package/dist/src/plugin/oauth-login.d.ts +22 -0
  198. package/dist/src/plugin/oauth-login.d.ts.map +1 -0
  199. package/dist/src/plugin/oauth-login.js +37 -0
  200. package/dist/src/plugin/oauth-login.js.map +1 -0
  201. package/dist/src/plugin/oauth-methods.d.ts +42 -0
  202. package/dist/src/plugin/oauth-methods.d.ts.map +1 -0
  203. package/dist/src/plugin/oauth-methods.js +1276 -0
  204. package/dist/src/plugin/oauth-methods.js.map +1 -0
  205. package/dist/src/plugin/operator-settings.d.ts +40 -0
  206. package/dist/src/plugin/operator-settings.d.ts.map +1 -0
  207. package/dist/src/plugin/operator-settings.js +148 -0
  208. package/dist/src/plugin/operator-settings.js.map +1 -0
  209. package/dist/src/plugin/persist-account-pool.d.ts +37 -0
  210. package/dist/src/plugin/persist-account-pool.d.ts.map +1 -0
  211. package/dist/src/plugin/persist-account-pool.js +142 -0
  212. package/dist/src/plugin/persist-account-pool.js.map +1 -0
  213. package/dist/src/plugin/project.d.ts +1 -1
  214. package/dist/src/plugin/project.js +1 -1
  215. package/dist/src/plugin/prompt-context.d.ts.map +1 -1
  216. package/dist/src/plugin/prompt-context.js +11 -11
  217. package/dist/src/plugin/prompt-context.js.map +1 -1
  218. package/dist/src/plugin/quota.d.ts +138 -41
  219. package/dist/src/plugin/quota.d.ts.map +1 -1
  220. package/dist/src/plugin/quota.js +417 -285
  221. package/dist/src/plugin/quota.js.map +1 -1
  222. package/dist/src/plugin/recovery/constants.d.ts.map +1 -1
  223. package/dist/src/plugin/recovery/constants.js +24 -15
  224. package/dist/src/plugin/recovery/constants.js.map +1 -1
  225. package/dist/src/plugin/recovery/index.d.ts +3 -3
  226. package/dist/src/plugin/recovery/index.d.ts.map +1 -1
  227. package/dist/src/plugin/recovery/index.js +3 -3
  228. package/dist/src/plugin/recovery/index.js.map +1 -1
  229. package/dist/src/plugin/recovery/storage.d.ts +1 -1
  230. package/dist/src/plugin/recovery/storage.d.ts.map +1 -1
  231. package/dist/src/plugin/recovery/storage.js +31 -39
  232. package/dist/src/plugin/recovery/storage.js.map +1 -1
  233. package/dist/src/plugin/recovery/types.d.ts +12 -12
  234. package/dist/src/plugin/recovery/types.d.ts.map +1 -1
  235. package/dist/src/plugin/recovery.d.ts +3 -3
  236. package/dist/src/plugin/recovery.d.ts.map +1 -1
  237. package/dist/src/plugin/recovery.js +62 -58
  238. package/dist/src/plugin/recovery.js.map +1 -1
  239. package/dist/src/plugin/refresh-queue.d.ts +5 -2
  240. package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
  241. package/dist/src/plugin/refresh-queue.js +37 -15
  242. package/dist/src/plugin/refresh-queue.js.map +1 -1
  243. package/dist/src/plugin/request-helpers.d.ts +1 -1
  244. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  245. package/dist/src/plugin/request-helpers.js +451 -352
  246. package/dist/src/plugin/request-helpers.js.map +1 -1
  247. package/dist/src/plugin/request.d.ts +7 -7
  248. package/dist/src/plugin/request.d.ts.map +1 -1
  249. package/dist/src/plugin/request.js +622 -384
  250. package/dist/src/plugin/request.js.map +1 -1
  251. package/dist/src/plugin/rotation.d.ts +1 -168
  252. package/dist/src/plugin/rotation.d.ts.map +1 -1
  253. package/dist/src/plugin/rotation.js +1 -327
  254. package/dist/src/plugin/rotation.js.map +1 -1
  255. package/dist/src/plugin/search.d.ts.map +1 -1
  256. package/dist/src/plugin/search.js +39 -35
  257. package/dist/src/plugin/search.js.map +1 -1
  258. package/dist/src/plugin/server.d.ts +1 -1
  259. package/dist/src/plugin/server.d.ts.map +1 -1
  260. package/dist/src/plugin/server.js +42 -37
  261. package/dist/src/plugin/server.js.map +1 -1
  262. package/dist/src/plugin/session-context.d.ts +2 -1
  263. package/dist/src/plugin/session-context.d.ts.map +1 -1
  264. package/dist/src/plugin/session-context.js +11 -7
  265. package/dist/src/plugin/session-context.js.map +1 -1
  266. package/dist/src/plugin/storage.d.ts +59 -120
  267. package/dist/src/plugin/storage.d.ts.map +1 -1
  268. package/dist/src/plugin/storage.js +140 -485
  269. package/dist/src/plugin/storage.js.map +1 -1
  270. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -1
  271. package/dist/src/plugin/stores/signature-store.js.map +1 -1
  272. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -1
  273. package/dist/src/plugin/thinking-recovery.js +35 -33
  274. package/dist/src/plugin/thinking-recovery.js.map +1 -1
  275. package/dist/src/plugin/token.d.ts +2 -2
  276. package/dist/src/plugin/token.d.ts.map +1 -1
  277. package/dist/src/plugin/token.js +30 -21
  278. package/dist/src/plugin/token.js.map +1 -1
  279. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +1 -1
  280. package/dist/src/plugin/transform/cross-model-sanitizer.js +1 -1
  281. package/dist/src/plugin/transform/index.d.ts +1 -1
  282. package/dist/src/plugin/transform/index.js +1 -1
  283. package/dist/src/plugin/transform/model-resolver.d.ts +1 -1
  284. package/dist/src/plugin/transform/model-resolver.js +1 -1
  285. package/dist/src/plugin/transform/types.d.ts +1 -1
  286. package/dist/src/plugin/transform/types.js +1 -1
  287. package/dist/src/plugin/types.d.ts +25 -69
  288. package/dist/src/plugin/types.d.ts.map +1 -1
  289. package/dist/src/plugin/ui/ansi.d.ts.map +1 -1
  290. package/dist/src/plugin/ui/ansi.js.map +1 -1
  291. package/dist/src/plugin/ui/auth-menu.d.ts +1 -1
  292. package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
  293. package/dist/src/plugin/ui/auth-menu.js +84 -35
  294. package/dist/src/plugin/ui/auth-menu.js.map +1 -1
  295. package/dist/src/plugin/ui/confirm.d.ts.map +1 -1
  296. package/dist/src/plugin/ui/confirm.js.map +1 -1
  297. package/dist/src/plugin/ui/model-status.d.ts +3 -3
  298. package/dist/src/plugin/ui/model-status.d.ts.map +1 -1
  299. package/dist/src/plugin/ui/model-status.js +3 -3
  300. package/dist/src/plugin/ui/model-status.js.map +1 -1
  301. package/dist/src/plugin/ui/quota-status.d.ts +4 -4
  302. package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
  303. package/dist/src/plugin/ui/quota-status.js +49 -49
  304. package/dist/src/plugin/ui/quota-status.js.map +1 -1
  305. package/dist/src/plugin/ui/select.d.ts.map +1 -1
  306. package/dist/src/plugin/ui/select.js +22 -12
  307. package/dist/src/plugin/ui/select.js.map +1 -1
  308. package/dist/src/plugin/version.d.ts +1 -1
  309. package/dist/src/plugin/version.js +1 -1
  310. package/dist/src/rpc/notifications.d.ts +6 -0
  311. package/dist/src/rpc/notifications.d.ts.map +1 -0
  312. package/dist/src/rpc/notifications.js +46 -0
  313. package/dist/src/rpc/notifications.js.map +1 -0
  314. package/dist/src/rpc/port-file.d.ts +13 -0
  315. package/dist/src/rpc/port-file.d.ts.map +1 -0
  316. package/dist/src/rpc/port-file.js +109 -0
  317. package/dist/src/rpc/port-file.js.map +1 -0
  318. package/dist/src/rpc/protocol.d.ts +22 -0
  319. package/dist/src/rpc/protocol.d.ts.map +1 -0
  320. package/dist/src/rpc/protocol.js +1 -0
  321. package/dist/src/rpc/protocol.js.map +1 -0
  322. package/dist/src/rpc/rpc-client.d.ts +10 -0
  323. package/dist/src/rpc/rpc-client.d.ts.map +1 -0
  324. package/dist/src/rpc/rpc-client.js +58 -0
  325. package/dist/src/rpc/rpc-client.js.map +1 -0
  326. package/dist/src/rpc/rpc-dir.d.ts +4 -0
  327. package/dist/src/rpc/rpc-dir.d.ts.map +1 -0
  328. package/dist/src/rpc/rpc-dir.js +19 -0
  329. package/dist/src/rpc/rpc-dir.js.map +1 -0
  330. package/dist/src/rpc/rpc-server.d.ts +13 -0
  331. package/dist/src/rpc/rpc-server.d.ts.map +1 -0
  332. package/dist/src/rpc/rpc-server.js +231 -0
  333. package/dist/src/rpc/rpc-server.js.map +1 -0
  334. package/dist/src/sidebar-state.d.ts +357 -0
  335. package/dist/src/sidebar-state.d.ts.map +1 -0
  336. package/dist/src/sidebar-state.js +680 -0
  337. package/dist/src/sidebar-state.js.map +1 -0
  338. package/dist/src/tui/command-dialogs.d.ts +61 -0
  339. package/dist/src/tui/command-dialogs.d.ts.map +1 -0
  340. package/dist/src/tui/command-dialogs.js +595 -0
  341. package/dist/src/tui/command-dialogs.js.map +1 -0
  342. package/dist/src/tui/file-logger.d.ts +41 -0
  343. package/dist/src/tui/file-logger.d.ts.map +1 -0
  344. package/dist/src/tui/file-logger.js +114 -0
  345. package/dist/src/tui/file-logger.js.map +1 -0
  346. package/dist/src/tui-preferences.d.ts +40 -0
  347. package/dist/src/tui-preferences.d.ts.map +1 -0
  348. package/dist/src/tui-preferences.js +328 -0
  349. package/dist/src/tui-preferences.js.map +1 -0
  350. package/dist/src/tui.d.ts +68 -0
  351. package/dist/src/tui.d.ts.map +1 -0
  352. package/dist/src/tui.js +697 -0
  353. package/dist/src/tui.js.map +1 -0
  354. package/package.json +46 -22
  355. package/src/plugin/command-data.ts +931 -0
  356. package/src/rpc/port-file.ts +143 -0
  357. package/src/rpc/protocol.ts +31 -0
  358. package/src/rpc/rpc-client.ts +102 -0
  359. package/src/rpc/rpc-dir.ts +24 -0
  360. package/src/sidebar-state.ts +991 -0
  361. package/src/tui/command-dialogs.tsx +832 -0
  362. package/src/tui/entry.mjs +74 -0
  363. package/src/tui/file-logger.ts +145 -0
  364. package/src/tui-compiled/plugin/command-data.ts +931 -0
  365. package/src/tui-compiled/rpc/port-file.ts +143 -0
  366. package/src/tui-compiled/rpc/protocol.ts +31 -0
  367. package/src/tui-compiled/rpc/rpc-client.ts +102 -0
  368. package/src/tui-compiled/rpc/rpc-dir.ts +24 -0
  369. package/src/tui-compiled/sidebar-state.ts +991 -0
  370. package/src/tui-compiled/tui/command-dialogs.tsx +779 -0
  371. package/src/tui-compiled/tui/file-logger.ts +145 -0
  372. package/src/tui-compiled/tui-preferences.ts +416 -0
  373. package/src/tui-compiled/tui.tsx +1193 -0
  374. package/src/tui-preferences.ts +416 -0
  375. package/src/tui.tsx +1171 -0
  376. package/dist/src/plugin.d.ts +0 -48
  377. package/dist/src/plugin.d.ts.map +0 -1
  378. package/dist/src/plugin.js +0 -3311
  379. package/dist/src/plugin.js.map +0 -1
package/README.md CHANGED
@@ -1,559 +1,252 @@
1
- # Antigravity + Gemini CLI OAuth Plugin for Opencode
1
+ # `@cortexkit/opencode-antigravity-auth`
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@cortexkit/opencode-antigravity-auth.svg)](https://www.npmjs.com/package/@cortexkit/opencode-antigravity-auth)
4
4
  [![npm downloads](https://img.shields.io/npm/dw/@cortexkit/opencode-antigravity-auth.svg)](https://www.npmjs.com/package/@cortexkit/opencode-antigravity-auth)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
6
 
7
- Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like `gemini-3.6-flash` and `claude-opus-4-6-thinking` with your Google credentials.
7
+ OpenCode 1.x plugin + OpenTUI sidebar for Google Antigravity. Authenticate with your Google account, get **Antigravity quota** access to Claude 4.6, Gemini 3.x/2.5, and GPT-OSS 120B, plus standalone OAuth login and quota commands through the bundled `antigravity-auth` CLI.
8
8
 
9
- ## What You Get
10
-
11
- - **Claude Opus 4.6, Sonnet 4.6, Gemini 3.6/3.5 Flash, Gemini 3.1 Pro/Image, and GPT-OSS 120B** via Google OAuth
12
- - **Multi-account support** — add multiple Google accounts, auto-rotates when rate-limited
13
- - **Dual quota system** — access both Antigravity and Gemini CLI quotas from one plugin
14
- - **Thinking models** — extended thinking for Claude and Gemini 3 with configurable budgets
15
- - **Google Search grounding** — enable web search for Gemini models (auto or always-on)
16
- - **Auto-recovery** — handles session errors and tool failures automatically
17
- - **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
18
-
19
- ---
20
-
21
- <details open>
22
- <summary><b>⚠️ Terms of Service Warning — Read Before Installing</b></summary>
23
-
24
- > [!CAUTION]
25
- > Using this plugin (and any proxy for Antigravity) violates Google's Terms of Service. A number of users have reported their Google accounts being **banned** or **shadow-banned** (restricted access without explicit notification).
9
+ > **CAUTION — read before installing.**
26
10
  >
27
- > **By using this plugin, you acknowledge:**
28
- > - This is an unofficial tool not endorsed by Google
29
- > - Your account may be suspended or permanently banned
30
- > - You assume all risks associated with using this plugin
31
- >
32
-
33
- </details>
34
-
35
- ---
36
-
37
- ## Installation
38
-
39
- <details open>
40
- <summary><b>For Humans</b></summary>
41
-
42
- **Option A: Let an LLM do it**
43
-
44
- Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
45
-
46
- ```
47
- Install the opencode-antigravity-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/cortexkit/antigravity-auth/main/README.md
48
- ```
49
-
50
- **Option B: Manual setup**
11
+ > Using this plugin (and any proxy for Antigravity) violates Google's Terms of Service. Google account holders have reported suspensions, bans, and shadow-bans (restricted access without notice). The plugin is **not endorsed by Google**; you assume all risks.
51
12
 
52
- 1. **Add the plugin** to `~/.config/opencode/opencode.json`:
13
+ This package is part of the `@cortexkit/antigravity-auth@2.0.0` monorepo. See the [root README](../../README.md) for the full operator and contributor guide, the installation matrix, the configuration reference, and the release process.
53
14
 
54
- ```json
55
- {
56
- "plugin": ["@cortexkit/opencode-antigravity-auth@latest"]
57
- }
58
- ```
15
+ ## What you get
59
16
 
60
- 2. **Login** with your Google account:
17
+ - **Claude Opus 4.6 / Sonnet 4.6 (thinking)** and **Gemini 3 Pro / Flash / 3.6 Flash / 3.1 Pro / 3.1 Flash Image** via Google OAuth against the Antigravity quota pool.
18
+ - **GPT-OSS 120B Medium** through the Antigravity-style headers.
19
+ - **Multi-account rotation** with deterministic selection (`sticky`, `round-robin`, `hybrid`), per-account rate-limit cooldowns, and a failsafe **killswitch** that hard-blocks accounts below a quota threshold.
20
+ - **Dual quota pools:** Antigravity headers + Gemini CLI headers with style-fallback so a single exhausted pool does not stall a request.
21
+ - **OpenTUI sidebar** — read-only, polls the on-disk sidebar-state file every 2s. Carries per-account health, cooldown, and per-quota-group remaining percent; never carries credentials.
22
+ - **Six slash commands** wired through the OpenTUI dialog system — `/antigravity-quota`, `/antigravity-account`, `/antigravity-routing`, `/antigravity-killswitch`, `/antigravity-dump`, `/antigravity-logging`. See `packages/opencode/src/plugin/commands.ts` and `packages/opencode/src/tui/command-dialogs.tsx`. `/gemini-dump` remains a backward-compat alias.
23
+ - **Thinking models** with optional signature caching and precompiled OpenTUI JSX.
24
+ - **Standalone CLI** shipped as the `antigravity-auth` bin (`login`, `list`, `quota`) — same storage as the plugin.
25
+ - **Auto-recovery** from `tool_result_missing` errors and proactive background token refresh.
61
26
 
62
- ```bash
63
- opencode auth login
64
- ```
27
+ ## Host requirement
65
28
 
66
- 3. **Add models** — choose one:
67
- - Run `opencode auth login` → Google → OAuth with Google (Antigravity) → select **"Configure models in opencode.json"** (auto-configures all models)
68
- - Or manually copy the [full configuration](#models) below
29
+ | Host field | Required range |
30
+ | --- | --- |
31
+ | `@opencode-ai/plugin` peer dependency | `>=1.17.13 <2` |
32
+ | `@opentui/core`, `@opentui/keymap`, `@opentui/solid` (peer) | `^0.4.5` each |
33
+ | Node | `>=20` |
69
34
 
70
- 4. **Use it:**
35
+ The package pins the supported host range through `engines.opencode` (`>=1.17.13 <2`); `opencode plugin` refuses to install a plugin that asks for an unsupported range.
71
36
 
72
- ```bash
73
- opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
74
- ```
37
+ The package exposes two `exports` subpaths the host installer reads:
75
38
 
76
- </details>
39
+ - `exports["."]` — the bundled `dist/index.js` server root. `opencode plugin` writes this entry into `opencode.json`'s `plugin` array.
40
+ - `exports["./tui"]` — `src/tui/entry.mjs`, the OpenTUI sidebar loader. `opencode plugin` writes this entry into `tui.json` so the TUI process picks it up on the next host start.
77
41
 
78
- <details>
79
- <summary><b>For LLM Agents</b></summary>
80
-
81
- ### Step-by-Step Instructions
82
-
83
- 1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
84
-
85
- > **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
86
-
87
- 2. Add the plugin to the `plugin` array
88
-
89
- 3. Add the model definitions from the [Full models configuration](#models) section
42
+ ## Installation
90
43
 
91
- 4. Set `provider` to `"google"` and choose a model
44
+ ### End-user (npm) — the supported path
92
45
 
93
- ### Verification
46
+ The supported installer writes both registrations in one step:
94
47
 
95
48
  ```bash
96
- opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
49
+ opencode plugin @cortexkit/opencode-antigravity-auth@latest
97
50
  ```
98
51
 
99
- </details>
52
+ What this does:
100
53
 
101
- ---
54
+ - Reads the package's `exports["."]` and writes it into `~/.config/opencode/opencode.json` under the `plugin` array — the `auth.loader` and `fetch` interceptor the host calls on every model dispatch.
55
+ - Reads the package's `exports["./tui"]` and writes it into `~/.config/opencode/tui.json` so the TUI process picks the sidebar up on the next host start.
56
+ - Refuses to install when the host's OpenCode version falls outside the package's `engines.opencode` range.
102
57
 
103
- ## Models
58
+ #### Manual config (hand-edited configs)
104
59
 
105
- ### Model Reference
106
-
107
- **Antigravity quota:**
108
-
109
- | Model | Variants | Notes |
110
- |-------|----------|-------|
111
- | `antigravity-gemini-3.6-flash` | low, high | Gemini 3.6 Flash with medium as the default |
112
- | `antigravity-gemini-3.5-flash` | low, high | Gemini 3.5 Flash with medium as the default |
113
- | `antigravity-gemini-3.1-pro` | low, high | Gemini 3.1 Pro with thinking |
114
- | `antigravity-gemini-3.1-flash-image` | — | Gemini 3.1 image generation |
115
- | `antigravity-claude-sonnet-4-6-thinking` | — | Claude Sonnet 4.6 with thinking |
116
- | `antigravity-claude-opus-4-6-thinking` | — | Claude Opus 4.6 with thinking |
117
- | `antigravity-gpt-oss-120b-medium` | — | GPT-OSS 120B medium reasoning |
118
-
119
- > Gemini 3.5 Flash-Lite is available through the Gemini API but is not present in
120
- > the AGY 1.1.5 Antigravity or Gemini CLI quota catalogs. Gemini 3.5 Flash Cyber
121
- > is restricted to a limited-access CodeMender pilot. Neither model is advertised
122
- > by this plugin.
123
-
124
- **Gemini CLI quota** (separate from Antigravity; used when `cli_first` is true or as fallback):
125
-
126
- | Model | Notes |
127
- |-------|-------|
128
- | `gemini-2.5-flash` | Gemini 2.5 Flash |
129
- | `gemini-2.5-pro` | Gemini 2.5 Pro |
130
- | `gemini-3-flash-preview` | Gemini 3 Flash (preview) |
131
- | `gemini-3-pro-preview` | Gemini 3 Pro (preview) |
132
- | `gemini-3.1-pro-preview` | Gemini 3.1 Pro (preview, rollout-dependent) |
133
- | `gemini-3.1-pro-preview-customtools` | Gemini 3.1 Pro Preview Custom Tools (preview, rollout-dependent) |
134
-
135
- > **Routing Behavior:**
136
- > - **Antigravity-first (default):** Gemini models use Antigravity quota across accounts.
137
- > - **CLI-first (`cli_first: true`):** Gemini models use Gemini CLI quota first.
138
- > - When a Gemini quota pool is exhausted, the plugin automatically falls back to the other pool.
139
- > - Claude and image models always use Antigravity.
140
- > Model names are automatically transformed for the target API (e.g., `antigravity-gemini-3-flash` → `gemini-3-flash-preview` for CLI).
141
-
142
- **Using variants:**
143
- ```bash
144
- opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
145
- ```
60
+ If you cannot use `opencode plugin`, write both files by hand:
146
61
 
147
- For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
148
-
149
- <details>
150
- <summary><b>Full models configuration (copy-paste ready)</b></summary>
151
-
152
- Add this to your `~/.config/opencode/opencode.json`:
153
-
154
- ```json
62
+ ```jsonc
63
+ // ~/.config/opencode/opencode.json
155
64
  {
156
- "$schema": "https://opencode.ai/config.json",
157
- "plugin": ["@cortexkit/opencode-antigravity-auth@latest"],
158
- "provider": {
159
- "google": {
160
- "models": {
161
- "antigravity-gemini-3-pro": {
162
- "name": "Gemini 3 Pro (Antigravity)",
163
- "limit": { "context": 1048576, "output": 65535 },
164
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
165
- "variants": {
166
- "low": { "thinkingLevel": "low" },
167
- "high": { "thinkingLevel": "high" }
168
- }
169
- },
170
- "antigravity-gemini-3.6-flash": {
171
- "name": "Gemini 3.6 Flash (Antigravity)",
172
- "limit": { "context": 1048576, "output": 65536 },
173
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
174
- "variants": {
175
- "low": { "thinkingLevel": "low" },
176
- "high": { "thinkingLevel": "high" }
177
- }
178
- },
179
- "antigravity-gemini-3.1-pro": {
180
- "name": "Gemini 3.1 Pro (Antigravity)",
181
- "limit": { "context": 1048576, "output": 65535 },
182
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
183
- "variants": {
184
- "low": { "thinkingLevel": "low" },
185
- "high": { "thinkingLevel": "high" }
186
- }
187
- },
188
- "antigravity-gemini-3-flash": {
189
- "name": "Gemini 3 Flash (Antigravity)",
190
- "limit": { "context": 1048576, "output": 65536 },
191
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
192
- "variants": {
193
- "minimal": { "thinkingLevel": "minimal" },
194
- "low": { "thinkingLevel": "low" },
195
- "medium": { "thinkingLevel": "medium" },
196
- "high": { "thinkingLevel": "high" }
197
- }
198
- },
199
- "antigravity-claude-sonnet-4-6": {
200
- "name": "Claude Sonnet 4.6 (Antigravity)",
201
- "limit": { "context": 200000, "output": 64000 },
202
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
203
- },
204
- "antigravity-claude-opus-4-6-thinking": {
205
- "name": "Claude Opus 4.6 Thinking (Antigravity)",
206
- "limit": { "context": 200000, "output": 64000 },
207
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
208
- "variants": {
209
- "low": { "thinkingConfig": { "thinkingBudget": 8192 } },
210
- "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
211
- }
212
- },
213
- "gemini-2.5-flash": {
214
- "name": "Gemini 2.5 Flash (Gemini CLI)",
215
- "limit": { "context": 1048576, "output": 65536 },
216
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
217
- },
218
- "gemini-2.5-pro": {
219
- "name": "Gemini 2.5 Pro (Gemini CLI)",
220
- "limit": { "context": 1048576, "output": 65536 },
221
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
222
- },
223
- "gemini-3-flash-preview": {
224
- "name": "Gemini 3 Flash Preview (Gemini CLI)",
225
- "limit": { "context": 1048576, "output": 65536 },
226
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
227
- },
228
- "gemini-3-pro-preview": {
229
- "name": "Gemini 3 Pro Preview (Gemini CLI)",
230
- "limit": { "context": 1048576, "output": 65535 },
231
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
232
- },
233
- "gemini-3.1-pro-preview": {
234
- "name": "Gemini 3.1 Pro Preview (Gemini CLI)",
235
- "limit": { "context": 1048576, "output": 65535 },
236
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
237
- },
238
- "gemini-3.1-pro-preview-customtools": {
239
- "name": "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)",
240
- "limit": { "context": 1048576, "output": 65535 },
241
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
242
- }
243
- }
244
- }
245
- }
65
+ "plugin": ["@cortexkit/opencode-antigravity-auth@latest"]
246
66
  }
247
67
  ```
248
68
 
249
- > **Backward Compatibility:** Legacy model names with `antigravity-` prefix (e.g., `antigravity-gemini-3-flash`) still work. The plugin automatically handles model name transformation for both Antigravity and Gemini CLI APIs.
250
-
251
- </details>
252
-
253
- ---
254
-
255
- ## Multi-Account Setup
256
-
257
- Add multiple Google accounts for a higher combined quota. The plugin automatically rotates between accounts when one is rate-limited.
258
-
259
- ```bash
260
- opencode auth login # Run again to add more accounts
261
- ```
262
-
263
- **Account management options (via `opencode auth login`):**
264
- - **Configure models** — Auto-configure all plugin models in opencode.json
265
- - **Check quotas** — View remaining API quota for each account
266
- - **Manage accounts** — Enable/disable specific accounts for rotation
267
-
268
- For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
269
-
270
- ---
271
-
272
- ## Troubleshooting
273
-
274
- > **Quick Reset**: Most issues can be resolved by deleting `~/.config/opencode/antigravity-accounts.json` and running `opencode auth login` again.
275
-
276
- ### Configuration Path (All Platforms)
277
-
278
- OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
279
-
280
- | File | Path |
281
- |------|------|
282
- | Main config | `~/.config/opencode/opencode.json` |
283
- | Accounts | `~/.config/opencode/antigravity-accounts.json` |
284
- | Plugin config | `~/.config/opencode/antigravity.json` |
285
- | Debug logs | `~/.config/opencode/antigravity-logs/` |
286
-
287
- > **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
288
-
289
- > **Custom path**: Set `OPENCODE_CONFIG_DIR` environment variable to use a custom location.
290
-
291
- > **Windows migration**: If upgrading from plugin v1.3.x or earlier, the plugin will automatically find your existing config in `%APPDATA%\opencode\` and use it. New installations use `~/.config/opencode/`.
292
-
293
- ---
294
-
295
- ### Multi-Account Auth Issues
296
-
297
- If you encounter authentication issues with multiple accounts:
298
-
299
- 1. Delete the accounts file:
300
- ```bash
301
- rm ~/.config/opencode/antigravity-accounts.json
302
- ```
303
- 2. Re-authenticate:
304
- ```bash
305
- opencode auth login
306
- ```
307
-
308
- ---
309
-
310
- ### 403 Permission Denied (`rising-fact-p41fc`)
311
-
312
- **Error:**
313
- ```
314
- Permission 'cloudaicompanion.companions.generateChat' denied on resource
315
- '//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'
316
- ```
317
-
318
- **Cause:** Plugin falls back to a default project ID when no valid project is found. This works for Antigravity but fails for Gemini CLI models.
319
-
320
- **Solution:**
321
- 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
322
- 2. Create or select a project
323
- 3. Enable the **Gemini for Google Cloud API** (`cloudaicompanion.googleapis.com`)
324
- 4. Add `projectId` to your accounts file:
325
- ```json
326
- {
327
- "accounts": [
328
- {
329
- "email": "your@email.com",
330
- "refreshToken": "...",
331
- "projectId": "your-project-id"
332
- }
333
- ]
334
- }
335
- ```
336
-
337
- > **Note**: Do this for each account in a multi-account setup.
338
-
339
- ---
340
-
341
- ### Gemini Model Not Found
342
-
343
- Add this to your `google` provider config:
344
-
345
- ```json
69
+ ```jsonc
70
+ // ~/.config/opencode/tui.json
346
71
  {
347
- "provider": {
348
- "google": {
349
- "npm": "@ai-sdk/google",
350
- "models": { ... }
351
- }
352
- }
72
+ "plugin": ["@cortexkit/opencode-antigravity-auth"]
353
73
  }
354
74
  ```
355
75
 
356
- ---
357
-
358
- ### Gemini 3 Models 400 Error ("Unknown name 'parameters'")
359
-
360
- **Error:**
361
- ```
362
- Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
363
- ```
364
-
365
- **Causes:**
366
- - Tool schema incompatibility with Gemini's strict protobuf validation
367
- - MCP servers with malformed schemas
368
- - Plugin version regression
369
-
370
- **Solutions:**
371
- 1. **Update to latest beta:**
372
- ```json
373
- { "plugin": ["@cortexkit/opencode-antigravity-auth@latest"] }
374
- ```
76
+ The two files are independent — the server registration is read from `opencode.json` and the TUI registration from `tui.json`.
375
77
 
376
- 2. **Disable MCP servers** one-by-one to find the problematic one
78
+ Then start OpenCode and run `opencode auth login`, pick **Antigravity (Google OAuth)** in the menu (or `/antigravity-account add`). Verify with `npx -y @cortexkit/opencode-antigravity-auth quota`.
377
79
 
378
- 3. **Add npm override:**
379
- ```json
380
- { "provider": { "google": { "npm": "@ai-sdk/google" } } }
381
- ```
80
+ ### Contributor (Bun)
382
81
 
383
- ---
384
-
385
- ### MCP Servers Causing Errors
386
-
387
- Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
388
-
389
- **Common symptom:**
390
82
  ```bash
391
- Invalid function name must start with a letter or underscore
83
+ bun install # at repo root
84
+ bun run build # core -> opencode -> pi
85
+ bun run --cwd packages/opencode smoke:tui # bundle + spawn the precompiled TUI
392
86
  ```
393
87
 
394
- Sometimes it shows up as:
395
- ```bash
396
- GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore
397
- ```
88
+ A precompiled JSX tree ships under `dist/src/tui-compiled/` and is regenerated by `bun run build:tui` (alias of `bunx tsx packages/opencode/scripts/build-tui.ts`). The host runtime module loads either the **precompiled** tree (production) or the **raw** `src/tui.tsx` source (development installs). `bun run --cwd packages/opencode smoke:tui` confirms both subpaths resolve correctly against the packaged tarball.
398
89
 
399
- This usually means an MCP tool name starts with a number (for example, a 1mcp key like `1mcp_*`). Rename the MCP key to start with a letter (e.g., `gw`) or disable that MCP entry for Antigravity models.
90
+ > Note: the pre-`2.0` inline quota helper is no longer shipped. Use `antigravity-auth quota [--refresh] [--json]` from this package or from the standalone CLI.
400
91
 
401
- **Diagnosis:**
402
- 1. Disable all MCP servers in your config
403
- 2. Enable one-by-one until error reappears
404
- 3. Report the specific MCP in a [GitHub issue](https://github.com/cortexkit/antigravity-auth/issues)
92
+ ## v2.0 migration
405
93
 
406
- ---
94
+ - **Root exports changed.** The package no longer re-exports `authorizeAntigravity` / `exchangeAntigravity` at the root — import them from `@cortexkit/antigravity-auth-core` instead:
407
95
 
408
- ### "All Accounts Rate-Limited" (But Quota Available)
96
+ ```ts
97
+ // v1.x — no longer supported at the root
98
+ // import { authorizeAntigravity } from "@cortexkit/opencode-antigravity-auth"
409
99
 
410
- **Cause:** Cascade bug in `clearExpiredRateLimits()` in hybrid mode (fixed in recent beta).
100
+ // v2.0 — explicit core import
101
+ import { authorizeAntigravity, exchangeAntigravity } from "@cortexkit/antigravity-auth-core"
102
+ ```
411
103
 
412
- **Solutions:**
413
- 1. Update to latest beta version
414
- 2. If persists, delete accounts file and re-authenticate
415
- 3. Try switching `account_selection_strategy` to `"sticky"` in `antigravity.json`
104
+ - **`@opencode-ai/plugin` peer dependency** moved from `^0.15.30` to `^1.17.13`. Hosts on 1.17.13+ get the TUI registration through `opencode plugin` (the host reads `exports["./tui"]` and writes it into `tui.json`).
105
+ - **New peer dependencies** (`@opentui/core`, `@opentui/keymap`, `@opentui/solid` at `^0.4.5`) — required by the sidebar.
106
+ - No account-storage changes: the on-disk format is unchanged from the v1.4+ storage schema (`AccountStorageV4`).
107
+ - Missing accounts now return **HTTP 401 `UNAUTHENTICATED`** from the fetch interceptor instead of a synthetic 200 with assistant text.
416
108
 
417
- ---
109
+ See [packages/opencode/CHANGELOG.md](./CHANGELOG.md) for the full list of v2.0.0 changes.
418
110
 
419
- ### Session Recovery
111
+ ## Models
420
112
 
421
- If you encounter errors during a session:
422
- 1. Type `continue` to trigger the recovery mechanism
423
- 2. If blocked, use `/undo` to revert to pre-error state
424
- 3. Retry the operation
113
+ ### Quick reference
425
114
 
426
- ---
115
+ The model registry lives at `packages/core/src/model-registry.ts`; the OpenCode package re-exports it through `getAntigravityOpencodeModelIds()`. Models below are an authoritative mirror at the time of release.
427
116
 
428
- ### Using with Oh-My-OpenCode
117
+ | Model | Variants | Quota group |
118
+ | --- | --- | --- |
119
+ | `antigravity-gemini-3.6-flash` | `low`, `high` | `gemini-flash` |
120
+ | `antigravity-gemini-3.5-flash` | `low`, `high` | `gemini-flash` |
121
+ | `antigravity-gemini-3.1-pro` | `low`, `high` | `gemini-pro` |
122
+ | `antigravity-gemini-3.1-flash-image` | — | `gemini-flash` |
123
+ | `antigravity-claude-sonnet-4-6` | — | `claude` |
124
+ | `antigravity-claude-opus-4-6-thinking` | `low`, `max` | `claude` |
125
+ | `antigravity-gpt-oss-120b-medium` | — | `gpt-oss` |
126
+ | `gemini-2.5-flash` | — | `gemini-flash` (CLI pool) |
127
+ | `gemini-2.5-pro` | — | `gemini-pro` (CLI pool) |
128
+ | `gemini-3-flash-preview` | — | `gemini-flash` (CLI pool) |
129
+ | `gemini-3-pro-preview` | — | `gemini-pro` (CLI pool) |
130
+ | `gemini-3.1-pro-preview` | — | `gemini-pro` (CLI pool) |
131
+ | `gemini-3.1-pro-preview-customtools` | — | `gemini-pro` (CLI pool) |
429
132
 
430
- **Important:** Disable the built-in Google auth to prevent conflicts:
133
+ > Gemini 3.5 Flash-Lite is not in the AGY 1.1.5 Antigravity or Gemini CLI quota catalogs, and Gemini 3.5 Flash Cyber is restricted to a limited-access CodeMender pilot — neither is exposed by this plugin.
431
134
 
432
- ```json
433
- // ~/.config/opencode/oh-my-opencode.json
434
- {
435
- "google_auth": false,
436
- "agents": {
437
- "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
438
- "document-writer": { "model": "google/antigravity-gemini-3-flash" }
439
- }
440
- }
441
- ```
135
+ ### Routing
442
136
 
443
- ---
137
+ - **Antigravity-first (default).** Gemini requests go to the Antigravity header style first; on `429 RESOURCE_EXHAUSTED` they fall back to the Gemini CLI header set.
138
+ - **CLI-first** (`cli_first: true`). Flip the order — Gemini CLI first, Antigravity fallback. Toggle at runtime through `/antigravity-routing cli_first=true`.
139
+ - **Style-fallback** (`quota_style_fallback: true`). Re-send the SAME request through the other header set on a rate limit. Default OFF to prevent double-spend across pools. Toggle at runtime through `/antigravity-routing quota_style_fallback=true`.
140
+ - **Claude and image models** always use Antigravity regardless of toggles.
141
+ - Model names transform automatically between Antigravity and Gemini CLI namespaces (`antigravity-gemini-3-flash` ↔ `gemini-3-flash-preview`).
444
142
 
445
- ### Infinite `.tmp` Files Created
143
+ ### Quota, killswitch, and the soft-threshold fail-open
446
144
 
447
- **Cause:** When account is rate-limited and plugin retries infinitely, it creates many temp files.
145
+ Each cached quota entry carries `{ remainingFraction, resetTime }` per group:
448
146
 
449
- **Workaround:**
450
- 1. Stop OpenCode
451
- 2. Clean up: `rm ~/.config/opencode/*.tmp`
452
- 3. Add more accounts or wait for rate limit to expire
147
+ - **Soft-quota threshold** — `soft_quota_threshold_percent` (default 80). Accounts above the threshold are skipped as if rate-limited. Set to `100` to disable.
148
+ - **Stale-TTL fail-open** — `soft_quota_cache_ttl_minutes = "auto"` resolves to `max(2 × refresh, 10)` minutes. Cache older than the TTL is treated as unknown and allowed through.
149
+ - **Proactive rotation** — `proactive_rotation_threshold_percent` (default 20). When the active account's remaining quota drops below, dispatch the next request from a warm-cache account.
150
+ - **All-throttled wait** — `max_rate_limit_wait_seconds` (default 300). Cap on how long the interceptor waits when every account is rate-limited before failing fast.
453
151
 
454
- ---
152
+ The **operator killswitch** is a hard rejection layer run BEFORE the soft-quota filter:
455
153
 
456
- ### OAuth Callback Issues
154
+ - `enabled` master switch.
155
+ - `minimum_remaining_percent` (default 5) — global hard-block threshold.
156
+ - `accounts[key]` — per-account override keyed by `sha256(refreshToken).slice(0,12)`. The hash is deterministic but irreversible; the raw token never appears in the config, the sidebar, RPC payloads, or apply responses.
157
+ - **Cache-TTL fail-open** — when an account has no fresh cached quota (default 5 min TTL), it is allowed through so a cold start cannot deadlock.
158
+ - **All-killed error** — if the entire pool is excluded, the interceptor throws `AntigravityKillswitchError` with a per-account summary.
457
159
 
458
- <details>
459
- <summary><b>Safari OAuth Callback Fails (macOS)</b></summary>
160
+ Both filters run before the token bucket / health score pick, so the operator's threshold is authoritative even on a healthy pool.
460
161
 
461
- **Symptoms:**
462
- - "fail to authorize" after successful Google login
463
- - Safari shows "Safari can't open the page"
162
+ ## Six slash commands
464
163
 
465
- **Cause:** Safari's "HTTPS-Only Mode" blocks `http://localhost` callback.
164
+ All commands are registered through `packages/opencode/src/plugin/catalog.ts` and the modal flow renders in `packages/opencode/src/tui/command-dialogs.tsx`. The apply RPC defaults to `2_000` ms; account `add` / `refresh` opts into `120_000` ms because OAuth can take up to two minutes on a fresh login.
466
165
 
467
- **Solutions:**
166
+ | Command | Args | Default timeout |
167
+ | --- | --- | --- |
168
+ | `/antigravity-quota` | `[refresh]` — status (default) or refresh all accounts | `2_000` |
169
+ | `/antigravity-account` | `add` · `refresh` · `remove` · `list` | `2_000` for list/remove, `120_000` for add/refresh |
170
+ | `/antigravity-routing` | `cli_first=true\|false` · `quota_style_fallback=true\|false` (omit a key to flip) | `2_000` |
171
+ | `/antigravity-killswitch` | `enabled=true\|false` · `minimum_remaining_percent=0..100` | `2_000` |
172
+ | `/antigravity-dump` | `enable` · `disable` · `status` (alias: `/gemini-dump`) | `2_000` |
173
+ | `/antigravity-logging` | `error` · `warn` · `info` · `debug` · `trace` | `2_000` |
468
174
 
469
- 1. **Use Chrome or Firefox** (easiest):
470
- Copy the OAuth URL and paste into a different browser.
175
+ Every apply mutates persistent state and bumps the sidebar's `checkedAt` via `createSidebarRefresher` so the TUI's next poll sees a fresh snapshot. Sidebar writers go through `sidebarWriteChain` (cross-process fenced lock, 2s lock timeout, atomic write `0600`).
471
176
 
472
- 2. **Disable HTTPS-Only Mode temporarily:**
473
- - Safari > Settings (⌘,) > Privacy
474
- - Uncheck "Enable HTTPS-Only Mode"
475
- - Run `opencode auth login`
476
- - Re-enable after authentication
177
+ ## Standalone CLI
477
178
 
478
- </details>
179
+ The `antigravity-auth` bin is bundled into this package:
479
180
 
480
- <details>
481
- <summary><b>Port Conflict (Address Already in Use)</b></summary>
482
-
483
- **macOS / Linux:**
484
181
  ```bash
485
- # Find process using the port
486
- lsof -i :51121
182
+ npx -y @cortexkit/opencode-antigravity-auth login [--project <id>] [--no-browser]
183
+ npx -y @cortexkit/opencode-antigravity-auth list [--json]
184
+ npx -y @cortexkit/opencode-antigravity-auth quota [--json] [--refresh]
185
+ ```
487
186
 
488
- # Kill if stale
489
- kill -9 <PID>
187
+ - `login` runs the full PKCE + local callback flow. `--no-browser` prints the URL instead of opening it (handy in headless / SSH sessions where the browser cannot reach the callback port; see Troubleshooting).
188
+ - `list` prints `INDEX`, `EMAIL`, `STATUS` for every account in storage (`active`, `disabled`, `ineligible`, `verification-required`).
189
+ - `quota` prints `ACCOUNT`, `STATUS`, `GROUP`, `REMAINING`, `RESET` rows. `--refresh` forces a live refresh; `--json` emits the same data as JSON.
490
190
 
491
- # Retry
492
- opencode auth login
493
- ```
191
+ Exit codes: `0` success, `1` thrown error, `2` parse failure. The CLI writes to the same `antigravity-accounts.json` the plugin reads — a CLI login shows up at the next plugin reload.
494
192
 
495
- **Windows (PowerShell):**
496
- ```powershell
497
- netstat -ano | findstr :51121
498
- taskkill /PID <PID> /F
499
- opencode auth login
500
- ```
193
+ ## Multi-account setup
501
194
 
502
- </details>
195
+ ```bash
196
+ opencode auth login # run again to add more accounts; pick Antigravity (Google OAuth)
197
+ opencode auth login # → "Check quotas" or "Manage accounts" for the existing pool
198
+ ```
503
199
 
504
- <details>
505
- <summary><b>Docker / WSL2 / Remote Development</b></summary>
200
+ Options exposed through the auth menu: configure models in `opencode.json` automatically, view remaining quota per account, enable/disable specific accounts. See [docs/MULTI-ACCOUNT.md](./docs/MULTI-ACCOUNT.md) for the storage schema, fenced-lock writers, and the rotation strategies (`sticky`, `hybrid`, `round-robin`) in depth.
506
201
 
507
- OAuth callback requires browser to reach `localhost` on the machine running OpenCode.
202
+ ## Sidebar / RPC state and recovery
508
203
 
509
- **WSL2:**
510
- - Use VS Code's port forwarding, or
511
- - Configure Windows → WSL port forwarding
204
+ The sidebar reads from `$XDG_STATE_HOME/cortexkit/antigravity-auth/sidebar-state.json` (or whatever `ANTIGRAVITY_AUTH_SIDEBAR_STATE_FILE` points at) and polls every `2s`. The contract version is `1`; malformed JSON or unknown versions silently fall back to `DEFAULT_SIDEBAR_STATE` (which is rendered as "Awaiting Antigravity state"). Carries `version`, `checkedAt`, `accounts[]`, `activeRouting` (per-session map, pruned to 24h / 100 entries), `routingAuthoritative`, optional `quotaBackoffUntil` and `lastError`. **Never carries refresh tokens, access tokens, project IDs, or fingerprints.**
512
205
 
513
- **SSH / Remote:**
514
- ```bash
515
- ssh -L 51121:localhost:51121 user@remote
516
- ```
206
+ The RPC lives under `$XDG_STATE_HOME/cortexkit/antigravity-auth/rpc/<project-hash>/port-<pid>.json` (override via `ANTIGRAVITY_AUTH_RPC_DIR`). The TUI process reads the highest-mtime live entry, drops entries whose owning PID is dead (`process.kill(pid, 0)`), and posts to `/rpc/apply` / `/rpc/pending-notifications` with a `Bearer <token>` header on `http://127.0.0.1`. The default request timeout is `2_000` ms; account `add` / `refresh` opts into `120_000` ms.
517
207
 
518
- **Docker / Containers:**
519
- - OAuth with localhost redirect doesn't work in containers
520
- - Wait 30s for manual URL flow, or use SSH port forwarding
208
+ **Recovery from a stale sidebar** — stop the host, verify `$XDG_STATE_HOME/cortexkit/antigravity-auth/sidebar-state.json` exists and is `0600`, then restart. **Recovery from a missing RPC port file** — confirm the running plugin process exists; `getRpcDir(directory)` derives the directory from a sha256 of the project directory, so two projects on the same host get independent RPC dirs.
521
209
 
522
- </details>
210
+ ## Disposal
523
211
 
524
- ---
212
+ The plugin's `dispose()` (host shutdown) runs in order:
525
213
 
526
- ### Configuration Key Typo: `plugin` not `plugins`
214
+ 1. Dispose the active `AccountManager` + proactive token-refresh queue.
215
+ 2. Shut down the disk signature cache (if `keep_thinking` is on).
216
+ 3. Clear the session registry.
217
+ 4. Drop the fetch-interceptor state.
218
+ 5. `drainSidebarWrites()` — wait for any in-flight sidebar-state merge to land so the TUI sees a fully landed snapshot if the user immediately reopens.
219
+ 6. Tear down registered disposables (RPC server, file logger, quota manager).
527
220
 
528
- The correct key is `plugin` (singular):
221
+ This ordering matters because a routing upsert enqueued at shutdown must land before the host closes the terminal. See `packages/opencode/src/plugin/lifecycle.ts:createPluginLifecycle`.
529
222
 
530
- ```json
531
- {
532
- "plugin": ["@cortexkit/opencode-antigravity-auth@latest"]
533
- }
534
- ```
223
+ ## File / state inventory (this package)
535
224
 
536
- **Not** `"plugins"` (will cause "Unrecognized key" error).
225
+ | Purpose | Path | Mode | Notes |
226
+ | --- | --- | --- | --- |
227
+ | Account pool | `~/.config/opencode/antigravity-accounts.json` (`%APPDATA%\opencode\…` on Windows) | `0600` | Storage schema `V4`. |
228
+ | Plugin config | `~/.config/opencode/antigravity.json` (and project `.opencode/antigravity.json`) | `0600` | Zod-validated config. |
229
+ | Debug logs | `~/.config/opencode/antigravity-logs/` (or `log_dir`) | `0600` | Sensitive — request/response bodies. |
230
+ | Sidebar state | `$XDG_STATE_HOME/cortexkit/antigravity-auth/sidebar-state.json` | `0600` dir `0700` | Poll-every-2s; pruned to 24h / 100 entries. |
231
+ | RPC port file | `$XDG_STATE_HOME/cortexkit/antigravity-auth/rpc/<project-hash>/port-<pid>.json` | `0600` | Loopback token bearer. |
232
+ | Signature cache | `signature-cache-disk-<hash>.json` (when `keep_thinking: true`) | `0600` | 2-day default TTL. |
537
233
 
538
- ---
234
+ ## Debug sinks
539
235
 
540
- ### Migrating Accounts Between Machines
236
+ The plugin has **two** debug sinks controlled independently:
541
237
 
542
- When copying `antigravity-accounts.json` to a new machine:
543
- 1. Ensure the plugin is installed: `"plugin": ["@cortexkit/opencode-antigravity-auth@latest"]`
544
- 2. Copy `~/.config/opencode/antigravity-accounts.json`
545
- 3. If you get "API key missing" error, the refresh token may be invalid — re-authenticate
238
+ - `debug: true` — file logging under `log_dir`. Disabled by default. May include request/response bodies; handle with care.
239
+ - `debug_tui: true` — TUI log-panel verbosity. Independent of `debug`.
546
240
 
547
- ## Known Plugin Interactions
548
- For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
241
+ Combined with the runtime log-level filter (`operator.log_level`, mutable through `/antigravity-logging`), you have three independent knobs.
549
242
 
550
- ---
243
+ ## Plugin interactions
551
244
 
552
- ## Plugin Compatibility
245
+ For load-balancing, dual quota pools, and account storage details, see [docs/MULTI-ACCOUNT.md](./docs/MULTI-ACCOUNT.md).
553
246
 
554
- ### @tarquinen/opencode-dcp
247
+ ### `@tarquinen/opencode-dcp`
555
248
 
556
- DCP creates synthetic assistant messages that lack thinking blocks. **List this plugin BEFORE DCP:**
249
+ DCP creates synthetic assistant messages that lack thinking blocks. **List this plugin BEFORE DCP**:
557
250
 
558
251
  ```json
559
252
  {
@@ -564,7 +257,7 @@ DCP creates synthetic assistant messages that lack thinking blocks. **List this
564
257
  }
565
258
  ```
566
259
 
567
- ### oh-my-opencode
260
+ ### `oh-my-opencode`
568
261
 
569
262
  Disable built-in auth and override agent models in `oh-my-opencode.json`:
570
263
 
@@ -583,117 +276,105 @@ Disable built-in auth and override agent models in `oh-my-opencode.json`:
583
276
 
584
277
  ### Plugins you don't need
585
278
 
586
- - **gemini-auth plugins** — Not needed. This plugin handles all Google OAuth.
587
-
588
- ---
279
+ - **gemini-auth plugins** — not needed; this plugin handles all Google OAuth.
589
280
 
590
- ## Configuration
281
+ ## Configuration keys (selected)
591
282
 
592
- Create `~/.config/opencode/antigravity.json` for optional settings:
283
+ Created by `~/.config/opencode/antigravity.json` for optional overrides. The full list with defaults and env overrides is in the [root README](../../README.md#configuration-reference) and the generated schema at [`assets/antigravity.schema.json`](./assets/antigravity.schema.json).
593
284
 
594
285
  ```json
595
286
  {
596
- "$schema": "https://raw.githubusercontent.com/cortexkit/antigravity-auth/main/assets/antigravity.schema.json"
287
+ "$schema": "https://raw.githubusercontent.com/cortexkit/antigravity-auth/main/assets/antigravity.schema.json",
288
+ "account_selection_strategy": "hybrid",
289
+ "scheduling_mode": "cache_first",
290
+ "soft_quota_threshold_percent": 80,
291
+ "quota_refresh_interval_minutes": 30,
292
+ "keep_thinking": false
597
293
  }
598
294
  ```
599
295
 
600
- Most users don't need to configure anything — defaults work well.
296
+ Environment variables:
601
297
 
602
- ### Model Behavior
298
+ ```bash
299
+ OPENCODE_CONFIG_DIR=/path/to/config opencode
300
+ OPENCODE_ANTIGRAVITY_DEBUG=1 opencode
301
+ OPENCODE_ANTIGRAVITY_DEBUG_TUI=1 opencode
302
+ OPENCODE_ANTIGRAVITY_LOG_DIR=/secure/path opencode
303
+ ```
603
304
 
604
- | Option | Default | What it does |
605
- |--------|---------|--------------
606
- | `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
607
- | `session_recovery` | `true` | Auto-recover from tool errors |
608
- | `cli_first` | `false` | Route Gemini models to Gemini CLI first (Claude and image models stay on Antigravity). |
305
+ For every option, see [docs/CONFIGURATION.md](./docs/CONFIGURATION.md) and the generated [`assets/antigravity.schema.json`](./assets/antigravity.schema.json).
609
306
 
610
- ### Account Rotation
307
+ ## Tests
611
308
 
612
- | Your Setup | Recommended Config |
613
- |------------|-------------------|
614
- | **1 account** | `"account_selection_strategy": "sticky"` |
615
- | **2-5 accounts** | Default (`"hybrid"`) works great |
616
- | **5+ accounts** | `"account_selection_strategy": "round-robin"` |
617
- | **Parallel agents** | Add `"pid_offset_enabled": true` |
309
+ This package ships **deterministic** tests for everything except the model registry and the live cross-model regression suite:
618
310
 
619
- ### Quota Protection
311
+ | Scope | Tooling | Network | Command |
312
+ | --- | --- | --- | --- |
313
+ | Unit (deterministic) | `bun test --isolate` | No | `bun run test` |
314
+ | Black-box e2e (deterministic) | mock Antigravity + harness runner in `packages/e2e-tests/` | No | `bun run test:e2e` |
315
+ | Live model inventory | `script/test-models.ts` | Yes (gated by label) | `bun run test:e2e:models` |
316
+ | Cross-model regression | `script/test-regression.ts` + `script/test-cross-model*.sh` | Yes | `bun run test:e2e:regression` |
317
+ | TUI smoke | install tarball + spawn | No | `bun run smoke:tui` |
620
318
 
621
- | Option | Default | What it does |
622
- |--------|---------|--------------|
623
- | `soft_quota_threshold_percent` | `90` | Skip account when quota usage exceeds this percentage. Prevents Google from penalizing accounts that fully exhaust quota. Set to `100` to disable. |
624
- | `quota_refresh_interval_minutes` | `15` | Background quota refresh interval. After successful API requests, refreshes quota cache if older than this interval. Set to `0` to disable. |
625
- | `soft_quota_cache_ttl_minutes` | `"auto"` | How long quota cache is considered fresh. `"auto"` = max(2 × refresh interval, 10 minutes). Set a number (1-120) for fixed TTL. |
319
+ The deterministic tier is what CI gates; the live tier is opt-in for changes that touch the model registry, the request transform, or the response transform.
626
320
 
627
- > **How it works**: Quota cache is refreshed automatically after API requests (when older than `quota_refresh_interval_minutes`) and manually via "Check quotas" in `opencode auth login`. The threshold check uses `soft_quota_cache_ttl_minutes` to determine cache freshness - if cache is older, the account is considered "unknown" and allowed (fail-open). When ALL accounts exceed the threshold, the plugin waits for the earliest quota reset time (like rate limit behavior). If wait time exceeds `max_rate_limit_wait_seconds`, it errors immediately.
321
+ ## Troubleshooting
628
322
 
629
- ### Rate Limit Scheduling
323
+ > **Quick reset** when nothing else works: stop OpenCode, `rm ~/.config/opencode/antigravity-accounts.json`, then `opencode auth login`.
630
324
 
631
- Control how the plugin handles rate limits:
325
+ ### Configuration paths (all platforms)
632
326
 
633
- | Option | Default | What it does |
634
- |--------|---------|--------------|
635
- | `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
636
- | `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
637
- | `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
327
+ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows; do not use `%APPDATA%` for new installs. Override with `OPENCODE_CONFIG_DIR`. v1.3.x and earlier stored config under `%APPDATA%\opencode\` — the plugin auto-migrates on first read.
638
328
 
639
- **When to use each mode:**
640
- - **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
641
- - **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
642
- - **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
329
+ ### OAuth callback issues
643
330
 
644
- ### App Behavior
331
+ - **Safari HTTPS-Only mode** blocks `http://localhost`. Switch browsers or temporarily disable HTTPS-Only (Safari → Settings → Privacy) during login.
332
+ - **Stale `Address already in use :51121`** — `lsof -i :51121` (or `netstat -ano | findstr :51121` on Windows) → kill the PID → retry. The standalone CLI's `--no-browser` flag avoids the listener entirely.
333
+ - **SSH / remote dev** — forward the callback port with `ssh -L 51121:localhost:51121 user@remote`. The standalone CLI + `--no-browser` is the simplest workaround when SSH-port-forwarding is awkward.
334
+ - **Docker / WSL2 / containers** — localhost OAuth does not work in containers out of the box. Wait 30s for the manual URL flow, or port-forward `51121` to the host.
645
335
 
646
- | Option | Default | What it does |
647
- |--------|---------|--------------|
648
- | `quiet_mode` | `false` | Hide toast notifications |
649
- | `debug` | `false` | Enable debug file logging (`~/.config/opencode/antigravity-logs/`) |
650
- | `debug_tui` | `false` | Show debug logs in the TUI log panel (independent from `debug`) |
651
- | `auto_update` | `true` | Auto-update plugin |
336
+ ### Common errors
652
337
 
653
- For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
338
+ - **`Permission 'cloudaicompanion.companions.generateChat' denied on resource '…/locations/global'`** — Antigravity returned no project ID (likely a workspace account) and the plugin used the hardcoded fallback `rising-fact-p41fc`. Enable the Gemini for Google Cloud API on a Cloud project and set `projectId` on the account in `antigravity-accounts.json`.
339
+ - **Gemini 3 model 400 "Unknown name 'parameters'"** — usually a tool-schema incompatibility. Update to the latest plugin version; or disable MCP servers one-by-one to isolate the offender.
340
+ - **`Invalid function name must start with a letter or underscore`** — an MCP tool name starts with a digit (e.g. `1mcp_*`). Rename the MCP key to start with a letter (e.g. `gw`) or disable that MCP entry for Antigravity models.
341
+ - **`All Accounts Rate-Limited (But Quota Available)`** — usually a stale cascade in `clearExpiredRateLimits()`. Lower `soft_quota_threshold_percent` (or raise to `100`), run `/antigravity-quota refresh`, or delete `antigravity-accounts.json` and re-authenticate.
342
+ - **Infinite `.tmp` files** — a rate-limit retry loop is creating temp files faster than cleanup. Stop OpenCode, `rm ~/.config/opencode/*.tmp`, add accounts, or wait for the cooldown.
654
343
 
655
- **Environment variables:**
656
- ```bash
657
- OPENCODE_CONFIG_DIR=/path/to/config opencode # Custom config directory
658
- OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug file logging
659
- OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose debug file logging
660
- OPENCODE_ANTIGRAVITY_DEBUG_TUI=1 opencode # Enable TUI log panel debug output
661
- ```
344
+ ### Sidebar / TUI
662
345
 
663
- ---
346
+ - **`Awaiting Antigravity state` stuck** — verify `$XDG_STATE_HOME/cortexkit/antigravity-auth/sidebar-state.json` exists, is `0600`, and the host user can write. Restart the host.
347
+ - **TUI bundle fails to spawn** — `bun run --cwd packages/opencode build` regenerates `dist/src/tui-compiled/tui.tsx`. Verify the file exists. Then `bun run --cwd packages/opencode smoke:tui`.
348
+ - **`Antigravity RPC server is not available`** — the TUI posts to a per-PID port file in `$XDG_STATE_HOME/cortexkit/antigravity-auth/rpc/<project-hash>/`. If the running plugin process is gone, stop and restart the host.
664
349
 
665
- ## Troubleshooting
350
+ ### Migration between machines
351
+
352
+ When copying `antigravity-accounts.json` to a new machine:
666
353
 
667
- See the full [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for solutions to common issues including:
354
+ 1. Ensure the plugin is installed: `"plugin": ["@cortexkit/opencode-antigravity-auth@latest"]`.
355
+ 2. Copy `~/.config/opencode/antigravity-accounts.json` (preserve the `0600` mode).
356
+ 3. If you see `API key missing`, the refresh token may be invalid — re-authenticate.
668
357
 
669
- - Auth problems and token refresh
670
- - "Model not found" errors
671
- - Session recovery
672
- - Gemini CLI permission errors
673
- - Safari OAuth issues
674
- - Plugin compatibility
675
- - Migration guides
358
+ ### Plugin config schema
676
359
 
677
- ---
360
+ The schema reference at `assets/antigravity.schema.json` drives editor IntelliSense. Set `$schema: "https://raw.githubusercontent.com/cortexkit/antigravity-auth/main/assets/antigravity.schema.json"` in your `antigravity.json` for autocomplete in the IDE.
678
361
 
679
362
  ## Documentation
680
363
 
681
- - [Configuration](docs/CONFIGURATION.md) — All configuration options
682
- - [Multi-Account](docs/MULTI-ACCOUNT.md) — Load balancing, dual quota pools, account storage
683
- - [Model Variants](docs/MODEL-VARIANTS.md) — Thinking budgets and variant system
684
- - [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and fixes
685
- - [Architecture](docs/ARCHITECTURE.md) — How the plugin works
686
- - [API Spec](docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
687
-
688
- ---
364
+ - [Root README](../../README.md) — full operator + contributor guide
365
+ - [CHANGELOG.md](./CHANGELOG.md) — release history
366
+ - [STRUCTURE.md](./STRUCTURE.md) — file-system map
367
+ - [ARCHITECTURE.md](./ARCHITECTURE.md) — architecture overview
368
+ - [docs/CONFIGURATION.md](./docs/CONFIGURATION.md) — every option with examples
369
+ - [docs/MULTI-ACCOUNT.md](./docs/MULTI-ACCOUNT.md) — load balancing, dual quota, storage
370
+ - [docs/MODEL-VARIANTS.md](./docs/MODEL-VARIANTS.md) — variants and thinking budgets
371
+ - [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) — long-form troubleshooting
372
+ - [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) — internal architecture
373
+ - [docs/ANTIGRAVITY_API_SPEC.md](./docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
689
374
 
690
375
  ## Support
691
376
 
692
- If this plugin saves you time, consider supporting its development:
693
-
694
- [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S81QBOIR)
695
-
696
- ---
377
+ If this plugin saves you time, consider supporting its development at <https://ko-fi.com/S6S81QBOIR>.
697
378
 
698
379
  ## Credits
699
380
 
@@ -702,29 +383,4 @@ If this plugin saves you time, consider supporting its development:
702
383
 
703
384
  ## License
704
385
 
705
- MIT License. See [LICENSE](LICENSE) for details.
706
-
707
- <details>
708
- <summary><b>Legal</b></summary>
709
-
710
- ### Intended Use
711
-
712
- - Personal / internal development only
713
- - Respect internal quotas and data handling policies
714
- - Not for production services or bypassing intended limits
715
-
716
- ### Warning
717
-
718
- By using this plugin, you acknowledge:
719
-
720
- - **Terms of Service risk** — This approach may violate ToS of AI model providers
721
- - **Account risk** — Providers may suspend or ban accounts
722
- - **No guarantees** — APIs may change without notice
723
- - **Assumption of risk** — You assume all legal, financial, and technical risks
724
-
725
- ### Disclaimer
726
-
727
- - Not affiliated with Google. This is an independent open-source project.
728
- - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
729
-
730
- </details>
386
+ MIT. See [LICENSE](./LICENSE).