opencode-quota-gui 1.3.0 → 1.3.2
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 +34 -20
- package/dist/bin/opencode-quota-gui.js +0 -0
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/card-order.d.ts +2 -0
- package/dist/contracts/card-order.js +2 -2
- package/dist/contracts/card-visibility.d.ts +2 -1
- package/dist/contracts/card-visibility.js +2 -1
- package/dist/contracts/dashboard.d.ts +95 -6
- package/dist/contracts/dashboard.js +10 -0
- package/dist/contracts/dto-guards.d.ts +4 -0
- package/dist/contracts/dto-guards.js +31 -7
- package/dist/contracts/guards.js +3 -1
- package/dist/contracts/identity.d.ts +37 -5
- package/dist/contracts/identity.js +43 -0
- package/dist/contracts/openai-quota.d.ts +3 -0
- package/dist/contracts/openai-quota.js +3 -0
- package/dist/contracts/provider-auto-resume.d.ts +9 -0
- package/dist/contracts/provider-auto-resume.js +24 -0
- package/dist/contracts/provider-failure.d.ts +22 -0
- package/dist/contracts/provider-failure.js +25 -1
- package/dist/contracts/row-order.d.ts +13 -0
- package/dist/contracts/row-order.js +34 -0
- package/dist/contracts/row-visibility.d.ts +53 -0
- package/dist/contracts/row-visibility.js +130 -0
- package/dist/data/modelsdev-pricing.min.json +1 -1
- package/dist/data/modelsdev-temporal.min.json +60 -634
- package/dist/gui/aggregation.d.ts +29 -1
- package/dist/gui/aggregation.js +157 -4
- package/dist/gui/analytics-bridge.d.ts +8 -9
- package/dist/gui/analytics-bridge.js +197 -54
- package/dist/gui/analytics-engine.d.ts +7 -15
- package/dist/gui/analytics-engine.js +246 -106
- package/dist/gui/analytics-model.d.ts +7 -0
- package/dist/gui/analytics-model.js +75 -9
- package/dist/gui/analytics-pricing-upkeep.d.ts +21 -0
- package/dist/gui/analytics-pricing-upkeep.js +23 -0
- package/dist/gui/analytics-protocol.d.ts +17 -7
- package/dist/gui/analytics-protocol.js +1 -0
- package/dist/gui/analytics-service.d.ts +10 -0
- package/dist/gui/analytics-service.js +30 -9
- package/dist/gui/analytics-state.d.ts +30 -5
- package/dist/gui/analytics-state.js +46 -7
- package/dist/gui/analytics-worker-runtime.d.ts +5 -0
- package/dist/gui/analytics-worker-runtime.js +9 -1
- package/dist/gui/analytics-worker.js +11 -0
- package/dist/gui/config.d.ts +3 -3
- package/dist/gui/config.js +77 -7
- package/dist/gui/identity.d.ts +6 -20
- package/dist/gui/identity.js +6 -54
- package/dist/gui/lifecycle.d.ts +5 -3
- package/dist/gui/lifecycle.js +3 -3
- package/dist/gui/primary-quota-windows.js +67 -44
- package/dist/gui/provider-cards.d.ts +20 -8
- package/dist/gui/provider-cards.js +42 -55
- package/dist/gui/quota-notification-detector.d.ts +29 -6
- package/dist/gui/quota-notification-detector.js +136 -47
- package/dist/gui/quota-notification-observer.d.ts +3 -4
- package/dist/gui/quota-notification-observer.js +73 -20
- package/dist/gui/quota-observation.d.ts +4 -0
- package/dist/gui/quota-observation.js +18 -0
- package/dist/gui/rpc.d.ts +2 -0
- package/dist/gui/rpc.js +14 -3
- package/dist/gui/server.js +17 -3
- package/dist/gui/snapshot-service.d.ts +3 -15
- package/dist/gui/snapshot-service.js +281 -23
- package/dist/gui/sources.js +179 -64
- package/dist/gui/temporal-status.d.ts +3 -2
- package/dist/gui/temporal-status.js +10 -6
- package/dist/gui-experimental.cjs +230 -225
- package/dist/lib/accounting-format.d.ts +8 -0
- package/dist/lib/accounting-format.js +20 -2
- package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
- package/dist/lib/alibaba-coding-plan-cli.js +539 -0
- package/dist/lib/anthropic-api-auth.d.ts +7 -0
- package/dist/lib/anthropic-api-auth.js +27 -0
- package/dist/lib/anthropic-api-rate-limits.d.ts +47 -0
- package/dist/lib/anthropic-api-rate-limits.js +92 -0
- package/dist/lib/anthropic-auth.d.ts +2 -3
- package/dist/lib/anthropic-auth.js +2 -3
- package/dist/lib/anthropic-oauth-throttle.d.ts +76 -0
- package/dist/lib/anthropic-oauth-throttle.js +379 -0
- package/dist/lib/anthropic.d.ts +68 -14
- package/dist/lib/anthropic.js +1016 -363
- package/dist/lib/api-key-retry-after.d.ts +7 -0
- package/dist/lib/api-key-retry-after.js +62 -0
- package/dist/lib/atomic-json.d.ts +2 -0
- package/dist/lib/atomic-json.js +1 -0
- package/dist/lib/cache-observer-ingestion.d.ts +90 -0
- package/dist/lib/cache-observer-ingestion.js +1008 -0
- package/dist/lib/cache-observer.d.ts +141 -0
- package/dist/lib/cache-observer.js +323 -0
- package/dist/lib/canonical-config-lock.d.ts +9 -0
- package/dist/lib/canonical-config-lock.js +36 -0
- package/dist/lib/chutes.js +62 -51
- package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
- package/dist/lib/claude-agent-transcript-ttl.js +154 -0
- package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
- package/dist/lib/claude-agent-ttl-tracker.js +152 -0
- package/dist/lib/cli-show.d.ts +5 -0
- package/dist/lib/cli-show.js +21 -8
- package/dist/lib/cli-status.js +3 -6
- package/dist/lib/config-write-target.d.ts +1 -1
- package/dist/lib/config-write-target.js +5 -2
- package/dist/lib/config.d.ts +2 -1
- package/dist/lib/config.js +257 -4
- package/dist/lib/copilot.js +171 -86
- package/dist/lib/dashboard-visibility.d.ts +5 -0
- package/dist/lib/dashboard-visibility.js +11 -10
- package/dist/lib/dashboard-web-policy.d.ts +4 -4
- package/dist/lib/dashboard-web-policy.js +2 -2
- package/dist/lib/deepseek.js +25 -13
- package/dist/lib/display-sanitize.js +2 -0
- package/dist/lib/entries.d.ts +33 -1
- package/dist/lib/entries.js +6 -0
- package/dist/lib/glm-coding-plan.js +98 -74
- package/dist/lib/google-agy.js +90 -12
- package/dist/lib/google-gemini-cli.js +84 -11
- package/dist/lib/grouped-entry-normalization.js +1 -1
- package/dist/lib/http.d.ts +4 -0
- package/dist/lib/http.js +16 -2
- package/dist/lib/init-installer.js +5 -3
- package/dist/lib/kilo.js +37 -18
- package/dist/lib/kimi.js +35 -18
- package/dist/lib/maintainer-announcements.js +2 -2
- package/dist/lib/mimo.d.ts +2 -0
- package/dist/lib/mimo.js +36 -0
- package/dist/lib/modelsdev-pricing.d.ts +74 -2
- package/dist/lib/modelsdev-pricing.js +457 -63
- package/dist/lib/modelsdev-temporal.d.ts +6 -0
- package/dist/lib/modelsdev-temporal.js +16 -2
- package/dist/lib/nanogpt.d.ts +1 -0
- package/dist/lib/nanogpt.js +26 -3
- package/dist/lib/ollama-cloud.d.ts +1 -1
- package/dist/lib/ollama-cloud.js +48 -35
- package/dist/lib/openai.js +84 -38
- package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
- package/dist/lib/opencode-auth-sqlite.js +2 -2
- package/dist/lib/opencode-config-editor.d.ts +1 -0
- package/dist/lib/opencode-config-editor.js +6 -1
- package/dist/lib/opencode-config-providers.js +2 -2
- package/dist/lib/opencode-go.js +29 -2
- package/dist/lib/opencode-storage.d.ts +20 -0
- package/dist/lib/opencode-storage.js +89 -2
- package/dist/lib/opencode-version-core.d.ts +30 -0
- package/dist/lib/opencode-version-core.js +59 -0
- package/dist/lib/opencode-version.d.ts +2 -22
- package/dist/lib/opencode-version.js +4 -48
- package/dist/lib/opencode-warming-refresh.d.ts +19 -0
- package/dist/lib/opencode-warming-refresh.js +95 -0
- package/dist/lib/opencode-zen.d.ts +3 -0
- package/dist/lib/opencode-zen.js +71 -5
- package/dist/lib/provider-add.js +5 -2
- package/dist/lib/provider-metadata.d.ts +11 -3
- package/dist/lib/provider-metadata.js +20 -2
- package/dist/lib/provider-registration.d.ts +358 -9
- package/dist/lib/provider-registration.js +423 -30
- package/dist/lib/quota-auto-resume.d.ts +74 -0
- package/dist/lib/quota-auto-resume.js +539 -0
- package/dist/lib/quota-command-format.js +23 -10
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.js +25 -0
- package/dist/lib/quota-identity.d.ts +64 -0
- package/dist/lib/quota-identity.js +111 -0
- package/dist/lib/quota-providers-remote.d.ts +2 -1
- package/dist/lib/quota-providers-remote.js +59 -3
- package/dist/lib/quota-providers.d.ts +1 -1
- package/dist/lib/quota-providers.js +14 -37
- package/dist/lib/quota-render-data.d.ts +6 -0
- package/dist/lib/quota-render-data.js +45 -19
- package/dist/lib/quota-reset-notifications.js +11 -155
- package/dist/lib/quota-retry-wait.d.ts +106 -5
- package/dist/lib/quota-retry-wait.js +301 -34
- package/dist/lib/quota-runtime-context.js +1 -0
- package/dist/lib/quota-state-codec.d.ts +2 -0
- package/dist/lib/quota-state-codec.js +31 -2
- package/dist/lib/quota-state.d.ts +8 -2
- package/dist/lib/quota-state.js +253 -47
- package/dist/lib/quota-stats.d.ts +26 -0
- package/dist/lib/quota-stats.js +40 -1
- package/dist/lib/quota-status.js +3 -51
- package/dist/lib/quota-surface-data.js +18 -3
- package/dist/lib/quota-telemetry.js +2 -2
- package/dist/lib/resolved-auth-identity.d.ts +19 -0
- package/dist/lib/resolved-auth-identity.js +44 -0
- package/dist/lib/scoped-update.d.ts +1 -1
- package/dist/lib/state-file-lock.d.ts +26 -0
- package/dist/lib/state-file-lock.js +205 -0
- package/dist/lib/synthetic.js +65 -54
- package/dist/lib/toast-format-grouped.js +7 -4
- package/dist/lib/tui-compact-format.js +29 -16
- package/dist/lib/types.d.ts +51 -1
- package/dist/lib/types.js +17 -1
- package/dist/lib/xai.js +48 -22
- package/dist/plugin.js +328 -14
- package/dist/provider-logos/NOTICE.md +1 -1
- package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
- package/dist/providers/alibaba-coding-plan.js +125 -104
- package/dist/providers/alibaba-token-plan.js +9 -5
- package/dist/providers/anthropic.d.ts +16 -3
- package/dist/providers/anthropic.js +172 -220
- package/dist/providers/cache-policies.d.ts +11 -4
- package/dist/providers/cache-policies.js +19 -13
- package/dist/providers/chutes.js +2 -0
- package/dist/providers/claude-agent.d.ts +19 -0
- package/dist/providers/claude-agent.js +215 -0
- package/dist/providers/copilot.js +7 -4
- package/dist/providers/glm-coding-plan-provider.d.ts +1 -0
- package/dist/providers/glm-coding-plan-provider.js +30 -23
- package/dist/providers/google-account-format.js +1 -0
- package/dist/providers/google-agy.d.ts +6 -5
- package/dist/providers/google-agy.js +43 -15
- package/dist/providers/google-gemini-cli.js +1 -0
- package/dist/providers/kilo.js +1 -0
- package/dist/providers/kimi-code.js +2 -0
- package/dist/providers/mimo.js +1 -0
- package/dist/providers/nanogpt.js +1 -0
- package/dist/providers/ollama-cloud.js +10 -0
- package/dist/providers/openai.js +24 -23
- package/dist/providers/opencode-go.js +10 -6
- package/dist/providers/opencode-zen.js +3 -1
- package/dist/providers/openrouter.js +1 -0
- package/dist/providers/quota-providers.js +16 -5
- package/dist/providers/registry.js +2 -0
- package/dist/providers/result-helpers.d.ts +6 -2
- package/dist/providers/result-helpers.js +7 -1
- package/dist/providers/synthetic.js +4 -0
- package/dist/providers/xai.js +9 -8
- package/dist/rpc.d.ts +129 -8
- package/dist/rpc.js +219 -14
- package/dist/ui/assets/{index-cDd9jUVY.css → index-6_g1FHs-.css} +1 -1
- package/dist/ui/assets/index-sZnGUuML.js +10 -0
- package/dist/ui/assets/{popover-BGkgv9s0.js → popover-C4ZLYe9E.js} +1 -1
- package/dist/ui/assets/providers/claude-agent.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +45 -46
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
- package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
- package/dist/ui/assets/index-DLHeXYff.js +0 -9
package/dist/providers/openai.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* OpenAI (Plus/Pro) provider wrapper.
|
|
3
3
|
*/
|
|
4
4
|
import { OPENAI_CREDITS_ROW_KEY, OPENAI_CREDITS_ROW_LABEL, OPENAI_CREDITS_ROW_RESULT_TYPE, OPENAI_RESETS_ROW_KEY, OPENAI_RESETS_ROW_LABEL, OPENAI_RESETS_ROW_RESULT_TYPE, } from "../contracts/openai-quota.js";
|
|
5
|
+
import { windowSemantic } from "../lib/entries.js";
|
|
5
6
|
import { DEFAULT_OPENAI_AUTH_CACHE_MAX_AGE_MS, hasOpenAIOAuthCached, OPENAI_AUTH_SOURCE_KEYS, queryOpenAIQuota, resolveOpenAIOAuth, } from "../lib/openai.js";
|
|
6
7
|
import { credentialRowAuthEntry, formatCredentialDisplayNames, readCredentialRows, } from "../lib/opencode-auth.js";
|
|
7
8
|
import { isCanonicalProviderAvailable } from "../lib/provider-availability.js";
|
|
@@ -17,23 +18,6 @@ const TOKEN_SHARING_METHOD_ID = "chatgpt-token-sharing";
|
|
|
17
18
|
function isTokenSharingLogin(row) {
|
|
18
19
|
return row.value.methodID === TOKEN_SHARING_METHOD_ID;
|
|
19
20
|
}
|
|
20
|
-
const OPENAI_WINDOW_ROW_KEYS = {
|
|
21
|
-
"5h:": "window:five_hour",
|
|
22
|
-
"Weekly:": "window:week",
|
|
23
|
-
"Monthly:": "window:month",
|
|
24
|
-
"Code Review:": "window:code_review",
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Percent-only window rows carry no typed `semantic`, so they get stable
|
|
28
|
-
* explicit `rowKey`s by window (the fallback aggregate row when no window
|
|
29
|
-
* exists); labels themselves are never used as ids.
|
|
30
|
-
*/
|
|
31
|
-
function withOpenAiWindowRowKeys(entries) {
|
|
32
|
-
return entries.map((entry) => ({
|
|
33
|
-
...entry,
|
|
34
|
-
rowKey: (entry.label ? OPENAI_WINDOW_ROW_KEYS[entry.label] : undefined) ?? "aggregate",
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
21
|
const OPENAI_OPTIONAL_ACCOUNTING = {
|
|
38
22
|
acquisitionMethod: "remote_api",
|
|
39
23
|
ownership: "maintained",
|
|
@@ -172,7 +156,7 @@ export const openaiProvider = {
|
|
|
172
156
|
credits: result.credits,
|
|
173
157
|
bankedResets: result.bankedResets,
|
|
174
158
|
});
|
|
175
|
-
const windowEntries =
|
|
159
|
+
const windowEntries = groupedPercentWindowEntries({
|
|
176
160
|
group,
|
|
177
161
|
accounting: {
|
|
178
162
|
resultType: "rate_limit",
|
|
@@ -182,17 +166,34 @@ export const openaiProvider = {
|
|
|
182
166
|
...(options.sourceId ? { sourceId: options.sourceId } : {}),
|
|
183
167
|
},
|
|
184
168
|
windows: [
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
169
|
+
{
|
|
170
|
+
window: result.windows.hourly,
|
|
171
|
+
suffix: "5h",
|
|
172
|
+
label: "5h:",
|
|
173
|
+
semantic: windowSemantic("five_hour"),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
window: result.windows.weekly,
|
|
177
|
+
suffix: "Weekly",
|
|
178
|
+
label: "Weekly:",
|
|
179
|
+
semantic: windowSemantic("week"),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
window: result.windows.monthly,
|
|
183
|
+
suffix: "Monthly",
|
|
184
|
+
label: "Monthly:",
|
|
185
|
+
semantic: windowSemantic("month"),
|
|
186
|
+
},
|
|
188
187
|
{
|
|
189
188
|
window: result.windows.codeReview,
|
|
190
189
|
suffix: "Code Review",
|
|
191
190
|
label: "Code Review:",
|
|
191
|
+
semantic: windowSemantic("code_review"),
|
|
192
192
|
},
|
|
193
193
|
],
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
// A successful response with no reported window is not a 0% quota.
|
|
195
|
+
fallbackWhenEmpty: false,
|
|
196
|
+
});
|
|
196
197
|
return attemptedResult([...windowEntries, ...optionalEntries], [], {
|
|
197
198
|
singleWindowDisplayName: group,
|
|
198
199
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { windowSemantic } from "../lib/entries.js";
|
|
2
3
|
import { credentialRowAuthEntry, formatCredentialDisplayNames, readCredentialRows, scrubCredentialErrorText, selectConnectionCredentialRows, } from "../lib/opencode-auth.js";
|
|
3
4
|
import { consoleBaseUrl, consoleUnexpectedErrorText, resolveOpenCodeConsoleAuthAccounts, } from "../lib/opencode-console-auth.js";
|
|
4
5
|
import { queryOpenCodeGoConsoleStatus, queryOpenCodeGoQuota } from "../lib/opencode-go.js";
|
|
@@ -13,11 +14,11 @@ const OPENCODE_GO_WINDOW_LABELS = {
|
|
|
13
14
|
weekly: { name: `${OPENCODE_GO_PROVIDER_LABEL} Weekly`, label: "Weekly:" },
|
|
14
15
|
monthly: { name: `${OPENCODE_GO_PROVIDER_LABEL} Monthly`, label: "Monthly:" },
|
|
15
16
|
};
|
|
16
|
-
/**
|
|
17
|
-
const
|
|
18
|
-
rolling: "
|
|
19
|
-
weekly: "
|
|
20
|
-
monthly: "
|
|
17
|
+
/** Typed window metrics for the percent-only window rows. */
|
|
18
|
+
const OPENCODE_GO_WINDOW_METRICS = {
|
|
19
|
+
rolling: "five_hour",
|
|
20
|
+
weekly: "week",
|
|
21
|
+
monthly: "month",
|
|
21
22
|
};
|
|
22
23
|
const notSubscribedCredentialFingerprints = new Set();
|
|
23
24
|
export function __resetOpenCodeGoNotSubscribedForTests() {
|
|
@@ -60,7 +61,7 @@ function buildOpenCodeGoEntries(result, selectedWindows, group = OPENCODE_GO_PRO
|
|
|
60
61
|
name: `${group} ${labels.label.slice(0, -1)}`,
|
|
61
62
|
group,
|
|
62
63
|
label: labels.label,
|
|
63
|
-
|
|
64
|
+
semantic: windowSemantic(OPENCODE_GO_WINDOW_METRICS[window]),
|
|
64
65
|
percentRemaining: usage.percentRemaining,
|
|
65
66
|
...(usage.resetTimeIso !== undefined ? { resetTimeIso: usage.resetTimeIso } : {}),
|
|
66
67
|
});
|
|
@@ -192,6 +193,7 @@ async function fetchOpenCodeGoConsoleAccounts(ctx, windows, consoleAccounts) {
|
|
|
192
193
|
retryable: result.retryable,
|
|
193
194
|
sourceId: account.sourceId,
|
|
194
195
|
failureCategory: result.failureCategory,
|
|
196
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
195
197
|
});
|
|
196
198
|
fetchErrorsBySourceId.set(account.sourceId, result.error);
|
|
197
199
|
accounts.push(consoleAccountDescriptor(account));
|
|
@@ -352,6 +354,7 @@ async function fetchOpenCodeGoLegacy(ctx, diagnostics, statusDetails) {
|
|
|
352
354
|
retryable: result.retryable,
|
|
353
355
|
sourceId: row.id,
|
|
354
356
|
failureCategory: result.failureCategory,
|
|
357
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
355
358
|
});
|
|
356
359
|
}
|
|
357
360
|
const attemptedSourceIds = new Set([
|
|
@@ -401,6 +404,7 @@ async function fetchOpenCodeGoLegacy(ctx, diagnostics, statusDetails) {
|
|
|
401
404
|
return withStatusDetails(attemptedErrorResult(OPENCODE_GO_PROVIDER_LABEL, result.error, {
|
|
402
405
|
retryable: result.retryable,
|
|
403
406
|
failureCategory: result.failureCategory,
|
|
407
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
404
408
|
}), [...baseStatusDetails, { key: "live_fetch_error", value: result.error }]);
|
|
405
409
|
}
|
|
406
410
|
const liveDetails = OPENCODE_GO_WINDOW_ORDER.map((window) => {
|
|
@@ -98,7 +98,7 @@ function buildZenEntries(params) {
|
|
|
98
98
|
info: "Workspace monthly spend (includes Go API equivalent)",
|
|
99
99
|
semantic: {
|
|
100
100
|
metric: { kind: "window", window: "month" },
|
|
101
|
-
prominence: "
|
|
101
|
+
prominence: "supplementary",
|
|
102
102
|
},
|
|
103
103
|
quantity: { decimal: zenUsdDecimal(monthlyUsageUsd), unit: USD_UNIT },
|
|
104
104
|
});
|
|
@@ -208,6 +208,7 @@ async function fetchOpenCodeZenConsoleAccounts(ctx, consoleAccounts) {
|
|
|
208
208
|
...(result.failureCategory !== undefined
|
|
209
209
|
? { failureCategory: result.failureCategory }
|
|
210
210
|
: {}),
|
|
211
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
211
212
|
});
|
|
212
213
|
statusDetails.push({
|
|
213
214
|
key: `live_fetch_error:${account.sourceId}`,
|
|
@@ -230,6 +231,7 @@ async function fetchOpenCodeZenConsoleAccounts(ctx, consoleAccounts) {
|
|
|
230
231
|
...(optionalError.failureCategory !== undefined
|
|
231
232
|
? { failureCategory: optionalError.failureCategory }
|
|
232
233
|
: {}),
|
|
234
|
+
...(optionalError.retryAtMs !== undefined ? { retryAtMs: optionalError.retryAtMs } : {}),
|
|
233
235
|
});
|
|
234
236
|
}
|
|
235
237
|
}
|
|
@@ -69,6 +69,7 @@ export const openRouterProvider = {
|
|
|
69
69
|
errors.push({
|
|
70
70
|
label: account.label,
|
|
71
71
|
message: result.error,
|
|
72
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
72
73
|
failureCategory: result.failureCategory,
|
|
73
74
|
...(account.sourceId ? { sourceId: account.sourceId } : {}),
|
|
74
75
|
});
|
|
@@ -2,7 +2,7 @@ import { mapWithConcurrency } from "../lib/map-with-concurrency.js";
|
|
|
2
2
|
import { customQuotaProviderDefinitions, QUOTA_PROVIDERS_AGGREGATE_ID, resolveQuotaProviderSessionModelIdentity, selectEligibleQuotaProviderDefinitions, } from "../lib/quota-providers.js";
|
|
3
3
|
import { collectLocalQuotaProviderEstimate, inspectLocalQuotaProviderState, } from "../lib/quota-providers-local.js";
|
|
4
4
|
import { fetchRemoteQuotaProvider, QUOTA_PROVIDER_CONCURRENCY, resolveQuotaProviderApiKey, } from "../lib/quota-providers-remote.js";
|
|
5
|
-
import { fetchQuotaProviderResult } from "../lib/quota-state.js";
|
|
5
|
+
import { fetchQuotaProviderResult, QUOTA_FORCE_REFRESH } from "../lib/quota-state.js";
|
|
6
6
|
import { resolveQuotaProviderDefinitionAuthIdentity } from "./cache-policies.js";
|
|
7
7
|
export const QUOTA_PROVIDERS_PROVIDER_ID = QUOTA_PROVIDERS_AGGREGATE_ID;
|
|
8
8
|
export const selectEligibleQuotaProviders = selectEligibleQuotaProviderDefinitions;
|
|
@@ -19,6 +19,12 @@ function matchesConfiguredCurrentSelection(model, context) {
|
|
|
19
19
|
async function getAvailableProviderIds(ctx) {
|
|
20
20
|
return ctx.resolveRuntimeProviderIds();
|
|
21
21
|
}
|
|
22
|
+
function configuredDefinitions(ctx) {
|
|
23
|
+
return ctx.config.quotaProviders ?? [];
|
|
24
|
+
}
|
|
25
|
+
function selectedDefinitionsStillCurrent(selected, current) {
|
|
26
|
+
return selected.filter((definition) => current.some((candidate) => candidate.id === definition.id));
|
|
27
|
+
}
|
|
22
28
|
function buildDiagnosticIdentity(definition) {
|
|
23
29
|
return {
|
|
24
30
|
sourceId: definition.id,
|
|
@@ -93,6 +99,7 @@ async function executeRemote(definition, requestTimeoutMs) {
|
|
|
93
99
|
{
|
|
94
100
|
label: definition.label,
|
|
95
101
|
message: result.error,
|
|
102
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
96
103
|
...(result.failureCategory !== undefined
|
|
97
104
|
? { failureCategory: result.failureCategory }
|
|
98
105
|
: {}),
|
|
@@ -135,7 +142,7 @@ async function executeRemoteWithCache(definition, ctx) {
|
|
|
135
142
|
isAvailable: async () => true,
|
|
136
143
|
cachePolicy: {
|
|
137
144
|
kind: "resolved-auth",
|
|
138
|
-
resolveIdentity: () => resolveQuotaProviderDefinitionAuthIdentity(definition),
|
|
145
|
+
resolveIdentity: (_cacheCtx) => resolveQuotaProviderDefinitionAuthIdentity(definition),
|
|
139
146
|
},
|
|
140
147
|
fetch: async () => {
|
|
141
148
|
const result = await executeRemote(definition, ctx.config.requestTimeoutMs);
|
|
@@ -157,6 +164,7 @@ async function executeRemoteWithCache(definition, ctx) {
|
|
|
157
164
|
},
|
|
158
165
|
},
|
|
159
166
|
ttlMs: ctx.config.providerCacheTtlMs ?? 0,
|
|
167
|
+
forceRefresh: ctx.operationCache?.get(QUOTA_FORCE_REFRESH) === true,
|
|
160
168
|
});
|
|
161
169
|
return {
|
|
162
170
|
entries: result.entries,
|
|
@@ -227,7 +235,7 @@ async function executeDefinition(definition, ctx) {
|
|
|
227
235
|
export const quotaProvidersProvider = {
|
|
228
236
|
id: QUOTA_PROVIDERS_PROVIDER_ID,
|
|
229
237
|
async isAvailable(ctx) {
|
|
230
|
-
const definitions = ctx
|
|
238
|
+
const definitions = configuredDefinitions(ctx);
|
|
231
239
|
if (customQuotaProviderDefinitions(definitions).length === 0)
|
|
232
240
|
return false;
|
|
233
241
|
const availableProviderIds = await getAvailableProviderIds(ctx);
|
|
@@ -243,12 +251,15 @@ export const quotaProvidersProvider = {
|
|
|
243
251
|
return matchesConfiguredCurrentSelection(model, context);
|
|
244
252
|
},
|
|
245
253
|
async fetch(ctx, cacheContext) {
|
|
246
|
-
const definitions = ctx
|
|
254
|
+
const definitions = configuredDefinitions(ctx);
|
|
247
255
|
if (customQuotaProviderDefinitions(definitions).length === 0) {
|
|
248
256
|
return { attempted: false, entries: [], errors: [] };
|
|
249
257
|
}
|
|
250
258
|
let selected = cacheContext?.runtimeEligibleQuotaProviders;
|
|
251
|
-
if (
|
|
259
|
+
if (selected) {
|
|
260
|
+
selected = selectedDefinitionsStillCurrent(selected, definitions);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
252
263
|
let availableProviderIds;
|
|
253
264
|
try {
|
|
254
265
|
availableProviderIds = await getAvailableProviderIds(ctx);
|
|
@@ -10,6 +10,7 @@ import { alibabaTokenPlanProvider } from "./alibaba-token-plan.js";
|
|
|
10
10
|
import { anthropicProvider } from "./anthropic.js";
|
|
11
11
|
import { PROVIDER_CACHE_POLICIES } from "./cache-policies.js";
|
|
12
12
|
import { chutesProvider } from "./chutes.js";
|
|
13
|
+
import { claudeAgentProvider } from "./claude-agent.js";
|
|
13
14
|
import { copilotProvider } from "./copilot.js";
|
|
14
15
|
import { cursorProvider } from "./cursor.js";
|
|
15
16
|
import { deepseekProvider } from "./deepseek.js";
|
|
@@ -32,6 +33,7 @@ import { zaiProvider } from "./zai.js";
|
|
|
32
33
|
import { zhipuProvider } from "./zhipu.js";
|
|
33
34
|
const PROVIDERS_BY_ID = {
|
|
34
35
|
anthropic: anthropicProvider,
|
|
36
|
+
"claude-agent": claudeAgentProvider,
|
|
35
37
|
copilot: copilotProvider,
|
|
36
38
|
openai: openaiProvider,
|
|
37
39
|
openrouter: openRouterProvider,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ProviderFailureCategory } from "../contracts/provider-failure.js";
|
|
2
|
-
import type { AccountingMetadata, FixedWindowProjectionEvidence, QuotaProviderPresentation, QuotaProviderResult, QuotaProviderStatusDetail, QuotaToastEntry, QuotaToastError } from "../lib/entries.js";
|
|
1
|
+
import type { ProviderFailureCategory, QuotaAttemptOutcome } from "../contracts/provider-failure.js";
|
|
2
|
+
import type { AccountingMetadata, AccountingSemantic, FixedWindowProjectionEvidence, QuotaProviderPresentation, QuotaProviderResult, QuotaProviderStatusDetail, QuotaToastEntry, QuotaToastError } from "../lib/entries.js";
|
|
3
3
|
export declare function notAttemptedResult(): QuotaProviderResult;
|
|
4
4
|
export declare function attemptedResult(entries: QuotaToastEntry[], errors?: QuotaToastError[], presentation?: QuotaProviderPresentation): QuotaProviderResult;
|
|
5
5
|
export declare function attemptedErrorResult(label: string, message: string, options?: {
|
|
6
6
|
retryable?: boolean;
|
|
7
7
|
failureCategory?: ProviderFailureCategory;
|
|
8
|
+
retryAtMs?: number;
|
|
9
|
+
attemptOutcome?: QuotaAttemptOutcome;
|
|
8
10
|
}): QuotaProviderResult;
|
|
9
11
|
export declare function statusDetailsFromRecord(values: Readonly<Record<string, string | undefined>>): QuotaProviderStatusDetail[];
|
|
10
12
|
export declare function configStatusDetails(diagnostics: {
|
|
@@ -40,6 +42,7 @@ export declare function mapNullableProviderResult<TResult extends {
|
|
|
40
42
|
success: false;
|
|
41
43
|
error: string;
|
|
42
44
|
retryable?: boolean;
|
|
45
|
+
retryAtMs?: number;
|
|
43
46
|
failureCategory?: ProviderFailureCategory;
|
|
44
47
|
} | null>(result: TResult, params: {
|
|
45
48
|
errorLabel: string;
|
|
@@ -59,6 +62,7 @@ export declare function groupedPercentWindowEntries(params: {
|
|
|
59
62
|
};
|
|
60
63
|
suffix: string;
|
|
61
64
|
label: string;
|
|
65
|
+
semantic?: AccountingSemantic;
|
|
62
66
|
}>;
|
|
63
67
|
fallbackWhenEmpty?: boolean;
|
|
64
68
|
}): QuotaToastEntry[];
|
|
@@ -17,6 +17,8 @@ export function attemptedErrorResult(label, message, options = {}) {
|
|
|
17
17
|
label,
|
|
18
18
|
message,
|
|
19
19
|
...(options.retryable === true ? { retryable: true } : {}),
|
|
20
|
+
...(options.retryAtMs !== undefined ? { retryAtMs: options.retryAtMs } : {}),
|
|
21
|
+
...(options.attemptOutcome !== undefined ? { attemptOutcome: options.attemptOutcome } : {}),
|
|
20
22
|
...(options.failureCategory !== undefined
|
|
21
23
|
? { failureCategory: options.failureCategory }
|
|
22
24
|
: {}),
|
|
@@ -97,6 +99,7 @@ export function mapNullableProviderResult(result, params) {
|
|
|
97
99
|
if (!result.success) {
|
|
98
100
|
return attemptedErrorResult(params.errorLabel, result.error, {
|
|
99
101
|
...(result.retryable === true ? { retryable: true } : {}),
|
|
102
|
+
...(result.retryAtMs !== undefined ? { retryAtMs: result.retryAtMs } : {}),
|
|
100
103
|
...((result.failureCategory ?? params.failureCategory) !== undefined
|
|
101
104
|
? { failureCategory: result.failureCategory ?? params.failureCategory }
|
|
102
105
|
: {}),
|
|
@@ -106,7 +109,7 @@ export function mapNullableProviderResult(result, params) {
|
|
|
106
109
|
}
|
|
107
110
|
export function groupedPercentWindowEntries(params) {
|
|
108
111
|
const entries = [];
|
|
109
|
-
for (const { window, suffix, label } of params.windows) {
|
|
112
|
+
for (const { window, suffix, label, semantic } of params.windows) {
|
|
110
113
|
if (!window)
|
|
111
114
|
continue;
|
|
112
115
|
entries.push({
|
|
@@ -114,6 +117,9 @@ export function groupedPercentWindowEntries(params) {
|
|
|
114
117
|
name: `${params.group} ${suffix}`,
|
|
115
118
|
group: params.group,
|
|
116
119
|
label,
|
|
120
|
+
...(semantic
|
|
121
|
+
? { semantic: { metric: { ...semantic.metric }, prominence: semantic.prominence } }
|
|
122
|
+
: {}),
|
|
117
123
|
percentRemaining: window.percentRemaining,
|
|
118
124
|
resetTimeIso: window.resetTimeIso,
|
|
119
125
|
...(window.fixedWindow ? { fixedWindow: { ...window.fixedWindow } } : {}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Synthetic provider wrapper.
|
|
3
3
|
*/
|
|
4
|
+
import { windowSemantic } from "../lib/entries.js";
|
|
4
5
|
import { isCanonicalProviderAvailable } from "../lib/provider-availability.js";
|
|
5
6
|
import { modelProviderIncludesAny } from "../lib/provider-model-matching.js";
|
|
6
7
|
import { getSyntheticKeyDiagnostics, hasSyntheticApiKeyConfigured, querySyntheticQuota, } from "../lib/synthetic.js";
|
|
@@ -27,6 +28,7 @@ function toSyntheticEntry(params) {
|
|
|
27
28
|
name: `Synthetic ${params.suffix}`,
|
|
28
29
|
group: "Synthetic",
|
|
29
30
|
label: params.label,
|
|
31
|
+
semantic: windowSemantic(params.semanticWindow),
|
|
30
32
|
percentRemaining: params.window.percentRemaining,
|
|
31
33
|
right,
|
|
32
34
|
resetTimeIso: params.window.resetTimeIso,
|
|
@@ -61,11 +63,13 @@ export const syntheticProvider = {
|
|
|
61
63
|
window: result.windows.fiveHour,
|
|
62
64
|
suffix: "5h",
|
|
63
65
|
label: "5h:",
|
|
66
|
+
semanticWindow: "five_hour",
|
|
64
67
|
}),
|
|
65
68
|
toSyntheticEntry({
|
|
66
69
|
window: result.windows.weekly,
|
|
67
70
|
suffix: "Weekly",
|
|
68
71
|
label: "Weekly:",
|
|
72
|
+
semanticWindow: "week",
|
|
69
73
|
currency: true,
|
|
70
74
|
}),
|
|
71
75
|
], [], {
|
package/dist/providers/xai.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* xAI SuperGrok provider wrapper.
|
|
3
3
|
*/
|
|
4
|
+
import { windowSemantic } from "../lib/entries.js";
|
|
4
5
|
import { credentialRowAuthEntry, formatCredentialDisplayNames, readCredentialRows, } from "../lib/opencode-auth.js";
|
|
5
6
|
import { isCanonicalProviderAvailable } from "../lib/provider-availability.js";
|
|
6
7
|
import { modelProviderMatchesRuntimeId } from "../lib/provider-model-matching.js";
|
|
7
8
|
import { DEFAULT_XAI_AUTH_CACHE_MAX_AGE_MS, hasXaiOAuthCached, periodKindLabel, queryXaiQuota, resolveXaiOAuth, } from "../lib/xai.js";
|
|
8
9
|
import { attemptedResult, mapNullableProviderResult } from "./result-helpers.js";
|
|
9
|
-
/**
|
|
10
|
-
function
|
|
10
|
+
/** Typed identity for the single provider-defined period row (never its label). */
|
|
11
|
+
function xaiWindowSemantic(kind) {
|
|
11
12
|
switch (kind) {
|
|
12
13
|
case "weekly":
|
|
13
|
-
return "
|
|
14
|
+
return windowSemantic("week");
|
|
14
15
|
case "monthly":
|
|
15
|
-
return "
|
|
16
|
+
return windowSemantic("month");
|
|
16
17
|
case "daily":
|
|
17
|
-
return "
|
|
18
|
+
return windowSemantic("day");
|
|
18
19
|
default:
|
|
19
|
-
return "named:period";
|
|
20
|
+
return { metric: { kind: "named", name: "period" }, prominence: "primary" };
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
export const xaiProvider = {
|
|
@@ -79,7 +80,7 @@ export const xaiProvider = {
|
|
|
79
80
|
name: `${group} ${period}`,
|
|
80
81
|
group,
|
|
81
82
|
label: `${period}:`,
|
|
82
|
-
|
|
83
|
+
semantic: xaiWindowSemantic(result.window.kind),
|
|
83
84
|
percentRemaining: result.window.percentRemaining,
|
|
84
85
|
resetTimeIso: result.window.resetTimeIso,
|
|
85
86
|
},
|
|
@@ -107,7 +108,7 @@ export const xaiProvider = {
|
|
|
107
108
|
name: `${result.label} ${period}`,
|
|
108
109
|
group: result.label,
|
|
109
110
|
label: `${period}:`,
|
|
110
|
-
|
|
111
|
+
semantic: xaiWindowSemantic(result.window.kind),
|
|
111
112
|
percentRemaining: result.window.percentRemaining,
|
|
112
113
|
resetTimeIso: result.window.resetTimeIso,
|
|
113
114
|
...(result.window.fixedWindow
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The plugin RPC definitions. `QuotaRpc` is
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The plugin RPC definitions. `QuotaRpc` is a legacy terminal-client contract
|
|
3
|
+
* retained for compatibility, but is not registered by the GUI-only server
|
|
4
|
+
* plugin. `DashboardRpc` is the typed dashboard contract the
|
|
5
5
|
* server plugin registers for native clients. Imports from `@opencode/*` stay
|
|
6
6
|
* type-only, so loading this file loads no OpenCode package.
|
|
7
7
|
*/
|
|
@@ -106,6 +106,8 @@ export type DashboardRpcImportApplyInput = {
|
|
|
106
106
|
};
|
|
107
107
|
export type DashboardRpcWatchInput = {
|
|
108
108
|
scope: DashboardRpcViewScope;
|
|
109
|
+
/** Optional for older callers; Native uses it to correlate the source cutover snapshot. */
|
|
110
|
+
attemptNonce?: string;
|
|
109
111
|
};
|
|
110
112
|
export type DashboardRpcWatchOutput = {
|
|
111
113
|
active: boolean;
|
|
@@ -113,10 +115,120 @@ export type DashboardRpcWatchOutput = {
|
|
|
113
115
|
export type DashboardRpcOpenSettingsOutput = {
|
|
114
116
|
opened: true;
|
|
115
117
|
};
|
|
118
|
+
export type DashboardRpcCacheObserverEvent = {
|
|
119
|
+
type: "session.step.started";
|
|
120
|
+
created: number;
|
|
121
|
+
data: {
|
|
122
|
+
sessionID: string;
|
|
123
|
+
assistantMessageID: string;
|
|
124
|
+
/** OpenCode's selected model identity, not the resolved HTTP request route. */
|
|
125
|
+
model: {
|
|
126
|
+
providerID: string;
|
|
127
|
+
id: string;
|
|
128
|
+
variant?: string;
|
|
129
|
+
};
|
|
130
|
+
/** Captured before `llm.stream`; event.created is emitted at first output instead. */
|
|
131
|
+
started?: number;
|
|
132
|
+
connectionMethod?: "oauth" | "key" | "external";
|
|
133
|
+
};
|
|
134
|
+
} | {
|
|
135
|
+
type: "session.step.ended";
|
|
136
|
+
created: number;
|
|
137
|
+
data: {
|
|
138
|
+
sessionID: string;
|
|
139
|
+
assistantMessageID: string;
|
|
140
|
+
tokens: {
|
|
141
|
+
input?: number;
|
|
142
|
+
cache?: {
|
|
143
|
+
read?: number;
|
|
144
|
+
write?: number;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
} | {
|
|
149
|
+
/**
|
|
150
|
+
* One completed Claude Agent invocation whose cache writes were observed as 1-hour-only.
|
|
151
|
+
* Carries no transcript content, path or native id.
|
|
152
|
+
*/
|
|
153
|
+
type: "session.cache.ttl";
|
|
154
|
+
created: number;
|
|
155
|
+
data: {
|
|
156
|
+
sessionID: string;
|
|
157
|
+
assistantMessageID: string;
|
|
158
|
+
ttlMs: 3_600_000;
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
type: "session.cache.warming";
|
|
162
|
+
data: {
|
|
163
|
+
sessionID: string;
|
|
164
|
+
dispatchMs: number;
|
|
165
|
+
evidence: "warming-inferred";
|
|
166
|
+
};
|
|
167
|
+
} | {
|
|
168
|
+
type: "session.created";
|
|
169
|
+
data: {
|
|
170
|
+
sessionID: string;
|
|
171
|
+
parentID: string;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
type: "session.forked";
|
|
175
|
+
data: {
|
|
176
|
+
sessionID: string;
|
|
177
|
+
parentID?: string;
|
|
178
|
+
};
|
|
179
|
+
} | {
|
|
180
|
+
type: "session.compaction.ended" | "session.deleted";
|
|
181
|
+
data: {
|
|
182
|
+
sessionID: string;
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
/**
|
|
186
|
+
* Authoritative session execution state, projected from the host's own
|
|
187
|
+
* `session.status`, `session.idle` and `session.execution.*` events.
|
|
188
|
+
* Carries no message, error or credential content.
|
|
189
|
+
*/
|
|
190
|
+
type: "session.status";
|
|
191
|
+
created: number;
|
|
192
|
+
data: {
|
|
193
|
+
sessionID: string;
|
|
194
|
+
state: "busy" | "idle";
|
|
195
|
+
};
|
|
196
|
+
} | {
|
|
197
|
+
/**
|
|
198
|
+
* Narrow session-identity update, projected from the host's own
|
|
199
|
+
* `session.renamed`, `session.agent.selected` and `session.model.selected`
|
|
200
|
+
* events. Only display-identity fields are carried, and only those the
|
|
201
|
+
* source event contains; `created` is the host timestamp that dates the
|
|
202
|
+
* change for recency ordering.
|
|
203
|
+
*/
|
|
204
|
+
type: "session.metadata";
|
|
205
|
+
created: number;
|
|
206
|
+
data: {
|
|
207
|
+
sessionID: string;
|
|
208
|
+
title?: string;
|
|
209
|
+
agent?: string;
|
|
210
|
+
model?: {
|
|
211
|
+
providerID: string;
|
|
212
|
+
id: string;
|
|
213
|
+
variant?: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
} | {
|
|
217
|
+
type: "source.status";
|
|
218
|
+
created: number;
|
|
219
|
+
data: {
|
|
220
|
+
state: "unverified" | "observed" | "unavailable" | "stopped";
|
|
221
|
+
/** Present only on a source snapshot requested by an active watch attempt. */
|
|
222
|
+
attemptNonce?: string;
|
|
223
|
+
/** Opaque identity of the setup-owned host-event source that emitted this state. */
|
|
224
|
+
sourceBinding?: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
116
227
|
export type DashboardRpcEventData = {
|
|
117
|
-
topic: DashboardEventTopic;
|
|
228
|
+
topic: DashboardEventTopic | "cache.observer";
|
|
118
229
|
at: number;
|
|
119
230
|
scope?: "visibility";
|
|
231
|
+
cacheObserverEvent?: DashboardRpcCacheObserverEvent;
|
|
120
232
|
};
|
|
121
233
|
export type DashboardRpcQuotaNotificationKind = "low" | "exhausted" | "reset" | "provider-error";
|
|
122
234
|
/**
|
|
@@ -153,9 +265,8 @@ declare const DASHBOARD_RPC_ERRORS: {
|
|
|
153
265
|
export type DashboardRpcErrorCode = keyof typeof DASHBOARD_RPC_ERRORS;
|
|
154
266
|
export type DashboardRpcMethod = (typeof DashboardRpc.methods)[keyof typeof DashboardRpc.methods];
|
|
155
267
|
/**
|
|
156
|
-
* The explicit typed dashboard RPC.
|
|
157
|
-
* operation (plus
|
|
158
|
-
* no generic dispatch/call method.
|
|
268
|
+
* The explicit typed dashboard RPC. Methods map to a dashboard data-source or
|
|
269
|
+
* user settings-store operation (plus `watch`); there is no generic dispatch.
|
|
159
270
|
*/
|
|
160
271
|
export declare const DashboardRpc: {
|
|
161
272
|
id: string;
|
|
@@ -185,7 +296,9 @@ export declare const DashboardRpc: {
|
|
|
185
296
|
};
|
|
186
297
|
};
|
|
187
298
|
quota: {
|
|
188
|
-
input: QuotaRpcSchema<
|
|
299
|
+
input: QuotaRpcSchema<{
|
|
300
|
+
refresh?: boolean;
|
|
301
|
+
}>;
|
|
189
302
|
output: QuotaRpcSchema<import("./contracts/dashboard.js").QuotaSnapshot>;
|
|
190
303
|
errors: {
|
|
191
304
|
readonly "bad-request": QuotaRpcSchema<DashboardRpcErrorDetails>;
|
|
@@ -203,6 +316,7 @@ export declare const DashboardRpc: {
|
|
|
203
316
|
home: {
|
|
204
317
|
input: QuotaRpcSchema<{
|
|
205
318
|
range: RangeKey;
|
|
319
|
+
background?: boolean;
|
|
206
320
|
}>;
|
|
207
321
|
output: QuotaRpcSchema<import("./contracts/dashboard.js").HomeSnapshot>;
|
|
208
322
|
errors: {
|
|
@@ -391,5 +505,12 @@ export declare const DASHBOARD_HEALTH: DashboardHealth;
|
|
|
391
505
|
* unsafe payload is dropped before it can reach a window's presenter.
|
|
392
506
|
*/
|
|
393
507
|
export declare function isDashboardRpcQuotaNotificationData(value: unknown): value is DashboardRpcQuotaNotificationData;
|
|
508
|
+
/** Strict runtime validation for the narrow, content-free cache observer event DTO. */
|
|
509
|
+
export declare function isDashboardRpcCacheObserverEvent(value: unknown): value is DashboardRpcCacheObserverEvent;
|
|
510
|
+
/** Strict guard for cache observer DTOs wrapped in the existing invalidation event envelope. */
|
|
511
|
+
export declare function isDashboardRpcCacheObserverEventData(value: unknown): value is DashboardRpcEventData & {
|
|
512
|
+
topic: "cache.observer";
|
|
513
|
+
cacheObserverEvent: DashboardRpcCacheObserverEvent;
|
|
514
|
+
};
|
|
394
515
|
export {};
|
|
395
516
|
//# sourceMappingURL=rpc.d.ts.map
|