@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/README.md CHANGED
@@ -6,9 +6,10 @@ pi-tracker is an extension for Pi. It manages todolists in your session.
6
6
 
7
7
  - Create and delete todolists.
8
8
  - Add, update, and remove items in a todolist.
9
+ - Give an item a short title, a longer description, and optional declarations.
9
10
  - Mark an item as complete or incomplete.
10
- - Change the task text of an item.
11
11
  - Declare dependencies between items, so work happens in order.
12
+ - Declare the references and products an item needs, so the next step survives compaction.
12
13
  - Persist todolists with the session.
13
14
  - Show the active todolist in a widget above the editor.
14
15
  - Start Pi's compaction when a completed item's detail is no longer needed.
@@ -27,38 +28,40 @@ The snapshot does not enter the LLM context.
27
28
  Ask Pi to manage your todolists. Pi calls the `tracker` tool. The tool
28
29
  supports these actions:
29
30
 
30
- | Action | Purpose | Parameters |
31
- | ------------- | ----------------------------------------- | ----------------------------------------------------------- |
32
- | `list` | Show all lists and items | None |
33
- | `create_list` | Create a list (becomes active by default) | `name`, `initial_items?`, `activate?` |
34
- | `delete_list` | Delete a list | `list_id` |
35
- | `set_active` | Set or clear the active list | `list_id` (optional) |
36
- | `add_item` | Add one or more items | `list_id`, `text` (string, item object, or array) |
37
- | `update_item` | Update one or more items | `item_id` + `text?`/`done?`/`deps?`, or `list_id` + `items` |
38
- | `remove_item` | Remove an item | `item_id` |
31
+ | Action | Purpose | Parameters |
32
+ | -------------- | ----------------------------------------- | ------------------------------------------ |
33
+ | `list` | Show all lists and items | None |
34
+ | `create_list` | Create a list (becomes active by default) | `name`, `initial_items?`, `activate?` |
35
+ | `delete_list` | Delete a list | `list_id` |
36
+ | `set_active` | Set or clear the active list | `list_id` (optional) |
37
+ | `add_items` | Add one or more items | `list_id`, `items` (array of item objects) |
38
+ | `update_items` | Update one or more items | `item_id` + fields, or `list_id` + `items` |
39
+ | `remove_item` | Remove an item | `item_id` |
39
40
 
40
41
  `create_list` accepts `initial_items` to create the list with its first
41
- items in one call, so the list and its items are created atomically. Each
42
- item is either a text string or an object `{text, deps?}`. `add_item`
43
- accepts the same shapes, plus an array of them, to add several items in one
44
- call.
42
+ items in one call, so the list and its items are created atomically. Every
43
+ item is an object `{title, description?, refs?, produces?, deps?}`, and
44
+ `add_items` takes the same objects in its `items` array, so an item is
45
+ always declared the same way. A title is one short action line, at most 200
46
+ characters; put the longer detail in `description`.
45
47
 
46
48
  Item ids are `listName:id`, as the `list` action shows them (e.g. `Work:2`).
47
49
  An id is permanent: it is stored on the item, it is unique within its list,
48
50
  and it is never reused. Removing an item leaves a gap in the numbering
49
51
  instead of shifting the items after it, so a reference you already hold stays
50
- valid. `update_item` accepts the scalar form (`item_id` with optional
51
- `text`/`done`/`deps`) or a per-list batched form: `list_id` plus an `items`
52
- array (`[{item_id, text?, done?, deps?}, ...]`), mirroring `add_item`'s
53
- `list_id + text[]` shape, so one batch stays within a single list. Creating a
54
- list makes it the active list (the widget switches to it); pass
55
- `activate: false` to keep the current active list.
52
+ valid. `update_items` accepts the scalar form (`item_id` with optional
53
+ `title`/`description`/`refs`/`produces`/`done`/`deps`) or a per-list batched
54
+ form: `list_id` plus an `items`
55
+ array (`[{item_id, title?, description?, refs?, produces?, done?, deps?}, ...]`),
56
+ mirroring `add_items`' `list_id + items` shape, so one batch stays within a
57
+ single list. Creating a list makes it the active list (the widget switches to
58
+ it); pass `activate: false` to keep the current active list.
56
59
 
57
60
  The tool validates every call and returns an error that names exactly what to
58
61
  fix: each action accepts only its own parameters, required fields are
59
- enforced, and the two `update_item` forms never mix. Read the error and retry
62
+ enforced, and the two `update_items` forms never mix. Read the error and retry
60
63
  with corrected parameters. Not-found errors also list the available ids.
61
- `update_item` also appends a reminder when one call marks two or more items
64
+ `update_items` also appends a reminder when one call marks two or more items
62
65
  done and leaves no open items behind (the terminal batch): the working
63
66
  rhythm is to mark each item done in the same turn it completes, never batch
64
67
  the marking at the end.
@@ -70,10 +73,29 @@ Example prompt:
70
73
  Call `set_active` without `list_id` to deselect. The widget hides when no
71
74
  list is active.
72
75
 
76
+ ### Titles, descriptions, and declarations
77
+
78
+ Every item has a required `title`: one short action line, at most 200
79
+ characters. An item may also carry a `description` with the longer detail. The
80
+ widget shows the title, with the description dimmed on the line below; the
81
+ `/tracker` items pane shows the full description.
82
+
83
+ An item may declare two optional lists:
84
+
85
+ - `refs`: what the item must read after the completed work. Each entry is
86
+ `{kind: "path", path, symbol?, span?}` or `{kind: "decision", topic}`.
87
+ - `produces`: every document the item will write. Each entry is `{path}`.
88
+
89
+ Declarations tell the tracker what the next step needs. At the settle boundary
90
+ the tracker resolves a declared path against disk. If the detail is readable
91
+ there, the rule table can compact the completed work and keep the next step
92
+ moving without a classifier call. After a session restore there is no tool
93
+ footprint, so references resolve as unresolved and only products check disk.
94
+
73
95
  ### Dependencies and readiness
74
96
 
75
97
  An item can wait for other items. Pass `deps` on the item object when you
76
- create it, or through `update_item`, as a list of `listName:id` references to
98
+ create it, or through `update_items`, as a list of `listName:id` references to
77
99
  items in the same list. `deps` replaces the whole dependency set, so pass `[]`
78
100
  to clear it. The result names the set before and after whenever the two
79
101
  differ, so a dependency the call dropped does not disappear silently.
@@ -105,7 +127,7 @@ keeps the output it had before dependencies existed. A dependency reference
105
127
  that does not resolve counts as a blocker, so a hand-edited snapshot cannot
106
128
  silently unblock work.
107
129
 
108
- An `update_item` batch applies its patches in order, so it behaves like the
130
+ An `update_items` batch applies its patches in order, so it behaves like the
109
131
  same calls in sequence: one call can complete a chain, and a completion that
110
132
  comes before its blocker in the array is refused.
111
133
 
@@ -119,8 +141,8 @@ action, the widget, and the `/tracker` items pane all use that order.
119
141
  The intended rhythm: break multi-step work into items up front (one item per
120
142
  deliverable), work through them one at a time, and mark each done as it
121
143
  completes. The list in the widget always shows current progress. The agent
122
- reads it with `list` before starting and after finishing, and updates item text
123
- with `update_item` when scope changes.
144
+ reads it with `list` before starting and after finishing, and updates an item's
145
+ title or description with `update_items` when scope changes.
124
146
 
125
147
  Failed calls are recoverable: the tool's errors say what to fix, and
126
148
  not-found errors name the available ids. The agent corrects the call and
@@ -138,16 +160,24 @@ pane for editing.
138
160
  | ------- | -------------------------------------- |
139
161
  | `tab` | Switch between the lists and the items |
140
162
  | `↑` `↓` | Move the cursor |
163
+ | `←` `→` | Switch panes |
164
+ | `j` `k` | Move the cursor (vim on) |
165
+ | `h` `l` | Switch panes (vim on) |
141
166
  | `enter` | Select a list and open its items |
142
167
  | `space` | Toggle the active list |
143
168
  | `n` | Create a list |
144
169
  | `d` | Delete a list |
145
170
  | `a` | Add an item |
146
171
  | `x` | Toggle an item complete or incomplete |
147
- | `e` | Edit the item text |
172
+ | `e` | Edit the item title |
148
173
  | `r` | Remove an item |
149
174
  | `esc` | Close the view |
150
175
 
176
+ The `j` `k` `h` `l` keys are the vim navigation motions, and they are live
177
+ only when `vim` is on in the shared `tui.json`. The overlay reads that toggle
178
+ when it opens and shows the vim keys in its help line only when they are
179
+ active. Arrows always work.
180
+
151
181
  ### The widget
152
182
 
153
183
  The widget shows the active list above the editor. It appears when a list is
@@ -180,41 +210,55 @@ output and the `/tracker` items pane, which have room for it.
180
210
 
181
211
  ### Smart compaction
182
212
 
183
- When you complete an item in the active list, pi-tracker asks a small
184
- classifier whether the **ready items** need the completed work. It judges the
185
- whole ready frontier in one call, up to `maxCandidates` entries, dependents
186
- first. Each candidate gets one two-label choice question: `needs-context` or
187
- `stands-alone`. The answer carries a probability and a `confidence`. When no
188
- ready item needs the detail, pi-tracker starts Pi's compaction at the settle
189
- boundary and then resumes the session with a pointer to the next ready item.
213
+ When you complete an item in the active list, pi-tracker decides whether the
214
+ **ready items** need the completed work. A measured rule row runs first. When
215
+ an accepted row fires, it decides the whole ready frontier on its own. Every
216
+ other row reports its name and hands the frontier to the classifier, which
217
+ judges up to `maxCandidates` entries, dependents first. Each candidate gets one
218
+ two-label choice question: `needs-context` or `stands-alone`. The answer carries
219
+ a probability and a `confidence`. When no ready item needs the detail,
220
+ pi-tracker starts Pi's compaction at the settle boundary and then resumes the
221
+ session with a pointer to the next ready item.
190
222
 
191
223
  The feature reads five keys from `tui.json`, under `smartCompaction`:
192
224
 
193
- | Key | Type | Default | Meaning |
194
- | -------------------------- | ---------------- | ------- | ---------------------------------------------------------------------------------------- |
195
- | `enabled` | boolean | `true` | Turn smart compaction on or off. |
196
- | `classifier` | string or null | `null` | A `provider/modelId` classifier. `null` uses the preference order: Clef Flash, then TypeSafe Jev, then OpenCode Jev. |
197
- | `keepContextThreshold` | number in (0, 1) | `0.5` | The probability of `needs-context` at or above which the context is kept. |
198
- | `keepContextMinConfidence` | number in (0, 1) | `0.5` | The answer confidence below which the context is kept. |
199
- | `maxCandidates` | integer 1..20 | `8` | How many ready items one classification judges. |
200
-
201
- `keepContextThreshold` is the probability knob: raise it to compact less often,
202
- lower it to compact more often. `keepContextMinConfidence` is the second guard:
203
- when the model's answer is less confident than the floor, pi-tracker keeps the
204
- context. The gate only adds keeping, so it can never cause a premature
205
- compaction. `maxCandidates` bounds the classifier input; when more items are
206
- ready than the cap, the first `maxCandidates` are judged, dependents first.
225
+ | Key | Type | Default | Meaning |
226
+ | ---------------------------------- | ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
227
+ | `enabled` | boolean | `true` | Turn smart compaction on or off. |
228
+ | `classifier` | string or null | `null` | A `provider/modelId` classifier. `null` uses the preference order: Clef Flash, then TypeSafe Jev, then OpenCode Jev. |
229
+ | `needsContextProbabilityThreshold` | number in (0, 1) | `0.5` | The `needs-context` probability at or above which the context is kept. |
230
+ | `minAnswerConfidence` | number in (0, 1) | `0.5` | The answer's self-reported confidence below which the context is kept. |
231
+ | `maxCandidates` | integer 1..20 | `8` | How many ready items one classification judges. |
232
+
233
+ `needsContextProbabilityThreshold` is the probability knob: raise it to compact
234
+ more often, lower it to keep context more often. It cuts on the probability the
235
+ classifier assigns to `needs-context`, not on its confidence. `minAnswerConfidence`
236
+ is a separate guard on the answer's self-reported confidence: when the model is
237
+ less confident than the floor, pi-tracker keeps the context. This guard only
238
+ adds keeping, so it can never cause a premature compaction. Both keys still
239
+ accept their pre-rename names (`keepContextThreshold`, `keepContextMinConfidence`)
240
+ as aliases; the current key wins when both are present. `maxCandidates` bounds the
241
+ classifier input; when more items are ready than the cap, the first
242
+ `maxCandidates` are judged, dependents first.
207
243
 
208
244
  A value outside the range in the table falls back to the default. The feature
209
245
  fails open. A disabled feature, no credential-available classifier, a classifier
210
246
  error or timeout, an aborted run, or a list with no ready item keeps the full
211
247
  context. The classifier input is the item list only. The transcript never leaves
212
- the session.
248
+ the session. An unaccepted rule row abstains, so it never compacts on its own.
249
+
250
+ The rule table lives in `src/compaction/rules.ts`. Only rows in
251
+ `ACCEPTED_RULES` compact on their own. A row enters that set only when the eval
252
+ gate accepts it on labeled decisions: at least 10 labeled firings, at least 95%
253
+ agreement, above the pass base rate, in at least two passes. Every decision on
254
+ an item with declarations records the fired row and the resolved states as a
255
+ `tracker/reliance-decision` session entry, which the eval reads back.
256
+ `bun run eval:rules` prints the tables and the gate.
213
257
 
214
258
  The `/tui` command edits all five on a **Compaction** tab: `Smart compaction`
215
- (toggle), `Compaction classifier` (picker), `Keep-context confidence`, `Min
216
- confidence`, and `Max candidates` (`+` and `-` adjust the numeric rows). The
217
- Compaction tab appears only while the tracker extension is loaded.
259
+ (toggle), `Compaction classifier` (picker), `Needs-context probability`, `Answer
260
+ confidence floor`, and `Max candidates` (`+` and `-` adjust the numeric rows).
261
+ The Compaction tab appears only while the tracker extension is loaded.
218
262
 
219
263
  ## Persistence
220
264
 
@@ -224,7 +268,9 @@ and written in order, and each result reports the state its own call produced
224
268
  instead of a value another surface cached.
225
269
 
226
270
  A snapshot saved before item ids existed loads with each item id equal to its
227
- position, so references in that format still resolve.
271
+ position, so references in that format still resolve. A snapshot written before
272
+ the title/description split loads with the first line as the title and the rest
273
+ as the description.
228
274
 
229
275
  ## Installation
230
276
 
@@ -258,12 +304,81 @@ Registration lives in `package.json` under the `pi` field:
258
304
 
259
305
  ## Development
260
306
 
261
- | Command | Purpose |
262
- | ------------------- | -------------------------------------------- |
263
- | `bun test` | Run the test suite (vitest + @effect/vitest) |
264
- | `bun test:watch` | Run the test suite in watch mode |
265
- | `bunx tsc --noEmit` | Type check |
266
- | `bun lint` | Lint with oxlint |
307
+ | Command | Purpose |
308
+ | ------------------------- | ---------------------------------------------------------- |
309
+ | `bun run test` | Run the test suite (vitest + @effect/vitest) |
310
+ | `bun run test:watch` | Run the test suite in watch mode |
311
+ | `bun run typecheck` | Type check with `tsc --noEmit` |
312
+ | `bun run lint` | Lint with oxlint |
313
+ | `bun run eval:harvest` | Harvest the frozen legacy corpus from local sessions |
314
+ | `bun run eval:harvest:v2` | Harvest only declared-format cases into `evals/data/v2` |
315
+ | `bun run eval:facts` | Freeze the declared facts and print the pre-flight verdict |
316
+ | `bun run eval:sample` | Draw the seeded, quota-based label sample |
317
+ | `bun run eval:review` | Render the corpus as a markdown review pack |
318
+ | `bun run eval:label` | Label the sample in a terminal |
319
+ | `bun run eval:audit` | Replay sampled facts against today's disk |
320
+ | `bun run eval:rules` | Print the rule tables and the promotion gate |
321
+ | `bun run eval:promote` | Add a measured row to `ACCEPTED_RULES` (v2 only) |
322
+ | `bun run eval:answers` | Freeze classifier answers for the sampled heads |
323
+ | `bun run eval:score` | Score a frozen answer file against the labels |
324
+ | `bun run eval:freeze` | Freeze the labeled corpus and write `report.md` |
325
+
326
+ ### Eval corpora
327
+
328
+ There are two corpora, and they measure different populations.
329
+
330
+ - `evals/data` is frozen. It holds 1,446 legacy cases and 1,385 labels in three
331
+ timestamp passes (`pass1`, `pass2`, `pass3`). It never measured a declared
332
+ row, so `eval:rules --out evals/data` checks only that the frozen floor
333
+ (`names-batch-output`, `no-visible-link`) is still accepted and names any rule
334
+ this corpus never measured. Do not re-harvest it.
335
+ - `evals/data/v2` is the declared corpus. A case is declared when its raw
336
+ snapshot holds any item with a `description`, `refs`, or `produces` key. The
337
+ gate scores one candidate per decision: the **declared head**, the head
338
+ candidate that carries at least one `refs` or `produces` entry. A head with a
339
+ description only is a control. The gate measures each row against the control
340
+ subset, in two explicit passes (`v2-a`, `v2-b`), and prints `base: thin (n)`
341
+ below 30 controls.
342
+
343
+ Run the declared pipeline in order:
344
+
345
+ ```bash
346
+ bun run eval:harvest:v2 --out evals/data/v2 --evidence evals/data/v2-evidence
347
+ bun run eval:facts --out evals/data/v2 --evidence evals/data/v2-evidence
348
+ bun run eval:sample --out evals/data/v2 --seed 7 --evidence evals/data/v2-evidence
349
+ bun run eval:label --out evals/data/v2 --pilot
350
+ bun run eval:label --out evals/data/v2 --pass v2-a
351
+ bun run eval:label --out evals/data/v2 --pass v2-b
352
+ bun run eval:audit --out evals/data/v2 --seed 7 --evidence evals/data/v2-evidence
353
+ bun run eval:rules --out evals/data/v2 --evidence evals/data/v2-evidence
354
+ bun run eval:freeze --out evals/data/v2 --evidence evals/data/v2-evidence
355
+ bun run eval:freeze --out evals/data/v2 --evidence evals/data/v2-evidence --report
356
+ ```
357
+
358
+ The pilot sitting labels the 20 pilot cases as ordinary `pilot`-pass labels.
359
+ Each later sitting opens with ten blind repeats of them, written with
360
+ `pilot: true` and excluded from the gate; self-agreement below 90% discards the
361
+ sitting. The pilot never enters the gate.
362
+
363
+ `eval:facts` ends with the pre-flight verdict. When no behavior-changing row can
364
+ reach 10 firings per pass it prints `STOP:` and exits non-zero, so the label run
365
+ never starts against a corpus that cannot promote.
366
+
367
+ `eval:promote --out evals/data/v2` is additive: it writes the union of the
368
+ frozen old floor and the v2 accepted set, minus any row named by an explicit
369
+ `--remove`, minus any row two audit mismatches block. It refuses any corpus whose
370
+ manifest is not the declared format. An abstain row is reported, never promoted.
371
+
372
+ `evals/data/v2-evidence/` is a local audit trail, ignored by git: the manifest,
373
+ the sample ids, the gate cells, the audit rows, and `report.md`. The harvest,
374
+ sample, and audit steps replace each session file name with a stable
375
+ `session-<hash>` alias before they write there, the manifest keeps only list-name
376
+ counts, and the session root becomes `<SESSION-ROOT>`. `evals/data/v2/cases.jsonl`,
377
+ `facts.jsonl`, and `answers.*` stay local because they hold session text.
378
+
379
+ `evals/.gitignore` ignores all of `evals/data/` except `evals/data/synthetic/`.
380
+ `evals/privacy.test.ts` fails when git tracks any other file under `evals/data/`,
381
+ or a legacy `data-v2/` or `v2-evidence/` path.
267
382
 
268
383
  ## Project structure
269
384
 
@@ -273,7 +388,15 @@ Registration lives in `package.json` under the `pi` field:
273
388
  | `src/core/deps.ts` | Dependency references, cycle detection, readiness, derived order |
274
389
  | `src/core/store.ts` | `TrackerStore` service with `Effect.Ref` state |
275
390
  | `src/core/persistence.ts` | `TrackerPersistence` service (save and restore snapshots) |
276
- | `src/compaction/*.ts` | Smart compaction: classifier, settle, digest, pointer, settings |
391
+ | `src/compaction/observations.ts` | Resolves declared references and products against disk |
392
+ | `src/compaction/rules.ts` | The rule table, `ACCEPTED_RULES`, and the gate constants |
393
+ | `src/compaction/footprint.ts` | Records what each batch wrote, read, and ran |
394
+ | `src/compaction/settle.ts` | The settle decision: rules first, then the classifier |
395
+ | `src/compaction/digest.ts` | The bounded classifier input |
396
+ | `src/compaction/decision-record.ts` | The `tracker/reliance-decision` session entry |
397
+ | `src/compaction/classifier.ts` | The classifier gateway |
398
+ | `src/compaction/pointer.ts` | The resume pointer and its custom entry |
399
+ | `src/compaction/settings.ts` | The `tui.json` reader |
277
400
  | `src/presentation/ui.ts` | Widget pane and interactive `/tracker` component |
278
401
  | `src/presentation/tool-metadata.ts` | Tool parameters, result details, and display labels |
279
402
  | `src/index.ts` | Pi bridge: tool, command, session hooks, widget refresh |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftrdotdev/pi-tracker",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Session-persistent todolist extension for Pi",
5
5
  "keywords": [
6
6
  "effect",
@@ -37,27 +37,39 @@
37
37
  "scripts": {
38
38
  "test": "vitest run",
39
39
  "test:watch": "vitest",
40
+ "eval:harvest": "bun evals/harvest.ts",
41
+ "eval:harvest:v2": "bun evals/harvest.ts --format declared",
42
+ "eval:facts": "bun evals/facts.ts",
43
+ "eval:sample": "bun evals/sample.ts",
44
+ "eval:audit": "bun evals/audit.ts",
45
+ "eval:answers": "bun evals/answers.ts",
46
+ "eval:score": "bun evals/score.ts",
47
+ "eval:freeze": "bun evals/freeze.ts",
48
+ "eval:review": "bun evals/review.ts",
49
+ "eval:label": "bun evals/label.ts",
50
+ "eval:rules": "bun evals/rules.ts",
51
+ "eval:promote": "bun evals/promote.ts",
40
52
  "lint": "oxlint && oxlint --type-aware -A all -D typescript/unbound-method",
41
53
  "lint:fix": "oxlint --fix",
42
54
  "fmt": "oxfmt",
43
55
  "typecheck": "tsc --noEmit"
44
56
  },
45
57
  "dependencies": {
46
- "@effect/platform-node": "4.0.0",
47
- "@effect/platform-node-shared": "4.0.0",
48
- "@ftrdotdev/pi-tui": "^0.6.0",
49
- "effect": "4.0.0"
58
+ "@effect/platform-node": "4.1.1",
59
+ "@effect/platform-node-shared": "4.1.1",
60
+ "@ftrdotdev/pi-tui": "^0.8.0",
61
+ "effect": "4.1.1"
50
62
  },
51
63
  "devDependencies": {
52
- "@earendil-works/pi-tui": "1.0.2",
53
- "@effect/tsgo": "0.47.2",
54
- "@effect/vitest": "4.0.0",
64
+ "@earendil-works/pi-tui": "1.4.0",
65
+ "@effect/tsgo": "0.63.0",
66
+ "@effect/vitest": "4.1.1",
55
67
  "@types/bun": "latest",
56
68
  "oxfmt": "^0.63.0",
57
- "oxlint": "1.82.0",
58
- "oxlint-tsgolint": "7.0.2001",
69
+ "oxlint": "1.90.0",
70
+ "oxlint-tsgolint": "7.0.2005",
59
71
  "typescript": "7.0.2",
60
- "vitest": "^4.1.10"
72
+ "vitest": "^5.0.5"
61
73
  },
62
74
  "peerDependencies": {
63
75
  "@earendil-works/pi-ai": "*",
@@ -6,11 +6,14 @@ import { TodoItem, TodoList } from "../core/domain.ts";
6
6
  interface ItemSpec {
7
7
  readonly id: number;
8
8
  readonly done: boolean;
9
- readonly text?: string;
9
+ readonly title?: string;
10
10
  readonly deps?: readonly string[];
11
11
  }
12
12
 
13
- const completion = (items: readonly ItemSpec[], completedItemIds: readonly number[]): PendingCompletion => {
13
+ const completion = (
14
+ items: readonly ItemSpec[],
15
+ completedItemIds: readonly number[],
16
+ ): PendingCompletion => {
14
17
  const list = new TodoList({
15
18
  id: 1,
16
19
  name: "Work",
@@ -18,7 +21,7 @@ const completion = (items: readonly ItemSpec[], completedItemIds: readonly numbe
18
21
  (item) =>
19
22
  new TodoItem({
20
23
  id: item.id,
21
- text: item.text ?? `item ${item.id}`,
24
+ title: item.title ?? `item ${item.id}`,
22
25
  done: item.done,
23
26
  deps: [...(item.deps ?? [])],
24
27
  }),
@@ -131,9 +134,9 @@ it("selectCandidates carries the completed batch as prior work", () => {
131
134
  const candidate = first(
132
135
  completion(
133
136
  [
134
- { id: 1, done: true, text: "first" },
135
- { id: 3, done: true, text: "third" },
136
- { id: 4, done: false, text: "fourth", deps: ["Work:3"] },
137
+ { id: 1, done: true, title: "first" },
138
+ { id: 3, done: true, title: "third" },
139
+ { id: 4, done: false, title: "fourth", deps: ["Work:3"] },
137
140
  ],
138
141
  [1, 3],
139
142
  ),
@@ -1,4 +1,5 @@
1
1
  import { dependentsOf, formatItemRef, readiness } from "../core/deps.ts";
2
+ import type { DeclaredProduct, DeclaredReference } from "../core/domain.ts";
2
3
  import type { PendingCompletion } from "./completion.ts";
3
4
 
4
5
  /** Why the candidate was chosen; the classifier question is keyed by this. */
@@ -8,6 +9,8 @@ export type CandidateClass = "dependent-successor" | "ready-queue";
8
9
  export interface CompletedItem {
9
10
  readonly ref: string;
10
11
  readonly text: string;
12
+ /** The item's description, when it carries one. Part of the batch text. */
13
+ readonly description?: string;
11
14
  }
12
15
 
13
16
  /** The single next unfinished item, with the batch as referenced prior work. */
@@ -15,9 +18,16 @@ export interface CompactionCandidate {
15
18
  readonly class: CandidateClass;
16
19
  readonly listName: string;
17
20
  readonly id: number;
21
+ /** The item's title. */
18
22
  readonly text: string;
23
+ /** The item's description, when it carries one. */
24
+ readonly description?: string;
19
25
  /** Every item completed since the last decision. Never the subject. */
20
26
  readonly completed: readonly CompletedItem[];
27
+ /** The item's declared references, when it carries any. */
28
+ readonly refs?: readonly DeclaredReference[];
29
+ /** The item's declared products, when it carries any. */
30
+ readonly produces?: readonly DeclaredProduct[];
21
31
  }
22
32
 
23
33
  /**
@@ -40,7 +50,16 @@ export const selectCandidates = (
40
50
  const completedIds = new Set(completion.completedItemIds);
41
51
  const completed: CompletedItem[] = completion.completedItemIds.flatMap((id) => {
42
52
  const item = list.items.find((candidate) => candidate.id === id);
43
- return item === undefined ? [] : [{ ref: formatItemRef(list.name, id), text: item.text }];
53
+ if (item === undefined) return [];
54
+ return [
55
+ {
56
+ ref: formatItemRef(list.name, id),
57
+ text: item.title,
58
+ ...(item.description === undefined || item.description.length === 0
59
+ ? {}
60
+ : { description: item.description }),
61
+ },
62
+ ];
44
63
  });
45
64
 
46
65
  // The completed items were selected because the candidate depends on one of
@@ -55,7 +74,18 @@ export const selectCandidates = (
55
74
 
56
75
  const make = (index: number, cls: CandidateClass): CompactionCandidate => {
57
76
  const item = list.items[index]!;
58
- return { class: cls, listName: list.name, id: item.id, text: item.text, completed };
77
+ return {
78
+ class: cls,
79
+ listName: list.name,
80
+ id: item.id,
81
+ text: item.title,
82
+ ...(item.description === undefined || item.description.length === 0
83
+ ? {}
84
+ : { description: item.description }),
85
+ completed,
86
+ ...(item.refs.length === 0 ? {} : { refs: item.refs }),
87
+ ...(item.produces.length === 0 ? {} : { produces: item.produces }),
88
+ };
59
89
  };
60
90
 
61
91
  const ordered: CompactionCandidate[] = [];