bazel start + mcp start
This commit is contained in:
1 parent
a90653260a
commit
4c082aca7c
33 files changed
+1728
-79
No files matched your search
+6
-2
@@ -31,6 +31,8 @@ flowchart LR
|
||||
|
||||
**Lifecycle threads:** `manager.EnsureProgress` reports `StartEvent`s (placing, booting, registered) only when it really starts a container. The bot (`bot/lifecycle.go`) turns them into replies in a dedicated top-level message for that container, pins it, and unpins the previous run's message. The message's channel and timestamp are kept on the owner (`lifecycle_channel`, `lifecycle_ts`). The user's thread only gets a link. Stops (`stop`, the button, the idle reaper) post to the same thread, and `manager.WaitStopped` confirms when the machine is gone.
|
||||
|
||||
**Files:** attachments on a message (`file_share`, or `files` on an `app_mention`) are downloaded by the bot and written into the home with the node's `write_file` call, then their paths are added to the prompt. The other way, goose gets the `slackerbot` MCP server (`slackerbot tools`, run inside the container as `slackerbot-tools`) through `mcpServers` in `session/new` and `session/load`. Its `send_file` tool only checks the path and size and answers "queued". The bot watches the ACP `tool_call` / `tool_call_update` messages, and when a `send_file` call completes it reads the file with `read_file` and uploads it to the thread with `files.uploadV2`. Bytes go node → master → Slack, so slaves never need a Slack token. Both calls work in 4 MB chunks, open files with `os.Root` so symlinks and `..` can't leave the home, and are capped by `max_send_file_mb`. An older slave answers "unknown call", which surfaces as `node.ErrTooOld` and a polite reply.
|
||||
|
||||
**Containers** are `systemd-nspawn` machines started through `systemd-run`, each in its own `slackerbot-<machine>.service` unit, with CPU and memory limits. They boot the NixOS system built by `nix build .#agent` (`nix/container.nix`), which runs `goose serve` on port 1984. `/nix/store` is shared read-only. `/root` is bind-mounted from a btrfs subvolume on one of the node's drives, and is the only thing that persists. The agent's env file (API keys, the per-container goose secret) is written by the host and bind-mounted in read-only.
|
||||
|
||||
**State** lives only on the master, in `state_dir/state.json`: owners (container, size, node, drive, storage limits, idle limit, lifecycle message), sessions (Slack thread → ACP session id, plus the thread's listen mode), each channel's default listen mode, and permissions. Nodes report what's running and how much disk each home uses. Nothing else is stored.
|
||||
@@ -59,8 +61,9 @@ All Go lives in `slackerbot/` (module `slackerbot`). Packages under `internal/`
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
main[main] --> bot & manager & local & state & config
|
||||
bot --> manager & acp & commands & balance
|
||||
main[main] --> bot & manager & local & state & config & tools
|
||||
bot --> manager & acp & commands & balance & tools
|
||||
tools --> acp
|
||||
manager --> balance & state & config & storage
|
||||
local --> config & storage
|
||||
acp --> node
|
||||
@@ -94,6 +97,7 @@ flowchart TD
|
||||
| `local` | The `Node` on this machine: nspawn via `systemd-run`, machined and systemd over D-Bus, capacity detection, btrfs send/receive |
|
||||
| `balance` | Builds a view of each node and picks where a container goes |
|
||||
| `manager` | `Manager` (owners, placement, start/stop/resize/storage), the cluster link (`Remote`, `ServeCluster`, `RunSlave`) and migration. These three share a package because they're tightly coupled |
|
||||
| `tools` | The in-container MCP server (`send_file`), how goose starts it, and spotting its calls in ACP updates |
|
||||
| `acp` | JSON-RPC client for goose's ACP endpoint. Tool permission requests are auto-approved |
|
||||
| `bot` | Slack events and buttons, replies, permission checks, `grant`/`revoke`, move announcements, idle reaper, streaming replies, thread listen modes, stop reactions, the assistant pane |
|
||||
| `util` | `KeyedMutex`, `RandomHex` |
|
||||
|
||||
Reference in new issue
Block a user