kaizen-agent 1.87.4 → 1.88.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/cli/activity.ts +2 -1
  2. package/cli/state.ts +15 -0
  3. package/cli/task-service.ts +23 -6
  4. package/cli/tasks.ts +4 -3
  5. package/cli/whats-new.json +26 -0
  6. package/package.json +1 -1
  7. package/web/components/decision/decision-bar.tsx +77 -26
  8. package/web/components/decision/index.ts +1 -0
  9. package/web/components/decision/plan-text.tsx +17 -0
  10. package/web/components/phone/phone-home.tsx +19 -14
  11. package/web/components/rail/rail-list.tsx +27 -4
  12. package/web/components/shared/action-menu.tsx +19 -2
  13. package/web/components/shared/index.ts +1 -0
  14. package/web/components/shared/panel-frame.tsx +212 -0
  15. package/web/components/shell/rail.tsx +5 -3
  16. package/web/components/task/agent-chip.tsx +56 -0
  17. package/web/components/task/agent-mark.tsx +34 -0
  18. package/web/components/task/changes-view.tsx +26 -0
  19. package/web/components/task/chat-bubble.tsx +8 -3
  20. package/web/components/task/composer.tsx +78 -0
  21. package/web/components/task/conversation.tsx +65 -0
  22. package/web/components/task/index.ts +12 -0
  23. package/web/components/task/plan-view.tsx +50 -0
  24. package/web/components/task/reference-files.tsx +24 -0
  25. package/web/components/task/result-view.tsx +3 -1
  26. package/web/components/task/review-view.tsx +40 -0
  27. package/web/components/task/saved-results.tsx +38 -0
  28. package/web/components/task/task-panel.tsx +143 -0
  29. package/web/components/task/task-phone.tsx +211 -0
  30. package/web/components/task/task-row.tsx +2 -2
  31. package/web/components/task/task-tabs.tsx +77 -0
  32. package/web/dist/annotate.js +1 -1
  33. package/web/dist/board.css +7 -5
  34. package/web/dist/board.js +59 -58
  35. package/web/dist/boot.js +1 -1
  36. package/web/dist/notebook.css +2 -2
  37. package/web/dist/notebook.js +33 -32
  38. package/web/dist/popup.css +1 -1
  39. package/web/dist/popup.js +1 -1
  40. package/web/dist/term.js +1 -1
  41. package/web/dist/ui.css +2 -2
  42. package/web/dist/video.js +18 -18
  43. package/web/lib/core/index.ts +1 -0
  44. package/web/lib/core/use-phone.ts +15 -0
  45. package/web/lib/router/route-rules.ts +17 -4
  46. package/web/lib/server/types.ts +1 -0
  47. package/web/lib/task/conversation.ts +56 -0
  48. package/web/lib/task/index.ts +5 -0
  49. package/web/lib/task/task-progress.ts +21 -0
  50. package/web/lib/task/task-tabs.ts +29 -0
  51. package/web/lib/task/tasks.ts +40 -1
  52. package/web/lib/task/use-task-page.ts +123 -0
  53. package/web/lib/task/use-task-run.ts +50 -0
  54. package/web/pages/board/panel.tsx +99 -4
  55. package/web/pages/task-page.tsx +319 -350
  56. package/web/ui/legacy/board.css +5 -3
  57. package/web/ui/theme.css +4 -0
package/cli/activity.ts CHANGED
@@ -12,7 +12,8 @@ const one = (s: unknown, n = 90) => String(s ?? "").replace(/\s+/g, " ").trim().
12
12
  const redact = (s: string) => s.replace(/\b[\w-]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD)[\w-]*=\S+/gi, "[hidden]").replace(/\b(Bearer|Basic)\s+\S+/gi, "$1 [hidden]");
13
13
  const rel = (p: unknown, cwd: string) => {
14
14
  const f = String(p ?? "");
15
- const r = isAbsolute(f) && cwd ? relative(cwd, f) : f;
15
+ // A path inside the project reads the same on every system: forward slashes (Windows gives backslashes).
16
+ const r = isAbsolute(f) && cwd ? relative(cwd, f).replace(/\\/g, "/") : f;
16
17
  return one(r && !r.startsWith("..") ? r : f, 80);
17
18
  };
18
19
 
package/cli/state.ts CHANGED
@@ -2024,6 +2024,20 @@ type Unpushed = { sha: string; at: number; subject: string; files: string[] };
2024
2024
 
2025
2025
  const noRemote = (s: { failed?: boolean }) => (s.failed ? "git did not answer. Try again." : "This project has no git remote.");
2026
2026
 
2027
+ // "Ahead" counts against the local copy of the remote branch, which only a fetch moves: a push made
2028
+ // another way (a URL, another clone, GitHub's web UI) would read "Not pushed yet" until then. So each
2029
+ // status starts a quiet fetch in the background, at most once a minute per folder; the next read sees it.
2030
+ const FETCH_MS = 60_000;
2031
+ const fetched = new Map<string, number>();
2032
+ function fetchSoon(dir: string, remote: string) {
2033
+ const now = Date.now();
2034
+ if (now - (fetched.get(dir) ?? 0) < FETCH_MS) return;
2035
+ fetched.set(dir, now);
2036
+ // BatchMode: a key with a passphrase fails quietly instead of popping an askpass window every minute.
2037
+ const env = { ...gitOpts().env, GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes" };
2038
+ try { Bun.spawn(["git", "-C", dir, "fetch", "-q", "--no-tags", remote], { ...gitOpts(), env, stdout: "ignore", stderr: "ignore" }); } catch {}
2039
+ }
2040
+
2027
2041
  // A project the board can commit for: a git work tree with somewhere to push.
2028
2042
  export function gitStatus(projectDir: string): GitStatus {
2029
2043
  // Only git's own answer (exit 128) means no repo: a killed or missing git says nothing about the folder.
@@ -2031,6 +2045,7 @@ export function gitStatus(projectDir: string): GitStatus {
2031
2045
  if (!inside.ok) return (inside as { code?: number | null }).code === 128 ? { repo: false } : { repo: false, failed: true };
2032
2046
  const remote = git(projectDir, "remote").out.split("\n")[0] ?? "";
2033
2047
  if (!remote) return { repo: false };
2048
+ fetchSoon(projectDir, remote);
2034
2049
  // Every untracked file on its own line: a new directory is never committed whole.
2035
2050
  const st = git(projectDir, "status", "--porcelain", "--untracked-files=all").out;
2036
2051
  // No upstream yet means nothing of this branch is on the remote: any commit is ahead.
@@ -45,10 +45,26 @@ export function allowedActions(state:string,task:T.Task,hooks?:Hooks) {
45
45
  abandon:live||task.status==='stopping',archive:true,delete:!task.runIds.length&&!task.activeRun,
46
46
  start:task.status==='draft'&&!task.activeRun&&!task.currentResult&&!!task.project};
47
47
  }
48
+ // The agents that worked on a task: one per tool across its runs, in the order first used. The run that is live says whether
49
+ // its agent is working or stopped, the rest are done. A task whose runs name no agent shows none.
50
+ const AGENT_NAMES:Record<string,string>={claude:'Claude',codex:'Codex',gemini:'Gemini',agy:'Antigravity',opencode:'OpenCode',cursor:'Cursor'};
51
+ // A run's agent is written once at its start, so it is read once per run, not on every poll of the task list.
52
+ const runAgents=new Map<string,string>();
53
+ const agentOf=(state:string,id:string)=>{const k=state+'\0'+id,c=runAgents.get(k);if(c)return c;const a=parse(join(state,'runs',id,'state.json'))?.agent;if(typeof a==='string'&&a){runAgents.set(k,a);return a;}return '';};
54
+ export function taskAgents(state:string,task:T.Task,live:boolean,alive:boolean) {
55
+ const out=new Map<string,{agent:string;name:string;state:'working'|'stopped'|'done';current:boolean}>();
56
+ for(const id of task.runIds){
57
+ const agent=agentOf(state,id);if(!agent)continue;
58
+ const current=live&&id===task.activeRun,was=out.get(agent);
59
+ out.set(agent,{agent,name:AGENT_NAMES[agent]??agent,state:current?(alive?'working':'stopped'):was&&was.state!=='done'?was.state:'done',current:current||!!was?.current});
60
+ }
61
+ return [...out.values()];
62
+ }
48
63
  export function taskView(state:string,task:T.Task,hooks?:Hooks) {
49
64
  const p=T.taskProjection(task);
50
65
  const run=runState(state,task), finished=run&&(['done','abandoned'].includes(run.stage)||run.healed);
51
- return {...task,actions:allowedActions(state,task,hooks),runStage:run&&!finished?String(run.stage??''):undefined,...(hooks?.asking?{agentAsking:!!(agentKey(state,task,hooks)&&hooks.asking(agentKey(state,task,hooks)!))}:{}),...(hooks?{agentAlive:!!(agentKey(state,task,hooks)&&hooks.alive(agentKey(state,task,hooks)!))}:{}),activeRun:finished&&['ready','accepted'].includes(task.status)?null:task.activeRun,projectName:task.project?.split(/[\\/]/).pop()??'Choose a project',dir:state,updatedAt:task.updated,attention:{category:p.filter,reason:p.reason,action:p.action},statusLabel:p.label,decision:!task.project?{id:'project',kind:'project',text:'Choose a named project for your saved goal.'}:task.pendingDecision,messages:task.events,runs:task.runIds,currentResultId:task.currentResult,acceptedResultId:task.acceptedResult};
66
+ const key=agentKey(state,task,hooks);
67
+ return {...task,agents:taskAgents(state,task,!!run&&!finished,!!(key&&hooks?.alive(key))),actions:allowedActions(state,task,hooks),runStage:run&&!finished?String(run.stage??''):undefined,...(hooks?.asking?{agentAsking:!!(agentKey(state,task,hooks)&&hooks.asking(agentKey(state,task,hooks)!))}:{}),...(hooks?{agentAlive:!!(agentKey(state,task,hooks)&&hooks.alive(agentKey(state,task,hooks)!))}:{}),activeRun:finished&&['ready','accepted'].includes(task.status)?null:task.activeRun,projectName:task.project?.split(/[\\/]/).pop()??'Choose a project',dir:state,updatedAt:task.updated,attention:{category:p.filter,reason:p.reason,action:p.action},statusLabel:p.label,decision:!task.project?{id:'project',kind:'project',text:'Choose a named project for your saved goal.'}:task.pendingDecision,messages:task.events,runs:task.runIds,currentResultId:task.currentResult,acceptedResultId:task.acceptedResult};
52
68
  }
53
69
  export function taskList(states:string[],hooks?:Hooks) {
54
70
  const tasks=states.flatMap(state=>T.listTasks(state).filter(t=>!t.archived).map(t=>taskView(state,reconcile(state,t,hooks),hooks)));
@@ -255,11 +271,12 @@ export function taskEvent(state:string,id:string,runId:string,event:any,operatio
255
271
  let preserving=false;
256
272
  try { return T.mutateTask(state,id,{revision:task.revision,opId:operationId},t=>{
257
273
  const run=runState(state,t);if(!run||run.task_id!==id)throw new T.TaskError('Run task identity does not match');
274
+ const agent=typeof run.agent==='string'?run.agent:undefined;
258
275
  if(event.type==='ack'){T.acknowledgeLaunch(t,String(event.launchId),runId,t.launch?.pty);}
259
- else if(event.type==='reply'){T.addEvent(t,'assistant','reply',String(event.text??''));}
276
+ else if(event.type==='reply'){T.addEvent(t,'assistant','reply',String(event.text??''),undefined,agent);}
260
277
  else if(event.type==='question'||event.type==='proposal'){
261
278
  if(!event.text?.trim())throw new T.TaskError('Question/proposal text is required',400);
262
- t.pendingDecision={id:randomUUID(),kind:event.type,text:String(event.text),run:runId,iteration:run.iteration??0,result:t.currentResult,...(event.details?{details:String(event.details)}:{}),...(Array.isArray(event.options)?{options:event.options.map(String)}:{})};t.status='waiting';t.safe=true;T.addEvent(t,'assistant',event.type,event.text);
279
+ t.pendingDecision={id:randomUUID(),kind:event.type,text:String(event.text),run:runId,iteration:run.iteration??0,result:t.currentResult,...(event.details?{details:String(event.details)}:{}),...(Array.isArray(event.options)?{options:event.options.map(String)}:{})};t.status='waiting';t.safe=true;T.addEvent(t,'assistant',event.type,event.text,undefined,agent);
263
280
  if(t.launch)t.launch.phase='acknowledged';
264
281
  if(event.type==='proposal')put(join(state,'runs',runId,'state.json'),{...run,awaiting:'approvals.plan',task_policy:{requirePlanConfirmation:true},task_confirmed:null});
265
282
  }else if(event.type==='approved'){
@@ -274,7 +291,7 @@ export function taskEvent(state:string,id:string,runId:string,event:any,operatio
274
291
  t.pendingDecision=null;t.safe=true;t.status='working';T.addEvent(t,'user','message',text+' (in the agent terminal)');
275
292
  }else if(event.type==='work'){
276
293
  if(run.task_policy?.requirePlanConfirmation&&!run.task_confirmed)throw new T.TaskError('Plan approval is required before the build');
277
- t.safe=false;t.status='working';T.addEvent(t,'assistant','work',String(event.text??'Working on the task'));
294
+ t.safe=false;t.status='working';T.addEvent(t,'assistant','work',String(event.text??'Working on the task'),undefined,agent);
278
295
  }else if(event.type==='receipt'){T.acknowledgeInputs(t,event.inputIds??[],event.outcome==='failed'?'failed':'applied',event.error);}
279
296
  else if(event.type==='boundary'){T.safeBoundary(t,runId,String(event.text??'Work reached a safe boundary'));}
280
297
  else if(event.type==='result'){
@@ -283,8 +300,8 @@ export function taskEvent(state:string,id:string,runId:string,event:any,operatio
283
300
  preserving=true;const result=R.publishResult(state,id,{...event,runId,iteration:run.iteration??0,roots:[dirname(state),...(typeof run.worktree==='string'?[run.worktree]:[])],id:stableUuid(`${id}:${runId}:${operationId}`)});
284
301
  preserving=false;
285
302
  // A result that lands while the task is stopping is saved, but the stop stands.
286
- if(['stopping','interrupted'].includes(t.status)){t.currentResult=result.id;t.acceptedResult=null;T.addEvent(t,'assistant','result',String(event.summary??event.title??'Result ready'));return;}
287
- t.currentResult=result.id;t.acceptedResult=null;t.status='ready';t.safe=true;t.pendingDecision=null;t.queuePaused=false;t.error=undefined;if(t.launch)t.launch.phase='acknowledged';T.addEvent(t,'assistant','result',String(event.summary??event.title??'Result ready'));
303
+ if(['stopping','interrupted'].includes(t.status)){t.currentResult=result.id;t.acceptedResult=null;T.addEvent(t,'assistant','result',String(event.summary??event.title??'Result ready'),undefined,agent);return;}
304
+ t.currentResult=result.id;t.acceptedResult=null;t.status='ready';t.safe=true;t.pendingDecision=null;t.queuePaused=false;t.error=undefined;if(t.launch)t.launch.phase='acknowledged';T.addEvent(t,'assistant','result',String(event.summary??event.title??'Result ready'),undefined,agent);
288
305
  }else throw new T.TaskError('Unknown task event',400);
289
306
  }); } catch (error) {
290
307
  if(event.type==='result'){
package/cli/tasks.ts CHANGED
@@ -6,7 +6,7 @@ import { randomUUID, createHash } from "node:crypto";
6
6
 
7
7
  export type InputState = "received" | "queued" | "dispatched" | "applied" | "failed";
8
8
  export type TaskInput = { id: string; text: string; intent: "change" | "answer" | "status"; at: number; state: InputState; baseResult: string | null; baseRun: string | null; error?: string };
9
- export type TaskEvent = { id: string; at: number; role: "user" | "assistant" | "system"; type: string; text: string; inputIds?: string[] };
9
+ export type TaskEvent = { id: string; at: number; role: "user" | "assistant" | "system"; type: string; text: string; inputIds?: string[]; agent?: string };
10
10
  export type TaskDecision = { id: string; kind: "question" | "proposal" | "rebase"; text: string; run: string | null; iteration: number; result: string | null; options?: string[]; summary?: string; details?: string; runRevision?: number };
11
11
  export type TaskLaunch = { id: string; run: string | null; inputIds: string[]; phase: "intent" | "started" | "acknowledged" | "interrupted"; at: number; pty?: string };
12
12
  export type Task = {
@@ -128,8 +128,9 @@ export function transferDraft(state: string, id: string, destination: string, pr
128
128
  return target;
129
129
  });
130
130
  }
131
- export function addEvent(task: Task, role: TaskEvent["role"], type: string, text: string, inputIds?: string[]) {
132
- task.events.push({ id: randomUUID(), at: Date.now(), role, type, text, ...(inputIds ? { inputIds } : {}) });
131
+ // `agent` names the tool that wrote an assistant message (the run's own agent), so the page can show who said what.
132
+ export function addEvent(task: Task, role: TaskEvent["role"], type: string, text: string, inputIds?: string[], agent?: string) {
133
+ task.events.push({ id: randomUUID(), at: Date.now(), role, type, text, ...(inputIds ? { inputIds } : {}), ...(agent ? { agent } : {}) });
133
134
  }
134
135
  export function receiveInput(task: Task, input: { id: string; text: string; intent?: TaskInput["intent"]; baseResult: string | null; baseRun?: string | null }): TaskInput {
135
136
  const existing = task.inputs.find((i) => i.id === input.id); if (existing) return existing;
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "version": "1.88.0",
4
+ "highlights": [
5
+ {
6
+ "title": "A cleaner task page",
7
+ "text": "A task now opens on the tab that needs you: Plan while it waits for your approval, Result once the agent has built something. The tab shows why with a mark, and the approval card has its own colour only while it waits."
8
+ },
9
+ {
10
+ "title": "See which agent is on a task",
11
+ "text": "The conversation shows the agent working now, with Resume or Stop beside it. Each message carries its agent's name and mark, and a line marks the moment one agent hands over to another."
12
+ },
13
+ {
14
+ "title": "A panel that looks like the run workspace",
15
+ "text": "The task's right panel has the run panel's layout: the task as a picker, a thin progress bar, an icon strip down the edge, a collapse button, and quiet Archive and Abandon under the message box."
16
+ },
17
+ {
18
+ "title": "Tasks on your phone",
19
+ "text": "The bottom bar says Tasks instead of Runs. A task opens as a chat, with the approval card above the message box and the result as a card you open full screen."
20
+ }
21
+ ],
22
+ "fixes": [
23
+ "A push made outside the board (by another clone or on GitHub) no longer keeps saying \"Not pushed yet\"; the board checks quietly in the background.",
24
+ "A task shows your own words as its title instead of \"# Request\", and the detailed plan is easier to read.",
25
+ "The Plan ready line leaves the conversation once you have answered it."
26
+ ]
27
+ },
2
28
  {
3
29
  "version": "1.87.4",
4
30
  "highlights": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.87.4",
3
+ "version": "1.88.1",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,14 +4,23 @@ import type { PlanQuestion } from "@lib/decision";
4
4
  import { need, toast } from "@lib/core";
5
5
  import { APPROVAL } from "@lib/run";
6
6
  import { dirName, type TaskDecision, type TaskPageData } from "@lib/task";
7
- import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@web/ui";
7
+ import {
8
+ Button,
9
+ DropdownMenu,
10
+ DropdownMenuContent,
11
+ DropdownMenuItem,
12
+ DropdownMenuSeparator,
13
+ DropdownMenuTrigger,
14
+ } from "@web/ui";
8
15
  import { Field, Picker } from "@components/shared";
16
+ import { PlanText } from "./plan-text.tsx";
9
17
  import { InlineForm } from "./inline-form.tsx";
10
18
  import { PlanAnswersForm } from "./plan-answers-form.tsx";
11
19
  import { ReviseForm } from "./revise-form.tsx";
12
20
  import { TaskReplyForm } from "./task-reply-form.tsx";
13
21
 
14
- const box = "mb-3 rounded-sm border border-[color:color-mix(in_srgb,var(--warn)_50%,var(--line))] p-3";
22
+ // What waits on the person: a neutral card with an amber edge, the same amber as the Plan tab's dot.
23
+ const box = "mb-3 rounded-lg border border-warning/55 bg-card p-4";
15
24
  type Choice = { projectDir: string } | { name: string };
16
25
  // What the agent is waiting on, with its one way forward. One component for both places that ask: the task page
17
26
  // draws it as sections (say which project the task belongs to, approve a plan, pick an answer), and the run panel's
@@ -44,6 +53,7 @@ type StripProps = {
44
53
  questions: PlanQuestion[] | null; // the plan's questions; null when the plan has some the board cannot read
45
54
  sourceControl: boolean; // git work is left on a finished run: point at the Source control tab
46
55
  actions: RunActions;
56
+ framed?: boolean; // in the run workspace: what waits on the person is the amber card, as on the task page
47
57
  };
48
58
  type SectionProps = {
49
59
  layout?: "section";
@@ -54,6 +64,8 @@ type SectionProps = {
54
64
  onApprove: (decisionId: string) => void;
55
65
  onAnswer: (text: string) => void;
56
66
  onProject: (choice: Choice) => void;
67
+ onAsk?: () => void; // Ask for changes: the page takes the person to its message box
68
+ onDetails?: (text: string) => void; // a phone opens the detailed plan in a sheet; without it the plan opens in place
57
69
  };
58
70
  // A question's options as buttons: one press is the answer.
59
71
  function QuestionOptions({
@@ -71,7 +83,17 @@ function QuestionOptions({
71
83
  </Button>
72
84
  ));
73
85
  }
74
- function TaskSections({ decision, needsProject, projects = [], pending, onApprove, onAnswer, onProject }: SectionProps) {
86
+ function TaskSections({
87
+ decision,
88
+ needsProject,
89
+ projects = [],
90
+ pending,
91
+ onApprove,
92
+ onAnswer,
93
+ onProject,
94
+ onAsk,
95
+ onDetails,
96
+ }: SectionProps) {
75
97
  const [dir, setDir] = useState("");
76
98
  const d = decision && decision.kind !== "project" ? decision : null;
77
99
  return (
@@ -109,33 +131,44 @@ function TaskSections({ decision, needsProject, projects = [], pending, onApprov
109
131
  )}
110
132
  {d && (
111
133
  <section className={box} aria-labelledby="decision-title">
112
- <h3 id="decision-title" className="mb-2 text-base font-semibold">
134
+ <p className="flex items-center gap-1.5 text-sm text-warning">
135
+ <i className="size-2 rounded-full bg-warning" />
136
+ {d.kind === "proposal" ? "Waiting for your approval" : "Waiting for your answer"}
137
+ </p>
138
+ <h3 id="decision-title" className="mb-1 mt-1.5 text-[17px] font-semibold leading-snug">
113
139
  {d.kind === "proposal" ? "Approve the plan" : "Your answer is needed"}
114
140
  </h3>
115
- <p className="my-2 whitespace-pre-wrap break-words">{d.summary || d.text}</p>
116
- {d.summary && d.text !== d.summary && <p className="my-2 whitespace-pre-wrap break-words">{d.text}</p>}
117
- {d.details && (
118
- <details>
119
- <summary className="cursor-pointer">Detailed plan</summary>
120
- <pre className="max-h-[520px] overflow-auto whitespace-pre-wrap break-words bg-background p-3 font-mono text-sm">
121
- {d.details}
122
- </pre>
123
- </details>
124
- )}
125
- {d.kind === "proposal" ? (
126
- <>
127
- <Button variant="primary" className="mt-2" disabled={pending} onClick={() => onApprove(d.id)}>
141
+ <p className="my-1.5 whitespace-pre-wrap break-words">{d.summary || d.text}</p>
142
+ {d.summary && d.text !== d.summary && <p className="my-1.5 whitespace-pre-wrap break-words">{d.text}</p>}
143
+ {d.kind === "proposal" && (
144
+ <div className="mt-3 flex flex-wrap items-center gap-2">
145
+ <Button variant="primary" disabled={pending} onClick={() => onApprove(d.id)}>
128
146
  Approve plan
129
147
  </Button>
130
- <p className="my-2 text-muted-foreground">
131
- The build starts after you approve this plan. Ask for changes below if needed.
132
- </p>
133
- </>
134
- ) : d.options?.length ? (
135
- <div className="flex flex-wrap gap-1.5">
148
+ {onAsk && <Button onClick={onAsk}>Ask for changes</Button>}
149
+ {!onDetails && <span className="text-sm text-muted-foreground">The build starts after you approve.</span>}
150
+ </div>
151
+ )}
152
+ {d.kind !== "proposal" && !!d.options?.length && (
153
+ <div className="mt-2 flex flex-wrap gap-1.5">
136
154
  <QuestionOptions options={d.options} onPick={onAnswer} />
137
155
  </div>
138
- ) : null}
156
+ )}
157
+ {d.details &&
158
+ (onDetails ? (
159
+ <button
160
+ type="button"
161
+ className="mt-2 py-1 text-sm text-muted-foreground"
162
+ onClick={() => onDetails(d.details!)}
163
+ >
164
+ Detailed plan ›
165
+ </button>
166
+ ) : (
167
+ <details className="mt-3 text-muted-foreground">
168
+ <summary className="cursor-pointer text-sm">Detailed plan</summary>
169
+ <PlanText text={d.details} className="mt-3 text-foreground" />
170
+ </details>
171
+ ))}
139
172
  </section>
140
173
  )}
141
174
  </>
@@ -143,7 +176,7 @@ function TaskSections({ decision, needsProject, projects = [], pending, onApprov
143
176
  }
144
177
 
145
178
  // The run panel's footer: its note, the buttons that fit the run's state, and the forms they open in its place.
146
- function RunStrip({ card: c, answered, questions, sourceControl, actions: a }: Omit<StripProps, "layout">) {
179
+ function RunStrip({ card: c, answered, questions, sourceControl, actions: a, framed }: Omit<StripProps, "layout">) {
147
180
  const [mode, setMode] = useState<"idle" | "revise" | "answers" | "reply">("idle"),
148
181
  [busy, setBusy] = useState("");
149
182
  // A pressed button waits for the run to move on; a new state or question starts afresh.
@@ -409,9 +442,27 @@ function RunStrip({ card: c, answered, questions, sourceControl, actions: a }: O
409
442
  ) : null}
410
443
  </>
411
444
  );
445
+ // What waits on the person is the same neutral card with an amber edge as on the task page.
446
+ const waits =
447
+ !!framed &&
448
+ c.kind !== "idea" &&
449
+ !c.archived &&
450
+ !q &&
451
+ (c.status === "waiting" || c.awaiting === "findings") &&
452
+ !!APPROVAL[c.awaiting ?? ""];
412
453
  return (
413
454
  <>
414
- {body}
455
+ {waits ? (
456
+ <div className="flex basis-full flex-wrap items-center gap-2 rounded-lg border border-warning/55 bg-card p-3">
457
+ <span className="flex basis-full items-center gap-1.5 text-sm text-warning">
458
+ <i className="size-2 rounded-full bg-warning" />
459
+ Waiting for your approval
460
+ </span>
461
+ {body}
462
+ </div>
463
+ ) : (
464
+ body
465
+ )}
415
466
  {c.stage === "explore" && (
416
467
  <Button data-a="skip-explore" disabled={busy === "skip"} onClick={() => void go("skip", a.skipExplore)}>
417
468
  Skip Explore
@@ -1 +1,2 @@
1
1
  export * from "./decision-bar.tsx";
2
+ export * from "./plan-text.tsx";
@@ -0,0 +1,17 @@
1
+ import { Markdown } from "@components/markdown";
2
+ import { cn } from "@lib/core";
3
+
4
+ // An agent's plan as plain, tidy reading: headings are small grey labels, lists have room between their items.
5
+ // The plan is the agent's own text, so this styles what is there and does not rearrange it. The board's old `section h2`
6
+ // rule (a sticky bar) would catch a plan inside a card, so the first rule line sets that back.
7
+ export function PlanText({ text, className }: { text: string; className?: string }) {
8
+ return (
9
+ <Markdown
10
+ text={text}
11
+ className={cn(
12
+ "text-base leading-relaxed [&_:is(h1,h2)]:static [&_:is(h1,h2)]:block [&_:is(h1,h2)]:h-auto [&_:is(h1,h2)]:bg-transparent [&_:is(h1,h2)]:p-0 [&_:is(h1,h2)]:shadow-none [&_h1]:mb-1 [&_h1]:mt-4 [&_h1]:text-sm [&_h1]:font-medium [&_h1]:text-muted-foreground [&_h2]:mb-1 [&_h2]:mt-4 [&_h2]:text-sm [&_h2]:font-medium [&_h2]:text-muted-foreground [&_h3]:mb-1 [&_h3]:mt-3 [&_h3]:text-sm [&_h3]:font-medium [&_h3]:text-muted-foreground [&_li]:my-1.5 [&_ol]:pl-5 [&_ul]:pl-5",
13
+ className,
14
+ )}
15
+ />
16
+ );
17
+ }
@@ -72,7 +72,12 @@ function AgentCards() {
72
72
  </button>
73
73
  </div>
74
74
  {groups.length ? (
75
- <div className={cn(groups.length > 2 ? "grid-rows-2" : "grid-rows-1", "-mx-4 grid snap-x snap-proximity auto-cols-[min(44vw,164px)] grid-flow-col gap-2 overflow-x-auto overscroll-x-contain scroll-px-4 px-4 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden")}>
75
+ <div
76
+ className={cn(
77
+ groups.length > 2 ? "grid-rows-2" : "grid-rows-1",
78
+ "-mx-4 grid snap-x snap-proximity auto-cols-[min(44vw,164px)] grid-flow-col gap-2 overflow-x-auto overscroll-x-contain scroll-px-4 px-4 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
79
+ )}
80
+ >
76
81
  {groups.map((g) => {
77
82
  const { a, st } = g.rows[0]!;
78
83
  return (
@@ -92,11 +97,7 @@ function AgentCards() {
92
97
  {g.rows.length > 1 ? g.rows.length + " agents" : WORD[st]}
93
98
  <span className="ml-auto flex gap-1">
94
99
  {g.rows.map((r, i) => (
95
- <Icon
96
- key={i}
97
- name={agentMark(r.a.agent || "")}
98
- className="size-4 flex-none"
99
- />
100
+ <Icon key={i} name={agentMark(r.a.agent || "")} className="size-4 flex-none" />
100
101
  ))}
101
102
  </span>
102
103
  </span>
@@ -117,6 +118,9 @@ function AgentCards() {
117
118
  function RunRow({ c, now }: { c: any; now: number }) {
118
119
  const data = useRailData(),
119
120
  name = projName(c.state, data.projects);
121
+ // The agent on this row: the one working a task now, else the card's own.
122
+ const task = taskForCard(c, data.tasks),
123
+ mark = task?.agents?.find((a) => a.current)?.agent ?? task?.agents?.at(-1)?.agent ?? c.agent;
120
124
  const open = (e: MouseEvent) => {
121
125
  if (!plain(e)) return;
122
126
  e.preventDefault();
@@ -149,6 +153,7 @@ function RunRow({ c, now }: { c: any; now: number }) {
149
153
  {subline(c, now, taskForCard(c, data.tasks))}
150
154
  </code>
151
155
  </span>
156
+ {mark && <Icon name={agentMark(mark)} className="mt-1 size-4 flex-none" />}
152
157
  </a>
153
158
  );
154
159
  }
@@ -237,12 +242,12 @@ function Home() {
237
242
  )}
238
243
  {!net.tailscale && <Note>Tailscale is off on this computer: other devices do not show.</Note>}
239
244
  </Section>
240
- <Section title="Runs">
245
+ <Section title="Tasks">
241
246
  <div className="flex flex-col">
242
247
  {recentRuns(data.cards).map((c, i) => (
243
248
  <RunRow key={i + c.state + rowKey(c)} c={c} now={now} />
244
249
  ))}
245
- {!recentRuns(data.cards).length && <Note>No runs yet.</Note>}
250
+ {!recentRuns(data.cards).length && <Note>No tasks yet.</Note>}
246
251
  </div>
247
252
  </Section>
248
253
  {usage.length > 0 && (
@@ -263,7 +268,7 @@ function Group({ title, cards, shut }: { title: string; cards: any[]; shut?: boo
263
268
  if (!cards.length) return null;
264
269
  return (
265
270
  <details open={!shut} className="group mt-1.5">
266
- <summary className="flex cursor-pointer list-none items-center gap-2 px-1 pt-3 pb-1.5 text-[11px] font-semibold tracking-[.06em] text-muted-foreground uppercase [&::-webkit-details-marker]:hidden">
271
+ <summary className="flex cursor-pointer list-none items-center gap-2 px-1 pt-3 pb-1.5 text-[13px] font-medium text-muted-foreground [&::-webkit-details-marker]:hidden">
267
272
  <span className="size-1.5 -rotate-45 border-r-[1.5px] border-b-[1.5px] border-current motion-safe:transition-transform group-open:rotate-45" />
268
273
  {title}
269
274
  <span>{cards.length}</span>
@@ -284,14 +289,14 @@ function Runs() {
284
289
  <>
285
290
  <Button asChild>
286
291
  <a href="?view=tasks" onClick={(e) => plain(e) && (e.preventDefault(), host.go("tasks", true))}>
287
- All tasks and results
292
+ Search and filter tasks
288
293
  </a>
289
294
  </Button>
290
- <Group title="Waiting on you" cards={g.wait} />
291
- <Group title="Active" cards={g.active} />
292
- <Group title="Tasks" cards={g.tasks} />
295
+ <Group title="Needs you" cards={g.wait} />
296
+ <Group title="Working" cards={g.active} />
297
+ <Group title="Not started" cards={g.tasks} />
293
298
  <Group title="Done" cards={g.done} shut />
294
- {g.none && <Note>No runs yet.</Note>}
299
+ {g.none && <Note>No tasks yet.</Note>}
295
300
  </>
296
301
  );
297
302
  }
@@ -23,6 +23,7 @@ import {
23
23
  import { useRoute } from "@lib/router";
24
24
  import { closeAllHome, homeTabs, showHomeWs, useHomeWs } from "@lib/home";
25
25
  import { useRailData, useServer } from "@lib/server";
26
+ import { taskTitle } from "@lib/task";
26
27
  import { AgentChips } from "./agent-chips.tsx";
27
28
 
28
29
  // The Projects list of the side menu. Rows keep the board's own markup and classes (.pgrp, .proj, .wsc, .row.ws ...):
@@ -87,7 +88,7 @@ function TaskLink({ t }: { t: RailTask }) {
87
88
  >
88
89
  <span className={`si ${taskDot(t)}`} />
89
90
  <span>
90
- <b>{t.title}</b>
91
+ <b>{taskTitle(t)}</b>
91
92
  <small>{t.attention.reason}</small>
92
93
  </span>
93
94
  </a>
@@ -96,7 +97,19 @@ function TaskLink({ t }: { t: RailTask }) {
96
97
 
97
98
  // Home is your own space outside any project, so its one row says that instead of the folder's name.
98
99
  export const HOME_TIP = "Your own space: chats and agent terminals that are not in a project. Add a project with +.";
99
- function WsRow({ dir, r, now, current, home }: { dir: string; r: RailRow; now: number; current: boolean; home?: boolean }) {
100
+ function WsRow({
101
+ dir,
102
+ r,
103
+ now,
104
+ current,
105
+ home,
106
+ }: {
107
+ dir: string;
108
+ r: RailRow;
109
+ now: number;
110
+ current: boolean;
111
+ home?: boolean;
112
+ }) {
100
113
  return (
101
114
  <>
102
115
  <div className="wsr wsc">
@@ -144,7 +157,10 @@ function WsRow({ dir, r, now, current, home }: { dir: string; r: RailRow; now: n
144
157
  // × closes them all. Open or closed, the window speaks for itself; it opens with Ctrl+Alt+A or a Home row's +.
145
158
  function HomeTerms() {
146
159
  const h = useHomeWs(),
147
- n = homeTabs(useServer((x) => x.shells), h.ending).length;
160
+ n = homeTabs(
161
+ useServer((x) => x.shells),
162
+ h.ending,
163
+ ).length;
148
164
  if (!n || h.st !== "min") return null;
149
165
  return (
150
166
  <span className="hterm">
@@ -245,7 +261,14 @@ function Group({
245
261
  {!g.shut && (
246
262
  <div className="pws">
247
263
  {g.rows.map((r) => (
248
- <WsRow key={r.path} dir={g.dir} r={r} now={now} current={cur.dir === g.dir && cur.ws === r.path} home={g.home && r.w.main} />
264
+ <WsRow
265
+ key={r.path}
266
+ dir={g.dir}
267
+ r={r}
268
+ now={now}
269
+ current={cur.dir === g.dir && cur.ws === r.path}
270
+ home={g.home && r.w.main}
271
+ />
249
272
  ))}
250
273
  </div>
251
274
  )}
@@ -1,6 +1,13 @@
1
1
  import { Fragment, type ReactNode } from "react";
2
2
  import { cn } from "@lib/core";
3
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Icon } from "@web/ui";
3
+ import {
4
+ DropdownMenu,
5
+ DropdownMenuContent,
6
+ DropdownMenuItem,
7
+ DropdownMenuSeparator,
8
+ DropdownMenuTrigger,
9
+ Icon,
10
+ } from "@web/ui";
4
11
  import { IconButton } from "./icon-button.tsx";
5
12
 
6
13
  export type ActionItem = {
@@ -11,6 +18,7 @@ export type ActionItem = {
11
18
  icon?: string; // leads the row (the board's sprite)
12
19
  before?: boolean; // a separator above this row
13
20
  count?: number; // trails the row
21
+ hint?: string; // a second, quiet line under the label
14
22
  onSelect?: () => void;
15
23
  };
16
24
  // A "…" menu: an icon button, optional information above, then actions. Selecting an action closes it; a
@@ -20,6 +28,7 @@ export function ActionMenu({
20
28
  icon = "more",
21
29
  items,
22
30
  children,
31
+ footer,
23
32
  className,
24
33
  triggerClassName,
25
34
  size,
@@ -28,6 +37,7 @@ export function ActionMenu({
28
37
  icon?: string;
29
38
  items: ActionItem[];
30
39
  children?: ReactNode;
40
+ footer?: ReactNode; // quiet details under the actions
31
41
  className?: string;
32
42
  triggerClassName?: string;
33
43
  size?: "sm"; // the compact trigger a card carries
@@ -54,7 +64,12 @@ export function ActionMenu({
54
64
  {items.map((it) =>
55
65
  it.href ? (
56
66
  <DropdownMenuItem key={it.id} asChild>
57
- <a href={it.href}>{it.label}</a>
67
+ <a href={it.href}>
68
+ <span className="flex min-w-0 flex-col">
69
+ {it.label}
70
+ {it.hint && <small className="truncate font-mono text-xs text-muted-foreground">{it.hint}</small>}
71
+ </span>
72
+ </a>
58
73
  </DropdownMenuItem>
59
74
  ) : (
60
75
  <Fragment key={it.id}>
@@ -70,6 +85,8 @@ export function ActionMenu({
70
85
  </Fragment>
71
86
  ),
72
87
  )}
88
+ {footer && (items.length > 0 || children) && <DropdownMenuSeparator />}
89
+ {footer}
73
90
  </DropdownMenuContent>
74
91
  </DropdownMenu>
75
92
  );
@@ -16,3 +16,4 @@ export * from "./project-mark.tsx";
16
16
  export * from "./segmented.tsx";
17
17
  export * from "./state-dot.tsx";
18
18
  export * from "./status-mark.tsx";
19
+ export * from "./panel-frame.tsx";