@ouro.bot/cli 0.1.0-alpha.1000 → 0.1.0-alpha.1001

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.1001",
6
+ "changes": [
7
+ "A starting daemon refuses to start, before it updates or signals anything, while another daemon still answers on its socket, so a second daemon can no longer kill a live one. On Linux, ouro up and the daemon refuse a FAT or exFAT ouro home with a clear message."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1000",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1000",
2
+ "runtimeVersion": "0.1.0-alpha.1001",
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.1000</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1001</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -73,6 +73,7 @@ const update_state_1 = require("../versioning/update-state");
73
73
  const logs_prune_1 = require("./logs-prune");
74
74
  const daemon_health_1 = require("./daemon-health");
75
75
  const log_tailer_1 = require("./log-tailer");
76
+ const home_filesystem_1 = require("./home-filesystem");
76
77
  const launchd_1 = require("./launchd");
77
78
  const linux_service_1 = require("./linux-service");
78
79
  const socket_client_1 = require("./socket-client");
@@ -797,6 +798,7 @@ function createDefaultOuroCliDeps(socketPath = socket_client_1.DEFAULT_DAEMON_SO
797
798
  isTTY: process.stdout.isTTY === true,
798
799
  checkSocketAlive: socket_client_1.checkDaemonSocketAlive,
799
800
  cleanupStaleSocket: defaultCleanupStaleSocket,
801
+ checkHomeFilesystem: () => (0, home_filesystem_1.unsupportedHomeFilesystem)((0, ouro_version_manager_1.getOuroCliHome)()),
800
802
  fallbackPendingMessage: defaultFallbackPendingMessage,
801
803
  tailLogs: (options) => (0, log_tailer_1.tailLogs)(options),
802
804
  healthFilePath: (0, daemon_health_1.getDefaultHealthPath)(),
@@ -7048,6 +7048,14 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
7048
7048
  autoRender: true,
7049
7049
  });
7050
7050
  const daemonAliveAtBootStart = await deps.checkSocketAlive(deps.socketPath);
7051
+ if (!daemonAliveAtBootStart) {
7052
+ const homeFilesystemProblem = deps.checkHomeFilesystem?.() ?? null;
7053
+ if (homeFilesystemProblem) {
7054
+ deps.writeStdout(homeFilesystemProblem);
7055
+ return homeFilesystemProblem;
7056
+ }
7057
+ }
7058
+ ;
7051
7059
  progress.setPhasePlan?.(bootPhasePlan(daemonAliveAtBootStart));
7052
7060
  // ── versioned CLI update check ──
7053
7061
  const versionIntent = deps.readVersionIntent?.() ?? null;
@@ -66,6 +66,8 @@ const daemon_tombstone_1 = require("./daemon-tombstone");
66
66
  const agent_config_check_1 = require("./agent-config-check");
67
67
  const pulse_1 = require("./pulse");
68
68
  const socket_client_1 = require("./socket-client");
69
+ const home_filesystem_1 = require("./home-filesystem");
70
+ const ouro_version_manager_1 = require("../versioning/ouro-version-manager");
69
71
  const await_private_wake_1 = require("./await-private-wake");
70
72
  const habit_private_wake_1 = require("./habit-private-wake");
71
73
  const habit_policy_1 = require("../../rsvp/habit-policy");
@@ -97,6 +99,13 @@ function parseSocketPath(argv) {
97
99
  }
98
100
  const socketPath = parseSocketPath(process.argv);
99
101
  (0, runtime_logging_1.configureDaemonRuntimeLogger)("daemon");
102
+ /* v8 ignore start -- refuses to start on a FAT or exFAT home; the check is unit-tested in home-filesystem.test.ts @preserve */
103
+ const homeFilesystemProblem = (0, home_filesystem_1.unsupportedHomeFilesystem)((0, ouro_version_manager_1.getOuroCliHome)());
104
+ if (homeFilesystemProblem) {
105
+ process.stderr.write(`${homeFilesystemProblem}\n`);
106
+ process.exit(1);
107
+ }
108
+ /* v8 ignore stop */
100
109
  const entryPath = path.resolve(__dirname, "daemon-entry.js");
101
110
  const mode = (0, runtime_mode_1.detectRuntimeMode)((0, identity_1.getRepoRoot)());
102
111
  // Each agent runs on exactly one machine: manage only agents homed here
@@ -646,6 +646,7 @@ class OuroDaemon {
646
646
  schedulerFireVerifier;
647
647
  schedulerFireConsumer;
648
648
  orphanStartupDrain;
649
+ socketAnswering;
649
650
  externalEventSourceReadiness;
650
651
  constructor(options) {
651
652
  this.socketPath = options.socketPath;
@@ -679,6 +680,7 @@ class OuroDaemon {
679
680
  this.schedulerFireVerifier = options.schedulerFireVerifier;
680
681
  this.schedulerFireConsumer = options.schedulerFireConsumer;
681
682
  this.orphanStartupDrain = options.orphanStartupDrain ?? drainOrphanProcessesBeforeStartup;
683
+ this.socketAnswering = options.socketAnswering ?? socket_client_1.checkDaemonSocketAlive;
682
684
  this.externalEventSourceReadiness = options.externalEventSourceReadiness ?? (async (agent, source) => {
683
685
  const { ensureSanctuarySourceRuntimeReady } = await Promise.resolve().then(() => __importStar(require("../../senses/sanctuary-runtime")));
684
686
  await ensureSanctuarySourceRuntimeReady(agent, source);
@@ -805,6 +807,19 @@ class OuroDaemon {
805
807
  }
806
808
  }
807
809
  async startInner() {
810
+ // A replacement always stops the old daemon first (ouro up, launchd bootout,
811
+ // staged restart). A daemon that still answers is live, not orphaned: never
812
+ // kill its processes or unlink its socket, whatever HOME this one runs under.
813
+ if (await this.socketAnswering(this.socketPath)) {
814
+ (0, runtime_1.emitNervesEvent)({
815
+ level: "error",
816
+ component: "daemon",
817
+ event: "daemon.socket_already_served",
818
+ message: "another daemon already answers on this socket; refusing to start",
819
+ meta: { socketPath: this.socketPath },
820
+ });
821
+ throw new Error(`another daemon already answers on ${this.socketPath}; stop it with ouro stop, or start this one with its own --socket`);
822
+ }
808
823
  const containerPolicy = (0, container_runtime_1.readContainerRuntimePolicy)();
809
824
  // Register update hooks and apply pending updates before starting agents
810
825
  (0, update_hooks_1.registerUpdateHook)(bundle_meta_1.bundleMetaHook);
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.unsupportedHomeFilesystem = unsupportedHomeFilesystem;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const runtime_1 = require("../../nerves/runtime");
40
+ /**
41
+ * Linux `statfs` magic numbers for filesystems that cannot hold `~/.ouro-cli`:
42
+ * no Unix sockets (the daemon's `listen` fails with EPERM), no symlinks (the
43
+ * `CurrentVersion` switch needs them) and no POSIX modes (a 0600 secret file
44
+ * is world-readable). Removable media and appliance data partitions often use them.
45
+ */
46
+ const UNSUPPORTED_LINUX_FILESYSTEMS = new Map([
47
+ [0x4d44, "FAT"],
48
+ [0x2011bab0, "exFAT"],
49
+ ]);
50
+ const defaultDeps = {
51
+ platform: process.platform,
52
+ statfsType: (dir) => fs.statfsSync(dir).type,
53
+ exists: (dir) => fs.existsSync(dir),
54
+ };
55
+ function nearestExistingDir(dir, exists) {
56
+ let current = path.resolve(dir);
57
+ while (!exists(current)) {
58
+ const parent = path.dirname(current);
59
+ if (parent === current)
60
+ break;
61
+ current = parent;
62
+ }
63
+ return current;
64
+ }
65
+ /**
66
+ * Returns a message when `ouroCliHome` (or, before it exists, its nearest
67
+ * existing parent) sits on a filesystem the runtime cannot use, and null
68
+ * otherwise. Read-only: it never writes to the directory it checks.
69
+ */
70
+ function unsupportedHomeFilesystem(ouroCliHome, deps = defaultDeps) {
71
+ if (deps.platform !== "linux")
72
+ return null;
73
+ const checkedDir = nearestExistingDir(ouroCliHome, deps.exists);
74
+ let type;
75
+ try {
76
+ type = deps.statfsType(checkedDir);
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ const filesystem = UNSUPPORTED_LINUX_FILESYSTEMS.get(type);
82
+ if (!filesystem)
83
+ return null;
84
+ const message = `${ouroCliHome} is on ${filesystem}, which has no Unix sockets, symlinks or file permissions. Set HOME to a directory on ext4 or another POSIX filesystem, then run ouro up again.`;
85
+ (0, runtime_1.emitNervesEvent)({
86
+ level: "error",
87
+ component: "daemon",
88
+ event: "daemon.home_filesystem_unsupported",
89
+ message: "the ouro home is on a filesystem the runtime cannot use",
90
+ meta: { ouroCliHome, checkedDir, filesystem },
91
+ });
92
+ return message;
93
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1000",
3
+ "version": "0.1.0-alpha.1001",
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.1000",
9
+ "version": "0.1.0-alpha.1001",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@azure/identity": "^4.13.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1000",
3
+ "version": "0.1.0-alpha.1001",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },