oh-my-opencode 3.0.0-beta.4 → 3.0.0-beta.6
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 +3 -16
- package/README.md +4 -29
- package/README.zh-cn.md +618 -500
- package/dist/agents/momus.d.ts +1 -1
- package/dist/agents/orchestrator-sisyphus.d.ts +1 -1
- package/dist/agents/prometheus-prompt.d.ts +3 -1
- package/dist/agents/sisyphus-junior.d.ts +6 -1
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/utils.d.ts +3 -2
- package/dist/cli/index.js +3647 -3661
- package/dist/cli/run/events.d.ts +1 -0
- package/dist/config/schema.d.ts +311 -179
- package/dist/features/background-agent/types.d.ts +2 -0
- package/dist/features/claude-code-session-state/state.d.ts +4 -0
- package/dist/features/hook-message-injector/index.d.ts +1 -1
- package/dist/features/hook-message-injector/injector.d.ts +7 -0
- package/dist/features/opencode-skill-loader/skill-content.d.ts +6 -2
- package/dist/hooks/auto-update-checker/checker.d.ts +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts +1 -0
- package/dist/index.js +19623 -22866
- package/dist/plugin-handlers/config-handler.d.ts +2 -0
- package/dist/shared/agent-variant.d.ts +5 -0
- package/dist/shared/first-message-variant.d.ts +11 -0
- package/dist/shared/first-message-variant.test.d.ts +1 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/permission-compat.d.ts +2 -0
- package/dist/shared/zip-extractor.d.ts +1 -0
- package/dist/tools/glob/cli.d.ts +4 -0
- package/dist/tools/glob/cli.test.d.ts +1 -0
- package/dist/tools/glob/types.d.ts +1 -0
- package/dist/tools/sisyphus-task/tools.d.ts +3 -1
- package/dist/tools/skill-mcp/types.d.ts +1 -1
- package/package.json +2 -6
- package/dist/auth/antigravity/accounts.d.ts +0 -40
- package/dist/auth/antigravity/browser.d.ts +0 -27
- package/dist/auth/antigravity/cli.d.ts +0 -2
- package/dist/auth/antigravity/constants.d.ts +0 -98
- package/dist/auth/antigravity/fetch.d.ts +0 -69
- package/dist/auth/antigravity/index.d.ts +0 -13
- package/dist/auth/antigravity/integration.test.d.ts +0 -10
- package/dist/auth/antigravity/message-converter.d.ts +0 -54
- package/dist/auth/antigravity/oauth.d.ts +0 -51
- package/dist/auth/antigravity/plugin.d.ts +0 -54
- package/dist/auth/antigravity/project.d.ts +0 -10
- package/dist/auth/antigravity/request.d.ts +0 -116
- package/dist/auth/antigravity/response.d.ts +0 -137
- package/dist/auth/antigravity/storage.d.ts +0 -5
- package/dist/auth/antigravity/thinking.d.ts +0 -278
- package/dist/auth/antigravity/thinking.test.d.ts +0 -10
- package/dist/auth/antigravity/thought-signature-store.d.ts +0 -52
- package/dist/auth/antigravity/token.d.ts +0 -38
- package/dist/auth/antigravity/tools.d.ts +0 -119
- package/dist/auth/antigravity/types.d.ts +0 -229
- package/dist/cli/ast-grep-napi.linux-x64-gnu-jfv8414z.node +0 -0
- package/dist/cli/ast-grep-napi.linux-x64-musl-8cj2e5cf.node +0 -0
- package/dist/cli/commands/auth.d.ts +0 -2
- package/dist/google-auth.d.ts +0 -3
- package/dist/google-auth.js +0 -3871
- /package/dist/{auth/antigravity/accounts.test.d.ts → agents/momus.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/browser.test.d.ts → agents/prometheus-prompt.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/cli.test.d.ts → agents/sisyphus-junior.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/constants.test.d.ts → hooks/auto-update-checker/checker.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/oauth.test.d.ts → plugin-config.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/request.test.d.ts → plugin-handlers/config-handler.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/storage.test.d.ts → shared/agent-variant.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/token.test.d.ts → shared/deep-merge.test.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OhMyOpenCodeConfig } from "../config";
|
|
2
2
|
import type { ModelCacheState } from "../plugin-state";
|
|
3
|
+
import type { CategoryConfig } from "../config/schema";
|
|
3
4
|
export interface ConfigHandlerDeps {
|
|
4
5
|
ctx: {
|
|
5
6
|
directory: string;
|
|
@@ -7,4 +8,5 @@ export interface ConfigHandlerDeps {
|
|
|
7
8
|
pluginConfig: OhMyOpenCodeConfig;
|
|
8
9
|
modelCacheState: ModelCacheState;
|
|
9
10
|
}
|
|
11
|
+
export declare function resolveCategoryConfig(categoryName: string, userCategories?: Record<string, CategoryConfig>): CategoryConfig | undefined;
|
|
10
12
|
export declare function createConfigHandler(deps: ConfigHandlerDeps): (config: Record<string, unknown>) => Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OhMyOpenCodeConfig } from "../config";
|
|
2
|
+
export declare function resolveAgentVariant(config: OhMyOpenCodeConfig, agentName?: string): string | undefined;
|
|
3
|
+
export declare function applyAgentVariant(config: OhMyOpenCodeConfig, agentName: string | undefined, message: {
|
|
4
|
+
variant?: string;
|
|
5
|
+
}): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type SessionInfo = {
|
|
2
|
+
id?: string;
|
|
3
|
+
parentID?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function createFirstMessageVariantGate(): {
|
|
6
|
+
markSessionCreated(info?: SessionInfo): void;
|
|
7
|
+
shouldOverride(sessionID?: string): boolean;
|
|
8
|
+
markApplied(sessionID?: string): void;
|
|
9
|
+
clear(sessionID?: string): void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractZip(archivePath: string, destDir: string): Promise<void>;
|
package/dist/tools/glob/cli.d.ts
CHANGED
|
@@ -4,4 +4,8 @@ export interface ResolvedCli {
|
|
|
4
4
|
path: string;
|
|
5
5
|
backend: GrepBackend;
|
|
6
6
|
}
|
|
7
|
+
declare function buildRgArgs(options: GlobOptions): string[];
|
|
8
|
+
declare function buildFindArgs(options: GlobOptions): string[];
|
|
9
|
+
declare function buildPowerShellCommand(options: GlobOptions): string[];
|
|
10
|
+
export { buildRgArgs, buildFindArgs, buildPowerShellCommand };
|
|
7
11
|
export declare function runRgFiles(options: GlobOptions, resolvedCli?: ResolvedCli): Promise<GlobResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
import type { BackgroundManager } from "../../features/background-agent";
|
|
3
|
-
import type { CategoriesConfig } from "../../config/schema";
|
|
3
|
+
import type { CategoriesConfig, GitMasterConfig } from "../../config/schema";
|
|
4
4
|
type OpencodeClient = PluginInput["client"];
|
|
5
5
|
export interface SisyphusTaskToolOptions {
|
|
6
6
|
manager: BackgroundManager;
|
|
7
7
|
client: OpencodeClient;
|
|
8
|
+
directory: string;
|
|
8
9
|
userCategories?: CategoriesConfig;
|
|
10
|
+
gitMasterConfig?: GitMasterConfig;
|
|
9
11
|
}
|
|
10
12
|
export interface BuildSystemContentInput {
|
|
11
13
|
skillContent?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.6",
|
|
4
4
|
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,14 +16,10 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js"
|
|
18
18
|
},
|
|
19
|
-
"./google-auth": {
|
|
20
|
-
"types": "./dist/google-auth.d.ts",
|
|
21
|
-
"import": "./dist/google-auth.js"
|
|
22
|
-
},
|
|
23
19
|
"./schema.json": "./dist/oh-my-opencode.schema.json"
|
|
24
20
|
},
|
|
25
21
|
"scripts": {
|
|
26
|
-
"build": "bun build src/index.ts
|
|
22
|
+
"build": "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
|
|
27
23
|
"build:schema": "bun run script/build-schema.ts",
|
|
28
24
|
"clean": "rm -rf dist",
|
|
29
25
|
"prepublishOnly": "bun run clean && bun run build",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type AccountStorage, type AccountTier, type AntigravityRefreshParts, type ModelFamily, type RateLimitState } from "./types";
|
|
2
|
-
export interface ManagedAccount {
|
|
3
|
-
index: number;
|
|
4
|
-
parts: AntigravityRefreshParts;
|
|
5
|
-
access?: string;
|
|
6
|
-
expires?: number;
|
|
7
|
-
rateLimits: RateLimitState;
|
|
8
|
-
lastUsed: number;
|
|
9
|
-
email?: string;
|
|
10
|
-
tier?: AccountTier;
|
|
11
|
-
}
|
|
12
|
-
interface AuthDetails {
|
|
13
|
-
refresh: string;
|
|
14
|
-
access: string;
|
|
15
|
-
expires: number;
|
|
16
|
-
}
|
|
17
|
-
interface OAuthAuthDetails {
|
|
18
|
-
type: "oauth";
|
|
19
|
-
refresh: string;
|
|
20
|
-
access: string;
|
|
21
|
-
expires: number;
|
|
22
|
-
}
|
|
23
|
-
export declare class AccountManager {
|
|
24
|
-
private accounts;
|
|
25
|
-
private currentIndex;
|
|
26
|
-
private activeIndex;
|
|
27
|
-
constructor(auth: AuthDetails, storedAccounts?: AccountStorage | null);
|
|
28
|
-
getAccountCount(): number;
|
|
29
|
-
getCurrentAccount(): ManagedAccount | null;
|
|
30
|
-
getAccounts(): ManagedAccount[];
|
|
31
|
-
getCurrentOrNextForFamily(family: ModelFamily): ManagedAccount | null;
|
|
32
|
-
getNextForFamily(family: ModelFamily): ManagedAccount | null;
|
|
33
|
-
markRateLimited(account: ManagedAccount, retryAfterMs: number, family: ModelFamily): void;
|
|
34
|
-
clearExpiredRateLimits(account: ManagedAccount): void;
|
|
35
|
-
addAccount(parts: AntigravityRefreshParts, access?: string, expires?: number, email?: string, tier?: AccountTier): void;
|
|
36
|
-
removeAccount(index: number): boolean;
|
|
37
|
-
save(path?: string): Promise<void>;
|
|
38
|
-
toAuthDetails(): OAuthAuthDetails;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
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>;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Antigravity OAuth configuration constants.
|
|
3
|
-
* Values sourced from cliproxyapi/sdk/auth/antigravity.go
|
|
4
|
-
*
|
|
5
|
-
* ## Logging Policy
|
|
6
|
-
*
|
|
7
|
-
* All console logging in antigravity modules follows a consistent policy:
|
|
8
|
-
*
|
|
9
|
-
* - **Debug logs**: Guard with `if (process.env.ANTIGRAVITY_DEBUG === "1")`
|
|
10
|
-
* - Includes: info messages, warnings, non-fatal errors
|
|
11
|
-
* - Enable debugging: `ANTIGRAVITY_DEBUG=1 opencode`
|
|
12
|
-
*
|
|
13
|
-
* - **Fatal errors**: None currently. All errors are handled by returning
|
|
14
|
-
* appropriate error responses to OpenCode's auth system.
|
|
15
|
-
*
|
|
16
|
-
* This policy ensures production silence while enabling verbose debugging
|
|
17
|
-
* when needed for troubleshooting OAuth flows.
|
|
18
|
-
*/
|
|
19
|
-
export declare const ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
|
|
20
|
-
export declare const ANTIGRAVITY_CLIENT_SECRET = "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";
|
|
21
|
-
export declare const ANTIGRAVITY_CALLBACK_PORT = 51121;
|
|
22
|
-
export declare const ANTIGRAVITY_REDIRECT_URI = "http://localhost:51121/oauth-callback";
|
|
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://daily-cloudcode-pa.googleapis.com", "https://cloudcode-pa.googleapis.com"];
|
|
25
|
-
export declare const ANTIGRAVITY_API_VERSION = "v1internal";
|
|
26
|
-
export declare const ANTIGRAVITY_HEADERS: {
|
|
27
|
-
readonly "User-Agent": "google-api-nodejs-client/9.15.1";
|
|
28
|
-
readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
|
|
29
|
-
readonly "Client-Metadata": string;
|
|
30
|
-
};
|
|
31
|
-
export declare const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
32
|
-
export declare const GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
33
|
-
export declare const GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
34
|
-
export declare const GOOGLE_USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo";
|
|
35
|
-
export declare const ANTIGRAVITY_TOKEN_REFRESH_BUFFER_MS = 60000;
|
|
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Antigravity Fetch Interceptor
|
|
3
|
-
*
|
|
4
|
-
* Creates a custom fetch function that:
|
|
5
|
-
* - Checks token expiration and auto-refreshes
|
|
6
|
-
* - Rewrites URLs to Antigravity endpoints
|
|
7
|
-
* - Applies request transformation (including tool normalization)
|
|
8
|
-
* - Applies response transformation (including thinking extraction)
|
|
9
|
-
* - Implements endpoint fallback (daily → autopush → prod)
|
|
10
|
-
*
|
|
11
|
-
* **Body Type Assumption:**
|
|
12
|
-
* This interceptor assumes `init.body` is a JSON string (OpenAI format).
|
|
13
|
-
* Non-string bodies (ReadableStream, Blob, FormData, URLSearchParams, etc.)
|
|
14
|
-
* are passed through unchanged to the original fetch to avoid breaking
|
|
15
|
-
* other requests that may not be OpenAI-format API calls.
|
|
16
|
-
*
|
|
17
|
-
* Debug logging available via ANTIGRAVITY_DEBUG=1 environment variable.
|
|
18
|
-
*/
|
|
19
|
-
import { AccountManager } from "./accounts";
|
|
20
|
-
/**
|
|
21
|
-
* Auth interface matching OpenCode's auth system
|
|
22
|
-
*/
|
|
23
|
-
interface Auth {
|
|
24
|
-
access?: string;
|
|
25
|
-
refresh?: string;
|
|
26
|
-
expires?: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Client interface for auth operations
|
|
30
|
-
*/
|
|
31
|
-
interface AuthClient {
|
|
32
|
-
set(providerId: string, auth: Auth): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create Antigravity fetch interceptor
|
|
36
|
-
*
|
|
37
|
-
* Factory function that creates a custom fetch function for Antigravity API.
|
|
38
|
-
* Handles token management, request/response transformation, and endpoint fallback.
|
|
39
|
-
*
|
|
40
|
-
* @param getAuth - Async function to retrieve current auth state
|
|
41
|
-
* @param client - Auth client for saving updated tokens
|
|
42
|
-
* @param providerId - Provider identifier (e.g., "google")
|
|
43
|
-
* @param clientId - Optional custom client ID for token refresh (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
44
|
-
* @param clientSecret - Optional custom client secret for token refresh (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
45
|
-
* @returns Custom fetch function compatible with standard fetch signature
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const customFetch = createAntigravityFetch(
|
|
50
|
-
* () => auth(),
|
|
51
|
-
* client,
|
|
52
|
-
* "google",
|
|
53
|
-
* "custom-client-id",
|
|
54
|
-
* "custom-client-secret"
|
|
55
|
-
* )
|
|
56
|
-
*
|
|
57
|
-
* // Use like standard fetch
|
|
58
|
-
* const response = await customFetch("https://api.example.com/chat", {
|
|
59
|
-
* method: "POST",
|
|
60
|
-
* body: JSON.stringify({ messages: [...] })
|
|
61
|
-
* })
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
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>;
|
|
65
|
-
/**
|
|
66
|
-
* Type export for createAntigravityFetch return type
|
|
67
|
-
*/
|
|
68
|
-
export type AntigravityFetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
69
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./constants";
|
|
3
|
-
export * from "./oauth";
|
|
4
|
-
export * from "./token";
|
|
5
|
-
export * from "./project";
|
|
6
|
-
export * from "./request";
|
|
7
|
-
export * from "./response";
|
|
8
|
-
export * from "./tools";
|
|
9
|
-
export * from "./thinking";
|
|
10
|
-
export * from "./thought-signature-store";
|
|
11
|
-
export * from "./message-converter";
|
|
12
|
-
export * from "./fetch";
|
|
13
|
-
export * from "./plugin";
|
|
@@ -1,10 +0,0 @@
|
|
|
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,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI → Gemini message format converter
|
|
3
|
-
*
|
|
4
|
-
* Converts OpenAI-style messages to Gemini contents format,
|
|
5
|
-
* injecting thoughtSignature into functionCall parts.
|
|
6
|
-
*/
|
|
7
|
-
interface OpenAIMessage {
|
|
8
|
-
role: "system" | "user" | "assistant" | "tool";
|
|
9
|
-
content?: string | OpenAIContentPart[];
|
|
10
|
-
tool_calls?: OpenAIToolCall[];
|
|
11
|
-
tool_call_id?: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
}
|
|
14
|
-
interface OpenAIContentPart {
|
|
15
|
-
type: string;
|
|
16
|
-
text?: string;
|
|
17
|
-
image_url?: {
|
|
18
|
-
url: string;
|
|
19
|
-
};
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
}
|
|
22
|
-
interface OpenAIToolCall {
|
|
23
|
-
id: string;
|
|
24
|
-
type: "function";
|
|
25
|
-
function: {
|
|
26
|
-
name: string;
|
|
27
|
-
arguments: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
interface GeminiPart {
|
|
31
|
-
text?: string;
|
|
32
|
-
functionCall?: {
|
|
33
|
-
name: string;
|
|
34
|
-
args: Record<string, unknown>;
|
|
35
|
-
};
|
|
36
|
-
functionResponse?: {
|
|
37
|
-
name: string;
|
|
38
|
-
response: Record<string, unknown>;
|
|
39
|
-
};
|
|
40
|
-
inlineData?: {
|
|
41
|
-
mimeType: string;
|
|
42
|
-
data: string;
|
|
43
|
-
};
|
|
44
|
-
thought_signature?: string;
|
|
45
|
-
[key: string]: unknown;
|
|
46
|
-
}
|
|
47
|
-
interface GeminiContent {
|
|
48
|
-
role: "user" | "model";
|
|
49
|
-
parts: GeminiPart[];
|
|
50
|
-
}
|
|
51
|
-
export declare function convertOpenAIToGemini(messages: OpenAIMessage[], thoughtSignature?: string): GeminiContent[];
|
|
52
|
-
export declare function hasOpenAIMessages(body: Record<string, unknown>): boolean;
|
|
53
|
-
export declare function convertRequestBody(body: Record<string, unknown>, thoughtSignature?: string): Record<string, unknown>;
|
|
54
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { AntigravityTokenExchangeResult, AntigravityUserInfo } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Result from building an OAuth authorization URL.
|
|
4
|
-
*/
|
|
5
|
-
export interface AuthorizationResult {
|
|
6
|
-
/** Full OAuth URL to open in browser */
|
|
7
|
-
url: string;
|
|
8
|
-
/** State for CSRF protection */
|
|
9
|
-
state: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Result from the OAuth callback server.
|
|
13
|
-
*/
|
|
14
|
-
export interface CallbackResult {
|
|
15
|
-
/** Authorization code from Google */
|
|
16
|
-
code: string;
|
|
17
|
-
/** State parameter from callback */
|
|
18
|
-
state: string;
|
|
19
|
-
/** Error message if any */
|
|
20
|
-
error?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function buildAuthURL(projectId?: string, clientId?: string, port?: number): Promise<AuthorizationResult>;
|
|
23
|
-
/**
|
|
24
|
-
* Exchange authorization code for tokens.
|
|
25
|
-
*
|
|
26
|
-
* @param code - Authorization code from OAuth callback
|
|
27
|
-
* @param redirectUri - OAuth redirect URI
|
|
28
|
-
* @param clientId - Optional custom client ID (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
29
|
-
* @param clientSecret - Optional custom client secret (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
30
|
-
* @returns Token exchange result with access and refresh tokens
|
|
31
|
-
*/
|
|
32
|
-
export declare function exchangeCode(code: string, redirectUri: string, clientId?: string, clientSecret?: string): Promise<AntigravityTokenExchangeResult>;
|
|
33
|
-
/**
|
|
34
|
-
* Fetch user info from Google's userinfo API.
|
|
35
|
-
*
|
|
36
|
-
* @param accessToken - Valid access token
|
|
37
|
-
* @returns User info containing email
|
|
38
|
-
*/
|
|
39
|
-
export declare function fetchUserInfo(accessToken: string): Promise<AntigravityUserInfo>;
|
|
40
|
-
export interface CallbackServerHandle {
|
|
41
|
-
port: number;
|
|
42
|
-
redirectUri: string;
|
|
43
|
-
waitForCallback: () => Promise<CallbackResult>;
|
|
44
|
-
close: () => void;
|
|
45
|
-
}
|
|
46
|
-
export declare function startCallbackServer(timeoutMs?: number): CallbackServerHandle;
|
|
47
|
-
export declare function performOAuthFlow(projectId?: string, openBrowser?: (url: string) => Promise<void>, clientId?: string, clientSecret?: string): Promise<{
|
|
48
|
-
tokens: AntigravityTokenExchangeResult;
|
|
49
|
-
userInfo: AntigravityUserInfo;
|
|
50
|
-
state: string;
|
|
51
|
-
}>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Google Antigravity Auth Plugin for OpenCode
|
|
3
|
-
*
|
|
4
|
-
* Provides OAuth authentication for Google models via Antigravity API.
|
|
5
|
-
* This plugin integrates with OpenCode's auth system to enable:
|
|
6
|
-
* - OAuth 2.0 with PKCE flow for Google authentication
|
|
7
|
-
* - Automatic token refresh
|
|
8
|
-
* - Request/response transformation for Antigravity API
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```json
|
|
12
|
-
* // opencode.json
|
|
13
|
-
* {
|
|
14
|
-
* "plugin": ["oh-my-opencode"],
|
|
15
|
-
* "provider": {
|
|
16
|
-
* "google": {
|
|
17
|
-
* "options": {
|
|
18
|
-
* "clientId": "custom-client-id",
|
|
19
|
-
* "clientSecret": "custom-client-secret"
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
import type { AuthHook, PluginInput } from "@opencode-ai/plugin";
|
|
27
|
-
/**
|
|
28
|
-
* Creates the Google Antigravity OAuth plugin for OpenCode.
|
|
29
|
-
*
|
|
30
|
-
* This factory function creates an auth plugin that:
|
|
31
|
-
* 1. Provides OAuth flow for Google authentication
|
|
32
|
-
* 2. Creates a custom fetch interceptor for Antigravity API
|
|
33
|
-
* 3. Handles token management and refresh
|
|
34
|
-
*
|
|
35
|
-
* @param input - Plugin input containing the OpenCode client
|
|
36
|
-
* @returns Hooks object with auth configuration
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* // Used by OpenCode automatically when plugin is loaded
|
|
41
|
-
* const hooks = await createGoogleAntigravityAuthPlugin({ client, ... })
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function createGoogleAntigravityAuthPlugin({ client, }: PluginInput): Promise<{
|
|
45
|
-
auth: AuthHook;
|
|
46
|
-
}>;
|
|
47
|
-
/**
|
|
48
|
-
* Default export for OpenCode plugin system
|
|
49
|
-
*/
|
|
50
|
-
export default createGoogleAntigravityAuthPlugin;
|
|
51
|
-
/**
|
|
52
|
-
* Named export for explicit imports
|
|
53
|
-
*/
|
|
54
|
-
export declare const GoogleAntigravityAuthPlugin: typeof createGoogleAntigravityAuthPlugin;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Antigravity project context management.
|
|
3
|
-
* Handles fetching GCP project ID via Google's loadCodeAssist API.
|
|
4
|
-
* For FREE tier users, onboards via onboardUser API to get server-assigned managed project ID.
|
|
5
|
-
* Reference: https://github.com/shekohex/opencode-google-antigravity-auth
|
|
6
|
-
*/
|
|
7
|
-
import type { AntigravityProjectContext } from "./types";
|
|
8
|
-
export declare function fetchProjectContext(accessToken: string): Promise<AntigravityProjectContext>;
|
|
9
|
-
export declare function clearProjectContextCache(accessToken?: string): void;
|
|
10
|
-
export declare function invalidateProjectContextByRefreshToken(_refreshToken: string): void;
|