import type { CreateNotificationInputInput } from "./manifest"; import type { ColineUiAction, ColineUiNode } from "./ui"; export interface ColineActorIdentity { userId: string; email?: string; handle?: string | null; firstName?: string | null; lastName?: string | null; } export interface ColineWorkspaceIdentity { workspaceId: string; workspaceSlug: string; workspaceName?: string; } export interface ColineAppIdentity { appKey: string; appInstallId?: string; } export interface ColineFileReference { id: string; typeKey: string; title?: string; } export interface ColineFilesApi { getDocument(fileId: string): Promise>; updateDocument( fileId: string, document: Record, ): Promise<{ version: number; updatedAt: string }>; } export interface ColineIndexApi { upsert(input: { documents: Array<{ documentKey: string; documentType: string; fileId?: string; title: string; body: string; url?: string; metadata?: Record; }>; }): Promise<{ documents: Array<{ id: string; documentKey: string; visibilityMode: string; }>; }>; delete(input: { documentKeys: string[]; }): Promise<{ deleted: Array<{ id: string; documentKey: string; }>; }>; } export interface ColineNotificationsApi { create( input: CreateNotificationInputInput, ): Promise<{ ok: true }>; } export interface ColineRoutesApi { openFile(fileId: string): ColineUiAction; openAppHome(): ColineUiAction; custom(type: string, payload?: Record): ColineUiAction; } export interface ColineBaseContext { workspace: ColineWorkspaceIdentity; app: ColineAppIdentity; actor?: ColineActorIdentity | null; routes: ColineRoutesApi; files: ColineFilesApi; index: ColineIndexApi; notifications: ColineNotificationsApi; } export interface HomeRenderContext extends ColineBaseContext {} export interface FileRenderContext extends ColineBaseContext { file: ColineFileReference; } export interface IndexSyncContext extends ColineBaseContext { file?: ColineFileReference; } export type HomeRenderResult = ColineUiNode; export type FileRenderResult = ColineUiNode;