import type { Contributions } from "./contracts.ts"; /** Package API v1. Compiled plugins export activate(api). */ export type Dispose = () => void | Promise; export interface PluginCommand { id: string; title: string; run: () => void | Promise } export interface PluginView { id: string; title: string; mount: (container: HTMLElement) => void | Dispose | Promise } export interface PluginApi { readonly id: string; readonly signal: AbortSignal; contribute(key: K, value: Contributions[K]): void; registerCommand(command: PluginCommand): void; registerView(view: PluginView): void; openView(id: string): void; onDispose(cleanup: Dispose): void; workspace: { list(path?: string): Promise<{ name: string; rel_path: string; kind: string }[]>; read(path: string): Promise; write(path: string, contents: string, expected: string): Promise; }; settings: { read(): Promise; write(value: unknown): Promise }; assets: { read(path: string): Promise }; } export interface PluginModule { activate(api: PluginApi): void | Dispose | Promise } export interface ExternalManifest { schemaVersion: 1; id: string; name: string; author: string; description: string; version: string; apiVersion: 1; entry: string; access: "full-app"; } export interface InstalledPlugin { manifest: ExternalManifest; hash: string; enabled: boolean; path: string; error: string | null; removal: boolean } export interface PluginSnapshot { root: string; plugins: InstalledPlugin[] } export interface Candidate { token: string; source: string; manifest: ExternalManifest | null; error: string | null } export interface RemovalPlan { token: string; plugin: InstalledPlugin }