1
0
silverbullet/packages/server/syscalls/system.ts
2022-09-14 09:32:47 +02:00

23 lines
597 B
TypeScript

import { SysCallMapping } from "@plugos/plugos/system";
import type { ExpressServer } from "../express_server";
import { version } from "../package.json";
export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
return {
"system.invokeFunction": async (
ctx,
env: string,
name: string,
...args: any[]
) => {
if (!ctx.plug) {
throw Error("No plug associated with context");
}
return ctx.plug.invoke(name, args);
},
"system.reloadPlugs": async () => {
return expressServer.reloadPlugs();
},
};
}