@stage-labs/metro 0.1.0-beta.122 → 0.1.0-beta.123
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/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.123",
|
|
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": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.123",
|
|
4
4
|
"description": "Metro for Claude Code, installed by the metro daemon on this machine: every connector the agent holds as its own MCP server relayed through the daemon, the orchestrator-only guard on the main thread, the standing rules loaded at each session start, and a refresh skill for when the daemon could not keep the server list current. No vendor credential ever sits in a config file.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bonustrack",
|
|
@@ -8,8 +8,6 @@ import { mintTerminalTicket } from './tickets.js';
|
|
|
8
8
|
|
|
9
9
|
const PREFIX = '/api/terminal';
|
|
10
10
|
const TICKETS = `${PREFIX}/tickets`;
|
|
11
|
-
const BUFFER = `${PREFIX}/buffer`;
|
|
12
|
-
const BUFFER_MAX = 1024 * 1024;
|
|
13
11
|
const SESSION_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/;
|
|
14
12
|
|
|
15
13
|
export const tmuxCommand = (session: string, home = homedir()): string[] => [
|
|
@@ -39,7 +37,6 @@ export const tmuxCommand = (session: string, home = homedir()): string[] => [
|
|
|
39
37
|
];
|
|
40
38
|
|
|
41
39
|
export interface TerminalApiDeps {
|
|
42
|
-
tmux?: string;
|
|
43
40
|
authorize: (subject: string) => void;
|
|
44
41
|
command?: (session: string) => string[];
|
|
45
42
|
}
|
|
@@ -67,15 +64,9 @@ export function sessionOf(raw: unknown): string {
|
|
|
67
64
|
return raw;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
export function tmuxBuffer(tmux = 'tmux'): string {
|
|
71
|
-
const run = spawnSync(tmux, ['save-buffer', '-'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: BUFFER_MAX });
|
|
72
|
-
if (run.error !== undefined || run.status !== 0) throw new ApiError('tmux holds nothing copied yet: select text in the terminal first', 404);
|
|
73
|
-
return run.stdout;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
67
|
export function handleTerminalRequest(req: IncomingMessage, res: ServerResponse, deps: TerminalApiDeps): boolean {
|
|
77
68
|
const path = (req.url ?? '').split('?')[0] ?? '';
|
|
78
|
-
if (path !== PREFIX && path !== TICKETS
|
|
69
|
+
if (path !== PREFIX && path !== TICKETS) return false;
|
|
79
70
|
if (req.method === 'OPTIONS') {
|
|
80
71
|
res.writeHead(204, cors(req)).end();
|
|
81
72
|
return true;
|
|
@@ -93,10 +84,6 @@ export function handleTerminalRequest(req: IncomingMessage, res: ServerResponse,
|
|
|
93
84
|
sendJson(req, res, 200, { available: tmuxAvailable(deps), sessions: tmuxSessions() });
|
|
94
85
|
return;
|
|
95
86
|
}
|
|
96
|
-
if (path === BUFFER) {
|
|
97
|
-
sendJson(req, res, 200, { text: tmuxBuffer(deps.tmux) });
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
87
|
const wanted = sessionOf(bodyField(await readJsonBody(req), 'session'));
|
|
101
88
|
const minted = mintTerminalTicket(session.subject, wanted);
|
|
102
89
|
log.info({ subject: session.subject, session: wanted }, 'terminal: ticket minted');
|
package/runtime/runtime.json
CHANGED