thenomad 0.4.2 → 0.5.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 (133) hide show
  1. package/dist/nomad.js +349 -50
  2. package/package.json +1 -1
  3. package/web/404.html +1 -1
  4. package/web/__next.__PAGE__.txt +33 -31
  5. package/web/__next._full.txt +37 -35
  6. package/web/__next._tree.txt +2 -2
  7. package/web/_next/static/chunks/0zu_3pbq18_tq.js +1 -0
  8. package/web/_next/static/chunks/{35uvx15wn7-j-.js → 1119s7y-irwgs.js} +1 -1
  9. package/web/_next/static/chunks/{1ygp921kjfxbp.css → 2o1e9ex_u8yqf.css} +1 -1
  10. package/web/_next/static/chunks/2qcrytgk9-6pf.js +1 -0
  11. package/web/_not-found/__next._full.txt +3 -3
  12. package/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  13. package/web/_not-found/__next._tree.txt +2 -2
  14. package/web/_not-found.html +1 -1
  15. package/web/_not-found.txt +3 -3
  16. package/web/app/__next._full.txt +3 -3
  17. package/web/app/__next._tree.txt +2 -2
  18. package/web/app/__next.app.__PAGE__.txt +1 -1
  19. package/web/app/__next.app.txt +2 -2
  20. package/web/app/agents/__next._full.txt +3 -3
  21. package/web/app/agents/__next._tree.txt +2 -2
  22. package/web/app/agents/__next.app.agents.__PAGE__.txt +1 -1
  23. package/web/app/agents/__next.app.txt +2 -2
  24. package/web/app/agents/view/__next._full.txt +3 -3
  25. package/web/app/agents/view/__next._tree.txt +2 -2
  26. package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +1 -1
  27. package/web/app/agents/view/__next.app.txt +2 -2
  28. package/web/app/agents/view.html +1 -1
  29. package/web/app/agents/view.txt +3 -3
  30. package/web/app/agents.html +1 -1
  31. package/web/app/agents.txt +3 -3
  32. package/web/app/backups/__next._full.txt +3 -3
  33. package/web/app/backups/__next._tree.txt +2 -2
  34. package/web/app/backups/__next.app.backups.__PAGE__.txt +1 -1
  35. package/web/app/backups/__next.app.txt +2 -2
  36. package/web/app/backups.html +1 -1
  37. package/web/app/backups.txt +3 -3
  38. package/web/app/compatibility/__next._full.txt +5 -5
  39. package/web/app/compatibility/__next._tree.txt +2 -2
  40. package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +3 -3
  41. package/web/app/compatibility/__next.app.txt +2 -2
  42. package/web/app/compatibility.html +1 -1
  43. package/web/app/compatibility.txt +5 -5
  44. package/web/app/export/__next._full.txt +5 -5
  45. package/web/app/export/__next._tree.txt +2 -2
  46. package/web/app/export/__next.app.export.__PAGE__.txt +3 -3
  47. package/web/app/export/__next.app.txt +2 -2
  48. package/web/app/export.html +1 -1
  49. package/web/app/export.txt +5 -5
  50. package/web/app/history/__next._full.txt +5 -5
  51. package/web/app/history/__next._tree.txt +2 -2
  52. package/web/app/history/__next.app.history.__PAGE__.txt +3 -3
  53. package/web/app/history/__next.app.txt +2 -2
  54. package/web/app/history.html +1 -1
  55. package/web/app/history.txt +5 -5
  56. package/web/app/import/__next._full.txt +3 -3
  57. package/web/app/import/__next._tree.txt +2 -2
  58. package/web/app/import/__next.app.import.__PAGE__.txt +1 -1
  59. package/web/app/import/__next.app.txt +2 -2
  60. package/web/app/import.html +1 -1
  61. package/web/app/import.txt +3 -3
  62. package/web/app/migrate/__next._full.txt +5 -5
  63. package/web/app/migrate/__next._tree.txt +2 -2
  64. package/web/app/migrate/__next.app.migrate.__PAGE__.txt +3 -3
  65. package/web/app/migrate/__next.app.txt +2 -2
  66. package/web/app/migrate.html +1 -1
  67. package/web/app/migrate.txt +5 -5
  68. package/web/app/settings/__next._full.txt +5 -5
  69. package/web/app/settings/__next._tree.txt +2 -2
  70. package/web/app/settings/__next.app.settings.__PAGE__.txt +3 -3
  71. package/web/app/settings/__next.app.txt +2 -2
  72. package/web/app/settings.html +1 -1
  73. package/web/app/settings.txt +5 -5
  74. package/web/app/versions/__next._full.txt +3 -3
  75. package/web/app/versions/__next._tree.txt +2 -2
  76. package/web/app/versions/__next.app.txt +2 -2
  77. package/web/app/versions/__next.app.versions.__PAGE__.txt +1 -1
  78. package/web/app/versions.html +1 -1
  79. package/web/app/versions.txt +3 -3
  80. package/web/app.html +1 -1
  81. package/web/app.txt +3 -3
  82. package/web/docs/__next._full.txt +3 -3
  83. package/web/docs/__next._tree.txt +2 -2
  84. package/web/docs/__next.docs.__PAGE__.txt +2 -2
  85. package/web/docs/adapters/__next._full.txt +3 -3
  86. package/web/docs/adapters/__next._tree.txt +2 -2
  87. package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +2 -2
  88. package/web/docs/adapters.html +1 -1
  89. package/web/docs/adapters.txt +3 -3
  90. package/web/docs/format/__next._full.txt +3 -3
  91. package/web/docs/format/__next._tree.txt +2 -2
  92. package/web/docs/format/__next.docs.format.__PAGE__.txt +2 -2
  93. package/web/docs/format.html +2 -2
  94. package/web/docs/format.txt +3 -3
  95. package/web/docs/security/__next._full.txt +3 -3
  96. package/web/docs/security/__next._tree.txt +2 -2
  97. package/web/docs/security/__next.docs.security.__PAGE__.txt +2 -2
  98. package/web/docs/security.html +1 -1
  99. package/web/docs/security.txt +3 -3
  100. package/web/docs/token/__next._full.txt +3 -3
  101. package/web/docs/token/__next._tree.txt +2 -2
  102. package/web/docs/token/__next.docs.token.__PAGE__.txt +2 -2
  103. package/web/docs/token.html +1 -1
  104. package/web/docs/token.txt +3 -3
  105. package/web/docs.html +2 -2
  106. package/web/docs.txt +3 -3
  107. package/web/index.html +2 -2
  108. package/web/index.txt +37 -35
  109. package/web/inspect/__next._full.txt +5 -5
  110. package/web/inspect/__next._tree.txt +2 -2
  111. package/web/inspect/__next.inspect.__PAGE__.txt +4 -4
  112. package/web/inspect.html +1 -1
  113. package/web/inspect.txt +5 -5
  114. package/web/privacy/__next._full.txt +3 -3
  115. package/web/privacy/__next._tree.txt +2 -2
  116. package/web/privacy/__next.privacy.__PAGE__.txt +2 -2
  117. package/web/privacy.html +1 -1
  118. package/web/privacy.txt +3 -3
  119. package/web/terms/__next._full.txt +3 -3
  120. package/web/terms/__next._tree.txt +2 -2
  121. package/web/terms/__next.terms.__PAGE__.txt +2 -2
  122. package/web/terms.html +1 -1
  123. package/web/terms.txt +3 -3
  124. package/web/vote/__next._full.txt +3 -3
  125. package/web/vote/__next._tree.txt +2 -2
  126. package/web/vote/__next.vote.__PAGE__.txt +2 -2
  127. package/web/vote.html +1 -1
  128. package/web/vote.txt +3 -3
  129. package/web/_next/static/chunks/10-jap4z156cb.js +0 -1
  130. package/web/_next/static/chunks/2bgjjtv5djk5k.js +0 -1
  131. /package/web/_next/static/{GFCmlWJPNNpG79BCw_NAH → rNLVbnwje7eCRAa4cBuY9}/_buildManifest.js +0 -0
  132. /package/web/_next/static/{GFCmlWJPNNpG79BCw_NAH → rNLVbnwje7eCRAa4cBuY9}/_clientMiddlewareManifest.js +0 -0
  133. /package/web/_next/static/{GFCmlWJPNNpG79BCw_NAH → rNLVbnwje7eCRAa4cBuY9}/_ssgManifest.js +0 -0
package/dist/nomad.js CHANGED
@@ -928,7 +928,7 @@ var init_src2 = __esm({
928
928
  init_markdown();
929
929
  init_document();
930
930
  init_merge();
931
- NOMAD_VERSION = "0.4.2";
931
+ NOMAD_VERSION = "0.5.0";
932
932
  NomadError = class extends Error {
933
933
  constructor(message, code, hint) {
934
934
  super(message);
@@ -9131,8 +9131,8 @@ __export(src_exports4, {
9131
9131
  });
9132
9132
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
9133
9133
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9134
- import { readFileSync as readFileSync4 } from "fs";
9135
- import { join as join18, resolve as resolve5 } from "path";
9134
+ import { readFileSync as readFileSync5 } from "fs";
9135
+ import { join as join19, resolve as resolve6 } from "path";
9136
9136
  import { z as z4 } from "zod";
9137
9137
  function text2(data) {
9138
9138
  return { content: [{ type: "text", text: typeof data === "string" ? data : JSON.stringify(data, null, 2) }] };
@@ -9165,9 +9165,9 @@ function summarizePlan(p) {
9165
9165
  };
9166
9166
  }
9167
9167
  function createMcpServer(options = {}) {
9168
- const nomad = new Nomad({ home: options.home ? resolve5(options.home) : nomadHome() });
9168
+ const nomad = new Nomad({ home: options.home ? resolve6(options.home) : nomadHome() });
9169
9169
  const server = new McpServer2({ name: "nomad", version: NOMAD_VERSION });
9170
- const exportsDir = join18(nomad.store.home, "exports");
9170
+ const exportsDir = join19(nomad.store.home, "exports");
9171
9171
  server.registerTool(
9172
9172
  "list_agents",
9173
9173
  { title: "List agents", description: "Agents in the local Nomad library with their known locations.", inputSchema: {} },
@@ -9237,9 +9237,9 @@ function createMcpServer(options = {}) {
9237
9237
  { 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") } },
9238
9238
  async ({ path }) => {
9239
9239
  try {
9240
- const p = resolve5(expandHome(path));
9240
+ const p = resolve6(expandHome(path));
9241
9241
  if (!/\.(nomad|agentpack|jetpack)$/.test(p)) throw new NomadError("Only .nomad, .agentpack or .jetpack files can be validated.", "usage");
9242
- const r = nomad.validatePackage(new Uint8Array(readFileSync4(p)));
9242
+ const r = nomad.validatePackage(new Uint8Array(readFileSync5(p)));
9243
9243
  return text2({ ok: r.ok, name: r.doc?.name, issues: r.issues, warnings: r.warnings, secretsFound: r.scan?.findings.length ?? 0 });
9244
9244
  } catch (e) {
9245
9245
  return fail(e);
@@ -9362,10 +9362,10 @@ init_src6();
9362
9362
  import { Command, Option } from "commander";
9363
9363
  import { createInterface } from "readline/promises";
9364
9364
  import { spawn as spawn2 } from "child_process";
9365
- import { existsSync as existsSync6, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
9366
- import { dirname as dirname6, join as join19, resolve as resolve6 } from "path";
9365
+ import { existsSync as existsSync7, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
9366
+ import { dirname as dirname7, join as join20, resolve as resolve7 } from "path";
9367
9367
  import { fileURLToPath } from "url";
9368
- import { randomBytes as randomBytes3 } from "crypto";
9368
+ import { randomBytes as randomBytes4 } from "crypto";
9369
9369
 
9370
9370
  // src/format.ts
9371
9371
  var NPM_NAME = "thenomad";
@@ -9528,14 +9528,14 @@ function shellQuote(s) {
9528
9528
  return `'${s.replace(/'/g, `'\\''`)}'`;
9529
9529
  }
9530
9530
  function run(cmd, args, input) {
9531
- return new Promise((resolve7, reject) => {
9531
+ return new Promise((resolve8, reject) => {
9532
9532
  const p = spawn(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
9533
9533
  let stdout = "";
9534
9534
  let stderr = "";
9535
9535
  p.stdout.on("data", (d) => stdout += d);
9536
9536
  p.stderr.on("data", (d) => stderr += d);
9537
9537
  p.on("error", (e) => reject(new NomadError(`${cmd} is not available: ${e.message}`, "ssh-missing", "Install OpenSSH to use remote migration.")));
9538
- p.on("close", (code) => resolve7({ code: code ?? 1, stdout, stderr }));
9538
+ p.on("close", (code) => resolve8({ code: code ?? 1, stdout, stderr }));
9539
9539
  if (input) p.stdin.end(input);
9540
9540
  else p.stdin.end();
9541
9541
  });
@@ -9574,8 +9574,8 @@ async function remoteMigrate(o, packagePath, args) {
9574
9574
 
9575
9575
  // src/ui.ts
9576
9576
  import { createServer } from "http";
9577
- import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
9578
- import { extname, join as join17, normalize, resolve as resolve4, sep as sep4 } from "path";
9577
+ import { existsSync as existsSync6, readFileSync as readFileSync4, statSync as statSync3 } from "fs";
9578
+ import { extname, join as join18, normalize, resolve as resolve5, sep as sep4 } from "path";
9579
9579
 
9580
9580
  // ../../packages/local/src/index.ts
9581
9581
  import { timingSafeEqual } from "crypto";
@@ -9793,6 +9793,203 @@ async function handleLocalApi(req, ctx, path) {
9793
9793
  }
9794
9794
  }
9795
9795
 
9796
+ // src/install.ts
9797
+ init_src2();
9798
+ import { spawnSync } from "child_process";
9799
+ import { createHash, randomBytes as randomBytes3 } from "crypto";
9800
+ import { chmodSync as chmodSync2, cpSync, existsSync as existsSync5, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
9801
+ import { basename as basename11, dirname as dirname6, join as join17, resolve as resolve4 } from "path";
9802
+ var REPO = "kadiri-seer/nomad";
9803
+ var VERSION_RE = /^\d+\.\d+\.\d+$/;
9804
+ function currentInstall(execPath = process.execPath) {
9805
+ const appDir = dirname6(execPath);
9806
+ if (basename11(dirname6(appDir)) !== "app" || !VERSION_RE.test(basename11(appDir))) return null;
9807
+ const root = dirname6(dirname6(appDir));
9808
+ try {
9809
+ const info = JSON.parse(readFileSync3(join17(root, "install.json"), "utf8"));
9810
+ if (info.by !== "nomad-installer" || typeof info.target !== "string" || !/^(windows|macos|linux)-(x64|arm64)$/.test(info.target)) return null;
9811
+ return { root, target: info.target, version: basename11(appDir) };
9812
+ } catch {
9813
+ return null;
9814
+ }
9815
+ }
9816
+ function newer(a, b) {
9817
+ const pa = a.split(".").map(Number);
9818
+ const pb = b.split(".").map(Number);
9819
+ for (let i = 0; i < 3; i++) if (pa[i] !== pb[i]) return pa[i] > pb[i];
9820
+ return false;
9821
+ }
9822
+ function assetName(target) {
9823
+ return `nomad-${target}.${target.startsWith("windows") ? "zip" : "tar.gz"}`;
9824
+ }
9825
+ function checksumFor(sums, name) {
9826
+ for (const line of sums.split(/\r?\n/)) {
9827
+ const m = /^([0-9a-fA-F]{64})\s+\*?(\S+)\s*$/.exec(line);
9828
+ if (m && m[2] === name) return m[1].toLowerCase();
9829
+ }
9830
+ return null;
9831
+ }
9832
+ async function get(url) {
9833
+ const host = new URL(url).host;
9834
+ let r;
9835
+ try {
9836
+ r = await fetch(url, { headers: { "User-Agent": `nomad/${NOMAD_VERSION}`, Accept: host === "api.github.com" ? "application/vnd.github+json" : "*/*" }, redirect: "follow", ...host === "api.github.com" ? { signal: AbortSignal.timeout(3e4) } : {} });
9837
+ } catch {
9838
+ throw new Error(`Could not reach ${host}. Check your connection and try again.`);
9839
+ }
9840
+ if (r.status === 404 && host === "api.github.com") throw new Error("No Nomad release was found on GitHub. Try again later.");
9841
+ if (!r.ok) throw new Error(`Could not reach ${host} (HTTP ${r.status}). Try again later.`);
9842
+ return r;
9843
+ }
9844
+ async function latestVersion() {
9845
+ const data = await (await get(`https://api.github.com/repos/${REPO}/releases/latest`)).json();
9846
+ const tag = typeof data.tag_name === "string" ? data.tag_name : "";
9847
+ if (!/^v\d+\.\d+\.\d+$/.test(tag)) throw new Error("GitHub returned an unexpected release name. Try again later.");
9848
+ return tag.slice(1);
9849
+ }
9850
+ function switchedVersion(install) {
9851
+ try {
9852
+ const v = readFileSync3(join17(install.root, "current"), "utf8").trim();
9853
+ if (VERSION_RE.test(v) && newer(v, install.version)) return v;
9854
+ } catch {
9855
+ }
9856
+ return install.version;
9857
+ }
9858
+ async function checkForUpdate(install = currentInstall()) {
9859
+ if (!install) return { installed: false, current: NOMAD_VERSION };
9860
+ const current2 = switchedVersion(install);
9861
+ const latest = await latestVersion();
9862
+ return { installed: true, current: current2, latest, available: newer(latest, current2) };
9863
+ }
9864
+ function systemTar() {
9865
+ if (process.platform === "win32") return join17(process.env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe");
9866
+ for (const p of ["/usr/bin/tar", "/bin/tar"]) if (existsSync5(p)) return p;
9867
+ return "tar";
9868
+ }
9869
+ function renameWithRetry(from, to) {
9870
+ for (let i = 0; ; i++) {
9871
+ try {
9872
+ return renameSync(from, to);
9873
+ } catch (e) {
9874
+ const code = e.code;
9875
+ if (i >= 40 || code !== "EPERM" && code !== "EBUSY" && code !== "EACCES") throw e;
9876
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 500);
9877
+ }
9878
+ }
9879
+ }
9880
+ function removeQuietly(p) {
9881
+ try {
9882
+ rmSync(p, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 });
9883
+ } catch {
9884
+ }
9885
+ }
9886
+ var powershell = () => join17(process.env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
9887
+ function startPowerShell(script, env) {
9888
+ const ps = powershell();
9889
+ const launch = "Start-Process -FilePath $env:NOMAD_PS -ArgumentList '-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-EncodedCommand',$env:NOMAD_PS_SCRIPT -WindowStyle Hidden";
9890
+ const r = spawnSync(ps, ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", launch], {
9891
+ env: { ...process.env, ...env, NOMAD_PS: ps, NOMAD_PS_SCRIPT: Buffer.from(script, "utf16le").toString("base64") },
9892
+ stdio: "ignore",
9893
+ windowsHide: true,
9894
+ timeout: 6e4
9895
+ });
9896
+ return r.status === 0;
9897
+ }
9898
+ function removeAfterExit(dir) {
9899
+ if (process.platform !== "win32") return;
9900
+ startPowerShell(`Wait-Process -Id ${process.pid} -ErrorAction SilentlyContinue; Start-Sleep -Seconds 2; Remove-Item -LiteralPath $env:NOMAD_OLD_DIR -Recurse -Force -ErrorAction SilentlyContinue`, { NOMAD_OLD_DIR: dir });
9901
+ }
9902
+ function takeLock(root) {
9903
+ const lock = join17(root, "update.lock");
9904
+ try {
9905
+ if (Date.now() - statSync2(lock).mtimeMs > 15 * 60 * 1e3) rmSync(lock, { recursive: true, force: true });
9906
+ } catch {
9907
+ }
9908
+ try {
9909
+ mkdirSync3(lock);
9910
+ } catch {
9911
+ throw new Error("Another Nomad update is running. Try again in a few minutes.");
9912
+ }
9913
+ return () => removeQuietly(lock);
9914
+ }
9915
+ async function applyUpdate(install, version, log = () => void 0) {
9916
+ if (!VERSION_RE.test(version)) throw new Error(`Not a version: ${version}`);
9917
+ if (switchedVersion(install) === version && existsSync5(join17(install.root, "app", version))) return version;
9918
+ const asset = assetName(install.target);
9919
+ const base = `https://github.com/${REPO}/releases/download/v${version}`;
9920
+ const unlock = takeLock(install.root);
9921
+ const work = join17(install.root, `tmp-${randomBytes3(6).toString("hex")}`);
9922
+ mkdirSync3(work, { recursive: true });
9923
+ try {
9924
+ log(`Downloading Nomad ${version}...`);
9925
+ const sums = await (await get(`${base}/SHA256SUMS`)).text();
9926
+ const expected = checksumFor(sums, asset);
9927
+ if (!expected) throw new Error(`The release has no fingerprint for ${asset}. Nothing was changed.`);
9928
+ const bytes2 = Buffer.from(await (await get(`${base}/${asset}`)).arrayBuffer());
9929
+ const actual = createHash("sha256").update(bytes2).digest("hex");
9930
+ if (actual !== expected) throw new Error("The download does not match its published fingerprint. Nothing was changed.");
9931
+ log("Fingerprint checked.");
9932
+ const archive = join17(work, asset);
9933
+ writeFileSync3(archive, bytes2);
9934
+ const staged = join17(work, "app");
9935
+ mkdirSync3(staged);
9936
+ const x = spawnSync(systemTar(), [install.target.startsWith("windows") ? "-xf" : "-xzf", archive, "-C", staged], { stdio: "pipe" });
9937
+ if (x.status !== 0) throw new Error(`Could not unpack the download: ${String(x.stderr ?? x.error ?? "").trim()}`);
9938
+ const node = join17(staged, process.platform === "win32" ? "node.exe" : "node");
9939
+ const check = spawnSync(node, [join17(staged, "node_modules", "thenomad", "dist", "nomad.js"), "--version"], { encoding: "utf8", timeout: 6e4 });
9940
+ if (check.status !== 0 || check.stdout.trim() !== version) throw new Error(`The new version did not start correctly. Nothing was changed.${check.stderr ? `
9941
+ ${check.stderr.trim()}` : ""}`);
9942
+ const target = join17(install.root, "app", version);
9943
+ if (resolve4(target) === resolve4(dirname6(process.execPath))) throw new Error(`Nomad ${version} is the version running now.`);
9944
+ removeQuietly(target);
9945
+ renameWithRetry(staged, target);
9946
+ const launcher = join17(target, "launcher");
9947
+ if (existsSync5(launcher)) {
9948
+ for (const f of readdirSync(launcher)) {
9949
+ cpSync(join17(launcher, f), join17(install.root, "bin", f), { force: true });
9950
+ if (process.platform !== "win32" && !f.endsWith(".png") && !f.endsWith(".icns")) chmodSync2(join17(install.root, "bin", f), 493);
9951
+ }
9952
+ }
9953
+ const next = join17(install.root, `current.${randomBytes3(4).toString("hex")}`);
9954
+ writeFileSync3(next, version);
9955
+ renameSync(next, join17(install.root, "current"));
9956
+ const infoPath = join17(install.root, "install.json");
9957
+ const info = JSON.parse(readFileSync3(infoPath, "utf8"));
9958
+ writeFileSync3(infoPath, JSON.stringify({ ...info, version, updated: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n");
9959
+ if (process.platform === "win32") {
9960
+ const reg = join17(process.env.SystemRoot ?? "C:\\Windows", "System32", "reg.exe");
9961
+ spawnSync(reg, ["add", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\thenomad.website", "/v", "DisplayVersion", "/t", "REG_SZ", "/d", version, "/f"], { stdio: "ignore" });
9962
+ }
9963
+ const running = resolve4(dirname6(process.execPath));
9964
+ for (const v of readdirSync(join17(install.root, "app"))) {
9965
+ const dir = resolve4(install.root, "app", v);
9966
+ if (v === version) continue;
9967
+ if (dir === running) removeAfterExit(dir);
9968
+ else removeQuietly(dir);
9969
+ }
9970
+ return version;
9971
+ } finally {
9972
+ removeQuietly(work);
9973
+ unlock();
9974
+ }
9975
+ }
9976
+ function runUninstaller(install, opts) {
9977
+ if (process.platform === "win32") {
9978
+ const script2 = join17(install.root, "bin", "uninstall.ps1");
9979
+ if (!existsSync5(script2)) return false;
9980
+ return startPowerShell(`& $env:NOMAD_UNINSTALL -Yes -WaitPid ${process.pid} -DataDir $env:NOMAD_DATA_DIR${opts.removeData ? " -RemoveData" : ""}`, {
9981
+ NOMAD_UNINSTALL: script2,
9982
+ NOMAD_DATA_DIR: opts.dataDir
9983
+ });
9984
+ }
9985
+ const script = join17(install.root, "bin", "uninstall.sh");
9986
+ if (!existsSync5(script)) return false;
9987
+ const args = [script, "--yes", "--data-dir", opts.dataDir];
9988
+ if (opts.removeData) args.push("--remove-data");
9989
+ const r = spawnSync("/bin/sh", args, { stdio: "inherit" });
9990
+ return r.status === 0;
9991
+ }
9992
+
9796
9993
  // src/ui.ts
9797
9994
  var TYPES = {
9798
9995
  ".html": "text/html; charset=utf-8",
@@ -9814,8 +10011,8 @@ var SECURITY_HEADERS = {
9814
10011
  "Permissions-Policy": "camera=(), microphone=(), geolocation=()"
9815
10012
  };
9816
10013
  function findSite(here) {
9817
- const candidates = [resolve4(here, "../web"), resolve4(here, "../../web/.next-export"), resolve4(process.cwd(), "apps/web/.next-export")];
9818
- return candidates.find((d) => existsSync5(join17(d, "app.html"))) ?? null;
10014
+ const candidates = [resolve5(here, "../web"), resolve5(here, "../../web/.next-export"), resolve5(process.cwd(), "apps/web/.next-export")];
10015
+ return candidates.find((d) => existsSync6(join18(d, "app.html"))) ?? null;
9819
10016
  }
9820
10017
  function fileFor(site, pathname) {
9821
10018
  let rel;
@@ -9825,11 +10022,11 @@ function fileFor(site, pathname) {
9825
10022
  return null;
9826
10023
  }
9827
10024
  if (rel.includes("\0")) return null;
9828
- const base = normalize(join17(site, rel));
10025
+ const base = normalize(join18(site, rel));
9829
10026
  if (base !== site && !base.startsWith(site + sep4)) return null;
9830
- for (const p of [base, `${base}.html`, join17(base, "index.html")]) {
10027
+ for (const p of [base, `${base}.html`, join18(base, "index.html")]) {
9831
10028
  try {
9832
- if (statSync2(p).isFile()) return p;
10029
+ if (statSync3(p).isFile()) return p;
9833
10030
  } catch {
9834
10031
  }
9835
10032
  }
@@ -9864,6 +10061,24 @@ async function send(res, r) {
9864
10061
  res.writeHead(r.status, headers);
9865
10062
  res.end(r.body ? Buffer.from(await r.arrayBuffer()) : void 0);
9866
10063
  }
10064
+ async function appUpdate(req, ctx) {
10065
+ const json2 = (body2, status = 200) => new Response(JSON.stringify(body2), { status, headers: { "Content-Type": "application/json", "Cache-Control": "no-store" } });
10066
+ const ok = checkRequest(req, ctx);
10067
+ if (!ok.ok) return json2({ error: ok.error }, ok.status);
10068
+ const install = currentInstall();
10069
+ if (!install) return json2({ installed: false });
10070
+ try {
10071
+ if (req.method === "GET") return json2(new URL(req.url).searchParams.get("check") === "1" ? await checkForUpdate(install) : { installed: true, current: install.version });
10072
+ if (req.method === "POST") {
10073
+ const c2 = await checkForUpdate(install);
10074
+ if (!c2.available || !c2.latest) return json2({ ...c2, updated: false });
10075
+ return json2({ ...c2, updated: true, current: await applyUpdate(install, c2.latest) });
10076
+ }
10077
+ return json2({ error: "Method not allowed." }, 405);
10078
+ } catch (e) {
10079
+ return json2({ error: e.message }, 502);
10080
+ }
10081
+ }
9867
10082
  function startUi(opts) {
9868
10083
  const { nomad, site, port, token } = opts;
9869
10084
  const ctx = { nomad, token, port };
@@ -9876,6 +10091,7 @@ function startUi(opts) {
9876
10091
  return;
9877
10092
  }
9878
10093
  if (url.pathname === "/app/session") return send(res, sessionResponse(await toRequest(req, url), ctx));
10094
+ if (opts.appUpdates && url.pathname === "/api/app/update") return send(res, await appUpdate(await toRequest(req, url), ctx));
9879
10095
  if (url.pathname.startsWith("/api/local/")) {
9880
10096
  const path2 = url.pathname.slice("/api/local/".length).split("/").filter(Boolean).map(decodeURIComponent);
9881
10097
  return send(res, await handleLocalApi(await toRequest(req, url), ctx, path2));
@@ -9885,11 +10101,11 @@ function startUi(opts) {
9885
10101
  return;
9886
10102
  }
9887
10103
  const file = fileFor(site, url.pathname === "/" ? "/index.html" : url.pathname);
9888
- const path = file ?? join17(site, "404.html");
10104
+ const path = file ?? join18(site, "404.html");
9889
10105
  const type = TYPES[extname(path)] ?? "application/octet-stream";
9890
10106
  const immutable = url.pathname.startsWith("/_next/static/");
9891
10107
  res.writeHead(file ? 200 : 404, { ...SECURITY_HEADERS, "Content-Type": type, "Cache-Control": immutable ? "public, max-age=31536000, immutable" : "no-cache" });
9892
- res.end(req.method === "HEAD" ? void 0 : readFileSync3(path));
10108
+ res.end(req.method === "HEAD" ? void 0 : readFileSync4(path));
9893
10109
  } catch (e) {
9894
10110
  if (!res.headersSent) res.writeHead(500, { "Content-Type": "text/plain" });
9895
10111
  res.end(e.message);
@@ -9924,8 +10140,8 @@ function out() {
9924
10140
  }
9925
10141
  function engine() {
9926
10142
  const home2 = program.opts().home;
9927
- if (home2) process.env.NOMAD_HOME = resolve6(home2);
9928
- return new Nomad({ home: home2 ? resolve6(home2) : nomadHome() });
10143
+ if (home2) process.env.NOMAD_HOME = resolve7(home2);
10144
+ return new Nomad({ home: home2 ? resolve7(home2) : nomadHome() });
9929
10145
  }
9930
10146
  function components(list) {
9931
10147
  if (!list) return void 0;
@@ -10054,8 +10270,8 @@ program.command("inspect <source>").description("show what an agent contains (re
10054
10270
  );
10055
10271
  program.command("validate <package>").description("check a package (.nomad, .agentpack or .jetpack) without importing it").action(
10056
10272
  (pkg) => run2(async (nomad) => {
10057
- const { readFileSync: readFileSync5 } = await import("fs");
10058
- const r = nomad.validatePackage(new Uint8Array(readFileSync5(resolve6(pkg))));
10273
+ const { readFileSync: readFileSync6 } = await import("fs");
10274
+ const r = nomad.validatePackage(new Uint8Array(readFileSync6(resolve7(pkg))));
10059
10275
  const { describeSigner: describeSigner2 } = await Promise.resolve().then(() => (init_src8(), src_exports3));
10060
10276
  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 ?? [] });
10061
10277
  return r.ok ? EXIT.ok : EXIT.invalid;
@@ -10065,7 +10281,7 @@ program.command("export <source>").description("export an agent to a portable .n
10065
10281
  (source, o) => run2(async (nomad) => {
10066
10282
  const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
10067
10283
  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"));
10068
- 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 });
10284
+ const r = await nomad.exportAgent(spec, { outPath: resolve7(o.out), includeSecrets: o.includeSecrets, includeFiles: o.includeFiles, includeSensitiveFiles: o.includeSensitiveFiles, components: components(o.components), format: o.format === "jetpack" ? "interchange" : "nomad", sign: o.sign });
10069
10285
  print(out(), () => [green("Exported") + ` ${r.path}`, ...r.receipt.signedBy ? [`Signed with your key ${r.receipt.signedBy}`] : [], ...r.receipt.notIncluded.length ? [yellow(`Not representable in this format: ${r.receipt.notIncluded.join(", ")}`)] : [], `${r.files.size} files, ${r.bytes.length} bytes`, ...r.sanitize.redactedText || r.sanitize.strippedEnvValues.length ? [yellow(`${r.sanitize.redactedText} secret(s) redacted, ${r.sanitize.strippedEnvValues.length} credential(s) replaced by references`)] : [], ...r.sanitize.removedFiles.length ? [yellow(`Left out credential files: ${r.sanitize.removedFiles.join(", ")}`)] : [], ...r.sanitize.walletKeysKept ? [yellow(`Left out ${r.sanitize.walletKeysKept} wallet key(s) or recovery phrase(s): Nomad never stores them as values, even with --include-secrets.`)] : []], r.receipt);
10070
10286
  })
10071
10287
  );
@@ -10073,7 +10289,7 @@ approvalOptions(
10073
10289
  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")
10074
10290
  ).action(
10075
10291
  (pkg, o) => run2(async (nomad) => {
10076
- const path = resolve6(pkg);
10292
+ const path = resolve7(pkg);
10077
10293
  const r = await nomad.importPackage({ path });
10078
10294
  if (!r.ok) {
10079
10295
  print(out(), () => [red("The package was rejected"), ...r.issues.map((i) => ` ${i.path}: ${i.message}`)], r);
@@ -10105,7 +10321,7 @@ approvalOptions(
10105
10321
  })
10106
10322
  );
10107
10323
  function parseDestination(spec) {
10108
- if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path: resolve6(spec.replace(/^~(?=$|\/)/, process.env.HOME ?? "~")) };
10324
+ if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path: resolve7(spec.replace(/^~(?=$|\/)/, process.env.HOME ?? "~")) };
10109
10325
  const m = /^([a-z0-9-]+)(?::(.*?))?(?:#(.+))?$/.exec(spec);
10110
10326
  const adapter = m ? findAdapter(m[1]) : void 0;
10111
10327
  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.`);
@@ -10142,8 +10358,8 @@ program.command("keys").description("show your signing key, and the keys you tru
10142
10358
  );
10143
10359
  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(
10144
10360
  (pkg, o) => run2(async (nomad) => {
10145
- const { readFileSync: readFileSync5 } = await import("fs");
10146
- const k = nomad.trustPackageSigner(new Uint8Array(readFileSync5(resolve6(pkg))), o.name);
10361
+ const { readFileSync: readFileSync6 } = await import("fs");
10362
+ const k = nomad.trustPackageSigner(new Uint8Array(readFileSync6(resolve7(pkg))), o.name);
10147
10363
  print(out(), () => [green("Trusted") + ` ${k.fingerprint} ${k.name}`, dim("Check this fingerprint with them through another channel.")], k);
10148
10364
  })
10149
10365
  );
@@ -10251,7 +10467,7 @@ remote.command("push <source>").description("export locally, copy over SSH, and
10251
10467
  (source, o) => run2(async (nomad) => {
10252
10468
  const spec = await parseSource(nomad, source);
10253
10469
  const tmp = await makeTempDir("nomad-remote-");
10254
- const exp = await nomad.exportAgent(spec, { outPath: join19(tmp, "agent.nomad") });
10470
+ const exp = await nomad.exportAgent(spec, { outPath: join20(tmp, "agent.nomad") });
10255
10471
  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 });
10256
10472
  print(out(), () => typeof r.result === "string" ? r.result : r.result.receipt ? receiptText(r.result.receipt) : planText(r.result.plan, out().verbose), r.result);
10257
10473
  return r.code;
@@ -10260,10 +10476,10 @@ remote.command("push <source>").description("export locally, copy over SSH, and
10260
10476
  program.command("schema").description("write the Universal Agent Format JSON Schemas").option("-o, --out <dir>", "output directory", ".").action(
10261
10477
  (o) => run2(async () => {
10262
10478
  const s = jsonSchemas();
10263
- const dir = resolve6(o.out);
10264
- mkdirSync3(dir, { recursive: true });
10265
- writeFileSync3(join19(dir, "agent-document.schema.json"), JSON.stringify(s.agentDocument, null, 2));
10266
- writeFileSync3(join19(dir, "package-manifest.schema.json"), JSON.stringify(s.packageManifest, null, 2));
10479
+ const dir = resolve7(o.out);
10480
+ mkdirSync4(dir, { recursive: true });
10481
+ writeFileSync4(join20(dir, "agent-document.schema.json"), JSON.stringify(s.agentDocument, null, 2));
10482
+ writeFileSync4(join20(dir, "package-manifest.schema.json"), JSON.stringify(s.packageManifest, null, 2));
10267
10483
  print(out(), () => `Wrote schemas to ${dir}`, { dir });
10268
10484
  })
10269
10485
  );
@@ -10285,27 +10501,99 @@ program.command("mcp").description("run the Nomad MCP server on stdio").option("
10285
10501
  const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_src9(), src_exports4));
10286
10502
  await startMcpServer2({ home: program.opts().home, allowWrites: !!o.allowWrites, allowReplace: !!o.allowReplace && !!o.allowWrites });
10287
10503
  });
10288
- 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) => {
10289
- const here = dirname6(fileURLToPath(import.meta.url));
10290
- const token = randomBytes3(24).toString("base64url");
10291
- const port = Number(o.port);
10292
- const url = `http://127.0.0.1:${port}/app/session?token=${token}`;
10504
+ program.command("update").description("update Nomad to the newest version (when installed from thenomad.website)").option("--check", "only check whether a newer version exists").option("-y, --yes", "update without asking").action(async (o) => {
10505
+ const install = currentInstall();
10506
+ if (!install) {
10507
+ const npx = process.env.npm_command === "exec";
10508
+ process.stderr.write(
10509
+ npx ? `npx runs the newest version each time, or add @latest: ${bold("npx thenomad@latest")}
10510
+ ` : `This copy of Nomad was not installed with the installer from thenomad.website.
10511
+ If you installed it with npm, update with: ${bold("npm install -g thenomad@latest")}
10512
+ `
10513
+ );
10514
+ return;
10515
+ }
10516
+ try {
10517
+ const c2 = await checkForUpdate(install);
10518
+ if (!c2.available) {
10519
+ process.stderr.write(`${green("Nomad is up to date")} (${install.version}).
10520
+ `);
10521
+ return;
10522
+ }
10523
+ process.stderr.write(`Nomad ${bold(c2.latest)} is available. You have ${install.version}.
10524
+ `);
10525
+ if (o.check) return;
10526
+ if (!o.yes && !await confirm("Update now?", true)) {
10527
+ process.exitCode = EXIT.approval;
10528
+ return;
10529
+ }
10530
+ const v = await applyUpdate(install, c2.latest, (l) => process.stderr.write(dim(l) + "\n"));
10531
+ process.stderr.write(`${green("Updated")} to Nomad ${v}. If the dashboard is open, close it and open Nomad again.
10532
+ `);
10533
+ } catch (e) {
10534
+ process.stderr.write(red("Error: ") + e.message + "\n");
10535
+ process.exitCode = EXIT.error;
10536
+ }
10537
+ });
10538
+ program.command("uninstall").description("remove Nomad from this computer (your agents are not touched)").option("-y, --yes", "do not ask; keeps your library, backups and history").option("--remove-data", "also delete the library, backups and history").action(async (o) => {
10539
+ const install = currentInstall();
10540
+ const dataDir = program.opts().home ? resolve7(program.opts().home) : nomadHome();
10541
+ if (!install) {
10542
+ process.stderr.write(
10543
+ `This copy of Nomad was not installed with the installer from thenomad.website.
10544
+ If you installed it with npm, remove it with: ${bold("npm uninstall -g thenomad")}
10545
+ Your library, backups and history stay in ${displayPath(dataDir)} until you delete that folder.
10546
+ `
10547
+ );
10548
+ return;
10549
+ }
10550
+ let removeData = !!o.removeData;
10551
+ if (!o.yes) {
10552
+ if (!process.stdin.isTTY) {
10553
+ process.stderr.write(`Run ${bold("nomad uninstall --yes")} to remove Nomad without questions.
10554
+ `);
10555
+ process.exitCode = EXIT.approval;
10556
+ return;
10557
+ }
10558
+ process.stderr.write(`This removes Nomad ${install.version} from ${displayPath(install.root)}, with its shortcut and the nomad command.
10559
+ Your agents are not touched.
10560
+ `);
10561
+ if (!await confirm("Remove Nomad?")) {
10562
+ process.exitCode = EXIT.approval;
10563
+ return;
10564
+ }
10565
+ if (!removeData && existsSync7(join20(dataDir, "nomad.db"))) removeData = await confirm(`Also delete the library, backups and history in ${displayPath(dataDir)}? Backups cannot be restored after this.`);
10566
+ }
10567
+ if (!runUninstaller(install, { removeData, dataDir })) {
10568
+ process.stderr.write(red("Error: ") + `The uninstaller is missing from ${displayPath(join20(install.root, "bin"))}. Delete ${displayPath(install.root)} to remove Nomad.
10569
+ `);
10570
+ process.exitCode = EXIT.error;
10571
+ return;
10572
+ }
10573
+ if (process.platform === "win32") process.stderr.write(`${green("Removing Nomad.")} It will be gone in a few seconds.${removeData ? "" : ` Your library, backups and history stay in ${displayPath(dataDir)}.`}
10574
+ `);
10575
+ });
10576
+ 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").addOption(new Option("--app").hideHelp()).action(async (o) => {
10577
+ const here = dirname7(fileURLToPath(import.meta.url));
10578
+ const token = randomBytes4(24).toString("base64url");
10579
+ let port = Number(o.port);
10580
+ let url = `http://127.0.0.1:${port}/app/session?token=${token}`;
10293
10581
  const openBrowser = () => {
10294
10582
  if (!o.open) return;
10295
10583
  const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
10296
10584
  spawn2(cmd, args, { stdio: "ignore", detached: true }).on("error", () => void 0).unref();
10297
10585
  };
10298
10586
  if (o.dev) {
10299
- const webDir = [resolve6(here, "../../web"), resolve6(process.cwd(), "apps/web")].find((d) => existsSync6(join19(d, "package.json")));
10587
+ const webDir = [resolve7(here, "../../web"), resolve7(process.cwd(), "apps/web")].find((d) => existsSync7(join20(d, "package.json")));
10300
10588
  if (!webDir) {
10301
10589
  process.stderr.write(red("--dev needs the repository checkout.\n"));
10302
10590
  process.exitCode = 1;
10303
10591
  return;
10304
10592
  }
10305
- const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ? resolve6(program.opts().home) : nomadHome(), PORT: String(port) };
10593
+ const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ? resolve7(program.opts().home) : nomadHome(), PORT: String(port) };
10306
10594
  process.stderr.write(`${bold("Nomad")} dev server at ${url}
10307
10595
  `);
10308
- 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"] });
10596
+ const child = spawn2(process.execPath, [join20(webDir, "node_modules", "next", "dist", "bin", "next"), "dev", "-H", "127.0.0.1", "-p", String(port)], { cwd: webDir, env, stdio: ["ignore", "inherit", "inherit"] });
10309
10597
  setTimeout(openBrowser, 2500);
10310
10598
  child.on("exit", (code) => process.exitCode = code ?? 0);
10311
10599
  return;
@@ -10318,7 +10606,16 @@ program.command("ui").description("open the dashboard in your browser (only this
10318
10606
  }
10319
10607
  const nomad = engine();
10320
10608
  try {
10321
- await startUi({ nomad, site, port, token });
10609
+ for (let tries = 0; ; tries++) {
10610
+ try {
10611
+ await startUi({ nomad, site, port, token, appUpdates: !!currentInstall() });
10612
+ break;
10613
+ } catch (e) {
10614
+ if (!o.app || tries >= 20 || e.code !== "EADDRINUSE") throw e;
10615
+ port += 1;
10616
+ url = `http://127.0.0.1:${port}/app/session?token=${token}`;
10617
+ }
10618
+ }
10322
10619
  } catch (e) {
10323
10620
  nomad.close();
10324
10621
  const busy = e.code === "EADDRINUSE";
@@ -10327,9 +10624,11 @@ program.command("ui").description("open the dashboard in your browser (only this
10327
10624
  process.exitCode = 1;
10328
10625
  return;
10329
10626
  }
10330
- process.stderr.write(`${bold("Nomad")} is open at ${url}
10331
- ${dim("Only this computer can reach it. Press Ctrl+C to stop.")}
10332
- `);
10627
+ process.stderr.write(
10628
+ `${bold("Nomad")} is open at ${url}
10629
+ ${dim(o.app ? "Only this computer can reach it. Keep this window open while you use Nomad, and close it to stop." : "Only this computer can reach it. Press Ctrl+C to stop.")}
10630
+ `
10631
+ );
10333
10632
  openBrowser();
10334
10633
  const stop = () => {
10335
10634
  nomad.close();
@@ -10368,8 +10667,8 @@ async function guided(nomad) {
10368
10667
  if (items.length === 1) process.stderr.write(dim("No agents were found at the usual places. You can open a package file.") + "\n");
10369
10668
  const pick = await choose(rl, "Which agent?", items);
10370
10669
  if (pick === "file") {
10371
- const path = resolve6((await rl.question("Path to the file: ")).trim().replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
10372
- if (!existsSync6(path)) throw new NomadError(`There is no file at ${path}.`, "not-found");
10670
+ const path = resolve7((await rl.question("Path to the file: ")).trim().replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
10671
+ if (!existsSync7(path)) throw new NomadError(`There is no file at ${path}.`, "not-found");
10373
10672
  source = { kind: "package", path };
10374
10673
  from = null;
10375
10674
  } else {
@@ -10391,7 +10690,7 @@ async function guided(nomad) {
10391
10690
  const name = (await nomad.loadSource(source).catch(() => null))?.doc.name ?? "agent";
10392
10691
  const def = `./${name.replace(/[^A-Za-z0-9._-]+/g, "-")}.nomad`;
10393
10692
  const a = (await rl.question(`Save to ${dim(`[${def}]`)}: `)).trim();
10394
- dest = { kind: "file", path: resolve6(a || def) };
10693
+ dest = { kind: "file", path: resolve7(a || def) };
10395
10694
  } else {
10396
10695
  const info = getAdapter(where).info;
10397
10696
  const def = info.defaultLocations[0] ?? displayPath(process.cwd());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thenomad",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Move AI agents between OpenClaw, Claude Code, Codex, Hermes and more, with a preview, a backup and one question.",
5
5
  "keywords": [
6
6
  "ai",