import type { Logger } from './types.js';
/** Callable that posts one structured log line to the platform UI's
 *  `/api/admin/log-ingest` endpoint. Tests inject a spy; production uses
 *  `postLogLineViaFetch` from this module. Fire-and-forget — failures are
 *  surfaced to the manager logger but never thrown. */
export type LogLinePoster = (tag: string, level: 'info' | 'warn' | 'error', line: string) => void;
export interface JsonlTailDeps {
    postLogLine: LogLinePoster;
    logger: Logger;
}
export interface JsonlTailRegisterArgs {
    specialist: string;
    argvTools: readonly string[];
    /** Task 215 — fires once when the FIRST non-thinking `assistant` record
     *  emits a `[recorder-turn]` line. pty-spawner attaches this to fire
     *  the `[pty-spawn-tool-inventory-final]` snapshot. The tail invokes it
     *  fire-and-forget and clears the reference after the first call so
     *  multi-turn sessions don't re-trigger the snapshot. */
    onFirstTurn?: () => void;
}
export interface JsonlTail {
    /** Called by pty-spawner at spawn time for the database-operator
     *  recorder. Stamps the argv tool list against this sessionId so Line 1
     *  can compute `toolsArgvMissingFromExposed`. */
    register(sessionId: string, args: JsonlTailRegisterArgs): void;
    /** Called from the http-server's fs-watcher subscriber on
     *  `kind=modify source=jsonl` events. Reads bytes from the cursor to EOF
     *  and emits any new lines. Unregistered sessions are silently ignored
     *  so operator turns never get tailed. */
    onJsonlModify(sessionId: string, jsonlPath: string): void;
    /** Drop per-session state when the PTY exits. */
    unregister(sessionId: string): void;
    /** Test seam — current state for one session, or null if unregistered. */
    __peek(sessionId: string): {
        cursorOffset: number;
        initEmitted: boolean;
        nextTurnIndex: number;
    } | null;
}
/** Task 571 — classify an admin turn for the delegation-ratio counter.
 *  Agent dispatch always wins; otherwise any non-read tool use is direct. */
export declare function classifyAdminTurn(toolUseNames: readonly string[]): 'delegated' | 'direct' | null;
/** Production implementation of LogLinePoster. POSTs to the brand UI's
 *  loopback log-ingest route. Fire-and-forget; failure is logged via the
 *  manager's own logger and otherwise swallowed. */
export declare function postLogLineViaFetch(opts: {
    uiPort: string;
    logger: Logger;
}): LogLinePoster;
/** Probe one JSONL record for an init candidate. Returns the matched
 *  tool list when found, else null. Three probe shapes in priority order:
 *  `system.init`, `attachment.command_permissions`, then
 *  `attachment.deferred_tools_delta`. Each probe is intentionally narrow:
 *  it must see the exact shape that a real CLI session writes, otherwise
 *  downstream fallbacks get their chance. Headless `claude --verbose`
 *  PTY mode writes none of these — Task 185's argv fallback in
 *  `emitInitFallbackArgv` handles that path. */
export declare function probeInitTools(rec: Record<string, unknown>): {
    source: string;
    tools: readonly string[];
} | null;
/** Task 565 observability item 3 — derive a coarse outcome from the same
 *  turn metadata the `[recorder-turn]` line carries. Three buckets:
 *    - `done`     — at least one tool_use block fired this turn.
 *    - `stalled`  — recorder leaked tool-call shape as text, OR the turn
 *                   ended (stopReason=end_turn) with prose but no tool_use.
 *                   The producer "talked but did not act" failure mode the
 *                   task closes against.
 *    - `refused`  — turn ended with no tool_use and no text. The model
 *                   stopped early without producing anything.
 *  Mid-turn records (stopReason='' or 'tool_use') return null and emit no
 *  outcome line — outcome only describes turn-completed events. */
export type SpecialistOutcome = 'done' | 'stalled' | 'refused';
export declare function classifyOutcome(args: {
    stopReason: string;
    toolUseNames: readonly string[];
    textBytes: number;
    containsToolCallText: boolean;
}): SpecialistOutcome | null;
export declare function createJsonlTail(deps: JsonlTailDeps): JsonlTail;
//# sourceMappingURL=jsonl-tail.d.ts.map