@benchsdk/runner 0.3.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/index.cjs +531 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -51
- package/dist/index.d.ts +108 -51
- package/dist/index.js +525 -176
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# @benchsdk/runner
|
|
2
2
|
|
|
3
|
-
Benchmark framework for authoring `*.bench.ts` files
|
|
3
|
+
Benchmark framework for authoring `*.bench.ts` files and operating benchmark workers. It reports to the benchmarks platform via `@benchsdk/api`; [`@benchsdk/client`](../benchsdk) is a backwards-compatibility re-export shim.
|
|
4
4
|
|
|
5
5
|
## What it provides
|
|
6
6
|
|
|
7
7
|
- **`defineBenchmarkConfig`** / **`defineTask`** — A `*.bench.ts` file exports exactly two things: a **config** (`defineBenchmarkConfig`, the orchestration knobs + `participants` + an optional `onComplete` hook) and a **task** (`defineTask`, the workload for one iteration). There is no "mode": the orchestration shape (sequential / staggered / burst) emerges from the `iterations`, `concurrency`, and `staggerDelayMs` knobs, and `groupBy` (`'participant'` | `'round'`) selects the ordering across participants.
|
|
8
8
|
- **`bench run <file>`** — The CLI entrypoint. It imports the module, reads its `config` and `task`, applies CLI overrides, and drives the run. Benchmark files declare; they never call the runner themselves.
|
|
9
|
+
- **`bench check <file>`** — Validates environment variables, API connectivity, participant availability, and scoring weights before a run.
|
|
10
|
+
- **`runBenchmarkWorker(options)`** — One-shot operator helper that runs a single participant's worker without a `*.bench.ts` file.
|
|
9
11
|
- **`TaskError`** / **`NoAvailableParticipantsError`** — Structured errors: throw `TaskError` from a task to attach a code / data / pre-measured steps; `bench run` treats `NoAvailableParticipantsError` (every participant env-gated out) as a clean no-op exit.
|
|
10
12
|
|
|
11
13
|
## Install
|
|
@@ -68,7 +70,7 @@ tsx node_modules/@benchsdk/runner/dist/bin.js run sandbox-tti.bench.ts
|
|
|
68
70
|
|
|
69
71
|
Inside a task the context exposes three separate channels:
|
|
70
72
|
|
|
71
|
-
- **`step(name, fn, options?)`** — returns `fn`'s value to your code (thread live objects between steps); records the step's timing/status on the platform. Return values are never auto-recorded as data. Set `captureOutput: false` to return an outcome-shaped object (`stdout`, `stderr`, `exitCode`, ...) without writing it to the worker log.
|
|
73
|
+
- **`step(name, fn, options?)`** — returns `fn`'s value to your code (thread live objects between steps); records the step's timing/status on the platform. Return values are never auto-recorded as data. Set `captureOutput: false` to return an outcome-shaped object (`stdout`, `stderr`, `exitCode`, ...) without writing it to the worker log. Use `parallelInvocations` (formerly `concurrency`) to invoke a step multiple times in parallel.
|
|
72
74
|
- **`measure(data)`** — explicit metric channel. Called inside a `step()` it merges into that step's data; called at task top-level it merges into the task record. A task with no explicit steps is recorded as one implicit `'task'` step carrying its measurements.
|
|
73
75
|
- **`log(message, metaOrOptions?)`** — human-readable narration to the run timeline. `metaOrOptions` can be a metadata JSON object or `{ level: 'debug' | 'info' | 'warn' | 'error', meta?: JsonObject }`.
|
|
74
76
|
|
|
@@ -77,6 +79,7 @@ Inside a task the context exposes three separate channels:
|
|
|
77
79
|
`bench` is a unified CLI. Besides `bench run`, it can authenticate and query the platform:
|
|
78
80
|
|
|
79
81
|
```sh
|
|
82
|
+
bench check <file.bench.ts>
|
|
80
83
|
bench auth login
|
|
81
84
|
bench benchmarks list
|
|
82
85
|
bench runs list <slug>
|