@herbertgao/pi-extensions 2026.9.2 → 2026.9.4
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.md +4 -2
- package/THIRD_PARTY_NOTICES.md +49 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +16 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-renderer.ts +20 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +12 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +98 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/sol-pi/LICENSE +19 -0
- package/node_modules/@herbertgao/sol-pi/README.md +159 -0
- package/node_modules/@herbertgao/sol-pi/SECURITY.md +26 -0
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +19 -0
- package/node_modules/@herbertgao/sol-pi/agents-install.md +150 -0
- package/node_modules/@herbertgao/sol-pi/assets/sol-pi-hero.png +0 -0
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +69 -0
- package/node_modules/@herbertgao/sol-pi/docs/configuration.md +75 -0
- package/node_modules/@herbertgao/sol-pi/package.json +76 -0
- package/node_modules/@herbertgao/sol-pi/scripts/check-pi-compat.mjs +32 -0
- package/node_modules/@herbertgao/sol-pi/scripts/check-sol-pi-config.mjs +120 -0
- package/node_modules/@herbertgao/sol-pi/sol-pi.example.json +10 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/config.ts +135 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/file-queue.ts +74 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +185 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +128 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/archive.ts +53 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/candidate.ts +101 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/config.ts +71 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/index.ts +220 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/journal.ts +25 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/provider.ts +164 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/evidence-preserving-reducer/receipt.ts +177 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/index.ts +227 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/ledger.ts +20 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/observation.ts +252 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/economics.ts +237 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +455 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/index.ts +49 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/plan.ts +79 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/state.ts +208 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +100 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/index.ts +42 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/runtime-paths.ts +17 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/tui.ts +71 -0
- package/node_modules/@narumitw/pi-btw/dist/index.ts +12 -2
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +2 -2
- package/node_modules/@narumitw/pi-btw/package.json +1 -1
- package/node_modules/@narumitw/pi-btw/src/btw.ts +13 -2
- package/node_modules/pi-antigravity/LICENSE +21 -0
- package/node_modules/pi-antigravity/README.md +194 -0
- package/node_modules/pi-antigravity/package.json +67 -0
- package/node_modules/pi-antigravity/src/auth/index.ts +14 -0
- package/node_modules/pi-antigravity/src/auth/oauth.ts +442 -0
- package/node_modules/pi-antigravity/src/client/client.ts +561 -0
- package/node_modules/pi-antigravity/src/client/index.ts +1 -0
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +96 -0
- package/node_modules/pi-antigravity/src/diagnostics/index.ts +1 -0
- package/node_modules/pi-antigravity/src/image/image.ts +336 -0
- package/node_modules/pi-antigravity/src/image/index.ts +1 -0
- package/node_modules/pi-antigravity/src/index.ts +280 -0
- package/node_modules/pi-antigravity/src/models/discovery.ts +154 -0
- package/node_modules/pi-antigravity/src/models/grouping.ts +424 -0
- package/node_modules/pi-antigravity/src/models/index.ts +3 -0
- package/node_modules/pi-antigravity/src/models/models.ts +500 -0
- package/node_modules/pi-antigravity/src/stream/index.ts +1 -0
- package/node_modules/pi-antigravity/src/stream/stream.ts +1460 -0
- package/node_modules/pi-antigravity/src/types/enums.ts +42 -0
- package/node_modules/pi-antigravity/src/types/index.ts +2 -0
- package/node_modules/pi-antigravity/src/types/types.ts +292 -0
- package/node_modules/pi-antigravity/src/usage/index.ts +1 -0
- package/node_modules/pi-antigravity/src/usage/usage.ts +371 -0
- package/node_modules/pi-antigravity/src/utils/http.ts +91 -0
- package/node_modules/pi-antigravity/src/utils/index.ts +3 -0
- package/node_modules/pi-antigravity/src/utils/security.ts +73 -0
- package/node_modules/pi-antigravity/src/utils/util.ts +132 -0
- package/node_modules/pi-antigravity/tsconfig.json +21 -0
- package/node_modules/pi-lens/CHANGELOG.md +176 -0
- package/node_modules/pi-lens/README.md +13 -8
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +3 -1
- package/node_modules/pi-lens/dist/clients/analysed-root.js +1 -0
- package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +1 -1
- package/node_modules/pi-lens/dist/clients/biome-client.js +13 -2
- package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +2 -0
- package/node_modules/pi-lens/dist/clients/cache-observability.js +122 -1
- package/node_modules/pi-lens/dist/clients/complexity-client.js +5 -0
- package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +2 -0
- package/node_modules/pi-lens/dist/clients/config-resolve.js +6 -3
- package/node_modules/pi-lens/dist/clients/config-schema.js +17 -0
- package/node_modules/pi-lens/dist/clients/config-warn.js +2 -2
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +8 -1
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +38 -15
- package/node_modules/pi-lens/dist/clients/dispatch/facts/function-facts.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/import-facts.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +2 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +4 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +19 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +3 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +12 -12
- package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +2 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +12 -11
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +2 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +3 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +3 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +5 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +2 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +8 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +4 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +2 -1
- package/node_modules/pi-lens/dist/clients/effective-config.js +12 -2
- package/node_modules/pi-lens/dist/clients/extension-log.js +2 -0
- package/node_modules/pi-lens/dist/clients/file-role.js +18 -1
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +4 -0
- package/node_modules/pi-lens/dist/clients/formatters.js +54 -188
- package/node_modules/pi-lens/dist/clients/generation-guard.js +4 -0
- package/node_modules/pi-lens/dist/clients/gitleaks-client.js +42 -6
- package/node_modules/pi-lens/dist/clients/govulncheck-client.js +48 -7
- package/node_modules/pi-lens/dist/clients/installer/index.js +196 -52
- package/node_modules/pi-lens/dist/clients/jscpd-client.js +9 -1
- package/node_modules/pi-lens/dist/clients/knip-client.js +9 -2
- package/node_modules/pi-lens/dist/clients/language-profile.js +12 -2
- package/node_modules/pi-lens/dist/clients/latency-logger.js +2 -0
- package/node_modules/pi-lens/dist/clients/lens-config.js +4 -0
- package/node_modules/pi-lens/dist/clients/lsp/config.js +36 -7
- package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +24 -1
- package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +78 -0
- package/node_modules/pi-lens/dist/clients/lsp/index.js +281 -45
- package/node_modules/pi-lens/dist/clients/lsp/server.js +62 -15
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +37 -4
- package/node_modules/pi-lens/dist/clients/mcp/analyze.js +3 -0
- package/node_modules/pi-lens/dist/clients/mcp/session.js +2 -0
- package/node_modules/pi-lens/dist/clients/opengrep-client.js +2 -0
- package/node_modules/pi-lens/dist/clients/package-manager.js +2 -1
- package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +8 -3
- package/node_modules/pi-lens/dist/clients/pipeline.js +3 -2
- package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +38 -10
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +10 -9
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +3 -0
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +2 -0
- package/node_modules/pi-lens/dist/clients/review-graph-logger.js +2 -0
- package/node_modules/pi-lens/dist/clients/ruff-client.js +18 -9
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +9 -0
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +5 -0
- package/node_modules/pi-lens/dist/clients/runtime-session.js +13 -4
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +4 -1
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +48 -1
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +2 -2
- package/node_modules/pi-lens/dist/clients/session-event-guard.js +69 -1
- package/node_modules/pi-lens/dist/clients/sg-runner.js +2 -1
- package/node_modules/pi-lens/dist/clients/situational-tool-telemetry.js +108 -0
- package/node_modules/pi-lens/dist/clients/test-runner-client.js +291 -76
- package/node_modules/pi-lens/dist/clients/tool-config.js +199 -0
- package/node_modules/pi-lens/dist/clients/tool-cwd.js +299 -0
- package/node_modules/pi-lens/dist/clients/tool-probe.js +53 -0
- package/node_modules/pi-lens/dist/clients/tool-set-policy.js +42 -0
- package/node_modules/pi-lens/dist/clients/trivy-client.js +9 -1
- package/node_modules/pi-lens/dist/clients/turn-context.js +52 -0
- package/node_modules/pi-lens/dist/clients/widget-state.js +4 -3
- package/node_modules/pi-lens/dist/index.js +21969 -20005
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +3 -2
- package/node_modules/pi-lens/dist/mcp/server.js +135 -159
- package/node_modules/pi-lens/dist/tools/activate-tools.js +10 -7
- package/node_modules/pi-lens/dist/tools/ast-grep-outline.js +2 -13
- package/node_modules/pi-lens/dist/tools/ast-grep-replace.js +8 -13
- package/node_modules/pi-lens/dist/tools/ast-grep-search.js +83 -39
- package/node_modules/pi-lens/dist/tools/effective-config.js +4 -3
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +1 -10
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +353 -85
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +21 -110
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +20 -44
- package/node_modules/pi-lens/dist/tools/module-report.js +5 -9
- package/node_modules/pi-lens/dist/tools/project-report.js +9 -17
- package/node_modules/pi-lens/dist/tools/render-compact.js +280 -1
- package/node_modules/pi-lens/dist/tools/symbol-search.js +2 -2
- package/node_modules/pi-lens/docs/agent-guide.md +3 -4
- package/node_modules/pi-lens/docs/agent-tools.md +46 -22
- package/node_modules/pi-lens/docs/configuration.md +9 -0
- package/node_modules/pi-lens/docs/environment-variables.md +0 -5
- package/node_modules/pi-lens/docs/features.md +5 -5
- package/node_modules/pi-lens/docs/globalconfig.md +11 -1
- package/node_modules/pi-lens/docs/mcp.md +13 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +71 -0
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +15 -0
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +88 -0
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +35 -0
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +12 -4
- package/node_modules/pi-lens/docs/public-api-stability.md +1 -0
- package/node_modules/pi-lens/docs/real-harness.md +46 -0
- package/node_modules/pi-lens/docs/release-qa-baseline.md +5 -1
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -6
- package/node_modules/pi-lens/docs/settings.md +37 -2
- package/node_modules/pi-lens/docs/tools_improvement2.md +4 -4
- package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +13 -3
- package/node_modules/pi-lens/package.json +10 -1
- package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/sql-injection.yml +7 -3
- package/node_modules/pi-lens/skills/pi-lens-ast-grep/SKILL.md +8 -6
- package/node_modules/pi-lens/skills/pi-lens-lsp-navigation/SKILL.md +19 -9
- package/node_modules/pi-web-access/CHANGELOG.md +29 -0
- package/node_modules/pi-web-access/README.md +33 -22
- package/node_modules/pi-web-access/abortable.ts +17 -0
- package/node_modules/pi-web-access/crawl4ai.ts +204 -0
- package/node_modules/pi-web-access/credential-source.ts +1 -0
- package/node_modules/pi-web-access/curator-page.ts +20 -2
- package/node_modules/pi-web-access/curator-run.ts +44 -0
- package/node_modules/pi-web-access/curator-server.ts +3 -1
- package/node_modules/pi-web-access/duckduckgo.ts +1 -1
- package/node_modules/pi-web-access/extract.ts +57 -12
- package/node_modules/pi-web-access/fetch-params.ts +1 -1
- package/node_modules/pi-web-access/gemini-search.ts +9 -5
- package/node_modules/pi-web-access/index.ts +25 -18
- package/node_modules/pi-web-access/openai-search.ts +35 -13
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/page-query.ts +5 -2
- package/node_modules/pi-web-access/query-rewrite.ts +5 -2
- package/node_modules/pi-web-access/serpapi.ts +220 -0
- package/node_modules/pi-web-access/ssrf-protection.ts +5 -1
- package/node_modules/pi-web-access/storage.ts +10 -0
- package/node_modules/pi-web-access/summary-review.ts +34 -21
- package/node_modules/pi-web-access/utils.ts +6 -4
- package/package.json +11 -5
- package/node_modules/pi-lens/dist/tools/ast-dump.js +0 -103
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AntigravityRouting, ThinkingWire } from "../types/types.js";
|
|
3
|
+
import { ThinkingEffort } from "../types/enums.js";
|
|
4
|
+
import type { AntigravityCatalog } from "./grouping.js";
|
|
5
|
+
|
|
6
|
+
export const PROVIDER_ID = "antigravity";
|
|
7
|
+
export const PROVIDER_NAME = "Antigravity";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Public selectable model IDs → backend request model IDs by thinking effort.
|
|
11
|
+
*
|
|
12
|
+
* Catalog mirrors `agy models` (Antigravity CLI), which currently advertises:
|
|
13
|
+
* - Gemini 3.8 Flash (Low / Medium / High)
|
|
14
|
+
* - Gemini 3.7 Flash (Low / Medium / High)
|
|
15
|
+
* - Gemini 3.6 Flash (Low / Medium / High)
|
|
16
|
+
* - Gemini 3.5 Flash (Low / Medium / High)
|
|
17
|
+
* - Gemini 3.1 Pro (Low / High)
|
|
18
|
+
* - Claude Sonnet 4.6 (Thinking)
|
|
19
|
+
* - Claude Opus 4.6 (Thinking)
|
|
20
|
+
* - GPT-OSS 120B (Medium)
|
|
21
|
+
*
|
|
22
|
+
* Pi exposes those as public model IDs and only surfaces the exact thinking levels
|
|
23
|
+
* advertised by the backend for each model.
|
|
24
|
+
*/
|
|
25
|
+
export const ANTIGRAVITY_ROUTING: Record<string, AntigravityRouting> = {
|
|
26
|
+
"claude-opus-4-6": {
|
|
27
|
+
routing: {
|
|
28
|
+
minimal: "claude-opus-4-6-thinking",
|
|
29
|
+
low: "claude-opus-4-6-thinking",
|
|
30
|
+
medium: "claude-opus-4-6-thinking",
|
|
31
|
+
high: "claude-opus-4-6-thinking",
|
|
32
|
+
},
|
|
33
|
+
defaultRequestId: "claude-opus-4-6-thinking",
|
|
34
|
+
},
|
|
35
|
+
// Live fetchAvailableModels exposes `claude-sonnet-4-6` (display: Thinking), not a separate *-thinking id.
|
|
36
|
+
"claude-sonnet-4-6": {
|
|
37
|
+
off: "claude-sonnet-4-6",
|
|
38
|
+
routing: {
|
|
39
|
+
minimal: "claude-sonnet-4-6",
|
|
40
|
+
low: "claude-sonnet-4-6",
|
|
41
|
+
medium: "claude-sonnet-4-6",
|
|
42
|
+
high: "claude-sonnet-4-6",
|
|
43
|
+
xhigh: "claude-sonnet-4-6",
|
|
44
|
+
},
|
|
45
|
+
defaultRequestId: "claude-sonnet-4-6",
|
|
46
|
+
},
|
|
47
|
+
"gemini-3.1-pro": {
|
|
48
|
+
// `gemini-3.1-pro-high` is advertised but currently 400s for agent streamGenerateContent;
|
|
49
|
+
// `gemini-pro-agent` is the working High runtime id (same display name in fetchAvailableModels).
|
|
50
|
+
off: "gemini-3.1-pro-low",
|
|
51
|
+
routing: {
|
|
52
|
+
minimal: "gemini-3.1-pro-low",
|
|
53
|
+
low: "gemini-3.1-pro-low",
|
|
54
|
+
medium: "gemini-3.1-pro-low",
|
|
55
|
+
high: "gemini-pro-agent",
|
|
56
|
+
xhigh: "gemini-pro-agent",
|
|
57
|
+
},
|
|
58
|
+
defaultRequestId: "gemini-3.1-pro-low",
|
|
59
|
+
},
|
|
60
|
+
"gemini-3.8-flash": {
|
|
61
|
+
off: "gemini-3.8-flash-low",
|
|
62
|
+
routing: {
|
|
63
|
+
minimal: "gemini-3.8-flash-low",
|
|
64
|
+
low: "gemini-3.8-flash-low",
|
|
65
|
+
medium: "gemini-3.8-flash-medium",
|
|
66
|
+
high: "gemini-3.8-flash-high",
|
|
67
|
+
xhigh: "gemini-3.8-flash-high",
|
|
68
|
+
},
|
|
69
|
+
defaultRequestId: "gemini-3.8-flash-low",
|
|
70
|
+
},
|
|
71
|
+
"gemini-3.7-flash": {
|
|
72
|
+
off: "gemini-3.7-flash-low",
|
|
73
|
+
routing: {
|
|
74
|
+
minimal: "gemini-3.7-flash-low",
|
|
75
|
+
low: "gemini-3.7-flash-low",
|
|
76
|
+
medium: "gemini-3.7-flash-medium",
|
|
77
|
+
high: "gemini-3.7-flash-high",
|
|
78
|
+
xhigh: "gemini-3.7-flash-high",
|
|
79
|
+
},
|
|
80
|
+
defaultRequestId: "gemini-3.7-flash-low",
|
|
81
|
+
},
|
|
82
|
+
"gemini-3.6-flash": {
|
|
83
|
+
// agy models: gemini-3.6-flash-low / -medium / -high
|
|
84
|
+
off: "gemini-3.6-flash-low",
|
|
85
|
+
routing: {
|
|
86
|
+
minimal: "gemini-3.6-flash-low",
|
|
87
|
+
low: "gemini-3.6-flash-low",
|
|
88
|
+
medium: "gemini-3.6-flash-medium",
|
|
89
|
+
high: "gemini-3.6-flash-high",
|
|
90
|
+
xhigh: "gemini-3.6-flash-high",
|
|
91
|
+
},
|
|
92
|
+
defaultRequestId: "gemini-3.6-flash-low",
|
|
93
|
+
},
|
|
94
|
+
"gemini-3.5-flash": {
|
|
95
|
+
off: "gemini-3.5-flash-extra-low",
|
|
96
|
+
routing: {
|
|
97
|
+
minimal: "gemini-3.5-flash-extra-low",
|
|
98
|
+
low: "gemini-3.5-flash-extra-low",
|
|
99
|
+
medium: "gemini-3.5-flash-low",
|
|
100
|
+
high: "gemini-3-flash-agent",
|
|
101
|
+
xhigh: "gemini-3-flash-agent",
|
|
102
|
+
},
|
|
103
|
+
defaultRequestId: "gemini-3.5-flash-extra-low",
|
|
104
|
+
},
|
|
105
|
+
"gpt-oss-120b": {
|
|
106
|
+
off: "gpt-oss-120b-medium",
|
|
107
|
+
routing: {
|
|
108
|
+
minimal: "gpt-oss-120b-medium",
|
|
109
|
+
low: "gpt-oss-120b-medium",
|
|
110
|
+
medium: "gpt-oss-120b-medium",
|
|
111
|
+
high: "gpt-oss-120b-medium",
|
|
112
|
+
},
|
|
113
|
+
defaultRequestId: "gpt-oss-120b-medium",
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Verified maximum output tokens accepted by the Cloud Code Assist backend per model/runtime ID.
|
|
119
|
+
* Requesting more than these limits returns a 400 Bad Request from the API.
|
|
120
|
+
*/
|
|
121
|
+
export const RUNTIME_MAX_OUTPUT_TOKENS: Record<string, number> = {
|
|
122
|
+
"gemini-3.8-flash": 65536,
|
|
123
|
+
"gemini-3.8-flash-low": 65536,
|
|
124
|
+
"gemini-3.8-flash-medium": 65536,
|
|
125
|
+
"gemini-3.8-flash-high": 65536,
|
|
126
|
+
"gemini-3.7-flash": 65536,
|
|
127
|
+
"gemini-3.7-flash-tiered": 65536,
|
|
128
|
+
// Retain rollout-era IDs for compatibility with pinned runtime overrides.
|
|
129
|
+
"gemini-3.7-flash-low": 65536,
|
|
130
|
+
"gemini-3.7-flash-medium": 65536,
|
|
131
|
+
"gemini-3.7-flash-high": 65536,
|
|
132
|
+
"gemini-3.6-flash": 65536,
|
|
133
|
+
"gemini-3.6-flash-low": 65536,
|
|
134
|
+
"gemini-3.6-flash-medium": 65536,
|
|
135
|
+
"gemini-3.6-flash-high": 65536,
|
|
136
|
+
"gemini-3.5-flash": 65536,
|
|
137
|
+
"gemini-3.5-flash-extra-low": 65536,
|
|
138
|
+
"gemini-3.5-flash-low": 65536,
|
|
139
|
+
"gemini-3-flash-agent": 65536,
|
|
140
|
+
"gemini-3.1-pro": 65535,
|
|
141
|
+
"gemini-3.1-pro-low": 65535,
|
|
142
|
+
"gemini-3.1-pro-high": 65535,
|
|
143
|
+
"gemini-pro-agent": 65535,
|
|
144
|
+
"claude-opus-4-6": 64000,
|
|
145
|
+
"claude-opus-4-6-thinking": 64000,
|
|
146
|
+
"claude-sonnet-4-6": 64000,
|
|
147
|
+
"gpt-oss-120b": 32768,
|
|
148
|
+
"gpt-oss-120b-medium": 32768,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export function getMaxOutputTokens(modelId: string, runtimeModel?: string): number {
|
|
152
|
+
if (runtimeModel && RUNTIME_MAX_OUTPUT_TOKENS[runtimeModel] !== undefined) {
|
|
153
|
+
return RUNTIME_MAX_OUTPUT_TOKENS[runtimeModel];
|
|
154
|
+
}
|
|
155
|
+
if (RUNTIME_MAX_OUTPUT_TOKENS[modelId] !== undefined) {
|
|
156
|
+
return RUNTIME_MAX_OUTPUT_TOKENS[modelId];
|
|
157
|
+
}
|
|
158
|
+
if (runtimeModel) {
|
|
159
|
+
if (runtimeModel.startsWith("claude-")) return 64000;
|
|
160
|
+
if (runtimeModel.startsWith("gpt-oss-")) return 32768;
|
|
161
|
+
if (runtimeModel.startsWith("gemini-3.1-pro") || runtimeModel === "gemini-pro-agent")
|
|
162
|
+
return 65535;
|
|
163
|
+
if (runtimeModel.startsWith("gemini-")) return 65536;
|
|
164
|
+
}
|
|
165
|
+
return 8192;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const geminiFlashCost = { input: 0.1, output: 0.4, cacheRead: 0.025, cacheWrite: 0.1 };
|
|
169
|
+
const geminiProCost = { input: 1.25, output: 5.0, cacheRead: 0.3125, cacheWrite: 1.25 };
|
|
170
|
+
const claudeSonnetCost = { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 };
|
|
171
|
+
const claudeOpusCost = { input: 15.0, output: 75.0, cacheRead: 1.5, cacheWrite: 18.75 };
|
|
172
|
+
const gptOssCost = { input: 0.6, output: 2.4, cacheRead: 0.15, cacheWrite: 0.6 };
|
|
173
|
+
|
|
174
|
+
// A null entry is intentionally hidden by Pi. Do not collapse levels that happen to
|
|
175
|
+
// route to the same runtime ID: the UI must reflect the levels the backend advertises.
|
|
176
|
+
const thinkingLevelMaps = {
|
|
177
|
+
lowMediumHigh: {
|
|
178
|
+
off: null,
|
|
179
|
+
minimal: null,
|
|
180
|
+
low: "low",
|
|
181
|
+
medium: "medium",
|
|
182
|
+
high: "high",
|
|
183
|
+
xhigh: null,
|
|
184
|
+
max: null,
|
|
185
|
+
},
|
|
186
|
+
lowHigh: {
|
|
187
|
+
off: null,
|
|
188
|
+
minimal: null,
|
|
189
|
+
low: "low",
|
|
190
|
+
medium: null,
|
|
191
|
+
high: "high",
|
|
192
|
+
xhigh: null,
|
|
193
|
+
max: null,
|
|
194
|
+
},
|
|
195
|
+
thinking: {
|
|
196
|
+
off: null,
|
|
197
|
+
minimal: null,
|
|
198
|
+
low: null,
|
|
199
|
+
medium: null,
|
|
200
|
+
high: "high",
|
|
201
|
+
xhigh: null,
|
|
202
|
+
max: null,
|
|
203
|
+
},
|
|
204
|
+
medium: {
|
|
205
|
+
off: null,
|
|
206
|
+
minimal: null,
|
|
207
|
+
low: null,
|
|
208
|
+
medium: "medium",
|
|
209
|
+
high: null,
|
|
210
|
+
xhigh: null,
|
|
211
|
+
max: null,
|
|
212
|
+
},
|
|
213
|
+
} satisfies Record<string, ProviderModelConfig["thinkingLevelMap"]>;
|
|
214
|
+
|
|
215
|
+
/** Same set as `agy models`, collapsed to public Pi model IDs. */
|
|
216
|
+
export const ANTIGRAVITY_MODELS: ProviderModelConfig[] = [
|
|
217
|
+
{
|
|
218
|
+
id: "gemini-3.8-flash",
|
|
219
|
+
name: "Gemini 3.8 Flash (Antigravity)",
|
|
220
|
+
reasoning: true,
|
|
221
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
222
|
+
input: ["text", "image"],
|
|
223
|
+
cost: geminiFlashCost,
|
|
224
|
+
contextWindow: 1048576,
|
|
225
|
+
maxTokens: 65536,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "gemini-3.7-flash",
|
|
229
|
+
name: "Gemini 3.7 Flash (Antigravity)",
|
|
230
|
+
reasoning: true,
|
|
231
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
232
|
+
input: ["text", "image"],
|
|
233
|
+
cost: geminiFlashCost,
|
|
234
|
+
contextWindow: 1048576,
|
|
235
|
+
maxTokens: 65536,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: "gemini-3.6-flash",
|
|
239
|
+
name: "Gemini 3.6 Flash (Antigravity)",
|
|
240
|
+
reasoning: true,
|
|
241
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
242
|
+
input: ["text", "image"],
|
|
243
|
+
cost: geminiFlashCost,
|
|
244
|
+
contextWindow: 1048576,
|
|
245
|
+
maxTokens: 65536,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "claude-opus-4-6",
|
|
249
|
+
name: "Claude Opus 4.6 (Antigravity)",
|
|
250
|
+
reasoning: true,
|
|
251
|
+
thinkingLevelMap: thinkingLevelMaps.thinking,
|
|
252
|
+
input: ["text", "image"],
|
|
253
|
+
cost: claudeOpusCost,
|
|
254
|
+
contextWindow: 250000,
|
|
255
|
+
maxTokens: 64000,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: "claude-sonnet-4-6",
|
|
259
|
+
name: "Claude Sonnet 4.6 (Antigravity)",
|
|
260
|
+
reasoning: true,
|
|
261
|
+
thinkingLevelMap: thinkingLevelMaps.thinking,
|
|
262
|
+
input: ["text", "image"],
|
|
263
|
+
cost: claudeSonnetCost,
|
|
264
|
+
contextWindow: 200000,
|
|
265
|
+
maxTokens: 64000,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "gemini-3.1-pro",
|
|
269
|
+
name: "Gemini 3.1 Pro (Antigravity)",
|
|
270
|
+
reasoning: true,
|
|
271
|
+
thinkingLevelMap: thinkingLevelMaps.lowHigh,
|
|
272
|
+
input: ["text", "image"],
|
|
273
|
+
cost: geminiProCost,
|
|
274
|
+
contextWindow: 1048576,
|
|
275
|
+
maxTokens: 65535,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "gemini-3.5-flash",
|
|
279
|
+
name: "Gemini 3.5 Flash (Antigravity)",
|
|
280
|
+
reasoning: true,
|
|
281
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
282
|
+
input: ["text", "image"],
|
|
283
|
+
cost: geminiFlashCost,
|
|
284
|
+
contextWindow: 1048576,
|
|
285
|
+
maxTokens: 65536,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: "gpt-oss-120b",
|
|
289
|
+
name: "GPT-OSS 120B (Antigravity)",
|
|
290
|
+
reasoning: true,
|
|
291
|
+
thinkingLevelMap: thinkingLevelMaps.medium,
|
|
292
|
+
input: ["text"],
|
|
293
|
+
cost: gptOssCost,
|
|
294
|
+
contextWindow: 131072,
|
|
295
|
+
maxTokens: 32768,
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
let currentModels: ProviderModelConfig[] = ANTIGRAVITY_MODELS;
|
|
300
|
+
let currentRouting: Record<string, AntigravityRouting> = { ...ANTIGRAVITY_ROUTING };
|
|
301
|
+
|
|
302
|
+
export function getCurrentAntigravityModels(): ProviderModelConfig[] {
|
|
303
|
+
return currentModels;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function getCurrentAntigravityRouting(): Record<string, AntigravityRouting> {
|
|
307
|
+
return currentRouting;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function getCurrentAntigravityCatalog(): AntigravityCatalog {
|
|
311
|
+
return { models: currentModels, routing: currentRouting };
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export function applyAntigravityCatalog(catalog: AntigravityCatalog): void {
|
|
315
|
+
currentModels = catalog.models;
|
|
316
|
+
currentRouting = catalog.routing;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function resetAntigravityCatalogForTests(): void {
|
|
320
|
+
currentModels = ANTIGRAVITY_MODELS;
|
|
321
|
+
currentRouting = { ...ANTIGRAVITY_ROUTING };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** Resolve public model id + thinking effort to Antigravity runtime model id. */
|
|
325
|
+
export function getAntigravityRequestModelId(modelId: string, effort: string | undefined): string {
|
|
326
|
+
const r = currentRouting[modelId] ?? ANTIGRAVITY_ROUTING[modelId];
|
|
327
|
+
if (!r) return modelId;
|
|
328
|
+
|
|
329
|
+
if (effort === undefined || effort === "off") {
|
|
330
|
+
return r.off ?? r.routing?.minimal ?? r.routing?.low ?? r.defaultRequestId ?? modelId;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const effortKey = effort as ThinkingEffort;
|
|
334
|
+
if (effortKey === ThinkingEffort.Xhigh) {
|
|
335
|
+
return (
|
|
336
|
+
r.routing?.xhigh ??
|
|
337
|
+
r.routing?.high ??
|
|
338
|
+
r.routing?.low ??
|
|
339
|
+
r.routing?.minimal ??
|
|
340
|
+
r.off ??
|
|
341
|
+
r.defaultRequestId ??
|
|
342
|
+
modelId
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
r.routing?.[effortKey] ??
|
|
348
|
+
r.routing?.low ??
|
|
349
|
+
r.routing?.minimal ??
|
|
350
|
+
r.off ??
|
|
351
|
+
r.defaultRequestId ??
|
|
352
|
+
modelId
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* If a next-gen model (e.g. Gemini 3.8 Flash) is not yet available on the backend,
|
|
358
|
+
* provide a fallback runtime model ID (e.g. Gemini 3.7 Flash) to maintain availability.
|
|
359
|
+
*/
|
|
360
|
+
export function getFallbackRuntimeModel(runtimeModel: string, effort?: string): string | undefined {
|
|
361
|
+
if (runtimeModel.startsWith("gemini-3.8-flash-")) {
|
|
362
|
+
return runtimeModel.replace("gemini-3.8-flash-", "gemini-3.7-flash-");
|
|
363
|
+
}
|
|
364
|
+
if (runtimeModel === "gemini-3.8-flash") {
|
|
365
|
+
return "gemini-3.7-flash-low";
|
|
366
|
+
}
|
|
367
|
+
if (runtimeModel === "gemini-3.7-flash-tiered") {
|
|
368
|
+
return getAntigravityRequestModelId("gemini-3.6-flash", effort);
|
|
369
|
+
}
|
|
370
|
+
if (runtimeModel.startsWith("gemini-3.7-flash-")) {
|
|
371
|
+
return runtimeModel.replace("gemini-3.7-flash-", "gemini-3.6-flash-");
|
|
372
|
+
}
|
|
373
|
+
if (runtimeModel === "gemini-3.7-flash") {
|
|
374
|
+
return "gemini-3.6-flash-low";
|
|
375
|
+
}
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export type { ThinkingWire };
|
|
380
|
+
|
|
381
|
+
export const ANTIGRAVITY_MODEL_ENUM: Record<string, string> = {
|
|
382
|
+
// Gemini 3.8 Flash
|
|
383
|
+
"gemini-3.8-flash": "MODEL_PLACEHOLDER_M318",
|
|
384
|
+
"gemini-3.8-flash-high": "MODEL_PLACEHOLDER_M318",
|
|
385
|
+
"gemini-3.8-flash-medium": "MODEL_PLACEHOLDER_M319",
|
|
386
|
+
"gemini-3.8-flash-low": "MODEL_PLACEHOLDER_M320",
|
|
387
|
+
"gemini-3.8-flash-tiered": "MODEL_PLACEHOLDER_M322",
|
|
388
|
+
// Gemini 3.7 Flash
|
|
389
|
+
"gemini-3.7-flash": "MODEL_PLACEHOLDER_M298",
|
|
390
|
+
"gemini-3.7-flash-high": "MODEL_PLACEHOLDER_M298",
|
|
391
|
+
"gemini-3.7-flash-medium": "MODEL_PLACEHOLDER_M299",
|
|
392
|
+
"gemini-3.7-flash-low": "MODEL_PLACEHOLDER_M300",
|
|
393
|
+
"gemini-3.7-flash-tiered": "MODEL_PLACEHOLDER_M301",
|
|
394
|
+
// Gemini 3.6 Flash
|
|
395
|
+
"gemini-3.6-flash": "MODEL_PLACEHOLDER_M71",
|
|
396
|
+
"gemini-3.6-flash-high": "MODEL_PLACEHOLDER_M71",
|
|
397
|
+
"gemini-3.6-flash-medium": "MODEL_PLACEHOLDER_M72",
|
|
398
|
+
"gemini-3.6-flash-low": "MODEL_PLACEHOLDER_M73",
|
|
399
|
+
"gemini-3.6-flash-tiered": "MODEL_PLACEHOLDER_M196",
|
|
400
|
+
// Gemini 3.5 Flash
|
|
401
|
+
"gemini-3.5-flash": "MODEL_PLACEHOLDER_M20",
|
|
402
|
+
"gemini-3.5-flash-extra-low": "MODEL_PLACEHOLDER_M187",
|
|
403
|
+
"gemini-3.5-flash-low": "MODEL_PLACEHOLDER_M20",
|
|
404
|
+
"gemini-3-flash-agent": "MODEL_PLACEHOLDER_M84",
|
|
405
|
+
// Gemini 3.1 Pro
|
|
406
|
+
"gemini-3.1-pro": "MODEL_PLACEHOLDER_M36",
|
|
407
|
+
"gemini-3.1-pro-low": "MODEL_PLACEHOLDER_M36",
|
|
408
|
+
"gemini-3.1-pro-high": "MODEL_PLACEHOLDER_M37",
|
|
409
|
+
"gemini-pro-agent": "MODEL_PLACEHOLDER_M16",
|
|
410
|
+
// Claude
|
|
411
|
+
"claude-sonnet-4-6": "MODEL_PLACEHOLDER_M35",
|
|
412
|
+
"claude-opus-4-6": "MODEL_PLACEHOLDER_M26",
|
|
413
|
+
"claude-opus-4-6-thinking": "MODEL_PLACEHOLDER_M26",
|
|
414
|
+
// GPT-OSS
|
|
415
|
+
"gpt-oss-120b": "MODEL_OPENAI_GPT_OSS_120B_MEDIUM",
|
|
416
|
+
"gpt-oss-120b-medium": "MODEL_OPENAI_GPT_OSS_120B_MEDIUM",
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const modelEnumCache = new Map<string, string>();
|
|
420
|
+
|
|
421
|
+
/** Register dynamically discovered model enum (e.g. from fetchAvailableModels). */
|
|
422
|
+
export function registerModelEnum(wireModelId: string, modelEnum: string): void {
|
|
423
|
+
if (wireModelId && modelEnum) {
|
|
424
|
+
modelEnumCache.set(wireModelId, modelEnum);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** Register batch of discovered model enums from fetchAvailableModels raw models dictionary. */
|
|
429
|
+
export function registerDiscoveredModelEnums(
|
|
430
|
+
models: Record<string, { model?: unknown }> | undefined,
|
|
431
|
+
): void {
|
|
432
|
+
if (!models) return;
|
|
433
|
+
for (const [wireId, info] of Object.entries(models)) {
|
|
434
|
+
if (typeof info?.model === "string" && info.model) {
|
|
435
|
+
modelEnumCache.set(wireId, info.model);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Get model_enum label for a given wire model id (dynamic cache first, then static fallback). */
|
|
441
|
+
export function getModelEnum(wireModelId: string): string | undefined {
|
|
442
|
+
const direct = modelEnumCache.get(wireModelId) || ANTIGRAVITY_MODEL_ENUM[wireModelId];
|
|
443
|
+
if (direct) return direct;
|
|
444
|
+
|
|
445
|
+
// Runtime overrides may name a public/base model while discovery only returned
|
|
446
|
+
// an enum for its selected runtime variant (for example `-low`).
|
|
447
|
+
const routed = getAntigravityRequestModelId(wireModelId, undefined);
|
|
448
|
+
return modelEnumCache.get(routed) || ANTIGRAVITY_MODEL_ENUM[routed];
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** Return a serializable snapshot of model enums learned from discovery. */
|
|
452
|
+
export function snapshotDynamicModelEnums(): Record<string, string> {
|
|
453
|
+
return Object.fromEntries(modelEnumCache);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/** Replace dynamically learned model enums with a previously persisted snapshot. */
|
|
457
|
+
export function restoreDynamicModelEnums(modelEnums: Record<string, string>): void {
|
|
458
|
+
modelEnumCache.clear();
|
|
459
|
+
for (const [wireModelId, modelEnum] of Object.entries(modelEnums)) {
|
|
460
|
+
if (wireModelId && modelEnum) modelEnumCache.set(wireModelId, modelEnum);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function clearModelEnumCache(): void {
|
|
465
|
+
modelEnumCache.clear();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export function getThinkingConfig(
|
|
469
|
+
modelId: string,
|
|
470
|
+
effort: string | undefined,
|
|
471
|
+
): ThinkingWire | undefined {
|
|
472
|
+
if (modelId.startsWith("claude-")) {
|
|
473
|
+
if (!effort || effort === "off") return { includeThoughts: false, thinkingBudget: 0 };
|
|
474
|
+
return { includeThoughts: true, thinkingBudget: 1024 };
|
|
475
|
+
}
|
|
476
|
+
if (modelId.startsWith("gpt-oss-")) {
|
|
477
|
+
if (!effort || effort === "off") return { includeThoughts: false, thinkingBudget: 0 };
|
|
478
|
+
return { includeThoughts: true, thinkingBudget: 8192 };
|
|
479
|
+
}
|
|
480
|
+
if (modelId.startsWith("gemini-3.5-flash") || modelId === "gemini-3-flash-agent") {
|
|
481
|
+
if (!effort || effort === "off") return { includeThoughts: false, thinkingBudget: 0 };
|
|
482
|
+
const thinkingBudget =
|
|
483
|
+
effort === "high" || effort === "xhigh" ? 10_000 : effort === "medium" ? 4_000 : 1_000;
|
|
484
|
+
return { includeThoughts: true, thinkingBudget };
|
|
485
|
+
}
|
|
486
|
+
if (modelId.startsWith("gemini-3.1-pro") || modelId === "gemini-pro-agent") {
|
|
487
|
+
if (!effort || effort === "off") return { includeThoughts: false, thinkingBudget: 0 };
|
|
488
|
+
return {
|
|
489
|
+
includeThoughts: true,
|
|
490
|
+
thinkingBudget: effort === "high" || effort === "xhigh" ? 10_001 : 1_001,
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
if (modelId.startsWith("gemini-")) {
|
|
494
|
+
if (!effort || effort === "off") return { includeThoughts: false, thinkingBudget: 0 };
|
|
495
|
+
const thinkingBudget =
|
|
496
|
+
effort === "high" || effort === "xhigh" ? -1 : effort === "medium" ? 4_000 : 1_000;
|
|
497
|
+
return { includeThoughts: true, thinkingBudget };
|
|
498
|
+
}
|
|
499
|
+
return undefined;
|
|
500
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./stream.js";
|