@arhen/pi-core-subagent 1.3.36 → 1.3.37
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/package.json +1 -1
- package/src/manager.ts +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arhen/pi-core-subagent",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "pi extension: fast in-process subagents with a dependency-graph scheduler (needs edges gate tasks and carry upstream output into dependent prompts), plus background runs, intercom and agent-to-agent mailbox. Leader defines agents inline.",
|
|
6
6
|
"license": "MIT",
|
package/src/manager.ts
CHANGED
|
@@ -154,6 +154,7 @@ export function cloneRun(run: RunSnapshot): RunSnapshot {
|
|
|
154
154
|
export function resolveChildModel(ctx: ExtensionContext, explicit: string | undefined) {
|
|
155
155
|
if (!explicit?.trim()) return ctx.model; // inherit the parent's active model
|
|
156
156
|
const ref = explicit.trim();
|
|
157
|
+
if (!ctx.modelRegistry) return ctx.model; // no registry to check against (tests, headless)
|
|
157
158
|
const available = ctx.modelRegistry.getAvailable();
|
|
158
159
|
// Model ids can contain slashes (e.g. 9router/cc/claude-opus-5), so a bare id
|
|
159
160
|
// match and every provider/id split point must be tried, not just the first.
|
|
@@ -1119,6 +1120,26 @@ export class SubagentManager {
|
|
|
1119
1120
|
}
|
|
1120
1121
|
}
|
|
1121
1122
|
const edges = resolveNeeds(inputs, mode);
|
|
1123
|
+
// Pre-flight every task's model BEFORE the run exists. A matched agent file
|
|
1124
|
+
// overrides the requested model, so an unresolvable one is the leader's
|
|
1125
|
+
// mistake to see NOW — not N children dying one by one on their first turn
|
|
1126
|
+
// with an error naming a model the leader never asked for.
|
|
1127
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
1128
|
+
const input = inputs[i] as TaskInput;
|
|
1129
|
+
const cwd = input.cwd ?? ctx.cwd;
|
|
1130
|
+
const file = resolveAgentFile(input.agent, input.task, cwd, getAgentDir());
|
|
1131
|
+
const requested = file?.model ?? input.model;
|
|
1132
|
+
try {
|
|
1133
|
+
validateThinking(resolveChildModel(ctx, requested), input.thinking);
|
|
1134
|
+
} catch (err) {
|
|
1135
|
+
const where = file?.model
|
|
1136
|
+
? ` (from agent file ${file.path}, which overrides the requested model${input.model ? ` "${input.model}"` : ""})`
|
|
1137
|
+
: "";
|
|
1138
|
+
throw new Error(
|
|
1139
|
+
`Task ${input.id ?? `task_${i + 1}`} (${input.agent}): ${err instanceof Error ? err.message : String(err)}${where}`,
|
|
1140
|
+
);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1122
1143
|
|
|
1123
1144
|
const run: RunSnapshot = {
|
|
1124
1145
|
id: newId("run"),
|