Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): add native Linq channel and setup (#2268)

OwenKephart0569638dad3e
diff --git a/.changeset/linq-native-channel.md b/.changeset/linq-native-channel.md
new file mode 100644
index 000000000..9d60d1cbd
--- /dev/null
+++ b/.changeset/linq-native-channel.md
@@ -0,0 +1,5 @@
+---
+"eve": minor
+---
+
+Add a first-class Linq iMessage and SMS channel with managed Vercel Connect and portable credential setup paths. Connect setup can provision a new Linq account and line or connect an existing account with its partner API token.
diff --git a/apps/docs/lib/integrations/data.ts b/apps/docs/lib/integrations/data.ts
index cef33c8d4..61e402663 100644
--- a/apps/docs/lib/integrations/data.ts
+++ b/apps/docs/lib/integrations/data.ts
@@ -810,50 +810,27 @@ export default channel;
See the [Liveblocks adapter documentation](https://chat-sdk.dev/adapters/vendor-official/liveblocks) for supported events, capabilities, and credentials.`,
configure: `Create a Liveblocks webhook, set \`LIVEBLOCKS_SECRET_KEY\` and \`LIVEBLOCKS_WEBHOOK_SECRET\`, and send comment events to \`/eve/v1/liveblocks\`. The adapter maps rooms to channels, comment threads to threads, and comments to messages. See the [Chat SDK channel docs](/docs/channels/chat-sdk) for eve session dispatch, state, streaming, and human-in-the-loop behavior.`,
},
- "chat-sdk-linq": {
+ linq: {
logo: "linq",
- docsHref: "/docs/channels/chat-sdk",
- badge: "Provider official",
- keywords: ["chat sdk", "linq", "imessage", "sms", "apple messages", "tapbacks", "phone"],
- install: `Add this Chat SDK channel from eve's registry. This writes \`agent/channels/linq.ts\` and installs Chat SDK and its adapter dependencies:
+ docsHref: "/docs/channels/linq",
+ badge: "First-party",
+ keywords: ["linq", "imessage", "sms", "apple messages", "tapbacks", "phone"],
+ install: `Add Linq from eve's registry, then follow the guided Connect or portable credential setup:
\`\`\`bash
-eve add channel/chat-sdk-linq
+eve add channel/linq
\`\`\``,
quickStart: `Create \`agent/channels/linq.ts\`:
\`\`\`ts
-// agent/channels/linq.ts
-import { createLinqAdapter } from "@linqapp/chat-sdk-adapter";
-import { createMemoryState } from "@chat-adapter/state-memory";
-import type { Message, Thread } from "chat";
-import { chatSdkChannel } from "eve/channels/chat-sdk";
-
-export const { bot, channel, send } = chatSdkChannel({
- userName: "My Agent",
- adapters: {
- linq: createLinqAdapter({
- apiKey: process.env.LINQ_API_KEY!,
- signingSecret: process.env.LINQ_WEBHOOK_SECRET!,
- }),
- },
- state: createMemoryState(),
-});
+import { connectLinqCredentials } from "@vercel/connect/eve";
+import { linqChannel } from "eve/channels/linq";
-bot.onNewMention(async (thread: Thread, message: Message) => {
- await thread.subscribe();
- await send(message.text, { thread });
+export default linqChannel({
+ credentials: connectLinqCredentials("linq/my-agent"),
});
-
-bot.onSubscribedMessage(async (thread: Thread, message: Message) => {
- await send(message.text, { thread });
-});
-
-export default channel;
-\`\`\`
-
-See the [Linq adapter documentation](https://chat-sdk.dev/adapters/vendor-official/linq) for supported events, capabilities, and credentials.`,
- configure: `Create a Linq account, set \`LINQ_API_KEY\` and \`LINQ_WEBHOOK_SECRET\`, then point its signed webhook at \`/eve/v1/linq\`. Linq supports iMessage and SMS DMs and group chats, media, buffered streaming, and tapbacks. See the [Chat SDK channel docs](/docs/channels/chat-sdk) for eve session dispatch, state, streaming, and human-in-the-loop behavior.`,
+\`\`\``,
+ configure: `The guided setup can provision a managed Linq line with Vercel Connect or collect portable credentials. Connect-backed setup creates a native Linq connector and routes verified triggers to \`/eve/v1/linq\`; with portable credentials, deploy first, then create a signed Linq webhook for that route.`,
},
"chat-sdk-kapso": {
logo: "kapso",
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 3a17387bd..992febd30 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -64,7 +64,6 @@
"@kapso/chat-adapter": "0.1.1",
"@kybernesis/arcana": "0.2.0",
"@larksuite/vercel-chat-adapter": "0.1.2",
- "@linqapp/chat-sdk-adapter": "0.1.0",
"@liveblocks/chat-sdk-adapter": "3.23.0",
"@novu/chat-sdk-adapter": "0.1.0",
"@onkernel/eve-extension": "^0.1.3",
diff --git a/apps/docs/registry.json b/apps/docs/registry.json
index fb8eeda68..1f83b0c6c 100644
--- a/apps/docs/registry.json
+++ b/apps/docs/registry.json
@@ -1839,26 +1839,22 @@
}
},
{
- "name": "channel/chat-sdk-linq",
+ "name": "channel/linq",
"type": "registry:item",
"title": "Linq",
- "description": "iMessage and SMS conversations, media, and tapbacks through Linq.",
- "dependencies": ["chat", "@linqapp/chat-sdk-adapter", "@chat-adapter/state-memory"],
- "envVars": {
- "LINQ_API_KEY": "",
- "LINQ_WEBHOOK_SECRET": ""
- },
- "files": [
- {
- "path": "registry/channels/chat-sdk-linq.ts",
- "type": "registry:file",
- "target": "agent/channels/linq.ts"
- }
- ],
+ "description": "Connect an eve agent to iMessage and SMS through Linq with guided Connect or portable setup.",
+ "dependencies": ["@vercel/connect@>=0.9.0"],
"meta": {
"eve": {
- "docs": "/docs/channels/chat-sdk",
- "implementation": "chat-sdk"
+ "setup": {
+ "command": "eve",
+ "package": "eve",
+ "bin": "eve",
+ "args": ["integration", "setup", "linq"]
+ },
+ "requires": ">=0.39.0",
+ "docs": "/docs/channels/linq",
+ "implementation": "native"
}
}
},
diff --git a/apps/docs/registry.staged-requirements.json b/apps/docs/registry.staged-requirements.json
new file mode 100644
index 000000000..864e3f2dc
--- /dev/null
+++ b/apps/docs/registry.staged-requirements.json
@@ -0,0 +1,3 @@
+{
+ "items": ["channel/linq"]
+}
diff --git a/apps/docs/registry/channels/chat-sdk-linq.ts b/apps/docs/registry/channels/chat-sdk-linq.ts
deleted file mode 100644
index 4ffd0c7db..000000000
--- a/apps/docs/registry/channels/chat-sdk-linq.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { createLinqAdapter } from "@linqapp/chat-sdk-adapter";
-import { createMemoryState } from "@chat-adapter/state-memory";
-import type { Message, Thread } from "chat";
-import { chatSdkChannel } from "eve/channels/chat-sdk";
-
-export const { bot, channel, send } = chatSdkChannel({
- userName: "My Agent",
- adapters: {
- linq: createLinqAdapter({
- apiKey: process.env.LINQ_API_KEY!,
- signingSecret: process.env.LINQ_WEBHOOK_SECRET!,
- }),
- },
- state: createMemoryState(),
-});
-
-bot.onNewMention(async (thread: Thread, message: Message) => {
- await thread.subscribe();
- await send(message.text, { thread });
-});
-
-bot.onSubscribedMessage(async (thread: Thread, message: Message) => {
- await send(message.text, { thread });
-});
-
-export default channel;
diff --git a/apps/docs/scripts/validate-channel-registry.ts b/apps/docs/scripts/validate-channel-registry.ts
index c1e33fdc3..9f4a9b24a 100644
--- a/apps/docs/scripts/validate-channel-registry.ts
+++ b/apps/docs/scripts/validate-channel-registry.ts
@@ -37,6 +37,7 @@ interface Registry {
const registrySlugsByCatalogSlug: Readonly<Record<string, string>> = {
eve: "web",
+ linq: "linq",
photon: "photon-imessage",
};
@@ -45,6 +46,7 @@ const setupKindsByCatalogSlug: Readonly<Record<string, string>> = {
github: "github",
"linear-agent": "linear",
eve: "web",
+ linq: "linq",
photon: "photon",
};
@@ -58,7 +60,6 @@ const adapterDependenciesByCatalogSlug: Readonly<Record<string, string>> = {
"chat-sdk-sendblue": "chat-adapter-sendblue",
"chat-sdk-novu": "@novu/chat-sdk-adapter",
"chat-sdk-liveblocks": "@liveblocks/chat-sdk-adapter",
- "chat-sdk-linq": "@linqapp/chat-sdk-adapter",
"chat-sdk-kapso": "@kapso/chat-adapter",
"chat-sdk-dial": "@getdial/chat-sdk-adapter",
"chat-sdk-agentphone": "@agentphone/chat-sdk-adapter",
@@ -78,7 +79,6 @@ const targetSlugsByCatalogSlug: Readonly<Record<string, string>> = {
"chat-sdk-sendblue": "sendblue",
"chat-sdk-novu": "novu",
"chat-sdk-liveblocks": "liveblocks",
- "chat-sdk-linq": "linq",
"chat-sdk-kapso": "kapso",
"chat-sdk-dial": "dial",
"chat-sdk-agentphone": "agentphone",
@@ -136,6 +136,7 @@ for (const [index, item] of items.entries()) {
entry.slug === "github" ||
entry.slug === "linear-agent" ||
entry.slug === "eve" ||
+ entry.slug === "linq" ||
entry.slug === "photon"
) {
const expectedArgs = [
diff --git a/docs/channels/linq.mdx b/docs/channels/linq.mdx
new file mode 100644
index 000000000..4993928d6
--- /dev/null
+++ b/docs/channels/linq.mdx
@@ -0,0 +1,67 @@
+---
+title: Linq
+description: Connect an eve agent to iMessage and SMS through Linq.
+---
+
+Use `linqChannel` to receive and reply to iMessage and SMS conversations through Linq.
+
+Run `eve add channel/linq` to choose Vercel Connect or portable credentials. With Vercel Connect, eve signs you in and creates or links a Vercel project when needed. Then choose whether to create a managed Linq account and line or connect an existing Linq account with its partner API token and phone numbers. eve configures the connector and webhook through Connect:
+
+```ts title="agent/channels/linq.ts"
+import { connectLinqCredentials } from "@vercel/connect/eve";
+import { linqChannel } from "eve/channels/linq";
+
+export default linqChannel({
+ credentials: connectLinqCredentials("linq/my-agent"),
+});
+```
+
+The default webhook route is `/eve/v1/linq`. The channel verifies forwarded webhooks with same-project Vercel OIDC by default, marks accepted messages as read, and continues the same eve session for every message in a Linq conversation. A new accepted message cooperatively cancels an active turn and steers its replacement turn.
+
+Set `turnPolicy: "queue"` when every response should finish before Linq starts the next message.
+
+Customize inbound dispatch with `onMessage`. Return `null` to ignore a message, or return `title` alongside `auth` to set the title when the dispatch starts a run:
+
+```ts
+export default linqChannel({
+ credentials: connectLinqCredentials("linq/my-agent"),
+ onMessage(_ctx, message) {
+ if (message.author.isBot) return null;
+ return {
+ auth: null,
+ context: [`The sender is ${message.author.fullName}.`],
+ };
+ },
+});
+```
+
+Set `route` to override the webhook path or `webhookVerifier` to use a different trusted-forwarder verifier.
+
+## Other hosts
+
+For a host without Vercel Connect, choose **Use portable credentials** during `eve add channel/linq`. eve writes `LINQ_API_KEY` and `LINQ_WEBHOOK_SECRET` to `.env.local`.
+
+After deploying the agent:
+
+1. Create a Linq webhook for your public `https://…/eve/v1/linq` URL with `message.received`, `reaction.added`, and `reaction.removed` events.
+2. Set `LINQ_API_KEY` and `LINQ_WEBHOOK_SECRET` in the host's encrypted environment variables.
+
+To configure the channel by hand, pass the API key and webhook signing secret:
+
+```ts title="agent/channels/linq.ts"
+import { linqChannel } from "eve/channels/linq";
+
+export default linqChannel({
+ credentials: {
+ apiKey: process.env.LINQ_API_KEY!,
+ signingSecret: process.env.LINQ_WEBHOOK_SECRET!,
+ },
+});
+```
+
+For direct Linq webhooks, pass `signingSecret`. A supplied `webhookVerifier` takes precedence over it.
+
+## What to read next
+
+- [Channels overview](./overview): the channel contract and every built-in channel
+- [Auth & route protection](../guides/auth-and-route-protection): authenticating inbound traffic
diff --git a/docs/channels/meta.json b/docs/channels/meta.json
index 7e419682e..0d17b68dd 100644
--- a/docs/channels/meta.json
+++ b/docs/channels/meta.json
@@ -6,6 +6,7 @@
"eve",
"mcp",
"slack",
+ "linq",
"photon",
"discord",
"teams",
diff --git a/docs/channels/overview.mdx b/docs/channels/overview.mdx
index 8b2fbce63..782879d0c 100644
--- a/docs/channels/overview.mdx
+++ b/docs/channels/overview.mdx
@@ -47,7 +47,7 @@ agent/
intake.ts
```
-Install a channel from the registry with `eve add channel/photon-imessage`, `eve add channel/slack`, or `eve add channel/web`. You can also author the file by hand.
+Install a channel from the registry with `eve add channel/<name>`, such as `eve add channel/slack` or `eve add channel/web`. You can also author the file by hand.
## The eve HTTP channel (default)
@@ -73,6 +73,7 @@ eve's first-class channels use eve-owned runtimes for webhook handling, verifica
| Local tooling, SDK clients, `curl` | [eve HTTP channel](./eve) (default) |
| MCP clients delegating durable work | [MCP](./mcp) |
| Slack mentions, DMs, buttons | [Slack](./slack) |
+| iMessage and SMS | [Linq](./linq) |
| iMessage | [Photon](./photon) |
| Discord slash commands, components | [Discord](./discord) |
| Microsoft Teams messages + Adaptive Cards | [Teams](./teams) |
@@ -94,7 +95,7 @@ Where an eve agent communicates with people, you may be required to disclose tha
- [eve HTTP channel](./eve): the default session API behind the TUI, SDK clients, and browser UIs
- [Slack](./slack): the most common platform channel, end to end
- [MCP](./mcp): expose the agent as a durable invocation service
-- [Photon](./photon), [Discord](./discord), [Teams](./teams), [Telegram](./telegram), [Twilio](./twilio), [GitHub](./github), and [Linear](./linear): the other first-class platform channels
+- [Linq](./linq), [Photon](./photon), [Discord](./discord), [Teams](./teams), [Telegram](./telegram), [Twilio](./twilio), [GitHub](./github), and [Linear](./linear): the other first-class platform channels
- [Chat SDK adapters](./chat-sdk): reach services eve has no first-class channel for
- [Custom channels](./custom): build a channel for any surface with `defineChannel`
- [Durable cross-channel notifications](../patterns/durable-cross-channel-notifications): post to another platform without starting an agent turn
diff --git a/packages/eve-catalog/src/index.ts b/packages/eve-catalog/src/index.ts
index acac6de23..3ff29a820 100644
--- a/packages/eve-catalog/src/index.ts
+++ b/packages/eve-catalog/src/index.ts
@@ -214,10 +214,10 @@ export const INTEGRATIONS: readonly IntegrationEntry[] = [
surfaces: { scaffoldable: false, registry: true, gallery: true },
},
{
- slug: "chat-sdk-linq",
+ slug: "linq",
name: "Linq",
kind: "channel",
- tagline: "iMessage and SMS conversations, media, and tapbacks through Linq.",
+ tagline: "iMessage and SMS conversations through Linq, with guided Connect or portable setup.",
surfaces: { scaffoldable: false, registry: true, gallery: true },
},
{
diff --git a/packages/eve/package.json b/packages/eve/package.json
index e206f557f..ef3ba49e2 100644
--- a/packages/eve/package.json
+++ b/packages/eve/package.json
@@ -251,6 +251,11 @@
"import": "./dist/src/public/channels/photon/index.js",
"default": "./dist/src/public/channels/photon/index.js"
},
+ "./channels/linq": {
+ "types": "./dist/src/public/channels/linq/index.d.ts",
+ "import": "./dist/src/public/channels/linq/index.js",
+ "default": "./dist/src/public/channels/linq/index.js"
+ },
"./channels/github": {
"types": "./dist/src/public/channels/github/index.d.ts",
"import": "./dist/src/public/channels/github/index.js",
@@ -336,6 +341,7 @@
"@chat-adapter/twilio": "4.34.0",
"@clack/core": "1.3.1",
"@eve/catalog": "workspace:*",
+ "@linqapp/chat-sdk-adapter": "^0.3.0",
"@modelcontextprotocol/server": "2.0.0",
"@nuxt/kit": "^4.0.0",
"@opentelemetry/context-async-hooks": "catalog:",
diff --git a/packages/eve/scripts/vendor-compiled/@linqapp/chat-sdk-adapter.mjs b/packages/eve/scripts/vendor-compiled/@linqapp/chat-sdk-adapter.mjs
new file mode 100644
index 000000000..c7640c4a5
--- /dev/null
+++ b/packages/eve/scripts/vendor-compiled/@linqapp/chat-sdk-adapter.mjs
@@ -0,0 +1,13 @@
+import { createDeclarationCopier } from "../_shared.mjs";
+
+export default {
+ packageName: "@linqapp/chat-sdk-adapter",
+ compiledPath: "@linqapp/chat-sdk-adapter",
+ copyDeclarations: createDeclarationCopier({
+ rewrites: {
+ chat: { kind: "vendored", compiledPath: "chat" },
+ "@linqapp/sdk": { kind: "external" },
+ standardwebhooks: { kind: "external" },
+ },
+ }),
+};
diff --git a/packages/eve/scripts/vendor-compiled/index.mjs b/packages/eve/scripts/vendor-compiled/index.mjs
index 82b2dec03..3177ce4b0 100644
--- a/packages/eve/scripts/vendor-compiled/index.mjs
+++ b/packages/eve/scripts/vendor-compiled/index.mjs
@@ -16,6 +16,7 @@ import chatAdapterSlack from "./@chat-adapter/slack.mjs";
import chatAdapterStateMemory from "./@chat-adapter/state-memory.mjs";
import chatAdapterTwilio from "./@chat-adapter/twilio.mjs";
import photonChatAdapterIMessage from "./@photon-ai/chat-adapter-imessage.mjs";
+import linqChatSdkAdapter from "./@linqapp/chat-sdk-adapter.mjs";
import modelContextProtocolServer from "./@modelcontextprotocol/server.mjs";
import opentelemetryApi from "./@opentelemetry/api.mjs";
@@ -76,6 +77,7 @@ export const MODULES = [
opentelemetryOtlpTransformer,
otel,
photonChatAdapterIMessage,
+ linqChatSdkAdapter,
picocolors,
provider,
providerUtils,
diff --git a/packages/eve/src/public/channels/linq/inboundContent.ts b/packages/eve/src/public/channels/linq/inboundContent.ts
new file mode 100644
index 000000000..800ab2060
--- /dev/null
+++ b/packages/eve/src/public/channels/linq/inboundContent.ts
@@ -0,0 +1,11 @@
+import type { UserContent } from "ai";
+
+import type { Message } from "#compiled/chat/index.js";
+import { messageToUserContent } from "#public/channels/chat-sdk/index.js";
+
+/** Returns model-visible Linq content, or `undefined` for blank messages. */
+export function linqInboundContent(message: Message): string | UserContent | undefined {
+ const content = messageToUserContent(message);
+ if (typeof content === "string") return content.trim().length > 0 ? content : undefined;
+ return content.length > 0 ? content : undefined;
+}
diff --git a/packages/eve/src/public/channels/linq/index.ts b/packages/eve/src/public/channels/linq/index.ts
new file mode 100644
index 000000000..8ff44c186
--- /dev/null
+++ b/packages/eve/src/public/channels/linq/index.ts
@@ -0,0 +1,10 @@
+export {
+ linqChannel,
+ type LinqChannel,
+ type LinqChannelConfig,
+ type LinqChannelCredentials,
+ type LinqCredentialValue,
+ type LinqInboundMessageContext,
+ type LinqInboundResult,
+ type LinqInboundResultOrPromise,
+} from "#public/channels/linq/linqChannel.js";
diff --git a/packages/eve/src/public/channels/linq/linqChannel.test.ts b/packages/eve/src/public/channels/linq/linqChannel.test.ts
new file mode 100644
index 000000000..12056fe34
--- /dev/null
+++ b/packages/eve/src/public/channels/linq/linqChannel.test.ts
@@ -0,0 +1,101 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const { createLinqAdapter, directMessage, markRead, newMessage, send } = vi.hoisted(() => ({
+ createLinqAdapter: vi.fn((_config: { credentials?: () => unknown | Promise<unknown> }) => ({
+ name: "linq",
+ })),
+ directMessage: vi.fn(),
+ markRead: vi.fn(),
+ newMessage: vi.fn(),
+ send: vi.fn(),
+}));
+
+vi.mock("#public/channels/chat-sdk/index.js", () => ({
+ chatSdkChannel: () => ({
+ bot: {
+ getAdapter: () => ({ markRead }),
+ onDirectMessage: directMessage,
+ onNewMessage: newMessage,
+ },
+ channel: { routes: [] },
+ send,
+ }),
+ messageToUserContent: (message: Message) => message.text,
+}));
+vi.mock("#compiled/@chat-adapter/state-memory/index.js", () => ({
+ createMemoryState: vi.fn(),
+}));
+vi.mock("#compiled/@linqapp/chat-sdk-adapter/index.js", () => ({
+ createLinqAdapter,
+}));
+vi.mock("#public/channels/auth.js", () => ({ vercelOidc: vi.fn() }));
+
+import { Message } from "#compiled/chat/index.js";
+import { linqChannel } from "#public/channels/linq/linqChannel.js";
+
+describe("linqChannel", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("dispatches direct messages to eve", async () => {
+ linqChannel({
+ credentials: { apiKey: "linq-api-key", signingSecret: "linq-signing-secret" },
+ });
+ const handler = directMessage.mock.calls[0]?.[0];
+ if (handler === undefined) throw new Error("Expected an inbound direct-message handler.");
+ const thread = { id: "thread-id" };
+ const message = new Message({
+ author: { isBot: false, isMe: false, userId: "user", userName: "user" },
+ id: "message-id",
+ raw: {},
+ text: "Hello Linq",
+ threadId: thread.id,
+ });
+
+ await handler(thread, message);
+
+ expect(markRead).toHaveBeenCalledWith(thread.id, message.id);
+ expect(send).toHaveBeenCalledWith(
+ { context: [], message: "Hello Linq" },
+ { auth: null, thread, title: undefined },
+ );
+ });
+
+ it("uses lazy credentials and the managed credential verifier", async () => {
+ const apiKey = vi.fn(async () => "rotating-token");
+ const signingSecret = vi.fn(async () => "rotating-secret");
+ const webhookVerifier = vi.fn();
+
+ linqChannel({ credentials: { apiKey, signingSecret, webhookVerifier } });
+
+ const config = createLinqAdapter.mock.calls[0]?.[0];
+ expect(config).toMatchObject({ webhookVerifier });
+ expect(config).not.toHaveProperty("signingSecret");
+ await expect(config?.credentials?.()).resolves.toEqual({
+ apiKey: "rotating-token",
+ signingSecret: "rotating-secret",
+ });
+ });
+
+ it("drops blank inbound messages", async () => {
+ linqChannel({
+ credentials: { apiKey: "linq-api-key", signingSecret: "linq-signing-secret" },
+ });
+ const handler = directMessage.mock.calls[0]?.[0];
+ if (handler === undefined) throw new Error("Expected an inbound direct-message handler.");
+ const thread = { id: "thread-id" };
+ const message = new Message({
+ author: { isBot: false, isMe: false, userId: "user", userName: "user" },
+ id: "message-id",
+ raw: {},
+ text: " \n",
+ threadId: thread.id,
+ });
+
+ await handler(thread, message);
+
+ expect(markRead).toHaveBeenCalledWith(thread.id, message.id);
+ expect(send).not.toHaveBeenCalled();
+ });
+});
diff --git a/packages/eve/src/public/channels/linq/linqChannel.ts b/packages/eve/src/public/channels/linq/linqChannel.ts
new file mode 100644
index 000000000..12401d00d
--- /dev/null
+++ b/packages/eve/src/public/channels/linq/linqChannel.ts
@@ -0,0 +1,184 @@
+import type { SessionAuthContext, TurnPolicy } from "#channel/types.js";
+import { vercelOidc } from "#public/channels/auth.js";
+import {
+ chatSdkChannel,
+ type ChatSdkChannelBridge,
+ type ChatSdkChannelEvents,
+ type ChatSdkChannelState,
+ type ChatSdkInstrumentationMetadata,
+ type ChatSdkReceiveTarget,
+} from "#public/channels/chat-sdk/index.js";
+import { createMemoryState } from "#compiled/@chat-adapter/state-memory/index.js";
+import type { Channel } from "#public/definitions/channel.js";
+import {
+ createLinqAdapter,
+ type LinqAdapterConfig,
+ type LinqCredentialProvider,
+ type LinqCredentials,
+ type LinqWebhookVerifier,
+} from "#compiled/@linqapp/chat-sdk-adapter/index.js";
+import type { Message, Thread } from "#compiled/chat/index.js";
+import { linqInboundContent } from "#public/channels/linq/inboundContent.js";
+
+/** Context passed to {@link LinqChannelConfig.onMessage}. */
+export interface LinqInboundMessageContext {
+ /** Low-level Chat SDK thread for Linq-specific operations. */
+ readonly thread: Thread;
+}
+
+/** Result of {@link LinqChannelConfig.onMessage}. Return `null` to drop the message. */
+export type LinqInboundResult = {
+ readonly auth: SessionAuthContext | null;
+ readonly context?: readonly string[];
+ /** Overrides the workflow run title without changing the message sent to the model. */
+ readonly title?: string;
+} | null;
+
+/** Sync or async {@link LinqInboundResult}. */
+export type LinqInboundResultOrPromise = LinqInboundResult | Promise<LinqInboundResult>;
+
+/** A direct value or lazy resolver for a Linq credential. */
+export type LinqCredentialValue = string | (() => string | Promise<string>);
+
+/** Linq credentials for outbound API calls and inbound webhook verification. */
+export interface LinqChannelCredentials {
+ /** API key for outbound Linq API calls. */
+ readonly apiKey?: LinqCredentialValue;
+ /** Signing secret for direct Linq webhook delivery. */
+ readonly signingSecret?: LinqCredentialValue;
+ /** Trusted verifier for webhooks forwarded by a provider such as Vercel Connect. */
+ readonly webhookVerifier?: LinqWebhookVerifier;
+}
+
+/** Configuration for {@link linqChannel}. */
+export interface LinqChannelConfig {
+ /** Optional Linq API base URL, for example a sandbox endpoint. */
+ readonly baseURL?: string;
+ /** Outbound credentials and inbound webhook verification. */
+ readonly credentials?: LinqChannelCredentials;
+ /** Per-event overrides for the underlying Chat SDK channel. */
+ readonly events?: ChatSdkChannelEvents<{ linq: ReturnType<typeof createLinqAdapter> }>;
+ /** Inbound message policy. Defaults to dispatching every message with no user auth. */
+ readonly onMessage?: (
+ ctx: LinqInboundMessageContext,
+ message: Message,
+ ) => LinqInboundResultOrPromise;
+ /** Override the default webhook route (`/eve/v1/linq`). */
+ readonly route?: string;
+ /** Policy for accepted messages that arrive while a turn is active. */
+ readonly turnPolicy?: TurnPolicy;
+ /** Display name used by the Chat SDK runtime. Defaults to `"eve"`. */
+ readonly userName?: string;
+}
+
+/** First-class eve channel backed by Linq iMessage and SMS. */
+export interface LinqChannel extends Channel<
+ ChatSdkChannelState,
+ ChatSdkReceiveTarget,
+ ChatSdkInstrumentationMetadata
+> {}
+
+/**
+ * Creates an eve channel for Linq-powered iMessage and SMS conversations.
+ *
+ * @example
+ * ```ts
+ * import { connectLinqCredentials } from "@vercel/connect/eve";
+ * import { linqChannel } from "eve/channels/linq";
+ *
+ * export default linqChannel({
+ * credentials: connectLinqCredentials("linq/my-agent"),
+ * });
+ * ```
+ */
+export function linqChannel(config: LinqChannelConfig): LinqChannel {
+ const adapterConfig: LinqAdapterConfig = normalizeCredentials(config.credentials);
+ if (config.baseURL !== undefined) adapterConfig.baseURL = config.baseURL;
+ const linq = createLinqAdapter(adapterConfig);
+ const bridge = chatSdkChannel({
+ adapters: { linq },
+ concurrency: "concurrent",
+ events: config.events,
+ routes: { linq: config.route ?? "/eve/v1/linq" },
+ state: createMemoryState(),
+ streaming: false,
+ turnPolicy: config.turnPolicy,
+ userName: config.userName ?? "eve",
+ });
+ const onMessage = config.onMessage ?? defaultOnMessage;
+
+ bridge.bot.onDirectMessage(async (thread: Thread, message: Message) => {
+ await dispatchMessage(bridge, onMessage, thread, message);
+ });
+ bridge.bot.onNewMessage(/[\s\S]*/, async (thread: Thread, message: Message) => {
+ await dispatchMessage(bridge, onMessage, thread, message);
+ });
+
+ return bridge.channel;
+}
+
+function normalizeCredentials(
+ credentials: LinqChannelConfig["credentials"],
+): Partial<Pick<LinqAdapterConfig, "credentials" | "webhookVerifier">> {
+ const { apiKey, signingSecret, webhookVerifier } = credentials ?? {};
+ const config: Partial<Pick<LinqAdapterConfig, "credentials" | "webhookVerifier">> = {};
+ if (apiKey !== undefined) {
+ config.credentials = createCredentialProvider(apiKey, signingSecret);
+ }
+ if (webhookVerifier !== undefined) {
+ config.webhookVerifier = webhookVerifier;
+ } else if (signingSecret === undefined) {
+ config.webhookVerifier = vercelOidc();
+ }
+ return config;
+}
+
+function createCredentialProvider(
+ apiKey: LinqCredentialValue,
+ signingSecret: LinqCredentialValue | undefined,
+): LinqCredentialProvider {
+ return async () => {
+ const credentials: LinqCredentials = { apiKey: await resolveCredentialValue(apiKey) };
+ if (signingSecret !== undefined) {
+ credentials.signingSecret = await resolveCredentialValue(signingSecret);
+ }
+ return credentials;
+ };
+}
+
+async function resolveCredentialValue(value: LinqCredentialValue): Promise<string> {
+ return typeof value === "function" ? await value() : value;
+}
+
+async function defaultOnMessage(): Promise<LinqInboundResult> {
+ return { auth: null };
+}
+
+async function dispatchMessage(
+ bridge: ChatSdkChannelBridge<{ linq: ReturnType<typeof createLinqAdapter> }>,
+ onMessage: NonNullable<LinqChannelConfig["onMessage"]>,
+ thread: Thread,
+ message: Message,
+): Promise<void> {
+ const result = await onMessage({ thread }, message);
+ if (result === null) return;
+ await markReadBestEffort(bridge.bot.getAdapter("linq"), thread, message);
+ const content = linqInboundContent(message);
+ if (content === undefined) return;
+ await bridge.send(
+ { context: [...(result.context ?? [])], message: content },
+ { auth: result.auth, thread, title: result.title },
+ );
+}
+
+async function markReadBestEffort(
+ adapter: ReturnType<typeof createLinqAdapter>,
+ thread: Thread,
+ message: Message,
+): Promise<void> {
+ try {
+ await adapter.markRead(thread.id, message.id);
+ } catch {
+ // A read receipt should never prevent the user's message from reaching eve.
+ }
+}
diff --git a/packages/eve/src/setup/integrations/linq/connect.test.ts b/packages/eve/src/setup/integrations/linq/connect.test.ts
new file mode 100644
index 000000000..ff43f08e6
--- /dev/null
+++ b/packages/eve/src/setup/integrations/linq/connect.test.ts
@@ -0,0 +1,66 @@
+import { describe, expect, it, vi } from "vitest";
+
+import type { ChannelSetupLog } from "#setup/cli/index.js";
+
+import { parseCreatedLinqConnector, provisionLinqConnector } from "./connect.js";
+
+function log(): ChannelSetupLog {
+ return {
+ message: vi.fn(),
+ info: vi.fn(),
+ success: vi.fn(),
+ warning: vi.fn(),
+ error: vi.fn(),
+ commandOutput: vi.fn(),
+ };
+}
+
+const createdConnector = {
+ id: "scl_linq",
+ uid: "linq/agent",
+ supportedSubjectTypes: ["app"],
+};
+
+describe("Linq Connect provisioning", () => {
+ it("parses the provisioned phone number", () => {
+ expect(
+ parseCreatedLinqConnector(
+ JSON.stringify({ ...createdConnector, data: { phoneNumbers: ["+14155550123"] } }),
+ ),
+ ).toEqual({ id: "scl_linq", uid: "linq/agent", phoneNumber: "+14155550123" });
+ });
+
+ it("creates a connector for an existing Linq account without exposing its token in argv", async () => {
+ const runVercelCaptureStdout = vi
+ .fn()
+ .mockResolvedValueOnce({
+ ok: true as const,
+ stdout: JSON.stringify(createdConnector),
+ stderr: "",
+ })
+ .mockResolvedValueOnce({
+ ok: true as const,
+ stdout: JSON.stringify(createdConnector),
+ stderr: "",
+ });
+ const runVercel = vi.fn(async () => true);
+
+ await provisionLinqConnector({
+ existingAccount: { apiToken: "linq-token", phoneNumbers: ["+14155550123"] },
+ log: log(),
+ project: { orgId: "team_123", projectId: "prj_123" },
+ projectRoot: "/project",
+ slug: "agent",
+ deps: { runVercel, runVercelCaptureStdout },
+ });
+
+ expect(runVercelCaptureStdout).toHaveBeenNthCalledWith(
+ 1,
+ expect.arrayContaining(["--connector-type", "linq", "--data", "@-"]),
+ expect.objectContaining({
+ stdin: JSON.stringify({ apiToken: "linq-token", phoneNumbers: ["+14155550123"] }),
+ }),
+ );
+ expect(runVercelCaptureStdout.mock.calls[0]?.[0]).not.toContain("linq-token");
+ });
+});
diff --git a/packages/eve/src/setup/integrations/linq/connect.ts b/packages/eve/src/setup/integrations/linq/connect.ts
new file mode 100644
index 000000000..d05b8a0ef
--- /dev/null
+++ b/packages/eve/src/setup/integrations/linq/connect.ts
@@ -0,0 +1,164 @@
+import type { ChannelSetupLog } from "#setup/cli/index.js";
+import { createPromptCommandOutput, withPhase } from "#setup/cli/index.js";
+import type { ProcessOutputHandler } from "#setup/primitives/process-output.js";
+import { replaceConnectTrigger } from "#setup/connect-provisioning.js";
+import type { VercelProjectReference } from "#setup/project-resolution.js";
+import {
+ runVercel,
+ runVercelCaptureStdout,
+ type RunVercelCaptureResult,
+} from "#setup/primitives/run-vercel.js";
+import { z } from "zod";
+
+export const LINQ_TRIGGER_PATH = "/eve/v1/linq";
+export const LINQ_TRIGGER_EVENTS = ["message.received", "reaction.added", "reaction.removed"];
+
+export interface LinqConnectorRef {
+ id: string;
+ uid: string;
+ phoneNumber?: string;
+}
+
+export interface ProvisionLinqConnectorDeps {
+ runVercel: typeof runVercel;
+ runVercelCaptureStdout: typeof runVercelCaptureStdout;
+}
+
+/** Credentials for a connector backed by an existing Linq account. */
+export interface LinqExistingAccountCredentials {
+ apiToken: string;
+ phoneNumbers: string[];
+}
+
+const ConnectorSchema = z.object({
+ id: z.string().min(1),
+ uid: z.string().min(1),
+ supportedSubjectTypes: z.array(z.string()).refine((types) => types.includes("app")),
+ data: z.object({ phoneNumbers: z.array(z.string().min(1)).optional() }).optional(),
+});
+
+/** Parses Vercel Connect JSON for an app-scoped Linq connector. */
+export function parseCreatedLinqConnector(stdout: string): LinqConnectorRef | undefined {
+ try {
+ const result = ConnectorSchema.safeParse(JSON.parse(stdout));
+ if (!result.success) return undefined;
+ const phoneNumber = result.data.data?.phoneNumbers?.[0];
+ const connector: LinqConnectorRef = { id: result.data.id, uid: result.data.uid };
+ if (phoneNumber !== undefined) connector.phoneNumber = phoneNumber;
+ return connector;
+ } catch {
+ return undefined;
+ }
+}
+
+function requireCreatedConnector(result: RunVercelCaptureResult): LinqConnectorRef {
+ if (!result.ok) {
+ const detail = [result.stderr, result.stdout].find(
+ (value): value is string => value !== undefined && value.trim().length > 0,
+ );
+ throw new Error(
+ detail ? `Linq connector creation failed:\n${detail}` : "Linq connector creation failed.",
+ );
+ }
+ const connector = parseCreatedLinqConnector(result.stdout);
+ if (connector === undefined) throw new Error("Vercel returned an invalid Linq connector.");
+ return connector;
+}
+
+/** Creates a managed Linq connector and routes verified events to eve. */
+export async function provisionLinqConnector(input: {
+ /** When omitted, Connect opens Linq's managed browser flow to provision a line. */
+ existingAccount?: LinqExistingAccountCredentials;
+ log: ChannelSetupLog;
+ project: VercelProjectReference;
+ projectRoot: string;
+ slug: string;
+ signal?: AbortSignal;
+ deps?: ProvisionLinqConnectorDeps;
+}): Promise<LinqConnectorRef> {
+ const deps = input.deps ?? { runVercel, runVercelCaptureStdout };
+ const commandOutput = createPromptCommandOutput(input.log);
+ const onOutput: ProcessOutputHandler = (line) => {
+ // The headless-browser shim captures this URL separately. Keeping it out
+ // of the setup renderer prevents terminal wrapping from making it unusable.
+ if (URL.parse(line.text) !== null) return;
+ commandOutput(line);
+ };
+ const command = ["connect", "create", "linq", "--name", input.slug];
+ const stdin =
+ input.existingAccount === undefined
+ ? undefined
+ : JSON.stringify({
+ apiToken: input.existingAccount.apiToken,
+ phoneNumbers: input.existingAccount.phoneNumbers,
+ });
+ if (stdin !== undefined) command.push("--connector-type", "linq", "--data", "@-");
+ command.push(
+ "--triggers",
+ ...LINQ_TRIGGER_EVENTS.flatMap((event) => ["--trigger-event", event]),
+ "-F",
+ "json",
+ "--scope",
+ input.project.orgId,
+ );
+ const result = await withPhase(input.log, "Creating Linq connector...", () =>
+ deps.runVercelCaptureStdout(command, {
+ cwd: input.projectRoot,
+ nonInteractive: true,
+ onOutput,
+ signal: input.signal,
+ stdin,
+ }),
+ );
+ input.signal?.throwIfAborted();
+ const created = requireCreatedConnector(result);
+ const connector = await readLinqConnector({
+ connector: created,
+ projectRoot: input.projectRoot,
+ orgId: input.project.orgId,
+ signal: input.signal,
+ deps,
+ });
+ const attachment = await withPhase(input.log, "Connecting Linq credentials...", () =>
+ replaceConnectTrigger({
+ connectorUid: connector.uid,
+ projectRoot: input.projectRoot,
+ projectId: input.project.projectId,
+ orgId: input.project.orgId,
+ environment: "production",
+ triggerPath: LINQ_TRIGGER_PATH,
+ onOutput,
+ signal: input.signal,
+ deps,
+ }),
+ );
+ if (attachment.state !== "attached") {
+ throw new Error(
+ `Linq connector was created, but its trigger could not be attached. Run \`vercel connect attach ${connector.uid} --project ${input.project.projectId} --environment production --triggers --trigger-path ${LINQ_TRIGGER_PATH} --yes --scope ${input.project.orgId}\`.`,
+ );
+ }
+ return connector;
+}
+
+/** Reads managed connector data after browser creation so setup can show its line. */
+async function readLinqConnector(input: {
+ connector: LinqConnectorRef;
+ projectRoot: string;
+ orgId: string;
+ signal?: AbortSignal;
+ deps: ProvisionLinqConnectorDeps;
+}): Promise<LinqConnectorRef> {
+ const result = await input.deps.runVercelCaptureStdout(
+ [
+ "api",
+ `/v1/connect/connectors/${encodeURIComponent(input.connector.id)}`,
+ "--scope",
+ input.orgId,
+ ],
+ { cwd: input.projectRoot, nonInteractive: true, signal: input.signal },
+ );
+ if (!result.ok) return input.connector;
+ const connector = parseCreatedLinqConnector(result.stdout);
+ if (connector?.phoneNumber === undefined) return input.connector;
+ return { ...input.connector, phoneNumber: connector.phoneNumber };
+}
diff --git a/packages/eve/src/setup/integrations/linq/setup.test.ts b/packages/eve/src/setup/integrations/linq/setup.test.ts
new file mode 100644
index 000000000..6b31c61e3
--- /dev/null
+++ b/packages/eve/src/setup/integrations/linq/setup.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it, vi } from "vitest";
+
+import { createFakePrompter } from "#internal/testing/fake-prompter.js";
+import { headlessAsker, withAnswers, withPolicy } from "#setup/ask.js";
+
+vi.mock("#setup/scaffold/index.js", () => ({
+ deriveSlackConnectorSlug: vi.fn(async () => "agent"),
+}));
+
+import { prepareLinqSetup } from "./setup.js";
+import { integrationSetupEnvironment } from "../shared/environment.js";
+import { createSetupContexts } from "../shared/ui.js";
+
+function contexts(answers: Record<string, unknown> = {}) {
+ return createSetupContexts({
+ appRoot: "/project",
+ asker: withAnswers(answers)(withPolicy("assume")(headlessAsker())),
+ environment: integrationSetupEnvironment("authenticated", { kind: "unresolved" }),
+ prompter: createFakePrompter().prompter,
+ resolveVercelProject: vi.fn(async () => ({ orgId: "team", projectId: "project" })),
+ });
+}
+
+describe("Linq setup", () => {
+ it("prepares a managed Linq account by default", async () => {
+ await expect(prepareLinqSetup(contexts().prepare)).resolves.toMatchObject({
+ credentials: "connect",
+ connectorSlug: "agent",
+ project: { orgId: "team", projectId: "project" },
+ });
+ });
+
+ it("collects an existing Linq account's token and phone numbers", async () => {
+ const context = contexts({
+ "linq-account": "existing",
+ "linq-existing-api-token": "linq-token",
+ "linq-existing-phone-numbers": " +14155550123, +14155550124 ",
+ });
+
+ await expect(prepareLinqSetup(context.prepare)).resolves.toMatchObject({
+ existingAccount: {
+ apiToken: "linq-token",
+ phoneNumbers: ["+14155550123", "+14155550124"],
+ },
+ });
+ });
+});
diff --git a/packages/eve/src/setup/integrations/linq/setup.ts b/packages/eve/src/setup/integrations/linq/setup.ts
new file mode 100644
index 000000000..d09bc33cb
--- /dev/null
+++ b/packages/eve/src/setup/integrations/linq/setup.ts
@@ -0,0 +1,221 @@
+import { join } from "node:path";
+
+import { select, text } from "#setup/ask.js";
+import { appendEnv } from "#setup/append-env.js";
+import type { VercelProjectReference } from "#setup/project-resolution.js";
+import { deriveSlackConnectorSlug } from "#setup/scaffold/index.js";
+import { writeTextFile } from "#setup/scaffold/files.js";
+
+import {
+ provisionLinqConnector,
+ type LinqExistingAccountCredentials,
+} from "./connect.js";
+import {
+ defineSetupIntegration,
+ type SetupApplyContext,
+ type SetupPrepareContext,
+} from "../types.js";
+
+interface LinqSetupPlan {
+ credentials: "connect" | "portable";
+ connectorSlug?: string;
+ existingAccount?: LinqExistingAccountCredentials;
+ project?: VercelProjectReference;
+ apiKey?: string;
+ signingSecret?: string;
+}
+
+const portableTemplate = `import { linqChannel } from "eve/channels/linq";
+
+export default linqChannel({
+ credentials: {
+ apiKey: process.env.LINQ_API_KEY!,
+ signingSecret: process.env.LINQ_WEBHOOK_SECRET!,
+ },
+});
+`;
+
+function validatePhoneNumbers(value: string): string | null {
+ const phoneNumbers = value
+ .split(",")
+ .map((phoneNumber) => phoneNumber.trim())
+ .filter(Boolean);
+ if (phoneNumbers.length === 0) return "Enter at least one phone number.";
+ return phoneNumbers.every((phoneNumber) => /^\+[1-9]\d{1,14}$/.test(phoneNumber))
+ ? null
+ : "Use comma-separated E.164 numbers, for example +14155550123.";
+}
+
+function connectTemplate(uid: string): string {
+ return `import { connectLinqCredentials } from "@vercel/connect/eve";
+import { linqChannel } from "eve/channels/linq";
+
+export default linqChannel({
+ credentials: connectLinqCredentials(${JSON.stringify(uid)}),
+});
+`;
+}
+
+export async function prepareLinqSetup(context: SetupPrepareContext): Promise<LinqSetupPlan> {
+ const credentials = await context.asker.ask(
+ select({
+ key: "linq-credentials",
+ message: "How would you like to configure Linq?",
+ options: [
+ {
+ id: "connect",
+ value: "connect" as const,
+ label: "Set up Vercel Connect",
+ hint: "Provision a managed Linq line",
+ },
+ {
+ id: "portable",
+ value: "portable" as const,
+ label: "Use portable credentials",
+ hint: "Register the webhook in Linq",
+ },
+ ],
+ recommended:
+ context.environment.vercel.kind === "available"
+ ? ("connect" as const)
+ : ("portable" as const),
+ required: true,
+ }),
+ );
+ if (credentials === "connect") {
+ if (context.environment.vercel.kind === "unavailable") {
+ throw new Error(
+ "Vercel Connect requires an authenticated Vercel CLI. Run `vercel login`, then retry Linq setup.",
+ );
+ }
+ const project = await context.resolveVercelProject("Linq");
+ const connectorSlug = await context.asker.ask(
+ text({
+ key: "linq-connector-name",
+ message: "Name your Linq agent",
+ recommended: await deriveSlackConnectorSlug(context.appRoot),
+ required: true,
+ }),
+ );
+ const account = await context.asker.ask(
+ select({
+ key: "linq-account",
+ message: "Which Linq account would you like to use?",
+ options: [
+ {
+ id: "new",
+ value: "new" as const,
+ label: "Create a new Linq account",
+ hint: "Provision a new managed Linq line",
+ },
+ {
+ id: "existing",
+ value: "existing" as const,
+ label: "Use an existing Linq account",
+ hint: "Connect a Linq partner API token and phone numbers",
+ },
+ ],
+ recommended: "new" as const,
+ required: true,
+ }),
+ );
+ if (account === "new") return { credentials, connectorSlug: connectorSlug.trim(), project };
+ const apiToken = await context.asker.ask(
+ text({
+ key: "linq-existing-api-token",
+ message: "Linq partner API token",
+ required: true,
+ sensitive: true,
+ environment: "LINQ_API_KEY",
+ }),
+ );
+ const phoneNumbers = await context.asker.ask(
+ text({
+ key: "linq-existing-phone-numbers",
+ message: "Linq phone numbers",
+ placeholder: "+14155550123, +14155550124",
+ required: true,
+ validate: validatePhoneNumbers,
+ }),
+ );
+ return {
+ credentials,
+ connectorSlug: connectorSlug.trim(),
+ existingAccount: {
+ apiToken: apiToken.trim(),
+ phoneNumbers: phoneNumbers
+ .split(",")
+ .map((phoneNumber) => phoneNumber.trim())
+ .filter(Boolean),
+ },
+ project,
+ };
+ }
+ const apiKey = await context.asker.ask(
+ text({
+ key: "linq-api-key",
+ message: "Linq API key",
+ required: true,
+ sensitive: true,
+ environment: "LINQ_API_KEY",
+ }),
+ );
+ const signingSecret = await context.asker.ask(
+ text({
+ key: "linq-signing-secret",
+ message: "Linq webhook signing secret",
+ required: true,
+ sensitive: true,
+ environment: "LINQ_WEBHOOK_SECRET",
+ }),
+ );
+ return { credentials, apiKey: apiKey.trim(), signingSecret: signingSecret.trim() };
+}
+
+export async function applyLinqSetup(plan: LinqSetupPlan, context: SetupApplyContext) {
+ const path = join(context.appRoot, "agent/channels/linq.ts");
+ let phoneNumber: string | undefined;
+ if (plan.credentials === "connect") {
+ const connectorInput: Parameters<typeof provisionLinqConnector>[0] = {
+ log: context.presenter.log,
+ project: plan.project!,
+ projectRoot: context.appRoot,
+ slug: plan.connectorSlug!,
+ signal: context.signal,
+ };
+ if (plan.existingAccount !== undefined) {
+ connectorInput.existingAccount = plan.existingAccount;
+ }
+ const connector = await provisionLinqConnector(connectorInput);
+ phoneNumber = connector.phoneNumber;
+ await writeTextFile(path, connectTemplate(connector.uid), { force: context.force });
+ if (phoneNumber !== undefined) {
+ context.presenter.note(phoneNumber, "Text your agent", { tone: "success" });
+ }
+ } else {
+ await appendEnv(join(context.appRoot, ".env.local"), {
+ LINQ_API_KEY: plan.apiKey!,
+ LINQ_WEBHOOK_SECRET: plan.signingSecret!,
+ });
+ await writeTextFile(path, portableTemplate, { force: context.force });
+ context.presenter.nextSteps([
+ "Deploy the agent, then create a Linq webhook subscription for https://<your-host>/eve/v1/linq with message.received, reaction.added, and reaction.removed events.",
+ ]);
+ }
+ context.presenter.log.success("Scaffolded channel: linq");
+ return {
+ facts:
+ phoneNumber === undefined
+ ? []
+ : [{ label: "Agent phone number", value: phoneNumber, kind: "phone" as const }],
+ deploymentRequired: true as const,
+ };
+}
+
+export const LINQ_SETUP = defineSetupIntegration({
+ kind: "linq",
+ label: "Linq",
+ hint: "iMessage and SMS through Linq",
+ prepare: prepareLinqSetup,
+ apply: applyLinqSetup,
+});
diff --git a/packages/eve/src/setup/integrations/registry.ts b/packages/eve/src/setup/integrations/registry.ts
index 24a3a787e..fddfbeb1a 100644
--- a/packages/eve/src/setup/integrations/registry.ts
+++ b/packages/eve/src/setup/integrations/registry.ts
@@ -1,6 +1,7 @@
import { DISCORD_SETUP } from "./discord/setup.js";
import { GITHUB_SETUP } from "./github/setup.js";
import { LINEAR_SETUP } from "./linear/setup.js";
+import { LINQ_SETUP } from "./linq/setup.js";
import { PHOTON_SETUP } from "./photon/setup.js";
import { SLACK_SETUP } from "./slack/setup.js";
import type { SetupIntegration } from "./types.js";
@@ -13,6 +14,7 @@ export const SETUP_INTEGRATIONS: readonly SetupIntegration[] = [
DISCORD_SETUP,
GITHUB_SETUP,
LINEAR_SETUP,
+ LINQ_SETUP,
PHOTON_SETUP,
];
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 880b6ccde..1a9544483 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -289,9 +289,6 @@ importers:
'@larksuite/vercel-chat-adapter':
specifier: 0.1.2
- '@linqapp/chat-sdk-adapter':
- specifier: 0.1.0
'@liveblocks/chat-sdk-adapter':
specifier: 3.23.0
@@ -1199,6 +1196,9 @@ importers:
'@eve/catalog':
specifier: workspace:*
version: link:../eve-catalog
+ '@linqapp/chat-sdk-adapter':
+ specifier: ^0.3.0
'@modelcontextprotocol/server':
specifier: 2.0.0
version: 2.0.0
@@ -3223,13 +3223,13 @@ packages:
'@larksuiteoapi/[email protected]':
resolution: {integrity: sha512-bVC2QVkITZ1i6kLP7hI7DXtp61ic9shP/F+bp/2qZ0ISSvrcHp2euu1xt6C29jPJVNieRgvdsBPuapOlybviVw==}
- '@linqapp/[email protected]':
- resolution: {integrity: sha512-/4OSAxcJWYqwoqsG73b1ElUhETOOsL/ufXUanGLgg3t2xGkpu412dUWqUboVffFS1zdDqciSnvXSXpIAWnGpiw==}
+ '@linqapp/[email protected]':
+ resolution: {integrity: sha512-mOh3y3G+xL6y8yztmB58CC6juxu3JAThSdLzV07+4Cjy+zHk9auDjSlbs+QyxSQC1ZW0Hu2Y60I5Y5J04Dr/BA==}
peerDependencies:
chat: ^4.28.1
- '@linqapp/[email protected]':
- resolution: {integrity: sha512-JCzOKegSIwHTDdizS6dUgHJ+90iVh9TO8+bLMg5+UE2qWl+r848/Wdy0M+2V8dwoVPUbb+vtG4sDN4ultpzqVQ==}
+ '@linqapp/[email protected]':
+ resolution: {integrity: sha512-t5Kilu+MPQQucAXy9bG3jlLvDHnlR36banKC74TbpJ9ZOrPa8nHyUHPk9/Y4eAVzaM+TzlxV8dZrkit4kuhWWw==}
'@liveblocks/[email protected]':
resolution: {integrity: sha512-tQo6AElxPKkI7g5XuiFLHa+EcT48S3TxPXykGUMf4IdIDt7YqVPCcFPDaI9oyN3AMyrZcavoz7+lTZZZznGC4w==}
@@ -17429,12 +17429,15 @@ snapshots:
- debug
- utf-8-validate
dependencies:
- '@linqapp/sdk': 0.22.1
+ '@linqapp/sdk': 0.40.0
+ standardwebhooks: 1.0.0
- '@linqapp/[email protected]': {}
+ '@linqapp/[email protected]':
+ dependencies:
+ standardwebhooks: 1.0.0
dependencies:
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 3992a3c41..8ef32efd5 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -59,6 +59,7 @@ catalog:
minimumReleaseAge: 2880 # 2 days
minimumReleaseAgeExclude:
+ - "@linqapp/chat-sdk-adapter"
- "@vercel/*"
- "@workflow/*"
- nitro