@benchsdk/runner 0.2.0 → 0.3.0

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 CHANGED
@@ -34,10 +34,11 @@ export const config = defineBenchmarkConfig({
34
34
  });
35
35
 
36
36
  export const task = defineTask(async ({ participant, step, measure, log }) => {
37
- log(`creating sandbox on ${participant.name}`);
37
+ log('creating sandbox', { level: 'info', meta: { participant: participant.name } });
38
38
  // Named steps via `ctx.step`: values flow between steps with closures and
39
39
  // cleanup runs in a `finally`. Each step is a first-class platform record
40
- // with its own timing/status.
40
+ // with its own timing/status. A step returning `{ stdout, stderr, exitCode }`
41
+ // writes that output to the worker log unless `captureOutput: false` is passed.
41
42
  const sandbox = await step('create', () => participant.createCompute().sandbox.create());
42
43
  try {
43
44
  const t0 = performance.now();
@@ -55,6 +56,8 @@ Run it with the CLI (flags override the config knobs):
55
56
  bench run benchmarks/sandbox/sandbox-tti.bench.ts --iterations 100 --concurrency 20 --provider e2b,modal
56
57
  ```
57
58
 
59
+ `bench run` requires platform auth — `BENCHMARKS_PLATFORM_API_KEY`, `BENCHMARKS_PLATFORM_TOKEN`, or a token saved via `bench auth login` — even for `--dry-run` / `--no-ingest` / `BENCHSDK_NO_INGEST=1`; those flags only skip uploading, they do not skip auth.
60
+
58
61
  To load a TypeScript benchmark without a build step, run the CLI under a TS loader:
59
62
 
60
63
  ```sh
@@ -65,9 +68,28 @@ tsx node_modules/@benchsdk/runner/dist/bin.js run sandbox-tti.bench.ts
65
68
 
66
69
  Inside a task the context exposes three separate channels:
67
70
 
68
- - **`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.
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.
69
72
  - **`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.
70
- - **`log(message, meta?)`** — human-readable narration to the run timeline.
73
+ - **`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
+
75
+ ## Platform data commands
76
+
77
+ `bench` is a unified CLI. Besides `bench run`, it can authenticate and query the platform:
78
+
79
+ ```sh
80
+ bench auth login
81
+ bench benchmarks list
82
+ bench runs list <slug>
83
+ bench results <slug> --run <runId>
84
+ bench artifacts list <slug> <runId>
85
+ bench export <slug> --out ./exports
86
+ ```
87
+
88
+ See the [benchsdk-cli skill](../../.agents/skills/benchsdk-cli/SKILL.md) for the full CLI reference, OAuth device-code login, config/credentials files, and CI use.
89
+
90
+ ## Examples and full guide
91
+
92
+ For a step-by-step authoring guide and runnable examples covering every capability, see [`WRITING_BENCHMARKS.md`](../../WRITING_BENCHMARKS.md) and the [`examples/`](../../examples) directory.
71
93
 
72
94
  ## License
73
95