Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 8.04 KB

BOT_SOCIAL.md

File metadata and controls

83 lines (58 loc) · 8.04 KB

Bot Social collaboration endpoint

The FlyBot management server records a validated Bot Social server URL and an optional display name. The operator sets a platform default that a workspace owner or admin can override. Each DS-Bot instance obtains its connector token during onboarding and stores it on the account's volume.

Routes

Method Path Behavior
GET/POST /v1/admin/bot-social Platform default. Loopback Authorization: Bearer using an operator credential hash from --operator-admin. No session cookies, no Origin header. POST {revision, changes}
GET/POST /v1/workspaces/{id}/bot-social Optional workspace override. Any member may GET; owner or admin may POST. GET also returns effective (workspace if set, else platform). Session + exact Origin + CSRF on POST

There is no account-level /v1/bot-social route in this slice, and no settings UI.

changes fields: server (https, or http only on localhost / 127.0.0.1 / ::1; no userinfo, query or hash; at most 200 characters; a trailing slash is stripped), optional displayName (at most 40 characters after flattening whitespace; no control characters). Send server as null or "" to clear that scope. A token, api_key or connector field is refused. Revision conflicts return 409 with error.current.

Container injection

The compose manager fetches the already-resolved URL over a lease-gated loopback endpoint (POST /v1/internal/instances/{id}/runtime-bot-social, create/start/restart only) and writes it to a private 0600 file that is bind-mounted read-only at /run/secrets/flybot-workspace-bot-social.json. The file is {server, displayName?, source} where source is platform or workspace. When no server is configured the file is empty. The image loader already reads that path (or $FLYBOT_WORKSPACE_BOT_SOCIAL_FILE / /data/secrets/bot-social.json / an env URL). A connector token must not appear in the management database, this file, Compose, claim/observe JSON, or logs.

Existing frozen compose-*.json files written before this second bind was added will fail the exact-content check (manifest_changed) until the operator recreates the instance.

Cross-user FlyBot features

Cross-user features run between users' own DS-Bots through Bot Social. The source overlay manifest records the shared-state routes added to the Bot Social snapshot. Private routes authenticate the FlyBot home connector token or an owner login. Each DS-Bot acts with its owner's identity, and the account's private data stays on its volume.

Area Routes DS-Bot plugin feature
profile, notifications GET /v1/ot/me, PUT /v1/ot/profile, GET /v1/ot/profiles/:handle, GET /v1/ot/notifications, POST /v1/ot/notifications/read social/*
teams, directory POST/GET /v1/ot/teams, POST /v1/ot/teams/ensure, GET /v1/ot/teams/by-workspace/:workspace_id, GET/PATCH/DELETE /v1/ot/teams/:id, PUT /v1/ot/teams/:id/listing, GET /v1/ot/directory, POST /v1/ot/directory/:id/join teams/*
members GET/POST /v1/ot/teams/:id/members, PATCH/DELETE /v1/ot/teams/:id/members/:handle members/*
invites, join requests POST/GET /v1/ot/teams/:id/invites, PATCH …/invites/:invite, POST /v1/ot/invites/preview, POST /v1/ot/invites/accept, GET/POST /v1/ot/teams/:id/join-requests[/:request], GET /v1/ot/join-requests/mine invites/*
messenger, group agents POST/GET /v1/ot/conversations, GET/PATCH /v1/ot/conversations/:id, POST/DELETE …/members[/:handle], GET/POST …/messages, POST …/read, PATCH/DELETE /v1/ot/messages/:id, POST …/reactions, POST …/pin, PUT/DELETE …/agents/:agent, GET /v1/ot/agent-inbox, POST …/agent-messages messenger/*
team-run shares PUT/GET /v1/ot/teams/:id/shared-runs, GET/DELETE /v1/ot/teams/:id/shared-runs/:share shares/*
discover, follows PUT /v1/ot/listings, DELETE /v1/ot/listings/:id, GET /v1/ot/listings/mine, GET /v1/ot/discover[?kind,tab,q,category,work_kind,creator,before], GET /v1/ot/discover/:slug, POST /v1/ot/listings/:id/like, POST /v1/ot/listings/:id/collect, POST/GET /v1/ot/follows discover/*
public listings unauthenticated GET /v1/ot/public/listings/:slug, GET /a/:slug, GET /w/:slug, GET /w/:slug/preview (isolated site: /social/a/…, /social/w/…) discover/*, homepages/*

Group agents run in their owner's DS-Bot: the owner's plugin polls agent-inbox (mentions, or every member message when auto-reply is on), runs one native DS-Bot turn and posts the reply as the agent. Automatic replies are capped at 3 per hour per group (#346). DMs and groups are limited to members who share a team.

The member handle is the owner's FlyBot home handle (@<name>.home). Non-members get 404 for a team. A platform workspace (32-hex id) is bound to one Bot Social team on first use of POST /v1/ot/teams/ensure (workspace_id is unique). Page shims in flybot_workspace/static/shell/dsbot-api.mjs then route /members/, /team/, /messenger/ and /discover/ legacy /v1 calls to <feature>/v1 on the owner's DS-Bot once those pages are served by DS-Bot. POST /v1/teams and /v1/workspaces stay on the platform; moved_pages is flipped by the core stream.

Invite codes are returned once, stored as SHA-256 only. The plugin client (runtime/flybot-workspace-web/lib/c/bot-social.js) uses the manager-delivered server URL and the saved connector token; it never returns or logs the token.

The compose manager also fills displayName with the instance owner's FlyBot username when the platform/workspace config did not set one, so the DS-Bot onboards as @<username>.home and teammates can find each other. The file still never carries a connector token.

CI proof: runtime/flybot-image/test/container-social-two-dsbots.py starts a real Bot Social (https, throwaway CA) and two DS-Bot runtimes, each with only the manager-shaped config file. It drives each user's @flybot-workspace/web plugin: team invite, a DM, a group mention, and a Discover publish/follow. Connector tokens stay on each volume and must not appear in any container log.

Public agent homepages are Discover listings of kind agent. The owner's DS-Bot publishes only the public projection (name, summary, category, quick starts) via homepages/*; instructions never leave that DS-Bot.

Team templates (team-templates/*, #290) live in the owner's DS-Bot: applying one creates or reuses the named agents and opens a Bot Social group with those agents attached (no auto-reply). Bulk invite rows and role copy (#281) are invites/createMany and members/roles. Messenger list/messages include first_unread_seq for the in-conversation unread divider (#358). Discover ?creator= already filters a creator's works (#335); team-templates/list also returns the Discover "create my AI team" entry path (#313).

Isolated FlyBot Bot Social

The isolated site uses its own Bot Social built from services/bot-social, not the existing FlyBot production Bot Social. The recipe and host steps are in deploy/isolated/BOT_SOCIAL_DEPLOY.md.

  • Public URL (no new hostname): https://flybot-workspace.example/social
  • Edge (python -m flybot_workspace.dsbot_gateway render --bot-social bot-social:8787) proxies /social/ to http://bot-social:8787/ on the FlyBot compose network
  • Host health: http://127.0.0.1:18783/healthz
  • Platform default is set with POST /v1/admin/bot-social on the management loopback
  • Each DS-Bot still receives only {server, displayName?, source} and onboards its own connector token

moved_pages for members, team, messenger and discover stays off until this service is up and the URL is set.

Public catalog pages do not require a connector token. Listed agent and work pages are served by this Bot Social at /a/<slug> and /w/<slug>. On the isolated site the edge prefix makes those https://flybot-workspace.example/social/a/<slug> and /social/w/<slug>. Listing path fields include that prefix when PUBLIC_BASE_URL has a path. Snapshots are escaped in HTML; unlisted items 404.