koneck 2.128.25 → 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"}
@@ -133,6 +133,26 @@ export declare const WORD_HOLD_MS = 60000;
133
133
  * appears frozen for seven seconds is worse than either.
134
134
  */
135
135
  export declare const HEARTBEAT_MS = 1000;
136
+ /**
137
+ * Whether the terminal should report the wheel to KONECK, when nothing has been saved either way.
138
+ *
139
+ * Mouse tracking is a trade: a terminal sends mouse events to one place, so while KONECK has them
140
+ * the drag-select, the right-click menu and the middle-click paste all stop working. In ordinary
141
+ * scrollback that trade is a bad one — the terminal's own buffer already scrolls with the wheel,
142
+ * so turning it on loses selection and gains nothing. Hence opt-in.
143
+ *
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.
151
+ *
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.
154
+ */
155
+ export declare function defaultMouseTracking(saved: boolean | undefined, _altScreen: boolean): boolean;
136
156
  /**
137
157
  * Where a tool's file changes are drawn, if anywhere.
138
158
  *
@@ -254,11 +274,12 @@ export declare function thinkingTail(text: string, lines: number, width: number)
254
274
  * prompt asking for one put the key in the message box — on screen, and one keystroke from being
255
275
  * sent to a model.
256
276
  */
257
- export type PasteTarget = 'key-prompt' | 'composer' | 'drop';
277
+ export type PasteTarget = 'key-prompt' | 'add-provider' | 'composer' | 'drop';
258
278
  export declare function pasteTarget(open: {
259
279
  keyPrompt?: boolean;
260
280
  picker?: boolean;
261
281
  ask?: boolean;
282
+ addProvider?: boolean;
262
283
  }): PasteTarget;
263
284
  /** Bytes as a person reads them, for a session listing. */
264
285
  export declare function humanBytes(bytes: number): string;
@@ -448,6 +469,28 @@ export declare function DiffPanel({ files, width, height, activity, activityRows
448
469
  * Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
449
470
  * an Ink app. Something does now.
450
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
+ };
451
494
  export declare function App({ config: initialConfig, clearFrame, synchronizedFrames }: {
452
495
  config: AgentConfig;
453
496
  clear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AAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,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';
@@ -502,6 +502,28 @@ export const WORD_HOLD_MS = 60_000;
502
502
  * appears frozen for seven seconds is worse than either.
503
503
  */
504
504
  export const HEARTBEAT_MS = 1_000;
505
+ /**
506
+ * Whether the terminal should report the wheel to KONECK, when nothing has been saved either way.
507
+ *
508
+ * Mouse tracking is a trade: a terminal sends mouse events to one place, so while KONECK has them
509
+ * the drag-select, the right-click menu and the middle-click paste all stop working. In ordinary
510
+ * scrollback that trade is a bad one — the terminal's own buffer already scrolls with the wheel,
511
+ * so turning it on loses selection and gains nothing. Hence opt-in.
512
+ *
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.
520
+ *
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.
523
+ */
524
+ export function defaultMouseTracking(saved, _altScreen) {
525
+ return saved ?? false;
526
+ }
505
527
  /**
506
528
  * Where a tool's file changes are drawn, if anywhere.
507
529
  *
@@ -862,6 +884,20 @@ export function thinkingTail(text, lines, width) {
862
884
  export function pasteTarget(open) {
863
885
  if (open.keyPrompt)
864
886
  return 'key-prompt';
887
+ /*
888
+ * The endpoint prompt takes a paste for the same reason the key prompt does.
889
+ *
890
+ * It was missing from this list, so a paste made the way a terminal makes one — right-click,
891
+ * Ctrl+Shift+V, middle-click — fell through to the composer and was typed into a draft hidden
892
+ * behind the prompt. Ctrl+V worked, because that is read from the clipboard by hand in the
893
+ * prompt's own key handler, which is exactly why the two disagreed and why it looked as though
894
+ * the field simply refused to accept a paste.
895
+ *
896
+ * A URL is the last thing anyone should be retyping: it is long, it is exact, and it has
897
+ * almost always just been copied out of a browser.
898
+ */
899
+ if (open.addProvider)
900
+ return 'add-provider';
865
901
  // A picker and a permission question both take single keys. A pasted blob is not an answer to
866
902
  // either, and answering something nobody chose is worse than ignoring it.
867
903
  if (open.picker || open.ask)
@@ -1319,13 +1355,28 @@ compositesRedraws = false) {
1319
1355
  * a frame when nobody has expressed a view.
1320
1356
  */
1321
1357
  export function initialAltScreen(cfg, compositesRedraws, stdout = process.stdout, env = process.env) {
1322
- if (cfg.altScreen === false)
1323
- return false;
1324
- // A panel explicitly enabled in saved settings needs a frame from the first render. Previously
1325
- // it was marked on but silently had nowhere to draw until `/diff off` then `/diff on` happened.
1326
- 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)
1327
1378
  return true;
1328
- return defaultAltScreen(stdout, env, compositesRedraws);
1379
+ return false;
1329
1380
  }
1330
1381
  /**
1331
1382
  * One diff line, syntax-coloured, on its tinted band.
@@ -1436,6 +1487,39 @@ export function DiffPanel({ files, width, height, activity, activityRows = 0 })
1436
1487
  * Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
1437
1488
  * an Ink app. Something does now.
1438
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
+ }
1439
1523
  export function App({ config: initialConfig, clearFrame, synchronizedFrames = false }) {
1440
1524
  const { exit } = useApp();
1441
1525
  const [cfg, setCfg] = useState(initialConfig);
@@ -1899,6 +1983,13 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1899
1983
  const readOnlyReviewRef = useRef(false);
1900
1984
  /** Caret offset into `draft`. Kept beside it so every edit can place the caret deliberately. */
1901
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);
1902
1993
  const [busy, setBusy] = useState(false);
1903
1994
  const [agentState, setAgentState] = useState('ready');
1904
1995
  // A shell normally uses the machine name as its tab title. Keep the KONECK mark and workspace
@@ -1988,7 +2079,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1988
2079
  *
1989
2080
  * So: the wheel is the thing you opt into, not the thing you lose.
1990
2081
  */
1991
- const [mouse, setMouse] = useState(cfg.mouse === true);
2082
+ const [mouse, setMouse] = useState(() => defaultMouseTracking(cfg.mouse, altScreen));
1992
2083
  /*
1993
2084
  * Whether the working animation runs at all.
1994
2085
  *
@@ -4184,11 +4275,22 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
4184
4275
  setStored(saved);
4185
4276
  setAltScreen(next);
4186
4277
  setScrollBack(0);
4278
+ // The wheel follows the screen unless somebody has said otherwise. Switching to a screen
4279
+ // with no scrollback of its own and leaving the wheel inert is how "koneck does not
4280
+ // scroll" happens; see defaultMouseTracking.
4281
+ const wheel = defaultMouseTracking(cfg.mouse, next);
4282
+ if (cfg.mouse === undefined)
4283
+ setMouse(wheel);
4187
4284
  addSystem(next
4188
- ? 'Alt-screen on: the prompt sits on the last row and nothing scrolls past it. ' +
4189
- 'Your terminal\'s own scrollback is not available here — use PageUp/PageDown, or ' +
4190
- 'shift with the arrows. Typing returns you to the newest. Saved as your default; /altscreen off to leave.'
4191
- : 'Alt-screen off: back to writing into the terminal\'s own scrollback. Saved as your default.');
4285
+ ? 'Alt-screen on: the prompt sits on the last row and nothing scrolls past it. '
4286
+ + 'Your terminal\'s own scrollback is not available here — '
4287
+ + (wheel
4288
+ ? 'the wheel scrolls the transcript instead, and PageUp/PageDown work too. '
4289
+ + 'Selecting text needs Shift held while the wheel is ours; `/mouse off` gives it back. '
4290
+ : 'use PageUp/PageDown, or `/mouse on` for the wheel. ')
4291
+ + 'Typing returns you to the newest. Saved as your default; /altscreen off to leave.'
4292
+ : 'Alt-screen off: back to writing into the terminal\'s own scrollback, which the wheel '
4293
+ + 'and mouse selection both work in as usual. Saved as your default.');
4192
4294
  return;
4193
4295
  }
4194
4296
  case '/thinking': {
@@ -5004,9 +5106,18 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5004
5106
  const clean = text.replace(/\r\n?/g, '\n');
5005
5107
  const lines = clean.split('\n').length;
5006
5108
  // Whatever owns the keyboard gets the paste.
5007
- const target = pasteTarget({ keyPrompt: Boolean(keyPrompt), picker: Boolean(picker), ask: Boolean(ask) });
5109
+ const target = pasteTarget({ keyPrompt: Boolean(keyPrompt), picker: Boolean(picker),
5110
+ ask: Boolean(ask), addProvider: Boolean(addProv) });
5008
5111
  if (target === 'drop')
5009
5112
  return;
5113
+ if (target === 'add-provider') {
5114
+ // One line, trimmed: an endpoint copied from an address bar arrives with a newline on it,
5115
+ // and that newline is not part of the URL.
5116
+ const one = cleanPastedSecret(clean.split('\n')[0] ?? '');
5117
+ if (one !== '')
5118
+ setAddProv(p => (p ? { ...p, value: p.value + one, error: undefined } : p));
5119
+ return;
5120
+ }
5010
5121
  if (target === 'key-prompt') {
5011
5122
  // A key pasted from a manager often carries a trailing newline; it is not part of the key.
5012
5123
  setKeyPrompt(p => (p ? { ...p, value: p.value + clean.replace(/\s+$/, '') } : p));
@@ -5031,6 +5142,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5031
5142
  setCaret(c => c + token.length);
5032
5143
  }
5033
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);
5034
5147
  /*
5035
5148
  * When a key was last pressed, so the animation can get out of the way.
5036
5149
  *
@@ -5087,6 +5200,25 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5087
5200
  closePicker();
5088
5201
  return;
5089
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
+ }
5090
5222
  void doSave().catch(() => { }).then(() => exit());
5091
5223
  return;
5092
5224
  }
@@ -5544,12 +5676,38 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5544
5676
  recallDraft(historyDirection);
5545
5677
  return;
5546
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
+ }
5547
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
+ }
5548
5701
  const step = 1 + takeBurst('left');
5549
5702
  setCaret(c => (key.ctrl || key.meta ? wordStart(draft, c) : Math.max(0, c - step)));
5550
5703
  return;
5551
5704
  }
5552
5705
  if (key.rightArrow) {
5706
+ if (composerSel) {
5707
+ setSelAnchor(null);
5708
+ setCaret(composerSel[1]);
5709
+ return;
5710
+ }
5553
5711
  const step = 1 + takeBurst('right');
5554
5712
  setCaret(c => (key.ctrl || key.meta ? wordEnd(draft, c) : Math.min(draft.length, c + step)));
5555
5713
  return;
@@ -5557,10 +5715,12 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5557
5715
  // ctrl+a / ctrl+e are line start and end, as in bash. Home/End arrive as these on most
5558
5716
  // terminals, so both spellings land here.
5559
5717
  if (key.ctrl && input === 'a') {
5718
+ setSelAnchor(null);
5560
5719
  setCaret(0);
5561
5720
  return;
5562
5721
  }
5563
5722
  if (key.ctrl && input === 'e') {
5723
+ setSelAnchor(null);
5564
5724
  setCaret(draft.length);
5565
5725
  return;
5566
5726
  }
@@ -5581,6 +5741,13 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5581
5741
  return;
5582
5742
  }
5583
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
+ }
5584
5751
  if (delKindRef.current === 'forward') {
5585
5752
  setDraft(d => d.slice(0, caret) + d.slice(caret + 1)); // caret stays put
5586
5753
  return;
@@ -5622,8 +5789,12 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5622
5789
  filePaste(text);
5623
5790
  return;
5624
5791
  }
5625
- const next = draft.slice(0, caret) + text + draft.slice(caret);
5626
- 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;
5627
5798
  // Once the recalled line is edited it is a new draft, not a history cursor position.
5628
5799
  historyIndexRef.current = null;
5629
5800
  setDraft(next);
@@ -5659,6 +5830,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5659
5830
  }
5660
5831
  /** Sends the composer contents: a slash command, or a task for the agent. */
5661
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);
5662
5835
  {
5663
5836
  // Tokens are expanded here, at the last moment. The model gets the text as it was copied —
5664
5837
  // blank lines, indentation and all — while the transcript shows the compact form so a
@@ -6018,7 +6191,9 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
6018
6191
  * by <Static> in inline mode, and re-rendered every frame inside a clipped viewport in
6019
6192
  * alt-screen mode. Two copies of this markup would drift apart within a release.
6020
6193
  */
6021
- const renderRow = (row, index) => (row.role === 'header' ? (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "column", alignItems: "center", marginTop: 1, marginBottom: 1, children: [logoFor(uiWidth, G.ascii).map((line, i) => (_jsx(Text, { color: CYAN, bold: true, children: line }, i))), _jsx(Text, { color: CYAN, bold: true, children: "KONECK / SOFTWARE DELIVERY SYSTEM" }), _jsx(Text, { color: MUTED, children: "Deliberate engineering, with control at every change." }), altScreen && (_jsx(Text, { color: DIM, children: `PageUp scrolls · /mouse on for the wheel · /altscreen off for the terminal's own scrollback` }))] }), _jsx(Panel, { width: barWidth, color: CYAN, title: "KONECK", children: [`MODEL: \`${modelShort}\` PROVIDER: \`${cfg.provider}\` WORKSPACE: \`${workspace}\``] })] }, index)) : row.role === 'user' ? (
6194
+ const renderRow = (row, index) => (row.role === 'header' ? (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "column", alignItems: "center", marginTop: 1, marginBottom: 1, children: [logoFor(uiWidth, G.ascii).map((line, i) => (_jsx(Text, { color: CYAN, bold: true, children: line }, i))), _jsx(Text, { color: CYAN, bold: true, children: "KONECK / SOFTWARE DELIVERY SYSTEM" }), _jsx(Text, { color: MUTED, children: "Deliberate engineering, with control at every change." }), altScreen && (_jsx(Text, { color: DIM, children: mouse
6195
+ ? `Wheel and PageUp scroll · shift-drag to select · /altscreen off for the terminal's own scrollback`
6196
+ : `PageUp scrolls · /mouse on for the wheel · /altscreen off for the terminal's own scrollback` }))] }), _jsx(Panel, { width: barWidth, color: CYAN, title: "KONECK", children: [`MODEL: \`${modelShort}\` PROVIDER: \`${cfg.provider}\` WORKSPACE: \`${workspace}\``] })] }, index)) : row.role === 'user' ? (
6022
6197
  // Painted as a filled bar so the user's own words are the most findable thing
6023
6198
  // on screen when scrolling back through a long session.
6024
6199
  _jsx(Box, { marginTop: 1, flexDirection: "column", children: wrapPreserving(row.text ?? '', barWidth - 2).map((line, li) => (_jsx(Text, { backgroundColor: USER_BG, color: USER_FG, bold: li === 0, children: (li === 0 ? `${G.caret} ` : ' ') + fitCells(line, barWidth - 2) }, li))) }, index)) : row.role === 'plan' ? (() => {
@@ -6496,11 +6671,17 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
6496
6671
  return (_jsx(Box, { marginTop: 1, children: _jsx(Panel, { width: panelWidth(lines, barWidth, 46), color: AMBER, title: `Permission — ${modeSpec(mode).label} mode`, children: lines }) }));
6497
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
6498
6673
  ? 'Running ' + liveToolRef.current.name : thinkingRef.current.chars > 0
6499
- ? '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
6500
- ? _jsx(Text, { color: INK, children: draft.slice(caret) })
6501
- : caret < draft.length
6502
- ? _jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: CYAN, color: "#10222A", children: draft[caret] }), _jsx(Text, { color: INK, children: draft.slice(caret + 1) })] })
6503
- : _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)] }) })] }));
6504
6685
  }
6505
6686
  export async function runInkChatMode(config) {
6506
6687
  // Nothing is written before the first frame. Filling the screen to push the prompt to the foot