Repository navigation
PiSharp 1.2.0.2
PiSharp 1.2.0.2
A C#-only release on the Pi v1.2.0 baseline (commit
06a466935536f8c9bcacb2d5efc0fc021be1bdff). The baseline does not change: everything new here
is PiSharp-only, and most of it is experimental. It also fixes bugs in pisharp itself.
- Experimental, now released: the media library and tools, service tiers, custom agents
(three new packages), questions and plan mode inpisharp durable, and the durable device
server and its commands. - Fixed:
writeno longer stops at 64 KiB, codemode scripts no longer see model headers,
and MCP, shutdown, input and RPC races are fixed. - Source only: the Web Agent, Durable Web, SQL Server storage and the libraries under them
are in the repository but not packaged.
The Parity page lists what still differs from Pi.
Everything marked experimental may change or be removed in any release, including a patch
release, without a deprecation period. Each experimental API carries an
[Experimental("...")] attribute: the compiler reports an error until you suppress that
diagnostic.
| Diagnostic | Covers |
|---|---|
PISHARP_MEDIA001 |
The media library, PiSharp.AI.Media |
PISHARP_TIERS001 |
Service tiers: ServiceTiers and the ServiceTier members |
PISHARP_AGENTS001 |
The custom agents packages (with PISHARP_DURABLE001) |
PISHARP_CATALOG001 |
MaintainedCatalogOverlay and MaintainedCatalogResult in PiSharp.AI |
PISHARP_DURABLE001 |
The durable packages, as in 1.2.0.1, now including questions, plan mode and the media tools |
Experimental: media
PiSharp can generate images, video, speech and music, transcribe audio, embed and rerank text,
and ask decision models. Pi has image generation and classifiers, but nothing for embeddings,
video, speech, transcription, music or reranking, so this is PiSharp-only
(decision 0007).
-
Library.
PiSharp.AI.Media(PISHARP_MEDIA001).MediaRegistryresolvesprovider/id
model specs and their credentials and dispatches by kind.- Embeddings: OpenAI-compatible and Gemini.
- Images: OpenAI GPT image, OpenRouter's Image API, Gemini and Imagen.
- Video: OpenRouter and Veo.
- Speech and transcription: OpenAI-compatible.
- Music: OpenRouter chat audio.
- OpenRouter rerank and decisions.
DiscoverAsynclists OpenRouter's models of each kind. -
Tools in
pisharp durable.generate_image,generate_video,embed,
list_media_modelsandset_media_defaults, plus the deferredgenerate_speech,
transcribe_audio,generate_music,rerankanddecide. They are installed only when a
configured provider has a media model and themedia.enabledsetting isn'tfalse. Each kind
has a default model and options in themediasetting. -
No double charges after a crash.
- Paid results are saved before they are used, so a rerun reuses them.
- A video's job id is saved as soon as the job is submitted.
- A transcription whose request went out but whose transcript was not saved fails as
interrupted instead of being sent again. embed,rerankanddecideare cheap and change nothing at the provider, so an unsaved
call simply runs again.
-
set_media_defaultschanges apply to the session even whensettings.jsoncan't be saved,
and the tool says so.
See Media and the
media library.
Experimental: service tiers
Some providers sell cheaper or faster capacity. A service tier picks it per request: auto,
normal, economy, priority, fast or ultrafast.
-
pisharp:--tier <tier>(alias--service-tier) or theserviceTiersetting sets the tier./tier <tier>changes it for the next request, and/tier <tier> defaultalso saves it.- The footer shows it.
-
pisharp durable: the same, per conversation, and thesubagenttool takes atier. -
Wire mapping. Each API gets its own field:
- OpenAI and OpenRouter:
service_tier. - Anthropic:
service_tier, plusspeed: "fast"on the models that offer fast mode. - Codex and Google: their own tier values.
Other providers and APIs get no tier field.
- OpenAI and OpenRouter:
-
Off by default. With no tier set, requests and the footer are exactly as before.
-
Not in Pi.
--tier,/tier, the footer tier and theserviceTiersetting are recorded
as intentional differences from Pi.
See Service tiers.
Experimental: custom agents (new packages)
Three new packages for building crash-safe agents in C# on the durable harness
(decision 0012):
| Package | Contents |
|---|---|
PiSharp.CustomAgents |
Typed workflows, agent teams, subagents, messaging, typed and dynamic tools, plugin DLLs and web_search |
PiSharp.CustomAgents.JavaScript |
JavaScript tools and workflow actions in Codemode's Jint sandbox |
PiSharp.CustomAgents.Scripting |
C# script tools and workflow actions, compiled with Roslyn |
- Workflows. A typed series of actions over one shared data object.
- An action can be:
- C# code or a model call (
Prompt, orPrompt<T>with structured output); - an agent run, or a JavaScript or C# script;
- a sub-workflow, a
ParallelorForEachfan-out, or a wait for a signal.
- C# code or a model call (
- Each step commits atomically, so a run resumes after a crash, and
OnceAsynckeeps a side
effect to one run. - A fail-fast fan-out names the child that failed, not a sibling it aborted.
- An action can be:
- Teams. Agent definitions with their own tools and instructions, on any provider.
- Subagents work through
delegate,spawn,wait_agentandstop_agent. - Agents talk through
send_message,ask_agentandreply. - A wait that would deadlock is refused.
- Subagents work through
- Dynamic tools.
- JavaScript: sandboxed. A model may write its own tools only if the host turns that on.
- C# scripts: run with full trust and are never model-written. Each compiles into a
collectible context and unloads when replaced. - Plugin DLLs: trusted only when listed.
web_search. Brave, Tavily, Firecrawl, and the hosted search of OpenAI, Anthropic, xAI
(with X search) and OpenRouter. Errors name the key's environment variable, never the key.
<PropertyGroup>
<NoWarn>$(NoWarn);PISHARP_AGENTS001;PISHARP_DURABLE001</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PiSharp.CustomAgents" Version="1.2.0.2" />
</ItemGroup>PiSharp.CustomAgents.Scripting depends on Microsoft.CodeAnalysis.CSharp 5.6.0 (MIT), pinned
exactly. See Custom agents, and
samples/CustomAgents.Examples and samples/CustomAgents.Research.
Experimental: pisharp durable additions
pi-durable has none of these; they are PiSharp's.
- Questions from the agent.
- The
ask_user_questiontool asks one to four multiple-choice questions, with an
"Other" answer. - The question waits durably: after a restart the same questions come back, and your
answer completes the same call.
- The
- Plan mode (
/plan,/plan <message>).- The conversation keeps only
read,bash,ask_user_questionandexit_plan_mode, and
writeandeditconfined to a plan directory (theplanMode.directorysetting). exit_plan_modesubmits the plan for your review: approve and start, approve without
starting, or keep planning with or without feedback.bashis not restricted in plan mode.
- The conversation keeps only
--tier,/tierand the media tools (above).pisharp durable --helpprints the options without opening a session.- The durable device server (decision 0008,
0009 and
0010). These commands are not in
pisharp --help;pisharp durable helplists them.pisharp durable serveruns this machine as a durable device: many durable sessions
behind an authenticated HTTP and server-sent-events API.- It listens on
127.0.0.1:4780by default and keeps its data in
~/.pi/agent/experimental/durable-device. - The device token is a shell: anyone who has it can run commands as you.
--hostcan listen on another address, with a warning. The API is plain HTTP, so use an
SSH tunnel or a TLS proxy instead.
- It listens on
pisharp durable tokenprints or rotates the device token. It is stored in a file only
you can read and never goes on a command line: remote commands read it from
PISHARP_DEVICE_TOKENor--token-file.- Device commands for sessions, executions, schedules, trigger credentials, budgets,
retention, policies and judgments, artifacts, evidence, sources, research, feedback and
preferences. Each takes--json, and--device <url>to work on another device. - Local commands:
attach(a line-mode terminal on a session's agent),doctor,
service(writes a per-user service definition and installs nothing) and
backup create|verify|restore.
Fixes in pisharp
writeis no longer capped at 64 KiB. Pi has no write limit; PiSharp now takes up to
8 MiB of arguments in one call.editarguments are still limited to 65,536 characters.- Codemode scripts no longer see model headers.
models.list()andgetModelOfType()used
to give scripts each model'sheaders, which can hold API keys. Requests made through
classifyandgenerateImagesstill send them. - MCP:
- Closing one server no longer fails another server that connects at the same moment.
- While a server closes, prompts,
/mcpactions and an extension'sgetAllToolswait or
answer instead of failing with "Session replacement is in progress". - A session that ends while a stdio MCP server is still starting exits cleanly instead of
reporting a cleanup failure.
- Input and shutdown:
- The first key after
/newor another session switch reaches the editor. - Shutting down a session that faulted, or that still had queued input, no longer reports a
cleanup failure on top of its real outcome. - A cancelled JSON-mode command reports
Canceledinstead ofCommandFailed.
- The first key after
- RPC and print mode.
pisharp -pand RPC no longer hang at exit when an extension command
starts a run while the command's response is being written. - Help:
--service-tieris listed as an alias of--tier.powershellis no longer listed as a built-in tool, since the CLI doesn't register it.pisharp session --helpandpisharp session <verb> --helpprint help, and
pisharp <command> --helpnamessessionanddurable.- The
mcphelp and messages saypisharp.
Maintained model catalog (PiSharp-only)
The CLI can apply a separately maintained, reviewed catalog layer of model metadata and prices
on top of Pi's pinned catalogs:
- Where it comes from.
catalog-maintained/models.overlay.jsonnext to the tool, or a file
named byPISHARP_MAINTAINED_CATALOG. - When it applies. After remote catalog refreshes and before
models.jsonand extensions. - It ships empty in 1.2.0.2, so the catalog is unchanged.
- What it can change. It updates prices and limits, and can add complete chat models. It
never selects a model.
MaintainedCatalogOverlay, its public reader in PiSharp.AI, is PISHARP_CATALOG001.
samples/agents/31-ModelCatalogMaintainer produces the format.
Source only (not packaged)
These are on main and run from source, but have no NuGet package and are not in the tool
unless noted:
- The PiSharp Web Agent (
src/PiSharp.WebAgent, decision 0011).- A local chat app and model playground on durable sessions, bound to
127.0.0.1:5180. - It has Spend Guard caps and a spend ledger, Compare, the Tool Bench and the Model Arena,
test suites and Drift Watch.
- A local chat app and model playground on durable sessions, bound to
- Durable Web (
src/PiSharp.Durable.Web): the hub and web UI for durable devices, on
127.0.0.1:5181. - SQL Server storage for durable sessions (
src/PiSharp.Durable.MSSQL, decision 0007). Its
SNI runtime dependency is under Microsoft's proprietary license terms, which the owner must
review before it is packaged or added to the CLI. - The libraries under them:
PiSharp.Durable.Hosting,PiSharp.Durable.ServerandPiSharp.Durable.Clientship
inside thePiSharp.Clitool, forpisharp durable serve, but not as packages.PiSharp.ModelRuntime(the model registry, moved out of the CLI) also ships inside the
tool.PiSharp.Web.Commonis source only.
- Samples. 62 runnable agent samples (
samples/agents) with fixtures and self-tests, and
samples/Durable.ReleaseWatcher.
Packages and tool
All 22 library packages and the PiSharp.Cli dotnet tool are published as 1.2.0.2: the 19 of
1.2.0.1 plus the three custom agents packages.
dotnet tool update -g PiSharp.Cli- The tool now needs the ASP.NET Core runtime.
Microsoft.AspNetCore.App10 is needed
becausepisharp durable servehosts a web server. The .NET 10 SDK, whichdotnet tool
needs, includes it. On a machine with only the .NET runtime, install the ASP.NET Core
runtime too. - New license in the tool. It carries
licenses/durable-pi.LICENSE.txt(MIT): the device
host adapts designs of durable-pi. See
THIRD-PARTY-NOTICES.md.
Known issues
- Media not run live. OpenRouter video and the Google media backends (Gemini, Imagen, Veo)
have not been run against the live services. The Brave and Tavily search backends haven't
either. - Plan mode doesn't restrict
bash. Onlywriteandeditare confined to the plan
directory. editargument cap.editarguments are still capped at 65,536 characters.- Extension state across
/reload. A native extension'sExtensionSessionStatewritten
before/reloadis not found after it, because the extension's id changes on reload. - MCP reads during a close. An extension's
getActiveToolsis still refused while an MCP
server closes. - Known issues kept from 1.2.0.1:
- JSONL durable storage keeps what it wrote in memory.
- Durable code mode scripts don't resume between Pi and PiSharp.
Feedback is welcome in GitHub issues.