1
0
silverbullet/packages/server/syscalls/system.ts

23 lines
597 B
TypeScript
Raw Normal View History

2022-04-26 17:04:36 +00:00
import { SysCallMapping } from "@plugos/plugos/system";
2022-04-26 18:31:31 +00:00
import type { ExpressServer } from "../express_server";
2022-09-14 06:48:14 +00:00
import { version } from "../package.json";
2022-04-26 17:04:36 +00:00
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();
},
};
}