@anyswarm/core 0.5.1 → 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.
Files changed (171) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +13 -6
  3. package/dist/examples/README.md +16 -5
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +15 -8
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  7. package/dist/examples/autoresearch/demo.js +1 -1
  8. package/dist/examples/autoresearch/eject.json +2 -0
  9. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  10. package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
  11. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  12. package/dist/examples/autoresearch/prepare-demo.js +15 -0
  13. package/dist/examples/autoresearch/prepare.js +3 -3
  14. package/dist/examples/autoresearch/project.d.ts +0 -94
  15. package/dist/examples/autoresearch/project.js +2 -20
  16. package/dist/examples/code/README.md +25 -17
  17. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  18. package/dist/examples/harness-session/README.md +3 -3
  19. package/dist/examples/messages/README.md +1 -1
  20. package/dist/examples/notes/README.md +3 -3
  21. package/dist/examples/services/mathlib-search/README.md +1 -1
  22. package/dist/examples/services/persistent-board/README.md +5 -2
  23. package/dist/examples/subagents/README.md +2 -2
  24. package/dist/examples/subagents/config.js +3 -3
  25. package/dist/examples/substrate/README.md +2 -2
  26. package/dist/examples/super/README.md +34 -22
  27. package/dist/examples/super/actions.d.ts +1 -1
  28. package/dist/examples/super/actions.js +11 -11
  29. package/dist/examples/super/config.js +3 -3
  30. package/dist/examples/super/eject.json +1 -1
  31. package/dist/examples/super/location.js +1 -1
  32. package/dist/examples/super/operator.d.ts +1 -0
  33. package/dist/examples/super/operator.js +31 -0
  34. package/dist/examples/super/project.d.ts +0 -107
  35. package/dist/examples/super/project.js +1 -3
  36. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  37. package/dist/scripts/anyswarm-arguments.js +69 -97
  38. package/dist/scripts/anyswarm-eject.js +1 -1
  39. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  40. package/dist/scripts/anyswarm-harnesses.js +1 -22
  41. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  42. package/dist/scripts/anyswarm-installation.js +17 -291
  43. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  44. package/dist/scripts/anyswarm-launch.js +32 -81
  45. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  46. package/dist/scripts/anyswarm-progress.js +102 -0
  47. package/dist/scripts/anyswarm-project.d.ts +1 -9
  48. package/dist/scripts/anyswarm-project.js +40 -127
  49. package/dist/scripts/anyswarm-source-runner.js +9 -41
  50. package/dist/scripts/anyswarm.js +6 -26
  51. package/dist/scripts/build-provenance.json +1 -1
  52. package/dist/scripts/local-environment.d.ts +10 -4
  53. package/dist/scripts/local-environment.js +67 -20
  54. package/dist/scripts/local-setup.d.ts +3 -0
  55. package/dist/scripts/local-setup.js +135 -107
  56. package/dist/scripts/pack-release.js +4 -1
  57. package/dist/src/core/worker-image.js +1 -1
  58. package/dist/src/harness/project-harness.d.ts +1 -0
  59. package/dist/src/harness/project-harness.js +2 -2
  60. package/dist/src/harness/project-runtime.js +3 -1
  61. package/docs/INDEX.md +2 -1
  62. package/docs/architecture/04-services.md +1 -1
  63. package/docs/architecture/07-run-configuration.md +28 -14
  64. package/docs/architecture/12-code-coverage.md +56 -57
  65. package/docs/architecture/17-harness-reporting.md +1 -1
  66. package/docs/architecture/22-website.md +4 -7
  67. package/docs/architecture/23-project-harness.md +48 -23
  68. package/docs/architecture/26-code.md +20 -5
  69. package/docs/architecture/27-personal.md +23 -8
  70. package/docs/architecture/28-autoresearch.md +18 -6
  71. package/docs/architecture/INDEX.md +1 -2
  72. package/docs/architecture/prompts/source-manifest.json +5 -5
  73. package/docs/architecture/source-map.json +51 -71
  74. package/docs/designs/core-harness/01-core.md +2 -2
  75. package/docs/designs/core-harness/06-project-harness.md +3 -3
  76. package/docs/designs/core-harness/README.md +2 -2
  77. package/docs/en/agents.md +1 -1
  78. package/docs/en/build-your-harness.md +1 -1
  79. package/docs/en/changelog.md +7 -0
  80. package/docs/en/first-harness.md +6 -6
  81. package/docs/en/harnesses/lead-worker.md +1 -1
  82. package/docs/en/harnesses/peermesh.md +2 -2
  83. package/docs/en/harnesses/subagents.md +2 -2
  84. package/docs/en/harnesses/substrate.md +4 -4
  85. package/docs/en/harnesses/taskpool.md +2 -2
  86. package/docs/en/latest.md +9 -5
  87. package/docs/en/quickstart.md +20 -41
  88. package/docs/en/reference/api.md +1 -1
  89. package/docs/en/reference/cli.md +47 -85
  90. package/docs/en/sandbox.md +3 -3
  91. package/docs/operations/trace-viewer.md +1 -1
  92. package/docs/third-party-notices.md +0 -1
  93. package/docs/workflows/development.md +14 -12
  94. package/docs/workflows/release-and-docs-versioning.md +13 -12
  95. package/docs/workflows/release-cli-acceptance.md +85 -0
  96. package/docs/zh/agents.md +1 -1
  97. package/docs/zh/build-your-harness.md +1 -1
  98. package/docs/zh/changelog.md +8 -1
  99. package/docs/zh/first-harness.md +7 -7
  100. package/docs/zh/harnesses/lead-worker.md +1 -1
  101. package/docs/zh/harnesses/peermesh.md +2 -2
  102. package/docs/zh/harnesses/subagents.md +2 -2
  103. package/docs/zh/harnesses/substrate.md +4 -4
  104. package/docs/zh/harnesses/taskpool.md +2 -2
  105. package/docs/zh/latest.md +9 -5
  106. package/docs/zh/quickstart.md +20 -41
  107. package/docs/zh/reference/api.md +1 -1
  108. package/docs/zh/reference/cli.md +19 -79
  109. package/docs/zh/sandbox.md +3 -3
  110. package/examples/README.md +16 -5
  111. package/examples/authoring/README.md +4 -4
  112. package/examples/autoresearch/README.md +15 -8
  113. package/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  114. package/examples/autoresearch/demo.ts +1 -1
  115. package/examples/autoresearch/eject.json +2 -0
  116. package/examples/autoresearch/frontiercs2-config.ts +4 -0
  117. package/examples/autoresearch/prepare-demo.ts +15 -0
  118. package/examples/autoresearch/prepare.ts +3 -3
  119. package/examples/autoresearch/project.ts +2 -19
  120. package/examples/code/README.md +25 -17
  121. package/examples/code/REQUIREMENTS.zh.md +3 -3
  122. package/examples/harness-session/README.md +3 -3
  123. package/examples/messages/README.md +1 -1
  124. package/examples/notes/README.md +3 -3
  125. package/examples/services/mathlib-search/README.md +1 -1
  126. package/examples/services/persistent-board/README.md +5 -2
  127. package/examples/subagents/README.md +2 -2
  128. package/examples/subagents/config.ts +4 -3
  129. package/examples/substrate/README.md +2 -2
  130. package/examples/super/README.md +34 -22
  131. package/examples/super/actions.ts +11 -11
  132. package/examples/super/config.ts +3 -3
  133. package/examples/super/eject.json +1 -1
  134. package/examples/super/location.ts +1 -1
  135. package/examples/super/operator.ts +28 -0
  136. package/examples/super/project.ts +1 -3
  137. package/npm-shrinkwrap.development.json +42 -1541
  138. package/npm-shrinkwrap.json +3 -43
  139. package/package.development.json +2 -6
  140. package/package.json +2 -5
  141. package/scripts/anyswarm-arguments.ts +67 -96
  142. package/scripts/anyswarm-eject.ts +1 -1
  143. package/scripts/anyswarm-harnesses.ts +1 -18
  144. package/scripts/anyswarm-installation.ts +18 -294
  145. package/scripts/anyswarm-launch.ts +30 -102
  146. package/scripts/anyswarm-progress.ts +95 -0
  147. package/scripts/anyswarm-project.ts +31 -123
  148. package/scripts/anyswarm-source-runner.ts +9 -36
  149. package/scripts/anyswarm.ts +4 -24
  150. package/scripts/local-environment.ts +71 -20
  151. package/scripts/local-setup.ts +134 -94
  152. package/scripts/pack-release.ts +4 -1
  153. package/src/core/worker-image.ts +1 -1
  154. package/src/harness/project-harness.ts +2 -2
  155. package/src/harness/project-runtime.ts +2 -1
  156. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  157. package/dist/scripts/anyswarm-applications.js +0 -19
  158. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  159. package/dist/scripts/anyswarm-tui-config.js +0 -189
  160. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  161. package/dist/scripts/anyswarm-tui-session.js +0 -304
  162. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  163. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  164. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  165. package/dist/scripts/anyswarm-tui.js +0 -1012
  166. package/docs/architecture/25-foreground-tui.md +0 -51
  167. package/scripts/anyswarm-applications.ts +0 -39
  168. package/scripts/anyswarm-tui-config.ts +0 -174
  169. package/scripts/anyswarm-tui-session.ts +0 -295
  170. package/scripts/anyswarm-tui-terminal.ts +0 -147
  171. package/scripts/anyswarm-tui.ts +0 -912
@@ -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
- 'Without --mode, reuse a saved managed local service or a configured connection. With no connection, prepare local OpenSandbox.',
5
- 'Existing mode saves the authenticated connection. Run anyswarm doctor --smoke to verify Worker and Runtime callbacks.',
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 [--archive <package.tgz> --sha256 <digest>]',
9
- 'Update this CLI to the latest stable release in its verified installation scope. Project SDK and Worker preparation are independent.',
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 <directory>] [--config <module>] [--output-dir <directory>] [--lifetime task|interactive] [--interaction none|questions]',
15
- ' anyswarm --harness <module> --mode rpc [--config <module>] [--output-dir <directory>] [--lifetime task|interactive] [--interaction none|questions]',
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 | anys Open the streaming TUI',
23
- 'Usage: anys -u <harness> [prompt] [--headless | --rpc]',
24
- ' anys -u <harness> --cmd "/action [arguments]"',
25
- 'Harness options: --config <module>, --cwd <directory>, --output-dir <directory>, --lifetime task|interactive',
26
- ' anys run <harness> [prompt] Local source files can also accept script arguments',
27
- 'Usage: anys eject <application> --dir <directory>',
28
- 'Usage: anyswarm --version',
29
- projectUsage, setupUsage, updateUsage, doctorUsage, recoverUsage,
30
- 'Usage: anyswarm trace --root <runs-dir> [--port 8787] [--open]',
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 isLocalHarness(specifier) {
33
- return specifier.startsWith('./') || specifier.startsWith('../') || specifier.startsWith('/');
34
- }
35
- export function isHarnessName(specifier) {
36
- return /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]*$/i.test(specifier);
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
- if ([values.use, values.harness, values.cwd, values.config, values['output-dir']].includes('') ||
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
- return { values, positionals, options: { configPath: values.config, outputRoot: values['output-dir'], lifetime, interaction } };
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 parseHarnessSelection(args, selected) {
53
- const { values, positionals, options } = parseHarnessOptions(args, true);
54
- const harness = selected ?? values.use;
55
- if (!harness || values.harness !== undefined || (selected && values.use !== undefined) ||
56
- (positionals.length && values.prompt !== undefined))
57
- throw new Error(anyswarmUsage);
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, registered = {}) {
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
- const usages = { run: 'Usage: anys run <harness> [prompt or source arguments]', eject: 'Usage: anys eject <application> --dir <directory>', setup: setupUsage, update: updateUsage, doctor: doctorUsage, recover: recoverUsage };
83
- const usage = Object.hasOwn(usages, command) ? usages[command] : anyswarmUsage;
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 isLocalHarness(options[0]) || /^[^@]+\.(?:[cm]?[jt]s)$/.test(options[0])
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 && isHarnessName(positionals[0]) && !positionals[0].includes('/') && values.dir) {
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 === '-u' || command.startsWith('-u=') || command === '--use' || command.startsWith('--use=')) {
102
- return parseHarnessSelection(args);
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
- const { values } = parseArgs({ args: options, options: { archive: { type: 'string' }, sha256: { type: 'string' } } });
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
- if (values.config !== '')
151
- return { command, configPath: values.config, smoke: values.smoke === true };
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: `anys run ./${manifest.entry}` }, dependencies: { ...dependencies, '@anyswarm/core': 'file:./.anyswarm-sdk/core.tgz' },
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,2 +1 @@
1
1
  export declare const builtins: Record<string, string>;
2
- export declare function builtinConfiguration(name: string): Promise<any>;
@@ -1,7 +1,5 @@
1
- import { existsSync } from 'node:fs';
2
- import { applicationDescriptors, findApplication } from './anyswarm-applications.js';
3
1
  export const builtins = {
4
- ...Object.fromEntries(applicationDescriptors().map(app => [app.id, app.harness])),
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 archiveDigest(path: string): Promise<string>;
2
- export declare function updateAnySwarm(options: {
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: string;
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
- before: string;
12
+ ok: boolean;
13
+ before: any;
37
14
  path: string;
38
15
  packageRoot: string;
39
- source: string;
40
16
  environment: string;
41
- ok: boolean;
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>;