koneck 2.128.26 → 2.128.27

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.
@@ -78,4 +78,20 @@ export declare class SelectionCopyState {
78
78
  * Unsupported desktops keep their terminal's native copy behavior.
79
79
  */
80
80
  export declare function startSelectionCopy(onCopy: (count: number) => void): () => void;
81
+ /**
82
+ * Put text on the clipboard by asking the terminal, rather than the operating system.
83
+ *
84
+ * OSC 52 is handed to the terminal in the output stream, so it is the one copy that works over
85
+ * SSH: the text reaches the clipboard of the machine the person is sitting at, not the machine
86
+ * the process is running on. That is the common case here — a Raspberry Pi reached from a laptop
87
+ * — where writing to a clipboard on the far end would put the text somewhere nobody can paste
88
+ * from.
89
+ *
90
+ * Best-effort by nature. A terminal that does not implement it ignores the sequence, and some
91
+ * implement it but refuse writes until switched on. There is nothing to detect and no reply to
92
+ * wait for, so the caller can only say what it attempted.
93
+ */
94
+ export declare function copyViaTerminal(text: string, stream?: {
95
+ write?: (s: string) => unknown;
96
+ }): boolean;
81
97
  //# sourceMappingURL=clipboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,OAAO,GAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAW,EAClE,SAAS,SAAQ,GAChB,OAAO,CAAC,aAAa,CAAC,CAmBxB;AA6BD;;;;;GAKG;AACH,wBAAgB,cAAc,CAA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BD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAK5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,+EAA+E;AAC/E,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBtF;AAED,yFAAyF;AACzF,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,4EAA4E;IAC5E,IAAI,cAAc,IAAI,OAAO,CAAoC;IACjE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;CAavD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CA+D9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE;IAAE,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;CAAmB,GAC1D,OAAO,CAWT"}
package/dist/clipboard.js CHANGED
@@ -258,4 +258,31 @@ export function startSelectionCopy(onCopy) {
258
258
  return () => { stopped = true; if (timer)
259
259
  clearTimeout(timer); };
260
260
  }
261
+ /**
262
+ * Put text on the clipboard by asking the terminal, rather than the operating system.
263
+ *
264
+ * OSC 52 is handed to the terminal in the output stream, so it is the one copy that works over
265
+ * SSH: the text reaches the clipboard of the machine the person is sitting at, not the machine
266
+ * the process is running on. That is the common case here — a Raspberry Pi reached from a laptop
267
+ * — where writing to a clipboard on the far end would put the text somewhere nobody can paste
268
+ * from.
269
+ *
270
+ * Best-effort by nature. A terminal that does not implement it ignores the sequence, and some
271
+ * implement it but refuse writes until switched on. There is nothing to detect and no reply to
272
+ * wait for, so the caller can only say what it attempted.
273
+ */
274
+ export function copyViaTerminal(text, stream = process.stdout) {
275
+ if (text === '')
276
+ return false;
277
+ try {
278
+ // Bounded: a runaway selection should not emit a megabyte of base64 into the terminal, and
279
+ // most implementations refuse very large payloads regardless.
280
+ const payload = Buffer.from(text.slice(0, 100_000), 'utf8').toString('base64');
281
+ stream.write?.('\u001b]52;c;' + payload + '\u0007');
282
+ return true;
283
+ }
284
+ catch {
285
+ return false;
286
+ }
287
+ }
261
288
  //# sourceMappingURL=clipboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,kFAAkF;AAClF,MAAM,OAAO,GAAoD;IAC/D,oDAAoD;IACpD,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE;IAC5C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;IAC1D,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE;IACnD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;IAC7B,qFAAqF;IACrF,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE;CAC9E,CAAC;AAWF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAA2D,OAAO,EAClE,SAAS,GAAG,KAAK;IAEjB,MAAM,EAAE,KAAK,EAAE,GAA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MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,SAA6C,OAAO,CAAC,MAAM;IAE3D,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC9B,IAAI,CAAC;QACH,2FAA2F;QAC3F,8DAA8D;QAC9D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/E,MAAM,CAAC,KAAK,EAAE,CAAC,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -141,16 +141,18 @@ export declare const HEARTBEAT_MS = 1000;
141
141
  * scrollback that trade is a bad one — the terminal's own buffer already scrolls with the wheel,
142
142
  * so turning it on loses selection and gains nothing. Hence opt-in.
143
143
  *
144
- * On the alternate screen there is nothing on the other side of the trade. The terminal has no
145
- * scrollback there to scroll, and a selection does not survive the next repaint both of which
146
- * are already the stated reasons for avoiding the alternate screen where it is not needed. So the
147
- * wheel does nothing at all unless KONECK asks for it, and "koneck does not scroll" is the whole
148
- * of the experience: the transcript runs off the top and the obvious gesture is inert.
144
+ * It was briefly defaulted on for the alternate screen, on the reasoning that a screen with no
145
+ * scrollback of its own has nothing to lose. That was answered directly: "select must happen on
146
+ * mouse like selecting in a document" and "mouse move should be by default, not to be turned
147
+ * on/off". Shift+drag is a workaround for a cost that should not be imposed, and the real fix was
148
+ * not to take the mouse but to stop taking the screen see `defaultAltScreen`. In ordinary
149
+ * scrollback the terminal scrolls with the wheel and selects with a drag, both without being
150
+ * asked, which is the behaviour being described.
149
151
  *
150
- * So the default follows the screen. An explicit `mouse` in the config still wins, in both
151
- * directions, and `/mouse off` is still there for anyone who wants the trade back.
152
+ * So this stays off unless somebody asks for it. `/mouse on` is there for anyone who wants the
153
+ * wheel to drive the transcript inside the alternate screen and will take Shift+drag for it.
152
154
  */
153
- export declare function defaultMouseTracking(saved: boolean | undefined, altScreen: boolean): boolean;
155
+ export declare function defaultMouseTracking(saved: boolean | undefined, _altScreen: boolean): boolean;
154
156
  /**
155
157
  * Where a tool's file changes are drawn, if anywhere.
156
158
  *
@@ -467,6 +469,28 @@ export declare function DiffPanel({ files, width, height, activity, activityRows
467
469
  * Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
468
470
  * an Ink app. Something does now.
469
471
  */
472
+ /**
473
+ * The selected span of the composer, or null when nothing is selected.
474
+ *
475
+ * Held as an anchor plus the caret rather than as a pair, because that is what makes Shift+arrow
476
+ * behave the way it does everywhere else: the anchor is where selecting began and stays put, the
477
+ * caret is the end being dragged, and which of the two is on the left depends on which way it
478
+ * was dragged. Clamped to the text, so a draft replaced underneath a stale anchor cannot produce
479
+ * a range that is not there.
480
+ */
481
+ export declare function selectionRange(anchor: number | null, caret: number, length: number): [number, number] | null;
482
+ /**
483
+ * The draft after typing over, or deleting, whatever is selected.
484
+ *
485
+ * One function for both, because they are the same operation: a selection is replaced by what
486
+ * was typed, and deleting is replacing it with nothing. With no selection it is an ordinary
487
+ * insert at the caret, so every editing path can call this without first asking which case it is
488
+ * in.
489
+ */
490
+ export declare function replaceSelection(text: string, range: [number, number] | null, caret: number, insert: string): {
491
+ text: string;
492
+ caret: number;
493
+ };
470
494
  export declare function App({ config: initialConfig, clearFrame, synchronizedFrames }: {
471
495
  config: AgentConfig;
472
496
  clearFrame?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ink-chat.d.ts","sourceRoot":"","sources":["../src/ink-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA2B3D,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAuCtE,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiB5D,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AAM,EAAE,MAAM,EAAE,MAAM,GAC1E;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMjC;AAED,wBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,kBAA0B,EAAE,EACxE;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7C,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8iLhE;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
package/dist/ink-chat.js CHANGED
@@ -14,7 +14,7 @@ import { normaliseEndpoint, withEndpoint, savedEndpoints, shortSource, resolveMo
14
14
  import { loadProjectConfig, loadGlobalConfig, saveGlobalConfig, withoutStoredApiKey } from './config.js';
15
15
  import { rememberKey, forgetAllKeys } from './credentials.js';
16
16
  import { ImageDraft, pastedImagePath } from './image-draft.js';
17
- import { readClipboard, readClipboardImage, startSelectionCopy, cleanPastedSecret } from './clipboard.js';
17
+ import { readClipboard, readClipboardImage, startSelectionCopy, cleanPastedSecret, copyViaTerminal } from './clipboard.js';
18
18
  import { paceFrom } from './pace.js';
19
19
  import { policyFrom, FAILOVER_OFF } from './failover.js';
20
20
  import { listCheckpoints, revertCheckpoint, previewCheckpoint, snapshotTree, filesTouchedBy, createWorkspaceCheckpoint, checkpointScope } from './checkpoint.js';
@@ -510,17 +510,19 @@ export const HEARTBEAT_MS = 1_000;
510
510
  * scrollback that trade is a bad one — the terminal's own buffer already scrolls with the wheel,
511
511
  * so turning it on loses selection and gains nothing. Hence opt-in.
512
512
  *
513
- * On the alternate screen there is nothing on the other side of the trade. The terminal has no
514
- * scrollback there to scroll, and a selection does not survive the next repaint both of which
515
- * are already the stated reasons for avoiding the alternate screen where it is not needed. So the
516
- * wheel does nothing at all unless KONECK asks for it, and "koneck does not scroll" is the whole
517
- * of the experience: the transcript runs off the top and the obvious gesture is inert.
513
+ * It was briefly defaulted on for the alternate screen, on the reasoning that a screen with no
514
+ * scrollback of its own has nothing to lose. That was answered directly: "select must happen on
515
+ * mouse like selecting in a document" and "mouse move should be by default, not to be turned
516
+ * on/off". Shift+drag is a workaround for a cost that should not be imposed, and the real fix was
517
+ * not to take the mouse but to stop taking the screen see `defaultAltScreen`. In ordinary
518
+ * scrollback the terminal scrolls with the wheel and selects with a drag, both without being
519
+ * asked, which is the behaviour being described.
518
520
  *
519
- * So the default follows the screen. An explicit `mouse` in the config still wins, in both
520
- * directions, and `/mouse off` is still there for anyone who wants the trade back.
521
+ * So this stays off unless somebody asks for it. `/mouse on` is there for anyone who wants the
522
+ * wheel to drive the transcript inside the alternate screen and will take Shift+drag for it.
521
523
  */
522
- export function defaultMouseTracking(saved, altScreen) {
523
- return saved ?? altScreen;
524
+ export function defaultMouseTracking(saved, _altScreen) {
525
+ return saved ?? false;
524
526
  }
525
527
  /**
526
528
  * Where a tool's file changes are drawn, if anywhere.
@@ -1353,13 +1355,28 @@ compositesRedraws = false) {
1353
1355
  * a frame when nobody has expressed a view.
1354
1356
  */
1355
1357
  export function initialAltScreen(cfg, compositesRedraws, stdout = process.stdout, env = process.env) {
1356
- if (cfg.altScreen === false)
1357
- return false;
1358
- // A panel explicitly enabled in saved settings needs a frame from the first render. Previously
1359
- // it was marked on but silently had nowhere to draw until `/diff off` then `/diff on` happened.
1360
- if (cfg.diffPanel === true || cfg.altScreen === true)
1358
+ /*
1359
+ * Opt-in, on every terminal, however good it is.
1360
+ *
1361
+ * The alternate screen was the default wherever a redraw composites, because it pins the prompt
1362
+ * to the last row. Everything else about it is a loss, and the losses are the ones people
1363
+ * actually notice: the terminal's own scrollback is gone, so the wheel does nothing; a
1364
+ * selection does not survive the next repaint, so text cannot be copied out; and the whole
1365
+ * transcript is re-rendered on every frame instead of being written once into scrollback.
1366
+ *
1367
+ * Each of those was reported separately — "koneck does not scroll", "i can't select anything or
1368
+ * copy anything", and the repainting. They are one cause. Asked for plainly in the end: "select
1369
+ * must happen on mouse like selecting in a document ... mouse move should be by default, not to
1370
+ * be turned on/off". In ordinary scrollback all of that is simply true, because the terminal is
1371
+ * doing it rather than KONECK imitating it.
1372
+ *
1373
+ * So the pinned prompt is the thing you opt into now, with `/altscreen on` or `altScreen: true`.
1374
+ * `diffPanel` no longer implies it either: the panel is a reason to want a frame, not a reason
1375
+ * to take one from somebody who never asked, and with no frame the diffs render inline.
1376
+ */
1377
+ if (cfg.altScreen === true)
1361
1378
  return true;
1362
- return defaultAltScreen(stdout, env, compositesRedraws);
1379
+ return false;
1363
1380
  }
1364
1381
  /**
1365
1382
  * One diff line, syntax-coloured, on its tinted band.
@@ -1470,6 +1487,39 @@ export function DiffPanel({ files, width, height, activity, activityRows = 0 })
1470
1487
  * Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
1471
1488
  * an Ink app. Something does now.
1472
1489
  */
1490
+ /**
1491
+ * The selected span of the composer, or null when nothing is selected.
1492
+ *
1493
+ * Held as an anchor plus the caret rather than as a pair, because that is what makes Shift+arrow
1494
+ * behave the way it does everywhere else: the anchor is where selecting began and stays put, the
1495
+ * caret is the end being dragged, and which of the two is on the left depends on which way it
1496
+ * was dragged. Clamped to the text, so a draft replaced underneath a stale anchor cannot produce
1497
+ * a range that is not there.
1498
+ */
1499
+ export function selectionRange(anchor, caret, length) {
1500
+ if (anchor === null)
1501
+ return null;
1502
+ const a = Math.max(0, Math.min(anchor, length));
1503
+ const c = Math.max(0, Math.min(caret, length));
1504
+ if (a === c)
1505
+ return null;
1506
+ return a < c ? [a, c] : [c, a];
1507
+ }
1508
+ /**
1509
+ * The draft after typing over, or deleting, whatever is selected.
1510
+ *
1511
+ * One function for both, because they are the same operation: a selection is replaced by what
1512
+ * was typed, and deleting is replacing it with nothing. With no selection it is an ordinary
1513
+ * insert at the caret, so every editing path can call this without first asking which case it is
1514
+ * in.
1515
+ */
1516
+ export function replaceSelection(text, range, caret, insert) {
1517
+ if (!range) {
1518
+ return { text: text.slice(0, caret) + insert + text.slice(caret), caret: caret + insert.length };
1519
+ }
1520
+ const [from, to] = range;
1521
+ return { text: text.slice(0, from) + insert + text.slice(to), caret: from + insert.length };
1522
+ }
1473
1523
  export function App({ config: initialConfig, clearFrame, synchronizedFrames = false }) {
1474
1524
  const { exit } = useApp();
1475
1525
  const [cfg, setCfg] = useState(initialConfig);
@@ -1933,6 +1983,13 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1933
1983
  const readOnlyReviewRef = useRef(false);
1934
1984
  /** Caret offset into `draft`. Kept beside it so every edit can place the caret deliberately. */
1935
1985
  const [caret, setCaret] = useState(0);
1986
+ /**
1987
+ * Where a keyboard selection began, or null when nothing is selected.
1988
+ *
1989
+ * Shift with an arrow drops the anchor and drags the caret away from it; anything that moves
1990
+ * the caret without Shift lifts it again. See `selectionRange`.
1991
+ */
1992
+ const [selAnchor, setSelAnchor] = useState(null);
1936
1993
  const [busy, setBusy] = useState(false);
1937
1994
  const [agentState, setAgentState] = useState('ready');
1938
1995
  // A shell normally uses the machine name as its tab title. Keep the KONECK mark and workspace
@@ -5085,6 +5142,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5085
5142
  setCaret(c => c + token.length);
5086
5143
  }
5087
5144
  useInput((input, key) => {
5145
+ /** What is selected in the composer right now, if anything. See `selectionRange`. */
5146
+ const composerSel = selectionRange(selAnchor, caret, draft.length);
5088
5147
  /*
5089
5148
  * When a key was last pressed, so the animation can get out of the way.
5090
5149
  *
@@ -5141,6 +5200,25 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5141
5200
  closePicker();
5142
5201
  return;
5143
5202
  }
5203
+ /*
5204
+ * With something selected this copies it, as it would in any other text box, and only
5205
+ * leaves when there is nothing selected.
5206
+ *
5207
+ * Overloading the key that quits is not done lightly. It is what everyone's hands already
5208
+ * do, the selection is visible on screen so the branch taken is never a surprise, and the
5209
+ * second press — with the selection now lifted — quits as it always did.
5210
+ *
5211
+ * The copy goes through the terminal rather than the operating system, because the
5212
+ * terminal is where the person is: over SSH, a clipboard on this machine is one nobody can
5213
+ * paste from.
5214
+ */
5215
+ if (composerSel) {
5216
+ const picked = draft.slice(composerSel[0], composerSel[1]);
5217
+ copyViaTerminal(picked, process.stdout);
5218
+ setSelAnchor(null);
5219
+ setCopyNotice(`Copied ${picked.length} chars · ctrl+c again to exit`);
5220
+ return;
5221
+ }
5144
5222
  void doSave().catch(() => { }).then(() => exit());
5145
5223
  return;
5146
5224
  }
@@ -5598,12 +5676,38 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5598
5676
  recallDraft(historyDirection);
5599
5677
  return;
5600
5678
  }
5679
+ /*
5680
+ * Shift with an arrow selects, the way it does in every other text box.
5681
+ *
5682
+ * The anchor is dropped where selecting began and left alone; the caret is what moves. Ctrl
5683
+ * with it extends by a word, matching what Ctrl alone already does to the caret.
5684
+ */
5685
+ if ((key.leftArrow || key.rightArrow) && key.shift) {
5686
+ if (selAnchor === null)
5687
+ setSelAnchor(caret);
5688
+ setCaret(key.leftArrow
5689
+ ? (key.ctrl || key.meta ? wordStart(draft, caret) : Math.max(0, caret - 1))
5690
+ : (key.ctrl || key.meta ? wordEnd(draft, caret) : Math.min(draft.length, caret + 1)));
5691
+ return;
5692
+ }
5601
5693
  if (key.leftArrow) {
5694
+ // An arrow without Shift lifts the selection and puts the caret on the edge it moved
5695
+ // towards, rather than jumping from wherever the caret happened to be dragged to.
5696
+ if (composerSel) {
5697
+ setSelAnchor(null);
5698
+ setCaret(composerSel[0]);
5699
+ return;
5700
+ }
5602
5701
  const step = 1 + takeBurst('left');
5603
5702
  setCaret(c => (key.ctrl || key.meta ? wordStart(draft, c) : Math.max(0, c - step)));
5604
5703
  return;
5605
5704
  }
5606
5705
  if (key.rightArrow) {
5706
+ if (composerSel) {
5707
+ setSelAnchor(null);
5708
+ setCaret(composerSel[1]);
5709
+ return;
5710
+ }
5607
5711
  const step = 1 + takeBurst('right');
5608
5712
  setCaret(c => (key.ctrl || key.meta ? wordEnd(draft, c) : Math.min(draft.length, c + step)));
5609
5713
  return;
@@ -5611,10 +5715,12 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5611
5715
  // ctrl+a / ctrl+e are line start and end, as in bash. Home/End arrive as these on most
5612
5716
  // terminals, so both spellings land here.
5613
5717
  if (key.ctrl && input === 'a') {
5718
+ setSelAnchor(null);
5614
5719
  setCaret(0);
5615
5720
  return;
5616
5721
  }
5617
5722
  if (key.ctrl && input === 'e') {
5723
+ setSelAnchor(null);
5618
5724
  setCaret(draft.length);
5619
5725
  return;
5620
5726
  }
@@ -5635,6 +5741,13 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5635
5741
  return;
5636
5742
  }
5637
5743
  if (key.backspace || key.delete) {
5744
+ if (composerSel) {
5745
+ const next = replaceSelection(draft, composerSel, caret, '');
5746
+ setDraft(next.text);
5747
+ setCaret(next.caret);
5748
+ setSelAnchor(null);
5749
+ return;
5750
+ }
5638
5751
  if (delKindRef.current === 'forward') {
5639
5752
  setDraft(d => d.slice(0, caret) + d.slice(caret + 1)); // caret stays put
5640
5753
  return;
@@ -5676,8 +5789,12 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5676
5789
  filePaste(text);
5677
5790
  return;
5678
5791
  }
5679
- const next = draft.slice(0, caret) + text + draft.slice(caret);
5680
- const nextCaret = caret + text.length;
5792
+ // Typing over a selection replaces it, which is the other half of selecting being useful.
5793
+ const edited = replaceSelection(draft, composerSel, caret, text);
5794
+ if (composerSel)
5795
+ setSelAnchor(null);
5796
+ const next = edited.text;
5797
+ const nextCaret = edited.caret;
5681
5798
  // Once the recalled line is edited it is a new draft, not a history cursor position.
5682
5799
  historyIndexRef.current = null;
5683
5800
  setDraft(next);
@@ -5713,6 +5830,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5713
5830
  }
5714
5831
  /** Sends the composer contents: a slash command, or a task for the agent. */
5715
5832
  function submitDraft(raw) {
5833
+ // The draft is about to be replaced, so an anchor into it no longer points at anything.
5834
+ setSelAnchor(null);
5716
5835
  {
5717
5836
  // Tokens are expanded here, at the last moment. The model gets the text as it was copied —
5718
5837
  // blank lines, indentation and all — while the transcript shows the compact form so a
@@ -6552,11 +6671,17 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
6552
6671
  return (_jsx(Box, { marginTop: 1, children: _jsx(Panel, { width: panelWidth(lines, barWidth, 46), color: AMBER, title: `Permission — ${modeSpec(mode).label} mode`, children: lines }) }));
6553
6672
  })()] }), sidePanelOpen && (_jsx(Box, { flexDirection: "column", width: diffPanelWidth, flexShrink: 0, children: diffPanelOpen && _jsx(DiffPanel, { files: liveDiffs, width: diffPanelWidth, height: Math.max(6, frameRows - 6), activityRows: activityPanelOpen ? 4 : 0, activity: activityPanelOpen ? _jsxs(_Fragment, { children: [_jsxs(Text, { color: CYAN, bold: true, children: ["Activity \u00B7 ", fmtElapsed(busyStart.current ? Date.now() - busyStart.current : 0)] }), _jsx(Text, { color: AMBER, wrap: "truncate", children: ask ? 'Waiting for your approval' : liveToolRef.current
6554
6673
  ? 'Running ' + liveToolRef.current.name : thinkingRef.current.chars > 0
6555
- ? 'Waiting for model · reasoning received' : 'Waiting for model' }), _jsx(Text, { color: MUTED, wrap: "truncate", children: liveToolRef.current?.detail || plan?.steps.find(s => s.state !== 'done')?.text || 'esc to interrupt' })] }) : undefined }) }))] }), _jsxs(Box, { marginTop: 1, borderStyle: "round", borderColor: busy ? DIM : CYAN, paddingX: 1, width: uiWidth - 5, flexShrink: 0, children: [_jsxs(Text, { color: CYAN, bold: true, children: [G.caret, " "] }), _jsx(Text, { color: INK, children: draft.slice(0, caret) }), busy
6556
- ? _jsx(Text, { color: INK, children: draft.slice(caret) })
6557
- : caret < draft.length
6558
- ? _jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: CYAN, color: "#10222A", children: draft[caret] }), _jsx(Text, { color: INK, children: draft.slice(caret + 1) })] })
6559
- : _jsx(Text, { color: CYAN, children: "\u2588" })] }), copyNotice && _jsx(Text, { color: CYAN, children: copyNotice }), _jsx(Box, { marginTop: 1, paddingX: 1, width: uiWidth - 4, flexShrink: 0, children: _jsxs(Text, { wrap: "truncate", backgroundColor: "#24343B", children: [repaint % 2 === 1 ? '\u200b' : '', _jsx(Text, { color: MUTED, children: "TAB " }), _jsx(Text, { color: INK, children: "Analytics" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: CYAN, children: "/HELP" }), _jsx(Text, { color: INK, children: " Commands" }), _jsx(Text, { color: MUTED, children: " / SHIFT+TAB " }), _jsx(Text, { color: INK, children: "Mode" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: statusColor, children: statusLabel.toLowerCase() }), plan && planSummary(plan) && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / PLAN: " }), _jsx(Text, { color: CYAN, children: planSummary(plan) })] })), _jsx(Text, { color: MUTED, children: " / MODE: " }), _jsx(Text, { color: mode === 'auto' ? INK : AMBER, children: modeSpec(mode).label }), _jsx(Text, { color: MUTED, children: " / EFFORT: " }), _jsx(Text, { color: effort === 'medium' ? INK : AMBER, children: effort }), mouse && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: AMBER, children: "WHEEL: on \u2014 shift to select \u00B7 /mouse off" })] })), _jsx(Text, { color: MUTED, children: " / MODEL: " }), _jsx(Text, { color: INK, children: modelShort }), _jsx(Text, { color: MUTED, children: " / v" }), _jsx(Text, { color: updatePane?.behind ? AMBER : INK, children: VERSION }), updatePane?.behind && _jsx(Text, { color: AMBER, children: " \u2191" }), pasteCount > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsxs(Text, { color: AMBER, children: [pasteCount, " paste", pasteCount === 1 ? '' : 's', " held, sent in full"] })] })), ' '.repeat(uiWidth)] }) })] }));
6674
+ ? 'Waiting for model · reasoning received' : 'Waiting for model' }), _jsx(Text, { color: MUTED, wrap: "truncate", children: liveToolRef.current?.detail || plan?.steps.find(s => s.state !== 'done')?.text || 'esc to interrupt' })] }) : undefined }) }))] }), _jsxs(Box, { marginTop: 1, borderStyle: "round", borderColor: busy ? DIM : CYAN, paddingX: 1, width: uiWidth - 5, flexShrink: 0, children: [_jsxs(Text, { color: CYAN, bold: true, children: [G.caret, " "] }), (() => {
6675
+ const sel = selectionRange(selAnchor, caret, draft.length);
6676
+ if (sel) {
6677
+ return (_jsxs(_Fragment, { children: [_jsx(Text, { color: INK, children: draft.slice(0, sel[0]) }), _jsx(Text, { backgroundColor: CYAN, color: "#10222A", children: draft.slice(sel[0], sel[1]) }), _jsx(Text, { color: INK, children: draft.slice(sel[1]) })] }));
6678
+ }
6679
+ return (_jsxs(_Fragment, { children: [_jsx(Text, { color: INK, children: draft.slice(0, caret) }), busy
6680
+ ? _jsx(Text, { color: INK, children: draft.slice(caret) })
6681
+ : caret < draft.length
6682
+ ? _jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: CYAN, color: "#10222A", children: draft[caret] }), _jsx(Text, { color: INK, children: draft.slice(caret + 1) })] })
6683
+ : _jsx(Text, { color: CYAN, children: "\u2588" })] }));
6684
+ })()] }), copyNotice && _jsx(Text, { color: CYAN, children: copyNotice }), _jsx(Box, { marginTop: 1, paddingX: 1, width: uiWidth - 4, flexShrink: 0, children: _jsxs(Text, { wrap: "truncate", backgroundColor: "#24343B", children: [repaint % 2 === 1 ? '\u200b' : '', _jsx(Text, { color: MUTED, children: "TAB " }), _jsx(Text, { color: INK, children: "Analytics" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: CYAN, children: "/HELP" }), _jsx(Text, { color: INK, children: " Commands" }), _jsx(Text, { color: MUTED, children: " / SHIFT+TAB " }), _jsx(Text, { color: INK, children: "Mode" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: statusColor, children: statusLabel.toLowerCase() }), plan && planSummary(plan) && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / PLAN: " }), _jsx(Text, { color: CYAN, children: planSummary(plan) })] })), _jsx(Text, { color: MUTED, children: " / MODE: " }), _jsx(Text, { color: mode === 'auto' ? INK : AMBER, children: modeSpec(mode).label }), _jsx(Text, { color: MUTED, children: " / EFFORT: " }), _jsx(Text, { color: effort === 'medium' ? INK : AMBER, children: effort }), mouse && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: AMBER, children: "WHEEL: on \u2014 shift to select \u00B7 /mouse off" })] })), _jsx(Text, { color: MUTED, children: " / MODEL: " }), _jsx(Text, { color: INK, children: modelShort }), _jsx(Text, { color: MUTED, children: " / v" }), _jsx(Text, { color: updatePane?.behind ? AMBER : INK, children: VERSION }), updatePane?.behind && _jsx(Text, { color: AMBER, children: " \u2191" }), pasteCount > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsxs(Text, { color: AMBER, children: [pasteCount, " paste", pasteCount === 1 ? '' : 's', " held, sent in full"] })] })), ' '.repeat(uiWidth)] }) })] }));
6560
6685
  }
6561
6686
  export async function runInkChatMode(config) {
6562
6687
  // Nothing is written before the first frame. Filling the screen to push the prompt to the foot