@kabmo-labs/kabmo 0.54.0 → 0.55.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 (130) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +445 -445
  3. package/dist/client/static/js/{Body-x5grdps8.js → Body-a4dwe3hh.js} +1 -1
  4. package/dist/client/static/js/{CsvGrid-248v9yzf.js → CsvGrid-ppj80brw.js} +1 -1
  5. package/dist/client/static/js/{DocxView-5we92k2h.js → DocxView-ef0bd2pg.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-c6xmw4qq.js → DrawioView-44tpkzbd.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-r3qxgqg6.js → HtmlPreview-w654aykz.js} +1 -1
  8. package/dist/client/static/js/{ImageView-cr4fea18.js → ImageView-kg0skt5s.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-j12z0djx.js → LayoutWrapper-qepkrtd8.js} +1 -1
  10. package/dist/client/static/js/MergeDiffView-n2h8vv0j.js +1 -0
  11. package/dist/client/static/js/{Modal-cqceypcn.js → Modal-8d299emm.js} +16 -16
  12. package/dist/client/static/js/{PdfView-xdgn31cm.js → PdfView-eq7fnqa2.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-ms6z44e2.js → SessionsView-tedh2es3.js} +1 -1
  14. package/dist/client/static/js/{SheetView-peqm9vft.js → SheetView-5xm33kgk.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-rdf4wbzr.js → SvgPreview-tp1m8r4t.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-48z2x5vg.js → abnfDiagram-O67JEVCF-xppr9jf1.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-n1pr5s6j.js → architectureDiagram-NJMV4G6O-s23e6vtk.js} +1 -1
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-p19shaft.js → blockDiagram-BEXU5L5S-7ws8yq9e.js} +1 -1
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-qcd46ts2.js → c4Diagram-YGBWAQC7-517yhfzj.js} +1 -1
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-scyhe133.js → classDiagram-v2-NBCMYWYE-tcad3rst.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-srnnj3f7.js → cose-bilkent-JH36ORCC-a76vf82p.js} +1 -1
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-1zfrnyay.js → cynefinDiagram-VND7K2PF-9kety453.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-hepk25pz.js → dagre-6A5THRUB-6g6gsp6b.js} +1 -1
  24. package/dist/client/static/js/{diagram-22UHCM2B-wy2y0323.js → diagram-22UHCM2B-ngj4fyg3.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-j904f93p.js → diagram-3UASUU5V-xw2m99qa.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-2mmxccm2.js → diagram-ATOU4E4O-hz3bd083.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-cfhk73ty.js → diagram-CDSNMT55-vfhtemve.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-ryf8j6hf.js → diagram-MLGK6HIB-22cjvj5g.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-8k5e36sd.js → diagram-MPIPVDR6-xv8fsecp.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-1e7deann.js → dockerfile-491tyqmj.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5kkbbbhv.js → ebnfDiagram-ZINNZB2B-m6mkn986.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-jqc4mzvc.js → elk-276RUBZZ-jccw706n.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-kx15t6f0.js → erDiagram-OPXOYQCR-rxk86jsf.js} +1 -1
  34. package/dist/client/static/js/flowDiagram-KWPJA3E3-aegwx04w.js +1 -0
  35. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-3hv8pej4.js → ganttDiagram-FUAMR5RP-veweech7.js} +1 -1
  36. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-a4mq8vwz.js → gitGraphDiagram-X574FWY7-7dyqcj8r.js} +1 -1
  37. package/dist/client/static/js/{index-1ye834yz.js → index-088gwjbz.js} +1 -1
  38. package/dist/client/static/js/{index-k4kwrze2.js → index-0ak5wdz1.js} +1 -1
  39. package/dist/client/static/js/{index-937bn0d2.js → index-0qmpqtp2.js} +1 -1
  40. package/dist/client/static/js/{index-40fdtqvw.js → index-0xh8402w.js} +1 -1
  41. package/dist/client/static/js/{index-0z7kerp1.js → index-2asa0faw.js} +1 -1
  42. package/dist/client/static/js/{index-w4dep7k6.js → index-2cfw7wem.js} +1 -1
  43. package/dist/client/static/js/{index-0j5ng1qc.js → index-39mr4tym.js} +1 -1
  44. package/dist/client/static/js/{index-kvker1ps.js → index-3x88fxzj.js} +1 -1
  45. package/dist/client/static/js/{index-8hnem33f.js → index-4m94cbms.js} +1 -1
  46. package/dist/client/static/js/{index-9gddw5qy.js → index-5701gj1f.js} +1 -1
  47. package/dist/client/static/js/{index-m85c740p.js → index-60fjqzdw.js} +1 -1
  48. package/dist/client/static/js/{index-exyg9sna.js → index-637my5h0.js} +1 -1
  49. package/dist/client/static/js/{index-jvn2xfpt.js → index-7ckzdf4r.js} +153 -151
  50. package/dist/client/static/js/{index-317v49ey.js → index-7ehep28z.js} +1 -1
  51. package/dist/client/static/js/{index-br27jz2t.js → index-bfy437re.js} +1 -1
  52. package/dist/client/static/js/{index-vxe4e903.js → index-bhst1c2x.js} +1 -1
  53. package/dist/client/static/js/{index-9cr6p86f.js → index-cz80n8yc.js} +1 -1
  54. package/dist/client/static/js/{index-demg0p74.js → index-d9dz0wt0.js} +1 -1
  55. package/dist/client/static/js/{index-51wzt3ma.js → index-dg714jam.js} +1 -1
  56. package/dist/client/static/js/{index-n3cts2j1.js → index-e6tjaccf.js} +1 -1
  57. package/dist/client/static/js/{index-eb43hnd3.js → index-gsw1zh30.js} +1 -1
  58. package/dist/client/static/js/{index-3kenmzbe.js → index-j0qt8gaj.js} +1 -1
  59. package/dist/client/static/js/{index-pszsxhjr.js → index-kfcpkx7h.js} +1 -1
  60. package/dist/client/static/js/{index-v90zd3sq.js → index-na95tr1k.js} +1 -1
  61. package/dist/client/static/js/{index-g3x4w48f.js → index-nzjc24v9.js} +1 -1
  62. package/dist/client/static/js/{index-n5194pe6.js → index-pqmvhqmj.js} +2 -2
  63. package/dist/client/static/js/{index-e2y4hkps.js → index-r51fqzb5.js} +1 -1
  64. package/dist/client/static/js/{index-40ydm28n.js → index-sx5x2q80.js} +1 -1
  65. package/dist/client/static/js/{index-p8bta9ae.js → index-tk1vr8q2.js} +1 -1
  66. package/dist/client/static/js/{index-x5c5yxhj.js → index-trpn9gxs.js} +1 -1
  67. package/dist/client/static/js/{index-01rdknec.js → index-twjq786a.js} +1 -1
  68. package/dist/client/static/js/{index-fanhvjk8.js → index-wa234c7k.js} +1 -1
  69. package/dist/client/static/js/{index-rtfw07hy.js → index-wp7tsava.js} +1 -1
  70. package/dist/client/static/js/{index-kz5d00m5.js → index-wvqwzgpx.js} +1 -1
  71. package/dist/client/static/js/{index-xhcbaaga.js → index-xbvjpa60.js} +2 -2
  72. package/dist/client/static/js/{index-n4pm0hrh.js → index-xm3691yp.js} +1 -1
  73. package/dist/client/static/js/{index-kevqayd9.js → index-xq78fj64.js} +1 -1
  74. package/dist/client/static/js/{index-bf54x0w8.js → index-zjc8yfbe.js} +1 -1
  75. package/dist/client/static/js/{infoDiagram-VRGFBTTK-wtnqb06v.js → infoDiagram-VRGFBTTK-ksz9cvq3.js} +1 -1
  76. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-eta0jnvr.js → ishikawaDiagram-OU5B5YK6-g8symmrp.js} +1 -1
  77. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-4e572kkp.js → journeyDiagram-ZHPQQLJL-qs2e3hdf.js} +1 -1
  78. package/dist/client/static/js/{kanban-definition-PNTS6WVX-yrtnn4zy.js → kanban-definition-PNTS6WVX-pzef80sz.js} +1 -1
  79. package/dist/client/static/js/{mermaid.core-195b0fb6.js → mermaid.core-chfcvkkc.js} +2 -2
  80. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-pphjnkvt.js → mindmap-definition-NLK3R4M7-sds2e243.js} +1 -1
  81. package/dist/client/static/js/one-dark-pro-5fvhpb1t.js +1 -0
  82. package/dist/client/static/js/one-light-pwj40vbr.js +1 -0
  83. package/dist/client/static/js/{pegDiagram-GJSIUBJH-kgffb9p3.js → pegDiagram-GJSIUBJH-m8199cy0.js} +1 -1
  84. package/dist/client/static/js/{pieDiagram-5QR66LMP-efech3mm.js → pieDiagram-5QR66LMP-wqz5k5w6.js} +1 -1
  85. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-khf9cv3t.js → quadrantDiagram-O4NWA36T-rjszd8an.js} +1 -1
  86. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-ye68kdx2.js → railroadDiagram-XR7U4H2S-qv0be7dh.js} +1 -1
  87. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-3s4smnme.js → requirementDiagram-PLB6GJNP-b87kqbr7.js} +1 -1
  88. package/dist/client/static/js/{rust-tdrnaxp3.js → rust-m7ma3tq9.js} +1 -1
  89. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-9pqd25mc.js → sankeyDiagram-IPEJSGJF-dh5we479.js} +1 -1
  90. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-rka8ct43.js → sequenceDiagram-PO4LG4MO-e6fg0x45.js} +1 -1
  91. package/dist/client/static/js/{sizeCapture-INFHLROL-g5wkzry8.js → sizeCapture-INFHLROL-mam6cagq.js} +1 -1
  92. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-gy1zab2j.js → stateDiagram-v2-GCMORJYK-htwar22v.js} +1 -1
  93. package/dist/client/static/js/{swimlanes-2SLR337P-kr35nmd2.js → swimlanes-2SLR337P-5g26cnkr.js} +1 -1
  94. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-qnhxxmjr.js → swimlanesDiagram-TC7HE7FX-rseba3zs.js} +1 -1
  95. package/dist/client/static/js/{timeline-definition-EJHVYXUP-sg151mkc.js → timeline-definition-EJHVYXUP-5km8n8mj.js} +1 -1
  96. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-f91g61p3.js → usecaseDiagram-POWQR4AR-0vt6ms5g.js} +1 -1
  97. package/dist/client/static/js/{vennDiagram-UO4OBE2U-zbhr4eqf.js → vennDiagram-UO4OBE2U-k425105a.js} +1 -1
  98. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-6302414n.js → wardleyDiagram-VNRHLVJA-s0gd4jg1.js} +1 -1
  99. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-0a47th65.js → xychartDiagram-PMCCYNJV-2nrdzp7p.js} +1 -1
  100. package/package.json +5 -5
  101. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +2 -0
  102. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.test.tsx +67 -0
  103. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.tsx +89 -0
  104. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.test.tsx +91 -0
  105. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +8 -2
  106. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +9 -0
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +16 -1
  108. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.test.tsx +59 -0
  109. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +11 -1
  110. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.test.ts +119 -0
  111. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts +174 -0
  112. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +14 -2
  113. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +22 -0
  114. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +14 -0
  115. package/src/client/data/settings/omp-schema.json +445 -165
  116. package/src/server/routes/fs/raw.test.ts +33 -0
  117. package/src/server/routes/fs/raw.ts +31 -11
  118. package/src/shared/lib/chat/timeline/tool-phrases.test.ts +4 -0
  119. package/src/shared/lib/chat/timeline/tool-phrases.ts +2 -0
  120. package/src/shared/lib/models/provider/glyph.test.ts +13 -11
  121. package/src/shared/lib/models/provider/glyph.ts +1 -0
  122. package/src/shared/lib/models/provider/label.ts +3 -0
  123. package/src/shared/lib/omp/config/schema-releases-19-3.test.ts +64 -0
  124. package/src/shared/lib/omp/config/schema-releases.test.ts +6 -4
  125. package/src/shared/lib/omp/session/wait-idle.test.ts +12 -2
  126. package/src/shared/lib/omp/session/wait-idle.ts +11 -6
  127. package/dist/client/static/js/MergeDiffView-y0we0194.js +0 -1
  128. package/dist/client/static/js/flowDiagram-KWPJA3E3-dpjz82p8.js +0 -1
  129. package/dist/client/static/js/one-dark-pro-asy2qj2p.js +0 -1
  130. package/dist/client/static/js/one-light-fya1pbbx.js +0 -1
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The agent-control card, mounted with the arguments measured on `agy acp`
8
+ * 1.5.3. The helper's own suite pins the normalization; this one proves the
9
+ * card actually paints it (the body is the only surface these calls have).
10
+ */
11
+
12
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
13
+ import { Window } from 'happy-dom';
14
+ import { h, render } from 'preact';
15
+ import { act } from 'preact/test-utils';
16
+ import { AgentAdmin } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin';
17
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
18
+ import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
19
+
20
+ let container: HTMLElement;
21
+
22
+ beforeAll(() => installDomGlobals(new Window()));
23
+ afterAll(() => restoreDomGlobals());
24
+ beforeEach(() => {
25
+ container = document.createElement('div');
26
+ document.body.appendChild(container);
27
+ });
28
+ afterEach(() => {
29
+ render(null, container);
30
+ container.remove();
31
+ });
32
+
33
+ function paint(tool: ToolCallData): string {
34
+ act(() => { render(h(AgentAdmin, { tool }), container); });
35
+ return container.textContent ?? '';
36
+ }
37
+
38
+ function agentTool(partial: Partial<ToolCallData> & Pick<ToolCallData, 'name'>): ToolCallData {
39
+ return { id: 'a1', type: 'other', title: `Run ${partial.name}`, status: 'success', ...partial } as ToolCallData;
40
+ }
41
+
42
+ describe('AgentAdmin panel', () => {
43
+ test('draws a background-task call and says the result is missing', () => {
44
+ const text = paint(agentTool({
45
+ name: 'manage_task',
46
+ input: { Action: 'kill', TaskId: '8b46…/task-23' },
47
+ }));
48
+ expect(text).toContain('Background task');
49
+ expect(text).toContain('kill');
50
+ expect(text).toContain('Task id');
51
+ expect(text).toContain('8b46…/task-23');
52
+ expect(text).toContain('did not report a result');
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
+ });
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The card for the agent's own control plane.
8
+ *
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.
15
+ *
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.
19
+ */
20
+
21
+ import type { ToolCallData } from '@/shared/types';
22
+ import { FallbackOutput } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput';
23
+ import { agentAdminView } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows';
24
+
25
+ export function AgentAdmin({ tool }: { tool: ToolCallData }) {
26
+ const view = agentAdminView(tool);
27
+
28
+ return (
29
+ <div className="space-y-2">
30
+ <div className="flex flex-wrap items-center gap-1.5">
31
+ <span className="text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/45">
32
+ {view.title}
33
+ </span>
34
+ {view.action && (
35
+ <span className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/60">
36
+ {view.action}
37
+ </span>
38
+ )}
39
+ </div>
40
+
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
+ {view.fields.map((field) => (
57
+ field.block ? (
58
+ <div key={field.label} className="space-y-1">
59
+ <div className="text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/40">
60
+ {field.label}
61
+ </div>
62
+ <pre className="max-h-64 overflow-auto rounded-lg border border-ink/8 bg-canvas/40 px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words text-ink/80 select-text">
63
+ {field.value}
64
+ </pre>
65
+ </div>
66
+ ) : (
67
+ <div key={field.label} className="flex items-start gap-2 text-[11.5px]">
68
+ <span className="w-24 shrink-0 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/40">
69
+ {field.label}
70
+ </span>
71
+ <span
72
+ className={field.mono
73
+ ? 'min-w-0 flex-1 break-all font-mono text-[11px] text-ink/80 select-text'
74
+ : 'min-w-0 flex-1 whitespace-pre-wrap text-ink/80 select-text'}
75
+ >
76
+ {field.value}
77
+ </span>
78
+ </div>
79
+ )
80
+ ))}
81
+
82
+ {view.note && (
83
+ <p className="text-[10.5px] leading-relaxed text-ink/45">{view.note}</p>
84
+ )}
85
+
86
+ {tool.output && <FallbackOutput text={tool.output} />}
87
+ </div>
88
+ );
89
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The MCP panel's two argument surfaces.
8
+ *
9
+ * The legacy `write xd://mcp__…` transport carries the call's arguments as a
10
+ * JSON string in `content`; an ACP `mcp__` call carries the same facts as a
11
+ * structured `rawInput` object. The panel read only `content`, so an ACP MCP
12
+ * call drew its header and result but never the arguments it asked with —
13
+ * measured on opencode 2.2.5, whose bare server names (`envsitter_validate`)
14
+ * now resolve to this panel.
15
+ */
16
+
17
+ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
18
+ import { Window } from 'happy-dom';
19
+ import { h, render } from 'preact';
20
+ import { act } from 'preact/test-utils';
21
+ import { Mcp } from './Mcp';
22
+ import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
23
+
24
+ const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
25
+ const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
26
+
27
+ beforeAll(() => {
28
+ const win = new Window({ url: 'http://localhost' });
29
+ const target = globalThis as unknown as Record<string, unknown>;
30
+ for (const key of DOM_GLOBALS) {
31
+ nativeGlobals[key] = target[key];
32
+ target[key] = (win as unknown as Record<string, unknown>)[key];
33
+ }
34
+ });
35
+
36
+ afterAll(() => {
37
+ const target = globalThis as unknown as Record<string, unknown>;
38
+ for (const key of DOM_GLOBALS) {
39
+ if (nativeGlobals[key] === undefined) delete target[key];
40
+ else target[key] = nativeGlobals[key];
41
+ }
42
+ });
43
+
44
+ async function mount(call: ToolCallData): Promise<HTMLElement> {
45
+ const container = document.createElement('div');
46
+ document.body.appendChild(container);
47
+ await act(async () => {
48
+ render(h(Mcp, { tool: call }), container);
49
+ });
50
+ return container;
51
+ }
52
+
53
+ function tool(partial: Partial<ToolCallData>): ToolCallData {
54
+ return {
55
+ id: 'm1',
56
+ type: 'other',
57
+ name: 'mcp__sqlite_query',
58
+ title: 'sqlite_query',
59
+ status: 'success',
60
+ ...partial,
61
+ } as ToolCallData;
62
+ }
63
+
64
+ describe('Mcp panel', () => {
65
+ test('a structured rawInput is drawn per key', async () => {
66
+ const el = await mount(tool({
67
+ name: 'envsitter_validate',
68
+ input: { filePath: '/repo/.env' },
69
+ output: '{"ok":true,"issues":[]}',
70
+ }));
71
+ const text = el.textContent ?? '';
72
+ expect(text).toContain('envsitter_validate');
73
+ expect(text).toContain('filePath');
74
+ expect(text).toContain('/repo/.env');
75
+ expect(text).toContain('ok');
76
+ });
77
+
78
+ test('the legacy write xd:// shape still parses its content JSON', async () => {
79
+ const el = await mount(tool({
80
+ type: 'write',
81
+ name: 'write',
82
+ target: 'xd://mcp__codegraph_explore',
83
+ input: { path: 'xd://mcp__codegraph_explore', content: '{"query":"tool renderers"}' },
84
+ output: '{"items":[]}',
85
+ }));
86
+ const text = el.textContent ?? '';
87
+ expect(text).toContain('codegraph_explore');
88
+ expect(text).toContain('query');
89
+ expect(text).toContain('tool renderers');
90
+ });
91
+ });
@@ -114,7 +114,13 @@ export function Mcp({ tool }: { tool: ToolCallData }) {
114
114
  : '';
115
115
 
116
116
  const parsedArgs = useMemo(() => (content ? tryParseJson(content) : { isValid: false }), [content]);
117
- const argsData = parsedArgs.isValid ? parsedArgs.data : undefined;
117
+ // ACP/omp `mcp__` calls carry their arguments as a structured `rawInput`
118
+ // object; only the legacy `write xd://…` transport carries a JSON string in
119
+ // `content`. Reading only `content` left a structured MCP call showing its
120
+ // header and result but never the arguments it asked with.
121
+ const argsData = content
122
+ ? (parsedArgs.isValid ? parsedArgs.data : undefined)
123
+ : inputObj;
118
124
  const argsStructured = isRecord(argsData) || Array.isArray(argsData);
119
125
 
120
126
  const parsedOutput = useMemo(() => (tool.output ? tryParseJson(tool.output) : { isValid: false }), [tool.output]);
@@ -131,7 +137,7 @@ export function Mcp({ tool }: { tool: ToolCallData }) {
131
137
  </span>
132
138
  </div>
133
139
 
134
- {content && argsStructured ? (
140
+ {argsStructured ? (
135
141
  <ValueNode value={argsData} />
136
142
  ) : content ? (
137
143
  <div className="prose-content max-h-72 overflow-auto rounded-lg border border-ink/8 bg-paper px-3 py-2.5 text-[12px] leading-relaxed text-ink/85 select-text">
@@ -53,6 +53,15 @@ describe('Read panel — lazy fallback', () => {
53
53
  expect(fetchCalls[0]).toContain('/api/fs/read?path=src%2Fx.ts');
54
54
  });
55
55
 
56
+ test('an absolute path takes the allow-listed reference route', async () => {
57
+ // `/api/fs/read` strips the leading `/` and resolves the rest UNDER the
58
+ // workspace root, so an ACP `locations[].path` answered 404 even when the
59
+ // file existed (`agy` 1.5.3 sends no tool result, so this is the only body).
60
+ fetchCalls.length = 0;
61
+ await mountRead(readTool({ target: '/Users/me/repo/src/x.ts', input: { Path: '/Users/me/repo/src/x.ts' } }));
62
+ expect(fetchCalls[0]).toContain('/api/fs/read-reference?path=%2FUsers%2Fme%2Frepo%2Fsrc%2Fx.ts');
63
+ });
64
+
56
65
  test('a refused read prints the server’s reason, never a fake body', async () => {
57
66
  // A binary or oversized file is refused by the route with its own sentence.
58
67
  // Printing `// Loaded file: <path>` described contents that were never read.
@@ -24,6 +24,21 @@ interface ReadPanelProps {
24
24
  output: string;
25
25
  }
26
26
 
27
+ /** Absolute references take the allow-listed route; a workspace-relative one
28
+ * takes the scoped reader.
29
+ *
30
+ * `/api/fs/read` strips the leading `/` and resolves the rest UNDER the
31
+ * workspace root, so an ACP `locations[].path` (`/Users/…/src/a.ts`) became
32
+ * `<root>/Users/…/src/a.ts` and answered 404 — measured with `agy` 1.5.3,
33
+ * whose `read_file` sends no result payload at all, so the lazy fallback is
34
+ * the ONLY body the card has. `/api/fs/read-reference` resolves an absolute
35
+ * path through the same allow-list the drop path uses. */
36
+ function lazyReadUrl(path: string): string {
37
+ const reference = /^(?:[A-Za-z]:[\\/]|\/|file:\/\/)/.test(path);
38
+ const route = reference ? '/api/fs/read-reference' : '/api/fs/read';
39
+ return `${route}?path=${encodeURIComponent(path)}`;
40
+ }
41
+
27
42
  /** File & Directory content viewer untuk tool `read` / `view_file` / `read_file`. */
28
43
  export function Read({ tool, targetFilePath, output }: ReadPanelProps) {
29
44
  const [lazyContent, setLazyContent] = useState<string | null>(null);
@@ -82,7 +97,7 @@ export function Read({ tool, targetFilePath, output }: ReadPanelProps) {
82
97
  useEffect(() => {
83
98
  if (cleanFetchPath && !virtualPath && !isPictureOnly && !output && lazyContent === null && !loadingFile) {
84
99
  setLoadingFile(true);
85
- fetch(`/api/fs/read?path=${encodeURIComponent(cleanFetchPath)}`)
100
+ fetch(lazyReadUrl(cleanFetchPath))
86
101
  .then(async (res) => {
87
102
  const data = (await res.json().catch(() => null)) as { content?: unknown; error?: unknown } | null;
88
103
  // The route refuses a file it will not hand back as text — a binary
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The search card must never look like a search that found nothing when the
8
+ * adapter simply did not send the results.
9
+ *
10
+ * Measured on `agy acp` 1.5.3: `search_web` answers the tool call with no
11
+ * `rawOutput`/`content` and puts the citations in its prose, so the panel
12
+ * returned `null` and the card was header-only.
13
+ */
14
+
15
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
16
+ import { Window } from 'happy-dom';
17
+ import { h, render } from 'preact';
18
+ import { act } from 'preact/test-utils';
19
+ import { WebSearch } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch';
20
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
21
+ import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
22
+
23
+ let container: HTMLElement;
24
+
25
+ beforeAll(() => installDomGlobals(new Window()));
26
+ afterAll(() => restoreDomGlobals());
27
+ beforeEach(() => {
28
+ container = document.createElement('div');
29
+ document.body.appendChild(container);
30
+ });
31
+ afterEach(() => {
32
+ render(null, container);
33
+ container.remove();
34
+ });
35
+
36
+ function searchTool(partial: Partial<ToolCallData>): ToolCallData {
37
+ return { id: 'w1', type: 'web_search', name: 'search_web', title: '"ACP protocol" on Web', status: 'success', ...partial } as ToolCallData;
38
+ }
39
+
40
+ function paint(tool: ToolCallData): string {
41
+ act(() => { render(h(WebSearch, { tool }), container); });
42
+ return container.textContent ?? '';
43
+ }
44
+
45
+ describe('WebSearch panel', () => {
46
+ test('names a result the adapter did not send', () => {
47
+ const text = paint(searchTool({ input: { query: 'ACP protocol' } }));
48
+ expect(text).toContain('did not include its results');
49
+ });
50
+
51
+ test('still lists the results when the report carries them', () => {
52
+ const text = paint(searchTool({
53
+ input: { query: 'ACP protocol' },
54
+ output: JSON.stringify({ results: [{ title: 'Agent Client Protocol', url: 'https://agentclientprotocol.com' }] }),
55
+ }));
56
+ expect(text).toContain('Agent Client Protocol');
57
+ expect(text).not.toContain('did not include its results');
58
+ });
59
+ });
@@ -61,7 +61,17 @@ export function WebSearch({ tool }: { tool: ToolCallData }) {
61
61
  const items = rawItems;
62
62
 
63
63
  if (items.length === 0) {
64
- if (!tool.output) return null;
64
+ // An adapter may run the search and send only its prose summary (measured
65
+ // on antigravity 1.5.3: the tool frame carries no `rawOutput`/`content`).
66
+ // Returning null left a header-only card; naming the missing result is the
67
+ // honest body — the card must not look like a search that found nothing.
68
+ if (!tool.output) {
69
+ return (
70
+ <div className="rounded-lg border border-ink/8 bg-canvas/40 px-3 py-2 text-[11px] leading-relaxed text-ink/50">
71
+ The agent ran this search but did not include its results in the tool call.
72
+ </div>
73
+ );
74
+ }
65
75
  return <FallbackOutput text={tool.output} />;
66
76
  }
67
77
 
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The agent-control card's normalizer, pinned against the exact arguments
8
+ * measured on `agy acp` 1.5.3.
9
+ *
10
+ * These calls arrive with no result payload, so the arguments ARE the card.
11
+ * A field the panel invents would be a lie about what the agent asked for, and
12
+ * the "no result" note is the only honest way to say the adapter sent none.
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+ import { agentAdminView } from './agent-admin-rows';
17
+ import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
18
+
19
+ function tool(partial: Partial<ToolCallData> & Pick<ToolCallData, 'name'>): ToolCallData {
20
+ return {
21
+ id: 'a1',
22
+ type: 'other',
23
+ title: `Run ${partial.name}`,
24
+ status: 'success',
25
+ ...partial,
26
+ } as ToolCallData;
27
+ }
28
+
29
+ describe('agentAdminView', () => {
30
+ test('manage_task names its action and target', () => {
31
+ const view = agentAdminView(tool({
32
+ name: 'manage_task',
33
+ input: { Action: 'kill', TaskId: '8b46…/task-23' },
34
+ }));
35
+ expect(view.title).toBe('Background task');
36
+ expect(view.action).toBe('kill');
37
+ expect(view.fields).toEqual([{ label: 'Task id', value: '8b46…/task-23', mono: true }]);
38
+ expect(view.note).toBe('The agent did not report a result for this call.');
39
+ });
40
+
41
+ test('define_subagent renders the definition as block fields', () => {
42
+ const view = agentAdminView(tool({
43
+ name: 'define_subagent',
44
+ input: { Name: 'probe_helper', Description: 'A helper.', SystemPrompt: 'Reply concisely.' },
45
+ }));
46
+ expect(view.title).toBe('Subagent definition');
47
+ expect(view.fields.map((field) => [field.label, field.block])).toEqual([
48
+ ['Name', undefined],
49
+ ['Description', true],
50
+ ['System prompt', true],
51
+ ]);
52
+ });
53
+
54
+ test('send_message shows the recipient as an id and the message as a block', () => {
55
+ const view = agentAdminView(tool({
56
+ name: 'send_message',
57
+ input: { Message: 'Acknowledged.', Recipient: '39709143-bd9d' },
58
+ }));
59
+ expect(view.fields[0]).toEqual({ label: 'Recipient', value: '39709143-bd9d', mono: true });
60
+ expect(view.fields[1]).toEqual({ label: 'Message', value: 'Acknowledged.', block: true });
61
+ });
62
+
63
+ test('schedule turns the raw seconds into a readable duration', () => {
64
+ const view = agentAdminView(tool({
65
+ name: 'schedule',
66
+ input: { DurationSeconds: 60, Prompt: 'Remind me.' },
67
+ }));
68
+ expect(view.fields[0]).toEqual({ label: 'Duration', value: '60 seconds' });
69
+ expect(view.fields[1]).toEqual({ label: 'Prompt', value: 'Remind me.', block: true });
70
+ });
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
+ test('an unknown argument is printed under its own humanized key', () => {
111
+ const view = agentAdminView(tool({ name: 'send_message', input: { SomeOtherField: { a: 1 } } }));
112
+ expect(view.fields).toEqual([{ label: 'Some Other Field', value: '{\n "a": 1\n}' }]);
113
+ });
114
+
115
+ test('a call with no arguments still renders', () => {
116
+ const view = agentAdminView(tool({ name: 'manage_subagents' }));
117
+ expect(view).toMatchObject({ title: 'Subagent', questions: [], fields: [] });
118
+ });
119
+ });