import type { OrgDaemon, RunningOrg } from './daemon.js'; import { type QueuedMessage } from './inbox.js'; import type { OrgDef, OrgRole } from './types.js'; export declare const ENDPOINT_POST_TIMEOUT_MS = 15000; export declare const DEFAULT_ENDPOINT_WAIT_MS = 600000; export declare const ENDPOINT_RETRY_MS: number[]; export declare const ENDPOINT_PERIODIC_RETRY_MS = 60000; /** Keys an endpoint role may not carry (it is not an agent). */ export declare const ENDPOINT_FORBIDDEN_KEYS: readonly ['policy', 'runtime', 'adapter_config', 'budget_tokens', 'budget_usd', 'tool_providers']; export declare function isEndpointRole(role: unknown): boolean; /** Roles that get sessions — everything except endpoint roles. */ export declare function agentRoles(roles: R[]): R[]; export declare function findEndpointRole(def: Pick | undefined, roleId: string): OrgRole | undefined; /** `org validate` rules for endpoint roles. */ export declare function endpointStructureErrors(def: Pick): string[]; /** Boss briefing: one line per endpoint role. */ export declare function endpointBriefingLines(def: Pick | undefined): string[]; export type EndpointAttempt = { ok: true; status: number; } | { ok: false; error: string; insecure?: boolean; }; /** Read `credential_file` at delivery time (rotation needs no restart). It * must be absolute, mode 0600 and owned by the daemon's user. */ export declare function readEndpointCredential(file: string | undefined): { ok: true; token?: string; } | { ok: false; error: string; insecure: boolean; }; export interface EndpointPayload { orgName: string; run: string; from: string; to: string; subject: string; body: string; messageId: string; } export declare function postToEndpoint(role: OrgRole, payload: EndpointPayload, timeoutMs?: number): Promise; export interface EndpointWait { role: string; messageId: string; until: number; } export declare function recordEndpointWait(org: RunningOrg, role: OrgRole, messageId: string): void; /** A message from `:` (or ``) clears that * role's oldest wait. */ export declare function clearEndpointWait(org: RunningOrg, orgName: string, from: string): void; /** True while any endpoint wait is unexpired (expired ones are pruned). */ export declare function hasActiveEndpointWait(org: RunningOrg, now?: number): boolean; /** deliver()/receiveRemote() leg for a target that is an endpoint role. */ export declare function deliverToEndpoint(daemon: OrgDaemon, args: { orgName: string; org: RunningOrg; role: OrgRole; /** Sender as the payload names it: bare role (same org) or `org:role`. */ from: string; subject: string; body: string; messageId: string; /** Extra bus to copy the delivery event to (a different sender org). */ src?: RunningOrg; /** `to` on the emitted event (deliver()'s display form). */ eventTo?: string; }): Promise; /** Take matching queued endpoint entries and POST them; failures are * re-queued. Returns the last error per messageId that stayed queued. */ export declare function retryQueuedEndpoints(daemon: OrgDaemon, orgName: string, predicate?: (m: QueuedMessage) => boolean): Promise<{ delivered: string[]; failed: Map; }>; /** 1 s / 5 s / 15 s retries for one queued message; after the last failure * emit `endpoint-unreachable` and leave it queued for the periodic sweep. */ export declare function scheduleEndpointRetries(daemon: OrgDaemon, orgName: string, messageId: string, roleId: string): void; /** Periodic (60 s) re-attempt of queued endpoint entries while `org` runs. * Entries still on their 1/5/15 s schedule are skipped. */ export declare function startEndpointRetryLoop(daemon: OrgDaemon, orgName: string): void; /** Stop every retry timer for `org` (stopOrg). Queued entries stay queued. */ export declare function stopEndpointRetries(daemon: OrgDaemon, orgName: string): void; //# sourceMappingURL=endpoint-roles.d.ts.map