UNPKG

@metamask/ocap-kernel

Version:
47 lines 1.92 kB
import type { VatSyscallObject, VatSyscallResult } from "@agoric/swingset-liveslots"; import type { JsonRpcMessage } from "@metamask/kernel-utils"; import type { Logger } from "@metamask/logger"; import type { DuplexStream } from "@metamask/streams"; import type { VatId } from "./types.cjs"; export type FetchBlob = (bundleURL: string) => Promise<Response>; type SupervisorConstructorProps = { id: VatId; kernelStream: DuplexStream<JsonRpcMessage, JsonRpcMessage>; logger: Logger; vatPowers?: Record<string, unknown> | undefined; fetchBlob?: FetchBlob; }; export declare class VatSupervisor { #private; /** The id of the vat being supervised */ readonly id: VatId; /** * Construct a new VatSupervisor instance. * * @param params - Named constructor parameters. * @param params.id - The id of the vat being supervised. * @param params.kernelStream - Communications channel connected to the kernel. * @param params.logger - The logger for this vat. * @param params.vatPowers - The external capabilities for this vat. * @param params.fetchBlob - Function to fetch the user code bundle for this vat. */ constructor({ id, kernelStream, logger, vatPowers, fetchBlob, }: SupervisorConstructorProps); /** * Terminate the VatSupervisor. * * @param error - The error to terminate the VatSupervisor with. */ terminate(error?: Error): Promise<void>; /** * Execute a syscall by sending it to the kernel. To support the synchronous * requirements of the liveslots interface, it optimistically assumes success; * errors will be dealt with at the end of the crank. * * @param vso - Descriptor of the syscall to be issued. * * @returns a syscall success result. */ executeSyscall(vso: VatSyscallObject): VatSyscallResult; } export {}; //# sourceMappingURL=VatSupervisor.d.cts.map