@11agents/cli 0.1.32 → 0.1.33
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/package.json +1 -1
- package/src/commands/runtime.js +10 -4
package/package.json
CHANGED
package/src/commands/runtime.js
CHANGED
|
@@ -83,6 +83,7 @@ function runtimeDeps(overrides = {}) {
|
|
|
83
83
|
sleep: overrides.sleep || sleep,
|
|
84
84
|
syncKnowledge: overrides.syncKnowledge || syncKnowledge,
|
|
85
85
|
mcpKnowledgeSync: overrides.mcpKnowledgeSync || mcpKnowledgeSync,
|
|
86
|
+
cpuCount: overrides.cpuCount ?? os.cpus().length,
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -1540,9 +1541,10 @@ async function claimAndRunRuntimeTasks(registration, flags, deps, handlerModule,
|
|
|
1540
1541
|
const config = configFromFlags(flags)
|
|
1541
1542
|
const machineKey = registration?.machine?.machine_key || machineOverride(flags) || ''
|
|
1542
1543
|
|
|
1543
|
-
// Each
|
|
1544
|
-
// maxConcurrent
|
|
1545
|
-
const
|
|
1544
|
+
// Each runtime gets (vCPUs - 1) slots so the host stays responsive.
|
|
1545
|
+
// maxConcurrent is honoured when it exceeds the CPU-derived default.
|
|
1546
|
+
const perRuntime = Math.max(1, (deps.cpuCount ?? os.cpus().length) - 1)
|
|
1547
|
+
const effectiveConcurrent = Math.max(maxConcurrent, runtimes.length * perRuntime)
|
|
1546
1548
|
const slots = Array.from({ length: effectiveConcurrent }, (_, i) => runtimes[i % runtimes.length])
|
|
1547
1549
|
const results = await Promise.allSettled(
|
|
1548
1550
|
slots.map(runtime => runOneRuntimeTaskSlot(runtime, config, machineKey, registration, flags, deps, handlerModule, retryState, heartbeatIntervalMs))
|
|
@@ -1565,7 +1567,11 @@ export async function startRuntimeDaemon(flags = {}, deps = {}) {
|
|
|
1565
1567
|
const scanIntervalMs = Number(flag(flags, 'scan-interval', '60')) * 1000
|
|
1566
1568
|
const taskIntervalMs = Number(flag(flags, 'task-interval', flag(flags, 'heartbeat-interval', '15'))) * 1000
|
|
1567
1569
|
const projectRefreshIntervalMs = Number(flag(flags, 'project-refresh-interval', '1800')) * 1000
|
|
1568
|
-
const
|
|
1570
|
+
const cpuCount = resolvedDeps.cpuCount ?? os.cpus().length
|
|
1571
|
+
const cpuDefault = Math.max(1, cpuCount - 1)
|
|
1572
|
+
const envMax = Number(process.env.DAEMON_MAX_CONCURRENCY)
|
|
1573
|
+
const envConcurrency = Number.isInteger(envMax) && envMax > 0 && envMax <= cpuCount - 1 ? envMax : null
|
|
1574
|
+
const maxConcurrent = envConcurrency ?? Math.max(1, Number(flag(flags, 'concurrency', String(cpuDefault))) || cpuDefault)
|
|
1569
1575
|
const once = Boolean(flags.once)
|
|
1570
1576
|
const handlerPath = flag(flags, 'handler')
|
|
1571
1577
|
|