@eliya-oss/agent-diff 0.1.0-alpha.160 → 0.1.0-alpha.162

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 +12 -0
  2. package/dist/main.js +126 -45
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.162
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(layers): Marking a file read on one layer no longer marks it read on the others. Where several layers claim one file, `m` records the layer's own runs, and the file counts as read once every layer's runs of it are read.
8
+
9
+ ## 0.1.0-alpha.161
10
+
11
+ ### Patch Changes
12
+
13
+ - fix(diff): `e` opens a line inside its project — an editor that takes a folder is handed the branch's worktree with the file, and every editor is started in that worktree — and a command you type yourself is offered back as the command to keep.
14
+
3
15
  ## 0.1.0-alpha.160
4
16
 
5
17
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9244,6 +9244,7 @@ var init_model$6 = __esmMin((() => {
9244
9244
  emptyBranchState = {
9245
9245
  taken: {},
9246
9246
  vouches: {},
9247
+ parts: {},
9247
9248
  consumed: 0,
9248
9249
  settled: {},
9249
9250
  removed: {},
@@ -9303,6 +9304,7 @@ var init_schema = __esmMin((() => {
9303
9304
  BranchState = Struct({
9304
9305
  taken: optionalKey(Record(String$1, String$1)),
9305
9306
  vouches: Stamps.pipe(noStamps),
9307
+ parts: Stamps.pipe(noStamps),
9306
9308
  consumed: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
9307
9309
  settled: Stamps.pipe(noStamps),
9308
9310
  removed: Stamps.pipe(noStamps),
@@ -10458,7 +10460,7 @@ var init_git = __esmMin((() => {
10458
10460
  }));
10459
10461
  //#endregion
10460
10462
  //#region src/domain/review/vouch.ts
10461
- var isVouched, vouch;
10463
+ var isVouched, vouch, partOf, isPartVouched, vouchPart;
10462
10464
  var init_vouch = __esmMin((() => {
10463
10465
  isVouched = (vouches, path, blob) => vouches[path] === blob;
10464
10466
  vouch = (vouches, path, blob) => {
@@ -10471,6 +10473,11 @@ var init_vouch = __esmMin((() => {
10471
10473
  [path]: blob
10472
10474
  };
10473
10475
  };
10476
+ partOf = (path, runs) => {
10477
+ return `${path}@${[...runs].toSorted((left, right) => left.start - right.start || left.end - right.end).map((run) => `${run.start}-${run.end}`).join(",")}`;
10478
+ };
10479
+ isPartVouched = (vouches, part, blob) => vouches[part] === blob;
10480
+ vouchPart = (vouches, part, blob) => vouch(vouches, part, blob);
10474
10481
  }));
10475
10482
  //#endregion
10476
10483
  //#region src/domain/review/index.ts
@@ -10570,7 +10577,7 @@ var init_error = __esmMin((() => {
10570
10577
  }));
10571
10578
  //#endregion
10572
10579
  //#region src/cli/commands.ts
10573
- var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$2, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, listRefs, setBase, clearBase, markRead;
10580
+ var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, readParts, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$2, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, listRefs, setBase, clearBase, markRead;
10574
10581
  var init_commands = __esmMin((() => {
10575
10582
  init_dist();
10576
10583
  init_patch();
@@ -10710,6 +10717,10 @@ var init_commands = __esmMin((() => {
10710
10717
  const worktrees = yield* (yield* Git).worktrees(repo);
10711
10718
  return (yield* forEach(worktrees, (found) => summaryOf(repo, found, base), { concurrency: 8 })).filter((summary) => summary.files > 0);
10712
10719
  });
10720
+ readParts = (parts, files) => {
10721
+ const blobs = new Map(files.map((file) => [file.path, file.blob]));
10722
+ return Object.entries(parts).filter(([part, blob]) => blobs.get(part.split("@")[0] ?? "") === blob).map(([part]) => part);
10723
+ };
10713
10724
  blobOf = (patches, file) => map$4(findPatch(patches, file), (patch) => patch.blob);
10714
10725
  vouchIn = fn("Cli.vouchIn")(function* (reading, file) {
10715
10726
  const store = yield* Store;
@@ -10727,11 +10738,13 @@ var init_commands = __esmMin((() => {
10727
10738
  ...was,
10728
10739
  vouches: vouch(was.vouches, file, blob)
10729
10740
  }));
10741
+ const files = patches.map((patch) => ({
10742
+ path: patch.path,
10743
+ blob: patch.blob
10744
+ }));
10730
10745
  return {
10731
- vouched: patches.map((patch) => ({
10732
- path: patch.path,
10733
- blob: patch.blob
10734
- })).filter((one) => isVouched(next, one.path, one.blob)).map((one) => one.path),
10746
+ vouched: files.filter((one) => isVouched(next, one.path, one.blob)).map((one) => one.path),
10747
+ parts: readParts(current.parts, files),
10735
10748
  total: patches.length
10736
10749
  };
10737
10750
  });
@@ -10747,11 +10760,13 @@ var init_commands = __esmMin((() => {
10747
10760
  });
10748
10761
  progressIn = fn("Cli.progressIn")(function* (reading) {
10749
10762
  const current = yield* (yield* Store).state(reading.worktree.path);
10763
+ const files = reading.patches.map((patch) => ({
10764
+ path: patch.path,
10765
+ blob: patch.blob
10766
+ }));
10750
10767
  return {
10751
- vouched: reading.patches.map((patch) => ({
10752
- path: patch.path,
10753
- blob: patch.blob
10754
- })).filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
10768
+ vouched: files.filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
10769
+ parts: readParts(current.parts, files),
10755
10770
  total: reading.patches.length
10756
10771
  };
10757
10772
  });
@@ -11328,7 +11343,7 @@ var init_pane = __esmMin((() => {
11328
11343
  //#region package.json
11329
11344
  init_drafts();
11330
11345
  init_pane();
11331
- var version$1 = "0.1.0-alpha.160";
11346
+ var version$1 = "0.1.0-alpha.162";
11332
11347
  //#endregion
11333
11348
  //#region src/cli/upgrade.ts
11334
11349
  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$1, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
@@ -11888,13 +11903,14 @@ var init_layers$1 = __esmMin((() => {
11888
11903
  }));
11889
11904
  //#endregion
11890
11905
  //#region src/cli/layers.ts
11891
- var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, resolve$1, resolveAll, worktreeAt, storedLayers, setLayers, showLayers, layersIn;
11906
+ var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, resolve$1, resolveAll, worktreeAt, storedLayers, setLayers, showLayers, layersIn, partsOfFile, vouchPartIn;
11892
11907
  var init_layers = __esmMin((() => {
11893
11908
  init_dist();
11894
11909
  init_layers$1();
11895
11910
  init_git();
11896
11911
  init_store();
11897
11912
  init_commands();
11913
+ init_review();
11898
11914
  init_error();
11899
11915
  STALE_ADVICE = "These layers describe an older commit. Read the diff again and write a new revision with layers set.";
11900
11916
  unique = (paths) => [...new Set(paths)];
@@ -12097,6 +12113,30 @@ var init_layers = __esmMin((() => {
12097
12113
  summary: found.value.summary
12098
12114
  };
12099
12115
  });
12116
+ partsOfFile = (layers, file) => layers.map((layer) => layer.spans.filter((span) => span.path === file)).filter((spans) => spans.length > 0).map((spans) => partOf(file, spans));
12117
+ vouchPartIn = fn("Cli.vouchPartIn")(function* (reading, file, part) {
12118
+ const store = yield* Store;
12119
+ const blob = reading.patches.find((one) => one.path === file)?.blob ?? "";
12120
+ const held = yield* layersIn(reading);
12121
+ const wanted = partsOfFile(held.layers, file);
12122
+ const current = yield* store.state(reading.worktree.path);
12123
+ const parts = vouchPart(current.parts, part, blob);
12124
+ const vouches = (wanted.length > 0 && wanted.every((one) => isPartVouched(parts, one, blob))) === isVouched(current.vouches, file, blob) ? current.vouches : vouch(current.vouches, file, blob);
12125
+ yield* store.changeState(reading.worktree.path, (was) => ({
12126
+ ...was,
12127
+ parts,
12128
+ vouches
12129
+ }));
12130
+ const files = reading.patches.map((one) => ({
12131
+ path: one.path,
12132
+ blob: one.blob
12133
+ }));
12134
+ return {
12135
+ vouched: files.filter((one) => isVouched(vouches, one.path, one.blob)).map((one) => one.path),
12136
+ parts: readParts(parts, files),
12137
+ total: reading.patches.length
12138
+ };
12139
+ });
12100
12140
  }));
12101
12141
  //#endregion
12102
12142
  //#region src/cli/threads.ts
@@ -13947,11 +13987,12 @@ var init_tree = __esmMin((() => {
13947
13987
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13948
13988
  };
13949
13989
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13950
- })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, nothingFound, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, remarkAnswering, answerTarget, replyTarget, threadReplying, VOICES, remarkQuote, threadQuote, pickedText, takenRows, selectedLines, shownMatches, refsShown, picking, refHere, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, threadsAtRow, remarkShown, remarksAtRow, remarkRowsIn, stopsIn, stopsAtRow, remarkAtStop, remarkAtRow, remarkInPanel, remarkInDiff, remarkUnderCursor, remarkToTakeOn, remarkHere, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, remarkRows, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13990
+ })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, nothingFound, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, partHere, layersHolding, readIn, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, remarkAnswering, answerTarget, replyTarget, threadReplying, VOICES, remarkQuote, threadQuote, pickedText, takenRows, selectedLines, shownMatches, refsShown, picking, refHere, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, threadsAtRow, remarkShown, remarksAtRow, remarkRowsIn, stopsIn, stopsAtRow, remarkAtStop, remarkAtRow, remarkInPanel, remarkInDiff, remarkUnderCursor, remarkToTakeOn, remarkHere, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, remarkRows, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13951
13991
  var init_model$1 = __esmMin((() => {
13952
13992
  init_dist();
13953
13993
  init_patch();
13954
13994
  init_preferences();
13995
+ init_review();
13955
13996
  init_gaps();
13956
13997
  init_tree();
13957
13998
  HOLDS = {
@@ -14033,6 +14074,7 @@ var init_model$1 = __esmMin((() => {
14033
14074
  returnTo: "branches",
14034
14075
  closed: [],
14035
14076
  vouched: [],
14077
+ partsRead: [],
14036
14078
  sent: [],
14037
14079
  remarks: [],
14038
14080
  viewport: 20,
@@ -14155,7 +14197,7 @@ var init_model$1 = __esmMin((() => {
14155
14197
  text: clip(name, room),
14156
14198
  lead: false,
14157
14199
  fileIndex: at,
14158
- reviewed: isReviewed(state, at),
14200
+ reviewed: readIn(state, layerIndex, at),
14159
14201
  here: at === state.patchIndex && layerIndex === state.layerIndex
14160
14202
  };
14161
14203
  };
@@ -14182,7 +14224,7 @@ var init_model$1 = __esmMin((() => {
14182
14224
  layerRead = (state, layerIndex) => {
14183
14225
  const files = layerHolds(state, layerIndex);
14184
14226
  return {
14185
- done: files.filter((at) => isReviewed(state, at)).length,
14227
+ done: files.filter((at) => readIn(state, layerIndex, at)).length,
14186
14228
  all: files.length
14187
14229
  };
14188
14230
  };
@@ -14304,6 +14346,19 @@ var init_model$1 = __esmMin((() => {
14304
14346
  const patch = state.patches[fileIndex];
14305
14347
  return patch !== void 0 && state.vouched.includes(patch.path);
14306
14348
  };
14349
+ partHere = (state, layerIndex, fileIndex) => {
14350
+ const path = state.patches[fileIndex]?.path;
14351
+ const layer = state.layers[layerIndex];
14352
+ if (path === void 0 || layer === void 0) return void 0;
14353
+ const spans = layer.spans.filter((span) => span.path === path);
14354
+ return spans.length === 0 ? void 0 : partOf(path, spans);
14355
+ };
14356
+ layersHolding = (state, fileIndex) => state.layers.filter((layer) => layer.spans.some((span) => span.path === state.patches[fileIndex]?.path)).length;
14357
+ readIn = (state, layerIndex, fileIndex) => {
14358
+ if (isReviewed(state, fileIndex)) return true;
14359
+ const part = partHere(state, layerIndex, fileIndex);
14360
+ return part !== void 0 && state.partsRead.includes(part);
14361
+ };
14307
14362
  treeStart = (state, height) => {
14308
14363
  const rows = treeRows(state);
14309
14364
  if (rows.length <= height) return 0;
@@ -14908,18 +14963,19 @@ var init_report = __esmMin((() => {
14908
14963
  var KNOWN, LINED, named, shaped, guessed, KNOWN_EDITORS, editorsAround, templateFor, openingOf;
14909
14964
  var init_model = __esmMin((() => {
14910
14965
  KNOWN = [
14911
- ["vscode", "code --goto {file}:{line}"],
14912
- ["cursor", "cursor --goto {file}:{line}"],
14913
- ["windsurf", "windsurf --goto {file}:{line}"],
14914
- ["zed", "zed {file}:{line}"],
14966
+ ["vscode", "code {repo} --goto {file}:{line}"],
14967
+ ["cursor", "cursor {repo} --goto {file}:{line}"],
14968
+ ["windsurf", "windsurf {repo} --goto {file}:{line}"],
14969
+ ["zed", "zed {repo} {file}:{line}"],
14915
14970
  ["jetbrains", "idea --line {line} {file}"]
14916
14971
  ];
14917
14972
  LINED = [
14918
- ["code", "{command} --goto {file}:{line}"],
14919
- ["cursor", "{command} --goto {file}:{line}"],
14920
- ["zed", "{command} {file}:{line}"],
14973
+ ["code", "{command} {repo} --goto {file}:{line}"],
14974
+ ["cursor", "{command} {repo} --goto {file}:{line}"],
14975
+ ["windsurf", "{command} {repo} --goto {file}:{line}"],
14976
+ ["zed", "{command} {repo} {file}:{line}"],
14921
14977
  ["idea", "{command} --line {line} {file}"],
14922
- ["subl", "{command} {file}:{line}"],
14978
+ ["subl", "{command} {repo} {file}:{line}"],
14923
14979
  ["vim", "{command} +{line} {file}"],
14924
14980
  ["nvim", "{command} +{line} {file}"],
14925
14981
  ["hx", "{command} {file}:{line}"],
@@ -14954,8 +15010,8 @@ var init_model = __esmMin((() => {
14954
15010
  const asked = told.editor ?? told.visual ?? told.fallback;
14955
15011
  return asked === void 0 || asked.trim().length === 0 ? guessed(told) : shaped(asked);
14956
15012
  };
14957
- openingOf = (template, file, line) => {
14958
- const [command, ...args] = template.replaceAll("{file}", file).replaceAll("{line}", String(line)).trim().split(/\s+/);
15013
+ openingOf = (template, file, line, repo) => {
15014
+ const [command, ...args] = template.replaceAll("{repo}", repo).replaceAll("{file}", file).replaceAll("{line}", String(line)).trim().split(/\s+/);
14959
15015
  return command === void 0 ? void 0 : {
14960
15016
  command,
14961
15017
  args
@@ -16738,9 +16794,10 @@ var init_reduce = __esmMin((() => {
16738
16794
  ...state,
16739
16795
  source
16740
16796
  });
16741
- withVouched = (state, vouched) => ({
16797
+ withVouched = (state, vouched, parts) => ({
16742
16798
  ...state,
16743
- vouched
16799
+ vouched,
16800
+ partsRead: parts ?? state.partsRead
16744
16801
  });
16745
16802
  restoredTo = (state, path, line, offset) => {
16746
16803
  const index = state.patches.findIndex((patch) => patch.path === path);
@@ -17726,7 +17783,7 @@ var init_diffview = __esmMin((() => {
17726
17783
  }));
17727
17784
  //#endregion
17728
17785
  //#region src/tui/render.ts
17729
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, LEGEND_ROWS, LEGEND, legendText, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeBaseParts, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, counting, foundBlocks, JOIN, foundTitle, CHANGED_MARK, DECLARED, fileRow, leftRow, placeRow, blockOf, aroundRow, windowedBlocks, pickingTitle, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, lostCode, lostEntry, writtenOn, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
17786
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, LEGEND_ROWS, LEGEND, legendText, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeBaseParts, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, counting, foundBlocks, JOIN, foundTitle, CHANGED_MARK, DECLARED, fileRow, leftRow, placeRow, blockOf, aroundRow, windowedBlocks, pickingTitle, YOURS, YOUR_REF, pickedTail, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, lostCode, lostEntry, writtenOn, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
17730
17787
  var init_render = __esmMin((() => {
17731
17788
  init_dist();
17732
17789
  init_command();
@@ -18765,6 +18822,12 @@ var init_render = __esmMin((() => {
18765
18822
  const on = here === void 0 ? "" : `${here.base}${here.basis === "set" ? "" : ", adiff's guess"}`;
18766
18823
  return `Base for ${here?.branch ?? "this branch"}${on.length === 0 ? "" : ` — now ${on}`}`;
18767
18824
  };
18825
+ YOURS = " ← the command you typed";
18826
+ YOUR_REF = " ← the ref you typed";
18827
+ pickedTail = (state, ref, typed) => {
18828
+ if (typed.length === 0 || ref !== typed || state.refs.includes(ref)) return "";
18829
+ return state.screen === "editor" ? YOURS : YOUR_REF;
18830
+ };
18768
18831
  REMARK_MARK = "◇";
18769
18832
  remarkWhere = (remark, known) => {
18770
18833
  if (remark.placed) return `:${remark.end}`;
@@ -19156,7 +19219,8 @@ var init_render = __esmMin((() => {
19156
19219
  this.baseBox.title.content = clip(pickingTitle(state), room - MODAL_ROOM);
19157
19220
  this.baseBox.query.visible = true;
19158
19221
  const tall = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), shown.length + PALETTE_CHROME + 1);
19159
- this.baseBox.choices.content = listText(shown.map((ref) => clip(` ${ref}`, room - MODAL_ROOM)), Math.min(state.refIndex, Math.max(0, shown.length - 1)), Math.max(1, tall - PALETTE_CHROME - 1));
19222
+ const typed = state.query.trim();
19223
+ this.baseBox.choices.content = listText(shown.map((ref) => clip(` ${ref}${pickedTail(state, ref, typed)}`, room - MODAL_ROOM)), Math.min(state.refIndex, Math.max(0, shown.length - 1)), Math.max(1, tall - PALETTE_CHROME - 1));
19160
19224
  this.baseBox.box.height = tall;
19161
19225
  this.baseBox.box.width = room;
19162
19226
  this.baseBox.box.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
@@ -19806,11 +19870,12 @@ var init_app = __esmMin((() => {
19806
19870
  if (process.env["TMUX"] !== void 0) return `\u001BPtmux;\u001B${sequence}\u001B\\`;
19807
19871
  return process.env["STY"] === void 0 ? sequence : `\u001BP${sequence}\u001B\\`;
19808
19872
  };
19809
- ranAside = (command, args) => {
19873
+ ranAside = (command, args, from) => {
19810
19874
  try {
19811
19875
  const child = spawn(command, [...args], {
19812
19876
  detached: true,
19813
- stdio: "ignore"
19877
+ stdio: "ignore",
19878
+ cwd: from
19814
19879
  });
19815
19880
  child.on("error", () => void 0);
19816
19881
  child.unref();
@@ -21109,25 +21174,31 @@ var init_app = __esmMin((() => {
21109
21174
  const branch = selectedBranch(this.state);
21110
21175
  const patch = selectedPatch(this.state);
21111
21176
  if (branch === void 0 || patch === void 0) return;
21112
- if (advance && isReviewed(this.state, this.state.patchIndex)) {
21177
+ if (advance && this.readHere()) {
21113
21178
  this.commit(alongFrom(this.state));
21114
21179
  return;
21115
21180
  }
21116
21181
  const report = yield* this.vouching(branch.branch, patch.path);
21117
- const marked = report.vouched.includes(patch.path);
21118
- const next = withVouched(this.state, report.vouched);
21182
+ const next = withVouched(this.state, report.vouched, report.parts);
21119
21183
  if (!advance) {
21120
- this.commit(withNotice(next, marked ? `marked ${patch.path}` : `unmarked ${patch.path}`));
21184
+ this.commit(withNotice(next, this.markedSaid(report, patch.path)));
21121
21185
  return;
21122
21186
  }
21123
- const target = nextUnreviewed(next, next.patchIndex);
21124
- if (target === void 0) {
21125
- this.commit(withNotice(next, "every file reviewed"));
21126
- return;
21127
- }
21128
- this.commit(withNotice(atFile(next, target), `marked ${patch.path}`));
21187
+ this.movedOn(next, patch.path);
21129
21188
  });
21130
21189
  }
21190
+ markedSaid(report, path) {
21191
+ const part = this.partHereNow();
21192
+ return (part === void 0 ? report.vouched.includes(path) : report.parts.includes(part)) ? `marked ${path}` : `unmarked ${path}`;
21193
+ }
21194
+ movedOn(next, path) {
21195
+ const target = nextUnreviewed(next, next.patchIndex);
21196
+ if (target === void 0) {
21197
+ this.commit(withNotice(next, "every file reviewed"));
21198
+ return;
21199
+ }
21200
+ this.commit(withNotice(atFile(next, target), `marked ${path}`));
21201
+ }
21131
21202
  forgetLeaving() {
21132
21203
  if (this.leaving === void 0) return;
21133
21204
  this.leaving = void 0;
@@ -21174,13 +21245,22 @@ var init_app = __esmMin((() => {
21174
21245
  const worktree = this.worktreeFor(branch);
21175
21246
  return worktree === void 0 ? removeComment(this.repo, branch, id, at) : removeIn(worktree, id, at);
21176
21247
  }
21248
+ readHere() {
21249
+ return onLayers(this.state) ? readIn(this.state, this.state.layerIndex, this.state.patchIndex) : isReviewed(this.state, this.state.patchIndex);
21250
+ }
21251
+ partHereNow() {
21252
+ if (!onLayers(this.state) || layersHolding(this.state, this.state.patchIndex) < 2) return;
21253
+ return partHere(this.state, this.state.layerIndex, this.state.patchIndex);
21254
+ }
21177
21255
  vouching(branch, file) {
21178
21256
  const held = this.reading;
21179
- return held === void 0 || held.worktree.branch !== branch ? toggleVouch({
21257
+ if (held === void 0 || held.worktree.branch !== branch) return toggleVouch({
21180
21258
  repo: this.repo,
21181
21259
  branch,
21182
21260
  file
21183
- }) : vouchIn(held, file);
21261
+ });
21262
+ const part = this.partHereNow();
21263
+ return part === void 0 ? vouchIn(held, file) : vouchPartIn(held, file, part);
21184
21264
  }
21185
21265
  loadSent(branch) {
21186
21266
  const reading = this.reading;
@@ -21194,6 +21274,7 @@ var init_app = __esmMin((() => {
21194
21274
  return {
21195
21275
  file: resolve(held, patch.path),
21196
21276
  path: patch.path,
21277
+ root: held,
21197
21278
  line: sourceLineAt(this.state, this.state.cursor) ?? 1
21198
21279
  };
21199
21280
  }
@@ -21234,12 +21315,12 @@ var init_app = __esmMin((() => {
21234
21315
  const where = this.whereTheLineIs();
21235
21316
  if (where === void 0) return;
21236
21317
  const template = templateFor(yield* editorTold);
21237
- const opening = template === void 0 ? void 0 : openingOf(template, where.file, where.line);
21318
+ const opening = template === void 0 ? void 0 : openingOf(template, where.file, where.line, where.root);
21238
21319
  if (opening === void 0) {
21239
21320
  yield* this.chooseEditor();
21240
21321
  return;
21241
21322
  }
21242
- const said = ranAside(opening.command, opening.args) ? `${where.path}:${where.line} in ${opening.command}` : `${opening.command} would not start`;
21323
+ const said = ranAside(opening.command, opening.args, where.root) ? `${where.path}:${where.line} in ${opening.command}` : `${opening.command} would not start`;
21243
21324
  this.commit(withNoticeHere(this.state, said));
21244
21325
  });
21245
21326
  }
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.160",
26
+ "version": "0.1.0-alpha.162",
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": {