Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-ui): stop showing a Slack Request URL on non-Slack channels

Jose Ramirez7483789173a8
diff --git a/control-ui/lib/__tests__/communicationChannels.test.ts b/control-ui/lib/__tests__/communicationChannels.test.ts
new file mode 100644
index 000000000..1b510eabd
--- /dev/null
+++ b/control-ui/lib/__tests__/communicationChannels.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest'
+import { slackWebhookUrlForChannel } from '../communicationChannels'
+
+const telegramOnly = {
+ metadata: { name: 'jose-tg', namespace: 'channels' },
+ spec: { telegram: [{ channelId: '1', chatType: 'private' as const }] },
+}
+const slackConfigured = {
+ metadata: { name: 'slack-jose', namespace: 'channels' },
+ spec: { slackSettings: { botHandle: 'Evenfire' } },
+}
+
+describe('slackWebhookUrlForChannel', () => {
+ it('returns null for a channel with no Slack provider', () => {
+ expect(slackWebhookUrlForChannel(telegramOnly)).toBeNull()
+ })
+
+ it('returns a URL for a channel with Slack configured', () => {
+ expect(slackWebhookUrlForChannel(slackConfigured)).toContain('/webhooks/slack/')
+ })
+
+ it('treats a confirmed conversation as Slack configured even with no settings', () => {
+ expect(
+ slackWebhookUrlForChannel({
+ metadata: { name: 'x', namespace: 'channels' },
+ spec: { slack: [{ channelId: 'C1', workspaceId: 'T1', userIds: ['U1'] }] },
+ })
+ ).toContain('/webhooks/slack/')
+ })
+})
diff --git a/control-ui/lib/communicationChannels.ts b/control-ui/lib/communicationChannels.ts
index 7a4c567c9..09f8c045f 100644
--- a/control-ui/lib/communicationChannels.ts
+++ b/control-ui/lib/communicationChannels.ts
@@ -71,6 +71,12 @@ export function slackWebhookTargetIdForChannel(item: CommunicationChannelItem):
const namespace = item.metadata?.namespace?.trim() || 'channels'
const name = item.metadata?.name?.trim()
if (!name) return null
+ const spec = item.spec
+ const slackConfigured =
+ (spec?.slack?.length ?? 0) > 0 ||
+ !!spec?.slackSettings?.workspaceId?.trim() ||
+ !!spec?.slackSettings?.botHandle?.trim()
+ if (!slackConfigured) return null
return `slack:${base64UrlEncode(JSON.stringify({ namespace, name }))}`
}
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 2bf8dcc16..141817c09 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.396",
+ "version": "0.1.397",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.396",
+ "version": "0.1.397",
"dependencies": {
"@clerum/llm-providers": "file:../packages/llm-providers",
"@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",
diff --git a/control-ui/package.json b/control-ui/package.json
index 053a09b2e..bb4eb3a4d 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.396",
+ "version": "0.1.397",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",