Documentation
¶
Overview ¶
Package platforms is the catalog of chat platforms an agent runs on, shared by the assemblies that run agents (orb chat, the team agent image): one row per platform maps its environment, and its section of an agent file, onto the platform package's options. Removing a platform is deleting its package and its row.
Index ¶
Constants ¶
View Source
const AllowedSenders = "ORB_CHAT_ALLOWED_SENDERS"
AllowedSenders is orb chat's sender allowlist, shared by the platforms it routes (those with Open).
Variables ¶
View Source
var All = []Platform{ { Name: "buzz", Env: []string{"BUZZ_PRIVATE_KEY", "BUZZ_RELAY_URL", "BUZZ_AUTH_TAG", "BUZZ_API_TOKEN", "BUZZ_ACP_*", "RUST_LOG"}, About: "starts buzz-acp (or ORB_BUZZ_ACP), which holds the agent's Buzz identity and reaches it over ACP", Front: func(ctx context.Context, agent chat.Agent, env Env) error { return buzz.Front(ctx, agent, buzz.Options{ CLI: cmp.Or(env.Get("ORB_BUZZ_CLI"), "buzz"), Credentials: env.Matching("BUZZ_PRIVATE_KEY", "BUZZ_AUTH_TAG", "BUZZ_RELAY_URL"), Profile: chat.Identity{Name: env.Get("BUZZ_ACP_DISPLAY_NAME"), About: env.Get("ORB_BUZZ_ABOUT"), Avatar: env.Get("ORB_BUZZ_AVATAR")}, Socket: env.Get("ORB_ACP_SOCKET"), Harness: cmp.Or(env.Get("ORB_BUZZ_ACP"), "buzz-acp"), HarnessEnv: env.Matching("BUZZ_*", "RUST_LOG"), }) }, Configure: configureBuzz, Sidecar: func(relay []string) ([]string, []string) { return []string{"buzz-acp"}, buzz.HarnessSettings(relay) }, Alias: func(env Env, args []string, stdin io.Reader, stdout, stderr io.Writer) int { dir, _ := os.Getwd() return buzz.Shim(env.Get("ORB_BUZZ"), dir, args, stdin, stdout, stderr) }, }, { Name: "discord", Env: []string{"DISCORD_BOT_TOKEN"}, About: "Discord bot token", Open: func(env Env) (chat.Adapter, chat.Inbound, error) { token, err := required(env, "DISCORD_BOT_TOKEN") if err != nil { return nil, chat.Inbound{}, err } return polled(discord.New(discord.Options{Token: token})) }, }, { Name: "googlechat", Env: []string{"GOOGLE_CHAT_PROJECT_NUMBER", "GOOGLE_CHAT_CREDENTIALS_FILE"}, Open: func(env Env) (chat.Adapter, chat.Inbound, error) { credentials, err := os.ReadFile(env.Get("GOOGLE_CHAT_CREDENTIALS_FILE")) if err != nil { return nil, chat.Inbound{}, fmt.Errorf("read GOOGLE_CHAT_CREDENTIALS_FILE: %w", err) } return webhook(googlechat.New(googlechat.Options{ProjectNumber: env.Get("GOOGLE_CHAT_PROJECT_NUMBER"), CredentialsJSON: credentials})) }, }, { Name: "messenger", Env: []string{"MESSENGER_TOKEN", "MESSENGER_PAGE_ID", "MESSENGER_APP_SECRET", "MESSENGER_VERIFY_TOKEN"}, Open: func(env Env) (chat.Adapter, chat.Inbound, error) { return webhook(messenger.New(messenger.Options{ Token: env.Get("MESSENGER_TOKEN"), PageID: env.Get("MESSENGER_PAGE_ID"), AppSecret: env.Get("MESSENGER_APP_SECRET"), VerifyToken: env.Get("MESSENGER_VERIFY_TOKEN"), })) }, }, { Name: "slack", Env: []string{"SLACK_BOT_TOKEN", "SLACK_SIGNING_SECRET", "SLACK_BOT_USER_ID"}, Open: func(env Env) (chat.Adapter, chat.Inbound, error) { return webhook(slack.New(slack.Options{ Token: env.Get("SLACK_BOT_TOKEN"), SigningSecret: env.Get("SLACK_SIGNING_SECRET"), BotUserID: env.Get("SLACK_BOT_USER_ID"), })) }, }, { Name: "teams", Env: []string{"TEAMS_APP_ID", "TEAMS_APP_PASSWORD", "TEAMS_TENANT_ID"}, Open: func(env Env) (chat.Adapter, chat.Inbound, error) { return webhook(teams.New(teams.Options{ AppID: env.Get("TEAMS_APP_ID"), AppPassword: env.Get("TEAMS_APP_PASSWORD"), TenantID: env.Get("TEAMS_TENANT_ID"), })) }, }, { Name: "telegram", Env: []string{"TELEGRAM_BOT_TOKEN"}, About: "Telegram bot token", Open: func(env Env) (chat.Adapter, chat.Inbound, error) { token, err := required(env, "TELEGRAM_BOT_TOKEN") if err != nil { return nil, chat.Inbound{}, err } return polled(telegram.New(telegram.Options{Token: token})) }, }, { Name: "whatsapp", Env: []string{"WHATSAPP_TOKEN", "WHATSAPP_PHONE_NUMBER_ID", "WHATSAPP_APP_SECRET", "WHATSAPP_VERIFY_TOKEN"}, Open: func(env Env) (chat.Adapter, chat.Inbound, error) { return webhook(whatsapp.New(whatsapp.Options{ Token: env.Get("WHATSAPP_TOKEN"), PhoneNumberID: env.Get("WHATSAPP_PHONE_NUMBER_ID"), AppSecret: env.Get("WHATSAPP_APP_SECRET"), VerifyToken: env.Get("WHATSAPP_VERIFY_TOKEN"), })) }, }, }
All is the catalog.
Functions ¶
Types ¶
type Env ¶
type Env []string
Env is a process environment as KEY=VALUE entries; for a name set twice, the last entry wins.
type Platform ¶
type Platform struct {
Name string
// Env names the variables the platform reads (a name, or a prefix ending
// in *), and About says what it does, for help.
Env []string
About string
// Open builds the adapter of a platform orb chat routes, and how its
// messages come in.
Open func(env Env) (chat.Adapter, chat.Inbound, error)
// Front runs a platform that drives the agent's sessions itself.
Front func(ctx context.Context, agent chat.Agent, env Env) error
// Configure maps the platform's section of an agent file onto the
// environment it reads; nil takes no settings.
Configure func(agent chat.Identity, section map[string]any) (map[string]string, error)
// Sidecar is a process the platform needs beside the agent, run as another
// user: given relay, a command connecting its stdio to the agent's ACP
// socket, it returns the command and its settings. It also gets the
// variables Env names.
Sidecar func(relay []string) (command, settings []string)
// Alias is what Orb runs when started under the platform's name, through a
// link in the agent's shell.
Alias func(env Env, args []string, stdin io.Reader, stdout, stderr io.Writer) int
}
Platform is one row of the catalog.
Click to show internal directories.
Click to hide internal directories.