oh-my-opencode 3.0.0-beta.1 → 3.0.0-beta.11
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 +69 -816
- package/README.md +72 -949
- package/README.zh-cn.md +222 -959
- package/bin/oh-my-opencode.js +80 -0
- package/bin/platform.js +38 -0
- package/bin/platform.test.ts +148 -0
- package/dist/agents/metis.d.ts +1 -0
- package/dist/agents/momus.d.ts +1 -1
- package/dist/agents/orchestrator-sisyphus.d.ts +3 -2
- package/dist/agents/prometheus-prompt.d.ts +3 -1
- package/dist/agents/sisyphus-junior.d.ts +6 -2
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/utils.d.ts +3 -2
- package/dist/cli/config-manager.d.ts +9 -1
- package/dist/cli/doctor/checks/opencode.d.ts +5 -1
- package/dist/cli/index.js +3886 -3763
- package/dist/cli/run/events.d.ts +1 -0
- package/dist/cli/types.d.ts +3 -0
- package/dist/config/schema.d.ts +538 -208
- package/dist/features/background-agent/concurrency.d.ts +17 -0
- package/dist/features/background-agent/manager.d.ts +54 -5
- package/dist/features/background-agent/types.d.ts +13 -4
- 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/types.d.ts +1 -1
- package/dist/features/claude-code-session-state/state.d.ts +6 -1
- package/dist/features/context-injector/index.d.ts +1 -1
- package/dist/features/context-injector/injector.d.ts +1 -1
- package/dist/features/hook-message-injector/index.d.ts +2 -2
- package/dist/features/hook-message-injector/injector.d.ts +7 -0
- package/dist/features/opencode-skill-loader/skill-content.d.ts +17 -2
- package/dist/features/skill-mcp-manager/manager.d.ts +11 -0
- package/dist/features/task-toast-manager/index.d.ts +1 -1
- package/dist/features/task-toast-manager/manager.d.ts +2 -1
- package/dist/features/task-toast-manager/types.d.ts +5 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
- package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +1 -1
- package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +1 -2
- package/dist/hooks/anthropic-context-window-limit-recovery/types.d.ts +0 -5
- package/dist/hooks/auto-update-checker/checker.d.ts +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts +4 -0
- package/dist/hooks/background-compaction/index.d.ts +19 -0
- package/dist/hooks/background-notification/index.d.ts +6 -0
- package/dist/hooks/comment-checker/cli.d.ts +0 -1
- package/dist/hooks/compaction-context-injector/index.d.ts +7 -1
- package/dist/hooks/delegate-task-retry/index.d.ts +24 -0
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/keyword-detector/index.d.ts +2 -1
- package/dist/hooks/prometheus-md-only/constants.d.ts +2 -2
- package/dist/hooks/prometheus-md-only/index.d.ts +1 -1
- package/dist/hooks/ralph-loop/index.d.ts +1 -0
- package/dist/hooks/ralph-loop/types.d.ts +1 -0
- package/dist/index.js +24184 -25263
- package/dist/mcp/context7.d.ts +1 -0
- package/dist/mcp/grep-app.d.ts +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/websearch.d.ts +1 -0
- package/dist/plugin-handlers/config-handler.d.ts +2 -0
- package/dist/plugin-handlers/config-handler.test.d.ts +1 -0
- package/dist/shared/agent-tool-restrictions.d.ts +7 -0
- package/dist/shared/agent-variant.d.ts +5 -0
- package/dist/shared/agent-variant.test.d.ts +1 -0
- package/dist/shared/deep-merge.test.d.ts +1 -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 +6 -0
- package/dist/shared/migration.d.ts +1 -0
- package/dist/shared/opencode-version.d.ts +6 -3
- package/dist/shared/permission-compat.d.ts +22 -7
- package/dist/shared/session-cursor.d.ts +13 -0
- package/dist/shared/session-cursor.test.d.ts +1 -0
- package/dist/shared/shell-env.d.ts +41 -0
- package/dist/shared/shell-env.test.d.ts +1 -0
- package/dist/shared/system-directive.d.ts +31 -0
- package/dist/shared/zip-extractor.d.ts +1 -0
- package/dist/tools/{sisyphus-task → delegate-task}/constants.d.ts +3 -3
- package/dist/tools/{sisyphus-task → delegate-task}/index.d.ts +1 -1
- package/dist/tools/{sisyphus-task → delegate-task}/tools.d.ts +5 -3
- package/dist/tools/delegate-task/tools.test.d.ts +1 -0
- package/dist/tools/{sisyphus-task → delegate-task}/types.d.ts +1 -1
- 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/index.d.ts +3 -1
- package/dist/tools/interactive-bash/constants.d.ts +1 -1
- package/dist/tools/look-at/tools.d.ts +7 -0
- package/dist/tools/look-at/tools.test.d.ts +1 -0
- package/dist/tools/lsp/client.d.ts +1 -3
- package/dist/tools/lsp/config.test.d.ts +1 -0
- package/dist/tools/lsp/index.d.ts +1 -1
- package/dist/tools/lsp/tools.d.ts +1 -6
- package/dist/tools/lsp/types.d.ts +0 -33
- package/dist/tools/lsp/utils.d.ts +1 -4
- package/dist/tools/skill/tools.d.ts +1 -7
- package/dist/tools/skill/types.d.ts +3 -0
- package/dist/tools/skill-mcp/types.d.ts +1 -1
- package/dist/tools/slashcommand/tools.d.ts +1 -7
- package/package.json +21 -14
- package/postinstall.mjs +43 -0
- package/dist/agents/build-prompt.d.ts +0 -31
- package/dist/agents/plan-prompt.d.ts +0 -64
- 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/hooks/anthropic-context-window-limit-recovery/pruning-executor.d.ts +0 -3
- package/dist/hooks/anthropic-context-window-limit-recovery/pruning-purge-errors.d.ts +0 -7
- package/dist/hooks/anthropic-context-window-limit-recovery/pruning-storage.d.ts +0 -2
- package/dist/hooks/anthropic-context-window-limit-recovery/pruning-supersede.d.ts +0 -6
- package/dist/hooks/comment-checker/constants.d.ts +0 -3
- package/dist/hooks/comment-checker/filters/bdd.d.ts +0 -2
- package/dist/hooks/comment-checker/filters/directive.d.ts +0 -2
- package/dist/hooks/comment-checker/filters/docstring.d.ts +0 -2
- package/dist/hooks/comment-checker/filters/index.d.ts +0 -7
- package/dist/hooks/comment-checker/filters/shebang.d.ts +0 -2
- package/dist/hooks/comment-checker/output/formatter.d.ts +0 -2
- package/dist/hooks/comment-checker/output/index.d.ts +0 -2
- package/dist/hooks/comment-checker/output/xml-builder.d.ts +0 -2
- package/dist/hooks/empty-message-sanitizer/index.d.ts +0 -12
- package/dist/hooks/preemptive-compaction/constants.d.ts +0 -3
- package/dist/hooks/preemptive-compaction/index.d.ts +0 -24
- package/dist/hooks/preemptive-compaction/types.d.ts +0 -17
- package/dist/tools/ast-grep/napi.d.ts +0 -13
- package/dist/tools/interactive-bash/types.d.ts +0 -3
- /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 → features/claude-code-session-state/state.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/oauth.test.d.ts → hooks/auto-update-checker/checker.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/request.test.d.ts → hooks/auto-update-checker/index.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/storage.test.d.ts → hooks/comment-checker/cli.test.d.ts} +0 -0
- /package/dist/{auth/antigravity/token.test.d.ts → hooks/delegate-task-retry/index.test.d.ts} +0 -0
- /package/dist/{tools/sisyphus-task/tools.test.d.ts → plugin-config.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.11",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"oh-my-opencode": "./
|
|
9
|
+
"oh-my-opencode": "./bin/oh-my-opencode.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"postinstall.mjs"
|
|
13
15
|
],
|
|
14
16
|
"exports": {
|
|
15
17
|
".": {
|
|
16
18
|
"types": "./dist/index.d.ts",
|
|
17
19
|
"import": "./dist/index.js"
|
|
18
20
|
},
|
|
19
|
-
"./google-auth": {
|
|
20
|
-
"types": "./dist/google-auth.d.ts",
|
|
21
|
-
"import": "./dist/google-auth.js"
|
|
22
|
-
},
|
|
23
21
|
"./schema.json": "./dist/oh-my-opencode.schema.json"
|
|
24
22
|
},
|
|
25
23
|
"scripts": {
|
|
26
|
-
"build": "bun build src/index.ts
|
|
24
|
+
"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",
|
|
25
|
+
"build:all": "bun run build && bun run build:binaries",
|
|
26
|
+
"build:binaries": "bun run script/build-binaries.ts",
|
|
27
27
|
"build:schema": "bun run script/build-schema.ts",
|
|
28
28
|
"clean": "rm -rf dist",
|
|
29
|
+
"postinstall": "node postinstall.mjs",
|
|
29
30
|
"prepublishOnly": "bun run clean && bun run build",
|
|
30
31
|
"typecheck": "tsc --noEmit",
|
|
31
32
|
"test": "bun test"
|
|
@@ -55,17 +56,14 @@
|
|
|
55
56
|
"@clack/prompts": "^0.11.0",
|
|
56
57
|
"@code-yeongyu/comment-checker": "^0.6.1",
|
|
57
58
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
58
|
-
"@
|
|
59
|
-
"@opencode-ai/
|
|
60
|
-
"@opencode-ai/sdk": "^1.1.1",
|
|
59
|
+
"@opencode-ai/plugin": "^1.1.19",
|
|
60
|
+
"@opencode-ai/sdk": "^1.1.19",
|
|
61
61
|
"commander": "^14.0.2",
|
|
62
|
-
"
|
|
62
|
+
"detect-libc": "^2.0.0",
|
|
63
63
|
"js-yaml": "^4.1.1",
|
|
64
64
|
"jsonc-parser": "^3.3.1",
|
|
65
|
-
"open": "^11.0.0",
|
|
66
65
|
"picocolors": "^1.1.1",
|
|
67
66
|
"picomatch": "^4.0.2",
|
|
68
|
-
"xdg-basedir": "^5.1.0",
|
|
69
67
|
"zod": "^4.1.8"
|
|
70
68
|
},
|
|
71
69
|
"devDependencies": {
|
|
@@ -74,6 +72,15 @@
|
|
|
74
72
|
"bun-types": "latest",
|
|
75
73
|
"typescript": "^5.7.3"
|
|
76
74
|
},
|
|
75
|
+
"optionalDependencies": {
|
|
76
|
+
"oh-my-opencode-darwin-arm64": "3.0.0-beta.11",
|
|
77
|
+
"oh-my-opencode-darwin-x64": "3.0.0-beta.11",
|
|
78
|
+
"oh-my-opencode-linux-arm64": "3.0.0-beta.11",
|
|
79
|
+
"oh-my-opencode-linux-arm64-musl": "3.0.0-beta.11",
|
|
80
|
+
"oh-my-opencode-linux-x64": "3.0.0-beta.11",
|
|
81
|
+
"oh-my-opencode-linux-x64-musl": "3.0.0-beta.11",
|
|
82
|
+
"oh-my-opencode-windows-x64": "3.0.0-beta.11"
|
|
83
|
+
},
|
|
77
84
|
"trustedDependencies": [
|
|
78
85
|
"@ast-grep/cli",
|
|
79
86
|
"@ast-grep/napi",
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// postinstall.mjs
|
|
2
|
+
// Runs after npm install to verify platform binary is available
|
|
3
|
+
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { getPlatformPackage, getBinaryPath } from "./bin/platform.js";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Detect libc family on Linux
|
|
11
|
+
*/
|
|
12
|
+
function getLibcFamily() {
|
|
13
|
+
if (process.platform !== "linux") {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const detectLibc = require("detect-libc");
|
|
19
|
+
return detectLibc.familySync();
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const { platform, arch } = process;
|
|
27
|
+
const libcFamily = getLibcFamily();
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const pkg = getPlatformPackage({ platform, arch, libcFamily });
|
|
31
|
+
const binPath = getBinaryPath(pkg, platform);
|
|
32
|
+
|
|
33
|
+
// Try to resolve the binary
|
|
34
|
+
require.resolve(binPath);
|
|
35
|
+
console.log(`✓ oh-my-opencode binary installed for ${platform}-${arch}`);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.warn(`⚠ oh-my-opencode: ${error.message}`);
|
|
38
|
+
console.warn(` The CLI may not work on this platform.`);
|
|
39
|
+
// Don't fail installation - let user try anyway
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
main();
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode's default build agent system prompt.
|
|
3
|
-
*
|
|
4
|
-
* This prompt enables FULL EXECUTION mode for the build agent, allowing file
|
|
5
|
-
* modifications, command execution, and system changes while focusing on
|
|
6
|
-
* implementation and execution.
|
|
7
|
-
*
|
|
8
|
-
* Inspired by OpenCode's build agent behavior.
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/session/prompt/build-switch.txt
|
|
11
|
-
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L118-L125
|
|
12
|
-
*/
|
|
13
|
-
export declare const BUILD_SYSTEM_PROMPT = "<system-reminder>\n# Build Mode - System Reminder\n\nBUILD MODE ACTIVE - you are in EXECUTION phase. Your responsibility is to:\n- Implement features and make code changes\n- Execute commands and run tests\n- Fix bugs and refactor code\n- Deploy and build systems\n- Make all necessary file modifications\n\nYou have FULL permissions to edit files, run commands, and make system changes.\nThis is the implementation phase - execute decisively and thoroughly.\n\n---\n\n## Responsibility\n\nYour current responsibility is to implement, build, and execute. You should:\n- Write and modify code to accomplish the user's goals\n- Run tests and builds to verify your changes\n- Fix errors and issues that arise\n- Use all available tools to complete the task efficiently\n- Delegate to specialized agents when appropriate for better results\n\n**NOTE:** You should ask the user for clarification when requirements are ambiguous,\nbut once the path is clear, execute confidently. The goal is to deliver working,\ntested, production-ready solutions.\n\n---\n\n## Important\n\nThe user wants you to execute and implement. You SHOULD make edits, run necessary\ntools, and make changes to accomplish the task. Use your full capabilities to\ndeliver excellent results.\n</system-reminder>\n";
|
|
14
|
-
/**
|
|
15
|
-
* OpenCode's default build agent permission configuration.
|
|
16
|
-
*
|
|
17
|
-
* Allows the build agent full execution permissions:
|
|
18
|
-
* - edit: "ask" - Can modify files with confirmation
|
|
19
|
-
* - bash: "ask" - Can execute commands with confirmation
|
|
20
|
-
* - webfetch: "allow" - Can fetch web content
|
|
21
|
-
*
|
|
22
|
-
* This provides balanced permissions - powerful but with safety checks.
|
|
23
|
-
*
|
|
24
|
-
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L57-L68
|
|
25
|
-
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L118-L125
|
|
26
|
-
*/
|
|
27
|
-
export declare const BUILD_PERMISSION: {
|
|
28
|
-
edit: "ask";
|
|
29
|
-
bash: "ask";
|
|
30
|
-
webfetch: "allow";
|
|
31
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OhMyOpenCode Plan Agent System Prompt
|
|
3
|
-
*
|
|
4
|
-
* A streamlined planner that:
|
|
5
|
-
* - SKIPS user dialogue/Q&A (no user questioning)
|
|
6
|
-
* - KEEPS context gathering via explore/librarian agents
|
|
7
|
-
* - Uses Metis ONLY for AI slop guardrails
|
|
8
|
-
* - Outputs plan directly to user (no file creation)
|
|
9
|
-
*
|
|
10
|
-
* For the full Prometheus experience with user dialogue, use "Prometheus (Planner)" agent.
|
|
11
|
-
*/
|
|
12
|
-
export declare const PLAN_SYSTEM_PROMPT = "<system-reminder>\n# Plan Mode - System Reminder\n\n## ABSOLUTE CONSTRAINTS (NON-NEGOTIABLE)\n\n### 1. NO IMPLEMENTATION - PLANNING ONLY\nYou are a PLANNER, NOT an executor. You must NEVER:\n- Start implementing ANY task\n- Write production code\n- Execute the work yourself\n- \"Get started\" on any implementation\n- Begin coding even if user asks\n\nYour ONLY job is to CREATE THE PLAN. Implementation is done by OTHER agents AFTER you deliver the plan.\nIf user says \"implement this\" or \"start working\", you respond: \"I am the plan agent. I will create a detailed work plan for execution by other agents.\"\n\n### 2. READ-ONLY FILE ACCESS\nYou may NOT create or edit any files. You can only READ files for context gathering.\n- Reading files for analysis: ALLOWED\n- ANY file creation or edits: STRICTLY FORBIDDEN\n\n### 3. PLAN OUTPUT\nYour deliverable is a structured work plan delivered directly in your response.\nYou do NOT deliver code. You do NOT deliver implementations. You deliver PLANS.\n\nZERO EXCEPTIONS to these constraints.\n</system-reminder>\n\nYou are a strategic planner. You bring foresight and structure to complex work.\n\n## Your Mission\n\nCreate structured work plans that enable efficient execution by AI agents.\n\n## Workflow (Execute Phases Sequentially)\n\n### Phase 1: Context Gathering (Parallel)\n\nLaunch **in parallel**:\n\n**Explore agents** (3-5 parallel):\n```\nTask(subagent_type=\"explore\", prompt=\"Find [specific aspect] in codebase...\")\n```\n- Similar implementations\n- Project patterns and conventions\n- Related test files\n- Architecture/structure\n\n**Librarian agents** (2-3 parallel):\n```\nTask(subagent_type=\"librarian\", prompt=\"Find documentation for [library/pattern]...\")\n```\n- Framework docs for relevant features\n- Best practices for the task type\n\n### Phase 2: AI Slop Guardrails\n\nCall `Metis (Plan Consultant)` with gathered context to identify guardrails:\n\n```\nTask(\n subagent_type=\"Metis (Plan Consultant)\",\n prompt=\"Based on this context, identify AI slop guardrails:\n\n User Request: {user's original request}\n Codebase Context: {findings from Phase 1}\n\n Generate:\n 1. AI slop patterns to avoid (over-engineering, unnecessary abstractions, verbose comments)\n 2. Common AI mistakes for this type of task\n 3. Project-specific conventions that must be followed\n 4. Explicit 'MUST NOT DO' guardrails\"\n)\n```\n\n### Phase 3: Plan Generation\n\nGenerate a structured plan with:\n\n1. **Core Objective** - What we're achieving (1-2 sentences)\n2. **Concrete Deliverables** - Exact files/endpoints/features\n3. **Definition of Done** - Acceptance criteria\n4. **Must Have** - Required elements\n5. **Must NOT Have** - Forbidden patterns (from Metis guardrails)\n6. **Task Breakdown** - Sequential/parallel task flow\n7. **References** - Existing code to follow\n\n## Key Principles\n\n1. **Infer intent from context** - Use codebase patterns and common practices\n2. **Define concrete deliverables** - Exact outputs, not vague goals\n3. **Clarify what NOT to do** - Most important for preventing AI mistakes\n4. **References over instructions** - Point to existing code\n5. **Verifiable acceptance criteria** - Commands with expected outputs\n6. **Implementation + Test = ONE task** - NEVER separate\n7. **Parallelizability is MANDATORY** - Enable multi-agent execution\n";
|
|
13
|
-
/**
|
|
14
|
-
* OpenCode's default plan agent permission configuration.
|
|
15
|
-
*
|
|
16
|
-
* Restricts the plan agent to read-only operations:
|
|
17
|
-
* - edit: "deny" - No file modifications allowed
|
|
18
|
-
* - bash: Only read-only commands (ls, grep, git log, etc.)
|
|
19
|
-
* - webfetch: "allow" - Can fetch web content for research
|
|
20
|
-
*
|
|
21
|
-
* @see https://github.com/sst/opencode/blob/db2abc1b2c144f63a205f668bd7267e00829d84a/packages/opencode/src/agent/agent.ts#L63-L107
|
|
22
|
-
*/
|
|
23
|
-
export declare const PLAN_PERMISSION: {
|
|
24
|
-
edit: "deny";
|
|
25
|
-
bash: {
|
|
26
|
-
"cut*": "allow";
|
|
27
|
-
"diff*": "allow";
|
|
28
|
-
"du*": "allow";
|
|
29
|
-
"file *": "allow";
|
|
30
|
-
"find * -delete*": "ask";
|
|
31
|
-
"find * -exec*": "ask";
|
|
32
|
-
"find * -fprint*": "ask";
|
|
33
|
-
"find * -fls*": "ask";
|
|
34
|
-
"find * -fprintf*": "ask";
|
|
35
|
-
"find * -ok*": "ask";
|
|
36
|
-
"find *": "allow";
|
|
37
|
-
"git diff*": "allow";
|
|
38
|
-
"git log*": "allow";
|
|
39
|
-
"git show*": "allow";
|
|
40
|
-
"git status*": "allow";
|
|
41
|
-
"git branch": "allow";
|
|
42
|
-
"git branch -v": "allow";
|
|
43
|
-
"grep*": "allow";
|
|
44
|
-
"head*": "allow";
|
|
45
|
-
"less*": "allow";
|
|
46
|
-
"ls*": "allow";
|
|
47
|
-
"more*": "allow";
|
|
48
|
-
"pwd*": "allow";
|
|
49
|
-
"rg*": "allow";
|
|
50
|
-
"sort --output=*": "ask";
|
|
51
|
-
"sort -o *": "ask";
|
|
52
|
-
"sort*": "allow";
|
|
53
|
-
"stat*": "allow";
|
|
54
|
-
"tail*": "allow";
|
|
55
|
-
"tree -o *": "ask";
|
|
56
|
-
"tree*": "allow";
|
|
57
|
-
"uniq*": "allow";
|
|
58
|
-
"wc*": "allow";
|
|
59
|
-
"whereis*": "allow";
|
|
60
|
-
"which*": "allow";
|
|
61
|
-
"*": "ask";
|
|
62
|
-
};
|
|
63
|
-
webfetch: "allow";
|
|
64
|
-
};
|
|
@@ -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;
|