Repository navigation
fix: OpenCode v2 compatibility (directory fallback, TTY guard, unref timers, and export schema) - #1
Open
markusbrand wants to merge 1 commit into
Open
markusbrand wants to merge 1 commit into
markusbrand wants to merge 1 commit into
Conversation
…timers, and export schema)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR addresses several breaking changes and compatibility issues encountered when using
@zeklop/opencode-antigravity-authwith OpenCode v2 (e.g.v2.0.12+):Default Export Schema for OpenCode v2 (
index.ts):{ id: string, setup: Function }.id: "antigravity-auth"and delegating toAntigravityCLIOAuthPlugin.Handle Optional / Undefined
directory(src/plugin.ts,src/plugin/config/loader.ts):opencode run --standalonepassesdirectoryasundefinedwhen running outside an explicit workspace.getProjectConfigPathpreviously calledjoin(undefined, ...)which causedTypeError [ERR_INVALID_ARG_TYPE].process.cwd()and guardsgetProjectConfigPath.Guard Interactive CLI Prompts in Non-TTY Environments (
src/plugin.ts):stdinandstdoutare not TTYs.if (inputs)inauthorize()withprocess.stdout?.isTTY && process.stdin?.isTTYto prevent background processes from hanging indefinitely onreadlineterminal menus.Call
.unref()on Background Timers (src/plugin/cache/signature-cache.ts,src/plugin/refresh-queue.ts,src/hooks/auto-update-checker/index.ts):setIntervalhandles kept Node.js event loops alive indefinitely, causing one-shot CLI commands likeopencode run "..."to hang after printing the model response..unref()on background intervals and timers so processes exit cleanly when execution finishes.Fix Recursion in Fallback Fetch (
src/plugin.ts,src/plugin/request.ts):isGenerativeLanguageRequestto support string,URL, andRequestobjects.provider?.fetch ?? globalThis.fetchto prevent recursive intercept loops when non-Antigravity requests are made.Testing
npm test): 41 test files passed, 1029 tests passing.npm run build: builds cleanly without errors.