/**
 * The engine's own classification of every inbound RPC record (senpi#4319).
 *
 * A client that speaks for someone other than the local user (a forwarder, a remote viewer, an automation) needs
 * to know which records it may accept from that someone. A list kept outside the engine drifts the moment a method
 * lands, so the table lives here and is exhaustive at compile time: it `satisfies` a mapped type over
 * `RpcInboundRecord["type"]`, so a record type added without a class fails the typecheck. An entry is a class, or a
 * versioned rule (a pure function of the record) when the class depends on its fields. The engine only classifies;
 * it does not gate its own local connections with this table.
 *
 * Classes, least to most dangerous:
 * - `observe`: side-effect-free reads.
 * - `drive`: runs, steers or edits the current session (prompts, queue and user-message edits, session-scoped
 *   settings; a setter that writes the device-wide settings file is `device_admin`). A prompt that can run a slash command is
 *   `device_admin`: extension command handlers run with the same unbounded context as `extension_request`.
 * - `answer`: replies to a question or dialog the engine asked. The engine's permission prompts are such dialogs, so
 *   a caller granted `answer` can approve what `device_admin` would otherwise gate: never treat it as harmless.
 * - `thread`: creates, opens, attaches, forks or closes sessions by id. A record that names a host path (a session
 *   file, a cwd, an import source, a parent session), a permission preset, or the environment of the session's tool
 *   subprocesses is `device_admin`: it reads or writes host files, or changes what the agent may do without asking.
 * - `device_admin`: acts on the device outside the agent's own permission flow (direct shell, filesystem writes and
 *   probes, credentials, device-wide settings, extension reloads, forged session entries: an assistant reply or custom message the engine did not produce, whether
 *   appended, sent or edited in). A remote caller reaches it
 *   only when it is a caller granted the class.
 * - `connection_local`: configures or tears down the caller's own connection or host ownership; meaningful only to
 *   the connection that sends it, so it is never permitted on someone else's behalf.
 *
 * At runtime a record the table does not classify (unknown type, non-string type, not an object) is treated as more
 * dangerous than every class: `rpcMethodPermitted` refuses it whatever is granted.
 */
import type { RpcInboundRecord } from "./rpc-host-command-types.ts";
export type RpcMethodClass = "observe" | "drive" | "answer" | "thread" | "device_admin" | "connection_local";
export type RpcMethodType = RpcInboundRecord["type"];
export type RpcInboundRecordOf<K extends RpcMethodType> = Extract<RpcInboundRecord, {
    type: K;
}>;
/** Bumped when the meaning of a class changes; a reassignment changes only the digest. */
export declare const RPC_METHOD_CLASSES_VERSION = 1;
/** How the table description names an entry whose class depends on the record. */
declare const DYNAMIC = "dynamic";
/**
 * A user-authored message entry drives the session; any other entry is a forged record of engine work, the same class as
 * `edit_assistant_message` and `send_custom_message`, which write that record by another route.
 */
declare function appendEntryClass(record: object): RpcMethodClass;
/**
 * Opening by id is a thread operation; naming a session file, a cwd, a permission preset, a browser engine (the
 * user's own signed-in browser) or an environment for the session's tool subprocesses (`env`, version 2) acts on
 * the device.
 */
declare function openSessionClass(record: object): RpcMethodClass;
/** `scope: "turn"` changes only this turn; any other scope remembers the model's level device-wide. */
declare function thinkingLevelClass(record: object): RpcMethodClass;
/** `scope: "session"` switches only this session's model; any other scope persists the device's default model. */
declare function setModelClass(record: object): RpcMethodClass;
/** An effect looked up by session id is a read; one looked up in a named session file opens a host path. */
declare function effectStatusClass(record: object): RpcMethodClass;
/**
 * Prompt text is `drive`; text that can dispatch a registered slash command is `device_admin`, because the handler runs
 * with a full command context (`/mcp` writes the MCP config and starts servers, `/account` edits credentials, `/ir`
 * reads any host path). Mirrors the session's own dispatch check: templates expand unless `expandPromptTemplates` is exactly
 * `false`, and the raw message starts with `/`. Whether the command exists is left to the session, so an unregistered
 * name is not a reason to answer lower; a message that is not a string cannot be judged.
 */
declare function promptClass(record: object): RpcMethodClass;
/**
 * `steer`/`follow_up` with `whenIdle: "start"` take the prompt path, which expands commands (with no template option);
 * the queue path refuses registered commands. So a turn-starting message that is not a string or starts with `/` is
 * `device_admin`, like `prompt`; anything else is `drive`.
 */
declare function idleStartClass(record: object): RpcMethodClass;
/** A new session is a thread operation; naming a parent session file reads a host path. */
declare function newSessionClass(record: object): RpcMethodClass;
export declare const RPC_METHOD_CLASS: {
    readonly get_protocol_info: "observe";
    readonly get_subscription_limits: "observe";
    readonly list_sessions: "observe";
    readonly list_hands: "observe";
    readonly get_state: "observe";
    readonly get_snapshot: "observe";
    readonly get_entries: "observe";
    readonly get_messages: "observe";
    readonly get_tree: "observe";
    readonly get_fork_messages: "observe";
    readonly get_last_assistant_text: "observe";
    readonly get_session_stats: "observe";
    readonly get_effect_status: {
        readonly classify: typeof effectStatusClass;
        readonly version: 1;
    };
    readonly get_pending_inputs: "observe";
    readonly get_follow_up_messages: "observe";
    readonly get_steering_messages: "observe";
    readonly get_commands: "observe";
    readonly get_loaded_surfaces: "observe";
    readonly get_project_trust: "observe";
    readonly get_available_models: "observe";
    readonly get_available_thinking_levels: "observe";
    readonly get_model_thinking_level: "observe";
    readonly get_fast_mode: "observe";
    readonly get_media: "observe";
    readonly memory_report: "observe";
    readonly "eval_cells.list": "observe";
    readonly "eval_cells.peek": "observe";
    readonly prompt: {
        readonly classify: typeof promptClass;
        readonly version: 1;
    };
    readonly steer: {
        readonly classify: typeof idleStartClass;
        readonly version: 1;
    };
    readonly follow_up: {
        readonly classify: typeof idleStartClass;
        readonly version: 1;
    };
    readonly abort: "drive";
    readonly interrupt: "drive";
    readonly abort_retry: "drive";
    readonly abort_compaction: "drive";
    readonly abort_branch_summary: "drive";
    readonly compact: "drive";
    readonly clear_queue: "drive";
    readonly dequeue_message: "drive";
    readonly edit_queued_message: "drive";
    readonly hold_input: "drive";
    readonly withdraw_held_input: "drive";
    readonly append_user_message: "drive";
    readonly edit_user_message: "drive";
    readonly continue_from_leaf: "drive";
    readonly navigate_tree: "drive";
    readonly set_label: "drive";
    readonly set_session_name: "drive";
    readonly set_session_archived: "drive";
    readonly set_session_settled: "drive";
    readonly set_thinking_level: {
        readonly classify: typeof thinkingLevelClass;
        readonly version: 1;
    };
    readonly set_model: {
        readonly classify: typeof setModelClass;
        readonly version: 1;
    };
    readonly set_auto_compaction: "drive";
    readonly set_permission_preset: "device_admin";
    readonly set_retry_fallback: "drive";
    readonly pause_for_run: "drive";
    readonly resume_for_run: "drive";
    readonly wake: "drive";
    readonly admit_external_message: "drive";
    readonly release_tool_barrier: "drive";
    readonly request_self_settle: "drive";
    readonly "eval_cells.stop": "drive";
    readonly append_session_entry: {
        readonly classify: typeof appendEntryClass;
        readonly version: 1;
    };
    readonly extension_ui_response: "answer";
    readonly extension_ui_progress: "answer";
    readonly new_session: {
        readonly classify: typeof newSessionClass;
        readonly version: 1;
    };
    readonly open_session: {
        readonly classify: typeof openSessionClass;
        readonly version: 2;
    };
    readonly claim_session: "device_admin";
    readonly park_session: "device_admin";
    readonly resume_session: "thread";
    readonly fork: "thread";
    readonly clone: "thread";
    readonly close_session: "thread";
    readonly unload_session: "thread";
    readonly set_session_context: "thread";
    readonly attach_session: "thread";
    readonly select_hand: "device_admin";
    readonly bash: "device_admin";
    readonly abort_bash: "device_admin";
    readonly record_bash_result: "device_admin";
    readonly cleanup_bash_output: "device_admin";
    readonly extension_request: "device_admin";
    readonly reload: "device_admin";
    readonly check_reload_veto: "device_admin";
    readonly resolve_path: "device_admin";
    readonly find_session: "device_admin";
    readonly login_start: "device_admin";
    readonly login_cancel: "device_admin";
    readonly login_api_key: "device_admin";
    readonly logout: "device_admin";
    readonly verify_api_key: "device_admin";
    readonly get_auth_providers: "device_admin";
    readonly get_provider_accounts: "device_admin";
    readonly account_order: "device_admin";
    readonly account_pin: "device_admin";
    readonly account_remove: "device_admin";
    readonly account_reset: "device_admin";
    readonly test_provider_account: "device_admin";
    readonly set_favorite_models: "device_admin";
    readonly set_scoped_models: "device_admin";
    readonly cycle_model: "device_admin";
    readonly cycle_thinking_level: "device_admin";
    readonly set_fast_mode: "device_admin";
    readonly set_steering_mode: "device_admin";
    readonly set_follow_up_mode: "device_admin";
    readonly set_auto_retry: "device_admin";
    readonly set_project_trust: "device_admin";
    readonly get_project_settings: "device_admin";
    readonly set_project_setting: "device_admin";
    readonly read_project_file: "device_admin";
    readonly write_project_file: "device_admin";
    readonly get_project_mcp_servers: "device_admin";
    readonly set_project_mcp_servers: "device_admin";
    readonly read_project_skill_file: "device_admin";
    readonly write_project_skill_file: "device_admin";
    readonly read_user_skill_file: "device_admin";
    readonly write_user_skill_file: "device_admin";
    readonly edit_assistant_message: "device_admin";
    readonly send_custom_message: "device_admin";
    readonly switch_session: "device_admin";
    readonly import_jsonl: "device_admin";
    readonly export_html: "device_admin";
    readonly export_jsonl: "device_admin";
    readonly set_client_info: "connection_local";
    readonly subscribe_sessions: "connection_local";
    readonly unsubscribe_sessions: "connection_local";
    readonly record_user_activity: "connection_local";
    readonly detach_connection: "connection_local";
    readonly release_session: "connection_local";
    readonly warm: "connection_local";
    readonly host_response: "connection_local";
    readonly release_attachment: "connection_local";
    readonly reclaim_session: "connection_local";
    readonly move_session: "connection_local";
    readonly get_recovery_page: "connection_local";
    readonly release_recovery: "connection_local";
    readonly cancel_attempt: "connection_local";
    readonly reset_stream: "connection_local";
};
/**
 * The class of an inbound record, or `undefined` when the engine cannot classify it: not a plain object, a
 * non-string `type`, a type the table does not own (own keys only, never the prototype's), or a record whose rule
 * throws (a hostile getter or proxy): a rule that cannot decide refuses.
 */
export declare function classifyRpcMethod(record: unknown): RpcMethodClass | undefined;
/**
 * Whether a caller granted `granted` may send `record`. Fails closed: an unclassified record is refused whatever is
 * granted, `connection_local` is never permitted, and every other class only when the caller is granted that class.
 */
export declare function rpcMethodPermitted(record: unknown, granted: ReadonlySet<RpcMethodClass>): boolean;
export type RpcMethodClassDescription = RpcMethodClass | typeof DYNAMIC;
/** Every entry as a class, or `dynamic` for a record-dependent entry, and the version of each `dynamic` entry. */
export interface RpcMethodClassesDescription {
    readonly version: typeof RPC_METHOD_CLASSES_VERSION;
    readonly digest: string;
    readonly classes: Readonly<Record<RpcMethodType, RpcMethodClassDescription>>;
    readonly dynamic_versions: Readonly<Partial<Record<RpcMethodType, number>>>;
}
/**
 * sha256 (hex) of the sorted `type=value\n` lines, where `value` is the class, or `dynamic@<version>` for a
 * record-dependent entry.
 */
export declare function rpcMethodClassesDigest(table: Readonly<Record<string, string>>): string;
export declare const RPC_METHOD_CLASSES_DIGEST: string;
/** The whole table as data: what a client compares against its own copy. */
export declare function describeRpcMethodClasses(): RpcMethodClassesDescription;
export {};
//# sourceMappingURL=method-classes.d.ts.map