/** * Who may start a chat with an organization's agent, read and changed through * the same Relay Console routes the Console's own "Available to" field and its * Always Allow and Never Allow lists use (Relay-Console apps/api/src/routes/ * agents.ts: PATCH /orgs/:orgId/agents/:id with people_can_message and * agents_can_message; GET, PUT and DELETE /orgs/:orgId/agents/:id/access). * Relay Server decides every chat (relationships.ts agentReach): people in * the agent's organization and its organization's agents always get through, * then Never Allow, then Always Allow, then the two settings. Private and * Open are names for two combinations of those settings, not a server mode: * the words follow `gh repo edit --visibility private` and the Console's * default ("open, like a Discord or Telegram bot"); "public" already means * listed in the directory (Relay Server's AgentVisibility). */ /** Relay Server's values for "Other agents" (migration 0090, AGENTS_CAN_MESSAGE). */ export declare const AGENTS_CAN_MESSAGE: readonly ["everyone", "nobody"]; export type AgentsCanMessage = (typeof AGENTS_CAN_MESSAGE)[number]; /** `allow` is Always Allow; `deny` is Never Allow (Relay Server's AccessRule). */ export type AccessRule = "allow" | "deny"; /** The Console's request, already signed in with the saved Console session. */ export type ConsoleRequest = (path: string, init?: RequestInit) => Promise; /** One row of a list: who it is, and nothing the command does not use. */ export interface AccessContact { handle: string; display_name: string; kind: "user" | "agent" | null; } /** The handle the way the Console's handle field reads it: no "@", trimmed, lowercase. */ export declare const accessHandle: (raw: string) => string; /** "on" or "off", the switch "People in the Relay app" in Relay Console. */ export declare const peopleSwitch: (value: string) => boolean; /** The organization and the agent's Console id for a handle the organization owns. */ export declare const findAgent: (request: ConsoleRequest, handle: string) => Promise<{ path: string; }>; /** The two settings each named combination sets. */ export declare const REACH_PRESETS: { readonly private: { readonly people: false; readonly agents: "nobody"; }; readonly open: { readonly people: true; readonly agents: "everyone"; }; }; export type ReachPreset = keyof typeof REACH_PRESETS; /** "Private" or "Open" when the two settings are exactly that combination; otherwise nothing. */ export declare const reachLabel: (people: boolean, agents: AgentsCanMessage) => "Private" | "Open" | undefined; /** "Available to" and both lists, the way the agent's Console page shows them. */ export declare function showAccess(request: ConsoleRequest, handle: string): Promise<{ handle: string; available_to?: "Open" | "Private"; people_can_message: boolean; agents_can_message: "everyone" | "nobody"; allow: AccessContact[]; deny: AccessContact[]; }>; /** Changes only the settings named; the Console reads the agent back after saving. */ export declare function updateReach(request: ConsoleRequest, handle: string, change: { people?: boolean; agents?: AgentsCanMessage; }): Promise<{ handle: string; available_to?: "Open" | "Private"; people_can_message: boolean; agents_can_message: "everyone" | "nobody"; }>; /** Sets both settings to a named combination, through the same route as `updateReach`. */ export declare function setReachPreset(request: ConsoleRequest, handle: string, preset: ReachPreset): Promise<{ handle: string; available_to?: "Open" | "Private"; people_can_message: boolean; agents_can_message: "everyone" | "nobody"; }>; /** Puts a person or agent on Always Allow (`allow`) or Never Allow (`deny`); the other list loses it. */ export declare function setAccess(request: ConsoleRequest, handle: string, subject: string, rule: AccessRule): Promise<{ ok: true; handle: string; rule: AccessRule; contact: AccessContact; }>; /** Takes a person or agent off whichever list holds it. */ export declare function removeAccess(request: ConsoleRequest, handle: string, subject: string): Promise<{ ok: true; handle: string; removed: string; }>; //# sourceMappingURL=agent-access.d.ts.map