mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-23 16:55:42 +00:00
Providers know things about a session and a turn that Paseo cannot derive: timing, token flow, cache use, cost, the model that answered. They can now report them as label/value rows that Paseo carries to clients unchanged, so each provider decides which metrics make sense and how they read. Session metrics live on the agent record and snapshot. Turn metrics are stamped on the turn's footer row (last assistant message, else last tool call) so they survive reload, pagination and a daemon restart, and so the live turn_completed event and a later timeline fetch agree. Provider history replay restores both. Metrics are sanitized once where they enter the agent manager. The wire schemas validate whole messages, so one malformed row from a provider would otherwise make clients drop an entire snapshot, turn event or timeline page. A live completed turn with no Model metric gets the agent's model, so every provider shows model attribution before it is instrumented. Replayed turns do not: they may have run on a different model than the agent has now. Plugin providers publish session metrics behind a negotiated `session.metrics` capability because an older daemon closes a connection that sends an event type it does not know. Turn metrics ride an existing event that older daemons strip, so they need no gate. The wire additions are optional fields on existing schemas only.
Direct provider example
This plugin implements ProviderRegistration directly. It demonstrates connection negotiation,
catalog and session listing, session creation, prompt and command disposition, option controls
with icons (controls and providerOptions),
persistence and replay, archive actions, turn and session metrics, and an ordinary child session.
The provider emits versioned provider-result timeline items for its root and child sessions.
index.client.tsx registers the Zod schema and React Native renderer for those items. The server
and client share only the item kind and schema under shared/.
The provider receives Paseo host tools through config.mcpServers; it does not receive a second
callback tool API.