@narumitw/pi-subagents 3.4.2 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @narumitw/pi-subagents
2
2
 
3
+ ## 3.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - cf7b63d: Put editor widget names and short current count/state summaries in their divider lines. Remove duplicate body titles while retaining safety text, detail rows, privacy modes, and standalone RPC/tool output. In fullscreen Pi, click anywhere in a widget to collapse it to one named line, then click that line to restore the latest content. Preserve independent, session-local disclosure through updates without taking editor focus, changing domain data, or stopping background work. Existing owner controls provide keyboard restoration; regular-mode mouse input remains terminal-owned.
8
+
9
+ The Kit minor release supplies the named widget state and publisher disclosure APIs. Changesets raises all adopting consumers' Kit dependency floors in the same Version PR. Publish and verify the exact Kit artifact before its consumers.
10
+ - Updated dependencies [cf7b63d]
11
+ - @narumitw/pi-tui-kit@0.70.0
12
+
3
13
  ## 3.4.2
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -22,18 +22,19 @@ Pi Subagents runs Pi jobs in separate child processes and supports authenticated
22
22
 
23
23
  ## 📦 Install
24
24
 
25
- The version 3 runtime documented here is not yet published to npm.
26
- The npm package still contains the legacy 2.x runtime and does not provide the tools below.
27
-
28
- Install the repository source as one Pi package:
25
+ Install from npm:
29
26
 
30
27
  ```bash
31
- pi install git:github.com/narumiruna/pi-extensions
28
+ pi install npm:@narumitw/pi-subagents
32
29
  ```
33
30
 
34
- This Git installation enables every extension listed in the repository root manifest, including Pi Subagents.
31
+ Try it for one invocation:
35
32
 
36
- To install only Pi Subagents, clone the repository, install dependencies, build its generated runtime, and install its package directory:
33
+ ```bash
34
+ pi -e npm:@narumitw/pi-subagents
35
+ ```
36
+
37
+ To install from a local checkout, clone the repository, install dependencies, build its generated runtime, and install its package directory:
37
38
 
38
39
  ```bash
39
40
  git clone https://github.com/narumiruna/pi-extensions.git
@@ -94,7 +95,7 @@ The widget is TUI-only and contains only queued or running jobs. Each row starts
94
95
  For example, with a main-agent thinking level of `high` at spawn:
95
96
 
96
97
  ```text
97
- Subagents · 2 active
98
+ ─ ▾ Subagents · 1 running · 1 queued ───────
98
99
  ▶ Review widget tests · 12s
99
100
  ○ Audit settings · thinking: medium · queued
100
101
  ```
@@ -107,9 +108,13 @@ The task preview removes terminal controls, collapses whitespace, and uses at mo
107
108
  Task text is visible in this local widget, but `subagent_inspect` continues to omit it. Optional tool names include selected core and extension tools, not fixed communication tools.
108
109
  The widget omits attachment paths and resource totals, disappears when no jobs remain active, and clears when the session ends.
109
110
 
111
+ The separator shows **Subagents** and current running and queued counts, including while collapsed. In fullscreen TUI mode, click anywhere in the widget, including blank columns, to collapse it to that separator. Click the separator to restore the latest jobs without moving keyboard focus.
112
+ Disclosure survives job updates, temporary absence, and host remounts. Select a visible view in `/subagents` to restore disclosure with the keyboard. Session start and tree navigation reset it.
113
+ Collapse does not change jobs, settings, item views, pins, or automatic rules.
114
+
110
115
  Ordinary updates refresh the mounted widget without changing its position among other widgets. Hiding and showing it again can change that position.
111
116
  The widget uses at most ten rows, including one separator, and reserves eight terminal rows for the editor and footer. This is a local height limit, not a calculation of space left by other widgets.
112
- With fewer than two available rows it renders nothing. Short layouts use a summary with active, running, queued, and omitted-row counts. Narrow layouts clip each line to the terminal width.
117
+ With no available rows it renders nothing. One available row shows only the separator with current counts and omitted-row information. Summary view also uses only the separator, but does not count its intentionally absent job rows as omitted. Narrow layouts clip each line to the terminal width.
113
118
 
114
119
  In `/subagents`, **Widget view** provides details, summary, hide/show, pin/unpin, automatic compaction, and item-view reset controls.
115
120
  These controls are session-local and do not write settings. Manual hide remains in effect across job changes until you show the widget again.
package/dist/index.ts CHANGED
@@ -2663,10 +2663,34 @@ var SUBAGENT_WIDGET_MAX_ROWS = 10;
2663
2663
  function subagentWidgetRowBudget(rows) {
2664
2664
  return Number.isFinite(rows) ? Math.min(SUBAGENT_WIDGET_MAX_ROWS, Math.max(0, Math.floor(rows) - SUBAGENT_WIDGET_RESERVED_ROWS)) : 0;
2665
2665
  }
2666
- function renderSubagentWidgetSnapshot(snapshot, theme, width, maxRows) {
2666
+ function subagentWidgetSummary(snapshot, maxRows) {
2667
+ const { jobs, items, mode } = snapshot;
2668
+ const budget = normalizeRowBudget(maxRows);
2669
+ if (!isVisible(snapshot) || budget === 0) return "";
2670
+ const shown = mode === "compact" ? items.length : Math.min(items.length, budget - 1);
2671
+ const omitted = jobs.length - shown;
2672
+ const removed = jobs.length - items.length;
2673
+ const running = jobs.filter((job) => job.state === "running").length;
2674
+ const counts = `${running} running \xB7 ${jobs.length - running} queued`;
2675
+ return `${counts}${omitted > 0 ? ` \xB7 ${omitted} not shown${removed > 0 ? ` (${removed} removed)` : ""}` : ""}`;
2676
+ }
2677
+ function normalizeRowBudget(maxRows) {
2678
+ return Number.isFinite(maxRows) ? Math.max(0, Math.floor(maxRows)) : 0;
2679
+ }
2680
+ function isVisible({ jobs, items, settings, mode }) {
2681
+ return settings.showWidget && mode !== "hidden" && jobs.length > 0 && items.length > 0;
2682
+ }
2683
+ function renderSubagentWidgetSnapshot(snapshot, theme, width, maxRows, includeHeader = true) {
2667
2684
  const { jobs, items, settings, mode } = snapshot;
2668
- const budget = Number.isFinite(maxRows) ? Math.max(0, Math.floor(maxRows)) : 0;
2669
- if (!settings.showWidget || mode === "hidden" || jobs.length === 0 || items.length === 0 || budget < 2) return [];
2685
+ const budget = normalizeRowBudget(maxRows);
2686
+ if (!isVisible(snapshot) || budget < (includeHeader ? 2 : 1)) return [];
2687
+ if (!includeHeader) {
2688
+ const shown = mode === "compact" ? [] : items.slice(0, budget - 1);
2689
+ return new EditorStatusWidget({
2690
+ theme,
2691
+ renderBody: () => shown.map(({ value, mode: itemMode }) => renderJob(value, theme, settings, itemMode === "compact"))
2692
+ }).render(width);
2693
+ }
2670
2694
  const running = jobs.filter((job) => job.state === "running").length;
2671
2695
  const counts = `Subagents \xB7 ${jobs.length} active \xB7 ${running} running \xB7 ${jobs.length - running} queued`;
2672
2696
  const removed = jobs.length - items.length;
@@ -2842,9 +2866,11 @@ function createSubagentWidgetController(runtime) {
2842
2866
  view = createEditorStatusView({ onChange: publish, canCompact: () => settings.showWidget && jobs.length > 0 });
2843
2867
  publisher = createEditorStatusPublisher({
2844
2868
  key: SUBAGENT_WIDGET_KEY,
2869
+ name: "Subagents",
2845
2870
  context: ctx,
2846
2871
  isCurrent,
2847
- render: (snapshot, theme, width, rows) => renderSubagentWidgetSnapshot(snapshot, theme, width, subagentWidgetRowBudget(rows))
2872
+ summary: (snapshot, _width, rows) => subagentWidgetSummary(snapshot, subagentWidgetRowBudget(rows)),
2873
+ render: (snapshot, theme, width, rows) => renderSubagentWidgetSnapshot(snapshot, theme, width, subagentWidgetRowBudget(rows), false)
2848
2874
  });
2849
2875
  if (phase === "maintenance") cyclePhase = phase;
2850
2876
  else if (phase !== "idle") startCycle(phase);
@@ -2853,7 +2879,9 @@ function createSubagentWidgetController(runtime) {
2853
2879
  controls = {
2854
2880
  state: () => ({ mode: ownedView.mode, pinned: ownedView.pinned, trigger: ownedView.trigger }),
2855
2881
  setMode: (mode) => {
2856
- if (isCurrent()) ownedView.setMode(mode);
2882
+ if (!isCurrent()) return;
2883
+ if (mode !== "hidden") publisher?.setCollapsed(false);
2884
+ ownedView.setMode(mode);
2857
2885
  },
2858
2886
  setPinned: (pinned) => {
2859
2887
  if (isCurrent()) ownedView.setPinned(pinned);