@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
|
@@ -2,7 +2,7 @@ import { execFile, spawn } from 'node:child_process';
|
|
|
2
2
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
3
3
|
import { access, lstat, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { createConnection, isIP } from 'node:net';
|
|
5
|
-
import { homedir, platform } from 'node:os';
|
|
5
|
+
import { homedir, platform, release } from 'node:os';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
@@ -15,7 +15,9 @@ const execute = promisify(execFile);
|
|
|
15
15
|
export const localProviderImage = 'opensandbox/server:release-1.2.1@sha256:07f9b39adb8cadf68357dd1b86367068210e960fc4cb50e11b75176387557ea7';
|
|
16
16
|
export const localExecdImage = 'opensandbox/execd:release-1.2.1@sha256:6b12d17844ac7167271488302c71934e47f76abb9ddab19ec8529bd1c1c56b23';
|
|
17
17
|
export const localEgressImage = 'opensandbox/egress:release-1.2.1@sha256:84b98d3b5989a87389c977f6433f8cd3c7998d03aa15aaae41ebcb15b7eb8000';
|
|
18
|
-
const
|
|
18
|
+
const darwin = platform() === 'darwin';
|
|
19
|
+
const nativeArchitecture = process.arch === 'x64' ? 'amd64' : process.arch;
|
|
20
|
+
const profileVersion = darwin ? 'anyswarm-local-darwin-sdk-v1' : 'anyswarm-local-linux-sdk-v3';
|
|
19
21
|
const providerStartupMs = 90_000;
|
|
20
22
|
const sourceRoot = fileURLToPath(new URL('../', import.meta.url));
|
|
21
23
|
const root = sourceRoot.endsWith('/dist/') ? fileURLToPath(new URL('../../', import.meta.url)) : sourceRoot;
|
|
@@ -32,13 +34,33 @@ export async function resolveLocalEnvironment(partial = {}, scope) {
|
|
|
32
34
|
export function resolveSubagentsEnvironment(config = {}) {
|
|
33
35
|
return resolveLocalEnvironment(config, 'SUBAGENTS');
|
|
34
36
|
}
|
|
35
|
-
export function
|
|
37
|
+
export function checkSetupHost() {
|
|
36
38
|
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
39
|
+
const os = platform();
|
|
37
40
|
return [
|
|
38
|
-
check('host.
|
|
39
|
-
check('host.node', major > 22 || major === 22 && minor >= 19, `Node.js ${process.versions.node}`, 'Install Node.js 22.19 or newer.'),
|
|
41
|
+
check('host.platform', os === 'linux' || os === 'darwin', `Host operating system ${os} ${release()} (${process.arch})`, 'Run this command on Linux or macOS.'),
|
|
42
|
+
check('host.node', major > 22 || major === 22 && minor >= 19, `Node.js ${process.versions.node} (${process.execPath})`, 'Install Node.js 22.19 or newer.'),
|
|
40
43
|
];
|
|
41
44
|
}
|
|
45
|
+
export async function checkHostTools(signal) {
|
|
46
|
+
return Promise.all(['npm', 'git'].map(async (tool) => {
|
|
47
|
+
const id = `host.${tool}`;
|
|
48
|
+
const remedy = tool === 'npm' ? 'Install Node.js with npm and use that installation on PATH.'
|
|
49
|
+
: 'Install Git before running a project Harness that captures local files.';
|
|
50
|
+
const options = { signal, timeout: 5_000 };
|
|
51
|
+
let path;
|
|
52
|
+
try {
|
|
53
|
+
path = (await execute('/bin/sh', ['-c', 'command -v "$1"', 'anyswarm', tool], options)).stdout.trim();
|
|
54
|
+
const version = (await execute(tool, ['--version'], options)).stdout.trim();
|
|
55
|
+
return check(id, true, `${tool === 'git' ? version : 'npm ' + version} (${path})`);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
signal.throwIfAborted();
|
|
59
|
+
const detail = path ? `Could not verify ${tool} at ${path}.` : `${tool} was not found on PATH.`;
|
|
60
|
+
return check(id, false, detail, remedy);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
42
64
|
async function dockerInstallRemedy() {
|
|
43
65
|
const release = await readFile('/etc/os-release', 'utf8').catch(() => '');
|
|
44
66
|
const id = /^ID="?([a-z0-9_-]+)/m.exec(release)?.[1];
|
|
@@ -58,25 +80,70 @@ async function dockerInstallRemedy() {
|
|
|
58
80
|
export async function resolveLocalDocker() {
|
|
59
81
|
const socket = await localDockerSocket();
|
|
60
82
|
const info = JSON.parse(await run('docker', ['info', '--format', '{{json .}}']));
|
|
61
|
-
if (info.OSType !== 'linux')
|
|
62
|
-
throw new Error('Local setup needs a Linux Docker Engine.');
|
|
63
|
-
|
|
83
|
+
if (info.OSType !== 'linux') {
|
|
84
|
+
throw Object.assign(new Error('Local setup needs a Linux Docker Engine.'), { code: 'DOCKER_OS' });
|
|
85
|
+
}
|
|
86
|
+
if (darwin && ![nativeArchitecture, ...(nativeArchitecture === 'arm64' ? ['aarch64'] : ['x86_64'])].includes(info.Architecture)) {
|
|
87
|
+
throw Object.assign(new Error('The Docker daemon does not match the native Mac architecture.'), { code: 'DOCKER_ARCHITECTURE' });
|
|
88
|
+
}
|
|
89
|
+
const bridge = darwin ? undefined : JSON.parse(await run('docker', ['network', 'inspect', 'bridge']).catch(() => '[]'))[0];
|
|
64
90
|
const advertiseHost = bridge?.IPAM?.Config?.find((entry) => isIP(entry.Gateway ?? '') === 4)?.Gateway;
|
|
65
|
-
return { socket, advertiseHost, rootless: info.SecurityOptions?.some((value) => value.includes('rootless')) === true
|
|
91
|
+
return { socket, advertiseHost, rootless: info.SecurityOptions?.some((value) => value.includes('rootless')) === true,
|
|
92
|
+
clientVersion: info.ClientInfo?.Version, context: info.ClientInfo?.Context,
|
|
93
|
+
engineVersion: info.ServerVersion };
|
|
66
94
|
}
|
|
67
95
|
export async function checkLocalDocker() {
|
|
68
96
|
try {
|
|
69
97
|
const docker = await resolveLocalDocker();
|
|
70
|
-
|
|
98
|
+
const engine = [`Linux Docker Engine`, docker.engineVersion, `(${docker.rootless ? 'rootless' : 'rootful'})`].filter(Boolean).join(' ');
|
|
99
|
+
const client = docker.clientVersion ? `Docker CLI ${docker.clientVersion}` : '';
|
|
100
|
+
const context = docker.context ? `context ${docker.context}` : '';
|
|
101
|
+
return { docker, diagnostic: check('host.docker-engine', true, [engine, client, context].filter(Boolean).join(', ')) };
|
|
71
102
|
}
|
|
72
103
|
catch (error) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
104
|
+
if (error.code === 'DOCKER_ARCHITECTURE') {
|
|
105
|
+
return { diagnostic: check('host.docker-engine', false, 'The Docker daemon does not match the native Mac architecture.', 'Select a native local Docker engine for this Mac and run docker info. AnySwarm does not fall back to emulation.') };
|
|
106
|
+
}
|
|
107
|
+
const { code, syscall, stderr = '' } = error;
|
|
108
|
+
const missing = code === 'ENOENT' && syscall === 'spawn docker';
|
|
109
|
+
const contextRemedy = 'Run docker context show and docker info. If needed, run docker context ls and docker context use <local-context>. Check DOCKER_CONTEXT and DOCKER_HOST overrides.';
|
|
110
|
+
if (code === 'LOCAL_WORKER_UNAVAILABLE') {
|
|
111
|
+
return { diagnostic: check('host.docker-engine', false, 'The selected Docker context does not use a local Unix socket.', contextRemedy) };
|
|
112
|
+
}
|
|
113
|
+
if (code === 'DOCKER_OS') {
|
|
114
|
+
return { diagnostic: check('host.docker-engine', false, 'The selected Docker daemon is not a Linux engine.', contextRemedy) };
|
|
115
|
+
}
|
|
116
|
+
if (code === 'EACCES' || code === 'EPERM' || /permission denied.*(?:socket|docker daemon)|(?:socket|docker daemon).*permission denied/i.test(stderr)) {
|
|
117
|
+
return { diagnostic: check('host.docker-engine', false, 'Permission denied while accessing the local Docker engine.', 'Ask the host administrator to grant socket access. Sign in again after any group change and run docker info as your login user.') };
|
|
118
|
+
}
|
|
119
|
+
let desktopRemedy = 'Install Docker Desktop for Mac (https://docs.docker.com/desktop/setup/install/mac-install/), open it, and wait for the engine to start.';
|
|
120
|
+
if (darwin) {
|
|
121
|
+
const app = 'Docker.app/Contents/Info.plist';
|
|
122
|
+
const installed = await Promise.all(['/Applications', join(homedir(), 'Applications')]
|
|
123
|
+
.map(directory => access(join(directory, app)).then(() => true, () => false)));
|
|
124
|
+
if (installed.some(Boolean)) {
|
|
125
|
+
desktopRemedy = 'Docker Desktop is installed. Open Docker Desktop or wait for its engine to finish starting, then check that its CLI is on PATH.';
|
|
126
|
+
}
|
|
127
|
+
desktopRemedy += ' If you already use another local Linux engine such as OrbStack, start that instead.';
|
|
128
|
+
}
|
|
129
|
+
if (missing) {
|
|
130
|
+
return { diagnostic: check('host.docker-engine', false, 'The Docker CLI was not found on PATH.', darwin ? desktopRemedy + ' ' + contextRemedy : await dockerInstallRemedy()) };
|
|
131
|
+
}
|
|
132
|
+
const unavailable = code === 'ENOENT' || /cannot connect|connection refused|daemon running/i.test(stderr);
|
|
133
|
+
const detail = unavailable ? 'The Docker CLI is installed, but the local daemon or its Unix socket is unavailable.'
|
|
134
|
+
: 'Could not verify the selected local Docker engine.';
|
|
135
|
+
return { diagnostic: check('host.docker-engine', false, detail, (darwin ? desktopRemedy : 'Start the local Docker engine, then verify access as your login user.') + ' ' + contextRemedy) };
|
|
78
136
|
}
|
|
79
137
|
}
|
|
138
|
+
export async function discoverMacCallback(image, signal) {
|
|
139
|
+
const output = await run('docker', ['run', '--rm', '--platform', `linux/${nativeArchitecture}`, '--entrypoint', 'getent', image, 'ahostsv4', 'host.docker.internal'], signal).catch(() => '');
|
|
140
|
+
signal?.throwIfAborted();
|
|
141
|
+
const addresses = [...new Set(output.split('\n').map(line => line.split(/\s+/, 1)[0])
|
|
142
|
+
.filter(value => isIP(value) === 4 && value !== '0.0.0.0' && !value.startsWith('127.')))];
|
|
143
|
+
if (addresses.length !== 1)
|
|
144
|
+
throw Object.assign(new Error('Could not resolve the native Mac callback in Docker'), { code: 'DOCKER_CALLBACK_UNAVAILABLE' });
|
|
145
|
+
return addresses[0];
|
|
146
|
+
}
|
|
80
147
|
function lifecycleUrl(config) {
|
|
81
148
|
return loopbackLifecycle(config.lifecycleBaseUrl);
|
|
82
149
|
}
|
|
@@ -99,8 +166,15 @@ async function ownedProvider(config, provider) {
|
|
|
99
166
|
(config.providerId && config.providerId !== provider.Id))
|
|
100
167
|
return false;
|
|
101
168
|
const state = join(homedir(), '.cache/anyswarm/opensandbox', token);
|
|
102
|
-
|
|
103
|
-
|
|
169
|
+
const port = String(lifecycleUrl(config)?.port || 80);
|
|
170
|
+
const ports = provider.HostConfig?.PortBindings;
|
|
171
|
+
const publication = ports?.[`${port}/tcp`];
|
|
172
|
+
const networkMatches = darwin
|
|
173
|
+
? provider.HostConfig?.NetworkMode === 'bridge' && Object.keys(ports ?? {}).length === 1 &&
|
|
174
|
+
publication?.length === 1 && publication[0].HostIp === '127.0.0.1' && publication[0].HostPort === port &&
|
|
175
|
+
provider.HostConfig.Binds?.includes('/var/run/docker.sock:/var/run/docker.sock')
|
|
176
|
+
: provider.HostConfig?.NetworkMode === 'host';
|
|
177
|
+
if (labels['org.anyswarm.setup.state'] !== state || provider.Config.Image !== localProviderImage || !networkMatches ||
|
|
104
178
|
!provider.HostConfig.Binds?.includes(`${join(state, 'config.toml')}:/config/config.toml:ro`) ||
|
|
105
179
|
!provider.HostConfig.Binds.includes(`${join(state, 'data')}:/root/.opensandbox`))
|
|
106
180
|
return false;
|
|
@@ -169,11 +243,13 @@ async function authenticatedHealth(config, budget) {
|
|
|
169
243
|
return error instanceof SandboxApiException && (error.statusCode === 401 || error.statusCode === 403) ? 'denied' : 'unreachable';
|
|
170
244
|
}
|
|
171
245
|
}
|
|
172
|
-
export async function checkLocalProvider(config, { requireAuth = true } = {}) {
|
|
246
|
+
export async function checkLocalProvider(config, { requireAuth = true, managed = false } = {}) {
|
|
173
247
|
const [healthy, denied] = await Promise.all([providerHealthy(config, true), requireAuth ? providerHealthy(config, false) : true]);
|
|
174
248
|
return [
|
|
175
|
-
check('provider.health', healthy, healthy ? 'OpenSandbox lifecycle listing is reachable with the configured credentials.' : 'OpenSandbox lifecycle listing failed.',
|
|
176
|
-
|
|
249
|
+
check('provider.health', healthy, healthy ? 'OpenSandbox lifecycle listing is reachable with the configured credentials.' : 'OpenSandbox lifecycle listing failed.', managed ? 'Run anyswarm setup to start or restore the managed OpenSandbox service.'
|
|
250
|
+
: 'Check ANYSWARM_LIFECYCLE_URL (or sandbox.lifecycleBaseUrl in --config), TLS trust, and the lifecycle API key. Rerun the same command.'),
|
|
251
|
+
...(requireAuth ? [check('provider.authentication', denied && !!config.apiKey, denied && config.apiKey ? 'Lifecycle rejects requests without the configured API key.' : 'Lifecycle authentication could not be confirmed.', managed ? 'Run anyswarm setup to check the managed service and its local credentials.'
|
|
252
|
+
: 'Configure a lifecycle API key on OpenSandbox and pass it through trusted anyswarm configuration.')] : []),
|
|
177
253
|
];
|
|
178
254
|
}
|
|
179
255
|
async function withProviderLock(config, action, signal) {
|
|
@@ -183,7 +259,8 @@ async function withProviderLock(config, action, signal) {
|
|
|
183
259
|
signal?.throwIfAborted();
|
|
184
260
|
const directory = join(homedir(), '.cache/anyswarm/opensandbox');
|
|
185
261
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
186
|
-
const
|
|
262
|
+
const flags = darwin ? ['-k', '-t', '180'] : ['--exclusive', '--timeout', '180'];
|
|
263
|
+
const child = spawn(darwin ? '/usr/bin/lockf' : 'flock', [...flags, join(directory, `port-${url.port || 80}.lock`),
|
|
187
264
|
process.execPath, '-e', 'console.log("locked"); process.stdin.resume()'], { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
188
265
|
child.stdin.on('error', () => { });
|
|
189
266
|
const cancel = () => child.kill('SIGTERM');
|
|
@@ -225,13 +302,15 @@ function localPortInUse(url) {
|
|
|
225
302
|
}
|
|
226
303
|
async function prepareProviderImage(image, code, signal) {
|
|
227
304
|
try {
|
|
228
|
-
await run('docker', ['image', 'inspect', image], signal);
|
|
305
|
+
const architecture = await run('docker', ['image', 'inspect', ...(darwin ? ['--format', '{{.Os}}/{{.Architecture}}'] : []), image], signal);
|
|
306
|
+
if (darwin && architecture !== `linux/${nativeArchitecture}`)
|
|
307
|
+
throw new Error('Pinned image is not installed for the native architecture.');
|
|
229
308
|
}
|
|
230
309
|
catch {
|
|
231
310
|
signal?.throwIfAborted();
|
|
232
311
|
console.error(`anyswarm setup: pulling ${image}`);
|
|
233
312
|
try {
|
|
234
|
-
await run('docker', ['pull', image], signal);
|
|
313
|
+
await run('docker', ['pull', ...(darwin ? ['--platform', `linux/${nativeArchitecture}`] : []), image], signal);
|
|
235
314
|
}
|
|
236
315
|
catch {
|
|
237
316
|
signal?.throwIfAborted();
|
|
@@ -244,7 +323,9 @@ async function ensureLocalProviderLocked(config, { signal } = {}) {
|
|
|
244
323
|
if (!url)
|
|
245
324
|
throw Object.assign(new Error('Local loopback OpenSandbox /v1 URL required'), { code: 'PROVIDER_CONFIGURATION_INVALID' });
|
|
246
325
|
signal?.throwIfAborted();
|
|
247
|
-
const
|
|
326
|
+
const docker = await resolveLocalDocker();
|
|
327
|
+
const socket = darwin ? '/var/run/docker.sock' : docker.socket;
|
|
328
|
+
const activeConfig = () => ({ ...config, egressMode: 'dns+nft', ...(darwin ? { useServerProxy: true } : {}) });
|
|
248
329
|
const existing = await inspectProvider(config, signal);
|
|
249
330
|
if (existing && !await ownedProvider(config, existing)) {
|
|
250
331
|
throw Object.assign(new Error('A different container owns the local service name'), { code: 'PROVIDER_NAME_IN_USE' });
|
|
@@ -292,7 +373,8 @@ async function ensureLocalProviderLocked(config, { signal } = {}) {
|
|
|
292
373
|
const token = randomUUID();
|
|
293
374
|
const stateDir = join(homedir(), '.cache/anyswarm/opensandbox', token);
|
|
294
375
|
const name = `anyswarm-opensandbox-${url.port || 80}`;
|
|
295
|
-
const
|
|
376
|
+
const port = Number(url.port || 80);
|
|
377
|
+
const recipe = (await readFile(join(root, 'deploy/opensandbox/config.toml'), 'utf8')).replace('port = 8080', `port = ${port}\napi_key = ${JSON.stringify(config.apiKey)}`).replace('host = "127.0.0.1"', darwin ? 'host = "0.0.0.0"' : 'host = "127.0.0.1"');
|
|
296
378
|
try {
|
|
297
379
|
await mkdir(join(stateDir, 'data'), { recursive: true, mode: 0o700 });
|
|
298
380
|
await writeFile(join(stateDir, 'config.toml'), recipe, { mode: 0o600, flag: 'wx' });
|
|
@@ -354,7 +436,8 @@ async function ensureLocalProviderLocked(config, { signal } = {}) {
|
|
|
354
436
|
await prepareProviderImage(localEgressImage, 'PROVIDER_EGRESS_PULL_FAILED', signal);
|
|
355
437
|
await prepareProviderImage(localProviderImage, 'PROVIDER_SERVER_PULL_FAILED', signal);
|
|
356
438
|
try {
|
|
357
|
-
|
|
439
|
+
const network = darwin ? ['--platform', `linux/${nativeArchitecture}`, '--network', 'bridge', '--publish', `127.0.0.1:${port}:${port}`] : ['--network', 'host'];
|
|
440
|
+
id = await run('docker', ['run', '-d', '--name', name, ...network, '--restart', 'unless-stopped', '--label', `org.anyswarm.setup.profile=${profileVersion}`, '--label', `org.anyswarm.setup.owner=${token}`, '--label', `org.anyswarm.setup.state=${stateDir}`, '-v', `${socket}:/var/run/docker.sock`, '-v', `${join(stateDir, 'config.toml')}:/config/config.toml:ro`, '-v', `${join(stateDir, 'data')}:/root/.opensandbox`, localProviderImage, '--config', '/config/config.toml'], signal);
|
|
358
441
|
created = true;
|
|
359
442
|
}
|
|
360
443
|
catch {
|
|
@@ -370,7 +453,7 @@ async function ensureLocalProviderLocked(config, { signal } = {}) {
|
|
|
370
453
|
const provider = await waitForProvider({ ...config, providerId: id || undefined }, signal);
|
|
371
454
|
if (created) {
|
|
372
455
|
providerReady = true;
|
|
373
|
-
return { ...handle, config:
|
|
456
|
+
return { ...handle, config: activeConfig(), created: true, id, images: await imageIds(provider) };
|
|
374
457
|
}
|
|
375
458
|
await rm(stateDir, { recursive: true, force: true });
|
|
376
459
|
return reuse(provider);
|
|
@@ -383,7 +466,7 @@ async function ensureLocalProviderLocked(config, { signal } = {}) {
|
|
|
383
466
|
const path = provider.Config.Labels?.['org.anyswarm.setup.state'];
|
|
384
467
|
if (provider.Config.Labels?.['org.anyswarm.setup.profile'] === profileVersion && path?.startsWith(join(homedir(), '.cache/anyswarm/opensandbox/')))
|
|
385
468
|
await writeFile(join(path, 'adopted'), '', { mode: 0o600 });
|
|
386
|
-
return { config:
|
|
469
|
+
return { config: activeConfig(), id: provider.Id, images: await imageIds(provider), created: false, retain: async () => {
|
|
387
470
|
const current = await inspectProvider(config);
|
|
388
471
|
if (current?.Id !== provider.Id)
|
|
389
472
|
throw new Error('Provider identity changed');
|
|
@@ -67,7 +67,8 @@ export async function runLocalSmoke(options) {
|
|
|
67
67
|
},
|
|
68
68
|
models: { default: model }, filePolicy: options.filePolicy,
|
|
69
69
|
profiles: { probe: { addedSystemPrompt: SETUP_PROFILE_PROMPT, model: 'default', image: options.image,
|
|
70
|
-
writable: true, services: { 'setup-probe': ['verify'] }
|
|
70
|
+
writable: true, services: { 'setup-probe': ['verify'] },
|
|
71
|
+
...(driver.kind === 'codex' ? { serviceToolMode: 'cli' } : {}) } },
|
|
71
72
|
services, maxAgents: 1, outputDir: temporary,
|
|
72
73
|
});
|
|
73
74
|
receipt.runtimeId = runtime.id;
|
|
@@ -79,7 +80,7 @@ export async function runLocalSmoke(options) {
|
|
|
79
80
|
signal.throwIfAborted();
|
|
80
81
|
if (agent.status !== 'idle')
|
|
81
82
|
throw new Error('worker');
|
|
82
|
-
passed(stage, `Controller reached the real Worker and verified ${driver.kind}
|
|
83
|
+
passed(stage, `Controller reached the real Worker and verified ${driver.kind}${driver.version ? ' ' + driver.version : ''}`);
|
|
83
84
|
if (upstream) {
|
|
84
85
|
stage = 'agent-bridge-gateway';
|
|
85
86
|
async function turn(message, requestId, expected) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExecutorSelection } from '../src/core/executor-adapter.js';
|
|
2
2
|
import type { DiagnosticCheck } from './local-environment.js';
|
|
3
3
|
import { type LocalWorker } from '../src/core/sandbox/local-worker.js';
|
|
4
4
|
import type { LocalExecutorSelection } from '../src/core/sandbox/local-executor.js';
|
|
@@ -3,11 +3,13 @@ import { execFile } from 'node:child_process';
|
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
4
|
import { isOfficialWorkerImage, WORKER_PROTOCOL } from '../src/core/worker-image.js';
|
|
5
5
|
import { selectExecutorDriver } from '../src/core/sandbox/executor-driver.js';
|
|
6
|
+
import { executorVersion } from '../src/core/executor-adapter.js';
|
|
6
7
|
import { prepareLocalWorker } from '../src/core/sandbox/local-worker.js';
|
|
7
8
|
const exec = promisify(execFile);
|
|
8
9
|
const protocol = WORKER_PROTOCOL;
|
|
9
10
|
const imageIdPattern = /^sha256:[a-f0-9]{64}$/;
|
|
10
11
|
const imageReferencePattern = /^[a-z0-9][a-z0-9._/@:+-]{0,254}$/i;
|
|
12
|
+
const darwinWorkerPlatform = process.platform === 'darwin' ? `linux/${process.arch === 'x64' ? 'amd64' : process.arch}` : undefined;
|
|
11
13
|
const remedy = 'Run anyswarm setup to prepare the selected Worker, or set ANYSWARM_WORKER_IMAGE to a compatible image.';
|
|
12
14
|
async function inspectWorker(reference, driver, signal) {
|
|
13
15
|
if (!imageReferencePattern.test(reference))
|
|
@@ -30,6 +32,12 @@ async function inspectWorker(reference, driver, signal) {
|
|
|
30
32
|
remedy }], state: absent ? 'missing' : 'unavailable',
|
|
31
33
|
};
|
|
32
34
|
}
|
|
35
|
+
if (darwinWorkerPlatform && `${image.Os}/${image.Architecture}` !== darwinWorkerPlatform)
|
|
36
|
+
return {
|
|
37
|
+
checks: [{ id: 'worker-platform', ok: false, detail: `The local Worker must be ${darwinWorkerPlatform} on this Mac.`,
|
|
38
|
+
remedy: 'Select a native Linux Worker, or omit the image and build a Worker from the selected executable.' }],
|
|
39
|
+
state: 'unavailable',
|
|
40
|
+
};
|
|
33
41
|
const labels = image.Config?.Labels ?? {};
|
|
34
42
|
const protocolMatches = labels['org.anyswarm.opensandbox.worker-protocol'] === protocol &&
|
|
35
43
|
labels['org.anyswarm.opensandbox.file-protocol'] === fileProtocol;
|
|
@@ -38,7 +46,8 @@ async function inspectWorker(reference, driver, signal) {
|
|
|
38
46
|
const actualVersion = labels[`org.anyswarm.opensandbox.${executor}-version`];
|
|
39
47
|
const versionMatches = driver.adapter
|
|
40
48
|
? actualVersion === version && labels[`org.anyswarm.opensandbox.${executor}-protocol`] === driver.adapter.protocol
|
|
41
|
-
: actualVersion
|
|
49
|
+
: executorVersion(actualVersion) && (version === undefined || actualVersion === version) &&
|
|
50
|
+
(installed === undefined || installed === 'both' || installed === executor);
|
|
42
51
|
return {
|
|
43
52
|
checks: [
|
|
44
53
|
{ id: 'worker-image', ok: true, detail: `Docker resolved ${image.Id}.` },
|
|
@@ -46,12 +55,12 @@ async function inspectWorker(reference, driver, signal) {
|
|
|
46
55
|
detail: protocolMatches ? `The image declares ${protocol} and ${fileProtocol}.` : `The image does not declare the required Worker protocol ${protocol} and ${fileProtocol}.`,
|
|
47
56
|
...(protocolMatches ? {} : { remedy }) },
|
|
48
57
|
{ id: `worker-${executor}`, ok: versionMatches,
|
|
49
|
-
detail: versionMatches ? `The image declares ${executor} ${
|
|
50
|
-
`Image declares ${executor} ${actualVersion ?? 'unavailable'};
|
|
58
|
+
detail: versionMatches ? `The image declares ${executor} ${actualVersion}.` :
|
|
59
|
+
`Image declares ${executor} ${actualVersion ?? 'unavailable'}; expected ${version ?? 'an exact version'}.`,
|
|
51
60
|
...(versionMatches ? {} : { remedy }) },
|
|
52
61
|
],
|
|
53
|
-
...(protocolMatches && versionMatches ? { image: { reference, id: image.Id,
|
|
54
|
-
digests: (image.RepoDigests ?? []).filter(value => imageReferencePattern.test(value)), protocol, executor, version } } : {}),
|
|
62
|
+
...(protocolMatches && versionMatches && actualVersion !== undefined ? { image: { reference, id: image.Id,
|
|
63
|
+
digests: (image.RepoDigests ?? []).filter(value => imageReferencePattern.test(value)), protocol, executor, version: actualVersion } } : {}),
|
|
55
64
|
state: 'inspected',
|
|
56
65
|
};
|
|
57
66
|
}
|
|
@@ -100,7 +109,7 @@ export async function prepareWorkerImage({ requestedImage, executor = 'pi', loca
|
|
|
100
109
|
}
|
|
101
110
|
progress?.(`Pulling explicitly selected Worker ${reference}`);
|
|
102
111
|
try {
|
|
103
|
-
await exec('docker', ['pull', '--', reference], { signal, timeout: 15 * 60_000, maxBuffer: 12 * 1024 * 1024 });
|
|
112
|
+
await exec('docker', ['pull', ...(darwinWorkerPlatform ? ['--platform', darwinWorkerPlatform] : []), '--', reference], { signal, timeout: 15 * 60_000, maxBuffer: 12 * 1024 * 1024 });
|
|
104
113
|
}
|
|
105
114
|
catch (error) {
|
|
106
115
|
signal.throwIfAborted();
|
|
@@ -13,6 +13,7 @@ type Timing = {
|
|
|
13
13
|
type Model = {
|
|
14
14
|
configuration: 'complete' | 'missing' | 'invalid';
|
|
15
15
|
verification: 'not-verified';
|
|
16
|
+
remedy?: string;
|
|
16
17
|
};
|
|
17
18
|
export declare function runLocalCommand(command: LocalCommand, signal: AbortSignal, progress?: (message: string) => void): Promise<{
|
|
18
19
|
command: LocalCommand['command'];
|
|
@@ -38,13 +39,15 @@ export declare function runLocalCommand(command: LocalCommand, signal: AbortSign
|
|
|
38
39
|
configuration?: {
|
|
39
40
|
executor: {
|
|
40
41
|
id: string;
|
|
41
|
-
version
|
|
42
|
-
|
|
42
|
+
version?: string;
|
|
43
|
+
entry?: string;
|
|
44
|
+
compatibleVersions?: readonly string[];
|
|
43
45
|
};
|
|
44
46
|
image: string;
|
|
45
47
|
filePolicy: ResolvedFilePolicy;
|
|
46
48
|
};
|
|
47
49
|
checks: DiagnosticCheck[];
|
|
50
|
+
tooling?: DiagnosticCheck[];
|
|
48
51
|
timings: Timing[];
|
|
49
52
|
elapsedMs: number;
|
|
50
53
|
interrupted: boolean;
|