@piotr-oles/pi-subagents 1.0.3 → 1.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piotr-oles/pi-subagents",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Pi Agent extension: spawn specialized subagents with isolated sessions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,14 +33,14 @@ export function createSubagentTool(deps: SubagentToolDeps) {
33
33
  executionMode: "parallel",
34
34
  execute: async (toolCallId, params, signal, onUpdate, ctx) => {
35
35
  const availableTools = pi.getActiveTools();
36
- const resolvedId = params.id ?? instanceManager.id(toolCallId);
36
+ const id = typeof params.id === "string" && params.id !== "" ? params.id : undefined;
37
37
  const onUpdateThrottled = onUpdate ? throttle(onUpdate, 500) : undefined;
38
38
 
39
39
  let promise: Promise<DoneSubagent>;
40
40
 
41
- if (params.id) {
41
+ if (id) {
42
42
  promise = instanceManager.followUp({
43
- id: resolvedId,
43
+ id,
44
44
  prompt: params.prompt,
45
45
  description: params.description,
46
46
  signal,
@@ -49,6 +49,7 @@ export function createSubagentTool(deps: SubagentToolDeps) {
49
49
  },
50
50
  });
51
51
  } else {
52
+ const generatedId = instanceManager.id(toolCallId);
52
53
  const template = templatesManager.getTemplate(params.name);
53
54
  if (!template) {
54
55
  const availableSubagents = templatesManager
@@ -60,7 +61,7 @@ export function createSubagentTool(deps: SubagentToolDeps) {
60
61
  );
61
62
  }
62
63
  promise = instanceManager.spawn({
63
- id: resolvedId,
64
+ id: generatedId,
64
65
  ctx,
65
66
  template,
66
67
  prompt: params.prompt,