@kabmo-labs/kabmo 0.53.2 → 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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +538 -527
- package/dist/client/static/js/{Body-vaa10tcd.js → Body-a4dwe3hh.js} +1 -1
- package/dist/client/static/js/{CsvGrid-wabx4e6w.js → CsvGrid-ppj80brw.js} +1 -1
- package/dist/client/static/js/{DocxView-22b3mhh5.js → DocxView-ef0bd2pg.js} +1 -1
- package/dist/client/static/js/{DrawioView-e02qhkp2.js → DrawioView-44tpkzbd.js} +1 -1
- package/dist/client/static/js/{HtmlPreview-q7hwcf4s.js → HtmlPreview-w654aykz.js} +1 -1
- package/dist/client/static/js/{ImageView-fxb60ge7.js → ImageView-kg0skt5s.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-cey5agsf.js → LayoutWrapper-qepkrtd8.js} +2 -2
- package/dist/client/static/js/MergeDiffView-n2h8vv0j.js +1 -0
- package/dist/client/static/js/{Modal-e4yq7p5f.js → Modal-8d299emm.js} +17 -17
- package/dist/client/static/js/{PdfView-pf3angsq.js → PdfView-eq7fnqa2.js} +1 -1
- package/dist/client/static/js/{SessionsView-mcvhpx0b.js → SessionsView-tedh2es3.js} +1 -1
- package/dist/client/static/js/{SheetView-5ha5vvsr.js → SheetView-5xm33kgk.js} +1 -1
- package/dist/client/static/js/{SvgPreview-45wqjw0b.js → SvgPreview-tp1m8r4t.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-gnf6krbs.js → abnfDiagram-O67JEVCF-xppr9jf1.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-00fd0wsg.js → architectureDiagram-NJMV4G6O-s23e6vtk.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-9c2sm96a.js → blockDiagram-BEXU5L5S-7ws8yq9e.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-pemygn0s.js → c4Diagram-YGBWAQC7-517yhfzj.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-h7r3sx3s.js → classDiagram-v2-NBCMYWYE-tcad3rst.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-krx9crwv.js → cose-bilkent-JH36ORCC-a76vf82p.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-5rp2btew.js → cynefinDiagram-VND7K2PF-9kety453.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-q57cnz52.js → dagre-6A5THRUB-6g6gsp6b.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-0bptn06k.js → diagram-22UHCM2B-ngj4fyg3.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-60snxawz.js → diagram-3UASUU5V-xw2m99qa.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-bb0kewfp.js → diagram-ATOU4E4O-hz3bd083.js} +2 -2
- package/dist/client/static/js/{diagram-CDSNMT55-3cdkns0z.js → diagram-CDSNMT55-vfhtemve.js} +3 -3
- package/dist/client/static/js/{diagram-MLGK6HIB-03mbhzeq.js → diagram-MLGK6HIB-22cjvj5g.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-bcvzqqf4.js → diagram-MPIPVDR6-xv8fsecp.js} +2 -2
- package/dist/client/static/js/{dockerfile-7kqkk4tz.js → dockerfile-491tyqmj.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-sg6kwnbx.js → ebnfDiagram-ZINNZB2B-m6mkn986.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-5b8v0sdv.js → elk-276RUBZZ-jccw706n.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-xbs156j5.js → erDiagram-OPXOYQCR-rxk86jsf.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-aegwx04w.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4p7pfk6c.js → ganttDiagram-FUAMR5RP-veweech7.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-3xqwr9pf.js → gitGraphDiagram-X574FWY7-7dyqcj8r.js} +2 -2
- package/dist/client/static/js/{index-p75b7phb.js → index-088gwjbz.js} +1 -1
- package/dist/client/static/js/{index-5qtnmn76.js → index-0ak5wdz1.js} +1 -1
- package/dist/client/static/js/{index-pak6t03c.js → index-0qmpqtp2.js} +1 -1
- package/dist/client/static/js/{index-26a4afcr.js → index-0xh8402w.js} +1 -1
- package/dist/client/static/js/{index-yf5a6t3p.js → index-2asa0faw.js} +1 -1
- package/dist/client/static/js/{index-gzz6snng.js → index-2cfw7wem.js} +1 -1
- package/dist/client/static/js/{index-e2esj214.js → index-39mr4tym.js} +1 -1
- package/dist/client/static/js/{index-hp3s5r3g.js → index-3x88fxzj.js} +1 -1
- package/dist/client/static/js/{index-trrmbq0h.js → index-4m94cbms.js} +1 -1
- package/dist/client/static/js/{index-rtpg4t84.js → index-5701gj1f.js} +1 -1
- package/dist/client/static/js/{index-pdkt3r4r.js → index-60fjqzdw.js} +1 -1
- package/dist/client/static/js/{index-mtjbp5ga.js → index-637my5h0.js} +1 -1
- package/dist/client/static/js/{index-c8ta3k4g.js → index-7ckzdf4r.js} +158 -156
- package/dist/client/static/js/{index-1d8ff4t7.js → index-7ehep28z.js} +2 -2
- package/dist/client/static/js/{index-hwq7zgqd.js → index-bfy437re.js} +1 -1
- package/dist/client/static/js/{index-zc3snsr9.js → index-bhst1c2x.js} +1 -1
- package/dist/client/static/js/{index-nnhs52db.js → index-cz80n8yc.js} +1 -1
- package/dist/client/static/js/{index-ayx3q8t9.js → index-d9dz0wt0.js} +1 -1
- package/dist/client/static/js/{index-3bmn5cc5.js → index-dg714jam.js} +1 -1
- package/dist/client/static/js/{index-z7gd7nvb.js → index-e6tjaccf.js} +1 -1
- package/dist/client/static/js/{index-vwxt5ss9.js → index-gsw1zh30.js} +1 -1
- package/dist/client/static/js/{index-x0y2c61e.js → index-j0qt8gaj.js} +1 -1
- package/dist/client/static/js/{index-45vcpqp9.js → index-kfcpkx7h.js} +1 -1
- package/dist/client/static/js/{index-cy6ceab8.js → index-na95tr1k.js} +1 -1
- package/dist/client/static/js/{index-ng3e6k6x.js → index-nzjc24v9.js} +1 -1
- package/dist/client/static/js/{index-3amzzsdk.js → index-pqmvhqmj.js} +11 -11
- package/dist/client/static/js/{index-0btbxkxf.js → index-r51fqzb5.js} +1 -1
- package/dist/client/static/js/{index-cj8v7b50.js → index-sx5x2q80.js} +1 -1
- package/dist/client/static/js/{index-qj9tcz44.js → index-tk1vr8q2.js} +1 -1
- package/dist/client/static/js/{index-j9t5xc3y.js → index-trpn9gxs.js} +1 -1
- package/dist/client/static/js/{index-1regq9wd.js → index-twjq786a.js} +1 -1
- package/dist/client/static/js/{index-xqkcx4az.js → index-wa234c7k.js} +1 -1
- package/dist/client/static/js/{index-mgs5nscx.js → index-wp7tsava.js} +1 -1
- package/dist/client/static/js/{index-nmhwjwmt.js → index-wvqwzgpx.js} +1 -1
- package/dist/client/static/js/{index-jg6ecfc7.js → index-xbvjpa60.js} +2 -2
- package/dist/client/static/js/{index-jf8zcg99.js → index-xm3691yp.js} +4 -4
- package/dist/client/static/js/{index-cysdvwqw.js → index-xq78fj64.js} +1 -1
- package/dist/client/static/js/{index-ryww3xxj.js → index-zjc8yfbe.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-c362sv3t.js → infoDiagram-VRGFBTTK-ksz9cvq3.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yc8ts8wj.js → ishikawaDiagram-OU5B5YK6-g8symmrp.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-178c75fy.js → journeyDiagram-ZHPQQLJL-qs2e3hdf.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-w6g3n001.js → kanban-definition-PNTS6WVX-pzef80sz.js} +1 -1
- package/dist/client/static/js/{mermaid.core-vcdgn378.js → mermaid.core-chfcvkkc.js} +3 -3
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-t9e8arca.js → mindmap-definition-NLK3R4M7-sds2e243.js} +1 -1
- package/dist/client/static/js/one-dark-pro-5fvhpb1t.js +1 -0
- package/dist/client/static/js/one-light-pwj40vbr.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-nehn0x9n.js → pegDiagram-GJSIUBJH-m8199cy0.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-p1t3ctd4.js → pieDiagram-5QR66LMP-wqz5k5w6.js} +2 -2
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-614rtbfe.js → quadrantDiagram-O4NWA36T-rjszd8an.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-2vpr6pw8.js → railroadDiagram-XR7U4H2S-qv0be7dh.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b91s5q3p.js → requirementDiagram-PLB6GJNP-b87kqbr7.js} +1 -1
- package/dist/client/static/js/{rust-jj206pb7.js → rust-m7ma3tq9.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-4101kt9r.js → sankeyDiagram-IPEJSGJF-dh5we479.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yq0cxg8c.js → sequenceDiagram-PO4LG4MO-e6fg0x45.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-jkvq39vz.js → sizeCapture-INFHLROL-mam6cagq.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y0h7w5rw.js → stateDiagram-v2-GCMORJYK-htwar22v.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-1y073wzx.js → swimlanes-2SLR337P-5g26cnkr.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-8ahz3c68.js → swimlanesDiagram-TC7HE7FX-rseba3zs.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-yjb0g0ys.js → timeline-definition-EJHVYXUP-5km8n8mj.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-8xjkxrkv.js → usecaseDiagram-POWQR4AR-0vt6ms5g.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-18wjbwtg.js → vennDiagram-UO4OBE2U-k425105a.js} +2 -2
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-xqrfsrwp.js → wardleyDiagram-VNRHLVJA-s0gd4jg1.js} +2 -2
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-azygghkz.js → xychartDiagram-PMCCYNJV-2nrdzp7p.js} +2 -2
- package/package.json +5 -5
- package/src/client/App.tsx +4 -0
- package/src/client/bootstrap.d.ts +11 -0
- 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 +67 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.tsx +89 -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 +119 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts +174 -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/data/settings/omp-schema.json +455 -165
- package/src/client/hooks/shell/last-opened-session.test.ts +166 -0
- package/src/client/hooks/shell/last-opened-session.ts +74 -0
- package/src/client/lib/router/open-session.test.ts +8 -0
- package/src/client/lib/router/open-session.ts +9 -4
- package/src/client/main.tsx +7 -0
- package/src/server/lib/db/schema.ts +10 -0
- package/src/server/lib/sessions/last-opened-client.server.ts +86 -0
- package/src/server/lib/sessions/last-opened-client.test.ts +91 -0
- package/src/server/lib/sessions/last-opened.server.test.ts +127 -0
- package/src/server/lib/sessions/last-opened.server.ts +129 -0
- package/src/server/plugins/ssr.ts +40 -17
- package/src/server/routes/fs/raw.test.ts +33 -0
- package/src/server/routes/fs/raw.ts +31 -11
- package/src/server/routes/sessions/index.ts +14 -0
- package/src/server/routes/sessions/last-opened.test.ts +139 -0
- package/src/server/routes/sessions/last-opened.ts +66 -0
- 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 +21 -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/dist/client/static/js/MergeDiffView-1z9mwf73.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-sasgvf55.js +0 -1
- package/dist/client/static/js/one-dark-pro-17hh3q12.js +0 -1
- package/dist/client/static/js/one-light-cntgvscy.js +0 -1
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,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
|
+
});
|
package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
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`, `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.
|
|
15
|
+
*
|
|
16
|
+
* The normalizer is pure so the panel is presentation only. It reads the
|
|
17
|
+
* adapter's spelling, never invents a field: a result the agent did not report
|
|
18
|
+
* is named as missing, and an unknown argument is printed under its own key.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { ToolCallData } from '@kabmo-labs/kabmo-chat/contracts/chat';
|
|
22
|
+
|
|
23
|
+
export interface AgentAdminField {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
mono?: boolean;
|
|
27
|
+
block?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AgentAdminQuestion {
|
|
31
|
+
question: string;
|
|
32
|
+
options: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AgentAdminView {
|
|
36
|
+
/** The card's own noun ("Subagent", "Scheduled run", …). */
|
|
37
|
+
title: string;
|
|
38
|
+
/** The verb the call names (`list`, `kill`, `send_input`). */
|
|
39
|
+
action?: string;
|
|
40
|
+
questions: AgentAdminQuestion[];
|
|
41
|
+
fields: AgentAdminField[];
|
|
42
|
+
/** A sentence for a fact the adapter did not send (no result, no answer). */
|
|
43
|
+
note?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const TITLES: Readonly<Record<string, string>> = {
|
|
47
|
+
manage_task: 'Background task',
|
|
48
|
+
manage_subagents: 'Subagent',
|
|
49
|
+
define_subagent: 'Subagent definition',
|
|
50
|
+
send_message: 'Message',
|
|
51
|
+
schedule: 'Scheduled run',
|
|
52
|
+
ask_question: 'Question',
|
|
53
|
+
// opencode's spelling of the same control-plane verb.
|
|
54
|
+
question: 'Question',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const LABELS: Readonly<Record<string, string>> = {
|
|
58
|
+
Name: 'Name',
|
|
59
|
+
Description: 'Description',
|
|
60
|
+
Recipient: 'Recipient',
|
|
61
|
+
TaskId: 'Task id',
|
|
62
|
+
ConversationIds: 'Conversation ids',
|
|
63
|
+
DurationSeconds: 'Duration',
|
|
64
|
+
Prompt: 'Prompt',
|
|
65
|
+
Message: 'Message',
|
|
66
|
+
SystemPrompt: 'System prompt',
|
|
67
|
+
Role: 'Role',
|
|
68
|
+
TypeName: 'Type',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const BLOCK_KEYS: Readonly<Record<string, true>> = {
|
|
72
|
+
Description: true,
|
|
73
|
+
Prompt: true,
|
|
74
|
+
Message: true,
|
|
75
|
+
SystemPrompt: true,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const MONO_KEYS: Readonly<Record<string, true>> = {
|
|
79
|
+
Recipient: true,
|
|
80
|
+
TaskId: true,
|
|
81
|
+
ConversationIds: true,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** Identity before prose, so the card reads the same whatever order the
|
|
85
|
+
* adapter serialised its arguments in. */
|
|
86
|
+
const FIELD_ORDER: readonly string[] = [
|
|
87
|
+
'Name', 'Role', 'TypeName', 'Recipient', 'TaskId', 'ConversationIds',
|
|
88
|
+
'DurationSeconds', 'Description', 'Prompt', 'Message', 'SystemPrompt',
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
function asText(value: unknown): string {
|
|
92
|
+
if (typeof value === 'string') return value;
|
|
93
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
94
|
+
if (Array.isArray(value)) return value.map((entry) => (typeof entry === 'string' ? entry : JSON.stringify(entry))).join('\n');
|
|
95
|
+
return JSON.stringify(value, null, 2) ?? '';
|
|
96
|
+
}
|
|
97
|
+
|
|
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
|
+
function humanKey(key: string): string {
|
|
120
|
+
return LABELS[key] ?? key.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/_/g, ' ');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function agentAdminView(tool: ToolCallData): AgentAdminView {
|
|
124
|
+
const input = tool.input && typeof tool.input === 'object' && !Array.isArray(tool.input)
|
|
125
|
+
? (tool.input as Record<string, unknown>)
|
|
126
|
+
: {};
|
|
127
|
+
const name = (tool.name ?? tool.type ?? '').toLowerCase();
|
|
128
|
+
const action = typeof input.Action === 'string' && input.Action ? input.Action : undefined;
|
|
129
|
+
const questions = readQuestions(input.questions);
|
|
130
|
+
const collected: Array<{ key: string; field: AgentAdminField }> = [];
|
|
131
|
+
|
|
132
|
+
for (const [key, value] of Object.entries(input)) {
|
|
133
|
+
if (key === 'Action' || key === 'questions') continue;
|
|
134
|
+
if (value === undefined || value === null || value === '') continue;
|
|
135
|
+
const duration = key === 'DurationSeconds' && typeof value === 'number'
|
|
136
|
+
? `${value} second${value === 1 ? '' : 's'}`
|
|
137
|
+
: undefined;
|
|
138
|
+
collected.push({
|
|
139
|
+
key,
|
|
140
|
+
field: {
|
|
141
|
+
label: humanKey(key),
|
|
142
|
+
value: duration ?? asText(value),
|
|
143
|
+
...(MONO_KEYS[key] ? { mono: true } : {}),
|
|
144
|
+
...(BLOCK_KEYS[key] ? { block: true } : {}),
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const rank = (key: string) => {
|
|
150
|
+
const index = FIELD_ORDER.indexOf(key);
|
|
151
|
+
return index === -1 ? FIELD_ORDER.length : index;
|
|
152
|
+
};
|
|
153
|
+
collected.sort((a, b) => rank(a.key) - rank(b.key));
|
|
154
|
+
const fields = collected.map((entry) => entry.field);
|
|
155
|
+
|
|
156
|
+
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;
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
title: TITLES[name] ?? 'Agent call',
|
|
169
|
+
...(action ? { action } : {}),
|
|
170
|
+
questions,
|
|
171
|
+
fields,
|
|
172
|
+
...(note ? { note } : {}),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -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
|