open-index/open-npm huggingface dataset:
npm package: @rlmesh/client
Description: Client for interacting with RLMesh
Author: ArenaX Labs, Inc.
Latest version: 0.1.0-alpha.1

# @rlmesh/client

TypeScript SDK for RLMesh evaluations. **Alpha — expect breaking changes.**

## Install

```bash
npm install @rlmesh/client
```

## Usage

```ts
import { RLMesh } from "@rlmesh/client";

const rlmesh = new RLMesh({
  baseUrl: "https://api.rlmesh.dev",
  apiKey: process.env.RLMESH_API_KEY,
});

const evaluation = await rlmesh.evaluations.create({
  model: { type: "remote" },
  tasks: [{ taskId: "task_1", env: { id: "env_cartpole" }, episodes: 10 }],
});

rlmesh.evaluations.stream(evaluation.id, evaluation.viewerToken, {
  onEvent: (event) => console.log(event.type),
});
```

## Mock Client (`@rlmesh/client/testing`)

In-memory mock that auto-runs the full eval lifecycle. No server needed.
Current testing helpers target Node.js; browser and worker runtimes are not supported yet.

```ts
import { createMockClient } from "@rlmesh/client/testing";

const { client, store } = createMockClient({
  environments: [{ gymId: "CartPole-v1", image: "ghcr.io/envs/cartpole:1.0" }],
});

const ev = await client.evaluations.create({
  model: { type: "remote" },
  tasks: [{ taskId: "tsk_1", env: "CartPole-v1", episodes: 10, seed: 42 }],
  webhook: { url: "http://localhost:3000/callbacks/rlmesh", events: ["eval.completed"] },
});
```

Modes: `"demo"` (default, timed), `"fast"` (instant, use `store.scheduler.advanceBy(ms)`), `"manual"` (nothing auto-runs).

Hot reload: `createStore()` on `globalThis`, then `createMockClientFromStore(store)` on each reload.

If you want disk-backed snapshots, pass `persist`:

```ts
import { createMockClient } from "@rlmesh/client/testing";

const { client, store } = createMockClient({
  environments: [{ gymId: "CartPole-v1", image: "ghcr.io/envs/cartpole:1.0" }],
  mode: "fast",
  persist: ".rlmesh/mock-store.json",
});

// snapshot auto-restores on startup and flushes on destroy / process exit
store.destroy();
```

## License

Apache-2.0