@anyswarm/core 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/README.md +21 -13
- package/deploy/worker/Dockerfile +12 -4
- package/dist/deploy/worker/Dockerfile +12 -4
- package/dist/examples/README.md +35 -12
- package/dist/examples/authoring/README.md +24 -0
- package/dist/examples/authoring/business.d.ts +2 -0
- package/dist/examples/authoring/business.js +4 -0
- package/dist/examples/authoring/config.d.ts +5 -0
- package/dist/examples/authoring/config.js +2 -0
- package/dist/examples/authoring/eject.json +5 -0
- package/dist/examples/authoring/harness.d.ts +4 -0
- package/dist/examples/authoring/harness.js +19 -0
- package/dist/examples/autoresearch/README.md +40 -0
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +11 -0
- package/dist/examples/autoresearch/config.d.ts +51 -0
- package/dist/examples/autoresearch/config.js +57 -0
- package/dist/examples/autoresearch/demo.d.ts +11 -0
- package/dist/examples/autoresearch/demo.js +52 -0
- package/dist/examples/autoresearch/eject.json +17 -0
- package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
- package/dist/examples/autoresearch/frontiercs2.d.ts +87 -0
- package/dist/examples/autoresearch/frontiercs2.js +211 -0
- package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
- package/dist/examples/autoresearch/prepare-demo.js +15 -0
- package/dist/examples/autoresearch/prepare.d.ts +95 -0
- package/dist/examples/autoresearch/prepare.js +257 -0
- package/dist/examples/autoresearch/process.d.ts +13 -0
- package/dist/examples/autoresearch/process.js +48 -0
- package/dist/examples/autoresearch/project.d.ts +21 -0
- package/dist/examples/autoresearch/project.js +392 -0
- package/dist/examples/autoresearch/research-service.d.ts +106 -0
- package/dist/examples/autoresearch/research-service.js +255 -0
- package/dist/examples/code/README.md +33 -0
- package/dist/examples/code/REQUIREMENTS.zh.md +11 -0
- package/dist/examples/code/candidate.d.ts +19 -0
- package/dist/examples/code/candidate.js +80 -0
- package/dist/examples/code/config.d.ts +32 -0
- package/dist/examples/code/config.js +18 -0
- package/dist/examples/code/eject.json +5 -0
- package/dist/examples/code/project.d.ts +3 -0
- package/dist/examples/code/project.js +605 -0
- package/dist/examples/code/prompts.d.ts +5 -0
- package/dist/examples/code/prompts.js +12 -0
- package/dist/examples/code/verification.d.ts +19 -0
- package/dist/examples/code/verification.js +268 -0
- package/dist/examples/code/worktree.d.ts +17 -0
- package/dist/examples/code/worktree.js +233 -0
- package/dist/examples/harness-session/README.md +3 -6
- package/dist/examples/lead-worker/harness/dynamic-scheduler.d.ts +2 -1
- package/dist/examples/lead-worker/harness/dynamic-scheduler.js +5 -2
- package/dist/examples/lead-worker/harness/index.d.ts +60 -0
- package/dist/examples/lead-worker/harness/index.js +77 -6
- package/dist/examples/lead-worker/project.js +2 -2
- package/dist/examples/lead-worker/services/board.d.ts +5 -0
- package/dist/examples/lead-worker/services/board.js +19 -1
- package/dist/examples/messages/README.md +5 -5
- package/dist/examples/messages/handoff.d.ts +2 -0
- package/dist/examples/messages/handoff.js +5 -1
- package/dist/examples/messages/project.js +52 -2
- package/dist/examples/notes/README.md +13 -18
- package/dist/examples/notes/project.js +67 -6
- package/dist/examples/peermesh/harness/router.js +3 -1
- package/dist/examples/peermesh/harness/team.d.ts +8 -0
- package/dist/examples/peermesh/harness/team.js +13 -0
- package/dist/examples/peermesh/project.js +22 -4
- package/dist/examples/services/agent-control/README.md +3 -3
- package/dist/examples/services/mathlib-search/Dockerfile +4 -2
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/mcp-managed/README.md +2 -2
- package/dist/examples/services/persistent-board/README.md +16 -3
- package/dist/examples/services/persistent-board/business.d.ts +7 -0
- package/dist/examples/services/persistent-board/business.js +7 -0
- package/dist/examples/services/persistent-board/index.js +10 -0
- package/dist/examples/services/persistent-board/live.d.ts +3 -0
- package/dist/examples/services/persistent-board/live.js +58 -0
- package/dist/examples/subagents/README.md +5 -5
- package/dist/examples/subagents/business.js +3 -1
- package/dist/examples/subagents/config.js +3 -3
- package/dist/examples/subagents/harness/controller.d.ts +15 -0
- package/dist/examples/subagents/harness/controller.js +181 -32
- package/dist/examples/subagents/project.d.ts +2 -0
- package/dist/examples/subagents/project.js +43 -34
- package/dist/examples/subagents/prompts/prompts.d.ts +1 -0
- package/dist/examples/subagents/prompts/prompts.js +3 -0
- package/dist/examples/subagents/services/collaboration-service.d.ts +3 -2
- package/dist/examples/subagents/services/collaboration-service.js +14 -2
- package/dist/examples/substrate/README.md +2 -2
- package/dist/examples/substrate/harness/index.d.ts +1 -1
- package/dist/examples/substrate/harness/index.js +77 -12
- package/dist/examples/substrate/project.js +4 -1
- package/dist/examples/super/README.md +52 -0
- package/dist/examples/super/actions.d.ts +95 -0
- package/dist/examples/super/actions.js +230 -0
- package/dist/examples/super/artifact.d.ts +4 -0
- package/dist/examples/super/artifact.js +51 -0
- package/dist/examples/super/config.d.ts +80 -0
- package/dist/examples/super/config.js +83 -0
- package/dist/examples/super/coordinator.d.ts +33 -0
- package/dist/examples/super/coordinator.js +151 -0
- package/dist/examples/super/daemon.d.ts +11 -0
- package/dist/examples/super/daemon.js +109 -0
- package/dist/examples/super/decisions.d.ts +8 -0
- package/dist/examples/super/decisions.js +52 -0
- package/dist/examples/super/eject.json +5 -0
- package/dist/examples/super/execution.d.ts +11 -0
- package/dist/examples/super/execution.js +136 -0
- package/dist/examples/super/github.d.ts +62 -0
- package/dist/examples/super/github.js +269 -0
- package/dist/examples/super/inbox.d.ts +162 -0
- package/dist/examples/super/inbox.js +284 -0
- package/dist/examples/super/location.d.ts +5 -0
- package/dist/examples/super/location.js +64 -0
- package/dist/examples/super/operator.d.ts +1 -0
- package/dist/examples/super/operator.js +31 -0
- package/dist/examples/super/outbox.d.ts +5 -0
- package/dist/examples/super/outbox.js +103 -0
- package/dist/examples/super/project.d.ts +4 -0
- package/dist/examples/super/project.js +251 -0
- package/dist/examples/super/prompts.d.ts +3 -0
- package/dist/examples/super/prompts.js +25 -0
- package/dist/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
- package/dist/examples/taskpool/harness/controller.d.ts +35 -6
- package/dist/examples/taskpool/harness/controller.js +73 -7
- package/dist/examples/taskpool/project.js +18 -2
- package/dist/scripts/anyswarm-arguments.d.ts +18 -6
- package/dist/scripts/anyswarm-arguments.js +88 -52
- package/dist/scripts/anyswarm-author.d.ts +5 -0
- package/dist/scripts/anyswarm-author.js +24 -0
- package/dist/scripts/anyswarm-eject.d.ts +11 -0
- package/dist/scripts/anyswarm-eject.js +164 -0
- package/dist/scripts/anyswarm-harnesses.d.ts +1 -0
- package/dist/scripts/anyswarm-harnesses.js +10 -0
- package/dist/scripts/anyswarm-installation.d.ts +7 -40
- package/dist/scripts/anyswarm-installation.js +17 -285
- package/dist/scripts/anyswarm-launch.d.ts +7 -0
- package/dist/scripts/anyswarm-launch.js +37 -0
- package/dist/scripts/anyswarm-progress.d.ts +6 -0
- package/dist/scripts/anyswarm-progress.js +102 -0
- package/dist/scripts/anyswarm-project.d.ts +3 -1
- package/dist/scripts/anyswarm-project.js +49 -35
- package/dist/scripts/anyswarm-source-runner.d.ts +1 -0
- package/dist/scripts/anyswarm-source-runner.js +200 -0
- package/dist/scripts/anyswarm.js +28 -3
- package/dist/scripts/build-provenance.json +1 -0
- package/dist/scripts/build.js +7 -1
- package/dist/scripts/generate-architecture-api.js +2 -0
- package/dist/scripts/generate-architecture-prompts.js +24 -2
- package/dist/scripts/local-environment.d.ts +13 -2
- package/dist/scripts/local-environment.js +111 -28
- package/dist/scripts/local-setup-smoke.js +3 -2
- package/dist/scripts/local-setup-worker.d.ts +1 -1
- package/dist/scripts/local-setup-worker.js +15 -6
- package/dist/scripts/local-setup.d.ts +5 -2
- package/dist/scripts/local-setup.js +167 -79
- package/dist/scripts/opensandbox-agent-worker.js +2 -2
- package/dist/scripts/pack-release.d.ts +1 -0
- package/dist/scripts/pack-release.js +66 -0
- package/dist/scripts/pi-session-bridge.js +11 -3
- package/dist/scripts/run-harness.js +3 -1
- package/dist/scripts/setup-bootstrap.js +43 -6
- package/dist/src/core/allocation-ledger.js +4 -3
- package/dist/src/core/host-identity.d.ts +2 -0
- package/dist/src/core/host-identity.js +11 -0
- package/dist/src/core/index.d.ts +4 -2
- package/dist/src/core/index.js +12 -4
- package/dist/src/core/mcp-service.js +2 -2
- package/dist/src/core/runtime-management.d.ts +6 -0
- package/dist/src/core/runtime-management.js +24 -0
- package/dist/src/core/sandbox/executor-driver.d.ts +4 -2
- package/dist/src/core/sandbox/executor-driver.js +12 -14
- package/dist/src/core/sandbox/local-executor.d.ts +13 -1
- package/dist/src/core/sandbox/local-executor.js +69 -19
- package/dist/src/core/sandbox/local-worker.js +32 -21
- package/dist/src/core/sandbox/opensandbox-backend.d.ts +2 -0
- package/dist/src/core/sandbox/opensandbox-backend.js +36 -11
- package/dist/src/core/sandbox/sandbox-connection.d.ts +2 -0
- package/dist/src/core/sandbox/sandbox-connection.js +14 -6
- package/dist/src/core/service-live-state.d.ts +14 -0
- package/dist/src/core/service-live-state.js +161 -0
- package/dist/src/core/service-observation-types.d.ts +21 -1
- package/dist/src/core/service-process.d.ts +1 -1
- package/dist/src/core/service-process.js +45 -4
- package/dist/src/core/service-types.d.ts +5 -1
- package/dist/src/core/services.d.ts +1 -1
- package/dist/src/core/services.js +8 -3
- package/dist/src/core/types.d.ts +3 -0
- package/dist/src/core/worker-image.js +3 -3
- package/dist/src/harness/harness-session-types.d.ts +10 -0
- package/dist/src/harness/harness-session.js +42 -5
- package/dist/src/harness/project-harness.d.ts +14 -1
- package/dist/src/harness/project-harness.js +38 -12
- package/dist/src/harness/project-input.js +81 -15
- package/dist/src/harness/project-rpc-client.d.ts +1 -0
- package/dist/src/harness/project-rpc-client.js +5 -0
- package/dist/src/harness/project-rpc.d.ts +8 -2
- package/dist/src/harness/project-rpc.js +31 -7
- package/dist/src/harness/project-runtime.js +6 -2
- package/dist/src/harness/typescript-loader.d.ts +2 -0
- package/dist/src/harness/typescript-loader.js +41 -0
- package/dist/src/trace-viewer/public/app.js +6 -5
- package/dist/src/trace-viewer/reader.mjs +42 -2
- package/docs/INDEX.md +5 -2
- package/docs/architecture/00-overview.md +1 -1
- package/docs/architecture/01-agent-core.md +1 -1
- package/docs/architecture/04-services.md +1 -1
- package/docs/architecture/06-observability-experiments.md +1 -1
- package/docs/architecture/07-run-configuration.md +38 -18
- package/docs/architecture/08-prompts.md +22 -0
- package/docs/architecture/10-service-api-reference.md +53 -18
- package/docs/architecture/11-storage-reference.md +18 -1
- package/docs/architecture/12-code-coverage.md +152 -89
- package/docs/architecture/15-core-runtime.md +8 -0
- package/docs/architecture/16-pi-opensandbox-backend.md +5 -5
- package/docs/architecture/17-harness-reporting.md +1 -1
- package/docs/architecture/19-substrate-harness.md +28 -1
- package/docs/architecture/20-lead-worker-harness.md +34 -1
- package/docs/architecture/22-website.md +5 -6
- package/docs/architecture/23-project-harness.md +152 -8
- package/docs/architecture/24-runtime-recovery.md +10 -3
- package/docs/architecture/26-code.md +54 -0
- package/docs/architecture/27-personal.md +58 -0
- package/docs/architecture/28-autoresearch.md +43 -0
- package/docs/architecture/INDEX.md +3 -0
- package/docs/architecture/prompts/08-lead-worker-harness.md +4 -2
- package/docs/architecture/prompts/08-subagents-harness.md +21 -0
- package/docs/architecture/prompts/21-personal.md +44 -0
- package/docs/architecture/prompts/22-autoresearch.md +63 -0
- package/docs/architecture/prompts/26-code.md +55 -0
- package/docs/architecture/prompts/source-manifest.json +152 -33
- package/docs/architecture/source-map.json +473 -25
- package/docs/designs/core-harness/01-core.md +2 -2
- package/docs/designs/core-harness/06-project-harness.md +13 -2
- package/docs/designs/core-harness/README.md +7 -2
- package/docs/en/agents.md +1 -1
- package/docs/en/build-your-harness.md +3 -5
- package/docs/en/changelog.md +20 -4
- package/docs/en/first-harness.md +9 -12
- package/docs/en/harnesses/lead-worker.md +1 -1
- package/docs/en/harnesses/peermesh.md +2 -2
- package/docs/en/harnesses/subagents.md +2 -2
- package/docs/en/harnesses/substrate.md +4 -4
- package/docs/en/harnesses/taskpool.md +2 -2
- package/docs/en/latest.md +14 -121
- package/docs/en/overview.md +1 -1
- package/docs/en/quickstart.md +42 -39
- package/docs/en/reference/api.md +14 -4
- package/docs/en/reference/cli.md +53 -47
- package/docs/en/runtime.md +2 -2
- package/docs/en/sandbox.md +3 -3
- package/docs/en/services.md +4 -0
- package/docs/operations/trace-viewer.md +1 -1
- package/docs/workflows/development.md +28 -21
- package/docs/workflows/release-and-docs-versioning.md +77 -0
- package/docs/workflows/release-cli-acceptance.md +85 -0
- package/docs/zh/agents.md +1 -1
- package/docs/zh/build-your-harness.md +3 -5
- package/docs/zh/changelog.md +20 -4
- package/docs/zh/first-harness.md +9 -12
- package/docs/zh/harnesses/lead-worker.md +1 -1
- package/docs/zh/harnesses/peermesh.md +2 -2
- package/docs/zh/harnesses/subagents.md +2 -2
- package/docs/zh/harnesses/substrate.md +4 -4
- package/docs/zh/harnesses/taskpool.md +2 -2
- package/docs/zh/latest.md +15 -122
- package/docs/zh/overview.md +1 -1
- package/docs/zh/quickstart.md +42 -39
- package/docs/zh/reference/api.md +14 -4
- package/docs/zh/reference/cli.md +24 -40
- package/docs/zh/runtime.md +2 -2
- package/docs/zh/sandbox.md +3 -3
- package/docs/zh/services.md +4 -0
- package/examples/README.md +35 -12
- package/examples/authoring/README.md +24 -0
- package/examples/authoring/business.ts +4 -0
- package/examples/authoring/config.ts +2 -0
- package/examples/authoring/eject.json +5 -0
- package/examples/authoring/harness.ts +21 -0
- package/examples/autoresearch/README.md +40 -0
- package/examples/autoresearch/REQUIREMENTS.zh.md +11 -0
- package/examples/autoresearch/config.ts +90 -0
- package/examples/autoresearch/demo.ts +55 -0
- package/examples/autoresearch/eject.json +17 -0
- package/examples/autoresearch/frontiercs2-config.ts +4 -0
- package/examples/autoresearch/frontiercs2.ts +237 -0
- package/examples/autoresearch/prepare-demo.ts +15 -0
- package/examples/autoresearch/prepare.ts +267 -0
- package/examples/autoresearch/process.ts +50 -0
- package/examples/autoresearch/project.ts +380 -0
- package/examples/autoresearch/research-service.ts +302 -0
- package/examples/code/README.md +33 -0
- package/examples/code/REQUIREMENTS.zh.md +11 -0
- package/examples/code/candidate.ts +89 -0
- package/examples/code/config.ts +19 -0
- package/examples/code/eject.json +5 -0
- package/examples/code/project.ts +581 -0
- package/examples/code/prompts.ts +16 -0
- package/examples/code/verification.ts +239 -0
- package/examples/code/worktree.ts +188 -0
- package/examples/harness-session/README.md +3 -6
- package/examples/lead-worker/harness/dynamic-scheduler.ts +6 -3
- package/examples/lead-worker/harness/index.ts +61 -6
- package/examples/lead-worker/project.ts +2 -2
- package/examples/lead-worker/services/board.ts +14 -1
- package/examples/messages/README.md +5 -5
- package/examples/messages/handoff.ts +6 -2
- package/examples/messages/project.ts +47 -2
- package/examples/notes/README.md +13 -18
- package/examples/notes/project.ts +57 -9
- package/examples/peermesh/harness/router.ts +2 -2
- package/examples/peermesh/harness/team.ts +11 -0
- package/examples/peermesh/project.ts +19 -4
- package/examples/services/agent-control/README.md +3 -3
- package/examples/services/mathlib-search/Dockerfile +4 -2
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/mcp-managed/README.md +2 -2
- package/examples/services/persistent-board/README.md +16 -3
- package/examples/services/persistent-board/business.ts +10 -0
- package/examples/services/persistent-board/index.ts +10 -0
- package/examples/services/persistent-board/live.ts +54 -0
- package/examples/subagents/README.md +5 -5
- package/examples/subagents/business.ts +3 -1
- package/examples/subagents/config.ts +4 -3
- package/examples/subagents/harness/controller.ts +161 -29
- package/examples/subagents/project.ts +47 -33
- package/examples/subagents/prompts/prompts.ts +4 -0
- package/examples/subagents/services/collaboration-service.ts +14 -2
- package/examples/substrate/README.md +2 -2
- package/examples/substrate/harness/index.ts +67 -11
- package/examples/substrate/project.ts +5 -1
- package/examples/super/README.md +52 -0
- package/examples/super/actions.ts +196 -0
- package/examples/super/artifact.ts +56 -0
- package/examples/super/config.ts +95 -0
- package/examples/super/coordinator.ts +158 -0
- package/examples/super/daemon.ts +84 -0
- package/examples/super/decisions.ts +46 -0
- package/examples/super/eject.json +5 -0
- package/examples/super/execution.ts +131 -0
- package/examples/super/github.ts +242 -0
- package/examples/super/inbox.ts +306 -0
- package/examples/super/location.ts +54 -0
- package/examples/super/operator.ts +28 -0
- package/examples/super/outbox.ts +97 -0
- package/examples/super/project.ts +225 -0
- package/examples/super/prompts.ts +27 -0
- package/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
- package/examples/taskpool/harness/controller.ts +59 -7
- package/examples/taskpool/project.ts +18 -2
- package/npm-shrinkwrap.development.json +700 -0
- package/npm-shrinkwrap.json +95 -1969
- package/package.development.json +88 -0
- package/package.json +11 -8
- package/scripts/anyswarm-arguments.ts +91 -54
- package/scripts/anyswarm-author.ts +25 -0
- package/scripts/anyswarm-eject.ts +145 -0
- package/scripts/anyswarm-harnesses.ts +10 -0
- package/scripts/anyswarm-installation.ts +18 -288
- package/scripts/anyswarm-launch.ts +36 -0
- package/scripts/anyswarm-progress.ts +95 -0
- package/scripts/anyswarm-project.ts +35 -34
- package/scripts/anyswarm-source-runner.ts +176 -0
- package/scripts/anyswarm.ts +24 -3
- package/scripts/build.ts +8 -1
- package/scripts/generate-architecture-api.ts +2 -0
- package/scripts/generate-architecture-prompts.ts +35 -2
- package/scripts/local-environment.ts +117 -28
- package/scripts/local-setup-smoke.ts +3 -2
- package/scripts/local-setup-worker.ts +17 -7
- package/scripts/local-setup.ts +166 -73
- package/scripts/opensandbox-agent-worker.ts +2 -2
- package/scripts/pack-release.ts +70 -0
- package/scripts/pi-session-bridge.ts +10 -2
- package/scripts/run-harness.ts +3 -1
- package/scripts/setup-bootstrap.ts +41 -6
- package/src/core/allocation-ledger.ts +5 -3
- package/src/core/host-identity.ts +11 -0
- package/src/core/index.ts +12 -6
- package/src/core/mcp-service.ts +2 -2
- package/src/core/runtime-management.ts +22 -0
- package/src/core/sandbox/executor-driver.ts +15 -18
- package/src/core/sandbox/local-executor.ts +65 -19
- package/src/core/sandbox/local-worker.ts +29 -21
- package/src/core/sandbox/opensandbox-backend.ts +36 -11
- package/src/core/sandbox/sandbox-connection.ts +14 -5
- package/src/core/service-live-state.ts +156 -0
- package/src/core/service-observation-types.ts +23 -1
- package/src/core/service-process.ts +36 -3
- package/src/core/service-types.ts +3 -1
- package/src/core/services.ts +8 -3
- package/src/core/types.ts +3 -0
- package/src/core/worker-image.ts +3 -3
- package/src/harness/harness-session-types.ts +13 -1
- package/src/harness/harness-session.ts +40 -7
- package/src/harness/project-harness.ts +38 -12
- package/src/harness/project-input.ts +73 -15
- package/src/harness/project-rpc-client.ts +5 -0
- package/src/harness/project-rpc.ts +29 -8
- package/src/harness/project-runtime.ts +4 -2
- package/src/harness/typescript-loader.ts +37 -0
- package/src/trace-viewer/public/app.js +6 -5
- package/src/trace-viewer/reader.mjs +42 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceRegistry, createRuntime, createSandbox, AnySwarmError, ProjectPreflightError, observeProjectRuntime, projectConfiguration, runInput } from '@anyswarm/core';
|
|
1
|
+
import { ServiceRegistry, createRuntime, getExecutorCapabilities, createSandbox, AnySwarmError, ProjectPreflightError, observeProjectRuntime, projectConfiguration, runInput } from '@anyswarm/core';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { createNotes } from './notes.js';
|
|
@@ -28,7 +28,14 @@ const notesHarness = {
|
|
|
28
28
|
services.register('notes', notes.service, { toolMode: 'cli' });
|
|
29
29
|
const common = { image, model, writable: true };
|
|
30
30
|
let observation;
|
|
31
|
-
const
|
|
31
|
+
const interventions = [];
|
|
32
|
+
const blocked = new Set();
|
|
33
|
+
const waits = new Map();
|
|
34
|
+
const assertMember = (agentId) => {
|
|
35
|
+
if (blocked.has(agentId))
|
|
36
|
+
throw new AnySwarmError('MEMBER_WORK_CANCELLED', 'The owner intervened in this member’s work');
|
|
37
|
+
};
|
|
38
|
+
const state = { stage: 'writer', interventions };
|
|
32
39
|
try {
|
|
33
40
|
const result = await context.runWithRuntime({ closeTimeoutMs,
|
|
34
41
|
async createRuntime() {
|
|
@@ -39,17 +46,71 @@ const notesHarness = {
|
|
|
39
46
|
reader: { ...common, addedSystemPrompt: projectNotesReaderPrompt, services: { notes: ['get'] },
|
|
40
47
|
collect: { paths: [artifact, followup], includeGit: false, maxBytes: 64 * 1024, required: true } },
|
|
41
48
|
} });
|
|
42
|
-
|
|
49
|
+
const native = getExecutorCapabilities(config.executor ?? 'pi');
|
|
50
|
+
const controlEffects = (core) => ({ core, harnessEffects: { memberWork: 'cancelled', status: 'complete' } });
|
|
51
|
+
const intervene = async (operation, agentId, requestId) => {
|
|
52
|
+
blocked.add(agentId);
|
|
53
|
+
interventions.push({ agentId, operation, requestId });
|
|
54
|
+
context.emit({ kind: 'user-intervention', agentId, operation, requestId });
|
|
55
|
+
void observation?.refresh();
|
|
56
|
+
try {
|
|
57
|
+
const core = operation === 'interrupt' ? await runtime.interrupt(agentId, { requestId })
|
|
58
|
+
: await runtime.stop(agentId, { timeoutMs: closeTimeoutMs });
|
|
59
|
+
return controlEffects(core);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
waits.get(agentId)?.abort();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
observation = observeProjectRuntime(runtime, context, () => state, {
|
|
66
|
+
capabilities: {
|
|
67
|
+
send: { supported: native.activeSteer, text: true, modes: ['steer'] },
|
|
68
|
+
interrupt: { supported: native.queuedInputCancellation }, stop: { supported: true },
|
|
69
|
+
},
|
|
70
|
+
handlers: {
|
|
71
|
+
send(agentId, payload, request) {
|
|
72
|
+
assertMember(agentId);
|
|
73
|
+
const { input, options } = payload;
|
|
74
|
+
return runtime.send(agentId, input, { ...options, mode: 'steer', wakeIfIdle: false, requestId: request.operationId });
|
|
75
|
+
},
|
|
76
|
+
interrupt: (agentId, _payload, request) => intervene('interrupt', agentId, request.operationId),
|
|
77
|
+
stop: (agentId, _payload, request) => intervene('stop', agentId, request.operationId),
|
|
78
|
+
},
|
|
79
|
+
async reconcile(operation, agentId, request) {
|
|
80
|
+
if (operation === 'stop')
|
|
81
|
+
return controlEffects(await runtime.stop(agentId, { timeoutMs: closeTimeoutMs }));
|
|
82
|
+
const core = await observation.reconcile(agentId, operation, request.operationId);
|
|
83
|
+
return operation === 'interrupt' ? controlEffects(core) : core;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
43
86
|
return runtime;
|
|
44
87
|
},
|
|
45
88
|
async run(runtime) {
|
|
46
89
|
const { signal, initial, input } = context;
|
|
90
|
+
const runMember = async (agentId, text, requestId) => {
|
|
91
|
+
assertMember(agentId);
|
|
92
|
+
const wait = new AbortController();
|
|
93
|
+
waits.set(agentId, wait);
|
|
94
|
+
try {
|
|
95
|
+
const result = await runInput(runtime, agentId, text, { requestId, timeoutMs: turnTimeoutMs,
|
|
96
|
+
signal: AbortSignal.any([signal, wait.signal]), beforeSend: () => assertMember(agentId) });
|
|
97
|
+
assertMember(agentId);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
assertMember(agentId);
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
waits.delete(agentId);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
47
108
|
signal.throwIfAborted();
|
|
48
109
|
const writer = await runtime.spawn({ requestId: 'notes-writer', profile: 'writer', files: initial.files });
|
|
49
110
|
signal.throwIfAborted();
|
|
50
111
|
state.writerId = writer.id;
|
|
51
112
|
context.markRunning();
|
|
52
|
-
await
|
|
113
|
+
await runMember(writer.id, input.prompt, 'notes-write');
|
|
53
114
|
const published = notes.records.get(key);
|
|
54
115
|
if (published?.author !== writer.id)
|
|
55
116
|
throw new AnySwarmError('NOTES_PUBLICATION_UNCONFIRMED', 'The writer did not publish its project observation');
|
|
@@ -60,14 +121,14 @@ const notesHarness = {
|
|
|
60
121
|
const reader = await runtime.spawn({ requestId: 'notes-reader', profile: 'reader', files: initial.files });
|
|
61
122
|
signal.throwIfAborted();
|
|
62
123
|
state.readerId = reader.id;
|
|
63
|
-
await
|
|
124
|
+
await runMember(reader.id, JSON.stringify({ task: input.prompt, artifact }), 'notes-read');
|
|
64
125
|
if (!notes.reads.some((read) => read.agentId === reader.id && read.key === key && read.found)) {
|
|
65
126
|
throw new AnySwarmError('NOTES_HANDOFF_UNCONFIRMED', 'The reader did not retrieve the writer’s note');
|
|
66
127
|
}
|
|
67
128
|
signal.throwIfAborted();
|
|
68
129
|
state.stage = 'followup';
|
|
69
130
|
void observation?.refresh();
|
|
70
|
-
await
|
|
131
|
+
await runMember(reader.id, JSON.stringify({ task: input.prompt, instruction: projectNotesFollowupPrompt, artifact, followup }), 'notes-followup');
|
|
71
132
|
signal.throwIfAborted();
|
|
72
133
|
state.stage = 'verification';
|
|
73
134
|
void observation?.refresh();
|
|
@@ -40,6 +40,7 @@ export function createPeerMeshRouter({ mapping, runInput, readContext, steerInpu
|
|
|
40
40
|
accepting = false;
|
|
41
41
|
steerOpen = false;
|
|
42
42
|
clearTimeout(nudgeTimer);
|
|
43
|
+
clearTimeout(timer);
|
|
43
44
|
for (const row of queue.splice(0))
|
|
44
45
|
cancelUnsubmitted(row, reason);
|
|
45
46
|
if (active?.state === 'context')
|
|
@@ -180,7 +181,8 @@ export function createPeerMeshRouter({ mapping, runInput, readContext, steerInpu
|
|
|
180
181
|
const uncertain = row.state === 'submitted' && !['input_failed', 'input_aborted', 'input_handled_without_model_run', 'wait_requires_idle_agent'].includes(error.code);
|
|
181
182
|
Object.assign(row, { state: uncertain ? 'uncertain' : 'failed', code: error.code ?? 'ROUTER_BATCH_FAILED',
|
|
182
183
|
...(error.inputId ? { inputId: error.inputId } : {}), ...(error.receipt ? { receipt: clone(error.receipt) } : {}), ...(error.event ? { event: clone(error.event), ...(error.event.type === 'settled' ? { settled: clone(error.event) } : {}) } : {}) });
|
|
183
|
-
|
|
184
|
+
if (accepting)
|
|
185
|
+
fence(row.code);
|
|
184
186
|
}
|
|
185
187
|
finally {
|
|
186
188
|
steerOpen = false;
|
|
@@ -21,6 +21,14 @@ export declare function createPeerMeshTeam(options: any): Promise<Readonly<{
|
|
|
21
21
|
}[];
|
|
22
22
|
};
|
|
23
23
|
hasPeer: (key: string) => any;
|
|
24
|
+
interruptPeer(key: string, requestId: string): Promise<{
|
|
25
|
+
core: any;
|
|
26
|
+
harnessEffects: {
|
|
27
|
+
status: string;
|
|
28
|
+
routerStopped: boolean;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
sendOwnerInput(key: string, input: string, requestId: string): any;
|
|
24
32
|
stopPeer(key: any, { timeoutMs }?: any): Promise<any>;
|
|
25
33
|
kickoff(key: any, text: any): any;
|
|
26
34
|
ingest(key: any, event: any): any;
|
|
@@ -222,6 +222,19 @@ export async function createPeerMeshTeam(options) {
|
|
|
222
222
|
halt: () => stop(fail('HARNESS_STOP_REQUESTED')),
|
|
223
223
|
currentPeers: () => ({ closing, peers: peerStates() }),
|
|
224
224
|
hasPeer: (key) => peers.has(key),
|
|
225
|
+
async interruptPeer(key, requestId) {
|
|
226
|
+
if (closing || !peers.has(key) || stoppedPeers.has(key))
|
|
227
|
+
throw fail('UNKNOWN_RECIPIENT');
|
|
228
|
+
routers.get(key).stop('USER_INTERRUPT');
|
|
229
|
+
const core = await runtime.interrupt(peers.get(key).id, { requestId });
|
|
230
|
+
return { core, harnessEffects: { status: core.status === 'interrupted' ? 'complete' : 'unknown', routerStopped: true } };
|
|
231
|
+
},
|
|
232
|
+
sendOwnerInput(key, input, requestId) {
|
|
233
|
+
if (closing || !peers.has(key) || stoppedPeers.has(key))
|
|
234
|
+
throw fail('UNKNOWN_RECIPIENT');
|
|
235
|
+
return runtime.send(peers.get(key).id, input, { requestId, mode: 'steer', source: 'user',
|
|
236
|
+
wakeIfIdle: !routers.get(key).snapshot().accepting });
|
|
237
|
+
},
|
|
225
238
|
async stopPeer(key, { timeoutMs = 60_000 } = {}) {
|
|
226
239
|
if (closing || !peers.has(key))
|
|
227
240
|
throw fail('UNKNOWN_RECIPIENT');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSandbox, ProjectPreflightError, checkGitProject, observeProjectRuntime, projectConfiguration, } from '@anyswarm/core';
|
|
1
|
+
import { createSandbox, ProjectPreflightError, checkGitProject, observeProjectRuntime, projectConfiguration, getExecutorCapabilities, } from '@anyswarm/core';
|
|
2
2
|
import { addAbortListener } from 'node:events';
|
|
3
3
|
import { peerBatchReceipt, runPeerMeshTeam } from './harness/team.js';
|
|
4
4
|
import { peerMeshConfig } from './project-config.js';
|
|
@@ -49,10 +49,12 @@ const peerMesh = {
|
|
|
49
49
|
onRuntime: (runtime, snapshot) => {
|
|
50
50
|
observation = observeProjectRuntime(runtime, context, snapshot, {
|
|
51
51
|
fence: () => team?.halt(),
|
|
52
|
-
async reconcile(operation, agentId) {
|
|
52
|
+
async reconcile(operation, agentId, request) {
|
|
53
53
|
const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
|
|
54
|
-
if (
|
|
54
|
+
if (!peer)
|
|
55
55
|
return { status: 'unknown' };
|
|
56
|
+
if (operation !== 'stop')
|
|
57
|
+
return observation.reconcile(agentId, operation, request.operationId);
|
|
56
58
|
try {
|
|
57
59
|
const core = await team.stopPeer(peer.key);
|
|
58
60
|
return { core, harnessEffects: { status: core.cleanup === 'complete' ? 'complete' : 'pending',
|
|
@@ -69,9 +71,25 @@ const peerMesh = {
|
|
|
69
71
|
},
|
|
70
72
|
capabilities: agentId => {
|
|
71
73
|
const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
|
|
72
|
-
|
|
74
|
+
const native = getExecutorCapabilities(config.executor ?? 'pi');
|
|
75
|
+
const available = !!peer && !peer.stopped;
|
|
76
|
+
return { stop: { supported: true, available, reason: peer?.stopped ? 'peer-closed' : undefined },
|
|
77
|
+
send: { supported: native.activeSteer, available, text: true, modes: ['steer'] },
|
|
78
|
+
interrupt: { supported: native.queuedInputCancellation, available } };
|
|
73
79
|
},
|
|
74
80
|
handlers: {
|
|
81
|
+
async send(agentId, payload, request) {
|
|
82
|
+
const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
|
|
83
|
+
if (!peer)
|
|
84
|
+
throw Object.assign(new Error('Unknown peer Agent'), { code: 'UNKNOWN_RECIPIENT' });
|
|
85
|
+
return team.sendOwnerInput(peer.key, payload.input, request.operationId);
|
|
86
|
+
},
|
|
87
|
+
async interrupt(agentId, _payload, request) {
|
|
88
|
+
const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
|
|
89
|
+
if (!peer)
|
|
90
|
+
throw Object.assign(new Error('Unknown peer Agent'), { code: 'UNKNOWN_RECIPIENT' });
|
|
91
|
+
return team.interruptPeer(peer.key, request.operationId);
|
|
92
|
+
},
|
|
75
93
|
async stop(agentId, _payload, { signal }) {
|
|
76
94
|
signal.throwIfAborted();
|
|
77
95
|
const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
[The script](flow.sh) reads the real child ID from the spawn receipt, gets that child, sends a follow-up input and stops the child. The send receipt confirms that the input was accepted. A caller that needs to wait for the child's work should observe its settled event before stopping it.
|
|
6
6
|
|
|
7
|
-
## Run from
|
|
7
|
+
## Run from the installed SDK
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive. The build puts `flow.sh` beside the compiled runner so the lead can receive it as an initial file.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm init -y
|
|
13
|
-
npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
|
|
13
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
|
|
14
14
|
npm install --save-dev typescript @types/node
|
|
15
15
|
cp -R node_modules/@anyswarm/core/examples/services/agent-control demo
|
|
16
16
|
cd demo
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
FROM node:22.19.0-bookworm-slim AS typescript-build
|
|
2
2
|
WORKDIR /build
|
|
3
|
-
COPY package
|
|
4
|
-
RUN
|
|
3
|
+
COPY package*.json npm-shrinkwrap*.json tsconfig.json ./
|
|
4
|
+
RUN if [ -f package.development.json ]; then \
|
|
5
|
+
cp package.development.json package.json && cp npm-shrinkwrap.development.json npm-shrinkwrap.json; \
|
|
6
|
+
fi && npm ci --include=dev --ignore-scripts --no-audit --no-fund
|
|
5
7
|
COPY src ./src
|
|
6
8
|
COPY scripts ./scripts
|
|
7
9
|
COPY examples/taskpool ./examples/taskpool
|
|
@@ -39,7 +39,7 @@ process. See the maintained [Mathlib service implementation](../../../docs/archi
|
|
|
39
39
|
|
|
40
40
|
To run the host without a container after building the checkout, use
|
|
41
41
|
`npm run service:mathlib-search` from the root, or
|
|
42
|
-
|
|
42
|
+
`../../../node_modules/.bin/anyswarm run ./main.ts` from this directory.
|
|
43
43
|
The caller supplies the host token with `MATHLIB_SEARCH_TOKEN`, and configures
|
|
44
44
|
the endpoint in its own service adapter. The application/operator owns the
|
|
45
45
|
external provider's lifecycle and persistent data; Runtime close does not remove it.
|
|
@@ -6,11 +6,11 @@ This example registers an MCP stdio provider with `mcpService()` and an ordinary
|
|
|
6
6
|
|
|
7
7
|
## Install and build outside the checkout
|
|
8
8
|
|
|
9
|
-
Use Linux with Node 24 or later.
|
|
9
|
+
Use Linux with Node 24 or later. Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm init -y
|
|
13
|
-
npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
|
|
13
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
|
|
14
14
|
npm install --save-dev typescript @types/node
|
|
15
15
|
cp -R node_modules/@anyswarm/core/examples/services/mcp-managed demo
|
|
16
16
|
cd demo
|
|
@@ -4,13 +4,13 @@ Two Agents share a SQLite Board. A replacement Agent reads the committed finding
|
|
|
4
4
|
|
|
5
5
|
`business.ts` is an independent SQLite library with publish/list operations. `interface.ts` describes the public operations. `index.ts` binds authenticated callers and supplies lifecycle and observation hooks. `python/board.py` implements the same business operations in Python. `python/server.py` exposes ordinary GET/POST `/entries` REST routes using Python's standard library.
|
|
6
6
|
|
|
7
|
-
## Run from
|
|
7
|
+
## Run from the installed SDK
|
|
8
8
|
|
|
9
|
-
Use Node 24 or later. The HTTP variant also needs Python 3.
|
|
9
|
+
Use Node 24 or later. The HTTP variant also needs Python 3. Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm init -y
|
|
13
|
-
npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
|
|
13
|
+
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
|
|
14
14
|
npm install --save-dev typescript @types/node
|
|
15
15
|
cp -R node_modules/@anyswarm/core/examples/services/persistent-board demo
|
|
16
16
|
cd demo
|
|
@@ -51,6 +51,19 @@ npx anyswarm trace --root ./runs
|
|
|
51
51
|
|
|
52
52
|
Open the completed Run, expand **Service states**, and inspect the Board export. A publish call also links the Board state and original JSON. Export start/end times describe the framework's export work. The Board supplies its capture time and last committed entry ID as a business revision. These close/retirement observations have their own timestamps. The Viewer retains the individual publish call evidence alongside them.
|
|
53
53
|
|
|
54
|
+
## Watch a live Board
|
|
55
|
+
|
|
56
|
+
Copy this example from the installed SDK as shown above. Configure OpenSandbox and select an installed Worker with setup or `ANYSWARM_WORKER_IMAGE`. Open the example in a regular terminal and run:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
anyswarm --harness ./live.ts --mode rpc --lifetime interactive
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use a [Harness RPC client](../../harness-session/README.md) to start the Run
|
|
63
|
+
and submit two short findings with its input operation. Each commit emits the
|
|
64
|
+
row ID and updates the committed count. Stop the Session, then inspect its saved
|
|
65
|
+
records with `anyswarm trace`.
|
|
66
|
+
|
|
54
67
|
## Author a different Service
|
|
55
68
|
|
|
56
69
|
Register the adapter and grant its operations explicitly.
|
|
@@ -47,6 +47,13 @@ export class Board {
|
|
|
47
47
|
.all();
|
|
48
48
|
return rows.map(row => ({ id: Number(row.id), authorId: String(row.authorId), text: String(row.text), createdAt: String(row.createdAt) }));
|
|
49
49
|
}
|
|
50
|
+
observation() {
|
|
51
|
+
const recent = this.database.prepare('SELECT id, created_at AS createdAt, (SELECT COUNT(*) FROM entries) AS count FROM entries ORDER BY id DESC LIMIT 20').all();
|
|
52
|
+
return {
|
|
53
|
+
count: Number(recent[0]?.count ?? 0),
|
|
54
|
+
entries: recent.map(row => ({ id: Number(row.id), createdAt: String(row.createdAt) })),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
50
57
|
close() {
|
|
51
58
|
this.database.close();
|
|
52
59
|
}
|
|
@@ -35,6 +35,16 @@ export function boardService({ storagePath } = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
return current().list();
|
|
37
37
|
},
|
|
38
|
+
readState() {
|
|
39
|
+
const state = current().observation();
|
|
40
|
+
return { state, capturedAt: new Date().toISOString(), revision: String(state.entries[0]?.id ?? 0),
|
|
41
|
+
presentation: {
|
|
42
|
+
summary: [{ label: 'Committed entries', path: '/count' }],
|
|
43
|
+
tables: [{ title: 'Recent entries', path: '/entries', columns: [
|
|
44
|
+
{ label: 'ID', path: '/id' }, { label: 'Committed at', path: '/createdAt' },
|
|
45
|
+
] }],
|
|
46
|
+
} };
|
|
47
|
+
},
|
|
38
48
|
exportState() {
|
|
39
49
|
const entries = current().list();
|
|
40
50
|
return { entries: entries, count: entries.length, capturedAt: new Date().toISOString(),
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { createRuntime, createSandbox, resolveSandboxConnection, ServiceRegistry, workerImageFor, } from '@anyswarm/core';
|
|
3
|
+
import { Board } from './business.js';
|
|
4
|
+
import { boardService } from './index.js';
|
|
5
|
+
const harness = {
|
|
6
|
+
apiVersion: 1,
|
|
7
|
+
id: 'live-board',
|
|
8
|
+
lifetimes: ['interactive'],
|
|
9
|
+
input: true,
|
|
10
|
+
inputDescriptor: { description: 'Commit a finding to the Board', schema: { type: 'string', minLength: 1, maxLength: 10000 } },
|
|
11
|
+
async run(context) {
|
|
12
|
+
const connection = resolveSandboxConnection();
|
|
13
|
+
const storagePath = join(context.outputDir, 'board.sqlite');
|
|
14
|
+
const services = new ServiceRegistry();
|
|
15
|
+
services.register('board', boardService({ storagePath }));
|
|
16
|
+
return context.runWithRuntime({
|
|
17
|
+
createRuntime: () => createRuntime({
|
|
18
|
+
sandbox: createSandbox({ lifecycleBaseUrl: connection.lifecycleBaseUrl, apiKey: connection.apiKey }),
|
|
19
|
+
connection: { advertiseHost: connection.advertiseHost, publicUrl: connection.publicUrl },
|
|
20
|
+
// This Harness publishes Host input and never spawns a model-backed Agent.
|
|
21
|
+
models: { default: { provider: 'openai', model: 'unused', upstream: { url: 'http://127.0.0.1:1/v1/responses', headers: {} } } },
|
|
22
|
+
profiles: { observer: { model: 'default', image: connection.image ?? workerImageFor('pi'), writable: false } },
|
|
23
|
+
services, maxAgents: 1, outputDir: join(context.outputDir, 'runtime'),
|
|
24
|
+
}),
|
|
25
|
+
async run(runtime) {
|
|
26
|
+
const unregister = context.registerAgentControls({ runtime });
|
|
27
|
+
let writer;
|
|
28
|
+
try {
|
|
29
|
+
const board = new Board(storagePath, { create: false });
|
|
30
|
+
writer = board;
|
|
31
|
+
context.registerInput(input => {
|
|
32
|
+
if (typeof input !== 'string')
|
|
33
|
+
throw new TypeError('Enter a text finding');
|
|
34
|
+
const { id } = board.publish('run-owner', input);
|
|
35
|
+
const summary = 'Committed entries ' + board.observation().count;
|
|
36
|
+
context.updateStatus({ business: { summary } });
|
|
37
|
+
context.emit({ kind: 'board.commit', summary: summary + ' · entry ' + id });
|
|
38
|
+
return { id };
|
|
39
|
+
});
|
|
40
|
+
context.markRunning();
|
|
41
|
+
context.updateStatus({ business: { summary: 'Committed entries ' + board.observation().count } });
|
|
42
|
+
await new Promise(resolve => {
|
|
43
|
+
if (context.signal.aborted)
|
|
44
|
+
resolve();
|
|
45
|
+
else
|
|
46
|
+
context.signal.addEventListener('abort', () => resolve(), { once: true });
|
|
47
|
+
});
|
|
48
|
+
return { committed: board.observation().count };
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
writer?.close();
|
|
52
|
+
unregister();
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export default harness;
|
|
@@ -52,12 +52,12 @@ The example defaults to a local OpenSandbox lifecycle URL of `http://127.0.0.1:8
|
|
|
52
52
|
From `examples/subagents/`, run one task.
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
../../node_modules/.bin/anyswarm run ./main.ts \
|
|
56
|
+
./config.ts \
|
|
57
57
|
'Suggest two checks to make before merging a pull request.'
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
The entry waits for Root's reply, closes the team, and writes the task result and cleanup receipts to `subagents-runs/<runtimeId>/harness-report.json`. Edit `config.ts` or `main.ts` here and
|
|
60
|
+
The entry waits for Root's reply, closes the team, and writes the task result and cleanup receipts to `subagents-runs/<runtimeId>/harness-report.json`. Edit `config.ts` or `main.ts` here and run the TS entry again to try changes.
|
|
61
61
|
|
|
62
62
|
## Fixed or interactive host entry
|
|
63
63
|
|
|
@@ -79,8 +79,8 @@ Install the published SDK or a matching source archive as described above. The e
|
|
|
79
79
|
|
|
80
80
|
```sh
|
|
81
81
|
sdk=node_modules/@anyswarm/core
|
|
82
|
-
example="$sdk"/
|
|
83
|
-
|
|
82
|
+
example="$sdk"/examples/subagents
|
|
83
|
+
node_modules/.bin/anyswarm run "$example/main.ts" "$example/config.ts" --interactive
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
The configured `doctor --smoke` path covers Pi projects. The installed Codex example runs through the same local OpenSandbox provider and its own executor. [Codex startup and capabilities](../../docs/architecture/16-pi-opensandbox-backend.md#codex-app-server)
|
|
@@ -20,7 +20,9 @@ export async function createSubagentsHarness(config, controls = {}) {
|
|
|
20
20
|
const services = new ServiceRegistry();
|
|
21
21
|
let team;
|
|
22
22
|
const { contextFork: allowContextFork } = getExecutorCapabilities(config.executor ?? 'pi');
|
|
23
|
-
services.register('collaboration', createCollaborationService(request => team.invoke(request), () => team.exportState(), {
|
|
23
|
+
services.register('collaboration', createCollaborationService(request => team.invoke(request), () => team.exportState(), {
|
|
24
|
+
allowContextFork, readState: () => team.readLiveState(),
|
|
25
|
+
}));
|
|
24
26
|
if (controls.userQuestions)
|
|
25
27
|
services.register('user-interaction', controls.userQuestions);
|
|
26
28
|
const common = { image, writable: true, serviceToolMode: 'cli', services: { collaboration: collaborationOperations,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { workerImageFor, resolveSandboxConnection } from '@anyswarm/core';
|
|
1
|
+
import { workerImageFor, resolveSandboxConnection, ProjectPreflightError } from '@anyswarm/core';
|
|
2
2
|
function required(...names) {
|
|
3
3
|
for (const name of names) {
|
|
4
4
|
const value = process.env[name];
|
|
5
5
|
if (value)
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
|
-
throw new
|
|
8
|
+
throw new ProjectPreflightError('INVALID_RUN_CONFIGURATION', `Set ${names.join(' or ')} before running the Subagents Harness.`);
|
|
9
9
|
}
|
|
10
10
|
const { image, advertiseHost, publicUrl, endpointSource: _endpointSource, executor: setupExecutor, ...sandbox } = resolveSandboxConnection({}, 'SUBAGENTS');
|
|
11
11
|
const upstream = required('ANYSWARM_MODEL_URL', 'ANYSWARM_SUBAGENTS_MODEL_URL');
|
|
12
12
|
const token = process.env.ANYSWARM_MODEL_TOKEN ?? process.env.ANYSWARM_SUBAGENTS_MODEL_TOKEN;
|
|
13
13
|
const executor = process.env.ANYSWARM_EXECUTOR ?? process.env.ANYSWARM_SUBAGENTS_EXECUTOR ?? setupExecutor ?? 'pi';
|
|
14
14
|
const provider = process.env.ANYSWARM_MODEL_PROVIDER ?? process.env.ANYSWARM_SUBAGENTS_MODEL_PROVIDER ?? 'openai';
|
|
15
|
-
const model = process.env.ANYSWARM_MODEL_ID ?? process.env.ANYSWARM_SUBAGENTS_MODEL_ID ?? (executor === 'codex' ? required('
|
|
15
|
+
const model = process.env.ANYSWARM_MODEL_ID ?? process.env.ANYSWARM_SUBAGENTS_MODEL_ID ?? (executor === 'codex' ? required('ANYSWARM_MODEL_ID', 'ANYSWARM_SUBAGENTS_MODEL_ID') : 'gpt-5.4');
|
|
16
16
|
export default {
|
|
17
17
|
model: 'default',
|
|
18
18
|
maxAgents: Number(process.env.ANYSWARM_SUBAGENTS_MAX_AGENTS ?? 4),
|
|
@@ -16,6 +16,21 @@ export declare function createSubagentsController(runtime: Runtime, { maxDepth,
|
|
|
16
16
|
onChange?: () => void;
|
|
17
17
|
}): {
|
|
18
18
|
attachRoot: (id: string) => void;
|
|
19
|
+
ownerControl: (operation: 'interrupt' | 'stop', agentId: string, requestId: string, reason?: string) => Promise<unknown>;
|
|
20
|
+
sendMember(agentId: string, input: string, requestId: string, options: Omit<SendOptions, 'requestId'>, signal: AbortSignal): Promise<JsonValue>;
|
|
21
|
+
reconcileMemberInput(agentId: string, requestId: string, query: () => Promise<any>): Promise<any>;
|
|
22
|
+
reconcileOwnerControl(operation: 'interrupt' | 'stop', agentId: string, requestId: string, query: () => Promise<any>): Promise<any>;
|
|
23
|
+
readLiveState(): {
|
|
24
|
+
memberCount: number;
|
|
25
|
+
operationCount: number;
|
|
26
|
+
members: {
|
|
27
|
+
path: string;
|
|
28
|
+
agentId: string | null;
|
|
29
|
+
parent: string | null;
|
|
30
|
+
lastOutcome: "completed" | "failed" | "interrupted" | null;
|
|
31
|
+
waiting: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
19
34
|
rootId: () => string | undefined;
|
|
20
35
|
rootEpoch: () => number;
|
|
21
36
|
rootBusy: () => boolean;
|