@eliya-oss/agent-diff 0.1.0-alpha.202 → 0.1.0-alpha.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/main.js +186 -66
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.204
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(agent commands): `--body -` reads the text from stdin, as `layers set --json -` already does, so an answer piped in from a heredoc reaches the reviewer whole. Blank text on stdin is refused.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ An agent that answered with `--body -` and the text on stdin stored a lone `-` as its answer, which the reviewer saw as an empty reply, and the text it meant to send was lost. Every command that takes `--body` now reads stdin for `-`: comment send, reply, answer and doing, draft add and edit, remark accept and reply.
12
+
13
+ </details>
14
+
15
+ - fix(marks): a layer marked read stays read when the agent changes the file only in another layer's lines, and marking that layer again unmarks it.
16
+
17
+ <details><summary>What was wrong</summary>
18
+
19
+ A file two layers share was read one layer at a time. When the agent changed the file in one layer's lines, every layer of the file went back to unread, so a layer with nothing new in it asked to be read again and its Since review view had nothing to show. A file marked read whole already kept its untouched layers. And on a layer kept read that way, pressing mark recorded a new mark instead of taking the layer back out.
20
+
21
+ </details>
22
+
23
+ ## 0.1.0-alpha.203
24
+
25
+ ### Patch Changes
26
+
27
+ - feat(CLI): `patch show` tags each changed row with `quietIn`, the layers that keep it in place, quiet, rather than fold it.
28
+
3
29
  ## 0.1.0-alpha.202
4
30
 
5
31
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10083,7 +10083,7 @@ var init_config = __esmMin((() => {
10083
10083
  //#region package.json
10084
10084
  init_pane();
10085
10085
  init_config();
10086
- var version$1 = "0.1.0-alpha.202";
10086
+ var version$1 = "0.1.0-alpha.204";
10087
10087
  //#endregion
10088
10088
  //#region src/cli/error.ts
10089
10089
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -10378,7 +10378,7 @@ var init_catalog = __esmMin((() => {
10378
10378
  name: "body",
10379
10379
  required: true,
10380
10380
  value: "text",
10381
- about: "What to tell the agent"
10381
+ about: "What to tell the agent, or - to read it from stdin"
10382
10382
  },
10383
10383
  {
10384
10384
  name: "side",
@@ -10602,7 +10602,7 @@ var init_catalog = __esmMin((() => {
10602
10602
  name: "body",
10603
10603
  required: true,
10604
10604
  value: "text",
10605
- about: "What to tell the agent"
10605
+ about: "What to tell the agent, or - to read it from stdin"
10606
10606
  }
10607
10607
  ],
10608
10608
  dataKey: "batch",
@@ -10650,7 +10650,7 @@ var init_catalog = __esmMin((() => {
10650
10650
  name: "body",
10651
10651
  required: true,
10652
10652
  value: "text",
10653
- about: "What was done, or what is being asked"
10653
+ about: "What was done, or what is being asked, or - to read it from stdin"
10654
10654
  },
10655
10655
  {
10656
10656
  name: "question",
@@ -10765,7 +10765,7 @@ var init_catalog = __esmMin((() => {
10765
10765
  name: "body",
10766
10766
  required: true,
10767
10767
  value: "text",
10768
- about: "What it should say instead"
10768
+ about: "What it should say instead, or - to read it from stdin"
10769
10769
  }
10770
10770
  ],
10771
10771
  dataKey: "draft",
@@ -10834,7 +10834,7 @@ var init_catalog = __esmMin((() => {
10834
10834
  name: "body",
10835
10835
  required: false,
10836
10836
  value: "text",
10837
- about: "What to tell the agent, instead of the remark's own words"
10837
+ about: "What to tell the agent, instead of the remark's own words, or - to read it from stdin"
10838
10838
  }
10839
10839
  ],
10840
10840
  dataKey: "accepted",
@@ -10858,7 +10858,7 @@ var init_catalog = __esmMin((() => {
10858
10858
  name: "body",
10859
10859
  required: true,
10860
10860
  value: "text",
10861
- about: "What to say in the thread"
10861
+ about: "What to say in the thread, or - to read it from stdin"
10862
10862
  }
10863
10863
  ],
10864
10864
  dataKey: "answered",
@@ -11138,7 +11138,7 @@ var init_catalog = __esmMin((() => {
11138
11138
  }));
11139
11139
  //#endregion
11140
11140
  //#region src/cli/parse.ts
11141
- var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, SPOT, spot, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
11141
+ var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, STDIN, text$1, numeric, SPOT, spot, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
11142
11142
  var init_parse$1 = __esmMin((() => {
11143
11143
  init_dist();
11144
11144
  init_catalog();
@@ -11216,6 +11216,16 @@ var init_parse$1 = __esmMin((() => {
11216
11216
  onSome: succeed$1
11217
11217
  });
11218
11218
  });
11219
+ STDIN = "-";
11220
+ text$1 = fn("Cli.text")(function* (options, name) {
11221
+ const given = yield* required(options, name);
11222
+ const said = given === STDIN ? yield* promise(() => text(process.stdin)) : given;
11223
+ return yield* said.trim().length > 0 ? succeed$1(given === STDIN ? said.trimEnd() : said) : new BadOption({
11224
+ option: name,
11225
+ given,
11226
+ allowed: ["text, or - with the text on stdin"]
11227
+ });
11228
+ });
11219
11229
  numeric = fn("Cli.numeric")(function* (options, name) {
11220
11230
  const raw = yield* required(options, name);
11221
11231
  const parsed = Number(raw);
@@ -11277,8 +11287,8 @@ var init_parse$1 = __esmMin((() => {
11277
11287
  });
11278
11288
  });
11279
11289
  oneLine = fn("Cli.oneLine")(function* (options, name) {
11280
- const said = (yield* required(options, name)).trim();
11281
- return yield* said.length > 0 && !said.includes("\n") ? succeed$1(said) : new BadOption({
11290
+ const said = (yield* text$1(options, name)).trim();
11291
+ return yield* !said.includes("\n") ? succeed$1(said) : new BadOption({
11282
11292
  option: name,
11283
11293
  given: said,
11284
11294
  allowed: ["one line of text, not empty"]
@@ -13545,7 +13555,7 @@ var init_branches$1 = __esmMin((() => {
13545
13555
  }));
13546
13556
  //#endregion
13547
13557
  //#region src/review/patches.ts
13548
- var findPatch, blobOf, wholeFile, rowAt, picked, anchorWith, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
13558
+ var findPatch, blobOf, wholeFile, rowAt, picked, anchorWith, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$3, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
13549
13559
  var init_patches = __esmMin((() => {
13550
13560
  init_dist();
13551
13561
  init_patch();
@@ -13618,7 +13628,7 @@ var init_patches = __esmMin((() => {
13618
13628
  return context ?? 3;
13619
13629
  };
13620
13630
  GENERATED_NAME = /\.generated\./;
13621
- lineOf$2 = (side, line) => match$3(line, {
13631
+ lineOf$3 = (side, line) => match$3(line, {
13622
13632
  onNone: () => ({}),
13623
13633
  onSome: (at) => ({ [side]: at })
13624
13634
  });
@@ -13628,8 +13638,8 @@ var init_patches = __esmMin((() => {
13628
13638
  text: row.text
13629
13639
  } : {
13630
13640
  kind: row.kind,
13631
- ...lineOf$2("old", row.oldLine),
13632
- ...lineOf$2("new", row.newLine),
13641
+ ...lineOf$3("old", row.oldLine),
13642
+ ...lineOf$3("new", row.newLine),
13633
13643
  text: row.text
13634
13644
  };
13635
13645
  shownHunk = (hunk) => ({
@@ -13665,15 +13675,15 @@ var init_patches = __esmMin((() => {
13665
13675
  show$3 = fn("Review.Diff.show")(function* (based, showing) {
13666
13676
  const git = yield* Git;
13667
13677
  const { worktree } = based;
13668
- const patches$2 = yield* patches(worktree, linesAround(showing.context), showing.file);
13669
- const [generated] = yield* all([git.generated(worktree, patches$2.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$2))], { concurrency: 2 });
13678
+ const patches$3 = yield* patches(worktree, linesAround(showing.context), showing.file);
13679
+ const [generated] = yield* all([git.generated(worktree, patches$3.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$3))], { concurrency: 2 });
13670
13680
  return {
13671
13681
  branch: worktree.branch,
13672
13682
  base: based.base,
13673
13683
  mergeBase: worktree.base,
13674
13684
  head: worktree.head,
13675
- files: yield* forEach(patches$2, fileShown$1(worktree, generated), { concurrency: 16 }),
13676
- order: treeOrder(patches$2.map((patch) => patch.path))
13685
+ files: yield* forEach(patches$3, fileShown$1(worktree, generated), { concurrency: 16 }),
13686
+ order: treeOrder(patches$3.map((patch) => patch.path))
13677
13687
  };
13678
13688
  });
13679
13689
  }));
@@ -13891,22 +13901,56 @@ var init_version = __esmMin((() => {
13891
13901
  total: gap.total
13892
13902
  };
13893
13903
  };
13904
+ })), lineOf$2, quietRows, quietKey, holds, quietFor, quietLayers;
13905
+ var init_quiet = __esmMin((() => {
13906
+ init_dist();
13907
+ lineOf$2 = (row) => getOrUndefined$1(orElse(row.newLine, () => row.oldLine));
13908
+ quietRows = (hunk, mine) => {
13909
+ const quiet = /* @__PURE__ */ new Set();
13910
+ if (!hunk.rows.some((row) => row.kind !== "context" && mine(row))) return quiet;
13911
+ let run = [];
13912
+ const flush = () => {
13913
+ if (run.length < 8) for (const row of run) quiet.add(row);
13914
+ run = [];
13915
+ };
13916
+ for (const row of hunk.rows) if (row.kind === "context" || mine(row)) flush();
13917
+ else run.push(row);
13918
+ flush();
13919
+ return quiet;
13920
+ };
13921
+ quietKey = (kind, line) => `${kind}:${line}`;
13922
+ holds = (spans, path, row) => {
13923
+ const line = lineOf$2(row);
13924
+ return line !== void 0 && spans.some((span) => span.path === path && span.start <= line && span.end >= line);
13925
+ };
13926
+ quietFor = (patch, spans) => patch.hunks.flatMap((hunk) => [...quietRows(hunk, (row) => holds(spans, patch.path, row))]);
13927
+ quietLayers = (patch, layers) => {
13928
+ const found = /* @__PURE__ */ new Map();
13929
+ for (const [at, spans] of layers.entries()) for (const row of quietFor(patch, spans)) {
13930
+ const line = lineOf$2(row);
13931
+ if (line === void 0) continue;
13932
+ const key = quietKey(row.kind, line);
13933
+ found.set(key, [...found.get(key) ?? [], at + 1]);
13934
+ }
13935
+ return found;
13936
+ };
13894
13937
  }));
13895
13938
  //#endregion
13896
13939
  //#region src/domain/layers/index.ts
13897
13940
  var init_layers$1 = __esmMin((() => {
13898
13941
  init_coverage();
13899
13942
  init_version();
13943
+ init_quiet();
13900
13944
  init_model$3();
13901
13945
  }));
13902
13946
  //#endregion
13903
13947
  //#region src/review/placing.ts
13904
- var keptOf, baseOf, nowOnNew, nowOnOld, writtenName, unplaced, rewordedAt, standing, searched, keyOf$3, pairOf, unique$1, nowFor, placedWithout, placedThrough, placedFrom, placeOne, nowsOf, writtenOf, pairsOf, diffsOf, placedAll, versionOf;
13948
+ var keptOf$1, baseOf, nowOnNew, nowOnOld, writtenName, unplaced, rewordedAt, standing, searched, keyOf$3, pairOf, unique$1, nowFor, placedWithout, placedThrough, placedFrom, placeOne, nowsOf, writtenOf, pairsOf, diffsOf, placedAll, versionOf;
13905
13949
  var init_placing = __esmMin((() => {
13906
13950
  init_dist();
13907
13951
  init_patch();
13908
13952
  init_git();
13909
- keptOf = (found) => getOrElse(found, () => []);
13953
+ keptOf$1 = (found) => getOrElse(found, () => []);
13910
13954
  baseOf = (worktree) => worktree.base.length > 0 ? worktree.base : "HEAD";
13911
13955
  nowOnNew = fn("Review.Placing.nowOnNew")(function* (worktree, patch) {
13912
13956
  const git = yield* Git;
@@ -13914,7 +13958,7 @@ var init_placing = __esmMin((() => {
13914
13958
  version: none(),
13915
13959
  lines: []
13916
13960
  };
13917
- const lines = keptOf(yield* git.source(worktree, patch.path));
13961
+ const lines = keptOf$1(yield* git.source(worktree, patch.path));
13918
13962
  const [version] = yield* git.keep(worktree, [patch.path]);
13919
13963
  return {
13920
13964
  version: fromNullishOr(version),
@@ -13931,7 +13975,7 @@ var init_placing = __esmMin((() => {
13931
13975
  const version = yield* git.kept(worktree, named);
13932
13976
  return {
13933
13977
  version,
13934
- lines: isNone(version) ? [] : keptOf(yield* git.blob(worktree, patch.previousPath))
13978
+ lines: isNone(version) ? [] : keptOf$1(yield* git.blob(worktree, patch.previousPath))
13935
13979
  };
13936
13980
  });
13937
13981
  writtenName = (anchor) => anchor.version ?? (anchor.side === "new" ? anchor.blob : "");
@@ -15432,7 +15476,7 @@ var init_remarks$1 = __esmMin((() => {
15432
15476
  }));
15433
15477
  //#endregion
15434
15478
  //#region src/review/vouching.ts
15435
- var pathOfMark, changedSince, readParts, restamped, now, keepMarked, fullBlob, blobIn, stateAfter, toggle, marksOf, newestFirst, speaking, contentNow, diffSince, placesIn, counted$1, nearestNew$1, touchedIn, touchedLines, holdsAny, layersTouched, untouchedParts, partsStillRead, stillRead, reportSince, isGone, goneSince, lapsedIn, sinceReview, progress, unchanged, markOf, since;
15479
+ var pathOfMark, changedSince, readParts, restamped, now, keepMarked, fullBlob, blobIn, stateAfter, toggle, marksOf, newestFirst, speaking, contentNow, diffSince, placesIn, counted$1, nearestNew$1, touchedIn, touchedLines, holdsAny, layersTouched, untouchedParts, partsStillRead, lapsedMarks, keptOf, stillRead, reportSince, isGone, goneSince, lapsedIn, sinceReview, progress, unchanged, markOf, since;
15436
15480
  var init_vouching$1 = __esmMin((() => {
15437
15481
  init_dist();
15438
15482
  init_patch();
@@ -15583,10 +15627,30 @@ var init_vouching$1 = __esmMin((() => {
15583
15627
  const since = yield* diffSince(worktree, patch.path, kept.value, 3);
15584
15628
  return untouchedParts(spans, patch.path, layersTouched(spans, patch.path, since));
15585
15629
  });
15586
- stillRead = fn("Review.Vouch.stillRead")(function* (reading, vouches, spans) {
15630
+ lapsedMarks = (patches, marks) => {
15631
+ const grouped = /* @__PURE__ */ new Map();
15632
+ for (const [key, blob] of Object.entries(marks)) {
15633
+ const patch = patches.find((one) => one.path === pathOfMark(key));
15634
+ if (patch === void 0 || sameBlob(blob, patch.blob)) continue;
15635
+ const held = grouped.get(`${patch.path}|${blob}`);
15636
+ grouped.set(`${patch.path}|${blob}`, {
15637
+ patch,
15638
+ blob,
15639
+ keys: [...held?.keys ?? [], key]
15640
+ });
15641
+ }
15642
+ return [...grouped.values()];
15643
+ };
15644
+ keptOf = (lapsed, untouched) => lapsed.keys.includes(lapsed.patch.path) ? untouched : untouched.filter((part) => lapsed.keys.includes(part));
15645
+ stillRead = fn("Review.Vouch.stillRead")(function* (reading, marks, spans) {
15587
15646
  if (spans.length === 0) return [];
15588
- const lapsed = reading.patches.filter((patch) => Object.hasOwn(vouches, patch.path) && !isVouched(vouches, patch.path, patch.blob));
15589
- return (yield* forEach(lapsed, (patch) => partsStillRead(reading.worktree, patch, vouches[patch.path] ?? "", spans), { concurrency: 8 })).flat();
15647
+ const lapsed = lapsedMarks(reading.patches, {
15648
+ ...marks.vouches,
15649
+ ...marks.parts
15650
+ });
15651
+ const keptIn = (one) => map$1(partsStillRead(reading.worktree, one.patch, one.blob, spans), (untouched) => keptOf(one, untouched));
15652
+ const found = yield* forEach(lapsed, keptIn, { concurrency: 8 });
15653
+ return [...new Set(found.flat())];
15590
15654
  });
15591
15655
  reportSince = fn("Review.Vouch.reportSince")(function* (worktree, asked, spans) {
15592
15656
  const git = yield* Git;
@@ -15645,7 +15709,7 @@ var init_vouching$1 = __esmMin((() => {
15645
15709
  const changed = changedSince([current.vouches, current.parts], files);
15646
15710
  return {
15647
15711
  vouched: files.filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
15648
- parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current.vouches, spans)],
15712
+ parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current, spans)],
15649
15713
  changed,
15650
15714
  since: yield* sinceReview(reading, current, changed, spans),
15651
15715
  total: reading.patches.length
@@ -15825,7 +15889,7 @@ var init_preferences = __esmMin((() => {
15825
15889
  }));
15826
15890
  //#endregion
15827
15891
  //#region src/review/layers.ts
15828
- var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, partIn, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, coversThread, readsFile, lastHolding, layersHolding$1, loudest, partWithThreads, withThreads, readReport, view, show$1, placeThreads, spansIn, layersAt, taggedRow, nearestNew, lineNow, taggedHunk, taggedFile, tagSince, tagRows, read, partsOfFile, vouchPart, askingFor, openAskOf, askIn, seenOf, ask, claims, vouchIn;
15892
+ var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, partIn, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, coversThread, readsFile, lastHolding, layersHolding$1, loudest, partWithThreads, withThreads, readReport, view, show$1, placeThreads, spansIn, layersAt, taggedRow, nearestNew, lineNow, taggedHunk, taggedFile, tagSince, quietRow, quietFile, tagRows, read, partsOfFile, vouchPart, carriedStamps, unmarkedPart, markedPart, askingFor, openAskOf, askIn, seenOf, ask, claims, vouchIn;
15829
15893
  var init_layers = __esmMin((() => {
15830
15894
  init_dist();
15831
15895
  init_layers$1();
@@ -16071,7 +16135,7 @@ var init_layers = __esmMin((() => {
16071
16135
  return some(withRead(report, {
16072
16136
  patches: reading.patches,
16073
16137
  vouches: current.vouches,
16074
- parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current.vouches, spans)]
16138
+ parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current, spans)]
16075
16139
  }));
16076
16140
  });
16077
16141
  view = fn("Review.Layers.view")(function* (reading) {
@@ -16126,15 +16190,31 @@ var init_layers = __esmMin((() => {
16126
16190
  });
16127
16191
  return spans.length === 0 ? shown : taggedFile(spans, shown, true);
16128
16192
  });
16193
+ quietRow = (quiet, row) => {
16194
+ const line = row.new ?? row.old;
16195
+ const quietIn = line === void 0 ? void 0 : quiet.get(quietKey(row.kind, line));
16196
+ return quietIn === void 0 ? row : {
16197
+ ...row,
16198
+ quietIn
16199
+ };
16200
+ };
16201
+ quietFile = (spans, patches, file) => {
16202
+ const patch = patches.find((one) => one.path === file.path);
16203
+ if (patch === void 0) return file;
16204
+ const quiet = quietLayers(patch, spans);
16205
+ if (quiet.size === 0) return file;
16206
+ return Object.assign({}, file, { hunks: file.hunks.map((hunk) => Object.assign({}, hunk, { rows: hunk.rows.map((row) => quietRow(quiet, row)) })) });
16207
+ };
16129
16208
  tagRows = fn("Review.Layers.tagRows")(function* (worktree, shown) {
16209
+ const patches$2 = yield* patches(worktree);
16130
16210
  const spans = yield* spansIn({
16131
16211
  worktree,
16132
- patches: yield* patches(worktree)
16212
+ patches: patches$2
16133
16213
  });
16134
16214
  if (spans.length === 0) return shown;
16135
16215
  return {
16136
16216
  ...shown,
16137
- files: shown.files.map((file) => taggedFile(spans, file))
16217
+ files: shown.files.map((file) => quietFile(spans, patches$2, taggedFile(spans, file)))
16138
16218
  };
16139
16219
  });
16140
16220
  read = fn("Review.Layers.read")(function* (reading) {
@@ -16164,32 +16244,75 @@ var init_layers = __esmMin((() => {
16164
16244
  });
16165
16245
  const blob = yield* fullBlob(reading.worktree, asked);
16166
16246
  const held = yield* read(reading);
16167
- const wanted = partsOfFile(held.layers, file);
16247
+ const spans = held.layers.map((layer) => layer.spans);
16168
16248
  const current = yield* store.state(reading.worktree.path);
16169
- const parts = vouchPart$1(current.parts, part, blob);
16170
- const vouches = (wanted.length > 0 && wanted.every((one) => isPartVouched(parts, one, blob))) === isVouched(current.vouches, file, blob) ? current.vouches : vouch$1(current.vouches, file, blob);
16249
+ const readBefore = yield* stillRead(reading, current, spans);
16250
+ const next = readBefore.includes(part) && !isPartVouched(current.parts, part, blob) ? unmarkedPart(current, file, part, readBefore) : yield* markedPart(reading, current, {
16251
+ file,
16252
+ part,
16253
+ blob,
16254
+ wanted: partsOfFile(held.layers, file),
16255
+ spans
16256
+ });
16171
16257
  yield* store.changeState(reading.worktree.path, (was) => ({
16172
16258
  ...was,
16173
- parts,
16174
- vouches,
16175
- vouchedAt: restamped(was.vouchedAt, {
16176
- ...was.vouches,
16177
- ...was.parts
16178
- }, {
16179
- ...vouches,
16180
- ...parts
16181
- }, at)
16259
+ parts: next.parts,
16260
+ vouches: next.vouches,
16261
+ vouchedAt: {
16262
+ ...restamped(was.vouchedAt, {
16263
+ ...was.vouches,
16264
+ ...was.parts
16265
+ }, {
16266
+ ...next.vouches,
16267
+ ...next.parts
16268
+ }, at),
16269
+ ...carriedStamps(next.carried, was.vouchedAt[file] ?? at)
16270
+ }
16182
16271
  }));
16183
16272
  const files = reading.patches.map((one) => ({
16184
16273
  path: one.path,
16185
16274
  blob: one.blob
16186
16275
  }));
16276
+ const readAfter = yield* stillRead(reading, next, spans);
16187
16277
  return {
16188
- vouched: files.filter((one) => isVouched(vouches, one.path, one.blob)).map((one) => one.path),
16189
- parts: readParts(parts, files),
16278
+ vouched: files.filter((one) => isVouched(next.vouches, one.path, one.blob)).map((one) => one.path),
16279
+ parts: [.../* @__PURE__ */ new Set([...readParts(next.parts, files), ...readAfter])],
16190
16280
  total: reading.patches.length
16191
16281
  };
16192
16282
  });
16283
+ carriedStamps = (carried, at) => Object.fromEntries(carried.map((key) => [key, at]));
16284
+ unmarkedPart = (current, file, part, readBefore) => {
16285
+ const { [part]: _unmarked, ...parts } = current.parts;
16286
+ const lapsed = current.vouches[file];
16287
+ if (lapsed === void 0) return {
16288
+ vouches: current.vouches,
16289
+ parts,
16290
+ carried: []
16291
+ };
16292
+ const { [file]: _whole, ...vouches } = current.vouches;
16293
+ const carried = readBefore.filter((one) => one !== part && one.startsWith(`${file}@`) && !Object.hasOwn(parts, one));
16294
+ return {
16295
+ vouches,
16296
+ parts: {
16297
+ ...parts,
16298
+ ...Object.fromEntries(carried.map((one) => [one, lapsed]))
16299
+ },
16300
+ carried
16301
+ };
16302
+ };
16303
+ markedPart = fn("Review.Layers.markedPart")(function* (reading, current, pressed) {
16304
+ const { file, blob } = pressed;
16305
+ const parts = vouchPart$1(current.parts, pressed.part, blob);
16306
+ const kept = yield* stillRead(reading, {
16307
+ vouches: current.vouches,
16308
+ parts
16309
+ }, pressed.spans);
16310
+ return {
16311
+ vouches: (pressed.wanted.length > 0 && pressed.wanted.every((one) => isPartVouched(parts, one, blob) || kept.includes(one))) === isVouched(current.vouches, file, blob) ? current.vouches : vouch$1(current.vouches, file, blob),
16312
+ parts,
16313
+ carried: []
16314
+ };
16315
+ });
16193
16316
  askingFor = (told) => {
16194
16317
  if (told.count === 0) return `${ASK_LEAD} Please write a reading order for it with \`adiff layers set\`, so the diff can be read in the order the change was made rather than by filename.`;
16195
16318
  if (told.stale) return `${ASK_LEAD} The reading order on it describes an older commit — please read the diff again and write a new one with \`adiff layers set\`.`;
@@ -17941,11 +18064,10 @@ var init_keys = __esmMin((() => {
17941
18064
  source: "raw"
17942
18065
  });
17943
18066
  };
17944
- })), FOLDS_FROM, sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf, openAbove, openBelow, elsewhereText, markElsewhere, keepQuiet, flushed, someRows, changedIn, firstChanged, makeRows, compose$1, cache, keyOf$1, saidOf, lineOf$1, inSpans, spansFor, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
18067
+ })), sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf, openAbove, openBelow, elsewhereText, markElsewhere, flushed, stays, keep, someRows, changedIn, firstChanged, makeRows, compose$1, cache, keyOf$1, saidOf, lineOf$1, inSpans, spansFor, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
17945
18068
  var init_gaps = __esmMin((() => {
17946
18069
  init_dist();
17947
18070
  init_layers$1();
17948
- FOLDS_FROM = 8;
17949
18071
  sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
17950
18072
  markerText = (hidden) => {
17951
18073
  const said = `⋯ ${hidden} ${hidden === 1 ? "line" : "lines"} hidden`;
@@ -18031,27 +18153,25 @@ var init_gaps = __esmMin((() => {
18031
18153
  text: elsewhereText(lines, said)
18032
18154
  });
18033
18155
  };
18034
- keepQuiet = (made, rows) => {
18035
- for (const row of rows) {
18036
- made.quiet.add(made.rows.length);
18037
- push(made, row);
18038
- }
18039
- };
18040
18156
  flushed = (made, run) => {
18041
- if (run === void 0) return void 0;
18042
- if (run.rows.length < FOLDS_FROM) keepQuiet(made, run.rows);
18043
- else markElsewhere(made, run.rows.length, run.said);
18157
+ if (run !== void 0) markElsewhere(made, run.lines, run.said);
18158
+ };
18159
+ stays = (row, claim, quiet) => row.kind === "context" || claim.mine(row) || quiet.has(row);
18160
+ keep = (made, row, quiet) => {
18161
+ if (quiet.has(row)) made.quiet.add(made.rows.length);
18162
+ push(made, row);
18044
18163
  };
18045
18164
  someRows = (made, hunk, claim) => {
18165
+ const quiet = quietRows(hunk, claim.mine);
18046
18166
  let run;
18047
18167
  for (const row of hunk.rows) {
18048
- if (row.kind === "context" || claim.mine(row)) {
18168
+ if (stays(row, claim, quiet)) {
18049
18169
  run = flushed(made, run);
18050
- push(made, row);
18170
+ keep(made, row, quiet);
18051
18171
  continue;
18052
18172
  }
18053
18173
  run = {
18054
- rows: [...run?.rows ?? [], row],
18174
+ lines: (run?.lines ?? 0) + 1,
18055
18175
  said: run?.said ?? claim.said(row)
18056
18176
  };
18057
18177
  }
@@ -26478,7 +26598,7 @@ const commentSend = fn("Main.commentSend")(function* (options) {
26478
26598
  const worktree = yield* worktreeIn(options);
26479
26599
  const batch = yield* submit(worktree, {
26480
26600
  ...yield* rangeIn(options, worktree),
26481
- body: yield* required(options, "body"),
26601
+ body: yield* text$1(options, "body"),
26482
26602
  id: options["id"] ?? randomUUID(),
26483
26603
  at: stamp(options)
26484
26604
  });
@@ -26492,7 +26612,7 @@ const draftAdd = fn("Main.draftAdd")(function* (options) {
26492
26612
  const worktree = yield* worktreeIn(options);
26493
26613
  const draft = yield* add$1(worktree, {
26494
26614
  ...yield* rangeIn(options, worktree),
26495
- body: yield* required(options, "body"),
26615
+ body: yield* text$1(options, "body"),
26496
26616
  id: options["id"] ?? randomUUID(),
26497
26617
  at: stamp(options),
26498
26618
  wroteBy: "agent"
@@ -26502,7 +26622,7 @@ const draftAdd = fn("Main.draftAdd")(function* (options) {
26502
26622
  const draftEdit = fn("Main.draftEdit")(function* (options) {
26503
26623
  const draft = yield* edit(yield* worktreeIn(options), {
26504
26624
  id: yield* required(options, "id"),
26505
- body: yield* required(options, "body"),
26625
+ body: yield* text$1(options, "body"),
26506
26626
  at: stamp(options),
26507
26627
  by: "agent"
26508
26628
  });
@@ -26519,7 +26639,7 @@ const draftSend = fn("Main.draftSend")(function* (options) {
26519
26639
  const commentReply = fn("Main.commentReply")(function* (options) {
26520
26640
  const batch = yield* reply(yield* worktreeIn(options), {
26521
26641
  to: yield* required(options, "to"),
26522
- body: yield* required(options, "body"),
26642
+ body: yield* text$1(options, "body"),
26523
26643
  id: options["id"] ?? randomUUID(),
26524
26644
  at: stamp(options)
26525
26645
  });
@@ -26541,7 +26661,7 @@ const commentTake = fn("Main.commentTake")(function* (options) {
26541
26661
  const commentAnswer = fn("Main.commentAnswer")(function* (options) {
26542
26662
  const report = yield* answer$3(yield* worktreeNamed(options), {
26543
26663
  id: yield* required(options, "id"),
26544
- body: yield* required(options, "body"),
26664
+ body: yield* text$1(options, "body"),
26545
26665
  asks: options["question"] !== void 0,
26546
26666
  at: stamp(options),
26547
26667
  choices: yield* choices(options, "choice")
@@ -26563,14 +26683,14 @@ const remarkList = fn("Main.remarkList")(function* (options) {
26563
26683
  const remarkAccept = fn("Main.remarkAccept")(function* (options) {
26564
26684
  const report = yield* accept(yield* readingIn(options), {
26565
26685
  id: yield* required(options, "id"),
26566
- body: options["body"],
26686
+ body: options["body"] === void 0 ? void 0 : yield* text$1(options, "body"),
26567
26687
  at: stamp(options),
26568
26688
  commentId: options["comment"] ?? randomUUID()
26569
26689
  });
26570
26690
  yield* answer(options, report);
26571
26691
  });
26572
26692
  const remarkReply = fn("Main.remarkReply")(function* (options) {
26573
- const report = yield* answer$1(yield* required(options, "repo"), yield* worktreeIn(options), yield* required(options, "id"), yield* required(options, "body"));
26693
+ const report = yield* answer$1(yield* required(options, "repo"), yield* worktreeIn(options), yield* required(options, "id"), yield* text$1(options, "body"));
26574
26694
  yield* answer(options, { answered: report.answered });
26575
26695
  });
26576
26696
  const remarkDismiss = fn("Main.remarkDismiss")(function* (options) {
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.202",
26
+ "version": "0.1.0-alpha.204",
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": {