pi-subagent-manager 1.13.1 → 1.13.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CAPABILITY_PROBE_CHANNEL, respondDiagnosticCapability, diagnosticAgentText, } from "./orch/diagnostics.js";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { buildSessionContext, getAgentDir } from "@earendil-works/pi-coding-agent";
4
- import { fuzzyFilter } from "@earendil-works/pi-tui";
4
+ import { fuzzyFilter, Text } from "@earendil-works/pi-tui";
5
5
  import { ConfigStore } from "./prefs/config.js";
6
6
  import { IMPORT_REQUEST_PREFIX, markImportOffered, offerAgentImport, } from "./prefs/agent-import.js";
7
7
  import { ThreadManager } from "./orch/manager.js";
@@ -16,11 +16,12 @@ import { createInheritedToolSource } from "./orch/inherited-tools.js";
16
16
  import { subagentPrompt } from "./orch/prompt.js";
17
17
  import { ChecklistMetaMirror, checklistStatus } from "./orch/checklist-integration.js";
18
18
  import { agentTools } from "./orch/tools.js";
19
- import { editAgentTypes, updateWidget } from "./ui/ui.js";
19
+ import { agentStartupList, editAgentTypes, updateWidget } from "./ui/ui.js";
20
20
  import { canOpenDialog, dialogMenu } from "./ui/dialog.js";
21
21
  import { COST_ENTRY, CostLedger } from "./orch/cost-ledger.js";
22
22
  import { readRegistry, RegistryWriter } from "./orch/registry.js";
23
23
  import { CostFooterController } from "./ui/cost-footer.js";
24
+ const STARTUP_AGENTS_ENTRY = "pi-subagent:startup-agents:v1";
24
25
  const ROOT_MAILBOX_ENTRY = "pi-subagent:root-mailbox:v1";
25
26
  const ROOT_SUMMARY_MESSAGE = "pi-subagent:final-recap";
26
27
  const ROOT_WAKE_MESSAGE = "pi-subagent:wake";
@@ -31,6 +32,12 @@ export default function piSubagent(pi) {
31
32
  respondDiagnosticCapability(payload);
32
33
  });
33
34
  let context;
35
+ let startupAgents;
36
+ pi.registerEntryRenderer(STARTUP_AGENTS_ENTRY, (entry, _options, theme) => {
37
+ if (!startupAgents || entry.data?.id !== startupAgents.id)
38
+ return undefined;
39
+ return new Text(agentStartupList(startupAgents.agents, theme, startupAgents.icons), 0, 0);
40
+ });
34
41
  const inheritedTools = createInheritedToolSource(pi);
35
42
  let store = new ConfigStore({
36
43
  cwd: process.cwd(),
@@ -590,11 +597,20 @@ export default function piSubagent(pi) {
590
597
  };
591
598
  pi.on("session_start", async (event, ctx) => {
592
599
  capabilityActive = true;
600
+ startupAgents = undefined;
593
601
  await attachSession(ctx, true, event.reason !== "startup");
594
- if (limits.subagentMode !== "off")
602
+ if (limits.subagentMode !== "off") {
595
603
  await importAgents(ctx, true);
604
+ if (event.reason === "startup" && ctx.hasUI && ctx.mode === "tui") {
605
+ startupAgents = { id: randomUUID(), agents: store.list(), icons: limits.nerdFontIcons };
606
+ pi.appendEntry(STARTUP_AGENTS_ENTRY, { id: startupAgents.id });
607
+ }
608
+ }
609
+ });
610
+ pi.on("session_tree", async (_event, ctx) => {
611
+ startupAgents = undefined;
612
+ await attachSession(ctx);
596
613
  });
597
- pi.on("session_tree", async (_event, ctx) => attachSession(ctx));
598
614
  const stopWorkingThreads = async () => {
599
615
  cancelSummary();
600
616
  closeNavigation();
@@ -229,7 +229,7 @@ export function createHousekeepingCompleter(getContext, getModelIdentity, onUsag
229
229
  timestamp: Date.now(),
230
230
  },
231
231
  ],
232
- }, { signal, maxTokens: 96, cacheRetention: "none" })
232
+ }, { signal, maxTokens: 96, cacheRetention: "none", sessionId: session?.sessionId })
233
233
  .result();
234
234
  const entry = reportHousekeepingUsage(session, response);
235
235
  try {
package/dist/ui/ui.js CHANGED
@@ -43,6 +43,10 @@ export function agentTypeLabel(type, icon, nerdFontIcons = false, loaderIcon) {
43
43
  const progress = loaderIcon && isAgentLoaderGlyph(loaderIcon, nerdFontIcons) ? `${loaderIcon} ` : "";
44
44
  return `${progress}${role}${sanitizeText(type)}`;
45
45
  }
46
+ export function agentStartupList(agents, theme, nerdFontIcons) {
47
+ const names = agents.map((agent) => theme.fg(agentColorToken(agent.color), agentTypeLabel(agent.name, agent.icon, nerdFontIcons)));
48
+ return `${theme.fg("warning", "[Agents]")}\n ${names.length ? names.join(", ") : "(none)"}`;
49
+ }
46
50
  export function agentTypeBadge(type, color, theme, icon, nerdFontIcons = false, loaderIcon) {
47
51
  return contrastPill(agentTypeLabel(type, icon, nerdFontIcons, loaderIcon), color, theme);
48
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagent-manager",
3
- "version": "1.13.1",
3
+ "version": "1.13.3",
4
4
  "description": "Hierarchical, steerable subagent threads for pi",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",