18 Commits

Author SHA1 Message Date
can1357 ae415199dc feat: added build-time compatibility in ModelSpec/buildModel pipeline
- Centralized catalog and registry handling on `ModelSpec` and `buildModel`, resolving compatibility at model build time.
- Removed runtime compatibility detectors and switched provider request flows to direct `model.compat` reads.
- Added compat fields (`supportsReasoningParams`, `alwaysSendMaxTokens`, `strictResponsesPairing`, `whenThinking`).
- Persisted explicit compatibility overrides through `compatConfig` in discovery and cache merge paths.
2026-06-10 06:20:51 +02:00
can1357 1b9d9d0851 refactor(catalog)!: split model catalog from pi-ai
Move bundled models, model cache/manager, thinking metadata, effort helpers,
provider descriptors/discovery, wire constants, and model identity utilities
into the new @oh-my-pi/pi-catalog package.

Update pi-ai to keep provider runtime/auth concerns, move catalog provider
metadata into CATALOG_PROVIDERS, and migrate coding-agent, agent, stats, docs,
and tests to import catalog values from pi-catalog.

Split coding-agent model registry helpers into discovery, roles, and models
config modules while preserving registry orchestration.

BREAKING CHANGE: @oh-my-pi/pi-ai no longer exports catalog subpaths such as
/models, /model-cache, /model-manager, /model-thinking, /effort,
/provider-models*, discovery helpers, and provider wire constants; use the
matching @oh-my-pi/pi-catalog subpaths instead.
2026-06-10 04:06:57 +02:00
can1357 f80d45aa6b fix(anthropic-provider): resolved Anthropic request and stream handling
- Added a 4-slot concurrency limiter for Anthropic multi-image resize work.
- Prioritized client-owned request fields and `claudeCodeVersion`-based `User-Agent` headers.
- Ignored terminal `message_delta` envelopes and treated missing `usage`/`delta` payloads as non-fatal.
- Stopped ping-only streams from consuming first-event watchdog logic and preserved timeout retries.
2026-06-09 23:17:26 +02:00
can1357 eb1a46baf5 feat: added injectable fetch transport across AI and coding network flows
- Added optional FetchImpl fields to compaction, proxy, AI, coding-agent, and mnemopi options.
- Threaded injected fetch implementations through OAuth, discovery, and search/LLM request flows.
- Removed exported hookFetch utility and its package entrypoint from utils.
- Replaced global-fetch test monkeypatching with per-test FetchImpl mocks across test suites.
2026-06-09 04:51:17 +02:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 31b6f0bf31 refactor(ai): consolidated provider config into single-source registry
- Derived descriptors, default-model map, env keys, login list, and refresh dispatch from one ProviderDefinition per provider.
- Disabled OpenAI Codex stream obfuscation and interrupted whitespace-only tool-call argument deltas.
- Derived auth-broker callback ports and paste-code login set from the registry.
2026-06-08 18:48:43 +02:00
roboomp 260171c5fe fix(providers): used api key auth for opencode go
OpenCode Go's Anthropic-compatible endpoint rejects bearer-only auth before validating the token, producing the reported Missing API key error for qwen3.7-max and minimax-m3.

Route OpenCode Go Anthropic requests through X-Api-Key while preserving bearer-only auth for OpenCode Zen, and cover the request headers with regression tests.

Fixes #1736
2026-06-02 21:26:12 +00:00
roboomp af5cca19f4 fix(ai): used bearer auth for opencode anthropic models
- Cleared Anthropic SDK apiKey/authToken for OpenCode Go/Zen Anthropic-format models so requests rely only on the OpenCode bearer Authorization header.
- Added regression coverage for qwen3.7-max auth configuration and documented the fix.

Fixes #1661
2026-06-01 21:06:12 +00:00
Adrian Glapiński 035adc610c fix(ai): restore Copilot reasoning controls
fixes #773
2026-04-26 12:37:37 +02:00
Abir Biswas bafa3b8a06 fix: github.com enterprise routing and structured Copilot OAuth credentials 2026-04-09 18:47:08 +02:00
Abir Biswas 31e4b91019 feat(ai): replace GitHub Copilot auth with opencode OAuth flow
Replace VSCode extension impersonation (client ID Iv1.b507a08c87ecfe98,
User-Agent GitHubCopilotChat/0.35.0) with the opencode OAuth app
(Ov23li8tweQw6odWQebz, User-Agent opencode/1.3.15).

Key changes:
- OAuth device flow now uses JSON body encoding and opencode headers
- GitHub OAuth token is used directly for all API requests; no JWT
  exchange or refresh cycle needed
- Base URL changed from api.individual.githubcopilot.com to
  api.githubcopilot.com across models.json, openai-compat.ts, and
  the oauth module
- Removed proxy-ep JWT base URL extraction from github-copilot-headers.ts
  and openai-compat.ts (resolveGitHubCopilotBaseUrl now passes through
  the model baseUrl unchanged)
- refreshGitHubCopilotToken is now a synchronous identity return
- All 25 bundled Copilot model definitions updated to new headers/baseUrl
- Tests updated to reflect plain GitHub token format and new base URL

Existing users will need to re-authenticate once with /login github-copilot.
2026-04-09 18:47:08 +02:00
Zakhar Kogan ccfd53c318 fix(ai): normalize anthropic base URLs (#561)
Co-authored-by: Zakhar Kogan <36503576+zaharkogan@users.noreply.github.com>
2026-03-29 17:48:54 +02:00
can1357 ea1d76b79e fix(tests): typing in tests for Context and event typing 2026-03-14 11:06:32 +01:00
can1357 3056caee91 chore: reformat 2026-03-14 10:46:26 +01:00
inprealpha 68894ab78b fix(coding-agent): attribute automatic compaction as agent (#397)
* fix(coding-agent): preserve Copilot initiator for auto-compaction

* fix(coding-agent): scope compaction initiator to auto mode

* test(ai): cover copilot initiator override in providers
2026-03-14 10:43:00 +01:00
can1357 0611e97dbc fix(ai,coding-agent): resolve copilot endpoint at provider layer
Fixes #260
2026-03-03 05:33:56 +01:00
can1357 5d32f93c0d fix(ai): improved error handling and provider robustness
- Added raw HTTP request dumps to error messages for 400 status codes.
- Implemented client-side retry for Anthropic streaming on transient errors.
- Preserved context by converting aborted assistant tool calls to text.
- Optimized model registry refresh in coding agent sessions.
2026-02-20 22:22:04 +01:00
can1357 c12be01a5f fix(coding-agent): backported pi-mono changes (34878e..5133697)
packages/ai:
- fix: hardened OpenAI tool-call JSON parsing for malformed trailing arguments
- feat: routed GitHub Copilot Claude 4.x models through anthropic-messages
- feat: centralized dynamic Copilot headers and anthropic bearer auth handling
- feat: added optional StreamOptions.metadata propagation
- test: added Copilot headers/auth/routing coverage
- fix: updated model generator and models.json for Copilot Claude API mapping

packages/coding-agent:
- fix: made CLI model resolution deterministic with provider-aware pattern parsing
- fix: corrected compaction boundary/context usage handling after compaction
- feat: expanded extension events and terminal input hook integration
- fix: hardened git source parsing to avoid local-path misclassification
- test: added git-url parser coverage and model-resolver cases

packages/tui:
- fix: scoped @ fuzzy autocomplete to typed path prefixes
- feat: added Windows VT input mode support via bun:ffi

docs:
- chore: updated porting sync point to 5133697
2026-02-16 10:08:53 +01:00