@eliya-oss/agent-diff 0.1.0-alpha.50 → 0.1.0-alpha.52

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.52
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+
9
+ ## 0.1.0-alpha.51
10
+
11
+ ### Patch Changes
12
+
13
+ - The file list stops ending without saying so. It reserved a row for `… N more` whether or not one was needed, and that row paid for the pane's padding instead, so the count was clipped and the list just stopped. `h` now closes the folder the cursor's file is in and then walks outward one folder per press, with `l` opening them again from the outside in, so a deep tree can be folded down to something that fits.
14
+
3
15
  ## 0.1.0-alpha.50
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) => () => {
@@ -9230,7 +9230,7 @@ var init_pane = __esmMin((() => {
9230
9230
  init_commands();
9231
9231
  init_init();
9232
9232
  init_pane();
9233
- var version$1 = "0.1.0-alpha.50";
9233
+ var version$1 = "0.1.0-alpha.52";
9234
9234
  //#endregion
9235
9235
  //#region src/cli/upgrade.ts
9236
9236
  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;
@@ -10951,7 +10951,7 @@ var init_tree = __esmMin((() => {
10951
10951
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
10952
10952
  };
10953
10953
  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, directoryOfFile, 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;
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;
10955
10955
  var init_model = __esmMin((() => {
10956
10956
  init_dist();
10957
10957
  init_patch();
@@ -11144,11 +11144,12 @@ var init_model = __esmMin((() => {
11144
11144
  return flattenTree(tree, state.closed);
11145
11145
  };
11146
11146
  crowdedOf = (patches) => crowdedDirectories(buildTree(patches.map((patch) => patch.path)), 8);
11147
- directoryOfFile = (state, fileIndex) => {
11147
+ foldersOfFile = (state, fileIndex) => {
11148
11148
  const patch = state.patches[fileIndex];
11149
- if (patch === void 0) return void 0;
11150
- const segments = patch.path.split("/");
11151
- return segments.length < 2 ? void 0 : segments.slice(0, -1).join("/");
11149
+ if (patch === void 0) return [];
11150
+ const drawn = new Set(flattenTree(treeOf(state), []).filter((row) => row.kind !== "file").map((row) => row.path));
11151
+ const segments = patch.path.split("/").slice(0, -1);
11152
+ return segments.map((_, at) => segments.slice(0, segments.length - at).join("/")).filter((path) => drawn.has(path));
11152
11153
  };
11153
11154
  isReviewed = (state, fileIndex) => {
11154
11155
  const patch = state.patches[fileIndex];
@@ -12091,7 +12092,7 @@ var init_match = __esmMin((() => {
12091
12092
  }));
12092
12093
  //#endregion
12093
12094
  //#region src/tui/reduce.ts
12094
- 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;
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, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, deleted, caretMoved, caretJumped, caretHomed, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12095
12096
  var init_reduce = __esmMin((() => {
12096
12097
  init_dist();
12097
12098
  init_patch();
@@ -12270,12 +12271,14 @@ var init_reduce = __esmMin((() => {
12270
12271
  };
12271
12272
  };
12272
12273
  foldDirectory = (state, shut) => {
12273
- const directory = directoryOfFile(state, state.patchIndex);
12274
- if (directory === void 0) return state;
12275
- const closed = state.closed.filter((path) => path !== directory);
12274
+ const chain = foldersOfFile(state, state.patchIndex);
12275
+ if (chain.length === 0) return state;
12276
+ const target = shut ? chain.find((path) => !state.closed.includes(path)) : chain.findLast((path) => state.closed.includes(path));
12277
+ if (target === void 0) return state;
12278
+ const closed = state.closed.filter((path) => path !== target);
12276
12279
  return {
12277
12280
  ...state,
12278
- closed: shut ? [...closed, directory] : closed
12281
+ closed: shut ? [...closed, target] : closed
12279
12282
  };
12280
12283
  };
12281
12284
  foldLayer = (state, shut) => {
@@ -12645,6 +12648,21 @@ var init_reduce = __esmMin((() => {
12645
12648
  query: `${state.query}${character}`,
12646
12649
  paletteIndex: 0
12647
12650
  } : inserted(state, character);
12651
+ TAB_WIDTH = 2;
12652
+ SPACE_CODE = 32;
12653
+ ERASED_FROM = 127;
12654
+ ERASED_TO = 159;
12655
+ readable = (character) => {
12656
+ if (character === "\n") return true;
12657
+ const code = character.codePointAt(0) ?? 0;
12658
+ return code >= SPACE_CODE && (code < ERASED_FROM || code > ERASED_TO);
12659
+ };
12660
+ legible = (text) => Array.from(text.replace(/\r\n?/g, "\n").replace(/\t/g, " ".repeat(TAB_WIDTH))).filter(readable).join("");
12661
+ pasted = (state, text) => {
12662
+ const clean = legible(stripAnsiSequences(text));
12663
+ if (clean.length === 0) return state;
12664
+ return typed(state, state.screen === "palette" ? clean.replace(/\n/g, " ") : clean);
12665
+ };
12648
12666
  backspaced = (state) => {
12649
12667
  if (state.screen === "palette") return {
12650
12668
  ...state,
@@ -13334,7 +13352,7 @@ var init_diffview = __esmMin((() => {
13334
13352
  }));
13335
13353
  //#endregion
13336
13354
  //#region src/tui/render.ts
13337
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
13355
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
13338
13356
  var init_render = __esmMin((() => {
13339
13357
  init_command();
13340
13358
  init_patch();
@@ -13370,6 +13388,7 @@ var init_render = __esmMin((() => {
13370
13388
  PANEL_QUARTER = 4;
13371
13389
  PANEL_FIFTH = 5;
13372
13390
  PANE_CHROME = 3;
13391
+ PANE_INSET = 1;
13373
13392
  BRANCH_WIDTH = 82;
13374
13393
  BRANCH_NAME_MIN = 12;
13375
13394
  BRANCH_TAIL = 45;
@@ -14183,17 +14202,24 @@ var init_render = __esmMin((() => {
14183
14202
  listText(state) {
14184
14203
  if (atHome(state)) return this.branchTable(state);
14185
14204
  if (onLayers(state)) return this.layerRail(state);
14186
- const height = Math.max(1, this.listPane.height - 1);
14205
+ const room = this.listRoom();
14187
14206
  const pane = this.paneRoom();
14188
- const window = treeWindow(state, height);
14207
+ const whole = treeWindow(state, room);
14208
+ const window = whole.more === 0 ? whole : treeWindow(state, Math.max(1, room - 1));
14189
14209
  const rows = window.rows.flatMap((row) => [fg(row.kind === "file" ? palette.ink : palette.muted)(`${treeLine(state, row, pane)}\n`)]);
14190
14210
  const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
14191
14211
  return new StyledText([...rows, ...more]);
14192
14212
  }
14213
+ listRoom() {
14214
+ return Math.max(1, this.listPane.height - PANE_INSET);
14215
+ }
14193
14216
  layerRail(state) {
14194
- const height = Math.max(1, this.listPane.height - 1);
14217
+ const banner = state.layersStale ? 1 : 0;
14218
+ const height = Math.max(1, this.listRoom() - banner);
14195
14219
  const room = layerRoom(state, this.paneRoom());
14196
- const window = railWindow(layerRows(state, room.title, room.note), height, state.layerIndex);
14220
+ const all = layerRows(state, room.title, room.note);
14221
+ const whole = railWindow(all, height, state.layerIndex);
14222
+ const window = whole.more === 0 ? whole : railWindow(all, Math.max(1, height - 1), state.layerIndex);
14197
14223
  const rows = window.rows.map((row) => fg(layerPaint(state, row))(`${layerText(state, row, room)}\n`));
14198
14224
  const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
14199
14225
  const warn = state.layersStale ? [fg(palette.attention)(`${staleBanner(room.note)}\n`)] : [];
@@ -14676,6 +14702,7 @@ var init_app = __esmMin((() => {
14676
14702
  onChip: (key) => this.dispatchTask(this.onKey(asKey(key)))
14677
14703
  }));
14678
14704
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
14705
+ renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
14679
14706
  renderer.on("destroy", () => this.stopWatching());
14680
14707
  renderer.on("destroy", () => this.stopFading());
14681
14708
  renderer.on("destroy", () => this.stopPainting());
@@ -14725,6 +14752,7 @@ var init_app = __esmMin((() => {
14725
14752
  answer(intent) {
14726
14753
  return Intent.$match(intent, {
14727
14754
  Key: ({ key }) => this.onKey(key),
14755
+ Paste: ({ text }) => sync(() => this.onPaste(text)),
14728
14756
  Task: ({ run }) => run,
14729
14757
  Ping: ({ done }) => asVoid(succeed$2(done, void 0))
14730
14758
  });
@@ -14764,6 +14792,13 @@ var init_app = __esmMin((() => {
14764
14792
  dispatch(key) {
14765
14793
  offerUnsafe(this.intents, Intent.Key({ key }));
14766
14794
  }
14795
+ dispatchPaste(event) {
14796
+ offerUnsafe(this.intents, Intent.Paste({ text: decodePasteBytes(event.bytes) }));
14797
+ }
14798
+ onPaste(text) {
14799
+ if (!takesText(this.state.screen)) return;
14800
+ this.commit(pasted(this.state, text));
14801
+ }
14767
14802
  fail(cause) {
14768
14803
  this.failure = cause instanceof Error ? `${cause.message}\n${cause.stack ?? ""}` : String(cause);
14769
14804
  }
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.50",
26
+ "version": "0.1.0-alpha.52",
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": {