Skip to main content
The SDK exports all types needed to work with the SupaProxy API. Import them directly:
import type {
  Workspace,
  Connection,
  Conversation,
  QueryResponse,
  ConversationWithStats
} from '@supaproxy/sdk';

Entity types

Workspace

interface Workspace {
  id: string
  org_id: string
  team_id: string
  name: string
  status: 'active' | 'paused' | 'archived'
  model: string
  system_prompt: string | null
  max_tool_rounds: number
  cold_timeout_minutes: number
  close_timeout_minutes: number
  created_by: string | null
  created_at: string
  updated_at: string
  team?: string
}

Connection

interface Connection {
  id: string
  workspace_id: string
  name: string
  type: 'mcp' | 'rest' | 'graphql' | 'database'
  status: 'connected' | 'disconnected' | 'error'
  config: string // JSON
}

interface ConnectionTool {
  id: string
  connection_id: string
  name: string
  description: string
  input_schema: string // JSON
  is_write: boolean
  connection_name?: string
  connection_type?: string
}

Consumer

type ConsumerType = 'slack' | 'api' | 'whatsapp' | 'claude-code'

interface Consumer {
  id: string
  workspace_id: string
  type: ConsumerType
  config: string // JSON
  status: 'active' | 'inactive'
}

Conversation

type ConversationStatus = 'open' | 'cold' | 'closed'
type ResolutionStatus = 'resolved' | 'unresolved' | 'escalated' | 'abandoned'
type ConversationCategory = 'query' | 'issue' | 'sales' | 'feedback' | 'support' | 'internal' | 'other'

interface Conversation {
  id: string
  workspace_id: string
  consumer_type: ConsumerType
  external_thread_id: string | null
  status: ConversationStatus
  user_id: string | null
  user_name: string | null
  channel: string | null
  message_count: number
  first_message_at: string | null
  last_activity_at: string | null
  cold_at: string | null
  closed_at: string | null
  created_at: string
  updated_at: string
}

interface Message {
  id: string
  conversation_id: string
  seq: number
  role: 'user' | 'assistant'
  content: string
  audit_log_id: string | null
  created_at: string
}

Conversation stats

interface ConversationStats {
  id: string
  conversation_id: string
  sentiment_score: number | null
  resolution_status: ResolutionStatus | null
  category: ConversationCategory | null
  summary: string | null
  compliance_violations: ComplianceViolation[]
  knowledge_gaps: KnowledgeGap[]
  fraud_indicators: FraudIndicator[]
  tools_used: string[]
  total_tokens_input: number
  total_tokens_output: number
  total_cost_usd: number
  message_count: number
  duration_seconds: number
  stats_status: 'pending' | 'complete' | 'failed'
  created_at: string
}

interface ComplianceViolation { rule: string; description: string }
interface KnowledgeGap { topic: string; description: string }
interface FraudIndicator { type: string; description: string; severity: 'low' | 'medium' | 'high' }

Knowledge

interface KnowledgeSourceEntity {
  id: string
  workspace_id: string
  type: 'confluence' | 'file' | 'inline' | 'url'
  name: string
  config: string // JSON
  status: 'pending' | 'syncing' | 'synced' | 'error'
  chunks: number
  last_synced_at: string | null
  created_at: string
  updated_at: string
}

Organisation

interface Organisation {
  id: string
  name: string
  slug: string
  created_at: string
}

interface User {
  id: string
  org_id: string
  email: string
  name: string
  org_role: 'admin' | 'member'
  created_at: string
}

API response types

All endpoint responses have dedicated types. Key ones:
TypeDescription
WorkspaceListResponse{ workspaces: WorkspaceListItem[] }
WorkspaceDetailResponseFull workspace with connections, tools, knowledge, guardrails, consumers, permissions, stats
QueryResponseAnswer, tools called, cost, duration, conversation ID
ConversationListResponseConversations with stats, total count, available filters
ConversationDetailResponseConversation, messages (with audit data), stats
DashboardResponseTickets, sentiment, compliance, cost, usage, recent conversations
HealthResponseServer status, setup state, counts

Configuration types

TypeDescription
WorkspaceConfigFull runtime config (MCP servers, knowledge, consumers, guardrails, permissions)
GuardrailsConfigPII filter, write confirmation, cost cap, rate limit, blocked topics
ConsumerConfigPer-consumer-type config (channels, auth, settings)
PermissionEnum of all permission types