vyomi-tunnel 1.3.1 → 1.3.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/README.md CHANGED
@@ -69,16 +69,49 @@ ssh -i ~/.ssh/vyomi-<instance>.pem -p 22000 ec2-user@127.0.0.1
69
69
  `GET /health` lists `"vm-tcp"` in `features` and the bridged VMs under `vms`.
70
70
  Port range: `VM_PORT_MIN` / `VM_PORT_MAX`.
71
71
 
72
- ## Agents: the Vyomi MCP server (1.3.0+)
72
+ ## Agents: the Vyomi MCP server (1.3.0+): Claude Code, Cursor, VS Code, Codex
73
73
 
74
74
  `vyomi-tunnel mcp` runs the Vyomi MCP server on stdin/stdout for Claude Code and
75
75
  other agents. The package bundles it for macOS (arm64, x64), Linux (arm64, x64) and Windows
76
76
  (x64), so there is nothing else to install:
77
77
 
78
+ Claude Code (the Vyomi plugin adds this server plus setup skills: `claude plugin install vyomi@vyomi`):
79
+
78
80
  ```bash
79
81
  claude mcp add vyomi -- vyomi-tunnel mcp
80
82
  ```
81
83
 
84
+ Cursor: `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):
85
+
86
+ ```json
87
+ { "mcpServers": { "vyomi": { "command": "vyomi-tunnel", "args": ["mcp"] } } }
88
+ ```
89
+
90
+ VS Code (Copilot agent mode): `.vscode/mcp.json` in the project, or `code --add-mcp '{"name":"vyomi","command":"vyomi-tunnel","args":["mcp"]}'`:
91
+
92
+ ```json
93
+ { "servers": { "vyomi": { "type": "stdio", "command": "vyomi-tunnel", "args": ["mcp"] } } }
94
+ ```
95
+
96
+ The portable `.mcp.json` at the project root uses the Cursor shape (`mcpServers`) and works across tools that read it.
97
+
98
+ OpenAI Codex (CLI, IDE extension and app share `~/.codex/config.toml`):
99
+
100
+ ```bash
101
+ codex mcp add vyomi -- vyomi-tunnel mcp
102
+ ```
103
+
104
+ ```toml
105
+ [mcp_servers.vyomi]
106
+ command = "vyomi-tunnel"
107
+ args = ["mcp"]
108
+ ```
109
+
110
+ Editors started from the Dock or Start menu may not see your shell's `PATH`. If the server does not start, use the
111
+ full path from `which vyomi-tunnel` (Windows: `where vyomi-tunnel`) as `command`. Every client gets the same tools and
112
+ the same built-in instructions (including: never write `.env.vyomi` without your yes); the setup skills are Claude
113
+ Code's plugin only.
114
+
82
115
  It finds your simulator (the Nano tab through this tunnel, a local mesh, or your
83
116
  Mesh Codespace), says which one it uses, and gives SDK settings, capability levels
84
117
  and examples for it. It needs no access key; only live Mesh Codespace details do
@@ -48,7 +48,7 @@ const friendly = (portal) => ({
48
48
  Throttled: "too many requests; wait a moment and retry.",
49
49
  });
50
50
 
51
- export async function fetchSession({ creds, fetchFn = globalThis.fetch, now = () => new Date(), version = "1.3.1" }) {
51
+ export async function fetchSession({ creds, fetchFn = globalThis.fetch, now = () => new Date(), version = "1.3.3" }) {
52
52
  const path = "/api/tunnel/session", body = JSON.stringify({ client: "vyomi-tunnel/" + version });
53
53
  const date = now().toISOString().replace(/\.\d+Z$/, "Z");
54
54
  let r;
@@ -16,7 +16,7 @@ export const ALLOWED_ORIGINS = [/^https:\/\/(www\.)?vyomi\.cloud$/, /^https?:\/\
16
16
  export const originAllowed = (origin) => !origin || ALLOWED_ORIGINS.some((re) => re.test(origin));
17
17
  export const hostIsLoopback = (host) => /^(localhost|127\.0\.0\.1|\[::1\])(:\d+)?$/i.test(String(host || ""));
18
18
 
19
- export function createCredsSync({ env = process.env, fetchFn = globalThis.fetch, version = "1.3.1", log = () => {}, intervalMs = 300000, now = () => Date.now() } = {}) {
19
+ export function createCredsSync({ env = process.env, fetchFn = globalThis.fetch, version = "1.3.3", log = () => {}, intervalMs = 300000, now = () => Date.now() } = {}) {
20
20
  const home = env.VYOMI_HOME || join(homedir(), ".vyomi");
21
21
  const file = env.VYOMI_CREDENTIALS_FILE || join(home, "credentials");
22
22
  let st = { state: "unknown", key_id: "", portal: "", checked_at: 0, error: "" };
package/bin/mesh-cli.mjs CHANGED
@@ -229,6 +229,8 @@ const HELP = `vyomi-tunnel - connect your machine to Vyomi
229
229
  let a Nano API Gateway reach your local backend (see: help gateway-backend)
230
230
  vyomi-tunnel reset <code>
231
231
  re-pair this tunnel with your Vyomi account (see: help reset)
232
+ vyomi-tunnel prune [--yes]
233
+ delete stopped Mesh Codespaces you no longer use (see: help prune)
232
234
  vyomi-tunnel start the local relay for the Nano console
233
235
 
234
236
  Agents:
@@ -239,6 +241,12 @@ Get one: 'vyomi-tunnel help credentials'.
239
241
  Log in to a Mesh VM over SSH: 'vyomi-tunnel help ssh'. Something failing? 'vyomi-tunnel help troubleshoot'.
240
242
  `;
241
243
  const DETAILS = {
244
+ prune: `vyomi-tunnel prune [--yes]
245
+
246
+ Lists your stopped Mesh Codespaces (vyomi-mesh-*, state Shutdown or Failed): each keeps its disk on your GitHub
247
+ Codespaces storage until it is deleted. Without --yes it only lists them; with --yes it deletes them.
248
+ Never touched: a running or starting Mesh, your current Mesh (the one your Vyomi session names), the newest Mesh, and any
249
+ Codespace that is not a Mesh. Deleting a Mesh Codespace removes what was in it; start a new Mesh from the Vyomi console.`,
242
250
  reset: `Re-pair this tunnel with your Vyomi account (new access key, same machine)
243
251
 
244
252
  vyomi-tunnel reset <code>
@@ -286,7 +294,8 @@ Add a type to narrow it:
286
294
  vyomi-tunnel list nano vm (also: api, db)
287
295
  vyomi-tunnel list mesh k3s (also: host, instance, llm, service, forward)
288
296
  A type alone works too: vyomi-tunnel list vm
289
- --json prints {schema: 1, rows: [{where, name, type, address, connect}], notes: [...]} (exit 0 rows, 1 none, 2 no key).`,
297
+ --json prints {schema: 1, rows: [{where, name, type, address, connect}], notes: [...]} (exit 0 rows, 1 none, 2 no key).
298
+ --quick answers the Mesh part from your Vyomi session alone (no ssh): the API and your forwards, not VMs / k3s / LLMs.`,
290
299
  ssh: `Log in to a Mesh VM over SSH
291
300
 
292
301
  1. See your Mesh and its VMs:
@@ -356,7 +365,7 @@ export async function main(argv) {
356
365
  if (!cmd || ["help", "-h", "--help", "-help", "-?"].includes(cmd) || rest.some((a) => ["-h", "--help", "-help"].includes(a))) { const topic = cmd === "help" ? rest[0] : (["-h", "--help", "-help", "-?"].includes(cmd) ? undefined : cmd); const t = topic && DETAILS[topic];
357
366
  if (topic && !t) { console.error(`vyomi-tunnel: no help for "${topic}".`); process.stdout.write(HELP); return 2; }
358
367
  process.stdout.write((t || HELP) + (t ? "\n" : "")); return cmd ? 0 : 2; }
359
- if (cmd === "--version" || cmd === "-v" || cmd === "version") { console.log(process.env.VYOMI_TUNNEL_VERSION || "vyomi-tunnel 1.3.1"); return 0; }
368
+ if (cmd === "--version" || cmd === "-v" || cmd === "version") { console.log(process.env.VYOMI_TUNNEL_VERSION || "vyomi-tunnel 1.3.3"); return 0; }
360
369
  const WS = createRequire(import.meta.url)(process.env.WS_PKG || "ws");
361
370
  // Mesh over the user's own ssh session (`--codespace <name>` or VYOMI_MESH_CODESPACE): no relay, no token (mesh-ssh.mjs).
362
371
  const ci = rest.indexOf("--codespace");
@@ -407,13 +416,38 @@ export async function main(argv) {
407
416
  console.log(`mapped ${m.from} -> ${m.to}\n(${g.mapFile()}; a running relay uses it immediately)`);
408
417
  return 0;
409
418
  }
419
+ if (cmd === "prune") { // stopped Mesh Codespaces keep their disk until deleted
420
+ const yes = rest.includes("--yes");
421
+ const { ensureGh } = await import("./gh-manager.mjs");
422
+ let env = { ...process.env };
423
+ let current = "";
424
+ try { const { createSessionManager } = await import("./credentials.mjs"); const sx = await createSessionManager({}).get(); // the session's GitHub token, if any
425
+ if (sx.githubToken) env.GH_TOKEN = sx.githubToken; current = sx.codespace || ""; } catch { /* the user's own gh login then */ }
426
+ let gh; try { gh = (await ensureGh({ log: (m) => console.error("vyomi-tunnel: " + m) })).path; } catch (e) { console.error("vyomi-tunnel: " + e.message); return 1; }
427
+ const { spawnSync } = await import("node:child_process");
428
+ const ls = spawnSync(gh, ["codespace", "list", "--json", "name,state,createdAt"], { env, encoding: "utf8" });
429
+ if (ls.status !== 0) { const ssh = await import("./mesh-ssh.mjs"); console.error("vyomi-tunnel: " + ssh.ghListError(ls.stderr)); return 1; }
430
+ let all; try { all = JSON.parse(ls.stdout || "[]"); } catch { all = []; }
431
+ const meshes = all.filter((c) => /^vyomi-mesh-/.test(c.name || "")).sort((a, b) => String(b.createdAt).localeCompare(String(a.createdAt)));
432
+ const newest = meshes[0] && meshes[0].name;
433
+ const stale = meshes.filter((c) => ["Shutdown", "Failed"].includes(c.state) && c.name !== current && c.name !== newest);
434
+ if (!stale.length) { console.log(`No stopped Mesh Codespaces to delete (${meshes.length} Mesh Codespace${meshes.length === 1 ? "" : "s"} on your account).`); return 0; }
435
+ for (const c of stale) console.log(` ${c.name} ${c.state} created ${String(c.createdAt || "").slice(0, 10)}`);
436
+ if (!yes) { console.log(`\n${stale.length} stopped Mesh Codespace${stale.length === 1 ? "" : "s"} still use${stale.length === 1 ? "s" : ""} storage. Delete with: vyomi-tunnel prune --yes`); return 0; }
437
+ let failed = 0;
438
+ for (const c of stale) {
439
+ const d = spawnSync(gh, ["codespace", "delete", "-c", c.name, "--force"], { env, encoding: "utf8" });
440
+ if (d.status === 0) console.log(`deleted ${c.name}`); else { failed++; console.error(`vyomi-tunnel: could not delete ${c.name}: ${String(d.stderr || "").trim().split("\n")[0]}`); }
441
+ }
442
+ return failed ? 1 : 0;
443
+ }
410
444
  if (cmd === "reset") { // re-pair with the account: same code flow as the console's Reset tunnel button
411
445
  const arg = String(rest.find((x) => !x.startsWith("-")) || "");
412
446
  const code = arg.replace(/[?#].*$/, "").replace(/\/+$/, "").split("/").pop();
413
447
  if (!/^[A-Za-z0-9_-]{20,64}$/.test(code)) { console.error("usage: vyomi-tunnel reset <code> (get a code in the Vyomi console: Setup Tunnel > Get install command; see `vyomi-tunnel help reset`)"); return 2; }
414
448
  const { createCredsSync } = await import("./creds-sync.mjs");
415
449
  try {
416
- const cs = createCredsSync({ version: process.env.VYOMI_TUNNEL_VERSION_NUM || "1.3.1" });
450
+ const cs = createCredsSync({ version: process.env.VYOMI_TUNNEL_VERSION_NUM || "1.3.3" });
417
451
  const st = await cs.reset(code, os.hostname());
418
452
  console.log(st.state === "ok" ? `Done. The tunnel now uses access key ${st.key_id}.` : `The new key was saved (${st.key_id}) but the portal answered: ${st.error || st.state}.`);
419
453
  try { await fetch(`http://127.0.0.1:${process.env.RELAY_PORT || 8090}/reload`, { method: "POST", signal: AbortSignal.timeout(3000) }); console.log("The running tunnel reloaded it."); }
@@ -450,7 +484,14 @@ export async function main(argv) {
450
484
  if (kinds.some((k) => ["host", "instance", "k3s", "llm", "service"].includes(k))) { // Mesh also needs a plan that allows it
451
485
  const o = meshDown ? { error: auth.error } : await openMesh({ cs, configure: false });
452
486
  if (o.error) meshP = Promise.resolve({ err: o.error });
453
- else {
487
+ else if (rest.includes("--quick") && !cs && o.sess && o.sess.codespace) {
488
+ // --quick (the MCP's status probe): the signed session already names the Mesh Codespace and its state, so answer without gh / ssh
489
+ // (an ssh round trip costs 7-9 s from far regions). The api row is the Mesh API by name; VMs, k3s and LLM rows need the full list.
490
+ // A Codespace that is not running is reported, never woken. A --codespace / VYOMI_MESH_CODESPACE override takes the full path.
491
+ const st = o.sess.meshState || "";
492
+ if (st && st !== "Available") { notes.push(`mesh: your Mesh Codespace ${o.sess.codespace} is ${st}. Start Mesh in the Vyomi console (or wait if it is starting).`); meshP = Promise.resolve({ ts: [], cs: o.sess.codespace, api: false }); }
493
+ else { meshP = Promise.resolve({ ts: [], cs: o.sess.codespace, api: true }); notes.push("quick: VMs, k3s and LLM rows are not listed here; `vyomi-tunnel list mesh` lists them"); }
494
+ } else {
454
495
  transport = o.transport;
455
496
  meshP = transport.list().then(async (ts) => ({ ts, cs: transport.codespace, api: !!(await transport.simulatorTarget().catch(() => null)) })).catch((e) => ({ err: e.message }));
456
497
  }
@@ -66,7 +66,7 @@ function friendlyError(e) {
66
66
  process.on("unhandledRejection", (e) => { console.error(`vyomi-tunnel: ${friendlyError(e)}`); if (process.env.VYOMI_DEBUG) console.error(e && e.stack); process.exit(1); });
67
67
 
68
68
  // Mesh / SSH client subcommands (no relay is started for these): login | config | connect <vm> | status | forward <target> <local>:<remote> | keep
69
- if (["login", "config", "connect", "status", "forward", "keep", "reset", "gh-login", "gateway-backend", "list", "ls", "help", "-h", "--help", "-help", "--version", "-v", "version"].includes(process.argv[2])) {
69
+ if (["login", "config", "connect", "status", "forward", "keep", "reset", "prune", "gh-login", "gateway-backend", "list", "ls", "help", "-h", "--help", "-help", "--version", "-v", "version"].includes(process.argv[2])) {
70
70
  const { main } = await import("./mesh-cli.mjs");
71
71
  try {
72
72
  process.exit(await main(process.argv.slice(2)));
@@ -86,7 +86,7 @@ if (process.argv[2]) {
86
86
 
87
87
  // The tunnel keeps running even when its key is missing, revoked or wrong (a service manager would crash-loop it otherwise): the state is
88
88
  // shown on /health, re-checked on a timer and when ~/.vyomi/credentials changes, and the Vyomi page can re-pair it (POST /reset).
89
- const VERSION = "1.3.1";
89
+ const VERSION = "1.3.3";
90
90
  const credsSync = createCredsSync({ version: VERSION, log: (m) => console.log("[creds] " + m) });
91
91
  const PORT = Number(process.env.RELAY_PORT || 8090);
92
92
  if (!Number.isInteger(PORT) || PORT < 1 || PORT > 65535) { console.error(`vyomi-tunnel: ${friendlyError({ code: "ERR_SOCKET_BAD_PORT" })}`); process.exit(2); }
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vyomi-tunnel",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Vyomi-Nano local reverse-tunnel — reach the in-browser cloud simulator from any local SDK/CLI. The install-once, zero-cloud counterpart to the hosted Cloudflare relay; the Nano tab auto-detects it and prefers it.",
5
5
  "type": "module",
6
6
  "bin": {