@ra3orblade/swarm 0.5.0 → 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/dist/swarm-mcp.js +24 -1
- package/dist/swarm.js +93 -7
- package/dist/swarmd.js +919 -161
- package/package.json +1 -1
- package/web/app.js +282 -8
- package/web/icons.js +2 -2
- package/web/index.html +29 -0
- package/web/release-notes.js +2 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// generated by tools/build.ts from CHANGELOG.md
|
|
2
|
+
window.RELEASE_NOTES = {"0.6.0":{"date":"2026-08-23","html":"<p>The learn release: the data Swarm has been collecting starts paying back. Replay what an agent did, see what each task cost, turn an incident into a rule, resume a session that died, try a rule on history before switching it on, read your backlog from GitHub or Linear, and search everything Swarm remembers.</p>\n<h4>Added</h4>\n<ul><li><b>Session Replay</b> — a <b>Replay</b> button on any session steps through its tool calls one at a time, showing the full input and output of each (Prev/Next, a slider, ←/→ keys). See exactly what an agent did, in order (M4.1).</li><li><b>Cost by task</b> — the Spend view attributes cost and tokens to each task (matched to a claim by the session's worktree), plus a <b>Context budget</b> table ranking sessions by how much context they re-processed — a signal for agents re-reading the same material. <code>GET /v1/attribution</code> (M4.2).</li><li><b>Codify an incident</b> — the Incidents feed has a <b>Codify</b> action that turns an incident into a <code>.swarm.toml</code> rule snippet and a CLAUDE.md lesson, both copyable. A rule that keeps firing as <code>ask</code> suggests hardening to <code>deny</code> (M4.3).</li><li><b>Desktop notifications</b> — opt-in native notifications (settings menu) for a spawned run waiting on a permission, or a claim orphaned with unfinished work; clicking opens the Allow/Deny card or the Board. Quiet while you're looking at the dashboard (M4.7).</li><li><b>Auto-handoff, and resume where it died</b> — whenever a session working in a claimed worktree pauses or ends, Swarm derives a handoff from what it did: files edited, the last verification-looking command, the last request, the last thing it said. One <code>auto:</code> handoff per session, replaced on every pause, silenced by a handoff left on purpose. An ended session's page gets <b>Resume where it died</b>, which spawns a run on the task from that handoff plus the session's last actions; <code>swarm run resume <session-id></code>; <code>GET/POST /v1/sessions/:id/resume</code> (M4.4).</li><li><b>Rule dry-run</b> — <b>Dry-run rules</b> on the Incidents view replays a project's recorded tool calls through the rules under modes you pick: what would have been asked or denied, per rule, before you switch anything on. It also flags <b>flaky signals</b> — a rule that keeps firing on the same command that is then allowed through anyway. Nothing is recorded. <code>swarm rules dryrun [--set rule=mode,…]</code>; <code>GET /v1/rules/dryrun</code> (M4.6).</li><li><b>GitHub Issues and Linear as task sources</b> — <code>[tasks] source = \"github\"</code> reads the repo's issues through the logged-in <code>gh</code> (optional <code>labels</code> filter); <code>source = \"linear\"</code> reads Linear through its API with <code>LINEAR_API_KEY</code> from the daemon's environment (optional <code>team</code>). Both land in the Board's Tasks, <code>swarm tasks</code> and <code>swarm_next_task</code> like a markdown backlog: closed/completed is done, in-progress is active, <em>depends on #n</em> / <em>blocked by</em> become dependencies. Read-only; no credential stored (M4.8).</li><li><b>What's New in the app</b> — the dashboard shows the release notes for the running version: a <b>What's New</b> item in the settings menu, in the desktop app's <b>Swarm</b> menu, and in the tray. It also opens once on its own the first time you run a new version. Notes are parsed from <code>CHANGELOG.md</code> into <code>release-notes.js</code> at build time, so they work offline with no repo checkout.</li><li>The desktop <b>Check for Updates…</b> is in the system menu bar (Swarm menu), not only the tray.</li></ul>"},"0.5.0":{"date":"2026-08-22","html":"<p>The drive release: Swarm doesn't just watch agents now — it starts them, in a claimed worktree, and brokers what they're allowed to do. Plus the coordination primitives that make an autonomous run safe to leave alone: leases that renew themselves, gates that gate, and a handoff the next session reads on its own.</p>\n<h4>Added</h4>\n<ul><li><b><code>swarm run</code></b> — spawn an agent on a task. <code>swarm run --task login-form --prompt \"…\"</code> claims the task and the daemon starts <code>claude -p</code> in its worktree with stream-json on both ends. Steer it with <code>swarm run send</code>, stop it with <code>swarm run stop</code> (stdin closed, then the process registry's pid-based TERM/KILL — never by pattern), list with <code>swarm run ls</code>. The session shows in Fleet as ▶ spawned and is ingested like any other; every finished turn is a <code>run.result</code> event with cost and turns (M3.1).</li><li><b>Run from the dashboard</b> — Ready (or held) task rows on the Board get a <b>Run</b> action: a drawer with the prompt prefilled from the task, permission mode, model and max turns (⌘⏎ to submit). The spawned session opens with a stdin box to steer it and a <b>Stop</b> button (M3.3).</li><li><b>Permission broker</b> — a <code>swarm run</code> agent's tool-permission prompts go through the same rules as your interactive sessions: a rule <code>deny</code> auto-denies with the reason, an unflagged tool auto-allows so the agent can make progress, and anything the rules mark <code>ask</code> is held and surfaced on the session as an <b>Allow / Deny</b> card. No blocking on a terminal you can't see. Uses <code>--permission-prompt-tool stdio</code>; <code>POST /v1/runs/:id/permissions/:reqId</code> (M3.2).</li><li><b>Leases renew themselves.</b> A session working inside a claimed worktree extends the lease on any activity (hook or transcript growth) once it is past half-way — no more <code>swarm renew</code> in a long session. Expired leases whose worktree still holds uncommitted or unpushed work are marked <b>Orphaned</b> within a minute and open an <code>orphaned_claim</code> incident; nothing is removed automatically (M1.2).</li><li><b>Handoffs, injected on start</b> — <code>swarm handoff <task> --done … --remaining … [--files] [--verify]</code> (or <code>swarm_handoff</code>) records what the last holder leaves; <code>swarm resume</code> / <code>swarm_resume</code> reads it. The next session that starts inside that task's worktree gets it automatically as <code>SessionStart</code> context, along with what it holds and the lease left, gate status, held resources, and the repo's rule modes (M1.3).</li><li><b>Gates</b> — verification runs recorded against a task: <code>swarm gate record login-form review pass --rubric \"tests green, error paths read\"</code> (or <code>swarm_gate_record</code>). A run without a rubric is rejected; the latest run per gate decides; failed runs are never deleted and open a <code>gate_failed</code> incident. <code>.swarm.toml [gates] required = [\"review\"]</code> declares what every task must pass; the Board's Tasks grid shows ✓ / ✗ / — per gate and a <b>Recent gates</b> section lists the runs (M2.2).</li><li><b>The MCP tools finally connect.</b> <code>swarm_status</code>, <code>swarm_claim</code>, <code>swarm_next_task</code>, <code>swarm_handoff</code>, <code>swarm_gate_record</code>, <code>swarm_acquire_resource</code> and the rest are reachable from Claude Code — see the fix below.</li><li>Dashboard deep links (<code>?view=board&project=<id>&session=<id></code>) and a screenshot carousel with a lightbox on the website; <code>tools/screens.ts</code> re-captures the shots with Playwright at 2×.</li></ul><h4>Fixed</h4>\n<ul><li><b>Swarm's MCP tools were never reachable.</b> <code>swarm install</code> wrote <code>mcpServers.swarm</code> into <code>~/.claude/settings.json</code>, which Claude Code ignores — user-scope MCP servers live in <code>~/.claude.json</code> (what <code>claude mcp add -s user</code> edits). Install now registers there (and cleans the stale settings.json entry); <code>claude mcp list</code> shows <code>swarm ✔ Connected</code>. <b>Re-run <code>swarm install</code> after upgrading.</b></li><li><b>The daemon reads global config from where its state lives.</b> <code>[rules]</code> / <code>[gates]</code> / <code>[tasks]</code> in <code>~/.swarm/config.toml</code> are resolved against the daemon's home (<code>SWARM_HOME</code>), matching the DB and logs — spawned runs, which execute in a worktree without the repo's <code>.swarm.toml</code>, still see machine-wide rules.</li></ul>"},"0.4.1":{"date":"2026-08-22","html":"<h4>Fixed</h4>\n<ul><li><b>PRs view went dark under the desktop app.</b> A daemon launched from the Dock gets macOS's bare GUI <code>PATH</code>, so Homebrew's <code>gh</code> / <code>glab</code> were invisible and the forge silently returned nothing. The daemon now also looks in <code>/opt/homebrew/bin</code>, <code>/usr/local/bin</code>, Linuxbrew and <code>~/.local/bin</code>; <code>swarm doctor</code> reports forge CLI auth and warns when <code>glab</code> relies on a shell-only <code>GITLAB_TOKEN</code>.</li><li>Icons are vertically centred on their text again (<code>vertical-align: middle</code> instead of a fixed <code>-3px</code> tuned for the old type scale).</li><li>npm publish moves to <b>trusted publishing</b> (OIDC, no <code>NPM_TOKEN</code>), the same setup as fancy-menus.</li></ul>"},"0.4.0":{"date":"2026-08-22","html":"<p>The enforcement release: rules that watch file writes, not just Bash; a backlog Swarm can read; servers Swarm starts and stops by pid; and an Incidents feed you can clear.</p>\n<h4>Added</h4>\n<ul><li><b>Rules on file writes</b> — two new rules evaluated on <code>Write</code> / <code>Edit</code> / <code>MultiEdit</code> / <code>NotebookEdit</code> paths (and Bash working directories), not only Bash commands. <code>no_foreign_worktree</code> (default <code>ask</code>) stops a session from editing inside a worktree another claim holds — <em>never touch a worktree you don't hold</em> is now a hook decision, with holding inferred from the session's cwd. <code>claim_required_to_write</code> (opt-in) makes a repo's shared checkout read-only without a claim: claim a task, get a worktree, write there. Both per repo as <code>ask | deny | off</code>.</li><li><b>Incidents view</b> — the denied-action feed as its own tab: Open / All, per-rule counts, reason and session per row, <b>Ack</b> and <b>Ack all</b>; the open count sits in the nav. <code>GET /v1/incidents?open=1&project=</code>, <code>POST /v1/incidents/:seq/ack</code>, <code>POST /v1/incidents/ack</code>, <code>/v1/state.openIncidents</code>. The Board keeps a short open-only section.</li><li><b>Task source</b> — <code>.swarm.toml</code> <code>[tasks] source = \"docs/plan.md\"</code> points at a markdown file whose <code>ID | Task | Depends | Status</code> tables are the backlog (✅ / 🟡 / ⚪, dependencies by task id or milestone prefix). The Board gets a <b>Tasks</b> section (Ready / Open / All, <em>Claim</em> per row), the CLI <code>swarm tasks [--ready]</code>, and agents <code>swarm_next_task</code> — the first unclaimed task whose dependencies are done. Swarm's own roadmap is its task source. Markdown only (OQ-5 decided).</li><li><b><code>swarm serve</code> / <code>swarm proc</code></b> — <code>swarm serve start --name web -- npm run dev</code> allocates a free port (ledger + bind probe), runs the command detached with <code>PORT</code> set and logs under <code>~/.swarm/logs/<project>/</code>, registers pid + start time, and acquires the singleton — so a second <code>web</code> fails closed and the port is protected for every other session with no config. <code>serve ls | stop [name|pid]</code>, <code>proc start | ls | stop</code> for workers without a port. Stop signals registry pids only, verified by start time; nothing is ever killed by pattern. <code>POST /v1/ports/allocate</code>, <code>GET/POST/DELETE /v1/processes</code>; <b>Processes</b> section on the Board with <em>Stop</em>.</li><li><b>Star nudge</b> — once a month at most, never on first open, the dashboard asks for a GitHub star. <em>Later</em> snoozes 30 days, <em>Don't ask again</em> is final; localStorage only.</li><li><b>Sidebar drag-and-drop</b> — pinned projects reorder by dragging; the order persists on the daemon (<code>PUT /v1/projects/order</code>, <code>Project.order</code>).</li><li><b>Desktop app menu</b> — a real application menu (Swarm / Edit / View / Window): ⌘C/⌘V work, <b>View › Zoom In / Zoom Out / Actual Size</b> (<code>⌘+</code> <code>⌘−</code> <code>⌘0</code>) scale the dashboard (persisted), plus Reload and Full Screen.</li></ul><h4>Fixed</h4>\n<ul><li><b>Shared-tree rules no longer lose sight of a session mid-turn.</b> <code>shared_tree</code> / <code>destructive_git</code> keyed on a 2-minute last-seen window fed only by hooks, so a neighbour three minutes into a long turn became invisible — and its uncommitted work unguarded. Transcript growth now counts as activity (the tailer bumps <code>last_seen_at</code>), and the liveness window is the daemon's 10-minute idle threshold (<code>LIVE_WINDOW_MS</code>). A false positive costs one confirmation; a false negative cost someone's work.</li><li><code>destructive_git</code> also matches <code>git stash drop</code>, <code>git stash clear</code> and <code>git branch -D</code>.</li><li>Dashboard type scale is one step larger across the board (base 13 → 14 px; the smallest labels 10 → 11 px) — it had drifted too small, especially in the desktop app.</li><li>The <b>PRs</b> tab icon (and the branch/commit glyphs) were near-invisible at 15 px; they use the pixelarticons <em>sharp</em> variants now.</li><li>The daemon dot stayed red for up to 15 s after load on a healthy connection (the SSE stream sent nothing until its first heartbeat); the stream now flushes immediately.</li><li>The nav flashed \"Fleet\" before the restored tab was applied; session-detail event kinds (<code>userpromptsubmit</code>) no longer overflow into the message column; \"Unpinned · seen, not pinned\" keeps its spacing.</li></ul><h4>Changed — docs</h4>\n<ul><li>README and site now say what the code does: Codex CLI and Grok sessions are tailed alongside Claude Code; the requirements and architecture diagram list all three.</li><li>Rules are described as <b>guardrails against accidents, not a sandbox</b> — the guide has a new \"What rules are — and aren't\" section spelling out that a denied Bash command can be routed around (script, heredoc, direct file edit), and that worktree isolation via claims is the real fix. The site's feature cards lead with claims, rules and resources instead of Fleet and Spend.</li></ul><h4>Changed — performance</h4>\n<ul><li><b>Daemon never spawns <code>git</code> on a request.</b> Worktree status (<code>git worktree list</code> + <code>status</code>/<code>rev-list</code> per worktree, ~0.8 s across a fleet) moves to a 15 s background refresh with async <code>Bun.spawn</code>; <code>/v1/state</code> serves the cache (612 ms → ~15 ms). Claim/release invalidate it.</li><li><b>Hook round-trips are two indexed statements</b>, not two <code>git rev-parse</code> spawns plus a transcript-directory scan: <code>cwd → project</code> is cached 60 s, the inline transcript tail is debounced to once per 2 s per session (the 5 s tailer covers steady state), and subagent directories are re-listed only when their mtime moves.</li><li><b>Events store ~2 KB, not ~10 KB.</b> <code>tool_input</code> is clipped at 2 KB and <code>tool_response</code> at 4 KB in <code>payload</code> (<code>{truncated, bytes, preview}</code>), and the tool I/O is no longer duplicated in <code>raw</code>. Existing databases are rewritten once on boot and <code>VACUUM</code>ed (96 MB → 27 MB here). Retention: events older than 30 days are pruned daily (incidents kept), <code>raw</code> is cleared after 7 days.</li><li><b>Wire shape.</b> SSE frames, <code>GET /v1/events</code> replays and <code>GET /v1/sessions/:id/events</code> carry <code>seq/ts/type/projectId/sessionId/payload{hook,summary,…}</code> only — no <code>raw</code>, no tool I/O (a 5.5 MB session fetch is now ~150 KB). <code>GET /v1/events/:seq</code> returns one stored event in full; <code>?full=1</code> on the SSE replay does the same. <code>?since=0</code> replays the last 200 events, not the table.</li><li><b>Incremental session view</b> — <code>GET /v1/sessions/:id/events?after=<seq>&afterTs=<iso></code>; the dashboard appends instead of re-fetching 500 events + 500 turns on every hook.</li><li><b>Dashboard render loop</b> — one <code>requestAnimationFrame</code> scheduler, snapshot <code>seq</code> short-circuit, paused while the tab is hidden, exponential SSE reconnect backoff; session log merges two sorted lists and caches rendered rows; data-grid memoises persisted layout and uses one <code>Intl.Collator</code>; charts memoise the turn strip.</li><li>SQLite: indexes on <code>events(type, seq)</code> and <code>turns(ts)</code>, <code>mmap_size</code> 256 MB, cached prepared statements (<code>db.query</code>), <code>sessions</code>/<code>spend</code>/<code>incidents</code> memoised per write generation; <code>/v1/spend</code> is its own endpoint.</li><li>Background tick: Codex/Grok discovery every 15 s when idle; Grok <code>summary.json</code> re-read only on mtime change.</li></ul>"},"0.3.0":{"date":"2026-08-22","html":"<p>The coordination release: rules you can configure, runtime resources agents can hold, and the merge queue at the end of the loop.</p>\n<h4>Added</h4>\n<ul><li><b>Config system</b> — <code>~/.swarm/config.toml</code> (global) deep-merged with an optional <code><repo>/.swarm.toml</code>. Lenient validation: bad config can never take the daemon down. Daemon port preference is <code>SWARM_PORT</code> > config > 7777. See <code>docs/13-config.md</code>.</li><li><b>Rule engine v2</b> — every rule is per-repo configurable as <code>ask | deny | off</code>: <code>shared_tree</code>, <code>destructive_git</code>, <code>pattern_kill</code>, and the new <code>protected_ports</code> (kill/free of a configured port — <code>lsof | kill</code>, <code>fuser -k</code>, <code>kill-port</code> — is asked or denied). <code>deny</code> is returned to Claude Code as a real permission denial.</li><li><b>Incidents</b> — every non-allow decision is recorded (<code>incident.opened</code>: rule, action, command, reason), exposed at <code>GET /v1/incidents</code>, included in <code>/v1/state</code>, and shown on the Board.</li><li><b>Runtime resources (Phase 1)</b> — named singletons for what agents fight over at runtime (dev servers, databases, ports). Fail-closed acquire: holdings live while their pid runs or their lease hasn't expired; the same owner refreshes; dead holdings reap instead of blocking. Release is fail-closed too (owner required, <code>--force</code> overrides). Held ports automatically join the protected-ports rule — acquiring <code>db</code> on 5432 guards <code>lsof -ti:5432 | xargs kill</code> for every other agent, no config needed. HTTP <code>GET/POST /v1/resources</code>, <code>DELETE /v1/resources/:name</code>; MCP <code>swarm_acquire_resource</code> / <code>swarm_release_resource</code> / <code>swarm_resources</code>; CLI <code>swarm res ls|acquire|release</code>.</li><li><b>PRs view</b> — one merge queue across GitHub and GitLab. Forge detection from the git remote (ssh/https, GitLab subgroups, self-hosted), polled through the locally-authenticated <code>gh</code> / <code>glab</code> CLIs with the project root as cwd — no tokens stored, 2-minute per-project cache floor. <code>GET /v1/prs</code>, <code>POST /v1/prs/merge</code> (squash). Merge is offered only on green, mergeable, non-draft rows, behind a confirm.</li><li><b>Board view</b> — Claims, Worktrees, Resources, and Incidents move out of Fleet into their own view; Fleet shows sessions only (Live + Earlier). Last view and project selection persist across reloads.</li><li><b>Stats view</b> — <code>GET /v1/stats</code>; activity line, calendar heatmap, and streaks (daily buckets in local time, DST-immune). <code>swarm stats</code> on the CLI.</li><li><b>Data-grid everywhere</b> — Claims, Worktrees, Resources, Incidents, PRs, and all six Spend tables render through the same sortable / resizable / reorderable grid with per-column filters, a column-visibility menu, and persisted layouts. Header ticks and tooltips make the affordances discoverable.</li><li><b>Desktop: Check for Updates…</b> in the tray menu, wired to the Tauri updater with native dialogs (available / up-to-date / failed) and install-and-restart on accept.</li><li><b>Agent badge</b> on every Fleet and session row, so mixed-agent fleets are labelled consistently.</li><li><b>Website</b> — getswarm.vercel.app: OS-detected downloads from the latest GitHub release, the <code>bunx</code> one-liner, sharing tags with hero art, and (this release) rendered docs and release notes.</li><li><b>Design tokens</b> — the dashboard's CSS contains zero raw hex / rgba / font-size / duration values; the system is documented in <code>docs/12-design-tokens.md</code> with a drift grep.</li><li>Swarm now dogfoods its own rules via the repo's <code>.swarm.toml</code> (<code>shared_tree</code> / <code>destructive_git</code> deny, daemon port protected).</li></ul><h4>Fixed</h4>\n<ul><li><b>Hook resilience</b> — the PreToolUse hook falls back to the default port when <code>daemon.json</code> points at a dead daemon, so a crashed daemon no longer silently disables the guard (this was the gap behind a real <code>git add -A</code> collision).</li><li>Resource liveness: pid 0 was treated as a live process (<code>kill(0)</code> addresses the process group), so those holdings never reaped; tracked pids are now <code>> 0</code>. <code>heldPorts()</code> is one SELECT on the hook path; lazy reap on acquire, sweep on the 5 s tick. Unknown session IDs on acquire no longer mint phantom sessions.</li><li>Session view is two equal columns again (a bare <code>aside</code> selector in the sidebar-collapse CSS captured the session side panel); the log keeps your scroll position across live updates and follows the tail only when pinned to the bottom.</li><li>A pinned project whose root vanished is merged into the live same-name entry (repo renames produced duplicate sidebar rows); the sidebar <code>⋯</code> appears on hover in the count's slot and reserves no space.</li><li>Desktop: quit actually quits, window close hides (macOS convention) and the dock icon restores it, and the <code>swarmd</code> sidecar dies with the app. Dev builds serve the repo's live dashboard instead of a stale staged snapshot.</li><li>Release pipeline: npm publish is skipped cleanly when <code>NPM_TOKEN</code> is absent (since 0.4.1: trusted publishing, no token).</li></ul>"},"0.2.2":{"date":"2026-08-21","html":"<h4>Added</h4>\n<ul><li>Publishable <code>@ra3orblade/swarm</code> npm package (bundled bins + dashboard); <code>bunx @ra3orblade/swarm setup</code> onboarding.</li><li>Enterprise data-grid for Fleet with a collapsible sidebar; pixel-art icon set and bespoke empty-state illustrations; folder picker; green chart palette.</li><li>Desktop: macOS window chrome, animated pixel-logo splash, free-port daemon startup.</li></ul><h4>Fixed</h4>\n<ul><li>Release builds bundle every platform target; Linux ships <code>.deb</code> + <code>.rpm</code> (AppImage disabled until <code>linuxdeploy</code> on GitHub runners is debugged).</li></ul>"},"0.0.6":{"date":"2026-08-21","html":"<p>First signed and notarized macOS desktop build; <code>release.yml</code> became a three-OS matrix (macOS / Windows / Linux) with a native sidecar per runner.</p>"}};
|