/**
 * Delivery envelope for `agents send` / `agents notify`.
 *
 * One primitive: resolve a destination (channel + target), compose text + urls +
 * attachments, hand off to a channel provider. `notify` is the same path with
 * destination defaulted from `humans.yaml` — owner is an address
 * alias (`--to owner`), not a separate stack.
 *
 * Agent control (`agents message`, `sessions inject`) stays outside this module.
 */
import type { Meta } from '../types.js';
import type { SendResult } from './registry.js';
import type { SinkMessageFormat } from '../sink-format.js';
/** Normalized delivery request after CLI/config resolution. */
export interface SendEnvelope {
    text: string;
    channel: string;
    to: string;
    thread?: string;
    attachments?: string[];
    from?: string;
    ownerScoped?: boolean;
    dryRun?: boolean;
}
export interface ResolveSendInput {
    /**
     * Body text. Prefer `--text`; positional `[text]` is accepted for compat and
     * folded in when `--text` is omitted.
     */
    text?: string;
    /** Positional `[text]` from commander (legacy). */
    positionalText?: string;
    /**
     * Recipient. Channel-specific id, or the alias `owner` which expands to
     * `notify.owner.{channel,to}`.
     */
    to?: string;
    /** Provider/channel name. Required unless `to` is `owner` (or ownerMode). */
    channel?: string;
    thread?: string;
    /** Local file paths. */
    attachments?: string[];
    /** Links / remote media refs — appended to the body so every provider sees them. */
    urls?: string[];
    from?: string;
    dryRun?: boolean;
    /**
     * When true (`agents notify`), missing channel/to default to `notify.owner`.
     * Explicit flags still win.
     */
    ownerMode?: boolean;
}
export type ResolveSendResult = {
    ok: true;
    envelope: SendEnvelope;
} | {
    ok: false;
    error: string;
};
/** True when the destination token means “the configured owner”. */
export declare function isOwnerAlias(to: string | undefined): boolean;
/** Compose body + optional URL lines (skip urls already present in the body). */
export declare function composeSendText(text: string, urls?: string[]): string;
/**
 * Read the owner destination. humans.yaml is canonical; notify.owner remains a
 * migration fallback for installations that have not run the schema migration.
 */
export declare function readOwnerDest(meta: Meta): {
    channel: string;
    to: string;
} | null;
/**
 * Resolve CLI/config into a send envelope. Pure except for reading `meta` —
 * no I/O, no provider registration — so unit tests do not need a real PATH.
 */
export declare function resolveSendEnvelope(input: ResolveSendInput, meta: Meta): ResolveSendResult;
/**
 * Register providers, resolve transport, deliver. Used by the CLI and by any
 * internal caller that already has a resolved envelope.
 */
export declare function deliverEnvelope(envelope: SendEnvelope, meta: Meta): Promise<SendResult>;
/**
 * Resolve + deliver in one step (CLI happy path).
 *
 * `ownerCompose`, when given, shapes the body PER owner destination on the
 * policy fan-out — Slack gets `mrkdwn` labeled links, iMessage stays plain
 * (PHNX-3698). Only the owner-policy path uses it; a direct `--channel`/`--to`
 * send is delivered verbatim. The envelope's own `text` remains the plain
 * default (validation, `--json`, dry-run display).
 */
export declare function sendMessage(input: ResolveSendInput, meta: Meta, ownerCompose?: (format: SinkMessageFormat) => string): Promise<{
    result: SendResult;
    envelope: SendEnvelope;
} | {
    error: string;
}>;
