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

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 +24 -0
  2. package/dist/main.js +208 -70
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.160
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(diff): The sheet of keys carries a legend along its foot, naming each mark a thread can carry, the remark mark, and the marks for your words and the agent's.
8
+
9
+ - feat(diff): the editor a line opens in is chosen in the terminal, from the editors found on your machine.
10
+
11
+ <details><summary>What was wrong</summary>
12
+
13
+ A reviewer with no editor in the environment was told to set `$VISUAL` or edit the settings file —
14
+ a chore instead of an editor. Pressing the key now offers the editors found on the path, narrowed by
15
+ typing, and a command typed in full is accepted; choosing one opens the line straight away.
16
+ Changing it later is in the command palette, and one key there hands the choice back to the
17
+ environment.
18
+
19
+ </details>
20
+
21
+ - fix(review): The panel quotes the code a comment was written on when the diff can no longer place it, and going to it says the diff no longer has that line.
22
+
23
+ - fix(report): A bug report names the cursor's row with the same number it marks that row with in the code around the cursor.
24
+
25
+ - fix(diff): A thread's stand is drawn as one circle at one size, `○ ◎ ◉ ●`, where the quarter-filled and half-filled circles were drawn at sizes of their own.
26
+
3
27
  ## 0.1.0-alpha.159
4
28
 
5
29
  ### Patch Changes
package/dist/main.js CHANGED
@@ -6,8 +6,8 @@ import { join, resolve } from "node:path";
6
6
  import { homedir, hostname, platform } from "node:os";
7
7
  import { promisify } from "node:util";
8
8
  import { fileURLToPath } from "node:url";
9
+ import { existsSync, mkdirSync, watch } from "node:fs";
9
10
  import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, defaultTextareaKeyBindings, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
10
- import { mkdirSync, watch } from "node:fs";
11
11
  //#region \0rolldown/runtime.js
12
12
  var __defProp = Object.defineProperty;
13
13
  var __esmMin = (fn, res, err) => () => {
@@ -10787,6 +10787,7 @@ var init_commands = __esmMin((() => {
10787
10787
  start: comment.start,
10788
10788
  end: comment.end,
10789
10789
  body: comment.body,
10790
+ snippet: comment.snippet,
10790
10791
  settled: Object.hasOwn(settled, comment.id),
10791
10792
  removed: Object.hasOwn(removed, comment.id),
10792
10793
  stale: comment.head !== head,
@@ -11327,7 +11328,7 @@ var init_pane = __esmMin((() => {
11327
11328
  //#region package.json
11328
11329
  init_drafts();
11329
11330
  init_pane();
11330
- var version$1 = "0.1.0-alpha.159";
11331
+ var version$1 = "0.1.0-alpha.160";
11331
11332
  //#endregion
11332
11333
  //#region src/cli/upgrade.ts
11333
11334
  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;
@@ -13320,6 +13321,7 @@ var init_remarks = __esmMin((() => {
13320
13321
  moreReplies: held.moreReplies,
13321
13322
  outdated: held.outdated,
13322
13323
  placed: sits.placed,
13324
+ code: quotedCode(held.hunk, held.side),
13323
13325
  state: stateOf(held, dismissed, accepted),
13324
13326
  comment: comment ?? ""
13325
13327
  };
@@ -13945,7 +13947,7 @@ var init_tree = __esmMin((() => {
13945
13947
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13946
13948
  };
13947
13949
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13948
- })), 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, 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;
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;
13949
13951
  var init_model$1 = __esmMin((() => {
13950
13952
  init_dist();
13951
13953
  init_patch();
@@ -14006,6 +14008,7 @@ var init_model$1 = __esmMin((() => {
14006
14008
  matches: [],
14007
14009
  refs: [],
14008
14010
  refIndex: 0,
14011
+ editorNow: "",
14009
14012
  matchIndex: 0,
14010
14013
  term: "",
14011
14014
  query: "",
@@ -14506,8 +14509,9 @@ var init_model$1 = __esmMin((() => {
14506
14509
  refsShown = (state) => {
14507
14510
  const wanted = state.query.trim().toLowerCase();
14508
14511
  const held = state.refs.filter((ref) => ref.toLowerCase().includes(wanted));
14509
- return wanted.length === 0 || held.some((ref) => ref.toLowerCase() === wanted) ? held : [...held, state.query.trim()];
14512
+ return wanted.length === 0 || held.some((ref) => ref.toLowerCase() === wanted) ? held : held.concat([state.query.trim()]);
14510
14513
  };
14514
+ picking = (state) => state.screen === "base" || state.screen === "editor";
14511
14515
  refHere = (state) => refsShown(state)[state.refIndex];
14512
14516
  matchHere = (state) => shownMatches(state)[state.matchIndex];
14513
14517
  selectionReadout = (state) => {
@@ -14821,7 +14825,7 @@ var init_report = __esmMin((() => {
14821
14825
  whereabouts = (state, around) => [
14822
14826
  `- repo \`${around.repo}\``,
14823
14827
  `- branch \`${selectedBranch(state)?.branch ?? "none"}\`, base \`${around.base.length === 0 ? "resolved by adiff" : around.base}\``,
14824
- `- file \`${selectedPatch(state)?.path ?? "none"}\`, row ${state.cursor + 1}`
14828
+ `- file \`${selectedPatch(state)?.path ?? "none"}\`, row ${state.cursor}`
14825
14829
  ];
14826
14830
  said$1 = (many, one) => `${many} ${one}${many === 1 ? "" : "s"}`;
14827
14831
  chosenAway = (state) => {
@@ -14901,7 +14905,7 @@ var init_report = __esmMin((() => {
14901
14905
  }));
14902
14906
  //#endregion
14903
14907
  //#region src/domain/editor/model.ts
14904
- var KNOWN, LINED, named, shaped, guessed, templateFor, openingOf;
14908
+ var KNOWN, LINED, named, shaped, guessed, KNOWN_EDITORS, editorsAround, templateFor, openingOf;
14905
14909
  var init_model = __esmMin((() => {
14906
14910
  KNOWN = [
14907
14911
  ["vscode", "code --goto {file}:{line}"],
@@ -14932,6 +14936,20 @@ var init_model = __esmMin((() => {
14932
14936
  const marks = `${told.termProgram ?? ""} ${told.terminalEmulator ?? ""}`.toLowerCase();
14933
14937
  return KNOWN.find(([mark]) => marks.includes(mark))?.[1];
14934
14938
  };
14939
+ KNOWN_EDITORS = [
14940
+ "code",
14941
+ "cursor",
14942
+ "windsurf",
14943
+ "zed",
14944
+ "idea",
14945
+ "subl",
14946
+ "nvim",
14947
+ "vim",
14948
+ "hx",
14949
+ "emacs",
14950
+ "nano"
14951
+ ];
14952
+ editorsAround = (found) => KNOWN_EDITORS.filter((name) => found(name)).map((name) => shaped(name));
14935
14953
  templateFor = (told) => {
14936
14954
  const asked = told.editor ?? told.visual ?? told.fallback;
14937
14955
  return asked === void 0 || asked.trim().length === 0 ? guessed(told) : shaped(asked);
@@ -15351,37 +15369,50 @@ var init_command = __esmMin((() => {
15351
15369
  }),
15352
15370
  command({
15353
15371
  action: "base.set",
15354
- title: "Use the base under the cursor",
15372
+ title: "Use the one under the cursor",
15355
15373
  category: "Branches",
15356
15374
  keys: ["return"],
15357
- screens: ["base"],
15375
+ screens: ["base", "editor"],
15358
15376
  listed: false
15359
15377
  }),
15360
15378
  command({
15361
15379
  action: "base.clear",
15362
- title: "Let adiff work the base out again",
15380
+ title: "Hand the choice back to adiff",
15363
15381
  category: "Branches",
15364
15382
  keys: ["ctrl+x"],
15365
- screens: ["base"],
15383
+ screens: ["base", "editor"],
15366
15384
  hint: "automatic",
15367
15385
  listed: false
15368
15386
  }),
15369
15387
  command({
15370
15388
  action: "base.next",
15371
- title: "Next base",
15389
+ title: "Next one",
15372
15390
  category: "Branches",
15373
15391
  keys: ["down"],
15374
- screens: ["base"],
15392
+ screens: ["base", "editor"],
15375
15393
  listed: false
15376
15394
  }),
15377
15395
  command({
15378
15396
  action: "base.prev",
15379
- title: "Previous base",
15397
+ title: "Previous one",
15380
15398
  category: "Branches",
15381
15399
  keys: ["up"],
15382
- screens: ["base"],
15400
+ screens: ["base", "editor"],
15383
15401
  listed: false
15384
15402
  }),
15403
+ command({
15404
+ action: "editor.open",
15405
+ also: [
15406
+ "editor",
15407
+ "ide",
15408
+ "choose editor",
15409
+ "which editor"
15410
+ ],
15411
+ title: "Choose the editor a line opens in",
15412
+ category: "Reading",
15413
+ keys: [],
15414
+ screens: ["review"]
15415
+ }),
15385
15416
  command({
15386
15417
  action: "line.open",
15387
15418
  also: [
@@ -15925,7 +15956,7 @@ var init_match = __esmMin((() => {
15925
15956
  }));
15926
15957
  //#endregion
15927
15958
  //#region src/tui/reduce.ts
15928
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, moveRef, withRefs, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withAround, withNoticeHere, withNotice;
15959
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, moveRef, withChoices, withRefs, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withAround, withNoticeHere, withNotice;
15929
15960
  var init_reduce = __esmMin((() => {
15930
15961
  init_dist();
15931
15962
  init_patch();
@@ -16424,14 +16455,16 @@ var init_reduce = __esmMin((() => {
16424
16455
  ...state,
16425
16456
  refIndex: clamp(state.refIndex + delta, 0, Math.max(0, refsShown(state).length - 1))
16426
16457
  });
16427
- withRefs = (state, refs) => ({
16458
+ withChoices = (state, refs, screen, now = "") => ({
16428
16459
  ...state,
16429
- screen: "base",
16460
+ screen,
16461
+ editorNow: now,
16430
16462
  returnTo: state.screen,
16431
16463
  refs,
16432
16464
  refIndex: 0,
16433
16465
  query: ""
16434
16466
  });
16467
+ withRefs = (state, refs) => withChoices(state, refs, "base");
16435
16468
  movePalette = (state, delta) => ({
16436
16469
  ...state,
16437
16470
  paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
@@ -16501,6 +16534,7 @@ var init_reduce = __esmMin((() => {
16501
16534
  "base.next": (state) => moveRef(state, 1),
16502
16535
  "base.prev": (state) => moveRef(state, -1),
16503
16536
  "line.open": (state) => state,
16537
+ "editor.open": (state) => state,
16504
16538
  "thread.settle": (state) => state,
16505
16539
  "thread.settleRead": (state) => state,
16506
16540
  "thread.remove": (state) => state,
@@ -16839,9 +16873,9 @@ var init_marks = __esmMin((() => {
16839
16873
  ring = {
16840
16874
  ...shared,
16841
16875
  filed: "○",
16842
- waiting: "◔",
16843
- answered: "◐",
16844
- asked: "●",
16876
+ waiting: "◎",
16877
+ answered: "●",
16878
+ asked: "◉",
16845
16879
  rule: "│"
16846
16880
  };
16847
16881
  sets = {
@@ -16849,9 +16883,9 @@ var init_marks = __esmMin((() => {
16849
16883
  bubble: {
16850
16884
  ...shared,
16851
16885
  filed: "◌",
16852
- waiting: "◔",
16853
- answered: "◑",
16854
- asked: "◗",
16886
+ waiting: "◎",
16887
+ answered: "●",
16888
+ asked: "◉",
16855
16889
  rule: "┃",
16856
16890
  cursor: "▌"
16857
16891
  },
@@ -16866,17 +16900,17 @@ var init_marks = __esmMin((() => {
16866
16900
  diamond: {
16867
16901
  ...shared,
16868
16902
  filed: "◇",
16869
- waiting: "◊",
16870
- answered: "◈",
16871
- asked: "◆",
16903
+ waiting: "◈",
16904
+ answered: "◆",
16905
+ asked: "❖",
16872
16906
  rule: "╎"
16873
16907
  },
16874
16908
  dot: {
16875
16909
  ...shared,
16876
- filed: "○",
16877
- waiting: "◔",
16878
- answered: "◉",
16879
- asked: "●",
16910
+ filed: "·",
16911
+ waiting: "◎",
16912
+ answered: "●",
16913
+ asked: "◉",
16880
16914
  rule: "▏"
16881
16915
  }
16882
16916
  };
@@ -16978,10 +17012,7 @@ var init_theme = __esmMin((() => {
16978
17012
  "note.label": { fg: "#7aa2f7" },
16979
17013
  default: { fg: ink }
16980
17014
  };
16981
- }));
16982
- //#endregion
16983
- //#region src/tui/diffview.ts
16984
- var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, REMARK_MARK$1, remarkHead, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, saidLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, apart, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
17015
+ })), WASH, NOTE_MIN, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, REMARK_MARK$1, remarkHead, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, saidLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, apart, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
16985
17016
  var init_diffview = __esmMin((() => {
16986
17017
  init_dist();
16987
17018
  init_patch();
@@ -16999,8 +17030,6 @@ var init_diffview = __esmMin((() => {
16999
17030
  }
17000
17031
  };
17001
17032
  NOTE_MIN = 24;
17002
- ANSWER_MARK = "↳";
17003
- REPLY_MARK = "»";
17004
17033
  OVERSCAN = 2;
17005
17034
  SIGN_WIDTH = 2;
17006
17035
  SCROLL_ROWS = 1;
@@ -17568,14 +17597,14 @@ var init_diffview = __esmMin((() => {
17568
17597
  return body.split("\n").flatMap((line) => wrap(line, Math.max(NOTE_MIN, room - 2))).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
17569
17598
  };
17570
17599
  heardFrom = (turn) => turn.by === void 0 ? void 0 : `@${turn.by}`;
17571
- answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, heardFrom(turn) ?? (turn.voice === "agent" ? ANSWER_MARK : REPLY_MARK))) : note.answers.flatMap((body) => spokenLines(body, room, ANSWER_MARK));
17600
+ answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, heardFrom(turn) ?? (turn.voice === "agent" ? "↳" : "»"))) : note.answers.flatMap((body) => spokenLines(body, room, "↳"));
17572
17601
  REMARK_LINES = 8;
17573
17602
  capped = (lines, most) => lines.length <= most ? lines : [...lines.slice(0, most), `⋯ ${lines.length - most} more lines, press p to read it on the pull request`];
17574
17603
  bodyLines = (note, room) => {
17575
17604
  const said = note.body.split("\n").flatMap((line) => wrap(line, room));
17576
17605
  return note.from === void 0 ? said : capped(said, REMARK_LINES);
17577
17606
  };
17578
- saidLines = (note, room) => note.from === void 0 ? bodyLines(note, room).map((line, at) => at === 0 ? `${REPLY_MARK} ${line}` : ` ${line}`) : bodyLines(note, room);
17607
+ saidLines = (note, room) => note.from === void 0 ? bodyLines(note, room).map((line, at) => at === 0 ? `» ${line}` : ` ${line}`) : bodyLines(note, room);
17579
17608
  noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
17580
17609
  headOf(note),
17581
17610
  ...saidLines(note, room),
@@ -17697,7 +17726,7 @@ var init_diffview = __esmMin((() => {
17697
17726
  }));
17698
17727
  //#endregion
17699
17728
  //#region src/tui/render.ts
17700
- 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, 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, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
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;
17701
17730
  var init_render = __esmMin((() => {
17702
17731
  init_dist();
17703
17732
  init_command();
@@ -17726,6 +17755,23 @@ var init_render = __esmMin((() => {
17726
17755
  PALETTE_GAP = 2;
17727
17756
  PALETTE_CHROME = 4;
17728
17757
  PENDING_CHROME = 4;
17758
+ LEGEND_ROWS = 1;
17759
+ LEGEND = [
17760
+ ["filed", "written"],
17761
+ ["waiting", "picked up"],
17762
+ ["answered", "answered"],
17763
+ ["asked", "waiting on you"],
17764
+ ["done", "settled"]
17765
+ ];
17766
+ legendText = (room) => {
17767
+ const said = LEGEND.map(([key, means]) => `${marks()[key]} ${means}`);
17768
+ const voices = [
17769
+ `${REMARK_MARK} remark`,
17770
+ `» you`,
17771
+ `↳ the agent`
17772
+ ];
17773
+ return clip([...said, ...voices].join(" "), room);
17774
+ };
17729
17775
  keysTitle = (found, whole) => {
17730
17776
  if (found === 0) return "No key matches";
17731
17777
  return whole ? `Keys here, ${found} of them` : `Keys here, ${found} of them — arrows for the rest`;
@@ -18131,7 +18177,12 @@ var init_render = __esmMin((() => {
18131
18177
  makeKeysParts = (renderer) => {
18132
18178
  const parts = makePaletteParts(renderer);
18133
18179
  parts.box.id = "keys";
18134
- return parts;
18180
+ const legend = bar(renderer, "keys-legend", palette.faint);
18181
+ parts.box.add(legend);
18182
+ return {
18183
+ ...parts,
18184
+ legend
18185
+ };
18135
18186
  };
18136
18187
  makeFoundParts = (renderer) => {
18137
18188
  const box = makePalette(renderer);
@@ -18708,6 +18759,12 @@ var init_render = __esmMin((() => {
18708
18759
  chunks: kept.flatMap((block) => block.chunks)
18709
18760
  };
18710
18761
  };
18762
+ pickingTitle = (state) => {
18763
+ if (state.screen === "editor") return `Editor${state.editorNow.length === 0 ? " — none found" : ` — now ${state.editorNow}`}`;
18764
+ const here = selectedBranch(state);
18765
+ const on = here === void 0 ? "" : `${here.base}${here.basis === "set" ? "" : ", adiff's guess"}`;
18766
+ return `Base for ${here?.branch ?? "this branch"}${on.length === 0 ? "" : ` — now ${on}`}`;
18767
+ };
18711
18768
  REMARK_MARK = "◇";
18712
18769
  remarkWhere = (remark, known) => {
18713
18770
  if (remark.placed) return `:${remark.end}`;
@@ -18730,19 +18787,51 @@ var init_render = __esmMin((() => {
18730
18787
  return (entry.kind === "remark" ? `@${entry.remark.by} ${entry.remark.body}` : entry.comment.body).split("\n").find((line) => line.trim().length > 0) ?? "";
18731
18788
  };
18732
18789
  panelMark = (entry) => entry.kind === "remark" ? REMARK_MARK : standMark(threadStand(entry.comment));
18790
+ lostCode = (entry) => {
18791
+ return (entry.kind === "remark" ? entry.remark.code : (entry.comment.snippet ?? "").split("\n")).filter((line) => line.trim().length > 0);
18792
+ };
18793
+ lostEntry = (state, entry) => entry.kind === "remark" ? !entry.remark.placed && state.patches.some((patch) => patch.path === entry.remark.file) : entry.comment.outside === true;
18794
+ writtenOn = (state, placed, room) => {
18795
+ const { entry } = placed;
18796
+ if (placed.at !== state.panelIndex || !lostEntry(state, entry)) return [];
18797
+ const code = lostCode(entry);
18798
+ if (code.length === 0) return [];
18799
+ const shown = code.slice(-4);
18800
+ const cut = code.length - shown.length;
18801
+ const rows = shown.map((line) => ({
18802
+ text: clip(` │ ${line.trim()}`, room),
18803
+ tone: palette.faint
18804
+ }));
18805
+ const more = cut === 0 ? [] : [{
18806
+ text: clip(` │ ⋯ ${cut} more`, room),
18807
+ tone: palette.faint
18808
+ }];
18809
+ return [
18810
+ {
18811
+ text: clip(" the code it was written on", room),
18812
+ tone: palette.faint
18813
+ },
18814
+ ...more,
18815
+ ...rows
18816
+ ];
18817
+ };
18733
18818
  panelPair = (state, placed, room) => {
18734
18819
  const { entry } = placed;
18735
18820
  const lead = ` ${panelMark(entry)} `;
18736
18821
  const here = placed.at === state.panelIndex;
18737
- return [{
18738
- text: `${lead}${panelWhere(state, entry, room - PANEL_LEAD)}`,
18739
- tone: palette.ink,
18740
- here
18741
- }, {
18742
- text: ` ${clip(panelBody(entry), Math.max(4, room - PANEL_LEAD))}`,
18743
- tone: palette.muted,
18744
- here
18745
- }];
18822
+ return [
18823
+ {
18824
+ text: `${lead}${panelWhere(state, entry, room - PANEL_LEAD)}`,
18825
+ tone: palette.ink,
18826
+ here
18827
+ },
18828
+ {
18829
+ text: ` ${clip(panelBody(entry), Math.max(4, room - PANEL_LEAD))}`,
18830
+ tone: palette.muted,
18831
+ here
18832
+ },
18833
+ ...writtenOn(state, placed, room)
18834
+ ];
18746
18835
  };
18747
18836
  panelSection = (state, placed, section, room) => {
18748
18837
  const here = placed.filter((one) => one.entry.section === section);
@@ -18850,6 +18939,7 @@ var init_render = __esmMin((() => {
18850
18939
  keysQuery;
18851
18940
  foundQuery;
18852
18941
  keysChoices;
18942
+ keysLegend;
18853
18943
  found;
18854
18944
  foundTitle;
18855
18945
  foundPeek;
@@ -18899,6 +18989,7 @@ var init_render = __esmMin((() => {
18899
18989
  this.keysTitle = modals.keys.title;
18900
18990
  this.keysQuery = modals.keys.query;
18901
18991
  this.keysChoices = modals.keys.choices;
18992
+ this.keysLegend = modals.keys.legend;
18902
18993
  this.baseBox = modals.bases;
18903
18994
  this.found = modals.found.box;
18904
18995
  this.foundTitle = modals.found.title;
@@ -18978,7 +19069,8 @@ var init_render = __esmMin((() => {
18978
19069
  case "palette": return this.paletteQuery;
18979
19070
  case "search": return this.foundQuery;
18980
19071
  case "keys": return this.keysQuery;
18981
- case "base": return this.baseBox.query;
19072
+ case "base":
19073
+ case "editor": return this.baseBox.query;
18982
19074
  default: return;
18983
19075
  }
18984
19076
  }
@@ -19053,17 +19145,15 @@ var init_render = __esmMin((() => {
19053
19145
  this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
19054
19146
  }
19055
19147
  paintBases(state) {
19056
- this.baseBox.box.visible = state.screen === "base";
19057
- if (state.screen !== "base") {
19148
+ this.baseBox.box.visible = picking(state);
19149
+ if (!picking(state)) {
19058
19150
  this.baseBox.title.content = "";
19059
19151
  this.baseBox.choices.content = "";
19060
19152
  return;
19061
19153
  }
19062
19154
  const shown = refsShown(state);
19063
19155
  const room = panelWidth(this.renderer.width);
19064
- const here = selectedBranch(state);
19065
- const on = here === void 0 ? "" : `${here.base}${here.basis === "set" ? "" : ", adiff's guess"}`;
19066
- this.baseBox.title.content = clip(`Base for ${here?.branch ?? "this branch"}${on.length === 0 ? "" : ` — now ${on}`}`, room - MODAL_ROOM);
19156
+ this.baseBox.title.content = clip(pickingTitle(state), room - MODAL_ROOM);
19067
19157
  this.baseBox.query.visible = true;
19068
19158
  const tall = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), shown.length + PALETTE_CHROME + 1);
19069
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));
@@ -19094,17 +19184,19 @@ var init_render = __esmMin((() => {
19094
19184
  if (state.screen !== "keys") {
19095
19185
  this.keysTitle.content = "";
19096
19186
  this.keysChoices.content = "";
19187
+ this.keysLegend.content = "";
19097
19188
  return;
19098
19189
  }
19099
19190
  const rows = keyMatches(state);
19100
19191
  const room = this.renderer.width;
19101
19192
  const keysRoom = this.renderer.height;
19102
- const shown = Math.max(1, keysRoom - PENDING_CHROME);
19193
+ const shown = Math.max(1, keysRoom - PENDING_CHROME - LEGEND_ROWS);
19103
19194
  this.keysTitle.content = keysTitle(rows.length, sheetDeep(rows, room - MODAL_ROOM) <= shown);
19104
19195
  this.keysChoices.content = sheetText(rows, Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), {
19105
19196
  height: shown,
19106
19197
  room: room - MODAL_ROOM
19107
19198
  });
19199
+ this.keysLegend.content = legendText(room - MODAL_ROOM);
19108
19200
  this.keys.height = keysRoom;
19109
19201
  this.keys.width = room;
19110
19202
  this.keys.left = 0;
@@ -19485,7 +19577,8 @@ var init_display = __esmMin((() => {
19485
19577
  "palette",
19486
19578
  "keys",
19487
19579
  "search",
19488
- "base"
19580
+ "base",
19581
+ "editor"
19489
19582
  ];
19490
19583
  Display = class extends Service()("adiff/Display") {};
19491
19584
  paintWith = (screen) => fn("Tui.paint")(function* (state) {
@@ -19514,14 +19607,15 @@ var init_display = __esmMin((() => {
19514
19607
  writeIn: (text) => sync(() => screen.writing().insertText(text)),
19515
19608
  writeOn: (on) => sync(() => on ? screen.writing().focus() : screen.writing().blur()),
19516
19609
  askOn: (which) => sync(() => {
19610
+ const wanted = which === void 0 ? void 0 : screen.asking(which);
19517
19611
  for (const name of ASKING) {
19518
19612
  const box = screen.asking(name);
19519
- if (box === void 0) continue;
19520
- if (name === which) {
19521
- box.setText("");
19522
- box.focus();
19523
- } else box.blur();
19613
+ if (box === void 0 || box === wanted) continue;
19614
+ box.blur();
19524
19615
  }
19616
+ if (wanted === void 0) return;
19617
+ wanted.setText("");
19618
+ wanted.focus();
19525
19619
  }),
19526
19620
  askWith: (text) => sync(() => {
19527
19621
  for (const name of ASKING) screen.asking(name)?.setText(text);
@@ -19620,7 +19714,7 @@ var init_upgrade = __esmMin((() => {
19620
19714
  }));
19621
19715
  //#endregion
19622
19716
  //#region src/tui/app.ts
19623
- var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, NO_EDITOR, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, ranAside, editorTold, 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;
19717
+ var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, ranAside, onThePath, saveEditor, editorTold, 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;
19624
19718
  var init_app = __esmMin((() => {
19625
19719
  init_dist();
19626
19720
  init_report();
@@ -19645,7 +19739,6 @@ var init_app = __esmMin((() => {
19645
19739
  AGE_TICK_MS = 3e4;
19646
19740
  LEAVING_SAID = "press ctrl+c again to leave";
19647
19741
  NOTHING_WRITTEN = "nothing written yet";
19648
- NO_EDITOR = "no editor to open it in: set $VISUAL, or editor in the settings file";
19649
19742
  WORTH_TIMING_MS = 250;
19650
19743
  TIMES_KEPT = 40;
19651
19744
  SLOWEST_KEPT = 3;
@@ -19726,6 +19819,16 @@ var init_app = __esmMin((() => {
19726
19819
  return false;
19727
19820
  }
19728
19821
  };
19822
+ onThePath = (name) => (process.env["PATH"] ?? "").split(":").some((where) => where.length > 0 && existsSync(join(where, name)));
19823
+ saveEditor = fn("Tui.saveEditor")(function* (command) {
19824
+ const store = yield* Store;
19825
+ const held = { ...yield* store.settings };
19826
+ if (command.length === 0) delete held["editor"];
19827
+ yield* store.saveSettings(command.length === 0 ? held : {
19828
+ ...held,
19829
+ editor: command
19830
+ });
19831
+ });
19729
19832
  editorTold = gen(function* () {
19730
19833
  const held = (yield* (yield* Store).settings)["editor"];
19731
19834
  return {
@@ -19764,7 +19867,8 @@ var init_app = __esmMin((() => {
19764
19867
  "keys",
19765
19868
  "palette",
19766
19869
  "search",
19767
- "base"
19870
+ "base",
19871
+ "editor"
19768
19872
  ]);
19769
19873
  WRITES = /* @__PURE__ */ new Set(["compose", "report"]);
19770
19874
  OVER = /* @__PURE__ */ new Set([
@@ -19774,7 +19878,8 @@ var init_app = __esmMin((() => {
19774
19878
  "palette",
19775
19879
  "search",
19776
19880
  "settings",
19777
- "base"
19881
+ "base",
19882
+ "editor"
19778
19883
  ]);
19779
19884
  overReview = (screen) => OVER.has(screen);
19780
19885
  writesInto = (screen) => WRITES.has(screen);
@@ -20228,9 +20333,10 @@ var init_app = __esmMin((() => {
20228
20333
  "search.jump": () => this.runFinder(),
20229
20334
  "review.reload": () => this.state.screen === "branches" ? this.reloadList() : this.reloadBranch(),
20230
20335
  "base.open": () => this.openBases(),
20231
- "base.set": () => this.setBaseHere(),
20232
- "base.clear": () => this.clearBaseHere(),
20336
+ "base.set": () => this.state.screen === "editor" ? this.editorChosen() : this.setBaseHere(),
20337
+ "base.clear": () => this.state.screen === "editor" ? this.forgetEditor() : this.clearBaseHere(),
20233
20338
  "line.open": () => this.openInEditor(),
20339
+ "editor.open": () => this.chooseEditor(),
20234
20340
  "report.open": () => sync(() => this.commit(reduce(this.measured(), "report.open"))),
20235
20341
  back: () => this.goBack(),
20236
20342
  "report.send": () => this.sendReport(),
@@ -20648,7 +20754,7 @@ var init_app = __esmMin((() => {
20648
20754
  const shown = selectedPatch(wide);
20649
20755
  if (shown === void 0 || rowShowing(shown, entry.comment.end) === void 0) {
20650
20756
  yield* this.readAnswers(entry.comment.id);
20651
- this.commit(withNoticeHere(this.state, "that comment is outside this diff"));
20757
+ this.commit(withNoticeHere(this.state, "the diff no longer has that line · the panel shows the code it was written on"));
20652
20758
  return;
20653
20759
  }
20654
20760
  this.commit(openedAt({
@@ -21091,6 +21197,38 @@ var init_app = __esmMin((() => {
21091
21197
  line: sourceLineAt(this.state, this.state.cursor) ?? 1
21092
21198
  };
21093
21199
  }
21200
+ chooseEditor() {
21201
+ return gen({ self: this }, function* () {
21202
+ const around = editorsAround(onThePath);
21203
+ const held = templateFor(yield* editorTold);
21204
+ const offered = held === void 0 || around.includes(held) ? around : [held, ...around];
21205
+ this.commit(withChoices(this.state, offered, "editor", held ?? ""));
21206
+ });
21207
+ }
21208
+ editorChosen() {
21209
+ return gen({ self: this }, function* () {
21210
+ const chosen = refHere(this.state);
21211
+ if (chosen === void 0) return;
21212
+ yield* saveEditor(chosen);
21213
+ this.commit({
21214
+ ...this.state,
21215
+ screen: this.state.returnTo,
21216
+ query: ""
21217
+ });
21218
+ yield* this.openInEditor();
21219
+ });
21220
+ }
21221
+ forgetEditor() {
21222
+ return gen({ self: this }, function* () {
21223
+ yield* saveEditor("");
21224
+ const back = {
21225
+ ...this.state,
21226
+ screen: this.state.returnTo,
21227
+ query: ""
21228
+ };
21229
+ this.commit(withNotice(back, "the editor is the environment's again"));
21230
+ });
21231
+ }
21094
21232
  openInEditor() {
21095
21233
  return gen({ self: this }, function* () {
21096
21234
  const where = this.whereTheLineIs();
@@ -21098,7 +21236,7 @@ var init_app = __esmMin((() => {
21098
21236
  const template = templateFor(yield* editorTold);
21099
21237
  const opening = template === void 0 ? void 0 : openingOf(template, where.file, where.line);
21100
21238
  if (opening === void 0) {
21101
- this.commit(withNoticeHere(this.state, NO_EDITOR));
21239
+ yield* this.chooseEditor();
21102
21240
  return;
21103
21241
  }
21104
21242
  const said = ranAside(opening.command, opening.args) ? `${where.path}:${where.line} in ${opening.command}` : `${opening.command} would not start`;
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.159",
26
+ "version": "0.1.0-alpha.160",
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": {