@ferris1225/pi-subagents 4.3.21 → 4.3.23

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
@@ -3,6 +3,20 @@
3
3
  Release notes for `@ferris1225/pi-subagents`. Only the most recent releases
4
4
  are kept here; every published version is preserved as a GitHub Release.
5
5
 
6
+ ## 4.3.23
7
+
8
+ - Track Pi 1.0.3. The extension API, RPC command types, and the child
9
+ `registerProvider` path are unchanged. Pi renamed the Azure provider from
10
+ `azure-openai-responses` to `azure`; a stored agent model override follows
11
+ whichever of those ids the live catalog still lists, and is rewritten to
12
+ `azure/<id>` once that is the one Pi reports.
13
+
14
+ ## 4.3.22
15
+
16
+ - Use a subagent when the work can run independently in parallel, its boundary
17
+ is clear, and delegation will actually reduce cost or improve completion
18
+ quality. Role choice still prefers scout or artisan when that gate is met.
19
+
6
20
  ## 4.3.21
7
21
 
8
22
  - Ship `scout` and `artisan` only. Scout is the lightweight read-only researcher;
package/README.md CHANGED
@@ -8,10 +8,20 @@
8
8
 
9
9
  On-demand delegation for [pi](https://github.com/earendil-works/pi): a lightweight
10
10
  reader and an implementer, durable threads, and Git worktree isolation. Main
11
- prefers those two roles when the work fits, and keeps small understood edits itself.
11
+ uses a subagent when the work can run independently in parallel, the boundary
12
+ is clear, and delegation will actually reduce cost or improve completion quality.
12
13
 
13
14
  ## What's new
14
15
 
16
+ **4.3.23** — Pi 1.0.3. Development dependencies track that release. A stored
17
+ agent model that still names `azure-openai-responses/<id>` keeps working: it
18
+ follows the live catalog, and is saved as `azure/<id>` once that is the id Pi
19
+ reports.
20
+
21
+ **4.3.22** — use a subagent when the work can run independently in parallel, its
22
+ boundary is clear, and delegation will actually reduce cost or improve
23
+ completion quality. Role choice stays with scout and artisan.
24
+
15
25
  **4.3.21** — two built-in roles. `scout` is the lightweight read-only researcher
16
26
  and `artisan` implements one substantial change. Steward and sentinel are no
17
27
  longer shipped. Role prompts follow the GPT-6 Astra guidance: the brief wins,
@@ -77,11 +87,13 @@ at "spawn a child with a prompt" and leave the hard parts — when to delegate,
77
87
  wide to fan out, what happens when a model dies, how results come
78
88
  back — with you. This extension owns them:
79
89
 
80
- - Main prefers `scout` for unfamiliar code or external facts and `artisan` for
81
- one substantial change. Independent phases go out together. A small edit
82
- already understood in the current context stays in main, and a free process
83
- slot is not a reason to invent another phase. Briefs define the outcome, done
84
- condition, useful context, and boundaries.
90
+ - Main uses a subagent when the work can run independently in parallel, its
91
+ boundary is clear, and delegation will actually reduce cost or improve
92
+ completion quality. `scout` covers unfamiliar code or external facts;
93
+ `artisan` covers one substantial change. A small edit already understood in
94
+ the current context stays in main, and a free process slot is not a reason
95
+ to invent another phase. Briefs define the outcome, done condition, useful
96
+ context, and boundaries.
85
97
  - A stable `phaseId` owns a logical phase in one resolved working directory even if
86
98
  its task wording changes. IDs are 1–80 ASCII letters, numbers, or `._:-`, starting
87
99
  with a letter or number, so lease output stays single-line. Exact normalized task+cwd
@@ -148,7 +160,7 @@ material assumptions or blockers.
148
160
 
149
161
  Children run the official `pi --mode rpc` server, using Pi's exported command/response
150
162
  types and its own session persistence. There is no separate subagent protocol. The
151
- host transport remains local. Pi 1.0.2's `RpcClient` still spawns its own `node`
163
+ host transport remains local. Pi 1.0.3's `RpcClient` still spawns its own `node`
152
164
  process, signals only that process, and does not provide process-tree shutdown,
153
165
  bounded abort coordination, or cancellation of child extension dialogs.
154
166
 
@@ -185,9 +197,11 @@ subagent({
185
197
  });
186
198
  ```
187
199
 
188
- Main prefers scout or artisan when that role fits, and puts independent phases
189
- in one `tasks` array. It keeps a small, already-understood edit itself. A free
190
- process slot is not a reason to invent another phase. The runtime paces
200
+ Main uses a subagent when the work can run independently in parallel, its
201
+ boundary is clear, and delegation will actually reduce cost or improve
202
+ completion quality. It puts those independent phases in one `tasks` array and
203
+ keeps a small, already-understood edit itself. A free process slot is not a
204
+ reason to invent another phase. The runtime paces
191
205
  execution: `maxConcurrentAgents: 0` (the default) keeps automatic capacity at half
192
206
  the machine's cores, bounded to 4–6 child processes. Set `maxConcurrentAgents` to
193
207
  1–6 for an explicit capacity. Wider batches queue and start as slots free.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "4.3.21",
3
+ "version": "4.3.23",
4
4
  "description": "A managed sub-agent team for pi: lightweight scout research and artisan implementation, one-shot runs, read-only status, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,11 +49,11 @@
49
49
  "typebox": "*"
50
50
  },
51
51
  "devDependencies": {
52
- "@earendil-works/pi-agent-core": "^1.0.2",
53
- "@earendil-works/pi-ai": "^1.0.2",
54
- "@earendil-works/pi-coding-agent": "^1.0.2",
55
- "@earendil-works/pi-server": "^1.0.2",
56
- "@earendil-works/pi-tui": "^1.0.2",
52
+ "@earendil-works/pi-agent-core": "^1.0.3",
53
+ "@earendil-works/pi-ai": "^1.0.3",
54
+ "@earendil-works/pi-coding-agent": "^1.0.3",
55
+ "@earendil-works/pi-server": "^1.0.3",
56
+ "@earendil-works/pi-tui": "^1.0.3",
57
57
  "@types/node": "^22.10.0",
58
58
  "typebox": "^1.3.27",
59
59
  "typescript": "^5.9.0"
@@ -54,6 +54,32 @@ function cleanModelRef(ref: string | undefined): string | undefined {
54
54
  return trimmed || undefined;
55
55
  }
56
56
 
57
+ /**
58
+ * Provider ids Pi renamed while keeping the model id. Pi 1.0.3 renamed
59
+ * `azure-openai-responses` to `azure`. The old id stays valid on earlier 1.0
60
+ * hosts, so a stored override follows whichever id the live catalog still has.
61
+ */
62
+ const RENAMED_PROVIDER_IDS: Readonly<Record<string, string>> = {
63
+ "azure-openai-responses": "azure",
64
+ };
65
+
66
+ /** Stored ref plus the renamed provider id, when Pi published one. */
67
+ export function modelRefAliases(ref: string): readonly string[] {
68
+ const normalized = ref.trim();
69
+ const slash = normalized.indexOf("/");
70
+ if (slash <= 0 || slash >= normalized.length - 1) return [normalized];
71
+ const renamed = RENAMED_PROVIDER_IDS[normalized.slice(0, slash)];
72
+ if (!renamed) return [normalized];
73
+ return [normalized, `${renamed}${normalized.slice(slash)}`];
74
+ }
75
+
76
+ /** Prefer the alias that the live catalog actually lists. */
77
+ function resolveLiveModelRef(ref: string, liveRefs: ReadonlySet<string> | undefined): string | undefined {
78
+ const aliases = modelRefAliases(ref);
79
+ if (!liveRefs) return aliases[0];
80
+ return aliases.find((candidate) => liveRefs.has(candidate));
81
+ }
82
+
57
83
  export function modelRef(model: { provider: string; id: string }): string {
58
84
  return `${model.provider}/${model.id}`;
59
85
  }
@@ -82,7 +108,9 @@ export function findModelByRef(
82
108
  ref: string | undefined,
83
109
  ): Model<Api> | undefined {
84
110
  const normalized = cleanModelRef(ref);
85
- return normalized ? models.find((model) => modelRef(model) === normalized) : undefined;
111
+ if (!normalized) return undefined;
112
+ const aliases = new Set(modelRefAliases(normalized));
113
+ return models.find((model) => aliases.has(modelRef(model)));
86
114
  }
87
115
 
88
116
  /** Split persisted agent model overrides into the ones Pi still reports as
@@ -95,7 +123,10 @@ export function filterUnavailableModelOverrides(
95
123
  const kept: Record<string, string> = {};
96
124
  const dropped: Array<{ agent: string; ref: string }> = [];
97
125
  for (const [agent, ref] of Object.entries(agentModels)) {
98
- if (findModelByRef(models, ref)) kept[agent] = ref;
126
+ const model = findModelByRef(models, ref);
127
+ // Persist the id the live catalog uses, so a renamed provider does not
128
+ // stay stored under the id Pi no longer registers.
129
+ if (model) kept[agent] = modelRef(model);
99
130
  else dropped.push({ agent, ref });
100
131
  }
101
132
  return { kept, dropped };
@@ -116,8 +147,9 @@ export function resolveAgentModelRoute(input: AgentModelRouteInput): ResolvedAge
116
147
  const available = input.availableRefs
117
148
  ? new Set(input.availableRefs.map((ref) => ref.trim()).filter(Boolean))
118
149
  : undefined;
119
- const selectedAvailable = !selectedRef || !available || available.has(selectedRef);
120
- const usableSelectedRef = selectedAvailable ? selectedRef : undefined;
150
+ const resolvedSelectedRef = selectedRef ? resolveLiveModelRef(selectedRef, available) : undefined;
151
+ const selectedAvailable = !selectedRef || resolvedSelectedRef !== undefined;
152
+ const usableSelectedRef = selectedAvailable ? resolvedSelectedRef : undefined;
121
153
  const primaryRef = usableSelectedRef ?? mainRef;
122
154
  const ordered = [primaryRef, usableSelectedRef && usableSelectedRef !== mainRef ? mainRef : undefined];
123
155
  const candidateRefs = [...new Set(ordered.filter((ref): ref is string => Boolean(ref)))];
@@ -155,18 +187,21 @@ export function buildModelPickerItems(options: {
155
187
  configuredRef?: string;
156
188
  mainRef?: string;
157
189
  }): ModelPickerItem[] {
158
- const configuredRef = cleanModelRef(options.configuredRef);
159
190
  const mainRef = cleanModelRef(options.mainRef);
160
191
  const byRef = new Map<string, ModelListEntry>();
161
192
  for (const model of options.models) {
162
193
  const ref = modelRef(model);
163
194
  if (!byRef.has(ref)) byRef.set(ref, model);
164
195
  }
196
+ const configuredRef = cleanModelRef(options.configuredRef);
197
+ const liveConfiguredRef = configuredRef
198
+ ? resolveLiveModelRef(configuredRef, new Set(byRef.keys())) ?? configuredRef
199
+ : undefined;
165
200
 
166
201
  const refs = [...byRef.keys()]
167
202
  .sort((left, right) => {
168
- const leftRank = left === configuredRef ? 0 : left === mainRef ? 1 : 2;
169
- const rightRank = right === configuredRef ? 0 : right === mainRef ? 1 : 2;
203
+ const leftRank = left === liveConfiguredRef ? 0 : left === mainRef ? 1 : 2;
204
+ const rightRank = right === liveConfiguredRef ? 0 : right === mainRef ? 1 : 2;
170
205
  return leftRank - rightRank || left.localeCompare(right);
171
206
  });
172
207
 
@@ -178,7 +213,7 @@ export function buildModelPickerItems(options: {
178
213
  const items: ModelPickerItem[] = [dynamic];
179
214
  for (const ref of refs) {
180
215
  const model = byRef.get(ref)!;
181
- const tags = [ref === configuredRef ? "configured" : "", ref === mainRef ? "current main" : ""]
216
+ const tags = [ref === liveConfiguredRef ? "configured" : "", ref === mainRef ? "current main" : ""]
182
217
  .filter(Boolean);
183
218
  const name = model.name.trim() && model.name !== model.id ? model.name.trim() : undefined;
184
219
  items.push({
@@ -149,7 +149,7 @@ function preferredRoleUse(agents: readonly AgentConfig[]): string | undefined {
149
149
  }
150
150
  if (uses.length === 0) return undefined;
151
151
  const preference = uses.length === 1 ? `Prefer ${uses[0]}` : `Prefer ${uses[0]}, and ${uses[1]}`;
152
- return `${preference}. Delegate that work instead of doing it in main when a fresh context or an independent parallel phase would help. Keep a small edit already understood in the current context in main. Do not open a phase that repeats owned work, splits one tightly coupled change, or exists only to fill a free slot.`;
152
+ return `${preference}. Keep a small edit already understood in the current context in main. Do not open a phase that repeats owned work, splits one tightly coupled change, or exists only to fill a free slot.`;
153
153
  }
154
154
 
155
155
  function delegationBody(agents: AgentConfig[]): string {
@@ -160,6 +160,7 @@ function delegationBody(agents: AgentConfig[]): string {
160
160
 
161
161
  const dispatchRules = [
162
162
  "The user's task sets the outcome. If it conflicts with this section, follow the task. Admission still rejects duplicate phases and overlapping writers.",
163
+ "Use a subagent when the work can run independently in parallel, its boundary is clear, and delegation will actually reduce cost or improve completion quality.",
163
164
  ...(preferred ? [preferred] : []),
164
165
  "Give each phase one owner, a stable `phaseId`, and exact writer `scope`. Parallelize independent phases in one call; never overlap writers or duplicate an owned phase. Dependent phases wait for prerequisites. Scope is conflict metadata, not permissions or a sandbox.",
165
166
  "Children have no parent conversation; send a self-contained brief and reuse established evidence.",
@@ -20,8 +20,10 @@ async function removeUnavailableAgentModels(
20
20
  const overrides = Object.entries(config.agentModels);
21
21
  if (overrides.length === 0) return;
22
22
  const { kept, dropped } = filterUnavailableModelOverrides(config.agentModels, availableModelsInScope(ctx));
23
- if (dropped.length === 0) return;
23
+ const rewritten = JSON.stringify(kept) !== JSON.stringify(config.agentModels);
24
+ if (!rewritten && dropped.length === 0) return;
24
25
  await saveConfig({ ...config, agentModels: kept }, runtime.configPath);
26
+ if (dropped.length === 0) return;
25
27
  const list = dropped.map(({ agent, ref }) => `${agent}: ${ref}`).join(", ");
26
28
  ctx.ui.notify(
27
29
  `pi-subagents: removed stale agent model overrides that are no longer available (${list}). Those agents now use their role's default model route; run /subagents-setup to re-pick.`,