/**
 * The HOST vocabulary, one home for how a host is spelled and read:
 *  · {@link hostOfSpelling} — the RULE side: the host a `<Tool>(domain:<host>)` rule names;
 *  · {@link hostOfUrl} — the CALL side: the host a URL names, which every host-rule judge reads as the call's subject and the
 *    engine's fetch tool reads as the host it connects to (one reading, two readers);
 *  · {@link callHostTargetOf} — which argument of a call carries that URL: the host face's protective and declared readings.
 * Both sides go through the URL parser (lower case, IDN in its ASCII form, a full-width dot folded, an IPv4 shorthand expanded)
 * and read trailing dots off; a call's host that does not read back as itself through the rule side's reader names no host a rule
 * can be judged on, so a rule and a call that name one host always name it in one spelling.
 *
 * Leaf module: it reads the catalog's host slots (the protective floor) and the name-reading seat, nothing else.
 */
import { type ToolCallLike } from "./tool-registry.js";
/**
 * THE reading of a host's spelling: the host as the URL parser reads it (lower case, IDN in its ASCII form, a full-width dot
 * folded, an IPv4 shorthand expanded, trailing dots read off), or why it names none — `empty_label` for a name with an empty
 * label once its trailing dots are read off (`.evil.test`, `a..test`: no host has one, and nothing a rule or a floor entry is
 * matched against ever does), `not_a_host` for a spelling that is more or less than a host (empty, carrying whitespace or a
 * separator a URL reads as something else, a port — a `:` outside an address's brackets —, credentials, a path).
 */
export declare function readSpelledHost(spelled: string): {
    readonly host: string;
} | {
    readonly problem: "empty_label" | "not_a_host";
};
/** The host a spelling names ({@link readSpelledHost}), or undefined when it names none. */
export declare function hostOfSpelling(spelled: string): string | undefined;
/** Is this host (as {@link hostOfUrl} reads it) an address — the URL parser's IPv4 form or a bracketed IPv6? */
export declare function isAddressHost(host: string): boolean;
/** A host pattern: one exact host (`host`), or every host BELOW a domain at any depth, never the domain itself (`subdomain`). */
export interface HostPattern {
    readonly match: "host" | "subdomain";
    readonly host: string;
}
/** Why a spelling is no host pattern: `*` alone (every host), a `*` other than a leading `*.`, a host with an empty label (a
 *  leading or doubled dot — "this domain and every host below" is two patterns, `example.com` and `*.example.com`), more or less
 *  than a host, a `*.` over an address (an address has no subdomains). */
export type HostPatternProblem = "every_host" | "inner_wildcard" | "empty_label" | "not_a_host" | "below_address";
/**
 * THE reader of a host pattern's spelling — `example.com` or `*.example.com` — for every place one is written: the content of a
 * `<Tool>(domain:<pattern>)` rule and an entry of the deployment's host floor. The `*.` operator is the spelling's leading two
 * characters; the host after it is read by {@link readSpelledHost}, must hold no `*` as read (a full-width or small asterisk the
 * parser folds included) and must read back as itself; each caller words its own refusal from the problem.
 */
export declare function readHostPattern(spelled: string): {
    readonly pattern: HostPattern;
} | {
    readonly problem: HostPatternProblem;
};
/** A pattern as it is written back: the host, or `*.` and the domain. */
export declare function spelledHostPattern(pattern: HostPattern): string;
/** Does the pattern reach this host (as {@link hostOfUrl} reads it)? `host`: equal; `subdomain`: a name ending in `.<domain>` with
 *  at least one label before it and no empty label. */
export declare function hostPatternAdmits(pattern: HostPattern, host: string): boolean;
/** Why a URL names no host a rule can be judged on — the closed set the fetch tool maps to its own refusal sentences:
 *  not a string; not a URL; not http(s); credentials in it; a host that does not read back as itself once its trailing dots
 *  are read off (`https://2130706433../` — the parser keeps the name, the rule side reads `127.0.0.1`). */
export declare const HOST_UNREADABLE_REASONS: readonly ["not_text", "not_url", "not_http", "credentials", "unstable"];
export type HostUnreadableReason = (typeof HOST_UNREADABLE_REASONS)[number];
/** The host a URL names, or why it names none. */
export type HostReading = {
    readonly host: string;
} | {
    readonly unreadable: HostUnreadableReason;
};
/** The words a refusal states for each unreadable reason. */
export declare const HOST_UNREADABLE_SENTENCE: Readonly<Record<HostUnreadableReason, string>>;
/** THE call-side reading of a URL: the host it names (lower case, IDN in its ASCII form, trailing dots read off), or why it
 *  names none ({@link HostUnreadableReason}). */
export declare function hostOfUrl(value: unknown): HostReading;
/** Which reading a judge takes: `tighten` for a deny, an ask and the unreadable law; `grant` for an allow. */
export type HostReadingDirection = "tighten" | "grant";
/**
 * The host a call reaches as every host-rule judge reads it — the rule policy's host lane, a person's stored rows, the entry
 * lists, the approval card's offer — or undefined when the call has no URL slot in that direction:
 *  · `tighten` — the PROTECTIVE reading: the call face's own slot, else the catalog's slot under the first name the call
 *    answers to that declares one (a bare request, or a face that declares none). Borrowing a slot can only add a host to
 *    judge, so a deny or an ask keeps reaching a same-name tool;
 *  · `grant` — the DECLARED reading: the call face's own slot only. A tool that declares none (a caller's tool that merely took
 *    the fetch tool's name, a bare request) is not the tool the catalog describes, and no allow by host reaches it.
 * The slot's value is read by {@link hostOfUrl}; a value that names no host answers `{ unreadable }`, and each judge's law
 * says what that means for its direction.
 */
export declare function callHostTargetOf(call: ToolCallLike, direction: HostReadingDirection): HostReading | undefined;
