@pi-archimedes/subagent 1.7.1 → 1.8.1

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-archimedes/subagent",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "main": "./src/index.ts",
13
13
  "dependencies": {
14
- "@pi-archimedes/core": "1.7.1"
14
+ "@pi-archimedes/core": "1.8.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@earendil-works/pi-ai": ">=0.1.0",
package/src/index.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { Text, TUI } from "@earendil-works/pi-tui";
3
3
  import { Type } from "typebox";
4
- import { executeSubagent, executeParallel } from "./execute.js";
4
+ // execute.js + agent-manager.js lazy-loaded below to keep subagent tool registration fast
5
5
  import { renderSubagentResult } from "./render.js";
6
6
  import { discoverAgents, discoverAgentsAll, findAgent } from "./agents.js";
7
- import { createAgentManager } from "./agent-manager.js";
8
7
  import type {
9
8
  SubagentDetails,
10
9
  SubagentProgress,
@@ -73,7 +72,8 @@ export function registerSubagent(pi: ExtensionAPI): void {
73
72
  onUpdate: ((update: SubagentToolResult) => void) | undefined,
74
73
  ctx: ExtensionContext,
75
74
  ): Promise<SubagentToolResult> {
76
- // Discover available agents
75
+ // Lazy-load executor (spawn/stream/cost) — only when tool is actually invoked
76
+ const { executeSubagent, executeParallel } = await import("./execute.js");
77
77
  const agents = discoverAgents(ctx.cwd);
78
78
 
79
79
  // Parallel mode
@@ -268,6 +268,8 @@ export function registerAgentsCommand(pi: ExtensionAPI): void {
268
268
  pi.registerCommand("agents", {
269
269
  description: "Open the Agents Manager",
270
270
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
271
+ // Lazy-load: 1689-line TUI component only needed when /agents is invoked
272
+ const { createAgentManager } = await import("./agent-manager.js");
271
273
  const { global: globalAgents, user, project, globalDir, userDir, projectDir } = discoverAgentsAll(ctx.cwd);
272
274
 
273
275
  const availableModels = ctx.modelRegistry.getAvailable().map((m) => ({