Commit graph

723 commits

Author SHA1 Message Date
Markus Ylisiurunen
bd7049b7d1 fix(ai): port openai responses handoff guard 2026-01-24 12:05:40 +01:00
Markus Ylisiurunen
5edec3a40a fix(ai): preserve codex tool strictness 2026-01-24 12:05:40 +01:00
Markus Ylisiurunen
284ff81035 refactor(ai): share openai responses logic 2026-01-24 12:05:40 +01:00
Markus Ylisiurunen
085c378d34 add Azure deployment name map and refresh generated models 2026-01-24 12:04:34 +01:00
Markus Ylisiurunen
0789bcbab0 clarify Azure OpenAI env vars in docs 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
01f559efc0 guard azure responses deltas before content parts 2026-01-24 12:04:34 +01:00
Markus Ylisiurunen
3112526051 remove service tier from azure-openai-responses; add link to changelog entry 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
Mario Zechner
72de8f26a1
Merge pull request #917 from williballenthin/fix-call-arguments-done
fix(ai): handle call arguments done on OpenAI-compatible endpoints
2026-01-24 03:14:02 +01:00
Mario Zechner
2cdf608d51 fix: Bun compatibility for build scripts and runtime detection (#922) 2026-01-23 17:38:46 +01:00
Danila Poyarkov
6d0c544e18 fix: Bun compatibility for build scripts and runtime detection 2026-01-23 19:31:16 +03:00
Willi Ballenthin
fb364c89bf fix(ai): handle call arguments done on OpenAI-compatible endpoints
fix bug encountered when running GLM-4.7-Flash hosted by LM Studio, in
which the provider sends tool call arguments via
`response.function_call_arguments.done` events instead of streaming them
via `response.function_call_arguments.delta` events. The final
`response.output_item.done` event then contains empty `{}` arguments.
The code only handled delta events, so tool calls failed with validation
errors like `"must have required property 'command'"`.

Full disclosure, Opus triaged the bug and provided the fix (by adding
logging statements to the req/resp to the upstream provider (LM
Studio)). I'm to provide prompts/transcripts, and acknowledge that I'm
not an expert in Pi internals at this time.
2026-01-23 13:48:54 +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
df8b3544c3 Add [Unreleased] section for next cycle 2026-01-22 01:43:26 +01:00
Mario Zechner
34d28a47b5 Release v0.49.3 2026-01-22 01:42:43 +01:00
Mario Zechner
ccf6db6376 docs: add missing changelog entries for f39ec4d7, b712d1ca 2026-01-22 01:37:55 +01:00
Mario Zechner
b712d1ca43 fix(ai, web-ui): browser compatibility for pi-ai, update tsgo for decorator support
- Update @typescript/native-preview to 7.0.0-dev.20260120.1 (supports experimentalDecorators)
- Replace top-level node:fs, node:os, node:path imports with dynamic imports in stream.ts
- Replace top-level node:os import with dynamic import in openai-codex-responses.ts
- Replace top-level node:crypto, node:http imports with dynamic imports in openai-codex.ts
- Replace Buffer.from with atob for browser-compatible base64 decoding

fixes #873
2026-01-22 01:33:46 +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
4ed9527213 docs: add missing changelog entries for commits since v0.49.2 2026-01-21 23:32:28 +01:00
Mario Zechner
693112e395 feat(ai): add originator option to loginOpenAICodex 2026-01-20 01:28:51 +01:00
Mario Zechner
d2be6486a4 feat(ai): add headers option to StreamOptions for custom HTTP headers
- Added headers field to base StreamOptions interface
- Updated all providers to merge options.headers with defaults
- Forward headers and onPayload through streamSimple/completeSimple
- Bedrock not supported (uses AWS SDK auth)
2026-01-20 01:08:31 +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
2f4b510c12 Add [Unreleased] section for next cycle 2026-01-19 16:14:47 +01:00
Mario Zechner
17a37bd174 Release v0.49.2 2026-01-19 16:14:07 +01:00
Mario Zechner
2b04aefa6d feat(ai): add AWS ECS/IRSA credential detection for Bedrock, fixes #848
Added support for additional AWS credential environment variables:
- AWS_CONTAINER_CREDENTIALS_RELATIVE_URI (ECS task roles)
- AWS_CONTAINER_CREDENTIALS_FULL_URI (ECS task roles)
- AWS_WEB_IDENTITY_TOKEN_FILE (IRSA for Kubernetes)

Also fixed undefined currentModel variable in OAuth error handling.
2026-01-19 16:10:10 +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
0e5977ad39 Add [Unreleased] section for next cycle 2026-01-19 00:23:57 +01:00
Mario Zechner
15a04c585a Release v0.49.1 2026-01-19 00:23:11 +01:00
Mario Zechner
83adb15dbb docs: add missing changelog entries for v0.50.0
- ai: tool call ID normalization for cross-provider handoffs (#821)
- coding-agent: photon WASM loading in standalone binaries
- coding-agent: fix attributions for #762 (@cv) and #829 (@terrorobe)
2026-01-19 00:22:15 +01:00
Mario Zechner
c8db8e613f docs(ai): note handoff coverage for new providers 2026-01-19 00:15:46 +01:00
Mario Zechner
0ce59236dc test(ai): remove handoff test closes #258 2026-01-19 00:14:24 +01:00
Mario Zechner
023f6e2fa4 docs(ai): document onPayload callback 2026-01-19 00:12:43 +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
632495338f Add [Unreleased] section for next cycle 2026-01-17 22:02:59 +01:00
Mario Zechner
3e6ae39083 Release v0.49.0 2026-01-17 22:02:12 +01:00
Mario Zechner
55508cca6a docs: audit and update changelog entries for v0.49.0 2026-01-17 22:01:03 +01:00
Mario Zechner
4068bc556a chore: simplify codex prompt handling 2026-01-17 21:53:01 +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
0f3a0f78bc fix(ai): prevent orphaned tool results after errored assistant messages
When an assistant message has stopReason 'error', its tool calls are now
excluded from pending tool tracking. This prevents synthetic tool results
from being generated for calls that will be dropped by provider-specific
converters (e.g., Codex drops tool calls from errored messages).

Previously, this mismatch caused OpenAI to reject requests with 'No tool
call found for function call output with call_id ...' errors.

fixes #812
2026-01-17 20:20:39 +01:00
Pablo Tovar
cd43b8a9ca
fix: ensure max_tokens > thinking.budget_tokens for bedrock claude (#797)
Bedrock Claude models require max_tokens to exceed thinking.budget_tokens.
This constraint was handled for anthropic-messages API but missing for
bedrock-converse-stream, causing compaction failures.

Extracted adjustMaxTokensForThinking() helper that:
- Adds thinking budget on top of desired output tokens
- Reduces thinking budget if insufficient room (min 1024 output tokens)
- Applied to both anthropic-messages and bedrock-converse-stream APIs
2026-01-17 10:55:30 +01:00
Mario Zechner
7f9cf543d5 Add [Unreleased] section for next cycle 2026-01-17 00:32:57 +01:00
Mario Zechner
91be338e39 Release v0.48.0 2026-01-17 00:32:07 +01:00
Mario Zechner
760414b288 docs: add missing changelog entries for v0.48.0 2026-01-17 00:31:03 +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
Mario Zechner
fbb74bb29e fix(ai): filter empty error assistant messages in transformMessages
When 429/500 errors occur during tool execution, empty assistant messages
with stopReason='error' get persisted. These break the tool_use -> tool_result
chain for Claude/Gemini APIs.

Added centralized filtering in transformMessages to skip assistant messages
with empty content and no tool calls. Provider-level filters remain for
defense-in-depth.
2026-01-16 22:35:50 +01:00
Mario Zechner
ffdc8d686b docs: add OpenCode Zen to provider lists in coding-agent README 2026-01-16 21:20:52 +01:00