Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'

This commit is contained in:
ruv
2026-02-28 14:39:40 -05:00
7854 changed files with 3522914 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
/**
* Browser-specific entry point with IndexedDB support
*/
export * from './index';
// Re-export with browser-specific defaults
import { RuDag, DagStorage } from './index';
/**
* Create a browser-optimized DAG with IndexedDB persistence
*/
export async function createBrowserDag(name?: string): Promise<RuDag> {
const storage = new DagStorage();
const dag = new RuDag({ name, storage });
await dag.init();
return dag;
}
/**
* Browser storage manager for DAGs
*/
export class BrowserDagManager {
private storage: DagStorage;
private initialized = false;
constructor() {
this.storage = new DagStorage();
}
async init(): Promise<void> {
if (this.initialized) return;
await this.storage.init();
this.initialized = true;
}
async createDag(name?: string): Promise<RuDag> {
await this.init();
const dag = new RuDag({ name, storage: this.storage });
await dag.init();
return dag;
}
async loadDag(id: string): Promise<RuDag | null> {
await this.init();
return RuDag.load(id, this.storage);
}
async listDags() {
await this.init();
return this.storage.list();
}
async deleteDag(id: string): Promise<boolean> {
await this.init();
return this.storage.delete(id);
}
async clearAll(): Promise<void> {
await this.init();
return this.storage.clear();
}
async getStats() {
await this.init();
return this.storage.stats();
}
close(): void {
this.storage.close();
this.initialized = false;
}
}