singularity-forge/packages/pi-ai/src
Derek Pearson 5ecf047553 fix(pi-ai): correct Copilot context window and output token limits (#2118)
* fix(gsd extension): detect initialized projects in health widget

Use .gsd presence plus project-state detection for the health widget so bootstrapped projects no longer appear as unloaded before metrics exist.

* fix(gsd extension): detect initialized projects in health widget

Use .gsd presence plus project-state detection for the health widget so bootstrapped projects no longer appear as unloaded before metrics exist.

* fix(pi-ai): correct Copilot context window and output token limits

- Remove github-copilot from 1M contextWindow override in generate-models.ts
- Add runtime fetching of model limits from Copilot /models API
- Apply fetched limits in modifyModels and refreshToken flows
- Regenerate models.generated.ts with corrected values
- Fix models.ts type constraints for providers not in MODELS

Fixes #2115

* fix(pi-ai): address QA round 1

- Use strict type/bounds checks for API limit values (QA-R1-001/005)
- Add caller-level try/catch in refreshToken for defense-in-depth (QA-R1-009)

* fix(pi-coding-agent): refresh model registry after OAuth token refresh

ModelRegistry.modifyModels() only ran at load time, so model limits
fetched during token refresh were persisted to auth.json but never
applied to the in-memory model objects. Users saw stale contextWindow
values (e.g., 144K from models.dev instead of 200K from the Copilot API).

Add credential change notification to AuthStorage: after a successful
OAuth token refresh, listeners are notified via queueMicrotask. The
ModelRegistry now registers a listener at construction that triggers
a full model reload, picking up the new limits from modifyModels().
2026-03-22 17:04:16 -06:00
..
providers feat: add anthropic-vertex provider for Claude on Vertex AI (#1533) 2026-03-19 23:14:13 -06:00
utils fix(pi-ai): correct Copilot context window and output token limits (#2118) 2026-03-22 17:04:16 -06:00
api-registry.ts refactor: remove dead code (unused exports) (#1486) 2026-03-19 15:33:32 -06:00
bedrock-provider.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
cli.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
env-api-keys.ts feat: add anthropic-vertex provider for Claude on Vertex AI (#1533) 2026-03-19 23:14:13 -06:00
index.ts Remove deprecated legacy dead code from OAuth module 2026-03-14 05:11:55 +00:00
models.generated.ts fix(pi-ai): correct Copilot context window and output token limits (#2118) 2026-03-22 17:04:16 -06:00
models.ts fix(pi-ai): correct Copilot context window and output token limits (#2118) 2026-03-22 17:04:16 -06:00
oauth.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
stream.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
types.ts feat: add anthropic-vertex provider for Claude on Vertex AI (#1533) 2026-03-19 23:14:13 -06:00
web-runtime-env-api-keys.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-runtime-oauth.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00