/**
 * schema2-build — the PRODUCER's per-tool mappers + `buildSessionDetailV2`
 * (PHNX-3442 step 2, increments 2-4).
 *
 * Populates the `SessionStepV2` discriminated union (schema2.ts) from the parsed
 * session events, reusing the SAME infrastructure the schema-1 path already uses:
 *
 *   - the callId pairing loop (`pairSteps` in session/trajectory.ts) — so a step's
 *     (use event, result event) triple is recovered without a duplicate loop;
 *   - bash unwrap/tokenize/classify (`session/bash-command.ts`) + the effective
 *     program resolver (`effectiveProgram`);
 *   - the meta / whereItWentWrong / surfacedToolFailures / active-time helpers
 *     factored out of sync.ts (`buildDetailMeta`, `buildWhereItWentWrong`, …).
 *
 * The command/patch/output PARSING lives here; the worker stores the shard
 * opaquely and the console reads the union directly and never reparses (spec §5).
 *
 * category / risk / categoryMetrics are DELIBERATELY omitted from the schema-2
 * detail: the shipped consumer (`decodeSessionDetail` → coerceCategory/Risk/Metrics)
 * backfills them to the same neutral defaults it uses for schema-1, so computing
 * them here would be inventing session-level signal this step does not own.
 */
import { type BashCategory as ClassifierCategory } from '../session/bash-command.js';
import { type SessionTrajectory } from '../session/trajectory.js';
import type { SessionEvent } from '../session/types.js';
import type { BashAction, BashCategory, SessionStepV2 } from './schema2.js';
import { activeMsFromTrajectory, type SessionDetail } from './sync.js';
/**
 * SessionDetailV2 — the schema-2 shard this producer emits.
 *
 * `category` / `risk` / `categoryMetrics` are DELIBERATELY OMITTED. The consumer's
 * `SessionDetailV2` declares them, but its `decodeSchema2` backfills neutral
 * defaults via `coerceCategory`/`coerceRisk`/`coerceMetrics` (never throws) — the
 * same defaulting it applies to schema-1 shards today. This producer does not yet
 * author those fields (their provenance is the prix/api PHNX-3351 hosted backend,
 * not agents-cli), so emitting them here would fabricate classification. Omission
 * is the honest choice and is asserted as a tested contract in
 * `schema2-fixture.test.ts`. Wire real category/risk here once its source is settled.
 */
export interface SessionDetailV2 {
    schema: 2;
    id: string;
    meta: SessionDetail['meta'];
    steps: SessionStepV2[];
    gaps: SessionTrajectory['gaps'];
    truncatedSteps: number;
    whereItWentWrong: string | null;
    surfacedToolFailures: Array<{
        tool?: string;
        label: string;
        detail?: string;
    }>;
}
/**
 * `unwrapCommand` (bash-command.ts) strips VAR=/sudo/cd&&/npx/loops/subshells but
 * NOT an interpreter wrapper like `/bin/zsh -lc "…"`, `bash -lc '…'`, or `sh -c …`
 * — the exact shape the managed runner wraps every command in. Peel that first,
 * then hand the inner payload to the existing unwrapper so all the wrappers it DOES
 * know still apply. One extra rule, at the source, not a fork of unwrapCommand.
 */
export declare function unwrapShellExec(command: string): string;
/**
 * Map a classifier `BashCategory` (the rich vcs|build-test|install|… taxonomy) to
 * the coarse schema-2 `BashCategory` (build|test|git|network|other). `build-test`
 * needs the argv/subcommand to decide build vs test — `bun test` is test, `bun
 * build` is build — so this takes the tokenized argv too.
 */
export declare function mapBashCategory(cat: ClassifierCategory, argv: string[]): BashCategory;
/** Build the per-segment BashAction list for a bash command. */
export declare function buildBashActions(unwrapped: string): BashAction[];
export interface BuildDetailV2Options {
    redact?: boolean;
    knownSecrets?: readonly string[];
}
/**
 * Build the schema-2 per-session detail from a pre-built trajectory and its raw
 * events. The trajectory supplies meta/gaps/whereItWentWrong/surfacedToolFailures
 * (via the shared sync.ts helpers) and the truncation count; the raw events supply
 * the per-tool detail the schema-1 flat step could not carry.
 *
 * Re-pairs the events with `pairSteps` (the SAME loop buildTrajectory ran) to
 * recover each step's (use event, result event) triple, then dispatches per tool.
 */
export declare function buildSessionDetailV2(traj: SessionTrajectory, events: SessionEvent[], options?: BuildDetailV2Options): SessionDetailV2;
export { activeMsFromTrajectory };
