@cortexkit/opencode-antigravity-auth 2.2.1 → 3.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 (957) hide show
  1. package/README.md +95 -89
  2. package/dist/cli.js +18469 -810
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +4079 -0
  5. package/dist/index.js +40914 -16441
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +6949 -0
  8. package/dist/server.js +50948 -0
  9. package/dist/server.js.map +7 -0
  10. package/dist/server.meta.json +7284 -0
  11. package/dist/src/cli.d.ts +46 -1
  12. package/dist/src/cli.d.ts.map +1 -1
  13. package/dist/src/cli.js +207 -2
  14. package/dist/src/cli.js.map +1 -1
  15. package/dist/src/common-auth-embedded/NOTICE.txt +21 -0
  16. package/dist/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
  17. package/dist/src/common-auth-embedded/auth-menu/accounts.js +387 -0
  18. package/dist/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
  19. package/dist/src/common-auth-embedded/auth-menu/ansi.js +98 -0
  20. package/dist/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
  21. package/dist/src/common-auth-embedded/auth-menu/confirm.js +21 -0
  22. package/dist/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
  23. package/dist/src/common-auth-embedded/auth-menu/doctor.js +81 -0
  24. package/dist/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
  25. package/dist/src/common-auth-embedded/auth-menu/index.js +12 -0
  26. package/dist/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
  27. package/dist/src/common-auth-embedded/auth-menu/login.js +83 -0
  28. package/dist/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
  29. package/dist/src/common-auth-embedded/auth-menu/menu.js +73 -0
  30. package/dist/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
  31. package/dist/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
  32. package/dist/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
  33. package/dist/src/common-auth-embedded/auth-menu/select.js +159 -0
  34. package/dist/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  35. package/dist/src/common-auth-embedded/auth-menu/terminal.js +19 -0
  36. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
  37. package/dist/src/common-auth-embedded/claustrum/consumer.js +298 -0
  38. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
  39. package/dist/src/common-auth-embedded/claustrum/custody.js +354 -0
  40. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
  41. package/dist/src/common-auth-embedded/claustrum/enrollment.js +759 -0
  42. package/dist/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  43. package/dist/src/common-auth-embedded/claustrum/errors.js +8 -0
  44. package/dist/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  45. package/dist/src/common-auth-embedded/claustrum/host-slot.js +72 -0
  46. package/dist/src/common-auth-embedded/claustrum/index.d.ts +18 -0
  47. package/dist/src/common-auth-embedded/claustrum/index.js +22 -0
  48. package/dist/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  49. package/dist/src/common-auth-embedded/claustrum/interlock.js +29 -0
  50. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
  51. package/dist/src/common-auth-embedded/claustrum/roster.js +536 -0
  52. package/dist/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  53. package/dist/src/common-auth-embedded/commands/builtins.js +534 -0
  54. package/dist/src/common-auth-embedded/commands/index.d.ts +10 -0
  55. package/dist/src/common-auth-embedded/commands/index.js +5 -0
  56. package/dist/src/common-auth-embedded/commands/menu.d.ts +61 -0
  57. package/dist/src/common-auth-embedded/commands/menu.js +300 -0
  58. package/dist/src/common-auth-embedded/commands/model.d.ts +238 -0
  59. package/dist/src/common-auth-embedded/commands/model.js +16 -0
  60. package/dist/src/common-auth-embedded/commands/pi.d.ts +23 -0
  61. package/dist/src/common-auth-embedded/commands/pi.js +206 -0
  62. package/dist/src/common-auth-embedded/commands/seam.d.ts +72 -0
  63. package/dist/src/common-auth-embedded/commands/seam.js +301 -0
  64. package/dist/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
  65. package/dist/src/common-auth-embedded/fs/atomic-write.js +80 -0
  66. package/dist/src/common-auth-embedded/fs/index.d.ts +7 -0
  67. package/dist/src/common-auth-embedded/fs/index.js +6 -0
  68. package/dist/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
  69. package/dist/src/common-auth-embedded/fs/lock-constants.js +14 -0
  70. package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  71. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
  72. package/dist/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
  73. package/dist/src/common-auth-embedded/fs/with-lock.js +48 -0
  74. package/dist/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  75. package/dist/src/common-auth-embedded/logger/capture-sink.js +13 -0
  76. package/dist/src/common-auth-embedded/logger/engine.d.ts +100 -0
  77. package/dist/src/common-auth-embedded/logger/engine.js +246 -0
  78. package/dist/src/common-auth-embedded/logger/index.d.ts +6 -0
  79. package/dist/src/common-auth-embedded/logger/index.js +3 -0
  80. package/dist/src/common-auth-embedded/logger/redact.d.ts +11 -0
  81. package/dist/src/common-auth-embedded/logger/redact.js +83 -0
  82. package/dist/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  83. package/dist/src/common-auth-embedded/opencode2/errors.js +15 -0
  84. package/dist/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  85. package/dist/src/common-auth-embedded/opencode2/index.js +4 -0
  86. package/dist/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  87. package/dist/src/common-auth-embedded/opencode2/install.js +886 -0
  88. package/dist/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  89. package/dist/src/common-auth-embedded/opencode2/integration.js +143 -0
  90. package/dist/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  91. package/dist/src/common-auth-embedded/opencode2/sse.js +60 -0
  92. package/dist/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  93. package/dist/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
  94. package/dist/src/common-auth-embedded/pi-slot/index.js +2 -0
  95. package/dist/src/common-auth-embedded/pi-slot/lock.js +212 -0
  96. package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
  97. package/dist/src/common-auth-embedded/pi-slot/slot.js +383 -0
  98. package/dist/src/common-auth-embedded/quota/codec.d.ts +11 -0
  99. package/dist/src/common-auth-embedded/quota/codec.js +12 -0
  100. package/dist/src/common-auth-embedded/quota/format.d.ts +46 -0
  101. package/dist/src/common-auth-embedded/quota/format.js +138 -0
  102. package/dist/src/common-auth-embedded/quota/index.d.ts +10 -0
  103. package/dist/src/common-auth-embedded/quota/index.js +5 -0
  104. package/dist/src/common-auth-embedded/quota/map.d.ts +63 -0
  105. package/dist/src/common-auth-embedded/quota/map.js +105 -0
  106. package/dist/src/common-auth-embedded/quota/merge.d.ts +48 -0
  107. package/dist/src/common-auth-embedded/quota/merge.js +162 -0
  108. package/dist/src/common-auth-embedded/quota/projection.d.ts +64 -0
  109. package/dist/src/common-auth-embedded/quota/projection.js +134 -0
  110. package/dist/src/common-auth-embedded/routing/admission.d.ts +93 -0
  111. package/dist/src/common-auth-embedded/routing/admission.js +142 -0
  112. package/dist/src/common-auth-embedded/routing/index.d.ts +8 -0
  113. package/dist/src/common-auth-embedded/routing/index.js +4 -0
  114. package/dist/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  115. package/dist/src/common-auth-embedded/routing/ordered.js +58 -0
  116. package/dist/src/common-auth-embedded/routing/pins.d.ts +22 -0
  117. package/dist/src/common-auth-embedded/routing/pins.js +34 -0
  118. package/dist/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  119. package/dist/src/common-auth-embedded/routing/sticky.js +339 -0
  120. package/dist/src/common-auth-embedded/rpc/client.d.ts +3 -0
  121. package/dist/src/common-auth-embedded/rpc/client.js +2 -0
  122. package/dist/src/common-auth-embedded/rpc/index.d.ts +10 -0
  123. package/dist/src/common-auth-embedded/rpc/index.js +5 -0
  124. package/dist/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
  125. package/dist/src/common-auth-embedded/rpc/notifications.js +100 -0
  126. package/dist/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
  127. package/dist/src/common-auth-embedded/rpc/port-file.js +217 -0
  128. package/dist/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
  129. package/dist/src/common-auth-embedded/rpc/rpc-client.js +253 -0
  130. package/dist/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
  131. package/dist/src/common-auth-embedded/rpc/rpc-server.js +311 -0
  132. package/dist/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
  133. package/dist/src/common-auth-embedded/rpc/server-registry.js +47 -0
  134. package/dist/src/common-auth-embedded/source-output.json +1326 -0
  135. package/dist/src/common-auth-embedded/store/attribution.d.ts +28 -0
  136. package/dist/src/common-auth-embedded/store/attribution.js +60 -0
  137. package/dist/src/common-auth-embedded/store/errors.d.ts +55 -0
  138. package/dist/src/common-auth-embedded/store/errors.js +38 -0
  139. package/dist/src/common-auth-embedded/store/hooks.d.ts +12 -0
  140. package/dist/src/common-auth-embedded/store/hooks.js +34 -0
  141. package/dist/src/common-auth-embedded/store/identity.d.ts +39 -0
  142. package/dist/src/common-auth-embedded/store/identity.js +79 -0
  143. package/dist/src/common-auth-embedded/store/index.d.ts +21 -0
  144. package/dist/src/common-auth-embedded/store/index.js +7 -0
  145. package/dist/src/common-auth-embedded/store/mutate.d.ts +189 -0
  146. package/dist/src/common-auth-embedded/store/mutate.js +500 -0
  147. package/dist/src/common-auth-embedded/store/pool.d.ts +196 -0
  148. package/dist/src/common-auth-embedded/store/pool.js +120 -0
  149. package/dist/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  150. package/dist/src/common-auth-embedded/store/provider-state.js +226 -0
  151. package/dist/src/common-auth-embedded/store/publication.d.ts +47 -0
  152. package/dist/src/common-auth-embedded/store/publication.js +304 -0
  153. package/dist/src/common-auth-embedded/store/pull.d.ts +36 -0
  154. package/dist/src/common-auth-embedded/store/pull.js +143 -0
  155. package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  156. package/dist/src/common-auth-embedded/store/refresh-lock.js +136 -0
  157. package/dist/src/common-auth-embedded/store/refresh.d.ts +72 -0
  158. package/dist/src/common-auth-embedded/store/refresh.js +225 -0
  159. package/dist/src/common-auth-embedded/store/reserved.js +13 -0
  160. package/dist/src/common-auth-embedded/store/rows.d.ts +313 -0
  161. package/dist/src/common-auth-embedded/store/rows.js +1258 -0
  162. package/dist/src/common-auth-embedded/store/runtime.d.ts +36 -0
  163. package/dist/src/common-auth-embedded/store/runtime.js +68 -0
  164. package/dist/src/common-auth-embedded/store/schema.d.ts +443 -0
  165. package/dist/src/common-auth-embedded/store/schema.js +754 -0
  166. package/dist/src/common-auth-embedded/store/settings.d.ts +63 -0
  167. package/dist/src/common-auth-embedded/store/settings.js +120 -0
  168. package/dist/src/common-auth-embedded/store/torn.d.ts +78 -0
  169. package/dist/src/common-auth-embedded/store/torn.js +294 -0
  170. package/dist/src/common-auth-embedded/tui/index.d.ts +8 -0
  171. package/dist/src/common-auth-embedded/tui/index.js +21 -0
  172. package/dist/src/common-auth-embedded/util/any-signal.js +42 -0
  173. package/dist/src/constants.d.ts +1 -0
  174. package/dist/src/constants.d.ts.map +1 -1
  175. package/dist/src/constants.js +4 -0
  176. package/dist/src/constants.js.map +1 -1
  177. package/dist/src/ga/proxy-guard.d.ts +120 -0
  178. package/dist/src/ga/proxy-guard.d.ts.map +1 -0
  179. package/dist/src/ga/proxy-guard.js +269 -0
  180. package/dist/src/ga/proxy-guard.js.map +1 -0
  181. package/dist/src/ga/rpc/protocol.d.ts +504 -0
  182. package/dist/src/ga/rpc/protocol.d.ts.map +1 -0
  183. package/dist/src/ga/rpc/protocol.js +1278 -0
  184. package/dist/src/ga/rpc/protocol.js.map +1 -0
  185. package/dist/src/ga/server/auth.d.ts +9 -0
  186. package/dist/src/ga/server/auth.d.ts.map +1 -0
  187. package/dist/src/ga/server/auth.js +37 -0
  188. package/dist/src/ga/server/auth.js.map +1 -0
  189. package/dist/src/ga/server/index.d.ts +576 -0
  190. package/dist/src/ga/server/index.d.ts.map +1 -0
  191. package/dist/src/ga/server/index.js +1012 -0
  192. package/dist/src/ga/server/index.js.map +1 -0
  193. package/dist/src/ga/tui/host-ga.d.ts +350 -0
  194. package/dist/src/ga/tui/host-ga.d.ts.map +1 -0
  195. package/dist/src/ga/tui/host-ga.js +1242 -0
  196. package/dist/src/ga/tui/host-ga.js.map +1 -0
  197. package/dist/src/logging/provider-key-policy.d.ts +9 -0
  198. package/dist/src/logging/provider-key-policy.d.ts.map +1 -0
  199. package/dist/src/logging/provider-key-policy.js +11 -0
  200. package/dist/src/logging/provider-key-policy.js.map +1 -0
  201. package/dist/src/plugin/account-access.d.ts +130 -15
  202. package/dist/src/plugin/account-access.d.ts.map +1 -1
  203. package/dist/src/plugin/account-access.js +331 -129
  204. package/dist/src/plugin/account-access.js.map +1 -1
  205. package/dist/src/plugin/account-blocks.d.ts +102 -0
  206. package/dist/src/plugin/account-blocks.d.ts.map +1 -0
  207. package/dist/src/plugin/account-blocks.js +196 -0
  208. package/dist/src/plugin/account-blocks.js.map +1 -0
  209. package/dist/src/plugin/accounts.d.ts +85 -1
  210. package/dist/src/plugin/accounts.d.ts.map +1 -1
  211. package/dist/src/plugin/accounts.js +127 -3
  212. package/dist/src/plugin/accounts.js.map +1 -1
  213. package/dist/src/plugin/auth-loader.d.ts +69 -5
  214. package/dist/src/plugin/auth-loader.d.ts.map +1 -1
  215. package/dist/src/plugin/auth-loader.js +355 -52
  216. package/dist/src/plugin/auth-loader.js.map +1 -1
  217. package/dist/src/plugin/background-quota-refresh.d.ts +54 -8
  218. package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
  219. package/dist/src/plugin/background-quota-refresh.js +81 -24
  220. package/dist/src/plugin/background-quota-refresh.js.map +1 -1
  221. package/dist/src/plugin/cache/index.d.ts +1 -1
  222. package/dist/src/plugin/cache/index.d.ts.map +1 -1
  223. package/dist/src/plugin/cache/index.js +1 -1
  224. package/dist/src/plugin/cache/index.js.map +1 -1
  225. package/dist/src/plugin/cache/signature-cache.d.ts +55 -10
  226. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  227. package/dist/src/plugin/cache/signature-cache.js +100 -41
  228. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  229. package/dist/src/plugin/cache.d.ts +80 -16
  230. package/dist/src/plugin/cache.d.ts.map +1 -1
  231. package/dist/src/plugin/cache.js +339 -200
  232. package/dist/src/plugin/cache.js.map +1 -1
  233. package/dist/src/plugin/catalog.d.ts +4 -18
  234. package/dist/src/plugin/catalog.d.ts.map +1 -1
  235. package/dist/src/plugin/catalog.js +11 -41
  236. package/dist/src/plugin/catalog.js.map +1 -1
  237. package/dist/src/plugin/command-apply.d.ts +58 -0
  238. package/dist/src/plugin/command-apply.d.ts.map +1 -0
  239. package/dist/src/plugin/command-apply.js +168 -0
  240. package/dist/src/plugin/command-apply.js.map +1 -0
  241. package/dist/src/plugin/command-data.d.ts +1 -0
  242. package/dist/src/plugin/command-data.d.ts.map +1 -1
  243. package/dist/src/plugin/command-data.js +2 -0
  244. package/dist/src/plugin/command-data.js.map +1 -1
  245. package/dist/src/plugin/commands.d.ts +142 -132
  246. package/dist/src/plugin/commands.d.ts.map +1 -1
  247. package/dist/src/plugin/commands.js +214 -686
  248. package/dist/src/plugin/commands.js.map +1 -1
  249. package/dist/src/plugin/config/index.d.ts +1 -1
  250. package/dist/src/plugin/config/index.d.ts.map +1 -1
  251. package/dist/src/plugin/config/index.js +1 -1
  252. package/dist/src/plugin/config/index.js.map +1 -1
  253. package/dist/src/plugin/config/loader.d.ts +37 -1
  254. package/dist/src/plugin/config/loader.d.ts.map +1 -1
  255. package/dist/src/plugin/config/loader.js +64 -9
  256. package/dist/src/plugin/config/loader.js.map +1 -1
  257. package/dist/src/plugin/config/operator-settings-schema.d.ts +2 -2
  258. package/dist/src/plugin/config/schema.d.ts +2 -2
  259. package/dist/src/plugin/config/writer.d.ts +7 -0
  260. package/dist/src/plugin/config/writer.d.ts.map +1 -1
  261. package/dist/src/plugin/config/writer.js +10 -1
  262. package/dist/src/plugin/config/writer.js.map +1 -1
  263. package/dist/src/plugin/debug.d.ts +72 -29
  264. package/dist/src/plugin/debug.d.ts.map +1 -1
  265. package/dist/src/plugin/debug.js +353 -239
  266. package/dist/src/plugin/debug.js.map +1 -1
  267. package/dist/src/plugin/fetch/retry-state.d.ts +1 -1
  268. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
  269. package/dist/src/plugin/fetch/retry-state.js.map +1 -1
  270. package/dist/src/plugin/fetch-interceptor.d.ts +66 -11
  271. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  272. package/dist/src/plugin/fetch-interceptor.js +228 -1352
  273. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  274. package/dist/src/plugin/fetch-routing.d.ts +7 -2
  275. package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
  276. package/dist/src/plugin/fetch-routing.js +7 -4
  277. package/dist/src/plugin/fetch-routing.js.map +1 -1
  278. package/dist/src/plugin/ga-location-services.d.ts +389 -0
  279. package/dist/src/plugin/ga-location-services.d.ts.map +1 -0
  280. package/dist/src/plugin/ga-location-services.js +1838 -0
  281. package/dist/src/plugin/ga-location-services.js.map +1 -0
  282. package/dist/src/plugin/gemini-dump.d.ts +37 -12
  283. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  284. package/dist/src/plugin/gemini-dump.js +42 -21
  285. package/dist/src/plugin/gemini-dump.js.map +1 -1
  286. package/dist/src/plugin/google-search-tool.d.ts +2 -1
  287. package/dist/src/plugin/google-search-tool.d.ts.map +1 -1
  288. package/dist/src/plugin/google-search-tool.js +4 -1
  289. package/dist/src/plugin/google-search-tool.js.map +1 -1
  290. package/dist/src/plugin/index.d.ts.map +1 -1
  291. package/dist/src/plugin/index.js +505 -141
  292. package/dist/src/plugin/index.js.map +1 -1
  293. package/dist/src/plugin/killswitch.d.ts +1 -2
  294. package/dist/src/plugin/killswitch.d.ts.map +1 -1
  295. package/dist/src/plugin/lifecycle.d.ts +24 -1
  296. package/dist/src/plugin/lifecycle.d.ts.map +1 -1
  297. package/dist/src/plugin/lifecycle.js +95 -8
  298. package/dist/src/plugin/lifecycle.js.map +1 -1
  299. package/dist/src/plugin/logger.d.ts +61 -10
  300. package/dist/src/plugin/logger.d.ts.map +1 -1
  301. package/dist/src/plugin/logger.js +134 -63
  302. package/dist/src/plugin/logger.js.map +1 -1
  303. package/dist/src/plugin/neutral-types.d.ts +42 -0
  304. package/dist/src/plugin/neutral-types.d.ts.map +1 -0
  305. package/dist/src/plugin/neutral-types.js +12 -0
  306. package/dist/src/plugin/neutral-types.js.map +1 -0
  307. package/dist/src/plugin/oauth-methods.d.ts +2 -1
  308. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  309. package/dist/src/plugin/oauth-methods.js +173 -88
  310. package/dist/src/plugin/oauth-methods.js.map +1 -1
  311. package/dist/src/plugin/operator-settings.d.ts +34 -0
  312. package/dist/src/plugin/operator-settings.d.ts.map +1 -1
  313. package/dist/src/plugin/operator-settings.js +105 -2
  314. package/dist/src/plugin/operator-settings.js.map +1 -1
  315. package/dist/src/plugin/persist-account-pool.d.ts +63 -2
  316. package/dist/src/plugin/persist-account-pool.d.ts.map +1 -1
  317. package/dist/src/plugin/persist-account-pool.js +125 -2
  318. package/dist/src/plugin/persist-account-pool.js.map +1 -1
  319. package/dist/src/plugin/quota.d.ts +335 -35
  320. package/dist/src/plugin/quota.d.ts.map +1 -1
  321. package/dist/src/plugin/quota.js +825 -95
  322. package/dist/src/plugin/quota.js.map +1 -1
  323. package/dist/src/plugin/refresh-queue.d.ts +35 -5
  324. package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
  325. package/dist/src/plugin/refresh-queue.js +50 -16
  326. package/dist/src/plugin/refresh-queue.js.map +1 -1
  327. package/dist/src/plugin/request-helpers.d.ts +30 -5
  328. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  329. package/dist/src/plugin/request-helpers.js +82 -17
  330. package/dist/src/plugin/request-helpers.js.map +1 -1
  331. package/dist/src/plugin/request.d.ts +63 -15
  332. package/dist/src/plugin/request.d.ts.map +1 -1
  333. package/dist/src/plugin/request.js +190 -60
  334. package/dist/src/plugin/request.js.map +1 -1
  335. package/dist/src/plugin/session-context.d.ts.map +1 -1
  336. package/dist/src/plugin/session-context.js +5 -2
  337. package/dist/src/plugin/session-context.js.map +1 -1
  338. package/dist/src/plugin/shared/local-grant.d.ts +26 -0
  339. package/dist/src/plugin/shared/local-grant.d.ts.map +1 -0
  340. package/dist/src/plugin/shared/local-grant.js +19 -0
  341. package/dist/src/plugin/shared/local-grant.js.map +1 -0
  342. package/dist/src/plugin/shared/request-cancellation.d.ts +12 -0
  343. package/dist/src/plugin/shared/request-cancellation.d.ts.map +1 -0
  344. package/dist/src/plugin/shared/request-cancellation.js +118 -0
  345. package/dist/src/plugin/shared/request-cancellation.js.map +1 -0
  346. package/dist/src/plugin/shared/request-services.d.ts +375 -0
  347. package/dist/src/plugin/shared/request-services.d.ts.map +1 -0
  348. package/dist/src/plugin/shared/request-services.js +1743 -0
  349. package/dist/src/plugin/shared/request-services.js.map +1 -0
  350. package/dist/src/plugin/shared/runtime.d.ts +217 -0
  351. package/dist/src/plugin/shared/runtime.d.ts.map +1 -0
  352. package/dist/src/plugin/shared/runtime.js +345 -0
  353. package/dist/src/plugin/shared/runtime.js.map +1 -0
  354. package/dist/src/plugin/shared/source-sidebar.d.ts +15 -0
  355. package/dist/src/plugin/shared/source-sidebar.d.ts.map +1 -0
  356. package/dist/src/plugin/shared/source-sidebar.js +41 -0
  357. package/dist/src/plugin/shared/source-sidebar.js.map +1 -0
  358. package/dist/src/plugin/shared/vault-menu.d.ts +5 -0
  359. package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -0
  360. package/dist/src/plugin/shared/vault-menu.js +49 -0
  361. package/dist/src/plugin/shared/vault-menu.js.map +1 -0
  362. package/dist/src/plugin/shared/vault-request-credentials.d.ts +168 -0
  363. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
  364. package/dist/src/plugin/shared/vault-request-credentials.js +485 -0
  365. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -0
  366. package/dist/src/plugin/storage.d.ts +127 -1
  367. package/dist/src/plugin/storage.d.ts.map +1 -1
  368. package/dist/src/plugin/storage.js +188 -3
  369. package/dist/src/plugin/storage.js.map +1 -1
  370. package/dist/src/plugin/token.d.ts +23 -1
  371. package/dist/src/plugin/token.d.ts.map +1 -1
  372. package/dist/src/plugin/token.js +117 -58
  373. package/dist/src/plugin/token.js.map +1 -1
  374. package/dist/src/plugin/ui/quota-status.d.ts +1 -10
  375. package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
  376. package/dist/src/plugin/ui/quota-status.js +6 -42
  377. package/dist/src/plugin/ui/quota-status.js.map +1 -1
  378. package/dist/src/plugin/vault-activation.d.ts +11 -0
  379. package/dist/src/plugin/vault-activation.d.ts.map +1 -0
  380. package/dist/src/plugin/vault-activation.js +53 -0
  381. package/dist/src/plugin/vault-activation.js.map +1 -0
  382. package/dist/src/plugin/vault-custody.d.ts +131 -0
  383. package/dist/src/plugin/vault-custody.d.ts.map +1 -0
  384. package/dist/src/plugin/vault-custody.js +381 -0
  385. package/dist/src/plugin/vault-custody.js.map +1 -0
  386. package/dist/src/quota-presentation.d.ts +18 -0
  387. package/dist/src/quota-presentation.d.ts.map +1 -0
  388. package/dist/src/quota-presentation.js +58 -0
  389. package/dist/src/quota-presentation.js.map +1 -0
  390. package/dist/src/rpc/notifications.d.ts +2 -2
  391. package/dist/src/rpc/notifications.d.ts.map +1 -1
  392. package/dist/src/rpc/notifications.js +1 -1
  393. package/dist/src/rpc/notifications.js.map +1 -1
  394. package/dist/src/rpc/port-file.d.ts +2 -12
  395. package/dist/src/rpc/port-file.d.ts.map +1 -1
  396. package/dist/src/rpc/port-file.js +5 -107
  397. package/dist/src/rpc/port-file.js.map +1 -1
  398. package/dist/src/rpc/protocol.d.ts +47 -16
  399. package/dist/src/rpc/protocol.d.ts.map +1 -1
  400. package/dist/src/rpc/rpc-client.d.ts +27 -3
  401. package/dist/src/rpc/rpc-client.d.ts.map +1 -1
  402. package/dist/src/rpc/rpc-client.js +55 -45
  403. package/dist/src/rpc/rpc-client.js.map +1 -1
  404. package/dist/src/rpc/rpc-server.d.ts +13 -2
  405. package/dist/src/rpc/rpc-server.d.ts.map +1 -1
  406. package/dist/src/rpc/rpc-server.js +38 -212
  407. package/dist/src/rpc/rpc-server.js.map +1 -1
  408. package/dist/src/server.d.ts +30 -0
  409. package/dist/src/server.d.ts.map +1 -0
  410. package/dist/src/server.js +29 -0
  411. package/dist/src/server.js.map +1 -0
  412. package/dist/src/sidebar-projection.d.ts +102 -0
  413. package/dist/src/sidebar-projection.d.ts.map +1 -0
  414. package/dist/src/sidebar-projection.js +146 -0
  415. package/dist/src/sidebar-projection.js.map +1 -0
  416. package/dist/src/sidebar-state.d.ts +13 -5
  417. package/dist/src/sidebar-state.d.ts.map +1 -1
  418. package/dist/src/sidebar-state.js +49 -16
  419. package/dist/src/sidebar-state.js.map +1 -1
  420. package/dist/src/tui/command-dialogs.d.ts +58 -52
  421. package/dist/src/tui/command-dialogs.d.ts.map +1 -1
  422. package/dist/src/tui/command-dialogs.js +379 -571
  423. package/dist/src/tui/command-dialogs.js.map +1 -1
  424. package/dist/src/tui/file-logger.d.ts +2 -3
  425. package/dist/src/tui/file-logger.d.ts.map +1 -1
  426. package/dist/src/tui/file-logger.js +21 -7
  427. package/dist/src/tui/file-logger.js.map +1 -1
  428. package/dist/src/tui/host-api.d.ts +196 -0
  429. package/dist/src/tui/host-api.d.ts.map +1 -0
  430. package/dist/src/tui/host-api.js +357 -0
  431. package/dist/src/tui/host-api.js.map +1 -0
  432. package/dist/src/tui/host-v1.d.ts +60 -0
  433. package/dist/src/tui/host-v1.d.ts.map +1 -0
  434. package/dist/src/tui/host-v1.js +147 -0
  435. package/dist/src/tui/host-v1.js.map +1 -0
  436. package/dist/src/tui/vault-setup.d.ts +98 -0
  437. package/dist/src/tui/vault-setup.d.ts.map +1 -0
  438. package/dist/src/tui/vault-setup.js +198 -0
  439. package/dist/src/tui/vault-setup.js.map +1 -0
  440. package/dist/src/tui.d.ts +4 -11
  441. package/dist/src/tui.d.ts.map +1 -1
  442. package/dist/src/tui.js +33 -75
  443. package/dist/src/tui.js.map +1 -1
  444. package/dist/tui-build-map.json +380 -0
  445. package/dist/tui-ga-build-map.json +187 -0
  446. package/dist/types/src/antigravity/oauth.d.ts +2 -0
  447. package/dist/types/src/antigravity/oauth.d.ts.map +1 -0
  448. package/dist/types/src/cli.d.ts +66 -0
  449. package/dist/types/src/cli.d.ts.map +1 -0
  450. package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  451. package/dist/types/src/common-auth-embedded/commands/index.d.ts +10 -0
  452. package/dist/types/src/common-auth-embedded/commands/menu.d.ts +61 -0
  453. package/dist/types/src/common-auth-embedded/commands/model.d.ts +238 -0
  454. package/dist/types/src/common-auth-embedded/commands/pi.d.ts +23 -0
  455. package/dist/types/src/common-auth-embedded/commands/seam.d.ts +72 -0
  456. package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  457. package/dist/types/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  458. package/dist/types/src/common-auth-embedded/logger/engine.d.ts +100 -0
  459. package/dist/types/src/common-auth-embedded/logger/index.d.ts +6 -0
  460. package/dist/types/src/common-auth-embedded/logger/redact.d.ts +11 -0
  461. package/dist/types/src/common-auth-embedded/quota/codec.d.ts +11 -0
  462. package/dist/types/src/common-auth-embedded/quota/format.d.ts +46 -0
  463. package/dist/types/src/common-auth-embedded/quota/index.d.ts +10 -0
  464. package/dist/types/src/common-auth-embedded/quota/map.d.ts +63 -0
  465. package/dist/types/src/common-auth-embedded/quota/merge.d.ts +48 -0
  466. package/dist/types/src/common-auth-embedded/quota/projection.d.ts +64 -0
  467. package/dist/types/src/common-auth-embedded/store/attribution.d.ts +28 -0
  468. package/dist/types/src/common-auth-embedded/store/errors.d.ts +55 -0
  469. package/dist/types/src/common-auth-embedded/store/hooks.d.ts +12 -0
  470. package/dist/types/src/common-auth-embedded/store/identity.d.ts +39 -0
  471. package/dist/types/src/common-auth-embedded/store/index.d.ts +21 -0
  472. package/dist/types/src/common-auth-embedded/store/mutate.d.ts +189 -0
  473. package/dist/types/src/common-auth-embedded/store/pool.d.ts +196 -0
  474. package/dist/types/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  475. package/dist/types/src/common-auth-embedded/store/publication.d.ts +47 -0
  476. package/dist/types/src/common-auth-embedded/store/pull.d.ts +36 -0
  477. package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  478. package/dist/types/src/common-auth-embedded/store/refresh.d.ts +72 -0
  479. package/dist/types/src/common-auth-embedded/store/rows.d.ts +313 -0
  480. package/dist/types/src/common-auth-embedded/store/runtime.d.ts +36 -0
  481. package/dist/types/src/common-auth-embedded/store/schema.d.ts +443 -0
  482. package/dist/types/src/common-auth-embedded/store/settings.d.ts +63 -0
  483. package/dist/types/src/common-auth-embedded/store/torn.d.ts +78 -0
  484. package/dist/types/src/constants.d.ts +3 -0
  485. package/dist/types/src/constants.d.ts.map +1 -0
  486. package/dist/types/src/ga/proxy-guard.d.ts +120 -0
  487. package/dist/types/src/ga/proxy-guard.d.ts.map +1 -0
  488. package/dist/types/src/ga/rpc/protocol.d.ts +504 -0
  489. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -0
  490. package/dist/types/src/ga/server/auth.d.ts +9 -0
  491. package/dist/types/src/ga/server/auth.d.ts.map +1 -0
  492. package/dist/types/src/ga/server/index.d.ts +576 -0
  493. package/dist/types/src/ga/server/index.d.ts.map +1 -0
  494. package/dist/types/src/hooks/auto-update-checker/cache.d.ts +3 -0
  495. package/dist/types/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  496. package/dist/types/src/hooks/auto-update-checker/checker.d.ts +16 -0
  497. package/dist/types/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  498. package/dist/types/src/hooks/auto-update-checker/constants.d.ts +9 -0
  499. package/dist/types/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  500. package/dist/types/src/hooks/auto-update-checker/index.d.ts +34 -0
  501. package/dist/types/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  502. package/dist/types/src/hooks/auto-update-checker/logging.d.ts +3 -0
  503. package/dist/types/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
  504. package/dist/types/src/hooks/auto-update-checker/types.d.ts +25 -0
  505. package/dist/types/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  506. package/dist/types/src/logging/provider-key-policy.d.ts +9 -0
  507. package/dist/types/src/logging/provider-key-policy.d.ts.map +1 -0
  508. package/dist/types/src/plugin/account-access.d.ts +214 -0
  509. package/dist/types/src/plugin/account-access.d.ts.map +1 -0
  510. package/dist/types/src/plugin/account-blocks.d.ts +102 -0
  511. package/dist/types/src/plugin/account-blocks.d.ts.map +1 -0
  512. package/dist/types/src/plugin/account-command-oauth.d.ts +34 -0
  513. package/dist/types/src/plugin/account-command-oauth.d.ts.map +1 -0
  514. package/dist/types/src/plugin/accounts.d.ts +94 -0
  515. package/dist/types/src/plugin/accounts.d.ts.map +1 -0
  516. package/dist/types/src/plugin/agy-request-metadata.d.ts +2 -0
  517. package/dist/types/src/plugin/agy-request-metadata.d.ts.map +1 -0
  518. package/dist/types/src/plugin/agy-transport.d.ts +2 -0
  519. package/dist/types/src/plugin/agy-transport.d.ts.map +1 -0
  520. package/dist/types/src/plugin/auth-doctor.d.ts +30 -0
  521. package/dist/types/src/plugin/auth-doctor.d.ts.map +1 -0
  522. package/dist/types/src/plugin/auth-drift.d.ts +13 -0
  523. package/dist/types/src/plugin/auth-drift.d.ts.map +1 -0
  524. package/dist/types/src/plugin/auth-loader.d.ts +114 -0
  525. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -0
  526. package/dist/types/src/plugin/auth.d.ts +2 -0
  527. package/dist/types/src/plugin/auth.d.ts.map +1 -0
  528. package/dist/types/src/plugin/background-quota-refresh.d.ts +192 -0
  529. package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -0
  530. package/dist/types/src/plugin/cache/signature-cache.d.ts +156 -0
  531. package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -0
  532. package/dist/types/src/plugin/cache.d.ts +109 -0
  533. package/dist/types/src/plugin/cache.d.ts.map +1 -0
  534. package/dist/types/src/plugin/catalog.d.ts +9 -0
  535. package/dist/types/src/plugin/catalog.d.ts.map +1 -0
  536. package/dist/types/src/plugin/cli.d.ts +44 -0
  537. package/dist/types/src/plugin/cli.d.ts.map +1 -0
  538. package/dist/types/src/plugin/command-apply.d.ts +58 -0
  539. package/dist/types/src/plugin/command-apply.d.ts.map +1 -0
  540. package/dist/types/src/plugin/command-data.d.ts +330 -0
  541. package/dist/types/src/plugin/command-data.d.ts.map +1 -0
  542. package/dist/types/src/plugin/commands.d.ts +164 -0
  543. package/dist/types/src/plugin/commands.d.ts.map +1 -0
  544. package/dist/types/src/plugin/config/index.d.ts +16 -0
  545. package/dist/types/src/plugin/config/index.d.ts.map +1 -0
  546. package/dist/types/src/plugin/config/loader.d.ts +72 -0
  547. package/dist/types/src/plugin/config/loader.d.ts.map +1 -0
  548. package/dist/types/src/plugin/config/models.d.ts +3 -0
  549. package/dist/types/src/plugin/config/models.d.ts.map +1 -0
  550. package/dist/types/src/plugin/config/operator-settings-schema.d.ts +29 -0
  551. package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
  552. package/dist/types/src/plugin/config/schema.d.ts +162 -0
  553. package/dist/types/src/plugin/config/schema.d.ts.map +1 -0
  554. package/dist/types/src/plugin/config/updater.d.ts +55 -0
  555. package/dist/types/src/plugin/config/updater.d.ts.map +1 -0
  556. package/dist/types/src/plugin/config/writer.d.ts +41 -0
  557. package/dist/types/src/plugin/config/writer.d.ts.map +1 -0
  558. package/dist/types/src/plugin/core/streaming/index.d.ts +3 -0
  559. package/dist/types/src/plugin/core/streaming/index.d.ts.map +1 -0
  560. package/dist/types/src/plugin/core/streaming/transformer.d.ts +12 -0
  561. package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  562. package/dist/types/src/plugin/core/streaming/types.d.ts +34 -0
  563. package/dist/types/src/plugin/core/streaming/types.d.ts.map +1 -0
  564. package/dist/types/src/plugin/debug.d.ts +144 -0
  565. package/dist/types/src/plugin/debug.d.ts.map +1 -0
  566. package/dist/types/src/plugin/dependencies.d.ts +129 -0
  567. package/dist/types/src/plugin/dependencies.d.ts.map +1 -0
  568. package/dist/types/src/plugin/errors.d.ts +55 -0
  569. package/dist/types/src/plugin/errors.d.ts.map +1 -0
  570. package/dist/types/src/plugin/event-handler.d.ts +53 -0
  571. package/dist/types/src/plugin/event-handler.d.ts.map +1 -0
  572. package/dist/types/src/plugin/fetch/retry-state.d.ts +61 -0
  573. package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -0
  574. package/dist/types/src/plugin/fetch/warmup.d.ts +30 -0
  575. package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -0
  576. package/dist/types/src/plugin/fetch-interceptor.d.ts +114 -0
  577. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -0
  578. package/dist/types/src/plugin/fetch-routing.d.ts +31 -0
  579. package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -0
  580. package/dist/types/src/plugin/fingerprint.d.ts +2 -0
  581. package/dist/types/src/plugin/fingerprint.d.ts.map +1 -0
  582. package/dist/types/src/plugin/ga-location-services.d.ts +389 -0
  583. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -0
  584. package/dist/types/src/plugin/gemini-dump.d.ts +72 -0
  585. package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -0
  586. package/dist/types/src/plugin/google-search-tool.d.ts +10 -0
  587. package/dist/types/src/plugin/google-search-tool.d.ts.map +1 -0
  588. package/dist/types/src/plugin/image-saver.d.ts +6 -0
  589. package/dist/types/src/plugin/image-saver.d.ts.map +1 -0
  590. package/dist/types/src/plugin/index.d.ts +30 -0
  591. package/dist/types/src/plugin/index.d.ts.map +1 -0
  592. package/dist/types/src/plugin/killswitch.d.ts +93 -0
  593. package/dist/types/src/plugin/killswitch.d.ts.map +1 -0
  594. package/dist/types/src/plugin/lifecycle.d.ts +63 -0
  595. package/dist/types/src/plugin/lifecycle.d.ts.map +1 -0
  596. package/dist/types/src/plugin/logger.d.ts +83 -0
  597. package/dist/types/src/plugin/logger.d.ts.map +1 -0
  598. package/dist/types/src/plugin/logging-utils.d.ts +57 -0
  599. package/dist/types/src/plugin/logging-utils.d.ts.map +1 -0
  600. package/dist/types/src/plugin/model-registry.d.ts +2 -0
  601. package/dist/types/src/plugin/model-registry.d.ts.map +1 -0
  602. package/dist/types/src/plugin/neutral-types.d.ts +42 -0
  603. package/dist/types/src/plugin/neutral-types.d.ts.map +1 -0
  604. package/dist/types/src/plugin/oauth-login.d.ts +22 -0
  605. package/dist/types/src/plugin/oauth-login.d.ts.map +1 -0
  606. package/dist/types/src/plugin/oauth-methods.d.ts +43 -0
  607. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -0
  608. package/dist/types/src/plugin/operator-settings.d.ts +74 -0
  609. package/dist/types/src/plugin/operator-settings.d.ts.map +1 -0
  610. package/dist/types/src/plugin/persist-account-pool.d.ts +98 -0
  611. package/dist/types/src/plugin/persist-account-pool.d.ts.map +1 -0
  612. package/dist/types/src/plugin/project.d.ts +2 -0
  613. package/dist/types/src/plugin/project.d.ts.map +1 -0
  614. package/dist/types/src/plugin/prompt-context.d.ts +18 -0
  615. package/dist/types/src/plugin/prompt-context.d.ts.map +1 -0
  616. package/dist/types/src/plugin/quota.d.ts +441 -0
  617. package/dist/types/src/plugin/quota.d.ts.map +1 -0
  618. package/dist/types/src/plugin/recovery/constants.d.ts +22 -0
  619. package/dist/types/src/plugin/recovery/constants.d.ts.map +1 -0
  620. package/dist/types/src/plugin/recovery/storage.d.ts +24 -0
  621. package/dist/types/src/plugin/recovery/storage.d.ts.map +1 -0
  622. package/dist/types/src/plugin/recovery/types.d.ts +116 -0
  623. package/dist/types/src/plugin/recovery/types.d.ts.map +1 -0
  624. package/dist/types/src/plugin/recovery.d.ts +61 -0
  625. package/dist/types/src/plugin/recovery.d.ts.map +1 -0
  626. package/dist/types/src/plugin/refresh-queue.d.ts +133 -0
  627. package/dist/types/src/plugin/refresh-queue.d.ts.map +1 -0
  628. package/dist/types/src/plugin/request-helpers.d.ts +304 -0
  629. package/dist/types/src/plugin/request-helpers.d.ts.map +1 -0
  630. package/dist/types/src/plugin/request.d.ts +161 -0
  631. package/dist/types/src/plugin/request.d.ts.map +1 -0
  632. package/dist/types/src/plugin/rotation.d.ts +2 -0
  633. package/dist/types/src/plugin/rotation.d.ts.map +1 -0
  634. package/dist/types/src/plugin/search.d.ts +25 -0
  635. package/dist/types/src/plugin/search.d.ts.map +1 -0
  636. package/dist/types/src/plugin/server.d.ts +23 -0
  637. package/dist/types/src/plugin/server.d.ts.map +1 -0
  638. package/dist/types/src/plugin/session-context.d.ts +22 -0
  639. package/dist/types/src/plugin/session-context.d.ts.map +1 -0
  640. package/dist/types/src/plugin/shared/local-grant.d.ts +26 -0
  641. package/dist/types/src/plugin/shared/local-grant.d.ts.map +1 -0
  642. package/dist/types/src/plugin/shared/request-cancellation.d.ts +12 -0
  643. package/dist/types/src/plugin/shared/request-cancellation.d.ts.map +1 -0
  644. package/dist/types/src/plugin/shared/request-services.d.ts +375 -0
  645. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -0
  646. package/dist/types/src/plugin/shared/runtime.d.ts +217 -0
  647. package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -0
  648. package/dist/types/src/plugin/shared/source-sidebar.d.ts +15 -0
  649. package/dist/types/src/plugin/shared/source-sidebar.d.ts.map +1 -0
  650. package/dist/types/src/plugin/shared/vault-menu.d.ts +5 -0
  651. package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -0
  652. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +168 -0
  653. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
  654. package/dist/types/src/plugin/storage.d.ts +221 -0
  655. package/dist/types/src/plugin/storage.d.ts.map +1 -0
  656. package/dist/types/src/plugin/stores/signature-store.d.ts +5 -0
  657. package/dist/types/src/plugin/stores/signature-store.d.ts.map +1 -0
  658. package/dist/types/src/plugin/thinking-recovery.d.ts +90 -0
  659. package/dist/types/src/plugin/thinking-recovery.d.ts.map +1 -0
  660. package/dist/types/src/plugin/token.d.ts +41 -0
  661. package/dist/types/src/plugin/token.d.ts.map +1 -0
  662. package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts +2 -0
  663. package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  664. package/dist/types/src/plugin/transform/index.d.ts +2 -0
  665. package/dist/types/src/plugin/transform/index.d.ts.map +1 -0
  666. package/dist/types/src/plugin/transform/model-resolver.d.ts +2 -0
  667. package/dist/types/src/plugin/transform/model-resolver.d.ts.map +1 -0
  668. package/dist/types/src/plugin/transform/types.d.ts +2 -0
  669. package/dist/types/src/plugin/transform/types.d.ts.map +1 -0
  670. package/dist/types/src/plugin/types.d.ts +36 -0
  671. package/dist/types/src/plugin/types.d.ts.map +1 -0
  672. package/dist/types/src/plugin/ui/ansi.d.ts +32 -0
  673. package/dist/types/src/plugin/ui/ansi.d.ts.map +1 -0
  674. package/dist/types/src/plugin/ui/auth-menu.d.ts +59 -0
  675. package/dist/types/src/plugin/ui/auth-menu.d.ts.map +1 -0
  676. package/dist/types/src/plugin/ui/confirm.d.ts +2 -0
  677. package/dist/types/src/plugin/ui/confirm.d.ts.map +1 -0
  678. package/dist/types/src/plugin/ui/quota-status.d.ts +73 -0
  679. package/dist/types/src/plugin/ui/quota-status.d.ts.map +1 -0
  680. package/dist/types/src/plugin/ui/select.d.ts +23 -0
  681. package/dist/types/src/plugin/ui/select.d.ts.map +1 -0
  682. package/dist/types/src/plugin/vault-activation.d.ts +11 -0
  683. package/dist/types/src/plugin/vault-activation.d.ts.map +1 -0
  684. package/dist/types/src/plugin/vault-custody.d.ts +131 -0
  685. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -0
  686. package/dist/types/src/plugin/version.d.ts +2 -0
  687. package/dist/types/src/plugin/version.d.ts.map +1 -0
  688. package/dist/types/src/quota-presentation.d.ts +18 -0
  689. package/dist/types/src/quota-presentation.d.ts.map +1 -0
  690. package/dist/types/src/rpc/notifications.d.ts +6 -0
  691. package/dist/types/src/rpc/notifications.d.ts.map +1 -0
  692. package/dist/types/src/rpc/protocol.d.ts +53 -0
  693. package/dist/types/src/rpc/protocol.d.ts.map +1 -0
  694. package/dist/types/src/rpc/rpc-dir.d.ts +4 -0
  695. package/dist/types/src/rpc/rpc-dir.d.ts.map +1 -0
  696. package/dist/types/src/rpc/rpc-server.d.ts +24 -0
  697. package/dist/types/src/rpc/rpc-server.d.ts.map +1 -0
  698. package/dist/types/src/server.d.ts +30 -0
  699. package/dist/types/src/server.d.ts.map +1 -0
  700. package/dist/types/src/sidebar-state.d.ts +365 -0
  701. package/dist/types/src/sidebar-state.d.ts.map +1 -0
  702. package/dist/types/src/tui/host-api.d.ts +196 -0
  703. package/dist/types/src/tui/host-api.d.ts.map +1 -0
  704. package/package.json +45 -18
  705. package/server.js +6 -0
  706. package/src/common-auth-embedded/NOTICE.txt +21 -0
  707. package/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
  708. package/src/common-auth-embedded/auth-menu/accounts.js +387 -0
  709. package/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
  710. package/src/common-auth-embedded/auth-menu/ansi.js +98 -0
  711. package/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
  712. package/src/common-auth-embedded/auth-menu/confirm.js +21 -0
  713. package/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
  714. package/src/common-auth-embedded/auth-menu/doctor.js +81 -0
  715. package/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
  716. package/src/common-auth-embedded/auth-menu/index.js +12 -0
  717. package/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
  718. package/src/common-auth-embedded/auth-menu/login.js +83 -0
  719. package/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
  720. package/src/common-auth-embedded/auth-menu/menu.js +73 -0
  721. package/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
  722. package/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
  723. package/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
  724. package/src/common-auth-embedded/auth-menu/select.js +159 -0
  725. package/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  726. package/src/common-auth-embedded/auth-menu/terminal.js +19 -0
  727. package/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
  728. package/src/common-auth-embedded/claustrum/consumer.js +298 -0
  729. package/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
  730. package/src/common-auth-embedded/claustrum/custody.js +354 -0
  731. package/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
  732. package/src/common-auth-embedded/claustrum/enrollment.js +759 -0
  733. package/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  734. package/src/common-auth-embedded/claustrum/errors.js +8 -0
  735. package/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  736. package/src/common-auth-embedded/claustrum/host-slot.js +72 -0
  737. package/src/common-auth-embedded/claustrum/index.d.ts +18 -0
  738. package/src/common-auth-embedded/claustrum/index.js +22 -0
  739. package/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  740. package/src/common-auth-embedded/claustrum/interlock.js +29 -0
  741. package/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
  742. package/src/common-auth-embedded/claustrum/roster.js +536 -0
  743. package/src/common-auth-embedded/commands/builtins.d.ts +71 -0
  744. package/src/common-auth-embedded/commands/builtins.js +534 -0
  745. package/src/common-auth-embedded/commands/index.d.ts +10 -0
  746. package/src/common-auth-embedded/commands/index.js +5 -0
  747. package/src/common-auth-embedded/commands/menu.d.ts +61 -0
  748. package/src/common-auth-embedded/commands/menu.js +300 -0
  749. package/src/common-auth-embedded/commands/model.d.ts +238 -0
  750. package/src/common-auth-embedded/commands/model.js +16 -0
  751. package/src/common-auth-embedded/commands/pi.d.ts +23 -0
  752. package/src/common-auth-embedded/commands/pi.js +206 -0
  753. package/src/common-auth-embedded/commands/seam.d.ts +72 -0
  754. package/src/common-auth-embedded/commands/seam.js +301 -0
  755. package/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
  756. package/src/common-auth-embedded/fs/atomic-write.js +80 -0
  757. package/src/common-auth-embedded/fs/index.d.ts +7 -0
  758. package/src/common-auth-embedded/fs/index.js +6 -0
  759. package/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
  760. package/src/common-auth-embedded/fs/lock-constants.js +14 -0
  761. package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
  762. package/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
  763. package/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
  764. package/src/common-auth-embedded/fs/with-lock.js +48 -0
  765. package/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
  766. package/src/common-auth-embedded/logger/capture-sink.js +13 -0
  767. package/src/common-auth-embedded/logger/engine.d.ts +100 -0
  768. package/src/common-auth-embedded/logger/engine.js +246 -0
  769. package/src/common-auth-embedded/logger/index.d.ts +6 -0
  770. package/src/common-auth-embedded/logger/index.js +3 -0
  771. package/src/common-auth-embedded/logger/redact.d.ts +11 -0
  772. package/src/common-auth-embedded/logger/redact.js +83 -0
  773. package/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  774. package/src/common-auth-embedded/opencode2/errors.js +15 -0
  775. package/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  776. package/src/common-auth-embedded/opencode2/index.js +4 -0
  777. package/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  778. package/src/common-auth-embedded/opencode2/install.js +886 -0
  779. package/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  780. package/src/common-auth-embedded/opencode2/integration.js +143 -0
  781. package/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  782. package/src/common-auth-embedded/opencode2/sse.js +60 -0
  783. package/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  784. package/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
  785. package/src/common-auth-embedded/pi-slot/index.js +2 -0
  786. package/src/common-auth-embedded/pi-slot/lock.js +212 -0
  787. package/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
  788. package/src/common-auth-embedded/pi-slot/slot.js +383 -0
  789. package/src/common-auth-embedded/quota/codec.d.ts +11 -0
  790. package/src/common-auth-embedded/quota/codec.js +12 -0
  791. package/src/common-auth-embedded/quota/format.d.ts +46 -0
  792. package/src/common-auth-embedded/quota/format.js +138 -0
  793. package/src/common-auth-embedded/quota/index.d.ts +10 -0
  794. package/src/common-auth-embedded/quota/index.js +5 -0
  795. package/src/common-auth-embedded/quota/map.d.ts +63 -0
  796. package/src/common-auth-embedded/quota/map.js +105 -0
  797. package/src/common-auth-embedded/quota/merge.d.ts +48 -0
  798. package/src/common-auth-embedded/quota/merge.js +162 -0
  799. package/src/common-auth-embedded/quota/projection.d.ts +64 -0
  800. package/src/common-auth-embedded/quota/projection.js +134 -0
  801. package/src/common-auth-embedded/routing/admission.d.ts +93 -0
  802. package/src/common-auth-embedded/routing/admission.js +142 -0
  803. package/src/common-auth-embedded/routing/index.d.ts +8 -0
  804. package/src/common-auth-embedded/routing/index.js +4 -0
  805. package/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  806. package/src/common-auth-embedded/routing/ordered.js +58 -0
  807. package/src/common-auth-embedded/routing/pins.d.ts +22 -0
  808. package/src/common-auth-embedded/routing/pins.js +34 -0
  809. package/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  810. package/src/common-auth-embedded/routing/sticky.js +339 -0
  811. package/src/common-auth-embedded/rpc/client.d.ts +3 -0
  812. package/src/common-auth-embedded/rpc/client.js +2 -0
  813. package/src/common-auth-embedded/rpc/index.d.ts +10 -0
  814. package/src/common-auth-embedded/rpc/index.js +5 -0
  815. package/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
  816. package/src/common-auth-embedded/rpc/notifications.js +100 -0
  817. package/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
  818. package/src/common-auth-embedded/rpc/port-file.js +217 -0
  819. package/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
  820. package/src/common-auth-embedded/rpc/rpc-client.js +253 -0
  821. package/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
  822. package/src/common-auth-embedded/rpc/rpc-server.js +311 -0
  823. package/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
  824. package/src/common-auth-embedded/rpc/server-registry.js +47 -0
  825. package/src/common-auth-embedded/source-output.json +1326 -0
  826. package/src/common-auth-embedded/store/attribution.d.ts +28 -0
  827. package/src/common-auth-embedded/store/attribution.js +60 -0
  828. package/src/common-auth-embedded/store/errors.d.ts +55 -0
  829. package/src/common-auth-embedded/store/errors.js +38 -0
  830. package/src/common-auth-embedded/store/hooks.d.ts +12 -0
  831. package/src/common-auth-embedded/store/hooks.js +34 -0
  832. package/src/common-auth-embedded/store/identity.d.ts +39 -0
  833. package/src/common-auth-embedded/store/identity.js +79 -0
  834. package/src/common-auth-embedded/store/index.d.ts +21 -0
  835. package/src/common-auth-embedded/store/index.js +7 -0
  836. package/src/common-auth-embedded/store/mutate.d.ts +189 -0
  837. package/src/common-auth-embedded/store/mutate.js +500 -0
  838. package/src/common-auth-embedded/store/pool.d.ts +196 -0
  839. package/src/common-auth-embedded/store/pool.js +120 -0
  840. package/src/common-auth-embedded/store/provider-state.d.ts +131 -0
  841. package/src/common-auth-embedded/store/provider-state.js +226 -0
  842. package/src/common-auth-embedded/store/publication.d.ts +47 -0
  843. package/src/common-auth-embedded/store/publication.js +304 -0
  844. package/src/common-auth-embedded/store/pull.d.ts +36 -0
  845. package/src/common-auth-embedded/store/pull.js +143 -0
  846. package/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
  847. package/src/common-auth-embedded/store/refresh-lock.js +136 -0
  848. package/src/common-auth-embedded/store/refresh.d.ts +72 -0
  849. package/src/common-auth-embedded/store/refresh.js +225 -0
  850. package/src/common-auth-embedded/store/reserved.js +13 -0
  851. package/src/common-auth-embedded/store/rows.d.ts +313 -0
  852. package/src/common-auth-embedded/store/rows.js +1258 -0
  853. package/src/common-auth-embedded/store/runtime.d.ts +36 -0
  854. package/src/common-auth-embedded/store/runtime.js +68 -0
  855. package/src/common-auth-embedded/store/schema.d.ts +443 -0
  856. package/src/common-auth-embedded/store/schema.js +754 -0
  857. package/src/common-auth-embedded/store/settings.d.ts +63 -0
  858. package/src/common-auth-embedded/store/settings.js +120 -0
  859. package/src/common-auth-embedded/store/torn.d.ts +78 -0
  860. package/src/common-auth-embedded/store/torn.js +294 -0
  861. package/src/common-auth-embedded/tui/index.d.ts +8 -0
  862. package/src/common-auth-embedded/tui/index.js +21 -0
  863. package/src/common-auth-embedded/util/any-signal.js +42 -0
  864. package/src/plugin/command-data.ts +3 -0
  865. package/src/rpc/port-file.ts +6 -140
  866. package/src/rpc/protocol.ts +59 -24
  867. package/src/rpc/rpc-client.ts +101 -71
  868. package/src/sidebar-state.ts +82 -24
  869. package/src/tui/command-dialogs.tsx +412 -776
  870. package/src/tui/entry.d.mts +17 -0
  871. package/src/tui/entry.mjs +34 -66
  872. package/src/tui/file-logger.ts +22 -7
  873. package/src/tui-compiled/common-auth-embedded/logger/capture-sink.js +13 -0
  874. package/src/tui-compiled/common-auth-embedded/logger/engine.js +246 -0
  875. package/src/tui-compiled/common-auth-embedded/logger/index.js +3 -0
  876. package/src/tui-compiled/common-auth-embedded/logger/redact.js +83 -0
  877. package/src/tui-compiled/common-auth-embedded/quota/codec.js +12 -0
  878. package/src/tui-compiled/common-auth-embedded/quota/format.js +138 -0
  879. package/src/tui-compiled/common-auth-embedded/quota/index.js +5 -0
  880. package/src/tui-compiled/common-auth-embedded/quota/map.js +105 -0
  881. package/src/tui-compiled/common-auth-embedded/quota/merge.js +162 -0
  882. package/src/tui-compiled/common-auth-embedded/quota/projection.js +134 -0
  883. package/src/tui-compiled/common-auth-embedded/rpc/client.js +2 -0
  884. package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +217 -0
  885. package/src/tui-compiled/common-auth-embedded/rpc/rpc-client.js +253 -0
  886. package/src/tui-compiled/logging/provider-key-policy.js +3 -0
  887. package/src/tui-compiled/quota-presentation.js +42 -0
  888. package/src/tui-compiled/rpc/rpc-client.js +35 -0
  889. package/src/tui-compiled/rpc/rpc-dir.js +13 -0
  890. package/src/tui-compiled/selector.js +21 -0
  891. package/src/tui-compiled/sidebar-state.js +401 -0
  892. package/src/tui-compiled/tui/command-dialogs.js +424 -0
  893. package/src/tui-compiled/tui/file-logger.js +73 -0
  894. package/src/tui-compiled/tui/host-api.js +269 -0
  895. package/src/tui-compiled/tui/host-v1.js +228 -0
  896. package/src/tui-compiled/tui-preferences.js +230 -0
  897. package/src/tui-compiled/{tui.tsx → tui.js} +140 -231
  898. package/src/tui-ga-compiled/host-ga.js +1304 -0
  899. package/src/tui-ga-compiled/selector.js +21 -0
  900. package/src/tui-ga-compiled/shared/07365a7d2ccade4c-host-api.js +269 -0
  901. package/src/tui-ga-compiled/shared/0e19a88ff3535906-command-dialogs.js +424 -0
  902. package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +134 -0
  903. package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +105 -0
  904. package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
  905. package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
  906. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +138 -0
  907. package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +5 -0
  908. package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +12 -0
  909. package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +162 -0
  910. package/src/tui-ga-raw/host-ga.tsx +1740 -0
  911. package/src/tui-ga-raw/selector.js +21 -0
  912. package/src/tui-ga-raw/shared/07365a7d2ccade4c-host-api.js +269 -0
  913. package/src/tui-ga-raw/shared/0e19a88ff3535906-command-dialogs.tsx +468 -0
  914. package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +134 -0
  915. package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +105 -0
  916. package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
  917. package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
  918. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +138 -0
  919. package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +5 -0
  920. package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +12 -0
  921. package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +162 -0
  922. package/src/tui-raw/common-auth-embedded/logger/capture-sink.js +13 -0
  923. package/src/tui-raw/common-auth-embedded/logger/engine.js +246 -0
  924. package/src/tui-raw/common-auth-embedded/logger/index.js +3 -0
  925. package/src/tui-raw/common-auth-embedded/logger/redact.js +83 -0
  926. package/src/tui-raw/common-auth-embedded/quota/codec.js +12 -0
  927. package/src/tui-raw/common-auth-embedded/quota/format.js +138 -0
  928. package/src/tui-raw/common-auth-embedded/quota/index.js +5 -0
  929. package/src/tui-raw/common-auth-embedded/quota/map.js +105 -0
  930. package/src/tui-raw/common-auth-embedded/quota/merge.js +162 -0
  931. package/src/tui-raw/common-auth-embedded/quota/projection.js +134 -0
  932. package/src/tui-raw/common-auth-embedded/rpc/client.js +2 -0
  933. package/src/tui-raw/common-auth-embedded/rpc/port-file.js +217 -0
  934. package/src/tui-raw/common-auth-embedded/rpc/rpc-client.js +253 -0
  935. package/src/tui-raw/logging/provider-key-policy.js +3 -0
  936. package/src/tui-raw/quota-presentation.js +42 -0
  937. package/src/tui-raw/rpc/rpc-client.js +35 -0
  938. package/src/tui-raw/rpc/rpc-dir.js +13 -0
  939. package/src/tui-raw/selector.js +21 -0
  940. package/src/tui-raw/sidebar-state.js +401 -0
  941. package/src/tui-raw/tui/command-dialogs.tsx +468 -0
  942. package/src/tui-raw/tui/file-logger.js +73 -0
  943. package/src/tui-raw/tui/host-api.js +269 -0
  944. package/src/tui-raw/tui/host-v1.tsx +249 -0
  945. package/src/tui-raw/tui-preferences.js +230 -0
  946. package/src/tui-raw/tui.tsx +1088 -0
  947. package/src/tui.tsx +58 -141
  948. package/tui.js +6 -0
  949. package/src/tui-compiled/plugin/command-data.ts +0 -931
  950. package/src/tui-compiled/rpc/port-file.ts +0 -143
  951. package/src/tui-compiled/rpc/protocol.ts +0 -31
  952. package/src/tui-compiled/rpc/rpc-client.ts +0 -102
  953. package/src/tui-compiled/rpc/rpc-dir.ts +0 -24
  954. package/src/tui-compiled/sidebar-state.ts +0 -991
  955. package/src/tui-compiled/tui/command-dialogs.tsx +0 -779
  956. package/src/tui-compiled/tui/file-logger.ts +0 -145
  957. package/src/tui-compiled/tui-preferences.ts +0 -416
@@ -1,832 +1,468 @@
1
- /** @jsxImportSource @opentui/solid */
2
-
3
1
  /**
4
- * Imperative command-dialog dispatcher for the /antigravity-* slash commands.
2
+ * The `/antigravity` drawer: one renderer for the server's command menu,
3
+ * shared by the OpenCode 1 and OpenCode GA TUIs.
4
+ *
5
+ * The server builds the whole menu with the shared command menu of
6
+ * `@cortexkit/common-auth/commands`: Accounts, Quota, Routing, Limits
7
+ * (killswitch), Cache, Diagnostics (logging and wire dump) and the plugin's
8
+ * extras (vault setup), each with its read-only lines, its items, and its
9
+ * actions with their typed inputs and confirmations. This file only walks
10
+ * that payload through the host's dialogs and sends back which action the
11
+ * user chose, by the opaque section, item and action ids the server gave.
12
+ * It never builds an account target of its own, never looks an account up
13
+ * by position, and never retries a choice against a different target: an id
14
+ * the server no longer knows comes back as a refused apply and the user sees
15
+ * the server's message.
5
16
  *
6
- * Mirrors the fleet sibling layout (see `anthropic-auth-live` /
7
- * `openai-auth-live` `packages/opencode/src/tui/command-dialogs.tsx`):
8
- * each command's dialog opens with its data/status content rendered into the
9
- * dialog BODY as a column of plain `<text>` nodes — non-selectable,
10
- * non-searchable — and a separate `<DialogSelect>` below carries ONLY the
11
- * real actions with proper `{title, description}` shapes the host renders
12
- * on separate lines. The earlier implementation crammed the data rows into
13
- * `DialogSelect`'s `placeholder` (which participates in type-ahead search)
14
- * and concatenated label+description into a single highlighted option line;
15
- * this rewrite separates data from actions the way the host expects.
17
+ * Every redraw after an apply uses the menu that apply returned, which the
18
+ * server built fresh for that answer; settings shown here are never a
19
+ * replay of an earlier answer.
16
20
  *
17
- * Contract:
18
- * - Every main/subdialog calls `api.ui.dialog.setSize('xlarge')` before
19
- * `api.ui.dialog.replace()` so the host reserves enough width for the
20
- * longest line in any branch.
21
- * - `apply(command, args, options?)` is the RPC apply path the dispatch
22
- * site (the module-scoped poll in `tui.tsx`) supplies. The dispatcher
23
- * forwards `options.timeoutMs` so a long-running apply (account add /
24
- * refresh, future quota refresh) gets the right RPC timeout.
25
- * - All `DialogSelect` options must remain VISIBLE — the host's
26
- * `disabled: true` is a hard hide, so this file must never set it.
27
- * Invalid actions stay visible with an explanatory description and are
28
- * rejected in `onSelect`. The `no hide-property option scan` test in
29
- * the verification gates pins this contract.
30
- * - `onSelect` awaits the apply, toasts the result, then either clears
31
- * the dialog or replaces it for multi-step flows. The dialog stack
32
- * never sees a `clear()` between apply and re-render so the user
33
- * always sees feedback (per the dispatcher contract).
21
+ * The drawer talks to the host only through `MenuUi` (dialog primitives as
22
+ * promises) and `MenuApply` (the transport), so the same code runs on both
23
+ * hosts. Nothing here writes to the terminal or picks colors.
34
24
  */
35
25
 
36
- import type { TuiPluginApi } from '@opencode-ai/plugin/tui'
37
- import type { CommandAccountRow } from '../plugin/command-data'
38
- import type { CommandModalName, OpenDialogPayload } from '../rpc/protocol'
26
+ import {
27
+ type KnobValue,
28
+ MENU_REFUSED_TEXT,
29
+ type MenuAction,
30
+ type MenuApply,
31
+ type MenuApplyRequest,
32
+ type MenuApplyResult,
33
+ type MenuDialogPayload,
34
+ type MenuItem,
35
+ type MenuKnob,
36
+ type MenuModel,
37
+ type MenuSection,
38
+ type MenuSelectOption,
39
+ type MenuUi,
40
+ } from './host-api'
41
+
42
+ const BACK = 'back'
43
+
44
+ /** Text longer than this, or with a line break, is shown in full, not toasted. */
45
+ const TOAST_MAX_LENGTH = 120
39
46
 
40
47
  /**
41
- * Apply handler the dispatcher calls when the user selects a dialog
42
- * option. Mirrors `ApplyRequest` from `rpc/protocol` plus the
43
- * `RpcRequestOptions.timeoutMs` knob the RPC client already accepts —
44
- * the call site in `tui.tsx` forwards these directly into
45
- * `rpcClient.apply(request, options)`.
48
+ * Raised by a transport when an answer fails validation, so the drawer can
49
+ * tell a refused answer from an unreachable server.
46
50
  */
47
- export type ApplyFn = (
48
- command: CommandModalName,
49
- args: string,
50
- options?: { timeoutMs?: number },
51
- ) => Promise<{ text: string; knobs: Record<string, unknown> }>
52
-
53
- /**
54
- * Mount the dialog for `payload.command` on the live TUI.
55
- *
56
- * The dispatcher branches on `payload.command` — each branch is
57
- * self-contained: render the data body, render the host DialogSelect
58
- * below it with the real actions, wire `onSelect` to await `apply(...)`,
59
- * then toast the result and clear (or replace for multi-step flows).
60
- * Unknown commands throw so a future command registered in
61
- * `MODAL_COMMANDS` without a dispatcher branch fails loudly at the first
62
- * dialog open.
63
- */
64
- export function openCommandDialog(
65
- api: TuiPluginApi,
66
- payload: OpenDialogPayload,
67
- apply: ApplyFn,
68
- ): void {
69
- if (payload.command === 'antigravity-dump') {
70
- renderDumpDialog(api, payload, apply)
71
- return
72
- }
73
- if (payload.command === 'antigravity-logging') {
74
- renderLoggingDialog(api, payload, apply)
75
- return
51
+ export class MenuRefusedError extends Error {
52
+ constructor(readonly issues: readonly string[]) {
53
+ super(MENU_REFUSED_TEXT)
54
+ this.name = 'MenuRefusedError'
76
55
  }
77
- if (payload.command === 'antigravity-quota') {
78
- throw new Error('antigravity-quota is rendered by the TUI quota panel')
79
- }
80
- if (payload.command === 'antigravity-account') {
81
- renderAccountDialog(api, payload, apply)
82
- return
83
- }
84
- if (payload.command === 'antigravity-routing') {
85
- renderRoutingDialog(api, payload, apply)
86
- return
87
- }
88
- if (payload.command === 'antigravity-killswitch') {
89
- renderKillswitchDialog(api, payload, apply)
90
- return
91
- }
92
- const exhaustiveCheck: never = payload.command
93
- throw new Error(`Unknown command ${exhaustiveCheck as string}`)
94
56
  }
95
57
 
96
- // ---------------------------------------------------------------------------
97
- // Fully wired branches — non-data-first dialogs.
98
- // ---------------------------------------------------------------------------
58
+ function factLines(
59
+ facts: Readonly<Record<string, unknown>> | undefined,
60
+ ): string[] {
61
+ return Object.entries(facts ?? {}).map(
62
+ ([name, value]) =>
63
+ `${name}: ${typeof value === 'string' ? value : JSON.stringify(value)}`,
64
+ )
65
+ }
99
66
 
100
- /**
101
- * /antigravity-dump: three actions (on / off / status). Each selection
102
- * applies through the RPC, toasts the result text, and clears the
103
- * dialog. Status is a read-only check that still goes through apply so
104
- * the dump helper runs once and reports the current state.
105
- */
106
- function renderDumpDialog(
107
- api: TuiPluginApi,
108
- _payload: OpenDialogPayload,
109
- apply: ApplyFn,
110
- ): void {
111
- const DialogSelect = api.ui.DialogSelect<string>
112
- api.ui.dialog.setSize('xlarge')
113
- api.ui.dialog.replace(() => (
114
- <DialogSelect
115
- title='Antigravity wire dump'
116
- options={[
117
- {
118
- title: 'Turn dump on',
119
- value: 'on',
120
- description: 'Write request and response bodies to the dump dir.',
121
- },
122
- {
123
- title: 'Turn dump off',
124
- value: 'off',
125
- description: 'Stop writing new dump files.',
126
- },
127
- {
128
- title: 'Show dump status',
129
- value: 'status',
130
- description: 'Display whether dumps are enabled and where they go.',
131
- },
132
- ]}
133
- onSelect={(option) => {
134
- void apply('antigravity-dump', String(option.value)).then((result) => {
135
- api.ui.toast({ message: result.text })
136
- api.ui.dialog.clear()
137
- })
138
- }}
139
- />
140
- ))
67
+ /** One option per section, in the order the menu gives them. */
68
+ export function sectionListOptions(menu: MenuModel): MenuSelectOption[] {
69
+ return menu.sections.map((section) => ({
70
+ title: section.title,
71
+ value: `section:${section.id}`,
72
+ ...(section.lines[0] ? { description: section.lines[0] } : {}),
73
+ }))
74
+ }
75
+
76
+ /** Status text is a group header; every option navigates or runs an action. */
77
+ export function sectionOptions(section: MenuSection): MenuSelectOption[] {
78
+ const header = [
79
+ ...section.lines,
80
+ ...factLines(section.facts),
81
+ ...section.items
82
+ .filter((item) => item.actions.length === 0)
83
+ .map((item) =>
84
+ [
85
+ item.group,
86
+ [item.label, item.status].filter(Boolean).join(' · '),
87
+ item.detail,
88
+ ...factLines(item.facts),
89
+ ]
90
+ .filter(Boolean)
91
+ .join('\n'),
92
+ ),
93
+ ]
94
+ const options: MenuSelectOption[] = [
95
+ ...section.items
96
+ .filter((item) => item.actions.length > 0)
97
+ .map((item) => ({
98
+ title: item.label,
99
+ value: `item:${item.id}`,
100
+ ...(item.detail ? { description: item.detail } : {}),
101
+ ...(item.group ? { category: item.group } : {}),
102
+ ...(item.status ? { footer: item.status } : {}),
103
+ })),
104
+ ...section.actions.map((action) => ({
105
+ title: action.label,
106
+ value: `action:${action.id}`,
107
+ ...(action.description ? { description: action.description } : {}),
108
+ ...(action.group ? { category: action.group } : {}),
109
+ })),
110
+ { title: 'Back', value: BACK },
111
+ ]
112
+ const first = options[0]
113
+ if (!first || header.length === 0) return options
114
+ const category = [...header, first.category].filter(Boolean).join('\n')
115
+ let firstGroup = true
116
+ return options.map((option) => {
117
+ if (option.category !== first.category) firstGroup = false
118
+ return firstGroup ? { ...option, category } : option
119
+ })
120
+ }
121
+
122
+ /** Item context stays in descriptions, never in rows that cannot be acted on. */
123
+ export function itemOptions(item: MenuItem): MenuSelectOption[] {
124
+ const detail = [item.detail, ...factLines(item.facts)]
125
+ .filter(Boolean)
126
+ .join(' · ')
127
+ return [
128
+ ...item.actions.map((action) => ({
129
+ title: action.label,
130
+ value: `action:${action.id}`,
131
+ ...(detail || action.description
132
+ ? {
133
+ description: [detail, action.description]
134
+ .filter(Boolean)
135
+ .join(' · '),
136
+ }
137
+ : {}),
138
+ ...(action.group ? { category: action.group } : {}),
139
+ })),
140
+ { title: 'Back', value: BACK },
141
+ ]
141
142
  }
142
143
 
143
144
  /**
144
- * /antigravity-logging: every log level as an option. The dispatcher
145
- * forwards the level as the apply arg; the apply path persists it
146
- * through `OperatorSettingsController` and toasts the resolution text.
145
+ * The value a typed `number` or `text` input sends. Empty is `null` (the
146
+ * action reads that as "leave unset"); a number input sends a number when
147
+ * the text parses as one and the text otherwise, so the server can say what
148
+ * is wrong with it.
147
149
  */
148
- function renderLoggingDialog(
149
- api: TuiPluginApi,
150
- payload: OpenDialogPayload,
151
- apply: ApplyFn,
152
- ): void {
153
- const DialogSelect = api.ui.DialogSelect<string>
154
- const current = (payload.knobs.log_level as string) ?? 'info'
155
- api.ui.dialog.setSize('xlarge')
156
- api.ui.dialog.replace(() => (
157
- <DialogSelect
158
- title='Antigravity logging'
159
- current={current}
160
- options={[
161
- { title: 'Error', value: 'error', description: 'Errors only.' },
162
- { title: 'Warn', value: 'warn', description: 'Warnings and errors.' },
163
- {
164
- title: 'Info',
165
- value: 'info',
166
- description: 'Default. Includes informational events.',
167
- },
168
- {
169
- title: 'Debug',
170
- value: 'debug',
171
- description: 'Includes debug-level events.',
172
- },
173
- {
174
- title: 'Trace',
175
- value: 'trace',
176
- description: 'Most verbose — every diagnostic event.',
177
- },
178
- ]}
179
- onSelect={(option) => {
180
- void apply('antigravity-logging', String(option.value)).then(
181
- (result) => {
182
- api.ui.toast({ message: result.text })
183
- api.ui.dialog.clear()
184
- },
185
- )
186
- }}
187
- />
188
- ))
150
+ export function promptValue(knob: MenuKnob, raw: string): KnobValue {
151
+ const text = raw.trim()
152
+ if (text === '') return null
153
+ if (knob.kind === 'number') {
154
+ const number = Number(text)
155
+ return Number.isFinite(number) ? number : text
156
+ }
157
+ return raw
189
158
  }
190
159
 
191
- // ---------------------------------------------------------------------------
192
- // Shared helpers — render data rows as plain text in the dialog body.
193
- // ---------------------------------------------------------------------------
160
+ function knobDefault(knob: MenuKnob): string {
161
+ if (knob.kind === 'toggle') return knob.value ? 'on' : 'off'
162
+ if (knob.kind === 'text' && knob.masked) return ''
163
+ return knob.value === undefined ? '' : String(knob.value)
164
+ }
194
165
 
195
- function formatQuotaRowLine(row: CommandAccountRow): string {
196
- const status = row.enabled ? '' : ' (disabled)'
197
- const current = row.current ? ' *' : ''
198
- if (row.quota.length === 0) {
199
- return `${row.label}${status}${current}: no cached quota`
200
- }
201
- const parts = row.quota.map((q) => {
202
- const pct = q.remainingPercent == null ? '–%' : `${q.remainingPercent}%`
203
- return `${q.label} ${pct}`
204
- })
205
- return `${row.label}${status}${current}: ${parts.join(', ')}`
166
+ /** The first web link in a message, such as a sign-in URL. */
167
+ export function firstLink(text: string): string | undefined {
168
+ return /https?:\/\/\S+/.exec(text)?.[0]
169
+ }
170
+
171
+ export interface DrawerOptions {
172
+ readonly ui: MenuUi
173
+ readonly apply: MenuApply
174
+ /**
175
+ * Copies text to the clipboard; returns false when the terminal cannot.
176
+ * Absent when the host offers no clipboard.
177
+ */
178
+ readonly copy?: (text: string) => boolean
179
+ /** Receives drawer failures; must not write to the terminal. */
180
+ readonly onError?: (message: string, detail: Record<string, unknown>) => void
181
+ /** Opens on this section instead of the section list, when it exists. */
182
+ readonly startSection?: string
206
183
  }
207
184
 
208
185
  /**
209
- * /antigravity-account data-first dialog.
210
- *
211
- * The body lists each account row as a plain `<text>` node (cache-only
212
- * — no network I/O on open). The DialogSelect carries ONLY real
213
- * actions: Add account… and one drill-in entry per row. Drill-in
214
- * navigates to a row-level subdialog that exposes toggle / set-current
215
- * / remove with a DialogConfirm gate for the destructive path.
216
- *
217
- * Each action calls `apply('antigravity-account', '<verb> <index>')`,
218
- * which the apply path translates into a locked-storage mutation.
219
- * The service returns fresh `CommandAccountRow[]`; the dialog mutates
220
- * its closed-over payload and re-renders via `renderMain()` so the
221
- * user never sees a clear-then-redraw gap.
186
+ * Opens the drawer on a payload the server pushed for `/antigravity`. The
187
+ * returned promise settles when the user closes the drawer.
222
188
  */
223
- function renderAccountDialog(
224
- api: TuiPluginApi,
225
- initialPayload: OpenDialogPayload,
226
- apply: ApplyFn,
227
- ): void {
228
- // Closed-over payload: every render reads from the latest snapshot.
229
- const payload: OpenDialogPayload = { ...initialPayload }
230
-
231
- const rowsFromKnobs = (): CommandAccountRow[] => {
232
- const raw = payload.knobs.accounts
233
- return Array.isArray(raw) ? (raw as CommandAccountRow[]) : []
234
- }
235
-
236
- const runApply = async (
237
- args: string,
238
- options?: { timeoutMs?: number },
239
- ): Promise<CommandAccountRow[] | null> => {
240
- const result = await apply('antigravity-account', args, options)
241
- api.ui.toast({ message: result.text })
242
- const next = result.knobs.accounts
243
- if (Array.isArray(next)) {
244
- payload.knobs = {
245
- ...payload.knobs,
246
- accounts: next as CommandAccountRow[],
247
- }
248
- renderMain()
249
- return next as CommandAccountRow[]
250
- }
251
- renderMain()
252
- return null
253
- }
189
+ export function openAntigravityMenu(
190
+ options: DrawerOptions,
191
+ payload: MenuDialogPayload,
192
+ ): Promise<void> {
193
+ return new Drawer(options, payload.menu).start()
194
+ }
254
195
 
255
- const updateAccounts = (knobs: Record<string, unknown>): void => {
256
- const accounts = knobs.accounts
257
- if (!Array.isArray(accounts)) return
258
- payload.knobs = {
259
- ...payload.knobs,
260
- accounts: accounts as CommandAccountRow[],
261
- }
262
- }
196
+ const CANCEL = '\u0000cancel'
263
197
 
264
- const openOAuthLabelPrompt = (code: string, oauthUrl: string): void => {
265
- const DialogPrompt = api.ui.DialogPrompt
266
- api.ui.dialog.setSize('xlarge')
267
- api.ui.dialog.replace(() => (
268
- <DialogPrompt
269
- title='OAuth sign-in — label'
270
- description={() => (
271
- <text>A short name for this account (optional).</text>
272
- )}
273
- placeholder='e.g. work'
274
- value=''
275
- onConfirm={(value: string) => {
276
- const label = value.trim()
277
- const args = label
278
- ? `add-oauth-finish ${code} --label ${label}`
279
- : `add-oauth-finish ${code}`
280
- void apply('antigravity-account', args, { timeoutMs: 120_000 })
281
- .then((result) => {
282
- api.ui.toast({ message: result.text })
283
- updateAccounts(result.knobs)
284
- renderMain()
285
- })
286
- .catch(() => {
287
- api.ui.toast({ message: 'OAuth account add failed' })
288
- renderMain()
289
- })
290
- }}
291
- onCancel={() => openOAuthCodePrompt(oauthUrl)}
292
- />
293
- ))
294
- }
198
+ class Drawer {
199
+ private menu: MenuModel
295
200
 
296
- const openOAuthCodePrompt = (oauthUrl: string): void => {
297
- const DialogPrompt = api.ui.DialogPrompt
298
- api.ui.dialog.setSize('xlarge')
299
- api.ui.dialog.replace(() => (
300
- <DialogPrompt
301
- title='OAuth sign-in — enter code'
302
- description={() => (
303
- <text>
304
- After signing in, paste the full callback URL or authorization code.
305
- </text>
306
- )}
307
- placeholder='Paste callback URL or code here'
308
- value=''
309
- onConfirm={(value: string) => {
310
- const code = value.trim()
311
- if (!code) {
312
- // Empty submit must keep the user inside the flow, not
313
- // silently drop them back to the account list. Surface the
314
- // validation message and reopen the same prompt so the
315
- // user can paste again.
316
- api.ui.toast({
317
- message: 'Please paste the callback URL or authorization code.',
318
- })
319
- openOAuthCodePrompt(oauthUrl)
320
- return
321
- }
322
- openOAuthLabelPrompt(code, oauthUrl)
323
- }}
324
- onCancel={() => openOAuthUrlScreen(oauthUrl)}
325
- />
326
- ))
201
+ constructor(
202
+ private readonly options: DrawerOptions,
203
+ menu: MenuModel,
204
+ ) {
205
+ this.menu = menu
327
206
  }
328
207
 
329
- const openOAuthUrlScreen = (oauthUrl: string): void => {
330
- const DialogSelect = api.ui.DialogSelect<string>
331
- api.ui.dialog.setSize('xlarge')
332
- api.ui.dialog.replace(() => (
333
- <DialogSelect
334
- title='OAuth sign-in'
335
- options={[
336
- {
337
- title: 'Copy URL to clipboard',
338
- value: 'copy',
339
- description: oauthUrl,
340
- },
341
- {
342
- title: 'Enter sign-in code',
343
- value: 'code',
344
- description:
345
- 'Open the URL in your browser, sign in, then paste the callback URL or code.',
346
- },
347
- { title: 'Cancel', value: 'cancel' },
348
- ]}
349
- onSelect={(option) => {
350
- if (option.value === 'cancel') {
351
- renderMain()
352
- return
353
- }
354
- if (option.value === 'copy') {
355
- const copied = api.renderer.copyToClipboardOSC52(oauthUrl)
356
- api.ui.toast({
357
- message: copied
358
- ? 'URL copied to clipboard'
359
- : 'Copy unavailable — select the URL text above to copy',
360
- })
361
- openOAuthUrlScreen(oauthUrl)
362
- return
363
- }
364
- openOAuthCodePrompt(oauthUrl)
365
- }}
366
- />
367
- ))
208
+ async start(): Promise<void> {
209
+ const start = this.options.startSection
210
+ if (start && this.menu.sections.some((section) => section.id === start)) {
211
+ await this.section(start)
212
+ return
213
+ }
214
+ const only =
215
+ this.menu.sections.length === 1 ? this.menu.sections[0] : undefined
216
+ if (only) {
217
+ await this.section(only.id)
218
+ return
219
+ }
220
+ await this.list()
368
221
  }
369
222
 
370
- const openAddOAuthStart = (): void => {
371
- void apply('antigravity-account', 'add-oauth-start', {
372
- timeoutMs: 120_000,
223
+ private async list(): Promise<void> {
224
+ const { ui } = this.options
225
+ const chosen = await ui.select({
226
+ title: this.menu.title,
227
+ options: sectionListOptions(this.menu),
373
228
  })
374
- .then((result) => {
375
- updateAccounts(result.knobs)
376
- const oauthUrl = result.knobs.oauthUrl
377
- if (typeof oauthUrl === 'string' && oauthUrl.length > 0) {
378
- openOAuthUrlScreen(oauthUrl)
379
- return
380
- }
381
- api.ui.toast({ message: result.text })
382
- renderMain()
383
- })
384
- .catch(() => {
385
- api.ui.toast({ message: 'OAuth account add failed' })
386
- renderMain()
387
- })
388
- }
389
-
390
- const renderManageRow = (row: CommandAccountRow): void => {
391
- const DialogSelect = api.ui.DialogSelect<string>
392
- api.ui.dialog.setSize('xlarge')
393
- api.ui.dialog.replace(() => (
394
- <box flexDirection='column' padding={1} width='100%'>
395
- <text>{row.label}</text>
396
- <text>
397
- {row.quota.length === 0
398
- ? 'no cached quota'
399
- : row.quota
400
- .map((q) =>
401
- q.remainingPercent == null
402
- ? `${q.label} –%`
403
- : `${q.label} ${q.remainingPercent}%`,
404
- )
405
- .join(', ')}
406
- </text>
407
- <box marginTop={1}>
408
- <DialogSelect
409
- title={`Manage ${row.label}`}
410
- options={[
411
- {
412
- title: row.enabled ? 'Disable account' : 'Enable account',
413
- value: `toggle ${row.index}`,
414
- description: row.enabled
415
- ? 'Skip this account in rotation when its quota is low.'
416
- : 'Include this account in rotation again.',
417
- },
418
- {
419
- title: 'Set as current',
420
- value: `current ${row.index}`,
421
- description:
422
- 'Pin this account as the active Claude + Gemini choice.',
423
- },
424
- {
425
- title: 'Remove account…',
426
- value: `__remove_prompt__ ${row.index}`,
427
- description:
428
- 'Permanently delete this account from the local pool.',
429
- },
430
- {
431
- title: 'Back',
432
- value: '__back__',
433
- description: 'Return to the account list.',
434
- },
435
- ]}
436
- onSelect={(option) => {
437
- const raw = String(option.value)
438
- if (raw === '__back__') {
439
- renderMain()
440
- return
441
- }
442
- if (raw.startsWith('__remove_prompt__ ')) {
443
- const targetIndex = Number.parseInt(raw.split(' ')[1] ?? '', 10)
444
- promptRemove(targetIndex)
445
- return
446
- }
447
- if (raw.startsWith('toggle ') || raw.startsWith('current ')) {
448
- void runApply(raw, { timeoutMs: 2_000 }).catch(() => {
449
- api.ui.toast({
450
- message: `${row.label}: action failed`,
451
- })
452
- })
453
- return
454
- }
455
- api.ui.toast({
456
- message: `${row.label}: unknown action`,
457
- })
458
- }}
459
- />
460
- </box>
461
- </box>
462
- ))
229
+ if (chosen === undefined) return
230
+ await this.section(chosen.slice('section:'.length))
463
231
  }
464
232
 
465
- const promptRemove = (index: number): void => {
466
- const DialogConfirm = api.ui.DialogConfirm
467
- const row = rowsFromKnobs()[index]
468
- api.ui.dialog.setSize('xlarge')
469
- api.ui.dialog.replace(() => (
470
- <DialogConfirm
471
- title='Remove account'
472
- message={`Permanently remove ${row?.label ?? `account ${index + 1}`} from the local pool? This cannot be undone.`}
473
- onConfirm={async () => {
474
- try {
475
- const next = await runApply(`remove ${index}`, {
476
- timeoutMs: 2_000,
477
- })
478
- if (next === null) {
479
- renderMain()
480
- }
481
- } catch {
482
- api.ui.toast({ message: 'Account remove failed' })
483
- renderMain()
484
- }
485
- }}
486
- onCancel={() => {
487
- renderMain()
488
- }}
489
- />
490
- ))
233
+ private async closeOrList(): Promise<void> {
234
+ if (this.menu.sections.length === 1) {
235
+ this.options.ui.clear()
236
+ return
237
+ }
238
+ await this.list()
491
239
  }
492
240
 
493
- const renderMain = (): void => {
494
- const DialogSelect = api.ui.DialogSelect<string>
495
- api.ui.dialog.setSize('xlarge')
496
- const rows = rowsFromKnobs()
497
- const bodyLines = rows.length
498
- ? rows.map(formatQuotaRowLine)
499
- : ['No accounts configured. Add one via the menu below.']
500
- api.ui.dialog.replace(() => (
501
- <box flexDirection='column' padding={1} width='100%'>
502
- {bodyLines.map((line) => (
503
- <text>{line}</text>
504
- ))}
505
- <box marginTop={1}>
506
- <DialogSelect
507
- title='Antigravity accounts'
508
- options={[
509
- {
510
- title: 'Add account…',
511
- value: 'add',
512
- description:
513
- 'Open the OAuth flow to add a new account (120s timeout).',
514
- },
515
- ...rows.map((row) => ({
516
- title: row.label,
517
- value: `__manage__ ${row.index}`,
518
- description: row.enabled
519
- ? row.current
520
- ? 'Current account — toggle, remove, or back.'
521
- : 'Enabled — toggle, set as current, or remove.'
522
- : 'Disabled — toggle to re-enable, or remove.',
523
- })),
524
- { title: 'Back', value: 'back' },
525
- ]}
526
- onSelect={(option) => {
527
- const raw = String(option.value)
528
- if (raw === 'back') {
529
- api.ui.dialog.clear()
530
- return
531
- }
532
- if (raw === 'add') {
533
- openAddOAuthStart()
534
- return
535
- }
536
- if (raw.startsWith('__manage__ ')) {
537
- const targetIndex = Number.parseInt(raw.split(' ')[1] ?? '', 10)
538
- const target = rows[targetIndex]
539
- if (target) renderManageRow(target)
540
- return
541
- }
542
- api.ui.toast({ message: 'Unknown action' })
543
- }}
544
- />
545
- </box>
546
- </box>
547
- ))
241
+ private async section(sectionId: string): Promise<void> {
242
+ const { ui } = this.options
243
+ const section = this.menu.sections.find((entry) => entry.id === sectionId)
244
+ if (!section) {
245
+ ui.toast('That section is no longer offered.', 'warning')
246
+ await this.list()
247
+ return
248
+ }
249
+ const chosen = await ui.select({
250
+ title: section.title,
251
+ options: sectionOptions(section),
252
+ })
253
+ // Dismissing the dialog (Escape) closes the drawer; Back goes up a level.
254
+ if (chosen === undefined) return
255
+ if (chosen === BACK) {
256
+ await this.closeOrList()
257
+ return
258
+ }
259
+ if (chosen.startsWith('item:')) {
260
+ await this.item(section.id, chosen.slice('item:'.length))
261
+ return
262
+ }
263
+ if (chosen.startsWith('action:')) {
264
+ const action = section.actions.find(
265
+ (entry) => entry.id === chosen.slice('action:'.length),
266
+ )
267
+ if (action) {
268
+ await this.run(section, undefined, action)
269
+ return
270
+ }
271
+ }
272
+ // A read-only line: redraw the same section.
273
+ await this.section(section.id)
548
274
  }
549
275
 
550
- renderMain()
551
- }
552
-
553
- /**
554
- * /antigravity-routing data-first dialog.
555
- *
556
- * The body lists the current persisted values (`cli_first`,
557
- * `quota_style_fallback`) as plain `<text>` nodes so the data is
558
- * visible without filtering the action list. The DialogSelect carries
559
- * ONLY real toggle actions — each row flips exactly one flag, awaits
560
- * apply, toasts the result, and re-renders in place from the
561
- * freshly-returned state.
562
- *
563
- * Re-render contract mirrors the quota/account dialogs: the
564
- * closed-over `payload.knobs` is mutated with the apply response and
565
- * `renderMain()` is re-invoked. The dialog stack never sees a
566
- * `clear()` between apply and re-render.
567
- *
568
- * Error path: when apply returns a `knobs.error === true` payload
569
- * (lock contention, unreadable config), the dispatcher does NOT swap
570
- * the closed-over payload — the dialog stays mounted on the previous
571
- * state so the user can retry or back out. The error message was
572
- * already toasted by `runApply`.
573
- */
574
- function renderRoutingDialog(
575
- api: TuiPluginApi,
576
- initialPayload: OpenDialogPayload,
577
- apply: ApplyFn,
578
- ): void {
579
- // Closed-over payload: every render reads from the latest snapshot.
580
- const payload: OpenDialogPayload = { ...initialPayload }
581
-
582
- const readRouting = (): { cliFirst: boolean; quotaFallback: boolean } => ({
583
- cliFirst: payload.knobs.cli_first === true,
584
- quotaFallback: payload.knobs.quota_style_fallback === true,
585
- })
586
-
587
- const runApply = async (args: string): Promise<void> => {
588
- const result = await apply('antigravity-routing', args, {
589
- timeoutMs: 2_000,
276
+ private async item(sectionId: string, itemId: string): Promise<void> {
277
+ const { ui } = this.options
278
+ const section = this.menu.sections.find((entry) => entry.id === sectionId)
279
+ const item = section?.items.find((entry) => entry.id === itemId)
280
+ if (!section || !item) {
281
+ ui.toast('That entry is no longer offered.', 'warning')
282
+ if (section) await this.section(section.id)
283
+ else await this.list()
284
+ return
285
+ }
286
+ const chosen = await ui.select({
287
+ title: `${section.title}: ${item.label}`,
288
+ options: itemOptions(item),
590
289
  })
591
- api.ui.toast({ message: result.text })
592
- if (result.knobs.error === true) {
290
+ if (chosen === undefined) return
291
+ if (chosen === BACK) {
292
+ await this.section(section.id)
593
293
  return
594
294
  }
595
- payload.knobs = {
596
- ...payload.knobs,
597
- cli_first: result.knobs.cli_first,
598
- quota_style_fallback: result.knobs.quota_style_fallback,
295
+ if (chosen.startsWith('action:')) {
296
+ const action = item.actions.find(
297
+ (entry) => entry.id === chosen.slice('action:'.length),
298
+ )
299
+ if (action) {
300
+ await this.run(section, item, action)
301
+ return
302
+ }
599
303
  }
600
- renderMain()
304
+ await this.item(section.id, item.id)
601
305
  }
602
306
 
603
- const renderMain = (): void => {
604
- const DialogSelect = api.ui.DialogSelect<string>
605
- api.ui.dialog.setSize('xlarge')
606
- const { cliFirst, quotaFallback } = readRouting()
607
- const bodyLines = [
608
- `cli_first: ${cliFirst ? 'on' : 'off'}`,
609
- `quota_style_fallback: ${quotaFallback ? 'on' : 'off'}`,
610
- ]
611
- api.ui.dialog.replace(() => (
612
- <box flexDirection='column' padding={1} width='100%'>
613
- {bodyLines.map((line) => (
614
- <text>{line}</text>
615
- ))}
616
- <box marginTop={1}>
617
- <DialogSelect
618
- title='Antigravity routing'
619
- options={[
620
- {
621
- title: `${cliFirst ? '●' : '○'} cli_first: ${cliFirst}`,
622
- value: `cli_first=${!cliFirst}`,
623
- description: cliFirst
624
- ? 'CLI is preferred before Antigravity. Click to turn off.'
625
- : 'Antigravity runs before CLI. Click to turn on.',
626
- },
627
- {
628
- title: `${quotaFallback ? '●' : '○'} quota_style_fallback: ${quotaFallback}`,
629
- value: `quota_style_fallback=${!quotaFallback}`,
630
- description: quotaFallback
631
- ? 'Falls back to the alternate quota style on exhaustion. Click to turn off.'
632
- : 'No quota-style fallback today. Click to turn on.',
633
- },
634
- { title: 'Back', value: 'back' },
635
- ]}
636
- onSelect={(option) => {
637
- const raw = String(option.value)
638
- if (raw === 'back') {
639
- api.ui.dialog.clear()
640
- return
641
- }
642
- if (
643
- !raw.startsWith('cli_first=') &&
644
- !raw.startsWith('quota_style_fallback=')
645
- ) {
646
- api.ui.toast({ message: 'Unknown routing action' })
647
- return
648
- }
649
- void runApply(raw).catch(() => {
650
- api.ui.toast({ message: 'Routing update failed' })
651
- renderMain()
652
- })
653
- }}
654
- />
655
- </box>
656
- </box>
657
- ))
307
+ /** Asks for one input; resolves undefined when the user backs out. */
308
+ private async knob(
309
+ title: string,
310
+ knob: MenuKnob,
311
+ ): Promise<KnobValue | undefined> {
312
+ const { ui } = this.options
313
+ if (knob.kind === 'choice' || knob.kind === 'toggle') {
314
+ const choices: MenuSelectOption[] =
315
+ knob.kind === 'choice'
316
+ ? knob.choices.map((choice) => ({
317
+ title: choice.label,
318
+ value: choice.value,
319
+ }))
320
+ : [
321
+ { title: 'On', value: 'on' },
322
+ { title: 'Off', value: 'off' },
323
+ ]
324
+ const chosen = await ui.select({
325
+ title: `${title}: ${knob.label}`,
326
+ current: knobDefault(knob),
327
+ options: [...choices, { title: 'Cancel', value: CANCEL }],
328
+ })
329
+ if (chosen === undefined || chosen === CANCEL) return undefined
330
+ return knob.kind === 'toggle' ? chosen === 'on' : chosen
331
+ }
332
+ const placeholder = knob.kind === 'text' ? knob.placeholder : undefined
333
+ const raw = await ui.prompt({
334
+ title: `${title}: ${knob.label}`,
335
+ ...(placeholder ? { placeholder } : {}),
336
+ value: knobDefault(knob),
337
+ })
338
+ if (raw === undefined) return undefined
339
+ return promptValue(knob, raw)
658
340
  }
659
341
 
660
- renderMain()
661
- }
662
-
663
- /**
664
- * /antigravity-killswitch data-first dialog.
665
- *
666
- * The body lists the current persisted killswitch state (`enabled`,
667
- * `minimum_remaining_percent`, and the per-account override map) as
668
- * plain `<text>` nodes. The DialogSelect carries ONLY real actions:
669
- * the global enabled toggle, the threshold-edit prompt, and a Back
670
- * affordance. The threshold edit opens a DialogPrompt for a fresh
671
- * integer in `0..100`; out-of-range input stays at the prompt without
672
- * applying.
673
- *
674
- * Re-render contract matches the routing dialog: the closed-over
675
- * `payload.knobs` is swapped to the apply response on success and
676
- * `renderMain()` re-runs. Errors leave the payload untouched.
677
- */
678
- function renderKillswitchDialog(
679
- api: TuiPluginApi,
680
- initialPayload: OpenDialogPayload,
681
- apply: ApplyFn,
682
- ): void {
683
- const payload: OpenDialogPayload = { ...initialPayload }
684
-
685
- const readKillswitch = (): {
686
- enabled: boolean
687
- minimum: number
688
- accounts: Record<string, number>
689
- } => {
690
- const enabled = payload.knobs.enabled === true
691
- const rawMin = payload.knobs.minimum_remaining_percent
692
- const minimum =
693
- typeof rawMin === 'number' && Number.isFinite(rawMin)
694
- ? Math.max(0, Math.min(100, Math.round(rawMin)))
695
- : 0
696
- const rawAccounts = payload.knobs.accounts
697
- const accounts =
698
- rawAccounts &&
699
- typeof rawAccounts === 'object' &&
700
- !Array.isArray(rawAccounts)
701
- ? (rawAccounts as Record<string, number>)
702
- : {}
703
- return { enabled, minimum, accounts }
342
+ private back(section: MenuSection, item: MenuItem | undefined) {
343
+ return item ? this.item(section.id, item.id) : this.section(section.id)
704
344
  }
705
345
 
706
- const runApply = async (args: string): Promise<void> => {
707
- const result = await apply('antigravity-killswitch', args, {
708
- timeoutMs: 2_000,
709
- })
710
- api.ui.toast({ message: result.text })
711
- if (result.knobs.error === true) {
346
+ /**
347
+ * Collects an action's inputs, confirms it when it carries a confirmation,
348
+ * applies it and redraws from the refreshed menu.
349
+ */
350
+ private async run(
351
+ section: MenuSection,
352
+ item: MenuItem | undefined,
353
+ action: MenuAction,
354
+ ): Promise<void> {
355
+ const { ui } = this.options
356
+ const values: Record<string, KnobValue> = {}
357
+ for (const knob of action.knobs) {
358
+ const value = await this.knob(action.label, knob)
359
+ if (value === undefined) {
360
+ await this.back(section, item)
361
+ return
362
+ }
363
+ values[knob.id] = value
364
+ }
365
+ let confirmed = false
366
+ if (action.confirm) {
367
+ confirmed = await ui.confirm({
368
+ title: action.label,
369
+ message: action.confirm.message,
370
+ })
371
+ if (!confirmed) {
372
+ await this.back(section, item)
373
+ return
374
+ }
375
+ }
376
+ const request: MenuApplyRequest = {
377
+ command: this.menu.command,
378
+ sectionId: section.id,
379
+ ...(item ? { itemId: item.id } : {}),
380
+ actionId: action.id,
381
+ values,
382
+ ...(confirmed ? { confirmed: true as const } : {}),
383
+ }
384
+ let result = await this.send(request)
385
+ if (!result) {
386
+ await this.back(section, item)
712
387
  return
713
388
  }
714
- payload.knobs = {
715
- ...payload.knobs,
716
- enabled: result.knobs.enabled,
717
- minimum_remaining_percent: result.knobs.minimum_remaining_percent,
718
- accounts: result.knobs.accounts ?? {},
389
+ if (result.needsConfirmation && !confirmed) {
390
+ const yes = await ui.confirm({
391
+ title: action.label,
392
+ message: result.text,
393
+ })
394
+ if (!yes) {
395
+ this.menu = result.menu
396
+ await this.section(section.id)
397
+ return
398
+ }
399
+ const again = await this.send({ ...request, confirmed: true })
400
+ if (!again) {
401
+ this.menu = result.menu
402
+ await this.back(section, item)
403
+ return
404
+ }
405
+ result = again
719
406
  }
720
- renderMain()
407
+ this.menu = result.menu
408
+ await this.finish(section.id, result)
721
409
  }
722
410
 
723
- const openThresholdPrompt = (currentMinimum: number): void => {
724
- const DialogPrompt = api.ui.DialogPrompt
725
- api.ui.dialog.setSize('xlarge')
726
- api.ui.dialog.replace(() => (
727
- <DialogPrompt
728
- title='Antigravity killswitch — set threshold'
729
- description={() => (
730
- <text>
731
- Enter a new minimum_remaining_percent (0-100). Empty input cancels.
732
- </text>
733
- )}
734
- placeholder={`${currentMinimum}`}
735
- value={`${currentMinimum}`}
736
- onConfirm={(value: string) => {
737
- const trimmed = value.trim()
738
- if (!trimmed) {
739
- renderMain()
740
- return
741
- }
742
- const parsed = Number.parseInt(trimmed, 10)
743
- if (
744
- !Number.isInteger(parsed) ||
745
- parsed < 0 ||
746
- parsed > 100 ||
747
- String(parsed) !== trimmed
748
- ) {
749
- api.ui.toast({
750
- message: 'Threshold must be an integer between 0 and 100',
751
- })
752
- openThresholdPrompt(currentMinimum)
753
- return
754
- }
755
- void runApply(`minimum_remaining_percent=${parsed}`).catch(() => {
756
- api.ui.toast({ message: 'Killswitch update failed' })
757
- renderMain()
758
- })
759
- }}
760
- onCancel={() => {
761
- renderMain()
762
- }}
763
- />
764
- ))
411
+ private async send(
412
+ request: MenuApplyRequest,
413
+ ): Promise<MenuApplyResult | undefined> {
414
+ const { ui, apply, onError } = this.options
415
+ try {
416
+ return await apply(request)
417
+ } catch (error) {
418
+ if (error instanceof MenuRefusedError) {
419
+ onError?.('menu-apply-refused', { issues: error.issues })
420
+ ui.toast(MENU_REFUSED_TEXT, 'error')
421
+ return undefined
422
+ }
423
+ onError?.('menu-apply-failed', {
424
+ error: error instanceof Error ? error.name : typeof error,
425
+ })
426
+ ui.toast('The action could not reach Antigravity auth.', 'error')
427
+ return undefined
428
+ }
765
429
  }
766
430
 
767
- const renderMain = (): void => {
768
- const DialogSelect = api.ui.DialogSelect<string>
769
- api.ui.dialog.setSize('xlarge')
770
- const { enabled, minimum, accounts } = readKillswitch()
771
- const accountKeys = Object.keys(accounts)
772
- const bodyLines = [
773
- `Killswitch: ${enabled ? 'enabled' : 'disabled'}`,
774
- `Minimum remaining percent: ${minimum}%`,
775
- ...(accountKeys.length > 0
776
- ? [
777
- 'Per-account overrides:',
778
- ...accountKeys.map((key) => ` ${key}: ${accounts[key] ?? 0}%`),
779
- ]
780
- : []),
781
- ]
782
- api.ui.dialog.replace(() => (
783
- <box flexDirection='column' padding={1} width='100%'>
784
- {bodyLines.map((line) => (
785
- <text>{line}</text>
786
- ))}
787
- <box marginTop={1}>
788
- <DialogSelect
789
- title='Antigravity killswitch'
790
- options={[
791
- {
792
- title: `${enabled ? '●' : '○'} Killswitch: ${enabled ? 'enabled' : 'disabled'}`,
793
- value: `enabled=${!enabled}`,
794
- description: enabled
795
- ? 'Drop candidates below the floor before dispatch. Click to turn off.'
796
- : 'Resume candidate selection regardless of quota. Click to turn on.',
797
- },
798
- {
799
- title: `Set minimum remaining percent (${minimum}%)`,
800
- value: '__edit_threshold__',
801
- description:
802
- 'Prompt for a new global floor (0-100). Per-account overrides are listed above.',
803
- },
804
- { title: 'Back', value: 'back' },
805
- ]}
806
- onSelect={(option) => {
807
- const raw = String(option.value)
808
- if (raw === 'back') {
809
- api.ui.dialog.clear()
810
- return
811
- }
812
- if (raw === '__edit_threshold__') {
813
- openThresholdPrompt(minimum)
814
- return
815
- }
816
- if (raw === 'enabled=true' || raw === 'enabled=false') {
817
- void runApply(raw).catch(() => {
818
- api.ui.toast({ message: 'Killswitch update failed' })
819
- renderMain()
820
- })
821
- return
822
- }
823
- api.ui.toast({ message: 'Unknown killswitch action' })
824
- }}
825
- />
826
- </box>
827
- </box>
828
- ))
431
+ /**
432
+ * Shows the apply's message and returns to the section. A long message (a
433
+ * sign-in URL, a multi-line result) is shown in full; a link in it can be
434
+ * copied when the host has a clipboard. A short one is a toast.
435
+ */
436
+ private async finish(sectionId: string, result: MenuApplyResult) {
437
+ const { ui, copy } = this.options
438
+ const kind = result.ok ? 'info' : 'warning'
439
+ const long =
440
+ result.text.includes('\n') || result.text.length > TOAST_MAX_LENGTH
441
+ const link = firstLink(result.text)
442
+ if (link && copy) {
443
+ const chosen = await ui.select({
444
+ title: result.ok ? 'Done' : 'Not done',
445
+ options: [
446
+ { title: 'Copy link', value: 'copy', description: link },
447
+ { title: 'Continue', value: 'continue', description: result.text },
448
+ ],
449
+ })
450
+ if (chosen === 'copy') {
451
+ ui.toast(
452
+ copy(link)
453
+ ? 'Link copied to the clipboard.'
454
+ : 'Copy is unavailable here; select the link to copy it.',
455
+ 'info',
456
+ )
457
+ }
458
+ } else if (long) {
459
+ await ui.alert({
460
+ title: result.ok ? 'Done' : 'Not done',
461
+ message: result.text,
462
+ })
463
+ } else {
464
+ ui.toast(result.text, kind)
465
+ }
466
+ await this.section(sectionId)
829
467
  }
830
-
831
- renderMain()
832
468
  }