/**
 * `GET /api/steps` — what happens from here: a screen, a handler or any
 * symbol as the ANCHOR, and everything it sets in motion drawn as typed steps.
 *
 * The Screens view (`screens.ts`) is already a picture of steps with one step
 * type: it folds `HomeScreen → ItemsGrid → ItemCard → openObjectDetail` into
 * one arrow labelled with its condition, because the reader wants the
 * transition, not the plumbing. This endpoint keeps that fold and widens the
 * set of things worth a box. Walking FORWARD from the anchor over calls,
 * renders, handler bindings and navigations, a node is a step when it is:
 *
 * - a **screen** (a route reached over a `navigates` edge),
 * - a **trigger** — a function wired as a value (`onPress={handleX}`,
 *   `addListener('x', handleX)`), the user's or the platform's way in,
 * - a **bridge** call — the language changes under the call, JS → native
 *   (the React Native bridge resolver's edges, or any family crossing),
 * - a native **event** landing back in JS (`sendEvent(withName:)` → the
 *   listener, via the RN event channel),
 * - a **store** action — a function in a store file, the state it writes,
 * - an **effect** — a call that leaves the index into the network, storage,
 *   the device or telemetry, drawn as its own box beside the function that
 *   makes it.
 *
 * Everything else — hooks, helpers, services, the components between a
 * screen and its handlers — is `via`: listed on the link, never a box. The
 * branch conditions along the folded chain join into the link's `when`, read
 * from the source at request time exactly as the Screens view reads them.
 *
 * The picture is finite because it is ANCHORED and CAPPED, not because the
 * graph is small: a bounded depth in steps, a bounded fan-out per node, a
 * bounded number of nodes folded per step, and hubs and shared chrome (a top
 * bar rendered on ten screens) are dead ends rather than paths. Every cap
 * that fired is reported on the step it fired at, so a short picture never
 * reads as "nothing else happens here".
 *
 * Read from the graph at request time, never cached: the `when` labels and
 * the effect sites are read from the source as it stands.
 */
import type CodeGraph from '../../index';
import type { Language, Node } from '../../types';
import type { SiteTrigger } from '../../graph/branch-guards';
import { type WireProgram } from './program';
import { type WireNodeRef } from './wire';
export type WireStepKind = 'anchor' | 'screen' | 'trigger' | 'bridge' | 'event' | 'store' | 'effect';
export type WireStepLinkKind = 'calls' | 'navigates' | 'handler' | 'bridge' | 'event' | 'store' | 'effect';
export interface WireStepSite {
    file: string;
    line: number;
    /** `push /capture`, `calls`, `client.post` — what the site does, in a word or two. */
    text: string;
    /**
     * What the site passes, as written and abbreviated: `'userEmail',
     * values.email`, `'/auth/login', { email, password }`. '' for an empty
     * argument list; absent when the source could not be read.
     */
    args?: string;
    /**
     * The conditions THIS site runs under — the whole chain's, joined; '' when
     * unconditional. A link with several sites is several scenarios (four
     * early returns that each go home), and the viewer lists them as rows with
     * the clauses they share factored out; the link's own `when` is only the
     * summary of all of them.
     */
    when: string;
    /** What fires THIS site, when it differs from the link's first. */
    trigger?: WireStepTrigger;
    /** For a response site: the status code it sends, when literal (`res.status(404)`, `throw new NotFoundException`). */
    status?: number;
    /**
     * The decision the site's INNERMOST condition belongs to, when one was
     * read. Two sites that agree on `branch` and disagree on `arm` are the two
     * ways of one fork — which a joined condition string can never say, however
     * exactly one reads as the other's negation. It is what lets a picture draw
     * `resolvePostLoginRoute → /home` and `→ /welcome` as one choice with two
     * answers instead of two lines that each carry the whole predicate.
     */
    decision?: WireStepDecision;
}
/** One arm of one decision, as the site that runs under it records it. */
export interface WireStepDecision {
    /** Where the branching construct starts (`line:column`) — the fork's identity. */
    branch: string;
    /** The decision as a reader says it, always positive: `await hasSeenWelcome(…)`. */
    on: string;
    /** THIS arm's own condition — an `if` and its `else` differ here and nowhere else. */
    arm: string;
    form: 'if' | 'switch' | 'ternary' | 'try';
    /** The arm taken when the condition does NOT hold — the `else` side. */
    not?: true;
}
/** What fires a step or a link: the event it is written under, and the function that writes it there. */
export interface WireStepTrigger extends SiteTrigger {
    /** The function the binding is written in — `LoginButton` for its `onPress`. */
    in: string;
}
export interface WireStep {
    /** The node's id, or `effect:<function id>:<api>` for a call leaving the index. */
    id: string;
    kind: WireStepKind;
    /** The step the picture starts from. A screen anchor keeps `kind: 'screen'`. */
    anchor: boolean;
    /** Null only for an effect, which is a call site rather than a symbol. */
    node: WireNodeRef | null;
    /** `/capture/review`, `handleApproveAllImages`, `client.post`. */
    label: string;
    /** The component for a screen, the file for a symbol, the category and caller for an effect. */
    sub: string;
    /** Steps from the anchor: the row. */
    depth: number;
    /**
     * Why the walk did not go on from this step, when it did not: a cap it hit
     * (`depth`, `fan-out`, `folded`, `steps`), or `screen` — another screen, or
     * an endpoint reached across a tier, is a chapter of its own, drawn but not
     * entered unless `through` asks.
     */
    cut: 'depth' | 'fan-out' | 'folded' | 'steps' | 'screen' | 'component' | null;
    /** The event name a native event step arrived on (`onZipComplete`) — the first, when several land here. */
    event?: string;
    /** Every event that lands on this step, in the order the walk met them. */
    events?: string[];
    /** For a handler: what fires it — the first binding the walk met. */
    trigger?: WireStepTrigger;
    /**
     * The step's place in its row, in the code's order: by the position of the
     * hop that first reached it, a hop written inside another site's arguments
     * counting before that site. The viewer lays the row out in it.
     */
    order?: number;
    /**
     * For a SCREEN anchor's picture: the region of the screen this step belongs
     * to — the top-level component (or hook) of the screen's tree the walk first
     * reached it through, the screen's own component for a call written in the
     * screen body, and the first-reaching parent's region for everything deeper.
     * The viewer lays a screen's picture out by these: a screen is a set of
     * handlers with no order between them, so distance alone put ninety boxes on
     * one row. Absent for an endpoint's or a function's picture, whose rows
     * already read in the code's order.
     */
    region?: {
        id: string;
        label: string;
    };
    /**
     * For a screen or an endpoint: its path and the symbol that serves it — the
     * component a screen renders, the handler an endpoint runs. `endpoint` when
     * the route leads with an HTTP verb (`POST /users`); `inline` when the
     * handler is an anonymous function at the registration site, so the route
     * itself stands in for it and `component` is null.
     */
    screen?: {
        path: string;
        component: WireNodeRef | null;
        endpoint: boolean;
        inline: boolean;
    };
    /**
     * For an effect: the calls one function makes into one category — `api` is
     * the first, `apis` all of them — and the function that makes them. A
     * database call also says the model / table it touches when the call
     * names one, and whether it reads or writes; a response box lists the
     * status codes its sites send.
     */
    effect?: {
        api: string;
        apis: string[];
        category: string;
        by: WireNodeRef;
        line: number;
        model?: string;
        access?: 'read' | 'write';
        statuses?: number[];
    };
}
export interface WireStepLink {
    id: string;
    from: string;
    to: string;
    kind: WireStepLinkKind;
    /** The symbols folded between the two steps, in order. */
    via: WireNodeRef[];
    /** Conditions along the whole chain, joined; '' when unconditional. */
    when: string;
    /** How the last hop was established when it was not a plain call — `via rn-event-channel · registered at file:line`. */
    label: string;
    /** The call the first hop is written inside the arguments of — `res.json` for a token signed while building the reply. */
    within?: string;
    synthesized: boolean;
    uncertain: boolean;
    sites: WireStepSite[];
    /** What fires the first site, when something binds it to an event. */
    trigger?: WireStepTrigger;
}
export interface WireStepsPayload {
    anchor: WireNodeRef;
    /** Other symbols that share the anchor's name, when it was given by name. */
    ambiguous: WireNodeRef[];
    /**
     * What the index is a picture of, decided from its routes: an `app` of
     * screens, an `api` of endpoints, or a `web` app with both. The viewer's
     * words (screen / endpoint, store action / data) follow it.
     */
    project: 'app' | 'api' | 'web';
    steps: WireStep[];
    links: WireStepLink[];
    /**
     * The same walk read in the code's ORDER: the anchor's body as a rail that
     * forks where the code forks. Built from the same records the links are, so
     * the two readings hold the same steps; null when the anchor has no body to
     * read (nothing was recorded).
     */
    program: WireProgram | null;
    /**
     * Which reading to open with: the code's order for a handler, an endpoint or
     * any function; the tree for a screen, where handlers fire on events and
     * have no order between them. The URL's `view` overrides it.
     */
    defaultView: 'order' | 'tree';
    depth: number;
    limit: number;
    /** Screens reached from the anchor were entered rather than drawn as boundaries. */
    through: boolean;
    truncated: {
        /** Steps not added because the picture reached `limit`. */
        steps: number;
        /** Folded walks that stopped at a hub (fan-in ≥ the hub threshold). */
        hubs: number;
        /** Folded walks that stopped at shared chrome (a component rendered by several screens). */
        chrome: number;
    };
    index: {
        lastIndexedAt: number | null;
        edges: number;
        files: number;
    };
    timing: {
        elapsedMs: number;
    };
}
export declare const DEFAULT_DEPTH = 8;
export declare const MAX_DEPTH = 14;
export declare const DEFAULT_LIMIT = 120;
export declare const MAX_LIMIT = 400;
/**
 * JS → native is a bridge call; native → JS is an event. Anything else is one
 * family — unless the edge itself says which way it crosses: a synthesized
 * channel (`resolution/tier-synthesizer.ts`) marks a client's request onto its
 * own route `client→server`, a socket message back `server→client`, and a
 * queue job or a bus event as a `channel` whose landing is an arrival; a
 * server action called from a client file is marked `client→server` at
 * request time, by its directive.
 */
export declare function crossing(from: Language, to: Language, meta?: Record<string, unknown>): 'bridge' | 'event' | null;
/**
 * A file that holds state: a store, a slice, a reducer. The graph has no
 * "store" kind — a Zustand action is an ordinary function node — so the file
 * is the evidence, and the legend says so.
 */
export declare const STORE_FILE: RegExp;
export declare function isStoreFile(file: string): boolean;
/**
 * What a call is when it leaves the index, by the reference text alone — the
 * mobile app's table, kept for callers that have no language in hand. The
 * Steps walk itself classifies on the call AS WRITTEN with the language and
 * the project kind (`effects.ts`).
 */
export declare function effectCategory(referenceName: string): string | null;
export declare function buildSteps(cg: CodeGraph, projectRoot: string, query: URLSearchParams): Promise<WireStepsPayload>;
/**
 * What kind of project the picture is of, by what its routes are: endpoints
 * (`POST /users`) make an API; screens with navigation between them make an
 * app; both — pages and the endpoints behind them — make a web app.
 */
export declare function projectKind(routes: readonly Node[], navigates: number): 'app' | 'api' | 'web';
//# sourceMappingURL=steps.d.ts.map