(args: string[], bm: BrowserManager)
| 101 | } |
| 102 | |
| 103 | export async function handleMemoryCommand(args: string[], bm: BrowserManager): Promise<string> { |
| 104 | const jsonMode = args.includes('--json'); |
| 105 | const structures = collectStructureStats(); |
| 106 | const snapshot = await bm.getMemorySnapshot(structures); |
| 107 | if (jsonMode) return JSON.stringify(snapshot); |
| 108 | return formatSnapshotText(snapshot); |
| 109 | } |
| 110 | |
| 111 | /** Entry point used by the /memory HTTP endpoint — same data, always JSON. */ |
| 112 | export async function buildMemorySnapshotJson(bm: BrowserManager): Promise<MemorySnapshot> { |
no test coverage detected