Commit graph

309 commits

Author SHA1 Message Date
Armin Ronacher
6f931797ca fix(coding-agent): install npm packages in managed root closes #4587 2026-05-17 20:48:00 +02:00
Mario Zechner
7adb8e7634 feat(ai): add Together AI provider
Some checks are pending
CI / build-check-test (push) Waiting to run
2026-05-08 16:44:18 +02:00
Armin Ronacher
f4fc04cd75 doc: Update readmes 2026-05-07 20:02:19 +02:00
Mario Zechner
3e5ad67e0f chore: migrate pi packages to earendil works scope 2026-05-07 15:59:42 +02:00
Jake Jia
693888ac47
feat(ai): switch xiaomi default to api billing, add per-region token plan providers (#4112)
Some checks are pending
CI / build-check-test (push) Waiting to run
Built-in `xiaomi` provider now targets the API billing endpoint (https://api.xiaomimimo.com/anthropic) — a single stable URL for keys issued at platform.xiaomimimo.com. The Token Plan endpoints are exposed as three sibling providers, each with its own env var:

- xiaomi-token-plan-cn: XIAOMI_TOKEN_PLAN_CN_API_KEY
- xiaomi-token-plan-ams: XIAOMI_TOKEN_PLAN_AMS_API_KEY
- xiaomi-token-plan-sgp: XIAOMI_TOKEN_PLAN_SGP_API_KEY

BREAKING CHANGE: users who previously set XIAOMI_API_KEY against the Token Plan AMS endpoint must move to xiaomi-token-plan-ams and set XIAOMI_TOKEN_PLAN_AMS_API_KEY. This also resolves the 401 reported by on #4005, where a platform.xiaomimimo.com key fails against the Token Plan endpoint.

closes #4082
2026-05-03 12:57:11 +02:00
Mario Zechner
c0e046990e fix(ai): use Xiaomi Token Plan Anthropic endpoint
closes #3912
2026-05-02 01:36:34 +02:00
Jake Jia
a44622670f
feat(ai): add Xiaomi MiMo provider (#4005)
* fix(ai): include minimax-cn in cross-provider-handoff matrix

* feat(ai): add Xiaomi MiMo provider

Adds Xiaomi MiMo as an openai-completions-compatible provider.

- packages/ai: register provider in types/KnownProvider, env-api-keys (XIAOMI_API_KEY), generate-models, models.generated.ts, overflow util, README, CHANGELOG
- packages/ai/test: extend stream, tokens, abort, empty, context-overflow, overflow, image-tool-result, tool-call-without-result, total-tokens, unicode-surrogate, cross-provider-handoff matrices with Xiaomi
- packages/coding-agent: default model (mimo-v2.5-pro), display name (Xiaomi MiMo), CLI env var docs, README, docs/providers.md

closes #3912

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-05-02 00:46:05 +02:00
MC
24fb6b833b
feat(ai): add Cloudflare AI Gateway as a provider (#3856)
* feat(ai): add Cloudflare AI Gateway as a provider

Routes through Cloudflare's Unified API (`/compat`) for Workers AI and
Anthropic models, and through the provider-specific `/openai` subpath
for OpenAI models so reasoning models (gpt-5.x, o-series) can hit
`/v1/responses` natively. Once `/compat` adds Responses-API support,
the OpenAI subpath can be folded back in.

Catalog layout:
  workers-ai/@cf/...  -> openai-completions, gateway/.../compat
  anthropic/...       -> openai-completions, gateway/.../compat
  <native-id>         -> openai-responses,   gateway/.../openai
                         (gpt-5.1, claude-... no, sorry: gpt-5.x and o-series only;
                          prefix stripped because the OpenAI SDK posts native ids)

Touches:
  packages/ai/src/types.ts                       add cloudflare-ai-gateway to KnownProvider
  packages/ai/src/env-api-keys.ts                map to CLOUDFLARE_API_KEY
  packages/ai/src/providers/cloudflare.ts        add CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL
                                                 and CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL
  packages/ai/src/providers/openai-responses.ts  one-line dispatch through resolveCloudflareBaseUrl
                                                 (matches what openai-completions.ts already does)
  packages/ai/scripts/generate-models.ts         branch openai/* vs workers-ai/anthropic/*
  packages/ai/src/models.generated.ts            spliced 34 entries
  packages/ai/test/stream.test.ts                3 e2e blocks (one per upstream)
  packages/coding-agent/*                        defaultModelPerProvider, login, env docs,
                                                 README, providers.md

Verified end-to-end against a real Cloudflare account with unified
billing: 9/9 e2e tests pass across all three upstreams (Workers AI
Kimi K2.6, OpenAI gpt-5.1 reasoning, Anthropic claude-sonnet-4-5).

* refactor(ai): move AI Gateway User-Agent and per-route session-affinity flag to catalog

Mirrors the same per-model metadata refactor done for Workers AI in the
parent branch. All cloudflare-ai-gateway entries get the User-Agent
header. Only workers-ai/* gateway entries set
`compat.sendSessionAffinityHeaders: true` because the gateway
forwards that header to the underlying Workers AI runtime; anthropic/*
upstream and openai/* (openai-responses) don't use it.

  packages/ai/scripts/generate-models.ts: emit headers (always) and
  per-upstream compat (workers-ai only) on each cloudflare-ai-gateway
  entry.
  packages/ai/src/models.generated.ts: re-spliced 35 entries with
  headers + conditional compat.

Behavior unchanged - 9/9 e2e tests pass across all three upstream
families.

* fix(ai): align AI Gateway with telemetry-aware UA helper

Adapts to badlogic/pi-mono#3851's follow-up fix ("honor telemetry for
Cloudflare attribution headers", fbb5eed) which moved the
'User-Agent: pi-coding-agent' header out of per-model catalog metadata
and into a centralized telemetry-honoring helper
(coding-agent/src/core/sdk.ts:getAttributionHeaders).

- packages/coding-agent/src/core/sdk.ts: extend the cloudflare branch of
  getAttributionHeaders to also match cloudflare-ai-gateway and
  gateway.ai.cloudflare.com.

- packages/ai/scripts/generate-models.ts and src/models.generated.ts:
  drop 'headers' from the 35 cloudflare-ai-gateway entries (constant
  CLOUDFLARE_STATIC_HEADERS no longer exists). Per-route
  compat.sendSessionAffinityHeaders is unchanged.

End-to-end behavior unchanged: 9/9 tests still pass across all three
upstream families (Workers AI, Anthropic, OpenAI Responses).

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-30 23:29:37 +02:00
Mario Zechner
8191d59c17 feat(coding-agent): support session dir env
closes #4027
2026-04-30 21:37:53 +02:00
Mario Zechner
8632e1b948 fix(coding-agent): update agent package readme link
closes #4023
2026-04-30 21:32:53 +02:00
Mario Zechner
fe66edd943 remove gemini cli and antigravity support 2026-04-30 21:24:36 +02:00
Armin Ronacher
904b843fee docs(coding-agent): clarify telemetry update checks 2026-04-30 11:04:20 +02:00
Julien Chaumond
ab7dbd3091
docs: render logo in black on light-mode READMEs (#3812)
Use a <picture> element with prefers-color-scheme so the white logo on
pi.dev stays visible in dark mode and a black variant is shown in light
mode. GitHub's HTML sanitizer strips style attributes and inline SVG, so
the two-file pattern is the only reliable theme-aware approach.

Co-authored-by: julien-agent <Agents+cyolo@huggingface.co>
2026-04-30 10:18:23 +02:00
Armin Ronacher
c745efc0d0
feat: Update check against pi.dev (#3877)
Some checks are pending
CI / build-check-test (push) Waiting to run
2026-04-28 12:48:27 +02:00
Armin Ronacher
4166cfa921 docs(coding-agent): reorganize session docs 2026-04-28 12:06:21 +02:00
MC
d6e08b3da0
feat(ai): add Cloudflare Workers AI as a provider (#3851)
* feat(ai): add Cloudflare Workers AI as a provider

Cloudflare Workers AI hosts open-weight LLMs (Kimi K2.6, GPT-OSS,
GLM-4.7, Llama 4, Gemma 4, Nemotron 3) on Cloudflare's GPU network with
an OpenAI-compatible endpoint. Reuses the openai-completions API
protocol; the per-account URL contains a {CLOUDFLARE_ACCOUNT_ID}
placeholder resolved at request time by a small helper.

Pi automatically sets x-session-affinity for prefix caching:
https://developers.cloudflare.com/workers-ai/features/prompt-caching/

Auth: CLOUDFLARE_API_KEY (matches pi's *_API_KEY convention) +
CLOUDFLARE_ACCOUNT_ID. The User-Agent identifies traffic as
'pi-coding-agent' in Cloudflare analytics.

Verified end-to-end against a real Cloudflare account: 17 e2e tests
pass across stream/empty/tokens/unicode/tool-call-without-result/
total-tokens against @cf/moonshotai/kimi-k2.6.

Cloudflare AI Gateway is a separate, larger change (it requires routing
through provider-specific subpaths with the matching API protocol per
upstream) and will land in a follow-up PR.

* refactor(ai): move Cloudflare User-Agent and session-affinity flag to per-model metadata

Instead of conditionally setting them in openai-completions.ts based on
provider detection, declare them as model-level fields in the catalog
(headers + compat). This is consistent with how the github-copilot and
kimi-coding entries already declare their static headers.

  packages/ai/scripts/generate-models.ts: emit headers and compat fields
  on each cloudflare-workers-ai entry (CLOUDFLARE_STATIC_HEADERS).
  packages/ai/src/providers/openai-completions.ts: drop the
  isCloudflareProvider conditional that injected User-Agent and the
  isCloudflareWorkersAI override of sendSessionAffinityHeaders.
  packages/ai/src/models.generated.ts: re-spliced 8 cloudflare-workers-ai
  entries with headers + compat.

Behavior is unchanged - verified via fetch interceptor that User-Agent
and x-session-affinity / session_id / x-client-request-id are still sent
on outbound requests. 5/5 e2e tests pass.
2026-04-27 23:41:54 +02:00
Armin Ronacher
dcf2651631
feat(coding-agent): Add built-in update command (#3680)
Some checks are pending
CI / build-check-test (push) Waiting to run
2026-04-25 13:09:33 +02:00
Mario Zechner
1e33492525 fix(coding-agent): harden clipboard copy
closes #3639
2026-04-24 12:55:58 +02:00
Mario Zechner
8700ac1f0e fix(coding-agent): support custom npmCommand for git deps
closes #3604
2026-04-23 22:32:32 +02:00
Mario Zechner
e38647f376 fix(coding-agent): restore builtin-only tool disabling
closes #3592
2026-04-23 21:36:16 +02:00
Armin Ronacher
df84e3d22f feat(branding): corporate said we're professionals 2026-04-22 11:04:56 +02:00
Mario Zechner
0bb0a58466 feat(ai): add Fireworks provider support closes #3519 2026-04-22 01:09:11 +02:00
Mario Zechner
ed89480f20 docs(coding-agent): document async extension factories closes #3469 2026-04-20 22:02:03 +02:00
Mario Zechner
860d67518c fix(coding-agent): clarify session ID docs closes #3390 2026-04-20 16:12:32 +02:00
Mario Zechner
d554409b1f fix(coding-agent): split /clone from /fork UX
closes #2962
2026-04-20 14:33:32 +02:00
Mario Zechner
ef1fcfcec2 fix(coding-agent): omit devDependencies when installing packages (fixes #3009) 2026-04-17 01:21:31 +02:00
Mario Zechner
e189b23964 feat(coding-agent): add --no-context-files flag
closes #3253
2026-04-16 10:59:32 +02:00
Mario Zechner
d62d22173a chore: replace OSS weekend with permanent contribution gate 2026-04-14 23:16:11 +02:00
Mario Zechner
7371c30c0a feat(coding-agent): add install telemetry ping controls 2026-04-14 00:21:13 +02:00
Mario Zechner
50ce1b0fb3 docs: enable OSS weekend 2026-04-13 22:59:01 +02:00
Mario Zechner
773f91f40a docs: add OSS session sharing call to action
Some checks failed
CI / build-check-test (push) Has been cancelled
2026-04-06 16:51:20 +02:00
Mario Zechner
0c98d5a54a fix(coding-agent): remove stale /exit docs closes #2850 2026-04-05 23:06:47 +02:00
Mario Zechner
9f9277ccdd refactor(coding-agent): replace AgentSessionRuntimeHost with closure-based AgentSessionRuntime
- Replace AgentSessionRuntimeHost and bootstrap abstractions with AgentSessionRuntime
- Runtime creation is now closure-based via CreateAgentSessionRuntimeFactory
- Factory closes over process-global fixed inputs, recreates cwd-bound services per effective cwd
- Session config (model, thinking, tools, scoped models) re-resolved per target cwd
- CLI resource paths resolved once at startup as absolute paths
- Swap lifecycle: teardown old, create next, apply next (hard fail on creation error)
- Unified diagnostics model (info/warning/error) for args, services, session resolution, resources
- No logging or process exits inside creation/parsing logic
- Removed session_directory support
- Removed session_switch and session_fork extension events (use session_start with reason)
- Moved package/config CLI to package-manager-cli.ts
- Fixed theme init for --resume session picker
- Fixed flaky reftable footer test (content-based polling)
- Fixed silent drop of unknown single-dash CLI flags
- Added error diagnostics for missing explicit CLI resource paths
- Updated SDK docs, examples, plans, exports, tests, changelog

fixes #2753
2026-04-03 20:14:12 +02:00
Mario Zechner
042066b982 docs: refine OSS weekend banner messaging
Some checks failed
CI / build-check-test (push) Has been cancelled
2026-04-02 11:17:42 +02:00
Mario Zechner
71f3e50a16 fix: update OSS weekend gating and messaging 2026-04-02 11:15:19 +02:00
Mario Zechner
d86122cbd3 refactor(coding-agent): add runtime host for session switching closes #2024 2026-03-31 13:49:57 +02:00
warren
84d2b51a2e
feat(coding-agent): add label timestamps to the session tree (#2691) 2026-03-30 15:56:37 +02:00
Mario Zechner
ef6af5ebbd feat(ai,coding-agent): add faux provider and ModelRegistry factories 2026-03-29 21:08:50 +02:00
Mario Zechner
72a8fcca93 docs: enable OSS weekend 2026-03-27 02:31:57 +01:00
Mario Zechner
0cf18f3cf2 docs: extend OSS weekend to 2026-03-30 2026-03-22 23:33:52 +01:00
Mario Zechner
6b83bf4b59 docs: enable OSS weekend 2026-03-20 19:12:42 +01:00
Mario Zechner
8a8e2a8049 docs(agent): update steering docs for deferred tool execution closes #2330 2026-03-18 03:49:30 +01:00
Mario Zechner
1a9185d3cb feat(coding-agent): add --fork session flag closes #2290 2026-03-18 01:09:23 +01:00
Mario Zechner
7eb55b08cf fix(coding-agent): reload keybindings on /reload closes #2309 2026-03-17 23:59:45 +01:00
Mario Zechner
bbd8392ef9 fix(coding-agent): merge piped stdin into initial prompt closes #2315 2026-03-17 22:25:35 +01:00
Mario Zechner
bf60741048 docs: disable OSS weekend 2026-03-17 12:11:55 +01:00
Mario Zechner
0253ebbc2f docs: enable OSS weekend 2026-03-14 16:35:01 +01:00
Mario Zechner
c3fc724887 fix(coding-agent): add uninstall alias
closes #2051
2026-03-14 05:44:47 +01:00
Mario Zechner
7ddaf150d6 fix(coding-agent): support configurable npm wrapper command closes #2072 2026-03-14 04:38:01 +01:00
Fero
b621f3eefd
docs(coding-agent): explain Windows Terminal Alt+Enter remap (#1967) 2026-03-09 13:31:42 +01:00