@anyswarm/core 0.5.2 → 0.6.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/AGENTS.md +19 -4
- package/README.md +68 -61
- package/dist/examples/README.md +134 -84
- package/dist/examples/autoresearch/README.md +106 -21
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +14 -6
- package/dist/examples/autoresearch/config.d.ts +48 -5
- package/dist/examples/autoresearch/config.js +57 -23
- package/dist/examples/autoresearch/demo.d.ts +12 -4
- package/dist/examples/autoresearch/demo.js +65 -22
- package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -2
- package/dist/examples/autoresearch/frontiercs2-config.js +13 -2
- package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
- package/dist/examples/autoresearch/frontiercs2.js +71 -14
- package/dist/examples/autoresearch/prepare-demo.js +34 -3
- package/dist/examples/autoresearch/prepare.d.ts +105 -53
- package/dist/examples/autoresearch/prepare.js +126 -57
- package/dist/examples/autoresearch/project.d.ts +6 -1
- package/dist/examples/autoresearch/project.js +130 -26
- package/dist/examples/autoresearch/research-service.d.ts +16 -1
- package/dist/examples/autoresearch/research-service.js +84 -44
- package/dist/examples/code/config.d.ts +1 -0
- package/dist/examples/first-harness/AGENTS.md +25 -0
- package/dist/examples/first-harness/README.md +136 -0
- package/dist/examples/first-harness/config.d.ts +9 -8
- package/dist/examples/first-harness/config.js +33 -26
- package/dist/examples/first-harness/eject.json +14 -0
- package/dist/examples/first-harness/handoff.js +3 -3
- package/dist/examples/first-harness/harness.d.ts +14 -18
- package/dist/examples/first-harness/harness.js +102 -77
- package/dist/examples/first-harness/input/README.md +7 -0
- package/dist/examples/first-harness/session.js +2 -1
- package/dist/examples/first-harness/tsconfig.json +2 -1
- package/dist/examples/harness-session/README.md +1 -1
- package/dist/examples/lead-worker/README.md +1 -1
- package/dist/examples/lead-worker/project-config.d.ts +1 -0
- package/dist/examples/messages/README.md +2 -2
- package/dist/examples/notes/README.md +2 -2
- package/dist/examples/notes/config.d.ts +1 -0
- package/dist/examples/parallel-swarm/AGENTS.md +32 -0
- package/dist/examples/parallel-swarm/README.md +136 -0
- package/dist/examples/parallel-swarm/board-service.js +25 -8
- package/dist/examples/parallel-swarm/board.d.ts +31 -1
- package/dist/examples/parallel-swarm/board.js +98 -13
- package/dist/examples/parallel-swarm/config.d.ts +11 -0
- package/dist/examples/parallel-swarm/config.js +39 -0
- package/dist/examples/parallel-swarm/eject.json +5 -0
- package/dist/examples/parallel-swarm/harness.d.ts +26 -20
- package/dist/examples/parallel-swarm/harness.js +77 -76
- package/dist/examples/parallel-swarm/report.d.ts +12 -0
- package/dist/examples/parallel-swarm/report.js +30 -0
- package/dist/examples/peermesh/README.md +1 -1
- package/dist/examples/peermesh/project-config.d.ts +1 -0
- package/dist/examples/services/agent-control/README.md +1 -1
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/mcp-managed/README.md +1 -1
- package/dist/examples/services/persistent-board/README.md +1 -1
- package/dist/examples/subagents/AGENTS.md +35 -0
- package/dist/examples/subagents/README.md +129 -93
- package/dist/examples/subagents/config.d.ts +2 -10
- package/dist/examples/subagents/config.js +8 -15
- package/dist/examples/subagents/eject.json +17 -0
- package/dist/examples/subagents/handoff-config.d.ts +41 -0
- package/dist/examples/subagents/handoff-config.js +13 -0
- package/dist/examples/subagents/model.d.ts +3 -0
- package/dist/examples/subagents/model.js +19 -0
- package/dist/examples/substrate/README.md +12 -6
- package/dist/examples/substrate/config.d.ts +1 -0
- package/dist/examples/substrate/project-config.d.ts +1 -0
- package/dist/examples/taskpool/README.md +1 -1
- package/dist/examples/taskpool/config.d.ts +1 -0
- package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
- package/dist/scripts/anyswarm-progress.js +36 -5
- package/dist/scripts/build-provenance.json +1 -1
- package/dist/scripts/generate-architecture-coverage.js +1 -1
- package/dist/scripts/generate-architecture-prompts.js +18 -10
- package/dist/scripts/local-environment.d.ts +3 -3
- package/dist/scripts/local-environment.js +6 -1
- package/dist/scripts/local-setup.js +25 -18
- package/dist/scripts/pack-release.js +27 -3
- package/dist/src/core/index.js +1 -1
- package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
- package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
- package/dist/src/core/sandbox/sandbox-connection.js +22 -7
- package/dist/src/harness/project-harness.js +3 -2
- package/dist/src/harness/project-rpc-client.js +19 -0
- package/dist/src/harness/typescript-loader.d.ts +2 -0
- package/dist/src/harness/typescript-loader.js +26 -8
- package/dist/src/trace-viewer/command.mjs +6 -3
- package/dist/src/trace-viewer/public/app.js +239 -59
- package/dist/src/trace-viewer/public/index.html +5 -0
- package/dist/src/trace-viewer/public/style.css +22 -0
- package/dist/src/trace-viewer/reader.mjs +242 -26
- package/dist/src/trace-viewer/run-root.d.mts +1 -0
- package/dist/src/trace-viewer/run-root.mjs +7 -0
- package/dist/src/trace-viewer/server.mjs +3 -1
- package/docs/INDEX.md +9 -8
- package/docs/architecture/06-observability-experiments.md +21 -7
- package/docs/architecture/07-run-configuration.md +97 -12
- package/docs/architecture/08-prompts.md +21 -2
- package/docs/architecture/10-service-api-reference.md +12 -5
- package/docs/architecture/12-code-coverage.md +129 -86
- package/docs/architecture/15-core-runtime.md +1 -1
- package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
- package/docs/architecture/17-harness-reporting.md +78 -0
- package/docs/architecture/22-website.md +53 -18
- package/docs/architecture/23-project-harness.md +63 -16
- package/docs/architecture/28-autoresearch.md +16 -22
- package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
- package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
- package/docs/architecture/prompts/22-autoresearch.md +9 -2
- package/docs/architecture/prompts/source-manifest.json +78 -54
- package/docs/architecture/source-map.json +396 -36
- package/docs/designs/core-harness/06-project-harness.md +1 -1
- package/docs/en/autoresearch.md +41 -0
- package/docs/en/blog/100b-tokens.md +157 -0
- package/docs/en/build-your-harness.md +47 -22
- package/docs/en/changelog.md +22 -1
- package/docs/en/first-harness.md +40 -32
- package/docs/en/harnesses/index.md +23 -23
- package/docs/en/harnesses/subagents.md +8 -29
- package/docs/en/latest.md +26 -5
- package/docs/en/overview.md +22 -22
- package/docs/en/quickstart.md +55 -21
- package/docs/en/reference/api.md +1 -1
- package/docs/en/trace-viewer.md +32 -12
- package/docs/operations/trace-viewer.md +25 -10
- package/docs/workflows/development.md +160 -120
- package/docs/workflows/release-and-docs-versioning.md +207 -55
- package/docs/workflows/release-cli-acceptance.md +124 -47
- package/docs/zh/autoresearch.md +41 -0
- package/docs/zh/blog/100b-tokens.md +102 -0
- package/docs/zh/build-your-harness.md +48 -23
- package/docs/zh/changelog.md +22 -1
- package/docs/zh/first-harness.md +43 -35
- package/docs/zh/harnesses/index.md +23 -23
- package/docs/zh/harnesses/subagents.md +8 -29
- package/docs/zh/latest.md +26 -5
- package/docs/zh/overview.md +23 -23
- package/docs/zh/quickstart.md +51 -21
- package/docs/zh/reference/api.md +1 -1
- package/docs/zh/trace-viewer.md +32 -12
- package/examples/README.md +134 -84
- package/examples/autoresearch/README.md +106 -21
- package/examples/autoresearch/REQUIREMENTS.zh.md +14 -6
- package/examples/autoresearch/config.ts +64 -25
- package/examples/autoresearch/demo.ts +75 -22
- package/examples/autoresearch/frontiercs2-config.ts +13 -2
- package/examples/autoresearch/frontiercs2.ts +64 -11
- package/examples/autoresearch/prepare-demo.ts +32 -3
- package/examples/autoresearch/prepare.ts +134 -60
- package/examples/autoresearch/project.ts +119 -26
- package/examples/autoresearch/research-service.ts +91 -41
- package/examples/first-harness/AGENTS.md +25 -0
- package/examples/first-harness/README.md +136 -0
- package/examples/first-harness/config.ts +41 -27
- package/examples/first-harness/eject.json +14 -0
- package/examples/first-harness/handoff.ts +3 -3
- package/examples/first-harness/harness.ts +104 -72
- package/examples/first-harness/input/README.md +7 -0
- package/examples/first-harness/session.ts +2 -1
- package/examples/first-harness/tsconfig.json +2 -1
- package/examples/harness-session/README.md +1 -1
- package/examples/lead-worker/README.md +1 -1
- package/examples/messages/README.md +2 -2
- package/examples/notes/README.md +2 -2
- package/examples/parallel-swarm/AGENTS.md +32 -0
- package/examples/parallel-swarm/README.md +136 -0
- package/examples/parallel-swarm/board-service.ts +28 -9
- package/examples/parallel-swarm/board.ts +107 -13
- package/examples/parallel-swarm/config.ts +47 -0
- package/examples/parallel-swarm/eject.json +5 -0
- package/examples/parallel-swarm/harness.ts +83 -71
- package/examples/parallel-swarm/report.ts +33 -0
- package/examples/peermesh/README.md +1 -1
- package/examples/services/agent-control/README.md +1 -1
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/mcp-managed/README.md +1 -1
- package/examples/services/persistent-board/README.md +1 -1
- package/examples/subagents/AGENTS.md +35 -0
- package/examples/subagents/README.md +129 -93
- package/examples/subagents/config.ts +8 -15
- package/examples/subagents/eject.json +17 -0
- package/examples/subagents/handoff-config.ts +14 -0
- package/examples/subagents/model.ts +20 -0
- package/examples/substrate/README.md +12 -6
- package/examples/taskpool/README.md +1 -1
- package/npm-shrinkwrap.development.json +9 -2
- package/npm-shrinkwrap.json +9 -2
- package/package.development.json +2 -1
- package/package.json +2 -1
- package/scripts/anyswarm-progress.ts +36 -6
- package/scripts/generate-architecture-coverage.ts +1 -1
- package/scripts/generate-architecture-prompts.ts +21 -10
- package/scripts/local-environment.ts +8 -1
- package/scripts/local-setup.ts +22 -17
- package/scripts/pack-release.ts +24 -3
- package/src/core/index.ts +1 -1
- package/src/core/sandbox/opensandbox-backend.ts +10 -4
- package/src/core/sandbox/sandbox-connection.ts +22 -7
- package/src/harness/project-harness.ts +3 -2
- package/src/harness/project-rpc-client.ts +23 -0
- package/src/harness/typescript-loader.ts +28 -8
- package/src/trace-viewer/command.mjs +6 -3
- package/src/trace-viewer/public/app.js +239 -59
- package/src/trace-viewer/public/index.html +5 -0
- package/src/trace-viewer/public/style.css +22 -0
- package/src/trace-viewer/reader.mjs +242 -26
- package/src/trace-viewer/run-root.d.mts +1 -0
- package/src/trace-viewer/run-root.mjs +7 -0
- package/src/trace-viewer/server.mjs +3 -1
|
@@ -1,40 +1,125 @@
|
|
|
1
|
-
# AutoResearch
|
|
1
|
+
# AutoResearch with FrontierCS-2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run a team of independent research peers on the official `binary_fuse_filter` task. The peers write patches, inspect each other's work and share train feedback. At the end, the trusted evaluator runs the official final on the selected patch. Open Trace Viewer during the run or replay it afterward.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 1. Install and choose your backend
|
|
6
6
|
|
|
7
|
-
Use a Linux x86-64
|
|
7
|
+
Use a Linux x86-64 controller. The CLI supports Node.js 22.19 or newer. The exported TypeScript example is tested with Node.js 24 LTS. Install Git, Git LFS, Python 3, Docker Engine and Docker Buildx. For a new Debian 13 VM, install Docker Engine 29 and its Buildx plugin from Docker's apt repository. Debian 13's stock Docker 26 can pass the image-store check and still fail when Pumpkin tags a just-built image. [Install Docker Engine on Debian](https://docs.docker.com/engine/install/debian/)
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
sudo apt-get update
|
|
11
|
+
sudo apt-get install git git-lfs python3 ca-certificates curl xz-utils util-linux
|
|
12
|
+
sudo systemctl enable --now docker
|
|
13
|
+
docker version --format '{{ .Server.Version }}'
|
|
14
|
+
docker buildx version
|
|
15
|
+
docker info --format '{{ .DriverStatus }}'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If those Docker commands report permission denied on your own Linux VM, add your account to the Docker group with `sudo usermod -aG docker "$USER"` and open a fresh login session before retrying. Keep Docker management access on the controller. [AnySwarm setup guide](https://anyswarm.github.io/anyswarm/docs/quickstart/)
|
|
19
|
+
|
|
20
|
+
Before running AnySwarm setup, verify that the Docker output contains `io.containerd.snapshotter.v1`. Pumpkin needs the containerd image store to resolve pinned images by digest. On a fresh Linux VM where the marker is absent, add `"containerd-snapshotter": true` under `"features"` in `/etc/docker/daemon.json`, run `sudo systemctl restart docker`, and check again. Existing images and containers from the previous store become hidden when switching stores. On a shared host, choose or provision a suitable Docker context first. [Docker image store setup](https://docs.docker.com/engine/storage/containerd/)
|
|
21
|
+
|
|
22
|
+
Install the CLI from a release that includes this example using `npm install -g @anyswarm/core`, or use `npm install -g /path/to/anyswarm-core.tgz` for a supplied candidate archive. A user-owned Node installation lets you install these packages without `sudo`. If you choose Pi, install the executable before setup:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install -g @earendil-works/pi-coding-agent
|
|
26
|
+
anyswarm setup --backend pi
|
|
27
|
+
anyswarm doctor --smoke
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you choose Codex, install its executable, choose a Responses model, then use `anyswarm setup --backend codex` and `anyswarm doctor --smoke`. Use `--backend-path` if your executable is outside your shell path. For an existing deployment, set its Lifecycle URL and API key and use `anyswarm setup --mode existing`. Make the matching Worker image available on that deployment, configure `dns+nft` egress and a callback URL reachable from the Workers, then repeat `anyswarm doctor --mode existing --smoke`. Pumpkin and its judges still run on the controller's selected Docker daemon.
|
|
31
|
+
|
|
32
|
+
## 2. Export the example and configure your model and budget
|
|
8
33
|
|
|
9
34
|
```sh
|
|
10
35
|
anyswarm eject autoresearch --dir ./research-demo
|
|
11
36
|
cd ./research-demo
|
|
12
37
|
npm install
|
|
13
|
-
npm exec -- anyswarm run ./prepare-demo.ts
|
|
14
|
-
npm run start -- --config ./frontiercs2-config.ts --prompt "Run the prepared FrontierCS-2 task." --output-dir ./runs
|
|
15
38
|
```
|
|
16
39
|
|
|
17
|
-
|
|
40
|
+
Edit `frontiercs2-config.ts`. Its default export is the shared configuration for prepare and run. The supplied template reads these values from the current shell. Use the provider’s full HTTP request URL. Load the token from your own credential store.
|
|
41
|
+
|
|
42
|
+
| Setting | What to supply |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `ANYSWARM_MODEL_PROVIDER` | Your provider label |
|
|
45
|
+
| `ANYSWARM_MODEL_ID` | Exact model ID at the upstream |
|
|
46
|
+
| `ANYSWARM_MODEL_URL` | Full HTTP(S) request endpoint ending in `/v1/responses` or `/v1/chat/completions` for the built-in transports |
|
|
47
|
+
| `ANYSWARM_MODEL_PROTOCOL` | `responses` by default. For Pi with Chat Completions, set `chat-completions` |
|
|
48
|
+
| `ANYSWARM_MODEL_TOKEN` | Bearer token if the endpoint requires one. Load it into your shell from private storage |
|
|
49
|
+
| `ANYSWARM_AUTORESEARCH_STATE_DIR` | Optional path for prepared material and reference records |
|
|
50
|
+
|
|
51
|
+
For a Responses endpoint, replace the placeholders in this shell snippet. Keep the same shell or load the same settings before prepare and run.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export ANYSWARM_MODEL_PROVIDER='my-provider'
|
|
55
|
+
export ANYSWARM_MODEL_ID='model-id-from-my-provider'
|
|
56
|
+
export ANYSWARM_MODEL_URL='https://my-provider.example/v1/responses'
|
|
57
|
+
# Skip these two lines if your endpoint needs no bearer token.
|
|
58
|
+
read -rsp 'Model token: ' ANYSWARM_MODEL_TOKEN && printf '\n'
|
|
59
|
+
export ANYSWARM_MODEL_TOKEN
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You can supply an ordinary `ModelConfig` in the TypeScript file instead. For a reasoning model outside the executor catalog, set its catalog-backed `capabilities` with `contextWindow`, `maxOutputTokens`, `tools: true` and `reasoning`. Use `model.upstream.headers` for custom authentication. Supply `executor`, `image`, `sandbox` and `connection` to override your saved setup.
|
|
63
|
+
|
|
64
|
+
The template reserves two peers, a shared 12-minute search window, four train admissions and 128 new model requests across the team. You can edit `goal` and `budget`. An omitted `maxModelRequests` leaves the Gateway's request count uncapped. Set `continueAfterTrainBudget: true` if peers should keep reviewing and testing locally until another stop condition. The app budget and Pumpkin's official grant are reported independently.
|
|
65
|
+
|
|
66
|
+
## 3. Check and prepare
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm exec -- anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts --check
|
|
70
|
+
npm exec -- anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Read the `ACTION` lines to see which command or configuration field to fix. `--check` reports configuration, authentication, endpoint reachability, placement and available capacity. It makes a bounded HTTP HEAD probe to the model route and reports inference as unattempted. A successful real tool turn and continuation during the run establish actual inference.
|
|
18
74
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
75
|
+
| If a check reports an action | Where to start |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `model-config` | Check the exact model ID and request endpoint. Codex uses Responses. Pi can also use Chat Completions. |
|
|
78
|
+
| `model-http` | Check controller DNS and outbound access. For HTTP 401/403, check the model token and provider access. |
|
|
79
|
+
| `opensandbox`, `callback` or `worker-image` | Repeat `anyswarm setup` and `anyswarm doctor --smoke` for the selected backend. Existing deployments also need a Worker-reachable callback and the matching image. |
|
|
80
|
+
| `run-capacity` or `storage` | Compare the plan below with the reported controller resources. Check both the state directory and `TMPDIR`. |
|
|
81
|
+
| `task-materials` | Run prepare. Use a different state directory when switching Docker contexts. |
|
|
82
|
+
| Pumpkin reports `can't be tagged` and `No such image` after a build | Check the server version and Buildx on the selected context. Try Docker Engine 29 with Docker's Buildx plugin and the containerd image store, then rerun prepare. |
|
|
23
83
|
|
|
24
|
-
|
|
84
|
+
| Phase | Controller plan when Workers are local |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| Prepare | 8 vCPU, 14 GiB RAM for the reference or bridge check, controller and build headroom |
|
|
87
|
+
| Run, two Workers | 10 vCPU, 18 GiB RAM |
|
|
88
|
+
| Run, four Workers | 14 vCPU, 26 GiB RAM |
|
|
25
89
|
|
|
26
|
-
|
|
90
|
+
Each Worker, the submission bridge and the active judge have a 2 vCPU / 4 GiB allowance. For remote Workers, check their capacity and image separately. The controller still needs its own Docker capacity. Allow 12 GiB on the state mount, 1 GiB for temporary files and at least 25,000 free inodes on both mounts. No GPU is required.
|
|
91
|
+
|
|
92
|
+
Preparation fetches the pinned task and dependencies, checks Pumpkin, completes a no-model reference train and final and validates the submission bridge. The first prepare can take several minutes. Repeat the same command to reuse verified material and keep existing records.
|
|
93
|
+
|
|
94
|
+
## 4. Run and verify the result
|
|
27
95
|
|
|
28
96
|
```sh
|
|
29
|
-
|
|
30
|
-
anyswarm
|
|
97
|
+
npm exec -- anyswarm run ./project.ts --config ./frontiercs2-config.ts --prompt 'Run the FrontierCS-2 task.' --output-dir ./runs
|
|
98
|
+
npm exec -- anyswarm trace --root ./runs
|
|
31
99
|
```
|
|
32
100
|
|
|
33
|
-
|
|
101
|
+
Run the Trace command in another terminal to watch live. For a remote controller, use `ssh -N -L 8787:127.0.0.1:8787 user@controller` with your connection options. Open `http://127.0.0.1:8787` in your browser. Select the matching Run and use the **Research** track. Search by candidate ID or patch SHA-256, open the candidate and follow the related full-read, review, train and final records. **Related evidence** opens the saved patch with SHA-256 verification. The **Model** track shows the actual request intervals and saved upstream responses for each peer. Reopen the same Run after it finishes to replay it.
|
|
102
|
+
|
|
103
|
+
The Run directory contains:
|
|
104
|
+
|
|
105
|
+
- `research-result.json` with goal, model, budget, actual use, candidate list, best, selected, typed final result and separate cleanup receipts.
|
|
106
|
+
- `<runtime-id>/candidates/*.patch` with the immutable candidate files and `research-events.jsonl` with their research events.
|
|
107
|
+
- The `pumpkin/<run-id>/` record with the official admission and final verdict. Match the candidate's patch hash and the official payload digest in the research journal. Final metrics stay on the controller.
|
|
108
|
+
|
|
109
|
+
To inspect the selected patch against the clean baseline, copy the prepared state's `reference/tasks/binary_fuse_filter/repo` directory to scratch, then run `git apply --check /absolute/path/to/candidate.patch` and `git apply /absolute/path/to/candidate.patch` from the copy. The original official final is in the Run's Pumpkin record. Leave the prepared starter intact for the next run.
|
|
110
|
+
|
|
111
|
+
The final result distinguishes a valid score, objective attainment, rejection and an unconfirmed result. Set `targetScore` to add a numeric objective. The official comparison with the reference is recorded separately. The research timer starts when all peers are ready. Prepare, train settlement, final and cleanup take their own time. If cleanup is pending, use the recorded Runtime receipt and Pumpkin run/container IDs to check those specific resources. Keep those records until reconciliation.
|
|
112
|
+
|
|
113
|
+
## Use your own project and evaluator
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
anyswarm --harness autoresearch --config ./research.ts --prompt 'Your research objective' --output-dir ./runs
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Default-export a `ResearchConfiguration` from trusted TypeScript. Choose `targetPath` relative to the launch directory, or pass `--cwd`. Set `goal`, `direction` (`max` or `min`), optional `targetScore`, `budget`, `model`, `executor`, `image`, `sandbox` and `connection`. Use the exported `frontiercs2-config.ts` as the model and backend example.
|
|
120
|
+
|
|
121
|
+
Implement `evaluator.train(patch, signal, admitted)` and return `{ valid, score, feedback }`. Set `valid: true` for a legal zero score. Call `admitted(jobId)` when a trusted external job is accepted. Implement `evaluator.final(patch, signal)` returning `{ status, score, meetsObjective, evidence }`. Use `status: 'valid' | 'rejected' | 'unknown'`, `score: null` if unknown, and `meetsObjective: null` when no application objective was evaluated. Legacy JSON output remains visible as unconfirmed evidence. `start` and `close` own evaluator resources. Report pending resources through `evidence()`.
|
|
34
122
|
|
|
35
|
-
|
|
36
|
-
to install the pinned SDK, then run
|
|
37
|
-
`npm run start -- --cwd /path/to/project --config ./research.ts --prompt "Your objective"`.
|
|
38
|
-
The export includes the FrontierCS-2 preparation and adapter sources.
|
|
123
|
+
Keep model credentials, judges and Docker management on the host. Run candidate code only in evaluator-owned isolation, apply each patch to a clean baseline, bound every callback and honor its abort signal. Evaluate the selected patch independently and keep final feedback out of the search loop.
|
|
39
124
|
|
|
40
|
-
See
|
|
125
|
+
See the [中文需求和配置提示](REQUIREMENTS.zh.md).
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
# AutoResearch
|
|
1
|
+
# AutoResearch 需求与配置提示
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
用户选择 backend、模型、人数和预算后,同一份配置用于预检、准备和运行。成员平级,各自在独立 Sandbox 研究,可以分享候选、完整读取并互评。官方 train 反馈可用于搜索,final 只进入宿主结果。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 首次设置
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. 准备 Linux x86-64 控制端、Node.js 24 LTS、Git、Git LFS、Python 3、Docker 和 Buildx。新 Debian 13 VM 请从 Docker 官方 apt 仓库安装 Docker Engine 29 和 Buildx 插件。Debian 自带的 Docker 26 即使通过镜像存储检查,Pumpkin 给新构建的镜像打标签时仍可能报 `No such image`。`docker info --format '{{ .DriverStatus }}'` 必须显示 `io.containerd.snapshotter.v1`,Pumpkin 才能按 digest 找到镜像。请在 AnySwarm setup 之前打开这个镜像存储。切换会隐藏旧存储中的容器和镜像,共享主机请先选择合适的 Docker context。其他依赖和命令见 [README](README.md#1-install-and-choose-your-backend)、[Docker 安装文档](https://docs.docker.com/engine/install/debian/) 和 [镜像存储文档](https://docs.docker.com/engine/storage/containerd/)。
|
|
8
|
+
2. 先安装所选执行器。Pi 可用 `npm install -g @earendil-works/pi-coding-agent` 安装。安装 AnySwarm 后运行 `anyswarm setup --backend pi` 或 `anyswarm setup --backend codex`。已有 OpenSandbox 时使用 `--mode existing`,配置 Lifecycle 地址、鉴权、匹配的 Worker 镜像、`dns+nft` 和可达的回调。用 `anyswarm doctor --smoke` 检查连接及 Worker。
|
|
9
|
+
3. `anyswarm eject autoresearch --dir ./research-demo`,进入导出目录执行 `npm install`。编辑 `frontiercs2-config.ts`。模板所需的模型设置是 `ANYSWARM_MODEL_PROVIDER`、`ANYSWARM_MODEL_ID` 和请求 URL `ANYSWARM_MODEL_URL`。路由需要凭证时设置 `ANYSWARM_MODEL_TOKEN`。Pi 的 Chat Completions 路由需要另设 `ANYSWARM_MODEL_PROTOCOL=chat-completions`。也可直接传入普通 `ModelConfig`,并按模型目录填写推理与工具能力。
|
|
10
|
+
4. `npm exec -- anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts --check`。先处理 `ACTION` 行,再去掉 `--check` 准备固定材料。首次准备执行独立的官方无模型 reference。重复准备复用已验证材料和镜像。四 Peer、GPT-6.1 Sol、60 分钟是本机验收配置,导出的模板由用户选择模型和预算。
|
|
11
|
+
5. `npm exec -- anyswarm run ./project.ts --config ./frontiercs2-config.ts --prompt '运行 FrontierCS-2 任务' --output-dir ./runs`。模板默认 2 Peer、12 分钟、4 次 train 和 128 次团队新模型请求。修改 `budget` 会同时影响准备计划和实际运行。完整命令、资源表和自定义评测入口见 [README](README.md)。
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## 结果与验收
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
固定使用 FrontierCS-2 `7e48965c7cef2a567c2669c8e2f10b06386289c9` 的 `binary_fuse_filter` 和原有 Pumpkin 评测。Worker 只获得干净 starter 和公开 train 反馈。应用侧 train 上限、官方 grant 和团队模型预算分别记录。
|
|
16
|
+
|
|
17
|
+
在运行中或结束后执行 `npm exec -- anyswarm trace --root ./runs`。用候选 ID 或 patch SHA-256 找到同一次 Run 的候选、完整读取、具体 review、train 回执、最终选择和 final。若声称采用另一 Peer 的贡献,用实际 patch 差异核实改动。按 Model 泳道中的请求区间核对真实并行。合法低分、无效候选、终验未达业务目标和未确认结果独立记录。清理保留 Runtime 和评测器各自的状态与待核对资源。
|
|
18
|
+
|
|
19
|
+
验收从仓库外固定候选包开始。记录任务版本、候选包及 hash、真实 backend 和模型、用量、耗时、候选关系和两类清理。正式评测以 Pumpkin 原始回执为准。应用范围见 [#337](https://github.com/AnySwarm/anyswarm/issues/337),宿主入口见 [#351](https://github.com/AnySwarm/anyswarm/issues/351)。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExecutorSelection, type ModelConfig, type RuntimeConnectionOptions, type SandboxConfig } from '@anyswarm/core';
|
|
1
|
+
import { type ExecutorSelection, type HarnessContext, type ModelConfig, type RuntimeConnectionOptions, type SandboxConfig } from '@anyswarm/core';
|
|
2
2
|
import type { Evaluator } from './research-service.js';
|
|
3
3
|
export interface ResearchBudget {
|
|
4
4
|
workers: number;
|
|
@@ -9,6 +9,7 @@ export interface ResearchBudget {
|
|
|
9
9
|
export interface ResearchConfiguration {
|
|
10
10
|
targetPath?: string;
|
|
11
11
|
requiredFiles?: readonly string[];
|
|
12
|
+
validateStarter?(initial: HarnessContext['initial']): Promise<void>;
|
|
12
13
|
goal: string;
|
|
13
14
|
direction: 'max' | 'min';
|
|
14
15
|
targetScore?: number;
|
|
@@ -22,16 +23,43 @@ export interface ResearchConfiguration {
|
|
|
22
23
|
evaluationTimeoutMs?: number;
|
|
23
24
|
closeTimeoutMs?: number;
|
|
24
25
|
restrictNetwork?: boolean;
|
|
26
|
+
continueAfterTrainBudget?: boolean;
|
|
25
27
|
}
|
|
26
28
|
export declare const demoBudget: Readonly<ResearchBudget>;
|
|
27
|
-
export declare
|
|
29
|
+
export declare const smallBudget: Readonly<ResearchBudget>;
|
|
30
|
+
export declare function frontierBudget(budget?: ResearchBudget): ResearchBudget;
|
|
28
31
|
export declare const demoGoal = "Solve the official FrontierCS-2 binary_fuse_filter task described in README.md. The 8-bit and 16-bit population routines in include/binaryfusefilter.h are stubs. Implement both routines and send a complete first patch to public train promptly. If a local C compiler is unavailable, use train for compile and correctness feedback. Then explore memory, construction or lookup performance. Change only include/, coordinate directly and review peers\u2019 patches against the official public train feedback.";
|
|
29
32
|
export declare const demoCloseTimeoutMs = 365000;
|
|
30
33
|
export declare function frontierHome(): string;
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
type ResearchConnection = Pick<ResearchConfiguration, 'executor' | 'image' | 'sandbox' | 'connection'>;
|
|
35
|
+
export declare function defaultResearchConnection(options?: Partial<ResearchConnection>): {
|
|
36
|
+
executor: "codex" | "pi" | import("@anyswarm/core").BuiltinExecutorSelection | import("@anyswarm/core").ExecutorAdapter;
|
|
33
37
|
image: string;
|
|
38
|
+
preparedWorker: string | undefined;
|
|
34
39
|
sandbox: {
|
|
40
|
+
kind?: 'opensandbox';
|
|
41
|
+
execdToken?: string;
|
|
42
|
+
endpointHost?: string;
|
|
43
|
+
resourceRequests?: {
|
|
44
|
+
cpu: string;
|
|
45
|
+
memory: string;
|
|
46
|
+
};
|
|
47
|
+
commandTimeoutMs?: number;
|
|
48
|
+
timeoutSeconds?: number;
|
|
49
|
+
isolation?: {
|
|
50
|
+
network?: 'local-docker';
|
|
51
|
+
disk: {
|
|
52
|
+
bytes: number;
|
|
53
|
+
inodes: number;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
network?: 'api';
|
|
57
|
+
disk?: {
|
|
58
|
+
bytes: number;
|
|
59
|
+
inodes?: never;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
endpoint: undefined;
|
|
35
63
|
lifecycleBaseUrl: string;
|
|
36
64
|
apiKey: string | undefined;
|
|
37
65
|
useServerProxy: boolean | undefined;
|
|
@@ -42,10 +70,25 @@ export declare function defaultResearchConnection(): {
|
|
|
42
70
|
};
|
|
43
71
|
};
|
|
44
72
|
connection: {
|
|
73
|
+
bindHost?: string;
|
|
74
|
+
bindPort?: number;
|
|
75
|
+
bridge?: {
|
|
76
|
+
host?: string;
|
|
77
|
+
publicUrl?: string;
|
|
78
|
+
};
|
|
79
|
+
modelGateway?: {
|
|
80
|
+
host?: string;
|
|
81
|
+
advertiseHost?: string;
|
|
82
|
+
publicUrl?: string;
|
|
83
|
+
requestTimeoutMs?: number;
|
|
84
|
+
maxOutputTokens?: number | null;
|
|
85
|
+
maxRequests?: number;
|
|
86
|
+
};
|
|
45
87
|
publicUrl: string | undefined;
|
|
46
88
|
advertiseHost: string | undefined;
|
|
47
89
|
};
|
|
48
90
|
};
|
|
49
|
-
export declare function
|
|
91
|
+
export declare function modelFromEnvironment(env?: NodeJS.ProcessEnv): ModelConfig;
|
|
92
|
+
export declare function modelConfigurationError(model: ModelConfig | undefined, executor?: ExecutorSelection): string | undefined;
|
|
50
93
|
export declare function checkBudget(budget: ResearchBudget, minimum?: number): ResearchBudget;
|
|
51
94
|
export default undefined;
|
|
@@ -4,9 +4,11 @@ import { join, resolve } from 'node:path';
|
|
|
4
4
|
export const demoBudget = Object.freeze({
|
|
5
5
|
workers: 4, workMs: 720_000, maxEvaluations: 8,
|
|
6
6
|
});
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export const smallBudget = Object.freeze({
|
|
8
|
+
workers: 2, workMs: 720_000, maxEvaluations: 4, maxModelRequests: 128,
|
|
9
|
+
});
|
|
10
|
+
export function frontierBudget(budget = demoBudget) {
|
|
11
|
+
return checkBudget(budget, 2);
|
|
10
12
|
}
|
|
11
13
|
export const demoGoal = 'Solve the official FrontierCS-2 binary_fuse_filter task described in README.md. The 8-bit and 16-bit population routines in include/binaryfusefilter.h are stubs. Implement both routines and send a complete first patch to public train promptly. If a local C compiler is unavailable, use train for compile and correctness feedback. Then explore memory, construction or lookup performance. Change only include/, coordinate directly and review peers’ patches against the official public train feedback.';
|
|
12
14
|
export const demoCloseTimeoutMs = 365_000;
|
|
@@ -14,35 +16,67 @@ export function frontierHome() {
|
|
|
14
16
|
return resolve(process.env.ANYSWARM_AUTORESEARCH_STATE_DIR ??
|
|
15
17
|
join(process.env.XDG_STATE_HOME ?? join(homedir(), '.local', 'state'), 'anyswarm', 'autoresearch', 'frontiercs2'));
|
|
16
18
|
}
|
|
17
|
-
export function defaultResearchConnection() {
|
|
18
|
-
const
|
|
19
|
+
export function defaultResearchConnection(options = {}) {
|
|
20
|
+
const { sandbox, connection } = options;
|
|
21
|
+
const saved = resolveSandboxConnection({
|
|
22
|
+
...sandbox, publicUrl: connection?.publicUrl, advertiseHost: connection?.advertiseHost, image: options.image,
|
|
23
|
+
}, 'AUTORESEARCH', { includePreparedImage: true });
|
|
24
|
+
const executor = options.executor ?? saved.executor ?? 'pi';
|
|
25
|
+
const kind = typeof executor === 'string' ? executor : executor.kind;
|
|
19
26
|
return {
|
|
20
|
-
executor
|
|
21
|
-
image: saved.image ?? workerImageFor(
|
|
27
|
+
executor,
|
|
28
|
+
image: saved.image ?? workerImageFor(executor),
|
|
29
|
+
// Setup records the immutable image separately from the Runtime's local Worker selector.
|
|
30
|
+
preparedWorker: saved.image === undefined && saved.executor === kind ? saved.preparedImage : undefined,
|
|
22
31
|
sandbox: {
|
|
32
|
+
...sandbox, endpoint: undefined,
|
|
23
33
|
lifecycleBaseUrl: saved.lifecycleBaseUrl, apiKey: saved.apiKey,
|
|
24
34
|
useServerProxy: saved.useServerProxy, egressMode: saved.egressMode,
|
|
25
|
-
resourceLimits: { cpu: '2', memory: '4Gi' },
|
|
35
|
+
resourceLimits: sandbox?.resourceLimits ?? { cpu: '2', memory: '4Gi' },
|
|
26
36
|
},
|
|
27
|
-
connection: { publicUrl: saved.publicUrl, advertiseHost: saved.advertiseHost },
|
|
37
|
+
connection: { ...connection, publicUrl: saved.publicUrl, advertiseHost: saved.advertiseHost },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function modelFromEnvironment(env = process.env) {
|
|
41
|
+
const protocol = env.ANYSWARM_MODEL_PROTOCOL;
|
|
42
|
+
const token = env.ANYSWARM_MODEL_TOKEN;
|
|
43
|
+
return {
|
|
44
|
+
provider: env.ANYSWARM_MODEL_PROVIDER ?? '',
|
|
45
|
+
model: env.ANYSWARM_MODEL_ID ?? '',
|
|
46
|
+
protocol,
|
|
47
|
+
upstream: { url: env.ANYSWARM_MODEL_URL ?? '', headers: token ? { authorization: `Bearer ${token}` } : {} },
|
|
28
48
|
};
|
|
29
49
|
}
|
|
30
|
-
export function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
export function modelConfigurationError(model, executor) {
|
|
51
|
+
if (!model?.provider?.trim() || !model.model?.trim() || !model.upstream?.url || !model.upstream.headers) {
|
|
52
|
+
return 'Set model.provider, model.model and model.upstream in the shared configuration, or set ANYSWARM_MODEL_PROVIDER, ANYSWARM_MODEL_ID and ANYSWARM_MODEL_URL. Set ANYSWARM_MODEL_TOKEN if your endpoint requires a token.';
|
|
53
|
+
}
|
|
54
|
+
const url = URL.canParse(model.upstream.url) ? new URL(model.upstream.url) : undefined;
|
|
55
|
+
if (!url || !['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
|
|
56
|
+
return 'Use a full HTTP(S) request URL in model.upstream.url. Put credentials in protected headers instead of the URL.';
|
|
57
|
+
}
|
|
58
|
+
const protocol = typeof model.protocol === 'object' ? model.protocol.clientProtocol : model.protocol ?? 'responses';
|
|
59
|
+
const backend = typeof executor === 'object' ? executor.kind : executor;
|
|
60
|
+
if ((!protocol && typeof model.protocol !== 'object') || (backend === 'codex' && protocol !== 'responses') ||
|
|
61
|
+
(backend === 'pi' && protocol !== 'responses' && protocol !== 'chat-completions')) {
|
|
62
|
+
return 'Select a model protocol supported by your backend. Codex uses Responses. Pi supports Responses and Chat Completions.';
|
|
63
|
+
}
|
|
64
|
+
const suffix = protocol === 'chat-completions' ? '/v1/chat/completions' : '/v1/responses';
|
|
65
|
+
if (typeof model.protocol === 'object' ? model.protocol.validateUpstream(url) !== true : !url.pathname.endsWith(suffix)) {
|
|
66
|
+
return `Set the full model request URL for the selected protocol, ending in ${suffix} for the built-in transport.`;
|
|
67
|
+
}
|
|
68
|
+
if (model.provider === 'kimi_proxy' && model.model === 'k3' && protocol !== 'responses') {
|
|
69
|
+
return 'The kimi_proxy/k3 configuration requires a fixed /v1/responses URL without a query string.';
|
|
38
70
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
if (model.capabilities?.tools === false)
|
|
72
|
+
return 'Select a tool-capable model so peers can work on files and use the research Service.';
|
|
73
|
+
if (model.capabilities && (!Number.isSafeInteger(model.capabilities.contextWindow) ||
|
|
74
|
+
model.capabilities.contextWindow < 16 || !Number.isSafeInteger(model.capabilities.maxOutputTokens) ||
|
|
75
|
+
model.capabilities.maxOutputTokens < 16 || model.capabilities.maxOutputTokens > model.capabilities.contextWindow ||
|
|
76
|
+
typeof model.capabilities.reasoning !== 'boolean' || model.capabilities.tools !== true)) {
|
|
77
|
+
return 'Set capabilities from your provider catalog: contextWindow, maxOutputTokens, tools: true and reasoning.';
|
|
43
78
|
}
|
|
44
|
-
|
|
45
|
-
return { provider, model, upstream: { url: endpoint.href, headers: token ? { authorization: `Bearer ${token}` } : {} } };
|
|
79
|
+
return undefined;
|
|
46
80
|
}
|
|
47
81
|
export function checkBudget(budget, minimum = 1) {
|
|
48
82
|
const bounded = (value, min, max) => Number.isSafeInteger(value) && value >= min && value <= max;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { JsonValue } from '@anyswarm/core';
|
|
2
|
+
import type { FinalEvaluation } from './research-service.js';
|
|
2
3
|
import { type ResearchConfiguration } from './config.js';
|
|
4
|
+
import { FrontierRun } from './frontiercs2.js';
|
|
3
5
|
export declare function frontierTrainEvaluation(returned: Record<string, unknown>): {
|
|
4
6
|
valid: boolean;
|
|
5
7
|
score: number | null;
|
|
6
8
|
feedback: JsonValue;
|
|
7
9
|
};
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export declare function frontierFinalEvaluation(result: Awaited<ReturnType<FrontierRun['finish']>>, targetScore?: number): FinalEvaluation;
|
|
11
|
+
export interface FrontierConfiguration extends ResearchConfiguration {
|
|
12
|
+
frontierStateDir: string;
|
|
13
|
+
preparedWorker?: string;
|
|
14
|
+
}
|
|
15
|
+
type FrontierOptions = Partial<Pick<ResearchConfiguration, 'budget' | 'model' | 'goal' | 'executor' | 'image' | 'sandbox' | 'connection' | 'continueAfterTrainBudget' | 'targetScore'>> & {
|
|
16
|
+
home?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function frontierDemo(options?: FrontierOptions): FrontierConfiguration;
|
|
19
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { ProjectPreflightError } from '@anyswarm/core';
|
|
4
|
+
import { defaultResearchConnection, demoCloseTimeoutMs, demoGoal, frontierBudget, frontierHome, modelConfigurationError, modelFromEnvironment } from './config.js';
|
|
5
|
+
import { command, requireSuccess } from './process.js';
|
|
6
|
+
import { digest, FrontierRun, frontierFinalTimeMs, frontierSubmission, judgeTimeMs } from './frontiercs2.js';
|
|
7
|
+
import { loadPrepared, resourcePlan, starterPath } from './prepare.js';
|
|
5
8
|
export function frontierTrainEvaluation(returned) {
|
|
6
9
|
const observed = returned.raw_score;
|
|
7
10
|
const score = typeof observed === 'number' && Number.isFinite(observed) ? observed : null;
|
|
@@ -13,40 +16,80 @@ export function frontierTrainEvaluation(returned) {
|
|
|
13
16
|
feedback: returned,
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
|
-
export
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
19
|
+
export function frontierFinalEvaluation(result, targetScore) {
|
|
20
|
+
const values = new Map(result.verdict.result?.values?.map(({ name, value }) => [name, value]));
|
|
21
|
+
const reportedScore = values.get('score');
|
|
22
|
+
const score = typeof reportedScore === 'number' && Number.isFinite(reportedScore) ? reportedScore : null;
|
|
23
|
+
const reportedSummary = values.get('summary');
|
|
24
|
+
const summary = typeof reportedSummary === 'string' ? reportedSummary : null;
|
|
25
|
+
const beatsReference = values.get('beats_reference');
|
|
26
|
+
const evidence = { record: result.record, payload: result.submission.payload, summary,
|
|
27
|
+
beatsReference: beatsReference === 1 ? true : beatsReference === 0 ? false : null };
|
|
28
|
+
if (summary?.startsWith('invalid candidate:'))
|
|
29
|
+
return { status: 'rejected', score, meetsObjective: false, evidence };
|
|
30
|
+
if (score === null || !(summary === 'strict PASS' || summary?.startsWith('valid;'))) {
|
|
31
|
+
return { status: 'unknown', score: null, meetsObjective: null, evidence };
|
|
32
|
+
}
|
|
33
|
+
return { status: 'valid', score, meetsObjective: targetScore === undefined ? null : score >= targetScore, evidence };
|
|
34
|
+
}
|
|
35
|
+
export function frontierDemo(options = {}) {
|
|
36
|
+
const { home: stateDir = frontierHome(), executor, image, sandbox: worker, connection, ...settings } = options;
|
|
37
|
+
const home = resolve(stateDir);
|
|
38
|
+
const defaults = defaultResearchConnection({ executor, image, sandbox: worker, connection });
|
|
39
|
+
const budget = frontierBudget(settings.budget);
|
|
40
|
+
const model = settings.model ?? modelFromEnvironment();
|
|
41
|
+
const { sandbox } = defaults;
|
|
42
|
+
// The official bridge starts before the Workers. Budget startup, one active
|
|
43
|
+
// judge at the stop boundary, final and cleanup independently of research.
|
|
44
|
+
const setupSeconds = 360;
|
|
45
|
+
const settleSeconds = Math.ceil((judgeTimeMs + frontierFinalTimeMs + demoCloseTimeoutMs) / 1000);
|
|
46
|
+
const lifetimeSeconds = setupSeconds + Math.ceil(budget.workMs / 1000) + settleSeconds;
|
|
21
47
|
let frontier;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
let ready;
|
|
49
|
+
return {
|
|
50
|
+
...defaults, ...settings, model, restrictNetwork: true, goal: settings.goal ?? demoGoal, direction: 'max', budget,
|
|
51
|
+
sandbox: { ...sandbox, timeoutSeconds: sandbox.timeoutSeconds ?? lifetimeSeconds },
|
|
52
|
+
frontierStateDir: home,
|
|
53
|
+
targetPath: starterPath(home),
|
|
26
54
|
requiredFiles: ['README.md', 'include/binaryfusefilter.h'],
|
|
55
|
+
async validateStarter(initial) {
|
|
56
|
+
ready = await loadPrepared(home);
|
|
57
|
+
const tracked = requireSuccess(await command('git', ['ls-files', '-z', '--', '.'], { cwd: ready.starter, timeoutMs: 5000 }), 'Read tracked FrontierCS-2 starter files').split('\0').filter(Boolean);
|
|
58
|
+
const captured = new Map(initial.manifest.map(file => [file.path, file.sha256]));
|
|
59
|
+
const expected = await Promise.all(tracked.map(async (file) => [file, digest(await readFile(join(ready.starter, file)))]));
|
|
60
|
+
if (captured.size !== expected.length || expected.some(([path, hash]) => captured.get(path) !== hash)) {
|
|
61
|
+
throw new ProjectPreflightError('AUTORESEARCH_STARTER_CHANGED', 'Use the prepared, unchanged FrontierCS-2 starter. Remove --cwd when running the FrontierCS-2 configuration.');
|
|
62
|
+
}
|
|
63
|
+
},
|
|
27
64
|
evaluationTimeoutMs: judgeTimeMs + 25_000,
|
|
28
65
|
closeTimeoutMs: demoCloseTimeoutMs,
|
|
29
66
|
evaluator: {
|
|
30
67
|
async start(directory, signal) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
68
|
+
const problem = modelConfigurationError(model, defaults.executor);
|
|
69
|
+
if (problem)
|
|
70
|
+
throw new ProjectPreflightError('AUTORESEARCH_MODEL_REQUIRED', problem);
|
|
71
|
+
ready ??= await loadPrepared(home);
|
|
72
|
+
frontier = new FrontierRun(ready.paths, join(directory, 'pumpkin'));
|
|
73
|
+
await frontier.start(lifetimeSeconds, signal, undefined, budget.maxEvaluations);
|
|
74
|
+
if (frontier.imageId !== ready.saved.bridgeImage || JSON.stringify(frontier.judges) !== JSON.stringify(ready.saved.judges)) {
|
|
75
|
+
throw new Error('Pumpkin image identity changed after preparation. Run prepare again.');
|
|
35
76
|
}
|
|
36
77
|
},
|
|
37
78
|
async train(patch, signal, admitted) {
|
|
38
79
|
const receipt = await frontier.train(frontierSubmission(patch), signal, admitted);
|
|
39
|
-
return frontierTrainEvaluation(receipt.returned);
|
|
80
|
+
return { ...frontierTrainEvaluation(receipt.returned), payload: receipt.payload };
|
|
40
81
|
},
|
|
41
82
|
async final(patch, signal) {
|
|
42
|
-
return await frontier.finish(frontierSubmission(patch), signal);
|
|
83
|
+
return frontierFinalEvaluation(await frontier.finish(frontierSubmission(patch), signal), settings.targetScore);
|
|
43
84
|
},
|
|
44
85
|
async close() { return frontier ? await frontier.close() : 'complete'; },
|
|
45
86
|
evidence() {
|
|
46
|
-
return {
|
|
47
|
-
|
|
87
|
+
return {
|
|
88
|
+
reference: ready?.saved.referenceRecord ?? null, record: frontier?.record ?? null, bridgeImage: frontier?.imageId ?? null,
|
|
89
|
+
judges: frontier?.judges ?? null, grants: frontier?.grants ?? null, cleanup: frontier?.cleanupEvidence ?? null,
|
|
90
|
+
benchmark: ready?.saved.revision ?? null, pumpkin: ready?.saved.pumpkin ?? null, resources: resourcePlan(budget, sandbox),
|
|
91
|
+
};
|
|
48
92
|
},
|
|
49
93
|
},
|
|
50
94
|
};
|
|
51
|
-
return { configuration, starter };
|
|
52
95
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: import("./demo.js").FrontierConfiguration;
|
|
2
|
+
export default _default;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { frontierDemo } from './demo.js';
|
|
2
|
-
|
|
3
|
-
export default
|
|
2
|
+
import { modelFromEnvironment, smallBudget } from './config.js';
|
|
3
|
+
export default frontierDemo({
|
|
4
|
+
// Run anyswarm setup to choose an executor and Worker, or set executor, image,
|
|
5
|
+
// sandbox and connection here for an existing OpenSandbox deployment.
|
|
6
|
+
// Set ANYSWARM_MODEL_PROVIDER, ANYSWARM_MODEL_ID and ANYSWARM_MODEL_URL.
|
|
7
|
+
// Optional: ANYSWARM_MODEL_PROTOCOL (responses by default) and ANYSWARM_MODEL_TOKEN.
|
|
8
|
+
// You can replace this model with your own ModelConfig, including capabilities
|
|
9
|
+
// from your provider catalog for a reasoning model. Keep tokens in the environment.
|
|
10
|
+
model: modelFromEnvironment(),
|
|
11
|
+
budget: { ...smallBudget },
|
|
12
|
+
// For timed runs, set continueAfterTrainBudget: true to keep reviewing and
|
|
13
|
+
// testing locally after the last train admission, within the model budget.
|
|
14
|
+
});
|
|
@@ -4,6 +4,7 @@ export declare const frontierTask = "tasks/binary_fuse_filter/task.star";
|
|
|
4
4
|
export declare const submissionLimit: number;
|
|
5
5
|
export declare const judgeTimeMs = 190000;
|
|
6
6
|
export declare const frontierFinalTimeMs = 250000;
|
|
7
|
+
export declare function preparePumpkin(source: string, cache: string, signal: AbortSignal): Promise<void>;
|
|
7
8
|
export declare function digest(bytes: Uint8Array | string): string;
|
|
8
9
|
export declare function frontierSubmission(patch: Uint8Array): Buffer;
|
|
9
10
|
export declare const bridgeDockerfile = "FROM ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852\n";
|
|
@@ -51,16 +52,32 @@ export declare class FrontierRun {
|
|
|
51
52
|
container?: string;
|
|
52
53
|
imageId?: string;
|
|
53
54
|
judges?: JudgeImages;
|
|
55
|
+
grants?: {
|
|
56
|
+
trainCalls: number;
|
|
57
|
+
trainCumulativeSeconds: number;
|
|
58
|
+
judgeSeconds: number;
|
|
59
|
+
callTimeoutSeconds: number;
|
|
60
|
+
maxBytes: number;
|
|
61
|
+
};
|
|
62
|
+
cleanupEvidence: {
|
|
63
|
+
status: 'complete' | 'pending';
|
|
64
|
+
runIds: string[];
|
|
65
|
+
pendingContainers: string[];
|
|
66
|
+
};
|
|
54
67
|
private closed;
|
|
55
68
|
constructor(paths: FrontierPaths, runs: string);
|
|
56
69
|
private pumpkin;
|
|
57
70
|
private docker;
|
|
58
71
|
get record(): string | undefined;
|
|
59
|
-
start(seconds: number, signal: AbortSignal, timeoutMs?: number): Promise<void>;
|
|
72
|
+
start(seconds: number, signal: AbortSignal, timeoutMs?: number, maxEvaluations?: number): Promise<void>;
|
|
60
73
|
private call;
|
|
61
74
|
train(bytes: Uint8Array, signal: AbortSignal, onAdmission: (job: number) => void): Promise<{
|
|
62
75
|
job: number;
|
|
63
76
|
returned: Record<string, unknown>;
|
|
77
|
+
payload: {
|
|
78
|
+
digest: string;
|
|
79
|
+
size: number;
|
|
80
|
+
};
|
|
64
81
|
}>;
|
|
65
82
|
finish(bytes: Uint8Array, signal: AbortSignal): Promise<{
|
|
66
83
|
record: string;
|