@ouro.bot/cli 0.1.0-alpha.1524 → 0.1.0-alpha.1525
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/changelog.json +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/context-loss-sentinel.js +9 -3
- package/dist/heart/daemon/daemon-entry.js +1 -0
- package/dist/heart/daemon/health-monitor.js +34 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1525",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Disk space is critical in daemon health only when under 5 GB is free; a high percent with room left is a warning, and every disk message says how much is free. A blocked context-loss Sentinel receipt now names the signals that blocked it instead of saying \"deterministic recovery failed\"."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1524",
|
|
6
12
|
"changes": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0"?>
|
|
2
2
|
<Container version="2">
|
|
3
3
|
<Name>ouro-butler</Name>
|
|
4
|
-
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1525</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -826,12 +826,18 @@ function sentinelVerdict(signals) {
|
|
|
826
826
|
return "watch";
|
|
827
827
|
return "ready";
|
|
828
828
|
}
|
|
829
|
-
|
|
829
|
+
// A blocked receipt names what blocked it: a daemon health check (a full disk, a down sense) blocks too, and
|
|
830
|
+
// "deterministic recovery failed" sent operators looking for a recovery failure that never happened.
|
|
831
|
+
function summaryForVerdict(verdict, signals) {
|
|
830
832
|
if (verdict === "ready")
|
|
831
833
|
return "ready: deterministic recovery state is current and last-known-good is safe";
|
|
832
834
|
if (verdict === "watch")
|
|
833
835
|
return "watch: deterministic recovery can continue, but one or more signals need attention";
|
|
834
|
-
|
|
836
|
+
const blockers = signals
|
|
837
|
+
.filter((entry) => entry.verdictImpact === "blocked")
|
|
838
|
+
.map((entry) => `${entry.id} (${entry.summary})`)
|
|
839
|
+
.join("; ");
|
|
840
|
+
return `blocked by ${blockers}; repair it or continue from latest-ready`;
|
|
835
841
|
}
|
|
836
842
|
function gauntletSummary(report) {
|
|
837
843
|
return {
|
|
@@ -945,7 +951,7 @@ function makeReceipt(agentName, agentRoot, options, generatedAt) {
|
|
|
945
951
|
trigger: options.trigger,
|
|
946
952
|
generatedAt,
|
|
947
953
|
verdict,
|
|
948
|
-
summary: summaryForVerdict(verdict),
|
|
954
|
+
summary: summaryForVerdict(verdict, signals),
|
|
949
955
|
receiptLocator: receiptLocator(receiptId),
|
|
950
956
|
latestReadyLocator: readyLocator,
|
|
951
957
|
recoveryAnchor: anchorFromResume(recoverySource.anchorKind, recoverySource.resume),
|
|
@@ -410,6 +410,7 @@ const healthMonitor = new health_monitor_1.HealthMonitor({
|
|
|
410
410
|
processManager,
|
|
411
411
|
scheduler,
|
|
412
412
|
diskUsagePercent: () => (0, health_monitor_1.readDiskUsagePercent)((0, identity_1.getAgentBundlesRoot)()),
|
|
413
|
+
diskFreeBytes: () => (0, health_monitor_1.readDiskFreeBytes)((0, identity_1.getAgentBundlesRoot)()),
|
|
413
414
|
sentinelChecker: async (resultsSoFar) => {
|
|
414
415
|
const sentinels = await Promise.all(managedAgents.map((agent) => refreshDaemonSentinel(agent, "daemon_health", resultsSoFar)));
|
|
415
416
|
// Each agent runs on one machine: stop any agent whose lease (on disk or
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.HealthMonitor = void 0;
|
|
37
37
|
exports.readDiskUsagePercent = readDiskUsagePercent;
|
|
38
|
+
exports.readDiskFreeBytes = readDiskFreeBytes;
|
|
38
39
|
const fs = __importStar(require("fs"));
|
|
39
40
|
const runtime_1 = require("../../nerves/runtime");
|
|
40
41
|
/** Percent of the volume holding `dir` that is in use, as `df` reports it, or null when it can't be read. */
|
|
@@ -49,11 +50,29 @@ function readDiskUsagePercent(dir, statfs = fs.statfsSync) {
|
|
|
49
50
|
return null;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
/** Bytes available to this user on the volume holding `dir`, or null when it can't be read. */
|
|
54
|
+
function readDiskFreeBytes(dir, statfs = fs.statfsSync) {
|
|
55
|
+
try {
|
|
56
|
+
const { bavail, bsize } = statfs(dir);
|
|
57
|
+
if (!(bavail >= 0) || !(bsize > 0))
|
|
58
|
+
return null;
|
|
59
|
+
return bavail * bsize;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Under this much free space, writes (sessions, the Sentinel's own receipts) are at real risk.
|
|
66
|
+
const DISK_CRITICAL_FREE_BYTES = 5_000_000_000;
|
|
67
|
+
function gigabytes(bytes) {
|
|
68
|
+
return `${(bytes / 1_000_000_000).toFixed(1)} GB`;
|
|
69
|
+
}
|
|
52
70
|
class HealthMonitor {
|
|
53
71
|
processManager;
|
|
54
72
|
scheduler;
|
|
55
73
|
alertSink;
|
|
56
74
|
diskUsagePercent;
|
|
75
|
+
diskFreeBytes;
|
|
57
76
|
sentinelChecker;
|
|
58
77
|
bundleSyncChecker;
|
|
59
78
|
onCriticalAgent;
|
|
@@ -67,6 +86,7 @@ class HealthMonitor {
|
|
|
67
86
|
this.scheduler = options.scheduler;
|
|
68
87
|
this.alertSink = options.alertSink ?? (() => undefined);
|
|
69
88
|
this.diskUsagePercent = options.diskUsagePercent ?? (() => 0);
|
|
89
|
+
this.diskFreeBytes = options.diskFreeBytes ?? (() => null);
|
|
70
90
|
this.sentinelChecker = options.sentinelChecker ?? (() => []);
|
|
71
91
|
this.bundleSyncChecker = options.bundleSyncChecker ?? (() => []);
|
|
72
92
|
this.onCriticalAgent = options.onCriticalAgent ?? (() => undefined);
|
|
@@ -176,7 +196,20 @@ class HealthMonitor {
|
|
|
176
196
|
results.push({ name: "cron-health", status: "ok", message: `cron jobs are healthy${firstRunSuffix}` });
|
|
177
197
|
}
|
|
178
198
|
const diskPercent = this.diskUsagePercent();
|
|
179
|
-
|
|
199
|
+
const diskFree = this.diskFreeBytes();
|
|
200
|
+
// 91% of a 460 GB disk is 42 GB free: high, not critical. Judge by what is left when it can be read.
|
|
201
|
+
if (diskPercent !== null && diskFree !== null) {
|
|
202
|
+
if (diskFree < DISK_CRITICAL_FREE_BYTES) {
|
|
203
|
+
results.push({ name: "disk-space", status: "critical", message: `disk space critical (${gigabytes(diskFree)} free, ${diskPercent}% used)` });
|
|
204
|
+
}
|
|
205
|
+
else if (diskPercent >= 80) {
|
|
206
|
+
results.push({ name: "disk-space", status: "warn", message: `disk usage high (${diskPercent}%, ${gigabytes(diskFree)} free)` });
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
results.push({ name: "disk-space", status: "ok", message: `disk usage healthy (${diskPercent}%, ${gigabytes(diskFree)} free)` });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else if (diskPercent === null) {
|
|
180
213
|
results.push({
|
|
181
214
|
name: "disk-space",
|
|
182
215
|
status: "warn",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1525",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1525",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1525",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|