refactor(app): introduce attachment storage layer and draft lifecycle management

Replace inline data-URL image handling with a persistent attachment storage service, add draft lifecycle states (active/abandoned/sent) with generation tracking, and update fetchAgent to return project placement alongside agent snapshots.
This commit is contained in:
Mohamed Boudra
2026-02-22 16:22:21 +07:00
parent 2652bdda2e
commit 0c710b09f5
55 changed files with 2381 additions and 350 deletions
@@ -0,0 +1,38 @@
class MemoryLocalStorage {
private readonly map = new Map<string, string>();
get length(): number {
return this.map.size;
}
clear(): void {
this.map.clear();
}
getItem(key: string): string | null {
return this.map.has(key) ? this.map.get(key) ?? null : null;
}
key(index: number): string | null {
return Array.from(this.map.keys())[index] ?? null;
}
removeItem(key: string): void {
this.map.delete(key);
}
setItem(key: string, value: string): void {
this.map.set(key, value);
}
}
if (typeof window === "undefined") {
const storage = new MemoryLocalStorage();
Object.defineProperty(globalThis, "window", {
value: {
localStorage: storage,
},
configurable: true,
writable: true,
});
}