mirror of
https://github.com/garrytan/gstack.git
synced 2026-07-06 08:07:53 +02:00
add \$B memory command
Registers 'memory' in META_COMMANDS, wires the meta-command dispatch to a lazy-imported handler in memory-command.ts. Lazy because the import graph (cdp-bridge + memory-snapshot + buffer accessors) isn't useful to projects that never run the diagnostic. The handler assembles MemoryStructureStats from the modules that own each buffer (cdp-inspector mod history stats, activity subscriber count, console/network/dialog buffer lengths, captureBuffer bytes, inspectorSubscriber count via a new server.ts export) and calls BrowserManager.getMemorySnapshot. Output is text by default, JSON with --json so the sidebar footer and test harness can consume it programmatically. buildMemorySnapshotJson is the entry the /memory endpoint will call in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -724,6 +724,11 @@ let inspectorTimestamp: number = 0;
|
||||
type InspectorSubscriber = (event: any) => void;
|
||||
const inspectorSubscribers = new Set<InspectorSubscriber>();
|
||||
|
||||
/** Diagnostic accessor used by the $B memory snapshot. */
|
||||
export function getInspectorSubscriberCount(): number {
|
||||
return inspectorSubscribers.size;
|
||||
}
|
||||
|
||||
function emitInspectorEvent(event: any): void {
|
||||
for (const notify of inspectorSubscribers) {
|
||||
queueMicrotask(() => {
|
||||
|
||||
Reference in New Issue
Block a user