@anyswarm/core 0.5.1 → 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 +20 -5
- package/README.md +69 -55
- package/dist/examples/README.md +138 -77
- package/dist/examples/authoring/README.md +4 -4
- package/dist/examples/autoresearch/README.md +108 -16
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- 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/eject.json +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
- package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
- package/dist/examples/autoresearch/frontiercs2.js +71 -14
- package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
- package/dist/examples/autoresearch/prepare-demo.js +46 -0
- 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 -95
- package/dist/examples/autoresearch/project.js +131 -45
- package/dist/examples/autoresearch/research-service.d.ts +16 -1
- package/dist/examples/autoresearch/research-service.js +84 -44
- package/dist/examples/code/README.md +25 -17
- package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
- 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 +4 -4
- 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 +5 -5
- 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 +6 -3
- 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 +9 -16
- 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/super/README.md +34 -22
- package/dist/examples/super/actions.d.ts +1 -1
- package/dist/examples/super/actions.js +11 -11
- package/dist/examples/super/config.js +3 -3
- package/dist/examples/super/eject.json +1 -1
- package/dist/examples/super/location.js +1 -1
- package/dist/examples/super/operator.d.ts +1 -0
- package/dist/examples/super/operator.js +31 -0
- package/dist/examples/super/project.d.ts +0 -107
- package/dist/examples/super/project.js +1 -3
- 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-arguments.d.ts +7 -25
- package/dist/scripts/anyswarm-arguments.js +69 -97
- package/dist/scripts/anyswarm-eject.js +1 -1
- package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
- package/dist/scripts/anyswarm-harnesses.js +1 -22
- package/dist/scripts/anyswarm-installation.d.ts +7 -40
- package/dist/scripts/anyswarm-installation.js +17 -291
- package/dist/scripts/anyswarm-launch.d.ts +6 -36
- package/dist/scripts/anyswarm-launch.js +32 -81
- package/dist/scripts/anyswarm-progress.d.ts +6 -0
- package/dist/scripts/anyswarm-progress.js +133 -0
- package/dist/scripts/anyswarm-project.d.ts +1 -9
- package/dist/scripts/anyswarm-project.js +40 -127
- package/dist/scripts/anyswarm-source-runner.js +9 -41
- package/dist/scripts/anyswarm.js +6 -26
- 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 +13 -7
- package/dist/scripts/local-environment.js +73 -21
- package/dist/scripts/local-setup.d.ts +3 -0
- package/dist/scripts/local-setup.js +153 -118
- package/dist/scripts/pack-release.js +31 -4
- 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/core/worker-image.js +1 -1
- package/dist/src/harness/project-harness.d.ts +1 -0
- package/dist/src/harness/project-harness.js +5 -4
- package/dist/src/harness/project-rpc-client.js +19 -0
- package/dist/src/harness/project-runtime.js +3 -1
- 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 +11 -9
- package/docs/architecture/04-services.md +1 -1
- package/docs/architecture/06-observability-experiments.md +21 -7
- package/docs/architecture/07-run-configuration.md +118 -19
- 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 +157 -115
- 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 +79 -1
- package/docs/architecture/22-website.md +52 -20
- package/docs/architecture/23-project-harness.md +109 -37
- package/docs/architecture/26-code.md +20 -5
- package/docs/architecture/27-personal.md +23 -8
- package/docs/architecture/28-autoresearch.md +18 -12
- package/docs/architecture/INDEX.md +1 -2
- 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 +76 -52
- package/docs/architecture/source-map.json +445 -105
- package/docs/designs/core-harness/01-core.md +2 -2
- package/docs/designs/core-harness/06-project-harness.md +3 -3
- package/docs/designs/core-harness/README.md +2 -2
- package/docs/en/agents.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 +29 -1
- package/docs/en/first-harness.md +40 -32
- package/docs/en/harnesses/index.md +23 -23
- package/docs/en/harnesses/lead-worker.md +1 -1
- package/docs/en/harnesses/peermesh.md +2 -2
- package/docs/en/harnesses/subagents.md +10 -31
- package/docs/en/harnesses/substrate.md +4 -4
- package/docs/en/harnesses/taskpool.md +2 -2
- package/docs/en/latest.md +30 -5
- package/docs/en/overview.md +22 -22
- package/docs/en/quickstart.md +69 -56
- package/docs/en/reference/api.md +1 -1
- package/docs/en/reference/cli.md +47 -85
- package/docs/en/sandbox.md +3 -3
- package/docs/en/trace-viewer.md +32 -12
- package/docs/operations/trace-viewer.md +26 -11
- package/docs/third-party-notices.md +0 -1
- package/docs/workflows/development.md +160 -118
- package/docs/workflows/release-and-docs-versioning.md +207 -54
- package/docs/workflows/release-cli-acceptance.md +162 -0
- package/docs/zh/agents.md +1 -1
- 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 +29 -1
- package/docs/zh/first-harness.md +43 -35
- package/docs/zh/harnesses/index.md +23 -23
- package/docs/zh/harnesses/lead-worker.md +1 -1
- package/docs/zh/harnesses/peermesh.md +2 -2
- package/docs/zh/harnesses/subagents.md +10 -31
- package/docs/zh/harnesses/substrate.md +4 -4
- package/docs/zh/harnesses/taskpool.md +2 -2
- package/docs/zh/latest.md +30 -5
- package/docs/zh/overview.md +23 -23
- package/docs/zh/quickstart.md +66 -57
- package/docs/zh/reference/api.md +1 -1
- package/docs/zh/reference/cli.md +19 -79
- package/docs/zh/sandbox.md +3 -3
- package/docs/zh/trace-viewer.md +32 -12
- package/examples/README.md +138 -77
- package/examples/authoring/README.md +4 -4
- package/examples/autoresearch/README.md +108 -16
- package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- package/examples/autoresearch/config.ts +64 -25
- package/examples/autoresearch/demo.ts +75 -22
- package/examples/autoresearch/eject.json +2 -0
- package/examples/autoresearch/frontiercs2-config.ts +15 -0
- package/examples/autoresearch/frontiercs2.ts +64 -11
- package/examples/autoresearch/prepare-demo.ts +44 -0
- package/examples/autoresearch/prepare.ts +134 -60
- package/examples/autoresearch/project.ts +120 -44
- package/examples/autoresearch/research-service.ts +91 -41
- package/examples/code/README.md +25 -17
- package/examples/code/REQUIREMENTS.zh.md +3 -3
- 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 +4 -4
- package/examples/lead-worker/README.md +1 -1
- package/examples/messages/README.md +2 -2
- package/examples/notes/README.md +5 -5
- 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 +6 -3
- package/examples/subagents/AGENTS.md +35 -0
- package/examples/subagents/README.md +129 -93
- package/examples/subagents/config.ts +9 -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/super/README.md +34 -22
- package/examples/super/actions.ts +11 -11
- package/examples/super/config.ts +3 -3
- package/examples/super/eject.json +1 -1
- package/examples/super/location.ts +1 -1
- package/examples/super/operator.ts +28 -0
- package/examples/super/project.ts +1 -3
- package/examples/taskpool/README.md +1 -1
- package/npm-shrinkwrap.development.json +46 -1538
- package/npm-shrinkwrap.json +10 -43
- package/package.development.json +3 -6
- package/package.json +3 -5
- package/scripts/anyswarm-arguments.ts +67 -96
- package/scripts/anyswarm-eject.ts +1 -1
- package/scripts/anyswarm-harnesses.ts +1 -18
- package/scripts/anyswarm-installation.ts +18 -294
- package/scripts/anyswarm-launch.ts +30 -102
- package/scripts/anyswarm-progress.ts +125 -0
- package/scripts/anyswarm-project.ts +31 -123
- package/scripts/anyswarm-source-runner.ts +9 -36
- package/scripts/anyswarm.ts +4 -24
- package/scripts/generate-architecture-coverage.ts +1 -1
- package/scripts/generate-architecture-prompts.ts +21 -10
- package/scripts/local-environment.ts +79 -21
- package/scripts/local-setup.ts +150 -105
- package/scripts/pack-release.ts +28 -4
- 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/core/worker-image.ts +1 -1
- package/src/harness/project-harness.ts +5 -4
- package/src/harness/project-rpc-client.ts +23 -0
- package/src/harness/project-runtime.ts +2 -1
- 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
- package/dist/scripts/anyswarm-applications.d.ts +0 -19
- package/dist/scripts/anyswarm-applications.js +0 -19
- package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
- package/dist/scripts/anyswarm-tui-config.js +0 -189
- package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
- package/dist/scripts/anyswarm-tui-session.js +0 -304
- package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
- package/dist/scripts/anyswarm-tui-terminal.js +0 -154
- package/dist/scripts/anyswarm-tui.d.ts +0 -2
- package/dist/scripts/anyswarm-tui.js +0 -1012
- package/docs/architecture/25-foreground-tui.md +0 -51
- package/scripts/anyswarm-applications.ts +0 -39
- package/scripts/anyswarm-tui-config.ts +0 -174
- package/scripts/anyswarm-tui-session.ts +0 -295
- package/scripts/anyswarm-tui-terminal.ts +0 -147
- package/scripts/anyswarm-tui.ts +0 -912
|
@@ -11,13 +11,13 @@ outside the checkout. Copy the example from that SDK.
|
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
13
|
npm init -y
|
|
14
|
-
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.
|
|
14
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
|
|
15
15
|
sdk=node_modules/@anyswarm/core
|
|
16
16
|
cp -R "$sdk"/examples/harness-session demo
|
|
17
17
|
cd demo
|
|
18
|
-
../node_modules/.bin/
|
|
19
|
-
../node_modules/.bin/
|
|
20
|
-
../node_modules/.bin/
|
|
18
|
+
../node_modules/.bin/anyswarm run ./sdk.ts /absolute/path/to/project 'Run the direct SDK example'
|
|
19
|
+
../node_modules/.bin/anyswarm run ./rpc.ts /absolute/path/to/project 'Run the RPC example'
|
|
20
|
+
../node_modules/.bin/anyswarm run ./terminal.ts /absolute/path/to/project 'Ask me the two business questions'
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
The SDK and RPC programs answer both questions and send a subsequent input
|
|
@@ -46,7 +46,7 @@ repository sources.
|
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
48
|
npm init -y
|
|
49
|
-
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.
|
|
49
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
|
|
50
50
|
npm install --save-dev typescript @types/node
|
|
51
51
|
sdk=node_modules/@anyswarm/core
|
|
52
52
|
cp -R "$sdk"/examples/lead-worker demo
|
|
@@ -42,7 +42,7 @@ example sources from the SDK you installed.
|
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
44
|
npm init -y
|
|
45
|
-
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.
|
|
45
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
|
|
46
46
|
npm install --save-dev typescript @types/node
|
|
47
47
|
cp -R node_modules/@anyswarm/core/examples/messages demo
|
|
48
48
|
cd demo
|
|
@@ -116,7 +116,7 @@ The external Service remains running after the Harness closes.
|
|
|
116
116
|
|
|
117
117
|
[`project.ts`](project.ts) consumes the user's directory and prompt.
|
|
118
118
|
[`handoff.ts`](handoff.ts) is a separate fixed-payload diagnostic, invoked from
|
|
119
|
-
the checkout root with `
|
|
119
|
+
the built checkout root with `node dist/scripts/anyswarm.js run ./examples/messages/handoff.ts`. It seeds a
|
|
120
120
|
value in the writer's files, then compares the reader's exported `received.txt`
|
|
121
121
|
byte for byte. Its report goes under `handoff-runs/` unless `ANYSWARM_SDK_OUTPUT`
|
|
122
122
|
overrides it. The common project runner has its own input and report handling.
|
|
@@ -32,7 +32,7 @@ This example requires Node.js 22.19 or newer, an authenticated OpenSandbox servi
|
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
34
|
npm init -y
|
|
35
|
-
npm install --omit=dev --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.
|
|
35
|
+
npm install --omit=dev --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
|
|
36
36
|
example=node_modules/@anyswarm/core/examples/notes
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -41,11 +41,11 @@ Set `ANYSWARM_NOTES_IMAGE` to your compatible worker image ID and `ANYSWARM_NOTE
|
|
|
41
41
|
The sample uses Pi and the configured common model route by default (`openai` / `gpt-5.4` when model labels are omitted). Common `ANYSWARM_MODEL_*` and `ANYSWARM_EXECUTOR` variables take precedence over scoped Notes variables. To run Codex, set `ANYSWARM_NOTES_EXECUTOR=codex` and `ANYSWARM_NOTES_MODEL_ID` to the model served by your endpoint. `ANYSWARM_NOTES_MODEL_PROVIDER` labels the model and defaults to `openai` for Codex. For a custom configuration module, set `executor` and its `models` mapping. The same Reader thread handles both reader inputs. See the [backend guide](../../docs/architecture/16-pi-opensandbox-backend.md#codex-app-server) for the credential and trace contract.
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
|
-
node_modules/.bin/
|
|
45
|
-
node_modules/.bin/
|
|
44
|
+
node_modules/.bin/anyswarm run "$example/main.ts" --help
|
|
45
|
+
node_modules/.bin/anyswarm run "$example/main.ts" "$example/config.ts" > notes-result.json
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
`main.ts` imports Runtime, Service Registry
|
|
48
|
+
`main.ts` imports Runtime, Service Registry, the configurable OpenSandbox backend, `runInput`, `runWithReport` and `readHarnessResult` from the public package exports. Turn order and business checks live in `main.ts`; the editable Service manifest and adapter live in `notes.ts`. Input/report/result helpers belong to the SDK rather than adjacent copied modules. The Harness uses `followUp` on an idle Agent after subscribing, with one input source and a fresh ID. An unknown or queued submission remains explicit and sends no replacement.
|
|
49
49
|
|
|
50
50
|
## Run and inspect the handoff
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@ Read the final CLI report from `notes-result.json`. It contains the Runtime iden
|
|
|
56
56
|
```sh
|
|
57
57
|
runtime_id=$(node -e 'const fs=require("node:fs"); console.log(JSON.parse(fs.readFileSync("notes-result.json","utf8")).runtimeId)')
|
|
58
58
|
run_dir=$(node -e 'const fs=require("node:fs"),path=require("node:path"); console.log(path.dirname(JSON.parse(fs.readFileSync("notes-result.json","utf8")).reportPath))')
|
|
59
|
-
node_modules/.bin/
|
|
59
|
+
node_modules/.bin/anyswarm run "$example/main.ts" --result "$run_dir" --runtime-id "$runtime_id"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Result inspection reads `harness-report.json` and `runtime.json`, checks both recorded identities, and projects business failure, recorded Core status, per-Agent execution/cleanup, pending count and artifact availability. It reports the Harness result's location without printing its content or interpreting business acceptance. Open the indicated Harness report's `result.verifiedFiles` and reader archive to inspect the actual checked deliverables. A pending receipt remains pending even if another recorded receipt later reports complete. This command reads saved files and does not contact or control a running Runtime.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Editing this Parallel Swarm Harness
|
|
2
|
+
|
|
3
|
+
These instructions are for a Coding Agent customizing the exported application.
|
|
4
|
+
Read `README.md`, then the actual collaboration in `harness.ts`, configuration
|
|
5
|
+
in `config.ts`, and the Board and report checks before changing behavior.
|
|
6
|
+
|
|
7
|
+
- Import SDK capabilities from `@anyswarm/core`. Use the installed public types;
|
|
8
|
+
do not depend on the AnySwarm repository's internal source or sibling examples.
|
|
9
|
+
- Keep the collaboration policy visible in ordinary TypeScript. One Harness
|
|
10
|
+
creates one Runtime with researcher and synthesizer Profiles; the CLI/SDK/RPC
|
|
11
|
+
clients use that same default Harness export.
|
|
12
|
+
- Read the user's repository from `context.initial.files` and their question
|
|
13
|
+
from `context.input.prompt`. Preserve snapshot identity and independent Agent
|
|
14
|
+
directories. Export results instead of modifying the user's original files.
|
|
15
|
+
- Honor `context.configuration`. Keep credentials in environment variables or
|
|
16
|
+
the user's private config, and preserve the selected executor and connection.
|
|
17
|
+
- Let the host assign author IDs and rounds. Keep Service permissions, exact
|
|
18
|
+
source checks and cross-author review checks when adapting the Board.
|
|
19
|
+
- Use `context.runWithRuntime` and `runInput` for owned work. Preserve cancellation,
|
|
20
|
+
finite waits, raw export/cleanup receipts and pending resources. A failed
|
|
21
|
+
business check is not a cleanup exception.
|
|
22
|
+
- State exactly what acceptance checks establish. Model text, file existence
|
|
23
|
+
and valid citations do not establish semantic correctness. Add a task-specific
|
|
24
|
+
checker only when the user has specified its actual acceptance rule.
|
|
25
|
+
- Verify changed behavior with focused deterministic checks and review the
|
|
26
|
+
resulting report. Use live model calls only within the user's authorized
|
|
27
|
+
endpoint, model and budget; identify any unrun integration checks honestly.
|
|
28
|
+
|
|
29
|
+
Run the edited source with `npm start -- --cwd /absolute/path/to/project
|
|
30
|
+
--prompt 'your question' --output-dir /absolute/path/to/runs`. The ejected
|
|
31
|
+
`package.json` pins the SDK archive recorded in `anyswarm-source.json`; changing
|
|
32
|
+
the application does not require a new AnySwarm framework or private API.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Parallel repository investigation
|
|
2
|
+
|
|
3
|
+
Ask a concrete question about a local repository and export an engineering
|
|
4
|
+
handoff or change-impact report. Three researchers inspect private copies of the
|
|
5
|
+
same captured input, publish source references to an in-process Board, and review
|
|
6
|
+
one another's findings. A fourth Agent integrates their work into `report.md`.
|
|
7
|
+
|
|
8
|
+
The complete collaboration policy is in `harness.ts`. The example uses public
|
|
9
|
+
`@anyswarm/core` APIs, one Runtime, and the same Harness definition for the CLI,
|
|
10
|
+
SDK and JSONL RPC. It has no mid-run questions or external business Services.
|
|
11
|
+
|
|
12
|
+
## Run your own repository question
|
|
13
|
+
|
|
14
|
+
Use AnySwarm 0.6.0 or a matching source build to export this example.
|
|
15
|
+
Prepare its Worker and OpenSandbox connection with `anyswarm setup`. You also
|
|
16
|
+
need a model endpoint reachable from the host and credentials for that endpoint;
|
|
17
|
+
setup's Sandbox selection does not configure your model account.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
anyswarm eject parallel-swarm --dir ./my-swarm
|
|
21
|
+
cd ./my-swarm
|
|
22
|
+
npm install
|
|
23
|
+
|
|
24
|
+
export ANYSWARM_MODEL_URL='https://your-provider.example/v1/responses'
|
|
25
|
+
export ANYSWARM_MODEL_ID='your-model'
|
|
26
|
+
# If required by your provider, set ANYSWARM_MODEL_TOKEN in your environment.
|
|
27
|
+
|
|
28
|
+
npm start -- \
|
|
29
|
+
--cwd /absolute/path/to/your-project \
|
|
30
|
+
--prompt 'Prepare an engineering handoff for this repository: identify the relevant entry points, configuration, main data flow and existing tests. Cite source paths and line numbers. Separate established facts from inferences and checks still needed.' \
|
|
31
|
+
--output-dir /absolute/path/to/runs
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Replace the question with your actual concern, for example: “We plan to change
|
|
35
|
+
how configuration is loaded; which modules and existing tests are involved, and
|
|
36
|
+
what still needs to be checked?” No Git diff or known repository defect is needed.
|
|
37
|
+
From this source directory the equivalent entry is
|
|
38
|
+
`anyswarm run ./harness.ts --cwd /absolute/path/to/your-project --prompt '…'`.
|
|
39
|
+
The exported package's `npm start` runs that same editable source.
|
|
40
|
+
|
|
41
|
+
Use `anyswarm trace --root /absolute/path/to/runs --open` to inspect the Run.
|
|
42
|
+
The final result's `artifacts` entry with `kind: "report"` names the actual
|
|
43
|
+
Markdown file. `result.detail.board` contains the findings, authenticated author
|
|
44
|
+
IDs, rounds, citations and checked source excerpts. The Runtime also exports the
|
|
45
|
+
Board's Service state. The original close receipt remains in `cleanup.receipt`.
|
|
46
|
+
|
|
47
|
+
Each Agent receives the captured project files selected by the SDK's file policy.
|
|
48
|
+
The host does not copy changes back to your repository. Researchers cannot write
|
|
49
|
+
their copies. The synthesizer can write its private copy and only `report.md` is
|
|
50
|
+
requested for collection. Changes made to your local project after input capture
|
|
51
|
+
are not part of this Run.
|
|
52
|
+
|
|
53
|
+
## Configuration and budgets
|
|
54
|
+
|
|
55
|
+
`harness.ts` uses `context.configuration` when supplied, including a CLI
|
|
56
|
+
`--config ./my-config.ts` module. That object is the complete configuration;
|
|
57
|
+
otherwise the Harness loads its own visible `config.ts`. It does not depend on a
|
|
58
|
+
configuration file from another example.
|
|
59
|
+
|
|
60
|
+
The default configuration resolves the saved setup connection and executor for
|
|
61
|
+
the selected endpoint. Common `ANYSWARM_*` model/executor variables override
|
|
62
|
+
`ANYSWARM_PARALLEL_SWARM_*` variables; the saved executor is the next fallback,
|
|
63
|
+
then Pi. Worker image and Sandbox connection overrides use the SDK's
|
|
64
|
+
`resolveSandboxConnection({}, 'PARALLEL_SWARM')` rules. A configured or saved
|
|
65
|
+
image is preserved; otherwise `workerImageFor(executor)` selects it.
|
|
66
|
+
|
|
67
|
+
| Setting | Default behavior |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `ANYSWARM_MODEL_URL` | Required model endpoint; scoped fallback is `ANYSWARM_PARALLEL_SWARM_MODEL_URL`. |
|
|
70
|
+
| `ANYSWARM_MODEL_ID`, `ANYSWARM_MODEL_PROVIDER` | Pi defaults to `gpt-5-mini` / `openai`; choose a model your provider supports. Codex requires an explicit model ID. |
|
|
71
|
+
| `ANYSWARM_MODEL_TOKEN` | Optional bearer token; keep it in the environment. |
|
|
72
|
+
| `ANYSWARM_EXECUTOR` | `pi` or `codex`; otherwise inherit setup's executor. |
|
|
73
|
+
| `ANYSWARM_MODEL_PROTOCOL` | `responses`; Pi also accepts `chat-completions`. Codex requires Responses. |
|
|
74
|
+
| `ANYSWARM_CONTEXT_WINDOW` | Optional explicit model context limit, at least 2,048 tokens. |
|
|
75
|
+
| `model`, `models` in a config module | Select a model alias and its complete public SDK model configuration. |
|
|
76
|
+
| `turnTimeoutMs`, `closeTimeoutMs` | 120 seconds for each owned Agent input and 60 seconds for close/reconciliation. All waits must be finite positive integers. |
|
|
77
|
+
|
|
78
|
+
When `ANYSWARM_CONTEXT_WINDOW` supplies capabilities for a custom model, the
|
|
79
|
+
default profile declares `reasoning: false`. If your Responses endpoint returns
|
|
80
|
+
reasoning items, set `models.default.capabilities.reasoning` to `true` in the
|
|
81
|
+
exported `config.ts` or in the full configuration you pass with `--config`.
|
|
82
|
+
Keep the context window and output limit appropriate for the selected model.
|
|
83
|
+
Otherwise the gateway can return `unsupported_responses_request` when the
|
|
84
|
+
executor includes a reasoning item in a subsequent request.
|
|
85
|
+
|
|
86
|
+
The example retains three researchers, two rounds, one synthesizer and a maximum
|
|
87
|
+
of four live Agents. Pi's default output cap is 2,048 tokens per model response;
|
|
88
|
+
Codex preserves executor output parameters. These bounds are configuration,
|
|
89
|
+
not a runtime or cost promise. Adjust the visible config to suit the question
|
|
90
|
+
and your authorized provider budget.
|
|
91
|
+
|
|
92
|
+
## What the host checks
|
|
93
|
+
|
|
94
|
+
1. Each of the three researchers publishes at least one first-round finding.
|
|
95
|
+
2. Every finding includes 1–8 source references. Each reference has a relative
|
|
96
|
+
`path`, 1-based `startLine` / `endLine`, and exact `excerpt` from the captured
|
|
97
|
+
input. Ranges contain 1–40 lines, excerpts are nonblank and at most 4,096 bytes,
|
|
98
|
+
and the final line separator is omitted. CRLF is normalized to LF for checking.
|
|
99
|
+
3. Each researcher publishes a new second-round review citing a first-round
|
|
100
|
+
finding by another author. The host assigns the round; clients cannot submit
|
|
101
|
+
an author or round override. Unknown citations and self-only reviews fail.
|
|
102
|
+
4. The synthesizer's required `report.md` is exported, readable as UTF-8 and
|
|
103
|
+
nonblank, within the 1 MiB collection limit. If the input already contained
|
|
104
|
+
`report.md`, an unchanged copy does not pass this export check.
|
|
105
|
+
|
|
106
|
+
`acceptance.status: "verified"` applies only to the listed collaboration and
|
|
107
|
+
export checks; `acceptance.semanticCorrectness` remains `"not-run"`. Source
|
|
108
|
+
locations matching the input do not prove that an excerpt supports a conclusion,
|
|
109
|
+
that reviews are useful, or that a report is complete. The host does not execute
|
|
110
|
+
project tests or validate Markdown citations against the Board. Read the report
|
|
111
|
+
and its evidence before using its recommendations.
|
|
112
|
+
|
|
113
|
+
Incomplete contributions stop the workflow before synthesis. Invalid evidence
|
|
114
|
+
is rejected by the Board without publication. A confirmed bad report is a
|
|
115
|
+
business verification failure, separate from resource cleanup. Unconfirmed
|
|
116
|
+
collection stays `export.status: "pending"` and retains the SDK receipt; it is
|
|
117
|
+
not reported as a confirmed missing file. Cleanup can remain pending even when
|
|
118
|
+
the report has already been exported and checked. Cancellation and Runtime
|
|
119
|
+
initialization errors retain the existing Harness result classification.
|
|
120
|
+
|
|
121
|
+
## Source and validation
|
|
122
|
+
|
|
123
|
+
| File | What to change |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| `harness.ts` | Research focus, prompts, rounds, Profiles, input handling and completion checks. |
|
|
126
|
+
| `config.ts` | Connections, executor/model selection, time limits and file policy. |
|
|
127
|
+
| `board.ts` | Source evidence checks, contribution accounting and review rules. |
|
|
128
|
+
| `board-service.ts` | Public Service schemas and authenticated caller mapping. |
|
|
129
|
+
| `report.ts` | Export verification, independently of close/cleanup classification. |
|
|
130
|
+
| `AGENTS.md` | Guidance for a Coding Agent editing this exported Harness. |
|
|
131
|
+
|
|
132
|
+
Repository tests exercise the Board and report failure cases, and run the real
|
|
133
|
+
HarnessSession/Runtime/Service Bridge with a controlled local transport. They
|
|
134
|
+
establish contract behavior, not model quality or compatibility with a particular
|
|
135
|
+
live model. A new paid model or Docker-based run is not implied by these tests;
|
|
136
|
+
record real-run evidence separately with its SDK, model, input and limitations.
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { createInProcessAdapter, serviceFromManifest, } from '@anyswarm/core';
|
|
2
|
+
const EVIDENCE_SCHEMA = {
|
|
3
|
+
type: 'array', minItems: 1, maxItems: 8,
|
|
4
|
+
items: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
path: { type: 'string', minLength: 1 },
|
|
8
|
+
startLine: { type: 'integer', minimum: 1 },
|
|
9
|
+
endLine: { type: 'integer', minimum: 1 },
|
|
10
|
+
excerpt: { type: 'string', minLength: 1, maxLength: 4096 },
|
|
11
|
+
},
|
|
12
|
+
required: ['path', 'startLine', 'endLine', 'excerpt'], additionalProperties: false,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
2
15
|
const FINDING_SCHEMA = {
|
|
3
16
|
type: 'object',
|
|
4
17
|
properties: {
|
|
5
18
|
id: { type: 'integer' },
|
|
6
19
|
authorId: { type: 'string' },
|
|
20
|
+
round: { type: 'string', enum: ['research', 'review'] },
|
|
7
21
|
topic: { type: 'string' },
|
|
8
22
|
summary: { type: 'string' },
|
|
23
|
+
evidence: EVIDENCE_SCHEMA,
|
|
9
24
|
cites: { type: 'array', items: { type: 'integer' } },
|
|
10
25
|
},
|
|
11
|
-
required: ['id', 'authorId', 'topic', 'summary', 'cites'],
|
|
26
|
+
required: ['id', 'authorId', 'round', 'topic', 'summary', 'evidence', 'cites'],
|
|
12
27
|
additionalProperties: false,
|
|
13
28
|
};
|
|
14
29
|
export function createBoardRegistration(board) {
|
|
@@ -18,25 +33,27 @@ export function createBoardRegistration(board) {
|
|
|
18
33
|
id: 'board',
|
|
19
34
|
title: 'Shared Research Board',
|
|
20
35
|
purpose: 'Publish, search, and cite findings across parallel swarm researchers.',
|
|
21
|
-
provider_version: '
|
|
36
|
+
provider_version: '2.0.0',
|
|
22
37
|
endpoint: { transport: 'in-process' },
|
|
23
38
|
capabilities: [
|
|
24
39
|
{
|
|
25
40
|
name: 'publish',
|
|
26
41
|
operation: 'publish',
|
|
27
|
-
description: 'Publish a
|
|
42
|
+
description: 'Publish a finding with exact source references. During review, cite another researcher\'s first-round finding. Source locations are checked; conclusions are not.',
|
|
28
43
|
side_effect: 'write',
|
|
29
44
|
idempotent: false,
|
|
30
45
|
help: { when: 'After discovering or cross-checking a concrete fact' },
|
|
31
|
-
errors: [
|
|
46
|
+
errors: ['NOT_FOUND', 'INVALID_EVIDENCE', 'INVALID_FINDING', 'REVIEW_REQUIRED', 'BOARD_CLOSED', 'NOT_RESEARCHER']
|
|
47
|
+
.map(code => ({ code, retryable: false })),
|
|
32
48
|
input_schema: {
|
|
33
49
|
type: 'object',
|
|
34
50
|
properties: {
|
|
35
51
|
topic: { type: 'string', minLength: 1, maxLength: 120 },
|
|
36
52
|
summary: { type: 'string', minLength: 1, maxLength: 2000 },
|
|
37
|
-
|
|
53
|
+
evidence: EVIDENCE_SCHEMA,
|
|
54
|
+
cites: { type: 'array', items: { type: 'integer', minimum: 1 }, maxItems: 8, uniqueItems: true },
|
|
38
55
|
},
|
|
39
|
-
required: ['topic', 'summary'],
|
|
56
|
+
required: ['topic', 'summary', 'evidence'],
|
|
40
57
|
additionalProperties: false,
|
|
41
58
|
},
|
|
42
59
|
output_schema: FINDING_SCHEMA,
|
|
@@ -67,8 +84,8 @@ export function createBoardRegistration(board) {
|
|
|
67
84
|
invoke({ capability, input, caller, assertAuthorized }) {
|
|
68
85
|
if (capability.operation === 'publish') {
|
|
69
86
|
assertAuthorized();
|
|
70
|
-
const { topic, summary, cites } = input;
|
|
71
|
-
return board.publish(caller.agentId, topic, summary, cites);
|
|
87
|
+
const { topic, summary, evidence, cites } = input;
|
|
88
|
+
return board.publish(caller.agentId, topic, summary, evidence, cites);
|
|
72
89
|
}
|
|
73
90
|
const { query } = input;
|
|
74
91
|
return { entries: board.search(query) };
|
|
@@ -1,16 +1,46 @@
|
|
|
1
|
+
import type { FileTree } from '@anyswarm/core';
|
|
2
|
+
export interface SourceReference {
|
|
3
|
+
path: string;
|
|
4
|
+
startLine: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
excerpt: string;
|
|
7
|
+
}
|
|
1
8
|
export interface Finding {
|
|
2
9
|
id: number;
|
|
3
10
|
authorId: string;
|
|
11
|
+
round: 'research' | 'review';
|
|
4
12
|
topic: string;
|
|
5
13
|
summary: string;
|
|
14
|
+
evidence: SourceReference[];
|
|
6
15
|
cites: number[];
|
|
7
16
|
}
|
|
17
|
+
/** Checks locations and exact excerpts, not whether they support a conclusion. */
|
|
18
|
+
export declare function verifySourceReference(files: FileTree, reference: SourceReference): SourceReference;
|
|
8
19
|
export declare class FindingsBoard {
|
|
20
|
+
private readonly files;
|
|
9
21
|
private entries;
|
|
10
|
-
|
|
22
|
+
private researchers;
|
|
23
|
+
private round;
|
|
24
|
+
constructor(files: FileTree);
|
|
25
|
+
beginResearch(researchers: readonly string[]): void;
|
|
26
|
+
beginReview(): void;
|
|
27
|
+
finishReview(): void;
|
|
28
|
+
private requireContributions;
|
|
29
|
+
publish(authorId: string, topic: string, summary: string, evidence: readonly SourceReference[], cites?: readonly number[]): Finding;
|
|
11
30
|
search(query?: string): Finding[];
|
|
31
|
+
contributions(): {
|
|
32
|
+
authorId: string;
|
|
33
|
+
research: number;
|
|
34
|
+
review: number;
|
|
35
|
+
}[];
|
|
12
36
|
exportState(): {
|
|
37
|
+
round: "closed" | "research" | "review" | "waiting";
|
|
13
38
|
total: number;
|
|
39
|
+
contributions: {
|
|
40
|
+
authorId: string;
|
|
41
|
+
research: number;
|
|
42
|
+
review: number;
|
|
43
|
+
}[];
|
|
14
44
|
entries: Finding[];
|
|
15
45
|
};
|
|
16
46
|
}
|
|
@@ -1,24 +1,109 @@
|
|
|
1
|
+
function reject(code, message) {
|
|
2
|
+
throw Object.assign(new Error(message), { code });
|
|
3
|
+
}
|
|
4
|
+
/** Checks locations and exact excerpts, not whether they support a conclusion. */
|
|
5
|
+
export function verifySourceReference(files, reference) {
|
|
6
|
+
const { path, startLine, endLine, excerpt } = reference;
|
|
7
|
+
if (typeof path !== 'string' || !path || /[\\\0]/.test(path) || /^[A-Za-z]:/.test(path) ||
|
|
8
|
+
path.split('/').some(part => !part || part === '.' || part === '..') || !Object.hasOwn(files, path)) {
|
|
9
|
+
reject('INVALID_EVIDENCE', 'Evidence must name a relative file in this Run\'s input snapshot');
|
|
10
|
+
}
|
|
11
|
+
if (!Number.isSafeInteger(startLine) || !Number.isSafeInteger(endLine) || startLine < 1 || endLine < startLine ||
|
|
12
|
+
endLine - startLine >= 40 || typeof excerpt !== 'string' || !excerpt.trim() || Buffer.byteLength(excerpt) > 4096) {
|
|
13
|
+
reject('INVALID_EVIDENCE', 'Evidence requires 1–40 source lines and an exact, nonblank excerpt of at most 4096 bytes');
|
|
14
|
+
}
|
|
15
|
+
const entry = files[path];
|
|
16
|
+
let text;
|
|
17
|
+
try {
|
|
18
|
+
const bytes = Buffer.from(entry.data, entry.encoding === 'base64' ? 'base64' : 'utf8');
|
|
19
|
+
text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes).replaceAll('\r\n', '\n');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
reject('INVALID_EVIDENCE', 'Evidence must refer to a UTF-8 source file');
|
|
23
|
+
}
|
|
24
|
+
const lines = text.split('\n');
|
|
25
|
+
if (lines.at(-1) === '')
|
|
26
|
+
lines.pop();
|
|
27
|
+
const normalized = excerpt.replaceAll('\r\n', '\n');
|
|
28
|
+
if (endLine > lines.length || normalized !== lines.slice(startLine - 1, endLine).join('\n')) {
|
|
29
|
+
reject('INVALID_EVIDENCE', 'The line range and excerpt do not match the captured source');
|
|
30
|
+
}
|
|
31
|
+
return { path, startLine, endLine, excerpt: normalized };
|
|
32
|
+
}
|
|
1
33
|
export class FindingsBoard {
|
|
34
|
+
files;
|
|
2
35
|
entries = [];
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
36
|
+
researchers = [];
|
|
37
|
+
round = 'waiting';
|
|
38
|
+
constructor(files) {
|
|
39
|
+
this.files = files;
|
|
40
|
+
}
|
|
41
|
+
beginResearch(researchers) {
|
|
42
|
+
if (this.round !== 'waiting' || researchers.length < 2 || new Set(researchers).size !== researchers.length ||
|
|
43
|
+
researchers.some(id => typeof id !== 'string' || !id)) {
|
|
44
|
+
reject('INVALID_ROUND', 'Start one research round with distinct researcher identities');
|
|
10
45
|
}
|
|
11
|
-
|
|
46
|
+
this.researchers = [...researchers];
|
|
47
|
+
this.round = 'research';
|
|
48
|
+
}
|
|
49
|
+
beginReview() {
|
|
50
|
+
if (this.round !== 'research')
|
|
51
|
+
reject('INVALID_ROUND', 'The review round must follow research');
|
|
52
|
+
this.requireContributions('research');
|
|
53
|
+
this.round = 'review';
|
|
54
|
+
}
|
|
55
|
+
finishReview() {
|
|
56
|
+
if (this.round !== 'review')
|
|
57
|
+
reject('INVALID_ROUND', 'Finish the review round before synthesis');
|
|
58
|
+
this.requireContributions('review');
|
|
59
|
+
this.round = 'closed';
|
|
60
|
+
}
|
|
61
|
+
requireContributions(round) {
|
|
62
|
+
const missing = this.researchers.filter(id => !this.entries.some(entry => entry.authorId === id && entry.round === round));
|
|
63
|
+
if (missing.length)
|
|
64
|
+
reject(round === 'research' ? 'RESEARCH_INCOMPLETE' : 'REVIEW_INCOMPLETE', `Missing ${round} contribution from ${missing.join(', ')}`);
|
|
65
|
+
}
|
|
66
|
+
publish(authorId, topic, summary, evidence, cites = []) {
|
|
67
|
+
if (this.round !== 'research' && this.round !== 'review')
|
|
68
|
+
reject('BOARD_CLOSED', 'The Board is not accepting publications');
|
|
69
|
+
if (!this.researchers.includes(authorId))
|
|
70
|
+
reject('NOT_RESEARCHER', 'Only this Run\'s researchers may publish');
|
|
71
|
+
if (typeof topic !== 'string' || !topic.trim() || topic.length > 120 ||
|
|
72
|
+
typeof summary !== 'string' || !summary.trim() || summary.length > 2000) {
|
|
73
|
+
reject('INVALID_FINDING', 'Provide a topic and a concise summary');
|
|
74
|
+
}
|
|
75
|
+
if (!Array.isArray(evidence) || evidence.length < 1 || evidence.length > 8) {
|
|
76
|
+
reject('INVALID_EVIDENCE', 'Each finding needs 1–8 source references');
|
|
77
|
+
}
|
|
78
|
+
const checked = evidence.map(reference => verifySourceReference(this.files, reference));
|
|
79
|
+
if (!Array.isArray(cites) || cites.length > 8 || new Set(cites).size !== cites.length) {
|
|
80
|
+
reject('NOT_FOUND', 'Citations must name at most eight distinct existing findings');
|
|
81
|
+
}
|
|
82
|
+
const cited = cites.map(id => {
|
|
83
|
+
const entry = this.entries.find(entry => entry.id === id);
|
|
84
|
+
if (!entry)
|
|
85
|
+
reject('NOT_FOUND', `Referenced finding #${id} does not exist`);
|
|
86
|
+
return entry;
|
|
87
|
+
});
|
|
88
|
+
if (this.round === 'review' && !cited.some(entry => entry.authorId !== authorId && entry.round === 'research')) {
|
|
89
|
+
reject('REVIEW_REQUIRED', 'A review must cite another researcher\'s first-round finding');
|
|
90
|
+
}
|
|
91
|
+
const entry = { id: this.entries.length + 1, authorId, round: this.round, topic, summary,
|
|
92
|
+
evidence: checked, cites: [...cites] };
|
|
12
93
|
this.entries.push(entry);
|
|
13
|
-
return entry;
|
|
94
|
+
return structuredClone(entry);
|
|
14
95
|
}
|
|
15
96
|
search(query = '') {
|
|
16
97
|
const q = query.trim().toLowerCase();
|
|
17
|
-
return q
|
|
18
|
-
|
|
19
|
-
|
|
98
|
+
return structuredClone(q ? this.entries.filter(entry => `${entry.topic} ${entry.summary}`.toLowerCase().includes(q)) : this.entries);
|
|
99
|
+
}
|
|
100
|
+
contributions() {
|
|
101
|
+
return this.researchers.map(authorId => ({ authorId,
|
|
102
|
+
research: this.entries.filter(entry => entry.authorId === authorId && entry.round === 'research').length,
|
|
103
|
+
review: this.entries.filter(entry => entry.authorId === authorId && entry.round === 'review').length,
|
|
104
|
+
}));
|
|
20
105
|
}
|
|
21
106
|
exportState() {
|
|
22
|
-
return { total: this.entries.length,
|
|
107
|
+
return { round: this.round, total: this.entries.length, contributions: this.contributions(), entries: this.search() };
|
|
23
108
|
}
|
|
24
109
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CreateRuntimeOptions, type SandboxConfig } from '@anyswarm/core';
|
|
2
|
+
export interface ParallelSwarmConfig extends Pick<CreateRuntimeOptions, 'executor' | 'connection' | 'models' | 'filePolicy'> {
|
|
3
|
+
sandbox: SandboxConfig;
|
|
4
|
+
image: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
turnTimeoutMs?: number;
|
|
7
|
+
closeTimeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function parallelSwarmConfig(): ParallelSwarmConfig;
|
|
10
|
+
declare const _default: ParallelSwarmConfig;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ProjectPreflightError, resolveSandboxConnection, workerImageFor } from '@anyswarm/core';
|
|
2
|
+
function invalid(message) {
|
|
3
|
+
throw new ProjectPreflightError('INVALID_RUN_CONFIGURATION', message);
|
|
4
|
+
}
|
|
5
|
+
export function parallelSwarmConfig() {
|
|
6
|
+
const env = process.env;
|
|
7
|
+
const setting = (key) => env[`ANYSWARM_${key}`] ?? env[`ANYSWARM_PARALLEL_SWARM_${key}`];
|
|
8
|
+
const { image, advertiseHost, publicUrl, endpointSource: _source, executor: setupExecutor, ...sandbox } = resolveSandboxConnection({}, 'PARALLEL_SWARM');
|
|
9
|
+
const executor = setting('EXECUTOR') ?? setupExecutor ?? 'pi';
|
|
10
|
+
if (executor !== 'pi' && executor !== 'codex')
|
|
11
|
+
invalid('Select pi or codex with ANYSWARM_EXECUTOR.');
|
|
12
|
+
const url = setting('MODEL_URL');
|
|
13
|
+
if (!url)
|
|
14
|
+
invalid('Set ANYSWARM_MODEL_URL to your model endpoint before running Parallel Swarm.');
|
|
15
|
+
const protocol = setting('MODEL_PROTOCOL') ?? 'responses';
|
|
16
|
+
if (protocol !== 'responses' && protocol !== 'chat-completions')
|
|
17
|
+
invalid('Select responses or chat-completions with ANYSWARM_MODEL_PROTOCOL.');
|
|
18
|
+
if (executor === 'codex' && protocol !== 'responses')
|
|
19
|
+
invalid('The Codex executor requires a Responses model endpoint.');
|
|
20
|
+
const model = setting('MODEL_ID') ?? (executor === 'pi' ? 'gpt-5-mini' : undefined);
|
|
21
|
+
if (!model)
|
|
22
|
+
invalid('Set ANYSWARM_MODEL_ID to a model supported by the selected Codex executor.');
|
|
23
|
+
const token = setting('MODEL_TOKEN');
|
|
24
|
+
const contextWindow = setting('CONTEXT_WINDOW') === undefined ? undefined : Number(setting('CONTEXT_WINDOW'));
|
|
25
|
+
if (contextWindow !== undefined && (!Number.isSafeInteger(contextWindow) || contextWindow < 2048)) {
|
|
26
|
+
invalid('ANYSWARM_CONTEXT_WINDOW must be the model context limit, at least 2048 tokens.');
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
sandbox, executor, image: image ?? workerImageFor(executor), model: 'default',
|
|
30
|
+
turnTimeoutMs: 120_000, closeTimeoutMs: 60_000,
|
|
31
|
+
connection: { advertiseHost, publicUrl, modelGateway: { maxOutputTokens: executor === 'codex' ? null : 2048 } },
|
|
32
|
+
models: { default: {
|
|
33
|
+
provider: setting('MODEL_PROVIDER') ?? 'openai', model, protocol,
|
|
34
|
+
...(contextWindow ? { capabilities: { contextWindow, maxOutputTokens: 2048, tools: true, reasoning: false } } : {}),
|
|
35
|
+
upstream: { url, headers: token ? { authorization: `Bearer ${token}` } : {} },
|
|
36
|
+
} },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default parallelSwarmConfig();
|
|
@@ -2,31 +2,37 @@ declare const parallelSwarm: {
|
|
|
2
2
|
id: string;
|
|
3
3
|
apiVersion: 1;
|
|
4
4
|
run(context: import("@anyswarm/core").HarnessContext): Promise<{
|
|
5
|
-
outcome:
|
|
5
|
+
outcome: 'completed' | 'failed' | 'cancelled';
|
|
6
6
|
reason: string;
|
|
7
|
-
result
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
result?: import("@anyswarm/core").HarnessJson;
|
|
8
|
+
export?: {
|
|
9
|
+
status: 'complete' | 'failed' | 'pending';
|
|
10
|
+
receipt?: import("@anyswarm/core").HarnessJson;
|
|
11
|
+
};
|
|
12
|
+
cleanup: {
|
|
13
|
+
status: 'complete' | 'pending';
|
|
14
|
+
receipt?: import("@anyswarm/core").HarnessJson;
|
|
15
|
+
pending?: import("@anyswarm/core").HarnessJson;
|
|
16
|
+
retained?: import("@anyswarm/core").HarnessJson;
|
|
11
17
|
};
|
|
12
18
|
acceptance: {
|
|
13
19
|
status: string;
|
|
20
|
+
scope: string;
|
|
21
|
+
research: string;
|
|
22
|
+
review: string;
|
|
23
|
+
sourceReferences: string;
|
|
24
|
+
report: {
|
|
25
|
+
status: 'not-run' | 'pending' | 'unverified';
|
|
26
|
+
reason: string;
|
|
27
|
+
} | {
|
|
28
|
+
status: 'verified';
|
|
29
|
+
path: string;
|
|
30
|
+
sha256: string;
|
|
31
|
+
bytes: number;
|
|
32
|
+
};
|
|
33
|
+
semanticCorrectness: string;
|
|
14
34
|
};
|
|
15
|
-
artifacts:
|
|
16
|
-
path: string;
|
|
17
|
-
sha256: string;
|
|
18
|
-
}[];
|
|
19
|
-
export?: {
|
|
20
|
-
status: "complete" | "failed";
|
|
21
|
-
} | undefined;
|
|
22
|
-
cleanup: {
|
|
23
|
-
status: "complete" | "pending";
|
|
24
|
-
pending: {
|
|
25
|
-
id: string;
|
|
26
|
-
kind: "agent" | "backend" | "bridge" | "model" | "report" | "service";
|
|
27
|
-
action: "archive-session" | "await-startup" | "close" | "collect-artifacts" | "delete-sandbox" | "retire-service" | "save" | "stop-execution";
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
35
|
+
artifacts: import("@anyswarm/core").HarnessJson[];
|
|
30
36
|
}>;
|
|
31
37
|
};
|
|
32
38
|
export default parallelSwarm;
|