import type { GraphDescription } from '../types/graph.js'; /** How much a lint finding matters: `error` fails `nexus graph lint`, the others only report. */ export type GraphLintSeverity = 'error' | 'warning' | 'info'; /** The rules `lintGraph()` checks. */ export type GraphLintCode = 'UNBOUNDED_CYCLE' | 'RETRY_WITHOUT_IDEMPOTENCY' | 'RETRY_WITHOUT_TIMEOUT' | 'DEFERRED_DURABILITY_WITH_SIDE_EFFECTS' | 'MEMORY_CHECKPOINTER' | 'NO_CHECKPOINTER' | 'UNBOUNDED_CONCURRENCY' | 'DYNAMIC_ROUTE' | 'SENSITIVE_TOOL_WITHOUT_APPROVAL' | 'UNDECLARED_TOOL_CAPABILITIES' | 'SIDE_EFFECT_BEFORE_INTERRUPT'; /** One design problem `lintGraph()` found. */ export interface GraphLintFinding { /** Which rule found it. */ code: GraphLintCode; /** How much it matters. */ severity: GraphLintSeverity; /** The node it is about, as a path through subgraphs such as `review/approve`. Absent for the graph itself. */ node?: string; /** What is wrong. */ message: string; /** What to do about it. */ fix: string; } /** Options for `lintGraph()`. */ export interface GraphLintOptions { /** * The graph runs where a restart, a second replica, or a hand-off is normal: under the agent * server, a job queue, or more than one process. An in-process checkpointer is then an error, not * a note. */ deployed?: boolean; /** Rules to skip, by code. */ ignore?: GraphLintCode[]; } /** * Finds designs that work in a demo and fail in production, by reading a compiled graph's shape. * * It needs no run and calls no node: it reads `describe()`, so it also works on a description saved * as JSON. The checks: * * | Code | Severity | Finds | * | --- | --- | --- | * | `UNBOUNDED_CYCLE` | error | A cycle of static edges, which only the step limit can stop | * | `RETRY_WITHOUT_IDEMPOTENCY` | warning | A retried node not declared `idempotent`, whose side effects can repeat | * | `RETRY_WITHOUT_TIMEOUT` | warning | A retried node with no timeout, whose hung attempt is never retried | * | `DEFERRED_DURABILITY_WITH_SIDE_EFFECTS` | warning | `async` or `exit` durability with nodes not declared `idempotent` | * | `MEMORY_CHECKPOINTER` | warning, or error when `deployed` | The in-process default, which a restart loses | * | `NO_CHECKPOINTER` | info | No checkpoints, so no interrupt, resume, or recovery | * | `UNBOUNDED_CONCURRENCY` | warning | A fan-out with no limit on tasks at once | * | `DYNAMIC_ROUTE` | info | A router with no mapping or `ends`, so routes cannot be checked | * | `SENSITIVE_TOOL_WITHOUT_APPROVAL` | warning, or error when `deployed` | A tool that writes, runs commands or code, or reaches the network, with no approval and no permission policy | * | `UNDECLARED_TOOL_CAPABILITIES` | info | A tool with no capabilities and no approval, whose effects cannot be judged | * | `SIDE_EFFECT_BEFORE_INTERRUPT` | warning | A node that declares effects and interrupts, so its effects repeat when it runs again on the answer | * * @example * ```ts * import { lintGraph } from 'nexus-ai-pro/graph/lint'; * * const findings = lintGraph(graph, { deployed: true }); * for (const finding of findings) console.log(finding.severity, finding.code, finding.message); * ``` */ export declare function lintGraph(graph: { describe(): GraphDescription; } | GraphDescription, options?: GraphLintOptions): GraphLintFinding[];