@ouro.bot/cli 0.1.0-alpha.1660 → 0.1.0-alpha.1662
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 +7 -0
- package/deploy/unraid/Dockerfile +2 -0
- package/deploy/unraid/sanctuary-unit16-host-broker.mjs +11 -2
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/container-runtime.js +22 -4
- package/dist/heart/daemon/container-spec-auditor.js +3 -3
- package/dist/heart/product/active.js +65 -0
- package/dist/heart/product/types.js +2 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
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.1662",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The Butler's image may name a product module in `/opt/ouro/container-runtime.json`. The harness checks and loads it, and then asks it what that product adds. No image names one yet, so behaviour is unchanged. In the image the policy file is now owned by root and read-only, so the agent can't change which code it loads.",
|
|
8
|
+
"Update the Ouro UI files to Ouro UI v1.3.599."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
4
11
|
{
|
|
5
12
|
"version": "0.1.0-alpha.1660",
|
|
6
13
|
"changes": [
|
package/deploy/unraid/Dockerfile
CHANGED
|
@@ -64,6 +64,8 @@ RUN chown root:root /etc/ouro /etc/ouro/github_known_hosts /usr/local/libexec/ou
|
|
|
64
64
|
&& visudo -cf /etc/sudoers.d/ouro-sync
|
|
65
65
|
COPY assets/sanctuary-host-launcher.sh /opt/ouro/deploy/unraid/sanctuary-host-launcher.sh
|
|
66
66
|
RUN chown -R 10001:10001 /opt/ouro /home/ouro
|
|
67
|
+
# The runtime policy names the product module to load, so the agent (10001) must not be able to change it.
|
|
68
|
+
RUN chown root:root /opt/ouro/container-runtime.json && chmod 0444 /opt/ouro/container-runtime.json
|
|
67
69
|
|
|
68
70
|
USER 10001:10001
|
|
69
71
|
ENV HOME=/home/ouro
|
|
@@ -349,8 +349,16 @@ function updaterDisabled(expectedImage) {
|
|
|
349
349
|
env: { PATH: "/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin" }, stdio: ["ignore", "pipe", "ignore"],
|
|
350
350
|
})
|
|
351
351
|
if (result.error || result.status !== 0) throw new Error("container runtime policy read failed")
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
return runtimePolicyDisablesUpdates(result.stdout)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function runtimePolicyDisablesUpdates(text) {
|
|
356
|
+
const policy = object(JSON.parse(text), "container runtime policy")
|
|
357
|
+
// An image may also name its product module (an absolute path under /opt ending in .js); the policy is otherwise exact.
|
|
358
|
+
exactKeys(policy, policy.product === undefined ? ["scheduler", "updates"] : ["product", "scheduler", "updates"], "container runtime policy")
|
|
359
|
+
if (policy.product !== undefined && !(typeof policy.product === "string" && /^\/opt\/[a-z0-9][a-z0-9/_.-]*\.js$/u.test(policy.product) && !policy.product.split("/").includes(".."))) {
|
|
360
|
+
throw new Error("container runtime policy product is invalid")
|
|
361
|
+
}
|
|
354
362
|
return policy.scheduler === "supercronic" && policy.updates === "disabled"
|
|
355
363
|
}
|
|
356
364
|
|
|
@@ -2059,6 +2067,7 @@ if (process.argv[1]?.endsWith("sanctuary-unit16-host-broker.mjs")) {
|
|
|
2059
2067
|
|
|
2060
2068
|
export {
|
|
2061
2069
|
acknowledgeStoredUnraidKey,
|
|
2070
|
+
runtimePolicyDisablesUpdates,
|
|
2062
2071
|
assertStableContainerProcess,
|
|
2063
2072
|
attestHealthProbeProcessAbsent,
|
|
2064
2073
|
armRestartAfterResponseClosed,
|
|
@@ -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.1662</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -33,12 +33,31 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isProductModulePath = isProductModulePath;
|
|
37
|
+
exports.isContainerRuntimePolicy = isContainerRuntimePolicy;
|
|
36
38
|
exports.hasManagedAgentProcess = hasManagedAgentProcess;
|
|
37
39
|
exports.hasManagedTelegramProcess = hasManagedTelegramProcess;
|
|
38
40
|
exports.hasManagedSupercronicProcess = hasManagedSupercronicProcess;
|
|
39
41
|
exports.readContainerRuntimePolicy = readContainerRuntimePolicy;
|
|
40
42
|
const fs = __importStar(require("node:fs"));
|
|
41
43
|
const runtime_1 = require("../../nerves/runtime");
|
|
44
|
+
/**
|
|
45
|
+
* The product module an image may name (`product`): an absolute path to a built .js file inside the image. The image's
|
|
46
|
+
* build chooses it and the file is root-owned, so the agent's own files never choose which code loads.
|
|
47
|
+
*/
|
|
48
|
+
function isProductModulePath(value) {
|
|
49
|
+
return typeof value === "string" && /^\/opt\/[a-z0-9][a-z0-9/_.-]*\.js$/u.test(value) && !value.split("/").includes("..");
|
|
50
|
+
}
|
|
51
|
+
/** Whether a parsed container runtime policy is exactly the locked policy: scheduler and updates, and optionally product. */
|
|
52
|
+
function isContainerRuntimePolicy(value) {
|
|
53
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
54
|
+
return false;
|
|
55
|
+
const policy = value;
|
|
56
|
+
const keys = Object.keys(policy).sort().join(",");
|
|
57
|
+
if (keys !== "scheduler,updates" && keys !== "product,scheduler,updates")
|
|
58
|
+
return false;
|
|
59
|
+
return policy.scheduler === "supercronic" && policy.updates === "disabled" && (policy.product === undefined || isProductModulePath(policy.product));
|
|
60
|
+
}
|
|
42
61
|
function hasManagedAgentProcess(processArguments, agent) {
|
|
43
62
|
const wanted = agent.trim();
|
|
44
63
|
if (!wanted)
|
|
@@ -89,9 +108,8 @@ function readContainerRuntimePolicy(options = {}) {
|
|
|
89
108
|
throw error;
|
|
90
109
|
}
|
|
91
110
|
const value = JSON.parse(raw);
|
|
92
|
-
if (
|
|
111
|
+
if (!isContainerRuntimePolicy(value))
|
|
93
112
|
throw new Error("container runtime policy is invalid");
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return { scheduler: "supercronic", updates: "disabled" };
|
|
113
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.container_runtime_policy_loaded", message: "container runtime policy loaded", meta: { scheduler: value.scheduler, updates: value.updates, product: value.product ?? null } });
|
|
114
|
+
return value.product === undefined ? { scheduler: "supercronic", updates: "disabled" } : { scheduler: "supercronic", updates: "disabled", product: value.product };
|
|
97
115
|
}
|
|
@@ -5,6 +5,7 @@ exports.auditSanctuaryStagedFiles = auditSanctuaryStagedFiles;
|
|
|
5
5
|
exports.auditSanctuaryPersistentTemplate = auditSanctuaryPersistentTemplate;
|
|
6
6
|
const runtime_1 = require("../../nerves/runtime");
|
|
7
7
|
const butler_agent_1 = require("../butler-agent");
|
|
8
|
+
const container_runtime_1 = require("./container-runtime");
|
|
8
9
|
const { parseDockerManTemplateXml } = require("../../../deploy/unraid/docker-man-template-xml.cjs");
|
|
9
10
|
// The host folders never change with the Butler's name: the bundle stays in sanctuary.ouro on the live host. Only where the
|
|
10
11
|
// bundle, its psyche and the operator trust are mounted inside the container follows the name the image runs.
|
|
@@ -222,9 +223,8 @@ function auditTemplate(input, expectedRepository, repositoryIsValid, repositoryV
|
|
|
222
223
|
catch {
|
|
223
224
|
runtimePolicy = null;
|
|
224
225
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
violations.push("container runtime policy must be exactly scheduler=supercronic and updates=disabled");
|
|
226
|
+
if (!(0, container_runtime_1.isContainerRuntimePolicy)(runtimePolicy)) {
|
|
227
|
+
violations.push("container runtime policy must be exactly scheduler=supercronic and updates=disabled, with an optional product module under /opt");
|
|
228
228
|
}
|
|
229
229
|
const configEntries = directChildren(template, "Config");
|
|
230
230
|
const pathConfigs = configEntries.map((entry) => {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRODUCT_SEAM_VERSION = void 0;
|
|
4
|
+
exports.loadProduct = loadProduct;
|
|
5
|
+
exports.productFor = productFor;
|
|
6
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
7
|
+
/** The seam version this harness runs. A product built for another stops the start. */
|
|
8
|
+
exports.PRODUCT_SEAM_VERSION = 1;
|
|
9
|
+
let active = null;
|
|
10
|
+
function invalid(modulePath, problem) {
|
|
11
|
+
(0, runtime_1.emitNervesEvent)({
|
|
12
|
+
level: "error",
|
|
13
|
+
component: "daemon",
|
|
14
|
+
event: "daemon.product_load_error",
|
|
15
|
+
message: "product module is invalid",
|
|
16
|
+
meta: { modulePath, problem },
|
|
17
|
+
});
|
|
18
|
+
return new Error(`product module ${modulePath} is invalid: ${problem}. Rebuild the image so its product module exports a valid \`product\`.`);
|
|
19
|
+
}
|
|
20
|
+
function validProduct(value, modulePath) {
|
|
21
|
+
const product = value && typeof value === "object" ? value.product : undefined;
|
|
22
|
+
if (!product || typeof product !== "object")
|
|
23
|
+
throw invalid(modulePath, "it does not export `product`");
|
|
24
|
+
const { seamVersion, id, agents } = product;
|
|
25
|
+
if (seamVersion !== exports.PRODUCT_SEAM_VERSION)
|
|
26
|
+
throw invalid(modulePath, `it is for seam version ${String(seamVersion)}, and this harness runs version ${exports.PRODUCT_SEAM_VERSION}`);
|
|
27
|
+
if (typeof id !== "string" || !/^[a-z][a-z0-9-]*$/u.test(id))
|
|
28
|
+
throw invalid(modulePath, "its id is not a lowercase name");
|
|
29
|
+
if (!Array.isArray(agents) || agents.length === 0 || !agents.every((name) => typeof name === "string" && /^[a-z][a-z0-9-]*$/u.test(name))) {
|
|
30
|
+
throw invalid(modulePath, "its agents are not a list of agent names");
|
|
31
|
+
}
|
|
32
|
+
if (new Set(agents).size !== agents.length)
|
|
33
|
+
throw invalid(modulePath, "its agents list a name twice");
|
|
34
|
+
return product;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Loads the product module the image names, and makes it the one `productFor` answers with. No path means no product:
|
|
38
|
+
* on a Mac, in dev and in tests nothing loads, and core behaves as it always has. A module that fails to load or is
|
|
39
|
+
* invalid stops the start.
|
|
40
|
+
*/
|
|
41
|
+
function loadProduct(modulePath, load = require) {
|
|
42
|
+
if (modulePath === undefined) {
|
|
43
|
+
active = null;
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
let loaded;
|
|
47
|
+
try {
|
|
48
|
+
loaded = load(modulePath);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw invalid(modulePath, `it did not load (${error instanceof Error ? error.message : String(error)})`);
|
|
52
|
+
}
|
|
53
|
+
active = validProduct(loaded, modulePath);
|
|
54
|
+
(0, runtime_1.emitNervesEvent)({
|
|
55
|
+
component: "daemon",
|
|
56
|
+
event: "daemon.product_loaded",
|
|
57
|
+
message: "product module loaded",
|
|
58
|
+
meta: { modulePath, id: active.id, agents: [...active.agents] },
|
|
59
|
+
});
|
|
60
|
+
return active;
|
|
61
|
+
}
|
|
62
|
+
/** The loaded product when this agent is one of its names, else null. */
|
|
63
|
+
function productFor(agentName) {
|
|
64
|
+
return active && active.agents.includes(agentName) ? active : null;
|
|
65
|
+
}
|
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.1662",
|
|
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.1662",
|
|
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.1662",
|
|
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": {
|