@huseynsnmz/pi-suite 0.0.0-stage → 0.1.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 +14 -0
- package/LICENSE +21 -0
- package/README.md +87 -2
- package/SECURITY.md +5 -0
- package/package.json +113 -4
- package/packages/board/CHANGELOG.md +340 -0
- package/packages/board/CONTRIBUTING.md +7 -0
- package/packages/board/LICENSE +21 -0
- package/packages/board/README.md +88 -0
- package/packages/board/SECURITY.md +19 -0
- package/packages/board/docs/how-it-works.md +31 -0
- package/packages/board/docs/reference.md +278 -0
- package/packages/board/package.json +83 -0
- package/packages/board/runner/job-runner-legacy.mjs +68 -0
- package/packages/board/runner/job-runner.mjs +834 -0
- package/packages/board/runner/pty-runner-legacy.mjs +50 -0
- package/packages/board/runner/pty-runner.mjs +2175 -0
- package/packages/board/runner/state-coordinator.mjs +673 -0
- package/packages/board/runner/state-runner.mjs +203 -0
- package/packages/board/runner/title-runner.mjs +80 -0
- package/packages/board/src/commands/agent-board.ts +394 -0
- package/packages/board/src/commands/attach-decision.mjs +66 -0
- package/packages/board/src/commands/attach-flow.ts +251 -0
- package/packages/board/src/commands/bg.ts +103 -0
- package/packages/board/src/commands/board-model.ts +21 -0
- package/packages/board/src/core/atomic.mjs +184 -0
- package/packages/board/src/core/attach-delete.mjs +24 -0
- package/packages/board/src/core/attach-frame-proof.mjs +870 -0
- package/packages/board/src/core/attach-frame-reporter.mjs +648 -0
- package/packages/board/src/core/attach-frame-stream.mjs +266 -0
- package/packages/board/src/core/attach-view-proof.mjs +709 -0
- package/packages/board/src/core/auto-state.mjs +377 -0
- package/packages/board/src/core/background-runs.mjs +273 -0
- package/packages/board/src/core/code-refs-store.mjs +315 -0
- package/packages/board/src/core/code-refs.mjs +913 -0
- package/packages/board/src/core/config.mjs +77 -0
- package/packages/board/src/core/control-protocol.mjs +482 -0
- package/packages/board/src/core/coordinator-client.mjs +633 -0
- package/packages/board/src/core/coordinator-journal.mjs +282 -0
- package/packages/board/src/core/coordinator-protocol.mjs +14 -0
- package/packages/board/src/core/cwd-stats.mjs +114 -0
- package/packages/board/src/core/dashboard-render.mjs +10 -0
- package/packages/board/src/core/derive.mjs +117 -0
- package/packages/board/src/core/diagnostics.mjs +133 -0
- package/packages/board/src/core/double-press.mjs +26 -0
- package/packages/board/src/core/editor-state-reporter.mjs +112 -0
- package/packages/board/src/core/events.mjs +286 -0
- package/packages/board/src/core/evidence.mjs +245 -0
- package/packages/board/src/core/follow-up-queue.mjs +211 -0
- package/packages/board/src/core/foreground-preview-cache.mjs +117 -0
- package/packages/board/src/core/foreground-projection-cache.mjs +99 -0
- package/packages/board/src/core/frame-witness-update.mjs +35 -0
- package/packages/board/src/core/heuristics.mjs +313 -0
- package/packages/board/src/core/hold-input.mjs +27 -0
- package/packages/board/src/core/host-coordination.mjs +300 -0
- package/packages/board/src/core/host-crash.mjs +79 -0
- package/packages/board/src/core/host-probe.mjs +207 -0
- package/packages/board/src/core/host-protocol.mjs +73 -0
- package/packages/board/src/core/ids.mjs +35 -0
- package/packages/board/src/core/ime-cursor-coalesce.mjs +193 -0
- package/packages/board/src/core/invocation.mjs +43 -0
- package/packages/board/src/core/launch-options.mjs +418 -0
- package/packages/board/src/core/launch.mjs +157 -0
- package/packages/board/src/core/load-config.mjs +4 -0
- package/packages/board/src/core/locks.mjs +530 -0
- package/packages/board/src/core/paths.mjs +183 -0
- package/packages/board/src/core/pid.mjs +75 -0
- package/packages/board/src/core/prewarm-schedule.mjs +41 -0
- package/packages/board/src/core/process-identity-probe.mjs +228 -0
- package/packages/board/src/core/prompt-transport.mjs +13 -0
- package/packages/board/src/core/pty-attach-jiggle-controller.mjs +356 -0
- package/packages/board/src/core/pty-attach-jiggle-retry.mjs +109 -0
- package/packages/board/src/core/pty-attach-reconnect.mjs +61 -0
- package/packages/board/src/core/pty-attach-render.mjs +229 -0
- package/packages/board/src/core/pty-links.mjs +81 -0
- package/packages/board/src/core/pty-scroll.mjs +522 -0
- package/packages/board/src/core/pty-support.mjs +327 -0
- package/packages/board/src/core/repo.mjs +103 -0
- package/packages/board/src/core/rows.mjs +398 -0
- package/packages/board/src/core/screen-log-gc.mjs +198 -0
- package/packages/board/src/core/screen-log.mjs +160 -0
- package/packages/board/src/core/session-view.mjs +174 -0
- package/packages/board/src/core/slash-commands.mjs +52 -0
- package/packages/board/src/core/state-commands.mjs +757 -0
- package/packages/board/src/core/status-consistency.mjs +98 -0
- package/packages/board/src/core/steering-prompts.mjs +34 -0
- package/packages/board/src/core/steering.mjs +133 -0
- package/packages/board/src/core/stop-latch.mjs +41 -0
- package/packages/board/src/core/store.mjs +523 -0
- package/packages/board/src/core/suspend.mjs +36 -0
- package/packages/board/src/core/terminal-attach-client.mjs +981 -0
- package/packages/board/src/core/terminal-attach-protocol.mjs +460 -0
- package/packages/board/src/core/terminal-model.mjs +222 -0
- package/packages/board/src/core/terminal-query-sequences.mjs +239 -0
- package/packages/board/src/core/terminal-reply-guard.mjs +222 -0
- package/packages/board/src/core/terminal-snapshot.mjs +440 -0
- package/packages/board/src/core/test-knobs.mjs +28 -0
- package/packages/board/src/core/title.mjs +43 -0
- package/packages/board/src/core/types.mjs +414 -0
- package/packages/board/src/core/warm-host-sweeper.mjs +168 -0
- package/packages/board/src/core/worktree.mjs +65 -0
- package/packages/board/src/index.ts +303 -0
- package/packages/board/src/runtime/service.mjs +3222 -0
- package/packages/board/src/ui/chrome.ts +20 -0
- package/packages/board/src/ui/dashboard-decisions.mjs +55 -0
- package/packages/board/src/ui/dashboard-evidence.mjs +85 -0
- package/packages/board/src/ui/dashboard.ts +2221 -0
- package/packages/board/src/ui/double-left.ts +30 -0
- package/packages/board/src/ui/external-editor.ts +25 -0
- package/packages/board/src/ui/focus.ts +32 -0
- package/packages/board/src/ui/pty-attach.ts +3184 -0
- package/packages/board/src/ui/waiting.ts +30 -0
- package/packages/frame/CHANGELOG.md +113 -0
- package/packages/frame/CONTRIBUTING.md +7 -0
- package/packages/frame/LICENSE +22 -0
- package/packages/frame/README.md +105 -0
- package/packages/frame/SECURITY.md +16 -0
- package/packages/frame/docs/how-it-works.md +53 -0
- package/packages/frame/docs/reference.md +78 -0
- package/packages/frame/package.json +75 -0
- package/packages/frame/src/data/git.ts +90 -0
- package/packages/frame/src/data/github.ts +140 -0
- package/packages/frame/src/data/gitlab.ts +63 -0
- package/packages/frame/src/data/mode.ts +23 -0
- package/packages/frame/src/data/past-prompts.ts +57 -0
- package/packages/frame/src/data/runner.ts +32 -0
- package/packages/frame/src/data/snapshot.ts +223 -0
- package/packages/frame/src/data/start-notes.ts +104 -0
- package/packages/frame/src/data/telemetry.ts +337 -0
- package/packages/frame/src/data/todos.ts +162 -0
- package/packages/frame/src/data/totals.ts +94 -0
- package/packages/frame/src/data/visits.ts +45 -0
- package/packages/frame/src/index.ts +676 -0
- package/packages/frame/src/render/diff.ts +104 -0
- package/packages/frame/src/render/fit.ts +86 -0
- package/packages/frame/src/render/format.ts +108 -0
- package/packages/frame/src/render/frame.ts +106 -0
- package/packages/frame/src/render/glyphs.ts +189 -0
- package/packages/frame/src/render/keys.ts +43 -0
- package/packages/frame/src/render/lead.ts +37 -0
- package/packages/frame/src/render/paint.ts +135 -0
- package/packages/frame/src/render/safe.ts +19 -0
- package/packages/frame/src/render/segments.ts +735 -0
- package/packages/frame/src/render/streaming.ts +223 -0
- package/packages/frame/src/render/timing.ts +106 -0
- package/packages/frame/src/render/tools.ts +167 -0
- package/packages/frame/src/settings.ts +105 -0
- package/packages/frame/src/ui/editor.ts +272 -0
- package/packages/frame/src/ui/effort.ts +36 -0
- package/packages/frame/src/ui/footer.ts +165 -0
- package/packages/frame/src/ui/header.ts +362 -0
- package/packages/frame/src/ui/history-search.ts +23 -0
- package/packages/frame/src/ui/interrupt.ts +21 -0
- package/packages/frame/src/ui/outputs.ts +170 -0
- package/packages/frame/src/ui/pi-entries.ts +276 -0
- package/packages/frame/src/ui/previews.ts +72 -0
- package/packages/frame/src/ui/queue.ts +75 -0
- package/packages/frame/src/ui/screen.ts +59 -0
- package/packages/frame/src/ui/timings.ts +48 -0
- package/packages/frame/src/ui/todos.ts +205 -0
- package/packages/frame/src/ui/tool-frame.ts +595 -0
- package/packages/frame/src/ui/working.ts +25 -0
- package/packages/frame/src/view/state.ts +97 -0
- package/packages/frame/src/view/transcript.ts +175 -0
- package/packages/frame/src/view/view.ts +162 -0
- package/packages/memory/CONTRIBUTING.md +7 -0
- package/packages/memory/LICENSE +21 -0
- package/packages/memory/README.md +44 -0
- package/packages/memory/SECURITY.md +20 -0
- package/packages/memory/package.json +55 -0
- package/packages/memory/skills/review-memory/SKILL.md +48 -0
- package/packages/memory/src/index.ts +163 -0
- package/packages/memory/src/prompt.ts +25 -0
- package/packages/memory/src/review.ts +150 -0
- package/packages/memory/src/secrets.ts +22 -0
- package/packages/memory/src/store.ts +173 -0
- package/packages/modes/CHANGELOG.md +104 -0
- package/packages/modes/CONTRIBUTING.md +7 -0
- package/packages/modes/LICENSE +21 -0
- package/packages/modes/README.md +174 -0
- package/packages/modes/SECURITY.md +17 -0
- package/packages/modes/package.json +55 -0
- package/packages/modes/skills/review-permissions/SKILL.md +54 -0
- package/packages/modes/src/bash.ts +218 -0
- package/packages/modes/src/deny-off.ts +62 -0
- package/packages/modes/src/git-safety.ts +72 -0
- package/packages/modes/src/index.ts +338 -0
- package/packages/modes/src/interview.ts +206 -0
- package/packages/modes/src/judge-gate.ts +113 -0
- package/packages/modes/src/modes.ts +121 -0
- package/packages/modes/src/review/apply.mjs +156 -0
- package/packages/modes/src/review/collect.mjs +208 -0
- package/packages/modes/src/review/tools.ts +71 -0
- package/packages/modes/src/sandbox.ts +37 -0
- package/packages/router/CHANGELOG.md +8 -0
- package/packages/router/LICENSE +21 -0
- package/packages/router/README.md +90 -0
- package/packages/router/package.json +51 -0
- package/packages/router/src/config.ts +65 -0
- package/packages/router/src/index.ts +172 -0
- package/packages/router/src/judge.ts +51 -0
- package/packages/router/src/route.ts +67 -0
- package/packages/web/CHANGELOG.md +36 -0
- package/packages/web/LICENSE +21 -0
- package/packages/web/README.md +87 -0
- package/packages/web/SECURITY.md +13 -0
- package/packages/web/package.json +61 -0
- package/packages/web/src/config.ts +109 -0
- package/packages/web/src/dnsfilter.ts +97 -0
- package/packages/web/src/extract.ts +65 -0
- package/packages/web/src/index.ts +217 -0
- package/packages/web/src/net.ts +109 -0
- package/packages/web/src/reader.ts +73 -0
- package/packages/web/src/sanitize.ts +50 -0
- package/packages/web/src/search.ts +76 -0
- package/packages/web/src/secrets.ts +22 -0
- package/packages/web/src/validate.ts +186 -0
- package/src/index.ts +156 -0
- package/src/settings.ts +78 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The board blanks Pi's header and footer while it is up. Pi can only hand them back as its
|
|
3
|
+
* defaults, so this also tells any extension that drew its own to draw them again.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
export const BOARD_CLOSED_EVENT = "agent-board:closed";
|
|
8
|
+
|
|
9
|
+
let events: ExtensionAPI["events"] | null = null;
|
|
10
|
+
|
|
11
|
+
export function announceBoardClosedOn(bus: ExtensionAPI["events"]): void {
|
|
12
|
+
events = bus;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function restoreChrome(ctx: Pick<ExtensionContext, "ui">): void {
|
|
16
|
+
ctx.ui.setHeader(undefined);
|
|
17
|
+
ctx.ui.setFooter(undefined);
|
|
18
|
+
ctx.ui.setWorkingVisible(true);
|
|
19
|
+
events?.emit(BOARD_CLOSED_EVENT, undefined);
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard decision helpers for host prewarm and attach prelude (issue #70 A14).
|
|
3
|
+
*
|
|
4
|
+
* Pure functions extracted from src/ui/dashboard.ts so the branching contract is
|
|
5
|
+
* node-testable without pi's TS loader (same pattern as commands/attach-decision.mjs).
|
|
6
|
+
* `hostActive` covers starting/alive/stopping claims from store.loadRow — pending
|
|
7
|
+
* claims count as an already-registered launch, so prewarm never re-spawns them.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Prewarm decision for the selected row.
|
|
12
|
+
* - "mark-only": the row has an active host claim — mark it prewarmed WITHOUT
|
|
13
|
+
* calling prewarmHost (a pending/starting claim is already a launch; the old
|
|
14
|
+
* hostAlive guard re-checked it on every debounce tick).
|
|
15
|
+
* - "skip": busy row without a host claim — no prewarm, no mark.
|
|
16
|
+
* - "prewarm": no claim — call service.prewarmHost once; the caller marks only on ok.
|
|
17
|
+
* @param {{ hostActive?: boolean, agentBusy?: boolean }} row
|
|
18
|
+
* @returns {{ action: "mark-only" | "skip" | "prewarm" }}
|
|
19
|
+
*/
|
|
20
|
+
export function planPrewarm({ hostActive, agentBusy }) {
|
|
21
|
+
if (hostActive) return { action: "mark-only" };
|
|
22
|
+
if (agentBusy) return { action: "skip" };
|
|
23
|
+
return { action: "prewarm" };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Attach prelude for a dashboard row. A hostActive row attaches directly — the
|
|
28
|
+
* async resolver owns starting/stopping wait, so no interrupt confirmation is
|
|
29
|
+
* offered even when the row is busy. A busy row WITHOUT a host claim keeps the
|
|
30
|
+
* existing stopFirst confirm; everything else attaches directly.
|
|
31
|
+
* @param {{ hostActive?: boolean, agentBusy?: boolean }} row
|
|
32
|
+
* @returns {{ plan: "attach" | "confirm-stop-first" }}
|
|
33
|
+
*/
|
|
34
|
+
export function planDashboardAttach({ hostActive, agentBusy }) {
|
|
35
|
+
if (!hostActive && agentBusy) return { plan: "confirm-stop-first" };
|
|
36
|
+
return { plan: "attach" };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Map a service reply() result to the dashboard notice (issue #70: queued and
|
|
41
|
+
* sent are different outcomes — a queued reply is durable, not yet delivered).
|
|
42
|
+
* Result shapes from service.reply(): {ok:false,error} | {ok:true,queued:true}
|
|
43
|
+
* | {ok:true,sent:true} | {ok:true,hostMode,fallbackReason?}.
|
|
44
|
+
* @param {{ ok?: boolean, error?: string, queued?: boolean, sent?: boolean, hostMode?: string|null, fallbackReason?: string }} res
|
|
45
|
+
* @returns {{ level: "info" | "warn" | "error", text: string }}
|
|
46
|
+
*/
|
|
47
|
+
export function replyNotice(res) {
|
|
48
|
+
if (!res?.ok) return { level: "error", text: res?.error ?? "Reply failed" };
|
|
49
|
+
if (res.queued) return { level: "info", text: "Reply queued — will deliver when the host is ready" };
|
|
50
|
+
if (res.sent) return { level: "info", text: "Reply sent" };
|
|
51
|
+
if (res.hostMode === "json-runner") {
|
|
52
|
+
return { level: "warn", text: `Reply sent with non-live fallback: ${res.fallbackReason ?? "PTY unavailable"}` };
|
|
53
|
+
}
|
|
54
|
+
return { level: "info", text: "Reply sent" };
|
|
55
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Pure evidence panel rendering helpers for dashboard evidence mode. */
|
|
2
|
+
import { relativeTime, truncate } from "../core/heuristics.mjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {{ row:any, evidence:any, diagnostics:any[], paths?:Record<string,string>, width:number, now?:number }} opts
|
|
6
|
+
* @returns {string[]}
|
|
7
|
+
*/
|
|
8
|
+
export function buildEvidencePanel(opts) {
|
|
9
|
+
const width = opts.width ?? 80;
|
|
10
|
+
const now = opts.now ?? Date.now();
|
|
11
|
+
const evidence = opts.evidence ?? {};
|
|
12
|
+
const diagnostics = Array.isArray(opts.diagnostics) ? opts.diagnostics : [];
|
|
13
|
+
const paths = opts.paths ?? {};
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push(`Evidence / diagnostics for ${opts.row?.meta?.name ?? "session"}`);
|
|
16
|
+
lines.push(`State: ${opts.row?.state?.semanticState ?? "unknown"} · Outcome: ${evidence.outcome ?? "unknown"}${evidence.ready ? " · ready" : ""}`);
|
|
17
|
+
if (evidence.summary) lines.push(...wrap(`Summary: ${evidence.summary}`, width));
|
|
18
|
+
lines.push("");
|
|
19
|
+
lines.push(`Changed files (${evidence.fileChanges?.length ?? 0})`);
|
|
20
|
+
if (evidence.fileChanges?.length) {
|
|
21
|
+
for (const f of evidence.fileChanges.slice(-12)) lines.push(` ${f.action ?? "changed"} ${f.path}${f.count > 1 ? ` ×${f.count}` : ""}`);
|
|
22
|
+
} else lines.push(" —");
|
|
23
|
+
lines.push("");
|
|
24
|
+
lines.push(`Commands (${evidence.commands?.length ?? 0})`);
|
|
25
|
+
if (evidence.commands?.length) {
|
|
26
|
+
for (const c of evidence.commands.slice(-12)) {
|
|
27
|
+
const status = c.status === "failed" ? "✗" : c.status === "passed" ? "✓" : c.status === "started" ? "…" : "?";
|
|
28
|
+
lines.push(...wrap(` ${status} [${c.kind ?? "other"}] ${c.command || "command"}`, width, 2));
|
|
29
|
+
if (c.outputPreview) lines.push(...wrap(` ${c.outputPreview}`, width, 2));
|
|
30
|
+
}
|
|
31
|
+
} else lines.push(" —");
|
|
32
|
+
lines.push("");
|
|
33
|
+
lines.push(`Errors (${evidence.errors?.length ?? 0})`);
|
|
34
|
+
if (evidence.errors?.length) {
|
|
35
|
+
for (const e of evidence.errors.slice(-8)) lines.push(...wrap(` ${e.source ?? "error"}: ${e.message}`, width, 2));
|
|
36
|
+
} else lines.push(" —");
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push("Latest assistant evidence");
|
|
39
|
+
const latest = evidence.assistantEvidence?.[evidence.assistantEvidence.length - 1]?.text;
|
|
40
|
+
lines.push(...wrap(` ${latest || "—"}`, width, 8));
|
|
41
|
+
lines.push("");
|
|
42
|
+
lines.push(`Diagnostics (${diagnostics.length} shown)`);
|
|
43
|
+
if (diagnostics.length) {
|
|
44
|
+
for (const d of diagnostics.slice(-12)) {
|
|
45
|
+
const age = d.at ? relativeTime(d.at, now) : "?";
|
|
46
|
+
lines.push(...wrap(` ${age} ${String(d.level ?? "info").toUpperCase()} ${d.code ?? "event"}: ${d.message ?? ""}`, width, 2));
|
|
47
|
+
}
|
|
48
|
+
} else lines.push(" —");
|
|
49
|
+
lines.push("");
|
|
50
|
+
lines.push("Artifacts");
|
|
51
|
+
for (const [name, value] of Object.entries(paths)) {
|
|
52
|
+
if (value) lines.push(...wrap(` ${name}: ${value}`, width, 2));
|
|
53
|
+
}
|
|
54
|
+
if (Object.keys(paths).length === 0) lines.push(" —");
|
|
55
|
+
return lines.map((line) => clip(line, width));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** @param {string} text @param {number} width @param {number} [maxLines] */
|
|
59
|
+
function wrap(text, width, maxLines = 10) {
|
|
60
|
+
const words = String(text ?? "").split(/\s+/);
|
|
61
|
+
const out = [];
|
|
62
|
+
let line = "";
|
|
63
|
+
for (const word of words) {
|
|
64
|
+
if (!word) continue;
|
|
65
|
+
const next = line ? `${line} ${word}` : word;
|
|
66
|
+
if (visibleLength(next) > width && line) {
|
|
67
|
+
out.push(line);
|
|
68
|
+
line = word;
|
|
69
|
+
} else line = next;
|
|
70
|
+
if (out.length >= maxLines) break;
|
|
71
|
+
}
|
|
72
|
+
if (line && out.length < maxLines) out.push(line);
|
|
73
|
+
if (out.length === maxLines && words.length > 0) out[out.length - 1] = truncate(out[out.length - 1], Math.max(1, width - 1));
|
|
74
|
+
return out.length ? out : [""];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @param {string} line @param {number} width */
|
|
78
|
+
function clip(line, width) {
|
|
79
|
+
return truncate(line, Math.max(1, width));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @param {string} s */
|
|
83
|
+
function visibleLength(s) {
|
|
84
|
+
return String(s || "").replace(/\x1b\[[0-9;]*m/g, "").length;
|
|
85
|
+
}
|