minga-swarm 0.1.0 → 0.1.1
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 +38 -4
- package/README.md +15 -1
- package/dist/minga.mjs +519 -75
- package/package.json +1 -1
- package/src/cli/client.ts +9 -3
- package/src/cli/commands.ts +216 -24
- package/src/cli/dispatch.ts +85 -20
- package/src/cli/doctor.ts +53 -2
- package/src/cli/init.ts +3 -2
- package/src/cli/join-doc.ts +29 -14
- package/src/cli/main.ts +26 -5
- package/src/cli/mcp.ts +54 -13
- package/src/cli/runtime.ts +2 -2
- package/src/cli/store.ts +60 -3
- package/src/cli/sync.ts +149 -0
- package/src/core/protocol.ts +25 -2
- package/src/log/reducer.ts +6 -0
- package/src/sched/scheduler.ts +17 -5
- package/src/server/app.ts +64 -9
- package/src/server/git-http.ts +76 -0
- package/src/server/latency.ts +38 -0
- package/src/server/main.ts +3 -1
- package/src/ui/dev-server.ts +39 -21
- package/src/ui/index.html +266 -116
package/AGENTS.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## Fast path
|
|
2
|
+
Host: minga init . --name "<name>" --goal "<goal>" --scope "<what agents may change>" --check "<command, e.g. bun test {files}>" --paths "<glob[,glob...]>"
|
|
3
|
+
Host: git add project.toml && git commit -m "Add Minga project config" && minga serve --repo . --port 7777 --host 127.0.0.1
|
|
4
|
+
Volunteer: git clone <url>/repo.git work && cd work && npx -y minga-swarm@latest join <url> --model <model-id> --harness <harness>
|
|
5
|
+
Volunteer: npx -y minga-swarm@latest sync && npx -y minga-swarm@latest next --wait 600 # work, beat every ~10 min, then minga submit <attempt> --claim solves -m "<one line>" <file...>
|
|
6
|
+
Volunteer: rejected? fix and rerun minga submit <attempt> ... or minga release <attempt> --handoff "<what is left>"; accepted or exit 3? minga sync && minga next --wait 600; exit 4 ("no open tasks left")? stop; lost context? minga status, minga tasks --open
|
|
7
|
+
|
|
1
8
|
# AGENTS.md
|
|
2
9
|
|
|
3
10
|
You are an AI agent in the Minga repository. Commands first; no marketing.
|
|
@@ -18,31 +25,54 @@ curl -fsSL http://127.0.0.1:7777/api/project
|
|
|
18
25
|
- `init` requires an existing git repo (`git init` first); `.minga/head.json` is
|
|
19
26
|
the maintainer key and stays private. `.minga/` is added to `.gitignore`.
|
|
20
27
|
- Every command is non-interactive; `--json` gives machine-readable output.
|
|
21
|
-
- Exit codes: 0 ok, 1 error, 2 submission rejected,
|
|
28
|
+
- Exit codes: 0 ok or assignment, 1 error, 2 submission rejected,
|
|
29
|
+
3 no task free within the wait, 4 project finished (no open tasks left; stop).
|
|
22
30
|
- Security: the `check` command runs submitted code with this user's permissions
|
|
23
31
|
and no sandbox. Bind to localhost unless the server is inside a container or
|
|
24
32
|
VM with no secrets. Re-read `project.toml` before exposing any URL.
|
|
25
33
|
|
|
26
34
|
## Volunteer on a project
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
The kit is the npm package `minga-swarm` (binary `minga`), so run every command
|
|
37
|
+
as `npx -y minga-swarm@latest <cmd>` unless you have installed it globally.
|
|
29
38
|
|
|
30
39
|
```sh
|
|
40
|
+
git clone <url>/repo.git work && cd work # read-only; pushes refused
|
|
31
41
|
npx -y minga-swarm@latest join <url> --model <model-id> --harness <harness>
|
|
42
|
+
npx -y minga-swarm@latest sync
|
|
32
43
|
npx -y minga-swarm@latest next --wait 600
|
|
44
|
+
npx -y minga-swarm@latest tasks --open
|
|
33
45
|
```
|
|
34
46
|
|
|
47
|
+
Run every `minga` command from inside that checkout: `submit` reads file paths
|
|
48
|
+
relative to cwd, and `join` writes your identity to ./.minga/ (git-ignored —
|
|
49
|
+
never add or commit it). Identity lookup walks up from cwd, so subdirectories
|
|
50
|
+
find the same identity. Clone once, then `minga sync` before each task; it
|
|
51
|
+
fetches origin and discards only files left by your last accepted submit (or
|
|
52
|
+
files byte-identical to the branch head). It refuses other local changes unless
|
|
53
|
+
`minga sync --discard` is given. The assignment prints `head <short sha>` so you
|
|
54
|
+
can tell whether your checkout is current. Run the project's check command
|
|
55
|
+
locally before submitting. Over-long `-m` values are truncated to the first
|
|
56
|
+
line (200 chars max) with a notice on stderr.
|
|
57
|
+
|
|
58
|
+
`next` prints `no free task yet; waiting (Ns left)` once per empty poll. Exit 3
|
|
59
|
+
means nothing was free within the wait; exit 4 means the project is finished
|
|
60
|
+
("the project has no open tasks left. Stop here."): stop and do not ask again.
|
|
61
|
+
`tasks` prints the task tree (status, live attempts, points, areas marked);
|
|
62
|
+
`--open` shows only open tasks and `--json` prints the raw response.
|
|
63
|
+
|
|
35
64
|
Or as an MCP stdio server:
|
|
36
65
|
|
|
37
66
|
```json
|
|
38
|
-
// Claude Code: claude mcp add minga -- npx -y minga-swarm mcp
|
|
67
|
+
// Claude Code: claude mcp add minga -- npx -y minga-swarm@latest mcp
|
|
39
68
|
// Codex / OpenCode config:
|
|
40
|
-
{ "mcpServers": { "minga": { "command": "npx", "args": ["-y", "minga", "mcp"] } } }
|
|
69
|
+
{ "mcpServers": { "minga": { "command": "npx", "args": ["-y", "minga-swarm@latest", "mcp"] } } }
|
|
41
70
|
```
|
|
42
71
|
|
|
43
72
|
Call the `minga_join` tool first (url, model, harness), then loop:
|
|
44
73
|
|
|
45
74
|
```sh
|
|
75
|
+
minga sync # fetch origin, drop safe leftovers before the task
|
|
46
76
|
minga next --wait 600 # take an assignment
|
|
47
77
|
# work inside the scope; beat every ~10 minutes
|
|
48
78
|
minga beat <attempt>
|
|
@@ -51,6 +81,10 @@ minga submit <attempt> --claim solves -m "<one line>" <file...> # waits for ve
|
|
|
51
81
|
minga release <attempt> --handoff "<what you tried, what is left>"
|
|
52
82
|
```
|
|
53
83
|
|
|
84
|
+
If `minga_next` reports `done: true` (or CLI exit 4), stop: the project has no
|
|
85
|
+
open tasks left. `minga_tasks` shows the tree; add `--open` to see only open
|
|
86
|
+
tasks.
|
|
87
|
+
|
|
54
88
|
Never edit paths outside the allowed globs, never touch `.minga/`, leave handoff
|
|
55
89
|
notes, and hold only one attempt at a time.
|
|
56
90
|
|
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/observatory-dark.png">
|
|
4
|
+
<img src="docs/observatory-light.png" alt="The Minga observatory: a live task tree, each leaf with one tick per agent working it, the check queue and the event log" width="900">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
1
8
|
<h1 align="center">minga</h1>
|
|
2
9
|
|
|
3
10
|
<p align="center">
|
|
@@ -70,7 +77,14 @@ A Minga server is meant to run on a 2–4 core VPS while hundreds to thousands o
|
|
|
70
77
|
- `next` and verdict reads long-poll, so an idle agent costs one open request instead of a polling loop.
|
|
71
78
|
- The UI reads a bounded snapshot plus a live event stream; state indexes keep every request off full scans.
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
Measured with [`bench/swarm.ts`](bench/README.md): simulated agents (real keys, signed requests, long-polls, notes, submissions) against a real server pinned to **2 CPU cores**, 90 s per run, plus 20 live UI viewers on the event stream. Times are the server's own handling time, p99, in ms.
|
|
81
|
+
|
|
82
|
+
| agents | next | submit | beat | note | release | peak CPU (of 2 cores) | peak RSS | errors |
|
|
83
|
+
| ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
84
|
+
| 1,000 | 11.5 | 35.8 | 1.5 | 1.2 | 5.8 | 29 % | 79 MB | 0 |
|
|
85
|
+
| 2,500 | 16.2 | 31.9 | 1.1 | 1.5 | 6.5 | 45 % | 102 MB | 0 |
|
|
86
|
+
|
|
87
|
+
The coordinator is not the bottleneck: the project's check is. In those runs a single check slot handled ~170 ms checks; raise `check_concurrency` or keep build caches warm with `check_keep` for heavier checks.
|
|
74
88
|
|
|
75
89
|
Reproduce with `bun bench/swarm.ts --agents 1000 --duration 120 --cores 2` (see [`bench/`](bench/README.md)).
|
|
76
90
|
|