thenomad 0.3.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 (136) hide show
  1. package/dist/nomad.js +223 -37
  2. package/package.json +1 -1
  3. package/web/404.html +1 -1
  4. package/web/__next.__PAGE__.txt +3 -3
  5. package/web/__next._full.txt +3 -3
  6. package/web/__next._tree.txt +1 -1
  7. package/web/_next/static/chunks/{240m_9t_ozl62.js → 01v5aab_kf3r7.js} +1 -1
  8. package/web/_next/static/chunks/0acwr1ymxj2xd.js +1 -0
  9. package/web/_next/static/chunks/1aptcj-lfpf2a.js +1 -0
  10. package/web/_next/static/chunks/1plj9h4y9cgwa.js +1 -0
  11. package/web/_next/static/chunks/2ka3apprzgwd-.js +7 -0
  12. package/web/_not-found/__next._full.txt +1 -1
  13. package/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
  14. package/web/_not-found/__next._tree.txt +1 -1
  15. package/web/_not-found.html +1 -1
  16. package/web/_not-found.txt +1 -1
  17. package/web/app/__next._full.txt +1 -1
  18. package/web/app/__next._tree.txt +1 -1
  19. package/web/app/__next.app.__PAGE__.txt +1 -1
  20. package/web/app/__next.app.txt +1 -1
  21. package/web/app/agents/__next._full.txt +1 -1
  22. package/web/app/agents/__next._tree.txt +1 -1
  23. package/web/app/agents/__next.app.agents.__PAGE__.txt +1 -1
  24. package/web/app/agents/__next.app.txt +1 -1
  25. package/web/app/agents/view/__next._full.txt +1 -1
  26. package/web/app/agents/view/__next._tree.txt +1 -1
  27. package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +1 -1
  28. package/web/app/agents/view/__next.app.txt +1 -1
  29. package/web/app/agents/view.html +1 -1
  30. package/web/app/agents/view.txt +1 -1
  31. package/web/app/agents.html +1 -1
  32. package/web/app/agents.txt +1 -1
  33. package/web/app/backups/__next._full.txt +1 -1
  34. package/web/app/backups/__next._tree.txt +1 -1
  35. package/web/app/backups/__next.app.backups.__PAGE__.txt +1 -1
  36. package/web/app/backups/__next.app.txt +1 -1
  37. package/web/app/backups.html +1 -1
  38. package/web/app/backups.txt +1 -1
  39. package/web/app/compatibility/__next._full.txt +3 -3
  40. package/web/app/compatibility/__next._tree.txt +1 -1
  41. package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +3 -3
  42. package/web/app/compatibility/__next.app.txt +1 -1
  43. package/web/app/compatibility.html +1 -1
  44. package/web/app/compatibility.txt +3 -3
  45. package/web/app/export/__next._full.txt +4 -4
  46. package/web/app/export/__next._tree.txt +1 -1
  47. package/web/app/export/__next.app.export.__PAGE__.txt +4 -4
  48. package/web/app/export/__next.app.txt +1 -1
  49. package/web/app/export.html +1 -1
  50. package/web/app/export.txt +4 -4
  51. package/web/app/history/__next._full.txt +4 -4
  52. package/web/app/history/__next._tree.txt +1 -1
  53. package/web/app/history/__next.app.history.__PAGE__.txt +4 -4
  54. package/web/app/history/__next.app.txt +1 -1
  55. package/web/app/history.html +1 -1
  56. package/web/app/history.txt +4 -4
  57. package/web/app/import/__next._full.txt +1 -1
  58. package/web/app/import/__next._tree.txt +1 -1
  59. package/web/app/import/__next.app.import.__PAGE__.txt +1 -1
  60. package/web/app/import/__next.app.txt +1 -1
  61. package/web/app/import.html +1 -1
  62. package/web/app/import.txt +1 -1
  63. package/web/app/migrate/__next._full.txt +4 -4
  64. package/web/app/migrate/__next._tree.txt +1 -1
  65. package/web/app/migrate/__next.app.migrate.__PAGE__.txt +4 -4
  66. package/web/app/migrate/__next.app.txt +1 -1
  67. package/web/app/migrate.html +1 -1
  68. package/web/app/migrate.txt +4 -4
  69. package/web/app/settings/__next._full.txt +1 -1
  70. package/web/app/settings/__next._tree.txt +1 -1
  71. package/web/app/settings/__next.app.settings.__PAGE__.txt +1 -1
  72. package/web/app/settings/__next.app.txt +1 -1
  73. package/web/app/settings.html +1 -1
  74. package/web/app/settings.txt +1 -1
  75. package/web/app/versions/__next._full.txt +1 -1
  76. package/web/app/versions/__next._tree.txt +1 -1
  77. package/web/app/versions/__next.app.txt +1 -1
  78. package/web/app/versions/__next.app.versions.__PAGE__.txt +1 -1
  79. package/web/app/versions.html +1 -1
  80. package/web/app/versions.txt +1 -1
  81. package/web/app.html +1 -1
  82. package/web/app.txt +1 -1
  83. package/web/docs/__next._full.txt +2 -2
  84. package/web/docs/__next._tree.txt +1 -1
  85. package/web/docs/__next.docs.__PAGE__.txt +2 -2
  86. package/web/docs/adapters/__next._full.txt +18 -16
  87. package/web/docs/adapters/__next._tree.txt +1 -1
  88. package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +15 -13
  89. package/web/docs/adapters.html +1 -1
  90. package/web/docs/adapters.txt +18 -16
  91. package/web/docs/format/__next._full.txt +1 -1
  92. package/web/docs/format/__next._tree.txt +1 -1
  93. package/web/docs/format/__next.docs.format.__PAGE__.txt +1 -1
  94. package/web/docs/format.html +1 -1
  95. package/web/docs/format.txt +1 -1
  96. package/web/docs/security/__next._full.txt +26 -21
  97. package/web/docs/security/__next._tree.txt +1 -1
  98. package/web/docs/security/__next.docs.security.__PAGE__.txt +24 -19
  99. package/web/docs/security.html +1 -1
  100. package/web/docs/security.txt +26 -21
  101. package/web/docs/token/__next._full.txt +1 -1
  102. package/web/docs/token/__next._tree.txt +1 -1
  103. package/web/docs/token/__next.docs.token.__PAGE__.txt +1 -1
  104. package/web/docs/token.html +1 -1
  105. package/web/docs/token.txt +1 -1
  106. package/web/docs.html +1 -1
  107. package/web/docs.txt +2 -2
  108. package/web/index.html +2 -2
  109. package/web/index.txt +3 -3
  110. package/web/inspect/__next._full.txt +4 -4
  111. package/web/inspect/__next._tree.txt +1 -1
  112. package/web/inspect/__next.inspect.__PAGE__.txt +4 -4
  113. package/web/inspect.html +1 -1
  114. package/web/inspect.txt +4 -4
  115. package/web/privacy/__next._full.txt +1 -1
  116. package/web/privacy/__next._tree.txt +1 -1
  117. package/web/privacy/__next.privacy.__PAGE__.txt +1 -1
  118. package/web/privacy.html +1 -1
  119. package/web/privacy.txt +1 -1
  120. package/web/terms/__next._full.txt +1 -1
  121. package/web/terms/__next._tree.txt +1 -1
  122. package/web/terms/__next.terms.__PAGE__.txt +1 -1
  123. package/web/terms.html +1 -1
  124. package/web/terms.txt +1 -1
  125. package/web/vote/__next._full.txt +1 -1
  126. package/web/vote/__next._tree.txt +1 -1
  127. package/web/vote/__next.vote.__PAGE__.txt +1 -1
  128. package/web/vote.html +1 -1
  129. package/web/vote.txt +1 -1
  130. package/web/_next/static/chunks/0yz4pc7gp4_iw.js +0 -1
  131. package/web/_next/static/chunks/1_0w_nimjt5-w.js +0 -1
  132. package/web/_next/static/chunks/2m8g429r9sjgz.js +0 -7
  133. package/web/_next/static/chunks/3ahuzuq_wii6l.js +0 -1
  134. /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → KOmtJW9C8Na0OCY-uXSeu}/_buildManifest.js +0 -0
  135. /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → KOmtJW9C8Na0OCY-uXSeu}/_clientMiddlewareManifest.js +0 -0
  136. /package/web/_next/static/{ZvJnVlnOSb137CZRNRk3Z → 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.3.0";
926
+ NOMAD_VERSION = "0.4.0";
927
927
  NomadError = class extends Error {
928
928
  constructor(message, code, hint) {
929
929
  super(message);
@@ -969,7 +969,9 @@ 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(\/|$)/
973
975
  ];
974
976
  KEY_MATERIAL_FILES = [/(^|\/)agent(-\d+)?\.key$/];
975
977
  skipped = /* @__PURE__ */ new Set();
@@ -1059,6 +1061,33 @@ async function isFile(p) {
1059
1061
  return false;
1060
1062
  }
1061
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
+ }
1062
1091
  async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
1063
1092
  if (isKeyMaterialPath(p)) {
1064
1093
  if (await pathExists(p)) recordSkippedKeyMaterial(p);
@@ -1069,6 +1098,11 @@ async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
1069
1098
  if (st.isSymbolicLink()) {
1070
1099
  const real = await fsp.stat(p);
1071
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`);
1072
1106
  } else if (!st.isFile()) return null;
1073
1107
  if (st.size > maxBytes) throw new Error(`${p} is larger than ${maxBytes} bytes`);
1074
1108
  return await fsp.readFile(p, "utf8");
@@ -1149,7 +1183,7 @@ function realHome() {
1149
1183
  return home();
1150
1184
  }
1151
1185
  }
1152
- var UnsafePathError;
1186
+ var UnsafePathError, CREDENTIAL_LINK_TARGETS, skippedLinks;
1153
1187
  var init_fs = __esm({
1154
1188
  "../../packages/core/src/node/fs.ts"() {
1155
1189
  "use strict";
@@ -1160,6 +1194,19 @@ var init_fs = __esm({
1160
1194
  this.name = "UnsafePathError";
1161
1195
  }
1162
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();
1163
1210
  }
1164
1211
  });
1165
1212
 
@@ -1225,6 +1272,27 @@ function redactLaunchField(text3) {
1225
1272
  });
1226
1273
  return { text: out2, count };
1227
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
+ }
1228
1296
  function shannonEntropy(s) {
1229
1297
  if (!s) return 0;
1230
1298
  const freq = /* @__PURE__ */ new Map();
@@ -1305,7 +1373,7 @@ function redactText(text3) {
1305
1373
  out2 += text3.slice(last);
1306
1374
  return { text: out2, count: matches2.length };
1307
1375
  }
1308
- 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;
1309
1377
  var init_secrets = __esm({
1310
1378
  "../../packages/security/src/secrets.ts"() {
1311
1379
  "use strict";
@@ -1376,6 +1444,7 @@ var init_secrets = __esm({
1376
1444
  "rpc.ordofi.network",
1377
1445
  "mainnet.base.org"
1378
1446
  ]);
1447
+ WALLET_RULE_IDS = /* @__PURE__ */ new Set(["evm-private-key", "bip39-mnemonic"]);
1379
1448
  }
1380
1449
  });
1381
1450
 
@@ -1384,6 +1453,11 @@ function isSecretEnvEntry(key2, value) {
1384
1453
  if (isSensitiveEnvKey(key2) || looksLikeSecretValue(value) || EVM_KEY_VALUE.test(value)) return true;
1385
1454
  return isRpcEnvKey(key2) && !isPublicRpcUrl(value);
1386
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
+ }
1387
1461
  function visitText(doc, fn) {
1388
1462
  if (doc.identity.persona) fn("identity/persona.md", doc.identity.persona);
1389
1463
  if (doc.identity.description) fn("identity/description", doc.identity.description);
@@ -1433,32 +1507,33 @@ function scanDocument(doc) {
1433
1507
  clean: findings.length === 0 && sensitiveFiles.length === 0 && inlineSecretValues.length === 0
1434
1508
  };
1435
1509
  }
1436
- function stripRecord(tool, rec, report) {
1510
+ function stripRecord(tool, rec, report, isSecret) {
1437
1511
  const out2 = {};
1438
1512
  for (const [k, v] of Object.entries(rec)) {
1439
- if ("value" in v && isSecretEnvEntry(k, v.value)) {
1513
+ if ("value" in v && isSecret(k, v.value)) {
1440
1514
  out2[k] = { secretRef: k, redacted: true };
1441
1515
  report.strippedEnvValues.push({ tool, key: k });
1516
+ if (report.includedSecrets) report.walletKeysKept++;
1442
1517
  } else out2[k] = v;
1443
1518
  }
1444
1519
  return out2;
1445
1520
  }
1446
1521
  function sanitizeDocument(doc, options = {}) {
1447
- const report = { redactedText: 0, strippedEnvValues: [], removedFiles: [], includedSecrets: !!options.includeSecrets };
1448
- if (options.includeSecrets) {
1449
- if (options.includeSensitiveFiles) return { doc, report };
1450
- }
1522
+ const include = !!options.includeSecrets;
1523
+ const report = { redactedText: 0, strippedEnvValues: [], removedFiles: [], includedSecrets: include, walletKeysKept: 0 };
1451
1524
  const red2 = (s) => {
1452
- if (options.includeSecrets) return s;
1453
- const r = redactText(s);
1525
+ const r = include ? redactWalletText(s) : redactText(s);
1454
1526
  report.redactedText += r.count;
1527
+ if (include) report.walletKeysKept += r.count;
1455
1528
  return r.text;
1456
1529
  };
1457
1530
  const launch = (s) => {
1458
- const r = redactLaunchField(s);
1531
+ const r = include ? redactWalletLaunchField(s) : redactLaunchField(s);
1459
1532
  report.redactedText += r.count;
1533
+ if (include) report.walletKeysKept += r.count;
1460
1534
  return r.text;
1461
1535
  };
1536
+ const isSecret = include ? isWalletEnvEntry : isSecretEnvEntry;
1462
1537
  const keepFile = (path) => {
1463
1538
  if (options.includeSensitiveFiles || !isSensitiveFile(path)) return true;
1464
1539
  report.removedFiles.push(path);
@@ -1484,14 +1559,14 @@ function sanitizeDocument(doc, options = {}) {
1484
1559
  actions: w.actions.map((a) => a.kind === "prompt" ? { ...a, text: red2(a.text) } : a)
1485
1560
  })),
1486
1561
  tools: doc.tools.map(
1487
- (t) => t.mcp && !options.includeSecrets ? {
1562
+ (t) => t.mcp ? {
1488
1563
  ...t,
1489
1564
  mcp: {
1490
1565
  ...t.mcp,
1491
1566
  args: t.mcp.args.map(launch),
1492
1567
  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)
1568
+ env: stripRecord(t.name, t.mcp.env, report, isSecret),
1569
+ headers: stripRecord(t.name, t.mcp.headers, report, isSecret)
1495
1570
  }
1496
1571
  } : t
1497
1572
  ),
@@ -1500,12 +1575,16 @@ function sanitizeDocument(doc, options = {}) {
1500
1575
  };
1501
1576
  return { doc: out2, report };
1502
1577
  }
1503
- var EVM_KEY_VALUE;
1578
+ var EVM_KEY_VALUE, WALLET_ENV_NAME, BARE_HEX_KEY, BASE58_KEY, BYTE_ARRAY_KEY;
1504
1579
  var init_document2 = __esm({
1505
1580
  "../../packages/security/src/document.ts"() {
1506
1581
  "use strict";
1507
1582
  init_secrets();
1508
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*\]$/;
1509
1588
  }
1510
1589
  });
1511
1590
 
@@ -3326,7 +3405,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
3326
3405
  function knownServerId(tool) {
3327
3406
  return PROFILES.find((p) => p.matches(tool))?.id ?? null;
3328
3407
  }
3329
- var isPriorsHost, PRIORS, isOakCommand, OAK, PROFILES;
3408
+ var isPriorsHost, PRIORS, isOakCommand, OAK, HEDGEHOOD_HOSTS, isHedgehoodHost, isHedgehoodCommand, HEDGEHOOD_KEY_VARS, HEDGEHOOD, PROFILES;
3330
3409
  var init_known_servers = __esm({
3331
3410
  "../../packages/adapters/src/known-servers.ts"() {
3332
3411
  "use strict";
@@ -3428,7 +3507,85 @@ var init_known_servers = __esm({
3428
3507
  }
3429
3508
  }
3430
3509
  };
3431
- PROFILES = [PRIORS, OAK];
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];
3432
3589
  }
3433
3590
  });
3434
3591
 
@@ -4352,7 +4509,8 @@ async function readInstalledPlugins(root, settings2, notes) {
4352
4509
  if (typeof rel !== "string") continue;
4353
4510
  const abs = resolve2(dir, rel);
4354
4511
  if (abs !== dir && !abs.startsWith(dir + sep2)) continue;
4355
- 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)) {
4356
4514
  sk.source = { ...sk.source ?? { platform: P }, note: provenance.note, ...provenance.extra };
4357
4515
  out2.skills.push(sk);
4358
4516
  }
@@ -4643,7 +4801,8 @@ var init_claude_code = __esm({
4643
4801
  init_util();
4644
4802
  P = "claude-code";
4645
4803
  KNOWN_MARKETPLACE_REPOS = {
4646
- "oak-agent-kit": "OakAgentKit/oak"
4804
+ "oak-agent-kit": "OakAgentKit/oak",
4805
+ hedgehood: "0xHedgeHood/hedgehood-agent-kit"
4647
4806
  };
4648
4807
  TOOL_CAP = {
4649
4808
  Bash: "shell",
@@ -7687,6 +7846,7 @@ async function applyOperations(ops) {
7687
7846
  const pending = ops.filter((o) => o.action === "create" || o.action === "update");
7688
7847
  const done = [];
7689
7848
  const createdDirs = [];
7849
+ const modes = /* @__PURE__ */ new Map();
7690
7850
  try {
7691
7851
  for (const op of pending) {
7692
7852
  assertNoSymlinks(op.root, op.abs);
@@ -7710,20 +7870,23 @@ async function applyOperations(ops) {
7710
7870
  createdDirs.push(dir);
7711
7871
  }
7712
7872
  let mode = op.mode;
7713
- 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
+ }
7714
7877
  await atomicWrite(op.abs, op.after, mode);
7715
7878
  done.push(op);
7716
7879
  }
7717
7880
  } catch (e) {
7718
- await rollback(done, createdDirs);
7881
+ await rollback(done, createdDirs, modes);
7719
7882
  throw e;
7720
7883
  }
7721
7884
  return { written: done };
7722
7885
  }
7723
- async function rollback(done, createdDirs) {
7886
+ async function rollback(done, createdDirs, modes = /* @__PURE__ */ new Map()) {
7724
7887
  for (const op of [...done].reverse()) {
7725
7888
  try {
7726
- if (op.before) await atomicWrite(op.abs, op.before);
7889
+ if (op.before) await atomicWrite(op.abs, op.before, modes.get(op.abs) ?? 384);
7727
7890
  else await fsp5.rm(op.abs, { force: true });
7728
7891
  } catch {
7729
7892
  }
@@ -8023,7 +8186,10 @@ var init_keys = __esm({
8023
8186
  // ../../packages/migration/src/engine.ts
8024
8187
  import { promises as fsp7, constants as constants2 } from "fs";
8025
8188
  import { basename as basename8, dirname as dirname5, join as join15 } from "path";
8026
- 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;
8027
8193
  var init_engine = __esm({
8028
8194
  "../../packages/migration/src/engine.ts"() {
8029
8195
  "use strict";
@@ -8040,6 +8206,7 @@ var init_engine = __esm({
8040
8206
  init_policy();
8041
8207
  init_compare();
8042
8208
  init_keys();
8209
+ shellWord = (a) => /^[\w@%+=:,./-]+$/.test(a) ? a : `'${a.replace(/'/g, "'\\''")}'`;
8043
8210
  PLAN_TTL_MS = 30 * 60 * 1e3;
8044
8211
  Nomad = class {
8045
8212
  store;
@@ -8081,11 +8248,16 @@ var init_engine = __esm({
8081
8248
  if (!adapter.read) throw new NomadError(`${adapter.info.displayName} cannot be read by Nomad.`, "not-readable", "Guided platforms only accept agents.");
8082
8249
  const r = resolveRoot(root);
8083
8250
  drainSkippedKeyMaterial();
8251
+ drainSkippedLinks();
8084
8252
  const result = await adapter.read(r, nativeId, { includeFiles: options.includeFiles, includeSecrets: options.includeSecrets });
8085
8253
  const skippedKeys = drainSkippedKeyMaterial();
8086
8254
  if (skippedKeys.length) {
8087
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)` });
8088
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
+ }
8089
8261
  let doc = parseDocument(result.doc);
8090
8262
  const mapped = this.store.findByLocation(adapterId, r, nativeId);
8091
8263
  if (!this.store.getAgent(doc.id) && mapped) doc = { ...doc, id: mapped.agentId };
@@ -8100,7 +8272,7 @@ var init_engine = __esm({
8100
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 });
8101
8273
  }
8102
8274
  const out2 = options.includeSecrets ? sanitizeDocument(doc, { includeSecrets: true }) : clean;
8103
- 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 };
8104
8276
  }
8105
8277
  signerOf(u) {
8106
8278
  return signerStatus(u.info?.signature, signingIdentity(this.store.home, false), this.store.getSetting("trustedKeys", []));
@@ -8172,6 +8344,9 @@ var init_engine = __esm({
8172
8344
  if (mode === "replace" && changing.some((o) => o.replacesForeign)) approvalsRequired.push("replace");
8173
8345
  if (changing.some((o) => o.userModified)) approvalsRequired.push("overwrite-modified");
8174
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");
8175
8350
  const notes = [...loaded.notes, ...planned.notes];
8176
8351
  if (!(await adapter.detect(root)).detected && adapter.info.support !== "GUIDED") {
8177
8352
  notes.push({ level: "info", message: `${adapter.info.displayName} was not detected at ${displayPath(root)}. Nomad will create the files there.` });
@@ -8179,6 +8354,12 @@ var init_engine = __esm({
8179
8354
  if (loaded.sanitize.redactedText || loaded.sanitize.strippedEnvValues.length) {
8180
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.` });
8181
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
+ }
8182
8363
  const statusCount = (s) => compatibility.categories.filter((c2) => c2.status === s).length;
8183
8364
  const id = shortId("plan");
8184
8365
  const plan = {
@@ -8231,6 +8412,7 @@ var init_engine = __esm({
8231
8412
  unsupported: statusCount("unsupported")
8232
8413
  },
8233
8414
  approvalsRequired,
8415
+ commands,
8234
8416
  blocked
8235
8417
  };
8236
8418
  this.plans.set(id, { plan, ops, doc, adapter, ctx, planned, at: Date.now() });
@@ -8287,7 +8469,7 @@ var init_engine = __esm({
8287
8469
  if (options.token && options.token !== plan.token) throw new NomadError("The approval does not match this preview.", "token-mismatch");
8288
8470
  if (plan.blocked.length) throw new NomadError("This migration cannot run: " + plan.blocked.join(" "), "blocked");
8289
8471
  const missing = plan.approvalsRequired.filter(
8290
- (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
8291
8473
  );
8292
8474
  if (missing.length) {
8293
8475
  throw new NomadError(`Explicit approval is required: ${missing.join(", ")}.`, "approval-required", "Review the preview and approve these changes to continue.");
@@ -8658,6 +8840,7 @@ var src_exports3 = {};
8658
8840
  __export(src_exports3, {
8659
8841
  Nomad: () => Nomad,
8660
8842
  applyOperations: () => applyOperations,
8843
+ commandLine: () => commandLine,
8661
8844
  compareDocuments: () => compareDocuments,
8662
8845
  computeOperations: () => computeOperations,
8663
8846
  createBackup: () => createBackup,
@@ -8856,7 +9039,7 @@ function createMcpServer(options = {}) {
8856
9039
  if (sensitive.length && !options.allowReplace) {
8857
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.");
8858
9041
  }
8859
- 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 });
8860
9043
  return text2(receipt);
8861
9044
  } catch (e) {
8862
9045
  return fail(e);
@@ -9064,6 +9247,7 @@ function summaryText(p) {
9064
9247
  if (p.conversions.length) lines.push(`Adapted: ${p.conversions.map((c2) => `${c2.item} ${dim("\u2192 " + c2.to)}`).join("; ")}.`);
9065
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)"));
9066
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)`) : ""));
9067
9251
  if (p.secrets.findings || p.secrets.strippedEnv.length) {
9068
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);
9069
9253
  lines.push(`Secrets stay behind: ${parts.join("; ")}.`);
@@ -9080,6 +9264,7 @@ function approvalQuestion(p) {
9080
9264
  if (p.approvalsRequired.includes("replace")) parts.push(`it replaces content Nomad did not create`);
9081
9265
  if (p.approvalsRequired.includes("overwrite-modified")) parts.push(`it overwrites files you edited after Nomad wrote them`);
9082
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`);
9083
9268
  return parts.length ? `Heads up: ${parts.join(", and ")}.` : null;
9084
9269
  }
9085
9270
 
@@ -9289,7 +9474,7 @@ async function handle(req, ctx, path) {
9289
9474
  }
9290
9475
  case "POST execute": {
9291
9476
  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) });
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) });
9293
9478
  return json(receipt);
9294
9479
  }
9295
9480
  case "POST export": {
@@ -9532,11 +9717,11 @@ async function previewAndApply(nomad, plan, o) {
9532
9717
  return plan.blocked.length ? EXIT.error : EXIT.ok;
9533
9718
  }
9534
9719
  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);
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);
9537
9722
  if (o.yes || !process.stdin.isTTY) {
9538
9723
  if (missing.length) {
9539
- 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");
9540
9725
  throw new NomadError(`This migration needs explicit approval: ${missing.join(", ")}.`, "approval-required", `Review the preview, then add ${flags.join(" ")}.`);
9541
9726
  }
9542
9727
  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 +9736,7 @@ async function previewAndApply(nomad, plan, o) {
9551
9736
  if (m === "replace") approvals.replace = true;
9552
9737
  if (m === "overwrite-modified") approvals.overwriteModified = true;
9553
9738
  if (m === "broader-permissions") approvals.broaderPermissions = true;
9739
+ if (m === "run-commands") approvals.runCommands = true;
9554
9740
  }
9555
9741
  }
9556
9742
  const receipt = await nomad.execute(plan.id, approvals, { token: plan.token });
@@ -9566,7 +9752,7 @@ function shortReceipt(r) {
9566
9752
  ...r.backupId ? ["", dim(`Changed your mind? ${CMD} restore ${r.backupId}`)] : []
9567
9753
  ];
9568
9754
  }
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");
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");
9570
9756
  program.command("adapters").description("list supported platforms and what each can transfer").option("--platform <id>", "show one platform in detail").action(
9571
9757
  (o) => run2(async (nomad) => {
9572
9758
  const infos = nomad.adapters();
@@ -9624,12 +9810,12 @@ program.command("validate <package>").description("check a package (.nomad, .age
9624
9810
  return r.ok ? EXIT.ok : EXIT.invalid;
9625
9811
  })
9626
9812
  );
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(
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(
9628
9814
  (source, o) => run2(async (nomad) => {
9629
9815
  const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
9630
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"));
9631
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 });
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);
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);
9633
9819
  })
9634
9820
  );
9635
9821
  approvalOptions(
@@ -9655,7 +9841,7 @@ approvalOptions(
9655
9841
  })
9656
9842
  );
9657
9843
  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)")
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)")
9659
9845
  ).action(
9660
9846
  (o) => run2(async (nomad) => {
9661
9847
  const spec = await parseSource(nomad, o.from, { sourceDir: o.sourceDir, agent: o.agent });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thenomad",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Move AI agents between OpenClaw, Claude Code, Codex, Hermes and more, with a preview, a backup and one question.",
5
5
  "keywords": [
6
6
  "ai",