@vercel/connect 0.7.0 → 0.9.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
@@ -5,7 +5,7 @@ SDK for obtaining scoped tokens for third-party services on behalf of apps or us
5
5
  Seven entrypoints, all ESM:
6
6
 
7
7
  - `@vercel/connect` — core token / authorization SDK
8
- - `@vercel/connect/chat` — adapter helpers for the [Chat SDK](https://chat-sdk.dev) (`chat`): `connectSlackAdapter`, `connectDiscordAdapter`, `connectGitHubAdapter`, `connectLinearAdapter` (no Chat SDK dependency — returns structural config)
8
+ - `@vercel/connect/chat` — adapter helpers for the [Chat SDK](https://chat-sdk.dev) (`chat`): `connectSlackAdapter`, `connectDiscordAdapter`, `connectGitHubAdapter`, `connectLinearAdapter`, `connectNotionAdapter`, `connectTelegramAdapter` (no Chat SDK dependency — returns structural config)
9
9
  - `@vercel/connect/ai-sdk` — [Vercel AI SDK](https://ai-sdk.dev) glue: re-exports `connectAuthProvider` for MCP transports (optional peers: `ai`, `@ai-sdk/mcp`)
10
10
  - `@vercel/connect/mcp` — canonical MCP-spec `OAuthClientProvider` for any MCP client (optional peer: `@ai-sdk/mcp`)
11
11
  - `@vercel/connect/eve` — adapter helpers for [Eve](https://github.com/vercel/eve) connections (optional peer: `eve`)
@@ -49,8 +49,8 @@ const { url } = await experimental_startInstallation(
49
49
  ### Chat SDK
50
50
 
51
51
  Spread the helper into the matching `create*Adapter` factory. Each helper
52
- wires both outbound app-scoped tokens and inbound Connect trigger-forwarded
53
- webhook verification (Vercel OIDC), so no provider secret lives in your env.
52
+ wires outbound app-scoped tokens; trigger-capable providers also receive
53
+ inbound Connect webhook verification via Vercel OIDC.
54
54
 
55
55
  ```ts
56
56
  import { createSlackAdapter } from '@chat-adapter/slack';
@@ -64,7 +64,10 @@ createSlackAdapter({
64
64
 
65
65
  `connectDiscordAdapter` (`botToken` and `applicationId`),
66
66
  `connectGitHubAdapter` (`installationToken`), and `connectLinearAdapter`
67
- (`accessToken`) follow the same shape. See the
67
+ (`accessToken`) follow the same shape. `connectNotionAdapter` supplies only the
68
+ outbound `token`; native Notion webhooks still require
69
+ `NOTION_VERIFICATION_TOKEN`. `connectTelegramAdapter` supplies only
70
+ `botToken`; Telegram retains native webhook verification or polling. See the
68
71
  [Chat SDK integration guide](https://github.com/vercel/vercel/blob/main/packages/connect/docs/chat-integration.md)
69
72
  for connector setup, trigger forwarding, and per-platform examples.
70
73
 
@@ -21,8 +21,11 @@
21
21
  * ```
22
22
  */
23
23
  export { createConnectWebhookVerifier, type ConnectWebhookVerifier, type ConnectWebhookVerifierOptions, } from './webhook-verifier.js';
24
- export type { ConnectDiscordAdapterConfig, ConnectGitHubAdapterConfig, ConnectLinearAdapterConfig, ConnectTokenResolver, } from './types.js';
24
+ export type { ConnectDiscordAdapterConfig, ConnectGitHubAdapterConfig, ConnectLinearAdapterConfig, ConnectLinqAdapterConfig, ConnectLinqCredentials, ConnectNotionAdapterConfig, ConnectTelegramAdapterConfig, ConnectTokenResolver, } from './types.js';
25
25
  export { connectDiscordAdapter, type ConnectDiscordAdapterParams, } from './discord-adapter.js';
26
26
  export { connectSlackAdapter, type ConnectSlackAdapterConfig, type ConnectSlackAdapterParams, } from './slack-adapter.js';
27
27
  export { connectGitHubAdapter, type ConnectGitHubAdapterParams, } from './github-adapter.js';
28
28
  export { connectLinearAdapter, type ConnectLinearAdapterParams, } from './linear-adapter.js';
29
+ export { connectLinqAdapter, type ConnectLinqAdapterParams, } from './linq-adapter.js';
30
+ export { connectNotionAdapter, type ConnectNotionAdapterParams, } from './notion-adapter.js';
31
+ export { connectTelegramAdapter, type ConnectTelegramAdapterParams, } from './telegram-adapter.js';
@@ -25,3 +25,6 @@ export { connectDiscordAdapter, } from './discord-adapter.js';
25
25
  export { connectSlackAdapter, } from './slack-adapter.js';
26
26
  export { connectGitHubAdapter, } from './github-adapter.js';
27
27
  export { connectLinearAdapter, } from './linear-adapter.js';
28
+ export { connectLinqAdapter, } from './linq-adapter.js';
29
+ export { connectNotionAdapter, } from './notion-adapter.js';
30
+ export { connectTelegramAdapter, } from './telegram-adapter.js';
@@ -0,0 +1,37 @@
1
+ import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
2
+ import type { ConnectLinqAdapterConfig } from './types.js';
3
+ /**
4
+ * Token parameters accepted by {@link connectLinqAdapter}.
5
+ *
6
+ * Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus `subject`.
7
+ * Linq credentials are app-scoped, so this helper always uses
8
+ * `{ type: 'app' }`.
9
+ */
10
+ export type ConnectLinqAdapterParams = Omit<ConnectTokenParams, 'subject'>;
11
+ /**
12
+ * Build a Linq adapter config fragment backed by a Vercel Connect connector.
13
+ *
14
+ * Spread the result into `createLinqAdapter` from `@linqapp/chat-sdk-adapter`:
15
+ *
16
+ * ```ts
17
+ * import { createLinqAdapter } from '@linqapp/chat-sdk-adapter';
18
+ * import { connectLinqAdapter } from '@vercel/connect/chat';
19
+ *
20
+ * createLinqAdapter({
21
+ * ...connectLinqAdapter('linq/my-agent'),
22
+ * });
23
+ * ```
24
+ *
25
+ * Linq's SDK calls its Bearer credential `apiKey`; the lazy `credentials`
26
+ * provider supplies the app-scoped Connect token through that field only when
27
+ * the adapter needs it.
28
+ *
29
+ * Connect retains Linq's webhook signing secret and verifies trigger-forwarded
30
+ * webhooks before attaching a Vercel OIDC token. `webhookVerifier` validates
31
+ * that OIDC token, replacing Linq's native HMAC check.
32
+ *
33
+ * The optional `params` and `options` arguments mirror the signature of
34
+ * {@link getTokenResponse}, allowing callers to pass through fields like
35
+ * `installationId`, `scopes`, or `validityBufferMs`.
36
+ */
37
+ export declare function connectLinqAdapter(connector: string, params?: ConnectLinqAdapterParams, options?: ConnectOptions): ConnectLinqAdapterConfig;
@@ -0,0 +1,37 @@
1
+ import { getTokenResponse, } from '../index.js';
2
+ import { createConnectWebhookVerifier } from './webhook-verifier.js';
3
+ /**
4
+ * Build a Linq adapter config fragment backed by a Vercel Connect connector.
5
+ *
6
+ * Spread the result into `createLinqAdapter` from `@linqapp/chat-sdk-adapter`:
7
+ *
8
+ * ```ts
9
+ * import { createLinqAdapter } from '@linqapp/chat-sdk-adapter';
10
+ * import { connectLinqAdapter } from '@vercel/connect/chat';
11
+ *
12
+ * createLinqAdapter({
13
+ * ...connectLinqAdapter('linq/my-agent'),
14
+ * });
15
+ * ```
16
+ *
17
+ * Linq's SDK calls its Bearer credential `apiKey`; the lazy `credentials`
18
+ * provider supplies the app-scoped Connect token through that field only when
19
+ * the adapter needs it.
20
+ *
21
+ * Connect retains Linq's webhook signing secret and verifies trigger-forwarded
22
+ * webhooks before attaching a Vercel OIDC token. `webhookVerifier` validates
23
+ * that OIDC token, replacing Linq's native HMAC check.
24
+ *
25
+ * The optional `params` and `options` arguments mirror the signature of
26
+ * {@link getTokenResponse}, allowing callers to pass through fields like
27
+ * `installationId`, `scopes`, or `validityBufferMs`.
28
+ */
29
+ export function connectLinqAdapter(connector, params = {}, options) {
30
+ return {
31
+ credentials: async () => {
32
+ const response = await getTokenResponse(connector, { ...params, subject: { type: 'app' } }, options);
33
+ return { apiKey: response.token };
34
+ },
35
+ webhookVerifier: createConnectWebhookVerifier(),
36
+ };
37
+ }
@@ -0,0 +1,28 @@
1
+ import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
2
+ import type { ConnectNotionAdapterConfig } from './types.js';
3
+ /**
4
+ * Token parameters accepted by {@link connectNotionAdapter}.
5
+ *
6
+ * Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus
7
+ * `subject` — Notion connection tokens are app-scoped, so this helper pins
8
+ * the subject to `{ type: "app" }`.
9
+ */
10
+ export type ConnectNotionAdapterParams = Omit<ConnectTokenParams, 'subject'>;
11
+ /**
12
+ * Build a Notion adapter config fragment backed by a Vercel Connect connector.
13
+ *
14
+ * The helper resolves outbound Notion API tokens only. Notion webhooks are
15
+ * delivered directly and must continue to use the adapter's native
16
+ * `verificationToken` / `NOTION_VERIFICATION_TOKEN` HMAC verification.
17
+ *
18
+ * ```ts
19
+ * import { createNotionAdapter } from "@chat-adapter/notion";
20
+ * import { connectNotionAdapter } from "@vercel/connect/chat";
21
+ *
22
+ * createNotionAdapter({
23
+ * ...connectNotionAdapter("notion/acme-notion"),
24
+ * verificationToken: process.env.NOTION_VERIFICATION_TOKEN,
25
+ * });
26
+ * ```
27
+ */
28
+ export declare function connectNotionAdapter(connector: string, params?: ConnectNotionAdapterParams, options?: ConnectOptions): ConnectNotionAdapterConfig;
@@ -0,0 +1,23 @@
1
+ import { getToken, } from '../index.js';
2
+ /**
3
+ * Build a Notion adapter config fragment backed by a Vercel Connect connector.
4
+ *
5
+ * The helper resolves outbound Notion API tokens only. Notion webhooks are
6
+ * delivered directly and must continue to use the adapter's native
7
+ * `verificationToken` / `NOTION_VERIFICATION_TOKEN` HMAC verification.
8
+ *
9
+ * ```ts
10
+ * import { createNotionAdapter } from "@chat-adapter/notion";
11
+ * import { connectNotionAdapter } from "@vercel/connect/chat";
12
+ *
13
+ * createNotionAdapter({
14
+ * ...connectNotionAdapter("notion/acme-notion"),
15
+ * verificationToken: process.env.NOTION_VERIFICATION_TOKEN,
16
+ * });
17
+ * ```
18
+ */
19
+ export function connectNotionAdapter(connector, params = {}, options) {
20
+ return {
21
+ token: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
22
+ };
23
+ }
@@ -0,0 +1,29 @@
1
+ import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
2
+ import type { ConnectTelegramAdapterConfig } from './types.js';
3
+ /**
4
+ * Token parameters accepted by {@link connectTelegramAdapter}.
5
+ *
6
+ * Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus
7
+ * `subject` — Telegram bot tokens are app-scoped, so this helper pins the
8
+ * subject to `{ type: "app" }`.
9
+ */
10
+ export type ConnectTelegramAdapterParams = Omit<ConnectTokenParams, 'subject'>;
11
+ /**
12
+ * Build a Telegram adapter config fragment backed by a Vercel Connect
13
+ * connector.
14
+ *
15
+ * The helper resolves outbound Telegram Bot API tokens only. Telegram webhooks
16
+ * are delivered directly and must continue to use the adapter's native
17
+ * `secretToken` / `TELEGRAM_WEBHOOK_SECRET_TOKEN` verification, or polling.
18
+ *
19
+ * ```ts
20
+ * import { createTelegramAdapter } from "@chat-adapter/telegram";
21
+ * import { connectTelegramAdapter } from "@vercel/connect/chat";
22
+ *
23
+ * createTelegramAdapter({
24
+ * ...connectTelegramAdapter("telegram/acme-telegram"),
25
+ * secretToken: process.env.TELEGRAM_WEBHOOK_SECRET_TOKEN,
26
+ * });
27
+ * ```
28
+ */
29
+ export declare function connectTelegramAdapter(connector: string, params?: ConnectTelegramAdapterParams, options?: ConnectOptions): ConnectTelegramAdapterConfig;
@@ -0,0 +1,24 @@
1
+ import { getToken, } from '../index.js';
2
+ /**
3
+ * Build a Telegram adapter config fragment backed by a Vercel Connect
4
+ * connector.
5
+ *
6
+ * The helper resolves outbound Telegram Bot API tokens only. Telegram webhooks
7
+ * are delivered directly and must continue to use the adapter's native
8
+ * `secretToken` / `TELEGRAM_WEBHOOK_SECRET_TOKEN` verification, or polling.
9
+ *
10
+ * ```ts
11
+ * import { createTelegramAdapter } from "@chat-adapter/telegram";
12
+ * import { connectTelegramAdapter } from "@vercel/connect/chat";
13
+ *
14
+ * createTelegramAdapter({
15
+ * ...connectTelegramAdapter("telegram/acme-telegram"),
16
+ * secretToken: process.env.TELEGRAM_WEBHOOK_SECRET_TOKEN,
17
+ * });
18
+ * ```
19
+ */
20
+ export function connectTelegramAdapter(connector, params = {}, options) {
21
+ return {
22
+ botToken: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
23
+ };
24
+ }
@@ -38,3 +38,41 @@ export interface ConnectLinearAdapterConfig {
38
38
  accessToken: ConnectTokenResolver;
39
39
  webhookVerifier: ConnectWebhookVerifier;
40
40
  }
41
+ /**
42
+ * Credentials resolved lazily by the Linq Chat SDK adapter.
43
+ *
44
+ * Structurally matches the return value of its `credentials` option.
45
+ */
46
+ export interface ConnectLinqCredentials {
47
+ apiKey: string;
48
+ }
49
+ /**
50
+ * Partial Linq adapter config backed by Vercel Connect.
51
+ *
52
+ * Structurally matches the `credentials` and `webhookVerifier` options of
53
+ * `createLinqAdapter` from `@linqapp/chat-sdk-adapter`.
54
+ */
55
+ export interface ConnectLinqAdapterConfig {
56
+ credentials: () => Promise<ConnectLinqCredentials>;
57
+ webhookVerifier: (request: Request, rawBody: Uint8Array) => Promise<unknown> | unknown;
58
+ }
59
+ /**
60
+ * Partial Notion adapter config backed by Vercel Connect.
61
+ *
62
+ * Structurally matches the `token` option of `createNotionAdapter` from
63
+ * `@chat-adapter/notion`. Notion webhooks continue to use native HMAC
64
+ * verification and are not part of this config fragment.
65
+ */
66
+ export interface ConnectNotionAdapterConfig {
67
+ token: ConnectTokenResolver;
68
+ }
69
+ /**
70
+ * Partial Telegram adapter config backed by Vercel Connect.
71
+ *
72
+ * Structurally matches the `botToken` option of `createTelegramAdapter` from
73
+ * `@chat-adapter/telegram`. Telegram webhooks continue to use native secret
74
+ * token verification and are not part of this config fragment.
75
+ */
76
+ export interface ConnectTelegramAdapterConfig {
77
+ botToken: ConnectTokenResolver;
78
+ }
@@ -9,7 +9,7 @@ import { verifyVercelOidcToken } from '@vercel/oidc';
9
9
  * subpath stay decoupled from `@chat-adapter/*` while remaining
10
10
  * structurally compatible.
11
11
  */
12
- export type ConnectWebhookVerifier = (request: Request, body: string) => Promise<unknown> | unknown;
12
+ export type ConnectWebhookVerifier = (request: Request, body: string | Uint8Array) => Promise<unknown> | unknown;
13
13
  /**
14
14
  * Options forwarded to {@link verifyVercelOidcToken}. Defaults to
15
15
  * matching `project_id` / `environment` against the current Vercel
@@ -11,5 +11,6 @@ export { CONNECT_OAUTH_ISSUER, connectOAuth, type ConnectOAuthAudienceEnvironmen
11
11
  export { connectDiscordCredentials, type ConnectDiscordCredentialsParams, } from './discord-credentials.js';
12
12
  export { connectGitHubCredentials, type ConnectGitHubCredentialsParams, } from './github-credentials.js';
13
13
  export { connectLinearCredentials, type ConnectLinearCredentialsParams, } from './linear-credentials.js';
14
+ export { connectLinqCredentials, type ConnectLinqCredentials, type ConnectLinqCredentialsParams, } from './linq-credentials.js';
14
15
  export { connectPhotonCredentials, type ConnectPhotonCredentialProvider, type PhotonCredentials, type ConnectPhotonCredentialsParams, } from './photon-credentials.js';
15
16
  export { connectSlackCredentials, type ConnectSlackCredentialsParams, } from './slack-credentials.js';
package/dist/eve/index.js CHANGED
@@ -11,5 +11,6 @@ export { CONNECT_OAUTH_ISSUER, connectOAuth, } from './connect-oauth.js';
11
11
  export { connectDiscordCredentials, } from './discord-credentials.js';
12
12
  export { connectGitHubCredentials, } from './github-credentials.js';
13
13
  export { connectLinearCredentials, } from './linear-credentials.js';
14
+ export { connectLinqCredentials, } from './linq-credentials.js';
14
15
  export { connectPhotonCredentials, } from './photon-credentials.js';
15
16
  export { connectSlackCredentials, } from './slack-credentials.js';
@@ -0,0 +1,34 @@
1
+ import { vercelOidc } from 'eve/channels/auth';
2
+ import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
3
+ /** Linq channel credentials returned by {@link connectLinqCredentials}. */
4
+ export interface ConnectLinqCredentials {
5
+ /** Short-lived API key for outbound Linq API calls. */
6
+ apiKey: () => Promise<string>;
7
+ /** Verifies webhooks forwarded by Vercel Connect. */
8
+ webhookVerifier: ReturnType<typeof vercelOidc>;
9
+ }
10
+ /**
11
+ * Token parameters accepted by {@link connectLinqCredentials}.
12
+ *
13
+ * Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus `subject`.
14
+ * Linq credentials are app-scoped, so this helper always uses
15
+ * `{ type: 'app' }`.
16
+ */
17
+ export type ConnectLinqCredentialsParams = Omit<ConnectTokenParams, 'subject'>;
18
+ /**
19
+ * Build Linq channel credentials backed by a Vercel Connect connector.
20
+ *
21
+ * The API-key resolver keeps token rotation delegated to Connect.
22
+ * `webhookVerifier` validates the Vercel OIDC token Connect attaches after it
23
+ * has verified and forwarded the provider webhook.
24
+ *
25
+ * ```ts
26
+ * import { connectLinqCredentials } from '@vercel/connect/eve';
27
+ * import { linqChannel } from 'eve/channels/linq';
28
+ *
29
+ * export default linqChannel({
30
+ * credentials: connectLinqCredentials('linq/my-agent'),
31
+ * });
32
+ * ```
33
+ */
34
+ export declare function connectLinqCredentials(connector: string, params?: ConnectLinqCredentialsParams, options?: ConnectOptions): ConnectLinqCredentials;
@@ -0,0 +1,24 @@
1
+ import { vercelOidc } from 'eve/channels/auth';
2
+ import { getToken, } from '../index.js';
3
+ /**
4
+ * Build Linq channel credentials backed by a Vercel Connect connector.
5
+ *
6
+ * The API-key resolver keeps token rotation delegated to Connect.
7
+ * `webhookVerifier` validates the Vercel OIDC token Connect attaches after it
8
+ * has verified and forwarded the provider webhook.
9
+ *
10
+ * ```ts
11
+ * import { connectLinqCredentials } from '@vercel/connect/eve';
12
+ * import { linqChannel } from 'eve/channels/linq';
13
+ *
14
+ * export default linqChannel({
15
+ * credentials: connectLinqCredentials('linq/my-agent'),
16
+ * });
17
+ * ```
18
+ */
19
+ export function connectLinqCredentials(connector, params = {}, options) {
20
+ return {
21
+ apiKey: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
22
+ webhookVerifier: vercelOidc(),
23
+ };
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/connect",
3
- "version": "0.7.0",
3
+ "version": "0.9.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.4"
45
+ "@vercel/oidc": "3.8.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@ai-sdk/mcp": "^1 || ^2",