diff --git a/darknode.js b/darknode.js index 6f8a090..9d5a711 100755 --- a/darknode.js +++ b/darknode.js @@ -2899,6 +2899,9 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { const S = settingsStore.value, Ssrc = settingsStore.source; const saveSetting = (k, v) => { try { settingsStore.set(k, v); } catch (_) {} }; if (settingsStore.corrupt) transcript.push({ role: "system", text: "your settings file (~/.nexus/settings.json) was unreadable, so Nexus started with defaults. The old file was kept as " + settingsStore.corrupt + " — fix it and copy it back to restore your settings." }); + // Signed in to Darknode: let the site owner's admin panel count this account as a Nexus user + // (version + OS, at most every 6 hours; /shareusage off). Fire and forget. + setTimeout(() => { try { const _fb = firebaseCfg() || {}; require("./lib/nexus/usage-ping").pingUsage({ readAuth: nexusAuth, saveAuth: (a) => writeGlobal("auth.json", a), refresh: firebaseRefresh, post: (url, body, headers) => httpReq({ url, method: "POST", body, headers, timeout: 8000 }), readState: () => readGlobal("usage-ping.json", {}), writeState: (st) => writeGlobal("usage-ping.json", st), version: VERSION, platform: process.platform, env: process.env, enabled: S.shareUsage !== false, api: _fb.apiUrl }).catch(() => {}); } catch (_) {} }, 3000).unref(); try { const _a = settingsStore.getSaved("aliases"); if (_a && typeof _a === "object" && !Array.isArray(_a)) aliases = _a; } catch (_) {} // Per-project command history, loaded from disk (dedup + capped) and driven // by the pure ComposerModel. `history`/`hIdx` stay as compatibility mirrors. @@ -3017,7 +3020,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { ["/agents", "run tasks in parallel: /agents a ;; b ;; c"], ["/mcp", "list / connect MCP servers"], ["/hooks", "show configured tool hooks"], ["/race", "run a prompt on every engine at once"], ["/review", "second opinion from a different engine"], ["/codereview", "multi-agent bug review: parallel reviewers, each finding verified · /codereview [low|medium|high|xhigh|max] [file|branch|PR#] [--fix] [--comment] [--max-findings n|all]"], ["/redo", "reapply an undone change"], ["/ultrareview", "rigorous multi-lens review of the working diff (severity-ranked)"], ["/changelog", "release notes from git history, grouped by type"], - ["/secrets", "scan the repo for leaked credentials"], ["/scan", "quick TCP port scan of a host"], ["/notify", "bell + desktop alert on long turns and questions · /notify on|off"], + ["/secrets", "scan the repo for leaked credentials"], ["/scan", "quick TCP port scan of a host"], ["/notify", "bell + desktop alert on long turns and questions · /notify on|off"], ["/shareusage", "tell Darknode this account uses Nexus (version + OS) · /shareusage on|off"], ["/watch", "run a cmd; auto-fix & re-run until it passes"], ["/commit", "AI commit message + commit the diff"], ["/diff", "colored word-level diff · /diff · /diff --staged"], ["/pin", "keep a file in context every turn"], ["/pins", "list pinned files"], ["/unpin", "remove a pinned file"], ["/redact", "mask secrets before cloud sends"], ["/ensemble", "all engines answer, then synthesize the best"], ["/settings", "all options, neatly arranged (alias /options /config)"], ["/jobs", "background commands the agent started (run_background)"], ["/loop", "autonomous goal loop: /loop [-n rounds] until GOAL-DONE"], ["/team", "multi-model workspace: architect + builder + reviewer, loops to PASS"], ["/policy", "show the enterprise security policy (org + local)"], ["/audit", "audited tool actions · /audit verify (tamper check)"], ["/bench", "speed / tokens / cost table per engine"], ["/explain", "explain the diff or a file in plain English"], ["/test", "generate & run unit tests for a file"], ["/refactor", "restructure code for clarity without changing behavior"], ["/migrate", "migrate code: /migrate to "], ["/pr", "AI-write a PR title+body from the diff and open it (gh)"], @@ -3614,7 +3617,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { "/autocompact": () => [["auto", "Nexus picks when to shrink"], ["off", "only when the context overflows"], ["40k", "or any token amount"]], "/autoupdate": () => [["on", "update on launch"], ["check", "just say when one is out"], ["off", "never check"]], "/report": () => [["json", "machine-readable"], ["save", "write it to a file"], ["since", "since "]], - ...Object.fromEntries([["/map", "repo map"], ["/recap", "after-task recap"], ["/title", "AI-named terminal tab"], ["/vim", "vim editing in the input box"], ["/notify", "bell + desktop alert"], ["/mouse", "mouse capture (off = select & copy)"], ["/lean", "minimal-output mode"], ["/offline", "local-only privacy lock"]].map(([c, what]) => [c, () => [["on", what + " on"], ["off", what + " off"]]])), + ...Object.fromEntries([["/map", "repo map"], ["/recap", "after-task recap"], ["/title", "AI-named terminal tab"], ["/vim", "vim editing in the input box"], ["/notify", "bell + desktop alert"], ["/shareusage", "usage sharing"], ["/mouse", "mouse capture (off = select & copy)"], ["/lean", "minimal-output mode"], ["/offline", "local-only privacy lock"]].map(([c, what]) => [c, () => [["on", what + " on"], ["off", what + " off"]]])), "/cache": () => [["on", "serve exact repeats free"], ["off", "always ask the model"], ["clear", "forget cached answers"]], }; const argMatches = () => { @@ -3966,6 +3969,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { const toggleState = (nm) => { switch (nm) { case "/notify": return notify; + case "/shareusage": return settingsStore.value.shareUsage !== false; case "/map": return repoMapOn; case "/lean": return lean; case "/cache": return cacheOn; @@ -5569,6 +5573,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { else if (cmd === "/changelog") { (async () => { const range = arg && arg.trim() ? arg.trim() : null; let rng = range; if (!rng) { const t = await sh(["describe", "--tags", "--abbrev=0"]); const tag = (t.stdout || "").trim(); rng = tag ? tag + "..HEAD" : ""; } const lg = await sh(["log", "--no-color", "--no-merges", "--pretty=%h%x09%s%x1f%b%x1e"].concat(rng ? [rng] : ["-40"])); if (lg.err) { transcript.push({ role: "system", text: "git log failed" + (rng ? " for " + rng : "") + ": " + String(lg.stderr || lg.err.message).trim().split("\n")[0] }); render(); return; } const commits = parseCommits(lg.stdout || ""); const md = renderChangelog(commits, { title: "Changelog", range: rng || "recent" }); transcript.push({ role: "system", text: commits.length ? md : "no commits found" + (rng ? " in " + rng : "") }); render(); })(); } else if (cmd === "/secrets") { try { const all = _cp.execSync("git ls-files -z --cached --others --exclude-standard", { cwd, encoding: "utf8", maxBuffer: 64 * 1024 * 1024, stdio: ["ignore", "pipe", "pipe"] }).split("\0").filter(Boolean); const files = all.slice(0, 5000); const found = []; /* tracked + new untracked (not ignored) files: a key in a file about to be committed counts too */ for (const f of files) { try { if (fs.statSync(path.join(cwd, f)).size > 400000) continue; const hits = scanSecrets(fs.readFileSync(path.join(cwd, f), "utf8")); if (hits.length) found.push(" " + f + " — " + hits.join(", ")); } catch (_) {} } transcript.push({ role: "system", text: found.length ? ("possible secrets found (tracked + untracked, not ignored):\n" + found.slice(0, 40).join("\n")) : "scanned " + files.length + " file" + (files.length === 1 ? "" : "s") + " (tracked + untracked, not ignored) — no obvious secrets found" }); if (all.length > files.length) transcript.push({ role: "system", text: "only the first " + files.length + " of " + all.length + " files were scanned" }); } catch (_) { transcript.push({ role: "system", text: "/secrets needs a git repo (uses git ls-files)" }); } } else if (cmd === "/scan") { const host = (arg || "").trim().split(/\s+/)[0] || "127.0.0.1"; const COMMON = [21, 22, 23, 25, 53, 80, 110, 143, 443, 445, 3306, 3389, 5432, 6379, 8080, 8443, 9000]; transcript.push({ role: "system", text: "scanning " + host + " (" + COMMON.length + " common TCP ports)…" }); render(); quickScan(host, COMMON).then((open) => { transcript.push({ role: "system", text: open.length ? ("open on " + host + ": " + open.join(", ")) : open.unresolved ? "could not resolve " + host + " — nothing was scanned" : "no common ports open on " + host }); render(); }); } + else if (cmd === "/shareusage") { const a = (arg || "").trim().toLowerCase(); if (a && a !== "on" && a !== "off") { transcript.push({ role: "system", text: "usage: /shareusage [on|off] (no argument toggles)" }); render(); return; } const on = a === "on" ? true : a === "off" ? false : settingsStore.value.shareUsage === false; saveSetting("shareUsage", on); transcript.push({ role: "system", text: "usage sharing " + (on ? "ON — while you are signed in, Nexus tells Darknode once every 6 hours that this account uses it (version and OS only)" : "off — Nexus sends nothing about your usage") }); } else if (cmd === "/notify") { const a = (arg || "").trim().toLowerCase(); if (a && a !== "on" && a !== "off") { transcript.push({ role: "system", text: "usage: /notify [on|off] (no argument toggles)" }); render(); return; } notify = a === "on" ? true : a === "off" ? false : !notify; saveSetting("notify", notify); transcript.push({ role: "system", text: "completion notifications " + (notify ? "ON — a bell rings (and a desktop notification) when a turn over ~15s finishes or Nexus stops to ask you something, so you can step away" : "off") }); } else if (cmd === "/watch") { if (!argstr) transcript.push({ role: "system", text: "usage: /watch — runs it, and if it fails has " + engine + " fix the code and re-run, up to 5 times (e.g. /watch npm test)" }); else watchFix(argstr); } else if (cmd === "/commit") commitChanges(); @@ -5706,7 +5711,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { } render(); return; } - const v = { engine, model: (sess.model && sess.model !== engine ? sess.model : ""), effort, fallback, style, lean, cowork, costCap, cost: sess.cost, mode: (MODES[mode] && MODES[mode].k) || "auto-accept", guard, policyOrg: policy.org, audit: policy.audit, redact, offline, notify, ctxPct: sess.ctxWindow ? Math.min(100, Math.round((sess.ctxUsed / sess.ctxWindow) * 100)) : null, pins: pinned.size, bgRunning: bgJobs.running() }; + const v = { engine, model: (sess.model && sess.model !== engine ? sess.model : ""), effort, fallback, style, lean, cowork, costCap, cost: sess.cost, mode: (MODES[mode] && MODES[mode].k) || "auto-accept", guard, policyOrg: policy.org, audit: policy.audit, redact, offline, notify, shareUsage: settingsStore.value.shareUsage, ctxPct: sess.ctxWindow ? Math.min(100, Math.round((sess.ctxUsed / sess.ctxWindow) * 100)) : null, pins: pinned.size, bgRunning: bgJobs.running() }; // on/off values read green/red at a glance, matching the slash-menu toggle colours const onOff = (x) => /^on\b/i.test(x) ? green(x) : /^off$/i.test(x) ? red(x) : x; let text = bold("Settings") + gray(" change any option with the command shown"); diff --git a/docs/NEXUS-COMMANDS.md b/docs/NEXUS-COMMANDS.md index 49dd5dc..965832e 100644 --- a/docs/NEXUS-COMMANDS.md +++ b/docs/NEXUS-COMMANDS.md @@ -118,6 +118,7 @@ File tools are confined to the project folder; secrets are blocked from being wr - `/secrets` — scan the repo for leaked credentials - `/scan` — quick TCP port scan of a host - `/notify` — bell + desktop alert on long turns and questions · /notify on|off +- `/shareusage` — tell Darknode this account uses Nexus (version + OS) · /shareusage on|off - `/watch` — run a cmd; auto-fix & re-run until it passes - `/commit` — AI commit message + commit the diff - `/diff` — colored word-level diff · /diff · /diff --staged diff --git a/lib/cli/command-help.js b/lib/cli/command-help.js index 952e36c..06dd8de 100644 --- a/lib/cli/command-help.js +++ b/lib/cli/command-help.js @@ -41,6 +41,7 @@ const HELP = { "/ultrareview": { u: "[file|branch|PR#]", ex: ["/ultrareview", "/ultrareview HEAD~3"], see: ["/codereview"] }, "/changelog": { u: "[git range]", ex: ["/changelog", "/changelog v1.0..HEAD"] }, "/notify": { u: "on|off", ex: ["/notify on", "/notify off"] }, + "/shareusage": { u: "on|off", ex: ["/shareusage off", "/shareusage on"] }, "/watch": { u: "", a: [["command", "re-run and auto-fix until it exits 0"]], ex: ["/watch npm test"], see: ["/verify", "/test"] }, "/commit": { u: "[message]", a: [["message", "override the AI-written message"]], ex: ["/commit", "/commit fix: null guard"], see: ["/pr", "/diff"] }, "/diff": { u: "[file] [--staged]", ex: ["/diff", "/diff src/app.js", "/diff --staged"], see: ["/explain", "/commit"] }, diff --git a/lib/cli/nexus-settings.js b/lib/cli/nexus-settings.js index b4a89ff..8a60736 100644 --- a/lib/cli/nexus-settings.js +++ b/lib/cli/nexus-settings.js @@ -42,6 +42,7 @@ const DEFAULTS = { mode: null, // null = keep the launch default 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 }; // Env vars that pin a key for THIS launch (highest precedence). A present + diff --git a/lib/cli/settings.js b/lib/cli/settings.js index 299b7b2..ed24358 100644 --- a/lib/cli/settings.js +++ b/lib/cli/settings.js @@ -27,6 +27,7 @@ const SETTINGS = [ { group: "Privacy", items: [ { label: "Redact secrets to cloud", cmd: "/redact", get: (v) => (v.redact ? "on" : "off") }, { label: "Offline lock", cmd: "/offline", get: (v) => (v.offline ? "on" : "off") }, + { label: "Share usage", cmd: "/shareusage", get: (v) => (v.shareUsage === false ? "off" : "on") }, ] }, { group: "Session", items: [ { label: "Desktop notify", cmd: "/notify", get: (v) => (v.notify ? "on" : "off") }, diff --git a/lib/nexus/usage-ping.js b/lib/nexus/usage-ping.js new file mode 100644 index 0000000..bbda910 --- /dev/null +++ b/lib/nexus/usage-ping.js @@ -0,0 +1,40 @@ +"use strict"; +// usage-ping — tells Darknode that a signed-in person uses Nexus, so the site owner's admin +// panel can list Nexus users (with version and OS). Sent only when a Darknode sign-in exists +// (/login), at most every 6 hours, never with prompts, files, paths or project names. +// Off with /shareusage off (saved in ~/.nexus/settings.json), NEXUS_SHARE_USAGE=0 or +// DO_NOT_TRACK=1. Never throws; the TUI fires it and forgets it. + +const DEFAULT_API = "https://darknode-proxy.darknode-ai.workers.dev"; +const EVERY_MS = 6 * 3600e3; +const OSES = new Set(["linux", "darwin", "win32"]); + +const claims = (t) => { try { return JSON.parse(Buffer.from(String(t).split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8")); } catch (_) { return null; } }; + +// deps: { readAuth, saveAuth, refresh(refreshToken) -> { id_token, refresh_token }, post(url, body, headers) -> { status }, +// readState() -> { at }, writeState(s), version, platform, env, enabled, now, api } +// -> "sent" | "off" | "signed-out" | "skipped" | "failed" +async function pingUsage(deps) { + try { + const env = deps.env || {}, now = deps.now || Date.now(); + if (deps.enabled === false || /^(0|false|off|no)$/i.test(String(env.NEXUS_SHARE_USAGE || "").trim()) || /^(1|true)$/i.test(String(env.DO_NOT_TRACK || "").trim())) return "off"; + const a = deps.readAuth(); + if (!a || !a.idToken || !a.uid) return "signed-out"; + const st = deps.readState() || {}; + if (st.at && now - st.at < EVERY_MS && st.uid === a.uid) return "skipped"; + let tok = a.idToken; const c = claims(tok); + if (!c || !c.exp || c.exp * 1000 - now < 120000) { + const r = await deps.refresh(a.refreshToken).catch(() => null); + if (!r || !r.id_token) return "failed"; + tok = r.id_token; + deps.saveAuth(Object.assign({}, a, { idToken: tok, refreshToken: r.refresh_token || a.refreshToken, ts: now })); + } + const body = { product: "nexus", version: String(deps.version || ""), os: OSES.has(deps.platform) ? deps.platform : "" }; + const r = await deps.post((deps.api || env.DARKNODE_API || DEFAULT_API) + "/api/v1/usage", body, { Authorization: "Bearer " + tok, "Content-Type": "application/json" }); + if (!r || r.status < 200 || r.status >= 300) return "failed"; + deps.writeState({ at: now, uid: a.uid }); + return "sent"; + } catch (_) { return "failed"; } +} + +module.exports = { pingUsage, EVERY_MS }; diff --git a/package.json b/package.json index 28d57f5..49e90df 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "scripts": { "start": "node darknode.js", "build": "pkg . --out-path dist", - "test": "node test/run.js && node test/authz.test.js && node test/composer.test.js && node test/term.test.js && node test/md-render.test.js && node test/links.test.js && node test/pager.test.js && node test/tool-tail.test.js && node test/os-notify.test.js && node test/repo-map-rank.test.js && node test/bm25.test.js && node test/danger-audit.test.js && node test/url-guard-audit.test.js && node test/edit-audit.test.js && node test/jail-audit.test.js && node test/mcp-audit.test.js && node test/git-search-audit.test.js && node test/state-audit.test.js && node test/exec-audit.test.js && node test/cli-audit.test.js && node test/governance-audit.test.js && node test/toolkit-audit.test.js && node test/devhelpers-audit.test.js && node test/radar-audit.test.js && node test/pentest-audit.test.js && node test/shellfix-audit.test.js && node test/convo-lifecycle-audit.test.js && node test/local-loop-audit.test.js && node test/undo-audit.test.js && node test/at-mentions-audit.test.js && node test/clipboard-audit.test.js && node test/notes-audit.test.js && node test/snippets-audit.test.js && node test/typed-names-audit.test.js && node test/sighup-audit.test.js && node test/tui-stderr-audit.test.js && node test/piped-stdin-audit.test.js && node test/oneshot-escape-audit.test.js && node test/hot-path-speed-audit.test.js && node test/command-help.test.js && node test/session-save.test.js && node test/agents-panel.test.js && node test/tui-layout.test.js && node test/hub.test.js", + "test": "node test/run.js && node test/usage-ping.test.js && node test/authz.test.js && node test/composer.test.js && node test/term.test.js && node test/md-render.test.js && node test/links.test.js && node test/pager.test.js && node test/tool-tail.test.js && node test/os-notify.test.js && node test/repo-map-rank.test.js && node test/bm25.test.js && node test/danger-audit.test.js && node test/url-guard-audit.test.js && node test/edit-audit.test.js && node test/jail-audit.test.js && node test/mcp-audit.test.js && node test/git-search-audit.test.js && node test/state-audit.test.js && node test/exec-audit.test.js && node test/cli-audit.test.js && node test/governance-audit.test.js && node test/toolkit-audit.test.js && node test/devhelpers-audit.test.js && node test/radar-audit.test.js && node test/pentest-audit.test.js && node test/shellfix-audit.test.js && node test/convo-lifecycle-audit.test.js && node test/local-loop-audit.test.js && node test/undo-audit.test.js && node test/at-mentions-audit.test.js && node test/clipboard-audit.test.js && node test/notes-audit.test.js && node test/snippets-audit.test.js && node test/typed-names-audit.test.js && node test/sighup-audit.test.js && node test/tui-stderr-audit.test.js && node test/piped-stdin-audit.test.js && node test/oneshot-escape-audit.test.js && node test/hot-path-speed-audit.test.js && node test/command-help.test.js && node test/session-save.test.js && node test/agents-panel.test.js && node test/tui-layout.test.js && node test/hub.test.js", "postinstall": "node scripts/postinstall.js", "docs": "node scripts/gen-nexus-docs.js" }, diff --git a/test/usage-ping.test.js b/test/usage-ping.test.js new file mode 100644 index 0000000..6c6af58 --- /dev/null +++ b/test/usage-ping.test.js @@ -0,0 +1,51 @@ +"use strict"; +// usage-ping: a signed-in Nexus tells Darknode it is in use (version + OS) at most every +// 6 hours, refreshes an expired token first, and sends nothing when off or signed out. +const { pingUsage, EVERY_MS } = require("../lib/nexus/usage-ping"); +let pass = 0, fail = 0; +const ok = (name, cond) => { if (cond) pass++; else { fail++; console.log(" FAIL " + name); } }; +const jwt = (exp) => "h." + Buffer.from(JSON.stringify({ exp })).toString("base64url") + ".s"; +const NOW = 1.8e12; + +function deps(over = {}) { + const log = { posts: [], saved: null, state: over.state || {} }; + const d = Object.assign({ + readAuth: () => ({ uid: "u1", idToken: jwt(NOW / 1000 + 3600), refreshToken: "r1" }), + saveAuth: (a) => { log.saved = a; }, + refresh: async () => ({ id_token: jwt(NOW / 1000 + 3600), refresh_token: "r2" }), + post: async (url, body, headers) => { log.posts.push({ url, body, headers }); return { status: 200 }; }, + readState: () => log.state, writeState: (s) => { log.state = s; }, + version: "2.56.0", platform: "linux", env: {}, now: NOW, + }, over); + return { d, log }; +} + +(async () => { + { const { d, log } = deps(); const r = await pingUsage(d); + ok("sends when signed in", r === "sent"); + ok("posts to the usage route", log.posts[0].url.endsWith("/api/v1/usage")); + ok("only product, version and OS", JSON.stringify(log.posts[0].body) === JSON.stringify({ product: "nexus", version: "2.56.0", os: "linux" })); + ok("bearer token", /^Bearer h\./.test(log.posts[0].headers.Authorization)); + ok("remembers when", log.state.at === NOW && log.state.uid === "u1"); } + { const { d, log } = deps({ state: { at: NOW - 3600e3, uid: "u1" } }); + ok("waits 6 hours", (await pingUsage(d)) === "skipped" && !log.posts.length); } + { const { d } = deps({ state: { at: NOW - 3600e3, uid: "someone-else" } }); + ok("a different account sends at once", (await pingUsage(d)) === "sent"); } + { const { d } = deps({ state: { at: NOW - EVERY_MS - 1, uid: "u1" } }); + ok("sends again after 6 hours", (await pingUsage(d)) === "sent"); } + { const { d, log } = deps({ readAuth: () => null }); ok("signed out sends nothing", (await pingUsage(d)) === "signed-out" && !log.posts.length); } + for (const [label, over] of [["setting off", { enabled: false }], ["NEXUS_SHARE_USAGE=0", { env: { NEXUS_SHARE_USAGE: "0" } }], ["DO_NOT_TRACK=1", { env: { DO_NOT_TRACK: "1" } }]]) { + const { d, log } = deps(over); ok(label + " sends nothing", (await pingUsage(d)) === "off" && !log.posts.length); + } + { const { d, log } = deps({ readAuth: () => ({ uid: "u1", idToken: jwt(NOW / 1000 - 10), refreshToken: "r1" }) }); + ok("an expired token is refreshed first", (await pingUsage(d)) === "sent" && log.saved && log.saved.refreshToken === "r2"); } + { const { d, log } = deps({ readAuth: () => ({ uid: "u1", idToken: jwt(NOW / 1000 - 10), refreshToken: "r1" }), refresh: async () => { throw new Error("offline"); } }); + ok("a failed refresh sends nothing", (await pingUsage(d)) === "failed" && !log.posts.length); } + { const { d, log } = deps({ post: async () => ({ status: 500 }) }); + ok("a server error is retried next launch", (await pingUsage(d)) === "failed" && !log.state.at); } + { const { d } = deps({ post: async () => { throw new Error("ECONNREFUSED"); } }); + ok("never throws", (await pingUsage(d)) === "failed"); } + { const { d, log } = deps({ platform: "aix" }); await pingUsage(d); ok("unknown OS is blank", log.posts[0].body.os === ""); } + console.log("usage-ping: " + pass + " passed, " + fail + " failed"); + if (fail) process.exit(1); +})();