import type { AgentSubmissionStore, ConversationStreamStore, PersistenceAdapter, SessionStore } from "@fabric-harness/sdk"; import type { LakebaseClient, LakebaseClientOptions } from "./lakebase.js"; /** * The slice of `@fabric-harness/node` this adapter assembles. Loaded * dynamically (node is an optional peer — Databricks Apps always run on * Node, but this package stays importable without it); injectable for tests. */ export interface DatabricksPersistenceStoreModule { PostgresSessionStore: new (options: { client: LakebaseClient; initialize?: boolean; }) => SessionStore; PostgresSubmissionStore: new (options: { client: LakebaseClient; initialize?: boolean; }) => AgentSubmissionStore; PostgresConversationStreamStore: new (options: { client: LakebaseClient; initialize?: boolean; }) => ConversationStreamStore; ensurePostgresSubmissionTables(client: LakebaseClient): Promise; ensurePostgresConversationStreamTables(client: LakebaseClient): Promise; postgresSchedulerLeaseStore?: (client: LakebaseClient) => DatabricksSchedulerLeaseStore; } interface DatabricksSchedulerLeaseStore { prepare?(): Promise; claim(key: string, ownerId: string, expiresAt: number, now: number): Promise; renew(key: string, ownerId: string, expiresAt: number): Promise; release(key: string, ownerId: string): Promise; readLastScheduledAt?(key: string): Promise; recordLastScheduledAt?(key: string, scheduledAt: number): Promise; } export interface DatabricksPersistenceOptions { /** * Lakebase connection options (workspace OAuth credential exchange or an * explicit local/test password), or an already-constructed client to reuse. */ lakebase: LakebaseClientOptions | LakebaseClient; /** Override the `@fabric-harness/node` loader (tests / bundlers). */ loadStores?: () => Promise; } /** * Everything the v2 runtime persists, on Lakebase, in one adapter: * sessions (canonical conversation state), durable agent submissions * (admission/FIFO/leases/settlement), and offset-addressable conversation * streams. Implements the SDK {@link PersistenceAdapter} contract, so it * plugs straight into `init({ persistence })`; the extra `connect*` methods * feed `startDevServer({ submissionStore, conversationStreamStore })`. */ export interface DatabricksPersistence extends PersistenceAdapter { readonly client: LakebaseClient; connect(): Promise; connectSubmissionStore(): Promise; connectConversationStreamStore(): Promise; connectSchedulerLeaseStore(): Promise; /** All three stores in one call (server wiring convenience). */ connectAll(): Promise<{ store: SessionStore; submissionStore: AgentSubmissionStore; conversationStreamStore: ConversationStreamStore; }>; /** Idempotent schema setup for every store (CREATE TABLE IF NOT EXISTS). */ migrate(): Promise; close(): Promise; } /** * One-call Lakebase persistence for Databricks-hosted agents. * * ```ts * const persistence = databricksPersistence({ * lakebase: { host, database: 'fabric', user: clientId, endpoint, credentialClient: sdk.postgres }, * }); * const { store, submissionStore, conversationStreamStore } = await persistence.connectAll(); * await startDevServer({ submissionStore, conversationStreamStore }); * ``` * * The Postgres store implementations come from `@fabric-harness/node` * (optional peer) and run unchanged against Lakebase — the only Databricks * specifics are database-credential exchange, refresh caching, and TLS defaults from * {@link lakebaseClient}. */ export declare function databricksPersistence(options: DatabricksPersistenceOptions): DatabricksPersistence; export {}; //# sourceMappingURL=persistence.d.ts.map