Skip to content

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

TypeScript

fix(control-ui): pin --sign-in-audience and stop pointing at a portal toggle

Jose Ramirezc6a51ef96e16
diff --git a/control-ui/app/communication-channels/new/page.tsx b/control-ui/app/communication-channels/new/page.tsx
index 8adcd2b1f..e1bd6b46f 100644
--- a/control-ui/app/communication-channels/new/page.tsx
+++ b/control-ui/app/communication-channels/new/page.tsx
@@ -40,6 +40,7 @@ import {
LOCAL_TEAMS_ENDPOINT_ORIGIN,
TEAMS_APP_NAME_MAX_LENGTH,
buildTeamsAppCreateCommand,
+ buildTeamsSupportsFilesCommand,
canGenerateTeamsCommand,
teamsAppNameError,
teamsPlaceholderEndpoint,
@@ -756,11 +757,13 @@ export default function CreateCommunicationChannelPage() {
Run this from any directory. The command writes CLIENT_ID, TENANT_ID and
CLIENT_SECRET into .env in whichever directory you run it from.
</li>
+ <li>Paste CLIENT_ID, TENANT_ID, and CLIENT_SECRET below.</li>
<li>
- In Teams Developer Portal, enable{' '}
- <strong>Upload and download files</strong> for the Bot feature.
+ To deliver workflow files, enable them on the manifest with{' '}
+ <code>{buildTeamsSupportsFilesCommand()}</code>. The <code>--yes</code>{' '}
+ is required; without it the command changes nothing and still looks like
+ it worked. File delivery works in a direct chat only, not in a channel.
</li>
- <li>Paste CLIENT_ID, TENANT_ID, and CLIENT_SECRET below.</li>
</ol>
{teamsAppCreateCommand ? (
<div className="cu-command-block">
diff --git a/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
index 8cef6f1b7..4367e99c7 100644
--- a/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
+++ b/control-ui/components/__tests__/CreateCommunicationChannelPage.test.tsx
@@ -253,13 +253,19 @@ describe('CreateCommunicationChannelPage — provider setup', () => {
expect(
screen.getByText(/The command writes CLIENT_ID, TENANT_ID and CLIENT_SECRET into/i)
).toBeInTheDocument()
- expect(screen.getByText('Upload and download files')).toBeInTheDocument()
+ // supportsFiles is a manifest property, not a Developer Portal toggle. The
+ // panel used to point at a checkbox the current portal does not present.
+ expect(screen.getByText(/bots\[0\]\.supportsFiles=true/)).toBeInTheDocument()
+ expect(screen.getByText(/direct chat only, not in a channel/i)).toBeInTheDocument()
const command = screen.getByText(/teams app create/).closest('pre')
expect(command).toHaveTextContent('teams app create')
// Quoted, so a display name with a space stays one argument.
expect(command).toHaveTextContent('--name "Evenfire Bot"')
expect(command).toHaveTextContent('--endpoint "https://webhook.example.com/webhooks/teams/')
+ // channel-reader uses a tenant-scoped token URL, so a multi-tenant app fails
+ // with AADSTS. The CLI does not document its default, so the flag is pinned.
+ expect(command).toHaveTextContent('--sign-in-audience myOrg')
expect(command).toHaveTextContent('--env .env')
expect(screen.getByLabelText(/^CLIENT_ID/)).toBeInTheDocument()
expect(screen.getByLabelText(/^TENANT_ID/)).toBeInTheDocument()
diff --git a/control-ui/lib/__tests__/teamsSetup.test.ts b/control-ui/lib/__tests__/teamsSetup.test.ts
index 58d10a470..0c1d84320 100644
--- a/control-ui/lib/__tests__/teamsSetup.test.ts
+++ b/control-ui/lib/__tests__/teamsSetup.test.ts
@@ -3,6 +3,7 @@ import {
LOCAL_TEAMS_ENDPOINT_ORIGIN,
TEAMS_APP_NAME_MAX_LENGTH,
buildTeamsAppCreateCommand,
+ buildTeamsSupportsFilesCommand,
canGenerateTeamsCommand,
teamsAppNameError,
teamsPlaceholderEndpoint,
@@ -92,3 +93,25 @@ describe('buildTeamsAppCreateCommand', () => {
expect(cmd).toContain('--name "My Bot"')
})
})
+
+describe('buildTeamsAppCreateCommand sign-in audience', () => {
+ it('pins the single-tenant audience, because channel-reader uses a tenant-scoped token URL', () => {
+ const cmd = buildTeamsAppCreateCommand({
+ botName: 'Evenfire Bot',
+ endpoint: 'https://webhook.example.com/webhooks/teams/x',
+ })
+ expect(cmd).toContain('--sign-in-audience myOrg')
+ })
+})
+
+describe('buildTeamsSupportsFilesCommand', () => {
+ it('includes --yes, without which the update silently does nothing', () => {
+ expect(buildTeamsSupportsFilesCommand('abc-123')).toBe(
+ "teams app manifest update abc-123 --set-json 'bots[0].supportsFiles=true' --yes"
+ )
+ })
+
+ it('falls back to a placeholder app id', () => {
+ expect(buildTeamsSupportsFilesCommand()).toContain('<appId>')
+ })
+})
diff --git a/control-ui/lib/teamsSetup.ts b/control-ui/lib/teamsSetup.ts
index ed6826dfb..475a5a934 100644
--- a/control-ui/lib/teamsSetup.ts
+++ b/control-ui/lib/teamsSetup.ts
@@ -72,12 +72,30 @@ export function teamsPlaceholderEndpoint(endpoint: string): string {
* canGenerateTeamsCommand and render a warning instead of calling this with a
* relative path.
*/
+/**
+ * `--sign-in-audience myOrg` is not optional in practice. channel-reader fetches
+ * its bot token from `login.microsoftonline.com/{tenantId}/oauth2/v2.0/token`,
+ * which only works for a single-tenant app; a multi-tenant registration needs the
+ * botframework.com authority and fails with an AADSTS error. The CLI documents
+ * `myOrg` and `multipleOrgs` as the accepted values but does not document which
+ * one it defaults to, so it is pinned here rather than assumed.
+ */
export function buildTeamsAppCreateCommand(params: { botName: string; endpoint: string }): string {
const botName = params.botName.trim() || '<bot-name>'
return [
'teams app create \\',
` --name "${botName}" \\`,
` --endpoint "${params.endpoint}" \\`,
+ ' --sign-in-audience myOrg \\',
' --env .env',
].join('\n')
}
+
+/**
+ * Enabling file delivery is a manifest property, not a Developer Portal toggle.
+ * Older guidance points at App features > Bot > "Upload and download files",
+ * which the current portal does not present.
+ */
+export function buildTeamsSupportsFilesCommand(appId?: string): string {
+ return `teams app manifest update ${appId?.trim() || '<appId>'} --set-json 'bots[0].supportsFiles=true' --yes`
+}
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index ce8768032..51480167a 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.423",
+ "version": "0.1.424",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.423",
+ "version": "0.1.424",
"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 653ecf0fd..180be428b 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.423",
+ "version": "0.1.424",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",