@eliya-oss/agent-diff 0.1.0-alpha.139 → 0.1.0-alpha.140

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.
@@ -22,7 +22,9 @@ each test builds its world into a real repository, boots adiff in a real termina
22
22
  the test pressed, encodes an mp4 and uploads it. It prints a finished `## Recorded tests` section.
23
23
  Paste that under the body.
24
24
 
25
- `pnpm record --test <path>` records one file instead of the whole branch.
25
+ `pnpm record --test <path>` records one file instead of the whole branch. `pnpm record --base
26
+ <branch>` reads the branch against something other than `origin/main`, which is what a PR stacked on
27
+ another PR needs so it records only its own tests.
26
28
 
27
29
  A recording narrates itself, so somebody who has never opened adiff can follow it:
28
30
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.140
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(comment delivery): with `hold` on, a comment waits with the others until `C` sends them to the agent as one review.
8
+
9
+ The review panel lists what is waiting under *Waiting to be sent*, the footer counts it, `X` drops the one under the cursor, and leaving with comments still waiting says so before it lets you go. Nothing waiting is a sent comment: it has no id the agent could answer and it is not in the inbox until it goes.
10
+
3
11
  ## 0.1.0-alpha.139
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -42,6 +42,9 @@ comment that `ctrl+s` sends. `d` settles the thread you are on, `m` marks a file
42
42
  copies the line you are on, and dragging over lines copies them. `?` lists every key and filters as
43
43
  you type. The footer carries the keys of whichever pane you are in.
44
44
 
45
+ `,` opens the preferences and turns any of it on or off. Turn on holding and a comment waits with
46
+ the others until `C` sends them to the agent as one review.
47
+
45
48
  ## For agents
46
49
 
47
50
  Three commands are the whole loop:
package/dist/main.js CHANGED
@@ -10243,7 +10243,7 @@ var init_error = __esmMin((() => {
10243
10243
  }));
10244
10244
  //#endregion
10245
10245
  //#region src/cli/commands.ts
10246
- 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, sentIn, listSent, anchorIn, commentIn, submitComment, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
10246
+ 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, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
10247
10247
  var init_commands = __esmMin((() => {
10248
10248
  init_dist();
10249
10249
  init_patch();
@@ -10517,25 +10517,36 @@ var init_commands = __esmMin((() => {
10517
10517
  onSome: succeed$1
10518
10518
  });
10519
10519
  });
10520
- commentIn = fn("Cli.commentIn")(function* (worktree, request) {
10520
+ commentsIn = fn("Cli.commentsIn")(function* (worktree, requests) {
10521
10521
  const store = yield* Store;
10522
- const chosen = yield* anchorIn(worktree, request);
10523
- const batch = {
10524
- id: request.id,
10525
- at: request.at,
10526
- head: worktree.head,
10527
- comments: [{
10522
+ const anchoring = fn("Cli.anchoring")(function* (request) {
10523
+ const anchor = yield* anchorIn(worktree, request);
10524
+ return {
10528
10525
  id: request.id,
10529
- anchor: chosen,
10526
+ anchor,
10530
10527
  body: request.body
10531
- }]
10528
+ };
10529
+ });
10530
+ const anchored = yield* forEach(requests, anchoring);
10531
+ const batch = {
10532
+ id: requests[0].id,
10533
+ at: requests[0].at,
10534
+ head: worktree.head,
10535
+ comments: anchored
10532
10536
  };
10533
10537
  yield* store.submit(worktree.path, batch);
10534
10538
  return batch;
10535
10539
  });
10540
+ commentIn = fn("Cli.commentIn")(function* (worktree, request) {
10541
+ return yield* commentsIn(worktree, [request]);
10542
+ });
10536
10543
  submitComment = fn("Cli.submitComment")(function* (request) {
10537
10544
  return yield* commentIn(yield* findBranch(request.repo, request.branch), request);
10538
10545
  });
10546
+ submitComments = fn("Cli.submitComments")(function* (requests) {
10547
+ const worktree = yield* findBranch(requests[0].repo, requests[0].branch);
10548
+ return yield* commentsIn(worktree, requests);
10549
+ });
10539
10550
  without$1 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
10540
10551
  submitReply = fn("Cli.submitReply")(function* (request) {
10541
10552
  const store = yield* Store;
@@ -11105,7 +11116,7 @@ var init_pane = __esmMin((() => {
11105
11116
  init_drafts();
11106
11117
  init_init();
11107
11118
  init_pane();
11108
- var version$1 = "0.1.0-alpha.139";
11119
+ var version$1 = "0.1.0-alpha.140";
11109
11120
  //#endregion
11110
11121
  //#region src/cli/upgrade.ts
11111
11122
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -12871,7 +12882,7 @@ const helpUnder = (noun) => {
12871
12882
  };
12872
12883
  //#endregion
12873
12884
  //#region src/tui/gaps.ts
12874
- var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf, openAbove, openBelow, makeRows, compose, cache, keyOf$1, shownOf, gapAtRow, gapNumbered, gapRowSet;
12885
+ var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, makeRows, compose, cache, keyOf$1, shownOf, gapAtRow, gapNumbered, gapRowSet;
12875
12886
  var init_gaps = __esmMin((() => {
12876
12887
  init_dist();
12877
12888
  sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
@@ -12930,11 +12941,11 @@ var init_gaps = __esmMin((() => {
12930
12941
  const asked = build.reveals.find((entry) => entry.gap === index)?.lines ?? 0;
12931
12942
  return Math.min(count, Math.max(0, asked));
12932
12943
  };
12933
- countOf = (span) => Math.max(0, span.hi - span.lo + 1);
12944
+ countOf$1 = (span) => Math.max(0, span.hi - span.lo + 1);
12934
12945
  openAbove = (made, build, index) => {
12935
12946
  const span = build.spans[index];
12936
12947
  if (span === void 0) return 0;
12937
- const count = countOf(span);
12948
+ const count = countOf$1(span);
12938
12949
  const open = openOf(build, index, count);
12939
12950
  const left = count - open;
12940
12951
  if (left > 0) markGap(made, index, left);
@@ -12945,7 +12956,7 @@ var init_gaps = __esmMin((() => {
12945
12956
  const index = build.base.hunks.length;
12946
12957
  const span = build.spans[index];
12947
12958
  if (span === void 0) return;
12948
- const count = countOf(span);
12959
+ const count = countOf$1(span);
12949
12960
  const open = openOf(build, index, count);
12950
12961
  for (const row of linesFrom(build, span.lo, span.lo + open - 1)) push(made, row);
12951
12962
  if (count - open > 0) markGap(made, index, count - open);
@@ -13174,6 +13185,7 @@ var init_model = __esmMin((() => {
13174
13185
  }));
13175
13186
  };
13176
13187
  nothingReviewed = {
13188
+ held: [],
13177
13189
  arrived: [],
13178
13190
  panelOpen: true,
13179
13191
  panelWas: true,
@@ -13736,6 +13748,7 @@ var init_model = __esmMin((() => {
13736
13748
  filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) ? [index] : []);
13737
13749
  answerCount = (comments) => comments.reduce((total, entry) => total + (entry.answers?.length ?? 0), 0);
13738
13750
  PANEL_SECTIONS = [
13751
+ "held",
13739
13752
  "asked",
13740
13753
  "filed",
13741
13754
  "with",
@@ -13770,7 +13783,13 @@ var init_model = __esmMin((() => {
13770
13783
  };
13771
13784
  };
13772
13785
  panelEntries = (state) => {
13773
- const delivered = (state.hideSettled ? state.sent.filter((comment) => comment.settled !== true) : state.sent).map((comment) => sentEntry(state, comment));
13786
+ const shown = state.hideSettled ? state.sent.filter((comment) => comment.settled !== true) : state.sent;
13787
+ const delivered = [...state.held.map((comment) => ({
13788
+ section: "held",
13789
+ comment,
13790
+ fresh: false,
13791
+ unread: 0
13792
+ })), ...shown.map((comment) => sentEntry(state, comment))];
13774
13793
  const ordered = (section) => {
13775
13794
  const found = delivered.filter((entry) => entry.section === section);
13776
13795
  return state.newestFirst ? found.toReversed() : found;
@@ -13951,7 +13970,7 @@ var init_watch = __esmMin((() => {
13951
13970
  }));
13952
13971
  //#endregion
13953
13972
  //#region src/tui/command.ts
13954
- var EVERY_PANE, command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, glossaryFor, actionFor, GLYPHS, displayKey, SWAPPED, hintOf, hintsFor;
13973
+ var EVERY_PANE, command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, glossaryFor, actionFor, GLYPHS, displayKey, heldOrRemoved, SWAPPED, hintOf, hintsFor;
13955
13974
  var init_command = __esmMin((() => {
13956
13975
  EVERY_PANE = [
13957
13976
  "tree",
@@ -13971,6 +13990,7 @@ var init_command = __esmMin((() => {
13971
13990
  whenSelecting: false,
13972
13991
  whenReviewed: false,
13973
13992
  whenPull: false,
13993
+ whenHeld: false,
13974
13994
  panes: EVERY_PANE,
13975
13995
  rank: 0,
13976
13996
  ...input
@@ -14532,6 +14552,27 @@ var init_command = __esmMin((() => {
14532
14552
  hint: "comment",
14533
14553
  rank: 3
14534
14554
  }),
14555
+ command({
14556
+ action: "held.send",
14557
+ also: [
14558
+ "send",
14559
+ "dispatch",
14560
+ "flush",
14561
+ "send everything"
14562
+ ],
14563
+ panes: [
14564
+ "diff",
14565
+ "tree",
14566
+ "review"
14567
+ ],
14568
+ category: "Comments",
14569
+ title: "Send the comments you are holding",
14570
+ keys: ["C"],
14571
+ screens: ["review"],
14572
+ hint: "send",
14573
+ whenHeld: true,
14574
+ rank: 1
14575
+ }),
14535
14576
  command({
14536
14577
  action: "report.open",
14537
14578
  title: "Report a bug",
@@ -14732,18 +14773,23 @@ var init_command = __esmMin((() => {
14732
14773
  if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
14733
14774
  return GLYPHS[key] ?? key;
14734
14775
  };
14776
+ heldOrRemoved = (offered) => {
14777
+ if (offered.onHeld) return "drop";
14778
+ return offered.onRemoved ? "restore" : "remove";
14779
+ };
14735
14780
  SWAPPED = {
14736
14781
  "rail.toggle": (offered) => offered.onLayers ? "file tree" : "layers",
14737
14782
  "tree.winnow": (offered) => offered.hidingRead ? "show read" : "hide read",
14738
14783
  "panel.winnow": (offered) => offered.hidingSettled ? "show settled" : "hide settled",
14739
- "thread.remove": (offered) => offered.onRemoved ? "restore" : "remove"
14784
+ "thread.remove": (offered) => heldOrRemoved(offered),
14785
+ "held.send": (offered) => `send ${offered.held}`
14740
14786
  };
14741
14787
  hintOf = (entry, offered) => {
14742
14788
  const swapped = SWAPPED[entry.action];
14743
14789
  if (swapped !== void 0) return swapped(offered);
14744
14790
  return entry.counted ? `${entry.hint} ${offered.comments}` : entry.hint;
14745
14791
  };
14746
- hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenComments || offered.comments > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenStale || offered.stale).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenSelecting || offered.selecting).filter((entry) => !entry.whenReviewed || offered.reviewed > 0).filter((entry) => !entry.whenPull || offered.pull).filter((entry) => entry.panes.includes(offered.pane)).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
14792
+ hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenComments || offered.comments > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenStale || offered.stale).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenSelecting || offered.selecting).filter((entry) => !entry.whenReviewed || offered.reviewed > 0).filter((entry) => !entry.whenPull || offered.pull).filter((entry) => !entry.whenHeld || offered.held > 0).filter((entry) => entry.panes.includes(offered.pane)).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
14747
14793
  key: displayKey(entry.keys[0] ?? ""),
14748
14794
  hint: hintOf(entry, offered),
14749
14795
  press: entry.keys[0] ?? ""
@@ -15310,6 +15356,7 @@ var init_reduce = __esmMin((() => {
15310
15356
  "select.swap": swapEnds,
15311
15357
  "compose.open": openCompose,
15312
15358
  "compose.submit": (state) => state,
15359
+ "held.send": (state) => state,
15313
15360
  "thread.reply": (state) => state,
15314
15361
  "focus.toggle": (state) => ({
15315
15362
  ...state,
@@ -16497,7 +16544,7 @@ var init_diffview = __esmMin((() => {
16497
16544
  }));
16498
16545
  //#endregion
16499
16546
  //#region src/tui/render.ts
16500
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, 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, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, 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, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16547
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, 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, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, 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, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16501
16548
  var init_render = __esmMin((() => {
16502
16549
  init_dist();
16503
16550
  init_command();
@@ -17336,7 +17383,24 @@ var init_render = __esmMin((() => {
17336
17383
  return `${row.here === true ? marks().cursor : " "}${look.mark.padStart(GUTTER - 1)}`;
17337
17384
  };
17338
17385
  layerText = (row, look, room) => row.kind === "gap" ? "" : `${layerGutter(row, look)}${" ".repeat(look.lead - GUTTER)}${row.text}`.padEnd(room.title + TITLE_LEAD);
17386
+ offeredIn = (state) => ({
17387
+ comments: state.sent.length,
17388
+ held: state.held.length,
17389
+ layers: state.layers.length,
17390
+ onThread: state.stop > 0 || threadChosen(state) !== void 0,
17391
+ selecting: state.selecting,
17392
+ reviewed: reviewedCountIn(state),
17393
+ pull: pullHere(state).length > 0,
17394
+ pane: state.screen === "review" ? state.focus : "diff",
17395
+ stale: state.layersStale,
17396
+ onLayers: onLayers(state),
17397
+ hidingRead: state.hideReviewed,
17398
+ hidingSettled: state.hideSettled,
17399
+ onRemoved: threadHere(state)?.removed === true,
17400
+ onHeld: state.focus === "review" && panelEntry(state)?.section === "held"
17401
+ });
17339
17402
  PANEL_TITLES = {
17403
+ held: "Waiting to be sent",
17340
17404
  asked: "Waiting on you",
17341
17405
  filed: "Not picked up",
17342
17406
  with: "Picked up, no answer",
@@ -17671,20 +17735,7 @@ var init_render = __esmMin((() => {
17671
17735
  }
17672
17736
  update(state) {
17673
17737
  this.shown = state;
17674
- this.chips = hintsFor(state.screen, {
17675
- comments: state.sent.length,
17676
- layers: state.layers.length,
17677
- onThread: state.stop > 0 || threadChosen(state) !== void 0,
17678
- selecting: state.selecting,
17679
- reviewed: reviewedCountIn(state),
17680
- pull: pullHere(state).length > 0,
17681
- pane: state.screen === "review" ? state.focus : "diff",
17682
- stale: state.layersStale,
17683
- onLayers: onLayers(state),
17684
- hidingRead: state.hideReviewed,
17685
- hidingSettled: state.hideSettled,
17686
- onRemoved: threadHere(state)?.removed === true
17687
- });
17738
+ this.chips = hintsFor(state.screen, offeredIn(state));
17688
17739
  this.header.content = this.headerText(state);
17689
17740
  this.footer.content = this.footerText(state);
17690
17741
  this.list.content = this.listText(state);
@@ -18283,7 +18334,7 @@ var init_upgrade = __esmMin((() => {
18283
18334
  }));
18284
18335
  //#endregion
18285
18336
  //#region src/tui/app.ts
18286
- var LEAVING_MS, LOOK_MS, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
18337
+ var LEAVING_MS, LOOK_MS, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
18287
18338
  var init_app = __esmMin((() => {
18288
18339
  init_dist();
18289
18340
  init_report();
@@ -18306,6 +18357,8 @@ var init_app = __esmMin((() => {
18306
18357
  AGE_TICK_MS = 3e4;
18307
18358
  LEAVING_SAID = "press ctrl+c again to leave";
18308
18359
  NOTHING_WRITTEN = "nothing written yet";
18360
+ countOf = (many, one) => `${many} ${one}${many === 1 ? "" : "s"}`;
18361
+ leavingSaid = (state) => state.held.length === 0 ? LEAVING_SAID : `${countOf(state.held.length, "comment")} never sent — press ctrl+c again to leave without them`;
18309
18362
  LAYERS_ASK_LEAD = "About this branch, not about this line.";
18310
18363
  layersAsk = (state) => {
18311
18364
  if (state.layers.length === 0) return `${LAYERS_ASK_LEAD} Please write a reading order for it with \`adiff layers set\`, so the diff can be read in the order the change was made rather than by filename.`;
@@ -18801,6 +18854,7 @@ var init_app = __esmMin((() => {
18801
18854
  "branch.pull": () => this.showPull(),
18802
18855
  "compose.open": () => this.compose(),
18803
18856
  "compose.submit": () => this.send(),
18857
+ "held.send": () => this.sendHeld(),
18804
18858
  "palette.run": () => this.runChoice(),
18805
18859
  "comment.next": () => this.walkComments(1),
18806
18860
  "comment.prev": () => this.walkComments(-1),
@@ -19188,8 +19242,19 @@ var init_app = __esmMin((() => {
19188
19242
  panelIndex: Math.min(was, last)
19189
19243
  };
19190
19244
  }
19245
+ heldUnderCursor() {
19246
+ if (this.state.focus !== "review") return -1;
19247
+ const entry = panelEntry(this.state);
19248
+ if (entry?.section !== "held") return -1;
19249
+ return this.state.held.indexOf(entry.comment);
19250
+ }
19191
19251
  removeHere() {
19192
19252
  return gen({ self: this }, function* () {
19253
+ const waiting = this.heldUnderCursor();
19254
+ if (waiting !== -1) {
19255
+ yield* this.dropHeld(waiting);
19256
+ return;
19257
+ }
19193
19258
  const branch = selectedBranch(this.state);
19194
19259
  const thread = threadHere(this.state);
19195
19260
  const id = thread?.id;
@@ -19363,7 +19428,7 @@ var init_app = __esmMin((() => {
19363
19428
  forgetLeaving() {
19364
19429
  if (this.leaving === void 0) return;
19365
19430
  this.leaving = void 0;
19366
- if (this.state.notice === LEAVING_SAID) this.commit(withNoticeHere(this.state, ""));
19431
+ if (this.state.notice === leavingSaid(this.state)) this.commit(withNoticeHere(this.state, ""));
19367
19432
  }
19368
19433
  askedToLeave() {
19369
19434
  return sync(() => {
@@ -19377,7 +19442,7 @@ var init_app = __esmMin((() => {
19377
19442
  return;
19378
19443
  }
19379
19444
  this.leaving = Date.now();
19380
- this.commit(withNotice(this.state, LEAVING_SAID));
19445
+ this.commit(withNotice(this.state, leavingSaid(this.state)));
19381
19446
  });
19382
19447
  }
19383
19448
  worktreeFor(branch) {
@@ -19388,6 +19453,10 @@ var init_app = __esmMin((() => {
19388
19453
  const worktree = this.worktreeFor(branch);
19389
19454
  return worktree === void 0 ? submitComment(request) : commentIn(worktree, request);
19390
19455
  }
19456
+ sending(branch, requests) {
19457
+ const worktree = this.worktreeFor(branch);
19458
+ return worktree === void 0 ? submitComments(requests) : commentsIn(worktree, requests);
19459
+ }
19391
19460
  settling(branch, id) {
19392
19461
  const at = (/* @__PURE__ */ new Date()).toISOString();
19393
19462
  const worktree = this.worktreeFor(branch);
@@ -19596,6 +19665,17 @@ var init_app = __esmMin((() => {
19596
19665
  this.commit(withNotice(this.state, "nothing selected"));
19597
19666
  return;
19598
19667
  }
19668
+ const body = yield* this.display.written;
19669
+ if (this.state.hold) {
19670
+ this.holding({
19671
+ file: patch.path,
19672
+ side: anchor.value.side,
19673
+ start: anchor.value.start,
19674
+ end: anchor.value.end,
19675
+ body
19676
+ });
19677
+ return;
19678
+ }
19599
19679
  yield* this.commenting(branch.branch, {
19600
19680
  repo: this.repo,
19601
19681
  branch: branch.branch,
@@ -19603,7 +19683,7 @@ var init_app = __esmMin((() => {
19603
19683
  side: anchor.value.side,
19604
19684
  start: anchor.value.start,
19605
19685
  end: anchor.value.end,
19606
- body: yield* this.display.written,
19686
+ body,
19607
19687
  id: randomUUID(),
19608
19688
  at: (/* @__PURE__ */ new Date()).toISOString()
19609
19689
  });
@@ -19611,6 +19691,49 @@ var init_app = __esmMin((() => {
19611
19691
  this.commit(withNotice(sentAway(withSent(this.state, sent)), "sent to the agent"));
19612
19692
  });
19613
19693
  }
19694
+ holding(comment) {
19695
+ const held = [...this.state.held, comment];
19696
+ this.commit(withNotice(sentAway({
19697
+ ...this.state,
19698
+ held
19699
+ }), `held — ${countOf(held.length, "comment")} waiting, press C to send`));
19700
+ }
19701
+ dropHeld(at) {
19702
+ return sync(() => {
19703
+ const was = this.state.panelIndex;
19704
+ const held = this.state.held.filter((_, index) => index !== at);
19705
+ this.commit(withNotice(this.staying({
19706
+ ...this.state,
19707
+ held
19708
+ }, was), "dropped, it was never sent"));
19709
+ });
19710
+ }
19711
+ sendHeld() {
19712
+ return gen({ self: this }, function* () {
19713
+ const branch = selectedBranch(this.state);
19714
+ const [first, ...rest] = this.state.held;
19715
+ if (branch === void 0 || first === void 0) return;
19716
+ const at = (/* @__PURE__ */ new Date()).toISOString();
19717
+ const asked = (comment) => ({
19718
+ repo: this.repo,
19719
+ branch: branch.branch,
19720
+ file: comment.file,
19721
+ side: comment.side,
19722
+ start: comment.start,
19723
+ end: comment.end,
19724
+ body: comment.body,
19725
+ id: randomUUID(),
19726
+ at
19727
+ });
19728
+ const many = this.state.held.length;
19729
+ yield* this.sending(branch.branch, [asked(first), ...rest.map(asked)]);
19730
+ const sent = yield* this.loadSent(branch.branch);
19731
+ this.commit(withNotice(withSent({
19732
+ ...this.state,
19733
+ held: []
19734
+ }, sent), `sent ${countOf(many, "comment")} to the agent`));
19735
+ });
19736
+ }
19614
19737
  };
19615
19738
  sentAway = (state) => ({
19616
19739
  ...state,
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.139",
26
+ "version": "0.1.0-alpha.140",
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": {