diff --git a/README.md b/README.md index d935b5b..fdfdfc0 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Add plugin with tokens to `~/.config/opencode/opencode.json`: | `SLACK_BOT_TOKEN` | — | Required. Bot token (`xoxb-...`) | | `SLACK_APP_TOKEN` | — | Required. App-level token (`xapp-...`) | | `DEFAULT_DIRECTORY` | serve directory | Default workspace for new sessions | +| `DEFAULT_AGENT` | — | Agent name to use for prompts in Slack threads. Reads plugin option first, then `SLACK_DEFAULT_AGENT` env var. Can be overridden per-message with `@` or per-thread with `!agent`; cleared by `!agent reset`. Useful when the global opencode default agent has an identity you don't want exposed in Slack (e.g., a chat-facing persona) | | `ALLOWED_USERS` | — | Comma-separated Slack user IDs or emails. If unset, everyone can use the bot | | `ATTACH_TIMEOUT_SEC` | 600 | Timeout (seconds) for `!attach bg_xxx` polling. Reads plugin option first, then env var fallback. Invalid/non-positive values fall back to 600 | diff --git a/dist/plugin.js b/dist/plugin.js index ea55873..23e8937 100644 --- a/dist/plugin.js +++ b/dist/plugin.js @@ -13566,6 +13566,8 @@ var pluginModule = { } pluginClient = input.client; defaultDirectory = expandTilde(options?.DEFAULT_DIRECTORY || process.env.SLACK_DEFAULT_DIRECTORY || input.directory); + agentOverride = options?.DEFAULT_AGENT || process.env.SLACK_DEFAULT_AGENT || null; + if (agentOverride) log(`default agent: ${agentOverride}`); attachBgTimeoutMs = resolveAttachTimeoutMs(options?.ATTACH_TIMEOUT_SEC); log(`attach timeout set to ${attachBgTimeoutMs}ms`); sessionsPath = join(input.directory, "slack-sessions.json"); diff --git a/src/plugin.ts b/src/plugin.ts index bda0677..71933cf 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1302,6 +1302,8 @@ const pluginModule: PluginModule = { pluginClient = input.client; defaultDirectory = expandTilde((options?.DEFAULT_DIRECTORY as string) || process.env.SLACK_DEFAULT_DIRECTORY || input.directory); + agentOverride = (options?.DEFAULT_AGENT as string) || process.env.SLACK_DEFAULT_AGENT || null; + if (agentOverride) log(`default agent: ${agentOverride}`); attachBgTimeoutMs = resolveAttachTimeoutMs(options?.ATTACH_TIMEOUT_SEC); log(`attach timeout set to ${attachBgTimeoutMs}ms`); sessionsPath = join(input.directory, "slack-sessions.json");