Commit graph

6546 commits

Author SHA1 Message Date
Armin Ronacher
8cd0ed48de feat(coding-agent): add OAuth sign-in for remote MCP servers
HTTP servers without an Authorization header use OAuth. Connections send the stored token and refresh it after a 401; /mcp login runs the browser authorization code flow (PKCE, dynamic client registration) with a loopback callback or a pasted redirect URL, and /mcp logout removes the credentials. Tokens are stored per server URL in mcp-auth.json. Pre-registered clients are configured with the oauth block.
2026-09-25 15:02:51 +02:00
Armin Ronacher
e5a252c102 feat(coding-agent): highlight JSON return values in codemode output 2026-09-25 15:02:51 +02:00
Armin Ronacher
27d2914457 feat(coding-agent): connect MCP servers and expose them through codemode
Adds a built-in mcp extension that reads mcp.json (agent dir, and .pi/mcp.json for trusted projects) in the common mcpServers format, connects stdio and streamable HTTP servers at session start, and registers their tools as mcp__<server>__<tool>. Calls go through the regular tool pipeline, so hooks and permission extensions apply. /mcp shows server status.

By default a server's tools are codemode-only: the new nestedOnly tool flag keeps them executable for other tools but out of the model's tool declarations, and pi activates the codemode tool for them. "exposure": "direct" declares them to the model as well. structuredContent from tools with an outputSchema reaches codemode scripts as data.
2026-09-25 15:02:51 +02:00
Armin Ronacher
5d29fad158 refactor(mcp): deduplicate transports, client, and OAuth helpers
Single definitions of isObject, toError, and isJsonRpcId in protocol/jsonrpc.
TransportEvents now coerces errors and fires close once, so the stdio,
HTTP, and in-memory transports drop their private copies. McpFetch lives
in auth-provider, removing the type cycle with the HTTP transport.

McpClient: one idempotent markClosed() shared by close(), transport close,
and connect() failure; requestInternal builds the pending entry inside the
promise executor; requireTransport() returns the transport; progress and
cancel notifications split out of handleNotification.

OAuth: compact() replaces validate-then-recast in the metadata parsers;
shared TokenRequestOptions and a single error path in tokenRequest;
discovery, provider, and callback helpers factored out of repeated code.

Tests share an HTTP server helper; the SSE parser test moves into the
HTTP transport test file.
2026-09-25 15:02:51 +02:00
Armin Ronacher
d4d1c69597 refactor(mcp): move transports into src/transports
One file per transport: stdio, streamable-http (SSE parser folded in),
and in-memory. The McpTransport interface and TransportEvents base class
are merged into transports/transport.ts. InMemoryTransport now extends
TransportEvents instead of duplicating the listener sets.

Public exports from the root and ./testing entry points are unchanged.
2026-09-25 15:02:51 +02:00
Armin Ronacher
8d390e7e0e feat(mcp): add OAuth client support 2026-09-25 15:02:51 +02:00
Armin Ronacher
58e4b483b3 feat(mcp): add standalone MCP client 2026-09-25 15:02:51 +02:00
Armin Ronacher
138771cd8a feat(coding-agent): add codemode tool
Adds a built-in, opt-in codemode tool that runs model-written JavaScript in the codemode sandbox. Scripts call the other active tools as tools.<name>(args), including concurrently with Promise.all; only the return value, console output, and images attached with image() reach the model.

Nested calls run through the agent loop via a new AgentToolContext (5th execute argument, ctx.executeTool for extension tools), so argument validation and the beforeToolCall/afterToolCall hooks apply. Hooks and tool_call/tool_result events carry the parent call id.

Tools can declare outputSchema and return structuredContent; codemode passes that to scripts and falls back to text content otherwise. The codemode package gains globals, declaration rendering from JSON Schema, and optional deadlines.
2026-09-25 15:02:51 +02:00
Armin Ronacher
5052d60f00 feat(codemode): add sandboxed JavaScript runtime 2026-09-25 15:02:50 +02:00
David Brailovsky
e473b5cd8b feat(coding-agent): report prompt disposition in RPC responses
Successful RPC prompt, steer, and follow_up responses include
data.disposition ("handled", "queued", or "started" for prompt), so clients
know whether to wait for agent_settled.

fixes #9098
2026-09-25 14:53:11 +02:00
David Brailovsky
b3487650f6 fix(tui): keep cursor visible when overlays close after stop
Closing the last overlay hid the terminal cursor. If an extension closed
an overlay during session shutdown, this ran after stop() had restored
the cursor, leaving the shell with an invisible cursor.

closes #10026
2026-09-25 13:30:50 +02:00
Armin Ronacher
ca7460d16b feat: build with TypeScript 7 and run sources with plain node
Replace the tsgo native preview with typescript@7.0.2 and port the check scripts to the TS 7 API. Target ES2024, drop useDefineForClassFields: false and unused decorator options, and enable verbatimModuleSyntax. Replace tsx with node plus the source resolver hook, passed to --import as a file URL.

closes #9965
2026-09-25 13:14:33 +02:00
David Brailovsky
49681e1b71 fix(coding-agent): hide line range for full-file read calls with null offset/limit
Strict tool schemas make models send null for omitted optional fields.
The read renderer only treated undefined as missing, so full-file reads
rendered as "path:1".

fixes #9996
2026-09-25 11:36:43 +02:00
David Brailovsky
92e8d4f02a fix(coding-agent): stop RpcClient skipping listeners on unsubscribe
closes #9990
2026-09-25 11:27:10 +02:00
David Brailovsky
f444ea5eaf fix(coding-agent): use per-ref cache folders for pinned temporary git extensions
Temporary git extensions (-e git:...@ref) were cached in a folder keyed
only by host and repo path. After changing the pinned ref, pi reused the
old checkout without refreshing it and kept loading the first downloaded
commit. Include the ref in the temporary folder hash so each ref gets
its own checkout. Unpinned sources keep their existing folder.

closes #9982
2026-09-25 10:53:32 +02:00
Mario Zechner
5fd446ca18 feat(durable): optimize document replay 2026-09-25 00:09:50 +02:00
Mario Zechner
9e70c3d505 feat(chord): optimize immutable batch application 2026-09-25 00:09:50 +02:00
Ramiz Wachtler
b2bd111f2d
feat(coding-agent): add hidden-message toggle to HTML exports (#10020) 2026-09-24 23:18:25 +02:00
Mario Zechner
5d4de953ce feat(durable): add checkpoints and document migrations 2026-09-24 23:09:15 +02:00
Mario Zechner
19a0361be8 feat(durable): add transactional sessions and documents
Add typed document definitions, atomic Session transactions, complete commit publication, task/document lifecycle handling, and paginated Tx scans. Share Chord's strict JSON copier across draft placements and durable ownership boundaries.
2026-09-24 22:24:04 +02:00
Ramiz Wachtler
7cf037c218
fix(tui): choose Kitty image dimensions by aspect distortion (#9957) 2026-09-24 20:51:10 +02:00
Mario Zechner
6966636dbe fix(chord): allow promise probes on settled drafts 2026-09-24 19:33:02 +02:00
Armin Ronacher
d5629e2048 fix(tui): autocomplete paths after opening wrappers like ( and backticks 2026-09-24 15:08:54 +02:00
Mario Zechner
d5cba1d97c feat(chord): make immutable delta tracker canonical
Replace the alternate tracker implementations with the optimized immutable overlay, validate draft placements as strict JSON, and document the ownership contract. Consolidate tracker tests and benchmarks around the canonical implementation.
2026-09-24 15:07:12 +02:00
Armin Ronacher
5674690966
feat(tui,coding-agent): add color values and theme styling (#8398)
Expose theme colors as values and add theme.style() for combined styling.

- @earendil-works/pi-tui gains a Color type (palette index, sRGB, OKLCH) with parseColor(), mixColors(), colorToHex(), colorToRgb(), styleText() and related helpers.
- Theme JSON accepts #rgb and oklch(...) values and an optional appearance ("dark" or "light"), detected from the theme colors when omitted.
- theme.style() combines tokens or concrete colors with text attributes; theme.colors exposes concrete colors, including the terminal's reported default colors (OSC 10/11) for tokens set to "".
- Terminals with TERM=*-direct are detected as truecolor.
2026-09-24 14:42:22 +02:00
Christian Klotz
3f0573877e
feat(durable): export storage benchmark workloads 2026-09-24 14:26:22 +02:00
Mario Zechner
cbe7cf00be docs(durable): move Pico5 strict-JSON checks to roots and Chord placements 2026-09-24 14:11:10 +02:00
Mario Zechner
481c7232f1 docs(durable): align Pico5 with canonical immutable tracker
Name the Astra-immutable-optimized Chord Delta tracker as the Packages 6-7
prerequisite, include the minimal generic Tx table surface in that
milestone, and revoke drafts at callback settlement. Drop the Chord
prerequisite from Package 11 because the existing replicated-state source
contract already matches. Specify that tool stream() never spills; tools
spill through their execution environment.
2026-09-24 13:50:10 +02:00
Mario Zechner
601437d5a7 fix(durable): test execution environment and fix output truncation metadata
Port and extend the agent environment tests for NodeExecutionEnv, output
capture, adaptive publishing, and truncation, including exact-byte
truncation, flushing, line-reader cancellation, spill backpressure, and
Buffer-free UTF-8 counting.

Fix truncation reporting when bytes and lines are both exceeded, when only
bytes are exceeded at the line cap, and when small limits trim multi-byte
edge characters. Report the full size of oversized newline-terminated tail
lines. Resolve durable test imports from source so tests run unbuilt.

Set Pico tool output defaults to 50 KiB and 2,000 lines.
2026-09-24 13:34:46 +02:00
Armin Ronacher
a7d17e39aa feat(ai): serve Jev classifier through OpenRouter and Cloudflare Workers AI
OpenRouter decision models use its TypeSafe-compatible /api/v1/systemone endpoint. Cloudflare Workers AI gets a cloudflare-workers-ai-system-one classifier API for the /ai/run envelope. Request and answer parsing is shared in system-one-shared.ts.
2026-09-24 12:34:58 +02:00
Mario Zechner
7c696c00f3 docs: revise Pico5 immutable revision design 2026-09-24 11:33:45 +02:00
Armin Ronacher
8676a0dcd8 fix(coding-agent): require advertised X11 clipboard images
closes #9786
2026-09-24 09:15:58 +02:00
Christian Klotz
b45597504e
feat(durable): export scoped storage conformance suite (#9977)
* feat(durable): export scoped storage conformance suite

* docs(durable): clarify storage conformance example
2026-09-23 23:21:15 +02:00
Armin Ronacher
7fd564cbb7 feat: share model catalog protocol with pi.dev (#9763)
Move catalog layout, index validation, version selection, and request
negotiation into scripts/model-catalog-protocol.ts. pi.dev keeps an
identical copy, so the publisher and a test running the current client
exercise the same selection pi.dev performs. Replaces the cross-repository
compatibility dispatch.

Related to #9099.
2026-09-23 20:08:05 +02:00
Armin Ronacher
a328aa89ad
feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
David Brailovsky
667fc3dd36 fix(ai): price Vercel AI Gateway 1-hour cache writes correctly
Read the 1-hour cache-write count from streaming deltas when present, and add a regression test.

Fixes #9210
2026-09-23 17:16:32 +02:00
David Brailovsky
002fc83852
feat: expose provider stream events to extensions (#9901)
Add onProviderStreamEvent through pi-ai and agent core, and surface
provider_stream_event to coding-agent extensions.

Closes #9784
2026-09-23 16:03:30 +02:00
Armin Ronacher
8d897edaa6 fix(coding-agent): prevent duplicate extension runtimes (closes #9863) 2026-09-23 15:33:56 +02:00
Armin Ronacher
36af9dc48e fix(tui): restore skill prefix autocomplete, closes #9944 2026-09-23 14:32:09 +02:00
Armin Ronacher
fde38ed7c2 fix(ai): stabilize Copilot Claude Opus 5.5 effort levels 2026-09-23 11:41:33 +02:00
Armin Ronacher
4c2dfd9362 chore: regenerate image models 2026-09-23 11:32:31 +02:00
Mario Zechner
b313731b80 feat: add JSONL sidecar reclamation 2026-09-23 09:54:05 +02:00
Mario Zechner
4bc1a2fe53 feat(chord): add optimized delta engine prototypes 2026-09-23 02:23:16 +02:00
Mario Zechner
9a139c62bf feat(chord): consolidate immutable delta tracking 2026-09-23 02:22:52 +02:00
Mario Zechner
898ab80405 feat: add durable JSONL storage backend 2026-09-23 01:33:31 +02:00
Mario Zechner
9672462143 docs: refine Pico5 JSONL publication design 2026-09-23 00:26:05 +02:00
Mario Zechner
a32782520f docs: propose Pico5 live extension registries 2026-09-22 23:46:19 +02:00
Armin Ronacher
a8ed497713 Add [Unreleased] section for next cycle 2026-09-22 21:28:09 +02:00
Armin Ronacher
f07218c4d4 Release v0.87.1 2026-09-22 21:28:02 +02:00
Armin Ronacher
3a4c777f26 docs(coding-agent): complete unreleased changelog 2026-09-22 21:26:21 +02:00