dsh-plugin-mesh 0.5.1 → 0.5.3

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/lib/index.js CHANGED
@@ -19,7 +19,7 @@ import { randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
19
19
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
20
20
  import { join, basename, isAbsolute, resolve } from "node:path";
21
21
  import { fileURLToPath } from "node:url";
22
- import { homedir, hostname, userInfo, platform } from "node:os";
22
+ import { homedir, hostname, userInfo, platform, arch } from "node:os";
23
23
  import z from "@deepseek-ai/schemastery";
24
24
  import { defineTool } from "@deepseek-ai/dsh-tools";
25
25
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
@@ -45,6 +45,7 @@ import {
45
45
  CAPABILITY_STALE_MS,
46
46
  } from "./capabilities.js";
47
47
  import { conversationKey, replyTarget } from "./conversation.js";
48
+ import { buildDiagnostics, entryInfo, readPackageVersion } from "./diagnostics.js";
48
49
  import { buildPrompt } from "./prompt.js";
49
50
  import { resolvePairing } from "./pairing.js";
50
51
  import {
@@ -59,7 +60,13 @@ import { tailnetFetch, tailnetOrigin } from "./tsnet/bridge.js";
59
60
  export const name = "dsh-plugin-mesh";
60
61
  export const inject = ["tools", "webServer"];
61
62
 
62
- const VERSION = "0.5.1";
63
+ const VERSION = "0.5.3";
64
+ // 诊断用:进程启动时间、入口真实路径、**磁盘上** package.json 的版本。
65
+ // 这三样放一起才能回答"现在跑的到底是哪份代码" —— 只看 state.json 或重启日志
66
+ // 都答不了(真踩过:磁盘升到 0.5.1,进程还在 0.5.0,界面显示 0.5.0)。
67
+ const PROCESS_STARTED_AT = Date.now() - Math.round(process.uptime() * 1000);
68
+ const ENTRY_INFO = entryInfo(import.meta.url);
69
+ const DISK_VERSION = readPackageVersion(import.meta.url);
63
70
  const RULE_ID = "mesh-inbound";
64
71
  const RULE_KIND = "mesh";
65
72
  const MAX_BODY = 256 * 1024;
@@ -669,8 +676,24 @@ function applyUnsafe(ctx, config) {
669
676
  // 入站唤醒的"能力位":服务齐备后由 setupInbound 置位
670
677
  const waker = { ready: false, ctx: undefined };
671
678
 
679
+ /** 诊断块:进程自述版本 / 磁盘版本 / 入口 mtime / 安全字段的配置 / 能力摘要。 */
680
+ const diagnosticsPayload = () =>
681
+ buildDiagnostics({
682
+ version: VERSION,
683
+ packageVersion: DISK_VERSION,
684
+ entry: ENTRY_INFO.path,
685
+ entryMtimeMs: ENTRY_INFO.mtimeMs,
686
+ startedAt: PROCESS_STARTED_AT,
687
+ machine: identity.name,
688
+ hostname: hostname(),
689
+ platform: platform(),
690
+ arch: arch(),
691
+ config,
692
+ capabilities: currentCapabilities(),
693
+ });
694
+
672
695
  // 1) 先起对端 HTTP(拿到真实端口),再开始发现
673
- startPeerServer(ctx, { config, discovery, inbound, outbound, log, warn, waker, threadState, capFor, capOverrides, throttled, onHistoryChange: scheduleHistorySave })
696
+ startPeerServer(ctx, { config, discovery, inbound, outbound, log, warn, waker, threadState, capFor, capOverrides, throttled, onHistoryChange: scheduleHistorySave, diagnostics: diagnosticsPayload })
674
697
  .then(async (port) => {
675
698
  discovery.setPort(port);
676
699
 
@@ -778,7 +801,7 @@ function applyUnsafe(ctx, config) {
778
801
  registerTools(ctx, { discovery, config, inbound, outbound, log, warn, threadState, hostDispatched, onHistoryChange: scheduleHistorySave });
779
802
 
780
803
  // 4) UI 接口
781
- registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound, log, warn, threadState, hostDispatched, capFor, capOverrides, throttled, waker, onHistoryChange: scheduleHistorySave });
804
+ registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound, log, warn, threadState, hostDispatched, capFor, capOverrides, throttled, waker, onHistoryChange: scheduleHistorySave, diagnostics: diagnosticsPayload });
782
805
 
783
806
  ctx.effect(() => () => {
784
807
  discovery.stop();
@@ -790,6 +813,31 @@ function machineOf(discovery) {
790
813
  return discovery.selfRecord().machine;
791
814
  }
792
815
 
816
+ /**
817
+ * 对端的系统身份,单行文本(mesh_peers 工具用)。
818
+ * 新对端有结构化 osInfo;老对端只有 os 字符串,原样回退。
819
+ */
820
+ function osLine(peer) {
821
+ const info = peer?.osInfo;
822
+ if (!info) return peer?.os || "?";
823
+ const label = [info.name, info.version].filter(Boolean).join(" ") || peer?.os || "?";
824
+ const extra = [info.arch, info.distro, info.desktop].filter(Boolean).join(" / ");
825
+ return extra ? `${label} (${extra})` : label;
826
+ }
827
+
828
+ /** 一台机器的全部系统(宿主机 + WSL 等),单行文本。 */
829
+ function systemsLine(peer) {
830
+ const list = Array.isArray(peer?.systems) && peer.systems.length ? peer.systems : null;
831
+ if (!list) return osLine(peer);
832
+ return list
833
+ .map((s) => {
834
+ const label = [s.name, s.version].filter(Boolean).join(" ") || s.platform || "?";
835
+ const extra = [s.kind === "wsl" ? "WSL" : "", s.distro, s.desktop, s.arch].filter(Boolean).join("/");
836
+ return extra ? `${label} (${extra})` : label;
837
+ })
838
+ .join(" + ");
839
+ }
840
+
793
841
  /**
794
842
  * 把对端的能力名片渲染成几行文本(mesh_peers 工具用)。
795
843
  * 渲染逻辑在 capabilities.js 里(可单测),这里只做转发。
@@ -1246,10 +1294,14 @@ function handleInboundTask(ctx, task, inbound, config, log, warn, waker, threadS
1246
1294
  // 只有"撞上限"值得提示用户去提高上限;寒暄/冷却/过短都是正常拦截
1247
1295
  if (verdict.kind === "cap") {
1248
1296
  const k = String(task.thread || "").trim();
1249
- const entry = throttled.get(k) ?? { taskIds: [], firstAt: now, lastAt: now, cap: capFor(k) };
1297
+ const entry = throttled.get(k) ?? { taskIds: [], firstAt: now, lastAt: now, cap: capFor(key), key };
1298
+ // The ledger and the cap override are keyed by conversationKey (machine +
1299
+ // thread), not by the bare thread label the UI displays. Remember it so
1300
+ // "/mesh/api/throttle/raise" can write the override under the right key.
1301
+ entry.key = key || entry.key || "";
1250
1302
  entry.taskIds.push(task.id);
1251
1303
  entry.lastAt = now;
1252
- entry.cap = capFor(k);
1304
+ entry.cap = capFor(entry.key || k);
1253
1305
  throttled.set(k, entry);
1254
1306
  warn(`任务 ${task.id} 因限速未唤醒(${verdict.reason});可在 Mesh 页面提高 ${k} 的上限`);
1255
1307
  } else {
@@ -1601,6 +1653,9 @@ async function runScan({ discovery, config, log, warn, signal, reason = "扫描"
1601
1653
  const ports = scanPortList(discovery, config);
1602
1654
  let lanFound = 0;
1603
1655
 
1656
+ if (addresses.length === 0) {
1657
+ warn(`${reason}: 没有可扫描的地址(检查 scanRanges 是否合法 / 网卡是否存在)`);
1658
+ }
1604
1659
  if (addresses.length > 0) {
1605
1660
  log(`${reason}: 探测 ${addresses.length} 个地址的 ${ports.join("/")} 端口…`);
1606
1661
  const started = Date.now();
@@ -1653,8 +1708,15 @@ async function pingKnownPeers({ discovery, config, warn }) {
1653
1708
  // 通道立刻探一次**,让它尽快有个真实状态而不是停在"未探测"。
1654
1709
  const tsnetInterval = Math.max(config.pingIntervalMs, config.tsnetProbeIntervalMs ?? 60000);
1655
1710
  const targets = endpoints.filter((ep) => {
1656
- if (ep.verified === false) return true; // 还没验证过,尽快探一次
1657
1711
  const interval = ep.transport === "tsnet" ? tsnetInterval : config.pingIntervalMs;
1712
+ if (ep.verified === false) {
1713
+ // 首次立刻探一次;失败后按通道节奏重试,并尊重 markEndpoint 记下
1714
+ // 的冷却时间。原来的 `return true` 让未验证端点每个 ping tick 都
1715
+ // 被探一次(默认 10s),完全绕过 tsnetProbeIntervalMs(60s)。
1716
+ if (!ep.lastFailAt) return true;
1717
+ if (Number(ep.downUntil ?? 0) > now) return false;
1718
+ return now - Number(ep.lastFailAt ?? 0) >= interval;
1719
+ }
1658
1720
  return now - Number(ep.lastSeen ?? 0) >= interval;
1659
1721
  });
1660
1722
  if (targets.length === 0) return;
@@ -1707,7 +1769,7 @@ async function peerFetchEndpoint(ep, url, opts = {}) {
1707
1769
 
1708
1770
  // ───────────────────────── 对端 HTTP 服务 ─────────────────────────
1709
1771
 
1710
- function startPeerServer(ctx, { config, discovery, inbound, outbound, log, warn, waker, threadState, capFor, capOverrides, throttled, onHistoryChange }) {
1772
+ function startPeerServer(ctx, { config, discovery, inbound, outbound, log, warn, waker, threadState, capFor, capOverrides, throttled, onHistoryChange, diagnostics }) {
1711
1773
  const send = (res, code, payload) => {
1712
1774
  const body = Buffer.from(JSON.stringify(payload), "utf8");
1713
1775
  res.writeHead(code, { "Content-Type": "application/json; charset=utf-8", "Content-Length": body.length });
@@ -1740,6 +1802,9 @@ function startPeerServer(ctx, { config, discovery, inbound, outbound, log, warn,
1740
1802
 
1741
1803
  if (!authed(req)) return send(res, 403, { ok: false, error: "未配对:两台机器的配对码不一致(本机开启了 requirePairing)" });
1742
1804
 
1805
+ // 诊断:进程版本 vs 磁盘版本。**必须在对端鉴权之后** —— 里面有本机路径。
1806
+ if (path === "/mesh/v1/diagnostics") return send(res, 200, diagnostics());
1807
+
1743
1808
  if (path === "/mesh/v1/peers") return send(res, 200, { ok: true, peers: discovery.peers() });
1744
1809
 
1745
1810
  if (path === "/mesh/v1/tasks" && req.method === "GET") {
@@ -1865,7 +1930,7 @@ function registerTools(ctx, { discovery, config, inbound, outbound, log, warn, t
1865
1930
  const lines = list.map((p) => {
1866
1931
  const caps = capabilityLine(p);
1867
1932
  return (
1868
- `${p.online ? "● 在线" : "○ 离线"} ${p.machine} ${p.host}:${p.port} ${p.os} user=${p.user}` +
1933
+ `${p.online ? "● 在线" : "○ 离线"} ${p.machine} ${p.host}:${p.port} ${systemsLine(p)} user=${p.user}` +
1869
1934
  (p.hostname ? `\n hostname=${p.hostname}` : "") +
1870
1935
  (p.mac ? ` mac=${p.mac}` : "") +
1871
1936
  (caps ? `\n${caps}` : "")
@@ -2034,7 +2099,7 @@ function registerTools(ctx, { discovery, config, inbound, outbound, log, warn, t
2034
2099
 
2035
2100
  // ───────────────────────── UI 接口(本地回环) ─────────────────────────
2036
2101
 
2037
- function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound, log, warn, threadState, hostDispatched, capFor, capOverrides, throttled, waker, onHistoryChange }) {
2102
+ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound, log, warn, threadState, hostDispatched, capFor, capOverrides, throttled, waker, onHistoryChange, diagnostics }) {
2038
2103
  const send = (res, code, payload) => {
2039
2104
  const body = Buffer.from(JSON.stringify(payload), "utf8");
2040
2105
  res.writeHead(code, { "Content-Type": "application/json; charset=utf-8", "Content-Length": body.length });
@@ -2057,6 +2122,21 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2057
2122
  }),
2058
2123
  );
2059
2124
 
2125
+ /**
2126
+ * POST-only wrapper for state-changing routes.
2127
+ *
2128
+ * Without this a GET (an <img>, a link prefetch, or any local process) can
2129
+ * trigger mutations. "/mesh/api/pairing" was the worst: readJson() returns
2130
+ * null for a body-less GET, `body?.enabled === true` becomes false, and the
2131
+ * empty result was persisted as "pairing disabled" -- a fail-open.
2132
+ */
2133
+ const post = (path, handler) =>
2134
+ route(path, (req, res) =>
2135
+ req.method === "POST"
2136
+ ? handler(req, res)
2137
+ : send(res, 405, { ok: false, error: `method ${req.method} not allowed; use POST` }),
2138
+ );
2139
+
2060
2140
  /** 返回 { peer } 或 { error },避免撞名时静默挑错机器 */
2061
2141
  const findPeer = (name) => {
2062
2142
  const matches = findPeersByName(discovery, name);
@@ -2120,6 +2200,10 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2120
2200
  addresses: lanIPv4Addresses(),
2121
2201
  platform: platform(),
2122
2202
  version: VERSION,
2203
+ // 磁盘上的版本 vs 本进程加载的版本。两者不一致 = 升级了但没重启,
2204
+ // 界面要明说"重启后生效",否则用户会拿旧行为当新版本的 bug 报上来。
2205
+ diskVersion: DISK_VERSION,
2206
+ versionDrift: !!DISK_VERSION && DISK_VERSION !== VERSION,
2123
2207
  secret: currentSecret(),
2124
2208
  // 本机的能力名片(对端看到的也是这一份)。**本机直接读采集缓存**,
2125
2209
  // 不走网络 —— 和 mac 一样,"自己的信息"没必要绕一圈。
@@ -2172,7 +2256,8 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2172
2256
  cap: v.cap,
2173
2257
  defaultCap: config.maxWakesPerThread ?? 0,
2174
2258
  windowMs: config.threadWindowMs ?? 3600000,
2175
- overridden: capOverrides.has(thread),
2259
+ key: v.key || thread,
2260
+ overridden: capOverrides.has(v.key || thread),
2176
2261
  firstAt: new Date(v.firstAt).toISOString(),
2177
2262
  lastAt: new Date(v.lastAt).toISOString(),
2178
2263
  })),
@@ -2180,6 +2265,8 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2180
2265
  };
2181
2266
 
2182
2267
  route("/mesh/api/state", (_req, res) => send(res, 200, state()));
2268
+ // 只读诊断:UI 的「诊断」卡片用它;与 /mesh/v1/diagnostics 同一份数据。
2269
+ route("/mesh/api/diagnostics", (_req, res) => send(res, 200, diagnostics()));
2183
2270
 
2184
2271
  /**
2185
2272
  * 用户决定提高某个 thread 的限速上限。
@@ -2187,20 +2274,21 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2187
2274
  * 提高后立刻放行**最近被挡的那一条**(对话的最新一环),其余仍留在收件箱 ——
2188
2275
  * 一次性全部重放会造成一个新的突发,反而失去限速的意义。
2189
2276
  */
2190
- route("/mesh/api/throttle/raise", async (req, res) => {
2277
+ post("/mesh/api/throttle/raise", async (req, res) => {
2191
2278
  const body = await readJson(req);
2192
2279
  const thread = String(body?.thread ?? "").trim();
2193
2280
  if (!thread) return send(res, 400, { ok: false, error: "thread 必填" });
2194
2281
  const entry = throttled.get(thread);
2195
2282
  if (!entry) return send(res, 404, { ok: false, error: `thread "${thread}" 当前没有被限速` });
2196
2283
 
2197
- const current = capFor(thread);
2284
+ const capKey = entry.key || thread;
2285
+ const current = capFor(capKey);
2198
2286
  const requested = Number(body?.cap);
2199
2287
  // 默认在当前基础上翻倍(至少 +10),也可由调用方指定
2200
2288
  const next = Number.isFinite(requested) && requested > current
2201
2289
  ? Math.floor(requested)
2202
2290
  : Math.max(current + 10, current * 2);
2203
- capOverrides.set(thread, next);
2291
+ capOverrides.set(capKey, next);
2204
2292
  // 必须显式传入,否则 saveThreads 会从磁盘读回旧值、把手动提高冲掉
2205
2293
  saveThreads(threadState, capOverrides);
2206
2294
 
@@ -2224,7 +2312,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2224
2312
  });
2225
2313
 
2226
2314
  /** 用户选择"忽略":清掉提示,不改上限。任务仍留在收件箱。 */
2227
- route("/mesh/api/throttle/dismiss", async (req, res) => {
2315
+ post("/mesh/api/throttle/dismiss", async (req, res) => {
2228
2316
  const body = await readJson(req);
2229
2317
  const thread = String(body?.thread ?? "").trim();
2230
2318
  if (!thread) return send(res, 400, { ok: false, error: "thread 必填" });
@@ -2235,7 +2323,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2235
2323
  });
2236
2324
 
2237
2325
  // 首次启动的"起名"接口:存进 state.json,并立刻重新广播
2238
- route("/mesh/api/name", async (req, res) => {
2326
+ post("/mesh/api/name", async (req, res) => {
2239
2327
  const body = await readJson(req);
2240
2328
  let name;
2241
2329
  try {
@@ -2258,12 +2346,12 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2258
2346
  send(res, 200, { ok: true, name, previous });
2259
2347
  });
2260
2348
 
2261
- route("/mesh/api/refresh", (_req, res) => {
2349
+ post("/mesh/api/refresh", (_req, res) => {
2262
2350
  discovery.announceNow();
2263
2351
  send(res, 200, { ok: true });
2264
2352
  });
2265
2353
 
2266
- route("/mesh/api/scan", async (_req, res) => {
2354
+ post("/mesh/api/scan", async (_req, res) => {
2267
2355
  try {
2268
2356
  const result = await runScan({ discovery, config, log, warn, reason: "手动扫描" });
2269
2357
  send(res, 200, { ok: true, ...result, peers: discovery.peers() });
@@ -2283,9 +2371,12 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2283
2371
  * 程序去改它风险太大(YAML 注释会被吃掉)。这也是 tsnet 开关一直在用的做法。
2284
2372
  * 配置里写死 requirePairing: true 的情况仍然优先(部署方能强制)。
2285
2373
  */
2286
- route("/mesh/api/pairing", async (req, res) => {
2374
+ post("/mesh/api/pairing", async (req, res) => {
2287
2375
  const body = await readJson(req);
2288
- const want = body?.enabled === true;
2376
+ if (typeof body?.enabled !== "boolean") {
2377
+ return send(res, 400, { ok: false, error: "enabled 必须是布尔值" });
2378
+ }
2379
+ const want = body.enabled;
2289
2380
  if (pairingPinned(config)) {
2290
2381
  return send(res, 409, {
2291
2382
  ok: false,
@@ -2297,7 +2388,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2297
2388
  return send(res, 200, { ok: true, requirePairing: want });
2298
2389
  });
2299
2390
 
2300
- route("/mesh/api/secret", async (req, res) => {
2391
+ post("/mesh/api/secret", async (req, res) => {
2301
2392
  const body = await readJson(req);
2302
2393
  const secret = String(body?.secret ?? "").trim();
2303
2394
  if (secret.length < 16) return send(res, 400, { ok: false, error: "配对码至少 16 个字符" });
@@ -2321,7 +2412,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2321
2412
  * 授权码存进 state.json(0600),所以**只需要输入一次**,重启不用再填。
2322
2413
  * 授权码传空串表示"不改动已保存的值",避免界面回显后又被空值覆盖。
2323
2414
  */
2324
- route("/mesh/api/tsnet/config", async (req, res) => {
2415
+ post("/mesh/api/tsnet/config", async (req, res) => {
2325
2416
  const body = await readJson(req);
2326
2417
  const patch = {};
2327
2418
  if (typeof body?.authKey === "string" && body.authKey.trim()) patch.tsnetAuthKey = body.authKey.trim();
@@ -2346,7 +2437,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2346
2437
  });
2347
2438
 
2348
2439
  /** 启动(或按最新配置重启)tailnet 节点。 */
2349
- route("/mesh/api/tsnet/start", async (_req, res) => {
2440
+ post("/mesh/api/tsnet/start", async (_req, res) => {
2350
2441
  if (tailnetNode) {
2351
2442
  const old = tailnetNode;
2352
2443
  tailnetNode = null;
@@ -2372,7 +2463,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2372
2463
  * 进程仍在跑、rendezvous 也没清)。不传参数即按归属判断:自己拉起的关掉,
2373
2464
  * 复用别人的只注销自己的 forward。
2374
2465
  */
2375
- route("/mesh/api/tsnet/stop", async (_req, res) => {
2466
+ post("/mesh/api/tsnet/stop", async (_req, res) => {
2376
2467
  const node = tailnetNode;
2377
2468
  tailnetNode = null;
2378
2469
  if (node) await node.stop().catch(() => {});
@@ -2380,7 +2471,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2380
2471
  });
2381
2472
 
2382
2473
  /** 清掉节点身份重新登录(授权码失效 / 换账号时用)。 */
2383
- route("/mesh/api/tsnet/relogin", async (_req, res) => {
2474
+ post("/mesh/api/tsnet/relogin", async (_req, res) => {
2384
2475
  if (!tailnetNode) return send(res, 409, { ok: false, error: "互联网组网未启动" });
2385
2476
  try {
2386
2477
  await tailnetNode.relogin();
@@ -2392,7 +2483,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2392
2483
  });
2393
2484
 
2394
2485
  /** 重新下载 sidecar 二进制(下载损坏或换平台时用)。 */
2395
- route("/mesh/api/tsnet/reinstall", async (_req, res) => {
2486
+ post("/mesh/api/tsnet/reinstall", async (_req, res) => {
2396
2487
  if (!tailnetNode) return send(res, 409, { ok: false, error: "互联网组网未启动" });
2397
2488
  try {
2398
2489
  const r = await tailnetNode.reinstallBinary();
@@ -2403,7 +2494,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2403
2494
  });
2404
2495
 
2405
2496
  /** 只扫 tailnet,不扫局域网。 */
2406
- route("/mesh/api/tsnet/scan", async (_req, res) => {
2497
+ post("/mesh/api/tsnet/scan", async (_req, res) => {
2407
2498
  const before = new Set(discovery.peers().map((p) => p.id));
2408
2499
  const result = await scanTailnet({
2409
2500
  discovery,
@@ -2420,7 +2511,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2420
2511
  });
2421
2512
  });
2422
2513
 
2423
- route("/mesh/api/send", async (req, res) => {
2514
+ post("/mesh/api/send", async (req, res) => {
2424
2515
  const body = await readJson(req);
2425
2516
  const peerName = String(body?.peer ?? "").trim();
2426
2517
  const task = String(body?.task ?? "").trim();
@@ -2514,7 +2605,7 @@ function registerUiRoutes(ctx, { discovery, config, identity, inbound, outbound,
2514
2605
  }
2515
2606
  });
2516
2607
 
2517
- route("/mesh/api/probe", async (req, res) => {
2608
+ post("/mesh/api/probe", async (req, res) => {
2518
2609
  const body = await readJson(req);
2519
2610
  const found = findPeer(String(body?.peer ?? "").trim());
2520
2611
  if (found.error) return send(res, 404, { ok: false, error: found.error });