shariq-pi-extensions 0.2.28 → 0.2.29

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.
@@ -44,13 +44,13 @@ State is stored in Pi session entries and reconstructed on resume, reload, and t
44
44
 
45
45
  The subagent extension runs flat Pi child agents with profiles, capability policies, continuation, result delivery, optional worktrees, pre-warmed task dispatch, instant cascading cancellation, cross-session persistence, and a dashboard. Configuration lives in `<agent-dir>/subagents.json`; trusted projects may override it through their Pi config directory. The configured concurrency ceiling is 50.
46
46
 
47
- The extension supplies tools including `spawn_agent`, `task`, `check_agent`, `list_agents`, `wait_agent`, `send_message`, `close_agent`, `reply_question`, and `apply_agent_changes`. These lifecycle operations render as compact expandable main-chat cards; only active manager entries contribute to the footer and bounded Active work dock, so persisted history never inflates live failure counts. Cancellation and reload interruption use a distinct `cancelled` state rather than `error`. All completed and cancelled production subagent snapshots and transcripts persist across Pi restarts (`<agent-dir>/subagents/runs/`), allowing `resume_from` to resume completed workers at any point. Interruption immediately cascades across all child fibers in `<10ms`. Child settlement stays in a private extension queue while the parent is active, then starts one custom-result turn at Pi's safe idle edge with the summary guaranteed in model context and never rendered as user-authored or follow-up input; status tools are for explicit inspection, not waiting.
47
+ The extension supplies tools including `spawn_agent`, `task`, `check_agent`, `list_agents`, `wait_agent`, `send_message`, `close_agent`, `reply_question`, and `apply_agent_changes`. These lifecycle operations render as compact expandable main-chat cards; only active manager entries contribute to the bounded Active work dock, while workflow progress is intentionally omitted from the footer so persisted history cannot inflate or duplicate live status. Cancellation and reload interruption use a distinct `cancelled` state rather than `error`. All completed and cancelled production subagent snapshots and transcripts persist across Pi restarts (`<agent-dir>/subagents/runs/`), allowing `resume_from` to resume completed workers at any point. Interruption immediately cascades across all child fibers in `<10ms`. Child settlement stays in a private extension queue while the parent is active, then starts one custom-result turn at Pi's safe idle edge with the summary guaranteed in model context and never rendered as user-authored or follow-up input; status tools are for explicit inspection, not waiting.
48
48
 
49
49
  ### [Orchestration](../extensions/orchestration/README.md)
50
50
 
51
51
  The Orchestration extension coordinates explicitly requested large tasks through a dedicated orchestrator plus configurable explorer, frontend, backend, general-worker, and reviewer models. `/orchestration` opens the dashboard and `/orchestration settings` configures global role models. It reuses the canonical Subagents runtime, maintains a 10-worker pool per project, isolates Git writers in task worktrees, resumes the original worker for substantial review fixes, and applies final reviewed changes without committing or pushing.
52
52
 
53
- The model-facing `create_orchestration` tool starts planning only after an explicit orchestration request. `get_orchestration` reports status without advancing work. Both use compact expandable timeline cards, active runs share the Active work dock, and footer states distinguish plan-ready, blocked, running, and paused work. Dashboard editors and confirmations run outside the live overlay to avoid nested-input stalls. Interrupted runs recover paused under `<agent-dir>/orchestration/`.
53
+ The model-facing `create_orchestration` tool starts planning only after an explicit orchestration request. `get_orchestration` reports status without advancing work. Both use compact expandable timeline cards, and active runs share the full-screen Active work dock with explicit plan-ready, blocked, running, and paused states instead of duplicating workflow progress in the footer. The full-height framed dashboard runs editors and confirmations outside its overlay to avoid nested-input stalls. Interrupted runs recover paused under `<agent-dir>/orchestration/`.
54
54
 
55
55
  ### [Smart Compaction](../extensions/smart-compaction/README.md)
56
56
 
@@ -101,13 +101,7 @@ export default function backgroundTerminals(pi: ExtensionAPI) {
101
101
  }
102
102
  if (next === lastStatus) return;
103
103
  lastStatus = next;
104
- if (!next) ui.setStatus(STATUS_KEY, undefined);
105
- else {
106
- ui.setStatus(
107
- STATUS_KEY,
108
- stateLabel(ui.theme, "active", next),
109
- );
110
- }
104
+ ui.setStatus(STATUS_KEY, undefined);
111
105
  }
112
106
 
113
107
  function flushResult(id: string): void {
@@ -31,7 +31,7 @@ Each project has up to 10 concurrent worker, explorer, or reviewer sessions. The
31
31
 
32
32
  ## Dashboard
33
33
 
34
- Orchestration creation and inspection render as compact main-chat cards with expandable detail. Active runs appear in the shared bounded **Active work** dock; plan-ready and blocked runs are prioritized as attention states. `/orchestration` opens the full-screen operations dashboard. Dashboard actions close the overlay before opening editors, settings, or confirmation prompts, then return to the live dashboard so nested UI cannot stall.
34
+ Orchestration creation and inspection render as compact main-chat cards with expandable detail. Active runs appear in the shared bounded **Active work** dock; plan-ready and blocked runs are prioritized as attention states. `/orchestration` opens a full-height framed operations dashboard with a bounded body and stable selection. Dashboard actions close the overlay before opening editors, settings, or confirmation prompts, then return to the live dashboard so nested UI cannot stall. **New** opens the objective editor before asking for missing role models, so cancelling a draft does not force configuration; cancelling unchanged settings does not claim they were saved.
35
35
 
36
36
  - `j` / `k`: select a run
37
37
  - `Enter`: inspect tasks and reviews
@@ -9,6 +9,7 @@ import {
9
9
  visibleWidth,
10
10
  type TUI,
11
11
  } from "@earendil-works/pi-tui";
12
+ import { frameBottom, frameTop, framedRow, joinSides } from "../shared/tui-dashboard.ts";
12
13
  import type { OrchestrationEngine } from "./engine.ts";
13
14
  import type { OrchestrationRun } from "./types.ts";
14
15
 
@@ -102,9 +103,34 @@ class OrchestrationDashboard {
102
103
  render(width: number) {
103
104
  const runs = this.engine.list();
104
105
  this.reconcileSelection(runs);
105
- const lines = this.detail && runs[this.selected]
106
- ? this.renderDetail(runs[this.selected], width)
107
- : this.renderList(runs, width);
106
+ const selected = runs[this.selected];
107
+ const rows = this.tui.terminal.rows || 30;
108
+ const bodyHeight = Math.max(8, rows - 5);
109
+ const innerWidth = Math.max(1, width - 2);
110
+ const content = this.detail && selected
111
+ ? this.renderDetail(selected, innerWidth)
112
+ : this.renderList(runs, innerWidth);
113
+ const body = content.length > bodyHeight
114
+ ? [...content.slice(0, bodyHeight - 1), this.theme.fg("dim", "… more")]
115
+ : content;
116
+ const status = runs.length
117
+ ? `${runs.filter((run) => ["planning", "running"].includes(run.status)).length} active · ${runs.length} total`
118
+ : "idle";
119
+ const controls = this.detail && selected
120
+ ? [
121
+ selected.status === "awaiting-approval" ? "a approve · f feedback" : "",
122
+ ["paused", "interrupted", "blocked"].includes(selected.status) ? "p resume" : selected.status === "running" ? "p pause" : "",
123
+ !["completed", "cancelled"].includes(selected.status) ? "x cancel" : "",
124
+ "esc back",
125
+ ].filter(Boolean).join(" · ")
126
+ : "j/k select · enter open · n new · s settings · esc close";
127
+ const lines = [
128
+ joinSides(` ${this.theme.fg("accent", this.theme.bold("◆ ORCHESTRATION"))}`, `${this.theme.fg("muted", status)} `, width),
129
+ frameTop(this.theme, width, this.detail && selected ? `${selected.id} · RUN DETAIL` : `${runs.length} RUN${runs.length === 1 ? "" : "S"} · CONTROL CENTER`),
130
+ ];
131
+ for (let row = 0; row < bodyHeight; row++) lines.push(framedRow(this.theme, body[row] ?? "", width));
132
+ lines.push(frameBottom(this.theme, width));
133
+ lines.push(truncateToWidth(this.theme.fg("dim", ` ${controls}`), width, ""));
108
134
  return lines.map((line) => truncateToWidth(line, width, ""));
109
135
  }
110
136
 
@@ -115,14 +141,7 @@ class OrchestrationDashboard {
115
141
  }
116
142
 
117
143
  private renderList(runs: OrchestrationRun[], width: number) {
118
- const lines = [
119
- this.split(
120
- this.theme.fg("accent", this.theme.bold("Orchestration")),
121
- this.theme.fg("dim", `${runs.length} run${runs.length === 1 ? "" : "s"}`),
122
- width,
123
- ),
124
- this.theme.fg("borderMuted", "─".repeat(Math.max(0, width))),
125
- ];
144
+ const lines: string[] = [];
126
145
  if (!runs.length) lines.push(this.theme.fg("muted", "No runs yet. Press n to create one."));
127
146
  const rows = this.tui.terminal.rows || 30;
128
147
  const visibleCount = Math.max(1, Math.floor((rows - 5) / 2));
@@ -142,13 +161,10 @@ class OrchestrationDashboard {
142
161
  );
143
162
  lines.push(` ${this.theme.fg("dim", `${run.id} · ${run.cwd}`)}`);
144
163
  }
145
- if (start > 0) lines.splice(2, 0, this.theme.fg("dim", ` ↑ ${start} more`));
164
+ if (start > 0) lines.unshift(this.theme.fg("dim", ` ↑ ${start} more`));
146
165
  const below = runs.length - start - visible.length;
147
166
  if (below > 0) lines.push(this.theme.fg("dim", ` ↓ ${below} more`));
148
- lines.push("", this.theme.fg("dim", "j/k select · enter open · n new · s settings · esc close"));
149
- const maxRows = Math.max(8, rows);
150
- if (lines.length <= maxRows) return lines;
151
- return [...lines.slice(0, maxRows - 2), this.theme.fg("dim", "… more runs"), lines.at(-1)!];
167
+ return lines;
152
168
  }
153
169
 
154
170
  private renderDetail(run: OrchestrationRun, width: number) {
@@ -179,16 +195,7 @@ class OrchestrationDashboard {
179
195
  }
180
196
  if (run.finalReviewSummary) lines.push("", this.theme.fg("accent", `Final review: ${run.finalReviewSummary}`));
181
197
  if (run.error) lines.push("", this.theme.fg("error", run.error));
182
- const controls = [
183
- run.status === "awaiting-approval" ? "a approve · f feedback" : "",
184
- ["paused", "interrupted", "blocked"].includes(run.status) ? "p resume" : run.status === "running" ? "p pause" : "",
185
- !["completed", "cancelled"].includes(run.status) ? "x cancel" : "",
186
- "esc back",
187
- ].filter(Boolean).join(" · ");
188
- lines.push("", this.theme.fg("dim", controls));
189
- const maxRows = Math.max(8, (this.tui.terminal.rows || 30) - 2);
190
- if (lines.length <= maxRows) return lines;
191
- return [...lines.slice(0, maxRows - 2), this.theme.fg("dim", "… more tasks in run state"), lines.at(-1)!];
198
+ return lines;
192
199
  }
193
200
  }
194
201
 
@@ -7,7 +7,7 @@ import { Text } from "@earendil-works/pi-tui";
7
7
  import { Type } from "typebox";
8
8
  import { clearActivitySource, setActivitySource } from "../shared/activity-dock.ts";
9
9
  import { toolCallCard, toolResultCard } from "../shared/tool-card.ts";
10
- import { oneLine, stateLabel } from "../shared/tui-dashboard.ts";
10
+ import { oneLine } from "../shared/tui-dashboard.ts";
11
11
  import {
12
12
  requestSubagentCoordinator,
13
13
  type SubagentCoordinator,
@@ -55,18 +55,7 @@ export default function orchestration(pi: ExtensionAPI) {
55
55
  ui.setStatus("orchestration", undefined);
56
56
  return;
57
57
  }
58
- const awaiting = active.filter((run) => run.status === "awaiting-approval").length;
59
- const blocked = active.filter((run) => run.status === "blocked").length;
60
- const running = active.filter((run) => run.status === "running" || run.status === "planning").length;
61
- const paused = active.filter((run) => ["paused", "interrupted"].includes(run.status)).length;
62
- const text = awaiting
63
- ? `${awaiting} plan${awaiting === 1 ? "" : "s"} ready · /orchestration`
64
- : blocked
65
- ? `${blocked} blocked · /orchestration`
66
- : running
67
- ? `${running} running · /orchestration`
68
- : `${paused} paused · /orchestration`;
69
- ui.setStatus("orchestration", stateLabel(ui.theme, awaiting || blocked ? "warning" : running ? "active" : "muted", `Orchestration ${text}`));
58
+ ui.setStatus("orchestration", undefined);
70
59
  };
71
60
 
72
61
  const requireEngine = () => {
@@ -91,12 +80,12 @@ export default function orchestration(pi: ExtensionAPI) {
91
80
  };
92
81
 
93
82
  const createFromUi = async (ctx: ExtensionContext) => {
94
- await ensureModels(ctx);
95
83
  const objective = await ctx.ui.editor(
96
84
  "New orchestration objective",
97
85
  "Describe the complete outcome, boundaries, and requirements…",
98
86
  );
99
87
  if (!objective?.trim()) return;
88
+ await ensureModels(ctx);
100
89
  try {
101
90
  const run = await requireEngine().create(objective, ctx.cwd);
102
91
  ctx.ui.notify(`Started dedicated planning agent for ${run.id}.`, "info");
@@ -9,6 +9,7 @@ const THINKING = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as
9
9
 
10
10
  export async function openOrchestrationSettings(ctx: ExtensionContext) {
11
11
  const settings = loadOrchestrationSettings();
12
+ let changed = false;
12
13
  for (;;) {
13
14
  const choices = [
14
15
  ...ORCHESTRATION_ROLES.map((role) =>
@@ -35,7 +36,8 @@ export async function openOrchestrationSettings(ctx: ExtensionContext) {
35
36
  thinking: (thinking as (typeof THINKING)[number] | undefined) ?? settings.roles[role].thinking,
36
37
  };
37
38
  saveOrchestrationSettings(settings);
39
+ changed = true;
38
40
  }
39
- saveOrchestrationSettings(settings);
40
- ctx.ui.notify("Orchestration settings saved.", "info");
41
+ if (changed) ctx.ui.notify("Orchestration settings saved.", "info");
42
+ return changed;
41
43
  }
@@ -39,10 +39,7 @@ import {
39
39
  type SubagentOrigin,
40
40
  type SubagentSnapshot,
41
41
  } from "./src/domain.ts";
42
- import {
43
- formatActivityStatus,
44
- formatContextUtilization,
45
- } from "./src/format.ts";
42
+ import { formatContextUtilization } from "./src/format.ts";
46
43
  import { SubagentManager, type SubagentManagerShape } from "./src/manager.ts";
47
44
  import {
48
45
  buildSubagentResultMessage,
@@ -514,7 +511,6 @@ export default function (pi: ExtensionAPI) {
514
511
  if (!ui) return;
515
512
  const subs = manager.view.active();
516
513
  const runningSnapshots = subs.filter((snap) => snap.status === "running");
517
- const failed = subs.filter((snap) => snap.status === "error").length;
518
514
  if (activityContext) {
519
515
  setActivitySource(activityContext, "subagents", runningSnapshots.map((snap) => {
520
516
  const activeTool = snap.liveTools.find((tool) => !tool.done)?.name;
@@ -528,14 +524,7 @@ export default function (pi: ExtensionAPI) {
528
524
  };
529
525
  }));
530
526
  }
531
- if (runningSnapshots.length === 0 && failed === 0) {
532
- ui.setStatus("subagents", undefined);
533
- return;
534
- }
535
- ui.setStatus(
536
- "subagents",
537
- formatActivityStatus(ui.theme, { running: runningSnapshots.length, done: 0, failed }),
538
- );
527
+ ui.setStatus("subagents", undefined);
539
528
  };
540
529
 
541
530
  const deliverResult = (snap: SubagentSnapshot) => {
@@ -130,15 +130,9 @@ export default function taskListExtension(pi: ExtensionAPI) {
130
130
  state: (task.status === "in_progress" ? "active" : task.status === "completed" ? "success" : task.status === "blocked" ? "error" : "muted") as ActivityState,
131
131
  priority: task.status === "blocked" ? 100 : task.status === "in_progress" ? 60 : 10,
132
132
  })));
133
- if (active) {
134
- const status = counts.blocked > 0
135
- ? `Tasks ${counts.completed}/${counts.total} · ${counts.blocked} blocked`
136
- : `Tasks ${counts.completed}/${counts.total} · ${counts.inProgress} active`;
137
- ctx.ui.setStatus(ACTIVITY_SOURCE, ctx.ui.theme.fg(counts.blocked > 0 ? "warning" : "accent", status));
138
- return;
139
- }
133
+ ctx.ui.setStatus(ACTIVITY_SOURCE, undefined);
134
+ if (active) return;
140
135
 
141
- ctx.ui.setStatus(ACTIVITY_SOURCE, ctx.ui.theme.fg("success", `Tasks complete ${counts.completed}/${counts.total}`));
142
136
  finishedTimer = setTimeout(() => {
143
137
  finishedTimer = undefined;
144
138
  if (lastCtx !== ctx || hasActiveTasks(state)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shariq-pi-extensions",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "description": "Cross-platform extension suite for the Pi coding agent.",
5
5
  "license": "MIT",
6
6
  "author": "Shariq Riaz",