pi-better-harness 0.61.0 → 0.61.2

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 (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/extensions/task-context/dynamic-workflow-runtime.ts +6 -1
  3. package/lib/console-icons.svg +121 -0
  4. package/lib/console-logo.png +0 -0
  5. package/lib/console-shell.mjs +41 -0
  6. package/lib/console-ui.mjs +152 -53
  7. package/lib/console.html +9 -3
  8. package/lib/prompt-ui.mjs +60 -31
  9. package/lib/prompt-web.mjs +10 -3
  10. package/lib/prompt.css +125 -10
  11. package/lib/prompt.html +19 -16
  12. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.gz +0 -0
  13. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.json +1 -1
  14. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.gz +0 -0
  15. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.json +1 -1
  16. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.gz +0 -0
  17. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.json +1 -1
  18. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.gz +0 -0
  19. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.json +1 -1
  20. package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/client.mjs +1 -1
  21. package/node_modules/pi-better-goal/package.json +1 -1
  22. package/node_modules/pi-better-goal/src/workflow-gates.ts +24 -0
  23. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.gz +0 -0
  24. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.json +1 -1
  25. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.gz +0 -0
  26. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.json +1 -1
  27. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.gz +0 -0
  28. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.json +1 -1
  29. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.gz +0 -0
  30. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.json +1 -1
  31. package/node_modules/pi-better-subagents/runtime-client/src/runtime/client.mjs +1 -1
  32. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.61.2] - 2026-11-29
4
+
5
+ ### Changed
6
+
7
+ - Align the opt-in local console with its approved screen designs. The Server overview shows runtime and upgrade status alongside hosted sessions. Prompts provides a module list, a focused editor and a composed preview.
8
+
9
+ ## [0.61.1] - 2026-11-29
10
+
11
+ ### Fixed
12
+
13
+ - Reopening a completed Goal restores the workflow plan bound after its most recent handback and resume. Bundles Goal 0.18.2.
14
+
15
+ ### Changed
16
+
17
+ - Carry the workflow's acceptance criteria into worker assignments.
18
+
3
19
  ## [0.61.0] - 2026-11-29
4
20
 
5
21
  ### Added
@@ -154,8 +154,13 @@ export function registerDynamicWorkflow(pi: ExtensionAPI, owner: (ctx: Extension
154
154
  needs.add(reviewer.review.revision);
155
155
  }
156
156
  const prior = current.history.filter(h => needs.has(h.step)).map(h => h.step + ": " + h.result);
157
+ const callerPrompt = typeof input.prompt === "string" ? input.prompt : "";
158
+ const criteria = current.criteria.filter(criterion => !callerPrompt.includes(criterion));
157
159
  const prompt = [input.prompt, "Objective: " + current.objective, "Assignment: " + s.title,
158
- "Required output: " + s.output, ...prior].join("\n");
160
+ "Required output: " + s.output,
161
+ ...(criteria.length ? ["Workflow acceptance criteria (overall objective; apply within this assignment):",
162
+ ...criteria.map(criterion => "- " + criterion)] : []),
163
+ ...prior].join("\n");
159
164
  request.admission = { prompt, settled(receipt) {
160
165
  // Re-read the selected branch after asynchronous admission. A fork or a
161
166
  // simultaneous independent launch may have changed the latest snapshot.
@@ -0,0 +1,121 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"><desc>ISC License
2
+
3
+ Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+ </desc>
17
+ <symbol id="server" viewBox="0 0 24 24">
18
+ <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
19
+ <rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
20
+ <line x1="6" x2="6.01" y1="6" y2="6" />
21
+ <line x1="6" x2="6.01" y1="18" y2="18" />
22
+ </symbol>
23
+ <symbol id="panels-top-left" viewBox="0 0 24 24">
24
+ <rect width="18" height="18" x="3" y="3" rx="2" />
25
+ <path d="M3 9h18" />
26
+ <path d="M9 21V9" />
27
+ </symbol>
28
+ <symbol id="sliders-horizontal" viewBox="0 0 24 24">
29
+ <line x1="21" x2="14" y1="4" y2="4" />
30
+ <line x1="10" x2="3" y1="4" y2="4" />
31
+ <line x1="21" x2="12" y1="12" y2="12" />
32
+ <line x1="8" x2="3" y1="12" y2="12" />
33
+ <line x1="21" x2="16" y1="20" y2="20" />
34
+ <line x1="12" x2="3" y1="20" y2="20" />
35
+ <line x1="14" x2="14" y1="2" y2="6" />
36
+ <line x1="8" x2="8" y1="10" y2="14" />
37
+ <line x1="16" x2="16" y1="18" y2="22" />
38
+ </symbol>
39
+ <symbol id="layout-grid" viewBox="0 0 24 24">
40
+ <rect width="7" height="7" x="3" y="3" rx="1" />
41
+ <rect width="7" height="7" x="14" y="3" rx="1" />
42
+ <rect width="7" height="7" x="14" y="14" rx="1" />
43
+ <rect width="7" height="7" x="3" y="14" rx="1" />
44
+ </symbol>
45
+ <symbol id="network" viewBox="0 0 24 24">
46
+ <rect x="16" y="16" width="6" height="6" rx="1" />
47
+ <rect x="2" y="16" width="6" height="6" rx="1" />
48
+ <rect x="9" y="2" width="6" height="6" rx="1" />
49
+ <path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" />
50
+ <path d="M12 12V8" />
51
+ </symbol>
52
+ <symbol id="list" viewBox="0 0 24 24">
53
+ <path d="M3 12h.01" />
54
+ <path d="M3 18h.01" />
55
+ <path d="M3 6h.01" />
56
+ <path d="M8 12h13" />
57
+ <path d="M8 18h13" />
58
+ <path d="M8 6h13" />
59
+ </symbol>
60
+ <symbol id="square-terminal" viewBox="0 0 24 24">
61
+ <path d="m7 11 2-2-2-2" />
62
+ <path d="M11 13h4" />
63
+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
64
+ </symbol>
65
+ <symbol id="monitor" viewBox="0 0 24 24">
66
+ <rect width="20" height="14" x="2" y="3" rx="2" />
67
+ <line x1="8" x2="16" y1="21" y2="21" />
68
+ <line x1="12" x2="12" y1="17" y2="21" />
69
+ </symbol>
70
+ <symbol id="refresh-cw" viewBox="0 0 24 24">
71
+ <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
72
+ <path d="M21 3v5h-5" />
73
+ <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
74
+ <path d="M8 16H3v5" />
75
+ </symbol>
76
+ <symbol id="upload" viewBox="0 0 24 24">
77
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
78
+ <polyline points="17 8 12 3 7 8" />
79
+ <line x1="12" x2="12" y1="3" y2="15" />
80
+ </symbol>
81
+ <symbol id="folder" viewBox="0 0 24 24">
82
+ <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
83
+ </symbol>
84
+ <symbol id="clock" viewBox="0 0 24 24">
85
+ <circle cx="12" cy="12" r="10" />
86
+ <polyline points="12 6 12 12 16 14" />
87
+ </symbol>
88
+ <symbol id="arrow-right" viewBox="0 0 24 24">
89
+ <path d="M5 12h14" />
90
+ <path d="m12 5 7 7-7 7" />
91
+ </symbol>
92
+ <symbol id="chevron-right" viewBox="0 0 24 24">
93
+ <path d="m9 18 6-6-6-6" />
94
+ </symbol>
95
+ <symbol id="hard-drive" viewBox="0 0 24 24">
96
+ <line x1="22" x2="2" y1="12" y2="12" />
97
+ <path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" />
98
+ <line x1="6" x2="6.01" y1="16" y2="16" />
99
+ <line x1="10" x2="10.01" y1="16" y2="16" />
100
+ </symbol>
101
+ <symbol id="circle-help" viewBox="0 0 24 24">
102
+ <circle cx="12" cy="12" r="10" />
103
+ <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
104
+ <path d="M12 17h.01" />
105
+ </symbol>
106
+ <symbol id="layers" viewBox="0 0 24 24">
107
+ <path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
108
+ <path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" />
109
+ <path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
110
+ </symbol>
111
+ <symbol id="files" viewBox="0 0 24 24">
112
+ <path d="M20 7h-3a2 2 0 0 1-2-2V2" />
113
+ <path d="M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z" />
114
+ <path d="M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8" />
115
+ </symbol>
116
+ <symbol id="menu" viewBox="0 0 24 24">
117
+ <line x1="4" x2="20" y1="12" y2="12" />
118
+ <line x1="4" x2="20" y1="6" y2="6" />
119
+ <line x1="4" x2="20" y1="18" y2="18" />
120
+ </symbol>
121
+ </svg>
Binary file
@@ -0,0 +1,41 @@
1
+ const sections = [
2
+ ["server", "Server", "server"], ["sessions", "Sessions", "panels-top-left"],
3
+ ["prompts/edit", "Prompts", "sliders-horizontal"], ["catalog", "Agent Catalog", "layout-grid"],
4
+ ["mcp", "MCP", "network"], ["skills", "Skills", "list"], ["tools", "Tools", "square-terminal"]
5
+ ];
6
+
7
+ export function icon(name) {
8
+ const ns = "http://www.w3.org/2000/svg";
9
+ const svg = document.createElementNS(ns, "svg");
10
+ svg.setAttribute("class", "icon");
11
+ svg.setAttribute("aria-hidden", "true");
12
+ const use = document.createElementNS(ns, "use");
13
+ use.setAttribute("href", "/console-icons.svg#" + name);
14
+ svg.append(use);
15
+ return svg;
16
+ }
17
+
18
+ export function mountShell() {
19
+ const root = document.querySelector(".rail nav");
20
+ const section = location.pathname.split("/")[1] || "prompts";
21
+ for (const [path, label, glyph] of sections) {
22
+ const a = document.createElement("a");
23
+ a.href = "/" + path;
24
+ a.append(icon(glyph), label);
25
+ if (section === path.split("/")[0]) {
26
+ a.setAttribute("aria-current", "page");
27
+ document.querySelector(".crumb strong").textContent = label;
28
+ document.title = label + " · Pi Better Harness";
29
+ }
30
+ root.append(a);
31
+ }
32
+ document.querySelector(".crumb").prepend(icon("monitor"));
33
+ }
34
+
35
+ export function agentDirectory(path) {
36
+ if (!path) return;
37
+ const target = document.querySelector(".rail-foot code");
38
+ target.textContent = path;
39
+ target.title = path;
40
+ target.parentElement.hidden = false;
41
+ }
@@ -1,11 +1,21 @@
1
+ import { agentDirectory, icon, mountShell } from "/console-shell.mjs";
1
2
  const el = id => document.getElementById(id);
2
3
  const token = location.hash.slice(1) || sessionStorage.getItem("prompt-token");
3
4
  if (token) sessionStorage.setItem("prompt-token",token);
4
5
  history.replaceState(null,"",location.pathname + location.search);
5
6
  const [,page,sessionId] = location.pathname.split("/");
6
- const current = document.querySelector('header a[href="/' + page + '"]');
7
- current?.setAttribute("aria-current","page");
8
- el("title").textContent = sessionId ? "Session TUI" : current?.textContent;
7
+ mountShell();
8
+ const pages = {
9
+ server: ["Server overview", "Local daemon and hosted sessions"],
10
+ sessions: ["Sessions", "Hosted sessions by workspace"],
11
+ catalog: ["Agent Catalog", "Roles and named agents"],
12
+ mcp: ["MCP", "Configured servers and connection status"],
13
+ skills: ["Skills", "Discovered skills in the selected session"],
14
+ tools: ["Tools", "Registered tools and the active session tool set"]
15
+ };
16
+ const [title, subtitle] = sessionId ? ["Session TUI", "Read-only terminal"] : pages[page];
17
+ el("title").textContent = title;
18
+ el("subtitle").textContent = subtitle;
9
19
  function node(tag,text) {
10
20
  const n = document.createElement(tag);
11
21
  if (text !== undefined) n.textContent = text;
@@ -24,25 +34,71 @@ function link(label,url) { const a = node("a",label); a.href = url; return a; }
24
34
  function field(name,control) { const label = node("label",name); label.append(control); return label; }
25
35
  function select(items) { const s = node("select"); s.append(...items.map(([id,label])=>new Option(label,id))); return s; }
26
36
  const controls = el("controls"), content = el("content");
37
+ function box(tag, className, text) {
38
+ const element = node(tag,text);
39
+ element.className = className;
40
+ return element;
41
+ }
42
+ function clock(value) {
43
+ const time = new Date(value);
44
+ return Number.isFinite(time.getTime()) ? time.toLocaleTimeString([], {hour:"2-digit",minute:"2-digit"}) : "Unavailable";
45
+ }
27
46
  function sessions(data) {
28
- const filter = node("input"); filter.type = "checkbox";
29
- filter.checked = new URLSearchParams(location.search).has("needsInput");
30
- controls.append(field("Needs input ",filter));
31
- const draw = () => {
32
- content.replaceChildren();
33
- const rows = data.sessions.filter(row => !filter.checked || row.needsInput.length);
34
- for (const [cwd,group] of Object.entries(Object.groupBy(rows,r=>r.cwd))) {
35
- content.append(node("h2",cwd));
36
- for (const row of group) {
37
- const anchor = link(row.name || row.sessionId,"/sessions/"+encodeURIComponent(row.sessionId));
38
- anchor.id = "session-" + row.sessionId;
39
- anchor.onclick = () => sessionStorage.setItem("console-back",JSON.stringify({path:location.pathname+location.search,id:anchor.id}));
40
- const p = node("p"); p.append(anchor," · ",row.needsInput.length ? "Needs input" : row.status); content.append(p);
47
+ const panel = box("section","panel sessions-panel");
48
+ const head = box("div","panel-head");
49
+ head.append(node("h2","Hosted sessions"),box("span","count",data.sessions.length));
50
+ if (page === "server") head.append(link("View all →","/sessions"));
51
+ const filters = box("div","filters"), table = node("table"), tbody = table.createTBody();
52
+ const header = table.createTHead().insertRow();
53
+ for (const text of ["Session","Workspace","Status","Updated"]) header.append(node("th",text));
54
+ const foot = box("div","panel-foot"), updated = node("span","Last check " + clock(data.observedAt)), total = node("span");
55
+ foot.append(updated,total);
56
+ panel.append(head,filters,table,foot); content.append(panel);
57
+ const params = new URLSearchParams(location.search);
58
+ let selected = params.has("needsInput") ? "Needs input" : params.get("status") || "All";
59
+ function setFilter(value) {
60
+ selected = value;
61
+ const url = new URL(location.href);
62
+ url.searchParams.delete("needsInput"); url.searchParams.delete("status");
63
+ if (value === "Needs input") url.searchParams.set("needsInput","");
64
+ else if (value !== "All") url.searchParams.set("status",value);
65
+ history.replaceState(null,"",url); draw();
66
+ }
67
+ const states = ["All","Needs input","Running","Idle"];
68
+ const chips = states.map(label => {
69
+ if (page === "sessions" && label === "Needs input") {
70
+ const check = node("input"); check.type = "checkbox"; check.onchange = () => setFilter(check.checked ? label : "All");
71
+ const control = field(label,check); control.className = "check-filter"; filters.append(control); return control;
72
+ }
73
+ const b = button(label,() => setFilter(label)); filters.append(b); return b;
74
+ });
75
+ const statusOf = row => row.needsInput?.length ? "Needs input" : row.displayStatus || row.status || "Unknown";
76
+ function draw() {
77
+ chips.forEach((control,i) => {
78
+ if (control.tagName === "LABEL") control.querySelector("input").checked = selected === states[i];
79
+ else control.setAttribute("aria-pressed",String(selected === states[i]));
80
+ });
81
+ const rows = data.sessions.filter(row => selected === "All" || statusOf(row).toLowerCase() === selected.toLowerCase());
82
+ tbody.replaceChildren();
83
+ const groups = page === "sessions" ? Object.entries(Object.groupBy(rows,r=>r.cwd)) : [["",rows]];
84
+ for (const [cwd,items] of groups) {
85
+ if (cwd) { const group = tbody.insertRow().insertCell(); group.colSpan = 4; group.className = "group"; group.textContent = cwd; }
86
+ for (const row of items) {
87
+ const tr = tbody.insertRow(), a = link(row.name || row.sessionId,"/sessions/"+encodeURIComponent(row.sessionId));
88
+ a.id = "session-"+row.sessionId; a.prepend(icon("square-terminal"));
89
+ a.onclick = () => sessionStorage.setItem("console-back",JSON.stringify({path:location.pathname+location.search,id:a.id}));
90
+ tr.insertCell().append(a);
91
+ const folder = tr.insertCell(); folder.textContent = row.cwd?.split("/").filter(Boolean).at(-1) || row.cwd; folder.title = row.cwd;
92
+ const status = statusOf(row); tr.insertCell().append(box("span","pill "+(status==="Needs input" ? "attention" : ""),status));
93
+ tr.insertCell().textContent = clock(row.lastActivityAt || row.updatedAt || row.createdAt);
41
94
  }
42
95
  }
43
- if (!rows.length) content.append(node("p","No matching sessions."));
44
- };
45
- filter.onchange = () => { history.replaceState(null,"",location.pathname+(filter.checked ? "?needsInput" : "")); draw(); };
96
+ if (!rows.length) {
97
+ const empty = tbody.insertRow().insertCell(); empty.colSpan = 4; empty.className = "empty";
98
+ empty.append(icon("panels-top-left"),node("p",data.sessions.length ? "No matching sessions." : "No hosted sessions."));
99
+ }
100
+ total.textContent = rows.length+" of "+data.sessions.length+" sessions";
101
+ }
46
102
  draw();
47
103
  const back = JSON.parse(sessionStorage.getItem("console-back") || "null");
48
104
  if (back?.path === location.pathname+location.search) el(back.id)?.focus();
@@ -50,8 +106,9 @@ function sessions(data) {
50
106
  function detail() {
51
107
  const back = JSON.parse(sessionStorage.getItem("console-back") || "null");
52
108
  controls.append(link("Back to sessions",back?.path || "/sessions"));
53
- const screen = node("pre"), meta = node("pre"); screen.className = "terminal";
54
- content.append(screen,meta);
109
+ const screen = box("pre","terminal"), meta = box("dl","metadata"), info = box("aside","panel inspector");
110
+ const layout = box("div","terminal-grid");
111
+ info.append(node("h2","Session details"),meta); layout.append(screen,info); content.append(layout);
55
112
  let generation = 0, timer, previous;
56
113
  const read = async () => {
57
114
  const request = generation;
@@ -67,7 +124,11 @@ function detail() {
67
124
  const cursor = node("mark",line[x] ?? " ");
68
125
  screen.replaceChildren(lines.slice(0,y).map(l=>l+"\n").join("")+line.slice(0,x).join(""),cursor,line.slice(x+1).join("")+"\n"+lines.slice(y+1).join("\n"));
69
126
  } else screen.textContent = frame.screen;
70
- meta.textContent = [frame.name,frame.sessionId,frame.cwd,frame.branch,frame.leaf,...frame.questions.map(q=>JSON.stringify(q))].filter(Boolean).join("\n");
127
+ meta.replaceChildren();
128
+ for (const [name,value] of Object.entries({Name:frame.name,Workspace:frame.cwd,Branch:frame.branch,Session:frame.sessionId,Leaf:frame.leaf})) {
129
+ if (value) meta.append(node("dt",name),node("dd",value));
130
+ }
131
+ for (const q of frame.questions) meta.append(node("dt","Needs input"),node("dd",q.question || q.title || JSON.stringify(q)));
71
132
  previous = encoded;
72
133
  }
73
134
  } catch (error) {
@@ -82,7 +143,9 @@ function detail() {
82
143
  }
83
144
  async function inventory(data) {
84
145
  const catalog = page === "catalog";
85
- const choices = catalog ? (await api("state")).connections.map(r=>[r.id,r.name]) : data.sessions.filter(r=>r.live).map(r=>[r.sessionId,r.name || r.sessionId]);
146
+ const catalogState = catalog ? await api("state") : null;
147
+ if (catalogState) agentDirectory(catalogState.agentDir);
148
+ const choices = catalog ? catalogState.connections.map(r=>[r.id,r.name]) : data.sessions.filter(r=>r.live).map(r=>[r.sessionId,r.name || r.sessionId]);
86
149
  const scope = select([["","Select session"],...choices]), query = node("input");
87
150
  query.type = "search"; controls.append(field("Session",scope),field("Search",query));
88
151
  const format = select([["Tree","Tree"],["Flat","Flat"]]), status = select([["","All"],["Active","Active"],["Registered","Registered"]]);
@@ -94,19 +157,29 @@ async function inventory(data) {
94
157
  const draw = () => {
95
158
  content.replaceChildren();
96
159
  const list = rows.filter(r=>(!status.value || r.status === status.value) && [r.name,r.description,r.source].join(" ").toLowerCase().includes(query.value.toLowerCase()));
97
- const info = node("pre");
98
- const pick = row => { selected = row; info.textContent = JSON.stringify(row,null,2); };
99
- if (list.includes(selected)) pick(selected);
160
+ const layout = box("div","inventory-grid"), results = box("section","panel inventory-list"), inspector = box("aside","panel inspector");
161
+ layout.append(results,inspector); content.append(layout);
162
+ const pick = row => {
163
+ selected = row; inspector.replaceChildren(box("span","caption","Details"),node("h2",row.name),node("p",row.description || ""));
164
+ const facts = box("dl","metadata");
165
+ for (const [title,value] of Object.entries({Source:row.source,Status:row.status})) {
166
+ if (value) facts.append(node("dt",title),node("dd",value));
167
+ }
168
+ const raw = node("details"); raw.append(node("summary","Full record"),node("pre",JSON.stringify(row,null,2)));
169
+ inspector.append(facts,raw);
170
+ for (const item of results.querySelectorAll("button")) item.setAttribute("aria-pressed",String(item.dataset.name === row.name));
171
+ };
172
+ const entry = row => { const item = button(row.name,()=>pick(row)); item.dataset.name = row.name; return item; };
100
173
  if (page === "tools" && format.value === "Flat") {
101
174
  const table = node("table"), head = node("tr"); head.append(...["Tool","Source","Session status","Description"].map(s=>node("th",s))); table.append(head);
102
- for (const row of list) { const tr = node("tr"), name = node("td"); name.append(button(row.name,()=>pick(row))); tr.append(name,...[row.source,row.status,row.description].map(s=>node("td",s))); table.append(tr); }
103
- content.append(table);
175
+ for (const row of list) { const tr = node("tr"), name = node("td"); name.append(entry(row)); tr.append(name,...[row.source,row.status,row.description].map(s=>node("td",s))); table.append(tr); }
176
+ results.append(table);
104
177
  } else for (const [source,items] of Object.entries(Object.groupBy(list,r=>r.source || "Unknown source"))) {
105
178
  const group = node("details"); group.open = true; group.append(node("summary",source));
106
- for (const row of items) group.append(button(row.name,()=>pick(row))); content.append(group);
179
+ for (const row of items) group.append(entry(row)); results.append(group);
107
180
  }
108
- if (!list.length && scope.value && !el("notice").textContent) content.append(node("p","No matching entries."));
109
- content.append(info);
181
+ if (list.length) pick(list.includes(selected) ? selected : list[0]);
182
+ else { inspector.hidden = true; results.append(node("p","No matching entries.")); }
110
183
  };
111
184
  const load = async () => {
112
185
  const request = ++generation;
@@ -124,33 +197,59 @@ async function inventory(data) {
124
197
  if (choices.length) { scope.value = choices[0][0]; await load(); }
125
198
  else el("notice").textContent = catalog ? "Connect a Pi session with a catalog host." : "No live session available.";
126
199
  }
200
+ function runtimeCards(data) {
201
+ const cards = box("div","runtime-cards"), runtime = box("section","runtime"), upgrade = box("section","upgrade panel");
202
+ const caption = box("div","caption","Managed runtime"); caption.prepend(icon("server"));
203
+ const state = box("h2","runtime-state",data.status === "Running" ? "Connected" : data.status);
204
+ state.dataset.connected = String(data.status === "Running");
205
+ const glyph = icon("server"); glyph.classList.add("runtime-glyph");
206
+ runtime.append(caption,state,glyph);
207
+ const hello = data.hello;
208
+ if (hello) {
209
+ const facts = box("dl","facts");
210
+ for (const [label,value] of [["Build",hello.build?.serverVersion],["Pi SDK",hello.piVersion],["Protocol","v"+hello.protocolVersion]]) {
211
+ const cell = node("div"); cell.append(node("dt",label),node("dd",value ?? "Unavailable")); facts.append(cell);
212
+ }
213
+ runtime.append(facts);
214
+ sessionStorage.setItem("console-last-handshake",JSON.stringify({at:data.observedAt,instance:hello.instanceId}));
215
+ } else {
216
+ if (data.status === "Stopped") runtime.append(button("Start server",()=>overview("console_start")));
217
+ const last = JSON.parse(sessionStorage.getItem("console-last-handshake") || "null");
218
+ if (last) runtime.append(node("p","Last connected " + clock(last.at)));
219
+ }
220
+ const label = box("div","caption","Runtime upgrade"); label.prepend(icon("upload"));
221
+ const phase = data.upgrade?.phase;
222
+ const heading = data.upgradeError || !hello ? "Unavailable" : phase === "ready" ? "Ready" : phase === "prepared" ? "Waiting for idle" : phase ? phase[0].toUpperCase()+phase.slice(1) : "No upgrade recorded";
223
+ upgrade.append(label,node("h2",heading));
224
+ const message = data.upgradeError || data.upgrade?.reason || (phase === "ready" && data.upgrade.desiredBuild?.serverVersion ? "Activated build " + data.upgrade.desiredBuild.serverVersion : "");
225
+ if (message) upgrade.append(node("p",message));
226
+ for (const blocker of data.upgrade?.blockers ?? []) {
227
+ const item = node("p",blocker.reason || blocker.kind || JSON.stringify(blocker));
228
+ const row = data.sessions?.find(r => r.sessionId === blocker.sessionId || r.sessionId === blocker.id);
229
+ if (row) item.append(" · ",link(row.name || row.sessionId,"/sessions/"+encodeURIComponent(row.sessionId)));
230
+ upgrade.append(item);
231
+ }
232
+ upgrade.append(link("View sessions →","/sessions")); cards.append(runtime,upgrade); controls.append(cards);
233
+ const details = box("details","panel disclosure"); details.append(node("summary","Connection details"));
234
+ const list = box("dl","metadata");
235
+ for (const [k,v] of Object.entries({Status:data.status,Directory:data.dir,Socket:data.serverDir,Instance:hello?.instanceId,Build:hello?.build?.contentId,Observed:data.observedAt})) {
236
+ if (v) list.append(node("dt",k),node("dd",v));
237
+ }
238
+ details.append(list); el("connection").replaceChildren(details);
239
+ }
240
+ let observation = 0;
127
241
  async function overview(action = "console_status") {
242
+ const request = ++observation;
128
243
  controls.replaceChildren(); content.replaceChildren(); el("notice").textContent = "";
244
+ el("connection").replaceChildren();
129
245
  if (sessionId) return detail();
130
- controls.append(button("Refresh",()=>overview()));
246
+ const refresh = button("Refresh",()=>overview()); refresh.prepend(icon("refresh-cw"));
247
+ el("actions").replaceChildren(refresh);
131
248
  if (page === "catalog") return inventory();
132
249
  const data = await api(action);
133
- if (page === "server") {
134
- const hello = data.hello;
135
- controls.append(node("h2",data.status),node("p",data.dir),node("p","Observed "+data.observedAt));
136
- if (hello) sessionStorage.setItem("console-last-handshake",JSON.stringify({at:data.observedAt,instance:hello.instanceId}));
137
- else {
138
- const last = JSON.parse(sessionStorage.getItem("console-last-handshake") || "null");
139
- if (last) controls.append(node("p","Last successful handshake (stale): "+last.instance+" · "+last.at));
140
- }
141
- if (hello) controls.append(node("pre",JSON.stringify({instance:hello.instanceId,build:hello.build ?? "Unavailable",piSDK:hello.piVersion,protocol:hello.protocolVersion},null,2)),
142
- node("p",data.upgradeError ? "Upgrade status unavailable · "+data.upgradeError : data.upgrade ? "Upgrade · "+data.upgrade.phase : "No recorded upgrade"));
143
- if (data.upgrade) {
144
- if (data.upgrade.reason) controls.append(node("p",data.upgrade.reason));
145
- for (const blocker of data.upgrade.blockers ?? []) {
146
- const p = node("p",JSON.stringify(blocker));
147
- const row = data.sessions.find(r=>r.sessionId === blocker.sessionId || r.sessionId === blocker.id);
148
- if (row) p.append(" ",link(row.name || row.sessionId,"/sessions/"+encodeURIComponent(row.sessionId)));
149
- controls.append(p);
150
- }
151
- }
152
- if (data.status === "Stopped") controls.append(button("Start server",()=>overview("console_start")));
153
- }
250
+ if (request !== observation) return;
251
+ agentDirectory(data.dir);
252
+ if (page === "server") runtimeCards(data);
154
253
  if (data.status !== "Running") { el("notice").textContent = data.reason || data.status; return; }
155
254
  if (["server","sessions"].includes(page)) sessions(data); else await inventory(data);
156
255
  }
package/lib/console.html CHANGED
@@ -1,3 +1,9 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Pi Better Harness</title><link rel="stylesheet" href="/manager.css"></head>
2
- <body><header><strong>Pi Better Harness</strong><a href="/server">Server</a><a href="/sessions">Sessions</a><a href="/catalog">Agent Catalog</a><a href="/mcp">MCP</a><a href="/skills">Skills</a><a href="/tools">Tools</a><a href="/prompts/edit">Prompts</a></header>
3
- <main class="console"><article><h1 id="title"></h1><p id="notice" role="status"></p><section id="controls"></section><section id="content"></section></article></main><script type="module" src="/console.js"></script></body></html>
1
+ <!doctype html>
2
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
3
+ <title>Pi Better Harness</title><link rel="stylesheet" href="/manager.css"></head>
4
+ <body><aside class="rail"><div class="brand"><img src="/console-logo.png" width="40" height="40" alt=""><div><b>Pi Better <br>Harness</b><small>Local console</small></div></div>
5
+ <nav aria-label="Main navigation"></nav><div class="rail-foot" hidden>Agent directory<code></code></div></aside>
6
+ <header class="crumb">Local <span>/</span> <strong></strong></header>
7
+ <main class="console"><div class="page-head"><div><h1 id="title"></h1><p id="subtitle"></p></div><div id="actions"></div></div>
8
+ <p id="notice" role="status"></p><div id="controls"></div><section id="content"></section><div id="connection"></div></main>
9
+ <script type="module" src="/console.js"></script></body></html>
package/lib/prompt-ui.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  import { caseOutcome, comparisonReport, replyComparison } from "./prompt-report.mjs";
2
2
  import { promptParts } from "/prompt-layout.mjs";
3
+ import { mountShell, agentDirectory } from "/console-shell.mjs";
4
+ mountShell();
3
5
  const el = id => document.getElementById(id);
4
6
  const token = location.hash.slice(1) || sessionStorage.getItem("prompt-token");
5
7
  if (token) sessionStorage.setItem("prompt-token", token);
@@ -33,40 +35,64 @@ function handle(fn) {
33
35
  finally { document.querySelector("main").inert = false; }
34
36
  };
35
37
  }
38
+ function moduleName(row) {
39
+ const name = row.id.replace(/^(?:bundled|user):/,"").replaceAll("-"," ");
40
+ return name ? name[0].toUpperCase()+name.slice(1) : "New module";
41
+ }
36
42
  function drawRows() {
37
- el("rows").replaceChildren(...rows.map((row, i) => {
38
- const section = node("div"); section.className = "module";
39
- section.addEventListener("focusin", () => { focused = row; preview(); });
40
- section.oninput = () => preview();
41
- if (i === 0 || rows[i-1].origin !== row.origin) section.append(node("h3",row.origin === "bundled" ? "Bundled" : "User"));
43
+ if (!rows.includes(focused)) focused = rows[0];
44
+ const list = el("rows");
45
+ list.replaceChildren();
46
+ let lastOrigin;
47
+ for (const row of rows) {
48
+ if (lastOrigin !== row.origin) list.append(node("h3",row.origin === "bundled" ? "Bundled" : "User"));
49
+ lastOrigin = row.origin;
50
+ const line = node("div"); line.className = "module-option";
51
+ const select = node("button",moduleName(row));
52
+ select.setAttribute("aria-pressed",String(row === focused));
53
+ select.onclick = () => { focused = row; drawRows(); el("editor").querySelector("textarea").focus({preventScroll:true}); };
54
+ line.append(select);
42
55
  if (row.origin === "bundled") {
43
56
  const toggle = node("input"); toggle.type = "checkbox"; toggle.checked = row.enabled;
57
+ toggle.setAttribute("aria-label","Enable "+row.id);
44
58
  toggle.onchange = () => { row.enabled = toggle.checked; preview(); };
45
- const label = node("label"); label.append(toggle, " " + row.id);
46
- const entry = state.attribution.bundled.find(m => m.id === row.id);
47
- const meta = node("details"); meta.append(node("summary","Shipped text and version"), node("pre",row.original),node("code",entry.version));
48
- const editor = node("textarea"); editor.value = row.override ?? row.text; editor.rows = 3;
49
- editor.setAttribute("aria-label", row.id + " Markdown");
50
- editor.oninput = () => { row.override = editor.value; reset.disabled = false; };
51
- const reset = node("button","Reset to original"); reset.disabled = !Object.hasOwn(row,"override");
52
- reset.onclick = () => { delete row.override; delete row.overrideBase; editor.value = row.text; reset.disabled = true; editor.focus(); preview(); };
53
- if (row.overrideBase && row.overrideBase !== entry.version) meta.append(node("p","Package original changed since this override."));
54
- section.append(label, editor, reset, meta); return section;
59
+ line.append(toggle);
55
60
  }
56
- const bar = node("div"); bar.className = "toolbar";
57
- const name = node("input"); name.value = row.id.slice(5); name.setAttribute("aria-label", "User module name");
58
- name.oninput = () => { row.id = "user:" + name.value; };
59
- bar.append(name);
60
- for (const [symbol, title, offset] of [["↑","Move up",-1],["↓","Move down",1],["×","Remove",0]]) {
61
- const b = node("button", symbol); b.title = title; b.setAttribute("aria-label", title + " " + row.id);
62
- b.disabled = rows[i + offset]?.origin !== "user";
63
- b.onclick = () => { rows.splice(i, 1); if (offset) rows.splice(i + offset, 0, row); drawRows(); };
64
- bar.append(b);
61
+ list.append(line);
62
+ }
63
+ const row = focused, i = rows.indexOf(row), editor = el("editor");
64
+ editor.replaceChildren();
65
+ el("module-title").textContent = moduleName(row);
66
+ el("module-origin").textContent = row.origin === "bundled" ? "Bundled module" : "User module";
67
+ el("module-id").textContent = row.id;
68
+ const body = node("textarea"); body.rows = 9; body.value = row.override ?? row.text;
69
+ body.setAttribute("aria-label",row.id+" Markdown");
70
+ const label = node("label","Markdown"); label.append(body);
71
+ if (row.origin === "bundled") {
72
+ const entry = state.attribution.bundled.find(m=>m.id === row.id);
73
+ const original = node("details"); original.append(node("summary","Package original"),node("pre",row.original),node("code",entry.version));
74
+ if (row.overrideBase && row.overrideBase !== entry.version) original.append(node("p","Package original changed since this override."));
75
+ const reset = node("button","Reset to original"); reset.disabled = !Object.hasOwn(row,"override");
76
+ reset.onclick = () => { delete row.override; delete row.overrideBase; body.value = row.text; reset.disabled = true; body.focus(); preview(); };
77
+ body.oninput = () => { row.override = body.value; reset.disabled = false; preview(); };
78
+ editor.append(label,original,reset);
79
+ } else {
80
+ const name = node("input"); name.value = row.id.slice(5); name.setAttribute("aria-label","User module name");
81
+ name.oninput = () => {
82
+ row.id = "user:"+name.value;
83
+ list.querySelector('[aria-pressed="true"]').textContent = moduleName(row);
84
+ el("module-title").textContent = moduleName(row); el("module-id").textContent = row.id;
85
+ body.setAttribute("aria-label",row.id+" Markdown"); preview();
86
+ };
87
+ const tools = node("div"); tools.className = "toolbar";
88
+ for (const [text,offset] of [["Move up",-1],["Move down",1],["Remove",0]]) {
89
+ const b = node("button",text); b.disabled = offset !== 0 && rows[i+offset]?.origin !== "user";
90
+ b.onclick = () => { rows.splice(i,1); if (offset) rows.splice(i+offset,0,row); drawRows(); };
91
+ tools.append(b);
65
92
  }
66
- const body = node("textarea"); body.rows = 3; body.value = row.text; body.setAttribute("aria-label", row.id + " Markdown");
67
- body.oninput = () => { row.text = body.value; };
68
- section.append(bar, body); return section;
69
- }));
93
+ body.oninput = () => { row.text = body.value; preview(); };
94
+ editor.append(name,label,tools);
95
+ }
70
96
  preview();
71
97
  }
72
98
  function preview() {
@@ -138,6 +164,9 @@ function showEvidence() {
138
164
  async function refresh(preferredEvidence) {
139
165
  const previous = state?.selected;
140
166
  state = await api("state"); selected = state.selected;
167
+ agentDirectory(state.agentDir);
168
+ el("active-id").textContent = state.active?.slice(0,12) || state.source;
169
+ el("active-id").title = state.active || "";
141
170
  if (previous !== selected) { rows = structuredClone(state.modules); focused = rows[0]; }
142
171
  options("revisions", state.records, selected);
143
172
  options("session", [{ id: "", label: "Standalone" }, ...state.connections.map(c => ({ id: c.id, label: c.name }))], connection);
@@ -238,15 +267,15 @@ function tab(view) {
238
267
  }
239
268
  if (state && view === "replay") (el("mode").value === "sessions" ? refreshSessions() : refreshForks()).catch(e=>{el("notice").textContent=e.message;});
240
269
  if (returning && focused) {
241
- const section = el("rows").children[rows.indexOf(focused)];
242
- section?.querySelector("textarea")?.focus({preventScroll:true});
270
+ el("editor").querySelector("textarea")?.focus({preventScroll:true});
243
271
  }
244
272
  }
245
273
  for (const b of document.querySelectorAll("[data-view]")) b.onclick = () => tab(b.dataset.view);
246
274
  el("revisions").onchange = handle(async () => { selected = el("revisions").value; await refresh(); });
247
275
  el("session").onchange = handle(async () => { connection = el("session").value; await refresh(); });
248
276
  el("refresh").onclick = handle(refresh);
249
- el("add").onclick = () => { rows.push({ id:"user:",origin:"user",text:"" }); drawRows(); el("rows").lastChild.querySelector("input").focus(); };
277
+ el("add").onclick = () => { focused = { id:"user:",origin:"user",text:"" }; rows.push(focused); drawRows(); el("editor").querySelector("input").focus(); };
278
+ el("history-link").onclick = () => { el("revision-history").open = true; el("revision-history").scrollIntoView(); return false; };
250
279
  el("compare").onclick = handle(async () => { el("target").value = selected; await refreshPair(); tab("replay"); });
251
280
  el("save").onclick = handle(async () => { selected = await api("save", { modules:rows }); await refresh(); el("notice").textContent = "Saved " + selected + " · Parent " + state.parent + (state.evidence.length ? " · Previously tested" : " · Untested"); });
252
281
  el("publish").onclick = handle(async () => { if (confirm("Publish " + state.active + " → " + selected + "?\n" + state.diff)) { await api("publish", { confirmed:true }); await refresh(); } });
@@ -15,18 +15,25 @@ async function listen(dispatch, ui = false) {
15
15
  res.setHeader("cache-control", "no-store");
16
16
  res.setHeader("referrer-policy", "no-referrer");
17
17
  res.setHeader("x-content-type-options", "nosniff");
18
- res.setHeader("content-security-policy", "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'");
18
+ res.setHeader("content-security-policy", "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'");
19
19
  if ("http://" + req.headers.host !== origin) { res.writeHead(403).end(); return; }
20
20
  const assets = { "/": ["prompt.html", "text/html"], "/manager.js": ["prompt-ui.mjs", "text/javascript"],
21
21
  "/prompts/edit":["prompt.html","text/html"], "/prompts/replay":["prompt.html","text/html"],
22
22
  "/console.js":["console-ui.mjs","text/javascript"],
23
+ "/console-shell.mjs":["console-shell.mjs","text/javascript"],
24
+ "/console-logo.png":["console-logo.png","image/png"], "/console-icons.svg":["console-icons.svg","image/svg+xml"],
23
25
  "/prompt-layout.mjs":["prompt-layout.mjs","text/javascript"],
24
26
  "/prompt-report.mjs": ["prompt-report.mjs", "text/javascript"], "/manager.css": ["prompt.css", "text/css"] };
25
27
  const pathname = req.url.split("?")[0];
26
28
  const page = /^\/(?:server|sessions(?:\/[\w-]+)?|catalog|mcp|skills|tools)$/.test(pathname) ? ["console.html","text/html"] : assets[pathname];
27
29
  if (ui && req.method === "GET" && page && Array.isArray(page)) {
28
30
  const [file, type] = page;
29
- res.writeHead(200, { "content-type": type + "; charset=utf-8" }).end(readFileSync(new URL(file, import.meta.url)));
31
+ try {
32
+ const body = readFileSync(new URL(file, import.meta.url));
33
+ res.writeHead(200, { "content-type": type.startsWith("text/") ? type + "; charset=utf-8" : type }).end(body);
34
+ } catch (error) {
35
+ res.writeHead(error.code === "ENOENT" ? 404 : 500).end();
36
+ }
30
37
  return;
31
38
  }
32
39
  if (req.method !== "POST" || req.url !== "/api" || req.headers.authorization !== "Bearer " + token ||
@@ -115,7 +122,7 @@ export async function startPromptWeb(dir) {
115
122
  try { const description = await session.describe(); session = { describe: () => description, run: send }; }
116
123
  catch (e) { problem = e.message; session = null; }
117
124
  }
118
- return { ...await managerAction(dir, args, session), problem, connections: list.map(({ id, name }) => ({ id, name })) };
125
+ return { ...await managerAction(dir, args, session), agentDir: dir, problem, connections: list.map(({ id, name }) => ({ id, name })) };
119
126
  }, true);
120
127
  }
121
128
 
package/lib/prompt.css CHANGED
@@ -1,10 +1,125 @@
1
- :root{font:15px/1.5 "Source Sans 3",system-ui,sans-serif;color:#202722;background:#fafbf9}
2
- input[type=checkbox]{width:auto;accent-color:#195f43}.module details{margin-bottom:10px}
3
- *{box-sizing:border-box}body{margin:0}header{border-bottom:1px solid #c9cfc9;padding:13px 4vw;display:flex;gap:24px;background:white}header strong{color:#146344}
4
- main{max-width:1240px;margin:auto;display:grid;grid-template-columns:minmax(190px,260px) minmax(0,1fr);min-height:90vh}aside{padding:28px 20px;border-right:1px solid #d8dcd7}article{padding:24px clamp(16px,4vw,54px)}h1{font-size:28px;margin:0}h2{font-size:17px;margin:22px 0 8px}label{display:block;font-weight:600;margin:10px 0}input,textarea,select,button{font:inherit;color:inherit}input,textarea,select{width:100%;padding:7px;border:1px solid #b7c1b8;background:white;border-radius:4px}textarea,pre,dd{font:13px/1.55 ui-monospace,monospace}textarea{resize:vertical}button{border:1px solid #a9b4ac;background:white;border-radius:4px;padding:5px 10px;cursor:pointer}button:hover,button[aria-current=true]{background:#e3eee8}button.primary{color:white;background:#195f43}button:disabled{opacity:.5;cursor:default}
5
- pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f0f2ef;padding:12px}pre:empty{display:none}dd{margin:0 0 8px;overflow-wrap:anywhere}dt{font-weight:600;font-size:13px}nav,footer,.toolbar{display:flex;gap:7px;align-items:center;flex-wrap:wrap}nav{border-bottom:1px solid #c9cfc9;padding:12px 0}nav button{border:0}.module{padding:8px 0;border-bottom:1px solid #ddd}.module .toolbar input{width:auto;flex:1;min-width:80px}.toolbar{margin:5px 0}footer{margin:14px 0}#notice{color:#86401d;overflow-wrap:anywhere}aside button{margin:5px 0}
6
- @media(max-width:700px){main{display:block}aside{border-right:0;border-bottom:1px solid #ddd;padding:15px}aside dl{display:grid;grid-template-columns:auto 1fr;gap:4px 10px}article{padding:16px}}
7
- :root{--line:#c9cfc9}.workspace,.pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.workspace section,.pair section{min-width:0}.pair h3{overflow-wrap:anywhere}header{flex-wrap:wrap}header a{color:inherit}.preview{position:sticky;top:1rem;align-self:start}#draft{max-height:68vh;overflow:auto}mark{background:#ffeba7;color:inherit}select{max-width:100%}
8
- @media(max-width:850px){.workspace,.pair{grid-template-columns:minmax(0,1fr)}.preview{position:static}}
9
- .console{display:block}.console article{max-width:1180px;margin:auto}.console #controls label{display:inline-block;margin-right:1rem}.console td,.console th{text-align:left;vertical-align:top;padding:6px}.console #content{overflow-x:auto}.console details button{display:block;margin:4px 1rem}.terminal{background:#192224;color:#f5f7f6;white-space:pre;overflow:auto;min-height:16rem;max-height:70vh}.terminal:empty{display:block}header a{padding:4px 8px;border-radius:4px}header a:hover,header a[aria-current=page]{background:#e3eee8}header a:focus-visible{outline:2px solid #195f43}
10
- #sessionSet p,#forkDetails,#result{overflow-wrap:anywhere}
1
+ :root {
2
+ color-scheme: light;
3
+ --bg: #f5f7f2; --ink: #1b2922; --muted: #58675e; --line: #d7e0d6;
4
+ --green: #245b44; --mint: #dcecdc; --rail: #192b20; --white: #fff;
5
+ --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
6
+ --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
7
+ font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg);
8
+ }
9
+ * { box-sizing: border-box }
10
+ [hidden], pre:empty, #notice:empty, .toolbar:empty { display: none !important }
11
+ body { margin: 0; display: grid; grid-template: 60px 1fr / 218px minmax(0,1fr); min-height: 100vh }
12
+ h1,h2,h3,p,dl,dd,pre { margin: 0 }
13
+ h1 { font-size: 40px; line-height: 1.14; font-weight: 690 }
14
+ h2 { font-size: 21px; line-height: 1.3 }
15
+ h3 { font-size: 16px }
16
+ a { color: var(--green); text-decoration: none } a:hover { text-decoration: underline }
17
+ button,select,input,textarea { font: inherit; color: inherit }
18
+ button, .action, select, input:not([type=checkbox]), textarea { border: 1px solid #bdcbbf; border-radius: 6px; background: white; padding: 7px 11px; max-width: 100% }
19
+ button,.action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 600; font-size: 13px; line-height: 1.4; min-height: 34px }
20
+ button:hover,.action:hover { background: #eff4ee; text-decoration: none } button:disabled { opacity: .52; cursor: default }
21
+ button.primary { color: white; background: var(--green); border-color: var(--green) }
22
+ :focus-visible { outline: 3px solid #3b83ba; outline-offset: 3px }
23
+ input[type=checkbox] { accent-color: var(--green) }
24
+ code,pre,textarea,dd { font: 13px/1.55 var(--mono); overflow-wrap: anywhere }
25
+ pre { white-space: pre-wrap } textarea { width: 100%; resize: vertical }
26
+ .icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none }
27
+ .rail { grid-row: 1 / 3; position: sticky; top: 0; height: 100vh; min-width: 0; padding: 25px 17px; display: flex; flex-direction: column; gap: 27px; background: var(--rail); color: #e8efe8 }
28
+ .brand { display: flex; gap: 11px; align-items: center; padding: 0 7px }
29
+ .brand img { object-fit: contain } .brand b { display: block; font-size: 16px; line-height: 1.35 }
30
+ .brand small,.rail-foot { color: #becdc0; font-size: 12px }
31
+ .rail nav { display: grid; gap: 4px }
32
+ .rail nav a { display: flex; align-items: center; gap: 12px; color: inherit; padding: 10px 13px; font-weight: 550; border-radius: 7px; white-space: nowrap }
33
+ .rail nav a:hover,.rail nav a[aria-current=page] { background: #344d39; text-decoration: none; color: #fff }
34
+ .rail-foot { margin-top: auto; padding: 16px 7px 0; border-top: 1px solid #425345 }
35
+ .rail-foot code { display: block; color: #fff; font-size: 11px; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
36
+ .crumb { grid-column: 2; background: white; border-bottom: 1px solid var(--line); padding: 0 4%; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px }
37
+ .crumb strong { color: var(--ink) } .crumb span { color: #89998c }
38
+ main { grid-column: 2; align-self: start; width: 100%; max-width: 1540px; margin: 0 auto; min-width: 0; padding: 32px 4% 48px }
39
+ .page-head,.panel-head,.panel-foot,.toolbar,.filters,.actions,footer { display: flex; align-items: center; gap: 10px }
40
+ .page-head { justify-content: space-between; gap: 16px; margin-bottom: 22px }
41
+ #subtitle, #packageProof, .upgrade p, .metadata dt { color: var(--muted) } #subtitle { margin-top: 6px }
42
+ #notice:not(:empty) { margin: 14px 0; padding: 10px 14px; border-left: 3px solid #b08245; background: #fff5e5; overflow-wrap: anywhere }
43
+ .panel,.pair > section { border: 1px solid var(--line); border-radius: 8px; background: white; min-width: 0 }
44
+ .runtime-cards { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 16px; margin-bottom: 24px }
45
+ .runtime,.upgrade { padding: 20px 22px; position: relative; min-width: 0 }
46
+ .runtime { border-radius: 8px; background: #15372b; color: #f3f8f3; overflow: hidden; isolation: isolate }
47
+ .runtime::before { content: ""; position: absolute; inset: 0 0 0 50%; background: radial-gradient(#78bf95 0.8px,transparent 1px) 0 0/9px 9px; mask-image: linear-gradient(90deg,transparent,#000); opacity: .24; z-index: -1 }
48
+ .caption,.revision-bar label,.module-list h3 { color: var(--muted); font-size: 11px; font-weight: 700 }
49
+ .caption { display: flex; align-items: center; gap: 8px }
50
+ .runtime .caption,.facts dt,.runtime > p { color: #bfd8c8 }
51
+ .runtime-state { display: flex; align-items: center; gap: 10px; margin: 20px 0 23px; padding-right: 55px; font-size: 30px; font-weight: 590 }
52
+ .runtime-state::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #abb9af; box-shadow: 0 0 0 4px #ffffff22 }
53
+ .runtime-state[data-connected=true]::before { background: #a0dbb7 }
54
+ .runtime-glyph { position: absolute; right: 24px; top: 48px; width: 47px; height: 47px; color: #97bda6; stroke-width: 1 }
55
+ .facts { display: grid; grid-template-columns: 1.25fr 1fr .8fr; gap: 18px; border-top: 1px solid #ffffff36; padding-top: 12px }
56
+ .facts dt { font-size: 11px; margin-bottom: 3px } .facts dd { font-size: 13px }
57
+ .upgrade { display: flex; flex-direction: column; align-items: start; gap: 8px }
58
+ .upgrade h2 { margin-top: 9px; font-size: 24px } .upgrade p { overflow-wrap: anywhere }
59
+ .upgrade a,.panel-head a { font-size: 13px; font-weight: 650 } .upgrade > a { margin-top: auto; padding-top: 14px }
60
+ .panel-head { padding: 18px 20px 8px } .panel-head a { margin-left: auto }
61
+ .count,.pill { display: inline-flex; align-items: center; background: #edf3eb; border-radius: 5px; padding: 1px 7px; font-size: 12px; color: #425b49 }
62
+ .filters { padding: 8px 20px 13px; flex-wrap: wrap; gap: 4px } .filters button,.check-filter { font-size: 12px; min-height: 28px; color: var(--muted); background: transparent; border: 1px solid transparent; padding: 4px 9px; border-radius: 5px }
63
+ .filters [aria-pressed=true],.check-filter:has(:checked) { background: #e7efe5; color: #29513b; border-color: #d2e0d2 } .check-filter { display: inline-flex; align-items: center; gap: 5px; cursor: pointer }
64
+ table { border-collapse: collapse; width: 100%; font-size: 13px } th,td { text-align: left; overflow-wrap: anywhere }
65
+ th { font-size: 10px; text-transform: uppercase; color: var(--muted); background: #f3f5ef } th,td { padding: 10px 12px } th:first-child,td:first-child { padding-left: 20px }
66
+ td { border-bottom: 1px solid #e5eae4 } td a { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 600 } td a .icon { color: var(--muted) }
67
+ .sessions-panel { overflow: hidden } .sessions-panel td:nth-child(2),.sessions-panel td:nth-child(4) { font: 12px var(--mono); color: var(--muted) }
68
+ .group { font-weight: 650; background: #f9faf7 } .pill { text-transform: capitalize; border-radius: 20px; white-space: nowrap }
69
+ .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px }
70
+ .attention { background: #fbefcf; color: #825d19 }
71
+ .empty { text-align: center; color: var(--muted); padding: 22px !important } .empty svg { width: 22px; height: 22px } .empty p { margin-top: 4px }
72
+ .panel-foot { justify-content: space-between; padding: 12px 20px; font-size: 11px; color: var(--muted) }
73
+ .disclosure { padding: 14px 20px; margin-top: 16px } summary { cursor: pointer; color: var(--green); font-weight: 600 }
74
+ .metadata { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 7px 18px; margin: 16px 0 }
75
+ #controls:not(:has(.runtime-cards)) { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px }
76
+ #controls label,.revision-bar label,#replay label,#editor label { display: grid; gap: 5px; font-size: 12px; color: var(--muted) }
77
+ #content details > button { display: block; margin: 4px 12px }
78
+ .inventory-grid,.terminal-grid { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(0,.9fr); gap: 16px }
79
+ .inventory-list,.inspector { padding: 16px; align-self: start }
80
+ .inventory-list details { border-bottom: 1px solid var(--line); padding: 8px 0 }
81
+ .inventory-list button { border: 0; background: transparent; text-align: left }
82
+ .inventory-list button:hover,.inventory-list button[aria-pressed=true] { background: var(--mint) }
83
+ .inspector h2 { overflow-wrap: anywhere; margin: 7px 0 } .inspector > p { color: var(--muted) }
84
+ .inspector pre,.disclosure pre,#replay pre { margin: 8px 0; background: #f5f7f2; padding: 12px; max-height: 420px; overflow: auto }
85
+ .terminal { background: #18231d; color: #f3f7f4; padding: 16px; border-radius: 8px; white-space: pre; overflow: auto; min-height: 17rem; max-height: 70vh }
86
+ .terminal:empty { display: block !important } mark { background: #d3eecf; color: var(--ink) }
87
+ .revision-bar { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; align-items: center; padding: 14px 18px; gap: 18px }
88
+ .revision-bar > label { border-left: 1px solid var(--line); padding-left: 16px } .revision-bar select { min-width: 0; width: 100%; padding: 3px 4px }
89
+ .revision-bar .caption,.revision-bar label,.module-list h3,.workspace .caption { text-transform: uppercase }
90
+ .revision-bar strong { font: 14px var(--mono) } .tabs { margin: 14px 0 18px; border-bottom: 1px solid var(--line) }
91
+ .tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 8px 12px }
92
+ .tabs [aria-current=true] { border-color: var(--green); color: var(--green) }
93
+ .workspace { display: grid; grid-template-columns: minmax(150px,.72fr) minmax(230px,1.08fr) minmax(260px,1.4fr); gap: 14px; align-items: start }
94
+ .workspace > section { padding: 17px; min-width: 0 } .workspace h2 { margin: 5px 0 8px } .module-list h3 { margin: 14px 0 5px }
95
+ .module-list > button { margin-top: 12px } .module-option { display: flex; align-items: center; gap: 3px }
96
+ .module-option button { flex: 1; min-width: 0; justify-content: start; text-align: left; border-color: transparent; overflow-wrap: anywhere; font-weight: normal; padding: 5px }
97
+ .module-option [aria-pressed=true] { background: var(--mint); color: var(--green); font-weight: 650 }
98
+ #editor { margin: 18px 0 } #editor label { font-weight: 650 } #editor textarea { background: #fafbf7; font-size: 13px; margin-bottom: 8px }
99
+ #editor details { margin: 8px 0 } .toolbar,footer { flex-wrap: wrap; margin-top: 12px }
100
+ .preview pre { padding-top: 14px; max-height: 66vh; overflow: auto; border-top: 1px solid var(--line) } #omission { color: var(--muted) }
101
+ #replay > section { padding: 16px 20px; margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: white }
102
+ #replay > .page-head { margin-bottom: 10px }
103
+ #replay > .page-head h2 { font-size: 26px }
104
+ #replay label,#replay h2,#replay details,#packageProof { margin: 14px 0 8px } #replay input:not([type=checkbox]),#replay select { width: 100% }
105
+ .pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px } .pair > section { padding: 10px } #replay { overflow-wrap: anywhere }
106
+ @media(max-width: 1080px) {
107
+ body { grid-template-columns: 185px minmax(0,1fr) } .rail { padding-inline: 12px }
108
+ main { padding: 25px 21px 38px } .workspace { grid-template-columns: minmax(140px,.6fr) minmax(0,1.4fr) }
109
+ .preview { grid-column: 1/-1 } .revision-bar { gap: 10px }
110
+ }
111
+ @media(max-width: 760px) {
112
+ body { display: block } .rail { position: static; height: auto; padding: 10px 14px; gap: 8px }
113
+ .brand { padding: 0; gap: 7px } .brand img { width: 27px; height: 27px } .brand br { display: none } .brand b { font-size: 15px } .brand br::after { content:" " }
114
+ .brand small,.rail-foot { display: none } .rail nav { display: flex; overflow-x: auto; gap: 3px } .rail nav a { padding: 6px 8px; gap: 5px; font-size: 12px }
115
+ .crumb { min-height: 40px; padding: 0 15px } main { padding: 21px 14px 34px } h1 { font-size: 30px }
116
+ .runtime-cards { grid-template-columns: minmax(0,1fr); gap: 10px; margin-bottom: 15px }
117
+ .page-head { margin-bottom: 15px } .runtime,.upgrade { padding: 16px } .runtime-state { margin: 12px 0 16px; font-size: 27px }
118
+ .runtime-glyph { top: 30px } .upgrade h2 { margin-top: 0 } .upgrade > a { padding-top: 3px }
119
+ .sessions-panel tr > :nth-child(2),.sessions-panel tr > :nth-child(4) { display: none }
120
+ .inventory-grid,.terminal-grid,.workspace,.pair { grid-template-columns: minmax(0,1fr) }
121
+ .revision-bar { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px }
122
+ .revision-bar > label { border: 0; padding: 0 } .module-list #rows { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2px 7px }
123
+ .module-list h3 { grid-column: 1/-1 } .workspace > section { padding: 14px }
124
+ .filters,.panel-head,.panel-foot { padding-inline: 12px } .panel-head h2 { font-size: 18px }
125
+ }
package/lib/prompt.html CHANGED
@@ -1,22 +1,25 @@
1
- <!doctype html>
2
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
3
- <title>Prompt manager · Pi Better Harness</title><link rel="stylesheet" href="/manager.css"></head>
4
- <body><header><strong>Pi Better Harness</strong><a href="/server">Server</a><a href="/sessions">Sessions</a><a href="/catalog">Agent Catalog</a><a href="/mcp">MCP</a><a href="/skills">Skills</a><a href="/tools">Tools</a><a aria-current="page" href="/prompts/edit">Prompts</a></header>
5
- <main><aside><label>Editing base<select id="revisions"></select></label>
6
- <label>Pi session<select id="session"></select></label><button id="refresh">Refresh</button>
7
- <dl id="status"></dl><section id="packageProof"></section><h2>Activation history</h2><section id="history"></section></aside>
8
- <article><h1>Prompts</h1><p role="status" id="notice"></p>
9
- <nav><button data-view="edit">Edit</button><button data-view="replay">Replay</button></nav>
10
- <section id="edit"><div class="workspace"><section><h2>Ordered modules</h2><div id="rows"></div><button id="add">Add module</button></section>
11
- <section class="preview"><h2>Composed prompt</h2><p id="omission"></p><pre id="draft"></pre></section></div>
12
- <details><summary>Draft changes</summary><pre id="draftDiff"></pre></details><footer><button class="primary" id="save">Save revision</button><button id="compare">Replay saved revision</button></footer>
13
- <details><summary>Publication</summary><h2>Changes from parent</h2><pre id="parentDiff"></pre><h2>Changes from active</h2><pre id="diff"></pre><button id="publish">Publish manually</button><h2>Installed block</h2><pre id="installed"></pre></details></section>
14
- <section id="replay" hidden><div class="pair"><label>Baseline revision<select id="base"></select></label><label>Candidate revision<select id="target"></select></label></div><details><summary>Selected compositions</summary><pre id="compositions"></pre></details>
15
- <label>Replay mode<select id="mode"><option value="fork">Session fork</option><option value="sessions">Evaluate sessions</option><option value="single">Captured response only</option><option value="suite">Reviewed case suite</option></select></label>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
2
+ <title>Prompt manager · Pi Better Harness</title><link rel="stylesheet" href="/manager.css"></head><body><aside class="rail"><div class="brand"><img src="/console-logo.png" width="40" height="40" alt=""><div><b>Pi Better <br>Harness</b><small>Local console</small></div></div>
3
+ <nav aria-label="Main navigation"></nav><div class="rail-foot" hidden>Agent directory<code></code></div></aside>
4
+ <header class="crumb">Local <span>/</span> <strong></strong></header>
5
+ <main class="prompts"><div class="page-head"><h1>Prompt manager</h1><a class="action" href="#revision-history" id="history-link">Revision history</a></div>
6
+ <div class="revision-bar panel"><div><span class="caption">Active revision</span><strong id="active-id"></strong></div>
7
+ <label>Editing from<select id="revisions"></select></label><label>Pi session<select id="session"></select></label><button id="refresh">Refresh</button></div>
8
+ <p role="status" id="notice"></p><nav class="tabs" aria-label="Prompt workspace"><button data-view="edit">Edit</button><button data-view="replay">Replay</button></nav>
9
+ <section id="edit"><div class="workspace">
10
+ <section class="panel module-list"><h2>Modules</h2><div id="rows"></div><button id="add">+ Add module</button></section>
11
+ <section class="panel module-edit"><span id="module-origin" class="caption"></span><h2 id="module-title">Module</h2><code id="module-id"></code><div id="editor"></div>
12
+ <details><summary>Review changes</summary><pre id="draftDiff"></pre></details><footer><button class="primary" id="save">Save revision</button><button id="compare">Replay saved revision</button></footer></section>
13
+ <section class="panel preview"><span class="caption">Working draft</span><h2>Full prompt preview</h2><p id="omission"></p><pre id="draft"></pre></section></div>
14
+ <details class="panel disclosure"><summary>Publication</summary><h2>Changes from parent</h2><pre id="parentDiff"></pre><h2>Changes from active</h2><pre id="diff"></pre><button id="publish">Publish manually</button><h2>Installed block</h2><pre id="installed"></pre></details></section>
15
+ <section id="replay" hidden><div class="page-head"><h2>Replay</h2><label>Replay mode<select id="mode"><option value="fork">Session fork</option><option value="sessions">Evaluate sessions</option><option value="single">Captured response only</option><option value="suite">Reviewed case suite</option></select></label></div>
16
+ <section class="panel replay-config"><div class="pair"><label>Baseline revision<select id="base"></select></label><label>Candidate revision<select id="target"></select></label></div><details><summary>Selected compositions</summary><pre id="compositions"></pre></details></section>
16
17
  <section id="sessions" hidden><h2>Complete sessions</h2><div id="sessionSet"></div><button id="runSessions">Evaluate selected sessions</button></section>
17
18
  <section id="fork"><label>Recommended fork<select id="forks"></select></label><pre id="forkDetails"></pre><button id="runFork">Run session fork</button></section>
18
19
  <section id="single" hidden><label>Captured request<select id="captures"></select></label><pre id="captureDetails"></pre><button id="runResponse">Replay a response</button></section>
19
20
  <section id="suite" hidden><label>Reviewed suite<select id="suites"></select></label><label>Model<select id="models"></select></label><label>Samples per case<input id="samples" type="number" min="1" max="16" value="1"></label><button id="evaluate">Evaluate case suite</button></section>
20
21
  <h2>Comparison evidence</h2><label>Result<select id="evidence"></select></label><div id="result"></div>
21
22
  <label>Rubric<textarea id="rubric" rows="2"></textarea></label><label>Judgment<textarea id="judgment" rows="3"></textarea></label><footer><button id="judge">Record judgment</button><button id="promote">Promote evaluated revision</button></footer></section>
22
- </article></main><script type="module" src="/manager.js"></script></body></html>
23
+
24
+ <details class="panel disclosure" id="revision-history"><summary>Revision history</summary><dl id="status" class="metadata"></dl><div id="history"></div></details>
25
+ <section id="packageProof"></section></main><script type="module" src="/manager.js"></script></body></html>
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"6b75c05b5a766e6a4253155b5f033179c5c8d34b80a0b18bb61b2dd5ee93c50f"},"sha256":"f3e805e02f0e522291ffed0fae247d7df1541072a2f24ce31a245e85af5e539e"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"04442594dc110af3d73e5075de2094a9fe2b2adb2955de39c84e785a869eb543"},"sha256":"f79ecee29823e829770a4847c3d86d2cbd86bf93f7d097fa4c16b0f1cadd8a52"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"962bc31dd994310104f26862987a9a9d7b40b1992656f11740f9631bd4ec4268"},"sha256":"67a097d04fab43222549b14c21f6ae83fa33df4a9b3ff516e3a1d02c429253e1"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"5cb393f556c1b787e1c0be6d78154f66fd4140b6f29e2030a1c811d1c607b7f3"},"sha256":"356ce80e21bde804765241c0ef150408505c2a039a2792d642dc25c7a494ce30"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"b13c2b2f4a05f16849fdf6b9af288302778b532b8c95a6a09287220d9ad7afab"},"sha256":"a4909b248d73634eb24ed16c83a0ea3339e2003083e5a531837b594042843e95"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"f2e844fedd5a6e14d68f0ab68eb11d378d7d4c55ac2bd0e1d7633583df3265fb"},"sha256":"ec088febda80c19361e0670b32e3ccff03b190e9edcf6926a77eec7433895204"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"125b52e4b01234f3a8af339eb070b95b1ee8a86380cfc4fbd141e9327b8bd101"},"sha256":"81e26d96fd104936c8c79f16d88655930fac3b3c56ae3ac19427ce55551ce1ed"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"f0cc8b712cf3f8e34e2f112b713a0d1318991061ce120a107d6351500adf621c"},"sha256":"802c0e819cf9896d840cb4da23cac3b777c7a48711d20ff68d7479764cf75fc4"}
@@ -55,7 +55,7 @@ export async function runtimeStatus(socketPath, agentDir, artifact, timeoutMs =
55
55
  });
56
56
  });
57
57
  }
58
- const runLocal = (command, input, timeoutMs) => new Promise((resolve, reject) => {
58
+ export const runLocal = (command, input, timeoutMs) => new Promise((resolve, reject) => {
59
59
  const child = spawn("/bin/sh", ["-c", command], { stdio: "pipe", timeout: timeoutMs });
60
60
  let stdout = "", stderr = "";
61
61
  child.stdout.on("data", chunk => { stdout += chunk; });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-goal",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Pi extension for goal tracking with background-aware continuation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,15 +73,37 @@ export function boundPlanEntry(entries: Iterable<EntryLike>, owner: WorkflowOwne
73
73
  let plan: { version: 1; kind: "set"; owner: string; path: string; runId?: string } | undefined;
74
74
  let ownsRun = false;
75
75
  let foundGoal = false;
76
+ let handback: "paused" | "released" | "rebound" | undefined;
76
77
  for (const entry of entries) {
78
+ // resumeGoal records the owner and then activates the same Goal. A separate
79
+ // invocation can bind the same skill, but cannot supply that Goal transition.
80
+ if (handback === "rebound" && entry.type === "message") handback = "released";
77
81
  if (entry.type !== "custom" || !isRecord(entry.data)) continue;
78
82
  const data = entry.data;
79
83
  if (goalId && entry.customType === EXTENSION_NAME && data.kind === "set" && isRecord(data.goal)) {
80
84
  if (foundGoal && (data.goal.goalId !== goalId || data.goal.status === "complete")) break;
81
85
  if (data.goal.goalId === goalId) foundGoal = true;
86
+ if (handback === "released") {
87
+ if (data.goal.status === "paused" && data.goal.pauseReason === "handback") continue;
88
+ break;
89
+ }
90
+ if (handback === "rebound") {
91
+ if (data.goal.status !== "active") break;
92
+ plan = undefined;
93
+ }
94
+ handback = foundGoal && data.goal.status === "paused" && data.goal.pauseReason === "handback" ? "paused" : undefined;
82
95
  }
83
96
  if (data.version !== 1) continue;
84
97
  if (entry.customType === WORKFLOW_ENTRY) {
98
+ if (handback === "paused" && ownsRun && data.kind === "clear") {
99
+ handback = "released";
100
+ continue;
101
+ }
102
+ if (handback === "released" || handback === "rebound") {
103
+ handback = data.kind === "set" && isRecord(data.owner) && data.owner.name === owner.name && data.owner.path === owner.path
104
+ ? "rebound" : "released";
105
+ continue;
106
+ }
85
107
  // A later invocation, even of the same skill, starts a different run.
86
108
  if (foundGoal && ownsRun && (data.kind === "set" || data.kind === "clear")) break;
87
109
  if (data.kind === "clear") ownsRun = false;
@@ -91,6 +113,8 @@ export function boundPlanEntry(entries: Iterable<EntryLike>, owner: WorkflowOwne
91
113
  }
92
114
  }
93
115
  if (entry.customType !== WORKFLOW_PLAN_ENTRY) continue;
116
+ if (handback === "released") continue;
117
+ if (handback === "rebound") { handback = "released"; continue; }
94
118
  if (data.kind === "clear") plan = undefined;
95
119
  else if (data.kind === "set" && data.owner === owner.name && typeof data.path === "string") {
96
120
  plan = { version: 1, kind: "set", owner: owner.name, path: data.path,
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"6b75c05b5a766e6a4253155b5f033179c5c8d34b80a0b18bb61b2dd5ee93c50f"},"sha256":"f3e805e02f0e522291ffed0fae247d7df1541072a2f24ce31a245e85af5e539e"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"04442594dc110af3d73e5075de2094a9fe2b2adb2955de39c84e785a869eb543"},"sha256":"f79ecee29823e829770a4847c3d86d2cbd86bf93f7d097fa4c16b0f1cadd8a52"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"962bc31dd994310104f26862987a9a9d7b40b1992656f11740f9631bd4ec4268"},"sha256":"67a097d04fab43222549b14c21f6ae83fa33df4a9b3ff516e3a1d02c429253e1"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"5cb393f556c1b787e1c0be6d78154f66fd4140b6f29e2030a1c811d1c607b7f3"},"sha256":"356ce80e21bde804765241c0ef150408505c2a039a2792d642dc25c7a494ce30"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"b13c2b2f4a05f16849fdf6b9af288302778b532b8c95a6a09287220d9ad7afab"},"sha256":"a4909b248d73634eb24ed16c83a0ea3339e2003083e5a531837b594042843e95"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"f2e844fedd5a6e14d68f0ab68eb11d378d7d4c55ac2bd0e1d7633583df3265fb"},"sha256":"ec088febda80c19361e0670b32e3ccff03b190e9edcf6926a77eec7433895204"}
@@ -1 +1 @@
1
- {"build":{"format":1,"sourceDigest":"f5d7cfb07e97ced8c15ea5276b43eb2fbde61484151f27c80706797bb9d343fe","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.0","contentId":"125b52e4b01234f3a8af339eb070b95b1ee8a86380cfc4fbd141e9327b8bd101"},"sha256":"81e26d96fd104936c8c79f16d88655930fac3b3c56ae3ac19427ce55551ce1ed"}
1
+ {"build":{"format":1,"sourceDigest":"f07e192489dd63381cb4b9dcfdaf0b6d8dd72e69057bf49f5acbab089cd08c5d","piSdkVersion":"1.7.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"6becccc0aa89805268794027bb9d0927ceab5ca05bee26a346d0d32e568968de","protocolVersion":1,"serverVersion":"0.10.1","contentId":"f0cc8b712cf3f8e34e2f112b713a0d1318991061ce120a107d6351500adf621c"},"sha256":"802c0e819cf9896d840cb4da23cac3b777c7a48711d20ff68d7479764cf75fc4"}
@@ -55,7 +55,7 @@ export async function runtimeStatus(socketPath, agentDir, artifact, timeoutMs =
55
55
  });
56
56
  });
57
57
  }
58
- const runLocal = (command, input, timeoutMs) => new Promise((resolve, reject) => {
58
+ export const runLocal = (command, input, timeoutMs) => new Promise((resolve, reject) => {
59
59
  const child = spawn("/bin/sh", ["-c", command], { stdio: "pipe", timeout: timeoutMs });
60
60
  let stdout = "", stderr = "";
61
61
  child.stdout.on("data", chunk => { stdout += chunk; });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-harness",
3
- "version": "0.61.0",
3
+ "version": "0.61.2",
4
4
  "description": "Pi extension bundle for a write sandbox, subagents, background tasks, SSH, Goals, and Todo lists.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,6 +55,8 @@
55
55
  "lib/prompt.html",
56
56
  "lib/console.html",
57
57
  "lib/prompt.css",
58
+ "lib/console-logo.png",
59
+ "lib/console-icons.svg",
58
60
  "lib/instructions.d.mts",
59
61
  "lib/prompt-tools.d.mts",
60
62
  "extensions/**/*.ts",
@@ -67,7 +69,7 @@
67
69
  },
68
70
  "dependencies": {
69
71
  "pi-better-background-tasks": "0.21.7",
70
- "pi-better-goal": "0.18.1",
72
+ "pi-better-goal": "0.18.2",
71
73
  "pi-better-sandbox": "0.15.2",
72
74
  "pi-better-ssh": "0.1.7",
73
75
  "pi-better-subagents": "0.41.0",