@zhuxixi/pi-agent-board 0.5.2 → 0.6.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +41 -3
  3. package/docs/superpowers/plans/2026-09-03-code-refs-pr-backlink-narrow.md +551 -0
  4. package/docs/superpowers/plans/2026-09-04-evidence-outputpreview.md +209 -0
  5. package/docs/superpowers/plans/2026-09-04-warm-host-reclaim.md +796 -0
  6. package/docs/superpowers/plans/2026-09-05-issue-13-drainnextfollowup-pty-probe.md +114 -0
  7. package/docs/superpowers/plans/2026-09-05-issue-38-windows-wezterm-ime-cursor.md +73 -0
  8. package/docs/superpowers/plans/2026-09-05-issue-39-truncate-codepoint-boundary.md +143 -0
  9. package/docs/superpowers/plans/2026-09-05-issue-61-mention-fallback-guards.md +226 -0
  10. package/docs/superpowers/plans/2026-09-05-issue-63-flaky-manual-completion.md +87 -0
  11. package/docs/superpowers/plans/2026-09-05-issue-64-changelog-release-helper.md +53 -0
  12. package/docs/superpowers/plans/2026-09-05-pty-host-stacking-sock-race.md +731 -0
  13. package/docs/superpowers/specs/2026-08-29-code-refs-badges-design.md +1 -1
  14. package/docs/superpowers/specs/2026-09-03-code-refs-pr-backlink-narrow-design.md +92 -0
  15. package/docs/superpowers/specs/2026-09-04-evidence-outputpreview-design.md +50 -0
  16. package/docs/superpowers/specs/2026-09-04-warm-host-reclaim-design.md +106 -0
  17. package/docs/superpowers/specs/2026-09-05-issue-13-drainnextfollowup-pty-probe-design.md +64 -0
  18. package/docs/superpowers/specs/2026-09-05-issue-38-windows-wezterm-ime-design.md +48 -0
  19. package/docs/superpowers/specs/2026-09-05-issue-39-truncate-codepoint-boundary-design.md +64 -0
  20. package/docs/superpowers/specs/2026-09-05-issue-61-mention-fallback-design.md +71 -0
  21. package/docs/superpowers/specs/2026-09-05-issue-63-flaky-manual-completion-design.md +49 -0
  22. package/docs/superpowers/specs/2026-09-05-issue-64-changelog-helper-design.md +76 -0
  23. package/docs/superpowers/specs/2026-09-05-pty-host-stacking-sock-race-design.md +510 -0
  24. package/package.json +83 -81
  25. package/runner/job-runner.mjs +2 -2
  26. package/runner/pty-runner.mjs +573 -2
  27. package/runner/state-runner.mjs +3 -0
  28. package/runner/title-runner.mjs +1 -1
  29. package/scripts/release_helper.mjs +277 -0
  30. package/src/commands/agent-board.ts +38 -35
  31. package/src/commands/attach-decision.mjs +66 -0
  32. package/src/commands/attach-flow.ts +45 -39
  33. package/src/core/code-refs.mjs +85 -33
  34. package/src/core/evidence.mjs +2 -2
  35. package/src/core/heuristics.mjs +40 -2
  36. package/src/core/host-coordination.mjs +159 -0
  37. package/src/core/host-crash.mjs +43 -3
  38. package/src/core/host-probe.mjs +196 -0
  39. package/src/core/launch.mjs +3 -1
  40. package/src/core/locks.mjs +196 -1
  41. package/src/core/paths.mjs +24 -0
  42. package/src/core/store.mjs +164 -5
  43. package/src/core/types.mjs +17 -1
  44. package/src/core/warm-host-sweeper.mjs +150 -0
  45. package/src/index.ts +29 -1
  46. package/src/runtime/service.mjs +967 -109
  47. package/src/ui/dashboard-decisions.mjs +55 -0
  48. package/src/ui/dashboard.ts +26 -12
package/src/index.ts CHANGED
@@ -11,7 +11,8 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
11
11
  import { resolvePiInvocation } from "./core/invocation.mjs";
12
12
  import { controlSocketPathFor, defaultRoot } from "./core/paths.mjs";
13
13
  import { listRows } from "./core/store.mjs";
14
- import { createService } from "./runtime/service.mjs";
14
+ import { createService, envInt } from "./runtime/service.mjs";
15
+ import { attachWarmHostSweeper } from "./core/warm-host-sweeper.mjs";
15
16
  import { openDashboard, registerAgentBoardCommand } from "./commands/agent-board.js";
16
17
  import { registerBgCommand } from "./commands/bg.js";
17
18
 
@@ -39,6 +40,33 @@ export default function piAgentBoard(pi: ExtensionAPI): void {
39
40
  piArgsPrefix,
40
41
  getThinkingLevel: () => pi.getThinkingLevel(),
41
42
  };
43
+
44
+ // Warm-host reclaim (issue #75): idle PTY hosts must not leak forever after
45
+ // detach. Sweep once now (reclaims hosts orphaned by a previous host pi that
46
+ // exited without cleanup), then periodically; sweep again on shutdown.
47
+ // Child pi processes skip entirely (they share the board root and would
48
+ // terminate their own runner). serviceForContext is defined before the attach
49
+ // call because the sweeper sweeps synchronously on attach and the sweep
50
+ // closure references it (no TDZ).
51
+ const serviceForContext = () =>
52
+ createService({ root, runnerScript: RUNNER_SCRIPT, ptyRunnerScript: PTY_RUNNER_SCRIPT, titleRunnerScript: TITLE_RUNNER_SCRIPT, autoStateRunnerScript: AUTO_STATE_RUNNER_SCRIPT, piCommand, piArgsPrefix, defaultCwd: process.cwd() });
53
+ let sweepService: ReturnType<typeof createService> | null = null;
54
+ attachWarmHostSweeper(pi, {
55
+ isHostedChild,
56
+ sweep: () => {
57
+ try {
58
+ // Reuse one service instance per extension lifetime: createService
59
+ // schedules a screen-log GC on construction, so per-tick creation
60
+ // would turn an event-driven cost into a timed one.
61
+ sweepService ??= serviceForContext();
62
+ sweepService.pruneWarmHosts();
63
+ } catch {
64
+ /* best-effort: never break the session over a sweep */
65
+ }
66
+ },
67
+ intervalMs: envInt("AGENT_BOARD_SWEEP_INTERVAL_MS", 60_000, 0, 24 * 60 * 60 * 1000, "AGENT_VIEW_SWEEP_INTERVAL_MS"),
68
+ });
69
+
42
70
  registerAgentBoardCommand(pi, commandOpts);
43
71
  registerBgCommand(pi, commandOpts);
44
72
  pi.registerFlag("agent-board", {