Give Bevelina her three asked-for powers: file download, file upload, custom emoji - #9
Merged
Merged
Conversation
…et custom emoji Bevelina's own asks from the :anya: thread — she could edit the image but not reach the original attachment, post the result, or land the emoji herself. - tools/slack.ts: the slack registry moves out of main.ts (testable, one place) and grows download_file (original bytes into <workspace>/files; bot token only ever rides to files.slack.com), upload_file (reserve→put→complete flow, addressed like reply, workspace-paths only), and emoji_set (admin.emoji.add, replace-on-exists; outward, so it waits for a go-ahead; fails room-safe when SLACK_ADMIN_TOKEN is absent). - inbox/service: attachment lines now carry mimetype + url_private so the original file is addressable from the turn, not just named. - policy.example.yaml documents the grants; KNOWN_TOOLS derives from SLACK_TOOL_NAMES. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the #bevelina thread — asked what tools would have made the :anya: emoji job self-serve, she named three: download the original slack attachment (not the 48px preview), upload a generated file back into the thread, and create/update custom emoji.
What this adds
src/tools/slack.ts— the slack registry moves out ofmain.tsinto its own tested module and gains:download_file— fetches an attachment's original bytes (via the adapter's existingdownloadFile) into<workspace>/files/. Host-pinned tofiles.slack.comso the bot token can never ride to an arbitrary URL; save names are sanitized against traversal.upload_file— Slack'sfiles.getUploadURLExternal→ PUT →files.completeUploadExternalflow, addressed exactly likereply(venueId + threadRootId). Ungated speech, but restricted to files inside her own workspace — the daemon's filesystem is not hers to post.emoji_set—admin.emoji.addwith replace-on-exists (remove + re-add). Staticallyoutward, so it rides the confirmation flow. Needs a new optionalSLACK_ADMIN_TOKENenv (admin user token); without it, it fails in room-safe language.mimetypeandurl_private(the router already persisted them; inbox narrowed them away), so a turn can actually address the original file.KNOWN_TOOLSderives fromSLACK_TOOL_NAMES;deploy/policy.example.yamldocuments the grants.To go live
download_file/upload_file/emoji_setto bevelina in the livepolicy.yaml(hot-reloads).files:read(already has, per the adapter) andfiles:writefor uploads.emoji_setcaveat:admin.emoji.addis the documented API and it's Enterprise Grid only. On a standard workspace it will fail friendly — worth knowing before wiringSLACK_ADMIN_TOKEN.13 new tests; full suite (382), typecheck, lint all green.
🤖 Generated with Claude Code