@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const setupUsage: string;
|
|
2
|
-
export declare const doctorUsage = "Usage: anyswarm doctor [--config <module>] [--smoke]";
|
|
2
|
+
export declare const doctorUsage = "Usage: anyswarm doctor [--mode local|existing] [--config <module>] [--smoke]";
|
|
3
3
|
export declare const anyswarmUsage: string;
|
|
4
4
|
export type LocalCommand = {
|
|
5
5
|
command: 'setup';
|
|
@@ -12,6 +12,7 @@ export type LocalCommand = {
|
|
|
12
12
|
backendVersion?: string;
|
|
13
13
|
} | {
|
|
14
14
|
command: 'doctor';
|
|
15
|
+
mode?: 'existing' | 'local';
|
|
15
16
|
configPath?: string;
|
|
16
17
|
smoke: boolean;
|
|
17
18
|
};
|
|
@@ -24,30 +25,14 @@ type HarnessOptions = {
|
|
|
24
25
|
};
|
|
25
26
|
export type ProjectCommand = HarnessOptions & {
|
|
26
27
|
command: 'harness';
|
|
27
|
-
defaults?: boolean;
|
|
28
28
|
} & ({
|
|
29
|
-
mode: 'foreground'
|
|
29
|
+
mode: 'foreground';
|
|
30
30
|
cwd?: string;
|
|
31
31
|
prompt: string;
|
|
32
32
|
} | {
|
|
33
33
|
mode: 'rpc';
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
command: 'tui';
|
|
37
|
-
cwd?: string;
|
|
38
|
-
prompt?: string;
|
|
39
|
-
};
|
|
40
|
-
export type HarnessCommand = HarnessOptions & {
|
|
41
|
-
command: 'use';
|
|
42
|
-
cwd?: string;
|
|
43
|
-
prompt?: string;
|
|
44
|
-
} & ({
|
|
45
|
-
mode: 'auto' | 'tui' | 'headless' | 'foreground' | 'rpc';
|
|
46
|
-
} | {
|
|
47
|
-
mode: 'action';
|
|
48
|
-
slash: string;
|
|
49
|
-
});
|
|
50
|
-
type AnySwarmCommand = TuiCommand | HarnessCommand | {
|
|
35
|
+
type AnySwarmCommand = {
|
|
51
36
|
command: 'run';
|
|
52
37
|
entryPath: string;
|
|
53
38
|
args: string[];
|
|
@@ -57,17 +42,14 @@ type AnySwarmCommand = TuiCommand | HarnessCommand | {
|
|
|
57
42
|
directory: string;
|
|
58
43
|
} | LocalCommand | {
|
|
59
44
|
command: 'update';
|
|
60
|
-
archive?: string;
|
|
61
|
-
sha256?: string;
|
|
62
45
|
} | ProjectCommand | {
|
|
63
46
|
command: 'recover';
|
|
64
47
|
directory: string;
|
|
65
48
|
configPath: string;
|
|
66
49
|
};
|
|
67
|
-
export declare function
|
|
68
|
-
export declare function
|
|
69
|
-
export declare function
|
|
70
|
-
export declare function parseAnySwarmCommand(args: string[], registered?: Readonly<Record<string, string>>): AnySwarmCommand | {
|
|
50
|
+
export declare function parseProjectCommand(args: string[], source?: string): ProjectCommand;
|
|
51
|
+
export declare function parseSourceHarnessCommand(args: string[], entry: string): ProjectCommand;
|
|
52
|
+
export declare function parseAnySwarmCommand(args: string[]): AnySwarmCommand | {
|
|
71
53
|
help: string;
|
|
72
54
|
};
|
|
73
55
|
export {};
|
|
@@ -1,122 +1,98 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
export const setupUsage = [
|
|
3
3
|
'Usage: anyswarm setup [--mode existing|local] [--endpoint <url>] [--public-url <url>] [--backend pi|codex] [--backend-path <executable>] [--backend-version <version>] [--config <module>]',
|
|
4
|
-
'
|
|
5
|
-
'Existing mode saves the authenticated connection.
|
|
4
|
+
'By default, prepare local OpenSandbox and reuse compatible local settings. Select --mode existing explicitly for a remote service.',
|
|
5
|
+
'Existing mode saves the authenticated connection. Use anyswarm doctor --mode existing --smoke to verify that service.',
|
|
6
6
|
].join('\n');
|
|
7
7
|
const updateUsage = [
|
|
8
|
-
'Usage: anyswarm update
|
|
9
|
-
'
|
|
8
|
+
'Usage: anyswarm update',
|
|
9
|
+
'Print the update command for this installation. npm manages the installed version.',
|
|
10
10
|
].join('\n');
|
|
11
11
|
const recoverUsage = 'Usage: anyswarm recover --run-dir <directory> --config <module>';
|
|
12
|
-
export const doctorUsage = 'Usage: anyswarm doctor [--config <module>] [--smoke]';
|
|
12
|
+
export const doctorUsage = 'Usage: anyswarm doctor [--mode local|existing] [--config <module>] [--smoke]';
|
|
13
|
+
const runUsage = 'Usage: anyswarm run <entry.ts> [--cwd <dir>] [--config <module>] [--prompt <text>] [--output-dir <dir>]';
|
|
14
|
+
const ejectUsage = 'Usage: anyswarm eject <name> --dir <dir>';
|
|
13
15
|
const projectUsage = [
|
|
14
|
-
'Usage: anyswarm --harness <module> --prompt <text> [--cwd <
|
|
15
|
-
' anyswarm --harness <module> --mode rpc [--config <module>] [--output-dir <
|
|
16
|
-
'Built-in Harnesses: subagents, taskpool, peermesh, substrate, lead-worker, notes, messages',
|
|
17
|
-
'Use a built-in name, an explicit TypeScript or ESM file, or a package installed from the invocation directory.',
|
|
18
|
-
'An explicit interactive lifetime or questions in foreground mode uses JSONL for subsequent commands.',
|
|
19
|
-
'The project directory defaults to the invocation directory. In RPC mode send cwd and prompt in the run request.',
|
|
16
|
+
'Usage: anyswarm --harness <name|module> --prompt <text> [--cwd <dir>] [--config <module>] [--output-dir <dir>]',
|
|
17
|
+
' anyswarm --harness <name|module> --mode rpc [--config <module>] [--output-dir <dir>] [--lifetime task|interactive] [--interaction none|questions]',
|
|
18
|
+
'Built-in Harnesses: subagents, autoresearch, taskpool, peermesh, substrate, lead-worker, notes, messages',
|
|
20
19
|
].join('\n');
|
|
21
20
|
export const anyswarmUsage = [
|
|
22
|
-
'Usage: anyswarm
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
|
|
30
|
-
'
|
|
21
|
+
'Usage: anyswarm <command> [options]',
|
|
22
|
+
'',
|
|
23
|
+
'Quickstart',
|
|
24
|
+
' anyswarm setup',
|
|
25
|
+
' anyswarm --harness subagents --prompt "Read README.md and report its heading." --output-dir ./runs',
|
|
26
|
+
' anyswarm trace --root ./runs',
|
|
27
|
+
'',
|
|
28
|
+
'Configure your model endpoint before running a model-backed Harness.',
|
|
29
|
+
'',
|
|
30
|
+
' setup / doctor [--smoke] Prepare and verify local execution',
|
|
31
|
+
' update Show the npm upgrade command',
|
|
32
|
+
' run <entry.ts> Run an editable Harness',
|
|
33
|
+
' --harness <name|module> Run a Harness or use --mode rpc for JSONL',
|
|
34
|
+
' eject <name> --dir <dir> Export editable source and its pinned SDK',
|
|
35
|
+
' trace / recover Inspect Run records or recover pending cleanup',
|
|
36
|
+
'',
|
|
37
|
+
'Run a command with --help for options. Use --version for the installed version.',
|
|
31
38
|
].join('\n');
|
|
32
|
-
export function
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
function parseHarnessOptions(args, allowPositionals) {
|
|
39
|
-
const { values, positionals } = parseArgs({ args, allowPositionals, options: {
|
|
40
|
-
use: { type: 'string', short: 'u' }, harness: { type: 'string' }, prompt: { type: 'string' },
|
|
41
|
-
cwd: { type: 'string' }, mode: { type: 'string' }, config: { type: 'string' }, 'output-dir': { type: 'string' },
|
|
39
|
+
export function parseProjectCommand(args, source) {
|
|
40
|
+
const { values } = parseArgs({ args, options: {
|
|
41
|
+
harness: { type: 'string' },
|
|
42
|
+
prompt: { type: 'string' }, cwd: { type: 'string' }, mode: { type: 'string' },
|
|
43
|
+
config: { type: 'string' }, 'output-dir': { type: 'string' },
|
|
42
44
|
lifetime: { type: 'string' }, interaction: { type: 'string' },
|
|
43
|
-
headless: { type: 'boolean' }, rpc: { type: 'boolean' }, cmd: { type: 'string' },
|
|
44
45
|
} });
|
|
45
|
-
const { lifetime, interaction } = values;
|
|
46
|
-
|
|
46
|
+
const { lifetime, interaction, mode, cwd } = values;
|
|
47
|
+
const harness = source ?? values.harness;
|
|
48
|
+
if ((source && values.harness !== undefined) || !harness?.trim() || [cwd, values.config, values['output-dir']].includes('') ||
|
|
47
49
|
(lifetime !== undefined && lifetime !== 'task' && lifetime !== 'interactive') ||
|
|
48
50
|
(interaction !== undefined && interaction !== 'none' && interaction !== 'questions'))
|
|
49
51
|
throw new Error();
|
|
50
|
-
|
|
52
|
+
const project = { command: 'harness', harness, configPath: values.config, outputRoot: values['output-dir'], lifetime, interaction };
|
|
53
|
+
if (mode === 'rpc' && values.prompt === undefined && cwd === undefined)
|
|
54
|
+
return { ...project, mode };
|
|
55
|
+
const prompt = values.prompt ?? (source ? 'Run this Harness.' : undefined);
|
|
56
|
+
if ((mode === undefined || mode === 'foreground') && prompt?.trim() && lifetime !== 'interactive' && interaction !== 'questions') {
|
|
57
|
+
return { ...project, mode: 'foreground', cwd, prompt };
|
|
58
|
+
}
|
|
59
|
+
throw new Error();
|
|
51
60
|
}
|
|
52
|
-
export function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
throw new Error(
|
|
58
|
-
const prompt = values.prompt ?? (positionals.length ? positionals.join(' ') : undefined);
|
|
59
|
-
if (prompt !== undefined && !prompt.trim())
|
|
60
|
-
throw new Error(anyswarmUsage);
|
|
61
|
-
const project = { command: 'use', harness, ...options, prompt, cwd: values.cwd };
|
|
62
|
-
if ([values.mode, values.headless, values.rpc, values.cmd].filter(value => value !== undefined).length > 1)
|
|
63
|
-
throw new Error(anyswarmUsage);
|
|
64
|
-
const mode = values.mode ?? (values.headless ? 'headless' : values.rpc ? 'rpc' : 'auto');
|
|
65
|
-
if (values.cmd !== undefined) {
|
|
66
|
-
if (prompt !== undefined || !/^\/[a-z][\w-]*(?:\s|$)/i.test(values.cmd.trim()))
|
|
67
|
-
throw new Error(anyswarmUsage);
|
|
68
|
-
return { ...project, mode: 'action', slash: values.cmd.trim() };
|
|
61
|
+
export function parseSourceHarnessCommand(args, entry) {
|
|
62
|
+
try {
|
|
63
|
+
return parseProjectCommand(args, entry);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
throw new Error(runUsage);
|
|
69
67
|
}
|
|
70
|
-
if (mode === 'rpc' && (prompt !== undefined || values.cwd !== undefined))
|
|
71
|
-
throw new Error(anyswarmUsage);
|
|
72
|
-
if (mode === 'auto' || mode === 'tui' || mode === 'headless' || mode === 'foreground' || mode === 'rpc')
|
|
73
|
-
return { ...project, mode };
|
|
74
|
-
throw new Error(anyswarmUsage);
|
|
75
68
|
}
|
|
76
|
-
export function parseAnySwarmCommand(args
|
|
69
|
+
export function parseAnySwarmCommand(args) {
|
|
77
70
|
const [command, ...options] = args;
|
|
78
|
-
if (command === undefined)
|
|
79
|
-
return { command: 'tui' };
|
|
80
|
-
if (command === '--help' && options.length === 0)
|
|
71
|
+
if (command === undefined || (command === '--help' && options.length === 0))
|
|
81
72
|
return { help: anyswarmUsage };
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
if ((command === '--harness' || command.startsWith('--harness=')) && options.at(-1) === '--help' &&
|
|
74
|
+
(options.length === 1 || (command === '--harness' && options.length === 2)))
|
|
75
|
+
return { help: projectUsage };
|
|
76
|
+
const usages = { run: runUsage, eject: ejectUsage, setup: setupUsage, update: updateUsage, doctor: doctorUsage, recover: recoverUsage };
|
|
77
|
+
const usage = Object.hasOwn(usages, command) ? usages[command]
|
|
78
|
+
: args.some(arg => /^--harness(?:=|$)/.test(arg)) ? projectUsage : anyswarmUsage;
|
|
84
79
|
if (options.length === 1 && options[0] === '--help' && Object.hasOwn(usages, command))
|
|
85
80
|
return { help: usage };
|
|
86
81
|
try {
|
|
87
82
|
if (command === 'run') {
|
|
88
|
-
if (!options[0] || options[0].startsWith('-'))
|
|
83
|
+
if (!options[0] || options[0].startsWith('-') || !/\.[cm]?[jt]s$/.test(options[0]))
|
|
89
84
|
throw new Error();
|
|
90
|
-
return
|
|
91
|
-
? { command, entryPath: options[0], args: options.slice(1) }
|
|
92
|
-
: parseHarnessSelection(options.slice(1), options[0]);
|
|
85
|
+
return { command, entryPath: options[0], args: options.slice(1) };
|
|
93
86
|
}
|
|
94
87
|
if (command === 'eject') {
|
|
95
88
|
const { values, positionals } = parseArgs({ args: options, allowPositionals: true, options: { dir: { type: 'string' } } });
|
|
96
|
-
if (positionals.length === 1 &&
|
|
89
|
+
if (positionals.length === 1 && /^[a-z0-9][a-z0-9_.-]*$/i.test(positionals[0]) && values.dir) {
|
|
97
90
|
return { command, application: positionals[0], directory: values.dir };
|
|
98
91
|
}
|
|
99
92
|
throw new Error();
|
|
100
93
|
}
|
|
101
|
-
if (command
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
if (command.startsWith('--')) {
|
|
105
|
-
const { values, options: selection } = parseHarnessOptions(args, false);
|
|
106
|
-
if (values.cmd !== undefined || values.headless !== undefined || values.rpc !== undefined || values.use !== undefined)
|
|
107
|
-
throw new Error();
|
|
108
|
-
const project = { command: 'harness', harness: values.harness, ...selection };
|
|
109
|
-
if (values.mode === 'tui' || (values.mode === undefined && values.prompt === undefined)) {
|
|
110
|
-
return { ...project, command: 'tui', harness: values.harness, cwd: values.cwd, prompt: values.prompt };
|
|
111
|
-
}
|
|
112
|
-
if (!project.harness)
|
|
113
|
-
throw new Error();
|
|
114
|
-
if (values.mode === 'rpc' && values.prompt === undefined && values.cwd === undefined)
|
|
115
|
-
return { ...project, mode: 'rpc' };
|
|
116
|
-
if ((values.mode === undefined || values.mode === 'foreground') && values.prompt?.trim()) {
|
|
117
|
-
return { ...project, mode: 'foreground', cwd: values.cwd, prompt: values.prompt };
|
|
118
|
-
}
|
|
119
|
-
}
|
|
94
|
+
if (command.startsWith('--'))
|
|
95
|
+
return parseProjectCommand(args);
|
|
120
96
|
if (command === 'setup') {
|
|
121
97
|
const { values } = parseArgs({ args: options, options: {
|
|
122
98
|
mode: { type: 'string' }, endpoint: { type: 'string' }, 'public-url': { type: 'string' }, config: { type: 'string' },
|
|
@@ -132,12 +108,8 @@ export function parseAnySwarmCommand(args, registered = {}) {
|
|
|
132
108
|
backend, backendPath: values['backend-path'], backendVersion: values['backend-version'] };
|
|
133
109
|
}
|
|
134
110
|
}
|
|
135
|
-
if (command === 'update')
|
|
136
|
-
|
|
137
|
-
if (options.length === 0 || (values.archive && /^[a-f0-9]{64}$/i.test(values.sha256 ?? ''))) {
|
|
138
|
-
return { command, archive: values.archive, sha256: values.sha256?.toLowerCase() };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
111
|
+
if (command === 'update' && options.length === 0)
|
|
112
|
+
return { command };
|
|
141
113
|
if (command === 'recover') {
|
|
142
114
|
const { values } = parseArgs({ args: options, options: { 'run-dir': { type: 'string' }, config: { type: 'string' } } });
|
|
143
115
|
if (values['run-dir'] && values.config)
|
|
@@ -145,13 +117,13 @@ export function parseAnySwarmCommand(args, registered = {}) {
|
|
|
145
117
|
}
|
|
146
118
|
if (command === 'doctor') {
|
|
147
119
|
const { values } = parseArgs({
|
|
148
|
-
args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' } },
|
|
120
|
+
args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' }, mode: { type: 'string' } },
|
|
149
121
|
});
|
|
150
|
-
|
|
151
|
-
|
|
122
|
+
const { mode } = values;
|
|
123
|
+
if (values.config !== '' && (mode === undefined || mode === 'existing' || mode === 'local')) {
|
|
124
|
+
return { command, mode, configPath: values.config, smoke: values.smoke === true };
|
|
125
|
+
}
|
|
152
126
|
}
|
|
153
|
-
if (Object.hasOwn(registered, command))
|
|
154
|
-
return parseHarnessSelection(options, command);
|
|
155
127
|
}
|
|
156
128
|
catch {
|
|
157
129
|
// Argument errors can contain untrusted input. Print only the command usage.
|
|
@@ -93,7 +93,7 @@ export async function ejectSourceCommand(command, cwd) {
|
|
|
93
93
|
archiveSha256, content: { sha256: digestFiles(packageRoot, files), files } } };
|
|
94
94
|
await writeFile(join(staging, 'anyswarm-source.json'), JSON.stringify(provenance, null, 2) + '\n');
|
|
95
95
|
await writeFile(join(staging, 'package.json'), JSON.stringify({ name: `anyswarm-${command.application}-source`, private: true,
|
|
96
|
-
scripts: { start: `
|
|
96
|
+
scripts: { start: `anyswarm run ./${manifest.entry}` }, dependencies: { ...dependencies, '@anyswarm/core': 'file:./.anyswarm-sdk/core.tgz' },
|
|
97
97
|
}, null, 2) + '\n');
|
|
98
98
|
if (targetInfo)
|
|
99
99
|
await rmdir(target);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { applicationDescriptors, findApplication } from './anyswarm-applications.js';
|
|
3
1
|
export const builtins = {
|
|
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,22 +8,3 @@ export const builtins = {
|
|
|
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
|
-
export async function builtinConfiguration(name) {
|
|
14
|
-
if (name === 'messages')
|
|
15
|
-
return (await import('../examples/messages/handoff-config.js')).handoffConfig();
|
|
16
|
-
if (name === 'peermesh')
|
|
17
|
-
return (await import('../examples/peermesh/project-config.js')).peerMeshConfig();
|
|
18
|
-
if (name === 'substrate')
|
|
19
|
-
return (await import('../examples/substrate/project-config.js')).substrateConfiguration();
|
|
20
|
-
if (name === 'lead-worker')
|
|
21
|
-
return {
|
|
22
|
-
...(await import('../examples/lead-worker/project-config.js')).leadWorkerConfig(),
|
|
23
|
-
team: process.env.ANYSWARM_LEAD_WORKER_TEAM,
|
|
24
|
-
checkingImage: process.env.ANYSWARM_LEAD_WORKER_CHECKING_IMAGE,
|
|
25
|
-
};
|
|
26
|
-
const path = new URL('../examples/' + name + '/config.js', import.meta.url);
|
|
27
|
-
if (findApplication(name) && !existsSync(path))
|
|
28
|
-
return undefined;
|
|
29
|
-
path.search = 'launcher=' + Date.now();
|
|
30
|
-
return (await import(path.href)).default;
|
|
31
|
-
}
|
|
@@ -1,52 +1,19 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
|
|
3
|
-
archive?: string;
|
|
4
|
-
sha256?: string;
|
|
5
|
-
}, signal: AbortSignal, progress: (message: string) => void): Promise<{
|
|
6
|
-
ok: boolean;
|
|
7
|
-
before: string;
|
|
1
|
+
export declare function updateAnySwarm(signal: AbortSignal): Promise<{
|
|
2
|
+
before: any;
|
|
8
3
|
path: string;
|
|
9
4
|
packageRoot: string;
|
|
10
|
-
source: string;
|
|
11
|
-
detail: string;
|
|
12
|
-
environment: string;
|
|
13
|
-
} | {
|
|
14
|
-
detail?: undefined;
|
|
15
|
-
before: string;
|
|
16
|
-
path: string;
|
|
17
|
-
packageRoot: string;
|
|
18
|
-
source: string;
|
|
19
5
|
environment: string;
|
|
20
6
|
ok: boolean;
|
|
21
|
-
after:
|
|
22
|
-
result: string;
|
|
23
|
-
} | {
|
|
24
|
-
version: string;
|
|
25
|
-
packageRoot: string;
|
|
26
|
-
path: string;
|
|
27
|
-
detail?: undefined;
|
|
28
|
-
before: string;
|
|
29
|
-
environment: string;
|
|
30
|
-
ok: boolean;
|
|
31
|
-
after: string;
|
|
7
|
+
after: any;
|
|
32
8
|
source: string;
|
|
33
|
-
sha256: string;
|
|
34
9
|
result: string;
|
|
10
|
+
detail: string;
|
|
35
11
|
} | {
|
|
36
|
-
|
|
12
|
+
ok: boolean;
|
|
13
|
+
before: any;
|
|
37
14
|
path: string;
|
|
38
15
|
packageRoot: string;
|
|
39
|
-
source: string;
|
|
40
16
|
environment: string;
|
|
41
|
-
|
|
42
|
-
after?: string | undefined;
|
|
43
|
-
result: string;
|
|
17
|
+
source: string;
|
|
44
18
|
detail: string;
|
|
45
19
|
}>;
|
|
46
|
-
export declare function activateOfficialInstall(input: {
|
|
47
|
-
prefix: string;
|
|
48
|
-
stage: string;
|
|
49
|
-
source: string;
|
|
50
|
-
sha256: string;
|
|
51
|
-
expectedVersion?: string;
|
|
52
|
-
}): Promise<void>;
|