@stage-labs/metro 0.1.0-beta.24 → 0.1.0-beta.25

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.24",
3
+ "version": "0.1.0-beta.25",
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": {
@@ -14,7 +14,7 @@ import {
14
14
  import { attachmentOwner, recordAttachmentOwner } from './attach-owner.js';
15
15
  import { grantAllows, issueAttachmentGrant } from './attach-grant.js';
16
16
  import { errMsg, log } from './log.js';
17
- import { loadTunnelConfig } from './tunnel.js';
17
+ import { loadTunnelConfig, webhookPort } from './tunnel.js';
18
18
 
19
19
  function authorized(req: IncomingMessage, name: string): boolean {
20
20
  const owner = attachmentOwner(name);
@@ -34,14 +34,19 @@ export function publicBaseUrl(): string | null {
34
34
  return host ? `https://${host}` : null;
35
35
  }
36
36
 
37
+ const localBase = (): string | null =>
38
+ (process.env.METRO_RUN_TOKEN?.trim() ?? '') === ''
39
+ ? null
40
+ : `http://127.0.0.1:${String(webhookPort())}`;
41
+
37
42
  export const publicBaseOrDefault = (): string =>
38
- publicBaseUrl() ?? DEFAULT_PUBLIC_BASE;
43
+ publicBaseUrl() ?? localBase() ?? DEFAULT_PUBLIC_BASE;
39
44
 
40
45
  export function attachmentUrl(
41
46
  pathOrName: string,
42
47
  agentId: string,
43
48
  ): string | null {
44
- const base = publicBaseUrl();
49
+ const base = publicBaseUrl() ?? localBase();
45
50
  if (!base) return null;
46
51
  const name = pathOrName.split('/').pop();
47
52
  if (!name || !resolveCachedAttachment(name)) return null;
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.0-beta.24"
2
+ "version": "0.1.0-beta.25"
3
3
  }