Files
claudia-docs-web/src/types/index.ts
Hiro fe6ef71902 feat: Add Token Management UI
- Add SettingsTokens view at /settings/tokens
- Add TokenManager modal component for creating tokens
- Add token management functions to auth store (fetchTokens, generateToken, revokeToken)
- Add Settings link in header user dropdown
- Add ApiToken types to types/index.ts
- Route: GET /auth/tokens, POST /auth/token/generate, DELETE /auth/tokens/{id}
2026-03-31 01:43:50 +00:00

258 lines
4.5 KiB
TypeScript

// User / Auth types
export interface Agent {
id: string
username: string
role: 'agent' | 'admin'
created_at: string
updated_at: string
}
export interface AuthResponse {
access_token: string
token_type: string
}
// Project types
export interface Project {
id: string
name: string
description: string | null
agent_id: string
created_at: string
updated_at: string
}
// Folder types
export interface Folder {
id: string
name: string
project_id: string
parent_id: string | null
path: string
created_at: string
updated_at: string
}
// Document types
export interface Tag {
id: string
name: string
color: string
}
export interface ReasoningStep {
step: number
thought: string
conclusion: string | null
}
export interface DocumentReasoning {
reasoning_type: 'chain' | 'idea' | 'context' | 'reflection' | null
confidence: number | null
reasoning_steps: ReasoningStep[]
model_source: string | null
}
export interface ReasoningPanelData {
document_id: string
has_reasoning: boolean
reasoning: DocumentReasoning | null
editable: boolean
}
export interface TipTapContentResponse {
content: Record<string, unknown>
format: 'tiptap'
}
export interface ContentUpdateRequest {
content: Record<string, unknown>
format: 'tiptap' | 'markdown'
}
export interface Document {
id: string
title: string
content: string
project_id: string
folder_id: string | null
path: string
tags: Tag[]
reasoning: DocumentReasoning | null
tiptap_content: Record<string, unknown> | null
created_at: string
updated_at: string
}
// Tree view node
export interface TreeNode {
id: string
name: string
type: 'folder' | 'document'
children?: TreeNode[]
parent_id: string | null
}
// API responses
export interface ProjectsResponse {
projects: Project[]
}
export interface FoldersResponse {
folders: Folder[]
}
export interface DocumentsResponse {
documents: Document[]
}
// Graph types
export interface GraphNode {
id: string
title: string
type: 'document'
}
export interface GraphEdge {
source: string
target: string
type: 'reference'
}
export interface GraphStats {
total_documents: number
total_references: number
orphaned_documents: number
}
export interface GraphData {
project_id: string
nodes: GraphNode[]
edges: GraphEdge[]
stats: GraphStats
}
// Backlinks types
export interface BacklinkItem {
document_id: string
title: string
project_id: string
project_name: string
excerpt: string
updated_at: string
}
export interface BacklinksResponse {
document_id: string
backlinks_count: number
backlinks: BacklinkItem[]
}
export interface OutgoingLinkItem {
document_id: string
title: string
project_id: string
project_name: string
exists: boolean
updated_at: string
}
export interface OutgoingLinksResponse {
document_id: string
outgoing_links_count: number
outgoing_links: OutgoingLinkItem[]
}
export interface DocumentLinkRef {
document_id: string
title: string
anchor_text: string
}
export interface DocumentLinksResponse {
document_id: string
outgoing_links: DocumentLinkRef[]
backlinks: DocumentLinkRef[]
}
// Search / Quick Switcher types
export interface SearchResult {
id: string
type: 'document' | 'project'
title: string
subtitle: string | null
highlight: string | null
icon: string
project_id?: string
}
export interface SearchResponse {
query: string
results: SearchResult[]
total: number
search_type: string
}
// Export types
export interface DocumentExportResponse {
// The API returns the raw file, not JSON
// This is for type safety on the response
}
export interface ProjectExportResponse {
// The API returns the raw file, not JSON
}
// Form inputs
export interface LoginForm {
username: string
password: string
}
export interface RegisterForm {
username: string
password: string
}
export interface ProjectForm {
name: string
description: string
}
export interface FolderForm {
name: string
parent_id: string | null
}
export interface DocumentForm {
title: string
content: string
folder_id: string | null
}
export interface TagForm {
name: string
color: string
}
// API Token types
export type TokenRole = 'researcher' | 'developer' | 'viewer'
export interface ApiToken {
id: string
name: string
role: TokenRole
created_at: string
}
export interface ApiTokenGenerateResponse {
token: string
name: string
role: TokenRole
}
export interface ApiTokenCreate {
name: string
role: TokenRole
}