Commit Graph

49 Commits

Author SHA1 Message Date
Armin Ronacher fc8a155901 fix(ai): honor Codex Responses maxRetries 2026-05-25 12:30:04 +02:00
Mario Zechner b141e1fa24 chore: remove web-ui workspace 2026-05-20 02:26:09 +02:00
Armin Ronacher ae9450dc51 chore(ts): use source import extensions 2026-05-20 00:04:03 +02:00
Mario Zechner 7be75baded fix(ai): clamp OpenAI prompt cache keys
closes #4720
2026-05-19 10:51:11 +02:00
Ramiz Wachtler 0ae909316a fix(ai): honor retry-after for OpenAI Codex SSE retries
- honor `retry-after-ms` and `retry-after` for OpenAI Codex SSE retries
- add SSE retry coverage for millisecond, seconds, date, and fallback delays
2026-05-13 19:44:07 +02:00
haoqixu 8c2e3eddec fix(ai): respect proxy envs in bun's websocket
fixes #4346
2026-05-10 03:43:07 +08:00
Mario Zechner 15aa313501 Closes #4184, codex needs a non-empty system prompt 2026-05-05 14:50:27 +02:00
Mario Zechner 23420012ab fix(coding-agent): decouple codex session cleanup 2026-05-04 00:45:56 +02:00
Armin Ronacher 370fdae6fa fix(ai): fall back from codex websocket to sse (#4133) 2026-05-03 22:51:42 +02:00
Mario Zechner b8bb2411ff fix(ai): honor codex transport option
closes #4083
2026-05-02 14:14:22 +02:00
Mario Zechner 80f06d3636 feat: add model thinking level metadata
closes #3208
2026-05-02 01:21:06 +02:00
Mario Zechner 4745a95898 feat(ai): add cached codex websocket transport 2026-05-01 13:07:40 +02:00
Mario Zechner 953f89fbe9 chore(ai): lower codex default verbosity 2026-04-25 16:20:56 +02:00
HQidea 3e0ee69b5e fix(ai): omit tools field instead of sending empty array (#3650)
DashScope / Aliyun Qwen (OpenAI-compatible) rejects `tools: []`
with HTTP 400 `"[] is too short - 'tools'"`. Five providers used
a truthy check (`if (context.tools)`) that treated an empty array
as "send tools", so `pi --no-tools` produced `tools: []` in the
request body. Matching the Google provider's pattern, we now
guard on `context.tools.length > 0`:

- openai-completions.ts
- openai-responses.ts
- openai-codex-responses.ts
- azure-openai-responses.ts
- anthropic.ts

The openai-completions fallback that emits `tools: []` when the
conversation has tool history (required by LiteLLM / Anthropic
proxies) is preserved via the existing `else if (hasToolHistory)`
branch.

closes #3649

Co-authored-by: 槐聚 <huaiju@zbyte-inc.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-24 14:24:31 +02:00
Markus Ylisiurunen ba8f1c228a Align GPT-5.5 Codex capability handling (#3618)
* fix(ai): align gpt-5.5 codex capabilities

* chore(ai): update generated models

* fix(ai): apply gpt-5.5 priority pricing to api

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-23 23:49:33 +02:00
Markus Ylisiurunen 2cdac7382a fix(ai): trust requested Codex service tier (#3307) 2026-04-17 01:50:04 +02:00
Mario Zechner d131fcd4ba feat(coding-agent): add after_provider_response hook closes #3128 2026-04-16 20:28:08 +02:00
Mario Zechner 018b40c30c fix: align OpenAI cache affinity and use uuidv7 session ids 2026-04-14 23:20:13 +02:00
Armin Ronacher e2b40dfc81 fix(ai): strip partialJson from responses tool calls
Mutate persisted tool-call blocks in place on function_call completion,
remove partialJson, and emit the same reference on toolcall_end.
Add regression coverage for persisted block cleanup and event identity.

fixes #3078
2026-04-14 18:56:53 +02:00
Markus Ylisiurunen f829f80885 fix(ai): support service tier in codex responses (#2996) 2026-04-13 11:04:11 +02:00
Mario Zechner ad48b52de4 fix(ai): align codex websocket headers and terminate SSE closes #1961 2026-03-14 12:23:17 +01:00
Mario Zechner a3f05423d9 feat(coding-agent): add provider payload hook 2026-03-07 14:34:28 +01:00
Markus Ylisiurunen 8a6384a925 add support for gpt-5.4 2026-03-05 22:53:08 +01:00
Mario Zechner 668ebc0941 fix(ai): replace Function-based dynamic imports with module imports (fixes #1814) 2026-03-04 20:50:14 +01:00
Mario Zechner e0754fdbb3 fix(ai,coding-agent): make pi-ai browser-safe and move OAuth runtime exports
- add browser smoke bundling check to root check + pre-commit

- lazy-load Bedrock provider registration to avoid browser graph traversal

- remove top-level OAuth runtime exports from @mariozechner/pi-ai

- add @mariozechner/pi-ai/oauth subpath export and update coding-agent imports

- move proxy dispatcher init to coding-agent CLI (Node-only)

- document Bedrock/OAuth browser limitations

closes #1814
2026-03-04 20:21:25 +01:00
Mario Zechner a26a9cfabd feat: add configurable transport and codex websocket session caching 2026-02-13 23:41:49 +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
Mario Zechner 150aeebf7d fix(ai): respect codex baseUrl (closes #1244) 2026-02-04 12:30:31 +01:00
Mario Zechner c725135a76 refactor(ai): register api providers 2026-01-24 23:15:11 +01:00
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
Danila Poyarkov 6d0c544e18 fix: Bun compatibility for build scripts and runtime detection 2026-01-23 19:31:16 +03: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 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 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 2c7c23b865 fix(ai): normalize tool call ids and handoff tests fixes #821 2026-01-19 00:10:49 +01:00
Mario Zechner 4068bc556a chore: simplify codex prompt handling 2026-01-17 21:53:01 +01:00
Mario Zechner c08801e4c5 Add retry logic to OpenAI Codex provider
Fixes #733
2026-01-16 03:15:59 +01:00
Mario Zechner be26d362fa Fix alt+backspace in Kitty mode and clamp Codex effort (refs #752) 2026-01-16 01:30:46 +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
Danila Poyarkov 934e7e470b Avoid cross-provider thought signatures (#654)
* Avoid cross-provider thought signatures

* Fix Google thought signature replay

Filter thought signatures to same provider with base64 validation and rename the transform helper for clarity.
2026-01-12 16:38:53 +01:00
Mario Zechner 6dcb64565a Prepare for alternative Codex harness certification 2026-01-10 13:22:10 +01:00
Thomas Mustier 6052453f4f fix(ai): improve codex stream error details 2026-01-07 22:44:22 +00:00
Zhou Rui d893ba7f20 fix(ai): clean up openai-codex models and token limits 2026-01-07 23:09:20 +08:00
Mario Zechner edb0da9611 feat(ai,agent,coding-agent): add sessionId for provider session-based caching
- Add sessionId to StreamOptions for providers that support session-based caching
- OpenAI Codex provider uses sessionId for prompt_cache_key and routing headers
- Agent class now accepts and forwards sessionId to stream functions
- coding-agent passes session ID from SessionManager and updates on session changes
- Update ai package README with table of contents, OpenAI Codex OAuth docs, and env vars table
- Increase Codex instructions cache TTL from 15 minutes to 24 hours
- Add tests for sessionId forwarding in ai and agent packages
2026-01-06 11:08:42 +01:00
Mario Zechner 858c6bae8a refactor(ai): streamline codex prompt handling 2026-01-06 10:27:51 +01:00
Ben Vargas 02b72b49d5 fix: codex thinking handling 2026-01-05 21:55:47 +01:00
Mario Zechner bb50738f7e fix(ai): append system prompt to codex bridge message instead of converting to input
Previously the system prompt was converted to an input message in convertMessages,
then stripped out by filterPiSystemPrompts. Now the system prompt is passed directly
to transformRequestBody and appended after CODEX_PI_BRIDGE in the bridge message.
2026-01-05 06:03:07 +01:00
Ahmed Kamal 1650041a63 feat(ai): add OpenAI Codex OAuth + responses provider 2026-01-04 21:11:19 +02:00