@stage-labs/metro 0.1.0-beta.36 → 0.1.0-beta.37
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.37",
|
|
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": {
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import type { AccountRef } from './account-attach.js';
|
|
24
24
|
import {
|
|
25
25
|
AGENT_FILE,
|
|
26
|
+
AgentFileError,
|
|
26
27
|
agentsDir,
|
|
27
28
|
listAgentFiles,
|
|
28
29
|
parseAgentFile,
|
|
@@ -224,17 +225,7 @@ export async function localImportAgent(
|
|
|
224
225
|
409,
|
|
225
226
|
);
|
|
226
227
|
assertUnclaimed(storedAgents(dir), agent);
|
|
227
|
-
const file =
|
|
228
|
-
JSON.stringify({
|
|
229
|
-
version: 1,
|
|
230
|
-
id: agent.id,
|
|
231
|
-
name: agent.name,
|
|
232
|
-
key: agent.key,
|
|
233
|
-
owner: localOwner(dir),
|
|
234
|
-
stations: agent.accounts.map((a) => ({ ...a, allowlist: a.allowlist ?? ['*'] })),
|
|
235
|
-
}),
|
|
236
|
-
path,
|
|
237
|
-
);
|
|
228
|
+
const file = fileFor(agent, localOwner(dir), path);
|
|
238
229
|
ensureSecureDir(folder);
|
|
239
230
|
save({ path, file });
|
|
240
231
|
registerKey(agent.key, agent.id);
|
|
@@ -246,6 +237,26 @@ export async function localImportAgent(
|
|
|
246
237
|
});
|
|
247
238
|
}
|
|
248
239
|
|
|
240
|
+
function fileFor(agent: LoadedAgent, owner: string | null, path: string): AgentFile {
|
|
241
|
+
try {
|
|
242
|
+
return parseAgentFile(
|
|
243
|
+
JSON.stringify({
|
|
244
|
+
version: 1,
|
|
245
|
+
id: agent.id,
|
|
246
|
+
name: agent.name,
|
|
247
|
+
key: agent.key,
|
|
248
|
+
owner,
|
|
249
|
+
stations: agent.accounts.map((a) => ({ ...a, allowlist: a.allowlist ?? ['*'] })),
|
|
250
|
+
}),
|
|
251
|
+
path,
|
|
252
|
+
);
|
|
253
|
+
} catch (err) {
|
|
254
|
+
if (err instanceof AgentFileError)
|
|
255
|
+
throw new AgentAdminError(`metro's copy of this agent cannot be written here: ${err.message}`, 400);
|
|
256
|
+
throw err;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
249
260
|
function removeIfEmpty(folder: string): void {
|
|
250
261
|
try {
|
|
251
262
|
rmdirSync(folder);
|
|
@@ -7,7 +7,7 @@ import type { LoadedAccount, LoadedAgent, StationSource } from './materialize.js
|
|
|
7
7
|
|
|
8
8
|
export const AGENT_FILE = 'agent.json';
|
|
9
9
|
|
|
10
|
-
const KEY_RE = /^mk_[A-Za-z0-9_-]{
|
|
10
|
+
const KEY_RE = /^mk_[A-Za-z0-9_-]{16,128}$/;
|
|
11
11
|
const ADDRESS_RE = /^0x[0-9a-f]{40}$/;
|
|
12
12
|
const STATION_NAMES = new Set<string>(STATIONS);
|
|
13
13
|
|
package/runtime/runtime.json
CHANGED