thenomad 0.1.0 → 0.2.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 (113) hide show
  1. package/dist/nomad.js +1253 -272
  2. package/package.json +2 -2
  3. package/web/404.html +1 -1
  4. package/web/__next.__PAGE__.txt +23 -22
  5. package/web/__next._full.txt +23 -22
  6. package/web/__next._tree.txt +1 -1
  7. package/web/_next/static/chunks/25ks-kwg9va83.js +1 -0
  8. package/web/_next/static/chunks/294sy_-iu03pf.js +1 -0
  9. package/web/_next/static/chunks/2m8g429r9sjgz.js +7 -0
  10. package/web/_next/static/chunks/{2itrx72tv-gct.js → 3-sl52vw828p-.js} +16 -16
  11. package/web/_not-found/__next._full.txt +2 -2
  12. package/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  13. package/web/_not-found/__next._tree.txt +1 -1
  14. package/web/_not-found.html +1 -1
  15. package/web/_not-found.txt +2 -2
  16. package/web/app/__next._full.txt +3 -3
  17. package/web/app/__next._tree.txt +1 -1
  18. package/web/app/__next.app.__PAGE__.txt +3 -3
  19. package/web/app/agents/__next._full.txt +3 -3
  20. package/web/app/agents/__next._tree.txt +1 -1
  21. package/web/app/agents/__next.app.agents.__PAGE__.txt +3 -3
  22. package/web/app/agents/view/__next._full.txt +3 -3
  23. package/web/app/agents/view/__next._tree.txt +1 -1
  24. package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +3 -3
  25. package/web/app/agents/view.html +1 -1
  26. package/web/app/agents/view.txt +3 -3
  27. package/web/app/agents.html +1 -1
  28. package/web/app/agents.txt +3 -3
  29. package/web/app/backups/__next._full.txt +3 -3
  30. package/web/app/backups/__next._tree.txt +1 -1
  31. package/web/app/backups/__next.app.backups.__PAGE__.txt +3 -3
  32. package/web/app/backups.html +1 -1
  33. package/web/app/backups.txt +3 -3
  34. package/web/app/compatibility/__next._full.txt +5 -5
  35. package/web/app/compatibility/__next._tree.txt +1 -1
  36. package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +5 -5
  37. package/web/app/compatibility.html +1 -1
  38. package/web/app/compatibility.txt +5 -5
  39. package/web/app/export/__next._full.txt +5 -5
  40. package/web/app/export/__next._tree.txt +1 -1
  41. package/web/app/export/__next.app.export.__PAGE__.txt +5 -5
  42. package/web/app/export.html +1 -1
  43. package/web/app/export.txt +5 -5
  44. package/web/app/history/__next._full.txt +5 -5
  45. package/web/app/history/__next._tree.txt +1 -1
  46. package/web/app/history/__next.app.history.__PAGE__.txt +5 -5
  47. package/web/app/history.html +1 -1
  48. package/web/app/history.txt +5 -5
  49. package/web/app/import/__next._full.txt +3 -3
  50. package/web/app/import/__next._tree.txt +1 -1
  51. package/web/app/import/__next.app.import.__PAGE__.txt +3 -3
  52. package/web/app/import.html +1 -1
  53. package/web/app/import.txt +3 -3
  54. package/web/app/migrate/__next._full.txt +5 -5
  55. package/web/app/migrate/__next._tree.txt +1 -1
  56. package/web/app/migrate/__next.app.migrate.__PAGE__.txt +5 -5
  57. package/web/app/migrate.html +1 -1
  58. package/web/app/migrate.txt +5 -5
  59. package/web/app/settings/__next._full.txt +3 -3
  60. package/web/app/settings/__next._tree.txt +1 -1
  61. package/web/app/settings/__next.app.settings.__PAGE__.txt +3 -3
  62. package/web/app/settings.html +1 -1
  63. package/web/app/settings.txt +3 -3
  64. package/web/app/versions/__next._full.txt +3 -3
  65. package/web/app/versions/__next._tree.txt +1 -1
  66. package/web/app/versions/__next.app.versions.__PAGE__.txt +3 -3
  67. package/web/app/versions.html +1 -1
  68. package/web/app/versions.txt +3 -3
  69. package/web/app.html +1 -1
  70. package/web/app.txt +3 -3
  71. package/web/docs/__next._full.txt +4 -4
  72. package/web/docs/__next._tree.txt +1 -1
  73. package/web/docs/__next.docs.__PAGE__.txt +2 -2
  74. package/web/docs/adapters/__next._full.txt +57 -53
  75. package/web/docs/adapters/__next._tree.txt +1 -1
  76. package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +55 -51
  77. package/web/docs/adapters.html +1 -1
  78. package/web/docs/adapters.txt +57 -53
  79. package/web/docs/format/__next._full.txt +4 -4
  80. package/web/docs/format/__next._tree.txt +1 -1
  81. package/web/docs/format/__next.docs.format.__PAGE__.txt +2 -2
  82. package/web/docs/format.html +1 -1
  83. package/web/docs/format.txt +4 -4
  84. package/web/docs/security/__next._full.txt +5 -5
  85. package/web/docs/security/__next._tree.txt +1 -1
  86. package/web/docs/security/__next.docs.security.__PAGE__.txt +3 -3
  87. package/web/docs/security.html +1 -1
  88. package/web/docs/security.txt +5 -5
  89. package/web/docs.html +1 -1
  90. package/web/docs.txt +4 -4
  91. package/web/index.html +5 -5
  92. package/web/index.txt +23 -22
  93. package/web/inspect/__next._full.txt +8 -8
  94. package/web/inspect/__next._tree.txt +1 -1
  95. package/web/inspect/__next.inspect.__PAGE__.txt +8 -8
  96. package/web/inspect.html +1 -1
  97. package/web/inspect.txt +8 -8
  98. package/web/privacy/__next._full.txt +3 -3
  99. package/web/privacy/__next._tree.txt +1 -1
  100. package/web/privacy/__next.privacy.__PAGE__.txt +29 -30
  101. package/web/privacy.html +1 -1
  102. package/web/privacy.txt +3 -3
  103. package/web/terms/__next._full.txt +28 -27
  104. package/web/terms/__next._tree.txt +1 -1
  105. package/web/terms/__next.terms.__PAGE__.txt +3 -3
  106. package/web/terms.html +1 -1
  107. package/web/terms.txt +28 -27
  108. package/web/_next/static/chunks/0pa_vjzo6qbn_.js +0 -1
  109. package/web/_next/static/chunks/2-s_pll2nvnpu.js +0 -7
  110. package/web/_next/static/chunks/245h302r_8ful.js +0 -1
  111. /package/web/_next/static/{iPPtzTmZOHZrEFsNQeVmA → 5B6R6zkMOO-jMrOE_HKge}/_buildManifest.js +0 -0
  112. /package/web/_next/static/{iPPtzTmZOHZrEFsNQeVmA → 5B6R6zkMOO-jMrOE_HKge}/_clientMiddlewareManifest.js +0 -0
  113. /package/web/_next/static/{iPPtzTmZOHZrEFsNQeVmA → 5B6R6zkMOO-jMrOE_HKge}/_ssgManifest.js +0 -0
package/dist/nomad.js CHANGED
@@ -391,8 +391,8 @@ function ulid(now = Date.now()) {
391
391
  rand[i] = 0;
392
392
  }
393
393
  } else {
394
- const bytes = randomBytes(16);
395
- rand = Array.from(bytes, (b) => b % 32);
394
+ const bytes2 = randomBytes(16);
395
+ rand = Array.from(bytes2, (b) => b % 32);
396
396
  }
397
397
  lastTime = now;
398
398
  lastRandom = rand;
@@ -497,9 +497,9 @@ function sortValue(v) {
497
497
  }
498
498
  return v;
499
499
  }
500
- function base64Encode(bytes) {
500
+ function base64Encode(bytes2) {
501
501
  let s = "";
502
- for (let i = 0; i < bytes.length; i += 32768) s += String.fromCharCode(...bytes.subarray(i, i + 32768));
502
+ for (let i = 0; i < bytes2.length; i += 32768) s += String.fromCharCode(...bytes2.subarray(i, i + 32768));
503
503
  return btoa(s);
504
504
  }
505
505
  function base64Decode(s) {
@@ -900,10 +900,10 @@ function mergeEntries(existing, incoming, delimiter) {
900
900
  a.push(e);
901
901
  added++;
902
902
  }
903
- const sep4 = delimiter.trim() === delimiter ? `
903
+ const sep5 = delimiter.trim() === delimiter ? `
904
904
  ${delimiter}
905
905
  ` : delimiter;
906
- return { value: a.join(sep4) + (a.length ? "\n" : ""), added, duplicates };
906
+ return { value: a.join(sep5) + (a.length ? "\n" : ""), added, duplicates };
907
907
  }
908
908
  var init_merge = __esm({
909
909
  "../../packages/core/src/merge.ts"() {
@@ -923,7 +923,7 @@ var init_src2 = __esm({
923
923
  init_markdown();
924
924
  init_document();
925
925
  init_merge();
926
- NOMAD_VERSION = "0.1.0";
926
+ NOMAD_VERSION = "0.2.0";
927
927
  NomadError = class extends Error {
928
928
  constructor(message, code, hint) {
929
929
  super(message);
@@ -937,8 +937,45 @@ var init_src2 = __esm({
937
937
  }
938
938
  });
939
939
 
940
+ // ../../packages/core/src/node/keymaterial.ts
941
+ import { realpathSync } from "fs";
942
+ function matches(p) {
943
+ const posix2 = p.replace(/\\/g, "/");
944
+ return KEY_MATERIAL_DIRS.some((re) => re.test(posix2)) || KEY_MATERIAL_FILES.some((re) => re.test(posix2));
945
+ }
946
+ function isKeyMaterialPath(abs) {
947
+ if (matches(abs)) return true;
948
+ try {
949
+ return matches(realpathSync(abs));
950
+ } catch {
951
+ return false;
952
+ }
953
+ }
954
+ function recordSkippedKeyMaterial(abs) {
955
+ skipped.add(abs);
956
+ }
957
+ function drainSkippedKeyMaterial() {
958
+ const out2 = [...skipped].sort();
959
+ skipped.clear();
960
+ return out2;
961
+ }
962
+ var KEY_MATERIAL_DIRS, KEY_MATERIAL_FILES, skipped;
963
+ var init_keymaterial = __esm({
964
+ "../../packages/core/src/node/keymaterial.ts"() {
965
+ "use strict";
966
+ KEY_MATERIAL_DIRS = [
967
+ /(^|\/)\.priors(\/|$)/,
968
+ /(^|\/)\.config\/priors(\/|$)/,
969
+ /(^|\/)\.local\/state\/priors-mcp(\/|$)/,
970
+ /(^|\/)\.agent001(\/|$)/
971
+ ];
972
+ KEY_MATERIAL_FILES = [/(^|\/)agent(-\d+)?\.key$/];
973
+ skipped = /* @__PURE__ */ new Set();
974
+ }
975
+ });
976
+
940
977
  // ../../packages/core/src/node/fs.ts
941
- import { constants, promises as fsp, lstatSync, existsSync, realpathSync } from "fs";
978
+ import { constants, promises as fsp, lstatSync, existsSync, realpathSync as realpathSync2 } from "fs";
942
979
  import { homedir } from "os";
943
980
  import { dirname, isAbsolute, join, relative, resolve, sep, posix } from "path";
944
981
  import { randomBytes as randomBytes2 } from "crypto";
@@ -956,7 +993,7 @@ function nomadHome() {
956
993
  function resolveRoot(p) {
957
994
  const abs = resolve(expandHome(p));
958
995
  try {
959
- return realpathSync(abs);
996
+ return realpathSync2(abs);
960
997
  } catch {
961
998
  return abs;
962
999
  }
@@ -975,8 +1012,12 @@ function safeJoin(root, rel) {
975
1012
  const abs = resolve(root, ...rel.split("/"));
976
1013
  const r = relative(root, abs);
977
1014
  if (r.startsWith("..") || isAbsolute(r)) throw new UnsafePathError(`Path escapes its root: "${rel}"`);
1015
+ assertNotKeyMaterial(abs);
978
1016
  return abs;
979
1017
  }
1018
+ function assertNotKeyMaterial(abs) {
1019
+ if (isKeyMaterialPath(abs)) throw new UnsafePathError(`Refusing to touch ${abs}: it can hold wallet keys.`);
1020
+ }
980
1021
  function assertNoSymlinks(root, abs) {
981
1022
  const r = relative(root, abs);
982
1023
  if (r.startsWith("..")) throw new UnsafePathError(`${abs} is outside ${root}`);
@@ -1017,6 +1058,10 @@ async function isFile(p) {
1017
1058
  }
1018
1059
  }
1019
1060
  async function readTextIfExists(p, maxBytes = 10 * 1024 * 1024) {
1061
+ if (isKeyMaterialPath(p)) {
1062
+ if (await pathExists(p)) recordSkippedKeyMaterial(p);
1063
+ return null;
1064
+ }
1020
1065
  try {
1021
1066
  const st = await fsp.lstat(p);
1022
1067
  if (st.isSymbolicLink()) {
@@ -1045,6 +1090,10 @@ async function walkFiles(root, options = {}) {
1045
1090
  async function rec(dir, rel, depth) {
1046
1091
  if (depth > maxDepth || out2.length >= maxFiles) return;
1047
1092
  for (const e of await listDir(dir)) {
1093
+ if (isKeyMaterialPath(join(dir, e.name))) {
1094
+ recordSkippedKeyMaterial(join(dir, e.name));
1095
+ continue;
1096
+ }
1048
1097
  if (e.symlink) continue;
1049
1098
  const r = rel ? `${rel}/${e.name}` : e.name;
1050
1099
  if (options.skip?.(r, e.dir)) continue;
@@ -1059,6 +1108,7 @@ async function walkFiles(root, options = {}) {
1059
1108
  return out2;
1060
1109
  }
1061
1110
  async function atomicWrite(abs, data, mode) {
1111
+ assertNotKeyMaterial(abs);
1062
1112
  await fsp.mkdir(dirname(abs), { recursive: true });
1063
1113
  const tmp = join(dirname(abs), `.${posix.basename(abs.split(sep).join("/"))}.nomad-tmp-${randomBytes2(6).toString("hex")}`);
1064
1114
  const fh = await fsp.open(tmp, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, mode ?? 420);
@@ -1092,7 +1142,7 @@ function displayPath(p) {
1092
1142
  }
1093
1143
  function realHome() {
1094
1144
  try {
1095
- return realpathSync(home());
1145
+ return realpathSync2(home());
1096
1146
  } catch {
1097
1147
  return home();
1098
1148
  }
@@ -1101,6 +1151,7 @@ var UnsafePathError;
1101
1151
  var init_fs = __esm({
1102
1152
  "../../packages/core/src/node/fs.ts"() {
1103
1153
  "use strict";
1154
+ init_keymaterial();
1104
1155
  UnsafePathError = class extends Error {
1105
1156
  constructor(message) {
1106
1157
  super(message);
@@ -1115,10 +1166,63 @@ var init_node = __esm({
1115
1166
  "../../packages/core/src/node/index.ts"() {
1116
1167
  "use strict";
1117
1168
  init_fs();
1169
+ init_keymaterial();
1170
+ }
1171
+ });
1172
+
1173
+ // ../../packages/security/src/bip39-words.ts
1174
+ var BIP39_ENGLISH;
1175
+ var init_bip39_words = __esm({
1176
+ "../../packages/security/src/bip39-words.ts"() {
1177
+ "use strict";
1178
+ BIP39_ENGLISH = new Set(
1179
+ "abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel base basic basket battle beach bean beauty because become beef before begin behave behind believe below belt bench benefit best betray better between beyond bicycle bid bike bind biology bird birth bitter black blade blame blanket blast bleak bless blind blood blossom blouse blue blur blush board boat body boil bomb bone bonus book boost border boring borrow boss bottom bounce box boy bracket brain brand brass brave bread breeze brick bridge brief bright bring brisk broccoli broken bronze broom brother brown brush bubble buddy budget buffalo build bulb bulk bullet bundle bunker burden burger burst bus business busy butter buyer buzz cabbage cabin cable cactus cage cake call calm camera camp can canal cancel candy cannon canoe canvas canyon capable capital captain car carbon card cargo carpet carry cart case cash casino castle casual cat catalog catch category cattle caught cause caution cave ceiling celery cement census century cereal certain chair chalk champion change chaos chapter charge chase chat cheap check cheese chef cherry chest chicken chief child chimney choice choose chronic chuckle chunk churn cigar cinnamon circle citizen city civil claim clap clarify claw clay clean clerk clever click client cliff climb clinic clip clock clog close cloth cloud clown club clump cluster clutch coach coast coconut code coffee coil coin collect color column combine come comfort comic common company concert conduct confirm congress connect consider control convince cook cool copper copy coral core corn correct cost cotton couch country couple course cousin cover coyote crack cradle craft cram crane crash crater crawl crazy cream credit creek crew cricket crime crisp critic crop cross crouch crowd crucial cruel cruise crumble crunch crush cry crystal cube culture cup cupboard curious current curtain curve cushion custom cute cycle dad damage damp dance danger daring dash daughter dawn day deal debate debris decade december decide decline decorate decrease deer defense define defy degree delay deliver demand demise denial dentist deny depart depend deposit depth deputy derive describe desert design desk despair destroy detail detect develop device devote diagram dial diamond diary dice diesel diet differ digital dignity dilemma dinner dinosaur direct dirt disagree discover disease dish dismiss disorder display distance divert divide divorce dizzy doctor document dog doll dolphin domain donate donkey donor door dose double dove draft dragon drama drastic draw dream dress drift drill drink drip drive drop drum dry duck dumb dune during dust dutch duty dwarf dynamic eager eagle early earn earth easily east easy echo ecology economy edge edit educate effort egg eight either elbow elder electric elegant element elephant elevator elite else embark embody embrace emerge emotion employ empower empty enable enact end endless endorse enemy energy enforce engage engine enhance enjoy enlist enough enrich enroll ensure enter entire entry envelope episode equal equip era erase erode erosion error erupt escape essay essence estate eternal ethics evidence evil evoke evolve exact example excess exchange excite exclude excuse execute exercise exhaust exhibit exile exist exit exotic expand expect expire explain expose express extend extra eye eyebrow fabric face faculty fade faint faith fall false fame family famous fan fancy fantasy farm fashion fat fatal father fatigue fault favorite feature february federal fee feed feel female fence festival fetch fever few fiber fiction field figure file film filter final find fine finger finish fire firm first fiscal fish fit fitness fix flag flame flash flat flavor flee flight flip float flock floor flower fluid flush fly foam focus fog foil fold follow food foot force forest forget fork fortune forum forward fossil foster found fox fragile frame frequent fresh friend fringe frog front frost frown frozen fruit fuel fun funny furnace fury future gadget gain galaxy gallery game gap garage garbage garden garlic garment gas gasp gate gather gauge gaze general genius genre gentle genuine gesture ghost giant gift giggle ginger giraffe girl give glad glance glare glass glide glimpse globe gloom glory glove glow glue goat goddess gold good goose gorilla gospel gossip govern gown grab grace grain grant grape grass gravity great green grid grief grit grocery group grow grunt guard guess guide guilt guitar gun gym habit hair half hammer hamster hand happy harbor hard harsh harvest hat have hawk hazard head health heart heavy hedgehog height hello helmet help hen hero hidden high hill hint hip hire history hobby hockey hold hole holiday hollow home honey hood hope horn horror horse hospital host hotel hour hover hub huge human humble humor hundred hungry hunt hurdle hurry hurt husband hybrid ice icon idea identify idle ignore ill illegal illness image imitate immense immune impact impose improve impulse inch include income increase index indicate indoor industry infant inflict inform inhale inherit initial inject injury inmate inner innocent input inquiry insane insect inside inspire install intact interest into invest invite involve iron island isolate issue item ivory jacket jaguar jar jazz jealous jeans jelly jewel job join joke journey joy judge juice jump jungle junior junk just kangaroo keen keep ketchup key kick kid kidney kind kingdom kiss kit kitchen kite kitten kiwi knee knife knock know lab label labor ladder lady lake lamp language laptop large later latin laugh laundry lava law lawn lawsuit layer lazy leader leaf learn leave lecture left leg legal legend leisure lemon lend length lens leopard lesson letter level liar liberty library license life lift light like limb limit link lion liquid list little live lizard load loan lobster local lock logic lonely long loop lottery loud lounge love loyal lucky luggage lumber lunar lunch luxury lyrics machine mad magic magnet maid mail main major make mammal man manage mandate mango mansion manual maple marble march margin marine market marriage mask mass master match material math matrix matter maximum maze meadow mean measure meat mechanic medal media melody melt member memory mention menu mercy merge merit merry mesh message metal method middle midnight milk million mimic mind minimum minor minute miracle mirror misery miss mistake mix mixed mixture mobile model modify mom moment monitor monkey monster month moon moral more morning mosquito mother motion motor mountain mouse move movie much muffin mule multiply muscle museum mushroom music must mutual myself mystery myth naive name napkin narrow nasty nation nature near neck need negative neglect neither nephew nerve nest net network neutral never news next nice night noble noise nominee noodle normal north nose notable note nothing notice novel now nuclear number nurse nut oak obey object oblige obscure observe obtain obvious occur ocean october odor off offer office often oil okay old olive olympic omit once one onion online only open opera opinion oppose option orange orbit orchard order ordinary organ orient original orphan ostrich other outdoor outer output outside oval oven over own owner oxygen oyster ozone pact paddle page pair palace palm panda panel panic panther paper parade parent park parrot party pass patch path patient patrol pattern pause pave payment peace peanut pear peasant pelican pen penalty pencil people pepper perfect permit person pet phone photo phrase physical piano picnic picture piece pig pigeon pill pilot pink pioneer pipe pistol pitch pizza place planet plastic plate play please pledge pluck plug plunge poem poet point polar pole police pond pony pool popular portion position possible post potato pottery poverty powder power practice praise predict prefer prepare present pretty prevent price pride primary print priority prison private prize problem process produce profit program project promote proof property prosper protect proud provide public pudding pull pulp pulse pumpkin punch pupil puppy purchase purity purpose purse push put puzzle pyramid quality quantum quarter question quick quit quiz quote rabbit raccoon race rack radar radio rail rain raise rally ramp ranch random range rapid rare rate rather raven raw razor ready real reason rebel rebuild recall receive recipe record recycle reduce reflect reform refuse region regret regular reject relax release relief rely remain remember remind remove render renew rent reopen repair repeat replace report require rescue resemble resist resource response result retire retreat return reunion reveal review reward rhythm rib ribbon rice rich ride ridge rifle right rigid ring riot ripple risk ritual rival river road roast robot robust rocket romance roof rookie room rose rotate rough round route royal rubber rude rug rule run runway rural sad saddle sadness safe sail salad salmon salon salt salute same sample sand satisfy satoshi sauce sausage save say scale scan scare scatter scene scheme school science scissors scorpion scout scrap screen script scrub sea search season seat second secret section security seed seek segment select sell seminar senior sense sentence series service session settle setup seven shadow shaft shallow share shed shell sheriff shield shift shine ship shiver shock shoe shoot shop short shoulder shove shrimp shrug shuffle shy sibling sick side siege sight sign silent silk silly silver similar simple since sing siren sister situate six size skate sketch ski skill skin skirt skull slab slam sleep slender slice slide slight slim slogan slot slow slush small smart smile smoke smooth snack snake snap sniff snow soap soccer social sock soda soft solar soldier solid solution solve someone song soon sorry sort soul sound soup source south space spare spatial spawn speak special speed spell spend sphere spice spider spike spin spirit split spoil sponsor spoon sport spot spray spread spring spy square squeeze squirrel stable stadium staff stage stairs stamp stand start state stay steak steel stem step stereo stick still sting stock stomach stone stool story stove strategy street strike strong struggle student stuff stumble style subject submit subway success such sudden suffer sugar suggest suit summer sun sunny sunset super supply supreme sure surface surge surprise surround survey suspect sustain swallow swamp swap swarm swear sweet swift swim swing switch sword symbol symptom syrup system table tackle tag tail talent talk tank tape target task taste tattoo taxi teach team tell ten tenant tennis tent term test text thank that theme then theory there they thing this thought three thrive throw thumb thunder ticket tide tiger tilt timber time tiny tip tired tissue title toast tobacco today toddler toe together toilet token tomato tomorrow tone tongue tonight tool tooth top topic topple torch tornado tortoise toss total tourist toward tower town toy track trade traffic tragic train transfer trap trash travel tray treat tree trend trial tribe trick trigger trim trip trophy trouble truck true truly trumpet trust truth try tube tuition tumble tuna tunnel turkey turn turtle twelve twenty twice twin twist two type typical ugly umbrella unable unaware uncle uncover under undo unfair unfold unhappy uniform unique unit universe unknown unlock until unusual unveil update upgrade uphold upon upper upset urban urge usage use used useful useless usual utility vacant vacuum vague valid valley valve van vanish vapor various vast vault vehicle velvet vendor venture venue verb verify version very vessel veteran viable vibrant vicious victory video view village vintage violin virtual virus visa visit visual vital vivid vocal voice void volcano volume vote voyage wage wagon wait walk wall walnut want warfare warm warrior wash wasp waste water wave way wealth weapon wear weasel weather web wedding weekend weird welcome west wet whale what wheat wheel when where whip whisper wide width wife wild will win window wine wing wink winner winter wire wisdom wise wish witness wolf woman wonder wood wool word work world worry worth wrap wreck wrestle wrist write wrong yard year yellow you young youth zebra zero zone zoo".split(" ")
1180
+ );
1118
1181
  }
1119
1182
  });
1120
1183
 
1121
1184
  // ../../packages/security/src/secrets.ts
1185
+ function isMnemonic(value) {
1186
+ const words = value.trim().split(/\s+/);
1187
+ return [12, 15, 18, 21, 24].includes(words.length) && words.every((w) => BIP39_ENGLISH.has(w));
1188
+ }
1189
+ function isPublicRpcUrl(value) {
1190
+ try {
1191
+ const u = new URL(value.trim());
1192
+ return (u.protocol === "https:" || u.protocol === "wss:") && !u.username && !u.password && !u.search && (u.pathname === "/" || u.pathname === "") && PUBLIC_RPC_HOSTS.has(u.hostname);
1193
+ } catch {
1194
+ return false;
1195
+ }
1196
+ }
1197
+ function isRpcEnvKey(key2) {
1198
+ return /(^|_)RPC(_URL)?$/i.test(key2);
1199
+ }
1200
+ function scanMcpLaunchFields(tool, fields) {
1201
+ const out2 = [];
1202
+ const check = (where, text3) => {
1203
+ out2.push(...scanText(text3, where));
1204
+ EVM_KEY.lastIndex = 0;
1205
+ let m;
1206
+ while (m = EVM_KEY.exec(text3)) {
1207
+ if (out2.some((f) => f.file === where && f.fingerprint === sha256(m[0]).slice(0, 12))) continue;
1208
+ out2.push({ ruleId: "evm-private-key", ruleName: "Wallet private key", file: where, line: 1, column: m.index + 1, fingerprint: sha256(m[0]).slice(0, 12), preview: `${m[0].length} characters` });
1209
+ }
1210
+ };
1211
+ (fields.args ?? []).forEach((a, i) => check(`tools/${tool}/args[${i}]`, a));
1212
+ for (const [k, v] of Object.entries(fields.env ?? {})) check(`tools/${tool}/env/${k}`, v);
1213
+ if (fields.url) check(`tools/${tool}/url`, fields.url);
1214
+ for (const [k, v] of Object.entries(fields.headers ?? {})) check(`tools/${tool}/headers/${k}`, v);
1215
+ return out2;
1216
+ }
1217
+ function redactLaunchField(text3) {
1218
+ const r = redactText(text3);
1219
+ let count = r.count;
1220
+ const out2 = r.text.replace(EVM_KEY, () => {
1221
+ count++;
1222
+ return "[REDACTED:evm-private-key]";
1223
+ });
1224
+ return { text: out2, count };
1225
+ }
1122
1226
  function shannonEntropy(s) {
1123
1227
  if (!s) return 0;
1124
1228
  const freq = /* @__PURE__ */ new Map();
@@ -1152,6 +1256,7 @@ function rawMatches(text3) {
1152
1256
  if (!value) continue;
1153
1257
  if (PLACEHOLDER.test(value)) continue;
1154
1258
  if (rule2.minEntropy && shannonEntropy(value) < rule2.minEntropy) continue;
1259
+ if (rule2.validate && !rule2.validate(value)) continue;
1155
1260
  const start = m.index + (g === 0 ? 0 : m[0].indexOf(value));
1156
1261
  const end = start + value.length;
1157
1262
  if (found.some((f) => start < f.end && end > f.start)) continue;
@@ -1187,23 +1292,42 @@ function scanText(text3, file) {
1187
1292
  });
1188
1293
  }
1189
1294
  function redactText(text3) {
1190
- const matches = rawMatches(text3);
1191
- if (!matches.length) return { text: text3, count: 0 };
1295
+ const matches2 = rawMatches(text3);
1296
+ if (!matches2.length) return { text: text3, count: 0 };
1192
1297
  let out2 = "";
1193
1298
  let last = 0;
1194
- for (const m of matches) {
1299
+ for (const m of matches2) {
1195
1300
  out2 += text3.slice(last, m.start) + `[REDACTED:${m.rule.id}]`;
1196
1301
  last = m.end;
1197
1302
  }
1198
1303
  out2 += text3.slice(last);
1199
- return { text: out2, count: matches.length };
1304
+ return { text: out2, count: matches2.length };
1200
1305
  }
1201
- var SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY;
1306
+ var EVM_KEY, SECRET_RULES, PLACEHOLDER, SENSITIVE_FILE_PATTERNS, SENSITIVE_ENV_KEY, PUBLIC_RPC_HOSTS;
1202
1307
  var init_secrets = __esm({
1203
1308
  "../../packages/security/src/secrets.ts"() {
1204
1309
  "use strict";
1205
1310
  init_src2();
1311
+ init_bip39_words();
1312
+ EVM_KEY = /\b0x[0-9a-fA-F]{64}\b/g;
1206
1313
  SECRET_RULES = [
1314
+ // A 0x-prefixed 32-byte hex value is a wallet key when the text around it says so.
1315
+ // Without that context it is usually a transaction or block hash, so it is left alone
1316
+ // here; launch arguments, URLs and headers of MCP servers are checked without context
1317
+ // (scanMcpLaunchFields).
1318
+ {
1319
+ id: "evm-private-key",
1320
+ name: "Wallet private key",
1321
+ pattern: /(?:private|secret|signer|wallet|\bkey\b|_key\b|-key\b)[^\n]{0,40}?\b(0x[0-9a-fA-F]{64})\b/gi,
1322
+ group: 1
1323
+ },
1324
+ {
1325
+ id: "bip39-mnemonic",
1326
+ name: "Wallet recovery phrase",
1327
+ pattern: /(?<![a-z] ?)\b([a-z]{3,8}(?:[ \t]+[a-z]{3,8}){11,23})\b(?! ?[a-z])/g,
1328
+ group: 1,
1329
+ validate: isMnemonic
1330
+ },
1207
1331
  { id: "private-key", name: "Private key block", pattern: /-----BEGIN (?:RSA |EC |OPENSSH |DSA |PGP |ENCRYPTED )?PRIVATE KEY(?: BLOCK)?-----[\s\S]*?(?:-----END[^-]*-----|$)/g },
1208
1332
  { id: "anthropic-key", name: "Anthropic API key", pattern: /\bsk-ant-[A-Za-z0-9_-]{20,}/g },
1209
1333
  { id: "openrouter-key", name: "OpenRouter API key", pattern: /\bsk-or-v1-[A-Za-z0-9]{32,}/g },
@@ -1222,7 +1346,7 @@ var init_secrets = __esm({
1222
1346
  {
1223
1347
  id: "generic-assignment",
1224
1348
  name: "Credential assignment",
1225
- pattern: /\b(?:password|passwd|pwd|secret|api[_-]?key|apikey|access[_-]?token|auth[_-]?token|client[_-]?secret|bearer)\b["']?\s*[:=]\s*["']?([^\s"'`,;]{8,})/gi,
1349
+ pattern: /\b(?:password|passwd|pwd|secret|api[_-]?key|apikey|access[_-]?token|auth[_-]?token|client[_-]?secret|bearer|private[_-]?key|mnemonic|seed[_ -]?phrase)\b["']?\s*[:=]\s*["']?([^\s"'`,;]{8,})/gi,
1226
1350
  group: 1,
1227
1351
  minEntropy: 3.2
1228
1352
  }
@@ -1237,13 +1361,27 @@ var init_secrets = __esm({
1237
1361
  /(^|\/)\.pypirc$/,
1238
1362
  /(^|\/)(credentials|secrets?)(\.[a-z]+)?$/i,
1239
1363
  /(^|\/)auth(-profiles)?\.json$/i,
1240
- /(^|\/)\.git-credentials$/
1364
+ /(^|\/)\.git-credentials$/,
1365
+ // Wallet files kept by agent tools.
1366
+ /(^|\/)\.agent001\/wallet\.(json|enc)$/i,
1367
+ /(^|\/)\.config\/priors\/.+/i
1241
1368
  ];
1242
- SENSITIVE_ENV_KEY = /(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL|AUTH|PRIVATE|COOKIE|SESSION|BEARER)/i;
1369
+ SENSITIVE_ENV_KEY = /(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL|AUTH|PRIVATE|COOKIE|SESSION|BEARER|MNEMONIC|SEED|WALLET|PASSPHRASE|KEYSTORE)/i;
1370
+ PUBLIC_RPC_HOSTS = /* @__PURE__ */ new Set([
1371
+ "rpc.mainnet.chain.robinhood.com",
1372
+ "rpc.testnet.chain.robinhood.com",
1373
+ "robinhood-rpc.publicnode.com",
1374
+ "rpc.ordofi.network",
1375
+ "mainnet.base.org"
1376
+ ]);
1243
1377
  }
1244
1378
  });
1245
1379
 
1246
1380
  // ../../packages/security/src/document.ts
1381
+ function isSecretEnvEntry(key2, value) {
1382
+ if (isSensitiveEnvKey(key2) || looksLikeSecretValue(value) || EVM_KEY_VALUE.test(value)) return true;
1383
+ return isRpcEnvKey(key2) && !isPublicRpcUrl(value);
1384
+ }
1247
1385
  function visitText(doc, fn) {
1248
1386
  if (doc.identity.persona) fn("identity/persona.md", doc.identity.persona);
1249
1387
  if (doc.identity.description) fn("identity/description", doc.identity.description);
@@ -1257,10 +1395,6 @@ function visitText(doc, fn) {
1257
1395
  for (const w of doc.workflows) {
1258
1396
  for (const a of w.actions) if (a.kind === "prompt") fn(`workflows/${w.id}.prompt`, a.text);
1259
1397
  }
1260
- for (const t of doc.tools) {
1261
- if (t.mcp?.args?.length) fn(`tools/${t.name}/args`, t.mcp.args.join(" "));
1262
- if (t.mcp?.url) fn(`tools/${t.name}/url`, t.mcp.url);
1263
- }
1264
1398
  for (const it of doc.integrations) fn(`integrations/${it.name}.json`, JSON.stringify(it.config));
1265
1399
  for (const f of doc.files) if (f.encoding === "utf8") fn(`files/${f.path}`, f.content);
1266
1400
  }
@@ -1272,6 +1406,11 @@ function scanDocument(doc) {
1272
1406
  for (const s of doc.skills)
1273
1407
  for (const f of s.files)
1274
1408
  if (isSensitiveFile(f.path)) sensitiveFiles.push({ file: `skills/${s.name}/${f.path}`, reason: "Credential or key file" });
1409
+ for (const t of doc.tools) {
1410
+ if (!t.mcp) continue;
1411
+ const literal = (rec) => Object.fromEntries(Object.entries(rec).flatMap(([k, v]) => "value" in v ? [[k, v.value]] : []));
1412
+ findings.push(...scanMcpLaunchFields(t.name, { args: t.mcp.args, url: t.mcp.url, headers: literal(t.mcp.headers) }).filter((f) => !f.file.includes("/headers/")));
1413
+ }
1275
1414
  const inlineSecretValues = [];
1276
1415
  for (const t of doc.tools) {
1277
1416
  for (const [loc, rec] of [
@@ -1279,7 +1418,7 @@ function scanDocument(doc) {
1279
1418
  ["headers", t.mcp?.headers ?? {}]
1280
1419
  ]) {
1281
1420
  for (const [k, v] of Object.entries(rec)) {
1282
- if ("value" in v && (isSensitiveEnvKey(k) || looksLikeSecretValue(v.value))) {
1421
+ if ("value" in v && isSecretEnvEntry(k, v.value)) {
1283
1422
  inlineSecretValues.push({ tool: t.name, key: k, location: loc });
1284
1423
  }
1285
1424
  }
@@ -1295,7 +1434,7 @@ function scanDocument(doc) {
1295
1434
  function stripRecord(tool, rec, report) {
1296
1435
  const out2 = {};
1297
1436
  for (const [k, v] of Object.entries(rec)) {
1298
- if ("value" in v && (isSensitiveEnvKey(k) || looksLikeSecretValue(v.value))) {
1437
+ if ("value" in v && isSecretEnvEntry(k, v.value)) {
1299
1438
  out2[k] = { secretRef: k, redacted: true };
1300
1439
  report.strippedEnvValues.push({ tool, key: k });
1301
1440
  } else out2[k] = v;
@@ -1313,6 +1452,11 @@ function sanitizeDocument(doc, options = {}) {
1313
1452
  report.redactedText += r.count;
1314
1453
  return r.text;
1315
1454
  };
1455
+ const launch = (s) => {
1456
+ const r = redactLaunchField(s);
1457
+ report.redactedText += r.count;
1458
+ return r.text;
1459
+ };
1316
1460
  const keepFile = (path) => {
1317
1461
  if (options.includeSensitiveFiles || !isSensitiveFile(path)) return true;
1318
1462
  report.removedFiles.push(path);
@@ -1342,8 +1486,8 @@ function sanitizeDocument(doc, options = {}) {
1342
1486
  ...t,
1343
1487
  mcp: {
1344
1488
  ...t.mcp,
1345
- args: t.mcp.args.map(red2),
1346
- url: t.mcp.url === void 0 ? void 0 : red2(t.mcp.url),
1489
+ args: t.mcp.args.map(launch),
1490
+ url: t.mcp.url === void 0 ? void 0 : launch(t.mcp.url),
1347
1491
  env: stripRecord(t.name, t.mcp.env, report),
1348
1492
  headers: stripRecord(t.name, t.mcp.headers, report)
1349
1493
  }
@@ -1354,10 +1498,12 @@ function sanitizeDocument(doc, options = {}) {
1354
1498
  };
1355
1499
  return { doc: out2, report };
1356
1500
  }
1501
+ var EVM_KEY_VALUE;
1357
1502
  var init_document2 = __esm({
1358
1503
  "../../packages/security/src/document.ts"() {
1359
1504
  "use strict";
1360
1505
  init_secrets();
1506
+ EVM_KEY_VALUE = /\b0x[0-9a-fA-F]{64}\b/;
1361
1507
  }
1362
1508
  });
1363
1509
 
@@ -1387,12 +1533,12 @@ function checkEntryName(name, limits) {
1387
1533
  if (parts.some((p) => p === "" || p === ".")) throw new ArchiveError(`Entry has an empty path segment`, "unsafe-name", name);
1388
1534
  if (parts.some((p) => p.length > 255)) throw new ArchiveError(`Entry has a path segment longer than 255 characters`, "unsafe-name", name);
1389
1535
  }
1390
- function listEntries(bytes, limits = DEFAULT_LIMITS) {
1391
- if (bytes.length > limits.maxArchiveBytes) throw new ArchiveError(`Archive is larger than ${limits.maxArchiveBytes} bytes`, "archive-too-large");
1392
- if (bytes.length < 22) throw new ArchiveError("Not a ZIP archive", "not-zip");
1393
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1536
+ function listEntries(bytes2, limits = DEFAULT_LIMITS) {
1537
+ if (bytes2.length > limits.maxArchiveBytes) throw new ArchiveError(`Archive is larger than ${limits.maxArchiveBytes} bytes`, "archive-too-large");
1538
+ if (bytes2.length < 22) throw new ArchiveError("Not a ZIP archive", "not-zip");
1539
+ const view = new DataView(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
1394
1540
  let eocd = -1;
1395
- for (let i = bytes.length - 22; i >= Math.max(0, bytes.length - 22 - 65535); i--) {
1541
+ for (let i = bytes2.length - 22; i >= Math.max(0, bytes2.length - 22 - 65535); i--) {
1396
1542
  if (view.getUint32(i, true) === 101010256) {
1397
1543
  eocd = i;
1398
1544
  break;
@@ -1404,13 +1550,13 @@ function listEntries(bytes, limits = DEFAULT_LIMITS) {
1404
1550
  const cdOffset = view.getUint32(eocd + 16, true);
1405
1551
  if (count === 65535 || cdOffset === 4294967295) throw new ArchiveError("ZIP64 archives are not supported", "zip64");
1406
1552
  if (count > limits.maxEntries) throw new ArchiveError(`Archive has ${count} entries, more than the limit of ${limits.maxEntries}`, "too-many-entries");
1407
- if (cdOffset + cdSize > bytes.length) throw new ArchiveError("Corrupt central directory", "corrupt");
1553
+ if (cdOffset + cdSize > bytes2.length) throw new ArchiveError("Corrupt central directory", "corrupt");
1408
1554
  const entries = [];
1409
1555
  const seen = /* @__PURE__ */ new Set();
1410
1556
  let total = 0;
1411
1557
  let p = cdOffset;
1412
1558
  for (let n = 0; n < count; n++) {
1413
- if (p + 46 > bytes.length || view.getUint32(p, true) !== 33639248) throw new ArchiveError("Corrupt central directory entry", "corrupt");
1559
+ if (p + 46 > bytes2.length || view.getUint32(p, true) !== 33639248) throw new ArchiveError("Corrupt central directory entry", "corrupt");
1414
1560
  const madeBy = view.getUint16(p + 4, true);
1415
1561
  const flags = view.getUint16(p + 8, true);
1416
1562
  const method = view.getUint16(p + 10, true);
@@ -1421,7 +1567,7 @@ function listEntries(bytes, limits = DEFAULT_LIMITS) {
1421
1567
  const commentLen = view.getUint16(p + 32, true);
1422
1568
  const extAttr = view.getUint32(p + 38, true);
1423
1569
  const localOffset = view.getUint32(p + 42, true);
1424
- const name = new TextDecoder("utf-8", { fatal: false }).decode(bytes.subarray(p + 46, p + 46 + nameLen));
1570
+ const name = new TextDecoder("utf-8", { fatal: false }).decode(bytes2.subarray(p + 46, p + 46 + nameLen));
1425
1571
  p += 46 + nameLen + extraLen + commentLen;
1426
1572
  checkEntryName(name, limits);
1427
1573
  if (flags & 1) throw new ArchiveError("Encrypted entries are not supported", "encrypted", name);
@@ -1471,20 +1617,20 @@ function inflateCapped(data, expected, name) {
1471
1617
  if (written !== expected) throw new ArchiveError("Entry size does not match its declared size", "corrupt", name);
1472
1618
  return out2;
1473
1619
  }
1474
- function extractEntries(bytes, limits = DEFAULT_LIMITS) {
1475
- const entries = listEntries(bytes, limits);
1476
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1620
+ function extractEntries(bytes2, limits = DEFAULT_LIMITS) {
1621
+ const entries = listEntries(bytes2, limits);
1622
+ const view = new DataView(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
1477
1623
  const files = /* @__PURE__ */ new Map();
1478
1624
  for (const e of entries) {
1479
1625
  if (e.isDirectory) continue;
1480
1626
  const lo = e.localOffset;
1481
- if (lo + 30 > bytes.length || view.getUint32(lo, true) !== 67324752) throw new ArchiveError("Corrupt local header", "corrupt", e.name);
1627
+ if (lo + 30 > bytes2.length || view.getUint32(lo, true) !== 67324752) throw new ArchiveError("Corrupt local header", "corrupt", e.name);
1482
1628
  const nameLen = view.getUint16(lo + 26, true);
1483
1629
  const extraLen = view.getUint16(lo + 28, true);
1484
1630
  const start = lo + 30 + nameLen + extraLen;
1485
1631
  const end = start + e.compressedSize;
1486
- if (end > bytes.length) throw new ArchiveError("Entry data is truncated", "corrupt", e.name);
1487
- const raw = bytes.subarray(start, end);
1632
+ if (end > bytes2.length) throw new ArchiveError("Entry data is truncated", "corrupt", e.name);
1633
+ const raw = bytes2.subarray(start, end);
1488
1634
  files.set(e.name, e.method === 0 ? raw.slice() : inflateCapped(raw, e.size, e.name));
1489
1635
  }
1490
1636
  return files;
@@ -2583,11 +2729,11 @@ function packAgent(doc, options = {}) {
2583
2729
  }
2584
2730
  return { bytes: createZip(files), manifest, files, scan, sanitize };
2585
2731
  }
2586
- function unpackAgent(bytes, options = {}) {
2732
+ function unpackAgent(bytes2, options = {}) {
2587
2733
  const limits = { ...DEFAULT_LIMITS, ...options.limits };
2588
2734
  let files;
2589
2735
  try {
2590
- files = extractEntries(bytes, limits);
2736
+ files = extractEntries(bytes2, limits);
2591
2737
  } catch (e) {
2592
2738
  if (e instanceof ArchiveError) {
2593
2739
  return { ok: false, doc: null, issues: [{ path: e.entry ?? "(archive)", message: `${e.message} [${e.code}]` }], warnings: [], scan: null, sanitize: null, executableFiles: [], fileCount: 0, totalBytes: 0 };
@@ -2739,7 +2885,7 @@ function analyzeCompatibility(doc, source, destination) {
2739
2885
  const isAttention = items > 0 && (status === "unsupported" || status === "manual" && IMPORTANT.includes(category));
2740
2886
  if (isAttention) {
2741
2887
  attention.push(
2742
- status === "unsupported" ? `${CATEGORY_LABELS[category]}: ${destination.displayName} cannot store ${items} item(s). They stay in the package.` : `${CATEGORY_LABELS[category]}: ${items} item(s) need manual setup in ${destination.displayName}.`
2888
+ status === "unsupported" ? `${CATEGORY_LABELS[category]}: ${destination.displayName} has no place for ${items === 1 ? "1 item" : `${items} items`}, so ${items === 1 ? "it is" : "they are"} not moved. Nomad keeps a copy and gives you steps to set ${items === 1 ? "it" : "them"} up another way.` : `${CATEGORY_LABELS[category]}: you finish setting up ${items === 1 ? "1 item" : `${items} items`} in ${destination.displayName} yourself. Nomad lists the steps.`
2743
2889
  );
2744
2890
  }
2745
2891
  categories.push({
@@ -2823,7 +2969,7 @@ function fileInfo(id, displayName, description, defaultLocations, opts) {
2823
2969
  id,
2824
2970
  displayName,
2825
2971
  category: "coding-agent",
2826
- support: "EXPERIMENTAL",
2972
+ support: "PARTIAL",
2827
2973
  adapterVersion: "0.1.0",
2828
2974
  supportedVersions: "Documented rules and configuration files as of late 2026",
2829
2975
  description,
@@ -2844,7 +2990,7 @@ function fileInfo(id, displayName, description, defaultLocations, opts) {
2844
2990
  knowledge: manual(),
2845
2991
  project: convert()
2846
2992
  }),
2847
- limitations: ["Experimental: verified against fixture layouts, not yet against every release of the application."]
2993
+ limitations: ["Scheduled routines, model choice and permission enforcement stay in the application settings."]
2848
2994
  };
2849
2995
  }
2850
2996
  function guidedInfo(id, displayName, category, description, notes) {
@@ -2855,7 +3001,7 @@ function guidedInfo(id, displayName, category, description, notes) {
2855
3001
  category,
2856
3002
  support: "GUIDED",
2857
3003
  adapterVersion: "0.1.0",
2858
- supportedVersions: category === "hosted" ? "Official settings screens" : "Current public SDK",
3004
+ supportedVersions: category === "hosted" ? "Published settings screens" : "Current public SDK",
2859
3005
  description,
2860
3006
  defaultLocations: [],
2861
3007
  multiAgent: false,
@@ -2881,7 +3027,7 @@ function guidedInfo(id, displayName, category, description, notes) {
2881
3027
  function infoById(id) {
2882
3028
  return ALL_INFOS.find((a) => a.id === id);
2883
3029
  }
2884
- var full, convert, manual, none, rw, GENERIC_INFO, CLAUDE_CODE_INFO, CODEX_INFO, OPENCLAW_INFO, HERMES_INFO, CURSOR_INFO, WINDSURF_INFO, CLINE_INFO, ROO_INFO, CONTINUE_INFO, OPENCODE_INFO, GOOSE_INFO, AIDER_INFO, GEMINI_CLI_INFO, GUIDED_INFOS, ALL_INFOS;
3030
+ var full, convert, manual, none, rw, GENERIC_INFO, CLAUDE_CODE_INFO, CODEX_INFO, OPENCLAW_INFO, HERMES_INFO, CURSOR_INFO, WINDSURF_INFO, CLINE_INFO, ROO_INFO, CONTINUE_INFO, OPENCODE_INFO, GOOSE_INFO, AIDER_INFO, GEMINI_CLI_INFO, GUIDED_INFOS, ELIZAOS_INFO, ALL_INFOS;
2885
3031
  var init_catalog = __esm({
2886
3032
  "../../packages/adapters/src/catalog.ts"() {
2887
3033
  "use strict";
@@ -2932,7 +3078,8 @@ var init_catalog = __esm({
2932
3078
  }),
2933
3079
  limitations: [
2934
3080
  "User level MCP servers live in ~/.claude.json, which Claude Code also rewrites. Close Claude Code before migrating.",
2935
- "Scheduled routines cannot be imported."
3081
+ "Scheduled routines cannot be imported.",
3082
+ "Reads installed plugins (servers and skills of enabled user-level plugins), never installs them."
2936
3083
  ]
2937
3084
  };
2938
3085
  CODEX_INFO = {
@@ -3017,7 +3164,10 @@ var init_catalog = __esm({
3017
3164
  knowledge: manual(),
3018
3165
  project: convert()
3019
3166
  }),
3020
- limitations: ["Hermes memory has character limits (2,200 for MEMORY.md and 1,375 for USER.md by default). Larger imports are reported."]
3167
+ limitations: [
3168
+ "Hermes memory has character limits (2,200 for MEMORY.md and 1,375 for USER.md by default). Larger imports are reported.",
3169
+ "Reads installed plugins (portable plugin servers and skills), never installs or enables them. ~/.hermes/.env is never read."
3170
+ ]
3021
3171
  };
3022
3172
  CURSOR_INFO = fileInfo("cursor", "Cursor", "Project rules in .cursor/rules (MDC), legacy .cursorrules and AGENTS.md, plus .cursor/mcp.json.", [], {
3023
3173
  mcp: true,
@@ -3078,12 +3228,44 @@ var init_catalog = __esm({
3078
3228
  guidedInfo("n8n", "n8n", "framework", "System message for the AI Agent node and schedule trigger settings.", "Instructions become the system message."),
3079
3229
  guidedInfo("letta", "Letta", "framework", "A Letta agent with persona and human memory blocks.", "Persona and user memory become memory blocks.")
3080
3230
  ];
3231
+ ELIZAOS_INFO = {
3232
+ id: "elizaos",
3233
+ displayName: "ElizaOS",
3234
+ category: "framework",
3235
+ support: "PARTIAL",
3236
+ adapterVersion: "0.1.0",
3237
+ supportedVersions: "ElizaOS 1.x JSON character files",
3238
+ description: "Character files (characters/*.json, *.character.json): bio, system prompt, style, knowledge, plugins and MCP servers under settings.mcp.",
3239
+ docsUrl: "https://docs.elizaos.ai/agents/character-interface",
3240
+ defaultLocations: [],
3241
+ multiAgent: true,
3242
+ configFormats: ["JSON"],
3243
+ capabilities: capabilityMatrix({
3244
+ identity: { read: "convert", write: "convert", notes: "bio becomes the persona; adjectives the tone." },
3245
+ instructions: { read: "convert", write: "convert", notes: "system and style; other instructions are folded into system with a heading." },
3246
+ memory: { read: "convert", write: "convert", notes: "Knowledge strings in the character. Runtime memory in ElizaOS's database is not read." },
3247
+ skills: { read: "unsupported", write: "unsupported" },
3248
+ tools: { read: "convert", write: "convert", notes: "MCP servers under settings.mcp.servers (needs @elizaos/plugin-mcp). References are not written." },
3249
+ integrations: { read: "manual", write: "manual", notes: "Plugins are listed; Nomad never installs them." },
3250
+ models: { read: "manual", write: "manual" },
3251
+ permissions: { read: "unsupported", write: "unsupported" },
3252
+ workflows: { read: "unsupported", write: "unsupported" },
3253
+ knowledge: { read: "convert", write: "manual", notes: "Knowledge file paths are listed, copied only with --include-files." },
3254
+ project: { read: "convert", write: "convert" }
3255
+ }),
3256
+ limitations: [
3257
+ "JSON characters only; TypeScript characters are reported, never run.",
3258
+ "Secrets (secrets and settings.secrets) are never read or written; only their names are listed.",
3259
+ "Runtime memory and conversations are not migrated."
3260
+ ]
3261
+ };
3081
3262
  ALL_INFOS = [
3082
3263
  OPENCLAW_INFO,
3083
3264
  CLAUDE_CODE_INFO,
3084
3265
  CODEX_INFO,
3085
3266
  HERMES_INFO,
3086
3267
  GENERIC_INFO,
3268
+ ELIZAOS_INFO,
3087
3269
  CURSOR_INFO,
3088
3270
  WINDSURF_INFO,
3089
3271
  CLINE_INFO,
@@ -3098,6 +3280,143 @@ var init_catalog = __esm({
3098
3280
  }
3099
3281
  });
3100
3282
 
3283
+ // ../../packages/adapters/src/known-servers.ts
3284
+ function applyKnownServerProfile(tool, platformName = "the destination") {
3285
+ const out2 = { tool, notes: [], manualSteps: [], unsupported: [] };
3286
+ const profile = tool.mcp ? PROFILES.find((p) => p.matches(tool)) : void 0;
3287
+ if (!profile || !tool.mcp) return out2;
3288
+ const env = { ...tool.mcp.env };
3289
+ const optional = new Set(tool.mcp.optionalEnv ?? []);
3290
+ const keys = profile.keyVars.filter((k) => env[k]);
3291
+ if (keys.length > 1) {
3292
+ for (const k of keys) delete env[k];
3293
+ out2.manualSteps.push(
3294
+ `"${tool.name}" listed both ${keys.join(" and ")}, which ${profile.id === "priors" ? "Priors" : "the server"} refuses together, so Nomad wrote neither. Set one: ${keys[0]} (recommended: a path to an owner-only key file, chmod 600, for a dedicated wallet) or ${keys[1]}.`
3295
+ );
3296
+ }
3297
+ for (const k of profile.keyVars) {
3298
+ if (keys.includes(k)) {
3299
+ out2.unsupported.push({ category: "tools", item: `${tool.name}: ${k}`, reason: "Wallet keys and key files are references only.", alternative: "Create the key file on the new machine (owner-only) and set the variable. Use a dedicated wallet." });
3300
+ }
3301
+ }
3302
+ for (const k of profile.limitVars) {
3303
+ const v = env[k];
3304
+ if (!v || "value" in v) continue;
3305
+ delete env[k];
3306
+ optional.delete(k);
3307
+ const looser = profile.looserDefaults[k];
3308
+ out2.unsupported.push({
3309
+ category: "permissions",
3310
+ item: `${tool.name}: ${k}`,
3311
+ reason: `Limit not carried: it was a reference on the source, so the destination uses Priors defaults${looser ? ` (${looser})` : ""}.`,
3312
+ alternative: `Set ${k} on the destination to keep the limit.`
3313
+ });
3314
+ }
3315
+ const mcp = { ...tool.mcp, env };
3316
+ const keptOptional = [...optional].filter((k) => env[k]);
3317
+ if (keptOptional.length) mcp.optionalEnv = keptOptional;
3318
+ else delete mcp.optionalEnv;
3319
+ mcp.emptyOkEnv = profile.emptyOkEnv;
3320
+ out2.tool = { ...tool, mcp };
3321
+ profile.apply?.(out2.tool, out2, platformName);
3322
+ return out2;
3323
+ }
3324
+ function knownServerId(tool) {
3325
+ return PROFILES.find((p) => p.matches(tool))?.id ?? null;
3326
+ }
3327
+ var isPriorsHost, PRIORS, PROFILES;
3328
+ var init_known_servers = __esm({
3329
+ "../../packages/adapters/src/known-servers.ts"() {
3330
+ "use strict";
3331
+ isPriorsHost = (url) => {
3332
+ if (!url) return false;
3333
+ try {
3334
+ return new URL(url).hostname === "mcp.priors.trade";
3335
+ } catch {
3336
+ return false;
3337
+ }
3338
+ };
3339
+ PRIORS = {
3340
+ id: "priors",
3341
+ label: "Priors (a credit service for agents on Robinhood Chain)",
3342
+ matches: (t) => !!t.mcp && (t.mcp.command === "priors-mcp" || t.mcp.args.some((a) => a.includes("@priors/mcp")) || isPriorsHost(t.mcp.url)),
3343
+ keyVars: ["PRIORS_KEY_FILE", "PRIORS_KEY"],
3344
+ emptyOkEnv: ["PRIORS_AGENT_ID"],
3345
+ limitVars: [
3346
+ "PRIORS_PAY_HOSTS",
3347
+ "PRIORS_OWNER_ENTITY_IDS",
3348
+ "PRIORS_MAX_PRICE_USD",
3349
+ "PRIORS_MAX_SPEND_USD",
3350
+ "PRIORS_MAX_BORROW_USD",
3351
+ "PRIORS_MAX_BORROW_TOTAL_USD",
3352
+ "PRIORS_MAX_SPEND_DAY_USD",
3353
+ "PRIORS_MAX_BORROW_DAY_USD",
3354
+ "PRIORS_AUTO_BORROW_USD",
3355
+ "PRIORS_STATE_DIR"
3356
+ ],
3357
+ looserDefaults: {
3358
+ PRIORS_PAY_HOSTS: "defaults are looser: any public https host",
3359
+ PRIORS_MAX_SPEND_DAY_USD: "defaults are looser: no daily caps",
3360
+ PRIORS_MAX_BORROW_DAY_USD: "defaults are looser: no daily caps"
3361
+ },
3362
+ apply(t, out2, platform) {
3363
+ const mcp = t.mcp;
3364
+ if (mcp.transport !== "stdio") {
3365
+ out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" is a remote server run by a third party (Priors). Nomad copies only its address.` });
3366
+ return;
3367
+ }
3368
+ out2.notes.push({
3369
+ level: "info",
3370
+ category: "integrations",
3371
+ message: "Priors on-chain items (the ERC-8004 identity, the credit line, open loans, Autopay enrolment, the declared agent wallet) stay with the wallet. Moving the agent does not move or repay them."
3372
+ });
3373
+ out2.notes.push({
3374
+ level: "info",
3375
+ category: "tools",
3376
+ message: `"${t.name}": daily spend and borrow counters start again on ${platform}. Give every client that uses this agent's key the same limits (Priors counts per state folder).`
3377
+ });
3378
+ if (mcp.command === "priors-mcp") {
3379
+ out2.manualSteps.push(`Install the Priors MCP server for "${t.name}": npm install -g @priors/mcp@<version you trust>. It needs Node.js 20.10 or later on the PATH ${platform} uses.`);
3380
+ }
3381
+ const keyFileArgs = mcp.args.filter((a) => /\.key$/i.test(a) || /(^|\/)\.config\/priors(\/|$)/.test(a));
3382
+ for (const a of keyFileArgs) {
3383
+ out2.manualSteps.push(`Create the key file ${a} on this machine (owner-only, chmod 600) for "${t.name}". Nomad did not copy it.`);
3384
+ out2.unsupported.push({ category: "tools", item: `${t.name}: key file referenced in launch arguments (${a})`, reason: "Key files are never read or copied.", alternative: "Create the key file on the new machine (owner-only) with a dedicated wallet." });
3385
+ }
3386
+ }
3387
+ };
3388
+ PROFILES = [PRIORS];
3389
+ }
3390
+ });
3391
+
3392
+ // ../../packages/adapters/src/elizaos-known-plugins.ts
3393
+ function knownElizaosPlugin(name) {
3394
+ return KNOWN_ELIZAOS_PLUGINS.find((p) => p.name === name);
3395
+ }
3396
+ function elizaosPluginHint(name) {
3397
+ const k = knownElizaosPlugin(name);
3398
+ if (k?.equivalentMcp) {
3399
+ return `On this platform, use the local MCP server ${k.equivalentMcp.local} and/or the hosted server ${k.equivalentMcp.hosted}. Nomad does not add them for you (the key stays with you).`;
3400
+ }
3401
+ return "Reinstall or replace it on this platform. Nomad never installs plugins.";
3402
+ }
3403
+ var KNOWN_ELIZAOS_PLUGINS;
3404
+ var init_elizaos_known_plugins = __esm({
3405
+ "../../packages/adapters/src/elizaos-known-plugins.ts"() {
3406
+ "use strict";
3407
+ KNOWN_ELIZAOS_PLUGINS = [
3408
+ {
3409
+ name: "@priors/plugin-elizaos",
3410
+ settingNames: ["PRIORS_KEY_FILE", "PRIORS_KEY", "PRIORS_AGENT_ID", "PRIORS_OWNER_ENTITY_IDS", "PRIORS_PAY_HOSTS", "PRIORS_MAX_PRICE_USD", "PRIORS_MAX_SPEND_DAY_USD", "PRIORS_MAX_BORROW_DAY_USD", "PRIORS_STATE_DIR", "PRIORS_AUTO_BORROW_USD"],
3411
+ sensitive: ["PRIORS_KEY_FILE", "PRIORS_KEY"],
3412
+ safetyLimits: ["PRIORS_OWNER_ENTITY_IDS", "PRIORS_PAY_HOSTS", "PRIORS_MAX_PRICE_USD", "PRIORS_MAX_SPEND_DAY_USD", "PRIORS_MAX_BORROW_DAY_USD", "PRIORS_AUTO_BORROW_USD"],
3413
+ equivalentMcp: { local: "priors-wallet (@priors/mcp)", hosted: "https://mcp.priors.trade/mcp" },
3414
+ note: "Priors says the plugin runs @priors/mcp in process and reads the hosted read-only server."
3415
+ }
3416
+ ];
3417
+ }
3418
+ });
3419
+
3101
3420
  // ../../packages/adapters/src/util.ts
3102
3421
  import { join as join2, basename } from "path";
3103
3422
  import { promises as fsp2 } from "fs";
@@ -3367,87 +3686,146 @@ function parseAgentMarkdown(text3, platform, path) {
3367
3686
  }
3368
3687
  return result;
3369
3688
  }
3370
- function envRecord(raw) {
3371
- const out2 = {};
3689
+ function envRecord(raw, refsOptional = false) {
3690
+ const out2 = { rec: {}, optional: [], defaults: [] };
3372
3691
  if (raw && typeof raw === "object" && !Array.isArray(raw)) {
3373
3692
  for (const [k, v] of Object.entries(raw)) {
3374
3693
  if (typeof v === "string") {
3375
- const ref = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(v);
3376
- out2[k] = ref ? { secretRef: ref[1], redacted: true } : { value: v };
3377
- } else if (v !== null && v !== void 0) out2[k] = { value: String(v) };
3694
+ const ref = ENV_REF.exec(v);
3695
+ if (!ref) {
3696
+ out2.rec[k] = { value: v };
3697
+ continue;
3698
+ }
3699
+ out2.rec[k] = { secretRef: ref[2], redacted: true };
3700
+ if (ref[3] !== void 0 && ref[4]) out2.defaults.push([k, ref[4]]);
3701
+ else if (ref[3] !== void 0 || refsOptional) out2.optional.push(k);
3702
+ } else if (v !== null && v !== void 0) out2.rec[k] = { value: String(v) };
3378
3703
  }
3379
3704
  }
3380
3705
  return out2;
3381
3706
  }
3382
- function toolsFromMcpServers(raw, platform, path) {
3707
+ function toolsFromMcpServers(raw, platform, path, opts = {}) {
3383
3708
  if (!raw || typeof raw !== "object") return [];
3384
3709
  const tools = [];
3385
3710
  for (const [name, cfg] of Object.entries(raw)) {
3386
3711
  if (!cfg || typeof cfg !== "object") continue;
3387
3712
  const url = cfg.url ?? cfg.httpUrl ?? cfg.serverUrl;
3388
- const transport = cfg.type === "sse" ? "sse" : url ? "http" : "stdio";
3713
+ const transport = cfg.type === "sse" || cfg.transport === "sse" ? "sse" : url ? "http" : "stdio";
3714
+ const env = envRecord(cfg.env, opts.refsOptional && transport === "stdio");
3715
+ const headers = envRecord(cfg.headers ?? cfg.http_headers);
3716
+ for (const [k, d] of env.defaults) opts.notes?.push({ level: "info", category: "tools", message: `"${name}": ${k} has a default (${d.length > 40 ? `${d.length} characters` : d}) that is not carried. Set ${k} on the destination if you rely on it.` });
3717
+ const mcp = {
3718
+ transport,
3719
+ command: typeof cfg.command === "string" ? cfg.command : void 0,
3720
+ args: Array.isArray(cfg.args) ? cfg.args.map(String) : [],
3721
+ url: typeof url === "string" ? url : void 0,
3722
+ env: env.rec,
3723
+ headers: headers.rec,
3724
+ cwd: typeof cfg.cwd === "string" ? cfg.cwd : void 0
3725
+ };
3726
+ if (env.optional.length) mcp.optionalEnv = env.optional;
3389
3727
  tools.push({
3390
3728
  name,
3391
3729
  description: typeof cfg.description === "string" ? cfg.description : void 0,
3392
3730
  kind: "mcp",
3393
- mcp: {
3394
- transport,
3395
- command: typeof cfg.command === "string" ? cfg.command : void 0,
3396
- args: Array.isArray(cfg.args) ? cfg.args.map(String) : [],
3397
- url: typeof url === "string" ? url : void 0,
3398
- env: envRecord(cfg.env),
3399
- headers: envRecord(cfg.headers ?? cfg.http_headers),
3400
- cwd: typeof cfg.cwd === "string" ? cfg.cwd : void 0
3401
- },
3731
+ mcp,
3402
3732
  permissions: [],
3403
3733
  platforms: [],
3404
3734
  enabled: cfg.disabled !== true && cfg.enabled !== false,
3405
- source: { platform, path }
3735
+ source: { platform, path, ...opts.note ? { note: opts.note } : {}, ...opts.extra ?? {} }
3406
3736
  });
3407
3737
  }
3408
3738
  return tools;
3409
3739
  }
3740
+ function pluginOf(item, host) {
3741
+ const src = item.source;
3742
+ return src?.pluginHost === host && typeof src.plugin === "string" ? src.plugin : null;
3743
+ }
3744
+ function integrationStep(i, platformName, otherwise) {
3745
+ if (i.kind === "elizaos-plugin") {
3746
+ return `${i.name} was an ElizaOS plugin. ${elizaosPluginHint(i.name)}`;
3747
+ }
3748
+ if (i.kind === "claude-code-plugin" || i.kind === "hermes-plugin") {
3749
+ return `${i.name} was an installed ${i.kind === "hermes-plugin" ? "Hermes" : "Claude Code"} plugin (installed plugin read, not installed). Its servers and skills are written to ${platformName} as ordinary entries where ${platformName} has a place for them.`;
3750
+ }
3751
+ return otherwise;
3752
+ }
3410
3753
  function mcpServersFromTools(tools, opts) {
3411
- const servers = {};
3412
- const manualSteps = [];
3413
- for (const t of tools) {
3414
- if (t.kind !== "mcp" || !t.mcp) continue;
3754
+ const style = opts.envRefStyle ?? (opts.envExpansion ? "dollar" : "none");
3755
+ const asRef = (name) => style === "env-prefix" ? `\${env:${name}}` : `\${${name}}`;
3756
+ const out2 = { servers: {}, manualSteps: [], unsupported: [], notes: [], refs: {} };
3757
+ const seenNotes = /* @__PURE__ */ new Set();
3758
+ for (const original of tools) {
3759
+ if (original.kind !== "mcp" || !original.mcp) continue;
3760
+ if (original.enabled === false) {
3761
+ out2.unsupported.push({ category: "tools", item: original.name, reason: "Disabled on the source, so it is not added.", alternative: "Add it yourself if you want it active here." });
3762
+ continue;
3763
+ }
3764
+ const profile = applyKnownServerProfile(original, opts.platformName);
3765
+ const t = profile.tool;
3766
+ out2.manualSteps.push(...profile.manualSteps);
3767
+ out2.unsupported.push(...profile.unsupported);
3768
+ for (const n of profile.notes) if (!seenNotes.has(n.message)) seenNotes.add(n.message), out2.notes.push(n);
3769
+ const trust = t.extensions?.["x-hermes"]?.trust;
3770
+ if (trust === "untrusted") {
3771
+ out2.unsupported.push({ category: "permissions", item: `${t.name}: Hermes asked before every call that is not read-only (trust: untrusted)`, reason: "Destination approvals are not copied.", alternative: `Set ${opts.platformName} to ask before using "${t.name}" tools, before using real funds.` });
3772
+ }
3773
+ const mcp = t.mcp;
3415
3774
  const s = {};
3416
- if (t.mcp.transport === "stdio") {
3417
- s.command = t.mcp.command;
3418
- if (t.mcp.args.length) s.args = t.mcp.args;
3419
- if (t.mcp.cwd) s.cwd = t.mcp.cwd;
3775
+ if (mcp.transport === "stdio") {
3776
+ s.command = mcp.command;
3777
+ if (mcp.args.length) s.args = mcp.args;
3778
+ if (mcp.cwd) s.cwd = mcp.cwd;
3420
3779
  } else {
3421
- s[opts.urlKey ?? "url"] = t.mcp.url;
3422
- if (opts.typeField) s.type = t.mcp.transport;
3780
+ s[opts.urlKey ?? "url"] = mcp.url;
3781
+ if (opts.typeField) s.type = mcp.transport;
3423
3782
  }
3783
+ const optionalNames = new Set(mcp.optionalEnv ?? []);
3784
+ const refs = { env: [], headers: [], optional: [] };
3424
3785
  const env = {};
3425
3786
  const missing = [];
3426
- for (const [k, v] of Object.entries(t.mcp.env)) {
3427
- if ("value" in v) env[k] = v.value;
3428
- else if (opts.envExpansion) {
3429
- env[k] = `\${${v.secretRef}}`;
3430
- missing.push(v.secretRef);
3431
- } else missing.push(k);
3787
+ const optionalMissing = [];
3788
+ for (const [k, v] of Object.entries(mcp.env)) {
3789
+ if ("value" in v) {
3790
+ env[k] = v.value;
3791
+ continue;
3792
+ }
3793
+ refs.env.push(k);
3794
+ if (optionalNames.has(k)) {
3795
+ refs.optional.push(k);
3796
+ const written = style === "none" ? null : opts.optionalRef?.(t, k) ?? null;
3797
+ if (written !== null) env[k] = written;
3798
+ else optionalMissing.push(k);
3799
+ continue;
3800
+ }
3801
+ if (style !== "none") env[k] = asRef(v.secretRef);
3802
+ missing.push(style === "none" ? k : v.secretRef);
3432
3803
  }
3433
3804
  if (Object.keys(env).length) s.env = env;
3434
3805
  const headers = {};
3435
- for (const [k, v] of Object.entries(t.mcp.headers)) {
3806
+ for (const [k, v] of Object.entries(mcp.headers)) {
3436
3807
  if ("value" in v) headers[k] = v.value;
3437
- else if (opts.envExpansion) {
3438
- headers[k] = `\${${v.secretRef}}`;
3439
- missing.push(v.secretRef);
3440
- } else missing.push(`${k} header`);
3808
+ else {
3809
+ refs.headers.push([k, v.secretRef]);
3810
+ if (style !== "none") {
3811
+ headers[k] = asRef(v.secretRef);
3812
+ missing.push(v.secretRef);
3813
+ } else missing.push(`${k} header`);
3814
+ }
3441
3815
  }
3442
3816
  if (Object.keys(headers).length) s.headers = headers;
3443
- servers[t.name] = s;
3817
+ out2.servers[t.name] = s;
3818
+ out2.refs[t.name] = refs;
3444
3819
  if (missing.length) {
3445
- manualSteps.push(
3446
- opts.envExpansion ? `Set ${missing.join(", ")} in your environment so the "${t.name}" MCP server can authenticate in ${opts.platformName}.` : `Add ${missing.join(", ")} for the "${t.name}" MCP server in ${opts.platformName}. Nomad does not write secret values.`
3820
+ out2.manualSteps.push(
3821
+ style !== "none" ? `Set ${missing.join(", ")} in your environment so the "${t.name}" MCP server can authenticate in ${opts.platformName}.` : `Add ${missing.join(", ")} for the "${t.name}" MCP server in ${opts.platformName}. Nomad does not write secret values.`
3447
3822
  );
3448
3823
  }
3824
+ if (optionalMissing.length) {
3825
+ out2.manualSteps.push(`If you use them, set ${optionalMissing.join(", ")} for the "${t.name}" MCP server in ${opts.platformName}. They were optional on the source and ${opts.platformName} may not accept an unset reference, so Nomad left them out.`);
3826
+ }
3449
3827
  }
3450
- return { servers, manualSteps };
3828
+ return out2;
3451
3829
  }
3452
3830
  function modelFamily(model) {
3453
3831
  if (!model) return null;
@@ -3527,11 +3905,13 @@ function parseMixedMemory(text3, opts) {
3527
3905
  if (outside) entries.push(...parseMemoryMarkdown(outside, opts).filter((e) => !/^#\s/.test(e.content)));
3528
3906
  return entries;
3529
3907
  }
3530
- var TEXT_EXT2, MARKER_RE, KIND_TITLES2, SECTION_RE;
3908
+ var TEXT_EXT2, MARKER_RE, KIND_TITLES2, SECTION_RE, ENV_REF;
3531
3909
  var init_util = __esm({
3532
3910
  "../../packages/adapters/src/util.ts"() {
3533
3911
  "use strict";
3534
3912
  init_src2();
3913
+ init_known_servers();
3914
+ init_elizaos_known_plugins();
3535
3915
  init_node();
3536
3916
  init_src3();
3537
3917
  init_src4();
@@ -3549,6 +3929,7 @@ var init_util = __esm({
3549
3929
  document: "Documents"
3550
3930
  };
3551
3931
  SECTION_RE = /<!-- nomad:section ([^>]*?) -->/g;
3932
+ ENV_REF = /^\$\{(env:)?([A-Za-z_][A-Za-z0-9_]*)(:-([^}]*))?\}$/;
3552
3933
  }
3553
3934
  });
3554
3935
 
@@ -3744,7 +4125,8 @@ var init_generic = __esm({
3744
4125
  });
3745
4126
 
3746
4127
  // ../../packages/adapters/src/claude-code.ts
3747
- import { basename as basename3, dirname as dirname2, join as join4 } from "path";
4128
+ import { realpathSync as realpathSync3 } from "fs";
4129
+ import { basename as basename3, dirname as dirname2, join as join4, resolve as resolve2, sep as sep2 } from "path";
3748
4130
  async function layoutOf(root) {
3749
4131
  const user = basename3(root) === ".claude" || !await pathExists(join4(root, ".claude")) && (await pathExists(join4(root, "settings.json")) || await isDirectory(join4(root, "agents")));
3750
4132
  if (user) {
@@ -3865,6 +4247,78 @@ function subagentModel(doc) {
3865
4247
  for (const a of ["opus", "sonnet", "haiku"]) if (lower.includes(a)) return a;
3866
4248
  return void 0;
3867
4249
  }
4250
+ async function readInstalledPlugins(root, settings2, notes) {
4251
+ const out2 = { tools: [], skills: [], integrations: [], sourceFiles: [] };
4252
+ const enabled = Object.entries(settings2?.enabledPlugins ?? {}).filter(([, v]) => v === true).map(([k]) => k);
4253
+ if (!enabled.length) return out2;
4254
+ const pluginsRoot = join4(root, "plugins");
4255
+ const roots = [pluginsRoot, process.env.CLAUDE_CODE_PLUGIN_CACHE_DIR].filter((x) => !!x).map((r) => {
4256
+ try {
4257
+ return realpathSync3(r);
4258
+ } catch {
4259
+ return r;
4260
+ }
4261
+ });
4262
+ const installedPath = join4(pluginsRoot, "installed_plugins.json");
4263
+ const installed = await readJson2(installedPath, notes);
4264
+ if (installed) out2.sourceFiles.push(installedPath);
4265
+ const map = installed?.plugins && typeof installed.plugins === "object" && !Array.isArray(installed.plugins) ? installed.plugins : installed ?? {};
4266
+ const marketplaces = await readJson2(join4(pluginsRoot, "known_marketplaces.json"), []) ?? {};
4267
+ for (const id of enabled) {
4268
+ const raw = map[id];
4269
+ const entry = Array.isArray(raw) ? raw.find((e) => e?.scope === "user") ?? raw[0] : raw;
4270
+ if (!entry || typeof entry.installPath !== "string") {
4271
+ notes.push({ level: "warning", category: "integrations", message: `Plugin ${id} is enabled but its install location was not found, so it was not read.` });
4272
+ continue;
4273
+ }
4274
+ let dir;
4275
+ try {
4276
+ dir = realpathSync3(entry.installPath);
4277
+ } catch {
4278
+ notes.push({ level: "warning", category: "integrations", message: `Plugin ${id} is enabled but its folder is missing.` });
4279
+ continue;
4280
+ }
4281
+ if (!roots.some((r) => dir === r || dir.startsWith(r + sep2))) {
4282
+ notes.push({ level: "warning", category: "integrations", message: `Plugin ${id} is installed outside the plugins folder, so it was not read.` });
4283
+ continue;
4284
+ }
4285
+ const [pluginName, marketplace] = id.split("@");
4286
+ const provenance = { note: `plugin ${id}`, extra: { plugin: id, pluginHost: P } };
4287
+ const manifestPath = join4(dir, ".claude-plugin", "plugin.json");
4288
+ const manifest = await readJson2(manifestPath, notes) ?? {};
4289
+ if (await pathExists(manifestPath)) out2.sourceFiles.push(manifestPath);
4290
+ const servers = {};
4291
+ if (manifest.mcpServers && typeof manifest.mcpServers === "object") Object.assign(servers, manifest.mcpServers);
4292
+ const mcpPath = join4(dir, typeof manifest.mcpServers === "string" ? manifest.mcpServers : ".mcp.json");
4293
+ const mcpFile = await readJson2(mcpPath, notes);
4294
+ if (mcpFile?.mcpServers) {
4295
+ out2.sourceFiles.push(mcpPath);
4296
+ Object.assign(servers, mcpFile.mcpServers);
4297
+ }
4298
+ out2.tools.push(...toolsFromMcpServers(servers, P, `plugins/${id}`, { notes, ...provenance }));
4299
+ const skillDirs = Array.isArray(manifest.skills) ? manifest.skills : typeof manifest.skills === "string" ? [manifest.skills] : ["skills"];
4300
+ for (const rel of skillDirs) {
4301
+ if (typeof rel !== "string") continue;
4302
+ const abs = resolve2(dir, rel);
4303
+ if (abs !== dir && !abs.startsWith(dir + sep2)) continue;
4304
+ for (const sk of await readSkillsTree(abs, P, notes, 1)) {
4305
+ sk.source = { ...sk.source ?? { platform: P }, note: provenance.note, ...provenance.extra };
4306
+ out2.skills.push(sk);
4307
+ }
4308
+ }
4309
+ const repo = marketplaces?.[marketplace ?? ""]?.source?.repo;
4310
+ out2.integrations.push({
4311
+ name: id,
4312
+ kind: "claude-code-plugin",
4313
+ requiresAuth: false,
4314
+ config: { ...typeof entry.version === "string" ? { version: entry.version } : {}, ...marketplace ? { marketplace } : {}, ...typeof repo === "string" ? { marketplaceRepo: repo } : {}, plugin: pluginName },
4315
+ notes: "Installed Claude Code plugin",
4316
+ source: { platform: P, path: `plugins/${id}` }
4317
+ });
4318
+ notes.push({ level: "info", category: "integrations", message: `Read installed plugin ${id} (installed plugin read, not installed anywhere by Nomad).` });
4319
+ }
4320
+ return out2;
4321
+ }
3868
4322
  async function readMain(root, notes, includeSecrets, agentId) {
3869
4323
  const L = await layoutOf(root);
3870
4324
  const sourceFiles = [];
@@ -3952,7 +4406,22 @@ async function readMain(root, notes, includeSecrets, agentId) {
3952
4406
  const mcp = await readJson2(mcpFile, notes);
3953
4407
  if (mcp?.mcpServers) {
3954
4408
  sourceFiles.push(mcpFile);
3955
- doc.tools.push(...toolsFromMcpServers(mcp.mcpServers, P, L.mcpPath));
4409
+ doc.tools.push(...toolsFromMcpServers(mcp.mcpServers, P, L.mcpPath, { notes }));
4410
+ }
4411
+ if (L.user) {
4412
+ const plugins = await readInstalledPlugins(root, settings2, notes);
4413
+ for (const t of plugins.tools) {
4414
+ const same2 = doc.tools.find((d) => d.mcp && t.mcp && d.mcp.transport === t.mcp.transport && !!d.mcp.url && d.mcp.url === t.mcp.url);
4415
+ if (same2) {
4416
+ notes.push({ level: "info", category: "tools", message: `"${t.name}" from plugin ${String(t.source?.plugin)} points at the same server as "${same2.name}", so it is read once.` });
4417
+ continue;
4418
+ }
4419
+ if (doc.tools.some((d) => d.name === t.name)) t.name = `${t.name}-plugin`;
4420
+ doc.tools.push(t);
4421
+ }
4422
+ doc.skills.push(...plugins.skills.filter((sk) => !doc.skills.some((d) => d.name === sk.name)));
4423
+ doc.integrations.push(...plugins.integrations);
4424
+ sourceFiles.push(...plugins.sourceFiles);
3956
4425
  }
3957
4426
  void includeSecrets;
3958
4427
  return { doc, sourceFiles };
@@ -4016,8 +4485,14 @@ async function planMain(doc, ctx, L) {
4016
4485
  description: "Agent name, persona and instructions in a Nomad managed section of CLAUDE.md"
4017
4486
  });
4018
4487
  if (doc.identity.persona) conversions.push({ category: "identity", item: "persona", from: "persona", to: "Persona section in CLAUDE.md" });
4488
+ const fromPlugins = new Set([...doc.tools, ...doc.skills].map((x) => pluginOf(x, P)).filter((x) => !!x));
4489
+ for (const id of fromPlugins) {
4490
+ 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>";
4492
+ 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
+ }
4019
4494
  if (wants(ctx, "skills")) {
4020
- for (const s of doc.skills) {
4495
+ for (const s of doc.skills.filter((x) => !pluginOf(x, P))) {
4021
4496
  if (s.frontmatter["x-claude-code-command"] === true || s.frontmatter["x-codex-prompt"] === true) {
4022
4497
  const { "x-claude-code-command": _c, "x-codex-prompt": _p, ...fm } = s.frontmatter;
4023
4498
  if (_p) conversions.push({ category: "skills", item: s.name, from: "Codex custom prompt", to: "Claude Code slash command" });
@@ -4050,9 +4525,16 @@ async function planMain(doc, ctx, L) {
4050
4525
  files.push({ path: L.settings, content: JSON.stringify(settings2, null, 2) + "\n", strategy: "merge-json", component: "permissions", description: "Permissions and model in settings.json" });
4051
4526
  }
4052
4527
  if (wants(ctx, "tools")) {
4053
- const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp);
4528
+ const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp && !pluginOf(t, P));
4054
4529
  if (mcpTools.length) {
4055
- const r = mcpServersFromTools(mcpTools, { platformName: "Claude Code", envExpansion: true, typeField: true });
4530
+ const r = mcpServersFromTools(mcpTools, {
4531
+ platformName: "Claude Code",
4532
+ envRefStyle: "dollar",
4533
+ typeField: true,
4534
+ optionalRef: (t, name) => (t.mcp?.emptyOkEnv ?? []).includes(name) ? `\${${name}:-}` : null
4535
+ });
4536
+ unsupported.push(...r.unsupported);
4537
+ notes.push(...r.notes);
4056
4538
  files.push({
4057
4539
  path: L.mcpPath,
4058
4540
  root: L.mcpRoot,
@@ -4070,7 +4552,7 @@ async function planMain(doc, ctx, L) {
4070
4552
  for (const w of doc.workflows) unsupported.push({ category: "workflows", item: w.name, reason: "Claude Code has no local scheduler.", alternative: "Use a system scheduler or another platform for this routine." });
4071
4553
  manualSteps.push(...workflowManualSteps(doc, "Claude Code"));
4072
4554
  }
4073
- if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(`Reconnect the ${i.name} integration in Claude Code.`);
4555
+ if (wants(ctx, "integrations")) for (const i of doc.integrations.filter((x) => !(x.kind === "claude-code-plugin" && fromPlugins.has(x.name)))) manualSteps.push(integrationStep(i, "Claude Code", `Reconnect the ${i.name} integration in Claude Code.`));
4074
4556
  if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) into your project and reference them from CLAUDE.md.`);
4075
4557
  return { nativeId: "main", files, notes, manualSteps, conversions, unsupported };
4076
4558
  }
@@ -4203,12 +4685,12 @@ var init_claude_code = __esm({
4203
4685
  }
4204
4686
  if (wants(ctx, "skills") && doc.skills.length && !nativeId.startsWith("subagent:")) {
4205
4687
  const names = new Set(got.skills.map((s) => s.name));
4206
- const missing = doc.skills.filter((s) => !names.has(s.name));
4688
+ const missing = doc.skills.filter((s) => !pluginOf(s, this.info.id) && !names.has(s.name));
4207
4689
  checks.push({ name: "Skills written", ok: missing.length === 0, detail: missing.length ? `Missing: ${missing.map((s) => s.name).join(", ")}` : void 0 });
4208
4690
  }
4209
4691
  if (wants(ctx, "tools") && doc.tools.some((t) => t.kind === "mcp") && !nativeId.startsWith("subagent:")) {
4210
4692
  const names = new Set(got.tools.map((t) => t.name));
4211
- const missing = doc.tools.filter((t) => t.kind === "mcp" && !names.has(t.name));
4693
+ const missing = doc.tools.filter((t) => t.kind === "mcp" && t.enabled !== false && !pluginOf(t, this.info.id) && !names.has(t.name));
4212
4694
  checks.push({ name: "MCP servers configured", ok: missing.length === 0, detail: missing.length ? `Missing: ${missing.map((t) => t.name).join(", ")}` : void 0 });
4213
4695
  }
4214
4696
  return checks;
@@ -4352,8 +4834,14 @@ var init_codex = __esm({
4352
4834
  doc.permissions = policyFromCodexConfig(cfg);
4353
4835
  if (cfg.mcp_servers) {
4354
4836
  const servers = {};
4355
- for (const [name, s] of Object.entries(cfg.mcp_servers)) servers[name] = { ...s, headers: s.http_headers };
4356
- doc.tools.push(...toolsFromMcpServers(servers, P2, L.config));
4837
+ for (const [name, s] of Object.entries(cfg.mcp_servers)) {
4838
+ const env = { ...s.env ?? {} };
4839
+ for (const v of Array.isArray(s.env_vars) ? s.env_vars : []) if (typeof v === "string" && !(v in env)) env[v] = `\${${v}}`;
4840
+ const headers = { ...s.http_headers ?? {} };
4841
+ for (const [h, v] of Object.entries(s.env_http_headers ?? {})) if (typeof v === "string") headers[h] = `\${${v}}`;
4842
+ servers[name] = { ...s, env, headers };
4843
+ }
4844
+ doc.tools.push(...toolsFromMcpServers(servers, P2, L.config, { notes }));
4357
4845
  }
4358
4846
  if (cfg.profiles) doc.extensions["x-codex"] = { profiles: cfg.profiles };
4359
4847
  }
@@ -4432,14 +4920,25 @@ var init_codex = __esm({
4432
4920
  if (wants(ctx, "tools")) {
4433
4921
  const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp);
4434
4922
  if (mcpTools.length) {
4435
- const r = mcpServersFromTools(mcpTools, { platformName: "Codex", envExpansion: false });
4923
+ const r = mcpServersFromTools(mcpTools, { platformName: "Codex", envRefStyle: "none" });
4436
4924
  const servers = {};
4437
4925
  for (const [name, s] of Object.entries(r.servers)) {
4438
- const { headers, ...rest } = s;
4439
- servers[name] = { ...rest, ...headers ? { http_headers: headers } : {} };
4926
+ const refs = r.refs[name];
4927
+ if (s.url) {
4928
+ servers[name] = {
4929
+ url: s.url,
4930
+ ...s.headers ? { http_headers: s.headers } : {},
4931
+ ...refs?.headers.length ? { env_http_headers: Object.fromEntries(refs.headers) } : {}
4932
+ };
4933
+ continue;
4934
+ }
4935
+ const { headers: _h, ...rest } = s;
4936
+ servers[name] = { ...rest, ...refs?.env.length ? { env_vars: refs.env } : {} };
4440
4937
  }
4441
4938
  config.mcp_servers = servers;
4442
- manualSteps.push(...r.manualSteps);
4939
+ manualSteps.push(...r.manualSteps.map((m) => m.replace(/^Add (.+) for the "(.+)" MCP server in Codex\. Nomad does not write secret values\.$/, 'Set $1 in your shell before starting Codex: the "$2" MCP server forwards them (env_vars). Nomad does not write secret values.')));
4940
+ unsupported.push(...r.unsupported);
4941
+ notes.push(...r.notes);
4443
4942
  }
4444
4943
  for (const t of doc.tools.filter((t2) => t2.kind !== "mcp")) unsupported.push({ category: "tools", item: t.name, reason: "Only MCP servers can be configured in Codex." });
4445
4944
  }
@@ -4451,7 +4950,7 @@ var init_codex = __esm({
4451
4950
  for (const w of doc.workflows) unsupported.push({ category: "workflows", item: w.name, reason: "Codex has no scheduler." });
4452
4951
  manualSteps.push(...workflowManualSteps(doc, "Codex"));
4453
4952
  }
4454
- if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(`Reconnect the ${i.name} integration for Codex.`);
4953
+ if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(integrationStep(i, "Codex", `Reconnect the ${i.name} integration for Codex.`));
4455
4954
  if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) into the project and mention them in AGENTS.md.`);
4456
4955
  return { nativeId: "main", files, notes, manualSteps, conversions, unsupported };
4457
4956
  },
@@ -4482,12 +4981,12 @@ var init_codex = __esm({
4482
4981
  }
4483
4982
  if (wants(ctx, "skills") && doc.skills.length) {
4484
4983
  const names = new Set(got.skills.map((s) => s.name));
4485
- const missing = doc.skills.filter((s) => !names.has(s.name) && !names.has(safeName2(s.name)));
4984
+ const missing = doc.skills.filter((s) => !pluginOf(s, this.info.id) && !names.has(s.name) && !names.has(safeName2(s.name)));
4486
4985
  checks.push({ name: "Skills written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((s) => s.name).join(", ")}` : void 0 });
4487
4986
  }
4488
4987
  if (wants(ctx, "tools") && doc.tools.some((t) => t.kind === "mcp")) {
4489
4988
  const names = new Set(got.tools.map((t) => t.name));
4490
- const missing = doc.tools.filter((t) => t.kind === "mcp" && !names.has(t.name));
4989
+ const missing = doc.tools.filter((t) => t.kind === "mcp" && t.enabled !== false && !pluginOf(t, this.info.id) && !names.has(t.name));
4491
4990
  checks.push({ name: "MCP servers configured", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((t) => t.name).join(", ")}` : void 0 });
4492
4991
  }
4493
4992
  return checks;
@@ -4887,7 +5386,7 @@ ${m.content.trim()}
4887
5386
  if (t.mcp) manualSteps.push(`Add the "${t.name}" MCP server (${t.mcp.command ?? t.mcp.url ?? ""} ${t.mcp.args.join(" ")}) through your OpenClaw MCP plugin.`.replace(/\s+\)/, ")"));
4888
5387
  }
4889
5388
  }
4890
- if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(`Reconnect ${i.name} in OpenClaw (credentials are never migrated).`);
5389
+ if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(integrationStep(i, "OpenClaw", `Reconnect ${i.name} in OpenClaw (credentials are never migrated).`));
4891
5390
  if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) into the workspace.`);
4892
5391
  if (newEntry) notes.push({ level: "info", message: `A new agent "${agentId}" with its own workspace will be created. Restart the gateway to load it.` });
4893
5392
  return { nativeId: agentId, files, notes, manualSteps, conversions, unsupported };
@@ -4977,7 +5476,7 @@ var init_openclaw = __esm({
4977
5476
  }
4978
5477
  if (wants(ctx, "skills") && doc.skills.length) {
4979
5478
  const names = new Set(got.skills.map((s) => s.name));
4980
- const missing = doc.skills.filter((s) => !names.has(s.name));
5479
+ const missing = doc.skills.filter((s) => !pluginOf(s, this.info.id) && !names.has(s.name));
4981
5480
  checks.push({ name: "Skills written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((s) => s.name).join(", ")}` : void 0 });
4982
5481
  }
4983
5482
  if (wants(ctx, "workflows") && doc.workflows.length) {
@@ -5055,6 +5554,70 @@ function memoryEntriesFrom(text3, kind, scope, path) {
5055
5554
  source: { platform: P4, path }
5056
5555
  }));
5057
5556
  }
5557
+ async function readPlugins(h, cfg, notes) {
5558
+ const out2 = { tools: [], skills: [], integrations: [], sourceFiles: [] };
5559
+ const enabled = new Set(Array.isArray(cfg?.plugins?.enabled) ? cfg.plugins.enabled.map(String) : []);
5560
+ const disabled = new Set(Array.isArray(cfg?.plugins?.disabled) ? cfg.plugins.disabled.map(String) : []);
5561
+ const base = join7(h, "plugins");
5562
+ const dirs = [];
5563
+ for (const e of await listDir(base)) {
5564
+ if (!e.dir || e.name.startsWith(".")) continue;
5565
+ const abs = join7(base, e.name);
5566
+ if (await pathExists(join7(abs, "plugin.json")) || await pathExists(join7(abs, "plugin.yaml"))) dirs.push({ rel: e.name, abs });
5567
+ else for (const c2 of await listDir(abs)) if (c2.dir && !c2.name.startsWith(".") && (await pathExists(join7(abs, c2.name, "plugin.json")) || await pathExists(join7(abs, c2.name, "plugin.yaml")))) dirs.push({ rel: `${e.name}/${c2.name}`, abs: join7(abs, c2.name) });
5568
+ }
5569
+ for (const d of dirs) {
5570
+ const manifestText = await readTextIfExists(join7(d.abs, "plugin.json"));
5571
+ if (manifestText === null) {
5572
+ out2.integrations.push({ name: d.rel.split("/").pop(), kind: "hermes-plugin", requiresAuth: false, config: { native: true }, notes: "Native Hermes plugin (Python). Its code was not read or copied.", source: { platform: P4, path: `plugins/${d.rel}` } });
5573
+ notes.push({ level: "info", category: "integrations", message: `Hermes plugin ${d.rel} is a native plugin: code not read or copied.` });
5574
+ continue;
5575
+ }
5576
+ let manifest;
5577
+ try {
5578
+ manifest = JSON.parse(manifestText);
5579
+ } catch {
5580
+ notes.push({ level: "warning", category: "integrations", message: `plugins/${d.rel}/plugin.json could not be parsed and was skipped.` });
5581
+ continue;
5582
+ }
5583
+ out2.sourceFiles.push(join7(d.abs, "plugin.json"));
5584
+ const name = typeof manifest.name === "string" && manifest.name ? manifest.name : d.rel.split("/").pop();
5585
+ const on = enabled.has(name) && !disabled.has(name);
5586
+ const provenance = { note: `plugin ${name}`, extra: { plugin: name, pluginHost: P4 } };
5587
+ const trust = manifest.extensions?.["com.nousresearch.hermes"]?.servers ?? {};
5588
+ const mcpText = await readTextIfExists(join7(d.abs, "mcp.json"));
5589
+ const requiredEnv = [];
5590
+ if (mcpText !== null) {
5591
+ out2.sourceFiles.push(join7(d.abs, "mcp.json"));
5592
+ try {
5593
+ const servers = JSON.parse(mcpText).mcpServers ?? {};
5594
+ const tools = toolsFromMcpServers(servers, P4, `plugins/${d.rel}/mcp.json`, { notes, refsOptional: true, ...provenance });
5595
+ for (const t of tools) {
5596
+ if (!on) t.enabled = false;
5597
+ const tr = trust[t.name]?.trust;
5598
+ if (typeof tr === "string") t.extensions = { "x-hermes": { trust: tr } };
5599
+ for (const [k, v] of Object.entries(t.mcp.env)) if (!("value" in v)) requiredEnv.push(k);
5600
+ }
5601
+ out2.tools.push(...tools);
5602
+ } catch {
5603
+ notes.push({ level: "warning", category: "tools", message: `plugins/${d.rel}/mcp.json could not be parsed and was skipped.` });
5604
+ }
5605
+ }
5606
+ const skills = on ? await readSkillsTree(join7(d.abs, "skills"), P4, notes, 2) : [];
5607
+ for (const sk of skills) sk.source = { ...sk.source ?? { platform: P4 }, note: provenance.note, ...provenance.extra };
5608
+ out2.skills.push(...skills);
5609
+ out2.integrations.push({
5610
+ name,
5611
+ kind: "hermes-plugin",
5612
+ requiresAuth: requiredEnv.length > 0,
5613
+ config: { ...typeof manifest.version === "string" ? { version: manifest.version } : {}, enabled: on, ...requiredEnv.length ? { requiredEnv: [...new Set(requiredEnv)] } : {} },
5614
+ notes: on ? "Installed and enabled Hermes plugin" : "Installed Hermes plugin, not enabled",
5615
+ source: { platform: P4, path: `plugins/${d.rel}/plugin.json` }
5616
+ });
5617
+ notes.push({ level: "info", category: "integrations", message: `Read installed Hermes plugin ${name}${on ? "" : " (not enabled, so its servers stay off)"}. Nomad never installs or enables plugins.` });
5618
+ }
5619
+ return out2;
5620
+ }
5058
5621
  async function readHome(root, nativeId, notes, agentId) {
5059
5622
  const h = homeFor(root, nativeId);
5060
5623
  const sourceFiles = [];
@@ -5104,13 +5667,21 @@ ${doc.identity.persona}` : outside;
5104
5667
  const model = typeof cfg.model === "string" ? cfg.model : cfg.model?.default;
5105
5668
  if (typeof model === "string") doc.models.preferred = model;
5106
5669
  if (typeof cfg.model?.provider === "string") doc.models.provider = cfg.model.provider;
5107
- if (cfg.mcp_servers) doc.tools.push(...toolsFromMcpServers(cfg.mcp_servers, P4, "config.yaml"));
5670
+ if (cfg.mcp_servers) doc.tools.push(...toolsFromMcpServers(cfg.mcp_servers, P4, "config.yaml", { notes, refsOptional: true }));
5108
5671
  if (Array.isArray(cfg.command_allowlist)) {
5109
5672
  doc.permissions = { mode: "ask", rules: cfg.command_allowlist.map((c2) => rule("shell", "allow", String(c2), "hermes:command_allowlist")), notes: ["Hermes command allowlist"] };
5110
5673
  }
5111
5674
  }
5112
5675
  if (await pathExists(join7(h, ".env"))) notes.push({ level: "info", category: "integrations", message: "~/.hermes/.env holds secrets. It is never read or migrated." });
5113
5676
  doc.skills.push(...await readSkillsTree(join7(h, "skills"), P4, notes, 3));
5677
+ const plugins = await readPlugins(h, cfg, notes);
5678
+ for (const t of plugins.tools) {
5679
+ if (doc.tools.some((d) => d.name === t.name)) t.name = `${t.name}-plugin`;
5680
+ doc.tools.push(t);
5681
+ }
5682
+ doc.skills.push(...plugins.skills.filter((s) => !doc.skills.some((d) => d.name === s.name)));
5683
+ doc.integrations.push(...plugins.integrations);
5684
+ sourceFiles.push(...plugins.sourceFiles);
5114
5685
  const jobsText = await read("cron/jobs.json");
5115
5686
  if (jobsText) {
5116
5687
  try {
@@ -5179,15 +5750,15 @@ async function planHome(doc, ctx) {
5179
5750
  const user = doc.memory.filter((m) => m.scope === "user" || m.kind === "profile");
5180
5751
  const logs = doc.memory.filter((m) => m.kind === "daily-log" || m.kind === "document");
5181
5752
  const rest = doc.memory.filter((m) => !user.includes(m) && !logs.includes(m));
5182
- const sep4 = `
5753
+ const sep5 = `
5183
5754
  ${HERMES_DELIMITER}
5184
5755
  `;
5185
5756
  const check = async (rel, entries, limit, label) => {
5186
5757
  if (!entries.length) return;
5187
5758
  const existing = splitEntries(await readTextIfExists(join7(h, rel)) ?? "");
5188
5759
  const all = [...existing, ...entries.map((e) => plainEntry(e.content)).filter((e) => !existing.includes(e))];
5189
- const size = all.join(sep4).length;
5190
- files.push({ path: `${prefix}${rel}`, content: entries.map((e) => plainEntry(e.content)).join(sep4) + "\n", strategy: "append-entries", entryDelimiter: HERMES_DELIMITER, component: "memory", description: `${entries.length} ${label} entries` });
5760
+ const size = all.join(sep5).length;
5761
+ files.push({ path: `${prefix}${rel}`, content: entries.map((e) => plainEntry(e.content)).join(sep5) + "\n", strategy: "append-entries", entryDelimiter: HERMES_DELIMITER, component: "memory", description: `${entries.length} ${label} entries` });
5191
5762
  if (size > limit) {
5192
5763
  notes.push({ level: "warning", category: "memory", message: `${rel} will hold ${size} characters, above the Hermes default limit of ${limit}. Hermes keeps loading it but refuses new memory until it is consolidated.` });
5193
5764
  manualSteps.push(`Raise memory.${label === "user" ? "user_char_limit" : "memory_char_limit"} in config.yaml to at least ${size}, or ask Hermes to consolidate ${rel}.`);
@@ -5204,8 +5775,12 @@ ${m.content.trim()}
5204
5775
  }
5205
5776
  if (logs.length) conversions.push({ category: "memory", item: `${logs.length} logs`, from: "daily logs", to: "memories/archive (readable on request, not loaded into every prompt)" });
5206
5777
  }
5778
+ const fromPlugins = new Set([...doc.tools, ...doc.skills].map((x) => pluginOf(x, P4)).filter((x) => !!x));
5779
+ for (const name of fromPlugins) {
5780
+ manualSteps.push(`Install and enable the Hermes plugin ${name}: "hermes plugins install ${name}", then "hermes plugins enable ${name}" (portable plugins install disabled). Nomad does not copy plugin servers or skills into config.yaml or skills/.`);
5781
+ }
5207
5782
  if (wants(ctx, "skills")) {
5208
- for (const s of doc.skills) {
5783
+ for (const s of doc.skills.filter((x) => !pluginOf(x, P4))) {
5209
5784
  const { "x-claude-code-command": c2, "x-codex-prompt": p, ...fm } = s.frontmatter;
5210
5785
  files.push(...skillToFiles({ ...s, frontmatter: fm }, `${prefix}skills/nomad-imports`));
5211
5786
  if (c2 || p) conversions.push({ category: "skills", item: s.name, from: c2 ? "Claude Code slash command" : "Codex custom prompt", to: "Hermes skill" });
@@ -5219,11 +5794,15 @@ ${m.content.trim()}
5219
5794
  manualSteps.push(`Check that Hermes has a provider for ${model} ("hermes model").`);
5220
5795
  }
5221
5796
  if (wants(ctx, "tools")) {
5222
- const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp);
5797
+ const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp && !pluginOf(t, P4));
5223
5798
  if (mcpTools.length) {
5224
- const r = mcpServersFromTools(mcpTools, { platformName: "Hermes (~/.hermes/.env)", envExpansion: false });
5799
+ const r = mcpServersFromTools(mcpTools, { platformName: "Hermes", envRefStyle: "dollar", optionalRef: (_t, name) => `\${${name}}` });
5225
5800
  cfg.mcp_servers = r.servers;
5226
- manualSteps.push(...r.manualSteps);
5801
+ const refNames = [...new Set(Object.values(r.refs).flatMap((x) => [...x.env.filter((k) => Object.values(r.servers).some((sv) => sv.env?.[k])), ...x.headers.map(([, v]) => v)]))];
5802
+ if (refNames.length) manualSteps.push(`Add ${refNames.join(", ")} to ~/.hermes/.env (Nomad never reads or writes that file).`);
5803
+ manualSteps.push(...r.manualSteps.filter((m) => !m.startsWith("Set ")));
5804
+ unsupported.push(...r.unsupported);
5805
+ notes.push(...r.notes);
5227
5806
  }
5228
5807
  }
5229
5808
  if (wants(ctx, "permissions")) {
@@ -5273,7 +5852,7 @@ ${m.content.trim()}
5273
5852
  manualSteps.push(`Review the imported routines and resume them with "hermes cron resume <id>". Results are delivered locally until you change the target.`);
5274
5853
  }
5275
5854
  }
5276
- if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(`Reconnect ${i.name} in Hermes ("hermes gateway setup"). Credentials are never migrated.`);
5855
+ if (wants(ctx, "integrations")) for (const i of doc.integrations.filter((x) => !(x.kind === "hermes-plugin" && fromPlugins.has(x.name)))) manualSteps.push(integrationStep(i, "Hermes", `Reconnect ${i.name} in Hermes ("hermes gateway setup"). Credentials are never migrated.`));
5277
5856
  if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) somewhere Hermes can read them.`);
5278
5857
  return { nativeId, files, notes, manualSteps, conversions, unsupported };
5279
5858
  }
@@ -5344,7 +5923,7 @@ var init_hermes = __esm({
5344
5923
  }
5345
5924
  if (wants(ctx, "skills") && doc.skills.length) {
5346
5925
  const names = new Set(got.skills.map((s) => s.name));
5347
- const missing = doc.skills.filter((s) => !names.has(s.name));
5926
+ const missing = doc.skills.filter((s) => !pluginOf(s, this.info.id) && !names.has(s.name));
5348
5927
  checks.push({ name: "Skills written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((s) => s.name).join(", ")}` : void 0 });
5349
5928
  }
5350
5929
  if (wants(ctx, "workflows") && doc.workflows.length) {
@@ -5358,8 +5937,384 @@ var init_hermes = __esm({
5358
5937
  }
5359
5938
  });
5360
5939
 
5940
+ // ../../packages/adapters/src/elizaos.ts
5941
+ import { promises as fsp4 } from "fs";
5942
+ import { basename as basename6, dirname as dirname3, join as join8 } from "path";
5943
+ async function isFile2(p) {
5944
+ try {
5945
+ return (await fsp4.lstat(p)).isFile();
5946
+ } catch {
5947
+ return false;
5948
+ }
5949
+ }
5950
+ async function characterFiles(root) {
5951
+ if (/\.json$/i.test(root) && await isFile2(root)) return [{ id: basename6(root).replace(/(\.character)?\.json$/i, ""), path: root }];
5952
+ const out2 = [];
5953
+ for (const dir of [join8(root, "characters"), root]) {
5954
+ for (const e of await listDir(dir)) {
5955
+ if (!(e.file || e.symlink)) continue;
5956
+ const isChar = dir === root ? /\.character\.json$/i.test(e.name) : /\.json$/i.test(e.name);
5957
+ if (!isChar) continue;
5958
+ const id = e.name.replace(/(\.character)?\.json$/i, "");
5959
+ if (!out2.some((o) => o.id === id)) out2.push({ id, path: join8(dir, e.name) });
5960
+ }
5961
+ }
5962
+ return out2;
5963
+ }
5964
+ async function typescriptCharacters(root) {
5965
+ const found = [];
5966
+ for (const rel of ["character.ts", "src/character.ts", "src/characters"]) {
5967
+ if (!await pathExists(join8(root, rel))) continue;
5968
+ if (rel.endsWith(".ts")) found.push(rel);
5969
+ else for (const e of await listDir(join8(root, rel))) if (e.file && e.name.endsWith(".ts")) found.push(`${rel}/${e.name}`);
5970
+ }
5971
+ return found;
5972
+ }
5973
+ function isSecretEntry(key2, value) {
5974
+ if (isSensitiveEnvKey(key2)) return true;
5975
+ return typeof value === "string" && looksLikeSecretValue(value);
5976
+ }
5977
+ function stripSecrets(obj, names, prefix = "") {
5978
+ const out2 = {};
5979
+ for (const [k, v] of Object.entries(obj)) {
5980
+ if (isSecretEntry(k, v)) {
5981
+ names.push(prefix + k);
5982
+ continue;
5983
+ }
5984
+ out2[k] = v;
5985
+ }
5986
+ return out2;
5987
+ }
5988
+ function parseCharacter(text3) {
5989
+ const parsed = JSON.parse(text3);
5990
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("A character file must hold a JSON object.");
5991
+ const character = parsed;
5992
+ const secretNames = [];
5993
+ if (character.secrets && typeof character.secrets === "object") secretNames.push(...Object.keys(character.secrets));
5994
+ delete character.secrets;
5995
+ const settings2 = character.settings && typeof character.settings === "object" && !Array.isArray(character.settings) ? character.settings : void 0;
5996
+ if (settings2?.secrets && typeof settings2.secrets === "object") secretNames.push(...Object.keys(settings2.secrets));
5997
+ if (settings2) delete settings2.secrets;
5998
+ return { character, secretNames };
5999
+ }
6000
+ function characterToDocument(character, secretNames, path, notes) {
6001
+ const name = typeof character.name === "string" && character.name.trim() ? character.name.trim() : basename6(path).replace(/(\.character)?\.json$/i, "");
6002
+ const doc = createDocument({ name, platform: P5 });
6003
+ if (typeof character.nomadAgentId === "string" && /^[0-9A-HJKMNP-TV-Z]{26}$/.test(character.nomadAgentId)) doc.id = character.nomadAgentId;
6004
+ const settings2 = character.settings && typeof character.settings === "object" ? character.settings : {};
6005
+ if (typeof settings2.nomadAgentId === "string" && /^[0-9A-HJKMNP-TV-Z]{26}$/.test(settings2.nomadAgentId)) doc.id = settings2.nomadAgentId;
6006
+ const x = {};
6007
+ const src = (field) => ({ platform: P5, path: `${basename6(path)}#${field}` });
6008
+ if (typeof character.username === "string") x.username = character.username;
6009
+ if (typeof character.id === "string") x.characterId = character.id;
6010
+ if (Array.isArray(character.bio)) {
6011
+ doc.identity.persona = character.bio.map(String).join("\n");
6012
+ x.bioShape = "array";
6013
+ } else if (typeof character.bio === "string") {
6014
+ doc.identity.persona = character.bio;
6015
+ x.bioShape = "string";
6016
+ } else notes.push({ level: "info", category: "identity", message: "The character has no bio." });
6017
+ if (typeof character.system === "string" && character.system.trim()) doc.instructions.push({ id: "eliza-system", kind: "system", title: "System", content: character.system, source: src("system") });
6018
+ if (character.style && typeof character.style === "object") {
6019
+ x.style = character.style;
6020
+ const style = character.style;
6021
+ for (const k of STYLE_KEYS) {
6022
+ const items = Array.isArray(style[k]) ? style[k].map(String) : [];
6023
+ if (items.length) doc.instructions.push({ id: `eliza-style-${k}`, kind: "conventions", title: `Style (${k})`, content: items.map((i) => `- ${i}`).join("\n"), source: src(`style.${k}`) });
6024
+ }
6025
+ }
6026
+ if (Array.isArray(character.adjectives)) {
6027
+ x.adjectives = character.adjectives;
6028
+ const tone = character.adjectives.map(String).join(", ");
6029
+ doc.identity.tone = tone.length > 200 ? `${tone.slice(0, 197).replace(/,[^,]*$/, "")}...` : tone;
6030
+ }
6031
+ if (Array.isArray(character.topics)) x.topics = character.topics;
6032
+ for (const k of ["messageExamples", "postExamples"]) {
6033
+ if (character[k] === void 0) continue;
6034
+ if (bytes(x.messageExamples) + bytes(character[k]) > MAX_EXAMPLES_BYTES) {
6035
+ notes.push({ level: "warning", category: "identity", message: `${k} is larger than 256 KB and was left out.` });
6036
+ continue;
6037
+ }
6038
+ x[k] = character[k];
6039
+ }
6040
+ if (character.templates && typeof character.templates === "object") {
6041
+ x.templates = Object.fromEntries(Object.entries(character.templates).filter(([, v]) => typeof v === "string"));
6042
+ }
6043
+ if (Array.isArray(character.knowledge)) {
6044
+ let n = 0;
6045
+ for (const k of character.knowledge) {
6046
+ if (typeof k === "string") doc.memory.push({ id: `eliza-knowledge-${++n}`, kind: "fact", scope: "agent", content: k, tags: [], source: src("knowledge") });
6047
+ else if (k && typeof k === "object") {
6048
+ const ref = k;
6049
+ const p = typeof ref.path === "string" ? ref.path : typeof ref.directory === "string" ? ref.directory : null;
6050
+ if (p) doc.knowledge.push({ path: p, ...typeof ref.directory === "string" ? { directory: true } : {}, ...typeof ref.shared === "boolean" ? { shared: ref.shared } : {} });
6051
+ }
6052
+ }
6053
+ }
6054
+ if (Array.isArray(character.plugins)) {
6055
+ for (const raw of character.plugins) {
6056
+ if (typeof raw !== "string") continue;
6057
+ const known = knownElizaosPlugin(raw);
6058
+ const local = raw.startsWith(".") || raw.startsWith("/");
6059
+ const it = {
6060
+ name: raw,
6061
+ kind: "elizaos-plugin",
6062
+ requiresAuth: !!known?.sensitive.length,
6063
+ config: known ? { requiredSettingNames: known.settingNames } : {},
6064
+ notes: local ? "Local plugin: the path is on the source machine." : known ? `${known.note} ${elizaosPluginHint(raw)}` : void 0,
6065
+ source: src("plugins")
6066
+ };
6067
+ doc.integrations.push(it);
6068
+ }
6069
+ }
6070
+ const mcp = settings2.mcp && typeof settings2.mcp === "object" ? settings2.mcp : void 0;
6071
+ if (mcp?.servers && typeof mcp.servers === "object") doc.tools.push(...toolsFromMcpServers(mcp.servers, P5, `${basename6(path)}#settings.mcp.servers`, { notes }));
6072
+ const restNames = [];
6073
+ const { mcp: _mcp, nomadAgentId: _id, ...otherSettings } = settings2;
6074
+ const keptSettings = stripSecrets(otherSettings, restNames, "settings.");
6075
+ const mcpRest = mcp ? Object.fromEntries(Object.entries(mcp).filter(([k]) => k !== "servers")) : {};
6076
+ if (Object.keys(keptSettings).length || Object.keys(mcpRest).length) x.settings = { ...keptSettings, ...Object.keys(mcpRest).length ? { mcp: mcpRest } : {} };
6077
+ if (typeof character.modelProvider === "string") {
6078
+ const p = PROVIDERS[character.modelProvider.toLowerCase()];
6079
+ if (p) doc.models.provider = p;
6080
+ }
6081
+ const unknownNames = [];
6082
+ const unknown = stripSecrets(Object.fromEntries(Object.entries(character).filter(([k]) => !KNOWN_KEYS.has(k))), unknownNames);
6083
+ if (Object.keys(unknown).length && bytes(unknown) <= MAX_EXAMPLES_BYTES) x.unknown = unknown;
6084
+ const dropped = [...secretNames, ...restNames, ...unknownNames];
6085
+ if (dropped.length) {
6086
+ x.secretNames = dropped;
6087
+ notes.push({ level: "info", category: "integrations", message: `Secrets are never read or moved. Set these again on the destination: ${dropped.join(", ")}.` });
6088
+ }
6089
+ if (dropped.some((d) => d.endsWith(PRIORS_OWNER))) {
6090
+ notes.push({ level: "warning", category: "permissions", message: "This agent only moved money for named ElizaOS entities (PRIORS_OWNER_ENTITY_IDS). Other platforms use their own approval prompts; that rule does not transfer." });
6091
+ }
6092
+ const kept = ["topics", "messageExamples", "postExamples", "templates", "username", "characterId"].filter((k) => x[k] !== void 0);
6093
+ if (kept.length) notes.push({ level: "info", category: "identity", message: `Kept in the package for ElizaOS round trips, not applied on other platforms: ${kept.join(", ")}.` });
6094
+ if (doc.integrations.length) notes.push({ level: "info", category: "integrations", message: "ElizaOS plugins are listed by name; their code and installs do not move." });
6095
+ notes.push({ level: "info", category: "memory", message: "ElizaOS runtime memory and conversations live in its database and are not migrated." });
6096
+ doc.extensions[X] = x;
6097
+ doc.source.location = path;
6098
+ return doc;
6099
+ }
6100
+ async function locate(root, nativeId) {
6101
+ const files = await characterFiles(root);
6102
+ const hit = files.find((f) => f.id === nativeId);
6103
+ if (!hit) throw new NomadError(`No ElizaOS character "${nativeId}" in ${root}.`, "not-found");
6104
+ return hit.path;
6105
+ }
6106
+ function isObject(v) {
6107
+ return !!v && typeof v === "object" && !Array.isArray(v);
6108
+ }
6109
+ function documentToCharacter(doc, mcpServers) {
6110
+ const x = isObject(doc.extensions[X]) ? doc.extensions[X] : {};
6111
+ const restoredStyle = isObject(x.style) ? x.style : void 0;
6112
+ const sys = [];
6113
+ const styleFromDoc = {};
6114
+ for (const i of doc.instructions) {
6115
+ if (i.kind === "system") sys.unshift(i.content);
6116
+ else if (i.kind === "conventions" && /^Style \((all|chat|post)\)$/.test(i.title ?? "")) {
6117
+ const k = /\((\w+)\)/.exec(i.title)[1];
6118
+ styleFromDoc[k] = i.content.split("\n").map((l) => l.replace(/^[-*]\s+/, "")).filter(Boolean);
6119
+ } else sys.push(`## ${i.title ?? i.kind}
6120
+
6121
+ ${i.content}`);
6122
+ }
6123
+ const persona = doc.identity.persona ?? "";
6124
+ const bio = x.bioShape === "array" ? persona.split("\n").filter((l) => l.length) : persona;
6125
+ const adjectives = Array.isArray(x.adjectives) ? x.adjectives : doc.identity.tone ? doc.identity.tone.split(/,\s*/).filter(Boolean) : void 0;
6126
+ const plugins = doc.integrations.filter((i) => i.kind === "elizaos-plugin").map((i) => i.name);
6127
+ const shared = (k) => typeof k.shared === "boolean" ? { shared: k.shared } : {};
6128
+ const knowledge = [...doc.memory.map((m) => m.content.replace(/^[-*]\s+/, "")), ...doc.knowledge.map((k) => k.directory === true ? { directory: k.path, ...shared(k) } : { path: k.path, ...shared(k) })];
6129
+ const settings2 = { ...isObject(x.settings) ? x.settings : {} };
6130
+ if (Object.keys(mcpServers).length) settings2.mcp = { ...isObject(settings2.mcp) ? settings2.mcp : {}, servers: mcpServers };
6131
+ settings2.nomadAgentId = doc.id;
6132
+ const out2 = {
6133
+ name: doc.identity.name ?? doc.name,
6134
+ ...typeof x.username === "string" ? { username: x.username } : {},
6135
+ bio,
6136
+ ...sys.length ? { system: sys.join("\n\n") } : {},
6137
+ ...restoredStyle ? { style: restoredStyle } : Object.keys(styleFromDoc).length ? { style: styleFromDoc } : {},
6138
+ ...adjectives?.length ? { adjectives } : {},
6139
+ ...Array.isArray(x.topics) ? { topics: x.topics } : {},
6140
+ ...x.messageExamples !== void 0 ? { messageExamples: x.messageExamples } : {},
6141
+ ...x.postExamples !== void 0 ? { postExamples: x.postExamples } : {},
6142
+ ...isObject(x.templates) ? { templates: x.templates } : {},
6143
+ ...knowledge.length ? { knowledge } : {},
6144
+ ...isObject(x.unknown) ? x.unknown : {},
6145
+ plugins,
6146
+ settings: settings2
6147
+ };
6148
+ return out2;
6149
+ }
6150
+ function hasSecretsKey(v) {
6151
+ if (Array.isArray(v)) return v.some(hasSecretsKey);
6152
+ if (!isObject(v)) return false;
6153
+ return Object.entries(v).some(([k, c2]) => k === "secrets" || hasSecretsKey(c2));
6154
+ }
6155
+ var P5, X, MAX_BYTES, MAX_EXAMPLES_BYTES, PRIORS_OWNER, KNOWN_KEYS, STYLE_KEYS, PROVIDERS, bytes, elizaosAdapter;
6156
+ var init_elizaos = __esm({
6157
+ "../../packages/adapters/src/elizaos.ts"() {
6158
+ "use strict";
6159
+ init_src2();
6160
+ init_node();
6161
+ init_src3();
6162
+ init_catalog();
6163
+ init_elizaos_known_plugins();
6164
+ init_known_servers();
6165
+ init_util();
6166
+ P5 = "elizaos";
6167
+ X = "x-elizaos";
6168
+ MAX_BYTES = 1024 * 1024;
6169
+ MAX_EXAMPLES_BYTES = 256 * 1024;
6170
+ PRIORS_OWNER = "PRIORS_OWNER_ENTITY_IDS";
6171
+ KNOWN_KEYS = /* @__PURE__ */ new Set(["name", "username", "id", "bio", "system", "style", "adjectives", "topics", "messageExamples", "postExamples", "templates", "knowledge", "plugins", "settings", "secrets", "modelProvider", "nomadAgentId"]);
6172
+ STYLE_KEYS = ["all", "chat", "post"];
6173
+ PROVIDERS = { anthropic: "anthropic", openai: "openai", openrouter: "openrouter", google: "google", groq: "groq", ollama: "ollama" };
6174
+ bytes = (v) => Buffer.byteLength(JSON.stringify(v ?? null));
6175
+ elizaosAdapter = {
6176
+ info: ELIZAOS_INFO,
6177
+ async detect(root) {
6178
+ const evidence = [];
6179
+ const files = await characterFiles(root);
6180
+ if (files.length) evidence.push(`${files.length} character file(s)`);
6181
+ const pkg = await readTextIfExists(join8(root, "package.json"));
6182
+ if (pkg && /"@elizaos\/(core|cli)"/.test(pkg)) evidence.push("package.json depends on @elizaos");
6183
+ const ts = await typescriptCharacters(root);
6184
+ if (ts.length) evidence.push(`TypeScript character: ${ts.join(", ")}`);
6185
+ const detected = files.length > 0 || evidence.some((e) => e.startsWith("package.json"));
6186
+ return { detected, confidence: files.length && evidence.length > 1 ? 0.9 : detected ? 0.6 : 0, evidence };
6187
+ },
6188
+ async discover(root) {
6189
+ const refs = [];
6190
+ for (const f of await characterFiles(root)) {
6191
+ let name = f.id;
6192
+ try {
6193
+ const st = await fsp4.lstat(f.path);
6194
+ if (!st.isSymbolicLink() && st.size <= MAX_BYTES) {
6195
+ const j = JSON.parse(await fsp4.readFile(f.path, "utf8"));
6196
+ if (typeof j?.name === "string") name = j.name;
6197
+ }
6198
+ } catch {
6199
+ }
6200
+ refs.push({ nativeId: f.id, name, location: f.path, kind: "main" });
6201
+ }
6202
+ return refs;
6203
+ },
6204
+ async read(root, nativeId) {
6205
+ const notes = [];
6206
+ const path = await locate(root, nativeId);
6207
+ const st = await fsp4.lstat(path);
6208
+ if (st.isSymbolicLink()) throw new NomadError(`${basename6(path)} is a symlink. Nomad does not follow it.`, "unsafe-path");
6209
+ if (st.size > MAX_BYTES) throw new NomadError(`${basename6(path)} is larger than 1 MB.`, "too-large");
6210
+ const text3 = await readTextIfExists(path);
6211
+ if (text3 === null) throw new NomadError(`${basename6(path)} could not be read.`, "not-found");
6212
+ let parsed;
6213
+ try {
6214
+ parsed = parseCharacter(text3);
6215
+ } catch (e) {
6216
+ const at2 = /position (\d+)/.exec(e.message)?.[1];
6217
+ throw new NomadError(`${basename6(path)} is not valid JSON${at2 ? ` (near character ${at2})` : ""}.`, "invalid-character");
6218
+ }
6219
+ const projectRoot = /\.json$/i.test(root) ? dirname3(root) : root;
6220
+ for (const ts of await typescriptCharacters(projectRoot)) notes.push({ level: "info", category: "identity", message: `TypeScript character found (${ts}), not imported. Nomad never runs your code.` });
6221
+ const doc = characterToDocument(parsed.character, parsed.secretNames, path, notes);
6222
+ doc.source.nativeId = nativeId;
6223
+ return { doc, sourceFiles: [path], notes };
6224
+ },
6225
+ async plan(doc, ctx) {
6226
+ const notes = [];
6227
+ const manualSteps = [];
6228
+ const conversions = [];
6229
+ const unsupported = [];
6230
+ const dir = "characters";
6231
+ let slug = ctx.targetNativeId ?? safeName2((ctx.mode === "copy" && ctx.targetName ? ctx.targetName : doc.name).toLowerCase());
6232
+ if (ctx.mode === "copy") {
6233
+ let i = 2;
6234
+ const base = slug;
6235
+ while (await pathExists(join8(ctx.root, dir, `${slug}.json`))) slug = `${base}-${i++}`;
6236
+ }
6237
+ const target = `${dir}/${slug}.json`;
6238
+ const existing = await readTextIfExists(join8(ctx.root, target));
6239
+ const tools = wants(ctx, "tools") ? doc.tools.filter((t) => t.kind === "mcp" && t.mcp) : [];
6240
+ const r = mcpServersFromTools(tools, { platformName: "ElizaOS", envRefStyle: "none" });
6241
+ const servers = {};
6242
+ for (const [name, s] of Object.entries(r.servers)) {
6243
+ servers[name] = s.url ? { type: "streamable-http", url: s.url } : { type: "stdio", command: s.command, ...s.args ? { args: s.args } : {}, ...s.env ? { env: s.env } : {} };
6244
+ }
6245
+ manualSteps.push(...r.manualSteps);
6246
+ unsupported.push(...r.unsupported);
6247
+ notes.push(...r.notes);
6248
+ for (const t of doc.tools.filter((t2) => t2.kind !== "mcp")) unsupported.push({ category: "tools", item: t.name, reason: "Only MCP servers can be written to an ElizaOS character." });
6249
+ if (Object.keys(servers).length) {
6250
+ manualSteps.push(`Add the ElizaOS MCP plugin "@elizaos/plugin-mcp" to the character's plugins and install it. Nomad does not add plugins.`);
6251
+ conversions.push({ category: "tools", item: `${Object.keys(servers).length} MCP server(s)`, from: "MCP servers", to: "settings.mcp.servers" });
6252
+ }
6253
+ const priors = tools.some((t) => knownServerId(t) === "priors") || doc.integrations.some((i) => i.name === "@priors/plugin-elizaos");
6254
+ if (priors) {
6255
+ manualSteps.push("Priors' documentation warns that ElizaOS keeps a character's settings in its database in plain text and returns them from its agents API. Put only a key file path in PRIORS_KEY_FILE, never the key itself.");
6256
+ }
6257
+ manualSteps.push("Set secrets in your own ElizaOS environment. Nomad never writes them into the character.");
6258
+ const docForWrite = {
6259
+ ...doc,
6260
+ instructions: wants(ctx, "instructions") ? doc.instructions : [],
6261
+ memory: wants(ctx, "memory") ? doc.memory : [],
6262
+ knowledge: wants(ctx, "knowledge") ? doc.knowledge : [],
6263
+ integrations: wants(ctx, "integrations") ? doc.integrations : []
6264
+ };
6265
+ const character = documentToCharacter(docForWrite, servers);
6266
+ const folded = doc.instructions.filter((i) => i.kind !== "system" && !/^Style \((all|chat|post)\)$/.test(i.title ?? ""));
6267
+ if (folded.length && wants(ctx, "instructions")) conversions.push({ category: "instructions", item: `${folded.length} section(s)`, from: "instructions", to: "system (with headings)" });
6268
+ if (doc.memory.length && wants(ctx, "memory")) conversions.push({ category: "memory", item: `${doc.memory.length} entries`, from: "memory", to: "knowledge strings" });
6269
+ for (const k of doc.knowledge) manualSteps.push(`Copy the knowledge file ${k.path} into the ElizaOS project if it is not there.`);
6270
+ for (const i of doc.integrations.filter((x2) => x2.kind !== "elizaos-plugin")) manualSteps.push(`${i.name} was set up on the source. Find or install an ElizaOS plugin for it; Nomad never installs plugins.`);
6271
+ for (const p of doc.integrations.filter((x2) => x2.kind === "elizaos-plugin" && (x2.name.startsWith(".") || x2.name.startsWith("/")))) {
6272
+ notes.push({ level: "warning", category: "integrations", message: `Plugin ${p.name} is a local path on the source machine.` });
6273
+ }
6274
+ const x = isObject(doc.extensions[X]) ? doc.extensions[X] : {};
6275
+ if (Array.isArray(x.secretNames) && x.secretNames.length) manualSteps.push(`Set again in ElizaOS: ${x.secretNames.join(", ")}. ${x.secretNames.some((n) => n.endsWith(PRIORS_OWNER)) ? "Set PRIORS_OWNER_ENTITY_IDS to your own entity ids; never * unless you mean anyone." : ""}`.trim());
6276
+ if (wants(ctx, "skills")) for (const s of doc.skills) unsupported.push({ category: "skills", item: s.name, reason: "ElizaOS characters have no skills.", alternative: "Skill instructions are in the package and the report." });
6277
+ if (wants(ctx, "workflows")) for (const w of doc.workflows) unsupported.push({ category: "workflows", item: w.name, reason: "ElizaOS characters have no scheduler." });
6278
+ if (wants(ctx, "permissions") && doc.permissions.rules.length) unsupported.push({ category: "permissions", item: `${doc.permissions.rules.length} rule(s)`, reason: "ElizaOS characters have no permission rules." });
6279
+ if (wants(ctx, "models") && doc.models.preferred) manualSteps.push(`Choose ${doc.models.preferred} (or the closest model) through a model plugin in ElizaOS.`);
6280
+ const strategy = existing !== null && ctx.mode === "merge" ? "merge-json" : "replace";
6281
+ const files = [{ path: target, content: JSON.stringify(character, null, 2) + "\n", strategy, agentOwned: true, component: "identity", description: `ElizaOS character ${target}` }];
6282
+ return { nativeId: slug, files, notes, manualSteps, conversions, unsupported };
6283
+ },
6284
+ async verify(doc, root, nativeId, ctx) {
6285
+ const checks = [];
6286
+ const path = join8(root, "characters", `${nativeId}.json`);
6287
+ const text3 = await readTextIfExists(path);
6288
+ if (text3 === null) return [{ name: "Character file written", ok: false, detail: "File is missing" }];
6289
+ let raw;
6290
+ try {
6291
+ raw = JSON.parse(text3);
6292
+ } catch {
6293
+ return [{ name: "Character file parses", ok: false }];
6294
+ }
6295
+ checks.push({ name: "No secrets in the character", ok: !hasSecretsKey(raw) });
6296
+ const notes = [];
6297
+ const got = characterToDocument(parseCharacter(text3).character, [], path, notes);
6298
+ checks.push({ name: "Name kept", ok: got.name === (doc.identity.name ?? doc.name) });
6299
+ if (wants(ctx, "identity") && doc.identity.persona) checks.push({ name: "Bio kept", ok: (got.identity.persona ?? "").replace(/\n/g, "") === doc.identity.persona.replace(/\n/g, "") });
6300
+ const sys = doc.instructions.find((i) => i.kind === "system");
6301
+ if (sys && wants(ctx, "instructions")) checks.push({ name: "System prompt kept", ok: (got.instructions.find((i) => i.kind === "system")?.content ?? "").includes(sys.content) });
6302
+ const plugins = doc.integrations.filter((i) => i.kind === "elizaos-plugin").map((i) => i.name);
6303
+ if (wants(ctx, "integrations")) checks.push({ name: "Plugins kept in order", ok: JSON.stringify(got.integrations.map((i) => i.name)) === JSON.stringify(plugins) });
6304
+ if (wants(ctx, "tools")) {
6305
+ const expected = doc.tools.filter((t) => t.kind === "mcp" && t.enabled !== false).map((t) => t.name);
6306
+ const names = new Set(got.tools.map((t) => t.name));
6307
+ const missing = expected.filter((n) => !names.has(n));
6308
+ checks.push({ name: "MCP servers written", ok: !missing.length, detail: missing.length ? `Missing: ${missing.join(", ")}` : void 0 });
6309
+ }
6310
+ return checks;
6311
+ }
6312
+ };
6313
+ }
6314
+ });
6315
+
5361
6316
  // ../../packages/adapters/src/file-based.ts
5362
- import { basename as basename6, join as join8 } from "path";
6317
+ import { basename as basename7, join as join9 } from "path";
5363
6318
  import { parse as parseYaml3, stringify as stringifyYaml3 } from "yaml";
5364
6319
  async function readStructured(path, format, notes) {
5365
6320
  const text3 = await readTextIfExists(path);
@@ -5400,26 +6355,27 @@ function toolsFromStyle(raw, style, platform, path) {
5400
6355
  }
5401
6356
  }
5402
6357
  function patchForStyle(tools, spec, platformName) {
5403
- const r = mcpServersFromTools(tools, { platformName, envExpansion: spec.envExpansion, urlKey: spec.urlKey });
6358
+ const r = mcpServersFromTools(tools, { platformName, envRefStyle: spec.envRefStyle ?? (spec.envExpansion ? "dollar" : "none"), urlKey: spec.urlKey });
6359
+ const extra = { unsupported: r.unsupported, notes: r.notes };
5404
6360
  switch (spec.style) {
5405
6361
  case "claude":
5406
- return { patch: { mcpServers: r.servers }, steps: r.manualSteps };
6362
+ return { patch: { mcpServers: r.servers }, steps: r.manualSteps, ...extra };
5407
6363
  case "opencode": {
5408
6364
  const mcp = {};
5409
6365
  for (const [name, s] of Object.entries(r.servers)) {
5410
6366
  mcp[name] = s.command ? { type: "local", command: [s.command, ...s.args ?? []], ...s.env ? { environment: s.env } : {}, enabled: true } : { type: "remote", url: s.url, ...s.headers ? { headers: s.headers } : {}, enabled: true };
5411
6367
  }
5412
- return { patch: { mcp }, steps: r.manualSteps };
6368
+ return { patch: { mcp }, steps: r.manualSteps, ...extra };
5413
6369
  }
5414
6370
  case "goose": {
5415
6371
  const extensions = {};
5416
6372
  for (const [name, s] of Object.entries(r.servers)) {
5417
6373
  extensions[name] = s.command ? { name, type: "stdio", cmd: s.command, args: s.args ?? [], ...s.env ? { envs: s.env } : {}, enabled: true, timeout: 300 } : { name, type: "streamable_http", uri: s.url, enabled: true, timeout: 300 };
5418
6374
  }
5419
- return { patch: { extensions }, steps: r.manualSteps };
6375
+ return { patch: { extensions }, steps: r.manualSteps, ...extra };
5420
6376
  }
5421
6377
  case "continue":
5422
- return { patch: { mcpServers: Object.entries(r.servers).map(([name, s]) => ({ name, ...s })) }, steps: r.manualSteps };
6378
+ return { patch: { mcpServers: Object.entries(r.servers).map(([name, s]) => ({ name, ...s })) }, steps: r.manualSteps, ...extra };
5423
6379
  }
5424
6380
  }
5425
6381
  function parseInstructionText(text3, kind, id, path, platform, doc, memorySection, prefer) {
@@ -5453,31 +6409,31 @@ function parseInstructionText(text3, kind, id, path, platform, doc, memorySectio
5453
6409
  else if (outside) doc.instructions.unshift({ id, kind: "custom", title: path, content: outside, source: { platform, path } });
5454
6410
  }
5455
6411
  function defineFileAdapter(spec) {
5456
- const P5 = spec.info.id;
6412
+ const P6 = spec.info.id;
5457
6413
  const name = spec.info.displayName;
5458
6414
  async function targetPath(doc, root) {
5459
6415
  const base = await spec.write.path(root);
5460
6416
  if (spec.write.kind === "block") return base;
5461
- if (base && await isFile(join8(root, base))) return base;
6417
+ if (base && await isFile(join9(root, base))) return base;
5462
6418
  return `${base}/nomad-${safeName2(slugify(doc.name))}${spec.write.ext ?? ".md"}`;
5463
6419
  }
5464
6420
  const adapter = {
5465
6421
  info: spec.info,
5466
6422
  async detect(root) {
5467
6423
  const evidence = [];
5468
- for (const f of spec.detect) if (await pathExists(join8(root, f))) evidence.push(f);
6424
+ for (const f of spec.detect) if (await pathExists(join9(root, f))) evidence.push(f);
5469
6425
  return { detected: evidence.length > 0, confidence: evidence.length ? 0.6 : 0, evidence };
5470
6426
  },
5471
6427
  async discover(root) {
5472
6428
  const d = await adapter.detect(root);
5473
6429
  const refs = [];
5474
- if (d.detected) refs.push({ nativeId: "main", name: `${name}: ${basename6(root)}`, description: d.evidence.join(", "), location: root, kind: "main" });
6430
+ if (d.detected) refs.push({ nativeId: "main", name: `${name}: ${basename7(root)}`, description: d.evidence.join(", "), location: root, kind: "main" });
5475
6431
  if (spec.agentsDir) {
5476
6432
  const dir = await spec.agentsDir(root);
5477
- for (const e of await listDir(join8(root, dir))) {
6433
+ for (const e of await listDir(join9(root, dir))) {
5478
6434
  if (!e.file || !e.name.endsWith(".md")) continue;
5479
- const fm = parseFrontmatter(await readTextIfExists(join8(root, dir, e.name)) ?? "");
5480
- refs.push({ nativeId: `agent:${e.name.replace(/\.md$/, "")}`, name: e.name.replace(/\.md$/, ""), description: typeof fm.data.description === "string" ? fm.data.description : void 0, location: join8(root, dir, e.name), kind: "subagent" });
6435
+ const fm = parseFrontmatter(await readTextIfExists(join9(root, dir, e.name)) ?? "");
6436
+ refs.push({ nativeId: `agent:${e.name.replace(/\.md$/, "")}`, name: e.name.replace(/\.md$/, ""), description: typeof fm.data.description === "string" ? fm.data.description : void 0, location: join9(root, dir, e.name), kind: "subagent" });
5481
6437
  }
5482
6438
  }
5483
6439
  return refs;
@@ -5485,50 +6441,50 @@ function defineFileAdapter(spec) {
5485
6441
  async read(root, nativeId, options = {}) {
5486
6442
  const notes = [];
5487
6443
  const sourceFiles = [];
5488
- const doc = createDocument({ name: `${name}: ${basename6(root)}`, platform: P5 });
6444
+ const doc = createDocument({ name: `${name}: ${basename7(root)}`, platform: P6 });
5489
6445
  doc.source.location = root;
5490
6446
  doc.source.nativeId = nativeId;
5491
6447
  if (nativeId.startsWith("agent:") && spec.agentsDir) {
5492
6448
  const rel = `${await spec.agentsDir(root)}/${nativeId.slice(6)}.md`;
5493
- const text3 = await readTextIfExists(join8(root, rel)) ?? "";
5494
- sourceFiles.push(join8(root, rel));
6449
+ const text3 = await readTextIfExists(join9(root, rel)) ?? "";
6450
+ sourceFiles.push(join9(root, rel));
5495
6451
  const fm = parseFrontmatter(text3);
5496
6452
  doc.name = nativeId.slice(6);
5497
6453
  doc.identity.name = doc.name;
5498
6454
  if (typeof fm.data.description === "string") doc.description = fm.data.description;
5499
6455
  if (typeof fm.data.model === "string") doc.models.preferred = fm.data.model;
5500
- doc.extensions[`x-${P5}`] = { frontmatter: fm.data };
5501
- parseInstructionText(fm.body, "system", "prompt", rel, P5, doc);
6456
+ doc.extensions[`x-${P6}`] = { frontmatter: fm.data };
6457
+ parseInstructionText(fm.body, "system", "prompt", rel, P6, doc);
5502
6458
  return { doc, sourceFiles, notes };
5503
6459
  }
5504
6460
  for (const f of await spec.instructionFiles(root)) {
5505
- const text3 = await readTextIfExists(join8(root, f.path));
6461
+ const text3 = await readTextIfExists(join9(root, f.path));
5506
6462
  if (text3 === null) continue;
5507
- sourceFiles.push(join8(root, f.path));
5508
- parseInstructionText(text3, f.kind, f.path.replace(/[^A-Za-z0-9]+/g, "-").replace(/^-|-$/g, "").toLowerCase(), f.path, P5, doc, spec.memorySection, options.agentId);
6463
+ sourceFiles.push(join9(root, f.path));
6464
+ parseInstructionText(text3, f.kind, f.path.replace(/[^A-Za-z0-9]+/g, "-").replace(/^-|-$/g, "").toLowerCase(), f.path, P6, doc, spec.memorySection, options.agentId);
5509
6465
  }
5510
6466
  for (const dir of await spec.rulesDirs?.(root) ?? []) {
5511
- if (!await isDirectory(join8(root, dir.path))) continue;
5512
- for (const e of await listDir(join8(root, dir.path))) {
6467
+ if (!await isDirectory(join9(root, dir.path))) continue;
6468
+ for (const e of await listDir(join9(root, dir.path))) {
5513
6469
  if (!e.file || !dir.exts.some((x) => e.name.endsWith(x))) continue;
5514
6470
  const rel = `${dir.path}/${e.name}`;
5515
- const text3 = await readTextIfExists(join8(root, rel));
5516
- sourceFiles.push(join8(root, rel));
6471
+ const text3 = await readTextIfExists(join9(root, rel));
6472
+ sourceFiles.push(join9(root, rel));
5517
6473
  const fm = parseFrontmatter(text3);
5518
- parseInstructionText(text3, "custom", e.name.replace(/\.[^.]+$/, ""), rel, P5, doc, void 0, options.agentId);
6474
+ parseInstructionText(text3, "custom", e.name.replace(/\.[^.]+$/, ""), rel, P6, doc, void 0, options.agentId);
5519
6475
  const last = doc.instructions[doc.instructions.length - 1];
5520
- if (last && Object.keys(fm.data).length) last[`x-${P5}`] = { frontmatter: fm.data };
6476
+ if (last && Object.keys(fm.data).length) last[`x-${P6}`] = { frontmatter: fm.data };
5521
6477
  }
5522
6478
  }
5523
6479
  if (spec.mcp) {
5524
6480
  const p = await spec.mcp.path(root);
5525
- const raw = await readStructured(join8(root, p), spec.mcp.format, notes);
6481
+ const raw = await readStructured(join9(root, p), spec.mcp.format, notes);
5526
6482
  if (raw) {
5527
- sourceFiles.push(join8(root, p));
5528
- doc.tools.push(...toolsFromStyle(raw, spec.mcp.style, P5, p));
6483
+ sourceFiles.push(join9(root, p));
6484
+ doc.tools.push(...toolsFromStyle(raw, spec.mcp.style, P6, p));
5529
6485
  }
5530
6486
  }
5531
- if (spec.skillsDir) doc.skills.push(...await readSkillsTree(join8(root, await spec.skillsDir(root)), P5, notes, 2));
6487
+ if (spec.skillsDir) doc.skills.push(...await readSkillsTree(join9(root, await spec.skillsDir(root)), P6, notes, 2));
5532
6488
  return { doc, sourceFiles, notes };
5533
6489
  },
5534
6490
  async plan(doc, ctx) {
@@ -5542,7 +6498,7 @@ function defineFileAdapter(spec) {
5542
6498
  if ((ctx.mode === "copy" || ctx.targetNativeId?.startsWith("agent:")) && spec.agentsDir) {
5543
6499
  const stem = ctx.mode === "copy" ? safeName2(slugify(ctx.targetName ?? doc.name)) : ctx.targetNativeId.slice(6);
5544
6500
  nativeId = `agent:${stem}`;
5545
- const ext = doc.extensions[`x-${P5}`]?.frontmatter ?? {};
6501
+ const ext = doc.extensions[`x-${P6}`]?.frontmatter ?? {};
5546
6502
  files.push({ path: `${await spec.agentsDir(ctx.root)}/${stem}.md`, content: stringifyFrontmatter({ description: doc.description ?? doc.identity.description ?? doc.name, mode: "subagent", ...ext }, `<!-- nomad:agent=${doc.id} -->
5547
6503
  ` + body2), strategy: "replace", component: "instructions", description: `Agent definition ${stem}`, agentOwned: true });
5548
6504
  } else if (ctx.mode === "copy" && spec.write.kind === "block") {
@@ -5550,7 +6506,7 @@ function defineFileAdapter(spec) {
5550
6506
  return { nativeId, files: [], notes, manualSteps, conversions, unsupported };
5551
6507
  } else {
5552
6508
  const path = await targetPath(doc, ctx.root);
5553
- if (spec.write.kind === "rule-file" && !await isFile(join8(ctx.root, await spec.write.path(ctx.root)))) {
6509
+ if (spec.write.kind === "rule-file" && !await isFile(join9(ctx.root, await spec.write.path(ctx.root)))) {
5554
6510
  const fm = spec.write.frontmatter?.(doc) ?? {};
5555
6511
  files.push({ path, content: stringifyFrontmatter(fm, `<!-- nomad:agent=${doc.id} -->
5556
6512
  ` + body2), strategy: "replace", component: "instructions", description: `Rules file for ${doc.name}`, agentOwned: true });
@@ -5576,7 +6532,9 @@ function defineFileAdapter(spec) {
5576
6532
  const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp);
5577
6533
  if (spec.mcp?.writable && mcpTools.length && !nativeId.startsWith("agent:")) {
5578
6534
  const p = await spec.mcp.path(ctx.root);
5579
- const { patch, steps } = patchForStyle(mcpTools, spec.mcp, name);
6535
+ const { patch, steps, unsupported: skipped2, notes: mcpNotes } = patchForStyle(mcpTools, spec.mcp, name);
6536
+ unsupported.push(...skipped2);
6537
+ notes.push(...mcpNotes);
5580
6538
  files.push({ path: p, content: spec.mcp.format === "json" ? JSON.stringify(patch, null, 2) + "\n" : stringifyYaml3(patch), strategy: spec.mcp.format === "json" ? "merge-json" : "merge-yaml", arrayKeys: spec.mcp.style === "continue" ? { mcpServers: "name" } : void 0, component: "tools", description: `${mcpTools.length} MCP server(s) in ${p}` });
5581
6539
  manualSteps.push(...steps);
5582
6540
  } else {
@@ -5593,9 +6551,9 @@ function defineFileAdapter(spec) {
5593
6551
  for (const w of doc.workflows) unsupported.push({ category: "workflows", item: w.name, reason: `${name} has no scheduler.` });
5594
6552
  manualSteps.push(...workflowManualSteps(doc, name));
5595
6553
  }
5596
- if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(`Reconnect ${i.name} in ${name}.`);
6554
+ if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(integrationStep(i, name, `Reconnect ${i.name} in ${name}.`));
5597
6555
  if (wants(ctx, "knowledge") && (doc.knowledge.length || doc.files.length)) manualSteps.push(`Copy ${doc.knowledge.length + doc.files.length} knowledge file(s) into the project.`);
5598
- notes.push({ level: "info", message: `${name} support is experimental. Open the project in ${name} after migrating to confirm the rules load.` });
6556
+ notes.push({ level: "info", message: `Open the project in ${name} after migrating to confirm the rules load.` });
5599
6557
  return { nativeId, files, notes, manualSteps, conversions, unsupported };
5600
6558
  },
5601
6559
  async verify(doc, root, nativeId, ctx) {
@@ -5613,7 +6571,7 @@ function defineFileAdapter(spec) {
5613
6571
  }
5614
6572
  if (spec.mcp?.writable && wants(ctx, "tools") && doc.tools.some((t) => t.kind === "mcp") && !nativeId.startsWith("agent:")) {
5615
6573
  const names = new Set(got.tools.map((t) => t.name));
5616
- const missing = doc.tools.filter((t) => t.kind === "mcp" && !names.has(t.name));
6574
+ const missing = doc.tools.filter((t) => t.kind === "mcp" && t.enabled !== false && !pluginOf(t, this.info.id) && !names.has(t.name));
5617
6575
  checks.push({ name: "MCP servers configured", ok: !missing.length, detail: missing.length ? `Missing: ${missing.map((t) => t.name).join(", ")}` : void 0 });
5618
6576
  }
5619
6577
  return checks;
@@ -5630,7 +6588,7 @@ var init_file_based = __esm({
5630
6588
  init_catalog();
5631
6589
  init_util();
5632
6590
  at = (p) => async () => p;
5633
- isHomeDir = (root, name) => basename6(root) === name;
6591
+ isHomeDir = (root, name) => basename7(root) === name;
5634
6592
  cursorAdapter = defineFileAdapter({
5635
6593
  info: CURSOR_INFO,
5636
6594
  detect: [".cursor", ".cursorrules"],
@@ -5640,7 +6598,7 @@ var init_file_based = __esm({
5640
6598
  ],
5641
6599
  rulesDirs: async () => [{ path: ".cursor/rules", exts: [".mdc", ".md"] }],
5642
6600
  write: { kind: "rule-file", path: at(".cursor/rules"), ext: ".mdc", frontmatter: (doc) => ({ description: doc.description ?? `${doc.name} agent instructions (Nomad)`, alwaysApply: true }) },
5643
- mcp: { path: at(".cursor/mcp.json"), format: "json", style: "claude", writable: true, envExpansion: true }
6601
+ mcp: { path: at(".cursor/mcp.json"), format: "json", style: "claude", writable: true, envExpansion: true, envRefStyle: "env-prefix" }
5644
6602
  });
5645
6603
  windsurfAdapter = defineFileAdapter({
5646
6604
  info: WINDSURF_INFO,
@@ -5652,7 +6610,7 @@ var init_file_based = __esm({
5652
6610
  clineAdapter = defineFileAdapter({
5653
6611
  info: CLINE_INFO,
5654
6612
  detect: [".clinerules"],
5655
- instructionFiles: async (root) => await isFile(join8(root, ".clinerules")) ? [{ path: ".clinerules", kind: "custom" }] : [],
6613
+ instructionFiles: async (root) => await isFile(join9(root, ".clinerules")) ? [{ path: ".clinerules", kind: "custom" }] : [],
5656
6614
  rulesDirs: async () => [{ path: ".clinerules", exts: [".md", ".txt"] }],
5657
6615
  write: { kind: "rule-file", path: at(".clinerules"), ext: ".md" }
5658
6616
  });
@@ -5976,7 +6934,7 @@ for item in ${JSON.stringify(memoryLines(doc).filter(Boolean))}:
5976
6934
  });
5977
6935
 
5978
6936
  // ../../packages/adapters/src/registry.ts
5979
- import { join as join9 } from "path";
6937
+ import { join as join10 } from "path";
5980
6938
  function registerAdapter(adapter) {
5981
6939
  if (!/^[a-z0-9][a-z0-9-]*$/.test(adapter.info.id)) throw new Error(`Invalid adapter id "${adapter.info.id}"`);
5982
6940
  registry.set(adapter.info.id, adapter);
@@ -6034,10 +6992,11 @@ var init_registry = __esm({
6034
6992
  init_codex();
6035
6993
  init_openclaw();
6036
6994
  init_hermes();
6995
+ init_elizaos();
6037
6996
  init_file_based();
6038
6997
  init_guided();
6039
6998
  registry = /* @__PURE__ */ new Map();
6040
- for (const a of [openclawAdapter, claudeCodeAdapter, codexAdapter, hermesAdapter, genericAdapter, ...FILE_ADAPTERS, ...GUIDED_ADAPTERS]) registerAdapter(a);
6999
+ for (const a of [openclawAdapter, claudeCodeAdapter, codexAdapter, hermesAdapter, genericAdapter, elizaosAdapter, ...FILE_ADAPTERS, ...GUIDED_ADAPTERS]) registerAdapter(a);
6041
7000
  }
6042
7001
  });
6043
7002
 
@@ -6051,6 +7010,7 @@ __export(src_exports2, {
6051
7010
  CODEX_INFO: () => CODEX_INFO,
6052
7011
  CONTINUE_INFO: () => CONTINUE_INFO,
6053
7012
  CURSOR_INFO: () => CURSOR_INFO,
7013
+ ELIZAOS_INFO: () => ELIZAOS_INFO,
6054
7014
  FILE_ADAPTERS: () => FILE_ADAPTERS,
6055
7015
  GEMINI_CLI_INFO: () => GEMINI_CLI_INFO,
6056
7016
  GENERIC_INFO: () => GENERIC_INFO,
@@ -6059,13 +7019,16 @@ __export(src_exports2, {
6059
7019
  GUIDED_INFOS: () => GUIDED_INFOS,
6060
7020
  HERMES_DELIMITER: () => HERMES_DELIMITER,
6061
7021
  HERMES_INFO: () => HERMES_INFO,
7022
+ KNOWN_ELIZAOS_PLUGINS: () => KNOWN_ELIZAOS_PLUGINS,
6062
7023
  OPENCLAW_INFO: () => OPENCLAW_INFO,
6063
7024
  OPENCODE_INFO: () => OPENCODE_INFO,
6064
7025
  ROO_INFO: () => ROO_INFO,
6065
7026
  WINDSURF_INFO: () => WINDSURF_INFO,
6066
7027
  adapterInfos: () => adapterInfos,
7028
+ applyKnownServerProfile: () => applyKnownServerProfile,
6067
7029
  bareModel: () => bareModel,
6068
7030
  blanketEffect: () => blanketEffect,
7031
+ characterToDocument: () => characterToDocument,
6069
7032
  claudeCodeAdapter: () => claudeCodeAdapter,
6070
7033
  codexAdapter: () => codexAdapter,
6071
7034
  codexSettingsFromPolicy: () => codexSettingsFromPolicy,
@@ -6074,23 +7037,32 @@ __export(src_exports2, {
6074
7037
  demoteHeadings: () => demoteHeadings,
6075
7038
  describeTrigger: () => describeTrigger,
6076
7039
  detectAdapterFor: () => detectAdapterFor,
7040
+ documentToCharacter: () => documentToCharacter,
7041
+ elizaosAdapter: () => elizaosAdapter,
7042
+ elizaosPluginHint: () => elizaosPluginHint,
6077
7043
  filesHash: () => filesHash,
6078
7044
  findAdapter: () => findAdapter,
6079
7045
  genericAdapter: () => genericAdapter,
6080
7046
  getAdapter: () => getAdapter,
7047
+ hasSecretsKey: () => hasSecretsKey,
6081
7048
  hermesAdapter: () => hermesAdapter,
6082
7049
  infoById: () => infoById,
6083
7050
  instructionsText: () => instructionsText,
6084
- join: () => join9,
7051
+ integrationStep: () => integrationStep,
7052
+ join: () => join10,
7053
+ knownElizaosPlugin: () => knownElizaosPlugin,
7054
+ knownServerId: () => knownServerId,
6085
7055
  listAdapters: () => listAdapters,
6086
7056
  mcpServersFromTools: () => mcpServersFromTools,
6087
7057
  modelFamily: () => modelFamily,
6088
7058
  nomadBlockKey: () => nomadBlockKey,
6089
7059
  openclawAdapter: () => openclawAdapter,
6090
7060
  parseAgentMarkdown: () => parseAgentMarkdown,
7061
+ parseCharacter: () => parseCharacter,
6091
7062
  parseMemoryMarkdown: () => parseMemoryMarkdown,
6092
7063
  parseMixedMemory: () => parseMixedMemory,
6093
7064
  plainEntry: () => plainEntry,
7065
+ pluginOf: () => pluginOf,
6094
7066
  policyFromCodexConfig: () => policyFromCodexConfig,
6095
7067
  policyFromSettings: () => policyFromSettings,
6096
7068
  qualifiedModel: () => qualifiedModel,
@@ -6124,6 +7096,9 @@ var init_src6 = __esm({
6124
7096
  init_hermes();
6125
7097
  init_file_based();
6126
7098
  init_guided();
7099
+ init_elizaos();
7100
+ init_elizaos_known_plugins();
7101
+ init_known_servers();
6127
7102
  }
6128
7103
  });
6129
7104
 
@@ -6253,7 +7228,7 @@ import Database from "better-sqlite3";
6253
7228
  import { drizzle } from "drizzle-orm/better-sqlite3";
6254
7229
  import { and, desc, eq } from "drizzle-orm";
6255
7230
  import { mkdirSync, readFileSync, writeFileSync, existsSync as existsSync2, chmodSync } from "fs";
6256
- import { join as join10 } from "path";
7231
+ import { join as join11 } from "path";
6257
7232
  var SCHEMA_VERSION, NomadStore;
6258
7233
  var init_src7 = __esm({
6259
7234
  "../../packages/storage/src/index.ts"() {
@@ -6275,8 +7250,8 @@ var init_src7 = __esm({
6275
7250
  db;
6276
7251
  static open(home2 = nomadHome()) {
6277
7252
  mkdirSync(home2, { recursive: true, mode: 448 });
6278
- for (const d of ["objects", "backups", "exports"]) mkdirSync(join10(home2, d), { recursive: true, mode: 448 });
6279
- const dbPath = join10(home2, "nomad.db");
7253
+ for (const d of ["objects", "backups", "exports"]) mkdirSync(join11(home2, d), { recursive: true, mode: 448 });
7254
+ const dbPath = join11(home2, "nomad.db");
6280
7255
  const sqlite = new Database(dbPath);
6281
7256
  try {
6282
7257
  chmodSync(dbPath, 384);
@@ -6297,13 +7272,13 @@ var init_src7 = __esm({
6297
7272
  }
6298
7273
  /* ----------------------------- objects ----------------------------- */
6299
7274
  objectPath(hash) {
6300
- return join10(this.home, "objects", hash.slice(0, 2), `${hash}.json`);
7275
+ return join11(this.home, "objects", hash.slice(0, 2), `${hash}.json`);
6301
7276
  }
6302
7277
  putObject(doc) {
6303
7278
  const hash = documentHash(doc);
6304
7279
  const p = this.objectPath(hash);
6305
7280
  if (!existsSync2(p)) {
6306
- mkdirSync(join10(this.home, "objects", hash.slice(0, 2)), { recursive: true, mode: 448 });
7281
+ mkdirSync(join11(this.home, "objects", hash.slice(0, 2)), { recursive: true, mode: 448 });
6307
7282
  writeFileSync(p, JSON.stringify(doc), { mode: 384 });
6308
7283
  }
6309
7284
  return hash;
@@ -6443,17 +7418,17 @@ var init_src7 = __esm({
6443
7418
  });
6444
7419
 
6445
7420
  // ../../packages/migration/src/ops.ts
6446
- import { promises as fsp4 } from "fs";
6447
- import { dirname as dirname3, join as join11, relative as relative3 } from "path";
7421
+ import { promises as fsp5 } from "fs";
7422
+ import { dirname as dirname4, join as join12, relative as relative3 } from "path";
6448
7423
  import JSON52 from "json5";
6449
7424
  import { parse as parseToml2, stringify as stringifyToml2 } from "smol-toml";
6450
7425
  import { parseDocument as parseYamlDocument, isMap } from "yaml";
6451
7426
  import { createTwoFilesPatch } from "diff";
6452
7427
  async function readExisting(abs) {
6453
7428
  try {
6454
- const st = await fsp4.lstat(abs);
7429
+ const st = await fsp5.lstat(abs);
6455
7430
  if (!st.isFile()) throw new UnsafePathError(`${abs} exists and is not a regular file`);
6456
- return new Uint8Array(await fsp4.readFile(abs));
7431
+ return new Uint8Array(await fsp5.readFile(abs));
6457
7432
  } catch (e) {
6458
7433
  const code = e.code;
6459
7434
  if (code === "ENOENT" || code === "ENOTDIR") return null;
@@ -6663,24 +7638,24 @@ async function applyOperations(ops) {
6663
7638
  const current2 = await readExisting(op.abs);
6664
7639
  const currentHash = current2 ? sha256(current2) : null;
6665
7640
  if (currentHash !== op.beforeHash) throw new Error(`${op.display} changed after the preview was created. Preview the migration again.`);
6666
- let d = dirname3(op.abs);
7641
+ let d = dirname4(op.abs);
6667
7642
  const toCreate = [];
6668
7643
  for (; ; ) {
6669
7644
  try {
6670
- await fsp4.lstat(d);
7645
+ await fsp5.lstat(d);
6671
7646
  break;
6672
7647
  } catch {
6673
7648
  toCreate.unshift(d);
6674
- if (d === dirname3(d)) break;
6675
- d = dirname3(d);
7649
+ if (d === dirname4(d)) break;
7650
+ d = dirname4(d);
6676
7651
  }
6677
7652
  }
6678
7653
  for (const dir of toCreate) {
6679
- await fsp4.mkdir(dir);
7654
+ await fsp5.mkdir(dir);
6680
7655
  createdDirs.push(dir);
6681
7656
  }
6682
7657
  let mode = op.mode;
6683
- if (current2) mode = (await fsp4.stat(op.abs)).mode & 511;
7658
+ if (current2) mode = (await fsp5.stat(op.abs)).mode & 511;
6684
7659
  await atomicWrite(op.abs, op.after, mode);
6685
7660
  done.push(op);
6686
7661
  }
@@ -6694,13 +7669,13 @@ async function rollback(done, createdDirs) {
6694
7669
  for (const op of [...done].reverse()) {
6695
7670
  try {
6696
7671
  if (op.before) await atomicWrite(op.abs, op.before);
6697
- else await fsp4.rm(op.abs, { force: true });
7672
+ else await fsp5.rm(op.abs, { force: true });
6698
7673
  } catch {
6699
7674
  }
6700
7675
  }
6701
7676
  for (const dir of [...createdDirs].reverse()) {
6702
7677
  try {
6703
- await fsp4.rmdir(dir);
7678
+ await fsp5.rmdir(dir);
6704
7679
  } catch {
6705
7680
  }
6706
7681
  }
@@ -6717,25 +7692,26 @@ var init_ops = __esm({
6717
7692
  });
6718
7693
 
6719
7694
  // ../../packages/migration/src/backup.ts
6720
- import { promises as fsp5 } from "fs";
6721
- import { join as join12 } from "path";
7695
+ import { promises as fsp6 } from "fs";
7696
+ import { join as join13 } from "path";
6722
7697
  import { createTwoFilesPatch as createTwoFilesPatch2 } from "diff";
6723
7698
  async function createBackup(store, files, meta) {
6724
7699
  const id = shortId("bk");
6725
- const dir = join12(store.home, "backups", id);
6726
- await ensureDir(join12(dir, "files"));
7700
+ const dir = join13(store.home, "backups", id);
7701
+ await ensureDir(join13(dir, "files"));
6727
7702
  const manifest = { id, kind: meta.kind, createdAt: (/* @__PURE__ */ new Date()).toISOString(), operationId: meta.operationId ?? null, agentId: meta.agentId ?? null, description: meta.description, files: [] };
6728
7703
  let n = 0;
6729
7704
  const seen = /* @__PURE__ */ new Set();
6730
7705
  for (const f of files) {
6731
7706
  if (seen.has(f.abs)) continue;
6732
7707
  seen.add(f.abs);
7708
+ if (isKeyMaterialPath(f.abs)) continue;
6733
7709
  try {
6734
- const st = await fsp5.lstat(f.abs);
7710
+ const st = await fsp6.lstat(f.abs);
6735
7711
  if (!st.isFile()) continue;
6736
- const data = await fsp5.readFile(f.abs);
7712
+ const data = await fsp6.readFile(f.abs);
6737
7713
  const stored = `files/${String(n++).padStart(5, "0")}`;
6738
- await fsp5.writeFile(join12(dir, stored), data, { mode: 384 });
7714
+ await fsp6.writeFile(join13(dir, stored), data, { mode: 384 });
6739
7715
  manifest.files.push({ root: f.root, abs: f.abs, existed: true, sha256: sha256(new Uint8Array(data)), mode: st.mode & 511, stored });
6740
7716
  } catch (e) {
6741
7717
  const code = e.code;
@@ -6743,18 +7719,18 @@ async function createBackup(store, files, meta) {
6743
7719
  manifest.files.push({ root: f.root, abs: f.abs, existed: false, sha256: null, mode: null, stored: null });
6744
7720
  }
6745
7721
  }
6746
- await fsp5.writeFile(join12(dir, "backup.json"), JSON.stringify(manifest, null, 2), { mode: 384 });
7722
+ await fsp6.writeFile(join13(dir, "backup.json"), JSON.stringify(manifest, null, 2), { mode: 384 });
6747
7723
  store.addBackup({ id, operationId: meta.operationId, agentId: meta.agentId, kind: meta.kind, path: dir, fileCount: manifest.files.length, description: meta.description });
6748
7724
  return manifest;
6749
7725
  }
6750
7726
  async function loadBackup(store, id) {
6751
7727
  const row = store.getBackup(id);
6752
7728
  if (!row) throw new Error(`Backup ${id} not found`);
6753
- return JSON.parse(await fsp5.readFile(join12(row.path, "backup.json"), "utf8"));
7729
+ return JSON.parse(await fsp6.readFile(join13(row.path, "backup.json"), "utf8"));
6754
7730
  }
6755
7731
  async function current(abs) {
6756
7732
  try {
6757
- return new Uint8Array(await fsp5.readFile(abs));
7733
+ return new Uint8Array(await fsp6.readFile(abs));
6758
7734
  } catch {
6759
7735
  return null;
6760
7736
  }
@@ -6769,7 +7745,7 @@ async function previewRestore(store, id) {
6769
7745
  if (f.existed) {
6770
7746
  if (nowHash === f.sha256) items.push({ path: displayPath(f.abs), abs: f.abs, action: "unchanged" });
6771
7747
  else {
6772
- const saved = new Uint8Array(await fsp5.readFile(join12(row.path, f.stored)));
7748
+ const saved = new Uint8Array(await fsp6.readFile(join13(row.path, f.stored)));
6773
7749
  items.push({
6774
7750
  path: displayPath(f.abs),
6775
7751
  abs: f.abs,
@@ -6795,11 +7771,11 @@ async function restoreBackup(store, id) {
6795
7771
  const item = preview.items.find((i) => i.abs === f.abs);
6796
7772
  assertNoSymlinks(f.root, f.abs);
6797
7773
  if (item.action === "restore") {
6798
- const saved = new Uint8Array(await fsp5.readFile(join12(row.path, f.stored)));
7774
+ const saved = new Uint8Array(await fsp6.readFile(join13(row.path, f.stored)));
6799
7775
  await atomicWrite(f.abs, saved, f.mode ?? void 0);
6800
7776
  store.forgetWrite(f.abs);
6801
7777
  } else if (item.action === "delete") {
6802
- await fsp5.rm(f.abs, { force: true });
7778
+ await fsp6.rm(f.abs, { force: true });
6803
7779
  store.forgetWrite(f.abs);
6804
7780
  }
6805
7781
  }
@@ -6922,13 +7898,13 @@ var init_compare = __esm({
6922
7898
  // ../../packages/migration/src/keys.ts
6923
7899
  import { createPrivateKey, createPublicKey, generateKeyPairSync, sign, verify } from "crypto";
6924
7900
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
6925
- import { join as join13 } from "path";
7901
+ import { join as join14 } from "path";
6926
7902
  function fingerprintOf(rawKeyBase64) {
6927
7903
  return sha256(new Uint8Array(Buffer.from(rawKeyBase64, "base64"))).slice(0, 16).match(/.{4}/g).join(" ");
6928
7904
  }
6929
7905
  function keyPaths(home2) {
6930
- const dir = join13(home2, "keys");
6931
- return { dir, priv: join13(dir, "signing.pem"), pub: join13(dir, "signing.pub") };
7906
+ const dir = join14(home2, "keys");
7907
+ return { dir, priv: join14(dir, "signing.pem"), pub: join14(dir, "signing.pub") };
6932
7908
  }
6933
7909
  function signingIdentity(home2, create = true) {
6934
7910
  const p = keyPaths(home2);
@@ -6990,8 +7966,8 @@ var init_keys = __esm({
6990
7966
  });
6991
7967
 
6992
7968
  // ../../packages/migration/src/engine.ts
6993
- import { promises as fsp6, constants as constants2 } from "fs";
6994
- import { basename as basename7, dirname as dirname4, join as join14 } from "path";
7969
+ import { promises as fsp7, constants as constants2 } from "fs";
7970
+ import { basename as basename8, dirname as dirname5, join as join15 } from "path";
6995
7971
  var PLAN_TTL_MS, Nomad;
6996
7972
  var init_engine = __esm({
6997
7973
  "../../packages/migration/src/engine.ts"() {
@@ -7049,7 +8025,12 @@ var init_engine = __esm({
7049
8025
  const adapter = getAdapter(adapterId);
7050
8026
  if (!adapter.read) throw new NomadError(`${adapter.info.displayName} cannot be read by Nomad.`, "not-readable", "Guided platforms only accept agents.");
7051
8027
  const r = resolveRoot(root);
8028
+ drainSkippedKeyMaterial();
7052
8029
  const result = await adapter.read(r, nativeId, { includeFiles: options.includeFiles, includeSecrets: options.includeSecrets });
8030
+ const skippedKeys = drainSkippedKeyMaterial();
8031
+ if (skippedKeys.length) {
8032
+ 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
+ }
7053
8034
  let doc = parseDocument(result.doc);
7054
8035
  const mapped = this.store.findByLocation(adapterId, r, nativeId);
7055
8036
  if (!this.store.getAgent(doc.id) && mapped) doc = { ...doc, id: mapped.agentId };
@@ -7086,12 +8067,12 @@ var init_engine = __esm({
7086
8067
  return { doc: s.doc, notes: [], scan, sanitize: s.report, version: source.version ?? agent.currentVersion, sourceFiles: [], sourceAdapter: adapter, label: `${agent.name} v${source.version ?? agent.currentVersion} (library)` };
7087
8068
  }
7088
8069
  case "package": {
7089
- const bytes = source.bytes ?? new Uint8Array(await fsp6.readFile(source.path));
7090
- const u = unpackAgent(bytes, { includeSecrets: options.includeSecrets, verifySignature });
8070
+ const bytes2 = source.bytes ?? new Uint8Array(await fsp7.readFile(source.path));
8071
+ const u = unpackAgent(bytes2, { includeSecrets: options.includeSecrets, verifySignature });
7091
8072
  if (!u.ok || !u.doc) throw new NomadError("The package is not valid: " + u.issues.map((i) => `${i.path}: ${i.message}`).join("; "), "invalid-package");
7092
8073
  const who = this.signerOf(u);
7093
8074
  const notes = [{ level: who.state === "unknown" ? "warning" : "info", message: describeSigner(who) }, ...u.warnings.map((w) => ({ level: "warning", message: w }))];
7094
- return { doc: u.doc, notes, scan: u.scan, sanitize: u.sanitize, sourceFiles: [], sourceAdapter: null, label: source.path ? basename7(source.path) : "uploaded package", unpack: u, signer: who };
8075
+ return { doc: u.doc, notes, scan: u.scan, sanitize: u.sanitize, sourceFiles: [], sourceAdapter: null, label: source.path ? basename8(source.path) : "uploaded package", unpack: u, signer: who };
7095
8076
  }
7096
8077
  }
7097
8078
  }
@@ -7204,34 +8185,34 @@ var init_engine = __esm({
7204
8185
  const changed = ops.filter((o) => o.after && o.root === root);
7205
8186
  if (!changed.length) return adapter.readPolicy(root, nativeId);
7206
8187
  const tmp = await makeTempDir("nomad-overlay-");
7207
- const overlay = join14(tmp, basename7(root));
8188
+ const overlay = join15(tmp, basename8(root));
7208
8189
  try {
7209
- await fsp6.mkdir(overlay, { recursive: true });
8190
+ await fsp7.mkdir(overlay, { recursive: true });
7210
8191
  for (const o of ops) {
7211
8192
  if (o.root !== root) continue;
7212
8193
  const data = o.after ?? o.before;
7213
8194
  if (!data) continue;
7214
8195
  const p = safeJoin(overlay, o.rel);
7215
- await fsp6.mkdir(dirname4(p), { recursive: true });
7216
- await fsp6.writeFile(p, data);
8196
+ await fsp7.mkdir(dirname5(p), { recursive: true });
8197
+ await fsp7.writeFile(p, data);
7217
8198
  }
7218
8199
  for (const f of ["settings.json", ".claude/settings.json", "config.toml", ".codex/config.toml", "openclaw.json", "config.yaml"]) {
7219
- const src = join14(root, f);
7220
- const dst = join14(overlay, f);
8200
+ const src = join15(root, f);
8201
+ const dst = join15(overlay, f);
7221
8202
  try {
7222
- await fsp6.access(dst);
8203
+ await fsp7.access(dst);
7223
8204
  } catch {
7224
8205
  try {
7225
- const data = await fsp6.readFile(src);
7226
- await fsp6.mkdir(dirname4(dst), { recursive: true });
7227
- await fsp6.writeFile(dst, data);
8206
+ const data = await fsp7.readFile(src);
8207
+ await fsp7.mkdir(dirname5(dst), { recursive: true });
8208
+ await fsp7.writeFile(dst, data);
7228
8209
  } catch {
7229
8210
  }
7230
8211
  }
7231
8212
  }
7232
8213
  return await adapter.readPolicy(overlay, nativeId);
7233
8214
  } finally {
7234
- await fsp6.rm(tmp, { recursive: true, force: true });
8215
+ await fsp7.rm(tmp, { recursive: true, force: true });
7235
8216
  }
7236
8217
  }
7237
8218
  getPlan(id) {
@@ -7295,7 +8276,7 @@ var init_engine = __esm({
7295
8276
  const verification = [];
7296
8277
  for (const o of changing) {
7297
8278
  try {
7298
- const data = new Uint8Array(await fsp6.readFile(o.abs));
8279
+ const data = new Uint8Array(await fsp7.readFile(o.abs));
7299
8280
  if (sha256(data) !== o.afterHash) verification.push({ name: `${o.display} written`, ok: false, detail: "Content differs from what was planned" });
7300
8281
  } catch {
7301
8282
  verification.push({ name: `${o.display} written`, ok: false, detail: "File is missing" });
@@ -7333,18 +8314,18 @@ var init_engine = __esm({
7333
8314
  }
7334
8315
  }
7335
8316
  async lock() {
7336
- const path = join14(this.store.home, "migration.lock");
8317
+ const path = join15(this.store.home, "migration.lock");
7337
8318
  for (let attempt = 0; attempt < 2; attempt++) {
7338
8319
  try {
7339
- const fh = await fsp6.open(path, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY, 384);
8320
+ const fh = await fsp7.open(path, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY, 384);
7340
8321
  await fh.writeFile(String(process.pid));
7341
8322
  await fh.close();
7342
8323
  return async () => {
7343
- await fsp6.rm(path, { force: true });
8324
+ await fsp7.rm(path, { force: true });
7344
8325
  };
7345
8326
  } catch (e) {
7346
8327
  if (e.code !== "EEXIST") throw e;
7347
- const pid = Number(await fsp6.readFile(path, "utf8").catch(() => "0"));
8328
+ const pid = Number(await fsp7.readFile(path, "utf8").catch(() => "0"));
7348
8329
  let alive = false;
7349
8330
  try {
7350
8331
  if (pid) {
@@ -7355,7 +8336,7 @@ var init_engine = __esm({
7355
8336
  alive = false;
7356
8337
  }
7357
8338
  if (alive) throw new NomadError("Another Nomad operation is running.", "locked", "Wait for it to finish and try again.");
7358
- await fsp6.rm(path, { force: true });
8339
+ await fsp7.rm(path, { force: true });
7359
8340
  }
7360
8341
  }
7361
8342
  throw new NomadError("Could not acquire the operation lock.", "locked");
@@ -7375,7 +8356,7 @@ var init_engine = __esm({
7375
8356
  const ext = interchange ? INTERCHANGE_EXTENSION : PACKAGE_EXTENSION;
7376
8357
  let path = null;
7377
8358
  if (options.outPath !== void 0) {
7378
- path = /\.(nomad|agentpack|jetpack)$/.test(options.outPath) ? options.outPath : join14(options.outPath, `${doc.name.replace(/[^A-Za-z0-9._-]+/g, "-")}${ext}`);
8359
+ path = /\.(nomad|agentpack|jetpack)$/.test(options.outPath) ? options.outPath : join15(options.outPath, `${doc.name.replace(/[^A-Za-z0-9._-]+/g, "-")}${ext}`);
7379
8360
  await atomicWrite(path, pack.bytes, 384);
7380
8361
  }
7381
8362
  const receipt = {
@@ -7401,8 +8382,8 @@ var init_engine = __esm({
7401
8382
  return { ...pack, path, receipt };
7402
8383
  }
7403
8384
  /** Validate a package without importing it. */
7404
- validatePackage(bytes) {
7405
- const u = unpackAgent(bytes, { verifySignature });
8385
+ validatePackage(bytes2) {
8386
+ const u = unpackAgent(bytes2, { verifySignature });
7406
8387
  return { ...u, signer: this.signerOf(u) };
7407
8388
  }
7408
8389
  /* ------------------------------------------------------------------ */
@@ -7416,8 +8397,8 @@ var init_engine = __esm({
7416
8397
  return this.store.getSetting("trustedKeys", []);
7417
8398
  }
7418
8399
  /** Trust the key that signed a package, under a name you choose. */
7419
- trustPackageSigner(bytes, name) {
7420
- const u = unpackAgent(bytes, { verifySignature });
8400
+ trustPackageSigner(bytes2, name) {
8401
+ const u = unpackAgent(bytes2, { verifySignature });
7421
8402
  const sig = u.info?.signature;
7422
8403
  if (!sig) throw new NomadError("This package is not signed.", "unsigned");
7423
8404
  if (sig.verified !== true) throw new NomadError("The signature does not match the package, so its key cannot be trusted.", "invalid-signature");
@@ -7434,13 +8415,13 @@ var init_engine = __esm({
7434
8415
  }
7435
8416
  /** Import a package into the local library. Use plan() with a package source to also write it to a platform. */
7436
8417
  async importPackage(input) {
7437
- const bytes = input.bytes ?? new Uint8Array(await fsp6.readFile(input.path));
7438
- const u = unpackAgent(bytes, { verifySignature });
8418
+ const bytes2 = input.bytes ?? new Uint8Array(await fsp7.readFile(input.path));
8419
+ const u = unpackAgent(bytes2, { verifySignature });
7439
8420
  if (!u.ok || !u.doc) return { ok: false, issues: u.issues, warnings: u.warnings };
7440
8421
  const who = this.signerOf(u);
7441
8422
  const known = this.store.getAgent(u.doc.id);
7442
8423
  const operationId = shortId("op");
7443
- const doc = { ...u.doc, history: [...u.doc.history, { operationId, kind: "import", from: input.path ? basename7(input.path) : "package", at: (/* @__PURE__ */ new Date()).toISOString() }] };
8424
+ const doc = { ...u.doc, history: [...u.doc.history, { operationId, kind: "import", from: input.path ? basename8(input.path) : "package", at: (/* @__PURE__ */ new Date()).toISOString() }] };
7444
8425
  const saved = this.store.saveAgent(doc, { reason: "Imported package", operationId, platform: doc.source.platform });
7445
8426
  const receipt = { operationId, kind: "import", status: "success", agent: { id: doc.id, name: doc.name }, recognized: !!known, version: saved.version, warnings: u.warnings, findings: u.scan?.findings.length ?? 0, redacted: u.sanitize?.redactedText ?? 0, executableFiles: u.executableFiles, at: (/* @__PURE__ */ new Date()).toISOString() };
7446
8427
  this.store.saveOperation({ id: operationId, kind: "import", agentId: doc.id, source: input.path ?? "package", destination: "library", status: "success", createdAt: receipt.at, receipt });
@@ -7516,7 +8497,7 @@ var init_engine = __esm({
7516
8497
  if (!adapter?.read) continue;
7517
8498
  try {
7518
8499
  const r = await adapter.read(loc.root, loc.nativeId);
7519
- for (const f of r.sourceFiles) files.push({ root: dirname4(f), abs: f });
8500
+ for (const f of r.sourceFiles) files.push({ root: dirname5(f), abs: f });
7520
8501
  } catch {
7521
8502
  }
7522
8503
  }
@@ -7627,7 +8608,7 @@ __export(src_exports3, {
7627
8608
  createBackup: () => createBackup,
7628
8609
  describeSigner: () => describeSigner,
7629
8610
  fingerprintOf: () => fingerprintOf,
7630
- join: () => join11,
8611
+ join: () => join12,
7631
8612
  loadBackup: () => loadBackup,
7632
8613
  parseSource: () => parseSource,
7633
8614
  previewRestore: () => previewRestore,
@@ -7663,7 +8644,7 @@ __export(src_exports4, {
7663
8644
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
7664
8645
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7665
8646
  import { readFileSync as readFileSync4 } from "fs";
7666
- import { join as join17, resolve as resolve4 } from "path";
8647
+ import { join as join18, resolve as resolve5 } from "path";
7667
8648
  import { z as z4 } from "zod";
7668
8649
  function text2(data) {
7669
8650
  return { content: [{ type: "text", text: typeof data === "string" ? data : JSON.stringify(data, null, 2) }] };
@@ -7696,9 +8677,9 @@ function summarizePlan(p) {
7696
8677
  };
7697
8678
  }
7698
8679
  function createMcpServer(options = {}) {
7699
- const nomad = new Nomad({ home: options.home ? resolve4(options.home) : nomadHome() });
8680
+ const nomad = new Nomad({ home: options.home ? resolve5(options.home) : nomadHome() });
7700
8681
  const server = new McpServer2({ name: "nomad", version: NOMAD_VERSION });
7701
- const exportsDir = join17(nomad.store.home, "exports");
8682
+ const exportsDir = join18(nomad.store.home, "exports");
7702
8683
  server.registerTool(
7703
8684
  "list_agents",
7704
8685
  { title: "List agents", description: "Agents in the local Nomad library with their known locations.", inputSchema: {} },
@@ -7768,7 +8749,7 @@ function createMcpServer(options = {}) {
7768
8749
  { title: "Validate a package", description: "Check a .nomad, .agentpack or .jetpack package for structure, integrity and security problems.", inputSchema: { path: z4.string().describe("Path to a package file") } },
7769
8750
  async ({ path }) => {
7770
8751
  try {
7771
- const p = resolve4(expandHome(path));
8752
+ const p = resolve5(expandHome(path));
7772
8753
  if (!/\.(nomad|agentpack|jetpack)$/.test(p)) throw new NomadError("Only .nomad, .agentpack or .jetpack files can be validated.", "usage");
7773
8754
  const r = nomad.validatePackage(new Uint8Array(readFileSync4(p)));
7774
8755
  return text2({ ok: r.ok, name: r.doc?.name, issues: r.issues, warnings: r.warnings, secretsFound: r.scan?.findings.length ?? 0 });
@@ -7894,7 +8875,7 @@ import { Command, Option } from "commander";
7894
8875
  import { createInterface } from "readline/promises";
7895
8876
  import { spawn as spawn2 } from "child_process";
7896
8877
  import { existsSync as existsSync6, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
7897
- import { dirname as dirname5, join as join18, resolve as resolve5 } from "path";
8878
+ import { dirname as dirname6, join as join19, resolve as resolve6 } from "path";
7898
8879
  import { fileURLToPath } from "url";
7899
8880
  import { randomBytes as randomBytes3 } from "crypto";
7900
8881
 
@@ -8050,20 +9031,20 @@ function approvalQuestion(p) {
8050
9031
  // src/remote.ts
8051
9032
  init_src2();
8052
9033
  import { spawn } from "child_process";
8053
- import { basename as basename8 } from "path";
9034
+ import { basename as basename9 } from "path";
8054
9035
  function shellQuote(s) {
8055
9036
  if (/^[A-Za-z0-9_\/.:=@%+-]+$/.test(s)) return s;
8056
9037
  return `'${s.replace(/'/g, `'\\''`)}'`;
8057
9038
  }
8058
9039
  function run(cmd, args, input) {
8059
- return new Promise((resolve6, reject) => {
9040
+ return new Promise((resolve7, reject) => {
8060
9041
  const p = spawn(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
8061
9042
  let stdout = "";
8062
9043
  let stderr = "";
8063
9044
  p.stdout.on("data", (d) => stdout += d);
8064
9045
  p.stderr.on("data", (d) => stderr += d);
8065
9046
  p.on("error", (e) => reject(new NomadError(`${cmd} is not available: ${e.message}`, "ssh-missing", "Install OpenSSH to use remote migration.")));
8066
- p.on("close", (code) => resolve6({ code: code ?? 1, stdout, stderr }));
9047
+ p.on("close", (code) => resolve7({ code: code ?? 1, stdout, stderr }));
8067
9048
  if (input) p.stdin.end(input);
8068
9049
  else p.stdin.end();
8069
9050
  });
@@ -8086,10 +9067,10 @@ async function remoteMigrate(o, packagePath, args) {
8086
9067
  if (mk.code !== 0) explain2(mk.stderr, o.host);
8087
9068
  const dir = mk.stdout.trim();
8088
9069
  if (!/^\/[\w./-]+$/.test(dir)) throw new NomadError("Unexpected temporary directory from the remote host.", "ssh-failed");
8089
- const scpArgs = ["-o", "StrictHostKeyChecking=yes", "-o", "BatchMode=yes", ...o.port ? ["-P", String(o.port)] : [], ...o.identity ? ["-i", o.identity] : [], packagePath, `${o.host}:${dir}/${basename8(packagePath)}`];
9070
+ const scpArgs = ["-o", "StrictHostKeyChecking=yes", "-o", "BatchMode=yes", ...o.port ? ["-P", String(o.port)] : [], ...o.identity ? ["-i", o.identity] : [], packagePath, `${o.host}:${dir}/${basename9(packagePath)}`];
8090
9071
  const cp = await run("scp", scpArgs);
8091
9072
  if (cp.code !== 0) explain2(cp.stderr, o.host);
8092
- const remotePack = `${dir}/${basename8(packagePath)}`;
9073
+ const remotePack = `${dir}/${basename9(packagePath)}`;
8093
9074
  const cmd = [o.remoteCommand, "migrate", "--from", shellQuote(remotePack), "--to", shellQuote(args.to), "--dest-dir", shellQuote(args.dest), "--mode", shellQuote(args.mode), ...args.apply ? ["--yes"] : ["--dry-run"], "--json"].join(" ");
8094
9075
  const r = await run("ssh", [...sshBase(o), o.host, `${cmd}; status=$?; rm -rf ${shellQuote(dir)}; exit $status`]);
8095
9076
  if (r.code !== 0 && !r.stdout.trim()) explain2(r.stderr, o.host);
@@ -8103,12 +9084,12 @@ async function remoteMigrate(o, packagePath, args) {
8103
9084
  // src/ui.ts
8104
9085
  import { createServer } from "http";
8105
9086
  import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
8106
- import { extname, join as join16, normalize, resolve as resolve3, sep as sep3 } from "path";
9087
+ import { extname, join as join17, normalize, resolve as resolve4, sep as sep4 } from "path";
8107
9088
 
8108
9089
  // ../../packages/local/src/index.ts
8109
9090
  import { timingSafeEqual } from "crypto";
8110
9091
  import { mkdir, readFile, writeFile } from "fs/promises";
8111
- import { basename as basename9, join as join15, resolve as resolve2, sep as sep2 } from "path";
9092
+ import { basename as basename10, join as join16, resolve as resolve3, sep as sep3 } from "path";
8112
9093
  var SESSION_COOKIE = "nomad_session";
8113
9094
  var HttpError = class extends Error {
8114
9095
  constructor(status, message) {
@@ -8176,9 +9157,9 @@ function safeSource(nomadHome2, s) {
8176
9157
  }
8177
9158
  if (s.kind === "stored") return { kind: "stored", agentId: String(s.agentId), version: s.version ? Number(s.version) : void 0 };
8178
9159
  if (s.kind === "package") {
8179
- const uploads = join15(nomadHome2, "uploads");
8180
- const p = resolve2(String(s.path));
8181
- if (!p.startsWith(uploads + sep2) || !/\.(nomad|agentpack|jetpack)$/.test(p)) throw new HttpError(400, "Packages must be uploaded first.");
9160
+ const uploads = join16(nomadHome2, "uploads");
9161
+ const p = resolve3(String(s.path));
9162
+ if (!p.startsWith(uploads + sep3) || !/\.(nomad|agentpack|jetpack)$/.test(p)) throw new HttpError(400, "Packages must be uploaded first.");
8182
9163
  return { kind: "package", path: p };
8183
9164
  }
8184
9165
  throw new HttpError(400, "Unknown source kind.");
@@ -8258,15 +9239,15 @@ async function handle(req, ctx, path) {
8258
9239
  }
8259
9240
  case "POST export": {
8260
9241
  const s = await body(req);
8261
- const dir = join15(home2, "exports");
9242
+ const dir = join16(home2, "exports");
8262
9243
  await mkdir(dir, { recursive: true, mode: 448 });
8263
9244
  const r = await nomad.exportAgent(safeSource(home2, s.source), { outPath: dir, includeSecrets: !!s.includeSecrets, includeFiles: !!s.includeFiles, components: Array.isArray(s.components) && s.components.length ? s.components : void 0, format: s.format === "interchange" ? "interchange" : "nomad", sign: !!s.sign && s.format !== "interchange" });
8264
- return json({ file: basename9(r.path), size: r.bytes.length, notIncluded: r.receipt.notIncluded, redacted: r.sanitize.redactedText, references: r.sanitize.strippedEnvValues.length, removedFiles: r.sanitize.removedFiles, signedBy: r.receipt.signedBy ?? null, receipt: r.receipt });
9245
+ return json({ file: basename10(r.path), size: r.bytes.length, notIncluded: r.receipt.notIncluded, redacted: r.sanitize.redactedText, references: r.sanitize.strippedEnvValues.length, removedFiles: r.sanitize.removedFiles, signedBy: r.receipt.signedBy ?? null, receipt: r.receipt });
8265
9246
  }
8266
9247
  case "GET download": {
8267
9248
  const name = q("file") ?? "";
8268
9249
  if (!/^[\w.-]+\.(nomad|agentpack|jetpack)$/.test(name)) throw new HttpError(400, "Invalid file name.");
8269
- const data = await readFile(join15(home2, "exports", name)).catch(() => {
9250
+ const data = await readFile(join16(home2, "exports", name)).catch(() => {
8270
9251
  throw new HttpError(404, "File not found.");
8271
9252
  });
8272
9253
  return new Response(new Uint8Array(data), { headers: { "Content-Type": "application/zip", "Content-Disposition": `attachment; filename="${name}"`, "Cache-Control": "no-store" } });
@@ -8277,9 +9258,9 @@ async function handle(req, ctx, path) {
8277
9258
  if (data.length > 128 * 1024 * 1024) throw new HttpError(413, "The package is larger than 128 MB.");
8278
9259
  const v = nomad.validatePackage(data);
8279
9260
  if (!v.ok) return json({ ok: false, issues: v.issues });
8280
- const dir = join15(home2, "uploads");
9261
+ const dir = join16(home2, "uploads");
8281
9262
  await mkdir(dir, { recursive: true, mode: 448 });
8282
- const path2 = join15(dir, `${Date.now()}-${v.doc.id}.nomad`);
9263
+ const path2 = join16(dir, `${Date.now()}-${v.doc.id}.nomad`);
8283
9264
  await writeFile(path2, data, { mode: 384 });
8284
9265
  return json({ ok: true, path: path2, name: v.doc.name, id: v.doc.id, warnings: v.warnings, secrets: v.scan?.findings.length ?? 0, files: v.fileCount, counts: { instructions: v.doc.instructions.length, memory: v.doc.memory.length, skills: v.doc.skills.length, tools: v.doc.tools.length, workflows: v.doc.workflows.length } });
8285
9266
  }
@@ -8342,8 +9323,8 @@ var SECURITY_HEADERS = {
8342
9323
  "Permissions-Policy": "camera=(), microphone=(), geolocation=()"
8343
9324
  };
8344
9325
  function findSite(here) {
8345
- const candidates = [resolve3(here, "../web"), resolve3(here, "../../web/.next-export"), resolve3(process.cwd(), "apps/web/.next-export")];
8346
- return candidates.find((d) => existsSync5(join16(d, "app.html"))) ?? null;
9326
+ const candidates = [resolve4(here, "../web"), resolve4(here, "../../web/.next-export"), resolve4(process.cwd(), "apps/web/.next-export")];
9327
+ return candidates.find((d) => existsSync5(join17(d, "app.html"))) ?? null;
8347
9328
  }
8348
9329
  function fileFor(site, pathname) {
8349
9330
  let rel;
@@ -8353,9 +9334,9 @@ function fileFor(site, pathname) {
8353
9334
  return null;
8354
9335
  }
8355
9336
  if (rel.includes("\0")) return null;
8356
- const base = normalize(join16(site, rel));
8357
- if (base !== site && !base.startsWith(site + sep3)) return null;
8358
- for (const p of [base, `${base}.html`, join16(base, "index.html")]) {
9337
+ const base = normalize(join17(site, rel));
9338
+ if (base !== site && !base.startsWith(site + sep4)) return null;
9339
+ for (const p of [base, `${base}.html`, join17(base, "index.html")]) {
8359
9340
  try {
8360
9341
  if (statSync2(p).isFile()) return p;
8361
9342
  } catch {
@@ -8413,7 +9394,7 @@ function startUi(opts) {
8413
9394
  return;
8414
9395
  }
8415
9396
  const file = fileFor(site, url.pathname === "/" ? "/index.html" : url.pathname);
8416
- const path = file ?? join16(site, "404.html");
9397
+ const path = file ?? join17(site, "404.html");
8417
9398
  const type = TYPES[extname(path)] ?? "application/octet-stream";
8418
9399
  const immutable = url.pathname.startsWith("/_next/static/");
8419
9400
  res.writeHead(file ? 200 : 404, { ...SECURITY_HEADERS, "Content-Type": type, "Cache-Control": immutable ? "public, max-age=31536000, immutable" : "no-cache" });
@@ -8452,8 +9433,8 @@ function out() {
8452
9433
  }
8453
9434
  function engine() {
8454
9435
  const home2 = program.opts().home;
8455
- if (home2) process.env.NOMAD_HOME = resolve5(home2);
8456
- return new Nomad({ home: home2 ? resolve5(home2) : nomadHome() });
9436
+ if (home2) process.env.NOMAD_HOME = resolve6(home2);
9437
+ return new Nomad({ home: home2 ? resolve6(home2) : nomadHome() });
8457
9438
  }
8458
9439
  function components(list) {
8459
9440
  if (!list) return void 0;
@@ -8582,7 +9563,7 @@ program.command("inspect <source>").description("show what an agent contains (re
8582
9563
  program.command("validate <package>").description("check a package (.nomad, .agentpack or .jetpack) without importing it").action(
8583
9564
  (pkg) => run2(async (nomad) => {
8584
9565
  const { readFileSync: readFileSync5 } = await import("fs");
8585
- const r = nomad.validatePackage(new Uint8Array(readFileSync5(resolve5(pkg))));
9566
+ const r = nomad.validatePackage(new Uint8Array(readFileSync5(resolve6(pkg))));
8586
9567
  const { describeSigner: describeSigner2 } = await Promise.resolve().then(() => (init_src8(), src_exports3));
8587
9568
  print(out(), () => r.ok ? [green("Valid package") + ` ${r.doc.name} (${r.doc.id})`, `Format ${r.format}. ${describeSigner2(r.signer)}`, `${r.fileCount} files, ${r.totalBytes} bytes`, ...r.warnings.map((w) => yellow("! ") + w), ...r.scan?.findings.length ? [yellow(`${r.scan.findings.length} secret(s) found in the package`)] : []] : [red("Invalid package"), ...r.issues.map((i) => ` ${i.path}: ${i.message}`)], { ok: r.ok, format: r.format, signer: r.signer, issues: r.issues, warnings: r.warnings, info: r.info, findings: r.scan?.findings ?? [] });
8588
9569
  return r.ok ? EXIT.ok : EXIT.invalid;
@@ -8592,7 +9573,7 @@ program.command("export <source>").description("export an agent to a portable .n
8592
9573
  (source, o) => run2(async (nomad) => {
8593
9574
  const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
8594
9575
  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"));
8595
- const r = await nomad.exportAgent(spec, { outPath: resolve5(o.out), includeSecrets: o.includeSecrets, includeFiles: o.includeFiles, includeSensitiveFiles: o.includeSensitiveFiles, components: components(o.components), format: o.format === "jetpack" ? "interchange" : "nomad", sign: o.sign });
9576
+ 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 });
8596
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);
8597
9578
  })
8598
9579
  );
@@ -8600,7 +9581,7 @@ approvalOptions(
8600
9581
  program.command("import <package>").description("import a package into the library, and optionally into a platform").option("--to <platform>", "also write the agent to this platform").option("--dest-dir <dir>", "destination directory").addOption(new Option("--mode <mode>", "conflict handling").choices(["merge", "copy", "replace"]).default("merge")).option("--name <name>", "name for copy mode").option("--components <list>", "only these components")
8601
9582
  ).action(
8602
9583
  (pkg, o) => run2(async (nomad) => {
8603
- const path = resolve5(pkg);
9584
+ const path = resolve6(pkg);
8604
9585
  const r = await nomad.importPackage({ path });
8605
9586
  if (!r.ok) {
8606
9587
  print(out(), () => [red("The package was rejected"), ...r.issues.map((i) => ` ${i.path}: ${i.message}`)], r);
@@ -8632,7 +9613,7 @@ approvalOptions(
8632
9613
  })
8633
9614
  );
8634
9615
  function parseDestination(spec) {
8635
- if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path: resolve5(spec.replace(/^~(?=$|\/)/, process.env.HOME ?? "~")) };
9616
+ if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path: resolve6(spec.replace(/^~(?=$|\/)/, process.env.HOME ?? "~")) };
8636
9617
  const m = /^([a-z0-9-]+)(?::(.*?))?(?:#(.+))?$/.exec(spec);
8637
9618
  const adapter = m ? findAdapter(m[1]) : void 0;
8638
9619
  if (!adapter || !m) throw new NomadError(`"${spec}" is not a platform or a package file.`, "usage", `Use a platform (${listAdapters().map((a) => a.info.id).slice(0, 5).join(", ")}, ...), a platform with a folder such as claude-code:~/project, or a file ending in .nomad.`);
@@ -8670,7 +9651,7 @@ program.command("keys").description("show your signing key, and the keys you tru
8670
9651
  program.command("trust <package>").description("trust the key that signed a package").requiredOption("--name <who>", "a name for this key, such as a person or team").action(
8671
9652
  (pkg, o) => run2(async (nomad) => {
8672
9653
  const { readFileSync: readFileSync5 } = await import("fs");
8673
- const k = nomad.trustPackageSigner(new Uint8Array(readFileSync5(resolve5(pkg))), o.name);
9654
+ const k = nomad.trustPackageSigner(new Uint8Array(readFileSync5(resolve6(pkg))), o.name);
8674
9655
  print(out(), () => [green("Trusted") + ` ${k.fingerprint} ${k.name}`, dim("Check this fingerprint with them through another channel.")], k);
8675
9656
  })
8676
9657
  );
@@ -8778,7 +9759,7 @@ remote.command("push <source>").description("export locally, copy over SSH, and
8778
9759
  (source, o) => run2(async (nomad) => {
8779
9760
  const spec = await parseSource(nomad, source);
8780
9761
  const tmp = await makeTempDir("nomad-remote-");
8781
- const exp = await nomad.exportAgent(spec, { outPath: join18(tmp, "agent.nomad") });
9762
+ const exp = await nomad.exportAgent(spec, { outPath: join19(tmp, "agent.nomad") });
8782
9763
  const r = await remoteMigrate({ host: o.host, port: o.port ? Number(o.port) : void 0, identity: o.identity, remoteCommand: o.remoteCommand }, exp.path, { to: o.to, dest: o.destDir, mode: o.mode, apply: !!o.apply });
8783
9764
  print(out(), () => typeof r.result === "string" ? r.result : r.result.receipt ? receiptText(r.result.receipt) : planText(r.result.plan, out().verbose), r.result);
8784
9765
  return r.code;
@@ -8787,10 +9768,10 @@ remote.command("push <source>").description("export locally, copy over SSH, and
8787
9768
  program.command("schema").description("write the Universal Agent Format JSON Schemas").option("-o, --out <dir>", "output directory", ".").action(
8788
9769
  (o) => run2(async () => {
8789
9770
  const s = jsonSchemas();
8790
- const dir = resolve5(o.out);
9771
+ const dir = resolve6(o.out);
8791
9772
  mkdirSync3(dir, { recursive: true });
8792
- writeFileSync3(join18(dir, "agent-document.schema.json"), JSON.stringify(s.agentDocument, null, 2));
8793
- writeFileSync3(join18(dir, "package-manifest.schema.json"), JSON.stringify(s.packageManifest, null, 2));
9773
+ writeFileSync3(join19(dir, "agent-document.schema.json"), JSON.stringify(s.agentDocument, null, 2));
9774
+ writeFileSync3(join19(dir, "package-manifest.schema.json"), JSON.stringify(s.packageManifest, null, 2));
8794
9775
  print(out(), () => `Wrote schemas to ${dir}`, { dir });
8795
9776
  })
8796
9777
  );
@@ -8813,7 +9794,7 @@ program.command("mcp").description("run the Nomad MCP server on stdio").option("
8813
9794
  await startMcpServer2({ home: program.opts().home, allowWrites: !!o.allowWrites, allowReplace: !!o.allowReplace && !!o.allowWrites });
8814
9795
  });
8815
9796
  program.command("ui").description("open the dashboard in your browser (only this computer can reach it)").option("-p, --port <port>", "port", "4317").option("--no-open", "do not open a browser").option("--dev", "developers: run the Next.js app from the repository with live reload").action(async (o) => {
8816
- const here = dirname5(fileURLToPath(import.meta.url));
9797
+ const here = dirname6(fileURLToPath(import.meta.url));
8817
9798
  const token = randomBytes3(24).toString("base64url");
8818
9799
  const port = Number(o.port);
8819
9800
  const url = `http://127.0.0.1:${port}/app/session?token=${token}`;
@@ -8823,16 +9804,16 @@ program.command("ui").description("open the dashboard in your browser (only this
8823
9804
  spawn2(cmd, args, { stdio: "ignore", detached: true }).on("error", () => void 0).unref();
8824
9805
  };
8825
9806
  if (o.dev) {
8826
- const webDir = [resolve5(here, "../../web"), resolve5(process.cwd(), "apps/web")].find((d) => existsSync6(join18(d, "package.json")));
9807
+ const webDir = [resolve6(here, "../../web"), resolve6(process.cwd(), "apps/web")].find((d) => existsSync6(join19(d, "package.json")));
8827
9808
  if (!webDir) {
8828
9809
  process.stderr.write(red("--dev needs the repository checkout.\n"));
8829
9810
  process.exitCode = 1;
8830
9811
  return;
8831
9812
  }
8832
- const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ? resolve5(program.opts().home) : nomadHome(), PORT: String(port) };
9813
+ const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ? resolve6(program.opts().home) : nomadHome(), PORT: String(port) };
8833
9814
  process.stderr.write(`${bold("Nomad")} dev server at ${url}
8834
9815
  `);
8835
- const child = spawn2(process.execPath, [join18(webDir, "node_modules", "next", "dist", "bin", "next"), "dev", "-H", "127.0.0.1", "-p", String(port)], { cwd: webDir, env, stdio: ["ignore", "inherit", "inherit"] });
9816
+ const child = spawn2(process.execPath, [join19(webDir, "node_modules", "next", "dist", "bin", "next"), "dev", "-H", "127.0.0.1", "-p", String(port)], { cwd: webDir, env, stdio: ["ignore", "inherit", "inherit"] });
8836
9817
  setTimeout(openBrowser, 2500);
8837
9818
  child.on("exit", (code) => process.exitCode = code ?? 0);
8838
9819
  return;
@@ -8895,7 +9876,7 @@ async function guided(nomad) {
8895
9876
  if (items.length === 1) process.stderr.write(dim("No agents were found at the usual places. You can open a package file.") + "\n");
8896
9877
  const pick = await choose(rl, "Which agent?", items);
8897
9878
  if (pick === "file") {
8898
- const path = resolve5((await rl.question("Path to the file: ")).trim().replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
9879
+ const path = resolve6((await rl.question("Path to the file: ")).trim().replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
8899
9880
  if (!existsSync6(path)) throw new NomadError(`There is no file at ${path}.`, "not-found");
8900
9881
  source = { kind: "package", path };
8901
9882
  from = null;
@@ -8918,7 +9899,7 @@ async function guided(nomad) {
8918
9899
  const name = (await nomad.loadSource(source).catch(() => null))?.doc.name ?? "agent";
8919
9900
  const def = `./${name.replace(/[^A-Za-z0-9._-]+/g, "-")}.nomad`;
8920
9901
  const a = (await rl.question(`Save to ${dim(`[${def}]`)}: `)).trim();
8921
- dest = { kind: "file", path: resolve5(a || def) };
9902
+ dest = { kind: "file", path: resolve6(a || def) };
8922
9903
  } else {
8923
9904
  const info = getAdapter(where).info;
8924
9905
  const def = info.defaultLocations[0] ?? displayPath(process.cwd());