import type { FabricActor, FabricPrincipal, ModelProvider, SubmissionTelemetrySink } from "@fabric-harness/sdk"; import type { DatabricksPrincipal, DatabricksTokenProvider } from "./identity.js"; import type { LakebasePoolFactory } from "./lakebase.js"; import type { MlflowTraceExporter } from "./mlflow-tracing.js"; import type { DatabricksModelOptions } from "./model.js"; import type { DatabricksPersistence, DatabricksPersistenceOptions } from "./persistence.js"; import type { DatabricksTelemetry } from "./telemetry-sink.js"; import { UcVolumesAttachmentStore } from "./volumes-attachment-store.js"; /** * Production preset for agents hosted on Databricks Apps (v2, workstream C5). * * One call resolves the runtime from the standard app environment: the app's * service principal (client-credentials OAuth), official workspace SDK clients and * serving-endpoint model provider, Lakebase-backed persistence for sessions + * submissions + conversation streams, and submission-keyed telemetry — all * running as one governed identity that Unity Catalog enforces. * * ```ts * const app = databricksApp(); * await startDevServer({ port: Number(process.env.DATABRICKS_APP_PORT ?? 8000), ...(await app.serverOptions()) }); * ``` */ export interface DatabricksAppOptions { /** Environment source. Default `process.env`. */ env?: Record; /** Acting identity. Default: the app service principal from the environment. */ principal?: DatabricksPrincipal; /** Workspace host. Default `DATABRICKS_HOST`. */ host?: string; /** Default model service or serving endpoint. Defaults to `DATABRICKS_MODEL`. */ model?: string; /** AI Gateway or custom Model Serving routing controls. */ inference?: Omit; /** * Lakebase connection. Defaults from the app's database resource * environment (`DATABRICKS_LAKEBASE_HOST`/`DATABASE`/`USER`/`ENDPOINT`, * falling back to `PGHOST`/`PGDATABASE`/`PGUSER`/`ENDPOINT_NAME`). Workspace * OAuth is exchanged for a rotating database credential. Set `false` to * run without durable persistence. */ lakebase?: false | { host?: string; database?: string; user?: string; endpoint?: string; port?: number; ssl?: boolean | { rejectUnauthorized?: boolean; }; poolFactory?: LakebasePoolFactory; }; /** Unity Catalog principal name, when it differs from the client id. */ ucPrincipal?: string; /** Submission-keyed telemetry into Lakebase. Default: on when Lakebase resolves. */ telemetry?: boolean; /** * UC Volume attachment storage. Defaults from DATABRICKS_CATALOG, * DATABRICKS_SCHEMA, and DATABRICKS_VOLUME; set false to disable. */ attachments?: false | { catalog?: string; schema?: string; volume?: string; rootPrefix?: string; }; fetchImpl?: typeof fetch; /** * Static persistence-store loader for self-contained bundles. Ordinary Node * projects can omit this and use the optional `@fabric-harness/node` peer. */ loadPersistenceStores?: DatabricksPersistenceOptions["loadStores"]; } export interface DatabricksAppRuntime { identity: DatabricksTokenProvider; /** Governed identity the app executes as; stamp into actors/submissions. */ principal: FabricPrincipal; actor: FabricActor; modelProvider: ModelProvider; persistence?: DatabricksPersistence; telemetry?: DatabricksTelemetry; attachmentStore?: UcVolumesAttachmentStore; /** Export settled submission traces without exposing Fabric's raw protocol transport. */ mlflowTraceExporter(options: { experimentId: string; onError?: (context: string, error: unknown) => void; }): MlflowTraceExporter; /** * The durable-store slice of `startDevServer` options (submission store + * conversation stream store on Lakebase), with schema ensured. Empty when * Lakebase is disabled. */ serverOptions(): Promise<{ sessionStore?: import("@fabric-harness/sdk").SessionStore; submissionStore?: import("@fabric-harness/sdk").AgentSubmissionStore; conversationStreamStore?: import("@fabric-harness/sdk").ConversationStreamStore; attachmentStore?: import("@fabric-harness/sdk").AttachmentStore; telemetry?: SubmissionTelemetrySink; scheduler?: { identity: () => { tenantId: string; actor: FabricActor; }; leaseStore?: import("@fabric-harness/node").SchedulerLeaseStore; catchUp: "skip" | "run-once"; }; }>; /** * Per-request on-behalf-of identity from Databricks Apps forwarded * headers, or `undefined` when the request carries no user token. */ onBehalfOf(headers: Headers | Record): { identity: DatabricksTokenProvider; actor: FabricActor; } | undefined; close(): Promise; } export declare function databricksApp(options?: DatabricksAppOptions): DatabricksAppRuntime; //# sourceMappingURL=app.d.ts.map