import type { AgentManager } from '../tools/agent/index.js'; import type { AgentRecord } from '../tools/agent/index.js'; import type { AutomationRouteBinding } from '../automation/routes.js'; import type { AutomationSurfaceKind } from '../automation/types.js'; import type { ChannelConversationKind, ChannelPolicyDecision, RouteBindingManager } from '../channels/index.js'; import type { SharedSessionBroker } from '../control-plane/index.js'; import type { ConversationMessageEnvelope } from '../control-plane/conversation-message.js'; import type { SecretsManager } from '../config/secrets.js'; import type { ServiceRegistry } from '../config/service-registry.js'; /** * What an adapter learns from an ingress authorization. * * Every adapter in packages/sdk/src/platform/adapters reads `allowed` and * `reason`, 19 sites each, and none reads `policy`, `matchedGroupPolicy`, * `matchedScope`, `effectiveRequireMention` or `effectiveAllowedCommands`. The * seam returned the whole `ChannelPolicyDecision`, so every adapter test double * had to produce a full `ChannelPolicyRecord` it would never look at, and the * ones that did not were cast through `unknown` instead, which is how a * decision missing its required `policy` field passed for a real one. * * The production implementation still returns the full decision; it remains * assignable. */ export type SurfaceIngressDecision = Pick; export interface SurfaceControlCommand { readonly action: 'status' | 'cancel' | 'retry'; readonly id: string; } export interface QueueSurfaceReplyInput { readonly agentId: string; readonly task: string; readonly agentTask?: string | undefined; readonly workflowChainId?: string | undefined; readonly sessionId?: string | undefined; } export interface QueueNtfyChatReplyInput { readonly sessionId: string; readonly topic: string; readonly body: string; readonly title?: string | undefined; readonly messageId: string; } export interface NtfyRemoteChatResult { readonly sessionId: string; readonly messageId: string; readonly delivered: boolean; readonly error?: string | undefined; } export interface HomeAssistantRemoteChatResult { readonly sessionId: string; readonly routeId?: string | undefined; readonly messageId: string; readonly assistantMessageId?: string | undefined; readonly response?: string | undefined; readonly delivered: boolean; readonly error?: string | undefined; } export type TrySpawnAgentInput = Parameters[0]; export type TrySpawnAgentResult = AgentRecord | Response; export type TrySpawnAgentFn = (input: TrySpawnAgentInput, logLabel: string, sessionId?: string) => TrySpawnAgentResult; export interface SurfaceAdapterContext { readonly serviceRegistry: ServiceRegistry; readonly secretsManager?: Pick | undefined; readonly configManager: { get(key: string): unknown; }; readonly routeBindings: RouteBindingManager; readonly sessionBroker: SharedSessionBroker; readonly authorizeSurfaceIngress: (input: { surface: Extract; userId?: string | undefined; channelId?: string | undefined; groupId?: string | undefined; threadId?: string | undefined; workspaceId?: string | undefined; conversationKind?: ChannelConversationKind | undefined; hasAnyMention?: boolean | undefined; text?: string | undefined; controlCommand?: string | undefined; mentioned?: boolean | undefined; metadata?: Record | undefined; }) => Promise; /** * Report that an inbound message on this surface could not be processed. * * For the DETACHED paths only, Slack's and Discord's slash commands answer * the provider immediately and then work in the background, so a failure * there is invisible to the shared inbound seam in `ChannelPluginRegistry` * that covers every other webhook surface. Optional so an embedder that * wires no alarm is unaffected. */ readonly reportIngressFailure?: ((surface: import('../channels/types.js').ChannelSurface, detail: string) => void) | undefined; readonly parseSurfaceControlCommand: (text: string) => SurfaceControlCommand | null; readonly performSurfaceControlCommand: (command: SurfaceControlCommand) => Promise; readonly performInteractiveSurfaceAction: (actionId: string, surface: 'slack' | 'discord', req: Request) => Promise; readonly trySpawnAgent: TrySpawnAgentFn; readonly queueSurfaceReplyFromBinding: (binding: AutomationRouteBinding | undefined, input: QueueSurfaceReplyInput) => void; readonly publishConversationFollowup?: (sessionId: string, envelope: Omit) => void; readonly queueNtfyChatReply?: ((input: QueueNtfyChatReplyInput) => void) | undefined; readonly postNtfyRemoteChatMessage?: (input: { readonly topic: string; readonly body: string; readonly title?: string | undefined; }) => Promise; readonly postHomeAssistantChatMessage?: (input: { readonly body: string; readonly messageId: string; readonly conversationId: string; readonly surfaceId: string; readonly channelId: string; readonly threadId?: string | undefined; readonly userId?: string | undefined; readonly displayName?: string | undefined; readonly title: string; readonly providerId?: string | undefined; readonly modelId?: string | undefined; readonly tools?: readonly string[] | undefined; readonly context?: Record | undefined; readonly remoteSessionTtlMs?: number | undefined; readonly publishEvent?: boolean | undefined; }) => Promise; } export interface GenericWebhookReplyInput { readonly agentId: string; readonly task: string; readonly sessionId?: string | undefined; readonly routeId?: string | undefined; readonly callbackUrl?: string | undefined; readonly callbackCorrelationId?: string | undefined; readonly callbackSignature?: 'shared-secret' | 'hmac-sha256' | undefined; } export interface GenericWebhookAdapterContext { /** * The store a `goodvibes://secrets/…` config reference resolves against. * * `surfaces.webhook.secret` is swept into the secret store like every other * surface credential, so without this the generic webhook adapter holds a * reference it cannot resolve and refuses every caller. */ readonly secretsManager?: Pick | undefined; readonly configManager: { get(key: string): unknown; }; readonly routeBindings: RouteBindingManager; readonly sessionBroker: SharedSessionBroker; readonly authorizeSurfaceIngress: (input: { surface: Extract; userId?: string | undefined; channelId?: string | undefined; groupId?: string | undefined; threadId?: string | undefined; workspaceId?: string | undefined; conversationKind?: ChannelConversationKind | undefined; hasAnyMention?: boolean | undefined; text?: string | undefined; controlCommand?: string | undefined; mentioned?: boolean | undefined; metadata?: Record | undefined; }) => Promise; readonly trySpawnAgent: TrySpawnAgentFn; readonly surfaceDeliveryEnabled: (surface: Extract) => boolean; readonly signWebhookPayload: (body: string, secret: string) => string; readonly queueWebhookReply: (input: GenericWebhookReplyInput) => void; } //# sourceMappingURL=types.d.ts.map