@vercel/connect 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -110,10 +110,10 @@ can import the same `connectAuthProvider` from `@vercel/connect/mcp`.
110
110
 
111
111
  ### Eve
112
112
 
113
- Use `connectSendblueCredentials` with Eve's native Sendblue channel. It
114
- resolves the app-scoped bearer token and managed sending line together, and
115
- includes Vercel OIDC webhook verification. When the connector has multiple
116
- lines, pass `fromNumber` to choose one.
113
+ Use channel-specific credential helpers with Eve's native channels.
114
+ `connectSendblueCredentials` resolves the app-scoped bearer token and managed
115
+ sending line together, and includes Vercel OIDC webhook verification. When the
116
+ connector has multiple lines, pass `fromNumber` to choose one.
117
117
 
118
118
  ```ts
119
119
  import { connectSendblueCredentials } from '@vercel/connect/eve';
@@ -124,6 +124,20 @@ export default sendblueChannel({
124
124
  });
125
125
  ```
126
126
 
127
+ For managed Microsoft Teams bots, `connectTeamsCredentials` resolves the
128
+ public bot application id and short-lived Bot Framework token without exposing
129
+ the managed app's federated credential. It also verifies Connect-forwarded
130
+ activities with Vercel OIDC.
131
+
132
+ ```ts
133
+ import { connectTeamsCredentials } from '@vercel/connect/eve';
134
+ import { teamsChannel } from 'eve/channels/teams';
135
+
136
+ export default teamsChannel({
137
+ credentials: connectTeamsCredentials('microsoft-teams/my-agent'),
138
+ });
139
+ ```
140
+
127
141
  ```ts
128
142
  import { defineMcpClientConnection } from 'eve/connections';
129
143
  import { connect } from '@vercel/connect/eve';
@@ -12,6 +12,7 @@ export { connectDiscordCredentials, type ConnectDiscordCredentialsParams, } from
12
12
  export { connectGitHubCredentials, type ConnectGitHubCredentialsParams, } from './github-credentials.js';
13
13
  export { connectLinearCredentials, type ConnectLinearCredentialsParams, } from './linear-credentials.js';
14
14
  export { connectLinqCredentials, type ConnectLinqCredentials, type ConnectLinqCredentialsParams, } from './linq-credentials.js';
15
+ export { connectTeamsCredentials, type ConnectTeamsCredentialsParams, } from './microsoft-teams-credentials.js';
15
16
  export { connectPhotonCredentials, type ConnectPhotonCredentialProvider, type PhotonCredentials, type ConnectPhotonCredentialsParams, } from './photon-credentials.js';
16
17
  export { connectSlackCredentials, type ConnectSlackCredentialsParams, } from './slack-credentials.js';
17
18
  export { connectSendblueCredentials, type ConnectSendblueCredentials, type ConnectSendblueCredentialsParams, } from './sendblue-credentials.js';
package/dist/eve/index.js CHANGED
@@ -12,6 +12,7 @@ export { connectDiscordCredentials, } from './discord-credentials.js';
12
12
  export { connectGitHubCredentials, } from './github-credentials.js';
13
13
  export { connectLinearCredentials, } from './linear-credentials.js';
14
14
  export { connectLinqCredentials, } from './linq-credentials.js';
15
+ export { connectTeamsCredentials, } from './microsoft-teams-credentials.js';
15
16
  export { connectPhotonCredentials, } from './photon-credentials.js';
16
17
  export { connectSlackCredentials, } from './slack-credentials.js';
17
18
  export { connectSendblueCredentials, } from './sendblue-credentials.js';
@@ -0,0 +1,30 @@
1
+ import type { TeamsChannelCredentials } from 'eve/channels/teams';
2
+ import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
3
+ /**
4
+ * Token parameters accepted by {@link connectTeamsCredentials}.
5
+ *
6
+ * Mirrors {@link ConnectTokenParams}, except that Teams bot credentials are
7
+ * always app-scoped and must request the Bot Framework resource. `subject`
8
+ * and `scopes` are therefore pinned by the helper.
9
+ */
10
+ export type ConnectTeamsCredentialsParams = Omit<ConnectTokenParams, 'subject' | 'scopes'>;
11
+ /**
12
+ * Build {@link TeamsChannelCredentials} backed by a managed Vercel Connect
13
+ * Microsoft Teams connector.
14
+ *
15
+ * The helper resolves the managed bot's public application id from connector
16
+ * metadata and obtains short-lived Bot Framework access tokens through
17
+ * Vercel Connect. It never exposes the managed app's federated credential.
18
+ * Vercel OIDC verifies trigger-forwarded Bot Framework activities, after
19
+ * Connect has verified their native bearer JWT.
20
+ *
21
+ * ```ts
22
+ * import { connectTeamsCredentials } from '@vercel/connect/eve';
23
+ * import { teamsChannel } from 'eve/channels/teams';
24
+ *
25
+ * export default teamsChannel({
26
+ * credentials: connectTeamsCredentials('microsoft-teams/my-agent'),
27
+ * });
28
+ * ```
29
+ */
30
+ export declare function connectTeamsCredentials(connector: string, params?: ConnectTeamsCredentialsParams, options?: ConnectOptions): TeamsChannelCredentials;
@@ -0,0 +1,44 @@
1
+ import { vercelOidc } from 'eve/channels/auth';
2
+ import { getConnectorMetadata, getTokenResponse, } from '../index.js';
3
+ const BOT_FRAMEWORK_SCOPE = 'https://api.botframework.com/.default';
4
+ /**
5
+ * Build {@link TeamsChannelCredentials} backed by a managed Vercel Connect
6
+ * Microsoft Teams connector.
7
+ *
8
+ * The helper resolves the managed bot's public application id from connector
9
+ * metadata and obtains short-lived Bot Framework access tokens through
10
+ * Vercel Connect. It never exposes the managed app's federated credential.
11
+ * Vercel OIDC verifies trigger-forwarded Bot Framework activities, after
12
+ * Connect has verified their native bearer JWT.
13
+ *
14
+ * ```ts
15
+ * import { connectTeamsCredentials } from '@vercel/connect/eve';
16
+ * import { teamsChannel } from 'eve/channels/teams';
17
+ *
18
+ * export default teamsChannel({
19
+ * credentials: connectTeamsCredentials('microsoft-teams/my-agent'),
20
+ * });
21
+ * ```
22
+ */
23
+ export function connectTeamsCredentials(connector, params = {}, options) {
24
+ return {
25
+ appId: () => getTeamsAppId(connector, options),
26
+ tokenProvider: async () => {
27
+ const response = await getTokenResponse(connector, {
28
+ ...params,
29
+ subject: { type: 'app' },
30
+ scopes: [BOT_FRAMEWORK_SCOPE],
31
+ }, options);
32
+ return { accessToken: response.token, expiresAt: response.expiresAt };
33
+ },
34
+ webhookVerifier: vercelOidc(),
35
+ };
36
+ }
37
+ async function getTeamsAppId(connector, options) {
38
+ const metadata = await getConnectorMetadata(connector, options);
39
+ const appId = metadata.vendor.appId;
40
+ if (typeof appId !== 'string' || appId.length === 0) {
41
+ throw new Error(`Vercel Connect connector ${connector} did not return a Microsoft Teams app id.`);
42
+ }
43
+ return appId;
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/connect",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "dist"
43
43
  ],
44
44
  "dependencies": {
45
- "@vercel/oidc": "3.8.6"
45
+ "@vercel/oidc": "3.8.7"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@ai-sdk/mcp": "^1 || ^2",