import type { EventSourceStatus } from "@opengeni/contracts"; import { type Database } from "./database.js"; export type SlackBotAccess = { connectionId: string; homeWorkspaceId: string; generation: number; connectionVersion: number; }; /** Configured sharing is independent of whether the bot needs reconnect. */ export declare function readOrganizationSlackBotAccess(db: Database, scope: { accountId: string; workspaceId: string; connectionId: string; }): Promise<{ enabled: boolean; generation: number; workspaceIds: string[] | null; }>; /** Metadata discovery only. The adapter must first authorize connections:read * in this exact target workspace. This never returns credentials or personal rows. */ export declare function sharedOrganizationSlackBots(db: Database, scope: { accountId: string; workspaceId: string; }): Promise; export declare function availableSlackBotConnectionMetadata(db: Database, scope: { accountId: string; workspaceId: string; }): Promise<({ id: string; authorityId?: string | undefined; connectionAuthorityGeneration?: number | undefined; accountId: string; workspaceId: string; subjectId: string | null; providerDomain: string; kind: "api_key" | "app_install" | "delegated" | "oauth2"; status: "active" | "error" | "needs_reauth" | "revoked"; grantedScopes: string[]; expiresAt: string | null; lastRefreshAt: string | null; lastUsedAt: string | null; lastError: string | null; version: number; verifiedInstallAt: string | null; verifiedInstallVersion: number | null; label?: string | null | undefined; accountIdentity?: "reconnect" | "single" | "verified" | undefined; listPrice?: { basis: "model"; modelId: string; } | { basis: "custom"; pricing: { inputMicrosPerMillionTokens: number; cachedInputMicrosPerMillionTokens?: number | undefined; cacheWriteMicrosPerMillionTokens?: number | undefined; outputMicrosPerMillionTokens: number; }; } | null | undefined; listPriceKnown?: boolean | undefined; createdBySubjectId: string | null; updatedBySubjectId: string | null; createdAt: string; updatedAt: string; turnedOnHere?: boolean | undefined; turnedOnHereGrantId?: string | null | undefined; metadata: { organizationSharingGeneration: number; }; } | import("./connection-metadata.js").ConnectionMetadataWithVerification)[]>; /** A shared workspace's Slack source, with what recording a delivery into it needs. */ export type SharedSlackEventSource = { workspaceId: string; sourceId: string; status: EventSourceStatus; statusReason: string | null; }; export declare const SHARED_SLACK_EVENT_SOURCES_V2_ROUTINE = "opengeni_private.list_shared_slack_event_sources_v2(uuid, uuid, uuid, text)"; /** * The Slack event sources, for one Slack team, of the other workspaces the * organization currently shares this home bot with. Empty unless the bot is * the active verified install and its sharing is enabled; the saved workspace * allowlist applies. In one statement, with each source's status, so * recording needs no further read. Once the runtime may call 1552's definer it * is one indexed lookup whatever the organization's size; until then 1538's * routine probes each covered workspace. */ export declare function sharedSlackEventSources(db: Database, scope: { accountId: string; homeWorkspaceId: string; connectionId: string; externalKey: string; }): Promise; /** * Whether the workspace has an Opengeni Slack bot to use, in one statement: * an active install here verified at its current version, or one its * organization shares with it (the share function applies the same checks * to the bot in its home workspace). Metadata only; never reads credentials. */ export declare function hasAvailableSlackBot(db: Database, scope: { accountId: string; workspaceId: string; }): Promise; /** Canonical organization-administrator authentication is supplied by a trusted * HTTP adapter. SQL separately rechecks live authority and exact bot identity. */ export declare function setOrganizationSlackBotAccess(db: Database, input: { accountId: string; workspaceId: string; connectionId: string; enabled: boolean; workspaceIds?: string[] | null; }, authorize: () => Promise<{ accountId: string; subjectId: string; }>): Promise<{ enabled: boolean; generation: number; workspaceIds: string[] | null; }>; export type PreparedBotMessage = { id: string; scheduledTaskId: string | null; connectionId: string; connectionVersion: number; homeWorkspaceId: string; sharingGeneration: number; channelId: string; threadTimestamp: string | null; text: string; }; type MessageScope = { accountId: string; workspaceId: string; sessionId: string; }; export declare function prepareBotMessage(db: Database, input: MessageScope & Omit): Promise; export declare function readPreparedBotMessage(db: Database, input: MessageScope & { id: string; }): Promise; export {};