@nredd/pi-subagents 0.22.0-nredd.6 → 0.22.0-nredd.8

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 (46) hide show
  1. package/README.md +160 -43
  2. package/package.json +8 -8
  3. package/src/agent-file-toggle.ts +6 -4
  4. package/src/agent-manager.ts +418 -118
  5. package/src/agent-runner.ts +155 -62
  6. package/src/cross-extension-rpc.ts +11 -36
  7. package/src/custom-agents.ts +9 -5
  8. package/src/default-agents.ts +2 -4
  9. package/src/enabled-models.ts +8 -7
  10. package/src/enterprise-local.ts +5 -5
  11. package/src/home-paths.ts +27 -0
  12. package/src/index.ts +231 -107
  13. package/src/invocation-config.ts +8 -35
  14. package/src/memory.ts +9 -9
  15. package/src/mention-clone.ts +9 -5
  16. package/src/model-resolver.ts +41 -11
  17. package/src/model-scope.ts +2 -1
  18. package/src/model-selection.ts +159 -0
  19. package/src/model-tiers.ts +171 -0
  20. package/src/nested-tools.ts +31 -26
  21. package/src/output-file.ts +23 -1
  22. package/src/package-resources.ts +25 -10
  23. package/src/process-budget.ts +346 -0
  24. package/src/quota-admission.ts +21 -9
  25. package/src/resource-loader.ts +51 -0
  26. package/src/schedule.ts +41 -19
  27. package/src/settings.ts +111 -8
  28. package/src/skill-loader.ts +8 -7
  29. package/src/stale-ctx.ts +16 -0
  30. package/src/types.ts +33 -0
  31. package/src/ui/agent-row.ts +13 -3
  32. package/src/ui/agent-widget.ts +15 -4
  33. package/src/ui/conversation-viewer.ts +6 -3
  34. package/src/ui/fallback-flag.ts +90 -0
  35. package/src/ui/fleet-list.ts +363 -53
  36. package/src/ui/fleet-state.ts +154 -0
  37. package/src/ui/notification-view.ts +18 -2
  38. package/src/ui/workflow-card.ts +5 -1
  39. package/src/ui/workflow-dialog.ts +10 -0
  40. package/src/workflow/host.ts +43 -45
  41. package/src/workflow/journal.ts +13 -1
  42. package/src/workflow/progress.ts +4 -0
  43. package/src/workflow/runtime.ts +25 -8
  44. package/src/workflow/saved.ts +19 -17
  45. package/src/workflow/task.ts +10 -0
  46. package/src/workflow/worker-source.ts +156 -38
@@ -27,15 +27,15 @@
27
27
 
28
28
  import { existsSync } from "node:fs";
29
29
  import { join, sep } from "node:path";
30
- import { getAgentDir } from "@earendil-works/pi-coding-agent";
31
30
  import { parseAgentFrontmatter } from "./custom-agents.js";
31
+ import { resolveAgentDir } from "./home-paths.js";
32
32
  import type { AgentConfig } from "./types.js";
33
33
 
34
34
  export type AgentFileLocation = "project" | "workspace" | "personal";
35
35
 
36
36
  export const projectAgentsDir = (cwd: string = process.cwd()) => join(cwd, ".pi", "agents");
37
37
  export const workspaceAgentsDir = (cwd: string = process.cwd()) => join(cwd, ".agents", "agents");
38
- export const personalAgentsDir = () => join(getAgentDir(), "agents");
38
+ export const personalAgentsDir = (homeDir?: string) => join(resolveAgentDir(homeDir), "agents");
39
39
 
40
40
  /**
41
41
  * Find the file path of a custom agent by name, in discovery-precedence order
@@ -46,12 +46,13 @@ export const personalAgentsDir = () => join(getAgentDir(), "agents");
46
46
  export function findAgentFile(
47
47
  name: string,
48
48
  cwd: string = process.cwd(),
49
+ homeDir?: string,
49
50
  ): { path: string; location: AgentFileLocation } | undefined {
50
51
  const projectPath = join(projectAgentsDir(cwd), `${name}.md`);
51
52
  if (existsSync(projectPath)) return { path: projectPath, location: "project" };
52
53
  const workspacePath = join(workspaceAgentsDir(cwd), `${name}.md`);
53
54
  if (existsSync(workspacePath)) return { path: workspacePath, location: "workspace" };
54
- const personalPath = join(personalAgentsDir(), `${name}.md`);
55
+ const personalPath = join(personalAgentsDir(homeDir), `${name}.md`);
55
56
  if (existsSync(personalPath)) return { path: personalPath, location: "personal" };
56
57
  return undefined;
57
58
  }
@@ -83,11 +84,12 @@ export function locateAgentFile(
83
84
  sourcePath: string | undefined,
84
85
  cwd: string = process.cwd(),
85
86
  source?: AgentConfig["source"],
87
+ homeDir?: string,
86
88
  ): { path: string; location: AgentFileLocation } | undefined {
87
89
  if (source !== "package" && sourcePath && existsSync(sourcePath)) {
88
90
  return { path: sourcePath, location: classifyAgentDir(sourcePath, cwd) };
89
91
  }
90
- return findAgentFile(name, cwd);
92
+ return findAgentFile(name, cwd, homeDir);
91
93
  }
92
94
 
93
95
  /**