(kind: string, detail: string)
| 259 | |
| 260 | // Best-effort JSONL append to ~/.gstack/.gbrain-errors.jsonl. Never throws. |
| 261 | function logGbrainError(kind: string, detail: string): void { |
| 262 | try { |
| 263 | const path = errorLogPath(); |
| 264 | mkdirSync(dirname(path), { recursive: true }); |
| 265 | appendFileSync( |
| 266 | path, |
| 267 | JSON.stringify({ ts: new Date().toISOString(), kind, detail: detail.slice(0, 500) }) + "\n", |
| 268 | "utf-8" |
| 269 | ); |
| 270 | } catch { /* logging is best-effort */ } |
| 271 | } |
| 272 | |
| 273 | function freshDetectEngineTier(): EngineDetect { |
| 274 | const now = Date.now(); |
no test coverage detected