feat(KB-057): complete Step 2 — useTerminal hook with history, SSE streaming, and command execution

This commit is contained in:
gsxdsm
2026-03-29 20:57:18 -07:00
parent c5b09e1cb1
commit 287ce1d6d2
6 changed files with 827 additions and 3 deletions

View File

@@ -102,7 +102,12 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
const filePath = join(dir, "task.json");
const raw = await readFile(filePath, "utf-8");
try {
return JSON.parse(raw) as Task;
const task = JSON.parse(raw) as Task;
// Normalize legacy task.json files so newer code can safely mutate them.
if (!Array.isArray(task.log)) task.log = [];
if (!Array.isArray(task.dependencies)) task.dependencies = [];
if (!Array.isArray(task.steps)) task.steps = [];
return task;
} catch (err) {
throw new Error(
`Failed to parse task.json at ${filePath}: ${(err as Error).message}`,