import { type BridgePeer } from './bridge-peers.js'; import { type Job } from './job-board.js'; import { isBridgeEnabled } from './bridge-switch.js'; export declare const BRIDGE_PROMPT_MAX_CODE_POINTS = 32000; export declare const BRIDGE_TIMEOUT_ERROR = "bridge_timeout"; export { isBridgeEnabled }; export type BridgeCallbackStatus = 'none' | 'pending' | 'sending' | 'delivered' | 'giving_up'; export interface BridgeRunRow { job_id: number; run_id: string; direction: 'inbound' | 'outbound'; peer_id: string; idempotency_key: string; remote_job_id: number | null; correlation_id: string | null; callback_status: BridgeCallbackStatus; wait_reason: string | null; timeout_at: string | null; last_event_seq: number; } /** Shape attached to GET /api/jobs/:id. Column names, no secrets. */ export type BridgeJobView = BridgeRunRow; export declare function codePointLength(text: string): number; /** Clamp a caller timeout onto the A2A wall clock. `0` is rejected by the API. */ export declare function clampBridgeTimeoutMs(requested: number | undefined): number; /** * The pinned workspace must be the one routeMessage will actually use. * routeMessage resolves from the peer id; if that is a different workspace, * the pin failed and the caller is refused before a job row exists. */ export declare function bridgeWorkspacePinned(peerId: string, workspaceId: string): boolean; export declare function getBridgeRunByJobId(jobId: number): BridgeRunRow | null; export declare function getBridgeRunByRunId(runId: string): BridgeRunRow | null; export interface AcceptBridgeRunInput { peer: BridgePeer; agent: string; prompt: string; idempotencyKey: string; correlationId: string | null; timeoutMs: number; createJob: (agent: string, prompt: string, opts: { kind: 'job'; creatorId: string; workspaceId: string; threadKey: string; callDepth: number; }) => number; } export type AcceptBridgeRunResult = { created: true; row: BridgeRunRow; job: Job; } | { created: false; row: BridgeRunRow; job: Job; }; /** * Insert the job and the side row in one immediate transaction. * A concurrent duplicate idempotency key rolls back the losing job * insert and returns the winner. The loser does not call runJob. */ export declare function acceptBridgeRun(input: AcceptBridgeRunInput): AcceptBridgeRunResult; export declare function resetBridgeInflightForTests(): void; /** Start the run when this peer still has a free concurrency slot. */ export declare function startBridgeRun(jobId: number): void; /** After process start, continue inbound rows that are still pending. */ export declare function resumePendingBridgeRuns(): void; //# sourceMappingURL=bridge-run.d.ts.map