@stage-labs/metro 0.1.0-beta.211 → 0.1.0-beta.213
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/claude.js
CHANGED
|
@@ -38,6 +38,7 @@ export function gatewayEnv(base, agentKey, port) {
|
|
|
38
38
|
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY: '1',
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
export const channelEnv = (env) => set(env, 'MCP_PROTOCOL_NEGOTIATION') ? env : { ...env, MCP_PROTOCOL_NEGOTIATION: 'legacy' };
|
|
41
42
|
const OWN_CREDENTIALS = ['ANTHROPIC_API_KEY', 'ANTHROPIC_AUTH_TOKEN'];
|
|
42
43
|
export function credentialEnv(env, agentKey, signedIn) {
|
|
43
44
|
if (signedIn || OWN_CREDENTIALS.some((name) => set(env, name)))
|
|
@@ -142,9 +143,9 @@ export async function launchClaude(extra) {
|
|
|
142
143
|
try {
|
|
143
144
|
if ('skip' in decision) {
|
|
144
145
|
process.stderr.write(`metro claude: ${decision.skip}\n`);
|
|
145
|
-
return await runClaude(claudeArgs(extra, mcp?.path, mode, prompt), process.env);
|
|
146
|
+
return await runClaude(claudeArgs(extra, mcp?.path, mode, prompt), channelEnv(process.env));
|
|
146
147
|
}
|
|
147
|
-
return await runClaude(claudeArgs(extra, mcp?.path, mode, prompt), gatewayLaunchEnv(decision.key, port));
|
|
148
|
+
return await runClaude(claudeArgs(extra, mcp?.path, mode, prompt), channelEnv(gatewayLaunchEnv(decision.key, port)));
|
|
148
149
|
}
|
|
149
150
|
finally {
|
|
150
151
|
mcp?.cleanup();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.213",
|
|
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, and the standing rules loaded at each session start. No vendor credential ever sits in a config file.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bonustrack",
|
|
@@ -154,10 +154,6 @@ function capturePane(tmux: string): string {
|
|
|
154
154
|
return run.error === undefined && run.status === 0 ? run.stdout : '';
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
const MCP_MISSING = 'no MCP server configured with that name';
|
|
158
|
-
const RELAUNCH_MAX = 3;
|
|
159
|
-
let relaunches = 0;
|
|
160
|
-
|
|
161
157
|
function noteLaunchLines(pane: string, seen: Set<string>): void {
|
|
162
158
|
for (const line of pane.split('\n').map((l) => l.trim()))
|
|
163
159
|
if (line.startsWith('metro claude:') && !seen.has(line)) {
|
|
@@ -166,26 +162,12 @@ function noteLaunchLines(pane: string, seen: Set<string>): void {
|
|
|
166
162
|
}
|
|
167
163
|
}
|
|
168
164
|
|
|
169
|
-
function relaunchWithoutMcp(tmux: string): void {
|
|
170
|
-
if (relaunches >= RELAUNCH_MAX) {
|
|
171
|
-
log.error('claude-session: Claude Code keeps starting without the metro MCP server, so channel messages cannot reach it; see the metro claude lines above');
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
relaunches += 1;
|
|
175
|
-
log.warn({ attempt: relaunches }, 'claude-session: Claude Code started without the metro MCP server, so channel messages cannot reach it; restarting the session');
|
|
176
|
-
spawnSync(...asAgent(tmux, ['kill-session', '-t', SESSION_NAME]), { stdio: 'ignore' });
|
|
177
|
-
}
|
|
178
|
-
|
|
179
165
|
function confirmChannels(tmux: string, until: number): void {
|
|
180
166
|
const seen = new Set<string>();
|
|
181
167
|
let confirmed = false;
|
|
182
168
|
const tick = (): void => {
|
|
183
169
|
const pane = capturePane(tmux);
|
|
184
170
|
noteLaunchLines(pane, seen);
|
|
185
|
-
if (pane.includes(MCP_MISSING) && pane.includes('server:metro')) {
|
|
186
|
-
relaunchWithoutMcp(tmux);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
171
|
if (!confirmed && pane.includes(WARNING) && pane.includes('server:metro')) {
|
|
190
172
|
spawnSync(...asAgent(tmux, ['send-keys', '-t', SESSION_NAME, 'Enter']), { stdio: 'ignore' });
|
|
191
173
|
log.info('claude-session: confirmed the development channels dialog for server:metro');
|
package/runtime/runtime.json
CHANGED