export { resumePendingWebQueueItems } from "./callback-queue-recovery.js"; import type { IncomingMessage as HttpRequest, ServerResponse } from "node:http"; import type { GatewayEmit } from "../shared/gateway-events.js"; import type { DelegatedActivity, Engine, JinnConfig, Session } from "../shared/types.js"; export { compactEmployeeRole } from "../shared/employee-role.js"; import { type SessionManager } from "../sessions/manager.js"; export { foldPartialText, normalizeBlockDeltaForTurn, } from "../sessions/partial-stream.js"; export { isSensitiveConfigKey, sanitizeConfigForApi } from "./config-payload.js"; export { deliverConnectorReply } from "./connector-reply.js"; export { formatEngineErrorAssistantMessage, shouldPersistFinalAssistantMessage, } from "../sessions/turn/text.js"; export { matchRoute } from "./route-helpers.js"; import { type Instance, type InstanceInput } from "../instances/directory.js"; import { type CreateInstanceInput, type CreateInstanceResult } from "../instances/create.js"; import { type StartInstanceInput, type StartInstanceResult } from "../instances/start.js"; import { type TailscaleServeMapping } from "../instances/access.js"; import { type RestartDetachedOptions } from "./lifecycle.js"; import type { WorkflowService } from "../workflows/service.js"; /** Operator Todo PATCH cap, measured as raw UTF-8 request bytes including JSON overhead. */ export declare const TODO_EDIT_BODY_MAX_BYTES: number; export interface ApiContext { config: JinnConfig; sessionManager: SessionManager; startTime: number; /** Opaque process-generation id used only in platform-context fingerprints. */ gatewayBootId?: string; getConfig: () => JinnConfig; emit: GatewayEmit; connectors: Map; reloadConnectorInstances?: () => Promise<{ started: string[]; stopped: string[]; errors: string[]; }>; /** Re-read config.yaml into memory immediately (same as the file-watcher does, * but synchronous). Call after a handler writes config.yaml so getConfig() * reflects the change without waiting on the debounced watcher (~1s). */ reloadConfig?: () => void; hookRegistry?: import("./hook-registry.js").HookRegistry; hookSecret?: string; /** PTY-backed Claude engine used by CLI-mode message sends so the user sees the * prompt + response stream into the live xterm. Distinct from the headless * "claude" engine in sessionManager (which chat/cron/connectors use). */ interactiveClaudeEngine?: import("../engines/claude-interactive.js").InteractiveClaudeEngine; /** PTY-capable engines keyed by engine name. Used by CLI-mode web sends. */ ptyViewEngines?: Record; /** Synchronously re-scan org/ into the gateway's in-memory employee registry * (and drop warm PTYs). Called after an employee YAML write so the next session * spawn sees the new persona/model immediately, rather than waiting ~800ms for * the chokidar watcher. Wired in server.ts; same body as the watcher's onOrgChange. */ reloadOrg?: () => void; /** In-memory (never persisted) post-settle background activity per session, * maintained in server.ts from the interactive engine's onBackgroundActivity * callback. lastActivityAt is epoch ms; serializeSession converts to ISO. */ backgroundActivity?: Map; /** Gateway auth token for seamless browser/CLI access when auth is required. */ gatewayAuthToken?: string; /** Test-injectable Jinn home for auth device storage. Defaults to shared JINN_HOME. */ jinnHome?: string; /** Test-injectable gateway restart primitive. Defaults to lifecycle.restartDetached(). */ restartGateway?: (options: RestartDetachedOptions) => void; /** Immutable port actually bound by this gateway process, unaffected by config hot reload. */ runtimePort?: number; /** Test seams for the host-level workspace directory and creation service. */ loadWorkspaceInstances?: () => Instance[]; saveWorkspaceInstances?: (instances: InstanceInput[]) => void; checkWorkspaceRunning?: (instance: Instance, current: boolean) => Promise; readWorkspaceAccessMappings?: () => Promise; createWorkspaceInstance?: (input: CreateInstanceInput) => Promise; startWorkspaceInstance?: (input: StartInstanceInput) => Promise; issueWorkspacePairingCode?: (home: string) => string; workflowService?: WorkflowService; } export declare const PROXIED_OPERATOR_AUTH_ERROR: string; export declare function isSameOriginBrowserRequest(req: Pick, config: Pick): boolean; /** Sessions already holding engine capacity: mid-turn, queued behind one, or parked on a gate. * The delegated-activity index and a Workflow fan-out's ceiling both count exactly these. */ export declare function sessionsHoldingEngineCapacity(sessions: readonly Session[], context: ApiContext): Session[]; export declare function buildSessionDelegatedActivityIndex(sessions: readonly Session[], context: ApiContext): Map; export declare function serializeSession(session: Session, context: ApiContext, delegatedActivityIndex?: ReadonlyMap): Session; export declare function handleApiRequest(req: HttpRequest, res: ServerResponse, context: ApiContext): Promise; /** * Resolve the forwarded SSO identity from request headers, given the configured * `gateway.userHeader` (a single header name or a priority-ordered list). Node * lowercases incoming header keys, so we look up case-insensitively. Returns the * first present, non-empty, trimmed value; `undefined` when the config is unset * or no configured header is present. Unset config = single-user no-op: the * header is never read and the caller falls back to "web-user". */ export declare function resolveUserHeader(headers: Record, userHeaderConfig: string | string[] | undefined): string | undefined; //# sourceMappingURL=api.d.ts.map