mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-11 15:07:26 +08:00
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>
38 lines
919 B
TypeScript
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`);
|
|
}
|
|
}
|