@kabmo-labs/kabmo 0.54.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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +479 -479
- package/dist/client/static/js/{Body-x5grdps8.js → Body-jfy4bhk2.js} +1 -1
- package/dist/client/static/js/{CsvGrid-248v9yzf.js → CsvGrid-4c5t668z.js} +1 -1
- package/dist/client/static/js/{DocxView-5we92k2h.js → DocxView-3x7whtvq.js} +1 -1
- package/dist/client/static/js/{DrawioView-c6xmw4qq.js → DrawioView-tbkc5dfz.js} +1 -1
- package/dist/client/static/js/{HtmlPreview-r3qxgqg6.js → HtmlPreview-egxkayya.js} +1 -1
- package/dist/client/static/js/{ImageView-cr4fea18.js → ImageView-swhzvw2p.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-j12z0djx.js → LayoutWrapper-sangsrt5.js} +2 -2
- package/dist/client/static/js/MergeDiffView-bv00y63x.js +1 -0
- package/dist/client/static/js/{Modal-cqceypcn.js → Modal-1fj8kvme.js} +16 -16
- package/dist/client/static/js/{PdfView-xdgn31cm.js → PdfView-0k2egsbz.js} +1 -1
- package/dist/client/static/js/{SessionsView-ms6z44e2.js → SessionsView-t547rqeb.js} +1 -1
- package/dist/client/static/js/{SheetView-peqm9vft.js → SheetView-anb3gavm.js} +1 -1
- package/dist/client/static/js/{SvgPreview-rdf4wbzr.js → SvgPreview-e2wrj2hj.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-48z2x5vg.js → abnfDiagram-O67JEVCF-0rs86b68.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-n1pr5s6j.js → architectureDiagram-NJMV4G6O-0k3zzxz1.js} +3 -3
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-p19shaft.js → blockDiagram-BEXU5L5S-t1n1fx96.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-qcd46ts2.js → c4Diagram-YGBWAQC7-93b7eds9.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-scyhe133.js → classDiagram-v2-NBCMYWYE-bnf85z0f.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-srnnj3f7.js → cose-bilkent-JH36ORCC-e290161f.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-1zfrnyay.js → cynefinDiagram-VND7K2PF-s13ra9ag.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-hepk25pz.js → dagre-6A5THRUB-83wshh5e.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-wy2y0323.js → diagram-22UHCM2B-ywh4wqna.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-j904f93p.js → diagram-3UASUU5V-cb53z698.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-2mmxccm2.js → diagram-ATOU4E4O-btf55c44.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-cfhk73ty.js → diagram-CDSNMT55-p6tbbm1n.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-ryf8j6hf.js → diagram-MLGK6HIB-6kzssf4y.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-8k5e36sd.js → diagram-MPIPVDR6-4v0yncvv.js} +1 -1
- package/dist/client/static/js/{dockerfile-1e7deann.js → dockerfile-r422htmd.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5kkbbbhv.js → ebnfDiagram-ZINNZB2B-mw1gh30z.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-jqc4mzvc.js → elk-276RUBZZ-1pe786ap.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-kx15t6f0.js → erDiagram-OPXOYQCR-x7rk70q6.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-kfwaac44.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-3hv8pej4.js → ganttDiagram-FUAMR5RP-j3m5km4p.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-a4mq8vwz.js → gitGraphDiagram-X574FWY7-fd1kebdy.js} +1 -1
- package/dist/client/static/js/{index-fanhvjk8.js → index-004x0a3p.js} +1 -1
- package/dist/client/static/js/{index-exyg9sna.js → index-0mhxw0a1.js} +1 -1
- package/dist/client/static/js/{index-51wzt3ma.js → index-22frp78d.js} +1 -1
- package/dist/client/static/js/{index-x5c5yxhj.js → index-29b1ysz6.js} +1 -1
- package/dist/client/static/js/{index-br27jz2t.js → index-3hrvhyym.js} +1 -1
- package/dist/client/static/js/{index-kvker1ps.js → index-3k45gspr.js} +1 -1
- package/dist/client/static/js/{index-vxe4e903.js → index-473wm10a.js} +1 -1
- package/dist/client/static/js/{index-demg0p74.js → index-4acka5fn.js} +1 -1
- package/dist/client/static/js/{index-40ydm28n.js → index-4dzvjfkd.js} +1 -1
- package/dist/client/static/js/{index-n5194pe6.js → index-4fpyzg5e.js} +7 -7
- package/dist/client/static/js/{index-n4pm0hrh.js → index-4jg10xtp.js} +1 -1
- package/dist/client/static/js/{index-937bn0d2.js → index-4nyajpeg.js} +1 -1
- package/dist/client/static/js/{index-8hnem33f.js → index-5fxm2tpg.js} +1 -1
- package/dist/client/static/js/{index-pszsxhjr.js → index-72v57e07.js} +1 -1
- package/dist/client/static/js/{index-0j5ng1qc.js → index-7tsdw8wt.js} +1 -1
- package/dist/client/static/js/{index-k4kwrze2.js → index-8e66p2a7.js} +1 -1
- package/dist/client/static/js/{index-317v49ey.js → index-8n4qwd64.js} +2 -2
- package/dist/client/static/js/{index-w4dep7k6.js → index-bnamrpm6.js} +1 -1
- package/dist/client/static/js/{index-01rdknec.js → index-bxhszdcz.js} +1 -1
- package/dist/client/static/js/{index-n3cts2j1.js → index-cbbwq25c.js} +1 -1
- package/dist/client/static/js/{index-kevqayd9.js → index-dfha2z56.js} +1 -1
- package/dist/client/static/js/{index-e2y4hkps.js → index-drsy400d.js} +1 -1
- package/dist/client/static/js/{index-4kchzh9y.js → index-e4yj4kbe.js} +8 -8
- package/dist/client/static/js/{index-bf54x0w8.js → index-g84dwmvr.js} +1 -1
- package/dist/client/static/js/index-gedsa0z7.css +1 -0
- package/dist/client/static/js/{index-x3g8fwkc.js → index-hge0y4vn.js} +2 -2
- package/dist/client/static/js/{index-9cr6p86f.js → index-hgsjynb0.js} +1 -1
- package/dist/client/static/js/{index-0z7kerp1.js → index-j1prebvy.js} +2 -2
- package/dist/client/static/js/{index-rtfw07hy.js → index-jbaceghb.js} +1 -1
- package/dist/client/static/js/{index-v90zd3sq.js → index-jtyzeynv.js} +2 -2
- package/dist/client/static/js/{index-p8bta9ae.js → index-kbk0vmex.js} +4 -4
- package/dist/client/static/js/{index-40fdtqvw.js → index-q178zgxp.js} +1 -1
- package/dist/client/static/js/{index-eb43hnd3.js → index-q4t5j3x7.js} +1 -1
- package/dist/client/static/js/{index-xhcbaaga.js → index-qdabc51h.js} +3 -3
- package/dist/client/static/js/{index-jvn2xfpt.js → index-qrwjxqdh.js} +168 -166
- package/dist/client/static/js/{index-3kenmzbe.js → index-rm5b3kn8.js} +1 -1
- package/dist/client/static/js/{index-g3x4w48f.js → index-s4v3vcsn.js} +1 -1
- package/dist/client/static/js/{index-kz5d00m5.js → index-s6nv35dv.js} +1 -1
- package/dist/client/static/js/{index-1ye834yz.js → index-satnfvaz.js} +1 -1
- package/dist/client/static/js/{index-m85c740p.js → index-tcp5cp53.js} +1 -1
- package/dist/client/static/js/{index-9gddw5qy.js → index-zkef5q39.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-wtnqb06v.js → infoDiagram-VRGFBTTK-1m0br602.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-eta0jnvr.js → ishikawaDiagram-OU5B5YK6-zryzhpq6.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-4e572kkp.js → journeyDiagram-ZHPQQLJL-6apqr7h4.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-yrtnn4zy.js → kanban-definition-PNTS6WVX-am385c1e.js} +1 -1
- package/dist/client/static/js/{mermaid.core-195b0fb6.js → mermaid.core-k937exrm.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-pphjnkvt.js → mindmap-definition-NLK3R4M7-hx8qq866.js} +1 -1
- package/dist/client/static/js/one-dark-pro-phxqe9mx.js +1 -0
- package/dist/client/static/js/one-light-vhwh499y.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-kgffb9p3.js → pegDiagram-GJSIUBJH-1hasj2h7.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-efech3mm.js → pieDiagram-5QR66LMP-x5nwff8r.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-khf9cv3t.js → quadrantDiagram-O4NWA36T-gmrcr5jb.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-ye68kdx2.js → railroadDiagram-XR7U4H2S-rdznfhfb.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-3s4smnme.js → requirementDiagram-PLB6GJNP-v9wb3ppf.js} +1 -1
- package/dist/client/static/js/{rust-tdrnaxp3.js → rust-9cgnbbcs.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-9pqd25mc.js → sankeyDiagram-IPEJSGJF-3p4ddd2h.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-rka8ct43.js → sequenceDiagram-PO4LG4MO-wfcqxjfq.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-g5wkzry8.js → sizeCapture-INFHLROL-g02k0k8x.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-gy1zab2j.js → stateDiagram-v2-GCMORJYK-7k449yvg.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-kr35nmd2.js → swimlanes-2SLR337P-zkf2bgm8.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-qnhxxmjr.js → swimlanesDiagram-TC7HE7FX-yex8g4fx.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-sg151mkc.js → timeline-definition-EJHVYXUP-qsfpjr1c.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-f91g61p3.js → usecaseDiagram-POWQR4AR-b2vprhsr.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-zbhr4eqf.js → vennDiagram-UO4OBE2U-x0ffeg2t.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-6302414n.js → wardleyDiagram-VNRHLVJA-hsnhaf4f.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-0a47th65.js → xychartDiagram-PMCCYNJV-90f9aadp.js} +1 -1
- package/package.json +5 -5
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +5 -3
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +41 -21
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +16 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +105 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +59 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.test.tsx +54 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.test.tsx +91 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +8 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +9 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +16 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.test.tsx +59 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +11 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.test.ts +81 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts +139 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +14 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +22 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +14 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +36 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +10 -5
- package/src/client/data/settings/omp-schema.json +445 -165
- package/src/client/hooks/chat/timeline/ask-frame-buckets.ts +14 -4
- package/src/client/hooks/chat/timeline/ask-frames-context.ts +3 -1
- package/src/client/hooks/chat/timeline/ask-frames-grouped.test.ts +31 -0
- package/src/client/hooks/chat/timeline/ask-frames.ts +12 -3
- package/src/client/hooks/chat/timeline/send-props.ts +1 -2
- package/src/server/lib/harness/acp/client-capabilities.test.ts +3 -2
- package/src/server/lib/sessions/last-opened.server.test.ts +26 -7
- package/src/server/lib/sessions/last-opened.server.ts +19 -4
- package/src/server/routes/fs/raw.test.ts +33 -0
- package/src/server/routes/fs/raw.ts +31 -11
- package/src/shared/lib/chat/ask-questions.test.ts +29 -0
- package/src/shared/lib/chat/ask-questions.ts +44 -3
- package/src/shared/lib/chat/ask-results.test.ts +66 -0
- package/src/shared/lib/chat/ask-results.ts +58 -0
- package/src/shared/lib/chat/timeline/block-chrome.ts +4 -4
- package/src/shared/lib/chat/timeline/tool-phrases.test.ts +4 -0
- package/src/shared/lib/chat/timeline/tool-phrases.ts +2 -0
- package/src/shared/lib/models/provider/glyph.test.ts +13 -11
- package/src/shared/lib/models/provider/glyph.ts +1 -0
- package/src/shared/lib/models/provider/label.ts +3 -0
- package/src/shared/lib/omp/config/schema-releases-19-3.test.ts +64 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +6 -4
- package/src/shared/lib/omp/session/wait-idle.test.ts +12 -2
- package/src/shared/lib/omp/session/wait-idle.ts +11 -6
- package/tsconfig.json +6 -0
- package/dist/client/static/js/MergeDiffView-y0we0194.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-dpjz82p8.js +0 -1
- package/dist/client/static/js/index-4m2d73m3.css +0 -1
- package/dist/client/static/js/one-dark-pro-asy2qj2p.js +0 -1
- package/dist/client/static/js/one-light-fya1pbbx.js +0 -1
|
@@ -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
|
-
|
|
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
|
-
{
|
|
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(
|
|
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
|
package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.test.tsx
ADDED
|
@@ -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
|
-
|
|
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
|
|
package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.test.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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('an unknown argument is printed under its own humanized key', () => {
|
|
73
|
+
const view = agentAdminView(tool({ name: 'send_message', input: { SomeOtherField: { a: 1 } } }));
|
|
74
|
+
expect(view.fields).toEqual([{ label: 'Some Other Field', value: '{\n "a": 1\n}' }]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('a call with no arguments still renders', () => {
|
|
78
|
+
const view = agentAdminView(tool({ name: 'manage_subagents' }));
|
|
79
|
+
expect(view).toMatchObject({ title: 'Subagent', fields: [] });
|
|
80
|
+
});
|
|
81
|
+
});
|
package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The rows the agent-control panel draws, from the arguments of the tools that
|
|
8
|
+
* manage the agent itself.
|
|
9
|
+
*
|
|
10
|
+
* Measured on `agy acp` 1.5.3: `manage_task`, `manage_subagents`,
|
|
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.
|
|
18
|
+
*
|
|
19
|
+
* The normalizer is pure so the panel is presentation only. It reads the
|
|
20
|
+
* adapter's spelling, never invents a field: a result the agent did not report
|
|
21
|
+
* is named as missing, and an unknown argument is printed under its own key.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
|
|
25
|
+
|
|
26
|
+
export interface AgentAdminField {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
mono?: boolean;
|
|
30
|
+
block?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface AgentAdminView {
|
|
34
|
+
/** The card's own noun ("Subagent", "Scheduled run", …). */
|
|
35
|
+
title: string;
|
|
36
|
+
/** The verb the call names (`list`, `kill`, `send_input`). */
|
|
37
|
+
action?: string;
|
|
38
|
+
fields: AgentAdminField[];
|
|
39
|
+
/** A sentence for a fact the adapter did not send (no result, no answer). */
|
|
40
|
+
note?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const TITLES: Readonly<Record<string, string>> = {
|
|
44
|
+
manage_task: 'Background task',
|
|
45
|
+
manage_subagents: 'Subagent',
|
|
46
|
+
define_subagent: 'Subagent definition',
|
|
47
|
+
send_message: 'Message',
|
|
48
|
+
schedule: 'Scheduled run',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const LABELS: Readonly<Record<string, string>> = {
|
|
52
|
+
Name: 'Name',
|
|
53
|
+
Description: 'Description',
|
|
54
|
+
Recipient: 'Recipient',
|
|
55
|
+
TaskId: 'Task id',
|
|
56
|
+
ConversationIds: 'Conversation ids',
|
|
57
|
+
DurationSeconds: 'Duration',
|
|
58
|
+
Prompt: 'Prompt',
|
|
59
|
+
Message: 'Message',
|
|
60
|
+
SystemPrompt: 'System prompt',
|
|
61
|
+
Role: 'Role',
|
|
62
|
+
TypeName: 'Type',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const BLOCK_KEYS: Readonly<Record<string, true>> = {
|
|
66
|
+
Description: true,
|
|
67
|
+
Prompt: true,
|
|
68
|
+
Message: true,
|
|
69
|
+
SystemPrompt: true,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const MONO_KEYS: Readonly<Record<string, true>> = {
|
|
73
|
+
Recipient: true,
|
|
74
|
+
TaskId: true,
|
|
75
|
+
ConversationIds: true,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Identity before prose, so the card reads the same whatever order the
|
|
79
|
+
* adapter serialised its arguments in. */
|
|
80
|
+
const FIELD_ORDER: readonly string[] = [
|
|
81
|
+
'Name', 'Role', 'TypeName', 'Recipient', 'TaskId', 'ConversationIds',
|
|
82
|
+
'DurationSeconds', 'Description', 'Prompt', 'Message', 'SystemPrompt',
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
function asText(value: unknown): string {
|
|
86
|
+
if (typeof value === 'string') return value;
|
|
87
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
88
|
+
if (Array.isArray(value)) return value.map((entry) => (typeof entry === 'string' ? entry : JSON.stringify(entry))).join('\n');
|
|
89
|
+
return JSON.stringify(value, null, 2) ?? '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function humanKey(key: string): string {
|
|
93
|
+
return LABELS[key] ?? key.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/_/g, ' ');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function agentAdminView(tool: ToolCallData): AgentAdminView {
|
|
97
|
+
const input = tool.input && typeof tool.input === 'object' && !Array.isArray(tool.input)
|
|
98
|
+
? (tool.input as Record<string, unknown>)
|
|
99
|
+
: {};
|
|
100
|
+
const name = (tool.name ?? tool.type ?? '').toLowerCase();
|
|
101
|
+
const action = typeof input.Action === 'string' && input.Action ? input.Action : undefined;
|
|
102
|
+
const collected: Array<{ key: string; field: AgentAdminField }> = [];
|
|
103
|
+
|
|
104
|
+
for (const [key, value] of Object.entries(input)) {
|
|
105
|
+
if (key === 'Action') continue;
|
|
106
|
+
if (value === undefined || value === null || value === '') continue;
|
|
107
|
+
const duration = key === 'DurationSeconds' && typeof value === 'number'
|
|
108
|
+
? `${value} second${value === 1 ? '' : 's'}`
|
|
109
|
+
: undefined;
|
|
110
|
+
collected.push({
|
|
111
|
+
key,
|
|
112
|
+
field: {
|
|
113
|
+
label: humanKey(key),
|
|
114
|
+
value: duration ?? asText(value),
|
|
115
|
+
...(MONO_KEYS[key] ? { mono: true } : {}),
|
|
116
|
+
...(BLOCK_KEYS[key] ? { block: true } : {}),
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const rank = (key: string) => {
|
|
122
|
+
const index = FIELD_ORDER.indexOf(key);
|
|
123
|
+
return index === -1 ? FIELD_ORDER.length : index;
|
|
124
|
+
};
|
|
125
|
+
collected.sort((a, b) => rank(a.key) - rank(b.key));
|
|
126
|
+
const fields = collected.map((entry) => entry.field);
|
|
127
|
+
|
|
128
|
+
const settled = tool.status === 'success' || tool.status === 'error' || tool.status === 'aborted';
|
|
129
|
+
const note = settled && !tool.output
|
|
130
|
+
? 'The agent did not report a result for this call.'
|
|
131
|
+
: undefined;
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
title: TITLES[name] ?? 'Agent call',
|
|
135
|
+
...(action ? { action } : {}),
|
|
136
|
+
fields,
|
|
137
|
+
...(note ? { note } : {}),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -31,13 +31,25 @@ export function acpDelegationRow(
|
|
|
31
31
|
): TaskRowShape | null {
|
|
32
32
|
if (!input) return null;
|
|
33
33
|
const description = typeof input.description === 'string' ? input.description.trim() : '';
|
|
34
|
-
|
|
34
|
+
// antigravity's `invoke_subagent` reports `Prompt`/`Role`/`TypeName` (capital
|
|
35
|
+
// letters). Reading only the lowercase spellings left `acpRow` null, so the
|
|
36
|
+
// panel returned null and the delegation card rendered EMPTY.
|
|
37
|
+
const prompt =
|
|
38
|
+
typeof input.prompt === 'string' && input.prompt.trim()
|
|
39
|
+
? input.prompt.trim()
|
|
40
|
+
: typeof input.Prompt === 'string' && input.Prompt.trim()
|
|
41
|
+
? input.Prompt.trim()
|
|
42
|
+
: '';
|
|
35
43
|
const subagent =
|
|
36
44
|
typeof input.subagent_type === 'string' && input.subagent_type.trim()
|
|
37
45
|
? input.subagent_type.trim()
|
|
38
46
|
: typeof input.agent === 'string' && input.agent.trim()
|
|
39
47
|
? input.agent.trim()
|
|
40
|
-
: ''
|
|
48
|
+
: typeof input.Role === 'string' && input.Role.trim()
|
|
49
|
+
? input.Role.trim()
|
|
50
|
+
: typeof input.TypeName === 'string' && input.TypeName.trim()
|
|
51
|
+
? input.TypeName.trim()
|
|
52
|
+
: '';
|
|
41
53
|
const wrapped = input._toolName === 'task';
|
|
42
54
|
const task = description || prompt;
|
|
43
55
|
if (!task && !wrapped && !subagent) return null;
|
package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts
CHANGED
|
@@ -55,6 +55,28 @@ describe('toolCardHeader — device calls', () => {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
describe('toolCardHeader — shell', () => {
|
|
59
|
+
test('an adapter that reports the command as the title does not title-case it', () => {
|
|
60
|
+
// opencode 2.2.5 sends `title: "pwd && ls -la"`; the generic rule produced
|
|
61
|
+
// `Pwd && Ls La`. The family names the card and the command is the detail.
|
|
62
|
+
expect(header({
|
|
63
|
+
type: 'tool',
|
|
64
|
+
name: 'shell',
|
|
65
|
+
title: 'pwd && ls -la',
|
|
66
|
+
input: { command: 'pwd && ls -la', workdir: '/tmp/x' },
|
|
67
|
+
})).toEqual({ title: 'Bash', subtitle: 'pwd && ls -la' });
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('a multi-line command keeps only its first line in the header', () => {
|
|
71
|
+
expect(header({
|
|
72
|
+
type: 'bash',
|
|
73
|
+
name: 'bash',
|
|
74
|
+
title: 'python3 - <<PY',
|
|
75
|
+
input: { command: 'python3 - <<PY\nprint(1)\nPY' },
|
|
76
|
+
})).toEqual({ title: 'Bash', subtitle: 'python3 - <<PY' });
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
58
80
|
describe('toolCardHeader — self-naming tools', () => {
|
|
59
81
|
test('an eval uses omp’s own label for the cell', () => {
|
|
60
82
|
expect(header({ type: 'eval', input: { title: 'open app and locate composer' } }))
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
|
|
21
21
|
import { toTitleCase } from '@/shared/lib/chat/title-case';
|
|
22
|
+
import { isRecord } from '@kabmo-labs/kabmo-guards';
|
|
22
23
|
import { parseAskQuestions } from '@/shared/lib/chat/ask-questions';
|
|
23
24
|
import { procOpLabel, procPathOf, procViewOf } from '@kabmo-labs/kabmo-omp/proc/proc';
|
|
24
25
|
import { waitViewOf } from '@/shared/lib/omp/session/wait';
|
|
@@ -86,6 +87,19 @@ export function toolCardHeader(tool: ToolCallData, toolKey: string): ToolCardHea
|
|
|
86
87
|
return { title: toolKey === 'resolve' ? 'Resolve Proposal' : 'Reject Proposal' };
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
// ── shell: the command is the identity, never a title to capitalize ───────
|
|
91
|
+
// opencode reports the command as the tool title (`pwd && ls -la`), and the
|
|
92
|
+
// generic rule title-cased it into `Pwd && Ls La`. The body already draws
|
|
93
|
+
// the command; the header names the family and repeats the first line so a
|
|
94
|
+
// collapsed card still says what ran.
|
|
95
|
+
if (toolKey === 'bash') {
|
|
96
|
+
const input = isRecord(tool.input) ? tool.input : undefined;
|
|
97
|
+
const command = typeof input?.command === 'string'
|
|
98
|
+
? input.command.split('\n')[0]
|
|
99
|
+
: undefined;
|
|
100
|
+
if (command) return { title: 'Bash', subtitle: clip(command) };
|
|
101
|
+
}
|
|
102
|
+
|
|
89
103
|
// ── todo / ask ────────────────────────────────────────────────────────────
|
|
90
104
|
// A todo's progress is a FACT, not a title line: `toolSummary` derives it from
|
|
91
105
|
// `details.phases` — the same source the Todo panel reads — so it renders as a
|
|
@@ -19,6 +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
25
|
* - The head is the toggle, with the SHARED wording (`toolToggleLabel`), so
|
|
23
26
|
* `chat.e2e.ts`'s `[aria-label^="Expand "]` collection and `mobile.e2e.ts`'s
|
|
24
27
|
* `/^Expand Bash/` click still work, and the section's per-call intent
|
|
@@ -99,6 +102,20 @@ const EDIT_TOOL: ToolCallData = {
|
|
|
99
102
|
details: { diff: 'a\n+b\n+c\n-d\n' },
|
|
100
103
|
} as ToolCallData;
|
|
101
104
|
|
|
105
|
+
/** A command longer than the header's 80-char clip, so its subtitle already
|
|
106
|
+
* ends in `…` before CSS touches it. */
|
|
107
|
+
const LONG_COMMAND_TOOL: ToolCallData = {
|
|
108
|
+
id: 'tui-long',
|
|
109
|
+
type: 'bash',
|
|
110
|
+
name: 'bash',
|
|
111
|
+
title: 'Bash',
|
|
112
|
+
status: 'success',
|
|
113
|
+
command: `bun test ${'--filter '.repeat(14)}`,
|
|
114
|
+
detail: `bun test ${'--filter '.repeat(14)}`,
|
|
115
|
+
input: { command: `bun test ${'--filter '.repeat(14)}` },
|
|
116
|
+
output: '',
|
|
117
|
+
} as ToolCallData;
|
|
118
|
+
|
|
102
119
|
async function mount(tools: ToolCallData[]): Promise<HTMLElement> {
|
|
103
120
|
await act(async () => {
|
|
104
121
|
render(
|
|
@@ -133,7 +150,10 @@ describe('the tui style', () => {
|
|
|
133
150
|
expect(el.querySelector('[data-tool-section]')?.getAttribute('data-tool-style')).toBe('tui');
|
|
134
151
|
|
|
135
152
|
const frame = row(el);
|
|
136
|
-
|
|
153
|
+
// The row is the transcript's own type, at the same size as every other
|
|
154
|
+
// style — not a monospace island inside the answer.
|
|
155
|
+
expect(frame.className).not.toContain('font-mono');
|
|
156
|
+
expect(head(el).className).toContain('text-[12px]');
|
|
137
157
|
// No card: no border, no fill, no rounded frame on the row.
|
|
138
158
|
expect(frame.className).not.toContain('border');
|
|
139
159
|
expect(frame.className).not.toContain('rounded');
|
|
@@ -152,6 +172,21 @@ describe('the tui style', () => {
|
|
|
152
172
|
expect(head(el).querySelector('.sr-only')?.textContent).toBe('Done');
|
|
153
173
|
});
|
|
154
174
|
|
|
175
|
+
test('the subject hugs its clip, so the ellipsis sits beside the outcome', async () => {
|
|
176
|
+
const el = await mount([LONG_COMMAND_TOOL]);
|
|
177
|
+
const children = Array.from(head(el).children) as HTMLElement[];
|
|
178
|
+
const subject = children.find((node) => node.className.includes('text-meta'));
|
|
179
|
+
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');
|
|
183
|
+
expect(subject.className).toContain('truncate');
|
|
184
|
+
expect(subject.textContent?.endsWith('…')).toBe(true);
|
|
185
|
+
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');
|
|
188
|
+
});
|
|
189
|
+
|
|
155
190
|
test('title and subject are different colours', async () => {
|
|
156
191
|
const el = await mount([OK_TOOL]);
|
|
157
192
|
const classes = headClasses(el);
|
|
@@ -130,7 +130,7 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
|
|
|
130
130
|
}, [onToggle, tool.id]);
|
|
131
131
|
|
|
132
132
|
return (
|
|
133
|
-
<div data-tool-row="tui"
|
|
133
|
+
<div data-tool-row="tui">
|
|
134
134
|
{/* The status line itself: glyph, name, subject, outcome, facts. Text
|
|
135
135
|
only — the colours separate the three claims (what ran, on what, how
|
|
136
136
|
it ended), which is what the terminal does with SGR and what a box
|
|
@@ -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-
|
|
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 ${
|
|
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,7 +156,12 @@ 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
|
-
|
|
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>
|
|
160
165
|
</>
|
|
161
166
|
)}
|
|
162
167
|
<span className={`shrink-0 font-semibold ${tone}`}>{`[${status.word.toLowerCase()}]`}</span>
|
|
@@ -167,7 +172,7 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
|
|
|
167
172
|
// The whole group carries the tooltip with every fact, so a clipped
|
|
168
173
|
// tail is still recoverable.
|
|
169
174
|
<span
|
|
170
|
-
className="min-w-0 shrink truncate text-[
|
|
175
|
+
className="min-w-0 shrink truncate font-mono text-[10px]"
|
|
171
176
|
title={facts.map((fact) => fact.label).join(' · ')}
|
|
172
177
|
>
|
|
173
178
|
<span className="text-ink/25">· </span>
|
|
@@ -175,7 +180,7 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
|
|
|
175
180
|
</span>
|
|
176
181
|
)}
|
|
177
182
|
{canToggle && (
|
|
178
|
-
<span className="
|
|
183
|
+
<span className="shrink-0 pl-1 text-ink/40" aria-hidden="true">
|
|
179
184
|
{isExpanded ? '▾' : '▸'}
|
|
180
185
|
</span>
|
|
181
186
|
)}
|