Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@procedures/client

Latest version: v0.68.7

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
npm package Publisher: mark1russell7
0 Stars
0 Forks
116 Versions
84.3K Downloads
TypeScript Repo language

Scan summary

@procedures/client was last scanned on 24 Nov 2026 at version 0.68.7. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 116 versions; the latest 5 were published on 24 Nov 2026.
  • Findings: No rules fired in version 0.68.7.
  • Downloads: 84,261 downloads.

Versions

116 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.68.7 LATEST 24 Nov 2026 No rules fired
0.68.6 24 Nov 2026 No rules fired
0.68.5 24 Nov 2026 No rules fired
0.68.4 24 Nov 2026 Not shown
0.68.3 24 Nov 2026 Not shown

No rules fired in 0.68.7

Findings

Findings for v0.68.7. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.68.7; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@procedures/client

npm version License: MIT TypeScript Node.js

Universal protocol-agnostic RPC client/server with middleware composition, type-safe procedures, streaming and procedure-as-data.

The core depends on no other package of the repository. The procedure components are in @procedures/splay, the data structures in @procedures/collections, and the program store with the storage layer in @procedures/store.

Table of Contents

  • Overview
  • Installation
  • Architecture
  • Core Concepts
  • API Reference
  • Examples
  • Integration

Overview

@procedures/client is the foundational package of the Mark ecosystem, providing a complete RPC framework with:

  • Universal Client/Server: Protocol-agnostic RPC supporting HTTP, WebSocket, gRPC, and local transports
  • Type-Safe Procedures: Schema-validated procedures with auto-discovery and registry management
  • Middleware System: Composable middleware for retry, cache, timeout, circuit breaker, rate limiting, auth, tracing, and validation
  • Procedure-as-Data: JSON programs of calls, references and control flow (PROGRAM-FORMAT.md)
  • Event Bus: Pub/sub messaging with async iteration support. A peer subscribes to the bus of another peer over each transport (EVENTS.md)
  • Error System: 70+ error codes with rich metadata and recovery suggestions

Installation

npm install @procedures/client

npm installs zod and ws with it. The HTTP server transport needs express 4 or 5 (an optional peer dependency).

import "@procedures/client/register" registers the control flow (client.chain and the others) and procedure.define, get, list and delete in the global registry. createRegistry() adds them to each new registry.

client.trace runs the steps of a client.chain program one at a time, and gives one row for each step with its result. A step that can write does not run, and the procedure asks for a capability without writes. Thus a read-only face can serve it. The procedure reference gives the rows and the input fields upTo and sampleLimit.

Architecture

graph TB
    subgraph "Application Layer"
        Procedures[Procedure System<br/>Type-safe RPC definitions]
        Events[Event Bus<br/>Pub/sub messaging]
    end

    subgraph "Client/Server Core"
        Client[Universal Client&lt;TContext&gt;<br/>Protocol-agnostic RPC]
        Server[Universal Server<br/>Handler registry]
        Middleware[Middleware Chain<br/>Composable behaviors]
    end

    subgraph "Transport Layer"
        HTTP[HTTP Transport<br/>RESTful + POST-only]
        WebSocket[WebSocket Transport<br/>Bidirectional streaming]
        Local[Local Transport<br/>In-process calls]
        Mock[Mock Transport<br/>Testing]
    end

    Procedures --> Client
    Procedures --> Server
    Events -.-> Client

    Client --> Middleware
    Server --> Middleware
    Middleware --> HTTP
    Middleware --> WebSocket
    Middleware --> Local
    Middleware --> Mock
Data Flow
sequenceDiagram
    participant App as Application
    participant Client as Client
    participant MW as Middleware Chain
    participant Transport as Transport
    participant Server as Server
    participant Handler as Procedure Handler

    App->>Client: call(method, payload)
    Client->>MW: compose middleware
    MW->>MW: retry, cache, timeout, auth...
    MW->>Transport: send(message)
    Transport->>Server: HTTP/WS/etc
    Server->>Handler: execute handler
    Handler-->>Server: result
    Server-->>Transport: response
    Transport-->>MW: response stream
    MW-->>Client: unwrap/validate
    Client-->>App: result

Core Concepts

1. Universal Client

The Client class provides protocol-agnostic RPC with type-safe middleware composition:

  • Generic over accumulated context type Client<TContext>
  • Middleware chain builds type information through .use()
  • Context inheritance via .withContext()
  • Supports streaming and single request/response
2. Procedure System

Type-safe RPC procedure definitions with:

  • Schema validation (Zod)
  • Auto-discovery via package.json
  • Handler execution (local or remote)
  • Procedure-as-data (procedure references)
3. Middleware Composition

Onion-model middleware with:

  • Type accumulation (Client<BaseContext & RetryContext & ...>)
  • Context propagation (parent → client → per-call)
  • Built-in middleware for common patterns
4. Call Policy and Interceptors

A host controls which procedures its callers reach, also through nested calls. See docs/POLICY.md.

  • expose: the procedures that the callers of a server can reach.
  • A data-driven procedure (client.chain) calls only exposed procedures.
  • A procedure of code declares its nested calls in metadata.calls. With strictCalls, a procedure that declares nothing calls only exposed procedures.
  • maxDepth: the highest depth of a nested call. The default is 64. A deeper call gets FORBIDDEN with the reason depth.
  • Interceptors run around each invocation and its nested calls: timeoutInterceptor, tracingInterceptor, metricsInterceptor.
Traces with OpenTelemetry

The client uses @opentelemetry/api only. The API does nothing until the program registers an SDK, for example with startNodeTelemetry() of @mark1russell7/otel-ts/node.

  • With an SDK, each try of a call is a client span. The registered propagator writes traceparent, tracestate and baggage into the metadata of the call.
  • The parent of the client span is the active span. When no span is active, the parent is the traceparent and tracestate that the caller gave in the metadata of the call. For example, mark gives the variables TRACEPARENT and TRACESTATE of its environment there.
  • The client marks each call as an internal call. The propagator of otel-ts sends the baggage only on an internal call.
  • With an SDK, tracingInterceptor makes a host span for a call of a host, and an internal span for a nested call. The handler runs in the context of its span.
  • The host reads no baggage from the metadata. @procedures/peer reads it from a trusted caller.
  • With no SDK, the client sends the W3C traceparent of its own ids, as before.
5. Related Packages
  • @procedures/collections: data structures (List, Map, Set, Queue) and composable behaviors (LRU, TTL, bounded, evented).
  • @procedures/splay: the procedure components, serializable UI descriptors (defineComponent, simpleComponent, streamingComponent).
  • @procedures/store: the program store (procedure.store, load, sync), ApiStorage, HybridStorage and the synced registry.

Quick Start

Client
import { Client, HttpTransport } from "@procedures/client";

const client = new Client({
  transport: new HttpTransport({ baseUrl: "https://api.example.com" })
})
  .use(createRetryMiddleware({ maxRetries: 3 }))
  .use(createAuthMiddleware({ token: "abc123" }));

// RPC call
const user = await client.call({ service: "users", operation: "get" }, { id: "123" });

// Streaming
for await (const event of client.stream({ service: "events", operation: "watch" }, {})) {
  console.log(event);
}
Procedures
import { defineProcedure, registerProcedures } from "client";
import * as z from "zod";

const getUserProcedure = defineProcedure({
  path: ["users", "get"],
  input: z.object({ id: z.string() }),
  output: z.object({ id: z.string(), name: z.string() }),
  handler: async ({ id }, ctx) => {
    return await db.users.findById(id);
  },
});

registerProcedures([getUserProcedure]);
Procedures of a package in the same process

callerOf(...modules) gives a function that runs the procedures of the modules. It makes the registry of the modules at the first call, and it does not use the global registry. Each call gives one value: the output, or the last item of a stream.

import { callerOf } from "@procedures/client";
import { ghModule } from "@procedures/gh";

const gh = callerOf(ghModule);
const runs = await gh<RunList>(["gh", "run", "list"], { repo: "owner/name" });
Procedures of a running peer

A peer with a state, for example a daemon, keeps its procedures in its own process. peerModule reads the manifest of the peer through procedure.manifest. It gives a module with a stub for each entry. The handler of each stub sends the call to the peer over HTTP.

import { readFileSync } from "node:fs";
import { createRegistry, peerModule } from "@procedures/client";

const jobs = await peerModule({
  name: "jobs",
  namespaces: ["jobs"],
  // The module reads the address at each call: a peer gets a new port or token when it starts again
  address: () => {
    const { url, token } = JSON.parse(readFileSync("/run/jobs/discovery.json", "utf8"));
    return { url, token };
  },
});
const registry = createRegistry(jobs);
  • The stub of an entry has the description, the JSON Schemas, the effects and the command-line metadata of the entry. A tool list shows them, and the policy of the host reads the effects.
  • The peer examines each input with its own schemas and applies its own policy. A validation error of the peer comes back with its code.
  • Without namespaces, the module forwards each namespace except client, procedure and handle (HOST_NAMESPACES), because each host has them.
  • prefix puts a path in front of each local path. With ["jobs"], the entry queue.add becomes jobs.queue.add.
  • The module leaves out each stream without an end. A stub gives the last item of a stream.
  • signal stops the read of the manifest, for example AbortSignal.timeout(5000) for a peer that does not answer. Each call of a stub takes the signal of its own context.
  • The peer must expose procedure.manifest. A host that has the client module (createRegistry()) has it. Another registry can register manifestProcedure.
  • forwardedModule(manifest, call, options) makes the same stubs with another transport.
Objects with a state: handles

A database, a service or a page of a browser is not JSON. A procedure that opens such an object keeps it in the handle scope of its caller. It gives a handle: { "handle": "h_<32 hex digits>" }. The procedures that take the handle get the object from the same scope.

import { handleModule, handleSchema, handleScopeOf } from "@procedures/client";

const open = createProcedure()
  .path(["db", "open"])
  .input(z.object({ path: z.string() }))
  .output(z.object({ handle: z.string() }))
  .handler(async ({ path }, ctx) => handleScopeOf(ctx).open("sqlite.Database", openDatabase(path), { label: path }))
  .build();

const query = createProcedure()
  .path(["db", "query"])
  .input(z.object({ db: z.object({ handle: z.string() }), sql: z.string() }))
  .handler(async ({ db, sql }, ctx) => handleScopeOf(ctx).get<Database>(db, "sqlite.Database").all(sql))
  .build();

const registry = createRegistry({ name: "db", procedures: [open, query], requires: [handleModule] });
  • The face of the host gives one HandleScope to each owner. Each MCP session and each WebSocket connection has its own scope. The end of the session or the close of the connection closes each object of its scope.
  • A handle resolves only in the scope that opened it. A caller of another session cannot use it. The ids have 128 random bits.
  • handleModule adds handle.list and handle.close. handle.list gives the open objects of the caller. handle.close closes one.
  • The scope closes an object with the close option of the open. Without it, the scope uses Symbol.asyncDispose, Symbol.dispose or a close() method.
  • The option handles of the MCP transport and of WebSocketServerTransport sets maxHandles (64 by default) and idleMs. An object that no call used for idleMs closes.
  • The HTTP face keeps no handles: each request has no owner after its answer. A call of a procedure with handles over HTTP gets NOT_ACCEPTABLE.
  • handleSchema(kind) gives the JSON Schema of a handle. Its keyword x-procedures-handle gives the kind of the object.
  • The errors have the codes of the protocol. VALIDATION_ERROR is for a handle that is not open. RATE_LIMITED is for a full scope. NOT_ACCEPTABLE is for a face that keeps no handles.
  • A peer does not forward handle.*. The handles of a host stay in the host.

API Reference

Client
class Client<TContext = {}>

Universal RPC client with type-safe middleware composition.

Constructor:

new Client(options: ClientOptions | Transport)

interface ClientOptions {
  transport: Transport;
  defaultMetadata?: Metadata;
  throwOnError?: boolean;  // default: true
}

Methods:

// Add middleware (returns new typed client)
use<TProvides>(middleware: ClientMiddleware): Client<TContext & TProvides>

// Create child client with additional context
withContext<TAdditional>(context: TAdditional): Client<TContext & TAdditional>

// Make RPC call (request/response)
call<TReq, TRes>(method: Method, payload: TReq, options?: CallOptions): Promise<TRes>

// Make streaming RPC call
stream<TReq, TRes>(method: Method, payload: TReq, options?: CallOptions): AsyncIterable<TRes>

// Execute procedure by path or reference
exec<TOutput>(refOrPath: ProcedureRef | ProcedurePath, input?: unknown): Promise<TOutput>

// Nested route API (batch calls with middleware overrides)
route<TRoute>(request: CallRequest<TRoute>): Promise<CallResponse<TRoute>>
routeStream<TRoute>(request: CallRequest<TRoute>): StreamingCallResponse<TRoute>

// Register validation schema (requires Zod middleware)
schema(method: Method, schemas: { input?: ZodSchema; output?: ZodSchema }): this

// Set custom procedure registry
useRegistry(registry: ProcedureRegistry): this

// Close transport
close(): Promise<void>
Transports
HttpTransport
new HttpTransport(options: HttpTransportOptions)

interface HttpTransportOptions {
  baseUrl: string;
  urlStrategy?: UrlStrategy;           // default: defaultUrlPattern
  httpMethodStrategy?: HttpMethodStrategy;  // default: postOnlyStrategy
  headerConverter?: HeaderConverter;
  defaultHeaders?: Record<string, string>;
  timeout?: Duration;                  // the time to the first item
  credentials?: "include" | "same-origin" | "omit";  // the credentials mode of fetch
  requestInit?: Omit<RequestInit, "method" | "headers" | "body" | "signal">;
  fetch?: typeof fetch;                // default: globalThis.fetch
}

An application with a cookie session on another origin sets credentials: "include". The browser then sends the cookies of the server with each call. The server must permit the origin of the page with credentials (CORS). Refer to "Procedure handler without a framework".

const client = new Client(new HttpTransport({ baseUrl: "https://api.example.com/api", credentials: "include" }));
WebSocketTransport

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @procedures/client

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

PHP2Shell, Day 5 93.6% of Measurable Instances Still Unpatched (1)
Vulnerability Insights

PHP2Shell, Day 5: The Panic Hasn’t Turned Into Patching

Frame 2085668439 (1)
Group 1261154229