@ferris1225/pi-subagents 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +68 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferris1225/pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Focused sub-agent delegation for pi: explore / worker / reviewer agents in isolated context, with proactive dispatch injection and per-agent model selection.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/index.ts
CHANGED
|
@@ -776,54 +776,75 @@ export default function (pi: ExtensionAPI): void {
|
|
|
776
776
|
}
|
|
777
777
|
}, 1000);
|
|
778
778
|
return {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
//
|
|
787
|
-
//
|
|
788
|
-
//
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
779
|
+
render(width: number): string[] {
|
|
780
|
+
const runs = monitor.getRuns();
|
|
781
|
+
if (runs.length === 0) return [];
|
|
782
|
+
const now = Date.now();
|
|
783
|
+
const lines: string[] = [];
|
|
784
|
+
// Tree layout: each top-level agent is a root whose title/activity hang
|
|
785
|
+
// off it as branches; auto-fix chain runs (groupId) become child nodes
|
|
786
|
+
// under their parent root, with a "│" continuation while more siblings
|
|
787
|
+
// follow. Blank lines separate agent blocks so parallel runs don't blur
|
|
788
|
+
// into one wall of text.
|
|
789
|
+
const dim = (t: string): string => theme.fg("dim", t);
|
|
790
|
+
for (let idx = 0; idx < runs.length; idx++) {
|
|
791
|
+
const r = runs[idx];
|
|
792
|
+
const isChain = Boolean(r.groupId);
|
|
793
|
+
const chainContinues = isChain && runs[idx + 1]?.groupId === r.groupId;
|
|
794
|
+
const activity =
|
|
795
|
+
r.activity && (r.status === "running" || r.status === "queued") ? r.activity : undefined;
|
|
796
|
+
const hasActivity = activity !== undefined;
|
|
797
|
+
const icon = statusIcon(r.status, theme);
|
|
798
|
+
// Chain-internal runs (auto-fix worker/reviewer) are child nodes under
|
|
799
|
+
// their parent reviewer. Their relationLabel ("fix round 1") is more
|
|
800
|
+
// distinguishing than the repeated worker/reviewer name.
|
|
801
|
+
const name = isChain ? (r.relationLabel ?? r.agent) : r.agent;
|
|
802
|
+
// Header row stays short: icon, run id, agent name — the task summary
|
|
803
|
+
// (keys-only fragments: paths, symbols, quoted phrases) gets its own
|
|
804
|
+
// line below with a full width budget, so parallel runs of the SAME
|
|
805
|
+
// agent are still distinguishable at a glance.
|
|
806
|
+
const title = formatTaskSummary(r.task, Math.max(16, Math.floor(width * 0.65)), true);
|
|
807
|
+
// Hierarchy: top-level agent names are the visual anchor (accent +
|
|
808
|
+
// bold); chain nodes and all metadata stay quiet, so the widget reads
|
|
809
|
+
// top-down: roots → their branches → the fine print.
|
|
810
|
+
if (!isChain && lines.length > 0) lines.push("");
|
|
811
|
+
const nodeBranch = isChain ? (chainContinues ? "├─ " : "└─ ") : "";
|
|
812
|
+
const left = `${dim(nodeBranch)}${icon} ${dim(`#${r.id}`)} ${isChain ? name : theme.fg("accent", theme.bold(name))}`;
|
|
813
|
+
|
|
814
|
+
// Right side: full model ref (provider/model), token usage (in/out +
|
|
815
|
+
// cache read/write), tool count, elapsed, and the soft activity-state
|
|
816
|
+
// annotation (idle / long-running). Trailing the header with a single
|
|
817
|
+
// " · " chain keeps the row compact (no center gap); compactLine
|
|
818
|
+
// clips on overflow, never the right side on its own.
|
|
819
|
+
const model = r.model ?? "?";
|
|
820
|
+
const usage = formatUsageCompact(r.usage);
|
|
821
|
+
const tools = r.toolCount ? `${r.toolCount} tool${r.toolCount === 1 ? "" : "s"}` : "";
|
|
822
|
+
const elapsed = formatElapsed(r, now);
|
|
823
|
+
const metaParts = [model, usage, tools, elapsed].filter(Boolean);
|
|
824
|
+
// Running is conveyed by the icon + elapsed; spell out the label only for
|
|
825
|
+
// the other states (ready / done / stopped) so they are unambiguous.
|
|
826
|
+
if (r.status !== "running") metaParts.push(statusLabel(r.status));
|
|
827
|
+
const state = deriveActivityState(r, now);
|
|
828
|
+
if (state) metaParts.push(activityStateLabel(state));
|
|
829
|
+
if (r.annotation) metaParts.push(r.annotation);
|
|
830
|
+
const right = metaParts.length ? dim(` · ${metaParts.join(" · ")}`) : "";
|
|
831
|
+
lines.push(compactLine(left, right, width));
|
|
832
|
+
|
|
833
|
+
// Branches hang off the node's content column; chain nodes that still
|
|
834
|
+
// have siblings carry a "│" continuation down to the last one.
|
|
835
|
+
const continuation = isChain ? (chainContinues ? "│ " : " ") : "";
|
|
836
|
+
// Task summary is the first branch; the summary itself is plain text —
|
|
837
|
+
// no accent, so it never competes with the agent name or pi's own UI.
|
|
838
|
+
lines.push(
|
|
839
|
+
rightAlign(`${continuation}${dim(hasActivity ? "├─ " : "└─ ")}${dim("title: ")}${theme.fg("text", title)}`, "", width),
|
|
840
|
+
);
|
|
841
|
+
// Current activity is the last branch, only while the run is active.
|
|
842
|
+
if (hasActivity) {
|
|
843
|
+
lines.push(rightAlign(`${continuation}${dim("└─ ")}${dim(activity)}`, "", width));
|
|
844
|
+
}
|
|
823
845
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
},
|
|
846
|
+
return lines;
|
|
847
|
+
},
|
|
827
848
|
invalidate() {},
|
|
828
849
|
dispose() {
|
|
829
850
|
unsub();
|