@ouro.bot/cli 0.1.0-alpha.1652 → 0.1.0-alpha.1654

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.
@@ -43,6 +43,7 @@ const fs = __importStar(require("node:fs"));
43
43
  const path = __importStar(require("node:path"));
44
44
  const runtime_1 = require("../../nerves/runtime");
45
45
  const identity_1 = require("../identity");
46
+ const butler_agent_1 = require("../butler-agent");
46
47
  const sanctuary_acceptance_marker_1 = require("./sanctuary-acceptance-marker");
47
48
  const sanctuary_acceptance_harness_1 = require("./sanctuary-acceptance-harness");
48
49
  const sanctuary_grounding_1 = require("../../senses/sanctuary-grounding");
@@ -121,7 +122,7 @@ function hash(value) {
121
122
  }
122
123
  const CONTAINMENT_READ_SCOPE = ["ARRAY", "DASHBOARD", "DISK", "DOCKER", "INFO", "LOGS", "NOTIFICATIONS", "SHARE", "VARS"]
123
124
  .map((resource) => `${resource}:READ_ANY`).sort();
124
- const CONTAINMENT_AUDIT_PATH = "/home/ouro/AgentBundles/sanctuary.ouro/state/acceptance/telegram-audit-chain.ndjson";
125
+ const containmentAuditPath = () => `${(0, butler_agent_1.butlerContainerPaths)((0, sanctuary_acceptance_marker_1.acceptanceButler)()).agentRoot}/state/acceptance/telegram-audit-chain.ndjson`;
125
126
  function exactContainmentAudit(evidence) {
126
127
  const digestFields = [evidence.keyInventoryDigest, evidence.auditLedgerDigest, evidence.writeApprovalPolicyDigest];
127
128
  return evidence.schemaVersion === "sanctuary-containment-audit-v2"
@@ -130,7 +131,7 @@ function exactContainmentAudit(evidence) {
130
131
  && evidence.writeScopeDigest === hash([...CONTAINMENT_READ_SCOPE, "DOCKER:UPDATE_ANY"].sort())
131
132
  && evidence.keyRoleAssignmentCount === 0
132
133
  && (0, sanctuary_acceptance_harness_1.exactSanctuaryContainmentProfileBoundaries)(evidence.profileBoundaries)
133
- && evidence.auditPathDigest === (0, node_crypto_1.createHash)("sha256").update(CONTAINMENT_AUDIT_PATH).digest("hex")
134
+ && evidence.auditPathDigest === (0, node_crypto_1.createHash)("sha256").update(containmentAuditPath()).digest("hex")
134
135
  && evidence.auditRecordCount >= 2 && evidence.auditLifecyclePairCount >= 1
135
136
  // Five mounts now; six for alpha.978 and earlier (and a rollback to one), which add the read-only psyche mount. mountsExact pins the set.
136
137
  && evidence.containerUser === "10001:10001" && evidence.liveProcessUser === "10001:10001" && (evidence.mountCount === 5 || evidence.mountCount === 6) && evidence.publishedPortCount === 0
@@ -648,7 +649,7 @@ function createSanctuaryScenarioCapture(deps) {
648
649
  const capturedBefore = await deps.readFacts(input.label, scenarioHandleDigest, healthScenario ? { skipContainerSnapshot: true } : undefined);
649
650
  const before = { ...capturedBefore, sourceValues: Object.fromEntries(Object.entries(capturedBefore.sourceValues).map(([source, value]) => [source, hash(value)])) };
650
651
  const receipt = { schemaVersion: "sanctuary-acceptance-receipt-v1", label: input.label, gate: input.externalGate, sources: [...input.sources], checkpointDigest, scenarioHandleDigest, startedAt, before };
651
- (0, sanctuary_acceptance_marker_1.writeSanctuaryAcceptanceMarker)("sanctuary", { schemaVersion: "sanctuary-acceptance-marker-v1", label: input.label, scenarioHandleDigest, startedAt }, deps.agentRoot);
652
+ (0, sanctuary_acceptance_marker_1.writeSanctuaryAcceptanceMarker)((0, sanctuary_acceptance_marker_1.acceptanceButler)(), { schemaVersion: "sanctuary-acceptance-marker-v1", label: input.label, scenarioHandleDigest, startedAt }, deps.agentRoot);
652
653
  atomicPrivateJson(receiptPath(checkpointDigest), receipt);
653
654
  (0, sanctuary_acceptance_marker_1.publishSanctuaryAcceptanceGateStatus)({ label: input.label, gate: input.externalGate, phase: "waiting", startedAt }, deps.gateStatusPath);
654
655
  if (healthScenario) {
@@ -718,7 +719,7 @@ function createSanctuaryScenarioCapture(deps) {
718
719
  if (READ_ONLY_DENIAL_LABELS.has(input.label))
719
720
  await deps.denialDriver.complete(input.label, receipt.scenarioHandleDigest);
720
721
  (0, sanctuary_acceptance_marker_1.publishSanctuaryAcceptanceGateStatus)({ label: input.label, gate: input.externalGate, phase: "complete", startedAt: receipt.startedAt }, deps.gateStatusPath);
721
- (0, sanctuary_acceptance_marker_1.clearSanctuaryAcceptanceMarker)("sanctuary", receipt.scenarioHandleDigest, deps.agentRoot);
722
+ (0, sanctuary_acceptance_marker_1.clearSanctuaryAcceptanceMarker)((0, sanctuary_acceptance_marker_1.acceptanceButler)(), receipt.scenarioHandleDigest, deps.agentRoot);
722
723
  fs.unlinkSync(filePath);
723
724
  (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.sanctuary_acceptance_scenario_end", message: "Sanctuary live acceptance scenario completed", meta: { label: input.label, scenarioHandleDigest: receipt.scenarioHandleDigest } });
724
725
  return { state: "complete", checkpointDigest: receipt.checkpointDigest, sourceDigests, assertions };
@@ -860,13 +861,13 @@ function durableQuarantineReceiptRoot(receiptRoot) {
860
861
  }
861
862
  }
862
863
  function finalizeSanctuaryScenarioCapture(gateStatusPath, configuredReceiptRoot, configuredAgentRoot) {
863
- const receiptRoot = configuredReceiptRoot ?? path.join(configuredAgentRoot ?? (0, identity_1.getAgentRoot)("sanctuary"), "state", "acceptance", "receipts");
864
+ const receiptRoot = configuredReceiptRoot ?? path.join(configuredAgentRoot ?? (0, identity_1.getAgentRoot)((0, sanctuary_acceptance_marker_1.acceptanceButler)()), "state", "acceptance", "receipts");
864
865
  const errors = [];
865
866
  let marker = null;
866
867
  let markerReadable = true;
867
868
  let normalCleanupFailed = false;
868
869
  try {
869
- marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)("sanctuary", configuredAgentRoot);
870
+ marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)((0, sanctuary_acceptance_marker_1.acceptanceButler)(), configuredAgentRoot);
870
871
  }
871
872
  catch (error) {
872
873
  markerReadable = false;
@@ -922,7 +923,7 @@ function finalizeSanctuaryScenarioCapture(gateStatusPath, configuredReceiptRoot,
922
923
  }
923
924
  if (!normalCleanupFailed) {
924
925
  try {
925
- (0, sanctuary_acceptance_marker_1.clearSanctuaryAcceptanceMarker)("sanctuary", marker.scenarioHandleDigest, configuredAgentRoot);
926
+ (0, sanctuary_acceptance_marker_1.clearSanctuaryAcceptanceMarker)((0, sanctuary_acceptance_marker_1.acceptanceButler)(), marker.scenarioHandleDigest, configuredAgentRoot);
926
927
  }
927
928
  catch (error) {
928
929
  normalCleanupFailed = true;
@@ -939,7 +940,7 @@ function finalizeSanctuaryScenarioCapture(gateStatusPath, configuredReceiptRoot,
939
940
  errors.push(error);
940
941
  }
941
942
  try {
942
- (0, sanctuary_acceptance_marker_1.quarantineSanctuaryAcceptanceMarker)("sanctuary", configuredAgentRoot);
943
+ (0, sanctuary_acceptance_marker_1.quarantineSanctuaryAcceptanceMarker)((0, sanctuary_acceptance_marker_1.acceptanceButler)(), configuredAgentRoot);
943
944
  }
944
945
  catch (error) {
945
946
  errors.push(error);
@@ -75,8 +75,6 @@ function acceptanceTargetEndpoint(house) {
75
75
  throw new Error("Sanctuary health acceptance probe needs a public endpoint in house/house.json");
76
76
  return target.url;
77
77
  }
78
- const CRON_MARKER = "# ouro:habit:sanctuary:sanctuary:sanctuary-health";
79
- const CRON_COMMAND = "*/15 * * * * /usr/local/bin/node /opt/ouro/dist/heart/daemon/ouro-entry.js poke sanctuary --habit sanctuary-health --trigger cron";
80
78
  const PROCESS_ENTRY = "/opt/ouro/dist/senses/sanctuary-health-acceptance-probe-entry.js";
81
79
  const LABELS = ["unit-16f-cron-fingerprint", "unit-16g-health-transition", "unit-16h-acceptance-delivery-probe"];
82
80
  /**
@@ -361,10 +359,12 @@ function exactLocalDailyBoundary(reference) {
361
359
  }
362
360
  return result;
363
361
  }
364
- function canonicalCron(raw) {
362
+ /** Whether the crontab registers the health habit for this Butler, under the name its marker and command carry. */
363
+ function canonicalCron(raw, butler) {
364
+ const { healthCronMarker, healthCommand } = (0, butler_agent_1.butlerContainerPaths)(butler);
365
365
  const lines = raw.split(/\r?\n/u);
366
- const marker = lines.indexOf(CRON_MARKER);
367
- return marker >= 0 && lines[marker + 1] === CRON_COMMAND;
366
+ const marker = lines.indexOf(healthCronMarker);
367
+ return marker >= 0 && lines[marker + 1] === `*/15 * * * * ${healthCommand}`;
368
368
  }
369
369
  async function closeServer(server) {
370
370
  await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
@@ -526,10 +526,11 @@ async function runSanctuaryHealthAcceptanceProbe(input, dependencies = createSan
526
526
  const beforeStateDigest = snapshotDigest(snapshot);
527
527
  atomicPrivateFile(snapshotPath, `${JSON.stringify(snapshot)}\n`);
528
528
  atomicPrivateFile(checkpointPath, `${JSON.stringify({ schemaVersion: 1, ownerImageDigest: input.ownerImageDigest, ownerContainerDigest: input.ownerContainerDigest })}\n`);
529
- const cronPath = path.join(dependencies.runtimeRoot, "scheduler", "sanctuary.crontab");
529
+ const butler = dependencies.butler ?? probeButler();
530
+ const cronPath = path.join(dependencies.runtimeRoot, "scheduler", `${butler}.crontab`);
530
531
  const cronBefore = fs.readFileSync(cronPath, "utf8");
531
532
  const cronFingerprintBefore = digestBytes(cronBefore);
532
- const cronRegisteredBefore = canonicalCron(cronBefore);
533
+ const cronRegisteredBefore = canonicalCron(cronBefore, butler);
533
534
  const effectiveNow = input.label === "unit-16h-acceptance-delivery-probe" ? exactLocalDailyBoundary(dependencies.now()) : dependencies.now();
534
535
  let fixture;
535
536
  let expectedIncidentDigest = "";
@@ -576,7 +577,7 @@ async function runSanctuaryHealthAcceptanceProbe(input, dependencies = createSan
576
577
  toolContext: dependencies.toolContext, house: dependencies.house, statePath, fetch: fetchImpl, now: () => now, lease, endpointDebounce: false,
577
578
  acceptanceEventMeta: () => ({ scenarioHandleDigest: input.scenarioHandleDigest }),
578
579
  });
579
- await (0, sanctuary_health_runner_1.runSanctuaryHealthHabit)(dependencies.butler ?? probeButler(), {
580
+ await (0, sanctuary_health_runner_1.runSanctuaryHealthHabit)(butler, {
580
581
  ...dependencies.runnerOptions,
581
582
  createSweep: () => sweep,
582
583
  acceptanceMetrics: {
@@ -608,7 +609,7 @@ async function runSanctuaryHealthAcceptanceProbe(input, dependencies = createSan
608
609
  });
609
610
  const cronAfter = fs.readFileSync(cronPath, "utf8");
610
611
  const cronFingerprintAfter = digestBytes(cronAfter);
611
- const cronRegisteredAfter = canonicalCron(cronAfter);
612
+ const cronRegisteredAfter = canonicalCron(cronAfter, butler);
612
613
  const observedFixtureSequence = fixture?.observed ?? [];
613
614
  removeProbeWorkspace(workspace);
614
615
  const receipt = {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1652",
3
+ "version": "0.1.0-alpha.1654",
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.1652",
9
+ "version": "0.1.0-alpha.1654",
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.1652",
3
+ "version": "0.1.0-alpha.1654",
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": {