@narumitw/pi-subagents 3.4.0 → 3.4.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,137 @@
1
+ # @narumitw/pi-subagents
2
+
3
+ ## 3.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 54f2700: Preserve fullscreen viewport capture through custom list wrappers so default and configured paging keys reach the focused list. Keep native transcript search, unrelated overlays, free-text modes, paste, and hard cancellation unchanged. Filter Kit key hints according to each screen's capture policy.
8
+
9
+ Update Recall and File Context to the current Kit dependency range. The selected consumer releases require the fixed Kit patch through Changesets dependency-floor updates.
10
+ - e484010: Include the existing package-root CHANGELOG.md in extension tarballs so Pi can show native update notices. Keep Changesets version headings and Pi's first-observation and collapseChangelog behavior unchanged.
11
+ - 5120d4d: Preserve TypeBox enum inference for direct imports and Pi's extension loader without changing provider-visible schemas or validation rules. Import Notes schemas from TypeBox, declare its host-provided peer, and complete Worktree's command result contract for the updated Pi APIs.
12
+ - 51e74e1: Use the host-injected key formatter for completion and broker-message expansion hints. Omit hints when the action is unbound or the host does not supply renderer key formatting, while preserving expanded content and terminal sanitization.
13
+ - Updated dependencies [54f2700]
14
+ - Updated dependencies [6c76ef1]
15
+ - @narumitw/pi-tui-kit@0.69.0
16
+
17
+ ## 3.4.1
18
+
19
+ ### Patch Changes
20
+
21
+ - 5803891: Wake an idle main agent when a subagent job reaches a terminal state. Keep steering delivery for a running main agent and suppress stale completions after session replacement or shutdown.
22
+
23
+ ## 3.4.0
24
+
25
+ ### Minor Changes
26
+
27
+ - a21d39b: Add opt-in editor status presentation helpers for stable snapshot publication, session-local view controls, and bounded whole-snapshot collections. Keep the existing EditorStatusWidget API unchanged.
28
+
29
+ Retain visible Progress, Subagents, and Herdr widgets during updates. Add bounded summaries, manual view and item controls, and explicit one-shot compaction policies to Progress and Subagents without changing task state or persistent defaults. Preserve Progress completion retention and keep Herdr observation policies local. Keep tree navigation and manual context compaction separate from response-cycle tracking.
30
+ - 106ef89: Add optional `provider` and `model` parameters to `subagent_spawn`. Each omitted value inherits independently from the effective parent model at spawn time. Explicit IDs use exact matching without fallback, including listed case-distinct and provider-prefixed IDs. Only the child checks model registration and current availability. The requested pair bypasses CLI pattern matching and is bound exactly before the child receives its task. A missing or unavailable model fails the job after `subagent_spawn` returns its `jobId`.
31
+
32
+ Unlisted custom model IDs previously accepted through Pi's CLI now fail, including inherited IDs. Register each exact model in Pi's `models.json` or attach a trusted extension that registers it in the child. Parent-only providers, runtime API keys, and virtual routing state are not forwarded. Reload or replace the session after upgrading to load the new tool schema.
33
+
34
+ Reject oversized provider and model IDs before character validation. Schema bounds and runtime byte checks use the existing shared 16 KiB child-bootstrap limit without adding a shorter naming limit.
35
+
36
+ ### Patch Changes
37
+
38
+ - 1e33872: Use task-first widget rows and hide job IDs and tool names by default while preserving saved preferences. Show thinking only when it differs from the main agent's level captured at spawn. Omit redundant running labels and unset timeout text; show elapsed time for running jobs and queued status for waiting jobs.
39
+ - 99b7c92: Show provider and model IDs in expanded widget rows only when they differ from the main agent's effective values captured at spawn, matching thinking-level display. Keep inherited and explicit-equal values hidden, and preserve each job's comparison after parent model changes.
40
+ - Updated dependencies [a21d39b]
41
+ - Updated dependencies [f68aa54]
42
+ - Updated dependencies [b062d21]
43
+ - @narumitw/pi-tui-kit@0.68.0
44
+
45
+ ## 3.3.3
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [57eeae7]
50
+ - @narumitw/pi-tui-kit@0.67.0
51
+
52
+ ## 3.3.2
53
+
54
+ ### Patch Changes
55
+
56
+ - 168248c: Reuse published TUI Kit frame metadata, masked input, configured-key syntax, and interaction ownership while retaining extension-owned settings and cancellation policy. Keep malformed Ticker key strings from suppressing valid reorder shortcuts, and drain Usage settings saves after cancellation.
57
+
58
+ ## 3.3.1
59
+
60
+ ### Patch Changes
61
+
62
+ - 9edf94b: Show each active job’s spawn-time thinking level in the above-editor widget.
63
+
64
+ ## 3.3.0
65
+
66
+ ### Minor Changes
67
+
68
+ - 53730f9: Add the `/subagents` job manager and `/subagents settings` route. Support confirmed active-job cancellation and persistent widget, job ID, tool, and timing display preferences without changing model tools or job execution.
69
+
70
+ ### Patch Changes
71
+
72
+ - 9f80b89: Reuse published Kit interaction ownership for native Progress and Subagents settings while preserving ordered saves, rollback, and durable-save recovery after the screen closes.
73
+
74
+ Share passive widget framing in Subagents, Tool, Plan Mode, and Cache Hit Monitor. Keep domain rendering and lifecycle ownership local, bound narrow and invalid widths, and retain lazy loading of Kit menus and other interactive APIs.
75
+ - 3dd82ec: Add transcript expansion and collapse for child requests and responses using Pi's configured tool-output expansion key.
76
+ - Updated dependencies [077137a]
77
+ - Updated dependencies [9f80b89]
78
+ - Updated dependencies [efc474c]
79
+ - @narumitw/pi-tui-kit@0.66.0
80
+
81
+ ## 3.2.1
82
+
83
+ ### Patch Changes
84
+
85
+ - dfc020b: Show a sanitized, shortened preview of each active subagent's existing task in the TUI widget without changing the spawn schema or inspection metadata.
86
+
87
+ ## 3.2.0
88
+
89
+ ### Minor Changes
90
+
91
+ - ca27497: Allow subagent jobs to select Pi's native codemode tool explicitly, with startup readiness verification and unchanged default tools.
92
+
93
+ ## 3.1.1
94
+
95
+ ### Patch Changes
96
+
97
+ - 68c4b95: Update runtime dependencies and preserve Pi tool-context types through the LSP session lifecycle guard for compatibility with current Pi releases.
98
+
99
+ ## 3.1.0
100
+
101
+ ### Minor Changes
102
+
103
+ - aec9773: Allow each subagent job to attach validated local skills and trusted extensions with an attested initial tool allowlist.
104
+
105
+ ## 3.0.2
106
+
107
+ ### Patch Changes
108
+
109
+ - 8abd5b7: Keep generated extension runtime graphs inside Pi's Jiti-loaded TypeScript path to avoid duplicate peer-runtime evaluation during startup. Add measured generated runtimes for Context Management, Herdr, and TypeSafe Search.
110
+
111
+ ## 3.0.1
112
+
113
+ ### Patch Changes
114
+
115
+ - 99f0bcc: Start subagent jobs from Pi's bundled executable when the package manifest points to a source-only CLI path.
116
+
117
+ ## 3.0.0
118
+
119
+ ### Major Changes
120
+
121
+ - 99c304e: Replace the legacy orchestration runtime with subagent jobs and authenticated main-agent messaging.
122
+
123
+ Remove `/subagents`, extension settings, persisted and retained agents, the previous blocking orchestration interfaces, custom agent catalogs, advanced orchestration, alternate transports, trust-aware cwd policy, and extension-owned worktrees.
124
+
125
+ Use `subagent_spawn`, `subagent_inspect`, `subagent_cancel`, `subagent_wait`, and the context-specific main-agent and child `subagent_send` contracts directly or through a user-designed skill after upgrading, and start a fresh Pi session so stored calls do not request removed tool names or the legacy `subagent_send` schema.
126
+
127
+ Main agents can send requests to queued or running jobs, and children can send requests to main, while either side answers with the same request ID through `subagent_send`.
128
+
129
+ A queued main-agent request interrupts active child response waits without consuming the original child requests, so RPC steering can proceed and those waits can be retried.
130
+
131
+ The package no longer registers or publishes a delegation skill, while the repository keeps `using-pi-subagents` as an example for designing one.
132
+
133
+ Completion messages follow Pi's global tool-output expansion state and configured `app.tools.expand` binding.
134
+
135
+ ### Patch Changes
136
+
137
+ - e55825e: Update the repository-only example skill to require independent work or a concrete context-isolation benefit before delegating to a subagent.
package/README.md CHANGED
@@ -62,6 +62,7 @@ Call `subagent_spawn` with a self-contained task and only the work tools that ta
62
62
 
63
63
  The call returns a `jobId` immediately, and the job continues in the background.
64
64
  Continue useful main-agent work until the result is required or a completion arrives.
65
+ A completion starts a new main-agent model turn if the main agent is idle.
65
66
 
66
67
  In TUI mode, the widget above the editor shows queued and running tasks; no new parameter is required.
67
68
 
@@ -72,8 +73,9 @@ Use messaging only when needed:
72
73
  - Answer a child-originated request by calling `subagent_send` with its `requestId`.
73
74
 
74
75
  Completion messages and child requests and responses follow Pi's global tool-output expansion state and the `app.tools.expand` binding (`Ctrl+O` by default).
75
- Collapsed messages show a summary and the configured expansion key; expanded messages show the full content.
76
- This display state does not change the content sent to the model.
76
+ Collapsed messages show a summary and the host's configured expansion keys.
77
+ The hint is omitted when the action is unbound or an older host does not supply renderer key formatting.
78
+ Expanded messages show the full content; this display state does not change the content sent to the model.
77
79
 
78
80
  ## 💬 Commands
79
81
 
@@ -321,7 +323,6 @@ Parallel writers require disjoint ownership or workspace isolation outside this
321
323
  - The extension does not provide custom agents, custom system prompts, peer-to-peer child messaging, retained conversations, user-directed follow-up work, mailboxes, Agent Teams, chains, fan-in aggregators, panels, workflow DAGs, dynamic scheduling, verification orchestration, nested subagents, or extension-owned semantic memory.
322
324
  - Bidirectional messages use request-response coordination, not a retained conversational session.
323
325
  - The main agent must verify child claims against the actual diff and deterministic checks.
324
- - Child requests and responses trigger a main-agent turn, but asynchronous job completions do not wake an otherwise idle model turn automatically.
325
326
  - Jobs, broker requests, and retained results do not survive extension reload, session replacement, or process exit.
326
327
 
327
328
  ## 🗂️ Package layout
@@ -108,6 +108,9 @@ async function showSubagentSettings(ctx, options) {
108
108
  () => complete("back")
109
109
  );
110
110
  return {
111
+ get capturesViewportInput() {
112
+ return list.capturesViewportInput;
113
+ },
111
114
  render(width) {
112
115
  if (!current()) complete("stale");
113
116
  renderedWidth = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;
@@ -182,4 +185,4 @@ async function showSubagentSettings(ctx, options) {
182
185
  export {
183
186
  showSubagentSettings
184
187
  };
185
- //# sourceMappingURL=settings-ui-24GHO6E2.ts.map
188
+ //# sourceMappingURL=settings-ui-KOX3DMZP.ts.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/settings-ui.ts"],
4
- "sourcesContent": ["import { stripVTControlCharacters } from \"node:util\";\nimport { type ExtensionCommandContext, getSettingsListTheme } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, type SettingItem, SettingsList, Text, type TuiMouseEvent } from \"@earendil-works/pi-tui\";\nimport {\n HorizontalRule,\n renderBoundedFrameLayout,\n runCustomInteraction,\n sanitizeTerminalText,\n} from \"@narumitw/pi-tui-kit\";\nimport type { SubagentSettings } from \"./settings.js\";\n\ninterface SubagentSettingsUIOptions {\n signal: AbortSignal;\n isCurrent(): boolean;\n get(): SubagentSettings;\n save(key: keyof SubagentSettings, value: boolean, signal: AbortSignal): Promise<SubagentSettings>;\n apply(settings: SubagentSettings): void;\n}\n\ntype CloseReason = \"back\" | \"close\" | \"stale\";\n\nconst SETTINGS: { key: keyof SubagentSettings; label: string; description: string }[] = [\n { key: \"showWidget\", label: \"Show widget\", description: \"Show subagent jobs above the editor.\" },\n { key: \"showJobId\", label: \"Show job ID\", description: \"Show job IDs in the widget.\" },\n { key: \"showTools\", label: \"Show tools\", description: \"Show active tools in the widget.\" },\n { key: \"showTiming\", label: \"Show timing\", description: \"Show job timing in the widget.\" },\n];\n\nexport async function showSubagentSettings(\n ctx: ExtensionCommandContext,\n options: SubagentSettingsUIOptions,\n): Promise<CloseReason> {\n const result = await runCustomInteraction<CloseReason>(ctx, {\n signal: options.signal,\n isCurrent: options.isCurrent,\n // The command owner reports interaction failures and non-TUI settings paths.\n onError: () => {},\n create({ tui, theme, signal, complete }) {\n let queue = Promise.resolve();\n const current = () => !signal.aborted && options.isCurrent();\n const revisions = new Map<string, number>();\n const pending = new Map<string, number>();\n const mouseRows = new Map<number, number>();\n let renderedWidth = 0;\n let contentHeight = 0;\n let mousePressed = false;\n const reportFailure = (message: string) => {\n if (!current()) return;\n try {\n ctx.ui.notify(sanitizeTerminalText(`Could not save pi-subagents.json: ${message}`), \"error\");\n } catch {\n // The host can dispose its notifier after the ownership check.\n }\n };\n const rule = new HorizontalRule({ ruleStyle: (text) => theme.fg(\"border\", text) });\n // Keep native SettingsList semantics, but use this screen's callback theme.\n const listTheme = {\n ...getSettingsListTheme(),\n label: (text: string, selected: boolean) => (selected ? theme.fg(\"accent\", text) : text),\n value: (text: string, selected: boolean) => theme.fg(selected ? \"accent\" : \"muted\", text),\n description: (text: string) => theme.fg(\"dim\", text),\n cursor: theme.fg(\"accent\", \"\u2192 \"),\n hint: (text: string) => theme.fg(\"dim\", text),\n };\n const initial = options.get();\n const items: SettingItem[] = SETTINGS.map(({ key, label, description }) => ({\n id: key,\n label,\n description,\n currentValue: String(initial[key]),\n values: [\"true\", \"false\"],\n }));\n const list = new SettingsList(\n items,\n items.length,\n listTheme,\n (id, value) => {\n if (!current()) return;\n const key = id as keyof SubagentSettings;\n const revision = (revisions.get(id) ?? 0) + 1;\n revisions.set(id, revision);\n pending.set(id, revision);\n queue = queue\n .then(async () => {\n if (!current()) {\n complete(\"stale\");\n return;\n }\n const before = { ...options.get() };\n let effective = before;\n try {\n const settings = await options.save(key, value === \"true\", signal);\n // A successful rename is durable, even when closing aborted the save signal.\n if (!options.isCurrent()) {\n complete(\"stale\");\n return;\n }\n options.apply(settings);\n effective = options.get();\n } catch (error) {\n if (!options.isCurrent()) {\n complete(\"stale\");\n return;\n }\n let message = error instanceof Error ? error.message : String(error);\n try {\n options.apply(before);\n } catch (rollbackError) {\n message += `; could not restore effective settings: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`;\n }\n reportFailure(message);\n }\n if (!current()) return;\n if (pending.get(id) === revision) pending.delete(id);\n // Saving rereads the full document, including unrelated manual edits. Keep newer\n // optimistic choices, but refresh every row with no outstanding user change.\n for (const { key: settingKey } of SETTINGS) {\n if (!pending.has(settingKey)) list.updateValue(settingKey, String(effective[settingKey]));\n }\n tui.requestRender();\n })\n .catch((error: unknown) => {\n // A failed action must not prevent later requests from entering the queue.\n reportFailure(error instanceof Error ? error.message : String(error));\n });\n },\n () => complete(\"back\"),\n );\n return {\n render(width: number) {\n if (!current()) complete(\"stale\");\n renderedWidth = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;\n listTheme.cursor = theme.fg(\"accent\", \"\u2192 \");\n // The native footer hardcodes keys. Advertise only the hard-cancel key owned here;\n // configured native navigation, change, and Back actions remain unchanged.\n const content = list.render(Math.max(4, renderedWidth)).slice(0, -2);\n contentHeight = content.length;\n const focusedRow = content.findIndex((line) => stripVTControlCharacters(line).startsWith(\"\u2192\"));\n mouseRows.clear();\n\n const terminalRows = Number.isFinite(tui.terminal.rows) ? Math.floor(tui.terminal.rows) : 24;\n const frame = renderBoundedFrameLayout({\n width: renderedWidth,\n maxRows: Math.max(1, terminalRows - 3),\n rule: rule.render(renderedWidth)[0] ?? \"\",\n title: new Text(theme.fg(\"accent\", theme.bold(\"Subagents Settings\")), 0, 0).render(renderedWidth),\n context: [theme.fg(\"muted\", \"Saved changes apply immediately.\")],\n content,\n hints: new Text(theme.fg(\"muted\", \"Ctrl+C close\"), 0, 0).render(renderedWidth),\n priorityRows: focusedRow < 0 ? [] : [focusedRow],\n focusedRow,\n });\n for (const { frameIndex, contentIndex } of frame.contentRows) mouseRows.set(frameIndex, contentIndex);\n return frame.lines;\n },\n invalidate() {\n mouseRows.clear();\n mousePressed = false;\n list.invalidate();\n },\n handleInput(data: string) {\n if (!current()) return complete(\"stale\");\n mouseRows.clear();\n mousePressed = false;\n if (matchesKey(data, Key.ctrl(\"c\"))) complete(\"close\");\n else {\n // SettingsList uses Pi's effective native keybindings for standard actions.\n list.handleInput(data);\n }\n tui.requestRender();\n },\n handleMouse(event: TuiMouseEvent) {\n if (!current()) {\n complete(\"stale\");\n return;\n }\n const nativeRow = mouseRows.get(event.y);\n if (nativeRow === undefined || event.x < 0 || event.x >= renderedWidth) {\n if (event.button === \"left\" && (event.type === \"press\" || event.type === \"click\")) mousePressed = false;\n return;\n }\n const nativeEvent = { ...event, y: nativeRow, width: renderedWidth, height: contentHeight };\n if (event.type === \"click\" && event.button === \"left\" && !mousePressed) {\n list.handleMouse({ ...nativeEvent, type: \"press\" });\n }\n const result = list.handleMouse(nativeEvent);\n if (event.type === \"press\" && event.button === \"left\") mousePressed = result?.handled === true;\n if (event.type === \"click\" || event.type === \"wheel\") mousePressed = false;\n if (result?.handled && result.render !== false) tui.requestRender();\n return result;\n },\n waitForPending() {\n return queue;\n },\n dispose() {\n mouseRows.clear();\n mousePressed = false;\n },\n };\n },\n });\n if (result.kind === \"error\") throw result.error;\n return result.kind === \"completed\" ? result.value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BAAM,cAAc,EAAE,GAAG,OAAO,GAAG,WAAW,OAAO,eAAe,QAAQ,cAAc;AAC1F,cAAI,MAAM,SAAS,WAAW,MAAM,WAAW,UAAU,CAAC,cAAc;AACtE,iBAAK,YAAY,EAAE,GAAG,aAAa,MAAM,QAAQ,CAAC;AAAA,UACpD;AACA,gBAAMA,UAAS,KAAK,YAAY,WAAW;AAC3C,cAAI,MAAM,SAAS,WAAW,MAAM,WAAW,OAAQ,gBAAeA,SAAQ,YAAY;AAC1F,cAAI,MAAM,SAAS,WAAW,MAAM,SAAS,QAAS,gBAAe;AACrE,cAAIA,SAAQ,WAAWA,QAAO,WAAW,MAAO,KAAI,cAAc;AAClE,iBAAOA;AAAA,QACT;AAAA,QACA,iBAAiB;AACf,iBAAO;AAAA,QACT;AAAA,QACA,UAAU;AACR,oBAAU,MAAM;AAChB,yBAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACD,MAAI,OAAO,SAAS,QAAS,OAAM,OAAO;AAC1C,SAAO,OAAO,SAAS,cAAc,OAAO,QAAQ,OAAO,SAAS,gBAAgB,SAAS;AAC/F;",
4
+ "sourcesContent": ["import { stripVTControlCharacters } from \"node:util\";\nimport { type ExtensionCommandContext, getSettingsListTheme } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, type SettingItem, SettingsList, Text, type TuiMouseEvent } from \"@earendil-works/pi-tui\";\nimport {\n HorizontalRule,\n renderBoundedFrameLayout,\n runCustomInteraction,\n sanitizeTerminalText,\n} from \"@narumitw/pi-tui-kit\";\nimport type { SubagentSettings } from \"./settings.js\";\n\ninterface SubagentSettingsUIOptions {\n signal: AbortSignal;\n isCurrent(): boolean;\n get(): SubagentSettings;\n save(key: keyof SubagentSettings, value: boolean, signal: AbortSignal): Promise<SubagentSettings>;\n apply(settings: SubagentSettings): void;\n}\n\ntype CloseReason = \"back\" | \"close\" | \"stale\";\n\nconst SETTINGS: { key: keyof SubagentSettings; label: string; description: string }[] = [\n { key: \"showWidget\", label: \"Show widget\", description: \"Show subagent jobs above the editor.\" },\n { key: \"showJobId\", label: \"Show job ID\", description: \"Show job IDs in the widget.\" },\n { key: \"showTools\", label: \"Show tools\", description: \"Show active tools in the widget.\" },\n { key: \"showTiming\", label: \"Show timing\", description: \"Show job timing in the widget.\" },\n];\n\nexport async function showSubagentSettings(\n ctx: ExtensionCommandContext,\n options: SubagentSettingsUIOptions,\n): Promise<CloseReason> {\n const result = await runCustomInteraction<CloseReason>(ctx, {\n signal: options.signal,\n isCurrent: options.isCurrent,\n // The command owner reports interaction failures and non-TUI settings paths.\n onError: () => {},\n create({ tui, theme, signal, complete }) {\n let queue = Promise.resolve();\n const current = () => !signal.aborted && options.isCurrent();\n const revisions = new Map<string, number>();\n const pending = new Map<string, number>();\n const mouseRows = new Map<number, number>();\n let renderedWidth = 0;\n let contentHeight = 0;\n let mousePressed = false;\n const reportFailure = (message: string) => {\n if (!current()) return;\n try {\n ctx.ui.notify(sanitizeTerminalText(`Could not save pi-subagents.json: ${message}`), \"error\");\n } catch {\n // The host can dispose its notifier after the ownership check.\n }\n };\n const rule = new HorizontalRule({ ruleStyle: (text) => theme.fg(\"border\", text) });\n // Keep native SettingsList semantics, but use this screen's callback theme.\n const listTheme = {\n ...getSettingsListTheme(),\n label: (text: string, selected: boolean) => (selected ? theme.fg(\"accent\", text) : text),\n value: (text: string, selected: boolean) => theme.fg(selected ? \"accent\" : \"muted\", text),\n description: (text: string) => theme.fg(\"dim\", text),\n cursor: theme.fg(\"accent\", \"\u2192 \"),\n hint: (text: string) => theme.fg(\"dim\", text),\n };\n const initial = options.get();\n const items: SettingItem[] = SETTINGS.map(({ key, label, description }) => ({\n id: key,\n label,\n description,\n currentValue: String(initial[key]),\n values: [\"true\", \"false\"],\n }));\n const list = new SettingsList(\n items,\n items.length,\n listTheme,\n (id, value) => {\n if (!current()) return;\n const key = id as keyof SubagentSettings;\n const revision = (revisions.get(id) ?? 0) + 1;\n revisions.set(id, revision);\n pending.set(id, revision);\n queue = queue\n .then(async () => {\n if (!current()) {\n complete(\"stale\");\n return;\n }\n const before = { ...options.get() };\n let effective = before;\n try {\n const settings = await options.save(key, value === \"true\", signal);\n // A successful rename is durable, even when closing aborted the save signal.\n if (!options.isCurrent()) {\n complete(\"stale\");\n return;\n }\n options.apply(settings);\n effective = options.get();\n } catch (error) {\n if (!options.isCurrent()) {\n complete(\"stale\");\n return;\n }\n let message = error instanceof Error ? error.message : String(error);\n try {\n options.apply(before);\n } catch (rollbackError) {\n message += `; could not restore effective settings: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`;\n }\n reportFailure(message);\n }\n if (!current()) return;\n if (pending.get(id) === revision) pending.delete(id);\n // Saving rereads the full document, including unrelated manual edits. Keep newer\n // optimistic choices, but refresh every row with no outstanding user change.\n for (const { key: settingKey } of SETTINGS) {\n if (!pending.has(settingKey)) list.updateValue(settingKey, String(effective[settingKey]));\n }\n tui.requestRender();\n })\n .catch((error: unknown) => {\n // A failed action must not prevent later requests from entering the queue.\n reportFailure(error instanceof Error ? error.message : String(error));\n });\n },\n () => complete(\"back\"),\n );\n return {\n get capturesViewportInput() {\n return list.capturesViewportInput;\n },\n render(width: number) {\n if (!current()) complete(\"stale\");\n renderedWidth = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;\n listTheme.cursor = theme.fg(\"accent\", \"\u2192 \");\n // The native footer hardcodes keys. Advertise only the hard-cancel key owned here;\n // configured native navigation, change, and Back actions remain unchanged.\n const content = list.render(Math.max(4, renderedWidth)).slice(0, -2);\n contentHeight = content.length;\n const focusedRow = content.findIndex((line) => stripVTControlCharacters(line).startsWith(\"\u2192\"));\n mouseRows.clear();\n\n const terminalRows = Number.isFinite(tui.terminal.rows) ? Math.floor(tui.terminal.rows) : 24;\n const frame = renderBoundedFrameLayout({\n width: renderedWidth,\n maxRows: Math.max(1, terminalRows - 3),\n rule: rule.render(renderedWidth)[0] ?? \"\",\n title: new Text(theme.fg(\"accent\", theme.bold(\"Subagents Settings\")), 0, 0).render(renderedWidth),\n context: [theme.fg(\"muted\", \"Saved changes apply immediately.\")],\n content,\n hints: new Text(theme.fg(\"muted\", \"Ctrl+C close\"), 0, 0).render(renderedWidth),\n priorityRows: focusedRow < 0 ? [] : [focusedRow],\n focusedRow,\n });\n for (const { frameIndex, contentIndex } of frame.contentRows) mouseRows.set(frameIndex, contentIndex);\n return frame.lines;\n },\n invalidate() {\n mouseRows.clear();\n mousePressed = false;\n list.invalidate();\n },\n handleInput(data: string) {\n if (!current()) return complete(\"stale\");\n mouseRows.clear();\n mousePressed = false;\n if (matchesKey(data, Key.ctrl(\"c\"))) complete(\"close\");\n else {\n // SettingsList uses Pi's effective native keybindings for standard actions.\n list.handleInput(data);\n }\n tui.requestRender();\n },\n handleMouse(event: TuiMouseEvent) {\n if (!current()) {\n complete(\"stale\");\n return;\n }\n const nativeRow = mouseRows.get(event.y);\n if (nativeRow === undefined || event.x < 0 || event.x >= renderedWidth) {\n if (event.button === \"left\" && (event.type === \"press\" || event.type === \"click\")) mousePressed = false;\n return;\n }\n const nativeEvent = { ...event, y: nativeRow, width: renderedWidth, height: contentHeight };\n if (event.type === \"click\" && event.button === \"left\" && !mousePressed) {\n list.handleMouse({ ...nativeEvent, type: \"press\" });\n }\n const result = list.handleMouse(nativeEvent);\n if (event.type === \"press\" && event.button === \"left\") mousePressed = result?.handled === true;\n if (event.type === \"click\" || event.type === \"wheel\") mousePressed = false;\n if (result?.handled && result.render !== false) tui.requestRender();\n return result;\n },\n waitForPending() {\n return queue;\n },\n dispose() {\n mouseRows.clear();\n mousePressed = false;\n },\n };\n },\n });\n if (result.kind === \"error\") throw result.error;\n return result.kind === \"completed\" ? result.value : result.kind === \"unsupported\" ? \"back\" : \"stale\";\n}\n"],
5
+ "mappings": ";;;;AAAA,SAAS,gCAAgC;AACzC,SAAuC,4BAA4B;AACnE,SAAS,KAAK,YAA8B,cAAc,YAAgC;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;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cAAc;AACtE,iBAAK,YAAY,EAAE,GAAG,aAAa,MAAM,QAAQ,CAAC;AAAA,UACpD;AACA,gBAAMA,UAAS,KAAK,YAAY,WAAW;AAC3C,cAAI,MAAM,SAAS,WAAW,MAAM,WAAW,OAAQ,gBAAeA,SAAQ,YAAY;AAC1F,cAAI,MAAM,SAAS,WAAW,MAAM,SAAS,QAAS,gBAAe;AACrE,cAAIA,SAAQ,WAAWA,QAAO,WAAW,MAAO,KAAI,cAAc;AAClE,iBAAOA;AAAA,QACT;AAAA,QACA,iBAAiB;AACf,iBAAO;AAAA,QACT;AAAA,QACA,UAAU;AACR,oBAAU,MAAM;AAChB,yBAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACD,MAAI,OAAO,SAAS,QAAS,OAAM,OAAO;AAC1C,SAAO,OAAO,SAAS,cAAc,OAAO,QAAQ,OAAO,SAAS,gBAAgB,SAAS;AAC/F;",
6
6
  "names": ["result"]
7
7
  }
package/dist/index.ts CHANGED
@@ -53,7 +53,7 @@ function sanitizeSubagentDisplayText(value) {
53
53
  }
54
54
 
55
55
  // src/message-renderers.ts
56
- import { getMarkdownTheme, keyText } from "@earendil-works/pi-coding-agent";
56
+ import { getMarkdownTheme } from "@earendil-works/pi-coding-agent";
57
57
  import { Box, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
58
58
  var COMPLETION_MESSAGE_TYPE = "pi-subagents-completion";
59
59
  var BROKER_MESSAGE_TYPE = "pi-subagents-message";
@@ -82,13 +82,9 @@ function registerMessageRenderers(pi) {
82
82
  new Spacer(1)
83
83
  ];
84
84
  if (!options.expanded) {
85
- children.push(
86
- new Text(
87
- theme.fg("customMessageText", `${summary} (`) + theme.fg("dim", keyText("app.tools.expand")) + theme.fg("customMessageText", " to expand)"),
88
- 0,
89
- 0
90
- )
91
- );
85
+ const expansionKey = options.keyText?.("app.tools.expand");
86
+ const hint = expansionKey ? theme.fg("muted", ` (${expansionKey} to expand)`) : "";
87
+ children.push(new Text(theme.fg("customMessageText", summary) + hint, 0, 0));
92
88
  } else {
93
89
  const content = typeof message.content === "string" ? message.content : message.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
94
90
  children.push(
@@ -2131,7 +2127,7 @@ var SubagentRuntime = class {
2131
2127
  display: true,
2132
2128
  details: payload
2133
2129
  },
2134
- { deliverAs: "steer" }
2130
+ { deliverAs: "steer", triggerTurn: true }
2135
2131
  );
2136
2132
  } catch {
2137
2133
  }
@@ -2258,9 +2254,11 @@ var SpawnParameters = Type.Object(
2258
2254
  ),
2259
2255
  tools: Type.Optional(
2260
2256
  Type.Array(
2261
- StringEnum(CHILD_CORE_TOOL_NAMES, {
2262
- description: "Available Pi core child work tool name."
2263
- }),
2257
+ Type.Unsafe(
2258
+ StringEnum(CHILD_CORE_TOOL_NAMES, {
2259
+ description: "Available Pi core child work tool name."
2260
+ })
2261
+ ),
2264
2262
  {
2265
2263
  description: "Child work tools. Defaults to read, grep, find, and ls. Communication tools are always added.",
2266
2264
  maxItems: MAX_TOOLS
@@ -2310,9 +2308,11 @@ var SpawnParameters = Type.Object(
2310
2308
  )
2311
2309
  ),
2312
2310
  thinkingLevel: Type.Optional(
2313
- StringEnum(SUBAGENT_THINKING_LEVELS, {
2314
- description: "Child thinking level. Defaults to the main agent's effective level."
2315
- })
2311
+ Type.Unsafe(
2312
+ StringEnum(SUBAGENT_THINKING_LEVELS, {
2313
+ description: "Child thinking level. Defaults to the main agent's effective level."
2314
+ })
2315
+ )
2316
2316
  ),
2317
2317
  timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (optional, no default timeout)" }))
2318
2318
  },
@@ -2973,7 +2973,7 @@ function subagents(pi, dependencies = {}) {
2973
2973
  ctx.ui.notify(sanitizeSubagentDisplayText(`Edit user settings: ${store.userPath}. Then run /reload.`), "info");
2974
2974
  return "back";
2975
2975
  }
2976
- const { showSubagentSettings } = await import("./chunks/settings-ui-24GHO6E2.ts");
2976
+ const { showSubagentSettings } = await import("./chunks/settings-ui-KOX3DMZP.ts");
2977
2977
  if (signal.aborted || !isCurrent()) return "stale";
2978
2978
  return showSubagentSettings(ctx, {
2979
2979
  signal,