import { type Database } from "./database.js"; import type { WorkspaceArtifactViewer } from "./workspace-artifacts.js"; export type SidebarLayoutScopeKey = { accountId: string; workspaceId: string; }; export type SidebarLayoutRow = { layout: unknown; revision: number; updatedAt: string; updatedBy: string | null; }; /** The workspace default and, when `subjectId` is given, that person's own changes. */ export declare function readSidebarLayouts(db: Database, scope: SidebarLayoutScopeKey, subjectId: string | null): Promise<{ workspace: SidebarLayoutRow | null; personal: SidebarLayoutRow | null; }>; /** * Write one layout if its revision is still `expectedRevision` (0: no row * yet). Returns the new row, or null when someone else changed it meanwhile. */ export declare function writeSidebarLayout(db: Database, scope: SidebarLayoutScopeKey, input: { /** Null: the workspace default. */ subjectId: string | null; expectedRevision: number; layout: unknown; updatedBy: string | null; }): Promise; export type SidebarAppSummary = { appId: string; title: string; }; /** * What the sidebar can show about apps for this viewer: the active apps among * `appIds` they can open, the workspace's pinned apps and the ones they * opened or edited (published a version of) most recently. Archived, deleted * and other people's Only me apps are left out. */ export declare function readSidebarApps(db: Database, scope: SidebarLayoutScopeKey, input: { viewer: WorkspaceArtifactViewer; appIds: readonly string[]; pinnedLimit: number; recentLimit: number; }): Promise<{ apps: Map; pinned: SidebarAppSummary[]; recent: SidebarAppSummary[]; }>; /** * Which of `appIds` a sidebar keeps links to (`kept`): apps of this workspace * that still exist, archived ones included, so restoring an app brings its * links back. With `viewer`, for a person's own links, only apps they could * open apart from archiving: shared ones and their own, not someone else's * Only me. A sidebar write drops links to the rest. `archived` is the kept * ones that are archived now. */ export declare function readSidebarLinkedApps(db: Database, scope: SidebarLayoutScopeKey, appIds: readonly string[], viewer?: WorkspaceArtifactViewer): Promise<{ kept: Set; archived: Set; }>; export type SidebarAgentSummary = { agentId: string; name: string; /** Its own avatar as stored; null shows its initials. */ avatar: unknown; visibility: "workspace" | "private"; ownerSubjectId: string | null; }; /** * The agents of this workspace among `agentIds`, whoever can see them: the * API keeps the ones the reader may see (shared ones and their own Only me * ones), and a sidebar write drops links to agents that are gone. */ export declare function readSidebarAgents(db: Database, scope: SidebarLayoutScopeKey, agentIds: readonly string[]): Promise>;