making use of the extended perms and added future work
This commit is contained in:
1 parent
296e465f48
commit
22fd8fbce8
19 files changed
+617
-40
No files matched your search
@@ -0,0 +1,11 @@
|
||||
# Future additions
|
||||
|
||||
Designs that aren't built yet. Each file says what it needs, which Slack scopes it uses, and what it must not break.
|
||||
|
||||
| Plan | Uses | Depends on |
|
||||
|---|---|---|
|
||||
| [send-files-to-user.md](send-files-to-user.md) | `files:write` | node file reads |
|
||||
| [attachments-into-container.md](attachments-into-container.md) | `files:read` | node file writes |
|
||||
| [agent-slack-tools.md](agent-slack-tools.md) | `canvases:*`, `lists:*`, `bookmarks:*`, `pins:*`, `channels:write.topic`, `emoji:read`, `team:read`, `users:read.email`, `chat:write.public` | the MCP bridge in send-files-to-user.md |
|
||||
|
||||
Until these are built, the scopes above are requested in `slack-manifest.yaml` but unused.
|
||||
@@ -0,0 +1,32 @@
|
||||
# Slack tools for the agent
|
||||
|
||||
Let the agent act in Slack: write canvases and lists, add bookmarks and pins, set the channel topic, look people up, use custom emoji.
|
||||
|
||||
## Don't hand the bot token to containers
|
||||
|
||||
With `channels:history` and the other read scopes, a container holding the bot token could read every channel the bot is in, and anyone who can talk to a channel's agent could make it do so. Instead, the bot keeps the token and exposes a narrow set of tools.
|
||||
|
||||
## Shape
|
||||
|
||||
- The bot exposes the tools through the same in-container MCP server as `send_file` ([send-files-to-user.md](send-files-to-user.md)). The container side stays a thin relay: it forwards each call to the bot, and the bot answers.
|
||||
- **Getting calls to the bot:** the relay talks back over the agent connection the bot already has open (a new ACP extension method such as `_slackerbot/call`, which goose would pass through from the MCP server, if it can), or over a new stream from container → node → master. The second option is a new direction on the cluster link (slave → master) and has to be additive, because masters and slaves may run different versions for a while.
|
||||
- **Every call is scoped to the session's owner:** the channel (or the user's DM) and its threads. The bot checks this, not the container.
|
||||
|
||||
## Tools
|
||||
|
||||
| Tool | Scope | Notes |
|
||||
|---|---|---|
|
||||
| `create_canvas`, `edit_canvas` | `canvases:write`, `canvases:read` | Channel canvas, or a standalone canvas shared into the thread |
|
||||
| `create_list`, `add_list_item` | `lists:write`, `lists:read` | |
|
||||
| `add_bookmark`, `list_bookmarks` | `bookmarks:write`, `bookmarks:read` | Channel only |
|
||||
| `pin_message`, `list_pins` | `pins:write`, `pins:read` | Messages in this conversation only |
|
||||
| `set_topic` | `channels:write.topic` | Channel only. Probably behind a new permission, since it changes what everyone sees |
|
||||
| `lookup_user` | `users:read`, `users:read.email` | Only users in this conversation. Email is handy for git commit authors |
|
||||
| `list_emoji` | `emoji:read` | |
|
||||
| `workspace_info` | `team:read` | Name and domain, for building links |
|
||||
| `post_to_channel` | `chat:write.public` | Only if we decide the agent may post outside its own conversation. Probably not |
|
||||
|
||||
## Before building
|
||||
|
||||
- Decide which tools need a permission (`set_topic` and `post_to_channel` at least), and add it to `model` and USERGUIDE.
|
||||
- Drop from the manifest any scope we decide not to use, since Slack lists every scope on the install screen.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Attachments into the container
|
||||
|
||||
Files attached to a message to the bot (images, logs, zips) end up in the container, so the agent can use them.
|
||||
|
||||
- Message events with `subtype: file_share` are dropped today (`bot.onEvent` only takes messages with no subtype). Accept `file_share` too.
|
||||
- For each entry in `files[]`, download `url_private_download` with the bot token (`files:read`), and write it to `/root/slack-uploads/<message ts>/<name>`.
|
||||
- Add the paths to the prompt text: `(Attached: /root/slack-uploads/…/report.pdf)`.
|
||||
- Writing needs a node operation, `write_file(machine, path)`, that streams chunks like `import_home` / `write_import`. It's the mirror of `read_file` in [send-files-to-user.md](send-files-to-user.md), so build the two together. It's an additive call name in `manager/cluster.go`, and old slaves get a polite "this node can't take attachments yet".
|
||||
- Size cap: reuse `max_send_file_mb`. The home's btrfs quota still applies, so an upload that doesn't fit fails with a clear message.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Agent sends files to the user
|
||||
|
||||
Give the agent a `send_file` tool, so it can hand back images, videos, PDFs, archives or any other file it made. The bot uploads the file into the session's thread, where Slack previews images, video and PDFs inline.
|
||||
|
||||
## Shape
|
||||
|
||||
1. **The tool runs inside the container.** It's a tiny stdio MCP server added to `nix/container.nix` (for example `slackerbot-tools`). The bot passes it to goose in `session/new` and `session/load` through `mcpServers` (now `[]` in `acp.go`), so every session gets it without a goose config change.
|
||||
- `send_file(path, comment?)`: checks that the path is a regular file under `/root` and below the size cap, then returns `"queued"`. It doesn't move any bytes itself, so file contents never land in the model's context.
|
||||
- Check first that the `goose serve` version we ship honours `mcpServers` from ACP. If it doesn't, register the extension in goose's config in `container.nix` instead.
|
||||
2. **The bot does the upload.** The streamer already sees ACP `tool_call` / `tool_call_update` messages. When a `send_file` call completes, the bot reads `rawInput.path`, fetches the file from the container's home, and calls `files.uploadV2` (`files:write`) into the thread, with `comment` as the initial message.
|
||||
3. **Getting the bytes from the home** needs a new node operation, `read_file(machine, path)`, that streams the file in chunks the same way `export_home` / `read_export` do.
|
||||
- `local` opens the file with `os.OpenInRoot(home, rel)` (Go 1.24), so symlinks and `..` can't escape the home.
|
||||
- It's a new call name in `manager/cluster.go`. Old slaves answer "unknown call", and the bot replies "This node is too old to send files" instead of failing the turn.
|
||||
- Files go node → master → Slack, so slaves still need no Slack token.
|
||||
|
||||
## Limits and config
|
||||
|
||||
- `max_send_file_mb` in `config.toml` (default 100). Slack's own limit is 1 GB.
|
||||
- At most a few files per turn, so a looping agent can't flood a thread.
|
||||
- The tool's description tells the agent to use it for anything the user should see or download, rather than pasting long output.
|
||||
|
||||
## Docs to update when built
|
||||
|
||||
USERGUIDE (agent can send files), ARCHITECTURE (`read_file` call, MCP tool), INSTALLATION and `config.example.toml` (`max_send_file_mb`).
|
||||
Reference in new issue
Block a user