@stage-labs/metro 0.1.0-beta.210 → 0.1.0-beta.211
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": "metro",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.211",
|
|
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,13 +154,42 @@ 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
|
+
function noteLaunchLines(pane: string, seen: Set<string>): void {
|
|
162
|
+
for (const line of pane.split('\n').map((l) => l.trim()))
|
|
163
|
+
if (line.startsWith('metro claude:') && !seen.has(line)) {
|
|
164
|
+
seen.add(line);
|
|
165
|
+
log.info({ line }, 'claude-session: metro claude said');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
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
|
+
|
|
157
179
|
function confirmChannels(tmux: string, until: number): void {
|
|
180
|
+
const seen = new Set<string>();
|
|
181
|
+
let confirmed = false;
|
|
158
182
|
const tick = (): void => {
|
|
159
183
|
const pane = capturePane(tmux);
|
|
160
|
-
|
|
184
|
+
noteLaunchLines(pane, seen);
|
|
185
|
+
if (pane.includes(MCP_MISSING) && pane.includes('server:metro')) {
|
|
186
|
+
relaunchWithoutMcp(tmux);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (!confirmed && pane.includes(WARNING) && pane.includes('server:metro')) {
|
|
161
190
|
spawnSync(...asAgent(tmux, ['send-keys', '-t', SESSION_NAME, 'Enter']), { stdio: 'ignore' });
|
|
162
191
|
log.info('claude-session: confirmed the development channels dialog for server:metro');
|
|
163
|
-
|
|
192
|
+
confirmed = true;
|
|
164
193
|
}
|
|
165
194
|
if (Date.now() < until && sessionRunning(tmux)) setTimeout(tick, CONFIRM_POLL_MS).unref();
|
|
166
195
|
};
|
package/runtime/runtime.json
CHANGED