@eliya-oss/agent-diff 0.1.0-alpha.123 → 0.1.0-alpha.125

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 +20 -0
  2. package/dist/main.js +137 -60
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.125
4
+
5
+ ### Patch Changes
6
+
7
+ - A key that toggles something says which way it will go. `f hide read` read the same whether files were hidden or shown — and the filter survives a restart, so you could open a review with files missing and nothing on screen saying so. It now reads `f show read` while hiding. Same for `f hide settled`, and `X` offers `restore` when the thread under the cursor has been removed.
8
+
9
+ `L` asks about the branch, not about the line the cursor happened to be on. The request landed as a comment card on an arbitrary import, so the agent was told to write a reading order in a thread about a line that had nothing to do with it. It is anchored to the start of the diff and says up front that it is about the branch.
10
+
11
+ Every changed file has a place in the layers rail. A file with no changed lines — a binary one, say — belonged to no layer and never reached the leftover layer either, so the rail listed seven of eight files, the two rails disagreed about the count, and `]` could never reach the eighth.
12
+
13
+ `→ N columns cut off` counted three columns that were not cut, and did not name the key that pans.
14
+
15
+ ## 0.1.0-alpha.124
16
+
17
+ ### Patch Changes
18
+
19
+ - `draft send` keeps the comments the forge did not take. A send the forge only partly accepted deleted every draft it had asked about and reported success, so comments the pull request never received were gone from disk. Only drafts the forge names back are cleared; the rest stay held, the answer says how many landed and how many are still waiting, and sending again sends only those. A reply adiff cannot read confirms nothing rather than everything.
20
+
21
+ Two sends at once post one review. They used to race, each read the whole set, and each post it, so the pull request got two identical reviews. A send now holds a lock across the whole cycle, and a second one finds nothing left to send.
22
+
3
23
  ## 0.1.0-alpha.123
4
24
 
5
25
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8819,7 +8819,7 @@ var init_error$3 = __esmMin((() => {
8819
8819
  }));
8820
8820
  //#endregion
8821
8821
  //#region src/service/forge/service.ts
8822
- var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, landedIn, review, ForgeLive;
8822
+ var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
8823
8823
  var init_service$2 = __esmMin((() => {
8824
8824
  init_dist();
8825
8825
  init_error$3();
@@ -8983,10 +8983,27 @@ var init_service$2 = __esmMin((() => {
8983
8983
  line: optionalKey(Int)
8984
8984
  }))) });
8985
8985
  readLanded = decodeUnknownEffect(Landed);
8986
+ keyOf$2 = (path, line) => `${path}:${line}`;
8987
+ counted = (back) => {
8988
+ const room = /* @__PURE__ */ new Map();
8989
+ back.forEach((one) => {
8990
+ const key = keyOf$2(one.path, one.line ?? 0);
8991
+ room.set(key, (room.get(key) ?? 0) + 1);
8992
+ });
8993
+ return room;
8994
+ };
8995
+ acknowledged = (said) => runSync(orElseSucceed(flatMap(try_(() => JSON.parse(said)), (value) => orElseSucceed(readLanded(value), () => ({ comments: void 0 }))), () => ({ comments: void 0 }))).comments;
8986
8996
  landedIn = (said, asked) => {
8987
- const back = runSync(orElseSucceed(flatMap(try_(() => JSON.parse(said)), (value) => orElseSucceed(readLanded(value), () => ({ comments: void 0 }))), () => ({ comments: void 0 }))).comments;
8988
- if (back === void 0) return asked.map((one) => `${one.path}:${one.line}`);
8989
- return back.map((one) => `${one.path}:${one.line ?? 0}`);
8997
+ const back = acknowledged(said);
8998
+ if (back === void 0) return [];
8999
+ const room = counted(back);
9000
+ return asked.flatMap((one, at) => {
9001
+ const key = keyOf$2(one.path, one.line);
9002
+ const left = room.get(key) ?? 0;
9003
+ if (left === 0) return [];
9004
+ room.set(key, left - 1);
9005
+ return [at];
9006
+ });
8990
9007
  };
8991
9008
  review = fn("Forge.review")(function* (repo, branch, comments) {
8992
9009
  const pull = yield* named(repo, branch);
@@ -9159,7 +9176,7 @@ var init_paths = __esmMin((() => {
9159
9176
  }));
9160
9177
  //#endregion
9161
9178
  //#region src/service/store/service.ts
9162
- var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, draftsOps, layersOps, inboxOps, LOCK_TRIES, LOCK_WAIT_MS, LOCK_STALE_MS, held$1, stale$1, stolen, taken, freed, stateOps, makeStore, madeStore, storeAt;
9179
+ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asDrafts, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, cursorOps, settingsOps, upgradeOps, reportOps, HEAD_REF, gitDirOf, headOf$1, repoOf$2, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT$1, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$1, stale$1, stolen, taken, freed, alone, draftsOps, stateOps, makeStore, madeStore, storeAt;
9163
9180
  var init_service$1 = __esmMin((() => {
9164
9181
  init_dist();
9165
9182
  init_error$2();
@@ -9360,27 +9377,6 @@ var init_service$1 = __esmMin((() => {
9360
9377
  })
9361
9378
  };
9362
9379
  };
9363
- draftsOps = (root, adopted) => {
9364
- return {
9365
- drafts: fn("Store.drafts")(function* (worktreePath) {
9366
- const key = yield* keyIn(adopted, worktreePath);
9367
- const path = draftsPath(root, key);
9368
- const raw = yield* readOptional(path);
9369
- if (isNone(raw)) return [];
9370
- const value = yield* jsonOf$1(path, raw.value);
9371
- return (yield* asDrafts(path, value)).drafts;
9372
- }),
9373
- saveDrafts: fn("Store.saveDrafts")(function* (worktreePath, next) {
9374
- const key = yield* keyIn(adopted, worktreePath);
9375
- const path = draftsPath(root, key);
9376
- yield* ensureDir(branchDir(root, key));
9377
- yield* writeDrafts(path, {
9378
- version: DRAFTS_VERSION,
9379
- drafts: next
9380
- });
9381
- })
9382
- };
9383
- };
9384
9380
  layersOps = (root, adopted) => {
9385
9381
  return {
9386
9382
  layers: fn("Store.layers")(function* (worktreePath) {
@@ -9417,9 +9413,16 @@ var init_service$1 = __esmMin((() => {
9417
9413
  })
9418
9414
  };
9419
9415
  };
9420
- LOCK_TRIES = 240;
9421
- LOCK_WAIT_MS = 25;
9422
- LOCK_STALE_MS = 15e3;
9416
+ STATE_LOCK = {
9417
+ tries: 240,
9418
+ waitMs: 25,
9419
+ staleMs: 15e3
9420
+ };
9421
+ DRAFTS_LOCK = {
9422
+ tries: 600,
9423
+ waitMs: 50,
9424
+ staleMs: 3e4
9425
+ };
9423
9426
  held$1 = (path) => tryPromise({
9424
9427
  try: () => writeFile(path, `${process.pid}`, { flag: "wx" }),
9425
9428
  catch: (cause) => new StoreUnwritable({
@@ -9427,13 +9430,43 @@ var init_service$1 = __esmMin((() => {
9427
9430
  reason: String(cause)
9428
9431
  })
9429
9432
  });
9430
- stale$1 = (path) => promise(() => stat(path).then((found) => Date.now() - found.mtimeMs > LOCK_STALE_MS, () => false));
9431
- stolen = (path, cause) => flatMap(stale$1(path), (old) => old ? flatMap(promise(() => rm(path, { force: true })), () => held$1(path)) : fail(cause));
9432
- taken = (path) => retry(held$1(path).pipe(catchTag("StoreUnwritable", (cause) => stolen(path, cause))), {
9433
- times: LOCK_TRIES,
9434
- schedule: spaced(LOCK_WAIT_MS)
9433
+ stale$1 = (path, waiting) => promise(() => stat(path).then((found) => Date.now() - found.mtimeMs > waiting.staleMs, () => false));
9434
+ stolen = (path, waiting, cause) => flatMap(stale$1(path, waiting), (old) => old ? flatMap(promise(() => rm(path, { force: true })), () => held$1(path)) : fail(cause));
9435
+ taken = (path, waiting) => retry(held$1(path).pipe(catchTag("StoreUnwritable", (cause) => stolen(path, waiting, cause))), {
9436
+ times: waiting.tries,
9437
+ schedule: spaced(waiting.waitMs)
9435
9438
  });
9436
9439
  freed = (path) => promise(() => rm(path, { force: true }));
9440
+ alone = (path, waiting, work) => acquireUseRelease(taken(path, waiting), () => work, () => freed(path));
9441
+ draftsOps = (root, adopted) => {
9442
+ const drafts = fn("Store.drafts")(function* (worktreePath) {
9443
+ const key = yield* keyIn(adopted, worktreePath);
9444
+ const path = draftsPath(root, key);
9445
+ const raw = yield* readOptional(path);
9446
+ if (isNone(raw)) return [];
9447
+ const value = yield* jsonOf$1(path, raw.value);
9448
+ return (yield* asDrafts(path, value)).drafts;
9449
+ });
9450
+ const saveDrafts = fn("Store.saveDrafts")(function* (worktreePath, next) {
9451
+ const key = yield* keyIn(adopted, worktreePath);
9452
+ const path = draftsPath(root, key);
9453
+ yield* ensureDir(branchDir(root, key));
9454
+ yield* writeDrafts(path, {
9455
+ version: DRAFTS_VERSION,
9456
+ drafts: next
9457
+ });
9458
+ });
9459
+ const whileHoldingDrafts = (worktreePath, work) => gen(function* () {
9460
+ const key = yield* keyIn(adopted, worktreePath);
9461
+ yield* ensureDir(branchDir(root, key));
9462
+ return yield* alone(`${draftsPath(root, key)}.lock`, DRAFTS_LOCK, work);
9463
+ }).pipe(withSpan("Store.whileHoldingDrafts"));
9464
+ return {
9465
+ drafts,
9466
+ saveDrafts,
9467
+ whileHoldingDrafts
9468
+ };
9469
+ };
9437
9470
  stateOps = (root, adopted) => {
9438
9471
  const state = fn("Store.state")(function* (worktreePath) {
9439
9472
  const key = yield* keyIn(adopted, worktreePath);
@@ -9453,8 +9486,7 @@ var init_service$1 = __esmMin((() => {
9453
9486
  const changeState = fn("Store.changeState")(function* (worktreePath, change) {
9454
9487
  const key = yield* keyIn(adopted, worktreePath);
9455
9488
  yield* ensureDir(branchDir(root, key));
9456
- const lock = `${statePath(root, key)}.lock`;
9457
- yield* acquireUseRelease(taken(lock), () => under(worktreePath, change), () => freed(lock));
9489
+ yield* alone(`${statePath(root, key)}.lock`, STATE_LOCK, under(worktreePath, change));
9458
9490
  });
9459
9491
  const under = fn("Store.under")(function* (worktreePath, change) {
9460
9492
  yield* saveState(worktreePath, change(yield* state(worktreePath)));
@@ -10062,7 +10094,7 @@ var init_preferences = __esmMin((() => {
10062
10094
  }));
10063
10095
  //#endregion
10064
10096
  //#region src/cli/error.ts
10065
- var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PullMoved, NoLayers, InitUnwritable;
10097
+ var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, InitUnwritable;
10066
10098
  var init_error = __esmMin((() => {
10067
10099
  init_dist();
10068
10100
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
@@ -10081,6 +10113,7 @@ var init_error = __esmMin((() => {
10081
10113
  BadOption = class extends TaggedError("BadOption") {};
10082
10114
  UnknownDraft = class extends TaggedError("UnknownDraft") {};
10083
10115
  NothingDrafted = class extends TaggedError("NothingDrafted") {};
10116
+ PartlySent = class extends TaggedError("PartlySent") {};
10084
10117
  PullMoved = class extends TaggedError("PullMoved") {};
10085
10118
  NoLayers = class extends TaggedError("NoLayers") {};
10086
10119
  InitUnwritable = class extends TaggedError("InitUnwritable") {};
@@ -10580,7 +10613,7 @@ var init_commands = __esmMin((() => {
10580
10613
  }));
10581
10614
  //#endregion
10582
10615
  //#region src/cli/drafts.ts
10583
- var reported, listDrafts, addDraft, editDraft, dropDraft, sameCommit, commentOf, dispatchDrafts;
10616
+ var reported, listDrafts, addDraft, editDraft, dropDraft, sameCommit, commentOf, sending, dispatchDrafts;
10584
10617
  var init_drafts = __esmMin((() => {
10585
10618
  init_dist();
10586
10619
  init_forge();
@@ -10651,10 +10684,9 @@ var init_drafts = __esmMin((() => {
10651
10684
  side: draft.anchor.side,
10652
10685
  body: draft.body
10653
10686
  });
10654
- dispatchDrafts = fn("Cli.dispatchDrafts")(function* (repo, branch) {
10687
+ sending = fn("Cli.sending")(function* (repo, branch, worktree) {
10655
10688
  const store = yield* Store;
10656
10689
  const forge = yield* Forge;
10657
- const worktree = yield* findBranch(repo, branch);
10658
10690
  const held = yield* store.drafts(worktree.path);
10659
10691
  if (held.length === 0) return yield* new NothingDrafted({ branch });
10660
10692
  const head = yield* forge.head(repo, branch);
@@ -10664,15 +10696,31 @@ var init_drafts = __esmMin((() => {
10664
10696
  now: head
10665
10697
  });
10666
10698
  const sent = yield* forge.review(repo, branch, held.map(commentOf));
10667
- const gone = new Set(held.map((one) => one.id));
10668
- const waiting = (yield* store.drafts(worktree.path)).filter((one) => !gone.has(one.id));
10699
+ const gone = new Set(sent.landed.map((at) => held[at]?.id));
10700
+ const kept = held.filter((one) => !gone.has(one.id));
10701
+ const asked = new Set(held.map((one) => one.id));
10702
+ const since = (yield* store.drafts(worktree.path)).filter((one) => !asked.has(one.id));
10703
+ const waiting = [...kept, ...since];
10669
10704
  yield* store.saveDrafts(worktree.path, waiting);
10705
+ if (kept.length > 0) return yield* new PartlySent({
10706
+ branch,
10707
+ url: sent.url,
10708
+ sent: held.length - kept.length,
10709
+ held: waiting.length,
10710
+ landed: held.filter((one) => gone.has(one.id)).map((one) => one.id),
10711
+ kept: kept.map((one) => one.id)
10712
+ });
10670
10713
  return {
10671
- sent: sent.landed.length,
10714
+ sent: held.length,
10672
10715
  url: sent.url,
10673
- held: waiting.length
10716
+ held: since.length
10674
10717
  };
10675
10718
  });
10719
+ dispatchDrafts = fn("Cli.dispatchDrafts")(function* (repo, branch) {
10720
+ const store = yield* Store;
10721
+ const worktree = yield* findBranch(repo, branch);
10722
+ return yield* store.whileHoldingDrafts(worktree.path, sending(repo, branch, worktree));
10723
+ });
10676
10724
  }));
10677
10725
  //#endregion
10678
10726
  //#region src/cli/init.ts
@@ -10929,7 +10977,7 @@ var init_pane = __esmMin((() => {
10929
10977
  init_drafts();
10930
10978
  init_init();
10931
10979
  init_pane();
10932
- var version$1 = "0.1.0-alpha.123";
10980
+ var version$1 = "0.1.0-alpha.125";
10933
10981
  //#endregion
10934
10982
  //#region src/cli/upgrade.ts
10935
10983
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -11191,7 +11239,7 @@ var init_model$1 = __esmMin((() => {
11191
11239
  }));
11192
11240
  //#endregion
11193
11241
  //#region src/domain/layers/coverage.ts
11194
- var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, missingSaid, withFullCoverage, proseAnchors;
11242
+ var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, missingSaid, unordered, withFullCoverage, proseAnchors;
11195
11243
  var init_coverage = __esmMin((() => {
11196
11244
  init_dist();
11197
11245
  init_model$1();
@@ -11248,15 +11296,25 @@ var init_coverage = __esmMin((() => {
11248
11296
  };
11249
11297
  };
11250
11298
  missingSaid = (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.`;
11299
+ unordered = (patches, layers, missing) => {
11300
+ const named = /* @__PURE__ */ new Set([...spansOf$1(layers).map((span) => span.path), ...missing.map((span) => span.path)]);
11301
+ return patches.filter((patch) => !named.has(patch.path)).map((patch) => ({
11302
+ path: patch.path,
11303
+ start: 1,
11304
+ end: 1
11305
+ }));
11306
+ };
11251
11307
  withFullCoverage = (patches, layers) => {
11252
11308
  const gap = coverage(patches, layers.layers);
11253
- if (gap.missing.length === 0) return layers;
11309
+ const left = unordered(patches, layers.layers, gap.missing);
11310
+ const spans = [...gap.missing, ...left];
11311
+ if (spans.length === 0) return layers;
11254
11312
  const remainder = {
11255
11313
  title: REMAINDER_TITLE,
11256
11314
  blocks: [{
11257
11315
  kind: "prose",
11258
11316
  markdown: missingSaid(gap.missing.length)
11259
- }, ...gap.missing.map((span) => codeBlockOf$1(span))]
11317
+ }, ...spans.map((span) => codeBlockOf$1(span))]
11260
11318
  };
11261
11319
  return {
11262
11320
  ...layers,
@@ -12480,6 +12538,11 @@ var init_report$1 = __esmMin((() => {
12480
12538
  suggestion: "Nothing is being held for this review. Write a comment on the pull request first; `adiff draft list` reports what is waiting.",
12481
12539
  retriable: false
12482
12540
  },
12541
+ PartlySent: {
12542
+ exit: 1,
12543
+ suggestion: "The forge confirmed some of the comments and said nothing about the rest. What it confirmed is on the pull request; what it did not is still held, listed under kept. Run the same send again to send only those.",
12544
+ retriable: true
12545
+ },
12483
12546
  PullMoved: {
12484
12547
  exit: 1,
12485
12548
  suggestion: "The pull request has moved since these comments were written, so they name lines that may no longer be there. Nothing was sent and nothing was lost. Read the diff again and check each draft still says what you mean.",
@@ -12940,7 +13003,7 @@ var init_tree = __esmMin((() => {
12940
13003
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
12941
13004
  };
12942
13005
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
12943
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, layerBody, layerRows, nearFirst, layerFitted, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13006
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, layerBody, layerRows, nearFirst, layerFitted, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
12944
13007
  var init_model = __esmMin((() => {
12945
13008
  init_dist();
12946
13009
  init_patch();
@@ -13412,6 +13475,7 @@ var init_model = __esmMin((() => {
13412
13475
  return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && lineOnSide(here, entry.side) === entry.end);
13413
13476
  };
13414
13477
  stopsAtRow = (state, row) => 1 + threadsAtRow(state, row).length;
13478
+ threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
13415
13479
  threadAtStop = (state) => state.stop === 0 ? void 0 : threadsAtRow(state, state.cursor)[state.stop - 1];
13416
13480
  threadAtRow = (state, row) => {
13417
13481
  const patch = selectedPatch(state);
@@ -13640,7 +13704,7 @@ var init_watch = __esmMin((() => {
13640
13704
  }));
13641
13705
  //#endregion
13642
13706
  //#region src/tui/command.ts
13643
- var EVERY_PANE, command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, glossaryFor, actionFor, GLYPHS, displayKey, hintOf, hintsFor;
13707
+ var EVERY_PANE, command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, glossaryFor, actionFor, GLYPHS, displayKey, SWAPPED, hintOf, hintsFor;
13644
13708
  var init_command = __esmMin((() => {
13645
13709
  EVERY_PANE = [
13646
13710
  "tree",
@@ -14353,8 +14417,15 @@ var init_command = __esmMin((() => {
14353
14417
  if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
14354
14418
  return GLYPHS[key] ?? key;
14355
14419
  };
14420
+ SWAPPED = {
14421
+ "rail.toggle": (offered) => offered.onLayers ? "file tree" : "layers",
14422
+ "tree.winnow": (offered) => offered.hidingRead ? "show read" : "hide read",
14423
+ "panel.winnow": (offered) => offered.hidingSettled ? "show settled" : "hide settled",
14424
+ "thread.remove": (offered) => offered.onRemoved ? "restore" : "remove"
14425
+ };
14356
14426
  hintOf = (entry, offered) => {
14357
- if (entry.action === "rail.toggle") return offered.onLayers ? "file tree" : "layers";
14427
+ const swapped = SWAPPED[entry.action];
14428
+ if (swapped !== void 0) return swapped(offered);
14358
14429
  return entry.counted ? `${entry.hint} ${offered.comments}` : entry.hint;
14359
14430
  };
14360
14431
  hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenComments || offered.comments > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenSelecting || offered.selecting).filter((entry) => !entry.whenReviewed || offered.reviewed > 0).filter((entry) => !entry.whenPull || offered.pull).filter((entry) => entry.panes.includes(offered.pane)).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
@@ -15659,6 +15730,9 @@ var init_diffview = __esmMin((() => {
15659
15730
  panLimit() {
15660
15731
  return this.wrapped ? 0 : Math.max(this.code.maxScrollX, this.pinned.maxScrollX);
15661
15732
  }
15733
+ cutOff() {
15734
+ return this.wrapped ? 0 : this.code.maxScrollX;
15735
+ }
15662
15736
  setPan(columns) {
15663
15737
  const wanted = Math.max(0, Math.min(this.panLimit(), columns));
15664
15738
  if (wanted !== this.held) {
@@ -16651,7 +16725,7 @@ var init_render = __esmMin((() => {
16651
16725
  panLabel = (state, across) => {
16652
16726
  if (across.pan > 0) return `→ ${across.pan} columns`;
16653
16727
  if (state.wrap || across.cutOff === 0) return "";
16654
- return `→ ${across.cutOff} columns cut off`;
16728
+ return `→ ${across.cutOff} columns cut off, > pans`;
16655
16729
  };
16656
16730
  HEADER_GAP = 2;
16657
16731
  HEADER_PATH_MIN = 20;
@@ -17082,7 +17156,10 @@ var init_render = __esmMin((() => {
17082
17156
  reviewed: reviewedCountIn(state),
17083
17157
  pull: pullHere(state).length > 0,
17084
17158
  pane: state.screen === "review" ? state.focus : "diff",
17085
- onLayers: onLayers(state)
17159
+ onLayers: onLayers(state),
17160
+ hidingRead: state.hideReviewed,
17161
+ hidingSettled: state.hideSettled,
17162
+ onRemoved: threadHere(state)?.removed === true
17086
17163
  });
17087
17164
  this.header.content = this.headerText(state);
17088
17165
  this.footer.content = this.footerText(state);
@@ -17153,7 +17230,7 @@ var init_render = __esmMin((() => {
17153
17230
  const path = selectedPatch(state)?.path ?? "";
17154
17231
  const parts = headerParts(state, branch?.branch ?? "", path, {
17155
17232
  pan: Math.min(state.pan, this.view.panLimit()),
17156
- cutOff: this.view.panLimit()
17233
+ cutOff: this.view.cutOff()
17157
17234
  }).filter((part) => part.length > 0);
17158
17235
  const [name = "", ...rest] = headerFitted(parts, path, headerRoom(this.renderer.width));
17159
17236
  return t`${fg(palette.ink)(name)} ${fg(palette.muted)(rest.join(" "))}`;
@@ -17659,7 +17736,7 @@ var init_upgrade = __esmMin((() => {
17659
17736
  }));
17660
17737
  //#endregion
17661
17738
  //#region src/tui/app.ts
17662
- var LEAVING_MS, LOOK_MS, LEAVING_SAID, NOTHING_WRITTEN, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, threadHere, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
17739
+ var LEAVING_MS, LOOK_MS, LEAVING_SAID, NOTHING_WRITTEN, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
17663
17740
  var init_app = __esmMin((() => {
17664
17741
  init_dist();
17665
17742
  init_report();
@@ -17681,10 +17758,11 @@ var init_app = __esmMin((() => {
17681
17758
  LOOK_MS = 110;
17682
17759
  LEAVING_SAID = "press ctrl+c again to leave";
17683
17760
  NOTHING_WRITTEN = "nothing written yet";
17761
+ LAYERS_ASK_LEAD = "About this branch, not about this line.";
17684
17762
  layersAsk = (state) => {
17685
- if (state.layers.length === 0) return "Please write a reading order for this branch with `adiff layers set`, so the diff can be read in the order the change was made rather than by filename.";
17686
- if (state.layersStale) return "The reading order on this branch describes an older commit. Please read the diff again and write a new one with `adiff layers set`.";
17687
- return "Please revise the reading order on this branch with `adiff layers set`.";
17763
+ if (state.layers.length === 0) return `${LAYERS_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.`;
17764
+ if (state.layersStale) return `${LAYERS_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\`.`;
17765
+ return `${LAYERS_ASK_LEAD} Please revise its reading order with \`adiff layers set\`.`;
17688
17766
  };
17689
17767
  askedFor = (state) => state.layers.length === 0 ? "asked for a reading order" : "asked for a new reading order";
17690
17768
  alongFrom = (state) => {
@@ -18882,7 +18960,7 @@ var init_app = __esmMin((() => {
18882
18960
  }
18883
18961
  askForLayers() {
18884
18962
  return gen({ self: this }, function* () {
18885
- const patch = selectedPatch(this.state);
18963
+ const patch = this.state.patches[0];
18886
18964
  const branch = selectedBranch(this.state);
18887
18965
  if (patch === void 0 || branch === void 0) return;
18888
18966
  yield* this.commenting(branch.branch, {
@@ -18931,7 +19009,6 @@ var init_app = __esmMin((() => {
18931
19009
  });
18932
19010
  }
18933
19011
  };
18934
- threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
18935
19012
  sentAway = (state) => ({
18936
19013
  ...state,
18937
19014
  screen: "review",
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.123",
26
+ "version": "0.1.0-alpha.125",
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": {