@causyne/agent 1.20.86 → 1.20.87
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/package.json +1 -1
- package/src/tui/scrollInteraction.js +6 -4
- package/src/tui/scrollInteraction.ts +7 -4
- package/src/tui/stageSurface.js +6 -4
- package/src/tui/turnRail.js +21 -11
- package/src/tui/turnRail.ts +19 -11
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// preventing terminal scrollback desync and UI freezes.
|
|
8
8
|
// 4. Scrollbar (rail) mouse interactions clamp cleanly even if clicked above or
|
|
9
9
|
// below the chat box bounds.
|
|
10
|
+
import { sessionMainWidth } from './sessionSidebar.js';
|
|
10
11
|
/**
|
|
11
12
|
* Adaptive Wheel Dampener & Momentum Controller.
|
|
12
13
|
*
|
|
@@ -148,12 +149,13 @@ export function handleScrollbarMouse(key, viewport, surface, host) {
|
|
|
148
149
|
const stageTop = Math.max(0, termRows - stageH);
|
|
149
150
|
const viewportH = viewport.height;
|
|
150
151
|
const stageW = typeof surface.stage?.width === 'function' ? surface.stage.width() : (surface.width || 80);
|
|
151
|
-
const
|
|
152
|
-
const
|
|
152
|
+
const mainW = sessionMainWidth(stageW);
|
|
153
|
+
const hasRail = typeof surface.railEnabled === 'function' ? surface.railEnabled(mainW) : true;
|
|
154
|
+
const contentW = hasRail ? Math.max(20, mainW - 3) : mainW;
|
|
153
155
|
const mouseX = key.mouse.x;
|
|
154
156
|
const mouseY = key.mouse.y;
|
|
155
|
-
// Rail occupies column contentW - 1 through
|
|
156
|
-
const isRailColumn = mouseX >= contentW - 1 && mouseX <=
|
|
157
|
+
// Rail occupies column contentW - 1 through mainW
|
|
158
|
+
const isRailColumn = mouseX >= contentW - 1 && mouseX <= mainW;
|
|
157
159
|
if (isRailColumn) {
|
|
158
160
|
// Auto-heal if detached
|
|
159
161
|
if (typeof surface.captureMouse === 'function' && surface.detached) {
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
// 4. Scrollbar (rail) mouse interactions clamp cleanly even if clicked above or
|
|
9
9
|
// below the chat box bounds.
|
|
10
10
|
|
|
11
|
+
import { sessionMainWidth } from './sessionSidebar.js';
|
|
12
|
+
|
|
11
13
|
export interface MouseCoordinate {
|
|
12
14
|
x: number;
|
|
13
15
|
y: number;
|
|
@@ -255,14 +257,15 @@ export function handleScrollbarMouse(
|
|
|
255
257
|
const stageTop = Math.max(0, termRows - stageH);
|
|
256
258
|
const viewportH = viewport.height;
|
|
257
259
|
const stageW = typeof surface.stage?.width === 'function' ? surface.stage.width() : (surface.width || 80);
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
+
const mainW = sessionMainWidth(stageW);
|
|
261
|
+
const hasRail = typeof surface.railEnabled === 'function' ? surface.railEnabled(mainW) : true;
|
|
262
|
+
const contentW = hasRail ? Math.max(20, mainW - 3) : mainW;
|
|
260
263
|
|
|
261
264
|
const mouseX = key.mouse.x;
|
|
262
265
|
const mouseY = key.mouse.y;
|
|
263
266
|
|
|
264
|
-
// Rail occupies column contentW - 1 through
|
|
265
|
-
const isRailColumn = mouseX >= contentW - 1 && mouseX <=
|
|
267
|
+
// Rail occupies column contentW - 1 through mainW
|
|
268
|
+
const isRailColumn = mouseX >= contentW - 1 && mouseX <= mainW;
|
|
266
269
|
|
|
267
270
|
if (isRailColumn) {
|
|
268
271
|
// Auto-heal if detached
|
package/src/tui/stageSurface.js
CHANGED
|
@@ -29,7 +29,7 @@ import { markHoveredMessage } from './messageInteraction.js';
|
|
|
29
29
|
import { placeMessageActionPanel } from './messageActionPlacement.js';
|
|
30
30
|
import { mouseTracking } from './keys.js';
|
|
31
31
|
import { mouseHoverTracking } from './mouseHover.js';
|
|
32
|
-
import { truncate, padEnd, visibleWidth } from './text.js';
|
|
32
|
+
import { truncate, padEnd, visibleWidth, stripAnsi } from './text.js';
|
|
33
33
|
import { composerWidth } from './layout.js';
|
|
34
34
|
import { placeHome, placeDialog } from './homeView.js';
|
|
35
35
|
import { sidebarVisible, sessionMainWidth, sessionComposerWidth, sessionSidebarRows, joinSessionSidebar } from './sessionSidebar.js';
|
|
@@ -727,9 +727,11 @@ export class StageSurface {
|
|
|
727
727
|
let row = rows[i] || '';
|
|
728
728
|
if (hasTurns && railResult) {
|
|
729
729
|
const leftCell = railResult.cells[i] || ' ';
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
730
|
+
const leadMatch = row.match(/^((?:\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_])*)[ ]{3}/);
|
|
731
|
+
if (leadMatch) {
|
|
732
|
+
const leadEscapes = leadMatch[1] || '';
|
|
733
|
+
row = `${leadEscapes} ${leftCell} ${row.slice(leadMatch[0].length)}`;
|
|
734
|
+
} else if (stripAnsi(row).length === 0) {
|
|
733
735
|
row = leftCell !== ' ' ? ` ${leftCell} ` : '';
|
|
734
736
|
} else {
|
|
735
737
|
row = ` ${leftCell} ${row}`;
|
package/src/tui/turnRail.js
CHANGED
|
@@ -347,11 +347,20 @@ export function overlayTurnPreviewCard(viewportRows, cardRows, anchorY, railX, s
|
|
|
347
347
|
if (x <= 6 && railX <= 4) {
|
|
348
348
|
const plainBase = stripAnsi(baseRow);
|
|
349
349
|
const dotChar = plainBase[railX] || ' ';
|
|
350
|
-
const isDot = dotChar === '●' || dotChar === '•' || dotChar === '·'
|
|
350
|
+
const isDot = dotChar === '●' || dotChar === '•' || dotChar === '·';
|
|
351
351
|
let dotCell = ' ';
|
|
352
352
|
if (isDot) {
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
if (dotChar === '●') {
|
|
354
|
+
dotCell = baseRow.includes('230;235;245m')
|
|
355
|
+
? '\x1b[1m\x1b[38;2;230;235;245m●\x1b[0m'
|
|
356
|
+
: '\x1b[1m\x1b[38;2;250;250;250m●\x1b[0m';
|
|
357
|
+
}
|
|
358
|
+
else if (dotChar === '•') {
|
|
359
|
+
dotCell = '\x1b[38;2;115;115;120m•\x1b[0m';
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
dotCell = dotChar;
|
|
363
|
+
}
|
|
355
364
|
}
|
|
356
365
|
const leadingSpace = ' '.repeat(Math.max(0, railX));
|
|
357
366
|
const trailingSpace = ' '.repeat(Math.max(0, x - railX - 1));
|
|
@@ -362,11 +371,12 @@ export function overlayTurnPreviewCard(viewportRows, cardRows, anchorY, railX, s
|
|
|
362
371
|
}
|
|
363
372
|
let restOfRow = '';
|
|
364
373
|
if (x <= 6) {
|
|
365
|
-
// For left-placed turn cards,
|
|
366
|
-
const
|
|
367
|
-
const rightCell = sliceFromColumn(baseRow,
|
|
374
|
+
// For left-placed turn cards, preserve the right overview rail without severed text leaks
|
|
375
|
+
const rowLen = visibleWidth(baseRow);
|
|
376
|
+
const rightCell = rowLen > 0 ? sliceFromColumn(baseRow, rowLen - 1) : ' ';
|
|
368
377
|
const rightCellWidth = visibleWidth(rightCell);
|
|
369
|
-
const
|
|
378
|
+
const targetWidth = Math.max(screenWidth, rowLen);
|
|
379
|
+
const gap = Math.max(0, targetWidth - x - cardWidth - rightCellWidth);
|
|
370
380
|
restOfRow = `${' '.repeat(gap)}${rightCell}`;
|
|
371
381
|
}
|
|
372
382
|
else {
|
|
@@ -391,10 +401,10 @@ export function handleTurnRailMouse(event, surface, host) {
|
|
|
391
401
|
const mouseY = event.mouse.y;
|
|
392
402
|
const stageTop = layout.stageTop ?? 0;
|
|
393
403
|
const relY = mouseY - stageTop;
|
|
394
|
-
// Rail hit box: if railX <=
|
|
395
|
-
const isRail = layout.railX <=
|
|
396
|
-
? (mouseX >= 0 && mouseX <= Math.max(
|
|
397
|
-
: (mouseX >= layout.railX -
|
|
404
|
+
// Rail hit box: if railX <= 4, check columns 0..5 (left margin); otherwise check [railX - 2, railX + 3]
|
|
405
|
+
const isRail = layout.railX <= 4
|
|
406
|
+
? (mouseX >= 0 && mouseX <= Math.max(5, layout.railX + 3))
|
|
407
|
+
: (mouseX >= layout.railX - 2 && mouseX <= layout.railX + 3);
|
|
398
408
|
// Check if currently showing a card and mouse is hovering over the card or bridge tunnel
|
|
399
409
|
const hasActiveCard = surface.hoveredTurnIndex !== null && surface.hoveredTurnIndex !== undefined;
|
|
400
410
|
let isCard = false;
|
package/src/tui/turnRail.ts
CHANGED
|
@@ -432,11 +432,18 @@ export function overlayTurnPreviewCard(
|
|
|
432
432
|
if (x <= 6 && railX <= 4) {
|
|
433
433
|
const plainBase = stripAnsi(baseRow);
|
|
434
434
|
const dotChar = plainBase[railX] || ' ';
|
|
435
|
-
const isDot = dotChar === '●' || dotChar === '•' || dotChar === '·'
|
|
435
|
+
const isDot = dotChar === '●' || dotChar === '•' || dotChar === '·';
|
|
436
436
|
let dotCell = ' ';
|
|
437
437
|
if (isDot) {
|
|
438
|
-
|
|
439
|
-
|
|
438
|
+
if (dotChar === '●') {
|
|
439
|
+
dotCell = baseRow.includes('230;235;245m')
|
|
440
|
+
? '\x1b[1m\x1b[38;2;230;235;245m●\x1b[0m'
|
|
441
|
+
: '\x1b[1m\x1b[38;2;250;250;250m●\x1b[0m';
|
|
442
|
+
} else if (dotChar === '•') {
|
|
443
|
+
dotCell = '\x1b[38;2;115;115;120m•\x1b[0m';
|
|
444
|
+
} else {
|
|
445
|
+
dotCell = dotChar;
|
|
446
|
+
}
|
|
440
447
|
}
|
|
441
448
|
const leadingSpace = ' '.repeat(Math.max(0, railX));
|
|
442
449
|
const trailingSpace = ' '.repeat(Math.max(0, x - railX - 1));
|
|
@@ -447,11 +454,12 @@ export function overlayTurnPreviewCard(
|
|
|
447
454
|
|
|
448
455
|
let restOfRow = '';
|
|
449
456
|
if (x <= 6) {
|
|
450
|
-
// For left-placed turn cards,
|
|
451
|
-
const
|
|
452
|
-
const rightCell = sliceFromColumn(baseRow,
|
|
457
|
+
// For left-placed turn cards, preserve the right overview rail without severed text leaks
|
|
458
|
+
const rowLen = visibleWidth(baseRow);
|
|
459
|
+
const rightCell = rowLen > 0 ? sliceFromColumn(baseRow, rowLen - 1) : ' ';
|
|
453
460
|
const rightCellWidth = visibleWidth(rightCell);
|
|
454
|
-
const
|
|
461
|
+
const targetWidth = Math.max(screenWidth, rowLen);
|
|
462
|
+
const gap = Math.max(0, targetWidth - x - cardWidth - rightCellWidth);
|
|
455
463
|
restOfRow = `${' '.repeat(gap)}${rightCell}`;
|
|
456
464
|
} else {
|
|
457
465
|
restOfRow = sliceFromColumn(baseRow, x + cardWidth);
|
|
@@ -482,10 +490,10 @@ export function handleTurnRailMouse(
|
|
|
482
490
|
const stageTop = layout.stageTop ?? 0;
|
|
483
491
|
const relY = mouseY - stageTop;
|
|
484
492
|
|
|
485
|
-
// Rail hit box: if railX <=
|
|
486
|
-
const isRail = layout.railX <=
|
|
487
|
-
? (mouseX >= 0 && mouseX <= Math.max(
|
|
488
|
-
: (mouseX >= layout.railX -
|
|
493
|
+
// Rail hit box: if railX <= 4, check columns 0..5 (left margin); otherwise check [railX - 2, railX + 3]
|
|
494
|
+
const isRail = layout.railX <= 4
|
|
495
|
+
? (mouseX >= 0 && mouseX <= Math.max(5, layout.railX + 3))
|
|
496
|
+
: (mouseX >= layout.railX - 2 && mouseX <= layout.railX + 3);
|
|
489
497
|
|
|
490
498
|
// Check if currently showing a card and mouse is hovering over the card or bridge tunnel
|
|
491
499
|
const hasActiveCard = surface.hoveredTurnIndex !== null && surface.hoveredTurnIndex !== undefined;
|