@kabmo-labs/kabmo 0.56.0 → 0.57.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 (129) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +3 -3
  3. package/dist/client/static/js/{Body-jfy4bhk2.js → Body-p6zwk0nx.js} +1 -1
  4. package/dist/client/static/js/{CsvGrid-4c5t668z.js → CsvGrid-563qmmmr.js} +1 -1
  5. package/dist/client/static/js/{DocxView-3x7whtvq.js → DocxView-5j69q3s0.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-tbkc5dfz.js → DrawioView-gd6k3hvn.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-egxkayya.js → HtmlPreview-6gnktzzp.js} +1 -1
  8. package/dist/client/static/js/{ImageView-swhzvw2p.js → ImageView-fkfq3fwv.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-sangsrt5.js → LayoutWrapper-mdb1qm26.js} +1 -1
  10. package/dist/client/static/js/MergeDiffView-7kpjxcg9.js +1 -0
  11. package/dist/client/static/js/{Modal-1fj8kvme.js → Modal-0p9cr2tn.js} +12 -12
  12. package/dist/client/static/js/{PdfView-0k2egsbz.js → PdfView-n1zq27td.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-t547rqeb.js → SessionsView-gptt0rq8.js} +1 -1
  14. package/dist/client/static/js/{SheetView-anb3gavm.js → SheetView-nes7j86v.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-e2wrj2hj.js → SvgPreview-vv0qzkt7.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-0rs86b68.js → abnfDiagram-O67JEVCF-02g96sn6.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-0k3zzxz1.js → architectureDiagram-NJMV4G6O-7qj2fpwt.js} +1 -1
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-t1n1fx96.js → blockDiagram-BEXU5L5S-grdr1j2h.js} +3 -3
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-93b7eds9.js → c4Diagram-YGBWAQC7-7y980xpx.js} +2 -2
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-bnf85z0f.js → classDiagram-v2-NBCMYWYE-29ag4js1.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-e290161f.js → cose-bilkent-JH36ORCC-e5dvgehd.js} +1 -1
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-s13ra9ag.js → cynefinDiagram-VND7K2PF-eq6fmx0b.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-83wshh5e.js → dagre-6A5THRUB-xfhwp8ha.js} +1 -1
  24. package/dist/client/static/js/{diagram-22UHCM2B-ywh4wqna.js → diagram-22UHCM2B-1bw6x6zt.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-cb53z698.js → diagram-3UASUU5V-076ej5n5.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-btf55c44.js → diagram-ATOU4E4O-cvf9fhdq.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-p6tbbm1n.js → diagram-CDSNMT55-hn1wdx54.js} +3 -3
  28. package/dist/client/static/js/{diagram-MLGK6HIB-6kzssf4y.js → diagram-MLGK6HIB-76gk27b5.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-4v0yncvv.js → diagram-MPIPVDR6-0cbajhpx.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-r422htmd.js → dockerfile-7atfjhnf.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-mw1gh30z.js → ebnfDiagram-ZINNZB2B-n0g3b9m2.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-1pe786ap.js → elk-276RUBZZ-f6wrjcv9.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-x7rk70q6.js → erDiagram-OPXOYQCR-jz622yrg.js} +1 -1
  34. package/dist/client/static/js/flowDiagram-KWPJA3E3-5bvd5k2t.js +1 -0
  35. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-j3m5km4p.js → ganttDiagram-FUAMR5RP-2ex4nxyg.js} +2 -2
  36. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fd1kebdy.js → gitGraphDiagram-X574FWY7-38eyay6g.js} +1 -1
  37. package/dist/client/static/js/{index-zkef5q39.js → index-1q934wfk.js} +1 -1
  38. package/dist/client/static/js/{index-5fxm2tpg.js → index-28wv94gz.js} +1 -1
  39. package/dist/client/static/js/{index-4jg10xtp.js → index-3wgjtp2k.js} +1 -1
  40. package/dist/client/static/js/{index-29b1ysz6.js → index-4cff0zg2.js} +1 -1
  41. package/dist/client/static/js/{index-8e66p2a7.js → index-55v3qv04.js} +1 -1
  42. package/dist/client/static/js/{index-s4v3vcsn.js → index-63mk2qk6.js} +1 -1
  43. package/dist/client/static/js/{index-4dzvjfkd.js → index-6z30g3ha.js} +1 -1
  44. package/dist/client/static/js/{index-473wm10a.js → index-7trfm17d.js} +1 -1
  45. package/dist/client/static/js/{index-drsy400d.js → index-8444mec5.js} +1 -1
  46. package/dist/client/static/js/{index-j1prebvy.js → index-9gfn1a3h.js} +1 -1
  47. package/dist/client/static/js/{index-qdabc51h.js → index-ays8t3t3.js} +2 -2
  48. package/dist/client/static/js/{index-q4t5j3x7.js → index-cxe75e06.js} +1 -1
  49. package/dist/client/static/js/{index-22frp78d.js → index-db7vsjkd.js} +1 -1
  50. package/dist/client/static/js/{index-7tsdw8wt.js → index-dmb1pykr.js} +1 -1
  51. package/dist/client/static/js/{index-tcp5cp53.js → index-ep99arz1.js} +1 -1
  52. package/dist/client/static/js/{index-0mhxw0a1.js → index-ewst55j2.js} +1 -1
  53. package/dist/client/static/js/{index-hgsjynb0.js → index-fqc1snjw.js} +1 -1
  54. package/dist/client/static/js/{index-rm5b3kn8.js → index-g2e0m757.js} +3 -3
  55. package/dist/client/static/js/{index-3k45gspr.js → index-jaxhfk9x.js} +1 -1
  56. package/dist/client/static/js/{index-satnfvaz.js → index-jsn2kedv.js} +1 -1
  57. package/dist/client/static/js/{index-bxhszdcz.js → index-n1xmkf2g.js} +1 -1
  58. package/dist/client/static/js/{index-004x0a3p.js → index-pe4d9wht.js} +1 -1
  59. package/dist/client/static/js/{index-cbbwq25c.js → index-pjf5wak8.js} +1 -1
  60. package/dist/client/static/js/{index-8n4qwd64.js → index-sm8gpk3g.js} +2 -2
  61. package/dist/client/static/js/{index-qrwjxqdh.js → index-st6a8q5z.js} +176 -176
  62. package/dist/client/static/js/{index-dfha2z56.js → index-stmwbavz.js} +1 -1
  63. package/dist/client/static/js/index-swaveqxg.css +1 -0
  64. package/dist/client/static/js/{index-3hrvhyym.js → index-t82q5t6m.js} +1 -1
  65. package/dist/client/static/js/{index-s6nv35dv.js → index-t9zjfxvc.js} +1 -1
  66. package/dist/client/static/js/{index-jbaceghb.js → index-tdbcp70z.js} +1 -1
  67. package/dist/client/static/js/{index-kbk0vmex.js → index-tdryzzy9.js} +1 -1
  68. package/dist/client/static/js/{index-jtyzeynv.js → index-tksrpqkh.js} +1 -1
  69. package/dist/client/static/js/{index-g84dwmvr.js → index-v38j2zxn.js} +1 -1
  70. package/dist/client/static/js/{index-4nyajpeg.js → index-x17y7xdr.js} +1 -1
  71. package/dist/client/static/js/{index-4fpyzg5e.js → index-xfnjwhan.js} +20 -20
  72. package/dist/client/static/js/{index-72v57e07.js → index-xrb4kjr3.js} +1 -1
  73. package/dist/client/static/js/{index-4acka5fn.js → index-zv8wrvha.js} +1 -1
  74. package/dist/client/static/js/{index-q178zgxp.js → index-zynbvm7x.js} +1 -1
  75. package/dist/client/static/js/{index-bnamrpm6.js → index-zzggk17b.js} +1 -1
  76. package/dist/client/static/js/{infoDiagram-VRGFBTTK-1m0br602.js → infoDiagram-VRGFBTTK-c55t0tvd.js} +2 -2
  77. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-zryzhpq6.js → ishikawaDiagram-OU5B5YK6-r9kg5kg5.js} +2 -2
  78. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-6apqr7h4.js → journeyDiagram-ZHPQQLJL-zmmst4v8.js} +2 -2
  79. package/dist/client/static/js/{kanban-definition-PNTS6WVX-am385c1e.js → kanban-definition-PNTS6WVX-3tt6sc9a.js} +1 -1
  80. package/dist/client/static/js/{mermaid.core-k937exrm.js → mermaid.core-pkrs8zp5.js} +2 -2
  81. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-hx8qq866.js → mindmap-definition-NLK3R4M7-b4c6gxg4.js} +1 -1
  82. package/dist/client/static/js/one-dark-pro-sstqnzcf.js +1 -0
  83. package/dist/client/static/js/one-light-6fpxxq2j.js +1 -0
  84. package/dist/client/static/js/{pegDiagram-GJSIUBJH-1hasj2h7.js → pegDiagram-GJSIUBJH-9jkat1mz.js} +1 -1
  85. package/dist/client/static/js/{pieDiagram-5QR66LMP-x5nwff8r.js → pieDiagram-5QR66LMP-6pbchjh7.js} +2 -2
  86. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-gmrcr5jb.js → quadrantDiagram-O4NWA36T-p9brea19.js} +2 -2
  87. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-rdznfhfb.js → railroadDiagram-XR7U4H2S-3cep8css.js} +1 -1
  88. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-v9wb3ppf.js → requirementDiagram-PLB6GJNP-x1yjgsrr.js} +1 -1
  89. package/dist/client/static/js/{rust-9cgnbbcs.js → rust-yy8gekx8.js} +1 -1
  90. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-3p4ddd2h.js → sankeyDiagram-IPEJSGJF-23wzf4aj.js} +1 -1
  91. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-wfcqxjfq.js → sequenceDiagram-PO4LG4MO-w4wr3zzr.js} +4 -4
  92. package/dist/client/static/js/{sizeCapture-INFHLROL-g02k0k8x.js → sizeCapture-INFHLROL-aabfesnr.js} +1 -1
  93. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-7k449yvg.js → stateDiagram-v2-GCMORJYK-t0n288xw.js} +1 -1
  94. package/dist/client/static/js/{swimlanes-2SLR337P-zkf2bgm8.js → swimlanes-2SLR337P-1nnm0p7h.js} +1 -1
  95. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-yex8g4fx.js → swimlanesDiagram-TC7HE7FX-cx3f29mq.js} +1 -1
  96. package/dist/client/static/js/{timeline-definition-EJHVYXUP-qsfpjr1c.js → timeline-definition-EJHVYXUP-8pyssn0q.js} +1 -1
  97. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-b2vprhsr.js → usecaseDiagram-POWQR4AR-vveepvt6.js} +1 -1
  98. package/dist/client/static/js/{vennDiagram-UO4OBE2U-x0ffeg2t.js → vennDiagram-UO4OBE2U-tqyvmqxc.js} +4 -4
  99. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-hsnhaf4f.js → wardleyDiagram-VNRHLVJA-p8rs34em.js} +2 -2
  100. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-90f9aadp.js → xychartDiagram-PMCCYNJV-pgnvxtps.js} +3 -3
  101. package/package.json +3 -3
  102. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.tsx +25 -62
  103. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.test.tsx +40 -0
  104. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.tsx +41 -2
  105. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionList.tsx +117 -0
  106. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/SwipeDeck.tsx +220 -0
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +10 -8
  108. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label.test.ts +37 -0
  109. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label.ts +17 -1
  110. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +18 -15
  111. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +7 -8
  112. package/src/client/data/settings/omp-schema.json +59 -7
  113. package/src/client/hooks/chat/timeline/ask-frames-form.test.ts +29 -0
  114. package/src/server/lib/dictation/capability.server.test.ts +9 -6
  115. package/src/server/lib/dictation/worker-process.ts +9 -2
  116. package/src/shared/lib/chat/ask-form/data.ts +25 -6
  117. package/src/shared/lib/chat/ask-form/deck.ts +80 -0
  118. package/src/shared/lib/chat/ask-form/fields.ts +26 -1
  119. package/src/shared/lib/chat/ask-form/index.ts +18 -310
  120. package/src/shared/lib/chat/ask-form/types.ts +14 -2
  121. package/src/shared/lib/chat/ask-form/walker.ts +350 -0
  122. package/src/shared/lib/chat/ask-form.test.ts +41 -0
  123. package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +47 -0
  124. package/src/shared/lib/omp/config/schema-releases.test.ts +4 -2
  125. package/dist/client/static/js/MergeDiffView-bv00y63x.js +0 -1
  126. package/dist/client/static/js/flowDiagram-KWPJA3E3-kfwaac44.js +0 -1
  127. package/dist/client/static/js/index-gedsa0z7.css +0 -1
  128. package/dist/client/static/js/one-dark-pro-phxqe9mx.js +0 -1
  129. package/dist/client/static/js/one-light-vhwh499y.js +0 -1
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The question list of the grouped `ask` form (`FormAsk`): every question at
8
+ * once, with swipe decks (`<booldeck>` cards) drawn as one deck per run.
9
+ *
10
+ * Split out of `FormAsk` at the 350-line ceiling: the submit state machine
11
+ * owns the rest of that file. The deck run detection lives here because a run
12
+ * needs every card of the run: only the run's first card renders the
13
+ * `SwipeDeck`, the rest are its stack.
14
+ */
15
+
16
+ import { AnswerList, QuestionCard } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard';
17
+ import { OptionRow } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow';
18
+ import { SwipeDeck } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/SwipeDeck';
19
+ import { partsFor, type Pick } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/form-picks';
20
+ import { isOtherOption } from '@/shared/lib/chat/ask-questions';
21
+ import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-form/types';
22
+
23
+ interface QuestionListProps {
24
+ questions: AskQuestion[];
25
+ picks: Record<number, Pick>;
26
+ recorded: (AskAnswer | null)[];
27
+ /** Whether the machine is sending — controls render inert only then. */
28
+ sending: boolean;
29
+ /** The live frame's answer for one question, or null while unanswered. */
30
+ answerFor: (index: number) => AskAnswer | null;
31
+ onToggle: (index: number, label: string, multi: boolean) => void;
32
+ onText: (index: number, text: string) => void;
33
+ onUndo: () => void;
34
+ }
35
+
36
+ export function QuestionList({ questions, picks, recorded, sending, answerFor, onToggle, onText, onUndo }: QuestionListProps) {
37
+ return (
38
+ <>
39
+ {questions.map((question, index) => {
40
+ if (question.kind === 'card') {
41
+ const prev = questions[index - 1];
42
+ if (prev && prev.kind === 'card') return null;
43
+ const cards: AskQuestion[] = [];
44
+ for (let at = index; at < questions.length && questions[at].kind === 'card'; at += 1) cards.push(questions[at]);
45
+ return (
46
+ <SwipeDeck
47
+ key={question.id ?? index}
48
+ cards={cards}
49
+ picks={picks}
50
+ offset={index}
51
+ onVerdict={(verdictIndex, label) => onToggle(verdictIndex, label, false)}
52
+ disabled={sending}
53
+ onUndo={onUndo}
54
+ />
55
+ );
56
+ }
57
+ const answer = answerFor(index);
58
+ const pick = picks[index] ?? { selected: [], text: '' };
59
+ return (
60
+ <QuestionCard
61
+ key={question.id ?? index}
62
+ index={index}
63
+ total={questions.length}
64
+ header={question.header}
65
+ question={question.question}
66
+ multi={question.multi === true}
67
+ answered={answer !== null}
68
+ >
69
+ {answer !== null ? (
70
+ <AnswerList parts={partsFor(question, pick, recorded[index] ?? null)} />
71
+ ) : (
72
+ <>
73
+ {question.kind === 'text' ? (
74
+ <textarea
75
+ rows={3}
76
+ value={pick.text}
77
+ disabled={sending}
78
+ placeholder="Type your answer…"
79
+ aria-label={`Your answer for question ${index + 1}`}
80
+ onInput={(event) => onText(index, event.currentTarget.value)}
81
+ className="mt-2 w-full rounded-md border border-ink/15 bg-canvas/40 px-2 py-1 font-mono text-[11.5px] text-ink outline-none focus:border-ink disabled:opacity-50"
82
+ />
83
+ ) : (
84
+ <>
85
+ <div className="mt-2 space-y-1" role={question.multi === true ? 'group' : 'radiogroup'}>
86
+ {question.options.filter((option) => !isOtherOption(option.label)).map((option, optionIndex) => (
87
+ <OptionRow
88
+ key={option.label}
89
+ label={option.label}
90
+ description={option.description}
91
+ multi={question.multi === true}
92
+ checked={pick.selected.includes(option.label)}
93
+ suggested={question.recommended === optionIndex}
94
+ disabled={sending}
95
+ onClick={() => onToggle(index, option.label, question.multi === true)}
96
+ />
97
+ ))}
98
+ </div>
99
+ <input
100
+ type="text"
101
+ value={pick.text}
102
+ disabled={sending}
103
+ placeholder="Or type your own…"
104
+ aria-label={`Your own answer for question ${index + 1}`}
105
+ onInput={(event) => onText(index, event.currentTarget.value)}
106
+ className="mt-2 w-full rounded-md border border-ink/15 bg-canvas/40 px-2 py-1 text-[11.5px] text-ink outline-none focus:border-ink disabled:opacity-50"
107
+ />
108
+ </>
109
+ )}
110
+ </>
111
+ )}
112
+ </QuestionCard>
113
+ );
114
+ })}
115
+ </>
116
+ );
117
+ }
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The `<booldeck>` swipe deck (omp 19.4.0), drawn in the timeline instead of a
8
+ * modal — the same surface every other `ask` question uses.
9
+ *
10
+ * omp's terminal deck shows one card from a stack: swipe right for yes, left
11
+ * for no, up to skip, with a pip per card and a tally (`7 Keep · 2 Drop · 1
12
+ * skipped`) once every card is decided. A card it cannot animate is the same
13
+ * deck without flight: the top card first with its three verdict buttons
14
+ * (`♥` yes, `✕` no, `↑` skip) and `↺` undo, a pip per card, the next card
15
+ * waiting under it, and the tally when the deck is done. Verdicts ride as the
16
+ * question's `options` (values `yes`/`no`/`skip`), so the one-Submit form
17
+ * builder carries them without a second convention.
18
+ */
19
+
20
+ import { useEffect, useRef } from 'preact/hooks';
21
+ import { CheckCircle2 } from 'lucide-preact';
22
+ import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
23
+ import type { FormPick } from '@/shared/lib/chat/ask-form/data';
24
+
25
+ /** One card verdict, in omp's order: yes, no, skip. */
26
+ export type Verdict = 'yes' | 'no' | 'skip';
27
+
28
+ /** The verdict a picked row carries, by its fixed value (never its label). */
29
+ export function verdictOf(question: AskQuestion, picked: readonly string[]): Verdict | undefined {
30
+ const option = question.options.find(
31
+ (candidate) => candidate.value === picked[0] || candidate.label === picked[0],
32
+ );
33
+ const value = option?.value ?? picked[0];
34
+ return value === 'yes' || value === 'no' || value === 'skip' ? value : undefined;
35
+ }
36
+
37
+ /** omp's label for a verdict: the side's own label, `Skip` for a skip. */
38
+ export function verdictLabel(question: AskQuestion, verdict: Verdict): string {
39
+ if (verdict === 'skip') return 'Skip';
40
+ return question.options.find((candidate) => candidate.value === verdict)?.label ?? (verdict === 'yes' ? 'Yes' : 'No');
41
+ }
42
+
43
+ /** omp's tally: `7 Keep · 2 Drop · 1 skipped`, skipping zero verdicts. */
44
+ export function tallyOf(cards: readonly AskQuestion[], picks: Record<number, FormPick>, offset: number): string | undefined {
45
+ const counts: Record<Verdict, number> = { yes: 0, no: 0, skip: 0 };
46
+ for (const [index, card] of cards.entries()) {
47
+ const verdict = verdictOf(card, picks[offset + index]?.selected ?? []);
48
+ if (verdict) counts[verdict] += 1;
49
+ }
50
+ const parts: string[] = [];
51
+ for (const verdict of ['yes', 'no', 'skip'] as const satisfies readonly Verdict[]) {
52
+ if (counts[verdict] === 0) continue;
53
+ const labels = [...new Set(cards.map((card) => verdictLabel(card, verdict)))];
54
+ const label = labels.length === 1 ? labels[0] : verdict === 'yes' ? 'Yes' : 'No';
55
+ parts.push(`${counts[verdict]} ${verdict === 'skip' ? 'skipped' : label}`);
56
+ }
57
+ return parts.length ? parts.join(' · ') : undefined;
58
+ }
59
+
60
+ interface SwipeDeckProps {
61
+ /** Every card question of the deck, in form order. */
62
+ cards: AskQuestion[];
63
+ /** Picks by question index (the timeline answers read these). */
64
+ picks: Record<number, FormPick>;
65
+ /** Offset of the deck's first card in the form's question list. */
66
+ offset: number;
67
+ /** Choose a verdict for one card. */
68
+ onVerdict: (index: number, label: string) => void;
69
+ /** Disable every control once the answers are on the wire. */
70
+ disabled?: boolean;
71
+ /** Drop the last verdict (omp's `↺`). */
72
+ onUndo?: () => void;
73
+ }
74
+
75
+ /**
76
+ * The deck: the first undecided card on top with its three verdicts, a pip per
77
+ * card, the cards under it, and the tally when every card is decided.
78
+ */
79
+ export function SwipeDeck({ cards, picks, offset, onVerdict, disabled, onUndo }: SwipeDeckProps) {
80
+ const focusRef = useRef<HTMLDivElement>(null);
81
+
82
+ // The deck owns the keyboard while it is on screen: arrows decide the top
83
+ // card, Enter submits once every card is decided. Mirrors the terminal
84
+ // deck's key map without overriding the app's shortcuts.
85
+ useEffect(() => {
86
+ if (disabled || !focusRef.current) return;
87
+ const node = focusRef.current;
88
+ const onKey = (event: KeyboardEvent) => {
89
+ const verdicts = cards.map((card, index) => verdictOf(card, picks[offset + index]?.selected ?? []));
90
+ const top = verdicts.findIndex((verdict) => verdict === undefined);
91
+ const verdictByKey: Record<string, Verdict> = {
92
+ ArrowRight: 'yes',
93
+ ArrowLeft: 'no',
94
+ ArrowUp: 'skip',
95
+ };
96
+ const verdict = verdictByKey[event.key];
97
+ if (verdict && top >= 0) {
98
+ event.preventDefault();
99
+ onVerdict(offset + top, verdictLabel(cards[top], verdict));
100
+ return;
101
+ }
102
+ if (event.key === 'Backspace' && onUndo) {
103
+ event.preventDefault();
104
+ onUndo();
105
+ }
106
+ };
107
+ node.addEventListener('keydown', onKey);
108
+ return () => node.removeEventListener('keydown', onKey);
109
+ }, [cards, picks, offset, onVerdict, disabled, onUndo]);
110
+
111
+ const verdicts = cards.map((card, index) => verdictOf(card, picks[offset + index]?.selected ?? []));
112
+ const top = verdicts.findIndex((verdict) => verdict === undefined);
113
+ const done = top === -1;
114
+ const visible = cards
115
+ .map((card, index) => ({ card, index, verdict: verdicts[index] }))
116
+ .filter(({ index }) => done || index >= top - 1)
117
+ .slice(0, 3);
118
+
119
+ return (
120
+ <div ref={focusRef} tabIndex={disabled ? undefined : 0} className="space-y-1.5 outline-none" aria-label="Swipe deck">
121
+ <div className="flex items-center gap-1" aria-hidden="true">
122
+ {cards.map((card, index) => {
123
+ const verdict = verdicts[index];
124
+ const tone =
125
+ verdict === 'yes'
126
+ ? 'text-success'
127
+ : verdict === 'no'
128
+ ? 'text-error'
129
+ : verdict === 'skip'
130
+ ? 'text-ink/40'
131
+ : index === top
132
+ ? 'text-accent'
133
+ : 'text-ink/25';
134
+ return (
135
+ <span key={card.id ?? index} className={`text-[10px] ${tone}`}>
136
+ {verdict ? '●' : index === top ? '◉' : '○'}
137
+ </span>
138
+ );
139
+ })}
140
+ <span className="ml-auto font-mono text-[10px] text-ink/40">
141
+ {done ? `${cards.length} of ${cards.length}` : `${top + 1} of ${cards.length}`}
142
+ </span>
143
+ </div>
144
+
145
+ {visible.map(({ card, index, verdict }) => (
146
+ <div
147
+ key={card.id ?? index}
148
+ className={`rounded-lg border bg-paper p-2.5 ${index === top ? 'border-ink/25 shadow-xs' : 'border-ink/10 opacity-70'}`}
149
+ >
150
+ <div className="text-[12.5px] leading-relaxed text-ink/90 select-text">{card.question}</div>
151
+ <div className="mt-1.5 flex items-center gap-1.5">
152
+ {(['yes', 'no', 'skip'] as const satisfies readonly Verdict[]).map((candidate) => {
153
+ const label = verdictLabel(card, candidate);
154
+ const active = verdict === candidate;
155
+ const tone =
156
+ candidate === 'yes'
157
+ ? active
158
+ ? 'border-success/40 bg-success/10 text-success'
159
+ : 'border-ink/15 text-ink/70 hover:border-success/40 hover:text-success'
160
+ : candidate === 'no'
161
+ ? active
162
+ ? 'border-error/40 bg-error/10 text-error'
163
+ : 'border-ink/15 text-ink/70 hover:border-error/40 hover:text-error'
164
+ : active
165
+ ? 'border-ink/30 bg-ink/5 text-ink'
166
+ : 'border-ink/15 text-ink/70 hover:border-ink/40 hover:text-ink';
167
+ const glyph = candidate === 'yes' ? '♥' : candidate === 'no' ? '✕' : '↑';
168
+ return (
169
+ <button
170
+ key={candidate}
171
+ type="button"
172
+ disabled={disabled}
173
+ onClick={() => onVerdict(offset + index, label)}
174
+ aria-label={`${label} — ${card.question}`}
175
+ aria-pressed={active}
176
+ className={`flex min-h-8 flex-1 cursor-pointer items-center justify-center gap-1 rounded-md border px-2 text-[11.5px] font-medium transition-colors disabled:cursor-default disabled:opacity-40 ${tone}`}
177
+ >
178
+ <span aria-hidden="true">{glyph}</span>
179
+ {label}
180
+ </button>
181
+ );
182
+ })}
183
+ {verdict && (
184
+ <span className="flex shrink-0 items-center gap-1 text-[10.5px] font-medium text-ink/60">
185
+ <CheckCircle2 size={11} className="text-success" />
186
+ {verdictLabel(card, verdict)}
187
+ </span>
188
+ )}
189
+ {onUndo && verdict !== undefined && index === verdicts.length - 1 && (
190
+ <button
191
+ type="button"
192
+ disabled={disabled}
193
+ onClick={onUndo}
194
+ aria-label="Undo the last verdict"
195
+ title="Undo (Backspace)"
196
+ className="shrink-0 cursor-pointer rounded-md border border-ink/15 px-2 py-1 text-[11.5px] text-ink/70 transition-colors hover:border-ink/40 hover:text-ink disabled:cursor-default disabled:opacity-40"
197
+ >
198
+ ↺
199
+ </button>
200
+ )}
201
+ </div>
202
+ </div>
203
+ ))}
204
+
205
+ {onUndo && verdicts.some((verdict) => verdict !== undefined) && !done && (
206
+ <div className="text-[10.5px] text-ink/45">
207
+ <span className="font-mono">←</span> no · <span className="font-mono">→</span> yes ·{' '}
208
+ <span className="font-mono">↑</span> skip · <span className="font-mono">⌫</span> undo
209
+ </div>
210
+ )}
211
+
212
+ {done && (
213
+ <div className="rounded-lg border border-ink/10 bg-paper p-2.5 text-center">
214
+ <div className="text-[12.5px] font-medium text-ink/90">That’s every card</div>
215
+ <div className="mt-1 text-[11.5px] text-ink/70">{tallyOf(cards, picks, offset)}</div>
216
+ </div>
217
+ )}
218
+ </div>
219
+ );
220
+ }
@@ -35,14 +35,16 @@ import {
35
35
 
36
36
  export interface ToolCardHeader {
37
37
  title: string;
38
+ /**
39
+ * The row's subject, in FULL. The row clips it with CSS (`truncate`) at its
40
+ * own right edge, so the ellipsis lands beside the outcome/facts; a
41
+ * character cap here put a literal `…` mid-row whenever the command was
42
+ * longer than the cap, far from the data. The accessible label is bounded
43
+ * separately in `toolToggleLabel`.
44
+ */
38
45
  subtitle?: string;
39
46
  }
40
47
 
41
- /** One line under the title, capped so it never eats the header row. */
42
- function clip(value: string, max = 80): string {
43
- return value.length > max ? `${value.slice(0, max - 1)}…` : value;
44
- }
45
-
46
48
  function subtitleFromTitle(title: string): { title: string; subtitle?: string } | null {
47
49
  const parts = title.split(/\s+[—\-:]\s+/);
48
50
  if (parts.length < 2) return null;
@@ -97,7 +99,7 @@ export function toolCardHeader(tool: ToolCallData, toolKey: string): ToolCardHea
97
99
  const command = typeof input?.command === 'string'
98
100
  ? input.command.split('\n')[0]
99
101
  : undefined;
100
- if (command) return { title: 'Bash', subtitle: clip(command) };
102
+ if (command) return { title: 'Bash', subtitle: command };
101
103
  }
102
104
 
103
105
  // ── todo / ask ────────────────────────────────────────────────────────────
@@ -122,7 +124,7 @@ export function toolCardHeader(tool: ToolCallData, toolKey: string): ToolCardHea
122
124
  const mcpName = mcpToolNameOf(tool);
123
125
  if (mcpName) {
124
126
  const subject = mcpSubjectOf(tool);
125
- return { title: toTitleCase(mcpName), subtitle: subject ? clip(subject) : undefined };
127
+ return { title: toTitleCase(mcpName), subtitle: subject };
126
128
  }
127
129
 
128
130
  // ── wait: the card says WHAT it blocks on, not just "Wait" ────────────────
@@ -138,7 +140,7 @@ export function toolCardHeader(tool: ToolCallData, toolKey: string): ToolCardHea
138
140
  const job = view?.jobs[0];
139
141
  const subject =
140
142
  (job ? jobSubject(job).primary?.split('\n')[0]?.trim() : undefined) || job?.id || view?.waited[0]?.from;
141
- return { title: 'Wait', subtitle: subject ? clip(subject) : undefined };
143
+ return { title: 'Wait', subtitle: subject };
142
144
  }
143
145
 
144
146
  // ── generic: a "name — subject" title splits, otherwise the name stands ──
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The one wording every style's expand control uses.
8
+ *
9
+ * The subject is bounded HERE, not in the visible text: the row draws the full
10
+ * subject and lets CSS ellipsize it at the row's edge, while the accessible
11
+ * name stays short enough to read. Measured defect this pins: a `bash` subtitle
12
+ * pre-clipped at 80 characters put a literal `…` mid-row, far from the
13
+ * outcome/facts it precedes.
14
+ */
15
+
16
+ import { describe, expect, test } from 'bun:test';
17
+ import { toolToggleLabel } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label';
18
+
19
+ describe('toolToggleLabel', () => {
20
+ test('names the tool and its subject', () => {
21
+ expect(toolToggleLabel('Bash', 'bun test', false)).toBe('Expand Bash — bun test');
22
+ expect(toolToggleLabel('Bash', 'bun test', true)).toBe('Collapse Bash — bun test');
23
+ });
24
+
25
+ test('names only the tool when there is no subject', () => {
26
+ expect(toolToggleLabel('Question', undefined, false)).toBe('Expand Question');
27
+ expect(toolToggleLabel('Question', '', false)).toBe('Expand Question');
28
+ });
29
+
30
+ test('bounds a long subject in the label, keeping the full one for display', () => {
31
+ const command = `bun test ${'--filter '.repeat(14)}`;
32
+ const label = toolToggleLabel('Bash', command, false);
33
+ expect(label.length).toBe('Expand Bash — '.length + 80);
34
+ expect(label.endsWith('…')).toBe(true);
35
+ expect(command.length).toBeGreaterThan(80);
36
+ });
37
+ });
@@ -14,6 +14,22 @@
14
14
  * — calls it.
15
15
  */
16
16
 
17
+ /**
18
+ * The accessible name's subject budget.
19
+ *
20
+ * The VISIBLE subject is not capped: the row clips it with CSS so the ellipsis
21
+ * lands at the row's edge. The label is read, not laid out, so a long command
22
+ * is bounded here — a `bash` call can name a whole inline script, and a screen
23
+ * reader should not spell all of it.
24
+ */
25
+ const MAX_LABEL_SUBJECT = 80;
26
+
27
+ function labelSubject(subtitle: string): string {
28
+ return subtitle.length > MAX_LABEL_SUBJECT
29
+ ? `${subtitle.slice(0, MAX_LABEL_SUBJECT - 1)}…`
30
+ : subtitle;
31
+ }
32
+
17
33
  export function toolToggleLabel(title: string, subtitle: string | undefined, isExpanded: boolean): string {
18
- return `${isExpanded ? 'Collapse' : 'Expand'} ${title}${subtitle ? ` — ${subtitle}` : ''}`;
34
+ return `${isExpanded ? 'Collapse' : 'Expand'} ${title}${subtitle ? ` — ${labelSubject(subtitle)}` : ''}`;
19
35
  }
@@ -19,9 +19,9 @@
19
19
  * defect — the head then reads as one undifferentiated run of text.
20
20
  * - Facts are terminal text (`599ms · exit 0`), not pills, and a diff keeps
21
21
  * `+4` green and `−1` red inside one statement.
22
- * - The status line is PACKED: the subject hugs its clip instead of growing,
23
- * and the toggle follows the data, so a pre-clipped `…` never floats far
24
- * from the outcome and facts on its right.
22
+ * - The trailing group (`[done]`, facts, toggle) is FLUSH RIGHT: the subject
23
+ * fills the gap and the browser ellipsizes it there. The subject is never
24
+ * pre-clipped — a literal `…` mid-row left the group short of the edge.
25
25
  * - The head is the toggle, with the SHARED wording (`toolToggleLabel`), so
26
26
  * `chat.e2e.ts`'s `[aria-label^="Expand "]` collection and `mobile.e2e.ts`'s
27
27
  * `/^Expand Bash/` click still work, and the section's per-call intent
@@ -102,17 +102,18 @@ const EDIT_TOOL: ToolCallData = {
102
102
  details: { diff: 'a\n+b\n+c\n-d\n' },
103
103
  } as ToolCallData;
104
104
 
105
- /** A command longer than the header's 80-char clip, so its subtitle already
106
- * ends in `…` before CSS touches it. */
105
+ /** A command longer than any row can show, so the browser must ellipsize it
106
+ * (its text is never pre-clipped in the header). */
107
+ const LONG_COMMAND = `bun test ${'--filter '.repeat(14)}`;
107
108
  const LONG_COMMAND_TOOL: ToolCallData = {
108
109
  id: 'tui-long',
109
110
  type: 'bash',
110
111
  name: 'bash',
111
112
  title: 'Bash',
112
113
  status: 'success',
113
- command: `bun test ${'--filter '.repeat(14)}`,
114
- detail: `bun test ${'--filter '.repeat(14)}`,
115
- input: { command: `bun test ${'--filter '.repeat(14)}` },
114
+ command: LONG_COMMAND,
115
+ detail: LONG_COMMAND,
116
+ input: { command: LONG_COMMAND },
116
117
  output: '',
117
118
  } as ToolCallData;
118
119
 
@@ -172,19 +173,21 @@ describe('the tui style', () => {
172
173
  expect(head(el).querySelector('.sr-only')?.textContent).toBe('Done');
173
174
  });
174
175
 
175
- test('the subject hugs its clip, so the ellipsis sits beside the outcome', async () => {
176
+ test('the subject fills up to a flush-right outcome, facts and toggle', async () => {
176
177
  const el = await mount([LONG_COMMAND_TOOL]);
177
178
  const children = Array.from(head(el).children) as HTMLElement[];
178
179
  const subject = children.find((node) => node.className.includes('text-meta'));
179
180
  if (!subject) throw new Error('no subject span in the head');
180
- // A pre-clipped subject already ends in `…`; a growing box (`flex-1`) would
181
- // park that ellipsis far from the outcome and facts on its right.
182
- expect(subject.className).not.toContain('flex-1');
181
+ // The subject fills the gap so the browser ellipsizes it at the trailing
182
+ // group's edge; a shrinking box left that group short of the row's edge.
183
+ expect(subject.className).toContain('flex-1');
183
184
  expect(subject.className).toContain('truncate');
184
- expect(subject.textContent?.endsWith('…')).toBe(true);
185
+ // No literal `…` from the header: the full command reaches the row.
186
+ expect(subject.textContent).toBe(LONG_COMMAND);
187
+ expect(subject.textContent?.endsWith('…')).toBe(false);
185
188
  expect(subject.nextElementSibling?.textContent).toContain('[done]');
186
- // The toggle follows the data too, instead of being pushed to the far edge.
187
- expect(children.at(-1)?.className).not.toContain('ml-auto');
189
+ // The toggle is pinned to the right edge, beside the facts.
190
+ expect(children.at(-1)?.className).toContain('ml-auto');
188
191
  });
189
192
 
190
193
  test('title and subject are different colours', async () => {
@@ -144,7 +144,7 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
144
144
  aria-label={
145
145
  canToggle ? toolToggleLabel(view.header.title, view.subtitle, isExpanded) : undefined
146
146
  }
147
- className={`flex min-w-0 flex-1 flex-nowrap items-baseline gap-x-1 rounded px-1 py-0.5 text-left text-[12px] leading-[1.55] transition-colors ${
147
+ className={`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-1 gap-y-0 rounded px-1 py-0.5 text-left text-[12px] leading-[1.55] transition-colors ${
148
148
  canToggle ? 'cursor-pointer hover:bg-ink/[0.03]' : 'cursor-default'
149
149
  } focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
150
150
  >
@@ -156,12 +156,11 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
156
156
  {view.subtitle && (
157
157
  <>
158
158
  <span className="shrink-0 text-ink/25">:</span>
159
- {/* The subject HUGS its text instead of growing (`flex-1`): a
160
- pre-clipped command already ends in `…`, and a growing box
161
- parked that ellipsis far from the outcome and facts on its
162
- right. A long subject still shrinks and CSS-ellipsizes at the
163
- box edge, so the ellipsis always sits beside the data. */}
164
- <span className="min-w-0 shrink truncate font-mono text-[10.5px] text-meta">{view.subtitle}</span>
159
+ {/* The subject FILLS the gap up to the trailing group, which is
160
+ flush right; the browser ellipsizes it at that group's edge.
161
+ The row must not pre-clip the text (a literal `…` sat far
162
+ from `[done]` and left the group short of the row's edge). */}
163
+ <span className="min-w-0 flex-1 truncate font-mono text-[10.5px] text-meta">{view.subtitle}</span>
165
164
  </>
166
165
  )}
167
166
  <span className={`shrink-0 font-semibold ${tone}`}>{`[${status.word.toLowerCase()}]`}</span>
@@ -180,7 +179,7 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
180
179
  </span>
181
180
  )}
182
181
  {canToggle && (
183
- <span className="shrink-0 pl-1 text-ink/40" aria-hidden="true">
182
+ <span className="ml-auto shrink-0 pl-1 text-ink/40" aria-hidden="true">
184
183
  {isExpanded ? '▾' : '▸'}
185
184
  </span>
186
185
  )}