@cortexkit/opencode-antigravity-auth 2.2.0 → 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 +40923 -16450
  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 -1347
  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
@@ -0,0 +1,1304 @@
1
+ import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
2
+ import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
3
+ import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
4
+ import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
5
+ import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
6
+ import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
7
+ /** @jsxImportSource @opentui/solid */
8
+
9
+ /**
10
+ * OpenCode GA adapter for the shared `/antigravity` drawer and sidebar.
11
+ *
12
+ * Everything goes through the host's native location RPC: the server plugin
13
+ * registers `antigravity-auth` (version 1) with the methods `state` and
14
+ * `apply` at its location, and this adapter calls them with the host
15
+ * client's `rpc.call`, naming the location explicitly. There is no port
16
+ * file, no PID discovery, no private HTTP port and no sidebar file here.
17
+ *
18
+ * Contract rules this client keeps (the server enforces the same ones):
19
+ *
20
+ * - Generation: the first `state` sends `generation: null`; every later call
21
+ * sends the generation the server last answered with. When the server
22
+ * answers with a different one (`reset: 'generation-changed'`) the client
23
+ * rebinds: every scope's cursor restarts at 0. An `apply` answered with
24
+ * `stale-generation` or `disposed` changed nothing; the drawer says so and
25
+ * the next `state` rebinds.
26
+ * - Scope: the current session (`{ kind: 'session', sessionID }`) or the
27
+ * sessionless scope on the home screen. Each scope has its own cursor. A
28
+ * drawer applies in the scope its menu arrived in, never the scope that
29
+ * happens to be current when the user chooses.
30
+ * - Cursor: the client sends the highest cursor it has handled; the answer
31
+ * holds the next notifications and the cursor to send next.
32
+ * - Disposal: after cleanup, or after the client rebinds, an answer to a
33
+ * request sent earlier is dropped unread, so a late completion can never
34
+ * open a dialog, show a toast or change the sidebar.
35
+ *
36
+ * Every answer is validated field by field before use; an answer that does
37
+ * not match is refused and logged by field name only.
38
+ *
39
+ * The wire shapes mirror the facade's `ga/rpc/protocol.ts` (clean v1:
40
+ * accounts carry opaque `selector`s, typed account actions name accounts
41
+ * only by selector, every snapshot carries the location's settings). GA
42
+ * notifications name a dialog command only, so this host builds the
43
+ * `/antigravity` menu from the latest snapshot and the shared drawer renders
44
+ * it; after every apply the menu is rebuilt from a fresh `state` read.
45
+ *
46
+ * Nothing here imports account storage, tokens, OAuth, the vault client or
47
+ * server code, and nothing writes to the terminal or forces a theme.
48
+ */
49
+
50
+ import { createSignal, For, Show } from "opentui:runtime-module:solid-js";
51
+ import { projectAccount, projectSidebar } from "./shared/8ae1927e5910ea81-sidebar-projection.js";
52
+ import { MenuRefusedError, openAntigravityMenu } from "./shared/0e19a88ff3535906-command-dialogs.js";
53
+ import { ANTIGRAVITY_MENU_COMMAND, ANTIGRAVITY_MENU_TITLE } from "./shared/07365a7d2ccade4c-host-api.js";
54
+ export const GA_TUI_ID = 'cortexkit.antigravity-auth';
55
+ export const GA_RPC_ID = 'antigravity-auth';
56
+ export const GA_RPC_VERSION = 1;
57
+
58
+ /** How often the TUI pulls state and notifications from its location. */
59
+ export const GA_SIDEBAR_PULL_MS = 1_000;
60
+
61
+ /** Pulls in one tick while the server reports more notifications waiting. */
62
+ const MAX_PULLS_PER_TICK = 4;
63
+
64
+ // ── Host surface (structural subset of the GA TUI context) ─────────────────
65
+
66
+ /** The parts of the GA TUI `Context` this adapter uses. */
67
+
68
+ // ── Wire shapes ─────────────────────────────────────────────────────────────
69
+
70
+ /** The dialog commands the server names in notifications and text applies. */
71
+ export const GA_COMMANDS = ['antigravity-quota', 'antigravity-account', 'antigravity-routing', 'antigravity-killswitch', 'antigravity-dump', 'antigravity-logging'];
72
+ export const GA_LOG_LEVELS = ['error', 'warn', 'info', 'debug', 'trace'];
73
+
74
+ /** A redacted account plus the opaque selector that names its credential. */
75
+
76
+ /** The location's operator settings, read fresh for every `state` answer. */
77
+
78
+ /** A typed account action; accounts are named only by selector. */
79
+
80
+ /** What the client sends besides version, generation and scope. */
81
+
82
+ /** The command result fields this TUI reads; the rest are validated only. */
83
+
84
+ const GENERATION = /^[A-Za-z0-9_-]{1,64}$/;
85
+ const SESSION_ID = /^[\x21-\x7e]{1,256}$/;
86
+ const ACCOUNT_ID = /^acct-(0|[1-9][0-9]{0,5})$/;
87
+ const ACCOUNT_LABEL = /^Account [1-9][0-9]{0,5}$/;
88
+ const SELECTOR = /^sel-[A-Za-z0-9_-]{32}$/;
89
+ const TARGET_OUTCOMES = ['applied', 'stale-target', 'unknown-target', 'unsupported-index-action', 'failed'];
90
+ function isRecord(value) {
91
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
92
+ return false;
93
+ }
94
+ const proto = Object.getPrototypeOf(value);
95
+ return proto === Object.prototype || proto === null;
96
+ }
97
+ function keys(record, required, optional, path, issues) {
98
+ for (const key of Object.keys(record)) {
99
+ if (!required.includes(key) && !optional.includes(key)) {
100
+ issues.push(`${path}.${key}: unexpected field`);
101
+ }
102
+ }
103
+ for (const key of required) {
104
+ if (!(key in record)) issues.push(`${path}.${key}: missing`);
105
+ }
106
+ }
107
+ function isCursor(value) {
108
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && !Object.is(value, -0);
109
+ }
110
+ function isTime(value) {
111
+ return typeof value === 'number' && Number.isFinite(value) && value >= 0;
112
+ }
113
+ function checkVersion(record, path, issues) {
114
+ if (record.version !== GA_RPC_VERSION) issues.push(`${path}.version: unsupported`);
115
+ }
116
+ function checkGeneration(value, path, issues) {
117
+ if (typeof value !== 'string' || !GENERATION.test(value)) {
118
+ issues.push(`${path}: expected a generation token`);
119
+ }
120
+ }
121
+ function checkScope(value, path, issues) {
122
+ if (!isRecord(value)) {
123
+ issues.push(`${path}: expected a scope`);
124
+ return;
125
+ }
126
+ if (value.kind === 'sessionless') {
127
+ keys(value, ['kind'], [], path, issues);
128
+ return;
129
+ }
130
+ if (value.kind === 'session') {
131
+ keys(value, ['kind', 'sessionID'], [], path, issues);
132
+ if (typeof value.sessionID !== 'string' || !SESSION_ID.test(value.sessionID)) {
133
+ issues.push(`${path}.sessionID: expected a session id`);
134
+ }
135
+ return;
136
+ }
137
+ issues.push(`${path}.kind: unknown scope`);
138
+ }
139
+ function checkPercent(value, path, issues) {
140
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 100) {
141
+ issues.push(`${path}: expected a percentage`);
142
+ }
143
+ }
144
+ function checkQuotaEntry(value, path, issues) {
145
+ if (value === undefined) return;
146
+ if (!isRecord(value)) {
147
+ issues.push(`${path}: expected a quota reading`);
148
+ return;
149
+ }
150
+ keys(value, ['remainingPercent'], ['resetAt', 'windows', 'checkedAt'], path, issues);
151
+ checkPercent(value.remainingPercent, `${path}.remainingPercent`, issues);
152
+ if (value.resetAt !== undefined && !isTime(value.resetAt)) {
153
+ issues.push(`${path}.resetAt: expected a time`);
154
+ }
155
+ if (value.checkedAt !== undefined && !isTime(value.checkedAt)) issues.push(`${path}.checkedAt: expected a time`);
156
+ if (value.windows === undefined) return;
157
+ if (!Array.isArray(value.windows) || value.windows.length > 4) {
158
+ issues.push(`${path}.windows: expected at most four windows`);
159
+ return;
160
+ }
161
+ value.windows.forEach((window, index) => {
162
+ const at = `${path}.windows.${index}`;
163
+ if (!isRecord(window)) {
164
+ issues.push(`${at}: expected a window`);
165
+ return;
166
+ }
167
+ keys(window, ['window', 'remainingPercent'], ['resetAt', 'checkedAt'], at, issues);
168
+ if (window.window !== 'weekly' && window.window !== '5h') {
169
+ issues.push(`${at}.window: unknown window`);
170
+ }
171
+ if (window.checkedAt !== undefined && !isTime(window.checkedAt)) issues.push(`${at}.checkedAt: expected a time`);
172
+ checkPercent(window.remainingPercent, `${at}.remainingPercent`, issues);
173
+ if (window.resetAt !== undefined && !isTime(window.resetAt)) {
174
+ issues.push(`${at}.resetAt: expected a time`);
175
+ }
176
+ });
177
+ }
178
+
179
+ /**
180
+ * One redacted account. The field list is closed: an email, token, project
181
+ * id or fingerprint arrives as an unexpected field and the whole answer is
182
+ * refused.
183
+ */
184
+ function checkAccount(value, path, issues) {
185
+ if (!isRecord(value)) {
186
+ issues.push(`${path}: expected an account`);
187
+ return;
188
+ }
189
+ keys(value, ['selector', 'id', 'label', 'enabled', 'health', 'current', 'quota'], ['cooldownUntil', 'tier'], path, issues);
190
+ if (typeof value.selector !== 'string' || !SELECTOR.test(value.selector)) {
191
+ issues.push(`${path}.selector: expected an opaque selector`);
192
+ }
193
+ if (typeof value.id !== 'string' || !ACCOUNT_ID.test(value.id)) {
194
+ issues.push(`${path}.id: expected an ordinal account id`);
195
+ }
196
+ if (typeof value.label !== 'string' || !ACCOUNT_LABEL.test(value.label)) {
197
+ issues.push(`${path}.label: expected an ordinal account label`);
198
+ }
199
+ if (typeof value.enabled !== 'boolean') issues.push(`${path}.enabled: expected true/false`);
200
+ if (typeof value.current !== 'boolean') issues.push(`${path}.current: expected true/false`);
201
+ checkPercent(value.health, `${path}.health`, issues);
202
+ if (value.cooldownUntil !== undefined && !isTime(value.cooldownUntil)) {
203
+ issues.push(`${path}.cooldownUntil: expected a time`);
204
+ }
205
+ if (!isRecord(value.quota)) {
206
+ issues.push(`${path}.quota: expected quota readings`);
207
+ } else {
208
+ keys(value.quota, [], ['gemini', 'non-gemini'], `${path}.quota`, issues);
209
+ checkQuotaEntry(value.quota.gemini, `${path}.quota.gemini`, issues);
210
+ checkQuotaEntry(value.quota['non-gemini'], `${path}.quota.non-gemini`, issues);
211
+ }
212
+ if (value.tier !== undefined) {
213
+ const tier = value.tier;
214
+ if (!isRecord(tier)) {
215
+ issues.push(`${path}.tier: expected a plan tier`);
216
+ } else {
217
+ keys(tier, ['id', 'capturedAt'], ['paidId'], `${path}.tier`, issues);
218
+ if (typeof tier.id !== 'string') issues.push(`${path}.tier.id: expected text`);
219
+ if (tier.paidId !== undefined && typeof tier.paidId !== 'string') {
220
+ issues.push(`${path}.tier.paidId: expected text`);
221
+ }
222
+ if (!isTime(tier.capturedAt)) issues.push(`${path}.tier.capturedAt: expected a time`);
223
+ }
224
+ }
225
+ }
226
+ function checkRoute(value, path, issues) {
227
+ if (value === null) return;
228
+ if (!isRecord(value)) {
229
+ issues.push(`${path}: expected a route`);
230
+ return;
231
+ }
232
+ keys(value, ['accountId', 'modelFamily', 'headerStyle', 'strategy', 'updatedAt'], [], path, issues);
233
+ if (typeof value.accountId !== 'string' || !ACCOUNT_ID.test(value.accountId)) {
234
+ issues.push(`${path}.accountId: expected an ordinal account id`);
235
+ }
236
+ if (value.modelFamily !== 'claude' && value.modelFamily !== 'gemini') {
237
+ issues.push(`${path}.modelFamily: unknown family`);
238
+ }
239
+ if (value.headerStyle !== 'antigravity' && value.headerStyle !== 'gemini-cli') {
240
+ issues.push(`${path}.headerStyle: unknown header style`);
241
+ }
242
+ if (value.strategy !== null && value.strategy !== 'sticky' && value.strategy !== 'round-robin' && value.strategy !== 'hybrid') {
243
+ issues.push(`${path}.strategy: unknown strategy`);
244
+ }
245
+ if (!isTime(value.updatedAt)) issues.push(`${path}.updatedAt: expected a time`);
246
+ }
247
+ function checkStatus(value, path, issues) {
248
+ if (!isRecord(value)) {
249
+ issues.push(`${path}: expected a status`);
250
+ return;
251
+ }
252
+ keys(value, ['checkedAt', 'quotaBackoffUntil', 'routingAuthoritative'], [], path, issues);
253
+ if (value.checkedAt !== null && !isTime(value.checkedAt)) {
254
+ issues.push(`${path}.checkedAt: expected a time or null`);
255
+ }
256
+ if (value.quotaBackoffUntil !== null && !isTime(value.quotaBackoffUntil)) {
257
+ issues.push(`${path}.quotaBackoffUntil: expected a time or null`);
258
+ }
259
+ if (typeof value.routingAuthoritative !== 'boolean') {
260
+ issues.push(`${path}.routingAuthoritative: expected true/false`);
261
+ }
262
+ }
263
+ function checkNotification(value, path, issues) {
264
+ if (!isRecord(value)) {
265
+ issues.push(`${path}: expected a notification`);
266
+ return;
267
+ }
268
+ keys(value, ['cursor', 'type', 'command', 'text'], [], path, issues);
269
+ if (!isCursor(value.cursor) || value.cursor < 1) {
270
+ issues.push(`${path}.cursor: expected a positive cursor`);
271
+ }
272
+ if (value.type !== 'open-dialog') {
273
+ issues.push(`${path}.type: unknown notification type`);
274
+ }
275
+ if (!GA_COMMANDS.includes(value.command)) {
276
+ issues.push(`${path}.command: unknown command`);
277
+ }
278
+ if (typeof value.text !== 'string') issues.push(`${path}.text: expected text`);
279
+ }
280
+ function checkBool(value, path, issues) {
281
+ if (typeof value !== 'boolean') issues.push(`${path}: expected true/false`);
282
+ }
283
+ function checkSettings(value, path, issues) {
284
+ if (!isRecord(value)) {
285
+ issues.push(`${path}: expected settings`);
286
+ return;
287
+ }
288
+ keys(value, ['routing', 'killswitch', 'logLevel', 'dump'], [], path, issues);
289
+ const {
290
+ routing,
291
+ killswitch,
292
+ dump
293
+ } = value;
294
+ if (!isRecord(routing)) issues.push(`${path}.routing: expected an object`);else {
295
+ keys(routing, ['cliFirst', 'quotaStyleFallback'], [], `${path}.routing`, issues);
296
+ checkBool(routing.cliFirst, `${path}.routing.cliFirst`, issues);
297
+ checkBool(routing.quotaStyleFallback, `${path}.routing.quotaStyleFallback`, issues);
298
+ }
299
+ if (!isRecord(killswitch)) issues.push(`${path}.killswitch: expected an object`);else {
300
+ keys(killswitch, ['enabled', 'minimumRemainingPercent'], [], `${path}.killswitch`, issues);
301
+ checkBool(killswitch.enabled, `${path}.killswitch.enabled`, issues);
302
+ checkPercent(killswitch.minimumRemainingPercent, `${path}.killswitch.minimumRemainingPercent`, issues);
303
+ }
304
+ if (!GA_LOG_LEVELS.includes(value.logLevel)) {
305
+ issues.push(`${path}.logLevel: unknown level`);
306
+ }
307
+ if (!isRecord(dump)) issues.push(`${path}.dump: expected an object`);else {
308
+ keys(dump, ['enabled'], [], `${path}.dump`, issues);
309
+ checkBool(dump.enabled, `${path}.dump.enabled`, issues);
310
+ }
311
+ }
312
+ function checkAccountsStatus(value, path, issues) {
313
+ if (!isRecord(value)) {
314
+ issues.push(`${path}: expected an accounts status`);
315
+ return;
316
+ }
317
+ if (value.kind === 'complete') {
318
+ keys(value, ['kind'], [], path, issues);
319
+ return;
320
+ }
321
+ if (value.kind === 'over-limit') {
322
+ keys(value, ['kind', 'count', 'limit'], [], path, issues);
323
+ if (!isCursor(value.count)) issues.push(`${path}.count: expected a count`);
324
+ if (value.limit !== 64) issues.push(`${path}.limit: unexpected limit`);
325
+ return;
326
+ }
327
+ issues.push(`${path}.kind: unknown accounts status`);
328
+ }
329
+ function checkAccountList(value, path, issues) {
330
+ if (value === null) return;
331
+ if (!Array.isArray(value) || value.length > 64) {
332
+ issues.push(`${path}: expected at most 64 accounts`);
333
+ return;
334
+ }
335
+ value.forEach((entry, index) => {
336
+ checkAccount(entry, `${path}.${index}`, issues);
337
+ });
338
+ }
339
+
340
+ /** One command result, with the closed field list of its command. */
341
+ function checkCommandResult(value, path, issues) {
342
+ if (!isRecord(value)) {
343
+ issues.push(`${path}: expected a command result`);
344
+ return;
345
+ }
346
+ const base = ['command', 'status', 'text'];
347
+ if (value.status !== 'applied' && value.status !== 'rejected' && value.status !== 'failed') {
348
+ issues.push(`${path}.status: unknown status`);
349
+ }
350
+ if (typeof value.text !== 'string') issues.push(`${path}.text: expected text`);
351
+ switch (value.command) {
352
+ case 'antigravity-quota':
353
+ keys(value, [...base, 'accounts'], [], path, issues);
354
+ checkAccountList(value.accounts, `${path}.accounts`, issues);
355
+ return;
356
+ case 'antigravity-account':
357
+ keys(value, [...base, 'accounts', 'authorizationUrl', 'targetOutcome'], [], path, issues);
358
+ checkAccountList(value.accounts, `${path}.accounts`, issues);
359
+ if (value.authorizationUrl !== null && !(typeof value.authorizationUrl === 'string' && /^https:\/\//.test(value.authorizationUrl) && value.authorizationUrl.length <= 4096)) {
360
+ issues.push(`${path}.authorizationUrl: expected an https link or null`);
361
+ }
362
+ if (value.targetOutcome !== null && !TARGET_OUTCOMES.includes(value.targetOutcome)) {
363
+ issues.push(`${path}.targetOutcome: unknown outcome`);
364
+ }
365
+ return;
366
+ case 'antigravity-routing':
367
+ keys(value, [...base, 'routing'], [], path, issues);
368
+ return;
369
+ case 'antigravity-killswitch':
370
+ keys(value, [...base, 'killswitch'], [], path, issues);
371
+ return;
372
+ case 'antigravity-dump':
373
+ keys(value, [...base, 'dump'], [], path, issues);
374
+ return;
375
+ case 'antigravity-logging':
376
+ keys(value, [...base, 'logLevel'], [], path, issues);
377
+ return;
378
+ default:
379
+ issues.push(`${path}.command: unknown command`);
380
+ }
381
+ }
382
+
383
+ /** Unwraps the host's `{ output }` answer. */
384
+ function unwrap(raw, issues) {
385
+ if (!isRecord(raw)) {
386
+ issues.push('answer: expected an object');
387
+ return undefined;
388
+ }
389
+ keys(raw, ['output'], [], 'answer', issues);
390
+ return raw.output;
391
+ }
392
+ function finish(value, issues) {
393
+ return issues.length === 0 ? {
394
+ ok: true,
395
+ value: value
396
+ } : {
397
+ ok: false,
398
+ issues
399
+ };
400
+ }
401
+
402
+ /** Validates a `state` answer (the host's `{ output }` wrapper included). */
403
+ export function parseGaStateAnswer(raw) {
404
+ const issues = [];
405
+ const output = unwrap(raw, issues);
406
+ if (issues.length > 0) return {
407
+ ok: false,
408
+ issues
409
+ };
410
+ if (!isRecord(output)) return {
411
+ ok: false,
412
+ issues: ['output: expected an object']
413
+ };
414
+ checkVersion(output, 'output', issues);
415
+ if (output.kind === 'disposed') {
416
+ keys(output, ['version', 'kind', 'generation'], [], 'output', issues);
417
+ checkGeneration(output.generation, 'output.generation', issues);
418
+ return finish(output, issues);
419
+ }
420
+ if (output.kind !== 'snapshot') {
421
+ return {
422
+ ok: false,
423
+ issues: ['output.kind: unknown answer']
424
+ };
425
+ }
426
+ keys(output, ['version', 'kind', 'generation', 'scope', 'reset', 'cursor', 'dropped', 'more', 'notifications', 'readSeq', 'accountsStatus', 'accounts', 'route', 'status', 'settings'], [], 'output', issues);
427
+ if (!isCursor(output.readSeq)) issues.push('output.readSeq: expected a count');
428
+ checkAccountsStatus(output.accountsStatus, 'output.accountsStatus', issues);
429
+ checkSettings(output.settings, 'output.settings', issues);
430
+ checkGeneration(output.generation, 'output.generation', issues);
431
+ checkScope(output.scope, 'output.scope', issues);
432
+ if (output.reset !== null && output.reset !== 'initial' && output.reset !== 'generation-changed' && output.reset !== 'cursor-ahead') {
433
+ issues.push('output.reset: unknown reset');
434
+ }
435
+ if (!isCursor(output.cursor)) issues.push('output.cursor: expected a cursor');
436
+ if (!isCursor(output.dropped)) issues.push('output.dropped: expected a count');
437
+ if (typeof output.more !== 'boolean') issues.push('output.more: expected true/false');
438
+ if (!Array.isArray(output.notifications) || output.notifications.length > 32) {
439
+ issues.push('output.notifications: expected at most 32 notifications');
440
+ } else {
441
+ output.notifications.forEach((entry, index) => {
442
+ checkNotification(entry, `output.notifications.${index}`, issues);
443
+ });
444
+ }
445
+ if (!Array.isArray(output.accounts) || output.accounts.length > 64) {
446
+ issues.push('output.accounts: expected at most 64 accounts');
447
+ } else {
448
+ output.accounts.forEach((entry, index) => {
449
+ checkAccount(entry, `output.accounts.${index}`, issues);
450
+ });
451
+ }
452
+ checkRoute(output.route, 'output.route', issues);
453
+ checkStatus(output.status, 'output.status', issues);
454
+ return finish(output, issues);
455
+ }
456
+
457
+ /** Validates an `apply` answer (the host's `{ output }` wrapper included). */
458
+ export function parseGaApplyAnswer(raw) {
459
+ const issues = [];
460
+ const output = unwrap(raw, issues);
461
+ if (issues.length > 0) return {
462
+ ok: false,
463
+ issues
464
+ };
465
+ if (!isRecord(output)) return {
466
+ ok: false,
467
+ issues: ['output: expected an object']
468
+ };
469
+ checkVersion(output, 'output', issues);
470
+ if (output.kind === 'stale-generation' || output.kind === 'disposed') {
471
+ keys(output, ['version', 'kind', 'generation'], [], 'output', issues);
472
+ checkGeneration(output.generation, 'output.generation', issues);
473
+ return finish(output, issues);
474
+ }
475
+ if (output.kind !== 'applied') {
476
+ return {
477
+ ok: false,
478
+ issues: ['output.kind: unknown answer']
479
+ };
480
+ }
481
+ keys(output, ['version', 'kind', 'generation', 'scope', 'result'], [], 'output', issues);
482
+ checkGeneration(output.generation, 'output.generation', issues);
483
+ checkScope(output.scope, 'output.scope', issues);
484
+ checkCommandResult(output.result, 'output.result', issues);
485
+ return finish(output, issues);
486
+ }
487
+
488
+ // ── Location client ─────────────────────────────────────────────────────────
489
+
490
+ /** The server restarted or was disposed; the action did nothing. */
491
+ export class GaStaleError extends Error {
492
+ constructor(reason) {
493
+ super(reason === 'not-bound' ? 'Antigravity auth is not connected at this location yet.' : 'Antigravity auth restarted; nothing was changed. Reopen /antigravity.');
494
+ this.reason = reason;
495
+ this.name = 'GaStaleError';
496
+ }
497
+ }
498
+
499
+ /** This client was disposed; its answers are no longer read. */
500
+ export class GaClientDisposedError extends Error {
501
+ constructor() {
502
+ super('Antigravity TUI client disposed');
503
+ this.name = 'GaClientDisposedError';
504
+ }
505
+ }
506
+ export function scopeKey(scope) {
507
+ return scope.kind === 'session' ? `session:${scope.sessionID}` : 'sessionless';
508
+ }
509
+ export function createGaLocationClient(options) {
510
+ let generation = null;
511
+ const cursors = new Map();
512
+ let isDisposed = false;
513
+ // Bumped on every rebind and on disposal. A request remembers the epoch
514
+ // it was sent in; an answer from an older epoch is dropped unread.
515
+ let epoch = 0;
516
+ const call = (method, input) => options.call({
517
+ rpcID: GA_RPC_ID,
518
+ method,
519
+ ...(options.location ? {
520
+ location: options.location
521
+ } : {}),
522
+ input
523
+ });
524
+ const rebind = next => {
525
+ if (next === generation) return;
526
+ generation = next;
527
+ cursors.clear();
528
+ epoch += 1;
529
+ };
530
+
531
+ // State pulls run one at a time, so two pulls can never send the same
532
+ // cursor and hand the same notification over twice.
533
+ let pullChain = Promise.resolve();
534
+ const pullNow = async scope => {
535
+ if (isDisposed) throw new GaClientDisposedError();
536
+ const sentEpoch = epoch;
537
+ const key = scopeKey(scope);
538
+ const raw = await call('state', {
539
+ version: GA_RPC_VERSION,
540
+ generation,
541
+ scope,
542
+ cursor: cursors.get(key) ?? 0
543
+ });
544
+ if (isDisposed || sentEpoch !== epoch) return {
545
+ kind: 'dropped'
546
+ };
547
+ const parsed = parseGaStateAnswer(raw);
548
+ if (!parsed.ok) {
549
+ options.logger?.warn('ga-state-refused', {
550
+ issues: parsed.issues
551
+ });
552
+ throw new MenuRefusedError(parsed.issues);
553
+ }
554
+ const output = parsed.value;
555
+ if (output.kind === 'disposed') {
556
+ // The activation we were bound to is gone; the next pull binds to
557
+ // whichever one the location runs now.
558
+ rebind(null);
559
+ return {
560
+ kind: 'server-disposed'
561
+ };
562
+ }
563
+ if (scopeKey(output.scope) !== key) {
564
+ options.logger?.warn('ga-state-scope-mismatch', {});
565
+ throw new MenuRefusedError(['output.scope: not the requested scope']);
566
+ }
567
+ if (output.generation !== generation) {
568
+ rebind(output.generation);
569
+ }
570
+ cursors.set(key, output.cursor);
571
+ return {
572
+ kind: 'snapshot',
573
+ snapshot: output
574
+ };
575
+ };
576
+ return {
577
+ generation: () => generation,
578
+ cursor: scope => cursors.get(scopeKey(scope)) ?? 0,
579
+ disposed: () => isDisposed,
580
+ dispose() {
581
+ isDisposed = true;
582
+ epoch += 1;
583
+ },
584
+ pull(scope) {
585
+ const run = pullChain.then(() => pullNow(scope));
586
+ pullChain = run.catch(() => undefined);
587
+ return run;
588
+ },
589
+ async apply(scope, body) {
590
+ if (isDisposed) throw new GaClientDisposedError();
591
+ const bound = generation;
592
+ if (bound === null) throw new GaStaleError('not-bound');
593
+ const sentEpoch = epoch;
594
+ const raw = await call('apply', {
595
+ version: GA_RPC_VERSION,
596
+ generation: bound,
597
+ scope,
598
+ ...body
599
+ });
600
+ if (isDisposed) throw new GaClientDisposedError();
601
+ const parsed = parseGaApplyAnswer(raw);
602
+ if (!parsed.ok) {
603
+ options.logger?.warn('ga-apply-refused', {
604
+ issues: parsed.issues
605
+ });
606
+ throw new MenuRefusedError(parsed.issues);
607
+ }
608
+ const output = parsed.value;
609
+ if (output.kind === 'stale-generation' || output.kind === 'disposed') {
610
+ if (sentEpoch === epoch) rebind(null);
611
+ throw new GaStaleError(output.kind);
612
+ }
613
+ if (output.generation !== bound || scopeKey(output.scope) !== scopeKey(scope)) {
614
+ throw new MenuRefusedError(['output: answered for another activation or scope']);
615
+ }
616
+ return output.result;
617
+ }
618
+ };
619
+ }
620
+
621
+ // ── Menu over the native state ──────────────────────────────────────────────
622
+
623
+ /**
624
+ * GA notifications name only a dialog command, so this host builds the
625
+ * `/antigravity` menu itself from the latest `state` answer: the accounts
626
+ * with their opaque selectors and the location's settings, both read fresh
627
+ * for that answer. The shared drawer renders it like the OpenCode 1 menu.
628
+ * Each item and action id encodes what the action sends; an account is named
629
+ * only by its selector, never by position or `acct-<n>` id.
630
+ */
631
+ const SECTION_FOR_COMMAND = {
632
+ 'antigravity-account': 'accounts',
633
+ 'antigravity-quota': 'quota',
634
+ 'antigravity-routing': 'routing',
635
+ 'antigravity-killswitch': 'limits',
636
+ 'antigravity-dump': 'diagnostics',
637
+ 'antigravity-logging': 'diagnostics'
638
+ };
639
+ export function sectionForCommand(command) {
640
+ return SECTION_FOR_COMMAND[command];
641
+ }
642
+ const ACCOUNT_ITEM_PREFIX = 'account:';
643
+ function onOff(value) {
644
+ return value ? 'on' : 'off';
645
+ }
646
+ function quotaLine(account, now) {
647
+ const projected = projectSidebar({
648
+ accounts: [account],
649
+ route: null,
650
+ status: {
651
+ checkedAt: 0,
652
+ quotaBackoffUntil: null
653
+ },
654
+ now
655
+ }).accounts[0];
656
+ const pools = (projected?.quota ?? []).map(row => `${row.label} ${row.figure}${row.reset ? ` · ${row.reset}` : ''}`).join(' · ');
657
+ return `${account.label}: ${pools}`;
658
+ }
659
+ export function buildGaMenu(snapshot, now) {
660
+ const {
661
+ settings
662
+ } = snapshot;
663
+ const overLimit = snapshot.accountsStatus.kind === 'over-limit';
664
+ const accountLines = overLimit ? [`${snapshot.accountsStatus.kind === 'over-limit' ? snapshot.accountsStatus.count : 0} accounts; more than this view can list. Manage them from the command line.`] : [snapshot.accounts.length === 0 ? 'No accounts yet.' : `${snapshot.accounts.length} account${snapshot.accounts.length === 1 ? '' : 's'}`];
665
+ const sections = [{
666
+ id: 'accounts',
667
+ slot: 'accounts',
668
+ title: 'Accounts',
669
+ lines: accountLines,
670
+ items: snapshot.accounts.map(account => {
671
+ const projected = projectAccount(account, now);
672
+ const use = (id, label, description) => ({
673
+ id,
674
+ label,
675
+ description,
676
+ knobs: []
677
+ });
678
+ return {
679
+ id: `${ACCOUNT_ITEM_PREFIX}${account.selector}`,
680
+ label: account.label,
681
+ detail: `${projected.status} · ${projected.health}`,
682
+ actions: [account.enabled ? use('disable', 'Disable', 'Stop routing requests to this account.') : use('enable', 'Enable', 'Route requests to this account again.'), use('select-active', 'Use for all models', 'Make this the current account.'), use('select-claude', 'Use for Claude', 'Make this the current Claude account.'), use('select-gemini', 'Use for Gemini', 'Make this the current Gemini account.'), {
683
+ id: 'remove',
684
+ label: 'Remove',
685
+ description: 'Delete this account from this machine.',
686
+ knobs: [],
687
+ confirm: {
688
+ message: `Remove ${account.label}? This cannot be undone.`,
689
+ irreversible: true
690
+ }
691
+ }]
692
+ };
693
+ }),
694
+ actions: [{
695
+ id: 'add',
696
+ label: 'Add account',
697
+ description: 'Sign in with Google in your browser.',
698
+ knobs: []
699
+ }]
700
+ }, {
701
+ id: 'quota',
702
+ slot: 'quota',
703
+ title: 'Quota',
704
+ lines: overLimit ? ['Quota is not listed while the account list is over the limit.'] : snapshot.accounts.length === 0 ? ['No accounts yet.'] : snapshot.accounts.map(account => quotaLine(account, now)),
705
+ items: [],
706
+ actions: [{
707
+ id: 'refresh',
708
+ label: 'Check quota now',
709
+ description: 'Ask Google for every account’s current quota.',
710
+ knobs: []
711
+ }]
712
+ }, {
713
+ id: 'routing',
714
+ slot: 'routing',
715
+ title: 'Routing',
716
+ lines: [`Gemini CLI first: ${onOff(settings.routing.cliFirst)}`, `Quota-style fallback: ${onOff(settings.routing.quotaStyleFallback)}`],
717
+ items: [],
718
+ actions: [{
719
+ id: settings.routing.cliFirst ? 'cli-first-off' : 'cli-first-on',
720
+ label: `Turn Gemini CLI first ${settings.routing.cliFirst ? 'off' : 'on'}`,
721
+ knobs: []
722
+ }, {
723
+ id: settings.routing.quotaStyleFallback ? 'quota-fallback-off' : 'quota-fallback-on',
724
+ label: `Turn quota-style fallback ${settings.routing.quotaStyleFallback ? 'off' : 'on'}`,
725
+ knobs: []
726
+ }]
727
+ }, {
728
+ id: 'limits',
729
+ slot: 'limits',
730
+ title: 'Limits',
731
+ lines: [`Killswitch: ${onOff(settings.killswitch.enabled)}`, `Minimum remaining quota: ${settings.killswitch.minimumRemainingPercent}%`],
732
+ items: [],
733
+ actions: [{
734
+ id: settings.killswitch.enabled ? 'killswitch-off' : 'killswitch-on',
735
+ label: `Turn killswitch ${settings.killswitch.enabled ? 'off' : 'on'}`,
736
+ description: 'Skip accounts whose quota is below the minimum.',
737
+ knobs: []
738
+ }, {
739
+ id: 'killswitch-minimum',
740
+ label: 'Set minimum remaining quota',
741
+ knobs: [{
742
+ kind: 'number',
743
+ id: 'percent',
744
+ label: 'Percent (0-100)',
745
+ value: settings.killswitch.minimumRemainingPercent,
746
+ min: 0,
747
+ max: 100,
748
+ required: true
749
+ }]
750
+ }]
751
+ }, {
752
+ id: 'diagnostics',
753
+ slot: 'diagnostics',
754
+ title: 'Diagnostics',
755
+ lines: [`Logging: ${settings.logLevel}`, `Wire dump: ${onOff(settings.dump.enabled)}`],
756
+ items: [],
757
+ actions: [{
758
+ id: 'log-level',
759
+ label: 'Set log level',
760
+ knobs: [{
761
+ kind: 'choice',
762
+ id: 'level',
763
+ label: 'Level',
764
+ value: settings.logLevel,
765
+ choices: GA_LOG_LEVELS.map(level => ({
766
+ value: level,
767
+ label: level
768
+ }))
769
+ }]
770
+ }, {
771
+ id: settings.dump.enabled ? 'dump-off' : 'dump-on',
772
+ label: `Turn wire dump ${settings.dump.enabled ? 'off' : 'on'}`,
773
+ description: 'Write request and response bodies to the dump folder.',
774
+ knobs: []
775
+ }]
776
+ }];
777
+ return {
778
+ command: ANTIGRAVITY_MENU_COMMAND,
779
+ title: ANTIGRAVITY_MENU_TITLE,
780
+ sections
781
+ };
782
+ }
783
+
784
+ /** Why a drawer choice could not be turned into a native apply. */
785
+ export class GaMenuChoiceError extends Error {
786
+ constructor(message) {
787
+ super(message);
788
+ this.name = 'GaMenuChoiceError';
789
+ }
790
+ }
791
+ const TEXT_ACTIONS = {
792
+ 'accounts/add': {
793
+ command: 'antigravity-account',
794
+ arguments: 'add-oauth-start'
795
+ },
796
+ 'quota/refresh': {
797
+ command: 'antigravity-quota',
798
+ arguments: 'refresh'
799
+ },
800
+ 'routing/cli-first-on': {
801
+ command: 'antigravity-routing',
802
+ arguments: 'cli_first=true'
803
+ },
804
+ 'routing/cli-first-off': {
805
+ command: 'antigravity-routing',
806
+ arguments: 'cli_first=false'
807
+ },
808
+ 'routing/quota-fallback-on': {
809
+ command: 'antigravity-routing',
810
+ arguments: 'quota_style_fallback=true'
811
+ },
812
+ 'routing/quota-fallback-off': {
813
+ command: 'antigravity-routing',
814
+ arguments: 'quota_style_fallback=false'
815
+ },
816
+ 'limits/killswitch-on': {
817
+ command: 'antigravity-killswitch',
818
+ arguments: 'enabled=true'
819
+ },
820
+ 'limits/killswitch-off': {
821
+ command: 'antigravity-killswitch',
822
+ arguments: 'enabled=false'
823
+ },
824
+ 'diagnostics/dump-on': {
825
+ command: 'antigravity-dump',
826
+ arguments: 'on'
827
+ },
828
+ 'diagnostics/dump-off': {
829
+ command: 'antigravity-dump',
830
+ arguments: 'off'
831
+ }
832
+ };
833
+
834
+ /**
835
+ * The native apply for one drawer choice. Explicit target values are sent
836
+ * ("turn on"), never a toggle, so a repeated or late choice cannot flip a
837
+ * setting back. An account item sends its selector exactly as the server
838
+ * issued it; a malformed one is refused here rather than guessed at.
839
+ */
840
+ export function gaApplyBody(request) {
841
+ const key = `${request.sectionId}/${request.actionId}`;
842
+ if (request.sectionId === 'accounts' && request.itemId !== undefined) {
843
+ if (!request.itemId.startsWith(ACCOUNT_ITEM_PREFIX)) {
844
+ throw new GaMenuChoiceError('That account entry is not valid.');
845
+ }
846
+ const selector = request.itemId.slice(ACCOUNT_ITEM_PREFIX.length);
847
+ if (!SELECTOR.test(selector)) {
848
+ throw new GaMenuChoiceError('That account entry is not valid.');
849
+ }
850
+ const action = request.actionId === 'enable' ? {
851
+ kind: 'enable',
852
+ selector
853
+ } : request.actionId === 'disable' ? {
854
+ kind: 'disable',
855
+ selector
856
+ } : request.actionId === 'remove' ? {
857
+ kind: 'remove',
858
+ selector
859
+ } : request.actionId === 'select-active' ? {
860
+ kind: 'select',
861
+ selector,
862
+ target: 'active'
863
+ } : request.actionId === 'select-claude' ? {
864
+ kind: 'select',
865
+ selector,
866
+ target: 'claude'
867
+ } : request.actionId === 'select-gemini' ? {
868
+ kind: 'select',
869
+ selector,
870
+ target: 'gemini'
871
+ } : undefined;
872
+ if (!action) throw new GaMenuChoiceError('Unknown account action.');
873
+ if (action.kind === 'remove' && request.confirmed !== true) {
874
+ throw new GaMenuChoiceError('Removing an account needs a confirmation.');
875
+ }
876
+ return {
877
+ command: 'antigravity-account',
878
+ action
879
+ };
880
+ }
881
+ if (request.itemId !== undefined) {
882
+ throw new GaMenuChoiceError('Unknown menu entry.');
883
+ }
884
+ const fixed = TEXT_ACTIONS[key];
885
+ if (fixed) return fixed;
886
+ if (key === 'limits/killswitch-minimum') {
887
+ const percent = request.values.percent;
888
+ if (typeof percent !== 'number' || !Number.isInteger(percent) || percent < 0 || percent > 100) {
889
+ throw new GaMenuChoiceError('The minimum must be a whole number from 0 to 100.');
890
+ }
891
+ return {
892
+ command: 'antigravity-killswitch',
893
+ arguments: `minimum_remaining_percent=${percent}`
894
+ };
895
+ }
896
+ if (key === 'diagnostics/log-level') {
897
+ const level = request.values.level;
898
+ if (!GA_LOG_LEVELS.includes(level)) {
899
+ throw new GaMenuChoiceError('Unknown log level.');
900
+ }
901
+ return {
902
+ command: 'antigravity-logging',
903
+ arguments: String(level)
904
+ };
905
+ }
906
+ throw new GaMenuChoiceError('Unknown menu action.');
907
+ }
908
+ const TARGET_TEXT = {
909
+ 'stale-target': 'That account changed since the list was shown; nothing was changed. Choose it again from the refreshed list.',
910
+ 'unknown-target': 'That account is no longer known; nothing was changed. Choose it again from the refreshed list.',
911
+ 'unsupported-index-action': 'Accounts can only be chosen from the list; nothing was changed.',
912
+ failed: 'The account action did not complete.'
913
+ };
914
+
915
+ /**
916
+ * Turns a native command result into the drawer's result. `ok` is true only
917
+ * when the command applied and, for an account action, its target applied.
918
+ * A sign-in link is shown in full: on GA the browser returns to this
919
+ * machine's sign-in listener, so there is nothing to paste.
920
+ */
921
+ export function gaMenuResult(result, menu) {
922
+ const outcome = result.targetOutcome ?? null;
923
+ const ok = result.status === 'applied' && (outcome === null || outcome === 'applied');
924
+ let text = result.text;
925
+ if (outcome !== null && outcome !== 'applied') {
926
+ text = `${TARGET_TEXT[outcome]}`;
927
+ }
928
+ if (result.authorizationUrl) {
929
+ text = `Open ${result.authorizationUrl} in your browser and sign in.\nThe account is added when the browser returns here; there is nothing to paste.`;
930
+ }
931
+ return {
932
+ command: ANTIGRAVITY_MENU_COMMAND,
933
+ ok,
934
+ text,
935
+ ...(ok ? {} : {
936
+ code: outcome ?? result.status
937
+ }),
938
+ menu
939
+ };
940
+ }
941
+
942
+ // ── Dialogs ─────────────────────────────────────────────────────────────────
943
+
944
+ /**
945
+ * `MenuUi` over the GA dialog API. After `isActive()` turns false every call
946
+ * is inert: a select resolves as dismissed and nothing is shown.
947
+ */
948
+ export function createGaMenuUi(context, isActive) {
949
+ const {
950
+ dialog,
951
+ toast
952
+ } = context.ui;
953
+ return {
954
+ async select(input) {
955
+ if (!isActive()) return undefined;
956
+ dialog.set({
957
+ size: 'xlarge'
958
+ });
959
+ const chosen = await dialog.select({
960
+ title: input.title,
961
+ options: input.options.map(option => ({
962
+ ...option
963
+ })),
964
+ ...(input.current === undefined ? {} : {
965
+ current: input.current
966
+ })
967
+ });
968
+ return isActive() ? chosen : undefined;
969
+ },
970
+ async prompt(input) {
971
+ if (!isActive()) return undefined;
972
+ dialog.set({
973
+ size: 'xlarge'
974
+ });
975
+ const value = await dialog.prompt({
976
+ ...input
977
+ });
978
+ return isActive() ? value : undefined;
979
+ },
980
+ async confirm(input) {
981
+ if (!isActive()) return false;
982
+ const yes = await dialog.confirm({
983
+ ...input
984
+ });
985
+ return isActive() && yes === true;
986
+ },
987
+ async alert(input) {
988
+ if (!isActive()) return;
989
+ await dialog.alert({
990
+ ...input
991
+ });
992
+ },
993
+ toast(message, kind = 'info') {
994
+ if (isActive()) toast.show({
995
+ message,
996
+ variant: kind
997
+ });
998
+ },
999
+ clear() {
1000
+ if (isActive()) dialog.clear();
1001
+ }
1002
+ };
1003
+ }
1004
+
1005
+ // ── Poller ──────────────────────────────────────────────────────────────────
1006
+
1007
+ export function currentScope(route) {
1008
+ return route.type === 'session' ? {
1009
+ kind: 'session',
1010
+ sessionID: route.sessionID
1011
+ } : {
1012
+ kind: 'sessionless'
1013
+ };
1014
+ }
1015
+ /**
1016
+ * One poll tick: pull the current scope, hand every new notification over in
1017
+ * cursor order, and keep pulling (bounded) while the server says more are
1018
+ * waiting. Never throws; a failed pull is logged and the next tick retries.
1019
+ */
1020
+ export async function pollGaOnce(options) {
1021
+ const scope = options.scope();
1022
+ for (let pulls = 0; pulls < MAX_PULLS_PER_TICK; pulls += 1) {
1023
+ let result;
1024
+ try {
1025
+ result = await options.client.pull(scope);
1026
+ } catch (error) {
1027
+ if (!(error instanceof GaClientDisposedError)) {
1028
+ options.logger?.warn('ga-pull-failed', {
1029
+ error: error instanceof Error ? error.name : typeof error
1030
+ });
1031
+ }
1032
+ return;
1033
+ }
1034
+ if (result.kind !== 'snapshot') return;
1035
+ const {
1036
+ snapshot
1037
+ } = result;
1038
+ options.onSnapshot(snapshot);
1039
+ for (const notification of [...snapshot.notifications].sort((a, b) => a.cursor - b.cursor)) {
1040
+ if (options.client.disposed()) return;
1041
+ options.onNotification(notification, snapshot.scope);
1042
+ }
1043
+ if (!snapshot.more) return;
1044
+ }
1045
+ }
1046
+
1047
+ // ── Sidebar ─────────────────────────────────────────────────────────────────
1048
+
1049
+ function GaSidebar(props) {
1050
+ // The route line belongs to one session; show it only in that session's
1051
+ // sidebar, never another session's.
1052
+ const route = () => {
1053
+ const view = props.view();
1054
+ if (view === undefined || view.scope.kind !== 'session') return null;
1055
+ return view.scope.sessionID === props.sessionID ? view.projected.route : null;
1056
+ };
1057
+ return (() => {
1058
+ var _el$ = _$createElement("box"),
1059
+ _el$2 = _$createElement("text"),
1060
+ _el$3 = _$createElement("b");
1061
+ _$insertNode(_el$, _el$2);
1062
+ _$setProp(_el$, "flexDirection", 'column');
1063
+ _$setProp(_el$, "width", '100%');
1064
+ _$insertNode(_el$2, _el$3);
1065
+ _$insertNode(_el$3, _$createTextNode(`Antigravity`));
1066
+ _$insert(_el$, _$createComponent(Show, {
1067
+ get when() {
1068
+ return props.view();
1069
+ },
1070
+ get fallback() {
1071
+ return (() => {
1072
+ var _el$5 = _$createElement("text");
1073
+ _$insertNode(_el$5, _$createTextNode(`connecting…`));
1074
+ return _el$5;
1075
+ })();
1076
+ },
1077
+ children: view => [_$createComponent(For, {
1078
+ get each() {
1079
+ return view().projected.accounts;
1080
+ },
1081
+ children: account => (() => {
1082
+ var _el$7 = _$createElement("box"),
1083
+ _el$8 = _$createElement("box"),
1084
+ _el$9 = _$createElement("text"),
1085
+ _el$0 = _$createElement("text"),
1086
+ _el$1 = _$createElement("text");
1087
+ _$insertNode(_el$7, _el$8);
1088
+ _$insertNode(_el$7, _el$1);
1089
+ _$setProp(_el$7, "flexDirection", 'column');
1090
+ _$setProp(_el$7, "width", '100%');
1091
+ _$insertNode(_el$8, _el$9);
1092
+ _$insertNode(_el$8, _el$0);
1093
+ _$setProp(_el$8, "flexDirection", 'row');
1094
+ _$setProp(_el$8, "justifyContent", 'space-between');
1095
+ _$setProp(_el$8, "width", '100%');
1096
+ _$insert(_el$9, () => account.label);
1097
+ _$insert(_el$0, () => account.status);
1098
+ _$insert(_el$7, _$createComponent(For, {
1099
+ get each() {
1100
+ return account.quota;
1101
+ },
1102
+ children: row => (() => {
1103
+ var _el$10 = _$createElement("box"),
1104
+ _el$11 = _$createElement("text"),
1105
+ _el$12 = _$createElement("text");
1106
+ _$insertNode(_el$10, _el$11);
1107
+ _$insertNode(_el$10, _el$12);
1108
+ _$setProp(_el$10, "flexDirection", 'row');
1109
+ _$setProp(_el$10, "justifyContent", 'space-between');
1110
+ _$setProp(_el$10, "width", '100%');
1111
+ _$insert(_el$11, () => `${row.label.padEnd(6)}${row.figure}`);
1112
+ _$insert(_el$12, () => row.reset);
1113
+ return _el$10;
1114
+ })()
1115
+ }), _el$1);
1116
+ _$insert(_el$1, () => ` ${account.health}`);
1117
+ return _el$7;
1118
+ })()
1119
+ }), _$createComponent(Show, {
1120
+ get when() {
1121
+ return route();
1122
+ },
1123
+ children: line => (() => {
1124
+ var _el$13 = _$createElement("text");
1125
+ _$insert(_el$13, () => `Route ${line()}`);
1126
+ return _el$13;
1127
+ })()
1128
+ }), _$createComponent(For, {
1129
+ get each() {
1130
+ return view().projected.notices;
1131
+ },
1132
+ children: notice => (() => {
1133
+ var _el$14 = _$createElement("text");
1134
+ _$insert(_el$14, notice);
1135
+ return _el$14;
1136
+ })()
1137
+ })]
1138
+ }), null);
1139
+ return _el$;
1140
+ })();
1141
+ }
1142
+
1143
+ // ── Plugin setup ────────────────────────────────────────────────────────────
1144
+
1145
+ function defaultSchedule(tick, intervalMs) {
1146
+ const timer = setInterval(tick, intervalMs);
1147
+ return () => clearInterval(timer);
1148
+ }
1149
+
1150
+ /**
1151
+ * GA TUI setup: claims the sidebar, starts the location poller and opens the
1152
+ * drawer for every menu the server pushes. Returns the cleanup that stops
1153
+ * all of it; after cleanup no answer, dialog or toast from this setup
1154
+ * reaches the host.
1155
+ */
1156
+ export function setupGaTui(context, options = {}) {
1157
+ const logger = options.logger;
1158
+ const now = options.now ?? Date.now;
1159
+ const client = createGaLocationClient({
1160
+ call: input => context.client.rpc.call(input),
1161
+ location: context.location,
1162
+ ...(logger ? {
1163
+ logger
1164
+ } : {})
1165
+ });
1166
+ const active = () => !client.disposed();
1167
+ const ui = createGaMenuUi(context, active);
1168
+ const [view, setView] = createSignal(undefined);
1169
+ const releaseSlot = context.ui.slot({
1170
+ append: 'sidebar.content',
1171
+ render: input => _$createComponent(GaSidebar, {
1172
+ view: view,
1173
+ get sessionID() {
1174
+ return input.sessionID;
1175
+ }
1176
+ })
1177
+ });
1178
+
1179
+ // The latest snapshot per scope; the drawer's menu is built from it.
1180
+ const latest = new Map();
1181
+ const showSnapshot = snapshot => {
1182
+ latest.set(scopeKey(snapshot.scope), snapshot);
1183
+ setView({
1184
+ scope: snapshot.scope,
1185
+ projected: projectSidebar({
1186
+ accounts: snapshot.accounts,
1187
+ route: snapshot.route,
1188
+ status: snapshot.status,
1189
+ now: now()
1190
+ })
1191
+ });
1192
+ };
1193
+
1194
+ /**
1195
+ * Pulls fresh state for `scope` and returns the menu built from it. Any
1196
+ * notifications the pull carries are handled like a poll tick's.
1197
+ */
1198
+ const freshMenu = async scope => {
1199
+ let fresh;
1200
+ await pollGaOnce({
1201
+ client,
1202
+ scope: () => scope,
1203
+ onSnapshot: snapshot => {
1204
+ fresh = snapshot;
1205
+ showSnapshot(snapshot);
1206
+ },
1207
+ onNotification,
1208
+ ...(logger ? {
1209
+ logger
1210
+ } : {})
1211
+ });
1212
+ return fresh ? buildGaMenu(fresh, now()) : undefined;
1213
+ };
1214
+ const applyChoice = async (scope, request, shown) => {
1215
+ const refused = async (text, code) => ({
1216
+ command: ANTIGRAVITY_MENU_COMMAND,
1217
+ ok: false,
1218
+ text,
1219
+ code,
1220
+ menu: (await freshMenu(scope)) ?? shown()
1221
+ });
1222
+ let body;
1223
+ try {
1224
+ body = gaApplyBody(request);
1225
+ } catch (error) {
1226
+ if (error instanceof GaMenuChoiceError) return refused(error.message, 'invalid-choice');
1227
+ throw error;
1228
+ }
1229
+ let result;
1230
+ try {
1231
+ result = await client.apply(scope, body);
1232
+ } catch (error) {
1233
+ if (error instanceof GaStaleError) return refused(error.message, error.reason);
1234
+ throw error;
1235
+ }
1236
+ // Settings and accounts shown next come from a fresh read, not from the
1237
+ // apply's answer.
1238
+ const menu = (await freshMenu(scope)) ?? shown();
1239
+ return gaMenuResult(result, menu);
1240
+ };
1241
+ function onNotification(notification, scope) {
1242
+ const snapshot = latest.get(scopeKey(scope));
1243
+ if (!snapshot) return;
1244
+ let shown = buildGaMenu(snapshot, now());
1245
+ void openAntigravityMenu({
1246
+ ui,
1247
+ apply: async request => {
1248
+ const result = await applyChoice(scope, request, () => shown);
1249
+ shown = result.menu;
1250
+ return result;
1251
+ },
1252
+ ...(context.renderer?.copyToClipboardOSC52 ? {
1253
+ copy: text => context.renderer?.copyToClipboardOSC52?.(text) === true
1254
+ } : {}),
1255
+ onError: (message, detail) => logger?.warn(message, detail),
1256
+ startSection: sectionForCommand(notification.command)
1257
+ }, {
1258
+ command: ANTIGRAVITY_MENU_COMMAND,
1259
+ menu: shown
1260
+ }).catch(error => {
1261
+ logger?.warn('menu-drawer-failed', {
1262
+ error: error instanceof Error ? error.name : typeof error
1263
+ });
1264
+ });
1265
+ }
1266
+ let inFlight = false;
1267
+ const tick = () => {
1268
+ if (inFlight || !active()) return;
1269
+ inFlight = true;
1270
+ void pollGaOnce({
1271
+ client,
1272
+ scope: () => currentScope(context.ui.router.current()),
1273
+ onSnapshot: showSnapshot,
1274
+ onNotification,
1275
+ ...(logger ? {
1276
+ logger
1277
+ } : {})
1278
+ }).finally(() => {
1279
+ inFlight = false;
1280
+ });
1281
+ };
1282
+ const stop = (options.schedule ?? defaultSchedule)(tick, GA_SIDEBAR_PULL_MS);
1283
+ tick();
1284
+ let cleaned = false;
1285
+ return async () => {
1286
+ if (cleaned) return;
1287
+ cleaned = true;
1288
+ stop();
1289
+ client.dispose();
1290
+ releaseSlot();
1291
+ };
1292
+ }
1293
+
1294
+ /**
1295
+ * The GA TUI plugin definition (`{ id, setup }`, the 2.0.22 TUI plugin
1296
+ * shape). Importing this module starts nothing; `setup` binds to the
1297
+ * context's location and returns the cleanup that stops everything it
1298
+ * started.
1299
+ */
1300
+ const gaTuiPlugin = {
1301
+ id: GA_TUI_ID,
1302
+ setup: context => setupGaTui(context)
1303
+ };
1304
+ export default gaTuiPlugin;