@arhen/pi-core-subagent 1.3.34 → 1.3.35

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/manager.ts +12 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-core-subagent",
3
- "version": "1.3.34",
3
+ "version": "1.3.35",
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
@@ -1062,9 +1062,18 @@ export class SubagentManager {
1062
1062
  createRun(params: SubagentParamsShape, ctx: ExtensionContext): { run: RunSnapshot; inputs: TaskInput[] } {
1063
1063
  const hasChain = (params.chain?.length ?? 0) > 0;
1064
1064
  const hasTasks = (params.tasks?.length ?? 0) > 0;
1065
- const hasSingle = Boolean(params.agent && params.task);
1066
- if (Number(hasChain) + Number(hasTasks) + Number(hasSingle) !== 1) {
1067
- throw new Error(`Provide exactly one subagent mode (single, tasks, or chain).`);
1065
+ // An array mode wins over stray top-level agent/task: models routinely leave
1066
+ // those in place when switching to tasks:[...], and the intent is not
1067
+ // ambiguous — rejecting a well-formed 3-task call over leftovers is worse
1068
+ // than ignoring them. Genuine ambiguity (tasks AND chain) is still refused.
1069
+ const hasSingle = !hasChain && !hasTasks && Boolean(params.agent && params.task);
1070
+ if (hasChain && hasTasks) {
1071
+ throw new Error(`Provide either tasks (parallel) or chain (sequential), not both.`);
1072
+ }
1073
+ if (!hasChain && !hasTasks && !hasSingle) {
1074
+ throw new Error(
1075
+ `Provide one subagent mode: agent+task (single), tasks: [...] (parallel), or chain: [...] (sequential).`,
1076
+ );
1068
1077
  }
1069
1078
 
1070
1079
  const mode: RunMode = hasChain ? "chain" : hasTasks ? "parallel" : "single";