@ouro.bot/cli 0.1.0-alpha.775 → 0.1.0-alpha.777
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 +12 -0
- package/deploy/unraid/README.txt +1 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +2 -2
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/agent-entry.js +69 -6
- package/dist/heart/daemon/daemon.js +54 -9
- package/dist/heart/daemon/process-manager.js +113 -4
- package/dist/heart/external-events/router.js +14 -0
- package/dist/heart/tool-loop.js +1 -1
- package/dist/repertoire/tools-continuity.js +199 -146
- package/dist/senses/private-runtime-worker.js +287 -208
- package/dist/senses/private-runtime.js +4 -1
- package/dist/senses/sanctuary-runtime.js +43 -0
- package/npm-shrinkwrap.json +40 -25
- package/package.json +1 -1
|
@@ -35,12 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.runWithSanctuaryToolReceiptCollection = runWithSanctuaryToolReceiptCollection;
|
|
37
37
|
exports.loadSanctuarySabApiKey = loadSanctuarySabApiKey;
|
|
38
|
+
exports.ensureSanctuarySourceRuntimeReady = ensureSanctuarySourceRuntimeReady;
|
|
38
39
|
exports.createSanctuaryToolContext = createSanctuaryToolContext;
|
|
39
40
|
const fs = __importStar(require("node:fs"));
|
|
40
41
|
const path = __importStar(require("node:path"));
|
|
41
42
|
const node_crypto_1 = require("node:crypto");
|
|
42
43
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
43
44
|
const identity_1 = require("../heart/identity");
|
|
45
|
+
const machine_identity_1 = require("../heart/machine-identity");
|
|
44
46
|
const runtime_credentials_1 = require("../heart/runtime-credentials");
|
|
45
47
|
const unraid_restart_1 = require("../repertoire/unraid-restart");
|
|
46
48
|
const steward_policy_1 = require("../heart/steward-policy");
|
|
@@ -55,6 +57,9 @@ const sanctuary_media_optimization_1 = require("./sanctuary-media-optimization")
|
|
|
55
57
|
const sanctuaryToolReceipts = new node_async_hooks_1.AsyncLocalStorage();
|
|
56
58
|
const sanctuaryToolGroundings = new node_async_hooks_1.AsyncLocalStorage();
|
|
57
59
|
const acceptanceLedgerTails = new Map();
|
|
60
|
+
function isSanctuaryExternalEventSource(source) {
|
|
61
|
+
return source === "sanctuary-health" || source === "sanctuary-usenet";
|
|
62
|
+
}
|
|
58
63
|
async function runWithSanctuaryToolReceiptCollection(operation, observer) {
|
|
59
64
|
const digests = observer?.toolResultDigests ?? [];
|
|
60
65
|
const groundings = observer?.toolGroundings ?? [];
|
|
@@ -118,6 +123,44 @@ function optionalJellyfin(config) {
|
|
|
118
123
|
jellyfinFolderIds: requiredPair(jellyfin, "folderIds"),
|
|
119
124
|
};
|
|
120
125
|
}
|
|
126
|
+
function readinessMissing(agentName, field) {
|
|
127
|
+
return new Error(`[human-required] Sanctuary ${field} is missing; run ouro connect --agent ${agentName} to attach the required machine credential.`);
|
|
128
|
+
}
|
|
129
|
+
function readinessRequired(config, agentName, field, label = field) {
|
|
130
|
+
const value = config[field];
|
|
131
|
+
if (typeof value !== "string" || value.trim().length === 0)
|
|
132
|
+
throw readinessMissing(agentName, label);
|
|
133
|
+
return value.trim();
|
|
134
|
+
}
|
|
135
|
+
function validateSanctuarySourceRuntime(agentName, source, config) {
|
|
136
|
+
readinessRequired(config, agentName, "unraidGraphqlUrl");
|
|
137
|
+
readinessRequired(config, agentName, "unraidReadApiKey");
|
|
138
|
+
if (config.jellyfin !== undefined) {
|
|
139
|
+
if (!config.jellyfin || typeof config.jellyfin !== "object" || Array.isArray(config.jellyfin))
|
|
140
|
+
throw readinessMissing(agentName, "jellyfin");
|
|
141
|
+
const jellyfin = config.jellyfin;
|
|
142
|
+
readinessRequired(jellyfin, agentName, "userId", "jellyfin.userId");
|
|
143
|
+
readinessRequired(jellyfin, agentName, "accessToken", "jellyfin.accessToken");
|
|
144
|
+
const folderIds = readinessRequired(jellyfin, agentName, "folderIds", "jellyfin.folderIds").split(",").map((value) => value.trim());
|
|
145
|
+
if (folderIds.length !== 2 || new Set(folderIds).size !== 2 || folderIds.some((value) => value.length === 0))
|
|
146
|
+
throw readinessMissing(agentName, "jellyfin.folderIds");
|
|
147
|
+
}
|
|
148
|
+
if (source === "sanctuary-usenet")
|
|
149
|
+
readinessRequired(config, agentName, "sabnzbdApiKey");
|
|
150
|
+
}
|
|
151
|
+
async function ensureSanctuarySourceRuntimeReady(agentName, source) {
|
|
152
|
+
if (!isSanctuaryExternalEventSource(source))
|
|
153
|
+
return;
|
|
154
|
+
let current = (0, runtime_credentials_1.readMachineRuntimeCredentialConfig)(agentName);
|
|
155
|
+
if (!current.ok) {
|
|
156
|
+
const machine = (0, machine_identity_1.loadOrCreateMachineIdentity)();
|
|
157
|
+
current = await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(agentName, machine.machineId, { preserveCachedOnFailure: true });
|
|
158
|
+
}
|
|
159
|
+
if (!current.ok) {
|
|
160
|
+
throw new Error(`[agent-runnable] Sanctuary machine runtime credentials are unavailable; retry the machine credential refresh for agent ${agentName} after its vault is unlocked.`);
|
|
161
|
+
}
|
|
162
|
+
validateSanctuarySourceRuntime(agentName, source, current.config);
|
|
163
|
+
}
|
|
121
164
|
function persistAttempt(filePath, attempt) {
|
|
122
165
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
123
166
|
const temporary = `${filePath}.tmp-${process.pid}-${(0, node_crypto_1.randomUUID)()}`;
|
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.777",
|
|
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.777",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@azure/identity": "^4.13.0",
|
|
@@ -1056,29 +1056,43 @@
|
|
|
1056
1056
|
"license": "BSD-3-Clause"
|
|
1057
1057
|
},
|
|
1058
1058
|
"node_modules/@humanfs/core": {
|
|
1059
|
-
"version": "0.19.
|
|
1060
|
-
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.
|
|
1061
|
-
"integrity": "sha512-
|
|
1059
|
+
"version": "0.19.2",
|
|
1060
|
+
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
|
|
1061
|
+
"integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
|
|
1062
1062
|
"dev": true,
|
|
1063
1063
|
"license": "Apache-2.0",
|
|
1064
|
+
"dependencies": {
|
|
1065
|
+
"@humanfs/types": "^0.15.0"
|
|
1066
|
+
},
|
|
1064
1067
|
"engines": {
|
|
1065
1068
|
"node": ">=18.18.0"
|
|
1066
1069
|
}
|
|
1067
1070
|
},
|
|
1068
1071
|
"node_modules/@humanfs/node": {
|
|
1069
|
-
"version": "0.16.
|
|
1070
|
-
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.
|
|
1071
|
-
"integrity": "sha512
|
|
1072
|
+
"version": "0.16.8",
|
|
1073
|
+
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
|
|
1074
|
+
"integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
|
|
1072
1075
|
"dev": true,
|
|
1073
1076
|
"license": "Apache-2.0",
|
|
1074
1077
|
"dependencies": {
|
|
1075
|
-
"@humanfs/core": "^0.19.
|
|
1078
|
+
"@humanfs/core": "^0.19.2",
|
|
1079
|
+
"@humanfs/types": "^0.15.0",
|
|
1076
1080
|
"@humanwhocodes/retry": "^0.4.0"
|
|
1077
1081
|
},
|
|
1078
1082
|
"engines": {
|
|
1079
1083
|
"node": ">=18.18.0"
|
|
1080
1084
|
}
|
|
1081
1085
|
},
|
|
1086
|
+
"node_modules/@humanfs/types": {
|
|
1087
|
+
"version": "0.15.0",
|
|
1088
|
+
"resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
|
|
1089
|
+
"integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
|
|
1090
|
+
"dev": true,
|
|
1091
|
+
"license": "Apache-2.0",
|
|
1092
|
+
"engines": {
|
|
1093
|
+
"node": ">=18.18.0"
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1082
1096
|
"node_modules/@humanwhocodes/module-importer": {
|
|
1083
1097
|
"version": "1.0.1",
|
|
1084
1098
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
|
|
@@ -4001,9 +4015,9 @@
|
|
|
4001
4015
|
"license": "MIT"
|
|
4002
4016
|
},
|
|
4003
4017
|
"node_modules/fast-uri": {
|
|
4004
|
-
"version": "3.1.
|
|
4005
|
-
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.
|
|
4006
|
-
"integrity": "sha512-
|
|
4018
|
+
"version": "3.1.7",
|
|
4019
|
+
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.7.tgz",
|
|
4020
|
+
"integrity": "sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg==",
|
|
4007
4021
|
"funding": [
|
|
4008
4022
|
{
|
|
4009
4023
|
"type": "github",
|
|
@@ -6600,12 +6614,13 @@
|
|
|
6600
6614
|
}
|
|
6601
6615
|
},
|
|
6602
6616
|
"node_modules/qs": {
|
|
6603
|
-
"version": "6.
|
|
6604
|
-
"resolved": "https://registry.npmjs.org/qs/-/qs-6.
|
|
6605
|
-
"integrity": "sha512-
|
|
6617
|
+
"version": "6.16.0",
|
|
6618
|
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz",
|
|
6619
|
+
"integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==",
|
|
6606
6620
|
"license": "BSD-3-Clause",
|
|
6607
6621
|
"dependencies": {
|
|
6608
|
-
"
|
|
6622
|
+
"es-define-property": "^1.0.1",
|
|
6623
|
+
"side-channel": "^1.1.1"
|
|
6609
6624
|
},
|
|
6610
6625
|
"engines": {
|
|
6611
6626
|
"node": ">=0.6"
|
|
@@ -7069,14 +7084,14 @@
|
|
|
7069
7084
|
}
|
|
7070
7085
|
},
|
|
7071
7086
|
"node_modules/side-channel": {
|
|
7072
|
-
"version": "1.1.
|
|
7073
|
-
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.
|
|
7074
|
-
"integrity": "sha512-
|
|
7087
|
+
"version": "1.1.1",
|
|
7088
|
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
|
7089
|
+
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
|
7075
7090
|
"license": "MIT",
|
|
7076
7091
|
"dependencies": {
|
|
7077
7092
|
"es-errors": "^1.3.0",
|
|
7078
|
-
"object-inspect": "^1.13.
|
|
7079
|
-
"side-channel-list": "^1.0.
|
|
7093
|
+
"object-inspect": "^1.13.4",
|
|
7094
|
+
"side-channel-list": "^1.0.1",
|
|
7080
7095
|
"side-channel-map": "^1.0.1",
|
|
7081
7096
|
"side-channel-weakmap": "^1.0.2"
|
|
7082
7097
|
},
|
|
@@ -7088,13 +7103,13 @@
|
|
|
7088
7103
|
}
|
|
7089
7104
|
},
|
|
7090
7105
|
"node_modules/side-channel-list": {
|
|
7091
|
-
"version": "1.0.
|
|
7092
|
-
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.
|
|
7093
|
-
"integrity": "sha512-
|
|
7106
|
+
"version": "1.0.1",
|
|
7107
|
+
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
|
7108
|
+
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
|
7094
7109
|
"license": "MIT",
|
|
7095
7110
|
"dependencies": {
|
|
7096
7111
|
"es-errors": "^1.3.0",
|
|
7097
|
-
"object-inspect": "^1.13.
|
|
7112
|
+
"object-inspect": "^1.13.4"
|
|
7098
7113
|
},
|
|
7099
7114
|
"engines": {
|
|
7100
7115
|
"node": ">= 0.4"
|