2026-03-06 22:51:19 -05:00
|
|
|
// Shared TypeScript types for the Nanobot UI
|
|
|
|
|
|
|
|
|
|
export type AgentState = "idle" | "listening" | "thinking" | "speaking";
|
2026-03-12 09:25:15 -04:00
|
|
|
export type CardLane = "attention" | "work" | "context" | "history";
|
|
|
|
|
export type CardState = "active" | "stale" | "resolved" | "superseded" | "archived";
|
|
|
|
|
export type JsonValue =
|
|
|
|
|
| string
|
|
|
|
|
| number
|
|
|
|
|
| boolean
|
|
|
|
|
| null
|
|
|
|
|
| { [key: string]: JsonValue }
|
|
|
|
|
| JsonValue[];
|
|
|
|
|
|
|
|
|
|
export interface CardMessageMetadata {
|
|
|
|
|
card_id?: string;
|
|
|
|
|
card_slot?: string;
|
|
|
|
|
card_title?: string;
|
|
|
|
|
card_lane?: CardLane;
|
|
|
|
|
card_template_key?: string;
|
|
|
|
|
card_context_summary?: string;
|
|
|
|
|
card_response_value?: string;
|
|
|
|
|
card_live_content?: JsonValue;
|
|
|
|
|
}
|
2026-03-06 22:51:19 -05:00
|
|
|
|
|
|
|
|
export type ServerMessage =
|
|
|
|
|
| { type: "agent_state"; state: AgentState }
|
2026-03-12 09:25:15 -04:00
|
|
|
| {
|
|
|
|
|
type: "message";
|
|
|
|
|
role: string;
|
|
|
|
|
content: string;
|
|
|
|
|
is_progress: boolean;
|
|
|
|
|
is_tool_hint: boolean;
|
|
|
|
|
timestamp: string;
|
|
|
|
|
}
|
|
|
|
|
| {
|
|
|
|
|
type: "card";
|
|
|
|
|
id: string;
|
|
|
|
|
kind: "text" | "question";
|
|
|
|
|
title: string;
|
|
|
|
|
content: string;
|
|
|
|
|
question: string;
|
|
|
|
|
choices: string[];
|
|
|
|
|
response_value: string;
|
|
|
|
|
slot: string;
|
|
|
|
|
lane: CardLane;
|
|
|
|
|
priority: number;
|
|
|
|
|
state: CardState;
|
|
|
|
|
template_key: string;
|
|
|
|
|
context_summary: string;
|
|
|
|
|
created_at: string;
|
|
|
|
|
updated_at: string;
|
|
|
|
|
}
|
2026-03-06 22:51:19 -05:00
|
|
|
| { type: "error"; error: string }
|
2026-03-12 09:25:15 -04:00
|
|
|
| { type: "pong" };
|
2026-03-06 22:51:19 -05:00
|
|
|
|
|
|
|
|
export type ClientMessage =
|
2026-03-12 09:25:15 -04:00
|
|
|
| { type: "voice-ptt"; pressed: boolean; metadata?: CardMessageMetadata }
|
2026-03-06 22:51:19 -05:00
|
|
|
| { type: "command"; command: string }
|
2026-03-12 09:25:15 -04:00
|
|
|
| { type: "card-response"; card_id: string; value: string }
|
2026-03-06 22:51:19 -05:00
|
|
|
| { type: "ping" };
|
|
|
|
|
|
|
|
|
|
export interface LogLine {
|
|
|
|
|
id: number;
|
|
|
|
|
role: string;
|
|
|
|
|
text: string;
|
|
|
|
|
timestamp: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 09:25:15 -04:00
|
|
|
export interface CardItem {
|
2026-03-06 22:51:19 -05:00
|
|
|
id: number;
|
2026-03-12 09:25:15 -04:00
|
|
|
serverId?: string;
|
|
|
|
|
kind: "text" | "question";
|
2026-03-06 22:51:19 -05:00
|
|
|
content: string;
|
|
|
|
|
title: string;
|
|
|
|
|
question?: string;
|
|
|
|
|
choices?: string[];
|
2026-03-12 09:25:15 -04:00
|
|
|
responseValue?: string;
|
|
|
|
|
slot?: string;
|
|
|
|
|
lane: CardLane;
|
|
|
|
|
priority: number;
|
|
|
|
|
state: CardState;
|
|
|
|
|
templateKey?: string;
|
|
|
|
|
contextSummary?: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
2026-03-06 22:51:19 -05:00
|
|
|
}
|