claude-code-kanban 7.11.0 → 7.12.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.
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ // A message to a stopped subagent spawns it again under the same id, and the plugin appends
4
+ // another start line. Each start line begins a new run, so nothing of the run before it shows.
5
+ function foldAgentLines(raw) {
6
+ let merged = {};
7
+ for (const line of raw.split(/\r?\n/)) {
8
+ if (!line.trim()) continue;
9
+ let obj;
10
+ try { obj = JSON.parse(line); } catch (_) { continue; }
11
+ if (obj.event === 'start') merged = {};
12
+ Object.assign(merged, obj);
13
+ }
14
+ return merged;
15
+ }
16
+
17
+ module.exports = { foldAgentLines };
package/lib/show.js CHANGED
@@ -6,6 +6,7 @@ const crypto = require('node:crypto');
6
6
  const fs = require('node:fs');
7
7
  const path = require('node:path');
8
8
  const express = require('express');
9
+ const { startFolder } = require('./folder-dialog');
9
10
  const { httpError } = require('./http-error');
10
11
 
11
12
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -24,14 +25,15 @@ function isLabel(v) {
24
25
  // A string is a reason the body is refused.
25
26
  function parsePost(body) {
26
27
  if (!body || typeof body !== 'object' || Array.isArray(body)) return 'body must be a JSON object';
27
- const { sessionId, title, key, kind = 'markdown', content, file } = body;
28
+ const { sessionId, title, key, kind = 'markdown', content, file, base } = body;
28
29
  if (typeof sessionId !== 'string' || !UUID_RE.test(sessionId)) return 'invalid sessionId';
29
30
  if (!isLabel(title)) return `title must be a non-empty string of at most ${MAX_LABEL} characters`;
30
31
  if (key != null && !isLabel(key)) return `key must be a non-empty string of at most ${MAX_LABEL} characters`;
31
32
  if (!Object.hasOwn(EXT, kind)) return 'kind must be markdown or html';
32
33
  if (content != null) return 'content is not accepted: call show with only title and key to get a file to write the card into';
33
34
  if (file != null && (typeof file !== 'string' || !path.isAbsolute(file))) return 'file must be an absolute path';
34
- return { sessionId, title, key: key ?? null, kind, file: file ?? null };
35
+ if (base != null && !startFolder(base)) return 'base must be an absolute path to an existing folder';
36
+ return { sessionId, title, key: key ?? null, kind, file: file ?? null, base: base ?? null };
35
37
  }
36
38
 
37
39
  function writeAtomic(file, text) {
@@ -193,7 +195,7 @@ function createShowStore(o) {
193
195
  // `kind` of a file post is the one readPreviewFile gave when it was posted. A post without a file
194
196
  // is a claim: cck names the file and the session writes it. cck does not create it, because
195
197
  // Claude Code's Write refuses to overwrite a file the session has not read.
196
- function post(terminalId, { sessionId, title, key, kind, file }) {
198
+ function post(terminalId, { sessionId, title, key, kind, file, base }) {
197
199
  const dir = folder(sessionId);
198
200
  if (!dir) throw httpError(409, 'no transcript found for that session');
199
201
  fs.mkdirSync(dir, { recursive: true });
@@ -210,7 +212,7 @@ function createShowStore(o) {
210
212
  seen.delete(id);
211
213
  }
212
214
  if (!old) at = posts.length;
213
- const entry = { id, title, key, kind, file, updatedAt: new Date(now()).toISOString() };
215
+ const entry = { id, title, key, kind, file, base, updatedAt: new Date(now()).toISOString() };
214
216
  posts[at] = entry;
215
217
  writeIndex(dir, sessionId, posts);
216
218
  bind(terminalId, sessionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-kanban",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "description": "A web-based Kanban board for viewing Claude Code tasks with agent teams support",
5
5
  "main": "server.js",
6
6
  "type": "commonjs",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "claude-code-kanban",
3
- "version": "3.7.5",
3
+ "version": "3.7.8",
4
4
  "description": "claude-code-kanban dashboard integration: agent activity tracking, context and cost tracking, board moves and reviews delivered to the session, and skills to drive the board from a session"
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { EngineInterface, Register, ToolCallArgs } from 'claude-code'
1
+ import type { AgentSpawnInput, EngineInterface, Register, ToolCallArgs } from 'claude-code'
2
2
  import { cckRoot } from './context'
3
3
 
4
4
  // Mods cannot delete files. The server reads any status but "waiting" as no ask.
@@ -148,21 +148,24 @@ async function markStopped($: EngineInterface) {
148
148
  await $.fs.write(`${await sessionDir($)}/_stop.json`, '')
149
149
  }
150
150
 
151
- // The name map lets TeammateIdle, which names the teammate, find its agent id.
152
- async function agentStarted($: EngineInterface, agentId: string, type: string, model: string, name?: string) {
151
+ // The name map lets TeammateIdle, which names the teammate, find its agent id. The prompt is on
152
+ // the start line because a resume runs a new prompt, and the server's own lookup finds the first.
153
+ async function agentStarted($: EngineInterface, e: AgentSpawnInput, agentId: string, model: string) {
153
154
  const dir = await sessionDir($)
154
155
  const ts = new Date().toISOString()
155
156
  await Promise.all([
156
157
  appendLine($, `${dir}/${agentId}.jsonl`, {
157
158
  agentId,
158
- type,
159
+ type: e.subagentType,
159
160
  model,
160
161
  event: 'start',
161
162
  status: 'active',
163
+ ...(e.prompt && { prompt: e.prompt }),
164
+ ...(e.description && { description: e.description }),
162
165
  startedAt: ts,
163
166
  updatedAt: ts,
164
167
  }),
165
- $.fs.write(`${dir}/_name-${name ?? type}.id`, agentId),
168
+ $.fs.write(`${dir}/_name-${e.name ?? e.subagentType}.id`, agentId),
166
169
  ])
167
170
  }
168
171
 
@@ -249,7 +252,7 @@ export const register: Register = on => {
249
252
  })
250
253
  on('agent.spawn', async ($, e, next) => {
251
254
  const result = await next(e)
252
- if (result.agentId) await agentStarted($, result.agentId, e.subagentType, result.model, e.name)
255
+ if (result.agentId) await agentStarted($, e, result.agentId, result.model)
253
256
  return result
254
257
  })
255
258
  // An interrupted turn fires no Stop hook, so it does not mark the session unread either.
@@ -4,7 +4,7 @@ import { cckRoot } from './context'
4
4
  export const TOOL = 'mcp__claude-code-kanban__show'
5
5
  export const SKILL_LINE = /^\s*-\s*claude-code-kanban:show(?=:|\s*$)/
6
6
 
7
- type ShowInput = { title: string; key?: string; kind?: 'markdown' | 'html'; file?: string }
7
+ type ShowInput = { title: string; key?: string; kind?: 'markdown' | 'html'; file?: string; base?: string }
8
8
  type Shown = { title: string; key?: string | null; index: number; count: number; path?: string | null }
9
9
 
10
10
  export function boardPort(cckUrl: string) {
@@ -67,8 +67,8 @@ async function post($: EngineInterface, input: ShowInput) {
67
67
  if (!t) return { deny: 'The overlay needs a Claude Code session started in the cck terminal.' }
68
68
  const token = await terminalToken($, t.url)
69
69
  if (!token) return { deny: `No terminal token for the cck server at ${t.url}. It must run with the terminal enabled.` }
70
- const { title, key, kind, file } = input
71
- const body = JSON.stringify({ sessionId: await $.session.id(), title, key, kind, file })
70
+ const { title, key, kind, file, base } = input
71
+ const body = JSON.stringify({ sessionId: await $.session.id(), title, key, kind, file, base })
72
72
  let res: Awaited<ReturnType<EngineInterface['http']['fetch']>>
73
73
  try {
74
74
  res = await $.http.fetch(`${t.url}/api/terminals/${encodeURIComponent(t.terminalId)}/show`, {
@@ -103,6 +103,11 @@ export const register: Register = on => {
103
103
  },
104
104
  file: { type: 'string', description: 'Absolute path of an existing markdown, HTML, image or text file' },
105
105
  key: { type: 'string', description: 'Card name: the same key replaces the card in place and keeps its file' },
106
+ base: {
107
+ type: 'string',
108
+ description:
109
+ "Absolute path of the folder that the card's path:line links resolve against, usually the repo root. Always pass it with a call stack. Without it, links resolve against the session cwd, which is wrong for a worktree or another repo",
110
+ },
106
111
  },
107
112
  required: ['title'],
108
113
  },
@@ -38,7 +38,9 @@ The board draws the tree lines, links, focus and folds from this notation:
38
38
  - The fence tag is `callstack`.
39
39
  - Caller on top. Indent each callee 2 spaces under its caller; the board turns the spaces into tree lines. Several roots are fine.
40
40
  - One frame per line: the function or method name as one identifier, spelled as in the code.
41
- - The note goes after 2 or more spaces: a `path:line` relative to the project root, which the board links, or a few words. Line the notes up in one column.
41
+ - The note goes after 2 or more spaces: a `path:line` relative to the card's `base`, which the board links, or a few words. Line the notes up in one column.
42
+ - Post every card with a call stack with `base`: the absolute path of the repo root that holds the files. Without it, links resolve against the session cwd, which is a different checkout when you work in a worktree or another repo.
43
+ - Write the full relative path on each linked frame. A bare file name (`place.ts:40`) or a bare line (`:40`) never resolves.
42
44
  - A `*` after the name, with one space, marks the frame to look at. One per stack.
43
45
  - `+` or `-` in the first column marks a frame the change adds or removes. In a stack with any `+` or `-`, every other line starts with one space.
44
46
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: visualize
3
- description: Present a topic as one static HTML page — findings, options and a pick, a system overview. Use when the user asks to visualize something, or when an answer outgrows chat (options plus a pick, a diagram plus a table).
3
+ description: Present a topic as one self-contained HTML page — findings, options and a pick, a system overview. Use when the user asks to visualize something, or when an answer outgrows chat (options plus a pick, a diagram plus a table).
4
4
  argument-hint: '[what to present]'
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ argument-hint: '[what to present]'
8
8
 
9
9
  Present this: $ARGUMENTS. With no argument, present the subject of this conversation.
10
10
 
11
- The page is a document to read: every mark is in the HTML, and it works offline with scripts off. Two leading words run through it: the **pick** is the option the page recommends (on a page with no options, its main path), and an **exhibit** is the one table, figure or block that proves a section's claim.
11
+ The page is a document to read: its text and static exhibits are in the HTML, and it works offline. Two leading words run through it: the **pick** is the option the page recommends (on a page with no options, its main path), and an **exhibit** is the one table, figure or block that proves a section's claim.
12
12
 
13
13
  ## Steps
14
14
 
@@ -18,21 +18,31 @@ The page is a document to read: every mark is in the HTML, and it works offline
18
18
  2. `.lead`: the answer in 1 or 2 sentences, the pick in `<b>`.
19
19
  3. Sections. Each `<h2>` is a claim that can be false ("A breaker alone trips again on release", not "Breaker"), with one exhibit and at most 2 short paragraphs under it.
20
20
  4. Close with what to do next and `.sources`.
21
- 3. **Invent each exhibit.** Ask what form makes this claim obvious at a glance, then build that, the template's blocks or something new: a slope chart, an annotated timeline, small multiples, a cutaway, a ranked strip, a map. The Blocks table is a palette of ready parts, not a menu to choose from. Before you draw an SVG, read the matching guide in the `show` skill — [chart](../show/references/chart.md), [diagram](../show/references/diagram.md) and its type file, [mockup](../show/references/mockup.md) — for shapes, arrows and labels; the Fit rule below replaces their card sizes, and label masks fill with `--color-bg-subtle`, the figure's background.
22
- 4. **Check.** Render the page headless (Playwright) in light and in dark, and look at each screenshot. Done when no text is clipped, no arrow crosses a label, `scrollWidth` equals `clientWidth`, and, when the topic comes from a source such as a file or a conversation, every section and number of it is named where it landed on the page or reported to the user as left out.
21
+ 3. **Invent each exhibit.** Ask what form makes this claim obvious at a glance, then build that, the template's blocks or something new: a slope chart, an annotated timeline, small multiples, a cutaway, a ranked strip, a map. The Blocks table is a palette of ready parts, not a menu to choose from. Before you draw an SVG, read the matching guide in the `show` skill — [chart](../show/references/chart.md), [diagram](../show/references/diagram.md) and its type file, [mockup](../show/references/mockup.md) — for patterns: shapes, arrows and labels. Their sizes and directions are for cards; on a page, the Principles below set them. Label masks fill with `--color-bg-subtle`, the figure's background. When the source or the request has a value the reader would want to change, or states one after another, the exhibit can be interactive: a slider or toggle that computes the figure again, a stepper through states, or a model that runs over time. Use the simplest one that proves the claim, and follow [Interactive exhibits](#interactive-exhibits). Never add a control on an input you made up: a claim that rests on fixed facts gets a static exhibit.
22
+ 4. **Check.** Render the page in light and in dark, and look at each render, not the source. Done when no text is clipped, no arrow crosses a label, `scrollWidth` equals `clientWidth`, and, when the topic comes from a source such as a file or a conversation, every section and number of it is named where it landed on the page or reported to the user as left out. For an interactive exhibit, also: no console errors, and the numbers the text states are the ones the exhibit shows at its default settings.
23
23
  5. **Show.** When `$CCK_URL` is set, the session runs in the cck board: run `claude-code-kanban pane add <page> --title '<h1>'` and tell the user the page waits in that tab. Else give the user the page path.
24
24
 
25
25
  ## Principles
26
26
 
27
27
  Every exhibit, ready or new, keeps these:
28
28
 
29
- - **Accent marks the pick**, one or two marks per exhibit: its tile, card, row, node, or the one bar or point in a chart. The rest stays muted. Status colors mean status.
30
- - **Chart data takes series colors**: `--color-series-1` for the main series, `--color-text-muted` or `--color-series-3` for a second, up to 8 series; past that, fold the tail into "Other" or split into small multiples. The accent can sit close to `--color-danger`, so a whole data series in it reads as an alarm.
29
+ - **Accent marks the pick**, one or two marks per exhibit: its tile, card, row, node, or the one bar or point in a chart. In a chart that compares options, the pick's series keeps its series color and the accent goes on its label or end point. The rest stays muted. Status colors mean status.
30
+ - **Chart data takes series colors**: `--color-series-1` for the main series, `--color-text-muted` or `--color-series-3` for a second, up to 8 series; skip `--color-series-2`, which is the accent's hue; past that, fold the tail into "Other" or split into small multiples. The accent can sit close to `--color-danger`, so a whole data series in it reads as an alarm.
31
31
  - **Tokens color everything**: `var(--color-*)`, tints by `color-mix(in srgb, var(--color-accent) 12%, var(--color-bg))`. Then the page follows light, dark and a host's theme with no script.
32
32
  - **Fit**: an SVG has a `viewBox` up to 960 wide, no `width` attribute, text of 12 units or more. A flow runs left to right when it has 6 steps or fewer.
33
33
  - **Remove test**: each node, arrow, label and decoration stays only if removing it loses meaning. A diagram past 9 nodes or 12 arrows splits into an overview and a detail. Each SVG has `role="img"` and `aria-labelledby` pointing at its `<title>`, with a per-figure id prefix.
34
34
  - **Real**: real names, numbers and `file:line`, estimates and invented data marked, each claim cited. Repeated marks, such as small multiples, are generated while you write the page.
35
35
 
36
+ ## Interactive exhibits
37
+
38
+ - An exhibit is the figure, its controls and the outputs they drive. The script draws the figure and writes only inside its exhibit; the text outside it is static HTML.
39
+ - Keep it small to edit: all inputs in one state object, one draw function that builds every figure from that state, and controls that only change state and call draw. Keep the computation apart from the drawing.
40
+ - Declare controls and presets in the markup, next to the text that names each scenario, and read them in one place. A new scenario is then one line of HTML.
41
+ - Colors come from the tokens on every draw, in canvas too, so a theme change needs no extra code.
42
+ - Nothing runs while the reader does nothing, except a running model that is on screen.
43
+ - Numbers from a model are marked as model numbers.
44
+ - The script goes at the end of `<body>`; its CSS goes in the second `<style>`.
45
+
36
46
  ## Blocks
37
47
 
38
48
  Ready parts in the template's CSS; its body has one of each.
@@ -272,6 +272,31 @@ test('a subagent stop with an empty answer leaves lastMessage out', async ($, on
272
272
  expect('lastMessage' in stop).toBe(false)
273
273
  })
274
274
 
275
+ test('a resumed subagent appends a start line with the new task', async ($, on) => {
276
+ const files: Record<string, string> = {}
277
+ engine(on, files)
278
+
279
+ await $.agent.spawn(spawn('general-purpose'))
280
+ await $.turn.complete(turn({ agentId: 'a1', answer: 'first answer' }))
281
+ await $.agent.spawn({ ...spawn('general-purpose'), prompt: 'second task', description: '' })
282
+
283
+ const all = lines(files[`${SESSION}/a1.jsonl`])
284
+ expect(all.map((l) => l.event)).toEqual(['start', 'stop', 'start'])
285
+ expect(all[2]).toMatchObject({ status: 'active', prompt: 'second task' })
286
+ expect('description' in all[2]).toBe(false)
287
+ })
288
+
289
+ test('a first spawn records its prompt and description', async ($, on) => {
290
+ const files: Record<string, string> = {}
291
+ engine(on, files)
292
+
293
+ await $.agent.spawn(spawn('general-purpose'))
294
+
295
+ const [start] = lines(files[`${SESSION}/a1.jsonl`])
296
+ expect(start).toMatchObject({ prompt: 'p', description: 'd' })
297
+ expect('lastMessage' in start).toBe(false)
298
+ })
299
+
275
300
  test('a finished loop that was never spawned writes nothing', async ($, on) => {
276
301
  const { writes } = engine(on, {})
277
302
 
@@ -102,6 +102,13 @@ test('posts the body with the terminal token and answers with the position', asy
102
102
  ])
103
103
  })
104
104
 
105
+ test('sends the base for the card links', async ($, on) => {
106
+ const board = engine(on, GATE, { status: 200, body: { id: 'p1', title: 'Stack', key: 'stack', index: 1, count: 1, path: 'C:/s/p1.md' } })
107
+ await $.session.start({ cwd: 'C:/proj', surface: 'terminal', isInteractive: true })
108
+ await $.tool.call(call({ title: 'Stack', key: 'stack', base: 'C:/proj-worktree' }))
109
+ expect(board.requests[0]?.body).toEqual({ sessionId: 'sid-1', title: 'Stack', key: 'stack', base: 'C:/proj-worktree' })
110
+ })
111
+
105
112
  test('a claim sends no file and answers with the file to write', async ($, on) => {
106
113
  const path = 'C:/s/.cck/show/p1.md'
107
114
  const board = engine(on, GATE, { status: 200, body: { id: 'p1', title: 'Plan', key: 'plan', index: 1, count: 1, path } })
package/public/app.js CHANGED
@@ -16021,7 +16021,7 @@ const showState = {
16021
16021
  path: null,
16022
16022
  };
16023
16023
  let showSize = store.readJson(SHOW_SIZE_KEY);
16024
- // Terminal id → { closed?, collapsed?, expanded? }; no entry when no flag is set. Ids gone from the terminal list are pruned.
16024
+ // Terminal id → { closed?, collapsed?, expanded? }; a terminal with no entry yet starts collapsed. Ids gone from the terminal list are pruned.
16025
16025
  const showViews = store.readJson(SHOW_VIEW_KEY, {});
16026
16026
  // Older boards stored the string 'collapsed' or 'expanded'.
16027
16027
  for (const [tid, v] of Object.entries(showViews)) if (typeof v === 'string') showViews[tid] = { [v]: true };
@@ -16114,17 +16114,20 @@ function forgetEndedTerminals() {
16114
16114
  if (!runningTerminals.has(showState.lookup)) showState.lookup = null;
16115
16115
  }
16116
16116
 
16117
- function setShowView(tid, view) {
16117
+ // `post` is the id of the card on screen; a view without one keeps the saved id, so an empty list
16118
+ // while a terminal's posts load does not forget it.
16119
+ function setShowView(tid, view, post) {
16118
16120
  const set = SHOW_VIEW_FLAGS.filter((f) => view[f]);
16119
- const old = showViews[tid] || {};
16120
- if (SHOW_VIEW_FLAGS.every((f) => !!old[f] === set.includes(f))) return;
16121
- if (set.length) showViews[tid] = Object.fromEntries(set.map((f) => [f, true]));
16122
- else delete showViews[tid];
16121
+ const old = showViews[tid];
16122
+ const shown = post ?? old?.post;
16123
+ if (old && old.post === shown && SHOW_VIEW_FLAGS.every((f) => !!old[f] === set.includes(f))) return;
16124
+ showViews[tid] = Object.fromEntries(set.map((f) => [f, true]));
16125
+ if (shown) showViews[tid].post = shown;
16123
16126
  store.writeJson(SHOW_VIEW_KEY, showViews);
16124
16127
  }
16125
16128
 
16126
16129
  function saveShowView() {
16127
- if (showState.terminalId) setShowView(showState.terminalId, showState);
16130
+ if (showState.terminalId) setShowView(showState.terminalId, showState, showState.posts[showState.idx]?.id);
16128
16131
  }
16129
16132
 
16130
16133
  function resetShowPosts() {
@@ -16142,23 +16145,23 @@ function syncShowCard() {
16142
16145
  }
16143
16146
  const tid = pty ? (terminalIds.get(pty) ?? null) : null;
16144
16147
  if (tid === showState.terminalId) return;
16145
- const view = (tid && showViews[tid]) || {};
16148
+ const view = (tid && showViews[tid]) || { collapsed: true };
16146
16149
  Object.assign(showState, { terminalId: tid, sessionId: null, idx: 0 });
16147
16150
  for (const f of SHOW_VIEW_FLAGS) showState[f] = !!view[f];
16148
16151
  resetShowPosts();
16149
16152
  renderShow();
16150
- if (tid) loadShowPosts(tid, { newest: true }).then((ok) => ok && renderShow());
16153
+ if (tid) loadShowPosts(tid, { shownId: view.post }).then((ok) => ok && renderShow());
16151
16154
  }
16152
16155
 
16153
- async function loadShowPosts(tid, { newest = false } = {}) {
16156
+ // Opens `shownId` (by default the card on screen) when the list still holds it, else the newest.
16157
+ async function loadShowPosts(tid, { shownId = showState.posts[showState.idx]?.id } = {}) {
16154
16158
  const seq = ++showState.listSeq;
16155
16159
  const data = await getJson(apiPath`/api/terminals/${tid}/show`, null, { cache: 'no-store' });
16156
16160
  if (seq !== showState.listSeq || tid !== showState.terminalId) return false;
16157
- const shownId = showState.posts[showState.idx]?.id;
16158
16161
  showState.sessionId = data?.sessionId ?? null;
16159
16162
  showState.posts = Array.isArray(data?.posts) ? data.posts : [];
16160
16163
  const at = showState.posts.findIndex((p) => p.id === shownId);
16161
- showState.idx = newest || at < 0 ? Math.max(0, showState.posts.length - 1) : at;
16164
+ showState.idx = at < 0 ? Math.max(0, showState.posts.length - 1) : at;
16162
16165
  return true;
16163
16166
  }
16164
16167
 
@@ -16231,10 +16234,11 @@ function showTicksHtml() {
16231
16234
  }
16232
16235
 
16233
16236
  function renderShow({ flash = false } = {}) {
16237
+ const n = showState.posts.length;
16238
+ if (n) showState.idx = Math.min(Math.max(0, showState.idx), n - 1);
16234
16239
  saveShowView();
16235
16240
  const card = showCardEl();
16236
16241
  const chip = document.getElementById('show-reopen');
16237
- const n = showState.posts.length;
16238
16242
  const open = n > 0 && !showState.closed;
16239
16243
  chip.hidden = !n || open;
16240
16244
  chip.querySelector('.show-reopen-n').textContent = `show · ${n}`;
@@ -16248,7 +16252,6 @@ function renderShow({ flash = false } = {}) {
16248
16252
  card.replaceChildren();
16249
16253
  return;
16250
16254
  }
16251
- showState.idx = Math.min(Math.max(0, showState.idx), n - 1);
16252
16255
  const p = showState.posts[showState.idx];
16253
16256
  showState.marked.delete(p.id);
16254
16257
  card.classList.toggle('expanded', showState.expanded && !showState.collapsed);
@@ -17280,8 +17283,9 @@ function onCallstackLoc(e) {
17280
17283
  e.preventDefault();
17281
17284
  e.stopPropagation();
17282
17285
  if (e.shiftKey) window.getSelection().collapseToEnd();
17283
- const sid = el.closest('#show-card') ? showState.sessionId : currentSessionId;
17284
- const base = (sid && getSessionBaseDir(sid)) || undefined;
17286
+ const onCard = !!el.closest('#show-card');
17287
+ const sid = onCard ? showState.sessionId : currentSessionId;
17288
+ const base = (onCard && showState.posts[showState.idx]?.base) || (sid && getSessionBaseDir(sid)) || undefined;
17285
17289
  if (e.shiftKey || !sid || el.closest('.modal-overlay')) openPreviewAtLine(loc, base);
17286
17290
  else openPaneAtLine(sid, loc, base);
17287
17291
  }
package/public/style.css CHANGED
@@ -2734,6 +2734,7 @@ code.ct .ct-loc {
2734
2734
  color: var(--accent-text);
2735
2735
  text-decoration: underline dotted;
2736
2736
  text-underline-offset: 3px;
2737
+ cursor: pointer;
2737
2738
  }
2738
2739
 
2739
2740
  code.ct .ct-focus {
package/server.js CHANGED
@@ -70,6 +70,7 @@ const { pickFolder } = require('./lib/folder-dialog');
70
70
  const { loadSessionCache, saveSessionCache } = require('./lib/session-cache');
71
71
  const { countTaskDir } = require('./lib/task-counts');
72
72
  const { readTaskDir } = require('./lib/task-dir');
73
+ const { foldAgentLines } = require('./lib/agent-log');
73
74
  const { projectMatcher, normalizeProjectPath, sessionProjectKey } = require('./public/project-match');
74
75
  const { getParentVerdict, setParentVerdict } = require('./lib/parent-cache');
75
76
 
@@ -275,13 +276,7 @@ const RETENTION_FIRST_RUN_MS = 5 * 60 * 1000;
275
276
  // #region AGENT_ACTIVITY
276
277
 
277
278
  function readAgentJsonl(filePath) {
278
- const raw = readFileSync(filePath, 'utf8');
279
- const merged = {};
280
- for (const line of raw.split(/\r?\n/)) {
281
- if (!line.trim()) continue;
282
- try { Object.assign(merged, JSON.parse(line)); } catch (_) { /* skip malformed */ }
283
- }
284
- return merged;
279
+ return foldAgentLines(readFileSync(filePath, 'utf8'));
285
280
  }
286
281
 
287
282
  // Agent-activity record files in a session dir, excluding the `_`-prefixed sidecars