@ftrdotdev/pi-tracker 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +136 -46
  2. package/package.json +8 -2
  3. package/src/compaction/candidate.test.ts +191 -0
  4. package/src/compaction/candidate.ts +105 -0
  5. package/src/compaction/classifier.test.ts +422 -0
  6. package/src/compaction/classifier.ts +198 -0
  7. package/src/compaction/completion.test.ts +257 -0
  8. package/src/compaction/completion.ts +94 -0
  9. package/src/compaction/decision-record.test.ts +91 -0
  10. package/src/compaction/decision-record.ts +101 -0
  11. package/src/compaction/digest.test.ts +185 -0
  12. package/src/compaction/digest.ts +158 -0
  13. package/src/compaction/footprint.test.ts +135 -0
  14. package/src/compaction/footprint.ts +387 -0
  15. package/src/compaction/observations.test.ts +199 -0
  16. package/src/compaction/observations.ts +348 -0
  17. package/src/compaction/pointer.test.ts +26 -0
  18. package/src/compaction/pointer.ts +15 -0
  19. package/src/compaction/rules.test.ts +253 -0
  20. package/src/compaction/rules.ts +188 -0
  21. package/src/compaction/settings.test.ts +315 -0
  22. package/src/compaction/settings.ts +185 -0
  23. package/src/compaction/settle.test.ts +370 -0
  24. package/src/compaction/settle.ts +150 -0
  25. package/src/{deps.test.ts → core/deps.test.ts} +1 -1
  26. package/src/{domain.test.ts → core/domain.test.ts} +42 -9
  27. package/src/{domain.ts → core/domain.ts} +73 -8
  28. package/src/{persistence.test.ts → core/persistence.test.ts} +7 -7
  29. package/src/{store.test.ts → core/store.test.ts} +116 -50
  30. package/src/{store.ts → core/store.ts} +92 -31
  31. package/src/index.test.ts +728 -84
  32. package/src/index.ts +237 -49
  33. package/src/{tool-metadata.test.ts → presentation/tool-metadata.test.ts} +264 -49
  34. package/src/presentation/tool-metadata.ts +675 -0
  35. package/src/{ui.test.ts → presentation/ui.test.ts} +128 -9
  36. package/src/{ui.ts → presentation/ui.ts} +123 -30
  37. package/src/tool-metadata.ts +0 -452
  38. /package/src/{deps.ts → core/deps.ts} +0 -0
  39. /package/src/{persistence.ts → core/persistence.ts} +0 -0
package/src/index.ts CHANGED
@@ -1,32 +1,47 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
2
3
  import { Text } from "@earendil-works/pi-tui";
3
4
  import { makeBorderedBox } from "@ftrdotdev/pi-tui";
5
+ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
4
6
  import { Effect, Layer, ManagedRuntime, Option, Result } from "effect";
7
+ import { join } from "node:path";
8
+ import { ClassifierGateway } from "./compaction/classifier.ts";
9
+ import { CompletionObserver } from "./compaction/completion.ts";
10
+ import { DECISION_CUSTOM_TYPE, encodeDecisionRecord } from "./compaction/decision-record.ts";
11
+ import { FootprintRecorder, productionProbe, type ToolEvent } from "./compaction/footprint.ts";
5
12
  import {
6
13
  formatItemRef,
7
14
  parseItemRef,
8
15
  type DependencyItem,
9
16
  type DependencyListView,
10
- } from "./deps.ts";
11
- import { TodoItem, TodoList, TrackerState, emptyState, encodeState } from "./domain.ts";
12
- import { TrackerPersistence } from "./persistence.ts";
13
- import { TrackerError, TrackerStore, type ItemSpec, type UpdateItemPatch } from "./store.ts";
17
+ } from "./core/deps.ts";
18
+ import { TodoItem, TodoList, TrackerState, emptyState, encodeState } from "./core/domain.ts";
19
+ import { TrackerPersistence } from "./core/persistence.ts";
20
+ import { SMART_COMPACTION_CUSTOM_TYPE } from "./compaction/pointer.ts";
21
+ import {
22
+ SMART_COMPACTION_CONFIG_FILE,
23
+ SmartCompactionSettingsService,
24
+ } from "./compaction/settings.ts";
25
+ import { SettleDecider } from "./compaction/settle.ts";
26
+ import { TrackerError, TrackerStore, type ItemSpec, type UpdateItemPatch } from "./core/store.ts";
14
27
  import {
15
28
  TRACKER_TOOL_METADATA,
16
29
  blockedDoneNote,
17
30
  doneMarkReminder,
18
31
  validateTrackerCall,
32
+ type TrackerItemSpec,
19
33
  type TrackerToolAction,
20
34
  type TrackerToolDetails,
21
35
  type TrackerToolParams,
22
- } from "./tool-metadata.ts";
36
+ type TrackerUpdatePatch,
37
+ } from "./presentation/tool-metadata.ts";
23
38
  import {
24
39
  displayList,
25
40
  makeTrackerOverlay,
26
41
  makeTrackerWidget,
27
42
  readinessSuffix,
28
43
  type TrackerUiAction,
29
- } from "./ui.ts";
44
+ } from "./presentation/ui.ts";
30
45
 
31
46
  /** Custom-entry type used to persist the tracker state in the session. */
32
47
  const CUSTOM_TYPE = "tracker/state";
@@ -47,35 +62,76 @@ const withPersistence = <A, E>(
47
62
  f: (persistence: TrackerPersistence["Service"]) => Effect.Effect<A, E>,
48
63
  ): Effect.Effect<A, E, TrackerPersistence> => Effect.flatMap(TrackerPersistence, f);
49
64
 
65
+ const withCompletionObserver = <A, E>(
66
+ f: (observer: CompletionObserver["Service"]) => Effect.Effect<A, E>,
67
+ ): Effect.Effect<A, E, CompletionObserver> => Effect.flatMap(CompletionObserver, f);
68
+
69
+ const withSettleDecider = <A, E>(
70
+ f: (decider: SettleDecider["Service"]) => Effect.Effect<A, E>,
71
+ ): Effect.Effect<A, E, SettleDecider> => Effect.flatMap(SettleDecider, f);
72
+
73
+ const withFootprintRecorder = <A, E>(
74
+ f: (recorder: FootprintRecorder["Service"]) => Effect.Effect<A, E>,
75
+ ): Effect.Effect<A, E, FootprintRecorder> => Effect.flatMap(FootprintRecorder, f);
76
+
77
+ /** The bounded `path`/`command` projection of a tool call's arguments. */
78
+ const boundedArgsOf = (value: unknown): ToolEvent["args"] => {
79
+ if (typeof value !== "object" || value === null) return undefined;
80
+ const record = value as { readonly path?: unknown; readonly command?: unknown };
81
+ const path = typeof record.path === "string" && record.path.length > 0 ? record.path : undefined;
82
+ const command =
83
+ typeof record.command === "string" && record.command.length > 0 ? record.command : undefined;
84
+ if (path === undefined && command === undefined) return undefined;
85
+ return {
86
+ ...(path === undefined ? {} : { path }),
87
+ ...(command === undefined ? {} : { command }),
88
+ };
89
+ };
90
+
91
+ /** The tool result's `details`, which carries a write's or edit's unified patch. */
92
+ const detailsOf = (result: unknown): unknown =>
93
+ typeof result === "object" && result !== null
94
+ ? (result as { readonly details?: unknown }).details
95
+ : undefined;
96
+
50
97
  /** Throw for a missing required tool parameter; caught in `execute`. */
51
98
  const requireParam = <T>(value: T | undefined, name: string): T => {
52
99
  if (value === undefined) throw new Error(`${name} is required for this tracker action`);
53
100
  return value;
54
101
  };
55
102
 
56
- /**
57
- * Normalize the tool's item shapes (a text string, an item object, or an array
58
- * of either) into the store's item specs.
59
- */
60
- const toItemSpecs = (raw: NonNullable<TrackerToolParams["text"]>): ItemSpec[] => {
61
- const entries = Array.isArray(raw) ? raw : [raw];
62
- return entries.map((entry) =>
63
- typeof entry === "string"
64
- ? entry
65
- : { text: entry.text, ...(entry.deps === undefined ? {} : { deps: entry.deps }) },
66
- );
67
- };
103
+ /** Project the tool's item objects onto the store's item specs. */
104
+ const toItemSpecs = (items: readonly TrackerItemSpec[]): ItemSpec[] =>
105
+ items.map((item) => ({
106
+ title: item.title,
107
+ ...(item.description === undefined ? {} : { description: item.description }),
108
+ ...(item.refs === undefined ? {} : { refs: item.refs }),
109
+ ...(item.produces === undefined ? {} : { produces: item.produces }),
110
+ ...(item.deps === undefined ? {} : { deps: item.deps }),
111
+ }));
68
112
 
69
113
  // --------------------------------------------------------------------------
70
114
  // Extension
71
115
  // --------------------------------------------------------------------------
72
116
 
73
117
  export default function (pi: ExtensionAPI): void {
118
+ // The settings path is resolved inside the factory, so a test can point
119
+ // ENV_AGENT_DIR at a temp directory before `tracker(api)` runs.
120
+ const probe = productionProbe();
121
+ const decisionServices = Layer.mergeAll(
122
+ CompletionObserver.layer,
123
+ ClassifierGateway.layer,
124
+ FootprintRecorder.layer(probe),
125
+ SmartCompactionSettingsService.make(join(getAgentDir(), SMART_COMPACTION_CONFIG_FILE)),
126
+ );
127
+
74
128
  const runtime = ManagedRuntime.make(
75
- TrackerStore.layer.pipe(
129
+ SettleDecider.layer(probe).pipe(
130
+ Layer.provideMerge(Layer.mergeAll(TrackerStore.layer, decisionServices)),
76
131
  Layer.provideMerge(
77
132
  TrackerPersistence.layer((encoded) => pi.appendEntry(CUSTOM_TYPE, encoded)),
78
133
  ),
134
+ Layer.provide(NodeFileSystem.layer),
79
135
  ),
80
136
  );
81
137
 
@@ -101,31 +157,42 @@ export default function (pi: ExtensionAPI): void {
101
157
  return withStore((store) => store.deleteList(requireParam(params.list_id, "list_id")));
102
158
  case "set_active":
103
159
  return withStore((store) => store.setActiveList(params.list_id ?? null));
104
- case "add_item": {
105
- const specs = toItemSpecs(requireParam(params.text, "text"));
160
+ case "add_items": {
161
+ // Validation guarantees every entry is an item object; the shared
162
+ // `items` field also carries update_items patches, which are rejected
163
+ // for this action.
164
+ const specs = toItemSpecs(
165
+ requireParam(params.items, "items") as readonly TrackerItemSpec[],
166
+ );
106
167
  return withStore((store) => store.addItems(requireParam(params.list_id, "list_id"), specs));
107
168
  }
108
- case "update_item": {
169
+ case "update_items": {
109
170
  if (params.items !== undefined) {
110
171
  // Batch form: list_id + item-id patches within one list (mirrors
111
- // add_item's list_id + text[]). The store resolves each id against
172
+ // add_items' list_id + items). The store resolves each id against
112
173
  // that single list, so the reference's list name must match it.
113
174
  const listId = requireParam(params.list_id, "list_id");
114
- const batch = params.items.map((patch) => ({
175
+ const batch = (params.items as readonly TrackerUpdatePatch[]).map((patch) => ({
115
176
  itemId: patch.item_id,
116
- ...(patch.text !== undefined ? { text: patch.text } : {}),
177
+ ...(patch.title !== undefined ? { title: patch.title } : {}),
178
+ ...(patch.description !== undefined ? { description: patch.description } : {}),
179
+ ...(patch.refs !== undefined ? { refs: patch.refs } : {}),
180
+ ...(patch.produces !== undefined ? { produces: patch.produces } : {}),
117
181
  ...(patch.done !== undefined ? { done: patch.done } : {}),
118
182
  ...(patch.deps !== undefined ? { deps: patch.deps } : {}),
119
183
  }));
120
184
  return withStore((store) => store.updateItems(listId, batch));
121
185
  }
122
186
  const patch: UpdateItemPatch = {
123
- ...(typeof params.text === "string" ? { text: params.text } : {}),
187
+ ...(typeof params.title === "string" ? { title: params.title } : {}),
188
+ ...(params.description !== undefined ? { description: params.description } : {}),
189
+ ...(params.refs !== undefined ? { refs: params.refs } : {}),
190
+ ...(params.produces !== undefined ? { produces: params.produces } : {}),
124
191
  ...(params.done !== undefined ? { done: params.done } : {}),
125
192
  ...(params.deps !== undefined ? { deps: params.deps } : {}),
126
193
  };
127
- // Both update_item forms return an affected-items array, so the
128
- // result contract matches add_item and the renderer/reminder can
194
+ // Both update_items forms return an affected-items array, so the
195
+ // result contract matches add_items and the renderer/reminder can
129
196
  // treat every result the same way.
130
197
  return withStore((store) =>
131
198
  store.updateItem(requireParam(params.item_id, "item_id"), patch),
@@ -147,7 +214,7 @@ export default function (pi: ExtensionAPI): void {
147
214
  case "setActive":
148
215
  return withStore((store) => store.setActiveList(action.listId));
149
216
  case "addItem":
150
- return withStore((store) => store.addItem(action.listId, action.text));
217
+ return withStore((store) => store.addItem(action.listId, action.title));
151
218
  case "updateItem":
152
219
  return withStore((store) => store.updateItem(action.itemId, action.patch));
153
220
  case "removeItem":
@@ -183,6 +250,10 @@ export default function (pi: ExtensionAPI): void {
183
250
  const applyMutation = (ctx: ExtensionContext): Promise<TrackerState> =>
184
251
  enqueue(async () => {
185
252
  const next = await runtime.runPromise(withStore((store) => store.state));
253
+ // Record the transition before the mirror moves, so the observer sees the
254
+ // true pre-mutation state. Every mutation runs this, so a later mutation
255
+ // that completes nothing still refreshes the live snapshot.
256
+ await runtime.runPromise(withCompletionObserver((observer) => observer.record(state, next)));
186
257
  state = next;
187
258
  await runtime.runPromise(
188
259
  withPersistence((p) => p.save(next)).pipe(
@@ -265,6 +336,96 @@ export default function (pi: ExtensionAPI): void {
265
336
  await runtime.dispose();
266
337
  });
267
338
 
339
+ // --- Smart compaction ---------------------------------------------------
340
+
341
+ /**
342
+ * Pi rethrows the provider's abort error on cancellation, so the error text
343
+ * is not a reliable signal. `session_compact_failed` fires first and carries
344
+ * the fact.
345
+ */
346
+ let compactionAborted = false;
347
+ pi.on("session_compact_failed", (event) => {
348
+ compactionAborted = event.aborted;
349
+ });
350
+
351
+ /**
352
+ * The args of in-flight tool calls, so a `tool_execution_end` event can name
353
+ * the path its `tool_execution_start` carried. pi's end event has no args.
354
+ */
355
+ const toolCallArgs = new Map<string, ToolEvent["args"]>();
356
+
357
+ pi.on("tool_execution_start", async (event) => {
358
+ const args = boundedArgsOf(event.args);
359
+ if (args === undefined) return;
360
+ toolCallArgs.set(event.toolCallId, args);
361
+ await runtime.runPromise(
362
+ withFootprintRecorder((recorder) =>
363
+ recorder.capture({ phase: "start", toolName: event.toolName, args }),
364
+ ),
365
+ );
366
+ });
367
+
368
+ pi.on("tool_execution_end", async (event) => {
369
+ const args = toolCallArgs.get(event.toolCallId);
370
+ toolCallArgs.delete(event.toolCallId);
371
+ const details = detailsOf(event.result);
372
+ await runtime.runPromise(
373
+ withFootprintRecorder((recorder) =>
374
+ recorder.capture({
375
+ phase: "end",
376
+ toolName: event.toolName,
377
+ ...(args === undefined ? {} : { args }),
378
+ ...(details === undefined ? {} : { details }),
379
+ }),
380
+ ),
381
+ );
382
+ });
383
+
384
+ pi.on("agent_before_settle", async (event, ctx) => {
385
+ const decision = await runtime.runPromise(
386
+ withSettleDecider((decider) =>
387
+ decider.decide({
388
+ registry: ctx.modelRegistry,
389
+ outcome: event.outcome,
390
+ signal: ctx.signal,
391
+ }),
392
+ ),
393
+ );
394
+ // The decision record is written before the pointer delivery, so the
395
+ // harvest can see the raw row and the resolved states for every decision.
396
+ if (decision.record !== undefined) {
397
+ pi.appendEntry(DECISION_CUSTOM_TYPE, encodeDecisionRecord(decision.record));
398
+ }
399
+ if (decision.kind !== "compact") return;
400
+ // The run signal can fire after the verdict, while the classifier is the
401
+ // last thing between here and compaction. An abort keeps the context.
402
+ if (ctx.signal?.aborted) return;
403
+ const pointer = decision.pointer;
404
+ // Delivery comes from pi's completion contract, which fires only after
405
+ // compaction has finished. `deliver` is idempotent, so a double callback
406
+ // cannot start two turns.
407
+ let resumed = false;
408
+ const deliver = () => {
409
+ if (resumed) return;
410
+ resumed = true;
411
+ pi.sendMessage(
412
+ { customType: SMART_COMPACTION_CUSTOM_TYPE, content: pointer, display: true },
413
+ { triggerTurn: true },
414
+ );
415
+ };
416
+ compactionAborted = false;
417
+ ctx.compact({
418
+ onComplete: () => deliver(),
419
+ onError: (error) => {
420
+ // Compaction failed, but the run already stopped and the context is
421
+ // intact, so the pointer still resumes the work. A user cancellation
422
+ // is different: nothing is resumed.
423
+ ctx.ui.notify(`tracker: smart compaction failed: ${error.message}`, "warning");
424
+ if (!compactionAborted) deliver();
425
+ },
426
+ });
427
+ });
428
+
268
429
  // --- Tool ---------------------------------------------------------------
269
430
 
270
431
  /**
@@ -311,7 +472,7 @@ export default function (pi: ExtensionAPI): void {
311
472
  : annotations.items
312
473
  .map(
313
474
  (item, index) =>
314
- ` [${item.done ? "x" : " "}] #${list.name}:${item.id}: ${item.text}` +
475
+ ` [${item.done ? "x" : " "}] #${list.name}:${item.id}: ${item.title}` +
315
476
  `${annotations.suffixByIndex[index]}`,
316
477
  )
317
478
  .join("\n");
@@ -384,7 +545,7 @@ export default function (pi: ExtensionAPI): void {
384
545
  }
385
546
  break;
386
547
  }
387
- case "add_item": {
548
+ case "add_items": {
388
549
  const items = value as TodoItem[];
389
550
  const list = current.lists.find((l) => l.id === params.list_id);
390
551
  details.list = list;
@@ -394,33 +555,36 @@ export default function (pi: ExtensionAPI): void {
394
555
  const ids = items.map((item) => `${listName}:${item.id}`);
395
556
  text =
396
557
  items.length === 1
397
- ? `Added item #${ids[0]} to ${listName}: ${items[0]!.text}`
398
- : `Added ${items.length} items to ${listName}: ${ids.map((id, i) => `#${id}: ${items[i]!.text}`).join(", ")}`;
558
+ ? `Added item #${ids[0]} to ${listName}: ${items[0]!.title}`
559
+ : `Added ${items.length} items to ${listName}: ${ids.map((id, i) => `#${id}: ${items[i]!.title}`).join(", ")}`;
399
560
  break;
400
561
  }
401
- case "update_item": {
562
+ case "update_items": {
402
563
  const items = value as TodoItem[];
403
564
  details.items = items;
404
565
  // Normalize both forms into patch records the renderer and reminder
405
- // share: each has a display id plus optional text/done.
406
- const batch = params.items;
566
+ // share: each has a display id plus optional title/description/done.
567
+ const batch = params.items as readonly TrackerUpdatePatch[] | undefined;
407
568
  const patches: Array<{
408
569
  id: string;
409
- text?: string;
570
+ title?: string;
571
+ description?: string;
410
572
  done?: boolean;
411
573
  deps?: readonly string[];
412
574
  }> =
413
575
  batch !== undefined
414
576
  ? batch.map((p) => ({
415
577
  id: p.item_id,
416
- text: p.text,
578
+ title: p.title,
579
+ description: p.description,
417
580
  done: p.done,
418
581
  deps: p.deps,
419
582
  }))
420
583
  : [
421
584
  {
422
585
  id: params.item_id ?? "?",
423
- text: typeof params.text === "string" ? params.text : undefined,
586
+ title: typeof params.title === "string" ? params.title : undefined,
587
+ description: params.description,
424
588
  done: params.done,
425
589
  deps: params.deps,
426
590
  },
@@ -429,7 +593,8 @@ export default function (pi: ExtensionAPI): void {
429
593
  const patch = patches[i]!;
430
594
  const changes: string[] = [];
431
595
  if (patch.done !== undefined) changes.push(item.done ? "completed" : "uncompleted");
432
- if (patch.text !== undefined) changes.push(`text: ${item.text}`);
596
+ if (patch.title !== undefined) changes.push(`title: ${item.title}`);
597
+ if (patch.description !== undefined) changes.push("description updated");
433
598
  if (patch.deps !== undefined) {
434
599
  changes.push(depsChange(patch.id, patch.deps, before));
435
600
  }
@@ -476,7 +641,7 @@ export default function (pi: ExtensionAPI): void {
476
641
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
477
642
  const action = params.action;
478
643
  // Error-nudging gate: reject incorrect calls (missing required fields,
479
- // unknown fields, mixed update_item forms) with a precise message that
644
+ // unknown fields, mixed update_items forms) with a precise message that
480
645
  // tells the agent exactly what to fix, before any state is touched.
481
646
  const validation = validateTrackerCall(params);
482
647
  if (!validation.ok) {
@@ -492,7 +657,7 @@ export default function (pi: ExtensionAPI): void {
492
657
  // The state as this call finds it, so a result can name what a change
493
658
  // replaced. Only the actions that report a diff read it.
494
659
  const before =
495
- action === "update_item"
660
+ action === "update_items"
496
661
  ? await runtime.runPromise(withStore((store) => store.state))
497
662
  : state;
498
663
 
@@ -513,15 +678,34 @@ export default function (pi: ExtensionAPI): void {
513
678
  // Args can come from failed validation too, so read them loosely.
514
679
  const raw = args as unknown as Record<string, unknown>;
515
680
  const action = String(raw.action ?? "list");
516
- let text = theme.fg("toolTitle", theme.bold("tracker ")) + theme.fg("muted", action);
681
+ let text =
682
+ theme.style("tracker ", { fg: "toolTitle", bold: true }) + theme.fg("muted", action);
517
683
  if (typeof raw.name === "string") text += ` ${theme.fg("dim", `"${raw.name}"`)}`;
518
- if (typeof raw.text === "string") {
519
- text += ` ${theme.fg("dim", `"${raw.text}"`)}`;
520
- } else if (Array.isArray(raw.text)) {
521
- text += ` ${theme.fg("dim", raw.text.map((t) => `"${t}"`).join(" "))}`;
684
+ if (typeof raw.title === "string") {
685
+ text += ` ${theme.fg("dim", `"${raw.title}"`)}`;
686
+ } else if (Array.isArray(raw.title)) {
687
+ text += ` ${theme.fg(
688
+ "dim",
689
+ raw.title
690
+ .map((entry) =>
691
+ typeof entry === "string"
692
+ ? `"${entry}"`
693
+ : `"${String((entry as { title?: unknown }).title ?? "")}"`,
694
+ )
695
+ .join(" "),
696
+ )}`;
522
697
  }
523
698
  if (Array.isArray(raw.initial_items)) {
524
- text += ` ${theme.fg("dim", raw.initial_items.map((t) => `"${t}"`).join(" "))}`;
699
+ text += ` ${theme.fg(
700
+ "dim",
701
+ raw.initial_items
702
+ .map((entry) =>
703
+ typeof entry === "string"
704
+ ? `"${entry}"`
705
+ : `"${String((entry as { title?: unknown }).title ?? "")}"`,
706
+ )
707
+ .join(" "),
708
+ )}`;
525
709
  }
526
710
  if (Array.isArray(raw.items)) text += ` ${theme.fg("accent", `${raw.items.length} items`)}`;
527
711
  if (raw.activate === false) text += ` ${theme.fg("muted", "(no auto-switch)")}`;
@@ -556,11 +740,14 @@ export default function (pi: ExtensionAPI): void {
556
740
  const display = expanded ? annotations.items : annotations.items.slice(0, 5);
557
741
  for (const [index, item] of display.entries()) {
558
742
  const check = item.done ? theme.fg("success", "✓") : theme.fg("dim", "○");
559
- const itemText = item.done ? theme.fg("dim", item.text) : item.text;
743
+ const itemText = item.done ? theme.fg("dim", item.title) : item.title;
560
744
  const blocked = theme.fg("dim", annotations.suffixByIndex[index] ?? "");
561
745
  parts.push(
562
746
  ` ${check} ${theme.fg("accent", `#${list.name}:${item.id}`)} ${itemText}${blocked}`,
563
747
  );
748
+ if (expanded && (item.description ?? "").length > 0) {
749
+ parts.push(` ${theme.fg("dim", item.description ?? "")}`);
750
+ }
564
751
  }
565
752
  if (!expanded && annotations.items.length > 5) {
566
753
  parts.push(theme.fg("dim", ` ... ${annotations.items.length - 5} more`));
@@ -619,6 +806,7 @@ export default function (pi: ExtensionAPI): void {
619
806
  render: (width) => framed.render(width),
620
807
  invalidate: () => framed.invalidate(),
621
808
  handleInput: (data) => overlay.handleInput(data),
809
+ handleMouse: (event) => overlay.handleMouse(event),
622
810
  };
623
811
  });
624
812
  },