@stage-labs/metro 0.1.0-beta.143 → 0.1.0-beta.144

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.143",
3
+ "version": "0.1.0-beta.144",
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.143",
3
+ "version": "0.1.0-beta.144",
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",
@@ -9,6 +9,7 @@ import { errMsg, log } from '@metro-labs/core/log';
9
9
  export interface RelayApiDeps {
10
10
  target: (connectorId: string, force: boolean) => Promise<RelayTarget>;
11
11
  identify: (req: IncomingMessage) => AgentIdentity | null;
12
+ signedOut: (connectorId: string) => void;
12
13
  }
13
14
 
14
15
  const ID_PATH_RE = /^\/relay\/([A-Za-z0-9][A-Za-z0-9_-]{10})$/;
@@ -242,6 +243,7 @@ async function relayExchange(
242
243
  }
243
244
  if (out.kind === 'signin') {
244
245
  noteHealth(connectorId, false, 'the sign-in has expired, connect it again');
246
+ deps.signedOut(connectorId);
245
247
  signinAnswer(res, connectorId);
246
248
  return;
247
249
  }
@@ -201,10 +201,19 @@ export async function localReconnectConnector(
201
201
  return replace(dir, { ...row, config: { ...row.config, auth, verified, oauth: true } });
202
202
  }
203
203
 
204
+ const signedOut = (row: LocalConnectorRow): LocalConnectorRow => ({ ...row, config: { ...row.config, auth: { kind: 'none' }, oauth: true } });
205
+
204
206
  export async function localDisconnectConnector(subject: string, id: string, dir = agentsDir()): Promise<Connector> {
205
207
  const row = rowOrThrow(subject, id, dir);
206
208
  if (row.config.auth.kind !== 'oauth') throw new ConnectorError('that connector is not signed in', 400);
207
- return Promise.resolve(replace(dir, { ...row, config: { ...row.config, auth: { kind: 'none' }, oauth: true } }));
209
+ return Promise.resolve(replace(dir, signedOut(row)));
210
+ }
211
+
212
+ export function localMarkSignedOut(id: string, dir = agentsDir()): void {
213
+ const row = readLocalConnectors(dir).find((r) => r.id === id);
214
+ if (row?.config.auth.kind !== 'oauth') return;
215
+ log.info({ id, name: row.name }, 'local relay: the vendor refused the token after a refresh; the connector is signed out');
216
+ replace(dir, signedOut(row));
208
217
  }
209
218
 
210
219
  async function freshAuth(auth: ConnectorAuth, resource: string): Promise<ConnectorAuth> {
@@ -27,6 +27,7 @@ import {
27
27
  localRelayTarget,
28
28
  localRenameConnector,
29
29
  localVerifyConnector,
30
+ localMarkSignedOut,
30
31
  localConnectorTools,
31
32
  } from '../connectors/store.js';
32
33
  import {
@@ -142,6 +143,9 @@ const relayApi: RelayApiDeps = {
142
143
  const who = authenticate(req);
143
144
  return who?.kind === 'agent' ? { subject: 'agent-key', agentId: who.agentId } : null;
144
145
  },
146
+ signedOut: (id) => {
147
+ localMarkSignedOut(id);
148
+ },
145
149
  };
146
150
 
147
151
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.0-beta.143"
2
+ "version": "0.1.0-beta.144"
3
3
  }