@ouro.bot/cli 0.1.0-alpha.1013 → 0.1.0-alpha.1014
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/optional-packages.js +71 -0
- package/dist/heart/providers/azure.js +4 -1
- package/dist/mailroom/core.js +2 -1
- package/dist/repertoire/stripe-client.js +2 -1
- package/dist/senses/mail-entry.js +5 -3
- package/dist/senses/shepherd/owner-notice.js +2 -1
- package/dist/senses/teams-entry.js +5 -3
- package/npm-shrinkwrap.json +174 -34
- package/package.json +14 -12
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.1014",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The Teams, Azure, Stripe and mail SDKs are optional packages. A small host can leave them out with npm config set omit optional (about 97 MB and 138 packages of the 220 MB install); the core harness, providers, vault and other senses run without them, and a feature that needs a missing one says which package and how to restore it. The edge benchmark now measures that install."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1013",
|
|
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.1014</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptionalPackageMissingError = exports.OPTIONAL_PACKAGES = void 0;
|
|
4
|
+
exports.missingOptionalPackage = missingOptionalPackage;
|
|
5
|
+
exports.importOptional = importOptional;
|
|
6
|
+
exports.describeStartupError = describeStartupError;
|
|
7
|
+
const runtime_1 = require("../nerves/runtime");
|
|
8
|
+
/**
|
|
9
|
+
* Product SDKs listed in package.json optionalDependencies. npm installs them by default; a small
|
|
10
|
+
* host can leave them out with `npm install --omit=optional` (about 97 MB and 138 packages), and
|
|
11
|
+
* only the feature that needs one stops working.
|
|
12
|
+
*/
|
|
13
|
+
exports.OPTIONAL_PACKAGES = [
|
|
14
|
+
"@azure/identity",
|
|
15
|
+
"@azure/storage-blob",
|
|
16
|
+
"@microsoft/teams.api",
|
|
17
|
+
"@microsoft/teams.apps",
|
|
18
|
+
"@microsoft/teams.cards",
|
|
19
|
+
"@microsoft/teams.common",
|
|
20
|
+
"@microsoft/teams.dev",
|
|
21
|
+
"@microsoft/teams.graph",
|
|
22
|
+
"mailparser",
|
|
23
|
+
"smtp-server",
|
|
24
|
+
"stripe",
|
|
25
|
+
];
|
|
26
|
+
class OptionalPackageMissingError extends Error {
|
|
27
|
+
packageName;
|
|
28
|
+
feature;
|
|
29
|
+
constructor(packageName, feature) {
|
|
30
|
+
super(`${feature} needs ${packageName}, an optional package this install left out (npm --omit=optional). ` +
|
|
31
|
+
"Reinstall @ouro.bot/cli without --omit=optional to use it.");
|
|
32
|
+
this.packageName = packageName;
|
|
33
|
+
this.feature = feature;
|
|
34
|
+
this.name = "OptionalPackageMissingError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.OptionalPackageMissingError = OptionalPackageMissingError;
|
|
38
|
+
/** The optional package an error says is missing, or null for any other error (including a missing file inside a package). */
|
|
39
|
+
function missingOptionalPackage(error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
+
return exports.OPTIONAL_PACKAGES.find((name) => message.includes(`Cannot find module '${name}'`)) ?? null;
|
|
42
|
+
}
|
|
43
|
+
function reportMissing(packageName, feature) {
|
|
44
|
+
const missing = new OptionalPackageMissingError(packageName, feature);
|
|
45
|
+
(0, runtime_1.emitNervesEvent)({
|
|
46
|
+
level: "error",
|
|
47
|
+
component: "engine",
|
|
48
|
+
event: "engine.optional_package_missing",
|
|
49
|
+
message: missing.message,
|
|
50
|
+
meta: { package: packageName, feature },
|
|
51
|
+
});
|
|
52
|
+
return missing;
|
|
53
|
+
}
|
|
54
|
+
/** Load an optional package, turning its absence into an error that names the feature and the fix. */
|
|
55
|
+
async function importOptional(packageName, feature, load) {
|
|
56
|
+
try {
|
|
57
|
+
return await load();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (missingOptionalPackage(error) !== packageName)
|
|
61
|
+
throw error;
|
|
62
|
+
throw reportMissing(packageName, feature);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** The message a sense entry point prints when it fails to start: the plain error, or what to do when an optional package is absent. */
|
|
66
|
+
function describeStartupError(error, feature) {
|
|
67
|
+
const packageName = missingOptionalPackage(error);
|
|
68
|
+
if (packageName)
|
|
69
|
+
return reportMissing(packageName, feature).message;
|
|
70
|
+
return error instanceof Error ? error.message : String(error);
|
|
71
|
+
}
|
|
@@ -42,6 +42,7 @@ const runtime_1 = require("../../nerves/runtime");
|
|
|
42
42
|
const streaming_1 = require("../streaming");
|
|
43
43
|
const model_capabilities_1 = require("../model-capabilities");
|
|
44
44
|
const error_classification_1 = require("./error-classification");
|
|
45
|
+
const optional_packages_1 = require("../optional-packages");
|
|
45
46
|
const COGNITIVE_SERVICES_SCOPE = "https://cognitiveservices.azure.com/.default";
|
|
46
47
|
function classifyAzureError(error) {
|
|
47
48
|
return (0, error_classification_1.classifyHttpError)(error);
|
|
@@ -55,7 +56,7 @@ function createAzureTokenProvider(managedIdentityClientId) {
|
|
|
55
56
|
return async () => {
|
|
56
57
|
try {
|
|
57
58
|
if (!credential) {
|
|
58
|
-
const { DefaultAzureCredential } = await Promise.resolve().then(() => __importStar(require("@azure/identity")));
|
|
59
|
+
const { DefaultAzureCredential } = await (0, optional_packages_1.importOptional)("@azure/identity", "Azure managed-identity sign-in", () => Promise.resolve().then(() => __importStar(require("@azure/identity"))));
|
|
59
60
|
const credentialOptions = managedIdentityClientId
|
|
60
61
|
? { managedIdentityClientId }
|
|
61
62
|
: undefined;
|
|
@@ -65,6 +66,8 @@ function createAzureTokenProvider(managedIdentityClientId) {
|
|
|
65
66
|
return tokenResponse.token;
|
|
66
67
|
}
|
|
67
68
|
catch (err) {
|
|
69
|
+
if (err instanceof optional_packages_1.OptionalPackageMissingError)
|
|
70
|
+
throw err;
|
|
68
71
|
const detail = err instanceof Error ? err.message : String(err);
|
|
69
72
|
throw new Error(`Azure OpenAI authentication failed: ${detail}\n` +
|
|
70
73
|
"To fix this, either:\n" +
|
package/dist/mailroom/core.js
CHANGED
|
@@ -58,6 +58,7 @@ exports.provisionMailboxRegistry = provisionMailboxRegistry;
|
|
|
58
58
|
exports.ensureMailboxRegistry = ensureMailboxRegistry;
|
|
59
59
|
const crypto = __importStar(require("node:crypto"));
|
|
60
60
|
const runtime_1 = require("../nerves/runtime");
|
|
61
|
+
const optional_packages_1 = require("../heart/optional-packages");
|
|
61
62
|
const LOCAL_PART_LIMIT = 64;
|
|
62
63
|
const SNIPPET_LIMIT = 240;
|
|
63
64
|
const RAW_OBJECT_PREFIX = "raw";
|
|
@@ -455,7 +456,7 @@ function privateMailEnvelopeReadableText(privateEnvelope) {
|
|
|
455
456
|
}
|
|
456
457
|
async function parsePrivateMailEnvelope(rawMime) {
|
|
457
458
|
// mailparser and its charset tables cost about 19 MB per process; load it on the first parse.
|
|
458
|
-
const { simpleParser } = await Promise.resolve().then(() => __importStar(require("mailparser")));
|
|
459
|
+
const { simpleParser } = await (0, optional_packages_1.importOptional)("mailparser", "Reading mail", () => Promise.resolve().then(() => __importStar(require("mailparser"))));
|
|
459
460
|
const parsed = await simpleParser(rawMime);
|
|
460
461
|
const html = typeof parsed.html === "string" ? parsed.html : undefined;
|
|
461
462
|
const parsedText = parsed.text ?? "";
|
|
@@ -43,6 +43,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
43
|
})();
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.createStripeClient = createStripeClient;
|
|
46
|
+
const optional_packages_1 = require("../heart/optional-packages");
|
|
46
47
|
const credential_access_1 = require("./credential-access");
|
|
47
48
|
const runtime_1 = require("../nerves/runtime");
|
|
48
49
|
// ---------------------------------------------------------------------------
|
|
@@ -62,7 +63,7 @@ async function createStripeClient() {
|
|
|
62
63
|
const store = (0, credential_access_1.getCredentialStore)();
|
|
63
64
|
const apiKey = await store.getRawSecret("stripe.com", "restrictedKey");
|
|
64
65
|
// Stripe's SDK is about 10 MB and 185 modules; only agents that issue cards load it.
|
|
65
|
-
const { default: StripeConstructor } = await Promise.resolve().then(() => __importStar(require("stripe")));
|
|
66
|
+
const { default: StripeConstructor } = await (0, optional_packages_1.importOptional)("stripe", "Virtual cards", () => Promise.resolve().then(() => __importStar(require("stripe"))));
|
|
66
67
|
const StripeFactory = StripeConstructor;
|
|
67
68
|
const stripe = new StripeFactory(apiKey);
|
|
68
69
|
return {
|
|
@@ -52,15 +52,17 @@ const runtime_1 = require("../nerves/runtime");
|
|
|
52
52
|
Promise.resolve().then(() => __importStar(require("./mail"))).then(async ({ startMailSenseApp }) => {
|
|
53
53
|
await startMailSenseApp({ agentName });
|
|
54
54
|
})
|
|
55
|
-
.catch((error) => {
|
|
55
|
+
.catch(async (error) => {
|
|
56
|
+
const { describeStartupError } = await Promise.resolve().then(() => __importStar(require("../heart/optional-packages")));
|
|
57
|
+
const detail = describeStartupError(error, "the Mail sense");
|
|
56
58
|
(0, runtime_1.emitNervesEvent)({
|
|
57
59
|
level: "error",
|
|
58
60
|
component: "senses",
|
|
59
61
|
event: "senses.entry_error",
|
|
60
62
|
message: "Mail entrypoint failed",
|
|
61
|
-
meta: { entry: "mail", agentName, error:
|
|
63
|
+
meta: { entry: "mail", agentName, error: detail },
|
|
62
64
|
});
|
|
63
65
|
// eslint-disable-next-line no-console -- fatal startup guard for sense process
|
|
64
|
-
console.error(
|
|
66
|
+
console.error(detail);
|
|
65
67
|
process.exit(1);
|
|
66
68
|
});
|
|
@@ -53,6 +53,7 @@ const identity_1 = require("../../heart/identity");
|
|
|
53
53
|
const reach_channel_1 = require("../../heart/reach-channel");
|
|
54
54
|
const runtime_1 = require("../../nerves/runtime");
|
|
55
55
|
const notice_outbox_1 = require("./notice-outbox");
|
|
56
|
+
const optional_packages_1 = require("../../heart/optional-packages");
|
|
56
57
|
/**
|
|
57
58
|
* The owner notice: after a judged return, the agent's owner hears what happened in one short plain message on their
|
|
58
59
|
* own channel. It is deterministic, written here and sent with no model turn, so the owner hears about every return the
|
|
@@ -277,7 +278,7 @@ function chooseTeamsBot(tenantId, primary, secondary) {
|
|
|
277
278
|
}
|
|
278
279
|
/* v8 ignore start -- the live Teams SDK client; its token and REST calls need a real bot registration @preserve */
|
|
279
280
|
async function liveBotApi(config) {
|
|
280
|
-
const { App } = await Promise.resolve().then(() => __importStar(require("@microsoft/teams.apps")));
|
|
281
|
+
const { App } = await (0, optional_packages_1.importOptional)("@microsoft/teams.apps", "Teams owner notices", () => Promise.resolve().then(() => __importStar(require("@microsoft/teams.apps"))));
|
|
281
282
|
const app = new App({
|
|
282
283
|
clientId: config.clientId,
|
|
283
284
|
...(config.clientSecret ? { clientSecret: config.clientSecret } : {}),
|
|
@@ -61,15 +61,17 @@ Promise.resolve().then(() => __importStar(require("../heart/runtime-credentials"
|
|
|
61
61
|
const { startTeamsApp } = await Promise.resolve().then(() => __importStar(require("./teams")));
|
|
62
62
|
startTeamsApp();
|
|
63
63
|
})
|
|
64
|
-
.catch((error) => {
|
|
64
|
+
.catch(async (error) => {
|
|
65
|
+
const { describeStartupError } = await Promise.resolve().then(() => __importStar(require("../heart/optional-packages")));
|
|
66
|
+
const detail = describeStartupError(error, "the Teams sense");
|
|
65
67
|
(0, runtime_1.emitNervesEvent)({
|
|
66
68
|
level: "error",
|
|
67
69
|
component: "senses",
|
|
68
70
|
event: "senses.entry_error",
|
|
69
71
|
message: "Teams entrypoint failed",
|
|
70
|
-
meta: { entry: "teams", agentName, error:
|
|
72
|
+
meta: { entry: "teams", agentName, error: detail },
|
|
71
73
|
});
|
|
72
74
|
// eslint-disable-next-line no-console -- fatal startup guard for sense process
|
|
73
|
-
console.error(
|
|
75
|
+
console.error(detail);
|
|
74
76
|
process.exit(1);
|
|
75
77
|
});
|