@stage-labs/metro 0.1.0-beta.116 → 0.1.0-beta.117
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 +1 -1
- package/runtime/marketplace/plugin/.claude-plugin/plugin.json +1 -1
- package/runtime/marketplace/plugin/bin/guard.mjs +6 -1
- package/runtime/marketplace/plugin/orchestrator.md +1 -1
- package/runtime/node_modules/@metro-labs/daemon/src/gateway/openrouter.ts +19 -3
- package/runtime/runtime.json +1 -1
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.117",
|
|
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.117",
|
|
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",
|
|
@@ -20,6 +20,8 @@ const ORCHESTRATION = new Set([
|
|
|
20
20
|
'TaskUpdate',
|
|
21
21
|
]);
|
|
22
22
|
const IMAGE = /\.(png|jpe?g|gif|webp|bmp)$/i;
|
|
23
|
+
const MCP = /^mcp__/;
|
|
24
|
+
const METRO_MCP = /^mcp__metro__/;
|
|
23
25
|
|
|
24
26
|
function deny(reason) {
|
|
25
27
|
process.stdout.write(
|
|
@@ -35,7 +37,10 @@ function verdict(payload) {
|
|
|
35
37
|
if (typeof payload.agent_id === 'string' && payload.agent_id !== '') return null;
|
|
36
38
|
if (tool === 'Agent' && input.run_in_background === false)
|
|
37
39
|
return 'A foreground subagent blinds the main thread: it cannot see or acknowledge inbound metro messages until the agent finishes. Re-issue the identical Agent call with run_in_background: true, then wait for the task notification.';
|
|
38
|
-
if (ORCHESTRATION.has(tool)
|
|
40
|
+
if (ORCHESTRATION.has(tool)) return null;
|
|
41
|
+
if (METRO_MCP.test(tool)) return null;
|
|
42
|
+
if (MCP.test(tool))
|
|
43
|
+
return `A connector call is work, not orchestration: ${tool} reads somebody's files, mail or records, and its answer can be long enough to crowd out the chat you are here to follow. Only metro's own tools run on this thread. Delegate it to a subagent with the Agent tool (run_in_background: true; the worker reaches every connector) and relay what it finds.`;
|
|
39
44
|
if (tool === 'Read' && typeof input.file_path === 'string' && IMAGE.test(input.file_path)) return null;
|
|
40
45
|
return `The main thread is orchestrator-only, so ${tool === '' ? 'this tool' : tool} is not available here. Delegate the work to a subagent with the Agent tool (run_in_background: true; the worker agent has full tool access) or to a Workflow, and report the result over metro.`;
|
|
41
46
|
}
|
|
@@ -7,7 +7,7 @@ You are the main thread of a Claude Code session that is connected to chat throu
|
|
|
7
7
|
|
|
8
8
|
**Inbound.** A message arrives as a `<channel source="metro" …>` block. Read `addressed` first: `direct`, `mention` or `reply` means it is for you; without it the message merely happened in a room you watch, so treat it as context and stay silent unless the person plainly wants you. For a message that is for you, the first tool call is `react` on it (👀, then 👍 or ✅ once done) so the person knows you saw it, and any reply goes on the same `line`, passed verbatim.
|
|
9
9
|
|
|
10
|
-
**Delegate everything that is work.** Reading files, running commands, searching, fetching pages, editing: hand it to a subagent with the `Agent` tool, `subagent_type: "worker"`, always `run_in_background: true`, then keep answering chat while it runs and relay the result when the task notification arrives. A foreground subagent blinds you to chat and the guard refuses it. You may read image files yourself, so a screenshot someone sends is yours to look at.
|
|
10
|
+
**Delegate everything that is work.** Reading files, running commands, searching, fetching pages, editing, and every connector tool: hand it to a subagent with the `Agent` tool, `subagent_type: "worker"`, always `run_in_background: true`, then keep answering chat while it runs and relay the result when the task notification arrives. A foreground subagent blinds you to chat and the guard refuses it. You may read image files yourself, so a screenshot someone sends is yours to look at.
|
|
11
11
|
|
|
12
12
|
**Never wait on the terminal.** `AskUserQuestion`, plan mode and anything that blocks for a person at the keyboard are denied everywhere, main thread and subagents alike. When something is ambiguous, do what does not depend on it, choose the most reasonable reading, say so in your reply, and if a real decision is needed ask over chat with `send` and carry on. Tool-approval prompts reach the chat too; the person answers `yes <id>` or `no <id>` there.
|
|
13
13
|
|
|
@@ -9,6 +9,7 @@ export interface OpenRouterModel {
|
|
|
9
9
|
name: string;
|
|
10
10
|
prompt: number | null;
|
|
11
11
|
completion: number | null;
|
|
12
|
+
created: number | null;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const str = (value: unknown): string => (typeof value === 'string' ? value : '');
|
|
@@ -18,12 +19,27 @@ function price(raw: unknown): number | null {
|
|
|
18
19
|
return Number.isFinite(value) && value >= 0 ? value : null;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
function released(raw: unknown): number | null {
|
|
23
|
+
return typeof raw === 'number' && Number.isFinite(raw) && raw > 0 ? raw : null;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
function modelOf(entry: unknown): OpenRouterModel | null {
|
|
22
27
|
if (!isRecord(entry)) return null;
|
|
23
28
|
const id = str(entry.id);
|
|
24
29
|
if (id === '') return null;
|
|
25
30
|
const pricing = isRecord(entry.pricing) ? entry.pricing : {};
|
|
26
|
-
return {
|
|
31
|
+
return {
|
|
32
|
+
id,
|
|
33
|
+
name: str(entry.name) || id,
|
|
34
|
+
prompt: price(pricing.prompt),
|
|
35
|
+
completion: price(pricing.completion),
|
|
36
|
+
created: released(entry.created),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function newestFirst(a: OpenRouterModel, b: OpenRouterModel): number {
|
|
41
|
+
const when = (b.created ?? 0) - (a.created ?? 0);
|
|
42
|
+
return when !== 0 ? when : a.id.localeCompare(b.id);
|
|
27
43
|
}
|
|
28
44
|
|
|
29
45
|
export async function openrouterModels(base = OPENROUTER_BASE, fetchImpl: typeof fetch = fetch): Promise<OpenRouterModel[]> {
|
|
@@ -35,8 +51,8 @@ export async function openrouterModels(base = OPENROUTER_BASE, fetchImpl: typeof
|
|
|
35
51
|
return data
|
|
36
52
|
.map(modelOf)
|
|
37
53
|
.filter((model): model is OpenRouterModel => model !== null)
|
|
38
|
-
.
|
|
39
|
-
.
|
|
54
|
+
.sort(newestFirst)
|
|
55
|
+
.slice(0, MODELS_MAX);
|
|
40
56
|
}
|
|
41
57
|
|
|
42
58
|
export async function openrouterZdrModels(base = OPENROUTER_BASE, fetchImpl: typeof fetch = fetch): Promise<string[]> {
|
package/runtime/runtime.json
CHANGED