@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.
- package/README.md +20 -7
- package/dist/chunks/auto-transport-SY2VHUFH.ts +109 -0
- package/dist/chunks/auto-transport-SY2VHUFH.ts.map +7 -0
- package/dist/chunks/capability-grant-CGEWOEKE.ts +19 -0
- package/dist/chunks/capability-grant-CGEWOEKE.ts.map +7 -0
- package/dist/chunks/chunk-434NII74.ts +282 -0
- package/dist/chunks/chunk-434NII74.ts.map +7 -0
- package/dist/chunks/chunk-47SK2QYC.ts +56 -0
- package/dist/chunks/chunk-47SK2QYC.ts.map +7 -0
- package/dist/chunks/chunk-6KJ34M6S.ts +159 -0
- package/dist/chunks/chunk-6KJ34M6S.ts.map +7 -0
- package/dist/chunks/chunk-7OBINKFM.ts +80 -0
- package/dist/chunks/chunk-7OBINKFM.ts.map +7 -0
- package/dist/chunks/chunk-7QPPBBXZ.ts +335 -0
- package/dist/chunks/chunk-7QPPBBXZ.ts.map +7 -0
- package/dist/chunks/chunk-AEUYS7JC.ts +73 -0
- package/dist/chunks/chunk-AEUYS7JC.ts.map +7 -0
- package/dist/chunks/chunk-BFK2Z4ZF.ts +189 -0
- package/dist/chunks/chunk-BFK2Z4ZF.ts.map +7 -0
- package/dist/chunks/chunk-BOAXY55Y.ts +153 -0
- package/dist/chunks/chunk-BOAXY55Y.ts.map +7 -0
- package/dist/chunks/chunk-C4L6P266.ts +22 -0
- package/dist/chunks/chunk-C4L6P266.ts.map +7 -0
- package/dist/chunks/chunk-DPPVEQAM.ts +29 -0
- package/dist/chunks/chunk-DPPVEQAM.ts.map +7 -0
- package/dist/chunks/chunk-DQMN4OYM.ts +913 -0
- package/dist/chunks/chunk-DQMN4OYM.ts.map +7 -0
- package/dist/chunks/chunk-DSOOH73Y.ts +238 -0
- package/dist/chunks/chunk-DSOOH73Y.ts.map +7 -0
- package/dist/chunks/chunk-EFBPISNT.ts +421 -0
- package/dist/chunks/chunk-EFBPISNT.ts.map +7 -0
- package/dist/chunks/chunk-EWWXFU7N.ts +150 -0
- package/dist/chunks/chunk-EWWXFU7N.ts.map +7 -0
- package/dist/chunks/chunk-F4L2UVSK.ts +380 -0
- package/dist/chunks/chunk-F4L2UVSK.ts.map +7 -0
- package/dist/chunks/chunk-F5YWVHQX.ts +1543 -0
- package/dist/chunks/chunk-F5YWVHQX.ts.map +7 -0
- package/dist/chunks/chunk-G3RSMSXJ.ts +63 -0
- package/dist/chunks/chunk-G3RSMSXJ.ts.map +7 -0
- package/dist/chunks/chunk-G6VZTCFH.ts +70 -0
- package/dist/chunks/chunk-G6VZTCFH.ts.map +7 -0
- package/dist/chunks/chunk-H3FP6DLR.ts +160 -0
- package/dist/chunks/chunk-H3FP6DLR.ts.map +7 -0
- package/dist/chunks/chunk-HA36LPCO.ts +130 -0
- package/dist/chunks/chunk-HA36LPCO.ts.map +7 -0
- package/dist/chunks/chunk-HKC4ES4B.ts +65 -0
- package/dist/chunks/chunk-HKC4ES4B.ts.map +7 -0
- package/dist/chunks/chunk-HOP5FXDT.ts +27 -0
- package/dist/chunks/chunk-HOP5FXDT.ts.map +7 -0
- package/dist/chunks/chunk-I2FAK44T.ts +324 -0
- package/dist/chunks/chunk-I2FAK44T.ts.map +7 -0
- package/dist/chunks/chunk-IGAMVWFN.ts +139 -0
- package/dist/chunks/chunk-IGAMVWFN.ts.map +7 -0
- package/dist/chunks/chunk-KMGKCEO4.ts +38 -0
- package/dist/chunks/chunk-KMGKCEO4.ts.map +7 -0
- package/dist/chunks/chunk-N7BLVXKK.ts +73 -0
- package/dist/chunks/chunk-N7BLVXKK.ts.map +7 -0
- package/dist/chunks/chunk-NIF42QMF.ts +297 -0
- package/dist/chunks/chunk-NIF42QMF.ts.map +7 -0
- package/dist/chunks/chunk-O4VO6JUJ.ts +52 -0
- package/dist/chunks/chunk-O4VO6JUJ.ts.map +7 -0
- package/dist/chunks/chunk-ONDTY4EL.ts +91 -0
- package/dist/chunks/chunk-ONDTY4EL.ts.map +7 -0
- package/dist/chunks/chunk-OVPHFGKO.ts +1769 -0
- package/dist/chunks/chunk-OVPHFGKO.ts.map +7 -0
- package/dist/chunks/chunk-P7OH4XMF.ts +60 -0
- package/dist/chunks/chunk-P7OH4XMF.ts.map +7 -0
- package/dist/chunks/chunk-PSK43Y6A.ts +339 -0
- package/dist/chunks/chunk-PSK43Y6A.ts.map +7 -0
- package/dist/chunks/chunk-QBORTI4W.ts +468 -0
- package/dist/chunks/chunk-QBORTI4W.ts.map +7 -0
- package/dist/chunks/chunk-QDVGH2X7.ts +171 -0
- package/dist/chunks/chunk-QDVGH2X7.ts.map +7 -0
- package/dist/chunks/chunk-RHRQMT7Q.ts +490 -0
- package/dist/chunks/chunk-RHRQMT7Q.ts.map +7 -0
- package/dist/chunks/chunk-RRR66UWR.ts +28 -0
- package/dist/chunks/chunk-RRR66UWR.ts.map +7 -0
- package/dist/chunks/chunk-RSUXZD6S.ts +275 -0
- package/dist/chunks/chunk-RSUXZD6S.ts.map +7 -0
- package/dist/chunks/chunk-RTCVYIZA.ts +221 -0
- package/dist/chunks/chunk-RTCVYIZA.ts.map +7 -0
- package/dist/chunks/chunk-S2IWVK3J.ts +44 -0
- package/dist/chunks/chunk-S2IWVK3J.ts.map +7 -0
- package/dist/chunks/chunk-SCZ33MYW.ts +52 -0
- package/dist/chunks/chunk-SCZ33MYW.ts.map +7 -0
- package/dist/chunks/chunk-SWGQLFSD.ts +60 -0
- package/dist/chunks/chunk-SWGQLFSD.ts.map +7 -0
- package/dist/chunks/chunk-UMBPMVJW.ts +22 -0
- package/dist/chunks/chunk-UMBPMVJW.ts.map +7 -0
- package/dist/chunks/chunk-UVFVHIOP.ts +735 -0
- package/dist/chunks/chunk-UVFVHIOP.ts.map +7 -0
- package/dist/chunks/completion-delivery-YPOWSSV3.ts +16 -0
- package/dist/chunks/completion-delivery-YPOWSSV3.ts.map +7 -0
- package/dist/chunks/config-status-J4GPWP46.ts +34 -0
- package/dist/chunks/config-status-J4GPWP46.ts.map +7 -0
- package/dist/chunks/config-ui-3IBMHTQB.ts +1146 -0
- package/dist/chunks/config-ui-3IBMHTQB.ts.map +7 -0
- package/dist/chunks/consult-NYXVDN5G.ts +518 -0
- package/dist/chunks/consult-NYXVDN5G.ts.map +7 -0
- package/dist/chunks/context-QDKLVQXE.ts +11 -0
- package/dist/chunks/context-QDKLVQXE.ts.map +7 -0
- package/dist/chunks/create-stateful-transport-4WKZHRSI.ts +130 -0
- package/dist/chunks/create-stateful-transport-4WKZHRSI.ts.map +7 -0
- package/dist/chunks/cwd-policy-NB6XZ5GF.ts +17 -0
- package/dist/chunks/cwd-policy-NB6XZ5GF.ts.map +7 -0
- package/dist/chunks/delegation-contract-WJPT4FVS.ts +24 -0
- package/dist/chunks/delegation-contract-WJPT4FVS.ts.map +7 -0
- package/dist/chunks/discovery-K25T3SH4.ts +12 -0
- package/dist/chunks/discovery-K25T3SH4.ts.map +7 -0
- package/dist/chunks/execution-DS2DEIQZ.ts +4034 -0
- package/dist/chunks/execution-DS2DEIQZ.ts.map +7 -0
- package/dist/chunks/in-process-transport-TEYAWSEC.ts +38 -0
- package/dist/chunks/in-process-transport-TEYAWSEC.ts.map +7 -0
- package/dist/chunks/inspect-UOQQ3KNL.ts +619 -0
- package/dist/chunks/inspect-UOQQ3KNL.ts.map +7 -0
- package/dist/chunks/peer-communication-KL36Z6CO.ts +294 -0
- package/dist/chunks/peer-communication-KL36Z6CO.ts.map +7 -0
- package/dist/chunks/persistence-VSGXAW4P.ts +344 -0
- package/dist/chunks/persistence-VSGXAW4P.ts.map +7 -0
- package/dist/chunks/registry-E6XPJB7L.ts +1324 -0
- package/dist/chunks/registry-E6XPJB7L.ts.map +7 -0
- package/dist/chunks/retained-semantic-state-7WXSGRJU.ts +81 -0
- package/dist/chunks/retained-semantic-state-7WXSGRJU.ts.map +7 -0
- package/dist/chunks/rpc-transport-Y6LA5BOP.ts +1154 -0
- package/dist/chunks/rpc-transport-Y6LA5BOP.ts.map +7 -0
- package/dist/chunks/runtime-policy-5YELCOVC.ts +15 -0
- package/dist/chunks/runtime-policy-5YELCOVC.ts.map +7 -0
- package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts +19 -0
- package/dist/chunks/semantic-snapshot-WPJ3UAFW.ts.map +7 -0
- package/dist/chunks/spawn-idempotency-QGHO2WKC.ts +13 -0
- package/dist/chunks/spawn-idempotency-QGHO2WKC.ts.map +7 -0
- package/dist/chunks/stateful-lifecycle-JAR6K55H.ts +15 -0
- package/dist/chunks/stateful-lifecycle-JAR6K55H.ts.map +7 -0
- package/dist/chunks/subprocess-transport-C2XVR25R.ts +158 -0
- package/dist/chunks/subprocess-transport-C2XVR25R.ts.map +7 -0
- package/dist/chunks/workspace-WDKLN72J.ts +11 -0
- package/dist/chunks/workspace-WDKLN72J.ts.map +7 -0
- package/dist/index.ts +1057 -0
- package/dist/index.ts.map +7 -0
- package/package.json +9 -5
- package/src/index.ts +1 -1
- package/src/settings-reader.ts +208 -0
- package/src/settings.ts +22 -187
- package/src/stateful-registration.ts +1230 -0
- package/src/stateful-safety.ts +1 -1
- package/src/stateful.ts +2 -1234
- package/src/subagents-extension.ts +307 -0
- package/src/subagents.ts +1 -308
package/src/settings.ts
CHANGED
|
@@ -15,32 +15,18 @@ import type {
|
|
|
15
15
|
SubagentTransportKind,
|
|
16
16
|
} from "./agents/types.js";
|
|
17
17
|
import { MAX_CONFIGURABLE_PARALLEL_TASKS } from "./limits.js";
|
|
18
|
-
import {
|
|
19
|
-
type BlockingParallelLimitSettingsSnapshot,
|
|
20
|
-
buildBlockingParallelLimitSettingsSnapshot,
|
|
21
|
-
buildCompletionDeliverySettingsSnapshot,
|
|
22
|
-
buildConsultResourceSettingsSnapshot,
|
|
23
|
-
buildCwdPolicySettingsSnapshot,
|
|
24
|
-
buildDelegationWorkflowSettingsSnapshot,
|
|
25
|
-
buildStatefulLimitSettingsSnapshot,
|
|
26
|
-
buildStatefulTransportSettingsSnapshot,
|
|
27
|
-
buildSubagentSettingsSnapshot,
|
|
28
|
-
type CompletionDeliverySettingsSnapshot,
|
|
29
|
-
type ConsultResourceSettingsSnapshot,
|
|
30
|
-
type CwdPolicySettingsSnapshot,
|
|
31
|
-
type DelegationWorkflow,
|
|
32
|
-
type DelegationWorkflowSettingsSnapshot,
|
|
33
|
-
type InspectedSubagentSettingsDocument,
|
|
34
|
-
type StatefulLimitSettingsSnapshot,
|
|
35
|
-
type StatefulTransportSettingsSnapshot,
|
|
36
|
-
type SubagentSettingsSnapshot,
|
|
37
|
-
} from "./settings/inspection.js";
|
|
18
|
+
import type { DelegationWorkflow } from "./settings/inspection.js";
|
|
38
19
|
import {
|
|
39
20
|
hasOwn,
|
|
40
21
|
isPlainObject,
|
|
41
22
|
isPositiveInteger,
|
|
42
23
|
normalizeSubagentSettings,
|
|
43
24
|
} from "./settings/schema.js";
|
|
25
|
+
import {
|
|
26
|
+
pathEntryExists,
|
|
27
|
+
resolveSubagentSettingsPaths,
|
|
28
|
+
SUBAGENT_SETTINGS_FILE,
|
|
29
|
+
} from "./settings-reader.js";
|
|
44
30
|
import {
|
|
45
31
|
isValidStatefulLimit,
|
|
46
32
|
resolveStatefulLimits,
|
|
@@ -56,26 +42,34 @@ export {
|
|
|
56
42
|
type ConsultResourceSettingsSnapshot,
|
|
57
43
|
type CwdPolicyFieldSnapshot,
|
|
58
44
|
type CwdPolicySettingsSnapshot,
|
|
45
|
+
consumeSubagentSettingsNotice,
|
|
59
46
|
DEFAULT_CONSULT_RESOURCE_POLICY,
|
|
60
47
|
DEFAULT_CONSULTATION_CWD_POLICY,
|
|
61
48
|
DEFAULT_DELEGATION_CWD_POLICY,
|
|
62
49
|
type DelegationWorkflow,
|
|
63
50
|
type DelegationWorkflowSettingsSnapshot,
|
|
51
|
+
hasOwn,
|
|
52
|
+
inspectBlockingParallelLimitSettings,
|
|
53
|
+
inspectCompletionDeliverySettings,
|
|
54
|
+
inspectConsultResourceSettings,
|
|
55
|
+
inspectCwdPolicySettings,
|
|
56
|
+
inspectDelegationWorkflowSettings,
|
|
57
|
+
inspectStatefulLimitSettings,
|
|
58
|
+
inspectStatefulTransportSettings,
|
|
59
|
+
inspectSubagentSettings,
|
|
60
|
+
normalizeAgentSettings,
|
|
61
|
+
normalizeSubagentSettings,
|
|
62
|
+
readSubagentSettings,
|
|
64
63
|
resolveBlockingMaxParallelTasks,
|
|
65
64
|
resolveDelegationWorkflow,
|
|
66
65
|
type StatefulLimitFieldSnapshot,
|
|
67
66
|
type StatefulLimitSettingsSnapshot,
|
|
68
67
|
type StatefulTransportSettingsSnapshot,
|
|
69
68
|
type SubagentSettingsSnapshot,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
hasOwn,
|
|
73
|
-
normalizeAgentSettings,
|
|
74
|
-
normalizeSubagentSettings,
|
|
75
|
-
} from "./settings/schema.js";
|
|
69
|
+
subagentSettingsFilePath,
|
|
70
|
+
} from "./settings-reader.js";
|
|
76
71
|
|
|
77
|
-
const SETTINGS_FILE =
|
|
78
|
-
const LEGACY_SETTINGS_FILE = "pi-subagents-config.json";
|
|
72
|
+
const SETTINGS_FILE = SUBAGENT_SETTINGS_FILE;
|
|
79
73
|
const require = createRequire(import.meta.url);
|
|
80
74
|
|
|
81
75
|
const SETTINGS_LOCK_FS_ADAPTER = {
|
|
@@ -90,140 +84,11 @@ const SETTINGS_LOCK_FS_ADAPTER = {
|
|
|
90
84
|
utimes: fs.utimes,
|
|
91
85
|
utimesSync: fs.utimesSync,
|
|
92
86
|
};
|
|
93
|
-
let pendingSettingsNotice: string | undefined;
|
|
94
|
-
|
|
95
|
-
function resolveSubagentSettingsPaths(): {
|
|
96
|
-
canonicalPath: string;
|
|
97
|
-
legacyPath: string;
|
|
98
|
-
activePath?: string;
|
|
99
|
-
} {
|
|
100
|
-
const canonicalPath = path.join(getAgentDir(), SETTINGS_FILE);
|
|
101
|
-
const legacyPath = path.join(getAgentDir(), LEGACY_SETTINGS_FILE);
|
|
102
|
-
return {
|
|
103
|
-
canonicalPath,
|
|
104
|
-
legacyPath,
|
|
105
|
-
activePath: fs.existsSync(canonicalPath)
|
|
106
|
-
? canonicalPath
|
|
107
|
-
: fs.existsSync(legacyPath)
|
|
108
|
-
? legacyPath
|
|
109
|
-
: undefined,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function readSubagentSettings(): SubagentSettings | undefined {
|
|
114
|
-
pendingSettingsNotice = undefined;
|
|
115
|
-
const { canonicalPath, legacyPath, activePath } = resolveSubagentSettingsPaths();
|
|
116
|
-
if (activePath === canonicalPath) {
|
|
117
|
-
const canonical = readSettingsFile(canonicalPath);
|
|
118
|
-
const notices: string[] = [];
|
|
119
|
-
if (!canonical) notices.push(`${SETTINGS_FILE} is invalid and was ignored.`);
|
|
120
|
-
if (fs.existsSync(legacyPath)) {
|
|
121
|
-
notices.push(`${LEGACY_SETTINGS_FILE} ignored because ${SETTINGS_FILE} takes precedence.`);
|
|
122
|
-
}
|
|
123
|
-
if (notices.length > 0) pendingSettingsNotice = notices.join("\n");
|
|
124
|
-
return canonical;
|
|
125
|
-
}
|
|
126
|
-
if (activePath === undefined) return undefined;
|
|
127
|
-
const legacy = readSettingsFile(legacyPath);
|
|
128
|
-
if (fs.existsSync(canonicalPath)) {
|
|
129
|
-
const canonical = readSettingsFile(canonicalPath);
|
|
130
|
-
pendingSettingsNotice = [
|
|
131
|
-
...(!canonical ? [`${SETTINGS_FILE} is invalid and was ignored.`] : []),
|
|
132
|
-
`${LEGACY_SETTINGS_FILE} ignored because ${SETTINGS_FILE} was created concurrently.`,
|
|
133
|
-
].join("\n");
|
|
134
|
-
return canonical;
|
|
135
|
-
}
|
|
136
|
-
if (!legacy) {
|
|
137
|
-
pendingSettingsNotice = `${LEGACY_SETTINGS_FILE} is invalid and was ignored.`;
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
pendingSettingsNotice = `Using legacy ${LEGACY_SETTINGS_FILE}; rename it to ${SETTINGS_FILE}. Future saves write ${SETTINGS_FILE} without modifying the legacy file.`;
|
|
141
|
-
return legacy;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function consumeSubagentSettingsNotice() {
|
|
145
|
-
const notice = pendingSettingsNotice;
|
|
146
|
-
pendingSettingsNotice = undefined;
|
|
147
|
-
return notice;
|
|
148
|
-
}
|
|
149
87
|
|
|
150
88
|
export function saveSubagentConfig(settings: SubagentSettings): void {
|
|
151
89
|
writeSettingsObject(settings);
|
|
152
90
|
}
|
|
153
91
|
|
|
154
|
-
export function subagentSettingsFilePath(): string {
|
|
155
|
-
return path.join(getAgentDir(), SETTINGS_FILE);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function inspectSubagentSettingsDocument(): InspectedSubagentSettingsDocument {
|
|
159
|
-
const { canonicalPath, activePath } = resolveSubagentSettingsPaths();
|
|
160
|
-
if (activePath === undefined) return { path: canonicalPath };
|
|
161
|
-
const inspected = inspectSubagentSettingsPath(activePath);
|
|
162
|
-
return activePath !== canonicalPath && fs.existsSync(canonicalPath)
|
|
163
|
-
? inspectSubagentSettingsPath(canonicalPath)
|
|
164
|
-
: inspected;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function inspectSubagentSettingsPath(configPath: string): InspectedSubagentSettingsDocument {
|
|
168
|
-
const fileName = path.basename(configPath);
|
|
169
|
-
let contents: string;
|
|
170
|
-
try {
|
|
171
|
-
contents = fs.readFileSync(configPath, "utf8");
|
|
172
|
-
} catch (error) {
|
|
173
|
-
const code = (error as NodeJS.ErrnoException).code;
|
|
174
|
-
return {
|
|
175
|
-
path: configPath,
|
|
176
|
-
error: `${fileName} could not be read${code ? ` (${safeErrorCode(code)})` : ""}`,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
let raw: unknown;
|
|
180
|
-
try {
|
|
181
|
-
raw = JSON.parse(contents);
|
|
182
|
-
} catch {
|
|
183
|
-
return { path: configPath, error: `${fileName} contains malformed JSON` };
|
|
184
|
-
}
|
|
185
|
-
const settings = normalizeSubagentSettings(raw);
|
|
186
|
-
if (!isPlainObject(raw) || !settings) {
|
|
187
|
-
return { path: configPath, error: `${fileName} is not a valid settings object` };
|
|
188
|
-
}
|
|
189
|
-
return { path: configPath, raw, settings };
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export function inspectSubagentSettings(): SubagentSettingsSnapshot {
|
|
193
|
-
return buildSubagentSettingsSnapshot(inspectSubagentSettingsDocument());
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function inspectConsultResourceSettings(): ConsultResourceSettingsSnapshot {
|
|
197
|
-
return buildConsultResourceSettingsSnapshot(inspectSubagentSettingsDocument());
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export function inspectCwdPolicySettings(): CwdPolicySettingsSnapshot {
|
|
201
|
-
return buildCwdPolicySettingsSnapshot(inspectSubagentSettingsDocument());
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function inspectDelegationWorkflowSettings(): DelegationWorkflowSettingsSnapshot {
|
|
205
|
-
return buildDelegationWorkflowSettingsSnapshot(inspectSubagentSettingsDocument());
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function inspectCompletionDeliverySettings(): CompletionDeliverySettingsSnapshot {
|
|
209
|
-
return buildCompletionDeliverySettingsSnapshot(inspectSubagentSettingsDocument());
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export function inspectStatefulTransportSettings(): StatefulTransportSettingsSnapshot {
|
|
213
|
-
return buildStatefulTransportSettingsSnapshot(inspectSubagentSettingsDocument());
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export function inspectBlockingParallelLimitSettings(): BlockingParallelLimitSettingsSnapshot {
|
|
217
|
-
return buildBlockingParallelLimitSettingsSnapshot(inspectSubagentSettingsDocument());
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export function inspectStatefulLimitSettings(): StatefulLimitSettingsSnapshot {
|
|
221
|
-
return buildStatefulLimitSettingsSnapshot(
|
|
222
|
-
inspectSubagentSettingsDocument(),
|
|
223
|
-
subagentSettingsFilePath(),
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
92
|
export function updateDelegationWorkflowSetting(
|
|
228
93
|
value: Exclude<DelegationWorkflow, "disabled">,
|
|
229
94
|
): void {
|
|
@@ -533,36 +398,6 @@ function sameStatefulLimits(left: StatefulLimits, right: StatefulLimits): boolea
|
|
|
533
398
|
return STATEFUL_LIMIT_FIELDS.every((field) => left[field] === right[field]);
|
|
534
399
|
}
|
|
535
400
|
|
|
536
|
-
function pathEntryExists(filePath: string): boolean {
|
|
537
|
-
try {
|
|
538
|
-
fs.lstatSync(filePath);
|
|
539
|
-
return true;
|
|
540
|
-
} catch (error) {
|
|
541
|
-
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
|
|
542
|
-
throw error;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function readSettingsFile(configPath: string): SubagentSettings | undefined {
|
|
547
|
-
return readSettingsSnapshot(configPath).settings;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function readSettingsSnapshot(configPath: string): {
|
|
551
|
-
settings?: SubagentSettings;
|
|
552
|
-
contents?: string;
|
|
553
|
-
} {
|
|
554
|
-
try {
|
|
555
|
-
const contents = fs.readFileSync(configPath, "utf8");
|
|
556
|
-
return { settings: normalizeSubagentSettings(JSON.parse(contents)), contents };
|
|
557
|
-
} catch {
|
|
558
|
-
return {};
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
function safeErrorCode(value: string): string {
|
|
563
|
-
return value.replace(/[^A-Z0-9_-]/giu, "?").slice(0, 64);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
401
|
export function uniqueToolNames(tools: string[]): string[] {
|
|
567
402
|
return [...new Set(tools)];
|
|
568
403
|
}
|