Commit graph

159 commits

Author SHA1 Message Date
Markus Ylisiurunen
f8d731a134 fix codex context window and add a few tests 2026-03-05 22:54:16 +01:00
Mario Zechner
a0d839ce84 fix(ai): use skip_thought_signature_validator for unsigned Gemini 3 tool calls
Replace text fallback with the official sentinel value so unsigned function
calls retain structured context in multi-turn conversations.

closes #1829
2026-03-05 22:04:00 +01:00
Mario Zechner
8f2af2ae7e feat(ai): add github-copilot gpt-5.3-codex fallback closes #1853 2026-03-05 21:47:52 +01:00
Mario Zechner
7b96041068 fix(ai): map groq qwen3 reasoning effort values closes #1745 2026-03-03 16:44:42 +01:00
Mario Zechner
42579dd923 feat(ai,coding-agent): add OpenCode Go provider support closes #1757 2026-03-03 16:02:29 +01:00
Mario Zechner
7bd4c45d81 fix(ai,coding-agent): update antigravity gemini 3.1 models and headers
fixes #1761
2026-03-03 14:54:43 +01:00
Mario Zechner
afe9ae06e8 Closes #1671, switch to GLM-5 for tests 2026-02-27 21:35:40 +01:00
Mario Zechner
18c7ab8a47 chore(models): update Gemini 3.1 provider catalogs and antigravity opus 4.6 2026-02-19 20:33:27 +01:00
Mario Zechner
a26a9cfabd feat: add configurable transport and codex websocket session caching 2026-02-13 23:41:49 +01:00
Nate Smyth
2419412483 refactor(ai): fix inconsistencies, trim ai code+replace tests, remove unnceccessary tool_result check 2026-02-12 18:41:12 +01:00
Nate Smyth
0a132a30a1 feat(ai): route copilot claude via anthropic messages api 2026-02-12 18:41:12 +01:00
Nate Smyth
cf1353b8e7 test(ai): cover copilot claude messages routing + headers 2026-02-12 18:41:12 +01:00
Markus Ylisiurunen
28c0991281
Extend interleaved thinking test to Anthropic first-party provider (#1413)
* extend interleaved thinking test to Anthropic first-party provider

* switch back to global Bedrock model identifier

* set retry to 3 for both

* enable bedrock claude interleaved thinking by default and use completeSimple in test
2026-02-12 17:27:42 +01:00
Mario Zechner
ed9255d3bd ai: update Antigravity system instruction to compact version, fix flaky tool test
- Replace verbose ANTIGRAVITY_SYSTEM_INSTRUCTION with compact version from CLIProxyAPI
- Replace bridgePrompt override with [ignore] wrapper pattern
- Switch Antigravity Gemini test model from gemini-3-flash to gemini-3-pro-high
- Rename calculator tool to math_operation (gemini-3-pro ignores schema for 'calculator')

closes #1415
2026-02-08 23:37:09 +01:00
Markus Ylisiurunen
5c87303b7f
add test cases for interleaved thinking on Bedrock (#1340) 2026-02-06 21:15:59 +01:00
Mario Zechner
f5b9eeb514 fix(ai): clamp minimal reasoning for gpt-5.3-codex (fixes #1334) 2026-02-06 18:45:08 +01:00
Markus Ylisiurunen
d3d3ef4155 fix(ai): handle bedrock opus 4.6 adaptive thinking and interleaved beta 2026-02-06 10:27:13 +02:00
Mario Zechner
ee53b53689 fix(ai): enable xhigh for anthropic opus 4.6 2026-02-05 22:57:43 +01:00
Mario Zechner
4c4d787b1a feat(ai): add adaptive thinking support for Claude Opus 4.6
- Add adaptive thinking mode (type: 'adaptive') for Opus 4.6+
- Add effort parameter ('low', 'medium', 'high', 'max') for adaptive thinking
- thinkingEnabled now auto-detects: adaptive for 4.6+, budget-based for older
- streamSimple/completeSimple map ThinkingLevel to effort levels for Opus 4.6
- Add tests for Opus 4.6 adaptive thinking and GPT-5.3 Codex
- Update @anthropic-ai/sdk to 0.73.0
- Update @aws-sdk/client-bedrock-runtime to 3.983.0
- Update @google/genai to 1.40.0
- Remove fast-xml-parser override (no longer needed)
2026-02-05 21:14:11 +01:00
Mario Zechner
111a31e4db fix(ai): apply cache_control to string user messages 2026-02-02 19:19:12 +01:00
Mario Zechner
ff0eb3ecd4 fix(ai): omit strict for unsupported openai completions 2026-02-02 00:44:55 +01:00
Mario Zechner
abfd04b5c5 feat(ai): add cacheRetention stream option 2026-02-01 09:32:10 +01:00
Ben Vargas
e045a9f142
feat(ai): add Vercel AI Gateway routing support (#1051)
* feat(ai): add Vercel AI Gateway routing support

Add vercelGatewayRouting to OpenAICompletionsCompat, parallel to
openRouterRouting. When a model targets ai-gateway.vercel.sh and has
vercelGatewayRouting configured, the openai-completions provider passes
providerOptions.gateway with only/order in the request body.

Changes:
- types.ts: VercelGatewayRouting interface + field on OpenAICompletionsCompat
- openai-completions.ts: buildParams passes providerOptions.gateway,
  detectCompat/getCompat include the new field
- model-registry.ts: VercelGatewayRoutingSchema for models.json validation
- test: updated Required<OpenAICompletionsCompat> in test fixture

* docs(coding-agent): add vercelGatewayRouting to custom models documentation
2026-01-30 01:44:51 +01:00
Mario Zechner
87ab5c5c3b feat(ai): add Kimi For Coding provider support
- Add kimi-coding provider using Anthropic Messages API
- API endpoint: https://api.kimi.com/coding/v1
- Environment variable: KIMI_API_KEY
- Models: kimi-k2-thinking (text), k2p5 (text + image)
- Add context overflow detection pattern for Kimi errors
- Add tests for all standard test suites
2026-01-29 04:12:28 +01:00
Mario Zechner
c808de605a feat(ai): add Hugging Face provider support
- Add huggingface to KnownProvider type
- Add HF_TOKEN env var mapping
- Process huggingface models from models.dev (14 models)
- Use openai-completions API with compat settings
- Add tests for all provider test suites
- Update documentation

fixes #994
2026-01-29 02:40:14 +01:00
Mario Zechner
1b6a147579 feat(ai): add PI_CACHE_RETENTION env var for extended prompt caching
Adds support for extended cache retention via PI_CACHE_RETENTION=long:
- Anthropic: 5m -> 1h TTL
- OpenAI: in-memory -> 24h retention

Only applies to direct API calls (api.anthropic.com, api.openai.com).
Proxies and other providers are unaffected.

fixes #967
2026-01-29 02:22:06 +01:00
Mario Zechner
605f6f494b fix(ai): normalize pipe-separated tool call IDs for cross-provider handoff
- Handle pipe-separated IDs from OpenAI Responses API in openai-completions provider
- Strip trailing underscores after truncation in openai-responses-shared (OpenAI Codex rejects them)
- Add regression tests for tool call ID normalization

fixes #1022
2026-01-29 01:28:12 +01:00
williamtwomey
41d2c7ff38
OpenAI completions toolChoice fix (#998)
* openai completions tools fix

* Reset generated file

---------

Co-authored-by: williamtwomey <ai@shadylawn.net>
2026-01-28 03:03:15 +01:00
mom
ebd8e895ce fix: typos in comments (fixes #1016) 2026-01-28 01:56:34 +00:00
jake
dac7474da2 feat(ai): add OpenRouter provider routing support
Allows custom models to specify which upstream providers OpenRouter
should route requests to via the `openRouterRouting` field in model
definitions.

Supported fields:
- `only`: list of provider slugs to exclusively use
- `order`: list of provider slugs to try in order
2026-01-25 03:34:49 +01:00
Mario Zechner
a6d878e804 fix(ai): default tool call arguments to empty object for Google providers
When Google providers return tool calls without an args field (common for
no-argument tools), the arguments field was undefined. This breaks
subsequent API calls that require tool_use.input to be present.

Now defaults to {} when args is missing.

Related: clawdbot/clawdbot#1509
2026-01-25 03:18:02 +01:00
Mario Zechner
c725135a76 refactor(ai): register api providers 2026-01-24 23:15:11 +01:00
Markus Ylisiurunen
c6e966bd1c adjust azure responses metadata and handoff gating 2026-01-24 12:05:58 +01:00
Markus Ylisiurunen
085c378d34 add Azure deployment name map and refresh generated models 2026-01-24 12:04:34 +01:00
Markus Ylisiurunen
391c93800c switch azure responses to base url config and v1 api 2026-01-24 12:04:34 +01:00
Markus Ylisiurunen
856012296b add Azure OpenAI Responses provider with deployment-aware model mapping 2026-01-24 12:04:34 +01:00
Michael Renner
6289c144bf
fix(ai): batch tool-result images after consecutive tool results (#902)
Fixes 400 errors when reading multiple images via GitHub Copilot's
Claude models. Claude requires tool_use -> tool_result adjacency with
no user messages interleaved.

Before: assistant(tool_calls) -> tool -> user(images) -> tool -> user(images)
After:  assistant(tool_calls) -> tool -> tool -> user(all images)
2026-01-22 13:10:10 +01:00
Mario Zechner
d327b9c768 fix(ai): handle same-provider different-model handoff in OpenAI Responses API
When switching between OpenAI models (e.g., gpt-5-mini to gpt-5.2-codex),
function_call IDs with fc_ prefix trigger pairing validation errors because
OpenAI tracks which fc_xxx IDs were paired with rs_xxx reasoning items.

The fix omits the id field for function_calls from different models, which
avoids the pairing validation while keeping call_id for matching with
function_call_output.

Fixes #886
2026-01-22 00:58:49 +01:00
Mario Zechner
de58391085 test(ai): add failing test for orphaned function_call without reasoning item
Reproduces issue #886 where function_call is sent without its required
paired reasoning item, causing Azure/OpenAI 400 error.
2026-01-21 23:59:29 +01:00
Mario Zechner
68352a42cf fix(ai): skip cross-provider-handoff tests when no API keys available
Tests were throwing errors instead of skipping on CI where no API keys
are configured. Now uses describe.skipIf() and it.skipIf() patterns
consistent with other tests in the package.
2026-01-19 16:47:49 +01:00
Mario Zechner
2d27a2c728 fix(ai): skip errored/aborted assistant messages in transform-messages
Fixes OpenAI Responses 400 error 'reasoning without following item' by
skipping errored/aborted assistant messages entirely rather than filtering
at the provider level. This covers openai-responses, openai-codex-responses,
and future providers.

Removes strictResponsesPairing compat option (no longer needed).

Closes #838
2026-01-19 15:55:29 +01:00
Mario Zechner
0ce59236dc test(ai): remove handoff test closes #258 2026-01-19 00:14:24 +01:00
Mario Zechner
ea02243a18 chore(ai): remove gemini cli session id test 2026-01-19 00:11:43 +01:00
Mario Zechner
2c7c23b865 fix(ai): normalize tool call ids and handoff tests fixes #821 2026-01-19 00:10:49 +01:00
Mario Zechner
d43930c818 feat(ai): add strictResponsesPairing for Azure OpenAI Responses API
Split OpenAICompat into OpenAICompletionsCompat and OpenAIResponsesCompat
for type-safe API-specific compat settings. Added strictResponsesPairing
option to suppress orphaned reasoning/tool calls on incomplete turns,
fixing 400 errors on Azure's Responses API which requires strict pairing.

Closes #768
2026-01-18 20:15:33 +01:00
Mario Zechner
a5f1016da2 fix(ai): normalize tool names case-insensitively against CC tool list
- Replace hardcoded pi->CC tool mappings with single CC tool name list
- Case-insensitive lookup: if tool name matches CC tool, use CC casing
- Remove broken find->Glob mapping (round-trip failed)
- Add test coverage for tool name normalization
2026-01-17 21:03:47 +01:00
Mario Zechner
5d3e7d5aaa fix(ai): preserve unsigned tool call context for Gemini 3 with anti-mimicry note
Instead of skipping unsigned tool calls entirely (which lobotomizes context),
convert them to text with an explicit note telling the model this is historical
context from a different model and not a format to mimic.

This preserves tool call/result context when switching from providers without
thought signatures (e.g. Claude via Antigravity) to Gemini 3.
2026-01-16 23:42:39 +01:00
Danila Poyarkov
923b9cb9ee
fix(ai): coerce string numbers in tool argument validation (#786)
* fix(ai): coerce string numbers in tool argument validation

* fix(ai): clone tool arguments before AJV validation for type coercion
2026-01-16 20:16:13 +01:00
Mario Zechner
6484ae279d
Finalize OpenAI Codex compatibility (#737)
- align Codex Responses provider with Pi static instructions
- simplify Codex request/stream handling and cleanup exports
- keep legacy OpenCode Codex prompt for testing until Pi prompt is allowlisted
2026-01-16 00:58:36 +01:00
Roshan Singh
b18f401d9e
fix(ai): avoid unsigned Gemini 3 tool calls (#741) 2026-01-15 13:12:39 +01:00