@kabmo-labs/kabmo 0.42.1 → 0.42.2
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 +415 -415
- package/dist/client/static/js/{CsvGrid-8gdp5b49.js → CsvGrid-g6rek8y9.js} +1 -1
- package/dist/client/static/js/{DocxView-j9sphgra.js → DocxView-41t9ryws.js} +1 -1
- package/dist/client/static/js/{DrawioView-xsgjc7d8.js → DrawioView-mfxhfz1h.js} +1 -1
- package/dist/client/static/js/{ImageView-ve9hc519.js → ImageView-bxqw3t4k.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-5mqffvkc.js → LayoutWrapper-zt14rv9m.js} +1 -1
- package/dist/client/static/js/{Modal-50whypff.js → Modal-cm35g20x.js} +1 -1
- package/dist/client/static/js/{PdfView-afd5cg54.js → PdfView-bek8k888.js} +1 -1
- package/dist/client/static/js/{SessionsView-7719nvy0.js → SessionsView-gn53zyn7.js} +1 -1
- package/dist/client/static/js/{SheetView-gfzgxb4r.js → SheetView-vezssf6b.js} +1 -1
- package/dist/client/static/js/{SvgPreview-225pkb99.js → SvgPreview-f1qaw73k.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-z70sk69m.js → abnfDiagram-O67JEVCF-4qn94h52.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-pf1gpkje.js → architectureDiagram-NJMV4G6O-tbewzdya.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-sr25kbn6.js → blockDiagram-BEXU5L5S-njgnwckz.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-znstpg86.js → c4Diagram-YGBWAQC7-f58pcvbk.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-7n0pdcd8.js → classDiagram-v2-NBCMYWYE-52g73vyw.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-zn3qw4c4.js → cose-bilkent-JH36ORCC-ptdnshzh.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-3z41vtzs.js → cynefinDiagram-VND7K2PF-qabfdkzr.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-5j3zn883.js → dagre-6A5THRUB-kyf5jetf.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-ryw1w2kh.js → diagram-22UHCM2B-bxrsjtv9.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-p91q4gkh.js → diagram-3UASUU5V-0f41s00j.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-22dn73g4.js → diagram-ATOU4E4O-0z1zx9h1.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-589p9n53.js → diagram-CDSNMT55-znrmr6bk.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-ezw06wbx.js → diagram-MLGK6HIB-jfe2jhk0.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-cfwrsvk1.js → diagram-MPIPVDR6-2kaawmwa.js} +1 -1
- package/dist/client/static/js/{dockerfile-r4k7q34y.js → dockerfile-12exatm9.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-3rv2wvbf.js → ebnfDiagram-ZINNZB2B-s5n37rfp.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-ma40kneq.js → elk-276RUBZZ-433rd9fp.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-xwstsfqa.js → erDiagram-OPXOYQCR-key6ah0b.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-qxyx9tr9.js → ganttDiagram-FUAMR5RP-4efkhmca.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-v6sg7bkh.js → gitGraphDiagram-X574FWY7-ac376y2k.js} +1 -1
- package/dist/client/static/js/{index-mq6s2faf.js → index-02543wk3.js} +1 -1
- package/dist/client/static/js/{index-df4yxfzd.js → index-0e9nkc0g.js} +1 -1
- package/dist/client/static/js/{index-cqaz1281.js → index-0gbj4270.js} +1 -1
- package/dist/client/static/js/{index-b3d2k7ec.js → index-0pabfaac.js} +1 -1
- package/dist/client/static/js/{index-x7a5jpvq.js → index-1t5ybx9v.js} +1 -1
- package/dist/client/static/js/{index-9ss64g4g.js → index-1y3rzw6b.js} +1 -1
- package/dist/client/static/js/{index-5599dngt.js → index-38xv8h4t.js} +1 -1
- package/dist/client/static/js/{index-0nca2nhp.js → index-50mdqev0.js} +1 -1
- package/dist/client/static/js/{index-9hzfvjrb.js → index-5jnvz9hw.js} +1 -1
- package/dist/client/static/js/{index-8fvmyv7t.js → index-77t0nvt1.js} +1 -1
- package/dist/client/static/js/{index-mphhvgm9.js → index-7a2efrbj.js} +1 -1
- package/dist/client/static/js/{index-2w9j2nj4.js → index-82vk27q1.js} +1 -1
- package/dist/client/static/js/{index-0p43qr4k.js → index-8k7vjp8b.js} +1 -1
- package/dist/client/static/js/{index-4y0ayjfx.js → index-8kbp24xg.js} +1 -1
- package/dist/client/static/js/{index-xsts4pqm.js → index-cz50ha6x.js} +2 -2
- package/dist/client/static/js/{index-v5dbrq83.js → index-dtj73vs1.js} +1 -1
- package/dist/client/static/js/{index-x7m6dmt4.js → index-dzmar8jr.js} +1 -1
- package/dist/client/static/js/{index-313ctswm.js → index-f33c4paw.js} +1 -1
- package/dist/client/static/js/{index-001vebsp.js → index-fb6pw9xb.js} +1 -1
- package/dist/client/static/js/{index-qh753ynv.js → index-gp57dx2v.js} +1 -1
- package/dist/client/static/js/{index-rt6ac0kk.js → index-pzvr1699.js} +181 -181
- package/dist/client/static/js/{index-6dxs0tvg.js → index-r9db1gsf.js} +1 -1
- package/dist/client/static/js/{index-sr7sdm2t.js → index-raca8tsh.js} +1 -1
- package/dist/client/static/js/{index-y1p3bdsw.js → index-rf29f3fq.js} +1 -1
- package/dist/client/static/js/{index-kh6vp5w5.js → index-s4gv0rpk.js} +1 -1
- package/dist/client/static/js/{index-6eq445nn.js → index-v3f7we4n.js} +1 -1
- package/dist/client/static/js/{index-b37ewyvk.js → index-yjmm73jm.js} +1 -1
- package/dist/client/static/js/{index-w5q9ymf4.js → index-ykfd2fyj.js} +1 -1
- package/dist/client/static/js/{index-869bpqcs.js → index-yzda8j2d.js} +2 -2
- package/dist/client/static/js/{index-8pdz41yh.js → index-z78bzryw.js} +1 -1
- package/dist/client/static/js/{index-q3qpm7jn.js → index-zndbhb9w.js} +1 -1
- package/dist/client/static/js/{index-3d40c0a7.js → index-zs73zwjz.js} +1 -1
- package/dist/client/static/js/{index-mvykbyhe.js → index-zs7sjv6x.js} +1 -1
- package/dist/client/static/js/{index-5asf5625.js → index-zw621xez.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-0anekyhb.js → infoDiagram-VRGFBTTK-4e7ej63f.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-zxpmfkjb.js → ishikawaDiagram-OU5B5YK6-k3yet1ec.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-1e86fzra.js → journeyDiagram-ZHPQQLJL-qe352kyd.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-e85hhmr1.js → kanban-definition-PNTS6WVX-58hag75n.js} +1 -1
- package/dist/client/static/js/{mermaid.core-jpcrnzyw.js → mermaid.core-6e89h6vm.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-xwy5928e.js → mindmap-definition-NLK3R4M7-ncsam2fm.js} +1 -1
- package/dist/client/static/js/one-dark-pro-qmyne0tn.js +1 -0
- package/dist/client/static/js/one-light-dj0ecjcj.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-7dy6pw26.js → pegDiagram-GJSIUBJH-b5ckc39d.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-nrv2t5yn.js → pieDiagram-5QR66LMP-s4d47ve8.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-3nt63xr8.js → quadrantDiagram-O4NWA36T-zm0ekvjz.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-evm05hzp.js → railroadDiagram-XR7U4H2S-52vdqf53.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-tzrcmktj.js → requirementDiagram-PLB6GJNP-7kf8bmk9.js} +1 -1
- package/dist/client/static/js/{rust-pcvgybk3.js → rust-q98kssv3.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-jvjd5rz8.js → sankeyDiagram-IPEJSGJF-bcb9f54a.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-0zvjwx29.js → sequenceDiagram-PO4LG4MO-76ywvj7g.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-6t6g0edv.js → sizeCapture-INFHLROL-p9bsf5dc.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-nb13b23a.js → stateDiagram-v2-GCMORJYK-1ecfb3fs.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-ef8vmg6f.js → swimlanes-2SLR337P-2pyjr946.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-f4sx355z.js → swimlanesDiagram-TC7HE7FX-qr5hdxm4.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-3bfph698.js → timeline-definition-EJHVYXUP-4csxwmn2.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-vj6yj6tc.js → usecaseDiagram-POWQR4AR-0p1jnbsn.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-9xyyabaq.js → vennDiagram-UO4OBE2U-y1hgdet4.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-zpcwgv9d.js → wardleyDiagram-VNRHLVJA-p578yrgm.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-pdr2rms2.js → xychartDiagram-PMCCYNJV-b08b4ah0.js} +1 -1
- package/package.json +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions.tsx +45 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view.ts +14 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Card.tsx +2 -12
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Compact.tsx +42 -38
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +25 -21
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Trace.tsx +41 -29
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +47 -43
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/parity.test.tsx +136 -0
- package/src/server/lib/omp/session/scan.ts +15 -2
- package/src/server/lib/omp/session/session-discovery.test.ts +21 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +3 -3
- package/src/shared/lib/omp/session/operator-title.test.ts +21 -0
- package/src/shared/lib/omp/session/operator-title.ts +28 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-evp84v09.js +0 -1
- package/dist/client/static/js/one-dark-pro-r0tswz8r.js +0 -1
- package/dist/client/static/js/one-light-xzcfrptf.js +0 -1
|
@@ -47,8 +47,10 @@ export interface ToolView {
|
|
|
47
47
|
hasPanel: boolean;
|
|
48
48
|
/** The plugin renderer to use INSTEAD, when the host has no panel. */
|
|
49
49
|
pluginPanel: PluginTimelineRenderer;
|
|
50
|
-
/** Whether there is anything to expand. */
|
|
50
|
+
/** Whether there is anything to expand — a panel, a plugin, or generic text. */
|
|
51
51
|
hasBody: boolean;
|
|
52
|
+
/** The generic Input / Diff / Output fallback is what fills the body. */
|
|
53
|
+
hasGenericBody: boolean;
|
|
52
54
|
summary: ToolSummary | null;
|
|
53
55
|
header: ToolCardHeader;
|
|
54
56
|
subtitle: string | undefined;
|
|
@@ -76,7 +78,6 @@ export function useToolView(tool: ToolCallData): ToolView {
|
|
|
76
78
|
// so a plugin can ship its own agent tool without shadowing `bash` or `read`.
|
|
77
79
|
const pluginRenderer = usePluginTimelineRenderer(toolKey);
|
|
78
80
|
const pluginPanel = hasPanel ? null : pluginRenderer;
|
|
79
|
-
const hasBody = hasPanel || pluginPanel !== null;
|
|
80
81
|
const summary = useMemo(() => toolSummary(tool), [tool]);
|
|
81
82
|
const header = useMemo(() => toolCardHeader(tool, toolKey), [tool, toolKey]);
|
|
82
83
|
const subtitle = toolCardSubtitle(tool, header);
|
|
@@ -85,9 +86,17 @@ export function useToolView(tool: ToolCallData): ToolView {
|
|
|
85
86
|
const outputText = tool.output || (tool.error ? `Error: ${tool.error}` : '');
|
|
86
87
|
const diffText = diffTextOf(tool);
|
|
87
88
|
|
|
89
|
+
// A tool with no panel and no plugin still has something to show: the generic
|
|
90
|
+
// Input / Diff / Output fallback. The card always rendered it (its shell sees
|
|
91
|
+
// a child VNode and calls that a body); the line styles used to gate the body
|
|
92
|
+
// on a panel alone, so a custom or plugin tool opened nothing at all.
|
|
93
|
+
const hasGenericBody =
|
|
94
|
+
!hasPanel && pluginPanel === null && Boolean(commandOrInput || diffText || outputText);
|
|
95
|
+
const hasBody = hasPanel || pluginPanel !== null || hasGenericBody;
|
|
96
|
+
|
|
88
97
|
const inputJson = useMemo(
|
|
89
|
-
() => (
|
|
90
|
-
[
|
|
98
|
+
() => (hasGenericBody && commandOrInput ? tryParseJson(commandOrInput) : null),
|
|
99
|
+
[hasGenericBody, commandOrInput],
|
|
91
100
|
);
|
|
92
101
|
|
|
93
102
|
// A reminder envelope in the result is the runtime interrupting the call, not
|
|
@@ -118,6 +127,7 @@ export function useToolView(tool: ToolCallData): ToolView {
|
|
|
118
127
|
hasPanel,
|
|
119
128
|
pluginPanel,
|
|
120
129
|
hasBody,
|
|
130
|
+
hasGenericBody,
|
|
121
131
|
summary: headerSummary,
|
|
122
132
|
header,
|
|
123
133
|
subtitle,
|
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
import { useCallback } from 'preact/hooks';
|
|
16
16
|
import { memo } from 'preact/compat';
|
|
17
|
-
import { Bell } from 'lucide-preact';
|
|
18
|
-
import { ArtifactChip } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip';
|
|
19
17
|
import { ToolBody } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody';
|
|
20
18
|
import { ToolCardShell } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolCardShell';
|
|
19
|
+
import { ToolRowActions } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions';
|
|
21
20
|
import { useToolView } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view';
|
|
22
21
|
import type { ToolRowProps } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/props';
|
|
23
22
|
|
|
@@ -30,16 +29,7 @@ export const CardRow = memo(function CardRow({ tool, isOpen, onToggle, defaultEx
|
|
|
30
29
|
|
|
31
30
|
// A reminder envelope in the result is the runtime interrupting the call, not
|
|
32
31
|
// its outcome — the header flags it beside the status badge.
|
|
33
|
-
const actions =
|
|
34
|
-
<>
|
|
35
|
-
<ArtifactChip tool={tool} />
|
|
36
|
-
{view.isReminder && (
|
|
37
|
-
<span className="inline-flex items-center gap-1 rounded-full bg-error/10 px-2 py-0.5 text-[10px] font-semibold text-error">
|
|
38
|
-
<Bell size={10} /> Reminder
|
|
39
|
-
</span>
|
|
40
|
-
)}
|
|
41
|
-
</>
|
|
42
|
-
);
|
|
32
|
+
const actions = <ToolRowActions tool={tool} isReminder={view.isReminder} />;
|
|
43
33
|
|
|
44
34
|
return (
|
|
45
35
|
<ToolCardShell
|
|
@@ -21,6 +21,7 @@ import { memo } from 'preact/compat';
|
|
|
21
21
|
import { ChevronDown } from 'lucide-preact';
|
|
22
22
|
import { ToolBody } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody';
|
|
23
23
|
import { ToolFactChips } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips';
|
|
24
|
+
import { ToolRowActions } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions';
|
|
24
25
|
import { toolStatusGlyph, STATUS_TONE_CLASS } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/status-glyph';
|
|
25
26
|
import { useToolView } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view';
|
|
26
27
|
import { toolToggleLabel } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label';
|
|
@@ -39,45 +40,48 @@ export const CompactRow = memo(function CompactRow({ tool, isOpen, onToggle, def
|
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<div className="group" data-tool-row="compact">
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{status.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<span className="min-w-0 flex-1
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
43
|
+
<div className="flex items-center gap-1">
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
onClick={handleToggle}
|
|
47
|
+
disabled={!view.hasBody || view.alwaysExpanded}
|
|
48
|
+
aria-expanded={isExpanded}
|
|
49
|
+
aria-label={view.hasBody && !view.alwaysExpanded ? toolToggleLabel(view.header.title, view.subtitle, isExpanded) : undefined}
|
|
50
|
+
className={`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5 rounded-md px-1.5 py-1 text-left transition-colors ${
|
|
51
|
+
view.hasBody && !view.alwaysExpanded ? 'cursor-pointer hover:bg-ink/[0.03]' : 'cursor-default'
|
|
52
|
+
} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
|
|
53
|
+
>
|
|
54
|
+
<span className={`shrink-0 ${STATUS_TONE_CLASS[status.tone]}`} aria-hidden="true">
|
|
55
|
+
{status.glyph}
|
|
56
|
+
</span>
|
|
57
|
+
<span className="sr-only">{status.word}</span>
|
|
58
|
+
<span className="shrink-0 text-ink/45" aria-hidden="true">
|
|
59
|
+
{view.icon}
|
|
60
|
+
</span>
|
|
61
|
+
<span className="shrink-0 truncate text-[12px] font-semibold tracking-tight text-ink">
|
|
62
|
+
{view.header.title}
|
|
63
|
+
</span>
|
|
64
|
+
{/* The subject and the facts share ONE clipping row, the way the card's
|
|
65
|
+
meta line does. Without the clip a long `+43 −16` chip pair widened
|
|
66
|
+
the section past the phone viewport: measured at 390, the section's
|
|
67
|
+
scrollWidth ran to 439 against a 362 client width. */}
|
|
68
|
+
<span className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
|
69
|
+
<span className="min-w-0 flex-1 truncate font-mono text-[10.5px] text-ink/45">{view.subtitle}</span>
|
|
70
|
+
{view.summary && view.summary.facts.length > 0 && (
|
|
71
|
+
<span className="shrink-0">
|
|
72
|
+
<ToolFactChips facts={view.summary.facts} max={2} />
|
|
73
|
+
</span>
|
|
74
|
+
)}
|
|
75
|
+
</span>
|
|
76
|
+
{view.hasBody && !view.alwaysExpanded && (
|
|
77
|
+
<ChevronDown
|
|
78
|
+
size={13}
|
|
79
|
+
className={`shrink-0 text-ink/30 transition-transform duration-200 ${isExpanded ? 'rotate-180' : ''}`}
|
|
80
|
+
/>
|
|
72
81
|
)}
|
|
73
|
-
</
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
size={13}
|
|
77
|
-
className={`shrink-0 text-ink/30 transition-transform duration-200 ${isExpanded ? 'rotate-180' : ''}`}
|
|
78
|
-
/>
|
|
79
|
-
)}
|
|
80
|
-
</button>
|
|
82
|
+
</button>
|
|
83
|
+
<ToolRowActions tool={tool} isReminder={view.isReminder} />
|
|
84
|
+
</div>
|
|
81
85
|
|
|
82
86
|
{isExpanded && view.hasBody && (
|
|
83
87
|
<div className="ml-5 mt-0.5 overflow-hidden border-l border-dashed border-ink/15 py-2 pl-3 space-y-3 code-surface">
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { useCallback, useState } from 'preact/hooks';
|
|
18
18
|
import { memo } from 'preact/compat';
|
|
19
19
|
import { ToolBody } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody';
|
|
20
|
+
import { ToolRowActions } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions';
|
|
20
21
|
import { toolStatusGlyph, STATUS_TONE_CLASS } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/status-glyph';
|
|
21
22
|
import { useToolView } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view';
|
|
22
23
|
import { toolToggleLabel } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label';
|
|
@@ -40,27 +41,30 @@ export const MinimalRow = memo(function MinimalRow({ tool, isOpen, onToggle, def
|
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
43
|
<div className="px-1" data-tool-row="minimal">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
<div className="flex items-center gap-1">
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
onClick={handleToggle}
|
|
48
|
+
disabled={!view.hasBody || view.alwaysExpanded}
|
|
49
|
+
aria-expanded={isExpanded}
|
|
50
|
+
aria-label={view.hasBody && !view.alwaysExpanded ? toolToggleLabel(view.header.title, view.subtitle, isExpanded) : undefined}
|
|
51
|
+
className={`flex min-w-0 flex-1 items-baseline gap-1.5 rounded py-0.5 text-left text-[11.5px] transition-colors ${
|
|
52
|
+
view.hasBody && !view.alwaysExpanded ? 'cursor-pointer hover:bg-ink/[0.03]' : 'cursor-default'
|
|
53
|
+
} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
|
|
54
|
+
>
|
|
55
|
+
<span className={`shrink-0 self-center ${toneClass}`} aria-hidden="true">
|
|
56
|
+
{status.glyph}
|
|
57
|
+
</span>
|
|
58
|
+
<span className="sr-only">{status.word}</span>
|
|
59
|
+
<span className="shrink-0 font-medium text-ink/70">{view.header.title}</span>
|
|
60
|
+
{(view.subtitle || factsLine) && <span className="text-ink/25">·</span>}
|
|
61
|
+
<span className="min-w-0 truncate font-mono text-ink/45">
|
|
62
|
+
{view.subtitle}
|
|
63
|
+
{factsLine}
|
|
64
|
+
</span>
|
|
65
|
+
</button>
|
|
66
|
+
<ToolRowActions tool={tool} isReminder={view.isReminder} />
|
|
67
|
+
</div>
|
|
64
68
|
|
|
65
69
|
{isExpanded && view.hasBody && (
|
|
66
70
|
<div className="my-1.5 overflow-hidden rounded-md border border-dashed border-ink/15 px-3 py-2.5 space-y-3 code-surface">
|
|
@@ -19,6 +19,7 @@ import { useCallback, useState } from 'preact/hooks';
|
|
|
19
19
|
import { memo } from 'preact/compat';
|
|
20
20
|
import { ToolBody } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody';
|
|
21
21
|
import { ToolFactChips } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips';
|
|
22
|
+
import { ToolRowActions } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions';
|
|
22
23
|
import { toolStatusGlyph, STATUS_TONE_CLASS } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/status-glyph';
|
|
23
24
|
import { useToolView } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view';
|
|
24
25
|
import { toolToggleLabel } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label';
|
|
@@ -38,41 +39,52 @@ export const TraceRow = memo(function TraceRow({ tool, isOpen, onToggle, default
|
|
|
38
39
|
return (
|
|
39
40
|
<div className="relative pl-4" data-tool-row="trace">
|
|
40
41
|
{/* The node, drawn ON the section's rail. `-left-px` centres it on the
|
|
41
|
-
1px line the section owns.
|
|
42
|
+
1px line the section owns. `warn` (an aborted call) gets its own
|
|
43
|
+
tone: falling through to the muted node made an interruption look
|
|
44
|
+
like a running or skipped call. */}
|
|
42
45
|
<span
|
|
43
46
|
aria-hidden="true"
|
|
44
47
|
className={`absolute left-0 top-[9px] flex h-2 w-2 items-center justify-center rounded-full ${
|
|
45
|
-
status.tone === 'error'
|
|
48
|
+
status.tone === 'error'
|
|
49
|
+
? 'bg-error'
|
|
50
|
+
: status.tone === 'warn'
|
|
51
|
+
? 'bg-warning'
|
|
52
|
+
: status.tone === 'ok'
|
|
53
|
+
? 'bg-ink/45'
|
|
54
|
+
: 'bg-ink/20'
|
|
46
55
|
}`}
|
|
47
56
|
/>
|
|
48
57
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{status.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<span className="min-w-0 flex-1
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
<div className="flex items-center gap-1">
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
onClick={handleToggle}
|
|
62
|
+
disabled={!view.hasBody || view.alwaysExpanded}
|
|
63
|
+
aria-expanded={isExpanded}
|
|
64
|
+
aria-label={view.hasBody && !view.alwaysExpanded ? toolToggleLabel(view.header.title, view.subtitle, isExpanded) : undefined}
|
|
65
|
+
className={`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5 rounded-md px-1.5 py-1 text-left transition-colors ${
|
|
66
|
+
view.hasBody && !view.alwaysExpanded ? 'cursor-pointer hover:bg-ink/[0.03]' : 'cursor-default'
|
|
67
|
+
} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
|
|
68
|
+
>
|
|
69
|
+
<span className={`shrink-0 self-center ${STATUS_TONE_CLASS[status.tone]}`} aria-hidden="true">
|
|
70
|
+
{status.glyph}
|
|
71
|
+
</span>
|
|
72
|
+
<span className="sr-only">{status.word}</span>
|
|
73
|
+
<span className="shrink-0 text-[12px] font-semibold tracking-tight text-ink">{view.header.title}</span>
|
|
74
|
+
{/* Subject + facts in ONE clipping row, the way the card's meta line
|
|
75
|
+
draws it: without the clip a long chip pair widened the section past
|
|
76
|
+
the phone viewport (measured at 390: 455 scrollWidth against 362). */}
|
|
77
|
+
<span className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
|
78
|
+
<span className="min-w-0 flex-1 truncate font-mono text-[10.5px] text-ink/45">{view.subtitle}</span>
|
|
79
|
+
{view.summary && view.summary.facts.length > 0 && (
|
|
80
|
+
<span className="shrink-0">
|
|
81
|
+
<ToolFactChips facts={view.summary.facts} max={2} />
|
|
82
|
+
</span>
|
|
83
|
+
)}
|
|
84
|
+
</span>
|
|
85
|
+
</button>
|
|
86
|
+
<ToolRowActions tool={tool} isReminder={view.isReminder} />
|
|
87
|
+
</div>
|
|
76
88
|
|
|
77
89
|
{isExpanded && view.hasBody && (
|
|
78
90
|
<div className="mb-1 ml-[3.5px] overflow-hidden border-l border-ink/10 py-2 pl-3 space-y-3 code-surface">
|
|
@@ -34,6 +34,7 @@ import { useCallback, useState } from 'preact/hooks';
|
|
|
34
34
|
import { memo } from 'preact/compat';
|
|
35
35
|
import type { ToolCallData } from '@/shared/types';
|
|
36
36
|
import { ToolBody } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody';
|
|
37
|
+
import { ToolRowActions } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolRowActions';
|
|
37
38
|
import {
|
|
38
39
|
toolStatusGlyph,
|
|
39
40
|
type ToolStatusTone,
|
|
@@ -134,50 +135,53 @@ export const TuiRow = memo(function TuiRow({ tool, isOpen, onToggle, defaultExpa
|
|
|
134
135
|
only — the colours separate the three claims (what ran, on what, how
|
|
135
136
|
it ended), which is what the terminal does with SGR and what a box
|
|
136
137
|
would otherwise have to do with borders. */}
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
<span className="sr-only">{status.word}</span>
|
|
153
|
-
<span className="shrink-0 font-semibold text-info">{view.header.title}</span>
|
|
154
|
-
{view.subtitle && (
|
|
155
|
-
<>
|
|
156
|
-
<span className="shrink-0 text-ink/25">:</span>
|
|
157
|
-
<span className="min-w-0 flex-1 truncate text-meta">{view.subtitle}</span>
|
|
158
|
-
</>
|
|
159
|
-
)}
|
|
160
|
-
<span className={`shrink-0 font-semibold ${tone}`}>{`[${status.word.toLowerCase()}]`}</span>
|
|
161
|
-
{facts.length > 0 && (
|
|
162
|
-
// Facts are the LAST thing on the line and they clip as a unit, so a
|
|
163
|
-
// long `exit 1 · 412 B` can never widen the row past the panel —
|
|
164
|
-
// measured at 390 the unbounded group ran the section to 459/362.
|
|
165
|
-
// The whole group carries the tooltip with every fact, so a clipped
|
|
166
|
-
// tail is still recoverable.
|
|
167
|
-
<span
|
|
168
|
-
className="min-w-0 shrink truncate text-[10.5px]"
|
|
169
|
-
title={facts.map((fact) => fact.label).join(' · ')}
|
|
170
|
-
>
|
|
171
|
-
<span className="text-ink/25">· </span>
|
|
172
|
-
<Facts facts={facts} max={HEAD_FACT_LIMIT} />
|
|
173
|
-
</span>
|
|
174
|
-
)}
|
|
175
|
-
{canToggle && (
|
|
176
|
-
<span className="ml-auto shrink-0 pl-1 text-ink/40" aria-hidden="true">
|
|
177
|
-
{isExpanded ? '▾' : '▸'}
|
|
138
|
+
<div className="flex items-center gap-1">
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
onClick={handleToggle}
|
|
142
|
+
disabled={!canToggle}
|
|
143
|
+
aria-expanded={isExpanded}
|
|
144
|
+
aria-label={
|
|
145
|
+
canToggle ? toolToggleLabel(view.header.title, view.subtitle, isExpanded) : undefined
|
|
146
|
+
}
|
|
147
|
+
className={`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-1 gap-y-0 rounded px-1 py-0.5 text-left text-[11.5px] leading-[1.55] transition-colors ${
|
|
148
|
+
canToggle ? 'cursor-pointer hover:bg-ink/[0.03]' : 'cursor-default'
|
|
149
|
+
} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
|
|
150
|
+
>
|
|
151
|
+
<span className={`shrink-0 self-center ${tone}`} aria-hidden="true">
|
|
152
|
+
{status.glyph}
|
|
178
153
|
</span>
|
|
179
|
-
|
|
180
|
-
|
|
154
|
+
<span className="sr-only">{status.word}</span>
|
|
155
|
+
<span className="shrink-0 font-semibold text-info">{view.header.title}</span>
|
|
156
|
+
{view.subtitle && (
|
|
157
|
+
<>
|
|
158
|
+
<span className="shrink-0 text-ink/25">:</span>
|
|
159
|
+
<span className="min-w-0 flex-1 truncate text-meta">{view.subtitle}</span>
|
|
160
|
+
</>
|
|
161
|
+
)}
|
|
162
|
+
<span className={`shrink-0 font-semibold ${tone}`}>{`[${status.word.toLowerCase()}]`}</span>
|
|
163
|
+
{facts.length > 0 && (
|
|
164
|
+
// Facts are the LAST thing on the line and they clip as a unit, so a
|
|
165
|
+
// long `exit 1 · 412 B` can never widen the row past the panel —
|
|
166
|
+
// measured at 390 the unbounded group ran the section to 459/362.
|
|
167
|
+
// The whole group carries the tooltip with every fact, so a clipped
|
|
168
|
+
// tail is still recoverable.
|
|
169
|
+
<span
|
|
170
|
+
className="min-w-0 shrink truncate text-[10.5px]"
|
|
171
|
+
title={facts.map((fact) => fact.label).join(' · ')}
|
|
172
|
+
>
|
|
173
|
+
<span className="text-ink/25">· </span>
|
|
174
|
+
<Facts facts={facts} max={HEAD_FACT_LIMIT} />
|
|
175
|
+
</span>
|
|
176
|
+
)}
|
|
177
|
+
{canToggle && (
|
|
178
|
+
<span className="ml-auto shrink-0 pl-1 text-ink/40" aria-hidden="true">
|
|
179
|
+
{isExpanded ? '▾' : '▸'}
|
|
180
|
+
</span>
|
|
181
|
+
)}
|
|
182
|
+
</button>
|
|
183
|
+
<ToolRowActions tool={tool} isReminder={view.isReminder} />
|
|
184
|
+
</div>
|
|
181
185
|
|
|
182
186
|
{isExpanded && view.hasBody && (
|
|
183
187
|
// Indentation, not a frame: the body hangs off the line the way a
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What every render style must show, whichever frame it draws.
|
|
8
|
+
*
|
|
9
|
+
* A style is a frame, not a capability: the card, the status line, the rail
|
|
10
|
+
* node and the terminal line all render the same call. Three facts used to be
|
|
11
|
+
* card-only, and each one was a silent loss in the other four styles:
|
|
12
|
+
*
|
|
13
|
+
* - a tool with no specialized panel (a custom or plugin tool) had no body at
|
|
14
|
+
* all, because the line styles gated the body on a panel while the card
|
|
15
|
+
* always rendered the generic Input / Diff / Output;
|
|
16
|
+
* - a result omp capped or rewrote had no "Full output" chip, so the truncated
|
|
17
|
+
* copy on screen was the only copy the reader could reach;
|
|
18
|
+
* - a reminder envelope in the result read as an ordinary success.
|
|
19
|
+
*
|
|
20
|
+
* The trace node's `warn` tone is pinned here too: an aborted call used to fall
|
|
21
|
+
* through to the muted node, indistinguishable from a running or skipped one.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
25
|
+
import { Window } from 'happy-dom';
|
|
26
|
+
import { h, render } from 'preact';
|
|
27
|
+
import { act } from 'preact/test-utils';
|
|
28
|
+
import { ToolCallingSection } from '@/client/components/workspace/chat-timeline/ToolCallingSection';
|
|
29
|
+
import { SessionStateProvider } from '@/client/components/common/session-state-provider';
|
|
30
|
+
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
31
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
32
|
+
import type { ToolCallData } from '@/shared/types/chat';
|
|
33
|
+
|
|
34
|
+
let container: HTMLElement;
|
|
35
|
+
|
|
36
|
+
beforeAll(() => installDomGlobals(new Window({ url: 'http://localhost/?sessionId=parity' })));
|
|
37
|
+
afterAll(() => restoreDomGlobals());
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
container = document.createElement('div');
|
|
41
|
+
document.body.appendChild(container);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
render(null, container);
|
|
46
|
+
container.remove();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/** A tool the host has no panel for — the generic body is its only body. */
|
|
50
|
+
const CUSTOM_TOOL: ToolCallData = {
|
|
51
|
+
id: 'custom-1',
|
|
52
|
+
type: 'custom',
|
|
53
|
+
name: 'web_fetch',
|
|
54
|
+
title: 'Web Fetch',
|
|
55
|
+
status: 'success',
|
|
56
|
+
input: { url: 'https://example.com' },
|
|
57
|
+
output: 'CUSTOM_OUTPUT_TOKEN',
|
|
58
|
+
} as ToolCallData;
|
|
59
|
+
|
|
60
|
+
/** A result omp capped, with the lossless original behind an artifact id. */
|
|
61
|
+
const ARTIFACT_TOOL: ToolCallData = {
|
|
62
|
+
id: 'artifact-1',
|
|
63
|
+
type: 'bash',
|
|
64
|
+
name: 'bash',
|
|
65
|
+
title: 'Bash',
|
|
66
|
+
status: 'success',
|
|
67
|
+
command: 'seq 1 100000',
|
|
68
|
+
output: 'truncated',
|
|
69
|
+
details: { meta: { limits: { columnTruncated: { artifactId: '42', artifactElidedBytes: 1024 } } } },
|
|
70
|
+
} as ToolCallData;
|
|
71
|
+
|
|
72
|
+
/** The runtime interrupting the call, not its outcome. */
|
|
73
|
+
const REMINDER_TOOL: ToolCallData = {
|
|
74
|
+
id: 'reminder-1',
|
|
75
|
+
type: 'bash',
|
|
76
|
+
name: 'bash',
|
|
77
|
+
title: 'Bash',
|
|
78
|
+
status: 'success',
|
|
79
|
+
command: 'bun test',
|
|
80
|
+
output: '<system-reminder>Every turn MUST end with a tool call.</system-reminder>',
|
|
81
|
+
} as ToolCallData;
|
|
82
|
+
|
|
83
|
+
const ABORTED_TOOL: ToolCallData = {
|
|
84
|
+
id: 'aborted-1',
|
|
85
|
+
type: 'bash',
|
|
86
|
+
name: 'bash',
|
|
87
|
+
title: 'Bash',
|
|
88
|
+
status: 'aborted',
|
|
89
|
+
command: 'bun test',
|
|
90
|
+
output: '',
|
|
91
|
+
} as ToolCallData;
|
|
92
|
+
|
|
93
|
+
async function mount(tools: ToolCallData[], style: string): Promise<HTMLElement> {
|
|
94
|
+
primeKabmoSettings({ kabmo_settings: { toolRenderStyle: style } });
|
|
95
|
+
await act(async () => {
|
|
96
|
+
render(
|
|
97
|
+
h(SessionStateProvider, {
|
|
98
|
+
sessionId: `parity-${style}`,
|
|
99
|
+
children: h(ToolCallingSection, { tools }),
|
|
100
|
+
}),
|
|
101
|
+
container,
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
return container;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
describe.each(['card', 'compact', 'trace', 'minimal', 'tui'])('style parity: %s', (style) => {
|
|
108
|
+
test('a panel-less tool opens its generic body', async () => {
|
|
109
|
+
const el = await mount([CUSTOM_TOOL], style);
|
|
110
|
+
const toggle = el.querySelector('[data-tool-row] button') as HTMLElement;
|
|
111
|
+
expect(toggle.getAttribute('aria-label')).toBe('Expand WEB Fetch');
|
|
112
|
+
|
|
113
|
+
await act(async () => {
|
|
114
|
+
toggle.click();
|
|
115
|
+
});
|
|
116
|
+
expect(el.querySelector('.code-surface')?.textContent).toContain('CUSTOM_OUTPUT_TOKEN');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('a spilled result offers the full output', async () => {
|
|
120
|
+
const el = await mount([ARTIFACT_TOOL], style);
|
|
121
|
+
expect(el.querySelector('[aria-label="Read the full output"]')).not.toBeNull();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('a reminder envelope is flagged', async () => {
|
|
125
|
+
const el = await mount([REMINDER_TOOL], style);
|
|
126
|
+
expect(el.textContent).toContain('Reminder');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('the trace node tone', () => {
|
|
131
|
+
test('an aborted call takes the warning tone, not the muted one', async () => {
|
|
132
|
+
const el = await mount([ABORTED_TOOL], 'trace');
|
|
133
|
+
const node = el.querySelector('[data-tool-row="trace"] > span[aria-hidden="true"]') as HTMLElement;
|
|
134
|
+
expect(node.className).toContain('bg-warning');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import { readLastEntryTimestamp, readTextPrefix, SESSION_LIST_PREFIX_BYTES } from '@/server/lib/omp/session/file-scan';
|
|
21
21
|
import { countMessageMarkers, parseJsonlLenient, parseSessionListHeader } from '@/shared/lib/omp/session/jsonl';
|
|
22
|
-
import { firstOperatorTitleFromPrefix, operatorTitleFromEntry } from '@/shared/lib/omp/session/operator-title';
|
|
22
|
+
import { countSkillPromptMarkers, firstOperatorTitleFromPrefix, operatorTitleFromEntry, SKILL_PROMPT_CUSTOM_TYPE } from '@/shared/lib/omp/session/operator-title';
|
|
23
23
|
|
|
24
24
|
export const SESSION_TITLE_SLOT_BYTES = 256;
|
|
25
25
|
|
|
@@ -76,6 +76,7 @@ export async function scanSessionInfo(filePath: string): Promise<OmpSessionInfo
|
|
|
76
76
|
type?: string;
|
|
77
77
|
message?: { role?: string; content?: unknown };
|
|
78
78
|
shortSummary?: string;
|
|
79
|
+
customType?: string;
|
|
79
80
|
};
|
|
80
81
|
if (entry.type === 'compaction' && typeof entry.shortSummary === 'string') {
|
|
81
82
|
shortSummary = entry.shortSummary;
|
|
@@ -83,6 +84,14 @@ export async function scanSessionInfo(filePath: string): Promise<OmpSessionInfo
|
|
|
83
84
|
if (entry.type === 'message' && entry.message) {
|
|
84
85
|
parsedMessageCount++;
|
|
85
86
|
}
|
|
87
|
+
// A `/skill:` turn is a real message in omp's transcript (a
|
|
88
|
+
// `custom_message`, not a `message`). Counting only `message` entries
|
|
89
|
+
// reported `messageCount: 0` for a chat opened with `/skill:<name>`, and
|
|
90
|
+
// the sidebar drops `messageCount === 0` files as header-only — measured:
|
|
91
|
+
// 8 real chats in one project missing from the list.
|
|
92
|
+
if (entry.type === 'custom_message' && entry.customType === SKILL_PROMPT_CUSTOM_TYPE) {
|
|
93
|
+
parsedMessageCount++;
|
|
94
|
+
}
|
|
86
95
|
// The operator's opening turn, by the ONE rule every surface shares — a
|
|
87
96
|
// `user` message OR a `/skill:` custom entry. A skill turn carries no
|
|
88
97
|
// `role` field, so a scan that looked only for `role: "user"` reported
|
|
@@ -99,6 +108,10 @@ export async function scanSessionInfo(filePath: string): Promise<OmpSessionInfo
|
|
|
99
108
|
// raw-text pass below is the only chance — it is what keeps this reader in
|
|
100
109
|
// agreement with the header instead of guessing a placeholder.
|
|
101
110
|
firstMessage ||= firstOperatorTitleFromPrefix(prefix) ?? '';
|
|
111
|
+
// Same reason for the COUNT: a skill entry cut by the window is not a
|
|
112
|
+
// parsed entry, so the raw marker is the only evidence the chat has a turn
|
|
113
|
+
// at all. Without it the row is filtered out as header-only.
|
|
114
|
+
const rawMessageCount = countMessageMarkers(prefix) + countSkillPromptMarkers(prefix);
|
|
102
115
|
return {
|
|
103
116
|
path: filePath,
|
|
104
117
|
id: header.id,
|
|
@@ -109,7 +122,7 @@ export async function scanSessionInfo(filePath: string): Promise<OmpSessionInfo
|
|
|
109
122
|
modified: lastEntryAt ?? mtime,
|
|
110
123
|
fileMtime: mtime,
|
|
111
124
|
fileMtimeMs: mtimeMs,
|
|
112
|
-
messageCount: Math.max(parsedMessageCount,
|
|
125
|
+
messageCount: Math.max(parsedMessageCount, rawMessageCount),
|
|
113
126
|
size,
|
|
114
127
|
firstMessage: firstMessage || '(no messages)',
|
|
115
128
|
};
|