Skip to content

PiSharp 1.1.0.2

Choose a tag to compare

@github-actions github-actions released this 10 Oct 00:48
· 1347 commits to main since this release
dcd9da4

PiSharp 1.1.0.2

A C#-only patch on the Pi v1.1.0 baseline (commit
abe508e1b89912adde45528136c3221eb69acdd7). It ports the rest of Pi v1.1.0: the work
planned in full-parity-v1.1.0.md (packages IMPL-A1 to
IMPL-I and IMPL-E) and the deviation burn-down that followed. Each area is tracked, with
its test suites, in
sync-1.1.0-applicability.json
(rows gap.* and parity.*). The owner decisions are in
decision 0004.

The version still names the baseline. The Parity page lists
what differs from Pi.

Breaking and behaviour changes

  • pisharp takes Pi's command line. Plain pisharp opens the terminal UI. -p,
    --mode json|rpc, @file arguments and every other flag in Pi's args.ts work as in
    Pi. Scripts that used pisharp session prompt --output print|json should move to -p
    and --mode json. The pisharp session … commands still exist, with their explicit
    paths and --allow-* grants. --user-settings and --project-settings belong to those
    commands only.
  • PiSharp uses Pi's folders. Settings come from ~/.pi/agent/settings.json and
    .pi/settings.json. AGENTS.md/CLAUDE.md, SYSTEM.md, APPEND_SYSTEM.md, skills,
    prompt templates, themes and extensions are discovered as in Pi. New sessions are saved
    in ~/.pi/agent/sessions. Project resources load only after you trust the project
    (trust.json, /trust, -a/-na, defaultProjectTrust).
  • Tool policy defaults to Pi's. On the Pi command line (pisharp, -p,
    --mode json|rpc), file tools take any path and bash runs any command with your
    environment and the discovered shell, as in Pi. --tool-policy explicit (or
    "toolPolicy": "explicit") keeps the exact grants. The session … commands still
    default to explicit. Untrusted projects keep the pi policy, as in Pi: trust gates
    project resources, not tools. Session files, extension manifests, approvals and
    snapshots stay protected under both policies.
  • Unknown tool names are ignored. Names in --tools, defaultTools or SDK initial
    names that match no tool select nothing, with no error, as in Pi.
  • !command values run. A value starting with ! in auth.json, models.json,
    settings.json or mcp.json runs as a shell command, as Pi resolves it. This includes
    stored API keys for every provider, MCP OAuth client secrets and AWS
    credential_process. 1.1.0.1 refused stored !command keys.
  • Extensions run as Pi runs them. Discovered TypeScript and JavaScript extensions run
    in your Node with your permissions, gated only by project trust. pisharp install and
    startup package resolution use your npm and git. Native C# extensions in the extension
    folders load without the approval and preflight files the session … loader needs.
  • Provider requests follow Pi's budgets. Images of about 4.5 MB reach the providers;
    the old 1 MiB transport cap is gone. PiSharp-only count caps on prompts, tools, queues,
    skills, MCP servers and stream events are removed on the Pi command line.
  • The model catalog refreshes at startup. Interactive mode fetches catalog updates
    from pi.dev, as Pi does, unless PI_OFFLINE is set or --offline is passed.

New

Command line and configuration

  • Every Pi v1.1.0 flag, including --version, --api-key, --system-prompt,
    --append-system-prompt, --thinking, --continue, --resume, --session,
    --session-id, --fork, --session-dir, --no-session, --name, --models,
    --list-models, --theme, --use-theme, --tui-mode, --offline, -e and
    --no-extensions.
  • pisharp install|remove|uninstall|update|list|config and
    pisharp auth check|print-api-key|print-bearer-token.
  • Global and project settings.json with Pi's merge rules and migrations.
  • Project trust as in Pi.
  • rg and fd from <agentDir>/bin or PATH, downloaded on first use when missing.

Providers and models

  • Every chat API in Pi 1.1.0: Bedrock Converse (native SigV4, the AWS credential chain
    and event-stream framing), OpenAI Codex with ChatGPT sign-in, GitHub Copilot, Cloudflare
    Workers AI and AI Gateway, and Vertex with Application Default Credentials (user,
    service account, impersonated and external accounts).
  • All 42 provider catalogs from pi-ai 1.1.0, byte for byte, each with a live route.
  • /login for every provider, with API keys or the provider's OAuth or device flow.
  • --model patterns with :thinking, --models, enabledModels, models.json
    (including baseUrl overrides of built-in providers), virtual models and
    --list-models.
  • Classifier and image models: OpenAI decisions (with image input), TypeSafe and
    Cloudflare system-one, llama.cpp classification and OpenRouter images.

Tools and codemode

  • read returns images: type sniffing, EXIF orientation, resizing and re-encoding as Pi
    does, on SkiaSharp.
  • bash finds its shell as Pi does, with shellPath, shellCommandPrefix and user_bash
    extension interception, on Windows, Linux and macOS.
  • Codemode on Jint: Pi's prelude, script API, store(), models.*, output framing and
    limits, the renderer, and codemode MCP servers. Each script runs in its own worker
    process.

Sessions and events

  • Sessions written with JSON.stringify bytes in Pi's key order, compared with session
    files captured from Pi 1.1.0.
  • /name, /session, /fork, /clone, /resume, /import, HTML export
    (/export, --export) and /share.
  • Every JSON and RPC event: entry_appended, thinking_level_changed, extension_error,
    auto_retry_*, summarization_retry_*; agent_end.willRetry; compaction retries.
  • SIGTERM and SIGHUP shut RPC and print mode down as in Pi.
  • 39 of the 41 v1.1.0 extension events reach native C# extensions.

Interactive mode

  • Pi's terminal UI on Windows, Linux and macOS, in fullscreen or regular mode.
  • All 24 built-in slash commands, with Pi's names, descriptions and arguments, plus /mcp.
  • Every /settings item, including tuiMode, quietStartup and outputPad.
  • The system, dark and light themes, custom theme files with live reload.
  • Inline images, Mermaid diagrams and highlight.js syntax highlighting.
  • What's New and /changelog, read from the CHANGELOG.md shipped with the tool.

MCP

  • Project .pi/mcp.json in trusted projects.
  • tool_search always registered and switched off, as in Pi; it waits for background
    servers and its prompt snippet is rendered.
  • The 10-second startup wait for direct servers, resource tools, the mcp_servers prompt
    section on live routes, auth.provider servers, per-server refresh locks, and /mcp.

Extensions and packages

  • Pi's TypeScript and JavaScript extensions from ~/.pi/agent/extensions,
    .pi/extensions, settings, packages and -e.
  • The whole ExtensionAPI, including shortcuts, flags, renderers, providers, virtual
    models and every event.
  • Pi packages from npm, git and local folders.
  • Native C# extensions: a folder with a pisharp-extension.json
    ({"assembly": "...", "entryType": "..."}) loads from the same places, without Node.

Fixed

  • Long sessions. Requests no longer fail once a session passes 256 messages
    (Anthropic) or 1,024 (other routes), and sessions with more than 10,000 records open.
    Pi has no message limit; requests are bounded by the model's context and compaction.
  • Prompting right after agent_settled is accepted instead of refused as "settling".
  • Bash commands containing NUL are refused before they run on every platform, as
    Node's spawn does.
  • Tool calls without a name or id (Gemini streams them) are recorded with an empty
    name or id, as Pi does, instead of failing the stream.
  • Update check compares against the latest PiSharp.Cli on NuGet and suggests
    dotnet tool update -g PiSharp.Cli; it never asks pi.dev. PI_SKIP_VERSION_CHECK,
    PI_OFFLINE and --offline turn it off.

New dependencies

  • SkiaSharp 4.152.1 (MIT) with its native assets for Windows, macOS and Linux, in
    PiSharp.Tools.Skia, for read images (decision 0004).
  • Jint 4.16.3 (BSD-2-Clause) and its parser Acornima 1.7.0 (BSD-3-Clause), in
    PiSharp.Codemode (decision 0003).
  • Pi's npm packages (@earendil-works/pi-coding-agent, pi-ai, pi-tui,
    pi-agent-core 1.1.0, with typebox 1.3.27 and jiti 2.7.0) are installed with your
    npm into ~/.pi/agent/pisharp/pi-runtime/1.1.0 the first time a TypeScript extension
    loads, and checked against the npm registry's integrity. Node.js 22.13 or later is
    needed for TypeScript extensions only.

PiSharp.Tools.Skia and PiSharp.Codemode are new NuGet packages.

Owner decisions that affect you

From decision 0004:

  • The --tool-policy pi|explicit option and its defaults (above).
  • Project trust gates project resources only; tools keep the pi policy in untrusted
    projects.
  • !command values run, for every provider and for AWS credential_process.
  • Vertex uses Application Default Credentials.
  • Trusted extensions call classifier and image models with stored credentials.
  • Interactive startup refreshes the model catalog from pi.dev unless PI_OFFLINE is set.
  • rg and fd are downloaded on first use when missing, unless PI_OFFLINE is set.
  • Extensions run in your Node with your privileges; Pi's own npm packages are installed
    on first extension use.
  • Native C# extensions are discovered like Pi extensions on every platform.
  • The codemode deadline starts when the script starts running in its worker.
  • Install telemetry is not ported.

Differences from Pi

Intentional:

  • No install telemetry. PI_TELEMETRY and enableInstallTelemetry are ignored.
  • Requests to Anthropic, Azure, Bedrock, Mistral, OpenAI-compatible endpoints and
    OpenRouter images carry a PiSharp user agent where Pi's SDKs send their own.
  • Codemode runs each script in a worker process (about 100 to 300 ms to start), and its
    deadline starts with the script. On Jint, memory and recursion overruns end the script
    instead of throwing, and engine error messages differ.
  • No zstd compression and no WebSocket transport for OpenAI Codex.
  • pisharp update can't update PiSharp itself. Use dotnet tool update -g PiSharp.Cli.

Still open:

  • Lone surrogates. RPC input and tool-call arguments turn escaped lone surrogates
    into U+FFFD, and a session line containing one is refused.
  • JSON depth. Session records, RPC input and tool-call arguments are limited to 64
    levels of nesting.
  • Fractional token counts are refused (Bedrock reads them as 0).
  • Memory bounds. 64 MiB per session line and file, 16 MiB per streamed event, 64 MiB
    per response, 8 MiB per tool result, 32 MiB per RPC record.
  • sendMessage with triggerTurn from inside an extension command runs after the
    command returns, and is dropped if the command runs longer than about 30 seconds.
  • User bash start failures report a different error text from Node's spawn error.
  • Linux X11 clipboard needs xclip or xsel; Pi also has a built-in helper.
  • Packages loaded with -e add their extensions but not their skills, prompts or themes.
  • No llama.cpp router discovery and no /llama.
  • ctx.ui.setTheme returns an error.
  • /bug never uploads reports to Pi's developers. It keeps Pi's prompts, zip and
    summary, and its Open GitHub Issue choice writes the zip and opens a prefilled issue
    at github.com/jkelly/PiSharp (description,
    summary, PiSharp version, OS, runtime and model) for you to attach the zip to. Without a
    browser it prints the zip's path and the issue link
    (decision 0004, item 11).

Out of scope, unchanged from decision 0002:
pi-durable, pi-env, the experimental server and client modes, and Nix packaging.

Packages

All library packages and the PiSharp.Cli dotnet tool will be published as 1.1.0.2:

dotnet tool update -g PiSharp.Cli