Skip to content

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

TypeScript

feat(control-ui): add Teams setup prerequisites, document install-link and description gaps

Jose Ramirez0977e964978b
diff --git a/control-ui/app/communication-channels/[name]/edit/page.tsx b/control-ui/app/communication-channels/[name]/edit/page.tsx
index 99d117607..fe8a13174 100644
--- a/control-ui/app/communication-channels/[name]/edit/page.tsx
+++ b/control-ui/app/communication-channels/[name]/edit/page.tsx
@@ -15,6 +15,7 @@ import { DashboardLayout } from '@components/DashboardLayout'
import { SegmentedControl } from '@components/SegmentedControl'
import { SelectionDropdown } from '@components/SelectionDropdown'
import { IconBroadcast } from '@components/Sidebar/icons'
+import { TeamsSetupPrerequisites } from '@components/TeamsSetupPrerequisites'
import { useToast } from '@components/Toast'
import { IconCopy } from '@components/icons'
import { Button } from '@components/ui'
@@ -703,6 +704,8 @@ export default function EditCommunicationChannelPage() {
</>
) : (
<>
+ <TeamsSetupPrerequisites />
+
<div className="cu-banner cu-banner--info">
Store the CLIENT_SECRET value here, not the Microsoft secret ID. CLIENT_ID and
TENANT_ID identify the Microsoft Teams bot that receives messages for this
diff --git a/control-ui/app/communication-channels/new/page.tsx b/control-ui/app/communication-channels/new/page.tsx
index 818cb4082..8adcd2b1f 100644
--- a/control-ui/app/communication-channels/new/page.tsx
+++ b/control-ui/app/communication-channels/new/page.tsx
@@ -13,6 +13,7 @@ import { DashboardLayout } from '@components/DashboardLayout'
import { SegmentedControl } from '@components/SegmentedControl'
import { SelectionDropdown } from '@components/SelectionDropdown'
import { IconBroadcast } from '@components/Sidebar/icons'
+import { TeamsSetupPrerequisites } from '@components/TeamsSetupPrerequisites'
import { useToast } from '@components/Toast'
import { IconCopy } from '@components/icons'
import { Button, Field, TextInput } from '@components/ui'
@@ -719,6 +720,8 @@ export default function CreateCommunicationChannelPage() {
}))
}
>
+ <TeamsSetupPrerequisites />
+
<section className="cu-teams-setup">
<div>
<p className="cu-section-title">Create the Teams bot</p>
diff --git a/control-ui/app/constants/teams.ts b/control-ui/app/constants/teams.ts
new file mode 100644
index 000000000..abeec4b56
--- /dev/null
+++ b/control-ui/app/constants/teams.ts
@@ -0,0 +1,12 @@
+/**
+ * The full Teams setup how-to, linked from the prerequisites block on both the
+ * create and edit Communication Channel pages. Mirrors SLACK_NEW_APP_URL: an
+ * external-facing address both pages need, so it lives here instead of inline
+ * in one of them.
+ *
+ * This file lives on `main` only from the next promotion onward, so the link
+ * 404s until then. That is accepted: pointing at `dev` instead would teach
+ * operators to trust an unstable doc location.
+ */
+export const TEAMS_SETUP_GUIDE_URL =
+ 'https://github.com/evenfire-ai/evenfire/blob/main/docs/how-to/connect-teams.md'
diff --git a/control-ui/components/TeamsSetupPrerequisites/index.tsx b/control-ui/components/TeamsSetupPrerequisites/index.tsx
new file mode 100644
index 000000000..5b173616d
--- /dev/null
+++ b/control-ui/components/TeamsSetupPrerequisites/index.tsx
@@ -0,0 +1,42 @@
+import React from 'react'
+import { TEAMS_SETUP_GUIDE_URL } from '@constants/teams'
+
+/**
+ * Both Teams panels used to jump straight to "run the CLI command", which
+ * quietly assumes two things: that the operator already has an authenticated
+ * Teams CLI, and that their tenant permits sideloading a custom app at all. An
+ * operator can hit either assumption being false, and the failure shows up far
+ * from its cause -- an install that never completes, or a command that has
+ * nothing to copy into.
+ *
+ * `teams status` checks both in one command, so lead with it rather than let
+ * either gap surface later as a confusing failure.
+ */
+export function TeamsSetupPrerequisites() {
+ return (
+ <section className="cu-teams-setup">
+ <div>
+ <p className="cu-section-title">Before you start</p>
+ <p className="cu-muted">Two things need to be true before the command below will work.</p>
+ </div>
+ <ol className="cu-teams-setup__instructions">
+ <li>
+ Install and sign in to the Teams CLI: <code>npm install -g @microsoft/teams.cli</code>,
+ then <code>teams login</code>.
+ </li>
+ <li>
+ Your organization also has to allow custom app upload (sideloading), or the bot this
+ creates cannot be installed. Run <code>teams status</code>: it proves both prerequisites
+ in one command, printing <code>Sideloading: enabled</code> once the tenant allows it. A{' '}
+ <code>disabled</code> result usually means an admin policy has not propagated yet, not
+ that anything is broken.
+ </li>
+ </ol>
+ <p className="cu-muted">
+ <a className="cu-link" href={TEAMS_SETUP_GUIDE_URL} target="_blank" rel="noreferrer">
+ Read the full Teams setup guide →
+ </a>
+ </p>
+ </section>
+ )
+}
diff --git a/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
index e9e3999e3..8cef6f1b7 100644
--- a/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
+++ b/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
@@ -722,3 +722,61 @@ describe('CreateCommunicationChannelPage — Teams CLI instruction', () => {
).toBeInTheDocument()
})
})
+
+/**
+ * An operator without an authenticated Teams CLI, or without a tenant that
+ * permits sideloading, used to hit both assumptions unannounced, only after
+ * copying the `teams app create` command. The prerequisites block exists to
+ * surface both before that command, and to point at the full guide.
+ */
+describe('CreateCommunicationChannelPage — Teams prerequisites', () => {
+ const TEAMS_GUIDE_URL =
+ 'https://github.com/evenfire-ai/evenfire/blob/main/docs/how-to/connect-teams.md'
+
+ it('shows CLI install/login and the sideloading check before the Teams provider is selected', async () => {
+ render(
+ <ToastProvider>
+ <CreateCommunicationChannelPage />
+ </ToastProvider>
+ )
+
+ await fillStep1AndContinue()
+ fireEvent.click(screen.getByRole('radio', { name: 'Microsoft Teams' }))
+
+ expect(screen.getByText(/npm install -g @microsoft\/teams\.cli/)).toBeInTheDocument()
+ expect(screen.getByText('teams login')).toBeInTheDocument()
+ expect(screen.getByText('Sideloading: enabled')).toBeInTheDocument()
+ // The point of running `teams status` at all: it proves both prerequisites
+ // in one shot, and a disabled result means propagation, not breakage.
+ expect(screen.getByText(/proves both prerequisites/i)).toBeInTheDocument()
+ expect(screen.getByText(/not that anything is broken/i)).toBeInTheDocument()
+ })
+
+ it('links to the Teams setup guide', async () => {
+ render(
+ <ToastProvider>
+ <CreateCommunicationChannelPage />
+ </ToastProvider>
+ )
+
+ await fillStep1AndContinue()
+ fireEvent.click(screen.getByRole('radio', { name: 'Microsoft Teams' }))
+
+ const link = screen.getByRole('link', { name: /Teams setup guide/i })
+ expect(link).toHaveAttribute('href', TEAMS_GUIDE_URL)
+ expect(link).toHaveAttribute('target', '_blank')
+ })
+
+ it('does not show the Teams prerequisites on the Telegram provider', async () => {
+ render(
+ <ToastProvider>
+ <CreateCommunicationChannelPage />
+ </ToastProvider>
+ )
+
+ await fillStep1AndContinue()
+
+ expect(screen.queryByText('Sideloading: enabled')).not.toBeInTheDocument()
+ expect(screen.queryByRole('link', { name: /Teams setup guide/i })).not.toBeInTheDocument()
+ })
+})
diff --git a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
index 1f39d9522..6b91d63ba 100644
--- a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
+++ b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
@@ -724,6 +724,55 @@ describe('EditCommunicationChannelPage Teams setup command', () => {
})
})
+/**
+ * An operator without an authenticated Teams CLI, or without a tenant that
+ * permits sideloading, used to hit both assumptions unannounced, only after
+ * copying the `teams app create` command. The prerequisites block exists to
+ * surface both before that command, and to point at the full guide. Unlike
+ * the create page, this section renders unconditionally on the Teams tab
+ * (it does not wait for teamsRequestUrl), so no draft setup is needed here.
+ */
+describe('EditCommunicationChannelPage Teams prerequisites', () => {
+ const TEAMS_GUIDE_URL =
+ 'https://github.com/evenfire-ai/evenfire/blob/main/docs/how-to/connect-teams.md'
+
+ it('shows CLI install/login and the sideloading check on the Teams tab', async () => {
+ mockChannel('teams-channel', { teamsSettings: { appName: 'evenfire' } })
+ await renderLoadedPage()
+
+ const user = userEvent.setup()
+ await user.click(await screen.findByRole('radio', { name: /microsoft teams/i }))
+
+ expect(screen.getByText(/npm install -g @microsoft\/teams\.cli/)).toBeInTheDocument()
+ expect(screen.getByText('teams login')).toBeInTheDocument()
+ expect(screen.getByText('Sideloading: enabled')).toBeInTheDocument()
+ // The point of running `teams status` at all: it proves both prerequisites
+ // in one shot, and a disabled result means propagation, not breakage.
+ expect(screen.getByText(/proves both prerequisites/i)).toBeInTheDocument()
+ expect(screen.getByText(/not that anything is broken/i)).toBeInTheDocument()
+ })
+
+ it('links to the Teams setup guide', async () => {
+ mockChannel('teams-channel', { teamsSettings: { appName: 'evenfire' } })
+ await renderLoadedPage()
+
+ const user = userEvent.setup()
+ await user.click(await screen.findByRole('radio', { name: /microsoft teams/i }))
+
+ const link = screen.getByRole('link', { name: /Teams setup guide/i })
+ expect(link).toHaveAttribute('href', TEAMS_GUIDE_URL)
+ expect(link).toHaveAttribute('target', '_blank')
+ })
+
+ it('does not show the Teams prerequisites on the Slack tab', async () => {
+ mockChannel('slack-channel', SLACK_CHANNEL_SPEC)
+ await renderLoadedPage()
+
+ expect(screen.queryByText('Sideloading: enabled')).not.toBeInTheDocument()
+ expect(screen.queryByRole('link', { name: /Teams setup guide/i })).not.toBeInTheDocument()
+ })
+})
+
/**
* spec.teamsSettings.appName is a free-form DISPLAY name: the CRD declares it
* with no pattern (unlike tenantId right below it), control-api checks only
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 45902cdb2..ce8768032 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.422",
+ "version": "0.1.423",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.422",
+ "version": "0.1.423",
"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 fd327fd2e..653ecf0fd 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.422",
+ "version": "0.1.423",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/how-to/connect-teams.md b/docs/how-to/connect-teams.md
index e7594775a..c72ee0672 100644
--- a/docs/how-to/connect-teams.md
+++ b/docs/how-to/connect-teams.md
@@ -133,6 +133,13 @@ link, and writes `CLIENT_ID`, `TENANT_ID` and `CLIENT_SECRET`. On a
teams-managed bot the Teams App ID, Bot ID and `CLIENT_ID` are the same UUID;
do not go hunting for three different values.
+**Short and long description need to differ.** `teams app create` sets both to
+the app name. The Developer Portal requires them to be different, so before
+installing, open the [Developer Portal](https://dev.teams.microsoft.com/apps),
+select the app, and under **Basic information** give the long description its
+own value. Do this regardless: it may be part of why the install link below
+fails (see Troubleshooting), though that has not been confirmed.
+
Open the install link, add the app, and optionally add it to a channel.
Then paste `CLIENT_ID`, `TENANT_ID` and `CLIENT_SECRET` into the Control UI and
@@ -265,6 +272,21 @@ endpoint changed with it. Update the bot's messaging endpoint in the portal.
signed-in user is not the one it was assigned to. Check `teams status` rather
than guessing.
+**The install link says "This app cannot be found."** Clicking the
+**Install in Teams** link `teams app create` prints, right after creation, can
+return this even though the app exists and is visible in the Developer Portal.
+It reads like the create failed. It did not: re-running `teams app create` in
+response leaves you with two bots.
+
+Two workarounds. Use **Preview in Teams** from the
+[Developer Portal](https://dev.teams.microsoft.com/apps) instead of the
+printed link; it bypasses the catalog lookup that is failing. Or wait a short
+while and regenerate the link:
+
+```shell
+teams app get <appId> --install-link
+```
+
**The bot cannot get a token.** An `AADSTS` error means the app is multi-tenant.
`channel-reader` needs single-tenant; `teams app doctor` should report
`Sign-in audience: AzureADMyOrg`.