@segmentstream/agent 0.6.12 → 0.6.13
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/dist/_chunks/{inbound-request-DgyI7oR9.mjs → inbound-request-CysnjMdw.mjs} +51 -59
- package/dist/extension/instructions.md +8 -1
- package/dist/extension/lib/chat-post-confirmation.mjs +1 -1
- package/dist/extension/lib/confirmation-description.d.ts +1 -0
- package/dist/extension/lib/confirmation-description.mjs +29 -13
- package/dist/extension/lib/confirmations.d.ts +3 -0
- package/dist/extension/lib/confirmations.mjs +22 -5
- package/dist/extension/lib/customer-text-safety.d.ts +1 -0
- package/dist/extension/lib/customer-text-safety.mjs +23 -0
- package/dist/extension/lib/ontology-tools.mjs +13 -6
- package/dist/extension/lib/telegram/adapter.mjs +5 -5
- package/dist/extension/lib/telegram/attachments-send.mjs +6 -6
- package/dist/extension/lib/telegram/chat-post-card.d.ts +4 -12
- package/dist/extension/lib/telegram/chat-post-card.mjs +15 -36
- package/dist/extension/lib/telegram/confirmation-text.d.ts +19 -8
- package/dist/extension/lib/telegram/confirmation-text.mjs +55 -65
- package/dist/extension/lib/telegram/confirmations.d.ts +1 -2
- package/dist/extension/lib/telegram/confirmations.mjs +36 -94
- package/dist/extension/lib/telegram/conversations.mjs +1 -1
- package/dist/extension/lib/telegram/customer-text.d.ts +3 -4
- package/dist/extension/lib/telegram/customer-text.mjs +2 -1
- package/dist/extension/lib/telegram/files.mjs +1 -1
- package/dist/extension/lib/telegram/images.mjs +1 -1
- package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
- package/dist/extension/lib/telegram/inbound.mjs +5 -5
- package/dist/extension/lib/telegram/media-policy.mjs +1 -1
- package/dist/extension/lib/telegram/principal.mjs +1 -1
- package/dist/extension/lib/telegram/silent.mjs +2 -2
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/telegram/voice.mjs +1 -1
- package/package.json +2 -2
|
@@ -19,9 +19,9 @@ import { messageAudience } from "./audience.mjs";
|
|
|
19
19
|
import { addressingReason, routeMessage } from "./router.mjs";
|
|
20
20
|
import { routingContext } from "./routing-context.mjs";
|
|
21
21
|
import { voiceOf, voiceText } from "./voice.mjs";
|
|
22
|
-
const UNKNOWN_PRIVATE = "
|
|
23
|
-
const UNKNOWN_IN_GROUP = "
|
|
24
|
-
const REFUSED = "
|
|
22
|
+
const UNKNOWN_PRIVATE = "🔗";
|
|
23
|
+
const UNKNOWN_IN_GROUP = "🔒";
|
|
24
|
+
const REFUSED = "🔒";
|
|
25
25
|
const MAXIMUM_QUOTE_LENGTH = 500;
|
|
26
26
|
function buttonTo(text, url) {
|
|
27
27
|
return { inline_keyboard: [[{
|
|
@@ -80,7 +80,7 @@ function speakerBlock(input) {
|
|
|
80
80
|
function unknownInGroup(bot) {
|
|
81
81
|
return bot?.username === void 0 ? { text: UNKNOWN_IN_GROUP } : {
|
|
82
82
|
text: UNKNOWN_IN_GROUP,
|
|
83
|
-
reply_markup: buttonTo("
|
|
83
|
+
reply_markup: buttonTo("✉️", `https://t.me/${bot.username}`)
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
async function answerUnpaired(input) {
|
|
@@ -101,7 +101,7 @@ async function answerUnpaired(input) {
|
|
|
101
101
|
});
|
|
102
102
|
await context.telegram.post({
|
|
103
103
|
text: UNKNOWN_PRIVATE,
|
|
104
|
-
reply_markup: buttonTo("
|
|
104
|
+
reply_markup: buttonTo("🔗", dependencies.connectUrl(pairing.code))
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
function isGroupChat(message) {
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { DEFAULT_IMAGE_DESCRIPTION_MODEL } from "../../config.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-CysnjMdw.mjs";
|
|
9
9
|
function planMedia(capabilities, descriptionModel = null) {
|
|
10
10
|
if (typeof descriptionModel === "string") return {
|
|
11
11
|
images: "describe",
|
|
@@ -35,7 +35,7 @@ function telegramPrincipal(input) {
|
|
|
35
35
|
}
|
|
36
36
|
function conversationLanguage(texts) {
|
|
37
37
|
for (const text of texts) {
|
|
38
|
-
if (/[
|
|
38
|
+
if (/[\u0430-\u044f\u0451]/iu.test(text)) return "ru";
|
|
39
39
|
if ((text.match(/\b[a-z]+\b/gi)?.length ?? 0) >= 3) return "en";
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -5,11 +5,11 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import "./principal.mjs";
|
|
8
|
+
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
8
9
|
import { agentMessage, observedChatKey } from "./observed.mjs";
|
|
9
10
|
import { splitTelegramText } from "./format.mjs";
|
|
10
11
|
import { inTelegramSendQueue } from "./send-queue.mjs";
|
|
11
|
-
import { a as TelegramDeliveryError, l as customerMessage,
|
|
12
|
-
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
12
|
+
import { a as TelegramDeliveryError, l as customerMessage, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-CysnjMdw.mjs";
|
|
13
13
|
const SILENT_MARKERS = new Set(["[silent]", "no_reply"]);
|
|
14
14
|
function isSilentReply(text) {
|
|
15
15
|
return SILENT_MARKERS.has(text.trim().toLowerCase());
|
|
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { memberIdOf } from "./principal.mjs";
|
|
8
|
-
import { c as customerCopy, d as failureText, m as reportTelegramError, o as currentLocale } from "../../../_chunks/inbound-request-DgyI7oR9.mjs";
|
|
9
8
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
9
|
+
import { c as customerCopy, d as failureText, o as currentLocale, p as reportTelegramError } from "../../../_chunks/inbound-request-CysnjMdw.mjs";
|
|
10
10
|
const telegramFailureEvents = {
|
|
11
11
|
async "turn.cancelled"(event, channel, context) {
|
|
12
12
|
const errorId = reportTelegramError("turn_cancelled", event, {
|
|
@@ -37,7 +37,7 @@ const telegramFailureEvents = {
|
|
|
37
37
|
const messageId = channel.state.pendingAuthMessageIds?.[event.name];
|
|
38
38
|
if (event.candidateId !== void 0 || messageId === void 0) return;
|
|
39
39
|
const locale = confirmationLocale(context.session.auth.current);
|
|
40
|
-
const copy = customerCopy(
|
|
40
|
+
const copy = customerCopy();
|
|
41
41
|
let text = event.outcome === "authorized" ? copy.connected : copy.disconnected;
|
|
42
42
|
if (event.reason !== void 0) {
|
|
43
43
|
const errorId = reportTelegramError("authorization_not_completed", event, { chatId: channel.state.chatId });
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import "../connection-proxy.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-CysnjMdw.mjs";
|
|
9
9
|
import { gateway, transcribe } from "ai";
|
|
10
10
|
const LABELS = {
|
|
11
11
|
voice: "voice message",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
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",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@chat-adapter/telegram": "4.41.0",
|
|
64
|
-
"@segmentstream-cloud/ontology": "0.31.
|
|
64
|
+
"@segmentstream-cloud/ontology": "0.31.5",
|
|
65
65
|
"@vercel/oidc": "^3.8.4",
|
|
66
66
|
"ai": "^7.0.128",
|
|
67
67
|
"csv-parse": "^7.0.3",
|