feat(kanban): resume runs' chat via Refine + isolate the event stream
Two intertwined changes that both touch the orchestrator hook + run console: Isolate the agent event stream (perf): - useRunStream owns the SSE stream + event log locally inside AgentRunBar, so a burst of streamed events re-renders only the console — never the board page or card modal (which was causing frame drops at run start). - useOrchestrator is now a registry only; lifecycle events reflect back up via stable patchRun/reflectBevy reflectors (effect deps depend on those, not the whole object, avoiding a stream-teardown loop). Session resume for Refine: - Runs now persist their pi session (drop --no-session); each fresh run captures its session JSONL path into a new agent_runs.session_file column (additive, idempotent migration). - Refine resumes the prior run's actual session (--session <path> → appends) in that run's own worktree (inherited, never owned), sending the operator's feedback as the next message in the same conversation with full prior context. - owns_worktree guards remove()/cleanup so a refinement never destroys the owning run's worktree; bad refinement targets return 409. - AgentRunBar shows Refine only for settled runs with a recorded session. EOF && echo "" && git log --oneline -3
This commit is contained in:
@@ -17,8 +17,12 @@ export interface AgentRun {
|
||||
cardId: string;
|
||||
status: RunStatus;
|
||||
useWorktree: boolean;
|
||||
/** Whether this run created (and therefore owns/cleans up) its worktree. */
|
||||
ownsWorktree: boolean;
|
||||
branch: string | null;
|
||||
worktreePath: string | null;
|
||||
/** pi session JSONL path persisted for this run (resumable by refinements). */
|
||||
sessionFile: string | null;
|
||||
prompt: string;
|
||||
summary: string | null;
|
||||
commitSha: string | null;
|
||||
@@ -78,6 +82,11 @@ export interface StartRunInput {
|
||||
prompt?: string;
|
||||
useWorktree?: boolean;
|
||||
cleanupOnFinish?: boolean;
|
||||
/**
|
||||
* If set, start a refinement run that continues this prior run's branch with
|
||||
* `prompt` as the operator's refinement feedback.
|
||||
*/
|
||||
refineRunId?: string;
|
||||
}
|
||||
|
||||
/** A commit on a run's branch that is not yet on main. */
|
||||
|
||||
Reference in New Issue
Block a user