@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/README.md +38 -352
  2. package/dist/cli.js +13757 -12857
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +1362 -1056
  5. package/dist/index.js +16038 -16162
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +1447 -1375
  8. package/dist/server.js +11254 -10921
  9. package/dist/server.js.map +4 -4
  10. package/dist/server.meta.json +1 -1
  11. package/dist/src/auth-method-labels.d.ts +3 -0
  12. package/dist/src/auth-method-labels.d.ts.map +1 -0
  13. package/dist/src/auth-method-labels.js +5 -0
  14. package/dist/src/auth-method-labels.js.map +1 -0
  15. package/dist/src/cli.d.ts +3 -1
  16. package/dist/src/cli.d.ts.map +1 -1
  17. package/dist/src/cli.js +98 -12
  18. package/dist/src/cli.js.map +1 -1
  19. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
  20. package/dist/src/common-auth-embedded/claustrum/consumer.js +134 -2
  21. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
  22. package/dist/src/common-auth-embedded/claustrum/custody.js +17 -0
  23. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  24. package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  25. package/dist/src/common-auth-embedded/claustrum/index.d.ts +3 -2
  26. package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
  27. package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  28. package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
  29. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  30. package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
  31. package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  32. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
  33. package/dist/src/common-auth-embedded/pi-slot/lock.js +7 -3
  34. package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
  35. package/dist/src/common-auth-embedded/quota/codec.js +2 -1
  36. package/dist/src/common-auth-embedded/quota/format.d.ts +40 -3
  37. package/dist/src/common-auth-embedded/quota/format.js +196 -43
  38. package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
  39. package/dist/src/common-auth-embedded/quota/index.js +2 -2
  40. package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
  41. package/dist/src/common-auth-embedded/quota/map.js +36 -1
  42. package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
  43. package/dist/src/common-auth-embedded/quota/merge.js +21 -5
  44. package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
  45. package/dist/src/common-auth-embedded/quota/projection.js +3 -1
  46. package/dist/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  47. package/dist/src/common-auth-embedded/setup/command-error.js +79 -0
  48. package/dist/src/common-auth-embedded/setup/command-runner.js +143 -0
  49. package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
  50. package/dist/src/common-auth-embedded/setup/command.js +271 -0
  51. package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
  52. package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
  53. package/dist/src/common-auth-embedded/setup/detect.js +224 -0
  54. package/dist/src/common-auth-embedded/setup/enroll.js +82 -0
  55. package/dist/src/common-auth-embedded/setup/index.d.ts +6 -0
  56. package/dist/src/common-auth-embedded/setup/index.js +5 -0
  57. package/dist/src/common-auth-embedded/setup/paths.js +33 -0
  58. package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  59. package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
  60. package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
  61. package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
  62. package/dist/src/common-auth-embedded/setup/register.js +136 -0
  63. package/dist/src/common-auth-embedded/setup/types.d.ts +150 -0
  64. package/dist/src/common-auth-embedded/source-output.json +265 -101
  65. package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
  66. package/dist/src/common-auth-embedded/store/pool.js +0 -1
  67. package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  68. package/dist/src/common-auth-embedded/store/refresh-lock.js +0 -1
  69. package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
  70. package/dist/src/common-auth-embedded/store/schema.js +3 -2
  71. package/dist/src/ga/rpc/protocol.d.ts +4 -7
  72. package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
  73. package/dist/src/ga/rpc/protocol.js +5 -13
  74. package/dist/src/ga/rpc/protocol.js.map +1 -1
  75. package/dist/src/ga/server/auth.d.ts +8 -3
  76. package/dist/src/ga/server/auth.d.ts.map +1 -1
  77. package/dist/src/ga/server/auth.js +25 -9
  78. package/dist/src/ga/server/auth.js.map +1 -1
  79. package/dist/src/ga/server/index.d.ts +39 -12
  80. package/dist/src/ga/server/index.d.ts.map +1 -1
  81. package/dist/src/ga/server/index.js +218 -55
  82. package/dist/src/ga/server/index.js.map +1 -1
  83. package/dist/src/ga/server/pool-login.d.ts +22 -0
  84. package/dist/src/ga/server/pool-login.d.ts.map +1 -0
  85. package/dist/src/ga/server/pool-login.js +150 -0
  86. package/dist/src/ga/server/pool-login.js.map +1 -0
  87. package/dist/src/ga/tui/host-ga.d.ts +2 -5
  88. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  89. package/dist/src/ga/tui/host-ga.js +54 -52
  90. package/dist/src/ga/tui/host-ga.js.map +1 -1
  91. package/dist/src/plugin/accounts.d.ts +1 -1
  92. package/dist/src/plugin/accounts.d.ts.map +1 -1
  93. package/dist/src/plugin/accounts.js +1 -0
  94. package/dist/src/plugin/accounts.js.map +1 -1
  95. package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  96. package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  97. package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
  98. package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
  99. package/dist/src/plugin/command-apply.d.ts +2 -2
  100. package/dist/src/plugin/command-apply.d.ts.map +1 -1
  101. package/dist/src/plugin/command-apply.js +3 -10
  102. package/dist/src/plugin/command-apply.js.map +1 -1
  103. package/dist/src/plugin/commands.d.ts +1 -0
  104. package/dist/src/plugin/commands.d.ts.map +1 -1
  105. package/dist/src/plugin/commands.js +2 -2
  106. package/dist/src/plugin/commands.js.map +1 -1
  107. package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
  108. package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  109. package/dist/src/plugin/config/operator-settings-schema.js +0 -5
  110. package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
  111. package/dist/src/plugin/config/schema.d.ts +0 -7
  112. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  113. package/dist/src/plugin/config/schema.js +2 -44
  114. package/dist/src/plugin/config/schema.js.map +1 -1
  115. package/dist/src/plugin/config/writer.d.ts +1 -1
  116. package/dist/src/plugin/config/writer.js +1 -1
  117. package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
  118. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
  119. package/dist/src/plugin/fetch/retry-state.js +0 -6
  120. package/dist/src/plugin/fetch/retry-state.js.map +1 -1
  121. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  122. package/dist/src/plugin/fetch-interceptor.js +0 -3
  123. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  124. package/dist/src/plugin/fetch-routing.d.ts +0 -16
  125. package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
  126. package/dist/src/plugin/fetch-routing.js +0 -49
  127. package/dist/src/plugin/fetch-routing.js.map +1 -1
  128. package/dist/src/plugin/ga-location-services.d.ts +14 -9
  129. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  130. package/dist/src/plugin/ga-location-services.js +124 -43
  131. package/dist/src/plugin/ga-location-services.js.map +1 -1
  132. package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
  133. package/dist/src/plugin/gemini-dump.js +2 -5
  134. package/dist/src/plugin/gemini-dump.js.map +1 -1
  135. package/dist/src/plugin/google-origin.d.ts +7 -0
  136. package/dist/src/plugin/google-origin.d.ts.map +1 -0
  137. package/dist/src/plugin/google-origin.js +14 -0
  138. package/dist/src/plugin/google-origin.js.map +1 -0
  139. package/dist/src/plugin/index.d.ts.map +1 -1
  140. package/dist/src/plugin/index.js +18 -7
  141. package/dist/src/plugin/index.js.map +1 -1
  142. package/dist/src/plugin/logging-utils.d.ts.map +1 -1
  143. package/dist/src/plugin/logging-utils.js +2 -5
  144. package/dist/src/plugin/logging-utils.js.map +1 -1
  145. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  146. package/dist/src/plugin/oauth-methods.js +0 -33
  147. package/dist/src/plugin/oauth-methods.js.map +1 -1
  148. package/dist/src/plugin/operator-settings.d.ts +1 -1
  149. package/dist/src/plugin/operator-settings.d.ts.map +1 -1
  150. package/dist/src/plugin/operator-settings.js +1 -8
  151. package/dist/src/plugin/operator-settings.js.map +1 -1
  152. package/dist/src/plugin/quota.d.ts +11 -7
  153. package/dist/src/plugin/quota.d.ts.map +1 -1
  154. package/dist/src/plugin/quota.js +128 -102
  155. package/dist/src/plugin/quota.js.map +1 -1
  156. package/dist/src/plugin/request.d.ts +6 -5
  157. package/dist/src/plugin/request.d.ts.map +1 -1
  158. package/dist/src/plugin/request.js +95 -180
  159. package/dist/src/plugin/request.js.map +1 -1
  160. package/dist/src/plugin/server.d.ts.map +1 -1
  161. package/dist/src/plugin/server.js +60 -53
  162. package/dist/src/plugin/server.js.map +1 -1
  163. package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
  164. package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  165. package/dist/src/plugin/shared/advisory-repository.js +91 -0
  166. package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
  167. package/dist/src/plugin/shared/request-services.d.ts +27 -26
  168. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  169. package/dist/src/plugin/shared/request-services.js +244 -245
  170. package/dist/src/plugin/shared/request-services.js.map +1 -1
  171. package/dist/src/plugin/shared/runtime.js +4 -2
  172. package/dist/src/plugin/shared/runtime.js.map +1 -1
  173. package/dist/src/plugin/shared/vault-request-credentials.d.ts +16 -4
  174. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  175. package/dist/src/plugin/shared/vault-request-credentials.js +44 -7
  176. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  177. package/dist/src/plugin/storage.d.ts +2 -2
  178. package/dist/src/plugin/storage.d.ts.map +1 -1
  179. package/dist/src/plugin/storage.js.map +1 -1
  180. package/dist/src/plugin/vault-custody.d.ts +14 -1
  181. package/dist/src/plugin/vault-custody.d.ts.map +1 -1
  182. package/dist/src/plugin/vault-custody.js +203 -44
  183. package/dist/src/plugin/vault-custody.js.map +1 -1
  184. package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
  185. package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  186. package/dist/src/plugin/vault-quota-outcome.js +47 -0
  187. package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
  188. package/dist/src/quota-presentation.d.ts +29 -1
  189. package/dist/src/quota-presentation.d.ts.map +1 -1
  190. package/dist/src/quota-presentation.js +52 -17
  191. package/dist/src/quota-presentation.js.map +1 -1
  192. package/dist/src/setup.d.ts +15 -0
  193. package/dist/src/setup.d.ts.map +1 -0
  194. package/dist/src/setup.js +320 -0
  195. package/dist/src/setup.js.map +1 -0
  196. package/dist/src/sidebar-projection.d.ts +5 -1
  197. package/dist/src/sidebar-projection.d.ts.map +1 -1
  198. package/dist/src/sidebar-projection.js +6 -2
  199. package/dist/src/sidebar-projection.js.map +1 -1
  200. package/dist/src/sidebar-state.d.ts +1 -1
  201. package/dist/src/sidebar-state.d.ts.map +1 -1
  202. package/dist/src/sidebar-state.js +19 -1
  203. package/dist/src/sidebar-state.js.map +1 -1
  204. package/dist/src/tui/quota-layout.d.ts +94 -0
  205. package/dist/src/tui/quota-layout.d.ts.map +1 -0
  206. package/dist/src/tui/quota-layout.js +139 -0
  207. package/dist/src/tui/quota-layout.js.map +1 -0
  208. package/dist/src/tui/route-layout.d.ts +8 -0
  209. package/dist/src/tui/route-layout.d.ts.map +1 -0
  210. package/dist/src/tui/route-layout.js +36 -0
  211. package/dist/src/tui/route-layout.js.map +1 -0
  212. package/dist/src/tui.d.ts.map +1 -1
  213. package/dist/src/tui.js +120 -127
  214. package/dist/src/tui.js.map +1 -1
  215. package/dist/tui-build-map.json +66 -37
  216. package/dist/tui-ga-build-map.json +66 -37
  217. package/dist/types/src/auth-method-labels.d.ts +3 -0
  218. package/dist/types/src/auth-method-labels.d.ts.map +1 -0
  219. package/dist/types/src/cli.d.ts +3 -1
  220. package/dist/types/src/cli.d.ts.map +1 -1
  221. package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  222. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +142 -0
  223. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +207 -0
  224. package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
  225. package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  226. package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  227. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
  228. package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  229. package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  230. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
  231. package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  232. package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  233. package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  234. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  235. package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  236. package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  237. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  238. package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
  239. package/dist/types/src/common-auth-embedded/quota/format.d.ts +40 -3
  240. package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
  241. package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
  242. package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
  243. package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
  244. package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
  245. package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
  246. package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  247. package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
  248. package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  249. package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  250. package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
  251. package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
  252. package/dist/types/src/common-auth-embedded/setup/index.d.ts +6 -0
  253. package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  254. package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
  255. package/dist/types/src/common-auth-embedded/setup/types.d.ts +150 -0
  256. package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
  257. package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  258. package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
  259. package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
  260. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  261. package/dist/types/src/ga/server/auth.d.ts +8 -3
  262. package/dist/types/src/ga/server/auth.d.ts.map +1 -1
  263. package/dist/types/src/ga/server/index.d.ts +39 -12
  264. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  265. package/dist/types/src/ga/server/pool-login.d.ts +22 -0
  266. package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
  267. package/dist/types/src/plugin/accounts.d.ts +1 -1
  268. package/dist/types/src/plugin/accounts.d.ts.map +1 -1
  269. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  270. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  271. package/dist/types/src/plugin/command-apply.d.ts +2 -2
  272. package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
  273. package/dist/types/src/plugin/commands.d.ts +1 -0
  274. package/dist/types/src/plugin/commands.d.ts.map +1 -1
  275. package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
  276. package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  277. package/dist/types/src/plugin/config/schema.d.ts +0 -7
  278. package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
  279. package/dist/types/src/plugin/config/writer.d.ts +1 -1
  280. package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
  281. package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
  282. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
  283. package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
  284. package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
  285. package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
  286. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  287. package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
  288. package/dist/types/src/plugin/google-origin.d.ts +7 -0
  289. package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
  290. package/dist/types/src/plugin/index.d.ts.map +1 -1
  291. package/dist/types/src/plugin/logging-utils.d.ts.map +1 -1
  292. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
  293. package/dist/types/src/plugin/operator-settings.d.ts +1 -1
  294. package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
  295. package/dist/types/src/plugin/quota.d.ts +11 -7
  296. package/dist/types/src/plugin/quota.d.ts.map +1 -1
  297. package/dist/types/src/plugin/request.d.ts +6 -5
  298. package/dist/types/src/plugin/request.d.ts.map +1 -1
  299. package/dist/types/src/plugin/server.d.ts.map +1 -1
  300. package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
  301. package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  302. package/dist/types/src/plugin/shared/request-services.d.ts +27 -26
  303. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  304. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +16 -4
  305. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  306. package/dist/types/src/plugin/storage.d.ts +2 -2
  307. package/dist/types/src/plugin/storage.d.ts.map +1 -1
  308. package/dist/types/src/plugin/vault-custody.d.ts +14 -1
  309. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
  310. package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
  311. package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  312. package/dist/types/src/setup.d.ts +15 -0
  313. package/dist/types/src/setup.d.ts.map +1 -0
  314. package/dist/types/src/sidebar-state.d.ts +1 -1
  315. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  316. package/package.json +5 -4
  317. package/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
  318. package/src/common-auth-embedded/claustrum/consumer.js +134 -2
  319. package/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
  320. package/src/common-auth-embedded/claustrum/custody.js +17 -0
  321. package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  322. package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  323. package/src/common-auth-embedded/claustrum/index.d.ts +3 -2
  324. package/src/common-auth-embedded/claustrum/index.js +5 -3
  325. package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  326. package/src/common-auth-embedded/claustrum/insula.js +152 -0
  327. package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  328. package/src/common-auth-embedded/claustrum/roster.js +33 -3
  329. package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
  330. package/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
  331. package/src/common-auth-embedded/pi-slot/lock.js +7 -3
  332. package/src/common-auth-embedded/quota/codec.d.ts +2 -0
  333. package/src/common-auth-embedded/quota/codec.js +2 -1
  334. package/src/common-auth-embedded/quota/format.d.ts +40 -3
  335. package/src/common-auth-embedded/quota/format.js +196 -43
  336. package/src/common-auth-embedded/quota/index.d.ts +4 -4
  337. package/src/common-auth-embedded/quota/index.js +2 -2
  338. package/src/common-auth-embedded/quota/map.d.ts +11 -0
  339. package/src/common-auth-embedded/quota/map.js +36 -1
  340. package/src/common-auth-embedded/quota/merge.d.ts +3 -1
  341. package/src/common-auth-embedded/quota/merge.js +21 -5
  342. package/src/common-auth-embedded/quota/projection.d.ts +2 -1
  343. package/src/common-auth-embedded/quota/projection.js +3 -1
  344. package/src/common-auth-embedded/setup/command-error.d.ts +32 -0
  345. package/src/common-auth-embedded/setup/command-error.js +79 -0
  346. package/src/common-auth-embedded/setup/command-runner.js +143 -0
  347. package/src/common-auth-embedded/setup/command.d.ts +3 -0
  348. package/src/common-auth-embedded/setup/command.js +271 -0
  349. package/src/common-auth-embedded/setup/config-write.js +60 -0
  350. package/src/common-auth-embedded/setup/detect.d.ts +6 -0
  351. package/src/common-auth-embedded/setup/detect.js +224 -0
  352. package/src/common-auth-embedded/setup/enroll.js +82 -0
  353. package/src/common-auth-embedded/setup/index.d.ts +6 -0
  354. package/src/common-auth-embedded/setup/index.js +5 -0
  355. package/src/common-auth-embedded/setup/paths.js +33 -0
  356. package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  357. package/src/common-auth-embedded/setup/process-fence.js +270 -0
  358. package/src/common-auth-embedded/setup/prompts.js +26 -0
  359. package/src/common-auth-embedded/setup/register.d.ts +11 -0
  360. package/src/common-auth-embedded/setup/register.js +136 -0
  361. package/src/common-auth-embedded/setup/types.d.ts +150 -0
  362. package/src/common-auth-embedded/source-output.json +265 -101
  363. package/src/common-auth-embedded/store/pool.d.ts +1 -1
  364. package/src/common-auth-embedded/store/pool.js +0 -1
  365. package/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
  366. package/src/common-auth-embedded/store/refresh-lock.js +0 -1
  367. package/src/common-auth-embedded/store/schema.d.ts +2 -0
  368. package/src/common-auth-embedded/store/schema.js +3 -2
  369. package/src/sidebar-state.ts +19 -2
  370. package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
  371. package/src/tui-compiled/common-auth-embedded/quota/format.js +196 -43
  372. package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
  373. package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
  374. package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
  375. package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
  376. package/src/tui-compiled/quota-presentation.js +42 -9
  377. package/src/tui-compiled/sidebar-state.js +15 -1
  378. package/src/tui-compiled/tui/quota-layout.js +378 -0
  379. package/src/tui-compiled/tui/route-layout.js +30 -0
  380. package/src/tui-compiled/tui.js +271 -371
  381. package/src/tui-ga-compiled/host-ga.js +93 -90
  382. package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
  383. package/src/tui-ga-compiled/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
  384. package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
  385. package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
  386. package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  387. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +196 -43
  388. package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
  389. package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
  390. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +378 -0
  391. package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
  392. package/src/tui-ga-raw/host-ga.tsx +102 -92
  393. package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
  394. package/src/tui-ga-raw/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
  395. package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
  396. package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
  397. package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  398. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +196 -43
  399. package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
  400. package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
  401. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +391 -0
  402. package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
  403. package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
  404. package/src/tui-raw/common-auth-embedded/quota/format.js +196 -43
  405. package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
  406. package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
  407. package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
  408. package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
  409. package/src/tui-raw/quota-presentation.js +42 -9
  410. package/src/tui-raw/sidebar-state.js +15 -1
  411. package/src/tui-raw/tui/quota-layout.tsx +391 -0
  412. package/src/tui-raw/tui/route-layout.js +30 -0
  413. package/src/tui-raw/tui.tsx +218 -272
  414. package/src/tui.tsx +218 -272
  415. package/dist/src/tui/vault-setup.d.ts +0 -98
  416. package/dist/src/tui/vault-setup.d.ts.map +0 -1
  417. package/dist/src/tui/vault-setup.js +0 -198
  418. package/dist/src/tui/vault-setup.js.map +0 -1
  419. package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
  420. package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
  421. package/dist/types/src/quota-presentation.d.ts +0 -18
  422. package/dist/types/src/quota-presentation.d.ts.map +0 -1
package/src/tui.tsx CHANGED
@@ -13,16 +13,20 @@
13
13
  * score, and per-session routing decisions), so the fleet components are
14
14
  * adapted rather than copied verbatim:
15
15
  *
16
- * - `QuotaRow` reads `remainingPercent + resetAt` from the Antigravity
17
- * `SidebarQuotaEntry` shape and colors via `quotaTone` (remaining
18
- * threshold) instead of `usageTone` (used threshold).
16
+ * - The quota rows come from `tui/quota-layout.tsx`, shared with the
17
+ * OpenCode 2 sidebar: each window reads `remainingPercent + resetAt` from
18
+ * the Antigravity `SidebarQuotaEntry` shape, is colored via `quotaTone`
19
+ * (remaining threshold) instead of `usageTone` (used threshold), and is
20
+ * one line sized from the measured sidebar width.
19
21
  * - `AccountBlock` derives its status word (`active` / `idle` /
20
- * `cooling` / `off` / `blocked`) from the Antigravity account state and
21
- * surfaces health as a muted secondary line rather than a top-level
22
- * bar — fleet parity for "Quota first, health second".
23
- * - `Routing` resolves to a single `Route` `StatRow` carrying the most
24
- * recent `activeRouting` entry, since Antigravity does not maintain a
25
- * per-session sidebar state alongside the slot-rendered tree.
22
+ * `cooling` / `off`) from the Antigravity account state; the shared block
23
+ * shows the reading age once per account and groups windows under
24
+ * `Gemini` and `Other models` headers. The routing health score is not
25
+ * shown.
26
+ * - `Routing` shows the mounted session's most recent `activeRouting`
27
+ * entry, or `No request yet` before the session's first request, since
28
+ * Antigravity does not maintain a per-session sidebar state alongside the
29
+ * slot-rendered tree.
26
30
  *
27
31
  * Hard rules for this file:
28
32
  *
@@ -45,12 +49,11 @@ import type {
45
49
  } from '@opencode-ai/plugin/tui'
46
50
  import { createSlot } from '@opentui/solid'
47
51
  import { createSignal, For, type JSX, onCleanup, onMount, Show } from 'solid-js'
48
- import { formatQuotaReading, quotaReadingParts } from './quota-presentation'
52
+ import { NO_QUOTA_READING } from './quota-presentation'
49
53
  import { getRpcDir } from './rpc/rpc-dir'
50
54
  import {
51
55
  readSidebarState,
52
56
  type SidebarAccountState,
53
- type SidebarQuotaEntry,
54
57
  type SidebarQuotaKey,
55
58
  type SidebarStateV1,
56
59
  } from './sidebar-state'
@@ -60,6 +63,19 @@ import {
60
63
  dispatchV1Notification,
61
64
  type V1Notification,
62
65
  } from './tui/host-v1'
66
+ import {
67
+ type AccountWindow,
68
+ ASSUMED_CONTENT_WIDTH,
69
+ accountWindows,
70
+ fitLabel,
71
+ QuotaAccountBlock,
72
+ type QuotaPalette,
73
+ type QuotaTone,
74
+ quotaTone,
75
+ RESET_SINCE_READING,
76
+ showsFigure,
77
+ } from './tui/quota-layout'
78
+ import { routeLineFits } from './tui/route-layout'
63
79
  import {
64
80
  type AntigravityAuthTuiPrefs,
65
81
  type AppearancePrefs,
@@ -121,18 +137,11 @@ let rpcInFlight = false
121
137
  const GLOBAL_NOTIFICATION_CURSOR = '__global__'
122
138
  const MAX_NOTIFICATION_CURSORS = 256
123
139
 
124
- const QUOTA_LABELS: Record<SidebarQuotaKey, string> = {
125
- gemini: 'Gm',
126
- 'non-gemini': 'NG',
127
- }
128
-
129
- const QUOTA_ORDER: readonly SidebarQuotaKey[] = ['gemini', 'non-gemini']
130
-
131
- const WINDOW_GUTTER: Record<string, string> = {
132
- weekly: '7d',
133
- '5h': '5h',
140
+ // The collapsed row has room for one word before the window name.
141
+ const COLLAPSED_GROUP_NAMES: Record<SidebarQuotaKey, string> = {
142
+ gemini: 'Gemini',
143
+ 'non-gemini': 'Other',
134
144
  }
135
-
136
145
  // --- Theme tokens ----------------------------------------------------------
137
146
  //
138
147
  // The sidebar pulls its colors from the live host theme (`api.theme.current`
@@ -146,7 +155,7 @@ const WINDOW_GUTTER: Record<string, string> = {
146
155
  // uses are populated; the rest of the TuiThemeCurrent fields are left
147
156
  // undefined and the `??` chain in `toneColor` falls through cleanly.
148
157
 
149
- type Tone = 'ok' | 'warn' | 'err' | 'muted' | 'accent' | 'text'
158
+ type Tone = QuotaTone
150
159
  type Theme = TuiThemeCurrent
151
160
  type ThemeColor = Theme['text']
152
161
 
@@ -225,31 +234,15 @@ function toneColor(theme: Theme, tone: Tone): ThemeColor {
225
234
  }
226
235
  }
227
236
 
228
- function quotaTone(usedPct: number, appearance: AppearancePrefs): Tone {
229
- if (usedPct < appearance.warnThreshold) return 'ok'
230
- if (usedPct < appearance.errorThreshold) return 'warn'
231
- return 'err'
232
- }
233
-
234
- interface BarSegment {
235
- text: string
236
- tone: Tone
237
- }
238
-
239
- function quotaBarSegments(
240
- remainingPct: number,
241
- appearance: AppearancePrefs,
242
- ): BarSegment[] {
243
- const width = appearance.barWidth
244
- const usedCells = Math.max(
245
- 0,
246
- Math.min(Math.round((remainingPct / 100) * width), width),
247
- )
248
- const tone = quotaTone(100 - remainingPct, appearance)
249
- return [
250
- { text: appearance.barFilledChar.repeat(usedCells), tone },
251
- { text: appearance.barEmptyChar.repeat(width - usedCells), tone },
252
- ].filter((segment) => segment.text.length > 0)
237
+ // The shared quota layout reads its colors through this palette. Muted text
238
+ // and the account label read `textMuted` and `text` straight from the theme,
239
+ // without the `toneColor` fallback chain.
240
+ function themePalette(theme: () => Theme): QuotaPalette {
241
+ return {
242
+ text: () => theme().text,
243
+ muted: () => theme().textMuted,
244
+ tone: (tone) => toneColor(theme(), tone),
245
+ }
253
246
  }
254
247
 
255
248
  export interface SidebarPanelProps {
@@ -397,12 +390,6 @@ function getSidebarController(): SidebarController {
397
390
 
398
391
  // --- Shared helpers (fleet shape, antigravity data) ------------------------
399
392
 
400
- function clamp(value: number, min: number, max: number): number {
401
- if (value < min) return min
402
- if (value > max) return max
403
- return value
404
- }
405
-
406
393
  // Render a "reset in Nm/Nh/NdNh" string from an epoch-ms reset time.
407
394
  // Empty string when no resetAt is cached. The fleet's `formatResetIn`
408
395
  // reads ISO strings; Antigravity persists resetAt as a numeric epoch, so
@@ -468,11 +455,9 @@ function StatRow(props: {
468
455
  )
469
456
  }
470
457
 
471
- // Fleet CollapsedRow: muted label left, caller-supplied value right. Used
472
- // for the collapsed sidebar view; the Antigravity adapter renders one
473
- // CollapsedRow per visible account (Claude's sibling collapses to a
474
- // single primary-quota line, but Antigravity's multi-quota model fits a
475
- // per-account row better when the sidebar is collapsed).
458
+ // Fleet CollapsedRow: muted label left, caller-supplied value right. The
459
+ // collapsed view renders one for the active account. The caller sizes both
460
+ // sides to the measured width, so neither side may wrap.
476
461
  function CollapsedRow(props: {
477
462
  theme: () => Theme
478
463
  label: string
@@ -480,77 +465,19 @@ function CollapsedRow(props: {
480
465
  }): JSX.Element {
481
466
  return (
482
467
  <box width='100%' flexDirection='row' justifyContent='space-between'>
483
- <text fg={props.theme().textMuted}>{props.label}</text>
468
+ <text flexShrink={0} wrapMode='none' fg={props.theme().textMuted}>
469
+ {props.label}
470
+ </text>
484
471
  {props.children}
485
472
  </box>
486
473
  )
487
474
  }
488
475
 
489
- // The bar fills with remaining quota. The shared formatter supplies the
490
- // figure, reset and reading age; the right column aligns reset and age text.
491
- function QuotaRow(props: {
492
- theme: () => Theme
493
- appearance: AppearancePrefs
494
- label: string
495
- entry: SidebarQuotaEntry | undefined
496
- now: () => number
497
- }): JSX.Element {
498
- const parts = () => quotaReadingParts(props.label, props.entry, props.now())
499
- const remaining = () => parts().remaining
500
- const reset = () => parts().detail
501
- return (
502
- <Show
503
- when={remaining() != null}
504
- fallback={
505
- <box width='100%' flexDirection='row' justifyContent='space-between'>
506
- <text fg={props.theme().textMuted}>{props.label.padEnd(5)}</text>
507
- <text fg={props.theme().textMuted}>{parts().figure}</text>
508
- </box>
509
- }
510
- >
511
- <box width='100%' flexDirection='row' justifyContent='space-between'>
512
- <box flexDirection='row'>
513
- <text width={5} flexShrink={0} fg={props.theme().textMuted}>
514
- {props.label}
515
- </text>
516
- <box
517
- width={props.appearance.barWidth}
518
- flexShrink={0}
519
- flexDirection='row'
520
- >
521
- <For each={quotaBarSegments(remaining() ?? 0, props.appearance)}>
522
- {(segment) => (
523
- <text fg={toneColor(props.theme(), segment.tone)}>
524
- {segment.text}
525
- </text>
526
- )}
527
- </For>
528
- </box>
529
- <text
530
- fg={toneColor(
531
- props.theme(),
532
- quotaTone(100 - (remaining() ?? 0), props.appearance),
533
- )}
534
- >
535
- {` ${parts().figure}`}
536
- </text>
537
- </box>
538
- <Show when={reset()}>
539
- <text fg={props.theme().textMuted}>{reset()}</text>
540
- </Show>
541
- </box>
542
- </Show>
543
- )
544
- }
545
-
546
- // Fleet AccountBlock, adapted to Antigravity's per-account data. Header
547
- // row is account label (left) + status word (right). The body renders one
548
- // QuotaRow per present quota group in the fleet's stable order, then a
549
- // muted secondary line with the account's health score and, when
550
- // relevant, a cooldown countdown. Status word priorities (first match
551
- // wins):
476
+ // One account in the Quota section: the shared quota block, with the status
477
+ // word computed from the sidebar file's account state. Status word priorities
478
+ // (first match wins):
552
479
  // - `off` when the account is disabled
553
- // - `cooling` when cooldownUntil is still in the future
480
+ // - `cooling <wait>` when cooldownUntil is still in the future
554
481
  // - `active` when current === true
555
482
  // - `idle` for the fallback (current === false) case
556
483
  function AccountBlock(props: {
@@ -558,86 +485,82 @@ function AccountBlock(props: {
558
485
  appearance: AppearancePrefs
559
486
  account: SidebarAccountState
560
487
  now: () => number
488
+ width: () => number
561
489
  active?: boolean
562
490
  marginTop?: number
563
491
  }): JSX.Element {
564
492
  const active = () => props.active ?? props.account.current
493
+ const cooldownMs = (): number => {
494
+ const cd = props.account.cooldownUntil
495
+ if (typeof cd !== 'number') return 0
496
+ return Math.max(0, cd - props.now())
497
+ }
565
498
  const statusWord = (): string => {
566
499
  if (!props.account.enabled) return 'off'
567
- const cd = props.account.cooldownUntil
568
- if (typeof cd === 'number' && cd > props.now()) return 'cooling'
500
+ if (cooldownMs() > 0) return `cooling ${formatWait(cooldownMs())}`
569
501
  return active() ? 'active' : 'idle'
570
502
  }
571
503
  const statusTone = (): Tone => {
572
504
  if (!props.account.enabled) return 'muted'
573
- const cd = props.account.cooldownUntil
574
- if (typeof cd === 'number' && cd > props.now()) return 'warn'
505
+ if (cooldownMs() > 0) return 'warn'
575
506
  return active() ? 'ok' : 'muted'
576
507
  }
577
- const cooldownMs = (): number => {
578
- const cd = props.account.cooldownUntil
579
- if (typeof cd !== 'number') return 0
580
- return Math.max(0, cd - props.now())
581
- }
582
- const healthText = () => {
583
- const base = `health ${Math.round(clamp(props.account.health, 0, 100))}`
584
- return cooldownMs() > 0
585
- ? `${base} · cooling ${formatWait(cooldownMs())}`
586
- : base
587
- }
588
508
  return (
589
- <box width='100%' flexDirection='column' marginTop={props.marginTop ?? 0}>
590
- <box width='100%' flexDirection='row' justifyContent='space-between'>
591
- <text fg={props.theme().text}>
592
- <b>{props.account.label}</b>
593
- </text>
594
- <text fg={toneColor(props.theme(), statusTone())}>
595
- <b>{statusWord()}</b>
596
- </text>
597
- </box>
598
- <For each={QUOTA_ORDER}>
599
- {(key) => {
600
- const poolEntry = props.account.quota[key]
601
- const windows = poolEntry?.windows
602
- // Legacy: no windows array — render a single row with the pool label.
603
- const hasWindows = windows && windows.length > 0
604
- if (!hasWindows) {
605
- return (
606
- <QuotaRow
607
- theme={props.theme}
608
- appearance={props.appearance}
609
- label={QUOTA_LABELS[key]}
610
- entry={poolEntry}
611
- now={props.now}
612
- />
613
- )
614
- }
615
- return (
616
- <>
617
- {windows.map((w) => (
618
- <QuotaRow
619
- theme={props.theme}
620
- appearance={props.appearance}
621
- label={`${QUOTA_LABELS[key]} ${WINDOW_GUTTER[w.window] ?? w.window}`}
622
- entry={{
623
- remainingPercent: w.remainingPercent,
624
- resetAt: w.resetAt,
625
- checkedAt: w.checkedAt,
626
- }}
627
- now={props.now}
628
- />
629
- ))}
630
- </>
631
- )
632
- }}
633
- </For>
634
- <box width='100%' flexDirection='row'>
635
- <text fg={props.theme().textMuted}>{` ${healthText()}`}</text>
636
- </box>
637
- </box>
509
+ <QuotaAccountBlock
510
+ palette={themePalette(props.theme)}
511
+ appearance={props.appearance}
512
+ account={props.account}
513
+ status={statusWord()}
514
+ statusTone={statusTone()}
515
+ now={props.now}
516
+ width={props.width}
517
+ marginTop={props.marginTop}
518
+ />
638
519
  )
639
520
  }
640
521
 
522
+ interface CollapsedQuota {
523
+ // The group and window of the figure (`Other 7d `), dropped when narrow.
524
+ prefix: string
525
+ text: string
526
+ remaining: number | null
527
+ }
528
+
529
+ // The collapsed row's figure: the lowest current window across both groups.
530
+ // A window that reset since its reading is not current and never binds.
531
+ function collapsedQuota(
532
+ account: SidebarAccountState,
533
+ now: number,
534
+ ): CollapsedQuota {
535
+ if (account.quota.gemini == null && account.quota['non-gemini'] == null)
536
+ return { prefix: '', text: '—', remaining: null }
537
+ const windows = accountWindows(account, now)
538
+ let lowest: AccountWindow | undefined
539
+ for (const window of windows) {
540
+ if (!showsFigure(window)) continue
541
+ if (
542
+ lowest === undefined ||
543
+ (window.text.remaining ?? 100) < (lowest.text.remaining ?? 100)
544
+ )
545
+ lowest = window
546
+ }
547
+ if (lowest) {
548
+ const name = lowest.text.name
549
+ return {
550
+ prefix: `${COLLAPSED_GROUP_NAMES[lowest.key]}${name ? ` ${name}` : ''} `,
551
+ text: lowest.text.figure,
552
+ remaining: lowest.text.remaining,
553
+ }
554
+ }
555
+ return {
556
+ prefix: '',
557
+ text: windows.some((window) => window.text.resetSinceReading)
558
+ ? RESET_SINCE_READING
559
+ : NO_QUOTA_READING,
560
+ remaining: null,
561
+ }
562
+ }
563
+
641
564
  function formatWait(ms: number): string {
642
565
  const seconds = Math.ceil(ms / 1000)
643
566
  if (seconds < 60) return `${seconds}s`
@@ -723,6 +646,36 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
723
646
  }
724
647
  }
725
648
 
649
+ // The route on one `Route <value>` line when it fits, else one line per
650
+ // part with the strategy last.
651
+ const routeValue = (route: {
652
+ strategy?: string
653
+ family: string
654
+ style: string
655
+ }): string =>
656
+ `${route.strategy ? `${route.strategy} · ` : ''}${route.family}: ${route.style}`
657
+ const routeLines = (route: {
658
+ strategy?: string
659
+ family: string
660
+ style: string
661
+ }): string[] =>
662
+ [`${route.family}: ${route.style}`, route.strategy ?? ''].filter(
663
+ (line) => line !== '',
664
+ )
665
+
666
+ // The width available to content: the header row spans the panel inside
667
+ // its border and padding. Layout reports it during a render pass, so the
668
+ // signal is updated afterwards rather than rebuilding rows mid-pass.
669
+ const [contentWidth, setContentWidth] = createSignal(ASSUMED_CONTENT_WIDTH)
670
+ let headerRow: { width: number } | undefined
671
+ const measureContentWidth = (): void => {
672
+ const width = headerRow?.width
673
+ if (typeof width !== 'number' || width <= 0) return
674
+ queueMicrotask(() => {
675
+ if (width !== contentWidth()) setContentWidth(width)
676
+ })
677
+ }
678
+
726
679
  // Header badge: ▼/▶ {label}. The fleet shows the version string on the
727
680
  // right when no degraded state is present; the antigravity adapter keeps
728
681
  // that right-alignment and surfaces `degraded` as a "LIMITED" badge
@@ -745,6 +698,10 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
745
698
  >
746
699
  {/* biome-ignore lint/a11y/noStaticElementInteractions: opentui renders to a terminal, not the DOM — ARIA roles do not apply */}
747
700
  <box
701
+ ref={(element) => {
702
+ headerRow = element
703
+ }}
704
+ onSizeChange={measureContentWidth}
748
705
  width='100%'
749
706
  flexDirection='row'
750
707
  justifyContent='space-between'
@@ -781,48 +738,12 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
781
738
  </Show>
782
739
  </box>
783
740
 
784
- {/* Collapsed: the active account's primary quota and fleet status dot. */}
741
+ {/* Collapsed: the active account's lowest current figure and fleet status dot. */}
785
742
  <Show when={collapsed() && hasData()}>
786
743
  {(() => {
787
744
  const account = () =>
788
745
  visibleAccounts().find((entry) => entry.current) ??
789
746
  visibleAccounts()[0]
790
- const remaining = () => {
791
- const q = account()?.quota
792
- // The lowest remaining percentage among dated readings determines the warning tone.
793
- const gemini = quotaReadingParts('Gm', q?.gemini, now()).remaining
794
- const nonGemini = quotaReadingParts(
795
- 'NG',
796
- q?.['non-gemini'],
797
- now(),
798
- ).remaining
799
- if (gemini === null && nonGemini === null) return null
800
- return Math.min(gemini ?? 100, nonGemini ?? 100)
801
- }
802
- const poolText = (key: 'gemini' | 'non-gemini') => {
803
- const entry = account()?.quota[key]
804
- if (!entry)
805
- return `${QUOTA_LABELS[key]}: ${formatQuotaReading(QUOTA_LABELS[key], undefined, now())}`
806
- // Show binding window when available, else just pool label.
807
- const bindingWindow = entry.windows?.reduce<
808
- (typeof entry.windows)[0] | null
809
- >(
810
- (best, w) =>
811
- best === null || w.remainingPercent < best.remainingPercent
812
- ? w
813
- : best,
814
- null,
815
- )
816
- const gutter = bindingWindow
817
- ? ` ${WINDOW_GUTTER[bindingWindow.window] ?? bindingWindow.window}`
818
- : ''
819
- const text = formatQuotaReading(
820
- `${QUOTA_LABELS[key]}${gutter}`,
821
- bindingWindow ?? entry,
822
- now(),
823
- )
824
- return bindingWindow ? `${QUOTA_LABELS[key]} ${text}` : text
825
- }
826
747
  const unavailable = () => {
827
748
  const selected = account()
828
749
  return (
@@ -834,45 +755,50 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
834
755
  }
835
756
  return (
836
757
  <Show when={account()}>
837
- {(selected) => (
838
- <CollapsedRow theme={theme} label={selected().label}>
839
- <box flexDirection='row'>
840
- <text
841
- fg={toneColor(
842
- theme(),
843
- remaining() == null
844
- ? 'muted'
845
- : quotaTone(
846
- 100 - (remaining() ?? 100),
847
- prefs().appearance,
848
- ),
849
- )}
850
- >
851
- <b>
852
- {account()?.quota.gemini == null &&
853
- account()?.quota['non-gemini'] == null
854
- ? '—'
855
- : `${poolText('gemini')} · ${poolText('non-gemini')}`}
856
- </b>
857
- </text>
858
- <text
859
- fg={toneColor(
860
- theme(),
861
- unavailable()
862
- ? 'err'
863
- : remaining() == null
864
- ? 'muted'
865
- : quotaTone(
866
- 100 - (remaining() ?? 100),
867
- prefs().appearance,
868
- ),
869
- )}
870
- >
871
- {unavailable() ? ' ⊘' : ' ●'}
872
- </text>
873
- </box>
874
- </CollapsedRow>
875
- )}
758
+ {(selected) => {
759
+ const quota = () => collapsedQuota(selected(), now())
760
+ const tone = (): Tone => {
761
+ const remaining = quota().remaining
762
+ return remaining == null
763
+ ? 'muted'
764
+ : quotaTone(100 - remaining, prefs().appearance)
765
+ }
766
+ // Label, one space, the figure and the two-cell dot. The
767
+ // group prefix goes first when narrow; then the label is cut.
768
+ const figure = () => {
769
+ const { prefix, text } = quota()
770
+ const full = `${prefix}${text}`
771
+ return selected().label.length + 1 + full.length + 2 <=
772
+ contentWidth()
773
+ ? full
774
+ : text
775
+ }
776
+ const label = () =>
777
+ fitLabel(
778
+ selected().label,
779
+ contentWidth() - 1 - figure().length - 2,
780
+ )
781
+ return (
782
+ <CollapsedRow theme={theme} label={label()}>
783
+ <box flexDirection='row' flexShrink={0}>
784
+ <text
785
+ flexShrink={0}
786
+ wrapMode='none'
787
+ fg={toneColor(theme(), tone())}
788
+ >
789
+ <b>{figure()}</b>
790
+ </text>
791
+ <text
792
+ flexShrink={0}
793
+ wrapMode='none'
794
+ fg={toneColor(theme(), unavailable() ? 'err' : tone())}
795
+ >
796
+ {unavailable() ? ' ⊘' : ' ●'}
797
+ </text>
798
+ </box>
799
+ </CollapsedRow>
800
+ )
801
+ }}
876
802
  </Show>
877
803
  )
878
804
  })()}
@@ -899,28 +825,48 @@ export function SidebarPanel(props: SidebarPanelProps): JSX.Element {
899
825
  appearance={prefs().appearance}
900
826
  account={account}
901
827
  now={now}
828
+ width={contentWidth}
902
829
  marginTop={index() === 0 ? 0 : 1}
903
830
  />
904
831
  )}
905
832
  </For>
906
833
  </Show>
907
834
 
908
- {/* Routing */}
835
+ {/* Routing: the session's route, or one dim line before its first request. */}
909
836
  <Show when={prefs().sections.routing}>
910
837
  <SectionHeader theme={theme} title='Routing' />
911
838
  <Show
912
839
  when={currentRoute()}
913
840
  fallback={
914
- <StatRow theme={theme} label='Route' value='—' tone='muted' />
841
+ <text wrapMode='none' fg={theme().textMuted}>
842
+ {'No request yet'}
843
+ </text>
915
844
  }
916
845
  >
917
846
  {(route) => (
918
- <StatRow
919
- theme={theme}
920
- label='Route'
921
- value={`${route().strategy ? `${route().strategy} · ` : ''}${route().family}: ${route().style}`}
922
- tone='accent'
923
- />
847
+ <Show
848
+ when={routeLineFits(
849
+ 'Route',
850
+ routeValue(route()),
851
+ contentWidth(),
852
+ )}
853
+ fallback={
854
+ <For each={routeLines(route())}>
855
+ {(line) => (
856
+ <text wrapMode='none' fg={toneColor(theme(), 'accent')}>
857
+ <b>{line}</b>
858
+ </text>
859
+ )}
860
+ </For>
861
+ }
862
+ >
863
+ <StatRow
864
+ theme={theme}
865
+ label='Route'
866
+ value={routeValue(route())}
867
+ tone='accent'
868
+ />
869
+ </Show>
924
870
  )}
925
871
  </Show>
926
872
  </Show>