Files
paseo/packages/app/test-stubs/lucide-react-native.ts
T
Mohamed Boudra 2d09c47672 Show provider session and turn metrics (#10496)
* feat(providers): let providers report session and turn metrics

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.

* feat(providers): report session and turn metrics from OpenCode, OMP, Pi and Claude

Each provider now attaches metrics to turn_completed and emits
session_metrics_updated, live and when history is replayed.

- Live turns end on the adapter's clock. A provider's message timestamps
  can come from another clock.
- Tool time merges overlapping runs, so parallel tools count once.
- A total that is missing any part is hidden, so a partial total is
  never shown.
- Replayed history reports metrics only for turns that finished, which
  matches live, where failed and interrupted turns report none.
- Claude reports cost as a running total for each query(). A resumed
  query starts that total from a saved one, so a turn's cost is the
  change since the previous result of the same query. The first turn of
  a query shows no cost.
- Claude transcripts do not record result messages, so replayed Claude
  history has no turn metrics.
- Session metrics come from each provider's own cumulative counters. The
  cache hit is the last reply's or the last turn's, because a session-wide
  figure blends prompts from before and after compactions.

* feat(app): show provider session and turn metrics

Session metrics appear in the context window details, between the context summary and the
account usage cards. A provider-reported Cost row replaces the app's own session cost line.

Each completed turn with metrics gets a stats button in its footer: a hover card on web, a
press-opened tooltip on native wide screens, and a sheet on compact screens. The context window
sheet becomes a shared DetailsSheet so both use the same content-sized sheet.

Metrics ride on the row that hosts the turn's footer (the turn's last assistant message, else its
last tool call), the same row the daemon stamps. Live turn_completed events and timeline pages
both stamp that row, so a refetch agrees with what the live event showed.

The daemon updates session metrics without bumping updatedAt, like usage, so a stale buffered
upsert may still carry the newest metrics and is accepted for that field.

* fix(app): keep a turn's stats after the cached timeline reloads

The local timeline cache dropped turnMetrics when it saved a turn's footer row. After a page
reload the cached rows painted without the stats icon, and the catch-up fetch had no new
entries to stamp them from.

* fix(providers): keep imported session stats and never count a steered turn short

Importing a Pi, Oh My Pi or OpenCode v2 session dropped the stats the provider returned with its
history, so imported chats showed none until a forced replay. Import now carries them the way
replay does.

Replaying a Pi or Oh My Pi transcript read a prompt that steered a running turn as the start of a
new turn, so the steered turn's stats counted only the steps after the steer. A turn that follows
one ending on tools now reports no total, because the transcript reads the same as a stop and a
new prompt.

* fix(providers): keep stats through merged messages and plugin imports, start Pi first-token timing at the request

A message the timeline merges from several chunks keeps the stats stamped on its last chunk. Plugin session imports carry the stats the plugin replayed, through the same history reader the other providers use. Steers queued together after an unclear turn stay unclear instead of attributing the final reply to the wrong turn. Pi measures time to first token from the request, not the first reply header.

* fix(providers): carry a turn's stats onto the message the timeline merges from text chunks

The previous change put the carry-over in the reasoning merge. The assistant message merge dropped the stats of its last chunk, so an imported reply of two text blocks lost its Turn stats button.

* fix(providers): carry a turn's stats onto the tool card the timeline merges from updates

An imported turn that ends on a tool call stamps the stats on the tool's last update. The tool merge kept the first update's fields, so the stats were lost.

* fix(opencode): replay no session stats for a session that has none

An empty OpenCode session replayed a session stats event with no metrics, which broke the empty-history check in the versioned runtime test.
2026-11-22 16:43:56 +07:00

146 lines
4.7 KiB
TypeScript

import type { ComponentType } from "react";
export type LucideIcon = ComponentType<{
size?: number;
color?: string;
uniProps?: unknown;
}>;
const StubIcon: LucideIcon = () => null;
export const Activity = StubIcon;
export const AlertTriangle = StubIcon;
export const Archive = StubIcon;
export const ArrowDown = StubIcon;
export const ArrowDownUp = StubIcon;
export const ArrowLeft = StubIcon;
export const ArrowLeftToLine = StubIcon;
export const ArrowRight = StubIcon;
export const ArrowUp = StubIcon;
export const ArrowUpRight = StubIcon;
export const AudioLines = StubIcon;
export const Blocks = StubIcon;
export const Bot = StubIcon;
export const Brain = StubIcon;
export const ChartNoAxesColumn = StubIcon;
export const Check = StubIcon;
export const CheckCircle = StubIcon;
export const CheckCircle2 = StubIcon;
export const ChevronDown = StubIcon;
export const ChevronLeft = StubIcon;
export const ChevronRight = StubIcon;
export const CircleAlert = StubIcon;
export const CircleCheck = StubIcon;
export const CircleDot = StubIcon;
export const CircleSlash = StubIcon;
export const CircleX = StubIcon;
export const ClipboardPaste = StubIcon;
export const Copy = StubIcon;
export const CornerDownLeft = StubIcon;
export const Download = StubIcon;
export const ExternalLink = StubIcon;
export const Eye = StubIcon;
export const EyeOff = StubIcon;
export const File = StubIcon;
export const FileText = StubIcon;
export const Folder = StubIcon;
export const FolderPlus = StubIcon;
export const FolderTree = StubIcon;
export const Gift = StubIcon;
export const GitBranch = StubIcon;
export const GitCommitHorizontal = StubIcon;
export const GitMerge = StubIcon;
export const GitPullRequest = StubIcon;
export const GitPullRequestClosed = StubIcon;
export const GitPullRequestDraft = StubIcon;
export const Globe = StubIcon;
export const Heart = StubIcon;
export const History = StubIcon;
export const Home = StubIcon;
export const Image = StubIcon;
export const Import = StubIcon;
export const Inbox = StubIcon;
export const Info = StubIcon;
export const Layers = StubIcon;
export const Link = StubIcon;
export const Link2 = StubIcon;
export const MessageSquare = StubIcon;
export const MessageSquarePlus = StubIcon;
export const Mic = StubIcon;
export const MicOff = StubIcon;
export const Monitor = StubIcon;
export const Moon = StubIcon;
export const MoreHorizontal = StubIcon;
export const MoreVertical = StubIcon;
export const MousePointer2 = StubIcon;
export const PackagePlus = StubIcon;
export const PanelLeft = StubIcon;
export const PanelRight = StubIcon;
export const PanelsTopLeft = StubIcon;
export const Paperclip = StubIcon;
export const Pencil = StubIcon;
export const PencilRuler = StubIcon;
export const Pin = StubIcon;
export const PinOff = StubIcon;
export const Play = StubIcon;
export const Plug = StubIcon;
export const Plus = StubIcon;
export const Puzzle = StubIcon;
export const QrCode = StubIcon;
export const RefreshCcw = StubIcon;
export const RefreshCw = StubIcon;
export const RotateCw = StubIcon;
export const Scan = StubIcon;
export const Search = StubIcon;
export const Server = StubIcon;
export const Settings = StubIcon;
export const Settings2 = StubIcon;
export const ShieldAlert = StubIcon;
export const ShieldCheck = StubIcon;
export const ShieldOff = StubIcon;
export const ShieldQuestionMark = StubIcon;
export const Smartphone = StubIcon;
export const Split = StubIcon;
export const Square = StubIcon;
export const SquarePen = StubIcon;
export const SquareSlash = StubIcon;
export const SquareTerminal = StubIcon;
export const Star = StubIcon;
export const Sun = StubIcon;
export const Terminal = StubIcon;
export const Trash2 = StubIcon;
export const TriangleAlert = StubIcon;
export const Undo2 = StubIcon;
export const Unlink = StubIcon;
export const Upload = StubIcon;
export const Wrench = StubIcon;
export const X = StubIcon;
export const XCircle = StubIcon;
export const Code = StubIcon;
export const Maximize2 = StubIcon;
export const Workflow = StubIcon;
export const ZoomIn = StubIcon;
export const ZoomOut = StubIcon;
export const ListTodo = StubIcon;
export const Shield = StubIcon;
export const ShieldEllipsis = StubIcon;
export const ShieldPlus = StubIcon;
export const Zap = StubIcon;
export const CheckSquare = StubIcon;
export const Circle = StubIcon;
export const FileSymlink = StubIcon;
export const MessageSquareCode = StubIcon;
export const MicVocal = StubIcon;
export const Scissors = StubIcon;
export const Sparkles = StubIcon;
export const TriangleAlertIcon = StubIcon;
export const ArrowRightToLine = StubIcon;
export const Columns2 = StubIcon;
export const CopyX = StubIcon;
export const Ellipsis = StubIcon;
export const Maximize = StubIcon;
export const Minimize = StubIcon;
export const Rows2 = StubIcon;
export const Gauge = StubIcon;
export const GripVertical = StubIcon;