Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 135 additions & 10 deletions darknode.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/NEXUS-COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ File tools are confined to the project folder; secrets are blocked from being wr
- `/estimate` — rough token/cost of a prompt before sending (opens in the side panel)
- `/fallback` — auto-switch model on rate-limit
- `/guard` — preflight destructive commands (enforce|warn|off)
- `/sandbox` — fence engines in (Landlock): no secrets, writes only the project · /sandbox auto|always|off
- `/acp` — ACP engines (opencode, gemini): live tool cards, they ask before acting · /acp auto|off
- `/permissions` — allow/deny tool rules — /allow /deny <rule>
- `/impact` — same as /savings — cost-savings analysis (opens in the side panel)
- `/savings` — cross-session cost-savings analysis + 30d projection (opens in the side panel)
Expand Down
2 changes: 2 additions & 0 deletions lib/cli/command-help.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const HELP = {
"/estimate": { u: "<prompt>", ex: ["/estimate refactor the auth module"], see: ["/tokens", "/cost"] },
"/fallback": { u: "<model>|off", a: [["<model>", "auto-switch to it when the main model is rate-limited"], ["off", "clear the fallback"]], ex: ["/fallback sonnet", "/fallback off"], see: ["/model", "/mode"] },
"/guard": { u: "[enforce|warn|off]", ex: ["/guard", "/guard enforce", "/guard off"], see: ["/permissions", "/policy"] },
"/sandbox": { u: "[auto|always|off]", ex: ["/sandbox", "/sandbox always", "/sandbox off"], see: ["/guard", "/permissions", "/acp"] },
"/acp": { u: "[auto|off]", ex: ["/acp", "/acp off"], see: ["/engine", "/sandbox", "/permissions"] },
"/permissions": { u: "— use /allow <rule> and /deny <rule>", ex: ["/permissions", "/allow run_command(git*)", "/deny write_file(.env)"], see: ["/guard", "/policy"] },
"/cache": { u: "[on|off|clear]", ex: ["/cache", "/cache on", "/cache clear"], see: ["/warm", "/cheap"] },
"/api": { u: "<base-url> <model> | key <key> | off", a: [["base-url", "any OpenAI-compatible endpoint"], ["key <key>", "set the API key for this session"], ["off", "stop using the custom endpoint"]], ex: ["/api https://openrouter.ai/api/v1 meta-llama/llama-3-70b", "/api key sk-...", "/api off"], see: ["/engine", "/models"] },
Expand Down
6 changes: 5 additions & 1 deletion lib/cli/nexus-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const DEFAULTS = {
model: "", // "" = the engine default; persists the user's /model choice
syntaxGate: "warn", // after an edit, warn (never block) if it introduced a syntax error; "off" disables
shareUsage: true, // signed in: tell Darknode this account uses Nexus (version + OS, every 6h); /shareusage off
acp: "auto", // engines that speak ACP (opencode, gemini) run over it: live tool cards, Nexus answers their permission asks; "off" = classic one-shot
sandbox: "auto", // Landlock engine sandbox (protective, Linux): "auto" = plan mode + untrusted repos, "always", "off"
};

// Env vars that pin a key for THIS launch (highest precedence). A present +
Expand All @@ -58,12 +60,14 @@ const ENV_KEYS = {
lean: (v) => truthy(v),
effort: (v) => v || undefined,
syntaxGate: (v) => (/^(off|warn)$/i.test(String(v).trim()) ? String(v).trim().toLowerCase() : undefined),
acp: (v) => (/^(auto|off)$/i.test(String(v).trim()) ? String(v).trim().toLowerCase() : /^(0|false|no)$/i.test(String(v).trim()) ? "off" : undefined),
sandbox: (v) => { const s = String(v).trim().toLowerCase(); return s === "on" || s === "1" || s === "true" ? "always" : /^(auto|always|off)$/.test(s) ? s : s === "0" || s === "false" ? "off" : undefined; },
};
// NEXUS_<KEY> env name for each governed key.
const ENV_NAME = {
budgetCap: "NEXUS_BUDGET", autoCompact: "NEXUS_AUTOCOMPACT", minimizeCalls: "NEXUS_MINIMIZE_CALLS",
stepCap: "NEXUS_STEP_CAP", trimOutput: "NEXUS_TRIM_OUTPUT", cache: "NEXUS_CACHE", map: "NEXUS_MAP",
lean: "NEXUS_LEAN", effort: "NEXUS_EFFORT", syntaxGate: "NEXUS_SYNTAX_GATE",
lean: "NEXUS_LEAN", effort: "NEXUS_EFFORT", syntaxGate: "NEXUS_SYNTAX_GATE", acp: "NEXUS_ACP", sandbox: "NEXUS_SANDBOX",
};

function truthy(v) { return /^(1|true|on|yes)$/i.test(String(v || "").trim()); }
Expand Down
2 changes: 2 additions & 0 deletions lib/cli/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const SETTINGS = [
{ group: "Safety & policy", items: [
{ label: "Permission mode", cmd: "shift+tab", get: (v) => v.mode || "auto-accept" },
{ label: "Command guard", cmd: "/guard enforce|warn|off", get: (v) => v.guard || "enforce" },
{ label: "Engine sandbox", cmd: "/sandbox auto|always|off", get: (v) => v.sandbox || "auto" },
{ label: "ACP engines", cmd: "/acp auto|off", get: (v) => v.acp || "auto" },
{ label: "Security policy", cmd: "/policy", get: (v) => (v.policyOrg ? "org-enforced" : "local/default") },
{ label: "Audit trail", cmd: "/audit verify", get: (v) => (v.audit ? "on (hash-chained)" : "off") },
] },
Expand Down
Loading
Loading