Files
Reims-Go/frontend/src/lib/logs.ts
T
NwflowerandClaude Opus 5.5 2f43182f0c feat: offline installer downloads, task progress events, Win10 cold reboot
Offline installers (roadmap M1.3):
- internal/installer drives `reims-util --json offline-installer` and parses
  its JSON event stream (upstream reims-vgpu 3731afd, reims_util.rs:423-509)
- downloads hold installers/.lock like reims-ctl, so the two never write the
  same file; checked against the real reims-ctl (TestLockExcludesReimsCtl)
- pause = stop the process, rerun resumes; deletes go through
  `reims-ctl downloads delete`, which refuses files in use or downloading
- CLI: reims-go installer list | download | cached | delete
- Wails bindings: ListOfflineReleases, DownloadInstaller, ListInstallers,
  DeleteInstaller

Task events (ui-redesign B1):
- tasks.go tracks long-running work and emits "reims:task" (throttled to
  200 ms per task); VM creation turns reims-ctl's progress lines into task
  progress and logs each step once
- the status bar shows the current task with a progress bar, details in a
  tooltip and a pause button; the frontend regex merging is removed

Win10 cold reboot workaround:
- host probes whether WinHvPlatform.dll lacks WHvResetPartition (Win10 19045)
- internal/qmp watches a dedicated QMP channel for guest resets; with
  -no-reboot the app restarts the VM in a fresh partition
- architecture.md documents download routing and the workaround

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 03:35:03 -07:00

29 lines
911 B
TypeScript

import { LogEntry } from '../types'
export type LogLevel = 'info' | 'warn' | 'error'
export interface LogLine extends LogEntry {
id: number
level: LogLevel
}
export const MAX_LOG_LINES = 2000
// Progress no longer reaches the log: the backend turns it into tasks
// (tasks.go, "reims:task"). Levels are still guessed from the text until the
// backend tags them (docs/ui-redesign.md §6 B2).
const ERROR_RE = /\b(error|failed|fatal|panic)\b/i
const WARN_RE = /\bwarn(ing)?\b/i
let nextId = 1
export function classify(entry: LogEntry): LogLine {
const level: LogLevel = ERROR_RE.test(entry.line) ? 'error' : WARN_RE.test(entry.line) ? 'warn' : 'info'
return { ...entry, id: nextId++, level }
}
export function appendLog(prev: LogLine[], entry: LogEntry): LogLine[] {
const next = [...prev, classify(entry)]
return next.length > MAX_LOG_LINES ? next.slice(next.length - MAX_LOG_LINES) : next
}