@eliya-oss/agent-diff 0.1.0-alpha.171 → 0.1.0-alpha.172

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 +16 -0
  2. package/dist/main.js +190 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.172
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(diff): a comment is written in the diff, under the line it is about, instead of in a box over it.
8
+
9
+ <details><summary>What moved</summary>
10
+
11
+ The draft opens under the last line of the selection and the code below it moves down, the way a
12
+ thread already sits under its line; a reply opens under the thread it answers. The quoted snippet is
13
+ gone, because the code is on the screen above. `ctrl+s` sends and `escape` cancels, as before. On a
14
+ pane too short to hold the draft, and where the diff cannot show the line, the draft opens over the
15
+ diff as it did before.
16
+
17
+ </details>
18
+
3
19
  ## 0.1.0-alpha.171
4
20
 
5
21
  ### Patch Changes
package/dist/main.js CHANGED
@@ -11601,7 +11601,7 @@ var init_pane = __esmMin((() => {
11601
11601
  //#region package.json
11602
11602
  init_drafts();
11603
11603
  init_pane();
11604
- var version$1 = "0.1.0-alpha.171";
11604
+ var version$1 = "0.1.0-alpha.172";
11605
11605
  //#endregion
11606
11606
  //#region src/cli/upgrade.ts
11607
11607
  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, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
@@ -14105,7 +14105,7 @@ var init_tree = __esmMin((() => {
14105
14105
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
14106
14106
  };
14107
14107
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
14108
- })), 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, coveredBy, lastLayerOf, threadsInLayer, threadsOpenOn, askedRows, withAsking, asksAbout, 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, refSaidOf, 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, movedPast, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
14108
+ })), 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, coveredBy, lastLayerOf, threadsInLayer, threadsOpenOn, askedRows, withAsking, asksAbout, 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, refSaidOf, refsShown, picking, refHere, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, draftPlace, notesShown, 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, movedPast, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
14109
14109
  var init_model$1 = __esmMin((() => {
14110
14110
  init_dist();
14111
14111
  init_patch();
@@ -14790,6 +14790,34 @@ var init_model$1 = __esmMin((() => {
14790
14790
  const notes = state.sent.filter((entry) => entry.file === patch.path && entry.outside !== true);
14791
14791
  return patch.rows.filter((row) => notes.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index).toSorted((left, right) => left - right);
14792
14792
  };
14793
+ draftPlace = (state) => {
14794
+ const patch = selectedPatch(state);
14795
+ if (patch === void 0) return void 0;
14796
+ const to = state.replyTo ?? state.answerTo;
14797
+ if (to === void 0) return {
14798
+ row: selectionRange(state)[1],
14799
+ stop: void 0
14800
+ };
14801
+ const drawn = notesShown(state, patch.path);
14802
+ const at = drawn.findIndex((note) => note.id === to);
14803
+ const note = drawn[at];
14804
+ if (note === void 0) return void 0;
14805
+ const row = patch.rows.find((one) => lineOnSide(one, note.side) === note.end)?.index;
14806
+ if (row === void 0) return void 0;
14807
+ return {
14808
+ row,
14809
+ stop: drawn.filter((one) => one.side === note.side && one.end === note.end && drawn.indexOf(one) <= at).length
14810
+ };
14811
+ };
14812
+ notesShown = (state, path) => [...state.sent.filter((one) => one.file === path && one.removed !== true && one.outside !== true).map((one) => ({
14813
+ id: one.id,
14814
+ side: one.side,
14815
+ end: one.end
14816
+ })), ...state.remarks.filter((one) => one.file === path && remarkShown(one)).map((one) => ({
14817
+ id: one.id,
14818
+ side: one.side,
14819
+ end: one.end
14820
+ }))];
14793
14821
  threadsAtRow = (state, row) => {
14794
14822
  const patch = selectedPatch(state);
14795
14823
  const here = patch?.rows[row];
@@ -17364,7 +17392,7 @@ var init_theme = __esmMin((() => {
17364
17392
  "note.label": { fg: "#7aa2f7" },
17365
17393
  default: { fg: ink }
17366
17394
  };
17367
- })), 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, firstOfEach, 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;
17395
+ })), 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, firstOfEach, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, SAID_INDENT, 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, DRAFT_STOP, draftText, draftRows, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
17368
17396
  var init_diffview = __esmMin((() => {
17369
17397
  init_dist();
17370
17398
  init_patch();
@@ -17453,6 +17481,7 @@ var init_diffview = __esmMin((() => {
17453
17481
  wrapped = false;
17454
17482
  held = 0;
17455
17483
  picked;
17484
+ draftLine;
17456
17485
  constructor(renderer) {
17457
17486
  this.code = new CodeRenderable(renderer, {
17458
17487
  id: "diff-code",
@@ -17507,6 +17536,15 @@ var init_diffview = __esmMin((() => {
17507
17536
  room() {
17508
17537
  return this.noteRoom();
17509
17538
  }
17539
+ noteLeft() {
17540
+ return this.numbers.x + this.gutterWidth();
17541
+ }
17542
+ saidLeft() {
17543
+ return this.noteLeft() + SAID_INDENT;
17544
+ }
17545
+ noteWidth() {
17546
+ return Math.max(NOTE_MIN, this.code.width - this.gutterWidth());
17547
+ }
17510
17548
  paneWidth() {
17511
17549
  return this.numbers.width;
17512
17550
  }
@@ -17550,6 +17588,19 @@ var init_diffview = __esmMin((() => {
17550
17588
  screenTop() {
17551
17589
  return this.code.y;
17552
17590
  }
17591
+ screenLeft() {
17592
+ return this.numbers.x;
17593
+ }
17594
+ showDraft(top, rows) {
17595
+ const at = this.draftTop();
17596
+ if (at === void 0) return top;
17597
+ const highest = Math.max(0, this.tallest() - this.rows());
17598
+ const below = at + rows - this.rows();
17599
+ const above = Math.max(0, at - 1);
17600
+ const settled = Math.max(0, Math.min(highest, above < top ? above : below > top ? below : top));
17601
+ if (this.code.scrollY !== settled) this.code.scrollY = settled;
17602
+ return settled;
17603
+ }
17553
17604
  fit(height) {
17554
17605
  const rows = Math.max(1, height);
17555
17606
  if (rows !== this.fitted) {
@@ -17563,9 +17614,13 @@ var init_diffview = __esmMin((() => {
17563
17614
  rows() {
17564
17615
  return this.fitted;
17565
17616
  }
17566
- show(patch, notes, gaps, prose = []) {
17617
+ show(patch, notes, gaps, under = {
17618
+ prose: [],
17619
+ draft: void 0
17620
+ }) {
17621
+ const { prose, draft } = under;
17567
17622
  const room = notes.length === 0 && prose.length === 0 ? NOTE_MIN : this.noteRoom();
17568
- const key = keyOf(room, notes, prose);
17623
+ const key = keyOf(room, notes, prose, draft);
17569
17624
  if (patch === this.shown && key === this.noted) return;
17570
17625
  this.unpin();
17571
17626
  this.shown = patch;
@@ -17576,8 +17631,11 @@ var init_diffview = __esmMin((() => {
17576
17631
  room,
17577
17632
  gaps,
17578
17633
  prose,
17579
- fresh: freshLines(patch)
17634
+ fresh: freshLines(patch),
17635
+ draft
17580
17636
  });
17637
+ const at = this.display.findIndex((entry) => entry.draft === true);
17638
+ this.draftLine = at === -1 ? void 0 : at;
17581
17639
  this.starts = startsOf(this.display);
17582
17640
  this.code.filetype = pathToFiletype(patch.path) ?? "text";
17583
17641
  this.feed();
@@ -17728,7 +17786,7 @@ var init_diffview = __esmMin((() => {
17728
17786
  carries(visual) {
17729
17787
  const entry = this.display[this.lineAt(visual)];
17730
17788
  if (entry === void 0) return false;
17731
- if (entry.prose) return false;
17789
+ if (entry.prose || entry.draft === true) return false;
17732
17790
  return true;
17733
17791
  }
17734
17792
  isComment(visual) {
@@ -17758,6 +17816,9 @@ var init_diffview = __esmMin((() => {
17758
17816
  screenRowOf(row) {
17759
17817
  return this.visualOfRow(row);
17760
17818
  }
17819
+ draftTop() {
17820
+ return this.draftLine === void 0 ? void 0 : this.visualOf(this.draftLine);
17821
+ }
17761
17822
  pick(picked) {
17762
17823
  if (alike(this.picked, picked)) return;
17763
17824
  this.picked = picked;
@@ -17828,8 +17889,9 @@ var init_diffview = __esmMin((() => {
17828
17889
  note.settled ? "settled" : note.asks ? "asked" : "open",
17829
17890
  ...note.turns.length > 0 ? note.turns.map((turn) => `${turn.voice[0] ?? ""}:${turn.body}`) : note.answers.map((body) => `a:${body}`)
17830
17891
  ].join("");
17831
- keyOf = (room, notes, prose) => [
17892
+ keyOf = (room, notes, prose, draft) => [
17832
17893
  room,
17894
+ draft === void 0 ? "d-" : `d${draft.row}:${draft.stop ?? 0}:${draft.rows}:${draft.head}`,
17833
17895
  ...notes.map(noteKey),
17834
17896
  ...prose.map((entry) => `p${entry.line}${entry.after ? ">" : "<"}:${entry.markdown}`)
17835
17897
  ].join("\0");
@@ -17944,6 +18006,7 @@ var init_diffview = __esmMin((() => {
17944
18006
  }
17945
18007
  return lines;
17946
18008
  };
18009
+ SAID_INDENT = 2;
17947
18010
  REMARK_MARK$1 = "◇";
17948
18011
  remarkHead = (note, from) => `${REMARK_MARK$1} @${from}${note.stale ? " · outdated" : ""}`;
17949
18012
  commentHead = (note) => {
@@ -18015,7 +18078,10 @@ var init_diffview = __esmMin((() => {
18015
18078
  gap: false,
18016
18079
  prose: false
18017
18080
  });
18018
- notesAt = (plan, row) => plan.notes.filter((note) => sideLineOf(row, note.side) === note.line).flatMap((note, at) => at === 0 ? noteRows(note, row.index, plan.room, at + 1) : [apart(row.index, at + 1)].concat(noteRows(note, row.index, plan.room, at + 1)));
18081
+ notesAt = (plan, row) => plan.notes.filter((note) => sideLineOf(row, note.side) === note.line).flatMap((note, at) => {
18082
+ const drawn = at === 0 ? noteRows(note, row.index, plan.room, at + 1) : [apart(row.index, at + 1)].concat(noteRows(note, row.index, plan.room, at + 1));
18083
+ return plan.draft?.stop === at + 1 ? drawn.concat(draftRows(plan, row)) : drawn;
18084
+ });
18019
18085
  TRAILING = /[ \t]+$/;
18020
18086
  shownText = (row) => {
18021
18087
  if (row.kind === "context") return row.text;
@@ -18034,11 +18100,29 @@ var init_diffview = __esmMin((() => {
18034
18100
  gap: plan.gaps.has(row.index),
18035
18101
  prose: false
18036
18102
  });
18103
+ DRAFT_STOP = -1;
18104
+ draftText = (draft, at) => {
18105
+ if (at === 0) return `${marks().rule} ${draft.head}`;
18106
+ if (at === 1) return `${marks().rule} » `;
18107
+ return marks().rule;
18108
+ };
18109
+ draftRows = (plan, row) => plan.draft === void 0 || plan.draft.row !== row.index ? [] : Array.from({ length: plan.draft.rows }, (_, at) => ({
18110
+ text: draftText(plan.draft, at),
18111
+ row: row.index,
18112
+ stop: DRAFT_STOP,
18113
+ draft: true,
18114
+ comment: true,
18115
+ sent: false,
18116
+ label: false,
18117
+ gap: false,
18118
+ prose: false
18119
+ }));
18037
18120
  rowsFor = (plan, row, around) => [
18038
18121
  ...around.lead.flatMap((entry) => proseRows(entry, row.index, plan.room)),
18039
18122
  ...(around.own ? proseAt(plan, row, false) : []).flatMap((entry) => proseRows(entry, row.index, plan.room)),
18040
18123
  codeRow(plan, row),
18041
18124
  ...notesAt(plan, row),
18125
+ ...plan.draft?.stop === void 0 ? draftRows(plan, row) : [],
18042
18126
  ...proseAt(plan, row, true).flatMap((entry) => proseRows(entry, row.index, plan.room))
18043
18127
  ];
18044
18128
  replacedBy = (rows, at) => {
@@ -18089,7 +18173,7 @@ var init_diffview = __esmMin((() => {
18089
18173
  }));
18090
18174
  //#endregion
18091
18175
  //#region src/tui/render.ts
18092
- 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, askText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeBaseParts, makeAskParts, makeReaderParts, 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, readerTitle, voicesOf, readerText, 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, foldLine, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelPicked, panelText, Screen;
18176
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, DRAFT_PAD, NOTE_ROOM_MIN, DRAFT_ROOM, DRAFT_HEAD, 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, askText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeBaseParts, makeAskParts, makeReaderParts, 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, readerTitle, voicesOf, readerText, 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, foldLine, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelPicked, panelText, Screen;
18093
18177
  var init_render = __esmMin((() => {
18094
18178
  init_dist();
18095
18179
  init_command();
@@ -18107,6 +18191,10 @@ var init_render = __esmMin((() => {
18107
18191
  CHIP_GAP = 4;
18108
18192
  MODAL_ROOM = 8;
18109
18193
  COMPOSE_CHROME = 3;
18194
+ DRAFT_PAD = 2;
18195
+ NOTE_ROOM_MIN = 24;
18196
+ DRAFT_ROOM = 6;
18197
+ DRAFT_HEAD = 1;
18110
18198
  COMPOSE_ACTION_ROWS = 2;
18111
18199
  reportActions = (full) => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^t")} ${fg(palette.muted)(full ? "sending everything" : "sending the least")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
18112
18200
  SENDS = "send it";
@@ -18741,6 +18829,7 @@ var init_render = __esmMin((() => {
18741
18829
  if (answering.length > 0) return answering.slice(0, shownLines * 2).map((line) => clip(line, room));
18742
18830
  const said = threadQuote(state, room);
18743
18831
  if (said.length > 0) return said.slice(0, shownLines * 2).map((line) => clip(line, room));
18832
+ if (state.replyTo !== void 0) return [];
18744
18833
  const snippet = snippetOf(state, shownLines);
18745
18834
  const more = selectedLineCount(state) - snippet.length;
18746
18835
  const tail = more > 0 ? [` … ${more} more lines`] : [];
@@ -19413,6 +19502,8 @@ var init_render = __esmMin((() => {
19413
19502
  panelPicks = [];
19414
19503
  dragFrom;
19415
19504
  lastTop = 0;
19505
+ drafted;
19506
+ drafting;
19416
19507
  constructor(renderer, repo = "") {
19417
19508
  this.renderer = renderer;
19418
19509
  this.repo = repo;
@@ -19829,14 +19920,25 @@ var init_render = __esmMin((() => {
19829
19920
  const patch = shown.patch;
19830
19921
  this.view.setWrap(state.wrap, this.diffRoom());
19831
19922
  this.view.setPan(state.pan);
19832
- this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
19923
+ const draft = this.draftFor(state);
19924
+ this.drafted = draft;
19925
+ this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), {
19926
+ prose: proseFor(state, patch.path),
19927
+ draft
19928
+ });
19833
19929
  this.view.pick(state.picked);
19834
19930
  if (!takesText(state.screen)) {
19835
19931
  this.view.fit(this.diffRows());
19836
19932
  this.lastTop = this.view.scrollTo(state.top, state.cursor, state.scroll);
19837
19933
  if (state.sticky) this.paintSticky(state, this.view.rowAt(this.lastTop));
19838
19934
  else this.view.pin([]);
19935
+ } else if (draft !== void 0) {
19936
+ this.view.fit(this.diffRows());
19937
+ const held = state.scroll >= 0 && this.drafting === draft.row ? state.scroll : this.lastTop;
19938
+ this.lastTop = this.view.showDraft(held, draft.rows);
19939
+ this.drafting = draft.row;
19839
19940
  }
19941
+ if (draft === void 0) this.drafting = void 0;
19840
19942
  const top = this.lastTop;
19841
19943
  this.view.paint(this.linePaint(state), top, this.view.rows());
19842
19944
  this.paintGutter(state, top, this.view.rows());
@@ -20009,6 +20111,7 @@ var init_render = __esmMin((() => {
20009
20111
  paintReport(state) {
20010
20112
  this.compose.visible = state.screen === "compose" || state.screen === "report";
20011
20113
  if (state.screen !== "report") return;
20114
+ this.asBox();
20012
20115
  const room = composeRoom(this.renderer.width);
20013
20116
  const asked = state.reportFull ? "What went wrong? Everything on screen is attached for you." : "What went wrong? Only what you type is sent.";
20014
20117
  const lead = laidOut$1([asked], room.text);
@@ -20060,6 +20163,66 @@ var init_render = __esmMin((() => {
20060
20163
  });
20061
20164
  };
20062
20165
  }
20166
+ draftFor(state) {
20167
+ if (state.screen !== "compose") return void 0;
20168
+ if (this.diffRows() < DRAFT_ROOM) return void 0;
20169
+ const place = draftPlace(state);
20170
+ if (place === void 0 || this.view.screenRowOf(place.row) === void 0) return void 0;
20171
+ const body = this.draftBody(state);
20172
+ return {
20173
+ row: place.row,
20174
+ stop: place.stop,
20175
+ rows: DRAFT_HEAD + body + COMPOSE_ACTION_ROWS,
20176
+ head: clip(composeTarget(state), this.draftRoom())
20177
+ };
20178
+ }
20179
+ draftRoom() {
20180
+ return Math.max(NOTE_ROOM_MIN, this.view.noteWidth() - DRAFT_PAD);
20181
+ }
20182
+ draftBody(state) {
20183
+ const most = Math.max(1, this.diffRows() - DRAFT_HEAD - COMPOSE_ACTION_ROWS - 1);
20184
+ return Math.max(1, Math.min(most, laidDraft(state.draft, this.draftRoom()).length));
20185
+ }
20186
+ paintInline(state, draft) {
20187
+ const at = this.view.draftTop();
20188
+ if (at === void 0) return;
20189
+ this.asNote();
20190
+ this.composeTitle.content = "";
20191
+ this.composeTitle.height = 0;
20192
+ this.composeQuoted.content = "";
20193
+ this.composeQuoted.height = 0;
20194
+ this.fitBody(state, this.draftRoom(), draft.rows - DRAFT_HEAD - COMPOSE_ACTION_ROWS);
20195
+ this.composeActions.content = actionsText(state.answerTo === void 0 ? SENDS : REPLIES);
20196
+ this.compose.height = draft.rows - DRAFT_HEAD;
20197
+ this.compose.width = this.draftRoom();
20198
+ this.compose.left = this.view.saidLeft();
20199
+ const top = this.view.screenTop();
20200
+ const lowest = top + Math.max(0, this.view.rows() - draft.rows + DRAFT_HEAD);
20201
+ this.compose.top = Math.max(top, Math.min(lowest, top + at + DRAFT_HEAD - this.lastTop));
20202
+ }
20203
+ asNote() {
20204
+ if (this.compose.border !== false) {
20205
+ this.compose.border = false;
20206
+ this.compose.paddingLeft = 0;
20207
+ this.compose.paddingRight = 0;
20208
+ this.compose.paddingTop = 0;
20209
+ this.compose.backgroundColor = "transparent";
20210
+ this.composeBody.backgroundColor = "transparent";
20211
+ this.composeBody.focusedBackgroundColor = "transparent";
20212
+ }
20213
+ }
20214
+ asBox() {
20215
+ if (this.compose.border === false) {
20216
+ this.compose.border = ["left"];
20217
+ this.compose.paddingLeft = GUTTER_X;
20218
+ this.compose.paddingRight = GUTTER_X;
20219
+ this.compose.paddingTop = 1;
20220
+ this.compose.backgroundColor = palette.panel;
20221
+ this.composeBody.backgroundColor = palette.panel;
20222
+ this.composeBody.focusedBackgroundColor = palette.panel;
20223
+ this.composeTitle.height = 1;
20224
+ }
20225
+ }
20063
20226
  fitBody(state, room, most) {
20064
20227
  if (this.composeBody.width !== room) this.composeBody.width = room;
20065
20228
  const wanted = Math.max(1, laidDraft(state.draft, room).length);
@@ -20070,6 +20233,12 @@ var init_render = __esmMin((() => {
20070
20233
  paintCompose(state) {
20071
20234
  this.compose.visible = state.screen === "compose";
20072
20235
  if (state.screen !== "compose") return;
20236
+ const inline = this.drafted;
20237
+ if (inline !== void 0) {
20238
+ this.paintInline(state, inline);
20239
+ return;
20240
+ }
20241
+ this.asBox();
20073
20242
  const room = composeRoom(this.renderer.width);
20074
20243
  const shownLines = Math.max(1, Math.min(SNIPPET_LINES, Math.floor(this.renderer.height / 6)));
20075
20244
  const quoted = quotedFor(state, shownLines, room.text);
@@ -20791,7 +20960,8 @@ var init_app = __esmMin((() => {
20791
20960
  return Date.now() - this.began;
20792
20961
  }
20793
20962
  commit(given) {
20794
- const next = given.patchIndex === this.state.patchIndex ? given : turnedOver(given);
20963
+ const kept = this.keptScroll(given);
20964
+ const next = kept.patchIndex === this.state.patchIndex ? kept : turnedOver(kept);
20795
20965
  this.turnWriting(next);
20796
20966
  const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
20797
20967
  if (appeared) this.recordNotice(next.notice);
@@ -20800,6 +20970,14 @@ var init_app = __esmMin((() => {
20800
20970
  this.write(next);
20801
20971
  if (appeared) this.fade();
20802
20972
  }
20973
+ keptScroll(given) {
20974
+ if (this.state.screen !== "compose" || given.screen === "compose") return given;
20975
+ if (given.patchIndex !== this.state.patchIndex) return given;
20976
+ return {
20977
+ ...given,
20978
+ scroll: runSync(this.display.at)
20979
+ };
20980
+ }
20803
20981
  recordNotice(notice) {
20804
20982
  this.trail.push(noticeOf(notice, this.since()));
20805
20983
  if (this.trail.length > TRAIL_HISTORY) this.trail.shift();
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.171",
26
+ "version": "0.1.0-alpha.172",
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": {