@segmentstream/agent 0.32.0 → 0.33.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.
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- var version = "0.32.0";
7
+ var version = "0.33.0";
8
8
  function agentBuild(environment = process.env) {
9
9
  return {
10
10
  agent: version,
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `POST /eve/v1/whatsapp`: the workspace's WhatsApp number, through the connection named in
3
+ * `channels.whatsapp`. SegmentStream relays the number's messages here. Without that setting, or
4
+ * outside production, the route answers 404.
5
+ */
6
+ declare const _default: import("eve/channels/chat-sdk").ChatSdkChannel;
7
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ const __filename = __eveFileURLToPath(import.meta.url);
5
+ __eveDirname(__filename);
6
+ __eveCreateRequire(import.meta.url);
7
+ import segmentstream from "../extension.mjs";
8
+ import { segmentstreamWhatsApp } from "../lib/whatsapp/adapter.mjs";
9
+ var whatsapp_default = segmentstreamWhatsApp({
10
+ settings: () => segmentstream.config.channels.whatsapp,
11
+ admission: () => segmentstream.config
12
+ });
13
+ export { whatsapp_default as default };
@@ -96,6 +96,10 @@ export interface SegmentStreamAgentConfigInput {
96
96
  readonly contextVersion?: number;
97
97
  };
98
98
  };
99
+ readonly whatsapp?: {
100
+ /** The key of the workspace's `WhatsAppConnection`, such as `whatsapp`. */
101
+ readonly connection: string;
102
+ };
99
103
  };
100
104
  readonly models?: {
101
105
  /**
@@ -195,6 +199,7 @@ export interface SegmentStreamAgentConfig extends AdmissionSettings {
195
199
  readonly groups: GroupPolicy;
196
200
  readonly channels: {
197
201
  readonly telegram: TelegramSettings | null;
202
+ readonly whatsapp: WhatsAppSettings | null;
198
203
  };
199
204
  readonly models: {
200
205
  /**
@@ -231,6 +236,13 @@ export declare class SegmentStreamAgentConfigError extends Error {
231
236
  readonly name = "SegmentStreamAgentConfigError";
232
237
  constructor(issues: ReadonlyArray<ConfigIssue>);
233
238
  }
239
+ /**
240
+ * The WhatsApp channel: the number of the workspace's `WhatsAppConnection` answers the members who
241
+ * paired their WhatsApp account. SegmentStream relays the number's messages to the agent.
242
+ */
243
+ export interface WhatsAppSettings {
244
+ readonly connection: string;
245
+ }
234
246
  /**
235
247
  * The chat model choice `agent.ts` passes to `segmentstream.model()`, validated like `models.chat`
236
248
  * of `agent/segmentstream.json`, where it normally comes from.
@@ -67,6 +67,24 @@ function section(input) {
67
67
  function isTelegramPolicy(value) {
68
68
  return TELEGRAM_POLICIES.some((policy) => policy === value);
69
69
  }
70
+ function whatsappSettings(value, issues) {
71
+ const path = ["channels", "whatsapp"];
72
+ const whatsapp = section({
73
+ value,
74
+ path,
75
+ allowed: ["connection"],
76
+ issues
77
+ });
78
+ if (whatsapp === void 0) return null;
79
+ if (typeof whatsapp.connection !== "string" || !CONNECTION_KEY.test(whatsapp.connection)) {
80
+ issues.push({
81
+ message: "must be a connection key such as whatsapp",
82
+ path: [...path, "connection"]
83
+ });
84
+ return null;
85
+ }
86
+ return { connection: whatsapp.connection };
87
+ }
70
88
  function telegramSettings(value, issues) {
71
89
  const path = ["channels", "telegram"];
72
90
  const telegram = section({
@@ -535,7 +553,7 @@ function validateConfig(input, options = {}) {
535
553
  const channels = section({
536
554
  value: root?.channels,
537
555
  path: ["channels"],
538
- allowed: ["telegram"],
556
+ allowed: ["telegram", "whatsapp"],
539
557
  issues
540
558
  });
541
559
  const models = section({
@@ -567,6 +585,7 @@ function validateConfig(input, options = {}) {
567
585
  path: ["confirmations", "mode"]
568
586
  });
569
587
  const telegram = telegramSettings(channels?.telegram, issues);
588
+ const whatsapp = whatsappSettings(channels?.whatsapp, issues);
570
589
  for (const issue of groupPolicyIssues(root?.groups)) issues.push({
571
590
  ...issue,
572
591
  path: ["groups", ...issue.path]
@@ -681,6 +700,10 @@ function validateConfig(input, options = {}) {
681
700
  ]
682
701
  });
683
702
  }
703
+ if (whatsapp !== null && replies.pairingRequired === void 0) issues.push({
704
+ message: "is required for WhatsApp",
705
+ path: ["replies", "pairingRequired"]
706
+ });
684
707
  if (typeof connection !== "boolean") issues.push({
685
708
  message: "must be true or false",
686
709
  path: ["ontology", "connection"]
@@ -693,10 +716,13 @@ function validateConfig(input, options = {}) {
693
716
  if (issues.length > 0) return { issues };
694
717
  return { value: {
695
718
  groups,
696
- channels: { telegram: telegram === null ? null : {
697
- ...telegram,
698
- policy: groups.mode
699
- } },
719
+ channels: {
720
+ telegram: telegram === null ? null : {
721
+ ...telegram,
722
+ policy: groups.mode
723
+ },
724
+ whatsapp
725
+ },
700
726
  models: {
701
727
  chat,
702
728
  stt,
@@ -4,4 +4,4 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- export { t as agentBuild } from "../../_chunks/build-metadata-B_hCvO_v.mjs";
7
+ export { t as agentBuild } from "../../_chunks/build-metadata-DpwHNeNL.mjs";
@@ -10,7 +10,7 @@ import { groupRoutingHealth } from "../group-routing/health.mjs";
10
10
  import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
11
11
  import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
12
12
  import { telegramText, withTelegramTexts } from "./texts.mjs";
13
- import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
13
+ import { t as agentBuild } from "../../../_chunks/build-metadata-DpwHNeNL.mjs";
14
14
  import { attachmentLifecycle } from "./lifecycle.mjs";
15
15
  import { manifestOf } from "../../config.mjs";
16
16
  import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
7
+ import { t as agentBuild } from "../../../_chunks/build-metadata-DpwHNeNL.mjs";
8
8
  import { runtimeRequestFailure } from "./runtime-request.mjs";
9
9
  import { GET } from "eve/channels";
10
10
  const HEALTH_ROUTE = "/eve/v1/telegram/health";
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
7
  import { d as telegramRuntimeSource, l as principalRuntimeSource, u as runtimeEnvelope } from "../../../_chunks/principal-VsmaJp1x.mjs";
8
- import { t as agentBuild } from "../../../_chunks/build-metadata-B_hCvO_v.mjs";
8
+ import { t as agentBuild } from "../../../_chunks/build-metadata-DpwHNeNL.mjs";
9
9
  import { n as currentInboundRequest } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
10
10
  import { object } from "../confirmation-description.mjs";
11
11
  import { needsConfirmation } from "../confirmations.mjs";
@@ -0,0 +1,81 @@
1
+ import { WhatsAppAdapter } from "@chat-adapter/whatsapp";
2
+ import { type Message, type WebhookOptions } from "chat";
3
+ import type { SessionAuthContext } from "eve/context";
4
+ import type { AdmissionSettings, WhatsAppSettings } from "../../config.js";
5
+ import { type ConnectionProxy } from "../connection-proxy.js";
6
+ import { type Environment } from "../environment.js";
7
+ import { type AgentIdentities, type PairedMember } from "../identities.js";
8
+ import { type RuntimeToken } from "../runtime-token.js";
9
+ /**
10
+ * The SegmentStream WhatsApp channel (`agent-design.md`, "Channels"): eve's Chat SDK bridge with
11
+ * the Chat SDK WhatsApp adapter, at `POST /eve/v1/whatsapp`. SegmentStream's Meta app receives the
12
+ * number's webhooks and relays its messages here, signed as Meta signs them with the project's
13
+ * `SEGMENTSTREAM_AGENT_WEBHOOK_SECRET`. Replies, read receipts, typing and media downloads go
14
+ * through the workspace's `WhatsAppConnection` by the connection proxy, which addresses the number
15
+ * as `/phone`: no Meta token or number ID enters this process.
16
+ *
17
+ * Only paired members are answered. A sender nobody paired gets the workspace's
18
+ * `replies.pairingRequired` text and a link to the app's `/agent/connect`.
19
+ */
20
+ /** The authenticator of a WhatsApp session's principal. */
21
+ export declare const WHATSAPP_AUTHENTICATOR = "segmentstream-whatsapp";
22
+ /** The origin the adapter's Graph calls are aimed at. `.invalid` never resolves (RFC 6761). */
23
+ export declare const WHATSAPP_PROXY_ORIGIN = "https://whatsapp.segmentstream.invalid";
24
+ /** The adapter sent a request this channel does not route through the proxy. */
25
+ export declare class WhatsAppProxyRouteError extends Error {
26
+ readonly name = "WhatsAppProxyRouteError";
27
+ }
28
+ export interface WhatsAppChannelOptions {
29
+ /** The mounted `channels.whatsapp`, or `null` when the workspace has no WhatsApp channel. */
30
+ readonly settings: () => WhatsAppSettings | null;
31
+ readonly admission: () => AdmissionSettings;
32
+ readonly environment?: Environment;
33
+ readonly token?: RuntimeToken;
34
+ /** For the proxy and the ontology service; tests pass a fake. */
35
+ readonly fetch?: typeof fetch;
36
+ /** The ontology's pairing routes; tests pass a fake. */
37
+ readonly identities?: AgentIdentities;
38
+ }
39
+ /** What the adapter reads per request: eve binds the mount after it loads the channel. */
40
+ interface WhatsAppRuntime {
41
+ readonly enabled: () => boolean;
42
+ readonly secret: () => string | undefined;
43
+ readonly proxy: () => ConnectionProxy;
44
+ }
45
+ /**
46
+ * The Chat SDK WhatsApp adapter with its network replaced: it accepts only the platform's relayed
47
+ * deliveries and sends every Graph request through the connection proxy.
48
+ */
49
+ export declare class ProxiedWhatsAppAdapter extends WhatsAppAdapter {
50
+ #private;
51
+ constructor(runtime: WhatsAppRuntime);
52
+ /** 404 until the channel is configured in production; the platform never sends a handshake. */
53
+ handleWebhook(request: Request, options?: WebhookOptions): Promise<Response>;
54
+ /** The platform signs each relayed body with the project's agent webhook secret. */
55
+ protected verifySignature(body: string, signature: string | null): boolean;
56
+ protected graphApiRequest<T = unknown>(path: string, body: unknown): Promise<T>;
57
+ /** Uploads are not admitted by the connection; messages send media by link. */
58
+ protected graphApiUpload<T = unknown>(): Promise<T>;
59
+ /** The media's URL by `GET /media/{id}`, then its bytes through the connection's `media` API. */
60
+ downloadMedia(mediaId: string): Promise<Buffer>;
61
+ }
62
+ /** The adapter addresses the number by its ID, which here is the proxy's `/phone` alias. */
63
+ export declare function proxyPath(path: string): string;
64
+ /** The principal of a paired member's WhatsApp session, as the Telegram channel stamps one. */
65
+ export declare function whatsappPrincipal(member: PairedMember, sender: string): SessionAuthContext;
66
+ /** Builds the channel. Everything it reads from the mount is read per request. */
67
+ export declare function segmentstreamWhatsApp(options: WhatsAppChannelOptions): import("eve/channels/chat-sdk").ChatSdkChannel;
68
+ /**
69
+ * Admits one inbound message: the principal of a paired member who wrote something, or undefined
70
+ * after answering anyone else with the workspace's reply, if it has one.
71
+ */
72
+ export declare function receive(input: {
73
+ readonly thread: {
74
+ readonly post: (text: string) => Promise<unknown>;
75
+ };
76
+ readonly message: Pick<Message, "author" | "text" | "attachments">;
77
+ readonly admission: AdmissionSettings;
78
+ readonly identities: AgentIdentities;
79
+ readonly environment: Environment;
80
+ }): Promise<SessionAuthContext | undefined>;
81
+ export {};
@@ -0,0 +1,237 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ const __filename = __eveFileURLToPath(import.meta.url);
5
+ __eveDirname(__filename);
6
+ __eveCreateRequire(import.meta.url);
7
+ import { admitMessage, localizedText } from "../admission.mjs";
8
+ import { redactDiagnostic } from "../diagnostics.mjs";
9
+ import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
10
+ import { appOrigin, channelsEnabled, proxyEnvironment, webhookSecret } from "../environment.mjs";
11
+ import { agentIdentities } from "../identities.mjs";
12
+ import { runtimeToken } from "../runtime-token.mjs";
13
+ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
14
+ import { createMemoryState } from "@chat-adapter/state-memory";
15
+ import { WhatsAppAdapter, WhatsAppApiError } from "@chat-adapter/whatsapp";
16
+ import { ConsoleLogger } from "chat";
17
+ import { chatSdkChannel, messageContentOf } from "eve/channels/chat-sdk";
18
+ const WHATSAPP_AUTHENTICATOR = "segmentstream-whatsapp";
19
+ const WHATSAPP_PROXY_ORIGIN = "https://whatsapp.segmentstream.invalid";
20
+ const API_VERSION = "v26.0";
21
+ const PLACEHOLDER = "segmentstream-connection";
22
+ const PHONE_ALIAS = "phone";
23
+ const MEDIA_ORIGIN = "https://lookaside.fbsbx.com";
24
+ var WhatsAppProxyRouteError = class extends Error {
25
+ name = "WhatsAppProxyRouteError";
26
+ };
27
+ var ProxiedWhatsAppAdapter = class extends WhatsAppAdapter {
28
+ #runtime;
29
+ constructor(runtime) {
30
+ super({
31
+ accessToken: PLACEHOLDER,
32
+ appSecret: PLACEHOLDER,
33
+ verifyToken: PLACEHOLDER,
34
+ phoneNumberId: PHONE_ALIAS,
35
+ apiUrl: WHATSAPP_PROXY_ORIGIN,
36
+ apiVersion: API_VERSION,
37
+ userName: "agent",
38
+ logger: new ConsoleLogger("warn", "whatsapp")
39
+ });
40
+ this.#runtime = runtime;
41
+ }
42
+ async handleWebhook(request, options) {
43
+ if (!this.#runtime.enabled()) return new Response(null, { status: 404 });
44
+ if (request.method !== "POST") return new Response(null, { status: 405 });
45
+ return super.handleWebhook(request, options);
46
+ }
47
+ verifySignature(body, signature) {
48
+ const secret = this.#runtime.secret();
49
+ if (secret === void 0 || signature === null) return false;
50
+ const expected = `sha256=${createHmac("sha256", secret).update(body, "utf8").digest("hex")}`;
51
+ return timingSafeEqual(digest(expected), digest(signature.trim().toLowerCase()));
52
+ }
53
+ async graphApiRequest(path, body) {
54
+ return this.#graph({
55
+ api: "graph",
56
+ method: "POST",
57
+ path: proxyPath(path),
58
+ headers: [["content-type", "application/json"]],
59
+ body: new TextEncoder().encode(JSON.stringify(body))
60
+ }, "WhatsApp API error");
61
+ }
62
+ async graphApiUpload() {
63
+ throw new WhatsAppProxyRouteError("The WhatsApp connection does not admit media uploads; send media by link.");
64
+ }
65
+ async downloadMedia(mediaId) {
66
+ if (!/^[0-9]{1,32}$/.test(mediaId)) throw new WhatsAppProxyRouteError("A WhatsApp media ID is numeric.");
67
+ const described = await this.#graph({
68
+ api: "graph",
69
+ method: "GET",
70
+ path: `/media/${mediaId}`,
71
+ headers: [],
72
+ body: new Uint8Array()
73
+ }, "Failed to get media URL");
74
+ const url = typeof described.url === "string" ? new URL(described.url) : void 0;
75
+ if (url === void 0 || url.origin !== MEDIA_ORIGIN) throw new WhatsAppProxyRouteError("WhatsApp media is downloaded only from its own host.");
76
+ const reply = await this.#runtime.proxy().download({
77
+ api: "media",
78
+ method: "GET",
79
+ path: `${url.pathname}${url.search}`,
80
+ headers: [],
81
+ body: new Uint8Array()
82
+ }, MAXIMUM_DOWNLOAD_BYTES);
83
+ if (reply.status < 200 || reply.status >= 300) throw new WhatsAppApiError(`Failed to download media ${mediaId}`, reply.status, new TextDecoder().decode(reply.body));
84
+ return Buffer.from(reply.body);
85
+ }
86
+ async #graph(call, label) {
87
+ const reply = await this.#runtime.proxy().request(call);
88
+ const text = new TextDecoder().decode(reply.body);
89
+ if (reply.status < 200 || reply.status >= 300) throw new WhatsAppApiError(label, reply.status, text);
90
+ return JSON.parse(text);
91
+ }
92
+ };
93
+ function proxyPath(path) {
94
+ if (path !== `/${PHONE_ALIAS}` && !path.startsWith(`/${PHONE_ALIAS}/`)) throw new WhatsAppProxyRouteError("The WhatsApp channel sends only as the connected number.");
95
+ return path;
96
+ }
97
+ function report(operation, error) {
98
+ console.error("[segmentstream] WhatsApp delivery diagnostic", {
99
+ operation,
100
+ error: redactDiagnostic(error, new Set())
101
+ });
102
+ }
103
+ function digest(value) {
104
+ return createHash("sha256").update(value, "utf8").digest();
105
+ }
106
+ function whatsappPrincipal(member, sender) {
107
+ return {
108
+ authenticator: WHATSAPP_AUTHENTICATOR,
109
+ issuer: "whatsapp",
110
+ principalId: `whatsapp:${sender}`,
111
+ principalType: "user",
112
+ subject: sender,
113
+ attributes: {
114
+ memberId: member.id,
115
+ identityProvider: "whatsapp",
116
+ roles: member.roles,
117
+ ...member.name === null ? {} : { memberName: member.name },
118
+ ...member.locale === void 0 ? {} : { locale: member.locale }
119
+ }
120
+ };
121
+ }
122
+ function segmentstreamWhatsApp(options) {
123
+ const environment = options.environment ?? process.env;
124
+ const token = options.token ?? runtimeToken;
125
+ const proxies = new Map();
126
+ let identities = options.identities;
127
+ const runtime = {
128
+ enabled: () => channelsEnabled(environment) && options.settings() !== null && webhookSecret(environment) !== void 0,
129
+ secret: () => webhookSecret(environment),
130
+ proxy: () => {
131
+ const connection = options.settings()?.connection;
132
+ if (connection === void 0) throw new Error("The WhatsApp channel is not configured in agent/segmentstream.json.");
133
+ let existing = proxies.get(connection);
134
+ if (existing === void 0) {
135
+ existing = connectionProxy({
136
+ environment: proxyEnvironment(environment),
137
+ connection,
138
+ token,
139
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch }
140
+ });
141
+ proxies.set(connection, existing);
142
+ }
143
+ return existing;
144
+ }
145
+ };
146
+ const pairing = () => identities ??= agentIdentities({
147
+ origin: appOrigin(environment),
148
+ token,
149
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch }
150
+ });
151
+ async function pairedPrincipal(sender) {
152
+ const lookup = await pairing().lookup({
153
+ provider: "whatsapp",
154
+ externalId: sender
155
+ });
156
+ return lookup.status === "paired" ? whatsappPrincipal(lookup.member, sender) : null;
157
+ }
158
+ const bridge = chatSdkChannel({
159
+ userName: "agent",
160
+ adapters: { whatsapp: new ProxiedWhatsAppAdapter(runtime) },
161
+ state: createMemoryState(),
162
+ streaming: false,
163
+ resolveInputAuth: (event) => event.user?.userId === void 0 ? null : pairedPrincipal(event.user.userId)
164
+ });
165
+ bridge.bot.onDirectMessage((thread, message) => receive({
166
+ thread,
167
+ message,
168
+ admission: options.admission(),
169
+ identities: pairing(),
170
+ environment
171
+ }).then((admitted) => admitted === void 0 ? void 0 : bridge.send(messageContentOf(message), {
172
+ thread,
173
+ idempotencyKey: message.id,
174
+ auth: admitted
175
+ })).then(() => void 0));
176
+ return bridge.channel;
177
+ }
178
+ async function receive(input) {
179
+ const { thread, message, admission, identities } = input;
180
+ if (message.author.isMe) return;
181
+ const sender = message.author.userId;
182
+ const display = message.author.fullName.trim() || void 0;
183
+ const turn = message.text.trim() !== "" || message.attachments.length > 0;
184
+ const resolution = await admitMessage({
185
+ identity: {
186
+ provider: "whatsapp",
187
+ externalId: sender,
188
+ chat: "private",
189
+ turn,
190
+ ...display === void 0 ? {} : { display }
191
+ },
192
+ identities,
193
+ settings: admission,
194
+ sendNotice: (text) => thread.post(text),
195
+ noticeFailed: (error) => report("notice_failed", error)
196
+ });
197
+ switch (resolution.status) {
198
+ case "existing":
199
+ case "created": return turn ? whatsappPrincipal(resolution.member, sender) : void 0;
200
+ case "pairing_required": {
201
+ const text = localizedText(admission.replies.pairingRequired);
202
+ if (text !== void 0) {
203
+ const code = (await identities.createPairing({
204
+ provider: "whatsapp",
205
+ externalId: sender,
206
+ ...display === void 0 ? {} : { display }
207
+ })).code;
208
+ await thread.post(`${text}\n\n${appOrigin(input.environment)}/agent/connect?code=${encodeURIComponent(code)}`);
209
+ }
210
+ return;
211
+ }
212
+ case "refused": {
213
+ const text = localizedText(admission.replies.refused);
214
+ if (text !== void 0) await thread.post(text);
215
+ return;
216
+ }
217
+ case "limited": {
218
+ const replies = admission.replies;
219
+ const configured = resolution.scope === "workspaceTurnsPerDay" ? replies.workspaceLimited : resolution.scope === "newUsersPerHour" ? replies.registrationsLimited : replies.perSenderLimited;
220
+ const text = resolution.notify ? localizedText(configured ?? replies.limited) : void 0;
221
+ if (text !== void 0) {
222
+ let delivered = false;
223
+ try {
224
+ await thread.post(text);
225
+ delivered = true;
226
+ } finally {
227
+ if (resolution.notificationId !== void 0) await identities.completeLimitNotice({
228
+ notificationId: resolution.notificationId,
229
+ delivered
230
+ }).catch((error) => report("limit_notice_completion_failed", error));
231
+ }
232
+ }
233
+ return;
234
+ }
235
+ }
236
+ }
237
+ export { ProxiedWhatsAppAdapter, WHATSAPP_AUTHENTICATOR, WHATSAPP_PROXY_ORIGIN, WhatsAppProxyRouteError, proxyPath, receive, segmentstreamWhatsApp, whatsappPrincipal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/agent",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Mount a SegmentStream workspace's agent on eve: the ontology as tools, acting as the member who writes, and Telegram through the workspace's connection.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",
@@ -73,10 +73,13 @@
73
73
  "eval:routing": "tsx tests/routing-eval/cli.ts"
74
74
  },
75
75
  "dependencies": {
76
+ "@chat-adapter/state-memory": "4.42.0",
76
77
  "@chat-adapter/telegram": "4.41.0",
78
+ "@chat-adapter/whatsapp": "4.42.0",
77
79
  "@segmentstream-cloud/ontology": "0.90.0",
78
80
  "@vercel/oidc": "^3.8.4",
79
81
  "ai": "^7.0.137",
82
+ "chat": "4.42.0",
80
83
  "csv-parse": "^7.0.3",
81
84
  "decimal.js": "^10.6.0",
82
85
  "fast-xml-parser": "^5.11.2",
@@ -93,9 +96,9 @@
93
96
  "devDependencies": {
94
97
  "@types/node": "^24",
95
98
  "eve": "1.0.0-rc.6",
99
+ "tsx": "^4",
96
100
  "typescript": "^5.9",
97
- "vitest": "^4.1.11",
98
- "tsx": "^4"
101
+ "vitest": "^4.1.11"
99
102
  },
100
103
  "publishConfig": {
101
104
  "access": "public"