@kabmo-labs/kabmo 0.55.0 → 0.56.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 (135) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +466 -466
  3. package/dist/client/static/js/{Body-a4dwe3hh.js → Body-jfy4bhk2.js} +1 -1
  4. package/dist/client/static/js/{CsvGrid-ppj80brw.js → CsvGrid-4c5t668z.js} +1 -1
  5. package/dist/client/static/js/{DocxView-ef0bd2pg.js → DocxView-3x7whtvq.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-44tpkzbd.js → DrawioView-tbkc5dfz.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-w654aykz.js → HtmlPreview-egxkayya.js} +1 -1
  8. package/dist/client/static/js/{ImageView-kg0skt5s.js → ImageView-swhzvw2p.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-qepkrtd8.js → LayoutWrapper-sangsrt5.js} +2 -2
  10. package/dist/client/static/js/MergeDiffView-bv00y63x.js +1 -0
  11. package/dist/client/static/js/{Modal-8d299emm.js → Modal-1fj8kvme.js} +7 -7
  12. package/dist/client/static/js/{PdfView-eq7fnqa2.js → PdfView-0k2egsbz.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-tedh2es3.js → SessionsView-t547rqeb.js} +1 -1
  14. package/dist/client/static/js/{SheetView-5xm33kgk.js → SheetView-anb3gavm.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-tp1m8r4t.js → SvgPreview-e2wrj2hj.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-xppr9jf1.js → abnfDiagram-O67JEVCF-0rs86b68.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-s23e6vtk.js → architectureDiagram-NJMV4G6O-0k3zzxz1.js} +3 -3
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-7ws8yq9e.js → blockDiagram-BEXU5L5S-t1n1fx96.js} +1 -1
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-517yhfzj.js → c4Diagram-YGBWAQC7-93b7eds9.js} +1 -1
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tcad3rst.js → classDiagram-v2-NBCMYWYE-bnf85z0f.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-a76vf82p.js → cose-bilkent-JH36ORCC-e290161f.js} +1 -1
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-9kety453.js → cynefinDiagram-VND7K2PF-s13ra9ag.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-6g6gsp6b.js → dagre-6A5THRUB-83wshh5e.js} +1 -1
  24. package/dist/client/static/js/{diagram-22UHCM2B-ngj4fyg3.js → diagram-22UHCM2B-ywh4wqna.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-xw2m99qa.js → diagram-3UASUU5V-cb53z698.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-hz3bd083.js → diagram-ATOU4E4O-btf55c44.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-vfhtemve.js → diagram-CDSNMT55-p6tbbm1n.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-22cjvj5g.js → diagram-MLGK6HIB-6kzssf4y.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-xv8fsecp.js → diagram-MPIPVDR6-4v0yncvv.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-491tyqmj.js → dockerfile-r422htmd.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-m6mkn986.js → ebnfDiagram-ZINNZB2B-mw1gh30z.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-jccw706n.js → elk-276RUBZZ-1pe786ap.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-rxk86jsf.js → erDiagram-OPXOYQCR-x7rk70q6.js} +1 -1
  34. package/dist/client/static/js/flowDiagram-KWPJA3E3-kfwaac44.js +1 -0
  35. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-veweech7.js → ganttDiagram-FUAMR5RP-j3m5km4p.js} +1 -1
  36. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-7dyqcj8r.js → gitGraphDiagram-X574FWY7-fd1kebdy.js} +1 -1
  37. package/dist/client/static/js/{index-wa234c7k.js → index-004x0a3p.js} +1 -1
  38. package/dist/client/static/js/{index-637my5h0.js → index-0mhxw0a1.js} +1 -1
  39. package/dist/client/static/js/{index-dg714jam.js → index-22frp78d.js} +1 -1
  40. package/dist/client/static/js/{index-trpn9gxs.js → index-29b1ysz6.js} +1 -1
  41. package/dist/client/static/js/{index-bfy437re.js → index-3hrvhyym.js} +1 -1
  42. package/dist/client/static/js/{index-3x88fxzj.js → index-3k45gspr.js} +1 -1
  43. package/dist/client/static/js/{index-bhst1c2x.js → index-473wm10a.js} +1 -1
  44. package/dist/client/static/js/{index-d9dz0wt0.js → index-4acka5fn.js} +1 -1
  45. package/dist/client/static/js/{index-sx5x2q80.js → index-4dzvjfkd.js} +1 -1
  46. package/dist/client/static/js/{index-pqmvhqmj.js → index-4fpyzg5e.js} +7 -7
  47. package/dist/client/static/js/{index-xm3691yp.js → index-4jg10xtp.js} +1 -1
  48. package/dist/client/static/js/{index-0qmpqtp2.js → index-4nyajpeg.js} +1 -1
  49. package/dist/client/static/js/{index-4m94cbms.js → index-5fxm2tpg.js} +1 -1
  50. package/dist/client/static/js/{index-kfcpkx7h.js → index-72v57e07.js} +1 -1
  51. package/dist/client/static/js/{index-39mr4tym.js → index-7tsdw8wt.js} +1 -1
  52. package/dist/client/static/js/{index-0ak5wdz1.js → index-8e66p2a7.js} +1 -1
  53. package/dist/client/static/js/{index-7ehep28z.js → index-8n4qwd64.js} +2 -2
  54. package/dist/client/static/js/{index-2cfw7wem.js → index-bnamrpm6.js} +1 -1
  55. package/dist/client/static/js/{index-twjq786a.js → index-bxhszdcz.js} +1 -1
  56. package/dist/client/static/js/{index-e6tjaccf.js → index-cbbwq25c.js} +1 -1
  57. package/dist/client/static/js/{index-xq78fj64.js → index-dfha2z56.js} +1 -1
  58. package/dist/client/static/js/{index-r51fqzb5.js → index-drsy400d.js} +1 -1
  59. package/dist/client/static/js/{index-4kchzh9y.js → index-e4yj4kbe.js} +8 -8
  60. package/dist/client/static/js/{index-zjc8yfbe.js → index-g84dwmvr.js} +1 -1
  61. package/dist/client/static/js/index-gedsa0z7.css +1 -0
  62. package/dist/client/static/js/{index-x3g8fwkc.js → index-hge0y4vn.js} +2 -2
  63. package/dist/client/static/js/{index-cz80n8yc.js → index-hgsjynb0.js} +1 -1
  64. package/dist/client/static/js/{index-2asa0faw.js → index-j1prebvy.js} +2 -2
  65. package/dist/client/static/js/{index-wp7tsava.js → index-jbaceghb.js} +1 -1
  66. package/dist/client/static/js/{index-na95tr1k.js → index-jtyzeynv.js} +2 -2
  67. package/dist/client/static/js/{index-tk1vr8q2.js → index-kbk0vmex.js} +4 -4
  68. package/dist/client/static/js/{index-0xh8402w.js → index-q178zgxp.js} +1 -1
  69. package/dist/client/static/js/{index-gsw1zh30.js → index-q4t5j3x7.js} +1 -1
  70. package/dist/client/static/js/{index-xbvjpa60.js → index-qdabc51h.js} +3 -3
  71. package/dist/client/static/js/{index-7ckzdf4r.js → index-qrwjxqdh.js} +168 -168
  72. package/dist/client/static/js/{index-j0qt8gaj.js → index-rm5b3kn8.js} +1 -1
  73. package/dist/client/static/js/{index-nzjc24v9.js → index-s4v3vcsn.js} +1 -1
  74. package/dist/client/static/js/{index-wvqwzgpx.js → index-s6nv35dv.js} +1 -1
  75. package/dist/client/static/js/{index-088gwjbz.js → index-satnfvaz.js} +1 -1
  76. package/dist/client/static/js/{index-60fjqzdw.js → index-tcp5cp53.js} +1 -1
  77. package/dist/client/static/js/{index-5701gj1f.js → index-zkef5q39.js} +1 -1
  78. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ksz9cvq3.js → infoDiagram-VRGFBTTK-1m0br602.js} +1 -1
  79. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-g8symmrp.js → ishikawaDiagram-OU5B5YK6-zryzhpq6.js} +1 -1
  80. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qs2e3hdf.js → journeyDiagram-ZHPQQLJL-6apqr7h4.js} +1 -1
  81. package/dist/client/static/js/{kanban-definition-PNTS6WVX-pzef80sz.js → kanban-definition-PNTS6WVX-am385c1e.js} +1 -1
  82. package/dist/client/static/js/{mermaid.core-chfcvkkc.js → mermaid.core-k937exrm.js} +2 -2
  83. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-sds2e243.js → mindmap-definition-NLK3R4M7-hx8qq866.js} +1 -1
  84. package/dist/client/static/js/one-dark-pro-phxqe9mx.js +1 -0
  85. package/dist/client/static/js/one-light-vhwh499y.js +1 -0
  86. package/dist/client/static/js/{pegDiagram-GJSIUBJH-m8199cy0.js → pegDiagram-GJSIUBJH-1hasj2h7.js} +1 -1
  87. package/dist/client/static/js/{pieDiagram-5QR66LMP-wqz5k5w6.js → pieDiagram-5QR66LMP-x5nwff8r.js} +1 -1
  88. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-rjszd8an.js → quadrantDiagram-O4NWA36T-gmrcr5jb.js} +1 -1
  89. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-qv0be7dh.js → railroadDiagram-XR7U4H2S-rdznfhfb.js} +1 -1
  90. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b87kqbr7.js → requirementDiagram-PLB6GJNP-v9wb3ppf.js} +1 -1
  91. package/dist/client/static/js/{rust-m7ma3tq9.js → rust-9cgnbbcs.js} +1 -1
  92. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-dh5we479.js → sankeyDiagram-IPEJSGJF-3p4ddd2h.js} +1 -1
  93. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-e6fg0x45.js → sequenceDiagram-PO4LG4MO-wfcqxjfq.js} +1 -1
  94. package/dist/client/static/js/{sizeCapture-INFHLROL-mam6cagq.js → sizeCapture-INFHLROL-g02k0k8x.js} +1 -1
  95. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-htwar22v.js → stateDiagram-v2-GCMORJYK-7k449yvg.js} +1 -1
  96. package/dist/client/static/js/{swimlanes-2SLR337P-5g26cnkr.js → swimlanes-2SLR337P-zkf2bgm8.js} +1 -1
  97. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-rseba3zs.js → swimlanesDiagram-TC7HE7FX-yex8g4fx.js} +1 -1
  98. package/dist/client/static/js/{timeline-definition-EJHVYXUP-5km8n8mj.js → timeline-definition-EJHVYXUP-qsfpjr1c.js} +1 -1
  99. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0vt6ms5g.js → usecaseDiagram-POWQR4AR-b2vprhsr.js} +1 -1
  100. package/dist/client/static/js/{vennDiagram-UO4OBE2U-k425105a.js → vennDiagram-UO4OBE2U-x0ffeg2t.js} +1 -1
  101. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-s0gd4jg1.js → wardleyDiagram-VNRHLVJA-hsnhaf4f.js} +1 -1
  102. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-2nrdzp7p.js → xychartDiagram-PMCCYNJV-90f9aadp.js} +1 -1
  103. package/package.json +3 -3
  104. package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +1 -1
  105. package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +5 -3
  106. package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +41 -21
  108. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +16 -3
  109. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +105 -2
  110. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +59 -8
  111. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.test.tsx +0 -13
  112. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.tsx +6 -23
  113. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.test.ts +1 -39
  114. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts +11 -46
  115. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +36 -1
  116. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +10 -5
  117. package/src/client/hooks/chat/timeline/ask-frame-buckets.ts +14 -4
  118. package/src/client/hooks/chat/timeline/ask-frames-context.ts +3 -1
  119. package/src/client/hooks/chat/timeline/ask-frames-grouped.test.ts +31 -0
  120. package/src/client/hooks/chat/timeline/ask-frames.ts +12 -3
  121. package/src/client/hooks/chat/timeline/send-props.ts +1 -2
  122. package/src/server/lib/harness/acp/client-capabilities.test.ts +3 -2
  123. package/src/server/lib/sessions/last-opened.server.test.ts +26 -7
  124. package/src/server/lib/sessions/last-opened.server.ts +19 -4
  125. package/src/shared/lib/chat/ask-questions.test.ts +29 -0
  126. package/src/shared/lib/chat/ask-questions.ts +44 -3
  127. package/src/shared/lib/chat/ask-results.test.ts +66 -0
  128. package/src/shared/lib/chat/ask-results.ts +58 -0
  129. package/src/shared/lib/chat/timeline/block-chrome.ts +4 -4
  130. package/tsconfig.json +6 -0
  131. package/dist/client/static/js/MergeDiffView-n2h8vv0j.js +0 -1
  132. package/dist/client/static/js/flowDiagram-KWPJA3E3-aegwx04w.js +0 -1
  133. package/dist/client/static/js/index-4m2d73m3.css +0 -1
  134. package/dist/client/static/js/one-dark-pro-5fvhpb1t.js +0 -1
  135. package/dist/client/static/js/one-light-pwj40vbr.js +0 -1
@@ -49,6 +49,17 @@ interface GroupedAskProps {
49
49
  */
50
50
  submitted?: { id: string; selectedOptions: string[]; customInput?: string }[] | null;
51
51
  onRespond: (response: ExtensionDialogResponse) => void;
52
+ /**
53
+ * An ACP ask answers by sending a prompt, not by replying to a frame. These
54
+ * flags let the same card lock while that send is on the wire, hide the
55
+ * omp-only Dismiss button, and label the action for what it does.
56
+ */
57
+ busy?: boolean;
58
+ readOnly?: boolean;
59
+ dismissible?: boolean;
60
+ submitLabel?: string;
61
+ /** Every question needs an answer (an ACP adapter reads one message). */
62
+ requireAll?: boolean;
52
63
  /**
53
64
  * The `pendingInteraction` slot's controls, if any.
54
65
  *
@@ -141,7 +152,7 @@ function QuestionRow({
141
152
  );
142
153
  }
143
154
 
144
- export function GroupedAsk({ frame, recorded, submitted, onRespond, interactions }: GroupedAskProps) {
155
+ export function GroupedAsk({ frame, recorded, submitted, onRespond, interactions, busy, readOnly, dismissible, submitLabel, requireAll }: GroupedAskProps) {
145
156
  const questions = useMemo(() => frame.questions ?? [], [frame.questions]);
146
157
  const [drafts, setDrafts] = useState<Record<string, Draft>>({});
147
158
 
@@ -188,9 +199,14 @@ export function GroupedAsk({ frame, recorded, submitted, onRespond, interactions
188
199
  };
189
200
  });
190
201
  const anyAnswer = answers.some((answer) => answer.selectedOptions.length > 0 || answer.customInput);
202
+ // An ACP adapter reads ONE prompt as the answer, so every question must carry
203
+ // one; omp's grouped frame keeps its original "any answer" rule.
204
+ const everyAnswer = answers.every((answer) => answer.selectedOptions.length > 0 || answer.customInput);
205
+ const ready = requireAll ? everyAnswer : anyAnswer;
191
206
  // Every question carries an answer once a submit is in flight, so the card
192
207
  // stops drawing controls and shows what was sent.
193
208
  const settled = submitted !== null && questions.every((question, index) => answerFor(question, index) !== null);
209
+ const locked = settled || busy === true || readOnly === true;
194
210
 
195
211
  return (
196
212
  <div className="space-y-2">
@@ -202,31 +218,35 @@ export function GroupedAsk({ frame, recorded, submitted, onRespond, interactions
202
218
  total={questions.length}
203
219
  draft={draftFor(question)}
204
220
  answer={answerFor(question, index)}
205
- locked={settled}
221
+ locked={locked}
206
222
  onToggle={(label) => toggle(question, label)}
207
223
  onText={(value) => setText(question, value)}
208
224
  />
209
225
  ))}
210
226
  {interactions}
211
- <div className="flex items-center justify-end gap-2">
212
- <button
213
- type="button"
214
- disabled={settled}
215
- onClick={() => onRespond({ cancelled: true })}
216
- className="cursor-pointer rounded-md border border-ink/15 px-3 py-1 text-[11.5px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:text-ink disabled:cursor-default disabled:opacity-40"
217
- >
218
- Dismiss
219
- </button>
220
- <button
221
- type="button"
222
- disabled={!anyAnswer || settled}
223
- onClick={() => onRespond({ answers })}
224
- className="flex cursor-pointer items-center gap-1.5 rounded-md bg-ink px-3 py-1 text-[11.5px] font-semibold text-paper transition-opacity hover:opacity-90 disabled:opacity-40"
225
- >
226
- <CornerDownLeft size={11} />
227
- <span>Submit answers</span>
228
- </button>
229
- </div>
227
+ {readOnly !== true && (
228
+ <div className="flex items-center justify-end gap-2">
229
+ {dismissible !== false && (
230
+ <button
231
+ type="button"
232
+ disabled={locked}
233
+ onClick={() => onRespond({ cancelled: true })}
234
+ className="cursor-pointer rounded-md border border-ink/15 px-3 py-1 text-[11.5px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:text-ink disabled:cursor-default disabled:opacity-40"
235
+ >
236
+ Dismiss
237
+ </button>
238
+ )}
239
+ <button
240
+ type="button"
241
+ disabled={!ready || locked}
242
+ onClick={() => onRespond({ answers })}
243
+ className="flex cursor-pointer items-center gap-1.5 rounded-md bg-ink px-3 py-1 text-[11.5px] font-semibold text-paper transition-opacity hover:opacity-90 disabled:opacity-40"
244
+ >
245
+ <CornerDownLeft size={11} />
246
+ <span>{submitLabel ?? 'Submit answers'}</span>
247
+ </button>
248
+ </div>
249
+ )}
230
250
  </div>
231
251
  );
232
252
  }
@@ -15,7 +15,7 @@
15
15
  * both of omp's shapes.
16
16
  */
17
17
 
18
- import { Ban, CheckCircle2, Clock } from 'lucide-preact';
18
+ import { Ban, CheckCircle2, Clock, MessageSquare } from 'lucide-preact';
19
19
  import type { ComponentChildren } from 'preact';
20
20
  import type { ExtensionUiDialogRequest } from '@kabmo-labs/kabmo-chat/contracts/agent';
21
21
  import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-form/types';
@@ -40,6 +40,12 @@ interface QuestionBlockProps {
40
40
  * anything.
41
41
  */
42
42
  settled: boolean;
43
+ /**
44
+ * Where an unanswered question is answered. ACP ask tools have no dialog:
45
+ * their adapter reads the next user message, so the card names the composer
46
+ * instead of promising a control it cannot draw.
47
+ */
48
+ answerChannel?: 'dialog' | 'message';
43
49
  /** Labels toggled locally on a multi-select question. */
44
50
  multiSelected: string[];
45
51
  /**
@@ -69,6 +75,7 @@ export function QuestionBlock({
69
75
  draft,
70
76
  passed,
71
77
  settled,
78
+ answerChannel = 'dialog',
72
79
  multiSelected,
73
80
  interactions,
74
81
  onAnswer,
@@ -143,8 +150,14 @@ export function QuestionBlock({
143
150
  ))}
144
151
  {/* "Waiting for the previous answer" is only true while the ask
145
152
  is still running: once it settles nothing is being asked, and
146
- the question was abandoned unanswered. */}
147
- {settled ? (
153
+ the question was abandoned unanswered. An ACP ask never has a
154
+ dialog at all, so it names the channel that actually works. */}
155
+ {answerChannel === 'message' ? (
156
+ <div className="flex items-center gap-1.5 pt-0.5 text-[10.5px] text-ink/40">
157
+ <MessageSquare size={10} className="shrink-0" />
158
+ <span>This harness has no inline control for this question.</span>
159
+ </div>
160
+ ) : settled ? (
148
161
  <div className="flex items-center gap-1.5 pt-0.5 text-[10.5px] text-ink/40">
149
162
  <Ban size={10} className="shrink-0" />
150
163
  <span>Not answered: the ask was cut short.</span>
@@ -53,9 +53,20 @@ function mountFromFrame(frame: IncomingExtensionUiRequest): ExtensionUiDialogReq
53
53
  }
54
54
 
55
55
  /** Mount the card with an explicit frame queue and tool, keeping it mounted. */
56
- function paint(queue: ExtensionUiDialogRequest[], tool: ToolCallData = ASK_TOOL): void {
56
+ function paint(
57
+ queue: ExtensionUiDialogRequest[],
58
+ tool: ToolCallData = ASK_TOOL,
59
+ harness?: string,
60
+ ): void {
57
61
  const split = splitAskFrames([MESSAGE], queue, true);
58
- const handle: AskFramesHandle = { framesByTool: split.framesByTool, looseByTool: split.looseByTool, orphanAsks: [], formByTool: new Map(), respond: () => {} };
62
+ const handle: AskFramesHandle = {
63
+ framesByTool: split.framesByTool,
64
+ looseByTool: split.looseByTool,
65
+ orphanAsks: [],
66
+ formByTool: new Map(),
67
+ ...(harness ? { harness } : {}),
68
+ respond: () => {},
69
+ };
59
70
  act(() => { render(h(AskFramesContext.Provider, { value: handle }, h(AskPanel, { tool })), container); });
60
71
  }
61
72
 
@@ -140,3 +151,95 @@ describe('grouped ask frame end to end', () => {
140
151
  expect(container.querySelector('[title="the warm one"]')).toBeNull();
141
152
  });
142
153
  });
154
+
155
+ describe('external ACP ask tool call', () => {
156
+ test('renders questions read-only when no elicitation frame has arrived', () => {
157
+ const external: ToolCallData = {
158
+ id: 'call-acp-ask',
159
+ type: 'other',
160
+ title: 'Run AskUserQuestion',
161
+ name: 'AskUserQuestion',
162
+ status: 'running',
163
+ input: {
164
+ questions: [{
165
+ header: 'Approach',
166
+ question: 'Which strategy?',
167
+ multiSelect: true,
168
+ options: [
169
+ { label: 'Conservative', description: 'small steps' },
170
+ { label: 'Balanced' },
171
+ ],
172
+ }],
173
+ },
174
+ };
175
+
176
+ paint([], external);
177
+
178
+ const text = container.textContent ?? '';
179
+ expect(text).toContain('Which strategy?');
180
+ expect(text).toContain('Conservative');
181
+ expect(text).toContain('small steps');
182
+ expect(text).toContain('This harness has no inline control for this question.');
183
+ expect(text).not.toContain('Waiting for the previous answer');
184
+ expect(text).not.toContain('Submit answers');
185
+ expect(text).not.toContain('Send answer');
186
+ });
187
+
188
+ test('omp-acp’s exact `ask` name is recognized as an external ask', () => {
189
+ // omp's own tool is `ask`; over ACP the only signal is the chat's harness.
190
+ paint([], ASK_TOOL, 'omp-acp');
191
+
192
+ const text = container.textContent ?? '';
193
+ expect(text).toContain('waiting for your answer.');
194
+ expect(text).toContain('This harness has no inline control for this question.');
195
+ expect(text).not.toContain('Waiting for the previous answer');
196
+ });
197
+
198
+ test('a completed external ask renders the answers its result carries', () => {
199
+ // The reported opencode/claude symptom: the answer was delivered and the
200
+ // tool completed, but the card still drew the question as unanswered.
201
+ const external: ToolCallData = {
202
+ id: 'call-acp-answered',
203
+ type: 'other',
204
+ title: 'question',
205
+ name: 'question',
206
+ status: 'success',
207
+ input: {
208
+ questions: [
209
+ { question: 'Koneksi ini buat ngoding stack apa?', options: [{ label: 'TypeScript / JS' }, { label: 'Go' }] },
210
+ { question: 'Gaya respons yang kamu mau?', options: [{ label: 'Singkat & langsung' }, { label: 'Detail' }] },
211
+ ],
212
+ },
213
+ output: 'Your questions have been answered: "Koneksi ini buat ngoding stack apa?"="TypeScript / JS", "Gaya respons yang kamu mau?"="Singkat & langsung". You can now continue with the user\'s answers in mind.',
214
+ };
215
+
216
+ paint([], external);
217
+
218
+ const text = container.textContent ?? '';
219
+ expect(text).toContain('TypeScript / JS');
220
+ expect(text).toContain('Singkat & langsung');
221
+ expect(text).not.toContain('Input needed');
222
+ expect(text).not.toContain('Send answer');
223
+ });
224
+
225
+ test('reads a single-question shape from an adapter that does not use questions[]', () => {
226
+ const external: ToolCallData = {
227
+ id: 'call-acp-single',
228
+ type: 'other',
229
+ title: 'Run ask_question',
230
+ name: 'ask_question',
231
+ status: 'success',
232
+ input: { question: 'Lanjut tes yang mana?', options: ['Image generation', 'Selesai'] },
233
+ };
234
+
235
+ paint([], external);
236
+
237
+ const text = container.textContent ?? '';
238
+ expect(text).toContain('Lanjut tes yang mana?');
239
+ expect(text).toContain('Image generation');
240
+ expect(text).toContain('Selesai');
241
+ expect(text).toContain('This harness has no inline control for this question.');
242
+ expect(text).not.toContain('Not answered: the ask was cut short.');
243
+ });
244
+ });
245
+
@@ -20,13 +20,19 @@
20
20
  * writes no result until the tool call finishes — so without the hold the card
21
21
  * redrew as unanswered (every question back to "Waiting for the previous
22
22
  * answer…") for the whole stretch the agent spent acting on the answers.
23
+ *
24
+ * An ACP agent's own ask (`ask_question`, `question`, `AskUserQuestion`, …)
25
+ * is the THIRD shape: a tool call with no dialog at all. The card draws its
26
+ * questions and names the composer, because the adapter reads the next user
27
+ * message as the answer — promising a dialog that cannot arrive left the card
28
+ * waiting forever.
23
29
  */
24
30
 
25
31
  import { useState } from 'preact/hooks';
26
32
  import { HelpCircle, XCircle } from 'lucide-preact';
27
33
  import type { ToolCallData } from '@/shared/types';
28
34
  import type { ExtensionUiDialogRequest } from '@kabmo-labs/kabmo-chat/contracts/agent';
29
- import { isAskSettled, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
35
+ import { isAskSettled, isExternalAskTool, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
30
36
  import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
31
37
  import { parseAskResult } from '@/shared/lib/chat/ask-results';
32
38
  import { useAskFrames } from '@/client/hooks/chat/timeline/ask-frames-context';
@@ -61,10 +67,21 @@ interface SubmittedAsk {
61
67
  export function AskPanel({ tool }: { tool: ToolCallData }) {
62
68
  const questions = parseAskQuestions(tool);
63
69
  const recorded = parseAskResult(tool, questions);
64
- const { framesByTool, looseByTool, formByTool, respond } = useAskFrames();
70
+ const { framesByTool, looseByTool, formByTool, harness, orphanAsks, respond } = useAskFrames();
65
71
  const groups = framesByTool.get(tool.id) ?? NO_GROUPS;
66
72
  const loose = looseByTool.get(tool.id) ?? NO_FRAMES;
67
- const settled = isAskSettled(tool);
73
+ // An ACP agent's own ask (`ask_question`, `question`, `AskUserQuestion`, …)
74
+ // reaches this card as a TOOL CALL with no extension dialog: the protocol
75
+ // has no ask frame, and the adapter reads the next user message as the
76
+ // answer. `omp-acp` may spell it exactly `ask`, so the chat's harness is the
77
+ // second half of the test. It must never enter the form/per-question paths,
78
+ // which wait for frames that cannot arrive.
79
+ const externalAsk = isExternalAskTool(tool)
80
+ || (harness !== undefined && harness !== 'omp-rpc'
81
+ && (typeof tool.name === 'string' ? tool.name : '').toLowerCase() === 'ask');
82
+ // A completed ACP call already took the next message as its answer; only
83
+ // omp's `success` is ambiguous (a reloaded mid-ask call reads back as one).
84
+ const settled = isAskSettled(tool) || (externalAsk && tool.status === 'success');
68
85
  // omp 19.1.0's whole-form dialog answers every control in ONE `{ data }`
69
86
  // reply; it is not part of the per-field walk at all.
70
87
  const formFrame = formByTool.get(tool.id) ?? null;
@@ -73,8 +90,10 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
73
90
  // restored draft the moment its frame arrives, which would answer question 1
74
91
  // before the user could reach the form's Submit.
75
92
  const groupedForm =
76
- !formFrame && !settled && questions.length > 1 && recorded.some((answer) => answer === null);
93
+ !externalAsk && !formFrame && !settled && questions.length > 1 && recorded.some((answer) => answer === null);
77
94
  const [submitted, setSubmitted] = useState<SubmittedAsk | null>(null);
95
+ const [externalSent, setExternalSent] = useState(false);
96
+ const [externalDismissed, setExternalDismissed] = useState(false);
78
97
  const { drafts, multiSelected, commit, toggleMulti } = useAskDrafts({
79
98
  toolId: tool.id,
80
99
  questions: groupedForm ? NO_QUESTIONS : questions,
@@ -100,11 +119,17 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
100
119
  // question must stay answerable.
101
120
  const waiting =
102
121
  !settled &&
103
- (formFrame !== null || groups.some((frames, index) => frames.length > 0 && !recorded[index]));
122
+ (externalAsk
123
+ ? !externalSent && !externalDismissed && recorded.some((answer) => answer === null)
124
+ : formFrame !== null || groups.some((frames, index) => frames.length > 0 && !recorded[index]));
104
125
  // omp asks in order and blocks on each, so the earliest question holding a
105
126
  // dialog is the only open one: everything before it is answered, whether or
106
127
  // not this client still has the text.
107
128
  const askingIndex = groups.findIndex((frames) => frames.length > 0);
129
+ const recordedAll = recorded.length > 0 && recorded.every((answer) => answer !== null);
130
+ // An elicitation with no usable toolCallId is drawn as an orphan at the end
131
+ // of the timeline. Point the tool card there instead of leaving it silent.
132
+ const questionElsewhere = externalAsk && orphanAsks.some((frame) => frame.toolCallId === tool.id);
108
133
 
109
134
  // A GROUPED ask (`method:"ask"`) covers every question at once, so it renders
110
135
  // its own card instead of one control per question. `splitAskFrames` places
@@ -121,13 +146,25 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
121
146
  const heldFrame = submitted && recorded.every((answer) => answer === null) ? submitted.frame : null;
122
147
  const card = groupedFrame ?? heldFrame;
123
148
 
124
- if (card && !settled) {
149
+ // A pending ACP elicitation outranks the tool status: the frame is what the
150
+ // agent is actually blocked on, even if the adapter marked the call done.
151
+ if (card && (!settled || externalAsk)) {
125
152
  const answered = submitted && submitted.frame.id === card.id ? submitted.answers : null;
126
153
  // The recorded flags and the answer path are shared with the plugin slot:
127
154
  // a plugin's response must be the frame the Submit button would have sent,
128
155
  // through the same sender, or omp receives something it did not expect.
129
156
  const answer = (response: ExtensionDialogResponse) => {
130
- if ('answers' in response) setSubmitted({ frame: card, answers: response.answers });
157
+ if ('answers' in response) {
158
+ setSubmitted({ frame: card, answers: response.answers });
159
+ // An ACP elicitation took the answer: its frame leaves the queue as
160
+ // soon as the JSON-RPC result is on the wire, so the banner must not
161
+ // keep claiming the agent is blocked.
162
+ if (externalAsk) setExternalSent(true);
163
+ } else if ('cancelled' in response && externalAsk) {
164
+ // The elicitation was declined. Its frame is gone, so the card must not
165
+ // fall through to the prompt fallback as if it still had a question.
166
+ setExternalDismissed(true);
167
+ }
131
168
  respond(card, response);
132
169
  };
133
170
  return (
@@ -138,11 +175,16 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
138
175
  <span>Input needed: the agent is blocked until you answer.</span>
139
176
  </div>
140
177
  )}
178
+ {externalSent && !settled && (
179
+ <p className="text-[10.5px] text-ink/45">Answer sent — the agent is continuing…</p>
180
+ )}
141
181
  <GroupedAsk
142
182
  frame={card}
143
183
  recorded={recorded}
144
184
  submitted={answered}
145
185
  onRespond={answer}
186
+ readOnly={externalAsk && (answered !== null || recordedAll)}
187
+ submitLabel={externalAsk ? 'Send answer' : undefined}
146
188
  interactions={
147
189
  <PluginPendingInteractions
148
190
  frame={card}
@@ -224,10 +266,18 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
224
266
  {waiting && (
225
267
  <div className="flex items-center gap-1.5 text-[10.5px] text-ink/50">
226
268
  <HelpCircle size={11} className="shrink-0" />
227
- <span>Input needed: the agent is blocked until you answer.</span>
269
+ <span>
270
+ {externalAsk
271
+ ? 'Input needed: the agent is waiting for your answer.'
272
+ : 'Input needed: the agent is blocked until you answer.'}
273
+ </span>
228
274
  </div>
229
275
  )}
230
276
 
277
+ {questionElsewhere && (
278
+ <p className="text-[10.5px] text-ink/45">The agent's question is shown at the end of the timeline.</p>
279
+ )}
280
+
231
281
  {questions.map((question, index) => {
232
282
  const live = liveFrame(groups, index);
233
283
  const answer = (response: ExtensionDialogResponse) => {
@@ -244,6 +294,7 @@ export function AskPanel({ tool }: { tool: ToolCallData }) {
244
294
  draft={drafts[index]}
245
295
  passed={askingIndex !== -1 && index < askingIndex}
246
296
  settled={settled}
297
+ answerChannel={externalAsk ? 'message' : 'dialog'}
247
298
  multiSelected={multiSelected[index] ?? NO_LABELS}
248
299
  onAnswer={(value) => commit(index, value)}
249
300
  onToggle={(label) => toggleMulti(index, label)}
@@ -51,17 +51,4 @@ describe('AgentAdmin panel', () => {
51
51
  expect(text).toContain('8b46…/task-23');
52
52
  expect(text).toContain('did not report a result');
53
53
  });
54
-
55
- test('draws a question read-only with its options and answer channel', () => {
56
- const text = paint(agentTool({
57
- name: 'ask_question',
58
- status: 'running',
59
- input: { questions: [{ question: 'Probe question?', options: ['A', 'B'] }] },
60
- }));
61
- expect(text).toContain('Question');
62
- expect(text).toContain('Probe question?');
63
- expect(text).toContain('A');
64
- expect(text).toContain('B');
65
- expect(text).toContain('next message as the answer');
66
- });
67
54
  });
@@ -7,15 +7,13 @@
7
7
  * The card for the agent's own control plane.
8
8
  *
9
9
  * `agent_admin` is the renderer family for tools that manipulate the agent
10
- * (background tasks, subagents, schedules, messages, its own questions), which
11
- * antigravity sends with no result payload. The card therefore draws the
12
- * ARGUMENTS as structure — action, target, brief, question options — and says
13
- * when a result was not reported, instead of rendering a guessed Bash/Task body
14
- * or an unreadable JSON document.
10
+ * (background tasks, subagents, schedules, messages), which antigravity sends
11
+ * with no result payload. The card therefore draws the ARGUMENTS as structure —
12
+ * action, target, brief — and says when a result was not reported, instead of
13
+ * rendering a guessed Bash/Task body or an unreadable JSON document.
15
14
  *
16
- * `ask_question` is not answerable here: ACP sends no dialog frame for it and
17
- * the adapter takes the next user message as the answer (measured on 1.5.3).
18
- * The options are shown read-only and the note names the real channel.
15
+ * The agent's ask is NOT one of these verbs: it has its own card (`ask-panel`),
16
+ * which is the one place the questions and their answer channel are drawn.
19
17
  */
20
18
 
21
19
  import type { ToolCallData } from '@/shared/types';
@@ -38,21 +36,6 @@ export function AgentAdmin({ tool }: { tool: ToolCallData }) {
38
36
  )}
39
37
  </div>
40
38
 
41
- {view.questions.map((question, index) => (
42
- <div key={index} className="rounded-lg border border-ink/8 bg-paper px-2.5 py-2">
43
- <div className="text-[11.5px] leading-relaxed text-ink select-text">{question.question}</div>
44
- {question.options.length > 0 && (
45
- <div className="mt-1.5 flex flex-wrap gap-1">
46
- {question.options.map((option) => (
47
- <span key={option} className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/60">
48
- {option}
49
- </span>
50
- ))}
51
- </div>
52
- )}
53
- </div>
54
- ))}
55
-
56
39
  {view.fields.map((field) => (
57
40
  field.block ? (
58
41
  <div key={field.label} className="space-y-1">
@@ -69,44 +69,6 @@ describe('agentAdminView', () => {
69
69
  expect(view.fields[1]).toEqual({ label: 'Prompt', value: 'Remind me.', block: true });
70
70
  });
71
71
 
72
- test('ask_question draws its questions read-only and names the answer channel', () => {
73
- const view = agentAdminView(tool({
74
- name: 'ask_question',
75
- status: 'running',
76
- input: { questions: [{ question: 'Probe question?', options: ['A', 'B'] }] },
77
- }));
78
- expect(view.questions).toEqual([{ question: 'Probe question?', options: ['A', 'B'] }]);
79
- expect(view.note).toBe('The agent waits for your next message as the answer.');
80
- });
81
-
82
- test('opencode’s `question` spelling draws the same read-only questions', () => {
83
- const view = agentAdminView(tool({
84
- name: 'question',
85
- status: 'running',
86
- input: {
87
- questions: [{
88
- header: 'Heavy tool tests',
89
- question: 'Lanjut tes yang mana?',
90
- multiple: true,
91
- options: [{ label: 'Image generation', description: 'Generate one test image' }, { label: 'Selesai' }],
92
- }],
93
- },
94
- }));
95
- expect(view.title).toBe('Question');
96
- expect(view.questions).toEqual([{ question: 'Lanjut tes yang mana?', options: ['Image generation', 'Selesai'] }]);
97
- expect(view.note).toBe('The agent waits for your next message as the answer.');
98
- });
99
-
100
- test('a settled ask makes no claim about the answer', () => {
101
- // The next user message is the answer channel, so the card cannot know
102
- // whether one arrived; it must not assert that the question went unanswered.
103
- const view = agentAdminView(tool({
104
- name: 'ask_question',
105
- input: { questions: [{ question: 'Probe question?', options: [] }] },
106
- }));
107
- expect(view.note).toBeUndefined();
108
- });
109
-
110
72
  test('an unknown argument is printed under its own humanized key', () => {
111
73
  const view = agentAdminView(tool({ name: 'send_message', input: { SomeOtherField: { a: 1 } } }));
112
74
  expect(view.fields).toEqual([{ label: 'Some Other Field', value: '{\n "a": 1\n}' }]);
@@ -114,6 +76,6 @@ describe('agentAdminView', () => {
114
76
 
115
77
  test('a call with no arguments still renders', () => {
116
78
  const view = agentAdminView(tool({ name: 'manage_subagents' }));
117
- expect(view).toMatchObject({ title: 'Subagent', questions: [], fields: [] });
79
+ expect(view).toMatchObject({ title: 'Subagent', fields: [] });
118
80
  });
119
81
  });
@@ -8,10 +8,13 @@
8
8
  * manage the agent itself.
9
9
  *
10
10
  * Measured on `agy acp` 1.5.3: `manage_task`, `manage_subagents`,
11
- * `define_subagent`, `send_message`, `schedule` and `ask_question` arrive as
12
- * `kind:"other"` with capitalised argument keys (`Action`, `Prompt`, `Role`, …)
13
- * and NO result payload. They were left to the JSON fallback, which hid the one
14
- * fact the call carries — its action and target — behind a raw document.
11
+ * `define_subagent`, `send_message` and `schedule` arrive as `kind:"other"`
12
+ * with capitalised argument keys (`Action`, `Prompt`, `Role`, …) and NO result
13
+ * payload. They were left to the JSON fallback, which hid the one fact the
14
+ * call carries — its action and target — behind a raw document.
15
+ *
16
+ * The agent's ask (`ask_question`, opencode's `question`) is not here: it has
17
+ * its own card, which draws the questions and names the answer channel.
15
18
  *
16
19
  * The normalizer is pure so the panel is presentation only. It reads the
17
20
  * adapter's spelling, never invents a field: a result the agent did not report
@@ -27,17 +30,11 @@ export interface AgentAdminField {
27
30
  block?: boolean;
28
31
  }
29
32
 
30
- export interface AgentAdminQuestion {
31
- question: string;
32
- options: string[];
33
- }
34
-
35
33
  export interface AgentAdminView {
36
34
  /** The card's own noun ("Subagent", "Scheduled run", …). */
37
35
  title: string;
38
36
  /** The verb the call names (`list`, `kill`, `send_input`). */
39
37
  action?: string;
40
- questions: AgentAdminQuestion[];
41
38
  fields: AgentAdminField[];
42
39
  /** A sentence for a fact the adapter did not send (no result, no answer). */
43
40
  note?: string;
@@ -49,9 +46,6 @@ const TITLES: Readonly<Record<string, string>> = {
49
46
  define_subagent: 'Subagent definition',
50
47
  send_message: 'Message',
51
48
  schedule: 'Scheduled run',
52
- ask_question: 'Question',
53
- // opencode's spelling of the same control-plane verb.
54
- question: 'Question',
55
49
  };
56
50
 
57
51
  const LABELS: Readonly<Record<string, string>> = {
@@ -95,27 +89,6 @@ function asText(value: unknown): string {
95
89
  return JSON.stringify(value, null, 2) ?? '';
96
90
  }
97
91
 
98
- function readQuestions(value: unknown): AgentAdminQuestion[] {
99
- if (!Array.isArray(value)) return [];
100
- const questions: AgentAdminQuestion[] = [];
101
- for (const entry of value) {
102
- if (!entry || typeof entry !== 'object') continue;
103
- const record = entry as Record<string, unknown>;
104
- const question = typeof record.question === 'string' ? record.question.trim() : '';
105
- if (!question) continue;
106
- const options = Array.isArray(record.options)
107
- ? record.options.flatMap((option) => {
108
- if (typeof option === 'string') return option ? [option] : [];
109
- if (!option || typeof option !== 'object') return [];
110
- const label = (option as Record<string, unknown>).label;
111
- return typeof label === 'string' && label ? [label] : [];
112
- })
113
- : [];
114
- questions.push({ question, options });
115
- }
116
- return questions;
117
- }
118
-
119
92
  function humanKey(key: string): string {
120
93
  return LABELS[key] ?? key.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/_/g, ' ');
121
94
  }
@@ -126,11 +99,10 @@ export function agentAdminView(tool: ToolCallData): AgentAdminView {
126
99
  : {};
127
100
  const name = (tool.name ?? tool.type ?? '').toLowerCase();
128
101
  const action = typeof input.Action === 'string' && input.Action ? input.Action : undefined;
129
- const questions = readQuestions(input.questions);
130
102
  const collected: Array<{ key: string; field: AgentAdminField }> = [];
131
103
 
132
104
  for (const [key, value] of Object.entries(input)) {
133
- if (key === 'Action' || key === 'questions') continue;
105
+ if (key === 'Action') continue;
134
106
  if (value === undefined || value === null || value === '') continue;
135
107
  const duration = key === 'DurationSeconds' && typeof value === 'number'
136
108
  ? `${value} second${value === 1 ? '' : 's'}`
@@ -154,20 +126,13 @@ export function agentAdminView(tool: ToolCallData): AgentAdminView {
154
126
  const fields = collected.map((entry) => entry.field);
155
127
 
156
128
  const settled = tool.status === 'success' || tool.status === 'error' || tool.status === 'aborted';
157
- // A settled ask says nothing about an answer: the next user message IS the
158
- // answer channel, so the card cannot know whether one arrived.
159
- const note = name === 'ask_question' || name === 'question'
160
- ? settled
161
- ? undefined
162
- : 'The agent waits for your next message as the answer.'
163
- : settled && !tool.output
164
- ? 'The agent did not report a result for this call.'
165
- : undefined;
129
+ const note = settled && !tool.output
130
+ ? 'The agent did not report a result for this call.'
131
+ : undefined;
166
132
 
167
133
  return {
168
134
  title: TITLES[name] ?? 'Agent call',
169
135
  ...(action ? { action } : {}),
170
- questions,
171
136
  fields,
172
137
  ...(note ? { note } : {}),
173
138
  };