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

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,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.76
4
+
5
+ ### Patch Changes
6
+
7
+ - The filter above the palette and the sheet of keys is a real text box now, like the one a comment is written in: a caret you can move, word jumps, and selection. `return` in a comment belongs to the box, so `shift+return` breaks a line rather than doing nothing.
8
+
3
9
  ## 0.1.0-alpha.75
4
10
 
5
11
  ### 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, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, decodePasteBytes, defaultTextareaKeyBindings, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
10
+ import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, TextareaRenderable, bg, createCliRenderer, 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.75";
9664
+ var version$1 = "0.1.0-alpha.76";
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, 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;
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, 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();
@@ -11694,7 +11694,6 @@ var init_model = __esmMin((() => {
11694
11694
  const last = held.text.endsWith(" ") ? held.text.length - 1 : held.text.length;
11695
11695
  return held.from + Math.min(column, Math.max(0, last));
11696
11696
  };
11697
- caretAt = (state) => Math.max(0, Math.min(state.draft.length, state.caret));
11698
11697
  COMPOSE_BOX = 72;
11699
11698
  COMPOSE_MARGIN = 4;
11700
11699
  COMPOSE_PAD = 5;
@@ -12520,14 +12519,6 @@ var init_command = __esmMin((() => {
12520
12519
  hint: "send",
12521
12520
  listed: false
12522
12521
  }),
12523
- command({
12524
- action: "compose.newline",
12525
- category: "Comments",
12526
- title: "New line",
12527
- keys: ["return"],
12528
- screens: ["compose"],
12529
- listed: false
12530
- }),
12531
12522
  command({
12532
12523
  action: "palette.run",
12533
12524
  category: "App",
@@ -12659,7 +12650,7 @@ var init_match = __esmMin((() => {
12659
12650
  }));
12660
12651
  //#endregion
12661
12652
  //#region src/tui/reduce.ts
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;
12653
+ 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, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
12663
12654
  var init_reduce = __esmMin((() => {
12664
12655
  init_dist();
12665
12656
  init_patch();
@@ -13058,7 +13049,6 @@ var init_reduce = __esmMin((() => {
13058
13049
  "select.swap": swapEnds,
13059
13050
  "compose.open": openCompose,
13060
13051
  "compose.submit": (state) => state,
13061
- "compose.newline": (state) => inserted(state, "\n"),
13062
13052
  "focus.toggle": (state) => ({
13063
13053
  ...state,
13064
13054
  focus: focusStepped(state, 1),
@@ -13287,20 +13277,6 @@ var init_reduce = __esmMin((() => {
13287
13277
  anchorRow: 0,
13288
13278
  selecting: false
13289
13279
  });
13290
- inserted = (state, text) => {
13291
- const at = caretAt(state);
13292
- return {
13293
- ...state,
13294
- draft: `${state.draft.slice(0, at)}${text}${state.draft.slice(at)}`,
13295
- caret: at + text.length
13296
- };
13297
- };
13298
- asksAQuery = (state) => state.screen === "palette" || state.screen === "keys";
13299
- typed = (state, character) => asksAQuery(state) ? {
13300
- ...state,
13301
- query: `${state.query}${character}`,
13302
- paletteIndex: 0
13303
- } : inserted(state, character);
13304
13280
  TAB_WIDTH = 2;
13305
13281
  SPACE_CODE = 32;
13306
13282
  ERASED_FROM = 127;
@@ -13311,25 +13287,6 @@ var init_reduce = __esmMin((() => {
13311
13287
  return code >= SPACE_CODE && (code < ERASED_FROM || code > ERASED_TO);
13312
13288
  };
13313
13289
  legible = (text) => Array.from(text.replace(/\r\n?/g, "\n").replace(/\t/g, " ".repeat(TAB_WIDTH))).filter(readable).join("");
13314
- pasted = (state, text) => {
13315
- const clean = legible(stripAnsiSequences(text));
13316
- if (clean.length === 0) return state;
13317
- return typed(state, asksAQuery(state) ? clean.replace(/\n/g, " ") : clean);
13318
- };
13319
- backspaced = (state) => {
13320
- if (asksAQuery(state)) return {
13321
- ...state,
13322
- query: state.query.slice(0, -1),
13323
- paletteIndex: 0
13324
- };
13325
- const at = caretAt(state);
13326
- if (at === 0) return state;
13327
- return {
13328
- ...state,
13329
- draft: `${state.draft.slice(0, at - 1)}${state.draft.slice(at)}`,
13330
- caret: at - 1
13331
- };
13332
- };
13333
13290
  withDraft = (state, draft) => ({
13334
13291
  ...state,
13335
13292
  draft,
@@ -14158,7 +14115,7 @@ var init_diffview = __esmMin((() => {
14158
14115
  }));
14159
14116
  //#endregion
14160
14117
  //#region src/tui/render.ts
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;
14118
+ 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, asking, 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;
14162
14119
  var init_render = __esmMin((() => {
14163
14120
  init_command();
14164
14121
  init_patch();
@@ -14353,10 +14310,25 @@ var init_render = __esmMin((() => {
14353
14310
  box.width = PALETTE_WIDTH;
14354
14311
  return box;
14355
14312
  };
14313
+ asking = (renderer, id) => new TextareaRenderable(renderer, {
14314
+ id,
14315
+ height: ROW_HEIGHT,
14316
+ wrapMode: "none",
14317
+ flexShrink: 0,
14318
+ marginLeft: GUTTER_X,
14319
+ marginRight: GUTTER_X,
14320
+ placeholder: "Type to filter…",
14321
+ placeholderColor: palette.faint,
14322
+ backgroundColor: palette.panel,
14323
+ focusedBackgroundColor: palette.panel,
14324
+ textColor: palette.ink,
14325
+ focusedTextColor: palette.ink,
14326
+ cursorColor: palette.ink
14327
+ });
14356
14328
  makePaletteParts = (renderer) => {
14357
14329
  const box = makePalette(renderer);
14358
14330
  const title = bar(renderer, "palette-title", palette.faint);
14359
- const query = bar(renderer, "palette-query", palette.ink);
14331
+ const query = asking(renderer, "palette-query");
14360
14332
  const choices = makeChoices(renderer);
14361
14333
  box.add(title);
14362
14334
  box.add(query);
@@ -14426,16 +14398,16 @@ var init_render = __esmMin((() => {
14426
14398
  makeFoundParts = (renderer) => {
14427
14399
  const box = makePalette(renderer);
14428
14400
  const title = bar(renderer, "found-title", palette.faint);
14429
- const query = bar(renderer, "found-peek", palette.muted);
14401
+ const peek = bar(renderer, "found-peek", palette.muted);
14430
14402
  const choices = makeChoices(renderer);
14431
14403
  box.id = "found";
14432
14404
  box.add(title);
14433
14405
  box.add(choices);
14434
- box.add(query);
14406
+ box.add(peek);
14435
14407
  return {
14436
14408
  box,
14437
14409
  title,
14438
- query,
14410
+ peek,
14439
14411
  choices
14440
14412
  };
14441
14413
  };
@@ -14512,6 +14484,16 @@ var init_render = __esmMin((() => {
14512
14484
  name: "backspace",
14513
14485
  meta: true,
14514
14486
  action: "delete-word-backward"
14487
+ },
14488
+ {
14489
+ name: "return",
14490
+ shift: true,
14491
+ action: "newline"
14492
+ },
14493
+ {
14494
+ name: "return",
14495
+ meta: true,
14496
+ action: "newline"
14515
14497
  }
14516
14498
  ];
14517
14499
  makeComposeParts = (renderer) => ({
@@ -14903,7 +14885,7 @@ var init_render = __esmMin((() => {
14903
14885
  this.keysChoices = modals.keys.choices;
14904
14886
  this.found = modals.found.box;
14905
14887
  this.foundTitle = modals.found.title;
14906
- this.foundPeek = modals.found.query;
14888
+ this.foundPeek = modals.found.peek;
14907
14889
  this.foundChoices = modals.found.choices;
14908
14890
  this.assemble(renderer);
14909
14891
  }
@@ -14974,6 +14956,10 @@ var init_render = __esmMin((() => {
14974
14956
  writing() {
14975
14957
  return this.composeBody;
14976
14958
  }
14959
+ asking(screen) {
14960
+ if (screen === "palette") return this.paletteQuery;
14961
+ return screen === "keys" ? this.keysQuery : void 0;
14962
+ }
14977
14963
  railRows() {
14978
14964
  return this.listRoom();
14979
14965
  }
@@ -15027,14 +15013,12 @@ var init_render = __esmMin((() => {
15027
15013
  paintPalette(state) {
15028
15014
  this.palette.visible = state.screen === "palette";
15029
15015
  if (state.screen !== "palette") {
15030
- this.paletteQuery.content = "";
15031
15016
  this.paletteTitle.content = "";
15032
15017
  this.paletteChoices.content = "";
15033
15018
  return;
15034
15019
  }
15035
15020
  const matches = paletteMatches(state);
15036
15021
  this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
15037
- this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
15038
15022
  const room = panelWidth(this.renderer.width);
15039
15023
  const paletteRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
15040
15024
  this.paletteChoices.content = listText(matches.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, matches.length - 1)), paletteRoom - PALETTE_CHROME);
@@ -15047,14 +15031,12 @@ var init_render = __esmMin((() => {
15047
15031
  this.keys.visible = state.screen === "keys";
15048
15032
  if (state.screen !== "keys") {
15049
15033
  this.keysTitle.content = "";
15050
- this.keysQuery.content = "";
15051
15034
  this.keysChoices.content = "";
15052
15035
  return;
15053
15036
  }
15054
15037
  const rows = keyMatches(state);
15055
15038
  const room = panelWidth(this.renderer.width);
15056
15039
  this.keysTitle.content = rows.length === 0 ? "No key matches" : `Keys here, ${rows.length} of them`;
15057
- this.keysQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
15058
15040
  const keysRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
15059
15041
  this.keysChoices.content = listText(rows.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), keysRoom - PENDING_CHROME);
15060
15042
  this.keys.height = keysRoom;
@@ -15401,10 +15383,11 @@ var init_render = __esmMin((() => {
15401
15383
  }));
15402
15384
  //#endregion
15403
15385
  //#region src/tui/display.ts
15404
- var Display, paintWith, listenWith, lightWith, shapeOf, displayOn;
15386
+ var ASKING, Display, paintWith, listenWith, lightWith, shapeOf, displayOn;
15405
15387
  var init_display = __esmMin((() => {
15406
15388
  init_dist();
15407
15389
  init_render();
15390
+ ASKING = ["palette", "keys"];
15408
15391
  Display = class extends Service()("adiff/Display") {};
15409
15392
  paintWith = (screen) => fn("Tui.paint")(function* (state) {
15410
15393
  yield* sync(() => screen.update(state));
@@ -15431,6 +15414,25 @@ var init_display = __esmMin((() => {
15431
15414
  write: (text) => sync(() => screen.writing().setText(text)),
15432
15415
  writeIn: (text) => sync(() => screen.writing().insertText(text)),
15433
15416
  writeOn: (on) => sync(() => on ? screen.writing().focus() : screen.writing().blur()),
15417
+ askOn: (which) => sync(() => {
15418
+ for (const name of ASKING) {
15419
+ const box = screen.asking(name);
15420
+ if (box === void 0) continue;
15421
+ if (name === which) {
15422
+ box.setText("");
15423
+ box.focus();
15424
+ } else box.blur();
15425
+ }
15426
+ }),
15427
+ askWith: (text) => sync(() => {
15428
+ for (const name of ASKING) screen.asking(name)?.setText(text);
15429
+ }),
15430
+ onAsked: (told) => sync(() => {
15431
+ for (const name of ASKING) {
15432
+ const box = screen.asking(name);
15433
+ if (box !== void 0) box.onContentChange = () => told(box.plainText);
15434
+ }
15435
+ }),
15434
15436
  at: sync(() => screen.scrolledAt()),
15435
15437
  rowAt: (visual) => sync(() => screen.rowAtScreen(visual)),
15436
15438
  screenRowOf: (row) => sync(() => screen.screenRowOf(row)),
@@ -15516,7 +15518,7 @@ var init_upgrade = __esmMin((() => {
15516
15518
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
15517
15519
  }).pipe(withSpan("Tui.upgradeHint"));
15518
15520
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
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;
15521
+ })), KEY_HISTORY, DRAIN_PASSES, 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;
15520
15522
  var init_app = __esmMin((() => {
15521
15523
  init_dist();
15522
15524
  init_report();
@@ -15533,8 +15535,8 @@ var init_app = __esmMin((() => {
15533
15535
  init_intent();
15534
15536
  init_session();
15535
15537
  init_upgrade();
15536
- PRINTABLE = /^[\S ]$/;
15537
15538
  KEY_HISTORY = 40;
15539
+ DRAIN_PASSES = 8;
15538
15540
  TRAIL_HISTORY = 20;
15539
15541
  clockOf = (elapsed) => {
15540
15542
  const seconds = Math.floor(elapsed / 1e3);
@@ -15643,9 +15645,9 @@ var init_app = __esmMin((() => {
15643
15645
  }));
15644
15646
  renderer.on("selection", () => this.copyDragged());
15645
15647
  runSync(options.display.onWritten((text) => this.readBack(text)));
15648
+ runSync(options.display.onAsked((text) => this.askedBack(text)));
15646
15649
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
15647
15650
  renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
15648
- renderer.keyInput.on("paste", (event) => this.dispatchPaste(event));
15649
15651
  renderer.on("destroy", () => this.stopWatching());
15650
15652
  renderer.on("destroy", () => this.stopFading());
15651
15653
  renderer.on("destroy", () => this.stopLighting());
@@ -15696,7 +15698,6 @@ var init_app = __esmMin((() => {
15696
15698
  answer(intent) {
15697
15699
  return Intent.$match(intent, {
15698
15700
  Key: ({ key }) => this.onKey(key),
15699
- Paste: ({ text }) => sync(() => this.onPaste(text)),
15700
15701
  Task: ({ run }) => run,
15701
15702
  Ping: ({ done }) => asVoid(succeed$3(done, void 0))
15702
15703
  });
@@ -15751,25 +15752,28 @@ var init_app = __esmMin((() => {
15751
15752
  this.grewWithShift = false;
15752
15753
  offerUnsafe(this.intents, Intent.Key({ key: asKey("c") }));
15753
15754
  }
15754
- dispatchPaste(event) {
15755
- offerUnsafe(this.intents, Intent.Paste({ text: decodePasteBytes(event.bytes) }));
15756
- }
15757
- onPaste(text) {
15758
- if (writesInto(this.state.screen)) return;
15759
- if (!takesText(this.state.screen)) return;
15760
- this.commit(pasted(this.state, text));
15761
- }
15762
15755
  fail(cause) {
15763
15756
  this.failure = cause instanceof Error ? `${cause.message}\n${cause.stack ?? ""}` : String(cause);
15764
15757
  }
15765
15758
  lastFailure() {
15766
15759
  return this.failure;
15767
15760
  }
15768
- settled() {
15769
- if (this.consuming === void 0) return Promise.resolve();
15761
+ pinged() {
15770
15762
  const done = makeUnsafe$4();
15771
15763
  offerUnsafe(this.intents, Intent.Ping({ done }));
15772
- return runPromise(andThen(_await(done), this.stillLighting()));
15764
+ return _await(done);
15765
+ }
15766
+ drained() {
15767
+ return gen({ self: this }, function* () {
15768
+ for (let pass = 0; pass < DRAIN_PASSES; pass += 1) {
15769
+ yield* this.pinged();
15770
+ if (sizeUnsafe(this.intents) === 0) return;
15771
+ }
15772
+ });
15773
+ }
15774
+ settled() {
15775
+ if (this.consuming === void 0) return Promise.resolve();
15776
+ return runPromise(andThen(this.drained(), this.stillLighting()));
15773
15777
  }
15774
15778
  stillLighting() {
15775
15779
  const fiber = this.lighting;
@@ -15977,29 +15981,31 @@ var init_app = __esmMin((() => {
15977
15981
  yield* effect();
15978
15982
  });
15979
15983
  }
15980
- typedIn(key) {
15981
- if (key.ctrl || key.option || key.meta || key.super === true) return false;
15982
- return PRINTABLE.test(key.sequence);
15983
- }
15984
15984
  onText(key) {
15985
15985
  if (!listens(this.state.screen)) return;
15986
- if (key.name === "backspace") {
15987
- this.commit(backspaced(this.state));
15988
- return;
15989
- }
15990
- if (key.name === "down" || key.name === "up") {
15991
- this.commit(paletteMoved(this.state, key.name === "down" ? 1 : -1));
15992
- return;
15993
- }
15994
- if (this.typedIn(key)) this.commit(typed(this.state, key.sequence));
15986
+ if (key.name === "down" || key.name === "up") this.commit(paletteMoved(this.state, key.name === "down" ? 1 : -1));
15995
15987
  }
15996
15988
  turnWriting(next) {
15989
+ if (listens(next.screen) !== listens(this.state.screen) || next.screen !== this.state.screen) runSync(this.display.askOn(listens(next.screen) ? next.screen : void 0));
15997
15990
  const was = writesInto(this.state.screen);
15998
15991
  const now = writesInto(next.screen);
15999
15992
  if (was === now) return;
16000
15993
  if (now) runSync(this.display.write(next.draft));
16001
15994
  runSync(this.display.writeOn(now));
16002
15995
  }
15996
+ askedBack(text) {
15997
+ const clean = legible(text).replaceAll("\n", " ");
15998
+ if (clean !== text) {
15999
+ runSync(this.display.askWith(clean));
16000
+ return;
16001
+ }
16002
+ if (!listens(this.state.screen) || clean === this.state.query) return;
16003
+ this.commit({
16004
+ ...this.state,
16005
+ query: clean,
16006
+ paletteIndex: 0
16007
+ });
16008
+ }
16003
16009
  readBack(text) {
16004
16010
  const clean = legible(stripAnsiSequences(text));
16005
16011
  if (clean !== text) {
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.75",
26
+ "version": "0.1.0-alpha.76",
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": {