mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-25 09:46:05 +00:00
* fix(app): derive theme states and plugin fills so light and Pure Black themes stay readable Hover, selected, the neutral fill and tertiary text were colors a theme picked by eye, and plugin palettes filled them by borrowing `ring` and `border`. A light plugin theme got a dark selected row under dark text, Pure Black's hover barely separated from its surface, and light terminal ANSI white was white on white. States are now fixed WCAG-contrast steps from the surface they sit on, toward the foreground, derived in styles/derive-colors.ts. Plugin themes derive their neutral fill and tertiary text instead of aliasing `ring` and `border`, and may set an optional `sidebar` color. The web focus outline follows the theme's `ring`, and light terminal white and bright white are derived to read on the background. Tokens with no consumers are removed. Existing plugin themes change look with no author action, and the composer placeholder uses foregroundMuted like every other placeholder. Co-authored-by: Nathan Green <342098+nathansgreen@users.noreply.github.com> * fix(app): accept alpha hex in plugin theme colors when deriving The plugin schema accepts #rgba and #rrggbbaa, but contrast derivation parsed only opaque hex and threw, which would crash rendering for such a theme. Derivation now reads those colors as the opaque color they sit on. * fix(app): keep derived plugin fills and tertiary text readable on low-contrast palettes A fixed contrast step for the neutral fill left text on message bubbles, secondary buttons and badges at 2.6:1 on a dark palette whose body text is 4.75:1, and the fixed fade made Solarized Light tertiary text 1.92:1. The fill step is now bounded by the text it carries and tertiary text has a floor. The plugin reference states the minimum Paseo version for sidebar and that the terminal white is derived on light themes only. * fix(app): keep the derived neutral fill visible when a theme's own text is quiet Bounding the fill by text contrast could reach a step of 1 or less on a palette whose body text is under about 3:1, returning the page background itself. The step now has a minimum. * docs(app): state the trade-off between the neutral fill step and text contrast Below about 3.8:1 body text the fill keeps its minimum step and text on it falls under 3:1. The comment now says so and a test pins both outcomes. * fix(app): leave the light terminal's ANSI white as it was ANSI white is both text and a cell background, so no single palette value is readable in both roles; making it readable as text broke black text on white cells. That needs a contrast rule in the terminal renderer, so light white and bright white return to their previous values and the derivation and its test floors are removed. * feat(plugins): make derived theme colors overridable Sidebar passive text was derived against the page even though timestamps render on hover and selected surfaces. Derive it against the resolved state surface and let contributed themes override each derived semantic role explicitly. --------- Co-authored-by: Nathan Green <342098+nathansgreen@users.noreply.github.com>
151 lines
4.7 KiB
TypeScript
151 lines
4.7 KiB
TypeScript
import type { WorkspaceRef, AgentRef, ProjectRef, TerminalRef } from "./refs.js";
|
|
import type { PluginText } from "./text.js";
|
|
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
|
import type { PluginSerializableIcon } from "./icons.js";
|
|
import type { PluginRpcContract } from "./rpc.js";
|
|
|
|
export interface PluginTheme {
|
|
readonly colors: {
|
|
readonly surface0: string;
|
|
readonly surface1: string;
|
|
readonly surface2: string;
|
|
readonly border: string;
|
|
readonly foreground: string;
|
|
readonly foregroundMuted: string;
|
|
readonly accent: string;
|
|
readonly accentForeground: string;
|
|
readonly statusSuccess: string;
|
|
readonly statusWarning: string;
|
|
readonly statusDanger: string;
|
|
};
|
|
}
|
|
|
|
export type WorkspaceIndicator = "needs_input" | "failed" | "running" | "attention" | "done";
|
|
|
|
export interface PluginWorkspaceSnapshot {
|
|
readonly ref: WorkspaceRef;
|
|
readonly hostId: string;
|
|
readonly project: ProjectRef;
|
|
readonly pinnedAt: string | null;
|
|
readonly labels: readonly string[];
|
|
readonly background: boolean;
|
|
readonly branch: string | null;
|
|
/** Null when an older host has not supplied the workspace creation time. */
|
|
readonly createdAt: string | null;
|
|
readonly lastPromptAt: string | null;
|
|
readonly parentAgent: AgentRef | null;
|
|
readonly indicator: WorkspaceIndicator;
|
|
readonly indicatorLabel: string | null;
|
|
readonly id: string;
|
|
readonly projectId: string;
|
|
readonly projectDisplayName: string;
|
|
readonly projectRootPath: string;
|
|
readonly directory: string;
|
|
readonly projectKind: "git" | "non_git" | "directory";
|
|
readonly kind: "directory" | "local_checkout" | "checkout" | "worktree";
|
|
readonly name: string;
|
|
readonly title: string | null;
|
|
/** Raw daemon status; prefer indicator for presentation. */
|
|
readonly status: "needs_input" | "failed" | "running" | "attention" | "done";
|
|
readonly statusEnteredAt: string | null;
|
|
readonly archivingAt: string | null;
|
|
readonly diffStat: { readonly additions: number; readonly deletions: number } | null;
|
|
}
|
|
|
|
export interface PluginAgentSnapshot {
|
|
readonly ref: AgentRef;
|
|
readonly hostId: string;
|
|
readonly workspace: WorkspaceRef;
|
|
readonly parentAgent: AgentRef | null;
|
|
readonly id: string;
|
|
readonly workspaceId: string;
|
|
readonly provider: string;
|
|
readonly status: "initializing" | "idle" | "running" | "error" | "closed";
|
|
/** Shells and monitors the agent left running after its turn. 0 when none are live. */
|
|
readonly backgroundWork: { readonly count: number };
|
|
/** A helper hidden from tabs, lists and attention. Fixed at creation. */
|
|
readonly background: boolean;
|
|
readonly createdAt: string;
|
|
readonly updatedAt: string;
|
|
readonly lastActivityAt: string;
|
|
readonly title: string | null;
|
|
readonly cwd: string;
|
|
readonly model: string | null;
|
|
readonly currentModeId: string | null;
|
|
readonly thinkingOptionId: string | null;
|
|
readonly requiresAttention: boolean;
|
|
readonly attentionReason: "finished" | "error" | "permission" | null;
|
|
readonly parentAgentId: string | null;
|
|
readonly labels: Readonly<Record<string, string>>;
|
|
/** Structured data plugins store on the agent. */
|
|
readonly metadata: Readonly<Record<string, JsonValue>>;
|
|
}
|
|
|
|
export interface PluginThemeColors {
|
|
background: string;
|
|
foreground: string;
|
|
raised: string;
|
|
control: string;
|
|
border: string;
|
|
accent?: string;
|
|
mutedForeground: string;
|
|
ring: string;
|
|
sidebar?: string;
|
|
sidebarHover?: string;
|
|
sidebarSelected?: string;
|
|
surface3?: string;
|
|
surface4?: string;
|
|
foregroundExtraMuted?: string;
|
|
}
|
|
|
|
export interface PluginThemeContribution<Text extends PluginText = string> {
|
|
id: string;
|
|
name: Text;
|
|
appearance: "light" | "dark";
|
|
colors: PluginThemeColors;
|
|
}
|
|
|
|
export interface PluginAttachmentSourceContribution<Text extends PluginText = string> {
|
|
id: string;
|
|
title: Text;
|
|
icon: PluginSerializableIcon;
|
|
pickerTitle: Text;
|
|
searchPlaceholder: Text;
|
|
search: PluginRpcContract;
|
|
}
|
|
|
|
export type PluginTimelineData = JsonValue;
|
|
|
|
export interface PluginTimelineItem {
|
|
type: "plugin";
|
|
id?: string;
|
|
kind: string;
|
|
version: number;
|
|
data: PluginTimelineData;
|
|
}
|
|
|
|
export interface PluginTimelineTransformResult {
|
|
items: PluginTimelineItem[];
|
|
}
|
|
|
|
export type PluginCleanup = () => void | Promise<void>;
|
|
|
|
export interface PluginProjectSnapshot {
|
|
readonly ref: ProjectRef;
|
|
readonly hostId: string;
|
|
readonly displayName: string;
|
|
readonly rootPath: string;
|
|
readonly kind: PluginWorkspaceSnapshot["projectKind"];
|
|
readonly iconRevision: string | null;
|
|
}
|
|
|
|
export interface PluginTerminalSnapshot {
|
|
readonly ref: TerminalRef;
|
|
readonly hostId: string;
|
|
readonly workspace: WorkspaceRef;
|
|
readonly title: string;
|
|
readonly isScript: boolean;
|
|
/** Null for terminals owned by workers started before timestamps were tracked. */
|
|
readonly createdAt: string | null;
|
|
}
|