@spunto/design-system 0.80.0 → 0.82.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.80.0",
3
+ "version": "0.82.0",
4
4
  "description": "Spunto's shared design system — green tokens (conservatory + sprout), color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,12 +17,18 @@
17
17
  // side of the archive, a finished row gets its own Archive button on hover, and « Select » turns
18
18
  // the rows into checkboxes for doing it in bulk. Only `done`/`failed` rows can be put away — a live
19
19
  // conversation is dropped, not archived — so live rows cannot be picked.
20
+ //
21
+ // On hold (optional): the same kind of switch for the tasks in review someone set aside for later
22
+ // (their machine parked), and a row in review gets its own « On hold » / « Back to review » button
23
+ // on hover. Still `in-review` — the list just keeps them out of the way until asked.
20
24
 
21
25
  import { useState, type ReactNode } from "react"
22
26
  import {
23
27
  ArchiveIcon,
24
28
  ArchiveRestoreIcon,
25
29
  CheckSquareIcon,
30
+ PauseCircleIcon,
31
+ Undo2Icon,
26
32
  ChevronRightIcon,
27
33
  Loader2Icon,
28
34
  MessagesSquareIcon,
@@ -31,6 +37,7 @@ import {
31
37
  } from "lucide-react"
32
38
 
33
39
  import { cn, formatRelativeTime } from "../../utils"
40
+ import { TaskFamilyMark } from "./family"
34
41
  import { Button } from "../button"
35
42
  import { TASK_STATE_ORDER, TaskStateIcon, taskPendingActionConfig, taskStateStyle, useElapsed } from "./task-state"
36
43
  import type { TaskConversation, TaskState } from "./types"
@@ -75,6 +82,16 @@ export interface TaskConversationListProps<T extends TaskConversation = TaskConv
75
82
  /** An archive change is in flight: the selection's buttons wait for it. */
76
83
  archiving?: boolean
77
84
 
85
+ /** Whether the « On hold » view is listed. Without `onHeldChange` there is no « On hold » switch. */
86
+ held?: boolean
87
+ onHeldChange?: (held: boolean) => void
88
+ /** How many conversations on hold match the search — drawn on the switch. */
89
+ heldCount?: number
90
+ /** Put a row in review on hold (`true`) or back to review (`false`) — its own button, on hover. Omitted → no button. */
91
+ onHoldChange?: (task: T, hold: boolean) => void
92
+ /** Which rows in review offer that button — e.g. only the reader's own. @default every one */
93
+ canHold?: (task: T) => boolean
94
+
78
95
  /** @default "Agents" */
79
96
  title?: string
80
97
  /** Next to the title — typically the "New" task button. */
@@ -130,6 +147,7 @@ function ConversationRow({
130
147
  picking,
131
148
  picked,
132
149
  onArchiveChange,
150
+ onHoldChange,
133
151
  }: {
134
152
  task: TaskConversation
135
153
  selected: boolean
@@ -139,6 +157,8 @@ function ConversationRow({
139
157
  picked?: boolean
140
158
  /** A finished row's own Archive/Unarchive button, on hover. */
141
159
  onArchiveChange?: (archived: boolean) => void
160
+ /** A row in review's own On hold / Back to review button, on hover. */
161
+ onHoldChange?: (hold: boolean) => void
142
162
  }) {
143
163
  const tone = task.pendingAction ? taskPendingActionConfig[task.pendingAction].textClass : taskStateStyle(task.state).textClass
144
164
  const pickable = isFinished(task) && !task.pendingAction
@@ -168,6 +188,7 @@ function ConversationRow({
168
188
  <span className={cn("min-w-0 flex-1 truncate text-xs pointer-coarse:text-sm", selected ? "font-semibold" : "font-medium")}>
169
189
  {task.title}
170
190
  </span>
191
+ <TaskFamilyMark task={task} />
171
192
  {/* When it last moved — replaced, while something is in flight, by how long it has been. */}
172
193
  <RowTime task={task} />
173
194
  {/* Touch has no hover to say "this leads somewhere", so the affordance is drawn. */}
@@ -182,7 +203,15 @@ function ConversationRow({
182
203
  )}
183
204
  </button>
184
205
  )
185
- if (picking || !onArchiveChange || !pickable) return row
206
+ const held = Boolean(task.onHoldAt)
207
+ const hover =
208
+ picking ? null
209
+ : onArchiveChange && pickable ? { label: archived ? "Unarchive" : "Archive", icon: archived ? ArchiveRestoreIcon : ArchiveIcon, run: () => onArchiveChange(!archived) }
210
+ : onHoldChange && task.state === "in-review" && !task.pendingAction
211
+ ? { label: held ? "Back to review" : "On hold", icon: held ? Undo2Icon : PauseCircleIcon, run: () => onHoldChange(!held) }
212
+ : null
213
+ if (!hover) return row
214
+ const Icon = hover.icon
186
215
  return (
187
216
  <div className="group relative">
188
217
  {row}
@@ -190,17 +219,36 @@ function ConversationRow({
190
219
  on hover, and absent on touch — which has no hover, and has « Select » instead. */}
191
220
  <button
192
221
  type="button"
193
- onClick={() => onArchiveChange(!archived)}
194
- aria-label={archived ? "Unarchive" : "Archive"}
195
- title={archived ? "Unarchive" : "Archive"}
222
+ onClick={hover.run}
223
+ aria-label={hover.label}
224
+ title={hover.label}
196
225
  className="absolute top-1.5 right-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100 hover:text-foreground focus-visible:opacity-100 pointer-coarse:hidden"
197
226
  >
198
- {archived ? <ArchiveRestoreIcon className="h-3.5 w-3.5" /> : <ArchiveIcon className="h-3.5 w-3.5" />}
227
+ <Icon className="h-3.5 w-3.5" />
199
228
  </button>
200
229
  </div>
201
230
  )
202
231
  }
203
232
 
233
+ /** A switch at the end of the chips that flips the list to another view (« On hold », « Archived »). */
234
+ function ViewSwitch({ label, icon: Icon, count, active, onClick }: { label: string; icon: typeof ArchiveIcon; count?: number; active: boolean; onClick: () => void }) {
235
+ return (
236
+ <button
237
+ type="button"
238
+ onClick={onClick}
239
+ aria-pressed={active}
240
+ className={cn(
241
+ "flex shrink-0 touch-manipulation items-center gap-1 rounded-full border border-dashed px-2.5 py-1 text-[11px] font-medium transition-colors active:bg-muted pointer-coarse:px-3 pointer-coarse:py-1.5 pointer-coarse:text-[12px]",
242
+ active ? "border-solid border-foreground/30 bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/60",
243
+ )}
244
+ >
245
+ <Icon className="h-3 w-3" />
246
+ {label}
247
+ {count !== undefined && <span className={cn("tabular-nums", !active && "text-muted-foreground/70")}>{count}</span>}
248
+ </button>
249
+ )
250
+ }
251
+
204
252
  export function TaskConversationList<T extends TaskConversation>({
205
253
  tasks,
206
254
  total,
@@ -220,6 +268,11 @@ export function TaskConversationList<T extends TaskConversation>({
220
268
  onArchiveChange,
221
269
  onArchiveAllFinished,
222
270
  archiving = false,
271
+ held = false,
272
+ onHeldChange,
273
+ heldCount,
274
+ onHoldChange,
275
+ canHold,
223
276
  title = "Agents",
224
277
  action,
225
278
  className,
@@ -299,23 +352,29 @@ export function TaskConversationList<T extends TaskConversation>({
299
352
  onClick={() => toggle(state)}
300
353
  />
301
354
  ))}
355
+ {onHeldChange && (
356
+ <ViewSwitch
357
+ label="On hold"
358
+ icon={PauseCircleIcon}
359
+ count={heldCount}
360
+ active={held}
361
+ onClick={() => {
362
+ stopPicking()
363
+ onHeldChange(!held)
364
+ }}
365
+ />
366
+ )}
302
367
  {onArchivedChange && (
303
- <button
304
- type="button"
368
+ <ViewSwitch
369
+ label="Archived"
370
+ icon={ArchiveIcon}
371
+ count={archivedCount}
372
+ active={archived}
305
373
  onClick={() => {
306
374
  stopPicking()
307
375
  onArchivedChange(!archived)
308
376
  }}
309
- aria-pressed={archived}
310
- className={cn(
311
- "flex shrink-0 touch-manipulation items-center gap-1 rounded-full border border-dashed px-2.5 py-1 text-[11px] font-medium transition-colors active:bg-muted pointer-coarse:px-3 pointer-coarse:py-1.5 pointer-coarse:text-[12px]",
312
- archived ? "border-solid border-foreground/30 bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/60",
313
- )}
314
- >
315
- <ArchiveIcon className="h-3 w-3" />
316
- Archived
317
- {archivedCount !== undefined && <span className={cn("tabular-nums", !archived && "text-muted-foreground/70")}>{archivedCount}</span>}
318
- </button>
377
+ />
319
378
  )}
320
379
  </div>
321
380
 
@@ -374,9 +433,11 @@ export function TaskConversationList<T extends TaskConversation>({
374
433
  <p className="px-3 py-4 text-xs leading-relaxed text-muted-foreground">
375
434
  {query || states.length > 0
376
435
  ? "No conversation matches that filter."
377
- : archived
378
- ? "No archived conversation. Archive a finished one to put it here."
379
- : "No delegated work yet. Open a project and start a task."}
436
+ : held
437
+ ? "Nothing on hold. Put a task in review on hold to park its machine and keep it out of the way until you come back to it."
438
+ : archived
439
+ ? "No archived conversation. Archive a finished one to put it here."
440
+ : "No delegated work yet. Open a project and start a task."}
380
441
  </p>
381
442
  )}
382
443
 
@@ -395,6 +456,7 @@ export function TaskConversationList<T extends TaskConversation>({
395
456
  picking={picking}
396
457
  picked={picked.has(task.id)}
397
458
  onArchiveChange={onArchiveChange && ((value) => onArchiveChange([task], value))}
459
+ onHoldChange={onHoldChange && (canHold?.(task) ?? true) ? (value) => onHoldChange(task, value) : undefined}
398
460
  />
399
461
  ))}
400
462
  </div>
@@ -0,0 +1,30 @@
1
+ "use client"
2
+
3
+ // Where a task sits in its family (docs/tasks.md § « Sous-tâches »), as a list row says it: a
4
+ // sub-task is marked as one, a task that delegated says how many. Small and muted — the title is
5
+ // the subject, this is a coordinate, like the project under it.
6
+
7
+ import { CornerDownRightIcon, ListTreeIcon } from "lucide-react"
8
+
9
+ import { cn } from "../../utils"
10
+ import type { TaskItem } from "./types"
11
+
12
+ export function TaskFamilyMark({ task, className }: { task: Pick<TaskItem, "parentTaskId" | "subtaskCount">; className?: string }) {
13
+ const count = task.subtaskCount ?? 0
14
+ if (!task.parentTaskId && count === 0) return null
15
+ return (
16
+ <span className={cn("flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground", className)}>
17
+ {task.parentTaskId && (
18
+ <span title="Sub-task — delegated by another task" aria-label="Sub-task">
19
+ <CornerDownRightIcon className="h-3 w-3" />
20
+ </span>
21
+ )}
22
+ {count > 0 && (
23
+ <span className="flex items-center gap-0.5 tabular-nums" title={`${count} sub-task${count === 1 ? "" : "s"}`}>
24
+ <ListTreeIcon className="h-3 w-3" />
25
+ {count}
26
+ </span>
27
+ )}
28
+ </span>
29
+ )
30
+ }
@@ -27,6 +27,7 @@ export type { TaskStateBadgeProps, TaskStateIconProps, TaskStateStyle } from "./
27
27
  export { TaskList } from "./task-list"
28
28
  export type { TaskListProps } from "./task-list"
29
29
  export { TaskConversationList, TaskConversationPlaceholder } from "./conversation-list"
30
+ export { TaskFamilyMark } from "./family"
30
31
  export type { TaskConversationListProps } from "./conversation-list"
31
32
  export { TaskWorkerChip, WorkerTaskChip, WorkerTaskHistory, indexTasksByWorker } from "./worker-link"
32
33
  export type { WorkerTask } from "./worker-link"
@@ -37,7 +38,7 @@ export type { NewTaskComposerProps } from "./new-task-composer"
37
38
  export { clearTaskDraft, readTaskDraft, useTaskDraft } from "./prompt-draft"
38
39
 
39
40
  // ── The cockpit ─────────────────────────────────────────────────────────────────────────────
40
- export { TaskArchiveButton, TaskArchivedBadge, TaskCockpit, TaskPanelTabs } from "./task-cockpit"
41
+ export { TaskArchiveButton, TaskArchivedBadge, TaskCockpit, TaskHoldButton, TaskOnHoldBadge, TaskPanelTabs } from "./task-cockpit"
41
42
  export type { TaskCockpitProps, TaskCockpitView } from "./task-cockpit"
42
43
  export { TaskCockpitMobile, useVisualViewport } from "./task-cockpit-mobile"
43
44
  export type { TaskCockpitMobileProps, VisualViewportState } from "./task-cockpit-mobile"
@@ -121,6 +122,7 @@ export type {
121
122
  TaskPatchHunk,
122
123
  TaskPatchLine,
123
124
  TaskPendingAction,
125
+ TaskRelative,
124
126
  TaskRepoDiff,
125
127
  TaskSharedData,
126
128
  TaskSharedFile,
@@ -18,7 +18,7 @@
18
18
 
19
19
  import { useEffect, useState, type ReactNode } from "react"
20
20
  import { createPortal } from "react-dom"
21
- import { ArchiveIcon, ArchiveRestoreIcon, CheckCircle2Icon, ChevronLeftIcon, Loader2Icon, SlidersHorizontalIcon, XIcon } from "lucide-react"
21
+ import { ArchiveIcon, ArchiveRestoreIcon, CheckCircle2Icon, ChevronLeftIcon, Loader2Icon, PauseCircleIcon, SlidersHorizontalIcon, Undo2Icon, XIcon } from "lucide-react"
22
22
 
23
23
  import { cn, formatRelativeTime } from "../../utils"
24
24
  import { useOverlayContainer } from "../spunto-provider"
@@ -127,6 +127,12 @@ function NavStatus({ task, action, since }: { task: TaskItem; action: TaskPendin
127
127
  Archived
128
128
  </>
129
129
  )}
130
+ {task.state === "in-review" && task.onHoldAt && (
131
+ <>
132
+ <span aria-hidden>·</span>
133
+ On hold
134
+ </>
135
+ )}
130
136
  </p>
131
137
  )
132
138
  }
@@ -174,6 +180,8 @@ export function TaskCockpitMobile({
174
180
  titleUpdating,
175
181
  onArchiveChange,
176
182
  archiveUpdating,
183
+ onHoldChange,
184
+ holdUpdating,
177
185
  backHref,
178
186
  onBack,
179
187
  render,
@@ -240,6 +248,24 @@ export function TaskCockpitMobile({
240
248
  {task && <NavStatus task={task} action={action} since={since} />}
241
249
  </div>
242
250
 
251
+ {task?.state === "in-review" && onHoldChange && (
252
+ <button
253
+ type="button"
254
+ disabled={action !== null || holdUpdating}
255
+ onClick={() => onHoldChange(!task.onHoldAt)}
256
+ aria-label={task.onHoldAt ? "Back to review" : "On hold"}
257
+ className={NAV_BUTTON}
258
+ >
259
+ {holdUpdating ? (
260
+ <Loader2Icon className="h-5 w-5 animate-spin" />
261
+ ) : task.onHoldAt ? (
262
+ <Undo2Icon className="h-5 w-5" />
263
+ ) : (
264
+ <PauseCircleIcon className="h-5 w-5" />
265
+ )}
266
+ </button>
267
+ )}
268
+
243
269
  {task?.state === "in-review" && onAccept && (
244
270
  <button
245
271
  type="button"
@@ -24,7 +24,7 @@
24
24
  // mount `TaskCockpitMobile` instead: a different screen, not this one squeezed.
25
25
 
26
26
  import { useState, type ReactNode } from "react"
27
- import { ArchiveIcon, ArchiveRestoreIcon, ArrowLeftIcon, CheckCircle2Icon, Loader2Icon, XCircleIcon } from "lucide-react"
27
+ import { ArchiveIcon, ArchiveRestoreIcon, ArrowLeftIcon, CheckCircle2Icon, Loader2Icon, PauseCircleIcon, Undo2Icon, XCircleIcon } from "lucide-react"
28
28
 
29
29
  import { cn } from "../../utils"
30
30
  import { Button } from "../button"
@@ -65,6 +65,14 @@ export interface TaskCockpitProps {
65
65
  onArchiveChange?: (archived: boolean) => void
66
66
  /** The archive toggle is in flight. */
67
67
  archiveUpdating?: boolean
68
+ /**
69
+ * Set a task in review aside for later (`true` — the app parks its machine), or bring it back to
70
+ * « In review » (`false`); `task.onHoldAt` says which is offered. Only drawn on an `in-review`
71
+ * task. Omitted → no button.
72
+ */
73
+ onHoldChange?: (hold: boolean) => void
74
+ /** The hold toggle is in flight. */
75
+ holdUpdating?: boolean
68
76
 
69
77
  /** Back arrow in the top bar. Omitted when the cockpit sits next to its own list. */
70
78
  backHref?: string
@@ -182,6 +190,8 @@ export function TaskCockpit({
182
190
  titleUpdating,
183
191
  onArchiveChange,
184
192
  archiveUpdating,
193
+ onHoldChange,
194
+ holdUpdating,
185
195
  backHref,
186
196
  render,
187
197
  view: viewProp,
@@ -238,14 +248,18 @@ export function TaskCockpit({
238
248
  </h1>
239
249
  <TaskStateBadge state={task.state} machine={task.machine} machinePaused={task.machinePaused} pendingAction={action} pendingSince={since} />
240
250
  {task.userArchivedAt && <TaskArchivedBadge />}
251
+ {task.state === "in-review" && task.onHoldAt && <TaskOnHoldBadge />}
241
252
  </div>
242
253
 
243
254
  {!live && onArchiveChange && (
244
255
  <TaskArchiveButton archived={Boolean(task.userArchivedAt)} updating={archiveUpdating} disabled={busy} onArchiveChange={onArchiveChange} />
245
256
  )}
246
257
 
247
- {live && (onAccept || onDrop) && (
258
+ {live && (onAccept || onDrop || onHoldChange) && (
248
259
  <div className="flex shrink-0 items-center gap-2">
260
+ {task.state === "in-review" && onHoldChange && (
261
+ <TaskHoldButton onHold={Boolean(task.onHoldAt)} updating={holdUpdating} disabled={busy} onHoldChange={onHoldChange} />
262
+ )}
249
263
  {task.state === "in-review" && onAccept && (
250
264
  <Button size="sm" disabled={busy} onClick={onAccept} className="h-8 gap-1.5 px-3 text-xs">
251
265
  {action === "accepting" ? <Loader2Icon className="h-3.5 w-3.5 animate-spin" /> : <CheckCircle2Icon className="h-3.5 w-3.5" />}
@@ -307,6 +321,54 @@ export function TaskArchivedBadge({ className }: { className?: string }) {
307
321
  )
308
322
  }
309
323
 
324
+ /** "On hold", next to the state of a task in review someone set aside for later. */
325
+ export function TaskOnHoldBadge({ className }: { className?: string }) {
326
+ return (
327
+ <span
328
+ className={cn(
329
+ "inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-muted/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
330
+ className,
331
+ )}
332
+ >
333
+ <PauseCircleIcon className="h-3 w-3" />
334
+ On hold
335
+ </span>
336
+ )
337
+ }
338
+
339
+ /**
340
+ * On hold / Back to review, on a task in review. A ghost button like Archive: it files the task
341
+ * (and parks its machine), it does not judge the work.
342
+ */
343
+ export function TaskHoldButton({
344
+ onHold,
345
+ updating = false,
346
+ disabled = false,
347
+ onHoldChange,
348
+ className,
349
+ }: {
350
+ onHold: boolean
351
+ updating?: boolean
352
+ disabled?: boolean
353
+ onHoldChange: (hold: boolean) => void
354
+ className?: string
355
+ }) {
356
+ const Icon = updating ? Loader2Icon : onHold ? Undo2Icon : PauseCircleIcon
357
+ return (
358
+ <Button
359
+ variant="ghost"
360
+ size="sm"
361
+ disabled={disabled || updating}
362
+ onClick={() => onHoldChange(!onHold)}
363
+ title={onHold ? "Back to « In review »" : "Park its machine and set it aside until you come back to it"}
364
+ className={cn("h-8 shrink-0 gap-1.5 px-3 text-xs text-muted-foreground", className)}
365
+ >
366
+ <Icon className={cn("h-3.5 w-3.5", updating && "animate-spin")} />
367
+ {onHold ? "Back to review" : "On hold"}
368
+ </Button>
369
+ )
370
+ }
371
+
310
372
  /**
311
373
  * Archive / Unarchive, on a finished task. Quiet on purpose — a ghost button: it files the
312
374
  * conversation, it does nothing to the work, so it must not look like Accept or Drop.
@@ -18,7 +18,7 @@
18
18
  // opens it in every conversation (`useBlockOpen`, this browser's `localStorage`).
19
19
 
20
20
  import { createContext, useContext, useState, useSyncExternalStore, type ReactNode } from "react"
21
- import { CheckIcon, ChevronRightIcon, CopyIcon, ExternalLinkIcon, GitBranchIcon, Loader2Icon, SlidersHorizontalIcon, XCircleIcon } from "lucide-react"
21
+ import { CheckIcon, ChevronRightIcon, CopyIcon, CornerLeftUpIcon, ExternalLinkIcon, GitBranchIcon, Loader2Icon, SlidersHorizontalIcon, XCircleIcon } from "lucide-react"
22
22
 
23
23
  import { cn, formatRelativeTime } from "../../utils"
24
24
  import { Avatar, AvatarFallback, AvatarImage } from "../avatar"
@@ -26,8 +26,9 @@ import { TaskCommandLog } from "./command-log"
26
26
  import { TaskSessionUsage } from "./session-usage"
27
27
  import { TaskSharedFiles, TaskSharedLinks } from "./shared"
28
28
  import { TaskAppTileContent } from "./app-tiles"
29
- import { isLiveTaskState, taskSpan } from "./task-state"
30
- import type { AttachmentUrl, TaskAppTile, TaskAppTileAction, TaskAppTileItem, TaskCommand, TaskItem, TaskPendingAction, TaskSessionUsageData, TaskSharedData } from "./types"
29
+ import { isLiveTaskState, taskSpan, TaskStateIcon, taskStateStyle, taskPendingActionConfig, taskStateConfig, TASK_STATE_ORDER } from "./task-state"
30
+ import type { LinkRender } from "../workers/worker-card"
31
+ import type { AttachmentUrl, TaskAppTile, TaskAppTileAction, TaskAppTileItem, TaskCommand, TaskItem, TaskPendingAction, TaskRelative, TaskSessionUsageData, TaskSharedData } from "./types"
31
32
 
32
33
  /** Set by `TaskCockpitMobile` around its sheet, so Drop can close it. @internal */
33
34
  export const TaskDetailsSheetContext = createContext<{ close: () => void } | null>(null)
@@ -75,6 +76,15 @@ export interface TaskDetailsProps {
75
76
  /** `sheet` only: the Drop button at the bottom, on a live task. */
76
77
  onDrop?: () => void
77
78
  pendingAction?: TaskPendingAction | null
79
+ /** The task that delegated this one — a link back up, among the facts. */
80
+ parent?: TaskRelative | null
81
+ /**
82
+ * The tasks this one delegated (its session through `spunto-tasks`, or a member attaching them):
83
+ * the orchestrator's view of its threads, right under the machine. Omitted or empty = no block.
84
+ */
85
+ subtasks?: TaskRelative[] | null
86
+ /** How the parent and sub-task links are drawn — the app's router link. A plain `<a>` otherwise. */
87
+ render?: { link?: LinkRender }
78
88
  className?: string
79
89
  }
80
90
 
@@ -228,6 +238,35 @@ function CustomizeLink({ tile, href }: { tile: TaskAppTile; href?: (tile: TaskAp
228
238
  )
229
239
  }
230
240
 
241
+ /** « 2 running · 1 in review » — where a family stands, in the cockpit's state order. */
242
+ function familyHint(subtasks: TaskRelative[]): string {
243
+ return TASK_STATE_ORDER.map((state) => [state, subtasks.filter((t) => t.state === state).length] as const)
244
+ .filter(([, n]) => n > 0)
245
+ .map(([state, n]) => `${n} ${taskStateConfig[state].label.toLowerCase()}`)
246
+ .join(" · ")
247
+ }
248
+
249
+ /** One sub-task: its state, its name, a link to its conversation. */
250
+ function SubtaskRow({ task, Link }: { task: TaskRelative; Link: LinkRender }) {
251
+ const tone = task.pendingAction ? taskPendingActionConfig[task.pendingAction].textClass : taskStateStyle(task.state).textClass
252
+ return (
253
+ <Link
254
+ href={task.href}
255
+ className="-mx-2 flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-colors hover:bg-muted/50"
256
+ >
257
+ <span className={cn("shrink-0", tone)}>
258
+ {task.pendingAction ? (
259
+ <Loader2Icon className="h-3 w-3 animate-spin" />
260
+ ) : (
261
+ <TaskStateIcon state={task.state} machine={task.machine} machinePaused={task.machinePaused} />
262
+ )}
263
+ </span>
264
+ <span className="min-w-0 flex-1 truncate">{task.title}</span>
265
+ <span className={cn("shrink-0 text-[10px]", tone)}>{taskStateStyle(task.state).label}</span>
266
+ </Link>
267
+ )
268
+ }
269
+
231
270
  /** Anything to draw in a block — a tile with only `links` has none: its links go to the header. */
232
271
  function hasBody(tile: TaskAppTile): boolean {
233
272
  return !!(tile.meters?.length || tile.facts?.length || tile.items?.length || tile.lists?.length)
@@ -249,9 +288,13 @@ export function TaskDetails({
249
288
  protocol = "none",
250
289
  onDrop,
251
290
  pendingAction = task.pendingAction ?? null,
291
+ parent,
292
+ subtasks,
293
+ render,
252
294
  className,
253
295
  }: TaskDetailsProps) {
254
296
  const sheet = useContext(TaskDetailsSheetContext)
297
+ const Link: LinkRender = render?.link ?? (({ href, className, children }) => <a href={href} className={className}>{children}</a>)
255
298
  const meta = task.meta && Object.keys(task.meta).length > 0 ? task.meta : null
256
299
  // The task's own links, then those its org's apps add (Spunto IDE: « Open IDE »), once each.
257
300
  const allLinks = [...(task.links ?? []), ...(appTiles ?? []).flatMap((tile) => tile.links ?? [])].filter(
@@ -262,7 +305,7 @@ export function TaskDetails({
262
305
  const ran = task.completedAt ? taskSpan(task.startedAt ?? task.createdAt, task.completedAt) : null
263
306
  // `baseBranch: null` is the project's default — saying so ("project default") on every task of a
264
307
  // project with no branches was a fact with nothing in it. Only an explicit base is worth a line.
265
- const facts = !!links || !!task.branch || !!task.baseBranch || !!task.outcomeUrl
308
+ const facts = !!links || !!task.branch || !!task.baseBranch || !!task.outcomeUrl || !!parent
266
309
 
267
310
  return (
268
311
  <div className={className}>
@@ -303,7 +346,19 @@ export function TaskDetails({
303
346
 
304
347
  {facts && (
305
348
  <div className={cn("grid grid-cols-2 gap-3", variant === "sidebar" && "mt-3")}>
306
- {/* First: where the work came from is what a reader arriving from a list asks before anything else. */}
349
+ {/* Where the work came from is what a reader arriving from a list asks before anything
350
+ else — and a sub-task came from its parent first. */}
351
+ {parent && (
352
+ <div className="col-span-2">
353
+ <Fact label="Delegated by task">
354
+ <Link href={parent.href} className="flex min-w-0 items-center gap-1.5 text-primary hover:underline">
355
+ <CornerLeftUpIcon className="h-3 w-3 shrink-0" />
356
+ <span className="truncate">{parent.title}</span>
357
+ <span className={cn("shrink-0 text-[10px]", taskStateStyle(parent.state).textClass)}>{taskStateStyle(parent.state).label}</span>
358
+ </Link>
359
+ </Fact>
360
+ </div>
361
+ )}
307
362
  {links && (
308
363
  <div className="col-span-2">
309
364
  <Fact label={links.length === 1 ? "Link" : "Links"}>
@@ -361,6 +416,18 @@ export function TaskDetails({
361
416
  </Block>
362
417
  )}
363
418
 
419
+ {/* The orchestrator's view: what it delegated and where each thread stands — open, since a
420
+ parent waiting on its sub-tasks is read for exactly this. */}
421
+ {subtasks && subtasks.length > 0 && (
422
+ <Block id="subtasks" variant={variant} title="Sub-tasks" hint={familyHint(subtasks)} pinned>
423
+ <div className="space-y-0.5">
424
+ {subtasks.map((t) => (
425
+ <SubtaskRow key={t.id} task={t} Link={Link} />
426
+ ))}
427
+ </div>
428
+ </Block>
429
+ )}
430
+
364
431
  {usage && (
365
432
  <Block id="session" variant={variant} title="Session">
366
433
  <TaskSessionUsage usage={usage} />
@@ -13,6 +13,7 @@
13
13
 
14
14
  import { useState, type ReactNode } from "react"
15
15
  import { CheckCircle2Icon, GitBranchIcon, GitPullRequestIcon, Loader2Icon, SparklesIcon, XCircleIcon } from "lucide-react"
16
+ import { TaskFamilyMark } from "./family"
16
17
 
17
18
  import { cn, formatRelativeTime } from "../../utils"
18
19
  import type { LinkRender } from "../workers/worker-card"
@@ -95,6 +96,7 @@ function TaskRow<T extends TaskItem>({
95
96
  <Link href={href} className="truncate text-sm font-medium underline-offset-2 hover:underline">
96
97
  {task.title}
97
98
  </Link>
99
+ <TaskFamilyMark task={task} />
98
100
  <TaskStateBadge state={task.state} machine={task.machine} machinePaused={task.machinePaused} pendingAction={pendingAction} pendingSince={task.pendingSince} />
99
101
 
100
102
  {/* Actions live on the row, not behind a menu: reviewing is the moment the panel exists
@@ -528,6 +528,34 @@ describe("TaskDetails", () => {
528
528
  expect(screen.getByText("release/2.0")).toBeTruthy()
529
529
  })
530
530
 
531
+ it("links back up to the parent, and lists the sub-tasks open, right under the machine", () => {
532
+ window.localStorage.clear()
533
+ const { container } = render(
534
+ <TaskDetails
535
+ task={task()}
536
+ machine={<p>machine panel</p>}
537
+ parent={{ id: "p", title: "Orchestrate the migration", state: "running", href: "/t/p" }}
538
+ subtasks={[
539
+ { id: "a", title: "Migrate the API", state: "in-review", href: "/t/a" },
540
+ { id: "b", title: "Migrate the dashboard", state: "running", href: "/t/b" },
541
+ { id: "c", title: "Migrate the docs", state: "running", href: "/t/c" },
542
+ ]}
543
+ commands={[]}
544
+ />,
545
+ )
546
+ expect(screen.getByText("Orchestrate the migration").closest("a")?.getAttribute("href")).toBe("/t/p")
547
+ const blocks = [...container.querySelectorAll("[data-block]")].map((el) => el.getAttribute("data-block"))
548
+ expect(blocks.slice(0, 2)).toEqual(["machine", "subtasks"])
549
+ expect(screen.getByText("Migrate the dashboard").closest("a")?.getAttribute("href")).toBe("/t/b")
550
+ expect(screen.getByText("2 running · 1 in review")).toBeTruthy()
551
+ })
552
+
553
+ it("draws no family when there is none", () => {
554
+ const { container } = render(<TaskDetails task={task()} subtasks={[]} commands={[]} />)
555
+ expect(container.querySelector('[data-block="subtasks"]')).toBeNull()
556
+ expect(screen.queryByText("Delegated by task")).toBeNull()
557
+ })
558
+
531
559
  it("names the member who delegated the task", () => {
532
560
  render(<TaskDetails task={task()} delegatedBy={{ name: "Ada" }} commands={[]} />)
533
561
  expect(screen.getByText("Ada")).toBeTruthy()
@@ -66,6 +66,23 @@ export interface TaskItem {
66
66
  machinePaused?: boolean
67
67
  /** When a member put this finished task away — it then lives in the « Archived » view. Null = not archived. */
68
68
  userArchivedAt?: string | null
69
+ /** When a member set this task in review aside for later — it then lives in the « On hold » view. Null = not on hold. */
70
+ onHoldAt?: string | null
71
+ /** The task that delegated this one — the API's `parentTaskId`. Null = a task of its own. */
72
+ parentTaskId?: string | null
73
+ /** How many tasks this one delegated — drawn as a count on its row. */
74
+ subtaskCount?: number
75
+ }
76
+
77
+ /** A task of the same family — a parent or a sub-task — as `TaskDetails` links to it. */
78
+ export interface TaskRelative {
79
+ id: string
80
+ title: string
81
+ state: TaskState
82
+ href: string
83
+ machine?: TaskMachineState | null
84
+ machinePaused?: boolean
85
+ pendingAction?: TaskPendingAction | null
69
86
  }
70
87
 
71
88
  /** A row of the org-wide conversation list: a task plus the project it belongs to. */