@eliya-oss/agent-diff 0.1.0-alpha.134 → 0.1.0-alpha.136

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,275 @@
1
+ ---
2
+ name: release-notes
3
+ description: Write the change intent, the PR description and the release note for a change to adiff. Use when opening a PR here, when adding or editing a file in .changeset/, when asked to fix up a PR body or a release note, or when deciding whether a change is worth a release at all.
4
+ ---
5
+
6
+ # Release notes for adiff
7
+
8
+ Every release note in this repo comes from one place: a change intent file in `.changeset/`.
9
+ `scripts/changelog.ts` reads those files, groups them, and writes `CHANGELOG.md` and the text on
10
+ the GitHub release page. Nothing else is edited by hand — do not edit `CHANGELOG.md` yourself.
11
+
12
+ A reader of a release note wants two things in this order: **which part of adiff changed**, and
13
+ **what it does now**. Give them that in one sentence. Everything else goes behind a fold.
14
+
15
+ ## Does this change deserve a release at all?
16
+
17
+ Only four kinds of change ship a note:
18
+
19
+ | Kind | Write it as | Lands under |
20
+ | --- | --- | --- |
21
+ | Something adiff could not do before | `feat(area): …` | `### Added` |
22
+ | Something adiff did wrong | `fix(area): …` | `### Fixed` |
23
+ | Something measurably faster or smaller | `perf(area): …` | `### Performance` |
24
+ | Something that changes what an existing command or key means | `breaking(area): …` | `### Breaking` |
25
+
26
+ **A refactor, a test, a doc, a CI change or a rename gets no change intent file.** No file, no
27
+ version bump, no note. If the change is invisible to a reviewer using adiff, it is invisible in the
28
+ changelog too. Say so in the PR body instead. A PR that touches only `src/testing/`, `.agents/`,
29
+ `.github/`, `README.md` or `ARCHITECTURE.md` almost never needs one.
30
+
31
+ If you are unsure, ask: would someone who upgraded notice? If no, no file.
32
+
33
+ ## The shape of a change intent
34
+
35
+ `.changeset/<name>.md`. Name it the way you would name the test: the sentence, kebab-cased, no
36
+ gerund — `a-file-with-an-accent.md`, not `keeping-a-file-with-an-accent.md`. The bump is `patch`
37
+ until this reaches 1.0, whatever the kind says.
38
+
39
+ **Do not copy a neighbouring file as a model.** Most of `.changeset/` predates this format and is
40
+ free prose with a gerund name. The test only holds intents that have not shipped yet to the shape,
41
+ which is why the old ones still pass. Follow this page, not the file next to yours.
42
+
43
+ ```markdown
44
+ ---
45
+ "@eliya-oss/agent-diff": patch
46
+ ---
47
+
48
+ fix(layers rail): the cursor stays on the rail when you collapse the layer you are reading.
49
+
50
+ <details><summary>What was wrong</summary>
51
+
52
+ Collapsing took the cursor off the whole rail — nothing said where you were, and the layer read
53
+ like one you had not started.
54
+
55
+ </details>
56
+ ```
57
+
58
+ which renders as:
59
+
60
+ ```markdown
61
+ ## 0.1.0-alpha.132
62
+
63
+ ### Fixed
64
+
65
+ - **Layers rail** — the cursor stays on the rail when you collapse the layer you are reading.
66
+
67
+ <details><summary>What was wrong</summary>
68
+ …
69
+ </details>
70
+ ```
71
+
72
+ Rules the generator and `a-changelog-that-says-what-kind-of-change.test.ts` enforce:
73
+
74
+ - The first line of every entry is `kind(area): one sentence.` — a full stop at the end, no
75
+ capital at the start, no line break inside it.
76
+ - `kind` is exactly one of `feat`, `fix`, `perf`, `breaking`.
77
+ - `area` is lowercase, and is capitalised for you when it is rendered. Write `CLI` and `README` in
78
+ the case you want them.
79
+ - Anything between one entry and the next belongs to the entry above it, and is indented under its
80
+ bullet.
81
+
82
+ ## One entry per thing that changed
83
+
84
+ A PR that fixes five things writes **five entries in one file**, not one paragraph covering five.
85
+ This is the single biggest difference from how this repo used to write notes.
86
+
87
+ ```markdown
88
+ fix(layers rail): the cursor stays on the rail when you collapse the layer you are reading.
89
+
90
+ <details>…</details>
91
+
92
+ fix(reading order): a first layer naming no file in the diff opens at the first file, not the last.
93
+
94
+ <details>…</details>
95
+ ```
96
+
97
+ Each one gets its own bullet, under the right heading, and can be found by someone searching for
98
+ the part of adiff it names.
99
+
100
+ ## Naming the area
101
+
102
+ Use the name a reviewer would use for the thing on screen. The ones already in use:
103
+
104
+ `diff` · `file tree` · `layers` · `layers rail` · `reading order` · `review panel` · `footer` ·
105
+ `marks` · `keys` · `search` · `key sheet` · `command palette` · `home screen` · `comment delivery` ·
106
+ `store` · `preferences` · `upgrade` · `CLI` · `changelog`
107
+
108
+ Reuse one before inventing another, and check `.agents/prd/CONTEXT.md` — never invent a word the
109
+ glossary already has.
110
+
111
+ ## The sentence
112
+
113
+ Write what is true **now**, in the present tense, from the reviewer's side of the screen.
114
+
115
+ - `fix(diff): a binary file says it is binary instead of drawing an empty pane.`
116
+ - `feat(search): typing narrows the matches as you type.`
117
+ - `perf(review): opening a 131-file branch takes 1.5s, down from 2.85s.`
118
+
119
+ Not:
120
+
121
+ - ~~`fix(diff): fixed the binary file handling`~~ — says nothing about what a reader will see.
122
+ - ~~`fix(diff): refactored patch parsing so binary blobs short-circuit`~~ — describes the code.
123
+ - ~~`fix(diff): a binary file that adiff cannot show`~~ — a title, not a statement.
124
+
125
+ **No gerund titles.** "Saying what is not there", "Opening onto one branch", "Asking before
126
+ leaving" are all wrong. Write a statement with a verb in it: "a file with no newline says so".
127
+ This holds for the sentence, the branch name, the changeset filename, the PR title and the test
128
+ filename.
129
+
130
+ For `perf`, give both numbers and what they were measured on. A speed claim with no measurement is
131
+ not a release note.
132
+
133
+ ## What goes behind the fold
134
+
135
+ The `<details>` block is for the reader who hits the bug and wants to know it is the one they hit.
136
+ Put the symptom there, in the words someone would use to describe what they saw. Keep it to a
137
+ paragraph or two.
138
+
139
+ Leave it out entirely when the sentence is the whole story — most `feat` entries need nothing.
140
+
141
+ Do not put in it: the file you changed, the function you added, the test you wrote, a count of
142
+ tests, or how long it took you. Those belong in the PR.
143
+
144
+ ## The PR description
145
+
146
+ ### The template
147
+
148
+ ```markdown
149
+ One paragraph. What this changes, and what prompted it. Two or three sentences.
150
+
151
+ ## What changed
152
+
153
+ ### Fixed
154
+
155
+ - **Layers rail** — the cursor stays on the rail when you collapse the layer you are reading.
156
+ - **Reading order** — a first layer naming no file in the diff opens at the first file, not the last.
157
+
158
+ ### Added
159
+
160
+ - **Search** — typing narrows the matches as you type.
161
+
162
+ ## The rail lost the cursor when you folded the layer you were in
163
+
164
+ The repro, as keys to press. Then what the fix was.
165
+
166
+ <table>
167
+ <tr><th>Before</th><th>After</th></tr>
168
+ <tr>
169
+ <td><img src="https://github.com/user-attachments/assets/…" alt="before"></td>
170
+ <td><img src="https://github.com/user-attachments/assets/…" alt="after"></td>
171
+ </tr>
172
+ </table>
173
+
174
+ ## Reading order opened at the end
175
+
176
+ The repro. Then what the fix was.
177
+ ```
178
+
179
+ - The **title** is the entry sentence without the `kind(area):` prefix, and follows the same
180
+ no-gerund rule.
181
+ - **`## What changed` is generated, never typed.** `node scripts/pr-summary.ts` prints it from the
182
+ change intents on this branch. The PR and the changelog then cannot drift apart. Commit the
183
+ intent first — the summary is read from the diff against `origin/main`, so an uncommitted file
184
+ is not on the branch yet and the script will say there is nothing to paste.
185
+ - **One `##` section per thing changed**, in the order the bullets list them, titled with the
186
+ symptom rather than the fix. That is what a reader searching their own bug will match on.
187
+ - A PR with **one entry and nothing to reproduce** is a title and a sentence. The template starts
188
+ earning its keep at two. This is about the `##` sections, not about the pictures: a single-entry
189
+ PR that changes a screen still owes a before and an after.
190
+ - A PR with **no change intent** — a refactor, a test, a doc — writes prose. `pnpm pr-summary`
191
+ will tell you there is nothing to paste, and that is the correct answer, not a problem to fix.
192
+
193
+ ### What never goes in a PR body
194
+
195
+ - **Raw command output.** No `ls` listings, no shell transcripts, no stack traces pasted whole.
196
+ Quote the one line that matters.
197
+ - **Backticks around anything a shell would run.** Writing a body in a heredoc executes
198
+ `` `l` `` and pastes its output into your prose. Write the body to a file, then
199
+ `gh pr create --body-file`.
200
+ - **Test counts, timings, or self-assessment.** No "full suite green", no "740 tests", no
201
+ "verified twice". CI says whether the tests pass.
202
+ - **Anything from a private repository.** See below.
203
+
204
+ ### Nothing private, ever
205
+
206
+ This repository is public, and so is every PR body, screenshot and recording attached to it. Before
207
+ you open or edit a PR, read what you wrote and confirm none of it carries:
208
+
209
+ - an employer's or a customer's name, or a private repository's name
210
+ - a ticket id, an internal URL, a dashboard link, or an internal hostname
211
+ - a real branch name, file path, or line of source from private work
212
+ - a colleague's name or address, or any credential, token or key
213
+
214
+ A screenshot leaks all of this faster than prose does, which is why **every capture runs against the
215
+ synthetic demo repository** — `scripts/simulate.ts` builds a repo of invented invitation code with
216
+ invented branch names. Never screenshot a review of real work. If you cannot reproduce a bug on the
217
+ synthetic repo, describe it instead, or seed what you need in `scripts/simulation/seed.ts`.
218
+
219
+ An attachment cannot be deleted once uploaded. There is no public deletion API for
220
+ user-attachments, so a leak is permanent.
221
+
222
+ ### Showing a screen
223
+
224
+ adiff is a terminal, so a screenshot is a real PNG of a real terminal, captured with
225
+ [terminal-control](https://github.com/anomalyco/terminal-control) and uploaded to GitHub's
226
+ attachment store.
227
+
228
+ ```bash
229
+ cargo install --locked terminal-control # once
230
+ gh extension install drogers0/gh-image # once, then `gh image check-token`
231
+ ```
232
+
233
+ **Something new** gets one image:
234
+
235
+ ```bash
236
+ pnpm shot --keys "enter text:l" --label "a layer opened"
237
+ ```
238
+
239
+ **Something that changed** gets a before and an after, in a one-row table so the two sit side by
240
+ side rather than a screen apart:
241
+
242
+ ```bash
243
+ pnpm shot --keys "enter text:l" --label "the layers rail" --against origin/main
244
+ ```
245
+
246
+ `--against` builds a worktree at the merge base, captures the same keystrokes on the code as it was,
247
+ and prints the finished `<table>` with both images uploaded. Paste it under the section it belongs
248
+ to. If the two frames come out identical the script says so and stops — those keys do not reach the
249
+ screen you changed.
250
+
251
+ **Something about motion** — scroll feel, focus moving, a gap opening ten lines at a time — gets a
252
+ recording, because a still frame cannot show it:
253
+
254
+ ```bash
255
+ pnpm shot --keys "enter text:l text:l text:l" --label "the gap opening" --video
256
+ ```
257
+
258
+ That prints a bare URL. Leave it bare: GitHub wraps a player around a user-attachments URL on its
259
+ own line, and `![…](…)` image markdown around a video renders nothing.
260
+
261
+ Keys are termctrl's: `enter`, `escape`, `tab`, `up`, `down`, `page-up`, `ctrl-a` through `ctrl-z`,
262
+ and `text:<value>` for anything typed, including single letters like `text:l`. Add `--keep` to leave
263
+ the files in `shots/` instead of deleting them after upload.
264
+
265
+ ## Before you open the PR
266
+
267
+ ```bash
268
+ node scripts/changelog.ts # rewrites CHANGELOG.md from every change intent
269
+ node scripts/changelog.ts 0.1.0-alpha.133 # prints one release's note, as the release page shows it
270
+ node scripts/pr-summary.ts # prints the `## What changed` block for this branch
271
+ ```
272
+
273
+ `CHANGELOG.md` is regenerated by the release workflow, so it does not need to be committed with the
274
+ change intent — but run the generator and read the output. If your entry looks wrong there, it will
275
+ look wrong on the release page.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.136
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(layers rail): the wheel keeps working after a flick, and moves one file per notch.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ The guard that stopped a trackpad flick running on past the gesture was never cleared when a move failed, so after one bad load the rail stopped answering the wheel entirely. It is cleared whatever happens now, and a notch that arrives mid-load is remembered rather than thrown away, so movement keeps up with the gesture instead of dropping out of it.
12
+
13
+ The wheel was also registered twice over the file list — once on the pane and once on the text inside it — so a single notch moved two files.
14
+
15
+ </details>
16
+
17
+ perf(diff): the diff is not handed to the highlighter again when only the pane width changed.
18
+
19
+ <details><summary>What was wrong</summary>
20
+
21
+ Toggling the review panel reassigned the code pane's contents even though the text was identical, which starts a fresh parse and draws the file unhighlighted until it finishes.
22
+
23
+ </details>
24
+
25
+ - fix(key sheet): `?` fills the screen and lays the keys out in two columns under their section headings.
26
+
27
+ <details><summary>What was wrong</summary>
28
+
29
+ Fifty keys were drawn in one narrow column the same size and shape as the command palette, so it scrolled even on a tall terminal and the category was repeated on every row instead of heading a section. The two columns fit most of the sheet at once, the headings say what each group is, and the space the repeated category took goes to the descriptions, which were being cut mid-word.
30
+
31
+ </details>
32
+
33
+ - fix(review panel): opening the panel puts the keys on it, and closing gives them back to the pane you came from.
34
+
35
+ <details><summary>What was wrong</summary>
36
+
37
+ `a` opened the panel and left the keys wherever they were, so the comments you had just asked to see could not be moved through without a second press of `tab`. Closing it sent the keys to the diff whatever you had been reading before, so opening and closing the panel quietly moved you off the file list. The panel is left alone when there is nothing in it to read.
38
+
39
+ </details>
40
+
41
+ ## 0.1.0-alpha.135
42
+
43
+ ### Patch Changes
44
+
45
+ - feat(changelog): a release note groups what changed under Breaking, Added, Fixed and Performance, and names the part of adiff each entry is about.
46
+
47
+ <details><summary>What it looked like before</summary>
48
+
49
+ A release was a run of paragraphs. Five fixes in one pull request arrived as one story, with no way to tell a fix from a new behaviour, or to find the part of adiff a line was about without reading all of it.
50
+
51
+ </details>
52
+
53
+ - fix(review panel): a thread says whether the agent has actually picked your comment up.
54
+
55
+ <details><summary>What was wrong</summary>
56
+
57
+ Everything unanswered was filed under "With the agent", which claimed custody adiff had no way to know about. `comment take` returned everything still owed an answer and left no trace, so a comment sent a second ago, one an agent had been working on for ten minutes, and one on a branch where no agent has ever run were the same thing on screen. Threads sit under "Not picked up" until something collects them, and "Picked up, no answer" after.
58
+
59
+ </details>
60
+
61
+ fix(diff): a thread head says how long ago the comment was picked up.
62
+
63
+ <details><summary>What was wrong</summary>
64
+
65
+ Every unanswered thread read `sent`. A comment an agent collected and then went away without answering — the case worth noticing — looked exactly like one written a second ago. It reads `picked up 40m ago` now.
66
+
67
+ </details>
68
+
3
69
  ## 0.1.0-alpha.134
4
70
 
5
71
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9054,6 +9054,7 @@ var init_error$2 = __esmMin((() => {
9054
9054
  var emptyBranchState;
9055
9055
  var init_model$4 = __esmMin((() => {
9056
9056
  emptyBranchState = {
9057
+ taken: {},
9057
9058
  vouches: {},
9058
9059
  consumed: 0,
9059
9060
  settled: {},
@@ -9064,7 +9065,7 @@ var init_model$4 = __esmMin((() => {
9064
9065
  }));
9065
9066
  //#endregion
9066
9067
  //#region src/service/store/schema.ts
9067
- var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, Settings, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
9068
+ var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, Settings, Watching, UpgradeCheck, Prose, Code, StoredLayer, StoredLayers;
9068
9069
  var init_schema = __esmMin((() => {
9069
9070
  init_dist();
9070
9071
  Side = Literals(["old", "new"]);
@@ -9110,6 +9111,7 @@ var init_schema = __esmMin((() => {
9110
9111
  Counts = Record(String$1, Int);
9111
9112
  noStamps = withDecodingDefaultKey(succeed$1({}));
9112
9113
  BranchState = Struct({
9114
+ taken: optionalKey(Record(String$1, String$1)),
9113
9115
  vouches: Stamps.pipe(noStamps),
9114
9116
  consumed: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9115
9117
  settled: Stamps.pipe(noStamps),
@@ -9126,6 +9128,7 @@ var init_schema = __esmMin((() => {
9126
9128
  newestFirst: optionalKey(Boolean),
9127
9129
  hold: optionalKey(Boolean)
9128
9130
  });
9131
+ Watching = Struct({ lookedAt: String$1 });
9129
9132
  UpgradeCheck = Struct({
9130
9133
  note: optionalKey(String$1),
9131
9134
  checkedAt: optionalKey(String$1),
@@ -9158,7 +9161,7 @@ var init_schema = __esmMin((() => {
9158
9161
  }));
9159
9162
  //#endregion
9160
9163
  //#region src/service/store/paths.ts
9161
- var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, draftsPath, layersPath, settingsPath, upgradePath, reportsDir, reportPath;
9164
+ var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, watchPath, draftsPath, layersPath, settingsPath, upgradePath, reportsDir, reportPath;
9162
9165
  var init_paths = __esmMin((() => {
9163
9166
  NON_SLUG = /[^a-zA-Z0-9]+/g;
9164
9167
  slugOf = (worktreePath) => worktreePath.replace(NON_SLUG, "-");
@@ -9167,6 +9170,7 @@ var init_paths = __esmMin((() => {
9167
9170
  inboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "inbox.jsonl");
9168
9171
  outboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "outbox.jsonl");
9169
9172
  statePath = (root, worktreePath) => join(branchDir(root, worktreePath), "state.json");
9173
+ watchPath = (root, worktreePath) => join(branchDir(root, worktreePath), "watch.json");
9170
9174
  draftsPath = (root, worktreePath) => join(branchDir(root, worktreePath), "drafts.json");
9171
9175
  layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
9172
9176
  settingsPath = (root) => join(root, "settings.json");
@@ -9176,7 +9180,7 @@ var init_paths = __esmMin((() => {
9176
9180
  }));
9177
9181
  //#endregion
9178
9182
  //#region src/service/store/service.ts
9179
- var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$1, stale$1, stolen, taken, freed, alone, draftsOps, stateOps, makeStore, madeStore, storeAt;
9183
+ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$1, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
9180
9184
  var init_service$1 = __esmMin((() => {
9181
9185
  init_dist();
9182
9186
  init_error$2();
@@ -9255,6 +9259,7 @@ var init_service$1 = __esmMin((() => {
9255
9259
  asState = decoded(BranchState);
9256
9260
  asLayers = decoded(StoredLayers);
9257
9261
  asDrafts = decoded(Drafts);
9262
+ asWatching = decoded(Watching);
9258
9263
  linesOf = (raw) => raw.split("\n").filter((line) => line.trim().length > 0);
9259
9264
  readLines = (path, raw, as) => forEach(linesOf(raw), (line) => jsonOf$1(path, line).pipe(flatMap((value) => as(path, value))));
9260
9265
  parseSettings = fn("Store.parseSettings")(function* (path, raw) {
@@ -9271,8 +9276,16 @@ var init_service$1 = __esmMin((() => {
9271
9276
  parseLayers = fn("Store.parseLayers")(function* (path, raw) {
9272
9277
  return yield* asLayers(path, yield* jsonOf$1(path, raw));
9273
9278
  });
9274
- cursorOps = (state, inbox, spoken) => {
9275
- return { take: fn("Store.take")(function* (worktreePath) {
9279
+ idsIn$1 = (batches) => batches.flatMap((batch) => batch.comments.map((one) => one.id));
9280
+ takes = (ids, at) => (was) => ({
9281
+ ...was,
9282
+ taken: {
9283
+ ...Object.fromEntries(ids.map((id) => [id, at])),
9284
+ ...was.taken
9285
+ }
9286
+ });
9287
+ cursorOps = (state, inbox, spoken, changeState) => {
9288
+ const owedIn = fn("Store.owedIn")(function* (worktreePath) {
9276
9289
  const batches = yield* inbox(worktreePath);
9277
9290
  const current = yield* state(worktreePath);
9278
9291
  const answered = new Set((yield* spoken(worktreePath)).map((entry) => entry.comment));
@@ -9286,7 +9299,16 @@ var init_service$1 = __esmMin((() => {
9286
9299
  comments
9287
9300
  }];
9288
9301
  });
9289
- }) };
9302
+ });
9303
+ return {
9304
+ take: fn("Store.take")(function* (worktreePath, at) {
9305
+ const batches = yield* owedIn(worktreePath);
9306
+ const ids = idsIn$1(batches);
9307
+ if (ids.length > 0) yield* changeState(worktreePath, takes(ids, at));
9308
+ return batches;
9309
+ }),
9310
+ owed: owedIn
9311
+ };
9290
9312
  };
9291
9313
  settingsOps = (root) => {
9292
9314
  return {
@@ -9438,6 +9460,30 @@ var init_service$1 = __esmMin((() => {
9438
9460
  });
9439
9461
  freed = (path) => promise(() => rm(path, { force: true }));
9440
9462
  alone = (path, waiting, work) => acquireUseRelease(taken(path, waiting), () => work, () => freed(path));
9463
+ watchOps = (root, adopted) => {
9464
+ return {
9465
+ watching: fn("Store.watching")(function* (worktreePath) {
9466
+ const key = yield* keyIn(adopted, worktreePath);
9467
+ const path = watchPath(root, key);
9468
+ const raw = yield* readOptional(path);
9469
+ if (isNone(raw)) return none();
9470
+ const value = yield* jsonOf$1(path, raw.value);
9471
+ return some(yield* asWatching(path, value));
9472
+ }),
9473
+ noteWatching: fn("Store.noteWatching")(function* (worktreePath, at) {
9474
+ const key = yield* keyIn(adopted, worktreePath);
9475
+ const path = watchPath(root, key);
9476
+ yield* ensureDir(branchDir(root, key));
9477
+ yield* tryPromise({
9478
+ try: () => writeFile(path, JSON.stringify({ lookedAt: at }), "utf8"),
9479
+ catch: (cause) => new StoreUnwritable({
9480
+ path,
9481
+ reason: String(cause)
9482
+ })
9483
+ });
9484
+ })
9485
+ };
9486
+ };
9441
9487
  draftsOps = (root, adopted) => {
9442
9488
  const drafts = fn("Store.drafts")(function* (worktreePath) {
9443
9489
  const key = yield* keyIn(adopted, worktreePath);
@@ -9501,7 +9547,7 @@ var init_service$1 = __esmMin((() => {
9501
9547
  const { submit, inbox } = inboxOps(root, adopted);
9502
9548
  const { state, saveState, changeState } = stateOps(root, adopted);
9503
9549
  const talk = answerOps(root, adopted);
9504
- const cursors = cursorOps(state, inbox, talk.answers);
9550
+ const cursors = cursorOps(state, inbox, talk.answers, changeState);
9505
9551
  return {
9506
9552
  root,
9507
9553
  branchAt: (worktreePath) => promise(() => headOf$1(worktreePath)),
@@ -9515,6 +9561,7 @@ var init_service$1 = __esmMin((() => {
9515
9561
  ...upgradeOps(root),
9516
9562
  ...talk,
9517
9563
  ...layersOps(root, adopted),
9564
+ ...watchOps(root, adopted),
9518
9565
  ...draftsOps(root, adopted),
9519
9566
  ...cursors
9520
9567
  };
@@ -10286,7 +10333,7 @@ var init_commands = __esmMin((() => {
10286
10333
  findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
10287
10334
  waitingOn = fn("Cli.waitingOn")(function* (worktree) {
10288
10335
  const store = yield* Store;
10289
- const owed = yield* store.take(worktree.path);
10336
+ const owed = yield* store.owed(worktree.path);
10290
10337
  const told = yield* store.layers(worktree.path);
10291
10338
  return {
10292
10339
  unanswered: owed.reduce((total, batch) => total + batch.comments.length, 0),
@@ -10391,12 +10438,13 @@ var init_commands = __esmMin((() => {
10391
10438
  asks: entry.asks
10392
10439
  }))].toSorted((one, other) => one.at < other.at ? -1 : one.at > other.at ? 1 : 0);
10393
10440
  sentOf = (comment, replies, reading) => {
10394
- const { spoken, settled, removed, head, shown, read } = reading;
10441
+ const { spoken, settled, removed, head, shown, read, taken } = reading;
10395
10442
  const ids = /* @__PURE__ */ new Set([comment.id, ...replies.map((reply) => reply.id)]);
10396
10443
  const said = spoken.filter((entry) => ids.has(entry.comment));
10397
10444
  const seen = [...ids].reduce((total, id) => total + (read[id] ?? 0), 0);
10398
10445
  const spun = spunOf(replies, said);
10399
10446
  const last = spun.at(-1);
10447
+ const takenAt = [...ids].flatMap((id) => taken[id] ?? []).toSorted().at(-1);
10400
10448
  return {
10401
10449
  id: comment.id,
10402
10450
  file: comment.file,
@@ -10410,6 +10458,7 @@ var init_commands = __esmMin((() => {
10410
10458
  outside: !shown.has(comment.file),
10411
10459
  unread: Math.max(0, said.length - seen),
10412
10460
  asks: last?.voice === "agent" && last.asks,
10461
+ ...takenAt === void 0 ? {} : { takenAt },
10413
10462
  answers: said.map(bodyOf),
10414
10463
  turns: spun.map((turn) => ({
10415
10464
  voice: turn.voice,
@@ -10431,7 +10480,8 @@ var init_commands = __esmMin((() => {
10431
10480
  removed: current.removed,
10432
10481
  head: worktree.head,
10433
10482
  shown,
10434
- read: current.read
10483
+ read: current.read,
10484
+ taken: current.taken ?? {}
10435
10485
  };
10436
10486
  const under = (comment) => replies.filter((reply) => reply.replyTo === comment.id);
10437
10487
  return held.filter((comment) => comment.replyTo === void 0).map((comment) => sentOf(comment, under(comment), conversation));
@@ -10539,7 +10589,9 @@ var init_commands = __esmMin((() => {
10539
10589
  takeComments = fn("Cli.takeComments")(function* (worktree) {
10540
10590
  const store = yield* Store;
10541
10591
  const resolved = yield* realOf(worktree);
10542
- const owed = flatten(yield* store.take(resolved));
10592
+ const at = (/* @__PURE__ */ new Date()).toISOString();
10593
+ yield* ignore(store.noteWatching(resolved, at));
10594
+ const owed = flatten(yield* store.take(resolved, at));
10543
10595
  if (owed.every((one) => one.replyTo === void 0)) return owed;
10544
10596
  const held = flatten(yield* store.inbox(resolved));
10545
10597
  const spoken = yield* store.answers(resolved);
@@ -11046,7 +11098,7 @@ var init_pane = __esmMin((() => {
11046
11098
  init_drafts();
11047
11099
  init_init();
11048
11100
  init_pane();
11049
- var version$1 = "0.1.0-alpha.134";
11101
+ var version$1 = "0.1.0-alpha.136";
11050
11102
  //#endregion
11051
11103
  //#region src/cli/upgrade.ts
11052
11104
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -11757,6 +11809,7 @@ var init_threads = __esmMin((() => {
11757
11809
  asks: request.asks,
11758
11810
  at: request.at
11759
11811
  });
11812
+ yield* ignore(store.noteWatching(worktree.path, request.at));
11760
11813
  return { answered: (yield* store.answers(worktree.path)).filter((entry) => entry.comment === request.id).length };
11761
11814
  });
11762
11815
  settleIn = fn("Cli.settleIn")(function* (worktree, id, at) {
@@ -13079,7 +13132,7 @@ var init_tree = __esmMin((() => {
13079
13132
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13080
13133
  };
13081
13134
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13082
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13135
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13083
13136
  var init_model = __esmMin((() => {
13084
13137
  init_dist();
13085
13138
  init_patch();
@@ -13100,7 +13153,9 @@ var init_model = __esmMin((() => {
13100
13153
  tallest: 0,
13101
13154
  scroll: -1,
13102
13155
  railRows: 12,
13103
- railScroll: -1
13156
+ railScroll: -1,
13157
+ now: 0,
13158
+ focusWas: "diff"
13104
13159
  };
13105
13160
  initialState = (branches) => ({
13106
13161
  ...nothingReviewed,
@@ -13408,16 +13463,27 @@ var init_model = __esmMin((() => {
13408
13463
  more: rows.length - (start + height)
13409
13464
  };
13410
13465
  };
13466
+ MINUTE = 6e4;
13467
+ HOUR = 60 * MINUTE;
13468
+ DAY = 24 * HOUR;
13469
+ sinceThen = (at, now = Date.now()) => {
13470
+ const gap = now - Date.parse(at);
13471
+ if (!Number.isFinite(gap) || gap < MINUTE) return "just now";
13472
+ if (gap < HOUR) return `${Math.floor(gap / MINUTE)}m ago`;
13473
+ if (gap < DAY) return `${Math.floor(gap / HOUR)}h ago`;
13474
+ return `${Math.floor(gap / DAY)}d ago`;
13475
+ };
13411
13476
  threadStand = (thread) => {
13412
13477
  if (thread.removed === true) return "gone";
13413
13478
  if (thread.settled === true) return "settled";
13414
13479
  if (thread.asks === true) return "asked";
13415
- if (spokeLast(thread) === "reviewer") return "waiting";
13416
- return answersIn(thread) > 0 ? "answered" : "waiting";
13480
+ if (spokeLast(thread) === "agent" && answersIn(thread) > 0) return "answered";
13481
+ return thread.takenAt === void 0 ? "filed" : "waiting";
13417
13482
  };
13418
13483
  STAND_WEIGHT = {
13419
13484
  gone: 0,
13420
13485
  settled: 1,
13486
+ filed: 2,
13421
13487
  waiting: 2,
13422
13488
  answered: 3,
13423
13489
  asked: 4
@@ -13635,6 +13701,7 @@ var init_model = __esmMin((() => {
13635
13701
  answerCount = (comments) => comments.reduce((total, entry) => total + (entry.answers?.length ?? 0), 0);
13636
13702
  PANEL_SECTIONS = [
13637
13703
  "asked",
13704
+ "filed",
13638
13705
  "with",
13639
13706
  "answered",
13640
13707
  "settled",
@@ -13649,6 +13716,7 @@ var init_model = __esmMin((() => {
13649
13716
  };
13650
13717
  spokeLast = (comment) => comment.turns?.at(-1)?.voice;
13651
13718
  SECTION_OF = {
13719
+ filed: "filed",
13652
13720
  gone: "removed",
13653
13721
  settled: "settled",
13654
13722
  asked: "asked",
@@ -14579,7 +14647,7 @@ var init_command = __esmMin((() => {
14579
14647
  }));
14580
14648
  //#endregion
14581
14649
  //#region src/tui/match.ts
14582
- var subsequence, label, matches, closeness, searchCommands, searchGlossary;
14650
+ var subsequence, label, matches, closeness, searchCommands, byCategory, searchGlossary;
14583
14651
  var init_match = __esmMin((() => {
14584
14652
  init_command();
14585
14653
  subsequence = (haystack, needle) => {
@@ -14602,7 +14670,16 @@ var init_match = __esmMin((() => {
14602
14670
  return label(entry).includes(wanted) ? 3 : 4;
14603
14671
  };
14604
14672
  searchCommands = (screen, query) => listableFor(screen).filter((entry) => matches(entry, query)).toSorted((left, right) => closeness(left, query) - closeness(right, query));
14605
- searchGlossary = (screen, query) => glossaryFor(screen).filter((entry) => matches(entry, query)).toSorted((left, right) => closeness(left, query) - closeness(right, query));
14673
+ byCategory = (screen) => {
14674
+ const seen = /* @__PURE__ */ new Map();
14675
+ for (const entry of glossaryFor(screen)) if (!seen.has(entry.category)) seen.set(entry.category, seen.size);
14676
+ return seen;
14677
+ };
14678
+ searchGlossary = (screen, query) => {
14679
+ const order = byCategory(screen);
14680
+ const placed = (entry) => order.get(entry.category) ?? order.size;
14681
+ return glossaryFor(screen).filter((entry) => matches(entry, query)).toSorted((left, right) => closeness(left, query) - closeness(right, query) || placed(left) - placed(right));
14682
+ };
14606
14683
  }));
14607
14684
  //#endregion
14608
14685
  //#region src/tui/reduce.ts
@@ -14828,12 +14905,20 @@ var init_reduce = __esmMin((() => {
14828
14905
  };
14829
14906
  togglePanel = (state) => {
14830
14907
  if (!panelFits(state)) return withNotice(state, "the terminal is too narrow for the review panel");
14831
- const panelOpen = !state.panelOpen;
14908
+ if (state.panelOpen) return {
14909
+ ...state,
14910
+ panelOpen: false,
14911
+ panelWas: false,
14912
+ focus: state.focus === "review" ? state.focusWas : state.focus,
14913
+ panelIndex: 0
14914
+ };
14915
+ const worthReading = panelEntries(state).length > 0;
14832
14916
  return {
14833
14917
  ...state,
14834
- panelOpen,
14835
- panelWas: panelOpen,
14836
- focus: panelOpen ? state.focus : "diff",
14918
+ panelOpen: true,
14919
+ panelWas: true,
14920
+ focus: worthReading ? "review" : state.focus,
14921
+ focusWas: state.focus,
14837
14922
  panelIndex: 0
14838
14923
  };
14839
14924
  };
@@ -15431,7 +15516,8 @@ var init_marks = __esmMin((() => {
15431
15516
  };
15432
15517
  ring = {
15433
15518
  ...shared,
15434
- waiting: "○",
15519
+ filed: "○",
15520
+ waiting: "◔",
15435
15521
  answered: "◐",
15436
15522
  asked: "●",
15437
15523
  rule: "│"
@@ -15440,7 +15526,8 @@ var init_marks = __esmMin((() => {
15440
15526
  ring,
15441
15527
  bubble: {
15442
15528
  ...shared,
15443
- waiting: "◌",
15529
+ filed: "◌",
15530
+ waiting: "◔",
15444
15531
  answered: "◑",
15445
15532
  asked: "◗",
15446
15533
  rule: "┃",
@@ -15448,21 +15535,24 @@ var init_marks = __esmMin((() => {
15448
15535
  },
15449
15536
  quote: {
15450
15537
  ...shared,
15451
- waiting: "❞",
15538
+ filed: "❞",
15539
+ waiting: "❟",
15452
15540
  answered: "❠",
15453
15541
  asked: "❝",
15454
15542
  rule: "┊"
15455
15543
  },
15456
15544
  diamond: {
15457
15545
  ...shared,
15458
- waiting: "◇",
15546
+ filed: "◇",
15547
+ waiting: "◊",
15459
15548
  answered: "◈",
15460
15549
  asked: "◆",
15461
15550
  rule: "╎"
15462
15551
  },
15463
15552
  dot: {
15464
15553
  ...shared,
15465
- waiting: "○",
15554
+ filed: "○",
15555
+ waiting: "◔",
15466
15556
  answered: "◉",
15467
15557
  asked: "●",
15468
15558
  rule: "▏"
@@ -15475,6 +15565,7 @@ var init_marks = __esmMin((() => {
15475
15565
  };
15476
15566
  marks = () => chosen;
15477
15567
  STAND_KEY = {
15568
+ filed: "filed",
15478
15569
  waiting: "waiting",
15479
15570
  answered: "answered",
15480
15571
  asked: "asked",
@@ -15573,6 +15664,7 @@ var init_diffview = __esmMin((() => {
15573
15664
  init_dist();
15574
15665
  init_patch();
15575
15666
  init_marks();
15667
+ init_model();
15576
15668
  init_theme();
15577
15669
  WASH = {
15578
15670
  added: {
@@ -15643,6 +15735,7 @@ var init_diffview = __esmMin((() => {
15643
15735
  pinned;
15644
15736
  pinBox;
15645
15737
  pinnedText = "";
15738
+ fed = "";
15646
15739
  newLit = [];
15647
15740
  oldLit = [];
15648
15741
  newFor = "";
@@ -15856,7 +15949,11 @@ var init_diffview = __esmMin((() => {
15856
15949
  }
15857
15950
  feed() {
15858
15951
  const spans = [...noteSpans(this.display, this.held), ...this.pickedSpans()];
15859
- this.code.content = textAt(this.display, this.held, this.hidden());
15952
+ const text = textAt(this.display, this.held, this.hidden());
15953
+ if (text !== this.fed) {
15954
+ this.fed = text;
15955
+ this.code.content = text;
15956
+ }
15860
15957
  this.code.onHighlight = (highlights) => {
15861
15958
  return [...(this.ownSpans() ?? highlights).filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
15862
15959
  };
@@ -16139,7 +16236,8 @@ var init_diffview = __esmMin((() => {
16139
16236
  if (note.asks) return `${marks().asked} asked back${moved}`;
16140
16237
  if (note.turns.at(-1)?.voice === "reviewer") return `${marks().waiting} replied${moved}`;
16141
16238
  if (note.answers.length > 0) return `${marks().answered} answered${moved}`;
16142
- return `${marks().sent} sent${moved}`;
16239
+ if (note.takenAt === void 0) return `${marks().sent} sent${moved}`;
16240
+ return `${marks().waiting} picked up ${sinceThen(note.takenAt, note.now)}${moved}`;
16143
16241
  };
16144
16242
  spokenLines = (body, room, mark) => {
16145
16243
  return wrap(body.replaceAll("\n", " "), Math.max(NOTE_MIN, room - 2)).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
@@ -16255,7 +16353,7 @@ var init_diffview = __esmMin((() => {
16255
16353
  }));
16256
16354
  //#endregion
16257
16355
  //#region src/tui/render.ts
16258
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16356
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16259
16357
  var init_render = __esmMin((() => {
16260
16358
  init_dist();
16261
16359
  init_command();
@@ -16282,10 +16380,9 @@ var init_render = __esmMin((() => {
16282
16380
  PALETTE_GAP = 2;
16283
16381
  PALETTE_CHROME = 4;
16284
16382
  PENDING_CHROME = 4;
16285
- keysTitle = (found, shown) => {
16383
+ keysTitle = (found, whole) => {
16286
16384
  if (found === 0) return "No key matches";
16287
- if (found <= shown) return `Keys here, ${found} of them`;
16288
- return `Keys here, ${found} of them — arrows for the rest`;
16385
+ return whole ? `Keys here, ${found} of them` : `Keys here, ${found} of them — arrows for the rest`;
16289
16386
  };
16290
16387
  PALETTE_WIDTH = 76;
16291
16388
  PANEL_SHARE = .62;
@@ -16555,6 +16652,73 @@ var init_render = __esmMin((() => {
16555
16652
  });
16556
16653
  return new StyledText(drawn);
16557
16654
  };
16655
+ SHEET_GAP = 3;
16656
+ sheetRow = (entry, room) => {
16657
+ return `${clip(keysOf(entry), 9).padEnd(PALETTE_KEY)}${clip(entry.title, Math.max(1, room - PALETTE_KEY))}`;
16658
+ };
16659
+ groupedBy = (rows) => {
16660
+ const groups = [];
16661
+ for (const [at, entry] of rows.entries()) {
16662
+ const last = groups.at(-1);
16663
+ if (last !== void 0 && rows[last[0] ?? 0]?.category === entry.category && last !== void 0) last.push(at);
16664
+ else groups.push([at]);
16665
+ }
16666
+ return groups;
16667
+ };
16668
+ sheetBlock = (rows, group, room) => [
16669
+ {
16670
+ text: rows[group[0] ?? 0]?.category ?? "",
16671
+ at: -1,
16672
+ heading: true
16673
+ },
16674
+ ...group.map((at) => ({
16675
+ text: sheetRow(rows[at], room),
16676
+ at,
16677
+ heading: false
16678
+ })),
16679
+ {
16680
+ text: "",
16681
+ at: -1,
16682
+ heading: false
16683
+ }
16684
+ ];
16685
+ splitInTwo = (blocks) => {
16686
+ const total = blocks.reduce((sum, block) => sum + block.length, 0);
16687
+ const left = [];
16688
+ const right = [];
16689
+ for (const block of blocks) if (left.length + block.length <= Math.ceil(total / 2) || left.length === 0) left.push(...block);
16690
+ else right.push(...block);
16691
+ return {
16692
+ left,
16693
+ right
16694
+ };
16695
+ };
16696
+ sheetPaint = (row, here, room) => {
16697
+ if (row === void 0) return fg(palette.ink)("".padEnd(room));
16698
+ const text = `${row.heading || row.at === -1 ? " " : here ? marks().cursor : " "} ${row.text}`.padEnd(room);
16699
+ if (row.heading) return fg(palette.accent)(text);
16700
+ return here ? bg(palette.selection)(fg(palette.ink)(text)) : fg(palette.ink)(text);
16701
+ };
16702
+ sheetDeep = (rows, room) => {
16703
+ const column = Math.max(12, Math.floor((room - SHEET_GAP) / 2));
16704
+ const { left, right } = splitInTwo(groupedBy(rows).map((group) => sheetBlock(rows, group, column - 2)));
16705
+ return Math.max(left.length, right.length);
16706
+ };
16707
+ sheetText = (rows, at, shown) => {
16708
+ const column = Math.max(12, Math.floor((shown.room - SHEET_GAP) / 2));
16709
+ const { left, right } = splitInTwo(groupedBy(rows).map((group) => sheetBlock(rows, group, column - 2)));
16710
+ const deep = Math.max(left.length, right.length);
16711
+ const where = left.findIndex((row) => row.at === at);
16712
+ const also = right.findIndex((row) => row.at === at);
16713
+ const on = where === -1 ? also : where;
16714
+ const top = Math.max(0, Math.min(deep - shown.height, on - Math.floor(shown.height / 2)));
16715
+ const drawn = [];
16716
+ for (let step = 0; step < Math.min(shown.height, deep); step += 1) {
16717
+ const row = top + step;
16718
+ drawn.push(sheetPaint(left[row], left[row]?.at === at, column), fg(palette.ink)(" ".repeat(SHEET_GAP)), sheetPaint(right[row], right[row]?.at === at, column), fg(palette.ink)("\n"));
16719
+ }
16720
+ return new StyledText(drawn);
16721
+ };
16558
16722
  stack = (parent, children) => {
16559
16723
  for (const child of children) parent.add(child);
16560
16724
  };
@@ -16771,9 +16935,12 @@ var init_render = __esmMin((() => {
16771
16935
  };
16772
16936
  waitingLabel = (branch) => branch.unanswered > 0 ? `${branch.unanswered} unanswered` : "";
16773
16937
  inRange = (state, row, from, to) => state.selecting && row >= from && row <= to;
16774
- notesOf = (comments, path, sent, opened = []) => comments.filter((entry) => entry.file === path).map((entry) => ({
16938
+ notesOf = (comments, path, sent, shown = {
16939
+ opened: [],
16940
+ now: Date.now()
16941
+ }) => comments.filter((entry) => entry.file === path).map((entry) => ({
16775
16942
  id: entry.id ?? "",
16776
- folded: entry.settled === true && !(entry.id !== void 0 && opened.includes(entry.id)),
16943
+ folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
16777
16944
  side: entry.side,
16778
16945
  line: entry.end,
16779
16946
  body: entry.body,
@@ -16782,9 +16949,14 @@ var init_render = __esmMin((() => {
16782
16949
  stale: entry.stale === true,
16783
16950
  asks: entry.asks === true,
16784
16951
  answers: entry.answers ?? [],
16785
- turns: entry.turns ?? []
16952
+ turns: entry.turns ?? [],
16953
+ takenAt: entry.takenAt,
16954
+ now: shown.now
16786
16955
  }));
16787
- notesFor = (state, path) => notesOf(stillThere(state.sent), path, true, state.opened);
16956
+ notesFor = (state, path) => notesOf(stillThere(state.sent), path, true, {
16957
+ opened: state.opened,
16958
+ now: state.now
16959
+ });
16788
16960
  paired = (chunks) => {
16789
16961
  const chips = [];
16790
16962
  for (let at = 0; at < chunks.length; at += CHIP_CHUNKS) chips.push(chunks.slice(at, at + CHIP_CHUNKS));
@@ -16997,7 +17169,8 @@ var init_render = __esmMin((() => {
16997
17169
  layerText = (row, look, room) => row.kind === "gap" ? "" : `${layerGutter(row, look)}${" ".repeat(look.lead - GUTTER)}${row.text}`.padEnd(room.title + TITLE_LEAD);
16998
17170
  PANEL_TITLES = {
16999
17171
  asked: "Waiting on you",
17000
- with: "With the agent",
17172
+ filed: "Not picked up",
17173
+ with: "Picked up, no answer",
17001
17174
  answered: "Answered, not settled",
17002
17175
  settled: "Settled",
17003
17176
  removed: "Removed"
@@ -17246,7 +17419,6 @@ var init_render = __esmMin((() => {
17246
17419
  this.wheelOnSheet(this.keys);
17247
17420
  this.wheelOnSheet(this.palette);
17248
17421
  this.wheelOnRail(this.listPane);
17249
- this.wheelOnRail(this.list);
17250
17422
  this.view.listenTo({
17251
17423
  scroll: (delta) => {
17252
17424
  this.dragFrom = void 0;
@@ -17394,15 +17566,18 @@ var init_render = __esmMin((() => {
17394
17566
  return;
17395
17567
  }
17396
17568
  const rows = keyMatches(state);
17397
- const room = panelWidth(this.renderer.width);
17398
- const keysRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
17569
+ const room = this.renderer.width;
17570
+ const keysRoom = this.renderer.height;
17399
17571
  const shown = Math.max(1, keysRoom - PENDING_CHROME);
17400
- this.keysTitle.content = keysTitle(rows.length, shown);
17401
- this.keysChoices.content = listText(rows.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), shown);
17572
+ this.keysTitle.content = keysTitle(rows.length, sheetDeep(rows, room - MODAL_ROOM) <= shown);
17573
+ this.keysChoices.content = sheetText(rows, Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), {
17574
+ height: shown,
17575
+ room: room - MODAL_ROOM
17576
+ });
17402
17577
  this.keys.height = keysRoom;
17403
17578
  this.keys.width = room;
17404
- this.keys.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
17405
- this.keys.top = panelTop(this.renderer.height, PANEL_QUARTER);
17579
+ this.keys.left = 0;
17580
+ this.keys.top = 0;
17406
17581
  }
17407
17582
  headerText(state) {
17408
17583
  const branch = selectedBranch(state);
@@ -17917,7 +18092,7 @@ var init_upgrade = __esmMin((() => {
17917
18092
  }));
17918
18093
  //#endregion
17919
18094
  //#region src/tui/app.ts
17920
- var LEAVING_MS, LOOK_MS, LEAVING_SAID, NOTHING_WRITTEN, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
18095
+ var LEAVING_MS, LOOK_MS, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
17921
18096
  var init_app = __esmMin((() => {
17922
18097
  init_dist();
17923
18098
  init_report();
@@ -17937,6 +18112,7 @@ var init_app = __esmMin((() => {
17937
18112
  init_upgrade();
17938
18113
  LEAVING_MS = 3e3;
17939
18114
  LOOK_MS = 110;
18115
+ AGE_TICK_MS = 3e4;
17940
18116
  LEAVING_SAID = "press ctrl+c again to leave";
17941
18117
  NOTHING_WRITTEN = "nothing written yet";
17942
18118
  LAYERS_ASK_LEAD = "About this branch, not about this line.";
@@ -18094,6 +18270,8 @@ var init_app = __esmMin((() => {
18094
18270
  leaving;
18095
18271
  looking;
18096
18272
  rolling = false;
18273
+ pendingRoll = 0;
18274
+ ticking;
18097
18275
  grewWithShift = false;
18098
18276
  keys = [];
18099
18277
  trail = [];
@@ -18132,6 +18310,8 @@ var init_app = __esmMin((() => {
18132
18310
  renderer.on("destroy", () => this.stopWatching());
18133
18311
  renderer.on("destroy", () => this.stopFading());
18134
18312
  renderer.on("destroy", () => this.stopLooking());
18313
+ renderer.on("destroy", () => this.stopTicking());
18314
+ this.startTicking();
18135
18315
  renderer.on("destroy", () => this.stopLighting());
18136
18316
  renderer.on("destroy", () => void getTreeSitterClient().destroy());
18137
18317
  renderer.on("destroy", () => this.stopPainting());
@@ -18387,6 +18567,24 @@ var init_app = __esmMin((() => {
18387
18567
  this.lighting = void 0;
18388
18568
  if (fiber !== void 0) runFork(interrupt(fiber));
18389
18569
  }
18570
+ startTicking() {
18571
+ this.commit({
18572
+ ...this.state,
18573
+ now: Date.now()
18574
+ });
18575
+ this.ticking = setInterval(() => {
18576
+ this.commit({
18577
+ ...this.state,
18578
+ now: Date.now()
18579
+ });
18580
+ }, AGE_TICK_MS);
18581
+ this.ticking.unref?.();
18582
+ }
18583
+ stopTicking() {
18584
+ if (this.ticking === void 0) return;
18585
+ clearInterval(this.ticking);
18586
+ this.ticking = void 0;
18587
+ }
18390
18588
  stopFading() {
18391
18589
  const fiber = this.fading;
18392
18590
  this.fading = void 0;
@@ -18880,13 +19078,18 @@ var init_app = __esmMin((() => {
18880
19078
  const was = this.state.patchIndex;
18881
19079
  this.commit(reduce(this.measured(), delta > 0 ? "comment.next" : "comment.prev"));
18882
19080
  if (this.state.patchIndex !== was) yield* this.turnedTo();
18883
- this.rolling = false;
18884
19081
  });
18885
19082
  }
18886
19083
  rollFrom(delta) {
18887
- const costly = onLayers(this.state);
18888
- if (costly && this.rolling) return;
18889
- this.rolling = costly;
19084
+ if (!onLayers(this.state)) {
19085
+ this.dispatchTask(this.rolled(delta));
19086
+ return;
19087
+ }
19088
+ if (this.rolling) {
19089
+ this.pendingRoll = delta;
19090
+ return;
19091
+ }
19092
+ this.rolling = true;
18890
19093
  this.dispatchTask(this.rolled(delta));
18891
19094
  }
18892
19095
  stepped(delta) {
@@ -18934,7 +19137,13 @@ var init_app = __esmMin((() => {
18934
19137
  const was = this.state.patchIndex;
18935
19138
  this.commit(railScrolled(this.measured(), delta));
18936
19139
  if (this.state.patchIndex !== was) yield* this.turnedTo();
18937
- });
19140
+ }).pipe(ensuring(sync(() => this.rolledOn())));
19141
+ }
19142
+ rolledOn() {
19143
+ this.rolling = false;
19144
+ const held = this.pendingRoll;
19145
+ this.pendingRoll = 0;
19146
+ if (held !== 0) this.rollFrom(held > 0 ? 1 : -1);
18938
19147
  }
18939
19148
  moveFile(delta) {
18940
19149
  return this.commitSynced(delta > 0 ? "file.next" : "file.prev");
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "bin": {
24
24
  "adiff": "./bin/adiff.js"
25
25
  },
26
- "version": "0.1.0-alpha.134",
26
+ "version": "0.1.0-alpha.136",
27
27
  "description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
28
28
  "license": "MIT",
29
29
  "repository": {
@@ -53,6 +53,8 @@
53
53
  "sketch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/sketch.ts",
54
54
  "watch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/watch.ts",
55
55
  "serve": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/serve.ts",
56
- "play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts"
56
+ "play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts",
57
+ "shot": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/shot.ts",
58
+ "pr-summary": "node scripts/pr-summary.ts"
57
59
  }
58
60
  }