import { z } from "zod"; import { type AgentClass } from "./agent-class.js"; export declare const AGENT_NAME_PATTERN: RegExp; export declare const RegisterAgentSchema: z.ZodObject<{ name: z.ZodString; role: z.ZodString; capabilities: z.ZodArray; description: z.ZodOptional; terminal_title_ref: z.ZodOptional; host_shell_pids: z.ZodOptional>; host_id: z.ZodOptional; agent_token: z.ZodOptional; agent_pid: z.ZodOptional; agent_pid_start: z.ZodOptional; recovery_token: z.ZodOptional; managed: z.ZodDefault; cli_profile: z.ZodOptional; class: z.ZodOptional>; /** * v2.2.1 B2 → ADR-0012: request a CAS TAKEOVER of the name (NOT an * unconditional bypass). Default false → re-register on an actively-held name * returns NAME_COLLISION_ACTIVE. force=true is a CONDITIONAL takeover that * MUST carry `expected_session_id` (see below): the server performs an atomic * compare-and-swap on the row's session_id, so exactly one of two racing * relaunches wins and the loser is rejected — there is NO lost-update path. * Bare force=true (without expected_session_id) is rejected as malformed. */ force: z.ZodOptional>; /** * ADR-0012: CAS precondition for a force takeover. REQUIRED when force=true; * `null` is a valid EXPLICIT value meaning "I expect an offline row" * (CAS matches `session_id IS NULL`). Absent + force=true → malformed reject. */ expected_session_id: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; capabilities: string[]; role: string; managed: boolean; description?: string | undefined; terminal_title_ref?: string | undefined; host_shell_pids?: number[] | undefined; host_id?: string | undefined; agent_token?: string | undefined; agent_pid?: number | undefined; agent_pid_start?: string | undefined; recovery_token?: string | undefined; cli_profile?: string | undefined; class?: "orchestrator" | "builder" | "advisory" | "auditor" | "transient" | undefined; force?: boolean | undefined; expected_session_id?: string | null | undefined; }, { name: string; capabilities: string[]; role: string; description?: string | undefined; terminal_title_ref?: string | undefined; host_shell_pids?: number[] | undefined; host_id?: string | undefined; agent_token?: string | undefined; agent_pid?: number | undefined; agent_pid_start?: string | undefined; recovery_token?: string | undefined; managed?: boolean | undefined; cli_profile?: string | undefined; class?: "orchestrator" | "builder" | "advisory" | "auditor" | "transient" | undefined; force?: boolean | undefined; expected_session_id?: string | null | undefined; }>; export declare const DiscoverAgentsSchema: z.ZodObject<{ role: z.ZodOptional; view: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { view: "list" | "topology"; role?: string | undefined; agent_token?: string | undefined; }, { role?: string | undefined; agent_token?: string | undefined; view?: "list" | "topology" | undefined; }>; export declare const UnregisterAgentSchema: z.ZodObject<{ name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; agent_token?: string | undefined; }, { name: string; agent_token?: string | undefined; }>; /** * ADR-0005 (v2.22.0): self-serve cleanup of a BOTCHED (orphaned) registration — * a row that registered but whose caller lost the agent_token before ever * authenticating (e.g. a truncated curl capture). Authenticated by the * one-time, name-scoped `recovery_handle` returned at register (NOT the lost * agent_token), so it needs NO auth token (the handle is the proof). SAFE by * the keystone: it can ONLY remove a NEVER-authenticated row, so it can never * reach a working agent — that's what makes it a safe alternative to the * operator kill endpoint. A live agent that lost its token uses rotate/recover. */ export declare const AbandonRegistrationSchema: z.ZodObject<{ name: z.ZodString; recovery_handle: z.ZodString; }, "strip", z.ZodTypeAny, { name: string; recovery_handle: string; }, { name: string; recovery_handle: string; }>; export declare const SpawnAgentSchema: z.ZodObject<{ name: z.ZodString; role: z.ZodString; capabilities: z.ZodDefault>; cwd: z.ZodOptional>; initial_message: z.ZodOptional; brief_file_path: z.ZodOptional>; cli: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; capabilities: string[]; role: string; cli: string; agent_token?: string | undefined; cwd?: string | undefined; initial_message?: string | undefined; brief_file_path?: string | undefined; }, { name: string; role: string; capabilities?: string[] | undefined; agent_token?: string | undefined; cwd?: string | undefined; initial_message?: string | undefined; brief_file_path?: string | undefined; cli?: string | undefined; }>; export declare const SendMessageSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; content: z.ZodOptional>; message: z.ZodOptional>; priority: z.ZodDefault>; disposition: z.ZodDefault>; deadline: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: string; to: string; priority: "normal" | "high"; disposition: "log" | "ask" | "obligation"; message?: string | undefined; agent_token?: string | undefined; content?: string | undefined; deadline?: string | undefined; }, { from: string; to: string; message?: string | undefined; agent_token?: string | undefined; content?: string | undefined; priority?: "normal" | "high" | undefined; disposition?: "log" | "ask" | "obligation" | undefined; deadline?: string | undefined; }>; /** * ADR-0011 — the SENDER's outstanding-ask recap. Pull source of truth for * overdue drift: a fresh orchestrator session reconstructs what it is owed by * calling this, with zero reliance on a webhook it may not have heard. */ export declare const GetOutstandingSchema: z.ZodObject<{ agent_name: z.ZodString; include_resolved: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; include_resolved: boolean; agent_token?: string | undefined; }, { agent_name: string; agent_token?: string | undefined; include_resolved?: boolean | undefined; }>; export type GetOutstandingInput = z.infer; /** * v2.3.0 Part C.3 — peek_inbox_version. Cheap non-mutating observation * of the agent's mailbox. Pair with get_messages(since_seq=...) in a * later release for efficient cursor-based drain. */ export declare const PeekInboxVersionSchema: z.ZodObject<{ agent_name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; agent_token?: string | undefined; }, { agent_name: string; agent_token?: string | undefined; }>; export type PeekInboxVersionInput = z.infer; export declare const GetMessagesSchema: z.ZodObject<{ agent_name: z.ZodString; status: z.ZodDefault>; limit: z.ZodDefault; since: z.ZodDefault>>; /** * v2.12.0 — pending-vs-history. When true, permanently RESOLVE (ack) the * returned messages in the SAME transaction as the per-session read-mark, * so the next poll — even from a fresh terminal session — never re-floods * with already-handled mail. Only takes effect on status='pending' (the * drain path); browsing history never resolves. Default false ⇒ byte- * identical to pre-v2.12.0 behavior (the session-scoped handover re-surface * is preserved for UNfinished work). Use `resolve_messages` for partial * handling ("I did these, not those"). */ ack: z.ZodDefault>; /** * v2.2.2 BUG1 — when true, do NOT mark returned messages as read-by- * this-session. Repeated calls with `status='pending'` continue to * return the same rows until the caller either requests without * peek OR another session marks them read. Default false preserves * v2.0 consume-once semantics for single-shot workers. Intended for * orchestrators that survey their own inbox on a polling interval * without consuming it (the orchestrator get_messages pattern). */ peek: z.ZodDefault>; /** * v2.10 — capability-routed messaging lane filter. 'all' (default, back- * compat) returns every message; 'direct' returns only point-to-point * messages (routed_capability IS NULL — the action lane); 'capability' * returns only capability-routed FYI messages (routed_capability IS NOT * NULL). Lets an orchestrator drain the action lane separately from the * FYI lane so an action-required completion report is never lost in FYI noise. */ lane: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "pending" | "read" | "all" | "history" | "resolved"; agent_name: string; limit: number; since: string | null; ack: boolean; peek: boolean; lane: "all" | "direct" | "capability"; agent_token?: string | undefined; }, { agent_name: string; status?: "pending" | "read" | "all" | "history" | "resolved" | undefined; agent_token?: string | undefined; limit?: number | undefined; since?: string | null | undefined; ack?: boolean | undefined; peek?: boolean | undefined; lane?: "all" | "direct" | "capability" | undefined; }>; /** * v2.1.6: lightweight inbox preview. Same filter surface as GetMessages but * returns only message headers + a 100-char content_preview. Does NOT mark * messages read (pure observation). Intended for orchestrators or dashboards * that want to scan an inbox cheaply + call get_messages only for IDs they * want to expand. */ export declare const GetMessagesSummarySchema: z.ZodObject<{ agent_name: z.ZodString; status: z.ZodDefault>; limit: z.ZodDefault; since: z.ZodDefault>>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "pending" | "read" | "all" | "history" | "resolved"; agent_name: string; limit: number; since: string | null; agent_token?: string | undefined; }, { agent_name: string; status?: "pending" | "read" | "all" | "history" | "resolved" | undefined; agent_token?: string | undefined; limit?: number | undefined; since?: string | null | undefined; }>; /** * v2.12.0 — pending-vs-history. Explicitly RESOLVE (ack) specific messages so * they leave the cross-session pending queue permanently. Recipient-scoped: * the dispatcher binds the caller's token to `agent_name`, and the DB layer * additionally scopes the UPDATE by `to_agent = agent_name`, so an agent can * only resolve its OWN mail. Use this for partial handling; use * get_messages(ack=true) to resolve a whole drain in one call. */ export declare const ResolveMessagesSchema: z.ZodObject<{ agent_name: z.ZodString; message_ids: z.ZodArray; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; message_ids: string[]; agent_token?: string | undefined; }, { agent_name: string; message_ids: string[]; agent_token?: string | undefined; }>; export declare const BroadcastSchema: z.ZodObject<{ from: z.ZodString; content: z.ZodEffects; role: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: string; content: string; role?: string | undefined; agent_token?: string | undefined; }, { from: string; content: string; role?: string | undefined; agent_token?: string | undefined; }>; /** * v2.10 — capability-routed messaging (principle #1: capability routing over * named routing). The sender tags an FYI/coordination message by a single * domain/capability; the relay fans it out to the CURRENT owner(s) of that * capability (exact-string match against the agent_capabilities index — same * matching contract as post_task_auto). FYI/coordination lane ONLY — action- * required completions stay point-to-point completion reports via send_message. */ export declare const PostToCapabilitySchema: z.ZodObject<{ from: z.ZodString; capability: z.ZodString; content: z.ZodEffects; priority: z.ZodDefault>; exclude_self: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: string; content: string; priority: "normal" | "high"; capability: string; exclude_self: boolean; agent_token?: string | undefined; }, { from: string; content: string; capability: string; agent_token?: string | undefined; priority?: "normal" | "high" | undefined; exclude_self?: boolean | undefined; }>; export type PostToCapabilityInput = z.infer; export declare const PostTaskSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; title: z.ZodString; description: z.ZodEffects; priority: z.ZodDefault>; schema_id: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { description: string; from: string; to: string; priority: "normal" | "high" | "low" | "critical"; title: string; agent_token?: string | undefined; schema_id?: string | undefined; }, { description: string; from: string; to: string; title: string; agent_token?: string | undefined; priority?: "normal" | "high" | "low" | "critical" | undefined; schema_id?: string | undefined; }>; /** * v2.10 — register a reusable, immutable JSON Schema used to gate task * completion. The document is meta-validated + hardened (no $ref/$data) BEFORE * ajv compiles it. Registration is authz-restricted (a registered schema is * compiled). Re-registering an existing id is refused (immutability). */ export declare const RegisterTaskSchemaSchema: z.ZodObject<{ name: z.ZodString; json_schema: z.ZodRecord; agent_name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; agent_name: string; json_schema: Record; agent_token?: string | undefined; }, { name: string; agent_name: string; json_schema: Record; agent_token?: string | undefined; }>; export type RegisterTaskSchemaInput = z.infer; /** v2.10 — fetch a registered task schema so an assignee can see the required shape before completing. */ export declare const TaskSchemaGetSchema: z.ZodObject<{ name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; agent_token?: string | undefined; }, { name: string; agent_token?: string | undefined; }>; export type TaskSchemaGetInput = z.infer; /** * v2.1.3 (I6) — agent_status enum widened from (online | busy | away | offline) * to (idle | working | blocked | waiting_user | stale | offline). Legacy values * stay accepted on input and map to the new enum: * online → idle * busy → working * away → blocked * offline → offline (unchanged) * * `stale` is RESERVED for relay auto-transitions only (agents shouldn't * self-declare stale — it's an observation-layer signal). The Zod schema * accepts it in `AgentStatusEnum` for completeness of the read-side type, * but `SetStatusInputEnum` excludes it for writes. */ export declare const AgentStatusEnum: z.ZodEnum<["idle", "working", "blocked", "waiting_user", "stale", "offline", "abandoned", "closed", "unknown"]>; /** v2.1.3 — union accepted by set_status: new values + legacy aliases. */ export declare const SetStatusInputEnum: z.ZodEnum<["idle", "working", "blocked", "waiting_user", "offline", "online", "busy", "away"]>; export declare const SetStatusSchema: z.ZodObject<{ agent_name: z.ZodString; status: z.ZodEnum<["idle", "working", "blocked", "waiting_user", "offline", "online", "busy", "away"]>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "idle" | "working" | "blocked" | "waiting_user" | "offline" | "online" | "busy" | "away"; agent_name: string; agent_token?: string | undefined; }, { status: "idle" | "working" | "blocked" | "waiting_user" | "offline" | "online" | "busy" | "away"; agent_name: string; agent_token?: string | undefined; }>; /** * v2.15.0 — report_liveness: a NARROW, metadata-only presence self-report. The * agent (via its SessionStart / PostToolUse hook) restamps its OWN liveness * anchor (agent_pid + start-time) so an existing/old-registration session that * predates the anchor capture becomes probe-able WITHOUT a full re-register * (register_agent rotates session_id + can re-surface session-scoped reads — * this must not). Wraps ONLY setAgentLivenessAnchor (pid + start + fill-host- * if-null), touching neither session_id, last_seen, nor the read cursor. */ export declare const ReportLivenessSchema: z.ZodObject<{ agent_name: z.ZodString; agent_pid: z.ZodNumber; agent_pid_start: z.ZodOptional>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_pid: number; agent_name: string; agent_token?: string | undefined; agent_pid_start?: string | null | undefined; }, { agent_pid: number; agent_name: string; agent_token?: string | undefined; agent_pid_start?: string | null | undefined; }>; export type ReportLivenessInput = z.infer; export declare const HealthCheckSchema: z.ZodObject<{ agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_token?: string | undefined; }, { agent_token?: string | undefined; }>; /** * v2.1.4 (I12): server-side team-status synthesis for orchestrators. * * `since` accepts either a duration string (`"15m"`, `"1h"`, `"3h"`, `"1d"`) or * an ISO8601 timestamp. Duration shorthand mirrors common standup intervals; * ISO is the escape hatch for finer control. * * `filter` narrows the synthesis window. `include_offline` defaults false so * the default view is "who's currently active." Set true for post-mortems. * * This is a READ-ONLY tool. No mutations. No LLM. Observation bullets are * hand-rolled heuristics in the handler. */ export declare const GetStandupSchema: z.ZodObject<{ since: z.ZodString; filter: z.ZodOptional>; roles: z.ZodOptional>; include_offline: z.ZodDefault; }, "strip", z.ZodTypeAny, { include_offline: boolean; agents?: string[] | undefined; roles?: string[] | undefined; }, { agents?: string[] | undefined; roles?: string[] | undefined; include_offline?: boolean | undefined; }>>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { since: string; filter?: { include_offline: boolean; agents?: string[] | undefined; roles?: string[] | undefined; } | undefined; agent_token?: string | undefined; }, { since: string; filter?: { agents?: string[] | undefined; roles?: string[] | undefined; include_offline?: boolean | undefined; } | undefined; agent_token?: string | undefined; }>; export type GetStandupInput = z.infer; /** * v2.1.4 (I11): self-managed additive capability expansion. Closes the v1.7.1 * cap-immutability gap for agents that hook-registered with a narrow set and * later need more caps, without forcing full unregister + re-register. * * Semantics: caller presents their token (resolved from any of arg / header / * env as usual). `new_capabilities` MUST be a superset of the agent's current * caps. Reductions are rejected (REDUCTION_NOT_ALLOWED) — operator ceremony * preserved for the destructive path. No-ops are rejected explicitly * (NO_OP_EXPANSION) so callers don't accidentally double-submit. */ export declare const ExpandCapabilitiesSchema: z.ZodObject<{ agent_name: z.ZodString; new_capabilities: z.ZodArray; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; new_capabilities: string[]; agent_token?: string | undefined; }, { agent_name: string; new_capabilities: string[]; agent_token?: string | undefined; }>; export type ExpandCapabilitiesInput = z.infer; export declare const UpdateTaskSchema: z.ZodObject<{ task_id: z.ZodString; agent_name: z.ZodString; action: z.ZodEnum<["accept", "complete", "reject", "cancel", "heartbeat"]>; result: z.ZodEffects, string | undefined, string | undefined>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; task_id: string; action: "accept" | "complete" | "reject" | "cancel" | "heartbeat"; agent_token?: string | undefined; result?: string | undefined; }, { agent_name: string; task_id: string; action: "accept" | "complete" | "reject" | "cancel" | "heartbeat"; agent_token?: string | undefined; result?: string | undefined; }>; export declare const GetTasksSchema: z.ZodObject<{ agent_name: z.ZodString; role: z.ZodDefault>; status: z.ZodDefault>; limit: z.ZodDefault; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { role: "assigned" | "posted"; status: "all" | "posted" | "queued" | "accepted" | "completed" | "rejected" | "cancelled"; agent_name: string; limit: number; agent_token?: string | undefined; }, { agent_name: string; role?: "assigned" | "posted" | undefined; status?: "all" | "posted" | "queued" | "accepted" | "completed" | "rejected" | "cancelled" | undefined; agent_token?: string | undefined; limit?: number | undefined; }>; export declare const PostTaskAutoSchema: z.ZodObject<{ from: z.ZodString; title: z.ZodString; description: z.ZodEffects; required_capabilities: z.ZodArray; priority: z.ZodDefault>; allow_self_assign: z.ZodDefault; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { description: string; from: string; priority: "normal" | "high" | "low" | "critical"; title: string; required_capabilities: string[]; allow_self_assign: boolean; agent_token?: string | undefined; }, { description: string; from: string; title: string; required_capabilities: string[]; agent_token?: string | undefined; priority?: "normal" | "high" | "low" | "critical" | undefined; allow_self_assign?: boolean | undefined; }>; export declare const GetTaskSchema: z.ZodObject<{ task_id: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { task_id: string; agent_token?: string | undefined; }, { task_id: string; agent_token?: string | undefined; }>; export declare const RotateTokenSchema: z.ZodObject<{ agent_name: z.ZodString; agent_token: z.ZodOptional; grace_seconds: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; agent_token?: string | undefined; grace_seconds?: number | undefined; }, { agent_name: string; agent_token?: string | undefined; grace_seconds?: number | undefined; }>; export declare const RotateTokenAdminSchema: z.ZodObject<{ target_agent_name: z.ZodString; rotator_name: z.ZodString; grace_seconds: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { target_agent_name: string; rotator_name: string; agent_token?: string | undefined; grace_seconds?: number | undefined; }, { target_agent_name: string; rotator_name: string; agent_token?: string | undefined; grace_seconds?: number | undefined; }>; export declare const RevokeTokenSchema: z.ZodObject<{ target_agent_name: z.ZodString; revoker_name: z.ZodString; issue_recovery: z.ZodDefault; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { target_agent_name: string; revoker_name: string; issue_recovery: boolean; agent_token?: string | undefined; }, { target_agent_name: string; revoker_name: string; agent_token?: string | undefined; issue_recovery?: boolean | undefined; }>; export declare const CreateChannelSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional; creator: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; creator: string; description?: string | undefined; agent_token?: string | undefined; }, { name: string; creator: string; description?: string | undefined; agent_token?: string | undefined; }>; export declare const JoinChannelSchema: z.ZodObject<{ channel_name: z.ZodString; agent_name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; channel_name: string; agent_token?: string | undefined; }, { agent_name: string; channel_name: string; agent_token?: string | undefined; }>; export declare const LeaveChannelSchema: z.ZodObject<{ channel_name: z.ZodString; agent_name: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; channel_name: string; agent_token?: string | undefined; }, { agent_name: string; channel_name: string; agent_token?: string | undefined; }>; export declare const PostToChannelSchema: z.ZodObject<{ channel_name: z.ZodString; from: z.ZodString; content: z.ZodEffects; priority: z.ZodDefault>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: string; content: string; priority: "normal" | "high"; channel_name: string; agent_token?: string | undefined; }, { from: string; content: string; channel_name: string; agent_token?: string | undefined; priority?: "normal" | "high" | undefined; }>; export declare const GetChannelMessagesSchema: z.ZodObject<{ channel_name: z.ZodString; agent_name: z.ZodString; limit: z.ZodDefault; since: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_name: string; limit: number; channel_name: string; agent_token?: string | undefined; since?: string | undefined; }, { agent_name: string; channel_name: string; agent_token?: string | undefined; limit?: number | undefined; since?: string | undefined; }>; export declare const WebhookEventEnum: z.ZodEnum<["message.sent", "message.broadcast", "message.capability_routed", "task.posted", "task.accepted", "task.completed", "task.rejected", "task.cancelled", "task.auto_routed", "task.health_reassigned", "agent.unregistered", "agent.spawned", "agent.health_timeout", "channel.message_posted", "webhook.delivery_failed", "*"]>; export declare const RegisterWebhookSchema: z.ZodObject<{ url: z.ZodString; event: z.ZodEnum<["message.sent", "message.broadcast", "message.capability_routed", "task.posted", "task.accepted", "task.completed", "task.rejected", "task.cancelled", "task.auto_routed", "task.health_reassigned", "agent.unregistered", "agent.spawned", "agent.health_timeout", "channel.message_posted", "webhook.delivery_failed", "*"]>; filter: z.ZodOptional; secret: z.ZodOptional; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { url: string; event: "*" | "message.sent" | "message.broadcast" | "message.capability_routed" | "task.posted" | "task.accepted" | "task.completed" | "task.rejected" | "task.cancelled" | "task.auto_routed" | "task.health_reassigned" | "agent.unregistered" | "agent.spawned" | "agent.health_timeout" | "channel.message_posted" | "webhook.delivery_failed"; filter?: string | undefined; agent_token?: string | undefined; secret?: string | undefined; }, { url: string; event: "*" | "message.sent" | "message.broadcast" | "message.capability_routed" | "task.posted" | "task.accepted" | "task.completed" | "task.rejected" | "task.cancelled" | "task.auto_routed" | "task.health_reassigned" | "agent.unregistered" | "agent.spawned" | "agent.health_timeout" | "channel.message_posted" | "webhook.delivery_failed"; filter?: string | undefined; agent_token?: string | undefined; secret?: string | undefined; }>; export declare const ListWebhooksSchema: z.ZodObject<{ agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { agent_token?: string | undefined; }, { agent_token?: string | undefined; }>; export declare const DeleteWebhookSchema: z.ZodObject<{ webhook_id: z.ZodString; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { webhook_id: string; agent_token?: string | undefined; }, { webhook_id: string; agent_token?: string | undefined; }>; /** * v2.2.0: dashboard click-to-focus request body. Sent by the dashboard JS to * POST /api/focus-terminal. Validated at the HTTP layer before dispatching * to the platform focus driver. */ export declare const FocusTerminalSchema: z.ZodObject<{ agent_name: z.ZodString; }, "strip", z.ZodTypeAny, { agent_name: string; }, { agent_name: string; }>; export type FocusTerminalInput = z.infer; /** * v2.2.1 P2: dashboard inline-action request bodies. Each proxies to the * matching MCP tool (send_message / unregister_agent / set_status) but * is gated by the dashboard auth surface (dashboardAuthCheck + origin + * CSRF) instead of agent-level tokens. Rationale: the dashboard operator * is by definition trusted once they've authenticated with the dashboard * secret — they're running the relay. We don't layer additional * agent-token auth on top; that would require every dashboard user to * also have an admin-cap agent token, which defeats the "operator * dashboard" semantic. */ export declare const ApiSendMessageSchema: z.ZodEffects>; message: z.ZodOptional>; priority: z.ZodDefault>; /** * v2.2.2 A1 — Option (b) defense-in-depth. Optional: when present, the * server verifies against the from-agent's stored token_hash + the * audit-log entry records `from_authenticated: true`. When absent, the * v2.2.1 Option (a) audit-only model applies: dashboard-secret gate is * the only check + `from_authenticated: false` is recorded so incident * review can distinguish operator-impersonation from token-verified * sends. Also acceptable via `X-From-Agent-Token` header. */ from_agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: string; to: string; priority: "normal" | "high"; message?: string | undefined; content?: string | undefined; from_agent_token?: string | undefined; }, { from: string; to: string; message?: string | undefined; content?: string | undefined; priority?: "normal" | "high" | undefined; from_agent_token?: string | undefined; }>, { content: string; from: string; to: string; priority: "normal" | "high"; from_agent_token?: string | undefined; }, { from: string; to: string; message?: string | undefined; content?: string | undefined; priority?: "normal" | "high" | undefined; from_agent_token?: string | undefined; }>; export type ApiSendMessageInput = z.infer; export declare const ApiKillAgentSchema: z.ZodObject<{ name: z.ZodString; }, "strip", z.ZodTypeAny, { name: string; }, { name: string; }>; export type ApiKillAgentInput = z.infer; /** * v2.3.0 Part C.5 — dashboard wake-agent inline-action endpoint. * POST /api/wake-agent {agent_name}. Touches the filesystem marker * (when RELAY_FILESYSTEM_MARKERS=1) so a client watching that path * receives a low-latency wake signal. */ export declare const ApiWakeAgentSchema: z.ZodObject<{ agent_name: z.ZodString; }, "strip", z.ZodTypeAny, { agent_name: string; }, { agent_name: string; }>; export type ApiWakeAgentInput = z.infer; export declare const ApiSetStatusSchema: z.ZodObject<{ agent_name: z.ZodString; agent_status: z.ZodEnum<["idle", "working", "blocked", "waiting_user", "offline"]>; }, "strip", z.ZodTypeAny, { agent_name: string; agent_status: "idle" | "working" | "blocked" | "waiting_user" | "offline"; }, { agent_name: string; agent_status: "idle" | "working" | "blocked" | "waiting_user" | "offline"; }>; export type ApiSetStatusInput = z.infer; export declare const CustomThemeSchema: z.ZodObject<{ bg: z.ZodEffects; panel: z.ZodEffects; "panel-2": z.ZodEffects; border: z.ZodEffects; text: z.ZodEffects; muted: z.ZodEffects; accent: z.ZodEffects; online: z.ZodEffects; stale: z.ZodEffects; offline: z.ZodEffects; critical: z.ZodEffects; high: z.ZodEffects; normal: z.ZodEffects; low: z.ZodEffects; }, "strip", z.ZodTypeAny, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }>; export type CustomTheme = z.infer; export declare const SetDashboardThemeSchema: z.ZodEffects; custom_json: z.ZodOptional; panel: z.ZodEffects; "panel-2": z.ZodEffects; border: z.ZodEffects; text: z.ZodEffects; muted: z.ZodEffects; accent: z.ZodEffects; online: z.ZodEffects; stale: z.ZodEffects; offline: z.ZodEffects; critical: z.ZodEffects; high: z.ZodEffects; normal: z.ZodEffects; low: z.ZodEffects; }, "strip", z.ZodTypeAny, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }>>; agent_token: z.ZodOptional; }, "strip", z.ZodTypeAny, { mode: "catppuccin" | "dark" | "light" | "custom"; agent_token?: string | undefined; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }, { mode: "catppuccin" | "dark" | "light" | "custom"; agent_token?: string | undefined; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }>, { mode: "catppuccin" | "dark" | "light" | "custom"; agent_token?: string | undefined; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }, { mode: "catppuccin" | "dark" | "light" | "custom"; agent_token?: string | undefined; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }>; export type SetDashboardThemeInput = z.infer; /** * v2.2.2 B1 — same shape as SetDashboardThemeSchema but without the MCP * agent_token field (the dashboard POST endpoint is gated by * dashboardAuthCheck + originCheck + csrfCheck, not by agent auth). */ export declare const ApiDashboardThemeSchema: z.ZodEffects; custom_json: z.ZodOptional; panel: z.ZodEffects; "panel-2": z.ZodEffects; border: z.ZodEffects; text: z.ZodEffects; muted: z.ZodEffects; accent: z.ZodEffects; online: z.ZodEffects; stale: z.ZodEffects; offline: z.ZodEffects; critical: z.ZodEffects; high: z.ZodEffects; normal: z.ZodEffects; low: z.ZodEffects; }, "strip", z.ZodTypeAny, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }, { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; }>>; }, "strip", z.ZodTypeAny, { mode: "catppuccin" | "dark" | "light" | "custom"; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }, { mode: "catppuccin" | "dark" | "light" | "custom"; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }>, { mode: "catppuccin" | "dark" | "light" | "custom"; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }, { mode: "catppuccin" | "dark" | "light" | "custom"; custom_json?: { stale: string; normal: string; high: string; low: string; critical: string; offline: string; online: string; bg: string; panel: string; "panel-2": string; border: string; text: string; muted: string; accent: string; } | undefined; }>; export type ApiDashboardThemeInput = z.infer; export type RegisterAgentInput = z.infer; export type DiscoverAgentsInput = z.infer; export type UnregisterAgentInput = z.infer; export type AbandonRegistrationInput = z.infer; export type SpawnAgentInput = z.infer; export type SendMessageInput = z.infer; export type GetMessagesInput = z.infer; export type GetMessagesSummaryInput = z.infer; export type ResolveMessagesInput = z.infer; export type BroadcastInput = z.infer; export type PostTaskInput = z.infer; export type PostTaskAutoInput = z.infer; export type UpdateTaskInput = z.infer; export type GetTasksInput = z.infer; export type GetTaskInput = z.infer; export type RegisterWebhookInput = z.infer; export type ListWebhooksInput = z.infer; export type DeleteWebhookInput = z.infer; export type WebhookEvent = z.infer; export type SetStatusInput = z.infer; export type HealthCheckInput = z.infer; export type CreateChannelInput = z.infer; export type JoinChannelInput = z.infer; export type LeaveChannelInput = z.infer; export type PostToChannelInput = z.infer; export type GetChannelMessagesInput = z.infer; export type RotateTokenInput = z.infer; export type RotateTokenAdminInput = z.infer; export type RevokeTokenInput = z.infer; /** * v2.1 Phase 4b.1 v2: explicit auth-state machine. Replaces the v1 * `token_hash IS NULL` overload (which conflated "pre-v1.7 legacy migration" * with "admin-revoked"). Transitions are CAS-gated at each write site. * * - active normal agent, token_hash set, auth via token verify * - legacy_bootstrap pre-v1.7 row (token_hash IS NULL), one-shot migration * via plain register_agent mint * - revoked terminal; admin must unregister_agent + fresh register * to re-use the name. token_hash preserved for forensics. * - recovery_pending admin issued a one-time recovery_token; target * re-registers with it to transition back to active */ export type AgentAuthState = "active" | "legacy_bootstrap" | "revoked" | "recovery_pending" /** v2.1 Phase 4b.2: managed agent is mid-rotation. Old token_hash lives in `previous_token_hash`, new in `token_hash`, both valid until `rotation_grace_expires_at`. */ | "rotation_grace"; export interface AgentRecord { id: string; name: string; role: string; capabilities: string; last_seen: string; created_at: string; token_hash: string | null; /** v2.0 final: session_id rotates on every register_agent call (session-aware read receipts). */ session_id?: string | null; /** v2.0 final: agent-set status (online/busy/away/offline). Default "online". Controlled by set_status + heartbeat. */ agent_status?: string | null; /** v2.0 final: optional human-readable description. Shown in discover_agents + dashboard. */ description?: string | null; /** v2.1 Phase 4b.1 v2: auth-state machine (see AgentAuthState). */ auth_state?: AgentAuthState; /** v2.1 Phase 4b.1 v2: ISO timestamp of the most recent revoke_token call against this row. */ revoked_at?: string | null; /** v2.1 Phase 4b.1 v2: bcrypt hash of admin-issued recovery secret. Populated iff state=recovery_pending. */ recovery_token_hash?: string | null; /** v2.1 Phase 4b.2: true = Managed Agent wrapper (can self-update from push-token messages). Immutable after first register (same as capabilities). */ managed?: number; /** ADR-0002 (schema v21): self-declared coarse coordination posture (SSOT src/agent-class.ts). NULL on legacy rows → normalized to `unclassified` on read. Immutable after first register. */ class?: string | null; /** Phase A (schema v22): relay build that SERVED this row's last register. Stdio servers are spawned per session from dist and run that build for life, so a machine routinely runs several versions at once — and until this column there was no way to ask a stdio server which one it was. */ server_version?: string | null; /** Phase A (schema v22): which agent-CLI this row registered through, validated against the profile registry. NULL = UNKNOWN and is never asked for a session-start verdict. */ cli_profile?: string | null; /** v2.1 Phase 4b.2: ISO timestamp of rotation grace window expiry. Populated iff state=rotation_grace. */ rotation_grace_expires_at?: string | null; /** v2.1 Phase 4b.2: bcrypt hash of pre-rotation token. Populated iff state=rotation_grace; allows the old token to auth alongside the new token during the grace window. */ previous_token_hash?: string | null; /** ADR-0003 (schema v20): HMAC-SHA256 lookup digest of the CURRENT token — an indexed O(1) locator, NEVER an auth decision (bcrypt on token_hash stays the verifier). NULL on legacy rows until the token is next minted/rotated or lazily self-healed on the O(N) fallback path. */ token_lookup?: string | null; /** ADR-0003 (schema v20): lookup digest of the PREVIOUS token; populated only during rotation_grace (mirrors previous_token_hash). NULL otherwise. */ previous_token_lookup?: string | null; /** ADR-0005 (schema v22): ISO timestamp of the agent's FIRST successful token auth. NULL = NEVER authenticated = an orphan — the abandon_registration + orphan-GC keystone. */ first_authed_at?: string | null; established_at?: string | null; /** ADR-0005 (schema v22): bcrypt hash of the one-time, name-scoped registration-recovery handle (self-serve orphan cleanup). NULL after redemption / first auth. */ registration_recovery_hash?: string | null; /** ADR-0005 (schema v22): TTL for the registration-recovery handle. */ registration_recovery_expires_at?: string | null; /** v2.1.6: ISO timestamp of the agent's current session start (last register_agent). NULL on rows registered before v2.1.6. */ session_started_at?: string | null; /** v2.2.0: window title the agent's terminal was spawned with. Used by the dashboard's click-to-focus driver. NULL on rows spawned before v2.2.0 or rows that did not thread the value through the register call. */ terminal_title_ref?: string | null; /** Tether v0.3 PID-handshake (schema v16): JSON-stringified number[] — the agent's process-ancestry PID chain. NULL on rows registered before v16 / agents that don't report it. Mutable on re-register (overwrites). */ host_shell_pids?: string | null; /** Tether v0.3 PID-handshake (schema v16): stable OS machine GUID, host-scopes the PID match. NULL on legacy rows. Immutable after first registration. */ host_id?: string | null; /** v2.13.0 (schema v18): ISO timestamp of the most recent POSITIVE liveness confirmation (same-host PID probe / future heartbeat). NULL = no liveness signal → verdict is unknown (age-based derivation retired in v2.19.0). Distinct from last_seen (activity). */ last_alive?: string | null; /** v2.13.0 (schema v18): the agent's OWN process id (claude/codex CLI), identified by the stdio server's ancestry walk or self-reported on register. The process the same-host liveness probe checks — NOT the host_shell_pids chain. NULL = no anchor → verdict unknown unless the agent advertises RELAY_AGENT_NAME in its argv (v2.19.0). */ agent_pid?: number | null; /** v2.13.0 (schema v18): start-time token of `agent_pid` (PID-reuse guard). A recycled PID with a different start-time reads dead. */ agent_pid_start?: string | null; } export interface AgentWithStatus extends Omit { capabilities: string[]; /** Coarse presence, derived from the liveness VERDICT (v2.19.0 — NOT from * last_seen age, which lied) — alive→online, dead→offline, unknown→unknown. * A live agent NEVER reads offline; last_seen is pure telemetry. */ status: "online" | "offline" | "unknown"; /** ADR-0002: normalized coordination posture (NULL/unknown → "unclassified"). Surfaced through the projection so discover_agents view='topology' can group on it. */ class: AgentClass; /** v1.7: whether the agent has a token (false = legacy pre-v1.7 agent) */ has_token: boolean; /** * v2.0 final: agent-controlled operational status (different from presence). * v2.1.3 (I6): enum widened — idle (default active), working, blocked, * waiting_user, stale (relay-computed from last_seen), offline. The value * surfaced here is the HYBRID: relay overrides a stored active-state * (idle/working/blocked/waiting_user) with 'stale' at 5 min + 'offline' at * 30 min of last_seen silence. */ agent_status: "idle" | "working" | "blocked" | "waiting_user" | "stale" | "offline" | "abandoned" | "closed" | "unknown"; /** v2.0 final: optional description. */ description: string | null; /** v2.0 final: current session_id (UUID, rotates on re-register). */ session_id: string | null; /** v2.2.0: window title the agent's terminal was spawned with (NULL if legacy). */ terminal_title_ref: string | null; /** Tether v0.3 PID-handshake: the agent's process-ancestry PID chain, PARSED to number[] (NULL if not reported). Tether intersects this with terminal.processId — host-scoped by host_id — to bind a terminal to this agent. */ host_shell_pids: number[] | null; /** Tether v0.3 PID-handshake: stable OS machine GUID that host-scopes the PID match (NULL if not reported). */ host_id: string | null; /** * v2.15.0 — presence liveness, the FIELD OF RECORD. `alive` = the process is * confirmed up (same-host agent_pid probe). `dead` = a POSITIVE dead signal * (agent_pid present, process confirmed gone / PID reused). `unknown` = no * probe-able anchor (agent_pid absent) or cross-host — the honest "we don't * know", NEVER death. Any dead-vs-unknown decision (close/relaunch/purge/ * rotate) MUST key on this field, never on `alive`/`status`. */ liveness: "alive" | "dead" | "unknown"; /** * v2.15.0 — informational ISO timestamp of the most recent positive liveness * confirmation (computed in-memory; null when the current verdict isn't a * fresh alive). Distinct from last_seen (activity). */ last_alive: string | null; /** * v2.13.0 — lossy back-compat convenience bool: "awake + available right now?" * = liveness==='alive' AND an active agent_status (so a declared-offline live * process reads false). `alive===false` means "not confirmed alive", NOT * "dead" — use `liveness` to distinguish dead from unknown. */ alive: boolean; /** * audit HIGH #2 — session-actionability, the SAME predicate `post_task_auto` * enforces (a live session + non-terminal status), surfaced so the operator * reads what the router uses (ADR-0015 L4). `routable` is the boolean; * `routability` is the one named state — `unroutable_alive` is the loud * diagnostic: a live process the router will silently never give work. */ routable: boolean; routability: "routable" | "unroutable_alive" | "unroutable_offline"; } export interface MessageRecord { id: string; from_agent: string; to_agent: string; content: string; priority: string; status: string; created_at: string; /** v2.0 final: session that read this message. Null = unread. Used for session-aware read receipts (#6). */ read_by_session?: string | null; /** * v2.3.0 Part C — per-recipient monotonic sequence assigned at first * observation. Null until the recipient reads the message for the * first time. Stable across later reads. */ seq?: number | null; /** * v2.3.0 Part C — mailbox epoch snapshotted on first observation * (same code path as `seq` above — src/db.ts:3181-3199, inside the * recipient's get_messages drain). NOT at send and NOT at delivery. * Lets the recipient detect a backup/restore vs. a genuine new * message. */ epoch?: string | null; /** * v2.10 — capability-routed messaging (FYI/coordination lane). NULL for * every point-to-point send_message / broadcast row (the action lane). * Non-NULL = this row was fanned out to the owner(s) of this capability * via post_to_capability. Makes the action-vs-FYI line machine- * distinguishable so an FYI is never mistaken for an action-required * completion report. */ routed_capability?: string | null; /** * v2.12.0 — pending-vs-history. ISO timestamp set when the recipient * permanently RESOLVED (acked) this message; NULL = unresolved. Session- * INDEPENDENT, orthogonal to `read_by_session`: read is a per-session * observation, resolved is a permanent "handled, archive it." The * `pending` filter excludes resolved rows so already-handled mail never * re-floods a fresh session. */ resolved_at?: string | null; /** * ADR-0011 (v2.23.0) — message disposition: 'log' (default) | 'ask' | * 'obligation'. LOG never goes overdue; only an explicit ask/obligation is * ever reported outstanding/overdue. Every pre-v24 row is backfilled to 'log' * by the migration DEFAULT, so an upgrade never manufactures overdue mail. */ disposition?: string; /** * ADR-0011 — optional ISO deadline for an OBLIGATION. NULL for log/ask (an * ask past the config bound is overdue; an obligation is overdue past its * deadline, or past the config bound if it declared none). */ deadline?: string | null; /** * ADR-0011 — the SENDER's sticky, AGENT-LEVEL read receipt: ISO timestamp set * WRITE-ONCE the first time ANY recipient session drains the message through * get_messages, and NEVER cleared (monotonic). ORTHOGONAL to `read_by_session` * above (per-session, re-pends for a fresh session). NULL = not yet read via * the normal MCP path — note a direct-DB/CLI read does NOT stamp it (the * receipt means "read via the MCP path," not "seen by any means"). */ read_at?: string | null; } export interface TaskRecord { id: string; from_agent: string; /** May be null for queued (not-yet-routed) tasks. */ to_agent: string | null; title: string; description: string; priority: string; status: string; result: string | null; created_at: string; updated_at: string; /** v2.0 beta: ISO timestamp of last lease renewal by the assigned agent. Null when status != 'accepted' or on legacy tasks. */ lease_renewed_at?: string | null; /** v2.0 beta: JSON-array string of capabilities required for auto-routing. Null for tasks posted via legacy post_task. */ required_capabilities?: string | null; /** v2.10: id of the registered task_schema gating this task's completion. Null = un-gated (completes exactly as today). */ schema_id?: string | null; } export interface WebhookRecord { id: string; url: string; event: string; filter: string | null; secret: string | null; created_at: string; } export interface WebhookDeliveryRecord { id: string; webhook_id: string; event: string; payload: string; status_code: number | null; error: string | null; attempted_at: string; } export type TaskStatus = "queued" | "posted" | "accepted" | "completed" | "rejected" | "cancelled"; export type TaskAction = "accept" | "complete" | "reject" | "cancel" | "heartbeat"; export declare const VALID_TRANSITIONS: Record; export declare const ACTION_TO_STATUS: Partial>; //# sourceMappingURL=types.d.ts.map