benignswarm 0.12.108 → 0.12.109

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.
@@ -190,7 +190,10 @@ export async function machineAdmin(action, rest, p, out) {
190
190
  }
191
191
  catch { /* A machine without a live sample still uses its last stable report. */ }
192
192
  const rep = liveReport ?? m.report ?? {};
193
+ const pressureText = (pressure) => `some ${pressure?.some_avg10 ?? "unknown"}% / full ${pressure?.full_avg10 ?? "unknown"}% (10s avg)`;
194
+ const agentPressure = rep.agent_cgroup_pressure;
193
195
  const head = [
196
+ ...[['I/O', 'io_pressure'], ['Memory', 'memory_pressure'], ['CPU', 'cpu_pressure']].map(([label, key]) => ` ${label} PSI host: ${pressureText(rep[key])}; agents: ${agentPressure?.status === "available" ? `${pressureText(agentPressure[key])} (${agentPressure.source})` : `${agentPressure?.status ?? "unknown"}; host PSI used when available`}${liveReport ? "" : "; live sample unavailable"}`),
194
197
  `${m.name}: last report ${m.last_report_at ?? "never"}; labels ${(m.labels ?? []).join(", ") || "(none)"}; slots ${m.slots ?? "auto"}; writable ${(m.writable ?? []).join(", ") || "-"}; workdir ${rep.workdir ?? m.workdir ?? "~/bschat"}${rep.workdir_free_bytes ? ` (${Math.round(rep.workdir_free_bytes / 1e9)} GB free)` : ""}; cache budget ${m.cache_budget_gb ?? 40} GB (floor ${m.cache_floor_pct ?? 15}%)`,
195
198
  rep.os ? ` ${rep.os}/${rep.arch} ${rep.hostname} as ${rep.user}; ${rep.cpus ?? "?"} CPUs, ${rep.mem_total_bytes ? `${Math.round(rep.mem_total_bytes / 1024 ** 3)} GB RAM` : "? RAM"}; b9s ${rep.bschat?.version}; codex ${rep.codex ? `${rep.codex.version}, ${rep.codex.logged_in ? "logged in" : "NOT logged in"}, sandbox ${rep.codex.sandbox ? (rep.codex.sandbox.ok ? "ok" : `FAILS (${rep.codex.sandbox.error})`) : "?"}` : "missing"}; hooks ${rep.managed_hooks ? "managed by policy" : "user-level"}; linger ${rep.linger ?? "n/a"}; disk free ${rep.disk_free_bytes ? `${Math.round(rep.disk_free_bytes / 1e9)} GB` : "?"}` : " (no report yet: is its daemon running?)",
196
199
  rep.os ? ` Antigravity: ${rep.antigravity ? `${rep.antigravity.version ?? "agy"}, ${rep.antigravity.available ? "available" : "unavailable"}, ${rep.antigravity.logged_in ? "logged in" : "not logged in"}, sandbox ${rep.antigravity.sandbox ? (rep.antigravity.sandbox.ok ? "ok" : `FAILS (${rep.antigravity.sandbox.error})`) : "not checked"}` : "not installed"}` : null,
@@ -115,6 +115,18 @@ export function machineResourceTelemetry(hostPlatform, readText, pageSizeBytes,
115
115
  const memoryPressure = pressure("memory");
116
116
  const cpuPressure = pressure("cpu");
117
117
  const ioPressure = pressure("io");
118
+ const cgroupText = linux ? readText("/proc/self/cgroup") : null;
119
+ const unifiedPath = /^0::(\/[^\n\r]*)$/m.exec(cgroupText ?? "")?.[1];
120
+ const legacyCgroup = !!cgroupText && !unifiedPath && /^\d+:[^:\n]+:/m.test(cgroupText);
121
+ const components = unifiedPath?.split("/").filter(Boolean) ?? [];
122
+ const appSlice = components.indexOf("app.slice");
123
+ const userSlice = /^user-(\d+)\.slice$/.exec(components[1] ?? "");
124
+ const userService = /^user@(\d+)\.service$/.exec(components[2] ?? "");
125
+ const safePath = appSlice === 3 && components[0] === "user.slice" && !!userSlice && !!userService && userSlice[1] === userService[1]
126
+ ? "/" + components.slice(0, appSlice + 1).join("/") : null;
127
+ const groupPressure = (kind) => safePath ? parsePressureStall(readText(`/sys/fs/cgroup${safePath}/${kind}.pressure`) ?? "") : null;
128
+ const groupMemory = groupPressure("memory"), groupCpu = groupPressure("cpu"), groupIo = groupPressure("io");
129
+ const groupAvailable = [groupMemory, groupCpu, groupIo].every((value) => value?.some?.avg10 != null) && groupIo?.full?.avg10 != null && groupMemory?.full?.avg10 != null;
118
130
  const swapTotal = linuxMemory?.swap_total_bytes ?? macSwap?.total_bytes ?? null;
119
131
  const swapUsed = linuxMemory?.swap_used_bytes ?? macSwap?.used_bytes ?? null;
120
132
  const swapAvailable = swapTotal !== null && swapUsed !== null;
@@ -139,6 +151,13 @@ export function machineResourceTelemetry(hostPlatform, readText, pageSizeBytes,
139
151
  memory_pressure: flattenPressure(memoryPressure),
140
152
  cpu_pressure: flattenPressure(cpuPressure),
141
153
  io_pressure: flattenPressure(ioPressure),
154
+ agent_cgroup_pressure: {
155
+ source: safePath,
156
+ status: !linux || legacyCgroup ? "unsupported" : groupAvailable ? "available" : "unavailable",
157
+ memory_pressure: flattenPressure(groupMemory),
158
+ cpu_pressure: flattenPressure(groupCpu),
159
+ io_pressure: flattenPressure(groupIo),
160
+ },
142
161
  metric_availability: {
143
162
  memory: linux ? (typeof linuxMemory?.total_bytes === "number" && typeof linuxMemory?.available_bytes === "number" ? "available" : "unavailable") : darwin ? (typeof macMemory?.available_bytes === "number" ? "available" : "unavailable") : "unsupported",
144
163
  ...(darwin ? { memory_source: "vm_stat_reclaimable_pages" } : {}),
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.108";
1
+ export const CLI_VERSION = "0.12.109";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.108",
3
+ "version": "0.12.109",
4
4
  "description": "b9s: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {