Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | 4x | /** Dashboards — user-composed boards of widgets.
*
* Widget *types* are defined by the backend registry rather than here, so
* `WidgetTypeSpec` (served from `/app/dashboards/widget-types`) is the source
* of truth for what can be added and how a new tile is seeded. The union
* below names the types this app knows how to draw; anything the backend adds
* later still lists in the picker and falls back to a generic tile.
*/
import { SystemManaged } from "./Doc";
export type WidgetType =
| "note"
| "shortcuts"
| "stat"
| "chart"
| "breakdown"
| "pinned_message"
| "message_list"
| "resource_list"
| "weather"
| "rss"
| "market"
| "automation"
| "comparison"
| "knowledge_network"
| "agent_memory"
| "web_link_graph"
| "knowledge_graph"
| "assurance";
/** Where a widget's content comes from.
*
* A board deliberately mixes exact data with model inference, so each tile
* states which it is: `stored` (the user wrote or saved it), `platform`
* (their own recorded usage), `feed` (fetched verbatim from a named source),
* or `generated` (a model's judgement, which can be wrong).
*/
export type DataKind = "stored" | "platform" | "feed" | "generated";
/** Lifecycle of a dynamic widget's cached result. */
export type RefreshStatus = "empty" | "refreshing" | "ready" | "failed";
export interface DashboardWidget {
id: string;
dashboard_id: string;
widget_type: WidgetType;
title: string | null;
config: Record<string, unknown>;
x: number;
y: number;
w: number;
h: number;
position: number;
refresh_interval_seconds: number | null;
cache_status: RefreshStatus;
cache_payload: Record<string, unknown> | null;
cache_error: string | null;
cached_at: string | null;
created_at: string | null;
updated_at: string | null;
}
/**
* A board. A **built-in** one (`is_system`) is a single row every user opens:
* its platform tiles fetch the viewer's own data, its cached tiles are the
* same for everyone, and nobody can change it — **Copy to my dashboards**
* makes an editable board of the viewer's own from it.
*/
export interface Dashboard extends SystemManaged {
id: string;
name: string;
description: string | null;
icon: string | null;
accent: string | null;
is_home: boolean;
position: number;
owner_user_id: string | null;
owner_organisation_id: string | null;
owner_project_id: string | null;
created_at: string | null;
updated_at: string | null;
widget_count: number;
/** A board composed by `POST /dashboards/generate` rather than by hand. */
is_ai_generated?: boolean;
/** The invocation that composed it — see {@link AIGenerated}. Boards have
* no parent agent, so there is no `generated_by_agent_id` here. */
generation_id?: string | null;
}
export interface DashboardWithWidgets extends Dashboard {
widgets: DashboardWidget[];
/** True when the read queued a background refresh — poll until it clears. */
refreshing: boolean;
}
/** A widget type as advertised by the backend registry. */
export interface WidgetTypeSpec {
type: WidgetType;
label: string;
description: string;
category: "content" | "platform" | "feeds" | "intelligence" | string;
data_kind: DataKind;
is_dynamic: boolean;
default_size: { w: number; h: number };
default_config: Record<string, unknown>;
default_refresh_interval_seconds: number | null;
}
export interface CreateWidgetBody {
widget_type: WidgetType;
title?: string | null;
config?: Record<string, unknown>;
x?: number;
y?: number;
w?: number;
h?: number;
position?: number;
refresh_interval_seconds?: number | null;
}
export interface CreateDashboardBody {
name: string;
description?: string | null;
icon?: string | null;
accent?: string | null;
widgets?: CreateWidgetBody[];
/** The generation a reviewed proposal came from: the board is stamped as
* AI-generated and resolves back to the invocation that composed it. */
generation_id?: string | null;
}
export interface WidgetPlacement {
id: string;
x: number;
y: number;
w: number;
h: number;
}
// ─── Widget config shapes ─────────────────────────────────────────────────────
//
// Each mirrors the config its renderer validates in
// `app/services/dashboards/widgets.py`.
export interface NoteConfig {
markdown: string;
accent: string;
}
export interface ShortcutLink {
label: string;
href: string;
icon: string;
}
export interface ShortcutsConfig {
links: ShortcutLink[];
}
export interface StatConfig {
metric: string;
period: "this_month" | "all_time";
}
export interface ChartConfig {
source: "llm_invocations" | "web_search_domains";
metric: string;
chart_type: "area" | "line" | "bar";
limit: number;
}
/** A metric sliced by agent, model, project or organisation.
*
* The dimensioned counterpart to `StatConfig`, which reports the same kinds
* of figure for the whole account. Its vocabulary is not a union here: the
* metrics, dimensions and periods come from `/app/stats/catalogue`, so a
* metric added on the backend reaches the editor's pickers without a release
* of this app.
*/
export interface BreakdownConfig {
metric: string;
/** Null means a single account-wide figure rather than a sliced one. */
dimension: string | null;
period: string;
display: "bar" | "list" | "value";
limit: number;
/** Written as `<dimension>:<id>`. */
filters: string[];
}
export interface PinnedMessageConfig {
content: string;
role: "user" | "assistant" | "system" | "tool";
source_label?: string;
conversation_id?: string;
message_id?: string;
pinned_at?: string;
}
export interface ResourceListConfig {
resource:
| "agents"
| "knowledge"
| "toolkits"
| "skillsets"
| "conversations"
| "projects";
limit: number;
}
// ─── Network widgets ──────────────────────────────────────────────────────────
//
// An empty id is not "unset": it is the tile's documented default — every
// agent, or the newest source of the kind — which the tile names in its
// caption. It is what lets a template or the generator place one.
export interface KnowledgeNetworkConfig {
/** Narrow to these agents and what they reach; empty = every agent. */
agent_ids: string[];
include_memory: boolean;
include_unconnected: boolean;
}
export interface AgentMemoryConfig {
/** One agent, or "" for every agent that remembers anything. */
agent_id: string;
/** Newest memory entries drawn per agent. */
recent: number;
}
export interface WebLinkGraphConfig {
/** A website source, or "" for the newest one. */
knowledge_id: string;
mode: "paths" | "all";
}
export interface KnowledgeGraphConfig {
/** A graph source, or "" for the newest one. */
knowledge_id: string;
}
/** What an assurance tile shows — svc-core's `AssuranceWidget.VIEWS`, drawn
* by `AssuranceWidgets.tsx`'s `VIEWS`. */
export type AssuranceView =
| "leaderboard"
| "risk_return"
| "scores"
| "bot_trend"
| "fleet";
export interface AssuranceConfig {
view: AssuranceView;
}
/** Where a widget sends its prompt — one of the user's agents, or a model. */
export interface WidgetTarget {
type: "agent" | "model";
agent_id?: string;
model_id?: string;
provider?: string;
model?: string;
/** The deployment's default model, resolved when the tile runs. */
default?: boolean;
}
export interface AutomationConfig {
prompt: string;
/** Extra instructions, added to the tile's own (never in place of them). */
system_prompt: string;
style: "summary" | "bullets" | "digest";
/** Keep a downloadable PDF of each refresh: the agent's document, or the
* answer laid out when it made none. Off, the tile never holds one. */
pdf?: boolean;
target: WidgetTarget;
}
export interface AutomationPayload {
markdown: string;
style: string;
/** The agent's name, or the model's, that wrote the answer. */
runs_on?: string;
/** When the answer was written (server timestamp — `parseServerDate`). */
generated_at?: string;
}
export interface ComparisonAxis {
name: string;
min: number;
max: number;
min_label: string;
max_label: string;
}
export interface ComparisonConfig {
subjects: string[];
axes: ComparisonAxis[];
context: string;
target: WidgetTarget;
}
export interface ComparisonRow {
subject: string;
scores: Record<string, number | null>;
note: string;
/** True when the model returned nothing usable for this subject. */
missing: boolean;
}
export interface ComparisonPayload {
axes: ComparisonAxis[];
rows: ComparisonRow[];
summary: string;
}
/** Common refresh cadences offered in the widget editor. */
export const REFRESH_INTERVALS: { label: string; seconds: number | null }[] = [
{ label: "Manual only", seconds: null },
{ label: "Every hour", seconds: 3600 },
{ label: "Every 6 hours", seconds: 21600 },
{ label: "Every 24 hours", seconds: 86400 },
{ label: "Every week", seconds: 604800 },
];
// ─── Saved-message lists ──────────────────────────────────────────────────────
export interface SavedMessage {
id: string;
content: string;
role: "user" | "assistant" | "system" | "tool";
note?: string;
source_label?: string;
saved_at: string;
conversation_id?: string;
message_id?: string;
}
export interface MessageListConfig {
items: SavedMessage[];
max_items: number;
}
/** What the chat "save to dashboard" picker needs, flat. */
export interface MessageListTarget {
dashboard_id: string;
dashboard_name: string;
dashboard_is_home: boolean;
widget_id: string;
widget_title: string | null;
item_count: number;
}
export interface SaveMessageBody {
content: string;
role?: string;
note?: string | null;
source_label?: string | null;
conversation_id?: string | null;
message_id?: string | null;
}
// ─── Feed widgets ─────────────────────────────────────────────────────────────
export interface WeatherConfig {
latitude: number;
longitude: number;
location_name: string;
units: "metric" | "imperial";
days: number;
}
export interface WeatherDay {
date: string;
label: string;
icon: string;
max: number | null;
min: number | null;
precipitation_probability: number | null;
}
export interface WeatherPayload {
current: {
temperature: number | null;
feels_like: number | null;
humidity: number | null;
wind_speed: number | null;
label: string;
icon: string;
is_day: boolean;
};
days: WeatherDay[];
units: { temperature: string; wind_speed: string };
timezone: string | null;
location_name: string;
source: string;
source_url: string;
}
export interface RSSConfig {
url: string;
limit: number;
show_summaries: boolean;
}
export interface RSSItem {
title: string;
link: string;
published: string;
summary: string;
}
export interface RSSPayload {
feed_title: string;
feed_link: string;
items: RSSItem[];
fetched_at: string;
}
// ─── Market ───────────────────────────────────────────────────────────────────
export interface MarketConfig {
symbols: string[];
chart_symbol: string;
days: number;
}
export interface MarketQuote {
symbol: string;
price: number | null;
change: number | null;
change_percent: number | null;
previous_close: number | null;
as_of: string | null;
}
export interface MarketPoint {
date: string;
close: number | null;
}
export interface MarketPayload {
quotes: MarketQuote[];
series: MarketPoint[];
series_symbol: string;
/** Per-symbol problems that did not blank the whole tile. */
errors: string[];
source: string;
/** Vendor free tiers are end-of-day or delayed; never shown as real time. */
delayed: boolean;
}
// ─── Generation ───────────────────────────────────────────────────────────────
export interface ProposedWidget {
widget_type: WidgetType;
title: string;
config: Record<string, unknown>;
x: number;
y: number;
w: number;
h: number;
position: number;
refresh_interval_seconds: number | null;
/** Why the model put this tile on the board. */
rationale: string;
data_kind: DataKind;
/** The agent (or model) a model-backed tile will run on; null otherwise. */
runs_on?: string | null;
}
export interface GenerationProposal {
/** The invocation that composed it, passed back on create. */
generation_id: string;
name: string;
description: string;
icon: string | null;
accent: string | null;
reasoning: string;
widgets: ProposedWidget[];
/** What was dropped or adjusted server-side, and why. */
warnings: string[];
model: {
provider: string;
model_name: string;
ai_model_id: string | null;
};
}
|