@stage-labs/metro 0.1.0-beta.80 → 0.1.0-beta.82
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/dist/serve.js
CHANGED
|
@@ -90,7 +90,11 @@ function tailscaleStatus(bin) {
|
|
|
90
90
|
return { ok: false, state: 'not running' };
|
|
91
91
|
try {
|
|
92
92
|
const parsed = JSON.parse(run.stdout);
|
|
93
|
-
|
|
93
|
+
if (parsed.BackendState !== 'Running')
|
|
94
|
+
return { ok: false, state: String(parsed.BackendState) };
|
|
95
|
+
if (parsed.Self?.Online === false)
|
|
96
|
+
return { ok: false, state: 'Running, but not connected to the tailnet: the machine may have been removed from it' };
|
|
97
|
+
return { ok: true };
|
|
94
98
|
}
|
|
95
99
|
catch {
|
|
96
100
|
return { ok: false, state: 'unreadable' };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stage-labs/metro",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.82",
|
|
4
4
|
"description": "The metro command line. Sign in once per machine, then hand your MCP connector list to Claude Code without the credentials touching disk, argv or shell history.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -7,7 +7,6 @@ import { mintTerminalTicket } from './tickets.js';
|
|
|
7
7
|
|
|
8
8
|
const PREFIX = '/api/terminal';
|
|
9
9
|
const TICKETS = `${PREFIX}/tickets`;
|
|
10
|
-
export const TMUX_SESSION = 'metro';
|
|
11
10
|
const SESSION_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/;
|
|
12
11
|
|
|
13
12
|
export const tmuxCommand = (session: string): string[] => ['tmux', 'new-session', '-A', '-D', '-s', session, ';', 'set-option', '-g', 'mouse', 'on'];
|
|
@@ -33,7 +32,8 @@ export function tmuxSessions(): string[] {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export function sessionOf(raw: unknown): string {
|
|
36
|
-
if (raw === undefined || raw === null || raw === '')
|
|
35
|
+
if (raw === undefined || raw === null || raw === '')
|
|
36
|
+
throw new ApiError('name the tmux session to open; GET /api/terminal lists the ones that exist', 400);
|
|
37
37
|
if (typeof raw !== 'string' || !SESSION_RE.test(raw))
|
|
38
38
|
throw new ApiError('a session name is 1 to 32 letters, digits, dots, dashes or underscores', 400);
|
|
39
39
|
return raw;
|
|
@@ -56,7 +56,7 @@ export function handleTerminalRequest(req: IncomingMessage, res: ServerResponse,
|
|
|
56
56
|
if (!session) throw new ApiError('unauthorized', 401);
|
|
57
57
|
deps.authorize(session.subject);
|
|
58
58
|
if (path === PREFIX) {
|
|
59
|
-
sendJson(req, res, 200, { available: tmuxAvailable(deps),
|
|
59
|
+
sendJson(req, res, 200, { available: tmuxAvailable(deps), sessions: tmuxSessions() });
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const wanted = sessionOf(bodyField(await readJsonBody(req), 'session'));
|
package/runtime/runtime.json
CHANGED