import { Manifest } from "../../common/manifest"; import { Plug } from "../../plugos/plug"; import { PageMeta } from "../../common/types"; export type SpaceEvents = { pageCreated: (meta: PageMeta) => void; pageChanged: (meta: PageMeta) => void; pageDeleted: (name: string) => void; pageListUpdated: (pages: Set) => void; plugLoaded: (plugName: string, plug: Manifest) => void; plugUnloaded: (plugName: string) => void; }; export type PlugMeta = { name: string; version: number; }; export interface Space { // Pages watchPage(pageName: string): void; unwatchPage(pageName: string): void; listPages(): Promise>; readPage(name: string): Promise<{ text: string; meta: PageMeta }>; getPageMeta(name: string): Promise; writePage( name: string, text: string, selfUpdate?: boolean, withMeta?: PageMeta ): Promise; deletePage(name: string): Promise; // Plugs listPlugs(): Promise; loadPlug(name: string): Promise; proxySyscall(plug: Plug, name: string, args: any[]): Promise; invokeFunction( plug: Plug, env: string, name: string, args: any[] ): Promise; // Events on(handlers: Partial): void; off(handlers: Partial): void; emit(eventName: keyof SpaceEvents, ...args: any[]): void; // TODO: Get rid of this updatePageListAsync(): void; }