import { type AgentRequestBase, type AgentResponder, type AgentResponse } from "@mono-agent/agent-contracts"; import type { MonoAgentAppLogger } from "./channels.js"; export interface MonitorWakeContext { readonly monitorId: string; readonly chainDepth: number; } export type MonitorWakeContextResolution = { readonly kind: "none"; } | { readonly kind: "resolved"; readonly context: MonitorWakeContext; } | { readonly kind: "missed"; }; /** * Run a genuine channel turn as a monitor wake. * * This nests INSIDE the process-job wake context on purpose. Both features raise * host-owned turns on the same conversation, and the steering registry admits * exactly one active run per conversation: a second, parallel registration would * make every steer ambiguous and silently downgrade process-job wakes to a * follow-up turn. Sharing it also means a monitor wake inherits the same * targeted-run steering and the same unforgeable chain-depth increment, so a * monitor started from a wake turn cannot escape `maxChainDepth`. */ export declare function runWithMonitorWakeContext(context: MonitorWakeContext, operation: () => Promise, deliveryKey: string): Promise; /** * Capture an admitted monitor wake on the request identity that survives the * responder-to-harness queue boundary, and suppress a sentinel-only answer. * * The suppression is the point of this wrapper. A monitor raises turns nobody * asked for, so it must be able to conclude "nothing worth saying" without * posting anything — but `NOTHING_TO_REPORT` is only honoured by the native * cron/webhook notify path, which a channel wake turn does not go through. * Blanking the answer here makes the adapters' existing "agent produced no * answer" path do the suppressing, without teaching any adapter about monitors. */ export declare function bindMonitorWakeContextToResponder(responder: AgentResponder, options?: { readonly logger?: MonoAgentAppLogger; }): AgentResponder; /** * Blank a monitor wake answer that ends with the sentinel. Attachments are * dropped with it: a turn that decided it has nothing to say must not still post * files. A `narrated-sentinel` is honoured but logged, exactly as the native * notify path does, because it means the model wrote prose before the marker. */ export declare function suppressSilentMonitorReply(response: AgentResponse, context: MonitorWakeContext & { readonly deliveryKey?: string; }, logger?: MonoAgentAppLogger): AgentResponse; /** * Whether this wake's turn ran and chose silence. Consumed once: the settling * wake is the only reader, and a stale key must not make a later batch look * delivered. */ export declare function consumeSilentMonitorWake(deliveryKey: string): boolean; /** Resolve only an association previously issued by this app-owned seam. */ export declare function monitorWakeContextForRequest(request: Pick): MonitorWakeContextResolution; //# sourceMappingURL=monitors-context.d.ts.map