@ouro.bot/cli 0.1.0-alpha.1618 → 0.1.0-alpha.1619
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 +13 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/a2a/escalation-wiring.js +2 -1
- package/dist/heart/butler-agent.js +13 -0
- package/dist/heart/daemon/daemon-entry.js +4 -3
- package/dist/heart/daemon/daemon.js +2 -1
- package/dist/heart/daemon/sanctuary-acceptance-marker.js +4 -3
- package/dist/heart/daemon/sanctuary-scheduler-origin.js +4 -3
- package/dist/heart/daemon/sense-manager.js +4 -3
- package/dist/heart/external-events/router.js +4 -3
- package/dist/heart/turn-context.js +2 -1
- package/dist/nerves/coverage/file-completeness.js +2 -0
- package/dist/repertoire/tools-sanctuary-host.js +2 -1
- package/dist/repertoire/tools-session.js +2 -1
- package/dist/repertoire/tools.js +4 -3
- package/dist/senses/a2a-entry.js +2 -1
- package/dist/senses/sanctuary-download-credit-presentation.js +2 -1
- package/dist/senses/sanctuary-runtime.js +2 -1
- package/dist/senses/telegram-effect-adapter.js +3 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
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.1619",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The Butler's behaviour (its Telegram sense, owner escalation, house-care and media tools, health habit, acceptance markers and download-credit text) now turns on for an agent named `butler` as well as `sanctuary`. This is the first step of the rename: an install runs the same whichever name its bundle has.",
|
|
8
|
+
"The Butler's saved records and messages from the host (the Usenet event spool, its replay record, the Telegram failsafe and the scheduler's cron proof) are now accepted under the name `butler` as well as `sanctuary`, so the Butler keeps working through the rename from `sanctuary.ouro` to `butler.ouro`. Records written before the rename still say `sanctuary` and are read as before."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
4
11
|
{
|
|
5
12
|
"version": "0.1.0-alpha.1618",
|
|
6
13
|
"changes": [
|
|
7
|
-
"Blind interviews, product U: every arm's sandbox container now has 4 GB of memory instead of 2 GB. Grading a component built on the shadcn kit peaks at about 2 GB, so at 2 GB it thrashed until the turn's time limit and the arm ended ungraded. A guest can now name its own container memory (`memory`, such as `4g`); the household and helper containers keep 2 GB.",
|
|
8
14
|
"An ask on its way to a person (through `surface`, `send_message`, Teams or iMessage) now reaches them only when it names something only their body can do: approve a number or prompt on their own phone (2FA, GitHub Mobile, a passkey), pay with their card, or make an irreversible call that is theirs. An ask to run a command, press a key at a prompt, paste a code from their mail, sign in on a particular machine, accept terms or change a setting by hand goes back to the sender with \"do it yourself; you have standing authority\". A \"you need to sign in to gh\" ask is checked with `gh auth status` first and dropped when gh is already signed in. Sign-in, password and verification-code asks are no longer treated as theirs.",
|
|
9
15
|
"The auth and mail docs no longer tell agents to hand browser logins, dashboards, API tokens, HEY export or DNS to the person: those are the agent's, with its vault and browser."
|
|
10
16
|
]
|
|
11
17
|
},
|
|
18
|
+
{
|
|
19
|
+
"version": "0.1.0-alpha.1617",
|
|
20
|
+
"changes": [
|
|
21
|
+
"Blind interviews, product U: every arm's sandbox container now has 4 GB of memory instead of 2 GB. Grading a component built on the shadcn kit peaks at about 2 GB, so at 2 GB it thrashed until the turn's time limit and the arm ended ungraded. A guest can now name its own container memory (`memory`, such as `4g`); the household and helper containers keep 2 GB."
|
|
22
|
+
]
|
|
23
|
+
},
|
|
12
24
|
{
|
|
13
25
|
"version": "0.1.0-alpha.1616",
|
|
14
26
|
"changes": [
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1619</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -39,6 +39,7 @@ exports.sendOwnerNoticeViaTelegram = sendOwnerNoticeViaTelegram;
|
|
|
39
39
|
const fs = __importStar(require("node:fs"));
|
|
40
40
|
const path = __importStar(require("node:path"));
|
|
41
41
|
const runtime_1 = require("../nerves/runtime");
|
|
42
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
42
43
|
/**
|
|
43
44
|
* The version of the harness that is running, read from its own package.json once when this module loads. A fix is
|
|
44
45
|
* "live" only when this process carries it, so the value must not follow whatever an upgrade later writes to disk.
|
|
@@ -49,7 +50,7 @@ exports.RUNNING_HARNESS_VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirn
|
|
|
49
50
|
* owner-notice path as delegated commands. Only the Butler files and confirms failure reports.
|
|
50
51
|
*/
|
|
51
52
|
function escalationOptionsFor(agentName, sendOwnerNotice) {
|
|
52
|
-
if (
|
|
53
|
+
if (!(0, butler_agent_1.isButlerAgent)(agentName))
|
|
53
54
|
return {};
|
|
54
55
|
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.a2a_escalation_wired", message: "A2A server will confirm resolved failure reports to the owner", meta: { agentName, runningVersion: exports.RUNNING_HARNESS_VERSION } });
|
|
55
56
|
return { escalation: { runningVersion: exports.RUNNING_HARNESS_VERSION, notifyOwner: sendOwnerNotice } };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUTLER_AGENT_NAMES = void 0;
|
|
4
|
+
exports.isButlerAgent = isButlerAgent;
|
|
5
|
+
/**
|
|
6
|
+
* The Butler's agent names: `butler`, and `sanctuary` from before the rename (M2). Every check that picks Butler behaviour
|
|
7
|
+
* asks this, so an install runs the same whichever name its bundle has.
|
|
8
|
+
*/
|
|
9
|
+
exports.BUTLER_AGENT_NAMES = ["butler", "sanctuary"];
|
|
10
|
+
/** Whether this agent (or a saved record's `agent` field) is the Butler, under its name or its name from before the rename. */
|
|
11
|
+
function isButlerAgent(agentName) {
|
|
12
|
+
return typeof agentName === "string" && exports.BUTLER_AGENT_NAMES.includes(agentName);
|
|
13
|
+
}
|
|
@@ -52,6 +52,7 @@ const sense_manager_1 = require("./sense-manager");
|
|
|
52
52
|
const agent_discovery_1 = require("./agent-discovery");
|
|
53
53
|
const agent_home_1 = require("./agent-home");
|
|
54
54
|
const identity_1 = require("../identity");
|
|
55
|
+
const butler_agent_1 = require("../butler-agent");
|
|
55
56
|
const app_sessions_record_1 = require("./app-sessions-record");
|
|
56
57
|
const runtime_mode_1 = require("./runtime-mode");
|
|
57
58
|
const habit_scheduler_1 = require("../habits/habit-scheduler");
|
|
@@ -537,7 +538,7 @@ const daemon = new daemon_1.OuroDaemon({
|
|
|
537
538
|
},
|
|
538
539
|
schedulerFireConsumer: (origin) => (0, sanctuary_scheduler_liveness_1.consumeSanctuarySchedulerFire)(path.join((0, identity_1.getAgentBundlesRoot)(), "sanctuary.ouro"), origin),
|
|
539
540
|
nativeHabitRunner: async ({ agent, habitName, trigger, occurrenceId, runnerId, schedulerOrigin }) => {
|
|
540
|
-
if (agent
|
|
541
|
+
if (!(0, butler_agent_1.isButlerAgent)(agent) || habitName !== "sanctuary-health")
|
|
541
542
|
return null;
|
|
542
543
|
const marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)(agent);
|
|
543
544
|
const schedulerScenario = marker?.label === "unit-16f-cron-fingerprint" ? marker : null;
|
|
@@ -580,7 +581,7 @@ const daemon = new daemon_1.OuroDaemon({
|
|
|
580
581
|
}
|
|
581
582
|
return result;
|
|
582
583
|
},
|
|
583
|
-
nativeHabitMatch: (agent, habitName) => agent
|
|
584
|
+
nativeHabitMatch: (agent, habitName) => (0, butler_agent_1.isButlerAgent)(agent) && habitName === "sanctuary-health",
|
|
584
585
|
mode,
|
|
585
586
|
onStopCommandComplete: async () => {
|
|
586
587
|
await stopEntryRuntime();
|
|
@@ -897,7 +898,7 @@ void (0, daemon_bootstrap_startup_1.startDaemonAfterContainerCredentialBootstrap
|
|
|
897
898
|
habitsDir,
|
|
898
899
|
osCronManager,
|
|
899
900
|
onHabitFire: (habitName, trigger, context) => {
|
|
900
|
-
if ((0, habit_policy_1.isRsvpHabitName)(habitName) || (agent
|
|
901
|
+
if ((0, habit_policy_1.isRsvpHabitName)(habitName) || ((0, butler_agent_1.isButlerAgent)(agent) && habitName === "sanctuary-health")) {
|
|
901
902
|
(0, socket_client_1.sendDaemonCommand)(socketPath, {
|
|
902
903
|
kind: "habit.poke",
|
|
903
904
|
agent,
|
|
@@ -53,6 +53,7 @@ const path = __importStar(require("path"));
|
|
|
53
53
|
const node_crypto_1 = require("node:crypto");
|
|
54
54
|
const node_string_decoder_1 = require("node:string_decoder");
|
|
55
55
|
const identity_1 = require("../identity");
|
|
56
|
+
const butler_agent_1 = require("../butler-agent");
|
|
56
57
|
const state_retention_1 = require("./state-retention");
|
|
57
58
|
const agent_discovery_1 = require("./agent-discovery");
|
|
58
59
|
const runtime_1 = require("../../nerves/runtime");
|
|
@@ -2393,7 +2394,7 @@ class OuroDaemon {
|
|
|
2393
2394
|
return { ok: false, error: `invalid habit trigger: ${String(trigger)}` };
|
|
2394
2395
|
}
|
|
2395
2396
|
const schedulerOrigin = this.authenticatedSchedulerPokes.get(command);
|
|
2396
|
-
if (command.agent
|
|
2397
|
+
if ((0, butler_agent_1.isButlerAgent)(command.agent) && command.habitName === "sanctuary-health" && trigger === "cron" && !schedulerOrigin) {
|
|
2397
2398
|
return { ok: false, error: "Sanctuary cron habit requires authenticated Supercronic provenance" };
|
|
2398
2399
|
}
|
|
2399
2400
|
if (!(0, habit_policy_1.isRsvpHabitName)(command.habitName) && !this.hasManagedPrivateRuntime(command.agent)) {
|
|
@@ -50,6 +50,7 @@ const node_async_hooks_1 = require("node:async_hooks");
|
|
|
50
50
|
const node_crypto_1 = require("node:crypto");
|
|
51
51
|
const node_child_process_1 = require("node:child_process");
|
|
52
52
|
const identity_1 = require("../identity");
|
|
53
|
+
const butler_agent_1 = require("../butler-agent");
|
|
53
54
|
const runtime_1 = require("../../nerves/runtime");
|
|
54
55
|
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
55
56
|
const acceptanceApproval = new node_async_hooks_1.AsyncLocalStorage();
|
|
@@ -93,7 +94,7 @@ function parseMarker(value) {
|
|
|
93
94
|
return marker;
|
|
94
95
|
}
|
|
95
96
|
function readSanctuaryAcceptanceMarker(agentName, configuredAgentRoot) {
|
|
96
|
-
if (
|
|
97
|
+
if (!(0, butler_agent_1.isButlerAgent)(agentName))
|
|
97
98
|
return null;
|
|
98
99
|
const filePath = markerPath(agentName, configuredAgentRoot);
|
|
99
100
|
let raw;
|
|
@@ -108,7 +109,7 @@ function readSanctuaryAcceptanceMarker(agentName, configuredAgentRoot) {
|
|
|
108
109
|
return parseMarker(JSON.parse(raw));
|
|
109
110
|
}
|
|
110
111
|
function writeSanctuaryAcceptanceMarker(agentName, marker, configuredAgentRoot) {
|
|
111
|
-
if (
|
|
112
|
+
if (!(0, butler_agent_1.isButlerAgent)(agentName))
|
|
112
113
|
throw new Error("acceptance markers are restricted to Sanctuary");
|
|
113
114
|
const parsed = parseMarker(marker);
|
|
114
115
|
const filePath = markerPath(agentName, configuredAgentRoot);
|
|
@@ -131,7 +132,7 @@ function clearSanctuaryAcceptanceMarker(agentName, scenarioHandleDigest, configu
|
|
|
131
132
|
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.sanctuary_acceptance_marker_cleared", message: "Sanctuary acceptance marker cleared", meta: { scenarioHandleDigest } });
|
|
132
133
|
}
|
|
133
134
|
function quarantineSanctuaryAcceptanceMarker(agentName, configuredAgentRoot) {
|
|
134
|
-
if (
|
|
135
|
+
if (!(0, butler_agent_1.isButlerAgent)(agentName))
|
|
135
136
|
throw new Error("acceptance markers are restricted to Sanctuary");
|
|
136
137
|
const filePath = markerPath(agentName, configuredAgentRoot);
|
|
137
138
|
const sourceParent = path.dirname(filePath);
|
|
@@ -42,6 +42,7 @@ const identity_1 = require("../identity");
|
|
|
42
42
|
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
|
+
const butler_agent_1 = require("../butler-agent");
|
|
45
46
|
const CRONTAB_PATH = "/home/ouro/.ouro-cli/scheduler/sanctuary.crontab";
|
|
46
47
|
const SUPERCRONIC = "/usr/local/bin/supercronic";
|
|
47
48
|
const SUPERCRONIC_CMDLINE = `${SUPERCRONIC}\0-split-logs\0-inotify\0${CRONTAB_PATH}\0`;
|
|
@@ -84,7 +85,7 @@ function defaultSanctuarySchedulerOriginDeps(agentRoot = (0, identity_1.getAgent
|
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
87
|
function createSanctuarySchedulerFireCommand(command, deps = defaultSanctuarySchedulerOriginDeps()) {
|
|
87
|
-
if (command.agent
|
|
88
|
+
if (!(0, butler_agent_1.isButlerAgent)(command.agent) || command.habitName !== "sanctuary-health" || command.trigger !== "cron" || deps.platform !== "linux")
|
|
88
89
|
return null;
|
|
89
90
|
try {
|
|
90
91
|
const invocation = processIdentity(deps.readFile(`/proc/${deps.pid}/stat`));
|
|
@@ -96,7 +97,7 @@ function createSanctuarySchedulerFireCommand(command, deps = defaultSanctuarySch
|
|
|
96
97
|
return null;
|
|
97
98
|
const slot = slotFor(deps.now());
|
|
98
99
|
const value = {
|
|
99
|
-
kind: "habit.scheduler-fire", agent:
|
|
100
|
+
kind: "habit.scheduler-fire", agent: command.agent, habitName: "sanctuary-health", trigger: "cron",
|
|
100
101
|
slot, occurrenceId: `cron:${slot}`, schedulerRunId: deps.randomId(), invocationPid: deps.pid, parentPid: deps.ppid,
|
|
101
102
|
parentStartTime: parent.startTime, invocationStartTime: invocation.startTime,
|
|
102
103
|
scenarioHandleDigest: marker?.label === "unit-16f-cron-fingerprint" ? marker.scenarioHandleDigest : null,
|
|
@@ -108,7 +109,7 @@ function createSanctuarySchedulerFireCommand(command, deps = defaultSanctuarySch
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
function verifySanctuarySchedulerFireCommand(command, deps) {
|
|
111
|
-
if (!command || command.kind !== "habit.scheduler-fire" || command.agent
|
|
112
|
+
if (!command || command.kind !== "habit.scheduler-fire" || !(0, butler_agent_1.isButlerAgent)(command.agent) || command.habitName !== "sanctuary-health" || command.trigger !== "cron"
|
|
112
113
|
|| !UUID.test(command.schedulerRunId) || (command.scenarioHandleDigest !== null && !SHA256.test(command.scenarioHandleDigest)) || command.scenarioHandleDigest !== deps.scenarioHandleDigest
|
|
113
114
|
|| command.slot !== slotFor(deps.now()) || command.occurrenceId !== `cron:${command.slot}`)
|
|
114
115
|
throw new Error("scheduler fire slot or binding is invalid");
|
|
@@ -40,6 +40,7 @@ const os = __importStar(require("os"));
|
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const runtime_1 = require("../../nerves/runtime");
|
|
42
42
|
const identity_1 = require("../identity");
|
|
43
|
+
const butler_agent_1 = require("../butler-agent");
|
|
43
44
|
const runtime_credentials_1 = require("../runtime-credentials");
|
|
44
45
|
const provider_credentials_1 = require("../provider-credentials");
|
|
45
46
|
const sense_truth_1 = require("../sense-truth");
|
|
@@ -189,7 +190,7 @@ function runtimeConfigUnavailableDetail(agent, runtimeConfig) {
|
|
|
189
190
|
return `vault ${itemName} unavailable (${compactRuntimeConfigError(agent, runtimeConfig.error)})`;
|
|
190
191
|
}
|
|
191
192
|
function needsMachineRuntimeConfig(agent, sense) {
|
|
192
|
-
return sense === "bluebubbles" || sense === "voice" || sense === "a2a" || sense === "shepherd" || (agent
|
|
193
|
+
return sense === "bluebubbles" || sense === "voice" || sense === "a2a" || sense === "shepherd" || ((0, butler_agent_1.isButlerAgent)(agent) && sense === "telegram");
|
|
193
194
|
}
|
|
194
195
|
function senseFactsFromRuntimeConfig(agent, senses, runtimeConfig, machineRuntimeConfig = (0, runtime_credentials_1.readMachineRuntimeCredentialConfig)(agent), workbenchHasStaleBundleEntry = false) {
|
|
195
196
|
const base = {
|
|
@@ -215,7 +216,7 @@ function senseFactsFromRuntimeConfig(agent, senses, runtimeConfig, machineRuntim
|
|
|
215
216
|
const integrations = payload.integrations;
|
|
216
217
|
const voice = machinePayload.voice;
|
|
217
218
|
const a2a = machinePayload.a2a;
|
|
218
|
-
if (senses.telegram.enabled &&
|
|
219
|
+
if (senses.telegram.enabled && (0, butler_agent_1.isButlerAgent)(agent)) {
|
|
219
220
|
const ready = runtimeConfig.ok && machineRuntimeConfig.ok
|
|
220
221
|
&& !Object.hasOwn(payload, "telegramBotToken") && !Object.hasOwn(machinePayload, "telegramBotToken");
|
|
221
222
|
base.telegram = ready
|
|
@@ -408,7 +409,7 @@ function senseRepairHint(agent, sense) {
|
|
|
408
409
|
return `Agent-runnable: run 'ouro connect a2a --agent ${agent}', then restart with 'ouro up'.`;
|
|
409
410
|
}
|
|
410
411
|
if (sense === "telegram") {
|
|
411
|
-
return agent
|
|
412
|
+
return (0, butler_agent_1.isButlerAgent)(agent)
|
|
412
413
|
? "Agent-runnable: complete or recover the root authority migration; do not restore a resident Telegram token."
|
|
413
414
|
: `Agent-runnable: store Telegram bot/user/chat coordinates with 'ouro connect telegram --agent ${agent}', then restart with 'ouro up'.`;
|
|
414
415
|
}
|
|
@@ -60,6 +60,7 @@ const path = __importStar(require("node:path"));
|
|
|
60
60
|
const runtime_1 = require("../../nerves/runtime");
|
|
61
61
|
const ouro_version_manager_1 = require("../versioning/ouro-version-manager");
|
|
62
62
|
const atomic_file_1 = require("../atomic-file");
|
|
63
|
+
const butler_agent_1 = require("../butler-agent");
|
|
63
64
|
const MAX_EVENT_TEXT_BYTES = 4_096;
|
|
64
65
|
const MAX_EVENT_EVIDENCE = 32;
|
|
65
66
|
const MAX_EVENT_RECORD_BYTES = 64 * 1_024;
|
|
@@ -877,7 +878,7 @@ function parsePrivilegedEnvelope(raw, fileName, now) {
|
|
|
877
878
|
const observationTransitionIsAllowed = value.eventType !== "usenet.health_observation" || /^(?:auth-failed|stalled|recovered|indeterminate):\d{8}T\d{6}Z$/u.test(String(value.transitionId));
|
|
878
879
|
const expectedKeys = ["action", "actionReceipt", "agent", "createdAt", "critical", "eventType", "evidence", "expiresAt", "incidentKey", "nonce", "observationRevision", "protectiveStateDigest", "protectiveStateObservedAt", "protectiveStateVerified", "schemaVersion", "source", "summary", "transitionId"];
|
|
879
880
|
if (Object.keys(value).sort().join("\0") !== expectedKeys.sort().join("\0")
|
|
880
|
-
|| value.schemaVersion !== 1 || value.agent
|
|
881
|
+
|| value.schemaVersion !== 1 || !(0, butler_agent_1.isButlerAgent)(value.agent) || value.source !== PRIVILEGED_EVENT_SOURCE
|
|
881
882
|
|| !eventShapeIsAllowed || !observationTransitionIsAllowed
|
|
882
883
|
|| value.critical !== true || !boundedIdentifier(value.incidentKey) || !boundedIdentifier(value.transitionId)
|
|
883
884
|
|| !/^[a-f0-9]{64}$/u.test(String(value.observationRevision)) || !/^[a-f0-9]{64}$/u.test(String(value.nonce))
|
|
@@ -1028,7 +1029,7 @@ function isReplayState(value) {
|
|
|
1028
1029
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1029
1030
|
return false;
|
|
1030
1031
|
const state = value;
|
|
1031
|
-
if (state.schemaVersion !== 1 || state.agent
|
|
1032
|
+
if (state.schemaVersion !== 1 || !(0, butler_agent_1.isButlerAgent)(state.agent) || state.source !== PRIVILEGED_EVENT_SOURCE || !canonicalIso(state.updatedAt))
|
|
1032
1033
|
return false;
|
|
1033
1034
|
try {
|
|
1034
1035
|
replayBytes(state);
|
|
@@ -1204,7 +1205,7 @@ function commitMutation(recordPath, record, now) {
|
|
|
1204
1205
|
function bindPrivilegedFailsafeArtifact(recordPath, input) {
|
|
1205
1206
|
return withRecordLock(recordPath, () => {
|
|
1206
1207
|
const record = readExternalEventRecord(recordPath);
|
|
1207
|
-
if (record.agent
|
|
1208
|
+
if (!(0, butler_agent_1.isButlerAgent)(record.agent) || record.source !== PRIVILEGED_EVENT_SOURCE || !record.privilegedProtectiveAction) {
|
|
1208
1209
|
throw new Error("System failsafe requires a privileged Sanctuary event");
|
|
1209
1210
|
}
|
|
1210
1211
|
if (!/^[a-f0-9]{64}$/u.test(input.artifactId))
|
|
@@ -48,6 +48,7 @@ const path = __importStar(require("path"));
|
|
|
48
48
|
const runtime_1 = require("../nerves/runtime");
|
|
49
49
|
const manager_1 = require("./bridges/manager");
|
|
50
50
|
const identity_1 = require("./identity");
|
|
51
|
+
const butler_agent_1 = require("./butler-agent");
|
|
51
52
|
const coding_1 = require("../repertoire/coding");
|
|
52
53
|
const session_activity_1 = require("./session-activity");
|
|
53
54
|
const thoughts_1 = require("./daemon/thoughts");
|
|
@@ -221,7 +222,7 @@ function readSenseStatusLines() {
|
|
|
221
222
|
// Sanctuary's resident is deliberately tokenless: the root authority gateway holds the
|
|
222
223
|
// token, so a token in the resident's config would be the misconfiguration. Mirror the
|
|
223
224
|
// daemon's rule (sense-manager) instead of reporting a working sense as needs_config (D-047).
|
|
224
|
-
telegram: agentName
|
|
225
|
+
telegram: (0, butler_agent_1.isButlerAgent)(agentName)
|
|
225
226
|
? runtimeConfig.ok && machineRuntimeConfig.ok && !Object.hasOwn(runtimePayload, "telegramBotToken") && !Object.hasOwn(machinePayload, "telegramBotToken")
|
|
226
227
|
: hasTextField(runtimePayload, "telegramBotToken")
|
|
227
228
|
&& hasTextField(runtimePayload, "telegramAuthorizedUserId")
|
|
@@ -69,6 +69,8 @@ const DISPATCH_EXEMPT_PATTERNS = [
|
|
|
69
69
|
// otherwise read as code to isTypeOnlyFile.
|
|
70
70
|
"daemon/cli-commands/",
|
|
71
71
|
// Shared utility modules: pure helpers consumed by modules that own observability.
|
|
72
|
+
// The Butler's names and the one check that picks Butler behaviour; each caller owns its observability.
|
|
73
|
+
"heart/butler-agent",
|
|
72
74
|
"arc/json-store",
|
|
73
75
|
"heart/mail-import-discovery",
|
|
74
76
|
"repertoire/api-client",
|
|
@@ -47,6 +47,7 @@ const shared_turn_1 = require("../senses/shared-turn");
|
|
|
47
47
|
const relationship_authorization_1 = require("./relationship-authorization");
|
|
48
48
|
const tool_arguments_1 = require("./tool-arguments");
|
|
49
49
|
const tools_base_1 = require("./tools-base");
|
|
50
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
50
51
|
const NAME = "sanctuary_host_execute";
|
|
51
52
|
const bindings = new WeakMap();
|
|
52
53
|
const selections = new WeakMap();
|
|
@@ -69,7 +70,7 @@ function currentCoordinates(ctx) {
|
|
|
69
70
|
const actor = relationship?.actor;
|
|
70
71
|
const session = ctx.currentSession;
|
|
71
72
|
const friend = ctx.context?.friend;
|
|
72
|
-
requireOwner(ctx.agentName
|
|
73
|
+
requireOwner((0, butler_agent_1.isButlerAgent)(ctx.agentName) && typeof ctx.agentRoot === "string" && path.isAbsolute(ctx.agentRoot)
|
|
73
74
|
&& path.resolve(ctx.agentRoot) === ctx.agentRoot && path.basename(ctx.agentRoot) === "sanctuary.ouro");
|
|
74
75
|
requireOwner(root && root.port.isHealthy() && !ctx.currentExternalEvent);
|
|
75
76
|
requireOwner(relationship?.profileId === "sanctuary-owner" && relationship.advertisedToolNames?.includes(NAME));
|
|
@@ -42,6 +42,7 @@ const path = __importStar(require("path"));
|
|
|
42
42
|
const crypto_1 = require("crypto");
|
|
43
43
|
const config_1 = require("../heart/config");
|
|
44
44
|
const identity_1 = require("../heart/identity");
|
|
45
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
45
46
|
const session_events_1 = require("../heart/session-events");
|
|
46
47
|
const runtime_1 = require("../nerves/runtime");
|
|
47
48
|
const socket_client_1 = require("../heart/daemon/socket-client");
|
|
@@ -652,7 +653,7 @@ exports.sessionToolDefinitions = [
|
|
|
652
653
|
const frame = await buildToolActiveWorkFrame(ctx);
|
|
653
654
|
const activeWork = `this is my current top-level live world-state.\nanswer whole-self status questions from this before drilling into individual sessions.\n\n${(0, active_work_1.formatActiveWorkFrame)(frame)}`;
|
|
654
655
|
const numeric = (value, fallback, min, max) => value === undefined ? fallback : /^\d+$/u.test(value) ? Math.min(max, Math.max(min, Number(value))) : fallback;
|
|
655
|
-
return (0, identity_1.getAgentName)()
|
|
656
|
+
return (0, butler_agent_1.isButlerAgent)((0, identity_1.getAgentName)())
|
|
656
657
|
? `${activeWork}\n\n${formatButlerOperationalVisibility(readButlerOperationalVisibility(), { section: args.section, offset: numeric(args.offset, 0, 0, 10_000), limit: numeric(args.limit, 10, 1, 20) })}`
|
|
657
658
|
: activeWork;
|
|
658
659
|
},
|
package/dist/repertoire/tools.js
CHANGED
|
@@ -32,6 +32,7 @@ const tools_bundle_1 = require("./tools-bundle");
|
|
|
32
32
|
const runtime_1 = require("../nerves/runtime");
|
|
33
33
|
const guardrails_1 = require("./guardrails");
|
|
34
34
|
const identity_1 = require("../heart/identity");
|
|
35
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
35
36
|
const store_1 = require("../commerce/store");
|
|
36
37
|
const tools_surface_1 = require("./tools-surface");
|
|
37
38
|
const mcp_tools_1 = require("./mcp-tools");
|
|
@@ -170,7 +171,7 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
|
|
|
170
171
|
// loop and the host-local CLI/MCP) keep the unscoped tool set.
|
|
171
172
|
const channel = capabilities?.channel;
|
|
172
173
|
const remote = channel !== undefined && !SANCTUARY_LOCAL_CHANNELS.has(channel);
|
|
173
|
-
const sanctuary = (context?.agentName
|
|
174
|
+
const sanctuary = ((0, butler_agent_1.isButlerAgent)(context?.agentName) && (relationship !== undefined || remote))
|
|
174
175
|
|| profileId?.startsWith("sanctuary-") === true;
|
|
175
176
|
const owner = profileId === "sanctuary-owner";
|
|
176
177
|
// A trusted peer agent acting for the owner gets the owner's chat tool menu. Host
|
|
@@ -230,7 +231,7 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
|
|
|
230
231
|
ordinary.push(hostTool);
|
|
231
232
|
const inner = capabilities?.channel === "inner";
|
|
232
233
|
// The Butler's own scheduled turns (the daily house-care await) carry no relationship, so they cannot take the owner profile's menu.
|
|
233
|
-
if (inner && !sanctuary && context?.agentName
|
|
234
|
+
if (inner && !sanctuary && (0, butler_agent_1.isButlerAgent)(context?.agentName))
|
|
234
235
|
ordinary.push(...tools_house_care_1.houseCareToolDefinitions);
|
|
235
236
|
const habit = context?.habitSession;
|
|
236
237
|
if (inner) {
|
|
@@ -491,7 +492,7 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
491
492
|
}
|
|
492
493
|
const currentSelection = ctx?.selectCurrentTools?.()
|
|
493
494
|
?? (name === tools_sanctuary_host_1.rootHostToolDefinition.tool.function.name ? selection
|
|
494
|
-
: relationship?.profileId?.startsWith("sanctuary-") || (relationship && ctx?.agentName
|
|
495
|
+
: relationship?.profileId?.startsWith("sanctuary-") || (relationship && (0, butler_agent_1.isButlerAgent)(ctx?.agentName))
|
|
495
496
|
? selectToolsForChannel(undefined, undefined, undefined, undefined, undefined, undefined, ctx)
|
|
496
497
|
: undefined);
|
|
497
498
|
const current = currentSelection ? findDefinition(name, currentSelection) : def?.mcpBinding ? def : findDefinition(name);
|
package/dist/senses/a2a-entry.js
CHANGED
|
@@ -49,6 +49,7 @@ const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
|
49
49
|
const runtime_1 = require("../nerves/runtime");
|
|
50
50
|
const delegated_command_1 = require("../a2a/delegated-command");
|
|
51
51
|
const identity_1 = require("../heart/identity");
|
|
52
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
52
53
|
(0, runtime_logging_1.configureDaemonRuntimeLogger)("a2a");
|
|
53
54
|
(0, runtime_1.emitNervesEvent)({
|
|
54
55
|
component: "senses",
|
|
@@ -105,7 +106,7 @@ Promise.all([
|
|
|
105
106
|
identity,
|
|
106
107
|
// The Butler accepts delegated commands from explicitly granted peers; each
|
|
107
108
|
// one is announced in the owner's own Telegram chat before it runs (never through the owner route, never held).
|
|
108
|
-
...(agentName
|
|
109
|
+
...((0, butler_agent_1.isButlerAgent)(agentName) ? {
|
|
109
110
|
delegation: {
|
|
110
111
|
principalProfileId: delegated_command_1.A2A_PRINCIPAL_PROFILE_ID,
|
|
111
112
|
agentRoot: (0, identity_1.getAgentRoot)(agentName),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.presentSanctuaryDownloadCreditReply = presentSanctuaryDownloadCreditReply;
|
|
4
4
|
const runtime_1 = require("../nerves/runtime");
|
|
5
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
5
6
|
const TOP_UP_LINK = "https://www.astraweb.com/login";
|
|
6
7
|
const SAFE_FALLBACK = `Downloads are paused to protect your prepaid credit. Top it up here: ${TOP_UP_LINK}. Tell me when you’re done, and I’ll resume downloads and verify one finishes. Or tell me a reminder time, like “tomorrow at 9.”`;
|
|
7
8
|
const FORBIDDEN_INTERNALS = /\b(?:SABnzbd|Sonarr|Radarr|Deluge|auth[ -]?check|credential|dead[ -]?letter|indexer has been disabled|keep watching)\b/iu;
|
|
@@ -20,7 +21,7 @@ const REQUIRED_HOUSEHOLD_CONTRACT = [
|
|
|
20
21
|
/\btime\b|\btomorrow at 9\b/iu,
|
|
21
22
|
];
|
|
22
23
|
function presentSanctuaryDownloadCreditReply(agentName, exactQuestion, text) {
|
|
23
|
-
if (agentName
|
|
24
|
+
if (!(0, butler_agent_1.isButlerAgent)(agentName) || !exactQuestion || !text.includes(TOP_UP_LINK) || !/\bcredit\b/iu.test(text))
|
|
24
25
|
return text;
|
|
25
26
|
if (!FORBIDDEN_INTERNALS.test(text) && REQUIRED_HOUSEHOLD_CONTRACT.every((pattern) => pattern.test(text)))
|
|
26
27
|
return text;
|
|
@@ -45,6 +45,7 @@ const path = __importStar(require("node:path"));
|
|
|
45
45
|
const node_crypto_1 = require("node:crypto");
|
|
46
46
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
47
47
|
const identity_1 = require("../heart/identity");
|
|
48
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
48
49
|
const sanctuary_bundle_migration_1 = require("../heart/daemon/sanctuary-bundle-migration");
|
|
49
50
|
const sanctuary_package_management_1 = require("../heart/daemon/sanctuary-package-management");
|
|
50
51
|
const machine_identity_1 = require("../heart/machine-identity");
|
|
@@ -68,7 +69,7 @@ const sanctuaryToolGroundings = new node_async_hooks_1.AsyncLocalStorage();
|
|
|
68
69
|
const acceptanceLedgerTails = new Map();
|
|
69
70
|
/** The Butler agent whose private and A2A turns carry the Sanctuary tool context. */
|
|
70
71
|
function isSanctuaryAgent(agentName) {
|
|
71
|
-
return agentName
|
|
72
|
+
return (0, butler_agent_1.isButlerAgent)(agentName);
|
|
72
73
|
}
|
|
73
74
|
function isSanctuaryExternalEventSource(source) {
|
|
74
75
|
return source === "sanctuary-health" || source === "sanctuary-usenet";
|
|
@@ -57,6 +57,7 @@ const session_events_1 = require("../heart/session-events");
|
|
|
57
57
|
const session_transaction_1 = require("../mind/session-transaction");
|
|
58
58
|
const telegram_client_1 = require("./telegram-client");
|
|
59
59
|
const telegram_markdown_1 = require("./telegram-markdown");
|
|
60
|
+
const butler_agent_1 = require("../heart/butler-agent");
|
|
60
61
|
exports.FIXED_ADMISSION_ACKNOWLEDGEMENT = "Thanks — I’ve asked the person I work for. Your message is still unread and unprocessed; I’ll only read it if they welcome you in.";
|
|
61
62
|
exports.FIXED_USENET_SYSTEM_FAILSAFE = "Quick heads-up: I paused downloads because the server was discarding most of what it fetched. Nothing needs doing this second — I’ll investigate and follow up when I’m back online.";
|
|
62
63
|
const SYSTEM_FAILSAFE_UNAVAILABLE_MS = 2 * 60_000;
|
|
@@ -543,7 +544,7 @@ async function reconcileTelegramSystemFailsafe(input) {
|
|
|
543
544
|
const action = record.privilegedProtectiveAction;
|
|
544
545
|
if (record.privilegedFailsafe)
|
|
545
546
|
return { sent: false, reason: "already_recorded", artifactId: record.privilegedFailsafe.artifactId };
|
|
546
|
-
if (record.agent
|
|
547
|
+
if (!(0, butler_agent_1.isButlerAgent)(record.agent) || record.source !== "sanctuary-usenet" || record.eventType !== "usenet.protective_action"
|
|
547
548
|
|| record.priority !== "critical" || !action?.critical)
|
|
548
549
|
return { sent: false, reason: "noncritical" };
|
|
549
550
|
if (!action.verification.verified)
|
|
@@ -578,7 +579,7 @@ async function reconcileTelegramSystemFailsafe(input) {
|
|
|
578
579
|
async function sweepTelegramSystemFailsafes(input) {
|
|
579
580
|
const scanned = (input.scanCache ?? new router_1.ExternalEventScanCache()).scan(input.eventRoot);
|
|
580
581
|
const records = scanned
|
|
581
|
-
.flatMap((entry) => entry.record && entry.record.agent
|
|
582
|
+
.flatMap((entry) => entry.record && (0, butler_agent_1.isButlerAgent)(entry.record.agent) && entry.record.source === "sanctuary-usenet" && !entry.record.privilegedFailsafe ? [entry.record] : [])
|
|
582
583
|
.sort((left, right) => left.eventId.localeCompare(right.eventId))
|
|
583
584
|
.slice(0, 32);
|
|
584
585
|
let sent = 0;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1619",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1619",
|
|
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.
|
|
3
|
+
"version": "0.1.0-alpha.1619",
|
|
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": {
|