@pi-unipi/subagents 0.2.7 → 2.0.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.
package/README.md CHANGED
@@ -1,34 +1,46 @@
1
1
  # @pi-unipi/subagents
2
2
 
3
- Parallel sub-agent execution for [Pi coding agent](https://github.com/badlogic/pi-mono). Spawn background or foreground agents, track activity, and manage concurrent work.
3
+ Parallel execution with file locking. Spawn background or foreground agents to work on tasks concurrently — research files, fix lint errors, run tests while the main agent keeps going.
4
4
 
5
- ## Install
5
+ Two built-in agent types: `explore` for read-only research, `work` for file modifications with transparent locking. Define your own types as markdown files.
6
6
 
7
- ```bash
8
- pi install npm:@pi-unipi/subagents
9
- ```
7
+ ## Commands
10
8
 
11
- Or as part of the full suite:
12
- ```bash
13
- pi install npm:unipi
14
- ```
9
+ Subagents has no user commands. It's an agent tool package — the agent calls it directly.
10
+
11
+ ## Special Triggers
15
12
 
16
- ## Tools
13
+ Workflow skills detect subagents and inject parallel strategies. When `@pi-unipi/subagents` is installed, these skills get enhanced:
14
+
15
+ | Skill | What Changes |
16
+ |-------|--------------|
17
+ | `brainstorm` | Parallel research for different approaches |
18
+ | `document` | Parallel documentation of different modules |
19
+ | `gather-context` | Parallel codebase exploration |
20
+ | `review-work` | Parallel task verification |
21
+ | `scan-issues` | Parallel scanning by category |
22
+ | `work` | Parallel task execution (with file locking) |
23
+
24
+ Subagents registers with the info-screen dashboard, showing active agents and their status. The footer displays agent activity in its extension status segment.
25
+
26
+ ## Agent Tools
17
27
 
18
28
  | Tool | Description |
19
29
  |------|-------------|
20
30
  | `spawn_helper` | Launch a sub-agent for parallel work |
21
31
  | `get_helper_result` | Check status and retrieve results from a background agent |
22
32
 
23
- ## Agent Types
33
+ ### spawn_helper Parameters
24
34
 
25
- | Type | Description |
26
- |------|-------------|
27
- | `explore` | Parallel file reads, research, analysis |
28
- | `work` | Parallel file writes with transparent locking |
29
- | Custom | Define your own in `~/.unipi/config/agents/<name>.md` |
30
-
31
- ## Usage
35
+ | Parameter | Description |
36
+ |-----------|-------------|
37
+ | `type` | Agent type (`explore`, `work`, or custom) |
38
+ | `prompt` | Task for the agent |
39
+ | `description` | Short description (3-5 words) |
40
+ | `run_in_background` | Return immediately, notify on completion |
41
+ | `max_turns` | Max agentic turns before stopping |
42
+ | `model` | Model override (e.g. `"haiku"`, `"sonnet"`) |
43
+ | `thinking` | Thinking level (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`) |
32
44
 
33
45
  ### Foreground (blocks until done)
34
46
 
@@ -57,18 +69,6 @@ spawn_helper(
57
69
  get_helper_result(agent_id: "helper_abc123")
58
70
  ```
59
71
 
60
- ## Options
61
-
62
- | Parameter | Description |
63
- |-----------|-------------|
64
- | `type` | Agent type (`explore`, `work`, or custom) |
65
- | `prompt` | Task for the agent |
66
- | `description` | Short description (3-5 words) |
67
- | `run_in_background` | Return immediately, notify on completion |
68
- | `max_turns` | Max agentic turns before stopping |
69
- | `model` | Model override (e.g. `"haiku"`, `"sonnet"`) |
70
- | `thinking` | Thinking level (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`) |
71
-
72
72
  ## Custom Agent Types
73
73
 
74
74
  Create markdown files defining agent behavior:
@@ -81,7 +81,7 @@ Create markdown files defining agent behavior:
81
81
  <workspace>/.unipi/config/agents/deployer.md
82
82
  ```
83
83
 
84
- ## Configuration
84
+ ## Configurables
85
85
 
86
86
  ```json
87
87
  // ~/.unipi/config/subagents.json
@@ -95,19 +95,11 @@ Create markdown files defining agent behavior:
95
95
  }
96
96
  ```
97
97
 
98
- ## Features
99
-
100
- - **Concurrent execution** run up to N agents simultaneously
101
- - **File locking** transparent locking for parallel writes
102
- - **ESC propagation** kill all agents with ESC
103
- - **Activity tracking** — real-time widget showing agent progress
104
- - **Info screen integration** — agent status in dashboard
105
-
106
- ## Dependencies
107
-
108
- - `@pi-unipi/core` — shared utilities
109
- - `@pi-unipi/workflow` — workflow integration
110
- - `@pi-unipi/info-screen` — dashboard registration
98
+ | Setting | Default | What It Does |
99
+ |---------|---------|--------------|
100
+ | `enabled` | true | Enable/disable subagents |
101
+ | `maxConcurrent` | 3 | Max agents running at once |
102
+ | `types.{name}.enabled` | true | Toggle agent types |
111
103
 
112
104
  ## License
113
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/subagents",
3
- "version": "0.2.7",
3
+ "version": "2.0.0",
4
4
  "description": "Subagents for UniPi — parallel execution, file locking, workflow integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ import { Type } from "@sinclair/typebox";
12
12
  import { existsSync, readdirSync } from "node:fs";
13
13
  import { join } from "node:path";
14
14
  import { homedir } from "node:os";
15
- import { emitEvent, MODULES, UNIPI_EVENTS } from "@pi-unipi/core";
15
+ import { emitEvent, MODULES, UNIPI_EVENTS, type UnipiBadgeGenerateRequestEvent } from "@pi-unipi/core";
16
16
  import { AgentManager } from "./agent-manager.js";
17
17
  import { initConfig } from "./config.js";
18
18
  import { type AgentActivity, type NotificationDetails, BUILTIN_TYPES } from "./types.js";
@@ -21,8 +21,7 @@ import { AgentWidget } from "./widget.js";
21
21
 
22
22
  /** Get info registry from global */
23
23
  function getInfoRegistry() {
24
- const g = globalThis as any;
25
- return g.__unipi_info_registry;
24
+ return globalThis.__unipi_info_registry;
26
25
  }
27
26
 
28
27
  // ---- Formatting helpers (shared between renderers and inline text) ----
@@ -338,7 +337,7 @@ export default function (pi: ExtensionAPI) {
338
337
  }
339
338
 
340
339
  // Store session context for badge generation
341
- let sessionCtx: any = null;
340
+ let sessionCtx: import("@mariozechner/pi-coding-agent").ExtensionContext | null = null;
342
341
 
343
342
  // Session start: emit MODULE_READY + capture context
344
343
  pi.on("session_start", async (_event, ctx) => {
@@ -352,7 +351,8 @@ export default function (pi: ExtensionAPI) {
352
351
  });
353
352
 
354
353
  // Listen for badge generation requests — spawn background agent
355
- pi.events.on(UNIPI_EVENTS.BADGE_GENERATE_REQUEST, async (event: any) => {
354
+ pi.events.on(UNIPI_EVENTS.BADGE_GENERATE_REQUEST, async (data) => {
355
+ const event = data as UnipiBadgeGenerateRequestEvent;
356
356
  if (!sessionCtx) return;
357
357
 
358
358
  const summary = event?.conversationSummary ?? "";
package/src/widget.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  import { truncateToWidth } from "@mariozechner/pi-tui";
14
+ import type { ExtensionUIContext } from "@mariozechner/pi-coding-agent";
14
15
  import type { AgentManager } from "./agent-manager.js";
15
16
  import type { AgentActivity } from "./types.js";
16
17
 
@@ -94,8 +95,8 @@ function describeActivity(activeTools: Map<string, string>, responseText?: strin
94
95
  export class AgentWidget {
95
96
  private spinnerFrame = 0;
96
97
  private timer?: ReturnType<typeof setInterval>;
97
- private uiCtx?: any;
98
- private tui?: any;
98
+ private uiCtx?: ExtensionUIContext;
99
+ private tui?: import("@mariozechner/pi-tui").TUI;
99
100
  private widgetRegistered = false;
100
101
  /** Last content key — skips requestRender when only spinner changed. */
101
102
  private lastContentKey = "";
@@ -112,7 +113,7 @@ export class AgentWidget {
112
113
  private activity: Map<string, AgentActivity>,
113
114
  ) {}
114
115
 
115
- setUICtx(ctx: any) {
116
+ setUICtx(ctx: ExtensionUIContext) {
116
117
  if (ctx !== this.uiCtx) {
117
118
  this.uiCtx = ctx;
118
119
  this.widgetRegistered = false;