- Add token-based authentication with auto-generated token stored in server/data/.token - Add login page with URL token auto-fill support - Add route guards requiring auth for all pages except login - Restructure routes: / for login, /chat for conversations - Add skill enable/disable toggle via config.yaml skills.disabled - Unify logo to /logo.png across sidebar, login, messages, and empty state - Hide sidebar on login page, prevent flash with router.isReady() - Fix session export JSON parse error when CLI returns non-JSON output - Display token in CLI on server start Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { request } from './client'
|
|
|
|
export interface SkillInfo {
|
|
name: string
|
|
description: string
|
|
enabled?: boolean
|
|
}
|
|
|
|
export interface SkillCategory {
|
|
name: string
|
|
description: string
|
|
skills: SkillInfo[]
|
|
}
|
|
|
|
export interface SkillListResponse {
|
|
categories: SkillCategory[]
|
|
}
|
|
|
|
export interface SkillFileEntry {
|
|
path: string
|
|
name: string
|
|
isDir: boolean
|
|
}
|
|
|
|
export interface MemoryData {
|
|
memory: string
|
|
user: string
|
|
memory_mtime: number | null
|
|
user_mtime: number | null
|
|
}
|
|
|
|
export async function fetchSkills(): Promise<SkillCategory[]> {
|
|
const res = await request<SkillListResponse>('/api/skills')
|
|
return res.categories
|
|
}
|
|
|
|
export async function fetchSkillContent(skillPath: string): Promise<string> {
|
|
const res = await request<{ content: string }>(`/api/skills/${skillPath}`)
|
|
return res.content
|
|
}
|
|
|
|
export async function fetchSkillFiles(category: string, skill: string): Promise<SkillFileEntry[]> {
|
|
const res = await request<{ files: SkillFileEntry[] }>(`/api/skills/${category}/${skill}/files`)
|
|
return res.files
|
|
}
|
|
|
|
export async function fetchMemory(): Promise<MemoryData> {
|
|
return request<MemoryData>('/api/memory')
|
|
}
|
|
|
|
export async function saveMemory(section: 'memory' | 'user', content: string): Promise<void> {
|
|
await request('/api/memory', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ section, content }),
|
|
})
|
|
}
|
|
|
|
export async function toggleSkill(name: string, enabled: boolean): Promise<void> {
|
|
await request('/api/skills/toggle', {
|
|
method: 'PUT',
|
|
body: JSON.stringify({ name, enabled }),
|
|
})
|
|
}
|