@eliya-oss/agent-diff 0.1.0-alpha.74 → 0.1.0-alpha.75

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 +10 -0
  2. package/dist/main.js +142 -157
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.75
4
+
5
+ ### Patch Changes
6
+
7
+ - The suite runs in three parts at once, so a change reaches a release in about half the time it took.
8
+
9
+ - Cmd and option in the compose box now do what they do everywhere else: cmd moves to the ends of a line or the draft, option moves by word, and a key held with a modifier is never typed. Letting go of shift after growing a selection opens the comment on it.
10
+
11
+ - The box a comment is written in is opentui's textarea now, rather than one written here: the caret is the terminal's own, and undo, selection, and word and line movement come with it. Cmd and option keys the box does not carry by default are added to it.
12
+
3
13
  ## 0.1.0-alpha.74
4
14
 
5
15
  ### Patch Changes
package/dist/main.js CHANGED
@@ -5,9 +5,9 @@ import { text } from "node:stream/consumers";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { execFile, spawn } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
- import { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
8
+ import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
10
- import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer, decodePasteBytes, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
10
+ import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, decodePasteBytes, defaultTextareaKeyBindings, 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) => () => {
@@ -9661,7 +9661,7 @@ var init_pane = __esmMin((() => {
9661
9661
  init_commands();
9662
9662
  init_init();
9663
9663
  init_pane();
9664
- var version$1 = "0.1.0-alpha.74";
9664
+ var version$1 = "0.1.0-alpha.75";
9665
9665
  //#endregion
9666
9666
  //#region src/cli/upgrade.ts
9667
9667
  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;
@@ -11394,7 +11394,7 @@ var init_tree = __esmMin((() => {
11394
11394
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11395
11395
  };
11396
11396
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11397
- })), nothingReviewed, initialState, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, 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, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, caretAt, WORD, wordLeft, wordRight, caretByWord, lineStart, lineEnd, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, caretByRow, caretToEdge, composeTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelIndexOf, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11397
+ })), nothingReviewed, initialState, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, 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, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, caretAt, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, pickedText, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, sectionOf, sentEntry, panelEntries, panelIndexOf, panelEntry, threadChosen, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
11398
11398
  var init_model = __esmMin((() => {
11399
11399
  init_dist();
11400
11400
  init_patch();
@@ -11695,40 +11695,12 @@ var init_model = __esmMin((() => {
11695
11695
  return held.from + Math.min(column, Math.max(0, last));
11696
11696
  };
11697
11697
  caretAt = (state) => Math.max(0, Math.min(state.draft.length, state.caret));
11698
- WORD = /[\p{L}\p{N}_]/u;
11699
- wordLeft = (draft, from) => {
11700
- let at = from;
11701
- while (at > 0 && !WORD.test(draft[at - 1] ?? "")) at -= 1;
11702
- while (at > 0 && WORD.test(draft[at - 1] ?? "")) at -= 1;
11703
- return at;
11704
- };
11705
- wordRight = (draft, from) => {
11706
- let at = from;
11707
- while (at < draft.length && !WORD.test(draft[at] ?? "")) at += 1;
11708
- while (at < draft.length && WORD.test(draft[at] ?? "")) at += 1;
11709
- return at;
11710
- };
11711
- caretByWord = (state, delta) => delta < 0 ? wordLeft(state.draft, caretAt(state)) : wordRight(state.draft, caretAt(state));
11712
- lineStart = (draft, at) => draft.lastIndexOf("\n", at - 1) + 1;
11713
- lineEnd = (draft, at) => {
11714
- const found = draft.indexOf("\n", at);
11715
- return found === -1 ? draft.length : found;
11716
- };
11717
11698
  COMPOSE_BOX = 72;
11718
11699
  COMPOSE_MARGIN = 4;
11719
11700
  COMPOSE_PAD = 5;
11720
11701
  COMPOSE_LEAST = 8;
11721
11702
  composeBox = (columns) => Math.max(0, Math.min(COMPOSE_BOX, columns - COMPOSE_MARGIN));
11722
11703
  composeRoom$1 = (columns) => Math.max(COMPOSE_LEAST, composeBox(columns) - COMPOSE_PAD);
11723
- caretByRow = (state, delta) => {
11724
- const rows = laidDraft(state.draft, composeRoom$1(state.columns));
11725
- const at = caretAt(state);
11726
- const wanted = caretRow(rows, at) + delta;
11727
- if (wanted < 0) return 0;
11728
- if (wanted >= rows.length) return state.draft.length;
11729
- return caretOn(rows, wanted, caretColumn(rows, at));
11730
- };
11731
- caretToEdge = (state, edge) => edge === "start" ? lineStart(state.draft, caretAt(state)) : lineEnd(state.draft, caretAt(state));
11732
11704
  composeTarget = (state) => {
11733
11705
  const patch = selectedPatch(state);
11734
11706
  if (patch === void 0) return "";
@@ -12687,7 +12659,7 @@ var init_match = __esmMin((() => {
12687
12659
  }));
12688
12660
  //#endregion
12689
12661
  //#region src/tui/reduce.ts
12690
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, inserted, asksAQuery, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, cutBackTo, wordBackspaced, lineBackspaced, deleted, caretMoved, caretJumped, caretRowed, caretEnded, caretHomed, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12662
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, panBy, withSent, withArrived, withColumns, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, inserted, asksAQuery, typed, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, pasted, backspaced, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12691
12663
  var init_reduce = __esmMin((() => {
12692
12664
  init_dist();
12693
12665
  init_patch();
@@ -13358,45 +13330,10 @@ var init_reduce = __esmMin((() => {
13358
13330
  caret: at - 1
13359
13331
  };
13360
13332
  };
13361
- cutBackTo = (state, to) => {
13362
- const at = caretAt(state);
13363
- if (to >= at) return state;
13364
- return {
13365
- ...state,
13366
- draft: `${state.draft.slice(0, to)}${state.draft.slice(at)}`,
13367
- caret: to
13368
- };
13369
- };
13370
- wordBackspaced = (state) => asksAQuery(state) ? backspaced(state) : cutBackTo(state, caretByWord(state, -1));
13371
- lineBackspaced = (state) => asksAQuery(state) ? backspaced(state) : cutBackTo(state, caretToEdge(state, "start"));
13372
- deleted = (state) => {
13373
- const at = caretAt(state);
13374
- if (at >= state.draft.length) return state;
13375
- return {
13376
- ...state,
13377
- draft: `${state.draft.slice(0, at)}${state.draft.slice(at + 1)}`,
13378
- caret: at
13379
- };
13380
- };
13381
- caretMoved = (state, delta) => ({
13333
+ withDraft = (state, draft) => ({
13382
13334
  ...state,
13383
- caret: clamp(caretAt(state) + delta, 0, state.draft.length)
13384
- });
13385
- caretJumped = (state, delta) => ({
13386
- ...state,
13387
- caret: caretByWord(state, delta)
13388
- });
13389
- caretRowed = (state, delta) => ({
13390
- ...state,
13391
- caret: caretByRow(state, delta)
13392
- });
13393
- caretEnded = (state, edge) => ({
13394
- ...state,
13395
- caret: edge === "start" ? 0 : state.draft.length
13396
- });
13397
- caretHomed = (state, edge) => ({
13398
- ...state,
13399
- caret: caretToEdge(state, edge)
13335
+ draft,
13336
+ caret: draft.length
13400
13337
  });
13401
13338
  paletteMoved = (state, delta) => movePalette(state, delta);
13402
13339
  paletteClosed = (state) => ({
@@ -14221,7 +14158,7 @@ var init_diffview = __esmMin((() => {
14221
14158
  }));
14222
14159
  //#endregion
14223
14160
  //#region src/tui/render.ts
14224
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, 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_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, CARET_ROOM, draftText, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, 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, baseLabel, 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;
14161
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, 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_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, 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, baseLabel, 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;
14225
14162
  var init_render = __esmMin((() => {
14226
14163
  init_command();
14227
14164
  init_patch();
@@ -14278,28 +14215,6 @@ var init_render = __esmMin((() => {
14278
14215
  box: composeBox(width),
14279
14216
  text: composeRoom$1(width)
14280
14217
  });
14281
- CARET_ROOM = 1;
14282
- draftText = (state, room) => {
14283
- const rows = laidDraft(state.draft, room);
14284
- const at = caretAt(state);
14285
- const here = caretRow(rows, at);
14286
- const column = caretColumn(rows, at);
14287
- return {
14288
- rows: rows.flatMap((row, index) => {
14289
- const tail = index === rows.length - 1 ? "" : "\n";
14290
- if (index !== here) return [fg(palette.ink)(`${row.text}${tail}`)];
14291
- const before = row.text.slice(0, column);
14292
- const under = row.text.slice(column, column + CARET_ROOM);
14293
- const after = row.text.slice(column + CARET_ROOM);
14294
- return [
14295
- fg(palette.ink)(before),
14296
- bg(palette.ink)(fg(palette.panel)(under.length === 0 ? " " : under)),
14297
- fg(palette.ink)(`${after}${tail}`)
14298
- ];
14299
- }),
14300
- height: rows.length
14301
- };
14302
- };
14303
14218
  laidOut$1 = (lines, room) => lines.flatMap((line) => {
14304
14219
  const parts = wrapped(line, room);
14305
14220
  return parts.length === 0 ? [""] : parts;
@@ -14555,6 +14470,50 @@ var init_render = __esmMin((() => {
14555
14470
  marginBottom: 2,
14556
14471
  flexShrink: 0
14557
14472
  });
14473
+ MAC_KEYS = [
14474
+ {
14475
+ name: "left",
14476
+ super: true,
14477
+ action: "line-home"
14478
+ },
14479
+ {
14480
+ name: "right",
14481
+ super: true,
14482
+ action: "line-end"
14483
+ },
14484
+ {
14485
+ name: "left",
14486
+ super: true,
14487
+ shift: true,
14488
+ action: "select-line-home"
14489
+ },
14490
+ {
14491
+ name: "right",
14492
+ super: true,
14493
+ shift: true,
14494
+ action: "select-line-end"
14495
+ },
14496
+ {
14497
+ name: "up",
14498
+ super: true,
14499
+ action: "buffer-home"
14500
+ },
14501
+ {
14502
+ name: "down",
14503
+ super: true,
14504
+ action: "buffer-end"
14505
+ },
14506
+ {
14507
+ name: "backspace",
14508
+ super: true,
14509
+ action: "delete-to-line-start"
14510
+ },
14511
+ {
14512
+ name: "backspace",
14513
+ meta: true,
14514
+ action: "delete-word-backward"
14515
+ }
14516
+ ];
14558
14517
  makeComposeParts = (renderer) => ({
14559
14518
  title: new TextRenderable(renderer, {
14560
14519
  id: "compose-title",
@@ -14562,12 +14521,23 @@ var init_render = __esmMin((() => {
14562
14521
  fg: palette.ink,
14563
14522
  wrapMode: "none"
14564
14523
  }),
14565
- body: new TextRenderable(renderer, {
14566
- id: "compose-body",
14524
+ quoted: new TextRenderable(renderer, {
14525
+ id: "compose-quoted",
14567
14526
  content: "",
14568
- fg: palette.ink,
14527
+ fg: palette.muted,
14569
14528
  wrapMode: "none"
14570
14529
  }),
14530
+ body: new TextareaRenderable(renderer, {
14531
+ id: "compose-body",
14532
+ wrapMode: "word",
14533
+ keyBindings: [...defaultTextareaKeyBindings, ...MAC_KEYS],
14534
+ backgroundColor: palette.panel,
14535
+ focusedBackgroundColor: palette.panel,
14536
+ textColor: palette.ink,
14537
+ focusedTextColor: palette.ink,
14538
+ cursorColor: palette.ink,
14539
+ placeholder: ""
14540
+ }),
14571
14541
  actions: new TextRenderable(renderer, {
14572
14542
  id: "compose-actions",
14573
14543
  content: "",
@@ -14870,6 +14840,7 @@ var init_render = __esmMin((() => {
14870
14840
  shown;
14871
14841
  chips = [];
14872
14842
  composeTitle;
14843
+ composeQuoted;
14873
14844
  composeBody;
14874
14845
  composeActions;
14875
14846
  footer;
@@ -14916,6 +14887,7 @@ var init_render = __esmMin((() => {
14916
14887
  const inside = makeComposeParts(renderer);
14917
14888
  this.compose = makeCompose(renderer);
14918
14889
  this.composeTitle = inside.title;
14890
+ this.composeQuoted = inside.quoted;
14919
14891
  this.composeBody = inside.body;
14920
14892
  this.composeActions = inside.actions;
14921
14893
  this.scrim = makeScrim(renderer);
@@ -14999,6 +14971,9 @@ var init_render = __esmMin((() => {
14999
14971
  tallestRows() {
15000
14972
  return this.view.tallestRows();
15001
14973
  }
14974
+ writing() {
14975
+ return this.composeBody;
14976
+ }
15002
14977
  railRows() {
15003
14978
  return this.listRoom();
15004
14979
  }
@@ -15191,6 +15166,7 @@ var init_render = __esmMin((() => {
15191
15166
  this.body.add(this.panelPane);
15192
15167
  stack(this.compose, [
15193
15168
  this.composeTitle,
15169
+ this.composeQuoted,
15194
15170
  this.composeBody,
15195
15171
  this.composeActions
15196
15172
  ]);
@@ -15349,12 +15325,13 @@ var init_render = __esmMin((() => {
15349
15325
  if (state.screen !== "report") return;
15350
15326
  const room = composeRoom(this.renderer.width);
15351
15327
  const asked = state.reportFull ? "What went wrong? Everything on screen is attached for you." : "What went wrong? Only what you type is sent.";
15352
- const written = draftText(state, room.text);
15353
- const lead = laidOut$1([asked, ""], room.text);
15328
+ const lead = laidOut$1([asked], room.text);
15354
15329
  this.composeTitle.content = "Report a bug";
15355
- this.composeBody.content = new StyledText([...lead.map((line) => fg(palette.muted)(`${line}\n`)), ...written.rows]);
15330
+ this.composeQuoted.content = lead.join("\n");
15331
+ this.composeQuoted.height = lead.length;
15332
+ const written = this.fitBody(state, room.text);
15356
15333
  this.composeActions.content = reportActions(state.reportFull);
15357
- this.compose.height = lead.length + written.height + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15334
+ this.compose.height = lead.length + written + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15358
15335
  this.compose.width = room.box;
15359
15336
  this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
15360
15337
  this.compose.top = Math.max(2, Math.floor(this.renderer.height / 4));
@@ -15395,22 +15372,26 @@ var init_render = __esmMin((() => {
15395
15372
  });
15396
15373
  };
15397
15374
  }
15375
+ fitBody(state, room) {
15376
+ if (this.composeBody.width !== room) this.composeBody.width = room;
15377
+ const rows = Math.max(1, laidDraft(state.draft, room).length);
15378
+ if (this.composeBody.height !== rows) this.composeBody.height = rows;
15379
+ return rows;
15380
+ }
15398
15381
  paintCompose(state) {
15399
15382
  this.compose.visible = state.screen === "compose";
15400
- if (state.screen !== "compose") {
15401
- this.composeBody.content = "";
15402
- return;
15403
- }
15383
+ if (state.screen !== "compose") return;
15404
15384
  const room = composeRoom(this.renderer.width);
15405
15385
  const snippet = snippetOf(state, SNIPPET_LINES);
15406
15386
  const more = selectedLineCount(state) - snippet.length;
15407
15387
  const tail = more > 0 ? [` … ${more} more lines`] : [];
15408
15388
  const quoted = [...snippet, ...tail].map((line) => clip(line, room.text));
15409
- const written = draftText(state, room.text);
15410
15389
  this.composeTitle.content = clip(composeTarget(state), room.text);
15411
- this.composeBody.content = new StyledText([...[...quoted, ""].map((line) => fg(palette.muted)(`${line}\n`)), ...written.rows]);
15390
+ this.composeQuoted.content = [...quoted, ""].join("\n");
15391
+ this.composeQuoted.height = quoted.length + 1;
15392
+ const written = this.fitBody(state, room.text);
15412
15393
  this.composeActions.content = actionsText();
15413
- const height = quoted.length + 1 + written.height + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15394
+ const height = quoted.length + 1 + written + COMPOSE_ACTION_ROWS + COMPOSE_CHROME;
15414
15395
  this.compose.height = height;
15415
15396
  this.compose.width = room.box;
15416
15397
  this.compose.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room.box) / 2));
@@ -15443,6 +15424,13 @@ var init_display = __esmMin((() => {
15443
15424
  room: sync(() => screen.noteRoom()),
15444
15425
  tallest: sync(() => screen.tallestRows()),
15445
15426
  rail: sync(() => screen.railRows()),
15427
+ onWritten: (told) => sync(() => {
15428
+ screen.writing().onContentChange = () => told(screen.writing().plainText);
15429
+ }),
15430
+ written: sync(() => screen.writing().plainText),
15431
+ write: (text) => sync(() => screen.writing().setText(text)),
15432
+ writeIn: (text) => sync(() => screen.writing().insertText(text)),
15433
+ writeOn: (on) => sync(() => on ? screen.writing().focus() : screen.writing().blur()),
15446
15434
  at: sync(() => screen.scrolledAt()),
15447
15435
  rowAt: (visual) => sync(() => screen.rowAtScreen(visual)),
15448
15436
  screenRowOf: (row) => sync(() => screen.screenRowOf(row)),
@@ -15528,7 +15516,7 @@ var init_upgrade = __esmMin((() => {
15528
15516
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
15529
15517
  }).pipe(withSpan("Tui.upgradeHint"));
15530
15518
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
15531
- })), PRINTABLE, KEY_HISTORY, TRAIL_HISTORY, clockOf, momentOf, noticeOf, handOver, copyToClipboard, lineUnder, asKey, openedPull, byWord, WORD_STEP, caretSideways, caretFor, erasedBy, LISTENS, listens, laidOut, ARROWS, keyName, App, turnedOver, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
15519
+ })), PRINTABLE, KEY_HISTORY, TRAIL_HISTORY, clockOf, momentOf, noticeOf, handOver, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, writesInto, listens, laidOut, ARROWS, keyName, App, turnedOver, settledPath, openingOn, launch, told, untilDestroyed, runOn, runTui;
15532
15520
  var init_app = __esmMin((() => {
15533
15521
  init_dist();
15534
15522
  init_report();
@@ -15593,31 +15581,9 @@ var init_app = __esmMin((() => {
15593
15581
  if (!opened) return "could not reach the pull request";
15594
15582
  return state.length === 0 ? "opened the pull request" : `opened the ${state} pull request`;
15595
15583
  };
15596
- byWord = (key) => key.option || key.ctrl;
15597
- WORD_STEP = {
15598
- b: -1,
15599
- f: 1
15600
- };
15601
- caretSideways = (state, key) => {
15602
- const step = key.name === "left" ? -1 : key.name === "right" ? 1 : 0;
15603
- if (step === 0) return void 0;
15604
- if (key.meta) return caretHomed(state, step > 0 ? "end" : "start");
15605
- return key.option || key.ctrl ? caretJumped(state, step) : caretMoved(state, step);
15606
- };
15607
- caretFor = (state, key) => {
15608
- const sideways = caretSideways(state, key);
15609
- if (sideways !== void 0) return sideways;
15610
- const word = byWord(key) ? WORD_STEP[key.name] : void 0;
15611
- if (word !== void 0) return caretJumped(state, word);
15612
- if (key.name === "home") return caretHomed(state, "start");
15613
- if (key.name === "end") return caretHomed(state, "end");
15614
- return key.name === "delete" ? deleted(state) : void 0;
15615
- };
15616
- erasedBy = (state, key) => {
15617
- if (key.meta || key.ctrl) return lineBackspaced(state);
15618
- return key.option ? wordBackspaced(state) : backspaced(state);
15619
- };
15620
15584
  LISTENS = /* @__PURE__ */ new Set(["keys", "palette"]);
15585
+ WRITES = /* @__PURE__ */ new Set(["compose", "report"]);
15586
+ writesInto = (screen) => WRITES.has(screen);
15621
15587
  listens = (screen) => LISTENS.has(screen);
15622
15588
  laidOut = (key) => key.baseCode === void 0 || key.name.length !== 1 ? key.name : String.fromCodePoint(key.baseCode);
15623
15589
  ARROWS = /* @__PURE__ */ new Set([
@@ -15647,6 +15613,7 @@ var init_app = __esmMin((() => {
15647
15613
  remembered = "";
15648
15614
  wrapKept = false;
15649
15615
  stickyKept = true;
15616
+ grewWithShift = false;
15650
15617
  keys = [];
15651
15618
  trail = [];
15652
15619
  began = Date.now();
@@ -15675,7 +15642,9 @@ var init_app = __esmMin((() => {
15675
15642
  onRail: (delta) => this.dispatchTask(this.rolled(delta))
15676
15643
  }));
15677
15644
  renderer.on("selection", () => this.copyDragged());
15645
+ runSync(options.display.onWritten((text) => this.readBack(text)));
15678
15646
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
15647
+ renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
15679
15648
  renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
15680
15649
  renderer.on("destroy", () => this.stopWatching());
15681
15650
  renderer.on("destroy", () => this.stopFading());
@@ -15770,13 +15739,23 @@ var init_app = __esmMin((() => {
15770
15739
  runFork(writeSession(this.sessionPath, session));
15771
15740
  }
15772
15741
  dispatch(key) {
15742
+ if (key.eventType === "release") {
15743
+ this.letGo(key);
15744
+ return;
15745
+ }
15773
15746
  if (this.renderer.hasSelection) this.renderer.clearSelection();
15774
15747
  offerUnsafe(this.intents, Intent.Key({ key }));
15775
15748
  }
15749
+ letGo(key) {
15750
+ if (!key.name.endsWith("shift") || !this.grewWithShift) return;
15751
+ this.grewWithShift = false;
15752
+ offerUnsafe(this.intents, Intent.Key({ key: asKey("c") }));
15753
+ }
15776
15754
  dispatchPaste(event) {
15777
15755
  offerUnsafe(this.intents, Intent.Paste({ text: decodePasteBytes(event.bytes) }));
15778
15756
  }
15779
15757
  onPaste(text) {
15758
+ if (writesInto(this.state.screen)) return;
15780
15759
  if (!takesText(this.state.screen)) return;
15781
15760
  this.commit(pasted(this.state, text));
15782
15761
  }
@@ -15879,6 +15858,7 @@ var init_app = __esmMin((() => {
15879
15858
  }
15880
15859
  commit(given) {
15881
15860
  const next = given.patchIndex === this.state.patchIndex ? given : turnedOver(given);
15861
+ this.turnWriting(next);
15882
15862
  const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
15883
15863
  if (appeared) this.recordNotice(next.notice);
15884
15864
  this.rememberPlace(next);
@@ -15983,6 +15963,7 @@ var init_app = __esmMin((() => {
15983
15963
  onKey(key, forced) {
15984
15964
  return gen({ self: this }, function* () {
15985
15965
  const action = forced ?? actionFor(this.state.screen, keyName(key), this.state.focus);
15966
+ this.grewWithShift = action === "select.grow" || action === "select.shrink";
15986
15967
  this.remember(action, key);
15987
15968
  if (action === void 0) {
15988
15969
  this.onText(key);
@@ -15996,31 +15977,37 @@ var init_app = __esmMin((() => {
15996
15977
  yield* effect();
15997
15978
  });
15998
15979
  }
15980
+ typedIn(key) {
15981
+ if (key.ctrl || key.option || key.meta || key.super === true) return false;
15982
+ return PRINTABLE.test(key.sequence);
15983
+ }
15999
15984
  onText(key) {
16000
- if (!takesText(this.state.screen)) return;
15985
+ if (!listens(this.state.screen)) return;
16001
15986
  if (key.name === "backspace") {
16002
- this.commit(erasedBy(this.state, key));
15987
+ this.commit(backspaced(this.state));
16003
15988
  return;
16004
15989
  }
16005
15990
  if (key.name === "down" || key.name === "up") {
16006
- this.commit(this.steppedText(key));
15991
+ this.commit(paletteMoved(this.state, key.name === "down" ? 1 : -1));
16007
15992
  return;
16008
15993
  }
16009
- if (this.onCaret(key)) return;
16010
- if (PRINTABLE.test(key.sequence)) this.commit(typed(this.state, key.sequence));
16011
- }
16012
- steppedText(key) {
16013
- const delta = key.name === "down" ? 1 : -1;
16014
- if (listens(this.state.screen)) return paletteMoved(this.state, delta);
16015
- if (key.meta) return caretEnded(this.state, delta > 0 ? "end" : "start");
16016
- return caretRowed(this.measured(), delta);
16017
- }
16018
- onCaret(key) {
16019
- if (this.state.screen === "palette" || this.state.screen === "keys") return false;
16020
- const moved = caretFor(this.state, key);
16021
- if (moved === void 0) return false;
16022
- this.commit(moved);
16023
- return true;
15994
+ if (this.typedIn(key)) this.commit(typed(this.state, key.sequence));
15995
+ }
15996
+ turnWriting(next) {
15997
+ const was = writesInto(this.state.screen);
15998
+ const now = writesInto(next.screen);
15999
+ if (was === now) return;
16000
+ if (now) runSync(this.display.write(next.draft));
16001
+ runSync(this.display.writeOn(now));
16002
+ }
16003
+ readBack(text) {
16004
+ const clean = legible(stripAnsiSequences(text));
16005
+ if (clean !== text) {
16006
+ runSync(this.display.write(clean));
16007
+ return;
16008
+ }
16009
+ if (text === this.state.draft) return;
16010
+ this.commit(withDraft(this.state, text));
16024
16011
  }
16025
16012
  runChoice() {
16026
16013
  return gen({ self: this }, function* () {
@@ -16064,11 +16051,6 @@ var init_app = __esmMin((() => {
16064
16051
  }
16065
16052
  copyDragged() {
16066
16053
  const taken = this.renderer.getSelection()?.getSelectedText() ?? "";
16067
- const where = process.env["ADIFF_TRACE"];
16068
- if (where !== void 0) {
16069
- const holder = this.renderer.getSelectionContainer()?.id ?? "none";
16070
- appendFileSync(where, `${this.state.screen} in=${holder} ${JSON.stringify(taken).slice(0, 70)}\n`);
16071
- }
16072
16054
  if (taken.trim().length === 0) return;
16073
16055
  copyToClipboard(taken);
16074
16056
  const lines = taken.split("\n").length;
@@ -16559,7 +16541,10 @@ var init_app = __esmMin((() => {
16559
16541
  yield* untilDestroyed(renderer);
16560
16542
  });
16561
16543
  runTui = fn("Tui.run")(function* (repo, sessionPath, branch) {
16562
- const renderer = yield* promise(() => createCliRenderer({ exitOnCtrlC: true }));
16544
+ const renderer = yield* promise(() => createCliRenderer({
16545
+ exitOnCtrlC: true,
16546
+ useKittyKeyboard: { events: true }
16547
+ }));
16563
16548
  yield* runOn(repo, renderer, sessionPath, branch);
16564
16549
  });
16565
16550
  }));
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.74",
26
+ "version": "0.1.0-alpha.75",
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": {