@narumitw/pi-subagents 0.31.0 → 0.35.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/src/subagents.ts CHANGED
@@ -22,6 +22,33 @@ import { consumeSubagentSettingsNotice, readSubagentSettings } from "./settings.
22
22
  import { registerStatefulSubagents } from "./stateful.js";
23
23
 
24
24
  export default function (pi: ExtensionAPI) {
25
+ const settings = readSubagentSettings();
26
+ if (settings?.blocking?.enabled !== false) registerBlockingSubagent(pi);
27
+
28
+ pi.on("session_start", (_event, ctx) => {
29
+ // Preserve a one-shot migration notice from extension load while refreshing
30
+ // validation against settings that may have changed before this session.
31
+ const loadNotice = consumeSubagentSettingsNotice();
32
+ readSubagentSettings();
33
+ const refreshedNotice = consumeSubagentSettingsNotice();
34
+ const notice = [
35
+ ...new Set([loadNotice, refreshedNotice].filter((value) => value !== undefined)),
36
+ ].join("\n");
37
+ if (notice) ctx.ui.notify(notice, "warning");
38
+ });
39
+
40
+ const blockingEnabled = settings?.blocking?.enabled !== false;
41
+ const statefulRuntime = registerStatefulSubagents(pi, {
42
+ blockingEnabled,
43
+ settings: settings?.stateful,
44
+ });
45
+ registerSubagentConfigCommand(pi, {
46
+ ...statefulRuntime,
47
+ getBlockingEnabled: () => blockingEnabled,
48
+ });
49
+ }
50
+
51
+ function registerBlockingSubagent(pi: ExtensionAPI) {
25
52
  pi.registerTool<typeof SubagentParams, SubagentDetails>({
26
53
  name: "subagent",
27
54
  label: "Blocking Subagent",
@@ -65,24 +92,14 @@ export default function (pi: ExtensionAPI) {
65
92
  if ((event.details as (SubagentDetails & { isError?: boolean }) | undefined)?.isError)
66
93
  return { isError: true };
67
94
  });
68
-
69
- pi.on("session_start", (_event, ctx) => {
70
- let notice = consumeSubagentSettingsNotice();
71
- if (!notice) {
72
- readSubagentSettings();
73
- notice = consumeSubagentSettingsNotice();
74
- }
75
- if (notice) ctx.ui.notify(notice, "warning");
76
- });
77
-
78
- const statefulRuntime = registerStatefulSubagents(pi);
79
- registerSubagentConfigCommand(pi, statefulRuntime);
80
95
  }
96
+
81
97
  export { parsePositiveInteger } from "./execution.js";
82
98
  export { formatTokens, formatUsageStats } from "./render.js";
83
99
  export { buildPiArgs } from "./runner.js";
84
100
  export {
85
101
  inspectCompletionDeliverySettings,
102
+ inspectDelegationWorkflowSettings,
86
103
  normalizeAgentSettings,
87
104
  normalizeSubagentSettings,
88
105
  readSubagentSettings,
@@ -93,4 +110,5 @@ export {
93
110
  uniqueToolNames,
94
111
  updateAgentToolsSetting,
95
112
  updateCompletionDeliverySetting,
113
+ updateDelegationWorkflowSetting,
96
114
  } from "./settings.js";