@anthonyhaussman/opencode-agy-auth 1.5.18 → 1.5.20-test.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 +22 -134
- package/dist/index.d.ts +4 -4
- package/dist/index.js +300 -21676
- package/dist/index.js.map +1 -1
- package/dist/src/acp/errors.d.ts +1 -1
- package/dist/src/acp/live-session.d.ts +11 -0
- package/dist/src/acp/mcp-bridge.d.ts +6 -0
- package/dist/src/acp/permission.d.ts +8 -3
- package/dist/src/acp/plugin.d.ts +9 -0
- package/dist/src/acp/process.d.ts +6 -0
- package/dist/src/acp/register-auth.d.ts +1 -1
- package/dist/src/acp/register.d.ts +1 -1
- package/dist/src/acp/stream-map.d.ts +8 -0
- package/dist/src/{plugin → acp}/types.d.ts +15 -26
- package/package.json +1 -7
- package/dist/src/constants.d.ts +0 -9
- package/dist/src/fetch.d.ts +0 -1
- package/dist/src/plugin/auth.d.ts +0 -14
- package/dist/src/plugin/cache.d.ts +0 -35
- package/dist/src/plugin/headers.d.ts +0 -7
- package/dist/src/plugin/notify.d.ts +0 -9
- package/dist/src/plugin/oauth-authorize.d.ts +0 -24
- package/dist/src/plugin/pricing.d.ts +0 -5
- package/dist/src/plugin/project/context.d.ts +0 -13
- package/dist/src/plugin/project/index.d.ts +0 -2
- package/dist/src/plugin/project/types.d.ts +0 -84
- package/dist/src/plugin/project/utils.d.ts +0 -35
- package/dist/src/plugin/provider.d.ts +0 -12
- package/dist/src/plugin/quota-summary.d.ts +0 -16
- package/dist/src/plugin/quota-utils.d.ts +0 -5
- package/dist/src/plugin/quota.d.ts +0 -16
- package/dist/src/plugin/tier.d.ts +0 -29
- package/dist/src/plugin/token.d.ts +0 -2
- package/dist/src/plugin/tos-warning.d.ts +0 -16
- package/dist/src/plugin/traffic.d.ts +0 -47
- package/dist/src/plugin/v2-fetch.d.ts +0 -1
- package/dist/src/plugin/v2-session.d.ts +0 -8
- package/dist/src/plugin/v2-storage.d.ts +0 -3
- package/dist/src/plugin/v2.d.ts +0 -15
- package/dist/src/sdk/activity-request-id.d.ts +0 -5
- package/dist/src/sdk/agy-cli-version.d.ts +0 -1
- package/dist/src/sdk/cache/signature-cache.d.ts +0 -130
- package/dist/src/sdk/chat-logger.d.ts +0 -8
- package/dist/src/sdk/fetch_models.d.ts +0 -48
- package/dist/src/sdk/fetch_project.d.ts +0 -9
- package/dist/src/sdk/fetch_quota.d.ts +0 -9
- package/dist/src/sdk/oauth.d.ts +0 -26
- package/dist/src/sdk/request/identifiers.d.ts +0 -16
- package/dist/src/sdk/request/index.d.ts +0 -12
- package/dist/src/sdk/request/openai.d.ts +0 -17
- package/dist/src/sdk/request/prepare.d.ts +0 -19
- package/dist/src/sdk/request/response.d.ts +0 -5
- package/dist/src/sdk/request/shared.d.ts +0 -20
- package/dist/src/sdk/request/thinking.d.ts +0 -129
- package/dist/src/sdk/request/tool-mapper.d.ts +0 -47
- package/dist/src/sdk/request/turn-state-tracker.d.ts +0 -21
- package/dist/src/sdk/request-helpers/errors.d.ts +0 -9
- package/dist/src/sdk/request-helpers/index.d.ts +0 -4
- package/dist/src/sdk/request-helpers/parsing.d.ts +0 -9
- package/dist/src/sdk/request-helpers/thinking.d.ts +0 -5
- package/dist/src/sdk/request-helpers/types.d.ts +0 -65
- package/dist/src/sdk/retry/cooldown-store.d.ts +0 -14
- package/dist/src/sdk/retry/helpers.d.ts +0 -19
- package/dist/src/sdk/retry/index.d.ts +0 -9
- package/dist/src/sdk/retry/quota.d.ts +0 -37
- package/dist/src/sdk/terminal-hyperlink.d.ts +0 -3
- package/dist/src/sdk/user-agent.d.ts +0 -5
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export declare const GEMINI_PREVIEW_LINK = "https://goo.gle/enable-preview-features";
|
|
2
|
-
export interface GeminiApiError {
|
|
3
|
-
code?: number;
|
|
4
|
-
message?: string;
|
|
5
|
-
status?: string;
|
|
6
|
-
details?: unknown[];
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* The minimal representation of the Gemini API response we touch.
|
|
11
|
-
*/
|
|
12
|
-
export interface GeminiApiBody {
|
|
13
|
-
response?: unknown;
|
|
14
|
-
error?: GeminiApiError;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export interface GeminiErrorEnhancement {
|
|
18
|
-
body?: GeminiApiBody;
|
|
19
|
-
retryAfterMs?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Usage metadata exposed by Gemini responses. Fields are optional to reflect partial payloads.
|
|
23
|
-
*/
|
|
24
|
-
export interface GeminiUsageMetadata {
|
|
25
|
-
totalTokenCount?: number;
|
|
26
|
-
promptTokenCount?: number;
|
|
27
|
-
candidatesTokenCount?: number;
|
|
28
|
-
cachedContentTokenCount?: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Thinking configuration accepted by Gemini.
|
|
32
|
-
*/
|
|
33
|
-
export interface ThinkingConfig {
|
|
34
|
-
thinkingBudget?: number;
|
|
35
|
-
thinkingLevel?: string | number;
|
|
36
|
-
includeThoughts?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface GoogleRpcErrorInfo {
|
|
39
|
-
"@type"?: string;
|
|
40
|
-
reason?: string;
|
|
41
|
-
domain?: string;
|
|
42
|
-
metadata?: Record<string, string>;
|
|
43
|
-
}
|
|
44
|
-
export interface GoogleRpcHelp {
|
|
45
|
-
"@type"?: string;
|
|
46
|
-
links?: Array<{
|
|
47
|
-
description?: string;
|
|
48
|
-
url?: string;
|
|
49
|
-
}>;
|
|
50
|
-
}
|
|
51
|
-
export interface GoogleRpcQuotaFailure {
|
|
52
|
-
"@type"?: string;
|
|
53
|
-
violations?: Array<{
|
|
54
|
-
subject?: string;
|
|
55
|
-
description?: string;
|
|
56
|
-
}>;
|
|
57
|
-
}
|
|
58
|
-
export interface GoogleRpcRetryInfo {
|
|
59
|
-
"@type"?: string;
|
|
60
|
-
retryDelay?: string | {
|
|
61
|
-
seconds?: number;
|
|
62
|
-
nanos?: number;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export declare const CLOUDCODE_DOMAINS: string[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function loadCooldowns(): Map<string, number>;
|
|
2
|
-
export declare function saveCooldowns(entries: Map<string, number>): boolean;
|
|
3
|
-
export declare class CooldownStore {
|
|
4
|
-
private dirty;
|
|
5
|
-
private lastWriteTime;
|
|
6
|
-
private writeTimer;
|
|
7
|
-
private entries;
|
|
8
|
-
bind(entries: Map<string, number>): void;
|
|
9
|
-
markDirty(): void;
|
|
10
|
-
flush(): boolean;
|
|
11
|
-
shutdown(): void;
|
|
12
|
-
private scheduleThrottledWrite;
|
|
13
|
-
private clearWriteTimer;
|
|
14
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_MAX_ATTEMPTS = 3;
|
|
2
|
-
/**
|
|
3
|
-
* Ensures the request body is replayable before attempting a retry.
|
|
4
|
-
*/
|
|
5
|
-
export declare function canRetryRequest(init: RequestInit | undefined): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Status code-based retry strategy, consistent with Gemini/Agy CLI.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isRetryableStatus(status: number): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Handles transient network failures (including error codes nested in `cause.code`).
|
|
12
|
-
*/
|
|
13
|
-
export declare function isRetryableNetworkError(error: unknown): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Prioritizes parsing retry delay milliseconds via Retry-After header, quota info in response body, or fallback exponential backoff.
|
|
16
|
-
*/
|
|
17
|
-
export declare function resolveRetryDelayMs(response: Response, attempt: number, quotaDelayMs?: number): Promise<number>;
|
|
18
|
-
export declare function getExponentialDelayWithJitter(attempt: number): number;
|
|
19
|
-
export declare function wait(ms: number): Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { retryInternals } from "./quota";
|
|
2
|
-
declare function initCooldownPersistence(): void;
|
|
3
|
-
export { initCooldownPersistence };
|
|
4
|
-
/**
|
|
5
|
-
* Sends a request with retry/exponential backoff semantics, consistent with Gemini/Agy CLI.
|
|
6
|
-
*/
|
|
7
|
-
export declare function fetchWithRetry(input: RequestInfo, init: RequestInit | undefined): Promise<Response>;
|
|
8
|
-
export declare function shutdownRetryCooldowns(): void;
|
|
9
|
-
export { retryInternals };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { RetrieveUserQuotaSummaryResponse } from "../../plugin/project/types";
|
|
2
|
-
export interface QuotaContext {
|
|
3
|
-
terminal: boolean;
|
|
4
|
-
retryDelayMs?: number;
|
|
5
|
-
reason?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* NOTE: Special Design - Granular 429 Error Classification and Retry Strategy
|
|
9
|
-
* Traditional network retry modules usually treat 429 errors uniformly as rate-limiting for retries or throwing errors.
|
|
10
|
-
* Here we parse it granularly:
|
|
11
|
-
* 1. Differentiate between "Account physical quota exhausted" and "Model instantaneous capacity overloaded (MODEL_CAPACITY_EXHAUSTED)".
|
|
12
|
-
* 2. If it's physical quota exhaustion, it's considered an unretriable terminal state to avoid meaningless network requests;
|
|
13
|
-
* If it's a momentary overload of Google's backend model capacity, it's considered retriable, parses RetryInfo delay from response, and notifies the upper layer (showing a Toast in TUI, backing off, and retrying).
|
|
14
|
-
*/
|
|
15
|
-
export declare function classifyQuotaResponse(response: Response): Promise<QuotaContext | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Extracts the RetryInfo delay hint directly from the error payload.
|
|
18
|
-
*/
|
|
19
|
-
export declare function parseRetryDelayFromBody(response: Response): Promise<number | null>;
|
|
20
|
-
declare function parseRetryDelayValue(value: string | {
|
|
21
|
-
seconds?: number;
|
|
22
|
-
nanos?: number;
|
|
23
|
-
}): number | null;
|
|
24
|
-
declare function parseRetryDelayFromMessage(message: string): number | null;
|
|
25
|
-
export declare const MAX_QUOTA_RESET_WAIT_MS = 7200000;
|
|
26
|
-
export declare function findResetTimeForModel(summary: RetrieveUserQuotaSummaryResponse | null | undefined, model?: string): string | null;
|
|
27
|
-
export declare function resolveQuotaResetDelay(accessToken: string, projectId: string, model?: string, userAgentModel?: string): Promise<{
|
|
28
|
-
waitMs: number;
|
|
29
|
-
resetTime: string;
|
|
30
|
-
} | null>;
|
|
31
|
-
export declare const retryInternals: {
|
|
32
|
-
parseRetryDelayValue: typeof parseRetryDelayValue;
|
|
33
|
-
parseRetryDelayFromMessage: typeof parseRetryDelayFromMessage;
|
|
34
|
-
findResetTimeForModel: typeof findResetTimeForModel;
|
|
35
|
-
resolveQuotaResetDelay: typeof resolveQuotaResetDelay;
|
|
36
|
-
};
|
|
37
|
-
export {};
|