type CapabilityInterface = import("@isolated-vm/experimental/frontend/realm", { with: { "resolution-mode": "import" }}).Realm.CapabilityInterface; type _Agent = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent; type _Module = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module; type _Reference = import("@isolated-vm/experimental/frontend/reference", { with: { "resolution-mode": "import" }}).Reference; type CompileModuleOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CompileModuleOptions; type CompileScriptOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CompileScriptOptions; type CreateAgentOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CreateOptions; type CreateCapabilityOptions = import("@isolated-vm/experimental/frontend/realm", { with: { "resolution-mode": "import" }}).Realm.CreateCapabilityOptions; type CreateNativeModuleOptions = import("@isolated-vm/experimental/frontend/native_module", { with: { "resolution-mode": "import" }}).NativeModule.CreateOptions; type EvaluateModuleOptions = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module.EvaluateOptions; type MaybeCompletionOf = import("@isolated-vm/experimental/utility/completion", { with: { "resolution-mode": "import" }}).MaybeCompletionOf; type ModuleLinkRecord = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module.LinkRecord; type ModuleRequest = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module.Request; type RunScriptOptions = import("@isolated-vm/experimental/frontend/script", { with: { "resolution-mode": "import" }}).Script.RunScriptOptions; declare const Secret: unique symbol; /** @internal */ export type Secret = typeof Secret; export class Agent { readonly #private; protected constructor(secret: Secret, ...args: unknown[]); disposeAsync(): Promise; compileModule(code: string, options?: CompileModuleOptions): Promise>; compileScript(code: string, options?: CompileScriptOptions): Promise>; createRealm(): Promise; static create(options?: CreateAgentOptions): Promise<_Agent>; } export class Capability { readonly #private; /** * Creates a synchronous capability from the given callback. When invoked from an isolate the calling task is * suspended until the value, or promise, returned by `callback` settles. The settled value is returned, or thrown, * synchronously inside the isolate. * * Capabilities are one-shot objects. They are consumed by `realm.createCapability`. */ static sync(this: void, callback: (...args: any[]) => unknown): Capability; /** * Creates a fire-and-forget capability from the given callback. When invoked from an isolate the call returns * `undefined` immediately and `callback` is scheduled on the nodejs thread. Its return value is ignored, and it is * expected not to throw. A thrown error is raised as an `uncaughtException`. * * Capabilities are one-shot objects. They are consumed by `realm.createCapability`. */ static void(this: void, callback: (...args: any[]) => void): Capability; } export class Module { readonly requests: readonly ModuleRequest[]; readonly specifier: string | undefined; readonly #private; protected constructor(secret: Secret, ...args: unknown[]); /** @internal */ _link(realm: Realm | null, linker: ModuleLinkRecord): Promise; evaluate(realm: Realm | null, options?: EvaluateModuleOptions): Promise>; } export class NativeModule { readonly #private; protected constructor(secret: Secret, ...args: unknown[]); instantiate(realm: Realm | null): Promise; static create(filename: string, options: CreateNativeModuleOptions): Promise; } export class Realm { readonly #private; protected constructor(secret: Secret, ...args: unknown[]); acquireGlobalObject(): Promise<_Reference>>; createCapability(capability: CapabilityInterface, options: CreateCapabilityOptions): Promise; instantiateRuntime(): Promise; } export interface TransferOptions { transfer?: readonly unknown[]; } export interface InvokeOptions extends TransferOptions { /** * Maximum amount of time in milliseconds the function is allowed to run before execution is * canceled. Default is no timeout. See `Script.RunScriptOptions.timeout`. */ timeout?: number | undefined; } export class Reference { readonly #private; protected constructor(secret: Secret, ...args: unknown[]); copy(): Promise; get(property: string): Promise; set(property: string, value: unknown): Promise; invoke(args: unknown[], options?: InvokeOptions): Promise>; } export class Script { readonly #private; protected constructor(secret: Secret, ...args: unknown[]); run(realm: Realm | null, options?: RunScriptOptions): Promise>; } /** @internal */ declare const exports: { Agent: typeof Agent; Capability: typeof Capability; Module: typeof Module; NativeModule: typeof NativeModule; Realm: typeof Realm; Script: typeof Script; }; export default exports;