@ouro.bot/cli 0.1.0-alpha.1300 → 0.1.0-alpha.1301
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/agent-entry.js +2 -1
- package/dist/heart/daemon/cli-commands/entry-points.js +164 -0
- package/dist/heart/daemon/cli-commands/failure-code.js +11 -0
- package/dist/heart/daemon/cli-manifest.js +22 -6
- package/dist/heart/daemon/container-healthcheck.js +14 -3
- package/dist/heart/daemon/container-spec-auditor-main.js +1 -1
- package/dist/heart/daemon/daemon-entry.js +2 -1
- package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +13 -5
- package/dist/heart/daemon/sanctuary-host-supervisor-entry.js +5 -2
- package/dist/heart/daemon/sanctuary-telegram-authority-entry.js +5 -2
- package/dist/heart/daemon/sanctuary-telegram-test-driver-entry.js +5 -2
- package/dist/heart/session-playback-cli-main.js +6 -1
- package/dist/heart/session-redaction-repair-cli-main.js +7 -4
- package/dist/heart/session-stats-cli-main.js +6 -1
- package/dist/mailroom/entry.js +13 -4
- package/dist/nerves/coverage/cli-main.js +6 -1
- package/dist/nerves/review/cli-main.js +6 -1
- package/dist/senses/a2a-entry.js +2 -1
- package/dist/senses/app-sessions-entry.js +2 -1
- package/dist/senses/bluebubbles/entry.js +2 -1
- package/dist/senses/cli-entry.js +2 -1
- package/dist/senses/mail-entry.js +2 -1
- package/dist/senses/sanctuary-health-acceptance-probe-entry.js +10 -1
- package/dist/senses/sanctuary-health-acceptance-probe.js +22 -6
- package/dist/senses/shepherd/judge-evaluation-command.js +4 -2
- package/dist/senses/shepherd/judge-evaluation-entry.js +9 -2
- package/dist/senses/shepherd-entry.js +2 -1
- package/dist/senses/teams-entry.js +2 -1
- package/dist/senses/telegram-entry.js +2 -1
- package/dist/senses/voice-entry.js +2 -1
- package/dist/senses/voice-realtime-eval-entry.js +6 -2
- package/dist/senses/voice-twilio-entry.js +2 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1301",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Every node entry point the harness ships has an Ouro AX card, and each prints a code an agent can act on when it fails."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1300",
|
|
6
12
|
"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.1301</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -35,11 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
// Unified agent runtime entrypoint.
|
|
37
37
|
// Requires --agent before importing runtime modules that rely on identity.
|
|
38
|
+
const MISSING_AGENT = "missing-agent";
|
|
38
39
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
39
40
|
const parsedAgentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
40
41
|
if (!parsedAgentName) {
|
|
41
42
|
// eslint-disable-next-line no-console -- pre-boot guard
|
|
42
|
-
console.error(
|
|
43
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/heart/agent-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
43
44
|
process.exit(1);
|
|
44
45
|
}
|
|
45
46
|
const agentName = parsedAgentName;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENTRY_POINT_COMMANDS = void 0;
|
|
4
|
+
/** The guard every sense and worker entry runs before it loads anything: no `--agent <name>`. */
|
|
5
|
+
function missingAgent(path) {
|
|
6
|
+
return {
|
|
7
|
+
code: "missing-agent",
|
|
8
|
+
means: `node ${path} was started without --agent <name>, so it can't tell which agent bundle to run.`,
|
|
9
|
+
fix: `Let ouro up start it, or pass the agent: node ${path} --agent <name>.`,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const ROOT_LIFECYCLE = "node dist/heart/daemon/sanctuary-authority-root-lifecycle.js";
|
|
13
|
+
const REDACTION = "node dist/heart/session-redaction-repair-cli-main.js";
|
|
14
|
+
const PROBE = "node dist/senses/sanctuary-health-acceptance-probe-entry.js";
|
|
15
|
+
/** A root lifecycle step run as someone other than root. */
|
|
16
|
+
function rootOnly(step) {
|
|
17
|
+
return {
|
|
18
|
+
code: "needs-root",
|
|
19
|
+
means: `${ROOT_LIFECYCLE} ${step} runs only as root (uid and gid 0) on the Sanctuary host.`,
|
|
20
|
+
fix: `Run ${step} from the host's root job, not from the agent's shell.`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** A root lifecycle step that needs an installed authority. */
|
|
24
|
+
function notActive(step) {
|
|
25
|
+
return {
|
|
26
|
+
code: "not-active",
|
|
27
|
+
means: `${ROOT_LIFECYCLE} ${step} found no activation record, so no Sanctuary authority is installed to change.`,
|
|
28
|
+
fix: `Install the authority with docker-man-template-transaction.mjs authority-install first, then rerun ${step}.`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** A root lifecycle step given the wrong words. */
|
|
32
|
+
function rootUsage(step, words) {
|
|
33
|
+
return {
|
|
34
|
+
code: "usage",
|
|
35
|
+
means: `${ROOT_LIFECYCLE} ${step} takes ${words}, and got something else.`,
|
|
36
|
+
fix: `Run ${step} with exactly ${words}.`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** A redaction repair step that started but didn't finish. */
|
|
40
|
+
function repairUnfinished(step) {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
code: "not-applied",
|
|
44
|
+
means: `${REDACTION} ${step} stopped before it changed the session; the file is as it was.`,
|
|
45
|
+
fix: `Its write didn't land and the session is unchanged; run ${step} again with the same manifest.`,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
code: "indeterminate",
|
|
49
|
+
means: `${REDACTION} ${step} found the session at neither its preimage nor its postimage (it changed underneath), or reading the session back after the write threw.`,
|
|
50
|
+
fix: "Stop, and compare the session with the manifest and preimage by hand before any other step.",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/** A redaction repair step the repair itself refused, such as a manifest digest that doesn't match. */
|
|
55
|
+
function repairRefused(step) {
|
|
56
|
+
return {
|
|
57
|
+
code: "repair-refused",
|
|
58
|
+
means: `${REDACTION} ${step} refused: the session, manifest or digest didn't pass its checks, and nothing changed.`,
|
|
59
|
+
fix: "Read the JSON error, then rerun inspect for a fresh manifest and use its exact digest.",
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** A probe step given the wrong coordinates. */
|
|
63
|
+
function probeUsage(step) {
|
|
64
|
+
return {
|
|
65
|
+
code: "usage",
|
|
66
|
+
means: `${PROBE} ${step} needs --label, --scenario, --owner-image and --owner-container in that order${step === "finalize" ? ", then the two -after digests" : ""}.`,
|
|
67
|
+
fix: `Pass the coordinates the acceptance runner recorded for this scenario to ${step}.`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.ENTRY_POINT_COMMANDS = [
|
|
71
|
+
{ name: "node dist/heart/agent-entry.js", effect: "private", summary: "Run one agent's worker process.", ax: { id: "cli:node dist/heart/agent-entry.js", group: "entry-points", effect: "write", when: "The daemon starts one per agent; run it by hand only to debug a worker crash with the daemon stopped.", errors: [missingAgent("dist/heart/agent-entry.js")] } },
|
|
72
|
+
{ name: "node dist/heart/daemon/container-healthcheck.js", effect: "private", readOnly: true, summary: "Check a Sanctuary container's health.", ax: { id: "cli:node dist/heart/daemon/container-healthcheck.js", group: "entry-points", effect: "read", when: "Docker runs it as the Sanctuary container's healthcheck; run it inside the container to see which readiness check fails.", errors: [
|
|
73
|
+
{ code: "missing-agent", means: "The container healthcheck needs --agent <name> for the agent the container runs.", fix: "Pass the same --agent the container's start command uses." },
|
|
74
|
+
{ code: "unhealthy", means: "A readiness check failed: the bundle, daemon health file, PID 1 daemon, or one managed process isn't ready.", fix: "Read the reason on stderr, then check ouro status and the daemon logs inside the container." },
|
|
75
|
+
] } },
|
|
76
|
+
{ name: "node dist/heart/daemon/container-spec-auditor-main.js", effect: "private", readOnly: true, summary: "Audit a Sanctuary container spec.", ax: { id: "cli:node dist/heart/daemon/container-spec-auditor-main.js", group: "entry-points", effect: "read", when: "Before or after deploying Sanctuary: check a template, persistent template or running container against the expected image and mounts.", errors: [
|
|
77
|
+
{ code: "usage", means: "The container spec auditor got no complete mode: it needs --mount-contract and one staged, persistent or effective set of flags.", fix: "Read the usage in the JSON error and pass every flag of one mode." },
|
|
78
|
+
] } },
|
|
79
|
+
{ name: "node dist/heart/daemon/daemon-entry.js", effect: "private", summary: "Run the Ouro daemon.", ax: { id: "cli:node dist/heart/daemon/daemon-entry.js", group: "entry-points", effect: "write", when: "ouro up starts the background runtime through this; start it by hand only with a custom --socket while debugging.", errors: [
|
|
80
|
+
{ code: "unsupported-home", means: "The daemon refused to start because the Ouro home folder sits on a FAT or exFAT disk, which can't hold its locks and links.", fix: "Move the Ouro home to an APFS, HFS+ or ext4 volume, then run ouro up." },
|
|
81
|
+
] } },
|
|
82
|
+
{ name: ROOT_LIFECYCLE, effect: "private", summary: "Run Sanctuary's root lifecycle steps.", ax: { id: `cli:${ROOT_LIFECYCLE}`, group: "sanctuary-host", effect: "write", when: "Root jobs on the Sanctuary host call it with one step: boot, vault, repin-execution, upgrade or upgrade-rollback.", errors: [
|
|
83
|
+
{ code: "usage", means: `${ROOT_LIFECYCLE} got no step it knows, or the wrong number of words for one.`, fix: "Pass one step and exactly its words, such as boot alone." },
|
|
84
|
+
{ code: "needs-root", means: `${ROOT_LIFECYCLE} runs only as root (uid and gid 0) on the Sanctuary host, whatever the step.`, fix: "Run boot, vault, repin-execution, upgrade or upgrade-rollback from the host's root job, not from the agent's shell." },
|
|
85
|
+
] } },
|
|
86
|
+
{ name: `${ROOT_LIFECYCLE} vault`, effect: "private", summary: "Move the Sanctuary authority's vault items.", ax: { id: `cli:${ROOT_LIFECYCLE} vault`, group: "sanctuary-host", effect: "consequential", confirm: "Vault restore and remove change which token the Butler's Telegram front door can reach.", when: "Inside the authority install transaction only: snapshot, restore or remove the root-held vault items, one verb at a time.", errors: [
|
|
87
|
+
rootUsage("vault", "one verb: snapshot, presence, remove or restore"),
|
|
88
|
+
rootOnly("vault"),
|
|
89
|
+
{ code: "outside-install", means: `${ROOT_LIFECYCLE} vault remove was run outside the authority install transaction, which could strand the Butler.`, fix: "Run docker-man-template-transaction.mjs authority-install, which removes it safely." },
|
|
90
|
+
] } },
|
|
91
|
+
{ name: `${ROOT_LIFECYCLE} repin-execution`, effect: "private", summary: "Repin the authority's prlimit and setsid.", ax: { id: `cli:${ROOT_LIFECYCLE} repin-execution`, group: "sanctuary-host", effect: "consequential", confirm: "The authority will launch only prlimit and setsid binaries with these digests; wrong ones stop the Butler starting.", when: "After the host's prlimit or setsid binary changes: record their new sha256 digests so the authority keeps launching.", errors: [rootUsage("repin-execution", "the prlimit and setsid sha256 digests"), rootOnly("repin-execution"), notActive("repin-execution")] } },
|
|
92
|
+
{ name: `${ROOT_LIFECYCLE} upgrade`, effect: "private", summary: "Upgrade the Sanctuary authority's image.", ax: { id: `cli:${ROOT_LIFECYCLE} upgrade`, group: "sanctuary-host", effect: "consequential", confirm: "The live Butler moves to the target image; upgrade-rollback is the way back.", when: "Move the installed authority to a target image id and reference, waiting out a boot in flight.", errors: [rootUsage("upgrade", "a target image id and image reference, then optionally --fail-after <step> or --hold-commit"), rootOnly("upgrade"), notActive("upgrade")] } },
|
|
93
|
+
{ name: `${ROOT_LIFECYCLE} upgrade-rollback`, effect: "private", summary: "Roll the Sanctuary authority's upgrade back.", ax: { id: `cli:${ROOT_LIFECYCLE} upgrade-rollback`, group: "sanctuary-host", effect: "consequential", confirm: "The Butler goes back to the image it ran before the last upgrade.", when: "When an upgraded authority misbehaves: return it to the image it ran before, from the root job.", errors: [rootUsage("upgrade-rollback", "no further words"), rootOnly("upgrade-rollback"), notActive("upgrade-rollback")] } },
|
|
94
|
+
{ name: `${ROOT_LIFECYCLE} boot`, effect: "private", summary: "Boot the Sanctuary authority.", ax: { id: `cli:${ROOT_LIFECYCLE} boot`, group: "sanctuary-host", effect: "write", when: "The host keeper retries it at start-up; it brings an installed authority up and does nothing when none is active.", errors: [rootUsage("boot", "no further words"), rootOnly("boot")] } },
|
|
95
|
+
{ name: "node dist/heart/daemon/sanctuary-host-supervisor-entry.js", effect: "private", summary: "Supervise one Sanctuary host job.", ax: { id: "cli:node dist/heart/daemon/sanctuary-host-supervisor-entry.js", group: "sanctuary-host", effect: "write", when: "The host runs it with a job's --spec file to launch and watch that job under a lock; agents don't start it.", errors: [
|
|
96
|
+
{ code: "missing-spec", means: "The Sanctuary host supervisor needs --spec <path> naming the job it supervises.", fix: "Pass the job's spec file with --spec." },
|
|
97
|
+
] } },
|
|
98
|
+
{ name: "node dist/heart/daemon/sanctuary-telegram-authority-entry.js", effect: "private", summary: "Run the Sanctuary Telegram authority.", ax: { id: "cli:node dist/heart/daemon/sanctuary-telegram-authority-entry.js", group: "sanctuary-host", effect: "write", when: "The root service runs the Butler's Telegram front door from its --config; --retire-only only retires a previous one.", errors: [
|
|
99
|
+
{ code: "missing-config", means: "The Sanctuary Telegram authority needs --config <path> for its root-held active config.", fix: "Pass the active config path the authority service unit names." },
|
|
100
|
+
] } },
|
|
101
|
+
{ name: "node dist/heart/daemon/sanctuary-telegram-test-driver-entry.js", effect: "private", summary: "Drive test turns through the Telegram authority.", ax: { id: "cli:node dist/heart/daemon/sanctuary-telegram-test-driver-entry.js", group: "sanctuary-host", effect: "consequential", confirm: "send delivers a real [test] owner turn to the live Butler, which answers it in the owner's Telegram chat.", when: "As root during acceptance: send a [test] owner turn through the live authority and read its log.", errors: [
|
|
102
|
+
{ code: "missing-config", means: "The Sanctuary test driver needs --config <active.json> before its command, to reach the live authority.", fix: "Pass --config with the authority's active config, then send or log." },
|
|
103
|
+
] } },
|
|
104
|
+
{ name: "node dist/heart/session-playback-cli-main.js", effect: "private", readOnly: true, summary: "Show what replaying a session would change.", ax: { id: "cli:node dist/heart/session-playback-cli-main.js", group: "diagnostics", effect: "read", when: "When an agent loops on replay: see what the sanitizer would drop or insert in a saved session file, writing nothing.", errors: [
|
|
105
|
+
{ code: "usage", means: "Session playback needs the path of a saved session.json.", fix: "Pass the session file, adding --json for the report as data." },
|
|
106
|
+
] } },
|
|
107
|
+
{ name: REDACTION, effect: "private", summary: "Repair a session's redaction with a fixed recipe.", ax: { id: `cli:${REDACTION}`, group: "diagnostics", effect: "write", when: "Only for the one known redaction defect: inspect a session, then apply or roll back with the manifest inspect wrote.", errors: [
|
|
108
|
+
{ code: "usage", means: `${REDACTION} takes only its three fixed shapes: inspect, apply or rollback with their exact flags.`, fix: "Start with inspect --agent <name> --session <path> --artifacts-dir <dir>." },
|
|
109
|
+
] } },
|
|
110
|
+
{ name: `${REDACTION} inspect`, effect: "private", summary: "Plan a session's redaction repair.", ax: { id: `cli:${REDACTION} inspect`, group: "diagnostics", effect: "write", when: "First step of the repair: write a manifest and preimage for one session into --artifacts-dir, leaving the session alone.", errors: [
|
|
111
|
+
{ code: "usage", means: `${REDACTION} inspect needs --agent, --session and --artifacts-dir, in that order.`, fix: "Pass all three with their values and nothing else." },
|
|
112
|
+
repairRefused("inspect"),
|
|
113
|
+
] } },
|
|
114
|
+
{ name: `${REDACTION} apply`, effect: "private", summary: "Apply a planned redaction repair.", ax: { id: `cli:${REDACTION} apply`, group: "diagnostics", effect: "consequential", confirm: "The session file is rewritten from the manifest; rollback with the preimage undoes it.", when: "After inspect: rewrite the session from the manifest, given its exact --manifest-sha256.", errors: [
|
|
115
|
+
{ code: "usage", means: `${REDACTION} apply needs --manifest-sha256 <digest> and the manifest path, and nothing else.`, fix: "Pass the digest and manifest path inspect printed." },
|
|
116
|
+
repairRefused("apply"), ...repairUnfinished("apply"),
|
|
117
|
+
] } },
|
|
118
|
+
{ name: `${REDACTION} rollback`, effect: "private", summary: "Undo an applied redaction repair.", ax: { id: `cli:${REDACTION} rollback`, group: "diagnostics", effect: "consequential", confirm: "The session file goes back to the preimage inspect saved.", when: "If an applied repair looks wrong: put the session back from the preimage, with the manifest's digest.", errors: [
|
|
119
|
+
{ code: "usage", means: `${REDACTION} rollback needs --manifest-sha256 <digest>, the manifest path and the preimage path, and nothing else.`, fix: "Pass the digest and both paths inspect printed." },
|
|
120
|
+
repairRefused("rollback"), ...repairUnfinished("rollback"),
|
|
121
|
+
] } },
|
|
122
|
+
{ name: "node dist/heart/session-stats-cli-main.js", effect: "private", readOnly: true, summary: "Summarize a saved session.", ax: { id: "cli:node dist/heart/session-stats-cli-main.js", group: "diagnostics", effect: "read", when: "Size up a saved session file: message counts, token use and the last usage record, before deciding to trim it.", errors: [
|
|
123
|
+
{ code: "usage", means: "Session stats needs the path of a saved session.json.", fix: "Pass the session file, adding --json for the numbers as data." },
|
|
124
|
+
] } },
|
|
125
|
+
{ name: "node dist/mailroom/entry.js", effect: "private", summary: "Run the mailroom's SMTP and HTTP ingress.", ax: { id: "cli:node dist/mailroom/entry.js", group: "mail", effect: "write", when: "The hosted mailroom container runs it to accept mail for a registry's domain into a file or Azure store.", errors: [
|
|
126
|
+
{ code: "missing-store", means: "The mailroom needs somewhere to keep mail: --store <dir> or --azure-account-url <url>.", fix: "Pass one of the two." },
|
|
127
|
+
{ code: "missing-registry", means: "The mailroom needs its domain registry: --registry <file> or --registry-base64 <data>.", fix: "Pass one of the two." },
|
|
128
|
+
{ code: "bad-port", means: "A mailroom port flag isn't a whole number from 0 to 65535.", fix: "Pass --smtp-port and --http-port as plain port numbers." },
|
|
129
|
+
] } },
|
|
130
|
+
{ name: "node dist/nerves/coverage/cli-main.js", effect: "private", summary: "Audit nerves event coverage for a test run.", ax: { id: "cli:node dist/nerves/coverage/cli-main.js", group: "diagnostics", effect: "write", when: "After a test run: check every source file emitted its nerves events, writing nerves-coverage.json into the run.", errors: [
|
|
131
|
+
{ code: "no-run-dir", means: "The nerves audit found no test run: nothing was recorded and no --run-dir was given.", fix: "Run the tests first, or pass --run-dir with a run's folder." },
|
|
132
|
+
{ code: "audit-failed", means: "The nerves audit ran and some files are missing nerves events.", fix: "Read nerves-coverage.json for the files, and add the events they need." },
|
|
133
|
+
] } },
|
|
134
|
+
{ name: "node dist/nerves/review/cli-main.js", effect: "private", readOnly: true, summary: "Filter an agent's recent nerves events.", ax: { id: "cli:node dist/nerves/review/cli-main.js", group: "diagnostics", effect: "read", when: "Investigate what a running agent did lately: tail its nerves log, filtered by component, event, level or age.", errors: [
|
|
135
|
+
{ code: "bad-duration", means: "The nerves review's --since isn't a duration it reads.", fix: "Give --since as a number and unit, such as 5m, 2h or 1d." },
|
|
136
|
+
] } },
|
|
137
|
+
{ name: "node dist/senses/a2a-entry.js", effect: "private", summary: "Run an agent's A2A sense.", ax: { id: "cli:node dist/senses/a2a-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it so other agents can reach this one over A2A; --port and --base-url set where it listens.", errors: [missingAgent("dist/senses/a2a-entry.js")] } },
|
|
138
|
+
{ name: "node dist/senses/app-sessions-entry.js", effect: "private", summary: "Run an agent's app-sessions sense.", ax: { id: "cli:node dist/senses/app-sessions-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it to watch the coding app's sessions and send the owner a notice when one waits on a prompt.", errors: [missingAgent("dist/senses/app-sessions-entry.js")] } },
|
|
139
|
+
{ name: "node dist/senses/bluebubbles/entry.js", effect: "private", summary: "Run an agent's iMessage sense.", ax: { id: "cli:node dist/senses/bluebubbles/entry.js", group: "entry-points", effect: "write", when: "The daemon starts it on the iMessage host to carry messages between the BlueBubbles server and the agent.", errors: [missingAgent("dist/senses/bluebubbles/entry.js")] } },
|
|
140
|
+
{ name: "node dist/senses/cli-entry.js", effect: "private", summary: "Chat with an agent in this terminal.", ax: { id: "cli:node dist/senses/cli-entry.js", group: "entry-points", effect: "write", when: "The terminal chat behind ouro chat; start it directly only to talk to an agent without the daemon.", errors: [missingAgent("dist/senses/cli-entry.js")] } },
|
|
141
|
+
{ name: "node dist/senses/mail-entry.js", effect: "private", summary: "Run an agent's mail sense.", ax: { id: "cli:node dist/senses/mail-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it to read the agent's mailbox and hand new mail to the agent.", errors: [missingAgent("dist/senses/mail-entry.js")] } },
|
|
142
|
+
{ name: PROBE, effect: "private", summary: "Run a Sanctuary health acceptance probe step.", ax: { id: `cli:${PROBE}`, group: "sanctuary-host", effect: "write", when: "The acceptance runner calls it with one step, run, stop, recover or finalize, for a recorded health scenario.", errors: [
|
|
143
|
+
{ code: "missing-mode", means: `${PROBE} was started with no step at all.`, fix: "Pass run, stop, recover or finalize, then the scenario's coordinates." },
|
|
144
|
+
{ code: "usage", means: `${PROBE} got a first word that isn't one of its steps.`, fix: "Start with run, stop, recover or finalize; the usage on stderr shows the rest." },
|
|
145
|
+
] } },
|
|
146
|
+
{ name: `${PROBE} run`, effect: "private", summary: "Run one health acceptance scenario.", ax: { id: `cli:${PROBE} run`, group: "sanctuary-host", effect: "write", when: "Inject the scenario's health fault into the agent's state and wait for the scheduler's receipt.", errors: [probeUsage("run")] } },
|
|
147
|
+
{ name: `${PROBE} stop`, effect: "private", summary: "Stop a running health acceptance probe.", ax: { id: `cli:${PROBE} stop`, group: "sanctuary-host", effect: "write", when: "End a probe run that's still going, for the same scenario coordinates it started with.", errors: [probeUsage("stop")] } },
|
|
148
|
+
{ name: `${PROBE} recover`, effect: "private", summary: "Restore state after a health probe.", ax: { id: `cli:${PROBE} recover`, group: "sanctuary-host", effect: "write", when: "After an interrupted probe: put the agent's health state back from the snapshot the run saved.", errors: [probeUsage("recover")] } },
|
|
149
|
+
{ name: `${PROBE} finalize`, effect: "private", summary: "Finish a health acceptance scenario.", ax: { id: `cli:${PROBE} finalize`, group: "sanctuary-host", effect: "write", when: "Close a scenario by proving the owner image and container after it, then clear the probe's workspace.", errors: [probeUsage("finalize")] } },
|
|
150
|
+
{ name: "node dist/senses/shepherd/judge-evaluation-entry.js", effect: "private", summary: "Evaluate Shepherd's judge on its cases.", ax: { id: "cli:node dist/senses/shepherd/judge-evaluation-entry.js", group: "diagnostics", effect: "write", when: "Measure how Shepherd's judge classifies its evaluation cases, writing a report; it never qualifies v1 on its own.", errors: [
|
|
151
|
+
{ code: "not-passed", means: "The Shepherd judge evaluation finished, but its classification didn't pass or closing its report threw.", fix: "Read the JSON summary on stdout and the report for the failing cases." },
|
|
152
|
+
{ code: "evaluation-error", means: "The Shepherd judge evaluation stopped before running a case (bad arguments, an output that exists already, no judge for the agent, or a bad case corpus), or writing its report threw.", fix: "Read the error in the JSON on stdout, fix it, and run again with a new --output path." },
|
|
153
|
+
{ code: "evaluation-crashed", means: "The Shepherd judge evaluation threw before it finished, outside its own checks; stderr's JSON holds what it threw.", fix: "Read the error in the JSON on stderr, fix its cause, and run it again." },
|
|
154
|
+
] } },
|
|
155
|
+
{ name: "node dist/senses/shepherd-entry.js", effect: "private", summary: "Run an agent's Shepherd sense.", ax: { id: "cli:node dist/senses/shepherd-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it so Shepherd can drive the agent's coding sessions; use ouro shepherd for the actions.", errors: [missingAgent("dist/senses/shepherd-entry.js")] } },
|
|
156
|
+
{ name: "node dist/senses/teams-entry.js", effect: "private", summary: "Run an agent's Teams sense.", ax: { id: "cli:node dist/senses/teams-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it once the bot's credentials load, so the agent answers in Microsoft Teams.", errors: [missingAgent("dist/senses/teams-entry.js")] } },
|
|
157
|
+
{ name: "node dist/senses/telegram-entry.js", effect: "private", summary: "Run an agent's Telegram sense.", ax: { id: "cli:node dist/senses/telegram-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it so the agent answers its owner on Telegram through the bot token in its vault.", errors: [missingAgent("dist/senses/telegram-entry.js")] } },
|
|
158
|
+
{ name: "node dist/senses/voice-entry.js", effect: "private", summary: "Run an agent's voice sense.", ax: { id: "cli:node dist/senses/voice-entry.js", group: "entry-points", effect: "write", when: "The daemon starts it to run the voice transports attached on this machine, such as phone calls.", errors: [missingAgent("dist/senses/voice-entry.js")] } },
|
|
159
|
+
{ name: "node dist/senses/voice-realtime-eval-entry.js", effect: "private", readOnly: true, summary: "Grade the voice realtime evaluation suite.", ax: { id: "cli:node dist/senses/voice-realtime-eval-entry.js", group: "diagnostics", effect: "read", when: "Check voice behaviour offline: run the built-in scenarios, and grade recorded call traces passed with --trace.", errors: [
|
|
160
|
+
{ code: "eval-error", means: "The voice evaluation stopped before running: it got an unknown argument, or reading a --trace file threw.", fix: "Pass only --trace <file> pairs, pointing at trace files that exist." },
|
|
161
|
+
{ code: "eval-failed", means: "The voice evaluation ran and a scenario or trace didn't match what it expects.", fix: "Read expectedKnownBadFailed and happyPathPassed for the built-ins, and traceSummary.mismatchedScenarioIds for traces." },
|
|
162
|
+
] } },
|
|
163
|
+
{ name: "node dist/senses/voice-twilio-entry.js", effect: "private", summary: "Run a standalone Twilio phone bridge.", ax: { id: "cli:node dist/senses/voice-twilio-entry.js", group: "entry-points", effect: "write", when: "For local voice testing only: bridge Twilio calls to the agent through a tunnel given as --public-url.", errors: [missingAgent("dist/senses/voice-twilio-entry.js")] } },
|
|
164
|
+
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The last stderr line of a failed `node dist/...` program (see entry-points.ts): `code: <code>`, but only for a code
|
|
3
|
+
// that program's card names. Any other code, such as Node's ENOENT, could say something about the host the program
|
|
4
|
+
// keeps private, and no card tells an agent what to do about it, so the line is left out.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.failureCodeLine = failureCodeLine;
|
|
7
|
+
/** `code: <code>\n` when the failure carries one of the door's card codes, otherwise "". */
|
|
8
|
+
function failureCodeLine(error, codes) {
|
|
9
|
+
const code = error?.code;
|
|
10
|
+
return typeof code === "string" && codes.includes(code) ? `code: ${code}\n` : "";
|
|
11
|
+
}
|
|
@@ -6,6 +6,7 @@ exports.entryPointHelp = entryPointHelp;
|
|
|
6
6
|
exports.cliHelpJson = cliHelpJson;
|
|
7
7
|
// The commands of the ouro CLI, declared once: the names `ouro help --json` lists and the X-ray's inventory reads.
|
|
8
8
|
const runtime_1 = require("../../nerves/runtime");
|
|
9
|
+
const identity_1 = require("../identity");
|
|
9
10
|
const lifecycle_1 = require("./cli-commands/lifecycle");
|
|
10
11
|
const providers_1 = require("./cli-commands/providers");
|
|
11
12
|
const vault_1 = require("./cli-commands/vault");
|
|
@@ -20,6 +21,7 @@ const presence_1 = require("./cli-commands/presence");
|
|
|
20
21
|
const shepherd_1 = require("./cli-commands/shepherd");
|
|
21
22
|
const rsvp_1 = require("./cli-commands/rsvp");
|
|
22
23
|
const dns_1 = require("./cli-commands/dns");
|
|
24
|
+
const entry_points_1 = require("./cli-commands/entry-points");
|
|
23
25
|
/** The CLI-level card: what words no command has answer. */
|
|
24
26
|
exports.serverErrors = [
|
|
25
27
|
{ code: "unknown-door", means: "No ouro command starts with those words; the error suggests the nearest one.", fix: "Run the suggested command if it is the one you meant; otherwise run ouro help --json and pick by summary." },
|
|
@@ -45,7 +47,7 @@ exports.CLI_COMMANDS = [
|
|
|
45
47
|
* The census finds them by their `process.argv` reads; each is declared here with its card. `help --json` lists them
|
|
46
48
|
* as `entryPoints`, apart from the commands, because they don't start with `ouro`.
|
|
47
49
|
*/
|
|
48
|
-
exports.CLI_ENTRY_POINTS =
|
|
50
|
+
exports.CLI_ENTRY_POINTS = entry_points_1.ENTRY_POINT_COMMANDS;
|
|
49
51
|
exports.CLI_EXIT_CODES = [
|
|
50
52
|
{ code: 0, name: "ok", meaning: "The command did what it was asked." },
|
|
51
53
|
{ code: 1, name: "error", meaning: "The command failed or refused; the output says why and how to fix it." },
|
|
@@ -74,12 +76,26 @@ function helpEntry(command, usage = `ouro ${command.name}`) {
|
|
|
74
76
|
: {}),
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
|
-
/**
|
|
78
|
-
function
|
|
79
|
-
|
|
79
|
+
/** Every string in a help value, with each `node dist/` made `node <root>/dist/`. */
|
|
80
|
+
function withPackageRoot(value, root) {
|
|
81
|
+
if (typeof value === "string")
|
|
82
|
+
return value.split("node dist/").join(`node ${root}/dist/`);
|
|
83
|
+
if (Array.isArray(value))
|
|
84
|
+
return value.map((item) => withPackageRoot(item, root));
|
|
85
|
+
if (value && typeof value === "object")
|
|
86
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, withPackageRoot(item, root)]));
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* An entry point's help: its usage is its own command line, not an ouro command. The cards say `node dist/...`, which
|
|
91
|
+
* runs only from the package folder; the help gives the installed package's absolute path, which an agent can run from
|
|
92
|
+
* anywhere (and which the X-ray doesn't take for a developer's source-checkout command).
|
|
93
|
+
*/
|
|
94
|
+
function entryPointHelp(entry, root = (0, identity_1.getRepoRoot)()) {
|
|
95
|
+
return withPackageRoot(helpEntry(entry, entry.name), root);
|
|
80
96
|
}
|
|
81
97
|
/** The help as data: every declared command and entry point with its effect and card, and the exit codes. */
|
|
82
|
-
function cliHelpJson() {
|
|
98
|
+
function cliHelpJson(root = (0, identity_1.getRepoRoot)()) {
|
|
83
99
|
(0, runtime_1.emitNervesEvent)({
|
|
84
100
|
component: "daemon",
|
|
85
101
|
event: "daemon.cli_help_json",
|
|
@@ -89,7 +105,7 @@ function cliHelpJson() {
|
|
|
89
105
|
return JSON.stringify({
|
|
90
106
|
tool: "ouro",
|
|
91
107
|
commands: exports.CLI_COMMANDS.map((command) => helpEntry(command)),
|
|
92
|
-
entryPoints: exports.CLI_ENTRY_POINTS.map(entryPointHelp),
|
|
108
|
+
entryPoints: exports.CLI_ENTRY_POINTS.map((entry) => entryPointHelp(entry, root)),
|
|
93
109
|
exitCodes: exports.CLI_EXIT_CODES,
|
|
94
110
|
errors: exports.serverErrors,
|
|
95
111
|
}, null, 2);
|
|
@@ -45,10 +45,11 @@ const bundle_manifest_1 = require("../../mind/bundle-manifest");
|
|
|
45
45
|
const container_runtime_1 = require("./container-runtime");
|
|
46
46
|
const sanctuary_bundle_migration_1 = require("./sanctuary-bundle-migration");
|
|
47
47
|
const sanctuary_package_management_1 = require("./sanctuary-package-management");
|
|
48
|
+
const failure_code_1 = require("./cli-commands/failure-code");
|
|
48
49
|
function fail(reason) {
|
|
49
50
|
(0, runtime_1.emitNervesEvent)({ level: "error", component: "daemon", event: "daemon.container_healthcheck_error", message: "container healthcheck failed", meta: { reason } });
|
|
50
51
|
process.exitCode = 1;
|
|
51
|
-
throw new Error(reason);
|
|
52
|
+
throw Object.assign(new Error(reason), { code: reason === "missing agent" ? "missing-agent" : "unhealthy" });
|
|
52
53
|
}
|
|
53
54
|
function runContainerHealthcheck(options = {}) {
|
|
54
55
|
const argv = options.argv ?? process.argv;
|
|
@@ -105,8 +106,18 @@ function runContainerHealthcheck(options = {}) {
|
|
|
105
106
|
fail("managed Supercronic scheduler is not running exactly once");
|
|
106
107
|
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.container_healthcheck_end", message: "container healthcheck passed", meta: { agent } });
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
110
|
+
const CARD_CODES = ["missing-agent", "unhealthy"];
|
|
111
|
+
/** Run the healthcheck as the container's entrypoint: a failure ends stderr with its code, and exits 1. */
|
|
112
|
+
function runContainerHealthcheckMain(isMain, runner, writeError = (text) => { process.stderr.write(text); }) {
|
|
113
|
+
if (!isMain)
|
|
114
|
+
return;
|
|
115
|
+
try {
|
|
110
116
|
runner();
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
writeError(`${error instanceof Error ? error.message : String(error)}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
120
|
+
process.exitCode = 1;
|
|
121
|
+
}
|
|
111
122
|
}
|
|
112
123
|
runContainerHealthcheckMain(require.main === module, runContainerHealthcheck);
|
|
@@ -94,7 +94,7 @@ function runContainerSpecAuditorCli(rawArgs, deps = {}) {
|
|
|
94
94
|
const sourceEffective = sourceContract === "legacy-alpha742" ? sourceCandidate : null;
|
|
95
95
|
const selectedEffective = effective ?? sourceEffective;
|
|
96
96
|
if (!sync || (!staged && !persistent && !selectedEffective)) {
|
|
97
|
-
write(JSON.stringify({ ok: false, error: "usage: all modes require --mount-contract canonical-pre-gateway|canonical-gateway and accept --sync-enabled true|false; staged --template <path> --runtime-policy <path> --expected-image <id>; persistent --persistent-template <path> --runtime-policy <path> --expected-image-reference <tag>; effective --inspect <path> --image-inspect <path> --expected-image <id> --expected-image-reference <tag> --expected-icon <url>; source compatibility effective --inspect <path> --image-inspect <path> --expected-image <id> --mount-contract legacy-alpha742" }) + "\n");
|
|
97
|
+
write(JSON.stringify({ ok: false, code: "usage", error: "usage: all modes require --mount-contract canonical-pre-gateway|canonical-gateway and accept --sync-enabled true|false; staged --template <path> --runtime-policy <path> --expected-image <id>; persistent --persistent-template <path> --runtime-policy <path> --expected-image-reference <tag>; effective --inspect <path> --image-inspect <path> --expected-image <id> --expected-image-reference <tag> --expected-icon <url>; source compatibility effective --inspect <path> --image-inspect <path> --expected-image <id> --mount-contract legacy-alpha742" }) + "\n");
|
|
98
98
|
(0, runtime_1.emitNervesEvent)({
|
|
99
99
|
level: "error",
|
|
100
100
|
component: "daemon",
|
|
@@ -108,7 +108,8 @@ const socketPath = parseSocketPath(process.argv);
|
|
|
108
108
|
/* v8 ignore start -- refuses to start on a FAT or exFAT home; the check is unit-tested in home-filesystem.test.ts @preserve */
|
|
109
109
|
const homeFilesystemProblem = (0, home_filesystem_1.unsupportedHomeFilesystem)((0, ouro_version_manager_1.getOuroCliHome)());
|
|
110
110
|
if (homeFilesystemProblem) {
|
|
111
|
-
|
|
111
|
+
const code = "unsupported-home";
|
|
112
|
+
process.stderr.write(`${homeFilesystemProblem}\ncode: ${code}\n`);
|
|
112
113
|
process.exit(1);
|
|
113
114
|
}
|
|
114
115
|
/* v8 ignore stop */
|
|
@@ -38,6 +38,7 @@ exports.SanctuaryAuthorityRootLifecycle = exports.SANCTUARY_UPGRADE_STEPS = expo
|
|
|
38
38
|
exports.predecessorExpectsPsycheMount = predecessorExpectsPsycheMount;
|
|
39
39
|
exports.predecessorHasBundleSync = predecessorHasBundleSync;
|
|
40
40
|
exports.recordSanctuaryRootLifecycleFailure = recordSanctuaryRootLifecycleFailure;
|
|
41
|
+
exports.sanctuaryRootLifecycleFailureText = sanctuaryRootLifecycleFailureText;
|
|
41
42
|
exports.runSanctuaryAuthorityRootCli = runSanctuaryAuthorityRootCli;
|
|
42
43
|
const node_child_process_1 = require("node:child_process");
|
|
43
44
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -51,6 +52,7 @@ const sanctuary_authority_resident_1 = require("../../senses/sanctuary-authority
|
|
|
51
52
|
const sanctuary_authority_vault_migration_1 = require("./sanctuary-authority-vault-migration");
|
|
52
53
|
const session_transaction_1 = require("../../mind/session-transaction");
|
|
53
54
|
const runtime_1 = require("../../nerves/runtime");
|
|
55
|
+
const failure_code_1 = require("./cli-commands/failure-code");
|
|
54
56
|
const ROOT = "/mnt/user/appdata/ouro-authority";
|
|
55
57
|
const BUNDLE = "/mnt/user/appdata/ouro-butler/agent/sanctuary.ouro";
|
|
56
58
|
const RUNTIME = "/mnt/user/appdata/ouro-butler/runtime/.ouro-cli";
|
|
@@ -1290,9 +1292,15 @@ function recordSanctuaryRootLifecycleFailure(error, file = `${ROOT}/lifecycle-fa
|
|
|
1290
1292
|
return "";
|
|
1291
1293
|
}
|
|
1292
1294
|
}
|
|
1295
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
1296
|
+
const CARD_CODES = ["needs-root", "usage", "outside-install", "not-active"];
|
|
1297
|
+
/** The stderr for a failed root lifecycle: generic (D-034), then the failure's code as its last line when it has one. */
|
|
1298
|
+
function sanctuaryRootLifecycleFailureText(error, details) {
|
|
1299
|
+
return `Sanctuary root lifecycle failed; inspect the root transaction and repair its failed boundary.${details}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`;
|
|
1300
|
+
}
|
|
1293
1301
|
async function runSanctuaryAuthorityRootCli(argv, write = (text) => process.stdout.write(text)) {
|
|
1294
1302
|
if (process.getuid() !== 0 || process.getgid() !== 0)
|
|
1295
|
-
throw new Error("Sanctuary root lifecycle requires root");
|
|
1303
|
+
throw Object.assign(new Error("Sanctuary root lifecycle requires root"), { code: "needs-root" });
|
|
1296
1304
|
if (argv.length === 2 && argv[0] === "vault") {
|
|
1297
1305
|
// `remove` is the one vault verb that can strand the household. It is safe
|
|
1298
1306
|
// only inside the install transaction, which has already proven the same
|
|
@@ -1303,7 +1311,7 @@ async function runSanctuaryAuthorityRootCli(argv, write = (text) => process.stdo
|
|
|
1303
1311
|
// transaction, not a privilege boundary: root can always set the variable,
|
|
1304
1312
|
// but it can no longer do this by reaching for a documented verb.
|
|
1305
1313
|
if (argv[1] === "remove" && !process.env.OURO_AUTHORITY_REMOVE_INTERLOCK) {
|
|
1306
|
-
throw new Error("Sanctuary vault removal runs only inside the authority install transaction; use docker-man-template-transaction.mjs authority-install");
|
|
1314
|
+
throw Object.assign(new Error("Sanctuary vault removal runs only inside the authority install transaction; use docker-man-template-transaction.mjs authority-install"), { code: "outside-install" });
|
|
1307
1315
|
}
|
|
1308
1316
|
const input = argv[1] === "restore" ? JSON.parse(fs.readFileSync(0, "utf8")) : undefined;
|
|
1309
1317
|
write(`${JSON.stringify(await (0, sanctuary_authority_vault_migration_1.migrateSanctuaryAuthorityVault)(argv[1], input))}\n`);
|
|
@@ -1314,13 +1322,13 @@ async function runSanctuaryAuthorityRootCli(argv, write = (text) => process.stdo
|
|
|
1314
1322
|
const upgrade = argv[0] === "upgrade" && (argv.length === 3 || holdCommit || (argv.length === 5 && argv[3] === "--fail-after"));
|
|
1315
1323
|
const rollback = argv.length === 1 && argv[0] === "upgrade-rollback";
|
|
1316
1324
|
if (!repin && !upgrade && !rollback && (argv.length !== 1 || argv[0] !== "boot"))
|
|
1317
|
-
throw new Error("Usage: sanctuary-authority-root-lifecycle <boot|repin-execution <prlimit-sha256> <setsid-sha256>|upgrade <target-image-id> <image-reference> [--fail-after <step>|--hold-commit]|upgrade-rollback|vault snapshot|vault presence|vault remove|vault restore>");
|
|
1325
|
+
throw Object.assign(new Error("Usage: sanctuary-authority-root-lifecycle <boot|repin-execution <prlimit-sha256> <setsid-sha256>|upgrade <target-image-id> <image-reference> [--fail-after <step>|--hold-commit]|upgrade-rollback|vault snapshot|vault presence|vault remove|vault restore>"), { code: "usage" });
|
|
1318
1326
|
// Boot never waits: the host keeper retries it. An operator upgrade waits out a boot in flight.
|
|
1319
1327
|
await (0, session_transaction_1.withSessionTurnLease)(TEMPLATE_JOURNAL, async () => {
|
|
1320
1328
|
const activationPath = `${ROOT}/activation.json`;
|
|
1321
1329
|
if (!fs.existsSync(activationPath)) {
|
|
1322
1330
|
if (repin || upgrade || rollback)
|
|
1323
|
-
throw new Error("Sanctuary authority is not active");
|
|
1331
|
+
throw Object.assign(new Error("Sanctuary authority is not active"), { code: "not-active" });
|
|
1324
1332
|
return;
|
|
1325
1333
|
}
|
|
1326
1334
|
const activation = JSON.parse(fs.readFileSync(activationPath, "utf8"));
|
|
@@ -1342,7 +1350,7 @@ async function runSanctuaryAuthorityRootCli(argv, write = (text) => process.stdo
|
|
|
1342
1350
|
}
|
|
1343
1351
|
if (process.argv[1] && fs.existsSync(process.argv[1]) && fs.realpathSync(process.argv[1]) === __filename) {
|
|
1344
1352
|
void runSanctuaryAuthorityRootCli(process.argv.slice(2)).catch((error) => {
|
|
1345
|
-
process.stderr.write(
|
|
1353
|
+
process.stderr.write(sanctuaryRootLifecycleFailureText(error, recordSanctuaryRootLifecycleFailure(error)));
|
|
1346
1354
|
process.exitCode = 1;
|
|
1347
1355
|
});
|
|
1348
1356
|
}
|
|
@@ -43,6 +43,7 @@ const runtime_1 = require("../../nerves/runtime");
|
|
|
43
43
|
const sanctuary_authority_codec_1 = require("./sanctuary-authority-codec");
|
|
44
44
|
const sanctuary_host_linux_kernel_1 = require("./sanctuary-host-linux-kernel");
|
|
45
45
|
const sanctuary_host_supervisor_1 = require("./sanctuary-host-supervisor");
|
|
46
|
+
const failure_code_1 = require("./cli-commands/failure-code");
|
|
46
47
|
const DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
47
48
|
function digest(bytes) {
|
|
48
49
|
return `sha256:${(0, node_crypto_1.createHash)("sha256").update(bytes).digest("hex")}`;
|
|
@@ -195,13 +196,15 @@ async function runSanctuaryHostSupervisorCli(argv = process.argv, run = runSanct
|
|
|
195
196
|
const index = argv.indexOf("--spec");
|
|
196
197
|
const specPath = index >= 0 ? argv[index + 1] : undefined;
|
|
197
198
|
if (!specPath)
|
|
198
|
-
throw new Error("Sanctuary host supervisor requires --spec");
|
|
199
|
+
throw Object.assign(new Error("Sanctuary host supervisor requires --spec"), { code: "missing-spec" });
|
|
199
200
|
await run(specPath);
|
|
200
201
|
}
|
|
202
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
203
|
+
const CARD_CODES = ["missing-spec"];
|
|
201
204
|
/* v8 ignore next 6 -- executable guard delegates to the tested CLI runner @preserve */
|
|
202
205
|
if (require.main === module) {
|
|
203
206
|
void runSanctuaryHostSupervisorCli().catch((error) => {
|
|
204
|
-
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary host supervisor failed"}\n`);
|
|
207
|
+
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary host supervisor failed"}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
205
208
|
process.exitCode = 1;
|
|
206
209
|
});
|
|
207
210
|
}
|
|
@@ -53,6 +53,7 @@ const sanctuary_authority_installation_1 = require("./sanctuary-authority-instal
|
|
|
53
53
|
const sanctuary_authority_epoch_1 = require("./sanctuary-authority-epoch");
|
|
54
54
|
const sanctuary_telegram_authority_service_1 = require("./sanctuary-telegram-authority-service");
|
|
55
55
|
const sanctuary_telegram_test_driver_1 = require("./sanctuary-telegram-test-driver");
|
|
56
|
+
const failure_code_1 = require("./cli-commands/failure-code");
|
|
56
57
|
const MAX_PRIVATE_FILE_BYTES = 64 * 1024;
|
|
57
58
|
const MAX_ATTACHMENT_BYTES = 20_000_000;
|
|
58
59
|
function isObject(value) {
|
|
@@ -456,7 +457,7 @@ async function runSanctuaryTelegramAuthorityCli(options = {}) {
|
|
|
456
457
|
const configIndex = argv.indexOf("--config");
|
|
457
458
|
const configPath = configIndex >= 0 ? argv[configIndex + 1] : undefined;
|
|
458
459
|
if (!configPath)
|
|
459
|
-
throw new Error("Sanctuary Telegram authority requires --config");
|
|
460
|
+
throw Object.assign(new Error("Sanctuary Telegram authority requires --config"), { code: "missing-config" });
|
|
460
461
|
const authority = await (options.start ?? startSanctuaryTelegramAuthority)({ configPath, ...(argv.includes("--retire-only") ? { retireOnly: true } : {}) });
|
|
461
462
|
const close = async () => {
|
|
462
463
|
await authority.close();
|
|
@@ -470,9 +471,11 @@ async function runSanctuaryTelegramAuthorityCli(options = {}) {
|
|
|
470
471
|
void authority.retire().then(() => (options.exit ?? process.exit)(0)).catch(() => (options.exit ?? process.exit)(1));
|
|
471
472
|
});
|
|
472
473
|
}
|
|
474
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
475
|
+
const CARD_CODES = ["missing-config"];
|
|
473
476
|
if (process.argv[1] && fs.existsSync(process.argv[1]) && fs.realpathSync(process.argv[1]) === __filename) {
|
|
474
477
|
void runSanctuaryTelegramAuthorityCli().catch((error) => {
|
|
475
|
-
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary Telegram authority failed"}\n`);
|
|
478
|
+
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary Telegram authority failed"}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
476
479
|
process.exitCode = 1;
|
|
477
480
|
});
|
|
478
481
|
}
|
|
@@ -42,6 +42,7 @@ const telegram_client_1 = require("../../senses/telegram-client");
|
|
|
42
42
|
const sanctuary_telegram_authority_entry_1 = require("./sanctuary-telegram-authority-entry");
|
|
43
43
|
const sanctuary_telegram_authority_gateway_1 = require("./sanctuary-telegram-authority-gateway");
|
|
44
44
|
const sanctuary_telegram_test_driver_1 = require("./sanctuary-telegram-test-driver");
|
|
45
|
+
const failure_code_1 = require("./cli-commands/failure-code");
|
|
45
46
|
/**
|
|
46
47
|
* Root-only entry for the owner-turn test driver. It reads the live authority's own config and signing key, which
|
|
47
48
|
* only root can read, and talks to nothing but the authority's state files and, for the visible echo, Telegram.
|
|
@@ -51,7 +52,7 @@ async function runSanctuaryTelegramTestDriverCli(options = {}) {
|
|
|
51
52
|
const configIndex = argv.indexOf("--config");
|
|
52
53
|
const configPath = configIndex >= 0 ? argv[configIndex + 1] : undefined;
|
|
53
54
|
if (!configPath)
|
|
54
|
-
throw new Error(sanctuary_telegram_test_driver_1.SANCTUARY_TELEGRAM_TEST_DRIVER_USAGE);
|
|
55
|
+
throw Object.assign(new Error(sanctuary_telegram_test_driver_1.SANCTUARY_TELEGRAM_TEST_DRIVER_USAGE), { code: "missing-config" });
|
|
55
56
|
const rest = [...argv.slice(0, configIndex), ...argv.slice(configIndex + 2)];
|
|
56
57
|
const expectedUid = options.expectedUid ?? 0;
|
|
57
58
|
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.sanctuary_telegram_test_driver_started", message: "Sanctuary owner-turn test driver started", meta: {} });
|
|
@@ -84,10 +85,12 @@ async function runSanctuaryTelegramTestDriverCli(options = {}) {
|
|
|
84
85
|
api?.stop();
|
|
85
86
|
}
|
|
86
87
|
}
|
|
88
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
89
|
+
const CARD_CODES = ["missing-config"];
|
|
87
90
|
/* v8 ignore start -- process entry wiring; runSanctuaryTelegramTestDriverCli is tested directly @preserve */
|
|
88
91
|
if (process.argv[1] && fs.existsSync(process.argv[1]) && fs.realpathSync(process.argv[1]) === __filename) {
|
|
89
92
|
void runSanctuaryTelegramTestDriverCli().catch((error) => {
|
|
90
|
-
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary test driver failed"}\n`);
|
|
93
|
+
process.stderr.write(`${error instanceof Error ? error.message : "Sanctuary test driver failed"}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
91
94
|
process.exitCode = 1;
|
|
92
95
|
});
|
|
93
96
|
}
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const session_playback_cli_1 = require("./session-playback-cli");
|
|
4
4
|
const code = (0, session_playback_cli_1.runSessionPlaybackCli)(process.argv.slice(2));
|
|
5
|
-
|
|
5
|
+
// A failure ends stderr with its code, as every ouro command's does.
|
|
6
|
+
const failure = { 2: "usage" }[code];
|
|
7
|
+
if (failure)
|
|
8
|
+
process.stderr.write(`code: ${failure}\n`);
|
|
9
|
+
// exitCode, not process.exit: exit can drop the stderr line on a macOS pipe.
|
|
10
|
+
process.exitCode = code;
|
|
@@ -18,13 +18,16 @@ async function main() {
|
|
|
18
18
|
result = await (0, session_redaction_repair_1.rollbackA003SessionRepair)({ manifestSha256: args[2], manifestPath: args[3], preimagePath: args[4] });
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
throw new Error("expected fixed inspect, apply, or rollback arguments");
|
|
21
|
+
throw Object.assign(new Error("expected fixed inspect, apply, or rollback arguments"), { code: "usage" });
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// A step that didn't finish says so in its code: not-applied left the session as it was, indeterminate can't tell.
|
|
24
|
+
const unfinished = result.status === "indeterminate" ? "indeterminate" : result.status === "not_applied" ? "not-applied" : undefined;
|
|
25
|
+
process.stdout.write(`${JSON.stringify(unfinished ? { ...result, code: unfinished } : result)}\n`);
|
|
26
|
+
process.exitCode = unfinished ? 1 : 0;
|
|
25
27
|
}
|
|
26
28
|
catch (error) {
|
|
27
|
-
|
|
29
|
+
const code = error?.code === "usage" ? "usage" : "repair-refused";
|
|
30
|
+
process.stdout.write(`${JSON.stringify({ status: "refused", code, error: (error instanceof Error ? error.message : String(error)).slice(0, 512) })}\n`);
|
|
28
31
|
process.exitCode = 2;
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const session_stats_1 = require("./session-stats");
|
|
4
4
|
const code = (0, session_stats_1.runSessionStatsCli)(process.argv.slice(2));
|
|
5
|
-
|
|
5
|
+
// A failure ends stderr with its code, as every ouro command's does.
|
|
6
|
+
const failure = { 2: "usage" }[code];
|
|
7
|
+
if (failure)
|
|
8
|
+
process.stderr.write(`code: ${failure}\n`);
|
|
9
|
+
// exitCode, not process.exit: exit can drop the stderr line on a macOS pipe.
|
|
10
|
+
process.exitCode = code;
|
package/dist/mailroom/entry.js
CHANGED
|
@@ -42,6 +42,7 @@ const runtime_1 = require("../nerves/runtime");
|
|
|
42
42
|
const blob_store_1 = require("./blob-store");
|
|
43
43
|
const file_store_1 = require("./file-store");
|
|
44
44
|
const smtp_ingress_1 = require("./smtp-ingress");
|
|
45
|
+
const failure_code_1 = require("../heart/daemon/cli-commands/failure-code");
|
|
45
46
|
const KEY_VALUE_ARGS = new Map([
|
|
46
47
|
["registry", "--registry"],
|
|
47
48
|
["registry-base64", "--registry-base64"],
|
|
@@ -79,7 +80,7 @@ function optionalNumber(args, flag, fallback) {
|
|
|
79
80
|
return fallback;
|
|
80
81
|
const value = Number.parseInt(args[index + 1] ?? "", 10);
|
|
81
82
|
if (!Number.isInteger(value) || value < 0 || value > 65535) {
|
|
82
|
-
throw new Error(`${flag} must be a TCP port`);
|
|
83
|
+
throw Object.assign(new Error(`${flag} must be a TCP port`), { code: "bad-port" });
|
|
83
84
|
}
|
|
84
85
|
return value;
|
|
85
86
|
}
|
|
@@ -91,12 +92,12 @@ function parseMailroomEntryArgs(args) {
|
|
|
91
92
|
const storePath = optionalValue(expanded, "--store");
|
|
92
93
|
const azureAccountUrl = optionalValue(expanded, "--azure-account-url");
|
|
93
94
|
if (!storePath && !azureAccountUrl) {
|
|
94
|
-
throw new Error("Missing --store or --azure-account-url");
|
|
95
|
+
throw Object.assign(new Error("Missing --store or --azure-account-url"), { code: "missing-store" });
|
|
95
96
|
}
|
|
96
97
|
const registryPath = optionalValue(expanded, "--registry");
|
|
97
98
|
const registryBase64 = optionalValue(expanded, "--registry-base64");
|
|
98
99
|
if (!registryPath && !registryBase64) {
|
|
99
|
-
throw new Error("Missing --registry or --registry-base64");
|
|
100
|
+
throw Object.assign(new Error("Missing --registry or --registry-base64"), { code: "missing-registry" });
|
|
100
101
|
}
|
|
101
102
|
const parsed = {
|
|
102
103
|
...(registryPath ? { registryPath } : {}),
|
|
@@ -153,8 +154,16 @@ function runMailroomEntry(args = process.argv.slice(2)) {
|
|
|
153
154
|
});
|
|
154
155
|
return servers;
|
|
155
156
|
}
|
|
157
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
158
|
+
const CARD_CODES = ["missing-store", "missing-registry", "bad-port"];
|
|
156
159
|
/* v8 ignore start -- exercised by packaged/container entrypoint smoke rather than in-process unit tests. @preserve */
|
|
157
160
|
if (require.main === module) {
|
|
158
|
-
|
|
161
|
+
try {
|
|
162
|
+
runMailroomEntry();
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
159
168
|
}
|
|
160
169
|
/* v8 ignore stop */
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_1 = require("./cli");
|
|
4
4
|
const code = (0, cli_1.runAuditCli)(process.argv.slice(2));
|
|
5
|
-
|
|
5
|
+
// A failure ends stderr with its code, as every ouro command's does.
|
|
6
|
+
const failure = { 1: "audit-failed", 2: "no-run-dir" }[code];
|
|
7
|
+
if (failure)
|
|
8
|
+
process.stderr.write(`code: ${failure}\n`);
|
|
9
|
+
// exitCode, not process.exit: exit can drop the stderr line on a macOS pipe.
|
|
10
|
+
process.exitCode = code;
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_1 = require("./cli");
|
|
4
4
|
const code = (0, cli_1.runNervesReviewCli)(process.argv.slice(2));
|
|
5
|
-
|
|
5
|
+
// A failure ends stderr with its code, as every ouro command's does.
|
|
6
|
+
const failure = { 2: "bad-duration" }[code];
|
|
7
|
+
if (failure)
|
|
8
|
+
process.stderr.write(`code: ${failure}\n`);
|
|
9
|
+
// exitCode, not process.exit: exit can drop the stderr line on a macOS pipe.
|
|
10
|
+
process.exitCode = code;
|
package/dist/senses/a2a-entry.js
CHANGED
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/a2a-entry.js --agent ouroboros [--port 18920] [--base-url https://agent.example]\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
function argValue(name) {
|
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/app-sessions-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
@@ -35,11 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
};
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const MISSING_AGENT = "missing-agent";
|
|
38
39
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
39
40
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
40
41
|
if (!agentName) {
|
|
41
42
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
42
|
-
console.error(
|
|
43
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/bluebubbles/entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
43
44
|
process.exit(1);
|
|
44
45
|
}
|
|
45
46
|
const runtime_logging_1 = require("../../heart/daemon/runtime-logging");
|
package/dist/senses/cli-entry.js
CHANGED
|
@@ -35,11 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const runtime_1 = require("../nerves/runtime");
|
|
37
37
|
// Fail fast if --agent is missing (before any src/ code tries getAgentName())
|
|
38
|
+
const MISSING_AGENT = "missing-agent";
|
|
38
39
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
39
40
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
40
41
|
if (!agentName) {
|
|
41
42
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
42
|
-
console.error(
|
|
43
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/cli-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
43
44
|
process.exit(1);
|
|
44
45
|
}
|
|
45
46
|
(0, runtime_1.emitNervesEvent)({
|
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/mail-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
@@ -9,4 +9,13 @@ const runtime_1 = require("../nerves/runtime");
|
|
|
9
9
|
message: "booting Sanctuary health acceptance probe entrypoint",
|
|
10
10
|
meta: { entry: "sanctuary-health-acceptance-probe" },
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
const argv = process.argv.slice(2);
|
|
13
|
+
// No step, or a word that isn't one: say so before the probe starts. A step's coordinates are the probe's to refuse.
|
|
14
|
+
if (!(0, sanctuary_health_acceptance_probe_1.isSanctuaryHealthAcceptanceProbeMode)(argv[0])) {
|
|
15
|
+
const code = argv.length === 0 ? "missing-mode" : "usage";
|
|
16
|
+
process.stderr.write(`${sanctuary_health_acceptance_probe_1.SANCTUARY_HEALTH_ACCEPTANCE_PROBE_USAGE}\ncode: ${code}\n`);
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
(0, sanctuary_health_acceptance_probe_1.startSanctuaryHealthAcceptanceProbeCli)(argv, (0, sanctuary_health_acceptance_probe_1.createSanctuaryHealthAcceptanceProbeCliOutput)());
|
|
21
|
+
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.SANCTUARY_HEALTH_ACCEPTANCE_PROBE_USAGE = void 0;
|
|
37
38
|
exports.acceptanceTargetEndpoint = acceptanceTargetEndpoint;
|
|
38
39
|
exports.registerSanctuaryHealthAcceptanceProbeProcess = registerSanctuaryHealthAcceptanceProbeProcess;
|
|
39
40
|
exports.createSanctuaryHealthAcceptanceProbeProcessHost = createSanctuaryHealthAcceptanceProbeProcessHost;
|
|
@@ -45,6 +46,7 @@ exports.createSanctuaryHealthAcceptanceProbeDependencies = createSanctuaryHealth
|
|
|
45
46
|
exports.runSanctuaryHealthAcceptanceProbe = runSanctuaryHealthAcceptanceProbe;
|
|
46
47
|
exports.finalizeSanctuaryHealthAcceptanceProbe = finalizeSanctuaryHealthAcceptanceProbe;
|
|
47
48
|
exports.recoverSanctuaryHealthAcceptanceProbe = recoverSanctuaryHealthAcceptanceProbe;
|
|
49
|
+
exports.isSanctuaryHealthAcceptanceProbeMode = isSanctuaryHealthAcceptanceProbeMode;
|
|
48
50
|
exports.createSanctuaryHealthAcceptanceProbeCliHost = createSanctuaryHealthAcceptanceProbeCliHost;
|
|
49
51
|
exports.runSanctuaryHealthAcceptanceProbeCli = runSanctuaryHealthAcceptanceProbeCli;
|
|
50
52
|
exports.createSanctuaryHealthAcceptanceProbeCliOutput = createSanctuaryHealthAcceptanceProbeCliOutput;
|
|
@@ -62,6 +64,7 @@ const sanctuary_health_runner_1 = require("./sanctuary-health-runner");
|
|
|
62
64
|
const sanctuary_runtime_1 = require("./sanctuary-runtime");
|
|
63
65
|
const sanctuary_scheduler_liveness_1 = require("../heart/daemon/sanctuary-scheduler-liveness");
|
|
64
66
|
const telegram_1 = require("./telegram");
|
|
67
|
+
const failure_code_1 = require("../heart/daemon/cli-commands/failure-code");
|
|
65
68
|
const SHA256 = /^[0-9a-f]{64}$/u;
|
|
66
69
|
/** The probe faults the household's Books endpoint, else its first public endpoint. */
|
|
67
70
|
function acceptanceTargetEndpoint(house) {
|
|
@@ -718,20 +721,31 @@ async function recoverSanctuaryHealthAcceptanceProbe(input, dependencies = creat
|
|
|
718
721
|
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.sanctuary_health_acceptance_recovered", message: "Sanctuary health acceptance probe state was restored", meta: { label: input.label, scenarioHandleDigest: input.scenarioHandleDigest } });
|
|
719
722
|
return { recovered: true };
|
|
720
723
|
}
|
|
724
|
+
/** The probe's usage line, which a malformed command line gets back. */
|
|
725
|
+
exports.SANCTUARY_HEALTH_ACCEPTANCE_PROBE_USAGE = "usage: sanctuary-health-acceptance-probe <run|stop|recover|finalize> --label <label> --scenario <digest> --owner-image <digest> --owner-container <digest> [--owner-image-after <digest> --owner-container-after <digest>]";
|
|
726
|
+
/** Whether a word is one of the probe's steps: run, stop, recover or finalize. */
|
|
727
|
+
function isSanctuaryHealthAcceptanceProbeMode(word) {
|
|
728
|
+
return word === "run" || word === "stop" || word === "recover" || word === "finalize";
|
|
729
|
+
}
|
|
721
730
|
function parseCli(argv) {
|
|
722
731
|
if ((argv.length !== 9 && argv.length !== 13) || (argv[0] !== "run" && argv[0] !== "stop" && argv[0] !== "recover" && argv[0] !== "finalize")
|
|
723
732
|
|| argv[1] !== "--label" || argv[3] !== "--scenario" || argv[5] !== "--owner-image" || argv[7] !== "--owner-container") {
|
|
724
|
-
throw new Error(
|
|
733
|
+
throw Object.assign(new Error(exports.SANCTUARY_HEALTH_ACCEPTANCE_PROBE_USAGE), { code: "usage" });
|
|
725
734
|
}
|
|
726
735
|
const input = { label: argv[2], scenarioHandleDigest: argv[4], ownerImageDigest: argv[6], ownerContainerDigest: argv[8] };
|
|
727
|
-
|
|
736
|
+
try {
|
|
737
|
+
canonicalInput(input);
|
|
738
|
+
}
|
|
739
|
+
catch (error) {
|
|
740
|
+
throw Object.assign(new Error(error.message), { code: "usage" });
|
|
741
|
+
}
|
|
728
742
|
if (argv[0] === "finalize") {
|
|
729
|
-
if (argv.length !== 13 || argv[9] !== "--owner-image-after" || argv[11] !== "--owner-container-after")
|
|
730
|
-
throw new Error("Sanctuary health acceptance finalize coordinates are invalid");
|
|
743
|
+
if (argv.length !== 13 || argv[9] !== "--owner-image-after" || argv[11] !== "--owner-container-after" || !SHA256.test(argv[10]) || !SHA256.test(argv[12]))
|
|
744
|
+
throw Object.assign(new Error("Sanctuary health acceptance finalize coordinates are invalid"), { code: "usage" });
|
|
731
745
|
return { mode: argv[0], input, after: { ownerImageDigest: argv[10], ownerContainerDigest: argv[12] } };
|
|
732
746
|
}
|
|
733
747
|
if (argv.length !== 9)
|
|
734
|
-
throw new Error("Sanctuary health acceptance probe coordinates are invalid");
|
|
748
|
+
throw Object.assign(new Error("Sanctuary health acceptance probe coordinates are invalid"), { code: "usage" });
|
|
735
749
|
return { mode: argv[0], input };
|
|
736
750
|
}
|
|
737
751
|
function createSanctuaryHealthAcceptanceProbeCliHost(target = process) {
|
|
@@ -778,9 +792,11 @@ function createSanctuaryHealthAcceptanceProbeCliOutput(target = process) {
|
|
|
778
792
|
setExitCode: (code) => { target.exitCode = code; },
|
|
779
793
|
};
|
|
780
794
|
}
|
|
795
|
+
/** The codes this program's card names; only these end its stderr (see failure-code.ts). */
|
|
796
|
+
const CARD_CODES = ["usage"];
|
|
781
797
|
function startSanctuaryHealthAcceptanceProbeCli(argv, output, options = {}) {
|
|
782
798
|
void runSanctuaryHealthAcceptanceProbeCli(argv, options).catch((error) => {
|
|
783
|
-
output.writeError(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
799
|
+
output.writeError(`${error instanceof Error ? error.message : String(error)}\n${(0, failure_code_1.failureCodeLine)(error, CARD_CODES)}`);
|
|
784
800
|
output.setExitCode(1);
|
|
785
801
|
});
|
|
786
802
|
}
|
|
@@ -147,8 +147,10 @@ async function runShepherdJudgeEvaluationCommand(argv, dependencies = {
|
|
|
147
147
|
exitCode = report.classificationPassed ? 0 : 1;
|
|
148
148
|
}
|
|
149
149
|
catch (error) {
|
|
150
|
+
// 2: the evaluation couldn't run (bad arguments, no judge, a bad corpus or output), apart from 1, a failed run.
|
|
151
|
+
exitCode = 2;
|
|
150
152
|
const detail = (0, redact_1.redactSecrets)(String(error)).slice(0, 2000);
|
|
151
|
-
dependencies.print(JSON.stringify({ error: detail, v1Qualified: false }));
|
|
153
|
+
dependencies.print(JSON.stringify({ error: detail, code: "evaluation-error", v1Qualified: false }));
|
|
152
154
|
if (output) {
|
|
153
155
|
try {
|
|
154
156
|
output.write({ schemaVersion: 1, phase: "judge-classification-only", state: "error", error: detail, v1Qualified: false });
|
|
@@ -167,7 +169,7 @@ async function runShepherdJudgeEvaluationCommand(argv, dependencies = {
|
|
|
167
169
|
outputClosed = output !== null;
|
|
168
170
|
}
|
|
169
171
|
catch (error) {
|
|
170
|
-
exitCode = 1;
|
|
172
|
+
exitCode = Math.max(exitCode, 1);
|
|
171
173
|
const detail = (0, redact_1.redactSecrets)(String(error)).slice(0, 2000);
|
|
172
174
|
dependencies.print(JSON.stringify({ error: `Could not close evaluation output: ${detail}`, v1Qualified: false }));
|
|
173
175
|
(0, runtime_1.emitNervesEvent)({ component: "senses", level: "error", event: "senses.shepherd_judge_evaluation_output_close_error",
|
|
@@ -3,11 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const judge_evaluation_command_1 = require("./judge-evaluation-command");
|
|
4
4
|
const runtime_1 = require("../../nerves/runtime");
|
|
5
5
|
const redact_1 = require("./redact");
|
|
6
|
-
void (0, judge_evaluation_command_1.runShepherdJudgeEvaluationCommand)(process.argv.slice(2)).then(code => {
|
|
6
|
+
void (0, judge_evaluation_command_1.runShepherdJudgeEvaluationCommand)(process.argv.slice(2)).then(code => {
|
|
7
|
+
// The JSON on stdout says why; stderr's last line names the failure for a script: 1 a run that finished and
|
|
8
|
+
// failed, 2 a run that couldn't start or finish.
|
|
9
|
+
const failure = code === 1 ? "not-passed" : "evaluation-error";
|
|
10
|
+
if (code !== 0)
|
|
11
|
+
process.stderr.write(`code: ${failure}\n`);
|
|
12
|
+
process.exitCode = code;
|
|
13
|
+
}).catch(error => {
|
|
7
14
|
const detail = (0, redact_1.redactSecrets)(String(error)).slice(0, 2000);
|
|
8
15
|
(0, runtime_1.emitNervesEvent)({ component: "senses", level: "error", event: "senses.shepherd_judge_evaluation_entry_error",
|
|
9
16
|
message: "classification command rejected unexpectedly", meta: { phase: "judge-classification-only", error: detail } });
|
|
10
17
|
// eslint-disable-next-line no-console -- terminal UX: last-resort nonzero evaluation failure
|
|
11
|
-
console.error(JSON.stringify({ error: detail, v1Qualified: false }));
|
|
18
|
+
console.error(JSON.stringify({ error: detail, code: "evaluation-crashed", v1Qualified: false }));
|
|
12
19
|
process.exitCode = 1;
|
|
13
20
|
});
|
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/shepherd-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
@@ -36,11 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
37
37
|
const runtime_1 = require("../nerves/runtime");
|
|
38
38
|
// Fail fast if --agent is missing (before any src/ code tries getAgentName())
|
|
39
|
+
const MISSING_AGENT = "missing-agent";
|
|
39
40
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
40
41
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
41
42
|
if (!agentName) {
|
|
42
43
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
43
|
-
console.error(
|
|
44
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/teams-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
44
45
|
process.exit(1);
|
|
45
46
|
}
|
|
46
47
|
// Without this the sense's events go to a console nobody reads: the daemon discards its output.
|
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/telegram-entry.js --agent butler\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const MISSING_AGENT = "missing-agent";
|
|
36
37
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
37
38
|
const agentName = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
38
39
|
if (!agentName) {
|
|
39
40
|
// eslint-disable-next-line no-console -- pre-boot guard: --agent check before imports
|
|
40
|
-
console.error(
|
|
41
|
+
console.error(`Missing required --agent <name> argument.\nUsage: node dist/senses/voice-entry.js --agent ouroboros\ncode: ${MISSING_AGENT}`);
|
|
41
42
|
process.exit(1);
|
|
42
43
|
}
|
|
43
44
|
const runtime_logging_1 = require("../heart/daemon/runtime-logging");
|
|
@@ -17,5 +17,9 @@ const result = (0, voice_realtime_eval_command_1.runVoiceRealtimeEvalCommand)(pr
|
|
|
17
17
|
});
|
|
18
18
|
// eslint-disable-next-line no-console -- terminal UX: eval command summary
|
|
19
19
|
console.log(JSON.stringify(result.payload, null, 2));
|
|
20
|
-
if (result.exitCode !== 0)
|
|
21
|
-
|
|
20
|
+
if (result.exitCode !== 0) {
|
|
21
|
+
// stderr's last line names the failure: a bad --trace argument or file, or a scenario that didn't match.
|
|
22
|
+
process.stderr.write(`code: ${result.payload.error === undefined ? "eval-failed" : "eval-error"}\n`);
|
|
23
|
+
// exitCode, not process.exit: exit can drop the stderr line on a macOS pipe.
|
|
24
|
+
process.exitCode = result.exitCode;
|
|
25
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MISSING_AGENT = "missing-agent";
|
|
3
4
|
function readRequiredAgentName() {
|
|
4
5
|
const agentArgIndex = process.argv.indexOf("--agent");
|
|
5
6
|
const value = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : undefined;
|
|
6
7
|
if (value)
|
|
7
8
|
return value;
|
|
8
|
-
process.stderr.write(
|
|
9
|
+
process.stderr.write(`Missing required --agent <name> argument.\nUsage: node dist/senses/voice-twilio-entry.js --agent ouroboros --public-url https://<tunnel>\ncode: ${MISSING_AGENT}\n`);
|
|
9
10
|
process.exit(1);
|
|
10
11
|
}
|
|
11
12
|
const agentName = readRequiredAgentName();
|
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.1301",
|
|
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.1301",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|