Commit Graph

264 Commits

Author SHA1 Message Date
Alishahryar1 d0929b2771 Fix stream recovery edge cases 2026-06-27 02:37:11 -07:00
Alishahryar1 485ad80afe Fix stream recovery review findings 2026-06-27 01:22:31 -07:00
Alishahryar1 455a8d4cfc Guard stream recovery terminal ordering 2026-06-27 00:51:07 -07:00
Alishahryar1 776cff6329 Simplify tool stream ledger ownership 2026-06-25 23:49:42 -07:00
Alishahryar1 9203d52784 Guard midstream error terminal events 2026-06-25 22:35:22 -07:00
Alishahryar1 6682e71476 Require terminal markers for recovery streams 2026-06-25 22:05:58 -07:00
Alishahryar1 ead3c9d45d Fix emitted tool stream ledger state 2026-06-24 23:36:43 -07:00
Alishahryar1 613e2076cf Fix stream ledger recovery edge cases 2026-06-24 23:15:25 -07:00
Alishahryar1 2d4ea0b337 Refactor provider stream engine 2026-06-24 23:15:25 -07:00
Ali Khokhar d281d52ced Refactor messaging around explicit ports (#878) 2026-06-20 09:35:38 -07:00
Alishahryar1 acf5885b16 Fix Windows installer uv version parsing 2026-06-19 14:03:30 -07:00
Ali Khokhar d9e42457bc Fix Claude auto-mode classifier thinking policy (#865) 2026-06-19 12:24:56 -07:00
Ali Khokhar 6bee3104fe Refactor CLI surfaces around launchers and managed Claude (#861)
## Problem

The CLI package preserved a generic adapter layer and managed Codex
parser path that did not match the supported customer workflows.
Messaging runs Claude Code sessions, while Codex is supported through
`fcc-codex` and extensions.

## Changes

| Before | After |
| --- | --- |
| `fcc-claude` and `fcc-codex` shared generic adapter plumbing. |
`fcc-claude` and `fcc-codex` use explicit launcher modules. |
| Messaging depended on a generic CLI session abstraction. | Messaging
depends on managed Claude Code sessions. |
| Codex catalog generation lived as a top-level CLI helper. | Codex
catalog generation lives under the Codex launcher owner. |
| Tests asserted deleted internal adapter shapes. | Tests assert
launcher, managed-Claude, and customer-surface behavior. |
2026-06-18 18:36:37 -07:00
Alishahryar1 e24711af3f Make local CI scripts autofix Ruff issues 2026-06-18 18:17:31 -07:00
Ali Khokhar b3ac9c2e5e Add Responses reasoning usage details (#860)
## Problem

Codex receives reasoning text from the Responses stream, but FCC does
not emit reasoning-token usage details. Codex reports zero reasoning
tokens even when thinking is present.

## Changes

| Before | After |
| --- | --- |
| Responses usage reported only input, output, and total tokens. |
Responses usage reports input, output, total, and reasoning-token
details when reasoning text exists. |
| Reasoning text had no adapter-owned token estimate. | Reasoning text
gets a Responses-owned best-effort token estimate. |
| Reasoning estimates could exceed reported output tokens. | Reasoning
estimates are capped at reported output tokens. |
| Text-only Responses usage kept the base shape. | Text-only Responses
usage keeps the base shape. |
2026-06-18 16:39:27 -07:00
Ali Khokhar 92488456bc Refactor messaging platform bridge (#858)
## Summary
- Extract shared messaging platform outbox for queued send/edit/delete,
dedup keys, limiter delegation, and fire-and-forget behavior
- Extract shared voice-note flow for pending voice state, transcription,
cancellation, cleanup, error replies, and IncomingMessage handoff
- Keep Telegram and Discord adapters focused on SDK lifecycle, event
extraction, attachment download, and raw send/edit/delete calls
- Document the split in ARCHITECTURE.md and bump version to 2.3.8

## Verification
- uv run pytest tests/messaging/test_platform_outbox.py
tests/messaging/test_platform_voice_flow.py
tests/messaging/test_voice_handlers.py tests/messaging/test_telegram.py
tests/messaging/test_telegram_edge_cases.py
tests/messaging/test_discord_platform.py
tests/contracts/test_import_boundaries.py
tests/contracts/test_architecture_contracts.py
- .\\scripts\\ci.ps1
2026-06-18 14:26:48 -07:00
Ali Khokhar a97bf7f8b3 Refactor messaging workflow architecture (#852) 2026-06-18 13:10:02 -07:00
Ali Khokhar b2af3f63d2 Refactor API request pipeline (#851) 2026-06-18 02:54:50 -07:00
Alishahryar1 c024bf6892 Fix stream cleanup context handling.
Avoid contextvar-based log context in SSE generators and treat GeneratorExit as quiet teardown.
2026-06-17 20:43:38 -07:00
Alishahryar1 da672af337 Skip passive tool_search in Responses conversion.
Codex includes OpenAI tool_search in the tools array; omit it from the Anthropic payload like other passive hosted tools so fcc-codex requests do not fail at conversion.
2026-06-17 20:27:11 -07:00
Ali Khokhar 8d2e5b95f7 Refactor OpenAI Responses into modular adapter facade (#847)
## Summary

- Split monolithic `core/openai_responses/conversion.py` and `sse.py`
into focused protocol modules (input, output, stream, tools, reasoning,
events, etc.) behind an `OpenAIResponsesAdapter` facade.
- Wire `ClaudeProxyService.create_response()` through the adapter
instead of importing conversion helpers directly, tightening the
API/import boundary.
- Add Codex bridging for Responses `custom_tool_call` items and document
the adapter architecture in `ARCHITECTURE.md`.

## Test plan

- [x] `uv run pytest tests/core/openai_responses/
tests/api/test_openai_responses.py tests/cli/test_adapters.py
tests/contracts/test_import_boundaries.py`
- [x] Full CI via `.\scripts\ci.ps1`
2026-06-17 20:19:51 -07:00
Ali Khokhar fa01c2a3a6 Refactor provider transports into packages (#845)
## Summary
- move provider transport families under `providers/transports/`
- split OpenAI-chat transport into thin transport, stream runner,
tool-call assembly, and recovery modules
- split native Anthropic transport into thin transport, stream runner,
recovery, and HTTP helper modules
- update concrete provider imports, architecture docs, transport import
contracts, version, and lockfile

## Verification
- `uv run pytest tests/providers/test_streaming_errors.py
tests/providers/test_openai_compat_5xx_retry.py
tests/providers/test_anthropic_messages.py
tests/providers/test_anthropic_messages_429_retry.py
tests/providers/test_provider_transport_logging.py
tests/providers/test_gemini.py
tests/providers/test_nvidia_nim_request.py
tests/providers/test_subagent_interception.py
tests/contracts/test_import_boundaries.py`
- `uv run ruff format`
- `./scripts/ci.ps1`
2026-06-17 15:56:19 -07:00
Alishahryar1 492860cc3d Fix Claude launcher no-auth login gate 2026-06-17 13:10:39 -07:00
Ali Khokhar c51a15608d Add FCC uninstall scripts (#836) 2026-06-17 01:43:28 -07:00
Ali Khokhar e2fa4b66d9 Extract shared stream recovery session for provider transports (#835)
## Summary

- Add `StreamRecoverySession` in
`core/anthropic/stream_recovery_session.py` to centralize early-retry
classification, holdback buffering, retry counting, and flush/discard
behavior shared by Anthropic and OpenAI transports.
- Refactor `AnthropicMessagesTransport` and `OpenAIChatTransport` to use
the shared session instead of duplicating recovery holdback and
early-retry logic.
- Update architecture docs and tests for per-delta overlap trim on
midstream recovery; bump version to 2.2.1.

## Test plan

- [x] `uv run pytest tests/core/anthropic/test_stream_recovery.py`
- [x] `uv run pytest tests/providers/test_anthropic_messages.py
tests/providers/test_streaming_errors.py`
2026-06-16 22:01:53 -07:00
Alishahryar1 fe9d287c23 Add Codex model picker catalog 2026-06-16 18:47:41 -07:00
Alishahryar1 a437df598e Fix Codex responses reasoning bridge 2026-06-16 18:05:15 -07:00
Alishahryar1 44fcc09c02 Add architecture map and provider guardrails 2026-06-16 17:33:46 -07:00
Alishahryar1 b26957faaf Update README 2026-06-16 17:01:24 -07:00
Alishahryar1 dcc4b50aae Fix Codex namespace Responses tools 2026-06-16 16:49:59 -07:00
Ali Khokhar 3abe41d270 Add Codex support (#691) 2026-06-16 16:32:43 -07:00
Alishahryar1 c1af215ff7 fix: normalize proxy auth token whitespace 2026-06-03 23:48:29 -07:00
Alishahryar1 e79b430cc2 Raise stream and upstream retry attempts to five total.
Align early transparent, mid-stream recovery, and 429/5xx execute_with_retry
to five attempts; bump version to 1.2.40.
2026-06-02 22:26:07 -07:00
Alishahryar1 103869f62f Ignore removed thinking env keys 2026-06-02 05:20:15 -07:00
Alishahryar1 b867e08084 Improve smoke provider coverage and skips 2026-06-01 22:53:34 -07:00
Alishahryar1 0eee1da072 Try mid stream retries 2026-05-31 16:28:44 -07:00
Alishahryar1 fedcc0a32b Fix Gemini thought signature replay 2026-05-31 15:13:37 -07:00
Alishahryar1 885c26d977 Surface upstream provider errors
Include copyable upstream status and error bodies in provider SSE failures for OpenAI-compatible and native Anthropic transports, while preserving retry behavior and safe logging defaults.
2026-05-31 14:48:51 -07:00
Alishahryar1 d501e5223a Fix live provider smoke defaults
Update live smoke model defaults for NIM, OpenRouter, and Gemini; normalize tool-call indexes; downgrade DeepSeek forced tool_choice; and add coverage for the provider smoke fixes.
2026-05-31 13:02:15 -07:00
Alishahryar1 e4d6dc1f94 fix: avoid dual gemini thinking controls 2026-05-29 17:05:43 -07:00
Alishahryar1 4631ff9c49 fix: update uv with install manager 2026-05-29 16:35:10 -07:00
Alishahryar1 cebdc02a32 fix: accept system role messages 2026-05-29 16:16:48 -07:00
Alishahryar1 8ae7795961 fix(gemini): nest google extra body for sdk 2026-05-24 11:10:29 -07:00
Alishahryar1 26c5b35698 Reorder providers in README and other places 2026-05-23 19:16:22 -07:00
Alishahryar1 a4d7d76040 Add Codestral Provider 2026-05-23 19:09:22 -07:00
Alishahryar1 fbb1d6586d feat(providers): native Anthropic Messages for Kimi, Fireworks, Z.ai
Route these providers through POST /messages with vendor headers and bases (including Kimi model list on OpenAI /v1/models). Remove Z.ai from OpenAI-chat server-tool rejection; extend tests and README.
2026-05-23 17:03:59 -07:00
Alishahryar1 ab842fd920 Add Cereberas Provider 2026-05-23 16:35:27 -07:00
Alishahryar1 b2f66db0bb Add Groq Provider 2026-05-23 16:31:48 -07:00
Alishahryar1 1324c36da5 Add Gemini Provider 2026-05-23 16:26:38 -07:00
Alishahryar1 870576937f Add Mistral Provider 2026-05-23 16:16:59 -07:00