@cortexkit/opencode-openai-auth 0.11.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -26
- package/dist/index-766sfrh5.js +1 -0
- package/dist/index-8kj7sa1p.js +12 -0
- package/dist/index-8rqfbhfw.js +221 -0
- package/dist/index-b3q3j39x.js +2 -0
- package/dist/index-bmd7x5aq.js +2 -0
- package/dist/index-eqh53k8v.js +2 -0
- package/dist/{index-sdt2d2ra.js → index-hy9030jh.js} +1 -1
- package/dist/index-jyr8y8k4.js +7 -0
- package/dist/index-rv08jmd4.js +2 -0
- package/dist/index.d.ts +578 -145
- package/dist/index.js +1 -110
- package/dist/pool-lifecycle-DbDmgabd.d.ts +2430 -0
- package/dist/port-file-Do3lQIEk.d.ts +29 -0
- package/dist/protocol-BOBdkqqm.d.ts +198 -0
- package/dist/rpc/port-file.d.ts +4 -17
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.d.ts +2 -2
- package/dist/rpc/protocol.js +1 -0
- package/dist/rpc/rpc-client.d.ts +5 -4
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.d.ts +2 -0
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/sidebar-state-D6cUKgkm.d.ts +385 -0
- package/dist/sidebar-state.d.ts +2 -2
- package/dist/sidebar-state.js +1 -1
- package/dist/token-util-wdza526f.js +1 -0
- package/dist/{token-9823y0pc.js → token-ypk61xj0.js} +1 -1
- package/dist/tui-preferences.js +5 -2
- package/dist/tui.d.ts +9 -4
- package/dist/v2/server.d.ts +54 -0
- package/dist/v2/server.js +4 -0
- package/package.json +21 -9
- package/src/tui/entry.mjs +26 -25
- package/src/tui-compiled/raw/logger.js +24 -0
- package/src/tui-compiled/raw/rpc/protocol.js +3 -0
- package/src/tui-compiled/raw/rpc/rpc-client.js +7 -0
- package/src/tui-compiled/raw/rpc/rpc-dir.js +27 -0
- package/src/tui-compiled/raw/selector.js +21 -0
- package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +138 -0
- package/src/tui-compiled/raw/shared/04a6357627de5ed0-errors.js +38 -0
- package/src/tui-compiled/raw/shared/053cc17b5419261e-codec.js +12 -0
- package/src/tui-compiled/raw/shared/0766d78c6f481f18-watcher.js +157 -0
- package/src/tui-compiled/raw/shared/08eef45626a94992-reserved.js +13 -0
- package/src/tui-compiled/raw/shared/39c3cb05738fcf6d-projection.js +134 -0
- package/src/tui-compiled/raw/shared/3c2d4169d00f907e-tui-support.js +5 -0
- package/src/tui-compiled/raw/shared/3e7d45a77c6ad4d5-index.js +4 -0
- package/src/tui-compiled/raw/shared/415792e85d80819e-capture-sink.js +13 -0
- package/src/tui-compiled/raw/shared/42ae93ab554fcec2-open-url.js +28 -0
- package/src/tui-compiled/raw/shared/43fc9e6b994519c7-refresh-lock.js +136 -0
- package/src/tui-compiled/raw/shared/458b934e92490331-mutate.js +500 -0
- package/src/tui-compiled/raw/shared/45bf5343bbbf9add-admission.js +142 -0
- package/src/tui-compiled/raw/shared/46f3dff1266160e8-client.js +2 -0
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +48 -0
- package/src/tui-compiled/raw/shared/4f36d333d081d040-merge.js +162 -0
- package/src/tui-compiled/raw/shared/54eba94fd64c8c3c-index.js +7 -0
- package/src/tui-compiled/raw/shared/7211cfec06a298bc-atomic-write.js +80 -0
- package/src/tui-compiled/raw/shared/754d6017f8e419cf-builtins.js +534 -0
- package/src/tui-compiled/raw/shared/75bd8c3bd63b315f-identity.js +79 -0
- package/src/tui-compiled/raw/shared/7a91bb630e6f4804-index.js +1 -0
- package/src/tui-compiled/raw/shared/826342a4b6a8b89b-model.js +16 -0
- package/src/tui-compiled/raw/shared/83068c0dbe8a6f13-publication.js +304 -0
- package/src/tui-compiled/raw/shared/836fc615de6afbd9-settings.js +120 -0
- package/src/tui-compiled/raw/shared/83bc3ba9d0fe2761-runtime.js +68 -0
- package/src/tui-compiled/raw/shared/8a18abe4fa2977c8-menu.js +300 -0
- package/src/tui-compiled/raw/shared/901e149c5a0dbbff-sticky.js +339 -0
- package/src/tui-compiled/raw/shared/9020c407ce64f672-ordered.js +58 -0
- package/src/tui-compiled/raw/shared/905bffc0220f43d0-map.js +105 -0
- package/src/tui-compiled/raw/shared/94820e324f2b4c09-seam.js +301 -0
- package/src/tui-compiled/raw/shared/97484d9bb98c705b-provider-state.js +226 -0
- package/src/tui-compiled/raw/shared/9968e3cade6969a1-index.js +2 -0
- package/src/tui-compiled/raw/shared/9b4da614c45f9cd0-lock-constants.js +14 -0
- package/src/tui-compiled/raw/shared/9d3fc9e37456504e-refresh.js +225 -0
- package/src/tui-compiled/raw/shared/9deae3c4da4fd63b-hooks.js +34 -0
- package/src/tui-compiled/raw/shared/a09b6a533c11858f-tui-preferences.js +77 -0
- package/src/tui-compiled/raw/shared/a62a27a204266acd-attribution.js +60 -0
- package/src/tui-compiled/raw/shared/a910277ac43a8626-pull.js +143 -0
- package/src/tui-compiled/raw/shared/b85c5301fddcb98a-paths.js +5 -0
- package/src/tui-compiled/raw/shared/c14988621dc60a75-port-file.js +217 -0
- package/src/tui-compiled/raw/shared/c64d7afbc14ca125-sidebar-file.js +157 -0
- package/src/tui-compiled/raw/shared/c6b176708c446d6d-pins.js +34 -0
- package/src/tui-compiled/raw/shared/c7d252bedee01600-pi.js +206 -0
- package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +120 -0
- package/src/tui-compiled/raw/shared/cc9e0702a752cea7-index.js +3 -0
- package/src/tui-compiled/raw/shared/cd94316a888b0a8e-schema.js +754 -0
- package/src/tui-compiled/raw/shared/d319517e3ea6ad70-redact.js +83 -0
- package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +5 -0
- package/src/tui-compiled/raw/shared/d669d72c40e9e116-logger.js +19 -0
- package/src/tui-compiled/raw/shared/d7dcba96fea1685c-engine.js +246 -0
- package/src/tui-compiled/raw/shared/dbef697d1df1cd84-index.js +5 -0
- package/src/tui-compiled/raw/shared/e4acc4cb713f300c-protocol.js +3 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +501 -0
- package/src/tui-compiled/raw/shared/ec971142548df90e-index.js +6 -0
- package/src/tui-compiled/raw/shared/f37fcefc7aedbf25-error.js +11 -0
- package/src/tui-compiled/raw/shared/fbcdcd0f925e74c0-rpc-client.js +253 -0
- package/src/tui-compiled/raw/shared/fd45e82f2f9c0a0d-torn.js +294 -0
- package/src/tui-compiled/raw/shared/fe02abeadc535f77-rows.js +1258 -0
- package/src/tui-compiled/raw/sidebar-state.js +960 -0
- package/src/tui-compiled/raw/tui/command-dialogs.tsx +424 -0
- package/src/tui-compiled/raw/tui-preferences.js +135 -0
- package/src/tui-compiled/raw/tui.tsx +135 -143
- package/src/tui-compiled/runtime/logger.js +24 -0
- package/src/tui-compiled/runtime/rpc/protocol.js +3 -0
- package/src/tui-compiled/runtime/rpc/rpc-client.js +7 -0
- package/src/tui-compiled/runtime/rpc/rpc-dir.js +27 -0
- package/src/tui-compiled/runtime/selector.js +21 -0
- package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +138 -0
- package/src/tui-compiled/runtime/shared/04a6357627de5ed0-errors.js +38 -0
- package/src/tui-compiled/runtime/shared/053cc17b5419261e-codec.js +12 -0
- package/src/tui-compiled/runtime/shared/0766d78c6f481f18-watcher.js +157 -0
- package/src/tui-compiled/runtime/shared/08eef45626a94992-reserved.js +13 -0
- package/src/tui-compiled/runtime/shared/39c3cb05738fcf6d-projection.js +134 -0
- package/src/tui-compiled/runtime/shared/3c2d4169d00f907e-tui-support.js +5 -0
- package/src/tui-compiled/runtime/shared/3e7d45a77c6ad4d5-index.js +4 -0
- package/src/tui-compiled/runtime/shared/415792e85d80819e-capture-sink.js +13 -0
- package/src/tui-compiled/runtime/shared/42ae93ab554fcec2-open-url.js +28 -0
- package/src/tui-compiled/runtime/shared/43fc9e6b994519c7-refresh-lock.js +136 -0
- package/src/tui-compiled/runtime/shared/458b934e92490331-mutate.js +500 -0
- package/src/tui-compiled/runtime/shared/45bf5343bbbf9add-admission.js +142 -0
- package/src/tui-compiled/runtime/shared/46f3dff1266160e8-client.js +2 -0
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +48 -0
- package/src/tui-compiled/runtime/shared/4f36d333d081d040-merge.js +162 -0
- package/src/tui-compiled/runtime/shared/54eba94fd64c8c3c-index.js +7 -0
- package/src/tui-compiled/runtime/shared/7211cfec06a298bc-atomic-write.js +80 -0
- package/src/tui-compiled/runtime/shared/754d6017f8e419cf-builtins.js +534 -0
- package/src/tui-compiled/runtime/shared/75bd8c3bd63b315f-identity.js +79 -0
- package/src/tui-compiled/runtime/shared/7a91bb630e6f4804-index.js +1 -0
- package/src/tui-compiled/runtime/shared/826342a4b6a8b89b-model.js +16 -0
- package/src/tui-compiled/runtime/shared/83068c0dbe8a6f13-publication.js +304 -0
- package/src/tui-compiled/runtime/shared/836fc615de6afbd9-settings.js +120 -0
- package/src/tui-compiled/runtime/shared/83bc3ba9d0fe2761-runtime.js +68 -0
- package/src/tui-compiled/runtime/shared/8a18abe4fa2977c8-menu.js +300 -0
- package/src/tui-compiled/runtime/shared/901e149c5a0dbbff-sticky.js +339 -0
- package/src/tui-compiled/runtime/shared/9020c407ce64f672-ordered.js +58 -0
- package/src/tui-compiled/runtime/shared/905bffc0220f43d0-map.js +105 -0
- package/src/tui-compiled/runtime/shared/94820e324f2b4c09-seam.js +301 -0
- package/src/tui-compiled/runtime/shared/97484d9bb98c705b-provider-state.js +226 -0
- package/src/tui-compiled/runtime/shared/9968e3cade6969a1-index.js +2 -0
- package/src/tui-compiled/runtime/shared/9b4da614c45f9cd0-lock-constants.js +14 -0
- package/src/tui-compiled/runtime/shared/9d3fc9e37456504e-refresh.js +225 -0
- package/src/tui-compiled/runtime/shared/9deae3c4da4fd63b-hooks.js +34 -0
- package/src/tui-compiled/runtime/shared/a09b6a533c11858f-tui-preferences.js +77 -0
- package/src/tui-compiled/runtime/shared/a62a27a204266acd-attribution.js +60 -0
- package/src/tui-compiled/runtime/shared/a910277ac43a8626-pull.js +143 -0
- package/src/tui-compiled/runtime/shared/b85c5301fddcb98a-paths.js +5 -0
- package/src/tui-compiled/runtime/shared/c14988621dc60a75-port-file.js +217 -0
- package/src/tui-compiled/runtime/shared/c64d7afbc14ca125-sidebar-file.js +157 -0
- package/src/tui-compiled/runtime/shared/c6b176708c446d6d-pins.js +34 -0
- package/src/tui-compiled/runtime/shared/c7d252bedee01600-pi.js +206 -0
- package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +120 -0
- package/src/tui-compiled/runtime/shared/cc9e0702a752cea7-index.js +3 -0
- package/src/tui-compiled/runtime/shared/cd94316a888b0a8e-schema.js +754 -0
- package/src/tui-compiled/runtime/shared/d319517e3ea6ad70-redact.js +83 -0
- package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +5 -0
- package/src/tui-compiled/runtime/shared/d669d72c40e9e116-logger.js +19 -0
- package/src/tui-compiled/runtime/shared/d7dcba96fea1685c-engine.js +246 -0
- package/src/tui-compiled/runtime/shared/dbef697d1df1cd84-index.js +5 -0
- package/src/tui-compiled/runtime/shared/e4acc4cb713f300c-protocol.js +3 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +501 -0
- package/src/tui-compiled/runtime/shared/ec971142548df90e-index.js +6 -0
- package/src/tui-compiled/runtime/shared/f37fcefc7aedbf25-error.js +11 -0
- package/src/tui-compiled/runtime/shared/fbcdcd0f925e74c0-rpc-client.js +253 -0
- package/src/tui-compiled/runtime/shared/fd45e82f2f9c0a0d-torn.js +294 -0
- package/src/tui-compiled/runtime/shared/fe02abeadc535f77-rows.js +1258 -0
- package/src/tui-compiled/runtime/sidebar-state.js +960 -0
- package/src/tui-compiled/runtime/tui/command-dialogs.js +378 -0
- package/src/tui-compiled/runtime/tui-preferences.js +135 -0
- package/src/tui-compiled/runtime/{tui.tsx → tui.js} +288 -316
- package/dist/index-4effjmr6.js +0 -2
- package/dist/index-9ehhb051.js +0 -2
- package/dist/index-g3hsdjh4.js +0 -2
- package/dist/index-hh52v8sb.js +0 -2
- package/dist/index-jwn4r3sw.js +0 -1
- package/dist/index-sq36b120.js +0 -211
- package/dist/internal-BTndPmW2.d.ts +0 -914
- package/dist/quota-normalize-08hpp51v.js +0 -1
- package/dist/sidebar-state-CoKYKcLn.d.ts +0 -220
- package/dist/token-util-ypgz7rge.js +0 -1
- package/src/tui-compiled/raw/core-account-paths.ts +0 -114
- package/src/tui-compiled/raw/core-custody-state.ts +0 -243
- package/src/tui-compiled/raw/logger.ts +0 -53
- package/src/tui-compiled/raw/rpc-port-file.ts +0 -177
- package/src/tui-compiled/raw/rpc-protocol.ts +0 -12
- package/src/tui-compiled/raw/rpc-rpc-client.ts +0 -82
- package/src/tui-compiled/raw/rpc-rpc-dir.ts +0 -46
- package/src/tui-compiled/raw/sidebar-state.ts +0 -1659
- package/src/tui-compiled/raw/tui-command-dialogs.tsx +0 -1096
- package/src/tui-compiled/raw/tui-preferences.ts +0 -328
- package/src/tui-compiled/runtime/core-account-paths.ts +0 -114
- package/src/tui-compiled/runtime/core-custody-state.ts +0 -243
- package/src/tui-compiled/runtime/logger.ts +0 -53
- package/src/tui-compiled/runtime/rpc-port-file.ts +0 -177
- package/src/tui-compiled/runtime/rpc-protocol.ts +0 -12
- package/src/tui-compiled/runtime/rpc-rpc-client.ts +0 -82
- package/src/tui-compiled/runtime/rpc-rpc-dir.ts +0 -46
- package/src/tui-compiled/runtime/sidebar-state.ts +0 -1659
- package/src/tui-compiled/runtime/tui-command-dialogs.tsx +0 -855
- package/src/tui-compiled/runtime/tui-preferences.ts +0 -328
- package/src/tui-compiled/shared/internal.ts +0 -6
- package/src/tui-compiled/shared/logger.ts +0 -264
- package/src/tui-compiled/shared/paths.ts +0 -33
- package/src/tui-compiled/shared/refresh-file-lock.ts +0 -384
- package/src/tui-compiled/shared/util/error.ts +0 -9
- package/src/tui-compiled/shared/util/open-url.ts +0 -30
|
@@ -11,25 +11,36 @@ import { createElement as _$createElement } from "opentui:runtime-module:%40open
|
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
12
|
import { dirname, join } from "node:path";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { formatQuota, quotaTextParts } from "./shared/d5a8f1061ee2f114-index.js";
|
|
14
15
|
import { createEffect, createSignal, For, onCleanup, Show } from "opentui:runtime-module:solid-js";
|
|
15
|
-
import { createLogger } from "./logger.
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
16
|
+
import { createLogger } from "./logger.js";
|
|
17
|
+
import { isNotifyPayload } from "./rpc/protocol.js";
|
|
18
|
+
import { createRpcClient } from "./rpc/rpc-client.js";
|
|
19
|
+
import { resolveRpcDir } from "./rpc/rpc-dir.js";
|
|
20
|
+
import { computeQuotaPacing, DEFAULT_SIDEBAR_STATE, getCollapsedQuotaSummary, getPresentQuotaWindows, getSidebarState, resolveActiveAccount, resolveSessionSidebarRouting, resolveSessionStickyAccount, sidebarQuotaProjection } from "./sidebar-state.js";
|
|
21
|
+
import { openCommandDialog } from "./tui/command-dialogs.js";
|
|
22
|
+
import { computeEffectiveOrder, DEFAULT_SLOT_ORDER, PLUGIN_KEY, queueTuiPreferenceUpdate, readTuiPreferencesFile, resolveOpenaiAuthPrefs, watchTuiPreferences } from "./tui-preferences.js";
|
|
21
23
|
const RPC_POLL_MS = 500;
|
|
22
24
|
let rpcPollStarted = false;
|
|
23
25
|
const log = createLogger('rpc-tui');
|
|
24
26
|
const ID = 'cortexkit.openai-auth';
|
|
25
|
-
|
|
27
|
+
|
|
28
|
+
/** One drawer action as the RPC apply request carries it, with its session. */
|
|
29
|
+
export function buildApplyRequest(request, sessionId) {
|
|
26
30
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
...request,
|
|
32
|
+
...(sessionId !== undefined ? {
|
|
33
|
+
sessionId
|
|
34
|
+
} : {})
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
37
|
|
|
38
|
+
/**
|
|
39
|
+
* How long the drawer waits for one action: a reset-credit redemption polls
|
|
40
|
+
* the provider and can take most of this.
|
|
41
|
+
*/
|
|
42
|
+
const MENU_APPLY_TIMEOUT_MS = 90_000;
|
|
43
|
+
|
|
33
44
|
// Read package metadata from the development source or either generated TUI
|
|
34
45
|
// variant. Avoid a JSON import because package.json sits outside the declaration
|
|
35
46
|
// build's rootDir.
|
|
@@ -232,6 +243,8 @@ function quotaRowLabels(quota) {
|
|
|
232
243
|
* cannot be tested without the host's rendering runtime.
|
|
233
244
|
*/
|
|
234
245
|
export function renderedQuotas(state) {
|
|
246
|
+
// In vault mode only the vault accounts are rendered.
|
|
247
|
+
if (state.vaultAccounts !== undefined) return state.vaultAccounts.filter(account => account.enabled).map(account => account.quota);
|
|
235
248
|
return [state.main?.quota ?? null, ...(state.fallbacks ?? []).filter(fallback => fallback.enabled).map(fallback => fallback.quota)];
|
|
236
249
|
}
|
|
237
250
|
export function computeQuotaLabelWidth(quotas) {
|
|
@@ -249,10 +262,20 @@ export function computeQuotaLabelWidth(quotas) {
|
|
|
249
262
|
// `labelWidth` comes from computeQuotaLabelWidth for rendered sidebars; callers
|
|
250
263
|
// that only inspect pacing may omit it and get this row set's own width.
|
|
251
264
|
export function buildQuotaRowsForDisplay(quota, now, pacingEnabled, labelWidth) {
|
|
265
|
+
const projection = sidebarQuotaProjection(quota, now);
|
|
252
266
|
const rows = getPresentQuotaWindows(quota).map(row => ({
|
|
253
267
|
key: row.key,
|
|
254
268
|
label: row.label,
|
|
255
269
|
window: row.window,
|
|
270
|
+
text: formatQuota(projection && {
|
|
271
|
+
...projection,
|
|
272
|
+
budget: undefined,
|
|
273
|
+
limits: projection.limits.filter(limit => limit.label === row.key)
|
|
274
|
+
}, {
|
|
275
|
+
now,
|
|
276
|
+
form: 'compact',
|
|
277
|
+
staleAfterMs: Number.POSITIVE_INFINITY
|
|
278
|
+
}),
|
|
256
279
|
pacing: pacingEnabled && row.windowMs !== null ? computeQuotaPacing(row.window, row.windowMs, now) : null
|
|
257
280
|
}));
|
|
258
281
|
const spendControl = quota?.spendControl;
|
|
@@ -260,6 +283,14 @@ export function buildQuotaRowsForDisplay(quota, now, pacingEnabled, labelWidth)
|
|
|
260
283
|
rows.push({
|
|
261
284
|
key: 'spendControl',
|
|
262
285
|
label: SPEND_CONTROL_LABEL,
|
|
286
|
+
text: formatQuota(projection && {
|
|
287
|
+
...projection,
|
|
288
|
+
limits: []
|
|
289
|
+
}, {
|
|
290
|
+
now,
|
|
291
|
+
form: 'compact',
|
|
292
|
+
staleAfterMs: Number.POSITIVE_INFINITY
|
|
293
|
+
}),
|
|
263
294
|
window: {
|
|
264
295
|
usedPercent: spendControl.usedPercent,
|
|
265
296
|
remainingPercent: spendControl.remainingPercent,
|
|
@@ -269,6 +300,12 @@ export function buildQuotaRowsForDisplay(quota, now, pacingEnabled, labelWidth)
|
|
|
269
300
|
});
|
|
270
301
|
}
|
|
271
302
|
const width = labelWidth ?? Math.max(3, ...rows.map(row => row.label.length + 1));
|
|
303
|
+
const parts = quotaTextParts(projection, {
|
|
304
|
+
now,
|
|
305
|
+
form: 'compact',
|
|
306
|
+
staleAfterMs: Number.POSITIVE_INFINITY
|
|
307
|
+
});
|
|
308
|
+
rows.sort((left, right) => parts.indexOf(left.text) - parts.indexOf(right.text));
|
|
272
309
|
return rows.map(row => ({
|
|
273
310
|
...row,
|
|
274
311
|
labelWidth: width
|
|
@@ -322,13 +359,12 @@ export function getAccountMetadataRows(resetCredits, spendControl) {
|
|
|
322
359
|
return rows;
|
|
323
360
|
}
|
|
324
361
|
|
|
325
|
-
// Quota window row: muted label left, tone-colored bar
|
|
326
|
-
//
|
|
362
|
+
// Quota window row: muted label left, tone-colored usage bar and shared quota text.
|
|
363
|
+
// When pacing data is present, the bar
|
|
327
364
|
// gains a pace segment and an off-pace window adds a muted subline with the
|
|
328
365
|
// reserve/deficit delta and the projected runout.
|
|
329
366
|
function QuotaRow(props) {
|
|
330
367
|
const used = () => props.window?.usedPercent ?? 0;
|
|
331
|
-
const reset = () => formatResetIn(props.window?.resetsAt);
|
|
332
368
|
const paceLine = () => {
|
|
333
369
|
const pacing = props.pacing;
|
|
334
370
|
if (!pacing || pacing.state === 'on-pace') return null;
|
|
@@ -342,26 +378,26 @@ function QuotaRow(props) {
|
|
|
342
378
|
},
|
|
343
379
|
get fallback() {
|
|
344
380
|
return (() => {
|
|
345
|
-
var _el$
|
|
346
|
-
_el$
|
|
347
|
-
_el$
|
|
348
|
-
_$insertNode(_el$
|
|
349
|
-
_$insertNode(_el$
|
|
350
|
-
_$setProp(_el$
|
|
351
|
-
_$setProp(_el$
|
|
352
|
-
_$insert(_el$
|
|
353
|
-
_$insertNode(_el$
|
|
381
|
+
var _el$15 = _$createElement("box"),
|
|
382
|
+
_el$16 = _$createElement("text"),
|
|
383
|
+
_el$17 = _$createElement("text");
|
|
384
|
+
_$insertNode(_el$15, _el$16);
|
|
385
|
+
_$insertNode(_el$15, _el$17);
|
|
386
|
+
_$setProp(_el$15, "width", '100%');
|
|
387
|
+
_$setProp(_el$15, "flexDirection", 'row');
|
|
388
|
+
_$insert(_el$16, () => props.label.padEnd(props.labelWidth));
|
|
389
|
+
_$insertNode(_el$17, _$createTextNode(`—`));
|
|
354
390
|
_$effect(_p$ => {
|
|
355
391
|
var _v$9 = props.theme.textMuted,
|
|
356
392
|
_v$0 = props.theme.textMuted;
|
|
357
|
-
_v$9 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
358
|
-
_v$0 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
393
|
+
_v$9 !== _p$.e && (_p$.e = _$setProp(_el$16, "fg", _v$9, _p$.e));
|
|
394
|
+
_v$0 !== _p$.t && (_p$.t = _$setProp(_el$17, "fg", _v$0, _p$.t));
|
|
359
395
|
return _p$;
|
|
360
396
|
}, {
|
|
361
397
|
e: undefined,
|
|
362
398
|
t: undefined
|
|
363
399
|
});
|
|
364
|
-
return _el$
|
|
400
|
+
return _el$15;
|
|
365
401
|
})();
|
|
366
402
|
},
|
|
367
403
|
get children() {
|
|
@@ -383,24 +419,13 @@ function QuotaRow(props) {
|
|
|
383
419
|
return quotaBarSegments(used(), props.appearance, props.pacing);
|
|
384
420
|
},
|
|
385
421
|
children: segment => (() => {
|
|
386
|
-
var _el$
|
|
387
|
-
_$insert(_el$
|
|
388
|
-
_$effect(_$p => _$setProp(_el$
|
|
389
|
-
return _el$
|
|
422
|
+
var _el$19 = _$createElement("text");
|
|
423
|
+
_$insert(_el$19, () => segment.text);
|
|
424
|
+
_$effect(_$p => _$setProp(_el$19, "fg", toneColor(props.theme, segment.tone), _$p));
|
|
425
|
+
return _el$19;
|
|
390
426
|
})()
|
|
391
427
|
}), _el$11);
|
|
392
|
-
_$insert(_el$11, () => ` ${
|
|
393
|
-
_$insert(_el$0, _$createComponent(Show, {
|
|
394
|
-
get when() {
|
|
395
|
-
return reset();
|
|
396
|
-
},
|
|
397
|
-
get children() {
|
|
398
|
-
var _el$12 = _$createElement("text");
|
|
399
|
-
_$insert(_el$12, reset);
|
|
400
|
-
_$effect(_$p => _$setProp(_el$12, "fg", props.theme.textMuted, _$p));
|
|
401
|
-
return _el$12;
|
|
402
|
-
}
|
|
403
|
-
}), null);
|
|
428
|
+
_$insert(_el$11, () => ` ${props.text.slice(props.label.length + 1)}`);
|
|
404
429
|
_$effect(_p$ => {
|
|
405
430
|
var _v$5 = props.theme.textMuted,
|
|
406
431
|
_v$6 = toneColor(props.theme, usageTone(used(), props.appearance));
|
|
@@ -417,26 +442,26 @@ function QuotaRow(props) {
|
|
|
417
442
|
return paceLine();
|
|
418
443
|
},
|
|
419
444
|
get children() {
|
|
420
|
-
var _el$
|
|
421
|
-
_el$
|
|
422
|
-
_el$
|
|
423
|
-
_$insertNode(_el$
|
|
424
|
-
_$insertNode(_el$
|
|
425
|
-
_$setProp(_el$
|
|
426
|
-
_$setProp(_el$
|
|
427
|
-
_$insert(_el$
|
|
428
|
-
_$insert(_el$
|
|
445
|
+
var _el$12 = _$createElement("box"),
|
|
446
|
+
_el$13 = _$createElement("text"),
|
|
447
|
+
_el$14 = _$createElement("text");
|
|
448
|
+
_$insertNode(_el$12, _el$13);
|
|
449
|
+
_$insertNode(_el$12, _el$14);
|
|
450
|
+
_$setProp(_el$12, "width", '100%');
|
|
451
|
+
_$setProp(_el$12, "flexDirection", 'row');
|
|
452
|
+
_$insert(_el$13, () => ''.padEnd(props.labelWidth));
|
|
453
|
+
_$insert(_el$14, paceLine);
|
|
429
454
|
_$effect(_p$ => {
|
|
430
455
|
var _v$7 = props.theme.textMuted,
|
|
431
456
|
_v$8 = toneColor(props.theme, props.pacing?.state === 'deficit' ? 'warn' : 'muted');
|
|
432
|
-
_v$7 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
433
|
-
_v$8 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
457
|
+
_v$7 !== _p$.e && (_p$.e = _$setProp(_el$13, "fg", _v$7, _p$.e));
|
|
458
|
+
_v$8 !== _p$.t && (_p$.t = _$setProp(_el$14, "fg", _v$8, _p$.t));
|
|
434
459
|
return _p$;
|
|
435
460
|
}, {
|
|
436
461
|
e: undefined,
|
|
437
462
|
t: undefined
|
|
438
463
|
});
|
|
439
|
-
return _el$
|
|
464
|
+
return _el$12;
|
|
440
465
|
}
|
|
441
466
|
})];
|
|
442
467
|
}
|
|
@@ -451,34 +476,34 @@ function AccountBlock(props) {
|
|
|
451
476
|
const statusTone = () => props.killed ? 'err' : props.active ? 'ok' : 'muted';
|
|
452
477
|
const rows = () => buildQuotaRowsForDisplay(props.quota, Date.now(), props.pacingEnabled, props.labelWidth);
|
|
453
478
|
return (() => {
|
|
454
|
-
var _el$
|
|
455
|
-
_el$
|
|
456
|
-
_el$
|
|
457
|
-
_el$
|
|
458
|
-
_el$
|
|
459
|
-
_el$
|
|
479
|
+
var _el$20 = _$createElement("box"),
|
|
480
|
+
_el$21 = _$createElement("box"),
|
|
481
|
+
_el$22 = _$createElement("text"),
|
|
482
|
+
_el$23 = _$createElement("b"),
|
|
483
|
+
_el$24 = _$createElement("text"),
|
|
484
|
+
_el$25 = _$createElement("b");
|
|
485
|
+
_$insertNode(_el$20, _el$21);
|
|
486
|
+
_$setProp(_el$20, "width", '100%');
|
|
487
|
+
_$setProp(_el$20, "flexDirection", 'column');
|
|
460
488
|
_$insertNode(_el$21, _el$22);
|
|
489
|
+
_$insertNode(_el$21, _el$24);
|
|
461
490
|
_$setProp(_el$21, "width", '100%');
|
|
462
|
-
_$setProp(_el$21, "flexDirection", '
|
|
491
|
+
_$setProp(_el$21, "flexDirection", 'row');
|
|
492
|
+
_$setProp(_el$21, "justifyContent", 'space-between');
|
|
463
493
|
_$insertNode(_el$22, _el$23);
|
|
464
|
-
_$
|
|
465
|
-
_$
|
|
466
|
-
_$
|
|
467
|
-
_$
|
|
468
|
-
_$insertNode(_el$23, _el$24);
|
|
469
|
-
_$insert(_el$24, () => props.name);
|
|
470
|
-
_$insertNode(_el$25, _el$26);
|
|
471
|
-
_$insert(_el$26, statusWord);
|
|
472
|
-
_$insert(_el$21, _$createComponent(Show, {
|
|
494
|
+
_$insert(_el$23, () => props.name);
|
|
495
|
+
_$insertNode(_el$24, _el$25);
|
|
496
|
+
_$insert(_el$25, statusWord);
|
|
497
|
+
_$insert(_el$20, _$createComponent(Show, {
|
|
473
498
|
get when() {
|
|
474
499
|
return isQuotaLoaded(props.quota);
|
|
475
500
|
},
|
|
476
501
|
get fallback() {
|
|
477
502
|
return (() => {
|
|
478
|
-
var _el$
|
|
479
|
-
_$insertNode(_el$
|
|
480
|
-
_$effect(_$p => _$setProp(_el$
|
|
481
|
-
return _el$
|
|
503
|
+
var _el$26 = _$createElement("text");
|
|
504
|
+
_$insertNode(_el$26, _$createTextNode(`checking…`));
|
|
505
|
+
_$effect(_$p => _$setProp(_el$26, "fg", props.theme.textMuted, _$p));
|
|
506
|
+
return _el$26;
|
|
482
507
|
})();
|
|
483
508
|
},
|
|
484
509
|
get children() {
|
|
@@ -488,10 +513,10 @@ function AccountBlock(props) {
|
|
|
488
513
|
},
|
|
489
514
|
get fallback() {
|
|
490
515
|
return (() => {
|
|
491
|
-
var _el$
|
|
492
|
-
_$insertNode(_el$
|
|
493
|
-
_$effect(_$p => _$setProp(_el$
|
|
494
|
-
return _el$
|
|
516
|
+
var _el$28 = _$createElement("text");
|
|
517
|
+
_$insertNode(_el$28, _$createTextNode(`—`));
|
|
518
|
+
_$effect(_$p => _$setProp(_el$28, "fg", props.theme.textMuted, _$p));
|
|
519
|
+
return _el$28;
|
|
495
520
|
})();
|
|
496
521
|
},
|
|
497
522
|
get children() {
|
|
@@ -512,6 +537,9 @@ function AccountBlock(props) {
|
|
|
512
537
|
get labelWidth() {
|
|
513
538
|
return row.labelWidth;
|
|
514
539
|
},
|
|
540
|
+
get text() {
|
|
541
|
+
return row.text;
|
|
542
|
+
},
|
|
515
543
|
get window() {
|
|
516
544
|
return row.window;
|
|
517
545
|
},
|
|
@@ -524,7 +552,21 @@ function AccountBlock(props) {
|
|
|
524
552
|
});
|
|
525
553
|
}
|
|
526
554
|
}), null);
|
|
527
|
-
_$insert(_el$
|
|
555
|
+
_$insert(_el$20, _$createComponent(For, {
|
|
556
|
+
get each() {
|
|
557
|
+
return quotaTextParts(sidebarQuotaProjection(props.quota, Date.now()), {
|
|
558
|
+
now: Date.now(),
|
|
559
|
+
form: 'compact'
|
|
560
|
+
}).filter(part => part.startsWith('checked '));
|
|
561
|
+
},
|
|
562
|
+
children: age => (() => {
|
|
563
|
+
var _el$30 = _$createElement("text");
|
|
564
|
+
_$insert(_el$30, age);
|
|
565
|
+
_$effect(_$p => _$setProp(_el$30, "fg", props.theme.textMuted, _$p));
|
|
566
|
+
return _el$30;
|
|
567
|
+
})()
|
|
568
|
+
}), null);
|
|
569
|
+
_$insert(_el$20, _$createComponent(For, {
|
|
528
570
|
get each() {
|
|
529
571
|
return getAccountMetadataRows(props.resetCredits, props.quota?.spendControl);
|
|
530
572
|
},
|
|
@@ -545,134 +587,16 @@ function AccountBlock(props) {
|
|
|
545
587
|
var _v$1 = props.marginTop ?? 0,
|
|
546
588
|
_v$10 = props.theme.text,
|
|
547
589
|
_v$11 = toneColor(props.theme, statusTone());
|
|
548
|
-
_v$1 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
549
|
-
_v$10 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
550
|
-
_v$11 !== _p$.a && (_p$.a = _$setProp(_el$
|
|
590
|
+
_v$1 !== _p$.e && (_p$.e = _$setProp(_el$20, "marginTop", _v$1, _p$.e));
|
|
591
|
+
_v$10 !== _p$.t && (_p$.t = _$setProp(_el$22, "fg", _v$10, _p$.t));
|
|
592
|
+
_v$11 !== _p$.a && (_p$.a = _$setProp(_el$24, "fg", _v$11, _p$.a));
|
|
551
593
|
return _p$;
|
|
552
594
|
}, {
|
|
553
595
|
e: undefined,
|
|
554
596
|
t: undefined,
|
|
555
597
|
a: undefined
|
|
556
598
|
});
|
|
557
|
-
return _el$
|
|
558
|
-
})();
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
// --- Quota dialog content ---------------------------------------------------
|
|
562
|
-
|
|
563
|
-
// Renders the same rich visualization as the sidebar (account blocks with
|
|
564
|
-
// quota bars + pacing) so the modal matches the sidebar look.
|
|
565
|
-
function QuotaDialogContent(props) {
|
|
566
|
-
const prefs = props.controller.prefs;
|
|
567
|
-
const [state, setState] = createSignal(DEFAULT_SIDEBAR_STATE);
|
|
568
|
-
let lastUpdated = 0;
|
|
569
|
-
async function refresh() {
|
|
570
|
-
const next = await readStateFromFile();
|
|
571
|
-
if (next.lastUpdated !== lastUpdated) {
|
|
572
|
-
lastUpdated = next.lastUpdated;
|
|
573
|
-
setState(next);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
createEffect(() => {
|
|
577
|
-
const timer = setInterval(refresh, prefs().pollMs);
|
|
578
|
-
onCleanup(() => clearInterval(timer));
|
|
579
|
-
});
|
|
580
|
-
setTimeout(refresh, 0);
|
|
581
|
-
const theme = () => props.api.theme.current;
|
|
582
|
-
const enabledFallbacks = () => (state().fallbacks ?? []).filter(f => f.enabled);
|
|
583
|
-
const activeId = () => resolveQuotaDialogActiveId(state(), props.sessionId);
|
|
584
|
-
const quotaLabelWidth = () => computeQuotaLabelWidth(renderedQuotas(state()));
|
|
585
|
-
return (() => {
|
|
586
|
-
var _el$31 = _$createElement("box"),
|
|
587
|
-
_el$32 = _$createElement("box"),
|
|
588
|
-
_el$33 = _$createElement("box"),
|
|
589
|
-
_el$34 = _$createElement("text"),
|
|
590
|
-
_el$35 = _$createElement("b");
|
|
591
|
-
_$insertNode(_el$31, _el$32);
|
|
592
|
-
_$setProp(_el$31, "flexDirection", 'column');
|
|
593
|
-
_$setProp(_el$31, "padding", 2);
|
|
594
|
-
_$setProp(_el$31, "width", '100%');
|
|
595
|
-
_$setProp(_el$31, "alignItems", 'center');
|
|
596
|
-
_$insertNode(_el$32, _el$33);
|
|
597
|
-
_$setProp(_el$32, "flexDirection", 'column');
|
|
598
|
-
_$setProp(_el$32, "width", 58);
|
|
599
|
-
_$insertNode(_el$33, _el$34);
|
|
600
|
-
_$setProp(_el$33, "width", '100%');
|
|
601
|
-
_$setProp(_el$33, "justifyContent", 'center');
|
|
602
|
-
_$setProp(_el$33, "marginBottom", 1);
|
|
603
|
-
_$insertNode(_el$34, _el$35);
|
|
604
|
-
_$insertNode(_el$35, _$createTextNode(`Codex Quota`));
|
|
605
|
-
_$insert(_el$32, _$createComponent(AccountBlock, {
|
|
606
|
-
get theme() {
|
|
607
|
-
return theme();
|
|
608
|
-
},
|
|
609
|
-
get appearance() {
|
|
610
|
-
return prefs().appearance;
|
|
611
|
-
},
|
|
612
|
-
name: "main",
|
|
613
|
-
get quota() {
|
|
614
|
-
return state().main?.quota ?? null;
|
|
615
|
-
},
|
|
616
|
-
get killed() {
|
|
617
|
-
return state().main?.killed ?? false;
|
|
618
|
-
},
|
|
619
|
-
get active() {
|
|
620
|
-
return activeId() === 'main';
|
|
621
|
-
},
|
|
622
|
-
get pacingEnabled() {
|
|
623
|
-
return prefs().sections.pacing;
|
|
624
|
-
},
|
|
625
|
-
get labelWidth() {
|
|
626
|
-
return quotaLabelWidth();
|
|
627
|
-
},
|
|
628
|
-
get resetCredits() {
|
|
629
|
-
return state().main?.resetCredits;
|
|
630
|
-
}
|
|
631
|
-
}), null);
|
|
632
|
-
_$insert(_el$32, _$createComponent(Show, {
|
|
633
|
-
get when() {
|
|
634
|
-
return prefs().sections.fallbackAccounts;
|
|
635
|
-
},
|
|
636
|
-
get children() {
|
|
637
|
-
return _$createComponent(For, {
|
|
638
|
-
get each() {
|
|
639
|
-
return enabledFallbacks();
|
|
640
|
-
},
|
|
641
|
-
children: fb => _$createComponent(AccountBlock, {
|
|
642
|
-
get theme() {
|
|
643
|
-
return theme();
|
|
644
|
-
},
|
|
645
|
-
get appearance() {
|
|
646
|
-
return prefs().appearance;
|
|
647
|
-
},
|
|
648
|
-
get name() {
|
|
649
|
-
return fb.label ?? fb.id;
|
|
650
|
-
},
|
|
651
|
-
get quota() {
|
|
652
|
-
return fb.quota;
|
|
653
|
-
},
|
|
654
|
-
get killed() {
|
|
655
|
-
return fb.killed;
|
|
656
|
-
},
|
|
657
|
-
get active() {
|
|
658
|
-
return activeId() === fb.id;
|
|
659
|
-
},
|
|
660
|
-
get pacingEnabled() {
|
|
661
|
-
return prefs().sections.pacing;
|
|
662
|
-
},
|
|
663
|
-
get labelWidth() {
|
|
664
|
-
return quotaLabelWidth();
|
|
665
|
-
},
|
|
666
|
-
get resetCredits() {
|
|
667
|
-
return fb.resetCredits;
|
|
668
|
-
},
|
|
669
|
-
marginTop: 1
|
|
670
|
-
})
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
}), null);
|
|
674
|
-
_$effect(_$p => _$setProp(_el$34, "fg", theme().text, _$p));
|
|
675
|
-
return _el$31;
|
|
599
|
+
return _el$20;
|
|
676
600
|
})();
|
|
677
601
|
}
|
|
678
602
|
|
|
@@ -789,7 +713,11 @@ function QuotaSidebar(props) {
|
|
|
789
713
|
});
|
|
790
714
|
const theme = () => props.api.theme.current;
|
|
791
715
|
const enabledFallbacks = () => (state().fallbacks ?? []).filter(f => f.enabled);
|
|
792
|
-
|
|
716
|
+
// Vault mode: the host uses only the vault's accounts, which the file lists
|
|
717
|
+
// in `vaultAccounts`; main and the local fallbacks are not shown.
|
|
718
|
+
const vaultMode = () => state().vaultAccounts !== undefined;
|
|
719
|
+
const enabledVaultAccounts = () => (state().vaultAccounts ?? []).filter(account => account.enabled);
|
|
720
|
+
const hasData = () => vaultMode() ? enabledVaultAccounts().length > 0 : state().main?.quota != null || enabledFallbacks().length > 0;
|
|
793
721
|
const headerLabel = () => {
|
|
794
722
|
const name = prefs().header.label;
|
|
795
723
|
return !hasData() ? name : collapsed() ? `\u25b6 ${name}` : `\u25bc ${name}`;
|
|
@@ -822,33 +750,33 @@ function QuotaSidebar(props) {
|
|
|
822
750
|
const refreshBackedOff = () => state().main?.refreshBackedOff === true;
|
|
823
751
|
const degraded = () => killedNames().length > 0 || quotaBackedOff() || refreshBackedOff();
|
|
824
752
|
return (() => {
|
|
825
|
-
var _el$
|
|
826
|
-
_el$
|
|
827
|
-
_el$
|
|
828
|
-
_el$
|
|
829
|
-
_el$
|
|
830
|
-
_$insertNode(_el$
|
|
831
|
-
_$setProp(_el$
|
|
832
|
-
_$setProp(_el$
|
|
833
|
-
_$setProp(_el$
|
|
834
|
-
_$setProp(_el$
|
|
835
|
-
_$setProp(_el$
|
|
836
|
-
_$setProp(_el$
|
|
837
|
-
_$setProp(_el$
|
|
838
|
-
_$insertNode(_el$
|
|
839
|
-
_$setProp(_el$
|
|
840
|
-
_$setProp(_el$
|
|
841
|
-
_$setProp(_el$
|
|
842
|
-
_$setProp(_el$
|
|
843
|
-
_$setProp(_el$
|
|
753
|
+
var _el$31 = _$createElement("box"),
|
|
754
|
+
_el$32 = _$createElement("box"),
|
|
755
|
+
_el$33 = _$createElement("box"),
|
|
756
|
+
_el$34 = _$createElement("text"),
|
|
757
|
+
_el$35 = _$createElement("b");
|
|
758
|
+
_$insertNode(_el$31, _el$32);
|
|
759
|
+
_$setProp(_el$31, "width", '100%');
|
|
760
|
+
_$setProp(_el$31, "flexDirection", 'column');
|
|
761
|
+
_$setProp(_el$31, "border", SINGLE_BORDER);
|
|
762
|
+
_$setProp(_el$31, "paddingTop", 1);
|
|
763
|
+
_$setProp(_el$31, "paddingBottom", 1);
|
|
764
|
+
_$setProp(_el$31, "paddingLeft", 1);
|
|
765
|
+
_$setProp(_el$31, "paddingRight", 1);
|
|
766
|
+
_$insertNode(_el$32, _el$33);
|
|
767
|
+
_$setProp(_el$32, "width", '100%');
|
|
768
|
+
_$setProp(_el$32, "flexDirection", 'row');
|
|
769
|
+
_$setProp(_el$32, "justifyContent", 'space-between');
|
|
770
|
+
_$setProp(_el$32, "alignItems", 'center');
|
|
771
|
+
_$setProp(_el$32, "onMouseDown", () => {
|
|
844
772
|
if (hasData()) props.controller.toggleCollapsed();
|
|
845
773
|
});
|
|
846
|
-
_$insertNode(_el$
|
|
847
|
-
_$setProp(_el$
|
|
848
|
-
_$setProp(_el$
|
|
849
|
-
_$insertNode(_el$
|
|
850
|
-
_$insert(_el$
|
|
851
|
-
_$insert(_el$
|
|
774
|
+
_$insertNode(_el$33, _el$34);
|
|
775
|
+
_$setProp(_el$33, "paddingLeft", 1);
|
|
776
|
+
_$setProp(_el$33, "paddingRight", 1);
|
|
777
|
+
_$insertNode(_el$34, _el$35);
|
|
778
|
+
_$insert(_el$35, headerLabel);
|
|
779
|
+
_$insert(_el$32, _$createComponent(Show, {
|
|
852
780
|
get when() {
|
|
853
781
|
return degraded();
|
|
854
782
|
},
|
|
@@ -858,36 +786,36 @@ function QuotaSidebar(props) {
|
|
|
858
786
|
return prefs().header.showVersion && PLUGIN_VERSION !== '';
|
|
859
787
|
},
|
|
860
788
|
get children() {
|
|
861
|
-
var _el$
|
|
862
|
-
_$insert(_el$
|
|
863
|
-
_$effect(_$p => _$setProp(_el$
|
|
864
|
-
return _el$
|
|
789
|
+
var _el$44 = _$createElement("text");
|
|
790
|
+
_$insert(_el$44, `v${PLUGIN_VERSION}`);
|
|
791
|
+
_$effect(_$p => _$setProp(_el$44, "fg", theme().textMuted, _$p));
|
|
792
|
+
return _el$44;
|
|
865
793
|
}
|
|
866
794
|
});
|
|
867
795
|
},
|
|
868
796
|
get children() {
|
|
869
|
-
var _el$
|
|
870
|
-
_el$
|
|
871
|
-
_el$
|
|
872
|
-
_$insertNode(_el$
|
|
873
|
-
_$setProp(_el$
|
|
874
|
-
_$setProp(_el$
|
|
875
|
-
_$insertNode(_el$
|
|
876
|
-
_$insertNode(_el$
|
|
797
|
+
var _el$36 = _$createElement("box"),
|
|
798
|
+
_el$37 = _$createElement("text"),
|
|
799
|
+
_el$38 = _$createElement("b");
|
|
800
|
+
_$insertNode(_el$36, _el$37);
|
|
801
|
+
_$setProp(_el$36, "paddingLeft", 1);
|
|
802
|
+
_$setProp(_el$36, "paddingRight", 1);
|
|
803
|
+
_$insertNode(_el$37, _el$38);
|
|
804
|
+
_$insertNode(_el$38, _$createTextNode(`LIMITED`));
|
|
877
805
|
_$effect(_p$ => {
|
|
878
806
|
var _v$12 = theme().warning,
|
|
879
807
|
_v$13 = theme().background;
|
|
880
|
-
_v$12 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
881
|
-
_v$13 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
808
|
+
_v$12 !== _p$.e && (_p$.e = _$setProp(_el$36, "backgroundColor", _v$12, _p$.e));
|
|
809
|
+
_v$13 !== _p$.t && (_p$.t = _$setProp(_el$37, "fg", _v$13, _p$.t));
|
|
882
810
|
return _p$;
|
|
883
811
|
}, {
|
|
884
812
|
e: undefined,
|
|
885
813
|
t: undefined
|
|
886
814
|
});
|
|
887
|
-
return _el$
|
|
815
|
+
return _el$36;
|
|
888
816
|
}
|
|
889
817
|
}), null);
|
|
890
|
-
_$insert(_el$
|
|
818
|
+
_$insert(_el$31, _$createComponent(Show, {
|
|
891
819
|
get when() {
|
|
892
820
|
return _$memo(() => !!collapsed())() && hasData();
|
|
893
821
|
},
|
|
@@ -906,41 +834,41 @@ function QuotaSidebar(props) {
|
|
|
906
834
|
},
|
|
907
835
|
get fallback() {
|
|
908
836
|
return (() => {
|
|
909
|
-
var _el$
|
|
910
|
-
_$insertNode(_el$
|
|
911
|
-
_$effect(_$p => _$setProp(_el$
|
|
912
|
-
return _el$
|
|
837
|
+
var _el$45 = _$createElement("text");
|
|
838
|
+
_$insertNode(_el$45, _$createTextNode(`—`));
|
|
839
|
+
_$effect(_$p => _$setProp(_el$45, "fg", theme().textMuted, _$p));
|
|
840
|
+
return _el$45;
|
|
913
841
|
})();
|
|
914
842
|
},
|
|
915
843
|
get children() {
|
|
916
|
-
var _el$
|
|
917
|
-
_el$
|
|
918
|
-
_el$
|
|
919
|
-
_el$
|
|
920
|
-
_$insertNode(_el$
|
|
921
|
-
_$insertNode(_el$
|
|
922
|
-
_$setProp(_el$
|
|
923
|
-
_$insertNode(_el$
|
|
924
|
-
_$insert(_el$
|
|
925
|
-
_$insert(_el$
|
|
844
|
+
var _el$40 = _$createElement("box"),
|
|
845
|
+
_el$41 = _$createElement("text"),
|
|
846
|
+
_el$42 = _$createElement("b"),
|
|
847
|
+
_el$43 = _$createElement("text");
|
|
848
|
+
_$insertNode(_el$40, _el$41);
|
|
849
|
+
_$insertNode(_el$40, _el$43);
|
|
850
|
+
_$setProp(_el$40, "flexDirection", 'row');
|
|
851
|
+
_$insertNode(_el$41, _el$42);
|
|
852
|
+
_$insert(_el$42, () => activeQuotaSummary().text);
|
|
853
|
+
_$insert(_el$43, () => activeAccount().killed ? ' \u2298' : ' \u25cf');
|
|
926
854
|
_$effect(_p$ => {
|
|
927
855
|
var _v$14 = toneColor(theme(), activeQuotaTone()),
|
|
928
856
|
_v$15 = toneColor(theme(), activeAccount().killed ? 'err' : activeQuotaTone());
|
|
929
|
-
_v$14 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
930
|
-
_v$15 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
857
|
+
_v$14 !== _p$.e && (_p$.e = _$setProp(_el$41, "fg", _v$14, _p$.e));
|
|
858
|
+
_v$15 !== _p$.t && (_p$.t = _$setProp(_el$43, "fg", _v$15, _p$.t));
|
|
931
859
|
return _p$;
|
|
932
860
|
}, {
|
|
933
861
|
e: undefined,
|
|
934
862
|
t: undefined
|
|
935
863
|
});
|
|
936
|
-
return _el$
|
|
864
|
+
return _el$40;
|
|
937
865
|
}
|
|
938
866
|
});
|
|
939
867
|
}
|
|
940
868
|
});
|
|
941
869
|
}
|
|
942
870
|
}), null);
|
|
943
|
-
_$insert(_el$
|
|
871
|
+
_$insert(_el$31, _$createComponent(Show, {
|
|
944
872
|
get when() {
|
|
945
873
|
return !collapsed() || !hasData();
|
|
946
874
|
},
|
|
@@ -951,14 +879,14 @@ function QuotaSidebar(props) {
|
|
|
951
879
|
},
|
|
952
880
|
get fallback() {
|
|
953
881
|
return (() => {
|
|
954
|
-
var _el$
|
|
955
|
-
_el$
|
|
956
|
-
_$insertNode(_el$
|
|
957
|
-
_$setProp(_el$
|
|
958
|
-
_$setProp(_el$
|
|
959
|
-
_$insertNode(_el$
|
|
960
|
-
_$effect(_$p => _$setProp(_el$
|
|
961
|
-
return _el$
|
|
882
|
+
var _el$47 = _$createElement("box"),
|
|
883
|
+
_el$48 = _$createElement("text");
|
|
884
|
+
_$insertNode(_el$47, _el$48);
|
|
885
|
+
_$setProp(_el$47, "marginTop", 1);
|
|
886
|
+
_$setProp(_el$47, "width", '100%');
|
|
887
|
+
_$insertNode(_el$48, _$createTextNode(`Waiting for quota…`));
|
|
888
|
+
_$effect(_$p => _$setProp(_el$48, "fg", theme().textMuted, _$p));
|
|
889
|
+
return _el$47;
|
|
962
890
|
})();
|
|
963
891
|
},
|
|
964
892
|
get children() {
|
|
@@ -972,42 +900,16 @@ function QuotaSidebar(props) {
|
|
|
972
900
|
return theme();
|
|
973
901
|
},
|
|
974
902
|
title: "Quota"
|
|
975
|
-
}), _$createComponent(AccountBlock, {
|
|
976
|
-
get theme() {
|
|
977
|
-
return theme();
|
|
978
|
-
},
|
|
979
|
-
get appearance() {
|
|
980
|
-
return prefs().appearance;
|
|
981
|
-
},
|
|
982
|
-
name: "main",
|
|
983
|
-
get quota() {
|
|
984
|
-
return state().main?.quota ?? null;
|
|
985
|
-
},
|
|
986
|
-
get killed() {
|
|
987
|
-
return state().main?.killed ?? false;
|
|
988
|
-
},
|
|
989
|
-
get active() {
|
|
990
|
-
return sessionRouting().activeId === 'main';
|
|
991
|
-
},
|
|
992
|
-
get pacingEnabled() {
|
|
993
|
-
return prefs().sections.pacing;
|
|
994
|
-
},
|
|
995
|
-
get labelWidth() {
|
|
996
|
-
return quotaLabelWidth();
|
|
997
|
-
},
|
|
998
|
-
get resetCredits() {
|
|
999
|
-
return state().main?.resetCredits;
|
|
1000
|
-
}
|
|
1001
903
|
}), _$createComponent(Show, {
|
|
1002
904
|
get when() {
|
|
1003
|
-
return
|
|
905
|
+
return !vaultMode();
|
|
1004
906
|
},
|
|
1005
|
-
get
|
|
907
|
+
get fallback() {
|
|
1006
908
|
return _$createComponent(For, {
|
|
1007
909
|
get each() {
|
|
1008
|
-
return
|
|
910
|
+
return enabledVaultAccounts();
|
|
1009
911
|
},
|
|
1010
|
-
children:
|
|
912
|
+
children: (account, index) => _$createComponent(AccountBlock, {
|
|
1011
913
|
get theme() {
|
|
1012
914
|
return theme();
|
|
1013
915
|
},
|
|
@@ -1015,16 +917,16 @@ function QuotaSidebar(props) {
|
|
|
1015
917
|
return prefs().appearance;
|
|
1016
918
|
},
|
|
1017
919
|
get name() {
|
|
1018
|
-
return
|
|
920
|
+
return account.label ?? account.id;
|
|
1019
921
|
},
|
|
1020
922
|
get quota() {
|
|
1021
|
-
return
|
|
923
|
+
return account.quota;
|
|
1022
924
|
},
|
|
1023
925
|
get killed() {
|
|
1024
|
-
return
|
|
926
|
+
return account.killed;
|
|
1025
927
|
},
|
|
1026
928
|
get active() {
|
|
1027
|
-
return sessionRouting().activeId ===
|
|
929
|
+
return sessionRouting().activeId === account.id;
|
|
1028
930
|
},
|
|
1029
931
|
get pacingEnabled() {
|
|
1030
932
|
return prefs().sections.pacing;
|
|
@@ -1033,11 +935,83 @@ function QuotaSidebar(props) {
|
|
|
1033
935
|
return quotaLabelWidth();
|
|
1034
936
|
},
|
|
1035
937
|
get resetCredits() {
|
|
1036
|
-
return
|
|
938
|
+
return account.resetCredits;
|
|
1037
939
|
},
|
|
1038
|
-
marginTop
|
|
940
|
+
get marginTop() {
|
|
941
|
+
return index() === 0 ? 0 : 1;
|
|
942
|
+
}
|
|
1039
943
|
})
|
|
1040
944
|
});
|
|
945
|
+
},
|
|
946
|
+
get children() {
|
|
947
|
+
return [_$createComponent(AccountBlock, {
|
|
948
|
+
get theme() {
|
|
949
|
+
return theme();
|
|
950
|
+
},
|
|
951
|
+
get appearance() {
|
|
952
|
+
return prefs().appearance;
|
|
953
|
+
},
|
|
954
|
+
name: "main",
|
|
955
|
+
get quota() {
|
|
956
|
+
return state().main?.quota ?? null;
|
|
957
|
+
},
|
|
958
|
+
get killed() {
|
|
959
|
+
return state().main?.killed ?? false;
|
|
960
|
+
},
|
|
961
|
+
get active() {
|
|
962
|
+
return sessionRouting().activeId === 'main';
|
|
963
|
+
},
|
|
964
|
+
get pacingEnabled() {
|
|
965
|
+
return prefs().sections.pacing;
|
|
966
|
+
},
|
|
967
|
+
get labelWidth() {
|
|
968
|
+
return quotaLabelWidth();
|
|
969
|
+
},
|
|
970
|
+
get resetCredits() {
|
|
971
|
+
return state().main?.resetCredits;
|
|
972
|
+
}
|
|
973
|
+
}), _$createComponent(Show, {
|
|
974
|
+
get when() {
|
|
975
|
+
return prefs().sections.fallbackAccounts;
|
|
976
|
+
},
|
|
977
|
+
get children() {
|
|
978
|
+
return _$createComponent(For, {
|
|
979
|
+
get each() {
|
|
980
|
+
return enabledFallbacks();
|
|
981
|
+
},
|
|
982
|
+
children: fb => _$createComponent(AccountBlock, {
|
|
983
|
+
get theme() {
|
|
984
|
+
return theme();
|
|
985
|
+
},
|
|
986
|
+
get appearance() {
|
|
987
|
+
return prefs().appearance;
|
|
988
|
+
},
|
|
989
|
+
get name() {
|
|
990
|
+
return fb.label ?? fb.id;
|
|
991
|
+
},
|
|
992
|
+
get quota() {
|
|
993
|
+
return fb.quota;
|
|
994
|
+
},
|
|
995
|
+
get killed() {
|
|
996
|
+
return fb.killed;
|
|
997
|
+
},
|
|
998
|
+
get active() {
|
|
999
|
+
return sessionRouting().activeId === fb.id;
|
|
1000
|
+
},
|
|
1001
|
+
get pacingEnabled() {
|
|
1002
|
+
return prefs().sections.pacing;
|
|
1003
|
+
},
|
|
1004
|
+
get labelWidth() {
|
|
1005
|
+
return quotaLabelWidth();
|
|
1006
|
+
},
|
|
1007
|
+
get resetCredits() {
|
|
1008
|
+
return fb.resetCredits;
|
|
1009
|
+
},
|
|
1010
|
+
marginTop: 1
|
|
1011
|
+
})
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
})];
|
|
1041
1015
|
}
|
|
1042
1016
|
})];
|
|
1043
1017
|
}
|
|
@@ -1156,16 +1130,16 @@ function QuotaSidebar(props) {
|
|
|
1156
1130
|
var _v$16 = theme().borderActive,
|
|
1157
1131
|
_v$17 = theme().accent,
|
|
1158
1132
|
_v$18 = theme().background;
|
|
1159
|
-
_v$16 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
1160
|
-
_v$17 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
1161
|
-
_v$18 !== _p$.a && (_p$.a = _$setProp(_el$
|
|
1133
|
+
_v$16 !== _p$.e && (_p$.e = _$setProp(_el$31, "borderColor", _v$16, _p$.e));
|
|
1134
|
+
_v$17 !== _p$.t && (_p$.t = _$setProp(_el$33, "backgroundColor", _v$17, _p$.t));
|
|
1135
|
+
_v$18 !== _p$.a && (_p$.a = _$setProp(_el$34, "fg", _v$18, _p$.a));
|
|
1162
1136
|
return _p$;
|
|
1163
1137
|
}, {
|
|
1164
1138
|
e: undefined,
|
|
1165
1139
|
t: undefined,
|
|
1166
1140
|
a: undefined
|
|
1167
1141
|
});
|
|
1168
|
-
return _el$
|
|
1142
|
+
return _el$31;
|
|
1169
1143
|
})();
|
|
1170
1144
|
}
|
|
1171
1145
|
const tui = async api => {
|
|
@@ -1207,16 +1181,14 @@ const tui = async api => {
|
|
|
1207
1181
|
void rpcClient.pending(lastNotificationId, sessionId).then(messages => {
|
|
1208
1182
|
for (const message of [...messages].sort((a, b) => a.id - b.id)) {
|
|
1209
1183
|
lastNotificationId = Math.max(lastNotificationId, message.id);
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
api.ui.
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
sessionId: sessionId
|
|
1216
|
-
}));
|
|
1184
|
+
const payload = message.payload;
|
|
1185
|
+
if (isNotifyPayload(payload)) {
|
|
1186
|
+
api.ui.toast({
|
|
1187
|
+
message: payload.notify.message
|
|
1188
|
+
});
|
|
1217
1189
|
continue;
|
|
1218
1190
|
}
|
|
1219
|
-
openCommandDialog(api,
|
|
1191
|
+
openCommandDialog(api, payload, request => rpcClient.apply(buildApplyRequest(request, sessionId), MENU_APPLY_TIMEOUT_MS));
|
|
1220
1192
|
}
|
|
1221
1193
|
}).catch(() => {}).finally(() => {
|
|
1222
1194
|
rpcInFlight = false;
|