Files
OmniRoute/open-sse/config/agyModels.ts
Bob.Hou 43eb470790 fix(models): update Anthropic model contextLength to 1M (#7129)
* chore(ci): add .mergify.yml to main — Mergify only reads config from the default branch (#7168)

* fix(ci): add the auto-enqueue pull_request_rule to the Mergify config (queue_conditions alone are eligibility-only) (#7179)

* fix(ci): migrate Mergify auto-enqueue to merge_protections_settings.auto_merge_conditions (rules-based path is EOL 2026-07-16) (#7216)

* fix(ci): drop Mergify batch settings (batching is a paid-tier feature; free plan queue is serial) (#7220)

* fix(ci): merge queue tolerates the advisory dast-smoke failure (its GH-hosted build hang dequeued every attempt) (#7225)

* test(ci): make the #6634 selfref guard hermetic — main's copy hard-fails every PR (#7341)

main's copy of this test still does git I/O inside a unit test:

    const baseSrc = git(['show', 'origin/main:' + FILE]);

Runners check out a shallow single ref, so origin/main does not resolve and the
test dies with 'fatal: invalid object name origin/main'. Every PR into main
fails Unit Tests (7/8) on it — today that is #7313, #7315, #7316, #7334, #7336
and #7337, six PRs red on a defect none of them introduced. #7313 has no other
red at all.

release/v3.8.49 already carries a fix (2e42b8efc, #7174: try/catch, fetch
origin/main on demand, t.skip() when unreachable), but it only reaches main at
release time — so main stays broken for the whole cycle. Cherry-picking it would
also import a new problem: PR Test Policy classifies t.skip() as a silenced
assertion, which we watched it correctly catch on #7300 today.

This is the hermetic version instead (ported from #7327, which does the same for
the release branch): read the file straight off disk, compare against an empty
base so baseTaut/baseExtTaut are 0 — the strictest possible comparison point —
and call evaluateMasking() directly. No git ref, no fetch, no skip, nothing the
runner's checkout depth can break.

The #6634 regression stays covered: the guard's logic lives in
SELF_TEST_FIXTURE_RE (check-test-masking.mjs:337), not in the test. Proven both
ways on main before committing — neutralise SELF_TEST_FIXTURE_RE to /$^/ and
the test FAILS; restore it and it passes 2/2, with check-test-masking.mjs left
byte-identical.

Co-authored-by: growab <nekron@icloud.com>

* chore(quality): tighten main's coverage baseline to the CI's real numbers (#7347)

main's ratchet had been failing --require-tighten on every PR: 11 metrics
improved but the baseline was never tightened. Same class as the #6634
selfref guard — an infra fix that lands only on the release branch leaves
main red for the whole cycle, and every PR into main pays for it.

Values are the merged-coverage numbers from a run on main itself (a local
run measures ~68% vs CI's ~80%; the baseline's own note warns about that
gap). Only the 11 coverage values change — gitleaks and semgrepFindings
keep main's own state.

No changelog fragment: #7326 carries it on release/v3.8.49, and a second
one here would double the entry at release time.

* fix(models): update Anthropic model contextLength to 1M

Opus 4.6, Sonnet 4.6, and Sonnet 5 all have 1M context
window since GA (2026-03-13). Update:

- agyModels + antigravityModelAliases: 200000 -> 1048576 (binary 1M, matches existing convention in those files)
- claude registry: 200000 -> 1000000 (decimal 1M, matches other entries in that file)

Older models (opus-4-5, sonnet-4-5, haiku-4-5) and defaultContextLength: 200000 left untouched.

Signed-off-by: Minxi Hou <houminxi@gmail.com>

* fix(claude): add sonnet-4-6 to CONTEXT_1M_SUPPORTED_MODELS

Sonnet 4.6 has 1M context GA since 2026-02-17. Without this entry, the CC-compatible wire image omits the context-1m beta header for Sonnet 4.6 requests, causing large-context requests to be rejected by Anthropic.

* test: regression test for CONTEXT_1M_SUPPORTED_MODELS allowlist

Verify that every Claude model with contextLength > 200K has a
matching entry in the beta header allowlist, and vice versa.
Parses source files directly (no module imports needed).

Signed-off-by: Minxi Hou <houminxi@gmail.com>

* test: improve regression test with empty-registry guard

Add sanity check that parser finds at least one model. Handle type annotations in CONTEXT_1M_SUPPORTED_MODELS assignment. Remove weaker subagent test.

Signed-off-by: Minxi Hou <houminxi@gmail.com>

* test: update stale contextLength expectations for the 1M Sonnet/Opus 4.6 fix

Three pre-existing tests hardcoded the old 200000 contextLength for
claude-opus-4-6-thinking / claude-sonnet-4-6 / claude-sonnet-5, which this
PR's own registry change (agyModels.ts, antigravityModelAliases.ts, claude
registry) legitimately bumped to 1M GA:

- antigravity-model-aliases.test.ts: deepEqual assertions for
  claude-opus-4-6-thinking and claude-sonnet-5 in the Antigravity catalog
  expected contextLength: 200000; now 1048576. Added an explicit contextLength
  assertion for claude-sonnet-4-6 too.
- auto-combo-context-advertising.test.ts: resolveComboContextLimit regression
  test asserted the claude target's own limit as 200000; the test's intent
  (own limit wins over an 8k sibling, not compressed) is unchanged, only the
  registry's current correct value (1000000) needed updating. Also refreshed
  a stale comment in the MAX-of-candidates test (functionally unaffected,
  since gemini's 1048576 already wins either way).
- models-catalog-route.test.ts: refreshed a stale inline comment (the actual
  assertion checks the MIN across combo targets, 128000, unaffected by the
  1M bump).

Verified via Anthropic's own docs (platform.claude.com/docs/en/build-with-claude/context-windows):
"Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 5, and
Claude Sonnet 4.6 have a 1M-token context window ... on the Claude API,
Amazon Bedrock, Google Cloud, and Microsoft Foundry" -- matches this PR's
claimed 2026-03-13 GA date exactly, and Google Cloud coverage corroborates
the Antigravity-hosted ids. Independently corroborated for the
Antigravity-specific path by unrelated third-party projects fixing the same
gap (earendil-works/pi#2209, badlogic/pi-mono#2194).

Swept the full test suite for other contextLength/contextWindow assertions
against these three model ids (grep + targeted runs across
models-catalog-route, model-capabilities-registry, t31-t33-t34-t38-model-specs,
executor-antigravity, agy-provider, provider-models-config,
model-metadata-registry, claude-web-sonnet5-registry, combo-routing-engine,
command-code-executor, combo-lockout-quota-reset -- 157 tests green); the
Bedrock-hosted registry and modelSpecs.ts module were already correctly at
1000000 for these models, reinforcing this PR's direction.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: growab <nekron@icloud.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
2026-07-18 15:13:57 -03:00

158 lines
4.4 KiB
TypeScript

// Antigravity CLI (`agy`) model catalog.
//
// These models are pinned from the live `:fetchAvailableModels` endpoint
// (https://daily-cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels) using a
// real `agy` consumer-OAuth token. The public catalog exposes the same clean Gemini
// 3.5 Flash tier names as the Antigravity IDE provider; the shared Antigravity executor
// maps those names to the legacy upstream IDs immediately before dispatch.
//
// The `agy` provider reuses the `antigravity` executor/translator (identical backend),
// but ships its OWN catalog so it can expose models the `antigravity` provider's static
// list omits — notably the Claude models (`claude-opus-4-6-thinking`, `claude-sonnet-4-6`),
// which `:fetchAvailableModels` reports as user-callable with quota even though the
// `antigravity` catalog comment assumes they 404. Tab-completion models
// (`tab_flash_lite_preview`, `tab_jump_flash_lite_preview`) are intentionally excluded —
// they are not chat-callable.
export const AGY_PUBLIC_MODELS = Object.freeze([
// Claude (Antigravity backend) — the headline differentiator for this provider.
{
id: "claude-opus-4-6-thinking",
name: "Claude Opus 4.6 (Thinking)",
contextLength: 1048576,
maxOutputTokens: 65536,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "claude-sonnet-4-6",
name: "Claude Sonnet 4.6 (Thinking)",
contextLength: 1048576,
maxOutputTokens: 65536,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
// Gemini 3.x
{
id: "gemini-3.1-pro-high",
name: "Gemini 3.1 Pro (High)",
contextLength: 1048576,
maxOutputTokens: 65535,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-3.1-pro-low",
name: "Gemini 3.1 Pro (Low)",
contextLength: 1048576,
maxOutputTokens: 65535,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-pro-agent",
name: "Gemini 3.1 Pro (Agent)",
contextLength: 1048576,
maxOutputTokens: 65535,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-3.5-flash-low",
name: "Gemini 3.5 Flash (Low)",
contextLength: 1048576,
maxOutputTokens: 65536,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-3.5-flash-medium",
name: "Gemini 3.5 Flash (Medium)",
contextLength: 1048576,
maxOutputTokens: 65536,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-3.5-flash-high",
name: "Gemini 3.5 Flash (High)",
contextLength: 1048576,
maxOutputTokens: 65536,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-3.1-flash-lite",
name: "Gemini 3.1 Flash Lite",
contextLength: 1048576,
maxOutputTokens: 65535,
toolCalling: true,
},
{ id: "gemini-3.1-flash-image", name: "Gemini 3.1 Flash Image" },
// Gemini 2.5
{
id: "gemini-2.5-pro",
name: "Gemini 2.5 Pro",
contextLength: 1048576,
maxOutputTokens: 65535,
supportsReasoning: true,
supportsVision: true,
toolCalling: true,
},
{
id: "gemini-2.5-flash",
name: "Gemini 2.5 Flash",
contextLength: 1048576,
maxOutputTokens: 65535,
toolCalling: true,
},
{
id: "gemini-2.5-flash-thinking",
name: "Gemini 2.5 Flash Thinking",
contextLength: 1048576,
maxOutputTokens: 65535,
supportsReasoning: true,
toolCalling: true,
},
{
id: "gemini-2.5-flash-lite",
name: "Gemini 2.5 Flash Lite",
contextLength: 1048576,
maxOutputTokens: 65535,
toolCalling: true,
},
// GPT-OSS
{
id: "gpt-oss-120b-medium",
name: "GPT-OSS 120B (Medium)",
contextLength: 131072,
maxOutputTokens: 32768,
supportsReasoning: true,
toolCalling: true,
},
]);
const AGY_PUBLIC_MODEL_IDS = new Set(AGY_PUBLIC_MODELS.map((model) => model.id));
const AGY_CLIENT_VISIBLE_MODEL_NAMES = Object.freeze(
AGY_PUBLIC_MODELS.reduce<Record<string, string>>((acc, model) => {
acc[model.id] = model.name;
return acc;
}, {})
);
export function getClientVisibleAgyModelName(modelId: string, fallbackName?: string): string {
return AGY_CLIENT_VISIBLE_MODEL_NAMES[modelId] || fallbackName || modelId;
}
export function isUserCallableAgyModelId(modelId: string): boolean {
return !!modelId && AGY_PUBLIC_MODEL_IDS.has(modelId);
}