/**
 * `admit_external_message` (senpi#6233): the session's own `ExternalAdmission.admit`, the call behind
 * `pi.session.admitExternalMessage`. The engine writes its fixed `session_control_delivery` entry: never a user message,
 * never the extension `input` event, never a slash command or prompt template, whatever the text says.
 *
 * What the engine adds comes from the connection the record arrived on (`DeliveryPeer`), never from the record (the
 * security design gate's binding conditions): the device a remote connection speaks for is stamped into the entry's
 * metadata (`details.remote_origin`) while the model reads exactly the text a same-machine delivery carries (senpi#6250:
 * an agent need not know a message crossed devices), the ledger keys the delivery under that device, a `command_line` sender is refused
 * from a remote device, the turn that consumes the delivery takes the connection's origin, the thread-chain guard
 * runs first, and an id the transcript already holds is answered `already_admitted` after a restart too.
 */
import type { AgentSession } from "../../core/agent-session.ts";
import type { ConnectionOrigin } from "../../core/turn-origin.ts";
import type { RpcAdmitExternalMessageCommand, RpcAdmitExternalMessageReply } from "./admit-external-message-wire.ts";
import { type ChainRefusal } from "./chain-admission.ts";
import type { RpcRemoteOrigin } from "./remote-origin.ts";
/** The connection a delivery arrived on, as the host knows it. */
export interface DeliveryPeer {
    /** The remote device the connection speaks for (`ConnectionRoles.originOf`); absent on a plain local connection. */
    readonly origin: RpcRemoteOrigin | undefined;
    readonly connectionOrigin: ConnectionOrigin;
    /** The origin the turn this delivery opens counts as (senpi#6342); the connection's origin when absent. */
    readonly turnOrigin?: ConnectionOrigin;
}
export type AdmitExternalMessageAnswer = {
    readonly ok: true;
    readonly data: RpcAdmitExternalMessageReply;
} | {
    readonly ok: false;
    readonly refusal: ChainRefusal | {
        readonly message: string;
        readonly errorCode: string;
    };
};
type AdmittingSession = Pick<AgentSession, "externalAdmission" | "sessionManager" | "settingsManager">;
export declare function admitExternalMessage(session: AdmittingSession, command: RpcAdmitExternalMessageCommand, peer: DeliveryPeer): AdmitExternalMessageAnswer;
export {};
//# sourceMappingURL=admit-external-message-command.d.ts.map