/** * Managed ingress pipeline: verified inbound event → agent run. * * Providers keep signature verification, event normalization, and reply * transport. This module owns the shared pieces: deterministic thread ids, * trusted loopback invoke with source-provider stamps, and source-thread * existence probes. */ import type { TriggerChannelResume } from "../channels/trigger/types.js"; import { type ChannelBinding } from "../channels/binding.js"; /** Inputs for the source-thread involvement probe (after identity remap). */ export interface SourceThreadExistsInput { sourceThreadKey: string; userId: string; } export interface InvokeIngressAgentInput { userId: string; sourceThreadKey: string; binding: ChannelBinding; text: string; assistantId: string; /** Trusted source provider stamped on loopback invoke. */ sourceProvider?: ChannelBinding["provider"]; } export interface InvokeIngressAgentResult { replyText: string; runId?: string; threadId: string; } export interface StartedIngressRun { threadId: string; runId: string; } export type IngressRunStatus = "error" | "success" | "timeout" | "interrupted"; export interface ObservedIngressRun { values: unknown; status: IngressRunStatus; } /** * Schedule background work after the provider ACK. Defaults to fire-and-forget * with error logging; tests pass an inline runner. */ export declare function scheduleIngressWork(work: () => Promise, options: { label: string; schedule?: (work: () => Promise) => void; }): void; /** * True when an MDA thread already exists for this source-thread key. * * Call with the **resolved** actor (post identity remap) so ownership matches * the thread created on the first run. */ export declare function ingressSourceThreadExists(input: SourceThreadExistsInput): Promise; /** * Invoke the managed graph over a trusted loopback with ingress identity stamped. * * Only this path may set `x-mda-source-provider` / `x-mda-source-thread-id`. */ export declare function invokeIngressAgent(input: InvokeIngressAgentInput): Promise; /** Create a Trigger-addressed thread and enqueue its run. */ export declare function startIngressAgent(input: { threadId: string; assistantId: string; messages: Record[]; sourceProvider: string; sourceThreadKey: string; }): Promise; /** Resume a Trigger-addressed thread with a keyed interrupt response. */ export declare function resumeIngressAgent(input: { threadId: string; assistantId: string; resume: TriggerChannelResume; sourceProvider: string; sourceThreadKey: string; }): Promise; /** Join an accepted Trigger run and read its terminal status. */ export declare function observeIngressAgent(input: { threadId: string; runId: string; }): Promise; /** Deterministic LangGraph thread id from a provider source-thread key. */ export declare function stableThreadId(sourceThreadKey: string): string; //# sourceMappingURL=index.d.ts.map