import { type AppDatabase, type SqlResult } from "@vendoai/core"; /** At most this many rows come back from one statement. A page the model can read, not a table dump that fills the context window. */ export declare const APP_SQL_MAX_ROWS = 500; export interface AppSqlResult extends SqlResult { /** Set when the answer was cut to {@link APP_SQL_MAX_ROWS}. */ truncated?: true; } export interface AppSqlAccess { /** Which SQL the app's database speaks — said in the agent tool's own description, because generated SQL has to be written for it. */ readonly dialect: AppDatabase["dialect"]; /** Run ONE statement as `subject`, against `appId`'s own database. */ run(appId: string, subject: string, sql: string, params?: readonly unknown[]): Promise; /** Erase cascade, subject leg — every `mine.` table this person holds in this app, and their place in the schema log. */ forget(appId: string, subject: string): Promise; /** Erase cascade, app leg. */ drop(appId: string): Promise; /** * Anonymous → signed-in. `mine.` is a table per person, so adoption MOVES * TABLES rather than rewriting an owner column: each table `from` holds is * renamed onto `to`, and `to` inherits the schema watermark. * * The collision — signed in, then anonymous, then signed in again, so `to` * already holds that table — is settled by MERGE, and by the rule that the * signed-in account never loses a row it already had: the anonymous rows that * do not collide are carried across, the ones that do are dropped, and the * anonymous copy goes. Refusing instead would strand the work the person just * did behind an error nobody can act on. */ adopt(appId: string, from: string, to: string): Promise; } export declare const createAppSql: (db: AppDatabase) => AppSqlAccess; /** Exported for the tests that prove one person's tables have no spelling in another's SQL. */ export declare const appSqlOwner: (subject: string) => string; export declare const appSqlMineTable: (owner: string, name: string) => string; //# sourceMappingURL=app-sql.d.ts.map