21 Commits

Author SHA1 Message Date
roboomp 565d09b13a fix(catalog): route copilot grok-4.6 through responses api
GitHub Copilot serves grok-4.6 / grok-4.6-1m only via /responses, but
isCopilotResponsesModelId matched grok-4.5 exactly, so both the static
generator and dynamic discovery classified grok-4.6 as openai-completions
and requests 400d with unsupported_api_for_model.

- match grok-4.6 in isCopilotResponsesModelId
- add grok-4.6 / grok-4.6-1m to COPILOT_CACHE_INVALIDATED_MODEL_IDS so
  stale cached completion routes drop on refresh
- regenerate github-copilot/grok-4.6 to api openai-responses (compat
  block dropped, xhigh effort added by the responses policy)
- cover discovery routing and cache migration in tests

Fixes #8807
2026-08-19 09:27:16 +00:00
roboomp c0394ba53d fix(catalog): scope Copilot model cache by credential
Copilot discovery writes an authoritative cache, so online-if-uncached served the prior endpoint for the full TTL after COPILOT_GITHUB_TOKEN switched accounts. Keying the cache namespace on the credential forces fresh discovery for a new token instead of reusing a stale personal-endpoint cache.

Fixes #8507
2026-08-14 05:12:06 +00:00
roboomp ce65a40539 fix(catalog): bound Copilot endpoint probe with discovery timeout
Threaded the shared 10s discovery AbortSignal into the copilot_internal/user probe so a stalled endpoint falls back to the personal host instead of hanging startup or refresh.

Fixes #8507
2026-08-14 04:47:42 +00:00
roboomp c92ba97538 fix(catalog): discovered Copilot endpoint for env tokens
Shared the plan-endpoint probe between OAuth login and raw token model discovery so Business credentials route to their advertised API host.

Added regression coverage for the raw environment-token path.

Fixes #8507
2026-08-14 04:41:27 +00:00
can1357 6b4823181b test: cleaned test suites and documented filtering guidelines
- Remove redundant definedness, null, and type checks across test suites in multiple packages.
- Clean up unused assertions, metadata tests, and obsolete test cases.
- Add good versus bad test filter guidelines and requirements to project documentation.
2026-08-13 08:28:42 +02:00
can1357 60d4cb997e test(catalog): pinned copilot grok-4.5 migration to the responses route
- The regenerated bundle (merged with PR #8021) now ships a
  responses-route github-copilot/grok-4.5, so the id legitimately
  resurfaces from the bundle when the migration refresh fails; the
  contract worth defending is that the stale cached completions route
  never returns and the unbundled long-context variant stays dropped.
2026-08-08 20:57:10 +02:00
roboomp 27c1d6e8d4 fix(catalog): used live copilot default-tier prices
Applied GitHub Copilot's discovered default token-price tier to base models while preserving the provider fallback for unreported cache-write costs. Added regression coverage for GPT-5.6 Luna base and long-context pricing.

Fixes #7471
2026-08-03 08:38:14 +00:00
roboomp b7c2026980 fix(catalog): invalidated cached grok context variants
Drop the synthesized grok-4.5-1m completion route alongside its base model during the Copilot Responses migration.

Cover the failed-refresh fallback so neither stale selectable route survives when discovery is unavailable.

Fixes #7096
2026-07-30 15:49:01 +00:00
roboomp cafbe6dec0 fix(catalog): refreshed endpoint-migration caches
Fold provider cache-drop policies into the catalog fingerprint and force online-if-uncached discovery when an affected cached model is present.

Seed the Copilot migration regression with the real bundled fingerprint and verify stale Grok and MAI completion routes are rewritten through Responses.

Fixes #7096
2026-07-30 15:40:34 +00:00
roboomp 1e3ac8f69d fix(catalog): invalidated cached copilot grok route
Drop cached grok-4.5 Chat Completions rows when the bundled Copilot catalog fingerprint changes, matching the existing MAI endpoint migration.

Cover both cached endpoint migrations through the model manager's default online-if-uncached path.

Fixes #7096
2026-07-30 15:32:16 +00:00
roboomp 4819341053 fix(catalog): routed copilot grok 4.5 to responses
Route the Copilot-discovered grok-4.5 model through the Responses API so requests no longer hit the unsupported Chat Completions endpoint.

Add focused discovery coverage for the endpoint contract.

Fixes #7096
2026-07-30 15:25:46 +00:00
can1357 d7241e572f fix(catalog): invalidate stale MAI Code routes 2026-07-16 03:31:58 +02:00
roboomp 4d89b29028 fix(catalog): routed copilot mai-code models to responses api
GitHub Copilot's mai-code-1-flash-picker (and other mai-* models) are
served only through the /responses endpoint; the classifier routed them
to /chat/completions, which returned 400 unsupported_api_for_model.

Added the mai- prefix to isCopilotResponsesModelId so both dynamic
discovery (inferCopilotApi) and bundled resolution
(COPILOT_API_RESOLUTION_RULES) select openai-responses, and updated the
bundled models.json entry to match.

Fixes #5612
2026-07-15 20:13:11 +00:00
roboomp e58d2c460c fix(providers): preserved copilot vision denials
Treat GitHub Copilot discovery input as authoritative during model merges so explicit supports.vision=false is not OR-upgraded from bundled references.

Fixes #4779
2026-07-10 12:20:39 +00:00
roboomp 4bae9a42ab fix(providers): required copilot vision confirmation
Keep non-personal Copilot endpoints text-only when discovery omits supports.vision, while preserving explicit vision support.

Fixes #4779
2026-07-10 12:08:43 +00:00
roboomp b0f22caf83 fix(providers): restored copilot business vision
Honor GitHub Copilot /models vision support on Business and Enterprise endpoints and remove the stale snapcompact non-personal-host block.

Fixes #4779
2026-07-10 11:57:14 +00:00
roboomp 714051d795 fix(catalog,coding-agent): disable vision on non-personal copilot endpoints
GitHub Copilot's /models response advertises supports.vision = true for
Claude/GPT chat models on every host, but only the canonical personal
endpoint (https://api.githubcopilot.com) actually accepts image inputs;
the business (api.business.githubcopilot.com) and enterprise
(copilot-api.{domain}) hosts respond '400 vision is not supported'.
snapcompact then injected rasterized transcript frames after compaction
and permanently broke every business-Copilot session.

- Catalog discovery (githubCopilotModelManagerOptions.mapModel) now
  forces input=['text'] whenever the resolved baseUrl is not the
  canonical personal-Copilot host, so the upstream's vision flag is
  honoured only where it actually works.
- mergeDynamicModel honours the dynamic input value (instead of
  OR-upgrading with the bundled reference) when the merged baseUrl
  differs from the bundled one, so a bundled spec pinned to the
  personal host can no longer taint a business-resolved merge.
- snapcompact-inline's canSendImages helper short-circuits the
  rasterizer for any github-copilot model whose baseUrl is non-personal,
  catching stale cached specs that still advertise vision.
- Helper isPersonalGitHubCopilotBaseUrl exported from
  pi-catalog/wire/github-copilot so catalog and coding-agent share one
  canonical check.

Regression coverage in github-copilot-model-limits.test.ts (vision
endpoint policy + full merge) and snapcompact-inline.test.ts (#3387
business/enterprise case).

Fixes #3387
2026-06-24 16:27:14 +00:00
roboomp 13b2b55221 fix(auth): routed copilot business endpoint
Stored GitHub Copilot plan-specific API endpoints discovered during OAuth login and propagated them through structured credentials, model discovery, usage/probe metadata, and request base URL resolution.

Added regression coverage for Business endpoint discovery, serialization, dynamic model discovery, and chat/responses routing.

Fixes #2876
2026-06-17 12:47:19 +00:00
can1357 c3e5b60174 feat(catalog): added requestModelId routing and Copilot long-context discovery support
- Added optional `requestModelId` to the `Model` interface for upstream wire overrides.
- Prioritized `model.requestModelId` when resolving request model IDs for Anthropic and OpenAI paths.
- Used `COPILOT_API_HEADERS` in Copilot discovery and policy calls with API version `2026-06-01`.
- Synthesized Copilot `-1m` long-context sibling models with dedicated upstream IDs and pricing data.
2026-06-11 21:28:32 +02:00
can1357 a25d521cab refactor(catalog): baked thinking metadata into buildModel pipeline
- Replaced minLevel/maxLevel range with explicit efforts array plus baked effortMap/supportsDisplay wire facts.
- Removed runtime enrichment layer and modelOmitsReasoningEffort; providers now read baked fields.
- Fixed dotted Opus 4.7/4.8 ids missing adaptive display via classifier-based predicates (#1373).
- Bumped model cache schema to v4 to invalidate pre-efforts rows.
2026-06-10 07:22:11 +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