thenomad 0.3.0 → 0.4.1
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/dist/nomad.js +388 -47
- package/package.json +1 -1
- package/web/404.html +1 -1
- package/web/__next.__PAGE__.txt +5 -5
- package/web/__next._full.txt +5 -5
- package/web/__next._tree.txt +1 -1
- package/web/_next/static/chunks/0acwr1ymxj2xd.js +1 -0
- package/web/_next/static/chunks/10-jap4z156cb.js +1 -0
- package/web/_next/static/chunks/1aptcj-lfpf2a.js +1 -0
- package/web/_next/static/chunks/1plj9h4y9cgwa.js +1 -0
- package/web/_next/static/chunks/{240m_9t_ozl62.js → 24nxqz5lj7mh0.js} +1 -1
- package/web/_next/static/chunks/2ka3apprzgwd-.js +7 -0
- package/web/_next/static/chunks/2xk_pltb6ubb0.js +1 -0
- package/web/_not-found/__next._full.txt +1 -1
- package/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/web/_not-found/__next._tree.txt +1 -1
- package/web/_not-found.html +1 -1
- package/web/_not-found.txt +1 -1
- package/web/app/__next._full.txt +1 -1
- package/web/app/__next._tree.txt +1 -1
- package/web/app/__next.app.__PAGE__.txt +1 -1
- package/web/app/__next.app.txt +1 -1
- package/web/app/agents/__next._full.txt +1 -1
- package/web/app/agents/__next._tree.txt +1 -1
- package/web/app/agents/__next.app.agents.__PAGE__.txt +1 -1
- package/web/app/agents/__next.app.txt +1 -1
- package/web/app/agents/view/__next._full.txt +1 -1
- package/web/app/agents/view/__next._tree.txt +1 -1
- package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +1 -1
- package/web/app/agents/view/__next.app.txt +1 -1
- package/web/app/agents/view.html +1 -1
- package/web/app/agents/view.txt +1 -1
- package/web/app/agents.html +1 -1
- package/web/app/agents.txt +1 -1
- package/web/app/backups/__next._full.txt +1 -1
- package/web/app/backups/__next._tree.txt +1 -1
- package/web/app/backups/__next.app.backups.__PAGE__.txt +1 -1
- package/web/app/backups/__next.app.txt +1 -1
- package/web/app/backups.html +1 -1
- package/web/app/backups.txt +1 -1
- package/web/app/compatibility/__next._full.txt +3 -3
- package/web/app/compatibility/__next._tree.txt +1 -1
- package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +3 -3
- package/web/app/compatibility/__next.app.txt +1 -1
- package/web/app/compatibility.html +1 -1
- package/web/app/compatibility.txt +3 -3
- package/web/app/export/__next._full.txt +4 -4
- package/web/app/export/__next._tree.txt +1 -1
- package/web/app/export/__next.app.export.__PAGE__.txt +4 -4
- package/web/app/export/__next.app.txt +1 -1
- package/web/app/export.html +1 -1
- package/web/app/export.txt +4 -4
- package/web/app/history/__next._full.txt +4 -4
- package/web/app/history/__next._tree.txt +1 -1
- package/web/app/history/__next.app.history.__PAGE__.txt +4 -4
- package/web/app/history/__next.app.txt +1 -1
- package/web/app/history.html +1 -1
- package/web/app/history.txt +4 -4
- package/web/app/import/__next._full.txt +1 -1
- package/web/app/import/__next._tree.txt +1 -1
- package/web/app/import/__next.app.import.__PAGE__.txt +1 -1
- package/web/app/import/__next.app.txt +1 -1
- package/web/app/import.html +1 -1
- package/web/app/import.txt +1 -1
- package/web/app/migrate/__next._full.txt +4 -4
- package/web/app/migrate/__next._tree.txt +1 -1
- package/web/app/migrate/__next.app.migrate.__PAGE__.txt +4 -4
- package/web/app/migrate/__next.app.txt +1 -1
- package/web/app/migrate.html +1 -1
- package/web/app/migrate.txt +4 -4
- package/web/app/settings/__next._full.txt +1 -1
- package/web/app/settings/__next._tree.txt +1 -1
- package/web/app/settings/__next.app.settings.__PAGE__.txt +1 -1
- package/web/app/settings/__next.app.txt +1 -1
- package/web/app/settings.html +1 -1
- package/web/app/settings.txt +1 -1
- package/web/app/versions/__next._full.txt +1 -1
- package/web/app/versions/__next._tree.txt +1 -1
- package/web/app/versions/__next.app.txt +1 -1
- package/web/app/versions/__next.app.versions.__PAGE__.txt +1 -1
- package/web/app/versions.html +1 -1
- package/web/app/versions.txt +1 -1
- package/web/app.html +1 -1
- package/web/app.txt +1 -1
- package/web/docs/__next._full.txt +2 -2
- package/web/docs/__next._tree.txt +1 -1
- package/web/docs/__next.docs.__PAGE__.txt +2 -2
- package/web/docs/adapters/__next._full.txt +21 -17
- package/web/docs/adapters/__next._tree.txt +1 -1
- package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +19 -15
- package/web/docs/adapters.html +1 -1
- package/web/docs/adapters.txt +21 -17
- package/web/docs/format/__next._full.txt +1 -1
- package/web/docs/format/__next._tree.txt +1 -1
- package/web/docs/format/__next.docs.format.__PAGE__.txt +1 -1
- package/web/docs/format.html +1 -1
- package/web/docs/format.txt +1 -1
- package/web/docs/security/__next._full.txt +26 -21
- package/web/docs/security/__next._tree.txt +1 -1
- package/web/docs/security/__next.docs.security.__PAGE__.txt +24 -19
- package/web/docs/security.html +1 -1
- package/web/docs/security.txt +26 -21
- package/web/docs/token/__next._full.txt +1 -1
- package/web/docs/token/__next._tree.txt +1 -1
- package/web/docs/token/__next.docs.token.__PAGE__.txt +1 -1
- package/web/docs/token.html +1 -1
- package/web/docs/token.txt +1 -1
- package/web/docs.html +1 -1
- package/web/docs.txt +2 -2
- package/web/index.html +2 -2
- package/web/index.txt +5 -5
- package/web/inspect/__next._full.txt +5 -5
- package/web/inspect/__next._tree.txt +1 -1
- package/web/inspect/__next.inspect.__PAGE__.txt +5 -5
- package/web/inspect.html +1 -1
- package/web/inspect.txt +5 -5
- package/web/privacy/__next._full.txt +1 -1
- package/web/privacy/__next._tree.txt +1 -1
- package/web/privacy/__next.privacy.__PAGE__.txt +1 -1
- package/web/privacy.html +1 -1
- package/web/privacy.txt +1 -1
- package/web/terms/__next._full.txt +1 -1
- package/web/terms/__next._tree.txt +1 -1
- package/web/terms/__next.terms.__PAGE__.txt +1 -1
- package/web/terms.html +1 -1
- package/web/terms.txt +1 -1
- package/web/vote/__next._full.txt +1 -1
- package/web/vote/__next._tree.txt +1 -1
- package/web/vote/__next.vote.__PAGE__.txt +1 -1
- package/web/vote.html +1 -1
- package/web/vote.txt +1 -1
- package/web/_next/static/chunks/0yz4pc7gp4_iw.js +0 -1
- package/web/_next/static/chunks/1_0w_nimjt5-w.js +0 -1
- package/web/_next/static/chunks/1d7qnsfqdlz_u.js +0 -1
- package/web/_next/static/chunks/1zb0q77s0yui0.js +0 -1
- package/web/_next/static/chunks/2m8g429r9sjgz.js +0 -7
- package/web/_next/static/chunks/3ahuzuq_wii6l.js +0 -1
- /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → wjHK22E9HmfsJn0z_eAFq}/_buildManifest.js +0 -0
- /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → wjHK22E9HmfsJn0z_eAFq}/_clientMiddlewareManifest.js +0 -0
- /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → wjHK22E9HmfsJn0z_eAFq}/_ssgManifest.js +0 -0
package/dist/nomad.js
CHANGED
|
@@ -923,7 +923,7 @@ var init_src2 = __esm({
|
|
|
923
923
|
init_markdown();
|
|
924
924
|
init_document();
|
|
925
925
|
init_merge();
|
|
926
|
-
NOMAD_VERSION = "0.
|
|
926
|
+
NOMAD_VERSION = "0.4.1";
|
|
927
927
|
NomadError = class extends Error {
|
|
928
928
|
constructor(message, code, hint) {
|
|
929
929
|
super(message);
|
|
@@ -969,7 +969,12 @@ var init_keymaterial = __esm({
|
|
|
969
969
|
/(^|\/)\.local\/state\/priors-mcp(\/|$)/,
|
|
970
970
|
/(^|\/)\.agent001(\/|$)/,
|
|
971
971
|
// Oak Agent Kit: the encrypted wallet (wallet.enc), private notes (*.gloam.enc), the wallet journal and settings.
|
|
972
|
-
/(^|\/)\.oak(\/|$)
|
|
972
|
+
/(^|\/)\.oak(\/|$)/,
|
|
973
|
+
// Hedgehood: the session, payer and owner key files and the kit's settings.
|
|
974
|
+
/(^|\/)\.hedgehood(\/|$)/,
|
|
975
|
+
// BrainChain: the payer and worker key files and the daily spending record (~/.brainchain), and the worker's state.
|
|
976
|
+
/(^|\/)\.brainchain(\/|$)/,
|
|
977
|
+
/(^|\/)\.config\/brainchain-worker(\/|$)/
|
|
973
978
|
];
|
|
974
979
|
KEY_MATERIAL_FILES = [/(^|\/)agent(-\d+)?\.key$/];
|
|
975
980
|
skipped = /* @__PURE__ */ new Set();
|
|
@@ -1059,6 +1064,33 @@ async function isFile(p) {
|
|
|
1059
1064
|
return false;
|
|
1060
1065
|
}
|
|
1061
1066
|
}
|
|
1067
|
+
function drainSkippedLinks() {
|
|
1068
|
+
const out2 = [...skippedLinks].sort();
|
|
1069
|
+
skippedLinks.clear();
|
|
1070
|
+
return out2;
|
|
1071
|
+
}
|
|
1072
|
+
async function linkTargetAllowed(p) {
|
|
1073
|
+
const realOf = (d) => {
|
|
1074
|
+
try {
|
|
1075
|
+
return realpathSync2.native(d);
|
|
1076
|
+
} catch {
|
|
1077
|
+
return d;
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
let real;
|
|
1081
|
+
try {
|
|
1082
|
+
real = realpathSync2.native(p);
|
|
1083
|
+
} catch {
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
const posixReal = real.split(sep).join("/");
|
|
1087
|
+
if (CREDENTIAL_LINK_TARGETS.some((re) => re.test(posixReal)) || isKeyMaterialPath(real)) return false;
|
|
1088
|
+
const inside = (dir) => {
|
|
1089
|
+
const r = relative(dir, real);
|
|
1090
|
+
return r !== "" && !r.startsWith("..") && !isAbsolute(r);
|
|
1091
|
+
};
|
|
1092
|
+
return [home(), realOf(home()), dirname(p), realOf(dirname(p))].some(inside);
|
|
1093
|
+
}
|
|
1062
1094
|
async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
|
|
1063
1095
|
if (isKeyMaterialPath(p)) {
|
|
1064
1096
|
if (await pathExists(p)) recordSkippedKeyMaterial(p);
|
|
@@ -1069,6 +1101,11 @@ async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
|
|
|
1069
1101
|
if (st.isSymbolicLink()) {
|
|
1070
1102
|
const real = await fsp.stat(p);
|
|
1071
1103
|
if (!real.isFile()) return null;
|
|
1104
|
+
if (!await linkTargetAllowed(p)) {
|
|
1105
|
+
skippedLinks.add(p);
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
if (real.size > maxBytes) throw new Error(`${p} is larger than ${maxBytes} bytes`);
|
|
1072
1109
|
} else if (!st.isFile()) return null;
|
|
1073
1110
|
if (st.size > maxBytes) throw new Error(`${p} is larger than ${maxBytes} bytes`);
|
|
1074
1111
|
return await fsp.readFile(p, "utf8");
|
|
@@ -1149,7 +1186,7 @@ function realHome() {
|
|
|
1149
1186
|
return home();
|
|
1150
1187
|
}
|
|
1151
1188
|
}
|
|
1152
|
-
var UnsafePathError;
|
|
1189
|
+
var UnsafePathError, CREDENTIAL_LINK_TARGETS, skippedLinks;
|
|
1153
1190
|
var init_fs = __esm({
|
|
1154
1191
|
"../../packages/core/src/node/fs.ts"() {
|
|
1155
1192
|
"use strict";
|
|
@@ -1160,6 +1197,19 @@ var init_fs = __esm({
|
|
|
1160
1197
|
this.name = "UnsafePathError";
|
|
1161
1198
|
}
|
|
1162
1199
|
};
|
|
1200
|
+
CREDENTIAL_LINK_TARGETS = [
|
|
1201
|
+
/(^|\/)\.(ssh|aws|gnupg|kube|azure|password-store)(\/|$)/,
|
|
1202
|
+
/(^|\/)\.config\/(gh|gcloud|hub)(\/|$)/,
|
|
1203
|
+
/(^|\/)\.docker\/config\.json$/,
|
|
1204
|
+
/(^|\/)\.(netrc|git-credentials|npmrc|pypirc|pgpass|my\.cnf)$/,
|
|
1205
|
+
/(^|\/)\.env(\..+)?$/,
|
|
1206
|
+
/(^|\/)\.?(credentials|secrets?)(\.[a-z]+)?$/i,
|
|
1207
|
+
/(^|\/)auth(-profiles)?\.json$/i,
|
|
1208
|
+
/\.(pem|key|p12|pfx|keystore|jks|kdbx)$/i,
|
|
1209
|
+
/(^|\/)id_(rsa|dsa|ecdsa|ed25519)(\.pub)?$/,
|
|
1210
|
+
/(^|\/)\.[a-z]*_history$/
|
|
1211
|
+
];
|
|
1212
|
+
skippedLinks = /* @__PURE__ */ new Set();
|
|
1163
1213
|
}
|
|
1164
1214
|
});
|
|
1165
1215
|
|
|
@@ -1225,6 +1275,27 @@ function redactLaunchField(text3) {
|
|
|
1225
1275
|
});
|
|
1226
1276
|
return { text: out2, count };
|
|
1227
1277
|
}
|
|
1278
|
+
function redactWalletText(text3) {
|
|
1279
|
+
const matches2 = rawMatches(text3).filter((m) => WALLET_RULE_IDS.has(m.rule.id));
|
|
1280
|
+
if (!matches2.length) return { text: text3, count: 0 };
|
|
1281
|
+
let out2 = "";
|
|
1282
|
+
let last = 0;
|
|
1283
|
+
for (const m of matches2) {
|
|
1284
|
+
out2 += text3.slice(last, m.start) + `[REDACTED:${m.rule.id}]`;
|
|
1285
|
+
last = m.end;
|
|
1286
|
+
}
|
|
1287
|
+
out2 += text3.slice(last);
|
|
1288
|
+
return { text: out2, count: matches2.length };
|
|
1289
|
+
}
|
|
1290
|
+
function redactWalletLaunchField(text3) {
|
|
1291
|
+
const r = redactWalletText(text3);
|
|
1292
|
+
let count = r.count;
|
|
1293
|
+
const out2 = r.text.replace(EVM_KEY, () => {
|
|
1294
|
+
count++;
|
|
1295
|
+
return "[REDACTED:evm-private-key]";
|
|
1296
|
+
});
|
|
1297
|
+
return { text: out2, count };
|
|
1298
|
+
}
|
|
1228
1299
|
function shannonEntropy(s) {
|
|
1229
1300
|
if (!s) return 0;
|
|
1230
1301
|
const freq = /* @__PURE__ */ new Map();
|
|
@@ -1305,7 +1376,7 @@ function redactText(text3) {
|
|
|
1305
1376
|
out2 += text3.slice(last);
|
|
1306
1377
|
return { text: out2, count: matches2.length };
|
|
1307
1378
|
}
|
|
1308
|
-
var EVM_KEY, SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY, PUBLIC_RPC_HOSTS;
|
|
1379
|
+
var EVM_KEY, SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY, PUBLIC_RPC_HOSTS, WALLET_RULE_IDS;
|
|
1309
1380
|
var init_secrets = __esm({
|
|
1310
1381
|
"../../packages/security/src/secrets.ts"() {
|
|
1311
1382
|
"use strict";
|
|
@@ -1376,6 +1447,7 @@ var init_secrets = __esm({
|
|
|
1376
1447
|
"rpc.ordofi.network",
|
|
1377
1448
|
"mainnet.base.org"
|
|
1378
1449
|
]);
|
|
1450
|
+
WALLET_RULE_IDS = /* @__PURE__ */ new Set(["evm-private-key", "bip39-mnemonic"]);
|
|
1379
1451
|
}
|
|
1380
1452
|
});
|
|
1381
1453
|
|
|
@@ -1384,6 +1456,11 @@ function isSecretEnvEntry(key2, value) {
|
|
|
1384
1456
|
if (isSensitiveEnvKey(key2) || looksLikeSecretValue(value) || EVM_KEY_VALUE.test(value)) return true;
|
|
1385
1457
|
return isRpcEnvKey(key2) && !isPublicRpcUrl(value);
|
|
1386
1458
|
}
|
|
1459
|
+
function isWalletEnvEntry(key2, value) {
|
|
1460
|
+
const v = value.trim();
|
|
1461
|
+
if (EVM_KEY_VALUE.test(v) || isMnemonic(v) || redactWalletText(v).count > 0) return true;
|
|
1462
|
+
return WALLET_ENV_NAME.test(key2) && (BARE_HEX_KEY.test(v) || BASE58_KEY.test(v) || BYTE_ARRAY_KEY.test(v));
|
|
1463
|
+
}
|
|
1387
1464
|
function visitText(doc, fn) {
|
|
1388
1465
|
if (doc.identity.persona) fn("identity/persona.md", doc.identity.persona);
|
|
1389
1466
|
if (doc.identity.description) fn("identity/description", doc.identity.description);
|
|
@@ -1410,8 +1487,8 @@ function scanDocument(doc) {
|
|
|
1410
1487
|
if (isSensitiveFile(f.path)) sensitiveFiles.push({ file: `skills/${s.name}/${f.path}`, reason: "Credential or key file" });
|
|
1411
1488
|
for (const t of doc.tools) {
|
|
1412
1489
|
if (!t.mcp) continue;
|
|
1413
|
-
const
|
|
1414
|
-
findings.push(...scanMcpLaunchFields(t.name, { args: t.mcp.args, url: t.mcp.url, headers:
|
|
1490
|
+
const literal2 = (rec) => Object.fromEntries(Object.entries(rec).flatMap(([k, v]) => "value" in v ? [[k, v.value]] : []));
|
|
1491
|
+
findings.push(...scanMcpLaunchFields(t.name, { args: t.mcp.args, url: t.mcp.url, headers: literal2(t.mcp.headers) }).filter((f) => !f.file.includes("/headers/")));
|
|
1415
1492
|
}
|
|
1416
1493
|
const inlineSecretValues = [];
|
|
1417
1494
|
for (const t of doc.tools) {
|
|
@@ -1433,32 +1510,33 @@ function scanDocument(doc) {
|
|
|
1433
1510
|
clean: findings.length === 0 && sensitiveFiles.length === 0 && inlineSecretValues.length === 0
|
|
1434
1511
|
};
|
|
1435
1512
|
}
|
|
1436
|
-
function stripRecord(tool, rec, report) {
|
|
1513
|
+
function stripRecord(tool, rec, report, isSecret) {
|
|
1437
1514
|
const out2 = {};
|
|
1438
1515
|
for (const [k, v] of Object.entries(rec)) {
|
|
1439
|
-
if ("value" in v &&
|
|
1516
|
+
if ("value" in v && isSecret(k, v.value)) {
|
|
1440
1517
|
out2[k] = { secretRef: k, redacted: true };
|
|
1441
1518
|
report.strippedEnvValues.push({ tool, key: k });
|
|
1519
|
+
if (report.includedSecrets) report.walletKeysKept++;
|
|
1442
1520
|
} else out2[k] = v;
|
|
1443
1521
|
}
|
|
1444
1522
|
return out2;
|
|
1445
1523
|
}
|
|
1446
1524
|
function sanitizeDocument(doc, options = {}) {
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
if (options.includeSensitiveFiles) return { doc, report };
|
|
1450
|
-
}
|
|
1525
|
+
const include = !!options.includeSecrets;
|
|
1526
|
+
const report = { redactedText: 0, strippedEnvValues: [], removedFiles: [], includedSecrets: include, walletKeysKept: 0 };
|
|
1451
1527
|
const red2 = (s) => {
|
|
1452
|
-
|
|
1453
|
-
const r = redactText(s);
|
|
1528
|
+
const r = include ? redactWalletText(s) : redactText(s);
|
|
1454
1529
|
report.redactedText += r.count;
|
|
1530
|
+
if (include) report.walletKeysKept += r.count;
|
|
1455
1531
|
return r.text;
|
|
1456
1532
|
};
|
|
1457
1533
|
const launch = (s) => {
|
|
1458
|
-
const r = redactLaunchField(s);
|
|
1534
|
+
const r = include ? redactWalletLaunchField(s) : redactLaunchField(s);
|
|
1459
1535
|
report.redactedText += r.count;
|
|
1536
|
+
if (include) report.walletKeysKept += r.count;
|
|
1460
1537
|
return r.text;
|
|
1461
1538
|
};
|
|
1539
|
+
const isSecret = include ? isWalletEnvEntry : isSecretEnvEntry;
|
|
1462
1540
|
const keepFile = (path) => {
|
|
1463
1541
|
if (options.includeSensitiveFiles || !isSensitiveFile(path)) return true;
|
|
1464
1542
|
report.removedFiles.push(path);
|
|
@@ -1484,14 +1562,14 @@ function sanitizeDocument(doc, options = {}) {
|
|
|
1484
1562
|
actions: w.actions.map((a) => a.kind === "prompt" ? { ...a, text: red2(a.text) } : a)
|
|
1485
1563
|
})),
|
|
1486
1564
|
tools: doc.tools.map(
|
|
1487
|
-
(t) => t.mcp
|
|
1565
|
+
(t) => t.mcp ? {
|
|
1488
1566
|
...t,
|
|
1489
1567
|
mcp: {
|
|
1490
1568
|
...t.mcp,
|
|
1491
1569
|
args: t.mcp.args.map(launch),
|
|
1492
1570
|
url: t.mcp.url === void 0 ? void 0 : launch(t.mcp.url),
|
|
1493
|
-
env: stripRecord(t.name, t.mcp.env, report),
|
|
1494
|
-
headers: stripRecord(t.name, t.mcp.headers, report)
|
|
1571
|
+
env: stripRecord(t.name, t.mcp.env, report, isSecret),
|
|
1572
|
+
headers: stripRecord(t.name, t.mcp.headers, report, isSecret)
|
|
1495
1573
|
}
|
|
1496
1574
|
} : t
|
|
1497
1575
|
),
|
|
@@ -1500,12 +1578,16 @@ function sanitizeDocument(doc, options = {}) {
|
|
|
1500
1578
|
};
|
|
1501
1579
|
return { doc: out2, report };
|
|
1502
1580
|
}
|
|
1503
|
-
var EVM_KEY_VALUE;
|
|
1581
|
+
var EVM_KEY_VALUE, WALLET_ENV_NAME, BARE_HEX_KEY, BASE58_KEY, BYTE_ARRAY_KEY;
|
|
1504
1582
|
var init_document2 = __esm({
|
|
1505
1583
|
"../../packages/security/src/document.ts"() {
|
|
1506
1584
|
"use strict";
|
|
1507
1585
|
init_secrets();
|
|
1508
1586
|
EVM_KEY_VALUE = /\b0x[0-9a-fA-F]{64}\b/;
|
|
1587
|
+
WALLET_ENV_NAME = /(PRIVATE|WALLET|SIGNER|MNEMONIC|SEED|OWNER|PAYER|SESSION)/i;
|
|
1588
|
+
BARE_HEX_KEY = /^(?:0x)?[0-9a-fA-F]{64}$/;
|
|
1589
|
+
BASE58_KEY = /^[1-9A-HJ-NP-Za-km-z]{86,90}$/;
|
|
1590
|
+
BYTE_ARRAY_KEY = /^\[\s*\d{1,3}(?:\s*,\s*\d{1,3}){63}\s*\]$/;
|
|
1509
1591
|
}
|
|
1510
1592
|
});
|
|
1511
1593
|
|
|
@@ -3128,7 +3210,7 @@ var init_catalog = __esm({
|
|
|
3128
3210
|
instructions: full,
|
|
3129
3211
|
memory: full,
|
|
3130
3212
|
skills: full,
|
|
3131
|
-
tools: rw("
|
|
3213
|
+
tools: rw("full", "convert", "MCP servers under mcp.servers in openclaw.json, shared by all agents. Secrets are not written; Nomad lists the openclaw config set commands."),
|
|
3132
3214
|
integrations: manual("Channels and credentials must be reconnected."),
|
|
3133
3215
|
models: convert("Written as provider/model."),
|
|
3134
3216
|
permissions: rw("convert", "convert", "Deny rules become tools.deny entries. Allow rules are documented, not applied."),
|
|
@@ -3283,6 +3365,29 @@ var init_catalog = __esm({
|
|
|
3283
3365
|
});
|
|
3284
3366
|
|
|
3285
3367
|
// ../../packages/adapters/src/known-servers.ts
|
|
3368
|
+
function knownSkillNotes(skills, platformId, platformName) {
|
|
3369
|
+
const notes = [];
|
|
3370
|
+
const fromBrainChain = (s) => {
|
|
3371
|
+
const home2 = s.frontmatter?.homepage;
|
|
3372
|
+
if (typeof home2 !== "string") return false;
|
|
3373
|
+
try {
|
|
3374
|
+
return /(^|\.)usebrainchain\.com$/.test(new URL(home2).hostname);
|
|
3375
|
+
} catch {
|
|
3376
|
+
return false;
|
|
3377
|
+
}
|
|
3378
|
+
};
|
|
3379
|
+
for (const s of skills) {
|
|
3380
|
+
if (!fromBrainChain(s)) continue;
|
|
3381
|
+
if (s.name === "brainchain-worker") {
|
|
3382
|
+
notes.push(
|
|
3383
|
+
platformId === "openclaw" ? { level: "warning", category: "skills", message: `The "brainchain-worker" skill reads its key through OpenClaw's secrets settings, which Nomad does not copy, and the worker itself is a program you run. Redo the skill's "For the operator, first" setup on this OpenClaw, then start the worker again.` } : { level: "warning", category: "skills", message: `The "brainchain-worker" skill is written for OpenClaw: it needs the openclaw command, Docker and its key in OpenClaw's secrets settings, so it does not work on ${platformName} as it is. Nomad copies it so nothing is lost.` }
|
|
3384
|
+
);
|
|
3385
|
+
} else if (s.name === "brainchain" && platformId !== "openclaw") {
|
|
3386
|
+
notes.push({ level: "info", category: "skills", message: `The "brainchain" skill is written for OpenClaw: its setup steps use openclaw commands and its wallet check script path is filled in by OpenClaw. The BrainChain MCP tools it describes work the same on ${platformName}.` });
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
return notes;
|
|
3390
|
+
}
|
|
3286
3391
|
function applyKnownServerProfile(tool, platformName = "the destination") {
|
|
3287
3392
|
const out2 = { tool, notes: [], manualSteps: [], unsupported: [] };
|
|
3288
3393
|
const profile = tool.mcp ? PROFILES.find((p) => p.matches(tool)) : void 0;
|
|
@@ -3326,7 +3431,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
|
|
|
3326
3431
|
function knownServerId(tool) {
|
|
3327
3432
|
return PROFILES.find((p) => p.matches(tool))?.id ?? null;
|
|
3328
3433
|
}
|
|
3329
|
-
var isPriorsHost, PRIORS, isOakCommand, OAK, PROFILES;
|
|
3434
|
+
var isPriorsHost, PRIORS, isOakCommand, OAK, HEDGEHOOD_HOSTS, isHedgehoodHost, isHedgehoodCommand, HEDGEHOOD_KEY_VARS, HEDGEHOOD, isBrainChainCommand, literal, amount, BRAINCHAIN, PROFILES;
|
|
3330
3435
|
var init_known_servers = __esm({
|
|
3331
3436
|
"../../packages/adapters/src/known-servers.ts"() {
|
|
3332
3437
|
"use strict";
|
|
@@ -3428,7 +3533,164 @@ var init_known_servers = __esm({
|
|
|
3428
3533
|
}
|
|
3429
3534
|
}
|
|
3430
3535
|
};
|
|
3431
|
-
|
|
3536
|
+
HEDGEHOOD_HOSTS = /* @__PURE__ */ new Set(["mcp.hedgehood.io", "testnet-mcp.hedgehood.io"]);
|
|
3537
|
+
isHedgehoodHost = (url) => {
|
|
3538
|
+
if (!url) return false;
|
|
3539
|
+
try {
|
|
3540
|
+
return HEDGEHOOD_HOSTS.has(new URL(url).hostname);
|
|
3541
|
+
} catch {
|
|
3542
|
+
return false;
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
isHedgehoodCommand = (command) => !!command && /(^|[\\/])hedgehood-mcp(\.cmd|\.exe)?$/i.test(command);
|
|
3546
|
+
HEDGEHOOD_KEY_VARS = ["HEDGEHOOD_SESSION_KEY_FILE", "HEDGEHOOD_SESSION_KEY", "HEDGEHOOD_PAYER_KEY_FILE", "HEDGEHOOD_PAYER_KEY", "HEDGEHOOD_OWNER_KEY_FILE", "HEDGEHOOD_OWNER_KEY"];
|
|
3547
|
+
HEDGEHOOD = {
|
|
3548
|
+
id: "hedgehood",
|
|
3549
|
+
vendor: "Hedgehood",
|
|
3550
|
+
label: "Hedgehood (an options market for AI agents on Robinhood Chain)",
|
|
3551
|
+
matches: (t) => !!t.mcp && (isHedgehoodCommand(t.mcp.command) || t.mcp.args.some((a) => /^@hedgehood-io\/mcp(@|$)/.test(a)) || isHedgehoodHost(t.mcp.url)),
|
|
3552
|
+
// Both the file and the raw form of a key may be set (the file wins), so keys are handled in apply().
|
|
3553
|
+
keyVars: [],
|
|
3554
|
+
emptyOkEnv: [],
|
|
3555
|
+
limitVars: ["HEDGEHOOD_MAX_DEPOSIT", "HEDGEHOOD_DRY_RUN"],
|
|
3556
|
+
looserDefaults: { HEDGEHOOD_MAX_DEPOSIT: "1000 USDG per deposit", HEDGEHOOD_DRY_RUN: "write tools only simulate" },
|
|
3557
|
+
apply(t, out2, platform) {
|
|
3558
|
+
const mcp = t.mcp;
|
|
3559
|
+
if (mcp.transport !== "stdio") {
|
|
3560
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" is a read-only server run by Hedgehood, with no keys. Nomad copies only its address.` });
|
|
3561
|
+
return;
|
|
3562
|
+
}
|
|
3563
|
+
out2.notes.push({
|
|
3564
|
+
level: "info",
|
|
3565
|
+
category: "integrations",
|
|
3566
|
+
message: "Hedgehood's keys and settings stay on this computer in ~/.hedgehood (the session, payer and owner key files and config.json). Nomad never reads that folder or any key file, and never moves positions, balances or sessions on chain."
|
|
3567
|
+
});
|
|
3568
|
+
for (const k of ["HEDGEHOOD_SESSION_KEY", "HEDGEHOOD_PAYER_KEY", "HEDGEHOOD_OWNER_KEY"]) {
|
|
3569
|
+
const v = mcp.env[k];
|
|
3570
|
+
if (v && "value" in v) mcp.env[k] = { secretRef: k, redacted: true };
|
|
3571
|
+
}
|
|
3572
|
+
for (const k of HEDGEHOOD_KEY_VARS) {
|
|
3573
|
+
if (!mcp.env[k]) continue;
|
|
3574
|
+
out2.unsupported.push({
|
|
3575
|
+
category: "tools",
|
|
3576
|
+
item: `${t.name}: ${k}`,
|
|
3577
|
+
reason: "Hedgehood keys and key files are references only; Nomad never reads or copies them.",
|
|
3578
|
+
alternative: k.includes("SESSION") ? "On this computer, keep the key file where it is (owner-only, chmod 600) and set the variable. On another computer, create a new session key there." : "Set it on the destination only if this agent needs it."
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
if (mcp.env.HEDGEHOOD_OWNER_KEY_FILE || mcp.env.HEDGEHOOD_OWNER_KEY) {
|
|
3582
|
+
out2.notes.push({
|
|
3583
|
+
level: "warning",
|
|
3584
|
+
category: "tools",
|
|
3585
|
+
message: `"${t.name}" was given the owner key. The owner key can withdraw funds and manage sessions; Hedgehood says to keep it off shared machines. Set it on ${platform} only if this agent really needs it.`
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
out2.notes.push({
|
|
3589
|
+
level: "warning",
|
|
3590
|
+
category: "tools",
|
|
3591
|
+
message: `Hedgehood: if ${platform} runs on another computer, the session key does not come along. Run hedgehood init (or hedgehood join) there in your own terminal, have the owner authorize the new session with a spending budget, and revoke the old session if it will no longer be used (with the owner key: hedgehood session revoke <old session address> --send).`
|
|
3592
|
+
});
|
|
3593
|
+
const chain = mcp.env.HEDGEHOOD_CHAIN_ID;
|
|
3594
|
+
const mainnetFlag = mcp.args.includes("--mainnet");
|
|
3595
|
+
const testnetFlag = mcp.args.includes("--testnet");
|
|
3596
|
+
if (mainnetFlag || chain && "value" in chain && chain.value.trim() === "4663") {
|
|
3597
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" runs on Robinhood Chain mainnet (4663): trades settle in real USDG.` });
|
|
3598
|
+
} else if (testnetFlag || chain && "value" in chain && chain.value.trim() === "46630") {
|
|
3599
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" runs on the Robinhood Chain testnet (46630), with test funds.` });
|
|
3600
|
+
} else {
|
|
3601
|
+
out2.notes.push({
|
|
3602
|
+
level: "warning",
|
|
3603
|
+
category: "tools",
|
|
3604
|
+
message: `"${t.name}" does not fix the network in its entry, so Hedgehood takes it from ~/.hedgehood/config.json on that computer, or uses the testnet (46630) if there is none. Set HEDGEHOOD_CHAIN_ID=4663 on ${platform} for mainnet.`
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
if (isHedgehoodCommand(mcp.command)) {
|
|
3608
|
+
out2.manualSteps.push(`Install Hedgehood's MCP server for "${t.name}": npm install -g @hedgehood-io/mcp. It needs Node.js 20 or later, and the hedgehood-mcp command must be on the PATH ${platform} uses.`);
|
|
3609
|
+
} else {
|
|
3610
|
+
out2.manualSteps.push(`"${t.name}" runs Hedgehood through npx: ${platform} needs Node.js 20 or later on its PATH.`);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
};
|
|
3614
|
+
isBrainChainCommand = (command) => !!command && /(^|[\\/])brainchain-mcp(\.cmd|\.exe)?$/i.test(command);
|
|
3615
|
+
literal = (t, k) => {
|
|
3616
|
+
const v = t.mcp?.env[k];
|
|
3617
|
+
return v && "value" in v ? v.value.trim() : void 0;
|
|
3618
|
+
};
|
|
3619
|
+
amount = (units) => {
|
|
3620
|
+
if (!/^\d+$/.test(units)) return units;
|
|
3621
|
+
const n = BigInt(units);
|
|
3622
|
+
const whole = n / 1000000n;
|
|
3623
|
+
const fraction = (n % 1000000n).toString().padStart(6, "0").replace(/0+$/, "");
|
|
3624
|
+
return fraction ? `${whole}.${fraction}` : `${whole}`;
|
|
3625
|
+
};
|
|
3626
|
+
BRAINCHAIN = {
|
|
3627
|
+
id: "brainchain",
|
|
3628
|
+
vendor: "BrainChain",
|
|
3629
|
+
label: "BrainChain (verified AI work, paid on Robinhood Chain or Base)",
|
|
3630
|
+
matches: (t) => !!t.mcp && t.mcp.transport === "stdio" && (isBrainChainCommand(t.mcp.command) || t.mcp.args.some((a) => /^brainchain-mcp(@|$)/.test(a))),
|
|
3631
|
+
keyVars: ["BRAINCHAIN_PAYER_KEY_FILE", "BRAINCHAIN_PAYER_KEY"],
|
|
3632
|
+
emptyOkEnv: [],
|
|
3633
|
+
limitVars: ["BRAINCHAIN_MAX_PRICE_UNITS", "BRAINCHAIN_BUDGET_UNITS", "BRAINCHAIN_DAILY_UNITS", "BRAINCHAIN_MAX_BOND_UNITS", "BRAINCHAIN_STATE_DIR"],
|
|
3634
|
+
looserDefaults: {
|
|
3635
|
+
BRAINCHAIN_BUDGET_UNITS: "10 per server run",
|
|
3636
|
+
BRAINCHAIN_DAILY_UNITS: "no daily cap",
|
|
3637
|
+
BRAINCHAIN_MAX_BOND_UNITS: "10 USDG per bond"
|
|
3638
|
+
},
|
|
3639
|
+
apply(t, out2, platform) {
|
|
3640
|
+
const mcp = t.mcp;
|
|
3641
|
+
out2.notes.push({
|
|
3642
|
+
level: "info",
|
|
3643
|
+
category: "integrations",
|
|
3644
|
+
message: "BrainChain's wallet key and daily spending record stay on this computer in ~/.brainchain. Nomad never reads that folder or any key file, and never moves tasks, bonds or approvals on chain."
|
|
3645
|
+
});
|
|
3646
|
+
const raw = mcp.env.BRAINCHAIN_PAYER_KEY;
|
|
3647
|
+
if (raw && "value" in raw) mcp.env.BRAINCHAIN_PAYER_KEY = { secretRef: "BRAINCHAIN_PAYER_KEY", redacted: true };
|
|
3648
|
+
if (mcp.env.BRAINCHAIN_PAYER_KEY && !mcp.env.BRAINCHAIN_PAYER_KEY_FILE) {
|
|
3649
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" was given its wallet key directly. BrainChain recommends BRAINCHAIN_PAYER_KEY_FILE instead: a path to an owner-only file holding only that key, so the key is not in ${platform}'s settings.` });
|
|
3650
|
+
}
|
|
3651
|
+
const network = mcp.env.BRAINCHAIN_NETWORK;
|
|
3652
|
+
const payOn = mcp.env.BRAINCHAIN_PAY_ON;
|
|
3653
|
+
const testnet = literal(t, "BRAINCHAIN_NETWORK")?.toLowerCase() === "testnet";
|
|
3654
|
+
const base = literal(t, "BRAINCHAIN_PAY_ON")?.toLowerCase() === "base";
|
|
3655
|
+
const token = base ? "USDC" : "USDG";
|
|
3656
|
+
const perTask = amount(literal(t, "BRAINCHAIN_MAX_PRICE_UNITS") ?? "1000000");
|
|
3657
|
+
const perRun = amount(literal(t, "BRAINCHAIN_BUDGET_UNITS") ?? "10000000");
|
|
3658
|
+
const where = base ? "Base" : "Robinhood Chain";
|
|
3659
|
+
if (network && !("value" in network)) {
|
|
3660
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" takes its network from BRAINCHAIN_NETWORK, which was a variable on the source. BrainChain uses mainnet (real money) unless it is set to testnet on ${platform}.` });
|
|
3661
|
+
} else if (testnet) {
|
|
3662
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" uses the BrainChain testnet and pays in test ${token} on ${base ? "Base Sepolia" : "the Robinhood Chain testnet"}.` });
|
|
3663
|
+
} else {
|
|
3664
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" pays on ${where} mainnet in real ${token}: up to ${perTask} ${token} per task and ${perRun} ${token} per run.` });
|
|
3665
|
+
}
|
|
3666
|
+
if (payOn && !("value" in payOn)) {
|
|
3667
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" takes where it pays from BRAINCHAIN_PAY_ON, which was a variable on the source: USDG on Robinhood Chain unless it is set to base on ${platform}.` });
|
|
3668
|
+
}
|
|
3669
|
+
if (!mcp.env.BRAINCHAIN_DAILY_UNITS) {
|
|
3670
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" has no daily cap on ${platform}: BrainChain then limits only each run, and that budget starts over whenever ${platform} restarts the server. For an agent that runs on its own, set BRAINCHAIN_DAILY_UNITS (in units of 0.000001: 5000000 is 5 ${token}).` });
|
|
3671
|
+
}
|
|
3672
|
+
out2.notes.push({
|
|
3673
|
+
level: "warning",
|
|
3674
|
+
category: "tools",
|
|
3675
|
+
message: `BrainChain: if ${platform} runs on another computer, the wallet key does not come along. Create the key file there yourself (owner-only), for a wallet that holds only what this agent may spend, and set BRAINCHAIN_PAYER_KEY_FILE.`
|
|
3676
|
+
});
|
|
3677
|
+
const optionalEnv = mcp.optionalEnv ?? [];
|
|
3678
|
+
const optionalKeys = ["BRAINCHAIN_PAYER_KEY_FILE", "BRAINCHAIN_PAYER_KEY"].filter((k) => mcp.env[k] && optionalEnv.includes(k));
|
|
3679
|
+
if (optionalKeys.length) {
|
|
3680
|
+
out2.manualSteps.push(`"${t.name}" can only pay with its wallet key: make sure ${optionalKeys.join(" or ")} is set for it on ${platform}. Without it the server starts and reads, but cannot post or bond tasks.`);
|
|
3681
|
+
}
|
|
3682
|
+
const pkg = mcp.args.find((a) => /^brainchain-mcp(@|$)/.test(a)) ?? "brainchain-mcp";
|
|
3683
|
+
const prefix = `${testnet ? "BRAINCHAIN_NETWORK=testnet " : ""}${base ? "BRAINCHAIN_PAY_ON=base " : ""}BRAINCHAIN_PAYER_KEY_FILE=<key file>`;
|
|
3684
|
+
if (!base) out2.manualSteps.push(`Paying in USDG needs a one-time approval per wallet. If this wallet has not paid BrainChain in USDG before, run in your own terminal: ${prefix} npx -y ${pkg} approve`);
|
|
3685
|
+
out2.manualSteps.push(`Check the wallet before the agent pays: ${prefix} npx -y ${pkg} wallet (it prints the wallet and what it still needs, never the key).`);
|
|
3686
|
+
if (isBrainChainCommand(mcp.command)) {
|
|
3687
|
+
out2.manualSteps.push(`Install BrainChain's MCP server for "${t.name}": npm install -g brainchain-mcp. It needs Node.js 22 or later, and the brainchain-mcp command must be on the PATH ${platform} uses.`);
|
|
3688
|
+
} else {
|
|
3689
|
+
out2.manualSteps.push(`"${t.name}" runs BrainChain through npx: ${platform} needs Node.js 22 or later on its PATH.`);
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
};
|
|
3693
|
+
PROFILES = [PRIORS, OAK, HEDGEHOOD, BRAINCHAIN];
|
|
3432
3694
|
}
|
|
3433
3695
|
});
|
|
3434
3696
|
|
|
@@ -4352,7 +4614,8 @@ async function readInstalledPlugins(root, settings2, notes) {
|
|
|
4352
4614
|
if (typeof rel !== "string") continue;
|
|
4353
4615
|
const abs = resolve2(dir, rel);
|
|
4354
4616
|
if (abs !== dir && !abs.startsWith(dir + sep2)) continue;
|
|
4355
|
-
|
|
4617
|
+
const single = abs !== dir ? await readSkillDir(abs, P, notes) : null;
|
|
4618
|
+
for (const sk of single ? [single] : await readSkillsTree(abs, P, notes, 1)) {
|
|
4356
4619
|
sk.source = { ...sk.source ?? { platform: P }, note: provenance.note, ...provenance.extra };
|
|
4357
4620
|
out2.skills.push(sk);
|
|
4358
4621
|
}
|
|
@@ -4643,7 +4906,8 @@ var init_claude_code = __esm({
|
|
|
4643
4906
|
init_util();
|
|
4644
4907
|
P = "claude-code";
|
|
4645
4908
|
KNOWN_MARKETPLACE_REPOS = {
|
|
4646
|
-
"oak-agent-kit": "OakAgentKit/oak"
|
|
4909
|
+
"oak-agent-kit": "OakAgentKit/oak",
|
|
4910
|
+
hedgehood: "0xHedgeHood/hedgehood-agent-kit"
|
|
4647
4911
|
};
|
|
4648
4912
|
TOOL_CAP = {
|
|
4649
4913
|
Bash: "shell",
|
|
@@ -5053,6 +5317,30 @@ var init_codex = __esm({
|
|
|
5053
5317
|
// ../../packages/adapters/src/openclaw.ts
|
|
5054
5318
|
import { basename as basename5, join as join6, relative as relative2 } from "path";
|
|
5055
5319
|
import JSON5 from "json5";
|
|
5320
|
+
function openclawServersForRead(raw) {
|
|
5321
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
5322
|
+
const out2 = {};
|
|
5323
|
+
for (const [name, cfg] of Object.entries(raw)) {
|
|
5324
|
+
if (!cfg || typeof cfg !== "object") continue;
|
|
5325
|
+
const c2 = { ...cfg };
|
|
5326
|
+
if (typeof c2.url === "string" && c2.transport === void 0 && c2.type === void 0) c2.transport = "sse";
|
|
5327
|
+
if (c2.type === "http") c2.transport = "streamable-http";
|
|
5328
|
+
for (const field of ["env", "headers"]) {
|
|
5329
|
+
if (!c2[field] || typeof c2[field] !== "object") continue;
|
|
5330
|
+
c2[field] = Object.fromEntries(
|
|
5331
|
+
Object.entries(c2[field]).map(([k, v]) => {
|
|
5332
|
+
if (v && typeof v === "object") {
|
|
5333
|
+
const ref = v;
|
|
5334
|
+
return [k, ref.source === "env" && typeof ref.id === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(ref.id) ? `\${${ref.id}}` : `\${${k}}`];
|
|
5335
|
+
}
|
|
5336
|
+
return [k, v];
|
|
5337
|
+
})
|
|
5338
|
+
);
|
|
5339
|
+
}
|
|
5340
|
+
out2[name] = c2;
|
|
5341
|
+
}
|
|
5342
|
+
return out2;
|
|
5343
|
+
}
|
|
5056
5344
|
async function loadConfig(root, notes) {
|
|
5057
5345
|
const text3 = await readTextIfExists(join6(root, "openclaw.json"));
|
|
5058
5346
|
if (text3 === null) return { cfg: {}, exists: false };
|
|
@@ -5275,6 +5563,7 @@ async function readAgent(root, agentId, notes, prefer) {
|
|
|
5275
5563
|
});
|
|
5276
5564
|
}
|
|
5277
5565
|
doc.skills.push(...await readSkillsTree(join6(ws, "skills"), P3, notes, 1));
|
|
5566
|
+
doc.tools.push(...toolsFromMcpServers(openclawServersForRead(cfg?.mcp?.servers), P3, "openclaw.json"));
|
|
5278
5567
|
const m = modelOf(cfg, agentId);
|
|
5279
5568
|
if (m.primary) doc.models.preferred = m.primary;
|
|
5280
5569
|
doc.models.fallbacks = m.fallbacks;
|
|
@@ -5431,16 +5720,33 @@ ${m.content.trim()}
|
|
|
5431
5720
|
cfgPatch.agents = { ...cfgPatch.agents ?? {}, list: listPatch };
|
|
5432
5721
|
}
|
|
5433
5722
|
}
|
|
5434
|
-
|
|
5435
|
-
files.push({ path: "openclaw.json", content: JSON.stringify(cfgPatch, null, 2) + "\n", strategy: "merge-json5", arrayKeys: { "agents.list": "id" }, component: "project", description: newEntry ? `Register agent "${agentId}" in openclaw.json` : "Model and tool policy in openclaw.json" });
|
|
5436
|
-
if (exists) notes.push({ level: "info", message: "openclaw.json is rewritten as JSON. Comments in it are not kept (a backup is taken first)." });
|
|
5437
|
-
}
|
|
5723
|
+
let mcpWritten = false;
|
|
5438
5724
|
if (wants(ctx, "tools")) {
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5725
|
+
const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp && !pluginOf(t, P3));
|
|
5726
|
+
if (mcpTools.length) {
|
|
5727
|
+
const r = mcpServersFromTools(mcpTools, { platformName: "OpenClaw", envRefStyle: "none" });
|
|
5728
|
+
for (const [name, server] of Object.entries(r.servers)) {
|
|
5729
|
+
const tool = mcpTools.find((t) => t.name === name);
|
|
5730
|
+
if (tool?.mcp?.transport === "http") server.transport = "streamable-http";
|
|
5731
|
+
else if (tool?.mcp?.transport === "sse") server.transport = "sse";
|
|
5732
|
+
const refs = r.refs[name];
|
|
5733
|
+
for (const k of refs?.env ?? []) manualSteps.push(`Set ${k} for the "${name}" MCP server in OpenClaw: openclaw config set mcp.servers.${name}.env.${k} <value>${refs.optional.includes(k) ? " (optional on the source: only if you use it)" : ""}`);
|
|
5734
|
+
for (const [h] of refs?.headers ?? []) manualSteps.push(`Set the ${h} header for the "${name}" MCP server in OpenClaw: openclaw config set mcp.servers.${name}.headers.${h} <value>`);
|
|
5735
|
+
}
|
|
5736
|
+
if (Object.keys(r.servers).length) {
|
|
5737
|
+
cfgPatch.mcp = { servers: r.servers };
|
|
5738
|
+
mcpWritten = true;
|
|
5739
|
+
notes.push({ level: "info", category: "tools", message: `OpenClaw's MCP servers are shared by all its agents, so ${Object.keys(r.servers).map((n) => `"${n}"`).join(", ")} will also be available to the other agents of this OpenClaw.` });
|
|
5740
|
+
}
|
|
5741
|
+
manualSteps.push(...r.manualSteps.filter((m) => !m.startsWith("Add ") && !m.startsWith("If you use them, set ")));
|
|
5742
|
+
unsupported.push(...r.unsupported);
|
|
5743
|
+
notes.push(...r.notes);
|
|
5442
5744
|
}
|
|
5443
5745
|
}
|
|
5746
|
+
if (Object.keys(cfgPatch).length) {
|
|
5747
|
+
files.push({ path: "openclaw.json", content: JSON.stringify(cfgPatch, null, 2) + "\n", strategy: "merge-json5", arrayKeys: { "agents.list": "id" }, component: "project", description: newEntry ? `Register agent "${agentId}" in openclaw.json` : mcpWritten ? "Model, tool policy and MCP servers in openclaw.json" : "Model and tool policy in openclaw.json" });
|
|
5748
|
+
if (exists) notes.push({ level: "info", message: "openclaw.json is rewritten as JSON. Comments in it are not kept (a backup is taken first)." });
|
|
5749
|
+
}
|
|
5444
5750
|
if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(integrationStep(i, "OpenClaw", `Reconnect ${i.name} in OpenClaw (credentials are never migrated).`));
|
|
5445
5751
|
if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) into the workspace.`);
|
|
5446
5752
|
if (newEntry) notes.push({ level: "info", message: `A new agent "${agentId}" with its own workspace will be created. Restart the gateway to load it.` });
|
|
@@ -5534,6 +5840,12 @@ var init_openclaw = __esm({
|
|
|
5534
5840
|
const missing = doc.skills.filter((s) => !pluginOf(s, this.info.id) && !names.has(s.name));
|
|
5535
5841
|
checks.push({ name: "Skills written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((s) => s.name).join(", ")}` : void 0 });
|
|
5536
5842
|
}
|
|
5843
|
+
const servers = doc.tools.filter((t) => t.kind === "mcp" && t.mcp && t.enabled !== false && !pluginOf(t, this.info.id));
|
|
5844
|
+
if (wants(ctx, "tools") && servers.length) {
|
|
5845
|
+
const names = new Set(got.tools.map((t) => t.name));
|
|
5846
|
+
const missing = servers.filter((t) => !names.has(t.name));
|
|
5847
|
+
checks.push({ name: "MCP servers written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((t) => t.name).join(", ")}` : `${servers.length} server(s) in mcp.servers` });
|
|
5848
|
+
}
|
|
5537
5849
|
if (wants(ctx, "workflows") && doc.workflows.length) {
|
|
5538
5850
|
const active = got.workflows.filter((w) => w.sourceEnabled && doc.workflows.some((d) => d.name === w.name));
|
|
5539
5851
|
checks.push({ name: "Imported routines are disabled", ok: active.length === 0, detail: active.length ? `${active.length} routine(s) are enabled` : void 0 });
|
|
@@ -7107,6 +7419,7 @@ __export(src_exports2, {
|
|
|
7107
7419
|
join: () => join10,
|
|
7108
7420
|
knownElizaosPlugin: () => knownElizaosPlugin,
|
|
7109
7421
|
knownServerId: () => knownServerId,
|
|
7422
|
+
knownSkillNotes: () => knownSkillNotes,
|
|
7110
7423
|
listAdapters: () => listAdapters,
|
|
7111
7424
|
mcpServersFromTools: () => mcpServersFromTools,
|
|
7112
7425
|
modelFamily: () => modelFamily,
|
|
@@ -7687,6 +8000,7 @@ async function applyOperations(ops) {
|
|
|
7687
8000
|
const pending = ops.filter((o) => o.action === "create" || o.action === "update");
|
|
7688
8001
|
const done = [];
|
|
7689
8002
|
const createdDirs = [];
|
|
8003
|
+
const modes = /* @__PURE__ */ new Map();
|
|
7690
8004
|
try {
|
|
7691
8005
|
for (const op of pending) {
|
|
7692
8006
|
assertNoSymlinks(op.root, op.abs);
|
|
@@ -7710,20 +8024,23 @@ async function applyOperations(ops) {
|
|
|
7710
8024
|
createdDirs.push(dir);
|
|
7711
8025
|
}
|
|
7712
8026
|
let mode = op.mode;
|
|
7713
|
-
if (current2)
|
|
8027
|
+
if (current2) {
|
|
8028
|
+
mode = (await fsp5.stat(op.abs)).mode & 511;
|
|
8029
|
+
modes.set(op.abs, mode);
|
|
8030
|
+
}
|
|
7714
8031
|
await atomicWrite(op.abs, op.after, mode);
|
|
7715
8032
|
done.push(op);
|
|
7716
8033
|
}
|
|
7717
8034
|
} catch (e) {
|
|
7718
|
-
await rollback(done, createdDirs);
|
|
8035
|
+
await rollback(done, createdDirs, modes);
|
|
7719
8036
|
throw e;
|
|
7720
8037
|
}
|
|
7721
8038
|
return { written: done };
|
|
7722
8039
|
}
|
|
7723
|
-
async function rollback(done, createdDirs) {
|
|
8040
|
+
async function rollback(done, createdDirs, modes = /* @__PURE__ */ new Map()) {
|
|
7724
8041
|
for (const op of [...done].reverse()) {
|
|
7725
8042
|
try {
|
|
7726
|
-
if (op.before) await atomicWrite(op.abs, op.before);
|
|
8043
|
+
if (op.before) await atomicWrite(op.abs, op.before, modes.get(op.abs) ?? 384);
|
|
7727
8044
|
else await fsp5.rm(op.abs, { force: true });
|
|
7728
8045
|
} catch {
|
|
7729
8046
|
}
|
|
@@ -8023,7 +8340,10 @@ var init_keys = __esm({
|
|
|
8023
8340
|
// ../../packages/migration/src/engine.ts
|
|
8024
8341
|
import { promises as fsp7, constants as constants2 } from "fs";
|
|
8025
8342
|
import { basename as basename8, dirname as dirname5, join as join15 } from "path";
|
|
8026
|
-
|
|
8343
|
+
function commandLine(command, args) {
|
|
8344
|
+
return [command, ...args].map(shellWord).join(" ");
|
|
8345
|
+
}
|
|
8346
|
+
var shellWord, PLAN_TTL_MS, Nomad;
|
|
8027
8347
|
var init_engine = __esm({
|
|
8028
8348
|
"../../packages/migration/src/engine.ts"() {
|
|
8029
8349
|
"use strict";
|
|
@@ -8040,6 +8360,7 @@ var init_engine = __esm({
|
|
|
8040
8360
|
init_policy();
|
|
8041
8361
|
init_compare();
|
|
8042
8362
|
init_keys();
|
|
8363
|
+
shellWord = (a) => /^[\w@%+=:,./-]+$/.test(a) ? a : `'${a.replace(/'/g, "'\\''")}'`;
|
|
8043
8364
|
PLAN_TTL_MS = 30 * 60 * 1e3;
|
|
8044
8365
|
Nomad = class {
|
|
8045
8366
|
store;
|
|
@@ -8081,11 +8402,16 @@ var init_engine = __esm({
|
|
|
8081
8402
|
if (!adapter.read) throw new NomadError(`${adapter.info.displayName} cannot be read by Nomad.`, "not-readable", "Guided platforms only accept agents.");
|
|
8082
8403
|
const r = resolveRoot(root);
|
|
8083
8404
|
drainSkippedKeyMaterial();
|
|
8405
|
+
drainSkippedLinks();
|
|
8084
8406
|
const result = await adapter.read(r, nativeId, { includeFiles: options.includeFiles, includeSecrets: options.includeSecrets });
|
|
8085
8407
|
const skippedKeys = drainSkippedKeyMaterial();
|
|
8086
8408
|
if (skippedKeys.length) {
|
|
8087
8409
|
result.notes.push({ level: "info", category: "integrations", message: `Skipped ${skippedKeys.length} path(s) that can hold wallet keys: ${skippedKeys.map(displayPath).join(", ")} (not read, not copied)` });
|
|
8088
8410
|
}
|
|
8411
|
+
const skippedLinks2 = drainSkippedLinks();
|
|
8412
|
+
if (skippedLinks2.length) {
|
|
8413
|
+
result.notes.push({ level: "warning", message: `Skipped ${skippedLinks2.length} linked file(s) that point to a credential file or outside your home folder: ${skippedLinks2.map(displayPath).join(", ")} (not read, not copied)` });
|
|
8414
|
+
}
|
|
8089
8415
|
let doc = parseDocument(result.doc);
|
|
8090
8416
|
const mapped = this.store.findByLocation(adapterId, r, nativeId);
|
|
8091
8417
|
if (!this.store.getAgent(doc.id) && mapped) doc = { ...doc, id: mapped.agentId };
|
|
@@ -8100,7 +8426,7 @@ var init_engine = __esm({
|
|
|
8100
8426
|
this.store.upsertLocation({ agentId: doc.id, adapter: adapterId, root: r, nativeId, hash: documentHash(clean.doc), role: mapped?.role === "primary" || !this.store.locationsFor(doc.id).length ? "primary" : void 0 });
|
|
8101
8427
|
}
|
|
8102
8428
|
const out2 = options.includeSecrets ? sanitizeDocument(doc, { includeSecrets: true }) : clean;
|
|
8103
|
-
return { doc: out2.doc, notes: result.notes, scan, sanitize:
|
|
8429
|
+
return { doc: out2.doc, notes: result.notes, scan, sanitize: out2.report, version, sourceFiles: result.sourceFiles, sourceAdapter: adapter };
|
|
8104
8430
|
}
|
|
8105
8431
|
signerOf(u) {
|
|
8106
8432
|
return signerStatus(u.info?.signature, signingIdentity(this.store.home, false), this.store.getSetting("trustedKeys", []));
|
|
@@ -8172,13 +8498,23 @@ var init_engine = __esm({
|
|
|
8172
8498
|
if (mode === "replace" && changing.some((o) => o.replacesForeign)) approvalsRequired.push("replace");
|
|
8173
8499
|
if (changing.some((o) => o.userModified)) approvalsRequired.push("overwrite-modified");
|
|
8174
8500
|
if (widened.length) approvalsRequired.push("broader-permissions");
|
|
8501
|
+
const toolsWritten = ["full", "convert"].includes(compatibility.categories.find((c2) => c2.category === "tools")?.status ?? "");
|
|
8502
|
+
const commands = req.source.kind === "location" || !toolsWritten ? [] : doc.tools.filter((t) => t.enabled !== false && t.mcp?.transport === "stdio" && t.mcp.command).map((t) => ({ tool: t.name, from: req.source.kind === "package" ? "package" : "library", command: commandLine(t.mcp.command, t.mcp.args), env: Object.keys(t.mcp.env) }));
|
|
8503
|
+
if (commands.length && changing.length) approvalsRequired.push("run-commands");
|
|
8175
8504
|
const notes = [...loaded.notes, ...planned.notes];
|
|
8505
|
+
if (components2.includes("skills")) notes.push(...knownSkillNotes(doc.skills, adapter.info.id, adapter.info.displayName));
|
|
8176
8506
|
if (!(await adapter.detect(root)).detected && adapter.info.support !== "GUIDED") {
|
|
8177
8507
|
notes.push({ level: "info", message: `${adapter.info.displayName} was not detected at ${displayPath(root)}. Nomad will create the files there.` });
|
|
8178
8508
|
}
|
|
8179
8509
|
if (loaded.sanitize.redactedText || loaded.sanitize.strippedEnvValues.length) {
|
|
8180
8510
|
notes.push({ level: "warning", message: `${loaded.sanitize.redactedText} secret value(s) in text were redacted and ${loaded.sanitize.strippedEnvValues.length} credential(s) were replaced by references.` });
|
|
8181
8511
|
}
|
|
8512
|
+
if (loaded.sanitize.walletKeysKept) {
|
|
8513
|
+
notes.push({ level: "warning", message: `${loaded.sanitize.walletKeysKept} wallet key(s) or recovery phrase(s) were left out although secrets are included: Nomad never copies them as values, because a leaked wallet key cannot be revoked. Set them again on the destination.` });
|
|
8514
|
+
}
|
|
8515
|
+
for (const c2 of commands) {
|
|
8516
|
+
notes.push({ level: "warning", message: `"${c2.tool}" comes from ${c2.from === "package" ? "a package" : "the Nomad library"} and ${adapter.info.displayName} will start it by itself: ${c2.command}${c2.env.length ? ` (with ${c2.env.join(", ")} set)` : ""}. Approve only if you trust where it came from.` });
|
|
8517
|
+
}
|
|
8182
8518
|
const statusCount = (s) => compatibility.categories.filter((c2) => c2.status === s).length;
|
|
8183
8519
|
const id = shortId("plan");
|
|
8184
8520
|
const plan = {
|
|
@@ -8231,6 +8567,7 @@ var init_engine = __esm({
|
|
|
8231
8567
|
unsupported: statusCount("unsupported")
|
|
8232
8568
|
},
|
|
8233
8569
|
approvalsRequired,
|
|
8570
|
+
commands,
|
|
8234
8571
|
blocked
|
|
8235
8572
|
};
|
|
8236
8573
|
this.plans.set(id, { plan, ops, doc, adapter, ctx, planned, at: Date.now() });
|
|
@@ -8287,7 +8624,7 @@ var init_engine = __esm({
|
|
|
8287
8624
|
if (options.token && options.token !== plan.token) throw new NomadError("The approval does not match this preview.", "token-mismatch");
|
|
8288
8625
|
if (plan.blocked.length) throw new NomadError("This migration cannot run: " + plan.blocked.join(" "), "blocked");
|
|
8289
8626
|
const missing = plan.approvalsRequired.filter(
|
|
8290
|
-
(a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions
|
|
8627
|
+
(a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions || a === "run-commands" && !approvals.runCommands
|
|
8291
8628
|
);
|
|
8292
8629
|
if (missing.length) {
|
|
8293
8630
|
throw new NomadError(`Explicit approval is required: ${missing.join(", ")}.`, "approval-required", "Review the preview and approve these changes to continue.");
|
|
@@ -8658,6 +8995,7 @@ var src_exports3 = {};
|
|
|
8658
8995
|
__export(src_exports3, {
|
|
8659
8996
|
Nomad: () => Nomad,
|
|
8660
8997
|
applyOperations: () => applyOperations,
|
|
8998
|
+
commandLine: () => commandLine,
|
|
8661
8999
|
compareDocuments: () => compareDocuments,
|
|
8662
9000
|
computeOperations: () => computeOperations,
|
|
8663
9001
|
createBackup: () => createBackup,
|
|
@@ -8856,7 +9194,7 @@ function createMcpServer(options = {}) {
|
|
|
8856
9194
|
if (sensitive.length && !options.allowReplace) {
|
|
8857
9195
|
throw new NomadError(`This migration needs approvals an assistant cannot give here: ${sensitive.join(", ")}.`, "forbidden", "Ask the user to apply it with the Nomad CLI or web app.");
|
|
8858
9196
|
}
|
|
8859
|
-
const receipt = await nomad.execute(planId, { replace: sensitive.includes("replace"), overwriteModified: sensitive.includes("overwrite-modified"), broaderPermissions: sensitive.includes("broader-permissions") }, { token: approvalToken });
|
|
9197
|
+
const receipt = await nomad.execute(planId, { replace: sensitive.includes("replace"), overwriteModified: sensitive.includes("overwrite-modified"), broaderPermissions: sensitive.includes("broader-permissions"), runCommands: sensitive.includes("run-commands") }, { token: approvalToken });
|
|
8860
9198
|
return text2(receipt);
|
|
8861
9199
|
} catch (e) {
|
|
8862
9200
|
return fail(e);
|
|
@@ -9064,6 +9402,7 @@ function summaryText(p) {
|
|
|
9064
9402
|
if (p.conversions.length) lines.push(`Adapted: ${p.conversions.map((c2) => `${c2.item} ${dim("\u2192 " + c2.to)}`).join("; ")}.`);
|
|
9065
9403
|
if (p.unsupported.length) lines.push(yellow(`Can't move: ${p.unsupported.map((u) => u.item).join(", ")}`) + dim(" (kept in the report with setup steps)"));
|
|
9066
9404
|
if (p.disabledRoutines.length) lines.push(`Routines arrive paused: ${p.disabledRoutines.join(", ")}.`);
|
|
9405
|
+
for (const c2 of p.commands ?? []) lines.push(yellow(`Starts by itself on ${p.destination.displayName}: "${c2.tool}" runs ${c2.command}`) + (c2.env.length ? dim(` (with ${c2.env.join(", ")} set)`) : ""));
|
|
9067
9406
|
if (p.secrets.findings || p.secrets.strippedEnv.length) {
|
|
9068
9407
|
const parts = [p.secrets.findings ? `${p.secrets.findings} found in text and removed` : "", p.secrets.strippedEnv.length ? `you will reconnect ${p.secrets.strippedEnv.map((s) => s.split(":")[1]).join(", ")}` : ""].filter(Boolean);
|
|
9069
9408
|
lines.push(`Secrets stay behind: ${parts.join("; ")}.`);
|
|
@@ -9080,6 +9419,7 @@ function approvalQuestion(p) {
|
|
|
9080
9419
|
if (p.approvalsRequired.includes("replace")) parts.push(`it replaces content Nomad did not create`);
|
|
9081
9420
|
if (p.approvalsRequired.includes("overwrite-modified")) parts.push(`it overwrites files you edited after Nomad wrote them`);
|
|
9082
9421
|
if (p.approvalsRequired.includes("broader-permissions")) parts.push(`the destination would allow more than it does now (${p.permissions.widened.join("; ")})`);
|
|
9422
|
+
if (p.approvalsRequired.includes("run-commands")) parts.push(`${p.destination.displayName} will start ${p.commands.length === 1 ? "this command" : "these commands"} by itself: ${p.commands.map((c2) => `"${c2.tool}" (from ${c2.from === "package" ? "the package" : "the Nomad library"}): ${c2.command}`).join("; ")}. Approve only if you trust where it came from`);
|
|
9083
9423
|
return parts.length ? `Heads up: ${parts.join(", and ")}.` : null;
|
|
9084
9424
|
}
|
|
9085
9425
|
|
|
@@ -9289,7 +9629,7 @@ async function handle(req, ctx, path) {
|
|
|
9289
9629
|
}
|
|
9290
9630
|
case "POST execute": {
|
|
9291
9631
|
const s = await body(req);
|
|
9292
|
-
const receipt = await nomad.execute(String(s.planId), { replace: !!s.approvals?.replace, overwriteModified: !!s.approvals?.overwriteModified, broaderPermissions: !!s.approvals?.broaderPermissions }, { token: String(s.token) });
|
|
9632
|
+
const receipt = await nomad.execute(String(s.planId), { replace: !!s.approvals?.replace, overwriteModified: !!s.approvals?.overwriteModified, broaderPermissions: !!s.approvals?.broaderPermissions, runCommands: !!s.approvals?.runCommands }, { token: String(s.token) });
|
|
9293
9633
|
return json(receipt);
|
|
9294
9634
|
}
|
|
9295
9635
|
case "POST export": {
|
|
@@ -9532,11 +9872,11 @@ async function previewAndApply(nomad, plan, o) {
|
|
|
9532
9872
|
return plan.blocked.length ? EXIT.error : EXIT.ok;
|
|
9533
9873
|
}
|
|
9534
9874
|
if (!output.json) print(output, show, null);
|
|
9535
|
-
const approvals = { replace: o.approveReplace, overwriteModified: o.approveModified, broaderPermissions: o.approvePermissions };
|
|
9536
|
-
const missing = plan.approvalsRequired.filter((a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions);
|
|
9875
|
+
const approvals = { replace: o.approveReplace, overwriteModified: o.approveModified, broaderPermissions: o.approvePermissions, runCommands: o.approveCommands };
|
|
9876
|
+
const missing = plan.approvalsRequired.filter((a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions || a === "run-commands" && !approvals.runCommands);
|
|
9537
9877
|
if (o.yes || !process.stdin.isTTY) {
|
|
9538
9878
|
if (missing.length) {
|
|
9539
|
-
const flags = missing.map((m) => m === "replace" ? "--approve-replace" : m === "overwrite-modified" ? "--approve-modified" : "--approve-permissions");
|
|
9879
|
+
const flags = missing.map((m) => m === "replace" ? "--approve-replace" : m === "overwrite-modified" ? "--approve-modified" : m === "run-commands" ? "--approve-commands" : "--approve-permissions");
|
|
9540
9880
|
throw new NomadError(`This migration needs explicit approval: ${missing.join(", ")}.`, "approval-required", `Review the preview, then add ${flags.join(" ")}.`);
|
|
9541
9881
|
}
|
|
9542
9882
|
if (!o.yes) throw new NomadError("Not running interactively.", "approval-required", "Add --yes to apply without a prompt, or --dry-run to preview.");
|
|
@@ -9551,6 +9891,7 @@ async function previewAndApply(nomad, plan, o) {
|
|
|
9551
9891
|
if (m === "replace") approvals.replace = true;
|
|
9552
9892
|
if (m === "overwrite-modified") approvals.overwriteModified = true;
|
|
9553
9893
|
if (m === "broader-permissions") approvals.broaderPermissions = true;
|
|
9894
|
+
if (m === "run-commands") approvals.runCommands = true;
|
|
9554
9895
|
}
|
|
9555
9896
|
}
|
|
9556
9897
|
const receipt = await nomad.execute(plan.id, approvals, { token: plan.token });
|
|
@@ -9566,7 +9907,7 @@ function shortReceipt(r) {
|
|
|
9566
9907
|
...r.backupId ? ["", dim(`Changed your mind? ${CMD} restore ${r.backupId}`)] : []
|
|
9567
9908
|
];
|
|
9568
9909
|
}
|
|
9569
|
-
var approvalOptions = (cmd) => cmd.option("--dry-run", "only show the preview").option("--details", "show the full preview: every category, file and diff").option("-y, --yes", "apply without asking (non-interactive)").option("--approve-replace", "allow replacing content Nomad did not write").option("--approve-modified", "allow overwriting files edited after Nomad wrote them").option("--approve-permissions", "allow a destination policy broader than the current one");
|
|
9910
|
+
var approvalOptions = (cmd) => cmd.option("--dry-run", "only show the preview").option("--details", "show the full preview: every category, file and diff").option("-y, --yes", "apply without asking (non-interactive)").option("--approve-replace", "allow replacing content Nomad did not write").option("--approve-modified", "allow overwriting files edited after Nomad wrote them").option("--approve-permissions", "allow a destination policy broader than the current one").option("--approve-commands", "allow commands from a package or the library that the destination app will start");
|
|
9570
9911
|
program.command("adapters").description("list supported platforms and what each can transfer").option("--platform <id>", "show one platform in detail").action(
|
|
9571
9912
|
(o) => run2(async (nomad) => {
|
|
9572
9913
|
const infos = nomad.adapters();
|
|
@@ -9624,12 +9965,12 @@ program.command("validate <package>").description("check a package (.nomad, .age
|
|
|
9624
9965
|
return r.ok ? EXIT.ok : EXIT.invalid;
|
|
9625
9966
|
})
|
|
9626
9967
|
);
|
|
9627
|
-
program.command("export <source>").description("export an agent to a portable .nomad package").option("-o, --out <path>", "output file or folder", ".").option("--source-dir <dir>", "platform directory").option("--agent <id>", "agent inside the platform").option("--components <list>", `only these components (${COMPONENT_CATEGORIES.join(",")})`).option("--include-files", "include knowledge and other files").option("--include-secrets", "keep secret values in the package (not recommended)").option("--include-sensitive-files", "keep credential files such as .env (not recommended)").addOption(new Option("--format <format>", "nomad (complete) or jetpack (interchange archive for other tools)").choices(["nomad", "jetpack"]).default("nomad")).option("--sign", "sign the package with your Nomad key so others can verify it came from you").action(
|
|
9968
|
+
program.command("export <source>").description("export an agent to a portable .nomad package").option("-o, --out <path>", "output file or folder", ".").option("--source-dir <dir>", "platform directory").option("--agent <id>", "agent inside the platform").option("--components <list>", `only these components (${COMPONENT_CATEGORIES.join(",")})`).option("--include-files", "include knowledge and other files").option("--include-secrets", "keep secret values in the package, except wallet keys (not recommended)").option("--include-sensitive-files", "keep credential files such as .env (not recommended)").addOption(new Option("--format <format>", "nomad (complete) or jetpack (interchange archive for other tools)").choices(["nomad", "jetpack"]).default("nomad")).option("--sign", "sign the package with your Nomad key so others can verify it came from you").action(
|
|
9628
9969
|
(source, o) => run2(async (nomad) => {
|
|
9629
9970
|
const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
|
|
9630
9971
|
if (o.includeSecrets && !out().json) process.stderr.write(yellow("Warning: secret values will be stored in the package. Share it only with people who may see them.\n"));
|
|
9631
9972
|
const r = await nomad.exportAgent(spec, { outPath: resolve6(o.out), includeSecrets: o.includeSecrets, includeFiles: o.includeFiles, includeSensitiveFiles: o.includeSensitiveFiles, components: components(o.components), format: o.format === "jetpack" ? "interchange" : "nomad", sign: o.sign });
|
|
9632
|
-
print(out(), () => [green("Exported") + ` ${r.path}`, ...r.receipt.signedBy ? [`Signed with your key ${r.receipt.signedBy}`] : [], ...r.receipt.notIncluded.length ? [yellow(`Not representable in this format: ${r.receipt.notIncluded.join(", ")}`)] : [], `${r.files.size} files, ${r.bytes.length} bytes`, ...r.sanitize.redactedText || r.sanitize.strippedEnvValues.length ? [yellow(`${r.sanitize.redactedText} secret(s) redacted, ${r.sanitize.strippedEnvValues.length} credential(s) replaced by references`)] : [], ...r.sanitize.removedFiles.length ? [yellow(`Left out credential files: ${r.sanitize.removedFiles.join(", ")}`)] : []], r.receipt);
|
|
9973
|
+
print(out(), () => [green("Exported") + ` ${r.path}`, ...r.receipt.signedBy ? [`Signed with your key ${r.receipt.signedBy}`] : [], ...r.receipt.notIncluded.length ? [yellow(`Not representable in this format: ${r.receipt.notIncluded.join(", ")}`)] : [], `${r.files.size} files, ${r.bytes.length} bytes`, ...r.sanitize.redactedText || r.sanitize.strippedEnvValues.length ? [yellow(`${r.sanitize.redactedText} secret(s) redacted, ${r.sanitize.strippedEnvValues.length} credential(s) replaced by references`)] : [], ...r.sanitize.removedFiles.length ? [yellow(`Left out credential files: ${r.sanitize.removedFiles.join(", ")}`)] : [], ...r.sanitize.walletKeysKept ? [yellow(`Left out ${r.sanitize.walletKeysKept} wallet key(s) or recovery phrase(s): Nomad never stores them as values, even with --include-secrets.`)] : []], r.receipt);
|
|
9633
9974
|
})
|
|
9634
9975
|
);
|
|
9635
9976
|
approvalOptions(
|
|
@@ -9655,7 +9996,7 @@ approvalOptions(
|
|
|
9655
9996
|
})
|
|
9656
9997
|
);
|
|
9657
9998
|
approvalOptions(
|
|
9658
|
-
program.command("migrate").description("move an agent to another platform, with a preview before anything changes").requiredOption("--from <source>", "package, platform (openclaw, claude-code:~/proj#main), folder or library agent").requiredOption("--to <platform>", "destination platform id").option("--source-dir <dir>", "source platform directory").option("--agent <id>", "agent inside the source platform").option("--dest-dir <dir>", "destination directory (default: the platform's default location)").option("--dest-agent <id>", "existing agent to update at the destination").addOption(new Option("--mode <mode>", "merge keeps existing data, copy creates a separate agent, replace overwrites").choices(["merge", "copy", "replace"]).default("merge")).option("--keep-existing", "same as --mode merge").option("--replace", "same as --mode replace").option("--name <name>", "name of the new agent in copy mode").option("--components <list>", `only these components (${COMPONENT_CATEGORIES.join(",")})`).option("--include-files", "include knowledge files").option("--include-secrets", "carry secret values (not recommended)")
|
|
9999
|
+
program.command("migrate").description("move an agent to another platform, with a preview before anything changes").requiredOption("--from <source>", "package, platform (openclaw, claude-code:~/proj#main), folder or library agent").requiredOption("--to <platform>", "destination platform id").option("--source-dir <dir>", "source platform directory").option("--agent <id>", "agent inside the source platform").option("--dest-dir <dir>", "destination directory (default: the platform's default location)").option("--dest-agent <id>", "existing agent to update at the destination").addOption(new Option("--mode <mode>", "merge keeps existing data, copy creates a separate agent, replace overwrites").choices(["merge", "copy", "replace"]).default("merge")).option("--keep-existing", "same as --mode merge").option("--replace", "same as --mode replace").option("--name <name>", "name of the new agent in copy mode").option("--components <list>", `only these components (${COMPONENT_CATEGORIES.join(",")})`).option("--include-files", "include knowledge files").option("--include-secrets", "carry secret values, except wallet keys (not recommended)")
|
|
9659
10000
|
).action(
|
|
9660
10001
|
(o) => run2(async (nomad) => {
|
|
9661
10002
|
const spec = await parseSource(nomad, o.from, { sourceDir: o.sourceDir, agent: o.agent });
|