Files
gstack/browse/src/buffers.ts
Garry Tan e9fbb664f8 refactor: reorganize codebase — move browse CLI to browse/ directory
Restructure project layout: src/ → browse/src/, test/ → browse/test/. Add snapshot testing. Update docs, package.json, and skills integration. Add setup script and TODO tracking.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-11 19:28:50 -07:00

38 lines
919 B
TypeScript

/**
* Shared buffers and types — extracted to break circular dependency
* between server.ts and browser-manager.ts
*/
export interface LogEntry {
timestamp: number;
level: string;
text: string;
}
export interface NetworkEntry {
timestamp: number;
method: string;
url: string;
status?: number;
duration?: number;
size?: number;
}
export const consoleBuffer: LogEntry[] = [];
export const networkBuffer: NetworkEntry[] = [];
const HIGH_WATER_MARK = 50_000;
export function addConsoleEntry(entry: LogEntry) {
consoleBuffer.push(entry);
if (consoleBuffer.length === HIGH_WATER_MARK) {
console.warn(`[browse] Console buffer reached ${HIGH_WATER_MARK} entries`);
}
}
export function addNetworkEntry(entry: NetworkEntry) {
networkBuffer.push(entry);
if (networkBuffer.length === HIGH_WATER_MARK) {
console.warn(`[browse] Network buffer reached ${HIGH_WATER_MARK} entries`);
}
}