@eliya-oss/agent-diff 0.1.0-alpha.190 → 0.1.0-alpha.192

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.
@@ -51,7 +51,9 @@ a test fails, nothing is recorded — a green run is the precondition, not a cla
51
51
  ## A recording replays keys, and nothing else
52
52
 
53
53
  The replay rebuilds the world from the trace — the branch fixture and the layers, and nothing more —
54
- then presses the keys. Anything a test does by another route is not there: a file changed or
54
+ then presses the keys. The one exception is a branch checked out in the directory under review with
55
+ `driver.branch.switchTo`: the trace keeps it as a step, and the replay checks out the same branch at
56
+ the same moment. Anything else a test does by another route is not there: a file changed or
55
57
  committed after the world was built, a comment or an answer seeded through the store or the command
56
58
  line, a preference set from outside. A test that does any of those marks its trace unreplayable, and
57
59
  `pnpm record` skips it and says which route it took.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.192
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(marks): marking a file after its directory was switched to another branch records nothing, and the footer names the branch the directory is on now.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ Review state is filed under the branch the directory is on. Checking out another branch there
12
+ mid-review sent every new mark to that branch and showed its marks in the file list, so a review
13
+ with twenty-eight files ticked suddenly showed four.
14
+
15
+ </details>
16
+
17
+ - feat(comment delivery): `adiff comment doing` records one line of what the agent is doing on a comment it took, and `comment list` reports it as `doing` until an answer, a settle or a remove clears it.
18
+
19
+ <details><summary>Why</summary>
20
+
21
+ Between taking a comment and answering it, a comment the agent was ten minutes into looked the same as one it had dropped.
22
+
23
+ </details>
24
+
25
+ feat(comment delivery): `adiff comment answer --choice`, given two to four times, offers the reviewer answers to a question, and `comment list` carries them on that turn as `choices`.
26
+
27
+ feat(CLI): `adiff review progress` names the files marked reviewed whose content changed since, as `changed`.
28
+
29
+ <details><summary>Why</summary>
30
+
31
+ A lapsed mark used to drop silently out of the count, so a file read before the agent rewrote it looked like one never read at all. The mark already held the blob it was made at, so a mark written by an older adiff reports the same way.
32
+
33
+ </details>
34
+
35
+ - feat(CLI): in a Harbor terminal, `adiff review pane` opens the review as a child terminal under the agent's.
36
+
37
+ ## 0.1.0-alpha.191
38
+
39
+ ### Patch Changes
40
+
41
+ - perf(layers): layers show on a branch of 3,185 changed files takes 1.0s, down from 3.3s.
42
+
43
+ <details><summary>What was slow</summary>
44
+
45
+ Working out which changed lines a layer covers looked through every span of every layer for each
46
+ line, so a branch with thousands of files spent most of the command there. The answer is the same,
47
+ byte for byte.
48
+
49
+ </details>
50
+
3
51
  ## 0.1.0-alpha.190
4
52
 
5
53
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9989,6 +9989,20 @@ var init_pane = __esmMin((() => {
9989
9989
  repo,
9990
9990
  ...run
9991
9991
  ]
9992
+ },
9993
+ {
9994
+ pane: "harbor",
9995
+ binary: "harbor",
9996
+ present: () => set$1("HARBOR_SOCKET") && set$1("HARBOR_PANE_ID"),
9997
+ args: (repo, run) => [
9998
+ "open",
9999
+ "--child",
10000
+ "--cwd",
10001
+ repo,
10002
+ "--",
10003
+ "adiff",
10004
+ ...run.slice(run.indexOf("review"))
10005
+ ]
9992
10006
  }
9993
10007
  ];
9994
10008
  named$4 = (option, value) => value === void 0 ? [] : [`--${option}`, value];
@@ -10044,7 +10058,7 @@ var init_config = __esmMin((() => {
10044
10058
  //#region package.json
10045
10059
  init_pane();
10046
10060
  init_config();
10047
- var version$1 = "0.1.0-alpha.190";
10061
+ var version$1 = "0.1.0-alpha.192";
10048
10062
  //#endregion
10049
10063
  //#region src/cli/error.ts
10050
10064
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -10572,11 +10586,41 @@ var init_catalog = __esmMin((() => {
10572
10586
  required: false,
10573
10587
  value: "flag",
10574
10588
  about: "The answer is a question, and the work waits for a reply"
10589
+ },
10590
+ {
10591
+ name: "choice",
10592
+ required: false,
10593
+ value: "text",
10594
+ about: "One answer the reviewer can pick. Give it 2 to 4 times, in order; it makes the answer a question"
10575
10595
  }
10576
10596
  ],
10577
10597
  dataKey: "answered",
10578
10598
  example: "adiff comment answer --worktree . --id c1 --body \"dropped it, and the import with it\""
10579
10599
  },
10600
+ {
10601
+ name: "comment doing",
10602
+ about: "Say in one line what you are doing on a comment you took. Replaces the last line; an answer clears it",
10603
+ group: ANSWER_COMMENTS,
10604
+ addresses: "review",
10605
+ safety: "write",
10606
+ options: [
10607
+ ...addressing,
10608
+ {
10609
+ name: "id",
10610
+ required: true,
10611
+ value: "id",
10612
+ about: "The comment being worked on, as `comment take` reported it"
10613
+ },
10614
+ {
10615
+ name: "body",
10616
+ required: true,
10617
+ value: "text",
10618
+ about: "One short line, such as Editing driver.ts"
10619
+ }
10620
+ ],
10621
+ dataKey: "doing",
10622
+ example: "adiff comment doing --worktree . --id c1 --body \"Editing driver.ts\""
10623
+ },
10580
10624
  {
10581
10625
  name: "layers set",
10582
10626
  about: "Write the reading order for this review's diff: ordered layers over spans of files",
@@ -11023,22 +11067,32 @@ var init_catalog = __esmMin((() => {
11023
11067
  }));
11024
11068
  //#endregion
11025
11069
  //#region src/cli/parse.ts
11026
- var FLAG, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, WHOLE, around$1, seconds;
11070
+ var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
11027
11071
  var init_parse$1 = __esmMin((() => {
11028
11072
  init_dist();
11029
11073
  init_catalog();
11030
11074
  init_error$5();
11031
11075
  FLAG = /^--(?<name>[^=]+)(?:=(?<value>[\s\S]*))?$/;
11076
+ REPEATED = /* @__PURE__ */ new Set(["choice"]);
11077
+ MANY = "\n";
11078
+ withValue = (options, name, value) => {
11079
+ const before = options[name];
11080
+ if (before === void 0 || !REPEATED.has(name)) return {
11081
+ ...options,
11082
+ [name]: value
11083
+ };
11084
+ return {
11085
+ ...options,
11086
+ [name]: `${before}${MANY}${value}`
11087
+ };
11088
+ };
11032
11089
  flagOn = (taken, token, valued) => {
11033
11090
  const found = FLAG.exec(token)?.groups;
11034
11091
  if (found === void 0) return taken;
11035
11092
  const name = found["name"] ?? "";
11036
- const given = found["value"];
11037
- if (given !== void 0) return {
11038
- options: {
11039
- ...taken.options,
11040
- [name]: given
11041
- },
11093
+ const value = found["value"];
11094
+ if (value !== void 0) return {
11095
+ options: withValue(taken.options, name, value),
11042
11096
  held: void 0
11043
11097
  };
11044
11098
  if (valued.has(name)) return {
@@ -11054,10 +11108,7 @@ var init_parse$1 = __esmMin((() => {
11054
11108
  };
11055
11109
  };
11056
11110
  tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
11057
- options: {
11058
- ...taken.options,
11059
- [taken.held]: token
11060
- },
11111
+ options: withValue(taken.options, taken.held, token),
11061
11112
  held: void 0
11062
11113
  };
11063
11114
  optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
@@ -11125,6 +11176,29 @@ var init_parse$1 = __esmMin((() => {
11125
11176
  allowed: [`a whole number of seconds from 1 to ${WAIT_MOST}`]
11126
11177
  });
11127
11178
  });
11179
+ many = (options, name) => {
11180
+ const raw = options[name];
11181
+ return raw === void 0 ? [] : raw.split(MANY);
11182
+ };
11183
+ CHOICES_FEWEST = 2;
11184
+ CHOICES_MOST = 4;
11185
+ choices = fn("Cli.choices")(function* (options, name) {
11186
+ const offered = many(options, name).map((choice) => choice.trim());
11187
+ if (offered.length === 0) return offered;
11188
+ return yield* offered.length >= CHOICES_FEWEST && offered.length <= CHOICES_MOST && offered.every((choice) => choice.length > 0) ? succeed$1(offered) : new BadOption({
11189
+ option: name,
11190
+ given: offered.join(" | "),
11191
+ allowed: [`${CHOICES_FEWEST} to ${CHOICES_MOST} choices, none of them empty`]
11192
+ });
11193
+ });
11194
+ oneLine = fn("Cli.oneLine")(function* (options, name) {
11195
+ const said = (yield* required(options, name)).trim();
11196
+ return yield* said.length > 0 && !said.includes("\n") ? succeed$1(said) : new BadOption({
11197
+ option: name,
11198
+ given: said,
11199
+ allowed: ["one line of text, not empty"]
11200
+ });
11201
+ });
11128
11202
  })), ADVICE, FALLBACK, tagOf, project, fieldsOf, narrow, keysIn, strangeField, sharpen, failure;
11129
11203
  var init_report$1 = __esmMin((() => {
11130
11204
  ADVICE = {
@@ -12340,12 +12414,13 @@ var init_model$4 = __esmMin((() => {
12340
12414
  base: "",
12341
12415
  read: {},
12342
12416
  dismissed: {},
12343
- seen: {}
12417
+ seen: {},
12418
+ doing: {}
12344
12419
  };
12345
12420
  }));
12346
12421
  //#endregion
12347
12422
  //#region src/service/store/schema.ts
12348
- var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, noStamps, BranchState, StoredSaid, StoredRemark, StoredRemarks, Settings, Watching, UpgradeCheck, Prose, Code$1, StoredLayer, StoredLayers;
12423
+ var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, Doing, noStamps, BranchState, StoredSaid, StoredRemark, StoredRemarks, Settings, Watching, UpgradeCheck, Prose, Code$1, StoredLayer, StoredLayers;
12349
12424
  var init_schema = __esmMin((() => {
12350
12425
  init_dist();
12351
12426
  Side = Literals(["old", "new"]);
@@ -12382,7 +12457,8 @@ var init_schema = __esmMin((() => {
12382
12457
  body: String$1,
12383
12458
  head: String$1,
12384
12459
  asks: Boolean,
12385
- at: String$1
12460
+ at: String$1,
12461
+ choices: optionalKey(ArraySchema(String$1))
12386
12462
  });
12387
12463
  Batch = Struct({
12388
12464
  id: String$1,
@@ -12392,6 +12468,10 @@ var init_schema = __esmMin((() => {
12392
12468
  });
12393
12469
  Stamps = Record(String$1, String$1);
12394
12470
  Counts = Record(String$1, Int);
12471
+ Doing = Record(String$1, Struct({
12472
+ body: String$1,
12473
+ at: String$1
12474
+ }));
12395
12475
  noStamps = withDecodingDefaultKey(succeed$1({}));
12396
12476
  BranchState = Struct({
12397
12477
  taken: optionalKey(Record(String$1, String$1)),
@@ -12404,7 +12484,8 @@ var init_schema = __esmMin((() => {
12404
12484
  base: String$1.pipe(withDecodingDefaultKey(succeed$1(""))),
12405
12485
  read: Counts.pipe(withDecodingDefaultKey(succeed$1({}))),
12406
12486
  dismissed: Stamps.pipe(noStamps),
12407
- seen: Stamps.pipe(noStamps)
12487
+ seen: Stamps.pipe(noStamps),
12488
+ doing: Doing.pipe(withDecodingDefaultKey(succeed$1({})))
12408
12489
  });
12409
12490
  StoredSaid = Struct({
12410
12491
  by: String$1,
@@ -12940,10 +13021,11 @@ var init_store = __esmMin((() => {
12940
13021
  }));
12941
13022
  //#endregion
12942
13023
  //#region src/review/error.ts
12943
- var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
13024
+ var UnknownBranch, BranchMoved, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
12944
13025
  var init_error$2 = __esmMin((() => {
12945
13026
  init_dist();
12946
13027
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
13028
+ BranchMoved = class extends TaggedError("BranchMoved") {};
12947
13029
  UnknownBase = class extends TaggedError("UnknownBase") {};
12948
13030
  UnknownFile = class extends TaggedError("UnknownFile") {};
12949
13031
  UnknownComment = class extends TaggedError("UnknownComment") {};
@@ -12963,7 +13045,7 @@ var init_error$2 = __esmMin((() => {
12963
13045
  NoLayers = class extends TaggedError("NoLayers") {};
12964
13046
  NoPull = class extends TaggedError("NoPull") {};
12965
13047
  UnknownLayer = class extends TaggedError("UnknownLayer") {};
12966
- })), realOf, AUTO, askedFor$1, basedOn, named$3, find, basedAt, worktreeAt, patches, reading, waitingOn, summaryOf, summary, list$5, markOpened, lastOpened, repoOf, nameAt, saveReport, refs, forOne, recentBases, setBase, clearBase;
13048
+ })), realOf, AUTO, askedFor$1, basedOn, named$3, SHORT, onNow, stillOn, find, basedAt, worktreeAt, patches, reading, waitingOn, summaryOf, summary, list$5, markOpened, lastOpened, repoOf, nameAt, saveReport, refs, forOne, recentBases, setBase, clearBase;
12967
13049
  var init_branches$1 = __esmMin((() => {
12968
13050
  init_dist();
12969
13051
  init_patch();
@@ -13043,6 +13125,18 @@ var init_branches$1 = __esmMin((() => {
13043
13125
  known: worktrees.map((w) => w.branch)
13044
13126
  }) : succeed$1(found);
13045
13127
  });
13128
+ SHORT = 8;
13129
+ onNow = (worktree, head) => worktree.detached ? `(detached ${head.slice(0, SHORT)})` : head;
13130
+ stillOn = fn("Review.Branch.stillOn")(function* (worktree) {
13131
+ const git = yield* Git;
13132
+ const now = onNow(worktree, yield* git.headOf(worktree.path));
13133
+ if (now === worktree.branch) return worktree;
13134
+ return yield* new BranchMoved({
13135
+ branch: worktree.branch,
13136
+ path: worktree.path,
13137
+ now
13138
+ });
13139
+ });
13046
13140
  find = fn("Review.Branch.find")(function* (repo, branch, base) {
13047
13141
  return (yield* basedOn(repo, yield* named$3(repo, branch), base)).worktree;
13048
13142
  });
@@ -13294,7 +13388,7 @@ var init_model$3 = __esmMin((() => {
13294
13388
  }));
13295
13389
  //#endregion
13296
13390
  //#region src/domain/layers/coverage.ts
13297
- var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, claimsHunk, runsOf, tallyOf, coverage, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
13391
+ var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, NOTHING, reachesOf, claimsOf, reaching, claimedBy, runsOf, tallyOf, changedHunks, coverage, sharedIn, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
13298
13392
  var init_coverage = __esmMin((() => {
13299
13393
  init_dist();
13300
13394
  init_model$3();
@@ -13315,8 +13409,42 @@ var init_coverage = __esmMin((() => {
13315
13409
  onNone: () => [],
13316
13410
  onSome: (line) => [line]
13317
13411
  }));
13318
- holds = (span, path, line) => span.path === path && span.start <= line && span.end >= line;
13319
- claimsHunk = (spans, path, hunk) => changedLines(hunk).some((line) => spans.some((span) => holds(span, path, line)));
13412
+ NOTHING = [];
13413
+ reachesOf = (spans) => {
13414
+ const reaches = [];
13415
+ const ordered = spans.filter((span) => span.start <= span.end).toSorted((a, b) => a.start - b.start);
13416
+ for (const span of ordered) {
13417
+ const open = reaches.at(-1);
13418
+ if (open !== void 0 && span.start <= open.end) open.end = Math.max(open.end, span.end);
13419
+ else reaches.push({
13420
+ start: span.start,
13421
+ end: span.end
13422
+ });
13423
+ }
13424
+ return reaches;
13425
+ };
13426
+ claimsOf = (spans) => {
13427
+ const byPath = /* @__PURE__ */ new Map();
13428
+ for (const span of spans) {
13429
+ const held = byPath.get(span.path);
13430
+ if (held === void 0) byPath.set(span.path, [span]);
13431
+ else held.push(span);
13432
+ }
13433
+ return new Map([...byPath].map(([path, held]) => [path, reachesOf(held)]));
13434
+ };
13435
+ reaching = (reaches, line) => {
13436
+ let low = 0;
13437
+ let high = reaches.length;
13438
+ while (low < high) {
13439
+ const middle = low + high >>> 1;
13440
+ const reach = reaches[middle];
13441
+ if (reach === void 0 || reach.start > line) high = middle;
13442
+ else low = middle + 1;
13443
+ }
13444
+ const last = reaches[low - 1];
13445
+ return last !== void 0 && last.end >= line;
13446
+ };
13447
+ claimedBy = (reaches, changed) => changed.some((line) => reaching(reaches, line));
13320
13448
  runsOf = (path, lines) => {
13321
13449
  const runs = [];
13322
13450
  for (const line of lines.toSorted((a, b) => a - b)) {
@@ -13330,20 +13458,23 @@ var init_coverage = __esmMin((() => {
13330
13458
  }
13331
13459
  return runs;
13332
13460
  };
13333
- tallyOf = (patch, hunk, claimed) => {
13334
- const changed = changedLines(hunk);
13335
- const loose = changed.filter((line) => !claimed.some((span) => holds(span, patch.path, line)));
13461
+ tallyOf = (path, changed, reaches) => {
13462
+ const loose = changed.filter((line) => !reaching(reaches, line));
13336
13463
  const whole = changed.length > 0 && loose.length === 0;
13337
13464
  const some = loose.length > 0 && loose.length < changed.length;
13338
13465
  return {
13339
13466
  covered: whole ? 1 : 0,
13340
13467
  partial: some ? 1 : 0,
13341
- missing: runsOf(patch.path, loose)
13468
+ missing: runsOf(path, loose)
13342
13469
  };
13343
13470
  };
13471
+ changedHunks = (patch) => patch.hunks.map(changedLines).filter((changed) => changed.length > 0);
13344
13472
  coverage = (patches, layers) => {
13345
- const claimed = spansOf$1(layers);
13346
- const tallies = patches.flatMap((patch) => patch.hunks.filter((hunk) => changedLines(hunk).length > 0).map((hunk) => tallyOf(patch, hunk, claimed)));
13473
+ const claims = claimsOf(spansOf$1(layers));
13474
+ const tallies = patches.flatMap((patch) => {
13475
+ const reaches = claims.get(patch.path) ?? NOTHING;
13476
+ return changedHunks(patch).map((changed) => tallyOf(patch.path, changed, reaches));
13477
+ });
13347
13478
  return {
13348
13479
  total: tallies.length,
13349
13480
  covered: tallies.reduce((sum, tally) => sum + tally.covered, 0),
@@ -13351,9 +13482,17 @@ var init_coverage = __esmMin((() => {
13351
13482
  missing: tallies.flatMap((tally) => tally.missing)
13352
13483
  };
13353
13484
  };
13485
+ sharedIn = (patch, claims) => {
13486
+ const held = claims.flatMap((claim) => {
13487
+ const reaches = claim.get(patch.path);
13488
+ return reaches === void 0 ? [] : [reaches];
13489
+ });
13490
+ if (held.length < 2) return 0;
13491
+ return changedHunks(patch).filter((changed) => held.filter((reaches) => claimedBy(reaches, changed)).length > 1).length;
13492
+ };
13354
13493
  sharedHunks = (patches, layers) => {
13355
- const claiming = (patch, hunk) => layers.filter((layer) => claimsHunk(spansOf$1([layer]), patch.path, hunk)).length;
13356
- return patches.reduce((sum, patch) => sum + patch.hunks.filter((hunk) => changedLines(hunk).length > 0 && claiming(patch, hunk) > 1).length, 0);
13494
+ const claims = layers.map((layer) => claimsOf(spansOf$1([layer])));
13495
+ return patches.reduce((sum, patch) => sum + sharedIn(patch, claims), 0);
13357
13496
  };
13358
13497
  runsSaid = (count) => count === 1 ? "One run of changed lines the layers do not account for." : `${count} runs of changed lines the layers do not account for.`;
13359
13498
  filesSaid = (count) => count === 1 ? "One file the layers had no lines to order." : `${count} files the layers had no lines to order.`;
@@ -13720,7 +13859,7 @@ var init_comments$1 = __esmMin((() => {
13720
13859
  }));
13721
13860
  //#endregion
13722
13861
  //#region src/review/threads.ts
13723
- var stateOf$2, placedNow$1, answerOf, turnsOf, threadOf, threadsIn$1, idsIn, isKnown, known, list$3, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead;
13862
+ var stateOf$2, placedNow$1, choicesOf, answerOf, turnsOf, threadOf, threadsIn$1, idsIn, rootIn, rootOf, isKnown, known, list$3, clearDoing, doing, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead;
13724
13863
  var init_threads$1 = __esmMin((() => {
13725
13864
  init_dist();
13726
13865
  init_patch();
@@ -13754,10 +13893,12 @@ var init_threads$1 = __esmMin((() => {
13754
13893
  })
13755
13894
  });
13756
13895
  };
13896
+ choicesOf = (entry) => entry.choices === void 0 ? {} : { choices: entry.choices };
13757
13897
  answerOf = (entry) => ({
13758
13898
  body: entry.body,
13759
13899
  at: entry.at,
13760
- asks: entry.asks
13900
+ asks: entry.asks,
13901
+ ...choicesOf(entry)
13761
13902
  });
13762
13903
  turnsOf = (replies, said) => [...replies.map((held) => ({
13763
13904
  voice: "reviewer",
@@ -13766,7 +13907,8 @@ var init_threads$1 = __esmMin((() => {
13766
13907
  })), ...said.map((entry) => ({
13767
13908
  voice: "agent",
13768
13909
  body: entry.body,
13769
- at: entry.at
13910
+ at: entry.at,
13911
+ ...choicesOf(entry)
13770
13912
  }))].toSorted((one, other) => one.at < other.at ? -1 : one.at > other.at ? 1 : 0);
13771
13913
  threadOf = (held, replies, conversation) => {
13772
13914
  const { comment, batch } = held;
@@ -13776,6 +13918,7 @@ var init_threads$1 = __esmMin((() => {
13776
13918
  const turns = turnsOf(replies, mine);
13777
13919
  const settled = Object.hasOwn(conversation.settled, comment.id);
13778
13920
  const sits = placedNow$1(conversation.patches, comment.anchor);
13921
+ const doing = conversation.doing[comment.id];
13779
13922
  return {
13780
13923
  id: comment.id,
13781
13924
  file: comment.anchor.path,
@@ -13792,7 +13935,8 @@ var init_threads$1 = __esmMin((() => {
13792
13935
  taken: [...ids].some((id) => Object.hasOwn(conversation.taken, id)),
13793
13936
  answers: mine.map(answerOf),
13794
13937
  turns,
13795
- settled
13938
+ settled,
13939
+ ...doing === void 0 ? {} : { doing }
13796
13940
  };
13797
13941
  };
13798
13942
  threadsIn$1 = (batches, conversation) => {
@@ -13805,6 +13949,15 @@ var init_threads$1 = __esmMin((() => {
13805
13949
  return held.filter((one) => one.comment.replyTo === void 0).map((one) => threadOf(one, under(one), conversation));
13806
13950
  };
13807
13951
  idsIn = (batches) => batches.flatMap((batch) => batch.comments.map((comment) => comment.id));
13952
+ rootIn = (batches, id) => {
13953
+ const found = batches.flatMap((batch) => batch.comments).find((comment) => comment.id === id);
13954
+ return found === void 0 ? void 0 : found.replyTo ?? found.id;
13955
+ };
13956
+ rootOf = fn("Review.Thread.rootOf")(function* (worktree, id) {
13957
+ const store = yield* Store;
13958
+ const root = rootIn(yield* store.inbox(worktree.path), id);
13959
+ return root === void 0 ? yield* new UnknownComment({ id }) : root;
13960
+ });
13808
13961
  isKnown = fn("Review.Thread.isKnown")(function* (worktree, id) {
13809
13962
  const store = yield* Store;
13810
13963
  return idsIn(yield* store.inbox(worktree.path)).includes(id);
@@ -13822,19 +13975,52 @@ var init_threads$1 = __esmMin((() => {
13822
13975
  shown: new Set(patches.map((patch) => patch.path)),
13823
13976
  patches,
13824
13977
  read: current.read,
13825
- taken: current.taken ?? {}
13978
+ taken: current.taken ?? {},
13979
+ doing: current.doing
13826
13980
  });
13827
13981
  });
13982
+ clearDoing = fn("Review.Thread.clearDoing")(function* (worktree, root) {
13983
+ const store = yield* Store;
13984
+ const current = yield* store.state(worktree.path);
13985
+ if (!Object.hasOwn(current.doing, root)) return;
13986
+ yield* store.changeState(worktree.path, (was) => ({
13987
+ ...was,
13988
+ doing: without$1(was.doing, root)
13989
+ }));
13990
+ });
13991
+ doing = fn("Review.Thread.doing")(function* (worktree, request) {
13992
+ const store = yield* Store;
13993
+ const root = yield* rootOf(worktree, request.id);
13994
+ const said = {
13995
+ body: request.body,
13996
+ at: request.at
13997
+ };
13998
+ yield* store.changeState(worktree.path, (was) => ({
13999
+ ...was,
14000
+ doing: {
14001
+ ...was.doing,
14002
+ [root]: said
14003
+ }
14004
+ }));
14005
+ yield* ignore(store.noteWatching(worktree.path, request.at));
14006
+ return { doing: {
14007
+ id: root,
14008
+ ...said
14009
+ } };
14010
+ });
13828
14011
  answer$3 = fn("Review.Thread.answer")(function* (worktree, request) {
13829
14012
  const store = yield* Store;
13830
- yield* known(worktree, request.id);
14013
+ const root = yield* rootOf(worktree, request.id);
14014
+ const offered = request.choices.length > 0;
13831
14015
  yield* store.answer(worktree.path, {
13832
14016
  comment: request.id,
13833
14017
  body: request.body,
13834
14018
  head: worktree.head,
13835
- asks: request.asks,
13836
- at: request.at
14019
+ asks: request.asks || offered,
14020
+ at: request.at,
14021
+ ...offered ? { choices: request.choices } : {}
13837
14022
  });
14023
+ yield* clearDoing(worktree, root);
13838
14024
  yield* ignore(store.noteWatching(worktree.path, request.at));
13839
14025
  return { answered: (yield* store.answers(worktree.path)).filter((entry) => entry.comment === request.id).length };
13840
14026
  });
@@ -13854,7 +14040,8 @@ var init_threads$1 = __esmMin((() => {
13854
14040
  read: {
13855
14041
  ...was.read,
13856
14042
  [id]: replies
13857
- }
14043
+ },
14044
+ doing: without$1(was.doing, id)
13858
14045
  }));
13859
14046
  return { settled: id };
13860
14047
  });
@@ -13884,7 +14071,8 @@ var init_threads$1 = __esmMin((() => {
13884
14071
  read: {
13885
14072
  ...was.read,
13886
14073
  [id]: replies
13887
- }
14074
+ },
14075
+ doing: without$1(was.doing, id)
13888
14076
  }));
13889
14077
  return { removed: id };
13890
14078
  });
@@ -14650,16 +14838,26 @@ var init_review$1 = __esmMin((() => {
14650
14838
  }));
14651
14839
  //#endregion
14652
14840
  //#region src/review/vouching.ts
14653
- var readParts, blobIn, toggle, progress;
14841
+ var pathOfMark, changedSince, readParts, blobIn, toggle, progress;
14654
14842
  var init_vouching$1 = __esmMin((() => {
14655
14843
  init_dist();
14656
14844
  init_review$1();
14657
14845
  init_store();
14658
14846
  init_error$2();
14659
14847
  init_patches();
14848
+ pathOfMark = (mark) => mark.split("@")[0] ?? "";
14849
+ changedSince = (marks, files) => {
14850
+ const recorded = marks.flatMap((held) => Object.entries(held));
14851
+ const blobsOf = (file) => recorded.filter(([mark]) => pathOfMark(mark) === file.path).map(([, blob]) => blob);
14852
+ const lapsed = (file) => {
14853
+ const blobs = blobsOf(file);
14854
+ return blobs.length > 0 && !blobs.includes(file.blob);
14855
+ };
14856
+ return files.filter(lapsed).map((file) => file.path);
14857
+ };
14660
14858
  readParts = (parts, files) => {
14661
14859
  const blobs = new Map(files.map((file) => [file.path, file.blob]));
14662
- return Object.entries(parts).filter(([part, blob]) => blobs.get(part.split("@")[0] ?? "") === blob).map(([part]) => part);
14860
+ return Object.entries(parts).filter(([part, blob]) => blobs.get(pathOfMark(part)) === blob).map(([part]) => part);
14663
14861
  };
14664
14862
  blobIn = fn("Review.Vouch.blobIn")(function* (reading, file) {
14665
14863
  return yield* match$3(blobOf(reading.patches, file), {
@@ -14699,6 +14897,7 @@ var init_vouching$1 = __esmMin((() => {
14699
14897
  return {
14700
14898
  vouched: files.filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
14701
14899
  parts: readParts(current.parts, files),
14900
+ changed: changedSince([current.vouches, current.parts], files),
14702
14901
  total: reading.patches.length
14703
14902
  };
14704
14903
  });
@@ -22666,11 +22865,11 @@ var init_reading = __esmMin((() => {
22666
22865
  worktreeFor = (app, branch) => readingHeld(app, branch)?.worktree;
22667
22866
  worktreeOf = (app, branch) => {
22668
22867
  const held = worktreeFor(app, branch);
22669
- return held === void 0 ? find(app.repo, branch) : succeed$1(held);
22868
+ return held === void 0 ? find(app.repo, branch) : stillOn(held);
22670
22869
  };
22671
22870
  readingOf = (app, branch) => {
22672
22871
  const held = readingHeld(app, branch);
22673
- return held === void 0 ? reading(app.repo, branch) : succeed$1(held);
22872
+ return held === void 0 ? reading(app.repo, branch) : as(stillOn(held.worktree), held);
22674
22873
  };
22675
22874
  loadSent = (app, branch) => flatMap(readingOf(app, branch), listSent);
22676
22875
  remarksHeld = (app, reading) => app.state.remarksOn ? list$2(reading) : succeed$1([]);
@@ -24523,7 +24722,7 @@ var init_vouching = __esmMin((() => {
24523
24722
  }));
24524
24723
  //#endregion
24525
24724
  //#region src/tui/app.ts
24526
- var LEAVING_MS, LOOK_MS, AGE_TICK_MS, NOTICE_MS, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, KEY_HISTORY, TRAIL_HISTORY, DRAIN_PASSES, LEAVING_SAID, leavingSaid, clockOf, momentOf, noticeOf, turnedOver, unmoved, chosenIn, EFFECTS, App, settingsHeld, firstBranches, missing, openingOn, sessionToResume, asidesMade, treeSitterFreed, shownOn, painting, ticking, noticing, noticingFiled, launch, untilDestroyed, runOn, rendererMade, runTui;
24725
+ var LEAVING_MS, LOOK_MS, AGE_TICK_MS, NOTICE_MS, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, KEY_HISTORY, TRAIL_HISTORY, DRAIN_PASSES, LEAVING_SAID, leavingSaid, clockOf, momentOf, noticeOf, turnedOver, unmoved, chosenIn, EFFECTS, movedSaid, App, settingsHeld, firstBranches, missing, openingOn, sessionToResume, asidesMade, treeSitterFreed, shownOn, painting, ticking, noticing, noticingFiled, launch, untilDestroyed, runOn, rendererMade, runTui;
24527
24726
  var init_app = __esmMin((() => {
24528
24727
  init_dist();
24529
24728
  init_preferences$1();
@@ -24649,6 +24848,7 @@ var init_app = __esmMin((() => {
24649
24848
  "match.next": (app) => walkMatches(app, 1),
24650
24849
  "match.prev": (app) => walkMatches(app, -1)
24651
24850
  };
24851
+ movedSaid = (moved) => `nothing recorded: the directory of ${moved.branch} is on ${moved.now} now`;
24652
24852
  App = class {
24653
24853
  renderer;
24654
24854
  screen;
@@ -24753,7 +24953,7 @@ var init_app = __esmMin((() => {
24753
24953
  }
24754
24954
  act(intent) {
24755
24955
  const began = Date.now();
24756
- return this.answer(intent).pipe(catchCause((cause) => sync(() => this.fail(squash(cause)))), ensuring(sync(() => this.timed(began))));
24956
+ return this.answer(intent).pipe(catchTag("BranchMoved", (moved) => sync(() => this.commit(withNotice(this.state, movedSaid(moved))))), catchCause((cause) => sync(() => this.fail(squash(cause)))), ensuring(sync(() => this.timed(began))));
24757
24957
  }
24758
24958
  answer(intent) {
24759
24959
  return Intent.$match(intent, {
@@ -25348,10 +25548,19 @@ const commentAnswer = fn("Main.commentAnswer")(function* (options) {
25348
25548
  id: yield* required(options, "id"),
25349
25549
  body: yield* required(options, "body"),
25350
25550
  asks: options["question"] !== void 0,
25351
- at: stamp(options)
25551
+ at: stamp(options),
25552
+ choices: yield* choices(options, "choice")
25352
25553
  });
25353
25554
  yield* answer(options, { answered: report.answered });
25354
25555
  });
25556
+ const commentDoing = fn("Main.commentDoing")(function* (options) {
25557
+ const report = yield* doing(yield* worktreeNamed(options), {
25558
+ id: yield* required(options, "id"),
25559
+ body: yield* oneLine(options, "body"),
25560
+ at: stamp(options)
25561
+ });
25562
+ yield* answer(options, report);
25563
+ });
25355
25564
  const remarkList = fn("Main.remarkList")(function* (options) {
25356
25565
  const remarks = yield* fetch$1(yield* required(options, "repo"), yield* readingIn(options));
25357
25566
  yield* answer(options, { remarks });
@@ -25456,6 +25665,7 @@ const reviewStatus = fn("Main.reviewStatus")(function* (options) {
25456
25665
  const report = yield* progress(yield* readingIn(options));
25457
25666
  yield* answer(options, {
25458
25667
  reviewed: report.vouched,
25668
+ changed: report.changed,
25459
25669
  total: report.total
25460
25670
  });
25461
25671
  });
@@ -25519,6 +25729,7 @@ const routes = {
25519
25729
  "comment reply": commentReply,
25520
25730
  "comment take": commentTake,
25521
25731
  "comment answer": commentAnswer,
25732
+ "comment doing": commentDoing,
25522
25733
  "comment list": commentList,
25523
25734
  "remark list": remarkList,
25524
25735
  "remark accept": remarkAccept,
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.190",
26
+ "version": "0.1.0-alpha.192",
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": {
@@ -98,6 +98,26 @@ adiff comment answer --worktree . --id <id> --question --body "Drop it, or keep
98
98
  That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
99
99
  the work genuinely stops without an answer.
100
100
 
101
+ When the answers you expect are few and short, offer them with `--choice`, two to four times. The
102
+ reviewer can pick one instead of typing it, and it reaches you as an ordinary reply carrying those
103
+ words. `--choice` marks the answer a question on its own:
104
+
105
+ ```bash
106
+ adiff comment answer --worktree . --id <id> --body "Drop it, or keep it and map the error?" --choice "Drop it" --choice "Keep it and map the error"
107
+ ```
108
+
109
+ ## Say what you are doing on a comment
110
+
111
+ A comment that takes more than a minute looks to the reviewer exactly like one you dropped. After
112
+ you take it, say in one short line what you are doing on it, and say it again when that changes:
113
+
114
+ ```bash
115
+ adiff comment doing --worktree . --id <id> --body "Editing driver.ts"
116
+ ```
117
+
118
+ The reviewer sees the latest line on the comment. Your answer clears it, so there is nothing to
119
+ take back when you finish. Keep it to what you are doing now, not a plan.
120
+
101
121
  ## When the reviewer writes back
102
122
 
103
123
  A reviewer can reply to an answer, and the reply arrives through `comment take` like any other
@@ -166,8 +186,9 @@ type. The answer says what happened:
166
186
  {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch add-invitations"}
167
187
  ```
168
188
 
169
- `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
170
- WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
189
+ In Harbor the review opens as a child terminal under yours instead of a split. `opened:false` means
190
+ nothing could be split, which is ordinary: a terminal without tmux, Zellij, WezTerm, kitty or Harbor
191
+ has nowhere to put a pane. The answer carries `command` either way, so quote that
171
192
  line and let them run it.
172
193
 
173
194
  Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over