feat(cli): add ensureSubagentDefaults function to set default subagent configurations
This commit introduces the ensureSubagentDefaults function, which sets various default configurations for subagents, including max concurrent agents, max spawn depth, and run timeout settings. The function is called during the bootstrap process to ensure these defaults are applied for the specified profile.
This commit is contained in:
parent
33589ca5ca
commit
7fa49f58ce
@ -357,6 +357,25 @@ async function ensureDefaultWorkspacePath(
|
||||
});
|
||||
}
|
||||
|
||||
async function ensureSubagentDefaults(openclawCommand: string, profile: string): Promise<void> {
|
||||
const settings: Array<[string, string]> = [
|
||||
["agents.defaults.subagents.maxConcurrent", "8"],
|
||||
["agents.defaults.subagents.maxSpawnDepth", "2"],
|
||||
["agents.defaults.subagents.maxChildrenPerAgent", "10"],
|
||||
["agents.defaults.subagents.archiveAfterMinutes", "180"],
|
||||
["agents.defaults.subagents.runTimeoutSeconds", "0"],
|
||||
["tools.subagents.tools.deny", "[]"],
|
||||
];
|
||||
for (const [key, value] of settings) {
|
||||
await runOpenClawOrThrow({
|
||||
openclawCommand,
|
||||
args: ["--profile", profile, "config", "set", key, value],
|
||||
timeoutMs: 10_000,
|
||||
errorMessage: `Failed to set ${key}=${value}.`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function probeForWebApp(port: number): Promise<boolean> {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), 1_500);
|
||||
@ -1355,6 +1374,8 @@ export async function bootstrapCommand(
|
||||
// the same gateway target on subsequent requests.
|
||||
await ensureGatewayPort(openclawCommand, profile, gatewayPort);
|
||||
|
||||
await ensureSubagentDefaults(openclawCommand, profile);
|
||||
|
||||
let gatewayProbe = await probeGateway(openclawCommand, profile, gatewayPort);
|
||||
let gatewayAutoFix: GatewayAutoFixResult | undefined;
|
||||
if (!gatewayProbe.ok) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user