@code-yeongyu/senpi 2026.5.24 → 2026.5.29-3
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 +33 -0
- package/dist/cli/args.d.ts +0 -6
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -2
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +117 -81
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +18 -24
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.js +4 -2
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.js.map +1 -1
- package/dist/core/extensions/builtin/session-observer/overlay.d.ts.map +1 -1
- package/dist/core/extensions/builtin/session-observer/overlay.js +0 -5
- package/dist/core/extensions/builtin/session-observer/overlay.js.map +1 -1
- package/dist/core/extensions/builtin/session-observer/scanner.d.ts.map +1 -1
- package/dist/core/extensions/builtin/session-observer/scanner.js +2 -0
- package/dist/core/extensions/builtin/session-observer/scanner.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +21 -9
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/output-guard.d.ts +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +52 -22
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/session-work-barrier.d.ts +9 -0
- package/dist/core/session-work-barrier.d.ts.map +1 -0
- package/dist/core/session-work-barrier.js +50 -0
- package/dist/core/session-work-barrier.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +0 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +6 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +64 -7
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +15 -3
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/settings.md +3 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +18 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +249 -39
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +349 -144
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +46 -29
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +2 -17
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +40 -55
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +7 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.d.ts +3 -0
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js +38 -0
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +5 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +66 -14
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/npm-shrinkwrap.json +13 -13
- package/package.json +6 -7
- package/dist/modes/neo-mode.d.ts +0 -43
- package/dist/modes/neo-mode.d.ts.map +0 -1
- package/dist/modes/neo-mode.js +0 -142
- package/dist/modes/neo-mode.js.map +0 -1
- package/dist/neo-tui-bin/senpi-neo-tui-linux-x64 +0 -0
|
@@ -3,9 +3,10 @@ import { decodePrintableKey, matchesKey } from "../keys.js";
|
|
|
3
3
|
import { KillRing } from "../kill-ring.js";
|
|
4
4
|
import { CURSOR_MARKER } from "../tui.js";
|
|
5
5
|
import { UndoStack } from "../undo-stack.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getGraphemeSegmenter, getWordSegmenter, isWhitespaceChar, truncateToWidth, visibleWidth } from "../utils.js";
|
|
7
7
|
import { SelectList } from "./select-list.js";
|
|
8
|
-
const
|
|
8
|
+
const graphemeSegmenter = getGraphemeSegmenter();
|
|
9
|
+
const wordSegmenter = getWordSegmenter();
|
|
9
10
|
/** Regex matching paste markers like `[paste #1 +123 lines]` or `[paste #2 1234 chars]`. */
|
|
10
11
|
const PASTE_MARKER_REGEX = /\[paste #(\d+)( (\+\d+ lines|\d+ chars))?\]/g;
|
|
11
12
|
/** Non-global version for single-segment testing. */
|
|
@@ -21,7 +22,7 @@ function isPasteMarker(segment) {
|
|
|
21
22
|
*
|
|
22
23
|
* Only markers whose numeric ID exists in `validIds` are merged.
|
|
23
24
|
*/
|
|
24
|
-
function segmentWithMarkers(text, validIds) {
|
|
25
|
+
function segmentWithMarkers(text, baseSegmenter, validIds) {
|
|
25
26
|
// Fast path: no paste markers in the text or no valid IDs.
|
|
26
27
|
if (validIds.size === 0 || !text.includes("[paste #")) {
|
|
27
28
|
return baseSegmenter.segment(text);
|
|
@@ -86,7 +87,7 @@ export function wordWrapLine(line, maxWidth, preSegmented) {
|
|
|
86
87
|
return [{ text: line, startIndex: 0, endIndex: line.length }];
|
|
87
88
|
}
|
|
88
89
|
const chunks = [];
|
|
89
|
-
const segments = preSegmented ?? [...
|
|
90
|
+
const segments = preSegmented ?? [...graphemeSegmenter.segment(line)];
|
|
90
91
|
let currentWidth = 0;
|
|
91
92
|
let chunkStart = 0;
|
|
92
93
|
// Wrap opportunity: the position after the last whitespace before a non-whitespace
|
|
@@ -225,8 +226,8 @@ export class Editor {
|
|
|
225
226
|
return new Set(this.pastes.keys());
|
|
226
227
|
}
|
|
227
228
|
/** Segment text with paste-marker awareness, only merging markers with valid IDs. */
|
|
228
|
-
segment(text) {
|
|
229
|
-
return segmentWithMarkers(text, this.validPasteIds());
|
|
229
|
+
segment(text, mode) {
|
|
230
|
+
return segmentWithMarkers(text, mode === "word" ? wordSegmenter : graphemeSegmenter, this.validPasteIds());
|
|
230
231
|
}
|
|
231
232
|
getPaddingX() {
|
|
232
233
|
return this.paddingX;
|
|
@@ -381,7 +382,7 @@ export class Editor {
|
|
|
381
382
|
if (after.length > 0) {
|
|
382
383
|
// Cursor is on a character (grapheme) - replace it with highlighted version
|
|
383
384
|
// Get the first grapheme from 'after'
|
|
384
|
-
const afterGraphemes = [...this.segment(after)];
|
|
385
|
+
const afterGraphemes = [...this.segment(after, "grapheme")];
|
|
385
386
|
const firstGrapheme = afterGraphemes[0]?.segment || "";
|
|
386
387
|
const restAfter = after.slice(firstGrapheme.length);
|
|
387
388
|
const cursor = `\x1b[7m${firstGrapheme}\x1b[0m`;
|
|
@@ -717,7 +718,7 @@ export class Editor {
|
|
|
717
718
|
}
|
|
718
719
|
else {
|
|
719
720
|
// Line needs wrapping - use word-aware wrapping
|
|
720
|
-
const chunks = wordWrapLine(line, contentWidth, [...this.segment(line)]);
|
|
721
|
+
const chunks = wordWrapLine(line, contentWidth, [...this.segment(line, "grapheme")]);
|
|
721
722
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
722
723
|
const chunk = chunks[chunkIndex];
|
|
723
724
|
if (!chunk)
|
|
@@ -1030,7 +1031,7 @@ export class Editor {
|
|
|
1030
1031
|
const line = this.state.lines[this.state.cursorLine] || "";
|
|
1031
1032
|
const beforeCursor = line.slice(0, this.state.cursorCol);
|
|
1032
1033
|
// Find the last grapheme in the text before cursor
|
|
1033
|
-
const graphemes = [...this.segment(beforeCursor)];
|
|
1034
|
+
const graphemes = [...this.segment(beforeCursor, "grapheme")];
|
|
1034
1035
|
const lastGrapheme = graphemes[graphemes.length - 1];
|
|
1035
1036
|
const graphemeLength = lastGrapheme ? lastGrapheme.segment.length : 1;
|
|
1036
1037
|
const before = line.slice(0, this.state.cursorCol - graphemeLength);
|
|
@@ -1114,7 +1115,7 @@ export class Editor {
|
|
|
1114
1115
|
// Snap cursor to atomic segment boundary (e.g. paste markers)
|
|
1115
1116
|
// so the cursor never lands in the middle of a multi-grapheme unit.
|
|
1116
1117
|
// Single-grapheme segments don't need snapping.
|
|
1117
|
-
const segments = [...this.segment(logicalLine)];
|
|
1118
|
+
const segments = [...this.segment(logicalLine, "grapheme")];
|
|
1118
1119
|
for (const seg of segments) {
|
|
1119
1120
|
if (seg.index > this.state.cursorCol)
|
|
1120
1121
|
break;
|
|
@@ -1334,7 +1335,7 @@ export class Editor {
|
|
|
1334
1335
|
// Delete grapheme at cursor position (handles emojis, combining characters, etc.)
|
|
1335
1336
|
const afterCursor = currentLine.slice(this.state.cursorCol);
|
|
1336
1337
|
// Find the first grapheme at cursor
|
|
1337
|
-
const graphemes = [...this.segment(afterCursor)];
|
|
1338
|
+
const graphemes = [...this.segment(afterCursor, "grapheme")];
|
|
1338
1339
|
const firstGrapheme = graphemes[0];
|
|
1339
1340
|
const graphemeLength = firstGrapheme ? firstGrapheme.segment.length : 1;
|
|
1340
1341
|
const before = currentLine.slice(0, this.state.cursorCol);
|
|
@@ -1389,7 +1390,7 @@ export class Editor {
|
|
|
1389
1390
|
}
|
|
1390
1391
|
else {
|
|
1391
1392
|
// Line needs wrapping - use word-aware wrapping
|
|
1392
|
-
const chunks = wordWrapLine(line, width, [...this.segment(line)]);
|
|
1393
|
+
const chunks = wordWrapLine(line, width, [...this.segment(line, "grapheme")]);
|
|
1393
1394
|
for (const chunk of chunks) {
|
|
1394
1395
|
visualLines.push({
|
|
1395
1396
|
logicalLine: i,
|
|
@@ -1441,7 +1442,7 @@ export class Editor {
|
|
|
1441
1442
|
// Moving right - move by one grapheme (handles emojis, combining characters, etc.)
|
|
1442
1443
|
if (this.state.cursorCol < currentLine.length) {
|
|
1443
1444
|
const afterCursor = currentLine.slice(this.state.cursorCol);
|
|
1444
|
-
const graphemes = [...this.segment(afterCursor)];
|
|
1445
|
+
const graphemes = [...this.segment(afterCursor, "grapheme")];
|
|
1445
1446
|
const firstGrapheme = graphemes[0];
|
|
1446
1447
|
this.setCursorCol(this.state.cursorCol + (firstGrapheme ? firstGrapheme.segment.length : 1));
|
|
1447
1448
|
}
|
|
@@ -1462,7 +1463,7 @@ export class Editor {
|
|
|
1462
1463
|
// Moving left - move by one grapheme (handles emojis, combining characters, etc.)
|
|
1463
1464
|
if (this.state.cursorCol > 0) {
|
|
1464
1465
|
const beforeCursor = currentLine.slice(0, this.state.cursorCol);
|
|
1465
|
-
const graphemes = [...this.segment(beforeCursor)];
|
|
1466
|
+
const graphemes = [...this.segment(beforeCursor, "grapheme")];
|
|
1466
1467
|
const lastGrapheme = graphemes[graphemes.length - 1];
|
|
1467
1468
|
this.setCursorCol(this.state.cursorCol - (lastGrapheme ? lastGrapheme.segment.length : 1));
|
|
1468
1469
|
}
|
|
@@ -1501,35 +1502,27 @@ export class Editor {
|
|
|
1501
1502
|
return;
|
|
1502
1503
|
}
|
|
1503
1504
|
const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
|
|
1504
|
-
const
|
|
1505
|
+
const segments = [...this.segment(textBeforeCursor, "word")];
|
|
1505
1506
|
let newCol = this.state.cursorCol;
|
|
1506
1507
|
// Skip trailing whitespace
|
|
1507
|
-
while (
|
|
1508
|
-
!isPasteMarker(
|
|
1509
|
-
isWhitespaceChar(
|
|
1510
|
-
newCol -=
|
|
1511
|
-
}
|
|
1512
|
-
if (
|
|
1513
|
-
const
|
|
1514
|
-
if (isPasteMarker(
|
|
1515
|
-
//
|
|
1516
|
-
newCol -=
|
|
1517
|
-
}
|
|
1518
|
-
else if (isPunctuationChar(lastGrapheme)) {
|
|
1519
|
-
// Skip punctuation run
|
|
1520
|
-
while (graphemes.length > 0 &&
|
|
1521
|
-
isPunctuationChar(graphemes[graphemes.length - 1]?.segment || "") &&
|
|
1522
|
-
!isPasteMarker(graphemes[graphemes.length - 1]?.segment || "")) {
|
|
1523
|
-
newCol -= graphemes.pop()?.segment.length || 0;
|
|
1524
|
-
}
|
|
1508
|
+
while (segments.length > 0 &&
|
|
1509
|
+
!isPasteMarker(segments[segments.length - 1]?.segment || "") &&
|
|
1510
|
+
isWhitespaceChar(segments[segments.length - 1]?.segment || "")) {
|
|
1511
|
+
newCol -= segments.pop()?.segment.length || 0;
|
|
1512
|
+
}
|
|
1513
|
+
if (segments.length > 0) {
|
|
1514
|
+
const last = segments[segments.length - 1];
|
|
1515
|
+
if (isPasteMarker(last.segment) || last.isWordLike) {
|
|
1516
|
+
// Skip one word-like segment (or paste marker)
|
|
1517
|
+
newCol -= segments.pop()?.segment.length || 0;
|
|
1525
1518
|
}
|
|
1526
1519
|
else {
|
|
1527
|
-
// Skip word run
|
|
1528
|
-
while (
|
|
1529
|
-
!
|
|
1530
|
-
!
|
|
1531
|
-
!
|
|
1532
|
-
newCol -=
|
|
1520
|
+
// Skip non-word non-whitespace run (punctuation)
|
|
1521
|
+
while (segments.length > 0 &&
|
|
1522
|
+
!isPasteMarker(segments[segments.length - 1]?.segment || "") &&
|
|
1523
|
+
!segments[segments.length - 1]?.isWordLike &&
|
|
1524
|
+
!isWhitespaceChar(segments[segments.length - 1]?.segment || "")) {
|
|
1525
|
+
newCol -= segments.pop()?.segment.length || 0;
|
|
1533
1526
|
}
|
|
1534
1527
|
}
|
|
1535
1528
|
}
|
|
@@ -1691,7 +1684,7 @@ export class Editor {
|
|
|
1691
1684
|
return;
|
|
1692
1685
|
}
|
|
1693
1686
|
const textAfterCursor = currentLine.slice(this.state.cursorCol);
|
|
1694
|
-
const segments = this.segment(textAfterCursor);
|
|
1687
|
+
const segments = this.segment(textAfterCursor, "word");
|
|
1695
1688
|
const iterator = segments[Symbol.iterator]();
|
|
1696
1689
|
let next = iterator.next();
|
|
1697
1690
|
let newCol = this.state.cursorCol;
|
|
@@ -1701,24 +1694,16 @@ export class Editor {
|
|
|
1701
1694
|
next = iterator.next();
|
|
1702
1695
|
}
|
|
1703
1696
|
if (!next.done) {
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
newCol += firstGrapheme.length;
|
|
1708
|
-
}
|
|
1709
|
-
else if (isPunctuationChar(firstGrapheme)) {
|
|
1710
|
-
// Skip punctuation run
|
|
1711
|
-
while (!next.done && isPunctuationChar(next.value.segment) && !isPasteMarker(next.value.segment)) {
|
|
1712
|
-
newCol += next.value.segment.length;
|
|
1713
|
-
next = iterator.next();
|
|
1714
|
-
}
|
|
1697
|
+
if (isPasteMarker(next.value.segment) || next.value.isWordLike) {
|
|
1698
|
+
// Skip one word-like segment (or paste marker)
|
|
1699
|
+
newCol += next.value.segment.length;
|
|
1715
1700
|
}
|
|
1716
1701
|
else {
|
|
1717
|
-
// Skip word run
|
|
1702
|
+
// Skip non-word non-whitespace run (punctuation)
|
|
1718
1703
|
while (!next.done &&
|
|
1719
|
-
!
|
|
1720
|
-
!
|
|
1721
|
-
!
|
|
1704
|
+
!isPasteMarker(next.value.segment) &&
|
|
1705
|
+
!next.value.isWordLike &&
|
|
1706
|
+
!isWhitespaceChar(next.value.segment)) {
|
|
1722
1707
|
newCol += next.value.segment.length;
|
|
1723
1708
|
next = iterator.next();
|
|
1724
1709
|
}
|