@ouro.bot/cli 0.1.0-alpha.1497 → 0.1.0-alpha.1499

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,18 @@
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.1499",
6
+ "changes": [
7
+ "Update the Ouro UI files to Ouro UI v1.3.502."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1498",
12
+ "changes": [
13
+ "The daemon now checks every hour that launchd still has the unattended updater, and loads its plist again if launchd has lost it. A run whose HOME isn't the account's own home (a test's throwaway HOME) no longer touches the machine-wide `bot.ouro.updater` label."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1497",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1497",
2
+ "runtimeVersion": "0.1.0-alpha.1499",
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.1497</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1499</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -613,9 +613,17 @@ function defaultSelfUpdateLauncher() {
613
613
  return null;
614
614
  return async () => (await Promise.resolve().then(() => __importStar(require("../versioning/self-update-defaults")))).launchUnattendedSelfUpdate();
615
615
  }
616
+ // macOS only, and never under a test runner: a test daemon must not load launch agents on the host.
617
+ function defaultUpdaterAgentWatch() {
618
+ if (process.platform !== "darwin" || process.env.VITEST)
619
+ return null;
620
+ return async () => (await Promise.resolve().then(() => __importStar(require("../versioning/self-update-defaults")))).restoreDefaultUpdaterAgentIfMissing();
621
+ }
616
622
  /* v8 ignore stop */
617
623
  const STATE_RETENTION_FIRST_DELAY_MS = 10 * 60_000;
618
624
  const STATE_RETENTION_INTERVAL_MS = 24 * 60 * 60_000;
625
+ const UPDATER_AGENT_WATCH_FIRST_DELAY_MS = 5 * 60_000;
626
+ const UPDATER_AGENT_WATCH_INTERVAL_MS = 60 * 60_000;
619
627
  class OuroDaemon {
620
628
  socketPath;
621
629
  processManager;
@@ -632,6 +640,8 @@ class OuroDaemon {
632
640
  externalEventReconcileTimer = null;
633
641
  stateRetentionTimer = null;
634
642
  stateRetention;
643
+ updaterAgentWatchTimer = null;
644
+ updaterAgentWatch;
635
645
  externalEventReconcileRunning = false;
636
646
  constructedAtMs = Date.now();
637
647
  frontendSocketPath;
@@ -692,6 +702,7 @@ class OuroDaemon {
692
702
  // Only agents homed here: another machine's daemon looks after its own agents' state.
693
703
  agents: (0, agent_discovery_1.listHomeBundleAgents)({ bundlesRoot: this.bundlesRoot }),
694
704
  }));
705
+ this.updaterAgentWatch = options.updaterAgentWatch !== undefined ? options.updaterAgentWatch : defaultUpdaterAgentWatch();
695
706
  this.socketAnswering = options.socketAnswering ?? socket_client_1.checkDaemonSocketAlive;
696
707
  this.selfUpdateLauncher = options.selfUpdateLauncher !== undefined ? options.selfUpdateLauncher : defaultSelfUpdateLauncher();
697
708
  this.externalEventSourceReadiness = options.externalEventSourceReadiness ?? (async (agent, source) => {
@@ -861,6 +872,7 @@ class OuroDaemon {
861
872
  }, 1_000);
862
873
  this.externalEventReconcileTimer.unref?.();
863
874
  this.scheduleStateRetention(STATE_RETENTION_FIRST_DELAY_MS);
875
+ this.scheduleUpdaterAgentWatch(UPDATER_AGENT_WATCH_FIRST_DELAY_MS);
864
876
  // Write all managed PIDs to disk so the next daemon can clean up
865
877
  /* v8 ignore start -- pidfile write: collects PIDs from process managers @preserve */
866
878
  const agentPids = this.processManager.listAgentSnapshots().map((s) => s.pid).filter((p) => p !== null);
@@ -887,6 +899,19 @@ class OuroDaemon {
887
899
  });
888
900
  }
889
901
  }
902
+ // The updater has dropped out of launchd after good bootstraps; nothing reloaded it until a hand-run `ouro up`.
903
+ scheduleUpdaterAgentWatch(delayMs) {
904
+ const watch = this.updaterAgentWatch;
905
+ if (!watch)
906
+ return;
907
+ this.updaterAgentWatchTimer = setTimeout(() => {
908
+ void watch().catch(() => undefined).finally(() => {
909
+ if (this.updaterAgentWatchTimer)
910
+ this.scheduleUpdaterAgentWatch(UPDATER_AGENT_WATCH_INTERVAL_MS);
911
+ });
912
+ }, delayMs);
913
+ this.updaterAgentWatchTimer.unref?.();
914
+ }
890
915
  // Waits after start so a restart isn't slowed by it; a failed pass is logged by retention and tried again tomorrow.
891
916
  scheduleStateRetention(delayMs) {
892
917
  this.stateRetentionTimer = setTimeout(() => {
@@ -1186,6 +1211,10 @@ class OuroDaemon {
1186
1211
  clearTimeout(this.stateRetentionTimer);
1187
1212
  this.stateRetentionTimer = null;
1188
1213
  }
1214
+ if (this.updaterAgentWatchTimer) {
1215
+ clearTimeout(this.updaterAgentWatchTimer);
1216
+ this.updaterAgentWatchTimer = null;
1217
+ }
1189
1218
  const workerStopTasks = [
1190
1219
  Promise.resolve().then(() => this.processManager.stopAll()),
1191
1220
  Promise.resolve().then(() => (0, mcp_manager_1.shutdownSharedMcpManager)()),
@@ -38,6 +38,7 @@ exports.isSelfUpdateLockHeld = isSelfUpdateLockHeld;
38
38
  exports.createDefaultSelfUpdateDeps = createDefaultSelfUpdateDeps;
39
39
  exports.launchUnattendedSelfUpdate = launchUnattendedSelfUpdate;
40
40
  exports.ensureDefaultUpdaterAgent = ensureDefaultUpdaterAgent;
41
+ exports.restoreDefaultUpdaterAgentIfMissing = restoreDefaultUpdaterAgentIfMissing;
41
42
  exports.isDefaultUpdaterAgentInstalled = isDefaultUpdaterAgentInstalled;
42
43
  /* v8 ignore start -- production wiring for self-update: real network, npm, launchd and daemon socket; the logic it feeds is unit-tested through injected deps @preserve */
43
44
  const child_process_1 = require("child_process");
@@ -385,6 +386,9 @@ function ensureDefaultUpdaterAgent(options = {}) {
385
386
  if (process.platform !== "darwin" || process.env.OURO_SELF_UPDATE_E2E === "1")
386
387
  return null;
387
388
  const homeDir = options.homeDir ?? os.homedir();
389
+ // A throwaway HOME (integration tests, synthetic bundles) must never touch the machine-wide label.
390
+ if (!(0, updater_launchd_1.isHostUserHome)(homeDir, os.userInfo().homedir))
391
+ return null;
388
392
  const result = (0, updater_launchd_1.ensureUpdaterAgent)({
389
393
  homeDir,
390
394
  userUid: os.userInfo().uid,
@@ -415,6 +419,21 @@ function ensureDefaultUpdaterAgent(options = {}) {
415
419
  });
416
420
  return result;
417
421
  }
422
+ /** The daemon's hourly check that launchd still has the updater; see restoreUpdaterAgentIfMissing. */
423
+ function restoreDefaultUpdaterAgentIfMissing(options = {}) {
424
+ if (process.platform !== "darwin" || process.env.OURO_SELF_UPDATE_E2E === "1")
425
+ return null;
426
+ const homeDir = options.homeDir ?? os.homedir();
427
+ if (!(0, updater_launchd_1.isHostUserHome)(homeDir, os.userInfo().homedir))
428
+ return null;
429
+ return (0, updater_launchd_1.restoreUpdaterAgentIfMissing)({
430
+ homeDir,
431
+ userUid: os.userInfo().uid,
432
+ fileExists: (filePath) => fs.existsSync(filePath),
433
+ exec: (command) => { require("child_process").execSync(command, { stdio: "ignore", timeout: 10_000 }); },
434
+ updateInProgress: () => isSelfUpdateLockHeld((0, ouro_version_manager_1.getOuroCliHome)(homeDir)),
435
+ });
436
+ }
418
437
  function isDefaultUpdaterAgentInstalled(options = {}) {
419
438
  if (process.platform !== "darwin")
420
439
  return null;
@@ -38,6 +38,8 @@ exports.chooseUpdaterNodePath = chooseUpdaterNodePath;
38
38
  exports.updaterPlistPath = updaterPlistPath;
39
39
  exports.generateUpdaterPlist = generateUpdaterPlist;
40
40
  exports.ensureUpdaterAgent = ensureUpdaterAgent;
41
+ exports.restoreUpdaterAgentIfMissing = restoreUpdaterAgentIfMissing;
42
+ exports.isHostUserHome = isHostUserHome;
41
43
  const path = __importStar(require("path"));
42
44
  const runtime_1 = require("../../nerves/runtime");
43
45
  const update_state_1 = require("./update-state");
@@ -148,3 +150,55 @@ function ensureUpdaterAgent(deps) {
148
150
  });
149
151
  return "installed";
150
152
  }
153
+ /**
154
+ * Put the updater back when launchd has lost it. The job has dropped out of
155
+ * launchd after a successful bootstrap more than once (2026-11-23, twice), and
156
+ * nothing then reloads it until someone runs `ouro up` by hand, so releases
157
+ * stop reaching the machine. This only bootstraps the plist already on disk,
158
+ * unchanged; it never boots anything out and never rewrites the file, so it
159
+ * cannot fight `ensureUpdaterAgent` or kill a pass in progress.
160
+ */
161
+ function restoreUpdaterAgentIfMissing(deps) {
162
+ const domain = `gui/${deps.userUid}`;
163
+ try {
164
+ deps.exec(`launchctl print ${domain}/${exports.UPDATER_PLIST_LABEL}`);
165
+ return "loaded";
166
+ }
167
+ catch {
168
+ // Not loaded: fall through.
169
+ }
170
+ const plistPath = updaterPlistPath(deps.homeDir);
171
+ if (!deps.fileExists(plistPath))
172
+ return "no-plist";
173
+ if (deps.updateInProgress())
174
+ return "update-in-progress";
175
+ let result = "restored";
176
+ try {
177
+ deps.exec(`launchctl bootstrap ${domain} "${plistPath}"`);
178
+ }
179
+ catch {
180
+ result = "restore-failed";
181
+ }
182
+ (0, runtime_1.emitNervesEvent)({
183
+ level: result === "restored" ? "warn" : "error",
184
+ component: "daemon",
185
+ event: "daemon.self_update_agent_restored",
186
+ message: result === "restored"
187
+ ? "the unattended updater had dropped out of launchd; loaded it again"
188
+ : "the unattended updater had dropped out of launchd and loading it again failed",
189
+ meta: { result },
190
+ });
191
+ return result;
192
+ }
193
+ /**
194
+ * True when `homeDir` is this account's own home directory. A run with HOME
195
+ * pointed elsewhere (a test's throwaway HOME) must not touch the machine-wide
196
+ * `gui/<uid>/bot.ouro.updater` label: its plist lives in that throwaway HOME,
197
+ * so it would boot out the real updater and load one that points at a folder
198
+ * about to be deleted.
199
+ */
200
+ function isHostUserHome(homeDir, accountHome) {
201
+ if (!accountHome)
202
+ return false;
203
+ return path.resolve(homeDir) === path.resolve(accountHome);
204
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1497",
3
+ "version": "0.1.0-alpha.1499",
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.1497",
9
+ "version": "0.1.0-alpha.1499",
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.1497",
3
+ "version": "0.1.0-alpha.1499",
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": {