Repository navigation
Conversation
…s usage A remote session offered no model menu and no context figure, because the Desktop projected its own provider store and transcript onto a session that runs on another machine. The Host owns both facts, so RACP now publishes `models/list` and `session/usage` as read-only operations and reports each session's provider, model, and thinking level. The model catalog carries only public metadata, and the Desktop validates both payloads as untrusted input before the renderer sees them. Context occupancy is the newest completed request rather than the turn aggregate: a turn that called tools issued several requests, and only the last one still occupies the model window.
The catalog section described a nested `providers[].models[]` response that the Host never returns. The published shape is a flat list of `(providerId, modelId)` rows plus the Host's defaults, so the spec now matches the schema in `packages/shared` and the operation the Host actually serves.
…l-catalog Keeps the branch on current main (ecb2d98) so the Host model catalog and usage report can land as a standalone feature. Conflicts were limited to shared import lists and the composer's image-only guard: the host-ports module now carries main's multi-line import style plus this branch's SESSION_THINKING_LEVELS, pi-host re-exports both sides' types, and the menu keeps main's isImageOnlyChatModel(imageGenerationCandidates, ...) signature while still exempting a Host catalog from this Desktop's local image workflow.
|
Merged current Re-ran the verification at this head: host-runtime 187 passed / 3 skipped, shared 1478, agent-host 67, the 7 touched desktop test files 98/98, |
|
Merged the latest main ( Re-ran the verification at this head:
The |
|
Merged the latest main (7254a04, which includes #2530) into the branch and pushed �f2dfaa06; the merge was clean, pnpm check:pr-base passes, and the PR is no longer behind. Re-ran the verification at this head:
Separately, I opened #2534 for a sidebar alignment regression that came from #2394: a host project group header was rendered through the generic |
Summary
A remote session runs on the paired Host's providers, but the Composer projected
this Desktop's provider store and transcript onto it: the model menu listed local
models the Host cannot serve, and the context ring stayed empty because a remote
transcript carries
usageonly on nested tool operations, never the top-levelassistant row.
The Host owns both facts, so RACP now publishes them as read-only operations and
a session reports its own binding.
Split out of #2371 at review request, so the project-group identity fix there can
land with the smallest coherent scope. Nothing in this diff touches the sidebar,
the attach identity path, or host-core persistence.
Protocol (additive)
models/list— the Host's own catalog: a flatmodels[]of(providerId, modelId)rows plus the Host's defaults. Two Host providers thatshare a display name stay distinct rows; only public metadata crosses the
boundary, never an endpoint or credential.
session/usage— context occupancy of the newest completed request forone session. A turn that called tools issued several requests, and only the
last one still occupies the model window, so the turn aggregate would
overstate usage.
Sessiongains optionalproviderId/modelId/thinkingLevel.CAPABILITY_UNAVAILABLEand theclient stays on a read-only model display, so an older Host keeps working.
Implementation
packages/shared/src/racp.ts,racp.test.ts,fixtures/racp.schema.json— schemas and operation table for both resources and the new session fields;
packages/racp/src/host-operations.tscarries the typed client interface.crates/host-core/src/sessions/usage.rs—latest_request_usageselectsthe last operation of the newest
status = 'completed'turn;rpc/mod.rsexposes it as
session.turnUsage.apps/pi-host/src/host-operations.ts— publishes only enabled providersthat have a usable credential, and reports each session's binding.
apps/desktop/electron/main/remote/remote-host-models.ts(new) —validates both payloads as untrusted input before the renderer sees them: a
Host is a separate machine and a separate release.
apps/desktop/electron/main/remote/backend-router.ts—remoteHost/sessionUsageaddresses a Host, not a session, so it iswhitelisted to
ROUTE_LOCALeven though its request carries asessionId;routing it as a session channel would hand it to a
RemoteBackendthat doesnot serve it.
apps/desktop/src/lib/remote-host-models.ts(new) — projects the Hostcatalog onto the renderer's provider model without inventing capability or
reasoning levels the Host did not declare.
useRemoteSessionModel.ts(new) — loads catalog and usage per host andsession, fenced so a switch mid-await cannot paint stale rows;
Composer.tsxuses the Host catalog in place of the local store and theHost's window for the ring.
remote-session-safety.ts/remote-ipc-safety.ts— a remote session mayconfigure its own model through the Host (
sessionConfigureis no longerlocal-only);
fastModestays refused because RACP has no such field.03-runtime/19-remote-agent-control-protocol.md§5.8 documents theflat catalog and the usage report; §6.2 lists both operations; §5.1 documents
the new session fields.
Tests
pnpm --filter @pi-desktop/shared testpnpm --filter @pi-desktop/racp testpnpm --filter @pi-desktop/agent-host testnode --teston the 7 touched desktop test filescargo test -p host-core --locked usagecargo fmt --check -p host-corepnpm --filter @pi-desktop/desktop typecheckpnpm --filter @pi-desktop/host-runtime testpnpm lint:biomepnpm --filter @pi-desktop/docs check:docspnpm check:pr-baseorigin/main(7254a0452)Head
af2dfaa06merges currentmain(7254a0452); every merge was clean, noconflicts. An earlier merge (
44ab985) resolved three conflicts: the sharedimport lists in
host-ports.tsandapps/pi-host/src/host-operations.ts, anduseComposerModelMenu.ts, where the menu keepsmain'sisImageOnlyChatModel(imageGenerationCandidates, …)guard and still exempts aHost catalog from this Desktop's local image workflow.
main's newer plugin/mode changes arrived with the merge and are not part ofthis diff against
main.The pi-host
host-operations.test.tssuite reports 3 failures in this Windowsworkspace only, all from POSIX assumptions (
workspaceLabelstarts with/,browse roots compared with
/separators); the two new model-catalog and usagecases pass, and the same 3 cases fail unchanged on
origin/main.New coverage:
apps/desktop/test/remote-host-models.test.mjs— the validators rejectnon-catalog shapes, impossible token counts, and impossible context windows;
the projection keeps the Host's declared thinking ladder and invents neither
capability nor reasoning levels.
apps/desktop/test/remote-backend-router.test.mjs— a host-scoped channelstays local even when its request names a remote session id.
apps/desktop/test/remote-backend.test.mjs— a session summary carries theHost's binding when published, and stays absent instead of inventing a model
when it is not.
packages/shared/src/racp.test.ts— both new resources round-trip through theschema, including the flat catalog shape.
Verification on a real paired host
Windows Desktop
0.23.0against a macOS arm64 Host built from the samerevision, over SSH (first probed on
0.23.0-beta.1, re-checked on the0.23.0release with both this branch and #2394 applied). That build carried the
model/usage code paths in this branch unchanged.
session/usagewithok: true;the ring went from
0%to80%, tooltipRemaining context 80%, 802.3K tokens total.Recentssection, chipdeepseek-v4.1-flash. Switching a temporary session's model wrote back to theHost (
385c8e13…|gpt-6-astra|low); the temporary session was deletedafterwards and the six existing sessions were untouched.
Not run
was a manual probe on a matching-revision Host.
pnpm -r --if-present test: thepi-hostsuite fails on this Windows host atboth revisions (
config.test.tsexpects/data,admin-socket.test.tsneedsa Unix domain socket,
host-operations.test.tsasserts POSIX paths; 17failures unchanged by this branch). The two new models/usage cases pass.
failures: a baseline worktree at
2b279cfreproduced exactly the same failureset (set difference 0).
Compatibility
Additive only. New operations are optional capabilities, the new
Sessionfields are optional, and no persisted format or database schema changes.