@eliya-oss/agent-diff 0.1.0-alpha.81 → 0.1.0-alpha.82

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.82
4
+
5
+ ### Minor Changes
6
+
7
+ - A reviewer can write back to an answer. Press `R` on a thread, in the diff or in the review panel, and the reply continues that thread rather than opening a second one about the same line. It reaches the agent through `comment take` like any other comment, carrying the conversation so far, and `adiff comment reply --to <id>` does the same from the command line.
8
+
3
9
  ## 0.1.0-alpha.81
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8709,7 +8709,8 @@ var init_schema = __esmMin((() => {
8709
8709
  StoredComment = Struct({
8710
8710
  id: String$1,
8711
8711
  anchor: Anchor,
8712
- body: String$1
8712
+ body: String$1,
8713
+ replyTo: optionalKey(String$1)
8713
8714
  });
8714
8715
  StoredAnswer = Struct({
8715
8716
  comment: String$1,
@@ -9107,7 +9108,7 @@ var init_error$1 = __esmMin((() => {
9107
9108
  }));
9108
9109
  //#endregion
9109
9110
  //#region src/cli/commands.ts
9110
- var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, sentOf, sentIn, listSent, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9111
+ var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, submitComment, without$1, submitReply, listPatches, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9111
9112
  var init_commands = __esmMin((() => {
9112
9113
  init_dist();
9113
9114
  init_patch();
@@ -9292,9 +9293,25 @@ var init_commands = __esmMin((() => {
9292
9293
  return yield* progressIn(yield* readingOf(repo, branch, base));
9293
9294
  });
9294
9295
  bodyOf = (entry) => entry.body;
9295
- sentOf = (comment, reading) => {
9296
+ saidTo = (spoken, id) => spoken.filter((entry) => entry.comment === id).length;
9297
+ spunOf = (replies, said) => [...replies.map((reply) => ({
9298
+ voice: "reviewer",
9299
+ body: reply.body,
9300
+ at: reply.at,
9301
+ asks: false
9302
+ })), ...said.map((entry) => ({
9303
+ voice: "agent",
9304
+ body: entry.body,
9305
+ at: entry.at,
9306
+ asks: entry.asks
9307
+ }))].toSorted((one, other) => one.at < other.at ? -1 : one.at > other.at ? 1 : 0);
9308
+ sentOf = (comment, replies, reading) => {
9296
9309
  const { spoken, settled, head, shown, read } = reading;
9297
- const mine = spoken.filter((entry) => entry.comment === comment.id);
9310
+ const ids = /* @__PURE__ */ new Set([comment.id, ...replies.map((reply) => reply.id)]);
9311
+ const said = spoken.filter((entry) => ids.has(entry.comment));
9312
+ const seen = [...ids].reduce((total, id) => total + (read[id] ?? 0), 0);
9313
+ const spun = spunOf(replies, said);
9314
+ const last = spun.at(-1);
9298
9315
  return {
9299
9316
  id: comment.id,
9300
9317
  file: comment.file,
@@ -9305,9 +9322,13 @@ var init_commands = __esmMin((() => {
9305
9322
  settled: Object.hasOwn(settled, comment.id),
9306
9323
  stale: comment.head !== head,
9307
9324
  outside: !shown.has(comment.file),
9308
- unread: Math.max(0, mine.length - (read[comment.id] ?? 0)),
9309
- asks: mine.at(-1)?.asks === true,
9310
- answers: mine.map(bodyOf)
9325
+ unread: Math.max(0, said.length - seen),
9326
+ asks: last?.voice === "agent" && last.asks,
9327
+ answers: said.map(bodyOf),
9328
+ turns: spun.map((turn) => ({
9329
+ voice: turn.voice,
9330
+ body: turn.body
9331
+ }))
9311
9332
  };
9312
9333
  };
9313
9334
  sentIn = fn("Cli.sentIn")(function* (reading) {
@@ -9316,13 +9337,17 @@ var init_commands = __esmMin((() => {
9316
9337
  const spoken = yield* store.answers(worktree.path);
9317
9338
  const current = yield* store.state(worktree.path);
9318
9339
  const shown = new Set(reading.patches.map((patch) => patch.path));
9319
- return flatten(yield* store.inbox(worktree.path)).filter((comment) => !Object.hasOwn(current.removed, comment.id)).map((comment) => sentOf(comment, {
9340
+ const held = flatten(yield* store.inbox(worktree.path)).filter((comment) => !Object.hasOwn(current.removed, comment.id));
9341
+ const replies = held.filter((comment) => comment.replyTo !== void 0);
9342
+ const conversation = {
9320
9343
  spoken,
9321
9344
  settled: current.settled,
9322
9345
  head: worktree.head,
9323
9346
  shown,
9324
9347
  read: current.read
9325
- }));
9348
+ };
9349
+ const under = (comment) => replies.filter((reply) => reply.replyTo === comment.id);
9350
+ return held.filter((comment) => comment.replyTo === void 0).map((comment) => sentOf(comment, under(comment), conversation));
9326
9351
  });
9327
9352
  listSent = fn("Cli.listSent")(function* (repo, branch, base) {
9328
9353
  return yield* sentIn(yield* readingOf(repo, branch, base));
@@ -9364,6 +9389,32 @@ var init_commands = __esmMin((() => {
9364
9389
  yield* store.submit(worktree.path, batch);
9365
9390
  return batch;
9366
9391
  });
9392
+ without$1 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
9393
+ submitReply = fn("Cli.submitReply")(function* (request) {
9394
+ const store = yield* Store;
9395
+ const worktree = yield* findBranch(request.repo, request.branch);
9396
+ const found = (yield* store.inbox(worktree.path)).flatMap((batch) => batch.comments).find((one) => one.id === request.to);
9397
+ if (found === void 0) return yield* new UnknownComment({ id: request.to });
9398
+ const root = found.replyTo ?? found.id;
9399
+ const batch = {
9400
+ id: request.id,
9401
+ at: request.at,
9402
+ head: worktree.head,
9403
+ comments: [{
9404
+ id: request.id,
9405
+ anchor: found.anchor,
9406
+ body: request.body,
9407
+ replyTo: root
9408
+ }]
9409
+ };
9410
+ yield* store.submit(worktree.path, batch);
9411
+ const current = yield* store.state(worktree.path);
9412
+ if (Object.hasOwn(current.settled, root)) yield* store.saveState(worktree.path, {
9413
+ ...current,
9414
+ settled: without$1(current.settled, root)
9415
+ });
9416
+ return batch;
9417
+ });
9367
9418
  listPatches = fn("Cli.listPatches")(function* (repo, branch, context = CONTEXT) {
9368
9419
  const worktree = yield* findBranch(repo, branch);
9369
9420
  const git = yield* Git;
@@ -9378,12 +9429,28 @@ var init_commands = __esmMin((() => {
9378
9429
  start: comment.anchor.start,
9379
9430
  end: comment.anchor.end,
9380
9431
  snippet: comment.anchor.snippet,
9381
- body: comment.body
9432
+ body: comment.body,
9433
+ replyTo: comment.replyTo
9382
9434
  })));
9435
+ threadBefore = (reply, held, spoken) => {
9436
+ const root = reply.replyTo;
9437
+ const mine = held.filter((one) => one.id === root || one.replyTo === root);
9438
+ const ids = new Set(mine.map((one) => one.id));
9439
+ const said = spoken.filter((entry) => ids.has(entry.comment));
9440
+ return spunOf(mine.filter((one) => one.at < reply.at), said.filter((entry) => entry.at < reply.at)).map((turn) => ({
9441
+ voice: turn.voice,
9442
+ body: turn.body
9443
+ }));
9444
+ };
9383
9445
  takeComments = fn("Cli.takeComments")(function* (worktree) {
9384
9446
  const store = yield* Store;
9385
9447
  const resolved = yield* promise(() => realpath(worktree));
9386
- return flatten(yield* store.take(resolved));
9448
+ const owed = flatten(yield* store.take(resolved));
9449
+ if (owed.every((one) => one.replyTo === void 0)) return owed;
9450
+ const held = flatten(yield* store.inbox(resolved));
9451
+ const spoken = yield* store.answers(resolved);
9452
+ const carried = (one) => one.replyTo === void 0 ? one : Object.assign({}, one, { thread: threadBefore(one, held, spoken) });
9453
+ return owed.map(carried);
9387
9454
  });
9388
9455
  repoOf$1 = fn("Cli.repoOf")(function* (worktree) {
9389
9456
  return yield* (yield* Git).repoOf(worktree);
@@ -9460,18 +9527,22 @@ var init_commands = __esmMin((() => {
9460
9527
  markRead = fn("Cli.markRead")(function* (repo, branch, id) {
9461
9528
  const store = yield* Store;
9462
9529
  const worktree = yield* findBranch(repo, branch);
9463
- const seen = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id).length;
9530
+ const spoken = yield* store.answers(worktree.path);
9531
+ const counted = [id, ...flatten(yield* store.inbox(worktree.path)).filter((one) => one.replyTo === id).map((one) => one.id)].map((one) => ({
9532
+ id: one,
9533
+ seen: saidTo(spoken, one)
9534
+ }));
9464
9535
  const current = yield* store.state(worktree.path);
9465
- if ((current.read[id] ?? 0) >= seen) return {
9536
+ const owed = counted.filter((one) => (current.read[one.id] ?? 0) < one.seen);
9537
+ if (owed.length === 0) return {
9466
9538
  id,
9467
9539
  unread: 0
9468
9540
  };
9541
+ const read = { ...current.read };
9542
+ for (const one of owed) read[one.id] = one.seen;
9469
9543
  yield* store.saveState(worktree.path, {
9470
9544
  ...current,
9471
- read: {
9472
- ...current.read,
9473
- [id]: seen
9474
- }
9545
+ read
9475
9546
  });
9476
9547
  return {
9477
9548
  id,
@@ -9733,7 +9804,7 @@ var init_pane = __esmMin((() => {
9733
9804
  init_commands();
9734
9805
  init_init();
9735
9806
  init_pane();
9736
- var version$1 = "0.1.0-alpha.81";
9807
+ var version$1 = "0.1.0-alpha.82";
9737
9808
  //#endregion
9738
9809
  //#region src/cli/upgrade.ts
9739
9810
  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, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -10301,27 +10372,41 @@ var init_layers = __esmMin((() => {
10301
10372
  }));
10302
10373
  //#endregion
10303
10374
  //#region src/cli/threads.ts
10304
- var stateOf$1, spoken$1, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleThread, removeComment, without, restoreComment, settleRead;
10375
+ var stateOf$1, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleThread, removeComment, without, restoreComment, settleRead;
10305
10376
  var init_threads = __esmMin((() => {
10306
10377
  init_dist();
10307
10378
  init_store();
10308
10379
  init_commands();
10309
10380
  init_layers();
10310
10381
  init_error$1();
10311
- stateOf$1 = (answers, isSettled, isRemoved) => {
10382
+ stateOf$1 = (turns, asked, isSettled, isRemoved) => {
10312
10383
  if (isRemoved) return "removed";
10313
10384
  if (isSettled) return "done";
10314
- const last = answers.at(-1);
10315
- if (last === void 0) return "sent";
10316
- return last.asks ? "question" : "answered";
10385
+ const last = turns.at(-1);
10386
+ if (last === void 0 || last.voice === "reviewer") return "sent";
10387
+ return asked ? "question" : "answered";
10317
10388
  };
10318
10389
  spoken$1 = (entry) => ({
10319
10390
  body: entry.body,
10320
10391
  at: entry.at,
10321
10392
  asks: entry.asks
10322
10393
  });
10323
- threadOf = (comment, batch, reading) => {
10324
- const mine = reading.answers.filter((entry) => entry.comment === comment.id);
10394
+ turnsOf = (replies, said) => [...replies.map((held) => ({
10395
+ voice: "reviewer",
10396
+ body: held.comment.body,
10397
+ at: held.batch.at
10398
+ })), ...said.map((entry) => ({
10399
+ voice: "agent",
10400
+ body: entry.body,
10401
+ at: entry.at
10402
+ }))].toSorted((one, other) => one.at < other.at ? -1 : one.at > other.at ? 1 : 0);
10403
+ threadOf = (held, replies, reading) => {
10404
+ const { comment, batch } = held;
10405
+ const ids = /* @__PURE__ */ new Set([comment.id, ...replies.map((one) => one.comment.id)]);
10406
+ const mine = reading.answers.filter((entry) => ids.has(entry.comment));
10407
+ const seen = [...ids].reduce((total, id) => total + (reading.read[id] ?? 0), 0);
10408
+ const turns = turnsOf(replies, mine);
10409
+ const settled = Object.hasOwn(reading.settled, comment.id);
10325
10410
  return {
10326
10411
  id: comment.id,
10327
10412
  file: comment.anchor.path,
@@ -10329,14 +10414,24 @@ var init_threads = __esmMin((() => {
10329
10414
  start: comment.anchor.start,
10330
10415
  end: comment.anchor.end,
10331
10416
  body: comment.body,
10332
- state: stateOf$1(mine, Object.hasOwn(reading.settled, comment.id), Object.hasOwn(reading.removed, comment.id)),
10417
+ state: stateOf$1(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(reading.removed, comment.id)),
10333
10418
  stale: batch.head !== reading.head,
10334
10419
  outside: !reading.shown.has(comment.anchor.path),
10335
- unread: Math.max(0, mine.length - (reading.read[comment.id] ?? 0)),
10336
- answers: mine.map(spoken$1)
10420
+ unread: Math.max(0, mine.length - seen),
10421
+ answers: mine.map(spoken$1),
10422
+ turns,
10423
+ settled
10337
10424
  };
10338
10425
  };
10339
- threadsIn = (batches, reading) => batches.flatMap((batch) => batch.comments.map((comment) => threadOf(comment, batch, reading)));
10426
+ threadsIn = (batches, reading) => {
10427
+ const held = batches.flatMap((batch) => batch.comments.map((comment) => ({
10428
+ comment,
10429
+ batch
10430
+ })));
10431
+ const replies = held.filter((one) => one.comment.replyTo !== void 0);
10432
+ const under = (one) => replies.filter((reply) => reply.comment.replyTo === one.comment.id);
10433
+ return held.filter((one) => one.comment.replyTo === void 0).map((one) => threadOf(one, under(one), reading));
10434
+ };
10340
10435
  idsIn = (batches) => batches.flatMap((batch) => batch.comments.map((comment) => comment.id));
10341
10436
  isKnown = fn("Cli.isKnown")(function* (worktreePath, id) {
10342
10437
  const store = yield* Store;
@@ -10646,6 +10741,30 @@ var init_catalog = __esmMin((() => {
10646
10741
  dataKey: "batch",
10647
10742
  example: "adiff comment send --repo . --branch cdr-1 --file src/api.ts --start 4 --end 5 --body \"why\""
10648
10743
  },
10744
+ {
10745
+ name: "comment reply",
10746
+ about: "Write back to a comment already sent, continuing its thread",
10747
+ group: WRITE_COMMENTS,
10748
+ addresses: "review",
10749
+ safety: "write",
10750
+ options: [
10751
+ ...addressing,
10752
+ {
10753
+ name: "to",
10754
+ required: true,
10755
+ value: "id",
10756
+ about: "The comment being continued, as `comment list` reports it"
10757
+ },
10758
+ {
10759
+ name: "body",
10760
+ required: true,
10761
+ value: "text",
10762
+ about: "What to tell the agent"
10763
+ }
10764
+ ],
10765
+ dataKey: "batch",
10766
+ example: "adiff comment reply --repo . --branch cdr-1 --to c1 --body \"the other one\""
10767
+ },
10649
10768
  {
10650
10769
  name: "comment take",
10651
10770
  about: "Collect the comments this review is still owed an answer on. Repeats until answered",
@@ -11465,7 +11584,7 @@ var init_tree = __esmMin((() => {
11465
11584
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11466
11585
  };
11467
11586
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11468
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelIndexOf, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11587
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelIndexOf, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11469
11588
  var init_model = __esmMin((() => {
11470
11589
  init_dist();
11471
11590
  init_patch();
@@ -11774,6 +11893,7 @@ var init_model = __esmMin((() => {
11774
11893
  composeRoom$1 = (columns) => Math.max(COMPOSE_LEAST, composeBox(columns) - COMPOSE_PAD);
11775
11894
  composeTarget = (state) => {
11776
11895
  const patch = selectedPatch(state);
11896
+ if (state.replyTo !== void 0) return replyTarget(state);
11777
11897
  if (patch === void 0) return "";
11778
11898
  const [from, to] = selectionRange(state);
11779
11899
  const anchor = anchorFor(patch, from, to);
@@ -11783,6 +11903,11 @@ var init_model = __esmMin((() => {
11783
11903
  });
11784
11904
  return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
11785
11905
  };
11906
+ replyTarget = (state) => {
11907
+ const thread = state.sent.find((entry) => entry.id === state.replyTo);
11908
+ if (thread === void 0) return "Reply";
11909
+ return `Reply on ${thread.file}:${thread.end}`;
11910
+ };
11786
11911
  pickedText = (state) => {
11787
11912
  const picked = state.picked;
11788
11913
  const patch = selectedPatch(state);
@@ -12451,6 +12576,17 @@ var init_command = __esmMin((() => {
12451
12576
  hint: "settle read",
12452
12577
  rank: 1
12453
12578
  }),
12579
+ command({
12580
+ action: "thread.reply",
12581
+ panes: ["review", "diff"],
12582
+ hint: "reply",
12583
+ rank: 1,
12584
+ title: "Write back to the thread here",
12585
+ category: "Comments",
12586
+ keys: ["R"],
12587
+ screens: ["review"],
12588
+ whenThread: true
12589
+ }),
12454
12590
  command({
12455
12591
  action: "thread.remove",
12456
12592
  panes: ["review"],
@@ -13045,6 +13181,7 @@ var init_reduce = __esmMin((() => {
13045
13181
  ...state,
13046
13182
  screen: "compose",
13047
13183
  draft: "",
13184
+ replyTo: void 0,
13048
13185
  anchorRow: state.selecting ? state.anchorRow : state.cursor
13049
13186
  };
13050
13187
  };
@@ -13073,7 +13210,8 @@ var init_reduce = __esmMin((() => {
13073
13210
  if (state.screen === "compose") return {
13074
13211
  ...state,
13075
13212
  screen: "review",
13076
- draft: ""
13213
+ draft: "",
13214
+ replyTo: void 0
13077
13215
  };
13078
13216
  if (state.selecting) return {
13079
13217
  ...state,
@@ -13145,6 +13283,7 @@ var init_reduce = __esmMin((() => {
13145
13283
  "select.swap": swapEnds,
13146
13284
  "compose.open": openCompose,
13147
13285
  "compose.submit": (state) => state,
13286
+ "thread.reply": (state) => state,
13148
13287
  "focus.toggle": (state) => ({
13149
13288
  ...state,
13150
13289
  focus: focusStepped(state, 1),
@@ -13595,7 +13734,7 @@ var init_theme = __esmMin((() => {
13595
13734
  }));
13596
13735
  //#endregion
13597
13736
  //#region src/tui/diffview.ts
13598
- var WASH, NOTE_MIN, ANSWER_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
13737
+ var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, proseAt, notesAt, codeRow, rowsFor, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
13599
13738
  var init_diffview = __esmMin((() => {
13600
13739
  init_dist();
13601
13740
  init_patch();
@@ -13613,6 +13752,7 @@ var init_diffview = __esmMin((() => {
13613
13752
  };
13614
13753
  NOTE_MIN = 24;
13615
13754
  ANSWER_MARK = "↳";
13755
+ REPLY_MARK = "»";
13616
13756
  OVERSCAN = 2;
13617
13757
  SIGN_WIDTH = 2;
13618
13758
  SCROLL_ROWS = 1;
@@ -14147,10 +14287,10 @@ var init_diffview = __esmMin((() => {
14147
14287
  if (note.answers.length > 0) return `${marks().sent} answered${moved}`;
14148
14288
  return `${marks().sent} sent${moved}`;
14149
14289
  };
14150
- spokenLines = (body, room) => {
14151
- return wrap(body.replaceAll("\n", " "), Math.max(NOTE_MIN, room - 2)).map((text, at) => at === 0 ? `${ANSWER_MARK} ${text}` : ` ${text}`);
14290
+ spokenLines = (body, room, mark) => {
14291
+ return wrap(body.replaceAll("\n", " "), Math.max(NOTE_MIN, room - 2)).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
14152
14292
  };
14153
- answerLines = (note, room) => note.answers.flatMap((body) => spokenLines(body, room));
14293
+ answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, turn.voice === "agent" ? ANSWER_MARK : REPLY_MARK)) : note.answers.flatMap((body) => spokenLines(body, room, ANSWER_MARK));
14154
14294
  noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
14155
14295
  headOf(note),
14156
14296
  ...note.body.split("\n").flatMap((line) => wrap(line, room)),
@@ -14700,7 +14840,8 @@ var init_render = __esmMin((() => {
14700
14840
  settled: entry.settled === true,
14701
14841
  stale: entry.stale === true,
14702
14842
  asks: entry.asks === true,
14703
- answers: entry.answers ?? []
14843
+ answers: entry.answers ?? [],
14844
+ turns: entry.turns ?? []
14704
14845
  }));
14705
14846
  notesFor = (state, path) => notesOf(state.sent, path, true, state.opened);
14706
14847
  paired = (chunks) => {
@@ -16064,6 +16205,7 @@ var init_app = __esmMin((() => {
16064
16205
  "thread.settle": () => this.settleHere(),
16065
16206
  "thread.settleRead": () => this.settleWhatIsRead(),
16066
16207
  "thread.remove": () => this.removeHere(),
16208
+ "thread.reply": () => this.replyHere(),
16067
16209
  "selection.copy": () => sync(() => this.copySelection(false)),
16068
16210
  "search.open": () => this.findSelection(),
16069
16211
  "search.jump": () => this.openMatch(),
@@ -16346,6 +16488,21 @@ var init_app = __esmMin((() => {
16346
16488
  this.commit(withNotice(this.staying(held, id), "settled"));
16347
16489
  });
16348
16490
  }
16491
+ replyHere() {
16492
+ return sync(() => {
16493
+ const thread = threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor);
16494
+ if (thread?.id === void 0) {
16495
+ this.commit(withNotice(this.state, "no thread here"));
16496
+ return;
16497
+ }
16498
+ this.commit({
16499
+ ...this.state,
16500
+ screen: "compose",
16501
+ draft: "",
16502
+ replyTo: thread.id
16503
+ });
16504
+ });
16505
+ }
16349
16506
  staying(state, id) {
16350
16507
  const at = panelIndexOf(state, id);
16351
16508
  const last = Math.max(0, panelEntries(state).length - 1);
@@ -16600,6 +16757,28 @@ var init_app = __esmMin((() => {
16600
16757
  });
16601
16758
  }
16602
16759
  send() {
16760
+ return this.state.replyTo === void 0 ? this.sendComment() : this.sendReply(this.state.replyTo);
16761
+ }
16762
+ sendReply(to) {
16763
+ return gen({ self: this }, function* () {
16764
+ const branch = selectedBranch(this.state);
16765
+ if (branch === void 0 || this.state.draft.length === 0) return;
16766
+ yield* submitReply({
16767
+ repo: this.repo,
16768
+ branch: branch.branch,
16769
+ to,
16770
+ body: yield* this.display.written,
16771
+ id: randomUUID(),
16772
+ at: (/* @__PURE__ */ new Date()).toISOString()
16773
+ });
16774
+ const sent = yield* this.loadSent(branch.branch);
16775
+ this.commit(withNotice(withSent({
16776
+ ...this.state,
16777
+ replyTo: void 0
16778
+ }, sent), "sent to the agent"));
16779
+ });
16780
+ }
16781
+ sendComment() {
16603
16782
  return gen({ self: this }, function* () {
16604
16783
  const patch = selectedPatch(this.state);
16605
16784
  const branch = selectedBranch(this.state);
@@ -16791,6 +16970,17 @@ const commentSend = fn("Main.commentSend")(function* (options) {
16791
16970
  });
16792
16971
  yield* answer(options, { batch });
16793
16972
  });
16973
+ const commentReply = fn("Main.commentReply")(function* (options) {
16974
+ const batch = yield* submitReply({
16975
+ repo: yield* required(options, "repo"),
16976
+ branch: yield* required(options, "branch"),
16977
+ to: yield* required(options, "to"),
16978
+ body: yield* required(options, "body"),
16979
+ id: options["id"] ?? randomUUID(),
16980
+ at: options["at"] ?? (/* @__PURE__ */ new Date()).toISOString()
16981
+ });
16982
+ yield* answer(options, { batch });
16983
+ });
16794
16984
  const NOTHING_WAITING = "No comment is waiting. Pass --wait <seconds> to block until one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
16795
16985
  const commentTake = fn("Main.commentTake")(function* (options) {
16796
16986
  const worktree = yield* required(options, "worktree");
@@ -16900,6 +17090,7 @@ const routes = {
16900
17090
  "base set": baseSet,
16901
17091
  "base clear": baseClear,
16902
17092
  "comment send": commentSend,
17093
+ "comment reply": commentReply,
16903
17094
  "comment take": commentTake,
16904
17095
  "comment answer": commentAnswer,
16905
17096
  "comment list": commentList,
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.81",
26
+ "version": "0.1.0-alpha.82",
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": {
@@ -73,6 +73,20 @@ adiff comment answer --worktree . --id <id> --question --body "Drop it, or keep
73
73
  That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
74
74
  the work genuinely stops without an answer.
75
75
 
76
+ ## When the reviewer writes back
77
+
78
+ A reviewer can reply to an answer, and the reply arrives through `comment take` like any other
79
+ comment — with an `id` of its own that you answer against, and a `thread` carrying what was said
80
+ before it, oldest first:
81
+
82
+ ```json
83
+ {"body":"the imports","replyTo":"c1","thread":[{"voice":"reviewer","body":"why two of these"},{"voice":"agent","body":"which two did you mean"}]}
84
+ ```
85
+
86
+ Read the thread before answering. A reply is usually short because it is the rest of a sentence you
87
+ already have: "the imports" only means something next to the question it answers. Answer it against
88
+ its own id, not the id of the comment that started the thread.
89
+
76
90
  Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is
77
91
  closed.
78
92