pi-usereq 0.6.0 → 0.10.0
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/.gitignore +2 -0
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/docs/pi.dev/coding-agent-docs/custom-provider.md +42 -1
- package/docs/pi.dev/coding-agent-docs/extensions.md +302 -28
- package/docs/pi.dev/coding-agent-docs/keybindings.md +23 -1
- package/docs/pi.dev/coding-agent-docs/models.md +3 -0
- package/docs/pi.dev/coding-agent-docs/packages.md +2 -2
- package/docs/pi.dev/coding-agent-docs/prompt-templates.md +21 -0
- package/docs/pi.dev/coding-agent-docs/providers.md +1 -0
- package/docs/pi.dev/coding-agent-docs/rpc.md +36 -6
- package/docs/pi.dev/coding-agent-docs/sdk.md +30 -5
- package/docs/pi.dev/coding-agent-docs/session.md +1 -1
- package/docs/pi.dev/coding-agent-docs/settings.md +2 -1
- package/docs/pi.dev/coding-agent-docs/skills.md +12 -12
- package/docs/pi.dev/coding-agent-docs/tree.md +2 -0
- package/docs/pi.dev/coding-agent-docs/tui.md +31 -0
- package/docs/pi.dev/mom-docs/new.md +4 -4
- package/package.json +1 -1
- package/pi-usereq/docs/REFERENCES.md +2658 -2035
- package/pi-usereq/docs/REQUIREMENTS.md +345 -191
- package/pi-usereq/docs/WORKFLOW.md +387 -363
- package/pi.dev-src/pi-mono/agent/src/agent-loop.ts +683 -0
- package/pi.dev-src/pi-mono/agent/src/agent.ts +543 -0
- package/pi.dev-src/pi-mono/agent/src/index.ts +8 -0
- package/pi.dev-src/pi-mono/agent/src/proxy.ts +367 -0
- package/pi.dev-src/pi-mono/agent/src/types.ts +364 -0
- package/pi.dev-src/pi-mono/agent/test/agent-loop.test.ts +1181 -0
- package/pi.dev-src/pi-mono/agent/test/agent.test.ts +463 -0
- package/pi.dev-src/pi-mono/agent/test/e2e.test.ts +404 -0
- package/pi.dev-src/pi-mono/agent/test/utils/calculate.ts +32 -0
- package/pi.dev-src/pi-mono/agent/test/utils/get-current-time.ts +46 -0
- package/pi.dev-src/pi-mono/agent/vitest.config.ts +9 -0
- package/pi.dev-src/pi-mono/ai/bedrock-provider.d.ts +1 -0
- package/pi.dev-src/pi-mono/ai/bedrock-provider.js +1 -0
- package/pi.dev-src/pi-mono/ai/scripts/generate-models.ts +1635 -0
- package/pi.dev-src/pi-mono/ai/scripts/generate-test-image.ts +34 -0
- package/pi.dev-src/pi-mono/ai/src/api-registry.ts +98 -0
- package/pi.dev-src/pi-mono/ai/src/bedrock-provider.ts +6 -0
- package/pi.dev-src/pi-mono/ai/src/cli.ts +133 -0
- package/pi.dev-src/pi-mono/ai/src/env-api-keys.ts +134 -0
- package/pi.dev-src/pi-mono/ai/src/index.ts +35 -0
- package/pi.dev-src/pi-mono/ai/src/models.generated.ts +14928 -0
- package/pi.dev-src/pi-mono/ai/src/models.ts +82 -0
- package/pi.dev-src/pi-mono/ai/src/oauth.ts +1 -0
- package/pi.dev-src/pi-mono/ai/src/providers/amazon-bedrock.ts +929 -0
- package/pi.dev-src/pi-mono/ai/src/providers/anthropic.ts +1125 -0
- package/pi.dev-src/pi-mono/ai/src/providers/azure-openai-responses.ts +253 -0
- package/pi.dev-src/pi-mono/ai/src/providers/faux.ts +499 -0
- package/pi.dev-src/pi-mono/ai/src/providers/github-copilot-headers.ts +37 -0
- package/pi.dev-src/pi-mono/ai/src/providers/google-gemini-cli.ts +996 -0
- package/pi.dev-src/pi-mono/ai/src/providers/google-shared.ts +354 -0
- package/pi.dev-src/pi-mono/ai/src/providers/google-vertex.ts +543 -0
- package/pi.dev-src/pi-mono/ai/src/providers/google.ts +500 -0
- package/pi.dev-src/pi-mono/ai/src/providers/mistral.ts +629 -0
- package/pi.dev-src/pi-mono/ai/src/providers/openai-codex-responses.ts +984 -0
- package/pi.dev-src/pi-mono/ai/src/providers/openai-completions.ts +1063 -0
- package/pi.dev-src/pi-mono/ai/src/providers/openai-responses-shared.ts +539 -0
- package/pi.dev-src/pi-mono/ai/src/providers/openai-responses.ts +264 -0
- package/pi.dev-src/pi-mono/ai/src/providers/register-builtins.ts +433 -0
- package/pi.dev-src/pi-mono/ai/src/providers/simple-options.ts +47 -0
- package/pi.dev-src/pi-mono/ai/src/providers/transform-messages.ts +220 -0
- package/pi.dev-src/pi-mono/ai/src/stream.ts +59 -0
- package/pi.dev-src/pi-mono/ai/src/types.ts +417 -0
- package/pi.dev-src/pi-mono/ai/src/utils/event-stream.ts +87 -0
- package/pi.dev-src/pi-mono/ai/src/utils/hash.ts +13 -0
- package/pi.dev-src/pi-mono/ai/src/utils/headers.ts +7 -0
- package/pi.dev-src/pi-mono/ai/src/utils/json-parse.ts +124 -0
- package/pi.dev-src/pi-mono/ai/src/utils/overflow.ts +138 -0
- package/pi.dev-src/pi-mono/ai/src/utils/sanitize-unicode.ts +25 -0
- package/pi.dev-src/pi-mono/ai/src/utils/typebox-helpers.ts +24 -0
- package/pi.dev-src/pi-mono/ai/src/utils/validation.ts +324 -0
- package/pi.dev-src/pi-mono/ai/test/abort.test.ts +260 -0
- package/pi.dev-src/pi-mono/ai/test/anthropic-oauth.test.ts +99 -0
- package/pi.dev-src/pi-mono/ai/test/anthropic-opus-4-7-smoke.test.ts +72 -0
- package/pi.dev-src/pi-mono/ai/test/anthropic-sse-parsing.test.ts +113 -0
- package/pi.dev-src/pi-mono/ai/test/anthropic-thinking-disable.test.ts +152 -0
- package/pi.dev-src/pi-mono/ai/test/anthropic-tool-name-normalization.test.ts +205 -0
- package/pi.dev-src/pi-mono/ai/test/azure-utils.ts +28 -0
- package/pi.dev-src/pi-mono/ai/test/bedrock-endpoint-resolution.test.ts +131 -0
- package/pi.dev-src/pi-mono/ai/test/bedrock-models.test.ts +66 -0
- package/pi.dev-src/pi-mono/ai/test/bedrock-thinking-payload.test.ts +107 -0
- package/pi.dev-src/pi-mono/ai/test/bedrock-utils.ts +18 -0
- package/pi.dev-src/pi-mono/ai/test/cache-retention.test.ts +335 -0
- package/pi.dev-src/pi-mono/ai/test/context-overflow.test.ts +714 -0
- package/pi.dev-src/pi-mono/ai/test/cross-provider-handoff.test.ts +458 -0
- package/pi.dev-src/pi-mono/ai/test/data/red-circle.png +0 -0
- package/pi.dev-src/pi-mono/ai/test/empty.test.ts +742 -0
- package/pi.dev-src/pi-mono/ai/test/faux-provider.test.ts +597 -0
- package/pi.dev-src/pi-mono/ai/test/fireworks-models.test.ts +49 -0
- package/pi.dev-src/pi-mono/ai/test/github-copilot-anthropic.test.ts +108 -0
- package/pi.dev-src/pi-mono/ai/test/github-copilot-oauth.test.ts +196 -0
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-claude-thinking-header.test.ts +103 -0
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-empty-stream.test.ts +108 -0
- package/pi.dev-src/pi-mono/ai/test/google-gemini-cli-retry-delay.test.ts +53 -0
- package/pi.dev-src/pi-mono/ai/test/google-shared-convert-tools.test.ts +187 -0
- package/pi.dev-src/pi-mono/ai/test/google-shared-gemini3-unsigned-tool-call.test.ts +172 -0
- package/pi.dev-src/pi-mono/ai/test/google-shared-image-tool-result-routing.test.ts +124 -0
- package/pi.dev-src/pi-mono/ai/test/google-thinking-disable.test.ts +183 -0
- package/pi.dev-src/pi-mono/ai/test/google-thinking-signature.test.ts +38 -0
- package/pi.dev-src/pi-mono/ai/test/google-tool-call-missing-args.test.ts +105 -0
- package/pi.dev-src/pi-mono/ai/test/google-vertex-api-key-resolution.test.ts +144 -0
- package/pi.dev-src/pi-mono/ai/test/image-tool-result.test.ts +481 -0
- package/pi.dev-src/pi-mono/ai/test/interleaved-thinking.test.ts +145 -0
- package/pi.dev-src/pi-mono/ai/test/lazy-module-load.test.ts +102 -0
- package/pi.dev-src/pi-mono/ai/test/mistral-reasoning-mode.test.ts +66 -0
- package/pi.dev-src/pi-mono/ai/test/mistral-tool-schema.test.ts +61 -0
- package/pi.dev-src/pi-mono/ai/test/oauth.ts +89 -0
- package/pi.dev-src/pi-mono/ai/test/openai-codex-cache-affinity-e2e.test.ts +36 -0
- package/pi.dev-src/pi-mono/ai/test/openai-codex-stream.test.ts +686 -0
- package/pi.dev-src/pi-mono/ai/test/openai-completions-cache-control-format.test.ts +189 -0
- package/pi.dev-src/pi-mono/ai/test/openai-completions-prompt-cache.test.ts +198 -0
- package/pi.dev-src/pi-mono/ai/test/openai-completions-thinking-as-text.test.ts +214 -0
- package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-choice.test.ts +560 -0
- package/pi.dev-src/pi-mono/ai/test/openai-completions-tool-result-images.test.ts +101 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-cache-affinity-e2e.test.ts +32 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-copilot-provider.test.ts +128 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-foreign-toolcall-id.test.ts +66 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-partial-json-cleanup.test.ts +101 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-reasoning-replay-e2e.test.ts +292 -0
- package/pi.dev-src/pi-mono/ai/test/openai-responses-tool-result-images.test.ts +200 -0
- package/pi.dev-src/pi-mono/ai/test/openrouter-cache-write-repro.test.ts +78 -0
- package/pi.dev-src/pi-mono/ai/test/overflow.test.ts +64 -0
- package/pi.dev-src/pi-mono/ai/test/responseid.test.ts +145 -0
- package/pi.dev-src/pi-mono/ai/test/stream.test.ts +1405 -0
- package/pi.dev-src/pi-mono/ai/test/supports-xhigh.test.ts +34 -0
- package/pi.dev-src/pi-mono/ai/test/tokens.test.ts +304 -0
- package/pi.dev-src/pi-mono/ai/test/tool-call-id-normalization.test.ts +291 -0
- package/pi.dev-src/pi-mono/ai/test/tool-call-without-result.test.ts +313 -0
- package/pi.dev-src/pi-mono/ai/test/total-tokens.test.ts +695 -0
- package/pi.dev-src/pi-mono/ai/test/transform-messages-copilot-openai-to-anthropic.test.ts +191 -0
- package/pi.dev-src/pi-mono/ai/test/unicode-surrogate.test.ts +754 -0
- package/pi.dev-src/pi-mono/ai/test/validation.test.ts +116 -0
- package/pi.dev-src/pi-mono/ai/test/xhigh.test.ts +71 -0
- package/pi.dev-src/pi-mono/ai/test/zen.test.ts +25 -0
- package/pi.dev-src/pi-mono/ai/vitest.config.ts +9 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/antigravity-image-gen.ts +418 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bash-spawn-hook.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/bookmark.ts +50 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/claude-rules.ts +86 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/commands.ts +72 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/confirm-destructive.ts +59 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-compaction.ts +127 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-footer.ts +64 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-header.ts +73 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/custom-provider-qwen-cli/index.ts +345 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dirty-repo-guard.ts +56 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/index.ts +74 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-resources/index.ts +15 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/dynamic-tools.ts +74 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/event-bus.ts +43 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/file-trigger.ts +41 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/git-checkpoint.ts +53 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/handoff.ts +153 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hello.ts +26 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/hidden-thinking-label.ts +53 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/inline-bash.ts +94 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/input-transform.ts +43 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/interactive-shell.ts +196 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/mac-system-theme.ts +47 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/message-renderer.ts +59 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/minimal-mode.ts +426 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/modal-editor.ts +85 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/model-status.ts +31 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/notify.ts +55 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-qa-tests.ts +1348 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/overlay-test.ts +150 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/permission-gate.ts +34 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/pirate.ts +47 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/index.ts +340 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/plan-mode/utils.ts +168 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/preset.ts +430 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/prompt-customizer.ts +97 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/protected-paths.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/provider-payload.ts +18 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/qna.ts +122 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/question.ts +264 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/questionnaire.ts +427 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rainbow-editor.ts +88 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/reload-runtime.ts +37 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/rpc-demo.ts +118 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/index.ts +321 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/sandbox/package-lock.json +92 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/send-user-message.ts +97 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/session-name.ts +27 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/shutdown-command.ts +63 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/snake.ts +343 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/space-invaders.ts +560 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/ssh.ts +220 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/status-line.ts +32 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/structured-output.ts +65 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/planner.md +37 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/scout.md +50 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents/worker.md +24 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/agents.ts +126 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/index.ts +987 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/implement.md +10 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/summarize.ts +206 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/system-prompt-header.ts +17 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tic-tac-toe.ts +1008 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/timed-confirm.ts +70 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/titlebar-spinner.ts +58 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/todo.ts +297 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tool-override.ts +144 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/tools.ts +141 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/trigger-compact.ts +50 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/truncated-tool.ts +195 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/widget-placement.ts +9 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/index.ts +32 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/with-deps/package-lock.json +31 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-indicator.ts +123 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/extensions/working-message-test.ts +25 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/rpc-extension-ui.ts +632 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/01-minimal.ts +22 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/02-custom-model.ts +49 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/03-custom-prompt.ts +62 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/04-skills.ts +55 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/05-tools.ts +44 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/06-extensions.ts +90 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/07-context-files.ts +42 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/08-prompt-templates.ts +51 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/10-settings.ts +53 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/11-sessions.ts +48 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/12-full-control.ts +73 -0
- package/pi.dev-src/pi-mono/coding-agent/examples/sdk/13-session-runtime.ts +67 -0
- package/pi.dev-src/pi-mono/coding-agent/scripts/migrate-sessions.sh +93 -0
- package/pi.dev-src/pi-mono/coding-agent/src/bun/cli.ts +6 -0
- package/pi.dev-src/pi-mono/coding-agent/src/bun/register-bedrock.ts +4 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/args.ts +335 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/config-selector.ts +52 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/file-processor.ts +100 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/initial-message.ts +43 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/list-models.ts +110 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli/session-picker.ts +52 -0
- package/pi.dev-src/pi-mono/coding-agent/src/cli.ts +17 -0
- package/pi.dev-src/pi-mono/coding-agent/src/config.ts +261 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-runtime.ts +394 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session-services.ts +196 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/agent-session.ts +3096 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/auth-storage.ts +493 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/bash-executor.ts +154 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/branch-summarization.ts +355 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/compaction.ts +839 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/index.ts +7 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/compaction/utils.ts +170 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/defaults.ts +3 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/diagnostics.ts +15 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/event-bus.ts +33 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/exec.ts +107 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/ansi-to-html.ts +258 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/index.ts +314 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.css +1017 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.html +55 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/template.js +1770 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/tool-renderer.ts +158 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/highlight.min.js +1213 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/export-html/vendor/marked.min.js +6 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/index.ts +171 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/loader.ts +606 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/runner.ts +1019 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/types.ts +1542 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/extensions/wrapper.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/footer-data-provider.ts +354 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/index.ts +77 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/keybindings.ts +370 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/messages.ts +195 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/model-registry.ts +858 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/model-resolver.ts +629 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/output-guard.ts +74 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/package-manager.ts +2408 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/prompt-templates.ts +296 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/resolve-config-value.ts +142 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/resource-loader.ts +917 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/sdk.ts +380 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/session-cwd.ts +59 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/session-manager.ts +1425 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/settings-manager.ts +999 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/skills.ts +508 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/slash-commands.ts +39 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/source-info.ts +40 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/system-prompt.ts +172 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/telemetry.ts +13 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/timings.ts +31 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/bash.ts +448 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit-diff.ts +445 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/edit.ts +487 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/file-mutation-queue.ts +39 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/find.ts +370 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/grep.ts +384 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/index.ts +196 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/ls.ts +229 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/path-utils.ts +94 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/read.ts +273 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/render-utils.ts +64 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/tool-definition-wrapper.ts +45 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/truncate.ts +265 -0
- package/pi.dev-src/pi-mono/coding-agent/src/core/tools/write.ts +281 -0
- package/pi.dev-src/pi-mono/coding-agent/src/index.ts +352 -0
- package/pi.dev-src/pi-mono/coding-agent/src/main.ts +731 -0
- package/pi.dev-src/pi-mono/coding-agent/src/migrations.ts +314 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/index.ts +9 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/assets/clankolas.png +0 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/armin.ts +382 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/assistant-message.ts +147 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bash-execution.ts +218 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/bordered-loader.ts +68 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/branch-summary-message.ts +58 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/compaction-summary-message.ts +59 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/config-selector.ts +592 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/countdown-timer.ts +38 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-editor.ts +80 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/custom-message.ts +99 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/daxnuts.ts +164 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/diff.ts +147 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/dynamic-border.ts +25 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/earendil-announcement.ts +53 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-editor.ts +147 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-input.ts +87 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/extension-selector.ts +107 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/footer.ts +220 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/index.ts +32 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/keybinding-hints.ts +24 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/login-dialog.ts +178 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/model-selector.ts +338 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/oauth-selector.ts +121 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/scoped-models-selector.ts +355 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector-search.ts +194 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/session-selector.ts +1026 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/settings-selector.ts +456 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/show-images-selector.ts +50 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/skill-invocation-message.ts +55 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/theme-selector.ts +67 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/thinking-selector.ts +74 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tool-execution.ts +352 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/tree-selector.ts +1246 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message-selector.ts +155 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/user-message.ts +35 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/components/visual-truncate.ts +50 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/interactive-mode.ts +5155 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/dark.json +85 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/light.json +84 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme-schema.json +335 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/interactive/theme/theme.ts +1141 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/print-mode.ts +158 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/jsonl.ts +58 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-client.ts +515 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-mode.ts +745 -0
- package/pi.dev-src/pi-mono/coding-agent/src/modes/rpc/rpc-types.ts +264 -0
- package/pi.dev-src/pi-mono/coding-agent/src/package-manager-cli.ts +270 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/changelog.ts +99 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/child-process.ts +86 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-image.ts +300 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard-native.ts +22 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/clipboard.ts +81 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/exif-orientation.ts +183 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/frontmatter.ts +39 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/fs-watch.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/git.ts +192 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/image-convert.ts +41 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/image-resize.ts +176 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/mime.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/paths.ts +20 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/photon.ts +139 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/shell.ts +210 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/sleep.ts +18 -0
- package/pi.dev-src/pi-mono/coding-agent/src/utils/tools-manager.ts +287 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-auto-compaction-queue.test.ts +437 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-branching.test.ts +156 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-compaction.test.ts +208 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-concurrent.test.ts +618 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-provider.test.ts +117 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-dynamic-tools.test.ts +182 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-retry.test.ts +318 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-runtime-events.test.ts +208 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-stats.test.ts +143 -0
- package/pi.dev-src/pi-mono/coding-agent/test/agent-session-tree-navigation.test.ts +323 -0
- package/pi.dev-src/pi-mono/coding-agent/test/args.test.ts +328 -0
- package/pi.dev-src/pi-mono/coding-agent/test/assistant-message.test.ts +57 -0
- package/pi.dev-src/pi-mono/coding-agent/test/auth-storage.test.ts +462 -0
- package/pi.dev-src/pi-mono/coding-agent/test/bash-close-hang-windows.test.ts +126 -0
- package/pi.dev-src/pi-mono/coding-agent/test/bash-execution-width.test.ts +80 -0
- package/pi.dev-src/pi-mono/coding-agent/test/block-images.test.ts +120 -0
- package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image-bmp-conversion.test.ts +88 -0
- package/pi.dev-src/pi-mono/coding-agent/test/clipboard-image.test.ts +136 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions-example.test.ts +66 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-extensions.test.ts +415 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-serialization.test.ts +79 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-summary-reasoning.test.ts +118 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction-thinking-model.test.ts +223 -0
- package/pi.dev-src/pi-mono/coding-agent/test/compaction.test.ts +550 -0
- package/pi.dev-src/pi-mono/coding-agent/test/config.test.ts +30 -0
- package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-legacy-input.test.ts +116 -0
- package/pi.dev-src/pi-mono/coding-agent/test/edit-tool-no-full-redraw.test.ts +235 -0
- package/pi.dev-src/pi-mono/coding-agent/test/export-html-whitespace.test.ts +12 -0
- package/pi.dev-src/pi-mono/coding-agent/test/export-html-xss.test.ts +28 -0
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-discovery.test.ts +463 -0
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-input-event.test.ts +112 -0
- package/pi.dev-src/pi-mono/coding-agent/test/extensions-runner.test.ts +805 -0
- package/pi.dev-src/pi-mono/coding-agent/test/file-mutation-queue.test.ts +163 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/assistant-message-with-thinking-code.json +33 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/before-compaction.jsonl +1003 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-agent/.gitkeep +0 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/empty-cwd/.gitkeep +0 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/large-session.jsonl +1019 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/consecutive-hyphens/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/disable-model-invocation/SKILL.md +9 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-name-chars/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/invalid-yaml/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/long-name/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/missing-description/SKILL.md +7 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/multiline-description/SKILL.md +11 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/name-mismatch/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/nested/child-skill/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/no-frontmatter/SKILL.md +3 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/SKILL.md +3 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/root-skill-preferred/nested-child/SKILL.md +3 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/unknown-field/SKILL.md +10 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills/valid-skill/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/first/calendar/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/fixtures/skills-collision/second/calendar/SKILL.md +8 -0
- package/pi.dev-src/pi-mono/coding-agent/test/footer-data-provider.test.ts +265 -0
- package/pi.dev-src/pi-mono/coding-agent/test/footer-width.test.ts +115 -0
- package/pi.dev-src/pi-mono/coding-agent/test/frontmatter.test.ts +60 -0
- package/pi.dev-src/pi-mono/coding-agent/test/git-ssh-url.test.ts +78 -0
- package/pi.dev-src/pi-mono/coding-agent/test/git-update.test.ts +411 -0
- package/pi.dev-src/pi-mono/coding-agent/test/image-processing.test.ts +145 -0
- package/pi.dev-src/pi-mono/coding-agent/test/image-resize-callers.test.ts +53 -0
- package/pi.dev-src/pi-mono/coding-agent/test/initial-message.test.ts +48 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-anthropic-warning.test.ts +73 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-clone-command.test.ts +77 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-compaction.test.ts +57 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-import-command.test.ts +144 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-status.test.ts +635 -0
- package/pi.dev-src/pi-mono/coding-agent/test/interactive-mode-suspend.test.ts +149 -0
- package/pi.dev-src/pi-mono/coding-agent/test/keybindings-migration.test.ts +88 -0
- package/pi.dev-src/pi-mono/coding-agent/test/model-registry.test.ts +1209 -0
- package/pi.dev-src/pi-mono/coding-agent/test/model-resolver.test.ts +436 -0
- package/pi.dev-src/pi-mono/coding-agent/test/package-command-paths.test.ts +144 -0
- package/pi.dev-src/pi-mono/coding-agent/test/package-manager-ssh.test.ts +97 -0
- package/pi.dev-src/pi-mono/coding-agent/test/package-manager.test.ts +1795 -0
- package/pi.dev-src/pi-mono/coding-agent/test/path-utils.test.ts +162 -0
- package/pi.dev-src/pi-mono/coding-agent/test/plan-mode-utils.test.ts +261 -0
- package/pi.dev-src/pi-mono/coding-agent/test/print-mode.test.ts +140 -0
- package/pi.dev-src/pi-mono/coding-agent/test/prompt-templates.test.ts +515 -0
- package/pi.dev-src/pi-mono/coding-agent/test/resource-loader.test.ts +576 -0
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-client-clone.test.ts +29 -0
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-example.ts +86 -0
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-jsonl.test.ts +65 -0
- package/pi.dev-src/pi-mono/coding-agent/test/rpc-prompt-response-semantics.test.ts +285 -0
- package/pi.dev-src/pi-mono/coding-agent/test/rpc.test.ts +321 -0
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-codex-cache-probe-tool-loop.ts +364 -0
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-openrouter-attribution.test.ts +181 -0
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-session-manager.test.ts +95 -0
- package/pi.dev-src/pi-mono/coding-agent/test/sdk-skills.test.ts +109 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-cwd.test.ts +91 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-info-modified-timestamp.test.ts +83 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/build-context.test.ts +268 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/custom-session-id.test.ts +109 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/file-operations.test.ts +208 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/labels.test.ts +198 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/migration.test.ts +78 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/save-entry.test.ts +55 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-manager/tree-traversal.test.ts +533 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-path-delete.test.ts +315 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-rename.test.ts +111 -0
- package/pi.dev-src/pi-mono/coding-agent/test/session-selector-search.test.ts +195 -0
- package/pi.dev-src/pi-mono/coding-agent/test/settings-manager-bug.test.ts +147 -0
- package/pi.dev-src/pi-mono/coding-agent/test/settings-manager.test.ts +319 -0
- package/pi.dev-src/pi-mono/coding-agent/test/skills.test.ts +432 -0
- package/pi.dev-src/pi-mono/coding-agent/test/stdout-cleanliness.test.ts +103 -0
- package/pi.dev-src/pi-mono/coding-agent/test/streaming-render-debug.ts +97 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-bash-persistence.test.ts +242 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-compaction.test.ts +343 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-model-extension.test.ts +325 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-prompt.test.ts +323 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-queue.test.ts +422 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-retry-events.test.ts +358 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/agent-session-runtime.test.ts +553 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/harness.ts +208 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2023-queued-slash-command-followup.test.ts +80 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2753-reload-stale-resource-settings.test.ts +100 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2781-skill-collision-precedence.test.ts +120 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2791-fswatch-error-crash.test.ts +106 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2835-tools-allowlist-filters-extension-tools.test.ts +94 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/2860-replaced-session-context.test.ts +274 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3217-scoped-model-order.test.ts +104 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3302-find-path-glob.test.ts +72 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3303-find-nested-gitignore.test.ts +83 -0
- package/pi.dev-src/pi-mono/coding-agent/test/suite/regressions/3317-network-connection-lost-retry.test.ts +33 -0
- package/pi.dev-src/pi-mono/coding-agent/test/system-prompt.test.ts +102 -0
- package/pi.dev-src/pi-mono/coding-agent/test/test-harness.test.ts +321 -0
- package/pi.dev-src/pi-mono/coding-agent/test/test-harness.ts +446 -0
- package/pi.dev-src/pi-mono/coding-agent/test/test-theme-colors.ts +246 -0
- package/pi.dev-src/pi-mono/coding-agent/test/theme-export.test.ts +104 -0
- package/pi.dev-src/pi-mono/coding-agent/test/tool-execution-component.test.ts +331 -0
- package/pi.dev-src/pi-mono/coding-agent/test/tools.test.ts +889 -0
- package/pi.dev-src/pi-mono/coding-agent/test/tree-selector.test.ts +655 -0
- package/pi.dev-src/pi-mono/coding-agent/test/trigger-compact-extension.test.ts +57 -0
- package/pi.dev-src/pi-mono/coding-agent/test/truncate-to-width.test.ts +81 -0
- package/pi.dev-src/pi-mono/coding-agent/test/user-message.test.ts +25 -0
- package/pi.dev-src/pi-mono/coding-agent/test/utilities.ts +316 -0
- package/pi.dev-src/pi-mono/coding-agent/tsconfig.examples.json +16 -0
- package/pi.dev-src/pi-mono/coding-agent/vitest.config.ts +26 -0
- package/pi.dev-src/pi-mono/mom/dev.sh +30 -0
- package/pi.dev-src/pi-mono/mom/docker.sh +95 -0
- package/pi.dev-src/pi-mono/mom/scripts/migrate-timestamps.ts +121 -0
- package/pi.dev-src/pi-mono/mom/src/agent.ts +882 -0
- package/pi.dev-src/pi-mono/mom/src/context.ts +180 -0
- package/pi.dev-src/pi-mono/mom/src/download.ts +117 -0
- package/pi.dev-src/pi-mono/mom/src/events.ts +442 -0
- package/pi.dev-src/pi-mono/mom/src/fs-watch.ts +30 -0
- package/pi.dev-src/pi-mono/mom/src/log.ts +271 -0
- package/pi.dev-src/pi-mono/mom/src/main.ts +367 -0
- package/pi.dev-src/pi-mono/mom/src/sandbox.ts +221 -0
- package/pi.dev-src/pi-mono/mom/src/slack.ts +623 -0
- package/pi.dev-src/pi-mono/mom/src/store.ts +234 -0
- package/pi.dev-src/pi-mono/mom/src/tools/attach.ts +47 -0
- package/pi.dev-src/pi-mono/mom/src/tools/bash.ts +97 -0
- package/pi.dev-src/pi-mono/mom/src/tools/edit.ts +165 -0
- package/pi.dev-src/pi-mono/mom/src/tools/index.ts +19 -0
- package/pi.dev-src/pi-mono/mom/src/tools/read.ts +159 -0
- package/pi.dev-src/pi-mono/mom/src/tools/truncate.ts +236 -0
- package/pi.dev-src/pi-mono/mom/src/tools/write.ts +45 -0
- package/pi.dev-src/pi-mono/mom/test/events.test.ts +50 -0
- package/pi.dev-src/pi-mono/pods/scripts/model_run.sh +83 -0
- package/pi.dev-src/pi-mono/pods/scripts/pod_setup.sh +336 -0
- package/pi.dev-src/pi-mono/pods/src/cli.ts +360 -0
- package/pi.dev-src/pi-mono/pods/src/commands/models.ts +753 -0
- package/pi.dev-src/pi-mono/pods/src/commands/pods.ts +205 -0
- package/pi.dev-src/pi-mono/pods/src/commands/prompt.ts +84 -0
- package/pi.dev-src/pi-mono/pods/src/config.ts +80 -0
- package/pi.dev-src/pi-mono/pods/src/index.ts +2 -0
- package/pi.dev-src/pi-mono/pods/src/model-configs.ts +111 -0
- package/pi.dev-src/pi-mono/pods/src/models.json +295 -0
- package/pi.dev-src/pi-mono/pods/src/ssh.ts +151 -0
- package/pi.dev-src/pi-mono/pods/src/types.ts +27 -0
- package/pi.dev-src/pi-mono/tui/src/autocomplete.ts +783 -0
- package/pi.dev-src/pi-mono/tui/src/components/box.ts +137 -0
- package/pi.dev-src/pi-mono/tui/src/components/cancellable-loader.ts +40 -0
- package/pi.dev-src/pi-mono/tui/src/components/editor.ts +2280 -0
- package/pi.dev-src/pi-mono/tui/src/components/image.ts +104 -0
- package/pi.dev-src/pi-mono/tui/src/components/input.ts +503 -0
- package/pi.dev-src/pi-mono/tui/src/components/loader.ts +86 -0
- package/pi.dev-src/pi-mono/tui/src/components/markdown.ts +852 -0
- package/pi.dev-src/pi-mono/tui/src/components/select-list.ts +229 -0
- package/pi.dev-src/pi-mono/tui/src/components/settings-list.ts +250 -0
- package/pi.dev-src/pi-mono/tui/src/components/spacer.ts +28 -0
- package/pi.dev-src/pi-mono/tui/src/components/text.ts +106 -0
- package/pi.dev-src/pi-mono/tui/src/components/truncated-text.ts +65 -0
- package/pi.dev-src/pi-mono/tui/src/editor-component.ts +74 -0
- package/pi.dev-src/pi-mono/tui/src/fuzzy.ts +133 -0
- package/pi.dev-src/pi-mono/tui/src/index.ts +106 -0
- package/pi.dev-src/pi-mono/tui/src/keybindings.ts +244 -0
- package/pi.dev-src/pi-mono/tui/src/keys.ts +1400 -0
- package/pi.dev-src/pi-mono/tui/src/kill-ring.ts +46 -0
- package/pi.dev-src/pi-mono/tui/src/stdin-buffer.ts +386 -0
- package/pi.dev-src/pi-mono/tui/src/terminal-image.ts +414 -0
- package/pi.dev-src/pi-mono/tui/src/terminal.ts +373 -0
- package/pi.dev-src/pi-mono/tui/src/tui.ts +1243 -0
- package/pi.dev-src/pi-mono/tui/src/undo-stack.ts +28 -0
- package/pi.dev-src/pi-mono/tui/src/utils.ts +1085 -0
- package/pi.dev-src/pi-mono/tui/test/autocomplete.test.ts +542 -0
- package/pi.dev-src/pi-mono/tui/test/bug-regression-isimageline-startswith-bug.test.ts +237 -0
- package/pi.dev-src/pi-mono/tui/test/chat-simple.ts +129 -0
- package/pi.dev-src/pi-mono/tui/test/editor.test.ts +3812 -0
- package/pi.dev-src/pi-mono/tui/test/fuzzy.test.ts +98 -0
- package/pi.dev-src/pi-mono/tui/test/image-test.ts +56 -0
- package/pi.dev-src/pi-mono/tui/test/input.test.ts +580 -0
- package/pi.dev-src/pi-mono/tui/test/key-tester.ts +105 -0
- package/pi.dev-src/pi-mono/tui/test/keybindings.test.ts +38 -0
- package/pi.dev-src/pi-mono/tui/test/keys.test.ts +614 -0
- package/pi.dev-src/pi-mono/tui/test/markdown.test.ts +1236 -0
- package/pi.dev-src/pi-mono/tui/test/overlay-non-capturing.test.ts +609 -0
- package/pi.dev-src/pi-mono/tui/test/overlay-options.test.ts +538 -0
- package/pi.dev-src/pi-mono/tui/test/overlay-short-content.test.ts +56 -0
- package/pi.dev-src/pi-mono/tui/test/regression-regional-indicator-width.test.ts +52 -0
- package/pi.dev-src/pi-mono/tui/test/select-list.test.ts +116 -0
- package/pi.dev-src/pi-mono/tui/test/stdin-buffer.test.ts +422 -0
- package/pi.dev-src/pi-mono/tui/test/terminal-image.test.ts +279 -0
- package/pi.dev-src/pi-mono/tui/test/test-themes.ts +38 -0
- package/pi.dev-src/pi-mono/tui/test/truncate-to-width.test.ts +62 -0
- package/pi.dev-src/pi-mono/tui/test/truncated-text.test.ts +129 -0
- package/pi.dev-src/pi-mono/tui/test/tui-cell-size-input.test.ts +81 -0
- package/pi.dev-src/pi-mono/tui/test/tui-overlay-style-leak.test.ts +72 -0
- package/pi.dev-src/pi-mono/tui/test/tui-render.test.ts +509 -0
- package/pi.dev-src/pi-mono/tui/test/viewport-overwrite-repro.ts +106 -0
- package/pi.dev-src/pi-mono/tui/test/virtual-terminal.ts +218 -0
- package/pi.dev-src/pi-mono/tui/test/wrap-ansi.test.ts +207 -0
- package/pi.dev-src/pi-mono/tui/vitest.config.ts +7 -0
- package/pi.dev-src/pi-mono/web-ui/example/index.html +13 -0
- package/pi.dev-src/pi-mono/web-ui/example/src/app.css +1 -0
- package/pi.dev-src/pi-mono/web-ui/example/src/custom-messages.ts +99 -0
- package/pi.dev-src/pi-mono/web-ui/example/src/main.ts +421 -0
- package/pi.dev-src/pi-mono/web-ui/example/tsconfig.json +23 -0
- package/pi.dev-src/pi-mono/web-ui/example/vite.config.ts +6 -0
- package/pi.dev-src/pi-mono/web-ui/scripts/count-prompt-tokens.ts +88 -0
- package/pi.dev-src/pi-mono/web-ui/src/ChatPanel.ts +209 -0
- package/pi.dev-src/pi-mono/web-ui/src/app.css +68 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/AgentInterface.ts +403 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/AttachmentTile.ts +107 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/ConsoleBlock.ts +72 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/CustomProviderCard.ts +100 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/ExpandableSection.ts +46 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/Input.ts +113 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/MessageEditor.ts +405 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/MessageList.ts +98 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/Messages.ts +383 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/ProviderKeyInput.ts +153 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/SandboxedIframe.ts +626 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/StreamingMessageContainer.ts +103 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/ThinkingBlock.ts +43 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/message-renderer-registry.ts +28 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ArtifactsRuntimeProvider.ts +220 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/AttachmentsRuntimeProvider.ts +66 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/ConsoleRuntimeProvider.ts +186 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/FileDownloadRuntimeProvider.ts +110 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageBridge.ts +82 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/RuntimeMessageRouter.ts +216 -0
- package/pi.dev-src/pi-mono/web-ui/src/components/sandbox/SandboxRuntimeProvider.ts +52 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ApiKeyPromptDialog.ts +75 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/AttachmentOverlay.ts +636 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/CustomProviderDialog.ts +274 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ModelSelector.ts +370 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/PersistentStorageDialog.ts +144 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/ProvidersModelsTab.ts +212 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/SessionListDialog.ts +150 -0
- package/pi.dev-src/pi-mono/web-ui/src/dialogs/SettingsDialog.ts +218 -0
- package/pi.dev-src/pi-mono/web-ui/src/index.ts +120 -0
- package/pi.dev-src/pi-mono/web-ui/src/prompts/prompts.ts +282 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/app-storage.ts +60 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/backends/indexeddb-storage-backend.ts +193 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/store.ts +33 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/custom-providers-store.ts +62 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/provider-keys-store.ts +33 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/sessions-store.ts +136 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/stores/settings-store.ts +34 -0
- package/pi.dev-src/pi-mono/web-ui/src/storage/types.ts +206 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactElement.ts +14 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ArtifactPill.ts +26 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/Console.ts +93 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/DocxArtifact.ts +213 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ExcelArtifact.ts +231 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/GenericArtifact.ts +117 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/HtmlArtifact.ts +195 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/ImageArtifact.ts +116 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/MarkdownArtifact.ts +82 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/PdfArtifact.ts +201 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/SvgArtifact.ts +119 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/TextArtifact.ts +148 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts-tool-renderer.ts +310 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/artifacts.ts +713 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/artifacts/index.ts +7 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/extract-document.ts +275 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/index.ts +46 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/javascript-repl.ts +293 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderer-registry.ts +130 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/BashRenderer.ts +52 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/CalculateRenderer.ts +58 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/DefaultRenderer.ts +103 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/renderers/GetCurrentTimeRenderer.ts +92 -0
- package/pi.dev-src/pi-mono/web-ui/src/tools/types.ts +15 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/attachment-utils.ts +472 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/auth-token.ts +22 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/format.ts +42 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/i18n.ts +653 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/model-discovery.ts +277 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/proxy-utils.ts +139 -0
- package/pi.dev-src/pi-mono/web-ui/src/utils/test-sessions.ts +2357 -0
- package/pi.dev-src/pi-mono/web-ui/tsconfig.json +7 -0
- package/scripts/lib/extension-debug-harness.ts +3 -10
- package/scripts/lib/recording-extension-api.ts +71 -2
- package/scripts/pi-usereq-debug.sh +1 -1
- package/scripts/tool-args-to-params.ts +4 -15
- package/src/cli.ts +24 -68
- package/src/core/agent-tool-json.ts +53 -239
- package/src/core/compress-payload.ts +4 -74
- package/src/core/compress.ts +26 -15
- package/src/core/config.ts +546 -65
- package/src/core/debug-runtime.ts +542 -0
- package/src/core/extension-status.ts +324 -202
- package/src/core/find-constructs.ts +3 -3
- package/src/core/find-payload.ts +26 -132
- package/src/core/path-context.ts +346 -81
- package/src/core/pi-notify.ts +585 -315
- package/src/core/pi-usereq-tools.ts +57 -19
- package/src/core/prompt-command-catalog.ts +46 -0
- package/src/core/prompt-command-runtime.ts +1650 -0
- package/src/core/prompt-command-state.ts +211 -0
- package/src/core/prompts.ts +173 -41
- package/src/core/reference-payload.ts +5 -63
- package/src/core/resources.ts +61 -5
- package/src/core/settings-menu.ts +33 -7
- package/src/core/source-analyzer.ts +27 -7
- package/src/core/token-counter.ts +61 -79
- package/src/core/tool-runner.ts +38 -317
- package/src/index.ts +2629 -1220
- package/src/resources/images/favicon.svg +21 -0
- package/src/resources/images/pi.dev.png +0 -0
- package/src/resources/instructions/git_commit.md +16 -0
- package/src/resources/instructions/git_read-only.md +2 -0
- package/src/resources/prompts/analyze.md +12 -13
- package/src/resources/prompts/change.md +21 -59
- package/src/resources/prompts/check.md +14 -16
- package/src/resources/prompts/cover.md +21 -59
- package/src/resources/prompts/create.md +5 -4
- package/src/resources/prompts/fix.md +20 -58
- package/src/resources/prompts/flowchart.md +14 -49
- package/src/resources/prompts/implement.md +14 -50
- package/src/resources/prompts/new.md +20 -58
- package/src/resources/prompts/readme.md +14 -50
- package/src/resources/prompts/recreate.md +14 -45
- package/src/resources/prompts/refactor.md +20 -58
- package/src/resources/prompts/references.md +7 -43
- package/src/resources/prompts/renumber.md +8 -39
- package/src/resources/prompts/workflow.md +14 -50
- package/src/resources/prompts/write.md +5 -4
- package/tests/attended-results-scenarios.ts +30 -136
- package/tests/cli-command-option-parity.test.ts +148 -192
- package/tests/debug-extension-harness.test.ts +74 -73
- package/tests/extension-registration.test.ts +3626 -685
- package/tests/fixtures_attended_results/project/compress-line-numbers.json +1 -1
- package/tests/fixtures_attended_results/project/compress.json +1 -1
- package/tests/fixtures_attended_results/project/find-line-numbers.json +1 -1
- package/tests/fixtures_attended_results/project/find.json +1 -1
- package/tests/fixtures_attended_results/project/references.json +2 -2
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_go.go.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_go.go.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-find/fixture_go.go.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_go.go.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_c.c.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_cpp.cpp.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_csharp.cs.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_elixir.ex.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_go.go.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_haskell.hs.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_java.java.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_javascript.js.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_kotlin.kt.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_lua.lua.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_perl.pl.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_php.php.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_python.py.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_ruby.rb.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_rust.rs.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_scala.scala.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_shell.sh.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_swift.swift.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_typescript.ts.json +1 -1
- package/tests/fixtures_attended_results/standalone/files-references/fixture_zig.zig.json +1 -1
- package/tests/helpers.ts +24 -15
- package/tests/oracle-project.test.ts +29 -30
- package/tests/oracle-standalone.test.ts +27 -1
- package/tests/prompt-rendering.test.ts +40 -9
- package/tests/python_oracle_stubs/tiktoken.py +76 -0
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
import { writeFileSync } from "fs";
|
|
4
|
+
import { join, dirname } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { Api, KnownProvider, Model, type OpenAICompletionsCompat } from "../src/types.js";
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
const packageRoot = join(__dirname, "..");
|
|
11
|
+
|
|
12
|
+
interface ModelsDevModel {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
tool_call?: boolean;
|
|
16
|
+
reasoning?: boolean;
|
|
17
|
+
limit?: {
|
|
18
|
+
context?: number;
|
|
19
|
+
output?: number;
|
|
20
|
+
};
|
|
21
|
+
cost?: {
|
|
22
|
+
input?: number;
|
|
23
|
+
output?: number;
|
|
24
|
+
cache_read?: number;
|
|
25
|
+
cache_write?: number;
|
|
26
|
+
};
|
|
27
|
+
modalities?: {
|
|
28
|
+
input?: string[];
|
|
29
|
+
};
|
|
30
|
+
provider?: {
|
|
31
|
+
npm?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface AiGatewayModel {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
context_window?: number;
|
|
39
|
+
max_tokens?: number;
|
|
40
|
+
tags?: string[];
|
|
41
|
+
pricing?: {
|
|
42
|
+
input?: string | number;
|
|
43
|
+
output?: string | number;
|
|
44
|
+
input_cache_read?: string | number;
|
|
45
|
+
input_cache_write?: string | number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const COPILOT_STATIC_HEADERS = {
|
|
50
|
+
"User-Agent": "GitHubCopilotChat/0.35.0",
|
|
51
|
+
"Editor-Version": "vscode/1.107.0",
|
|
52
|
+
"Editor-Plugin-Version": "copilot-chat/0.35.0",
|
|
53
|
+
"Copilot-Integration-Id": "vscode-chat",
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
const AI_GATEWAY_MODELS_URL = "https://ai-gateway.vercel.sh/v1";
|
|
57
|
+
const AI_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
|
|
58
|
+
const ZAI_TOOL_STREAM_UNSUPPORTED_MODELS = new Set(["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v"]);
|
|
59
|
+
|
|
60
|
+
function getBedrockBaseUrl(modelId: string): string {
|
|
61
|
+
return modelId.startsWith("eu.")
|
|
62
|
+
? "https://bedrock-runtime.eu-central-1.amazonaws.com"
|
|
63
|
+
: "https://bedrock-runtime.us-east-1.amazonaws.com";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function fetchOpenRouterModels(): Promise<Model<any>[]> {
|
|
67
|
+
try {
|
|
68
|
+
console.log("Fetching models from OpenRouter API...");
|
|
69
|
+
const response = await fetch("https://openrouter.ai/api/v1/models");
|
|
70
|
+
const data = await response.json();
|
|
71
|
+
|
|
72
|
+
const models: Model<any>[] = [];
|
|
73
|
+
|
|
74
|
+
for (const model of data.data) {
|
|
75
|
+
// Only include models that support tools
|
|
76
|
+
if (!model.supported_parameters?.includes("tools")) continue;
|
|
77
|
+
|
|
78
|
+
// Parse provider from model ID
|
|
79
|
+
let provider: KnownProvider = "openrouter";
|
|
80
|
+
let modelKey = model.id;
|
|
81
|
+
|
|
82
|
+
modelKey = model.id; // Keep full ID for OpenRouter
|
|
83
|
+
|
|
84
|
+
// Parse input modalities
|
|
85
|
+
const input: ("text" | "image")[] = ["text"];
|
|
86
|
+
if (model.architecture?.modality?.includes("image")) {
|
|
87
|
+
input.push("image");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Convert pricing from $/token to $/million tokens
|
|
91
|
+
const inputCost = parseFloat(model.pricing?.prompt || "0") * 1_000_000;
|
|
92
|
+
const outputCost = parseFloat(model.pricing?.completion || "0") * 1_000_000;
|
|
93
|
+
const cacheReadCost = parseFloat(model.pricing?.input_cache_read || "0") * 1_000_000;
|
|
94
|
+
const cacheWriteCost = parseFloat(model.pricing?.input_cache_write || "0") * 1_000_000;
|
|
95
|
+
|
|
96
|
+
const normalizedModel: Model<any> = {
|
|
97
|
+
id: modelKey,
|
|
98
|
+
name: model.name,
|
|
99
|
+
api: "openai-completions",
|
|
100
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
101
|
+
provider,
|
|
102
|
+
reasoning: model.supported_parameters?.includes("reasoning") || false,
|
|
103
|
+
input,
|
|
104
|
+
cost: {
|
|
105
|
+
input: inputCost,
|
|
106
|
+
output: outputCost,
|
|
107
|
+
cacheRead: cacheReadCost,
|
|
108
|
+
cacheWrite: cacheWriteCost,
|
|
109
|
+
},
|
|
110
|
+
contextWindow: model.context_length || 4096,
|
|
111
|
+
maxTokens: model.top_provider?.max_completion_tokens || 4096,
|
|
112
|
+
};
|
|
113
|
+
models.push(normalizedModel);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log(`Fetched ${models.length} tool-capable models from OpenRouter`);
|
|
117
|
+
return models;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error("Failed to fetch OpenRouter models:", error);
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function fetchAiGatewayModels(): Promise<Model<any>[]> {
|
|
125
|
+
try {
|
|
126
|
+
console.log("Fetching models from Vercel AI Gateway API...");
|
|
127
|
+
const response = await fetch(`${AI_GATEWAY_MODELS_URL}/models`);
|
|
128
|
+
const data = await response.json();
|
|
129
|
+
const models: Model<any>[] = [];
|
|
130
|
+
|
|
131
|
+
const toNumber = (value: string | number | undefined): number => {
|
|
132
|
+
if (typeof value === "number") {
|
|
133
|
+
return Number.isFinite(value) ? value : 0;
|
|
134
|
+
}
|
|
135
|
+
const parsed = parseFloat(value ?? "0");
|
|
136
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const items = Array.isArray(data.data) ? (data.data as AiGatewayModel[]) : [];
|
|
140
|
+
for (const model of items) {
|
|
141
|
+
const tags = Array.isArray(model.tags) ? model.tags : [];
|
|
142
|
+
// Only include models that support tools
|
|
143
|
+
if (!tags.includes("tool-use")) continue;
|
|
144
|
+
|
|
145
|
+
const input: ("text" | "image")[] = ["text"];
|
|
146
|
+
if (tags.includes("vision")) {
|
|
147
|
+
input.push("image");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const inputCost = toNumber(model.pricing?.input) * 1_000_000;
|
|
151
|
+
const outputCost = toNumber(model.pricing?.output) * 1_000_000;
|
|
152
|
+
const cacheReadCost = toNumber(model.pricing?.input_cache_read) * 1_000_000;
|
|
153
|
+
const cacheWriteCost = toNumber(model.pricing?.input_cache_write) * 1_000_000;
|
|
154
|
+
|
|
155
|
+
models.push({
|
|
156
|
+
id: model.id,
|
|
157
|
+
name: model.name || model.id,
|
|
158
|
+
api: "anthropic-messages",
|
|
159
|
+
baseUrl: AI_GATEWAY_BASE_URL,
|
|
160
|
+
provider: "vercel-ai-gateway",
|
|
161
|
+
reasoning: tags.includes("reasoning"),
|
|
162
|
+
input,
|
|
163
|
+
cost: {
|
|
164
|
+
input: inputCost,
|
|
165
|
+
output: outputCost,
|
|
166
|
+
cacheRead: cacheReadCost,
|
|
167
|
+
cacheWrite: cacheWriteCost,
|
|
168
|
+
},
|
|
169
|
+
contextWindow: model.context_window || 4096,
|
|
170
|
+
maxTokens: model.max_tokens || 4096,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
console.log(`Fetched ${models.length} tool-capable models from Vercel AI Gateway`);
|
|
175
|
+
return models;
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error("Failed to fetch Vercel AI Gateway models:", error);
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function loadModelsDevData(): Promise<Model<any>[]> {
|
|
183
|
+
try {
|
|
184
|
+
console.log("Fetching models from models.dev API...");
|
|
185
|
+
const response = await fetch("https://models.dev/api.json");
|
|
186
|
+
const data = await response.json();
|
|
187
|
+
|
|
188
|
+
const models: Model<any>[] = [];
|
|
189
|
+
|
|
190
|
+
// Process Amazon Bedrock models
|
|
191
|
+
if (data["amazon-bedrock"]?.models) {
|
|
192
|
+
for (const [modelId, model] of Object.entries(data["amazon-bedrock"].models)) {
|
|
193
|
+
const m = model as ModelsDevModel;
|
|
194
|
+
if (m.tool_call !== true) continue;
|
|
195
|
+
|
|
196
|
+
let id = modelId;
|
|
197
|
+
|
|
198
|
+
if (id.startsWith("ai21.jamba")) {
|
|
199
|
+
// These models doesn't support tool use in streaming mode
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (id.startsWith("mistral.mistral-7b-instruct-v0")) {
|
|
204
|
+
// These models doesn't support system messages
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
models.push({
|
|
209
|
+
id,
|
|
210
|
+
name: m.name || id,
|
|
211
|
+
api: "bedrock-converse-stream" as const,
|
|
212
|
+
provider: "amazon-bedrock" as const,
|
|
213
|
+
baseUrl: getBedrockBaseUrl(id),
|
|
214
|
+
reasoning: m.reasoning === true,
|
|
215
|
+
input: (m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"]) as ("text" | "image")[],
|
|
216
|
+
cost: {
|
|
217
|
+
input: m.cost?.input || 0,
|
|
218
|
+
output: m.cost?.output || 0,
|
|
219
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
220
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
221
|
+
},
|
|
222
|
+
contextWindow: m.limit?.context || 4096,
|
|
223
|
+
maxTokens: m.limit?.output || 4096,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Process Anthropic models
|
|
229
|
+
if (data.anthropic?.models) {
|
|
230
|
+
for (const [modelId, model] of Object.entries(data.anthropic.models)) {
|
|
231
|
+
const m = model as ModelsDevModel;
|
|
232
|
+
if (m.tool_call !== true) continue;
|
|
233
|
+
|
|
234
|
+
models.push({
|
|
235
|
+
id: modelId,
|
|
236
|
+
name: m.name || modelId,
|
|
237
|
+
api: "anthropic-messages",
|
|
238
|
+
provider: "anthropic",
|
|
239
|
+
baseUrl: "https://api.anthropic.com",
|
|
240
|
+
reasoning: m.reasoning === true,
|
|
241
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
242
|
+
cost: {
|
|
243
|
+
input: m.cost?.input || 0,
|
|
244
|
+
output: m.cost?.output || 0,
|
|
245
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
246
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
247
|
+
},
|
|
248
|
+
contextWindow: m.limit?.context || 4096,
|
|
249
|
+
maxTokens: m.limit?.output || 4096,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Process Google models
|
|
255
|
+
if (data.google?.models) {
|
|
256
|
+
for (const [modelId, model] of Object.entries(data.google.models)) {
|
|
257
|
+
const m = model as ModelsDevModel;
|
|
258
|
+
if (m.tool_call !== true) continue;
|
|
259
|
+
|
|
260
|
+
models.push({
|
|
261
|
+
id: modelId,
|
|
262
|
+
name: m.name || modelId,
|
|
263
|
+
api: "google-generative-ai",
|
|
264
|
+
provider: "google",
|
|
265
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
266
|
+
reasoning: m.reasoning === true,
|
|
267
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
268
|
+
cost: {
|
|
269
|
+
input: m.cost?.input || 0,
|
|
270
|
+
output: m.cost?.output || 0,
|
|
271
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
272
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
273
|
+
},
|
|
274
|
+
contextWindow: m.limit?.context || 4096,
|
|
275
|
+
maxTokens: m.limit?.output || 4096,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Process OpenAI models
|
|
281
|
+
if (data.openai?.models) {
|
|
282
|
+
for (const [modelId, model] of Object.entries(data.openai.models)) {
|
|
283
|
+
const m = model as ModelsDevModel;
|
|
284
|
+
if (m.tool_call !== true) continue;
|
|
285
|
+
|
|
286
|
+
models.push({
|
|
287
|
+
id: modelId,
|
|
288
|
+
name: m.name || modelId,
|
|
289
|
+
api: "openai-responses",
|
|
290
|
+
provider: "openai",
|
|
291
|
+
baseUrl: "https://api.openai.com/v1",
|
|
292
|
+
reasoning: m.reasoning === true,
|
|
293
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
294
|
+
cost: {
|
|
295
|
+
input: m.cost?.input || 0,
|
|
296
|
+
output: m.cost?.output || 0,
|
|
297
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
298
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
299
|
+
},
|
|
300
|
+
contextWindow: m.limit?.context || 4096,
|
|
301
|
+
maxTokens: m.limit?.output || 4096,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Process Groq models
|
|
307
|
+
if (data.groq?.models) {
|
|
308
|
+
for (const [modelId, model] of Object.entries(data.groq.models)) {
|
|
309
|
+
const m = model as ModelsDevModel;
|
|
310
|
+
if (m.tool_call !== true) continue;
|
|
311
|
+
|
|
312
|
+
models.push({
|
|
313
|
+
id: modelId,
|
|
314
|
+
name: m.name || modelId,
|
|
315
|
+
api: "openai-completions",
|
|
316
|
+
provider: "groq",
|
|
317
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
318
|
+
reasoning: m.reasoning === true,
|
|
319
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
320
|
+
cost: {
|
|
321
|
+
input: m.cost?.input || 0,
|
|
322
|
+
output: m.cost?.output || 0,
|
|
323
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
324
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
325
|
+
},
|
|
326
|
+
contextWindow: m.limit?.context || 4096,
|
|
327
|
+
maxTokens: m.limit?.output || 4096,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Process Cerebras models
|
|
333
|
+
if (data.cerebras?.models) {
|
|
334
|
+
for (const [modelId, model] of Object.entries(data.cerebras.models)) {
|
|
335
|
+
const m = model as ModelsDevModel;
|
|
336
|
+
if (m.tool_call !== true) continue;
|
|
337
|
+
|
|
338
|
+
models.push({
|
|
339
|
+
id: modelId,
|
|
340
|
+
name: m.name || modelId,
|
|
341
|
+
api: "openai-completions",
|
|
342
|
+
provider: "cerebras",
|
|
343
|
+
baseUrl: "https://api.cerebras.ai/v1",
|
|
344
|
+
reasoning: m.reasoning === true,
|
|
345
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
346
|
+
cost: {
|
|
347
|
+
input: m.cost?.input || 0,
|
|
348
|
+
output: m.cost?.output || 0,
|
|
349
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
350
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
351
|
+
},
|
|
352
|
+
contextWindow: m.limit?.context || 4096,
|
|
353
|
+
maxTokens: m.limit?.output || 4096,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Process xAi models
|
|
359
|
+
if (data.xai?.models) {
|
|
360
|
+
for (const [modelId, model] of Object.entries(data.xai.models)) {
|
|
361
|
+
const m = model as ModelsDevModel;
|
|
362
|
+
if (m.tool_call !== true) continue;
|
|
363
|
+
|
|
364
|
+
models.push({
|
|
365
|
+
id: modelId,
|
|
366
|
+
name: m.name || modelId,
|
|
367
|
+
api: "openai-completions",
|
|
368
|
+
provider: "xai",
|
|
369
|
+
baseUrl: "https://api.x.ai/v1",
|
|
370
|
+
reasoning: m.reasoning === true,
|
|
371
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
372
|
+
cost: {
|
|
373
|
+
input: m.cost?.input || 0,
|
|
374
|
+
output: m.cost?.output || 0,
|
|
375
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
376
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
377
|
+
},
|
|
378
|
+
contextWindow: m.limit?.context || 4096,
|
|
379
|
+
maxTokens: m.limit?.output || 4096,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Process zAi models
|
|
385
|
+
if (data["zai-coding-plan"]?.models) {
|
|
386
|
+
for (const [modelId, model] of Object.entries(data["zai-coding-plan"].models)) {
|
|
387
|
+
const m = model as ModelsDevModel;
|
|
388
|
+
if (m.tool_call !== true) continue;
|
|
389
|
+
const supportsImage = m.modalities?.input?.includes("image");
|
|
390
|
+
|
|
391
|
+
models.push({
|
|
392
|
+
id: modelId,
|
|
393
|
+
name: m.name || modelId,
|
|
394
|
+
api: "openai-completions",
|
|
395
|
+
provider: "zai",
|
|
396
|
+
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
|
397
|
+
reasoning: m.reasoning === true,
|
|
398
|
+
input: supportsImage ? ["text", "image"] : ["text"],
|
|
399
|
+
cost: {
|
|
400
|
+
input: m.cost?.input || 0,
|
|
401
|
+
output: m.cost?.output || 0,
|
|
402
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
403
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
404
|
+
},
|
|
405
|
+
compat: {
|
|
406
|
+
supportsDeveloperRole: false,
|
|
407
|
+
thinkingFormat: "zai",
|
|
408
|
+
...(!ZAI_TOOL_STREAM_UNSUPPORTED_MODELS.has(modelId) ? { zaiToolStream: true } : {}),
|
|
409
|
+
},
|
|
410
|
+
contextWindow: m.limit?.context || 4096,
|
|
411
|
+
maxTokens: m.limit?.output || 4096,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Process Mistral models
|
|
417
|
+
if (data.mistral?.models) {
|
|
418
|
+
for (const [modelId, model] of Object.entries(data.mistral.models)) {
|
|
419
|
+
const m = model as ModelsDevModel;
|
|
420
|
+
if (m.tool_call !== true) continue;
|
|
421
|
+
|
|
422
|
+
models.push({
|
|
423
|
+
id: modelId,
|
|
424
|
+
name: m.name || modelId,
|
|
425
|
+
api: "mistral-conversations",
|
|
426
|
+
provider: "mistral",
|
|
427
|
+
baseUrl: "https://api.mistral.ai",
|
|
428
|
+
reasoning: m.reasoning === true,
|
|
429
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
430
|
+
cost: {
|
|
431
|
+
input: m.cost?.input || 0,
|
|
432
|
+
output: m.cost?.output || 0,
|
|
433
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
434
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
435
|
+
},
|
|
436
|
+
contextWindow: m.limit?.context || 4096,
|
|
437
|
+
maxTokens: m.limit?.output || 4096,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Process Hugging Face models
|
|
443
|
+
if (data.huggingface?.models) {
|
|
444
|
+
for (const [modelId, model] of Object.entries(data.huggingface.models)) {
|
|
445
|
+
const m = model as ModelsDevModel;
|
|
446
|
+
if (m.tool_call !== true) continue;
|
|
447
|
+
|
|
448
|
+
models.push({
|
|
449
|
+
id: modelId,
|
|
450
|
+
name: m.name || modelId,
|
|
451
|
+
api: "openai-completions",
|
|
452
|
+
provider: "huggingface",
|
|
453
|
+
baseUrl: "https://router.huggingface.co/v1",
|
|
454
|
+
reasoning: m.reasoning === true,
|
|
455
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
456
|
+
cost: {
|
|
457
|
+
input: m.cost?.input || 0,
|
|
458
|
+
output: m.cost?.output || 0,
|
|
459
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
460
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
461
|
+
},
|
|
462
|
+
compat: {
|
|
463
|
+
supportsDeveloperRole: false,
|
|
464
|
+
},
|
|
465
|
+
contextWindow: m.limit?.context || 4096,
|
|
466
|
+
maxTokens: m.limit?.output || 4096,
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Process Fireworks models
|
|
472
|
+
if (data["fireworks-ai"]?.models) {
|
|
473
|
+
for (const [modelId, model] of Object.entries(data["fireworks-ai"].models)) {
|
|
474
|
+
const m = model as ModelsDevModel;
|
|
475
|
+
if (m.tool_call !== true) continue;
|
|
476
|
+
|
|
477
|
+
models.push({
|
|
478
|
+
id: modelId,
|
|
479
|
+
name: m.name || modelId,
|
|
480
|
+
api: "anthropic-messages",
|
|
481
|
+
provider: "fireworks",
|
|
482
|
+
// Fireworks Anthropic-compatible API - SDK appends /v1/messages
|
|
483
|
+
baseUrl: "https://api.fireworks.ai/inference",
|
|
484
|
+
reasoning: m.reasoning === true,
|
|
485
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
486
|
+
cost: {
|
|
487
|
+
input: m.cost?.input || 0,
|
|
488
|
+
output: m.cost?.output || 0,
|
|
489
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
490
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
491
|
+
},
|
|
492
|
+
contextWindow: m.limit?.context || 4096,
|
|
493
|
+
maxTokens: m.limit?.output || 4096,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Process OpenCode models (Zen and Go)
|
|
499
|
+
// API mapping based on provider.npm field:
|
|
500
|
+
// - @ai-sdk/openai → openai-responses
|
|
501
|
+
// - @ai-sdk/anthropic → anthropic-messages
|
|
502
|
+
// - @ai-sdk/google → google-generative-ai
|
|
503
|
+
// - null/undefined/@ai-sdk/openai-compatible → openai-completions
|
|
504
|
+
const opencodeVariants = [
|
|
505
|
+
{ key: "opencode", provider: "opencode", basePath: "https://opencode.ai/zen" },
|
|
506
|
+
{ key: "opencode-go", provider: "opencode-go", basePath: "https://opencode.ai/zen/go" },
|
|
507
|
+
] as const;
|
|
508
|
+
|
|
509
|
+
for (const variant of opencodeVariants) {
|
|
510
|
+
if (!data[variant.key]?.models) continue;
|
|
511
|
+
|
|
512
|
+
for (const [modelId, model] of Object.entries(data[variant.key].models)) {
|
|
513
|
+
const m = model as ModelsDevModel & { status?: string };
|
|
514
|
+
if (m.tool_call !== true) continue;
|
|
515
|
+
if (m.status === "deprecated") continue;
|
|
516
|
+
|
|
517
|
+
const npm = m.provider?.npm;
|
|
518
|
+
let api: Api;
|
|
519
|
+
let baseUrl: string;
|
|
520
|
+
let compat: OpenAICompletionsCompat | undefined;
|
|
521
|
+
|
|
522
|
+
if (npm === "@ai-sdk/openai") {
|
|
523
|
+
api = "openai-responses";
|
|
524
|
+
baseUrl = `${variant.basePath}/v1`;
|
|
525
|
+
} else if (npm === "@ai-sdk/anthropic") {
|
|
526
|
+
api = "anthropic-messages";
|
|
527
|
+
// Anthropic SDK appends /v1/messages to baseURL
|
|
528
|
+
baseUrl = variant.basePath;
|
|
529
|
+
} else if (npm === "@ai-sdk/google") {
|
|
530
|
+
api = "google-generative-ai";
|
|
531
|
+
baseUrl = `${variant.basePath}/v1`;
|
|
532
|
+
} else if (npm === "@ai-sdk/alibaba") {
|
|
533
|
+
api = "openai-completions";
|
|
534
|
+
baseUrl = `${variant.basePath}/v1`;
|
|
535
|
+
compat = { cacheControlFormat: "anthropic" };
|
|
536
|
+
} else {
|
|
537
|
+
// null, undefined, or @ai-sdk/openai-compatible
|
|
538
|
+
api = "openai-completions";
|
|
539
|
+
baseUrl = `${variant.basePath}/v1`;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
models.push({
|
|
543
|
+
id: modelId,
|
|
544
|
+
name: m.name || modelId,
|
|
545
|
+
api,
|
|
546
|
+
provider: variant.provider,
|
|
547
|
+
baseUrl,
|
|
548
|
+
reasoning: m.reasoning === true,
|
|
549
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
550
|
+
cost: {
|
|
551
|
+
input: m.cost?.input || 0,
|
|
552
|
+
output: m.cost?.output || 0,
|
|
553
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
554
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
555
|
+
},
|
|
556
|
+
...(compat ? { compat } : {}),
|
|
557
|
+
contextWindow: m.limit?.context || 4096,
|
|
558
|
+
maxTokens: m.limit?.output || 4096,
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// Process GitHub Copilot models
|
|
564
|
+
if (data["github-copilot"]?.models) {
|
|
565
|
+
for (const [modelId, model] of Object.entries(data["github-copilot"].models)) {
|
|
566
|
+
const m = model as ModelsDevModel & { status?: string };
|
|
567
|
+
if (m.tool_call !== true) continue;
|
|
568
|
+
if (m.status === "deprecated") continue;
|
|
569
|
+
|
|
570
|
+
// Claude 4.x models route to Anthropic Messages API
|
|
571
|
+
const isCopilotClaude4 = /^claude-(haiku|sonnet|opus)-4([.\-]|$)/.test(modelId);
|
|
572
|
+
// gpt-5 models require responses API, others use completions
|
|
573
|
+
const needsResponsesApi = modelId.startsWith("gpt-5") || modelId.startsWith("oswe");
|
|
574
|
+
|
|
575
|
+
const api: Api = isCopilotClaude4
|
|
576
|
+
? "anthropic-messages"
|
|
577
|
+
: needsResponsesApi
|
|
578
|
+
? "openai-responses"
|
|
579
|
+
: "openai-completions";
|
|
580
|
+
|
|
581
|
+
const copilotModel: Model<any> = {
|
|
582
|
+
id: modelId,
|
|
583
|
+
name: m.name || modelId,
|
|
584
|
+
api,
|
|
585
|
+
provider: "github-copilot",
|
|
586
|
+
baseUrl: "https://api.individual.githubcopilot.com",
|
|
587
|
+
reasoning: m.reasoning === true,
|
|
588
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
589
|
+
cost: {
|
|
590
|
+
input: m.cost?.input || 0,
|
|
591
|
+
output: m.cost?.output || 0,
|
|
592
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
593
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
594
|
+
},
|
|
595
|
+
contextWindow: m.limit?.context || 128000,
|
|
596
|
+
maxTokens: m.limit?.output || 8192,
|
|
597
|
+
headers: { ...COPILOT_STATIC_HEADERS },
|
|
598
|
+
// compat only applies to openai-completions
|
|
599
|
+
...(api === "openai-completions" ? {
|
|
600
|
+
compat: {
|
|
601
|
+
supportsStore: false,
|
|
602
|
+
supportsDeveloperRole: false,
|
|
603
|
+
supportsReasoningEffort: false,
|
|
604
|
+
},
|
|
605
|
+
} : {}),
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
models.push(copilotModel);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Process MiniMax models
|
|
613
|
+
const minimaxVariants = [
|
|
614
|
+
{ key: "minimax", provider: "minimax", baseUrl: "https://api.minimax.io/anthropic" },
|
|
615
|
+
{ key: "minimax-cn", provider: "minimax-cn", baseUrl: "https://api.minimaxi.com/anthropic" },
|
|
616
|
+
] as const;
|
|
617
|
+
|
|
618
|
+
for (const { key, provider, baseUrl } of minimaxVariants) {
|
|
619
|
+
if (data[key]?.models) {
|
|
620
|
+
for (const [modelId, model] of Object.entries(data[key].models)) {
|
|
621
|
+
const m = model as ModelsDevModel;
|
|
622
|
+
if (m.tool_call !== true) continue;
|
|
623
|
+
|
|
624
|
+
models.push({
|
|
625
|
+
id: modelId,
|
|
626
|
+
name: m.name || modelId,
|
|
627
|
+
api: "anthropic-messages",
|
|
628
|
+
provider,
|
|
629
|
+
// MiniMax's Anthropic-compatible API - SDK appends /v1/messages
|
|
630
|
+
baseUrl,
|
|
631
|
+
reasoning: m.reasoning === true,
|
|
632
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
633
|
+
cost: {
|
|
634
|
+
input: m.cost?.input || 0,
|
|
635
|
+
output: m.cost?.output || 0,
|
|
636
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
637
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
638
|
+
},
|
|
639
|
+
contextWindow: m.limit?.context || 4096,
|
|
640
|
+
maxTokens: m.limit?.output || 4096,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// Process Kimi For Coding models
|
|
647
|
+
if (data["kimi-for-coding"]?.models) {
|
|
648
|
+
const kimiModels = data["kimi-for-coding"].models as Record<string, ModelsDevModel>;
|
|
649
|
+
const hasCanonicalModel = Object.prototype.hasOwnProperty.call(kimiModels, "kimi-for-coding");
|
|
650
|
+
|
|
651
|
+
for (const [modelId, model] of Object.entries(kimiModels)) {
|
|
652
|
+
const m = model as ModelsDevModel;
|
|
653
|
+
if (m.tool_call !== true) continue;
|
|
654
|
+
// models.dev still exposes deprecated "k2p5" in some snapshots.
|
|
655
|
+
// Normalize to the canonical model id and drop duplicates when canonical exists.
|
|
656
|
+
if (modelId === "k2p5" && hasCanonicalModel) continue;
|
|
657
|
+
|
|
658
|
+
const normalizedId = modelId === "k2p5" ? "kimi-for-coding" : modelId;
|
|
659
|
+
const normalizedName = modelId === "k2p5" ? "Kimi For Coding" : m.name || normalizedId;
|
|
660
|
+
|
|
661
|
+
models.push({
|
|
662
|
+
id: normalizedId,
|
|
663
|
+
name: normalizedName,
|
|
664
|
+
api: "anthropic-messages",
|
|
665
|
+
provider: "kimi-coding",
|
|
666
|
+
// Kimi For Coding's Anthropic-compatible API - SDK appends /v1/messages
|
|
667
|
+
baseUrl: "https://api.kimi.com/coding",
|
|
668
|
+
reasoning: m.reasoning === true,
|
|
669
|
+
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
|
670
|
+
cost: {
|
|
671
|
+
input: m.cost?.input || 0,
|
|
672
|
+
output: m.cost?.output || 0,
|
|
673
|
+
cacheRead: m.cost?.cache_read || 0,
|
|
674
|
+
cacheWrite: m.cost?.cache_write || 0,
|
|
675
|
+
},
|
|
676
|
+
contextWindow: m.limit?.context || 4096,
|
|
677
|
+
maxTokens: m.limit?.output || 4096,
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
console.log(`Loaded ${models.length} tool-capable models from models.dev`);
|
|
683
|
+
return models;
|
|
684
|
+
} catch (error) {
|
|
685
|
+
console.error("Failed to load models.dev data:", error);
|
|
686
|
+
return [];
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
async function generateModels() {
|
|
691
|
+
// Fetch models from both sources
|
|
692
|
+
// models.dev: Anthropic, Google, OpenAI, Groq, Cerebras
|
|
693
|
+
// OpenRouter: xAI and other providers (excluding Anthropic, Google, OpenAI)
|
|
694
|
+
// AI Gateway: OpenAI-compatible catalog with tool-capable models
|
|
695
|
+
const modelsDevModels = await loadModelsDevData();
|
|
696
|
+
const openRouterModels = await fetchOpenRouterModels();
|
|
697
|
+
const aiGatewayModels = await fetchAiGatewayModels();
|
|
698
|
+
|
|
699
|
+
// Combine models (models.dev has priority)
|
|
700
|
+
const allModels = [...modelsDevModels, ...openRouterModels, ...aiGatewayModels].filter(
|
|
701
|
+
(model) =>
|
|
702
|
+
!((model.provider === "opencode" || model.provider === "opencode-go") && model.id === "gpt-5.3-codex-spark"),
|
|
703
|
+
);
|
|
704
|
+
|
|
705
|
+
// Fix incorrect cache pricing for Claude Opus 4.5 from models.dev
|
|
706
|
+
// models.dev has 3x the correct pricing (1.5/18.75 instead of 0.5/6.25)
|
|
707
|
+
const opus45 = allModels.find(m => m.provider === "anthropic" && m.id === "claude-opus-4-5");
|
|
708
|
+
if (opus45) {
|
|
709
|
+
opus45.cost.cacheRead = 0.5;
|
|
710
|
+
opus45.cost.cacheWrite = 6.25;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// Temporary overrides until upstream model metadata is corrected.
|
|
714
|
+
for (const candidate of allModels) {
|
|
715
|
+
if (candidate.provider === "amazon-bedrock" && candidate.id.includes("anthropic.claude-opus-4-6-v1")) {
|
|
716
|
+
candidate.cost.cacheRead = 0.5;
|
|
717
|
+
candidate.cost.cacheWrite = 6.25;
|
|
718
|
+
}
|
|
719
|
+
if (
|
|
720
|
+
(candidate.provider === "anthropic" ||
|
|
721
|
+
candidate.provider === "opencode" ||
|
|
722
|
+
candidate.provider === "opencode-go" ||
|
|
723
|
+
candidate.provider === "github-copilot") &&
|
|
724
|
+
(candidate.id === "claude-opus-4-6" ||
|
|
725
|
+
candidate.id === "claude-sonnet-4-6" ||
|
|
726
|
+
candidate.id === "claude-opus-4.6" ||
|
|
727
|
+
candidate.id === "claude-sonnet-4.6")
|
|
728
|
+
) {
|
|
729
|
+
candidate.contextWindow = 1000000;
|
|
730
|
+
}
|
|
731
|
+
if (
|
|
732
|
+
candidate.provider === "google-antigravity" &&
|
|
733
|
+
(candidate.id === "claude-opus-4-6-thinking" || candidate.id === "claude-sonnet-4-6")
|
|
734
|
+
) {
|
|
735
|
+
candidate.contextWindow = 1000000;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// OpenCode variants list Claude Sonnet 4/4.5 with 1M context, actual limit is 200K
|
|
739
|
+
if (
|
|
740
|
+
(candidate.provider === "opencode" || candidate.provider === "opencode-go") &&
|
|
741
|
+
(candidate.id === "claude-sonnet-4-5" || candidate.id === "claude-sonnet-4")
|
|
742
|
+
) {
|
|
743
|
+
candidate.contextWindow = 200000;
|
|
744
|
+
}
|
|
745
|
+
if ((candidate.provider === "opencode" || candidate.provider === "opencode-go") && candidate.id === "gpt-5.4") {
|
|
746
|
+
candidate.contextWindow = 272000;
|
|
747
|
+
candidate.maxTokens = 128000;
|
|
748
|
+
}
|
|
749
|
+
if (candidate.provider === "openai" && candidate.id === "gpt-5.4") {
|
|
750
|
+
candidate.contextWindow = 272000;
|
|
751
|
+
candidate.maxTokens = 128000;
|
|
752
|
+
}
|
|
753
|
+
// Keep selected OpenRouter model metadata stable until upstream settles.
|
|
754
|
+
if (candidate.provider === "openrouter" && candidate.id === "moonshotai/kimi-k2.5") {
|
|
755
|
+
candidate.cost.input = 0.41;
|
|
756
|
+
candidate.cost.output = 2.06;
|
|
757
|
+
candidate.cost.cacheRead = 0.07;
|
|
758
|
+
candidate.maxTokens = 4096;
|
|
759
|
+
}
|
|
760
|
+
if (candidate.provider === "openrouter" && candidate.id === "z-ai/glm-5") {
|
|
761
|
+
candidate.cost.input = 0.6;
|
|
762
|
+
candidate.cost.output = 1.9;
|
|
763
|
+
candidate.cost.cacheRead = 0.119;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
// Add missing EU Opus 4.6 profile
|
|
770
|
+
if (!allModels.some((m) => m.provider === "amazon-bedrock" && m.id === "eu.anthropic.claude-opus-4-6-v1")) {
|
|
771
|
+
allModels.push({
|
|
772
|
+
id: "eu.anthropic.claude-opus-4-6-v1",
|
|
773
|
+
name: "Claude Opus 4.6 (EU)",
|
|
774
|
+
api: "bedrock-converse-stream",
|
|
775
|
+
provider: "amazon-bedrock",
|
|
776
|
+
baseUrl: getBedrockBaseUrl("eu.anthropic.claude-opus-4-6-v1"),
|
|
777
|
+
reasoning: true,
|
|
778
|
+
input: ["text", "image"],
|
|
779
|
+
cost: {
|
|
780
|
+
input: 5,
|
|
781
|
+
output: 25,
|
|
782
|
+
cacheRead: 0.5,
|
|
783
|
+
cacheWrite: 6.25,
|
|
784
|
+
},
|
|
785
|
+
contextWindow: 200000,
|
|
786
|
+
maxTokens: 128000,
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// Add missing Claude Opus 4.6
|
|
791
|
+
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-opus-4-6")) {
|
|
792
|
+
allModels.push({
|
|
793
|
+
id: "claude-opus-4-6",
|
|
794
|
+
name: "Claude Opus 4.6",
|
|
795
|
+
api: "anthropic-messages",
|
|
796
|
+
baseUrl: "https://api.anthropic.com",
|
|
797
|
+
provider: "anthropic",
|
|
798
|
+
reasoning: true,
|
|
799
|
+
input: ["text", "image"],
|
|
800
|
+
cost: {
|
|
801
|
+
input: 5,
|
|
802
|
+
output: 25,
|
|
803
|
+
cacheRead: 0.5,
|
|
804
|
+
cacheWrite: 6.25,
|
|
805
|
+
},
|
|
806
|
+
contextWindow: 1000000,
|
|
807
|
+
maxTokens: 128000,
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// Add missing Claude Opus 4.7
|
|
812
|
+
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-opus-4-7")) {
|
|
813
|
+
allModels.push({
|
|
814
|
+
id: "claude-opus-4-7",
|
|
815
|
+
name: "Claude Opus 4.7",
|
|
816
|
+
api: "anthropic-messages",
|
|
817
|
+
baseUrl: "https://api.anthropic.com",
|
|
818
|
+
provider: "anthropic",
|
|
819
|
+
reasoning: true,
|
|
820
|
+
input: ["text", "image"],
|
|
821
|
+
cost: {
|
|
822
|
+
input: 5,
|
|
823
|
+
output: 25,
|
|
824
|
+
cacheRead: 0.5,
|
|
825
|
+
cacheWrite: 6.25,
|
|
826
|
+
},
|
|
827
|
+
contextWindow: 1000000,
|
|
828
|
+
maxTokens: 128000,
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// Add missing Claude Sonnet 4.6
|
|
833
|
+
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-sonnet-4-6")) {
|
|
834
|
+
allModels.push({
|
|
835
|
+
id: "claude-sonnet-4-6",
|
|
836
|
+
name: "Claude Sonnet 4.6",
|
|
837
|
+
api: "anthropic-messages",
|
|
838
|
+
baseUrl: "https://api.anthropic.com",
|
|
839
|
+
provider: "anthropic",
|
|
840
|
+
reasoning: true,
|
|
841
|
+
input: ["text", "image"],
|
|
842
|
+
cost: {
|
|
843
|
+
input: 3,
|
|
844
|
+
output: 15,
|
|
845
|
+
cacheRead: 0.3,
|
|
846
|
+
cacheWrite: 3.75,
|
|
847
|
+
},
|
|
848
|
+
contextWindow: 1000000,
|
|
849
|
+
maxTokens: 64000,
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// Add missing Gemini 3.1 Flash Lite Preview until models.dev includes it.
|
|
854
|
+
if (!allModels.some((m) => m.provider === "google" && m.id === "gemini-3.1-flash-lite-preview")) {
|
|
855
|
+
allModels.push({
|
|
856
|
+
id: "gemini-3.1-flash-lite-preview",
|
|
857
|
+
name: "Gemini 3.1 Flash Lite Preview",
|
|
858
|
+
api: "google-generative-ai",
|
|
859
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
860
|
+
provider: "google",
|
|
861
|
+
reasoning: true,
|
|
862
|
+
input: ["text", "image"],
|
|
863
|
+
cost: {
|
|
864
|
+
input: 0,
|
|
865
|
+
output: 0,
|
|
866
|
+
cacheRead: 0,
|
|
867
|
+
cacheWrite: 0,
|
|
868
|
+
},
|
|
869
|
+
contextWindow: 1048576,
|
|
870
|
+
maxTokens: 65536,
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// Add missing gpt models
|
|
875
|
+
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5-chat-latest")) {
|
|
876
|
+
allModels.push({
|
|
877
|
+
id: "gpt-5-chat-latest",
|
|
878
|
+
name: "GPT-5 Chat Latest",
|
|
879
|
+
api: "openai-responses",
|
|
880
|
+
baseUrl: "https://api.openai.com/v1",
|
|
881
|
+
provider: "openai",
|
|
882
|
+
reasoning: false,
|
|
883
|
+
input: ["text", "image"],
|
|
884
|
+
cost: {
|
|
885
|
+
input: 1.25,
|
|
886
|
+
output: 10,
|
|
887
|
+
cacheRead: 0.125,
|
|
888
|
+
cacheWrite: 0,
|
|
889
|
+
},
|
|
890
|
+
contextWindow: 128000,
|
|
891
|
+
maxTokens: 16384,
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.1-codex")) {
|
|
896
|
+
allModels.push({
|
|
897
|
+
id: "gpt-5.1-codex",
|
|
898
|
+
name: "GPT-5.1 Codex",
|
|
899
|
+
api: "openai-responses",
|
|
900
|
+
baseUrl: "https://api.openai.com/v1",
|
|
901
|
+
provider: "openai",
|
|
902
|
+
reasoning: true,
|
|
903
|
+
input: ["text", "image"],
|
|
904
|
+
cost: {
|
|
905
|
+
input: 1.25,
|
|
906
|
+
output: 5,
|
|
907
|
+
cacheRead: 0.125,
|
|
908
|
+
cacheWrite: 1.25,
|
|
909
|
+
},
|
|
910
|
+
contextWindow: 400000,
|
|
911
|
+
maxTokens: 128000,
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.1-codex-max")) {
|
|
916
|
+
allModels.push({
|
|
917
|
+
id: "gpt-5.1-codex-max",
|
|
918
|
+
name: "GPT-5.1 Codex Max",
|
|
919
|
+
api: "openai-responses",
|
|
920
|
+
baseUrl: "https://api.openai.com/v1",
|
|
921
|
+
provider: "openai",
|
|
922
|
+
reasoning: true,
|
|
923
|
+
input: ["text", "image"],
|
|
924
|
+
cost: {
|
|
925
|
+
input: 1.25,
|
|
926
|
+
output: 10,
|
|
927
|
+
cacheRead: 0.125,
|
|
928
|
+
cacheWrite: 0,
|
|
929
|
+
},
|
|
930
|
+
contextWindow: 400000,
|
|
931
|
+
maxTokens: 128000,
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.3-codex-spark")) {
|
|
936
|
+
allModels.push({
|
|
937
|
+
id: "gpt-5.3-codex-spark",
|
|
938
|
+
name: "GPT-5.3 Codex Spark",
|
|
939
|
+
api: "openai-responses",
|
|
940
|
+
baseUrl: "https://api.openai.com/v1",
|
|
941
|
+
provider: "openai",
|
|
942
|
+
reasoning: true,
|
|
943
|
+
input: ["text"],
|
|
944
|
+
cost: {
|
|
945
|
+
input: 0,
|
|
946
|
+
output: 0,
|
|
947
|
+
cacheRead: 0,
|
|
948
|
+
cacheWrite: 0,
|
|
949
|
+
},
|
|
950
|
+
contextWindow: 128000,
|
|
951
|
+
maxTokens: 16384,
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// Add missing GitHub Copilot GPT-5.3 models until models.dev includes them.
|
|
956
|
+
const copilotBaseModel = allModels.find(
|
|
957
|
+
(m) => m.provider === "github-copilot" && m.id === "gpt-5.2-codex",
|
|
958
|
+
);
|
|
959
|
+
if (copilotBaseModel) {
|
|
960
|
+
if (!allModels.some((m) => m.provider === "github-copilot" && m.id === "gpt-5.3-codex")) {
|
|
961
|
+
allModels.push({
|
|
962
|
+
...copilotBaseModel,
|
|
963
|
+
id: "gpt-5.3-codex",
|
|
964
|
+
name: "GPT-5.3 Codex",
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
if (!allModels.some((m) => m.provider === "openai" && m.id === "gpt-5.4")) {
|
|
970
|
+
allModels.push({
|
|
971
|
+
id: "gpt-5.4",
|
|
972
|
+
name: "GPT-5.4",
|
|
973
|
+
api: "openai-responses",
|
|
974
|
+
baseUrl: "https://api.openai.com/v1",
|
|
975
|
+
provider: "openai",
|
|
976
|
+
reasoning: true,
|
|
977
|
+
input: ["text", "image"],
|
|
978
|
+
cost: {
|
|
979
|
+
input: 2.5,
|
|
980
|
+
output: 15,
|
|
981
|
+
cacheRead: 0.25,
|
|
982
|
+
cacheWrite: 0,
|
|
983
|
+
},
|
|
984
|
+
contextWindow: 272000,
|
|
985
|
+
maxTokens: 128000,
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const minimaxDirectSupportedIds = new Set(["MiniMax-M2.7", "MiniMax-M2.7-highspeed"]);
|
|
990
|
+
|
|
991
|
+
for (const candidate of allModels) {
|
|
992
|
+
if (
|
|
993
|
+
(candidate.provider === "minimax" || candidate.provider === "minimax-cn") &&
|
|
994
|
+
minimaxDirectSupportedIds.has(candidate.id)
|
|
995
|
+
) {
|
|
996
|
+
candidate.contextWindow = 204800;
|
|
997
|
+
candidate.maxTokens = 131072;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
for (let i = allModels.length - 1; i >= 0; i--) {
|
|
1002
|
+
const candidate = allModels[i];
|
|
1003
|
+
if (
|
|
1004
|
+
(candidate.provider === "minimax" || candidate.provider === "minimax-cn") &&
|
|
1005
|
+
!minimaxDirectSupportedIds.has(candidate.id)
|
|
1006
|
+
) {
|
|
1007
|
+
allModels.splice(i, 1);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// OpenAI Codex (ChatGPT OAuth) models
|
|
1012
|
+
// NOTE: These are not fetched from models.dev; we keep a small, explicit list to avoid aliases.
|
|
1013
|
+
// Context window is based on observed server limits (400s above ~272k), not marketing numbers.
|
|
1014
|
+
const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
1015
|
+
const CODEX_CONTEXT = 272000;
|
|
1016
|
+
const CODEX_MAX_TOKENS = 128000;
|
|
1017
|
+
const codexModels: Model<"openai-codex-responses">[] = [
|
|
1018
|
+
{
|
|
1019
|
+
id: "gpt-5.1",
|
|
1020
|
+
name: "GPT-5.1",
|
|
1021
|
+
api: "openai-codex-responses",
|
|
1022
|
+
provider: "openai-codex",
|
|
1023
|
+
baseUrl: CODEX_BASE_URL,
|
|
1024
|
+
reasoning: true,
|
|
1025
|
+
input: ["text", "image"],
|
|
1026
|
+
cost: { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 0 },
|
|
1027
|
+
contextWindow: CODEX_CONTEXT,
|
|
1028
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
id: "gpt-5.1-codex-max",
|
|
1032
|
+
name: "GPT-5.1 Codex Max",
|
|
1033
|
+
api: "openai-codex-responses",
|
|
1034
|
+
provider: "openai-codex",
|
|
1035
|
+
baseUrl: CODEX_BASE_URL,
|
|
1036
|
+
reasoning: true,
|
|
1037
|
+
input: ["text", "image"],
|
|
1038
|
+
cost: { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 0 },
|
|
1039
|
+
contextWindow: CODEX_CONTEXT,
|
|
1040
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
id: "gpt-5.1-codex-mini",
|
|
1044
|
+
name: "GPT-5.1 Codex Mini",
|
|
1045
|
+
api: "openai-codex-responses",
|
|
1046
|
+
provider: "openai-codex",
|
|
1047
|
+
baseUrl: CODEX_BASE_URL,
|
|
1048
|
+
reasoning: true,
|
|
1049
|
+
input: ["text", "image"],
|
|
1050
|
+
cost: { input: 0.25, output: 2, cacheRead: 0.025, cacheWrite: 0 },
|
|
1051
|
+
contextWindow: CODEX_CONTEXT,
|
|
1052
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
id: "gpt-5.2",
|
|
1056
|
+
name: "GPT-5.2",
|
|
1057
|
+
api: "openai-codex-responses",
|
|
1058
|
+
provider: "openai-codex",
|
|
1059
|
+
baseUrl: CODEX_BASE_URL,
|
|
1060
|
+
reasoning: true,
|
|
1061
|
+
input: ["text", "image"],
|
|
1062
|
+
cost: { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 0 },
|
|
1063
|
+
contextWindow: CODEX_CONTEXT,
|
|
1064
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
id: "gpt-5.2-codex",
|
|
1068
|
+
name: "GPT-5.2 Codex",
|
|
1069
|
+
api: "openai-codex-responses",
|
|
1070
|
+
provider: "openai-codex",
|
|
1071
|
+
baseUrl: CODEX_BASE_URL,
|
|
1072
|
+
reasoning: true,
|
|
1073
|
+
input: ["text", "image"],
|
|
1074
|
+
cost: { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 0 },
|
|
1075
|
+
contextWindow: CODEX_CONTEXT,
|
|
1076
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
id: "gpt-5.3-codex",
|
|
1080
|
+
name: "GPT-5.3 Codex",
|
|
1081
|
+
api: "openai-codex-responses",
|
|
1082
|
+
provider: "openai-codex",
|
|
1083
|
+
baseUrl: CODEX_BASE_URL,
|
|
1084
|
+
reasoning: true,
|
|
1085
|
+
input: ["text", "image"],
|
|
1086
|
+
cost: { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 0 },
|
|
1087
|
+
contextWindow: CODEX_CONTEXT,
|
|
1088
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
id: "gpt-5.4",
|
|
1092
|
+
name: "GPT-5.4",
|
|
1093
|
+
api: "openai-codex-responses",
|
|
1094
|
+
provider: "openai-codex",
|
|
1095
|
+
baseUrl: CODEX_BASE_URL,
|
|
1096
|
+
reasoning: true,
|
|
1097
|
+
input: ["text", "image"],
|
|
1098
|
+
cost: { input: 2.5, output: 15, cacheRead: 0.25, cacheWrite: 0 },
|
|
1099
|
+
contextWindow: CODEX_CONTEXT,
|
|
1100
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
id: "gpt-5.4-mini",
|
|
1104
|
+
name: "GPT-5.4 Mini",
|
|
1105
|
+
api: "openai-codex-responses",
|
|
1106
|
+
provider: "openai-codex",
|
|
1107
|
+
baseUrl: CODEX_BASE_URL,
|
|
1108
|
+
reasoning: true,
|
|
1109
|
+
input: ["text", "image"],
|
|
1110
|
+
cost: { input: 0.75, output: 4.5, cacheRead: 0.075, cacheWrite: 0 },
|
|
1111
|
+
contextWindow: CODEX_CONTEXT,
|
|
1112
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
id: "gpt-5.3-codex-spark",
|
|
1116
|
+
name: "GPT-5.3 Codex Spark",
|
|
1117
|
+
api: "openai-codex-responses",
|
|
1118
|
+
provider: "openai-codex",
|
|
1119
|
+
baseUrl: CODEX_BASE_URL,
|
|
1120
|
+
reasoning: true,
|
|
1121
|
+
input: ["text"],
|
|
1122
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1123
|
+
contextWindow: 128000,
|
|
1124
|
+
maxTokens: CODEX_MAX_TOKENS,
|
|
1125
|
+
},
|
|
1126
|
+
];
|
|
1127
|
+
allModels.push(...codexModels);
|
|
1128
|
+
|
|
1129
|
+
// Add missing Grok models
|
|
1130
|
+
if (!allModels.some(m => m.provider === "xai" && m.id === "grok-code-fast-1")) {
|
|
1131
|
+
allModels.push({
|
|
1132
|
+
id: "grok-code-fast-1",
|
|
1133
|
+
name: "Grok Code Fast 1",
|
|
1134
|
+
api: "openai-completions",
|
|
1135
|
+
baseUrl: "https://api.x.ai/v1",
|
|
1136
|
+
provider: "xai",
|
|
1137
|
+
reasoning: false,
|
|
1138
|
+
input: ["text"],
|
|
1139
|
+
cost: {
|
|
1140
|
+
input: 0.2,
|
|
1141
|
+
output: 1.5,
|
|
1142
|
+
cacheRead: 0.02,
|
|
1143
|
+
cacheWrite: 0,
|
|
1144
|
+
},
|
|
1145
|
+
contextWindow: 32768,
|
|
1146
|
+
maxTokens: 8192,
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// Add "auto" alias for openrouter/auto
|
|
1151
|
+
if (!allModels.some(m => m.provider === "openrouter" && m.id === "auto")) {
|
|
1152
|
+
allModels.push({
|
|
1153
|
+
id: "auto",
|
|
1154
|
+
name: "Auto",
|
|
1155
|
+
api: "openai-completions",
|
|
1156
|
+
provider: "openrouter",
|
|
1157
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
1158
|
+
reasoning: true,
|
|
1159
|
+
input: ["text", "image"],
|
|
1160
|
+
cost: {
|
|
1161
|
+
// we dont know about the costs because OpenRouter auto routes to different models
|
|
1162
|
+
// and then charges you for the underlying used model
|
|
1163
|
+
input:0,
|
|
1164
|
+
output:0,
|
|
1165
|
+
cacheRead:0,
|
|
1166
|
+
cacheWrite:0,
|
|
1167
|
+
},
|
|
1168
|
+
contextWindow: 2000000,
|
|
1169
|
+
maxTokens: 30000,
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// Google Cloud Code Assist models (Gemini CLI)
|
|
1174
|
+
// Uses production endpoint, standard Gemini models only
|
|
1175
|
+
const CLOUD_CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
|
|
1176
|
+
const cloudCodeAssistModels: Model<"google-gemini-cli">[] = [
|
|
1177
|
+
{
|
|
1178
|
+
id: "gemini-2.5-pro",
|
|
1179
|
+
name: "Gemini 2.5 Pro (Cloud Code Assist)",
|
|
1180
|
+
api: "google-gemini-cli",
|
|
1181
|
+
provider: "google-gemini-cli",
|
|
1182
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1183
|
+
reasoning: true,
|
|
1184
|
+
input: ["text", "image"],
|
|
1185
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1186
|
+
contextWindow: 1048576,
|
|
1187
|
+
maxTokens: 65535,
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
id: "gemini-2.5-flash",
|
|
1191
|
+
name: "Gemini 2.5 Flash (Cloud Code Assist)",
|
|
1192
|
+
api: "google-gemini-cli",
|
|
1193
|
+
provider: "google-gemini-cli",
|
|
1194
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1195
|
+
reasoning: true,
|
|
1196
|
+
input: ["text", "image"],
|
|
1197
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1198
|
+
contextWindow: 1048576,
|
|
1199
|
+
maxTokens: 65535,
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
id: "gemini-2.0-flash",
|
|
1203
|
+
name: "Gemini 2.0 Flash (Cloud Code Assist)",
|
|
1204
|
+
api: "google-gemini-cli",
|
|
1205
|
+
provider: "google-gemini-cli",
|
|
1206
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1207
|
+
reasoning: false,
|
|
1208
|
+
input: ["text", "image"],
|
|
1209
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1210
|
+
contextWindow: 1048576,
|
|
1211
|
+
maxTokens: 8192,
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
id: "gemini-3-pro-preview",
|
|
1215
|
+
name: "Gemini 3 Pro Preview (Cloud Code Assist)",
|
|
1216
|
+
api: "google-gemini-cli",
|
|
1217
|
+
provider: "google-gemini-cli",
|
|
1218
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1219
|
+
reasoning: true,
|
|
1220
|
+
input: ["text", "image"],
|
|
1221
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1222
|
+
contextWindow: 1048576,
|
|
1223
|
+
maxTokens: 65535,
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
id: "gemini-3-flash-preview",
|
|
1227
|
+
name: "Gemini 3 Flash Preview (Cloud Code Assist)",
|
|
1228
|
+
api: "google-gemini-cli",
|
|
1229
|
+
provider: "google-gemini-cli",
|
|
1230
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1231
|
+
reasoning: true,
|
|
1232
|
+
input: ["text", "image"],
|
|
1233
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1234
|
+
contextWindow: 1048576,
|
|
1235
|
+
maxTokens: 65535,
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
id: "gemini-3.1-flash-lite-preview",
|
|
1239
|
+
name: "Gemini 3.1 Flash Lite Preview (Cloud Code Assist)",
|
|
1240
|
+
api: "google-gemini-cli",
|
|
1241
|
+
provider: "google-gemini-cli",
|
|
1242
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1243
|
+
reasoning: true,
|
|
1244
|
+
input: ["text", "image"],
|
|
1245
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1246
|
+
contextWindow: 1048576,
|
|
1247
|
+
maxTokens: 65535,
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
id: "gemini-3.1-pro-preview",
|
|
1251
|
+
name: "Gemini 3.1 Pro Preview (Cloud Code Assist)",
|
|
1252
|
+
api: "google-gemini-cli",
|
|
1253
|
+
provider: "google-gemini-cli",
|
|
1254
|
+
baseUrl: CLOUD_CODE_ASSIST_ENDPOINT,
|
|
1255
|
+
reasoning: true,
|
|
1256
|
+
input: ["text", "image"],
|
|
1257
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
1258
|
+
contextWindow: 1048576,
|
|
1259
|
+
maxTokens: 65535,
|
|
1260
|
+
},
|
|
1261
|
+
];
|
|
1262
|
+
allModels.push(...cloudCodeAssistModels);
|
|
1263
|
+
|
|
1264
|
+
// Antigravity models (Gemini 3, Claude, GPT-OSS via Google Cloud)
|
|
1265
|
+
// Uses sandbox endpoint and different OAuth credentials for access to additional models
|
|
1266
|
+
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
1267
|
+
const antigravityModels: Model<"google-gemini-cli">[] = [
|
|
1268
|
+
{
|
|
1269
|
+
id: "gemini-3.1-pro-high",
|
|
1270
|
+
name: "Gemini 3.1 Pro High (Antigravity)",
|
|
1271
|
+
api: "google-gemini-cli",
|
|
1272
|
+
provider: "google-antigravity",
|
|
1273
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1274
|
+
reasoning: true,
|
|
1275
|
+
input: ["text", "image"],
|
|
1276
|
+
// the Model type doesn't seem to support having extended-context costs, so I'm just using the pricing for <200k input
|
|
1277
|
+
cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.375 },
|
|
1278
|
+
contextWindow: 1048576,
|
|
1279
|
+
maxTokens: 65535,
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
id: "gemini-3.1-pro-low",
|
|
1283
|
+
name: "Gemini 3.1 Pro Low (Antigravity)",
|
|
1284
|
+
api: "google-gemini-cli",
|
|
1285
|
+
provider: "google-antigravity",
|
|
1286
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1287
|
+
reasoning: true,
|
|
1288
|
+
input: ["text", "image"],
|
|
1289
|
+
// the Model type doesn't seem to support having extended-context costs, so I'm just using the pricing for <200k input
|
|
1290
|
+
cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.375 },
|
|
1291
|
+
contextWindow: 1048576,
|
|
1292
|
+
maxTokens: 65535,
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
id: "gemini-3-flash",
|
|
1296
|
+
name: "Gemini 3 Flash (Antigravity)",
|
|
1297
|
+
api: "google-gemini-cli",
|
|
1298
|
+
provider: "google-antigravity",
|
|
1299
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1300
|
+
reasoning: true,
|
|
1301
|
+
input: ["text", "image"],
|
|
1302
|
+
cost: { input: 0.5, output: 3, cacheRead: 0.5, cacheWrite: 0 },
|
|
1303
|
+
contextWindow: 1048576,
|
|
1304
|
+
maxTokens: 65535,
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
id: "claude-sonnet-4-5",
|
|
1308
|
+
name: "Claude Sonnet 4.5 (Antigravity)",
|
|
1309
|
+
api: "google-gemini-cli",
|
|
1310
|
+
provider: "google-antigravity",
|
|
1311
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1312
|
+
reasoning: false,
|
|
1313
|
+
input: ["text", "image"],
|
|
1314
|
+
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
1315
|
+
contextWindow: 200000,
|
|
1316
|
+
maxTokens: 64000,
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
id: "claude-sonnet-4-5-thinking",
|
|
1320
|
+
name: "Claude Sonnet 4.5 Thinking (Antigravity)",
|
|
1321
|
+
api: "google-gemini-cli",
|
|
1322
|
+
provider: "google-antigravity",
|
|
1323
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1324
|
+
reasoning: true,
|
|
1325
|
+
input: ["text", "image"],
|
|
1326
|
+
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
1327
|
+
contextWindow: 200000,
|
|
1328
|
+
maxTokens: 64000,
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
id: "claude-opus-4-5-thinking",
|
|
1332
|
+
name: "Claude Opus 4.5 Thinking (Antigravity)",
|
|
1333
|
+
api: "google-gemini-cli",
|
|
1334
|
+
provider: "google-antigravity",
|
|
1335
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1336
|
+
reasoning: true,
|
|
1337
|
+
input: ["text", "image"],
|
|
1338
|
+
cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
1339
|
+
contextWindow: 200000,
|
|
1340
|
+
maxTokens: 64000,
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
id: "claude-opus-4-6-thinking",
|
|
1344
|
+
name: "Claude Opus 4.6 Thinking (Antigravity)",
|
|
1345
|
+
api: "google-gemini-cli",
|
|
1346
|
+
provider: "google-antigravity",
|
|
1347
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1348
|
+
reasoning: true,
|
|
1349
|
+
input: ["text", "image"],
|
|
1350
|
+
cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
1351
|
+
contextWindow: 200000,
|
|
1352
|
+
maxTokens: 128000,
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
id: "claude-sonnet-4-6",
|
|
1356
|
+
name: "Claude Sonnet 4.6 (Antigravity)",
|
|
1357
|
+
api: "google-gemini-cli",
|
|
1358
|
+
provider: "google-antigravity",
|
|
1359
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1360
|
+
reasoning: true,
|
|
1361
|
+
input: ["text", "image"],
|
|
1362
|
+
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
1363
|
+
contextWindow: 200000,
|
|
1364
|
+
maxTokens: 64000,
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
id: "gpt-oss-120b-medium",
|
|
1368
|
+
name: "GPT-OSS 120B Medium (Antigravity)",
|
|
1369
|
+
api: "google-gemini-cli",
|
|
1370
|
+
provider: "google-antigravity",
|
|
1371
|
+
baseUrl: ANTIGRAVITY_ENDPOINT,
|
|
1372
|
+
reasoning: false,
|
|
1373
|
+
input: ["text"],
|
|
1374
|
+
cost: { input: 0.09, output: 0.36, cacheRead: 0, cacheWrite: 0 },
|
|
1375
|
+
contextWindow: 131072,
|
|
1376
|
+
maxTokens: 32768,
|
|
1377
|
+
},
|
|
1378
|
+
];
|
|
1379
|
+
allModels.push(...antigravityModels);
|
|
1380
|
+
|
|
1381
|
+
const VERTEX_BASE_URL = "https://{location}-aiplatform.googleapis.com";
|
|
1382
|
+
const vertexModels: Model<"google-vertex">[] = [
|
|
1383
|
+
{
|
|
1384
|
+
id: "gemini-3-pro-preview",
|
|
1385
|
+
name: "Gemini 3 Pro Preview (Vertex)",
|
|
1386
|
+
api: "google-vertex",
|
|
1387
|
+
provider: "google-vertex",
|
|
1388
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1389
|
+
reasoning: true,
|
|
1390
|
+
input: ["text", "image"],
|
|
1391
|
+
cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 },
|
|
1392
|
+
contextWindow: 1000000,
|
|
1393
|
+
maxTokens: 64000,
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
id: "gemini-3.1-pro-preview",
|
|
1397
|
+
name: "Gemini 3.1 Pro Preview (Vertex)",
|
|
1398
|
+
api: "google-vertex",
|
|
1399
|
+
provider: "google-vertex",
|
|
1400
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1401
|
+
reasoning: true,
|
|
1402
|
+
input: ["text", "image"],
|
|
1403
|
+
cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 },
|
|
1404
|
+
contextWindow: 1048576,
|
|
1405
|
+
maxTokens: 65536,
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
id: "gemini-3.1-pro-preview-customtools",
|
|
1409
|
+
name: "Gemini 3.1 Pro Preview Custom Tools (Vertex)",
|
|
1410
|
+
api: "google-vertex",
|
|
1411
|
+
provider: "google-vertex",
|
|
1412
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1413
|
+
reasoning: true,
|
|
1414
|
+
input: ["text", "image"],
|
|
1415
|
+
cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 },
|
|
1416
|
+
contextWindow: 1048576,
|
|
1417
|
+
maxTokens: 65536,
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
id: "gemini-3-flash-preview",
|
|
1421
|
+
name: "Gemini 3 Flash Preview (Vertex)",
|
|
1422
|
+
api: "google-vertex",
|
|
1423
|
+
provider: "google-vertex",
|
|
1424
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1425
|
+
reasoning: true,
|
|
1426
|
+
input: ["text", "image"],
|
|
1427
|
+
cost: { input: 0.5, output: 3, cacheRead: 0.05, cacheWrite: 0 },
|
|
1428
|
+
contextWindow: 1048576,
|
|
1429
|
+
maxTokens: 65536,
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
id: "gemini-2.0-flash",
|
|
1433
|
+
name: "Gemini 2.0 Flash (Vertex)",
|
|
1434
|
+
api: "google-vertex",
|
|
1435
|
+
provider: "google-vertex",
|
|
1436
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1437
|
+
reasoning: false,
|
|
1438
|
+
input: ["text", "image"],
|
|
1439
|
+
cost: { input: 0.15, output: 0.6, cacheRead: 0.0375, cacheWrite: 0 },
|
|
1440
|
+
contextWindow: 1048576,
|
|
1441
|
+
maxTokens: 8192,
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
id: "gemini-2.0-flash-lite",
|
|
1445
|
+
name: "Gemini 2.0 Flash Lite (Vertex)",
|
|
1446
|
+
api: "google-vertex",
|
|
1447
|
+
provider: "google-vertex",
|
|
1448
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1449
|
+
reasoning: true,
|
|
1450
|
+
input: ["text", "image"],
|
|
1451
|
+
cost: { input: 0.075, output: 0.3, cacheRead: 0.01875, cacheWrite: 0 },
|
|
1452
|
+
contextWindow: 1048576,
|
|
1453
|
+
maxTokens: 65536,
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
id: "gemini-2.5-pro",
|
|
1457
|
+
name: "Gemini 2.5 Pro (Vertex)",
|
|
1458
|
+
api: "google-vertex",
|
|
1459
|
+
provider: "google-vertex",
|
|
1460
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1461
|
+
reasoning: true,
|
|
1462
|
+
input: ["text", "image"],
|
|
1463
|
+
cost: { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 0 },
|
|
1464
|
+
contextWindow: 1048576,
|
|
1465
|
+
maxTokens: 65536,
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
id: "gemini-2.5-flash",
|
|
1469
|
+
name: "Gemini 2.5 Flash (Vertex)",
|
|
1470
|
+
api: "google-vertex",
|
|
1471
|
+
provider: "google-vertex",
|
|
1472
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1473
|
+
reasoning: true,
|
|
1474
|
+
input: ["text", "image"],
|
|
1475
|
+
cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 },
|
|
1476
|
+
contextWindow: 1048576,
|
|
1477
|
+
maxTokens: 65536,
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
id: "gemini-2.5-flash-lite-preview-09-2025",
|
|
1481
|
+
name: "Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",
|
|
1482
|
+
api: "google-vertex",
|
|
1483
|
+
provider: "google-vertex",
|
|
1484
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1485
|
+
reasoning: true,
|
|
1486
|
+
input: ["text", "image"],
|
|
1487
|
+
cost: { input: 0.1, output: 0.4, cacheRead: 0.01, cacheWrite: 0 },
|
|
1488
|
+
contextWindow: 1048576,
|
|
1489
|
+
maxTokens: 65536,
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
id: "gemini-2.5-flash-lite",
|
|
1493
|
+
name: "Gemini 2.5 Flash Lite (Vertex)",
|
|
1494
|
+
api: "google-vertex",
|
|
1495
|
+
provider: "google-vertex",
|
|
1496
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1497
|
+
reasoning: true,
|
|
1498
|
+
input: ["text", "image"],
|
|
1499
|
+
cost: { input: 0.1, output: 0.4, cacheRead: 0.01, cacheWrite: 0 },
|
|
1500
|
+
contextWindow: 1048576,
|
|
1501
|
+
maxTokens: 65536,
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
id: "gemini-1.5-pro",
|
|
1505
|
+
name: "Gemini 1.5 Pro (Vertex)",
|
|
1506
|
+
api: "google-vertex",
|
|
1507
|
+
provider: "google-vertex",
|
|
1508
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1509
|
+
reasoning: false,
|
|
1510
|
+
input: ["text", "image"],
|
|
1511
|
+
cost: { input: 1.25, output: 5, cacheRead: 0.3125, cacheWrite: 0 },
|
|
1512
|
+
contextWindow: 1000000,
|
|
1513
|
+
maxTokens: 8192,
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
id: "gemini-1.5-flash",
|
|
1517
|
+
name: "Gemini 1.5 Flash (Vertex)",
|
|
1518
|
+
api: "google-vertex",
|
|
1519
|
+
provider: "google-vertex",
|
|
1520
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1521
|
+
reasoning: false,
|
|
1522
|
+
input: ["text", "image"],
|
|
1523
|
+
cost: { input: 0.075, output: 0.3, cacheRead: 0.01875, cacheWrite: 0 },
|
|
1524
|
+
contextWindow: 1000000,
|
|
1525
|
+
maxTokens: 8192,
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
id: "gemini-1.5-flash-8b",
|
|
1529
|
+
name: "Gemini 1.5 Flash-8B (Vertex)",
|
|
1530
|
+
api: "google-vertex",
|
|
1531
|
+
provider: "google-vertex",
|
|
1532
|
+
baseUrl: VERTEX_BASE_URL,
|
|
1533
|
+
reasoning: false,
|
|
1534
|
+
input: ["text", "image"],
|
|
1535
|
+
cost: { input: 0.0375, output: 0.15, cacheRead: 0.01, cacheWrite: 0 },
|
|
1536
|
+
contextWindow: 1000000,
|
|
1537
|
+
maxTokens: 8192,
|
|
1538
|
+
},
|
|
1539
|
+
];
|
|
1540
|
+
allModels.push(...vertexModels);
|
|
1541
|
+
|
|
1542
|
+
const azureOpenAiModels: Model<Api>[] = allModels
|
|
1543
|
+
.filter((model) => model.provider === "openai" && model.api === "openai-responses")
|
|
1544
|
+
.map((model) => ({
|
|
1545
|
+
...model,
|
|
1546
|
+
api: "azure-openai-responses",
|
|
1547
|
+
provider: "azure-openai-responses",
|
|
1548
|
+
baseUrl: "",
|
|
1549
|
+
}));
|
|
1550
|
+
allModels.push(...azureOpenAiModels);
|
|
1551
|
+
|
|
1552
|
+
// Group by provider and deduplicate by model ID
|
|
1553
|
+
const providers: Record<string, Record<string, Model<any>>> = {};
|
|
1554
|
+
for (const model of allModels) {
|
|
1555
|
+
if (!providers[model.provider]) {
|
|
1556
|
+
providers[model.provider] = {};
|
|
1557
|
+
}
|
|
1558
|
+
// Use model ID as key to automatically deduplicate
|
|
1559
|
+
// Only add if not already present (models.dev takes priority over OpenRouter)
|
|
1560
|
+
if (!providers[model.provider][model.id]) {
|
|
1561
|
+
providers[model.provider][model.id] = model;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
// Generate TypeScript file
|
|
1566
|
+
let output = `// This file is auto-generated by scripts/generate-models.ts
|
|
1567
|
+
// Do not edit manually - run 'npm run generate-models' to update
|
|
1568
|
+
|
|
1569
|
+
import type { Model } from "./types.js";
|
|
1570
|
+
|
|
1571
|
+
export const MODELS = {
|
|
1572
|
+
`;
|
|
1573
|
+
|
|
1574
|
+
// Generate provider sections (sorted for deterministic output)
|
|
1575
|
+
const sortedProviderIds = Object.keys(providers).sort();
|
|
1576
|
+
for (const providerId of sortedProviderIds) {
|
|
1577
|
+
const models = providers[providerId];
|
|
1578
|
+
output += `\t${JSON.stringify(providerId)}: {\n`;
|
|
1579
|
+
|
|
1580
|
+
const sortedModelIds = Object.keys(models).sort();
|
|
1581
|
+
for (const modelId of sortedModelIds) {
|
|
1582
|
+
const model = models[modelId];
|
|
1583
|
+
output += `\t\t"${model.id}": {\n`;
|
|
1584
|
+
output += `\t\t\tid: "${model.id}",\n`;
|
|
1585
|
+
output += `\t\t\tname: "${model.name}",\n`;
|
|
1586
|
+
output += `\t\t\tapi: "${model.api}",\n`;
|
|
1587
|
+
output += `\t\t\tprovider: "${model.provider}",\n`;
|
|
1588
|
+
if (model.baseUrl !== undefined) {
|
|
1589
|
+
output += `\t\t\tbaseUrl: "${model.baseUrl}",\n`;
|
|
1590
|
+
}
|
|
1591
|
+
if (model.headers) {
|
|
1592
|
+
output += `\t\t\theaders: ${JSON.stringify(model.headers)},\n`;
|
|
1593
|
+
}
|
|
1594
|
+
if (model.compat) {
|
|
1595
|
+
output += ` compat: ${JSON.stringify(model.compat)},
|
|
1596
|
+
`;
|
|
1597
|
+
}
|
|
1598
|
+
output += `\t\t\treasoning: ${model.reasoning},\n`;
|
|
1599
|
+
output += `\t\t\tinput: [${model.input.map(i => `"${i}"`).join(", ")}],\n`;
|
|
1600
|
+
output += `\t\t\tcost: {\n`;
|
|
1601
|
+
output += `\t\t\t\tinput: ${model.cost.input},\n`;
|
|
1602
|
+
output += `\t\t\t\toutput: ${model.cost.output},\n`;
|
|
1603
|
+
output += `\t\t\t\tcacheRead: ${model.cost.cacheRead},\n`;
|
|
1604
|
+
output += `\t\t\t\tcacheWrite: ${model.cost.cacheWrite},\n`;
|
|
1605
|
+
output += `\t\t\t},\n`;
|
|
1606
|
+
output += `\t\t\tcontextWindow: ${model.contextWindow},\n`;
|
|
1607
|
+
output += `\t\t\tmaxTokens: ${model.maxTokens},\n`;
|
|
1608
|
+
output += `\t\t} satisfies Model<"${model.api}">,\n`;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
output += `\t},\n`;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
output += `} as const;
|
|
1615
|
+
`;
|
|
1616
|
+
|
|
1617
|
+
// Write file
|
|
1618
|
+
writeFileSync(join(packageRoot, "src/models.generated.ts"), output);
|
|
1619
|
+
console.log("Generated src/models.generated.ts");
|
|
1620
|
+
|
|
1621
|
+
// Print statistics
|
|
1622
|
+
const totalModels = allModels.length;
|
|
1623
|
+
const reasoningModels = allModels.filter(m => m.reasoning).length;
|
|
1624
|
+
|
|
1625
|
+
console.log(`\nModel Statistics:`);
|
|
1626
|
+
console.log(` Total tool-capable models: ${totalModels}`);
|
|
1627
|
+
console.log(` Reasoning-capable models: ${reasoningModels}`);
|
|
1628
|
+
|
|
1629
|
+
for (const [provider, models] of Object.entries(providers)) {
|
|
1630
|
+
console.log(` ${provider}: ${Object.keys(models).length} models`);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// Run the generator
|
|
1635
|
+
generateModels().catch(console.error);
|