@ouro.bot/cli 0.1.0-alpha.1079 → 0.1.0-alpha.1080

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 CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1080",
6
+ "changes": [
7
+ "Self-update restarts the daemon only when memory clears the floor plus the restart's headroom"
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1079",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1079",
2
+ "runtimeVersion": "0.1.0-alpha.1080",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -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.1079</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1080</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PIN_MAX_AGE_MS = void 0;
3
+ exports.RESTART_MEMORY_HEADROOM_BYTES = exports.PIN_MAX_AGE_MS = void 0;
4
4
  exports.runSelfUpdate = runSelfUpdate;
5
5
  const runtime_1 = require("../../nerves/runtime");
6
6
  const ouro_version_manager_1 = require("./ouro-version-manager");
@@ -25,6 +25,14 @@ const ouro_version_manager_1 = require("./ouro-version-manager");
25
25
  * version.
26
26
  */
27
27
  exports.PIN_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
28
+ /**
29
+ * Restarting the daemon briefly runs `ouro up` beside this pass and the daemon
30
+ * it replaces, so a restart needs this much above the memory floor to keep the
31
+ * floor while it runs.
32
+ */
33
+ exports.RESTART_MEMORY_HEADROOM_BYTES = 128 * 1024 * 1024;
34
+ const RESTART_MEMORY_WAIT_MS = 180_000;
35
+ const RESTART_MEMORY_POLL_MS = 10_000;
28
36
  function errorText(error) {
29
37
  return error instanceof Error ? error.message : String(error);
30
38
  }
@@ -202,6 +210,22 @@ async function runLocked(deps) {
202
210
  }
203
211
  // 4. Activate, then restart a running daemon on the new version.
204
212
  const daemonWasRunning = !deps.isDevMode() && await deps.isDaemonRunning();
213
+ if (daemonWasRunning && deps.memory) {
214
+ const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
215
+ let memory = deps.memory();
216
+ for (let polls = 0; memory && memory.availableBytes < memory.floorBytes + exports.RESTART_MEMORY_HEADROOM_BYTES && polls < RESTART_MEMORY_WAIT_MS / RESTART_MEMORY_POLL_MS; polls += 1) {
217
+ await sleep(RESTART_MEMORY_POLL_MS);
218
+ memory = deps.memory();
219
+ }
220
+ if (memory && memory.availableBytes < memory.floorBytes + exports.RESTART_MEMORY_HEADROOM_BYTES) {
221
+ const mb = (bytes) => Math.round(bytes / (1024 * 1024));
222
+ return finish("deferred", {
223
+ summary: `${latest} is installed, but MemAvailable stayed at ${mb(memory.availableBytes)} MB, under the ${mb(memory.floorBytes)} MB floor plus ${mb(exports.RESTART_MEMORY_HEADROOM_BYTES)} MB for the restart; staying on ${currentVersion} and trying again next pass`,
224
+ latestVersion: latest,
225
+ source: installSource,
226
+ });
227
+ }
228
+ }
205
229
  deps.writeIntent({ schemaVersion: 1, mode: "latest", targetVersion: latest });
206
230
  deps.activate(latest);
207
231
  if (daemonWasRunning) {
@@ -113,6 +113,9 @@ function formatUpdateStatusLine(state, options) {
113
113
  case "pinned":
114
114
  line = `Updates: pinned to ${version} (checked ${age}; ${state.detail ?? "pin honored"})`;
115
115
  break;
116
+ case "deferred":
117
+ line = `Updates: ${state.latestVersion ?? "a new version"} waits for memory, staying on ${version} (checked ${age}; ${state.detail ?? "deferred"})`;
118
+ break;
116
119
  default:
117
120
  line = `Updates: needs attention: ${state.outcome} ${age} on ${version}${state.latestVersion ? ` (latest ${state.latestVersion})` : ""}: ${state.detail ?? "no detail"}`;
118
121
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1079",
3
+ "version": "0.1.0-alpha.1080",
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.1079",
9
+ "version": "0.1.0-alpha.1080",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1079",
3
+ "version": "0.1.0-alpha.1080",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },