feat: TypeScript types for sessions, artifacts, A2UI, tool calls, auth

This commit is contained in:
Ken
2026-05-26 19:06:01 +00:00
parent 64b18613e1
commit e1e001c7e0
+107
View File
@@ -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<string, unknown>
export interface ToolCall {
id: string
name: string
args: Record<string, unknown>
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
}