@stage-labs/metro 0.1.0-beta.76 → 0.1.0-beta.78
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/cli.js +4 -4
- package/dist/runtime-install.js +7 -4
- package/dist/runtime.js +6 -2
- package/dist/serve.js +2 -3
- package/dist/service.js +29 -11
- package/package.json +1 -1
- package/runtime/node_modules/@metro-labs/core/package.json +43 -0
- package/runtime/node_modules/@metro-labs/core/src/endpoints.ts +7 -0
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/events.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/identity.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/protocol.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → core}/src/stations/account-store.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → core}/src/stations/station-runtime.ts +1 -1
- package/runtime/node_modules/@metro-labs/daemon/package.json +47 -0
- package/runtime/node_modules/@metro-labs/{mcp/src/db → daemon/src/agents}/account-attach.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/account-api.ts → daemon/src/agents/accounts-api.ts} +6 -6
- package/runtime/node_modules/@metro-labs/{mcp/src/db/agent-admin.ts → daemon/src/agents/admin.ts} +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/agent-api.ts → daemon/src/agents/api.ts} +6 -6
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/bundle-api.ts → daemon/src/agents/bundle.ts} +7 -7
- package/runtime/node_modules/@metro-labs/{mcp/src/db → daemon/src/agents}/file-admin.ts +9 -9
- package/runtime/node_modules/@metro-labs/{mcp/src/db/file-source.ts → daemon/src/agents/files.ts} +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/db/key-map.ts → daemon/src/agents/keys.ts} +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/db/agent-scope.ts → daemon/src/agents/scope.ts} +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/boot}/boot.ts +23 -51
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/boot}/crash-guard.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/boot}/local-owner.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/boot}/paths.ts +1 -4
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/addressed.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/dedupe.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/inbound.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/pending.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/relay.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/claude-api.ts → daemon/src/claude/api.ts} +7 -7
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/claude-files.ts → daemon/src/claude/files.ts} +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/claude-login.ts → daemon/src/claude/login.ts} +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/claude-settings.ts → daemon/src/claude/settings.ts} +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-api.ts → daemon/src/connectors/api.ts} +6 -6
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/local-cli-api.ts → daemon/src/connectors/cli-api.ts} +5 -5
- package/runtime/node_modules/@metro-labs/{mcp/src/db/connector-config.ts → daemon/src/connectors/config.ts} +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/db/connectors.ts → daemon/src/connectors/model.ts} +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/connectors}/oauth-client.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/connectors}/oauth-discovery.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-oauth-routes.ts → daemon/src/connectors/oauth-routes.ts} +6 -6
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-oauth.ts → daemon/src/connectors/oauth.ts} +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/db/connector-relay.ts → daemon/src/connectors/relay-target.ts} +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/connectors}/relay.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/db/local-connectors.ts → daemon/src/connectors/store.ts} +12 -12
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-tools.ts → daemon/src/connectors/tools.ts} +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-url.ts → daemon/src/connectors/url.ts} +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-verify.ts → daemon/src/connectors/verify.ts} +5 -5
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/files}/attach-grant.ts +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/files}/attach-owner.ts +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/files}/attach-serve.ts +5 -12
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/files}/upload-api.ts +5 -5
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/files}/upload-store.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/bedrock.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/codex-auth.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/codex-device.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/codex-stream.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/codex-translate.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/codex.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/gateway.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/gateway}/model-api.ts +12 -12
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/model-config.ts +3 -3
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/openrouter.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/accounts.ts +3 -7
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/call-tools.ts +3 -3
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/channel-owner.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/ctx.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/frame-scope.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/group-tools.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/index.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/member-tools.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/request-identity.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/session-registry.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/session.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/tool-dispatch.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/upload-tool.ts +5 -5
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/monitor/api.ts +5 -5
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/net}/tunnel.ts +6 -10
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/routes}/http.ts +15 -15
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/identity-routes.ts → daemon/src/routes/identity.ts} +5 -5
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/routes}/local-mode.ts +16 -16
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/routes}/session-apis.ts +14 -20
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/session-api.ts → daemon/src/routes/session.ts} +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/control-api.ts → daemon/src/server/control.ts} +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/machine-api.ts → daemon/src/server/machine.ts} +8 -8
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/update-api.ts → daemon/src/server/update.ts} +5 -5
- package/runtime/node_modules/@metro-labs/daemon/src/server.ts +2 -0
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/attach-resolve.ts +5 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/attach-session.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/attach-xmtp.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/attach.ts +3 -3
- package/runtime/node_modules/@metro-labs/{mcp/src/db → daemon/src/stations}/materialize.ts +9 -14
- package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/registry.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/runtime-deps.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/supervisor-io.ts +2 -2
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/supervisor.ts +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/train-call.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/terminal-api.ts → daemon/src/terminal/api.ts} +4 -4
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon/terminal-ws.ts → daemon/src/terminal/socket.ts} +3 -3
- package/runtime/node_modules/@metro-labs/discord-bot/package.json +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/accounts.ts +2 -2
- package/runtime/node_modules/@metro-labs/discord-bot/src/actions.ts +3 -3
- package/runtime/node_modules/@metro-labs/discord-bot/src/attachments.ts +2 -2
- package/runtime/node_modules/@metro-labs/discord-bot/src/group.ts +2 -2
- package/runtime/node_modules/@metro-labs/discord-bot/src/index.ts +2 -2
- package/runtime/node_modules/@metro-labs/discord-bot/src/members.ts +2 -2
- package/runtime/node_modules/@metro-labs/discord-bot/src/send-files.ts +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/station.ts +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/voice-speak.ts +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/voice-transcribe.ts +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/voice.ts +1 -1
- package/runtime/node_modules/@metro-labs/discord-bot/src/wire.ts +1 -1
- package/runtime/node_modules/@metro-labs/http/package.json +33 -0
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/api-http.ts +1 -1
- package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/signed-identity.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/package.json +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/accounts.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/actions.ts +3 -3
- package/runtime/node_modules/@metro-labs/telegram/src/attachments.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/client.ts +2 -2
- package/runtime/node_modules/@metro-labs/telegram/src/format.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/group.ts +3 -3
- package/runtime/node_modules/@metro-labs/telegram/src/inbound.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/index.ts +3 -3
- package/runtime/node_modules/@metro-labs/telegram/src/media-actions.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/members.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/normalize.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/reactions.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/station.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram/src/wire.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/package.json +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/src/accounts.ts +2 -2
- package/runtime/node_modules/@metro-labs/telegram-bot/src/actions.ts +4 -4
- package/runtime/node_modules/@metro-labs/telegram-bot/src/attachments.ts +2 -2
- package/runtime/node_modules/@metro-labs/telegram-bot/src/format.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/src/index.ts +2 -2
- package/runtime/node_modules/@metro-labs/telegram-bot/src/media-actions.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/src/members.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/src/station.ts +1 -1
- package/runtime/node_modules/@metro-labs/telegram-bot/src/wire.ts +1 -1
- package/runtime/node_modules/@metro-labs/webhook/package.json +1 -1
- package/runtime/node_modules/@metro-labs/webhook/src/station.ts +4 -4
- package/runtime/node_modules/@metro-labs/whatsapp/package.json +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/accounts.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/ack.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/actions.ts +4 -4
- package/runtime/node_modules/@metro-labs/whatsapp/src/attachments.ts +2 -2
- package/runtime/node_modules/@metro-labs/whatsapp/src/auth-state.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/client.ts +2 -2
- package/runtime/node_modules/@metro-labs/whatsapp/src/format.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/inbound.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/index.ts +3 -3
- package/runtime/node_modules/@metro-labs/whatsapp/src/keys.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/login.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/media.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/normalize.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/station.ts +1 -1
- package/runtime/node_modules/@metro-labs/whatsapp/src/token-store.ts +2 -2
- package/runtime/node_modules/@metro-labs/whatsapp/src/wire.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/package.json +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/accounts.ts +2 -2
- package/runtime/node_modules/@metro-labs/xmtp/src/actions-close.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/actions-conv.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/actions-meta.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/actions.ts +3 -3
- package/runtime/node_modules/@metro-labs/xmtp/src/attachments.ts +3 -3
- package/runtime/node_modules/@metro-labs/xmtp/src/conv-helpers.ts +2 -2
- package/runtime/node_modules/@metro-labs/xmtp/src/emit-payloads.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/emit.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/group-members.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/group.ts +2 -2
- package/runtime/node_modules/@metro-labs/xmtp/src/index.ts +2 -2
- package/runtime/node_modules/@metro-labs/xmtp/src/member-args.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/push.ts +2 -2
- package/runtime/node_modules/@metro-labs/xmtp/src/station.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/tools-handlers.ts +3 -3
- package/runtime/node_modules/@metro-labs/xmtp/src/tools.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/transcribe.ts +1 -1
- package/runtime/node_modules/@metro-labs/xmtp/src/wire.ts +1 -1
- package/runtime/runtime.json +1 -1
- package/runtime/server.ts +1 -0
- package/dist/bedrock-eventstream.js +0 -120
- package/dist/bedrock-proxy.js +0 -260
- package/dist/bedrock-upstream.js +0 -72
- package/dist/bedrock.js +0 -37
- package/runtime/node_modules/@metro-labs/mcp/package.json +0 -64
- package/runtime/node_modules/@metro-labs/mcp/src/daemon/server-types.ts +0 -21
- package/runtime/node_modules/@metro-labs/mcp/src/daemon/servers-api.ts +0 -80
- package/runtime/node_modules/@metro-labs/mcp/src/daemon/vault-api.ts +0 -78
- package/runtime/node_modules/@metro-labs/mcp/src/daemon/vault-types.ts +0 -12
- package/runtime/node_modules/@metro-labs/mcp/src/db/client.ts +0 -32
- package/runtime/node_modules/@metro-labs/mcp/src/db/schema.ts +0 -33
- package/runtime/node_modules/@metro-labs/mcp/src/db/servers.ts +0 -83
- package/runtime/node_modules/@metro-labs/mcp/src/db/vault.ts +0 -109
- package/runtime/node_modules/@metro-labs/mcp/src/server.ts +0 -2
- /package/runtime/node_modules/@metro-labs/{mcp/src/db → core/src}/address.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/db → core/src}/ids.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/is-record.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/stations → core/src}/lines.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/log.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/secure-fs.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/db/stations.ts → core/src/station-names.ts} +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → core}/src/stations/attachments.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → core}/src/stations/messaging-normalize.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → core}/src/stations/types.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/mcp → core/src}/str.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/train-error.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → core/src}/version.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/db/agent-map.ts → daemon/src/agents/map.ts} +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/boot}/connect-hint.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/media-note.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/channels/webhook-note.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon/connector-json.ts → daemon/src/connectors/json.ts} +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/connectors}/oauth-pending.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/eventstream.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/forward.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/gateway/served.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/event-store.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/permission-relay.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/raw-get-stream.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/session-route.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/mcp/tool-schemas.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/attach-inline.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp → daemon}/src/stations/attach-interactive.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon/terminal-tickets.ts → daemon/src/terminal/tickets.ts} +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/api-error.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/cors.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/identity-key.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/identity-registry.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/mode-api.ts +0 -0
- /package/runtime/node_modules/@metro-labs/{mcp/src/daemon → http/src}/return-to.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { readJson, writeSecure } from '
|
|
3
|
-
import { agentsDir } from '../
|
|
4
|
-
import { isRecord } from '
|
|
2
|
+
import { readJson, writeSecure } from '@metro-labs/core/secure-fs';
|
|
3
|
+
import { agentsDir } from '../agents/files.js';
|
|
4
|
+
import { isRecord } from '@metro-labs/core/is-record';
|
|
5
5
|
import type { CodexTokens } from './codex-auth.js';
|
|
6
6
|
|
|
7
7
|
export const PROVIDERS = ['anthropic', 'bedrock', 'openrouter', 'codex'] as const;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { forwardTrainCall } from '../
|
|
1
|
+
import { forwardTrainCall } from '../stations/train-call.js';
|
|
2
2
|
import {
|
|
3
3
|
accountStationNames,
|
|
4
4
|
stationByName,
|
|
5
5
|
} from '../stations/registry.js';
|
|
6
|
-
import { listEndpoints } from '../
|
|
6
|
+
import { listEndpoints } from '../net/tunnel.js';
|
|
7
7
|
import { hookUrl } from '../stations/attach.js';
|
|
8
|
-
import { agentIdForAccount, knownAccounts, type KnownAccount } from '../
|
|
9
|
-
import { stationRunsHere } from '../db/materialize.js';
|
|
10
|
-
import { type StationName } from '../db/stations.js';
|
|
8
|
+
import { agentIdForAccount, knownAccounts, type KnownAccount } from '../agents/map.js';
|
|
11
9
|
|
|
12
10
|
const accountId = (acc: unknown): string | undefined => {
|
|
13
11
|
const id = (acc as { id?: unknown }).id;
|
|
@@ -81,8 +79,6 @@ async function liveAccounts(
|
|
|
81
79
|
): Promise<{ rows: unknown[]; reachable: boolean }> {
|
|
82
80
|
if (!hasTrain(station))
|
|
83
81
|
return { rows: inCoreAccounts(station), reachable: true };
|
|
84
|
-
if (!stationRunsHere(station as StationName))
|
|
85
|
-
return { rows: [], reachable: true };
|
|
86
82
|
try {
|
|
87
83
|
const resp = await forwardTrainCall(station, 'accounts', {});
|
|
88
84
|
const list = (resp.result as { accounts?: unknown[] } | undefined)?.accounts;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { stationForLine } from '../stations/registry.js';
|
|
2
|
-
import { kindOf, toCanonical } from '
|
|
2
|
+
import { kindOf, toCanonical } from '@metro-labs/core/stations/attachments';
|
|
3
3
|
import {
|
|
4
4
|
cleanupAttachments,
|
|
5
5
|
resolveAttachments,
|
|
6
6
|
type ResolvedAttachment,
|
|
7
7
|
} from '../stations/attach-resolve.js';
|
|
8
|
-
import type { CanonicalAttachment, ToolResult } from '
|
|
8
|
+
import type { CanonicalAttachment, ToolResult } from '@metro-labs/core/stations/types';
|
|
9
9
|
import { errResult, makeCtx, ok, okJson, toErr } from './ctx.js';
|
|
10
10
|
import { allowedAgents, currentIdentity } from './request-identity.js';
|
|
11
|
-
import { str } from '
|
|
11
|
+
import { str } from '@metro-labs/core/str';
|
|
12
12
|
|
|
13
13
|
type Station = NonNullable<ReturnType<typeof stationForLine>>;
|
|
14
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { forwardTrainCall } from '../
|
|
3
|
-
import { errMsg, log } from '
|
|
4
|
-
import { TrainError } from '
|
|
5
|
-
import { type ToolContext, type ToolResult } from '
|
|
2
|
+
import { forwardTrainCall } from '../stations/train-call.js';
|
|
3
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
4
|
+
import { TrainError } from '@metro-labs/core/train-error';
|
|
5
|
+
import { type ToolContext, type ToolResult } from '@metro-labs/core/stations/types';
|
|
6
6
|
|
|
7
7
|
export async function metroCall(
|
|
8
8
|
train: string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { eventInScope } from '../
|
|
3
|
-
import { str } from '
|
|
2
|
+
import { eventInScope } from '../agents/scope.js';
|
|
3
|
+
import { str } from '@metro-labs/core/str';
|
|
4
4
|
|
|
5
5
|
export interface FrameOrigin {
|
|
6
6
|
line: string | undefined;
|
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
MemberOutcome,
|
|
6
6
|
Station,
|
|
7
7
|
ToolResult,
|
|
8
|
-
} from '
|
|
8
|
+
} from '@metro-labs/core/stations/types';
|
|
9
9
|
import { makeCtx, okJson, toErr } from './ctx.js';
|
|
10
|
-
import { str } from '
|
|
10
|
+
import { str } from '@metro-labs/core/str';
|
|
11
11
|
|
|
12
12
|
export interface GroupOpResult {
|
|
13
13
|
op: GroupOp;
|
|
@@ -4,9 +4,9 @@ import type {
|
|
|
4
4
|
MemberList,
|
|
5
5
|
MetroMember,
|
|
6
6
|
ToolResult,
|
|
7
|
-
} from '
|
|
7
|
+
} from '@metro-labs/core/stations/types';
|
|
8
8
|
import { makeCtx, okJson, toErr } from './ctx.js';
|
|
9
|
-
import { str } from '
|
|
9
|
+
import { str } from '@metro-labs/core/str';
|
|
10
10
|
|
|
11
11
|
export interface MemberListResult {
|
|
12
12
|
line: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import type { IncomingMessage } from 'node:http';
|
|
3
|
-
import { agentIdForKey } from '../
|
|
3
|
+
import { agentIdForKey } from '../agents/keys.js';
|
|
4
4
|
|
|
5
5
|
export type RequestIdentity =
|
|
6
6
|
| { kind: 'agent'; agentId: string }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { currentBusSeq } from '
|
|
3
|
-
import { errMsg } from '
|
|
2
|
+
import { currentBusSeq } from '@metro-labs/core/events';
|
|
3
|
+
import { errMsg } from '@metro-labs/core/log';
|
|
4
4
|
import { newReplayLedger, type ReplayLedger } from '../channels/relay.js';
|
|
5
5
|
import { McpSession, channelLog } from './session.js';
|
|
6
6
|
import { agentsInScopeKey } from './session-route.js';
|
|
@@ -2,11 +2,11 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
2
2
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
3
3
|
import { InboundRelay } from '../channels/inbound.js';
|
|
4
4
|
import { ChannelRelay, type ReplayLedger } from '../channels/relay.js';
|
|
5
|
-
import { errMsg } from '
|
|
5
|
+
import { errMsg } from '@metro-labs/core/log';
|
|
6
6
|
import {
|
|
7
7
|
allowlistForLine,
|
|
8
8
|
senderMatchesAllowlist,
|
|
9
|
-
} from '../
|
|
9
|
+
} from '../agents/map.js';
|
|
10
10
|
import { accountStationNames } from '../stations/registry.js';
|
|
11
11
|
import { MCP_INSTRUCTIONS } from './tool-schemas.js';
|
|
12
12
|
import { ChannelOwner } from './channel-owner.js';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
STATIONS,
|
|
10
10
|
accountStationCapabilities,
|
|
11
11
|
} from '../stations/registry.js';
|
|
12
|
-
import type { Station, StationTool, ToolResult } from '
|
|
12
|
+
import type { Station, StationTool, ToolResult } from '@metro-labs/core/stations/types';
|
|
13
13
|
import { COMMON_TOOLS, LIST_ACCOUNTS_TOOL } from './tool-schemas.js';
|
|
14
14
|
import { errResult, makeCtx, okJson, toErr } from './ctx.js';
|
|
15
15
|
import { dispatchMessageTool, type ToolHooks } from './call-tools.js';
|
|
@@ -21,16 +21,16 @@ import {
|
|
|
21
21
|
dispatchRemoveMembers,
|
|
22
22
|
} from './group-tools.js';
|
|
23
23
|
import { dispatchCreateUpload } from './upload-tool.js';
|
|
24
|
-
import { callTargetDenied, lineTargetDenied } from '../
|
|
24
|
+
import { callTargetDenied, lineTargetDenied } from '../agents/scope.js';
|
|
25
25
|
import { SOURCE_KEYS } from '../stations/attach-resolve.js';
|
|
26
26
|
import { decodedLengthOf } from '../stations/attach-inline.js';
|
|
27
|
-
import { log } from '
|
|
27
|
+
import { log } from '@metro-labs/core/log';
|
|
28
28
|
import {
|
|
29
29
|
allowedAgents,
|
|
30
30
|
currentIdentity,
|
|
31
31
|
type RequestIdentity,
|
|
32
32
|
} from './request-identity.js';
|
|
33
|
-
import { str } from '
|
|
33
|
+
import { str } from '@metro-labs/core/str';
|
|
34
34
|
|
|
35
35
|
const STATION_TOOLS = new Map<
|
|
36
36
|
string,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { publicBaseOrDefault } from '../
|
|
1
|
+
import { publicBaseOrDefault } from '../files/attach-serve.js';
|
|
2
2
|
import { safeFileName } from '../stations/attach-inline.js';
|
|
3
|
-
import { guessMime } from '
|
|
3
|
+
import { guessMime } from '@metro-labs/core/stations/attachments';
|
|
4
4
|
import {
|
|
5
5
|
createUploadSlot,
|
|
6
6
|
issueUploadTicket,
|
|
7
7
|
MAX_UPLOAD_BYTES,
|
|
8
8
|
removeUpload,
|
|
9
9
|
UPLOAD_TTL_MS,
|
|
10
|
-
} from '../
|
|
11
|
-
import type { ToolResult } from '
|
|
10
|
+
} from '../files/upload-store.js';
|
|
11
|
+
import type { ToolResult } from '@metro-labs/core/stations/types';
|
|
12
12
|
import { errResult, okJson } from './ctx.js';
|
|
13
13
|
import { allowedAgents, currentIdentity } from './request-identity.js';
|
|
14
|
-
import { str } from '
|
|
14
|
+
import { str } from '@metro-labs/core/str';
|
|
15
15
|
|
|
16
16
|
const ttlMinutes = (): number => Math.round(UPLOAD_TTL_MS / 60_000);
|
|
17
17
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { stationByName } from '../stations/registry.js';
|
|
3
|
-
import { errMsg, log } from '
|
|
4
|
-
import { subscribeEvents, type MetroEvent } from '
|
|
5
|
-
import { callTargetDenied, eventInScope } from '../
|
|
6
|
-
import { hasAnyKey } from '../
|
|
3
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
4
|
+
import { subscribeEvents, type MetroEvent } from '@metro-labs/core/events';
|
|
5
|
+
import { callTargetDenied, eventInScope } from '../agents/scope.js';
|
|
6
|
+
import { hasAnyKey } from '../agents/keys.js';
|
|
7
7
|
import {
|
|
8
8
|
allowedAgents,
|
|
9
9
|
authenticate,
|
|
10
10
|
} from '../mcp/request-identity.js';
|
|
11
|
-
import { METRO_VERSION } from '
|
|
11
|
+
import { METRO_VERSION } from '@metro-labs/core/version';
|
|
12
12
|
|
|
13
13
|
export type MonitorCall = (
|
|
14
14
|
train: string,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import type { Endpoint } from '@metro-labs/core/endpoints';
|
|
1
2
|
import { execFile, spawn, type ChildProcess } from 'node:child_process';
|
|
2
3
|
import { timingSafeEqual } from 'node:crypto';
|
|
3
4
|
import { Resolver } from 'node:dns/promises';
|
|
4
5
|
import { request as httpsRequest } from 'node:https';
|
|
5
6
|
import { homedir } from 'node:os';
|
|
6
7
|
import { join } from 'node:path';
|
|
7
|
-
import { errMsg, log } from '
|
|
8
|
-
import { readJson } from '
|
|
9
|
-
import { localOwner } from '../
|
|
8
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
9
|
+
import { readJson } from '@metro-labs/core/secure-fs';
|
|
10
|
+
import { localOwner } from '../agents/file-admin.js';
|
|
10
11
|
|
|
11
12
|
const RESTART_DELAY_MS = 2_000;
|
|
12
13
|
const RESTART_DELAY_MAX_MS = 30_000;
|
|
@@ -183,13 +184,6 @@ async function untilResolvable(host: string, resolves: Resolves): Promise<boolea
|
|
|
183
184
|
return false;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
export interface Endpoint {
|
|
187
|
-
id: string;
|
|
188
|
-
webhookId?: string;
|
|
189
|
-
label: string;
|
|
190
|
-
secret?: string;
|
|
191
|
-
createdAt: string;
|
|
192
|
-
}
|
|
193
187
|
interface AccountRecord {
|
|
194
188
|
id?: unknown;
|
|
195
189
|
webhookId?: unknown;
|
|
@@ -201,6 +195,8 @@ interface AccountRecord {
|
|
|
201
195
|
export const webhookPort = (): number =>
|
|
202
196
|
Number(process.env.METRO_WEBHOOK_PORT) || 8420;
|
|
203
197
|
|
|
198
|
+
export type { Endpoint };
|
|
199
|
+
|
|
204
200
|
const accountsFile = (): string =>
|
|
205
201
|
process.env.WEBHOOK_ACCOUNTS_FILE ??
|
|
206
202
|
join(homedir(), '.metro', 'webhook-accounts.json');
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { handleSessionApis, type SessionApis } from './session-apis.js';
|
|
2
2
|
import { handleGatewayRequest } from '../gateway/gateway.js';
|
|
3
|
-
import { handleRelayRequest } from '
|
|
3
|
+
import { handleRelayRequest } from '../connectors/relay.js';
|
|
4
4
|
import {
|
|
5
5
|
createServer,
|
|
6
6
|
type IncomingMessage,
|
|
7
7
|
type Server,
|
|
8
8
|
type ServerResponse,
|
|
9
9
|
} from 'node:http';
|
|
10
|
-
import { Line } from '
|
|
11
|
-
import { errMsg, log } from '
|
|
10
|
+
import { Line } from '@metro-labs/core/lines';
|
|
11
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
12
12
|
import {
|
|
13
13
|
classifyEvent,
|
|
14
14
|
formatDisplay,
|
|
@@ -16,29 +16,29 @@ import {
|
|
|
16
16
|
publishEvent,
|
|
17
17
|
userSelf,
|
|
18
18
|
type MetroEvent,
|
|
19
|
-
} from '
|
|
20
|
-
import type { TrainEvent } from '
|
|
21
|
-
import { agentForLine, agentIdForLine } from '../
|
|
19
|
+
} from '@metro-labs/core/events';
|
|
20
|
+
import type { TrainEvent } from '@metro-labs/core/trains/protocol';
|
|
21
|
+
import { agentForLine, agentIdForLine } from '../agents/map.js';
|
|
22
22
|
import {
|
|
23
23
|
findEndpointByWebhookId,
|
|
24
24
|
listEndpoints,
|
|
25
25
|
tokenMatches,
|
|
26
26
|
webhookPort,
|
|
27
27
|
type Endpoint,
|
|
28
|
-
} from '
|
|
29
|
-
import { attachmentEventUrl, handleAttachRequest } from '
|
|
28
|
+
} from '../net/tunnel.js';
|
|
29
|
+
import { attachmentEventUrl, handleAttachRequest } from '../files/attach-serve.js';
|
|
30
30
|
import { webhookEntry } from '@metro-labs/webhook';
|
|
31
|
-
import { handleIdentityRequest } from './identity
|
|
32
|
-
import { attachTerminalSockets } from '
|
|
33
|
-
import { tmuxCommand } from '
|
|
34
|
-
import { handleModeRequest } from '
|
|
35
|
-
import { handleUploadRequest } from '
|
|
31
|
+
import { handleIdentityRequest } from './identity.js';
|
|
32
|
+
import { attachTerminalSockets } from '../terminal/socket.js';
|
|
33
|
+
import { tmuxCommand } from '../terminal/api.js';
|
|
34
|
+
import { handleModeRequest } from '@metro-labs/http/mode-api';
|
|
35
|
+
import { handleUploadRequest } from '../files/upload-api.js';
|
|
36
36
|
import {
|
|
37
37
|
handleMonitorRequest,
|
|
38
38
|
type MonitorCall,
|
|
39
39
|
} from '../monitor/api.js';
|
|
40
|
-
import { applyMcpCors, handleMcpPreflight } from '
|
|
41
|
-
import { METRO_VERSION } from '
|
|
40
|
+
import { applyMcpCors, handleMcpPreflight } from '@metro-labs/http/cors';
|
|
41
|
+
import { METRO_VERSION } from '@metro-labs/core/version';
|
|
42
42
|
|
|
43
43
|
const LRU_CAP = 2_000;
|
|
44
44
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { verifyTypedData } from 'viem';
|
|
3
|
-
import { log } from '
|
|
4
|
-
import { ApiError } from '
|
|
5
|
-
import { apiFailure, bodyField, cors, readJsonBody, sendJson } from '
|
|
6
|
-
import { ENCRYPTION_KEY_TYPED_DATA, deriveIdentityAddress } from '
|
|
7
|
-
import { authorizeIdentity } from '
|
|
3
|
+
import { log } from '@metro-labs/core/log';
|
|
4
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
5
|
+
import { apiFailure, bodyField, cors, readJsonBody, sendJson } from '@metro-labs/http/api-http';
|
|
6
|
+
import { ENCRYPTION_KEY_TYPED_DATA, deriveIdentityAddress } from '@metro-labs/http/identity-key';
|
|
7
|
+
import { authorizeIdentity } from '@metro-labs/http/identity-registry';
|
|
8
8
|
|
|
9
9
|
const PATH = '/auth/identity';
|
|
10
10
|
const SIGNATURE_RE = /^0x[0-9a-fA-F]{130}$/;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ApiError } from '
|
|
2
|
-
import { errMsg, log } from '
|
|
3
|
-
import { AttachSessions } from '
|
|
4
|
-
import type { AgentApiDeps } from '
|
|
5
|
-
import { ATTACHABLE, type AccountApiDeps } from '
|
|
1
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
2
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
3
|
+
import { AttachSessions } from '../stations/attach-session.js';
|
|
4
|
+
import type { AgentApiDeps } from '../agents/api.js';
|
|
5
|
+
import { ATTACHABLE, type AccountApiDeps } from '../agents/accounts-api.js';
|
|
6
6
|
import type { SessionApis } from './session-apis.js';
|
|
7
|
-
import type { ModeInfo } from '
|
|
8
|
-
import { loadedAgentOf, type AgentBundle, type BundleApiDeps } from '
|
|
9
|
-
import { METRO_VERSION } from '
|
|
10
|
-
import type { ConnectorApiDeps } from '
|
|
11
|
-
import { allowLocalConnectors } from '
|
|
12
|
-
import { keyIdentity, type LocalCliDeps } from '
|
|
13
|
-
import type { RelayApiDeps } from '
|
|
7
|
+
import type { ModeInfo } from '@metro-labs/http/mode-api';
|
|
8
|
+
import { loadedAgentOf, type AgentBundle, type BundleApiDeps } from '../agents/bundle.js';
|
|
9
|
+
import { METRO_VERSION } from '@metro-labs/core/version';
|
|
10
|
+
import type { ConnectorApiDeps } from '../connectors/api.js';
|
|
11
|
+
import { allowLocalConnectors } from '../connectors/url.js';
|
|
12
|
+
import { keyIdentity, type LocalCliDeps } from '../connectors/cli-api.js';
|
|
13
|
+
import type { RelayApiDeps } from '../connectors/relay.js';
|
|
14
14
|
import {
|
|
15
15
|
readLocalConnectors,
|
|
16
16
|
localImportConnectors,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
localRelayTarget,
|
|
26
26
|
localRenameConnector,
|
|
27
27
|
localVerifyConnector,
|
|
28
|
-
} from '../
|
|
28
|
+
} from '../connectors/store.js';
|
|
29
29
|
import {
|
|
30
30
|
assertLocalOwner,
|
|
31
31
|
LOCAL_PROJECT_ID,
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
localOwner,
|
|
40
40
|
localResetAgentKey,
|
|
41
41
|
readLocalAgentFile,
|
|
42
|
-
} from '../
|
|
43
|
-
import { listAgentFiles, readAgentFile } from '../
|
|
42
|
+
} from '../agents/file-admin.js';
|
|
43
|
+
import { listAgentFiles, readAgentFile } from '../agents/files.js';
|
|
44
44
|
import { readModelConfig } from '../gateway/model-config.js';
|
|
45
|
-
import type { StationName } from '
|
|
45
|
+
import type { StationName } from '@metro-labs/core/station-names';
|
|
46
46
|
|
|
47
47
|
export interface LocalModeDeps {
|
|
48
48
|
syncStations: (station: StationName) => Promise<void>;
|
package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/routes}/session-apis.ts
RENAMED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { handleSessionApiRequest } from './session
|
|
3
|
-
import { handleAgentApiRequest, type AgentApiDeps } from '
|
|
2
|
+
import { handleSessionApiRequest } from './session.js';
|
|
3
|
+
import { handleAgentApiRequest, type AgentApiDeps } from '../agents/api.js';
|
|
4
4
|
import {
|
|
5
5
|
handleConnectorApiRequest,
|
|
6
6
|
type ConnectorApiDeps,
|
|
7
|
-
} from '
|
|
8
|
-
import type { RelayApiDeps } from '
|
|
9
|
-
import type { IdentityRouteDeps } from './identity
|
|
10
|
-
import { handleLocalCliRequest, type LocalCliDeps } from '
|
|
11
|
-
import { handleClaudeRequest, type ClaudeApiDeps } from '
|
|
12
|
-
import type { ModeInfo } from '
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { handleMachineRequest, type MachineApiDeps } from './machine-api.js';
|
|
19
|
-
import { handleModelRequest, type ModelApiDeps } from './model-api.js';
|
|
7
|
+
} from '../connectors/api.js';
|
|
8
|
+
import type { RelayApiDeps } from '../connectors/relay.js';
|
|
9
|
+
import type { IdentityRouteDeps } from './identity.js';
|
|
10
|
+
import { handleLocalCliRequest, type LocalCliDeps } from '../connectors/cli-api.js';
|
|
11
|
+
import { handleClaudeRequest, type ClaudeApiDeps } from '../claude/api.js';
|
|
12
|
+
import type { ModeInfo } from '@metro-labs/http/mode-api';
|
|
13
|
+
import { handleBundleRequest, type BundleApiDeps } from '../agents/bundle.js';
|
|
14
|
+
import { handleUpdateRequest, type UpdateApiDeps } from '../server/update.js';
|
|
15
|
+
import { handleControlRequest, type ControlApiDeps } from '../server/control.js';
|
|
16
|
+
import { handleMachineRequest, type MachineApiDeps } from '../server/machine.js';
|
|
17
|
+
import { handleModelRequest, type ModelApiDeps } from '../gateway/model-api.js';
|
|
20
18
|
import type { GatewayDeps } from '../gateway/gateway.js';
|
|
21
|
-
import { handleTerminalRequest, type TerminalApiDeps } from '
|
|
19
|
+
import { handleTerminalRequest, type TerminalApiDeps } from '../terminal/api.js';
|
|
22
20
|
|
|
23
21
|
export interface SessionApis {
|
|
24
22
|
agentApi?: AgentApiDeps;
|
|
25
23
|
bundleApi?: BundleApiDeps;
|
|
26
|
-
vaultApi?: VaultApiDeps;
|
|
27
|
-
serversApi?: ServersApiDeps;
|
|
28
24
|
updateApi?: UpdateApiDeps;
|
|
29
25
|
controlApi?: ControlApiDeps;
|
|
30
26
|
machineApi?: MachineApiDeps;
|
|
@@ -52,8 +48,6 @@ export function handleSessionApis(
|
|
|
52
48
|
...when(apis.localCli, (d) => handleLocalCliRequest(req, res, d)),
|
|
53
49
|
...when(apis.connectorApi, (d) => handleConnectorApiRequest(req, res, d)),
|
|
54
50
|
...when(apis.bundleApi, (d) => handleBundleRequest(req, res, d)),
|
|
55
|
-
...when(apis.vaultApi, (d) => handleVaultApiRequest(req, res, d)),
|
|
56
|
-
...when(apis.serversApi, (d) => handleServersApiRequest(req, res, d)),
|
|
57
51
|
...when(apis.updateApi, (d) => handleUpdateRequest(req, res, d)),
|
|
58
52
|
...when(apis.controlApi, (d) => handleControlRequest(req, res, d)),
|
|
59
53
|
...when(apis.machineApi, (d) => handleMachineRequest(req, res, d)),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { ApiError } from '
|
|
3
|
-
import { apiFailure, apiSession, cors, sendJson } from '
|
|
4
|
-
import { errMsg, log } from '
|
|
2
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
3
|
+
import { apiFailure, apiSession, cors, sendJson } from '@metro-labs/http/api-http';
|
|
4
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
5
5
|
|
|
6
6
|
const STOP = '/api/stop';
|
|
7
7
|
const RESTART = '/api/restart';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { hostname } from 'node:os';
|
|
3
|
-
import { ApiError } from '
|
|
4
|
-
import { apiFailure, apiSession, cors, sendJson } from '
|
|
5
|
-
import { publicBaseUrl } from '
|
|
6
|
-
import { claudeDir } from '
|
|
7
|
-
import { webhookPort } from '
|
|
8
|
-
import { METRO_VERSION } from '
|
|
9
|
-
import { agentsDir } from '../
|
|
10
|
-
import { localOwner } from '../
|
|
3
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
4
|
+
import { apiFailure, apiSession, cors, sendJson } from '@metro-labs/http/api-http';
|
|
5
|
+
import { publicBaseUrl } from '../files/attach-serve.js';
|
|
6
|
+
import { claudeDir } from '../claude/files.js';
|
|
7
|
+
import { webhookPort } from '../net/tunnel.js';
|
|
8
|
+
import { METRO_VERSION } from '@metro-labs/core/version';
|
|
9
|
+
import { agentsDir } from '../agents/files.js';
|
|
10
|
+
import { localOwner } from '../agents/file-admin.js';
|
|
11
11
|
|
|
12
12
|
const PATH = '/api/server';
|
|
13
13
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
import { errMsg, log } from '
|
|
4
|
-
import { ApiError } from '
|
|
5
|
-
import { apiFailure, apiSession, cors, sendJson } from '
|
|
6
|
-
import { isRecord } from '
|
|
7
|
-
import { METRO_VERSION } from '
|
|
3
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
4
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
5
|
+
import { apiFailure, apiSession, cors, sendJson } from '@metro-labs/http/api-http';
|
|
6
|
+
import { isRecord } from '@metro-labs/core/is-record';
|
|
7
|
+
import { METRO_VERSION } from '@metro-labs/core/version';
|
|
8
8
|
|
|
9
9
|
const PATH = '/api/update';
|
|
10
10
|
const CHECK_TTL_MS = 10 * 60_000;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
assertContentLength,
|
|
4
4
|
guessMime,
|
|
5
5
|
saveBufferToCache,
|
|
6
|
-
} from '
|
|
6
|
+
} from '@metro-labs/core/stations/attachments';
|
|
7
7
|
import {
|
|
8
8
|
assertInlineTotal,
|
|
9
9
|
decodeInline,
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
writeInlineTemp,
|
|
13
13
|
} from './attach-inline.js';
|
|
14
14
|
import { realpathSync } from 'node:fs';
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
15
|
+
import { log } from '@metro-labs/core/log';
|
|
16
|
+
import { readUpload, UPLOAD_TTL_MS } from '../files/upload-store.js';
|
|
17
|
+
import type { CanonicalAttachment } from '@metro-labs/core/stations/types';
|
|
17
18
|
|
|
18
19
|
export interface ResolvedAttachment {
|
|
19
20
|
path: string;
|
|
@@ -167,6 +168,7 @@ async function resolveAttachment(
|
|
|
167
168
|
.map((s) => `\`${s}\``)
|
|
168
169
|
.join(', ')}); pass exactly one of \`upload\`, \`data\`, \`url\` or \`path\``,
|
|
169
170
|
);
|
|
171
|
+
log.info({ source: sources[0] }, 'send: attachment source');
|
|
170
172
|
if (a.upload) return fromUpload(a, a.upload, opts.allowed);
|
|
171
173
|
if (a.data) return fromData(a, a.data, budget);
|
|
172
174
|
if (a.path) return fromPath(a, a.path);
|
package/runtime/node_modules/@metro-labs/{mcp/src/daemon → daemon/src/stations}/attach-session.ts
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
|
-
import { ApiError } from '
|
|
3
|
-
import { errMsg, log } from '
|
|
4
|
-
import type { StationName } from '
|
|
2
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
3
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
4
|
+
import type { StationName } from '@metro-labs/core/station-names';
|
|
5
5
|
import { ensureStationDeps } from './runtime-deps.js';
|
|
6
6
|
import {
|
|
7
7
|
startInteractiveAttach,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type DriverHooks,
|
|
13
13
|
type InteractiveStation,
|
|
14
14
|
type StartedAttach,
|
|
15
|
-
} from '
|
|
15
|
+
} from './attach-interactive.js';
|
|
16
16
|
|
|
17
17
|
export type StartAttach = (
|
|
18
18
|
station: InteractiveStation,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
2
|
import { rmSync } from 'node:fs';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { errMsg, log } from '
|
|
4
|
+
import { errMsg, log } from '@metro-labs/core/log';
|
|
5
5
|
|
|
6
6
|
export class XmtpAttachError extends Error {}
|
|
7
7
|
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
TelegramTokenError,
|
|
8
8
|
verifyTelegramBotToken,
|
|
9
9
|
} from '@metro-labs/telegram-bot/verify';
|
|
10
|
-
import { ApiError } from '
|
|
11
|
-
import { ensureStationDeps } from '
|
|
12
|
-
import { publicBaseOrDefault } from '../
|
|
10
|
+
import { ApiError } from '@metro-labs/http/api-error';
|
|
11
|
+
import { ensureStationDeps } from './runtime-deps.js';
|
|
12
|
+
import { publicBaseOrDefault } from '../files/attach-serve.js';
|
|
13
13
|
import {
|
|
14
14
|
discardXmtpDb,
|
|
15
15
|
newXmtpDbPath,
|