- 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.
- Added dependency-free `@oh-my-pi/pi-ai/effort` module and re-exported `Effort`/`THINKING_EFFORTS`.
- Moved `Effort` and `THINKING_EFFORTS` from `model-thinking.ts` to `effort.ts`, then migrated runtime/tests imports.
Mapped GitHub Copilot OAuth discovery context windows from max_context_window_tokens before prompt budgets.
Kept output token mapping on max_output_tokens and covered the fallback order in Copilot model limit tests.
Fixes#1539
Three fixes to make CI green after the opus 4.7 and auto-bump landed:
1. github-copilot model mapper: prefer capabilities.limits.max_prompt_tokens
over the root-level context_length field (which mirrors max_context_window_tokens, i.e.
total window). Copilot's real /models response returns both for the gpt-5.x family, and
context_length inflates contextWindow with the output budget. Also restore the bundled
Copilot limits (claude-opus-4.6, gpt-5.2, gpt-5.4, gpt-5.4-mini, grok-code-fast-1) to
the values the fixed mapper produces so tests that depend on truthful offline fallbacks
pass. Update the two Copilot discovery tests whose payloads conflated context_length
with prompt capacity.
2. coding-agent task schema: make the per-task assignment description context-mode-aware.
The previous description unconditionally told agents that 'shared background belongs
in context', which is wrong for independent mode where shared context is disabled.
3. coding-agent model-registry test: update the anthropic-latest canonical collapse case
to claude-opus-4-7 since opus 4.7 is now the newest official opus in models.json.
Copilot's /models endpoint exposes token limits under capabilities.limits.
max_prompt_tokens is the actual prompt capacity (what OMP calls contextWindow),
while max_context_window_tokens is the total window (prompt + output budget).
Using the latter inflates contextWindow, which breaks compaction thresholds,
overflow detection, and context promotion.
Three changes:
1. mapModel reference selection: always prefer the Copilot-specific bundled
reference over the global cross-provider reference. Copilot imposes its
own limits that are strictly lower than native provider limits.
2. mapModel contextWindow chain: remove max_context_window_tokens from the
fallback. New chain: context_length -> max_prompt_tokens -> reference.
3. generate-models: stop overwriting contextWindow/maxTokens in
applyGlobalModelsDevFallback. These are provider-specific and should not
be replaced with cross-provider models.dev global references.
Also fixes bundled values: github-copilot/gpt-5.4 (400k -> 272k) and
github-copilot/gpt-5.2 (264k -> 128k) to match live API max_prompt_tokens.
Refs: #225, #226
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.
- Fixed memory leak by cancelling idle compaction timer on event controller disposal.
- Fixed session resumption to preserve last non-empty session when starting fresh.
- Fixed stash detection to use git ref resolution instead of output parsing for reliability.
- Fixed secret obfuscation to deobfuscate restored session messages locally while keeping LLM messages obfuscated.
- Fixed stash pop operation to preserve staged changes with --index flag after task branch merges.
- Changed idle compaction settings from enum to numeric type for flexible configuration.
- Added 40+ new AI model entries across multiple providers including Alibaba, Google, ByteDance, NVIDIA, OpenRouter, and others.
- Updated context window and token limits for existing models including GitHub Copilot Opus 4.6 (1M tokens) and Gemini 2.5 Pro (1M tokens).
- Fixed GitHub Copilot and Gemini 2.5 Pro model detection logic in context window calculation.
- Enhanced model configurations with reasoning capabilities, thinking modes, and updated pricing across providers.