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:
@@ -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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user