fix(antigravity): use loadCodeAssist project ID and add OpenAI message conversion

- Add message-converter.ts for OpenAI messages to Gemini contents conversion
- Use SKIP_THOUGHT_SIGNATURE_VALIDATOR as default signature (CLIProxyAPI approach)
- Restore loadCodeAssist API call to get user's actual project ID
- Improve debug logging for troubleshooting
- Fix tool normalization edge cases

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-13 04:24:24 +09:00
parent 7fe85a11da
commit abd90bbc9c
7 changed files with 264 additions and 35 deletions

View File

@@ -96,34 +96,31 @@ export function normalizeToolsForGemini(
const functionDeclarations: GeminiFunctionDeclaration[] = []
for (const tool of tools) {
// Handle function type tools
if (tool.type === "function" && tool.function) {
if (!tool || typeof tool !== "object") {
continue
}
const toolType = tool.type ?? "function"
if (toolType === "function" && tool.function) {
const declaration: GeminiFunctionDeclaration = {
name: tool.function.name,
}
// Include description if present
if (tool.function.description) {
declaration.description = tool.function.description
}
// Include parameters if present, default to empty object schema
if (tool.function.parameters) {
declaration.parameters = tool.function.parameters
} else {
// Gemini requires parameters field, use empty object as default
declaration.parameters = { type: "object", properties: {} }
}
functionDeclarations.push(declaration)
} else {
// Log warning for unsupported tool types (debug only)
if (process.env.ANTIGRAVITY_DEBUG === "1") {
console.warn(
`[antigravity-tools] Unsupported tool type: "${tool.type}". ` +
`Only "function" type tools are supported for Gemini. Tool will be skipped.`
)
}
} else if (toolType !== "function" && process.env.ANTIGRAVITY_DEBUG === "1") {
console.warn(
`[antigravity-tools] Unsupported tool type: "${toolType}". Tool will be skipped.`
)
}
}