1667 Commits

Author SHA1 Message Date
Armin Ronacher ea65a51a15 fix: update vulnerable dependencies 2026-06-19 00:43:44 +02:00
Fred K. Schott 0d89a33373 feat(packages): Add selective pi-ai base entrypoints (#5348) 2026-06-19 00:41:49 +02:00
Armin Ronacher 651d10d90b feat(ai): enable Mistral prompt caching 2026-06-18 23:47:25 +02:00
Armin Ronacher cab89d1435 docs: audit unreleased changelogs 2026-06-18 23:09:41 +02:00
Danila Poyarkov b09fbde00e feat(ai): add OpenRouter Fusion alias (#5866) 2026-06-18 22:39:02 +02:00
Armin Ronacher 788a044483 Add [Unreleased] section for next cycle 2026-06-18 18:22:10 +02:00
Armin Ronacher c4ab61dcbf Release v0.79.7 2026-06-18 18:22:07 +02:00
Vegard Stikbakke 58dd2f5996 feat(ai): add GLM-5.2 to OpenCode Go model catalog
closes #5860
2026-06-18 10:06:23 +02:00
Armin Ronacher 12bb8dd2c9 Add [Unreleased] section for next cycle 2026-06-16 23:59:17 +02:00
Armin Ronacher 31bfb2f16f Release v0.79.6 2026-06-16 23:59:14 +02:00
Armin Ronacher 7da475db66 fix(ai): regenerate model catalog 2026-06-16 23:58:43 +02:00
Armin Ronacher bd9f8773ad fix(ai): restore OpenCode Go DeepSeek thinking controls 2026-06-16 23:14:56 +02:00
Armin Ronacher 0b0b9eae62 Add [Unreleased] section for next cycle 2026-06-16 19:54:26 +02:00
Armin Ronacher 6561cb293b Release v0.79.5 2026-06-16 19:54:23 +02:00
Armin Ronacher 2431491c92 fix(ai): avoid duplicate OpenCode DeepSeek reasoning controls
closes #5818
2026-06-16 19:05:44 +02:00
Armin Ronacher 2d597f0212 fix(ai): tolerate null Responses message content
closes #5819
2026-06-16 19:00:12 +02:00
Armin Ronacher 7f29e7a369 feat: add provider-scoped environment overrides (#5807) 2026-06-16 17:19:08 +02:00
Armin Ronacher 75b0d723c0 fix(ai): support Z.AI GLM-5.2 effort levels
closes #5770
2026-06-16 14:29:27 +02:00
Armin Ronacher b0c8f65ffa fix(ai): update Google Vertex Gemini models
closes #5761
2026-06-16 01:03:12 +02:00
Armin Ronacher 0369bdb8f4 fix(ai): add Moonshot CN Kimi K2.7 metadata
closes #5760
2026-06-15 17:08:59 +02:00
Armin Ronacher 1aa3c02d56 Add [Unreleased] section for next cycle 2026-06-15 10:28:24 +02:00
Armin Ronacher bba6af2c71 Release v0.79.4 2026-06-15 10:28:21 +02:00
Armin Ronacher b1ad469be4 docs: audit changelog entries 2026-06-15 10:23:19 +02:00
Armin Ronacher 408ac103ec fix(ai): update Copilot Claude thinking metadata
closes #4637
2026-06-15 09:50:25 +02:00
Bucky 0be5bb6c96 fix(ai): price anthropic 1h cache writes at 2x input (#5738)
anthropic 1h cache writes were billed at the 5m rate; split the bucket and price the 1h portion correctly
2026-06-15 09:21:14 +02:00
Armin Ronacher 21a904f4b7 fix(ai): disable OpenCode long cache retention for rejecting routes
closes #5702
2026-06-13 23:59:45 +02:00
Armin Ronacher 6f29450e13 fix(ai): update adaptive thinking model expectations 2026-06-13 11:17:38 +02:00
Armin Ronacher b15148fe37 Add [Unreleased] section for next cycle 2026-06-13 11:11:14 +02:00
Armin Ronacher f2585c4c82 Release v0.79.3 2026-06-13 11:11:11 +02:00
Armin Ronacher aa3a5233ad fix(ai): restore Codex context limits 2026-06-13 11:02:38 +02:00
Armin Ronacher 032c01c1e1 Add [Unreleased] section for next cycle 2026-06-13 00:25:18 +02:00
Armin Ronacher f21f3c4bbd Release v0.79.2 2026-06-13 00:25:15 +02:00
Armin Ronacher e320f09618 docs: update unreleased changelogs 2026-06-13 00:20:01 +02:00
Armin Ronacher 121f0edbf4 fix(ai): detect parenthesized context overflow errors
closes #5677
2026-06-13 00:01:37 +02:00
Michael Yu 7a3cb6312e fix(ai): normalize generated model costs (#5634) 2026-06-13 00:01:04 +02:00
Armin Ronacher a7cdc679e7 fix(ai): correct GPT-5 context window metadata
closes #5644
2026-06-12 23:03:10 +02:00
Armin Ronacher be7d5cf585 fix(ai): relax Codex SSE header timeout 2026-06-12 17:08:30 +02:00
Ramiz Wachtler a455f62f72 fix(ai): preserve Anthropic refusal details (#5666)
Propagate Anthropic refusal stop_details explanation to errorMessage
2026-06-12 14:52:46 +02:00
Vegard Stikbakke 3f44d3e2eb fix(ai): remove stale OpenRouter Kimi free model assertion (#5650) 2026-06-12 09:00:15 +02:00
Mario Zechner 827fe1e2c4 feat(ai): ImagesModels collections mirroring the chat-side design
createImagesModels()/ImagesProvider/createImagesProvider() give image
generation the same shape as chat: sync model reads, explicit async
refresh(provider?) with in-flight dedupe, provider-resolved auth, and
never-rejecting generateImages() (failures return AssistantImages with
stopReason error). Auth resolution is shared with the chat side via the
free-standing resolveProviderAuth() in auth/resolve.ts, which also owns
ModelsError; both collections pass their store/context as arguments.

The OpenRouter implementation moves to api/openrouter-images.ts with a
lazy wrapper; openrouterImagesProvider() factory plus
builtinImagesProviders()/builtinImagesModels() land in providers/all.
The ImagesProvider id type alias is renamed to ImagesProviderId
(mirror of Provider -> ProviderId). The old global image API
(getImageModel*, generateImages, registerImagesApiProvider) stays on
/compat, its registration shim repointed at the moved implementation.

README: Quick Start uses builtinModels(), the full streaming event
switch, image generation and the development checklist are restored in
full, image generation documents the new collections with compat noted
for the old API, plus the review fixes (builtinModels options,
credential-store mention for browsers, ImagesModels notes).
2026-06-11 00:27:43 +02:00
Mario Zechner e1283fc17a docs(ai): rewrite README around the Models API
Quick Start, querying, auth, OAuth, custom providers, faux, handoffs,
browser usage, and the dev checklist now demonstrate createModels() +
provider factories: sync model reads with explicit refresh, provider-
owned auth resolution (getAuth, credential store, env tables),
OAuthAuth login/refresh with prompt()/notify() callbacks, and
createProvider() for custom/dynamic providers (replacing bare Model +
global stream). Direct API implementation calls documented under the
canonical ./api/<id> subpaths with the legacy aliases noted.

The old global API is documented once, in a migration section pointing
at /compat with an old-to-new mapping table. Image generation is
documented as living on compat for now. All import/code claims
verified with a compile-and-run smoke script.
2026-06-10 23:37:11 +02:00
Mario Zechner 6e98573f24 feat(ai): sync model reads, explicit async refresh
Provider.getModels() is sync-only (last-known list; must not throw) with
an optional refreshModels() where dynamic providers fetch. The
sync-or-async union invited latent sync assumptions that would detonate
on the first dynamic provider; async-only reads would force sync
consumer surfaces (extension find/getAll) through Promises. Sync reads
plus an explicit refresh verb keeps the contract single and the
staleness visible.

Models.getModels()/getModel() are sync best-effort reads;
Models.refresh(provider?) rejects with ModelsError(model_source) for a
single provider and is concurrent best-effort across all providers.
createProvider() takes a models array plus an optional refreshModels
fetcher (stored on success, in-flight calls deduped, list unchanged on
rejection). forceRefresh options are gone.

Also finishes the in-progress AuthStorage fallbackResolver removal
(drops the now-unused includeFallback option from getApiKey).
2026-06-10 23:30:04 +02:00
Mario Zechner 10a575b76b docs: changelogs and phase restructure for the models refactor (phase 8)
Breaking-change entries with migration guides: pi-ai (compat
entrypoint, Provider -> ProviderId, api module moves, new Models/
provider/auth API), agent (required AgentHarnessOptions.models,
compaction signatures, structural StreamFn), coding-agent (extension
author note: runtime unaffected via loader compat alias).

models.md: Phase 7 closed out (import switch landed with phase 5; the
gated bullets move to a new Phase 9 ModelManager-migration outline:
per-session Models, AgentSession streaming, AuthStorage replacement,
login UI on OAuthAuth, cloudflare cleanup, internal compat removal,
compat deletion).
2026-06-10 21:31:56 +02:00
Mario Zechner 8a0903ebf2 feat(ai): compat entrypoint, core-only root barrel (phase 5)
The root barrel is now core-only and side-effect free: types,
createModels/createProvider, auth substrate, lazyStream/lazyApi, faux,
utils. Generated catalogs, api-registry, env-api-keys, images, global
stream functions, and per-API lazy wrappers leave the root.

New @earendil-works/pi-ai/compat preserves the old surface verbatim as
a strict superset of the root: api-dispatch stream/complete with env
key injection, the builtin registration side effect (skip-if-present so
it cannot clobber earlier overrides), deprecated getModel/getModels/
getProviders aliases of the new getBuiltin* reads in providers/all,
lazy api wrappers + setBedrockProviderModule, and image generation.
Compat dies with the coding-agent ModelManager migration.

Packaging: exports map gains ./compat, ./providers/*, ./api/*;
sideEffects array lists only the effectful modules.

Old-global imports across agent/coding-agent/examples and pi-ai tests
switch to /compat (path-only; compat is a superset). The coding-agent
extension loader resolves the pi-ai ROOT specifier to compat, so
existing user extensions using the old global API keep working at
runtime until compat is removed. vitest configs alias /compat to src;
browser smoke imports old globals from /compat.
2026-06-10 21:17:12 +02:00
Mario Zechner 4d5c015820 feat(ai): adapt OAuth flows to OAuthAuth (phase 4)
anthropic, openai-codex, and github-copilot flow modules gain OAuthAuth
exports (login/refresh/toAuth) wired to the prompt()/notify() login
callbacks, making the lazyOAuth attachments on the provider factories
functional. Copilot's modifyModels baseUrl rewriting becomes toAuth()
returning ModelAuth.baseUrl derived from the token proxy endpoint.

Callback-server flows race a manual_code prompt and abort it through
AuthPrompt.signal once the flow settles; OAuthAuth has no
usesCallbackServer flag. The old OAuthProviderInterface exports stay
unchanged until the coding-agent migration.
2026-06-10 20:41:29 +02:00
Mario Zechner fec0c3d12f feat(ai): provider factories, per-provider catalogs, createProvider (phase 3)
Auth helpers in src/auth/helpers.ts: envApiKeyAuth() (stored key wins,
then env vars in order, with secret-prompt login) and lazyOAuth()
(flow loads on first use through bundler-opaque dynamic imports in
utils/oauth/load.ts; the OAuthAuth flow exports land in phase 4).
There is no OAuth factory toggle: providers that support OAuth always
attach it, advertising costs nothing until login/refresh runs.

createProvider() in models.ts builds providers from parts: single API
implementation or a map dispatched on model.api (mixed-API providers
like opencode and github-copilot); unknown api yields a stream error.

generate-models.ts now emits one providers/<id>.models.ts catalog per
provider (35 files, biome-excluded like models.generated.ts) and
models.generated.ts becomes a generated aggregator, so importing one
provider factory pulls one catalog. Typed getModel globals unchanged.

One factory per built-in provider under src/providers/: envApiKeyAuth
for standard providers, OAuth for anthropic/openai-codex/github-copilot,
ambient ApiKeyAuth for amazon-bedrock (AWS env/profile/IAM) and
google-vertex (explicit key or ADC+project+location).

providers/all.ts: builtinProviders(), builtinModels(), getBuiltin*
re-exports. fauxProvider() factory returns a real Provider for tests;
legacy registerFauxProvider() unchanged.
2026-06-10 20:33:20 +02:00
Mario Zechner 20a9b82cf9 fix(ai): regenerate model catalog
Picks up the Claude Fable 5 thinking-off metadata (off: null in
thinkingLevelMap) that 9ccfcd7c added to the generator without
regenerating, fixing anthropic-thinking-disable and supports-xhigh
tests. Includes upstream catalog drift; OpenRouter delisted
moonshotai/kimi-k2.6:free, so the kimi compat test now pins only the
listed variant.
2026-06-10 20:09:13 +02:00
Mario Zechner ba93da9a93 feat(ai): move API implementations to src/api with lazy wrappers (phase 2)
Stream implementations move from src/providers/ to src/api/, renamed by
API id (anthropic.ts -> anthropic-messages.ts, google.ts ->
google-generative-ai.ts, mistral.ts -> mistral-conversations.ts,
amazon-bedrock.ts -> bedrock-converse-stream.ts). Every module now
exports exactly stream/streamSimple; shared helpers move alongside.

New ProviderStreams dispatch contract in types.ts, lazyApi() wrapper in
api/lazy.ts, and one .lazy.ts wrapper per API. Bedrock's wrapper keeps
the node-only variable-specifier import and setBedrockProviderModule()
(now taking ProviderStreams).

providers/register-builtins.ts deleted; interim until the compat
entrypoint lands, builtin api-registry registration lives in stream.ts
and lazy wrappers are exported from the root barrel. Old per-API lazy
exports (streamAnthropic, ...) are gone; package.json subpaths retarget
to dist/api/.
2026-06-10 20:08:59 +02:00
Mario Zechner ee276e4db5 Merge remote-tracking branch 'origin/main' into model-registry 2026-06-10 18:49:18 +02:00
Mario Zechner f63095cfff feat(ai): add Models runtime with provider-owned auth (phase 1)
New Models/MutableModels/createModels collection: provider map, async
model listing (best-effort aggregation), getAuth decision tree with
double-checked locked OAuth refresh, stream/complete with per-field
auth merge over lazyStream.

Auth substrate: ProviderAuth { apiKey?, oauth? }, one type-tagged
credential per provider, CredentialStore (read/modify/delete; modify
is the only write path, serialized RMW), OAuthAuth login/refresh/toAuth
split, prompt()/notify() login callbacks, browser-safe default
AuthContext.

types.ts: Provider alias renamed to ProviderId; ApiOptionsMap and
ApiStreamOptions<TApi> for typed per-API stream options; hasApi()
runtime narrowing guard.
2026-06-10 18:49:10 +02:00