@11agents/cli 0.1.31 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@11agents/cli",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "11agents local runtime and telemetry CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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,7 +1541,11 @@ 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
- const slots = Array.from({ length: maxConcurrent }, (_, i) => runtimes[i % runtimes.length])
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)
1548
+ const slots = Array.from({ length: effectiveConcurrent }, (_, i) => runtimes[i % runtimes.length])
1544
1549
  const results = await Promise.allSettled(
1545
1550
  slots.map(runtime => runOneRuntimeTaskSlot(runtime, config, machineKey, registration, flags, deps, handlerModule, retryState, heartbeatIntervalMs))
1546
1551
  )
@@ -1562,7 +1567,11 @@ export async function startRuntimeDaemon(flags = {}, deps = {}) {
1562
1567
  const scanIntervalMs = Number(flag(flags, 'scan-interval', '60')) * 1000
1563
1568
  const taskIntervalMs = Number(flag(flags, 'task-interval', flag(flags, 'heartbeat-interval', '15'))) * 1000
1564
1569
  const projectRefreshIntervalMs = Number(flag(flags, 'project-refresh-interval', '1800')) * 1000
1565
- const maxConcurrent = Math.max(1, Number(flag(flags, 'concurrency', '1')) || 1)
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)
1566
1575
  const once = Boolean(flags.once)
1567
1576
  const handlerPath = flag(flags, 'handler')
1568
1577