feat(sessions): surface live session startup warnings in the web UI

Show a pinned banner at the top of the session view with resource and
runtime diagnostics (skills, prompts, themes, extension load errors) plus
the Anthropic subscription-auth billing notice, recomputed live from the
current runtime so they stay accurate across browser reloads.

Warnings carry an optional dismiss capability; the Anthropic notice is
dismissable and durably suppressed through pi's own anthropicExtraUsage
warning setting. Also fixes the testing-guide skill frontmatter so it
loads.
This commit is contained in:
Federico Jaramillo Martinez
2026-07-17 19:16:58 +02:00
parent 2b17145291
commit aedcbf885e
20 changed files with 820 additions and 7 deletions
+31
View File
@@ -399,6 +399,30 @@ export interface ThinkingLevelsResponse {
levels: string[];
}
export type SessionWarningSeverity = "info" | "warning" | "error";
/**
* A live, runtime-scoped warning surfaced to the browser (skill/resource
* diagnostics, extension load errors, subscription-auth billing notice, etc.).
*
* Warnings are recomputed whenever the runtime is (re)built inside sessiond and
* are not persisted chat messages. `source` is an optional short origin label
* (e.g. `"skill"`, `"extension"`, `"anthropic"`); `path` carries a related file
* path when the warning came from a resource diagnostic.
*
* `dismiss` is present only when the warning has a durable, first-class
* off-switch in the underlying `pi` agent (not a UI-only hide). Its `id` is the
* opaque token the server maps back to that suppression; the client renders a
* dismiss control for any warning carrying it, without knowing what it means.
*/
export interface SessionWarning {
severity: SessionWarningSeverity;
message: string;
source?: string;
path?: string;
dismiss?: { id: string };
}
export interface SessionStatus {
sessionId: string;
/** True when the server has verified a backing session file exists; false when known transient. */
@@ -414,6 +438,13 @@ export interface SessionStatus {
tokens: { input: number; output: number; cacheRead: number; cacheWrite: number; total: number };
cost: number;
contextUsage?: { tokens: number | null; contextWindow: number; percent: number | null };
/**
* Live, runtime-scoped warnings for this session (skill/resource diagnostics,
* extension load errors, Anthropic subscription-auth billing notice, etc.).
* Recomputed on each status read from the current runtime; absent/empty when
* there are none. See {@link SessionWarning}.
*/
warnings?: SessionWarning[];
}
export interface WorkspaceActivity {