@ferris1225/pi-subagents 5.0.6 → 6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Breaking changes
6
+
7
+ - Support only the built-in `code-review`, `research`, and `migration` workflows
8
+ through `workflow` plus `inputs`. Remove inline graphs, custom names, workflow
9
+ files, and user/project workflow discovery. Keep old interrupted records
10
+ readable for recovery.
11
+ - Embed routing guidance and workflow templates in the extension. Remove the
12
+ separately loaded workflow skill and root workflow resource directory.
13
+
14
+ ### Changes
15
+
16
+ - Append one mandatory independent sentinel acceptance officer to every
17
+ workflow. Review all settled work and integration evidence, including failed
18
+ branches; require an explicit terminal PASS, and reject missing, ambiguous,
19
+ malformed, or FAIL verdicts. Cancellation skips acceptance.
20
+ - Replace ambiguous graph-source selection with direct built-in input errors.
21
+ Give different template inputs distinct phase identities while retaining
22
+ duplicate ownership for the same deliverable. Preserve brace syntax in task
23
+ inputs as literal text instead of interpreting it as graph dependencies.
24
+ - Redesign the terminal board around work progress, blocking reasons, and a
25
+ separate required-acceptance row. Keep failures visible within the 10-line
26
+ budget, preserve narrow-screen identity, and correct hidden-task counts.
27
+ - Redesign setup as a role selector with focused model/thinking details, using
28
+ side-by-side or stacked layouts. Preserve search, paging, focus, and default
29
+ versus override information. Budget setup height with the host's widget and
30
+ footer so required acceptance remains visible in a 24-row terminal.
31
+ - Preserve managed recovery references when the original checkout is temporarily
32
+ unavailable. Use stable durable identities and cross-process manifest locks
33
+ so separate windows cannot overwrite or delete each other's recovery records.
34
+ Match recovered workflow children by durable identity after local renumbering,
35
+ keep project keys stable through unavailable checkouts with aliased parent paths,
36
+ and exclude lock directories from project scans.
37
+ - Preserve concurrent recovery additions during announcements and keep newly
38
+ settled long-running sessions inside their follow-up retention window.
39
+ - Remove duplicate manifest scans and model-catalog lookups. Stop idle widget
40
+ refreshes and fix zero-width summaries and ANSI-contaminated task labels.
41
+
3
42
  ## 5.0.6
4
43
 
5
44
  ### Changes
package/README.md CHANGED
@@ -11,13 +11,15 @@ Requires **Pi >= 1.0.0** and **Node.js >= 22.19.0**.
11
11
  pi install npm:@ferris1225/pi-subagents
12
12
  ```
13
13
 
14
- Run `/subagents-setup` for a role grid: one row per role with **Model**,
15
- **Thinking**, and **Reset** as columns. ↑/↓ moves between roles, ←/→ between
16
- columns, and Enter edits the highlighted value. Headers align with their values,
17
- and the footer names the focused role and field; **Thinking** selects reasoning
18
- effort. Each selection saves immediately;
19
- Esc returns without applying a picker selection, and the grid keeps the focused
20
- cell. Model pickers support search, paste, and paging.
14
+ Run `/subagents-setup` for a role selector and focused settings editor. Wide
15
+ terminals place them side by side; narrow terminals stack them. ↑/↓ changes the
16
+ role, ←/→ selects **Model**, **Thinking**, or **Reset**, and Enter edits it.
17
+ The selected role shows its full model reference, effective reasoning level,
18
+ requested level when clamped, and default/override source. Each selection saves
19
+ immediately; Esc returns without applying a picker selection and keeps focus.
20
+ Model pickers support search, paste, and paging. On short terminals, PgUp/PgDn
21
+ scrolls the settings while the selected role and field stay pinned. Setup
22
+ reserves space for the workflow's required-acceptance row.
21
23
 
22
24
  All roles follow the main model by default; thinking defaults to `low` for scout
23
25
  and `high` for artisan, sentinel, and skeptic. The panel distinguishes defaults from overrides and
@@ -48,9 +50,8 @@ and valid checks, filling gaps rather than repeating main or upstream work.
48
50
  Only `scout`, `artisan`, `sentinel`, and `skeptic` are valid runtime role names.
49
51
  Existing model/thinking settings and interrupted run records migrate on load
50
52
  and are saved with the new names. Explicit valid settings under the new names
51
- win. A selected trusted saved workflow is migrated on disk before compilation;
52
- its briefs, node ids, and dependency edges are preserved. Discovery remains
53
- read-only. New tool calls and inline graphs using retired names are rejected.
53
+ win. Custom roles and user-defined workflows are not supported. Retained records
54
+ from older releases remain available for recovery.
54
55
 
55
56
  Children receive a self-contained brief and project instructions, but no parent
56
57
  conversation. They cannot delegate or release. Main owns planning, integration,
@@ -134,63 +135,77 @@ phase/scope ownership; an exact run id also retrieves its retained result for re
134
135
 
135
136
  ## Workflows
136
137
 
137
- Main proactively chooses `subagent_workflow` for two or more substantial phases
138
- with known dependencies and write scopes when scheduling them saves coordination.
139
- Independent phases without dependency edges use `subagent` with `tasks`; a single
140
- justified phase uses one `subagent` run. Small work stays in main.
138
+ `subagent_workflow` runs a built-in plan with named task inputs. Its only source
139
+ is the catalog in [templates.ts](./src/workflow/templates.ts): no inline `nodes`,
140
+ `file`, custom graph name, user directory, or project directory is loaded.
141
+ The model's routing rules are embedded in [prompt.ts](./src/delegation/prompt.ts),
142
+ so no separate workflow skill needs to be loaded.
141
143
 
142
- If a research result must determine the next task or its scope, run that phase
143
- first, decide in main, then reassess whether the remaining work fits a graph.
144
- A workflow runs a fixed plan; it does not discover the plan or adapt its nodes
145
- while running. Research, implementation, review, and confirmation are added only
146
- when the task needs their distinct work.
144
+ | Workflow | Work before acceptance | Required inputs |
145
+ | --- | --- | --- |
146
+ | `code-review` | Sentinel inspects the target and produces supported findings | `TARGET` |
147
+ | `research` | Three scouts investigate first-party sources, practice, and the repository; a fourth synthesizes the answer | `QUESTION` |
148
+ | `migration` | Two artisans implement disjoint slices; an integrated gate checks and fixes their combined result | `TARGET`, `CONTRACT`, `CORE_CHANGE`, `ADAPTER_CHANGE`, `CORE_SCOPE`, `CORE_TEST_SCOPE`, `ADAPTER_SCOPE`, `ADAPTER_TEST_SCOPE` |
147
149
 
148
150
  ```ts
149
151
  subagent_workflow({
150
- name: "auth-fix",
151
- nodes: [
152
- {
153
- id: "fix",
154
- agent: "artisan",
155
- task: "Fix the refresh race in src/auth and add regression tests. Run the relevant checks.",
156
- scope: { paths: ["src/auth", "test/auth.test.ts"] },
157
- },
158
- {
159
- id: "review",
160
- agent: "sentinel",
161
- dependsOn: ["fix"],
162
- task: "Inspect the implementation against the refresh contract and callers. Reuse valid checks and investigate concrete gaps. Do not edit files.\n{{fix}}",
163
- },
164
- ],
152
+ workflow: "code-review",
153
+ inputs: { TARGET: "HEAD~1..HEAD; inspect the cache invalidation fix" },
165
154
  });
166
- ```
167
-
168
- `dependsOn` starts a node after its prerequisites complete and integrate.
169
- `{{id}}` inserts an upstream answer; `.status`, `.runId`, and `.error` expose its
170
- facts. Long answers include a full-result file. A failed node blocks its
171
- dependents; independent branches continue. The graph delivers one summary.
172
155
 
173
- Reviews inspect implementations; claim verification tests named findings or
174
- assumptions. Add independent verification only when its distinct work earns the cost.
156
+ subagent_workflow({
157
+ workflow: "research",
158
+ inputs: { QUESTION: "How should this repository invalidate its HTTP cache?" },
159
+ });
160
+ ```
175
161
 
176
- Saved definitions use JSON or Markdown with a `json` fenced block:
162
+ Migration inputs must name the shared interface contract, both slice briefs, and
163
+ exact write paths. Each slice owns its implementation and regression tests;
164
+ shared paths are rejected before any child starts. The integrated gate waits
165
+ for both slices and can edit their combined scope. For example:
177
166
 
178
167
  ```ts
179
- subagent_workflow({ workflow: "code-review" });
180
- subagent_workflow({ file: ".pi/workflows/code-review.md" });
168
+ subagent_workflow({
169
+ workflow: "migration",
170
+ inputs: {
171
+ TARGET: "the version 2 cache API",
172
+ CONTRACT: "docs/cache-v2.md",
173
+ CORE_CHANGE: "Update storage and its invalidation rules",
174
+ ADAPTER_CHANGE: "Update HTTP callers to the new interface",
175
+ CORE_SCOPE: "src/core",
176
+ CORE_TEST_SCOPE: "test/core",
177
+ ADAPTER_SCOPE: "src/adapters",
178
+ ADAPTER_TEST_SCOPE: "test/adapters",
179
+ },
180
+ });
181
181
  ```
182
182
 
183
- Definitions load from `.pi/workflows/`, `~/.pi/agent/workflows/`, and the shipped
184
- [templates](./workflows), in that order of precedence. Project definitions and
185
- explicit file paths require project trust. Customize template questions, targets,
186
- and scopes before running them. The `code-review` template has two nodes:
187
- sentinel reviews the target, then skeptic verifies only the reported claims and
188
- returns the final review. An ordinary review uses one sentinel. The `migration`
189
- template passes the shared interface contract to every slice and declares the
190
- closing gate's write scope. Run the full integrated gate once in main or a closing
191
- node, and repeat it when later edits or unresolved failures warrant it.
192
-
193
- See the [workflow skill](./skills/workflow/SKILL.md) for graph authoring details.
183
+ Choose a built-in workflow when its fixed phases fit the task. For one bounded
184
+ phase use `subagent`; for independent work use `subagent({ tasks: [...] })`.
185
+ If research must determine the next task or its scope, run it first and decide
186
+ in main. Missing, unknown, or unused template inputs are rejected with the exact
187
+ parameter names before a child starts. Task inputs remain literal, including
188
+ `{{...}}` text.
189
+
190
+ Every workflow ends with an independent **sentinel acceptance officer**. The
191
+ runtime adds this node, waits until all work has settled and integrated, and
192
+ passes a bounded evidence brief plus the complete report. Failed and blocked
193
+ branches are included. The officer reviews the delivered outcome, reuses valid
194
+ checks, and may run focused checks to close evidence gaps. It does not edit or
195
+ release. A successful code review can report defects in the target; acceptance
196
+ judges the accuracy and completeness of that review.
197
+
198
+ The final answer must end with `WORKFLOW_ACCEPTANCE: PASS` or
199
+ `WORKFLOW_ACCEPTANCE: FAIL`. A missing, ambiguous, malformed, or negative verdict
200
+ fails the workflow even when the reviewer process exits normally. A PASS cannot
201
+ clear failures in earlier work. Explicit cancellation or session interruption
202
+ stops the graph without starting acceptance. The graph sends one final summary
203
+ containing its acceptance result; main still owns remediation, the final gate,
204
+ and release.
205
+
206
+ Phase identity includes the built-in plan and its inputs. The same deliverable
207
+ remains owned within its workspace; different questions or targets can run in
208
+ the same session. Inspect retained results instead of repeating completed work.
194
209
 
195
210
  ## Status, cancellation, and recovery
196
211
 
@@ -204,18 +219,20 @@ See the [workflow skill](./skills/workflow/SKILL.md) for graph authoring details
204
219
  | `subagent_stop({ workflow: 3 })` | Stop a graph and finalize its active nodes |
205
220
  | `subagent_stop({ all: true })` | Stop all active runs and graphs |
206
221
 
207
- The widget is a compact task board capped at 10 lines: a status overview,
208
- workflow progress groups, and task rows with status and elapsed time at the right.
209
- Activity, model, thinking, token usage, and worktree state use secondary lines as
210
- space permits. Task identities take priority over detail; failed and blocked
211
- work takes priority over ordinary activity. Completed nodes collapse into graph
212
- progress while their workflow is running. Successfully completed workflows hide
213
- automatically, while failed or blocked work stays visible until the next dispatch.
222
+ The widget is a terminal task board capped at 10 lines: a quiet overview,
223
+ workflow identity and work progress, then task rows with status/time at the
224
+ right. Failures and blocked reasons get space before optional telemetry; narrow
225
+ terminals keep task identity visible. Model, thinking, token usage, and worktree
226
+ state appear as secondary detail. Each workflow has a separate **Acceptance
227
+ required** row showing pending, running, PASS, or FAIL. Acceptance does not
228
+ inflate the ordinary work count or hidden-task total. Completed work collapses
229
+ into progress while acceptance is pending; a successfully accepted workflow
230
+ hides automatically. Failed or blocked work stays until the next dispatch.
214
231
  Completion messages and status lookups retain the results. Overflow reports
215
- hidden tasks. Runs preparing their child process show `starting`. There is no
216
- process-count limit or shared-checkout startup
217
- lock: independent runs start together, including separate dispatch calls while
218
- another call awaits results.
232
+ hidden tasks. Runs preparing their child process show `starting`. The refresh
233
+ timer runs only while visible active work needs it. There is no process-count
234
+ limit or shared-checkout startup lock: independent runs start together, including
235
+ separate dispatch calls while another call awaits results.
219
236
 
220
237
  Usually omit `isolation`: implementation tasks use detached Git worktrees in
221
238
  single calls, parallel batches, and workflows. Reading and review use the current
@@ -296,6 +313,17 @@ and freed bytes; `/subagents-cleanup dry-run` measures without deleting anything
296
313
 
297
314
  ## Development
298
315
 
316
+ Runtime code lives under `src/`; the package has no skill or workflow resource
317
+ directories. Built-in prompts and plans change with the code and its tests.
318
+
319
+ | Module | Responsibility |
320
+ | --- | --- |
321
+ | `delegation/` | Built-in roles, parent routing prompt, and phase/scope ownership |
322
+ | `workflow/` | Built-in templates, parameter validation, scheduling, and mandatory acceptance |
323
+ | `configuration/` | Model and thinking settings, plus the setup interface |
324
+ | `presentation/` | Running task board, activity, status, and result formatting |
325
+ | `execution/`, `lifecycle/`, `isolation/` | Child processes, durable state, cancellation, worktrees, and recovery |
326
+
299
327
  ```bash
300
328
  npm ci
301
329
  npm run check
package/index.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * - configuration/ — persisted settings, model routes, and setup UI
8
8
  * - execution/ — background tasks, native RPC transport, and model handoff
9
9
  * - lifecycle/ — durable threads, restoration, controls, and delivery
10
- * - workflow/ — dependency-graph plans, discovery, and the graph runner
10
+ * - workflow/ — built-in plans, dependency runner, and acceptance
11
11
  * - isolation/ — Git worktrees, recovery, and temporary-state hygiene
12
12
  * - presentation/ — announcements, formatting, monitor, and the active-run
13
13
  * widget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "5.0.6",
3
+ "version": "6.0.0",
4
4
  "description": "A managed sub-agent team for pi: research, implementation, independent review, interactive follow-ups, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,8 +25,6 @@
25
25
  "files": [
26
26
  "index.ts",
27
27
  "src",
28
- "skills",
29
- "workflows",
30
28
  "README.md",
31
29
  "CHANGELOG.md",
32
30
  "LICENSE"
@@ -34,9 +32,6 @@
34
32
  "pi": {
35
33
  "extensions": [
36
34
  "./index.ts"
37
- ],
38
- "skills": [
39
- "./skills"
40
35
  ]
41
36
  },
42
37
  "scripts": {
@@ -30,8 +30,8 @@ function migrateField(value: unknown, key: string): boolean {
30
30
  return true;
31
31
  }
32
32
 
33
- /** Accept saved plans or bare node arrays; never rewrite briefs or node ids. */
34
- export function migrateStoredWorkflowRoles(value: unknown): boolean {
33
+ /** Retained graph nodes keep their original briefs, ids, and dependencies. */
34
+ function migrateStoredWorkflowRoles(value: unknown): boolean {
35
35
  const nodes = Array.isArray(value) ? value : value && typeof value === "object" ? (value as { nodes?: unknown }).nodes : undefined;
36
36
  if (!Array.isArray(nodes)) return false;
37
37
  let changed = false;
@@ -53,12 +53,14 @@ function roleModel(ctx: ExtensionContext, config: SubagentsConfig, name: string)
53
53
  /** One row per role: every model and thinking choice stays visible together. */
54
54
  function roleRows(ctx: ExtensionContext, config: SubagentsConfig): RoleGridRow[] {
55
55
  const mainRef = currentModelRef(ctx) ?? "Pi default";
56
+ const models = availableModelsInScope(ctx);
56
57
  return BUILTIN_AGENT_NAMES.map((name) => {
57
58
  const profile = agentProfile(name)!;
58
59
  const selected = config.agentModels[name];
59
- const available = !selected || Boolean(findModelByRef(availableModelsInScope(ctx), selected));
60
+ const model = findModelByRef(models, selected);
61
+ const available = !selected || Boolean(model);
60
62
  const preferred = config.agentThinkingLevels[name] ?? roleThinkingLevel(name);
61
- const effective = resolveThinkingLevel(roleModel(ctx, config, name), preferred);
63
+ const effective = resolveThinkingLevel(model ?? ctx.model, preferred);
62
64
  const clamped = effective !== preferred ? " (" + preferred + " requested)" : "";
63
65
  const overridden = Boolean(config.agentThinkingLevels[name]);
64
66
  return {