@ouro.bot/cli 0.1.0-alpha.1624 → 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 +18 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/butler-agent.js +21 -0
- package/dist/heart/daemon/daemon-entry.js +8 -6
- package/dist/heart/daemon/sanctuary-package-management.js +8 -4
- package/dist/heart/daemon/sanctuary-scheduler-liveness.js +12 -8
- package/dist/heart/daemon/sanctuary-scheduler-origin.js +11 -9
- package/dist/mind/prompt.js +1 -1
- package/dist/repertoire/tools-session.js +1 -1
- package/dist/repertoire/tools-surface.js +1 -1
- package/dist/senses/proactive-content-guard.js +4 -62
- package/dist/senses/sanctuary-runtime.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
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
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1625",
|
|
12
|
+
"changes": [
|
|
13
|
+
"Agents no longer have messages held back for asking a person to do something. Version 0.1.0-alpha.1618 held any off-turn message asking for keyboard or machine work, and any \"you need to sign in\" message that `gh auth status` showed was false. This version removes both holds, along with the older hold on \"please check this for me\" requests. The rule now lives where agents read it, in the `send_message` and `surface` tool descriptions and the base prompt: ask a person only for what needs their body (a phone approval, their card, an irreversible call that's theirs, the vault's unlock secret), and do the rest under standing authority, checking a sign-in claim before passing it on. Untested delivery claims are still held and returned to the sender to verify."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.1624",
|
|
6
18
|
"changes": [
|
|
7
|
-
"Update the Ouro UI files to Ouro UI v1.3.587.",
|
|
8
19
|
"New `ouro mailbox handle set <person> <handle>`: the owner names the phone number (with its country code) or email address whose iMessages answer a person's letters. It is a CLI command only; no MCP or in-turn tool can set it. Each letter keeps the handle that was set when it was filed.",
|
|
9
20
|
"Letters now have a plain-text chat form: code, sender and subject, the reason only you can answer, links by label, the \"Options (from Ouro):\" block, and the exact replies that answer it, such as `Reply \"L7 1\" or \"L7 2\".` A line anchor such as `#L12` is dropped from a link so it can't be mistaken for a letter code. Nothing sends it yet.",
|
|
10
21
|
"`ouro mailbox handle set` only accepts the person letters actually go to (the family record naming this machine's owner), and refuses with `not-recipient` otherwise. It won't overwrite a damaged answering file (`answering-unreadable`), so nobody else's handle is lost.",
|
|
11
22
|
"A letter's body, its \"why only you\" line or a link label can no longer start with a number such as \"1 \" or \"2.\", so sender text can't pass for one of Ouro's option lines."
|
|
12
23
|
]
|
|
13
24
|
},
|
|
25
|
+
{
|
|
26
|
+
"version": "0.1.0-alpha.1623",
|
|
27
|
+
"changes": [
|
|
28
|
+
"Update the Ouro UI files to Ouro UI v1.3.587."
|
|
29
|
+
]
|
|
30
|
+
},
|
|
14
31
|
{
|
|
15
32
|
"version": "0.1.0-alpha.1622",
|
|
16
33
|
"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.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",
|
|
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)(
|
|
533
|
+
const marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)(butlerName);
|
|
532
534
|
return (0, sanctuary_scheduler_origin_1.verifySanctuarySchedulerFireCommand)(command, {
|
|
533
|
-
childPid: supercronicSupervisor.authenticatedSnapshot(
|
|
534
|
-
identityKey: (0, telegram_identity_key_1.readOrCreateTelegramIdentityKey)(path.join((0, identity_1.getAgentBundlesRoot)(),
|
|
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)(),
|
|
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(
|
|
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
|
-
|
|
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, [
|
|
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 !==
|
|
167
|
-
|| JSON.stringify(snapshot.args) !== JSON.stringify(["-split-logs", "-inotify",
|
|
168
|
-
|| snapshot.namespace !==
|
|
169
|
-
|| manifest[0]
|
|
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 !==
|
|
172
|
-
|| manifest[0].command !==
|
|
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
|
-
|
|
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)(
|
|
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,
|
|
88
|
-
if (!(0, butler_agent_1.isButlerAgent)(command.agent) || command.habitName !== "sanctuary-health" || command.trigger !== "cron"
|
|
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 {
|
package/dist/mind/prompt.js
CHANGED
|
@@ -1179,7 +1179,7 @@ exports.TALKING_WITH_PEOPLE_GUIDANCE = `## talking with people
|
|
|
1179
1179
|
|
|
1180
1180
|
my voice is the one in my identity, in every chat, however much formal text i've been reading. reports, task cards, changelogs, notices and agent intake are written in report-speak; that register belongs on formal surfaces (PRs, task cards, docs, emails to strangers, handoffs between agents), and i don't carry it into chat: no bolded headers or status sections in a chat reply. a notice or tool output isn't the body of my reply; my own words come first.
|
|
1181
1181
|
|
|
1182
|
-
i ask a person only for what
|
|
1182
|
+
i ask a person only for what needs their body: a number or prompt to approve on their own phone, their card, an irreversible call that's theirs, or the vault's unlock secret. i have standing authority, so the rest is mine: sign-ins with the password from my vault, codes in their mail, prompts, terminals and machines, which they're usually nowhere near. before i pass on "you need to sign in" i check it (\`gh auth status\` for gh) and drop it if it's false, and an agent that hands me an ask that isn't the person's gets it back: do it yourself, you have standing authority. i collect those asks and send them together with the next message i'm already sending, so they can do them in one sitting, rather than one at a time or held for a clock window. an item marked now goes out at once. when something they can try lands, i tell them "Ready: <what>, at <where>" as soon as it lands. when other agents hand me items for a person, a repeat with the same dedupe key and the same ask is dropped; the same key with a changed ask replaces the old one and goes on as new.`;
|
|
1183
1183
|
function contextSection(context, options) {
|
|
1184
1184
|
if (!context)
|
|
1185
1185
|
return "";
|
|
@@ -822,7 +822,7 @@ exports.sessionToolDefinitions = [
|
|
|
822
822
|
type: "function",
|
|
823
823
|
function: {
|
|
824
824
|
name: "send_message",
|
|
825
|
-
description: "send a message to a friend's session. Delivers at once when authorized from a trusted live chat; otherwise reports queued, blocked or failed. For user-requested private-return work use ponder, not friendId=self.",
|
|
825
|
+
description: "send a message to a friend's session. Delivers at once when authorized from a trusted live chat; otherwise reports queued, blocked or failed. For user-requested private-return work use ponder, not friendId=self. Ask a person only for what needs their body: a number or prompt to approve on their own phone, their card, an irreversible call that is theirs. Sign-ins (password from your vault), codes in their mail, prompts, terminals and machines are yours under standing authority; check a 'you need to sign in' claim (gh auth status) before passing it on.",
|
|
826
826
|
parameters: {
|
|
827
827
|
type: "object",
|
|
828
828
|
properties: {
|
|
@@ -99,7 +99,7 @@ exports.surfaceToolDef = {
|
|
|
99
99
|
type: "function",
|
|
100
100
|
function: {
|
|
101
101
|
name: "surface",
|
|
102
|
-
description: "return a ready thought to a friend or active session; content carrying internal markers is refused. pass delegationId to address a held thought (see your attention queue above): it goes back to the session that asked. pass friendId for spontaneous outreach: to a person it sends now on their newest iMessage, Telegram or Teams chat active in the last 30 days, trying the next if one does not send, and skipping MCP, CLI and agent sessions, which they don't read; to an agent friend it goes to that agent's newest session. if a send fails partway it comes back unconfirmed: it may have reached them, so don't send it again. if none sends, it comes back deferred: not sent, saved for their next message, and the result says why and what else reaches them. set channel=voice only when you intentionally want a live phone call; content becomes the call reason/opening context. set channel=teams to tell a friend on Teams now (it sends at once where your Teams sense runs, otherwise waits in their Teams chat). does not end your turn.",
|
|
102
|
+
description: "return a ready thought to a friend or active session; content carrying internal markers is refused. pass delegationId to address a held thought (see your attention queue above): it goes back to the session that asked. pass friendId for spontaneous outreach: to a person it sends now on their newest iMessage, Telegram or Teams chat active in the last 30 days, trying the next if one does not send, and skipping MCP, CLI and agent sessions, which they don't read; to an agent friend it goes to that agent's newest session. if a send fails partway it comes back unconfirmed: it may have reached them, so don't send it again. if none sends, it comes back deferred: not sent, saved for their next message, and the result says why and what else reaches them. set channel=voice only when you intentionally want a live phone call; content becomes the call reason/opening context. set channel=teams to tell a friend on Teams now (it sends at once where your Teams sense runs, otherwise waits in their Teams chat). does not end your turn. Ask a person only for what needs their body: a number or prompt to approve on their own phone, their card, an irreversible call that is theirs. Sign-ins (password from your vault), codes in their mail, prompts, terminals and machines are yours under standing authority; check a 'you need to sign in' claim (gh auth status) before passing it on.",
|
|
103
103
|
parameters: {
|
|
104
104
|
type: "object",
|
|
105
105
|
properties: {
|
|
@@ -38,7 +38,6 @@ exports.isReturnToSenderReason = isReturnToSenderReason;
|
|
|
38
38
|
exports.proactiveContentBlockGuidance = proactiveContentBlockGuidance;
|
|
39
39
|
exports.returnHeldProactiveMessage = returnHeldProactiveMessage;
|
|
40
40
|
exports.emitProactiveInternalContentBlocked = emitProactiveInternalContentBlocked;
|
|
41
|
-
const child_process_1 = require("child_process");
|
|
42
41
|
const runtime_1 = require("../nerves/runtime");
|
|
43
42
|
// ── Patterns ────────────────────────────────────────────────────
|
|
44
43
|
const PROACTIVE_INTERNAL_CONTENT_PATTERNS = [
|
|
@@ -63,54 +62,6 @@ const PROACTIVE_INTERNAL_CONTENT_PATTERNS = [
|
|
|
63
62
|
{ reason: "heartbeat_status", pattern: /\bobligations?\s+showing\b/i },
|
|
64
63
|
{ reason: "heartbeat_status", pattern: /\bsame state\b/i },
|
|
65
64
|
];
|
|
66
|
-
// ── Asks that aren't theirs ─────────────────────────────────────
|
|
67
|
-
// An ask reaches a person only when it names something only their body can do: approve a number or prompt on their own
|
|
68
|
-
// phone, pay with their card, or make an irreversible call that is theirs. The rest goes back to the sender.
|
|
69
|
-
// The sentence asks them to act: it opens with a command, or asks "can you", "please", "you need to".
|
|
70
|
-
const ASK_FRAME = /^\s*(?:[-*\u2022]\s*)?(?:\w+[:,]\s*)?(?:please\s+)?(?:run|type|press|paste|enter|sign|log|accept|make|open|check|click|restart|grab|copy|create|grant)\b|\b(?:(?:can|could|would|will) you|please|you(?:'ll)? (?:need|have) to|needs? you to|ask(?:ing)? you to|the (?:human|owner) (?:needs?|has) to)\b/i;
|
|
71
|
-
// Keyboard and terminal work, codes in their mail, a sign-in or a setting: never theirs.
|
|
72
|
-
const AT_A_KEYBOARD = [
|
|
73
|
-
/\b(?:run|type|paste|enter)\s+(?:`[^`\n]+`|(?:gh|ouro|npm|npx|git|claude|brew|bw)\b)/i,
|
|
74
|
-
/\b(?:in|from|at) (?:a|your|the) (?:terminal|shell|command line)\b/i,
|
|
75
|
-
/\bpress(?:ing)? (?:\d+|enter|return|y(?:es)?|no?)\b|\bat the [^.?!\n]{0,30}\bprompt\b/i,
|
|
76
|
-
/\b(?:paste|send|give|forward|tell|read|grab|copy)\b[^.?!\n]{0,40}\bcodes?\b(?!\s+review)/i,
|
|
77
|
-
/(?:^\s*|\b(?:you(?:'ll)? (?:need|have) to|(?:can|could|would) you|please|needs? you to)\s+)(?:re-?)?(?:sign|log)\s*-?\s*(?:in|into|on)\b|\bre-?(?:auth(?:enticate)?|login)\b|\b(?:gh auth (?:login|refresh)|ouro up)\b/i,
|
|
78
|
-
/\baccept\b[^.?!\n]{0,40}\b(?:agreement|terms|tos|eula|licen[cs]e)\b|\bmake\b[^.?!\n]{0,40}\b(?:public|private)\b/i,
|
|
79
|
-
/\b(?:by hand|manually|system settings|full disk access)\b|\bgrant\b[^.?!\n]{0,30}\baccess\b/i,
|
|
80
|
-
/\b(?:restart|relaunch|re-?run|rotate|click|merge)\b|\b(?:create|generate)\b[^.?!\n]{0,40}\b(?:token|api key)\b/i,
|
|
81
|
-
];
|
|
82
|
-
// A particular machine: theirs only when the sentence is about a phone approval or a payment.
|
|
83
|
-
const ON_A_MACHINE = /\b(?:in|on) (?:edge|chrome|safari|firefox|the browser|(?:the |your )?(?:mac(?: mini)?|macbook|laptop|desktop|computer)|[\w-]+-host)\b/i;
|
|
84
|
-
// A check an agent can run, asked for in its own words ("open X and tell me if it shows").
|
|
85
|
-
const ROUTINE_CHECKS = [
|
|
86
|
-
/\b(?:open|check|look at|test|try|verify|confirm)\b[^.?!]{0,160}\b(?:tell|let) me\b(?![^.?!]*\bworks? for you\b)/i,
|
|
87
|
-
/\b(?:tell|let) me(?: know)? (?:if|whether)\b[^.?!]{0,80}\b(?:show|shows|showing|load|loads|loading|works?(?! for you)|render|renders|appear|appears)\b/i,
|
|
88
|
-
/\b(?:can|could) you (?:check|see|look at)\b[^.?!\n]{0,40}\b(?:whether|logs?)\b/i,
|
|
89
|
-
];
|
|
90
|
-
const BODY_ONLY = /\b(?:passkey|face id|touch id|github mobile|authenticator|(?:approve|tap|confirm)\b[^.?!\n]{0,40}\b(?:on|in) (?:your|their|his|her) (?:own )?phone|tap \d+|pay|payment|(?:your|their|his|her) card|irreversible|can'?t be undone|permanently)\b/i;
|
|
91
|
-
// A sign-in ask whose claim the agent can check, and the command that checks it.
|
|
92
|
-
const SIGN_IN_CLAIMS = [
|
|
93
|
-
{ ask: /\bgh auth (?:login|refresh)\b|\b(?:sign|log)\s*-?\s*(?:in|into)\s+(?:to\s+)?(?:gh|the github cli)\b/i, command: "gh", args: ["auth", "status"] },
|
|
94
|
-
];
|
|
95
|
-
/** The first sentence that asks them for something that isn't theirs to do, or null. */
|
|
96
|
-
function askNotTheirs(text) {
|
|
97
|
-
// Only they hold the vault's own unlock secret.
|
|
98
|
-
return text.split(/(?<=[.?!])\s+|\n+/).find((sentence) => !/\bouro vault (?:unlock|create)\b/i.test(sentence) && ((ASK_FRAME.test(sentence) && AT_A_KEYBOARD.some((p) => p.test(sentence)))
|
|
99
|
-
|| (!BODY_ONLY.test(sentence) && ((ASK_FRAME.test(sentence) && ON_A_MACHINE.test(sentence)) || ROUTINE_CHECKS.some((p) => p.test(sentence)))))) ?? null;
|
|
100
|
-
}
|
|
101
|
-
/** True when the sign-in the ask wants is already done, by the claim's own status command. */
|
|
102
|
-
function isSignInClaimFalse(ask) {
|
|
103
|
-
const claim = SIGN_IN_CLAIMS.find((c) => c.ask.test(ask));
|
|
104
|
-
if (!claim)
|
|
105
|
-
return false;
|
|
106
|
-
try {
|
|
107
|
-
(0, child_process_1.execFileSync)(claim.command, claim.args, { stdio: "ignore", timeout: 5_000 });
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
65
|
// An untested result offered as the news.
|
|
115
66
|
const UNTESTED_CLAIM_PATTERNS = [
|
|
116
67
|
/\b(?:hasn'?t|has not|haven'?t|have not|not yet|never)\s+(?:been\s+)?(?:tested|verified|confirmed)\b/i,
|
|
@@ -120,10 +71,7 @@ const SHOULD_WORK_PATTERN = /\bshould (?:now )?(?:load|show|display|render|work|
|
|
|
120
71
|
const VERIFIED_BY_SENDER_PATTERN = /\b(?:i|we)(?:'ve| have)?\s+(?:verified|confirmed|tested|checked)\b|\bverified:/i;
|
|
121
72
|
// The person asked for this update, so labelling it unverified is honest progress, not a delivery claim.
|
|
122
73
|
const REQUESTED_STATUS_PATTERN = /\b(?:as you asked|you asked (?:for|me)|you wanted (?:an )?update|status you asked)\b/i;
|
|
123
|
-
function
|
|
124
|
-
const ask = askNotTheirs(text);
|
|
125
|
-
if (ask)
|
|
126
|
-
return isSignInClaimFalse(ask) ? "false_sign_in_claim" : "not_theirs_to_do";
|
|
74
|
+
function getUntestedClaimReason(text) {
|
|
127
75
|
if (REQUESTED_STATUS_PATTERN.test(text))
|
|
128
76
|
return null;
|
|
129
77
|
if (UNTESTED_CLAIM_PATTERNS.some((p) => p.test(text)))
|
|
@@ -142,20 +90,14 @@ function getProactiveInternalContentBlockReason(text) {
|
|
|
142
90
|
if (pattern.test(text))
|
|
143
91
|
return reason;
|
|
144
92
|
}
|
|
145
|
-
return
|
|
93
|
+
return getUntestedClaimReason(text);
|
|
146
94
|
}
|
|
147
|
-
/** Reasons the sender is told about, so it can
|
|
95
|
+
/** Reasons the sender is told about, so it can verify the result itself. */
|
|
148
96
|
function isReturnToSenderReason(reason) {
|
|
149
|
-
return reason === "
|
|
97
|
+
return reason === "untested_delivery_claim";
|
|
150
98
|
}
|
|
151
99
|
/** What the sending lane is told when the guard refuses its text. */
|
|
152
100
|
function proactiveContentBlockGuidance(reason) {
|
|
153
|
-
if (reason === "not_theirs_to_do") {
|
|
154
|
-
return "held back, not sent (not_theirs_to_do): do it yourself; you have standing authority. An ask reaches them only when their body must do it: approve a number or prompt on their own phone (2FA, GitHub Mobile, passkey), pay with their card, or an irreversible call that is theirs. Keyboard and terminal steps, anything on a particular machine, codes in their mail, sign-ins (the password is in your vault) and checks you can run are yours; when a sign-in ends in a phone prompt, send only the number to approve";
|
|
155
|
-
}
|
|
156
|
-
if (reason === "false_sign_in_claim") {
|
|
157
|
-
return "dropped, not sent (false_sign_in_claim): its status command says that sign-in is already done (for gh, `gh auth status` passes), so there is nothing to ask them; retry what failed and read its real error";
|
|
158
|
-
}
|
|
159
101
|
if (reason === "untested_delivery_claim") {
|
|
160
102
|
return "held back, not sent (untested_delivery_claim): do not report an untested result. Verify it yourself, then send the verified result with its proof, naming exactly what you verified (a mobile-web browser render is not proof for the native app). A status update they asked for may go unverified if it says so (\"as you asked\")";
|
|
161
103
|
}
|
|
@@ -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 () => {
|
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.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.
|
|
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.
|
|
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": {
|