pi-subagent-manager 1.11.0 → 1.13.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.
Files changed (169) hide show
  1. package/README.md +9 -9
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +1 -47
  4. package/dist/orch/checklist-integration.js +2 -30
  5. package/dist/orch/context-entries.js +0 -2
  6. package/dist/orch/cost-ledger.js +0 -5
  7. package/dist/orch/diagnostics.js +0 -9
  8. package/dist/orch/extensions.js +22 -21
  9. package/dist/orch/housekeeping-usage.js +0 -5
  10. package/dist/orch/housekeeping.js +1 -34
  11. package/dist/orch/inherited-tools.js +0 -14
  12. package/dist/orch/mailbox.js +0 -1
  13. package/dist/orch/manager.js +4 -44
  14. package/dist/orch/paths.js +0 -4
  15. package/dist/orch/prompt.js +1 -5
  16. package/dist/orch/registry.js +1 -20
  17. package/dist/orch/runtime.js +1 -48
  18. package/dist/orch/tools.js +0 -2
  19. package/dist/orch/transcript.js +0 -11
  20. package/dist/prefs/agent-import.js +2 -10
  21. package/dist/prefs/config.js +3 -51
  22. package/dist/prefs/import-discovery.js +0 -15
  23. package/dist/prefs/import-instructions.js +0 -2
  24. package/dist/prefs/models.js +0 -1
  25. package/dist/prefs/settings.js +22 -25
  26. package/dist/types.js +0 -1
  27. package/dist/ui/agent-loader.js +0 -10
  28. package/dist/ui/agent-navigation-editor.js +0 -21
  29. package/dist/ui/cost-footer.js +3 -9
  30. package/dist/ui/dialog.js +1 -29
  31. package/dist/ui/import-picker.js +0 -20
  32. package/dist/ui/live-agent-view.js +0 -19
  33. package/dist/ui/model-picker.js +0 -20
  34. package/dist/ui/settings-ui.js +8 -12
  35. package/dist/ui/status-ui.js +0 -17
  36. package/dist/ui/thread-tree.js +1 -12
  37. package/dist/ui/tool-picker.js +1 -4
  38. package/dist/ui/transcript-tool.js +0 -9
  39. package/dist/ui/ui.js +1 -29
  40. package/package.json +3 -3
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/index.js.map +0 -1
  43. package/dist/orch/checklist-integration.d.ts +0 -48
  44. package/dist/orch/checklist-integration.d.ts.map +0 -1
  45. package/dist/orch/checklist-integration.js.map +0 -1
  46. package/dist/orch/context-entries.d.ts +0 -8
  47. package/dist/orch/context-entries.d.ts.map +0 -1
  48. package/dist/orch/context-entries.js.map +0 -1
  49. package/dist/orch/cost-ledger.d.ts +0 -16
  50. package/dist/orch/cost-ledger.d.ts.map +0 -1
  51. package/dist/orch/cost-ledger.js.map +0 -1
  52. package/dist/orch/diagnostics.d.ts +0 -13
  53. package/dist/orch/diagnostics.d.ts.map +0 -1
  54. package/dist/orch/diagnostics.js.map +0 -1
  55. package/dist/orch/extensions.d.ts +0 -15
  56. package/dist/orch/extensions.d.ts.map +0 -1
  57. package/dist/orch/extensions.js.map +0 -1
  58. package/dist/orch/housekeeping-usage.d.ts +0 -14
  59. package/dist/orch/housekeeping-usage.d.ts.map +0 -1
  60. package/dist/orch/housekeeping-usage.js.map +0 -1
  61. package/dist/orch/housekeeping.d.ts +0 -89
  62. package/dist/orch/housekeeping.d.ts.map +0 -1
  63. package/dist/orch/housekeeping.js.map +0 -1
  64. package/dist/orch/inherited-tools.d.ts +0 -18
  65. package/dist/orch/inherited-tools.d.ts.map +0 -1
  66. package/dist/orch/inherited-tools.js.map +0 -1
  67. package/dist/orch/mailbox.d.ts +0 -59
  68. package/dist/orch/mailbox.d.ts.map +0 -1
  69. package/dist/orch/mailbox.js.map +0 -1
  70. package/dist/orch/manager.d.ts +0 -82
  71. package/dist/orch/manager.d.ts.map +0 -1
  72. package/dist/orch/manager.js.map +0 -1
  73. package/dist/orch/paths.d.ts +0 -7
  74. package/dist/orch/paths.d.ts.map +0 -1
  75. package/dist/orch/paths.js.map +0 -1
  76. package/dist/orch/prompt.d.ts +0 -7
  77. package/dist/orch/prompt.d.ts.map +0 -1
  78. package/dist/orch/prompt.js.map +0 -1
  79. package/dist/orch/registry.d.ts +0 -49
  80. package/dist/orch/registry.d.ts.map +0 -1
  81. package/dist/orch/registry.js.map +0 -1
  82. package/dist/orch/runtime.d.ts +0 -11
  83. package/dist/orch/runtime.d.ts.map +0 -1
  84. package/dist/orch/runtime.js.map +0 -1
  85. package/dist/orch/tools.d.ts +0 -6
  86. package/dist/orch/tools.d.ts.map +0 -1
  87. package/dist/orch/tools.js.map +0 -1
  88. package/dist/orch/transcript.d.ts +0 -28
  89. package/dist/orch/transcript.d.ts.map +0 -1
  90. package/dist/orch/transcript.js.map +0 -1
  91. package/dist/prefs/agent-import.d.ts +0 -37
  92. package/dist/prefs/agent-import.d.ts.map +0 -1
  93. package/dist/prefs/agent-import.js.map +0 -1
  94. package/dist/prefs/config.d.ts +0 -108
  95. package/dist/prefs/config.d.ts.map +0 -1
  96. package/dist/prefs/config.js.map +0 -1
  97. package/dist/prefs/import-discovery.d.ts +0 -28
  98. package/dist/prefs/import-discovery.d.ts.map +0 -1
  99. package/dist/prefs/import-discovery.js.map +0 -1
  100. package/dist/prefs/import-instructions.d.ts +0 -3
  101. package/dist/prefs/import-instructions.d.ts.map +0 -1
  102. package/dist/prefs/import-instructions.js.map +0 -1
  103. package/dist/prefs/models.d.ts +0 -24
  104. package/dist/prefs/models.d.ts.map +0 -1
  105. package/dist/prefs/models.js.map +0 -1
  106. package/dist/prefs/settings.d.ts +0 -89
  107. package/dist/prefs/settings.d.ts.map +0 -1
  108. package/dist/prefs/settings.js.map +0 -1
  109. package/dist/types.d.ts +0 -293
  110. package/dist/types.d.ts.map +0 -1
  111. package/dist/types.js.map +0 -1
  112. package/dist/ui/agent-loader.d.ts +0 -21
  113. package/dist/ui/agent-loader.d.ts.map +0 -1
  114. package/dist/ui/agent-loader.js.map +0 -1
  115. package/dist/ui/agent-navigation-editor.d.ts +0 -46
  116. package/dist/ui/agent-navigation-editor.d.ts.map +0 -1
  117. package/dist/ui/agent-navigation-editor.js.map +0 -1
  118. package/dist/ui/cost-footer.d.ts +0 -37
  119. package/dist/ui/cost-footer.d.ts.map +0 -1
  120. package/dist/ui/cost-footer.js.map +0 -1
  121. package/dist/ui/dialog.d.ts +0 -135
  122. package/dist/ui/dialog.d.ts.map +0 -1
  123. package/dist/ui/dialog.js.map +0 -1
  124. package/dist/ui/import-picker.d.ts +0 -38
  125. package/dist/ui/import-picker.d.ts.map +0 -1
  126. package/dist/ui/import-picker.js.map +0 -1
  127. package/dist/ui/live-agent-view.d.ts +0 -82
  128. package/dist/ui/live-agent-view.d.ts.map +0 -1
  129. package/dist/ui/live-agent-view.js.map +0 -1
  130. package/dist/ui/model-picker.d.ts +0 -109
  131. package/dist/ui/model-picker.d.ts.map +0 -1
  132. package/dist/ui/model-picker.js.map +0 -1
  133. package/dist/ui/settings-ui.d.ts +0 -17
  134. package/dist/ui/settings-ui.d.ts.map +0 -1
  135. package/dist/ui/settings-ui.js.map +0 -1
  136. package/dist/ui/status-ui.d.ts +0 -67
  137. package/dist/ui/status-ui.d.ts.map +0 -1
  138. package/dist/ui/status-ui.js.map +0 -1
  139. package/dist/ui/thread-tree.d.ts +0 -22
  140. package/dist/ui/thread-tree.d.ts.map +0 -1
  141. package/dist/ui/thread-tree.js.map +0 -1
  142. package/dist/ui/tool-picker.d.ts +0 -46
  143. package/dist/ui/tool-picker.d.ts.map +0 -1
  144. package/dist/ui/tool-picker.js.map +0 -1
  145. package/dist/ui/transcript-tool.d.ts +0 -2
  146. package/dist/ui/transcript-tool.d.ts.map +0 -1
  147. package/dist/ui/transcript-tool.js.map +0 -1
  148. package/dist/ui/ui.d.ts +0 -41
  149. package/dist/ui/ui.d.ts.map +0 -1
  150. package/dist/ui/ui.js.map +0 -1
  151. package/docs/assets/subagent-manager-demo.gif +0 -0
  152. package/docs/async-lifecycle.md +0 -153
  153. package/docs/custom-agents.md +0 -154
  154. package/docs/default-agents.md +0 -95
  155. package/docs/demo.md +0 -63
  156. package/docs/development.md +0 -75
  157. package/docs/importing-agents.md +0 -41
  158. package/docs/pi-footer.md +0 -128
  159. package/docs/research-claude.md +0 -258
  160. package/docs/research-codex.md +0 -143
  161. package/docs/research-default-agent-models.md +0 -121
  162. package/docs/research-model-audit-2026-10.md +0 -154
  163. package/docs/research-model-roles-coding.md +0 -99
  164. package/docs/research-model-roles-writing.md +0 -78
  165. package/docs/research-researcher-workflow.md +0 -97
  166. package/docs/settings.md +0 -293
  167. package/docs/subagent-extension-limitations.md +0 -98
  168. package/docs/threads.md +0 -73
  169. package/docs/tools-and-ui.md +0 -129
@@ -4,7 +4,6 @@ import { dialogText } from "./dialog.js";
4
4
  import { AGENT_PROGRESS_INTERVAL, agentProgressIcon, agentTypeLabel } from "./ui.js";
5
5
  import { renderTranscriptTool } from "./transcript-tool.js";
6
6
  const DETAIL_CYCLE = ["full", "preview", "compact"];
7
- /** Fully cover main, including at very small sizes; only trusted renderers emit terminal sequences. */
8
7
  export function fillViewport(lines, width, height) {
9
8
  width = Math.max(0, Math.floor(width));
10
9
  height = Math.max(1, Math.floor(height));
@@ -32,7 +31,6 @@ function json(value) {
32
31
  return "[unrenderable data]";
33
32
  }
34
33
  }
35
- /** Live transcript and manual steering. Reuse trusted pi built-ins; strip untrusted controls. */
36
34
  export class LiveAgentView {
37
35
  host;
38
36
  theme;
@@ -95,7 +93,6 @@ export class LiveAgentView {
95
93
  this.steerStatus = "Sending steering…";
96
94
  this.host.requestRender();
97
95
  try {
98
- // Same root-scoped service as the Actions menu: queues a running turn or resumes a settled one.
99
96
  await this.service.steer(this.path, message);
100
97
  if (this.disposed)
101
98
  return;
@@ -116,7 +113,6 @@ export class LiveAgentView {
116
113
  }
117
114
  }
118
115
  editInput(data) {
119
- // Keep paste chunks (including embedded Esc, Tab and Enter) out of navigation shortcuts.
120
116
  const pasteData = this.pasteTail + data;
121
117
  if (pasteData.includes("\x1b[200~"))
122
118
  this.pasting = true;
@@ -244,7 +240,6 @@ export class LiveAgentView {
244
240
  void this.attach();
245
241
  return;
246
242
  }
247
- // Transcript scrolling remains available while composing; Home/End edit the input.
248
243
  if (matchesKey(data, Key.up))
249
244
  this.scroll.scrollBy(-1);
250
245
  else if (matchesKey(data, Key.down))
@@ -270,7 +265,6 @@ export class LiveAgentView {
270
265
  this.saveViewport();
271
266
  this.host.requestRender();
272
267
  }
273
- /** Fullscreen wheel events scroll the transcript like Up/Down, even while composing. */
274
268
  handleMouse(event) {
275
269
  if (this.disposed || event.type !== "wheel")
276
270
  return undefined;
@@ -288,7 +282,6 @@ export class LiveAgentView {
288
282
  get detail() {
289
283
  return this.viewport.detail ?? "preview";
290
284
  }
291
- /** One column of horizontal padding on each side of the transcript. */
292
285
  pad(lines) {
293
286
  return lines.map((line) => ` ${line}`);
294
287
  }
@@ -297,13 +290,11 @@ export class LiveAgentView {
297
290
  .split("\n")
298
291
  .flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width)));
299
292
  }
300
- /** Use the same themed Markdown (including code highlighting) as pi's main transcript. */
301
293
  markdown(value, width, thinking = false) {
302
294
  return new Markdown(text(value), 0, 0, getMarkdownTheme(), thinking
303
295
  ? { color: (value) => this.theme.fg("thinkingText", value), italic: true }
304
296
  : undefined).render(Math.max(1, width));
305
297
  }
306
- /** Collapsed content is bounded by rendered rows, not just source newlines. */
307
298
  preview(content, width, markdown = false) {
308
299
  const values = Array.isArray(content) ? content : [content];
309
300
  const lines = [];
@@ -317,7 +308,6 @@ export class LiveAgentView {
317
308
  : block?.type === "image"
318
309
  ? "[Image — text-only observer]"
319
310
  : json(value);
320
- // Bound source work before rendering a collapsed preview.
321
311
  const safe = text(valueText);
322
312
  const bounded = safe.slice(0, 32768);
323
313
  const rendered = markdown ? this.markdown(bounded, width) : bounded.split("\n");
@@ -331,7 +321,6 @@ export class LiveAgentView {
331
321
  }
332
322
  return lines;
333
323
  }
334
- /** Renders padded rows: `width` is the full transcript width. Tool calls get a themed band. */
335
324
  blocks(content, width) {
336
325
  const inner = Math.max(1, width - 2);
337
326
  if (!Array.isArray(content))
@@ -356,7 +345,6 @@ export class LiveAgentView {
356
345
  if (block.type === "thinking") {
357
346
  if (this.detail === "compact")
358
347
  return [this.theme.fg("dim", "[Thinking hidden · Ctrl+O cycles view]")];
359
- // Thinking is model-authored Markdown; preview truncates the rendered lines, not the source.
360
348
  const rendered = this.markdown(String(block.thinking ?? "[redacted thinking]"), width, true);
361
349
  if (this.detail === "full" || rendered.length <= 3)
362
350
  return rendered;
@@ -364,7 +352,6 @@ export class LiveAgentView {
364
352
  }
365
353
  return this.preview(json(block), width);
366
354
  }
367
- /** Extension messages follow the tool detail cycle without running extension renderers. */
368
355
  customBlocks(content, width) {
369
356
  if (this.detail === "compact")
370
357
  return [];
@@ -407,7 +394,6 @@ export class LiveAgentView {
407
394
  this.cache.set(message, { width, detail: this.detail, lines });
408
395
  return lines;
409
396
  }
410
- /** Pair a call with its committed result or live partial, then render nested executions in place. */
411
397
  tool(id, name, args, width) {
412
398
  if (this.renderedTools.has(id))
413
399
  return [];
@@ -416,7 +402,6 @@ export class LiveAgentView {
416
402
  const result = this.results.get(id) ?? state?.result;
417
403
  const running = !this.results.has(id) && (state ? state.state === "running" : result === undefined);
418
404
  const isError = Boolean(object(result)?.isError ?? state?.isError);
419
- // Committed call arguments are authoritative; orphan results use retained live args if available.
420
405
  if (state && !Object.keys(object(args) ?? {}).length)
421
406
  args = state.args;
422
407
  const cached = this.toolCache.get(id);
@@ -483,11 +468,9 @@ export class LiveAgentView {
483
468
  body.push(...this.message(message, columns));
484
469
  if (snapshot.assistant)
485
470
  body.push(` ${this.theme.fg("warning", "Assistant streaming…")}`, ...this.message(snapshot.assistant, columns));
486
- // Parents first even when nested notifications arrive before the outer call.
487
471
  for (const tool of snapshot.tools)
488
472
  if (!tool.parentToolCallId && !this.results.has(tool.toolCallId))
489
473
  body.push(...this.tool(tool.toolCallId, tool.toolName, tool.args, columns));
490
- // An orphan nested execution still needs to be visible if its parent is unavailable.
491
474
  for (const tool of snapshot.tools)
492
475
  if (!this.renderedTools.has(tool.toolCallId) && !this.results.has(tool.toolCallId))
493
476
  body.push(...this.tool(tool.toolCallId, tool.toolName, tool.args, columns));
@@ -525,7 +508,6 @@ export class LiveAgentView {
525
508
  : thread
526
509
  ? `${thread.task} · ${thread.status}`
527
510
  : "Live transcript · Enter to steer")));
528
- // Chrome rows share the transcript's one-column side padding; `visible` is already padded.
529
511
  const chrome = (line) => ` ${truncateToWidth(line, inner, "")}`;
530
512
  const lines = height === 1
531
513
  ? [input]
@@ -543,4 +525,3 @@ export class LiveAgentView {
543
525
  return fillViewport(lines, width, height);
544
526
  }
545
527
  }
546
- //# sourceMappingURL=live-agent-view.js.map
@@ -18,9 +18,6 @@ function renderModelIdentity(identity) {
18
18
  return sanitizeModelText(identity);
19
19
  }
20
20
  function modelSearchText(text) {
21
- // Providers spell the same version differently (sonnet-5.5 vs sonnet-5-5).
22
- // Strip separators rather than splitting them into repeated numeric terms;
23
- // raw identities and labels remain untouched.
24
21
  return sanitizeModelText(text).replace(/[._:/-]+/g, "");
25
22
  }
26
23
  function sortModels(models) {
@@ -63,8 +60,6 @@ export class OrderedModelEditorComponent extends Container {
63
60
  this.tui = options.tui;
64
61
  this.theme = options.theme;
65
62
  this.allModels = sortModels(options.availableModels);
66
- // The registry is fixed for this dialog; prepare searchable fields once.
67
- // Scope annotations deliberately aren't searchable model metadata.
68
63
  this.modelSearch = fuzzysort.snapshot(this.allModels, {
69
64
  keys: [
70
65
  (model) => modelSearchText(modelIdentity(model)),
@@ -121,7 +116,6 @@ export class OrderedModelEditorComponent extends Container {
121
116
  ];
122
117
  const budget = Math.max(1, height - 4 - header.length);
123
118
  const selected = this.selectList.getSelectedItem()?.value;
124
- // Headings are visual rows only: keyboard navigation selects models, not groups.
125
119
  const displayRows = [];
126
120
  let previousGroup;
127
121
  const hasResults = this.currentItems.some((item) => item.group !== SELECTED_GROUP && item.group !== ACTIONS_GROUP);
@@ -136,7 +130,6 @@ export class OrderedModelEditorComponent extends Container {
136
130
  }
137
131
  const index = Math.max(0, displayRows.findIndex((row) => typeof row !== "string" && row.value === selected));
138
132
  const start = Math.max(0, Math.min(index - budget + 1, displayRows.length - budget));
139
- // Only format visible rows; a registry can contain thousands of models.
140
133
  const rows = displayRows.slice(start, start + budget).map((row) => {
141
134
  if (typeof row === "string")
142
135
  return this.theme.fg("muted", row);
@@ -165,7 +158,6 @@ export class OrderedModelEditorComponent extends Container {
165
158
  const selected = this.selectList.getSelectedItem()?.value;
166
159
  const index = selected === undefined ? -1 : this.draft.indexOf(selected);
167
160
  const next = index + (earlier ? -1 : 1);
168
- // Consume reorder keys even on unselected models or at a list boundary.
169
161
  if (index >= 0 && next >= 0 && next < this.draft.length) {
170
162
  [this.draft[index], this.draft[next]] = [this.draft[next], this.draft[index]];
171
163
  this.refreshPickerList(selected);
@@ -187,8 +179,6 @@ export class OrderedModelEditorComponent extends Container {
187
179
  if (nextQuery !== this.pickerQuery) {
188
180
  this.setSearching(true);
189
181
  this.pickerQuery = nextQuery;
190
- // Keep selected preferences visible, but focus the first search result
191
- // so typing a query and pressing Enter still adds the matching model.
192
182
  this.refreshPickerList(undefined, true);
193
183
  }
194
184
  }
@@ -275,8 +265,6 @@ export class OrderedModelEditorComponent extends Container {
275
265
  const scores = new Map();
276
266
  const uniqueQueries = new Set(queries.map((query) => modelSearchText(query).trim()).filter(Boolean));
277
267
  for (const query of uniqueQueries) {
278
- // Both defaults are restrictive (10 results, score >= .5); collect every
279
- // fuzzy match so suggestions aren't silently capped or omitted.
280
268
  for (const result of fuzzysort.go(query, this.modelSearch, {
281
269
  limit: 0,
282
270
  threshold: 0,
@@ -306,8 +294,6 @@ export class OrderedModelEditorComponent extends Container {
306
294
  }
307
295
  }
308
296
  const bySuggestionScore = (a, b) => this.suggestedScores.get(modelIdentity(b)) - this.suggestedScores.get(modelIdentity(a));
309
- // Stable score sorting preserves alphabetical order for ties. The last
310
- // tier retains the registry's alphabetical order, irrespective of scope.
311
297
  scoped.sort(bySuggestionScore);
312
298
  other.sort(bySuggestionScore);
313
299
  const items = (models, group) => models.map((model) => ({
@@ -363,10 +349,6 @@ const HOUSEKEEPING_TITLE = "[lab] Housekeeping model";
363
349
  const CLEAR_GROUP = "Selection";
364
350
  const SCOPED_GROUP = "Scoped models";
365
351
  const OTHER_GROUP = "Other available models";
366
- /**
367
- * Single-select picker over available models, scoped models listed first.
368
- * Typing searches; Enter selects; Esc cancels. "No model" clears the selection.
369
- */
370
352
  export class HousekeepingModelPickerComponent extends Container {
371
353
  tui;
372
354
  theme;
@@ -514,7 +496,6 @@ export class HousekeepingModelPickerComponent extends Container {
514
496
  const previous = this.rows[this.selected]?.value;
515
497
  this.rows = rows;
516
498
  if (resetSelection) {
517
- // Land on the best matching available model, never the clear row or an unavailable saved one.
518
499
  const first = query ? rows.findIndex((r) => r.group !== CLEAR_GROUP) : -1;
519
500
  this.selected = Math.max(0, first);
520
501
  }
@@ -546,4 +527,3 @@ export async function pickHousekeepingModel(ctx, current) {
546
527
  onCancel: () => done(HOUSEKEEPING_PICKER_CANCEL),
547
528
  }), DIALOG_OPTIONS);
548
529
  }
549
- //# sourceMappingURL=model-picker.js.map
@@ -121,7 +121,6 @@ const COST_VALUE_OPTIONS = [
121
121
  },
122
122
  ];
123
123
  const COST_ICON_LABELS = { money: "Money", coins: "Coins", wallet: "Wallet" };
124
- /** Persisted changes, not unsaved draft values; theme styling is computed on render. */
125
124
  function withProvenance(row, keys, layers) {
126
125
  const globalChanged = keys.some((key) => layers.global[key] !== undefined &&
127
126
  !settingsValueEqual(layers.global[key], DEFAULT_MANAGER_SETTINGS[key]));
@@ -141,15 +140,17 @@ function provenanceLegend(theme) {
141
140
  return (theme.fg("muted", "Saved: ") +
142
141
  `${global} Global · ${project} Current Project · ${global} ${project} Both`);
143
142
  }
144
- /** Selection edits stay in the outer draft until Save and apply. */
145
143
  async function configureSubagentExtensions(ctx, draft, agentDir) {
146
- const available = await discoverSubagentExtensions({
144
+ const discovered = await discoverSubagentExtensions({
147
145
  cwd: ctx.cwd,
148
146
  agentDir,
149
147
  projectTrusted: ctx.isProjectTrusted(),
150
148
  });
151
- const selected = new Set(draft.subagentExtensions === true ? available : draft.subagentExtensions || []);
152
- // Keep stale selections visible and removable; runtime still intersects with discovery.
149
+ const available = new Set(discovered.map(({ id }) => id));
150
+ const idsByPath = new Map(discovered.map(({ path, id }) => [path, id]));
151
+ const selected = new Set(draft.subagentExtensions === true
152
+ ? available
153
+ : (draft.subagentExtensions || []).map((file) => idsByPath.get(file) ?? file));
153
154
  const files = [...new Set([...available, ...selected])].sort();
154
155
  let selectedId;
155
156
  while (true) {
@@ -157,8 +158,8 @@ async function configureSubagentExtensions(ctx, draft, agentDir) {
157
158
  ...files.map((file) => ({
158
159
  id: file,
159
160
  label: `${selected.has(file) ? "[x]" : "[ ]"} ${extensionDisplayName(file)}`,
160
- value: available.includes(file) ? (selected.has(file) ? "On" : "Off") : "Unavailable",
161
- help: `${file}\n${available.includes(file) ? "Reload this extension in newly opened subagent sessions." : "Not currently discoverable/trusted; will not load. Toggle Off to remove the saved selection."}\nSpace/Enter toggles. Changes are saved only with outer Save and apply.`,
161
+ value: available.has(file) ? (selected.has(file) ? "On" : "Off") : "Unavailable",
162
+ help: `${file}\n${available.has(file) ? "Reload this extension in newly opened subagent sessions." : "Not currently discoverable/trusted; will not load. Toggle Off to remove the saved selection."}\nSpace/Enter toggles. Changes are saved only with outer Save and apply.`,
162
163
  })),
163
164
  {
164
165
  id: "back",
@@ -179,7 +180,6 @@ async function configureSubagentExtensions(ctx, draft, agentDir) {
179
180
  selected.add(action);
180
181
  }
181
182
  }
182
- /** Edits the shared draft; only the outer settings screen saves or applies it. */
183
183
  async function configureFooterDisplay(ctx, draft, layers) {
184
184
  let selectedId;
185
185
  while (true) {
@@ -250,7 +250,6 @@ function housekeepingValue(draft) {
250
250
  return draft.housekeepingModel ? `On · ${draft.housekeepingModel}` : "On · no model selected";
251
251
  }
252
252
  const HOUSEKEEPING_HELP = "Experimental: a model you choose writes a one-line summary of each running agent's current work, shown in the tree and widget instead of raw tool-call status.\nSends the agent's task and recent tool names/arguments/text to the selected model, uses extra tokens, and is not included in subagent cost totals.\nOff by default. Any failure keeps the original status. Choose from available and scoped models.";
253
- /** Edits the shared draft; only the outer settings screen saves or applies it. */
254
253
  async function configureHousekeeping(ctx, draft, layers) {
255
254
  let selectedId;
256
255
  while (true) {
@@ -319,7 +318,6 @@ export async function configureAgents(ctx, options) {
319
318
  return;
320
319
  await withDialogSession(ctx, (scoped) => configureAgentsDialog(scoped, options));
321
320
  }
322
- /** Always shown; "disabled" (muted, guarded) unless pi-checklist prerequisites currently hold. */
323
321
  function checklistRow(enabled, status) {
324
322
  const requirements = `${CHECKLIST_REQUIREMENTS}\nWhen On and eligible, adds prompt guidance to tag which agent works on each checklist task via meta.agent; in Orchestration mode /root must use the checklist. Off by default.`;
325
323
  if (status.eligible)
@@ -551,7 +549,6 @@ async function configureAgentsDialog(ctx, options) {
551
549
  }
552
550
  else if (action === "checklistIntegration") {
553
551
  const status = checklistStatus();
554
- // Turning Off is always allowed; turning On requires current eligibility.
555
552
  if (!draft.checklistIntegration && !status.eligible)
556
553
  ctx.ui.notify(`Checklist integration cannot be enabled: ${status.reason ?? "requirements not met"}. ${CHECKLIST_REQUIREMENTS}`, "warning");
557
554
  else
@@ -676,4 +673,3 @@ async function configureAgentsDialog(ctx, options) {
676
673
  }
677
674
  }
678
675
  }
679
- //# sourceMappingURL=settings-ui.js.map
@@ -78,13 +78,11 @@ export class StatusDialog {
78
78
  this.state = navigation?.state ?? { selectedPath: selected || ROOT, collapsed: new Set() };
79
79
  }
80
80
  invalidate() { }
81
- /** Poll retained status, accelerating the existing timer only for animated live agents. */
82
81
  startRefresh() {
83
82
  this.stopRefresh();
84
83
  this.refreshing = true;
85
84
  this.syncRefresh();
86
85
  }
87
- /** Stop the refresh. Safe to call more than once, including from dispose(). */
88
86
  dispose() {
89
87
  this.refreshing = false;
90
88
  this.stopRefresh();
@@ -115,7 +113,6 @@ export class StatusDialog {
115
113
  this.timer = undefined;
116
114
  this.refreshDelay = 0;
117
115
  }
118
- /** Stop every live agent. Stopping a subtree covers its descendants, so only top-most live paths are sent. */
119
116
  stopAll() {
120
117
  const live = this.service
121
118
  .list()
@@ -199,7 +196,6 @@ export class StatusDialog {
199
196
  if (child)
200
197
  this.selectedPath = child.path;
201
198
  else if (this.navigation?.fullscreen) {
202
- // Nothing left to fold or descend into: the next step right is the widget.
203
199
  this.navigation.returnToWidget?.();
204
200
  this.done(undefined);
205
201
  return;
@@ -254,7 +250,6 @@ export class StatusDialog {
254
250
  this.theme.fg(inactive ? base : selected ? "accent" : "text", ` ${identity} `),
255
251
  this.theme.fg(inactive ? hint : "muted", dialogText(thread.state)),
256
252
  ].join("");
257
- // Continue the tree's vertical guides without repeating the branch or selection marker.
258
253
  const stem = row.prefix.replace("├ ", "│ ").replace("└ ", " ");
259
254
  const activity = ` ${stem} ${dialogText(threadActivity(thread))}`;
260
255
  const metrics = this.theme.fg(base, threadMetrics(thread));
@@ -319,8 +314,6 @@ async function showAgentDialog(ctx, service, options = {}) {
319
314
  const open = options.inspect ?? ((path) => showThreads(ctx, service, path));
320
315
  let selected = options.selected;
321
316
  for (;;) {
322
- // Cleared on close and from dispose(): DialogSession host disposal can
323
- // leave this promise pending, so finally alone may not run immediately.
324
317
  let dialog;
325
318
  try {
326
319
  const chosen = await ctx.ui.custom((host, theme, _keys, done) => {
@@ -345,7 +338,6 @@ export async function showAgentStatus(ctx, service, inspect, nerdFontIcons = fal
345
338
  return;
346
339
  await showAgentDialog(ctx, service, { inspect, nerdFontIcons, loaderStyle });
347
340
  }
348
- /** Root-owned navigation state. Opening and closing never changes the executing session. */
349
341
  export class AgentNavigationController {
350
342
  returnToWidget;
351
343
  tree = { selectedPath: ROOT, collapsed: new Set() };
@@ -383,14 +375,11 @@ export class AgentNavigationController {
383
375
  return session;
384
376
  }
385
377
  this.session = session;
386
- // The alt-screen renderer's listener runs before extension listeners. Temporarily
387
- // remove only its search action from the public keybinding lookup, before dispatch.
388
378
  const previousKeybindings = getKeybindings();
389
379
  const watchingKeybindings = new Proxy(previousKeybindings, {
390
380
  get(target, property) {
391
381
  if (property === "matches")
392
382
  return (data, action) => action === "tui.altScreen.search" ? false : target.matches(data, action);
393
- // Preserve all other public manager methods and their original receiver.
394
383
  const value = Reflect.get(target, property, target);
395
384
  return typeof value === "function" ? value.bind(target) : value;
396
385
  },
@@ -398,16 +387,13 @@ export class AgentNavigationController {
398
387
  setKeybindings(watchingKeybindings);
399
388
  const dispose = session.dispose.bind(session);
400
389
  session.dispose = () => {
401
- // Do not overwrite a newer keybinding owner installed by another extension.
402
390
  if (getKeybindings() === watchingKeybindings)
403
391
  setKeybindings(previousKeybindings);
404
392
  dispose();
405
393
  };
406
- // One fullscreen surface also covers shorter Actions dialogs without exposing main.
407
394
  const render = session.render.bind(session);
408
395
  session.render = (width) => fillViewport(render(width), width, host.terminal.rows);
409
396
  const scoped = scopeDialogContext(ctx, session);
410
- // Built-in UI dialogs otherwise stack independently. Mount these actions in our child slot.
411
397
  const ui = scoped.ui;
412
398
  ui.select = (title, options) => dialogMenu(scoped, title, options.map((label) => ({ id: label, label })));
413
399
  ui.confirm = async (title, message) => (await dialogMenu(scoped, title, [
@@ -415,7 +401,6 @@ export class AgentNavigationController {
415
401
  { id: "No", label: "No", help: message },
416
402
  ], { selectedId: "No" })) === "Yes";
417
403
  ui.editor = (title, prefill) => dialogEditor(scoped, title, prefill ?? "");
418
- // Defer until Pi has installed/focused the overlay.
419
404
  void Promise.resolve()
420
405
  .then(async () => {
421
406
  while (generation === this.generation) {
@@ -464,7 +449,6 @@ export class AgentNavigationController {
464
449
  throw failure;
465
450
  })
466
451
  .finally(() => {
467
- // Also clean up if the host rejects mounting after our factory returned.
468
452
  ownedSession?.dispose();
469
453
  if (this.opening === result)
470
454
  this.opening = undefined;
@@ -484,4 +468,3 @@ export async function showAgentTree(ctx, service, selectedPath, nerdFontIcons =
484
468
  }
485
469
  await navigation.open(ctx, service, selectedPath, nerdFontIcons, loaderStyle);
486
470
  }
487
- //# sourceMappingURL=status-ui.js.map
@@ -1,8 +1,4 @@
1
1
  const ROOT = "/root";
2
- /**
3
- * A [labs] housekeeping summary is shown only while the agent is active.
4
- * Detailed rows fall back to status/task; the compact widget supplies its task-only fallback.
5
- */
6
2
  export function threadActivity(thread, fallback = thread.status || thread.task) {
7
3
  const active = thread.state === "starting" || thread.state === "running";
8
4
  const summary = typeof thread.summary === "string" ? thread.summary.trim() : "";
@@ -26,13 +22,11 @@ function chainHas(parentOf, start, target) {
26
22
  }
27
23
  return false;
28
24
  }
29
- /** When an agent last (re)started; older saves fall back to creation time. */
30
25
  export function lastStarted(thread) {
31
26
  const value = thread?.lastStartedAt ?? thread?.createdAt;
32
27
  return typeof value === "number" && Number.isFinite(value) ? value : 0;
33
28
  }
34
- /** Newest branch first: a branch ranks by its most recently started agent. Cycles are guarded. */
35
- export function recencyComparator(threads) {
29
+ function recencyComparator(threads) {
36
30
  const byPath = new Map();
37
31
  for (const thread of threads) {
38
32
  if (thread?.path && !byPath.has(thread.path))
@@ -56,10 +50,6 @@ export function recencyComparator(threads) {
56
50
  }
57
51
  return (a, b) => (latest.get(b) ?? 0) - (latest.get(a) ?? 0) || comparePath(a, b);
58
52
  }
59
- /** Flatten retained agents. Parent links win over path shape; /root is always present.
60
- * `comparePaths` orders siblings and roots only (default: most recently started branch first).
61
- * Cycle repair stays lexical.
62
- */
63
53
  export function buildStatusTree(threads, collapsed, comparePaths = recencyComparator(threads)) {
64
54
  const threadsByPath = new Map();
65
55
  for (const thread of threads) {
@@ -150,4 +140,3 @@ export function buildStatusTree(threads, collapsed, comparePaths = recencyCompar
150
140
  walk(missed, [], true);
151
141
  return rows;
152
142
  }
153
- //# sourceMappingURL=thread-tree.js.map
@@ -14,7 +14,7 @@ export function toolPolicyNotice(field, policy) {
14
14
  }
15
15
  const LAYOUT = { minPrimaryColumnWidth: 24, maxPrimaryColumnWidth: 52 };
16
16
  const MCP_TOOL = /^mcp__(.+?)__(.+)$/;
17
- export function mcpServerOf(name) {
17
+ function mcpServerOf(name) {
18
18
  return MCP_TOOL.exec(name)?.[1];
19
19
  }
20
20
  export class ToolPickerComponent extends Container {
@@ -181,7 +181,6 @@ export class ToolPickerComponent extends Container {
181
181
  for (const tool of matches)
182
182
  if (!selected.has(tool.name))
183
183
  addName(tool.name);
184
- // Group members: all session tools plus preserved draft names (so toggling affects the whole MCP).
185
184
  const members = new Map();
186
185
  for (const name of [...this.tools.map((t) => t.name), ...selected]) {
187
186
  const server = mcpServerOf(name);
@@ -196,7 +195,6 @@ export class ToolPickerComponent extends Container {
196
195
  if (mcpServerOf(name) !== undefined && !searching)
197
196
  addName(name);
198
197
  for (const key of [...groups.keys()]) {
199
- // Show a group when not searching, or when any member matches the search.
200
198
  if (searching && !members.get(key).some((n) => matchedNames.has(n)))
201
199
  groups.delete(key);
202
200
  }
@@ -331,4 +329,3 @@ export async function editToolSelection(ctx, field, current, options) {
331
329
  onCancel: () => done(TOOL_EDITOR_CANCEL),
332
330
  }), DIALOG_OPTIONS);
333
331
  }
334
- //# sourceMappingURL=tool-picker.js.map
@@ -13,13 +13,9 @@ const renderers = new Map([
13
13
  tool.name,
14
14
  { renderCall: tool.renderCall, renderResult: tool.renderResult },
15
15
  ]));
16
- // Native edit call previews otherwise read today's file asynchronously. An observer must
17
- // use the recorded result.diff, not inspect a possibly different worktree on every paint.
18
16
  const edit = renderers.get("edit");
19
17
  const editCall = edit.renderCall;
20
18
  edit.renderCall = (args, theme, context) => editCall(args, theme, { ...context, argsComplete: false });
21
- // Pi's generic fallback is unbounded. Retain the native tool box/title, but bound
22
- // unknown-tool previews by visual rows (extension tools can return enormous single lines).
23
19
  const generic = {
24
20
  renderResult(result, options, theme) {
25
21
  const output = result.content
@@ -46,7 +42,6 @@ function safeText(value) {
46
42
  .replace(/\r\n?/g, "\n")
47
43
  .replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, "");
48
44
  }
49
- /** Sanitize args, content AND details before trusted renderers interpolate them. */
50
45
  function sanitize(value, seen = new WeakSet(), depth = 0) {
51
46
  if (typeof value === "string")
52
47
  return safeText(value);
@@ -67,15 +62,12 @@ function sanitize(value, seen = new WeakSet(), depth = 0) {
67
62
  return safe;
68
63
  }
69
64
  export function renderTranscriptTool(name, id, args, result, isError, running, detail, width) {
70
- // The native shell renderer owns elapsed-time intervals after markExecutionStarted().
71
- // An observer has no execution lifecycle to dispose, so intentionally don't start that clock.
72
65
  const ui = { requestRender() { } };
73
66
  const component = new ToolExecutionComponent(safeText(name), safeText(id), sanitize(args), { showImages: false }, renderers.get(name) ?? generic, ui, process.cwd());
74
67
  const data = result && typeof result === "object" ? result : undefined;
75
68
  const content = data?.content ?? result;
76
69
  component.updateResult({
77
70
  content: (Array.isArray(content) ? content : content === undefined ? [] : [content]).map((block) => {
78
- // Never hand image payloads to pi (even showImages:false can trigger Kitty conversion).
79
71
  if (block && typeof block === "object" && block.type === "image")
80
72
  return { type: "text", text: "[Image — text-only observer]" };
81
73
  if (block && typeof block === "object" && block.type === "text")
@@ -97,4 +89,3 @@ export function renderTranscriptTool(name, id, args, result, isError, running, d
97
89
  return lines.filter((line) => stripTerminalSequences(line).trim()).slice(0, 1);
98
90
  return lines;
99
91
  }
100
- //# sourceMappingURL=transcript-tool.js.map