@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
package/dist/src/acp/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AgyErrorCode = "tos_disabled" | "auth_required" | "missing" | "too_old" | "plugin_install" | "bridge_unreachable" | "crash" | "other";
|
|
1
|
+
export type AgyErrorCode = "tos_disabled" | "auth_required" | "missing" | "too_old" | "plugin_install" | "bridge_unreachable" | "crash" | "rate_limited" | "other";
|
|
2
2
|
export declare const BRIDGE_NOT_CONNECTED_TEXT = "agy did not connect to the OpenCode tool bridge. Check that \"agy plugin list\" shows opencode-bridge, then retry.";
|
|
3
3
|
export declare const TOS_DISABLED_TEXT = "Google disabled Antigravity access for this account for a Terms of Service violation. Submit an appeal to Google, or switch the google-agy-acp provider to the Gemini API key or Vertex (Agent Platform) method.";
|
|
4
4
|
/** Error with a known classification, raised by the provider itself. */
|
|
@@ -59,6 +59,8 @@ export declare class LiveTurn {
|
|
|
59
59
|
done: Promise<void>;
|
|
60
60
|
detachAbort?: () => void;
|
|
61
61
|
interruptWrite?: Promise<void>;
|
|
62
|
+
/** Latest context use agy reported through `usage_update` (tokens). */
|
|
63
|
+
contextUsed?: number;
|
|
62
64
|
setAbortSignal(signal: AbortSignal | undefined, onAbort: (reason: unknown) => void): void;
|
|
63
65
|
}
|
|
64
66
|
export interface LiveSessionConfig {
|
|
@@ -67,6 +69,8 @@ export interface LiveSessionConfig {
|
|
|
67
69
|
tools: BridgeToolDef[];
|
|
68
70
|
session: NewSessionParams;
|
|
69
71
|
auth: AgyAuth;
|
|
72
|
+
/** agy session id stored for this OpenCode session; resumed instead of opening a new one when set. */
|
|
73
|
+
resumeId?: string;
|
|
70
74
|
}
|
|
71
75
|
/** agy process + MCP bridge + agy session for one OpenCode session. */
|
|
72
76
|
export declare class LiveSession implements PoolEntry {
|
|
@@ -79,6 +83,8 @@ export declare class LiveSession implements PoolEntry {
|
|
|
79
83
|
turn?: LiveTurn;
|
|
80
84
|
dead: boolean;
|
|
81
85
|
record?: SessionRecord;
|
|
86
|
+
/** True while the current agy session was resumed from the store (it already holds the history). */
|
|
87
|
+
resumed: boolean;
|
|
82
88
|
readonly claimed: Set<string>;
|
|
83
89
|
readonly callOrder: string[];
|
|
84
90
|
private readonly toolCalls;
|
|
@@ -89,6 +95,11 @@ export declare class LiveSession implements PoolEntry {
|
|
|
89
95
|
onDead(listener: () => void): void;
|
|
90
96
|
/** Opens a new agy session (closing the current one, if any). */
|
|
91
97
|
openSession(): Promise<AcpModelInfo[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Reattaches the stored agy session so history and prompt cache survive a process restart.
|
|
100
|
+
* Falls back to a new session when agy cannot resume it (expired, deleted, other machine).
|
|
101
|
+
*/
|
|
102
|
+
resumeOrOpen(sessionId: string): Promise<AcpModelInfo[]>;
|
|
92
103
|
private onPermission;
|
|
93
104
|
private markClaimed;
|
|
94
105
|
startTurn(blocks: AcpContentBlock[]): LiveTurn;
|
|
@@ -10,9 +10,15 @@ export interface BridgeCall {
|
|
|
10
10
|
toolName: string;
|
|
11
11
|
input: unknown;
|
|
12
12
|
}
|
|
13
|
+
export type ToolImage = {
|
|
14
|
+
data: string;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
};
|
|
17
|
+
/** An OpenCode tool result as agy sees it: text plus optional base64 images. */
|
|
13
18
|
export type ToolOutcome = {
|
|
14
19
|
text: string;
|
|
15
20
|
isError: boolean;
|
|
21
|
+
images?: ToolImage[];
|
|
16
22
|
};
|
|
17
23
|
export declare class PendingTools {
|
|
18
24
|
private readonly opts;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { AcpPermissionRequest, AcpPermissionResponse } from "./process";
|
|
2
|
+
/** Directory where OpenCode stores full outputs of truncated tool results. */
|
|
3
|
+
export declare function openCodeToolOutputDir(env?: NodeJS.ProcessEnv): string;
|
|
4
|
+
/** Directory where OpenCode saves the full output of truncated shell commands. */
|
|
5
|
+
export declare function openCodeShellOutputDir(env?: NodeJS.ProcessEnv): string;
|
|
2
6
|
/**
|
|
3
|
-
* Allows
|
|
4
|
-
* else. Replies `cancelled`
|
|
7
|
+
* Allows `call_mcp_tool` aimed at the OpenCode bridge and `read_file` of
|
|
8
|
+
* OpenCode tool-output files; rejects everything else. Replies `cancelled`
|
|
9
|
+
* only when no option of the needed kind exists.
|
|
5
10
|
*/
|
|
6
|
-
export declare function decidePermission(req: AcpPermissionRequest): {
|
|
11
|
+
export declare function decidePermission(req: AcpPermissionRequest, env?: NodeJS.ProcessEnv): {
|
|
7
12
|
response: AcpPermissionResponse;
|
|
8
13
|
allowed: boolean;
|
|
9
14
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OpenCodeV2PluginContext, OpenCodeV2PluginDefinition } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin id. It stays `google-agy` (the id of earlier releases) so hosts that
|
|
4
|
+
* already know this plugin see the same id after the upgrade.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AGY_PLUGIN_ID = "google-agy";
|
|
7
|
+
/** OpenCode v2 setup: registers the google-agy-acp provider. */
|
|
8
|
+
export declare function setupAgyPlugin(ctx: OpenCodeV2PluginContext): Promise<void>;
|
|
9
|
+
export declare const agyPluginDefinition: OpenCodeV2PluginDefinition;
|
|
@@ -156,6 +156,12 @@ export declare class AgyAcpProcess {
|
|
|
156
156
|
touch(): void;
|
|
157
157
|
private rpc;
|
|
158
158
|
newSession(p: NewSessionParams): Promise<NewSessionResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Reattaches a session agy persisted earlier (`session/resume` replays no history and keeps the
|
|
161
|
+
* prompt cache). Rejects when agy no longer knows the session.
|
|
162
|
+
*/
|
|
163
|
+
resumeSession(sessionId: string, p: NewSessionParams): Promise<NewSessionResult>;
|
|
164
|
+
private applySelections;
|
|
159
165
|
prompt(sessionId: string, blocks: AcpContentBlock[]): Promise<PromptResult>;
|
|
160
166
|
cancel(sessionId: string): void;
|
|
161
167
|
closeSession(sessionId: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenCodeV2PluginContext, PluginClient } from "
|
|
1
|
+
import type { OpenCodeV2PluginContext, PluginClient } from "./types";
|
|
2
2
|
import { createAgyPluginInstaller } from "./agy-plugin";
|
|
3
3
|
import { listAgyModels, probeAgy } from "./binary";
|
|
4
4
|
import { type AgyAcpDeps } from "./language-model";
|
|
@@ -29,8 +29,16 @@ export declare class StreamMapper {
|
|
|
29
29
|
private counter;
|
|
30
30
|
private readonly seen;
|
|
31
31
|
private readonly providerCalls;
|
|
32
|
+
/** agy's final 429 message, set when agy gave up retrying a rate-limited request. */
|
|
33
|
+
rateLimit?: string;
|
|
32
34
|
map(update: AcpSessionUpdate): MappedEvent;
|
|
33
35
|
flush(): LanguageModelV3StreamPart[];
|
|
36
|
+
/**
|
|
37
|
+
* Ends the turn: closes the open text block and gives every provider-executed
|
|
38
|
+
* call agy never finished an error result, so OpenCode does not report a
|
|
39
|
+
* missing tool result (agy can drop the update after a denied or aborted call).
|
|
40
|
+
*/
|
|
41
|
+
finish(): LanguageModelV3StreamPart[];
|
|
34
42
|
private close;
|
|
35
43
|
private chunk;
|
|
36
44
|
private toolCall;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export type PluginClient = OpencodeClient;
|
|
14
|
-
export interface RefreshParts {
|
|
15
|
-
refreshToken: string;
|
|
16
|
-
projectId?: string;
|
|
17
|
-
managedProjectId?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ProjectContextResult {
|
|
20
|
-
auth: OAuthAuthDetails;
|
|
21
|
-
effectiveProjectId: string;
|
|
1
|
+
/** The part of the OpenCode client the provider uses: TUI toasts. */
|
|
2
|
+
export interface PluginClient {
|
|
3
|
+
tui?: {
|
|
4
|
+
showToast?: (input: {
|
|
5
|
+
body: {
|
|
6
|
+
title?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
variant: "info" | "success" | "warning" | "error";
|
|
9
|
+
duration?: number;
|
|
10
|
+
};
|
|
11
|
+
}) => unknown;
|
|
12
|
+
};
|
|
22
13
|
}
|
|
23
|
-
export type { Provider as ProviderV2, Model as ModelV2 } from '@opencode-ai/sdk/v2';
|
|
24
14
|
export interface OpenCodeV2TransformRegistry<T = any> {
|
|
25
15
|
transform: (fn: (target: T) => Promise<void> | void) => void;
|
|
26
16
|
}
|
|
@@ -35,7 +25,7 @@ export interface ModelRequestEvent {
|
|
|
35
25
|
headers: Record<string, string>;
|
|
36
26
|
}
|
|
37
27
|
export interface OpenCodeV2SessionHook {
|
|
38
|
-
(name:
|
|
28
|
+
(name: "model.request", handler: (ev: ModelRequestEvent) => void | Promise<void>, options?: {
|
|
39
29
|
providerID?: string;
|
|
40
30
|
}): unknown;
|
|
41
31
|
(name: string, handler: (...args: any[]) => any, options?: {
|
|
@@ -55,7 +45,7 @@ export interface OpenCodeV2PluginLocation {
|
|
|
55
45
|
}
|
|
56
46
|
/** OpenCode 2.3 connection status: only `needs_auth` exists; `undefined` clears it. */
|
|
57
47
|
export interface OpenCodeV2ConnectionStatus {
|
|
58
|
-
status:
|
|
48
|
+
status: "needs_auth";
|
|
59
49
|
message: string;
|
|
60
50
|
url?: string;
|
|
61
51
|
}
|
|
@@ -84,7 +74,7 @@ export interface OpenCodeV2PluginContext {
|
|
|
84
74
|
command: OpenCodeV2TransformRegistry;
|
|
85
75
|
session: OpenCodeV2SessionRegistry;
|
|
86
76
|
aisdk?: {
|
|
87
|
-
hook: (name:
|
|
77
|
+
hook: (name: "sdk" | "language", handler: (event: any) => Promise<void> | void) => Promise<{
|
|
88
78
|
dispose(): void;
|
|
89
79
|
} | void> | void;
|
|
90
80
|
};
|
|
@@ -99,4 +89,3 @@ export interface OpenCodeV2PluginDefinition {
|
|
|
99
89
|
id: string;
|
|
100
90
|
setup: (ctx: OpenCodeV2PluginContext) => Promise<void> | void;
|
|
101
91
|
}
|
|
102
|
-
export declare function defineOpenCodeV2Plugin(def: OpenCodeV2PluginDefinition): OpenCodeV2PluginDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthonyhaussman/opencode-agy-auth",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.20-test.1",
|
|
4
4
|
"author": "antigravity",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"antigravity",
|
|
30
30
|
"agy",
|
|
31
31
|
"google-gemini",
|
|
32
|
-
"oauth",
|
|
33
32
|
"ai-coding",
|
|
34
33
|
"gemini-flash"
|
|
35
34
|
],
|
|
@@ -41,12 +40,10 @@
|
|
|
41
40
|
"test:watch": "vitest",
|
|
42
41
|
"build": "tsup && tsc -p tsconfig.build.json",
|
|
43
42
|
"typecheck": "tsc",
|
|
44
|
-
"models:refresh": "node scripts/fetch-models.mjs",
|
|
45
43
|
"smoke:node-import": "node -e \"import('./dist/index.js').then(() => console.log('ok')).catch((error) => { console.error(error); process.exit(1); })\"",
|
|
46
44
|
"prepack": "npm run build"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@opencode-ai/sdk": "^1.19.6",
|
|
50
47
|
"@types/node": "^26.6.11",
|
|
51
48
|
"@vitest/coverage-v8": "^5.1.2",
|
|
52
49
|
"tsup": "^9.0.0",
|
|
@@ -54,11 +51,8 @@
|
|
|
54
51
|
"vitest": "^5.1.2"
|
|
55
52
|
},
|
|
56
53
|
"dependencies": {
|
|
57
|
-
"@ai-sdk/google": "^4.0.128",
|
|
58
54
|
"@ai-sdk/provider": "4.0.39",
|
|
59
55
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
60
|
-
"@openauthjs/openauth": "^0.4.3",
|
|
61
|
-
"@opencode-ai/plugin": "^1.19.6",
|
|
62
56
|
"ajv": "^8.20.0"
|
|
63
57
|
}
|
|
64
58
|
}
|
package/dist/src/constants.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const AGY_PROVIDER_ID = "google-agy";
|
|
2
|
-
export declare const AGY_AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
|
|
3
|
-
export declare const AGY_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
4
|
-
export declare const AGY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
|
|
5
|
-
export declare const AGY_CLIENT_SECRET = "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";
|
|
6
|
-
export declare const AGY_SCOPES: readonly string[];
|
|
7
|
-
export declare const AGY_REDIRECT_URI = "https://antigravity.google/oauth-callback";
|
|
8
|
-
export declare const AGY_CODE_ASSIST_ENDPOINT: string;
|
|
9
|
-
export declare const AGY_GENERATIVE_LANGUAGE_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta";
|
package/dist/src/fetch.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function agyFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AuthDetails, OAuthAuthDetails, RefreshParts } from './types';
|
|
2
|
-
export declare function isOAuthAuth(auth: AuthDetails | undefined | null): auth is OAuthAuthDetails;
|
|
3
|
-
/**
|
|
4
|
-
* Splits the packed refresh string into the corresponding refresh token and project ID.
|
|
5
|
-
*/
|
|
6
|
-
export declare function parseRefreshParts(refresh: string): RefreshParts;
|
|
7
|
-
/**
|
|
8
|
-
* Serializes the parts of a refresh token into the stored string format.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatRefreshParts(parts: RefreshParts): string;
|
|
11
|
-
/**
|
|
12
|
-
* Determines whether the access token has expired or is missing, with a buffer for clock skew.
|
|
13
|
-
*/
|
|
14
|
-
export declare function accessTokenExpired(auth: OAuthAuthDetails): boolean;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { OAuthAuthDetails } from "./types";
|
|
2
|
-
import { SignatureCache, type SignatureCacheConfig } from "../sdk/cache/signature-cache";
|
|
3
|
-
/**
|
|
4
|
-
* Extracts valid OAuthAuthDetails from cache. Reuses an available and unexpired Token if present, otherwise prioritizes the latest provided value.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveCachedAuth(auth: OAuthAuthDetails): OAuthAuthDetails;
|
|
7
|
-
/**
|
|
8
|
-
* Explicitly updates or saves authorized token details to the cache.
|
|
9
|
-
*/
|
|
10
|
-
export declare function storeCachedAuth(auth: OAuthAuthDetails): void;
|
|
11
|
-
/**
|
|
12
|
-
* Clears cached login authorization details. If no refresh token is provided, clears the global cache.
|
|
13
|
-
*/
|
|
14
|
-
export declare function clearCachedAuth(refresh?: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Initializes the disk-level signature storage manager.
|
|
17
|
-
*/
|
|
18
|
-
export declare function initDiskSignatureCache(config: SignatureCacheConfig | undefined): SignatureCache | null;
|
|
19
|
-
/**
|
|
20
|
-
* Caches a thought chain fragment and its corresponding service signature, synchronously saving it to disk.
|
|
21
|
-
*/
|
|
22
|
-
export declare function cacheSignature(sessionId: string, text: string, signature: string): void;
|
|
23
|
-
/**
|
|
24
|
-
* Recovers and retrieves the most recently cached signature for a session (supports signature recovery).
|
|
25
|
-
*/
|
|
26
|
-
export declare function getLatestSignature(sessionId: string): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves a cached signature for a specific text in a session.
|
|
29
|
-
* Checks memory cache first, then falls back to disk cache.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getSignatureForText(sessionId: string, text: string): string | undefined;
|
|
32
|
-
export declare function getDiskSignatureCache(): SignatureCache | null;
|
|
33
|
-
export declare function resetDiskSignatureCacheForTesting(): void;
|
|
34
|
-
export type { SignatureCache } from "../sdk/cache/signature-cache";
|
|
35
|
-
export type { SignatureCacheConfig } from "../sdk/cache/signature-cache";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP header and URL manipulation utilities.
|
|
3
|
-
* Shared between OpenCode v1 and v2 runtimes.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getSafeHeader(headers: unknown, key: string): string | undefined;
|
|
6
|
-
export declare function setSafeHeaders(initHeaders: unknown, newHeaders: Record<string, string>): unknown;
|
|
7
|
-
export declare function toUrlString(value: RequestInfo): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PluginClient } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Shows a Toast notification to the user when the server-side Agy model capacity is exhausted.
|
|
4
|
-
*/
|
|
5
|
-
export declare function maybeShowAgyCapacityToast(client: PluginClient, response: Response, projectId: string, requestedModel?: string): Promise<void>;
|
|
6
|
-
/**
|
|
7
|
-
* Temporary smoke test Toast, only enabled when OPENCODE_AGY_TEST_TOAST=1.
|
|
8
|
-
*/
|
|
9
|
-
export declare function maybeShowAgyTestToast(client: PluginClient, projectId: string): Promise<void>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { AgyTokenExchangeResult } from '../sdk/oauth';
|
|
2
|
-
import type { PluginClient } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Builds the OAuth authorization callback for the plugin authentication method.
|
|
5
|
-
*/
|
|
6
|
-
export declare function createOAuthAuthorizeMethod(options?: {
|
|
7
|
-
client?: PluginClient;
|
|
8
|
-
getConfiguredProjectId?: () => Promise<string | undefined> | string | undefined;
|
|
9
|
-
getUserAgentModel?: () => Promise<string | undefined> | string | undefined;
|
|
10
|
-
openBrowser?: (url: string) => void;
|
|
11
|
-
}): () => Promise<{
|
|
12
|
-
url: string;
|
|
13
|
-
instructions: string;
|
|
14
|
-
method: 'code';
|
|
15
|
-
callback: (callbackUrl: string) => Promise<AgyTokenExchangeResult>;
|
|
16
|
-
}>;
|
|
17
|
-
export declare function parseOAuthCallbackInput(input: string): {
|
|
18
|
-
code?: string;
|
|
19
|
-
state?: string;
|
|
20
|
-
};
|
|
21
|
-
export declare function setOpenBrowserLauncherForTesting(launcher: typeof openBrowserLauncher | null): void;
|
|
22
|
-
export declare function defaultOpenBrowserLauncher(command: string, args: string[]): void;
|
|
23
|
-
declare let openBrowserLauncher: typeof defaultOpenBrowserLauncher;
|
|
24
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { OAuthAuthDetails, PluginClient, ProjectContextResult } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Clears cached project context results and pending Promises.
|
|
4
|
-
*/
|
|
5
|
-
export declare function invalidateProjectContextCache(refresh?: string): void;
|
|
6
|
-
/**
|
|
7
|
-
* Resolves the project context corresponding to the access token, optionally persisting updated auth details.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolveProjectContextFromAccessToken(auth: OAuthAuthDetails, accessToken: string, configuredProjectId?: string, persistAuth?: (auth: OAuthAuthDetails) => Promise<void>, userAgentModel?: string): Promise<ProjectContextResult>;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves the effective project ID for the current auth state and caches the result by refresh token.
|
|
12
|
-
*/
|
|
13
|
-
export declare function ensureProjectContext(auth: OAuthAuthDetails, client: PluginClient, configuredProjectId?: string, userAgentModel?: string): Promise<ProjectContextResult>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export declare const FREE_TIER_ID = "free-tier";
|
|
2
|
-
export declare const LEGACY_TIER_ID = "legacy-tier";
|
|
3
|
-
export declare const CODE_ASSIST_METADATA: {
|
|
4
|
-
readonly ideType: "ANTIGRAVITY";
|
|
5
|
-
};
|
|
6
|
-
export interface AgyUserTier {
|
|
7
|
-
id?: string;
|
|
8
|
-
isDefault?: boolean;
|
|
9
|
-
userDefinedCloudaicompanionProject?: boolean;
|
|
10
|
-
name?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface CloudAiCompanionProject {
|
|
14
|
-
id?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface AgyIneligibleTier {
|
|
17
|
-
reasonCode?: string;
|
|
18
|
-
reasonMessage?: string;
|
|
19
|
-
validationUrl?: string;
|
|
20
|
-
validationLearnMoreUrl?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface LoadCodeAssistPayload {
|
|
23
|
-
cloudaicompanionProject?: string | CloudAiCompanionProject;
|
|
24
|
-
currentTier?: {
|
|
25
|
-
id?: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
};
|
|
28
|
-
allowedTiers?: AgyUserTier[];
|
|
29
|
-
ineligibleTiers?: AgyIneligibleTier[];
|
|
30
|
-
}
|
|
31
|
-
export interface OnboardUserPayload {
|
|
32
|
-
name?: string;
|
|
33
|
-
done?: boolean;
|
|
34
|
-
response?: {
|
|
35
|
-
cloudaicompanionProject?: {
|
|
36
|
-
id?: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export interface RetrieveUserQuotaBucket {
|
|
41
|
-
remainingAmount?: string;
|
|
42
|
-
remainingFraction?: number;
|
|
43
|
-
resetTime?: string;
|
|
44
|
-
tokenType?: string;
|
|
45
|
-
modelId?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface RetrieveUserQuotaResponse {
|
|
48
|
-
buckets?: RetrieveUserQuotaBucket[];
|
|
49
|
-
}
|
|
50
|
-
export interface QuotaSummaryBucket {
|
|
51
|
-
bucketId?: string;
|
|
52
|
-
displayName?: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
window?: string;
|
|
55
|
-
remaining?: string;
|
|
56
|
-
remainingFraction?: number;
|
|
57
|
-
remainingAmount?: string;
|
|
58
|
-
disabled?: boolean;
|
|
59
|
-
resetTime?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface QuotaSummaryGroup {
|
|
62
|
-
displayName?: string;
|
|
63
|
-
description?: string;
|
|
64
|
-
buckets?: QuotaSummaryBucket[];
|
|
65
|
-
}
|
|
66
|
-
export interface RetrieveUserQuotaSummaryResponse {
|
|
67
|
-
groups?: QuotaSummaryGroup[];
|
|
68
|
-
buckets?: QuotaSummaryBucket[];
|
|
69
|
-
description?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Thrown during Gemini enablement if the required Google Cloud project is missing.
|
|
73
|
-
*/
|
|
74
|
-
export declare class ProjectIdRequiredError extends Error {
|
|
75
|
-
constructor();
|
|
76
|
-
}
|
|
77
|
-
export declare class ProjectAccessDeniedError extends Error {
|
|
78
|
-
constructor(projectId: string | undefined, backendMessage: string | undefined);
|
|
79
|
-
}
|
|
80
|
-
export declare class AccountValidationRequiredError extends Error {
|
|
81
|
-
validationUrl?: string;
|
|
82
|
-
validationLearnMoreUrl?: string;
|
|
83
|
-
constructor(message: string, validationUrl?: string, validationLearnMoreUrl?: string);
|
|
84
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { OAuthAuthDetails } from "../types";
|
|
2
|
-
import { type CloudAiCompanionProject, type AgyIneligibleTier, type AgyUserTier } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* Builds the metadata headers required for the Code Assist API.
|
|
5
|
-
*/
|
|
6
|
-
export declare function buildMetadata(projectId?: string, includeDuetProject?: boolean): Record<string, string>;
|
|
7
|
-
/**
|
|
8
|
-
* Normalizes project identifiers from API payloads or configuration.
|
|
9
|
-
*/
|
|
10
|
-
export declare function normalizeProjectId(value?: string | CloudAiCompanionProject): string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Selects the default hierarchy ID from the allowed hierarchy list.
|
|
13
|
-
*/
|
|
14
|
-
export declare function pickOnboardTier(allowedTiers?: AgyUserTier[]): AgyUserTier;
|
|
15
|
-
/**
|
|
16
|
-
* Builds a concise error message for non-compliant hierarchy payloads.
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildIneligibleTierMessage(tiers?: AgyIneligibleTier[]): string | undefined;
|
|
19
|
-
export declare function throwIfValidationRequired(tiers?: AgyIneligibleTier[]): void;
|
|
20
|
-
/**
|
|
21
|
-
* Detects VPC-SC errors from Cloud Code responses.
|
|
22
|
-
*/
|
|
23
|
-
export declare function isVpcScError(payload: unknown): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Safely parses JSON, returning null on failure.
|
|
26
|
-
*/
|
|
27
|
-
export declare function parseJsonSafe(text: string): unknown;
|
|
28
|
-
/**
|
|
29
|
-
* Promise-based delay utility.
|
|
30
|
-
*/
|
|
31
|
-
export declare function wait(ms: number): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Generates a cache key for the project context based on the refresh token.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getCacheKey(auth: OAuthAuthDetails): string | undefined;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Config } from "./types";
|
|
2
|
-
import type { PluginClient, Provider } from "./types";
|
|
3
|
-
interface ResolveConfiguredProjectIdInput {
|
|
4
|
-
provider?: Provider | null;
|
|
5
|
-
config?: Config | null;
|
|
6
|
-
configProjectId?: string;
|
|
7
|
-
env?: NodeJS.ProcessEnv;
|
|
8
|
-
}
|
|
9
|
-
export declare function resolveConfiguredProjectId(input?: ResolveConfiguredProjectIdInput): string | undefined;
|
|
10
|
-
export declare function resolveConfiguredProjectIdFromConfig(config: Config | null | undefined): string | undefined;
|
|
11
|
-
export declare function resolveConfiguredProjectIdFromClient(client: PluginClient | null | undefined): Promise<string | undefined>;
|
|
12
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { GetAuth, PluginClient } from "./types";
|
|
2
|
-
export declare const AGY_QUOTA_SUMMARY_TOOL_NAME = "agy_quota_summary";
|
|
3
|
-
export declare const AGY_V2_QUOTA_SUMMARY_COMMAND = "agy-quota-summary";
|
|
4
|
-
export declare const AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota summary (weekly and 5-hour limits by model group) for the current authenticated account.\n\nImmediately call `agy_quota_summary` with no arguments and return its output verbatim.\nDo not call other tools.\n";
|
|
5
|
-
interface AgyQuotaSummaryToolDependencies {
|
|
6
|
-
client: PluginClient;
|
|
7
|
-
getAuthResolver: () => GetAuth | undefined;
|
|
8
|
-
getConfiguredProjectId: () => string | undefined;
|
|
9
|
-
getUserAgentModel: () => string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export declare function createAgyQuotaSummaryTool({ client, getAuthResolver, getConfiguredProjectId, getUserAgentModel, }: AgyQuotaSummaryToolDependencies): {
|
|
12
|
-
description: string;
|
|
13
|
-
args: {};
|
|
14
|
-
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
2
|
-
export declare function pad(value: string, width: number): string;
|
|
3
|
-
export declare function buildProgressBar(fraction: number, width?: number): string;
|
|
4
|
-
export declare function formatRemainingAmount(value: string | undefined): string | undefined;
|
|
5
|
-
export declare function formatRelativeResetTime(resetTime: string | undefined): string | undefined;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { GetAuth, PluginClient } from "./types";
|
|
2
|
-
export declare const AGY_QUOTA_TOOL_NAME = "agy_quota";
|
|
3
|
-
export declare const AGY_V2_QUOTA_COMMAND = "agy-quota";
|
|
4
|
-
export declare const AGY_V2_QUOTA_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota usage for the current authenticated account.\n\nImmediately call `agy_quota` with no arguments and return its output verbatim.\nDo not call other tools.\n";
|
|
5
|
-
interface AgyQuotaToolDependencies {
|
|
6
|
-
client: PluginClient;
|
|
7
|
-
getAuthResolver: () => GetAuth | undefined;
|
|
8
|
-
getConfiguredProjectId: () => string | undefined;
|
|
9
|
-
getUserAgentModel: () => string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export declare function createAgyQuotaTool({ client, getAuthResolver, getConfiguredProjectId, getUserAgentModel, }: AgyQuotaToolDependencies): {
|
|
12
|
-
description: string;
|
|
13
|
-
args: {};
|
|
14
|
-
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface SimpleStaticModel {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
maxTokens: number;
|
|
5
|
-
maxOutputTokens: number;
|
|
6
|
-
toolCall: boolean;
|
|
7
|
-
reasoning: boolean;
|
|
8
|
-
attachment: boolean;
|
|
9
|
-
cost?: {
|
|
10
|
-
input: number;
|
|
11
|
-
output: number;
|
|
12
|
-
cache?: {
|
|
13
|
-
read: number;
|
|
14
|
-
write: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const STATIC_MODELS_SIMPLE: Record<string, SimpleStaticModel>;
|
|
19
|
-
export declare const TIER_MAPPING: Record<string, {
|
|
20
|
-
low: string;
|
|
21
|
-
high: string;
|
|
22
|
-
medium?: string;
|
|
23
|
-
minimal?: string;
|
|
24
|
-
xhigh?: string;
|
|
25
|
-
} & Record<string, string | undefined>>;
|
|
26
|
-
/**
|
|
27
|
-
* Resolves a model ID and optional request headers or suffix into the appropriate tier variant.
|
|
28
|
-
*/
|
|
29
|
-
export declare function resolveModelTier(baseModelId: string, headersOrInit?: RequestInit | unknown): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PluginClient } from "./types";
|
|
2
|
-
export declare const AGY_TOS_APPEAL_URL = "https://docs.google.com/forms/d/e/1FAIpQLScOJWibQ_-hYuVv63kJTgEqlgAaOwRLGFTbXm-QY1gz8U0CGA/viewform";
|
|
3
|
-
export declare const AGY_TOS_WARNING_TITLE = "Antigravity Terms of Service Risk";
|
|
4
|
-
export declare const AGY_TOS_WARNING: string;
|
|
5
|
-
export declare const AGY_ACP_TOS_WARNING: string;
|
|
6
|
-
/**
|
|
7
|
-
* Emits the Antigravity Terms of Service warning once per process.
|
|
8
|
-
* Always logs to the console; also shows an error toast when the client supports it.
|
|
9
|
-
*/
|
|
10
|
-
export declare function emitAgyTosWarning(client?: PluginClient): void;
|
|
11
|
-
/** Emits the google-agy-acp variant of the Terms of Service warning once per process. */
|
|
12
|
-
export declare function emitAgyAcpTosWarning(client?: PluginClient): void;
|
|
13
|
-
/**
|
|
14
|
-
* Resets the once-per-process guards. Test-only.
|
|
15
|
-
*/
|
|
16
|
-
export declare function resetAgyTosWarningForTesting(): void;
|