@eliya-oss/agent-diff 0.1.0-alpha.51 → 0.1.0-alpha.53

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.53
4
+
5
+ ### Patch Changes
6
+
7
+ - Three places where the screen did something and said nothing about it. `}` and `{` now name the edge they hit instead of absorbing the keystroke, and when a file has been widened into a single change they name the context ladder as the reason — `+` quietly trades the changes you were stepping between for the lines around them. The review panel settles and removes the comment it is standing on, so a comment the diff cannot reach — its file deleted since, or just not the file on screen — stops being one you can see but not answer. And `… N more` counts what is below it rather than every row outside the window, so scrolling to the last file no longer promises seventeen more that are not there.
8
+
9
+ ## 0.1.0-alpha.52
10
+
11
+ ### Patch Changes
12
+
13
+ - Pasting into a comment works. The terminal hands a paste over in one piece rather than replaying it as keystrokes, and adiff was only listening for keystrokes, so every paste was read correctly and then thrown away — nothing appeared, and quoting a stack trace or an error message meant retyping it. A paste now lands at the caret in one move. Line breaks survive in a draft and become spaces in the palette, whose query is one line; tabs become two spaces so pasted code keeps its shape; escape sequences and control characters are stripped, because a comment is prose an agent reads back rather than a channel to the screen.
14
+
3
15
  ## 0.1.0-alpha.51
4
16
 
5
17
  ### Patch Changes
package/dist/main.js CHANGED
@@ -7,7 +7,7 @@ import { execFile, spawn } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
8
  import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
10
- import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, SelectRenderable, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer, fg, getTreeSitterClient, pathToFiletype, t } from "@opentui/core";
10
+ import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, SelectRenderable, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer, decodePasteBytes, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
11
11
  //#region \0rolldown/runtime.js
12
12
  var __defProp = Object.defineProperty;
13
13
  var __esmMin = (fn, res, err) => () => {
@@ -8407,7 +8407,7 @@ var init_service$1 = __esmMin((() => {
8407
8407
  parent: held.parent
8408
8408
  };
8409
8409
  });
8410
- cursorOps = (state, saveState, inbox) => {
8410
+ cursorOps = (state, saveState, inbox, spoken) => {
8411
8411
  return {
8412
8412
  stage: fn("Store.stage")(function* (worktreePath, comment) {
8413
8413
  const current = yield* state(worktreePath);
@@ -8441,12 +8441,17 @@ var init_service$1 = __esmMin((() => {
8441
8441
  take: fn("Store.take")(function* (worktreePath) {
8442
8442
  const batches = yield* inbox(worktreePath);
8443
8443
  const current = yield* state(worktreePath);
8444
- const pending = batches.slice(current.consumed);
8445
- if (pending.length > 0) yield* saveState(worktreePath, {
8446
- ...current,
8447
- consumed: batches.length
8444
+ const answered = new Set((yield* spoken(worktreePath)).map((entry) => entry.comment));
8445
+ const owed = (comment) => !answered.has(comment.id) && !Object.hasOwn(current.settled, comment.id) && !Object.hasOwn(current.removed, comment.id);
8446
+ return batches.flatMap((batch) => {
8447
+ const comments = batch.comments.filter(owed);
8448
+ return comments.length === 0 ? [] : [{
8449
+ id: batch.id,
8450
+ at: batch.at,
8451
+ head: batch.head,
8452
+ comments
8453
+ }];
8448
8454
  });
8449
- return pending;
8450
8455
  })
8451
8456
  };
8452
8457
  };
@@ -8618,7 +8623,8 @@ var init_service$1 = __esmMin((() => {
8618
8623
  makeStore = (root) => {
8619
8624
  const { submit, inbox } = inboxOps(root);
8620
8625
  const { state, saveState } = stateOps(root);
8621
- const cursors = cursorOps(state, saveState, inbox);
8626
+ const talk = answerOps(root);
8627
+ const cursors = cursorOps(state, saveState, inbox, talk.answers);
8622
8628
  return {
8623
8629
  root,
8624
8630
  branchAt: (worktreePath) => promise(() => headOf$1(worktreePath)),
@@ -8629,7 +8635,7 @@ var init_service$1 = __esmMin((() => {
8629
8635
  saveReport: reportOps(root),
8630
8636
  ...settingsOps(root),
8631
8637
  ...upgradeOps(root),
8632
- ...answerOps(root),
8638
+ ...talk,
8633
8639
  ...layersOps(root),
8634
8640
  ...cursors
8635
8641
  };
@@ -8696,11 +8702,11 @@ var init_commands = __esmMin((() => {
8696
8702
  waitingOn = fn("Cli.waitingOn")(function* (worktree) {
8697
8703
  const store = yield* Store;
8698
8704
  const state = yield* store.state(worktree.path);
8699
- const batches = yield* store.inbox(worktree.path);
8705
+ const owed = yield* store.take(worktree.path);
8700
8706
  const told = yield* store.layers(worktree.path);
8701
8707
  return {
8702
8708
  staged: state.pending.length,
8703
- unread: Math.max(0, batches.length - state.consumed),
8709
+ unread: owed.reduce((total, batch) => total + batch.comments.length, 0),
8704
8710
  layers: match$3(told, {
8705
8711
  onNone: () => 0,
8706
8712
  onSome: (layers) => layers.layers.length
@@ -9230,7 +9236,7 @@ var init_pane = __esmMin((() => {
9230
9236
  init_commands();
9231
9237
  init_init();
9232
9238
  init_pane();
9233
- var version$1 = "0.1.0-alpha.51";
9239
+ var version$1 = "0.1.0-alpha.53";
9234
9240
  //#endregion
9235
9241
  //#region src/cli/upgrade.ts
9236
9242
  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, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -10135,10 +10141,10 @@ var init_catalog = __esmMin((() => {
10135
10141
  },
10136
10142
  {
10137
10143
  name: "comment take",
10138
- about: "Collect the comments this review has not handed over yet. Exactly-once",
10144
+ about: "Collect the comments this review is still owed an answer on. Repeats until answered",
10139
10145
  group: ANSWER_COMMENTS,
10140
10146
  addresses: "review",
10141
- safety: "write",
10147
+ safety: "read",
10142
10148
  options: [...addressing, {
10143
10149
  name: "wait",
10144
10150
  required: false,
@@ -10951,7 +10957,7 @@ var init_tree = __esmMin((() => {
10951
10957
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
10952
10958
  };
10953
10959
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
10954
- })), nothingReviewed, initialState, BODY_BORDER, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, PANEL_WIDTH, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, treeRows, crowdedOf, foldersOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelEntry, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
10960
+ })), nothingReviewed, initialState, BODY_BORDER, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, PANEL_WIDTH, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, treeRows, crowdedOf, foldersOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, caretAt, drafted, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, caretToEdge, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
10955
10961
  var init_model = __esmMin((() => {
10956
10962
  init_dist();
10957
10963
  init_patch();
@@ -11131,7 +11137,7 @@ var init_model = __esmMin((() => {
11131
11137
  const start = Math.max(0, Math.min(rows.length - height, wanted));
11132
11138
  return {
11133
11139
  rows: rows.slice(start, start + height),
11134
- more: rows.length - height
11140
+ more: rows.length - (start + height)
11135
11141
  };
11136
11142
  };
11137
11143
  selectedBranch = (state) => state.branches[state.branchIndex];
@@ -11166,7 +11172,7 @@ var init_model = __esmMin((() => {
11166
11172
  const start = Math.max(0, Math.min(rows.length - height, anchor - Math.floor(height / 2)));
11167
11173
  return {
11168
11174
  rows: rows.slice(start, start + height),
11169
- more: rows.length - height
11175
+ more: rows.length - (start + height)
11170
11176
  };
11171
11177
  };
11172
11178
  commentsOn = (state, fileIndex) => {
@@ -11399,6 +11405,11 @@ var init_model = __esmMin((() => {
11399
11405
  ];
11400
11406
  };
11401
11407
  panelEntry = (state) => panelEntries(state)[state.panelIndex];
11408
+ threadChosen = (state) => {
11409
+ if (state.focus !== "review") return void 0;
11410
+ const entry = panelEntry(state);
11411
+ return entry === void 0 || entry.section === "staged" ? void 0 : entry.comment;
11412
+ };
11402
11413
  spokenSince = (seen, now) => Math.max(0, answerCount(now) - answerCount(seen));
11403
11414
  hunkStarts = (state) => {
11404
11415
  const patch = selectedPatch(state);
@@ -12092,7 +12103,7 @@ var init_match = __esmMin((() => {
12092
12103
  }));
12093
12104
  //#endregion
12094
12105
  //#region src/tui/reduce.ts
12095
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, movePanel, layerDown, nextFocus, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, withPatches, inserted, typed, backspaced, deleted, caretMoved, caretJumped, caretHomed, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12106
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, movePanel, layerDown, nextFocus, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, withPatches, inserted, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, deleted, caretMoved, caretJumped, caretHomed, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12096
12107
  var init_reduce = __esmMin((() => {
12097
12108
  init_dist();
12098
12109
  init_patch();
@@ -12157,10 +12168,14 @@ var init_reduce = __esmMin((() => {
12157
12168
  stop: 0,
12158
12169
  cursor: clamp(row, 0, lastRow(selectedPatch(state)))
12159
12170
  });
12171
+ noneLeft = (state, delta) => {
12172
+ const only = hunkStarts(state).length <= 1;
12173
+ return withNotice(state, only ? "this file reads as one change · press - for less context to split it" : `no change ${delta > 0 ? "after" : "before"} this one`);
12174
+ };
12160
12175
  layerHunk = (state, delta) => {
12161
12176
  const starts = hunkStarts(state);
12162
12177
  const target = delta > 0 ? starts.find((start) => start > state.cursor) : starts.findLast((start) => start < state.cursor);
12163
- return target === void 0 ? state : atRow(state, target);
12178
+ return target === void 0 ? noneLeft(state, delta) : atRow(state, target);
12164
12179
  };
12165
12180
  nextFileWithComments = (state, delta) => {
12166
12181
  const elsewhere = filesWithComments(state).filter((index) => index !== state.patchIndex);
@@ -12648,6 +12663,21 @@ var init_reduce = __esmMin((() => {
12648
12663
  query: `${state.query}${character}`,
12649
12664
  paletteIndex: 0
12650
12665
  } : inserted(state, character);
12666
+ TAB_WIDTH = 2;
12667
+ SPACE_CODE = 32;
12668
+ ERASED_FROM = 127;
12669
+ ERASED_TO = 159;
12670
+ readable = (character) => {
12671
+ if (character === "\n") return true;
12672
+ const code = character.codePointAt(0) ?? 0;
12673
+ return code >= SPACE_CODE && (code < ERASED_FROM || code > ERASED_TO);
12674
+ };
12675
+ legible = (text) => Array.from(text.replace(/\r\n?/g, "\n").replace(/\t/g, " ".repeat(TAB_WIDTH))).filter(readable).join("");
12676
+ pasted = (state, text) => {
12677
+ const clean = legible(stripAnsiSequences(text));
12678
+ if (clean.length === 0) return state;
12679
+ return typed(state, state.screen === "palette" ? clean.replace(/\n/g, " ") : clean);
12680
+ };
12651
12681
  backspaced = (state) => {
12652
12682
  if (state.screen === "palette") return {
12653
12683
  ...state,
@@ -13716,7 +13746,7 @@ var init_render = __esmMin((() => {
13716
13746
  };
13717
13747
  waitingLabel = (branch) => {
13718
13748
  if (branch.staged > 0) return `${branch.staged} staged`;
13719
- return branch.unread > 0 ? `${branch.unread} unread` : "";
13749
+ return branch.unread > 0 ? `${branch.unread} unanswered` : "";
13720
13750
  };
13721
13751
  inRange = (state, row, from, to) => state.selecting && row >= from && row <= to;
13722
13752
  notesOf = (comments, path, sent, opened = []) => comments.filter((entry) => entry.file === path).map((entry) => ({
@@ -14078,7 +14108,7 @@ var init_render = __esmMin((() => {
14078
14108
  this.chips = hintsFor(state.screen, {
14079
14109
  staged: state.staged,
14080
14110
  layers: state.layers.length,
14081
- onThread: state.stop > 0,
14111
+ onThread: state.stop > 0 || threadChosen(state) !== void 0,
14082
14112
  pull: pullHere(state).length > 0
14083
14113
  });
14084
14114
  this.header.content = this.headerText(state);
@@ -14687,6 +14717,7 @@ var init_app = __esmMin((() => {
14687
14717
  onChip: (key) => this.dispatchTask(this.onKey(asKey(key)))
14688
14718
  }));
14689
14719
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
14720
+ renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
14690
14721
  renderer.on("destroy", () => this.stopWatching());
14691
14722
  renderer.on("destroy", () => this.stopFading());
14692
14723
  renderer.on("destroy", () => this.stopPainting());
@@ -14736,6 +14767,7 @@ var init_app = __esmMin((() => {
14736
14767
  answer(intent) {
14737
14768
  return Intent.$match(intent, {
14738
14769
  Key: ({ key }) => this.onKey(key),
14770
+ Paste: ({ text }) => sync(() => this.onPaste(text)),
14739
14771
  Task: ({ run }) => run,
14740
14772
  Ping: ({ done }) => asVoid(succeed$2(done, void 0))
14741
14773
  });
@@ -14775,6 +14807,13 @@ var init_app = __esmMin((() => {
14775
14807
  dispatch(key) {
14776
14808
  offerUnsafe(this.intents, Intent.Key({ key }));
14777
14809
  }
14810
+ dispatchPaste(event) {
14811
+ offerUnsafe(this.intents, Intent.Paste({ text: decodePasteBytes(event.bytes) }));
14812
+ }
14813
+ onPaste(text) {
14814
+ if (!takesText(this.state.screen)) return;
14815
+ this.commit(pasted(this.state, text));
14816
+ }
14778
14817
  fail(cause) {
14779
14818
  this.failure = cause instanceof Error ? `${cause.message}\n${cause.stack ?? ""}` : String(cause);
14780
14819
  }
@@ -15099,7 +15138,7 @@ var init_app = __esmMin((() => {
15099
15138
  settleHere() {
15100
15139
  return gen({ self: this }, function* () {
15101
15140
  const branch = selectedBranch(this.state);
15102
- const id = (threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
15141
+ const id = (threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
15103
15142
  if (branch === void 0 || id === void 0) {
15104
15143
  this.commit(withNotice(this.state, "no thread here"));
15105
15144
  return;
@@ -15116,7 +15155,7 @@ var init_app = __esmMin((() => {
15116
15155
  removeHere() {
15117
15156
  return gen({ self: this }, function* () {
15118
15157
  const branch = selectedBranch(this.state);
15119
- const id = (threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
15158
+ const id = (threadChosen(this.state) ?? threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
15120
15159
  if (branch === void 0 || id === void 0) {
15121
15160
  this.commit(withNotice(this.state, "no thread here"));
15122
15161
  return;
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.51",
26
+ "version": "0.1.0-alpha.53",
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": {