@cat-factory/app 0.275.0 → 0.276.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.
Files changed (44) hide show
  1. package/README.md +89 -2
  2. package/app/components/board/LaneViewControl.vue +87 -0
  3. package/app/components/board/nodes/BlockNode.vue +24 -10
  4. package/app/components/board/nodes/FrameSwimlanes.vue +139 -0
  5. package/app/components/board/nodes/InitiativeCard.vue +9 -28
  6. package/app/components/board/nodes/LaneGroup.vue +93 -0
  7. package/app/components/board/nodes/LaneTask.vue +66 -0
  8. package/app/components/board/nodes/TaskCard.vue +16 -2
  9. package/app/components/board/nodes/TaskLane.vue +82 -0
  10. package/app/components/layout/BoardToolbar.vue +4 -0
  11. package/app/components/panels/InspectorPanel.vue +15 -2
  12. package/app/components/panels/inspector/TaskStructure.vue +70 -3
  13. package/app/components/settings/WorkspaceSettingsPanel.vue +59 -0
  14. package/app/composables/useBlockDrag.ts +47 -17
  15. package/app/composables/useBlockQueries.ts +27 -24
  16. package/app/composables/useFrameLanes.ts +177 -0
  17. package/app/composables/useTaskExpansion.ts +1 -1
  18. package/app/stores/board/placement.ts +7 -0
  19. package/app/stores/board.spec.ts +119 -14
  20. package/app/stores/laneView.spec.ts +61 -0
  21. package/app/stores/laneView.ts +85 -0
  22. package/app/stores/taskExpansion.spec.ts +1 -1
  23. package/app/stores/taskExpansion.ts +1 -1
  24. package/app/stores/workspaceSettings.ts +4 -0
  25. package/app/utils/framePlacement.ts +9 -4
  26. package/app/utils/laneGeometry.spec.ts +69 -0
  27. package/app/utils/laneGeometry.ts +104 -0
  28. package/app/utils/laneSort.spec.ts +236 -0
  29. package/app/utils/laneSort.ts +306 -0
  30. package/app/utils/swimlanes.spec.ts +259 -0
  31. package/app/utils/swimlanes.ts +355 -0
  32. package/i18n/locales/de.json +78 -3
  33. package/i18n/locales/en.json +78 -3
  34. package/i18n/locales/es.json +78 -3
  35. package/i18n/locales/fr.json +78 -3
  36. package/i18n/locales/he.json +78 -3
  37. package/i18n/locales/it.json +78 -3
  38. package/i18n/locales/ja.json +78 -3
  39. package/i18n/locales/pl.json +78 -3
  40. package/i18n/locales/tr.json +78 -3
  41. package/i18n/locales/uk.json +78 -3
  42. package/package.json +2 -2
  43. package/app/components/board/nodes/DraggableTask.vue +0 -58
  44. package/app/components/board/nodes/ModuleFrame.vue +0 -73
package/README.md CHANGED
@@ -15,6 +15,7 @@ The SPA source lives under `app/` (the Nuxt srcDir).
15
15
  - [What it is](#what-it-is)
16
16
  - [Tech stack](#tech-stack)
17
17
  - [Layout](#layout)
18
+ - [Task swimlanes](#task-swimlanes)
18
19
  - [Roles (engineer / product manager / designer)](#roles-engineer--product-manager--designer)
19
20
  - [Interface modes (basic / advanced)](#interface-modes-basic--advanced)
20
21
  - [Agent tiers (basic / intermediate / advanced)](#agent-tiers-basic--intermediate--advanced)
@@ -240,6 +241,89 @@ surface rather than a toast, and are tracked as G4 in
240
241
 
241
242
  A status → chip map feeding a `<UBadge :color="…">` types its values as `BadgeColor` (`utils/badge.ts`), which is derived from `UBadge`'s own prop type rather than restated as a literal union. Typed `string`, the binding does not compile and the reflex is `as any` at each call site: seven of them had accumulated. That cast also accepts a colour Nuxt UI does not define, which renders as an unstyled badge with nothing failing.
242
243
 
244
+ ## Task swimlanes
245
+
246
+ A service frame lays its tasks out in **status lanes**, not at coordinates. Three lanes a reader
247
+ works in (`not_started`, `in_progress`, `needs_you`) plus a collapsed **Done** strip beneath them.
248
+ The vocabulary, the classification and the Done caps are `app/utils/swimlanes.ts`; the ordering and
249
+ grouping are `app/utils/laneSort.ts`; `composables/useFrameLanes.ts` is the only store-facing half.
250
+
251
+ **A lane is a CLAIM, which is a higher bar than a badge.** A mislabelled badge sits beside the
252
+ truth; a card filed in the wrong lane states something false _and_ hides the card from the column
253
+ its reader was scanning. Three rules follow, and they are what the tests pin:
254
+
255
+ - **The classification is TOTAL.** `BASE_REASON_BY_STATUS` is a `Record<BlockStatus, …>`, so a new
256
+ status fails the build; and a status the TYPE says is impossible while the DATABASE still holds it
257
+ (a retired picklist member on an old row) resolves to `unclassified` → `needs_you`, never to
258
+ `undefined`, which would drop the card out of every lane with nothing left to say it existed.
259
+ - **An imprecise reason beats a wrong lane.** The SPA models only decisions and approvals as global
260
+ per-block selectors; a judge / human-test / visual-confirmation / fork / follow-up / input-gate
261
+ park is reachable only by drilling into a step. But every one of them parks the RUN at
262
+ `status: 'blocked'`, and that coarse marker places the card correctly even when this layer cannot
263
+ name the surface. Such a park reports `parked` — named but imprecise, never demoted to "in flight".
264
+ - **The reason is a separate answer from the lane.** The lane says "look at this"; the reason says
265
+ "what would I do". `failed`, `budget_paused` and `approval` all stop work dead and need three
266
+ unrelated actions, which is why `blocking_reason` is a grouping and why a lane header can name it.
267
+
268
+ **Ordering defaults per lane** (`smart`), because the actionable order genuinely differs by column:
269
+ what can be started now / what has gone quiet / what has waited longest. Two rules bind any new
270
+ comparator: an **unknown timestamp sorts last in BOTH directions** (a run that reported no activity
271
+ is not stale and not fresh, and ranking it as either invents a fact), and **every comparator ends on
272
+ board order**, since these re-run on every live push and an unresolved tie makes the lane shuffle
273
+ itself. `nullsLast` is the single place the first rule lives.
274
+
275
+ **Sizing is decoupled from content** (`utils/laneGeometry.ts`). A lane scrolls; it does not grow. A
276
+ service with 300 open tasks gets the same frame as one with three, which is what the old free layout
277
+ could not do — a busy service grew until it dwarfed its neighbours.
278
+
279
+ Three consumers have to agree about that size, which is why the module exports two FUNCTIONS rather
280
+ than leaving each to do the arithmetic: `frameContentSize` is the frame's floor (read by
281
+ `contentSize`, and by `framePlacement.EMPTY_FRAME_SIZE`, which has to reserve a spot for a frame
282
+ that does not exist yet and so cannot measure it), and `laneBodyHeightIn` is its inverse, handing a
283
+ lane whatever the frame's ACTUAL size leaves it. A dragged border therefore grows the lanes rather
284
+ than leaving dead canvas below them, and a constant restating either answer is exactly what went
285
+ stale before. A frame with no children at all is the one that skips the lanes: it renders one "add
286
+ the first task" panel and is sized for that.
287
+
288
+ **Two preferences, deliberately different scopes.** The sort/group choice is per user, per browser
289
+ (`stores/laneView.ts`, persisted like the interface tier): it is personal and changes several times
290
+ an hour, and making it shared would let one person's triage sweep re-arrange everyone's board. The
291
+ Done lane's two **caps** are per-workspace settings (`doneLaneMaxItems`, `doneLaneRetentionDays`),
292
+ because what the board may show of a service's history is a shared decision. Both caps hide cards
293
+ only, and the lane reports the two drop counts separately: an age drop means "there is older
294
+ history", a cap drop means "there is more from this period".
295
+
296
+ **A task with no `completedAt` is exempt from the age cap**, not treated as ancient. Every block
297
+ merged before that column existed reads that way, and hiding history on the strength of a timestamp
298
+ nobody recorded would be the platform inferring a fact it does not have. The count cap still bounds
299
+ them, so the exemption cannot make the lane unbounded, and `undatedShown` says how many there are.
300
+
301
+ **A FRAME still has coordinates, and they live on its `WorkspaceMount`, not on the block** (one
302
+ shared service sits at a different spot on every board that mounts it), so every frame-returning read
303
+ projects through kernel's `applyMountLayout`. The resize path is where people hit a missed projection,
304
+ because a `size`-only edit is the one frame patch with no other visible effect: the SPA upserts the
305
+ authoritative block the mutation returned and the frame jumps to coordinates no board shows it at.
306
+
307
+ **Dragging a card now only reparents** (`positioned: false` in `useBlockDrag`): between services,
308
+ and into or out of a module via a module group header's drop zone. Which LANE a card is in is not
309
+ something a drop can decide — the lane is derived from state, so dropping a not-started card on
310
+ "In progress" could only lie or silently do nothing. Because that drop target exists only while the
311
+ reader has grouping set to `module`, the inspector carries a **module picker** that does not depend
312
+ on the current grouping; module sub-frames no longer render as boxes, so without it the only route
313
+ into a module would be to change a view preference first.
314
+
315
+ **A move re-stamps the module the task DECLARES**, which is the one thing about that drag that is
316
+ not obvious. A task names its module twice: the block it is parented to, and `moduleName`, which
317
+ exists because the engine only materialises the module block on merge, so a task can name its module
318
+ before anything is its parent. Grouping reads the parent and falls back to the declared name — so a
319
+ card dragged OUT of a module and left still declaring it lands right back in the group it came from.
320
+ `BoardService.reparent` therefore rewrites the name from the destination container, exactly as it
321
+ already rewrote the `type` a task inherits from its frame, and the SPA's optimistic write predicts
322
+ the same answer through the shared `moduleNameInContainer` (`@cat-factory/contracts`) so the card
323
+ does not visibly jump when the response lands. "No module" is the EMPTY STRING on the wire, the way
324
+ every other clearable field spells a clear; `undefined` is dropped by `JSON.stringify` and reaches
325
+ the server as an empty patch.
326
+
243
327
  ## Roles (engineer / product manager / designer)
244
328
 
245
329
  The outermost of the three narrowing axes, and the only one the app **asks about**: on a first-ever
@@ -1004,8 +1088,11 @@ example ships in [`deploy/frontend`](https://github.com/kibertoad/cat-factory/tr
1004
1088
  ## Key UI surfaces
1005
1089
 
1006
1090
  - **Board canvas** (`components/board`): `BoardCanvas` + `nodes/` (`BlockNode`,
1007
- `ModuleFrame`, `TaskCard`), dependency edges, the per-block `AgentFailureCard` /
1008
- `AgentStopButton`, and a deep-zoom `focus/BlockFocusView`. A running task card expands
1091
+ `FrameSwimlanes` / `TaskLane` / `LaneGroup` / `LaneTask`, `TaskCard`), dependency edges,
1092
+ the per-block `AgentFailureCard` /
1093
+ `AgentStopButton`, and a deep-zoom `focus/BlockFocusView`. Tasks are laid out in status
1094
+ lanes rather than at coordinates (see [Task swimlanes](#task-swimlanes)); the board-level
1095
+ order/grouping override is `LaneViewControl` in the toolbar. A running task card expands
1009
1096
  its build pipeline (`TaskPipelineMini`) on hover at any zoom level, and across every
1010
1097
  on-screen card past the `steps` zoom band: the two grants are combined in the
1011
1098
  `taskExpansion` store and driven by `useTaskExpansion`.
@@ -0,0 +1,87 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ LANE_GROUP_KEYS,
4
+ LANE_SORT_KEYS,
5
+ type LaneGroupKey,
6
+ type LaneSortKey,
7
+ } from '~/utils/laneSort'
8
+ import { showOverrideField } from '~/utils/uiMode'
9
+
10
+ /**
11
+ * The board-level override for how every frame's swimlanes are ordered and grouped.
12
+ *
13
+ * It is an OVERRIDE, which is what makes it an advanced-tier affordance: hidden, what remains is
14
+ * exactly the `smart` per-lane order and no grouping — the default it would otherwise have shown.
15
+ * The gate is `showOverrideField` rather than `isAdvanced` alone, because the preference persists
16
+ * per browser: someone who picks "by severity" in advanced mode and then switches to basic must
17
+ * still be able to see and clear it, or the board would be ordered by a rule they cannot find.
18
+ */
19
+ const { t } = useI18n()
20
+ const uiMode = useUiModeStore()
21
+ const laneView = useLaneViewStore()
22
+
23
+ // The DEFAULT values are passed as `undefined` rather than as themselves: `showOverrideField`
24
+ // reveals the control as soon as any value it edits is set, and `smart`/`none` being set is
25
+ // exactly the state where there is nothing to reveal.
26
+ const visible = computed(() =>
27
+ showOverrideField(
28
+ uiMode.isAdvanced,
29
+ laneView.sortKey === 'smart' ? undefined : laneView.sortKey,
30
+ laneView.groupKey === 'none' ? undefined : laneView.groupKey,
31
+ ),
32
+ )
33
+
34
+ const sortItems = computed(() =>
35
+ LANE_SORT_KEYS.map((key) => ({
36
+ label: t(`board.lanes.sort.${key}`),
37
+ icon: laneView.sortKey === key ? 'i-lucide-check' : undefined,
38
+ onSelect: () => laneView.setSortKey(key as LaneSortKey),
39
+ })),
40
+ )
41
+
42
+ const groupItems = computed(() =>
43
+ LANE_GROUP_KEYS.map((key) => ({
44
+ label: t(`board.lanes.group.${key}`),
45
+ icon: laneView.groupKey === key ? 'i-lucide-check' : undefined,
46
+ onSelect: () => laneView.setGroupKey(key as LaneGroupKey),
47
+ })),
48
+ )
49
+
50
+ /**
51
+ * One menu, two labelled sections, plus a reset. Grouped rather than two adjacent buttons because
52
+ * the two choices are read together — "the newest bugs, by module" is one intent — and because the
53
+ * toolbar has no room for two more controls at small widths.
54
+ */
55
+ const items = computed(() => [
56
+ [{ label: t('board.lanes.sort.heading'), type: 'label' as const }],
57
+ sortItems.value,
58
+ [{ label: t('board.lanes.group.heading'), type: 'label' as const }],
59
+ groupItems.value,
60
+ ...(laneView.hasOverride
61
+ ? [
62
+ [
63
+ {
64
+ label: t('board.lanes.resetView'),
65
+ icon: 'i-lucide-rotate-ccw',
66
+ onSelect: () => laneView.reset(),
67
+ },
68
+ ],
69
+ ]
70
+ : []),
71
+ ])
72
+ </script>
73
+
74
+ <template>
75
+ <UDropdownMenu v-if="visible" :items="items">
76
+ <UButton
77
+ color="neutral"
78
+ :variant="laneView.hasOverride ? 'soft' : 'ghost'"
79
+ size="sm"
80
+ icon="i-lucide-arrow-down-up"
81
+ :title="t('board.lanes.viewTitle')"
82
+ data-testid="lane-view-control"
83
+ >
84
+ <span class="hidden sm:inline">{{ t('board.lanes.viewTitle') }}</span>
85
+ </UButton>
86
+ </UDropdownMenu>
87
+ </template>
@@ -2,15 +2,15 @@
2
2
  import type { Block, BlockStatus } from '~/types/domain'
3
3
  import { blockTypeMeta, STATUS_META } from '~/utils/catalog'
4
4
  import DecisionBadge from './DecisionBadge.vue'
5
- import DraggableTask from './DraggableTask.vue'
5
+ import FrameSwimlanes from './FrameSwimlanes.vue'
6
6
  import InitiativeCard from './InitiativeCard.vue'
7
- import ModuleFrame from './ModuleFrame.vue'
8
7
  import ResizeGrips from './ResizeGrips.vue'
9
8
  import AgentFailureCard from '~/components/board/AgentFailureCard.vue'
10
9
  import AgentStopButton from '~/components/board/AgentStopButton.vue'
11
10
  import { useBlockDrag } from '~/composables/useBlockDrag'
12
11
  import { useFrameStacking } from '~/composables/useFrameStacking'
13
12
  import { useViewport } from '~/composables/useViewport'
13
+ import { laneBodyHeightIn } from '~/utils/laneGeometry'
14
14
 
15
15
  // Vue Flow passes the node's `id` and `data` as props to custom node components.
16
16
  // Only frames are rendered as board nodes; their tasks live inside the card.
@@ -43,7 +43,9 @@ const isShared = computed(() => services.isSharedFrame(props.id))
43
43
  const typeMeta = computed(() => (block.value ? blockTypeMeta(block.value.type) : null))
44
44
 
45
45
  // ---- this service's children (tasks + modules) -----------------------------
46
- const directTasks = computed(() => board.tasksOf(props.id))
46
+ // No `directTasks` here: the swimlanes take EVERY task under the frame, its modules' included,
47
+ // because a module is a grouping inside a lane now rather than a box of its own. `modules` is
48
+ // still read for the composition line's module count.
47
49
  const modules = computed(() => board.modulesOf(props.id))
48
50
  const initiativeBlocks = computed(() => board.initiativesOf(props.id))
49
51
  const allTasks = computed(() => board.allTasksUnder(props.id))
@@ -54,6 +56,9 @@ const hasTasks = computed(
54
56
  )
55
57
  const prTasks = computed(() => allTasks.value.filter((t) => t.status === 'pr_ready').length)
56
58
  const canvas = computed(() => board.containerSize(props.id))
59
+ // A lane's scroll viewport fills whatever the frame's actual size leaves it, so dragging the
60
+ // frame's border gives the reader more of the lane rather than dead canvas beneath it.
61
+ const laneBodyHeight = computed(() => laneBodyHeightIn(canvas.value, initiativeBlocks.value.length))
57
62
 
58
63
  // Frame status is derived from its tasks — services never reach "done".
59
64
  const frameStatus = computed<BlockStatus>(() => board.frameStatus(props.id))
@@ -273,7 +278,7 @@ const ITEM_ICON: Record<string, string> = {
273
278
  />
274
279
  </div>
275
280
 
276
- <!-- ===================== The service card: 2D canvas of tasks + modules =====================
281
+ <!-- ============= The service card: the initiative band + task swimlanes =============
277
282
  There is no chip or compact variant: a service is always expanded to its task canvas, at
278
283
  every zoom level, so panning is a fixed layout and zooming has no expand/collapse
279
284
  transition to snap on. The two gated-off branches that used to sit here (a far-zoom chip
@@ -501,15 +506,24 @@ const ITEM_ICON: Record<string, string> = {
501
506
  </div>
502
507
  </div>
503
508
 
504
- <!-- the 2D drop zone: modules and loose tasks live here, draggable -->
509
+ <!-- The frame's canvas. Tasks are laid out in status swimlanes rather than at
510
+ coordinates, so this is a fixed-size viewport (each lane scrolls) instead of the 2D
511
+ free-drag surface it used to be. `data-drop-zone` stays on the outer box so a drop
512
+ in the padding between lanes still resolves to this service rather than falling
513
+ through to nothing; each lane body carries the same zone for drops inside it. -->
505
514
  <div
506
515
  :data-drop-zone="block.id"
507
- class="nodrag relative rounded-xl bg-slate-950/40"
508
- :style="{ width: canvas.w + 'px', height: canvas.h + 'px' }"
516
+ class="nodrag relative rounded-xl bg-slate-950/40 p-2"
517
+ :style="{ width: canvas.w + 'px', minHeight: canvas.h + 'px' }"
509
518
  >
510
- <ModuleFrame v-for="m in modules" :key="m.id" :module-id="m.id" />
511
- <InitiativeCard v-for="i in initiativeBlocks" :key="i.id" :block-id="i.id" />
512
- <DraggableTask v-for="t in directTasks" :key="t.id" :task-id="t.id" />
519
+ <!-- Initiatives sit in a wrapping band above the lanes: they are containers of work,
520
+ not units of it, so they belong in no status lane. -->
521
+ <div v-if="initiativeBlocks.length" class="mb-2 flex flex-wrap gap-2">
522
+ <InitiativeCard v-for="i in initiativeBlocks" :key="i.id" :block-id="i.id" />
523
+ </div>
524
+
525
+ <FrameSwimlanes v-if="hasTasks" :frame-id="block.id" :lane-body-height="laneBodyHeight" />
526
+
513
527
  <button
514
528
  v-if="!hasTasks && access.canWriteBoard.value"
515
529
  type="button"
@@ -0,0 +1,139 @@
1
+ <script setup lang="ts">
2
+ import LaneGroup from './LaneGroup.vue'
3
+ import TaskLane from './TaskLane.vue'
4
+ import { useFrameLanes } from '~/composables/useFrameLanes'
5
+ import { LANE_GEOMETRY } from '~/utils/laneGeometry'
6
+ import { LANE_META } from '~/utils/swimlanes'
7
+
8
+ /**
9
+ * A service frame's tasks, laid out in status lanes.
10
+ *
11
+ * Three live lanes side by side, then the Done lane as a full-width strip beneath them rather
12
+ * than a fourth column. A collapsed column cannot state its own count without turning its label
13
+ * sideways, and giving the archive a quarter of the width permanently would take it from the
14
+ * three lanes a reader actually works in. As a strip it is one row when shut and a wide grid when
15
+ * opened, which is also the better shape for scanning history.
16
+ */
17
+ const props = defineProps<{
18
+ frameId: string
19
+ /** A live lane's scroll viewport, resolved by the frame from its own size. */
20
+ laneBodyHeight: number
21
+ }>()
22
+
23
+ const { t } = useI18n()
24
+ const laneView = useLaneViewStore()
25
+ const { lanes, doneSelection } = useFrameLanes(computed(() => props.frameId))
26
+
27
+ const liveLanes = computed(() => lanes.value.filter((l) => l.lane !== 'done'))
28
+ const doneLane = computed(() => lanes.value.find((l) => l.lane === 'done'))
29
+
30
+ /**
31
+ * What the Done lane is holding back, as one line.
32
+ *
33
+ * The two counts are reported separately because they tell a reader different things: an age
34
+ * drop means "there is older history, look further back", a cap drop means "there is more from
35
+ * this same period". Reporting nothing at all would be the worse failure — a truncated archive
36
+ * would read exactly like a complete one.
37
+ */
38
+ const withheldNote = computed(() => {
39
+ const { hiddenByAge, hiddenByCap, undatedShown } = doneSelection.value
40
+ const parts: string[] = []
41
+ if (hiddenByCap > 0) parts.push(t('board.lanes.done.hiddenByCap', { count: hiddenByCap }))
42
+ if (hiddenByAge > 0) parts.push(t('board.lanes.done.hiddenByAge', { count: hiddenByAge }))
43
+ // Blocks merged before completion dates were recorded have no honest age, so the age cap
44
+ // cannot apply to them. Saying so stops the window looking tighter than it is.
45
+ if (undatedShown > 0 && hiddenByAge > 0) {
46
+ parts.push(t('board.lanes.done.undated', { count: undatedShown }))
47
+ }
48
+ return parts.join(' · ')
49
+ })
50
+ </script>
51
+
52
+ <template>
53
+ <div class="space-y-2">
54
+ <!-- The three lanes a reader works in -->
55
+ <div class="flex items-start" :style="{ gap: LANE_GEOMETRY.laneGap + 'px' }">
56
+ <TaskLane
57
+ v-for="rendered in liveLanes"
58
+ :key="rendered.lane"
59
+ :rendered="rendered"
60
+ :group-key="laneView.groupKey"
61
+ :frame-id="frameId"
62
+ :body-height="laneBodyHeight"
63
+ />
64
+ </div>
65
+
66
+ <!-- The Done strip. Rendered only once the service HAS finished something: an empty archive
67
+ is the one lane whose emptiness says nothing a reader needs (a new service has merged
68
+ nothing, which its three live lanes already show). -->
69
+ <div v-if="doneLane && doneLane.total > 0" class="rounded-lg bg-slate-900/40">
70
+ <button
71
+ type="button"
72
+ class="nodrag flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left hover:bg-slate-800/40"
73
+ data-testid="done-lane-toggle"
74
+ :aria-expanded="!laneView.doneLaneCollapsed"
75
+ @click.stop="laneView.toggleDoneLane()"
76
+ >
77
+ <UIcon
78
+ :name="laneView.doneLaneCollapsed ? 'i-lucide-chevron-right' : 'i-lucide-chevron-down'"
79
+ class="h-3.5 w-3.5 shrink-0 text-slate-500"
80
+ />
81
+ <UIcon
82
+ :name="LANE_META.done.icon"
83
+ class="h-3.5 w-3.5 shrink-0"
84
+ :style="{ color: LANE_META.done.color }"
85
+ />
86
+ <span class="text-[11px] font-semibold text-slate-200">{{
87
+ t(LANE_META.done.labelKey)
88
+ }}</span>
89
+ <!-- The TOTAL, not what the caps admitted: "this service has finished 312 tasks" is the
90
+ fact the lane carries, and counting only the visible cards would understate it by
91
+ two orders of magnitude. -->
92
+ <span
93
+ class="shrink-0 rounded px-1 text-[10px] font-semibold tabular-nums"
94
+ :style="{
95
+ backgroundColor: LANE_META.done.color + '22',
96
+ color: LANE_META.done.color,
97
+ }"
98
+ data-testid="lane-count-done"
99
+ >{{ doneLane.total }}</span
100
+ >
101
+ <span v-if="withheldNote" class="ms-auto truncate text-[10px] text-slate-500">{{
102
+ withheldNote
103
+ }}</span>
104
+ </button>
105
+
106
+ <!-- The archive opens as a WIDE GRID: each group takes the strip's full width and wraps its
107
+ own cards across it, and the groups stack. Wrapping the GROUPS instead read correctly
108
+ only when there were several of them — under the default `none` grouping a lane is
109
+ exactly one group, so the whole archive rendered as a single card-wide column down the
110
+ left of an otherwise empty strip. -->
111
+ <div
112
+ v-if="!laneView.doneLaneCollapsed"
113
+ :data-drop-zone="frameId"
114
+ data-testid="lane-done"
115
+ data-lane="done"
116
+ class="nodrag space-y-2 overflow-y-auto p-2 pt-0"
117
+ :style="{ maxHeight: laneBodyHeight + 'px' }"
118
+ >
119
+ <!-- A zero cap is a real setting ("count them, show none"), so the strip explains why it
120
+ has nothing in it rather than looking broken. -->
121
+ <p
122
+ v-if="doneSelection.shown.length === 0"
123
+ class="px-1 text-[10px] leading-snug text-slate-600"
124
+ >
125
+ {{ t('board.lanes.done.allWithheld') }}
126
+ </p>
127
+ <LaneGroup
128
+ v-for="(group, i) in doneLane.groups"
129
+ v-else
130
+ :key="group.label ?? `catch-all-${i}`"
131
+ :group="group"
132
+ :group-key="laneView.groupKey"
133
+ :frame-id="frameId"
134
+ layout="grid"
135
+ />
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </template>
@@ -9,10 +9,14 @@
9
9
  // on the plan-approval gate (or on an agent-raised decision) offers the button that
10
10
  // opens the window resolving it, instead of leaving the card on a spinning "Run
11
11
  // planning" whose only route in was the inspector's execution panel.
12
- // The tracker button opens the dedicated window directly. Draggable within its
13
- // frame like a task card.
12
+ // The tracker button opens the dedicated window directly.
13
+ //
14
+ // Laid out in a wrapping band above the frame's task swimlanes, not at coordinates. It used to be
15
+ // free-positioned inside the frame's canvas beside the task cards, and lost that along with them
16
+ // when tasks moved into lanes: with the canvas gone there is nothing left for an initiative's
17
+ // coordinates to be relative to, and its drag handle only ever moved it within a canvas nothing
18
+ // renders now. An initiative is still a first-class board block with its own inspector.
14
19
  import type { InitiativeStatus } from '~/types/domain'
15
- import { useBlockDrag } from '~/composables/useBlockDrag'
16
20
  import { useInitiativePlanning } from '~/composables/useInitiativePlanning'
17
21
  import {
18
22
  INITIATIVE_ATTENTION_ICONS,
@@ -27,7 +31,6 @@ const board = useBoardStore()
27
31
  const initiatives = useInitiativesStore()
28
32
  const ui = useUiStore()
29
33
  const { t } = useI18n()
30
- const { draggingId, startDrag } = useBlockDrag()
31
34
 
32
35
  const block = computed(() => board.getBlock(props.blockId))
33
36
  const initiative = computed(() => initiatives.forBlock(props.blockId))
@@ -56,36 +59,14 @@ const {
56
59
  function select() {
57
60
  ui.select(props.blockId)
58
61
  }
59
- function onHandle(e: PointerEvent) {
60
- if (block.value) startDrag(block.value, e)
61
- }
62
62
  </script>
63
63
 
64
64
  <template>
65
- <div
66
- v-if="block"
67
- class="absolute w-[230px]"
68
- :style="{
69
- left: block.position.x + 'px',
70
- top: block.position.y + 'px',
71
- zIndex: draggingId === blockId ? 60 : 10,
72
- pointerEvents: draggingId === blockId ? 'none' : undefined,
73
- }"
74
- >
75
- <div
76
- class="nodrag nopan flex cursor-grab touch-none items-center justify-center rounded-t-lg border border-b-0 border-indigo-800/60 bg-indigo-950/60 py-px active:cursor-grabbing pointer-coarse:py-2"
77
- :title="t('board.frame.dragTask')"
78
- @pointerdown="onHandle"
79
- >
80
- <UIcon
81
- name="i-lucide-grip-horizontal"
82
- class="h-3 w-3 text-indigo-400/60 pointer-coarse:h-5 pointer-coarse:w-5"
83
- />
84
- </div>
65
+ <div v-if="block" class="w-[230px]">
85
66
  <div
86
67
  data-testid="initiative-card"
87
68
  :data-status="status"
88
- class="cursor-pointer rounded-b-lg border border-indigo-800/60 bg-indigo-950/40 p-3 transition hover:border-indigo-600"
69
+ class="cursor-pointer rounded-lg border border-indigo-800/60 bg-indigo-950/40 p-3 transition hover:border-indigo-600"
89
70
  :class="[
90
71
  selected ? 'ring-2 ring-indigo-400/60' : '',
91
72
  awaitingAnswers || attention ? 'board-pulse' : '',
@@ -0,0 +1,93 @@
1
+ <script setup lang="ts">
2
+ import LaneTask from './LaneTask.vue'
3
+ import { MODULE_META, taskTypeMeta } from '~/utils/catalog'
4
+ import { LANE_GEOMETRY } from '~/utils/laneGeometry'
5
+ import type { LaneGroup, LaneGroupKey } from '~/utils/laneSort'
6
+ import { LANE_REASON_LABEL_KEYS, type LaneReason } from '~/utils/swimlanes'
7
+
8
+ /**
9
+ * One labelled run of cards inside a lane.
10
+ *
11
+ * The WRAPPER carries `data-drop-zone`, not the header, so dropping anywhere in a module's group
12
+ * — on its title or on a card already in it — means "into that module". With the zone on the
13
+ * header alone, a drop onto one of the group's own cards would fall through to the lane's frame
14
+ * zone and reparent the card OUT of the module it was dropped into, which is the opposite of
15
+ * what the gesture said.
16
+ *
17
+ * That drop target is also why module grouping matters beyond presentation: module sub-frames no
18
+ * longer render as boxes, so this is the board's drag route into a module. The inspector's module
19
+ * picker is the route that does not depend on the current grouping.
20
+ */
21
+ const props = withDefaults(
22
+ defineProps<{
23
+ group: LaneGroup
24
+ groupKey: LaneGroupKey
25
+ /** The enclosing service frame, so the catch-all group can be the way back OUT of a module. */
26
+ frameId: string
27
+ /**
28
+ * How the group's own cards run: down a lane column (the default) or wrapped across the full
29
+ * width of the Done strip, which is what makes the opened archive a grid rather than a column.
30
+ */
31
+ layout?: 'column' | 'grid'
32
+ }>(),
33
+ { layout: 'column' },
34
+ )
35
+
36
+ const { t } = useI18n()
37
+
38
+ /**
39
+ * Which block a drop onto this group reparents into.
40
+ *
41
+ * Only meaningful while grouping BY MODULE: a named group targets its module block, and the
42
+ * catch-all ("no module") targets the frame, which is what makes dragging a card out of a module
43
+ * possible. Under any other grouping the group is not a container at all, so it declares no zone
44
+ * and drops fall through to the lane's own frame zone.
45
+ */
46
+ const dropZone = computed(() => {
47
+ if (props.groupKey !== 'module') return null
48
+ return props.group.label == null ? props.frameId : props.group.id
49
+ })
50
+
51
+ /** Group labels are DATA (a module name, a type, a reason), so each kind is rendered as itself. */
52
+ const label = computed(() => {
53
+ const raw = props.group.label
54
+ // `none` grouping renders no header at all, so it has no catch-all label to name.
55
+ if (props.groupKey === 'none') return ''
56
+ if (raw == null) return t(`board.lanes.group.catchAll.${props.groupKey}`)
57
+ if (props.groupKey === 'task_type') return taskTypeMeta(raw).label
58
+ if (props.groupKey === 'blocking_reason') {
59
+ return t(LANE_REASON_LABEL_KEYS[raw as LaneReason] ?? 'board.lanes.reason.unclassified')
60
+ }
61
+ return raw
62
+ })
63
+
64
+ const icon = computed(() => {
65
+ if (props.groupKey === 'module') return MODULE_META.icon
66
+ if (props.groupKey === 'initiative') return 'i-lucide-flag'
67
+ if (props.groupKey === 'epic') return 'i-lucide-layers'
68
+ return null
69
+ })
70
+ </script>
71
+
72
+ <template>
73
+ <div :data-drop-zone="dropZone ?? undefined" class="space-y-1.5">
74
+ <!-- `none` grouping renders no header: one unlabelled group IS the flat lane, and a header
75
+ saying "all of them" would be a row of chrome carrying no information. -->
76
+ <div
77
+ v-if="groupKey !== 'none'"
78
+ class="flex items-center gap-1 px-0.5 text-[10px] uppercase tracking-wide text-slate-500"
79
+ >
80
+ <UIcon v-if="icon" :name="icon" class="h-3 w-3 shrink-0" />
81
+ <span class="truncate" :title="label">{{ label }}</span>
82
+ <span class="ms-auto shrink-0 tabular-nums">{{ group.entries.length }}</span>
83
+ </div>
84
+ <div :class="layout === 'grid' ? 'flex flex-wrap items-start gap-2' : 'space-y-1.5'">
85
+ <LaneTask
86
+ v-for="entry in group.entries"
87
+ :key="entry.task.id"
88
+ :task-id="entry.task.id"
89
+ :style="layout === 'grid' ? { width: LANE_GEOMETRY.cardWidth + 'px' } : undefined"
90
+ />
91
+ </div>
92
+ </div>
93
+ </template>
@@ -0,0 +1,66 @@
1
+ <script setup lang="ts">
2
+ import TaskCard from './TaskCard.vue'
3
+ import { useBlockDrag } from '~/composables/useBlockDrag'
4
+
5
+ /**
6
+ * One task card in a swimlane.
7
+ *
8
+ * Replaces the old `DraggableTask`, and the difference is the whole point of the lanes: a card
9
+ * no longer carries coordinates. It sits where its lane's order puts it, so this wrapper is an
10
+ * ordinary flow item and the drag it starts is REPARENT-ONLY (`positioned: false`) — moving work
11
+ * between services, and into or out of a module, which is what a task drag was always actually
12
+ * for. Nothing is previewed while dragging, because there is nowhere to preview to.
13
+ *
14
+ * It also renders merged tasks, where `DraggableTask` returned nothing for them. That is what
15
+ * the Done lane needed: a finished task used to vanish from the board entirely, so a service's
16
+ * own history was invisible on it.
17
+ */
18
+ const props = defineProps<{ taskId: string }>()
19
+
20
+ const board = useBoardStore()
21
+ const access = useWorkspaceAccess()
22
+ const expansion = useTaskExpansionStore()
23
+ const { t } = useI18n()
24
+ const { draggingId, startDrag } = useBlockDrag()
25
+
26
+ const task = computed(() => board.getBlock(props.taskId))
27
+ const dragging = computed(() => draggingId.value === props.taskId)
28
+
29
+ // An expanded pipeline overlays its neighbours, so it must stack above the compact cards
30
+ // around it. Reads the same predicate the pipeline itself renders on.
31
+ const expanded = computed(() => expansion.isExpanded(props.taskId))
32
+
33
+ function onHandle(e: PointerEvent) {
34
+ if (task.value) startDrag(task.value, e, { reparent: true, positioned: false })
35
+ }
36
+ </script>
37
+
38
+ <template>
39
+ <div
40
+ v-if="task"
41
+ class="relative"
42
+ :style="{
43
+ zIndex: dragging ? 60 : expanded ? 20 : 10,
44
+ // While this card is being dragged it must not capture hit-tests, so the drop zone
45
+ // beneath the cursor (a lane, or a module's group) resolves on release. The handle sits
46
+ // in this wrapper above the card and would otherwise mask the zone under it.
47
+ pointerEvents: dragging ? 'none' : undefined,
48
+ }"
49
+ :class="{ 'opacity-40': dragging }"
50
+ >
51
+ <!-- Drag handle. `nopan` so a start-drag from here moves the card, not the pane. Hidden
52
+ for read-only viewers, for whom the drag is a no-op anyway (see useBlockDrag). -->
53
+ <div
54
+ v-if="access.canWriteBoard.value"
55
+ class="nodrag nopan flex cursor-grab touch-none items-center justify-center rounded-t-lg border border-b-0 border-slate-700 bg-slate-800/80 py-px active:cursor-grabbing pointer-coarse:py-2"
56
+ :title="t('board.frame.dragTask')"
57
+ @pointerdown="onHandle"
58
+ >
59
+ <UIcon
60
+ name="i-lucide-grip-horizontal"
61
+ class="h-3 w-3 text-slate-500 pointer-coarse:h-5 pointer-coarse:w-5"
62
+ />
63
+ </div>
64
+ <TaskCard :task-id="taskId" :class="access.canWriteBoard.value ? '!rounded-t-none' : ''" />
65
+ </div>
66
+ </template>