feat(workspace): overhaul ProjectBox tab system with 6 tabs and lazy mount

This commit is contained in:
Hibryda 2026-03-10 02:12:05 +01:00
parent f5f3e0d63e
commit 6744e1beaf
6 changed files with 1317 additions and 13 deletions

View file

@ -0,0 +1,22 @@
import { invoke } from '@tauri-apps/api/core';
export interface DirEntry {
name: string;
path: string;
is_dir: boolean;
size: number;
ext: string;
}
export type FileContent =
| { type: 'Text'; content: string; lang: string }
| { type: 'Binary'; message: string }
| { type: 'TooLarge'; size: number };
export function listDirectoryChildren(path: string): Promise<DirEntry[]> {
return invoke<DirEntry[]>('list_directory_children', { path });
}
export function readFileContent(path: string): Promise<FileContent> {
return invoke<FileContent>('read_file_content', { path });
}

View file

@ -0,0 +1,52 @@
/**
* Pluggable memory adapter interface.
* Memora is the default implementation, but others can be swapped in.
*/
export interface MemoryNode {
id: string | number;
content: string;
tags: string[];
metadata?: Record<string, unknown>;
created_at?: string;
updated_at?: string;
}
export interface MemorySearchResult {
nodes: MemoryNode[];
total: number;
}
export interface MemoryAdapter {
readonly name: string;
readonly available: boolean;
/** List memories, optionally filtered by tags */
list(options?: { tags?: string[]; limit?: number; offset?: number }): Promise<MemorySearchResult>;
/** Semantic search across memories */
search(query: string, options?: { tags?: string[]; limit?: number }): Promise<MemorySearchResult>;
/** Get a single memory by ID */
get(id: string | number): Promise<MemoryNode | null>;
}
/** Registry of available memory adapters */
const adapters = new Map<string, MemoryAdapter>();
export function registerMemoryAdapter(adapter: MemoryAdapter): void {
adapters.set(adapter.name, adapter);
}
export function getMemoryAdapter(name: string): MemoryAdapter | undefined {
return adapters.get(name);
}
export function getAvailableAdapters(): MemoryAdapter[] {
return Array.from(adapters.values()).filter(a => a.available);
}
export function getDefaultAdapter(): MemoryAdapter | undefined {
// Prefer Memora if available, otherwise first available
return adapters.get('memora') ?? getAvailableAdapters()[0];
}