import { invoke } from '@tauri-apps/api/core'; export interface CtxEntry { project: string; key: string; value: string; updated_at: string; } export interface CtxSummary { project: string; summary: string; created_at: string; } export async function ctxInitDb(): Promise { return invoke('ctx_init_db'); } export async function ctxRegisterProject(name: string, description: string, workDir?: string): Promise { return invoke('ctx_register_project', { name, description, workDir: workDir ?? null }); } export async function ctxGetContext(project: string): Promise { return invoke('ctx_get_context', { project }); } export async function ctxGetShared(): Promise { return invoke('ctx_get_shared'); } export async function ctxGetSummaries(project: string, limit: number = 5): Promise { return invoke('ctx_get_summaries', { project, limit }); } export async function ctxSearch(query: string): Promise { return invoke('ctx_search', { query }); }