oh-my-opencode 2.14.0 → 3.0.0-beta.10
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 +173 -97
- package/README.md +247 -109
- package/README.zh-cn.md +708 -502
- 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 +19 -0
- package/dist/agents/momus.d.ts +6 -0
- package/dist/agents/momus.test.d.ts +1 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +20 -0
- package/dist/agents/prometheus-prompt.d.ts +29 -0
- package/dist/agents/prometheus-prompt.test.d.ts +1 -0
- package/dist/agents/sisyphus-junior.d.ts +8 -0
- package/dist/agents/sisyphus-junior.test.d.ts +1 -0
- package/dist/agents/types.d.ts +2 -1
- package/dist/agents/utils.d.ts +6 -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 +5394 -5052
- package/dist/cli/run/events.d.ts +1 -0
- package/dist/cli/types.d.ts +3 -0
- package/dist/config/schema.d.ts +756 -163
- package/dist/features/background-agent/concurrency.d.ts +17 -0
- package/dist/features/background-agent/manager.d.ts +53 -2
- package/dist/features/background-agent/types.d.ts +34 -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/claude-code-session-state/state.d.ts +6 -1
- package/dist/features/claude-code-session-state/state.test.d.ts +1 -0
- 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 +9 -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 +20 -0
- package/dist/features/opencode-skill-loader/skill-content.test.d.ts +1 -0
- package/dist/features/skill-mcp-manager/manager.d.ts +11 -0
- package/dist/features/task-toast-manager/index.d.ts +2 -0
- package/dist/features/task-toast-manager/manager.d.ts +57 -0
- package/dist/features/task-toast-manager/manager.test.d.ts +1 -0
- package/dist/features/task-toast-manager/types.d.ts +21 -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/checker.test.d.ts +1 -0
- package/dist/hooks/auto-update-checker/index.d.ts +4 -0
- package/dist/hooks/auto-update-checker/index.test.d.ts +1 -0
- package/dist/hooks/background-compaction/index.d.ts +19 -0
- package/dist/hooks/background-notification/index.d.ts +6 -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/comment-checker/cli.d.ts +0 -1
- package/dist/hooks/comment-checker/cli.test.d.ts +1 -0
- 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/delegate-task-retry/index.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/keyword-detector/index.d.ts +2 -1
- 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/ralph-loop/index.d.ts +1 -0
- package/dist/hooks/ralph-loop/types.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 +28035 -20876
- package/dist/mcp/context7.d.ts +1 -0
- package/dist/mcp/grep-app.d.ts +1 -0
- package/dist/mcp/index.d.ts +5 -2
- package/dist/mcp/websearch.d.ts +4 -0
- package/dist/plugin-config.test.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/external-plugin-detector.d.ts +18 -0
- package/dist/shared/external-plugin-detector.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 +7 -0
- package/dist/shared/migration.d.ts +7 -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/background-task/index.d.ts +1 -1
- package/dist/tools/call-omo-agent/constants.d.ts +1 -1
- package/dist/tools/delegate-task/constants.d.ts +12 -0
- package/dist/tools/delegate-task/index.d.ts +3 -0
- package/dist/tools/delegate-task/tools.d.ts +18 -0
- package/dist/tools/delegate-task/tools.test.d.ts +1 -0
- package/dist/tools/delegate-task/types.d.ts +9 -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/index.d.ts +3 -0
- 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 +22 -14
- package/postinstall.mjs +43 -0
- package/dist/agents/build-prompt.d.ts +0 -31
- package/dist/agents/plan-prompt.d.ts +0 -61
- package/dist/auth/antigravity/constants.d.ts +0 -36
- package/dist/auth/antigravity/fetch.d.ts +0 -68
- package/dist/auth/antigravity/index.d.ts +0 -13
- package/dist/auth/antigravity/message-converter.d.ts +0 -54
- package/dist/auth/antigravity/oauth.d.ts +0 -85
- 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 -104
- package/dist/auth/antigravity/response.d.ts +0 -137
- package/dist/auth/antigravity/thinking.d.ts +0 -234
- 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 -205
- 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/google-auth.d.ts +0 -3
- package/dist/google-auth.js +0 -1865
- 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/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "OpenCode
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
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,16 +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
65
|
"picocolors": "^1.1.1",
|
|
66
66
|
"picomatch": "^4.0.2",
|
|
67
|
-
"xdg-basedir": "^5.1.0",
|
|
68
67
|
"zod": "^4.1.8"
|
|
69
68
|
},
|
|
70
69
|
"devDependencies": {
|
|
@@ -73,6 +72,15 @@
|
|
|
73
72
|
"bun-types": "latest",
|
|
74
73
|
"typescript": "^5.7.3"
|
|
75
74
|
},
|
|
75
|
+
"optionalDependencies": {
|
|
76
|
+
"oh-my-opencode-darwin-arm64": "3.0.0-beta.10",
|
|
77
|
+
"oh-my-opencode-darwin-x64": "3.0.0-beta.10",
|
|
78
|
+
"oh-my-opencode-linux-arm64": "3.0.0-beta.10",
|
|
79
|
+
"oh-my-opencode-linux-arm64-musl": "3.0.0-beta.10",
|
|
80
|
+
"oh-my-opencode-linux-x64": "3.0.0-beta.10",
|
|
81
|
+
"oh-my-opencode-linux-x64-musl": "3.0.0-beta.10",
|
|
82
|
+
"oh-my-opencode-windows-x64": "3.0.0-beta.10"
|
|
83
|
+
},
|
|
76
84
|
"trustedDependencies": [
|
|
77
85
|
"@ast-grep/cli",
|
|
78
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,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode's default plan agent system prompt.
|
|
3
|
-
*
|
|
4
|
-
* This prompt enforces READ-ONLY mode for the plan agent, preventing any file
|
|
5
|
-
* modifications and ensuring the agent focuses solely on analysis and planning.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/sst/opencode/blob/db2abc1b2c144f63a205f668bd7267e00829d84a/packages/opencode/src/session/prompt/plan.txt
|
|
8
|
-
*/
|
|
9
|
-
export declare const PLAN_SYSTEM_PROMPT = "<system-reminder>\n# Plan Mode - System Reminder\n\nCRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY FORBIDDEN:\nANY file edits, modifications, or system changes. Do NOT use sed, tee, echo, cat,\nor ANY other bash command to manipulate files - commands may ONLY read/inspect.\nThis ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user\nedit requests. You may ONLY observe, analyze, and plan. Any modification attempt\nis a critical violation. ZERO exceptions.\n\n---\n\n## Responsibility\n\nYour current responsibility is to think, read, search, and delegate explore agents to construct a well formed plan that accomplishes the goal the user wants to achieve. Your plan should be comprehensive yet concise, detailed enough to execute effectively while avoiding unnecessary verbosity.\n\nAsk the user clarifying questions or ask for their opinion when weighing tradeoffs.\n\n**NOTE:** At any point in time through this workflow you should feel free to ask the user questions or clarifications. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins.\n\n---\n\n## Important\n\nThe user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received.\n</system-reminder>\n";
|
|
10
|
-
/**
|
|
11
|
-
* OpenCode's default plan agent permission configuration.
|
|
12
|
-
*
|
|
13
|
-
* Restricts the plan agent to read-only operations:
|
|
14
|
-
* - edit: "deny" - No file modifications allowed
|
|
15
|
-
* - bash: Only read-only commands (ls, grep, git log, etc.)
|
|
16
|
-
* - webfetch: "allow" - Can fetch web content for research
|
|
17
|
-
*
|
|
18
|
-
* @see https://github.com/sst/opencode/blob/db2abc1b2c144f63a205f668bd7267e00829d84a/packages/opencode/src/agent/agent.ts#L63-L107
|
|
19
|
-
*/
|
|
20
|
-
export declare const PLAN_PERMISSION: {
|
|
21
|
-
edit: "deny";
|
|
22
|
-
bash: {
|
|
23
|
-
"cut*": "allow";
|
|
24
|
-
"diff*": "allow";
|
|
25
|
-
"du*": "allow";
|
|
26
|
-
"file *": "allow";
|
|
27
|
-
"find * -delete*": "ask";
|
|
28
|
-
"find * -exec*": "ask";
|
|
29
|
-
"find * -fprint*": "ask";
|
|
30
|
-
"find * -fls*": "ask";
|
|
31
|
-
"find * -fprintf*": "ask";
|
|
32
|
-
"find * -ok*": "ask";
|
|
33
|
-
"find *": "allow";
|
|
34
|
-
"git diff*": "allow";
|
|
35
|
-
"git log*": "allow";
|
|
36
|
-
"git show*": "allow";
|
|
37
|
-
"git status*": "allow";
|
|
38
|
-
"git branch": "allow";
|
|
39
|
-
"git branch -v": "allow";
|
|
40
|
-
"grep*": "allow";
|
|
41
|
-
"head*": "allow";
|
|
42
|
-
"less*": "allow";
|
|
43
|
-
"ls*": "allow";
|
|
44
|
-
"more*": "allow";
|
|
45
|
-
"pwd*": "allow";
|
|
46
|
-
"rg*": "allow";
|
|
47
|
-
"sort --output=*": "ask";
|
|
48
|
-
"sort -o *": "ask";
|
|
49
|
-
"sort*": "allow";
|
|
50
|
-
"stat*": "allow";
|
|
51
|
-
"tail*": "allow";
|
|
52
|
-
"tree -o *": "ask";
|
|
53
|
-
"tree*": "allow";
|
|
54
|
-
"uniq*": "allow";
|
|
55
|
-
"wc*": "allow";
|
|
56
|
-
"whereis*": "allow";
|
|
57
|
-
"which*": "allow";
|
|
58
|
-
"*": "ask";
|
|
59
|
-
};
|
|
60
|
-
webfetch: "allow";
|
|
61
|
-
};
|
|
@@ -1,36 +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://autopush-cloudcode-pa.sandbox.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";
|
|
@@ -1,68 +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
|
-
/**
|
|
20
|
-
* Auth interface matching OpenCode's auth system
|
|
21
|
-
*/
|
|
22
|
-
interface Auth {
|
|
23
|
-
access?: string;
|
|
24
|
-
refresh?: string;
|
|
25
|
-
expires?: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Client interface for auth operations
|
|
29
|
-
*/
|
|
30
|
-
interface AuthClient {
|
|
31
|
-
set(providerId: string, auth: Auth): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Create Antigravity fetch interceptor
|
|
35
|
-
*
|
|
36
|
-
* Factory function that creates a custom fetch function for Antigravity API.
|
|
37
|
-
* Handles token management, request/response transformation, and endpoint fallback.
|
|
38
|
-
*
|
|
39
|
-
* @param getAuth - Async function to retrieve current auth state
|
|
40
|
-
* @param client - Auth client for saving updated tokens
|
|
41
|
-
* @param providerId - Provider identifier (e.g., "google")
|
|
42
|
-
* @param clientId - Optional custom client ID for token refresh (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
43
|
-
* @param clientSecret - Optional custom client secret for token refresh (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
44
|
-
* @returns Custom fetch function compatible with standard fetch signature
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* const customFetch = createAntigravityFetch(
|
|
49
|
-
* () => auth(),
|
|
50
|
-
* client,
|
|
51
|
-
* "google",
|
|
52
|
-
* "custom-client-id",
|
|
53
|
-
* "custom-client-secret"
|
|
54
|
-
* )
|
|
55
|
-
*
|
|
56
|
-
* // Use like standard fetch
|
|
57
|
-
* const response = await customFetch("https://api.example.com/chat", {
|
|
58
|
-
* method: "POST",
|
|
59
|
-
* body: JSON.stringify({ messages: [...] })
|
|
60
|
-
* })
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare function createAntigravityFetch(getAuth: () => Promise<Auth>, client: AuthClient, providerId: string, clientId?: string, clientSecret?: string): (url: string, init?: RequestInit) => Promise<Response>;
|
|
64
|
-
/**
|
|
65
|
-
* Type export for createAntigravityFetch return type
|
|
66
|
-
*/
|
|
67
|
-
export type AntigravityFetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
68
|
-
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,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,85 +0,0 @@
|
|
|
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
|
-
/**
|
|
24
|
-
* Result from building an OAuth authorization URL.
|
|
25
|
-
*/
|
|
26
|
-
export interface AuthorizationResult {
|
|
27
|
-
/** Full OAuth URL to open in browser */
|
|
28
|
-
url: string;
|
|
29
|
-
/** PKCE verifier to use during code exchange */
|
|
30
|
-
verifier: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Result from the OAuth callback server.
|
|
34
|
-
*/
|
|
35
|
-
export interface CallbackResult {
|
|
36
|
-
/** Authorization code from Google */
|
|
37
|
-
code: string;
|
|
38
|
-
/** State parameter from callback */
|
|
39
|
-
state: string;
|
|
40
|
-
/** Error message if any */
|
|
41
|
-
error?: string;
|
|
42
|
-
}
|
|
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
|
-
export declare function buildAuthURL(projectId?: string, clientId?: string, port?: number): Promise<AuthorizationResult>;
|
|
58
|
-
/**
|
|
59
|
-
* Exchange authorization code for tokens.
|
|
60
|
-
*
|
|
61
|
-
* @param code - Authorization code from OAuth callback
|
|
62
|
-
* @param verifier - PKCE verifier from initial auth request
|
|
63
|
-
* @param clientId - Optional custom client ID (defaults to ANTIGRAVITY_CLIENT_ID)
|
|
64
|
-
* @param clientSecret - Optional custom client secret (defaults to ANTIGRAVITY_CLIENT_SECRET)
|
|
65
|
-
* @returns Token exchange result with access and refresh tokens
|
|
66
|
-
*/
|
|
67
|
-
export declare function exchangeCode(code: string, verifier: string, clientId?: string, clientSecret?: string, port?: number): Promise<AntigravityTokenExchangeResult>;
|
|
68
|
-
/**
|
|
69
|
-
* Fetch user info from Google's userinfo API.
|
|
70
|
-
*
|
|
71
|
-
* @param accessToken - Valid access token
|
|
72
|
-
* @returns User info containing email
|
|
73
|
-
*/
|
|
74
|
-
export declare function fetchUserInfo(accessToken: string): Promise<AntigravityUserInfo>;
|
|
75
|
-
export interface CallbackServerHandle {
|
|
76
|
-
port: number;
|
|
77
|
-
waitForCallback: () => Promise<CallbackResult>;
|
|
78
|
-
close: () => void;
|
|
79
|
-
}
|
|
80
|
-
export declare function startCallbackServer(timeoutMs?: number): CallbackServerHandle;
|
|
81
|
-
export declare function performOAuthFlow(projectId?: string, openBrowser?: (url: string) => Promise<void>, clientId?: string, clientSecret?: string): Promise<{
|
|
82
|
-
tokens: AntigravityTokenExchangeResult;
|
|
83
|
-
userInfo: AntigravityUserInfo;
|
|
84
|
-
verifier: string;
|
|
85
|
-
}>;
|
|
@@ -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;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Antigravity request transformer.
|
|
3
|
-
* Transforms OpenAI-format requests to Antigravity format.
|
|
4
|
-
* Does NOT handle tool normalization (handled by tools.ts in Task 9).
|
|
5
|
-
*/
|
|
6
|
-
import type { AntigravityRequestBody } from "./types";
|
|
7
|
-
/**
|
|
8
|
-
* Result of request transformation including URL, headers, and body.
|
|
9
|
-
*/
|
|
10
|
-
export interface TransformedRequest {
|
|
11
|
-
/** Transformed URL for Antigravity API */
|
|
12
|
-
url: string;
|
|
13
|
-
/** Request headers including Authorization and Antigravity-specific headers */
|
|
14
|
-
headers: Record<string, string>;
|
|
15
|
-
/** Transformed request body in Antigravity format */
|
|
16
|
-
body: AntigravityRequestBody;
|
|
17
|
-
/** Whether this is a streaming request */
|
|
18
|
-
streaming: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Build Antigravity-specific request headers.
|
|
22
|
-
* Includes Authorization, User-Agent, X-Goog-Api-Client, and Client-Metadata.
|
|
23
|
-
*
|
|
24
|
-
* @param accessToken - OAuth access token for Authorization header
|
|
25
|
-
* @returns Headers object with all required Antigravity headers
|
|
26
|
-
*/
|
|
27
|
-
export declare function buildRequestHeaders(accessToken: string): Record<string, string>;
|
|
28
|
-
/**
|
|
29
|
-
* Extract model name from request body.
|
|
30
|
-
* OpenAI-format requests include model in the body.
|
|
31
|
-
*
|
|
32
|
-
* @param body - Request body that may contain a model field
|
|
33
|
-
* @returns Model name or undefined if not found
|
|
34
|
-
*/
|
|
35
|
-
export declare function extractModelFromBody(body: Record<string, unknown>): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Extract model name from URL path.
|
|
38
|
-
* Handles Google Generative Language API format: /models/{model}:{action}
|
|
39
|
-
*
|
|
40
|
-
* @param url - Request URL to parse
|
|
41
|
-
* @returns Model name or undefined if not found
|
|
42
|
-
*/
|
|
43
|
-
export declare function extractModelFromUrl(url: string): string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Determine the action type from the URL path.
|
|
46
|
-
* E.g., generateContent, streamGenerateContent
|
|
47
|
-
*
|
|
48
|
-
* @param url - Request URL to parse
|
|
49
|
-
* @returns Action name or undefined if not found
|
|
50
|
-
*/
|
|
51
|
-
export declare function extractActionFromUrl(url: string): string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Check if a URL is targeting Google's Generative Language API.
|
|
54
|
-
*
|
|
55
|
-
* @param url - URL to check
|
|
56
|
-
* @returns true if this is a Google Generative Language API request
|
|
57
|
-
*/
|
|
58
|
-
export declare function isGenerativeLanguageRequest(url: string): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Build Antigravity API URL for the given action.
|
|
61
|
-
*
|
|
62
|
-
* @param baseEndpoint - Base Antigravity endpoint URL (from fallbacks)
|
|
63
|
-
* @param action - API action (e.g., generateContent, streamGenerateContent)
|
|
64
|
-
* @param streaming - Whether to append SSE query parameter
|
|
65
|
-
* @returns Formatted Antigravity API URL
|
|
66
|
-
*/
|
|
67
|
-
export declare function buildAntigravityUrl(baseEndpoint: string, action: string, streaming: boolean): string;
|
|
68
|
-
/**
|
|
69
|
-
* Get the first available Antigravity endpoint.
|
|
70
|
-
* Can be used with fallback logic in fetch.ts.
|
|
71
|
-
*
|
|
72
|
-
* @returns Default (first) Antigravity endpoint
|
|
73
|
-
*/
|
|
74
|
-
export declare function getDefaultEndpoint(): string;
|
|
75
|
-
export declare function wrapRequestBody(body: Record<string, unknown>, projectId: string, modelName: string, sessionId: string): AntigravityRequestBody;
|
|
76
|
-
export declare function injectThoughtSignatureIntoFunctionCalls(body: Record<string, unknown>, signature: string | undefined): Record<string, unknown>;
|
|
77
|
-
/**
|
|
78
|
-
* Detect if request is for streaming.
|
|
79
|
-
* Checks both action name and request body for stream flag.
|
|
80
|
-
*
|
|
81
|
-
* @param url - Request URL
|
|
82
|
-
* @param body - Request body
|
|
83
|
-
* @returns true if streaming is requested
|
|
84
|
-
*/
|
|
85
|
-
export declare function isStreamingRequest(url: string, body: Record<string, unknown>): boolean;
|
|
86
|
-
export interface TransformRequestOptions {
|
|
87
|
-
url: string;
|
|
88
|
-
body: Record<string, unknown>;
|
|
89
|
-
accessToken: string;
|
|
90
|
-
projectId: string;
|
|
91
|
-
sessionId: string;
|
|
92
|
-
modelName?: string;
|
|
93
|
-
endpointOverride?: string;
|
|
94
|
-
thoughtSignature?: string;
|
|
95
|
-
}
|
|
96
|
-
export declare function transformRequest(options: TransformRequestOptions): TransformedRequest;
|
|
97
|
-
/**
|
|
98
|
-
* Prepare request headers for streaming responses.
|
|
99
|
-
* Adds Accept header for SSE format.
|
|
100
|
-
*
|
|
101
|
-
* @param headers - Existing headers object
|
|
102
|
-
* @returns Headers with streaming support
|
|
103
|
-
*/
|
|
104
|
-
export declare function addStreamingHeaders(headers: Record<string, string>): Record<string, string>;
|