refactor: centralize concurrency resolution
This commit is contained in:
@@ -1,2 +1,20 @@
|
||||
import type { ClawdbotConfig } from "./types.js";
|
||||
|
||||
export const DEFAULT_AGENT_MAX_CONCURRENT = 4;
|
||||
export const DEFAULT_SUBAGENT_MAX_CONCURRENT = 8;
|
||||
|
||||
export function resolveAgentMaxConcurrent(cfg?: ClawdbotConfig): number {
|
||||
const raw = cfg?.agents?.defaults?.maxConcurrent;
|
||||
if (typeof raw === "number" && Number.isFinite(raw)) {
|
||||
return Math.max(1, Math.floor(raw));
|
||||
}
|
||||
return DEFAULT_AGENT_MAX_CONCURRENT;
|
||||
}
|
||||
|
||||
export function resolveSubagentMaxConcurrent(cfg?: ClawdbotConfig): number {
|
||||
const raw = cfg?.agents?.defaults?.subagents?.maxConcurrent;
|
||||
if (typeof raw === "number" && Number.isFinite(raw)) {
|
||||
return Math.max(1, Math.floor(raw));
|
||||
}
|
||||
return DEFAULT_SUBAGENT_MAX_CONCURRENT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user