@cortexkit/opencode-antigravity-auth 1.1.0 → 2.0.0

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 (371) hide show
  1. package/README.md +225 -569
  2. package/dist/cli.js +3790 -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 +18767 -13829
  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/accounts.d.ts +7 -256
  38. package/dist/src/plugin/accounts.d.ts.map +1 -1
  39. package/dist/src/plugin/accounts.js +31 -1367
  40. package/dist/src/plugin/accounts.js.map +1 -1
  41. package/dist/src/plugin/agy-request-metadata.d.ts +1 -1
  42. package/dist/src/plugin/agy-request-metadata.js +1 -1
  43. package/dist/src/plugin/agy-transport.d.ts +1 -1
  44. package/dist/src/plugin/agy-transport.js +1 -1
  45. package/dist/src/plugin/auth-doctor.d.ts +6 -6
  46. package/dist/src/plugin/auth-doctor.d.ts.map +1 -1
  47. package/dist/src/plugin/auth-doctor.js +74 -66
  48. package/dist/src/plugin/auth-doctor.js.map +1 -1
  49. package/dist/src/plugin/auth-drift.d.ts +4 -4
  50. package/dist/src/plugin/auth-drift.d.ts.map +1 -1
  51. package/dist/src/plugin/auth-drift.js +15 -15
  52. package/dist/src/plugin/auth-drift.js.map +1 -1
  53. package/dist/src/plugin/auth-loader.d.ts +35 -0
  54. package/dist/src/plugin/auth-loader.d.ts.map +1 -0
  55. package/dist/src/plugin/auth-loader.js +144 -0
  56. package/dist/src/plugin/auth-loader.js.map +1 -0
  57. package/dist/src/plugin/auth.d.ts +1 -1
  58. package/dist/src/plugin/auth.js +1 -1
  59. package/dist/src/plugin/cache/index.d.ts +1 -1
  60. package/dist/src/plugin/cache/index.d.ts.map +1 -1
  61. package/dist/src/plugin/cache/index.js +1 -1
  62. package/dist/src/plugin/cache/index.js.map +1 -1
  63. package/dist/src/plugin/cache/signature-cache.d.ts +1 -1
  64. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  65. package/dist/src/plugin/cache/signature-cache.js +23 -24
  66. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  67. package/dist/src/plugin/cache.d.ts +6 -5
  68. package/dist/src/plugin/cache.d.ts.map +1 -1
  69. package/dist/src/plugin/cache.js +21 -7
  70. package/dist/src/plugin/cache.js.map +1 -1
  71. package/dist/src/plugin/catalog.d.ts +23 -0
  72. package/dist/src/plugin/catalog.d.ts.map +1 -0
  73. package/dist/src/plugin/catalog.js +60 -0
  74. package/dist/src/plugin/catalog.js.map +1 -0
  75. package/dist/src/plugin/cli.d.ts +7 -7
  76. package/dist/src/plugin/cli.d.ts.map +1 -1
  77. package/dist/src/plugin/cli.js +62 -55
  78. package/dist/src/plugin/cli.js.map +1 -1
  79. package/dist/src/plugin/command-data.d.ts +276 -0
  80. package/dist/src/plugin/command-data.d.ts.map +1 -0
  81. package/dist/src/plugin/command-data.js +325 -0
  82. package/dist/src/plugin/command-data.js.map +1 -0
  83. package/dist/src/plugin/commands.d.ts +151 -0
  84. package/dist/src/plugin/commands.d.ts.map +1 -0
  85. package/dist/src/plugin/commands.js +639 -0
  86. package/dist/src/plugin/commands.js.map +1 -0
  87. package/dist/src/plugin/config/index.d.ts +2 -2
  88. package/dist/src/plugin/config/index.d.ts.map +1 -1
  89. package/dist/src/plugin/config/index.js +2 -2
  90. package/dist/src/plugin/config/index.js.map +1 -1
  91. package/dist/src/plugin/config/loader.d.ts +1 -1
  92. package/dist/src/plugin/config/loader.d.ts.map +1 -1
  93. package/dist/src/plugin/config/loader.js +18 -16
  94. package/dist/src/plugin/config/loader.js.map +1 -1
  95. package/dist/src/plugin/config/models.d.ts +2 -2
  96. package/dist/src/plugin/config/models.d.ts.map +1 -1
  97. package/dist/src/plugin/config/models.js +1 -1
  98. package/dist/src/plugin/config/models.js.map +1 -1
  99. package/dist/src/plugin/config/operator-settings-schema.d.ts +29 -0
  100. package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
  101. package/dist/src/plugin/config/operator-settings-schema.js +28 -0
  102. package/dist/src/plugin/config/operator-settings-schema.js.map +1 -0
  103. package/dist/src/plugin/config/schema.d.ts +21 -2
  104. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  105. package/dist/src/plugin/config/schema.js +85 -25
  106. package/dist/src/plugin/config/schema.js.map +1 -1
  107. package/dist/src/plugin/config/updater.d.ts.map +1 -1
  108. package/dist/src/plugin/config/updater.js +15 -15
  109. package/dist/src/plugin/config/updater.js.map +1 -1
  110. package/dist/src/plugin/config/writer.d.ts +34 -0
  111. package/dist/src/plugin/config/writer.d.ts.map +1 -0
  112. package/dist/src/plugin/config/writer.js +81 -0
  113. package/dist/src/plugin/config/writer.js.map +1 -0
  114. package/dist/src/plugin/core/streaming/index.d.ts +1 -1
  115. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -1
  116. package/dist/src/plugin/core/streaming/index.js +1 -1
  117. package/dist/src/plugin/core/streaming/index.js.map +1 -1
  118. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
  119. package/dist/src/plugin/core/streaming/transformer.js +85 -44
  120. package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
  121. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
  122. package/dist/src/plugin/debug.d.ts +3 -3
  123. package/dist/src/plugin/debug.d.ts.map +1 -1
  124. package/dist/src/plugin/debug.js +85 -47
  125. package/dist/src/plugin/debug.js.map +1 -1
  126. package/dist/src/plugin/dependencies.d.ts +129 -0
  127. package/dist/src/plugin/dependencies.d.ts.map +1 -0
  128. package/dist/src/plugin/dependencies.js +107 -0
  129. package/dist/src/plugin/dependencies.js.map +1 -0
  130. package/dist/src/plugin/errors.d.ts +27 -0
  131. package/dist/src/plugin/errors.d.ts.map +1 -1
  132. package/dist/src/plugin/errors.js +29 -3
  133. package/dist/src/plugin/errors.js.map +1 -1
  134. package/dist/src/plugin/event-handler.d.ts +53 -0
  135. package/dist/src/plugin/event-handler.d.ts.map +1 -0
  136. package/dist/src/plugin/event-handler.js +101 -0
  137. package/dist/src/plugin/event-handler.js.map +1 -0
  138. package/dist/src/plugin/fetch/retry-state.d.ts +61 -0
  139. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -0
  140. package/dist/src/plugin/fetch/retry-state.js +248 -0
  141. package/dist/src/plugin/fetch/retry-state.js.map +1 -0
  142. package/dist/src/plugin/fetch/warmup.d.ts +30 -0
  143. package/dist/src/plugin/fetch/warmup.d.ts.map +1 -0
  144. package/dist/src/plugin/fetch/warmup.js +76 -0
  145. package/dist/src/plugin/fetch/warmup.js.map +1 -0
  146. package/dist/src/plugin/fetch-interceptor.d.ts +59 -0
  147. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -0
  148. package/dist/src/plugin/fetch-interceptor.js +1387 -0
  149. package/dist/src/plugin/fetch-interceptor.js.map +1 -0
  150. package/dist/src/plugin/fetch-routing.d.ts +26 -0
  151. package/dist/src/plugin/fetch-routing.d.ts.map +1 -0
  152. package/dist/src/plugin/fetch-routing.js +99 -0
  153. package/dist/src/plugin/fetch-routing.js.map +1 -0
  154. package/dist/src/plugin/fingerprint.d.ts +1 -1
  155. package/dist/src/plugin/fingerprint.js +1 -1
  156. package/dist/src/plugin/gemini-dump.d.ts +5 -5
  157. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  158. package/dist/src/plugin/gemini-dump.js +109 -55
  159. package/dist/src/plugin/gemini-dump.js.map +1 -1
  160. package/dist/src/plugin/google-search-tool.d.ts +9 -0
  161. package/dist/src/plugin/google-search-tool.d.ts.map +1 -0
  162. package/dist/src/plugin/google-search-tool.js +56 -0
  163. package/dist/src/plugin/google-search-tool.js.map +1 -0
  164. package/dist/src/plugin/image-saver.d.ts.map +1 -1
  165. package/dist/src/plugin/image-saver.js +16 -16
  166. package/dist/src/plugin/image-saver.js.map +1 -1
  167. package/dist/src/plugin/index.d.ts +23 -0
  168. package/dist/src/plugin/index.d.ts.map +1 -0
  169. package/dist/src/plugin/index.js +308 -0
  170. package/dist/src/plugin/index.js.map +1 -0
  171. package/dist/src/plugin/killswitch.d.ts +94 -0
  172. package/dist/src/plugin/killswitch.d.ts.map +1 -0
  173. package/dist/src/plugin/killswitch.js +194 -0
  174. package/dist/src/plugin/killswitch.js.map +1 -0
  175. package/dist/src/plugin/lifecycle.d.ts +40 -0
  176. package/dist/src/plugin/lifecycle.d.ts.map +1 -0
  177. package/dist/src/plugin/lifecycle.js +73 -0
  178. package/dist/src/plugin/lifecycle.js.map +1 -0
  179. package/dist/src/plugin/logger.d.ts +10 -1
  180. package/dist/src/plugin/logger.d.ts.map +1 -1
  181. package/dist/src/plugin/logger.js +38 -12
  182. package/dist/src/plugin/logger.js.map +1 -1
  183. package/dist/src/plugin/logging-utils.d.ts +35 -1
  184. package/dist/src/plugin/logging-utils.d.ts.map +1 -1
  185. package/dist/src/plugin/logging-utils.js +98 -15
  186. package/dist/src/plugin/logging-utils.js.map +1 -1
  187. package/dist/src/plugin/model-registry.d.ts +1 -1
  188. package/dist/src/plugin/model-registry.js +1 -1
  189. package/dist/src/plugin/oauth-login.d.ts +22 -0
  190. package/dist/src/plugin/oauth-login.d.ts.map +1 -0
  191. package/dist/src/plugin/oauth-login.js +37 -0
  192. package/dist/src/plugin/oauth-login.js.map +1 -0
  193. package/dist/src/plugin/oauth-methods.d.ts +42 -0
  194. package/dist/src/plugin/oauth-methods.d.ts.map +1 -0
  195. package/dist/src/plugin/oauth-methods.js +1284 -0
  196. package/dist/src/plugin/oauth-methods.js.map +1 -0
  197. package/dist/src/plugin/operator-settings.d.ts +40 -0
  198. package/dist/src/plugin/operator-settings.d.ts.map +1 -0
  199. package/dist/src/plugin/operator-settings.js +148 -0
  200. package/dist/src/plugin/operator-settings.js.map +1 -0
  201. package/dist/src/plugin/persist-account-pool.d.ts +37 -0
  202. package/dist/src/plugin/persist-account-pool.d.ts.map +1 -0
  203. package/dist/src/plugin/persist-account-pool.js +142 -0
  204. package/dist/src/plugin/persist-account-pool.js.map +1 -0
  205. package/dist/src/plugin/project.d.ts +1 -1
  206. package/dist/src/plugin/project.js +1 -1
  207. package/dist/src/plugin/prompt-context.d.ts.map +1 -1
  208. package/dist/src/plugin/prompt-context.js +11 -11
  209. package/dist/src/plugin/prompt-context.js.map +1 -1
  210. package/dist/src/plugin/quota.d.ts +97 -41
  211. package/dist/src/plugin/quota.d.ts.map +1 -1
  212. package/dist/src/plugin/quota.js +273 -285
  213. package/dist/src/plugin/quota.js.map +1 -1
  214. package/dist/src/plugin/recovery/constants.d.ts.map +1 -1
  215. package/dist/src/plugin/recovery/constants.js +24 -15
  216. package/dist/src/plugin/recovery/constants.js.map +1 -1
  217. package/dist/src/plugin/recovery/index.d.ts +3 -3
  218. package/dist/src/plugin/recovery/index.d.ts.map +1 -1
  219. package/dist/src/plugin/recovery/index.js +3 -3
  220. package/dist/src/plugin/recovery/index.js.map +1 -1
  221. package/dist/src/plugin/recovery/storage.d.ts +1 -1
  222. package/dist/src/plugin/recovery/storage.d.ts.map +1 -1
  223. package/dist/src/plugin/recovery/storage.js +31 -39
  224. package/dist/src/plugin/recovery/storage.js.map +1 -1
  225. package/dist/src/plugin/recovery/types.d.ts +12 -12
  226. package/dist/src/plugin/recovery/types.d.ts.map +1 -1
  227. package/dist/src/plugin/recovery.d.ts +3 -3
  228. package/dist/src/plugin/recovery.d.ts.map +1 -1
  229. package/dist/src/plugin/recovery.js +62 -58
  230. package/dist/src/plugin/recovery.js.map +1 -1
  231. package/dist/src/plugin/refresh-queue.d.ts +5 -2
  232. package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
  233. package/dist/src/plugin/refresh-queue.js +37 -15
  234. package/dist/src/plugin/refresh-queue.js.map +1 -1
  235. package/dist/src/plugin/request-helpers.d.ts +1 -1
  236. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  237. package/dist/src/plugin/request-helpers.js +451 -352
  238. package/dist/src/plugin/request-helpers.js.map +1 -1
  239. package/dist/src/plugin/request.d.ts +7 -7
  240. package/dist/src/plugin/request.d.ts.map +1 -1
  241. package/dist/src/plugin/request.js +622 -384
  242. package/dist/src/plugin/request.js.map +1 -1
  243. package/dist/src/plugin/rotation.d.ts +1 -168
  244. package/dist/src/plugin/rotation.d.ts.map +1 -1
  245. package/dist/src/plugin/rotation.js +1 -327
  246. package/dist/src/plugin/rotation.js.map +1 -1
  247. package/dist/src/plugin/search.d.ts.map +1 -1
  248. package/dist/src/plugin/search.js +39 -35
  249. package/dist/src/plugin/search.js.map +1 -1
  250. package/dist/src/plugin/server.d.ts +1 -1
  251. package/dist/src/plugin/server.d.ts.map +1 -1
  252. package/dist/src/plugin/server.js +42 -37
  253. package/dist/src/plugin/server.js.map +1 -1
  254. package/dist/src/plugin/session-context.d.ts +2 -1
  255. package/dist/src/plugin/session-context.d.ts.map +1 -1
  256. package/dist/src/plugin/session-context.js +11 -7
  257. package/dist/src/plugin/session-context.js.map +1 -1
  258. package/dist/src/plugin/storage.d.ts +59 -120
  259. package/dist/src/plugin/storage.d.ts.map +1 -1
  260. package/dist/src/plugin/storage.js +140 -485
  261. package/dist/src/plugin/storage.js.map +1 -1
  262. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -1
  263. package/dist/src/plugin/stores/signature-store.js.map +1 -1
  264. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -1
  265. package/dist/src/plugin/thinking-recovery.js +35 -33
  266. package/dist/src/plugin/thinking-recovery.js.map +1 -1
  267. package/dist/src/plugin/token.d.ts +2 -2
  268. package/dist/src/plugin/token.d.ts.map +1 -1
  269. package/dist/src/plugin/token.js +30 -21
  270. package/dist/src/plugin/token.js.map +1 -1
  271. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +1 -1
  272. package/dist/src/plugin/transform/cross-model-sanitizer.js +1 -1
  273. package/dist/src/plugin/transform/index.d.ts +1 -1
  274. package/dist/src/plugin/transform/index.js +1 -1
  275. package/dist/src/plugin/transform/model-resolver.d.ts +1 -1
  276. package/dist/src/plugin/transform/model-resolver.js +1 -1
  277. package/dist/src/plugin/transform/types.d.ts +1 -1
  278. package/dist/src/plugin/transform/types.js +1 -1
  279. package/dist/src/plugin/types.d.ts +25 -69
  280. package/dist/src/plugin/types.d.ts.map +1 -1
  281. package/dist/src/plugin/ui/ansi.d.ts.map +1 -1
  282. package/dist/src/plugin/ui/ansi.js.map +1 -1
  283. package/dist/src/plugin/ui/auth-menu.d.ts +1 -1
  284. package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
  285. package/dist/src/plugin/ui/auth-menu.js +82 -31
  286. package/dist/src/plugin/ui/auth-menu.js.map +1 -1
  287. package/dist/src/plugin/ui/confirm.d.ts.map +1 -1
  288. package/dist/src/plugin/ui/confirm.js.map +1 -1
  289. package/dist/src/plugin/ui/model-status.d.ts +3 -3
  290. package/dist/src/plugin/ui/model-status.d.ts.map +1 -1
  291. package/dist/src/plugin/ui/model-status.js +3 -3
  292. package/dist/src/plugin/ui/model-status.js.map +1 -1
  293. package/dist/src/plugin/ui/quota-status.d.ts +4 -4
  294. package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
  295. package/dist/src/plugin/ui/quota-status.js +51 -49
  296. package/dist/src/plugin/ui/quota-status.js.map +1 -1
  297. package/dist/src/plugin/ui/select.d.ts.map +1 -1
  298. package/dist/src/plugin/ui/select.js +22 -12
  299. package/dist/src/plugin/ui/select.js.map +1 -1
  300. package/dist/src/plugin/version.d.ts +1 -1
  301. package/dist/src/plugin/version.js +1 -1
  302. package/dist/src/rpc/notifications.d.ts +6 -0
  303. package/dist/src/rpc/notifications.d.ts.map +1 -0
  304. package/dist/src/rpc/notifications.js +46 -0
  305. package/dist/src/rpc/notifications.js.map +1 -0
  306. package/dist/src/rpc/port-file.d.ts +13 -0
  307. package/dist/src/rpc/port-file.d.ts.map +1 -0
  308. package/dist/src/rpc/port-file.js +109 -0
  309. package/dist/src/rpc/port-file.js.map +1 -0
  310. package/dist/src/rpc/protocol.d.ts +22 -0
  311. package/dist/src/rpc/protocol.d.ts.map +1 -0
  312. package/dist/src/rpc/protocol.js +1 -0
  313. package/dist/src/rpc/protocol.js.map +1 -0
  314. package/dist/src/rpc/rpc-client.d.ts +10 -0
  315. package/dist/src/rpc/rpc-client.d.ts.map +1 -0
  316. package/dist/src/rpc/rpc-client.js +58 -0
  317. package/dist/src/rpc/rpc-client.js.map +1 -0
  318. package/dist/src/rpc/rpc-dir.d.ts +4 -0
  319. package/dist/src/rpc/rpc-dir.d.ts.map +1 -0
  320. package/dist/src/rpc/rpc-dir.js +19 -0
  321. package/dist/src/rpc/rpc-dir.js.map +1 -0
  322. package/dist/src/rpc/rpc-server.d.ts +13 -0
  323. package/dist/src/rpc/rpc-server.d.ts.map +1 -0
  324. package/dist/src/rpc/rpc-server.js +231 -0
  325. package/dist/src/rpc/rpc-server.js.map +1 -0
  326. package/dist/src/sidebar-state.d.ts +240 -0
  327. package/dist/src/sidebar-state.d.ts.map +1 -0
  328. package/dist/src/sidebar-state.js +520 -0
  329. package/dist/src/sidebar-state.js.map +1 -0
  330. package/dist/src/tui/command-dialogs.d.ts +61 -0
  331. package/dist/src/tui/command-dialogs.d.ts.map +1 -0
  332. package/dist/src/tui/command-dialogs.js +497 -0
  333. package/dist/src/tui/command-dialogs.js.map +1 -0
  334. package/dist/src/tui/file-logger.d.ts +41 -0
  335. package/dist/src/tui/file-logger.d.ts.map +1 -0
  336. package/dist/src/tui/file-logger.js +114 -0
  337. package/dist/src/tui/file-logger.js.map +1 -0
  338. package/dist/src/tui-preferences.d.ts +40 -0
  339. package/dist/src/tui-preferences.d.ts.map +1 -0
  340. package/dist/src/tui-preferences.js +328 -0
  341. package/dist/src/tui-preferences.js.map +1 -0
  342. package/dist/src/tui.d.ts +68 -0
  343. package/dist/src/tui.d.ts.map +1 -0
  344. package/dist/src/tui.js +662 -0
  345. package/dist/src/tui.js.map +1 -0
  346. package/package.json +46 -22
  347. package/src/plugin/command-data.ts +651 -0
  348. package/src/rpc/port-file.ts +143 -0
  349. package/src/rpc/protocol.ts +31 -0
  350. package/src/rpc/rpc-client.ts +102 -0
  351. package/src/rpc/rpc-dir.ts +24 -0
  352. package/src/sidebar-state.ts +717 -0
  353. package/src/tui/command-dialogs.tsx +699 -0
  354. package/src/tui/entry.mjs +74 -0
  355. package/src/tui/file-logger.ts +145 -0
  356. package/src/tui-compiled/plugin/command-data.ts +651 -0
  357. package/src/tui-compiled/rpc/port-file.ts +143 -0
  358. package/src/tui-compiled/rpc/protocol.ts +31 -0
  359. package/src/tui-compiled/rpc/rpc-client.ts +102 -0
  360. package/src/tui-compiled/rpc/rpc-dir.ts +24 -0
  361. package/src/tui-compiled/sidebar-state.ts +717 -0
  362. package/src/tui-compiled/tui/command-dialogs.tsx +659 -0
  363. package/src/tui-compiled/tui/file-logger.ts +145 -0
  364. package/src/tui-compiled/tui-preferences.ts +416 -0
  365. package/src/tui-compiled/tui.tsx +1150 -0
  366. package/src/tui-preferences.ts +416 -0
  367. package/src/tui.tsx +1117 -0
  368. package/dist/src/plugin.d.ts +0 -48
  369. package/dist/src/plugin.d.ts.map +0 -1
  370. package/dist/src/plugin.js +0 -3311
  371. package/dist/src/plugin.js.map +0 -1
@@ -0,0 +1,659 @@
1
+ import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
2
+ import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
3
+ import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
4
+ import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
5
+ import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
6
+ import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
7
+ import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
8
+ /** @jsxImportSource @opentui/solid */
9
+
10
+ /**
11
+ * Imperative command-dialog dispatcher for the /antigravity-* slash commands.
12
+ *
13
+ * Mirrors the fleet sibling layout (see `anthropic-auth-live` /
14
+ * `openai-auth-live` `packages/opencode/src/tui/command-dialogs.tsx`):
15
+ * each command's dialog opens with its data/status content rendered into the
16
+ * dialog BODY as a column of plain `<text>` nodes — non-selectable,
17
+ * non-searchable — and a separate `<DialogSelect>` below carries ONLY the
18
+ * real actions with proper `{title, description}` shapes the host renders
19
+ * on separate lines. The earlier implementation crammed the data rows into
20
+ * `DialogSelect`'s `placeholder` (which participates in type-ahead search)
21
+ * and concatenated label+description into a single highlighted option line;
22
+ * this rewrite separates data from actions the way the host expects.
23
+ *
24
+ * Contract:
25
+ * - Every main/subdialog calls `api.ui.dialog.setSize('xlarge')` before
26
+ * `api.ui.dialog.replace()` so the host reserves enough width for the
27
+ * longest line in any branch.
28
+ * - `apply(command, args, options?)` is the RPC apply path the dispatch
29
+ * site (the module-scoped poll in `tui.tsx`) supplies. The dispatcher
30
+ * forwards `options.timeoutMs` so a long-running apply (account add /
31
+ * refresh, future quota refresh) gets the right RPC timeout.
32
+ * - All `DialogSelect` options must remain VISIBLE — the host's
33
+ * `disabled: true` is a hard hide, so this file must never set it.
34
+ * Invalid actions stay visible with an explanatory description and are
35
+ * rejected in `onSelect`. The `no hide-property option scan` test in
36
+ * the verification gates pins this contract.
37
+ * - `onSelect` awaits the apply, toasts the result, then either clears
38
+ * the dialog or replaces it for multi-step flows. The dialog stack
39
+ * never sees a `clear()` between apply and re-render so the user
40
+ * always sees feedback (per the dispatcher contract).
41
+ */
42
+
43
+ /**
44
+ * Apply handler the dispatcher calls when the user selects a dialog
45
+ * option. Mirrors `ApplyRequest` from `rpc/protocol` plus the
46
+ * `RpcRequestOptions.timeoutMs` knob the RPC client already accepts —
47
+ * the call site in `tui.tsx` forwards these directly into
48
+ * `rpcClient.apply(request, options)`.
49
+ */
50
+
51
+ /**
52
+ * Mount the dialog for `payload.command` on the live TUI.
53
+ *
54
+ * The dispatcher branches on `payload.command` — each branch is
55
+ * self-contained: render the data body, render the host DialogSelect
56
+ * below it with the real actions, wire `onSelect` to await `apply(...)`,
57
+ * then toast the result and clear (or replace for multi-step flows).
58
+ * Unknown commands throw so a future command registered in
59
+ * `MODAL_COMMANDS` without a dispatcher branch fails loudly at the first
60
+ * dialog open.
61
+ */
62
+ export function openCommandDialog(api, payload, apply) {
63
+ if (payload.command === 'antigravity-dump') {
64
+ renderDumpDialog(api, payload, apply);
65
+ return;
66
+ }
67
+ if (payload.command === 'antigravity-logging') {
68
+ renderLoggingDialog(api, payload, apply);
69
+ return;
70
+ }
71
+ if (payload.command === 'antigravity-quota') {
72
+ throw new Error('antigravity-quota is rendered by the TUI quota panel');
73
+ }
74
+ if (payload.command === 'antigravity-account') {
75
+ renderAccountDialog(api, payload, apply);
76
+ return;
77
+ }
78
+ if (payload.command === 'antigravity-routing') {
79
+ renderRoutingDialog(api, payload, apply);
80
+ return;
81
+ }
82
+ if (payload.command === 'antigravity-killswitch') {
83
+ renderKillswitchDialog(api, payload, apply);
84
+ return;
85
+ }
86
+ const exhaustiveCheck = payload.command;
87
+ throw new Error(`Unknown command ${exhaustiveCheck}`);
88
+ }
89
+
90
+ // ---------------------------------------------------------------------------
91
+ // Fully wired branches — non-data-first dialogs.
92
+ // ---------------------------------------------------------------------------
93
+
94
+ /**
95
+ * /antigravity-dump: three actions (on / off / status). Each selection
96
+ * applies through the RPC, toasts the result text, and clears the
97
+ * dialog. Status is a read-only check that still goes through apply so
98
+ * the dump helper runs once and reports the current state.
99
+ */
100
+ function renderDumpDialog(api, _payload, apply) {
101
+ const DialogSelect = api.ui.DialogSelect;
102
+ api.ui.dialog.setSize('xlarge');
103
+ api.ui.dialog.replace(() => _$createComponent(DialogSelect, {
104
+ title: "Antigravity wire dump",
105
+ options: [{
106
+ title: 'Turn dump on',
107
+ value: 'on',
108
+ description: 'Write request and response bodies to the dump dir.'
109
+ }, {
110
+ title: 'Turn dump off',
111
+ value: 'off',
112
+ description: 'Stop writing new dump files.'
113
+ }, {
114
+ title: 'Show dump status',
115
+ value: 'status',
116
+ description: 'Display whether dumps are enabled and where they go.'
117
+ }],
118
+ onSelect: option => {
119
+ void apply('antigravity-dump', String(option.value)).then(result => {
120
+ api.ui.toast({
121
+ message: result.text
122
+ });
123
+ api.ui.dialog.clear();
124
+ });
125
+ }
126
+ }));
127
+ }
128
+
129
+ /**
130
+ * /antigravity-logging: every log level as an option. The dispatcher
131
+ * forwards the level as the apply arg; the apply path persists it
132
+ * through `OperatorSettingsController` and toasts the resolution text.
133
+ */
134
+ function renderLoggingDialog(api, payload, apply) {
135
+ const DialogSelect = api.ui.DialogSelect;
136
+ const current = payload.knobs.log_level ?? 'info';
137
+ api.ui.dialog.setSize('xlarge');
138
+ api.ui.dialog.replace(() => _$createComponent(DialogSelect, {
139
+ title: "Antigravity logging",
140
+ current: current,
141
+ options: [{
142
+ title: 'Error',
143
+ value: 'error',
144
+ description: 'Errors only.'
145
+ }, {
146
+ title: 'Warn',
147
+ value: 'warn',
148
+ description: 'Warnings and errors.'
149
+ }, {
150
+ title: 'Info',
151
+ value: 'info',
152
+ description: 'Default. Includes informational events.'
153
+ }, {
154
+ title: 'Debug',
155
+ value: 'debug',
156
+ description: 'Includes debug-level events.'
157
+ }, {
158
+ title: 'Trace',
159
+ value: 'trace',
160
+ description: 'Most verbose — every diagnostic event.'
161
+ }],
162
+ onSelect: option => {
163
+ void apply('antigravity-logging', String(option.value)).then(result => {
164
+ api.ui.toast({
165
+ message: result.text
166
+ });
167
+ api.ui.dialog.clear();
168
+ });
169
+ }
170
+ }));
171
+ }
172
+
173
+ // ---------------------------------------------------------------------------
174
+ // Shared helpers — render data rows as plain text in the dialog body.
175
+ // ---------------------------------------------------------------------------
176
+
177
+ function formatQuotaRowLine(row) {
178
+ const status = row.enabled ? '' : ' (disabled)';
179
+ const current = row.current ? ' *' : '';
180
+ if (row.quota.length === 0) {
181
+ return `${row.label}${status}${current}: no cached quota`;
182
+ }
183
+ const parts = row.quota.map(q => {
184
+ const pct = q.remainingPercent == null ? '–%' : `${q.remainingPercent}%`;
185
+ return `${q.label} ${pct}`;
186
+ });
187
+ return `${row.label}${status}${current}: ${parts.join(', ')}`;
188
+ }
189
+
190
+ /**
191
+ * /antigravity-account data-first dialog.
192
+ *
193
+ * The body lists each account row as a plain `<text>` node (cache-only
194
+ * — no network I/O on open). The DialogSelect carries ONLY real
195
+ * actions: Add account… and one drill-in entry per row. Drill-in
196
+ * navigates to a row-level subdialog that exposes toggle / set-current
197
+ * / remove with a DialogConfirm gate for the destructive path.
198
+ *
199
+ * Each action calls `apply('antigravity-account', '<verb> <index>')`,
200
+ * which the apply path translates into a locked-storage mutation.
201
+ * The service returns fresh `CommandAccountRow[]`; the dialog mutates
202
+ * its closed-over payload and re-renders via `renderMain()` so the
203
+ * user never sees a clear-then-redraw gap.
204
+ */
205
+ function renderAccountDialog(api, initialPayload, apply) {
206
+ // Closed-over payload: every render reads from the latest snapshot.
207
+ const payload = {
208
+ ...initialPayload
209
+ };
210
+ const rowsFromKnobs = () => {
211
+ const raw = payload.knobs.accounts;
212
+ return Array.isArray(raw) ? raw : [];
213
+ };
214
+ const runApply = async (args, options) => {
215
+ const result = await apply('antigravity-account', args, options);
216
+ api.ui.toast({
217
+ message: result.text
218
+ });
219
+ const next = result.knobs.accounts;
220
+ if (Array.isArray(next)) {
221
+ payload.knobs = {
222
+ ...payload.knobs,
223
+ accounts: next
224
+ };
225
+ renderMain();
226
+ return next;
227
+ }
228
+ renderMain();
229
+ return null;
230
+ };
231
+ const renderManageRow = row => {
232
+ const DialogSelect = api.ui.DialogSelect;
233
+ api.ui.dialog.setSize('xlarge');
234
+ api.ui.dialog.replace(() => (() => {
235
+ var _el$ = _$createElement("box"),
236
+ _el$2 = _$createElement("text"),
237
+ _el$3 = _$createElement("text"),
238
+ _el$4 = _$createElement("box");
239
+ _$insertNode(_el$, _el$2);
240
+ _$insertNode(_el$, _el$3);
241
+ _$insertNode(_el$, _el$4);
242
+ _$setProp(_el$, "flexDirection", 'column');
243
+ _$setProp(_el$, "padding", 1);
244
+ _$setProp(_el$, "width", '100%');
245
+ _$insert(_el$2, () => row.label);
246
+ _$insert(_el$3, (() => {
247
+ var _c$ = _$memo(() => row.quota.length === 0);
248
+ return () => _c$() ? 'no cached quota' : row.quota.map(q => q.remainingPercent == null ? `${q.label} –%` : `${q.label} ${q.remainingPercent}%`).join(', ');
249
+ })());
250
+ _$setProp(_el$4, "marginTop", 1);
251
+ _$insert(_el$4, _$createComponent(DialogSelect, {
252
+ get title() {
253
+ return `Manage ${row.label}`;
254
+ },
255
+ get options() {
256
+ return [{
257
+ title: row.enabled ? 'Disable account' : 'Enable account',
258
+ value: `toggle ${row.index}`,
259
+ description: row.enabled ? 'Skip this account in rotation when its quota is low.' : 'Include this account in rotation again.'
260
+ }, {
261
+ title: 'Set as current',
262
+ value: `current ${row.index}`,
263
+ description: 'Pin this account as the active Claude + Gemini choice.'
264
+ }, {
265
+ title: 'Remove account…',
266
+ value: `__remove_prompt__ ${row.index}`,
267
+ description: 'Permanently delete this account from the local pool.'
268
+ }, {
269
+ title: 'Back',
270
+ value: '__back__',
271
+ description: 'Return to the account list.'
272
+ }];
273
+ },
274
+ onSelect: option => {
275
+ const raw = String(option.value);
276
+ if (raw === '__back__') {
277
+ renderMain();
278
+ return;
279
+ }
280
+ if (raw.startsWith('__remove_prompt__ ')) {
281
+ const targetIndex = Number.parseInt(raw.split(' ')[1] ?? '', 10);
282
+ promptRemove(targetIndex);
283
+ return;
284
+ }
285
+ if (raw.startsWith('toggle ') || raw.startsWith('current ')) {
286
+ void runApply(raw, {
287
+ timeoutMs: 2_000
288
+ }).catch(() => {
289
+ api.ui.toast({
290
+ message: `${row.label}: action failed`
291
+ });
292
+ });
293
+ return;
294
+ }
295
+ api.ui.toast({
296
+ message: `${row.label}: unknown action`
297
+ });
298
+ }
299
+ }));
300
+ return _el$;
301
+ })());
302
+ };
303
+ const promptRemove = index => {
304
+ const DialogConfirm = api.ui.DialogConfirm;
305
+ const row = rowsFromKnobs()[index];
306
+ api.ui.dialog.setSize('xlarge');
307
+ api.ui.dialog.replace(() => _$createComponent(DialogConfirm, {
308
+ title: "Remove account",
309
+ get message() {
310
+ return `Permanently remove ${row?.label ?? `account ${index + 1}`} from the local pool? This cannot be undone.`;
311
+ },
312
+ onConfirm: async () => {
313
+ try {
314
+ const next = await runApply(`remove ${index}`, {
315
+ timeoutMs: 2_000
316
+ });
317
+ if (next === null) {
318
+ renderMain();
319
+ }
320
+ } catch {
321
+ api.ui.toast({
322
+ message: 'Account remove failed'
323
+ });
324
+ renderMain();
325
+ }
326
+ },
327
+ onCancel: () => {
328
+ renderMain();
329
+ }
330
+ }));
331
+ };
332
+ const renderMain = () => {
333
+ const DialogSelect = api.ui.DialogSelect;
334
+ api.ui.dialog.setSize('xlarge');
335
+ const rows = rowsFromKnobs();
336
+ const bodyLines = rows.length ? rows.map(formatQuotaRowLine) : ['No accounts configured. Add one via the menu below.'];
337
+ api.ui.dialog.replace(() => (() => {
338
+ var _el$5 = _$createElement("box"),
339
+ _el$6 = _$createElement("box");
340
+ _$insertNode(_el$5, _el$6);
341
+ _$setProp(_el$5, "flexDirection", 'column');
342
+ _$setProp(_el$5, "padding", 1);
343
+ _$setProp(_el$5, "width", '100%');
344
+ _$insert(_el$5, () => bodyLines.map(line => (() => {
345
+ var _el$7 = _$createElement("text");
346
+ _$insert(_el$7, line);
347
+ return _el$7;
348
+ })()), _el$6);
349
+ _$setProp(_el$6, "marginTop", 1);
350
+ _$insert(_el$6, _$createComponent(DialogSelect, {
351
+ title: "Antigravity accounts",
352
+ get options() {
353
+ return [{
354
+ title: 'Add account…',
355
+ value: 'add',
356
+ description: 'Open the OAuth flow to add a new account (120s timeout).'
357
+ }, ...rows.map(row => ({
358
+ title: row.label,
359
+ value: `__manage__ ${row.index}`,
360
+ description: row.enabled ? row.current ? 'Current account — toggle, remove, or back.' : 'Enabled — toggle, set as current, or remove.' : 'Disabled — toggle to re-enable, or remove.'
361
+ })), {
362
+ title: 'Back',
363
+ value: 'back'
364
+ }];
365
+ },
366
+ onSelect: option => {
367
+ const raw = String(option.value);
368
+ if (raw === 'back') {
369
+ api.ui.dialog.clear();
370
+ return;
371
+ }
372
+ if (raw === 'add') {
373
+ void runApply('add', {
374
+ timeoutMs: 120_000
375
+ }).catch(() => {
376
+ api.ui.toast({
377
+ message: 'Account add failed'
378
+ });
379
+ });
380
+ return;
381
+ }
382
+ if (raw.startsWith('__manage__ ')) {
383
+ const targetIndex = Number.parseInt(raw.split(' ')[1] ?? '', 10);
384
+ const target = rows[targetIndex];
385
+ if (target) renderManageRow(target);
386
+ return;
387
+ }
388
+ api.ui.toast({
389
+ message: 'Unknown action'
390
+ });
391
+ }
392
+ }));
393
+ return _el$5;
394
+ })());
395
+ };
396
+ renderMain();
397
+ }
398
+
399
+ /**
400
+ * /antigravity-routing data-first dialog.
401
+ *
402
+ * The body lists the current persisted values (`cli_first`,
403
+ * `quota_style_fallback`) as plain `<text>` nodes so the data is
404
+ * visible without filtering the action list. The DialogSelect carries
405
+ * ONLY real toggle actions — each row flips exactly one flag, awaits
406
+ * apply, toasts the result, and re-renders in place from the
407
+ * freshly-returned state.
408
+ *
409
+ * Re-render contract mirrors the quota/account dialogs: the
410
+ * closed-over `payload.knobs` is mutated with the apply response and
411
+ * `renderMain()` is re-invoked. The dialog stack never sees a
412
+ * `clear()` between apply and re-render.
413
+ *
414
+ * Error path: when apply returns a `knobs.error === true` payload
415
+ * (lock contention, unreadable config), the dispatcher does NOT swap
416
+ * the closed-over payload — the dialog stays mounted on the previous
417
+ * state so the user can retry or back out. The error message was
418
+ * already toasted by `runApply`.
419
+ */
420
+ function renderRoutingDialog(api, initialPayload, apply) {
421
+ // Closed-over payload: every render reads from the latest snapshot.
422
+ const payload = {
423
+ ...initialPayload
424
+ };
425
+ const readRouting = () => ({
426
+ cliFirst: payload.knobs.cli_first === true,
427
+ quotaFallback: payload.knobs.quota_style_fallback === true
428
+ });
429
+ const runApply = async args => {
430
+ const result = await apply('antigravity-routing', args, {
431
+ timeoutMs: 2_000
432
+ });
433
+ api.ui.toast({
434
+ message: result.text
435
+ });
436
+ if (result.knobs.error === true) {
437
+ return;
438
+ }
439
+ payload.knobs = {
440
+ ...payload.knobs,
441
+ cli_first: result.knobs.cli_first,
442
+ quota_style_fallback: result.knobs.quota_style_fallback
443
+ };
444
+ renderMain();
445
+ };
446
+ const renderMain = () => {
447
+ const DialogSelect = api.ui.DialogSelect;
448
+ api.ui.dialog.setSize('xlarge');
449
+ const {
450
+ cliFirst,
451
+ quotaFallback
452
+ } = readRouting();
453
+ const bodyLines = [`cli_first: ${cliFirst ? 'on' : 'off'}`, `quota_style_fallback: ${quotaFallback ? 'on' : 'off'}`];
454
+ api.ui.dialog.replace(() => (() => {
455
+ var _el$8 = _$createElement("box"),
456
+ _el$9 = _$createElement("box");
457
+ _$insertNode(_el$8, _el$9);
458
+ _$setProp(_el$8, "flexDirection", 'column');
459
+ _$setProp(_el$8, "padding", 1);
460
+ _$setProp(_el$8, "width", '100%');
461
+ _$insert(_el$8, () => bodyLines.map(line => (() => {
462
+ var _el$0 = _$createElement("text");
463
+ _$insert(_el$0, line);
464
+ return _el$0;
465
+ })()), _el$9);
466
+ _$setProp(_el$9, "marginTop", 1);
467
+ _$insert(_el$9, _$createComponent(DialogSelect, {
468
+ title: "Antigravity routing",
469
+ options: [{
470
+ title: `${cliFirst ? '●' : '○'} cli_first: ${cliFirst}`,
471
+ value: `cli_first=${!cliFirst}`,
472
+ description: cliFirst ? 'CLI is preferred before Antigravity. Click to turn off.' : 'Antigravity runs before CLI. Click to turn on.'
473
+ }, {
474
+ title: `${quotaFallback ? '●' : '○'} quota_style_fallback: ${quotaFallback}`,
475
+ value: `quota_style_fallback=${!quotaFallback}`,
476
+ description: quotaFallback ? 'Falls back to the alternate quota style on exhaustion. Click to turn off.' : 'No quota-style fallback today. Click to turn on.'
477
+ }, {
478
+ title: 'Back',
479
+ value: 'back'
480
+ }],
481
+ onSelect: option => {
482
+ const raw = String(option.value);
483
+ if (raw === 'back') {
484
+ api.ui.dialog.clear();
485
+ return;
486
+ }
487
+ if (!raw.startsWith('cli_first=') && !raw.startsWith('quota_style_fallback=')) {
488
+ api.ui.toast({
489
+ message: 'Unknown routing action'
490
+ });
491
+ return;
492
+ }
493
+ void runApply(raw).catch(() => {
494
+ api.ui.toast({
495
+ message: 'Routing update failed'
496
+ });
497
+ renderMain();
498
+ });
499
+ }
500
+ }));
501
+ return _el$8;
502
+ })());
503
+ };
504
+ renderMain();
505
+ }
506
+
507
+ /**
508
+ * /antigravity-killswitch data-first dialog.
509
+ *
510
+ * The body lists the current persisted killswitch state (`enabled`,
511
+ * `minimum_remaining_percent`, and the per-account override map) as
512
+ * plain `<text>` nodes. The DialogSelect carries ONLY real actions:
513
+ * the global enabled toggle, the threshold-edit prompt, and a Back
514
+ * affordance. The threshold edit opens a DialogPrompt for a fresh
515
+ * integer in `0..100`; out-of-range input stays at the prompt without
516
+ * applying.
517
+ *
518
+ * Re-render contract matches the routing dialog: the closed-over
519
+ * `payload.knobs` is swapped to the apply response on success and
520
+ * `renderMain()` re-runs. Errors leave the payload untouched.
521
+ */
522
+ function renderKillswitchDialog(api, initialPayload, apply) {
523
+ const payload = {
524
+ ...initialPayload
525
+ };
526
+ const readKillswitch = () => {
527
+ const enabled = payload.knobs.enabled === true;
528
+ const rawMin = payload.knobs.minimum_remaining_percent;
529
+ const minimum = typeof rawMin === 'number' && Number.isFinite(rawMin) ? Math.max(0, Math.min(100, Math.round(rawMin))) : 0;
530
+ const rawAccounts = payload.knobs.accounts;
531
+ const accounts = rawAccounts && typeof rawAccounts === 'object' && !Array.isArray(rawAccounts) ? rawAccounts : {};
532
+ return {
533
+ enabled,
534
+ minimum,
535
+ accounts
536
+ };
537
+ };
538
+ const runApply = async args => {
539
+ const result = await apply('antigravity-killswitch', args, {
540
+ timeoutMs: 2_000
541
+ });
542
+ api.ui.toast({
543
+ message: result.text
544
+ });
545
+ if (result.knobs.error === true) {
546
+ return;
547
+ }
548
+ payload.knobs = {
549
+ ...payload.knobs,
550
+ enabled: result.knobs.enabled,
551
+ minimum_remaining_percent: result.knobs.minimum_remaining_percent,
552
+ accounts: result.knobs.accounts ?? {}
553
+ };
554
+ renderMain();
555
+ };
556
+ const openThresholdPrompt = currentMinimum => {
557
+ const DialogPrompt = api.ui.DialogPrompt;
558
+ api.ui.dialog.setSize('xlarge');
559
+ api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
560
+ title: "Antigravity killswitch \u2014 set threshold",
561
+ description: () => (() => {
562
+ var _el$1 = _$createElement("text");
563
+ _$insertNode(_el$1, _$createTextNode(`Enter a new minimum_remaining_percent (0-100). Empty input cancels.`));
564
+ return _el$1;
565
+ })(),
566
+ placeholder: `${currentMinimum}`,
567
+ value: `${currentMinimum}`,
568
+ onConfirm: value => {
569
+ const trimmed = value.trim();
570
+ if (!trimmed) {
571
+ renderMain();
572
+ return;
573
+ }
574
+ const parsed = Number.parseInt(trimmed, 10);
575
+ if (!Number.isInteger(parsed) || parsed < 0 || parsed > 100 || String(parsed) !== trimmed) {
576
+ api.ui.toast({
577
+ message: 'Threshold must be an integer between 0 and 100'
578
+ });
579
+ openThresholdPrompt(currentMinimum);
580
+ return;
581
+ }
582
+ void runApply(`minimum_remaining_percent=${parsed}`).catch(() => {
583
+ api.ui.toast({
584
+ message: 'Killswitch update failed'
585
+ });
586
+ renderMain();
587
+ });
588
+ },
589
+ onCancel: () => {
590
+ renderMain();
591
+ }
592
+ }));
593
+ };
594
+ const renderMain = () => {
595
+ const DialogSelect = api.ui.DialogSelect;
596
+ api.ui.dialog.setSize('xlarge');
597
+ const {
598
+ enabled,
599
+ minimum,
600
+ accounts
601
+ } = readKillswitch();
602
+ const accountKeys = Object.keys(accounts);
603
+ const bodyLines = [`Killswitch: ${enabled ? 'enabled' : 'disabled'}`, `Minimum remaining percent: ${minimum}%`, ...(accountKeys.length > 0 ? ['Per-account overrides:', ...accountKeys.map(key => ` ${key}: ${accounts[key] ?? 0}%`)] : [])];
604
+ api.ui.dialog.replace(() => (() => {
605
+ var _el$11 = _$createElement("box"),
606
+ _el$12 = _$createElement("box");
607
+ _$insertNode(_el$11, _el$12);
608
+ _$setProp(_el$11, "flexDirection", 'column');
609
+ _$setProp(_el$11, "padding", 1);
610
+ _$setProp(_el$11, "width", '100%');
611
+ _$insert(_el$11, () => bodyLines.map(line => (() => {
612
+ var _el$13 = _$createElement("text");
613
+ _$insert(_el$13, line);
614
+ return _el$13;
615
+ })()), _el$12);
616
+ _$setProp(_el$12, "marginTop", 1);
617
+ _$insert(_el$12, _$createComponent(DialogSelect, {
618
+ title: "Antigravity killswitch",
619
+ options: [{
620
+ title: `${enabled ? '●' : '○'} Killswitch: ${enabled ? 'enabled' : 'disabled'}`,
621
+ value: `enabled=${!enabled}`,
622
+ description: enabled ? 'Drop candidates below the floor before dispatch. Click to turn off.' : 'Resume candidate selection regardless of quota. Click to turn on.'
623
+ }, {
624
+ title: `Set minimum remaining percent (${minimum}%)`,
625
+ value: '__edit_threshold__',
626
+ description: 'Prompt for a new global floor (0-100). Per-account overrides are listed above.'
627
+ }, {
628
+ title: 'Back',
629
+ value: 'back'
630
+ }],
631
+ onSelect: option => {
632
+ const raw = String(option.value);
633
+ if (raw === 'back') {
634
+ api.ui.dialog.clear();
635
+ return;
636
+ }
637
+ if (raw === '__edit_threshold__') {
638
+ openThresholdPrompt(minimum);
639
+ return;
640
+ }
641
+ if (raw === 'enabled=true' || raw === 'enabled=false') {
642
+ void runApply(raw).catch(() => {
643
+ api.ui.toast({
644
+ message: 'Killswitch update failed'
645
+ });
646
+ renderMain();
647
+ });
648
+ return;
649
+ }
650
+ api.ui.toast({
651
+ message: 'Unknown killswitch action'
652
+ });
653
+ }
654
+ }));
655
+ return _el$11;
656
+ })());
657
+ };
658
+ renderMain();
659
+ }