thenomad 0.2.0 → 0.4.0

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.
Files changed (151) hide show
  1. package/README.md +1 -1
  2. package/dist/nomad.js +281 -40
  3. package/package.json +1 -1
  4. package/web/404.html +1 -1
  5. package/web/__next.__PAGE__.txt +43 -52
  6. package/web/__next._full.txt +42 -40
  7. package/web/__next._tree.txt +2 -2
  8. package/web/_next/static/chunks/{3-sl52vw828p-.js → 01v5aab_kf3r7.js} +1 -1
  9. package/web/_next/static/chunks/0acwr1ymxj2xd.js +1 -0
  10. package/web/_next/static/chunks/1aptcj-lfpf2a.js +1 -0
  11. package/web/_next/static/chunks/1d7qnsfqdlz_u.js +1 -0
  12. package/web/_next/static/chunks/1p0rmc54l0_3e.js +5 -0
  13. package/web/_next/static/chunks/1plj9h4y9cgwa.js +1 -0
  14. package/web/_next/static/chunks/1ygp921kjfxbp.css +4 -0
  15. package/web/_next/static/chunks/1zb0q77s0yui0.js +1 -0
  16. package/web/_next/static/chunks/2c1swz3f540lq.js +1 -0
  17. package/web/_next/static/chunks/2gqqo11auvml1.js +1 -0
  18. package/web/_next/static/chunks/2ka3apprzgwd-.js +7 -0
  19. package/web/_next/static/chunks/2nr_qzaf1ds_m.js +1 -0
  20. package/web/_next/static/chunks/2x2dvcjppyahs.js +1 -0
  21. package/web/_not-found/__next._full.txt +27 -22
  22. package/web/_not-found/__next._not-found.__PAGE__.txt +30 -34
  23. package/web/_not-found/__next._tree.txt +2 -2
  24. package/web/_not-found.html +1 -1
  25. package/web/_not-found.txt +27 -22
  26. package/web/app/__next._full.txt +38 -30
  27. package/web/app/__next._tree.txt +4 -4
  28. package/web/app/__next.app.__PAGE__.txt +25 -48
  29. package/web/app/__next.app.txt +27 -0
  30. package/web/app/agents/__next._full.txt +40 -32
  31. package/web/app/agents/__next._tree.txt +4 -4
  32. package/web/app/agents/__next.app.agents.__PAGE__.txt +30 -52
  33. package/web/app/agents/__next.app.txt +27 -0
  34. package/web/app/agents/view/__next._full.txt +43 -36
  35. package/web/app/agents/view/__next._tree.txt +4 -4
  36. package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +33 -56
  37. package/web/app/agents/view/__next.app.txt +27 -0
  38. package/web/app/agents/view.html +1 -1
  39. package/web/app/agents/view.txt +43 -36
  40. package/web/app/agents.html +1 -1
  41. package/web/app/agents.txt +40 -32
  42. package/web/app/backups/__next._full.txt +39 -32
  43. package/web/app/backups/__next._tree.txt +4 -4
  44. package/web/app/backups/__next.app.backups.__PAGE__.txt +30 -52
  45. package/web/app/backups/__next.app.txt +27 -0
  46. package/web/app/backups.html +1 -1
  47. package/web/app/backups.txt +39 -32
  48. package/web/app/compatibility/__next._full.txt +40 -33
  49. package/web/app/compatibility/__next._tree.txt +4 -4
  50. package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +31 -53
  51. package/web/app/compatibility/__next.app.txt +27 -0
  52. package/web/app/compatibility.html +1 -1
  53. package/web/app/compatibility.txt +40 -33
  54. package/web/app/export/__next._full.txt +41 -33
  55. package/web/app/export/__next._tree.txt +4 -4
  56. package/web/app/export/__next.app.export.__PAGE__.txt +31 -53
  57. package/web/app/export/__next.app.txt +27 -0
  58. package/web/app/export.html +1 -1
  59. package/web/app/export.txt +41 -33
  60. package/web/app/history/__next._full.txt +40 -33
  61. package/web/app/history/__next._tree.txt +4 -4
  62. package/web/app/history/__next.app.history.__PAGE__.txt +31 -53
  63. package/web/app/history/__next.app.txt +27 -0
  64. package/web/app/history.html +1 -1
  65. package/web/app/history.txt +40 -33
  66. package/web/app/import/__next._full.txt +40 -32
  67. package/web/app/import/__next._tree.txt +4 -4
  68. package/web/app/import/__next.app.import.__PAGE__.txt +30 -52
  69. package/web/app/import/__next.app.txt +27 -0
  70. package/web/app/import.html +1 -1
  71. package/web/app/import.txt +40 -32
  72. package/web/app/migrate/__next._full.txt +40 -33
  73. package/web/app/migrate/__next._tree.txt +4 -4
  74. package/web/app/migrate/__next.app.migrate.__PAGE__.txt +31 -53
  75. package/web/app/migrate/__next.app.txt +27 -0
  76. package/web/app/migrate.html +1 -1
  77. package/web/app/migrate.txt +40 -33
  78. package/web/app/settings/__next._full.txt +39 -32
  79. package/web/app/settings/__next._tree.txt +4 -4
  80. package/web/app/settings/__next.app.settings.__PAGE__.txt +30 -52
  81. package/web/app/settings/__next.app.txt +27 -0
  82. package/web/app/settings.html +1 -1
  83. package/web/app/settings.txt +39 -32
  84. package/web/app/versions/__next._full.txt +39 -32
  85. package/web/app/versions/__next._tree.txt +4 -4
  86. package/web/app/versions/__next.app.txt +27 -0
  87. package/web/app/versions/__next.app.versions.__PAGE__.txt +30 -52
  88. package/web/app/versions.html +1 -1
  89. package/web/app/versions.txt +39 -32
  90. package/web/app.html +1 -1
  91. package/web/app.txt +38 -30
  92. package/web/docs/__next._full.txt +31 -31
  93. package/web/docs/__next._tree.txt +2 -2
  94. package/web/docs/__next.docs.__PAGE__.txt +38 -50
  95. package/web/docs/adapters/__next._full.txt +88 -85
  96. package/web/docs/adapters/__next._tree.txt +2 -2
  97. package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +93 -101
  98. package/web/docs/adapters.html +1 -1
  99. package/web/docs/adapters.txt +88 -85
  100. package/web/docs/format/__next._full.txt +40 -41
  101. package/web/docs/format/__next._tree.txt +2 -2
  102. package/web/docs/format/__next.docs.format.__PAGE__.txt +45 -57
  103. package/web/docs/format.html +2 -2
  104. package/web/docs/format.txt +40 -41
  105. package/web/docs/security/__next._full.txt +41 -37
  106. package/web/docs/security/__next._tree.txt +2 -2
  107. package/web/docs/security/__next.docs.security.__PAGE__.txt +46 -53
  108. package/web/docs/security.html +1 -1
  109. package/web/docs/security.txt +41 -37
  110. package/web/docs/token/__next._full.txt +52 -0
  111. package/web/docs/token/__next._tree.txt +6 -0
  112. package/web/docs/token/__next.docs.token.__PAGE__.txt +55 -0
  113. package/web/docs/token.html +1 -0
  114. package/web/docs/token.txt +52 -0
  115. package/web/docs.html +2 -2
  116. package/web/docs.txt +31 -31
  117. package/web/index.html +2 -2
  118. package/web/index.txt +42 -40
  119. package/web/inspect/__next._full.txt +29 -28
  120. package/web/inspect/__next._tree.txt +2 -2
  121. package/web/inspect/__next.inspect.__PAGE__.txt +32 -39
  122. package/web/inspect.html +1 -1
  123. package/web/inspect.txt +29 -28
  124. package/web/privacy/__next._full.txt +34 -30
  125. package/web/privacy/__next._tree.txt +2 -2
  126. package/web/privacy/__next.privacy.__PAGE__.txt +36 -40
  127. package/web/privacy.html +1 -1
  128. package/web/privacy.txt +34 -30
  129. package/web/terms/__next._full.txt +35 -34
  130. package/web/terms/__next._tree.txt +2 -2
  131. package/web/terms/__next.terms.__PAGE__.txt +37 -44
  132. package/web/terms.html +1 -1
  133. package/web/terms.txt +35 -34
  134. package/web/vote/__next._full.txt +34 -0
  135. package/web/vote/__next._tree.txt +5 -0
  136. package/web/vote/__next.vote.__PAGE__.txt +36 -0
  137. package/web/vote.html +1 -0
  138. package/web/vote.txt +34 -0
  139. package/web/_next/static/chunks/0fh-fhwc4fqmh.js +0 -1
  140. package/web/_next/static/chunks/0r144bat18tjc.css +0 -4
  141. package/web/_next/static/chunks/0yz4pc7gp4_iw.js +0 -1
  142. package/web/_next/static/chunks/0zz4b9f_7-jdc.js +0 -1
  143. package/web/_next/static/chunks/1_0w_nimjt5-w.js +0 -1
  144. package/web/_next/static/chunks/25ks-kwg9va83.js +0 -1
  145. package/web/_next/static/chunks/294sy_-iu03pf.js +0 -1
  146. package/web/_next/static/chunks/2bozyj4tl2bji.js +0 -1
  147. package/web/_next/static/chunks/2m8g429r9sjgz.js +0 -7
  148. package/web/_next/static/chunks/3ahuzuq_wii6l.js +0 -1
  149. /package/web/_next/static/{5B6R6zkMOO-jMrOE_HKge → KOmtJW9C8Na0OCY-uXSeu}/_buildManifest.js +0 -0
  150. /package/web/_next/static/{5B6R6zkMOO-jMrOE_HKge → KOmtJW9C8Na0OCY-uXSeu}/_clientMiddlewareManifest.js +0 -0
  151. /package/web/_next/static/{5B6R6zkMOO-jMrOE_HKge → KOmtJW9C8Na0OCY-uXSeu}/_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.2.0";
926
+ NOMAD_VERSION = "0.4.0";
927
927
  NomadError = class extends Error {
928
928
  constructor(message, code, hint) {
929
929
  super(message);
@@ -967,7 +967,11 @@ var init_keymaterial = __esm({
967
967
  /(^|\/)\.priors(\/|$)/,
968
968
  /(^|\/)\.config\/priors(\/|$)/,
969
969
  /(^|\/)\.local\/state\/priors-mcp(\/|$)/,
970
- /(^|\/)\.agent001(\/|$)/
970
+ /(^|\/)\.agent001(\/|$)/,
971
+ // Oak Agent Kit: the encrypted wallet (wallet.enc), private notes (*.gloam.enc), the wallet journal and settings.
972
+ /(^|\/)\.oak(\/|$)/,
973
+ // Hedgehood: the session, payer and owner key files and the kit's settings.
974
+ /(^|\/)\.hedgehood(\/|$)/
971
975
  ];
972
976
  KEY_MATERIAL_FILES = [/(^|\/)agent(-\d+)?\.key$/];
973
977
  skipped = /* @__PURE__ */ new Set();
@@ -1057,6 +1061,33 @@ async function isFile(p) {
1057
1061
  return false;
1058
1062
  }
1059
1063
  }
1064
+ function drainSkippedLinks() {
1065
+ const out2 = [...skippedLinks].sort();
1066
+ skippedLinks.clear();
1067
+ return out2;
1068
+ }
1069
+ async function linkTargetAllowed(p) {
1070
+ const realOf = (d) => {
1071
+ try {
1072
+ return realpathSync2.native(d);
1073
+ } catch {
1074
+ return d;
1075
+ }
1076
+ };
1077
+ let real;
1078
+ try {
1079
+ real = realpathSync2.native(p);
1080
+ } catch {
1081
+ return false;
1082
+ }
1083
+ const posixReal = real.split(sep).join("/");
1084
+ if (CREDENTIAL_LINK_TARGETS.some((re) => re.test(posixReal)) || isKeyMaterialPath(real)) return false;
1085
+ const inside = (dir) => {
1086
+ const r = relative(dir, real);
1087
+ return r !== "" && !r.startsWith("..") && !isAbsolute(r);
1088
+ };
1089
+ return [home(), realOf(home()), dirname(p), realOf(dirname(p))].some(inside);
1090
+ }
1060
1091
  async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
1061
1092
  if (isKeyMaterialPath(p)) {
1062
1093
  if (await pathExists(p)) recordSkippedKeyMaterial(p);
@@ -1067,6 +1098,11 @@ async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
1067
1098
  if (st.isSymbolicLink()) {
1068
1099
  const real = await fsp.stat(p);
1069
1100
  if (!real.isFile()) return null;
1101
+ if (!await linkTargetAllowed(p)) {
1102
+ skippedLinks.add(p);
1103
+ return null;
1104
+ }
1105
+ if (real.size > maxBytes) throw new Error(`${p} is larger than ${maxBytes} bytes`);
1070
1106
  } else if (!st.isFile()) return null;
1071
1107
  if (st.size > maxBytes) throw new Error(`${p} is larger than ${maxBytes} bytes`);
1072
1108
  return await fsp.readFile(p, "utf8");
@@ -1147,7 +1183,7 @@ function realHome() {
1147
1183
  return home();
1148
1184
  }
1149
1185
  }
1150
- var UnsafePathError;
1186
+ var UnsafePathError, CREDENTIAL_LINK_TARGETS, skippedLinks;
1151
1187
  var init_fs = __esm({
1152
1188
  "../../packages/core/src/node/fs.ts"() {
1153
1189
  "use strict";
@@ -1158,6 +1194,19 @@ var init_fs = __esm({
1158
1194
  this.name = "UnsafePathError";
1159
1195
  }
1160
1196
  };
1197
+ CREDENTIAL_LINK_TARGETS = [
1198
+ /(^|\/)\.(ssh|aws|gnupg|kube|azure|password-store)(\/|$)/,
1199
+ /(^|\/)\.config\/(gh|gcloud|hub)(\/|$)/,
1200
+ /(^|\/)\.docker\/config\.json$/,
1201
+ /(^|\/)\.(netrc|git-credentials|npmrc|pypirc|pgpass|my\.cnf)$/,
1202
+ /(^|\/)\.env(\..+)?$/,
1203
+ /(^|\/)\.?(credentials|secrets?)(\.[a-z]+)?$/i,
1204
+ /(^|\/)auth(-profiles)?\.json$/i,
1205
+ /\.(pem|key|p12|pfx|keystore|jks|kdbx)$/i,
1206
+ /(^|\/)id_(rsa|dsa|ecdsa|ed25519)(\.pub)?$/,
1207
+ /(^|\/)\.[a-z]*_history$/
1208
+ ];
1209
+ skippedLinks = /* @__PURE__ */ new Set();
1161
1210
  }
1162
1211
  });
1163
1212
 
@@ -1223,6 +1272,27 @@ function redactLaunchField(text3) {
1223
1272
  });
1224
1273
  return { text: out2, count };
1225
1274
  }
1275
+ function redactWalletText(text3) {
1276
+ const matches2 = rawMatches(text3).filter((m) => WALLET_RULE_IDS.has(m.rule.id));
1277
+ if (!matches2.length) return { text: text3, count: 0 };
1278
+ let out2 = "";
1279
+ let last = 0;
1280
+ for (const m of matches2) {
1281
+ out2 += text3.slice(last, m.start) + `[REDACTED:${m.rule.id}]`;
1282
+ last = m.end;
1283
+ }
1284
+ out2 += text3.slice(last);
1285
+ return { text: out2, count: matches2.length };
1286
+ }
1287
+ function redactWalletLaunchField(text3) {
1288
+ const r = redactWalletText(text3);
1289
+ let count = r.count;
1290
+ const out2 = r.text.replace(EVM_KEY, () => {
1291
+ count++;
1292
+ return "[REDACTED:evm-private-key]";
1293
+ });
1294
+ return { text: out2, count };
1295
+ }
1226
1296
  function shannonEntropy(s) {
1227
1297
  if (!s) return 0;
1228
1298
  const freq = /* @__PURE__ */ new Map();
@@ -1303,7 +1373,7 @@ function redactText(text3) {
1303
1373
  out2 += text3.slice(last);
1304
1374
  return { text: out2, count: matches2.length };
1305
1375
  }
1306
- var EVM_KEY, SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY, PUBLIC_RPC_HOSTS;
1376
+ var EVM_KEY, SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY, PUBLIC_RPC_HOSTS, WALLET_RULE_IDS;
1307
1377
  var init_secrets = __esm({
1308
1378
  "../../packages/security/src/secrets.ts"() {
1309
1379
  "use strict";
@@ -1374,6 +1444,7 @@ var init_secrets = __esm({
1374
1444
  "rpc.ordofi.network",
1375
1445
  "mainnet.base.org"
1376
1446
  ]);
1447
+ WALLET_RULE_IDS = /* @__PURE__ */ new Set(["evm-private-key", "bip39-mnemonic"]);
1377
1448
  }
1378
1449
  });
1379
1450
 
@@ -1382,6 +1453,11 @@ function isSecretEnvEntry(key2, value) {
1382
1453
  if (isSensitiveEnvKey(key2) || looksLikeSecretValue(value) || EVM_KEY_VALUE.test(value)) return true;
1383
1454
  return isRpcEnvKey(key2) && !isPublicRpcUrl(value);
1384
1455
  }
1456
+ function isWalletEnvEntry(key2, value) {
1457
+ const v = value.trim();
1458
+ if (EVM_KEY_VALUE.test(v) || isMnemonic(v) || redactWalletText(v).count > 0) return true;
1459
+ return WALLET_ENV_NAME.test(key2) && (BARE_HEX_KEY.test(v) || BASE58_KEY.test(v) || BYTE_ARRAY_KEY.test(v));
1460
+ }
1385
1461
  function visitText(doc, fn) {
1386
1462
  if (doc.identity.persona) fn("identity/persona.md", doc.identity.persona);
1387
1463
  if (doc.identity.description) fn("identity/description", doc.identity.description);
@@ -1431,32 +1507,33 @@ function scanDocument(doc) {
1431
1507
  clean: findings.length === 0 && sensitiveFiles.length === 0 && inlineSecretValues.length === 0
1432
1508
  };
1433
1509
  }
1434
- function stripRecord(tool, rec, report) {
1510
+ function stripRecord(tool, rec, report, isSecret) {
1435
1511
  const out2 = {};
1436
1512
  for (const [k, v] of Object.entries(rec)) {
1437
- if ("value" in v && isSecretEnvEntry(k, v.value)) {
1513
+ if ("value" in v && isSecret(k, v.value)) {
1438
1514
  out2[k] = { secretRef: k, redacted: true };
1439
1515
  report.strippedEnvValues.push({ tool, key: k });
1516
+ if (report.includedSecrets) report.walletKeysKept++;
1440
1517
  } else out2[k] = v;
1441
1518
  }
1442
1519
  return out2;
1443
1520
  }
1444
1521
  function sanitizeDocument(doc, options = {}) {
1445
- const report = { redactedText: 0, strippedEnvValues: [], removedFiles: [], includedSecrets: !!options.includeSecrets };
1446
- if (options.includeSecrets) {
1447
- if (options.includeSensitiveFiles) return { doc, report };
1448
- }
1522
+ const include = !!options.includeSecrets;
1523
+ const report = { redactedText: 0, strippedEnvValues: [], removedFiles: [], includedSecrets: include, walletKeysKept: 0 };
1449
1524
  const red2 = (s) => {
1450
- if (options.includeSecrets) return s;
1451
- const r = redactText(s);
1525
+ const r = include ? redactWalletText(s) : redactText(s);
1452
1526
  report.redactedText += r.count;
1527
+ if (include) report.walletKeysKept += r.count;
1453
1528
  return r.text;
1454
1529
  };
1455
1530
  const launch = (s) => {
1456
- const r = redactLaunchField(s);
1531
+ const r = include ? redactWalletLaunchField(s) : redactLaunchField(s);
1457
1532
  report.redactedText += r.count;
1533
+ if (include) report.walletKeysKept += r.count;
1458
1534
  return r.text;
1459
1535
  };
1536
+ const isSecret = include ? isWalletEnvEntry : isSecretEnvEntry;
1460
1537
  const keepFile = (path) => {
1461
1538
  if (options.includeSensitiveFiles || !isSensitiveFile(path)) return true;
1462
1539
  report.removedFiles.push(path);
@@ -1482,14 +1559,14 @@ function sanitizeDocument(doc, options = {}) {
1482
1559
  actions: w.actions.map((a) => a.kind === "prompt" ? { ...a, text: red2(a.text) } : a)
1483
1560
  })),
1484
1561
  tools: doc.tools.map(
1485
- (t) => t.mcp && !options.includeSecrets ? {
1562
+ (t) => t.mcp ? {
1486
1563
  ...t,
1487
1564
  mcp: {
1488
1565
  ...t.mcp,
1489
1566
  args: t.mcp.args.map(launch),
1490
1567
  url: t.mcp.url === void 0 ? void 0 : launch(t.mcp.url),
1491
- env: stripRecord(t.name, t.mcp.env, report),
1492
- headers: stripRecord(t.name, t.mcp.headers, report)
1568
+ env: stripRecord(t.name, t.mcp.env, report, isSecret),
1569
+ headers: stripRecord(t.name, t.mcp.headers, report, isSecret)
1493
1570
  }
1494
1571
  } : t
1495
1572
  ),
@@ -1498,12 +1575,16 @@ function sanitizeDocument(doc, options = {}) {
1498
1575
  };
1499
1576
  return { doc: out2, report };
1500
1577
  }
1501
- var EVM_KEY_VALUE;
1578
+ var EVM_KEY_VALUE, WALLET_ENV_NAME, BARE_HEX_KEY, BASE58_KEY, BYTE_ARRAY_KEY;
1502
1579
  var init_document2 = __esm({
1503
1580
  "../../packages/security/src/document.ts"() {
1504
1581
  "use strict";
1505
1582
  init_secrets();
1506
1583
  EVM_KEY_VALUE = /\b0x[0-9a-fA-F]{64}\b/;
1584
+ WALLET_ENV_NAME = /(PRIVATE|WALLET|SIGNER|MNEMONIC|SEED|OWNER|PAYER|SESSION)/i;
1585
+ BARE_HEX_KEY = /^(?:0x)?[0-9a-fA-F]{64}$/;
1586
+ BASE58_KEY = /^[1-9A-HJ-NP-Za-km-z]{86,90}$/;
1587
+ BYTE_ARRAY_KEY = /^\[\s*\d{1,3}(?:\s*,\s*\d{1,3}){63}\s*\]$/;
1507
1588
  }
1508
1589
  });
1509
1590
 
@@ -3308,7 +3389,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
3308
3389
  out2.unsupported.push({
3309
3390
  category: "permissions",
3310
3391
  item: `${tool.name}: ${k}`,
3311
- reason: `Limit not carried: it was a reference on the source, so the destination uses Priors defaults${looser ? ` (${looser})` : ""}.`,
3392
+ reason: `Limit not carried: it was a reference on the source, so the destination uses ${profile.vendor} defaults${looser ? ` (${looser})` : ""}.`,
3312
3393
  alternative: `Set ${k} on the destination to keep the limit.`
3313
3394
  });
3314
3395
  }
@@ -3316,7 +3397,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
3316
3397
  const keptOptional = [...optional].filter((k) => env[k]);
3317
3398
  if (keptOptional.length) mcp.optionalEnv = keptOptional;
3318
3399
  else delete mcp.optionalEnv;
3319
- mcp.emptyOkEnv = profile.emptyOkEnv;
3400
+ if (profile.emptyOkEnv.length) mcp.emptyOkEnv = profile.emptyOkEnv;
3320
3401
  out2.tool = { ...tool, mcp };
3321
3402
  profile.apply?.(out2.tool, out2, platformName);
3322
3403
  return out2;
@@ -3324,7 +3405,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
3324
3405
  function knownServerId(tool) {
3325
3406
  return PROFILES.find((p) => p.matches(tool))?.id ?? null;
3326
3407
  }
3327
- var isPriorsHost, PRIORS, PROFILES;
3408
+ var isPriorsHost, PRIORS, isOakCommand, OAK, HEDGEHOOD_HOSTS, isHedgehoodHost, isHedgehoodCommand, HEDGEHOOD_KEY_VARS, HEDGEHOOD, PROFILES;
3328
3409
  var init_known_servers = __esm({
3329
3410
  "../../packages/adapters/src/known-servers.ts"() {
3330
3411
  "use strict";
@@ -3338,6 +3419,7 @@ var init_known_servers = __esm({
3338
3419
  };
3339
3420
  PRIORS = {
3340
3421
  id: "priors",
3422
+ vendor: "Priors",
3341
3423
  label: "Priors (a credit service for agents on Robinhood Chain)",
3342
3424
  matches: (t) => !!t.mcp && (t.mcp.command === "priors-mcp" || t.mcp.args.some((a) => a.includes("@priors/mcp")) || isPriorsHost(t.mcp.url)),
3343
3425
  keyVars: ["PRIORS_KEY_FILE", "PRIORS_KEY"],
@@ -3385,7 +3467,125 @@ var init_known_servers = __esm({
3385
3467
  }
3386
3468
  }
3387
3469
  };
3388
- PROFILES = [PRIORS];
3470
+ isOakCommand = (command) => !!command && /(^|[\\/])oak(\.cmd|\.exe)?$/i.test(command);
3471
+ OAK = {
3472
+ id: "oak",
3473
+ vendor: "Oak",
3474
+ label: "Oak Agent Kit (a local wallet and tools for Robinhood Chain projects)",
3475
+ matches: (t) => !!t.mcp && t.mcp.transport === "stdio" && (isOakCommand(t.mcp.command) && t.mcp.args[0] === "mcp" || t.mcp.args.some((a) => /^@oakagentkit\/addon(@|$)/.test(a))),
3476
+ keyVars: [],
3477
+ emptyOkEnv: [],
3478
+ limitVars: ["OAK_AUTO_DAILY_CAP_USD"],
3479
+ looserDefaults: { OAK_AUTO_DAILY_CAP_USD: "50 USD a day for automatic approvals" },
3480
+ apply(t, out2, platform) {
3481
+ const mcp = t.mcp;
3482
+ out2.notes.push({
3483
+ level: "info",
3484
+ category: "integrations",
3485
+ message: "Oak's wallet, its settings (including the approval mode and the daily budget) and its keychain entry stay on this computer, in ~/.oak and the system keychain. Nomad never reads ~/.oak."
3486
+ });
3487
+ out2.notes.push({
3488
+ level: "warning",
3489
+ category: "tools",
3490
+ message: `Oak: if ${platform} runs on another computer, Oak creates a new, empty wallet there the first time it starts. To keep the same wallet, restore it there yourself, in your own terminal and never through an agent, following Oak's backup guide (oak backup).`
3491
+ });
3492
+ out2.notes.push({
3493
+ level: "warning",
3494
+ category: "tools",
3495
+ message: `Oak: Oak asks for approval in the app before it signs. Oak's documentation says apps without MCP form elicitation cannot sign in its default ask mode, so check that ${platform} shows Oak's approval form before relying on it.`
3496
+ });
3497
+ if (isOakCommand(mcp.command)) {
3498
+ out2.manualSteps.push(`Install Oak for "${t.name}": npm install -g @oakagentkit/addon. It needs Node.js 22.12 or later, and the oak command must be on the PATH ${platform} uses.`);
3499
+ } else {
3500
+ out2.manualSteps.push(`"${t.name}" runs Oak through npx: ${platform} needs Node.js 22.12 or later on its PATH.`);
3501
+ }
3502
+ for (const k of ["OAK_NETWORK", "OAK_CHAIN_ID"]) {
3503
+ const v = mcp.env[k];
3504
+ if (v && !("value" in v)) {
3505
+ out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}": ${k} is a reference. Set it on ${platform} too; without it Oak uses Robinhood Chain mainnet.` });
3506
+ }
3507
+ }
3508
+ }
3509
+ };
3510
+ HEDGEHOOD_HOSTS = /* @__PURE__ */ new Set(["mcp.hedgehood.io", "testnet-mcp.hedgehood.io"]);
3511
+ isHedgehoodHost = (url) => {
3512
+ if (!url) return false;
3513
+ try {
3514
+ return HEDGEHOOD_HOSTS.has(new URL(url).hostname);
3515
+ } catch {
3516
+ return false;
3517
+ }
3518
+ };
3519
+ isHedgehoodCommand = (command) => !!command && /(^|[\\/])hedgehood-mcp(\.cmd|\.exe)?$/i.test(command);
3520
+ HEDGEHOOD_KEY_VARS = ["HEDGEHOOD_SESSION_KEY_FILE", "HEDGEHOOD_SESSION_KEY", "HEDGEHOOD_PAYER_KEY_FILE", "HEDGEHOOD_PAYER_KEY", "HEDGEHOOD_OWNER_KEY_FILE", "HEDGEHOOD_OWNER_KEY"];
3521
+ HEDGEHOOD = {
3522
+ id: "hedgehood",
3523
+ vendor: "Hedgehood",
3524
+ label: "Hedgehood (an options market for AI agents on Robinhood Chain)",
3525
+ matches: (t) => !!t.mcp && (isHedgehoodCommand(t.mcp.command) || t.mcp.args.some((a) => /^@hedgehood-io\/mcp(@|$)/.test(a)) || isHedgehoodHost(t.mcp.url)),
3526
+ // Both the file and the raw form of a key may be set (the file wins), so keys are handled in apply().
3527
+ keyVars: [],
3528
+ emptyOkEnv: [],
3529
+ limitVars: ["HEDGEHOOD_MAX_DEPOSIT", "HEDGEHOOD_DRY_RUN"],
3530
+ looserDefaults: { HEDGEHOOD_MAX_DEPOSIT: "1000 USDG per deposit", HEDGEHOOD_DRY_RUN: "write tools only simulate" },
3531
+ apply(t, out2, platform) {
3532
+ const mcp = t.mcp;
3533
+ if (mcp.transport !== "stdio") {
3534
+ 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.` });
3535
+ return;
3536
+ }
3537
+ out2.notes.push({
3538
+ level: "info",
3539
+ category: "integrations",
3540
+ 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."
3541
+ });
3542
+ for (const k of ["HEDGEHOOD_SESSION_KEY", "HEDGEHOOD_PAYER_KEY", "HEDGEHOOD_OWNER_KEY"]) {
3543
+ const v = mcp.env[k];
3544
+ if (v && "value" in v) mcp.env[k] = { secretRef: k, redacted: true };
3545
+ }
3546
+ for (const k of HEDGEHOOD_KEY_VARS) {
3547
+ if (!mcp.env[k]) continue;
3548
+ out2.unsupported.push({
3549
+ category: "tools",
3550
+ item: `${t.name}: ${k}`,
3551
+ reason: "Hedgehood keys and key files are references only; Nomad never reads or copies them.",
3552
+ 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."
3553
+ });
3554
+ }
3555
+ if (mcp.env.HEDGEHOOD_OWNER_KEY_FILE || mcp.env.HEDGEHOOD_OWNER_KEY) {
3556
+ out2.notes.push({
3557
+ level: "warning",
3558
+ category: "tools",
3559
+ 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.`
3560
+ });
3561
+ }
3562
+ out2.notes.push({
3563
+ level: "warning",
3564
+ category: "tools",
3565
+ 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).`
3566
+ });
3567
+ const chain = mcp.env.HEDGEHOOD_CHAIN_ID;
3568
+ const mainnetFlag = mcp.args.includes("--mainnet");
3569
+ const testnetFlag = mcp.args.includes("--testnet");
3570
+ if (mainnetFlag || chain && "value" in chain && chain.value.trim() === "4663") {
3571
+ out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" runs on Robinhood Chain mainnet (4663): trades settle in real USDG.` });
3572
+ } else if (testnetFlag || chain && "value" in chain && chain.value.trim() === "46630") {
3573
+ out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" runs on the Robinhood Chain testnet (46630), with test funds.` });
3574
+ } else {
3575
+ out2.notes.push({
3576
+ level: "warning",
3577
+ category: "tools",
3578
+ 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.`
3579
+ });
3580
+ }
3581
+ if (isHedgehoodCommand(mcp.command)) {
3582
+ 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.`);
3583
+ } else {
3584
+ out2.manualSteps.push(`"${t.name}" runs Hedgehood through npx: ${platform} needs Node.js 20 or later on its PATH.`);
3585
+ }
3586
+ }
3587
+ };
3588
+ PROFILES = [PRIORS, OAK, HEDGEHOOD];
3389
3589
  }
3390
3590
  });
3391
3591
 
@@ -4294,6 +4494,14 @@ async function readInstalledPlugins(root, settings2, notes) {
4294
4494
  if (mcpFile?.mcpServers) {
4295
4495
  out2.sourceFiles.push(mcpPath);
4296
4496
  Object.assign(servers, mcpFile.mcpServers);
4497
+ } else if (mcpFile && typeof mcpFile === "object") {
4498
+ const flat = Object.entries(mcpFile).filter(
4499
+ ([, v]) => !!v && typeof v === "object" && !Array.isArray(v) && (typeof v.command === "string" || typeof v.url === "string")
4500
+ );
4501
+ if (flat.length) {
4502
+ out2.sourceFiles.push(mcpPath);
4503
+ Object.assign(servers, Object.fromEntries(flat));
4504
+ }
4297
4505
  }
4298
4506
  out2.tools.push(...toolsFromMcpServers(servers, P, `plugins/${id}`, { notes, ...provenance }));
4299
4507
  const skillDirs = Array.isArray(manifest.skills) ? manifest.skills : typeof manifest.skills === "string" ? [manifest.skills] : ["skills"];
@@ -4301,7 +4509,8 @@ async function readInstalledPlugins(root, settings2, notes) {
4301
4509
  if (typeof rel !== "string") continue;
4302
4510
  const abs = resolve2(dir, rel);
4303
4511
  if (abs !== dir && !abs.startsWith(dir + sep2)) continue;
4304
- for (const sk of await readSkillsTree(abs, P, notes, 1)) {
4512
+ const single = abs !== dir ? await readSkillDir(abs, P, notes) : null;
4513
+ for (const sk of single ? [single] : await readSkillsTree(abs, P, notes, 1)) {
4305
4514
  sk.source = { ...sk.source ?? { platform: P }, note: provenance.note, ...provenance.extra };
4306
4515
  out2.skills.push(sk);
4307
4516
  }
@@ -4488,7 +4697,8 @@ async function planMain(doc, ctx, L) {
4488
4697
  const fromPlugins = new Set([...doc.tools, ...doc.skills].map((x) => pluginOf(x, P)).filter((x) => !!x));
4489
4698
  for (const id of fromPlugins) {
4490
4699
  const info = doc.integrations.find((i) => i.kind === "claude-code-plugin" && i.name === id)?.config;
4491
- const market = typeof info?.marketplaceRepo === "string" ? info.marketplaceRepo : id.split("@")[1] ?? "<marketplace>";
4700
+ const marketName = id.split("@")[1];
4701
+ const market = typeof info?.marketplaceRepo === "string" ? info.marketplaceRepo : (marketName && KNOWN_MARKETPLACE_REPOS[marketName]) ?? marketName ?? "<marketplace>";
4492
4702
  manualSteps.push(`Install the plugin ${id} in Claude Code: /plugin marketplace add ${market}, then /plugin install ${id}. Nomad does not copy plugin servers or skills.`);
4493
4703
  }
4494
4704
  if (wants(ctx, "skills")) {
@@ -4581,7 +4791,7 @@ function planSubagent(doc, ctx, L, stem) {
4581
4791
  for (const r of restricted) unsupported.push({ category: "permissions", item: `${r.effect} ${r.capability} (${r.pattern})`, reason: "Subagents only support a tool allowlist.", alternative: "Add the rule to settings.json if it should apply to the whole project." });
4582
4792
  return { nativeId: `subagent:${stem}`, files, notes: [], manualSteps, conversions: [], unsupported };
4583
4793
  }
4584
- var P, TOOL_CAP, SUBAGENT_TOOLS, claudeCodeAdapter;
4794
+ var P, KNOWN_MARKETPLACE_REPOS, TOOL_CAP, SUBAGENT_TOOLS, claudeCodeAdapter;
4585
4795
  var init_claude_code = __esm({
4586
4796
  "../../packages/adapters/src/claude-code.ts"() {
4587
4797
  "use strict";
@@ -4590,6 +4800,10 @@ var init_claude_code = __esm({
4590
4800
  init_catalog();
4591
4801
  init_util();
4592
4802
  P = "claude-code";
4803
+ KNOWN_MARKETPLACE_REPOS = {
4804
+ "oak-agent-kit": "OakAgentKit/oak",
4805
+ hedgehood: "0xHedgeHood/hedgehood-agent-kit"
4806
+ };
4593
4807
  TOOL_CAP = {
4594
4808
  Bash: "shell",
4595
4809
  Read: "read",
@@ -7632,6 +7846,7 @@ async function applyOperations(ops) {
7632
7846
  const pending = ops.filter((o) => o.action === "create" || o.action === "update");
7633
7847
  const done = [];
7634
7848
  const createdDirs = [];
7849
+ const modes = /* @__PURE__ */ new Map();
7635
7850
  try {
7636
7851
  for (const op of pending) {
7637
7852
  assertNoSymlinks(op.root, op.abs);
@@ -7655,20 +7870,23 @@ async function applyOperations(ops) {
7655
7870
  createdDirs.push(dir);
7656
7871
  }
7657
7872
  let mode = op.mode;
7658
- if (current2) mode = (await fsp5.stat(op.abs)).mode & 511;
7873
+ if (current2) {
7874
+ mode = (await fsp5.stat(op.abs)).mode & 511;
7875
+ modes.set(op.abs, mode);
7876
+ }
7659
7877
  await atomicWrite(op.abs, op.after, mode);
7660
7878
  done.push(op);
7661
7879
  }
7662
7880
  } catch (e) {
7663
- await rollback(done, createdDirs);
7881
+ await rollback(done, createdDirs, modes);
7664
7882
  throw e;
7665
7883
  }
7666
7884
  return { written: done };
7667
7885
  }
7668
- async function rollback(done, createdDirs) {
7886
+ async function rollback(done, createdDirs, modes = /* @__PURE__ */ new Map()) {
7669
7887
  for (const op of [...done].reverse()) {
7670
7888
  try {
7671
- if (op.before) await atomicWrite(op.abs, op.before);
7889
+ if (op.before) await atomicWrite(op.abs, op.before, modes.get(op.abs) ?? 384);
7672
7890
  else await fsp5.rm(op.abs, { force: true });
7673
7891
  } catch {
7674
7892
  }
@@ -7968,7 +8186,10 @@ var init_keys = __esm({
7968
8186
  // ../../packages/migration/src/engine.ts
7969
8187
  import { promises as fsp7, constants as constants2 } from "fs";
7970
8188
  import { basename as basename8, dirname as dirname5, join as join15 } from "path";
7971
- var PLAN_TTL_MS, Nomad;
8189
+ function commandLine(command, args) {
8190
+ return [command, ...args].map(shellWord).join(" ");
8191
+ }
8192
+ var shellWord, PLAN_TTL_MS, Nomad;
7972
8193
  var init_engine = __esm({
7973
8194
  "../../packages/migration/src/engine.ts"() {
7974
8195
  "use strict";
@@ -7985,6 +8206,7 @@ var init_engine = __esm({
7985
8206
  init_policy();
7986
8207
  init_compare();
7987
8208
  init_keys();
8209
+ shellWord = (a) => /^[\w@%+=:,./-]+$/.test(a) ? a : `'${a.replace(/'/g, "'\\''")}'`;
7988
8210
  PLAN_TTL_MS = 30 * 60 * 1e3;
7989
8211
  Nomad = class {
7990
8212
  store;
@@ -8026,11 +8248,16 @@ var init_engine = __esm({
8026
8248
  if (!adapter.read) throw new NomadError(`${adapter.info.displayName} cannot be read by Nomad.`, "not-readable", "Guided platforms only accept agents.");
8027
8249
  const r = resolveRoot(root);
8028
8250
  drainSkippedKeyMaterial();
8251
+ drainSkippedLinks();
8029
8252
  const result = await adapter.read(r, nativeId, { includeFiles: options.includeFiles, includeSecrets: options.includeSecrets });
8030
8253
  const skippedKeys = drainSkippedKeyMaterial();
8031
8254
  if (skippedKeys.length) {
8032
8255
  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)` });
8033
8256
  }
8257
+ const skippedLinks2 = drainSkippedLinks();
8258
+ if (skippedLinks2.length) {
8259
+ 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)` });
8260
+ }
8034
8261
  let doc = parseDocument(result.doc);
8035
8262
  const mapped = this.store.findByLocation(adapterId, r, nativeId);
8036
8263
  if (!this.store.getAgent(doc.id) && mapped) doc = { ...doc, id: mapped.agentId };
@@ -8045,7 +8272,7 @@ var init_engine = __esm({
8045
8272
  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 });
8046
8273
  }
8047
8274
  const out2 = options.includeSecrets ? sanitizeDocument(doc, { includeSecrets: true }) : clean;
8048
- return { doc: out2.doc, notes: result.notes, scan, sanitize: clean.report, version, sourceFiles: result.sourceFiles, sourceAdapter: adapter };
8275
+ return { doc: out2.doc, notes: result.notes, scan, sanitize: out2.report, version, sourceFiles: result.sourceFiles, sourceAdapter: adapter };
8049
8276
  }
8050
8277
  signerOf(u) {
8051
8278
  return signerStatus(u.info?.signature, signingIdentity(this.store.home, false), this.store.getSetting("trustedKeys", []));
@@ -8117,6 +8344,9 @@ var init_engine = __esm({
8117
8344
  if (mode === "replace" && changing.some((o) => o.replacesForeign)) approvalsRequired.push("replace");
8118
8345
  if (changing.some((o) => o.userModified)) approvalsRequired.push("overwrite-modified");
8119
8346
  if (widened.length) approvalsRequired.push("broader-permissions");
8347
+ const toolsWritten = ["full", "convert"].includes(compatibility.categories.find((c2) => c2.category === "tools")?.status ?? "");
8348
+ 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) }));
8349
+ if (commands.length && changing.length) approvalsRequired.push("run-commands");
8120
8350
  const notes = [...loaded.notes, ...planned.notes];
8121
8351
  if (!(await adapter.detect(root)).detected && adapter.info.support !== "GUIDED") {
8122
8352
  notes.push({ level: "info", message: `${adapter.info.displayName} was not detected at ${displayPath(root)}. Nomad will create the files there.` });
@@ -8124,6 +8354,12 @@ var init_engine = __esm({
8124
8354
  if (loaded.sanitize.redactedText || loaded.sanitize.strippedEnvValues.length) {
8125
8355
  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.` });
8126
8356
  }
8357
+ if (loaded.sanitize.walletKeysKept) {
8358
+ 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.` });
8359
+ }
8360
+ for (const c2 of commands) {
8361
+ 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.` });
8362
+ }
8127
8363
  const statusCount = (s) => compatibility.categories.filter((c2) => c2.status === s).length;
8128
8364
  const id = shortId("plan");
8129
8365
  const plan = {
@@ -8176,6 +8412,7 @@ var init_engine = __esm({
8176
8412
  unsupported: statusCount("unsupported")
8177
8413
  },
8178
8414
  approvalsRequired,
8415
+ commands,
8179
8416
  blocked
8180
8417
  };
8181
8418
  this.plans.set(id, { plan, ops, doc, adapter, ctx, planned, at: Date.now() });
@@ -8232,7 +8469,7 @@ var init_engine = __esm({
8232
8469
  if (options.token && options.token !== plan.token) throw new NomadError("The approval does not match this preview.", "token-mismatch");
8233
8470
  if (plan.blocked.length) throw new NomadError("This migration cannot run: " + plan.blocked.join(" "), "blocked");
8234
8471
  const missing = plan.approvalsRequired.filter(
8235
- (a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions
8472
+ (a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions || a === "run-commands" && !approvals.runCommands
8236
8473
  );
8237
8474
  if (missing.length) {
8238
8475
  throw new NomadError(`Explicit approval is required: ${missing.join(", ")}.`, "approval-required", "Review the preview and approve these changes to continue.");
@@ -8603,6 +8840,7 @@ var src_exports3 = {};
8603
8840
  __export(src_exports3, {
8604
8841
  Nomad: () => Nomad,
8605
8842
  applyOperations: () => applyOperations,
8843
+ commandLine: () => commandLine,
8606
8844
  compareDocuments: () => compareDocuments,
8607
8845
  computeOperations: () => computeOperations,
8608
8846
  createBackup: () => createBackup,
@@ -8801,7 +9039,7 @@ function createMcpServer(options = {}) {
8801
9039
  if (sensitive.length && !options.allowReplace) {
8802
9040
  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.");
8803
9041
  }
8804
- const receipt = await nomad.execute(planId, { replace: sensitive.includes("replace"), overwriteModified: sensitive.includes("overwrite-modified"), broaderPermissions: sensitive.includes("broader-permissions") }, { token: approvalToken });
9042
+ 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 });
8805
9043
  return text2(receipt);
8806
9044
  } catch (e) {
8807
9045
  return fail(e);
@@ -9009,6 +9247,7 @@ function summaryText(p) {
9009
9247
  if (p.conversions.length) lines.push(`Adapted: ${p.conversions.map((c2) => `${c2.item} ${dim("\u2192 " + c2.to)}`).join("; ")}.`);
9010
9248
  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)"));
9011
9249
  if (p.disabledRoutines.length) lines.push(`Routines arrive paused: ${p.disabledRoutines.join(", ")}.`);
9250
+ 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)`) : ""));
9012
9251
  if (p.secrets.findings || p.secrets.strippedEnv.length) {
9013
9252
  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);
9014
9253
  lines.push(`Secrets stay behind: ${parts.join("; ")}.`);
@@ -9025,6 +9264,7 @@ function approvalQuestion(p) {
9025
9264
  if (p.approvalsRequired.includes("replace")) parts.push(`it replaces content Nomad did not create`);
9026
9265
  if (p.approvalsRequired.includes("overwrite-modified")) parts.push(`it overwrites files you edited after Nomad wrote them`);
9027
9266
  if (p.approvalsRequired.includes("broader-permissions")) parts.push(`the destination would allow more than it does now (${p.permissions.widened.join("; ")})`);
9267
+ 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`);
9028
9268
  return parts.length ? `Heads up: ${parts.join(", and ")}.` : null;
9029
9269
  }
9030
9270
 
@@ -9234,7 +9474,7 @@ async function handle(req, ctx, path) {
9234
9474
  }
9235
9475
  case "POST execute": {
9236
9476
  const s = await body(req);
9237
- const receipt = await nomad.execute(String(s.planId), { replace: !!s.approvals?.replace, overwriteModified: !!s.approvals?.overwriteModified, broaderPermissions: !!s.approvals?.broaderPermissions }, { token: String(s.token) });
9477
+ 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) });
9238
9478
  return json(receipt);
9239
9479
  }
9240
9480
  case "POST export": {
@@ -9477,11 +9717,11 @@ async function previewAndApply(nomad, plan, o) {
9477
9717
  return plan.blocked.length ? EXIT.error : EXIT.ok;
9478
9718
  }
9479
9719
  if (!output.json) print(output, show, null);
9480
- const approvals = { replace: o.approveReplace, overwriteModified: o.approveModified, broaderPermissions: o.approvePermissions };
9481
- const missing = plan.approvalsRequired.filter((a) => a === "replace" && !approvals.replace || a === "overwrite-modified" && !approvals.overwriteModified || a === "broader-permissions" && !approvals.broaderPermissions);
9720
+ const approvals = { replace: o.approveReplace, overwriteModified: o.approveModified, broaderPermissions: o.approvePermissions, runCommands: o.approveCommands };
9721
+ 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);
9482
9722
  if (o.yes || !process.stdin.isTTY) {
9483
9723
  if (missing.length) {
9484
- const flags = missing.map((m) => m === "replace" ? "--approve-replace" : m === "overwrite-modified" ? "--approve-modified" : "--approve-permissions");
9724
+ const flags = missing.map((m) => m === "replace" ? "--approve-replace" : m === "overwrite-modified" ? "--approve-modified" : m === "run-commands" ? "--approve-commands" : "--approve-permissions");
9485
9725
  throw new NomadError(`This migration needs explicit approval: ${missing.join(", ")}.`, "approval-required", `Review the preview, then add ${flags.join(" ")}.`);
9486
9726
  }
9487
9727
  if (!o.yes) throw new NomadError("Not running interactively.", "approval-required", "Add --yes to apply without a prompt, or --dry-run to preview.");
@@ -9496,6 +9736,7 @@ async function previewAndApply(nomad, plan, o) {
9496
9736
  if (m === "replace") approvals.replace = true;
9497
9737
  if (m === "overwrite-modified") approvals.overwriteModified = true;
9498
9738
  if (m === "broader-permissions") approvals.broaderPermissions = true;
9739
+ if (m === "run-commands") approvals.runCommands = true;
9499
9740
  }
9500
9741
  }
9501
9742
  const receipt = await nomad.execute(plan.id, approvals, { token: plan.token });
@@ -9511,7 +9752,7 @@ function shortReceipt(r) {
9511
9752
  ...r.backupId ? ["", dim(`Changed your mind? ${CMD} restore ${r.backupId}`)] : []
9512
9753
  ];
9513
9754
  }
9514
- 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");
9755
+ 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");
9515
9756
  program.command("adapters").description("list supported platforms and what each can transfer").option("--platform <id>", "show one platform in detail").action(
9516
9757
  (o) => run2(async (nomad) => {
9517
9758
  const infos = nomad.adapters();
@@ -9569,12 +9810,12 @@ program.command("validate <package>").description("check a package (.nomad, .age
9569
9810
  return r.ok ? EXIT.ok : EXIT.invalid;
9570
9811
  })
9571
9812
  );
9572
- 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(
9813
+ 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(
9573
9814
  (source, o) => run2(async (nomad) => {
9574
9815
  const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
9575
9816
  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"));
9576
9817
  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 });
9577
- 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);
9818
+ 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);
9578
9819
  })
9579
9820
  );
9580
9821
  approvalOptions(
@@ -9600,7 +9841,7 @@ approvalOptions(
9600
9841
  })
9601
9842
  );
9602
9843
  approvalOptions(
9603
- 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)")
9844
+ 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)")
9604
9845
  ).action(
9605
9846
  (o) => run2(async (nomad) => {
9606
9847
  const spec = await parseSource(nomad, o.from, { sourceDir: o.sourceDir, agent: o.agent });