import type { JourneyRun, JourneyRunDetail, JourneyTrajectoryStep } from "../contract"; /** Any failure to obtain a run from ora: network, HTTP, rate limit, stream error. */ export declare class DeepJourneyApiError extends Error { } export interface JourneyIntentOption { id: string; label: string; hint: string; template: string; } export interface JourneyAgentOption { id: string; label: string; variant: string; harness: string; model: string; blurb?: string; } /** The per-target allowance the POST response advertises via X-RateLimit-*. */ export interface RunAllowance { limit?: number; remaining?: number; /** Unix ms when the next per-target slot frees; absent when unknown. */ resetAtMs?: number; } export interface DeepJourneyOptions { /** Curated intent id; the server default when omitted. */ intentId?: string; /** * Free-text task (the keyed custom arm, 4-300 chars server-side). Needs a * partner API key; mutually exclusive with `intentId` (the command layer * enforces the exclusivity, this client just sends whichever arm is set). */ task?: string; /** * ora-issued partner API key, sent as `Authorization: Bearer`. Unlocks * free-text tasks and moves the caller to the 1000/24h per-key allowance * (no per-target cap, no burst guard). Falls back to $ORA_PARTNER_API_KEY, * then $ORA_SCAN_API_KEY (the shared partner registry serves both * surfaces). Safe to send a wrong key with a curated intent - the server * silently degrades to the keyless tier. */ apiKey?: string; harness: string; model: string; /** Receives one-line progress updates while the run streams/polls. */ progress?: (line: string) => void; /** * Receives the cumulative trajectory on every `trajectory` frame - the raw * material the caller redraws the live attribution graph from. Streaming * only; polling has no per-step frames to hand back. */ onTrajectory?: (steps: JourneyTrajectoryStep[]) => void; /** Base URL override; otherwise $ORA_API_URL, otherwise https://ora.ai. */ baseUrl?: string; /** Abort when the stream is silent for this long (default 120s). */ idleMs?: number; /** Skip the SSE and poll GET /api/journey/runs/{id} instead. */ noStream?: boolean; pollEveryMs?: number; pollLimit?: number; } export interface DeepJourneyOutcome { /** The projected run record from the trigger (or the cached latest run). */ record: JourneyRun; /** True when the per-target cap answered with the stored latest run. */ cached: boolean; /** Milliseconds until a per-target slot frees, on a cached answer. */ retryAfterMs?: number; allowance: RunAllowance; /** Terminal detail: status, verdict, step_count, and result once succeeded. */ detail: JourneyRunDetail; /** The stream's terminal error message, when the run failed mid-stream. */ engineError?: string; } /** The curated intents a public run can execute. */ export declare function fetchJourneyIntents(baseUrl?: string): Promise<{ intents: JourneyIntentOption[]; defaultId: string; }>; /** The agents an anonymous run request accepts. */ export declare function fetchJourneyAgents(baseUrl?: string): Promise<{ agents: JourneyAgentOption[]; defaultId: string; }>; export declare function formatWait(ms: number): string; /** Non-streaming run detail (verdict, step_count, result once succeeded). */ export declare function fetchRunDetail(base: string, runId: string): Promise; /** * Run a deep journey against `target` and resolve with the terminal detail. * Streams the trajectory by default (progress lines via `options.progress`); * with `noStream`, polls the record instead. A per-target-capped trigger is * NOT an error: ora answers with the most recent stored run for that target, * and the outcome carries `cached: true` plus `retryAfterMs`. */ export declare function performDeepJourney(target: string, options: DeepJourneyOptions): Promise;