oh-my-opencode 2.14.0 → 3.0.0-beta.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.ja.md +76 -17
- package/README.md +169 -37
- package/README.zh-cn.md +73 -17
- package/dist/agents/metis.d.ts +19 -0
- package/dist/agents/momus.d.ts +6 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +20 -0
- package/dist/agents/plan-prompt.d.ts +8 -5
- package/dist/agents/prometheus-prompt.d.ts +27 -0
- package/dist/agents/sisyphus-junior.d.ts +3 -0
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/utils.d.ts +4 -1
- package/dist/auth/antigravity/accounts.d.ts +40 -0
- package/dist/auth/antigravity/accounts.test.d.ts +1 -0
- package/dist/auth/antigravity/browser.d.ts +27 -0
- package/dist/auth/antigravity/browser.test.d.ts +1 -0
- package/dist/auth/antigravity/cli.d.ts +2 -0
- package/dist/auth/antigravity/cli.test.d.ts +1 -0
- package/dist/auth/antigravity/constants.d.ts +63 -1
- package/dist/auth/antigravity/constants.test.d.ts +1 -0
- package/dist/auth/antigravity/fetch.d.ts +2 -1
- package/dist/auth/antigravity/integration.test.d.ts +10 -0
- package/dist/auth/antigravity/oauth.d.ts +6 -40
- package/dist/auth/antigravity/oauth.test.d.ts +1 -0
- package/dist/auth/antigravity/request.d.ts +12 -0
- package/dist/auth/antigravity/request.test.d.ts +1 -0
- package/dist/auth/antigravity/storage.d.ts +5 -0
- package/dist/auth/antigravity/storage.test.d.ts +1 -0
- package/dist/auth/antigravity/thinking.d.ts +45 -1
- package/dist/auth/antigravity/thinking.test.d.ts +10 -0
- package/dist/auth/antigravity/token.test.d.ts +1 -0
- package/dist/auth/antigravity/types.d.ts +29 -5
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/index.js +342 -117
- package/dist/config/schema.d.ts +473 -6
- package/dist/features/background-agent/manager.d.ts +13 -1
- package/dist/features/background-agent/types.d.ts +26 -1
- package/dist/features/boulder-state/constants.d.ts +10 -0
- package/dist/features/boulder-state/index.d.ts +3 -0
- package/dist/features/boulder-state/storage.d.ts +28 -0
- package/dist/features/boulder-state/storage.test.d.ts +1 -0
- package/dist/features/boulder-state/types.d.ts +24 -0
- package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor.d.ts +1 -1
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/features/hook-message-injector/injector.d.ts +2 -2
- package/dist/features/hook-message-injector/types.d.ts +3 -2
- package/dist/features/opencode-skill-loader/index.d.ts +1 -0
- package/dist/features/opencode-skill-loader/skill-content.d.ts +5 -0
- package/dist/features/opencode-skill-loader/skill-content.test.d.ts +1 -0
- package/dist/features/task-toast-manager/index.d.ts +2 -0
- package/dist/features/task-toast-manager/manager.d.ts +56 -0
- package/dist/features/task-toast-manager/manager.test.d.ts +1 -0
- package/dist/features/task-toast-manager/types.d.ts +16 -0
- package/dist/google-auth.js +2167 -161
- package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts +3 -0
- package/dist/hooks/auto-update-checker/index.test.d.ts +1 -0
- package/dist/hooks/claude-code-hooks/index.d.ts +2 -1
- package/dist/hooks/claude-code-hooks/types.d.ts +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/prometheus-md-only/constants.d.ts +6 -0
- package/dist/hooks/prometheus-md-only/index.d.ts +12 -0
- package/dist/hooks/prometheus-md-only/index.test.d.ts +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +35 -0
- package/dist/hooks/sisyphus-orchestrator/index.test.d.ts +1 -0
- package/dist/hooks/start-work/index.d.ts +16 -0
- package/dist/hooks/start-work/index.test.d.ts +1 -0
- package/dist/hooks/task-resume-info/index.d.ts +11 -0
- package/dist/hooks/todo-continuation-enforcer.d.ts +1 -0
- package/dist/index.js +15227 -6676
- package/dist/mcp/index.d.ts +4 -2
- package/dist/mcp/websearch.d.ts +3 -0
- package/dist/shared/external-plugin-detector.d.ts +18 -0
- package/dist/shared/external-plugin-detector.test.d.ts +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/migration.d.ts +6 -0
- package/dist/tools/background-task/index.d.ts +1 -1
- package/dist/tools/call-omo-agent/constants.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/sisyphus-task/constants.d.ts +12 -0
- package/dist/tools/sisyphus-task/index.d.ts +3 -0
- package/dist/tools/sisyphus-task/tools.d.ts +16 -0
- package/dist/tools/sisyphus-task/tools.test.d.ts +1 -0
- package/dist/tools/sisyphus-task/types.d.ts +9 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform browser opening utility.
|
|
3
|
+
* Uses the "open" npm package for reliable cross-platform support.
|
|
4
|
+
*
|
|
5
|
+
* Supports: macOS, Windows, Linux (including WSL)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Opens a URL in the user's default browser.
|
|
9
|
+
*
|
|
10
|
+
* Cross-platform support:
|
|
11
|
+
* - macOS: uses `open` command
|
|
12
|
+
* - Windows: uses `start` command
|
|
13
|
+
* - Linux: uses `xdg-open` command
|
|
14
|
+
* - WSL: uses Windows PowerShell
|
|
15
|
+
*
|
|
16
|
+
* @param url - The URL to open in the browser
|
|
17
|
+
* @returns Promise<boolean> - true if browser opened successfully, false otherwise
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const success = await openBrowserURL("https://accounts.google.com/oauth...")
|
|
22
|
+
* if (!success) {
|
|
23
|
+
* console.log("Please open this URL manually:", url)
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function openBrowserURL(url: string): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -21,7 +21,7 @@ export declare const ANTIGRAVITY_CLIENT_SECRET = "GOCSPX-K58FWR486LdLJ1mLB8sXC4z
|
|
|
21
21
|
export declare const ANTIGRAVITY_CALLBACK_PORT = 51121;
|
|
22
22
|
export declare const ANTIGRAVITY_REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
23
23
|
export declare const ANTIGRAVITY_SCOPES: readonly ["https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/cclog", "https://www.googleapis.com/auth/experimentsandconfigs"];
|
|
24
|
-
export declare const ANTIGRAVITY_ENDPOINT_FALLBACKS: readonly ["https://daily-cloudcode-pa.sandbox.googleapis.com", "https://
|
|
24
|
+
export declare const ANTIGRAVITY_ENDPOINT_FALLBACKS: readonly ["https://daily-cloudcode-pa.sandbox.googleapis.com", "https://daily-cloudcode-pa.googleapis.com", "https://cloudcode-pa.googleapis.com"];
|
|
25
25
|
export declare const ANTIGRAVITY_API_VERSION = "v1internal";
|
|
26
26
|
export declare const ANTIGRAVITY_HEADERS: {
|
|
27
27
|
readonly "User-Agent": "google-api-nodejs-client/9.15.1";
|
|
@@ -34,3 +34,65 @@ export declare const GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
|
34
34
|
export declare const GOOGLE_USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo";
|
|
35
35
|
export declare const ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS = 60000;
|
|
36
36
|
export declare const SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
37
|
+
export declare const ANTIGRAVITY_SYSTEM_PROMPT = "<identity>\nYou are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\nThe USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.\nThis information may or may not be relevant to the coding task, it is up for you to decide.\n</identity>\n\n<tool_calling>\nCall tools as you normally would. The following list provides additional guidance to help you avoid errors:\n - **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.\n</tool_calling>\n\n<web_application_development>\n## Technology Stack\nYour web applications should be built using the following technologies:\n1. **Core**: Use HTML for structure and Javascript for logic.\n2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.\n3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.\n4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:\n - Use `npx -y` to automatically install the script and its dependencies\n - You MUST run the command with `--help` flag to see all available options first\n - Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`)\n</web_application_development>\n";
|
|
38
|
+
/**
|
|
39
|
+
* Maps reasoning_effort UI values to thinking budget tokens.
|
|
40
|
+
*
|
|
41
|
+
* Key notes:
|
|
42
|
+
* - `none: 0` is a sentinel value meaning "delete thinkingConfig entirely"
|
|
43
|
+
* - `auto: -1` triggers dynamic budget calculation based on context
|
|
44
|
+
* - All other values represent actual thinking budget in tokens
|
|
45
|
+
*/
|
|
46
|
+
export declare const REASONING_EFFORT_BUDGET_MAP: Record<string, number>;
|
|
47
|
+
/**
|
|
48
|
+
* Model-specific thinking configuration.
|
|
49
|
+
*
|
|
50
|
+
* thinkingType:
|
|
51
|
+
* - "numeric": Uses thinkingBudget (number) - Gemini 2.5, Claude via Antigravity
|
|
52
|
+
* - "levels": Uses thinkingLevel (string) - Gemini 3
|
|
53
|
+
*
|
|
54
|
+
* zeroAllowed:
|
|
55
|
+
* - true: Budget can be 0 (thinking disabled)
|
|
56
|
+
* - false: Minimum budget enforced (cannot disable thinking)
|
|
57
|
+
*/
|
|
58
|
+
export interface AntigravityModelConfig {
|
|
59
|
+
thinkingType: "numeric" | "levels";
|
|
60
|
+
min: number;
|
|
61
|
+
max: number;
|
|
62
|
+
zeroAllowed: boolean;
|
|
63
|
+
levels?: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Thinking configuration per model.
|
|
67
|
+
* Keys are normalized model IDs (no provider prefix, no variant suffix).
|
|
68
|
+
*
|
|
69
|
+
* Config lookup uses pattern matching fallback:
|
|
70
|
+
* - includes("gemini-3") → Gemini 3 (levels)
|
|
71
|
+
* - includes("gemini-2.5") → Gemini 2.5 (numeric)
|
|
72
|
+
* - includes("claude") → Claude via Antigravity (numeric)
|
|
73
|
+
*/
|
|
74
|
+
export declare const ANTIGRAVITY_MODEL_CONFIGS: Record<string, AntigravityModelConfig>;
|
|
75
|
+
/**
|
|
76
|
+
* Normalizes model ID for config lookup.
|
|
77
|
+
*
|
|
78
|
+
* Algorithm:
|
|
79
|
+
* 1. Strip provider prefix (e.g., "google/")
|
|
80
|
+
* 2. Strip "antigravity-" prefix
|
|
81
|
+
* 3. Strip UI variant suffixes (-high, -low, -thinking-*)
|
|
82
|
+
*
|
|
83
|
+
* Examples:
|
|
84
|
+
* - "google/antigravity-gemini-3-pro-high" → "gemini-3-pro"
|
|
85
|
+
* - "antigravity-gemini-3-flash-preview" → "gemini-3-flash-preview"
|
|
86
|
+
* - "gemini-2.5-flash" → "gemini-2.5-flash"
|
|
87
|
+
* - "gemini-claude-sonnet-4-5-thinking-high" → "gemini-claude-sonnet-4-5"
|
|
88
|
+
*/
|
|
89
|
+
export declare function normalizeModelId(model: string): string;
|
|
90
|
+
export declare const ANTIGRAVITY_SUPPORTED_MODELS: readonly ["gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.5-computer-use-preview-10-2025", "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-claude-sonnet-4-5-thinking", "gemini-claude-opus-4-5-thinking"];
|
|
91
|
+
/**
|
|
92
|
+
* Converts UI model names to Antigravity API model names.
|
|
93
|
+
*
|
|
94
|
+
* NOTE: Tested 2026-01-08 - Gemini 3 models work with -preview suffix directly.
|
|
95
|
+
* The CLIProxyAPI transformations (gemini-3-pro-high, gemini-3-flash) return 404.
|
|
96
|
+
* Claude models return 404 on all endpoints (may require special access/quota).
|
|
97
|
+
*/
|
|
98
|
+
export declare function alias2ModelName(modelName: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Debug logging available via ANTIGRAVITY_DEBUG=1 environment variable.
|
|
18
18
|
*/
|
|
19
|
+
import { AccountManager } from "./accounts";
|
|
19
20
|
/**
|
|
20
21
|
* Auth interface matching OpenCode's auth system
|
|
21
22
|
*/
|
|
@@ -60,7 +61,7 @@ interface AuthClient {
|
|
|
60
61
|
* })
|
|
61
62
|
* ```
|
|
62
63
|
*/
|
|
63
|
-
export declare function createAntigravityFetch(getAuth: () => Promise<Auth>, client: AuthClient, providerId: string, clientId?: string, clientSecret?: string): (url: string, init?: RequestInit) => Promise<Response>;
|
|
64
|
+
export declare function createAntigravityFetch(getAuth: () => Promise<Auth>, client: AuthClient, providerId: string, clientId?: string, clientSecret?: string, accountManager?: AccountManager | null): (url: string, init?: RequestInit) => Promise<Response>;
|
|
64
65
|
/**
|
|
65
66
|
* Type export for createAntigravityFetch return type
|
|
66
67
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Integration Tests - End-to-End
|
|
3
|
+
*
|
|
4
|
+
* Tests the complete request transformation pipeline:
|
|
5
|
+
* - Request parsing and model extraction
|
|
6
|
+
* - System prompt injection (handled by transformRequest)
|
|
7
|
+
* - Thinking config application (handled by applyThinkingConfigToRequest)
|
|
8
|
+
* - Body wrapping for Antigravity API format
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
import type { AntigravityTokenExchangeResult, AntigravityUserInfo } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* PKCE pair containing verifier and challenge.
|
|
4
|
-
*/
|
|
5
|
-
export interface PKCEPair {
|
|
6
|
-
/** PKCE verifier - used during token exchange */
|
|
7
|
-
verifier: string;
|
|
8
|
-
/** PKCE challenge - sent in auth URL */
|
|
9
|
-
challenge: string;
|
|
10
|
-
/** Challenge method - always "S256" */
|
|
11
|
-
method: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* OAuth state encoded in the auth URL.
|
|
15
|
-
* Contains the PKCE verifier for later retrieval.
|
|
16
|
-
*/
|
|
17
|
-
export interface OAuthState {
|
|
18
|
-
/** PKCE verifier */
|
|
19
|
-
verifier: string;
|
|
20
|
-
/** Optional project ID */
|
|
21
|
-
projectId?: string;
|
|
22
|
-
}
|
|
23
2
|
/**
|
|
24
3
|
* Result from building an OAuth authorization URL.
|
|
25
4
|
*/
|
|
26
5
|
export interface AuthorizationResult {
|
|
27
6
|
/** Full OAuth URL to open in browser */
|
|
28
7
|
url: string;
|
|
29
|
-
/**
|
|
30
|
-
|
|
8
|
+
/** State for CSRF protection */
|
|
9
|
+
state: string;
|
|
31
10
|
}
|
|
32
11
|
/**
|
|
33
12
|
* Result from the OAuth callback server.
|
|
@@ -40,31 +19,17 @@ export interface CallbackResult {
|
|
|
40
19
|
/** Error message if any */
|
|
41
20
|
error?: string;
|
|
42
21
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Generate PKCE verifier and challenge pair.
|
|
45
|
-
* Uses @openauthjs/openauth for cryptographically secure generation.
|
|
46
|
-
*
|
|
47
|
-
* @returns PKCE pair with verifier, challenge, and method
|
|
48
|
-
*/
|
|
49
|
-
export declare function generatePKCEPair(): Promise<PKCEPair>;
|
|
50
|
-
/**
|
|
51
|
-
* Decode OAuth state from a base64 string.
|
|
52
|
-
*
|
|
53
|
-
* @param encoded - Base64URL or Base64 encoded state
|
|
54
|
-
* @returns Decoded OAuth state
|
|
55
|
-
*/
|
|
56
|
-
export declare function decodeState(encoded: string): OAuthState;
|
|
57
22
|
export declare function buildAuthURL(projectId?: string, clientId?: string, port?: number): Promise<AuthorizationResult>;
|
|
58
23
|
/**
|
|
59
24
|
* Exchange authorization code for tokens.
|
|
60
25
|
*
|
|
61
26
|
* @param code - Authorization code from OAuth callback
|
|
62
|
-
* @param
|
|
27
|
+
* @param redirectUri - OAuth redirect URI
|
|
63
28
|
* @param clientId - Optional custom client ID (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
64
29
|
* @param clientSecret - Optional custom client secret (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
65
30
|
* @returns Token exchange result with access and refresh tokens
|
|
66
31
|
*/
|
|
67
|
-
export declare function exchangeCode(code: string,
|
|
32
|
+
export declare function exchangeCode(code: string, redirectUri: string, clientId?: string, clientSecret?: string): Promise<AntigravityTokenExchangeResult>;
|
|
68
33
|
/**
|
|
69
34
|
* Fetch user info from Google's userinfo API.
|
|
70
35
|
*
|
|
@@ -74,6 +39,7 @@ export declare function exchangeCode(code: string, verifier: string, clientId?:
|
|
|
74
39
|
export declare function fetchUserInfo(accessToken: string): Promise<AntigravityUserInfo>;
|
|
75
40
|
export interface CallbackServerHandle {
|
|
76
41
|
port: number;
|
|
42
|
+
redirectUri: string;
|
|
77
43
|
waitForCallback: () => Promise<CallbackResult>;
|
|
78
44
|
close: () => void;
|
|
79
45
|
}
|
|
@@ -81,5 +47,5 @@ export declare function startCallbackServer(timeoutMs?: number): CallbackServerH
|
|
|
81
47
|
export declare function performOAuthFlow(projectId?: string, openBrowser?: (url: string) => Promise<void>, clientId?: string, clientSecret?: string): Promise<{
|
|
82
48
|
tokens: AntigravityTokenExchangeResult;
|
|
83
49
|
userInfo: AntigravityUserInfo;
|
|
84
|
-
|
|
50
|
+
state: string;
|
|
85
51
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -72,6 +72,18 @@ export declare function buildAntigravityUrl(baseEndpoint: string, action: string
|
|
|
72
72
|
* @returns Default (first) Antigravity endpoint
|
|
73
73
|
*/
|
|
74
74
|
export declare function getDefaultEndpoint(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Inject ANTIGRAVITY_SYSTEM_PROMPT into request.systemInstruction.
|
|
77
|
+
* Prepends Antigravity prompt before any existing systemInstruction.
|
|
78
|
+
* Prevents duplicate injection by checking for <identity> marker.
|
|
79
|
+
*
|
|
80
|
+
* CRITICAL: Modifies wrappedBody.request.systemInstruction (NOT outer body!)
|
|
81
|
+
*
|
|
82
|
+
* @param wrappedBody - The wrapped request body with request field
|
|
83
|
+
*/
|
|
84
|
+
export declare function injectSystemPrompt(wrappedBody: {
|
|
85
|
+
request?: unknown;
|
|
86
|
+
}): void;
|
|
75
87
|
export declare function wrapRequestBody(body: Record<string, unknown>, projectId: string, modelName: string, sessionId: string): AntigravityRequestBody;
|
|
76
88
|
export declare function injectThoughtSignatureIntoFunctionCalls(body: Record<string, unknown>, signature: string | undefined): Record<string, unknown>;
|
|
77
89
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AccountStorage } from "./types";
|
|
2
|
+
export declare function getDataDir(): string;
|
|
3
|
+
export declare function getStoragePath(): string;
|
|
4
|
+
export declare function loadAccounts(path?: string): Promise<AccountStorage | null>;
|
|
5
|
+
export declare function saveAccounts(storage: AccountStorage, path?: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Note: This is Gemini-only. Claude models are NOT handled by Antigravity.
|
|
14
14
|
*/
|
|
15
|
+
import { type AntigravityModelConfig } from "./constants";
|
|
15
16
|
/**
|
|
16
17
|
* Represents a single thinking/reasoning block extracted from Gemini response
|
|
17
18
|
*/
|
|
@@ -212,13 +213,14 @@ export declare function normalizeThinkingConfig(config: unknown): ThinkingConfig
|
|
|
212
213
|
* Extract thinking configuration from request payload
|
|
213
214
|
*
|
|
214
215
|
* Supports both Gemini-style thinkingConfig and Anthropic-style thinking options.
|
|
216
|
+
* Also supports reasoning_effort parameter which maps to thinking budget/level.
|
|
215
217
|
*
|
|
216
218
|
* @param requestPayload - Request body
|
|
217
219
|
* @param generationConfig - Generation config from request
|
|
218
220
|
* @param extraBody - Extra body options
|
|
219
221
|
* @returns Extracted thinking configuration or undefined
|
|
220
222
|
*/
|
|
221
|
-
export declare function extractThinkingConfig(requestPayload: Record<string, unknown>, generationConfig?: Record<string, unknown>, extraBody?: Record<string, unknown>): ThinkingConfig | undefined;
|
|
223
|
+
export declare function extractThinkingConfig(requestPayload: Record<string, unknown>, generationConfig?: Record<string, unknown>, extraBody?: Record<string, unknown>): ThinkingConfig | DeleteThinkingConfig | undefined;
|
|
222
224
|
/**
|
|
223
225
|
* Resolve final thinking configuration based on model and context
|
|
224
226
|
*
|
|
@@ -232,3 +234,45 @@ export declare function extractThinkingConfig(requestPayload: Record<string, unk
|
|
|
232
234
|
* @returns Final thinking configuration
|
|
233
235
|
*/
|
|
234
236
|
export declare function resolveThinkingConfig(userConfig: ThinkingConfig | undefined, isThinkingModel: boolean, isClaudeModel: boolean, hasAssistantHistory: boolean): ThinkingConfig | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Get thinking config for a model by normalized ID.
|
|
239
|
+
* Uses pattern matching fallback if exact match not found.
|
|
240
|
+
*
|
|
241
|
+
* @param model - Model identifier string (with or without provider prefix)
|
|
242
|
+
* @returns Thinking configuration or undefined if not found
|
|
243
|
+
*/
|
|
244
|
+
export declare function getModelThinkingConfig(model: string): AntigravityModelConfig | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Type for the delete thinking config marker.
|
|
247
|
+
* Used when reasoning_effort is "none" to signal complete removal.
|
|
248
|
+
*/
|
|
249
|
+
export interface DeleteThinkingConfig {
|
|
250
|
+
deleteThinkingConfig: true;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Union type for thinking configuration input.
|
|
254
|
+
*/
|
|
255
|
+
export type ThinkingConfigInput = ThinkingConfig | DeleteThinkingConfig;
|
|
256
|
+
/**
|
|
257
|
+
* Convert thinking budget to closest level string for Gemini 3 models.
|
|
258
|
+
*
|
|
259
|
+
* @param budget - Thinking budget in tokens
|
|
260
|
+
* @param model - Model identifier
|
|
261
|
+
* @returns Level string ("low", "high", etc.) or "medium" fallback
|
|
262
|
+
*/
|
|
263
|
+
export declare function budgetToLevel(budget: number, model: string): string;
|
|
264
|
+
/**
|
|
265
|
+
* Apply thinking config to request body.
|
|
266
|
+
*
|
|
267
|
+
* CRITICAL: Sets request.generationConfig.thinkingConfig (NOT outer body!)
|
|
268
|
+
*
|
|
269
|
+
* Handles:
|
|
270
|
+
* - Gemini 3: Sets thinkingLevel (string)
|
|
271
|
+
* - Gemini 2.5: Sets thinkingBudget (number)
|
|
272
|
+
* - Delete marker: Removes thinkingConfig entirely
|
|
273
|
+
*
|
|
274
|
+
* @param requestBody - Request body to modify (mutates in place)
|
|
275
|
+
* @param model - Model identifier
|
|
276
|
+
* @param config - Thinking configuration or delete marker
|
|
277
|
+
*/
|
|
278
|
+
export declare function applyThinkingConfigToRequest(requestBody: Record<string, unknown>, model: string, config: ThinkingConfigInput): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for reasoning_effort and Gemini 3 thinkingLevel support.
|
|
3
|
+
*
|
|
4
|
+
* Tests the following functions:
|
|
5
|
+
* - getModelThinkingConfig()
|
|
6
|
+
* - extractThinkingConfig() with reasoning_effort
|
|
7
|
+
* - applyThinkingConfigToRequest()
|
|
8
|
+
* - budgetToLevel()
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -78,15 +78,11 @@ export interface AntigravityOnboardUserPayload {
|
|
|
78
78
|
* Wraps the actual request with project and model context
|
|
79
79
|
*/
|
|
80
80
|
export interface AntigravityRequestBody {
|
|
81
|
-
/** GCP project ID */
|
|
82
81
|
project: string;
|
|
83
|
-
/** Model identifier (e.g., "gemini-3-pro-preview") */
|
|
84
82
|
model: string;
|
|
85
|
-
/** User agent identifier */
|
|
86
83
|
userAgent: string;
|
|
87
|
-
|
|
84
|
+
requestType: string;
|
|
88
85
|
requestId: string;
|
|
89
|
-
/** The actual request payload */
|
|
90
86
|
request: Record<string, unknown>;
|
|
91
87
|
}
|
|
92
88
|
/**
|
|
@@ -203,3 +199,31 @@ export interface ParsedOAuthError {
|
|
|
203
199
|
code?: string;
|
|
204
200
|
description?: string;
|
|
205
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Multi-account support types
|
|
204
|
+
*/
|
|
205
|
+
/** All model families for rate limit tracking */
|
|
206
|
+
export declare const MODEL_FAMILIES: readonly ["claude", "gemini-flash", "gemini-pro"];
|
|
207
|
+
/** Model family for rate limit tracking */
|
|
208
|
+
export type ModelFamily = (typeof MODEL_FAMILIES)[number];
|
|
209
|
+
/** Account tier for prioritization */
|
|
210
|
+
export type AccountTier = "free" | "paid";
|
|
211
|
+
/** Rate limit state per model family (Unix timestamps in ms) */
|
|
212
|
+
export type RateLimitState = Partial<Record<ModelFamily, number>>;
|
|
213
|
+
/** Account metadata for storage */
|
|
214
|
+
export interface AccountMetadata {
|
|
215
|
+
email: string;
|
|
216
|
+
tier: AccountTier;
|
|
217
|
+
refreshToken: string;
|
|
218
|
+
projectId: string;
|
|
219
|
+
managedProjectId?: string;
|
|
220
|
+
accessToken: string;
|
|
221
|
+
expiresAt: number;
|
|
222
|
+
rateLimits: RateLimitState;
|
|
223
|
+
}
|
|
224
|
+
/** Storage schema for persisting multiple accounts */
|
|
225
|
+
export interface AccountStorage {
|
|
226
|
+
version: number;
|
|
227
|
+
accounts: AccountMetadata[];
|
|
228
|
+
activeIndex: number;
|
|
229
|
+
}
|