@slkiser/opencode-quota 5.0.3 → 6.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (794) hide show
  1. package/README.md +30 -44
  2. package/dist/agent-tools.d.ts +24 -0
  3. package/dist/agent-tools.d.ts.map +1 -0
  4. package/dist/agent-tools.js +578 -0
  5. package/dist/agent-tools.js.map +1 -0
  6. package/dist/bin/opencode-quota.d.ts.map +1 -1
  7. package/dist/bin/opencode-quota.js +1 -32
  8. package/dist/bin/opencode-quota.js.map +1 -1
  9. package/dist/core/errors.d.ts +12 -0
  10. package/dist/core/errors.d.ts.map +1 -0
  11. package/dist/core/errors.js +141 -0
  12. package/dist/core/errors.js.map +1 -0
  13. package/dist/core/pace.d.ts +13 -0
  14. package/dist/core/pace.d.ts.map +1 -0
  15. package/dist/core/pace.js +52 -0
  16. package/dist/core/pace.js.map +1 -0
  17. package/dist/core/persist.d.ts +44 -0
  18. package/dist/core/persist.d.ts.map +1 -0
  19. package/dist/core/persist.js +210 -0
  20. package/dist/core/persist.js.map +1 -0
  21. package/dist/core/provider-source.d.ts +40 -0
  22. package/dist/core/provider-source.d.ts.map +1 -0
  23. package/dist/core/provider-source.js +210 -0
  24. package/dist/core/provider-source.js.map +1 -0
  25. package/dist/core/redact.d.ts +17 -0
  26. package/dist/core/redact.d.ts.map +1 -0
  27. package/dist/core/redact.js +217 -0
  28. package/dist/core/redact.js.map +1 -0
  29. package/dist/core/rows.d.ts +20 -0
  30. package/dist/core/rows.d.ts.map +1 -0
  31. package/dist/core/rows.js +142 -0
  32. package/dist/core/rows.js.map +1 -0
  33. package/dist/core/selection.d.ts +15 -0
  34. package/dist/core/selection.d.ts.map +1 -0
  35. package/dist/core/selection.js +43 -0
  36. package/dist/core/selection.js.map +1 -0
  37. package/dist/core/snapshot-publisher.d.ts +15 -0
  38. package/dist/core/snapshot-publisher.d.ts.map +1 -0
  39. package/dist/core/snapshot-publisher.js +57 -0
  40. package/dist/core/snapshot-publisher.js.map +1 -0
  41. package/dist/core/store.d.ts +93 -0
  42. package/dist/core/store.d.ts.map +1 -0
  43. package/dist/core/store.js +563 -0
  44. package/dist/core/store.js.map +1 -0
  45. package/dist/core/types.d.ts +186 -0
  46. package/dist/core/types.d.ts.map +1 -0
  47. package/dist/core/types.js +2 -0
  48. package/dist/core/types.js.map +1 -0
  49. package/dist/core/usage-ranges.d.ts +46 -0
  50. package/dist/core/usage-ranges.d.ts.map +1 -0
  51. package/dist/core/usage-ranges.js +72 -0
  52. package/dist/core/usage-ranges.js.map +1 -0
  53. package/dist/core/usage.d.ts +100 -0
  54. package/dist/core/usage.d.ts.map +1 -0
  55. package/dist/core/usage.js +373 -0
  56. package/dist/core/usage.js.map +1 -0
  57. package/dist/core/validate.d.ts +8 -0
  58. package/dist/core/validate.d.ts.map +1 -0
  59. package/dist/core/validate.js +167 -0
  60. package/dist/core/validate.js.map +1 -0
  61. package/dist/core/windows.d.ts +24 -0
  62. package/dist/core/windows.d.ts.map +1 -0
  63. package/dist/core/windows.js +43 -0
  64. package/dist/core/windows.js.map +1 -0
  65. package/dist/index.d.ts +2 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/lib/accounting-format.d.ts +2 -52
  69. package/dist/lib/accounting-format.d.ts.map +1 -1
  70. package/dist/lib/accounting-format.js +6 -255
  71. package/dist/lib/accounting-format.js.map +1 -1
  72. package/dist/lib/alibaba-auth.d.ts +14 -21
  73. package/dist/lib/alibaba-auth.d.ts.map +1 -1
  74. package/dist/lib/alibaba-auth.js +36 -149
  75. package/dist/lib/alibaba-auth.js.map +1 -1
  76. package/dist/lib/alibaba-coding-plan-local-quota.d.ts +1 -6
  77. package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +1 -1
  78. package/dist/lib/alibaba-coding-plan-local-quota.js +1 -1
  79. package/dist/lib/alibaba-coding-plan-local-quota.js.map +1 -1
  80. package/dist/lib/alibaba-token-plan.d.ts +18 -27
  81. package/dist/lib/alibaba-token-plan.d.ts.map +1 -1
  82. package/dist/lib/alibaba-token-plan.js +121 -285
  83. package/dist/lib/alibaba-token-plan.js.map +1 -1
  84. package/dist/lib/anthropic-auth.d.ts +3 -5
  85. package/dist/lib/anthropic-auth.d.ts.map +1 -1
  86. package/dist/lib/anthropic-auth.js +6 -9
  87. package/dist/lib/anthropic-auth.js.map +1 -1
  88. package/dist/lib/anthropic.d.ts +12 -37
  89. package/dist/lib/anthropic.d.ts.map +1 -1
  90. package/dist/lib/anthropic.js +348 -698
  91. package/dist/lib/anthropic.js.map +1 -1
  92. package/dist/lib/api-key-resolver.d.ts +165 -192
  93. package/dist/lib/api-key-resolver.d.ts.map +1 -1
  94. package/dist/lib/api-key-resolver.js +208 -234
  95. package/dist/lib/api-key-resolver.js.map +1 -1
  96. package/dist/lib/atomic-json.d.ts +4 -1
  97. package/dist/lib/atomic-json.d.ts.map +1 -1
  98. package/dist/lib/atomic-json.js +2 -3
  99. package/dist/lib/atomic-json.js.map +1 -1
  100. package/dist/lib/calendar-date.d.ts +15 -0
  101. package/dist/lib/calendar-date.d.ts.map +1 -0
  102. package/dist/lib/calendar-date.js +21 -0
  103. package/dist/lib/calendar-date.js.map +1 -0
  104. package/dist/lib/chutes.d.ts +0 -1
  105. package/dist/lib/chutes.d.ts.map +1 -1
  106. package/dist/lib/chutes.js +2 -4
  107. package/dist/lib/chutes.js.map +1 -1
  108. package/dist/lib/cli-reports.d.ts +15 -11
  109. package/dist/lib/cli-reports.d.ts.map +1 -1
  110. package/dist/lib/cli-reports.js +34 -107
  111. package/dist/lib/cli-reports.js.map +1 -1
  112. package/dist/lib/cli-show.d.ts +9 -22
  113. package/dist/lib/cli-show.d.ts.map +1 -1
  114. package/dist/lib/cli-show.js +104 -75
  115. package/dist/lib/cli-show.js.map +1 -1
  116. package/dist/lib/config-file-utils.d.ts +3 -15
  117. package/dist/lib/config-file-utils.d.ts.map +1 -1
  118. package/dist/lib/config-file-utils.js +4 -63
  119. package/dist/lib/config-file-utils.js.map +1 -1
  120. package/dist/lib/config-write-target.d.ts +4 -7
  121. package/dist/lib/config-write-target.d.ts.map +1 -1
  122. package/dist/lib/config-write-target.js +4 -18
  123. package/dist/lib/config-write-target.js.map +1 -1
  124. package/dist/lib/copilot.d.ts +29 -20
  125. package/dist/lib/copilot.d.ts.map +1 -1
  126. package/dist/lib/copilot.js +392 -649
  127. package/dist/lib/copilot.js.map +1 -1
  128. package/dist/lib/cursor-detection.d.ts +3 -3
  129. package/dist/lib/cursor-detection.d.ts.map +1 -1
  130. package/dist/lib/cursor-detection.js +44 -88
  131. package/dist/lib/cursor-detection.js.map +1 -1
  132. package/dist/lib/cursor-pricing.d.ts +71 -8
  133. package/dist/lib/cursor-pricing.d.ts.map +1 -1
  134. package/dist/lib/cursor-pricing.js +33 -125
  135. package/dist/lib/cursor-pricing.js.map +1 -1
  136. package/dist/lib/cursor-usage.d.ts +6 -4
  137. package/dist/lib/cursor-usage.d.ts.map +1 -1
  138. package/dist/lib/cursor-usage.js +27 -40
  139. package/dist/lib/cursor-usage.js.map +1 -1
  140. package/dist/lib/deepseek.d.ts +9 -17
  141. package/dist/lib/deepseek.d.ts.map +1 -1
  142. package/dist/lib/deepseek.js +24 -54
  143. package/dist/lib/deepseek.js.map +1 -1
  144. package/dist/lib/display-sanitize.d.ts +0 -8
  145. package/dist/lib/display-sanitize.d.ts.map +1 -1
  146. package/dist/lib/display-sanitize.js +0 -139
  147. package/dist/lib/display-sanitize.js.map +1 -1
  148. package/dist/lib/entries.d.ts +13 -239
  149. package/dist/lib/entries.d.ts.map +1 -1
  150. package/dist/lib/entries.js +1 -46
  151. package/dist/lib/entries.js.map +1 -1
  152. package/dist/lib/file-lock.d.ts +23 -0
  153. package/dist/lib/file-lock.d.ts.map +1 -0
  154. package/dist/lib/file-lock.js +122 -0
  155. package/dist/lib/file-lock.js.map +1 -0
  156. package/dist/lib/format-utils.d.ts +2 -82
  157. package/dist/lib/format-utils.d.ts.map +1 -1
  158. package/dist/lib/format-utils.js +2 -191
  159. package/dist/lib/format-utils.js.map +1 -1
  160. package/dist/lib/glm-coding-plan.d.ts +6 -5
  161. package/dist/lib/glm-coding-plan.d.ts.map +1 -1
  162. package/dist/lib/glm-coding-plan.js +19 -1
  163. package/dist/lib/glm-coding-plan.js.map +1 -1
  164. package/dist/lib/google-agy.d.ts +8 -40
  165. package/dist/lib/google-agy.d.ts.map +1 -1
  166. package/dist/lib/google-agy.js +88 -519
  167. package/dist/lib/google-agy.js.map +1 -1
  168. package/dist/lib/google-companion-credentials.d.ts +9 -40
  169. package/dist/lib/google-companion-credentials.d.ts.map +1 -1
  170. package/dist/lib/google-companion-credentials.js +167 -224
  171. package/dist/lib/google-companion-credentials.js.map +1 -1
  172. package/dist/lib/google-gemini-cli.d.ts +5 -38
  173. package/dist/lib/google-gemini-cli.d.ts.map +1 -1
  174. package/dist/lib/google-gemini-cli.js +71 -442
  175. package/dist/lib/google-gemini-cli.js.map +1 -1
  176. package/dist/lib/google-oauth-quota.d.ts +76 -0
  177. package/dist/lib/google-oauth-quota.d.ts.map +1 -0
  178. package/dist/lib/google-oauth-quota.js +297 -0
  179. package/dist/lib/google-oauth-quota.js.map +1 -0
  180. package/dist/lib/google-token-cache.d.ts +3 -5
  181. package/dist/lib/google-token-cache.d.ts.map +1 -1
  182. package/dist/lib/google-token-cache.js +2 -14
  183. package/dist/lib/google-token-cache.js.map +1 -1
  184. package/dist/lib/home-dir-display.d.ts.map +1 -1
  185. package/dist/lib/home-dir-display.js +21 -39
  186. package/dist/lib/home-dir-display.js.map +1 -1
  187. package/dist/lib/http.d.ts +4 -1
  188. package/dist/lib/http.d.ts.map +1 -1
  189. package/dist/lib/http.js +2 -1
  190. package/dist/lib/http.js.map +1 -1
  191. package/dist/lib/json-guards.d.ts +11 -0
  192. package/dist/lib/json-guards.d.ts.map +1 -0
  193. package/dist/lib/json-guards.js +25 -0
  194. package/dist/lib/json-guards.js.map +1 -0
  195. package/dist/lib/kilo.d.ts +0 -2
  196. package/dist/lib/kilo.d.ts.map +1 -1
  197. package/dist/lib/kilo.js +33 -116
  198. package/dist/lib/kilo.js.map +1 -1
  199. package/dist/lib/kimi-endpoints.d.ts +2 -2
  200. package/dist/lib/kimi-endpoints.d.ts.map +1 -1
  201. package/dist/lib/kimi-endpoints.js +1 -1
  202. package/dist/lib/kimi-endpoints.js.map +1 -1
  203. package/dist/lib/kimi.d.ts.map +1 -1
  204. package/dist/lib/kimi.js +40 -86
  205. package/dist/lib/kimi.js.map +1 -1
  206. package/dist/lib/maintainer-announcements.d.ts +4 -17
  207. package/dist/lib/maintainer-announcements.d.ts.map +1 -1
  208. package/dist/lib/maintainer-announcements.js +7 -44
  209. package/dist/lib/maintainer-announcements.js.map +1 -1
  210. package/dist/lib/maintainer-home-notice.d.ts +19 -0
  211. package/dist/lib/maintainer-home-notice.d.ts.map +1 -0
  212. package/dist/lib/maintainer-home-notice.js +92 -0
  213. package/dist/lib/maintainer-home-notice.js.map +1 -0
  214. package/dist/lib/mimo-config.d.ts +6 -9
  215. package/dist/lib/mimo-config.d.ts.map +1 -1
  216. package/dist/lib/mimo-config.js +43 -74
  217. package/dist/lib/mimo-config.js.map +1 -1
  218. package/dist/lib/mimo.d.ts +2 -5
  219. package/dist/lib/mimo.d.ts.map +1 -1
  220. package/dist/lib/mimo.js +57 -109
  221. package/dist/lib/mimo.js.map +1 -1
  222. package/dist/lib/minimax-endpoints.d.ts +2 -2
  223. package/dist/lib/minimax-endpoints.d.ts.map +1 -1
  224. package/dist/lib/minimax-endpoints.js +1 -1
  225. package/dist/lib/minimax-endpoints.js.map +1 -1
  226. package/dist/lib/modelsdev-pricing.d.ts +22 -16
  227. package/dist/lib/modelsdev-pricing.d.ts.map +1 -1
  228. package/dist/lib/modelsdev-pricing.js +279 -560
  229. package/dist/lib/modelsdev-pricing.js.map +1 -1
  230. package/dist/lib/nanogpt.d.ts +6 -6
  231. package/dist/lib/nanogpt.d.ts.map +1 -1
  232. package/dist/lib/nanogpt.js +19 -72
  233. package/dist/lib/nanogpt.js.map +1 -1
  234. package/dist/lib/ollama-cloud.d.ts +3 -6
  235. package/dist/lib/ollama-cloud.d.ts.map +1 -1
  236. package/dist/lib/ollama-cloud.js +26 -37
  237. package/dist/lib/ollama-cloud.js.map +1 -1
  238. package/dist/lib/openai.d.ts +18 -29
  239. package/dist/lib/openai.d.ts.map +1 -1
  240. package/dist/lib/openai.js +108 -182
  241. package/dist/lib/openai.js.map +1 -1
  242. package/dist/lib/opencode-auth-sqlite.d.ts.map +1 -1
  243. package/dist/lib/opencode-auth-sqlite.js +22 -23
  244. package/dist/lib/opencode-auth-sqlite.js.map +1 -1
  245. package/dist/lib/opencode-auth.d.ts +17 -11
  246. package/dist/lib/opencode-auth.d.ts.map +1 -1
  247. package/dist/lib/opencode-auth.js +39 -46
  248. package/dist/lib/opencode-auth.js.map +1 -1
  249. package/dist/lib/opencode-config-editor.d.ts +3 -34
  250. package/dist/lib/opencode-config-editor.d.ts.map +1 -1
  251. package/dist/lib/opencode-config-editor.js +23 -142
  252. package/dist/lib/opencode-config-editor.js.map +1 -1
  253. package/dist/lib/opencode-config-providers.d.ts +4 -3
  254. package/dist/lib/opencode-config-providers.d.ts.map +1 -1
  255. package/dist/lib/opencode-config-providers.js +7 -11
  256. package/dist/lib/opencode-config-providers.js.map +1 -1
  257. package/dist/lib/opencode-config-read.d.ts +2 -1
  258. package/dist/lib/opencode-config-read.d.ts.map +1 -1
  259. package/dist/lib/opencode-config-read.js +3 -2
  260. package/dist/lib/opencode-config-read.js.map +1 -1
  261. package/dist/lib/opencode-console-auth.d.ts +2 -3
  262. package/dist/lib/opencode-console-auth.d.ts.map +1 -1
  263. package/dist/lib/opencode-console-auth.js +2 -2
  264. package/dist/lib/opencode-console-auth.js.map +1 -1
  265. package/dist/lib/opencode-go.d.ts.map +1 -1
  266. package/dist/lib/opencode-go.js +51 -79
  267. package/dist/lib/opencode-go.js.map +1 -1
  268. package/dist/lib/opencode-storage.d.ts +18 -3
  269. package/dist/lib/opencode-storage.d.ts.map +1 -1
  270. package/dist/lib/opencode-storage.js +134 -2
  271. package/dist/lib/opencode-storage.js.map +1 -1
  272. package/dist/lib/opencode-zen.d.ts +15 -12
  273. package/dist/lib/opencode-zen.d.ts.map +1 -1
  274. package/dist/lib/opencode-zen.js +139 -147
  275. package/dist/lib/opencode-zen.js.map +1 -1
  276. package/dist/lib/openrouter.d.ts.map +1 -1
  277. package/dist/lib/openrouter.js +1 -13
  278. package/dist/lib/openrouter.js.map +1 -1
  279. package/dist/lib/pricing-key.d.ts +48 -0
  280. package/dist/lib/pricing-key.d.ts.map +1 -0
  281. package/dist/lib/pricing-key.js +371 -0
  282. package/dist/lib/pricing-key.js.map +1 -0
  283. package/dist/lib/provider-metadata.d.ts +16 -20
  284. package/dist/lib/provider-metadata.d.ts.map +1 -1
  285. package/dist/lib/provider-metadata.js +69 -69
  286. package/dist/lib/provider-metadata.js.map +1 -1
  287. package/dist/lib/provider-model-matching.d.ts +2 -1
  288. package/dist/lib/provider-model-matching.d.ts.map +1 -1
  289. package/dist/lib/provider-registration.d.ts +1 -177
  290. package/dist/lib/provider-registration.d.ts.map +1 -1
  291. package/dist/lib/provider-registration.js +1 -163
  292. package/dist/lib/provider-registration.js.map +1 -1
  293. package/dist/lib/quota-dialog-commands.d.ts +87 -53
  294. package/dist/lib/quota-dialog-commands.d.ts.map +1 -1
  295. package/dist/lib/quota-dialog-commands.js +259 -519
  296. package/dist/lib/quota-dialog-commands.js.map +1 -1
  297. package/dist/lib/quota-export-types.d.ts +29 -23
  298. package/dist/lib/quota-export-types.d.ts.map +1 -1
  299. package/dist/lib/quota-export.d.ts +16 -26
  300. package/dist/lib/quota-export.d.ts.map +1 -1
  301. package/dist/lib/quota-export.js +105 -147
  302. package/dist/lib/quota-export.js.map +1 -1
  303. package/dist/lib/quota-providers-local.d.ts +12 -8
  304. package/dist/lib/quota-providers-local.d.ts.map +1 -1
  305. package/dist/lib/quota-providers-local.js +150 -223
  306. package/dist/lib/quota-providers-local.js.map +1 -1
  307. package/dist/lib/quota-providers-remote.d.ts +3 -8
  308. package/dist/lib/quota-providers-remote.d.ts.map +1 -1
  309. package/dist/lib/quota-providers-remote.js +309 -449
  310. package/dist/lib/quota-providers-remote.js.map +1 -1
  311. package/dist/lib/quota-providers.d.ts +57 -15
  312. package/dist/lib/quota-providers.d.ts.map +1 -1
  313. package/dist/lib/quota-providers.js +157 -64
  314. package/dist/lib/quota-providers.js.map +1 -1
  315. package/dist/lib/quota-report-message.d.ts +23 -10
  316. package/dist/lib/quota-report-message.d.ts.map +1 -1
  317. package/dist/lib/quota-report-message.js +37 -13
  318. package/dist/lib/quota-report-message.js.map +1 -1
  319. package/dist/lib/quota-retry-wait.d.ts +14 -6
  320. package/dist/lib/quota-retry-wait.d.ts.map +1 -1
  321. package/dist/lib/quota-retry-wait.js +37 -39
  322. package/dist/lib/quota-retry-wait.js.map +1 -1
  323. package/dist/lib/quota-status.d.ts +50 -33
  324. package/dist/lib/quota-status.d.ts.map +1 -1
  325. package/dist/lib/quota-status.js +1113 -773
  326. package/dist/lib/quota-status.js.map +1 -1
  327. package/dist/lib/quota-telemetry.d.ts +7 -14
  328. package/dist/lib/quota-telemetry.d.ts.map +1 -1
  329. package/dist/lib/quota-telemetry.js +46 -97
  330. package/dist/lib/quota-telemetry.js.map +1 -1
  331. package/dist/lib/report-document.d.ts +5 -65
  332. package/dist/lib/report-document.d.ts.map +1 -1
  333. package/dist/lib/report-document.js +14 -167
  334. package/dist/lib/report-document.js.map +1 -1
  335. package/dist/lib/resolved-auth-identity.d.ts +1 -2
  336. package/dist/lib/resolved-auth-identity.d.ts.map +1 -1
  337. package/dist/lib/resolved-auth-identity.js +0 -4
  338. package/dist/lib/resolved-auth-identity.js.map +1 -1
  339. package/dist/lib/session-tokens.d.ts +19 -19
  340. package/dist/lib/session-tokens.d.ts.map +1 -1
  341. package/dist/lib/session-tokens.js +58 -44
  342. package/dist/lib/session-tokens.js.map +1 -1
  343. package/dist/lib/synthetic.d.ts +0 -1
  344. package/dist/lib/synthetic.d.ts.map +1 -1
  345. package/dist/lib/synthetic.js +43 -94
  346. package/dist/lib/synthetic.js.map +1 -1
  347. package/dist/lib/token-buckets.d.ts +0 -1
  348. package/dist/lib/token-buckets.d.ts.map +1 -1
  349. package/dist/lib/token-buckets.js +0 -3
  350. package/dist/lib/token-buckets.js.map +1 -1
  351. package/dist/lib/token-cost.d.ts +2 -1
  352. package/dist/lib/token-cost.d.ts.map +1 -1
  353. package/dist/lib/types.d.ts +25 -333
  354. package/dist/lib/types.d.ts.map +1 -1
  355. package/dist/lib/types.js +2 -70
  356. package/dist/lib/types.js.map +1 -1
  357. package/dist/lib/xai.d.ts +6 -6
  358. package/dist/lib/xai.d.ts.map +1 -1
  359. package/dist/lib/xai.js +51 -90
  360. package/dist/lib/xai.js.map +1 -1
  361. package/dist/plugin.d.ts +6 -3
  362. package/dist/plugin.d.ts.map +1 -1
  363. package/dist/plugin.js +315 -90
  364. package/dist/plugin.js.map +1 -1
  365. package/dist/providers/alibaba-coding-plan.d.ts +4 -0
  366. package/dist/providers/alibaba-coding-plan.d.ts.map +1 -1
  367. package/dist/providers/alibaba-coding-plan.js +47 -77
  368. package/dist/providers/alibaba-coding-plan.js.map +1 -1
  369. package/dist/providers/alibaba-token-plan.d.ts.map +1 -1
  370. package/dist/providers/alibaba-token-plan.js +34 -46
  371. package/dist/providers/alibaba-token-plan.js.map +1 -1
  372. package/dist/providers/anthropic.d.ts +2 -4
  373. package/dist/providers/anthropic.d.ts.map +1 -1
  374. package/dist/providers/anthropic.js +80 -162
  375. package/dist/providers/anthropic.js.map +1 -1
  376. package/dist/providers/cache-policies.d.ts +0 -2
  377. package/dist/providers/cache-policies.d.ts.map +1 -1
  378. package/dist/providers/cache-policies.js +38 -88
  379. package/dist/providers/cache-policies.js.map +1 -1
  380. package/dist/providers/chutes.d.ts +0 -3
  381. package/dist/providers/chutes.d.ts.map +1 -1
  382. package/dist/providers/chutes.js +16 -28
  383. package/dist/providers/chutes.js.map +1 -1
  384. package/dist/providers/contract.d.ts +128 -0
  385. package/dist/providers/contract.d.ts.map +1 -0
  386. package/dist/providers/contract.js +101 -0
  387. package/dist/providers/contract.js.map +1 -0
  388. package/dist/providers/copilot.d.ts.map +1 -1
  389. package/dist/providers/copilot.js +171 -175
  390. package/dist/providers/copilot.js.map +1 -1
  391. package/dist/providers/cursor.d.ts.map +1 -1
  392. package/dist/providers/cursor.js +56 -109
  393. package/dist/providers/cursor.js.map +1 -1
  394. package/dist/providers/deepseek.d.ts +1 -6
  395. package/dist/providers/deepseek.d.ts.map +1 -1
  396. package/dist/providers/deepseek.js +46 -81
  397. package/dist/providers/deepseek.js.map +1 -1
  398. package/dist/providers/glm-coding-plan.d.ts +8 -0
  399. package/dist/providers/glm-coding-plan.d.ts.map +1 -0
  400. package/dist/providers/glm-coding-plan.js +106 -0
  401. package/dist/providers/glm-coding-plan.js.map +1 -0
  402. package/dist/providers/google-agy.d.ts +0 -1
  403. package/dist/providers/google-agy.d.ts.map +1 -1
  404. package/dist/providers/google-agy.js +41 -192
  405. package/dist/providers/google-agy.js.map +1 -1
  406. package/dist/providers/google-gemini-cli.d.ts.map +1 -1
  407. package/dist/providers/google-gemini-cli.js +51 -151
  408. package/dist/providers/google-gemini-cli.js.map +1 -1
  409. package/dist/providers/google-oauth-provider.d.ts +39 -0
  410. package/dist/providers/google-oauth-provider.d.ts.map +1 -0
  411. package/dist/providers/google-oauth-provider.js +161 -0
  412. package/dist/providers/google-oauth-provider.js.map +1 -0
  413. package/dist/providers/kilo.d.ts +0 -3
  414. package/dist/providers/kilo.d.ts.map +1 -1
  415. package/dist/providers/kilo.js +69 -123
  416. package/dist/providers/kilo.js.map +1 -1
  417. package/dist/providers/kimi-code.d.ts +5 -0
  418. package/dist/providers/kimi-code.d.ts.map +1 -1
  419. package/dist/providers/kimi-code.js +91 -136
  420. package/dist/providers/kimi-code.js.map +1 -1
  421. package/dist/providers/mimo.d.ts.map +1 -1
  422. package/dist/providers/mimo.js +55 -94
  423. package/dist/providers/mimo.js.map +1 -1
  424. package/dist/providers/minimax-coding-plan.d.ts +2 -23
  425. package/dist/providers/minimax-coding-plan.d.ts.map +1 -1
  426. package/dist/providers/minimax-coding-plan.js +161 -277
  427. package/dist/providers/minimax-coding-plan.js.map +1 -1
  428. package/dist/providers/nanogpt.d.ts +0 -3
  429. package/dist/providers/nanogpt.d.ts.map +1 -1
  430. package/dist/providers/nanogpt.js +61 -95
  431. package/dist/providers/nanogpt.js.map +1 -1
  432. package/dist/providers/ollama-cloud.d.ts +0 -6
  433. package/dist/providers/ollama-cloud.d.ts.map +1 -1
  434. package/dist/providers/ollama-cloud.js +86 -112
  435. package/dist/providers/ollama-cloud.js.map +1 -1
  436. package/dist/providers/openai.d.ts.map +1 -1
  437. package/dist/providers/openai.js +144 -166
  438. package/dist/providers/openai.js.map +1 -1
  439. package/dist/providers/opencode-go.d.ts.map +1 -1
  440. package/dist/providers/opencode-go.js +157 -199
  441. package/dist/providers/opencode-go.js.map +1 -1
  442. package/dist/providers/opencode-zen.d.ts.map +1 -1
  443. package/dist/providers/opencode-zen.js +100 -150
  444. package/dist/providers/opencode-zen.js.map +1 -1
  445. package/dist/providers/openrouter.d.ts +0 -3
  446. package/dist/providers/openrouter.d.ts.map +1 -1
  447. package/dist/providers/openrouter.js +26 -13
  448. package/dist/providers/openrouter.js.map +1 -1
  449. package/dist/providers/quota-providers.d.ts +7 -3
  450. package/dist/providers/quota-providers.d.ts.map +1 -1
  451. package/dist/providers/quota-providers.js +111 -217
  452. package/dist/providers/quota-providers.js.map +1 -1
  453. package/dist/providers/registry.d.ts.map +1 -1
  454. package/dist/providers/registry.js +1 -2
  455. package/dist/providers/registry.js.map +1 -1
  456. package/dist/providers/result-helpers.d.ts +10 -37
  457. package/dist/providers/result-helpers.d.ts.map +1 -1
  458. package/dist/providers/result-helpers.js +23 -56
  459. package/dist/providers/result-helpers.js.map +1 -1
  460. package/dist/providers/synthetic.d.ts +0 -3
  461. package/dist/providers/synthetic.d.ts.map +1 -1
  462. package/dist/providers/synthetic.js +16 -58
  463. package/dist/providers/synthetic.js.map +1 -1
  464. package/dist/providers/xai.d.ts +2 -1
  465. package/dist/providers/xai.d.ts.map +1 -1
  466. package/dist/providers/xai.js +49 -71
  467. package/dist/providers/xai.js.map +1 -1
  468. package/dist/rpc.d.ts +110 -38
  469. package/dist/rpc.d.ts.map +1 -1
  470. package/dist/rpc.js +125 -37
  471. package/dist/rpc.js.map +1 -1
  472. package/dist/settings/convert.d.ts +60 -0
  473. package/dist/settings/convert.d.ts.map +1 -0
  474. package/dist/settings/convert.js +473 -0
  475. package/dist/settings/convert.js.map +1 -0
  476. package/dist/settings/file.d.ts +89 -0
  477. package/dist/settings/file.d.ts.map +1 -0
  478. package/dist/settings/file.js +452 -0
  479. package/dist/settings/file.js.map +1 -0
  480. package/dist/settings/index.d.ts +10 -0
  481. package/dist/settings/index.d.ts.map +1 -0
  482. package/dist/settings/index.js +3 -0
  483. package/dist/settings/index.js.map +1 -0
  484. package/dist/settings/schema.d.ts +607 -0
  485. package/dist/settings/schema.d.ts.map +1 -0
  486. package/dist/settings/schema.js +479 -0
  487. package/dist/settings/schema.js.map +1 -0
  488. package/dist/tui/client.d.ts +86 -0
  489. package/dist/tui/client.d.ts.map +1 -0
  490. package/dist/tui/client.js +229 -0
  491. package/dist/tui/client.js.map +1 -0
  492. package/dist/tui/display.d.ts +127 -0
  493. package/dist/tui/display.d.ts.map +1 -0
  494. package/dist/tui/display.js +474 -0
  495. package/dist/tui/display.js.map +1 -0
  496. package/dist/tui/index.d.ts +21 -0
  497. package/dist/tui/index.d.ts.map +1 -0
  498. package/dist/tui/index.js +305 -0
  499. package/dist/tui/server-settings.d.ts +43 -0
  500. package/dist/tui/server-settings.d.ts.map +1 -0
  501. package/dist/tui/server-settings.js +233 -0
  502. package/dist/tui/server-settings.js.map +1 -0
  503. package/dist/tui/sidebar.d.ts +41 -0
  504. package/dist/tui/sidebar.d.ts.map +1 -0
  505. package/dist/tui/sidebar.js +148 -0
  506. package/dist/tui/status-line.d.ts +14 -0
  507. package/dist/tui/status-line.d.ts.map +1 -0
  508. package/dist/tui/status-line.js +225 -0
  509. package/dist/tui/theme.d.ts +41 -0
  510. package/dist/tui/theme.d.ts.map +1 -0
  511. package/dist/tui/theme.js +52 -0
  512. package/dist/tui/theme.js.map +1 -0
  513. package/dist/tui/toast-colors.d.ts +37 -0
  514. package/dist/tui/toast-colors.d.ts.map +1 -0
  515. package/dist/tui/toast-colors.js +77 -0
  516. package/dist/tui/toasts.d.ts +59 -0
  517. package/dist/tui/toasts.d.ts.map +1 -0
  518. package/dist/tui/toasts.js +148 -0
  519. package/dist/tui/toasts.js.map +1 -0
  520. package/dist/tui/window/drag.d.ts +26 -0
  521. package/dist/tui/window/drag.d.ts.map +1 -0
  522. package/dist/tui/window/drag.js +80 -0
  523. package/dist/tui/window/drag.js.map +1 -0
  524. package/dist/tui/window/limits.d.ts +15 -0
  525. package/dist/tui/window/limits.d.ts.map +1 -0
  526. package/dist/tui/window/limits.js +227 -0
  527. package/dist/tui/window/limits.js.map +1 -0
  528. package/dist/tui/window/rail.d.ts +21 -0
  529. package/dist/tui/window/rail.d.ts.map +1 -0
  530. package/dist/tui/window/rail.js +81 -0
  531. package/dist/tui/window/settings.d.ts +164 -0
  532. package/dist/tui/window/settings.d.ts.map +1 -0
  533. package/dist/tui/window/settings.js +1679 -0
  534. package/dist/tui/window/shell.d.ts +108 -0
  535. package/dist/tui/window/shell.d.ts.map +1 -0
  536. package/dist/tui/window/shell.js +1003 -0
  537. package/dist/tui/window/usage.d.ts +75 -0
  538. package/dist/tui/window/usage.d.ts.map +1 -0
  539. package/dist/tui/window/usage.js +928 -0
  540. package/dist/tui/window/views.d.ts +61 -0
  541. package/dist/tui/window/views.d.ts.map +1 -0
  542. package/dist/tui/window/views.js +242 -0
  543. package/dist/tui.d.ts +1 -5
  544. package/dist/tui.js +1 -894
  545. package/dist/view/columns.d.ts +15 -0
  546. package/dist/view/columns.d.ts.map +1 -0
  547. package/dist/view/columns.js +48 -0
  548. package/dist/view/columns.js.map +1 -0
  549. package/dist/view/format.d.ts +82 -0
  550. package/dist/view/format.d.ts.map +1 -0
  551. package/dist/view/format.js +201 -0
  552. package/dist/view/format.js.map +1 -0
  553. package/dist/view/quick-look.d.ts +28 -0
  554. package/dist/view/quick-look.d.ts.map +1 -0
  555. package/dist/view/quick-look.js +150 -0
  556. package/dist/view/quick-look.js.map +1 -0
  557. package/dist/view/select.d.ts +67 -0
  558. package/dist/view/select.d.ts.map +1 -0
  559. package/dist/view/select.js +87 -0
  560. package/dist/view/select.js.map +1 -0
  561. package/dist/view/text.d.ts +153 -0
  562. package/dist/view/text.d.ts.map +1 -0
  563. package/dist/view/text.js +642 -0
  564. package/dist/view/text.js.map +1 -0
  565. package/dist/view/usage.d.ts +86 -0
  566. package/dist/view/usage.d.ts.map +1 -0
  567. package/dist/view/usage.js +724 -0
  568. package/dist/view/usage.js.map +1 -0
  569. package/package.json +4 -6
  570. package/dist/lib/chutes-config.d.ts +0 -15
  571. package/dist/lib/chutes-config.d.ts.map +0 -1
  572. package/dist/lib/chutes-config.js +0 -28
  573. package/dist/lib/chutes-config.js.map +0 -1
  574. package/dist/lib/cli-status.d.ts +0 -8
  575. package/dist/lib/cli-status.d.ts.map +0 -1
  576. package/dist/lib/cli-status.js +0 -98
  577. package/dist/lib/cli-status.js.map +0 -1
  578. package/dist/lib/command-parsing.d.ts +0 -43
  579. package/dist/lib/command-parsing.d.ts.map +0 -1
  580. package/dist/lib/command-parsing.js +0 -103
  581. package/dist/lib/command-parsing.js.map +0 -1
  582. package/dist/lib/config.d.ts +0 -63
  583. package/dist/lib/config.d.ts.map +0 -1
  584. package/dist/lib/config.js +0 -1092
  585. package/dist/lib/config.js.map +0 -1
  586. package/dist/lib/deepseek-auth.d.ts +0 -15
  587. package/dist/lib/deepseek-auth.d.ts.map +0 -1
  588. package/dist/lib/deepseek-auth.js +0 -28
  589. package/dist/lib/deepseek-auth.js.map +0 -1
  590. package/dist/lib/format.d.ts +0 -25
  591. package/dist/lib/format.d.ts.map +0 -1
  592. package/dist/lib/format.js +0 -300
  593. package/dist/lib/format.js.map +0 -1
  594. package/dist/lib/google-agy-companion.d.ts +0 -8
  595. package/dist/lib/google-agy-companion.d.ts.map +0 -1
  596. package/dist/lib/google-agy-companion.js +0 -64
  597. package/dist/lib/google-agy-companion.js.map +0 -1
  598. package/dist/lib/google-gemini-cli-companion.d.ts +0 -8
  599. package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
  600. package/dist/lib/google-gemini-cli-companion.js +0 -64
  601. package/dist/lib/google-gemini-cli-companion.js.map +0 -1
  602. package/dist/lib/grouped-entry-normalization.d.ts +0 -12
  603. package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
  604. package/dist/lib/grouped-entry-normalization.js +0 -124
  605. package/dist/lib/grouped-entry-normalization.js.map +0 -1
  606. package/dist/lib/grouped-header-format.d.ts +0 -5
  607. package/dist/lib/grouped-header-format.d.ts.map +0 -1
  608. package/dist/lib/grouped-header-format.js +0 -16
  609. package/dist/lib/grouped-header-format.js.map +0 -1
  610. package/dist/lib/init-installer.d.ts +0 -123
  611. package/dist/lib/init-installer.d.ts.map +0 -1
  612. package/dist/lib/init-installer.js +0 -1111
  613. package/dist/lib/init-installer.js.map +0 -1
  614. package/dist/lib/jsonc.d.ts +0 -17
  615. package/dist/lib/jsonc.d.ts.map +0 -1
  616. package/dist/lib/jsonc.js +0 -23
  617. package/dist/lib/jsonc.js.map +0 -1
  618. package/dist/lib/kilo-config.d.ts +0 -15
  619. package/dist/lib/kilo-config.d.ts.map +0 -1
  620. package/dist/lib/kilo-config.js +0 -27
  621. package/dist/lib/kilo-config.js.map +0 -1
  622. package/dist/lib/kimi-auth.d.ts +0 -49
  623. package/dist/lib/kimi-auth.d.ts.map +0 -1
  624. package/dist/lib/kimi-auth.js +0 -82
  625. package/dist/lib/kimi-auth.js.map +0 -1
  626. package/dist/lib/markdown-table.d.ts +0 -51
  627. package/dist/lib/markdown-table.d.ts.map +0 -1
  628. package/dist/lib/markdown-table.js +0 -179
  629. package/dist/lib/markdown-table.js.map +0 -1
  630. package/dist/lib/minimax-auth.d.ts +0 -62
  631. package/dist/lib/minimax-auth.d.ts.map +0 -1
  632. package/dist/lib/minimax-auth.js +0 -206
  633. package/dist/lib/minimax-auth.js.map +0 -1
  634. package/dist/lib/nanogpt-config.d.ts +0 -15
  635. package/dist/lib/nanogpt-config.d.ts.map +0 -1
  636. package/dist/lib/nanogpt-config.js +0 -31
  637. package/dist/lib/nanogpt-config.js.map +0 -1
  638. package/dist/lib/ollama-cloud-config.d.ts +0 -15
  639. package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
  640. package/dist/lib/ollama-cloud-config.js +0 -27
  641. package/dist/lib/ollama-cloud-config.js.map +0 -1
  642. package/dist/lib/opencode-go-auth.d.ts +0 -16
  643. package/dist/lib/opencode-go-auth.d.ts.map +0 -1
  644. package/dist/lib/opencode-go-auth.js +0 -42
  645. package/dist/lib/opencode-go-auth.js.map +0 -1
  646. package/dist/lib/opencode-version.d.ts +0 -6
  647. package/dist/lib/opencode-version.d.ts.map +0 -1
  648. package/dist/lib/opencode-version.js +0 -26
  649. package/dist/lib/opencode-version.js.map +0 -1
  650. package/dist/lib/provider-add-command.d.ts +0 -35
  651. package/dist/lib/provider-add-command.d.ts.map +0 -1
  652. package/dist/lib/provider-add-command.js +0 -204
  653. package/dist/lib/provider-add-command.js.map +0 -1
  654. package/dist/lib/provider-add-json-v1-questionnaire.d.ts +0 -32
  655. package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
  656. package/dist/lib/provider-add-json-v1-questionnaire.js +0 -336
  657. package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
  658. package/dist/lib/provider-add.d.ts +0 -21
  659. package/dist/lib/provider-add.d.ts.map +0 -1
  660. package/dist/lib/provider-add.js +0 -219
  661. package/dist/lib/provider-add.js.map +0 -1
  662. package/dist/lib/quota-accounting-projection.d.ts +0 -9
  663. package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
  664. package/dist/lib/quota-accounting-projection.js +0 -254
  665. package/dist/lib/quota-accounting-projection.js.map +0 -1
  666. package/dist/lib/quota-columns.d.ts +0 -38
  667. package/dist/lib/quota-columns.d.ts.map +0 -1
  668. package/dist/lib/quota-columns.js +0 -129
  669. package/dist/lib/quota-columns.js.map +0 -1
  670. package/dist/lib/quota-command-format.d.ts +0 -34
  671. package/dist/lib/quota-command-format.d.ts.map +0 -1
  672. package/dist/lib/quota-command-format.js +0 -240
  673. package/dist/lib/quota-command-format.js.map +0 -1
  674. package/dist/lib/quota-dialog-command-specs.d.ts +0 -63
  675. package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
  676. package/dist/lib/quota-dialog-command-specs.js +0 -145
  677. package/dist/lib/quota-dialog-command-specs.js.map +0 -1
  678. package/dist/lib/quota-entry-display.d.ts +0 -7
  679. package/dist/lib/quota-entry-display.d.ts.map +0 -1
  680. package/dist/lib/quota-entry-display.js +0 -59
  681. package/dist/lib/quota-entry-display.js.map +0 -1
  682. package/dist/lib/quota-exhaustion-projection.d.ts +0 -11
  683. package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
  684. package/dist/lib/quota-exhaustion-projection.js +0 -105
  685. package/dist/lib/quota-exhaustion-projection.js.map +0 -1
  686. package/dist/lib/quota-format-style.d.ts +0 -21
  687. package/dist/lib/quota-format-style.d.ts.map +0 -1
  688. package/dist/lib/quota-format-style.js +0 -38
  689. package/dist/lib/quota-format-style.js.map +0 -1
  690. package/dist/lib/quota-render-data.d.ts +0 -102
  691. package/dist/lib/quota-render-data.d.ts.map +0 -1
  692. package/dist/lib/quota-render-data.js +0 -419
  693. package/dist/lib/quota-render-data.js.map +0 -1
  694. package/dist/lib/quota-reset-notifications.d.ts +0 -20
  695. package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
  696. package/dist/lib/quota-reset-notifications.js +0 -331
  697. package/dist/lib/quota-reset-notifications.js.map +0 -1
  698. package/dist/lib/quota-runtime-context.d.ts +0 -54
  699. package/dist/lib/quota-runtime-context.d.ts.map +0 -1
  700. package/dist/lib/quota-runtime-context.js +0 -110
  701. package/dist/lib/quota-runtime-context.js.map +0 -1
  702. package/dist/lib/quota-state-codec.d.ts +0 -16
  703. package/dist/lib/quota-state-codec.d.ts.map +0 -1
  704. package/dist/lib/quota-state-codec.js +0 -412
  705. package/dist/lib/quota-state-codec.js.map +0 -1
  706. package/dist/lib/quota-state.d.ts +0 -28
  707. package/dist/lib/quota-state.d.ts.map +0 -1
  708. package/dist/lib/quota-state.js +0 -473
  709. package/dist/lib/quota-state.js.map +0 -1
  710. package/dist/lib/quota-stats-format.d.ts +0 -29
  711. package/dist/lib/quota-stats-format.d.ts.map +0 -1
  712. package/dist/lib/quota-stats-format.js +0 -459
  713. package/dist/lib/quota-stats-format.js.map +0 -1
  714. package/dist/lib/quota-stats.d.ts +0 -126
  715. package/dist/lib/quota-stats.d.ts.map +0 -1
  716. package/dist/lib/quota-stats.js +0 -695
  717. package/dist/lib/quota-stats.js.map +0 -1
  718. package/dist/lib/quota-surface-data.d.ts +0 -21
  719. package/dist/lib/quota-surface-data.d.ts.map +0 -1
  720. package/dist/lib/quota-surface-data.js +0 -362
  721. package/dist/lib/quota-surface-data.js.map +0 -1
  722. package/dist/lib/scoped-update-migration.d.ts +0 -103
  723. package/dist/lib/scoped-update-migration.d.ts.map +0 -1
  724. package/dist/lib/scoped-update-migration.js +0 -344
  725. package/dist/lib/scoped-update-migration.js.map +0 -1
  726. package/dist/lib/scoped-update.d.ts +0 -77
  727. package/dist/lib/scoped-update.d.ts.map +0 -1
  728. package/dist/lib/scoped-update.js +0 -590
  729. package/dist/lib/scoped-update.js.map +0 -1
  730. package/dist/lib/session-tokens-format.d.ts +0 -36
  731. package/dist/lib/session-tokens-format.d.ts.map +0 -1
  732. package/dist/lib/session-tokens-format.js +0 -111
  733. package/dist/lib/session-tokens-format.js.map +0 -1
  734. package/dist/lib/synthetic-config.d.ts +0 -15
  735. package/dist/lib/synthetic-config.d.ts.map +0 -1
  736. package/dist/lib/synthetic-config.js +0 -28
  737. package/dist/lib/synthetic-config.js.map +0 -1
  738. package/dist/lib/toast-format-grouped.d.ts +0 -25
  739. package/dist/lib/toast-format-grouped.d.ts.map +0 -1
  740. package/dist/lib/toast-format-grouped.js +0 -296
  741. package/dist/lib/toast-format-grouped.js.map +0 -1
  742. package/dist/lib/tui-compact-format.d.ts +0 -10
  743. package/dist/lib/tui-compact-format.d.ts.map +0 -1
  744. package/dist/lib/tui-compact-format.js +0 -460
  745. package/dist/lib/tui-compact-format.js.map +0 -1
  746. package/dist/lib/tui-panel-state.d.ts +0 -15
  747. package/dist/lib/tui-panel-state.d.ts.map +0 -1
  748. package/dist/lib/tui-panel-state.js +0 -2
  749. package/dist/lib/tui-panel-state.js.map +0 -1
  750. package/dist/lib/tui-prompt-bar-format.d.ts +0 -25
  751. package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
  752. package/dist/lib/tui-prompt-bar-format.js +0 -206
  753. package/dist/lib/tui-prompt-bar-format.js.map +0 -1
  754. package/dist/lib/tui-sidebar-format.d.ts +0 -13
  755. package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
  756. package/dist/lib/tui-sidebar-format.js +0 -34
  757. package/dist/lib/tui-sidebar-format.js.map +0 -1
  758. package/dist/lib/zai-auth.d.ts +0 -15
  759. package/dist/lib/zai-auth.d.ts.map +0 -1
  760. package/dist/lib/zai-auth.js +0 -37
  761. package/dist/lib/zai-auth.js.map +0 -1
  762. package/dist/lib/zai.d.ts +0 -5
  763. package/dist/lib/zai.d.ts.map +0 -1
  764. package/dist/lib/zai.js +0 -14
  765. package/dist/lib/zai.js.map +0 -1
  766. package/dist/lib/zhipu-auth.d.ts +0 -15
  767. package/dist/lib/zhipu-auth.d.ts.map +0 -1
  768. package/dist/lib/zhipu-auth.js +0 -42
  769. package/dist/lib/zhipu-auth.js.map +0 -1
  770. package/dist/lib/zhipu.d.ts +0 -5
  771. package/dist/lib/zhipu.d.ts.map +0 -1
  772. package/dist/lib/zhipu.js +0 -13
  773. package/dist/lib/zhipu.js.map +0 -1
  774. package/dist/providers/glm-coding-plan-provider.d.ts +0 -56
  775. package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
  776. package/dist/providers/glm-coding-plan-provider.js +0 -115
  777. package/dist/providers/glm-coding-plan-provider.js.map +0 -1
  778. package/dist/providers/google-account-format.d.ts +0 -7
  779. package/dist/providers/google-account-format.d.ts.map +0 -1
  780. package/dist/providers/google-account-format.js +0 -52
  781. package/dist/providers/google-account-format.js.map +0 -1
  782. package/dist/providers/zai.d.ts +0 -2
  783. package/dist/providers/zai.d.ts.map +0 -1
  784. package/dist/providers/zai.js +0 -24
  785. package/dist/providers/zai.js.map +0 -1
  786. package/dist/providers/zhipu.d.ts +0 -2
  787. package/dist/providers/zhipu.d.ts.map +0 -1
  788. package/dist/providers/zhipu.js +0 -21
  789. package/dist/providers/zhipu.js.map +0 -1
  790. package/dist/tui-v2.d.ts +0 -5
  791. package/dist/tui-v2.d.ts.map +0 -1
  792. package/dist/tui-v2.jsx +0 -624
  793. package/dist/tui-v2.jsx.map +0 -1
  794. package/dist/tui.d.ts.map +0 -1
@@ -0,0 +1,1003 @@
1
+ import { use as _$use } from "@opentui/solid";
2
+ import { createComponent as _$createComponent } from "@opentui/solid";
3
+ import { memo as _$memo } from "@opentui/solid";
4
+ import { effect as _$effect } from "@opentui/solid";
5
+ import { createTextNode as _$createTextNode } from "@opentui/solid";
6
+ import { insertNode as _$insertNode } from "@opentui/solid";
7
+ import { insert as _$insert } from "@opentui/solid";
8
+ import { setProp as _$setProp } from "@opentui/solid";
9
+ import { createElement as _$createElement } from "@opentui/solid";
10
+ /** @jsxImportSource @opentui/solid */
11
+ /**
12
+ * The quota window. `/quota`, `/quota_usage`, `/quota_status` and `/quota_settings` open it
13
+ * above the message box of a session, where it covers the chat
14
+ * with the same size on every tab: Usage, Limits, Plugin and the Settings tabs Layout, Colors
15
+ * and Providers (`settings.tsx`); Layout has pages, All places and one per place. The tab bar is
16
+ * one line: the window's title and the plugin's version, the tabs, and "esc" at its right end to
17
+ * close the window. When its tabs don't fit, it drops the "Settings" label, then shows the tabs
18
+ * around the current one between ‹ and ›. Usage keeps its range list and Layout its page list
19
+ * left of the scrolling tab body (`rail.tsx`); a Settings tab's switch and warning sit above
20
+ * that body. The bottom line lists the tab's keys (Usage's as key and label pairs); the Settings
21
+ * tabs have Save and Discard above it. While the window is focused (it is after opening; click
22
+ * it to give it the keyboard again) its keys work: ↑↓ select or scroll,
23
+ * space/enter use a line, ←/→ change it, c on Limits copies its limits as text, tab switches
24
+ * tabs, esc closes. Closing gives the keyboard back to whatever had it before. Plugin shows the
25
+ * maintainer notices, the switches
26
+ * for other tools and the status report, each under its own title.
27
+ */
28
+
29
+ import { createSignal, onCleanup, onMount, Show } from "solid-js";
30
+ import { DEFAULT_USAGE_RANGE } from "../../core/usage-ranges.js";
31
+ import { sanitizeDisplayText } from "../../lib/display-sanitize.js";
32
+ import { quotaLimitsText } from "../../lib/quota-report-message.js";
33
+ import { getPackageVersion } from "../../lib/version.js";
34
+ import { QuotaRpc } from "../../rpc.js";
35
+ import { columnsOf } from "../../view/columns.js";
36
+ import { errorToast, quotaCallOptions, rpcErrorMessage } from "../client.js";
37
+ import { isSettingsTab, OptionRow, pagesRoom, SETTINGS_GROUPS } from "./settings.js";
38
+ import { Choice, createUsageTab, USAGE_RAIL_WIDTH } from "./usage.js";
39
+ import { LimitsView, NoticesView, StatusView } from "./views.js";
40
+ /** Plugin's switches (`system`), under their group's title; each saves straight away. */
41
+ const SYSTEM_SWITCHES = [{
42
+ key: "system.oldCommands",
43
+ group: "Commands",
44
+ title: "Old command names",
45
+ note: "the 4.x and 5.x /tokens_* names; the / list changes after a restart"
46
+ }, {
47
+ key: "system.exportFile",
48
+ group: "For other tools",
49
+ title: "Quota file (JSON)",
50
+ note: "for status bars and scripts; the opencode-quota CLI works either way"
51
+ }, {
52
+ key: "system.telemetry",
53
+ group: "For other tools",
54
+ title: "OpenTelemetry metrics"
55
+ }];
56
+ /** Columns inside the window until it knows its real width. */
57
+ const DEFAULT_WIDTH = 120;
58
+
59
+ /** A tab of the tab bar and the window tabs it shows: Layout shows one of its pages. */
60
+
61
+ /** The view tabs; the Settings tabs (`SETTINGS_GROUPS`) follow them under their own label. */
62
+ const TABS = [{
63
+ title: "Usage",
64
+ pages: ["usage"]
65
+ }, {
66
+ title: "Limits",
67
+ pages: ["limits"]
68
+ }, {
69
+ title: "Plugin",
70
+ pages: ["system"]
71
+ }];
72
+ /** Every tab in the order the tab bar shows them and tab and shift+tab go through them. */
73
+ const BAR_TABS = [...TABS, ...SETTINGS_GROUPS];
74
+ const WINDOW_TITLE = "OpenCode Quota";
75
+ const SETTINGS_LABEL = "Settings";
76
+ /** Between the tab bar's items. */
77
+ const TAB_GAP = 2;
78
+ /** "‹" or "›" and its gap. */
79
+ const ARROW_WIDTH = 1 + TAB_GAP;
80
+ /** The "esc" that closes the window, at the right end of the tab bar, and the gap before it. */
81
+ const CLOSE_WIDTH = "esc".length + TAB_GAP;
82
+
83
+ /** The tabs the tab bar shows, `first` to `last`, and whether "Settings" labels its group. */
84
+ const HINT_SEPARATOR = " · ";
85
+
86
+ /** The keyboard hint in `width` columns, its lines broken between " · " items, never inside one. */
87
+ export function hintLines(hint, width) {
88
+ const lines = [];
89
+ for (const item of hint.split(HINT_SEPARATOR)) {
90
+ const last = lines.length - 1;
91
+ if (last >= 0 && columnsOf(lines[last] + HINT_SEPARATOR + item) <= width) {
92
+ lines[last] += HINT_SEPARATOR + item;
93
+ } else {
94
+ lines.push(item);
95
+ }
96
+ }
97
+ return lines.join("\n");
98
+ }
99
+
100
+ /** A key and what it does, for a tab's bottom line; without a key, a note such as "updating…". */
101
+
102
+ const KEY_HINT_GAP = " ";
103
+ function keyHintText(hint) {
104
+ return hint.key ? `${hint.key} ${hint.label}` : hint.label;
105
+ }
106
+
107
+ /** The key hints in `width` columns, two spaces apart, lines broken between hints, never inside one. */
108
+ export function keyHintLines(hints, width) {
109
+ const lines = [];
110
+ let lineWidth = 0;
111
+ for (const hint of hints) {
112
+ const hintWidth = columnsOf(keyHintText(hint));
113
+ const last = lines.at(-1);
114
+ if (last && lineWidth + KEY_HINT_GAP.length + hintWidth <= width) {
115
+ last.push(hint);
116
+ lineWidth += KEY_HINT_GAP.length + hintWidth;
117
+ } else {
118
+ lines.push([hint]);
119
+ lineWidth = hintWidth;
120
+ }
121
+ }
122
+ return lines;
123
+ }
124
+ /**
125
+ * What fits in `room` columns after the window's title: every tab under both labels; every tab
126
+ * with a │ before the Settings tabs; or the tabs around `active` between ‹ and ›.
127
+ */
128
+ export function tabStrip(titles, settingsFrom, active, room) {
129
+ const runWidth = (first, last, label) => {
130
+ let width = 0;
131
+ for (let index = first; index <= last; index += 1) {
132
+ width += titles[index].length + (index > first ? TAB_GAP : 0);
133
+ }
134
+ if (first < settingsFrom && last >= settingsFrom) {
135
+ width += (label ? SETTINGS_LABEL.length : 1) + TAB_GAP;
136
+ }
137
+ return width;
138
+ };
139
+ const end = titles.length - 1;
140
+ if (runWidth(0, end, true) <= room) return {
141
+ first: 0,
142
+ last: end,
143
+ settingsLabel: true
144
+ };
145
+ if (runWidth(0, end, false) <= room) return {
146
+ first: 0,
147
+ last: end,
148
+ settingsLabel: false
149
+ };
150
+ const fits = (first, last) => runWidth(first, last, false) + (first > 0 ? ARROW_WIDTH : 0) + (last < end ? ARROW_WIDTH : 0) <= room;
151
+ let first = active;
152
+ let last = active;
153
+ for (let grew = true; grew;) {
154
+ grew = false;
155
+ if (last < end && fits(first, last + 1)) {
156
+ last += 1;
157
+ grew = true;
158
+ }
159
+ if (first > 0 && fits(first - 1, last)) {
160
+ first -= 1;
161
+ grew = true;
162
+ }
163
+ }
164
+ return {
165
+ first,
166
+ last,
167
+ settingsLabel: false
168
+ };
169
+ }
170
+
171
+ /** The theme tokens the window reads, besides the surfaces' ones (OpenCode's `ResolvedTheme`). */
172
+
173
+ /** Returning false lets the key continue to the next layer. */
174
+
175
+ /** What the window needs from OpenCode's TUI context (its theme and client types aren't installed). */
176
+
177
+ /** The session on screen; undefined on Home. */
178
+ export function routeSessionID(api) {
179
+ const route = api.ui.router.current();
180
+ return route.type === "session" ? route.sessionID : undefined;
181
+ }
182
+ const KEYS = "Quota window";
183
+ export function createQuotaWindow(api, host, settings) {
184
+ const [tab, setTab] = createSignal();
185
+ const [selected, setSelected] = createSignal("");
186
+ /** The page each tab of the tab bar showed last, by its title: Layout goes back to it. */
187
+ const lastPages = new Map();
188
+ const [notices, setNotices] = createSignal({
189
+ state: "loading"
190
+ });
191
+ const [status, setStatus] = createSignal({
192
+ state: "loading"
193
+ });
194
+ let windowBox;
195
+ let scroll;
196
+ /** What had the keyboard before the window opened (the message box), so closing gives it back. */
197
+ let focusBefore = null;
198
+ /**
199
+ * The window had the keyboard and nothing took it on purpose. A resize across the sidebar's
200
+ * breakpoint makes OpenCode give the keyboard to its message box, and OpenCode can draw the
201
+ * window again (a new box); the window then takes the keyboard back.
202
+ */
203
+ let keyboardWanted = false;
204
+ /** The terminal was resized in this turn of the event loop. */
205
+ let resizedThisTurn = false;
206
+ const onResize = () => {
207
+ resizedThisTurn = true;
208
+ setTimeout(() => {
209
+ resizedThisTurn = false;
210
+ }, 0);
211
+ };
212
+ /** Numbers the notice and status requests; only the newest one's answer shows. */
213
+ let noticeRequest = 0;
214
+ let statusRequest = 0;
215
+ /** Plugin switches whose save is not back yet; another flip of the same one is ignored. */
216
+ const savingSwitches = new Set();
217
+
218
+ // The RPC client is made per call, so nothing reaches OpenCode during plugin setup.
219
+ const rpc = () => api.client.rpc(QuotaRpc);
220
+ const options = () => quotaCallOptions(api);
221
+ const usage = createUsageTab(api, () => scroll);
222
+ const showError = error => api.ui.toast.show(errorToast(error));
223
+ /** The installed plugin's version from its package.json, like "v5.0.2", after the title. */
224
+ const [version, setVersion] = createSignal("");
225
+ void getPackageVersion().then(found => {
226
+ if (found) setVersion(`v${found}`);
227
+ });
228
+ async function loadNotices() {
229
+ const request = ++noticeRequest;
230
+ setNotices({
231
+ state: "loading"
232
+ });
233
+ try {
234
+ const board = await rpc().noticeList({}, options());
235
+ if (request === noticeRequest) setNotices({
236
+ state: "ready",
237
+ board
238
+ });
239
+ } catch (error) {
240
+ if (request !== noticeRequest) return;
241
+ setNotices({
242
+ state: "failed",
243
+ message: sanitizeDisplayText(rpcErrorMessage(error))
244
+ });
245
+ }
246
+ }
247
+ async function flipSwitch(key, on) {
248
+ if (savingSwitches.has(key)) return;
249
+ savingSwitches.add(key);
250
+ try {
251
+ await settings.saveSwitch(key, on);
252
+ } catch (error) {
253
+ showError(error);
254
+ } finally {
255
+ savingSwitches.delete(key);
256
+ }
257
+ }
258
+ async function loadStatus(sessionID) {
259
+ const request = ++statusRequest;
260
+ setStatus({
261
+ state: "loading"
262
+ });
263
+ try {
264
+ const output = await rpc().status(sessionID ? {
265
+ sessionID
266
+ } : {}, options());
267
+ if (request === statusRequest) setStatus({
268
+ state: "ready",
269
+ text: output.text
270
+ });
271
+ } catch (error) {
272
+ if (request !== statusRequest) return;
273
+ setStatus({
274
+ state: "failed",
275
+ message: sanitizeDisplayText(rpcErrorMessage(error))
276
+ });
277
+ }
278
+ }
279
+
280
+ /** The tab bar's tab that shows `shown`. */
281
+ function barTabOf(shown) {
282
+ return BAR_TABS.find(item => shown !== undefined && item.pages.includes(shown));
283
+ }
284
+
285
+ /** The page a tab of the tab bar opens on: the one it showed last, else its first. */
286
+ function pageOf(item) {
287
+ return lastPages.get(item.title) ?? item.pages[0];
288
+ }
289
+
290
+ /**
291
+ * Each tab asks the server again when it shows: Limits a refresh, the others their data. Usage
292
+ * shows `choice`: the default range, unless a command named one.
293
+ */
294
+ function showTab(next, choice = {
295
+ range: DEFAULT_USAGE_RANGE
296
+ }) {
297
+ const item = barTabOf(next);
298
+ if (item) lastPages.set(item.title, next);
299
+ settings.setTab(next);
300
+ setTab(next);
301
+ // A Settings line may have had the keyboard; it is gone with its tab.
302
+ windowBox?.focus();
303
+ const sessionID = routeSessionID(api);
304
+ if (next === "limits") void host.quota.refresh("manual", sessionID);
305
+ if (next === "system") {
306
+ void loadNotices();
307
+ void loadStatus(sessionID);
308
+ // Snapshots bring the saved settings too, so the switches show even if this read fails.
309
+ settings.loadSaved().catch(() => {});
310
+ }
311
+ if (next === "usage") usage.choose(choice);
312
+ if (next === "usage" && sessionID) usage.show(sessionID);
313
+ // Plugin picks Copy, so enter copies the report as soon as the tab opens.
314
+ setSelected(next === "system" ? "copy" : "");
315
+ scroll?.scrollTo(0);
316
+ }
317
+
318
+ /** Copies `text` and says in a toast titled `title` whether the terminal let it. */
319
+ function copyWithToast(text, title, messages) {
320
+ const copied = api.renderer.copyToClipboardOSC52(text);
321
+ api.ui.toast.show({
322
+ variant: copied ? "success" : "warning",
323
+ title,
324
+ message: copied ? messages.copied : messages.failed,
325
+ duration: 4_000
326
+ });
327
+ }
328
+ function copyReport() {
329
+ const report = status();
330
+ if (report.state !== "ready") return;
331
+ copyWithToast(report.text, "Status report", {
332
+ copied: "Copied. Paste it into a GitHub issue.",
333
+ failed: "This terminal doesn't allow copying; select the text instead."
334
+ });
335
+ }
336
+
337
+ /** c on Limits: every provider's limits as Web and Desktop /quota write them. */
338
+ function copyLimits(sessionID) {
339
+ const snapshot = host.quota.snapshot(sessionID);
340
+ if (!snapshot) {
341
+ api.ui.toast.show({
342
+ variant: "info",
343
+ title: "Limits",
344
+ message: "Quota is still loading.",
345
+ duration: 4_000
346
+ });
347
+ return;
348
+ }
349
+ copyWithToast(quotaLimitsText(snapshot, Date.now()), "Limits", {
350
+ copied: "Copied the limits report",
351
+ failed: "This terminal doesn't allow copying."
352
+ });
353
+ }
354
+
355
+ /**
356
+ * The lines that ↑↓ can select, under the notices: Plugin's switches (‹ on ›)
357
+ * once the saved settings arrived, then Copy (▸) above the status report.
358
+ */
359
+ function tabOptions() {
360
+ if (tab() !== "system") return [];
361
+ const copy = {
362
+ id: "copy",
363
+ group: "Status report",
364
+ title: "Copy the report",
365
+ value: () => "copy",
366
+ run: copyReport,
367
+ note: () => "then paste it into a GitHub issue"
368
+ };
369
+ const switches = SYSTEM_SWITCHES.flatMap(({
370
+ key,
371
+ group,
372
+ title,
373
+ note
374
+ }, index) => {
375
+ const on = settings.savedSwitch(key);
376
+ if (on === undefined) return [];
377
+ return [{
378
+ id: key,
379
+ ...(group !== SYSTEM_SWITCHES[index - 1]?.group ? {
380
+ group
381
+ } : {}),
382
+ title,
383
+ value: () => on ? "on" : "off",
384
+ cycle: () => void flipSwitch(key, !on),
385
+ ...(note ? {
386
+ note: () => note
387
+ } : {})
388
+ }];
389
+ });
390
+ return [...switches, copy];
391
+ }
392
+
393
+ /** Opens the window on `next`; on Usage, on `choice` (else the default range). */
394
+ function open(next, choice) {
395
+ if (!routeSessionID(api)) {
396
+ api.ui.toast.show({
397
+ variant: "info",
398
+ title: "OpenCode Quota",
399
+ message: "Open a session first: the quota window opens above its message box."
400
+ });
401
+ return;
402
+ }
403
+ if (tab() === undefined) focusBefore = api.renderer.currentFocusedRenderable;
404
+ showTab(next === "settings" ? pageOf(BAR_TABS[TABS.length]) : next, choice);
405
+ // The command leaves the message box focused; take the keyboard once it has settled.
406
+ setTimeout(() => windowBox?.focus(), 50);
407
+ }
408
+
409
+ /** Esc or Close. With unsaved settings the bottom bar asks first. */
410
+ function close() {
411
+ if (settings.askBeforeClose()) return;
412
+ settings.setTab(undefined);
413
+ setTab(undefined);
414
+ // Answers still on their way belong to the closed window.
415
+ noticeRequest += 1;
416
+ statusRequest += 1;
417
+ keyboardWanted = false;
418
+ if (focusBefore && !focusBefore.isDestroyed) focusBefore.focus();
419
+ focusBefore = null;
420
+ }
421
+ function switchTab(delta) {
422
+ const index = Math.max(0, BAR_TABS.indexOf(barTabOf(tab()) ?? BAR_TABS[0]));
423
+ showTab(pageOf(BAR_TABS[(index + delta + BAR_TABS.length) % BAR_TABS.length]));
424
+ }
425
+
426
+ /** ↑↓ select the next line; past the first or last one (or with none) they scroll. */
427
+ function select(delta) {
428
+ const ids = tabOptions().map(option => option.id);
429
+ const next = ids.indexOf(selected()) + delta;
430
+ if (ids.length === 0 || next < 0 || next >= ids.length) scroll?.scrollBy(delta);else setSelected(ids[next]);
431
+ }
432
+
433
+ /** Space or enter use any line; ←/→ only flip a switch. */
434
+ function useLine(option, anyKind) {
435
+ if (option?.cycle) option.cycle(1);else if (anyKind) option?.run?.();
436
+ }
437
+ const useSelected = anyKind => useLine(tabOptions().find(item => item.id === selected()), anyKind);
438
+ function Window(props) {
439
+ const theme = () => api.theme;
440
+ const [hasKeyboard, setHasKeyboard] = createSignal(false);
441
+ const [width, setWidth] = createSignal(DEFAULT_WIDTH);
442
+ const [nowMs, setNowMs] = createSignal(Date.now());
443
+ // Reset times and the pace count on between snapshots.
444
+ const clock = setInterval(() => setNowMs(Date.now()), 60_000);
445
+ onCleanup(() => clearInterval(clock));
446
+ const stopWatch = host.quota.watch(props.sessionID);
447
+ onCleanup(stopWatch);
448
+
449
+ // The window covers the whole chat, so it has the same size on every tab. OpenCode's
450
+ // session column holds the messages box (its first child holds the messages scrollbox),
451
+ // a one-line "Jump to latest" row, then the box with this slot and the message box. Room =
452
+ // the column minus its 1-line bottom padding, the other rows, and whatever else sits in
453
+ // that last box (the message box, queued prompts).
454
+ const [roomHeight, setRoomHeight] = createSignal();
455
+ function measureRoom() {
456
+ const box = windowBox;
457
+ if (!box || box.isDestroyed) return;
458
+ let child = box;
459
+ for (let parent = box.parent; parent; child = parent, parent = parent.parent) {
460
+ const siblings = parent.getChildren();
461
+ const messages = siblings[0];
462
+ if (messages === child || !messages?.getChildren().some(item => "scrollChildIntoView" in item)) {
463
+ continue;
464
+ }
465
+ const otherRows = siblings.filter(item => item !== child && item !== messages).reduce((total, item) => total + item.height, 0);
466
+ const room = Math.max(12, parent.height - 1 - otherRows - (child.height - box.height));
467
+ if (room !== roomHeight()) queueMicrotask(() => setRoomHeight(room));
468
+ return;
469
+ }
470
+ }
471
+ onMount(() => {
472
+ api.renderer.root.on("layout-changed", measureRoom);
473
+ onCleanup(() => api.renderer.root.off("layout-changed", measureRoom));
474
+ });
475
+ api.renderer.on("resize", onResize);
476
+ onCleanup(() => api.renderer.off("resize", onResize));
477
+ // This window's own boxes: when OpenCode draws the window again, the new one may already
478
+ // have set them before this one is cleaned up.
479
+ let ownBox;
480
+ let ownScroll;
481
+ onCleanup(() => {
482
+ if (windowBox === ownBox) windowBox = undefined;
483
+ if (scroll === ownScroll) scroll = undefined;
484
+ });
485
+
486
+ // Keys work only while this box has the keyboard; the message box keeps its own keys.
487
+ api.keymap.layer(() => ({
488
+ target: () => windowBox,
489
+ priority: 10,
490
+ // While a Settings line takes typed text, the keys go to its input.
491
+ enabled: () => !settings.typing(),
492
+ commands: [{
493
+ bind: "up",
494
+ title: "Previous line",
495
+ group: KEYS,
496
+ run: () => select(-1)
497
+ }, {
498
+ bind: "down",
499
+ title: "Next line",
500
+ group: KEYS,
501
+ run: () => select(1)
502
+ }, {
503
+ bind: "pageup",
504
+ title: "Scroll up one page",
505
+ group: KEYS,
506
+ run: () => scroll?.scrollBy(-(scroll.height || 1))
507
+ }, {
508
+ bind: "pagedown",
509
+ title: "Scroll down one page",
510
+ group: KEYS,
511
+ run: () => scroll?.scrollBy(scroll.height || 1)
512
+ }, {
513
+ bind: "space",
514
+ title: "Use the line",
515
+ group: KEYS,
516
+ run: () => useSelected(true)
517
+ }, {
518
+ bind: "return",
519
+ title: "Use the line",
520
+ group: KEYS,
521
+ run: () => useSelected(true)
522
+ }, {
523
+ bind: "left",
524
+ title: "Change the line",
525
+ group: KEYS,
526
+ run: () => useSelected(false)
527
+ }, {
528
+ bind: "right",
529
+ title: "Change the line",
530
+ group: KEYS,
531
+ run: () => useSelected(false)
532
+ }, {
533
+ bind: "c",
534
+ title: "Copy the limits report",
535
+ group: KEYS,
536
+ run: () => tab() === "limits" ? copyLimits(props.sessionID) : false
537
+ }, {
538
+ bind: "tab",
539
+ title: "Next tab",
540
+ group: KEYS,
541
+ run: () => switchTab(1)
542
+ }, {
543
+ bind: "shift+tab",
544
+ title: "Previous tab",
545
+ group: KEYS,
546
+ run: () => switchTab(-1)
547
+ }, {
548
+ bind: "escape",
549
+ title: "Close",
550
+ group: KEYS,
551
+ run: close
552
+ }]
553
+ }));
554
+ const settingsTab = () => {
555
+ const shown = tab();
556
+ return isSettingsTab(shown) ? shown : undefined;
557
+ };
558
+ const viewHint = () => {
559
+ const end = "tab next tab · esc close";
560
+ if (tab() === "limits") return `┃ where even use would be · c copy · ↑↓ scroll · ${end}`;
561
+ return `↑↓ select · space/enter or click to use · ‹ › (or ←/→) change · ${end}`;
562
+ };
563
+ const hint = () => settings.hint(tab() ?? "", hasKeyboard()) ?? (hasKeyboard() ? viewHint() : "The keyboard is somewhere else (the message box, a dialog). Click this box to use ↑↓ space tab esc here.");
564
+ /**
565
+ * Usage's own key hints while the tab or one of its dates has the keyboard, unless the
566
+ * bottom bar asks about unsaved settings.
567
+ */
568
+ const usageHints = () => {
569
+ if (tab() !== "usage") return undefined;
570
+ if (usage.typingDate()) return usage.hints();
571
+ if (!hasKeyboard() || settings.hint(tab() ?? "", true) !== undefined) return undefined;
572
+ return usage.hints();
573
+ };
574
+ /** Usage's key hints: each key bold in the text color, its label muted, two spaces apart. */
575
+ const KeyHints = hintProps => (() => {
576
+ var _el$ = _$createElement("box");
577
+ _$setProp(_el$, "flexDirection", "column");
578
+ _$setProp(_el$, "flexShrink", 0);
579
+ _$insert(_el$, () => keyHintLines(hintProps.hints, width()).map(line => (() => {
580
+ var _el$2 = _$createElement("text");
581
+ _$setProp(_el$2, "wrapMode", "none");
582
+ _$setProp(_el$2, "selectable", false);
583
+ _$insert(_el$2, () => line.flatMap((item, index) => [...(index > 0 ? [(() => {
584
+ var _el$3 = _$createElement("span");
585
+ _$insertNode(_el$3, _$createTextNode(` `));
586
+ _$effect(_$p => _$setProp(_el$3, "style", {
587
+ fg: theme().text.muted
588
+ }, _$p));
589
+ return _el$3;
590
+ })()] : []), ...(item.key ? [(() => {
591
+ var _el$5 = _$createElement("b");
592
+ _$insert(_el$5, () => item.key);
593
+ _$effect(_$p => _$setProp(_el$5, "style", {
594
+ fg: theme().text.base
595
+ }, _$p));
596
+ return _el$5;
597
+ })()] : []), (() => {
598
+ var _el$6 = _$createElement("span");
599
+ _$insert(_el$6, (() => {
600
+ var _c$ = _$memo(() => !!item.key);
601
+ return () => _c$() ? ` ${item.label}` : item.label;
602
+ })());
603
+ _$effect(_$p => _$setProp(_el$6, "style", {
604
+ fg: theme().text.muted
605
+ }, _$p));
606
+ return _el$6;
607
+ })()]));
608
+ return _el$2;
609
+ })()));
610
+ return _el$;
611
+ })();
612
+ /** The title and the version, as the tab bar shows them. */
613
+ const titleText = () => version() ? `${WINDOW_TITLE} ${version()}` : WINDOW_TITLE;
614
+ /** The drawn tab bodies' width: the scrollbar's column and a gap before it stay free. */
615
+ const bodyWidth = () => width() - 2;
616
+ const strip = () => tabStrip(BAR_TABS.map(item => item.title), TABS.length, Math.max(0, BAR_TABS.indexOf(barTabOf(tab()) ?? BAR_TABS[0])), width() - columnsOf(titleText()) - TAB_GAP - CLOSE_WIDTH);
617
+ const label = text => (() => {
618
+ var _el$7 = _$createElement("text"),
619
+ _el$8 = _$createElement("b");
620
+ _$insertNode(_el$7, _el$8);
621
+ _$setProp(_el$7, "wrapMode", "none");
622
+ _$setProp(_el$7, "selectable", false);
623
+ _$insert(_el$8, text);
624
+ _$effect(_$p => _$setProp(_el$7, "fg", theme().text.base, _$p));
625
+ return _el$7;
626
+ })();
627
+ const arrow = (text, delta) => (() => {
628
+ var _el$9 = _$createElement("text");
629
+ _$setProp(_el$9, "wrapMode", "none");
630
+ _$setProp(_el$9, "selectable", false);
631
+ _$insert(_el$9, text);
632
+ _$effect(_p$ => {
633
+ var _v$ = theme().text.action.primary.selected,
634
+ _v$2 = settings.click(() => switchTab(delta));
635
+ _v$ !== _p$.e && (_p$.e = _$setProp(_el$9, "fg", _v$, _p$.e));
636
+ _v$2 !== _p$.t && (_p$.t = _$setProp(_el$9, "onMouseUp", _v$2, _p$.t));
637
+ return _p$;
638
+ }, {
639
+ e: undefined,
640
+ t: undefined
641
+ });
642
+ return _el$9;
643
+ })();
644
+ /** The tab bar after the title: the shown tabs, with "Settings" or │ before the Settings tabs. */
645
+ const stripItems = () => {
646
+ const {
647
+ first,
648
+ last,
649
+ settingsLabel
650
+ } = strip();
651
+ const items = [];
652
+ for (let index = first; index <= last; index += 1) {
653
+ const item = BAR_TABS[index];
654
+ if (index === TABS.length && index > first) {
655
+ items.push(settingsLabel ? label(SETTINGS_LABEL) : (() => {
656
+ var _el$0 = _$createElement("text");
657
+ _$insertNode(_el$0, _$createTextNode(`│`));
658
+ _$setProp(_el$0, "wrapMode", "none");
659
+ _$setProp(_el$0, "selectable", false);
660
+ _$effect(_$p => _$setProp(_el$0, "fg", theme().text.muted, _$p));
661
+ return _el$0;
662
+ })());
663
+ }
664
+ items.push(_$createComponent(Choice, {
665
+ get label() {
666
+ return item.title;
667
+ },
668
+ get active() {
669
+ return barTabOf(tab()) === item;
670
+ },
671
+ get theme() {
672
+ return theme();
673
+ },
674
+ get run() {
675
+ return settings.click(() => showTab(pageOf(item)));
676
+ }
677
+ }));
678
+ }
679
+ return items;
680
+ };
681
+ return (() => {
682
+ var _el$10 = _$createElement("box"),
683
+ _el$11 = _$createElement("box"),
684
+ _el$12 = _$createElement("box"),
685
+ _el$13 = _$createElement("text"),
686
+ _el$14 = _$createElement("b"),
687
+ _el$16 = _$createElement("span"),
688
+ _el$17 = _$createElement("text"),
689
+ _el$19 = _$createElement("box"),
690
+ _el$20 = _$createElement("box"),
691
+ _el$21 = _$createElement("scrollbox"),
692
+ _el$22 = _$createElement("box"),
693
+ _el$23 = _$createElement("box");
694
+ _$insertNode(_el$10, _el$11);
695
+ _$insertNode(_el$10, _el$19);
696
+ _$insertNode(_el$10, _el$22);
697
+ _$use(element => {
698
+ windowBox = element;
699
+ ownBox = element;
700
+ element.on("focused", () => {
701
+ keyboardWanted = true;
702
+ setHasKeyboard(true);
703
+ });
704
+ element.on("blurred", () => {
705
+ setHasKeyboard(false);
706
+ // Decided once the event that took the keyboard is over: a resize took it (take it
707
+ // back), or a click elsewhere or a dialog did (leave it). A box drawn again loses it
708
+ // to its replacement, which takes it back.
709
+ queueMicrotask(() => {
710
+ if (windowBox !== element || element.isDestroyed) return;
711
+ if (resizedThisTurn && keyboardWanted) element.focus();else keyboardWanted = false;
712
+ });
713
+ });
714
+ // Drawn again while it had the keyboard: take it back once the new box is in place.
715
+ if (keyboardWanted) {
716
+ setTimeout(() => {
717
+ if (keyboardWanted && windowBox === element) element.focus();
718
+ }, 0);
719
+ }
720
+ }, _el$10);
721
+ _$setProp(_el$10, "focusable", true);
722
+ _$setProp(_el$10, "border", true);
723
+ _$setProp(_el$10, "borderStyle", "rounded");
724
+ _$setProp(_el$10, "paddingLeft", 1);
725
+ _$setProp(_el$10, "paddingRight", 1);
726
+ _$setProp(_el$10, "onMouseDown", () => {
727
+ settings.pressed();
728
+ if (!settings.typing()) windowBox?.focus();
729
+ });
730
+ _$setProp(_el$10, "onSizeChange", function () {
731
+ // Inside the border and the padding.
732
+ const measured = this.width - 4;
733
+ if (measured > 0 && measured !== width()) queueMicrotask(() => setWidth(measured));
734
+ });
735
+ _$insertNode(_el$11, _el$12);
736
+ _$insertNode(_el$11, _el$17);
737
+ _$setProp(_el$11, "flexDirection", "row");
738
+ _$setProp(_el$11, "flexShrink", 0);
739
+ _$insertNode(_el$12, _el$13);
740
+ _$setProp(_el$12, "flexDirection", "row");
741
+ _$setProp(_el$12, "columnGap", 2);
742
+ _$setProp(_el$12, "flexGrow", 1);
743
+ _$insertNode(_el$13, _el$14);
744
+ _$insertNode(_el$13, _el$16);
745
+ _$setProp(_el$13, "wrapMode", "none");
746
+ _$setProp(_el$13, "selectable", false);
747
+ _$insertNode(_el$14, _$createTextNode(`OpenCode Quota`));
748
+ _$insert(_el$16, (() => {
749
+ var _c$2 = _$memo(() => !!version());
750
+ return () => _c$2() ? ` ${version()}` : "";
751
+ })());
752
+ _$insert(_el$12, _$createComponent(Show, {
753
+ get when() {
754
+ return strip().first > 0;
755
+ },
756
+ get children() {
757
+ return arrow("‹", -1);
758
+ }
759
+ }), null);
760
+ _$insert(_el$12, stripItems, null);
761
+ _$insert(_el$12, _$createComponent(Show, {
762
+ get when() {
763
+ return strip().last < BAR_TABS.length - 1;
764
+ },
765
+ get children() {
766
+ return arrow("›", 1);
767
+ }
768
+ }), null);
769
+ _$insertNode(_el$17, _$createTextNode(`esc`));
770
+ _$setProp(_el$17, "selectable", false);
771
+ _$insertNode(_el$19, _el$20);
772
+ _$setProp(_el$19, "flexDirection", "row");
773
+ _$setProp(_el$19, "flexGrow", 1);
774
+ _$setProp(_el$19, "flexBasis", 0);
775
+ _$setProp(_el$19, "minHeight", 0);
776
+ _$setProp(_el$19, "marginTop", 1);
777
+ _$insert(_el$19, _$createComponent(Show, {
778
+ get when() {
779
+ return tab() === "usage";
780
+ },
781
+ get children() {
782
+ return _$createComponent(usage.Rail, {});
783
+ }
784
+ }), _el$20);
785
+ _$insert(_el$19, _$createComponent(Show, {
786
+ get when() {
787
+ return settingsTab();
788
+ },
789
+ children: shown => _$createComponent(settings.Pages, {
790
+ get tab() {
791
+ return shown();
792
+ },
793
+ showPage: showTab
794
+ })
795
+ }), _el$20);
796
+ _$insertNode(_el$20, _el$21);
797
+ _$setProp(_el$20, "flexDirection", "column");
798
+ _$setProp(_el$20, "flexGrow", 1);
799
+ _$setProp(_el$20, "overflow", "hidden");
800
+ _$insert(_el$20, _$createComponent(Show, {
801
+ get when() {
802
+ return settingsTab();
803
+ },
804
+ children: shown => _$createComponent(settings.Header, {
805
+ get tab() {
806
+ return shown();
807
+ },
808
+ refocus: () => windowBox?.focus()
809
+ })
810
+ }), _el$21);
811
+ _$use(element => {
812
+ scroll = element;
813
+ ownScroll = element;
814
+ }, _el$21);
815
+ _$setProp(_el$21, "flexGrow", 1);
816
+ _$setProp(_el$21, "flexBasis", 0);
817
+ _$setProp(_el$21, "minHeight", 0);
818
+ _$insert(_el$21, _$createComponent(Show, {
819
+ get when() {
820
+ return tab() === "system";
821
+ },
822
+ get children() {
823
+ return _$createComponent(NoticesView, {
824
+ get theme() {
825
+ return theme();
826
+ },
827
+ get report() {
828
+ return notices();
829
+ }
830
+ });
831
+ }
832
+ }), null);
833
+ _$insert(_el$21, () => tabOptions().map(option => _$createComponent(OptionRow, {
834
+ line: option,
835
+ get theme() {
836
+ return theme();
837
+ },
838
+ get active() {
839
+ return selected() === option.id;
840
+ },
841
+ get click() {
842
+ return settings.click;
843
+ },
844
+ press: () => setSelected(option.id),
845
+ use: () => useLine(option, true),
846
+ get valueWidth() {
847
+ return option.cycle ? 3 : 9;
848
+ },
849
+ get width() {
850
+ return bodyWidth();
851
+ }
852
+ })), null);
853
+ _$insert(_el$21, _$createComponent(Show, {
854
+ get when() {
855
+ return tab() === "limits";
856
+ },
857
+ get children() {
858
+ return _$createComponent(LimitsView, {
859
+ host: host,
860
+ get sessionID() {
861
+ return props.sessionID;
862
+ },
863
+ get nowMs() {
864
+ return nowMs();
865
+ },
866
+ get width() {
867
+ return bodyWidth();
868
+ }
869
+ });
870
+ }
871
+ }), null);
872
+ _$insert(_el$21, _$createComponent(Show, {
873
+ get when() {
874
+ return tab() === "usage";
875
+ },
876
+ get children() {
877
+ return _$createComponent(usage.View, {
878
+ get width() {
879
+ return bodyWidth() - USAGE_RAIL_WIDTH;
880
+ },
881
+ keyTarget: () => windowBox
882
+ });
883
+ }
884
+ }), null);
885
+ _$insert(_el$21, _$createComponent(Show, {
886
+ get when() {
887
+ return tab() === "system";
888
+ },
889
+ get children() {
890
+ return _$createComponent(StatusView, {
891
+ get theme() {
892
+ return theme();
893
+ },
894
+ get report() {
895
+ return status();
896
+ },
897
+ get width() {
898
+ return bodyWidth();
899
+ }
900
+ });
901
+ }
902
+ }), null);
903
+ _$insert(_el$21, _$createComponent(Show, {
904
+ get when() {
905
+ return settingsTab();
906
+ },
907
+ children: shown => _$createComponent(settings.Body, {
908
+ get tab() {
909
+ return shown();
910
+ },
911
+ showPage: showTab,
912
+ host: host,
913
+ get sessionID() {
914
+ return props.sessionID;
915
+ },
916
+ box: () => windowBox,
917
+ scroll: () => scroll,
918
+ get width() {
919
+ return bodyWidth() - pagesRoom(shown());
920
+ }
921
+ })
922
+ }), null);
923
+ _$insertNode(_el$22, _el$23);
924
+ _$setProp(_el$22, "flexDirection", "column");
925
+ _$setProp(_el$22, "marginTop", 1);
926
+ _$setProp(_el$22, "flexShrink", 0);
927
+ _$setProp(_el$23, "flexDirection", "row");
928
+ _$setProp(_el$23, "gap", 2);
929
+ _$insert(_el$23, _$createComponent(settings.Buttons, {
930
+ get tab() {
931
+ return tab() ?? "";
932
+ },
933
+ host: host,
934
+ get sessionID() {
935
+ return props.sessionID;
936
+ },
937
+ box: () => windowBox,
938
+ close: close
939
+ }));
940
+ _$insert(_el$22, _$createComponent(Show, {
941
+ get when() {
942
+ return usageHints();
943
+ },
944
+ get fallback() {
945
+ return (() => {
946
+ var _el$24 = _$createElement("text");
947
+ _$setProp(_el$24, "wrapMode", "word");
948
+ _$setProp(_el$24, "selectable", false);
949
+ _$insert(_el$24, () => hintLines(hint(), width()));
950
+ _$effect(_$p => _$setProp(_el$24, "fg", theme().text.muted, _$p));
951
+ return _el$24;
952
+ })();
953
+ },
954
+ children: hints => _$createComponent(KeyHints, {
955
+ get hints() {
956
+ return hints();
957
+ }
958
+ })
959
+ }), null);
960
+ _$effect(_p$ => {
961
+ var _v$3 = roomHeight(),
962
+ _v$4 = hasKeyboard() ? theme().text.action.primary.selected : theme().border.base,
963
+ _v$5 = theme().text.base,
964
+ _v$6 = {
965
+ fg: theme().text.muted
966
+ },
967
+ _v$7 = theme().text.muted,
968
+ _v$8 = settings.click(close);
969
+ _v$3 !== _p$.e && (_p$.e = _$setProp(_el$10, "height", _v$3, _p$.e));
970
+ _v$4 !== _p$.t && (_p$.t = _$setProp(_el$10, "borderColor", _v$4, _p$.t));
971
+ _v$5 !== _p$.a && (_p$.a = _$setProp(_el$13, "fg", _v$5, _p$.a));
972
+ _v$6 !== _p$.o && (_p$.o = _$setProp(_el$16, "style", _v$6, _p$.o));
973
+ _v$7 !== _p$.i && (_p$.i = _$setProp(_el$17, "fg", _v$7, _p$.i));
974
+ _v$8 !== _p$.n && (_p$.n = _$setProp(_el$17, "onMouseUp", _v$8, _p$.n));
975
+ return _p$;
976
+ }, {
977
+ e: undefined,
978
+ t: undefined,
979
+ a: undefined,
980
+ o: undefined,
981
+ i: undefined,
982
+ n: undefined
983
+ });
984
+ return _el$10;
985
+ })();
986
+ }
987
+ return {
988
+ open,
989
+ openUsage: choice => open("usage", choice),
990
+ Slot: props => _$createComponent(Show, {
991
+ get when() {
992
+ return tab() !== undefined;
993
+ },
994
+ get children() {
995
+ return _$createComponent(Window, {
996
+ get sessionID() {
997
+ return props.sessionID;
998
+ }
999
+ });
1000
+ }
1001
+ })
1002
+ };
1003
+ }