@zhuxixi/pi-agent-board 0.13.1 → 0.14.0
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 +51 -0
- package/README.md +15 -8
- package/docs/SECTION_FOLDING.md +53 -0
- package/docs/superpowers/plans/2026-10-23-issue-222-attach-ready.md +290 -0
- package/docs/superpowers/plans/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup.md +256 -0
- package/docs/superpowers/plans/2026-11-03-cwd-favorites-full-pool.md +266 -0
- package/docs/superpowers/plans/2026-11-03-issue-266-alt-h-detach.md +467 -0
- package/docs/superpowers/plans/2026-11-04-issue-270-scenario-stdout-flush.md +584 -0
- package/docs/superpowers/plans/2026-11-05-issue-278-ctrl-g-external-editor.md +381 -0
- package/docs/superpowers/plans/2026-11-06-issue-280-frame-witness-delivery.md +430 -0
- package/docs/superpowers/plans/2026-11-07-issue-284-attach-recovery.md +115 -0
- package/docs/superpowers/plans/2026-11-07-issue-284-u1-u2-trial-guide.md +39 -0
- package/docs/superpowers/plans/2026-11-08-host-restart-model-override.md +894 -0
- package/docs/superpowers/plans/2026-11-08-issue-288-cap-floor.md +51 -0
- package/docs/superpowers/plans/2026-11-09-dashboard-fold-flake.md +166 -0
- package/docs/superpowers/plans/2026-11-09-issue-273-harness-console-log-exit.md +369 -0
- package/docs/superpowers/plans/2026-11-10-issue-258-board-selection-settle.md +760 -0
- package/docs/superpowers/plans/2026-11-13-issue-294-snapshot-resize-intent.md +590 -0
- package/docs/superpowers/plans/2026-11-16-greeting-title-poll.md +838 -0
- package/docs/superpowers/plans/2026-11-22-issue-297-compaction-mirror.md +797 -0
- package/docs/superpowers/plans/2026-11-23-issue-254-cursor-keep-position.md +663 -0
- package/docs/superpowers/plans/2026-11-23-issue-95-legacy-quarantine.md +320 -0
- package/docs/superpowers/specs/2026-10-23-issue-222-attach-ready-design.md +204 -0
- package/docs/superpowers/specs/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup-design.md +197 -0
- package/docs/superpowers/specs/2026-11-03-cwd-favorites-full-pool-design.md +106 -0
- package/docs/superpowers/specs/2026-11-03-issue-266-alt-h-detach-design.md +185 -0
- package/docs/superpowers/specs/2026-11-04-issue-270-scenario-stdout-flush-design.md +176 -0
- package/docs/superpowers/specs/2026-11-05-issue-278-ctrl-g-external-editor-design.md +185 -0
- package/docs/superpowers/specs/2026-11-07-issue-284-attach-recovery-design.md +166 -0
- package/docs/superpowers/specs/2026-11-08-host-restart-model-override-design.md +115 -0
- package/docs/superpowers/specs/2026-11-08-issue-288-cap-floor-design.md +86 -0
- package/docs/superpowers/specs/2026-11-09-dashboard-fold-flake-design.md +109 -0
- package/docs/superpowers/specs/2026-11-09-issue-273-harness-console-log-exit-design.md +182 -0
- package/docs/superpowers/specs/2026-11-10-issue-258-board-selection-settle-design.md +109 -0
- package/docs/superpowers/specs/2026-11-13-issue-294-snapshot-resize-intent-design.md +141 -0
- package/docs/superpowers/specs/2026-11-16-greeting-title-poll-design.md +174 -0
- package/docs/superpowers/specs/2026-11-22-issue-297-compaction-mirror-design.md +158 -0
- package/docs/superpowers/specs/2026-11-22-issue-95-legacy-quarantine-design.md +209 -0
- package/docs/superpowers/specs/2026-11-23-issue-254-cursor-keep-position-design.md +201 -0
- package/package.json +1 -1
- package/runner/pty-runner.mjs +526 -63
- package/runner/title-runner.mjs +33 -24
- package/src/commands/agent-board.ts +5 -1
- package/src/core/attach-detach.mjs +27 -0
- package/src/core/attach-frame-proof.mjs +897 -0
- package/src/core/attach-frame-reporter.mjs +738 -0
- package/src/core/attach-frame-stream.mjs +266 -0
- package/src/core/attach-pr-label.mjs +12 -0
- package/src/core/attach-recovery.mjs +239 -0
- package/src/core/attach-screen-owner.mjs +55 -0
- package/src/core/attach-view-proof.mjs +709 -0
- package/src/core/auto-state.mjs +6 -1
- package/src/core/cwd-stats.mjs +3 -1
- package/src/core/dashboard-prefs.mjs +31 -0
- package/src/core/derive.mjs +8 -1
- package/src/core/events.mjs +127 -1
- package/src/core/foreground-projection-cache.mjs +1 -0
- package/src/core/frame-witness-update.mjs +35 -0
- package/src/core/fullscreen-selection.mjs +60 -0
- package/src/core/host-protocol.mjs +13 -2
- package/src/core/hosted-frame-witness.mjs +60 -0
- package/src/core/paths.mjs +10 -3
- package/src/core/pty-attach-render.mjs +239 -0
- package/src/core/pty-kitty-images.mjs +237 -0
- package/src/core/rows.mjs +43 -7
- package/src/core/session-entries.mjs +82 -0
- package/src/core/session-launch-prefs.mjs +45 -0
- package/src/core/session-view.mjs +3 -63
- package/src/core/store.mjs +1 -0
- package/src/core/terminal-attach-client.mjs +199 -20
- package/src/core/terminal-attach-protocol.mjs +221 -7
- package/src/core/terminal-model.mjs +24 -3
- package/src/core/terminal-snapshot.mjs +10 -0
- package/src/core/title-flow.mjs +66 -0
- package/src/core/title.mjs +101 -0
- package/src/core/types.mjs +17 -0
- package/src/index.ts +85 -0
- package/src/runtime/service.mjs +87 -18
- package/src/ui/dashboard.ts +198 -44
- package/src/ui/pty-attach.ts +1462 -117
package/runner/title-runner.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Detached title-runner shim
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Detached title-runner shim (issue #295): non-greeting prompts generate a
|
|
4
|
+
* title immediately (previous behavior); greeting prompts poll the session
|
|
5
|
+
* file for the first substantive user message. Best-effort only — the manual
|
|
6
|
+
* rename always wins. All orchestration lives in src/core/title-flow.mjs.
|
|
7
7
|
*/
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
10
|
import { readJson } from "../src/core/atomic.mjs";
|
|
10
11
|
import { readMeta, writeMeta } from "../src/core/store.mjs";
|
|
11
|
-
import {
|
|
12
|
+
import { runTitleFlow } from "../src/core/title-flow.mjs";
|
|
13
|
+
import { resolveTitleSettings, titlePrompt } from "../src/core/title.mjs";
|
|
12
14
|
|
|
13
15
|
function main() {
|
|
14
16
|
const configPath = process.argv[2];
|
|
@@ -17,29 +19,36 @@ function main() {
|
|
|
17
19
|
const config = readJson(configPath, null);
|
|
18
20
|
if (!config?.viewId || !config.prompt) process.exit(2);
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
const settings = resolveTitleSettings(process.env, config.model);
|
|
23
|
+
if (!settings.enabled) return;
|
|
24
|
+
|
|
25
|
+
runTitleFlow(config, realDeps(config, settings))
|
|
21
26
|
.catch(() => {})
|
|
22
27
|
.finally(() => process.exit(0));
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @param {import("../src/core/types.mjs").TitleConfig} config
|
|
32
|
+
* @param {{ enabled: boolean, model: string, thinking: string }} settings
|
|
33
|
+
*/
|
|
34
|
+
function realDeps(config, settings) {
|
|
35
|
+
return {
|
|
36
|
+
now: () => Date.now(),
|
|
37
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
38
|
+
readMeta: (root, viewId) => readMeta(root, viewId),
|
|
39
|
+
commitMeta: (meta) => writeMeta(config.root, meta),
|
|
40
|
+
readSessionText: () => {
|
|
41
|
+
const meta = readMeta(config.root, config.viewId);
|
|
42
|
+
if (!meta?.sessionFile) return null;
|
|
43
|
+
return existsSync(meta.sessionFile) ? readFileSync(meta.sessionFile, "utf8") : null;
|
|
44
|
+
},
|
|
45
|
+
runOneShot: (prompt) => {
|
|
46
|
+
const args = [...(config.piArgsPrefix ?? []), "--mode", "json", "-p", "--no-session", "--model", settings.model];
|
|
47
|
+
if (settings.thinking && settings.thinking !== "off") args.push("--thinking", settings.thinking);
|
|
48
|
+
args.push(titlePrompt(prompt));
|
|
49
|
+
return runOneShot(config.piCommand, args, 15000);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
function runOneShot(command, args, timeoutMs = 20000) {
|
|
@@ -15,6 +15,7 @@ import { screenLogPath } from "../core/paths.mjs";
|
|
|
15
15
|
import { appendDiagnostic } from "../core/diagnostics.mjs";
|
|
16
16
|
import { DashboardComponent, type DashboardResult } from "../ui/dashboard.ts";
|
|
17
17
|
import { PtyAttachComponent, type PtyAttachResult } from "../ui/pty-attach.ts";
|
|
18
|
+
import { attachPrLabel } from "../core/attach-pr-label.mjs";
|
|
18
19
|
|
|
19
20
|
const POLL_MS = 700;
|
|
20
21
|
|
|
@@ -199,7 +200,8 @@ async function attach(
|
|
|
199
200
|
const plan = planAttachResolved(await service.resolveAttachTarget(viewId));
|
|
200
201
|
if (plan.plan === "open-pty") {
|
|
201
202
|
void service.markVisited?.(viewId)?.catch(() => {});
|
|
202
|
-
const
|
|
203
|
+
const latest = service.row(viewId) ?? row;
|
|
204
|
+
const result = await openPtyAttach(ctx, root, row.meta.id, row.meta.name, plan.socketPath, attachPrLabel(latest.codeRefs));
|
|
203
205
|
void service.markVisited?.(viewId)?.catch(() => {});
|
|
204
206
|
if (result.action === "delete") {
|
|
205
207
|
// Issue #147: the component already tore down and exited — archive
|
|
@@ -254,6 +256,7 @@ async function openPtyAttach(
|
|
|
254
256
|
viewId: string,
|
|
255
257
|
name: string,
|
|
256
258
|
socketPath: string,
|
|
259
|
+
prLabel: string,
|
|
257
260
|
): Promise<PtyAttachResult> {
|
|
258
261
|
ctx.ui.setWorkingVisible(false);
|
|
259
262
|
ctx.ui.setHeader(() => ({ render: () => [], invalidate() {} }));
|
|
@@ -266,6 +269,7 @@ async function openPtyAttach(
|
|
|
266
269
|
socketPath,
|
|
267
270
|
screenLogPath: root ? screenLogPath(root, viewId) : undefined,
|
|
268
271
|
title: name,
|
|
272
|
+
prLabel,
|
|
269
273
|
onDiagnostic: root
|
|
270
274
|
? (event) => {
|
|
271
275
|
// Best effort, like every other diagnostics writer.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Key, matchesKey } from "@earendil-works/pi-tui";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Issue #266: the attach view's unconditional detach chords. Pure — no
|
|
5
|
+
* component state, no socket, no editor cache: a chord is exit intent or it is
|
|
6
|
+
* forwarded. Callers must run the #147 delete-confirm resolver first, so an
|
|
7
|
+
* armed confirm still cancels before the chord closes the surface.
|
|
8
|
+
*
|
|
9
|
+
* - `ctrl+\` (raw 0x1c) — the terminal-independent escape (issue #126): one raw
|
|
10
|
+
* ASCII byte every terminal forwards unchanged in raw mode; the kitty CSI-u
|
|
11
|
+
* and modifyOtherKeys encodings of the same chord match too.
|
|
12
|
+
* - `ctrl+left` — unambiguous intent while a draft sits in the editor
|
|
13
|
+
* (issue #89); a single ← stays gated on the pushed editorEmpty channel.
|
|
14
|
+
* - `alt+h` — vim's h is "left" (issue #266). The bare letter must keep
|
|
15
|
+
* reaching the child editor, so the chord is the modified key; a segment
|
|
16
|
+
* that coalesces the chord with other bytes does not match and is forwarded
|
|
17
|
+
* unchanged.
|
|
18
|
+
* @param {string} data one key segment from splitAttachInput
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
21
|
+
export function resolveAttachDetachChord(data) {
|
|
22
|
+
return (
|
|
23
|
+
matchesKey(data, "ctrl+\\") ||
|
|
24
|
+
matchesKey(data, Key.ctrl("left")) ||
|
|
25
|
+
matchesKey(data, Key.alt("h"))
|
|
26
|
+
);
|
|
27
|
+
}
|