@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
|
@@ -6,7 +6,7 @@ The Runtime owns Agent resources and execution for one Run; `runtime.id` identif
|
|
|
6
6
|
|
|
7
7
|
The JavaScript and TypeScript entry is `@anyswarm/core`. Its values are `createSandbox`, `createRuntime`, `resolveSandboxConnection`, `createPiExecutor`, `createCodexExecutor`, `createExecutorAdapter`, `getExecutorCapabilities`, `EXECUTOR_ADAPTER_PROTOCOL`, `DEFAULT_WORKER_IMAGE`, `workerImageFor`, `ServiceRegistry`, `createInProcessAdapter` and `createHttpJsonAdapter`. The image constant selects local Worker preparation for the Runtime’s executor. A Profile can also use `workerImageFor(executor)` or supply an explicit prepared image. File, event, Runtime, Profile, result and Service author types are named exports from the same entry. The package declares public npm publication settings and can be installed from a packed tarball. The [SDK & API Reference](../en/reference/api.md) and [Services guide](../en/services.md) document the public interface alongside the independent Messages application. The package exports the Sandbox Provider contract from the root. Bundled Harness helpers and the provider and executor implementation modules are internal.
|
|
8
8
|
|
|
9
|
-
The host calls `createSandbox()` to read the shared connection resolver or supplies explicit OpenSandbox settings or `{ provider }`. The opaque handle freezes
|
|
9
|
+
The host calls `createSandbox()` to read the shared connection resolver or supplies explicit OpenSandbox settings or `{ provider }`. The opaque handle freezes the endpoint and configured, environment or saved connection settings and performs no allocation or interface enumeration. Runtime claims the handle after receiving its own `connection` options. Only when neither those explicit options nor the frozen settings supply a callback does a local OpenSandbox claim inspect `docker0`; it does not reread the environment or saved configuration. Unavailable inspection raises the internal `HOST_NETWORK_DISCOVERY_FAILED`; public `createRuntime()` retains its `INVALID_CONTRACT` resource error with the safe explanation and configuration remedy. A successful inspection without `docker0` retains the local fallback. Explicit callback URLs and hosts therefore work on hosts that cannot enumerate interfaces. The default creation lifetime is 3,600 seconds with automatic renewal while Runtime owns the resource. The built-in path rejects removed exact Workspace byte/inode limits, `local-docker` and endpoint host rewriting with migration errors. Trusted custom Providers keep their own capability contract.
|
|
10
10
|
|
|
11
11
|
An external `SandboxProvider` is trusted application code. Its preflight verifies the deployment before Core can allocate. Its per-image `SandboxManager` supplies creation, reconciliation and deletion, authenticated Worker calls and bounded file and Session transfer. `prepareSandbox` can verify or provision the deployed isolation before Worker startup. A provider advertising shared workspaces implements backing creation and deletion and applies the specified read-only or read-write attachment in preparation. The backend keeps the original manager and resource identity across uncertain operations. [Provider and Worker call order](16-pi-opensandbox-backend.md#startup-and-ownership)
|
|
12
12
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The public `createSandbox()` factory snapshots one connection without allocating resources. Runtime owns Agent admission, resource responsibility, renewal, stop, export and deletion. `@alibaba-group/opensandbox@1.2.1` supplies the Lifecycle and Execd protocols through `opensandbox-sdk.ts`. `opensandbox-manager.ts` coordinates these SDK calls and holds known or uncertain allocations. `worker-client.ts` owns authenticated AnySwarm startup, input, event, project, file and session requests. The executor driver owns the selected executable version, catalog, credentials and capabilities.
|
|
4
4
|
|
|
5
|
+
The Sandbox snapshot omits host interface discovery. At Runtime claim, a consistent explicit `connection.publicUrl` or supported Bridge/Gateway URL takes precedence over the saved URL. Explicit advertise-host settings take precedence over the frozen host. A local OpenSandbox connection with neither fact calls the guarded `docker0` discovery helper, then uses `172.17.0.1` only if inspection succeeded without an address. An inspection failure reports its own code and a callback configuration remedy before any listeners or Sandboxes are allocated. Custom Providers keep their existing host fallback and do not enter this OpenSandbox discovery branch. [Connection precedence and setup diagnostics](07-run-configuration.md)
|
|
6
|
+
|
|
5
7
|
```text
|
|
6
8
|
Runtime.spawn
|
|
7
9
|
provider.beforeAllocation → SDK authenticated listing + authentication check
|
|
@@ -4,6 +4,82 @@ The installed project command runs with a captured directory and the initial pro
|
|
|
4
4
|
|
|
5
5
|
This chapter describes the private Core evidence files, the Service observation hook and the shared host report helper. [Core Runtime](15-core-runtime.md) and [Pi/OpenSandbox](16-pi-opensandbox-backend.md) describe execution and resource ownership.
|
|
6
6
|
|
|
7
|
+
## SDK tutorial business checks
|
|
8
|
+
|
|
9
|
+
First Harness and Parallel Swarm use `context.runWithRuntime` for the original
|
|
10
|
+
Runtime/factory, business, close and cleanup evidence. They register Agent
|
|
11
|
+
observations after Runtime construction and unregister in `finally`. Exclusive
|
|
12
|
+
turns use public `runInput`; all work receives the Run signal, while close has
|
|
13
|
+
its own bounded allowance. A thrown business error fails the job, cancellation
|
|
14
|
+
keeps the cancelled classification, and unconfirmed factory/close ownership
|
|
15
|
+
keeps its resource IDs and pending receipts. No example retries an unknown write
|
|
16
|
+
with a replacement identity. These result projections do not replace or edit
|
|
17
|
+
the Runtime's close receipt.
|
|
18
|
+
|
|
19
|
+
**First Harness.** The Publisher alone receives a fresh random reference in
|
|
20
|
+
`release-data.txt`. Its authenticated publication records author and request ID.
|
|
21
|
+
The host verifies that author and reference before choosing the foreground
|
|
22
|
+
channel (default `preview`) or awaiting an explicitly enabled SDK/RPC question.
|
|
23
|
+
Writer has only the read operation; its authenticated read must match the
|
|
24
|
+
expected Writer and reference. A sandbox snapshot must equal the expected two
|
|
25
|
+
newline-terminated lines in `delivery.txt`. After close, the host reads the
|
|
26
|
+
Writer artifact path from that same receipt and compares exported bytes again.
|
|
27
|
+
Only exact delivery gets `acceptance.status: verified`, a byte count and hash.
|
|
28
|
+
This verifies a Service handoff, not a real release operation.
|
|
29
|
+
|
|
30
|
+
The First Harness `afterClose` callback only captures the receipt. Export byte
|
|
31
|
+
validation runs separately after `runWithRuntime` returns: mismatched/missing
|
|
32
|
+
confirmed output appears as `result.verificationFailure` and a failed outcome,
|
|
33
|
+
without fabricating `cleanupFailure`. Pending required collection is unverified
|
|
34
|
+
and `export.status: pending`, with the original Writer receipt. A business
|
|
35
|
+
failure before Writer creation does not invent a required export. Resource
|
|
36
|
+
cleanup and file delivery remain separate, including after cancellation.
|
|
37
|
+
|
|
38
|
+
**Parallel Swarm.** Host-owned phases are waiting → research → review → closed.
|
|
39
|
+
After all three researchers spawn, `FindingsBoard.beginResearch` records their
|
|
40
|
+
actual Agent IDs. Every successful publication is attributed by the authenticated
|
|
41
|
+
Service caller and assigned the current phase; input cannot override either.
|
|
42
|
+
Before advancing each phase, the host requires a contribution from every
|
|
43
|
+
researcher, rather than only growth in a global count. A second-round review
|
|
44
|
+
must be a newly published record citing at least one existing first-round
|
|
45
|
+
finding by another author. A self-only or unknown citation is rejected before
|
|
46
|
+
publication. The write operation advertises `idempotent: false`; it does not
|
|
47
|
+
claim business deduplication that its append-only records do not provide.
|
|
48
|
+
|
|
49
|
+
Every finding has 1–8 source references to the captured initial FileTree. Each
|
|
50
|
+
must use a canonical relative path belonging to that snapshot, a positive
|
|
51
|
+
1-based inclusive range of at most 40 lines, and an exact nonblank excerpt of at
|
|
52
|
+
most 4,096 bytes. The host decodes UTF-8 strictly and normalizes CRLF to LF for
|
|
53
|
+
the comparison; path traversal, nonexistent files, invalid line ranges,
|
|
54
|
+
non-text input and changed excerpts fail. Only successfully checked findings
|
|
55
|
+
enter the Board. Its exported Service state and `result.detail.board` retain
|
|
56
|
+
rounds, authenticated authors, per-member contribution counts and references.
|
|
57
|
+
|
|
58
|
+
After research and review pass, the host stops the researchers and runs one
|
|
59
|
+
synthesizer with search-only Board access. It requires collection of `report.md`
|
|
60
|
+
within 1 MiB. `report.ts` checks the synthesizer's recorded artifact location,
|
|
61
|
+
readable UTF-8 and nonblank bytes, and rejects an exact unchanged copy of an
|
|
62
|
+
input `report.md`. It records size and SHA-256. That check returns structured
|
|
63
|
+
evidence inside `afterClose`, rather than throwing a business validation error
|
|
64
|
+
into the helper's cleanup channel. Missing or unreadable confirmed output fails
|
|
65
|
+
the business result; unconfirmed collection stays pending. A late read after the
|
|
66
|
+
bounded close wait cannot upgrade the frozen Run result.
|
|
67
|
+
|
|
68
|
+
Parallel acceptance names its scope: participant contributions, cross-author
|
|
69
|
+
reviews, Board source references and report export. Individual checks remain
|
|
70
|
+
visible, with `semanticCorrectness: not-run` even when that limited scope passes.
|
|
71
|
+
The host does not establish that an excerpt supports a claim, that a review is
|
|
72
|
+
useful, that the Markdown cites the Board correctly, or that project tests pass.
|
|
73
|
+
Likewise the recommended Subagents repository-handoff task keeps the generic
|
|
74
|
+
`acceptance: not-run`; its source citations and conclusions need human inspection.
|
|
75
|
+
No fixed report text or injected defect defines business success.
|
|
76
|
+
|
|
77
|
+
The focused tests exercise real Session/Runtime/Bridge behavior through
|
|
78
|
+
controlled Worker transports and targeted failure injection. Package tests
|
|
79
|
+
check the same source dependency graph, edits and SDK archive identity outside
|
|
80
|
+
the checkout. These establish software contracts; new real-model repository
|
|
81
|
+
handoff and exported Parallel Swarm runs remain explicitly deferred acceptance.
|
|
82
|
+
|
|
7
83
|
## Runtime summary and ordered observations
|
|
8
84
|
|
|
9
85
|
`createRuntime` allocates a fresh `runtimeId` and a private directory under the supplied `outputDir`. `runtime.json` is replaced atomically as assembly enters starting, open or initialization-failed, and after each close attempt. It records the output schema and Core/Pi versions, the backend resource settings, effective wait limits, provider/model for each alias, gateway output and request limits, frozen Profile settings, the Profile prompt hash, and registered Service transports and known adapter timeouts. The final summary includes per-Agent Sandbox observations with provider identity, selected image and verified startup constraints. Failed or incomplete startup remains visible through allocation and cleanup evidence. Profile environment keys appear without their values. The summary also lists the available model ledgers by alias and host path. `runtime_model_attempts` in each SQLite file carries the model request's Agent ID, permit phase, status, limits and available usage. Join it by Runtime, model alias and Agent when checking a model error.
|
|
@@ -153,6 +229,8 @@ The [PeerMesh peer team](18-peermesh-harness.md) exposes `runPeerMeshTeam(option
|
|
|
153
229
|
|
|
154
230
|
## Subagents Harness
|
|
155
231
|
|
|
232
|
+
The exported repository handoff example includes `handoff-config.ts`. Pass it explicitly with `--config` to use the same time limits as the recorded p-limit handoff. It keeps the default connection, executor and environment-selected model and applies a 360-second work window, a 70-second model request limit and a 60-second close window. The topology allows Root and two direct children. Collection requires `report.md` with a 1 MiB limit and excludes Git data. The work limit starts before Runtime creation. A missing or oversized required report surfaces through the normal collection result, and cleanup remains visible in the run report. Input comes from the supplied directory snapshot and the report exports under the configured run output directory.
|
|
233
|
+
|
|
156
234
|
The normal [Subagents example](../../examples/subagents/README.md) exposes `createSubagentsHarness(config)` with `input`, `status`, reply observation and close, plus `runSubagentsHarness(config, signal, interact?)` for reports. The CLI reads a host config and accepts a task string or interactive input. The default cap is four Agents including Root and three child edges in a path. The default work deadline is 120 seconds and the close allowance is 30 seconds. An interactive reply leaves the team available for another input. EOF, `/exit`, timeout or host cancellation enters close. `/status` takes a live Core snapshot independently of a waiting model or pending input.
|
|
157
235
|
|
|
158
236
|
The host registers the collaboration Service before creating Root. It attaches the listener before the first input and uses the same Child Profile for every descendant. Both Profiles have all six Service grants. A spawn reserves a validated name before awaiting Core, uses the actual authenticated caller as parent, and binds the Agent before submitting the first task. The manifest allows up to 60 seconds for this Service operation within the Run's overall work limit. Default `all` sets `forkFrom` to that parent; `none` creates fresh history. The host alone chooses the model, image, root seed files, required collection and private or shared workspace. Child paths are collaborative addresses, separate from work directory paths. The caller can target a visible same-tree Agent ID, absolute path or relative child path. List filters by path segments and current Core status. Follow-up rejects Root, whose work comes from the host. Interrupt rejects Root and the caller itself and leaves an already idle target idle.
|
|
@@ -1,40 +1,75 @@
|
|
|
1
1
|
# 22. Public documentation website
|
|
2
2
|
|
|
3
|
-
The Astro application in [website/](../../website/) publishes
|
|
3
|
+
The Astro application in [website/](../../website/) publishes bilingual landing pages, SDK tutorials, collaboration guides, Blog, Changelog and the Quickstart. Its npm package has a separate lockfile. It renders a pinned stable documentation snapshot alongside development documentation from the checkout. It does not start a Runtime or connect to a model provider or private Run.
|
|
4
4
|
|
|
5
5
|
## Build and render
|
|
6
6
|
|
|
7
|
-
Use Node.js 22.23.4
|
|
7
|
+
Use Node.js 24 for the supported development and CI commands; the website package requires at least 22.23.4. Run `npm ci` and `npm run dev` in `website/` for a local preview. Both development and build commands first prepare the documentation inputs. `npm run build` also runs the website's deterministic tests, produces `website/dist/`, and checks the rendered routes and content. `BASE_PATH` defaults to `/` and selects the URL prefix; the repository site uses `/anyswarm`. `SITE_URL` selects the site's origin. Both are build inputs, so changing the host or prefix requires a rebuild.
|
|
8
8
|
|
|
9
|
-
Website CI runs for the site, bilingual guides, documentation images
|
|
9
|
+
Website CI runs for the site, bilingual guides, documentation images and changes that require full Core verification. Checkout includes Git history for the pinned snapshots. CI installs the locked site dependencies and builds with `/anyswarm` and `https://anyswarm.github.io`. It does not upload or deploy the output. [CI triggers and permissions](07-run-configuration.md#ci-build-and-verification)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Stable inputs and development inputs
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[docs-release.json](../../website/docs-release.json) is the explicit stable-version selection. It records a stable npm version, the full immutable `packageRevision`, a compatible immutable `docsRevision`, and an ordered list of tracked documentation correction patches. `scripts/docs-release.mjs` rejects moving refs, prerelease versions, duplicate corrections and correction paths outside the allowed directory. Both revisions must exist locally and identify `@anyswarm/core` with the selected version. Missing history fails with an exact `git fetch --no-tags origin <revision>` instruction; it never falls back to main.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
`scripts/prepare-docs.mjs` creates a temporary snapshot under the ignored `website/.generated/` directory. `git archive` extracts the package revision, preserving its implementation and example sources. Only `docs/en/` and `docs/zh/` are then replaced by the selected documentation revision. Reviewed correction patches may update public Markdown guides only. Each patch must apply cleanly and its SHA-256 becomes part of the build metadata. The script compares the English and Chinese route lists, reserves `next` as a channel prefix, and replaces the previous stable snapshot so deleted pages cannot survive a rebuild. Temporary staging is removed even on failure.
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
This separates a documentation correction from an API change. The manifest does not prove semantic compatibility: review must establish that the selected guide revision and patches describe the package revision. For the initial `0.5.2` selection, the package revision is the published `070b0253` tree and the guide revision is the compatible documentation update in `2aa972ed`. Corrections pin npm commands to `0.5.2`, direct main-source builds to Next, and document the released source-RPC and Trace limitations. The Next guides describe the repaired paths. Source links and downloadable examples always use the package revision, even when a later compatible documentation correction is selected.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
The generated metadata contains the stable version, both stable revisions, patch hashes and available slugs. Next metadata contains the checkout's commit, dirty-tree indicator and guide slugs. `src/lib/docs.ts` exposes these inputs to the renderer; `/docs-metadata.json` publishes their provenance for readers and verification. None of the extracted historical source or generated metadata is committed.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
### Routes, navigation and downloads
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The content loader validates title, description, section and order in four collections. Stable English and Chinese guides render at `/docs/` and `/zh/docs/`; development guides render at `/docs/next/` and `/zh/docs/next/`. Each root serves the corresponding overview, and the explicit `/overview/` routes remain available. Only the current selected stable version and next are built; this is not an archive of every historical release.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Shared layouts preserve the channel through the sidebar, previous/next navigation, language switch and local search. The version menu preserves the language and slug when switching channels, falling back to overview when that page does not exist in the destination. The stable label comes from the manifest. The next banner identifies unreleased checkout documentation and its source revision; it explains that these guides can be newer than the last npm `next` publication. It does not claim that main and the current registry preview are identical.
|
|
26
26
|
|
|
27
|
-
The
|
|
27
|
+
The site uses Astro's Sätteri Markdown processor with `markdown-doc-links.mjs`. Authors keep repository-relative links such as `../runtime.md` in the Markdown shared with GitHub. The transformer resolves stable links against the prepared snapshot and next links against the checkout, rejects missing or out-of-root destinations, converts relative guide links to the corresponding language/channel route, honors explicit public stable and Next URLs, and pins implementation links to the relevant source commit. Query strings and fragments are preserved. External links and same-page fragments retain their meaning. The URL helper applies `BASE_PATH` to navigation, search, downloads and assets.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`src/pages/downloads/[...path].ts` serves sources from the channel's source tree. Stable 0.5.2 provides five First Harness and three Parallel Swarm files through `/downloads/stable/v0.5.2/` and the existing stable aliases. Next serves the complete checked-in eject manifests at `/downloads/next/`. First Harness has eight files, including the nested `input/README.md` and the consumer `AGENTS.md`. Parallel Swarm has seven, including its own configuration, report checks and consumer `AGENTS.md`. The Markdown transformer maps these sources to channel downloads and preserves nested paths. The build compares each download with its selected source bytes. Eject also creates an installable project manifest, provenance and a matching SDK archive. Historical tutorials use their matching fixed release source.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Both landing pages render a copyable global npm command pinned to the manifest's stable version, with clipboard success or failure feedback. They link to the same stable Quickstart and SDK reference. The root CLI documentation test checks the installation contract; the built-output check verifies the actual homepage command. The retired shell installer is absent. [npm installation and update](07-run-configuration.md#npm-cli-installation-and-update)
|
|
32
|
+
|
|
33
|
+
The locale-specific introduction film and static Trace replay are available from the landing page. The three-pattern Harness selector and its zoom dialog share Subagents, TaskPool and Substrate. Arrow keys cycle through these patterns, and Escape closes zoom. Search indexes only the active language and channel's titles, descriptions and sections at build time. Sidebar labels and order organize navigation pages; other pages use frontmatter. Opening search shows up to eight pages, and typing filters locally. Results and empty-query feedback use DOM text and only built destinations; no query is sent to a server. Escape or backdrop click closes search and returns focus. Copy page writes the title, description and article text without code-copy controls. The theme preference stays in browser storage; there is no server-side session state.
|
|
34
|
+
|
|
35
|
+
### Blog and changelog
|
|
36
|
+
|
|
37
|
+
Blog pages read the editorial Markdown from the checkout under `docs/{en,zh}/blog/`. Editorial content renders on the standalone `/blog/` and `/zh/blog/` routes and is excluded from both channels' guide inventories and search. Markdown links to a post lead to its standalone route. Essay illustrations in `website/public/blog/` resolve under the site base. The standalone changelog in each language renders the pinned stable release guide and changelog. The Next navigation links to the checkout changelog under the Next documentation routes. Missing required article or release content fails the build.
|
|
38
|
+
|
|
39
|
+
### Visual assets and static replay
|
|
40
|
+
|
|
41
|
+
Navigation and landing pages render the shared six-bird mark with the active foreground color. The favicon uses the same geometry and follows the browser color scheme. The README selects light or dark SVG through its picture element, and the Trace Viewer uses the same silhouettes. `/anyswarm-logo.png` provides the transparent export under the configured base path. Astro bundles local fonts and SVG diagrams; `public/licenses/` supplies the font notices. Departure Mono's notice and font come from the [upstream assets](https://github.com/rektdeckard/departure-mono/tree/75152a3f1e6dacdd248a6c397c97dbf27e33eea0/public/assets); other notices come from the locked Fontsource packages. Update notices when changing the corresponding fonts.
|
|
42
|
+
|
|
43
|
+
Stable Quickstart links to the published Trace Viewer replay are rewritten to the current site's base. Next Quickstart links to its historical handoff embed. The tracked `website/public/trace-demo/` bundle serves both the labeled release-notes fixture and the recorded p-limit Run without contacting a model or Runtime. Regenerate it with `node website/scripts/build-trace-demo.mjs`. `--root <directory>` selects another Run root and enables sanitization; `--sanitize` also enables it explicitly. The generator rejects a Run whose complete timeline exceeds 1,000 intervals and points, leaving the existing bundle untouched. This preserves complete static window and focus links. Accepted demos include record details and at most 256 KiB of each referenced file. A static file response pages the cached prefix by UTF-8 byte offsets and signals a preview limit separately from the next-page flag. For sanitized exports the generator redacts named credential fields in complete JSON, JSONL and model response events and omits structured previews it cannot parse completely. If sanitization changes a Research patch preview, the static record marks that patch unavailable for verified inspection and removes its file identity. The original candidate hash remains part of the historical Research record. Use `anyswarm trace --root <directory>` for larger Runs and on-demand bounded queries.
|
|
44
|
+
|
|
45
|
+
## Use cases, tutorials and evidence boundaries
|
|
46
|
+
|
|
47
|
+
The landing page retains the existing six-bird identity, introduction films, Blog and Changelog routes, Trace preview and three illustrated collaboration patterns. `UseCases.astro` adds two application explanations using the existing visual styles: engineering handoff from a local repository, and AutoResearch candidates evaluated by a host-controlled Evaluator. Each card states the input, collaboration, outputs and current limitation. These descriptions are usage contracts, not claims that a new live-model Run was executed during website development. The film and conceptual schematics are introductory material, not Run evidence.
|
|
48
|
+
|
|
49
|
+
The repository handoff uses the existing `subagents` name and flags. Its prompt asks Root to delegate independent source reading and export `report.md`; the generic Harness does not enforce exactly two children or certify the report. The Quickstart explains initial capture, private Sandbox copies, no automatic local overwrite, configured time/collection limits, and separate business, acceptance, export and cleanup results. `acceptance: not-run` is kept explicit. The first SDK tutorial defaults to a preset channel without questions; SDK/RPC question handling is an opt-in section. Parallel Swarm teaches three researchers, two rounds and one synthesizer. It describes the host's contribution, source-reference and export checks separately from semantic correctness.
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
Next sidebar and overview use three tiers. Stable navigation includes the sections available in its pinned snapshot. Tier 1 is the repository CLI task and First Harness → Parallel Swarm SDK path. Tier 2 contains AutoResearch and local Subagents, TaskPool and Substrate collaboration references. Tier 3 contains advanced source and heavy integrations; PeerMesh and Lead-Worker are grouped separately with visible facility badges. Their detailed requirements remain in the example catalog and guides. The AutoResearch page describes the FrontierCS-2 evaluator setup, the configurable model and Worker, and the linked real-model records from #337.
|
|
34
52
|
|
|
35
|
-
|
|
53
|
+
The source-candidate tutorials clearly state that their new eject targets and consumer author guides are absent from stable 0.5.2. They link to the matching source-package instructions. The shared Copy Prompt in the root README and English Swarm guide tells Coding Agents to export `parallel-swarm`, read its own `AGENTS.md` and installed SDK types, and preserve explicit evidence, export and cleanup checks. The Chinese guide provides the same requirements in Chinese. The homepage points to the Next repository handoff and AutoResearch guides and links directly to the Next customization prompt. The repository maintainer `AGENTS.md` is not presented as the consumer guide.
|
|
54
|
+
|
|
55
|
+
The landing page and Next Trace guide open the recorded p-limit Run. The illustrated landing-page timeline and stable guide still identify the release-notes fixture. The default build exports the fixture through Trace Reader, labels it in the Run list and adds the checked-in [p-limit replay data](../../website/trace-replays/p-limit-handoff.json) before writing the combined bundle. Explicit `--root` and `TRACE_DEMO_ROOT` exports only read the selected Run root. The browser shim gives the Viewer the saved Run, summary, timeline, events, record details and byte-paged report through its usual requests. It disables live following. The embedded Events panel scrolls its ledger inside the frame so the last recorded event remains reachable when the parent caps the frame height.
|
|
56
|
+
|
|
57
|
+
The public p-limit data was selected from one VM Run after checking its input revision, Agent identities, Service call metadata and archived report. It includes three Agent lanes, recorded model, input and Service events, allowlisted Service targets and the original `report.md` with its SHA-256. Whole-Run counts reflect the original Run even when the viewer shows only a selected window. It includes neither message bodies nor model payloads, tool arguments, private file paths or raw proof/candidate source. The export keeps the recorded cleanup and generic acceptance fields. Verifying the report bytes does not certify the report's conclusions.
|
|
58
|
+
|
|
59
|
+
## Publish and recover
|
|
60
|
+
|
|
61
|
+
The [Pages workflow](../../.github/workflows/deploy-website.yml) starts after relevant main pushes, manual dispatch, or a successful tag-triggered Release run. Relevant paths include `website/`, public guides, both downloadable example directories and the workflow. Deployment requires the public `AnySwarm/anyswarm` repository and `main`. Main changes can update next documentation while stable remains selected by the manifest.
|
|
62
|
+
|
|
63
|
+
Before building, `scripts/verify-public-release.mjs` resolves the selected `v<version>` tag and requires it to equal `packageRevision`. It fetches that exact npm version, validates the package identity and registry tarball origin, downloads the bytes, verifies npm SHA-512 integrity, and compares their SHA-256 with the canonical versioned archive in that GitHub Release's `SHA256SUMS`. It also reads the archive's package manifest. A missing package, wrong tag, inconsistent bytes or unavailable public endpoint fails the build. The check uses thirty-second request deadlines and deletes its temporary archive directory in `finally`. It does not consult or move npm `latest` or GitHub Latest, so a newer release cannot silently advance stable documentation.
|
|
64
|
+
|
|
65
|
+
After verification, Pages supplies the site origin and base path. A locked Node 24 build produces the static artifact. The deploy job runs only after that build succeeds, uses the `github-pages` environment and publishes via Pages permission and an OIDC token. Each deployment replaces the entire site, so every artifact includes stable and next in both languages. Deployments share the Pages concurrency group. No package publication or sandbox setup occurs here.
|
|
66
|
+
|
|
67
|
+
The public site is `https://anyswarm.github.io/anyswarm/`. A failed build leaves the existing deployment available; a successful deploy records the URL. Correct the manifest, missing history, public distribution or build failure, then dispatch Pages on main and check both channels and locales. Stable promotion is an explicit reviewed manifest change after the exact package is publicly verified. [Release and documentation workflow](../workflows/release-and-docs-versioning.md)
|
|
68
|
+
|
|
69
|
+
## Content maintenance and rendered-link checks
|
|
36
70
|
|
|
37
|
-
|
|
71
|
+
The [documentation index](../INDEX.md) is the repository reading map. Current guides live under `docs/en/` and `docs/zh/` and feed next; stable guides are reproducibly derived from the manifest. `website/` owns rendering, navigation, stable input selection and compatibility corrections. Add both language pages and update `src/lib/nav.ts` together. Keep SDK examples aligned with public exports. The [website README](../../website/README.md) explains local preparation and stable promotion.
|
|
38
72
|
|
|
73
|
+
After Astro generation, `scripts/check-links.mjs` walks the HTML output, resolves same-origin links and assets under the configured base, checks files and heading anchors, and compares language routes. `scripts/check-doc-channels.mjs` checks the stable and next identifiers, version links, language links, sidebar and search boundaries, homepage version, metadata and example download bytes. Deterministic website tests also exercise manifest rejection, missing or wrong-version history, stale patch failures and snapshot cleanup. Any failure blocks Website CI and Pages. External link reachability and browser interaction remain separate checks.
|
|
39
74
|
|
|
40
|
-
|
|
75
|
+
For the repository-prefix build, use `BASE_PATH=/anyswarm SITE_URL=https://anyswarm.github.io npm --prefix website run build`; build without a base override for root-path preview. `npm run docs:check` separately validates current repository-relative Markdown links, anchors and generated architecture references.
|
|
@@ -27,13 +27,16 @@ and reuse it across the Run's roles. Scheduling still validates Service results,
|
|
|
27
27
|
exported files and the original close receipt before accepting the Run.
|
|
28
28
|
|
|
29
29
|
Public installation instructions first install the published SDK or an explicitly
|
|
30
|
-
selected, checksum-verified source archive
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
selected, checksum-verified source archive. Editable collaboration starts with
|
|
31
|
+
`eject parallel-swarm`, `eject subagents` or `eject first-harness` when the package
|
|
32
|
+
contains those manifests; these are new after 0.5.2. Each export contains its own
|
|
33
|
+
complete configuration and collaboration sources, an application-author
|
|
34
|
+
`AGENTS.md`, and a bound local SDK archive. Parallel Swarm does not import a
|
|
35
|
+
sibling example's configuration or require its compiler files. Each normal
|
|
36
|
+
Harness consumes complete `context.configuration` or loads its local default
|
|
37
|
+
through `projectConfiguration`. The older copy/build route remains supported.
|
|
38
|
+
An edited repository example must use a package built from the same source
|
|
39
|
+
revision. Matching package version numbers alone cannot establish that pairing.
|
|
37
40
|
|
|
38
41
|
Each of the five mechanism directories contains a `package.json`, `tsconfig.json`
|
|
39
42
|
and `project.ts`. `npm run build` emits `dist/project.js` in that directory.
|
|
@@ -65,6 +68,8 @@ The definition declares `inputDescriptor`, the optional lifetime and question su
|
|
|
65
68
|
|
|
66
69
|
## HarnessSession admission and lifetime
|
|
67
70
|
|
|
71
|
+
The standard output root is `${XDG_STATE_HOME:-$HOME/.local/state}/anyswarm/runs`, shared with the Trace command through `src/trace-viewer/run-root.mjs`. A nonempty explicit `outputRoot` (CLI `--output-dir`) resolves against the launch directory and takes precedence. The Session reserves `<root>/<runId>/` and saves `project-run.json` there. If the default state location cannot be used or is inside the captured workspace, preparation can choose a private temporary root; the final report path and terminal replay command identify that actual location. Direct `createRuntime()` has a separate required `outputDir` and writes its Runtime directory below it. A report-only Harness can be replayed even when no Runtime was created; the Viewer discovery and association rules are described in [Trace Viewer](06-observability-experiments.md).
|
|
72
|
+
|
|
68
73
|
`createHarnessSession(definition, options)` runs one `Harness.run(context)`. It resolves configuration from an object or a config module, captures the project at `start`, and assigns a Run ID. It exposes `describe`, `start`, `input`, `respond`, `getState`, `onEvent`, `agents`, `stop`, and `completion` from the package root. Construction allocates no Sandbox. The default `task` lifetime finishes according to the Harness's existing business policy. Subagents additionally supports `interactive`, where Root can settle repeatedly while the Run remains open. The configured work deadline still applies.
|
|
69
74
|
|
|
70
75
|
A mutation carries one `requestId`. The Session stores the operation and normalized arguments under that ID before dispatch. A repeat reads the saved receipt or joins the in-flight operation. Changing operation, target or arguments conflicts. Session callbacks receive both the external `requestId` and a bounded `operationId` derived from the Run ID, operation and original request ID. Native dispatch and receipt lookup reuse the same operation ID. Business controllers retain their own child, Task execution and batch identities. A bounded wait may report unknown while the original request is pending. A late receipt or a registered read-only reconciliation can update it. Admission keeps up to 4,096 ordinary mutation identities for the lifetime of the process. Ordinary input queues up to 64 entries and 256 KiB by default. The callback can capture a business binding when input is admitted and recheck it during dispatch. Handlers have a 10-second default observation deadline. A conditional or unknown child receipt stays visible in the input result.
|
|
@@ -91,7 +96,15 @@ settlement, Agent closure and Service lifecycle changes. Static Service names
|
|
|
91
96
|
come from Session observation handles when the Harness reaches running. Progress
|
|
92
97
|
uses only the redacted Session projection and escapes terminal control characters.
|
|
93
98
|
Arbitrary business events, messages, and question contents stay out of progress.
|
|
94
|
-
On completion it prints outcome
|
|
99
|
+
On completion it prints the outcome and one `Result` block. That block uses a
|
|
100
|
+
string `result.business` or `result.business.output` when present, otherwise the
|
|
101
|
+
result string or formatted JSON, including an explicit `null`. It preserves
|
|
102
|
+
newlines and tabs, normalizes CRLF, and escapes other Unicode control and format
|
|
103
|
+
characters so recorded output cannot execute terminal controls. The block is
|
|
104
|
+
limited to 64 KiB of UTF-8 at a character boundary. A truncation notice points to
|
|
105
|
+
the complete saved report only when saving succeeded; a failed save is reported
|
|
106
|
+
as unavailable. The finish guard prevents duplicate final blocks. Completion
|
|
107
|
+
also prints separately observed export and cleanup statuses,
|
|
95
108
|
up to five artifact paths, the saved report path when available, and a Trace
|
|
96
109
|
command for the actual Run root. The final path accounts for the Host's fallback
|
|
97
110
|
when the default state directory cannot be used. Trace is started explicitly in
|
|
@@ -152,11 +165,19 @@ An application can call SDK `runProjectRpc(session, input, write, launchDirector
|
|
|
152
165
|
|
|
153
166
|
The project RPC server consumes the same Session as the process-local SDK. It reads strict UTF-8 lines separated by LF, with a command bound of 64 KiB. The wire record has `id`, `operation`, optional `input` and an optional mutation `requestId`. Existing clients use `id` as the mutation identity. Typed clients can choose a fresh transport ID while reusing the business request ID after an uncertain reply. `run`, `status`, `input` and `stop` retain their operation names. `describe`, `answer` and the fixed `agent.*` operations delegate to the corresponding Session methods. Status queries capture and write the current state synchronously. Other queries share an in-flight reply for matching IDs, reject changed arguments while that ID is pending, and release one of the 128 slots when the reply arrives or after 30 seconds. A reused read ID after release starts a fresh query. Answer, stop and mutation replay use independent admission. Dependencies, queues and mutation reconciliation belong to HarnessSession.
|
|
154
167
|
|
|
155
|
-
The server writes `ready` with v1, Harness identity, descriptor and initial state, then writes separate reply, error, event and result records. A fresh status reply is queued synchronously with its captured state. `HarnessRpcClient` installs its read side before sending requests, correlates replies by ID, and gives a new subscriber that status snapshot before subsequent events. It exposes `ready` and the same methods as a direct Session. Its transport declaration describes the pipe and event methods it uses, so other package-root SDK consumers can still typecheck with a standard-library-only configuration. Transport disconnect rejects any unresolved final result. The caller manages its streams and subprocess. Unsubscribing leaves the Run open.
|
|
168
|
+
The server writes `ready` with v1, Harness identity, descriptor and initial state, then writes separate reply, error, event and result records. A fresh status reply is queued synchronously with its captured state. `HarnessRpcClient` installs its read side before sending requests, correlates replies by ID, and gives a new subscriber that status snapshot before subsequent events. It exposes `ready` and the same methods as a direct Session. Its transport declaration describes the pipe and event methods it uses, so other package-root SDK consumers can still typecheck with a standard-library-only configuration. Before `ready`, an error without a request ID is a terminal launch failure: it rejects readiness and waiting calls with the Host code, preserving bounded public messages for recognized module, configuration, Session and request errors. Unicode control and format characters (`Cc`/`Cf`), including line breaks and bidirectional controls, are escaped; arbitrary exception stacks/details and messages from unknown codes are not copied. A later EOF cannot replace that launch failure with `RPC_DISCONNECTED`. After readiness, unrelated reply/error IDs retain their existing ignore behavior. Transport disconnect rejects any unresolved final result. The caller manages its streams and subprocess. Unsubscribing leaves the Run open.
|
|
156
169
|
|
|
157
170
|
The CLI flushes one output record at a time, with a five-second deadline per write. A new state event can replace the last unsent state event. Replies, errors, questions, operation changes, business events and the terminal result keep their place in the same queue. Queued data can total 1 MiB, with a single queued record allowed up to 8 MiB for a large reply or result. A full queue, oversized record or failing pipe stops the foreground Run with `output-failed`, discards unsent records and lets Run cleanup and reporting finish.
|
|
158
171
|
|
|
159
|
-
Foreground task invocations
|
|
172
|
+
Foreground task invocations print one final result and do not accept questions
|
|
173
|
+
or interactive lifetimes. Use an explicit SDK client or `--mode rpc` for those
|
|
174
|
+
capabilities; the RPC entry requires a `run` command. First Harness defaults to
|
|
175
|
+
its preset channel and only asks when the client declares question support.
|
|
176
|
+
Its advanced `session.ts` demonstrates both direct SDK and JSONL question clients.
|
|
177
|
+
The legacy `run-harness` TaskPool and PeerMesh frontends translate their input
|
|
178
|
+
arguments to the same business handlers, retaining the inner request ID on that
|
|
179
|
+
wire. Their old PeerMesh kickoff, wait, and project EOF exception keep their
|
|
180
|
+
existing behavior. Harness RPC stops on EOF and supports one Run per process.
|
|
160
181
|
|
|
161
182
|
## Built-in owners and handoffs
|
|
162
183
|
|
|
@@ -201,20 +222,36 @@ RPC query or mutation rejection carries the same recognized framework fields bes
|
|
|
201
222
|
## TypeScript author entry and source export
|
|
202
223
|
|
|
203
224
|
`anyswarm run ./harness.ts` starts a child Node process
|
|
204
|
-
with source maps enabled and
|
|
225
|
+
with source maps enabled and forwards the remaining arguments and standard streams.
|
|
205
226
|
The parent forwards SIGINT and SIGTERM and returns the child's exit code. The
|
|
206
227
|
child installs synchronous module hooks before loading the trusted author entry.
|
|
207
|
-
These hooks
|
|
208
|
-
`
|
|
228
|
+
These hooks lazily load the packaged SWC WebAssembly transformer for `.ts` and
|
|
229
|
+
`.mts` files. It compiles TypeScript constructs such as enums, erases explicit
|
|
230
|
+
type-only imports and exports, retains value imports and exports, and returns
|
|
231
|
+
ESM with inline source maps. The transformer preserves modern JavaScript syntax
|
|
232
|
+
and runs independently of Node's native type-stripping modes. Source read and
|
|
233
|
+
transform errors stop module loading before the Harness starts. The hooks override the
|
|
209
234
|
surrounding package's CommonJS interpretation for these source files. A relative
|
|
210
|
-
`.js` or `.mjs` import first resolves normally, then
|
|
211
|
-
`.ts` or `.mts` source when the JavaScript file is
|
|
235
|
+
`.js` or `.mjs` import, absolute path or `file:` URL first resolves normally, then
|
|
236
|
+
falls back to the corresponding `.ts` or `.mts` source when the JavaScript file is
|
|
237
|
+
missing. This also covers a CLI Harness path converted to a file URL, such as the
|
|
238
|
+
First Harness RPC client's `new URL('./harness.js', import.meta.url)`. The fallback
|
|
239
|
+
changes only the URL pathname extension, preserving encoded filenames and URL
|
|
240
|
+
identity. An existing JavaScript file remains preferred. Ordinary installed
|
|
212
241
|
package resolution runs first. A missing `@anyswarm/core` dependency falls back to
|
|
213
242
|
the invoking CLI's public SDK entry. No hook is installed merely by importing the
|
|
214
243
|
SDK. The trusted Harness and configuration loading paths enable these same hooks,
|
|
215
244
|
so explicit foreground/RPC and the legacy repository foreground runner can
|
|
216
245
|
load TypeScript configuration modules as well.
|
|
217
246
|
|
|
247
|
+
The installed source-entry regression copies the package's four First Harness
|
|
248
|
+
TypeScript files into a directory without JavaScript or `dist`, invokes the local
|
|
249
|
+
CLI with the documented RPC command, and verifies admission and report creation
|
|
250
|
+
using an intentionally rejected configuration before Runtime allocation. The
|
|
251
|
+
release acceptance additionally runs that unchanged source client against the
|
|
252
|
+
same installed candidate and real Worker, checking the question, handoff, exported
|
|
253
|
+
bytes and cleanup alongside the compiled SDK/RPC paths.
|
|
254
|
+
|
|
218
255
|
An entry without a default Harness executes as an ordinary source program with
|
|
219
256
|
its original argv. A default Harness with `apiVersion: 1` and `run` is dispatched
|
|
220
257
|
through the same one-shot or RPC host used by explicit `--harness`. A source
|
|
@@ -246,7 +283,7 @@ Source diagnostics and Harness console output go to stderr. Configuration
|
|
|
246
283
|
loading inside the Host records a stable configuration failure in the Run report.
|
|
247
284
|
In a non-Git author directory, untracked top-level `node_modules`, `.anyswarm-sdk` and Code recovery directories named `.anyswarm-code-recovery-` plus a six-character suffix are excluded from project capture. Explicit Git-tracked files at those paths keep the tracked-file capture behavior.
|
|
248
285
|
|
|
249
|
-
`anyswarm eject <
|
|
286
|
+
`anyswarm eject <name> --dir <target>` selects a packaged
|
|
250
287
|
application's `examples/<id>/eject.json`; `example` selects `examples/authoring`.
|
|
251
288
|
The version-1 manifest names its TypeScript entry, an explicit file list and optional additional npm dependencies. The engine
|
|
252
289
|
rejects absolute/traversal paths, private/runtime/build directories, secret-file
|
|
@@ -256,6 +293,16 @@ files, and renames the complete export into place. A nonempty target fails befor
|
|
|
256
293
|
writes. Failures remove the temporary export. Applications without a source
|
|
257
294
|
manifest return a reason identifying the missing application source.
|
|
258
295
|
|
|
296
|
+
The `subagents` manifest lists its project entry, business assembly, config,
|
|
297
|
+
controller, Service adapter, prompts and direct host demonstration. The
|
|
298
|
+
`parallel-swarm` manifest includes the actual phases, Board, evidence/export
|
|
299
|
+
validators and config. The `first-harness` manifest includes the handoff Service,
|
|
300
|
+
config, explicit SDK/RPC client and input directory. Each includes a local README
|
|
301
|
+
and downstream author `AGENTS.md`; the root repository's maintainer instructions
|
|
302
|
+
are not substituted for that guide. No new export wraps another bundled Harness
|
|
303
|
+
or imports a sibling example. Code, Super, AutoResearch and the zero-Runtime
|
|
304
|
+
authoring fixture retain their existing manifests.
|
|
305
|
+
|
|
259
306
|
The exported package depends on `file:./.anyswarm-sdk/core.tgz`. That archive is
|
|
260
307
|
repacked from the actual invoking SDK with lifecycle scripts disabled. The
|
|
261
308
|
provenance file records the SDK name/version, npm installation source/integrity
|
|
@@ -2,41 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
AutoResearch is a finite-run Harness with equal research peers. The search loop and research Service are shared by a custom trusted evaluator and the FrontierCS-2 demo. It is the flagship one-shot CLI showcase and uses the common task Session, source runner and Trace records. The applicable product requirements are [#337](https://github.com/AnySwarm/anyswarm/issues/337), the owner’s subsequent four-peer decision, [#344](https://github.com/AnySwarm/anyswarm/issues/344) and the [integration review](https://github.com/AnySwarm/anyswarm/pull/342#issuecomment-7346884457), [#351](https://github.com/AnySwarm/anyswarm/issues/351), and the [Core and Harness design revision](https://github.com/AnySwarm/anyswarm/tree/45775d7312e62a791ab8a097c5e7715dc3c9d548/docs/designs/core-harness).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Configuration, preparation and launch
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The exported `frontiercs2-config.ts` builds a trusted configuration without loading prepared material. It uses a regular `ModelConfig`, the connection and Worker saved by `anyswarm setup`, and explicit overrides for the executor, image, Sandbox and callback. The template reads provider, model ID, HTTP request URL, optional bearer token and protocol from the environment. It sets two Peers, a 720-second work window, four train admissions and 128 Gateway attempts for the whole team. The caller can change budget and goal. The four-peer preset supplies 720 seconds and eight train admissions; a missing model-request cap is reported as uncapped. Prepared manifests do not select the model or budget, including on reads of existing version 2 manifests. K3's route rule applies only to the corresponding provider/model. The same exported configuration is used by both preparation and the normal foreground Harness.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts --check` loads the chosen trusted module, checks Linux x86-64, Git, LFS, Python, the Pumpkin download and extraction tools, Docker Buildx, context, daemon and its containerd image store, CPU, memory, disk and inodes, authenticated OpenSandbox Lifecycle access, declared `dns+nft`, Worker image and callback. The report gives one action per unmet check, prints JSON, and exits 2 on configuration or preparation failure. It checks the immutable image recorded by local setup, or the explicit image in the configuration, and calls out that a remote provider must verify its own image and Worker capacity. The controller plan lists a bridge, one active judge, controller margin and image-build headroom for prepare, and counts each Worker at its placement for run. The benchmark still runs its official judge on the controller's Docker context. The model probe sends bounded HEAD, with five seconds, supplied headers and no redirect following. Denial and network failures have separate remedies. A successful HTTP check or a reachable POST-only endpoint does not establish actual inference. Inference awaits the first real turn. The check-only path skips downloading material and running the reference.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The image-store check confirms the reported storage driver. Actual image import and digest tagging take place during the reference build. If Pumpkin reports a failed tag followed by `No such image`, the preparation report preserves the official error and suggests Docker Engine 29 with its official Buildx plugin and the containerd store. Other preparation errors retain their original diagnostic.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
unsuccessful prerequisite check. The demo configuration exports the trusted
|
|
15
|
-
evaluator, fixed research goal and absolute starter path. The one-shot launcher
|
|
16
|
-
calls the module's workspace resolver before initial capture. That resolver
|
|
17
|
-
uses configuration's `targetPath`, relative to the invocation directory when
|
|
18
|
-
needed. An explicit `--cwd` takes precedence. A custom configuration uses
|
|
19
|
-
`anyswarm --harness autoresearch --config ./research.ts --prompt <objective>`.
|
|
20
|
-
An SDK or RPC caller supplies its own workspace. The Harness only supports task
|
|
21
|
-
lifetime.
|
|
13
|
+
Dropping `--check` takes an exclusive state lock, uses sparse Git to fetch the pinned task and shared recipes, loads LFS files and verifies the Pumpkin pin. On cold preparation it bootstraps the checksum-pinned Pumpkin release under a private cache with a child-only `022` umask so the judge can execute `sandboxd`. If that release was already extracted with a restrictive umask, it restores only the missing executable bits on the cached `sandboxd` file. The caller’s umask and recorded run directories keep their original permissions. Preparation checks the official no-model reference in an independent record directory. It checks a positive train score, a legal final result tied to the submitted payload, zero model requests and confirmed cleanup. It copies the pinned materials into a host-owned bridge tree and adds a minimal model-free agent role. The bridge image uses a pinned Ubuntu base. This role receives the candidate tar in its writable `/pumpkin` scratch space, invokes its official grants and removes each temporary tar on exit. Prepare verifies the judge and bridge image identities, train grant, scratch access and that no role container remains. The atomic manifest records Docker context, source and bridge fingerprints, image identities and reference record. Repeat preparation reuses those records and images after checking them. A different context requires a separate state directory. The lock is removed on exit and prior reference records are retained.
|
|
22
14
|
|
|
23
|
-
The
|
|
24
|
-
The Viewer indexes the timed research journal alongside Runtime evidence and
|
|
25
|
-
shows claims, patch reads, findings, peer messages, reviews, lineage and
|
|
26
|
-
evaluation results in its Research track. It can read the Run while it is active
|
|
27
|
-
and replay it after completion.
|
|
15
|
+
`anyswarm run ./project.ts --config ./frontiercs2-config.ts --prompt <objective>` resolves the configured starter path before workspace capture. The Harness compares the captured manifest against the verified tracked starter paths and hashes before any Runtime or evaluator starts. The evaluator starts the official workflow and finds exactly one container with the matching run and role labels. It verifies images and requested train admissions against the official grant. The Workers receive copies of the starter with callback-only egress. Reference, judge code, hidden final data and Docker access stay at the trusted boundary. The generic Harness supports `--harness autoresearch --config ./research.ts`, explicit `--cwd` and SDK/RPC workspace input. It uses the provided evaluator under task lifetime.
|
|
28
16
|
|
|
29
17
|
## Peer and evaluation lifecycle
|
|
30
18
|
|
|
31
|
-
The Harness creates one Runtime and
|
|
19
|
+
The Harness creates one Runtime and shared model alias. It starts all Peers concurrently, waits for all of them, records `team.ready` and starts the search clock and initial turns together. Official workflow and Worker lifetimes include startup, the work window and evaluation/cleanup margins. All new Gateway attempts share the configured cap and a replay with the same request identity is not a new attempt. Research turns stop on the deadline, target, shutdown, failed work or train budget. If `continueAfterTrainBudget` is enabled, remaining turns may review and run local checks within the same model and time limits. When those peers settle and the recorded Gateway attempts reach the cap, the stop event and result record `model-request-budget`. The recorded phase timestamps separate startup, work, final and cleanup.
|
|
32
20
|
|
|
33
21
|
The Harness registers its owned Runtime with the public Session controls. The SDK/RPC `agent.send` operation uses native steer on the selected member's active turn. An idle peer returns the native non-admission receipt and does not get an independent turn. `agent.interrupt` cancels the current native turn and pending native inputs. The peer loop can schedule a new turn after a confirmed interrupt and current-turn settlement. An unknown interrupt prevents automatic redispatch. `agent.stop` synchronously fences that peer's scheduler, aborts its wait and stops its allocated Agent. A retry reads the original stop state. The peer remains in the record, and the other peers and already queued evaluations retain their existing budget and state. An explicit stop of the entire Run fences all further work, aborts active train and final, and proceeds to cleanup.
|
|
34
22
|
|
|
35
|
-
Each peer can read the Board, claim a direction by normalized text, send a targeted message, publish findings, read segments of another candidate patch and record a review of a version it has read. Peers submit a patch by writing `.anyswarm-candidate.patch` inside their own workspace and passing a summary and optional predecessor identity to the research Service. Bridge authentication supplies caller identity. The host snapshots the file by request identity, hashes the bytes and stores an immutable candidate. Identical bytes reuse the original candidate identity. The host
|
|
23
|
+
Each peer can read the Board, claim a direction by normalized text, send a targeted message, publish findings, read segments of another candidate patch and record a review of a version it has read. Peers submit a patch by writing `.anyswarm-candidate.patch` inside their own workspace and passing a summary and optional predecessor identity to the research Service. Bridge authentication supplies caller identity. The host snapshots the file by request identity, hashes the bytes and stores an immutable candidate. Identical bytes reuse the original candidate identity. Per-caller mutation receipts bind the operation ID to the action and normalized payload. An identical retry receives the original result; a conflicting operation returns an error. The receipt table is bounded. A serialized host commit makes the bytes durable before charging a slot and queuing evaluation. A failed commit does not use a train slot. Identical patch bytes reuse the prior candidate. Once a new patch becomes readable, the Harness offers it to each other eligible peer who has yet to receive a review offer in this Run. It attempts conditional active steer if the executor supports it and no owner interrupt is pending. Accepted steer is recorded as a notice. The peer’s next regular turn can carry the prompt once if a matching review or derivative has not arrived. It can do so after the train quota has filled, while the work deadline and stop fences still apply. The notice never wakes an idle or stopped peer through steer. Publication of a review requires another peer’s candidate and a complete ordered read. The journal records the immutable SHA-256 on candidate registration, completion of a patch read, review publication and the corresponding parent hash on a derivative. Compare patch contents to check semantic adoption.
|
|
36
24
|
|
|
37
|
-
Train calls queue serially. The official adapter packages the exact patch as the single `payload/solution.patch` member of a deterministic bounded tar file. The official role returns a job number on admission. The host polls that job
|
|
25
|
+
Train calls queue serially. The official adapter packages the exact patch as the single `payload/solution.patch` member of a deterministic bounded tar file. The official role returns a job number on admission. The host polls that job and verifies the payload SHA-256 and size in the official admission log. It waits for the official job teardown event before another train or final can be admitted. After that event it records the public returned score and metrics and updates the best eligible candidate. The official task supplies 100 train calls and 12,000 cumulative train seconds, with 180 seconds per judge and one MiB per submission. Pumpkin’s train grant bounds the call at 181 seconds. The adapter permits extra time for observing its receipt. This task scores a failed correctness gate as zero, including responses without an explicit rejection field. Such candidates stay in result history and cannot become best. A missing admission, failed job or timeout is kept as an unknown outcome, with the original job identity when known. The Harness fences subsequent train and final admissions so an unresolved train cannot overlap another judge. It records the uncertainty and cleans up the run. The trusted evaluator has its own abort-bounded time; the prepared task enforces official payload, train quota and judge time limits.
|
|
38
26
|
|
|
39
|
-
At deadline, target
|
|
27
|
+
At deadline, target, quota or user stop, the Harness fences new work and stops Agents while the evaluator settles the active job. Research-queued train work without an official admission is cancelled when the pump is stopped. User stop also aborts active train and final. If an active train has an unknown outcome, the Harness retains the recorded job identity and avoids a second submission. On regular finish, the selected patch is the highest or lowest valid train score according to the configured direction. A Run without a valid patch records why final could not start. The adapter calls the final grant with the selected tar and `finalize=true`, waits on the original official outcome and checks the final payload digest, size and returned verdict. It never feeds final results back to a Worker.
|
|
28
|
+
|
|
29
|
+
A generic final callback declares `status` (`valid`, `rejected` or `unknown`), `score`, `meetsObjective` and `evidence`. A valid zero is representable. Plain JSON from an older evaluator is retained as unconfirmed evidence. A confirmed official submission, legal candidate, score and objective result have separate meanings. For FrontierCS-2, the adapter verifies the official score and legality separately from the reference comparison, and checks the application objective only when a target score is configured. The Run report preserves failures, business acceptance and both cleanup receipts. Cleanup uses bounded Runtime close and evaluator cancellation plus a container inventory check. The report retains Core’s Runtime ID, cleanup status and available report path on initialization failure, including when Core has already rolled back all allocated resources. Pending resources retain the available Runtime or Pumpkin identities. A subsequent Pumpkin cleanup check rebuilds its container inventory for the known run IDs. Candidate patches and research events are written under the Runtime directory. The atomic `research-result.json` in the Run directory records the chosen configuration, observed use, every candidate, selected patch, original Pumpkin path, phase timing and both cleanup outcomes.
|
|
30
|
+
|
|
31
|
+
## Trace evidence
|
|
32
|
+
|
|
33
|
+
The Viewer reads `research-events.jsonl` alongside Core, Service and Model records. It indexes candidate ID, hash, parent, event sequence, official job and payload digest as structured evidence. A candidate inspector follows matching versions across publication, full read, review, derivation, train and final. With a long review history, the bounded inspector retains evaluation evidence and the timeline search can retrieve the full history by hash. Files are limited to the recorded candidate namespace. The Viewer compares the active file to the recorded SHA-256 and exposes missing or changed bytes. Model overlap counts successful model request intervals across distinct Peers and the final result summarizes upstream model identifiers when the response recorded them. The CLI prints the Viewer command. Live and replay use the same recorded events.
|
|
40
34
|
|
|
41
35
|
## Source and verification
|
|
42
36
|
|