@ouro.bot/cli 0.1.0-alpha.1625 → 0.1.0-alpha.1626

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": "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.1626",
6
+ "changes": [
7
+ "The Butler's scheduler now follows the name its bundle has. Its cron proof, its health-check liveness receipt, its crontab and the daemon's package-managed start all work for a bundle named `butler.ouro` as well as `sanctuary.ouro`. A daemon that finds both bundles refuses to start rather than guess which one is the Butler."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1625",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1625",
2
+ "runtimeVersion": "0.1.0-alpha.1626",
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.1625</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1626</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BUTLER_AGENT_NAMES = void 0;
4
4
  exports.isButlerAgent = isButlerAgent;
5
+ exports.butlerContainerPaths = butlerContainerPaths;
6
+ exports.managedButlerAgent = managedButlerAgent;
5
7
  /**
6
8
  * The Butler's agent names: `butler`, and `sanctuary` from before the rename (M2). Every check that picks Butler behaviour
7
9
  * asks this, so an install runs the same whichever name its bundle has.
@@ -11,3 +13,22 @@ exports.BUTLER_AGENT_NAMES = ["butler", "sanctuary"];
11
13
  function isButlerAgent(agentName) {
12
14
  return typeof agentName === "string" && exports.BUTLER_AGENT_NAMES.includes(agentName);
13
15
  }
16
+ function butlerContainerPaths(name) {
17
+ const agentRoot = `/home/ouro/AgentBundles/${name}.ouro`;
18
+ const habitNamespace = `habit:${name}`;
19
+ const healthJobId = `${name}:sanctuary-health`;
20
+ return {
21
+ agentRoot,
22
+ crontabPath: `/home/ouro/.ouro-cli/scheduler/${name}.crontab`,
23
+ habitNamespace,
24
+ healthJobId,
25
+ healthTaskPath: `${agentRoot}/habits/sanctuary-health.md`,
26
+ healthCommand: `/usr/local/bin/node /opt/ouro/dist/heart/daemon/ouro-entry.js poke ${name} --habit sanctuary-health --trigger cron`,
27
+ healthCronMarker: `# ouro:${habitNamespace}:${healthJobId}`,
28
+ };
29
+ }
30
+ /** The one Butler among the agents this daemon manages, or null when there is none or more than one. */
31
+ function managedButlerAgent(managedAgents) {
32
+ const butlers = managedAgents.filter(isButlerAgent);
33
+ return butlers.length === 1 ? butlers[0] : null;
34
+ }
@@ -123,6 +123,8 @@ const mode = (0, runtime_mode_1.detectRuntimeMode)((0, identity_1.getRepoRoot)()
123
123
  const daemonMachine = (0, machine_identity_1.loadOrCreateMachineIdentity)();
124
124
  const daemonMachineId = daemonMachine.machineId;
125
125
  const managedAgents = (0, agent_discovery_1.listHomeBundleAgents)({ machineId: daemonMachineId });
126
+ // The Butler under whichever name its bundle has; its container paths follow that name.
127
+ const butlerName = (0, butler_agent_1.managedButlerAgent)(managedAgents) ?? "sanctuary";
126
128
  const readinessAgents = (0, daemon_bootstrap_startup_1.providerReadinessAgents)(managedAgents, process.env.OURO_DAEMON_REQUIRED_AGENT);
127
129
  const sanctuaryPackageManagement = (0, sanctuary_package_management_1.resolveSanctuaryPackageManagementActivation)({ mode, argv: process.argv, managedAgents, repoRoot: (0, identity_1.getRepoRoot)(), bundlesRoot: (0, identity_1.getAgentBundlesRoot)(), runtimePackageVersion: (0, bundle_manifest_1.getPackageVersion)() });
128
130
  try {
@@ -356,7 +358,7 @@ const containerRuntimePolicy = (0, container_runtime_1.readContainerRuntimePolic
356
358
  const supercronicSupervisor = containerRuntimePolicy?.scheduler === "supercronic"
357
359
  ? new supercronic_supervisor_1.SupercronicSupervisor({
358
360
  binaryPath: "/usr/local/bin/supercronic",
359
- crontabPath: path.join((0, identity_1.getAgentBundlesRoot)(), "..", ".ouro-cli", "scheduler", "sanctuary.crontab"),
361
+ crontabPath: path.join((0, identity_1.getAgentBundlesRoot)(), "..", ".ouro-cli", "scheduler", `${butlerName}.crontab`),
360
362
  onFatal: (error) => {
361
363
  (0, runtime_1.emitNervesEvent)({ level: "error", component: "daemon", event: "daemon.supercronic_state", message: "Supercronic restart budget exhausted", meta: { error: error.message } });
362
364
  process.exit(1);
@@ -528,15 +530,15 @@ const daemon = new daemon_1.OuroDaemon({
528
530
  schedulerFireVerifier: (command) => {
529
531
  if (!supercronicSupervisor)
530
532
  throw new Error("Supercronic scheduler is unavailable");
531
- const marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)("sanctuary");
533
+ const marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)(butlerName);
532
534
  return (0, sanctuary_scheduler_origin_1.verifySanctuarySchedulerFireCommand)(command, {
533
- childPid: supercronicSupervisor.authenticatedSnapshot("habit:sanctuary").childPid,
534
- identityKey: (0, telegram_identity_key_1.readOrCreateTelegramIdentityKey)(path.join((0, identity_1.getAgentBundlesRoot)(), "sanctuary.ouro")),
535
+ childPid: supercronicSupervisor.authenticatedSnapshot(`habit:${butlerName}`).childPid,
536
+ identityKey: (0, telegram_identity_key_1.readOrCreateTelegramIdentityKey)(path.join((0, identity_1.getAgentBundlesRoot)(), `${butlerName}.ouro`)),
535
537
  scenarioHandleDigest: marker?.label === "unit-16f-cron-fingerprint" ? marker.scenarioHandleDigest : null, now: () => new Date(),
536
538
  readFile: (target) => fs.readFileSync(target, "utf8"), readLink: (target) => fs.readlinkSync(target),
537
539
  });
538
540
  },
539
- schedulerFireConsumer: (origin) => (0, sanctuary_scheduler_liveness_1.consumeSanctuarySchedulerFire)(path.join((0, identity_1.getAgentBundlesRoot)(), "sanctuary.ouro"), origin),
541
+ schedulerFireConsumer: (origin) => (0, sanctuary_scheduler_liveness_1.consumeSanctuarySchedulerFire)(path.join((0, identity_1.getAgentBundlesRoot)(), `${butlerName}.ouro`), origin),
540
542
  nativeHabitRunner: async ({ agent, habitName, trigger, occurrenceId, runnerId, schedulerOrigin }) => {
541
543
  if (!(0, butler_agent_1.isButlerAgent)(agent) || habitName !== "sanctuary-health")
542
544
  return null;
@@ -571,7 +573,7 @@ const daemon = new daemon_1.OuroDaemon({
571
573
  occurrenceId,
572
574
  runnerId,
573
575
  scenario: schedulerScenario,
574
- supervisor: supercronicSupervisor.authenticatedSnapshot("habit:sanctuary"),
576
+ supervisor: supercronicSupervisor.authenticatedSnapshot(`habit:${agent}`),
575
577
  before,
576
578
  providerInvocationCount,
577
579
  privateTurnCount,
@@ -39,12 +39,14 @@ exports.requireSanctuaryPackageManagementDecision = requireSanctuaryPackageManag
39
39
  exports.prepareSanctuaryPackageManagedBundle = prepareSanctuaryPackageManagedBundle;
40
40
  const path = __importStar(require("node:path"));
41
41
  const runtime_1 = require("../../nerves/runtime");
42
+ const butler_agent_1 = require("../butler-agent");
42
43
  const sanctuary_bundle_migration_1 = require("./sanctuary-bundle-migration");
43
44
  const daemon_bootstrap_startup_1 = require("./daemon-bootstrap-startup");
45
+ /** The packaged starter bundle stays at deploy/unraid/sanctuary.ouro; the live bundle is named for the agent (`butler` or `sanctuary`). */
44
46
  function resolveSanctuaryPackageManagedRoots(input) {
45
47
  return {
46
48
  packageRoot: path.join(input.repoRoot, "deploy", "unraid", "sanctuary.ouro"),
47
- agentRoot: path.join(input.bundlesRoot, "sanctuary.ouro"),
49
+ agentRoot: path.join(input.bundlesRoot, `${input.agent ?? "sanctuary"}.ouro`),
48
50
  };
49
51
  }
50
52
  function invalidDecision() {
@@ -59,14 +61,16 @@ function resolveSanctuaryPackageManagementActivation(input) {
59
61
  if (indices.length !== 1)
60
62
  return invalidDecision();
61
63
  const value = input.argv[indices[0] + 1];
62
- if (value !== "sanctuary" || input.managedAgents.length !== 1 || input.managedAgents[0] !== "sanctuary")
64
+ // The flag names the Butler; the one bundle this daemon manages says which name it has. Two Butler bundles never boot.
65
+ const agent = input.managedAgents.length === 1 ? (0, butler_agent_1.managedButlerAgent)(input.managedAgents) : null;
66
+ if (!(0, butler_agent_1.isButlerAgent)(value) || !agent)
63
67
  return invalidDecision();
64
68
  if (!path.isAbsolute(input.repoRoot) || !path.isAbsolute(input.bundlesRoot) || input.runtimePackageVersion.trim() !== input.runtimePackageVersion || input.runtimePackageVersion.length === 0)
65
69
  return invalidDecision();
66
- const roots = resolveSanctuaryPackageManagedRoots(input);
70
+ const roots = resolveSanctuaryPackageManagedRoots({ ...input, agent });
67
71
  try {
68
72
  const packageIdentity = (0, sanctuary_bundle_migration_1.inspectSanctuaryDirectoryFromBase)(input.repoRoot, ["deploy", "unraid", "sanctuary.ouro"]);
69
- const agentIdentity = (0, sanctuary_bundle_migration_1.inspectSanctuaryDirectoryFromBase)(input.bundlesRoot, ["sanctuary.ouro"]);
73
+ const agentIdentity = (0, sanctuary_bundle_migration_1.inspectSanctuaryDirectoryFromBase)(input.bundlesRoot, [`${agent}.ouro`]);
70
74
  if (!packageIdentity || !agentIdentity || (0, sanctuary_bundle_migration_1.sanctuaryDirectoriesShareIdentity)(packageIdentity, agentIdentity))
71
75
  return invalidDecision();
72
76
  }
@@ -44,10 +44,9 @@ const node_crypto_1 = require("node:crypto");
44
44
  const fs = __importStar(require("node:fs"));
45
45
  const path = __importStar(require("node:path"));
46
46
  const runtime_1 = require("../../nerves/runtime");
47
+ const butler_agent_1 = require("../butler-agent");
47
48
  const SHA256 = /^[0-9a-f]{64}$/u;
48
49
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
49
- const CRONTAB_PATH = "/home/ouro/.ouro-cli/scheduler/sanctuary.crontab";
50
- const COMMAND = "/usr/local/bin/node /opt/ouro/dist/heart/daemon/ouro-entry.js poke sanctuary --habit sanctuary-health --trigger cron";
51
50
  function readSanctuaryHealthCursor(agentRoot) {
52
51
  const state = JSON.parse(fs.readFileSync(path.join(agentRoot, "state", "health", "sanctuary-health.json"), "utf8"));
53
52
  if (!Array.isArray(state.sweepReceipts) || !Array.isArray(state.deliveredReceipts))
@@ -161,15 +160,20 @@ function verifySanctuarySchedulerLivenessReceiptMac(identityKey, value) {
161
160
  }
162
161
  function validateSupervisor(snapshot) {
163
162
  const manifest = snapshot.manifest;
163
+ // The Butler's paths all follow the name its bundle has; the manifest's job names it.
164
+ const agent = manifest[0]?.agent;
165
+ if (!(0, butler_agent_1.isButlerAgent)(agent))
166
+ throw new Error("Sanctuary scheduler supervisor attestation is invalid");
167
+ const paths = (0, butler_agent_1.butlerContainerPaths)(agent);
164
168
  if (snapshot.schemaVersion !== "supercronic-supervisor-snapshot-v1" || snapshot.daemonPid !== process.pid
165
169
  || snapshot.childCount !== 1 || snapshot.healthy !== true || !Number.isSafeInteger(snapshot.childPid) || snapshot.childPid <= 1
166
- || snapshot.binaryPath !== "/usr/local/bin/supercronic" || snapshot.crontabPath !== CRONTAB_PATH
167
- || JSON.stringify(snapshot.args) !== JSON.stringify(["-split-logs", "-inotify", CRONTAB_PATH])
168
- || snapshot.namespace !== "habit:sanctuary" || manifest.length !== 1
169
- || manifest[0]?.id !== "sanctuary:sanctuary-health" || manifest[0].agent !== "sanctuary"
170
+ || snapshot.binaryPath !== "/usr/local/bin/supercronic" || snapshot.crontabPath !== paths.crontabPath
171
+ || JSON.stringify(snapshot.args) !== JSON.stringify(["-split-logs", "-inotify", paths.crontabPath])
172
+ || snapshot.namespace !== paths.habitNamespace || manifest.length !== 1
173
+ || manifest[0].id !== paths.healthJobId
170
174
  || manifest[0].taskId !== "sanctuary-health" || manifest[0].schedule !== "*/15 * * * *"
171
- || manifest[0].taskPath !== "/home/ouro/AgentBundles/sanctuary.ouro/habits/sanctuary-health.md"
172
- || manifest[0].command !== COMMAND || !snapshot.renderedCrontab.includes(`# ouro:habit:sanctuary:sanctuary:sanctuary-health\n*/15 * * * * ${COMMAND}\n`)) {
175
+ || manifest[0].taskPath !== paths.healthTaskPath
176
+ || manifest[0].command !== paths.healthCommand || !snapshot.renderedCrontab.includes(`${paths.healthCronMarker}\n*/15 * * * * ${paths.healthCommand}\n`)) {
173
177
  throw new Error("Sanctuary scheduler supervisor attestation is invalid");
174
178
  }
175
179
  }
@@ -43,9 +43,7 @@ const runtime_1 = require("../../nerves/runtime");
43
43
  const telegram_identity_key_1 = require("../../senses/telegram-identity-key");
44
44
  const sanctuary_acceptance_marker_1 = require("./sanctuary-acceptance-marker");
45
45
  const butler_agent_1 = require("../butler-agent");
46
- const CRONTAB_PATH = "/home/ouro/.ouro-cli/scheduler/sanctuary.crontab";
47
46
  const SUPERCRONIC = "/usr/local/bin/supercronic";
48
- const SUPERCRONIC_CMDLINE = `${SUPERCRONIC}\0-split-logs\0-inotify\0${CRONTAB_PATH}\0`;
49
47
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
50
48
  const SHA256 = /^[0-9a-f]{64}$/u;
51
49
  const SLOT_MS = 15 * 60 * 1_000;
@@ -74,23 +72,27 @@ function safeEqual(left, right) {
74
72
  return false;
75
73
  return (0, node_crypto_1.timingSafeEqual)(Buffer.from(left, "hex"), Buffer.from(right, "hex"));
76
74
  }
77
- function isSupercronicProcess(pid, deps) {
78
- return deps.readLink(`/proc/${pid}/exe`) === SUPERCRONIC && deps.readFile(`/proc/${pid}/cmdline`) === SUPERCRONIC_CMDLINE;
75
+ function isSupercronicProcess(agent, pid, deps) {
76
+ const cmdline = `${SUPERCRONIC}\0-split-logs\0-inotify\0${(0, butler_agent_1.butlerContainerPaths)(agent).crontabPath}\0`;
77
+ return deps.readLink(`/proc/${pid}/exe`) === SUPERCRONIC && deps.readFile(`/proc/${pid}/cmdline`) === cmdline;
79
78
  }
80
- function defaultSanctuarySchedulerOriginDeps(agentRoot = (0, identity_1.getAgentRoot)("sanctuary"), markerReader = () => (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)("sanctuary")) {
79
+ function defaultSanctuarySchedulerOriginDeps(agent = "sanctuary", agentRoot = (0, identity_1.getAgentRoot)(agent), markerReader = () => (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)(agent)) {
81
80
  return {
82
81
  platform: process.platform, pid: process.pid, ppid: process.ppid, now: () => new Date(),
83
82
  readFile: (target) => fs.readFileSync(target, "utf8"), readLink: (target) => fs.readlinkSync(target),
84
83
  identityKey: () => (0, telegram_identity_key_1.readOrCreateTelegramIdentityKey)(agentRoot), marker: markerReader, randomId: () => (0, node_crypto_1.randomUUID)(),
85
84
  };
86
85
  }
87
- function createSanctuarySchedulerFireCommand(command, deps = defaultSanctuarySchedulerOriginDeps()) {
88
- if (!(0, butler_agent_1.isButlerAgent)(command.agent) || command.habitName !== "sanctuary-health" || command.trigger !== "cron" || deps.platform !== "linux")
86
+ function createSanctuarySchedulerFireCommand(command, given) {
87
+ if (!(0, butler_agent_1.isButlerAgent)(command.agent) || command.habitName !== "sanctuary-health" || command.trigger !== "cron")
88
+ return null;
89
+ const deps = given ?? defaultSanctuarySchedulerOriginDeps(command.agent);
90
+ if (deps.platform !== "linux")
89
91
  return null;
90
92
  try {
91
93
  const invocation = processIdentity(deps.readFile(`/proc/${deps.pid}/stat`));
92
94
  const parent = processIdentity(deps.readFile(`/proc/${deps.ppid}/stat`));
93
- if (!isSupercronicProcess(deps.ppid, deps) && !isSupercronicProcess(parent.parentPid, deps))
95
+ if (!isSupercronicProcess(command.agent, deps.ppid, deps) && !isSupercronicProcess(command.agent, parent.parentPid, deps))
94
96
  return null;
95
97
  const marker = deps.marker();
96
98
  if (invocation.parentPid !== deps.ppid)
@@ -122,7 +124,7 @@ function verifySanctuarySchedulerFireCommand(command, deps) {
122
124
  throw new Error("scheduler fire ancestry is invalid");
123
125
  if (command.parentPid !== deps.childPid && parent.parentPid !== deps.childPid)
124
126
  throw new Error("scheduler fire ancestry is invalid");
125
- if (command.parentPid === deps.childPid ? !isSupercronicProcess(command.parentPid, deps) : !isSupercronicProcess(parent.parentPid, deps))
127
+ if (command.parentPid === deps.childPid ? !isSupercronicProcess(command.agent, command.parentPid, deps) : !isSupercronicProcess(command.agent, parent.parentPid, deps))
126
128
  throw new Error("scheduler fire ancestry is invalid");
127
129
  (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.sanctuary_scheduler_origin_authenticated", message: "Sanctuary scheduler origin authenticated", meta: { schedulerRunId: command.schedulerRunId, slot: command.slot } });
128
130
  return {
@@ -335,7 +335,7 @@ function createSanctuaryToolContext(agentName) {
335
335
  getNotifications: acceptanceRead("unraid_get_notifications", reads.getNotifications),
336
336
  getSystem: acceptanceRead("unraid_get_system", reads.getSystem),
337
337
  getInstallState: acceptanceRead("sanctuary_get_install_state", async () => (0, sanctuary_bundle_migration_1.inspectSanctuaryPackageManagedBundle)({
338
- ...(0, sanctuary_package_management_1.resolveSanctuaryPackageManagedRoots)({ repoRoot: (0, identity_1.getRepoRoot)(), bundlesRoot: (0, identity_1.getAgentBundlesRoot)() }),
338
+ ...(0, sanctuary_package_management_1.resolveSanctuaryPackageManagedRoots)({ repoRoot: (0, identity_1.getRepoRoot)(), bundlesRoot: (0, identity_1.getAgentBundlesRoot)(), ...((0, butler_agent_1.isButlerAgent)(agentName) ? { agent: agentName } : {}) }),
339
339
  runtimePackageVersion: (0, bundle_manifest_1.getPackageVersion)(),
340
340
  })),
341
341
  checkServices: acceptanceRead("unraid_check_services", async () => {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1625",
3
+ "version": "0.1.0-alpha.1626",
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.1625",
9
+ "version": "0.1.0-alpha.1626",
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.1625",
3
+ "version": "0.1.0-alpha.1626",
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": {