@anyswarm/core 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +20 -5
- package/README.md +69 -55
- package/dist/examples/README.md +138 -77
- package/dist/examples/authoring/README.md +4 -4
- package/dist/examples/autoresearch/README.md +108 -16
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- package/dist/examples/autoresearch/config.d.ts +48 -5
- package/dist/examples/autoresearch/config.js +57 -23
- package/dist/examples/autoresearch/demo.d.ts +12 -4
- package/dist/examples/autoresearch/demo.js +65 -22
- package/dist/examples/autoresearch/eject.json +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
- package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
- package/dist/examples/autoresearch/frontiercs2.js +71 -14
- package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
- package/dist/examples/autoresearch/prepare-demo.js +46 -0
- package/dist/examples/autoresearch/prepare.d.ts +105 -53
- package/dist/examples/autoresearch/prepare.js +126 -57
- package/dist/examples/autoresearch/project.d.ts +6 -95
- package/dist/examples/autoresearch/project.js +131 -45
- package/dist/examples/autoresearch/research-service.d.ts +16 -1
- package/dist/examples/autoresearch/research-service.js +84 -44
- package/dist/examples/code/README.md +25 -17
- package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
- package/dist/examples/code/config.d.ts +1 -0
- package/dist/examples/first-harness/AGENTS.md +25 -0
- package/dist/examples/first-harness/README.md +136 -0
- package/dist/examples/first-harness/config.d.ts +9 -8
- package/dist/examples/first-harness/config.js +33 -26
- package/dist/examples/first-harness/eject.json +14 -0
- package/dist/examples/first-harness/handoff.js +3 -3
- package/dist/examples/first-harness/harness.d.ts +14 -18
- package/dist/examples/first-harness/harness.js +102 -77
- package/dist/examples/first-harness/input/README.md +7 -0
- package/dist/examples/first-harness/session.js +2 -1
- package/dist/examples/first-harness/tsconfig.json +2 -1
- package/dist/examples/harness-session/README.md +4 -4
- package/dist/examples/lead-worker/README.md +1 -1
- package/dist/examples/lead-worker/project-config.d.ts +1 -0
- package/dist/examples/messages/README.md +2 -2
- package/dist/examples/notes/README.md +5 -5
- package/dist/examples/notes/config.d.ts +1 -0
- package/dist/examples/parallel-swarm/AGENTS.md +32 -0
- package/dist/examples/parallel-swarm/README.md +136 -0
- package/dist/examples/parallel-swarm/board-service.js +25 -8
- package/dist/examples/parallel-swarm/board.d.ts +31 -1
- package/dist/examples/parallel-swarm/board.js +98 -13
- package/dist/examples/parallel-swarm/config.d.ts +11 -0
- package/dist/examples/parallel-swarm/config.js +39 -0
- package/dist/examples/parallel-swarm/eject.json +5 -0
- package/dist/examples/parallel-swarm/harness.d.ts +26 -20
- package/dist/examples/parallel-swarm/harness.js +77 -76
- package/dist/examples/parallel-swarm/report.d.ts +12 -0
- package/dist/examples/parallel-swarm/report.js +30 -0
- package/dist/examples/peermesh/README.md +1 -1
- package/dist/examples/peermesh/project-config.d.ts +1 -0
- package/dist/examples/services/agent-control/README.md +1 -1
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/mcp-managed/README.md +1 -1
- package/dist/examples/services/persistent-board/README.md +6 -3
- package/dist/examples/subagents/AGENTS.md +35 -0
- package/dist/examples/subagents/README.md +129 -93
- package/dist/examples/subagents/config.d.ts +2 -10
- package/dist/examples/subagents/config.js +9 -16
- package/dist/examples/subagents/eject.json +17 -0
- package/dist/examples/subagents/handoff-config.d.ts +41 -0
- package/dist/examples/subagents/handoff-config.js +13 -0
- package/dist/examples/subagents/model.d.ts +3 -0
- package/dist/examples/subagents/model.js +19 -0
- package/dist/examples/substrate/README.md +12 -6
- package/dist/examples/substrate/config.d.ts +1 -0
- package/dist/examples/substrate/project-config.d.ts +1 -0
- package/dist/examples/super/README.md +34 -22
- package/dist/examples/super/actions.d.ts +1 -1
- package/dist/examples/super/actions.js +11 -11
- package/dist/examples/super/config.js +3 -3
- package/dist/examples/super/eject.json +1 -1
- package/dist/examples/super/location.js +1 -1
- package/dist/examples/super/operator.d.ts +1 -0
- package/dist/examples/super/operator.js +31 -0
- package/dist/examples/super/project.d.ts +0 -107
- package/dist/examples/super/project.js +1 -3
- package/dist/examples/taskpool/README.md +1 -1
- package/dist/examples/taskpool/config.d.ts +1 -0
- package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
- package/dist/scripts/anyswarm-arguments.d.ts +7 -25
- package/dist/scripts/anyswarm-arguments.js +69 -97
- package/dist/scripts/anyswarm-eject.js +1 -1
- package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
- package/dist/scripts/anyswarm-harnesses.js +1 -22
- package/dist/scripts/anyswarm-installation.d.ts +7 -40
- package/dist/scripts/anyswarm-installation.js +17 -291
- package/dist/scripts/anyswarm-launch.d.ts +6 -36
- package/dist/scripts/anyswarm-launch.js +32 -81
- package/dist/scripts/anyswarm-progress.d.ts +6 -0
- package/dist/scripts/anyswarm-progress.js +133 -0
- package/dist/scripts/anyswarm-project.d.ts +1 -9
- package/dist/scripts/anyswarm-project.js +40 -127
- package/dist/scripts/anyswarm-source-runner.js +9 -41
- package/dist/scripts/anyswarm.js +6 -26
- package/dist/scripts/build-provenance.json +1 -1
- package/dist/scripts/generate-architecture-coverage.js +1 -1
- package/dist/scripts/generate-architecture-prompts.js +18 -10
- package/dist/scripts/local-environment.d.ts +13 -7
- package/dist/scripts/local-environment.js +73 -21
- package/dist/scripts/local-setup.d.ts +3 -0
- package/dist/scripts/local-setup.js +153 -118
- package/dist/scripts/pack-release.js +31 -4
- package/dist/src/core/index.js +1 -1
- package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
- package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
- package/dist/src/core/sandbox/sandbox-connection.js +22 -7
- package/dist/src/core/worker-image.js +1 -1
- package/dist/src/harness/project-harness.d.ts +1 -0
- package/dist/src/harness/project-harness.js +5 -4
- package/dist/src/harness/project-rpc-client.js +19 -0
- package/dist/src/harness/project-runtime.js +3 -1
- package/dist/src/harness/typescript-loader.d.ts +2 -0
- package/dist/src/harness/typescript-loader.js +26 -8
- package/dist/src/trace-viewer/command.mjs +6 -3
- package/dist/src/trace-viewer/public/app.js +239 -59
- package/dist/src/trace-viewer/public/index.html +5 -0
- package/dist/src/trace-viewer/public/style.css +22 -0
- package/dist/src/trace-viewer/reader.mjs +242 -26
- package/dist/src/trace-viewer/run-root.d.mts +1 -0
- package/dist/src/trace-viewer/run-root.mjs +7 -0
- package/dist/src/trace-viewer/server.mjs +3 -1
- package/docs/INDEX.md +11 -9
- package/docs/architecture/04-services.md +1 -1
- package/docs/architecture/06-observability-experiments.md +21 -7
- package/docs/architecture/07-run-configuration.md +118 -19
- package/docs/architecture/08-prompts.md +21 -2
- package/docs/architecture/10-service-api-reference.md +12 -5
- package/docs/architecture/12-code-coverage.md +157 -115
- package/docs/architecture/15-core-runtime.md +1 -1
- package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
- package/docs/architecture/17-harness-reporting.md +79 -1
- package/docs/architecture/22-website.md +52 -20
- package/docs/architecture/23-project-harness.md +109 -37
- package/docs/architecture/26-code.md +20 -5
- package/docs/architecture/27-personal.md +23 -8
- package/docs/architecture/28-autoresearch.md +18 -12
- package/docs/architecture/INDEX.md +1 -2
- package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
- package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
- package/docs/architecture/prompts/22-autoresearch.md +9 -2
- package/docs/architecture/prompts/source-manifest.json +76 -52
- package/docs/architecture/source-map.json +445 -105
- package/docs/designs/core-harness/01-core.md +2 -2
- package/docs/designs/core-harness/06-project-harness.md +3 -3
- package/docs/designs/core-harness/README.md +2 -2
- package/docs/en/agents.md +1 -1
- package/docs/en/autoresearch.md +41 -0
- package/docs/en/blog/100b-tokens.md +157 -0
- package/docs/en/build-your-harness.md +47 -22
- package/docs/en/changelog.md +29 -1
- package/docs/en/first-harness.md +40 -32
- package/docs/en/harnesses/index.md +23 -23
- package/docs/en/harnesses/lead-worker.md +1 -1
- package/docs/en/harnesses/peermesh.md +2 -2
- package/docs/en/harnesses/subagents.md +10 -31
- package/docs/en/harnesses/substrate.md +4 -4
- package/docs/en/harnesses/taskpool.md +2 -2
- package/docs/en/latest.md +30 -5
- package/docs/en/overview.md +22 -22
- package/docs/en/quickstart.md +69 -56
- package/docs/en/reference/api.md +1 -1
- package/docs/en/reference/cli.md +47 -85
- package/docs/en/sandbox.md +3 -3
- package/docs/en/trace-viewer.md +32 -12
- package/docs/operations/trace-viewer.md +26 -11
- package/docs/third-party-notices.md +0 -1
- package/docs/workflows/development.md +160 -118
- package/docs/workflows/release-and-docs-versioning.md +207 -54
- package/docs/workflows/release-cli-acceptance.md +162 -0
- package/docs/zh/agents.md +1 -1
- package/docs/zh/autoresearch.md +41 -0
- package/docs/zh/blog/100b-tokens.md +102 -0
- package/docs/zh/build-your-harness.md +48 -23
- package/docs/zh/changelog.md +29 -1
- package/docs/zh/first-harness.md +43 -35
- package/docs/zh/harnesses/index.md +23 -23
- package/docs/zh/harnesses/lead-worker.md +1 -1
- package/docs/zh/harnesses/peermesh.md +2 -2
- package/docs/zh/harnesses/subagents.md +10 -31
- package/docs/zh/harnesses/substrate.md +4 -4
- package/docs/zh/harnesses/taskpool.md +2 -2
- package/docs/zh/latest.md +30 -5
- package/docs/zh/overview.md +23 -23
- package/docs/zh/quickstart.md +66 -57
- package/docs/zh/reference/api.md +1 -1
- package/docs/zh/reference/cli.md +19 -79
- package/docs/zh/sandbox.md +3 -3
- package/docs/zh/trace-viewer.md +32 -12
- package/examples/README.md +138 -77
- package/examples/authoring/README.md +4 -4
- package/examples/autoresearch/README.md +108 -16
- package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- package/examples/autoresearch/config.ts +64 -25
- package/examples/autoresearch/demo.ts +75 -22
- package/examples/autoresearch/eject.json +2 -0
- package/examples/autoresearch/frontiercs2-config.ts +15 -0
- package/examples/autoresearch/frontiercs2.ts +64 -11
- package/examples/autoresearch/prepare-demo.ts +44 -0
- package/examples/autoresearch/prepare.ts +134 -60
- package/examples/autoresearch/project.ts +120 -44
- package/examples/autoresearch/research-service.ts +91 -41
- package/examples/code/README.md +25 -17
- package/examples/code/REQUIREMENTS.zh.md +3 -3
- package/examples/first-harness/AGENTS.md +25 -0
- package/examples/first-harness/README.md +136 -0
- package/examples/first-harness/config.ts +41 -27
- package/examples/first-harness/eject.json +14 -0
- package/examples/first-harness/handoff.ts +3 -3
- package/examples/first-harness/harness.ts +104 -72
- package/examples/first-harness/input/README.md +7 -0
- package/examples/first-harness/session.ts +2 -1
- package/examples/first-harness/tsconfig.json +2 -1
- package/examples/harness-session/README.md +4 -4
- package/examples/lead-worker/README.md +1 -1
- package/examples/messages/README.md +2 -2
- package/examples/notes/README.md +5 -5
- package/examples/parallel-swarm/AGENTS.md +32 -0
- package/examples/parallel-swarm/README.md +136 -0
- package/examples/parallel-swarm/board-service.ts +28 -9
- package/examples/parallel-swarm/board.ts +107 -13
- package/examples/parallel-swarm/config.ts +47 -0
- package/examples/parallel-swarm/eject.json +5 -0
- package/examples/parallel-swarm/harness.ts +83 -71
- package/examples/parallel-swarm/report.ts +33 -0
- package/examples/peermesh/README.md +1 -1
- package/examples/services/agent-control/README.md +1 -1
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/mcp-managed/README.md +1 -1
- package/examples/services/persistent-board/README.md +6 -3
- package/examples/subagents/AGENTS.md +35 -0
- package/examples/subagents/README.md +129 -93
- package/examples/subagents/config.ts +9 -15
- package/examples/subagents/eject.json +17 -0
- package/examples/subagents/handoff-config.ts +14 -0
- package/examples/subagents/model.ts +20 -0
- package/examples/substrate/README.md +12 -6
- package/examples/super/README.md +34 -22
- package/examples/super/actions.ts +11 -11
- package/examples/super/config.ts +3 -3
- package/examples/super/eject.json +1 -1
- package/examples/super/location.ts +1 -1
- package/examples/super/operator.ts +28 -0
- package/examples/super/project.ts +1 -3
- package/examples/taskpool/README.md +1 -1
- package/npm-shrinkwrap.development.json +46 -1538
- package/npm-shrinkwrap.json +10 -43
- package/package.development.json +3 -6
- package/package.json +3 -5
- package/scripts/anyswarm-arguments.ts +67 -96
- package/scripts/anyswarm-eject.ts +1 -1
- package/scripts/anyswarm-harnesses.ts +1 -18
- package/scripts/anyswarm-installation.ts +18 -294
- package/scripts/anyswarm-launch.ts +30 -102
- package/scripts/anyswarm-progress.ts +125 -0
- package/scripts/anyswarm-project.ts +31 -123
- package/scripts/anyswarm-source-runner.ts +9 -36
- package/scripts/anyswarm.ts +4 -24
- package/scripts/generate-architecture-coverage.ts +1 -1
- package/scripts/generate-architecture-prompts.ts +21 -10
- package/scripts/local-environment.ts +79 -21
- package/scripts/local-setup.ts +150 -105
- package/scripts/pack-release.ts +28 -4
- package/src/core/index.ts +1 -1
- package/src/core/sandbox/opensandbox-backend.ts +10 -4
- package/src/core/sandbox/sandbox-connection.ts +22 -7
- package/src/core/worker-image.ts +1 -1
- package/src/harness/project-harness.ts +5 -4
- package/src/harness/project-rpc-client.ts +23 -0
- package/src/harness/project-runtime.ts +2 -1
- package/src/harness/typescript-loader.ts +28 -8
- package/src/trace-viewer/command.mjs +6 -3
- package/src/trace-viewer/public/app.js +239 -59
- package/src/trace-viewer/public/index.html +5 -0
- package/src/trace-viewer/public/style.css +22 -0
- package/src/trace-viewer/reader.mjs +242 -26
- package/src/trace-viewer/run-root.d.mts +1 -0
- package/src/trace-viewer/run-root.mjs +7 -0
- package/src/trace-viewer/server.mjs +3 -1
- package/dist/scripts/anyswarm-applications.d.ts +0 -19
- package/dist/scripts/anyswarm-applications.js +0 -19
- package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
- package/dist/scripts/anyswarm-tui-config.js +0 -189
- package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
- package/dist/scripts/anyswarm-tui-session.js +0 -304
- package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
- package/dist/scripts/anyswarm-tui-terminal.js +0 -154
- package/dist/scripts/anyswarm-tui.d.ts +0 -2
- package/dist/scripts/anyswarm-tui.js +0 -1012
- package/docs/architecture/25-foreground-tui.md +0 -51
- package/scripts/anyswarm-applications.ts +0 -39
- package/scripts/anyswarm-tui-config.ts +0 -174
- package/scripts/anyswarm-tui-session.ts +0 -295
- package/scripts/anyswarm-tui-terminal.ts +0 -147
- package/scripts/anyswarm-tui.ts +0 -912
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anyswarm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@anyswarm/core",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.6.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@alibaba-group/opensandbox": "1.2.1",
|
|
13
|
-
"@earendil-works/pi-tui": "1.3.0",
|
|
14
13
|
"@modelcontextprotocol/client": "2.4.0",
|
|
14
|
+
"@swc/wasm": "1.16.22",
|
|
15
15
|
"ajv": "8.20.0",
|
|
16
16
|
"es-module-lexer": "3.0.5",
|
|
17
17
|
"js-tiktoken": "1.0.21"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
|
-
"
|
|
21
|
-
"anyswarm": "dist/scripts/anyswarm.js",
|
|
22
|
-
"swarm": "dist/scripts/swarm.js"
|
|
20
|
+
"anyswarm": "dist/scripts/anyswarm.js"
|
|
23
21
|
},
|
|
24
22
|
"engines": {
|
|
25
23
|
"node": ">=22.19.0"
|
|
@@ -48,19 +46,6 @@
|
|
|
48
46
|
"node": ">=20.18.1"
|
|
49
47
|
}
|
|
50
48
|
},
|
|
51
|
-
"node_modules/@earendil-works/pi-tui": {
|
|
52
|
-
"version": "1.3.0",
|
|
53
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-1.3.0.tgz",
|
|
54
|
-
"integrity": "sha512-AlKvEwEWyVtnuw7SVb4N/mUhlfIohyFslUNWarZVdLHHSdt3ca5EhMLwTzblBpDpaofSz+f+tAHie6CfxVrWKA==",
|
|
55
|
-
"license": "MIT",
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"get-east-asian-width": "1.6.0",
|
|
58
|
-
"marked": "18.0.11"
|
|
59
|
-
},
|
|
60
|
-
"engines": {
|
|
61
|
-
"node": ">=22.19.0"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
49
|
"node_modules/@modelcontextprotocol/client": {
|
|
65
50
|
"version": "2.4.0",
|
|
66
51
|
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/client/-/client-2.4.0.tgz",
|
|
@@ -114,6 +99,12 @@
|
|
|
114
99
|
"node": ">=8.0.0"
|
|
115
100
|
}
|
|
116
101
|
},
|
|
102
|
+
"node_modules/@swc/wasm": {
|
|
103
|
+
"version": "1.16.22",
|
|
104
|
+
"resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.16.22.tgz",
|
|
105
|
+
"integrity": "sha512-7wFC6rBgXXiNElVvrBokCD7xgNF6QOMyiEDeQyhcvPgIBc+jWW99FU/E4KScd+NPZBAxwEkj3/a7N9xnu1RI+A==",
|
|
106
|
+
"license": "Apache-2.0"
|
|
107
|
+
},
|
|
117
108
|
"node_modules/ajv": {
|
|
118
109
|
"version": "8.20.0",
|
|
119
110
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
|
|
@@ -199,18 +190,6 @@
|
|
|
199
190
|
],
|
|
200
191
|
"license": "BSD-3-Clause"
|
|
201
192
|
},
|
|
202
|
-
"node_modules/get-east-asian-width": {
|
|
203
|
-
"version": "1.6.0",
|
|
204
|
-
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
|
|
205
|
-
"integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
|
|
206
|
-
"license": "MIT",
|
|
207
|
-
"engines": {
|
|
208
|
-
"node": ">=18"
|
|
209
|
-
},
|
|
210
|
-
"funding": {
|
|
211
|
-
"url": "https://github.com/sponsors/sindresorhus"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
193
|
"node_modules/isexe": {
|
|
215
194
|
"version": "2.0.0",
|
|
216
195
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
|
@@ -241,18 +220,6 @@
|
|
|
241
220
|
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
|
242
221
|
"license": "MIT"
|
|
243
222
|
},
|
|
244
|
-
"node_modules/marked": {
|
|
245
|
-
"version": "18.0.11",
|
|
246
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-18.0.11.tgz",
|
|
247
|
-
"integrity": "sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw==",
|
|
248
|
-
"license": "MIT",
|
|
249
|
-
"bin": {
|
|
250
|
-
"marked": "bin/marked.js"
|
|
251
|
-
},
|
|
252
|
-
"engines": {
|
|
253
|
-
"node": ">= 20"
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
223
|
"node_modules/openapi-fetch": {
|
|
257
224
|
"version": "0.14.1",
|
|
258
225
|
"resolved": "https://registry.npmjs.org/openapi-fetch/-/openapi-fetch-0.14.1.tgz",
|
package/package.development.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anyswarm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@alibaba-group/opensandbox": "1.2.1",
|
|
71
|
-
"@earendil-works/pi-tui": "1.3.0",
|
|
72
71
|
"@modelcontextprotocol/client": "2.4.0",
|
|
72
|
+
"@swc/wasm": "1.16.22",
|
|
73
73
|
"ajv": "8.20.0",
|
|
74
74
|
"es-module-lexer": "3.0.5",
|
|
75
75
|
"js-tiktoken": "1.0.21"
|
|
@@ -80,12 +80,9 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"bin": {
|
|
83
|
-
"anyswarm": "dist/scripts/anyswarm.js"
|
|
84
|
-
"swarm": "dist/scripts/swarm.js",
|
|
85
|
-
"anys": "dist/scripts/anyswarm.js"
|
|
83
|
+
"anyswarm": "dist/scripts/anyswarm.js"
|
|
86
84
|
},
|
|
87
85
|
"devDependencies": {
|
|
88
|
-
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
89
86
|
"@types/node": "26.6.5",
|
|
90
87
|
"typescript": "^7.0.2"
|
|
91
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anyswarm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@alibaba-group/opensandbox": "1.2.1",
|
|
70
|
-
"@earendil-works/pi-tui": "1.3.0",
|
|
71
70
|
"@modelcontextprotocol/client": "2.4.0",
|
|
71
|
+
"@swc/wasm": "1.16.22",
|
|
72
72
|
"ajv": "8.20.0",
|
|
73
73
|
"es-module-lexer": "3.0.5",
|
|
74
74
|
"js-tiktoken": "1.0.21"
|
|
@@ -79,8 +79,6 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"bin": {
|
|
82
|
-
"anyswarm": "dist/scripts/anyswarm.js"
|
|
83
|
-
"swarm": "dist/scripts/swarm.js",
|
|
84
|
-
"anys": "dist/scripts/anyswarm.js"
|
|
82
|
+
"anyswarm": "dist/scripts/anyswarm.js"
|
|
85
83
|
}
|
|
86
84
|
}
|
|
@@ -2,38 +2,45 @@ import { parseArgs } from 'node:util';
|
|
|
2
2
|
|
|
3
3
|
export const setupUsage = [
|
|
4
4
|
'Usage: anyswarm setup [--mode existing|local] [--endpoint <url>] [--public-url <url>] [--backend pi|codex] [--backend-path <executable>] [--backend-version <version>] [--config <module>]',
|
|
5
|
-
'
|
|
6
|
-
'Existing mode saves the authenticated connection.
|
|
5
|
+
'By default, prepare local OpenSandbox and reuse compatible local settings. Select --mode existing explicitly for a remote service.',
|
|
6
|
+
'Existing mode saves the authenticated connection. Use anyswarm doctor --mode existing --smoke to verify that service.',
|
|
7
7
|
].join('\n');
|
|
8
8
|
const updateUsage = [
|
|
9
|
-
'Usage: anyswarm update
|
|
10
|
-
'
|
|
9
|
+
'Usage: anyswarm update',
|
|
10
|
+
'Print the update command for this installation. npm manages the installed version.',
|
|
11
11
|
].join('\n');
|
|
12
12
|
const recoverUsage = 'Usage: anyswarm recover --run-dir <directory> --config <module>';
|
|
13
|
-
export const doctorUsage = 'Usage: anyswarm doctor [--config <module>] [--smoke]';
|
|
13
|
+
export const doctorUsage = 'Usage: anyswarm doctor [--mode local|existing] [--config <module>] [--smoke]';
|
|
14
|
+
const runUsage = 'Usage: anyswarm run <entry.ts> [--cwd <dir>] [--config <module>] [--prompt <text>] [--output-dir <dir>]';
|
|
15
|
+
const ejectUsage = 'Usage: anyswarm eject <name> --dir <dir>';
|
|
14
16
|
const projectUsage = [
|
|
15
|
-
'Usage: anyswarm --harness <module> --prompt <text> [--cwd <
|
|
16
|
-
' anyswarm --harness <module> --mode rpc [--config <module>] [--output-dir <
|
|
17
|
-
'Built-in Harnesses: subagents, taskpool, peermesh, substrate, lead-worker, notes, messages',
|
|
18
|
-
'Use a built-in name, an explicit TypeScript or ESM file, or a package installed from the invocation directory.',
|
|
19
|
-
'An explicit interactive lifetime or questions in foreground mode uses JSONL for subsequent commands.',
|
|
20
|
-
'The project directory defaults to the invocation directory. In RPC mode send cwd and prompt in the run request.',
|
|
17
|
+
'Usage: anyswarm --harness <name|module> --prompt <text> [--cwd <dir>] [--config <module>] [--output-dir <dir>]',
|
|
18
|
+
' anyswarm --harness <name|module> --mode rpc [--config <module>] [--output-dir <dir>] [--lifetime task|interactive] [--interaction none|questions]',
|
|
19
|
+
'Built-in Harnesses: subagents, autoresearch, taskpool, peermesh, substrate, lead-worker, notes, messages',
|
|
21
20
|
].join('\n');
|
|
22
21
|
export const anyswarmUsage = [
|
|
23
|
-
'Usage: anyswarm
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
'
|
|
22
|
+
'Usage: anyswarm <command> [options]',
|
|
23
|
+
'',
|
|
24
|
+
'Quickstart',
|
|
25
|
+
' anyswarm setup',
|
|
26
|
+
' anyswarm --harness subagents --prompt "Read README.md and report its heading." --output-dir ./runs',
|
|
27
|
+
' anyswarm trace --root ./runs',
|
|
28
|
+
'',
|
|
29
|
+
'Configure your model endpoint before running a model-backed Harness.',
|
|
30
|
+
'',
|
|
31
|
+
' setup / doctor [--smoke] Prepare and verify local execution',
|
|
32
|
+
' update Show the npm upgrade command',
|
|
33
|
+
' run <entry.ts> Run an editable Harness',
|
|
34
|
+
' --harness <name|module> Run a Harness or use --mode rpc for JSONL',
|
|
35
|
+
' eject <name> --dir <dir> Export editable source and its pinned SDK',
|
|
36
|
+
' trace / recover Inspect Run records or recover pending cleanup',
|
|
37
|
+
'',
|
|
38
|
+
'Run a command with --help for options. Use --version for the installed version.',
|
|
32
39
|
].join('\n');
|
|
33
40
|
|
|
34
41
|
export type LocalCommand =
|
|
35
42
|
| { command: 'setup'; mode?: 'existing' | 'local'; endpoint?: string; publicUrl?: string; configPath?: string; backend?: 'pi' | 'codex'; backendPath?: string; backendVersion?: string }
|
|
36
|
-
| { command: 'doctor'; configPath?: string; smoke: boolean };
|
|
43
|
+
| { command: 'doctor'; mode?: 'existing' | 'local'; configPath?: string; smoke: boolean };
|
|
37
44
|
|
|
38
45
|
type HarnessOptions = {
|
|
39
46
|
harness: string;
|
|
@@ -43,94 +50,61 @@ type HarnessOptions = {
|
|
|
43
50
|
interaction?: 'none' | 'questions';
|
|
44
51
|
};
|
|
45
52
|
|
|
46
|
-
export type ProjectCommand = HarnessOptions & { command: 'harness'
|
|
47
|
-
({ mode: 'foreground'
|
|
48
|
-
export type TuiCommand = Partial<HarnessOptions> & { command: 'tui'; cwd?: string; prompt?: string };
|
|
49
|
-
export type HarnessCommand = HarnessOptions & { command: 'use'; cwd?: string; prompt?: string } &
|
|
50
|
-
({ mode: 'auto' | 'tui' | 'headless' | 'foreground' | 'rpc' } | { mode: 'action'; slash: string });
|
|
53
|
+
export type ProjectCommand = HarnessOptions & { command: 'harness' } &
|
|
54
|
+
({ mode: 'foreground'; cwd?: string; prompt: string } | { mode: 'rpc' });
|
|
51
55
|
|
|
52
|
-
type AnySwarmCommand =
|
|
56
|
+
type AnySwarmCommand = { command: 'run'; entryPath: string; args: string[] } |
|
|
53
57
|
{ command: 'eject'; application: string; directory: string } | LocalCommand |
|
|
54
|
-
{ command: 'update'
|
|
58
|
+
{ command: 'update' } | ProjectCommand | { command: 'recover'; directory: string; configPath: string };
|
|
55
59
|
|
|
56
|
-
export function
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]*$/i.test(specifier);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function parseHarnessOptions(args: string[], allowPositionals: boolean) {
|
|
65
|
-
const { values, positionals } = parseArgs({ args, allowPositionals, options: {
|
|
66
|
-
use: { type: 'string', short: 'u' }, harness: { type: 'string' }, prompt: { type: 'string' },
|
|
67
|
-
cwd: { type: 'string' }, mode: { type: 'string' }, config: { type: 'string' }, 'output-dir': { type: 'string' },
|
|
60
|
+
export function parseProjectCommand(args: string[], source?: string): ProjectCommand {
|
|
61
|
+
const { values } = parseArgs({ args, options: {
|
|
62
|
+
harness: { type: 'string' },
|
|
63
|
+
prompt: { type: 'string' }, cwd: { type: 'string' }, mode: { type: 'string' },
|
|
64
|
+
config: { type: 'string' }, 'output-dir': { type: 'string' },
|
|
68
65
|
lifetime: { type: 'string' }, interaction: { type: 'string' },
|
|
69
|
-
headless: { type: 'boolean' }, rpc: { type: 'boolean' }, cmd: { type: 'string' },
|
|
70
66
|
} });
|
|
71
|
-
const { lifetime, interaction } = values;
|
|
72
|
-
|
|
67
|
+
const { lifetime, interaction, mode, cwd } = values;
|
|
68
|
+
const harness = source ?? values.harness;
|
|
69
|
+
if ((source && values.harness !== undefined) || !harness?.trim() || [cwd, values.config, values['output-dir']].includes('') ||
|
|
73
70
|
(lifetime !== undefined && lifetime !== 'task' && lifetime !== 'interactive') ||
|
|
74
71
|
(interaction !== undefined && interaction !== 'none' && interaction !== 'questions')) throw new Error();
|
|
75
|
-
|
|
72
|
+
const project: HarnessOptions & { command: 'harness' } = { command: 'harness', harness, configPath: values.config, outputRoot: values['output-dir'], lifetime, interaction };
|
|
73
|
+
if (mode === 'rpc' && values.prompt === undefined && cwd === undefined) return { ...project, mode };
|
|
74
|
+
const prompt = values.prompt ?? (source ? 'Run this Harness.' : undefined);
|
|
75
|
+
if ((mode === undefined || mode === 'foreground') && prompt?.trim() && lifetime !== 'interactive' && interaction !== 'questions') {
|
|
76
|
+
return { ...project, mode: 'foreground', cwd, prompt };
|
|
77
|
+
}
|
|
78
|
+
throw new Error();
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
export function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!harness || values.harness !== undefined || (selected && values.use !== undefined) ||
|
|
82
|
-
(positionals.length && values.prompt !== undefined)) throw new Error(anyswarmUsage);
|
|
83
|
-
const prompt = values.prompt ?? (positionals.length ? positionals.join(' ') : undefined);
|
|
84
|
-
if (prompt !== undefined && !prompt.trim()) throw new Error(anyswarmUsage);
|
|
85
|
-
const project = { command: 'use' as const, harness, ...options, prompt, cwd: values.cwd };
|
|
86
|
-
if ([values.mode, values.headless, values.rpc, values.cmd].filter(value => value !== undefined).length > 1) throw new Error(anyswarmUsage);
|
|
87
|
-
const mode = values.mode ?? (values.headless ? 'headless' : values.rpc ? 'rpc' : 'auto');
|
|
88
|
-
if (values.cmd !== undefined) {
|
|
89
|
-
if (prompt !== undefined || !/^\/[a-z][\w-]*(?:\s|$)/i.test(values.cmd.trim())) throw new Error(anyswarmUsage);
|
|
90
|
-
return { ...project, mode: 'action', slash: values.cmd.trim() };
|
|
91
|
-
}
|
|
92
|
-
if (mode === 'rpc' && (prompt !== undefined || values.cwd !== undefined)) throw new Error(anyswarmUsage);
|
|
93
|
-
if (mode === 'auto' || mode === 'tui' || mode === 'headless' || mode === 'foreground' || mode === 'rpc') return { ...project, mode };
|
|
94
|
-
throw new Error(anyswarmUsage);
|
|
81
|
+
export function parseSourceHarnessCommand(args: string[], entry: string) {
|
|
82
|
+
try { return parseProjectCommand(args, entry); }
|
|
83
|
+
catch { throw new Error(runUsage); }
|
|
95
84
|
}
|
|
96
85
|
|
|
97
|
-
export function parseAnySwarmCommand(args: string[]
|
|
86
|
+
export function parseAnySwarmCommand(args: string[]): AnySwarmCommand | { help: string } {
|
|
98
87
|
const [command, ...options] = args;
|
|
99
|
-
if (command === undefined) return {
|
|
100
|
-
if (command === '--
|
|
101
|
-
|
|
102
|
-
const
|
|
88
|
+
if (command === undefined || (command === '--help' && options.length === 0)) return { help: anyswarmUsage };
|
|
89
|
+
if ((command === '--harness' || command.startsWith('--harness=')) && options.at(-1) === '--help' &&
|
|
90
|
+
(options.length === 1 || (command === '--harness' && options.length === 2))) return { help: projectUsage };
|
|
91
|
+
const usages = { run: runUsage, eject: ejectUsage, setup: setupUsage, update: updateUsage, doctor: doctorUsage, recover: recoverUsage };
|
|
92
|
+
const usage = Object.hasOwn(usages, command) ? usages[command as keyof typeof usages]
|
|
93
|
+
: args.some(arg => /^--harness(?:=|$)/.test(arg)) ? projectUsage : anyswarmUsage;
|
|
103
94
|
if (options.length === 1 && options[0] === '--help' && Object.hasOwn(usages, command)) return { help: usage };
|
|
104
95
|
try {
|
|
105
96
|
if (command === 'run') {
|
|
106
|
-
if (!options[0] || options[0].startsWith('-')) throw new Error();
|
|
107
|
-
return
|
|
108
|
-
? { command, entryPath: options[0], args: options.slice(1) }
|
|
109
|
-
: parseHarnessSelection(options.slice(1), options[0]);
|
|
97
|
+
if (!options[0] || options[0].startsWith('-') || !/\.[cm]?[jt]s$/.test(options[0])) throw new Error();
|
|
98
|
+
return { command, entryPath: options[0], args: options.slice(1) };
|
|
110
99
|
}
|
|
111
100
|
if (command === 'eject') {
|
|
112
101
|
const { values, positionals } = parseArgs({ args: options, allowPositionals: true, options: { dir: { type: 'string' } } });
|
|
113
|
-
if (positionals.length === 1 &&
|
|
102
|
+
if (positionals.length === 1 && /^[a-z0-9][a-z0-9_.-]*$/i.test(positionals[0]) && values.dir) {
|
|
114
103
|
return { command, application: positionals[0], directory: values.dir };
|
|
115
104
|
}
|
|
116
105
|
throw new Error();
|
|
117
106
|
}
|
|
118
|
-
if (command
|
|
119
|
-
return parseHarnessSelection(args);
|
|
120
|
-
}
|
|
121
|
-
if (command.startsWith('--')) {
|
|
122
|
-
const { values, options: selection } = parseHarnessOptions(args, false);
|
|
123
|
-
if (values.cmd !== undefined || values.headless !== undefined || values.rpc !== undefined || values.use !== undefined) throw new Error();
|
|
124
|
-
const project = { command: 'harness' as const, harness: values.harness!, ...selection };
|
|
125
|
-
if (values.mode === 'tui' || (values.mode === undefined && values.prompt === undefined)) {
|
|
126
|
-
return { ...project, command: 'tui', harness: values.harness, cwd: values.cwd, prompt: values.prompt };
|
|
127
|
-
}
|
|
128
|
-
if (!project.harness) throw new Error();
|
|
129
|
-
if (values.mode === 'rpc' && values.prompt === undefined && values.cwd === undefined) return { ...project, mode: 'rpc' };
|
|
130
|
-
if ((values.mode === undefined || values.mode === 'foreground') && values.prompt?.trim()) {
|
|
131
|
-
return { ...project, mode: 'foreground', cwd: values.cwd, prompt: values.prompt };
|
|
132
|
-
}
|
|
133
|
-
}
|
|
107
|
+
if (command.startsWith('--')) return parseProjectCommand(args);
|
|
134
108
|
if (command === 'setup') {
|
|
135
109
|
const { values } = parseArgs({ args: options, options: {
|
|
136
110
|
mode: { type: 'string' }, endpoint: { type: 'string' }, 'public-url': { type: 'string' }, config: { type: 'string' },
|
|
@@ -146,23 +120,20 @@ export function parseAnySwarmCommand(args: string[], registered: Readonly<Record
|
|
|
146
120
|
backend, backendPath: values['backend-path'], backendVersion: values['backend-version'] };
|
|
147
121
|
}
|
|
148
122
|
}
|
|
149
|
-
if (command === 'update') {
|
|
150
|
-
const { values } = parseArgs({ args: options, options: { archive: { type: 'string' }, sha256: { type: 'string' } } });
|
|
151
|
-
if (options.length === 0 || (values.archive && /^[a-f0-9]{64}$/i.test(values.sha256 ?? ''))) {
|
|
152
|
-
return { command, archive: values.archive, sha256: values.sha256?.toLowerCase() };
|
|
153
|
-
}
|
|
154
|
-
}
|
|
123
|
+
if (command === 'update' && options.length === 0) return { command };
|
|
155
124
|
if (command === 'recover') {
|
|
156
125
|
const { values } = parseArgs({ args: options, options: { 'run-dir': { type: 'string' }, config: { type: 'string' } } });
|
|
157
126
|
if (values['run-dir'] && values.config) return { command, directory: values['run-dir'], configPath: values.config };
|
|
158
127
|
}
|
|
159
128
|
if (command === 'doctor') {
|
|
160
129
|
const { values } = parseArgs({
|
|
161
|
-
args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' } },
|
|
130
|
+
args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' }, mode: { type: 'string' } },
|
|
162
131
|
});
|
|
163
|
-
|
|
132
|
+
const { mode } = values;
|
|
133
|
+
if (values.config !== '' && (mode === undefined || mode === 'existing' || mode === 'local')) {
|
|
134
|
+
return { command, mode, configPath: values.config, smoke: values.smoke === true };
|
|
135
|
+
}
|
|
164
136
|
}
|
|
165
|
-
if (Object.hasOwn(registered, command)) return parseHarnessSelection(options, command);
|
|
166
137
|
} catch {
|
|
167
138
|
// Argument errors can contain untrusted input. Print only the command usage.
|
|
168
139
|
}
|
|
@@ -92,7 +92,7 @@ export async function ejectSourceCommand(command: { application: string; directo
|
|
|
92
92
|
archiveSha256, content: { sha256: digestFiles(packageRoot, files), files } } };
|
|
93
93
|
await writeFile(join(staging, 'anyswarm-source.json'), JSON.stringify(provenance, null, 2) + '\n');
|
|
94
94
|
await writeFile(join(staging, 'package.json'), JSON.stringify({ name: `anyswarm-${command.application}-source`, private: true,
|
|
95
|
-
scripts: { start: `
|
|
95
|
+
scripts: { start: `anyswarm run ./${manifest.entry}` }, dependencies: { ...dependencies, '@anyswarm/core': 'file:./.anyswarm-sdk/core.tgz' },
|
|
96
96
|
}, null, 2) + '\n');
|
|
97
97
|
if (targetInfo) await rmdir(target);
|
|
98
98
|
await rename(staging, target);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { applicationDescriptors, findApplication } from './anyswarm-applications.js';
|
|
3
1
|
export const builtins: Record<string, string> = {
|
|
4
|
-
|
|
2
|
+
autoresearch: new URL('../examples/autoresearch/project.js', import.meta.url).href,
|
|
5
3
|
'lead-worker': new URL('../examples/lead-worker/project.js', import.meta.url).href,
|
|
6
4
|
peermesh: new URL('../examples/peermesh/project.js', import.meta.url).href,
|
|
7
5
|
notes: new URL('../examples/notes/project.js', import.meta.url).href,
|
|
@@ -10,18 +8,3 @@ export const builtins: Record<string, string> = {
|
|
|
10
8
|
substrate: new URL('../examples/substrate/project.js', import.meta.url).href,
|
|
11
9
|
subagents: new URL('../examples/subagents/project.js', import.meta.url).href,
|
|
12
10
|
};
|
|
13
|
-
|
|
14
|
-
export async function builtinConfiguration(name: string) {
|
|
15
|
-
if (name === 'messages') return (await import('../examples/messages/handoff-config.js')).handoffConfig();
|
|
16
|
-
if (name === 'peermesh') return (await import('../examples/peermesh/project-config.js')).peerMeshConfig();
|
|
17
|
-
if (name === 'substrate') return (await import('../examples/substrate/project-config.js')).substrateConfiguration();
|
|
18
|
-
if (name === 'lead-worker') return {
|
|
19
|
-
...(await import('../examples/lead-worker/project-config.js')).leadWorkerConfig(),
|
|
20
|
-
team: process.env.ANYSWARM_LEAD_WORKER_TEAM,
|
|
21
|
-
checkingImage: process.env.ANYSWARM_LEAD_WORKER_CHECKING_IMAGE,
|
|
22
|
-
};
|
|
23
|
-
const path = new URL('../examples/' + name + '/config.js', import.meta.url);
|
|
24
|
-
if (findApplication(name) && !existsSync(path)) return undefined;
|
|
25
|
-
path.search = 'launcher=' + Date.now();
|
|
26
|
-
return (await import(path.href)).default;
|
|
27
|
-
}
|