Documentation
    Preparing search index...

    Interface CvmTransport

    Abstract ContextVM transport. Implementors own Nostr relay access, signing, encryption (CEP-4 gift wrap), JSON-RPC correlation, and MCP initialization.

    interface CvmTransport {
        cancel?(
            server: CvmServerRef,
            handle: object,
            message: McpMessage,
            options?: CvmRequestOptions,
            execution?: { signal: ApprovalSignal },
        ): Promise<boolean>;
        close(server: CvmServerRef): Promise<void>;
        discover(
            query?: CvmDiscoverQuery,
            execution?: { signal: ApprovalSignal },
        ): Promise<CvmServer[]>;
        dispose?(): void;
        onEvent(
            handler: (server: CvmServerRef, message: McpMessage) => void,
        ): { close(): void };
        planDiscover?(query?: CvmDiscoverQuery): readonly string[];
        planRequest?(server: CvmServerRef): readonly string[];
        publish?(
            server: CvmServerRef,
            message: McpMessage,
            options?: CvmRequestOptions,
            execution?: { signal: ApprovalSignal },
        ): Promise<void>;
        request(
            server: CvmServerRef,
            message: McpMessage,
            options?: CvmRequestOptions,
            execution?: CvmTransportExecution,
        ): Promise<McpMessage>;
    }
    Index

    Methods

    • Publish a napplet's notifications/cancelled for its request handle, with params.requestId mapped to the id the transport actually sent (NAP-CVM #31 @ 28cf1bdb: a transport that maps request ids "consistently maps request references such as cancellation"). Resolves false, without publishing, when that request has already settled.

      Optional for older transports. Without it the service warns once (KEHTO_CVM_TRANSPORT_CANCEL, see docs/compatibility.md) and publishes the cancellation unchanged.

      Parameters

      Returns Promise<boolean>

    • Publish an MCP notification or a response to a server request, and resolve once it is published (NAP-CVM #31 @ 28cf1bdb: "After transport publication, result without message"). No MCP response is awaited, and the message is sent as given: a notification gets no id and a response keeps the napplet's id. Rejects with relay timeout past timeoutMs.

      Optional for older transports. Without it the service warns once (KEHTO_CVM_TRANSPORT_PUBLISH, see docs/compatibility.md) and falls back to CvmTransport.request, still answering without message.

      Parameters

      Returns Promise<void>