@ftrdotdev/pi-tracker 0.6.0 → 0.8.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 (36) hide show
  1. package/README.md +183 -60
  2. package/package.json +23 -11
  3. package/src/compaction/candidate.test.ts +9 -6
  4. package/src/compaction/candidate.ts +32 -2
  5. package/src/compaction/classifier.test.ts +67 -60
  6. package/src/compaction/classifier.ts +24 -22
  7. package/src/compaction/completion.test.ts +127 -49
  8. package/src/compaction/completion.ts +1 -3
  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 +104 -9
  12. package/src/compaction/digest.ts +96 -9
  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/rules.test.ts +253 -0
  18. package/src/compaction/rules.ts +188 -0
  19. package/src/compaction/settings.test.ts +105 -49
  20. package/src/compaction/settings.ts +53 -31
  21. package/src/compaction/settle.test.ts +370 -0
  22. package/src/compaction/settle.ts +109 -53
  23. package/src/core/deps.test.ts +1 -1
  24. package/src/core/domain.test.ts +42 -9
  25. package/src/core/domain.ts +73 -8
  26. package/src/core/persistence.test.ts +7 -7
  27. package/src/core/store.test.ts +116 -50
  28. package/src/core/store.ts +92 -31
  29. package/src/index.test.ts +209 -68
  30. package/src/index.ts +170 -48
  31. package/src/presentation/tool-metadata.test.ts +263 -48
  32. package/src/presentation/tool-metadata.ts +325 -102
  33. package/src/presentation/ui.test.ts +122 -7
  34. package/src/presentation/ui.ts +81 -18
  35. package/src/presentation/vim-settings.test.ts +98 -0
  36. package/src/presentation/vim-settings.ts +59 -0
package/src/index.test.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bridge tests for `src/index.ts`. The store and the planner have their own
3
3
  * suites; these tests pin the thin wiring between them, including the result
4
- * contract that both `update_item` forms report an affected-items array. That
4
+ * contract that both `update_items` forms report an affected-items array. That
5
5
  * contract broke once: the scalar form returned one `TodoItem`, the renderer
6
6
  * called `.map` on it, and the tool failed with `items.map is not a function`.
7
7
  */
@@ -11,6 +11,7 @@ import {
11
11
  type CompactOptions,
12
12
  type ExtensionAPI,
13
13
  type ExtensionToolContext,
14
+ type Theme,
14
15
  type ToolDefinition,
15
16
  } from "@earendil-works/pi-coding-agent";
16
17
  import type {
@@ -215,16 +216,63 @@ const textOf = (result: AgentToolResult<TrackerToolDetails>): string => {
215
216
  return block?.type === "text" ? block.text : "";
216
217
  };
217
218
 
219
+ /** Identity theme: styles pass text through, so assertions search plain text. */
220
+ const identityTheme = {
221
+ fg: (_color: string, text: string): string => text,
222
+ bold: (text: string): string => text,
223
+ strikethrough: (text: string): string => text,
224
+ style: (text: string): string => text,
225
+ } as unknown as Theme;
226
+
227
+ /** Render a tool result through the registered `renderResult`. */
228
+ const renderList = (
229
+ harness: Harness,
230
+ result: AgentToolResult<TrackerToolDetails>,
231
+ expanded: boolean,
232
+ ): string =>
233
+ harness.tool.renderResult!(
234
+ result,
235
+ { expanded, isPartial: false },
236
+ identityTheme,
237
+ harness.ctx as never,
238
+ )
239
+ .render(400)
240
+ .join("\n")
241
+ .replace(/\s+/g, " ");
242
+
243
+ /**
244
+ * Capture everything the tracker's Effect logger writes while `body` runs.
245
+ * Vitest's console proxy defeats `vi.spyOn`, so replace the methods directly.
246
+ */
247
+ const captureConsole = async (body: () => Promise<void>): Promise<string[]> => {
248
+ const lines: string[] = [];
249
+ const originalLog = console.log;
250
+ const originalError = console.error;
251
+ console.log = (...args: unknown[]) => {
252
+ lines.push(args.map(String).join(" "));
253
+ };
254
+ console.error = (...args: unknown[]) => {
255
+ lines.push(args.map(String).join(" "));
256
+ };
257
+ try {
258
+ await body();
259
+ } finally {
260
+ console.log = originalLog;
261
+ console.error = originalError;
262
+ }
263
+ return lines;
264
+ };
265
+
218
266
  describe("tracker tool bridge", () => {
219
- it("returns an affected-items array for the scalar update_item form", async () => {
267
+ it("returns an affected-items array for the scalar update_items form", async () => {
220
268
  const harness = await makeHarness();
221
269
  await run(harness, {
222
270
  action: "create_list",
223
271
  name: "Work",
224
- initial_items: ["write plan", "ship it"],
272
+ initial_items: [{ title: "write plan" }, { title: "ship it" }],
225
273
  });
226
274
 
227
- const result = await run(harness, { action: "update_item", item_id: "Work:1", done: true });
275
+ const result = await run(harness, { action: "update_items", item_id: "Work:1", done: true });
228
276
 
229
277
  expect(result.details?.items).toHaveLength(1);
230
278
  expect(result.details?.items?.[0]?.done).toBe(true);
@@ -232,33 +280,37 @@ describe("tracker tool bridge", () => {
232
280
  expect(textOf(result)).toContain("Work:1 (completed)");
233
281
  });
234
282
 
235
- it("keeps the text patch for the scalar update_item form", async () => {
283
+ it("keeps the title patch for the scalar update_items form", async () => {
236
284
  const harness = await makeHarness();
237
- await run(harness, { action: "create_list", name: "Work", initial_items: ["old"] });
285
+ await run(harness, { action: "create_list", name: "Work", initial_items: [{ title: "old" }] });
238
286
 
239
- const result = await run(harness, { action: "update_item", item_id: "Work:1", text: "new" });
287
+ const result = await run(harness, { action: "update_items", item_id: "Work:1", title: "new" });
240
288
 
241
289
  expect(result.details?.items).toHaveLength(1);
242
- expect(result.details?.items?.[0]?.text).toBe("new");
243
- expect(textOf(result)).toContain("Work:1 (text: new)");
290
+ expect(result.details?.items?.[0]?.title).toBe("new");
291
+ expect(textOf(result)).toContain("Work:1 (title: new)");
244
292
  });
245
293
 
246
- it("returns one entry per patch for the batch update_item form", async () => {
294
+ it("returns one entry per patch for the batch update_items form", async () => {
247
295
  const harness = await makeHarness();
248
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a", "b", "c"] });
296
+ await run(harness, {
297
+ action: "create_list",
298
+ name: "Work",
299
+ initial_items: [{ title: "a" }, { title: "b" }, { title: "c" }],
300
+ });
249
301
 
250
302
  const result = await run(harness, {
251
- action: "update_item",
303
+ action: "update_items",
252
304
  list_id: 1,
253
305
  items: [
254
306
  { item_id: "Work:1", done: true },
255
- { item_id: "Work:3", text: "cee" },
307
+ { item_id: "Work:3", title: "cee" },
256
308
  ],
257
309
  });
258
310
 
259
311
  expect(result.details?.items).toHaveLength(2);
260
312
  expect(textOf(result)).toContain("Updated 2 items");
261
- expect(textOf(result)).toContain("Work:3 (text: cee)");
313
+ expect(textOf(result)).toContain("Work:3 (title: cee)");
262
314
  });
263
315
 
264
316
  it("shows id-based references in the list output", async () => {
@@ -266,10 +318,10 @@ describe("tracker tool bridge", () => {
266
318
  await run(harness, {
267
319
  action: "create_list",
268
320
  name: "Work",
269
- initial_items: ["write plan", "ship it"],
321
+ initial_items: [{ title: "write plan" }, { title: "ship it" }],
270
322
  });
271
323
 
272
- await run(harness, { action: "update_item", item_id: "Work:2", done: true });
324
+ await run(harness, { action: "update_items", item_id: "Work:2", done: true });
273
325
  const result = await run(harness, { action: "list" });
274
326
 
275
327
  expect(textOf(result)).toContain("[x] #Work:2: ship it");
@@ -277,7 +329,11 @@ describe("tracker tool bridge", () => {
277
329
 
278
330
  it("shows stable ids after a removal", async () => {
279
331
  const harness = await makeHarness();
280
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a", "b", "c"] });
332
+ await run(harness, {
333
+ action: "create_list",
334
+ name: "Work",
335
+ initial_items: [{ title: "a" }, { title: "b" }, { title: "c" }],
336
+ });
281
337
 
282
338
  await run(harness, { action: "remove_item", item_id: "Work:1" });
283
339
  const result = await run(harness, { action: "list" });
@@ -288,11 +344,26 @@ describe("tracker tool bridge", () => {
288
344
  expect(textOf(result)).not.toContain("#Work:1");
289
345
  });
290
346
 
347
+ it("shows the full description in the expanded list view", async () => {
348
+ const harness = await makeHarness();
349
+ const description = "detail ".repeat(30).trim();
350
+ await run(harness, { action: "create_list", name: "Work" });
351
+ await run(harness, {
352
+ action: "add_items",
353
+ list_id: 1,
354
+ items: [{ title: "big", description }],
355
+ });
356
+ const result = await run(harness, { action: "list" });
357
+
358
+ expect(renderList(harness, result, true)).toContain(description);
359
+ expect(renderList(harness, result, false)).not.toContain(description);
360
+ });
361
+
291
362
  it("reports an error result for a missing item instead of throwing", async () => {
292
363
  const harness = await makeHarness();
293
- await run(harness, { action: "create_list", name: "Work", initial_items: ["only"] });
364
+ await run(harness, { action: "create_list", name: "Work", initial_items: [{ title: "only" }] });
294
365
 
295
- const result = await run(harness, { action: "update_item", item_id: "Work:9", done: true });
366
+ const result = await run(harness, { action: "update_items", item_id: "Work:9", done: true });
296
367
 
297
368
  expect(result.details?.error).toContain("Work:9");
298
369
  expect(result.content[0]).toMatchObject({ type: "text" });
@@ -303,13 +374,13 @@ describe("tracker tool bridge", () => {
303
374
  await run(harness, {
304
375
  action: "create_list",
305
376
  name: "Work",
306
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
377
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
307
378
  });
308
379
 
309
380
  const added = await run(harness, {
310
- action: "add_item",
381
+ action: "add_items",
311
382
  list_id: 1,
312
- text: { text: "c", deps: ["Work:2"] },
383
+ items: [{ title: "c", deps: ["Work:2"] }],
313
384
  });
314
385
 
315
386
  expect(added.details?.error).toBeUndefined();
@@ -317,14 +388,46 @@ describe("tracker tool bridge", () => {
317
388
  expect(textOf(added)).toContain("Work:3");
318
389
  });
319
390
 
391
+ it("carries every nested object field on add_items", async () => {
392
+ const harness = await makeHarness();
393
+ await run(harness, {
394
+ action: "create_list",
395
+ name: "Work",
396
+ initial_items: [{ title: "a" }, { title: "b" }],
397
+ });
398
+
399
+ const added = await run(harness, {
400
+ action: "add_items",
401
+ list_id: 1,
402
+ items: [
403
+ {
404
+ title: "Wire the promotion script",
405
+ description: "Add evals/promote.ts.",
406
+ refs: [{ kind: "path", path: "evals/rules.ts" }],
407
+ produces: [{ path: "evals/promote.ts" }],
408
+ deps: ["Work:1"],
409
+ },
410
+ ],
411
+ });
412
+
413
+ expect(added.details?.error).toBeUndefined();
414
+ expect(added.details?.items?.[0]).toMatchObject({
415
+ title: "Wire the promotion script",
416
+ description: "Add evals/promote.ts.",
417
+ refs: [{ kind: "path", path: "evals/rules.ts" }],
418
+ produces: [{ path: "evals/promote.ts" }],
419
+ deps: ["Work:1"],
420
+ });
421
+ });
422
+
320
423
  it("rejects a malformed dependency reference with an actionable message", async () => {
321
424
  const harness = await makeHarness();
322
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a"] });
425
+ await run(harness, { action: "create_list", name: "Work", initial_items: [{ title: "a" }] });
323
426
 
324
427
  const result = await run(harness, {
325
- action: "add_item",
428
+ action: "add_items",
326
429
  list_id: 1,
327
- text: { text: "b", deps: ["nonsense"] },
430
+ items: [{ title: "b", deps: ["nonsense"] }],
328
431
  });
329
432
 
330
433
  expect(result.details?.error).toContain("listName:id");
@@ -335,11 +438,11 @@ describe("tracker tool bridge", () => {
335
438
  await run(harness, {
336
439
  action: "create_list",
337
440
  name: "Work",
338
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
441
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
339
442
  });
340
443
 
341
444
  const result = await run(harness, {
342
- action: "update_item",
445
+ action: "update_items",
343
446
  item_id: "Work:1",
344
447
  deps: ["Work:2"],
345
448
  });
@@ -353,7 +456,11 @@ describe("tracker tool bridge", () => {
353
456
  await run(harness, {
354
457
  action: "create_list",
355
458
  name: "Work",
356
- initial_items: ["a", { text: "b", deps: ["Work:1"] }, { text: "c", deps: ["Work:2"] }],
459
+ initial_items: [
460
+ { title: "a" },
461
+ { title: "b", deps: ["Work:1"] },
462
+ { title: "c", deps: ["Work:2"] },
463
+ ],
357
464
  });
358
465
 
359
466
  const text = textOf(await run(harness, { action: "list" }));
@@ -365,7 +472,11 @@ describe("tracker tool bridge", () => {
365
472
 
366
473
  it("leaves the list output untouched for a dependency-free list", async () => {
367
474
  const harness = await makeHarness();
368
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a", "b"] });
475
+ await run(harness, {
476
+ action: "create_list",
477
+ name: "Work",
478
+ initial_items: [{ title: "a" }, { title: "b" }],
479
+ });
369
480
 
370
481
  const text = textOf(await run(harness, { action: "list" }));
371
482
 
@@ -379,10 +490,10 @@ describe("tracker tool bridge", () => {
379
490
  await run(harness, {
380
491
  action: "create_list",
381
492
  name: "Work",
382
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
493
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
383
494
  });
384
495
 
385
- const result = await run(harness, { action: "update_item", item_id: "Work:2", done: true });
496
+ const result = await run(harness, { action: "update_items", item_id: "Work:2", done: true });
386
497
 
387
498
  expect(result.details?.error).toContain("Work:1");
388
499
  expect(result.details?.error).toContain("blocked");
@@ -393,13 +504,13 @@ describe("tracker tool bridge", () => {
393
504
  await run(harness, {
394
505
  action: "create_list",
395
506
  name: "Work",
396
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
507
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
397
508
  });
398
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
399
- await run(harness, { action: "update_item", item_id: "Work:2", done: true });
509
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
510
+ await run(harness, { action: "update_items", item_id: "Work:2", done: true });
400
511
 
401
512
  const text = textOf(
402
- await run(harness, { action: "update_item", item_id: "Work:1", done: false }),
513
+ await run(harness, { action: "update_items", item_id: "Work:1", done: false }),
403
514
  );
404
515
 
405
516
  expect(text).toContain("Note:");
@@ -411,12 +522,12 @@ describe("tracker tool bridge", () => {
411
522
  await run(harness, {
412
523
  action: "create_list",
413
524
  name: "Work",
414
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
525
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
415
526
  });
416
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
527
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
417
528
 
418
529
  const text = textOf(
419
- await run(harness, { action: "update_item", item_id: "Work:1", done: false }),
530
+ await run(harness, { action: "update_items", item_id: "Work:1", done: false }),
420
531
  );
421
532
 
422
533
  expect(text).not.toContain("Note:");
@@ -427,11 +538,11 @@ describe("tracker tool bridge", () => {
427
538
  await run(harness, {
428
539
  action: "create_list",
429
540
  name: "Work",
430
- initial_items: ["a", { text: "b", deps: ["Work:1"] }],
541
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }],
431
542
  });
432
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
433
- await run(harness, { action: "update_item", item_id: "Work:2", done: true });
434
- await run(harness, { action: "update_item", item_id: "Work:1", done: false });
543
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
544
+ await run(harness, { action: "update_items", item_id: "Work:2", done: true });
545
+ await run(harness, { action: "update_items", item_id: "Work:1", done: false });
435
546
 
436
547
  const text = textOf(await run(harness, { action: "list" }));
437
548
 
@@ -443,11 +554,15 @@ describe("tracker tool bridge", () => {
443
554
 
444
555
  it("notes a done item that a dependency edit left waiting", async () => {
445
556
  const harness = await makeHarness();
446
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a", "b"] });
447
- await run(harness, { action: "update_item", item_id: "Work:2", done: true });
557
+ await run(harness, {
558
+ action: "create_list",
559
+ name: "Work",
560
+ initial_items: [{ title: "a" }, { title: "b" }],
561
+ });
562
+ await run(harness, { action: "update_items", item_id: "Work:2", done: true });
448
563
 
449
564
  const text = textOf(
450
- await run(harness, { action: "update_item", item_id: "Work:2", deps: ["Work:1"] }),
565
+ await run(harness, { action: "update_items", item_id: "Work:2", deps: ["Work:1"] }),
451
566
  );
452
567
 
453
568
  expect(text).toContain("Note: Work:2 is done but now waits on Work:1");
@@ -458,15 +573,15 @@ describe("tracker tool bridge", () => {
458
573
  await run(harness, {
459
574
  action: "create_list",
460
575
  name: "Work",
461
- initial_items: ["a", { text: "b", deps: ["Work:1"] }, "c"],
576
+ initial_items: [{ title: "a" }, { title: "b", deps: ["Work:1"] }, { title: "c" }],
462
577
  });
463
578
 
464
- const cleared = await run(harness, { action: "update_item", item_id: "Work:2", deps: [] });
579
+ const cleared = await run(harness, { action: "update_items", item_id: "Work:2", deps: [] });
465
580
  expect(textOf(cleared)).toContain("deps cleared (was Work:1)");
466
581
 
467
- await run(harness, { action: "update_item", item_id: "Work:2", deps: ["Work:1"] });
582
+ await run(harness, { action: "update_items", item_id: "Work:2", deps: ["Work:1"] });
468
583
  const replaced = await run(harness, {
469
- action: "update_item",
584
+ action: "update_items",
470
585
  item_id: "Work:2",
471
586
  deps: ["Work:3"],
472
587
  });
@@ -475,13 +590,17 @@ describe("tracker tool bridge", () => {
475
590
 
476
591
  it("persists overlapping mutations in order", async () => {
477
592
  const harness = await makeHarness();
478
- await run(harness, { action: "create_list", name: "Work", initial_items: ["a", "b"] });
593
+ await run(harness, {
594
+ action: "create_list",
595
+ name: "Work",
596
+ initial_items: [{ title: "a" }, { title: "b" }],
597
+ });
479
598
 
480
599
  // Two calls in flight at once. The last snapshot the session receives must
481
600
  // be the state after both, or a later restore resurrects an older one.
482
601
  await Promise.all([
483
- run(harness, { action: "update_item", item_id: "Work:1", done: true }),
484
- run(harness, { action: "update_item", item_id: "Work:2", done: true }),
602
+ run(harness, { action: "update_items", item_id: "Work:1", done: true }),
603
+ run(harness, { action: "update_items", item_id: "Work:2", done: true }),
485
604
  ]);
486
605
 
487
606
  const last = harness.appends.at(-1) as {
@@ -499,7 +618,7 @@ describe("tracker tool bridge", () => {
499
618
  await run(harness, {
500
619
  action: "create_list",
501
620
  name: "Work",
502
- initial_items: [{ text: "ship", deps: ["Work:2"] }, "write plan"],
621
+ initial_items: [{ title: "ship", deps: ["Work:2"] }, { title: "write plan" }],
503
622
  });
504
623
 
505
624
  const text = textOf(await run(harness, { action: "list" }));
@@ -533,9 +652,9 @@ describe("tracker smart-compaction bridge", () => {
533
652
  await run(harness, {
534
653
  action: "create_list",
535
654
  name: "Work",
536
- initial_items: ["first", { text: "second", deps: ["Work:1"] }],
655
+ initial_items: [{ title: "first" }, { title: "second", deps: ["Work:1"] }],
537
656
  });
538
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
657
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
539
658
  };
540
659
 
541
660
  it("a completed item with a compact verdict starts pi's compaction at the settle boundary", async () => {
@@ -559,10 +678,24 @@ describe("tracker smart-compaction bridge", () => {
559
678
  expect(harness.compacts).toHaveLength(0);
560
679
  });
561
680
 
562
- it("a raised keepContextThreshold compacts an answer the default would keep", async () => {
681
+ it("writes nothing to the console when an observe-only rule asks the classifier", async () => {
682
+ // The fired row is reported through the decision record. A console log
683
+ // would bypass pi's differential renderer and stick in the editor area.
684
+ const harness = await makeHarness({
685
+ registry: compactRegistry(0.1),
686
+ config: { smartCompaction: { enabled: true } },
687
+ });
688
+ await completeFirst(harness);
689
+
690
+ const lines = await captureConsole(() => harness.settle());
691
+
692
+ expect(lines).toEqual([]);
693
+ });
694
+
695
+ it("a raised needsContextProbabilityThreshold compacts an answer the default would keep", async () => {
563
696
  const harness = await makeHarness({
564
697
  registry: compactRegistry(0.6),
565
- config: { smartCompaction: { keepContextThreshold: 0.9 } },
698
+ config: { smartCompaction: { needsContextProbabilityThreshold: 0.9 } },
566
699
  });
567
700
  await completeFirst(harness);
568
701
 
@@ -571,10 +704,10 @@ describe("tracker smart-compaction bridge", () => {
571
704
  expect(harness.compacts).toHaveLength(1);
572
705
  });
573
706
 
574
- it("a lowered keepContextThreshold keeps an answer the default would compact", async () => {
707
+ it("a lowered needsContextProbabilityThreshold keeps an answer the default would compact", async () => {
575
708
  const harness = await makeHarness({
576
709
  registry: compactRegistry(0.45),
577
- config: { smartCompaction: { keepContextThreshold: 0.2 } },
710
+ config: { smartCompaction: { needsContextProbabilityThreshold: 0.2 } },
578
711
  });
579
712
  await completeFirst(harness);
580
713
 
@@ -586,7 +719,7 @@ describe("tracker smart-compaction bridge", () => {
586
719
  it("keeps context when the classifier answer is below the confidence floor", async () => {
587
720
  const harness = await makeHarness({
588
721
  registry: compactRegistry(0.1, undefined, 0.2),
589
- config: { smartCompaction: { keepContextMinConfidence: 0.9 } },
722
+ config: { smartCompaction: { minAnswerConfidence: 0.9 } },
590
723
  });
591
724
  await completeFirst(harness);
592
725
 
@@ -598,7 +731,7 @@ describe("tracker smart-compaction bridge", () => {
598
731
  it("compacts when the classifier answer reaches the confidence floor", async () => {
599
732
  const harness = await makeHarness({
600
733
  registry: compactRegistry(0.1, undefined, 0.9),
601
- config: { smartCompaction: { keepContextMinConfidence: 0.5 } },
734
+ config: { smartCompaction: { minAnswerConfidence: 0.5 } },
602
735
  });
603
736
  await completeFirst(harness);
604
737
 
@@ -642,9 +775,13 @@ describe("tracker smart-compaction bridge", () => {
642
775
  await run(harness, {
643
776
  action: "create_list",
644
777
  name: "Work",
645
- initial_items: ["first", { text: "second", deps: ["Work:1"] }, "third"],
778
+ initial_items: [
779
+ { title: "first" },
780
+ { title: "second", deps: ["Work:1"] },
781
+ { title: "third" },
782
+ ],
646
783
  });
647
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
784
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
648
785
 
649
786
  await harness.settle();
650
787
 
@@ -657,9 +794,13 @@ describe("tracker smart-compaction bridge", () => {
657
794
  await run(harness, {
658
795
  action: "create_list",
659
796
  name: "Work",
660
- initial_items: ["first", { text: "second", deps: ["Work:1"] }, "third"],
797
+ initial_items: [
798
+ { title: "first" },
799
+ { title: "second", deps: ["Work:1"] },
800
+ { title: "third" },
801
+ ],
661
802
  });
662
- await run(harness, { action: "update_item", item_id: "Work:1", done: true });
803
+ await run(harness, { action: "update_items", item_id: "Work:1", done: true });
663
804
 
664
805
  await harness.settle();
665
806
 
@@ -711,7 +852,7 @@ describe("tracker smart-compaction bridge", () => {
711
852
  await run(harness, {
712
853
  action: "create_list",
713
854
  name: "Work",
714
- initial_items: ["first", { text: "second", deps: ["Work:1"] }],
855
+ initial_items: [{ title: "first" }, { title: "second", deps: ["Work:1"] }],
715
856
  });
716
857
 
717
858
  await harness.settle();
@@ -813,10 +954,10 @@ describe("tracker smart-compaction bridge", () => {
813
954
  await run(harness, {
814
955
  action: "create_list",
815
956
  name: "Work",
816
- initial_items: ["first", { text: "second", deps: ["Work:1"] }],
957
+ initial_items: [{ title: "first" }, { title: "second", deps: ["Work:1"] }],
817
958
  });
818
959
 
819
- const result = await run(harness, { action: "update_item", item_id: "Work:1", done: true });
960
+ const result = await run(harness, { action: "update_items", item_id: "Work:1", done: true });
820
961
  const appendsBefore = harness.appends.length;
821
962
 
822
963
  await harness.settle();