Repository navigation
Conversation
- Removed STATIC_MODELS_SIMPLE and TIER_MAPPING hardcoded lists - Added dynamic model inference from AGY quota API (retrieveUserQuota) - Models are now discovered at runtime based on user's actual AGY access - Updated tier.ts with inferModelMetadata, extractBaseModelId, buildTierMapping, fetchAvailableModelIds - Updated plugin.ts to use dynamic catalog via buildDynamicModelCatalog - Updated v2.ts to use dynamic catalog at startup - Tests updated to verify dynamic behavior instead of hardcoded models
- Remove STATIC_MODELS_SIMPLE and TIER_MAPPING hardcoded lists - Discover models live from AGY quota API (retrieveUserQuota) - Infer model metadata (name, limits, capabilities) from model ID patterns - Config hook populates models at startup without touching client (avoids re-entrant config.get deadlock); NOOP auth client + 25s cap so a stalled network can never hang server startup - Resolve projectId via refresh-token parts, config, env, then AGY API (resolveProjectContextFromAccessToken) as last resort - v2 setup registers dynamic models via provider/model/catalog transforms using the connection API - provider.models hook merges dynamic catalog with user overrides, applies models.dev pricing, normalizes costs; login-required fallback - Verified: opencode models lists live AGY inventory (4.6, gemini-3.8, gpt-oss-120b, etc.), zero 5.5 entries; nvidia-labs unaffected - Remove accidentally committed npm tarball
…percase acronym, no hardcoded list)
…static catalog Fork identity + fully dynamic model catalog. - package renamed @anthonyhaussman/opencode-agy-auth -> @kpihx-labs/opencode-agy-auth (1.6.0-kpihx.1) so a stray npm spec can never be installed alongside the local file:// fork and silently override the provider model list with upstream statics (root cause 2026-11-17). - removed the bundled models.json catalog and its importer (src/sdk/request/prepare.ts); getModelEnum no longer reads a hardcoded model map. - emptied REQUEST_MODEL_FALLBACKS (src/sdk/request/shared.ts). - tier/v2 metadata derived structurally from model IDs (no claude-/gpt-/gemini- names). - models are discovered live from the AGY quota API (retrieveUserQuota). Runtime verified: no claude-*-5-5, no ToS warning, 4.6 line-up exposed dynamically.
…tics - Multi-account storage with plugin-owned file (agy-accounts.json) immune to OpenCode clobbering - Namespaced models: google-agy/<account>/<model> for per-account quota isolation - Dynamic model_enum fetching via fetchAvailableModels (no more stale catalog) - Project resolution prefers API-discovered project over stale refresh-token project - Exhaustion tracking + 30-min TTL + automatic failover on 429 - Stub accounts (needsCredentials) replace credential cloning - importAccountFromProvider / importAccountFromJson / describeAccounts diagnostics - Fix: projectId resolution prefers backend-discovered project over stale refresh-token project - enumLabel: omits model_enum when unknown (avoids M16 placeholder) - Model enums fetched from live catalogue per account/project with 10-min TTL - URL rewrite handles both /models/ and /v1beta/ paths - seedAccountFromActive creates stubs (needsCredentials) instead of cloning credentials - Storage survives OpenCode clobbering via plugin-owned agy-accounts.json - IdentifyAccounts() diagnostic for duplicate-email detection - importAccountFromProvider/Json for safe credential import - Purged redundant demar (duplicate of kpihx) and activeAccount pointer - Version bump to 1.6.0-kpihx.2
- Replace dual V1/V2 plugin with v2-clean.ts: options.ids drives N provider IDs (agy, agy-labs), each with one OAuth method; credentials stored by OpenCode. - Remove multi-account store, account/model namespacing, failover, plugin-owned secrets. - Dynamic catalog loaded before synchronous transforms, replayed on credential.updated. - Reuse proven SDK helpers for request shaping, tier variants and enum mapping. - Archive legacy V1/V2 dual-architecture tests under test/legacy/ (audit, excluded). - Fix stale test expectations aligned with intentional dynamic-catalog design.
…rite - connection.resolve() returns the stored (stale) access token and does not drive OAuth refresh because the provider declares a dummy apiKey. Refresh expired tokens in resolveCredential via the shared dedup/cache helper. - Replace dead aisdk.hook with real session http.request/http.response hooks that rewrite generative-language calls to the Antigravity internal endpoint with a Bearer token, and transform streaming responses. - Dynamic model catalog from live quota (20 models for AGY account). - Update index-export test to assert no aisdk.hook + session hook registration. Result: 401 'API key not valid' -> genuine Google 429 (quota), 392/392 tests.
Root cause of the false 'Resource has been exhausted' 429 on a full-quota account was in the request shaping, NOT the account/auth/quota: - prepareAgyRequest derived a display-variant model id (gemini-3.8-flash-medium) rejected by the backend with 404/429. Force the wrapped body's model to the canonical bucket id (gemini-3.8-flash-tiered). Recognize -tiered as a tier suffix and strip inline tier suffixes when resolving. - OpenCode injects the entire AGENTS.md kernel (~90k chars) into systemInstruction; the backend rejects >~12k chars with a misleading 429. Relocate the full text into a leading user content part (lossless), keeping a short systemInstruction. Verified: <=12000->200, >=16000->429. Verified end-to-end: opencode run -m agy/gemini-3.8-flash exits 0 with a real answer, zero 429. 392/392 tests, typecheck + build clean.
- DEFAULT_IDS, options guidance and tests now use ['agy','agy-x']. - Kernel opencode.jsonc options.ids updated to ['agy','agy-x'] (live config). - agy-x starts as login-required until its own OAuth account is added.
- DEFAULT_IDS back to ['agy'] only; no personal provider ids, emails or project ids baked into the published plugin (tests use neutral ids). - Restore agent-callable agy_quota / agy_quota_summary tools and /agy-quota, /agy-quota-summary commands (per configured id), using the existing quota factories with an OpenCode-owned credential resolver. - Earlier fix retained: canonical bucket model id + lossless AGENTS.md relocation (root cause of the false 429 on a full-quota account). 392/392 tests, typecheck + build clean. Quota tools verified live for both configured accounts.
…account # Conflicts: # CHANGELOG.md # package-lock.json # package.json # src/plugin.ts # src/plugin/v2.ts
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.
This PR makes the opencode-agy-auth plugin fully dynamic by removing all hardcoded model lists.
Changes
How it works
Verification
This ensures the plugin always shows exactly the models the user has access to in their AGY account, not a stale hardcoded list.