From e1e001c7e0b69b7bdf1fbabdaca6af84750f1713 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 26 May 2026 19:06:01 +0000 Subject: [PATCH] feat: TypeScript types for sessions, artifacts, A2UI, tool calls, auth --- frontend/src/lib/types.ts | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 frontend/src/lib/types.ts diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts new file mode 100644 index 0000000..8fa2ab0 --- /dev/null +++ b/frontend/src/lib/types.ts @@ -0,0 +1,107 @@ +// Session types +export interface Session { + session_id: string + status: string + bundle: string + created_at: string + last_activity: string + total_messages: number + tool_invocations: number + stale: boolean +} + +export interface SessionListResponse { + sessions: Session[] + total: number +} + +// Artifact types +export interface Artifact { + name: string + session_id: string + size: number +} + +export interface ArtifactContent { + name: string + session_id: string + content: string +} + +// A2UI types +export type A2UIBlockType = 'filters' | 'form' | 'table' | 'cards' + +export interface A2UIFilterOption { + label: string + value: string +} + +export interface A2UIFiltersBlock { + type: 'filters' + filters: A2UIFilterOption[] +} + +export interface A2UIFormField { + name: string + type: 'text' | 'number' | 'select' + label?: string + value?: string | number + options?: A2UIFilterOption[] +} + +export interface A2UIFormBlock { + type: 'form' + fields: A2UIFormField[] + submitLabel: string +} + +export interface A2UITableBlock { + type: 'table' + headers: string[] + rows: string[][] +} + +export interface A2UICardItem { + title: string + description?: string + image?: string + price?: string + url?: string +} + +export interface A2UICardsBlock { + type: 'cards' + items: A2UICardItem[] +} + +export type A2UIBlock = A2UIFiltersBlock | A2UIFormBlock | A2UITableBlock | A2UICardsBlock + +// MCP / Tool Call types +export interface MCPAppMeta { + ui: { + resourceUri: string + csp?: string + } +} + +export type MCPAppStructuredContent = Record + +export interface ToolCall { + id: string + name: string + args: Record + result?: unknown + status: 'pending' | 'running' | 'complete' | 'error' + _meta?: MCPAppMeta + structuredContent?: MCPAppStructuredContent +} + +// Auth types +export interface AuthUser { + email: string +} + +export interface LoginResponse { + token: string + email: string +}