@zhuxixi/pi-agent-board 0.13.0 → 0.13.1
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 +14 -0
- package/README.md +22 -4
- package/docs/superpowers/plans/2026-10-26-issue-245-key-hints-doc-sync.md +244 -0
- package/docs/superpowers/plans/2026-10-27-issue-172-fullscreen-selection-clear.md +344 -0
- package/docs/superpowers/plans/2026-10-27-issue-252-select-key-hints.md +209 -0
- package/docs/superpowers/plans/2026-10-28-issue-255-coordinator-endpoint-zombie.md +442 -0
- package/docs/superpowers/specs/2026-10-26-issue-245-key-hints-doc-sync-design.md +72 -0
- package/docs/superpowers/specs/2026-10-27-issue-172-fullscreen-selection-clear-design.md +248 -0
- package/docs/superpowers/specs/2026-10-27-issue-252-select-key-hints-design.md +95 -0
- package/docs/superpowers/specs/2026-10-28-issue-255-coordinator-endpoint-zombie-design.md +380 -0
- package/package.json +1 -1
- package/runner/state-coordinator.mjs +62 -5
- package/src/core/host-coordination.mjs +48 -0
- package/src/core/pty-scroll.mjs +8 -8
- package/src/ui/dashboard.ts +8 -5
- package/src/ui/pty-attach.ts +43 -15
package/src/ui/pty-attach.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { createJiggleRetryController } from "../core/pty-attach-jiggle-controlle
|
|
|
14
14
|
import { createTerminalAttachClient } from "../core/terminal-attach-client.mjs";
|
|
15
15
|
import { backgroundRgbFromTerminalColors, buildSettleSchemePatch, colorSchemeForBackgroundRgb, extractOscQuerySequences, resolveProbeApi, toColorSchemeReport } from "../core/terminal-query-sequences.mjs";
|
|
16
16
|
import { REPLY_GUARD_WINDOW_MS, createReplyGuard, isReplyGuardEnabled } from "../core/terminal-reply-guard.mjs";
|
|
17
|
-
import { clampInt, encodeWheelReport, fullscreenMouseEnableSequence, historyFloorAfterHydrate, resolveAttachMouseAction, resolveAttachWheelRoute, resolvePasteSelectionSource, resolveWheelLines, sameMousePoint, scrollableHistoryLines, scrollViewportTop, selectionDragScrollLines, selectionReleaseIsDrag,
|
|
17
|
+
import { clampInt, encodeWheelReport, fullscreenMouseEnableSequence, historyFloorAfterHydrate, isFullscreenSelectionEnd, resolveAttachMouseAction, resolveAttachWheelRoute, resolvePasteSelectionSource, resolveWheelLines, sameMousePoint, scrollableHistoryLines, scrollViewportTop, selectionDragScrollLines, selectionReleaseIsDrag, shouldOwnOuterMouseMode, splitAttachInput, wheelScrollLinesUp } from "../core/pty-scroll.mjs";
|
|
18
18
|
|
|
19
19
|
export type PtyAttachResult = { action: "detached" } | { action: "closed"; exitCode?: number | null } | { action: "delete" };
|
|
20
20
|
|
|
@@ -23,6 +23,16 @@ type ThemeLike = {
|
|
|
23
23
|
bold(text: string): string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/** The pi-tui members the attach view reads without a public typing contract:
|
|
27
|
+
* getActiveSelectionText / clearTextSelection are private in TuiAltScreen's d.ts
|
|
28
|
+
* (runtime-reachable plain methods), getCopyOnSelect is public. Every access is
|
|
29
|
+
* feature-detected so an older or newer pi-tui degrades instead of throwing. */
|
|
30
|
+
interface FullscreenSelectionHost {
|
|
31
|
+
getActiveSelectionText?: () => string | undefined;
|
|
32
|
+
getCopyOnSelect?: () => boolean;
|
|
33
|
+
clearTextSelection?: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
/** Diagnostic patch emitted at attach settle (DiagnosticEvent-compatible; built by buildSettleSchemePatch). */
|
|
27
37
|
export interface AttachSettleDiagnosticPatch {
|
|
28
38
|
source: string;
|
|
@@ -239,6 +249,9 @@ export class PtyAttachComponent implements Component {
|
|
|
239
249
|
/** Injectable clock for desync gating (tests override this). */
|
|
240
250
|
private nowFn: () => number = () => Date.now();
|
|
241
251
|
private selection: MouseSelection | null = null;
|
|
252
|
+
/** Issue #172: bumped on every left press so a settle still queued for the previous
|
|
253
|
+
* gesture cannot read or clear a selection the next press has already started. */
|
|
254
|
+
private selectionGestureSerial = 0;
|
|
242
255
|
private selectionDragging = false;
|
|
243
256
|
private selectionAutoScrollTimer: ReturnType<typeof setInterval> | null = null;
|
|
244
257
|
private selectionAutoScrollLines = 0;
|
|
@@ -520,11 +533,19 @@ export class PtyAttachComponent implements Component {
|
|
|
520
533
|
return { handled: true, render: false };
|
|
521
534
|
}
|
|
522
535
|
const nativePasteEnabled = process.env.AGENT_BOARD_ATTACH_NATIVE_PASTE !== "0";
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
536
|
+
// Issue #172: a press starts a new gesture. Two reports can share one stdin chunk
|
|
537
|
+
// (pi-tui emits them synchronously in a loop), so the settle queued by the previous
|
|
538
|
+
// release must not consume the selection this press just started.
|
|
539
|
+
if (event.type === "press" && event.button === "left") this.selectionGestureSerial += 1;
|
|
540
|
+
if (isFullscreenSelectionEnd(event)) {
|
|
541
|
+
// Observe only — pi's fullscreen selection keeps the event. Overlays are
|
|
542
|
+
// dispatched before TuiAltScreen finalizes (and copies) the selection for this
|
|
543
|
+
// event, so settling must run deferred (issue #174).
|
|
544
|
+
const serial = this.selectionGestureSerial;
|
|
545
|
+
process.nextTick(() => {
|
|
546
|
+
if (serial !== this.selectionGestureSerial) return;
|
|
547
|
+
this.settleFullscreenSelection(nativePasteEnabled);
|
|
548
|
+
});
|
|
528
549
|
return undefined;
|
|
529
550
|
}
|
|
530
551
|
const action = resolveAttachMouseAction(event, { nativePasteEnabled });
|
|
@@ -1367,17 +1388,24 @@ export class PtyAttachComponent implements Component {
|
|
|
1367
1388
|
}
|
|
1368
1389
|
}
|
|
1369
1390
|
|
|
1370
|
-
/** Issue #174 (B2):
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1375
|
-
*
|
|
1376
|
-
|
|
1391
|
+
/** Issue #174 (B2) + #172: a selection gesture ended inside this overlay and pi has
|
|
1392
|
+
* finalized (and copied) its selection. Mirror the text into X11 PRIMARY so
|
|
1393
|
+
* middle-click paste closes the loop, then drop pi's selection so the inverse-video
|
|
1394
|
+
* highlight does not outlive the copy. Clearing is skipped when copy-on-select is
|
|
1395
|
+
* off (the user copies later with pi's Ctrl+X) and when the pi-tui method is absent
|
|
1396
|
+
* (older/newer runtime) — both degrade to the previous behaviour instead of throwing.
|
|
1397
|
+
* clearTextSelection preserves pi's multi-click history; resetTextSelection would
|
|
1398
|
+
* clear lastClick and break double-click word / triple-click line selection. */
|
|
1399
|
+
private settleFullscreenSelection(nativePasteEnabled: boolean): void {
|
|
1377
1400
|
if (this.closed) return;
|
|
1378
|
-
const alt = this.tui as
|
|
1401
|
+
const alt = this.tui as FullscreenSelectionHost;
|
|
1379
1402
|
const text = alt.getActiveSelectionText?.();
|
|
1380
|
-
if (typeof text
|
|
1403
|
+
if (typeof text !== "string" || text.length === 0) return;
|
|
1404
|
+
if (nativePasteEnabled) this.writePrimarySelection(text);
|
|
1405
|
+
if (alt.getCopyOnSelect?.() === false) return;
|
|
1406
|
+
if (typeof alt.clearTextSelection !== "function") return;
|
|
1407
|
+
alt.clearTextSelection();
|
|
1408
|
+
this.scheduleRender();
|
|
1381
1409
|
}
|
|
1382
1410
|
|
|
1383
1411
|
/** Write `text` to the X11 PRIMARY selection so other apps can middle-click-paste it. */
|