@stage-labs/metro 0.1.0-beta.133 → 0.1.0-beta.134
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 +2 -0
- package/package.json +1 -1
- package/runtime/marketplace/plugin/.claude-plugin/plugin.json +1 -1
- package/runtime/node_modules/@metro-labs/daemon/src/agents/api.ts +2 -16
- package/runtime/node_modules/@metro-labs/daemon/src/boot/boot.ts +6 -1
- package/runtime/node_modules/@metro-labs/daemon/src/routes/local-mode.ts +3 -1
- package/runtime/runtime.json +1 -1
package/dist/claude.js
CHANGED
|
@@ -7,6 +7,7 @@ import { localAgents, pickLocalAgent } from './local.js';
|
|
|
7
7
|
import { PROVIDER_FLAGS } from './provider-flags.js';
|
|
8
8
|
import { localPort, localUrl } from './runtime.js';
|
|
9
9
|
const CHANNEL_FLAGS = ['--dangerously-load-development-channels', 'server:metro'];
|
|
10
|
+
const FRESH_PROMPT_FLAGS = ['--system-prompt-snapshot', 'off'];
|
|
10
11
|
const PERMISSION_MODE_FLAG = { auto: 'auto', bypass: 'bypassPermissions' };
|
|
11
12
|
const KEY_HEADER = 'x-metro-key';
|
|
12
13
|
const PROBE_MS = 3_000;
|
|
@@ -14,6 +15,7 @@ export const claudeArgs = (extra, mcpConfig, mode = 'auto', prompt = null) => [
|
|
|
14
15
|
...CHANNEL_FLAGS,
|
|
15
16
|
'--permission-mode',
|
|
16
17
|
PERMISSION_MODE_FLAG[mode],
|
|
18
|
+
...FRESH_PROMPT_FLAGS,
|
|
17
19
|
...(mcpConfig === undefined ? [] : ['--mcp-config', mcpConfig]),
|
|
18
20
|
...(prompt === null ? [] : ['--append-system-prompt', prompt]),
|
|
19
21
|
...extra,
|
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.134",
|
|
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.134",
|
|
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",
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
} from './admin.js';
|
|
24
24
|
|
|
25
25
|
const PREFIX = '/api/agents';
|
|
26
|
-
const SERVER_NAME = 'metro';
|
|
27
26
|
|
|
28
27
|
export interface AgentApiDeps extends AccountApiDeps {
|
|
29
28
|
listAgents: (subject: string, project: string) => Promise<AgentSummary[]>;
|
|
@@ -73,29 +72,16 @@ export function target(path: string): Target {
|
|
|
73
72
|
|
|
74
73
|
const localMcpEndpoint = (): string => `http://127.0.0.1:${String(webhookPort())}/mcp`;
|
|
75
74
|
|
|
76
|
-
export function mcpAddCommand(key: string): string {
|
|
77
|
-
const url = `${localMcpEndpoint()}?token=${key}`;
|
|
78
|
-
return `claude mcp add --transport http ${SERVER_NAME} "${url}"`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
75
|
interface KeyPayload {
|
|
82
76
|
key: string | null;
|
|
83
77
|
endpoint: string | null;
|
|
84
|
-
command: string | null;
|
|
85
78
|
}
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
key,
|
|
90
|
-
endpoint: `${localMcpEndpoint()}?token=${key}`,
|
|
91
|
-
command: mcpAddCommand(key),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
80
|
+
const credentials = (key: string): KeyPayload => ({ key, endpoint: `${localMcpEndpoint()}?token=${key}` });
|
|
94
81
|
|
|
95
82
|
function keyPayload(agent: AgentSummary): KeyPayload {
|
|
96
83
|
const value = agent.owned ? agent.key : null;
|
|
97
|
-
|
|
98
|
-
return credentials(value);
|
|
84
|
+
return value === null ? { key: null, endpoint: null } : credentials(value);
|
|
99
85
|
}
|
|
100
86
|
|
|
101
87
|
function livenessPayload(
|
|
@@ -23,7 +23,7 @@ import { agentsDir, fileSource } from '../agents/files.js';
|
|
|
23
23
|
import { ConnectorWatch } from '../connectors/watch.js';
|
|
24
24
|
import { syncPluginServers } from '../connectors/plugin-sync.js';
|
|
25
25
|
import { ensureMetroPlugin } from '../claude/plugin-install.js';
|
|
26
|
-
import { unwatchSession, watchSession } from '../claude/session.js';
|
|
26
|
+
import { sessionRunning, stopSession, unwatchSession, watchSession } from '../claude/session.js';
|
|
27
27
|
import { tryClaudeSetup } from '../claude/setup.js';
|
|
28
28
|
import { applyLocalOwner } from './local-owner.js';
|
|
29
29
|
import { ensureLocalAgent, localOwner } from '../agents/file-admin.js';
|
|
@@ -116,6 +116,11 @@ function sessionApis(): SessionApis {
|
|
|
116
116
|
onShutdown();
|
|
117
117
|
},
|
|
118
118
|
closeAgentSession,
|
|
119
|
+
restartClaudeSession: () => {
|
|
120
|
+
if (!sessionRunning()) return false;
|
|
121
|
+
stopSession();
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
119
124
|
gatherAccounts: gatherAccountsForAgents,
|
|
120
125
|
capabilities: accountStationCapabilities,
|
|
121
126
|
liveness: agentLiveness,
|
|
@@ -54,6 +54,7 @@ export interface LocalModeDeps {
|
|
|
54
54
|
restart: () => void;
|
|
55
55
|
stop: () => void;
|
|
56
56
|
closeAgentSession: (id: string) => Promise<boolean>;
|
|
57
|
+
restartClaudeSession: () => boolean;
|
|
57
58
|
gatherAccounts: AgentApiDeps['gatherAccounts'];
|
|
58
59
|
capabilities: AgentApiDeps['capabilities'];
|
|
59
60
|
liveness: AgentApiDeps['liveness'];
|
|
@@ -90,7 +91,8 @@ function agentApi(deps: LocalModeDeps): AgentApiDeps {
|
|
|
90
91
|
resetKey: async (subject, id) => {
|
|
91
92
|
const reset = await localResetAgentKey(subject, id);
|
|
92
93
|
const closed = await deps.closeAgentSession(id);
|
|
93
|
-
|
|
94
|
+
const restarted = deps.restartClaudeSession();
|
|
95
|
+
log.info({ agent: reset.name, id, sessionClosed: closed, claudeRestarted: restarted }, 'local: key rotated');
|
|
94
96
|
return reset;
|
|
95
97
|
},
|
|
96
98
|
gatherAccounts: deps.gatherAccounts,
|
package/runtime/runtime.json
CHANGED