@narumitw/pi-subagents 2.0.1 → 2.0.3

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 (148) hide show
  1. package/README.md +20 -7
  2. package/dist/chunks/auto-transport-SY2VHUFH.ts +109 -0
  3. package/dist/chunks/auto-transport-SY2VHUFH.ts.map +7 -0
  4. package/dist/chunks/capability-grant-CGEWOEKE.ts +19 -0
  5. package/dist/chunks/capability-grant-CGEWOEKE.ts.map +7 -0
  6. package/dist/chunks/chunk-434NII74.ts +282 -0
  7. package/dist/chunks/chunk-434NII74.ts.map +7 -0
  8. package/dist/chunks/chunk-47SK2QYC.ts +56 -0
  9. package/dist/chunks/chunk-47SK2QYC.ts.map +7 -0
  10. package/dist/chunks/chunk-6KJ34M6S.ts +159 -0
  11. package/dist/chunks/chunk-6KJ34M6S.ts.map +7 -0
  12. package/dist/chunks/chunk-7OBINKFM.ts +80 -0
  13. package/dist/chunks/chunk-7OBINKFM.ts.map +7 -0
  14. package/dist/chunks/chunk-7QPPBBXZ.ts +335 -0
  15. package/dist/chunks/chunk-7QPPBBXZ.ts.map +7 -0
  16. package/dist/chunks/chunk-AEUYS7JC.ts +73 -0
  17. package/dist/chunks/chunk-AEUYS7JC.ts.map +7 -0
  18. package/dist/chunks/chunk-BFK2Z4ZF.ts +189 -0
  19. package/dist/chunks/chunk-BFK2Z4ZF.ts.map +7 -0
  20. package/dist/chunks/chunk-BOAXY55Y.ts +153 -0
  21. package/dist/chunks/chunk-BOAXY55Y.ts.map +7 -0
  22. package/dist/chunks/chunk-C4L6P266.ts +22 -0
  23. package/dist/chunks/chunk-C4L6P266.ts.map +7 -0
  24. package/dist/chunks/chunk-DPPVEQAM.ts +29 -0
  25. package/dist/chunks/chunk-DPPVEQAM.ts.map +7 -0
  26. package/dist/chunks/chunk-DQMN4OYM.ts +913 -0
  27. package/dist/chunks/chunk-DQMN4OYM.ts.map +7 -0
  28. package/dist/chunks/chunk-DSOOH73Y.ts +238 -0
  29. package/dist/chunks/chunk-DSOOH73Y.ts.map +7 -0
  30. package/dist/chunks/chunk-EFBPISNT.ts +421 -0
  31. package/dist/chunks/chunk-EFBPISNT.ts.map +7 -0
  32. package/dist/chunks/chunk-EWWXFU7N.ts +150 -0
  33. package/dist/chunks/chunk-EWWXFU7N.ts.map +7 -0
  34. package/dist/chunks/chunk-F4L2UVSK.ts +380 -0
  35. package/dist/chunks/chunk-F4L2UVSK.ts.map +7 -0
  36. package/dist/chunks/chunk-F5YWVHQX.ts +1543 -0
  37. package/dist/chunks/chunk-F5YWVHQX.ts.map +7 -0
  38. package/dist/chunks/chunk-G3RSMSXJ.ts +63 -0
  39. package/dist/chunks/chunk-G3RSMSXJ.ts.map +7 -0
  40. package/dist/chunks/chunk-G6VZTCFH.ts +70 -0
  41. package/dist/chunks/chunk-G6VZTCFH.ts.map +7 -0
  42. package/dist/chunks/chunk-H3FP6DLR.ts +160 -0
  43. package/dist/chunks/chunk-H3FP6DLR.ts.map +7 -0
  44. package/dist/chunks/chunk-HA36LPCO.ts +130 -0
  45. package/dist/chunks/chunk-HA36LPCO.ts.map +7 -0
  46. package/dist/chunks/chunk-HKC4ES4B.ts +65 -0
  47. package/dist/chunks/chunk-HKC4ES4B.ts.map +7 -0
  48. package/dist/chunks/chunk-HOP5FXDT.ts +27 -0
  49. package/dist/chunks/chunk-HOP5FXDT.ts.map +7 -0
  50. package/dist/chunks/chunk-I2FAK44T.ts +324 -0
  51. package/dist/chunks/chunk-I2FAK44T.ts.map +7 -0
  52. package/dist/chunks/chunk-IGAMVWFN.ts +139 -0
  53. package/dist/chunks/chunk-IGAMVWFN.ts.map +7 -0
  54. package/dist/chunks/chunk-KMGKCEO4.ts +38 -0
  55. package/dist/chunks/chunk-KMGKCEO4.ts.map +7 -0
  56. package/dist/chunks/chunk-N7BLVXKK.ts +73 -0
  57. package/dist/chunks/chunk-N7BLVXKK.ts.map +7 -0
  58. package/dist/chunks/chunk-NIF42QMF.ts +297 -0
  59. package/dist/chunks/chunk-NIF42QMF.ts.map +7 -0
  60. package/dist/chunks/chunk-O4VO6JUJ.ts +52 -0
  61. package/dist/chunks/chunk-O4VO6JUJ.ts.map +7 -0
  62. package/dist/chunks/chunk-ONDTY4EL.ts +91 -0
  63. package/dist/chunks/chunk-ONDTY4EL.ts.map +7 -0
  64. package/dist/chunks/chunk-OVPHFGKO.ts +1769 -0
  65. package/dist/chunks/chunk-OVPHFGKO.ts.map +7 -0
  66. package/dist/chunks/chunk-P7OH4XMF.ts +60 -0
  67. package/dist/chunks/chunk-P7OH4XMF.ts.map +7 -0
  68. package/dist/chunks/chunk-PSK43Y6A.ts +339 -0
  69. package/dist/chunks/chunk-PSK43Y6A.ts.map +7 -0
  70. package/dist/chunks/chunk-QBORTI4W.ts +468 -0
  71. package/dist/chunks/chunk-QBORTI4W.ts.map +7 -0
  72. package/dist/chunks/chunk-QDVGH2X7.ts +171 -0
  73. package/dist/chunks/chunk-QDVGH2X7.ts.map +7 -0
  74. package/dist/chunks/chunk-RHRQMT7Q.ts +490 -0
  75. package/dist/chunks/chunk-RHRQMT7Q.ts.map +7 -0
  76. package/dist/chunks/chunk-RRR66UWR.ts +28 -0
  77. package/dist/chunks/chunk-RRR66UWR.ts.map +7 -0
  78. package/dist/chunks/chunk-RSUXZD6S.ts +275 -0
  79. package/dist/chunks/chunk-RSUXZD6S.ts.map +7 -0
  80. package/dist/chunks/chunk-RTCVYIZA.ts +221 -0
  81. package/dist/chunks/chunk-RTCVYIZA.ts.map +7 -0
  82. package/dist/chunks/chunk-S2IWVK3J.ts +44 -0
  83. package/dist/chunks/chunk-S2IWVK3J.ts.map +7 -0
  84. package/dist/chunks/chunk-SCZ33MYW.ts +52 -0
  85. package/dist/chunks/chunk-SCZ33MYW.ts.map +7 -0
  86. package/dist/chunks/chunk-SWGQLFSD.ts +60 -0
  87. package/dist/chunks/chunk-SWGQLFSD.ts.map +7 -0
  88. package/dist/chunks/chunk-UMBPMVJW.ts +22 -0
  89. package/dist/chunks/chunk-UMBPMVJW.ts.map +7 -0
  90. package/dist/chunks/chunk-UVFVHIOP.ts +735 -0
  91. package/dist/chunks/chunk-UVFVHIOP.ts.map +7 -0
  92. package/dist/chunks/completion-delivery-YPOWSSV3.ts +16 -0
  93. package/dist/chunks/completion-delivery-YPOWSSV3.ts.map +7 -0
  94. package/dist/chunks/config-status-J4GPWP46.ts +34 -0
  95. package/dist/chunks/config-status-J4GPWP46.ts.map +7 -0
  96. package/dist/chunks/config-ui-3IBMHTQB.ts +1146 -0
  97. package/dist/chunks/config-ui-3IBMHTQB.ts.map +7 -0
  98. package/dist/chunks/consult-NYXVDN5G.ts +518 -0
  99. package/dist/chunks/consult-NYXVDN5G.ts.map +7 -0
  100. package/dist/chunks/context-QDKLVQXE.ts +11 -0
  101. package/dist/chunks/context-QDKLVQXE.ts.map +7 -0
  102. package/dist/chunks/create-stateful-transport-4WKZHRSI.ts +130 -0
  103. package/dist/chunks/create-stateful-transport-4WKZHRSI.ts.map +7 -0
  104. package/dist/chunks/cwd-policy-NB6XZ5GF.ts +17 -0
  105. package/dist/chunks/cwd-policy-NB6XZ5GF.ts.map +7 -0
  106. package/dist/chunks/delegation-contract-WJPT4FVS.ts +24 -0
  107. package/dist/chunks/delegation-contract-WJPT4FVS.ts.map +7 -0
  108. package/dist/chunks/discovery-K25T3SH4.ts +12 -0
  109. package/dist/chunks/discovery-K25T3SH4.ts.map +7 -0
  110. package/dist/chunks/execution-DS2DEIQZ.ts +4034 -0
  111. package/dist/chunks/execution-DS2DEIQZ.ts.map +7 -0
  112. package/dist/chunks/in-process-transport-TEYAWSEC.ts +38 -0
  113. package/dist/chunks/in-process-transport-TEYAWSEC.ts.map +7 -0
  114. package/dist/chunks/inspect-UOQQ3KNL.ts +619 -0
  115. package/dist/chunks/inspect-UOQQ3KNL.ts.map +7 -0
  116. package/dist/chunks/peer-communication-KL36Z6CO.ts +294 -0
  117. package/dist/chunks/peer-communication-KL36Z6CO.ts.map +7 -0
  118. package/dist/chunks/persistence-VSGXAW4P.ts +344 -0
  119. package/dist/chunks/persistence-VSGXAW4P.ts.map +7 -0
  120. package/dist/chunks/registry-E6XPJB7L.ts +1324 -0
  121. package/dist/chunks/registry-E6XPJB7L.ts.map +7 -0
  122. package/dist/chunks/retained-semantic-state-7WXSGRJU.ts +81 -0
  123. package/dist/chunks/retained-semantic-state-7WXSGRJU.ts.map +7 -0
  124. package/dist/chunks/rpc-transport-Y6LA5BOP.ts +1154 -0
  125. package/dist/chunks/rpc-transport-Y6LA5BOP.ts.map +7 -0
  126. package/dist/chunks/runtime-policy-5YELCOVC.ts +15 -0
  127. package/dist/chunks/runtime-policy-5YELCOVC.ts.map +7 -0
  128. package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts +19 -0
  129. package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts.map +7 -0
  130. package/dist/chunks/spawn-idempotency-QGHO2WKC.ts +13 -0
  131. package/dist/chunks/spawn-idempotency-QGHO2WKC.ts.map +7 -0
  132. package/dist/chunks/stateful-lifecycle-JAR6K55H.ts +15 -0
  133. package/dist/chunks/stateful-lifecycle-JAR6K55H.ts.map +7 -0
  134. package/dist/chunks/subprocess-transport-C2XVR25R.ts +158 -0
  135. package/dist/chunks/subprocess-transport-C2XVR25R.ts.map +7 -0
  136. package/dist/chunks/workspace-WDKLN72J.ts +11 -0
  137. package/dist/chunks/workspace-WDKLN72J.ts.map +7 -0
  138. package/dist/index.ts +1057 -0
  139. package/dist/index.ts.map +7 -0
  140. package/package.json +9 -5
  141. package/src/index.ts +1 -1
  142. package/src/settings-reader.ts +208 -0
  143. package/src/settings.ts +22 -187
  144. package/src/stateful-registration.ts +1230 -0
  145. package/src/stateful-safety.ts +1 -1
  146. package/src/stateful.ts +2 -1234
  147. package/src/subagents-extension.ts +307 -0
  148. package/src/subagents.ts +1 -308
@@ -0,0 +1,468 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+ import {
4
+ STATEFUL_LIMIT_FIELDS,
5
+ isValidStatefulLimit,
6
+ resolveStatefulLimits
7
+ } from "./chunk-7OBINKFM.ts";
8
+ import {
9
+ CONSULTATION_CWD_POLICIES,
10
+ CONSULT_RESOURCE_POLICIES,
11
+ DELEGATION_CWD_POLICIES,
12
+ isThinkingLevel
13
+ } from "./chunk-DPPVEQAM.ts";
14
+ import {
15
+ DEFAULT_MAX_PARALLEL_TASKS,
16
+ MAX_CONFIGURABLE_PARALLEL_TASKS,
17
+ MAX_SUBAGENT_TIMEOUT_MS
18
+ } from "./chunk-H3FP6DLR.ts";
19
+
20
+ // src/settings/schema.ts
21
+ function hasOwn(obj, key) {
22
+ return Object.hasOwn(obj, key);
23
+ }
24
+ function isPlainObject(value) {
25
+ return typeof value === "object" && value !== null && !Array.isArray(value);
26
+ }
27
+ function isStringArray(value) {
28
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
29
+ }
30
+ function isPositiveNumber(value) {
31
+ return typeof value === "number" && Number.isFinite(value) && value >= 1;
32
+ }
33
+ function isPositiveInteger(value) {
34
+ return isPositiveNumber(value) && Number.isSafeInteger(value);
35
+ }
36
+ function normalizeAgentSettings(value) {
37
+ if (!isPlainObject(value)) return void 0;
38
+ const config = {};
39
+ let hasKnownField = false;
40
+ if (hasOwn(value, "tools")) {
41
+ if (!isStringArray(value.tools)) return void 0;
42
+ config.tools = value.tools;
43
+ hasKnownField = true;
44
+ }
45
+ if (hasOwn(value, "model")) {
46
+ if (value.model !== null && typeof value.model !== "string") return void 0;
47
+ config.model = value.model;
48
+ hasKnownField = true;
49
+ }
50
+ if (hasOwn(value, "thinkingLevel")) {
51
+ if (value.thinkingLevel !== null && !isThinkingLevel(value.thinkingLevel)) return void 0;
52
+ config.thinkingLevel = value.thinkingLevel;
53
+ hasKnownField = true;
54
+ }
55
+ if (hasOwn(value, "timeoutMs")) {
56
+ if (value.timeoutMs !== null && (!isPositiveNumber(value.timeoutMs) || value.timeoutMs > MAX_SUBAGENT_TIMEOUT_MS)) {
57
+ return void 0;
58
+ }
59
+ config.timeoutMs = value.timeoutMs;
60
+ hasKnownField = true;
61
+ }
62
+ return hasKnownField ? config : void 0;
63
+ }
64
+ function normalizeSubagentSettings(value) {
65
+ if (!isPlainObject(value)) return void 0;
66
+ const settings = {};
67
+ if (hasOwn(value, "agents")) {
68
+ if (!isPlainObject(value.agents)) return void 0;
69
+ const agents = {};
70
+ for (const [name, rawConfig] of Object.entries(value.agents)) {
71
+ const config = normalizeAgentSettings(rawConfig);
72
+ if (config) agents[name] = config;
73
+ }
74
+ if (Object.keys(agents).length > 0) settings.agents = agents;
75
+ }
76
+ if (hasOwn(value, "blocking")) {
77
+ if (!isPlainObject(value.blocking)) return void 0;
78
+ const blocking = {};
79
+ if (hasOwn(value.blocking, "enabled")) {
80
+ if (typeof value.blocking.enabled !== "boolean") return void 0;
81
+ blocking.enabled = value.blocking.enabled;
82
+ }
83
+ if (hasOwn(value.blocking, "maxParallelTasks")) {
84
+ if (!isPositiveInteger(value.blocking.maxParallelTasks) || value.blocking.maxParallelTasks > MAX_CONFIGURABLE_PARALLEL_TASKS) {
85
+ return void 0;
86
+ }
87
+ blocking.maxParallelTasks = value.blocking.maxParallelTasks;
88
+ }
89
+ settings.blocking = blocking;
90
+ }
91
+ if (hasOwn(value, "stateful")) {
92
+ if (!isPlainObject(value.stateful)) return void 0;
93
+ const runtime = {};
94
+ if (hasOwn(value.stateful, "transport")) {
95
+ if (value.stateful.transport !== "subprocess" && value.stateful.transport !== "in-process" && value.stateful.transport !== "rpc" && value.stateful.transport !== "auto") {
96
+ return void 0;
97
+ }
98
+ runtime.transport = value.stateful.transport;
99
+ }
100
+ if (hasOwn(value.stateful, "completionDelivery")) {
101
+ if (value.stateful.completionDelivery !== "next-turn" && value.stateful.completionDelivery !== "auto-resume") {
102
+ return void 0;
103
+ }
104
+ runtime.completionDelivery = value.stateful.completionDelivery;
105
+ }
106
+ for (const key of STATEFUL_LIMIT_FIELDS) {
107
+ if (hasOwn(value.stateful, key)) {
108
+ if (!isValidStatefulLimit(key, value.stateful[key])) return void 0;
109
+ runtime[key] = value.stateful[key];
110
+ }
111
+ }
112
+ for (const key of ["maxMailboxMessages", "maxMailboxMessageBytes", "idleTtlMs"]) {
113
+ if (hasOwn(value.stateful, key)) {
114
+ if (!isPositiveInteger(value.stateful[key])) return void 0;
115
+ runtime[key] = value.stateful[key];
116
+ }
117
+ }
118
+ if (hasOwn(value.stateful, "retentionDays")) {
119
+ if (!isPositiveNumber(value.stateful.retentionDays)) return void 0;
120
+ runtime.retentionDays = value.stateful.retentionDays;
121
+ }
122
+ if (hasOwn(value.stateful, "enabled")) {
123
+ if (typeof value.stateful.enabled !== "boolean") return void 0;
124
+ runtime.enabled = value.stateful.enabled;
125
+ }
126
+ settings.stateful = runtime;
127
+ }
128
+ if (hasOwn(value, "consult")) {
129
+ if (!isPlainObject(value.consult)) return void 0;
130
+ const consult = {};
131
+ if (hasOwn(value.consult, "resources")) {
132
+ if (typeof value.consult.resources !== "string" || !CONSULT_RESOURCE_POLICIES.includes(value.consult.resources)) {
133
+ return void 0;
134
+ }
135
+ consult.resources = value.consult.resources;
136
+ }
137
+ settings.consult = consult;
138
+ }
139
+ if (hasOwn(value, "cwdPolicy")) {
140
+ if (!isPlainObject(value.cwdPolicy)) return void 0;
141
+ const cwdPolicy = {};
142
+ if (hasOwn(value.cwdPolicy, "consultation")) {
143
+ if (typeof value.cwdPolicy.consultation !== "string" || !CONSULTATION_CWD_POLICIES.includes(value.cwdPolicy.consultation)) {
144
+ return void 0;
145
+ }
146
+ cwdPolicy.consultation = value.cwdPolicy.consultation;
147
+ }
148
+ if (hasOwn(value.cwdPolicy, "delegation")) {
149
+ if (typeof value.cwdPolicy.delegation !== "string" || !DELEGATION_CWD_POLICIES.includes(value.cwdPolicy.delegation)) {
150
+ return void 0;
151
+ }
152
+ cwdPolicy.delegation = value.cwdPolicy.delegation;
153
+ }
154
+ settings.cwdPolicy = cwdPolicy;
155
+ }
156
+ return settings;
157
+ }
158
+
159
+ // src/settings/inspection.ts
160
+ var DEFAULT_COMPLETION_DELIVERY = "next-turn";
161
+ var DEFAULT_CONSULT_RESOURCE_POLICY = "project-context";
162
+ var DEFAULT_CONSULTATION_CWD_POLICY = "anywhere";
163
+ var DEFAULT_DELEGATION_CWD_POLICY = "trusted-targets";
164
+ function resolveDelegationWorkflow(blockingEnabled, statefulEnabled) {
165
+ if (blockingEnabled && statefulEnabled) return "all";
166
+ if (statefulEnabled) return "async-only";
167
+ if (blockingEnabled) return "blocking-only";
168
+ return "disabled";
169
+ }
170
+ function resolveBlockingMaxParallelTasks(settings) {
171
+ return settings?.blocking?.maxParallelTasks ?? DEFAULT_MAX_PARALLEL_TASKS;
172
+ }
173
+ function buildSubagentSettingsSnapshot(inspected) {
174
+ return {
175
+ path: inspected.path,
176
+ settings: inspected.settings,
177
+ source: inspected.settings ? "user settings" : "default",
178
+ ...inspected.error ? { error: inspected.error } : {}
179
+ };
180
+ }
181
+ function buildConsultResourceSettingsSnapshot(inspected) {
182
+ if (!inspected.raw || !inspected.settings) {
183
+ return {
184
+ path: inspected.path,
185
+ value: DEFAULT_CONSULT_RESOURCE_POLICY,
186
+ source: "default",
187
+ ...inspected.error ? { error: inspected.error } : {}
188
+ };
189
+ }
190
+ const explicit = isPlainObject(inspected.raw.consult) && hasOwn(inspected.raw.consult, "resources");
191
+ return {
192
+ path: inspected.path,
193
+ value: inspected.settings.consult?.resources ?? DEFAULT_CONSULT_RESOURCE_POLICY,
194
+ source: explicit ? "user settings" : "default"
195
+ };
196
+ }
197
+ function buildCwdPolicySettingsSnapshot(inspected) {
198
+ if (!inspected.raw || !inspected.settings) {
199
+ return {
200
+ path: inspected.path,
201
+ consultation: { value: DEFAULT_CONSULTATION_CWD_POLICY, source: "default" },
202
+ delegation: { value: DEFAULT_DELEGATION_CWD_POLICY, source: "default" },
203
+ ...inspected.error ? { error: inspected.error } : {}
204
+ };
205
+ }
206
+ const rawPolicy = isPlainObject(inspected.raw.cwdPolicy) ? inspected.raw.cwdPolicy : void 0;
207
+ return {
208
+ path: inspected.path,
209
+ consultation: {
210
+ value: inspected.settings.cwdPolicy?.consultation ?? DEFAULT_CONSULTATION_CWD_POLICY,
211
+ source: rawPolicy && hasOwn(rawPolicy, "consultation") ? "user settings" : "default"
212
+ },
213
+ delegation: {
214
+ value: inspected.settings.cwdPolicy?.delegation ?? DEFAULT_DELEGATION_CWD_POLICY,
215
+ source: rawPolicy && hasOwn(rawPolicy, "delegation") ? "user settings" : "default"
216
+ }
217
+ };
218
+ }
219
+ function buildDelegationWorkflowSettingsSnapshot(inspected) {
220
+ if (!inspected.raw || !inspected.settings) {
221
+ return {
222
+ path: inspected.path,
223
+ value: "all",
224
+ source: "default",
225
+ ...inspected.error ? { error: inspected.error } : {}
226
+ };
227
+ }
228
+ const explicit = isPlainObject(inspected.raw.blocking) && hasOwn(inspected.raw.blocking, "enabled") || isPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, "enabled");
229
+ return {
230
+ path: inspected.path,
231
+ value: resolveDelegationWorkflow(
232
+ inspected.settings.blocking?.enabled !== false,
233
+ inspected.settings.stateful?.enabled !== false
234
+ ),
235
+ source: explicit ? "user settings" : "default"
236
+ };
237
+ }
238
+ function buildCompletionDeliverySettingsSnapshot(inspected) {
239
+ if (!inspected.raw || !inspected.settings) {
240
+ return {
241
+ path: inspected.path,
242
+ value: DEFAULT_COMPLETION_DELIVERY,
243
+ source: "default",
244
+ ...inspected.error ? { error: inspected.error } : {}
245
+ };
246
+ }
247
+ const explicit = isPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, "completionDelivery");
248
+ return {
249
+ path: inspected.path,
250
+ value: inspected.settings.stateful?.completionDelivery ?? DEFAULT_COMPLETION_DELIVERY,
251
+ source: explicit ? "user settings" : "default"
252
+ };
253
+ }
254
+ function buildStatefulTransportSettingsSnapshot(inspected) {
255
+ if (!inspected.raw || !inspected.settings) {
256
+ return {
257
+ path: inspected.path,
258
+ value: "subprocess",
259
+ source: "default",
260
+ ...inspected.error ? { error: inspected.error } : {}
261
+ };
262
+ }
263
+ const explicit = isPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, "transport");
264
+ return {
265
+ path: inspected.path,
266
+ value: inspected.settings.stateful?.transport ?? "subprocess",
267
+ source: explicit ? "user settings" : "default"
268
+ };
269
+ }
270
+ function buildBlockingParallelLimitSettingsSnapshot(inspected) {
271
+ if (!inspected.raw || !inspected.settings) {
272
+ return {
273
+ path: inspected.path,
274
+ value: DEFAULT_MAX_PARALLEL_TASKS,
275
+ source: "default",
276
+ ...inspected.error ? { error: inspected.error } : {}
277
+ };
278
+ }
279
+ const explicit = isPlainObject(inspected.raw.blocking) && hasOwn(inspected.raw.blocking, "maxParallelTasks");
280
+ return {
281
+ path: inspected.path,
282
+ value: resolveBlockingMaxParallelTasks(inspected.settings),
283
+ source: explicit ? "user settings" : "default"
284
+ };
285
+ }
286
+ function buildStatefulLimitSettingsSnapshot(inspected, writePath) {
287
+ if (inspected.error) {
288
+ return { path: inspected.path, writePath, error: inspected.error };
289
+ }
290
+ const resolved = resolveStatefulLimits(inspected.settings?.stateful);
291
+ const rawStateful = isPlainObject(inspected.raw?.stateful) ? inspected.raw.stateful : void 0;
292
+ return {
293
+ path: inspected.path,
294
+ writePath,
295
+ values: Object.fromEntries(
296
+ STATEFUL_LIMIT_FIELDS.map((field) => [
297
+ field,
298
+ {
299
+ value: resolved[field],
300
+ source: rawStateful && hasOwn(rawStateful, field) ? "user settings" : "default"
301
+ }
302
+ ])
303
+ )
304
+ };
305
+ }
306
+
307
+ // src/settings-reader.ts
308
+ import * as fs from "node:fs";
309
+ import * as path from "node:path";
310
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
311
+ var SUBAGENT_SETTINGS_FILE = "pi-subagents.json";
312
+ var LEGACY_SETTINGS_FILE = "pi-subagents-config.json";
313
+ var pendingSettingsNotice;
314
+ function resolveSubagentSettingsPaths() {
315
+ const canonicalPath = path.join(getAgentDir(), SUBAGENT_SETTINGS_FILE);
316
+ const legacyPath = path.join(getAgentDir(), LEGACY_SETTINGS_FILE);
317
+ return {
318
+ canonicalPath,
319
+ legacyPath,
320
+ activePath: fs.existsSync(canonicalPath) ? canonicalPath : fs.existsSync(legacyPath) ? legacyPath : void 0
321
+ };
322
+ }
323
+ function readSubagentSettings() {
324
+ pendingSettingsNotice = void 0;
325
+ const { canonicalPath, legacyPath, activePath } = resolveSubagentSettingsPaths();
326
+ if (activePath === canonicalPath) {
327
+ const canonical = readSettingsFile(canonicalPath);
328
+ const notices = [];
329
+ if (!canonical) notices.push(`${SUBAGENT_SETTINGS_FILE} is invalid and was ignored.`);
330
+ if (fs.existsSync(legacyPath)) {
331
+ notices.push(
332
+ `${LEGACY_SETTINGS_FILE} ignored because ${SUBAGENT_SETTINGS_FILE} takes precedence.`
333
+ );
334
+ }
335
+ if (notices.length > 0) pendingSettingsNotice = notices.join("\n");
336
+ return canonical;
337
+ }
338
+ if (activePath === void 0) return void 0;
339
+ const legacy = readSettingsFile(legacyPath);
340
+ if (fs.existsSync(canonicalPath)) {
341
+ const canonical = readSettingsFile(canonicalPath);
342
+ pendingSettingsNotice = [
343
+ ...!canonical ? [`${SUBAGENT_SETTINGS_FILE} is invalid and was ignored.`] : [],
344
+ `${LEGACY_SETTINGS_FILE} ignored because ${SUBAGENT_SETTINGS_FILE} was created concurrently.`
345
+ ].join("\n");
346
+ return canonical;
347
+ }
348
+ if (!legacy) {
349
+ pendingSettingsNotice = `${LEGACY_SETTINGS_FILE} is invalid and was ignored.`;
350
+ return void 0;
351
+ }
352
+ pendingSettingsNotice = `Using legacy ${LEGACY_SETTINGS_FILE}; rename it to ${SUBAGENT_SETTINGS_FILE}. Future saves write ${SUBAGENT_SETTINGS_FILE} without modifying the legacy file.`;
353
+ return legacy;
354
+ }
355
+ function consumeSubagentSettingsNotice() {
356
+ const notice = pendingSettingsNotice;
357
+ pendingSettingsNotice = void 0;
358
+ return notice;
359
+ }
360
+ function subagentSettingsFilePath() {
361
+ return path.join(getAgentDir(), SUBAGENT_SETTINGS_FILE);
362
+ }
363
+ function inspectSubagentSettingsDocument() {
364
+ const { canonicalPath, activePath } = resolveSubagentSettingsPaths();
365
+ if (activePath === void 0) return { path: canonicalPath };
366
+ const inspected = inspectSubagentSettingsPath(activePath);
367
+ return activePath !== canonicalPath && fs.existsSync(canonicalPath) ? inspectSubagentSettingsPath(canonicalPath) : inspected;
368
+ }
369
+ function inspectSubagentSettingsPath(configPath) {
370
+ const fileName = path.basename(configPath);
371
+ let contents;
372
+ try {
373
+ contents = fs.readFileSync(configPath, "utf8");
374
+ } catch (error) {
375
+ const code = error.code;
376
+ return {
377
+ path: configPath,
378
+ error: `${fileName} could not be read${code ? ` (${safeErrorCode(code)})` : ""}`
379
+ };
380
+ }
381
+ let raw;
382
+ try {
383
+ raw = JSON.parse(contents);
384
+ } catch {
385
+ return { path: configPath, error: `${fileName} contains malformed JSON` };
386
+ }
387
+ const settings = normalizeSubagentSettings(raw);
388
+ if (!isPlainObject(raw) || !settings) {
389
+ return { path: configPath, error: `${fileName} is not a valid settings object` };
390
+ }
391
+ return { path: configPath, raw, settings };
392
+ }
393
+ function inspectSubagentSettings() {
394
+ return buildSubagentSettingsSnapshot(inspectSubagentSettingsDocument());
395
+ }
396
+ function inspectConsultResourceSettings() {
397
+ return buildConsultResourceSettingsSnapshot(inspectSubagentSettingsDocument());
398
+ }
399
+ function inspectCwdPolicySettings() {
400
+ return buildCwdPolicySettingsSnapshot(inspectSubagentSettingsDocument());
401
+ }
402
+ function inspectDelegationWorkflowSettings() {
403
+ return buildDelegationWorkflowSettingsSnapshot(inspectSubagentSettingsDocument());
404
+ }
405
+ function inspectCompletionDeliverySettings() {
406
+ return buildCompletionDeliverySettingsSnapshot(inspectSubagentSettingsDocument());
407
+ }
408
+ function inspectStatefulTransportSettings() {
409
+ return buildStatefulTransportSettingsSnapshot(inspectSubagentSettingsDocument());
410
+ }
411
+ function inspectBlockingParallelLimitSettings() {
412
+ return buildBlockingParallelLimitSettingsSnapshot(inspectSubagentSettingsDocument());
413
+ }
414
+ function inspectStatefulLimitSettings() {
415
+ return buildStatefulLimitSettingsSnapshot(
416
+ inspectSubagentSettingsDocument(),
417
+ subagentSettingsFilePath()
418
+ );
419
+ }
420
+ function pathEntryExists(filePath) {
421
+ try {
422
+ fs.lstatSync(filePath);
423
+ return true;
424
+ } catch (error) {
425
+ if (error.code === "ENOENT") return false;
426
+ throw error;
427
+ }
428
+ }
429
+ function readSettingsFile(configPath) {
430
+ return readSettingsSnapshot(configPath).settings;
431
+ }
432
+ function readSettingsSnapshot(configPath) {
433
+ try {
434
+ const contents = fs.readFileSync(configPath, "utf8");
435
+ return { settings: normalizeSubagentSettings(JSON.parse(contents)), contents };
436
+ } catch {
437
+ return {};
438
+ }
439
+ }
440
+ function safeErrorCode(value) {
441
+ return value.replace(/[^A-Z0-9_-]/giu, "?").slice(0, 64);
442
+ }
443
+
444
+ export {
445
+ hasOwn,
446
+ isPlainObject,
447
+ isPositiveInteger,
448
+ normalizeSubagentSettings,
449
+ DEFAULT_CONSULT_RESOURCE_POLICY,
450
+ DEFAULT_CONSULTATION_CWD_POLICY,
451
+ DEFAULT_DELEGATION_CWD_POLICY,
452
+ resolveDelegationWorkflow,
453
+ resolveBlockingMaxParallelTasks,
454
+ SUBAGENT_SETTINGS_FILE,
455
+ resolveSubagentSettingsPaths,
456
+ readSubagentSettings,
457
+ consumeSubagentSettingsNotice,
458
+ inspectSubagentSettings,
459
+ inspectConsultResourceSettings,
460
+ inspectCwdPolicySettings,
461
+ inspectDelegationWorkflowSettings,
462
+ inspectCompletionDeliverySettings,
463
+ inspectStatefulTransportSettings,
464
+ inspectBlockingParallelLimitSettings,
465
+ inspectStatefulLimitSettings,
466
+ pathEntryExists
467
+ };
468
+ //# sourceMappingURL=chunk-QBORTI4W.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/settings/schema.ts", "../../src/settings/inspection.ts", "../../src/settings-reader.ts"],
4
+ "sourcesContent": ["import {\n\tCONSULT_RESOURCE_POLICIES,\n\tCONSULTATION_CWD_POLICIES,\n\ttype ConsultationCwdPolicy,\n\ttype ConsultResourcePolicy,\n\tDELEGATION_CWD_POLICIES,\n\ttype DelegationCwdPolicy,\n\tisThinkingLevel,\n\ttype SubagentAgentConfig,\n\ttype SubagentSettings,\n} from \"../agents/types.js\";\nimport { MAX_CONFIGURABLE_PARALLEL_TASKS, MAX_SUBAGENT_TIMEOUT_MS } from \"../limits.js\";\nimport { isValidStatefulLimit, STATEFUL_LIMIT_FIELDS } from \"../stateful-limits.js\";\n\nexport function hasOwn(obj: object, key: PropertyKey): boolean {\n\treturn Object.hasOwn(obj, key);\n}\n\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n\treturn Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\n\nexport function isPositiveNumber(value: unknown): value is number {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value >= 1;\n}\n\nexport function isPositiveInteger(value: unknown): value is number {\n\treturn isPositiveNumber(value) && Number.isSafeInteger(value);\n}\n\nexport function normalizeAgentSettings(value: unknown): SubagentAgentConfig | undefined {\n\tif (!isPlainObject(value)) return undefined;\n\n\tconst config: SubagentAgentConfig = {};\n\tlet hasKnownField = false;\n\n\tif (hasOwn(value, \"tools\")) {\n\t\tif (!isStringArray(value.tools)) return undefined;\n\t\tconfig.tools = value.tools;\n\t\thasKnownField = true;\n\t}\n\n\tif (hasOwn(value, \"model\")) {\n\t\tif (value.model !== null && typeof value.model !== \"string\") return undefined;\n\t\tconfig.model = value.model;\n\t\thasKnownField = true;\n\t}\n\n\tif (hasOwn(value, \"thinkingLevel\")) {\n\t\tif (value.thinkingLevel !== null && !isThinkingLevel(value.thinkingLevel)) return undefined;\n\t\tconfig.thinkingLevel = value.thinkingLevel;\n\t\thasKnownField = true;\n\t}\n\n\tif (hasOwn(value, \"timeoutMs\")) {\n\t\tif (\n\t\t\tvalue.timeoutMs !== null &&\n\t\t\t(!isPositiveNumber(value.timeoutMs) || value.timeoutMs > MAX_SUBAGENT_TIMEOUT_MS)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconfig.timeoutMs = value.timeoutMs;\n\t\thasKnownField = true;\n\t}\n\n\treturn hasKnownField ? config : undefined;\n}\n\nexport function normalizeSubagentSettings(value: unknown): SubagentSettings | undefined {\n\tif (!isPlainObject(value)) return undefined;\n\tconst settings: SubagentSettings = {};\n\tif (hasOwn(value, \"agents\")) {\n\t\tif (!isPlainObject(value.agents)) return undefined;\n\t\tconst agents: Record<string, SubagentAgentConfig> = {};\n\t\tfor (const [name, rawConfig] of Object.entries(value.agents)) {\n\t\t\tconst config = normalizeAgentSettings(rawConfig);\n\t\t\tif (config) agents[name] = config;\n\t\t}\n\t\tif (Object.keys(agents).length > 0) settings.agents = agents;\n\t}\n\tif (hasOwn(value, \"blocking\")) {\n\t\tif (!isPlainObject(value.blocking)) return undefined;\n\t\tconst blocking: NonNullable<SubagentSettings[\"blocking\"]> = {};\n\t\tif (hasOwn(value.blocking, \"enabled\")) {\n\t\t\tif (typeof value.blocking.enabled !== \"boolean\") return undefined;\n\t\t\tblocking.enabled = value.blocking.enabled;\n\t\t}\n\t\tif (hasOwn(value.blocking, \"maxParallelTasks\")) {\n\t\t\tif (\n\t\t\t\t!isPositiveInteger(value.blocking.maxParallelTasks) ||\n\t\t\t\tvalue.blocking.maxParallelTasks > MAX_CONFIGURABLE_PARALLEL_TASKS\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tblocking.maxParallelTasks = value.blocking.maxParallelTasks;\n\t\t}\n\t\tsettings.blocking = blocking;\n\t}\n\tif (hasOwn(value, \"stateful\")) {\n\t\tif (!isPlainObject(value.stateful)) return undefined;\n\t\tconst runtime: NonNullable<SubagentSettings[\"stateful\"]> = {};\n\t\tif (hasOwn(value.stateful, \"transport\")) {\n\t\t\tif (\n\t\t\t\tvalue.stateful.transport !== \"subprocess\" &&\n\t\t\t\tvalue.stateful.transport !== \"in-process\" &&\n\t\t\t\tvalue.stateful.transport !== \"rpc\" &&\n\t\t\t\tvalue.stateful.transport !== \"auto\"\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\truntime.transport = value.stateful.transport;\n\t\t}\n\t\tif (hasOwn(value.stateful, \"completionDelivery\")) {\n\t\t\tif (\n\t\t\t\tvalue.stateful.completionDelivery !== \"next-turn\" &&\n\t\t\t\tvalue.stateful.completionDelivery !== \"auto-resume\"\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\truntime.completionDelivery = value.stateful.completionDelivery;\n\t\t}\n\t\tfor (const key of STATEFUL_LIMIT_FIELDS) {\n\t\t\tif (hasOwn(value.stateful, key)) {\n\t\t\t\tif (!isValidStatefulLimit(key, value.stateful[key])) return undefined;\n\t\t\t\truntime[key] = value.stateful[key];\n\t\t\t}\n\t\t}\n\t\tfor (const key of [\"maxMailboxMessages\", \"maxMailboxMessageBytes\", \"idleTtlMs\"] as const) {\n\t\t\tif (hasOwn(value.stateful, key)) {\n\t\t\t\tif (!isPositiveInteger(value.stateful[key])) return undefined;\n\t\t\t\truntime[key] = value.stateful[key];\n\t\t\t}\n\t\t}\n\t\tif (hasOwn(value.stateful, \"retentionDays\")) {\n\t\t\tif (!isPositiveNumber(value.stateful.retentionDays)) return undefined;\n\t\t\truntime.retentionDays = value.stateful.retentionDays;\n\t\t}\n\t\tif (hasOwn(value.stateful, \"enabled\")) {\n\t\t\tif (typeof value.stateful.enabled !== \"boolean\") return undefined;\n\t\t\truntime.enabled = value.stateful.enabled;\n\t\t}\n\t\tsettings.stateful = runtime;\n\t}\n\tif (hasOwn(value, \"consult\")) {\n\t\tif (!isPlainObject(value.consult)) return undefined;\n\t\tconst consult: NonNullable<SubagentSettings[\"consult\"]> = {};\n\t\tif (hasOwn(value.consult, \"resources\")) {\n\t\t\tif (\n\t\t\t\ttypeof value.consult.resources !== \"string\" ||\n\t\t\t\t!CONSULT_RESOURCE_POLICIES.includes(value.consult.resources as ConsultResourcePolicy)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconsult.resources = value.consult.resources as ConsultResourcePolicy;\n\t\t}\n\t\tsettings.consult = consult;\n\t}\n\tif (hasOwn(value, \"cwdPolicy\")) {\n\t\tif (!isPlainObject(value.cwdPolicy)) return undefined;\n\t\tconst cwdPolicy: NonNullable<SubagentSettings[\"cwdPolicy\"]> = {};\n\t\tif (hasOwn(value.cwdPolicy, \"consultation\")) {\n\t\t\tif (\n\t\t\t\ttypeof value.cwdPolicy.consultation !== \"string\" ||\n\t\t\t\t!CONSULTATION_CWD_POLICIES.includes(value.cwdPolicy.consultation as ConsultationCwdPolicy)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcwdPolicy.consultation = value.cwdPolicy.consultation as ConsultationCwdPolicy;\n\t\t}\n\t\tif (hasOwn(value.cwdPolicy, \"delegation\")) {\n\t\t\tif (\n\t\t\t\ttypeof value.cwdPolicy.delegation !== \"string\" ||\n\t\t\t\t!DELEGATION_CWD_POLICIES.includes(value.cwdPolicy.delegation as DelegationCwdPolicy)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcwdPolicy.delegation = value.cwdPolicy.delegation as DelegationCwdPolicy;\n\t\t}\n\t\tsettings.cwdPolicy = cwdPolicy;\n\t}\n\treturn settings;\n}\n", "import type {\n\tCompletionDelivery,\n\tConsultationCwdPolicy,\n\tConsultResourcePolicy,\n\tDelegationCwdPolicy,\n\tSubagentSettings,\n\tSubagentTransportKind,\n} from \"../agents/types.js\";\nimport { DEFAULT_MAX_PARALLEL_TASKS } from \"../limits.js\";\nimport {\n\tresolveStatefulLimits,\n\tSTATEFUL_LIMIT_FIELDS,\n\ttype StatefulLimitField,\n} from \"../stateful-limits.js\";\nimport { hasOwn, isPlainObject } from \"./schema.js\";\n\nconst DEFAULT_COMPLETION_DELIVERY: CompletionDelivery = \"next-turn\";\nexport const DEFAULT_CONSULT_RESOURCE_POLICY: ConsultResourcePolicy = \"project-context\";\nexport const DEFAULT_CONSULTATION_CWD_POLICY: ConsultationCwdPolicy = \"anywhere\";\nexport const DEFAULT_DELEGATION_CWD_POLICY: DelegationCwdPolicy = \"trusted-targets\";\n\nexport type DelegationWorkflow = \"all\" | \"async-only\" | \"blocking-only\" | \"disabled\";\n\ntype SettingsSource = \"default\" | \"user settings\";\n\nexport interface InspectedSubagentSettingsDocument {\n\tpath: string;\n\traw?: Record<string, unknown>;\n\tsettings?: SubagentSettings;\n\terror?: string;\n}\n\nexport interface DelegationWorkflowSettingsSnapshot {\n\tpath: string;\n\tvalue: DelegationWorkflow;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport interface CompletionDeliverySettingsSnapshot {\n\tpath: string;\n\tvalue: CompletionDelivery;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport interface StatefulTransportSettingsSnapshot {\n\tpath: string;\n\tvalue: SubagentTransportKind;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport interface BlockingParallelLimitSettingsSnapshot {\n\tpath: string;\n\tvalue: number;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport interface StatefulLimitFieldSnapshot {\n\tvalue: number;\n\tsource: SettingsSource;\n}\n\nexport interface StatefulLimitSettingsSnapshot {\n\tpath: string;\n\twritePath: string;\n\tvalues?: Record<StatefulLimitField, StatefulLimitFieldSnapshot>;\n\terror?: string;\n}\n\nexport interface ConsultResourceSettingsSnapshot {\n\tpath: string;\n\tvalue: ConsultResourcePolicy;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport interface CwdPolicyFieldSnapshot<T> {\n\tvalue: T;\n\tsource: SettingsSource;\n}\n\nexport interface CwdPolicySettingsSnapshot {\n\tpath: string;\n\tconsultation: CwdPolicyFieldSnapshot<ConsultationCwdPolicy>;\n\tdelegation: CwdPolicyFieldSnapshot<DelegationCwdPolicy>;\n\terror?: string;\n}\n\nexport interface SubagentSettingsSnapshot {\n\tpath: string;\n\tsettings?: SubagentSettings;\n\tsource: SettingsSource;\n\terror?: string;\n}\n\nexport function resolveDelegationWorkflow(\n\tblockingEnabled: boolean,\n\tstatefulEnabled: boolean,\n): DelegationWorkflow {\n\tif (blockingEnabled && statefulEnabled) return \"all\";\n\tif (statefulEnabled) return \"async-only\";\n\tif (blockingEnabled) return \"blocking-only\";\n\treturn \"disabled\";\n}\n\nexport function resolveBlockingMaxParallelTasks(settings?: SubagentSettings): number {\n\treturn settings?.blocking?.maxParallelTasks ?? DEFAULT_MAX_PARALLEL_TASKS;\n}\n\nexport function buildSubagentSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): SubagentSettingsSnapshot {\n\treturn {\n\t\tpath: inspected.path,\n\t\tsettings: inspected.settings,\n\t\tsource: inspected.settings ? \"user settings\" : \"default\",\n\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t};\n}\n\nexport function buildConsultResourceSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): ConsultResourceSettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tvalue: DEFAULT_CONSULT_RESOURCE_POLICY,\n\t\t\tsource: \"default\",\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst explicit =\n\t\tisPlainObject(inspected.raw.consult) && hasOwn(inspected.raw.consult, \"resources\");\n\treturn {\n\t\tpath: inspected.path,\n\t\tvalue: inspected.settings.consult?.resources ?? DEFAULT_CONSULT_RESOURCE_POLICY,\n\t\tsource: explicit ? \"user settings\" : \"default\",\n\t};\n}\n\nexport function buildCwdPolicySettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): CwdPolicySettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tconsultation: { value: DEFAULT_CONSULTATION_CWD_POLICY, source: \"default\" },\n\t\t\tdelegation: { value: DEFAULT_DELEGATION_CWD_POLICY, source: \"default\" },\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst rawPolicy = isPlainObject(inspected.raw.cwdPolicy) ? inspected.raw.cwdPolicy : undefined;\n\treturn {\n\t\tpath: inspected.path,\n\t\tconsultation: {\n\t\t\tvalue: inspected.settings.cwdPolicy?.consultation ?? DEFAULT_CONSULTATION_CWD_POLICY,\n\t\t\tsource: rawPolicy && hasOwn(rawPolicy, \"consultation\") ? \"user settings\" : \"default\",\n\t\t},\n\t\tdelegation: {\n\t\t\tvalue: inspected.settings.cwdPolicy?.delegation ?? DEFAULT_DELEGATION_CWD_POLICY,\n\t\t\tsource: rawPolicy && hasOwn(rawPolicy, \"delegation\") ? \"user settings\" : \"default\",\n\t\t},\n\t};\n}\n\nexport function buildDelegationWorkflowSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): DelegationWorkflowSettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tvalue: \"all\",\n\t\t\tsource: \"default\",\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst explicit =\n\t\t(isPlainObject(inspected.raw.blocking) && hasOwn(inspected.raw.blocking, \"enabled\")) ||\n\t\t(isPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, \"enabled\"));\n\treturn {\n\t\tpath: inspected.path,\n\t\tvalue: resolveDelegationWorkflow(\n\t\t\tinspected.settings.blocking?.enabled !== false,\n\t\t\tinspected.settings.stateful?.enabled !== false,\n\t\t),\n\t\tsource: explicit ? \"user settings\" : \"default\",\n\t};\n}\n\nexport function buildCompletionDeliverySettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): CompletionDeliverySettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tvalue: DEFAULT_COMPLETION_DELIVERY,\n\t\t\tsource: \"default\",\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst explicit =\n\t\tisPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, \"completionDelivery\");\n\treturn {\n\t\tpath: inspected.path,\n\t\tvalue: inspected.settings.stateful?.completionDelivery ?? DEFAULT_COMPLETION_DELIVERY,\n\t\tsource: explicit ? \"user settings\" : \"default\",\n\t};\n}\n\nexport function buildStatefulTransportSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): StatefulTransportSettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tvalue: \"subprocess\",\n\t\t\tsource: \"default\",\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst explicit =\n\t\tisPlainObject(inspected.raw.stateful) && hasOwn(inspected.raw.stateful, \"transport\");\n\treturn {\n\t\tpath: inspected.path,\n\t\tvalue: inspected.settings.stateful?.transport ?? \"subprocess\",\n\t\tsource: explicit ? \"user settings\" : \"default\",\n\t};\n}\n\nexport function buildBlockingParallelLimitSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n): BlockingParallelLimitSettingsSnapshot {\n\tif (!inspected.raw || !inspected.settings) {\n\t\treturn {\n\t\t\tpath: inspected.path,\n\t\t\tvalue: DEFAULT_MAX_PARALLEL_TASKS,\n\t\t\tsource: \"default\",\n\t\t\t...(inspected.error ? { error: inspected.error } : {}),\n\t\t};\n\t}\n\tconst explicit =\n\t\tisPlainObject(inspected.raw.blocking) && hasOwn(inspected.raw.blocking, \"maxParallelTasks\");\n\treturn {\n\t\tpath: inspected.path,\n\t\tvalue: resolveBlockingMaxParallelTasks(inspected.settings),\n\t\tsource: explicit ? \"user settings\" : \"default\",\n\t};\n}\n\nexport function buildStatefulLimitSettingsSnapshot(\n\tinspected: InspectedSubagentSettingsDocument,\n\twritePath: string,\n): StatefulLimitSettingsSnapshot {\n\tif (inspected.error) {\n\t\treturn { path: inspected.path, writePath, error: inspected.error };\n\t}\n\tconst resolved = resolveStatefulLimits(inspected.settings?.stateful);\n\tconst rawStateful = isPlainObject(inspected.raw?.stateful) ? inspected.raw.stateful : undefined;\n\treturn {\n\t\tpath: inspected.path,\n\t\twritePath,\n\t\tvalues: Object.fromEntries(\n\t\t\tSTATEFUL_LIMIT_FIELDS.map((field) => [\n\t\t\t\tfield,\n\t\t\t\t{\n\t\t\t\t\tvalue: resolved[field],\n\t\t\t\t\tsource: rawStateful && hasOwn(rawStateful, field) ? \"user settings\" : \"default\",\n\t\t\t\t},\n\t\t\t]),\n\t\t) as unknown as Record<StatefulLimitField, StatefulLimitFieldSnapshot>,\n\t};\n}\n", "import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { getAgentDir } from \"@earendil-works/pi-coding-agent\";\nimport type { SubagentSettings } from \"./agents/types.js\";\nimport {\n\ttype BlockingParallelLimitSettingsSnapshot,\n\tbuildBlockingParallelLimitSettingsSnapshot,\n\tbuildCompletionDeliverySettingsSnapshot,\n\tbuildConsultResourceSettingsSnapshot,\n\tbuildCwdPolicySettingsSnapshot,\n\tbuildDelegationWorkflowSettingsSnapshot,\n\tbuildStatefulLimitSettingsSnapshot,\n\tbuildStatefulTransportSettingsSnapshot,\n\tbuildSubagentSettingsSnapshot,\n\ttype CompletionDeliverySettingsSnapshot,\n\ttype ConsultResourceSettingsSnapshot,\n\ttype CwdPolicySettingsSnapshot,\n\ttype DelegationWorkflowSettingsSnapshot,\n\ttype InspectedSubagentSettingsDocument,\n\ttype StatefulLimitSettingsSnapshot,\n\ttype StatefulTransportSettingsSnapshot,\n\ttype SubagentSettingsSnapshot,\n} from \"./settings/inspection.js\";\nimport { isPlainObject, normalizeSubagentSettings } from \"./settings/schema.js\";\n\nexport {\n\ttype BlockingParallelLimitSettingsSnapshot,\n\ttype CompletionDeliverySettingsSnapshot,\n\ttype ConsultResourceSettingsSnapshot,\n\ttype CwdPolicyFieldSnapshot,\n\ttype CwdPolicySettingsSnapshot,\n\tDEFAULT_CONSULT_RESOURCE_POLICY,\n\tDEFAULT_CONSULTATION_CWD_POLICY,\n\tDEFAULT_DELEGATION_CWD_POLICY,\n\ttype DelegationWorkflow,\n\ttype DelegationWorkflowSettingsSnapshot,\n\tresolveBlockingMaxParallelTasks,\n\tresolveDelegationWorkflow,\n\ttype StatefulLimitFieldSnapshot,\n\ttype StatefulLimitSettingsSnapshot,\n\ttype StatefulTransportSettingsSnapshot,\n\ttype SubagentSettingsSnapshot,\n} from \"./settings/inspection.js\";\nexport { hasOwn, normalizeAgentSettings, normalizeSubagentSettings } from \"./settings/schema.js\";\n\nexport const SUBAGENT_SETTINGS_FILE = \"pi-subagents.json\";\nconst LEGACY_SETTINGS_FILE = \"pi-subagents-config.json\";\nlet pendingSettingsNotice: string | undefined;\n\nexport function resolveSubagentSettingsPaths(): {\n\tcanonicalPath: string;\n\tlegacyPath: string;\n\tactivePath?: string;\n} {\n\tconst canonicalPath = path.join(getAgentDir(), SUBAGENT_SETTINGS_FILE);\n\tconst legacyPath = path.join(getAgentDir(), LEGACY_SETTINGS_FILE);\n\treturn {\n\t\tcanonicalPath,\n\t\tlegacyPath,\n\t\tactivePath: fs.existsSync(canonicalPath)\n\t\t\t? canonicalPath\n\t\t\t: fs.existsSync(legacyPath)\n\t\t\t\t? legacyPath\n\t\t\t\t: undefined,\n\t};\n}\n\nexport function readSubagentSettings(): SubagentSettings | undefined {\n\tpendingSettingsNotice = undefined;\n\tconst { canonicalPath, legacyPath, activePath } = resolveSubagentSettingsPaths();\n\tif (activePath === canonicalPath) {\n\t\tconst canonical = readSettingsFile(canonicalPath);\n\t\tconst notices: string[] = [];\n\t\tif (!canonical) notices.push(`${SUBAGENT_SETTINGS_FILE} is invalid and was ignored.`);\n\t\tif (fs.existsSync(legacyPath)) {\n\t\t\tnotices.push(\n\t\t\t\t`${LEGACY_SETTINGS_FILE} ignored because ${SUBAGENT_SETTINGS_FILE} takes precedence.`,\n\t\t\t);\n\t\t}\n\t\tif (notices.length > 0) pendingSettingsNotice = notices.join(\"\\n\");\n\t\treturn canonical;\n\t}\n\tif (activePath === undefined) return undefined;\n\tconst legacy = readSettingsFile(legacyPath);\n\tif (fs.existsSync(canonicalPath)) {\n\t\tconst canonical = readSettingsFile(canonicalPath);\n\t\tpendingSettingsNotice = [\n\t\t\t...(!canonical ? [`${SUBAGENT_SETTINGS_FILE} is invalid and was ignored.`] : []),\n\t\t\t`${LEGACY_SETTINGS_FILE} ignored because ${SUBAGENT_SETTINGS_FILE} was created concurrently.`,\n\t\t].join(\"\\n\");\n\t\treturn canonical;\n\t}\n\tif (!legacy) {\n\t\tpendingSettingsNotice = `${LEGACY_SETTINGS_FILE} is invalid and was ignored.`;\n\t\treturn undefined;\n\t}\n\tpendingSettingsNotice = `Using legacy ${LEGACY_SETTINGS_FILE}; rename it to ${SUBAGENT_SETTINGS_FILE}. Future saves write ${SUBAGENT_SETTINGS_FILE} without modifying the legacy file.`;\n\treturn legacy;\n}\n\nexport function consumeSubagentSettingsNotice() {\n\tconst notice = pendingSettingsNotice;\n\tpendingSettingsNotice = undefined;\n\treturn notice;\n}\n\nexport function subagentSettingsFilePath(): string {\n\treturn path.join(getAgentDir(), SUBAGENT_SETTINGS_FILE);\n}\n\nfunction inspectSubagentSettingsDocument(): InspectedSubagentSettingsDocument {\n\tconst { canonicalPath, activePath } = resolveSubagentSettingsPaths();\n\tif (activePath === undefined) return { path: canonicalPath };\n\tconst inspected = inspectSubagentSettingsPath(activePath);\n\treturn activePath !== canonicalPath && fs.existsSync(canonicalPath)\n\t\t? inspectSubagentSettingsPath(canonicalPath)\n\t\t: inspected;\n}\n\nfunction inspectSubagentSettingsPath(configPath: string): InspectedSubagentSettingsDocument {\n\tconst fileName = path.basename(configPath);\n\tlet contents: string;\n\ttry {\n\t\tcontents = fs.readFileSync(configPath, \"utf8\");\n\t} catch (error) {\n\t\tconst code = (error as NodeJS.ErrnoException).code;\n\t\treturn {\n\t\t\tpath: configPath,\n\t\t\terror: `${fileName} could not be read${code ? ` (${safeErrorCode(code)})` : \"\"}`,\n\t\t};\n\t}\n\tlet raw: unknown;\n\ttry {\n\t\traw = JSON.parse(contents);\n\t} catch {\n\t\treturn { path: configPath, error: `${fileName} contains malformed JSON` };\n\t}\n\tconst settings = normalizeSubagentSettings(raw);\n\tif (!isPlainObject(raw) || !settings) {\n\t\treturn { path: configPath, error: `${fileName} is not a valid settings object` };\n\t}\n\treturn { path: configPath, raw, settings };\n}\n\nexport function inspectSubagentSettings(): SubagentSettingsSnapshot {\n\treturn buildSubagentSettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectConsultResourceSettings(): ConsultResourceSettingsSnapshot {\n\treturn buildConsultResourceSettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectCwdPolicySettings(): CwdPolicySettingsSnapshot {\n\treturn buildCwdPolicySettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectDelegationWorkflowSettings(): DelegationWorkflowSettingsSnapshot {\n\treturn buildDelegationWorkflowSettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectCompletionDeliverySettings(): CompletionDeliverySettingsSnapshot {\n\treturn buildCompletionDeliverySettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectStatefulTransportSettings(): StatefulTransportSettingsSnapshot {\n\treturn buildStatefulTransportSettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectBlockingParallelLimitSettings(): BlockingParallelLimitSettingsSnapshot {\n\treturn buildBlockingParallelLimitSettingsSnapshot(inspectSubagentSettingsDocument());\n}\n\nexport function inspectStatefulLimitSettings(): StatefulLimitSettingsSnapshot {\n\treturn buildStatefulLimitSettingsSnapshot(\n\t\tinspectSubagentSettingsDocument(),\n\t\tsubagentSettingsFilePath(),\n\t);\n}\n\nexport function pathEntryExists(filePath: string): boolean {\n\ttry {\n\t\tfs.lstatSync(filePath);\n\t\treturn true;\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n\t\tthrow error;\n\t}\n}\n\nfunction readSettingsFile(configPath: string): SubagentSettings | undefined {\n\treturn readSettingsSnapshot(configPath).settings;\n}\n\nexport function readSettingsSnapshot(configPath: string): {\n\tsettings?: SubagentSettings;\n\tcontents?: string;\n} {\n\ttry {\n\t\tconst contents = fs.readFileSync(configPath, \"utf8\");\n\t\treturn { settings: normalizeSubagentSettings(JSON.parse(contents)), contents };\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction safeErrorCode(value: string): string {\n\treturn value.replace(/[^A-Z0-9_-]/giu, \"?\").slice(0, 64);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAcO,SAAS,OAAO,KAAa,KAA2B;AAC9D,SAAO,OAAO,OAAO,KAAK,GAAG;AAC9B;AAEO,SAAS,cAAc,OAAkD;AAC/E,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC3E;AAEA,SAAS,cAAc,OAAmC;AACzD,SAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,MAAM,CAAC,SAAS,OAAO,SAAS,QAAQ;AAC9E;AAEO,SAAS,iBAAiB,OAAiC;AACjE,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS;AACxE;AAEO,SAAS,kBAAkB,OAAiC;AAClE,SAAO,iBAAiB,KAAK,KAAK,OAAO,cAAc,KAAK;AAC7D;AAEO,SAAS,uBAAuB,OAAiD;AACvF,MAAI,CAAC,cAAc,KAAK,EAAG,QAAO;AAElC,QAAM,SAA8B,CAAC;AACrC,MAAI,gBAAgB;AAEpB,MAAI,OAAO,OAAO,OAA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