Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(channels): give Slack a first-class Web UI config form

shadowinlife2f138a77aba5
diff --git a/agent/src/channels/config_meta.py b/agent/src/channels/config_meta.py
index dc6c7dcd6..b4c1961e7 100644
--- a/agent/src/channels/config_meta.py
+++ b/agent/src/channels/config_meta.py
@@ -24,6 +24,7 @@ from __future__ import annotations
import logging
import re
from typing import Any
+from typing import NotRequired
from typing import TypedDict
from urllib.parse import urlsplit, urlunsplit
@@ -54,6 +55,11 @@ class FieldHint(TypedDict):
submission on it (verified against ``ChannelConfigPanel.tsx``).
help_key: i18n key for the frontend label, or ``None`` when the
channel has no hand-written label.
+ choices: Optional closed set of valid values. When present (and
+ non-empty) the frontend widget renders a ``<select>`` instead of a
+ free-text input; option labels render the raw enum strings. Absent
+ for every pre-existing hint — the contract extension is additive,
+ and only Slack's ``group_policy`` carries choices today.
"""
key: str
@@ -61,6 +67,7 @@ class FieldHint(TypedDict):
secret: bool
required: bool
help_key: str | None
+ choices: NotRequired[list[str]]
def _dingtalk_hints() -> list[FieldHint]:
@@ -240,11 +247,74 @@ def _websocket_hints() -> list[FieldHint]:
]
+# Drift pin: these literals mirror the policy strings the adapter branches on
+# in ``SlackChannel._should_respond_in_channel`` ("open"/"mention"/"allowlist")
+# and ``_is_allowed`` ("allowlist") in slack.py — there is no pydantic enum, so
+# this list plus its contract test is the only cross-reference. Route-side enum
+# enforcement (422 on a value outside ``choices``) is deferred to a later PR.
+_SLACK_GROUP_POLICY_CHOICES = ["open", "mention", "allowlist"]
+
+
+def _slack_hints() -> list[FieldHint]:
+ """Return the hand-written Slack field hints (``enabled`` excluded).
+
+ ``required`` decision: :meth:`SlackChannel.start` (slack.py) logs
+ "bot/app token not configured" and returns without connecting when either
+ ``bot_token`` or ``app_token`` is missing, so both credentials are marked
+ required — consistent with the DingTalk/Feishu credential precedent, and
+ safe because ``required`` is a decorative affordance (see
+ :class:`FieldHint`).
+
+ ``user_token_read_only`` carries an audited ``secret=False`` subtraction
+ from :data:`SECRET_KEY_RE`: the key name contains "token" but the value is
+ a plain behavior bool, so the fail-safe regex masked it and made it
+ uneditable — the same over-match class as websocket's ``token_ttl_s``
+ (module docstring).
+
+ ``mode`` and ``webhook_path`` are deliberately excluded: socket is the
+ only transport :meth:`SlackChannel.start` accepts (any other mode logs
+ "Unsupported mode" and returns), so they stay file-configured — the
+ Feishu precedent, where transport knobs are not exposed either.
+ Hand-written hints replace derived ones, so unlisted keys simply do not
+ render in the form while still traveling in GET ``values``.
+ """
+ specs = (
+ ("bot_token", "password", True, True),
+ ("app_token", "password", True, True),
+ ("user_token_read_only", "bool", False, False),
+ ("reply_in_thread", "bool", False, False),
+ ("react_emoji", "text", False, False),
+ ("done_emoji", "text", False, False),
+ ("include_thread_context", "bool", False, False),
+ ("thread_context_limit", "text", False, False),
+ ("allow_from", "list", False, False),
+ ("group_policy", "text", False, False),
+ ("group_allow_from", "list", False, False),
+ ("group_require_mention", "bool", False, False),
+ )
+ return [
+ {
+ "key": key,
+ "type": widget,
+ "secret": secret,
+ "required": required,
+ "help_key": f"{_HELP_KEY_PREFIX}.slack.{key}",
+ **(
+ {"choices": list(_SLACK_GROUP_POLICY_CHOICES)}
+ if key == "group_policy"
+ else {}
+ ),
+ }
+ for key, widget, secret, required in specs
+ ]
+
+
FIELD_HINTS: dict[str, list[FieldHint]] = {
"dingtalk": _dingtalk_hints(),
"email": _email_hints(),
"feishu": _feishu_hints(),
"qq": _qq_hints(),
+ "slack": _slack_hints(),
"websocket": _websocket_hints(),
}
diff --git a/agent/tests/test_channel_authoring_contract.py b/agent/tests/test_channel_authoring_contract.py
index 614d838e6..3e19755eb 100644
--- a/agent/tests/test_channel_authoring_contract.py
+++ b/agent/tests/test_channel_authoring_contract.py
@@ -19,6 +19,16 @@ import pytest
from src.channels.config_meta import channel_field_hints, split_values_secrets
from src.channels.registry import discover_channel_names, load_channel_class
+# Hand-written hints replace derived ones, so a channel may deliberately keep
+# scalar keys file-configured. Each exemption is an audited design decision,
+# not a gap: slack's transport knobs — SlackChannel.start() only accepts
+# mode == "socket" (any other mode logs and returns), so mode/webhook_path
+# have no meaningful form widget (feishu precedent: transport knobs are not
+# exposed). See _slack_hints() in config_meta.py.
+_FILE_CONFIGURED_SCALARS: dict[str, set[str]] = {
+ "slack": {"mode", "webhook_path"},
+}
+
@pytest.mark.parametrize("name", discover_channel_names())
def test_every_discovered_channel_satisfies_the_authoring_contract(name) -> None:
@@ -45,10 +55,11 @@ def test_every_discovered_channel_satisfies_the_authoring_contract(name) -> None
# The generic form renders from hints; every configurable scalar key
# must resolve one. Dict-valued fields are exempt by design: the form
# cannot edit them, so they stay file-configured (see _derive_hints).
+ # _FILE_CONFIGURED_SCALARS lists the audited per-channel exemptions.
hints = channel_field_hints(name)
configurable = {k for k, v in default_config.items() if k != "enabled" and not isinstance(v, dict)}
hint_keys = {h["key"] for h in hints}
- missing = configurable - hint_keys
+ missing = configurable - hint_keys - _FILE_CONFIGURED_SCALARS.get(name, set())
assert not missing, f"{name} has scalar config keys with no field hint: {sorted(missing)}"
# Test the serialized form consumed by the settings UI, rather than
diff --git a/agent/tests/test_channel_config_meta.py b/agent/tests/test_channel_config_meta.py
index 3e76b5db2..60c91a639 100644
--- a/agent/tests/test_channel_config_meta.py
+++ b/agent/tests/test_channel_config_meta.py
@@ -1,8 +1,9 @@
"""Tests for channel config field metadata and fail-safe secret masking.
-Covers the uiHints registry (hand-written for DingTalk, Email, Feishu, QQ
-and WebSocket, derived elsewhere) and the security acceptance criterion: no key matching
-:data:`SECRET_KEY_RE` ever survives in the non-secret ``values`` half.
+Covers the uiHints registry (hand-written for DingTalk, Email, Feishu, QQ,
+Slack and WebSocket, derived elsewhere) and the security acceptance criterion:
+no key matching :data:`SECRET_KEY_RE` ever survives in the non-secret
+``values`` half.
"""
from __future__ import annotations
@@ -397,6 +398,143 @@ def test_websocket_field_hints_contract() -> None:
assert hint["help_key"] == f"settings.channels.fields.websocket.{hint['key']}"
+# --- (a2b) hand-written Slack hints ------------------------------------------ #
+
+_SLACK_HINT_KEYS = (
+ "bot_token",
+ "app_token",
+ "user_token_read_only",
+ "reply_in_thread",
+ "react_emoji",
+ "done_emoji",
+ "include_thread_context",
+ "thread_context_limit",
+ "allow_from",
+ "group_policy",
+ "group_allow_from",
+ "group_require_mention",
+)
+
+
+def test_slack_field_hints_contract() -> None:
+ """Slack hints: declaration order, secrets, required set, help_key prefix."""
+ hints = channel_field_hints("slack")
+ keys = tuple(hint["key"] for hint in hints)
+ assert keys == _SLACK_HINT_KEYS
+ assert "enabled" not in keys
+ assert len(hints) == 12
+
+ by_key = {hint["key"]: hint for hint in hints}
+ assert {key for key, hint in by_key.items() if hint["secret"]} == {
+ "bot_token",
+ "app_token",
+ }
+ assert by_key["bot_token"]["type"] == "password"
+ assert by_key["app_token"]["type"] == "password"
+ # required mirrors SlackChannel.start(): it logs "bot/app token not
+ # configured" and returns without connecting when either is missing.
+ assert {key for key, hint in by_key.items() if hint["required"]} == {
+ "bot_token",
+ "app_token",
+ }
+ for hint in hints:
+ assert hint["help_key"] == f"settings.channels.fields.slack.{hint['key']}"
+
+
+def test_slack_transport_knobs_stay_file_configured() -> None:
+ """``mode``/``webhook_path`` are excluded: socket is the only transport."""
+ keys = {hint["key"] for hint in channel_field_hints("slack")}
+ assert "mode" not in keys
+ assert "webhook_path" not in keys
+ assert "dm" not in keys
+
+
+def test_slack_group_policy_choices_pin() -> None:
+ """group_policy carries the enum the adapter branches on; nothing else does.
+
+ Drift pin for the choices contract: the literals mirror
+ ``SlackChannel._should_respond_in_channel`` ("open"/"mention"/"allowlist")
+ and ``_is_allowed`` ("allowlist") in slack.py. Route-side enum enforcement
+ is deferred to a later PR.
+ """
+ by_key = {hint["key"]: hint for hint in channel_field_hints("slack")}
+ choices = by_key["group_policy"].get("choices")
+ assert choices == ["open", "mention", "allowlist"]
+ assert all(isinstance(choice, str) for choice in choices)
+
+ source = (_REPO_ROOT / "agent/src/channels/slack.py").read_text(encoding="utf-8")
+ for choice in choices:
+ assert f'group_policy == "{choice}"' in source, choice
+
+ # Additive contract: choices is absent for every other hinted field, in
+ # slack and in all pre-existing hint tables.
+ for name, hints in _config_meta.FIELD_HINTS.items():
+ for hint in hints:
+ if (name, hint["key"]) != ("slack", "group_policy"):
+ assert "choices" not in hint, f"{name}.{hint['key']}"
+
+
+def test_slack_hint_keys_exist_in_default_config() -> None:
+ """Every slack hint key is a real SlackConfig field (authoring contract)."""
+ config = _section_for("slack")
+ if config is None:
+ pytest.skip("slack adapter is not loadable in this environment")
+ for hint in channel_field_hints("slack"):
+ assert hint["key"] in config
+
+
+def test_slack_user_token_read_only_is_not_a_secret() -> None:
+ """The audited subtraction: a behavior bool the regex over-matches."""
+ assert SECRET_KEY_RE.search("user_token_read_only")
+ assert is_secret_key("slack", "user_token_read_only") is False
+ assert is_secret_key("slack", "bot_token") is True
+ assert is_secret_key("slack", "app_token") is True
+
+ values, secrets = split_values_secrets(
+ "slack", {"user_token_read_only": True, "bot_token": "xoxb-dummy-1234"}
+ )
+ assert values == {"user_token_read_only": True}
+ assert set(secrets) == {"bot_token"}
+
+
+def test_slack_split_keeps_dm_dict_and_behavior_values_untouched() -> None:
+ """Regression: F5 unmasks user_token_read_only but must NOT flatten ``dm``.
+
+ The raw ``dm`` dict still travels in ``values`` unchanged (nested ``dm.*``
+ graphical editing is a later feature); credentials mask; every behavior
+ field stays visible.
+ """
+ section = {
+ "enabled": True,
+ "mode": "socket",
+ "webhook_path": "/slack/events",
+ "bot_token": "xoxb-dummy-secret-1234",
+ "app_token": "xapp-dummy-secret-5678",
+ "user_token_read_only": True,
+ "reply_in_thread": True,
+ "react_emoji": "eyes",
+ "done_emoji": "white_check_mark",
+ "include_thread_context": True,
+ "thread_context_limit": 20,
+ "allow_from": ["U123"],
+ "group_policy": "mention",
+ "group_allow_from": [],
+ "group_require_mention": False,
+ "dm": {"enabled": True, "policy": "open", "allow_from": []},
+ }
+
+ values, secrets = split_values_secrets("slack", section)
+
+ assert set(secrets) == {"bot_token", "app_token"}
+ assert secrets["bot_token"] == {"set": True, "masked": "****1234"}
+ assert secrets["app_token"] == {"set": True, "masked": "****5678"}
+ assert values["user_token_read_only"] is True
+ assert values["dm"] == {"enabled": True, "policy": "open", "allow_from": []}
+ assert values["group_policy"] == "mention"
+ assert values["allow_from"] == ["U123"]
+ assert set(values) == set(section) - {"bot_token", "app_token"}
+
+
# --- (a3) hint-authoritative secret resolution ------------------------------- #
@@ -695,7 +833,10 @@ _EXPECTED_SECRET_KEYS: dict[str, set[str]] = {
"napcat": {"access_token"},
"qq": {"secret"},
"signal": set(),
- "slack": {"bot_token", "app_token", "user_token_read_only"},
+ # user_token_read_only is NOT here: the hand-written slack hint carries an
+ # audited secret=False subtraction (a behavior bool the regex over-matches),
+ # listed in _AUDITED_NON_SECRETS below.
+ "slack": {"bot_token", "app_token"},
"telegram": {"token", "webhook_secret_token"},
"wecom": {"secret"},
"weixin": {"token"},
@@ -780,6 +921,7 @@ _AUDITED_NON_SECRETS = {
("websocket", "token_issue_path"), # a URL path
("websocket", "token_ttl_s"), # an integer lifetime
("websocket", "websocket_requires_token"), # a boolean switch
+ ("slack", "user_token_read_only"), # a boolean switch
}
diff --git a/frontend/src/components/settings/ChannelConfigPanel.tsx b/frontend/src/components/settings/ChannelConfigPanel.tsx
index cfa5469f1..85304dc19 100644
--- a/frontend/src/components/settings/ChannelConfigPanel.tsx
+++ b/frontend/src/components/settings/ChannelConfigPanel.tsx
@@ -292,6 +292,18 @@ export function ChannelConfigPanel({
"settings.channels.fields.feishu.streaming": { label: t("settings.channels.fields.feishu.streaming.label"), help: t("settings.channels.fields.feishu.streaming.help") },
"settings.channels.fields.feishu.domain": { label: t("settings.channels.fields.feishu.domain.label"), help: t("settings.channels.fields.feishu.domain.help") },
"settings.channels.fields.feishu.topic_isolation": { label: t("settings.channels.fields.feishu.topic_isolation.label"), help: t("settings.channels.fields.feishu.topic_isolation.help") },
+ "settings.channels.fields.slack.bot_token": { label: t("settings.channels.fields.slack.bot_token.label"), help: t("settings.channels.fields.slack.bot_token.help") },
+ "settings.channels.fields.slack.app_token": { label: t("settings.channels.fields.slack.app_token.label"), help: t("settings.channels.fields.slack.app_token.help") },
+ "settings.channels.fields.slack.user_token_read_only": { label: t("settings.channels.fields.slack.user_token_read_only.label"), help: t("settings.channels.fields.slack.user_token_read_only.help") },
+ "settings.channels.fields.slack.reply_in_thread": { label: t("settings.channels.fields.slack.reply_in_thread.label"), help: t("settings.channels.fields.slack.reply_in_thread.help") },
+ "settings.channels.fields.slack.react_emoji": { label: t("settings.channels.fields.slack.react_emoji.label"), help: t("settings.channels.fields.slack.react_emoji.help") },
+ "settings.channels.fields.slack.done_emoji": { label: t("settings.channels.fields.slack.done_emoji.label"), help: t("settings.channels.fields.slack.done_emoji.help") },
+ "settings.channels.fields.slack.include_thread_context": { label: t("settings.channels.fields.slack.include_thread_context.label"), help: t("settings.channels.fields.slack.include_thread_context.help") },
+ "settings.channels.fields.slack.thread_context_limit": { label: t("settings.channels.fields.slack.thread_context_limit.label"), help: t("settings.channels.fields.slack.thread_context_limit.help") },
+ "settings.channels.fields.slack.allow_from": { label: t("settings.channels.fields.slack.allow_from.label"), help: t("settings.channels.fields.slack.allow_from.help") },
+ "settings.channels.fields.slack.group_policy": { label: t("settings.channels.fields.slack.group_policy.label"), help: t("settings.channels.fields.slack.group_policy.help") },
+ "settings.channels.fields.slack.group_allow_from": { label: t("settings.channels.fields.slack.group_allow_from.label"), help: t("settings.channels.fields.slack.group_allow_from.help") },
+ "settings.channels.fields.slack.group_require_mention": { label: t("settings.channels.fields.slack.group_require_mention.label"), help: t("settings.channels.fields.slack.group_require_mention.help") },
}),
[t],
);
@@ -541,6 +553,36 @@ export function ChannelConfigPanel({
);
}
+ if (field.choices?.length) {
+ const current = typeof values[field.key] === "string" ? (values[field.key] as string) : "";
+ return (
+ <div key={field.key} className="grid gap-2">
+ <label className={labelClass} htmlFor={inputId}>
+ {text.label}
+ {field.required ? (
+ <span className="ms-1 text-destructive" aria-hidden="true">*</span>
+ ) : null}
+ </label>
+ <select
+ id={inputId}
+ value={current}
+ onChange={(event) => setValue(field.key, event.target.value)}
+ className={fieldClass}
+ disabled={formDisabled}
+ >
+ {/* A stored value outside the enum stays visible instead of silently snapping to an option. */}
+ {current && !field.choices.includes(current) ? (
+ <option value={current}>{current}</option>
+ ) : null}
+ {field.choices.map((choice) => (
+ <option key={choice} value={choice}>{choice}</option>
+ ))}
+ </select>
+ {text.help ? <span className={hintClass}>{text.help}</span> : null}
+ </div>
+ );
+ }
+
const secret = entry.secrets[field.key];
const placeholder = field.secret
? secret?.set
diff --git a/frontend/src/components/settings/__tests__/ChannelSettings.test.tsx b/frontend/src/components/settings/__tests__/ChannelSettings.test.tsx
index e8b40bd61..68a929467 100644
--- a/frontend/src/components/settings/__tests__/ChannelSettings.test.tsx
+++ b/frontend/src/components/settings/__tests__/ChannelSettings.test.tsx
@@ -290,6 +290,50 @@ function feishuEntry(overrides: Record<string, unknown> = {}) {
};
}
+function slackEntry(overrides: Record<string, unknown> = {}) {
+ return {
+ display_name: "Slack",
+ available: true,
+ loaded: true,
+ install_hint: "",
+ error: "",
+ supports_test: false,
+ sdk_available: true,
+ fields: [
+ { key: "bot_token", type: "password", secret: true, required: true, help_key: "settings.channels.fields.slack.bot_token" },
+ { key: "app_token", type: "password", secret: true, required: true, help_key: "settings.channels.fields.slack.app_token" },
+ { key: "user_token_read_only", type: "bool", secret: false, required: false, help_key: "settings.channels.fields.slack.user_token_read_only" },
+ { key: "reply_in_thread", type: "bool", secret: false, required: false, help_key: "settings.channels.fields.slack.reply_in_thread" },
+ { key: "react_emoji", type: "text", secret: false, required: false, help_key: "settings.channels.fields.slack.react_emoji" },
+ { key: "done_emoji", type: "text", secret: false, required: false, help_key: "settings.channels.fields.slack.done_emoji" },
+ { key: "include_thread_context", type: "bool", secret: false, required: false, help_key: "settings.channels.fields.slack.include_thread_context" },
+ { key: "thread_context_limit", type: "text", secret: false, required: false, help_key: "settings.channels.fields.slack.thread_context_limit" },
+ { key: "allow_from", type: "list", secret: false, required: false, help_key: "settings.channels.fields.slack.allow_from" },
+ { key: "group_policy", type: "text", secret: false, required: false, help_key: "settings.channels.fields.slack.group_policy", choices: ["open", "mention", "allowlist"] },
+ { key: "group_allow_from", type: "list", secret: false, required: false, help_key: "settings.channels.fields.slack.group_allow_from" },
+ { key: "group_require_mention", type: "bool", secret: false, required: false, help_key: "settings.channels.fields.slack.group_require_mention" },
+ ],
+ values: {
+ enabled: false,
+ user_token_read_only: true,
+ reply_in_thread: true,
+ react_emoji: "eyes",
+ done_emoji: "white_check_mark",
+ include_thread_context: true,
+ thread_context_limit: 20,
+ allow_from: [],
+ group_policy: "mention",
+ group_allow_from: [],
+ group_require_mention: false,
+ },
+ secrets: {
+ bot_token: { set: true, masked: "****b123" },
+ app_token: { set: true, masked: "****a456" },
+ },
+ ...overrides,
+ };
+}
+
function channelsConfig(overrides: Record<string, unknown> = {}) {
return {
config_path: "~/.vibe-trading/agent.json",
@@ -346,6 +390,17 @@ async function renderWebsocketExpanded() {
expect(await screen.findByDisplayValue("127.0.0.1")).toBeInTheDocument();
}
+/** Render the card with the Slack config panel expanded. */
+async function renderSlackExpanded() {
+ apiMock.getChannelsConfig.mockResolvedValue(channelsConfig({
+ channels: { dingtalk: dingtalkEntry(), slack: slackEntry() },
+ }));
+ render(<ChannelSettings />);
+ await screen.findByText("IM Channels");
+ fireEvent.click(await screen.findByRole("button", { name: "Configure Slack" }));
+ expect(await screen.findByDisplayValue("eyes")).toBeInTheDocument();
+}
+
/** Render the card with the three guided IM channels available. */
function guidedChannelsConfig() {
return channelsConfig({
@@ -849,6 +904,81 @@ describe("ChannelSettings config panel", () => {
expect(document.body.textContent).not.toContain("leaked-verification-token");
});
+ it("renders every Slack field from the backend help_keys with localized labels", async () => {
+ await renderSlackExpanded();
+
+ expect(screen.getByText("Bot token (xoxb-)")).toBeInTheDocument();
+ expect(screen.getByText("App token (xapp-)")).toBeInTheDocument();
+ expect(screen.getByText("User token read-only")).toBeInTheDocument();
+ expect(screen.getByText("Reply in thread")).toBeInTheDocument();
+ expect(screen.getByText("Working emoji")).toBeInTheDocument();
+ expect(screen.getByText("Done emoji")).toBeInTheDocument();
+ expect(screen.getByText("Include thread context")).toBeInTheDocument();
+ expect(screen.getByText("Thread context limit")).toBeInTheDocument();
+ expect(screen.getByText("Allowed senders")).toBeInTheDocument();
+ expect(screen.getByText("Group policy")).toBeInTheDocument();
+ expect(screen.getByText("Allowed channels")).toBeInTheDocument();
+ expect(screen.getByText("Require mention in allowed channels")).toBeInTheDocument();
+ // The audited secret=False subtraction keeps the behavior bool editable.
+ expect(screen.getByRole("checkbox", { name: "User token read-only" })).toBeChecked();
+ // Both credentials keep the generic masked placeholder and password type.
+ for (const masked of ["****b123", "****a456"]) {
+ const secretInput = screen.getByPlaceholderText(`Keep current (${masked})`);
+ expect(secretInput).toHaveAttribute("type", "password");
+ expect(secretInput).toHaveValue("");
+ }
+ });
+
+ it("renders a choices field as a select and keeps choice-less fields as inputs", async () => {
+ await renderSlackExpanded();
+
+ const select = screen.getByLabelText("Group policy");
+ expect(select.tagName).toBe("SELECT");
+ expect(Array.from(select.querySelectorAll("option")).map((option) => option.value)).toEqual([
+ "open",
+ "mention",
+ "allowlist",
+ ]);
+ expect(select).toHaveValue("mention");
+
+ // A field without choices keeps its existing text widget.
+ const emojiInput = screen.getByLabelText("Working emoji");
+ expect(emojiInput.tagName).toBe("INPUT");
+ expect(emojiInput).toHaveValue("eyes");
+
+ // The select flows through the same form-state path as text inputs.
+ fireEvent.change(select, { target: { value: "allowlist" } });
+ expect(select).toHaveValue("allowlist");
+ fireEvent.click(screen.getByRole("button", { name: "Save configuration" }));
+
+ await waitFor(() => expect(apiMock.putChannelConfig).toHaveBeenCalledTimes(1));
+ expect(apiMock.putChannelConfig).toHaveBeenLastCalledWith("slack", {
+ config: expect.objectContaining({ group_policy: "allowlist" }),
+ });
+ });
+
+ it("keeps a stored group_policy value outside the choices visible", async () => {
+ apiMock.getChannelsConfig.mockResolvedValue(channelsConfig({
+ channels: {
+ slack: slackEntry({
+ values: { ...slackEntry().values, group_policy: "legacy" },
+ }),
+ },
+ }));
+ render(<ChannelSettings />);
+ await screen.findByText("IM Channels");
+ fireEvent.click(await screen.findByRole("button", { name: "Configure Slack" }));
+
+ const select = await screen.findByLabelText("Group policy");
+ expect(select).toHaveValue("legacy");
+ expect(Array.from(select.querySelectorAll("option")).map((option) => option.value)).toEqual([
+ "legacy",
+ "open",
+ "mention",
+ "allowlist",
+ ]);
+ });
+
it("renders no setup guide for a channel without a guide definition", async () => {
apiMock.getChannelsConfig.mockResolvedValue(channelsConfig({
channels: {
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index 2cb5d18ed..b775f66d5 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -858,6 +858,56 @@
"label": "جلسات مستقلة لكل موضوع",
"help": "تخصيص جلسة وكيل مستقلة لكل موضوع في المجموعة بدل جلسة واحدة مشتركة."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "رمز البوت (xoxb-)",
+ "help": "رمز OAuth لبوت Slack (يبدأ بـ xoxb-). يُحفظ في الخادم ولا يُعاد إلى المتصفح أبدًا."
+ },
+ "app_token": {
+ "label": "رمز التطبيق (xapp-)",
+ "help": "رمز Slack على مستوى التطبيق (يبدأ بـ xapp-) مع نطاق connections:write، وهو مطلوب لوضع Socket Mode. يُحفظ في الخادم ولا يُعاد إلى المتصفح أبدًا."
+ },
+ "user_token_read_only": {
+ "label": "رمز المستخدم للقراءة فقط",
+ "help": "خيار سلوك وليس بيانات اعتماد: يُبقي الوصول برمز المستخدم للقراءة فقط."
+ },
+ "reply_in_thread": {
+ "label": "الرد ضمن سلسلة",
+ "help": "الرد ضمن سلسلة (thread) تحت الرسالة الأصلية بدلًا من النشر مباشرة في القناة."
+ },
+ "react_emoji": {
+ "label": "تفاعل حالة العمل",
+ "help": "التفاعل الذي يوضع على الرسالة الواردة أثناء عمل الوكيل (الافتراضي eyes)."
+ },
+ "done_emoji": {
+ "label": "تفاعل الاكتمال",
+ "help": "التفاعل الذي يوضع عند اكتمال المهمة (الافتراضي white_check_mark). اتركه فارغًا للتعطيل."
+ },
+ "include_thread_context": {
+ "label": "تضمين سياق السلسلة",
+ "help": "إرفاق الردود السابقة في السلسلة كسياق عند استدعاء البوت إليها لأول مرة."
+ },
+ "thread_context_limit": {
+ "label": "حد سياق السلسلة",
+ "help": "الحد الأقصى لعدد رسائل السلسلة المضمّنة كسياق (الافتراضي 20)."
+ },
+ "allow_from": {
+ "label": "المُرسلون المسموح بهم",
+ "help": "قائمة سماح بمعرّفات مستخدمي Slack المسموح لهم بمحادثة الوكيل. يخضع الوصول في الرسائل المباشرة والقنوات أيضًا لسياسة الرسائل المباشرة وسياسة المجموعات."
+ },
+ "group_policy": {
+ "label": "سياسة المجموعات",
+ "help": "\"mention\" للرد فقط عند الإشارة إلى البوت في القناة، و\"open\" للرد على كل رسائل القناة، و\"allowlist\" للرد فقط في القنوات المدرجة أدناه."
+ },
+ "group_allow_from": {
+ "label": "القنوات المسموح بها",
+ "help": "معرّفات القنوات التي يرد فيها البوت عندما تكون سياسة المجموعات \"allowlist\"."
+ },
+ "group_require_mention": {
+ "label": "اشتراط الإشارة في القنوات المسموح بها",
+ "help": "مع سياسة \"allowlist\"، اشتراط الإشارة إلى البوت أيضًا قبل الرد في القنوات المعتمدة. لا تأثير لها مع \"mention\" أو \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json
index 1f8024ad3..343e9c1d0 100644
--- a/frontend/src/i18n/locales/de.json
+++ b/frontend/src/i18n/locales/de.json
@@ -863,6 +863,56 @@
"label": "Sitzungen pro Thread",
"help": "Jedem Gruppen-Thread eine eigene Agent-Sitzung geben, statt einer gemeinsamen pro Gruppe."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Bot-Token (xoxb-)",
+ "help": "Das Slack-Bot-User-OAuth-Token (beginnt mit xoxb-). Wird serverseitig gespeichert und nie an den Browser zurückgegeben."
+ },
+ "app_token": {
+ "label": "App-Token (xapp-)",
+ "help": "Das Slack-App-Level-Token (beginnt mit xapp-) mit dem connections:write-Scope, erforderlich für den Socket-Modus. Wird serverseitig gespeichert und nie an den Browser zurückgegeben."
+ },
+ "user_token_read_only": {
+ "label": "User-Token schreibgeschützt",
+ "help": "Verhaltensschalter, keine Zugangsdaten: hält den Zugriff per User-Token schreibgeschützt."
+ },
+ "reply_in_thread": {
+ "label": "Im Thread antworten",
+ "help": "In einem Thread unter der Originalnachricht antworten, statt direkt in den Channel zu schreiben."
+ },
+ "react_emoji": {
+ "label": "Arbeits-Emoji",
+ "help": "Emoji, mit dem auf eine eingehende Nachricht reagiert wird, während der Agent arbeitet (Standard: eyes)."
+ },
+ "done_emoji": {
+ "label": "Fertig-Emoji",
+ "help": "Emoji, mit dem reagiert wird, wenn die Aufgabe abgeschlossen ist (Standard: white_check_mark). Leer lassen für keins."
+ },
+ "include_thread_context": {
+ "label": "Thread-Kontext einbeziehen",
+ "help": "Frühere Antworten aus dem Thread als Kontext voranstellen, wenn der Bot zum ersten Mal in den Thread geholt wird."
+ },
+ "thread_context_limit": {
+ "label": "Thread-Kontextlimit",
+ "help": "Maximale Anzahl von Thread-Nachrichten, die als Kontext einbezogen werden (Standard: 20)."
+ },
+ "allow_from": {
+ "label": "Erlaubte Absender",
+ "help": "Allowlist von Slack-User-IDs, die mit dem Agenten sprechen dürfen. Der Zugriff auf DMs und Channels wird zusätzlich durch die DM-Richtlinie und die Gruppenrichtlinie gesteuert."
+ },
+ "group_policy": {
+ "label": "Gruppenrichtlinie",
+ "help": "\"mention\" antwortet nur bei @-Erwähnung in einem Channel, \"open\" antwortet auf alle Channel-Nachrichten, \"allowlist\" antwortet nur in den unten aufgeführten Channels."
+ },
+ "group_allow_from": {
+ "label": "Erlaubte Channels",
+ "help": "Channel-IDs, in denen der Bot antwortet, wenn die Gruppenrichtlinie \"allowlist\" ist."
+ },
+ "group_require_mention": {
+ "label": "Erwähnung in erlaubten Channels erforderlich",
+ "help": "Mit der Richtlinie \"allowlist\" zusätzlich eine @-Erwähnung verlangen, bevor in zugelassenen Channels geantwortet wird. Ohne Wirkung für \"mention\" oder \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index dced6233b..b9b1e847b 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -863,6 +863,56 @@
"label": "Per-topic sessions",
"help": "Give each group topic its own agent session instead of sharing one session per group."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Bot token (xoxb-)",
+ "help": "The Slack bot user OAuth token (starts with xoxb-). Stored server-side and never sent back to the browser."
+ },
+ "app_token": {
+ "label": "App token (xapp-)",
+ "help": "The Slack app-level token (starts with xapp-) with the connections:write scope, required for Socket Mode. Stored server-side and never sent back to the browser."
+ },
+ "user_token_read_only": {
+ "label": "User token read-only",
+ "help": "A behavior flag, not a credential: keeps user-token access read-only."
+ },
+ "reply_in_thread": {
+ "label": "Reply in thread",
+ "help": "Reply in a thread under the original message instead of posting directly to the channel."
+ },
+ "react_emoji": {
+ "label": "Working emoji",
+ "help": "Emoji reacted on an incoming message while the agent works (default eyes)."
+ },
+ "done_emoji": {
+ "label": "Done emoji",
+ "help": "Emoji reacted when the task completes (default white_check_mark). Leave empty for none."
+ },
+ "include_thread_context": {
+ "label": "Include thread context",
+ "help": "Prepend earlier replies from the thread as context the first time the bot is pulled into it."
+ },
+ "thread_context_limit": {
+ "label": "Thread context limit",
+ "help": "Maximum number of thread messages included as context (default 20)."
+ },
+ "allow_from": {
+ "label": "Allowed senders",
+ "help": "Allowlist of Slack user IDs permitted to talk to the agent. DM and channel access are further controlled by the DM policy and the group policy."
+ },
+ "group_policy": {
+ "label": "Group policy",
+ "help": "\"mention\" replies only when the bot is @mentioned in a channel, \"open\" replies to all channel messages, \"allowlist\" replies only in the channels listed below."
+ },
+ "group_allow_from": {
+ "label": "Allowed channels",
+ "help": "Channel IDs the bot responds in when the group policy is \"allowlist\"."
+ },
+ "group_require_mention": {
+ "label": "Require mention in allowed channels",
+ "help": "With the \"allowlist\" policy, also require an @mention before replying in approved channels. No effect for \"mention\" or \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index 90b402bed..675500b9f 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -863,6 +863,56 @@
"label": "Sesiones por tema",
"help": "Asigna a cada tema del grupo su propia sesión del agente."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Token del bot (xoxb-)",
+ "help": "El token OAuth de usuario bot de Slack (empieza por xoxb-). Se guarda en el servidor y nunca se devuelve al navegador."
+ },
+ "app_token": {
+ "label": "Token de la app (xapp-)",
+ "help": "El token de nivel de aplicación de Slack (empieza por xapp-) con el ámbito connections:write, necesario para Socket Mode. Se guarda en el servidor y nunca se devuelve al navegador."
+ },
+ "user_token_read_only": {
+ "label": "Token de usuario en solo lectura",
+ "help": "Indicador de comportamiento, no una credencial: mantiene el acceso con token de usuario en solo lectura."
+ },
+ "reply_in_thread": {
+ "label": "Responder en hilo",
+ "help": "Responder en un hilo bajo el mensaje original en lugar de publicar directamente en el canal."
+ },
+ "react_emoji": {
+ "label": "Emoji de procesamiento",
+ "help": "Emoji con el que se reacciona a un mensaje entrante mientras el agente trabaja (por defecto eyes)."
+ },
+ "done_emoji": {
+ "label": "Emoji de finalización",
+ "help": "Emoji con el que se reacciona cuando la tarea termina (por defecto white_check_mark). Déjalo vacío para no usar ninguno."
+ },
+ "include_thread_context": {
+ "label": "Incluir contexto del hilo",
+ "help": "Anteponer las respuestas anteriores del hilo como contexto la primera vez que el bot es incorporado a él."
+ },
+ "thread_context_limit": {
+ "label": "Límite de contexto del hilo",
+ "help": "Número máximo de mensajes del hilo incluidos como contexto (por defecto 20)."
+ },
+ "allow_from": {
+ "label": "Remitentes permitidos",
+ "help": "Lista blanca de IDs de usuario de Slack autorizados a hablar con el agente. El acceso a MD y canales también está controlado por la política de MD y la política de grupos."
+ },
+ "group_policy": {
+ "label": "Política de grupos",
+ "help": "\"mention\": responde solo cuando se menciona al bot en un canal; \"open\": responde a todos los mensajes del canal; \"allowlist\": responde solo en los canales enumerados abajo."
+ },
+ "group_allow_from": {
+ "label": "Canales permitidos",
+ "help": "IDs de canales en los que el bot responde cuando la política de grupos es \"allowlist\"."
+ },
+ "group_require_mention": {
+ "label": "Requerir mención en canales permitidos",
+ "help": "Con la política \"allowlist\", exigir además una @mención antes de responder en los canales aprobados. Sin efecto para \"mention\" u \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/id.json b/frontend/src/i18n/locales/id.json
index bd9594e5a..fb40390da 100644
--- a/frontend/src/i18n/locales/id.json
+++ b/frontend/src/i18n/locales/id.json
@@ -863,6 +863,56 @@
"label": "Sesi per topik",
"help": "Beri setiap topik grup sesi agennya sendiri, bukan satu sesi untuk seluruh grup."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Token bot (xoxb-)",
+ "help": "Token OAuth pengguna bot Slack (diawali dengan xoxb-). Disimpan di sisi server dan tidak pernah dikirim kembali ke peramban."
+ },
+ "app_token": {
+ "label": "Token aplikasi (xapp-)",
+ "help": "Token tingkat aplikasi Slack (diawali dengan xapp-) dengan cakupan connections:write, diperlukan untuk Socket Mode. Disimpan di sisi server dan tidak pernah dikirim kembali ke peramban."
+ },
+ "user_token_read_only": {
+ "label": "Token pengguna hanya-baca",
+ "help": "Tanda perilaku, bukan kredensial: menjaga akses token pengguna tetap hanya-baca."
+ },
+ "reply_in_thread": {
+ "label": "Balas di utas",
+ "help": "Membalas di utas (thread) di bawah pesan asli alih-alih mengirim langsung ke kanal."
+ },
+ "react_emoji": {
+ "label": "Emoji saat bekerja",
+ "help": "Emoji yang direaksikan pada pesan masuk saat agen bekerja (default eyes)."
+ },
+ "done_emoji": {
+ "label": "Emoji selesai",
+ "help": "Emoji yang direaksikan saat tugas selesai (default white_check_mark). Biarkan kosong untuk tidak memakai apa pun."
+ },
+ "include_thread_context": {
+ "label": "Sertakan konteks utas",
+ "help": "Menyertakan balasan sebelumnya dari utas sebagai konteks saat bot pertama kali ditarik ke dalamnya."
+ },
+ "thread_context_limit": {
+ "label": "Batas konteks utas",
+ "help": "Jumlah maksimum pesan utas yang disertakan sebagai konteks (default 20)."
+ },
+ "allow_from": {
+ "label": "Pengirim yang diizinkan",
+ "help": "Daftar putih ID pengguna Slack yang boleh berbicara dengan agen. Akses DM dan kanal juga dikendalikan oleh kebijakan DM dan kebijakan grup."
+ },
+ "group_policy": {
+ "label": "Kebijakan grup",
+ "help": "\"mention\" hanya membalas saat bot disebut (@mention) di kanal, \"open\" membalas semua pesan kanal, \"allowlist\" hanya membalas di kanal yang tercantum di bawah."
+ },
+ "group_allow_from": {
+ "label": "Kanal yang diizinkan",
+ "help": "ID kanal tempat bot merespons saat kebijakan grup adalah \"allowlist\"."
+ },
+ "group_require_mention": {
+ "label": "Wajib sebut di kanal yang diizinkan",
+ "help": "Dengan kebijakan \"allowlist\", juga mewajibkan @mention sebelum membalas di kanal yang disetujui. Tidak berpengaruh pada \"mention\" atau \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index c2f626061..847d00cac 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -858,6 +858,56 @@
"label": "トピック別セッション",
"help": "グループの各トピックに専用のエージェントセッションを割り当てます。"
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Botトークン(xoxb-)",
+ "help": "Slack ボットユーザーの OAuth トークン(xoxb- で始まります)。サーバー側に保存され、ブラウザに返されることはありません。"
+ },
+ "app_token": {
+ "label": "Appトークン(xapp-)",
+ "help": "connections:write スコープを持つ Slack アプリレベルトークン(xapp- で始まります)。Socket Mode に必要です。サーバー側に保存され、ブラウザに返されることはありません。"
+ },
+ "user_token_read_only": {
+ "label": "ユーザートークン読み取り専用",
+ "help": "動作フラグ(認証情報ではありません):ユーザートークンのアクセスを読み取り専用に保ちます。"
+ },
+ "reply_in_thread": {
+ "label": "スレッドで返信",
+ "help": "チャンネルに直接投稿する代わりに、元のメッセージのスレッドで返信します。"
+ },
+ "react_emoji": {
+ "label": "作業中リアクション",
+ "help": "エージェントの作業中、受信メッセージに付けるリアクション(デフォルトは eyes)。"
+ },
+ "done_emoji": {
+ "label": "完了リアクション",
+ "help": "タスク完了時に付けるリアクション(デフォルトは white_check_mark)。空欄で無し。"
+ },
+ "include_thread_context": {
+ "label": "スレッドのコンテキストを含める",
+ "help": "ボットがスレッドに初めて呼び出されたとき、それまでのスレッドの返信をコンテキストとして先頭に付けます。"
+ },
+ "thread_context_limit": {
+ "label": "スレッドコンテキストの上限",
+ "help": "コンテキストとして含めるスレッドメッセージの最大数(デフォルト 20)。"
+ },
+ "allow_from": {
+ "label": "許可する送信者",
+ "help": "エージェントと会話できる Slack ユーザー ID の許可リスト。DM とチャンネルのアクセスは DM ポリシーとグループポリシーでも制御されます。"
+ },
+ "group_policy": {
+ "label": "グループポリシー",
+ "help": "「mention」はチャンネルで @ メンションされたときのみ返信し、「open」はすべてのチャンネルメッセージに返信し、「allowlist」は下に列挙したチャンネルでのみ返信します。"
+ },
+ "group_allow_from": {
+ "label": "許可するチャンネル",
+ "help": "グループポリシーが「allowlist」の場合にボットが応答するチャンネル ID。"
+ },
+ "group_require_mention": {
+ "label": "許可チャンネルでメンションを要求",
+ "help": "「allowlist」ポリシーで、承認済みチャンネルでも @ メンションされたときのみ返信します。「mention」と「open」には影響しません。"
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index 07405f9ba..fa5b55aac 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -858,6 +858,56 @@
"label": "토픽별 세션",
"help": "그룹의 각 토픽에 별도 에이전트 세션을 할당합니다."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "봇 토큰(xoxb-)",
+ "help": "Slack 봇 사용자 OAuth 토큰(xoxb- 로 시작). 서버 측에만 저장되며 브라우저로는 절대 반환되지 않습니다."
+ },
+ "app_token": {
+ "label": "앱 토큰(xapp-)",
+ "help": "connections:write 범위를 가진 Slack 앱 수준 토큰(xapp- 로 시작). Socket Mode에 필요합니다. 서버 측에만 저장되며 브라우저로는 절대 반환되지 않습니다."
+ },
+ "user_token_read_only": {
+ "label": "사용자 토큰 읽기 전용",
+ "help": "동작 플래그(자격 증명이 아님): 사용자 토큰 접근을 읽기 전용으로 유지합니다."
+ },
+ "reply_in_thread": {
+ "label": "스레드로 답변",
+ "help": "채널에 직접 게시하는 대신 원본 메시지 아래의 스레드로 답변합니다."
+ },
+ "react_emoji": {
+ "label": "작업 중 이모지",
+ "help": "에이전트가 작업하는 동안 수신 메시지에 추가할 이모지(기본값 eyes)."
+ },
+ "done_emoji": {
+ "label": "완료 이모지",
+ "help": "작업 완료 시 추가할 이모지(기본값 white_check_mark). 비워 두면 사용하지 않습니다."
+ },
+ "include_thread_context": {
+ "label": "스레드 컨텍스트 포함",
+ "help": "봇이 스레드에 처음 호출될 때 이전 스레드 답변을 컨텍스트로 앞에 첨부합니다."
+ },
+ "thread_context_limit": {
+ "label": "스레드 컨텍스트 제한",
+ "help": "컨텍스트로 포함할 스레드 메시지 수의 최대값(기본값 20)."
+ },
+ "allow_from": {
+ "label": "허용된 발신자",
+ "help": "에이전트와 대화할 수 있는 Slack 사용자 ID 허용 목록. DM 및 채널 접근은 DM 정책과 그룹 정책으로도 제어됩니다."
+ },
+ "group_policy": {
+ "label": "그룹 정책",
+ "help": "\"mention\"은 채널에서 @ 멘션될 때만 답변하고, \"open\"은 모든 채널 메시지에 답변하며, \"allowlist\"는 아래에 나열된 채널에서만 답변합니다."
+ },
+ "group_allow_from": {
+ "label": "허용된 채널",
+ "help": "그룹 정책이 \"allowlist\"일 때 봇이 응답할 채널 ID."
+ },
+ "group_require_mention": {
+ "label": "허용 채널에서 멘션 요구",
+ "help": "\"allowlist\" 정책에서 승인된 채널에서도 @ 멘션되어야 답변합니다. \"mention\"과 \"open\" 정책에는 영향이 없습니다."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/pt-BR.json b/frontend/src/i18n/locales/pt-BR.json
index bcd07f479..eaf101b46 100644
--- a/frontend/src/i18n/locales/pt-BR.json
+++ b/frontend/src/i18n/locales/pt-BR.json
@@ -863,6 +863,56 @@
"label": "Sessões por tópico",
"help": "Dar a cada tópico do grupo sua própria sessão do agente."
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Token do bot (xoxb-)",
+ "help": "O token OAuth do usuário bot do Slack (começa com xoxb-). Armazenado no servidor e nunca devolvido ao navegador."
+ },
+ "app_token": {
+ "label": "Token do app (xapp-)",
+ "help": "O token em nível de aplicativo do Slack (começa com xapp-) com o escopo connections:write, necessário para o Socket Mode. Armazenado no servidor e nunca devolvido ao navegador."
+ },
+ "user_token_read_only": {
+ "label": "Token do usuário somente leitura",
+ "help": "Sinalizador de comportamento, não uma credencial: mantém o acesso por token do usuário como somente leitura."
+ },
+ "reply_in_thread": {
+ "label": "Responder na thread",
+ "help": "Responder em uma thread sob a mensagem original em vez de publicar diretamente no canal."
+ },
+ "react_emoji": {
+ "label": "Emoji de processamento",
+ "help": "Emoji adicionado como reação a uma mensagem recebida enquanto o agente trabalha (padrão eyes)."
+ },
+ "done_emoji": {
+ "label": "Emoji de conclusão",
+ "help": "Emoji adicionado como reação quando a tarefa é concluída (padrão white_check_mark). Deixe vazio para nenhum."
+ },
+ "include_thread_context": {
+ "label": "Incluir contexto da thread",
+ "help": "Anexar as respostas anteriores da thread como contexto na primeira vez que o bot é incluído nela."
+ },
+ "thread_context_limit": {
+ "label": "Limite de contexto da thread",
+ "help": "Número máximo de mensagens da thread incluídas como contexto (padrão 20)."
+ },
+ "allow_from": {
+ "label": "Remetentes permitidos",
+ "help": "Lista de permissão com IDs de usuário do Slack autorizados a falar com o agente. O acesso a DMs e canais também é controlado pela política de DM e pela política de grupos."
+ },
+ "group_policy": {
+ "label": "Política de grupos",
+ "help": "\"mention\" responde apenas quando o bot é mencionado em um canal, \"open\" responde a todas as mensagens do canal, \"allowlist\" responde apenas nos canais listados abaixo."
+ },
+ "group_allow_from": {
+ "label": "Canais permitidos",
+ "help": "IDs dos canais nos quais o bot responde quando a política de grupos é \"allowlist\"."
+ },
+ "group_require_mention": {
+ "label": "Exigir menção nos canais permitidos",
+ "help": "Com a política \"allowlist\", exigir também uma @menção antes de responder nos canais aprovados. Sem efeito para \"mention\" ou \"open\"."
+ }
}
},
"guides": {
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index 2f09f9c10..90be9d714 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -858,6 +858,56 @@
"label": "按话题隔离会话",
"help": "群聊中每个话题使用独立的智能体会话,而不是整群共享一个会话。"
}
+ },
+ "slack": {
+ "bot_token": {
+ "label": "Bot 令牌(xoxb-)",
+ "help": "Slack 机器人用户的 OAuth 令牌(以 xoxb- 开头)。保存在服务端,绝不会回传到浏览器。"
+ },
+ "app_token": {
+ "label": "App 令牌(xapp-)",
+ "help": "Slack 应用级令牌(以 xapp- 开头),需具备 connections:write 权限,Socket Mode 必需。保存在服务端,绝不会回传到浏览器。"
+ },
+ "user_token_read_only": {
+ "label": "用户令牌只读",
+ "help": "行为开关,不是凭据:保持用户令牌只读。"
+ },
+ "reply_in_thread": {
+ "label": "在话题中回复",
+ "help": "在原消息下的话题(thread)中回复,而不是直接发送到频道。"
+ },
+ "react_emoji": {
+ "label": "处理中表情",
+ "help": "智能体处理消息期间为该消息添加的表情回应(默认 eyes)。"
+ },
+ "done_emoji": {
+ "label": "完成表情",
+ "help": "任务完成时添加的表情回应(默认 white_check_mark)。留空表示不添加。"
+ },
+ "include_thread_context": {
+ "label": "包含话题上下文",
+ "help": "机器人首次被拉入话题时,将话题中较早的回复作为上下文一并附上。"
+ },
+ "thread_context_limit": {
+ "label": "话题上下文条数上限",
+ "help": "作为上下文包含的话题消息数量上限(默认 20)。"
+ },
+ "allow_from": {
+ "label": "允许的发送者",
+ "help": "允许与智能体对话的 Slack 用户 ID 白名单。DM 与频道访问还受 DM 策略和群聊策略控制。"
+ },
+ "group_policy": {
+ "label": "群聊策略",
+ "help": "“mention”表示在频道中仅在被 @ 提及时回复;“open”表示回复所有频道消息;“allowlist”表示仅在下方列出的频道中回复。"
+ },
+ "group_allow_from": {
+ "label": "允许的频道",
+ "help": "群聊策略为“allowlist”时,机器人会响应的频道 ID。"
+ },
+ "group_require_mention": {
+ "label": "允许频道内需提及",
+ "help": "在“allowlist”策略下,已批准的频道中还需 @ 提及机器人才回复。对“mention”和“open”策略无效。"
+ }
}
},
"guides": {
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 27a1a0ce0..353a35661 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -978,6 +978,8 @@ export interface ChannelFieldHint {
secret: boolean;
required: boolean;
help_key?: string | null;
+ /** Closed set of valid values; the panel renders a <select> when present. */
+ choices?: string[];
}
export interface ChannelSecretStatus {