thenomad 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nomad.js +314 -48
- package/package.json +1 -1
- package/web/404.html +1 -1
- package/web/__next.__PAGE__.txt +5 -5
- package/web/__next._full.txt +5 -5
- package/web/__next._tree.txt +1 -1
- package/web/_next/static/chunks/{1119s7y-irwgs.js → 2ey6g40ex3wx5.js} +1 -1
- package/web/_next/static/chunks/3u5lly_m8hc-w.js +1 -0
- package/web/_not-found/__next._full.txt +1 -1
- package/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/web/_not-found/__next._tree.txt +1 -1
- package/web/_not-found.html +1 -1
- package/web/_not-found.txt +1 -1
- package/web/app/__next._full.txt +1 -1
- package/web/app/__next._tree.txt +1 -1
- package/web/app/__next.app.__PAGE__.txt +1 -1
- package/web/app/__next.app.txt +1 -1
- package/web/app/agents/__next._full.txt +1 -1
- package/web/app/agents/__next._tree.txt +1 -1
- package/web/app/agents/__next.app.agents.__PAGE__.txt +1 -1
- package/web/app/agents/__next.app.txt +1 -1
- package/web/app/agents/view/__next._full.txt +1 -1
- package/web/app/agents/view/__next._tree.txt +1 -1
- package/web/app/agents/view/__next.app.agents.view.__PAGE__.txt +1 -1
- package/web/app/agents/view/__next.app.txt +1 -1
- package/web/app/agents/view.html +1 -1
- package/web/app/agents/view.txt +1 -1
- package/web/app/agents.html +1 -1
- package/web/app/agents.txt +1 -1
- package/web/app/backups/__next._full.txt +1 -1
- package/web/app/backups/__next._tree.txt +1 -1
- package/web/app/backups/__next.app.backups.__PAGE__.txt +1 -1
- package/web/app/backups/__next.app.txt +1 -1
- package/web/app/backups.html +1 -1
- package/web/app/backups.txt +1 -1
- package/web/app/compatibility/__next._full.txt +3 -3
- package/web/app/compatibility/__next._tree.txt +1 -1
- package/web/app/compatibility/__next.app.compatibility.__PAGE__.txt +3 -3
- package/web/app/compatibility/__next.app.txt +1 -1
- package/web/app/compatibility.html +1 -1
- package/web/app/compatibility.txt +3 -3
- package/web/app/export/__next._full.txt +3 -3
- package/web/app/export/__next._tree.txt +1 -1
- package/web/app/export/__next.app.export.__PAGE__.txt +3 -3
- package/web/app/export/__next.app.txt +1 -1
- package/web/app/export.html +1 -1
- package/web/app/export.txt +3 -3
- package/web/app/history/__next._full.txt +3 -3
- package/web/app/history/__next._tree.txt +1 -1
- package/web/app/history/__next.app.history.__PAGE__.txt +3 -3
- package/web/app/history/__next.app.txt +1 -1
- package/web/app/history.html +1 -1
- package/web/app/history.txt +3 -3
- package/web/app/import/__next._full.txt +1 -1
- package/web/app/import/__next._tree.txt +1 -1
- package/web/app/import/__next.app.import.__PAGE__.txt +1 -1
- package/web/app/import/__next.app.txt +1 -1
- package/web/app/import.html +1 -1
- package/web/app/import.txt +1 -1
- package/web/app/migrate/__next._full.txt +3 -3
- package/web/app/migrate/__next._tree.txt +1 -1
- package/web/app/migrate/__next.app.migrate.__PAGE__.txt +3 -3
- package/web/app/migrate/__next.app.txt +1 -1
- package/web/app/migrate.html +1 -1
- package/web/app/migrate.txt +3 -3
- package/web/app/settings/__next._full.txt +1 -1
- package/web/app/settings/__next._tree.txt +1 -1
- package/web/app/settings/__next.app.settings.__PAGE__.txt +1 -1
- package/web/app/settings/__next.app.txt +1 -1
- package/web/app/settings.html +1 -1
- package/web/app/settings.txt +1 -1
- package/web/app/versions/__next._full.txt +1 -1
- package/web/app/versions/__next._tree.txt +1 -1
- package/web/app/versions/__next.app.txt +1 -1
- package/web/app/versions/__next.app.versions.__PAGE__.txt +1 -1
- package/web/app/versions.html +1 -1
- package/web/app/versions.txt +1 -1
- package/web/app.html +1 -1
- package/web/app.txt +1 -1
- package/web/docs/__next._full.txt +1 -1
- package/web/docs/__next._tree.txt +1 -1
- package/web/docs/__next.docs.__PAGE__.txt +1 -1
- package/web/docs/adapters/__next._full.txt +20 -16
- package/web/docs/adapters/__next._tree.txt +1 -1
- package/web/docs/adapters/__next.docs.adapters.__PAGE__.txt +18 -14
- package/web/docs/adapters.html +1 -1
- package/web/docs/adapters.txt +20 -16
- package/web/docs/format/__next._full.txt +1 -1
- package/web/docs/format/__next._tree.txt +1 -1
- package/web/docs/format/__next.docs.format.__PAGE__.txt +1 -1
- package/web/docs/format.html +1 -1
- package/web/docs/format.txt +1 -1
- package/web/docs/security/__next._full.txt +1 -1
- package/web/docs/security/__next._tree.txt +1 -1
- package/web/docs/security/__next.docs.security.__PAGE__.txt +1 -1
- package/web/docs/security.html +1 -1
- package/web/docs/security.txt +1 -1
- package/web/docs/token/__next._full.txt +1 -1
- package/web/docs/token/__next._tree.txt +1 -1
- package/web/docs/token/__next.docs.token.__PAGE__.txt +1 -1
- package/web/docs/token.html +1 -1
- package/web/docs/token.txt +1 -1
- package/web/docs.html +1 -1
- package/web/docs.txt +1 -1
- package/web/index.html +2 -2
- package/web/index.txt +5 -5
- package/web/inspect/__next._full.txt +3 -3
- package/web/inspect/__next._tree.txt +1 -1
- package/web/inspect/__next.inspect.__PAGE__.txt +3 -3
- package/web/inspect.html +1 -1
- package/web/inspect.txt +3 -3
- package/web/privacy/__next._full.txt +1 -1
- package/web/privacy/__next._tree.txt +1 -1
- package/web/privacy/__next.privacy.__PAGE__.txt +1 -1
- package/web/privacy.html +1 -1
- package/web/privacy.txt +1 -1
- package/web/terms/__next._full.txt +1 -1
- package/web/terms/__next._tree.txt +1 -1
- package/web/terms/__next.terms.__PAGE__.txt +1 -1
- package/web/terms.html +1 -1
- package/web/terms.txt +1 -1
- package/web/vote/__next._full.txt +1 -1
- package/web/vote/__next._tree.txt +1 -1
- package/web/vote/__next.vote.__PAGE__.txt +1 -1
- package/web/vote.html +1 -1
- package/web/vote.txt +1 -1
- package/web/_next/static/chunks/0zu_3pbq18_tq.js +0 -1
- /package/web/_next/static/{rNLVbnwje7eCRAa4cBuY9 → 17hXNNJlnLuiGSqi7wSeA}/_buildManifest.js +0 -0
- /package/web/_next/static/{rNLVbnwje7eCRAa4cBuY9 → 17hXNNJlnLuiGSqi7wSeA}/_clientMiddlewareManifest.js +0 -0
- /package/web/_next/static/{rNLVbnwje7eCRAa4cBuY9 → 17hXNNJlnLuiGSqi7wSeA}/_ssgManifest.js +0 -0
package/dist/nomad.js
CHANGED
|
@@ -905,10 +905,10 @@ function mergeEntries(existing, incoming, delimiter) {
|
|
|
905
905
|
a.push(e);
|
|
906
906
|
added++;
|
|
907
907
|
}
|
|
908
|
-
const
|
|
908
|
+
const sep6 = delimiter.trim() === delimiter ? `
|
|
909
909
|
${delimiter}
|
|
910
910
|
` : delimiter;
|
|
911
|
-
return { value: a.join(
|
|
911
|
+
return { value: a.join(sep6) + (a.length ? "\n" : ""), added, duplicates };
|
|
912
912
|
}
|
|
913
913
|
var init_merge = __esm({
|
|
914
914
|
"../../packages/core/src/merge.ts"() {
|
|
@@ -928,7 +928,7 @@ var init_src2 = __esm({
|
|
|
928
928
|
init_markdown();
|
|
929
929
|
init_document();
|
|
930
930
|
init_merge();
|
|
931
|
-
NOMAD_VERSION = "0.5.
|
|
931
|
+
NOMAD_VERSION = "0.5.2";
|
|
932
932
|
NomadError = class extends Error {
|
|
933
933
|
constructor(message, code, hint) {
|
|
934
934
|
super(message);
|
|
@@ -979,9 +979,15 @@ var init_keymaterial = __esm({
|
|
|
979
979
|
/(^|\/)\.hedgehood(\/|$)/,
|
|
980
980
|
// BrainChain: the payer and worker key files and the daily spending record (~/.brainchain), and the worker's state.
|
|
981
981
|
/(^|\/)\.brainchain(\/|$)/,
|
|
982
|
-
/(^|\/)\.config\/brainchain-worker(\/|$)
|
|
982
|
+
/(^|\/)\.config\/brainchain-worker(\/|$)/,
|
|
983
|
+
// Rushr: the agent wallet made by create_wallet, the registered API key and the daily spend ledger.
|
|
984
|
+
/(^|\/)\.rushr(\/|$)/
|
|
985
|
+
];
|
|
986
|
+
KEY_MATERIAL_FILES = [
|
|
987
|
+
/(^|\/)agent(-\d+)?\.key$/,
|
|
988
|
+
// Rushr's and its Talos example agent's wallet file ({ "privateKey": ... }), wherever it is kept.
|
|
989
|
+
/(^|\/)\.?agent-wallet\.json$/
|
|
983
990
|
];
|
|
984
|
-
KEY_MATERIAL_FILES = [/(^|\/)agent(-\d+)?\.key$/];
|
|
985
991
|
skipped = /* @__PURE__ */ new Set();
|
|
986
992
|
}
|
|
987
993
|
});
|
|
@@ -3406,7 +3412,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
|
|
|
3406
3412
|
if (keys.length > 1) {
|
|
3407
3413
|
for (const k of keys) delete env[k];
|
|
3408
3414
|
out2.manualSteps.push(
|
|
3409
|
-
`"${tool.name}" listed both ${keys.join(" and ")}, which ${profile.id === "priors"
|
|
3415
|
+
`"${tool.name}" listed both ${keys.join(" and ")}, which ${profile.id === "priors" || profile.id === "rushr" ? profile.vendor : "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]}.`
|
|
3410
3416
|
);
|
|
3411
3417
|
}
|
|
3412
3418
|
for (const k of profile.keyVars) {
|
|
@@ -3439,7 +3445,7 @@ function applyKnownServerProfile(tool, platformName = "the destination") {
|
|
|
3439
3445
|
function knownServerId(tool) {
|
|
3440
3446
|
return PROFILES.find((p) => p.matches(tool))?.id ?? null;
|
|
3441
3447
|
}
|
|
3442
|
-
var NPM_SPEC, escapeRe2, isPackageArg, isPackageInScript, isPriorsPackage, isPriorsScript, isPriorsHost, PRIORS, isOakCommand, OAK, HEDGEHOOD_HOSTS, isHedgehoodHost, isHedgehoodCommand, HEDGEHOOD_KEY_VARS, HEDGEHOOD, BRAINCHAIN_PKG, isBrainChainCommand, literal, amount, BRAINCHAIN, PROFILES;
|
|
3448
|
+
var NPM_SPEC, escapeRe2, isPackageArg, isPackageInScript, isPriorsPackage, isPriorsScript, isPriorsHost, PRIORS, isOakCommand, OAK, HEDGEHOOD_HOSTS, isHedgehoodHost, isHedgehoodCommand, HEDGEHOOD_KEY_VARS, HEDGEHOOD, BRAINCHAIN_PKG, isBrainChainCommand, literal, amount, BRAINCHAIN, isHeyHost, isHeyCommand, isHeyPackage, HEY_API, HEY, isRushrCommand, isRushrPackage, RUSHR_LIMITS, RUSHR, PROFILES;
|
|
3443
3449
|
var init_known_servers = __esm({
|
|
3444
3450
|
"../../packages/adapters/src/known-servers.ts"() {
|
|
3445
3451
|
"use strict";
|
|
@@ -3711,7 +3717,132 @@ var init_known_servers = __esm({
|
|
|
3711
3717
|
}
|
|
3712
3718
|
}
|
|
3713
3719
|
};
|
|
3714
|
-
|
|
3720
|
+
isHeyHost = (url) => {
|
|
3721
|
+
if (!url) return false;
|
|
3722
|
+
try {
|
|
3723
|
+
const u = new URL(url);
|
|
3724
|
+
return u.protocol === "https:" && u.hostname === "heyresearch.xyz" && !u.port && /^\/mcp(\/research)?\/?$/.test(u.pathname);
|
|
3725
|
+
} catch {
|
|
3726
|
+
return false;
|
|
3727
|
+
}
|
|
3728
|
+
};
|
|
3729
|
+
isHeyCommand = (command) => !!command && /(^|[\\/])hey-research-mcp(\.cmd|\.exe)?$/i.test(command);
|
|
3730
|
+
isHeyPackage = isPackageArg("@hey-research-lab/mcp");
|
|
3731
|
+
HEY_API = "https://heyresearch.xyz";
|
|
3732
|
+
HEY = {
|
|
3733
|
+
id: "hey-research",
|
|
3734
|
+
vendor: "HEY Research Lab",
|
|
3735
|
+
label: "HEY Research Lab (read-only research on Robinhood Chain projects)",
|
|
3736
|
+
matches: (t) => !!t.mcp && (isHeyHost(t.mcp.url) || isHeyCommand(t.mcp.command) || t.mcp.args.some(isHeyPackage)),
|
|
3737
|
+
keyVars: [],
|
|
3738
|
+
emptyOkEnv: [],
|
|
3739
|
+
limitVars: [],
|
|
3740
|
+
looserDefaults: {},
|
|
3741
|
+
apply(t, out2, platform) {
|
|
3742
|
+
const mcp = t.mcp;
|
|
3743
|
+
const lit = (k) => {
|
|
3744
|
+
const v = mcp.env[k];
|
|
3745
|
+
return v && "value" in v ? v.value.trim() : void 0;
|
|
3746
|
+
};
|
|
3747
|
+
if (mcp.transport !== "stdio") {
|
|
3748
|
+
const research = /\/mcp\/research\/?$/.test(new URL(mcp.url).pathname);
|
|
3749
|
+
out2.notes.push({
|
|
3750
|
+
level: "info",
|
|
3751
|
+
category: "tools",
|
|
3752
|
+
message: `"${t.name}" is HEY Research Lab's hosted, read-only server${research ? " (the research profile: builder research, without market tools)" : ""}. It needs no key and no wallet; Nomad copies its address.`
|
|
3753
|
+
});
|
|
3754
|
+
if (Object.keys(mcp.headers ?? {}).some((h) => h.toLowerCase() === "authorization")) {
|
|
3755
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" used a HEY API key in its Authorization header. Keys are never copied: set it again on ${platform} as "Bearer <your key>" (the key is on heyresearch.xyz/account), or leave it out to use HEY without a key.` });
|
|
3756
|
+
}
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" runs HEY Research Lab's read-only server on this computer. It needs no wallet; an API key is optional.` });
|
|
3760
|
+
if (mcp.env.HEY_API_KEY) {
|
|
3761
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" used a HEY API key (HEY_API_KEY). Keys are never copied: set it again on ${platform} (it is on heyresearch.xyz/account), or leave it out to use HEY without a key.` });
|
|
3762
|
+
}
|
|
3763
|
+
const api = mcp.env.HEY_API_URL;
|
|
3764
|
+
const apiValue = lit("HEY_API_URL");
|
|
3765
|
+
if (apiValue !== void 0 && apiValue.replace(/\/+$/, "") !== HEY_API) {
|
|
3766
|
+
out2.notes.push({
|
|
3767
|
+
level: "warning",
|
|
3768
|
+
category: "tools",
|
|
3769
|
+
message: `"${t.name}" reads ${apiValue} instead of ${HEY_API} (HEY_API_URL). Its API key, if it has one, is sent there too. Keep it only if you trust that address.`
|
|
3770
|
+
});
|
|
3771
|
+
} else if (api && !("value" in api)) {
|
|
3772
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" takes the HEY address it reads from HEY_API_URL, which was a variable on the source. Without it on ${platform}, it reads ${HEY_API}.` });
|
|
3773
|
+
}
|
|
3774
|
+
if (lit("HEY_MCP_PROFILE")?.toLowerCase() === "research") {
|
|
3775
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" serves HEY's research profile (HEY_MCP_PROFILE=research): builder research, without market tools.` });
|
|
3776
|
+
}
|
|
3777
|
+
if (isHeyCommand(mcp.command)) {
|
|
3778
|
+
out2.manualSteps.push(`Install HEY Research Lab's MCP server for "${t.name}": npm install -g @hey-research-lab/mcp. It needs Node.js 20 or later, and the hey-research-mcp command must be on the PATH ${platform} uses.`);
|
|
3779
|
+
} else {
|
|
3780
|
+
out2.manualSteps.push(`"${t.name}" runs HEY Research Lab's server through npx: ${platform} needs Node.js 20 or later on its PATH.`);
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
};
|
|
3784
|
+
isRushrCommand = (command) => !!command && /(^|[\\/])rushr-mcp(\.cmd|\.exe)?$/i.test(command);
|
|
3785
|
+
isRushrPackage = isPackageArg("@rushr/mcp");
|
|
3786
|
+
RUSHR_LIMITS = ["RUSHR_MAX_TRADE_USD", "RUSHR_DAILY_USD", "RUSHR_DRY_RUN", "RUSHR_MAX_SIZE_IMPACT_BPS", "RUSHR_MAX_TOTAL_IMPACT_BPS", "RUSHR_SLIPPAGE_BPS", "RUSHR_GAS_RESERVE_ETH", "RUSHR_STATE_DIR"];
|
|
3787
|
+
RUSHR = {
|
|
3788
|
+
id: "rushr",
|
|
3789
|
+
vendor: "Rushr",
|
|
3790
|
+
label: "Rushr (a social trading terminal for humans and AI agents on Robinhood Chain)",
|
|
3791
|
+
matches: (t) => !!t.mcp && t.mcp.transport === "stdio" && (isRushrCommand(t.mcp.command) || t.mcp.args.some(isRushrPackage)),
|
|
3792
|
+
keyVars: ["RUSHR_WALLET_FILE", "RUSHR_PRIVATE_KEY"],
|
|
3793
|
+
emptyOkEnv: [],
|
|
3794
|
+
limitVars: RUSHR_LIMITS,
|
|
3795
|
+
looserDefaults: {
|
|
3796
|
+
RUSHR_MAX_TRADE_USD: "$10 per buy",
|
|
3797
|
+
RUSHR_DAILY_USD: "$50 per 24 hours",
|
|
3798
|
+
RUSHR_DRY_RUN: "real trades, signed and sent",
|
|
3799
|
+
RUSHR_MAX_SIZE_IMPACT_BPS: "3% price impact from the trade's size",
|
|
3800
|
+
RUSHR_MAX_TOTAL_IMPACT_BPS: "5% total price impact",
|
|
3801
|
+
RUSHR_SLIPPAGE_BPS: "1.5% slippage",
|
|
3802
|
+
RUSHR_GAS_RESERVE_ETH: "0.001 ETH kept for gas",
|
|
3803
|
+
RUSHR_STATE_DIR: "~/.rushr"
|
|
3804
|
+
},
|
|
3805
|
+
apply(t, out2, platform) {
|
|
3806
|
+
const mcp = t.mcp;
|
|
3807
|
+
const lit = (k) => {
|
|
3808
|
+
const v = mcp.env[k];
|
|
3809
|
+
return v && "value" in v ? v.value.trim() : void 0;
|
|
3810
|
+
};
|
|
3811
|
+
out2.notes.push({
|
|
3812
|
+
level: "info",
|
|
3813
|
+
category: "integrations",
|
|
3814
|
+
message: "Rushr's wallet, API key and daily spend record stay on this computer in ~/.rushr (and in any agent-wallet.json key file). Nomad never reads them, and never moves holdings, trades, callouts or the agent's registration."
|
|
3815
|
+
});
|
|
3816
|
+
const raw = mcp.env.RUSHR_PRIVATE_KEY;
|
|
3817
|
+
if (raw && "value" in raw) mcp.env.RUSHR_PRIVATE_KEY = { secretRef: "RUSHR_PRIVATE_KEY", redacted: true };
|
|
3818
|
+
const hadWallet = out2.unsupported.some((u) => u.item === `${t.name}: RUSHR_WALLET_FILE` || u.item === `${t.name}: RUSHR_PRIVATE_KEY`);
|
|
3819
|
+
if (!hadWallet && !mcp.env.RUSHR_WALLET_FILE && !mcp.env.RUSHR_PRIVATE_KEY) {
|
|
3820
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" names no wallet, so Rushr uses ~/.rushr/agent-wallet.json on the computer ${platform} runs on (made by its create_wallet tool). Without that file it can only read.` });
|
|
3821
|
+
}
|
|
3822
|
+
const dryRef = out2.unsupported.some((u) => u.item === `${t.name}: RUSHR_DRY_RUN`);
|
|
3823
|
+
const dry = lit("RUSHR_DRY_RUN");
|
|
3824
|
+
const perBuy = lit("RUSHR_MAX_TRADE_USD") ?? "10";
|
|
3825
|
+
const perDay = lit("RUSHR_DAILY_USD") ?? "50";
|
|
3826
|
+
if (dryRef) {
|
|
3827
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" took RUSHR_DRY_RUN from a variable on the source. Without it on ${platform}, Rushr trades for real: it signs and sends trades with real ETH on Robinhood Chain mainnet (4663). Set RUSHR_DRY_RUN=1 there to keep it in dry run.` });
|
|
3828
|
+
} else if (dry === "1") {
|
|
3829
|
+
out2.notes.push({ level: "info", category: "tools", message: `"${t.name}" is in dry run (RUSHR_DRY_RUN=1): it quotes, builds and simulates trades but never signs or sends them, and cannot register.` });
|
|
3830
|
+
} else {
|
|
3831
|
+
out2.notes.push({ level: "warning", category: "tools", message: `"${t.name}" trades real ETH on Robinhood Chain mainnet (4663): up to $${perBuy} per buy and $${perDay} per 24 hours. Set RUSHR_DRY_RUN=1 on ${platform} to try it without signing anything.` });
|
|
3832
|
+
}
|
|
3833
|
+
out2.notes.push({
|
|
3834
|
+
level: "warning",
|
|
3835
|
+
category: "tools",
|
|
3836
|
+
message: `Rushr: if ${platform} runs on another computer, the wallet and its API key do not come along, and the daily spend count starts again there. Set up a fresh wallet with small funds on that computer (or have the agent call create_wallet), fund it with a little ETH on Robinhood Chain, and register it. Its rank on the leaderboard belongs to the wallet.`
|
|
3837
|
+
});
|
|
3838
|
+
if (isRushrCommand(mcp.command)) {
|
|
3839
|
+
out2.manualSteps.push(`Install Rushr's MCP server for "${t.name}": npm install -g @rushr/mcp. It needs Node.js 20 or later, and the rushr-mcp command must be on the PATH ${platform} uses.`);
|
|
3840
|
+
} else {
|
|
3841
|
+
out2.manualSteps.push(`"${t.name}" runs Rushr through npx: ${platform} needs Node.js 20 or later on its PATH.`);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
};
|
|
3845
|
+
PROFILES = [PRIORS, OAK, HEDGEHOOD, BRAINCHAIN, HEY, RUSHR];
|
|
3715
3846
|
}
|
|
3716
3847
|
});
|
|
3717
3848
|
|
|
@@ -4074,8 +4205,9 @@ function integrationStep(i, platformName, otherwise) {
|
|
|
4074
4205
|
if (i.kind === "elizaos-plugin") {
|
|
4075
4206
|
return `${i.name} was an ElizaOS plugin. ${elizaosPluginHint(i.name)}`;
|
|
4076
4207
|
}
|
|
4077
|
-
if (i.kind === "claude-code-plugin" || i.kind === "hermes-plugin") {
|
|
4078
|
-
|
|
4208
|
+
if (i.kind === "claude-code-plugin" || i.kind === "hermes-plugin" || i.kind === "codex-plugin") {
|
|
4209
|
+
const host = i.kind === "hermes-plugin" ? "Hermes" : i.kind === "codex-plugin" ? "Codex" : "Claude Code";
|
|
4210
|
+
return `${i.name} was an installed ${host} plugin (installed plugin read, not installed). Its servers and skills are written to ${platformName} as ordinary entries where ${platformName} has a place for them.`;
|
|
4079
4211
|
}
|
|
4080
4212
|
return otherwise;
|
|
4081
4213
|
}
|
|
@@ -4947,7 +5079,8 @@ var init_claude_code = __esm({
|
|
|
4947
5079
|
P = "claude-code";
|
|
4948
5080
|
KNOWN_MARKETPLACE_REPOS = {
|
|
4949
5081
|
"oak-agent-kit": "OakAgentKit/oak",
|
|
4950
|
-
hedgehood: "0xHedgeHood/hedgehood-agent-kit"
|
|
5082
|
+
hedgehood: "0xHedgeHood/hedgehood-agent-kit",
|
|
5083
|
+
rushr: "rushr-dev/platform"
|
|
4951
5084
|
};
|
|
4952
5085
|
TOOL_CAP = {
|
|
4953
5086
|
Bash: "shell",
|
|
@@ -5059,7 +5192,8 @@ var init_claude_code = __esm({
|
|
|
5059
5192
|
});
|
|
5060
5193
|
|
|
5061
5194
|
// ../../packages/adapters/src/codex.ts
|
|
5062
|
-
import {
|
|
5195
|
+
import { realpathSync as realpathSync4 } from "fs";
|
|
5196
|
+
import { basename as basename4, join as join5, resolve as resolve3, sep as sep3 } from "path";
|
|
5063
5197
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
5064
5198
|
async function layoutOf2(root) {
|
|
5065
5199
|
const user = basename4(root) === ".codex" || await pathExists(join5(root, "config.toml"));
|
|
@@ -5075,6 +5209,104 @@ async function readConfig(path, notes) {
|
|
|
5075
5209
|
return void 0;
|
|
5076
5210
|
}
|
|
5077
5211
|
}
|
|
5212
|
+
async function readJsonFile(path, notes) {
|
|
5213
|
+
const text3 = await readTextIfExists(path);
|
|
5214
|
+
if (text3 === null) return void 0;
|
|
5215
|
+
try {
|
|
5216
|
+
return JSON.parse(text3);
|
|
5217
|
+
} catch (e) {
|
|
5218
|
+
notes.push({ level: "warning", message: `Could not parse ${path}: ${e.message}` });
|
|
5219
|
+
return void 0;
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
function codexMarketplaceSource(source) {
|
|
5223
|
+
if (typeof source !== "string" || !source) return null;
|
|
5224
|
+
const gh = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(\.git)?\/?$/.exec(source);
|
|
5225
|
+
return gh ? `${gh[1]}/${gh[2]}` : source;
|
|
5226
|
+
}
|
|
5227
|
+
async function readCodexPlugins(root, cfg, notes) {
|
|
5228
|
+
const out2 = { tools: [], skills: [], integrations: [], sourceFiles: [] };
|
|
5229
|
+
const plugins = cfg.plugins && typeof cfg.plugins === "object" ? cfg.plugins : {};
|
|
5230
|
+
const cache = join5(root, "plugins", "cache");
|
|
5231
|
+
let cacheReal;
|
|
5232
|
+
try {
|
|
5233
|
+
cacheReal = realpathSync4(cache);
|
|
5234
|
+
} catch {
|
|
5235
|
+
cacheReal = cache;
|
|
5236
|
+
}
|
|
5237
|
+
for (const [id, entry] of Object.entries(plugins)) {
|
|
5238
|
+
if (entry?.enabled === false) continue;
|
|
5239
|
+
const [name, market] = id.split("@");
|
|
5240
|
+
if (!name || !market || id.split("@").length !== 2) {
|
|
5241
|
+
notes.push({ level: "warning", category: "integrations", message: `Codex plugin ${JSON.stringify(id)} has an unexpected name, so it was not read.` });
|
|
5242
|
+
continue;
|
|
5243
|
+
}
|
|
5244
|
+
const base = join5(cache, market, name);
|
|
5245
|
+
const versions2 = (await listDir(base)).filter((e) => !e.file).map((e) => e.name).sort(byVersion);
|
|
5246
|
+
const version = versions2[versions2.length - 1];
|
|
5247
|
+
if (!version) {
|
|
5248
|
+
notes.push({ level: "warning", category: "integrations", message: `Codex plugin ${id} is enabled but its files were not found, so it was not read.` });
|
|
5249
|
+
continue;
|
|
5250
|
+
}
|
|
5251
|
+
let dir;
|
|
5252
|
+
try {
|
|
5253
|
+
dir = realpathSync4(join5(base, version));
|
|
5254
|
+
} catch {
|
|
5255
|
+
continue;
|
|
5256
|
+
}
|
|
5257
|
+
if (!dir.startsWith(cacheReal + sep3)) {
|
|
5258
|
+
notes.push({ level: "warning", category: "integrations", message: `Codex plugin ${id} points outside Codex's plugin folder, so it was not read.` });
|
|
5259
|
+
continue;
|
|
5260
|
+
}
|
|
5261
|
+
const provenance = { note: `plugin ${id}`, extra: { plugin: id, pluginHost: P2 } };
|
|
5262
|
+
let manifest = {};
|
|
5263
|
+
for (const m of ["plugin.json", ".codex-plugin/plugin.json"]) {
|
|
5264
|
+
const found = await readJsonFile(join5(dir, m), notes);
|
|
5265
|
+
if (found && typeof found === "object") {
|
|
5266
|
+
manifest = found;
|
|
5267
|
+
out2.sourceFiles.push(join5(dir, m));
|
|
5268
|
+
break;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
const servers = {};
|
|
5272
|
+
if (manifest.mcpServers && typeof manifest.mcpServers === "object") Object.assign(servers, manifest.mcpServers);
|
|
5273
|
+
const mcpFiles = typeof manifest.mcpServers === "string" ? [manifest.mcpServers] : ["mcp.json", ".mcp.json"];
|
|
5274
|
+
for (const rel of mcpFiles) {
|
|
5275
|
+
const abs = resolve3(dir, rel);
|
|
5276
|
+
if (!abs.startsWith(dir + sep3)) continue;
|
|
5277
|
+
const file = await readJsonFile(abs, notes);
|
|
5278
|
+
if (file?.mcpServers && typeof file.mcpServers === "object") {
|
|
5279
|
+
out2.sourceFiles.push(abs);
|
|
5280
|
+
Object.assign(servers, file.mcpServers);
|
|
5281
|
+
break;
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
out2.tools.push(...toolsFromMcpServers(servers, P2, `plugins/${id}`, { notes, ...provenance }));
|
|
5285
|
+
const skillDirs = Array.isArray(manifest.skills) ? manifest.skills : typeof manifest.skills === "string" ? [manifest.skills] : ["skills"];
|
|
5286
|
+
for (const rel of skillDirs) {
|
|
5287
|
+
if (typeof rel !== "string") continue;
|
|
5288
|
+
const abs = resolve3(dir, rel);
|
|
5289
|
+
if (abs !== dir && !abs.startsWith(dir + sep3)) continue;
|
|
5290
|
+
if (!await isDirectory(abs)) continue;
|
|
5291
|
+
const single = abs !== dir ? await readSkillDir(abs, P2, notes) : null;
|
|
5292
|
+
for (const sk of single ? [single] : await readSkillsTree(abs, P2, notes, 1)) {
|
|
5293
|
+
sk.source = { ...sk.source ?? { platform: P2 }, note: provenance.note, ...provenance.extra };
|
|
5294
|
+
out2.skills.push(sk);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
const source = codexMarketplaceSource(cfg.marketplaces?.[market]?.source);
|
|
5298
|
+
out2.integrations.push({
|
|
5299
|
+
name: id,
|
|
5300
|
+
kind: "codex-plugin",
|
|
5301
|
+
requiresAuth: false,
|
|
5302
|
+
config: { version: typeof manifest.version === "string" ? manifest.version : version, marketplace: market, ...source ? { marketplaceSource: source } : {}, plugin: name },
|
|
5303
|
+
notes: "Installed Codex plugin",
|
|
5304
|
+
source: { platform: P2, path: `plugins/${id}` }
|
|
5305
|
+
});
|
|
5306
|
+
notes.push({ level: "info", category: "integrations", message: `Read installed Codex plugin ${id} (installed plugin read, not installed anywhere by Nomad).` });
|
|
5307
|
+
}
|
|
5308
|
+
return out2;
|
|
5309
|
+
}
|
|
5078
5310
|
function policyFromCodexConfig(cfg) {
|
|
5079
5311
|
const rules = [];
|
|
5080
5312
|
const notes = [];
|
|
@@ -5129,7 +5361,7 @@ function codexSettingsFromPolicy(policy) {
|
|
|
5129
5361
|
}
|
|
5130
5362
|
return { settings: settings2, unenforced };
|
|
5131
5363
|
}
|
|
5132
|
-
var P2, codexAdapter;
|
|
5364
|
+
var P2, byVersion, codexAdapter;
|
|
5133
5365
|
var init_codex = __esm({
|
|
5134
5366
|
"../../packages/adapters/src/codex.ts"() {
|
|
5135
5367
|
"use strict";
|
|
@@ -5138,6 +5370,7 @@ var init_codex = __esm({
|
|
|
5138
5370
|
init_catalog();
|
|
5139
5371
|
init_util();
|
|
5140
5372
|
P2 = "codex";
|
|
5373
|
+
byVersion = (a, b) => a.localeCompare(b, void 0, { numeric: true });
|
|
5141
5374
|
codexAdapter = {
|
|
5142
5375
|
info: CODEX_INFO,
|
|
5143
5376
|
async detect(root) {
|
|
@@ -5205,6 +5438,16 @@ var init_codex = __esm({
|
|
|
5205
5438
|
if (cfg.profiles) doc.extensions["x-codex"] = { profiles: cfg.profiles };
|
|
5206
5439
|
}
|
|
5207
5440
|
doc.skills.push(...await readSkillsTree(join5(root, L.skills), P2, notes, 1));
|
|
5441
|
+
if (cfg && L.user) {
|
|
5442
|
+
const plugins = await readCodexPlugins(root, cfg, notes);
|
|
5443
|
+
for (const t of plugins.tools) {
|
|
5444
|
+
if (doc.tools.some((d) => d.name === t.name)) t.name = `${t.name}-plugin`;
|
|
5445
|
+
doc.tools.push(t);
|
|
5446
|
+
}
|
|
5447
|
+
doc.skills.push(...plugins.skills.filter((sk) => !doc.skills.some((d) => d.name === sk.name)));
|
|
5448
|
+
doc.integrations.push(...plugins.integrations);
|
|
5449
|
+
sourceFiles.push(...plugins.sourceFiles);
|
|
5450
|
+
}
|
|
5208
5451
|
for (const e of await listDir(join5(root, L.prompts))) {
|
|
5209
5452
|
if (!e.file || !e.name.endsWith(".md")) continue;
|
|
5210
5453
|
const text3 = await readTextIfExists(join5(root, L.prompts, e.name));
|
|
@@ -5244,8 +5487,16 @@ var init_codex = __esm({
|
|
|
5244
5487
|
files.push({ path: L.agentsMd, content: body2, strategy: "managed-block", blockKey: nomadBlockKey(doc), component: "instructions", description: "Agent persona, instructions and memory in a Nomad managed section of AGENTS.md" });
|
|
5245
5488
|
if (doc.identity.persona) conversions.push({ category: "identity", item: "persona", from: "persona", to: "Persona section in AGENTS.md" });
|
|
5246
5489
|
if (wants(ctx, "memory") && doc.memory.length) conversions.push({ category: "memory", item: `${doc.memory.length} entries`, from: "structured memory", to: "Memory section in AGENTS.md" });
|
|
5490
|
+
const fromPlugins = new Set([...doc.tools, ...doc.skills].map((x) => pluginOf(x, P2)).filter((x) => !!x));
|
|
5491
|
+
for (const id of fromPlugins) {
|
|
5492
|
+
const info = doc.integrations.find((i) => i.kind === "codex-plugin" && i.name === id)?.config;
|
|
5493
|
+
const source = typeof info?.marketplaceSource === "string" ? info.marketplaceSource : null;
|
|
5494
|
+
manualSteps.push(
|
|
5495
|
+
isPlainCliWord(id, "path") && source && isPlainCliWord(source, "path") ? `Install the plugin ${id} in Codex: codex plugin marketplace add ${source}, then codex plugin add ${id}. Nomad does not copy plugin servers or skills.` : `Install the plugin ${JSON.stringify(id)} in Codex from its marketplace (codex plugin add). Nomad prints no command for it${source ? ", because its name or source has characters a terminal could misread," : ", because the source did not record where its marketplace is,"} and does not copy plugin servers or skills.`
|
|
5496
|
+
);
|
|
5497
|
+
}
|
|
5247
5498
|
if (wants(ctx, "skills")) {
|
|
5248
|
-
for (const s of doc.skills) {
|
|
5499
|
+
for (const s of doc.skills.filter((x) => !pluginOf(x, P2))) {
|
|
5249
5500
|
const isCommand = s.frontmatter["x-codex-prompt"] === true || s.frontmatter["x-claude-code-command"] === true;
|
|
5250
5501
|
const { "x-codex-prompt": _p, "x-claude-code-command": _c, ...fm } = s.frontmatter;
|
|
5251
5502
|
if (isCommand) {
|
|
@@ -5277,7 +5528,7 @@ var init_codex = __esm({
|
|
|
5277
5528
|
conversions.push({ category: "permissions", item: "policy", from: "permission rules", to: `approval_policy=${p.settings.approval_policy}, sandbox_mode=${p.settings.sandbox_mode}` });
|
|
5278
5529
|
}
|
|
5279
5530
|
if (wants(ctx, "tools")) {
|
|
5280
|
-
const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp);
|
|
5531
|
+
const mcpTools = doc.tools.filter((t) => t.kind === "mcp" && t.mcp && !pluginOf(t, P2));
|
|
5281
5532
|
if (mcpTools.length) {
|
|
5282
5533
|
const r = mcpServersFromTools(mcpTools, { platformName: "Codex", envRefStyle: "none" });
|
|
5283
5534
|
const servers = {};
|
|
@@ -5309,7 +5560,7 @@ var init_codex = __esm({
|
|
|
5309
5560
|
for (const w of doc.workflows) unsupported.push({ category: "workflows", item: w.name, reason: "Codex has no scheduler." });
|
|
5310
5561
|
manualSteps.push(...workflowManualSteps(doc, "Codex"));
|
|
5311
5562
|
}
|
|
5312
|
-
if (wants(ctx, "integrations")) for (const i of doc.integrations) manualSteps.push(integrationStep(i, "Codex", `Reconnect the ${i.name} integration for Codex.`));
|
|
5563
|
+
if (wants(ctx, "integrations")) for (const i of doc.integrations.filter((x) => !(x.kind === "codex-plugin" && fromPlugins.has(x.name)))) manualSteps.push(integrationStep(i, "Codex", `Reconnect the ${i.name} integration for Codex.`));
|
|
5313
5564
|
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.`);
|
|
5314
5565
|
return { nativeId: "main", files, notes, manualSteps, conversions, unsupported };
|
|
5315
5566
|
},
|
|
@@ -6200,15 +6451,15 @@ async function planHome(doc, ctx) {
|
|
|
6200
6451
|
const user = doc.memory.filter((m) => m.scope === "user" || m.kind === "profile");
|
|
6201
6452
|
const logs = doc.memory.filter((m) => m.kind === "daily-log" || m.kind === "document");
|
|
6202
6453
|
const rest = doc.memory.filter((m) => !user.includes(m) && !logs.includes(m));
|
|
6203
|
-
const
|
|
6454
|
+
const sep6 = `
|
|
6204
6455
|
${HERMES_DELIMITER}
|
|
6205
6456
|
`;
|
|
6206
6457
|
const check = async (rel, entries, limit, label) => {
|
|
6207
6458
|
if (!entries.length) return;
|
|
6208
6459
|
const existing = splitEntries(await readTextIfExists(join7(h, rel)) ?? "");
|
|
6209
6460
|
const all = [...existing, ...entries.map((e) => plainEntry(e.content)).filter((e) => !existing.includes(e))];
|
|
6210
|
-
const size = all.join(
|
|
6211
|
-
files.push({ path: `${prefix}${rel}`, content: entries.map((e) => plainEntry(e.content)).join(
|
|
6461
|
+
const size = all.join(sep6).length;
|
|
6462
|
+
files.push({ path: `${prefix}${rel}`, content: entries.map((e) => plainEntry(e.content)).join(sep6) + "\n", strategy: "append-entries", entryDelimiter: HERMES_DELIMITER, component: "memory", description: `${entries.length} ${label} entries` });
|
|
6212
6463
|
if (size > limit) {
|
|
6213
6464
|
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.` });
|
|
6214
6465
|
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}.`);
|
|
@@ -9132,7 +9383,7 @@ __export(src_exports4, {
|
|
|
9132
9383
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9133
9384
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9134
9385
|
import { readFileSync as readFileSync5 } from "fs";
|
|
9135
|
-
import { join as join19, resolve as
|
|
9386
|
+
import { join as join19, resolve as resolve7 } from "path";
|
|
9136
9387
|
import { z as z4 } from "zod";
|
|
9137
9388
|
function text2(data) {
|
|
9138
9389
|
return { content: [{ type: "text", text: typeof data === "string" ? data : JSON.stringify(data, null, 2) }] };
|
|
@@ -9165,7 +9416,7 @@ function summarizePlan(p) {
|
|
|
9165
9416
|
};
|
|
9166
9417
|
}
|
|
9167
9418
|
function createMcpServer(options = {}) {
|
|
9168
|
-
const nomad = new Nomad({ home: options.home ?
|
|
9419
|
+
const nomad = new Nomad({ home: options.home ? resolve7(options.home) : nomadHome() });
|
|
9169
9420
|
const server = new McpServer2({ name: "nomad", version: NOMAD_VERSION });
|
|
9170
9421
|
const exportsDir = join19(nomad.store.home, "exports");
|
|
9171
9422
|
server.registerTool(
|
|
@@ -9237,7 +9488,7 @@ function createMcpServer(options = {}) {
|
|
|
9237
9488
|
{ 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
9489
|
async ({ path }) => {
|
|
9239
9490
|
try {
|
|
9240
|
-
const p =
|
|
9491
|
+
const p = resolve7(expandHome(path));
|
|
9241
9492
|
if (!/\.(nomad|agentpack|jetpack)$/.test(p)) throw new NomadError("Only .nomad, .agentpack or .jetpack files can be validated.", "usage");
|
|
9242
9493
|
const r = nomad.validatePackage(new Uint8Array(readFileSync5(p)));
|
|
9243
9494
|
return text2({ ok: r.ok, name: r.doc?.name, issues: r.issues, warnings: r.warnings, secretsFound: r.scan?.findings.length ?? 0 });
|
|
@@ -9363,7 +9614,7 @@ import { Command, Option } from "commander";
|
|
|
9363
9614
|
import { createInterface } from "readline/promises";
|
|
9364
9615
|
import { spawn as spawn2 } from "child_process";
|
|
9365
9616
|
import { existsSync as existsSync7, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
9366
|
-
import { dirname as dirname7, join as join20, resolve as
|
|
9617
|
+
import { dirname as dirname7, join as join20, resolve as resolve8 } from "path";
|
|
9367
9618
|
import { fileURLToPath } from "url";
|
|
9368
9619
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
9369
9620
|
|
|
@@ -9497,6 +9748,9 @@ function summaryText(p) {
|
|
|
9497
9748
|
if (p.conversions.length) lines.push(`Adapted: ${p.conversions.map((c2) => `${c2.item} ${dim("\u2192 " + c2.to)}`).join("; ")}.`);
|
|
9498
9749
|
if (p.unsupported.length) lines.push(yellow(`Can't move: ${p.unsupported.map((u) => u.item).join(", ")}`) + dim(" (kept in the report with setup steps)"));
|
|
9499
9750
|
if (p.disabledRoutines.length) lines.push(`Routines arrive paused: ${p.disabledRoutines.join(", ")}.`);
|
|
9751
|
+
const warns = p.notes.filter((n) => n.level === "warning" && !/cannot tell who made it/.test(n.message));
|
|
9752
|
+
for (const n of warns.slice(0, 6)) lines.push(yellow(`Warning: ${n.message}`));
|
|
9753
|
+
if (warns.length > 6) lines.push(dim(` and ${warns.length - 6} more warning${warns.length - 6 === 1 ? "" : "s"} (use --details)`));
|
|
9500
9754
|
if (p.source.signer === "unsigned" || p.source.signer === "unknown") lines.push(yellow(p.source.signer === "unsigned" ? "Not signed: Nomad cannot tell who made this package. Move it only if you trust where it came from." : "Signed by a key you have not trusted: Nomad cannot tell who made this package."));
|
|
9501
9755
|
for (const c2 of p.commands ?? []) lines.push(yellow(`Starts by itself on ${p.destination.displayName}: "${c2.tool}" runs ${c2.command}`) + (c2.env.length ? dim(` (with ${c2.env.join(", ")} set)`) : ""));
|
|
9502
9756
|
if (p.secrets.findings || p.secrets.strippedEnv.length) {
|
|
@@ -9528,14 +9782,14 @@ function shellQuote(s) {
|
|
|
9528
9782
|
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
9529
9783
|
}
|
|
9530
9784
|
function run(cmd, args, input) {
|
|
9531
|
-
return new Promise((
|
|
9785
|
+
return new Promise((resolve9, reject) => {
|
|
9532
9786
|
const p = spawn(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
9533
9787
|
let stdout = "";
|
|
9534
9788
|
let stderr = "";
|
|
9535
9789
|
p.stdout.on("data", (d) => stdout += d);
|
|
9536
9790
|
p.stderr.on("data", (d) => stderr += d);
|
|
9537
9791
|
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) =>
|
|
9792
|
+
p.on("close", (code) => resolve9({ code: code ?? 1, stdout, stderr }));
|
|
9539
9793
|
if (input) p.stdin.end(input);
|
|
9540
9794
|
else p.stdin.end();
|
|
9541
9795
|
});
|
|
@@ -9575,12 +9829,12 @@ async function remoteMigrate(o, packagePath, args) {
|
|
|
9575
9829
|
// src/ui.ts
|
|
9576
9830
|
import { createServer } from "http";
|
|
9577
9831
|
import { existsSync as existsSync6, readFileSync as readFileSync4, statSync as statSync3 } from "fs";
|
|
9578
|
-
import { extname, join as join18, normalize, resolve as
|
|
9832
|
+
import { extname, join as join18, normalize, resolve as resolve6, sep as sep5 } from "path";
|
|
9579
9833
|
|
|
9580
9834
|
// ../../packages/local/src/index.ts
|
|
9581
9835
|
import { timingSafeEqual } from "crypto";
|
|
9582
9836
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
9583
|
-
import { basename as basename10, join as join16, resolve as
|
|
9837
|
+
import { basename as basename10, join as join16, resolve as resolve4, sep as sep4 } from "path";
|
|
9584
9838
|
var SESSION_COOKIE = "nomad_session";
|
|
9585
9839
|
var HttpError = class extends Error {
|
|
9586
9840
|
constructor(status, message) {
|
|
@@ -9649,8 +9903,8 @@ function safeSource(nomadHome2, s) {
|
|
|
9649
9903
|
if (s.kind === "stored") return { kind: "stored", agentId: String(s.agentId), version: s.version ? Number(s.version) : void 0 };
|
|
9650
9904
|
if (s.kind === "package") {
|
|
9651
9905
|
const uploads = join16(nomadHome2, "uploads");
|
|
9652
|
-
const p =
|
|
9653
|
-
if (!p.startsWith(uploads +
|
|
9906
|
+
const p = resolve4(String(s.path));
|
|
9907
|
+
if (!p.startsWith(uploads + sep4) || !/\.(nomad|agentpack|jetpack)$/.test(p)) throw new HttpError(400, "Packages must be uploaded first.");
|
|
9654
9908
|
return { kind: "package", path: p };
|
|
9655
9909
|
}
|
|
9656
9910
|
throw new HttpError(400, "Unknown source kind.");
|
|
@@ -9798,7 +10052,7 @@ init_src2();
|
|
|
9798
10052
|
import { spawnSync } from "child_process";
|
|
9799
10053
|
import { createHash, randomBytes as randomBytes3 } from "crypto";
|
|
9800
10054
|
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
|
|
10055
|
+
import { basename as basename11, dirname as dirname6, join as join17, resolve as resolve5 } from "path";
|
|
9802
10056
|
var REPO = "kadiri-seer/nomad";
|
|
9803
10057
|
var VERSION_RE = /^\d+\.\d+\.\d+$/;
|
|
9804
10058
|
function currentInstall(execPath = process.execPath) {
|
|
@@ -9842,6 +10096,12 @@ async function get(url) {
|
|
|
9842
10096
|
return r;
|
|
9843
10097
|
}
|
|
9844
10098
|
async function latestVersion() {
|
|
10099
|
+
try {
|
|
10100
|
+
const page = await fetch(`https://github.com/${REPO}/releases/latest`, { method: "HEAD", redirect: "follow", headers: { "User-Agent": `nomad/${NOMAD_VERSION}` }, signal: AbortSignal.timeout(3e4) });
|
|
10101
|
+
const m = /^https:\/\/github\.com\/[^/]+\/[^/]+\/releases\/tag\/v(\d+\.\d+\.\d+)$/.exec(page.url);
|
|
10102
|
+
if (page.ok && m) return m[1];
|
|
10103
|
+
} catch {
|
|
10104
|
+
}
|
|
9845
10105
|
const data = await (await get(`https://api.github.com/repos/${REPO}/releases/latest`)).json();
|
|
9846
10106
|
const tag = typeof data.tag_name === "string" ? data.tag_name : "";
|
|
9847
10107
|
if (!/^v\d+\.\d+\.\d+$/.test(tag)) throw new Error("GitHub returned an unexpected release name. Try again later.");
|
|
@@ -9940,9 +10200,15 @@ async function applyUpdate(install, version, log = () => void 0) {
|
|
|
9940
10200
|
if (check.status !== 0 || check.stdout.trim() !== version) throw new Error(`The new version did not start correctly. Nothing was changed.${check.stderr ? `
|
|
9941
10201
|
${check.stderr.trim()}` : ""}`);
|
|
9942
10202
|
const target = join17(install.root, "app", version);
|
|
9943
|
-
if (
|
|
10203
|
+
if (resolve5(target) === resolve5(dirname6(process.execPath))) throw new Error(`Nomad ${version} is the version running now.`);
|
|
9944
10204
|
removeQuietly(target);
|
|
9945
10205
|
renameWithRetry(staged, target);
|
|
10206
|
+
for (const need of [process.platform === "win32" ? "node.exe" : "node", "launcher", join17("node_modules", "thenomad", "dist", "nomad.js")]) {
|
|
10207
|
+
if (!existsSync5(join17(target, need))) {
|
|
10208
|
+
removeQuietly(target);
|
|
10209
|
+
throw new Error(`The new version is incomplete (${need} is missing). Nothing was changed.`);
|
|
10210
|
+
}
|
|
10211
|
+
}
|
|
9946
10212
|
const launcher = join17(target, "launcher");
|
|
9947
10213
|
if (existsSync5(launcher)) {
|
|
9948
10214
|
for (const f of readdirSync(launcher)) {
|
|
@@ -9960,9 +10226,9 @@ ${check.stderr.trim()}` : ""}`);
|
|
|
9960
10226
|
const reg = join17(process.env.SystemRoot ?? "C:\\Windows", "System32", "reg.exe");
|
|
9961
10227
|
spawnSync(reg, ["add", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\thenomad.website", "/v", "DisplayVersion", "/t", "REG_SZ", "/d", version, "/f"], { stdio: "ignore" });
|
|
9962
10228
|
}
|
|
9963
|
-
const running =
|
|
10229
|
+
const running = resolve5(dirname6(process.execPath));
|
|
9964
10230
|
for (const v of readdirSync(join17(install.root, "app"))) {
|
|
9965
|
-
const dir =
|
|
10231
|
+
const dir = resolve5(install.root, "app", v);
|
|
9966
10232
|
if (v === version) continue;
|
|
9967
10233
|
if (dir === running) removeAfterExit(dir);
|
|
9968
10234
|
else removeQuietly(dir);
|
|
@@ -10011,7 +10277,7 @@ var SECURITY_HEADERS = {
|
|
|
10011
10277
|
"Permissions-Policy": "camera=(), microphone=(), geolocation=()"
|
|
10012
10278
|
};
|
|
10013
10279
|
function findSite(here) {
|
|
10014
|
-
const candidates = [
|
|
10280
|
+
const candidates = [resolve6(here, "../web"), resolve6(here, "../../web/.next-export"), resolve6(process.cwd(), "apps/web/.next-export")];
|
|
10015
10281
|
return candidates.find((d) => existsSync6(join18(d, "app.html"))) ?? null;
|
|
10016
10282
|
}
|
|
10017
10283
|
function fileFor(site, pathname) {
|
|
@@ -10023,7 +10289,7 @@ function fileFor(site, pathname) {
|
|
|
10023
10289
|
}
|
|
10024
10290
|
if (rel.includes("\0")) return null;
|
|
10025
10291
|
const base = normalize(join18(site, rel));
|
|
10026
|
-
if (base !== site && !base.startsWith(site +
|
|
10292
|
+
if (base !== site && !base.startsWith(site + sep5)) return null;
|
|
10027
10293
|
for (const p of [base, `${base}.html`, join18(base, "index.html")]) {
|
|
10028
10294
|
try {
|
|
10029
10295
|
if (statSync3(p).isFile()) return p;
|
|
@@ -10140,8 +10406,8 @@ function out() {
|
|
|
10140
10406
|
}
|
|
10141
10407
|
function engine() {
|
|
10142
10408
|
const home2 = program.opts().home;
|
|
10143
|
-
if (home2) process.env.NOMAD_HOME =
|
|
10144
|
-
return new Nomad({ home: home2 ?
|
|
10409
|
+
if (home2) process.env.NOMAD_HOME = resolve8(home2);
|
|
10410
|
+
return new Nomad({ home: home2 ? resolve8(home2) : nomadHome() });
|
|
10145
10411
|
}
|
|
10146
10412
|
function components(list) {
|
|
10147
10413
|
if (!list) return void 0;
|
|
@@ -10271,7 +10537,7 @@ program.command("inspect <source>").description("show what an agent contains (re
|
|
|
10271
10537
|
program.command("validate <package>").description("check a package (.nomad, .agentpack or .jetpack) without importing it").action(
|
|
10272
10538
|
(pkg) => run2(async (nomad) => {
|
|
10273
10539
|
const { readFileSync: readFileSync6 } = await import("fs");
|
|
10274
|
-
const r = nomad.validatePackage(new Uint8Array(readFileSync6(
|
|
10540
|
+
const r = nomad.validatePackage(new Uint8Array(readFileSync6(resolve8(pkg))));
|
|
10275
10541
|
const { describeSigner: describeSigner2 } = await Promise.resolve().then(() => (init_src8(), src_exports3));
|
|
10276
10542
|
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 ?? [] });
|
|
10277
10543
|
return r.ok ? EXIT.ok : EXIT.invalid;
|
|
@@ -10281,7 +10547,7 @@ program.command("export <source>").description("export an agent to a portable .n
|
|
|
10281
10547
|
(source, o) => run2(async (nomad) => {
|
|
10282
10548
|
const spec = await parseSource(nomad, source, { sourceDir: o.sourceDir, agent: o.agent });
|
|
10283
10549
|
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"));
|
|
10284
|
-
const r = await nomad.exportAgent(spec, { outPath:
|
|
10550
|
+
const r = await nomad.exportAgent(spec, { outPath: resolve8(o.out), includeSecrets: o.includeSecrets, includeFiles: o.includeFiles, includeSensitiveFiles: o.includeSensitiveFiles, components: components(o.components), format: o.format === "jetpack" ? "interchange" : "nomad", sign: o.sign });
|
|
10285
10551
|
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);
|
|
10286
10552
|
})
|
|
10287
10553
|
);
|
|
@@ -10289,7 +10555,7 @@ approvalOptions(
|
|
|
10289
10555
|
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")
|
|
10290
10556
|
).action(
|
|
10291
10557
|
(pkg, o) => run2(async (nomad) => {
|
|
10292
|
-
const path =
|
|
10558
|
+
const path = resolve8(pkg);
|
|
10293
10559
|
const r = await nomad.importPackage({ path });
|
|
10294
10560
|
if (!r.ok) {
|
|
10295
10561
|
print(out(), () => [red("The package was rejected"), ...r.issues.map((i) => ` ${i.path}: ${i.message}`)], r);
|
|
@@ -10321,7 +10587,7 @@ approvalOptions(
|
|
|
10321
10587
|
})
|
|
10322
10588
|
);
|
|
10323
10589
|
function parseDestination(spec) {
|
|
10324
|
-
if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path:
|
|
10590
|
+
if (/\.(nomad|jetpack)$/i.test(spec)) return { kind: "file", path: resolve8(spec.replace(/^~(?=$|\/)/, process.env.HOME ?? "~")) };
|
|
10325
10591
|
const m = /^([a-z0-9-]+)(?::(.*?))?(?:#(.+))?$/.exec(spec);
|
|
10326
10592
|
const adapter = m ? findAdapter(m[1]) : void 0;
|
|
10327
10593
|
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.`);
|
|
@@ -10359,7 +10625,7 @@ program.command("keys").description("show your signing key, and the keys you tru
|
|
|
10359
10625
|
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(
|
|
10360
10626
|
(pkg, o) => run2(async (nomad) => {
|
|
10361
10627
|
const { readFileSync: readFileSync6 } = await import("fs");
|
|
10362
|
-
const k = nomad.trustPackageSigner(new Uint8Array(readFileSync6(
|
|
10628
|
+
const k = nomad.trustPackageSigner(new Uint8Array(readFileSync6(resolve8(pkg))), o.name);
|
|
10363
10629
|
print(out(), () => [green("Trusted") + ` ${k.fingerprint} ${k.name}`, dim("Check this fingerprint with them through another channel.")], k);
|
|
10364
10630
|
})
|
|
10365
10631
|
);
|
|
@@ -10476,7 +10742,7 @@ remote.command("push <source>").description("export locally, copy over SSH, and
|
|
|
10476
10742
|
program.command("schema").description("write the Universal Agent Format JSON Schemas").option("-o, --out <dir>", "output directory", ".").action(
|
|
10477
10743
|
(o) => run2(async () => {
|
|
10478
10744
|
const s = jsonSchemas();
|
|
10479
|
-
const dir =
|
|
10745
|
+
const dir = resolve8(o.out);
|
|
10480
10746
|
mkdirSync4(dir, { recursive: true });
|
|
10481
10747
|
writeFileSync4(join20(dir, "agent-document.schema.json"), JSON.stringify(s.agentDocument, null, 2));
|
|
10482
10748
|
writeFileSync4(join20(dir, "package-manifest.schema.json"), JSON.stringify(s.packageManifest, null, 2));
|
|
@@ -10537,7 +10803,7 @@ If you installed it with npm, update with: ${bold("npm install -g thenomad@lates
|
|
|
10537
10803
|
});
|
|
10538
10804
|
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
10805
|
const install = currentInstall();
|
|
10540
|
-
const dataDir = program.opts().home ?
|
|
10806
|
+
const dataDir = program.opts().home ? resolve8(program.opts().home) : nomadHome();
|
|
10541
10807
|
if (!install) {
|
|
10542
10808
|
process.stderr.write(
|
|
10543
10809
|
`This copy of Nomad was not installed with the installer from thenomad.website.
|
|
@@ -10584,13 +10850,13 @@ program.command("ui").description("open the dashboard in your browser (only this
|
|
|
10584
10850
|
spawn2(cmd, args, { stdio: "ignore", detached: true }).on("error", () => void 0).unref();
|
|
10585
10851
|
};
|
|
10586
10852
|
if (o.dev) {
|
|
10587
|
-
const webDir = [
|
|
10853
|
+
const webDir = [resolve8(here, "../../web"), resolve8(process.cwd(), "apps/web")].find((d) => existsSync7(join20(d, "package.json")));
|
|
10588
10854
|
if (!webDir) {
|
|
10589
10855
|
process.stderr.write(red("--dev needs the repository checkout.\n"));
|
|
10590
10856
|
process.exitCode = 1;
|
|
10591
10857
|
return;
|
|
10592
10858
|
}
|
|
10593
|
-
const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ?
|
|
10859
|
+
const env = { ...process.env, NOMAD_LOCAL: "1", NOMAD_LOCAL_TOKEN: token, NOMAD_HOME: program.opts().home ? resolve8(program.opts().home) : nomadHome(), PORT: String(port) };
|
|
10594
10860
|
process.stderr.write(`${bold("Nomad")} dev server at ${url}
|
|
10595
10861
|
`);
|
|
10596
10862
|
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"] });
|
|
@@ -10667,7 +10933,7 @@ async function guided(nomad) {
|
|
|
10667
10933
|
if (items.length === 1) process.stderr.write(dim("No agents were found at the usual places. You can open a package file.") + "\n");
|
|
10668
10934
|
const pick = await choose(rl, "Which agent?", items);
|
|
10669
10935
|
if (pick === "file") {
|
|
10670
|
-
const path =
|
|
10936
|
+
const path = resolve8((await rl.question("Path to the file: ")).trim().replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
|
|
10671
10937
|
if (!existsSync7(path)) throw new NomadError(`There is no file at ${path}.`, "not-found");
|
|
10672
10938
|
source = { kind: "package", path };
|
|
10673
10939
|
from = null;
|
|
@@ -10690,7 +10956,7 @@ async function guided(nomad) {
|
|
|
10690
10956
|
const name = (await nomad.loadSource(source).catch(() => null))?.doc.name ?? "agent";
|
|
10691
10957
|
const def = `./${name.replace(/[^A-Za-z0-9._-]+/g, "-")}.nomad`;
|
|
10692
10958
|
const a = (await rl.question(`Save to ${dim(`[${def}]`)}: `)).trim();
|
|
10693
|
-
dest = { kind: "file", path:
|
|
10959
|
+
dest = { kind: "file", path: resolve8(a || def) };
|
|
10694
10960
|
} else {
|
|
10695
10961
|
const info = getAdapter(where).info;
|
|
10696
10962
|
const def = info.defaultLocations[0] ?? displayPath(process.cwd());
|