@segmentstream/agent 0.75.0 → 0.76.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/CHANGELOG.md +25 -0
- package/README.md +1 -0
- package/dist/_chunks/{build-metadata-CLenocka.mjs → build-metadata-DIf8SOej.mjs} +1 -1
- package/dist/_chunks/{chat-archive-DHYplDT5.mjs → chat-archive-BVngSwuB.mjs} +1 -1
- package/dist/extension/config.d.ts +15 -0
- package/dist/extension/config.mjs +25 -5
- package/dist/extension/connections/ontology.mjs +1 -1
- package/dist/extension/extension.d.ts +1 -1
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/instructions/persona.mjs +1 -1
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/admission.d.ts +8 -3
- package/dist/extension/lib/admission.mjs +14 -2
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/attachments-send.mjs +1 -1
- package/dist/extension/lib/attachments.mjs +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-address.mjs +1 -1
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/chat-messages.d.ts +37 -3
- package/dist/extension/lib/chat-messages.mjs +45 -7
- package/dist/extension/lib/chat-recorder.mjs +1 -1
- package/dist/extension/lib/confirmations.mjs +1 -1
- package/dist/extension/lib/email/attachments-send.mjs +1 -1
- package/dist/extension/lib/email/channel.mjs +1 -1
- package/dist/extension/lib/guest-usage.mjs +1 -1
- package/dist/extension/lib/inbound-media/files.mjs +1 -1
- package/dist/extension/lib/inbound-media/index.mjs +1 -1
- package/dist/extension/lib/ontology-connection.mjs +1 -1
- package/dist/extension/lib/ontology-file-call.mjs +1 -1
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/review/hold.mjs +1 -1
- package/dist/extension/lib/review/reply.mjs +1 -1
- package/dist/extension/lib/role-skill.mjs +1 -1
- package/dist/extension/lib/runtime-envelope.mjs +1 -1
- package/dist/extension/lib/sent-files.mjs +1 -1
- package/dist/extension/lib/slack/adapter.mjs +1 -1
- package/dist/extension/lib/slack/attachments-send.mjs +1 -1
- package/dist/extension/lib/slack/callbacks.mjs +1 -1
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +3 -3
- package/dist/extension/lib/telegram/attachment-description.mjs +1 -1
- package/dist/extension/lib/telegram/attachments-send.mjs +1 -1
- package/dist/extension/lib/telegram/callbacks.mjs +1 -1
- package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
- package/dist/extension/lib/telegram/confirmations.mjs +1 -1
- package/dist/extension/lib/telegram/customer-text.mjs +1 -1
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +2 -2
- package/dist/extension/lib/telegram/lifecycle.mjs +2 -2
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
- package/dist/extension/lib/telegram/silent.mjs +1 -1
- package/dist/extension/lib/telegram/store-capture.mjs +1 -1
- package/dist/extension/lib/telegram/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/web/auth.mjs +1 -1
- package/dist/extension/lib/web/channel.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.d.ts +6 -2
- package/dist/extension/lib/whatsapp/adapter.mjs +43 -9
- package/dist/extension/lib/whatsapp/attachments-send.mjs +1 -1
- package/dist/extension/lib/whatsapp/callbacks.mjs +1 -1
- package/dist/extension/lib/whatsapp/changes.d.ts +5 -4
- package/dist/extension/lib/whatsapp/changes.mjs +2 -2
- package/dist/extension/lib/whatsapp/echoes.d.ts +4 -3
- package/dist/extension/lib/whatsapp/echoes.mjs +2 -2
- package/dist/extension/lib/whatsapp/files.mjs +1 -1
- package/dist/extension/lib/workspace-action.mjs +1 -1
- package/dist/extension/lib/workspace-channel/attachments-send.mjs +1 -1
- package/dist/extension/lib/workspace-channel/channel.mjs +29 -15
- package/dist/extension/lib/workspace-source.mjs +1 -1
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/tools/attachments_discard.mjs +1 -1
- package/dist/extension/tools/attachments_list.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/attachments_read.mjs +1 -1
- package/dist/extension/tools/attachments_send.mjs +1 -1
- package/dist/extension/tools/attachments_stage.mjs +1 -1
- package/dist/extension/tools/attachments_table.mjs +1 -1
- package/dist/extension/tools/handoff.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/dist/extension/tools/workspace_source.mjs +1 -1
- package/package.json +2 -2
- package/dist/_chunks/{principal-Zf42Yf4r.mjs → principal-C7aAjyt4.mjs} +2 -2
|
@@ -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 { Ft as chatChannel, Pt as chatAddressOf, i as memberIdOf } from "../../../_chunks/principal-
|
|
7
|
+
import { Ft as chatChannel, Pt as chatAddressOf, i as memberIdOf } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { a as chatEvent, r as chatArchive } from "../../../_chunks/chat-archive-CDk-FPLX.mjs";
|
|
9
9
|
import { stampedChat } from "../chat-recorder.mjs";
|
|
10
10
|
import { appOrigin } from "../environment.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 { a as rolesOf } from "../../_chunks/principal-
|
|
7
|
+
import { a as rolesOf } from "../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { defineDynamic, defineSkill } from "eve/skills";
|
|
9
9
|
function forRoles(roles, skill) {
|
|
10
10
|
if (!Array.isArray(roles) || roles.length === 0 || !roles.every((role) => typeof role === "string" && role.trim() !== "")) throw new TypeError("forRoles() needs at least one role name; a skill for everyone is an ordinary skill file.");
|
|
@@ -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 { wt as RUNTIME_SOURCE_PROTOCOL, Tt as compatibleRuntimeEnvelope, Et as principalRuntimeSource, Dt as readableRuntimeEnvelope, Ot as runtimeEnvelope, kt as telegramRuntimeSource } from "../../_chunks/principal-
|
|
7
|
+
export { wt as RUNTIME_SOURCE_PROTOCOL, Tt as compatibleRuntimeEnvelope, Et as principalRuntimeSource, Dt as readableRuntimeEnvelope, Ot as runtimeEnvelope, kt as telegramRuntimeSource } from "../../_chunks/principal-C7aAjyt4.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 { Nt as SESSION_HEADER, R as ACT_AS_HEADER, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER } from "../../_chunks/principal-
|
|
7
|
+
import { Nt as SESSION_HEADER, R as ACT_AS_HEADER, _ as AttachmentError, jt as CHAT_HEADER, v as EARLIER_CHAT_HEADER } from "../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { fetchFileGrant, transientFileStatus } from "./file-grant.mjs";
|
|
9
9
|
var StoredFileError = class extends AttachmentError {
|
|
10
10
|
filename;
|
|
@@ -8,7 +8,7 @@ import { admitMessage, localizedText } from "../admission.mjs";
|
|
|
8
8
|
import { agentToolsAttribute } from "../agent-tools.mjs";
|
|
9
9
|
import { agentChats, channelChats } from "../chats.mjs";
|
|
10
10
|
import { withButtonDecision } from "../confirmation-buttons.mjs";
|
|
11
|
-
import { b as agentAttachments, d as prepareInboundMedia, m as turnContent, zt as withChatAddress } from "../../../_chunks/principal-
|
|
11
|
+
import { b as agentAttachments, d as prepareInboundMedia, m as turnContent, zt as withChatAddress } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
12
12
|
import { channelAttributes, currentChannel, withNamedRoutes, withSessionChannels } from "../channel-scope.mjs";
|
|
13
13
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
14
14
|
import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.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 { _ as AttachmentError } from "../../../_chunks/principal-
|
|
7
|
+
import { _ as AttachmentError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { sendStoredAttachments } from "../attachments-send.mjs";
|
|
9
9
|
import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
|
|
10
10
|
import { redactDiagnostic } from "../diagnostics.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 { Lt as chatRuntimeSource, Ot as runtimeEnvelope, zt as withChatAddress } from "../../../_chunks/principal-
|
|
7
|
+
import { Lt as chatRuntimeSource, Ot as runtimeEnvelope, zt as withChatAddress } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { currentChannel } from "../channel-scope.mjs";
|
|
9
9
|
import { pressWorkspaceButton, queueWorkspaceButtonTurn, workspaceAction, workspaceButtonToken } from "../workspace-action.mjs";
|
|
10
10
|
import { pairingNotice } from "./pairing.mjs";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { object } from "./confirmation-description.mjs";
|
|
8
|
-
import { D as OntologyFileUnavailable, W as member, i as memberIdOf, j as ontologyTools } from "../../_chunks/principal-
|
|
8
|
+
import { D as OntologyFileUnavailable, W as member, i as memberIdOf, j as ontologyTools } from "../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
async function readStoredFile(input, principal, options = {}) {
|
|
@@ -10,17 +10,17 @@ import { groupRoutingHealth } from "../group-routing/health.mjs";
|
|
|
10
10
|
import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
|
|
11
11
|
import { handleWorkspaceCallback } from "./callbacks.mjs";
|
|
12
12
|
import { telegramText, withTelegramTexts } from "./texts.mjs";
|
|
13
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
13
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-DIf8SOej.mjs";
|
|
14
14
|
import { attachmentLifecycle } from "./lifecycle.mjs";
|
|
15
15
|
import { manifestOf } from "../../config.mjs";
|
|
16
16
|
import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
|
|
17
17
|
import { chooseModel } from "../../model.mjs";
|
|
18
|
-
import { Ct as withDeliveryLocale, S as fetchStoredAttachment, St as safeTelegramFetch, b as agentAttachments, c as currentInboundRequest, l as runInboundRequest, mt as currentLocale, n as chatLanguage, o as telegramPrincipal, s as InboundRequest, u as withReplacedText, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-
|
|
18
|
+
import { Ct as withDeliveryLocale, S as fetchStoredAttachment, St as safeTelegramFetch, b as agentAttachments, c as currentInboundRequest, l as runInboundRequest, mt as currentLocale, n as chatLanguage, o as telegramPrincipal, s as InboundRequest, u as withReplacedText, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
19
19
|
import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs";
|
|
20
20
|
import { appOrigin, channelsEnabled, proxyEnvironment, runtimeIdentityEnvironment, webhookSecret } from "../environment.mjs";
|
|
21
21
|
import { agentIdentities } from "../identities.mjs";
|
|
22
22
|
import { m as topicContext, r as chatArchive } from "../../../_chunks/chat-archive-CDk-FPLX.mjs";
|
|
23
|
-
import { a as captureTelegramFetch, h as telegramChatCapture, i as captureRouteDecider, s as chatIdentities, u as recordGateDecision } from "../../../_chunks/chat-archive-
|
|
23
|
+
import { a as captureTelegramFetch, h as telegramChatCapture, i as captureRouteDecider, s as chatIdentities, u as recordGateDecision } from "../../../_chunks/chat-archive-BVngSwuB.mjs";
|
|
24
24
|
import { runtimeTokenVerifier } from "../runtime-identity.mjs";
|
|
25
25
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
26
26
|
import { botIdentityCache, proxiedBotRequest, runtimeBotIdentity } from "./bot.mjs";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { describableImage } from "../inbound-media/images.mjs";
|
|
8
|
-
import { xt as reportTelegramError } from "../../../_chunks/principal-
|
|
8
|
+
import { xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { gateway, generateText } from "ai";
|
|
10
10
|
const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
|
|
11
11
|
const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { attachmentOwner } from "../attachment-tools.mjs";
|
|
8
|
-
import { _ as AttachmentError, _t as customerMessage, bt as formattingRefused, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-
|
|
8
|
+
import { _ as AttachmentError, _t as customerMessage, bt as formattingRefused, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { attachmentFailure } from "../attachments-send.mjs";
|
|
10
10
|
import { MAXIMUM_PROXY_BODY_BYTES, connectionProxy } from "../connection-proxy.mjs";
|
|
11
11
|
import { redactDiagnostic } from "../diagnostics.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 { Ot as runtimeEnvelope, c as currentInboundRequest, i as memberIdOf, kt as telegramRuntimeSource, o as telegramPrincipal, xt as reportTelegramError } from "../../../_chunks/principal-
|
|
7
|
+
import { Ot as runtimeEnvelope, c as currentInboundRequest, i as memberIdOf, kt as telegramRuntimeSource, o as telegramPrincipal, xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { formatAddress, parseAddress, scopedAddress } from "./sessions.mjs";
|
|
9
9
|
import { telegramText } from "./texts.mjs";
|
|
10
10
|
import { isWorkspaceCallback, pressWorkspaceButton, queueWorkspaceButtonTurn, workspaceAction, workspaceButtonToken } from "../workspace-action.mjs";
|
|
@@ -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 REVISION_CLAIM_TTL_MS, n as attachmentIdentity, r as attachmentRefs, i as captureRouteDecider, a as captureTelegramFetch, o as captureTelegramWebhook, s as chatIdentities, c as currentCapture, l as participants, u as recordGateDecision, d as recordInboundContent, f as recordRouteDecision, p as recordSessionFailure, m as registerCapture, h as telegramChatCapture } from "../../../_chunks/chat-archive-
|
|
7
|
+
export { t as REVISION_CLAIM_TTL_MS, n as attachmentIdentity, r as attachmentRefs, i as captureRouteDecider, a as captureTelegramFetch, o as captureTelegramWebhook, s as chatIdentities, c as currentCapture, l as participants, u as recordGateDecision, d as recordInboundContent, f as recordRouteDecision, p as recordSessionFailure, m as registerCapture, h as telegramChatCapture } from "../../../_chunks/chat-archive-BVngSwuB.mjs";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { telegramText } from "./texts.mjs";
|
|
8
|
-
import { F as confirmations, Ft as chatChannel, c as currentInboundRequest, i as memberIdOf, o as telegramPrincipal, xt as reportTelegramError } from "../../../_chunks/principal-
|
|
8
|
+
import { F as confirmations, Ft as chatChannel, c as currentInboundRequest, i as memberIdOf, o as telegramPrincipal, xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { humanText } from "../confirmation-description.mjs";
|
|
10
10
|
import { withConfirmationPrompt } from "../group-routing/messages.mjs";
|
|
11
11
|
import { chatPostOperationId, isChatPost } from "../chat-post-confirmation.mjs";
|
|
@@ -5,5 +5,5 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { isTechnicalText } from "../customer-text-safety.mjs";
|
|
8
|
-
import { Ct as withDeliveryLocale, St as safeTelegramFetch, _t as customerMessage, bt as formattingRefused, gt as customerCopy, ht as currentThreadId, mt as currentLocale, pt as TelegramDeliveryError, vt as customerText, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-
|
|
8
|
+
import { Ct as withDeliveryLocale, St as safeTelegramFetch, _t as customerMessage, bt as formattingRefused, gt as customerCopy, ht as currentThreadId, mt as currentLocale, pt as TelegramDeliveryError, vt as customerText, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
export { TelegramDeliveryError, currentLocale, currentThreadId, customerCopy, customerMessage, customerText, failureText, formattingRefused, isTechnicalText, reportTelegramError, safeTelegramFetch, withDeliveryLocale };
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { currentChannel } from "../channel-scope.mjs";
|
|
8
|
-
import { p as storeFiles, xt as reportTelegramError } from "../../../_chunks/principal-
|
|
8
|
+
import { p as storeFiles, xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
function telegramChat(chatId) {
|
|
10
10
|
return `${currentChannel("telegram")}:${chatId}`;
|
|
11
11
|
}
|
|
@@ -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-
|
|
7
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-DIf8SOej.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";
|
|
@@ -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 { N as CONFIRMATION_TTL_MS } from "../../../_chunks/principal-
|
|
7
|
+
import { N as CONFIRMATION_TTL_MS } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { object } from "../confirmation-description.mjs";
|
|
9
9
|
import { SessionNotActiveError } from "eve/sessions";
|
|
10
10
|
function heldApprovals(events) {
|
|
@@ -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 { s as InboundRequest, c as currentInboundRequest, l as runInboundRequest, u as withReplacedText } from "../../../_chunks/principal-
|
|
7
|
+
export { s as InboundRequest, c as currentInboundRequest, l as runInboundRequest, u as withReplacedText } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { WorkspaceActionAlreadyDispatched } from "../workspace-action.mjs";
|
|
8
8
|
import { structuredMessage } from "./structured.mjs";
|
|
9
9
|
import { currentChannel } from "../channel-scope.mjs";
|
|
10
|
-
import { Ot as runtimeEnvelope, f as attachmentsContext, kt as telegramRuntimeSource, n as chatLanguage, o as telegramPrincipal, x as attachmentUrl, xt as reportTelegramError } from "../../../_chunks/principal-
|
|
10
|
+
import { Ot as runtimeEnvelope, f as attachmentsContext, kt as telegramRuntimeSource, n as chatLanguage, o as telegramPrincipal, x as attachmentUrl, xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
11
11
|
import { routingBurst } from "../group-routing/burst.mjs";
|
|
12
12
|
import { telegramSignals } from "./signals.mjs";
|
|
13
13
|
import { addressingReason, chatKey, otherRecipient } from "../group-routing/signals.mjs";
|
|
@@ -28,7 +28,7 @@ import { routingContext } from "./routing-context.mjs";
|
|
|
28
28
|
import { formatAddress, messageAddress, scopedAddress } from "./sessions.mjs";
|
|
29
29
|
import { voiceOf } from "./voice.mjs";
|
|
30
30
|
import { MAXIMUM_ROUTING_ATTACHMENT_BYTES, describeRoutingAttachment, routingAttachmentDeadline } from "./attachment-description.mjs";
|
|
31
|
-
import { d as recordInboundContent, f as recordRouteDecision, u as recordGateDecision } from "../../../_chunks/chat-archive-
|
|
31
|
+
import { d as recordInboundContent, f as recordRouteDecision, u as recordGateDecision } from "../../../_chunks/chat-archive-BVngSwuB.mjs";
|
|
32
32
|
import { contentShape, messageContent } from "./content.mjs";
|
|
33
33
|
import { messageAudience } from "./audience.mjs";
|
|
34
34
|
const MAXIMUM_QUOTE_LENGTH = 500;
|
|
@@ -4,8 +4,8 @@ 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 { E as OntologyActionNotPermitted, Et as principalRuntimeSource, L as needsConfirmation, Ot as runtimeEnvelope, W as member, c as currentInboundRequest, j as ontologyTools, k as actionToolName, kt as telegramRuntimeSource } from "../../../_chunks/principal-
|
|
8
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
7
|
+
import { E as OntologyActionNotPermitted, Et as principalRuntimeSource, L as needsConfirmation, Ot as runtimeEnvelope, W as member, c as currentInboundRequest, j as ontologyTools, k as actionToolName, kt as telegramRuntimeSource } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-DIf8SOej.mjs";
|
|
9
9
|
import { object } from "../confirmation-description.mjs";
|
|
10
10
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
11
11
|
code = "attachment_lifecycle_not_permitted";
|
|
@@ -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 TELEGRAM_AUTHENTICATOR, n as chatLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-
|
|
7
|
+
export { t as TELEGRAM_AUTHENTICATOR, n as chatLanguage, r as identityProviderOf, i as memberIdOf, a as rolesOf, o as telegramPrincipal } from "../../../_chunks/principal-C7aAjyt4.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 { xt as reportTelegramError } from "../../../_chunks/principal-
|
|
7
|
+
import { xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
function strandedRun(error) {
|
|
10
10
|
if (!(error instanceof Error) || error.name !== "RunKeyFetchError" || !("status" in error) || error.status !== 404) return;
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
8
|
-
import { _t as customerMessage, mt as currentLocale, pt as TelegramDeliveryError, xt as reportTelegramError } from "../../../_chunks/principal-
|
|
8
|
+
import { _t as customerMessage, mt as currentLocale, pt as TelegramDeliveryError, xt as reportTelegramError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { splitTelegramText } from "./format.mjs";
|
|
10
10
|
import { inTelegramSendQueue } from "./send-queue.mjs";
|
|
11
11
|
const NO_REPLY_TOOL = "no_reply";
|
|
@@ -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 { g as captureInStore, _ as storeSend } from "../../../_chunks/chat-archive-
|
|
7
|
+
export { g as captureInStore, _ as storeSend } from "../../../_chunks/chat-archive-BVngSwuB.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 { Ot as runtimeEnvelope, kt as telegramRuntimeSource } from "../../../_chunks/principal-
|
|
7
|
+
import { Ot as runtimeEnvelope, kt as telegramRuntimeSource } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { workspaceAction } from "../workspace-action.mjs";
|
|
9
9
|
import { STRUCTURED_KINDS } from "./structured-settings.mjs";
|
|
10
10
|
const record = (value) => {
|
|
@@ -6,8 +6,8 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { telegramText } from "./texts.mjs";
|
|
8
8
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
9
|
-
import { p as recordSessionFailure } from "../../../_chunks/chat-archive-
|
|
10
|
-
import { gt as customerCopy, ht as currentThreadId, i as memberIdOf, mt as currentLocale, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-
|
|
9
|
+
import { p as recordSessionFailure } from "../../../_chunks/chat-archive-BVngSwuB.mjs";
|
|
10
|
+
import { gt as customerCopy, ht as currentThreadId, i as memberIdOf, mt as currentLocale, xt as reportTelegramError, yt as failureText } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
11
11
|
import { modelServiceFailure } from "../model-service-failure.mjs";
|
|
12
12
|
function telegramFailureEvents(input) {
|
|
13
13
|
return {
|
|
@@ -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 { q as ACCESS_TOKEN_PREFIX, J as AGENT_GRANT_HEADER, Y as GUEST_CONFIRMATIONS_ATTRIBUTE, X as GUEST_ID_ATTRIBUTE, Z as GUEST_ROLE, Q as INTROSPECTION_PATH, $ as KIND_ATTRIBUTE, et as TURN_LIMITED_CODE, tt as TurnLimitedError, nt as WEB_AUTHENTICATOR, rt as WEB_GRANT_ATTRIBUTE, it as WEB_PROVIDER, at as guestConfirms, ot as guestIdOf, st as guestPrincipal, ct as ontologyIntrospection, lt as webAuth, ut as webGrantOf, dt as webMemberOf, ft as webPrincipal } from "../../../_chunks/principal-
|
|
7
|
+
export { q as ACCESS_TOKEN_PREFIX, J as AGENT_GRANT_HEADER, Y as GUEST_CONFIRMATIONS_ATTRIBUTE, X as GUEST_ID_ATTRIBUTE, Z as GUEST_ROLE, Q as INTROSPECTION_PATH, $ as KIND_ATTRIBUTE, et as TURN_LIMITED_CODE, tt as TurnLimitedError, nt as WEB_AUTHENTICATOR, rt as WEB_GRANT_ATTRIBUTE, it as WEB_PROVIDER, at as guestConfirms, ot as guestIdOf, st as guestPrincipal, ct as ontologyIntrospection, lt as webAuth, ut as webGrantOf, dt as webMemberOf, ft as webPrincipal } from "../../../_chunks/principal-C7aAjyt4.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 { it as WEB_PROVIDER, lt as webAuth } from "../../../_chunks/principal-
|
|
7
|
+
import { it as WEB_PROVIDER, lt as webAuth } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { localDev, placeholderAuth, vercelOidc } from "eve/channels/auth";
|
|
9
9
|
import { eveChannel } from "eve/channels/eve";
|
|
10
10
|
const WEB_EXPOSED_HEADERS = [
|
|
@@ -2,7 +2,7 @@ import { WhatsAppAdapter, type WhatsAppRawMessage } from "@chat-adapter/whatsapp
|
|
|
2
2
|
import { type AdapterPostableMessage, type Message, type PostableCard, type RawMessage, type WebhookOptions } from "chat";
|
|
3
3
|
import type { SessionAuthContext } from "eve/context";
|
|
4
4
|
import { type ChatSdkChannel } from "eve/channels/chat-sdk";
|
|
5
|
-
import type { AdmissionSettings, ChatModelChoice, WhatsAppSettings } from "../../config.js";
|
|
5
|
+
import type { AdmissionSettings, ChatModelChoice, RecordSetting, WhatsAppSettings } from "../../config.js";
|
|
6
6
|
import { type AgentAttachments } from "../attachments.js";
|
|
7
7
|
import { type ImageDescriber } from "../inbound-media/images.js";
|
|
8
8
|
import { type CapabilityLookup } from "../inbound-media/plan.js";
|
|
@@ -166,7 +166,9 @@ export declare function inboundOf(message: Pick<Message, "raw">): {
|
|
|
166
166
|
};
|
|
167
167
|
/**
|
|
168
168
|
* Admits one inbound message: the principal of a paired member who wrote something, or undefined
|
|
169
|
-
* after answering anyone else with the workspace's reply, if it has one.
|
|
169
|
+
* after answering anyone else with the workspace's reply, if it has one. Under `record: "all"`
|
|
170
|
+
* every message that starts no turn is recorded in the person's chat first, the message of a sender
|
|
171
|
+
* the agent did not admit without a member.
|
|
170
172
|
*/
|
|
171
173
|
export declare function receive(input: {
|
|
172
174
|
/** The Chat SDK thread: its id names the chat, one person's chat with the number. */
|
|
@@ -180,6 +182,8 @@ export declare function receive(input: {
|
|
|
180
182
|
readonly environment: Environment;
|
|
181
183
|
/** Where a message in a chat staff took over is recorded; by default, the platform's archive. */
|
|
182
184
|
readonly archive?: () => ChatArchive;
|
|
185
|
+
/** Which messages the channel records; `agent` by default. */
|
|
186
|
+
readonly record?: RecordSetting;
|
|
183
187
|
}): Promise<SessionAuthContext | undefined>;
|
|
184
188
|
/**
|
|
185
189
|
* The pairing reply: the workspace's text with a button opening the link, which WhatsApp shows as
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { admitMessage, localizedText } from "../admission.mjs";
|
|
8
8
|
import { agentToolsAttribute } from "../agent-tools.mjs";
|
|
9
9
|
import { providerChat } from "../attachment-tools.mjs";
|
|
10
|
-
import { b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, zt as withChatAddress } from "../../../_chunks/principal-
|
|
10
|
+
import { b as agentAttachments, d as prepareInboundMedia, i as memberIdOf, zt as withChatAddress } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
11
11
|
import { gatewayImageDescriber } from "../inbound-media/images.mjs";
|
|
12
12
|
import { gatewayMediaCapabilities, turnMediaPlan } from "../inbound-media/plan.mjs";
|
|
13
13
|
import { gatewayTranscriber } from "../inbound-media/speech.mjs";
|
|
@@ -21,7 +21,7 @@ import { appOrigin, channelsEnabled, proxyEnvironment, webhookSecret } from "../
|
|
|
21
21
|
import { agentIdentities } from "../identities.mjs";
|
|
22
22
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
23
23
|
import { r as chatArchive } from "../../../_chunks/chat-archive-CDk-FPLX.mjs";
|
|
24
|
-
import { recordHandledMessage, recordReceivedMessage, stagedFiles } from "../chat-messages.mjs";
|
|
24
|
+
import { recordHandledMessage, recordReceivedMessage, recordUnadmittedMessage, stagedFiles } from "../chat-messages.mjs";
|
|
25
25
|
import { handleWorkspaceButton } from "./callbacks.mjs";
|
|
26
26
|
import { recordWhatsAppChanges, whatsappChanges, whatsappParts } from "./changes.mjs";
|
|
27
27
|
import { recordEchoes, whatsappEchoes } from "./echoes.mjs";
|
|
@@ -277,8 +277,8 @@ function segmentstreamWhatsApp(options) {
|
|
|
277
277
|
const runtime = {
|
|
278
278
|
enabled: () => channelsEnabled(environment) && settings() !== null && webhookSecret(environment) !== void 0,
|
|
279
279
|
secret: () => webhookSecret(environment),
|
|
280
|
-
echoes: (echoes) => recordEchoes(chats(), echoes),
|
|
281
|
-
changes: (changes) => recordWhatsAppChanges(chats(), changes),
|
|
280
|
+
echoes: (echoes) => recordEchoes(chats(), echoes, { record: settings()?.record ?? "agent" }),
|
|
281
|
+
changes: (changes) => recordWhatsAppChanges(chats(), changes, { record: settings()?.record ?? "agent" }),
|
|
282
282
|
proxy: () => {
|
|
283
283
|
const connection = settings()?.connection;
|
|
284
284
|
if (connection === void 0) throw new Error("The WhatsApp channel is not configured in agent/segmentstream.json.");
|
|
@@ -392,7 +392,8 @@ function segmentstreamWhatsApp(options) {
|
|
|
392
392
|
admission: options.admission(),
|
|
393
393
|
identities: pairing(),
|
|
394
394
|
environment,
|
|
395
|
-
archive: chats
|
|
395
|
+
archive: chats,
|
|
396
|
+
record: settings()?.record ?? "agent"
|
|
396
397
|
});
|
|
397
398
|
const memberId = memberIdOf(auth);
|
|
398
399
|
if (auth === void 0 || memberId === void 0) return;
|
|
@@ -485,6 +486,21 @@ async function receive(input) {
|
|
|
485
486
|
const sender = message.author.userId;
|
|
486
487
|
const display = message.author.fullName.trim() || void 0;
|
|
487
488
|
const turn = message.text.trim() !== "" || message.attachments.length > 0;
|
|
489
|
+
const record = input.record ?? "agent";
|
|
490
|
+
const archive = () => input.archive?.() ?? chatArchive({ environment: input.environment });
|
|
491
|
+
const raw = message.raw === void 0 ? {} : inboundOf({ raw: message.raw });
|
|
492
|
+
const unadmitted = async (reason) => {
|
|
493
|
+
if (record === "all") await recordUnadmittedMessage(archive(), {
|
|
494
|
+
channel: currentChannel("whatsapp"),
|
|
495
|
+
chatId: thread.id,
|
|
496
|
+
senderId: sender,
|
|
497
|
+
senderName: display ?? null,
|
|
498
|
+
messageId: message.id,
|
|
499
|
+
text: message.text,
|
|
500
|
+
files: message.attachments,
|
|
501
|
+
...raw
|
|
502
|
+
}, reason).catch((cause) => report("message_record_failed", cause));
|
|
503
|
+
};
|
|
488
504
|
const resolution = await admitMessage({
|
|
489
505
|
identity: {
|
|
490
506
|
provider: "whatsapp",
|
|
@@ -502,14 +518,15 @@ async function receive(input) {
|
|
|
502
518
|
chatId: thread.id,
|
|
503
519
|
recipient: sender
|
|
504
520
|
},
|
|
505
|
-
inboxFailed: (error) => report("inbox_report_failed", error)
|
|
521
|
+
inboxFailed: (error) => report("inbox_report_failed", error),
|
|
522
|
+
record
|
|
506
523
|
});
|
|
507
524
|
switch (resolution.status) {
|
|
508
525
|
case "existing":
|
|
509
526
|
case "created":
|
|
510
527
|
if (resolution.handled === true) {
|
|
511
|
-
if (!turn) return;
|
|
512
|
-
await recordHandledMessage(
|
|
528
|
+
if (!turn && record !== "all") return;
|
|
529
|
+
await recordHandledMessage(archive(), {
|
|
513
530
|
chat: {
|
|
514
531
|
channel: currentChannel("whatsapp"),
|
|
515
532
|
chatId: thread.id
|
|
@@ -520,10 +537,24 @@ async function receive(input) {
|
|
|
520
537
|
messageId: message.id,
|
|
521
538
|
text: message.text,
|
|
522
539
|
files: message.attachments,
|
|
523
|
-
...
|
|
540
|
+
...raw
|
|
524
541
|
});
|
|
525
542
|
return;
|
|
526
543
|
}
|
|
544
|
+
if (!turn && record === "all") {
|
|
545
|
+
await recordReceivedMessage(archive(), {
|
|
546
|
+
channel: currentChannel("whatsapp"),
|
|
547
|
+
chatId: thread.id,
|
|
548
|
+
memberId: resolution.member.id,
|
|
549
|
+
senderId: sender,
|
|
550
|
+
senderName: display ?? null,
|
|
551
|
+
messageId: message.id,
|
|
552
|
+
text: message.text,
|
|
553
|
+
...raw,
|
|
554
|
+
outcome: { skipped: "no_text" }
|
|
555
|
+
}).catch((cause) => report("message_record_failed", cause));
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
527
558
|
return turn ? withChatAddress(whatsappPrincipal(resolution.member, sender), {
|
|
528
559
|
provider: "whatsapp",
|
|
529
560
|
...currentChannel("whatsapp") === "whatsapp" ? {} : { channel: currentChannel("whatsapp") },
|
|
@@ -536,6 +567,7 @@ async function receive(input) {
|
|
|
536
567
|
sender
|
|
537
568
|
}) : void 0;
|
|
538
569
|
case "pairing_required": {
|
|
570
|
+
await unadmitted("identity_unknown");
|
|
539
571
|
const text = localizedText(admission.replies.pairingRequired);
|
|
540
572
|
if (text !== void 0 && turn) {
|
|
541
573
|
const code = (await identities.createPairing({
|
|
@@ -548,11 +580,13 @@ async function receive(input) {
|
|
|
548
580
|
return;
|
|
549
581
|
}
|
|
550
582
|
case "refused": {
|
|
583
|
+
await unadmitted("identity_refused");
|
|
551
584
|
const text = localizedText(admission.replies.refused);
|
|
552
585
|
if (text !== void 0 && turn) await thread.post(text);
|
|
553
586
|
return;
|
|
554
587
|
}
|
|
555
588
|
case "limited": {
|
|
589
|
+
await unadmitted("limited");
|
|
556
590
|
const replies = admission.replies;
|
|
557
591
|
const configured = resolution.scope === "workspaceTurnsPerDay" ? replies.workspaceLimited : resolution.scope === "newUsersPerHour" ? replies.registrationsLimited : replies.perSenderLimited;
|
|
558
592
|
const text = resolution.notify ? localizedText(configured ?? replies.limited) : void 0;
|
|
@@ -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 { _ as AttachmentError } from "../../../_chunks/principal-
|
|
7
|
+
import { _ as AttachmentError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { sendStoredAttachments } from "../attachments-send.mjs";
|
|
9
9
|
import { r as chatArchive } from "../../../_chunks/chat-archive-CDk-FPLX.mjs";
|
|
10
10
|
import { connectionProxy } from "../connection-proxy.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 { Lt as chatRuntimeSource, Ot as runtimeEnvelope, zt as withChatAddress } from "../../../_chunks/principal-
|
|
7
|
+
import { Lt as chatRuntimeSource, Ot as runtimeEnvelope, zt as withChatAddress } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { currentChannel } from "../channel-scope.mjs";
|
|
9
9
|
import { recordChatMessage } from "../chat-messages.mjs";
|
|
10
10
|
import { object } from "../confirmation-description.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChatArchive } from "../chat-archive.js";
|
|
2
|
-
import { type ChatChange, type ChatPart } from "../chat-messages.js";
|
|
2
|
+
import { type ChatChange, type ChatPart, type RecordOptions } from "../chat-messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* How long a failure Meta reports waits for its message, between tries: Meta can report a send
|
|
5
5
|
* failed before the agent stored the send's receipt, which names the message.
|
|
@@ -40,7 +40,8 @@ export declare function whatsappParts(message: Readonly<Record<string, unknown>>
|
|
|
40
40
|
export declare function whatsappChanges(payload: unknown): WhatsAppChanges;
|
|
41
41
|
/**
|
|
42
42
|
* Applies a delivery's changes, then records its contact cards, on the WhatsApp channel the
|
|
43
|
-
* delivery runs for
|
|
44
|
-
*
|
|
43
|
+
* delivery runs for: in the chat the agent has with the person, or under `record: "all"` in any.
|
|
44
|
+
* Answers whether its statuses were recorded: false on the chat archive in Cloud, which keeps no
|
|
45
|
+
* changes, so the platform keeps a failure Meta reports there itself.
|
|
45
46
|
*/
|
|
46
|
-
export declare function recordWhatsAppChanges(archive: ChatArchive, read: WhatsAppChanges, wait?: (ms: number) => Promise<void>): Promise<boolean>;
|
|
47
|
+
export declare function recordWhatsAppChanges(archive: ChatArchive, read: WhatsAppChanges, options?: RecordOptions, wait?: (ms: number) => Promise<void>): Promise<boolean>;
|
|
@@ -167,7 +167,7 @@ function whatsappChanges(payload) {
|
|
|
167
167
|
statuses
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
async function recordWhatsAppChanges(archive, read, wait = (ms) => new Promise((done) => setTimeout(done, ms))) {
|
|
170
|
+
async function recordWhatsAppChanges(archive, read, options = {}, wait = (ms) => new Promise((done) => setTimeout(done, ms))) {
|
|
171
171
|
const channel = currentChannel("whatsapp");
|
|
172
172
|
let recorded = read.statuses;
|
|
173
173
|
for (const change of read.changes) {
|
|
@@ -191,7 +191,7 @@ async function recordWhatsAppChanges(archive, read, wait = (ms) => new Promise((
|
|
|
191
191
|
parts: card.parts,
|
|
192
192
|
...card.replyTo === void 0 ? {} : { replyTo: card.replyTo },
|
|
193
193
|
...card.at === void 0 ? {} : { at: card.at }
|
|
194
|
-
}, "no_text");
|
|
194
|
+
}, "no_text", options);
|
|
195
195
|
return recorded;
|
|
196
196
|
}
|
|
197
197
|
async function failureKept(archive, change, wait) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChatArchive } from "../chat-archive.js";
|
|
2
|
-
import { type RecordedFile } from "../chat-messages.js";
|
|
2
|
+
import { type RecordedFile, type RecordOptions } from "../chat-messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* What the business wrote from the WhatsApp Business app on a number connected in Coexistence: Meta
|
|
5
5
|
* reports each such message as a `smb_message_echoes` change, which the platform relays to the
|
|
@@ -23,6 +23,7 @@ export interface WhatsAppEcho {
|
|
|
23
23
|
export declare function whatsappEchoes(payload: unknown): ReadonlyArray<WhatsAppEcho>;
|
|
24
24
|
/**
|
|
25
25
|
* Records each echo in the person's chat on the WhatsApp channel the delivery runs for, as a
|
|
26
|
-
* human's outbound message, keyed by Meta's id so a delivery read again records it once
|
|
26
|
+
* human's outbound message, keyed by Meta's id so a delivery read again records it once; under
|
|
27
|
+
* `record: "all"`, in a chat the agent has none of too.
|
|
27
28
|
*/
|
|
28
|
-
export declare function recordEchoes(archive: ChatArchive, echoes: ReadonlyArray<WhatsAppEcho
|
|
29
|
+
export declare function recordEchoes(archive: ChatArchive, echoes: ReadonlyArray<WhatsAppEcho>, options?: RecordOptions): Promise<void>;
|
|
@@ -54,7 +54,7 @@ function whatsappEchoes(payload) {
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
async function recordEchoes(archive, echoes) {
|
|
57
|
+
async function recordEchoes(archive, echoes, options = {}) {
|
|
58
58
|
for (const echo of echoes) await recordSentOutside(archive, {
|
|
59
59
|
provider: currentChannel("whatsapp"),
|
|
60
60
|
chatId: echo.chatId,
|
|
@@ -64,6 +64,6 @@ async function recordEchoes(archive, echoes) {
|
|
|
64
64
|
messageId: echo.id,
|
|
65
65
|
text: echo.text,
|
|
66
66
|
files: echo.files
|
|
67
|
-
});
|
|
67
|
+
}, options);
|
|
68
68
|
}
|
|
69
69
|
export { recordEchoes, whatsappEchoes };
|
|
@@ -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 { m as turnContent } from "../../../_chunks/principal-
|
|
7
|
+
import { m as turnContent } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
function record(value) {
|
|
9
9
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
10
10
|
}
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { admitMessage } from "./admission.mjs";
|
|
8
|
-
import { L as needsConfirmation, W as member, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-
|
|
8
|
+
import { L as needsConfirmation, W as member, j as ontologyTools, k as actionToolName } from "../../_chunks/principal-C7aAjyt4.mjs";
|
|
9
9
|
import { object } from "./confirmation-description.mjs";
|
|
10
10
|
var WorkspaceActionAlreadyDispatched = class extends Error {};
|
|
11
11
|
const WORKSPACE_BUTTON_PREFIX = "ws:";
|
|
@@ -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 { Ft as chatChannel, _ as AttachmentError } from "../../../_chunks/principal-
|
|
7
|
+
import { Ft as chatChannel, _ as AttachmentError } from "../../../_chunks/principal-C7aAjyt4.mjs";
|
|
8
8
|
import { sendStoredAttachments } from "../attachments-send.mjs";
|
|
9
9
|
import { redactDiagnostic } from "../diagnostics.mjs";
|
|
10
10
|
import { StoredFileError, fetchStoredFile } from "../sent-files.mjs";
|