@usex/mikrotik-mcp 4.19.0 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cli.js +13 -1
  2. package/dist/index.d.ts +17 -0
  3. package/dist/index.js +1 -1
  4. package/dist/shared/{cli-dv2kmsh2.js → cli-4tycy2mf.js} +3598 -3557
  5. package/dist/shared/{cli-7jxnfmp0.js → cli-g27x73vg.js} +1 -1
  6. package/dist/shared/{library-7m2c1g1y.js → library-v21pwa2g.js} +3595 -3557
  7. package/dist/shared/{library-77r1j24d.js → library-w7gzvedz.js} +1 -1
  8. package/dist/ui/observability.html +60 -60
  9. package/package.json +3 -3
  10. package/schemas/tool-catalog.json +34 -9
  11. package/schemas/tools/add_ovpn_server.json +1 -0
  12. package/schemas/tools/build_wireguard_mesh.json +3 -2
  13. package/schemas/tools/create_bridge.json +1 -0
  14. package/schemas/tools/create_eoip_tunnel.json +1 -0
  15. package/schemas/tools/create_gre_tunnel.json +1 -0
  16. package/schemas/tools/create_ipip_tunnel.json +1 -0
  17. package/schemas/tools/create_l2tp_client.json +1 -0
  18. package/schemas/tools/create_ovpn_client.json +1 -0
  19. package/schemas/tools/create_pptp_client.json +1 -0
  20. package/schemas/tools/create_sstp_client.json +1 -0
  21. package/schemas/tools/create_vlan_interface.json +1 -0
  22. package/schemas/tools/create_vxlan_tunnel.json +1 -0
  23. package/schemas/tools/create_wireguard_interface.json +3 -1
  24. package/schemas/tools/create_wireless_interface.json +3 -1
  25. package/schemas/tools/design_network_segment.json +1 -0
  26. package/schemas/tools/update_bridge.json +3 -1
  27. package/schemas/tools/update_vlan_interface.json +3 -1
  28. package/schemas/tools/update_wireguard_interface.json +3 -1
  29. package/schemas/tools/update_wireless_interface.json +3 -1
package/dist/cli.js CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  captureSnapshot,
41
41
  checkForUpdate,
42
42
  closeAll,
43
+ closeDevice,
43
44
  closeMemoryStore,
44
45
  commandUnsupported,
45
46
  configureRecorder,
@@ -123,7 +124,7 @@ import {
123
124
  updateAaaEntity,
124
125
  updateSummaryLine,
125
126
  writeBackup
126
- } from "./shared/cli-dv2kmsh2.js";
127
+ } from "./shared/cli-4tycy2mf.js";
127
128
 
128
129
  // src/cli.ts
129
130
  import { existsSync as existsSync2 } from "fs";
@@ -2997,6 +2998,17 @@ async function runDashboard(cfg, transportLabel) {
2997
2998
  ...devicesPayload(db)
2998
2999
  });
2999
3000
  }
3001
+ if ((url.pathname === "/api/devices/test" || url.pathname === "/api/devices/reconnect") && req.method === "POST") {
3002
+ const b = await readJson(req);
3003
+ const name = typeof b?.device === "string" ? b.device : "";
3004
+ const cfg2 = getConfig();
3005
+ if (!(name in cfg2.devices))
3006
+ return json3({ error: `unknown device: ${name}` }, 404);
3007
+ if (url.pathname === "/api/devices/reconnect")
3008
+ closeDevice(name);
3009
+ const status = await probeDevice(name, cfg2.devices[name]);
3010
+ return json3({ ok: true, status, ...devicesPayload(db) });
3011
+ }
3000
3012
  if (url.pathname === "/api/topology") {
3001
3013
  return json3(topologyPayload());
3002
3014
  }
package/dist/index.d.ts CHANGED
@@ -280,6 +280,14 @@ declare class SafeModeManager {
280
280
  private ssh;
281
281
  private channel;
282
282
  private active;
283
+ /**
284
+ * Set when the persistent shell drops WHILE Safe Mode was active — i.e. the
285
+ * session died before an explicit commit, so RouterOS has already auto-reverted
286
+ * every staged change. Distinguishes "never enabled / cleanly closed" from
287
+ * "died with your changes still pending" so commit/status can report the revert
288
+ * instead of a reassuring false success. Cleared on the next enable().
289
+ */
290
+ private droppedUnexpectedly;
283
291
  /** Serializes channel access so concurrent tool calls don't interleave I/O. */
284
292
  private queue;
285
293
  /** The device this Safe Mode session belongs to (a configured device name). */
@@ -308,6 +316,15 @@ declare class SafeModeManager {
308
316
  rollback(): Promise<string>;
309
317
  status(): string;
310
318
  /**
319
+ * Fired by the persistent shell's `close`/`error` events. Arrow-bound so the
320
+ * same reference is used for add/removeListener. Acts ONLY when we still think
321
+ * Safe Mode is active — a drop then means the session died with staged changes
322
+ * pending, which RouterOS has auto-reverted, so we flag it and tear the zombie
323
+ * handles down. A close during our own cleanup() (which clears `active` first)
324
+ * is a no-op: it is an intentional teardown, not a lost session.
325
+ */
326
+ private readonly handleUnexpectedDrop;
327
+ /**
311
328
  * Read from the channel until `isDone(cleaned)` is satisfied or the shell goes
312
329
  * SILENT. Defaults to "any RouterOS prompt appeared". Mode transitions pass a
313
330
  * stricter predicate so they wait for the prompt that reflects the NEW state
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  selectToolModules,
30
30
  setConfig,
31
31
  updateSummaryLine
32
- } from "./shared/library-7m2c1g1y.js";
32
+ } from "./shared/library-v21pwa2g.js";
33
33
  // src/server.ts
34
34
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
35
35
  import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";