opencode-quota-gui 1.3.0 → 1.3.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.
- package/README.md +27 -17
- package/dist/bin/opencode-quota-gui.js +0 -0
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/dashboard.d.ts +8 -1
- package/dist/contracts/dto-guards.js +2 -0
- package/dist/contracts/openai-quota.d.ts +3 -0
- package/dist/contracts/openai-quota.js +3 -0
- package/dist/data/modelsdev-temporal.min.json +57 -0
- package/dist/gui/config.d.ts +3 -3
- package/dist/gui/config.js +31 -2
- package/dist/gui/lifecycle.d.ts +5 -3
- package/dist/gui/lifecycle.js +3 -3
- package/dist/gui/primary-quota-windows.js +16 -14
- package/dist/gui/provider-cards.d.ts +10 -2
- package/dist/gui/provider-cards.js +51 -23
- package/dist/gui/quota-notification-detector.d.ts +4 -4
- package/dist/gui/quota-notification-detector.js +76 -42
- package/dist/gui/quota-notification-observer.d.ts +2 -3
- package/dist/gui/quota-notification-observer.js +68 -19
- package/dist/gui/rpc.d.ts +2 -0
- package/dist/gui/rpc.js +11 -3
- package/dist/gui/server.js +11 -2
- package/dist/gui/snapshot-service.d.ts +3 -1
- package/dist/gui/snapshot-service.js +126 -18
- package/dist/gui/sources.js +98 -56
- package/dist/gui-experimental.cjs +230 -225
- package/dist/lib/accounting-format.js +8 -0
- 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-auth.d.ts +2 -3
- package/dist/lib/anthropic-auth.js +2 -3
- package/dist/lib/anthropic.d.ts +48 -12
- package/dist/lib/anthropic.js +610 -275
- 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 +981 -0
- package/dist/lib/cache-observer.d.ts +138 -0
- package/dist/lib/cache-observer.js +317 -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.js +5 -3
- 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 +193 -2
- package/dist/lib/copilot.js +171 -86
- 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 +1 -0
- package/dist/lib/entries.d.ts +23 -0
- package/dist/lib/entries.js +2 -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/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/mimo.d.ts +2 -0
- package/dist/lib/mimo.js +36 -0
- 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-go.js +29 -2
- package/dist/lib/opencode-version-core.d.ts +23 -0
- package/dist/lib/opencode-version-core.js +49 -0
- package/dist/lib/opencode-version.d.ts +2 -22
- package/dist/lib/opencode-version.js +4 -48
- 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-registration.d.ts +19 -9
- package/dist/lib/provider-registration.js +17 -6
- package/dist/lib/quota-command-format.js +1 -1
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.js +25 -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 +12 -35
- package/dist/lib/quota-render-data.d.ts +6 -0
- package/dist/lib/quota-render-data.js +43 -17
- package/dist/lib/quota-state-codec.js +17 -1
- package/dist/lib/quota-state.d.ts +7 -1
- package/dist/lib/quota-state.js +208 -34
- package/dist/lib/quota-stats.js +21 -0
- package/dist/lib/quota-status.js +3 -51
- package/dist/lib/scoped-update.d.ts +1 -1
- package/dist/lib/synthetic.js +65 -54
- package/dist/lib/types.d.ts +31 -1
- package/dist/lib/types.js +13 -0
- package/dist/lib/xai.js +48 -22
- package/dist/plugin.js +261 -13
- package/dist/provider-logos/NOTICE.md +1 -1
- package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
- package/dist/providers/alibaba-coding-plan.js +107 -104
- package/dist/providers/anthropic.d.ts +12 -3
- package/dist/providers/anthropic.js +71 -228
- package/dist/providers/cache-policies.d.ts +11 -4
- package/dist/providers/cache-policies.js +19 -13
- package/dist/providers/claude-agent.d.ts +19 -0
- package/dist/providers/claude-agent.js +196 -0
- package/dist/providers/copilot.js +2 -0
- package/dist/providers/glm-coding-plan-provider.d.ts +1 -0
- 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/opencode-go.js +3 -0
- package/dist/providers/opencode-zen.js +2 -0
- 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 +2 -0
- package/dist/providers/result-helpers.js +2 -0
- package/dist/rpc.d.ts +121 -8
- package/dist/rpc.js +204 -12
- package/dist/ui/assets/{index-cDd9jUVY.css → index-BcueIm3Z.css} +1 -1
- package/dist/ui/assets/index-C6qRSoh8.js +10 -0
- package/dist/ui/assets/{popover-BGkgv9s0.js → popover-4bFSvRZ7.js} +1 -1
- package/dist/ui/assets/providers/claude-agent.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +44 -45
- 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/lib/anthropic.d.ts
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Uses the local Claude CLI/runtime to detect install/auth state first. When
|
|
5
5
|
* Claude auth is confirmed but local quota windows are missing, it falls back
|
|
6
6
|
* to Anthropic's OAuth usage endpoint using the first usable OAuth access
|
|
7
|
-
* token
|
|
8
|
-
* Keychain first, then the local credentials file).
|
|
7
|
+
* token from Claude OAuth credentials (macOS Keychain first, then the local credentials file).
|
|
9
8
|
*/
|
|
9
|
+
import type { BankedResetAvailability } from "../contracts/openai-quota.js";
|
|
10
10
|
import type { ProviderFailureCategory } from "../contracts/provider-failure.js";
|
|
11
|
+
import type { FixedWindowProjectionEvidence } from "./entries.js";
|
|
11
12
|
import { type ResolvedAuthIdentity } from "./resolved-auth-identity.js";
|
|
12
13
|
export interface AnthropicQuotaWindow {
|
|
13
14
|
utilization?: number;
|
|
@@ -27,31 +28,41 @@ export interface AnthropicExtraUsage {
|
|
|
27
28
|
utilization?: number;
|
|
28
29
|
}
|
|
29
30
|
export interface AnthropicUsageResponse {
|
|
30
|
-
five_hour
|
|
31
|
-
seven_day
|
|
31
|
+
five_hour?: AnthropicQuotaWindow | null;
|
|
32
|
+
seven_day?: AnthropicQuotaWindow | null;
|
|
32
33
|
extra_usage?: AnthropicExtraUsage;
|
|
33
34
|
limits?: unknown[];
|
|
34
35
|
}
|
|
35
36
|
export interface AnthropicQuotaResult {
|
|
36
37
|
success: true;
|
|
37
|
-
five_hour
|
|
38
|
+
five_hour?: {
|
|
38
39
|
percentRemaining: number;
|
|
39
40
|
resetTimeIso?: string;
|
|
41
|
+
fixedWindow?: FixedWindowProjectionEvidence;
|
|
40
42
|
};
|
|
41
|
-
seven_day
|
|
43
|
+
seven_day?: {
|
|
42
44
|
percentRemaining: number;
|
|
43
45
|
resetTimeIso?: string;
|
|
46
|
+
fixedWindow?: FixedWindowProjectionEvidence;
|
|
44
47
|
};
|
|
45
48
|
extra_usage?: {
|
|
46
49
|
percentRemaining: number;
|
|
47
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* The Fable scope is `weekly_scoped` with a reset time only. No fixed cycle or duration is
|
|
53
|
+
* supplied, so it carries no fixed-window evidence and gets no runway.
|
|
54
|
+
*/
|
|
48
55
|
fable_weekly?: {
|
|
49
56
|
percentRemaining: number;
|
|
50
57
|
resetTimeIso?: string;
|
|
51
58
|
};
|
|
59
|
+
/** Eligible, active, unpaused saved resets; only counts and expiry. Absent means none or unknown. */
|
|
60
|
+
saved_resets?: BankedResetAvailability;
|
|
52
61
|
}
|
|
53
62
|
export interface AnthropicUsageParseOptions {
|
|
54
63
|
includeExtraUsage?: boolean;
|
|
64
|
+
/** When the usage payload was observed; defaults to now. Used only for fixed-window evidence. */
|
|
65
|
+
observedAtMs?: number;
|
|
55
66
|
}
|
|
56
67
|
export interface AnthropicQuotaError {
|
|
57
68
|
success: false;
|
|
@@ -61,7 +72,7 @@ export interface AnthropicQuotaError {
|
|
|
61
72
|
}
|
|
62
73
|
export type AnthropicResult = AnthropicQuotaResult | AnthropicQuotaError | null;
|
|
63
74
|
export type AnthropicAuthStatus = "authenticated" | "unauthenticated" | "unknown";
|
|
64
|
-
export type AnthropicQuotaSource = "claude-auth-status-json" | "claude-credentials-oauth-api" | "
|
|
75
|
+
export type AnthropicQuotaSource = "claude-auth-status-json" | "claude-credentials-oauth-api" | "none";
|
|
65
76
|
export interface AnthropicDiagnostics {
|
|
66
77
|
installed: boolean;
|
|
67
78
|
version: string | null;
|
|
@@ -79,31 +90,56 @@ export interface AnthropicDiagnostics {
|
|
|
79
90
|
message?: string;
|
|
80
91
|
/** Source-assigned category for a failed OAuth usage request; absent otherwise. */
|
|
81
92
|
failureCategory?: ProviderFailureCategory;
|
|
93
|
+
/** Epoch ms when a rate-limited usage request may be retried; absent otherwise. */
|
|
94
|
+
retryAtMs?: number;
|
|
82
95
|
quota?: AnthropicQuotaResult;
|
|
96
|
+
/** sha256 of the OAuth token bound to this probe, when a CLI token was used. */
|
|
97
|
+
credentialFingerprint?: string;
|
|
98
|
+
/** Display-only plan (e.g. `Claude (Max)`) of the verified Claude CLI login that answered the quota probe. */
|
|
99
|
+
planLabel?: string;
|
|
83
100
|
}
|
|
84
101
|
export interface AnthropicProbeOptions {
|
|
85
102
|
binaryPath?: string;
|
|
103
|
+
operationCache?: Map<symbol, unknown>;
|
|
104
|
+
forceRefresh?: boolean;
|
|
86
105
|
requestTimeoutMs?: number;
|
|
87
106
|
}
|
|
88
107
|
export type ClaudeCommandInvocation = {
|
|
89
108
|
file: string;
|
|
90
109
|
args: string[];
|
|
91
110
|
display: string;
|
|
111
|
+
/** Set for cmd.exe bridges: the command line is already quoted, so Node must not re-quote it. */
|
|
112
|
+
windowsVerbatimArguments?: boolean;
|
|
92
113
|
};
|
|
93
114
|
/** Which credential store provided the OAuth access token used for the usage probe. */
|
|
94
|
-
export type AnthropicCredentialSource = "
|
|
115
|
+
export type AnthropicCredentialSource = "claude-credentials";
|
|
95
116
|
export declare function resolveAnthropicBinaryPath(binaryPath?: string): string;
|
|
96
117
|
export declare function buildClaudeCommandInvocation(binaryPath: string, args: string[], runtime?: {
|
|
97
118
|
platform?: NodeJS.Platform;
|
|
98
119
|
comspec?: string;
|
|
99
120
|
}): ClaudeCommandInvocation;
|
|
100
121
|
declare function parseUsageResponse(data: unknown, options?: AnthropicUsageParseOptions): AnthropicQuotaResult | null;
|
|
101
|
-
declare function parseOAuthUsageResponse(data: unknown): AnthropicQuotaResult | null;
|
|
102
|
-
|
|
122
|
+
declare function parseOAuthUsageResponse(data: unknown, observedAtMs?: number): AnthropicQuotaResult | null;
|
|
123
|
+
/**
|
|
124
|
+
* Parses one candidate config directory. `undefined` means the value is absent, which is not an
|
|
125
|
+
* error. `null` means it is present but cannot name a directory (not a string, empty, padded with
|
|
126
|
+
* whitespace, or relative), so the caller must fail closed rather than read another login.
|
|
127
|
+
*/
|
|
128
|
+
export declare function parseClaudeConfigDirectoryCandidate(value: unknown): string | null | undefined;
|
|
129
|
+
export declare function fingerprintAccessToken(accessToken: string): string;
|
|
130
|
+
export declare function queryAnthropicQuotaWithOAuth(accessToken: string, requestTimeoutMs?: number, forcedOperationCache?: Map<symbol, unknown>): Promise<AnthropicResult>;
|
|
103
131
|
export declare function clearAnthropicDiagnosticsCacheForTests(): void;
|
|
104
132
|
export declare function getAnthropicDiagnostics(options?: AnthropicProbeOptions): Promise<AnthropicDiagnostics>;
|
|
105
133
|
export declare function hasAnthropicCredentialsConfigured(options?: AnthropicProbeOptions): Promise<boolean>;
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Identity of the Claude Agent provider's single Claude CLI login. Null when the CLI reports quota
|
|
136
|
+
* itself (no account binding) or cannot be probed, so the caller must not cache it.
|
|
137
|
+
*/
|
|
138
|
+
export declare function resolveClaudeAgentAccountIdentity(params: {
|
|
139
|
+
binaryPath?: string;
|
|
140
|
+
operationCache?: Map<symbol, unknown>;
|
|
141
|
+
onlyCurrentModel: boolean;
|
|
142
|
+
runtimeDetected: boolean;
|
|
143
|
+
}): Promise<ResolvedAuthIdentity | null>;
|
|
108
144
|
export { parseOAuthUsageResponse, parseUsageResponse };
|
|
109
145
|
//# sourceMappingURL=anthropic.d.ts.map
|