@agent-native/core 0.98.5 → 0.98.6
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +12 -0
- package/corpus/core/docs/content/external-agents.mdx +62 -7
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +37 -7
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +37 -7
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/handlers.ts +95 -21
- package/corpus/core/src/a2a/task-store.ts +65 -3
- package/corpus/core/src/integrations/adapters/slack.ts +123 -13
- package/corpus/core/src/integrations/identity-links-store.ts +210 -0
- package/corpus/core/src/integrations/identity.ts +132 -0
- package/corpus/core/src/integrations/index.ts +6 -0
- package/corpus/core/src/integrations/plugin.ts +58 -1
- package/corpus/core/src/integrations/types.ts +7 -0
- package/corpus/core/src/mcp/build-server.ts +127 -22
- package/corpus/core/src/mcp/external-agent-policy.ts +18 -0
- package/corpus/core/src/mcp/index.ts +1 -0
- package/corpus/core/src/server/agent-chat/plugin-options.ts +12 -1
- package/corpus/core/src/server/agent-chat/script-entries.ts +20 -3
- package/corpus/core/src/server/agent-chat-plugin.ts +3 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
- package/corpus/templates/analytics/AGENTS.md +20 -5
- package/corpus/templates/analytics/actions/create-session-replay-agent-link.ts +0 -1
- package/corpus/templates/analytics/actions/get-session-replay-events.ts +0 -1
- package/corpus/templates/analytics/actions/get-session-replay-timeline.ts +40 -0
- package/corpus/templates/analytics/actions/list-error-issues.ts +12 -0
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +4 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +48 -17
- package/corpus/templates/analytics/changelog/2026-07-12-connected-external-agents-can-now-look-up-sessions-error-iss.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-session-identities-stay-visible-when-demo-mode-is-off.md +6 -0
- package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +2 -2
- package/corpus/templates/analytics/server/lib/error-capture.ts +47 -5
- package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +49 -17
- package/corpus/templates/analytics/server/lib/session-replay.ts +16 -7
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +4 -0
- package/corpus/templates/analytics/server/plugins/db.ts +15 -0
- package/corpus/templates/forms/app/global.css +54 -8
- package/corpus/templates/forms/app/pages/AskPage.tsx +35 -13
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +11 -17
- package/corpus/templates/forms/app/pages/ResponsesPage.tsx +8 -5
- package/corpus/templates/forms/changelog/2026-07-12-ask-forms-suggestions-now-sit-beneath-the-composer-for-a-tig.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-builder-response-tables-now-fill-the-view-without-a-redundan.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-response-tables-now-fill-the-available-pane-with-a-flexible-.md +6 -0
- package/corpus/templates/mail/AGENTS.md +3 -1
- package/corpus/templates/mail/server/lib/mail-integrations.ts +3 -0
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +84 -15
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/task-store.d.ts +20 -1
- package/dist/a2a/task-store.d.ts.map +1 -1
- package/dist/a2a/task-store.js +57 -4
- package/dist/a2a/task-store.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +98 -13
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/identity-links-store.d.ts +23 -0
- package/dist/integrations/identity-links-store.d.ts.map +1 -0
- package/dist/integrations/identity-links-store.js +158 -0
- package/dist/integrations/identity-links-store.js.map +1 -0
- package/dist/integrations/identity.d.ts +11 -0
- package/dist/integrations/identity.d.ts.map +1 -0
- package/dist/integrations/identity.js +100 -0
- package/dist/integrations/identity.js.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +43 -1
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +6 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/mcp/build-server.d.ts +9 -2
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +97 -20
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/external-agent-policy.d.ts +19 -0
- package/dist/mcp/external-agent-policy.d.ts.map +1 -0
- package/dist/mcp/external-agent-policy.js +2 -0
- package/dist/mcp/external-agent-policy.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat/plugin-options.d.ts +11 -1
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
- package/dist/server/agent-chat/script-entries.js +16 -2
- package/dist/server/agent-chat/script-entries.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +3 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
- package/docs/content/external-agents.mdx +62 -7
- package/docs/content/locales/ar-SA/external-agents.mdx +38 -7
- package/docs/content/locales/de-DE/external-agents.mdx +39 -7
- package/docs/content/locales/es-ES/external-agents.mdx +39 -7
- package/docs/content/locales/fr-FR/external-agents.mdx +39 -7
- package/docs/content/locales/hi-IN/external-agents.mdx +38 -7
- package/docs/content/locales/ja-JP/external-agents.mdx +38 -7
- package/docs/content/locales/ko-KR/external-agents.mdx +38 -7
- package/docs/content/locales/pt-BR/external-agents.mdx +39 -7
- package/docs/content/locales/zh-CN/external-agents.mdx +37 -7
- package/docs/content/locales/zh-TW/external-agents.mdx +37 -7
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
|
@@ -245,6 +245,12 @@ export interface PlatformAdapter {
|
|
|
245
245
|
* metadata, and text only — never persist file bodies or credentials.
|
|
246
246
|
*/
|
|
247
247
|
hydrateIncomingMessage?(incoming: IncomingMessage): Promise<IncomingMessage>;
|
|
248
|
+
/**
|
|
249
|
+
* Hydrate only verified sender identity before execution-context selection.
|
|
250
|
+
* This runs on the provider acknowledgement path and must avoid fetching
|
|
251
|
+
* conversation history or file bodies.
|
|
252
|
+
*/
|
|
253
|
+
hydrateIncomingIdentity?(incoming: IncomingMessage): Promise<IncomingMessage>;
|
|
248
254
|
/**
|
|
249
255
|
* Provider-specific response returned only after a message is verified and
|
|
250
256
|
* durably enqueued. Discord uses this to return a type-5 deferred response
|
|
@@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AiC,CAAC;IAElD,YACW,QAAgB,EAChB,UAA6C;QAEtD,KAAK,CAAC,YAAY,QAAQ,qBAAqB,UAAU,EAAE,CAAC,CAAC;wBAHpD,QAAQ;0BACR,UAAU;QAGnB,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACnD,CAAC;CACF;AA0ID,MAAM,UAAU,wBAAwB,CACtC,OAAwB,EACxB,UAA6C;IAE7C,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,kCAAkC,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC","sourcesContent":["import type { H3Event } from \"h3\";\n\nimport type { AgentChatEvent } from \"../agent/types.js\";\nimport type { EnvKeyConfig } from \"../server/create-server.js\";\n\nexport type IntegrationConversationType =\n | \"channel\"\n | \"private_channel\"\n | \"dm\"\n | \"group_dm\"\n | \"unknown\";\n\nexport type IntegrationTriggerKind = \"mention\" | \"dm\" | \"thread_reply\";\n\nexport interface IntegrationActorTrust {\n memberType: \"owner\" | \"admin\" | \"member\" | \"guest\" | \"external\" | \"unknown\";\n verified: boolean;\n}\n\nexport interface IntegrationContextMessage {\n senderId?: string;\n senderName?: string;\n text: string;\n timestamp: number;\n sourceUrl?: string;\n reactions?: Array<{ name: string; count: number }>;\n files?: IntegrationFileReference[];\n}\n\nexport interface IntegrationFileReference {\n id: string;\n name?: string;\n mimetype?: string;\n size?: number;\n permalink?: string;\n downloadUrl?: string;\n}\n\n/**\n * Normalized incoming message from any messaging platform.\n */\nexport interface IncomingMessage {\n /** Platform identifier (e.g., \"slack\", \"telegram\", \"whatsapp\") */\n platform: string;\n /** Platform-specific thread/conversation identifier */\n externalThreadId: string;\n /** Message text content */\n text: string;\n /** Display name of the sender */\n senderName?: string;\n /** Verified sender email, when the platform can provide one */\n senderEmail?: string;\n /** Platform-specific sender ID */\n senderId?: string;\n /** How this message intentionally invoked an agent. */\n triggerKind?: IntegrationTriggerKind;\n /** Normalized provider conversation type for policy evaluation. */\n conversationType?: IntegrationConversationType;\n /** Provider tenant/workspace identifier. */\n tenantId?: string;\n /** Authorized integration scope resolved before execution. */\n integrationScopeId?: string;\n /** Normalized actor trust; unknown/unverified callers fail closed. */\n actorTrust?: IntegrationActorTrust;\n /** Bounded provider-native conversation context hydrated at run time. */\n contextMessages?: IntegrationContextMessage[];\n /** Provider file references only. Raw file bodies never belong here. */\n files?: IntegrationFileReference[];\n /** Server-verified approval grants carried by an interaction continuation. */\n approvedToolCalls?: string[];\n /**\n * Whether the platform cryptographically authenticated that the message\n * genuinely came from the claimed sender (e.g. inbound email that passed\n * DKIM, or an aligned SPF pass, for the From domain). Defaults to\n * undefined/false for platforms that don't provide sender authentication.\n *\n * Owner-resolution paths that grant a real user's identity/credentials\n * MUST treat a missing/false value as \"unverified\" and fail closed —\n * never derive a privileged acting identity from an unverified sender.\n */\n senderVerified?: boolean;\n /** Raw platform-specific context needed for routing responses */\n platformContext: Record<string, unknown>;\n /**\n * Short-lived delivery context needed only while the queued task is active.\n * Secrets such as Discord interaction tokens belong here, never in\n * `platformContext`, thread mappings, logs, or agent-visible context.\n */\n responseContext?: Record<string, unknown>;\n /** Provider-native thread/topic reference, when one exists. */\n threadRef?: string;\n /**\n * Canonical provider URL for the originating message thread, when the\n * provider can resolve one. This is safe agent-visible provenance (not a\n * credential) and should be preserved across A2A delegation so created\n * artifacts can link back to their request source.\n */\n sourceUrl?: string;\n /**\n * Trusted app-side routing guidance added after provider parsing. Adapters\n * should not copy this from user-controlled webhook payload fields.\n */\n routingHint?: {\n targetAgent?: string;\n instruction: string;\n };\n /** Provider-native message/activity reference for contextual replies. */\n replyRef?: string;\n /** Message timestamp (epoch ms) */\n timestamp: number;\n}\n\n/**\n * Outgoing message to send back to a messaging platform.\n */\nexport interface OutgoingMessage {\n /** Text content of the response */\n text: string;\n /** Platform-specific payload (e.g., Slack blocks, Telegram parse_mode) */\n platformContext: Record<string, unknown>;\n}\n\n/**\n * Proactive outbound message target for a platform.\n * Used when the agent needs to send to a saved destination instead of replying\n * to the current inbound thread.\n */\nexport interface OutboundTarget {\n /** Canonical platform-specific destination id (channel, chat, thread, etc.) */\n destination: string;\n /** Optional thread reference when the destination supports threading */\n threadRef?: string | null;\n /** Optional fallback display label */\n label?: string;\n /** Provider tenant/workspace used to select an installation credential. */\n tenantId?: string;\n /** Managed installation id when the caller already resolved it. */\n installationId?: string;\n}\n\n/**\n * Connection status for a platform integration.\n */\nexport interface IntegrationStatus {\n platform: string;\n /** Human-readable label (e.g., \"Slack\", \"Telegram\") */\n label: string;\n /** Whether the integration is explicitly enabled */\n enabled: boolean;\n /** Whether all required credentials are configured */\n configured: boolean;\n /** Platform-specific details (workspace name, bot username, etc.) */\n details?: Record<string, unknown>;\n /** Error message if something is wrong */\n error?: string;\n /** The webhook URL that should be configured in the platform */\n webhookUrl?: string;\n /** The full list of env keys (required + optional) the adapter recognizes,\n * including UI hints. Surfaced on the integrations status endpoint so the\n * frontend can render fields without hard-coding them per platform. */\n requiredEnvKeys?: import(\"../server/create-server.js\").EnvKeyConfig[];\n}\n\nexport interface PlatformAdapterCapabilities {\n /** The adapter can deliver a response to the current inbound event. */\n replyText: boolean;\n /** The adapter can send without an active inbound event. */\n proactiveMessages: boolean;\n /** The adapter preserves a provider-native thread or topic reference. */\n nativeThreads: boolean;\n /** The adapter can quote/reply to a specific inbound message. */\n contextualReplies: boolean;\n /** The provider requires an immediate deferred webhook acknowledgement. */\n deferredWebhookResponse: boolean;\n /** The adapter only receives explicit interactions, not ordinary messages. */\n interactionOnly?: boolean;\n /** The adapter can hydrate bounded native thread/file/reaction context. */\n nativeContextHydration?: boolean;\n /** The adapter can surface live agent progress in the provider UI. */\n liveRunProgress?: boolean;\n}\n\nexport interface PlatformRunProgress {\n /**\n * Opaque, provider-owned reference for resuming this progress surface from a\n * durable continuation. It deliberately contains no user content,\n * credentials, or provider payload.\n */\n ref?: PlatformRunProgressRef;\n /** Receive normalized agent events. Implementations should throttle writes. */\n onEvent(event: AgentChatEvent): Promise<void> | void;\n /** Finalize the provider-native progress surface with the answer. */\n complete(message: OutgoingMessage): Promise<void>;\n /** Mark the provider-native surface failed and leave a retryable explanation. */\n fail?(message: string): Promise<void>;\n}\n\n/**\n * Safe, minimal reference to a provider-native run-progress surface.\n *\n * The field values are opaque to the framework. Adapters may use `kind` to\n * distinguish their own resume strategy and `streamTs` to identify the\n * provider-side stream. No incoming message text, platform payload, or\n * credential belongs here.\n */\nexport interface PlatformRunProgressRef {\n kind: string;\n streamTs: string;\n}\n\nexport interface ImmediateWebhookResponse {\n status: number;\n body: unknown;\n}\n\nexport class UnsupportedPlatformCapabilityError extends Error {\n readonly code = \"UNSUPPORTED_PLATFORM_CAPABILITY\";\n\n constructor(\n readonly platform: string,\n readonly capability: keyof PlatformAdapterCapabilities,\n ) {\n super(`Platform ${platform} does not support ${capability}`);\n this.name = \"UnsupportedPlatformCapabilityError\";\n }\n}\n\n/**\n * Platform adapter interface — implement this for each messaging platform.\n *\n * Each adapter handles the platform-specific concerns:\n * - Webhook verification (HMAC signatures, challenge responses)\n * - Message parsing (platform events → normalized IncomingMessage)\n * - Response formatting (agent text → platform-specific format)\n * - Response delivery (POST back to platform API)\n */\nexport interface PlatformAdapter {\n /** Unique platform identifier */\n readonly platform: string;\n /** Human-readable label */\n readonly label: string;\n /** Explicit runtime behavior. Missing fields are treated as unsupported. */\n readonly capabilities?: Partial<PlatformAdapterCapabilities>;\n\n /** Env keys this adapter needs (tokens, secrets, etc.) */\n getRequiredEnvKeys(): EnvKeyConfig[];\n\n /**\n * Handle platform-specific verification challenges.\n * For example, Slack sends a `url_verification` event when setting up.\n * Return `{ handled: true, response }` to short-circuit the webhook handler.\n */\n handleVerification(event: H3Event): Promise<{\n handled: boolean;\n response?: unknown;\n }>;\n\n /**\n * Validate the webhook request signature.\n * Returns true if the request is authentic.\n */\n verifyWebhook(event: H3Event): Promise<boolean>;\n\n /**\n * Parse the webhook payload into a normalized IncomingMessage.\n * Return null to silently ignore the event (bot messages, edits, etc.).\n */\n parseIncomingMessage(event: H3Event): Promise<IncomingMessage | null>;\n\n /**\n * Hydrate bounded provider-native context after durable enqueue, outside the\n * provider acknowledgement budget. Implementations must return references,\n * metadata, and text only — never persist file bodies or credentials.\n */\n hydrateIncomingMessage?(incoming: IncomingMessage): Promise<IncomingMessage>;\n\n /**\n * Provider-specific response returned only after a message is verified and\n * durably enqueued. Discord uses this to return a type-5 deferred response\n * within its three-second interaction deadline.\n */\n getImmediateWebhookResponse?(\n incoming: IncomingMessage,\n ): ImmediateWebhookResponse | null;\n\n /**\n * Return pre-canonical thread ids used by older adapter versions. The\n * integration handler checks these only when the canonical mapping is\n * missing, then aliases a match to the canonical id without forking history.\n */\n getLegacyExternalThreadIds?(incoming: IncomingMessage): string[];\n\n /**\n * Send the agent's response back to the messaging platform.\n *\n * If `opts.placeholderRef` is provided (returned earlier by\n * `postProcessingPlaceholder`), adapters that support in-place edits should\n * update that placeholder message rather than posting a new one. Adapters\n * without an \"update message\" API can ignore the ref and post fresh.\n */\n sendResponse(\n message: OutgoingMessage,\n context: IncomingMessage,\n opts?: { placeholderRef?: string },\n ): Promise<void>;\n\n /**\n * Optionally post a \"working on it…\" placeholder message immediately when a\n * webhook arrives, before the agent loop runs. Adapters that support\n * in-place message edits (Slack via `chat.update`, etc.) return an opaque\n * `placeholderRef` that the webhook flow threads through to `sendResponse`\n * so the same message is updated with the final answer once ready.\n *\n * Adapters without edit support should leave this undefined; the webhook\n * handler will skip the placeholder step entirely.\n */\n postProcessingPlaceholder?(\n incoming: IncomingMessage,\n ): Promise<{ placeholderRef: string } | null>;\n\n /** Start a provider-native progress/streaming surface for an agent run. */\n startRunProgress?(\n incoming: IncomingMessage,\n ): Promise<PlatformRunProgress | null>;\n\n /**\n * Reattach a durable continuation to a provider-native progress surface\n * previously started by this adapter. Adapters that cannot resume a native\n * surface should omit this and the continuation will use its normal reply\n * path instead.\n */\n resumeRunProgress?(\n incoming: IncomingMessage,\n ref: PlatformRunProgressRef,\n ): Promise<PlatformRunProgress | null>;\n\n /**\n * Send a proactive outbound message to a platform destination. Adapters that\n * only support direct replies can omit this.\n */\n sendMessageToTarget?(\n message: OutgoingMessage,\n target: OutboundTarget,\n ): Promise<void>;\n\n /**\n * Format plain agent response text into a platform-appropriate message.\n * Handles markdown conversion, message splitting for length limits, etc.\n *\n * `opts.threadDeepLinkUrl`, when present, is a URL back to the originating\n * thread in the dispatch UI. Adapters that support rich blocks should\n * render this as a button (Slack); adapters that don't may inline it as a\n * link or simply omit it.\n */\n formatAgentResponse(\n text: string,\n opts?: { threadDeepLinkUrl?: string },\n ): OutgoingMessage;\n\n /** Return current connection/configuration status for the settings UI. */\n getStatus(baseUrl?: string): Promise<IntegrationStatus>;\n}\n\nexport function assertPlatformCapability(\n adapter: PlatformAdapter,\n capability: keyof PlatformAdapterCapabilities,\n): void {\n if (adapter.capabilities?.[capability] !== true) {\n throw new UnsupportedPlatformCapabilityError(adapter.platform, capability);\n }\n}\n\n/**\n * Options for the integrations plugin.\n */\nexport interface IntegrationsPluginOptions {\n /** App identifier used by call-agent to prevent self-calls (e.g. \"dispatch\"). */\n appId?: string;\n /** Platform adapters to enable. Default: all built-in adapters with configured env keys. */\n adapters?: PlatformAdapter[];\n /** System prompt for the agent (same as agent-chat). Inherited from agent-chat plugin if not set. */\n systemPrompt?: string;\n /** Actions registry (same as agent-chat). */\n actions?: Record<string, import(\"../agent/production-agent.js\").ActionEntry>;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var. */\n apiKey?: string;\n /** Agent engine to use. Defaults to the same engine resolver as web chat. */\n engine?:\n | import(\"../agent/engine/types.js\").AgentEngine\n | string\n | {\n name: string;\n config: Record<string, unknown>;\n };\n /**\n * Resolve which owner should receive personal resource context and own the\n * created chat thread for an incoming platform message.\n */\n resolveOwner?: (incoming: IncomingMessage) => string | Promise<string>;\n /**\n * Resolve the durable execution principal for an inbound provider message.\n * Shared channels should use a service principal; DMs may use a verified\n * linked user. When present this supersedes `resolveOwner`.\n */\n resolveExecutionContext?: (\n incoming: IncomingMessage,\n ) => IntegrationExecutionContext | Promise<IntegrationExecutionContext>;\n /**\n * Optional preprocessor for inbound platform messages. Can intercept special\n * commands (such as `/link`) before the agent loop runs.\n */\n beforeProcess?: (\n incoming: IncomingMessage,\n adapter: PlatformAdapter,\n ) => Promise<\n | {\n handled: true;\n responseText?: string;\n }\n | { handled: false }\n >;\n}\n\nexport interface IntegrationExecutionContext {\n ownerEmail: string;\n orgId: string | null;\n principalType: \"user\" | \"service\";\n installationId?: string;\n scopeId?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/integrations/types.ts"],"names":[],"mappings":"AAuNA,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAIhD,QAAQ;IACR,UAAU;IAJZ,IAAI,GAAG,iCAAiC,CAAC;IAElD,YACW,QAAgB,EAChB,UAA6C;QAEtD,KAAK,CAAC,YAAY,QAAQ,qBAAqB,UAAU,EAAE,CAAC,CAAC;wBAHpD,QAAQ;0BACR,UAAU;QAGnB,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACnD,CAAC;CACF;AAiJD,MAAM,UAAU,wBAAwB,CACtC,OAAwB,EACxB,UAA6C;IAE7C,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,kCAAkC,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC","sourcesContent":["import type { H3Event } from \"h3\";\n\nimport type { AgentChatEvent } from \"../agent/types.js\";\nimport type { EnvKeyConfig } from \"../server/create-server.js\";\n\nexport type IntegrationConversationType =\n | \"channel\"\n | \"private_channel\"\n | \"dm\"\n | \"group_dm\"\n | \"unknown\";\n\nexport type IntegrationTriggerKind = \"mention\" | \"dm\" | \"thread_reply\";\n\nexport interface IntegrationActorTrust {\n memberType: \"owner\" | \"admin\" | \"member\" | \"guest\" | \"external\" | \"unknown\";\n verified: boolean;\n}\n\nexport interface IntegrationContextMessage {\n senderId?: string;\n senderName?: string;\n text: string;\n timestamp: number;\n sourceUrl?: string;\n reactions?: Array<{ name: string; count: number }>;\n files?: IntegrationFileReference[];\n}\n\nexport interface IntegrationFileReference {\n id: string;\n name?: string;\n mimetype?: string;\n size?: number;\n permalink?: string;\n downloadUrl?: string;\n}\n\n/**\n * Normalized incoming message from any messaging platform.\n */\nexport interface IncomingMessage {\n /** Platform identifier (e.g., \"slack\", \"telegram\", \"whatsapp\") */\n platform: string;\n /** Platform-specific thread/conversation identifier */\n externalThreadId: string;\n /** Message text content */\n text: string;\n /** Display name of the sender */\n senderName?: string;\n /** Verified sender email, when the platform can provide one */\n senderEmail?: string;\n /** Platform-specific sender ID */\n senderId?: string;\n /** How this message intentionally invoked an agent. */\n triggerKind?: IntegrationTriggerKind;\n /** Normalized provider conversation type for policy evaluation. */\n conversationType?: IntegrationConversationType;\n /** Provider tenant/workspace identifier. */\n tenantId?: string;\n /** Authorized integration scope resolved before execution. */\n integrationScopeId?: string;\n /** Normalized actor trust; unknown/unverified callers fail closed. */\n actorTrust?: IntegrationActorTrust;\n /** Bounded provider-native conversation context hydrated at run time. */\n contextMessages?: IntegrationContextMessage[];\n /** Provider file references only. Raw file bodies never belong here. */\n files?: IntegrationFileReference[];\n /** Server-verified approval grants carried by an interaction continuation. */\n approvedToolCalls?: string[];\n /**\n * Whether the platform cryptographically authenticated that the message\n * genuinely came from the claimed sender (e.g. inbound email that passed\n * DKIM, or an aligned SPF pass, for the From domain). Defaults to\n * undefined/false for platforms that don't provide sender authentication.\n *\n * Owner-resolution paths that grant a real user's identity/credentials\n * MUST treat a missing/false value as \"unverified\" and fail closed —\n * never derive a privileged acting identity from an unverified sender.\n */\n senderVerified?: boolean;\n /** Raw platform-specific context needed for routing responses */\n platformContext: Record<string, unknown>;\n /**\n * Short-lived delivery context needed only while the queued task is active.\n * Secrets such as Discord interaction tokens belong here, never in\n * `platformContext`, thread mappings, logs, or agent-visible context.\n */\n responseContext?: Record<string, unknown>;\n /** Provider-native thread/topic reference, when one exists. */\n threadRef?: string;\n /**\n * Canonical provider URL for the originating message thread, when the\n * provider can resolve one. This is safe agent-visible provenance (not a\n * credential) and should be preserved across A2A delegation so created\n * artifacts can link back to their request source.\n */\n sourceUrl?: string;\n /**\n * Trusted app-side routing guidance added after provider parsing. Adapters\n * should not copy this from user-controlled webhook payload fields.\n */\n routingHint?: {\n targetAgent?: string;\n instruction: string;\n };\n /** Provider-native message/activity reference for contextual replies. */\n replyRef?: string;\n /** Message timestamp (epoch ms) */\n timestamp: number;\n}\n\n/**\n * Outgoing message to send back to a messaging platform.\n */\nexport interface OutgoingMessage {\n /** Text content of the response */\n text: string;\n /** Platform-specific payload (e.g., Slack blocks, Telegram parse_mode) */\n platformContext: Record<string, unknown>;\n}\n\n/**\n * Proactive outbound message target for a platform.\n * Used when the agent needs to send to a saved destination instead of replying\n * to the current inbound thread.\n */\nexport interface OutboundTarget {\n /** Canonical platform-specific destination id (channel, chat, thread, etc.) */\n destination: string;\n /** Optional thread reference when the destination supports threading */\n threadRef?: string | null;\n /** Optional fallback display label */\n label?: string;\n /** Provider tenant/workspace used to select an installation credential. */\n tenantId?: string;\n /** Managed installation id when the caller already resolved it. */\n installationId?: string;\n}\n\n/**\n * Connection status for a platform integration.\n */\nexport interface IntegrationStatus {\n platform: string;\n /** Human-readable label (e.g., \"Slack\", \"Telegram\") */\n label: string;\n /** Whether the integration is explicitly enabled */\n enabled: boolean;\n /** Whether all required credentials are configured */\n configured: boolean;\n /** Platform-specific details (workspace name, bot username, etc.) */\n details?: Record<string, unknown>;\n /** Error message if something is wrong */\n error?: string;\n /** The webhook URL that should be configured in the platform */\n webhookUrl?: string;\n /** The full list of env keys (required + optional) the adapter recognizes,\n * including UI hints. Surfaced on the integrations status endpoint so the\n * frontend can render fields without hard-coding them per platform. */\n requiredEnvKeys?: import(\"../server/create-server.js\").EnvKeyConfig[];\n}\n\nexport interface PlatformAdapterCapabilities {\n /** The adapter can deliver a response to the current inbound event. */\n replyText: boolean;\n /** The adapter can send without an active inbound event. */\n proactiveMessages: boolean;\n /** The adapter preserves a provider-native thread or topic reference. */\n nativeThreads: boolean;\n /** The adapter can quote/reply to a specific inbound message. */\n contextualReplies: boolean;\n /** The provider requires an immediate deferred webhook acknowledgement. */\n deferredWebhookResponse: boolean;\n /** The adapter only receives explicit interactions, not ordinary messages. */\n interactionOnly?: boolean;\n /** The adapter can hydrate bounded native thread/file/reaction context. */\n nativeContextHydration?: boolean;\n /** The adapter can surface live agent progress in the provider UI. */\n liveRunProgress?: boolean;\n}\n\nexport interface PlatformRunProgress {\n /**\n * Opaque, provider-owned reference for resuming this progress surface from a\n * durable continuation. It deliberately contains no user content,\n * credentials, or provider payload.\n */\n ref?: PlatformRunProgressRef;\n /** Receive normalized agent events. Implementations should throttle writes. */\n onEvent(event: AgentChatEvent): Promise<void> | void;\n /** Finalize the provider-native progress surface with the answer. */\n complete(message: OutgoingMessage): Promise<void>;\n /** Mark the provider-native surface failed and leave a retryable explanation. */\n fail?(message: string): Promise<void>;\n}\n\n/**\n * Safe, minimal reference to a provider-native run-progress surface.\n *\n * The field values are opaque to the framework. Adapters may use `kind` to\n * distinguish their own resume strategy and `streamTs` to identify the\n * provider-side stream. No incoming message text, platform payload, or\n * credential belongs here.\n */\nexport interface PlatformRunProgressRef {\n kind: string;\n streamTs: string;\n}\n\nexport interface ImmediateWebhookResponse {\n status: number;\n body: unknown;\n}\n\nexport class UnsupportedPlatformCapabilityError extends Error {\n readonly code = \"UNSUPPORTED_PLATFORM_CAPABILITY\";\n\n constructor(\n readonly platform: string,\n readonly capability: keyof PlatformAdapterCapabilities,\n ) {\n super(`Platform ${platform} does not support ${capability}`);\n this.name = \"UnsupportedPlatformCapabilityError\";\n }\n}\n\n/**\n * Platform adapter interface — implement this for each messaging platform.\n *\n * Each adapter handles the platform-specific concerns:\n * - Webhook verification (HMAC signatures, challenge responses)\n * - Message parsing (platform events → normalized IncomingMessage)\n * - Response formatting (agent text → platform-specific format)\n * - Response delivery (POST back to platform API)\n */\nexport interface PlatformAdapter {\n /** Unique platform identifier */\n readonly platform: string;\n /** Human-readable label */\n readonly label: string;\n /** Explicit runtime behavior. Missing fields are treated as unsupported. */\n readonly capabilities?: Partial<PlatformAdapterCapabilities>;\n\n /** Env keys this adapter needs (tokens, secrets, etc.) */\n getRequiredEnvKeys(): EnvKeyConfig[];\n\n /**\n * Handle platform-specific verification challenges.\n * For example, Slack sends a `url_verification` event when setting up.\n * Return `{ handled: true, response }` to short-circuit the webhook handler.\n */\n handleVerification(event: H3Event): Promise<{\n handled: boolean;\n response?: unknown;\n }>;\n\n /**\n * Validate the webhook request signature.\n * Returns true if the request is authentic.\n */\n verifyWebhook(event: H3Event): Promise<boolean>;\n\n /**\n * Parse the webhook payload into a normalized IncomingMessage.\n * Return null to silently ignore the event (bot messages, edits, etc.).\n */\n parseIncomingMessage(event: H3Event): Promise<IncomingMessage | null>;\n\n /**\n * Hydrate bounded provider-native context after durable enqueue, outside the\n * provider acknowledgement budget. Implementations must return references,\n * metadata, and text only — never persist file bodies or credentials.\n */\n hydrateIncomingMessage?(incoming: IncomingMessage): Promise<IncomingMessage>;\n\n /**\n * Hydrate only verified sender identity before execution-context selection.\n * This runs on the provider acknowledgement path and must avoid fetching\n * conversation history or file bodies.\n */\n hydrateIncomingIdentity?(incoming: IncomingMessage): Promise<IncomingMessage>;\n\n /**\n * Provider-specific response returned only after a message is verified and\n * durably enqueued. Discord uses this to return a type-5 deferred response\n * within its three-second interaction deadline.\n */\n getImmediateWebhookResponse?(\n incoming: IncomingMessage,\n ): ImmediateWebhookResponse | null;\n\n /**\n * Return pre-canonical thread ids used by older adapter versions. The\n * integration handler checks these only when the canonical mapping is\n * missing, then aliases a match to the canonical id without forking history.\n */\n getLegacyExternalThreadIds?(incoming: IncomingMessage): string[];\n\n /**\n * Send the agent's response back to the messaging platform.\n *\n * If `opts.placeholderRef` is provided (returned earlier by\n * `postProcessingPlaceholder`), adapters that support in-place edits should\n * update that placeholder message rather than posting a new one. Adapters\n * without an \"update message\" API can ignore the ref and post fresh.\n */\n sendResponse(\n message: OutgoingMessage,\n context: IncomingMessage,\n opts?: { placeholderRef?: string },\n ): Promise<void>;\n\n /**\n * Optionally post a \"working on it…\" placeholder message immediately when a\n * webhook arrives, before the agent loop runs. Adapters that support\n * in-place message edits (Slack via `chat.update`, etc.) return an opaque\n * `placeholderRef` that the webhook flow threads through to `sendResponse`\n * so the same message is updated with the final answer once ready.\n *\n * Adapters without edit support should leave this undefined; the webhook\n * handler will skip the placeholder step entirely.\n */\n postProcessingPlaceholder?(\n incoming: IncomingMessage,\n ): Promise<{ placeholderRef: string } | null>;\n\n /** Start a provider-native progress/streaming surface for an agent run. */\n startRunProgress?(\n incoming: IncomingMessage,\n ): Promise<PlatformRunProgress | null>;\n\n /**\n * Reattach a durable continuation to a provider-native progress surface\n * previously started by this adapter. Adapters that cannot resume a native\n * surface should omit this and the continuation will use its normal reply\n * path instead.\n */\n resumeRunProgress?(\n incoming: IncomingMessage,\n ref: PlatformRunProgressRef,\n ): Promise<PlatformRunProgress | null>;\n\n /**\n * Send a proactive outbound message to a platform destination. Adapters that\n * only support direct replies can omit this.\n */\n sendMessageToTarget?(\n message: OutgoingMessage,\n target: OutboundTarget,\n ): Promise<void>;\n\n /**\n * Format plain agent response text into a platform-appropriate message.\n * Handles markdown conversion, message splitting for length limits, etc.\n *\n * `opts.threadDeepLinkUrl`, when present, is a URL back to the originating\n * thread in the dispatch UI. Adapters that support rich blocks should\n * render this as a button (Slack); adapters that don't may inline it as a\n * link or simply omit it.\n */\n formatAgentResponse(\n text: string,\n opts?: { threadDeepLinkUrl?: string },\n ): OutgoingMessage;\n\n /** Return current connection/configuration status for the settings UI. */\n getStatus(baseUrl?: string): Promise<IntegrationStatus>;\n}\n\nexport function assertPlatformCapability(\n adapter: PlatformAdapter,\n capability: keyof PlatformAdapterCapabilities,\n): void {\n if (adapter.capabilities?.[capability] !== true) {\n throw new UnsupportedPlatformCapabilityError(adapter.platform, capability);\n }\n}\n\n/**\n * Options for the integrations plugin.\n */\nexport interface IntegrationsPluginOptions {\n /** App identifier used by call-agent to prevent self-calls (e.g. \"dispatch\"). */\n appId?: string;\n /** Platform adapters to enable. Default: all built-in adapters with configured env keys. */\n adapters?: PlatformAdapter[];\n /** System prompt for the agent (same as agent-chat). Inherited from agent-chat plugin if not set. */\n systemPrompt?: string;\n /** Actions registry (same as agent-chat). */\n actions?: Record<string, import(\"../agent/production-agent.js\").ActionEntry>;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var. */\n apiKey?: string;\n /** Agent engine to use. Defaults to the same engine resolver as web chat. */\n engine?:\n | import(\"../agent/engine/types.js\").AgentEngine\n | string\n | {\n name: string;\n config: Record<string, unknown>;\n };\n /**\n * Resolve which owner should receive personal resource context and own the\n * created chat thread for an incoming platform message.\n */\n resolveOwner?: (incoming: IncomingMessage) => string | Promise<string>;\n /**\n * Resolve the durable execution principal for an inbound provider message.\n * Shared channels should use a service principal; DMs may use a verified\n * linked user. When present this supersedes `resolveOwner`.\n */\n resolveExecutionContext?: (\n incoming: IncomingMessage,\n ) => IntegrationExecutionContext | Promise<IntegrationExecutionContext>;\n /**\n * Optional preprocessor for inbound platform messages. Can intercept special\n * commands (such as `/link`) before the agent loop runs.\n */\n beforeProcess?: (\n incoming: IncomingMessage,\n adapter: PlatformAdapter,\n ) => Promise<\n | {\n handled: true;\n responseText?: string;\n }\n | { handled: false }\n >;\n}\n\nexport interface IntegrationExecutionContext {\n ownerEmail: string;\n orgId: string | null;\n principalType: \"user\" | \"service\";\n installationId?: string;\n scopeId?: string;\n}\n"]}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* — it can be bundled into the serverless function alongside `mountMCP`.
|
|
19
19
|
*/
|
|
20
20
|
import type { ActionEntry } from "../agent/production-agent.js";
|
|
21
|
+
import type { ExternalAgentPolicy } from "./external-agent-policy.js";
|
|
21
22
|
export interface MCPConfig {
|
|
22
23
|
/** App name shown in MCP server info */
|
|
23
24
|
name: string;
|
|
@@ -85,8 +86,9 @@ export interface MCPConfig {
|
|
|
85
86
|
* from connectors. It is no longer gated behind an environment variable, and
|
|
86
87
|
* the catalog is never inferred from the client name/user-agent.
|
|
87
88
|
*
|
|
88
|
-
* `tool-search` stays available in the compact catalog
|
|
89
|
-
*
|
|
89
|
+
* `tool-search` stays available in the compact catalog for discovery. A
|
|
90
|
+
* searched action still needs the connector catalog or authenticated-read
|
|
91
|
+
* policy before `tools/call`; callers who need the full surface up front opt in
|
|
90
92
|
* explicitly with `agent-native connect --full-catalog` (embeds a
|
|
91
93
|
* `catalog_scope: "full"` claim in the connect-minted JWT) or the
|
|
92
94
|
* deployment-wide `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.
|
|
@@ -95,6 +97,11 @@ export interface MCPConfig {
|
|
|
95
97
|
* setting it on `MCPConfig` directly; the plugin copies it through.
|
|
96
98
|
*/
|
|
97
99
|
connectorCatalog?: string[];
|
|
100
|
+
/**
|
|
101
|
+
* Optional policy for automatically exposing explicitly annotated,
|
|
102
|
+
* authenticated read actions to external MCP callers.
|
|
103
|
+
*/
|
|
104
|
+
externalAgents?: ExternalAgentPolicy;
|
|
98
105
|
}
|
|
99
106
|
/**
|
|
100
107
|
* Identity extracted from a verified MCP bearer token / JWT. Used to wrap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-server.d.ts","sourceRoot":"","sources":["../../src/mcp/build-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"build-server.d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M,EAAE,OAAO,CAAC,CAAC;CACjC,CA2BA;AA+hBD;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,WAAW,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkgB7B;AAOD,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAc1C;AAyCD,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,GAAG,SAAS,CAIpB;AA+FD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAO,GACxE,OAAO,CAAC;IACT,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC,CA4ID;AAED,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GACtC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAc7B"}
|
package/dist/mcp/build-server.js
CHANGED
|
@@ -93,7 +93,7 @@ function explicitlyRequestsFullMcpCatalog(requestMeta) {
|
|
|
93
93
|
// (100k+ tokens) into a context window just because a client called itself
|
|
94
94
|
// "code"/"cursor"/"codex" was a recurring footgun. Everything else gets the
|
|
95
95
|
// connector/compact catalog plus `tool-search`, which keeps every tool
|
|
96
|
-
//
|
|
96
|
+
// discoverable; only permitted actions are callable without full opt-in.
|
|
97
97
|
if (process.env.AGENT_NATIVE_MCP_FULL_CATALOG === "1")
|
|
98
98
|
return true;
|
|
99
99
|
return requestMeta?.fullCatalog === true;
|
|
@@ -117,19 +117,80 @@ function warnFullCatalogServed(toolCount) {
|
|
|
117
117
|
`This is a large context payload meant to be a rare, explicit opt-in — most ` +
|
|
118
118
|
`clients should use the default compact/connector catalog + tool-search instead.`);
|
|
119
119
|
}
|
|
120
|
+
function isAuthenticatedReadAction(entry) {
|
|
121
|
+
return (entry.http !== false &&
|
|
122
|
+
entry.http?.method === "GET" &&
|
|
123
|
+
entry.readOnly === true &&
|
|
124
|
+
entry.publicAgent?.expose === true &&
|
|
125
|
+
entry.publicAgent.readOnly === true &&
|
|
126
|
+
entry.publicAgent.requiresAuth === true);
|
|
127
|
+
}
|
|
120
128
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
129
|
+
* Hard exclusion list for the `authenticatedReads: "auto"` derivation ONLY
|
|
130
|
+
* (see `autoAuthenticatedReadNames` below). Explicit `connectorCatalog`
|
|
131
|
+
* entries are a deliberate, reviewed choice made by the app and are NOT
|
|
132
|
+
* affected by this list — an app can still list any of these names in
|
|
133
|
+
* `connectorCatalog` on purpose.
|
|
134
|
+
*
|
|
135
|
+
* These are the footgun families this file's other comments already call
|
|
136
|
+
* out ("removes footguns (db-exec, seed-*, extension tools, browser-session
|
|
137
|
+
* tools, etc.)" above, and "keeps db-exec / seed-* / extension /
|
|
138
|
+
* browser-session footguns off the external surface" near the connector
|
|
139
|
+
* tier below): generic core SQL access, template demo/seed data, the
|
|
140
|
+
* extension-management suite, live browser-session control, and Context
|
|
141
|
+
* X-Ray internals. `isAuthenticatedReadAction` only inspects action
|
|
142
|
+
* metadata (http/readOnly/publicAgent flags) — nothing stops a future
|
|
143
|
+
* change from mis-annotating one of these with that exact flag set again,
|
|
144
|
+
* the way `db-query`/`db-schema` were briefly (and accidentally) annotated
|
|
145
|
+
* before it was caught in review. These names can never be auto-derived
|
|
146
|
+
* from metadata alone; exposing one to external callers requires an
|
|
147
|
+
* explicit `connectorCatalog` entry.
|
|
126
148
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
149
|
+
const AUTO_READ_EXCLUDED_ACTION_NAMES = new Set([
|
|
150
|
+
"db-query",
|
|
151
|
+
"db-schema",
|
|
152
|
+
"db-exec",
|
|
153
|
+
"db-patch",
|
|
154
|
+
"context-manifest-get",
|
|
155
|
+
"context-pin",
|
|
156
|
+
"context-evict",
|
|
157
|
+
"context-restore",
|
|
158
|
+
"context-report",
|
|
159
|
+
]);
|
|
160
|
+
/**
|
|
161
|
+
* Substring/prefix patterns for excluded name *families* that aren't a
|
|
162
|
+
* fixed, enumerable set: `seed-*` varies per app/template, and the
|
|
163
|
+
* extension-management and browser-session tool suites use varying verb
|
|
164
|
+
* prefixes around a shared noun (e.g. `list-extensions`, `create-extension`,
|
|
165
|
+
* `hide-extension`; `list-browser-sessions`, `run-browser-session-action`) —
|
|
166
|
+
* so a leading-prefix match alone would miss most of them.
|
|
167
|
+
*/
|
|
168
|
+
const AUTO_READ_EXCLUDED_ACTION_PATTERNS = [
|
|
169
|
+
/^seed-/,
|
|
170
|
+
/extension/,
|
|
171
|
+
/browser-session/,
|
|
172
|
+
];
|
|
173
|
+
function isAutoReadExcludedActionName(name) {
|
|
174
|
+
return (AUTO_READ_EXCLUDED_ACTION_NAMES.has(name) ||
|
|
175
|
+
AUTO_READ_EXCLUDED_ACTION_PATTERNS.some((pattern) => pattern.test(name)));
|
|
176
|
+
}
|
|
177
|
+
function autoAuthenticatedReadNames(actions, config) {
|
|
178
|
+
if (config.externalAgents?.authenticatedReads !== "auto")
|
|
179
|
+
return new Set();
|
|
180
|
+
return new Set(Object.entries(actions)
|
|
181
|
+
.filter(([name, entry]) => isAuthenticatedReadAction(entry) &&
|
|
182
|
+
!isAutoReadExcludedActionName(name))
|
|
183
|
+
.map(([name]) => name));
|
|
184
|
+
}
|
|
185
|
+
function externalAgentDenySet(config) {
|
|
186
|
+
return new Set((config.externalAgents?.denyActions ?? [])
|
|
187
|
+
.map((name) => name.trim())
|
|
188
|
+
.filter(Boolean));
|
|
189
|
+
}
|
|
190
|
+
function externalAgentWritesAreAskAppOnly(config) {
|
|
191
|
+
return (config.externalAgents?.writes === "ask_app_only" ||
|
|
192
|
+
(config.externalAgents?.authenticatedReads === "auto" &&
|
|
193
|
+
config.externalAgents?.writes !== "allowlisted"));
|
|
133
194
|
}
|
|
134
195
|
function metadataObject(value) {
|
|
135
196
|
return value && typeof value === "object" && !Array.isArray(value)
|
|
@@ -926,15 +987,19 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
926
987
|
const advertisedActionsBeforeConnector = compactMcpAppCatalog
|
|
927
988
|
? Object.fromEntries(Object.entries(visibleActions).filter(([name, entry]) => isActionAdvertisedInCompactMcpAppCatalog(name, entry, config)))
|
|
928
989
|
: visibleActions;
|
|
990
|
+
const autoReadNames = autoAuthenticatedReadNames(visibleActions, config);
|
|
991
|
+
const connectorNames = new Set([
|
|
992
|
+
...(config.connectorCatalog ?? []),
|
|
993
|
+
...autoReadNames,
|
|
994
|
+
]);
|
|
995
|
+
const denyNames = externalAgentDenySet(config);
|
|
996
|
+
const automaticConnectorPolicyActive = config.externalAgents?.authenticatedReads === "auto";
|
|
929
997
|
// Connector-catalog tier: when a template declares a connector allow-list,
|
|
930
|
-
// serve exactly that curated surface
|
|
931
|
-
//
|
|
932
|
-
//
|
|
933
|
-
// so the ~105-tool full catalog can never leak just because a deployment
|
|
934
|
-
// forgot to set one. It also keeps db-exec / seed-* / extension /
|
|
998
|
+
// serve exactly that curated surface plus any explicitly annotated
|
|
999
|
+
// authenticated reads from `externalAgents.authenticatedReads: "auto"`.
|
|
1000
|
+
// This stays compact by default and keeps db-exec / seed-* / extension /
|
|
935
1001
|
// browser-session footguns off the external surface.
|
|
936
|
-
const connectorCatalogActive =
|
|
937
|
-
config.connectorCatalog.length > 0 &&
|
|
1002
|
+
const connectorCatalogActive = (connectorNames.size > 0 || automaticConnectorPolicyActive) &&
|
|
938
1003
|
!fullCatalogRequested;
|
|
939
1004
|
// When the connector catalog is active, filter directly from visibleActions
|
|
940
1005
|
// rather than advertisedActionsBeforeConnector. This ensures the connector
|
|
@@ -942,7 +1007,19 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
942
1007
|
// narrow to just the compact-catalog builtins when shouldUseCompactMcpCatalogByDefault
|
|
943
1008
|
// would have activated the compact catalog for the same caller.
|
|
944
1009
|
const advertisedActions = connectorCatalogActive
|
|
945
|
-
? Object.fromEntries(Object.entries(visibleActions).filter(([name]) =>
|
|
1010
|
+
? Object.fromEntries(Object.entries(visibleActions).filter(([name, entry]) => {
|
|
1011
|
+
if (denyNames.has(name))
|
|
1012
|
+
return false;
|
|
1013
|
+
if (COMPACT_MCP_APP_CATALOG_BUILTINS.has(name))
|
|
1014
|
+
return true;
|
|
1015
|
+
if (!connectorNames.has(name))
|
|
1016
|
+
return false;
|
|
1017
|
+
if (externalAgentWritesAreAskAppOnly(config) &&
|
|
1018
|
+
entry.readOnly !== true) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
return true;
|
|
1022
|
+
}))
|
|
946
1023
|
: advertisedActionsBeforeConnector;
|
|
947
1024
|
if (fullCatalogRequested) {
|
|
948
1025
|
warnFullCatalogServed(Object.keys(advertisedActions).length);
|