export type AgentSqlDialect = "postgres" | "bigquery"; export type AgentSqlTokenKind = /** Unquoted keyword or identifier. `value` is case-folded. */ "word" /** `"name"` on Postgres, `` `name` `` on BigQuery. `value` is the exact name. */ | "quoted-identifier" | "string" | "number" /** `?`, `$1`, or BigQuery `@name` / `@@name`. */ | "parameter" | "operator" | "punctuation"; export interface AgentSqlToken { kind: AgentSqlTokenKind; /** Source text of the token. */ text: string; /** Identifier name as the database resolves it; source text otherwise. */ value: string; start: number; end: number; } export type AgentSqlSyntaxErrorCode = "unterminated" | "unsupported_syntax" | "unexpected_character"; /** * The lexer could not read the SQL the way the database would. Callers must * refuse to run the statement: a guard that skipped what it could not read * would be checking different text from what executes. */ export declare class AgentSqlSyntaxError extends Error { readonly code: AgentSqlSyntaxErrorCode; readonly position: number; constructor(code: AgentSqlSyntaxErrorCode, message: string, position: number); } /** * Splits agent-authored SQL into the tokens the target database will see. * Comments and whitespace are dropped; everything else is kept with its * source offsets. Throws {@link AgentSqlSyntaxError} for anything the lexer * cannot read the same way the database does. */ export declare function lexAgentSql(sql: string, options: { dialect: AgentSqlDialect; }): AgentSqlToken[];