self-bench 0.3.0 → 0.3.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.
Files changed (66) hide show
  1. package/.dockerignore +10 -0
  2. package/Dockerfile +37 -0
  3. package/Dockerfile.sandbox +24 -0
  4. package/README.md +34 -26
  5. package/biome.json +18 -0
  6. package/bun.lock +1182 -0
  7. package/compose.yaml +85 -0
  8. package/dist/agent-smoke-main.js +1 -1
  9. package/dist/build-metadata.d.ts +2 -0
  10. package/dist/build-metadata.d.ts.map +1 -0
  11. package/dist/build-metadata.js +2 -0
  12. package/dist/build-metadata.js.map +1 -0
  13. package/dist/cli.js +18 -8
  14. package/dist/cli.js.map +1 -1
  15. package/dist/eval-main.js +1 -1
  16. package/dist/reaudit-main.js +1 -1
  17. package/dist/repair-main.js +1 -1
  18. package/dist/validate-main.js +1 -1
  19. package/docs/evaluations.md +67 -0
  20. package/docs/operations.md +178 -0
  21. package/docs/task-construction.md +94 -0
  22. package/package.json +28 -15
  23. package/scripts/verify-package.ts +57 -0
  24. package/scripts/write-build-metadata.ts +27 -0
  25. package/src/activities.ts +1236 -0
  26. package/src/agent-smoke-main.ts +63 -0
  27. package/src/agent-smoke.ts +132 -0
  28. package/src/api-main.ts +12 -0
  29. package/src/api.ts +239 -0
  30. package/src/artifacts.ts +361 -0
  31. package/src/audit.ts +106 -0
  32. package/src/build-metadata.ts +3 -0
  33. package/src/cli.ts +350 -0
  34. package/src/codex-review.ts +220 -0
  35. package/src/config.ts +117 -0
  36. package/src/contracts.ts +209 -0
  37. package/src/coupling.ts +259 -0
  38. package/src/docker-executor.ts +115 -0
  39. package/src/eval-main.ts +92 -0
  40. package/src/evaluate.ts +293 -0
  41. package/src/github.ts +26 -0
  42. package/src/harbor-results.ts +142 -0
  43. package/src/harbor-task.ts +528 -0
  44. package/src/hash.ts +5 -0
  45. package/src/modal-auth.ts +11 -0
  46. package/src/modal-executor.ts +176 -0
  47. package/src/parallel.ts +24 -0
  48. package/src/process.ts +165 -0
  49. package/src/provenance.ts +458 -0
  50. package/src/reaudit-main.ts +192 -0
  51. package/src/repair-main.ts +203 -0
  52. package/src/repair.ts +55 -0
  53. package/src/run-wait.ts +40 -0
  54. package/src/sandbox-author.ts +19 -0
  55. package/src/sandbox-repair.ts +160 -0
  56. package/src/sandbox-review.ts +17 -0
  57. package/src/sandbox-validation-repair.ts +174 -0
  58. package/src/sandbox.ts +51 -0
  59. package/src/subscription-auth.ts +67 -0
  60. package/src/temporal.ts +23 -0
  61. package/src/validate-main.ts +171 -0
  62. package/src/validation-repair.ts +94 -0
  63. package/src/worker-main.ts +32 -0
  64. package/src/workflow.ts +519 -0
  65. package/tsconfig.build.json +13 -0
  66. package/tsconfig.json +21 -0
package/.dockerignore ADDED
@@ -0,0 +1,10 @@
1
+ .git
2
+ .github
3
+ .selfbench
4
+ .venv
5
+ dist
6
+ jobs
7
+ node_modules
8
+ review
9
+ tests
10
+ *.md
package/Dockerfile ADDED
@@ -0,0 +1,37 @@
1
+ FROM oven/bun:1.3.14-debian AS build
2
+
3
+ WORKDIR /app
4
+ ARG SELFBENCH_BUILD_COMMIT
5
+ COPY package.json bun.lock ./
6
+ RUN bun install --frozen-lockfile
7
+ COPY biome.json tsconfig.json tsconfig.build.json ./
8
+ COPY src ./src
9
+ COPY scripts ./scripts
10
+ RUN bun run build:server
11
+
12
+ FROM docker:29.4.0-cli AS docker-cli
13
+
14
+ FROM node:22-bookworm
15
+
16
+ ARG HARBOR_VERSION=0.20.1.dev202608040148
17
+ RUN apt-get update \
18
+ && apt-get install -y --no-install-recommends bash ca-certificates curl gh git jq ripgrep tar \
19
+ && rm -rf /var/lib/apt/lists/* \
20
+ && curl -LsSf https://astral.sh/uv/0.11.3/install.sh | env UV_INSTALL_DIR=/usr/local/bin UV_NO_MODIFY_PATH=1 sh \
21
+ && env UV_PYTHON_INSTALL_DIR=/opt/uv-python UV_TOOL_DIR=/opt/uv-tools UV_TOOL_BIN_DIR=/usr/local/bin uv tool install --python 3.12 "harbor[modal]==${HARBOR_VERSION}" \
22
+ && chmod -R a+rX /opt/uv-python /opt/uv-tools
23
+ COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
24
+ COPY --from=docker-cli /usr/local/libexec/docker/cli-plugins /usr/local/libexec/docker/cli-plugins
25
+
26
+ ENV NODE_ENV=production
27
+ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
28
+ WORKDIR /app
29
+ RUN mkdir -p /var/lib/selfbench/artifacts && chown -R node:node /var/lib/selfbench
30
+ COPY --from=build /app/node_modules ./node_modules
31
+ COPY --from=build /app/dist ./dist
32
+ COPY src/extensions ./src/extensions
33
+ COPY src/skills ./src/skills
34
+ COPY package.json ./package.json
35
+
36
+ USER node
37
+ CMD ["node", "dist/api-main.js"]
@@ -0,0 +1,24 @@
1
+ FROM node:22-bookworm
2
+
3
+ ARG PI_VERSION=0.84.0
4
+ ARG CODEX_VERSION=0.146.1
5
+ ARG GH_VERSION=2.89.0
6
+ ARG TARGETARCH
7
+
8
+ RUN apt-get update \
9
+ && apt-get install -y --no-install-recommends bash ca-certificates curl git jq ripgrep unzip xz-utils \
10
+ && rm -rf /var/lib/apt/lists/*
11
+ RUN case "${TARGETARCH}" in \
12
+ amd64) GH_SHA256=d0422caade520530e76c1c558da47daebaa8e1203d6b7ff10ad7d6faba3490d8 ;; \
13
+ arm64) GH_SHA256=9e64a623dfc242990aa5d9b3f507111149c4282f66b68eaad1dc79eeb13b9ce5 ;; \
14
+ *) echo "unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
15
+ esac \
16
+ && curl -fsSL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${TARGETARCH}.tar.gz" -o /tmp/gh.tar.gz \
17
+ && echo "${GH_SHA256} /tmp/gh.tar.gz" | sha256sum -c - \
18
+ && tar -xzf /tmp/gh.tar.gz -C /tmp \
19
+ && mv "/tmp/gh_${GH_VERSION}_linux_${TARGETARCH}/bin/gh" /usr/local/bin/gh \
20
+ && rm -rf /tmp/gh.tar.gz "/tmp/gh_${GH_VERSION}_linux_${TARGETARCH}"
21
+ RUN npm install --global --ignore-scripts "@earendil-works/pi-coding-agent@${PI_VERSION}"
22
+ RUN npm install --global "@openai/codex@${CODEX_VERSION}"
23
+
24
+ WORKDIR /work
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  SelfBench turns completed GitHub changes into private [Harbor](https://harborframework.com/) evaluations for coding agents. It finds real feature requests, builds tasks from the repository's base commit, hides the tests and reference solution, and checks that each task fails without a solution and passes with one.
4
4
 
5
- SelfBench is a TypeScript package. Use **Bun** to install dependencies, build the package, and run the development CLI.
5
+ SelfBench is distributed as the [`self-bench`](https://www.npmjs.com/package/self-bench) package and installed with **Bun**.
6
6
 
7
7
  ## Choose your setup
8
8
 
@@ -15,33 +15,41 @@ After a run is submitted, the workflow continues independently of the waiting CL
15
15
 
16
16
  ## Prerequisites
17
17
 
18
- All setups require:
18
+ Installing the package requires [Bun](https://bun.sh/) 1.3.14 or newer. Running evaluations additionally requires:
19
19
 
20
- - [Bun](https://bun.sh/) 1.3.14 or newer
21
20
  - Docker with Compose
22
- - Node.js 22 or newer (the built service images use Node)
23
21
  - `gh`, authenticated with access to the source repository
24
22
  - Pi with an authenticated `openai-codex` account
25
23
  - Codex CLI with an authenticated account
26
24
 
27
25
  Modal execution additionally requires a Modal account and token. Temporal Cloud execution additionally requires a Temporal Cloud namespace and a durable artifact store such as Google Cloud Storage.
28
26
 
29
- ## Install from source
27
+ ## Install
30
28
 
31
- The package is not currently published to npm. Clone the repository and build it locally:
29
+ Install the CLI from the npm registry with Bun:
32
30
 
33
31
  ```bash
34
- git clone https://github.com/mupt-ai/self-bench.git
35
- cd self-bench
36
- bun install --frozen-lockfile
37
- bun run build
32
+ bun add --global self-bench
33
+ self-bench --help
38
34
  ```
39
35
 
40
- The compiled CLI is `dist/cli.js`, and the package exposes it as `selfbench`. To use `selfbench` directly from this checkout:
36
+ For one-off use without a global install:
41
37
 
42
38
  ```bash
39
+ bunx self-bench --help
40
+ ```
41
+
42
+ The package exposes `dist/cli.js` as `self-bench`.
43
+
44
+ To develop SelfBench itself, clone the repository and use Bun:
45
+
46
+ ```bash
47
+ git clone https://github.com/mupt-ai/self-bench.git
48
+ cd self-bench
49
+ bun install --frozen-lockfile
50
+ bun run build
43
51
  bun link
44
- selfbench --help
52
+ self-bench --help
45
53
  ```
46
54
 
47
55
  During development, run the TypeScript entrypoint without linking:
@@ -66,15 +74,15 @@ This starts Postgres, Temporal, the SelfBench API, and a worker on your machine.
66
74
  export SELFBENCH_API_TOKEN="$(openssl rand -hex 24)"
67
75
  export GH_TOKEN="$(gh auth token)"
68
76
 
69
- selfbench up --backend docker
77
+ self-bench up --backend docker
70
78
  export SELFBENCH_API_URL=http://127.0.0.1:8080
71
79
 
72
- selfbench run \
80
+ self-bench run \
73
81
  --repo /absolute/path/to/your/repository \
74
82
  --easy-count 30 \
75
83
  --medium-count 30 \
76
84
  --hard-count 10 \
77
- --output ./selfbench-evals.tar.gz
85
+ --output ./self-bench-evals.tar.gz
78
86
  ```
79
87
 
80
88
  The `--repo` directory must be a Git checkout with a GitHub `origin`. SelfBench pins the current `HEAD`; uncommitted changes are ignored. It discovers candidate requests from sanitized local coding-session messages and merged, non-bot GitHub pull requests.
@@ -86,10 +94,10 @@ A run may take hours. `--output` waits for the run to finish, then downloads and
86
94
  ## Local commands
87
95
 
88
96
  ```bash
89
- selfbench status RUN_ID
90
- selfbench list
91
- selfbench cancel RUN_ID
92
- selfbench download RUN_ID ./selfbench-evals.tar.gz
97
+ self-bench status RUN_ID
98
+ self-bench list
99
+ self-bench cancel RUN_ID
100
+ self-bench download RUN_ID ./self-bench-evals.tar.gz
93
101
  ```
94
102
 
95
103
  If you are working from source rather than using `bun link`, use the same commands through Bun:
@@ -111,7 +119,7 @@ Named Docker volumes retain Temporal history and generated artifacts. Back them
111
119
  For large repositories or unattended runs, use Temporal Cloud for workflow state and Modal for disposable execution sandboxes. Temporal Cloud does not host the SelfBench API or worker; deploy those separately.
112
120
 
113
121
  ```text
114
- selfbench CLI
122
+ self-bench CLI
115
123
  -> SelfBench API
116
124
  -> Temporal Cloud namespace
117
125
  -> persistent SelfBench worker
@@ -188,11 +196,11 @@ Provide the Codex auth JSON to the worker at `/home/node/.codex/auth.json` (the
188
196
  ### 4. Run against the hosted service
189
197
 
190
198
  ```bash
191
- selfbench run \
199
+ self-bench run \
192
200
  --repo /absolute/path/to/your/repository \
193
201
  --easy-count 2 \
194
202
  --medium-count 2 \
195
- --output ./selfbench-evals.tar.gz
203
+ --output ./self-bench-evals.tar.gz
196
204
  ```
197
205
 
198
206
  The CLI uploads only repository metadata and sanitized provenance. The worker performs discovery, authoring, sandbox validation, review, audit, and export remotely.
@@ -213,17 +221,17 @@ The local `up` command configures one execution backend for the stack:
213
221
 
214
222
  ```bash
215
223
  # Local Docker sandboxes; simplest, usually one activity at a time
216
- selfbench up --backend docker
224
+ self-bench up --backend docker
217
225
 
218
226
  # Modal sandboxes; better for concurrency and larger runs
219
227
  modal token new
220
- selfbench up --backend modal
228
+ self-bench up --backend modal
221
229
  ```
222
230
 
223
- For Modal, `selfbench up` uses `~/.modal.toml` by default. Override it with:
231
+ For Modal, `self-bench up` uses `~/.modal.toml` by default. Override it with:
224
232
 
225
233
  ```bash
226
- selfbench up --backend modal --modal-config /absolute/path/to/.modal.toml
234
+ self-bench up --backend modal --modal-config /absolute/path/to/.modal.toml
227
235
  ```
228
236
 
229
237
  ## Development
package/biome.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.5.7/schema.json",
3
+ "files": {
4
+ "includes": ["src/**/*.ts", "tests/**/*.ts", "review/src/**/*.{ts,tsx}"]
5
+ },
6
+ "formatter": {
7
+ "enabled": true,
8
+ "indentStyle": "space",
9
+ "indentWidth": 2,
10
+ "lineWidth": 100
11
+ },
12
+ "linter": {
13
+ "enabled": true,
14
+ "rules": {
15
+ "preset": "recommended"
16
+ }
17
+ }
18
+ }