@segmentstream/agent 0.31.14 → 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.
- package/dist/_chunks/{build-metadata-frH1WOMT.mjs → build-metadata-DpwHNeNL.mjs} +1 -1
- package/dist/_chunks/{inbound-request-Dy7q3T23.mjs → inbound-request-BQQWCrWl.mjs} +7 -3
- package/dist/_chunks/{principal-CPOCTHBa.mjs → principal-VsmaJp1x.mjs} +1 -1
- package/dist/extension/channels/whatsapp.d.ts +7 -0
- package/dist/extension/channels/whatsapp.mjs +13 -0
- package/dist/extension/config.d.ts +12 -0
- package/dist/extension/config.mjs +31 -5
- package/dist/extension/hooks/authorization.mjs +1 -1
- package/dist/extension/instructions.md +6 -2
- package/dist/extension/lib/actor.mjs +1 -1
- package/dist/extension/lib/attachment-tools.mjs +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/chat-context.mjs +1 -1
- package/dist/extension/lib/confirmation-description.d.ts +45 -0
- package/dist/extension/lib/confirmation-description.mjs +60 -1
- package/dist/extension/lib/confirmations.d.ts +7 -1
- package/dist/extension/lib/confirmations.mjs +5 -4
- package/dist/extension/lib/conversation-runtime.mjs +1 -1
- package/dist/extension/lib/ontology-connection.mjs +1 -1
- package/dist/extension/lib/ontology-file-call.mjs +3 -3
- package/dist/extension/lib/ontology-tools.d.ts +2 -1
- package/dist/extension/lib/ontology-tools.mjs +48 -4
- package/dist/extension/lib/runtime-envelope.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 +2 -2
- package/dist/extension/lib/telegram/callbacks.mjs +2 -2
- package/dist/extension/lib/telegram/confirmation-text.d.ts +52 -4
- package/dist/extension/lib/telegram/confirmation-text.mjs +84 -15
- package/dist/extension/lib/telegram/confirmations.d.ts +9 -0
- package/dist/extension/lib/telegram/confirmations.mjs +46 -14
- package/dist/extension/lib/telegram/conversations.mjs +1 -1
- package/dist/extension/lib/telegram/customer-text.mjs +1 -1
- package/dist/extension/lib/telegram/files.mjs +2 -2
- package/dist/extension/lib/telegram/format.d.ts +4 -0
- package/dist/extension/lib/telegram/health.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 +2 -2
- package/dist/extension/lib/telegram/lifecycle.mjs +3 -3
- package/dist/extension/lib/telegram/media-policy.mjs +1 -1
- 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/structured.mjs +1 -1
- package/dist/extension/lib/telegram/turn-errors.mjs +2 -2
- package/dist/extension/lib/telegram/voice.mjs +1 -1
- package/dist/extension/lib/whatsapp/adapter.d.ts +81 -0
- package/dist/extension/lib/whatsapp/adapter.mjs +237 -0
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +3 -3
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/package.json +7 -4
|
@@ -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.
|
|
7
|
+
var version = "0.33.0";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -8,7 +8,7 @@ import { telegramText } from "../extension/lib/telegram/texts.mjs";
|
|
|
8
8
|
import { isTechnicalText } from "../extension/lib/customer-text-safety.mjs";
|
|
9
9
|
import { redactTelegramDiagnostic } from "../extension/lib/telegram/diagnostic-redaction.mjs";
|
|
10
10
|
import { chatPostCardLinks, isExactChatPostCard } from "../extension/lib/telegram/chat-post-card.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { confirmationEntities } from "../extension/lib/telegram/confirmation-text.mjs";
|
|
12
12
|
import { plainTelegramText, splitTelegramText, telegramMarkdown } from "../extension/lib/telegram/format.mjs";
|
|
13
13
|
import { inTelegramSendQueue } from "../extension/lib/telegram/send-queue.mjs";
|
|
14
14
|
import { retainDeliveryDiagnostic } from "../extension/lib/telegram/delivery-diagnostics.mjs";
|
|
@@ -140,9 +140,13 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}) {
|
|
|
140
140
|
if (typeof body[field] === "string" && !isExactChatPostCard(body[field])) {
|
|
141
141
|
const entityField = field === "text" ? "entities" : "caption_entities";
|
|
142
142
|
const existing = body[entityField];
|
|
143
|
-
const
|
|
143
|
+
const card = confirmationEntities(body[field]);
|
|
144
|
+
const message = card !== void 0 ? {
|
|
144
145
|
text: body[field],
|
|
145
|
-
entities:
|
|
146
|
+
entities: [...card]
|
|
147
|
+
} : Array.isArray(existing) ? {
|
|
148
|
+
text: body[field],
|
|
149
|
+
entities: existing
|
|
146
150
|
} : guardedCustomerMessage(body[field], currentLocale(), () => {
|
|
147
151
|
textBlocked = true;
|
|
148
152
|
});
|
|
@@ -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 currentInboundRequest } from "./inbound-request-
|
|
7
|
+
import { n as currentInboundRequest } from "./inbound-request-BQQWCrWl.mjs";
|
|
8
8
|
import "../extension/lib/agent-task.mjs";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
function telegramRuntimeSource(message, files, callbackQueryId) {
|
|
@@ -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: {
|
|
697
|
-
|
|
698
|
-
|
|
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,
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import segmentstream from "../extension.mjs";
|
|
8
8
|
import { localizedText } from "../lib/admission.mjs";
|
|
9
9
|
import { confirmationLocale } from "../lib/telegram/confirmation-text.mjs";
|
|
10
|
-
import "../../_chunks/principal-
|
|
10
|
+
import "../../_chunks/principal-VsmaJp1x.mjs";
|
|
11
11
|
import { defineHook } from "eve/hooks";
|
|
12
12
|
var authorization_default = defineHook({ events: { "interaction.opened": (event, context) => {
|
|
13
13
|
const principal = context.session.auth.current;
|
|
@@ -37,8 +37,10 @@ turn's own input with its `<speaker>` and `<message_audience>` blocks; use the a
|
|
|
37
37
|
and rich mentions for addressing.
|
|
38
38
|
|
|
39
39
|
In Telegram, reply in the member's conversation language. After an action, use at most one short
|
|
40
|
-
human sentence saying what changed and where, with a link to the record in the app.
|
|
41
|
-
|
|
40
|
+
human sentence saying what changed and where, with a link to the record in the app. A confirmation
|
|
41
|
+
card is the whole exchange for its action: it shows what will happen and then its outcome, so do
|
|
42
|
+
not announce the action before its card, and add nothing after it unless there is something the
|
|
43
|
+
card does not say, such as a next step. Never quote tool output, tool names, record ids, JSON, stack traces or
|
|
42
44
|
internal errors; explain failures briefly with an error reference when available. When
|
|
43
45
|
`<message_audience>` has `engagement_policy` `conversation` and the member declines your
|
|
44
46
|
involvement or closes the conversation, output exactly `[SILENT]`; do not acknowledge the
|
|
@@ -77,6 +79,8 @@ rejection or perform actions.
|
|
|
77
79
|
adds trusted facts. Omit this argument on older tools without schema support.
|
|
78
80
|
Use distinct confirm/cancel labels; all visible wording comes from the workspace. If trusted
|
|
79
81
|
target titles are unavailable or the facts are too long, resolve the targets or narrow the call.
|
|
82
|
+
An action can describe its own card; when it refuses the input instead, the call is refused
|
|
83
|
+
before any card with the action's reason: tell the member that reason and do not retry.
|
|
80
84
|
Cancel ends that call; retry it only after a new instruction from the member.
|
|
81
85
|
- Every change goes through an action. Report results after success; never claim a record changed
|
|
82
86
|
unless an action reported it.
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { AGENT_TASK_HEADER, agentTaskIdOf, taskSecret } from "./agent-task.mjs";
|
|
8
|
-
import { i as memberIdOf, r as identityProviderOf } from "../../_chunks/principal-
|
|
8
|
+
import { i as memberIdOf, r as identityProviderOf } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
9
9
|
import { defineDynamic } from "eve/tools";
|
|
10
10
|
const ACT_AS_HEADER = "X-SegmentStream-Act-As";
|
|
11
11
|
function member(memberId) {
|
|
@@ -10,7 +10,7 @@ import { readSheets, typedTable } from "./attachment-tables.mjs";
|
|
|
10
10
|
import { appOrigin } from "./environment.mjs";
|
|
11
11
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
12
12
|
import { telegramConversation } from "./telegram/files.mjs";
|
|
13
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
13
|
+
import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
14
14
|
const MAXIMUM_TEXT_CHARACTERS = 5e4;
|
|
15
15
|
const MAXIMUM_INLINE_BYTES = 5242880;
|
|
16
16
|
var AttachmentOwnerError = class extends Error {
|
|
@@ -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-
|
|
7
|
+
export { t as agentBuild } from "../../_chunks/build-metadata-DpwHNeNL.mjs";
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
8
8
|
import { conversationCoordinates } from "./conversation-runtime.mjs";
|
|
9
9
|
import { collapseConversationEvents, conversations, topicContext } from "./conversations.mjs";
|
|
10
|
-
import { p as reportTelegramError } from "../../_chunks/inbound-request-
|
|
10
|
+
import { p as reportTelegramError } from "../../_chunks/inbound-request-BQQWCrWl.mjs";
|
|
11
11
|
import { deliveries, runs, turns } from "eve/events";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { defineState } from "eve/context";
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { ChatPostPreview } from "./chat-post-confirmation.js";
|
|
2
|
+
/** One line of an action's own confirmation: what the person checks before confirming. */
|
|
3
|
+
export interface ConfirmationCardFact {
|
|
4
|
+
readonly icon?: string;
|
|
5
|
+
readonly text: string;
|
|
6
|
+
/** A page that shows what the line names; the line links to it. */
|
|
7
|
+
readonly url?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The confirmation an action describes itself, through the ontology's preview, in the chat's
|
|
11
|
+
* language: its title and the facts the person checks, already checked as safe to show.
|
|
12
|
+
*/
|
|
13
|
+
export interface ConfirmationCard {
|
|
14
|
+
readonly title: string;
|
|
15
|
+
readonly icon?: string;
|
|
16
|
+
readonly facts: readonly ConfirmationCardFact[];
|
|
17
|
+
/** Secondary detail, shown collapsed. */
|
|
18
|
+
readonly details: readonly string[];
|
|
19
|
+
/** A page about what the action concerns, shown as a button. */
|
|
20
|
+
readonly link?: {
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly url: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
2
25
|
/** Only human-facing facts cross into the confirmation renderer; identifiers stay in the gate. */
|
|
3
26
|
export interface ConfirmationDescription {
|
|
27
|
+
/** The action's own confirmation; the fields below are then not shown. */
|
|
28
|
+
readonly card?: ConfirmationCard;
|
|
4
29
|
readonly action: string;
|
|
5
30
|
readonly entity?: string;
|
|
6
31
|
readonly description?: string;
|
|
@@ -16,6 +41,14 @@ export interface ConfirmationDescription {
|
|
|
16
41
|
readonly chatPost?: ChatPostPreview;
|
|
17
42
|
readonly warning?: boolean;
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* The action refuses the input it would be confirmed with, in its own words: no card is shown, and
|
|
46
|
+
* the agent tells the member why.
|
|
47
|
+
*/
|
|
48
|
+
export declare class ConfirmationRefused extends Error {
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
constructor(reason: string);
|
|
51
|
+
}
|
|
19
52
|
/** A target the card cannot name, by its field's safe label, so the model learns which one and why. */
|
|
20
53
|
export declare class UnsafeConfirmationTarget extends Error {
|
|
21
54
|
readonly label: string;
|
|
@@ -34,6 +67,18 @@ export declare function humanText(value: unknown, maximum?: number): string | un
|
|
|
34
67
|
export declare function fieldSchema(value: unknown, root: Record<string, unknown>, depth?: number): Record<string, unknown>;
|
|
35
68
|
/** The annotation in which the ontology lists a confirmable action's card facts. */
|
|
36
69
|
export declare const CONFIRMATION_FACTS = "segmentstream/confirmation";
|
|
70
|
+
/**
|
|
71
|
+
* The JSON-RPC method that asks an action, whose card facts carry `preview`, what its member
|
|
72
|
+
* confirms instead of running it: `{ name, arguments, locale }`. The ontology answers as
|
|
73
|
+
* `tools/call` does, with `{ confirmation }`; an ontology without the method, or a tool that no
|
|
74
|
+
* longer describes its confirmation, answers with an error and runs nothing.
|
|
75
|
+
*/
|
|
76
|
+
export declare const CONFIRMATION_PREVIEW_METHOD = "segmentstream/confirmation/preview";
|
|
77
|
+
/**
|
|
78
|
+
* The confirmation an action described, checked as every card fact is: plain text without ids,
|
|
79
|
+
* codes or markup, emoji markers and https links. It throws on anything else, saying what.
|
|
80
|
+
*/
|
|
81
|
+
export declare function confirmationCard(value: unknown): ConfirmationCard;
|
|
37
82
|
/**
|
|
38
83
|
* The trusted inputs of {@link describeConfirmation} from the card facts the ontology lists in a
|
|
39
84
|
* confirmable tool's annotations: each listed field's label, its options' labels, and for a record
|
|
@@ -5,6 +5,14 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { isTechnicalText, withoutEmailAddresses } from "./customer-text-safety.mjs";
|
|
8
|
+
var ConfirmationRefused = class extends Error {
|
|
9
|
+
reason;
|
|
10
|
+
constructor(reason) {
|
|
11
|
+
super(reason);
|
|
12
|
+
this.reason = reason;
|
|
13
|
+
this.name = "ConfirmationRefused";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
8
16
|
var UnsafeConfirmationTarget = class extends Error {
|
|
9
17
|
label;
|
|
10
18
|
constructor(label) {
|
|
@@ -51,6 +59,57 @@ function fieldSchema(value, root, depth = 0) {
|
|
|
51
59
|
return Object.assign({}, ...ref === void 0 ? [] : [fieldSchema(referenced, root, depth + 1)], ...branches.map((branch) => fieldSchema(branch, root, depth + 1)), schema);
|
|
52
60
|
}
|
|
53
61
|
const CONFIRMATION_FACTS = "segmentstream/confirmation";
|
|
62
|
+
const CONFIRMATION_PREVIEW_METHOD = "segmentstream/confirmation/preview";
|
|
63
|
+
const ICON = /^[\p{Extended_Pictographic}\p{Regional_Indicator}\u{1F3FB}-\u{1F3FF}\u200D\uFE0F\u20E3#*0-9]{1,16}$/u;
|
|
64
|
+
function cardIcon(value, where) {
|
|
65
|
+
if (value === void 0) return;
|
|
66
|
+
if (typeof value !== "string" || !ICON.test(value) || !/\p{Extended_Pictographic}|\p{Regional_Indicator}/u.test(value)) throw new Error(`The confirmation's ${where} icon is not an emoji.`);
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
const GRANTS = new RegExp("(?:^|[?&#])(?:x-amz-[^=&]*|x-goog-[^=&]*|sig|signature|token|access_token|key|api_key|secret|password|code|credential)=", "i");
|
|
70
|
+
function cardUrl(value, where) {
|
|
71
|
+
if (value === void 0) return;
|
|
72
|
+
let url;
|
|
73
|
+
try {
|
|
74
|
+
url = typeof value === "string" && value.length <= 2048 ? new URL(value) : void 0;
|
|
75
|
+
} catch {
|
|
76
|
+
url = void 0;
|
|
77
|
+
}
|
|
78
|
+
if (url === void 0 || url.protocol !== "https:" || url.username !== "" || url.password !== "" || GRANTS.test(`${url.search}${url.hash}`) || isTechnicalText(String(value))) throw new Error(`The confirmation's ${where} link is not a plain https page.`);
|
|
79
|
+
return String(value);
|
|
80
|
+
}
|
|
81
|
+
function cardText(value, maximum, where) {
|
|
82
|
+
const issue = humanTextIssue(value, maximum);
|
|
83
|
+
if (issue !== void 0) throw new Error(`The confirmation's ${where} ${issue}.`);
|
|
84
|
+
return value.trim();
|
|
85
|
+
}
|
|
86
|
+
function confirmationCard(value) {
|
|
87
|
+
const card = object(value);
|
|
88
|
+
const facts = Array.isArray(card.facts) ? card.facts : [];
|
|
89
|
+
const details = Array.isArray(card.details) ? card.details : [];
|
|
90
|
+
if (!Array.isArray(card.facts) || facts.length > 20 || details.length > 10) throw new Error("The confirmation has no facts list, or too many lines.");
|
|
91
|
+
const link = card.link === void 0 ? void 0 : object(card.link);
|
|
92
|
+
const icon = cardIcon(card.icon, "title");
|
|
93
|
+
return {
|
|
94
|
+
title: cardText(card.title, 80, "title"),
|
|
95
|
+
...icon === void 0 ? {} : { icon },
|
|
96
|
+
facts: facts.map((item, index) => {
|
|
97
|
+
const fact = object(item);
|
|
98
|
+
const icon = cardIcon(fact.icon, `fact ${index + 1}`);
|
|
99
|
+
const url = cardUrl(fact.url, `fact ${index + 1}`);
|
|
100
|
+
return {
|
|
101
|
+
...icon === void 0 ? {} : { icon },
|
|
102
|
+
text: cardText(fact.text, 300, `fact ${index + 1}`),
|
|
103
|
+
...url === void 0 ? {} : { url }
|
|
104
|
+
};
|
|
105
|
+
}),
|
|
106
|
+
details: details.map((line, index) => cardText(line, 300, `detail ${index + 1}`)),
|
|
107
|
+
...link === void 0 ? {} : { link: {
|
|
108
|
+
text: cardText(link.text, 40, "link"),
|
|
109
|
+
url: cardUrl(link.url, "link")
|
|
110
|
+
} }
|
|
111
|
+
};
|
|
112
|
+
}
|
|
54
113
|
function factsConfirmation(facts) {
|
|
55
114
|
const properties = {};
|
|
56
115
|
const entities = new Map();
|
|
@@ -151,4 +210,4 @@ async function describeConfirmation(input) {
|
|
|
151
210
|
...targets.length === 0 ? {} : { targets }
|
|
152
211
|
};
|
|
153
212
|
}
|
|
154
|
-
export { CONFIRMATION_FACTS, UnsafeConfirmationTarget, describeConfirmation, factsConfirmation, fieldSchema, humanText, humanTextIssue, humanize, object };
|
|
213
|
+
export { CONFIRMATION_FACTS, CONFIRMATION_PREVIEW_METHOD, ConfirmationRefused, UnsafeConfirmationTarget, confirmationCard, describeConfirmation, factsConfirmation, fieldSchema, humanText, humanTextIssue, humanize, object };
|
|
@@ -8,6 +8,8 @@ export declare const CONFIRMATION_TTL_MS: number;
|
|
|
8
8
|
export interface ActionAnnotations {
|
|
9
9
|
readonly readOnlyHint?: boolean;
|
|
10
10
|
readonly confirmation?: boolean;
|
|
11
|
+
/** The action describes its own confirmation; the agent's presentation copy is optional. */
|
|
12
|
+
readonly preview?: boolean;
|
|
11
13
|
readonly destructiveHint?: boolean;
|
|
12
14
|
readonly irreversibleHint?: boolean;
|
|
13
15
|
readonly idempotentHint?: boolean;
|
|
@@ -43,7 +45,11 @@ export declare const confirmations: StateHandle<Record<string, Confirmation>>;
|
|
|
43
45
|
*/
|
|
44
46
|
export declare function actionApproval(options: {
|
|
45
47
|
readonly labels: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: Readonly<Record<string, unknown>>) => Promise<ActionAnnotations>;
|
|
46
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The card's trusted facts, or the action's own confirmation in the chat's `locale`. Throws
|
|
50
|
+
* {@link ConfirmationRefused} when the action refuses the input: no card is shown.
|
|
51
|
+
*/
|
|
52
|
+
readonly describe?: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: Readonly<Record<string, unknown>>, locale?: string) => Promise<ConfirmationDescription>;
|
|
47
53
|
/**
|
|
48
54
|
* The call's `_confirmation` when the tool input does not carry it itself, such as a file-backed
|
|
49
55
|
* call whose arguments are snapshotted elsewhere. Defaults to the tool input's own field.
|
|
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { actorOf, member } from "./actor.mjs";
|
|
8
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
9
|
-
import { UnsafeConfirmationTarget } from "./confirmation-description.mjs";
|
|
8
|
+
import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
9
|
+
import { ConfirmationRefused, UnsafeConfirmationTarget } from "./confirmation-description.mjs";
|
|
10
10
|
import { chatPostDigest, isChatPost } from "./chat-post-confirmation.mjs";
|
|
11
11
|
import { confirmationCopy, confirmationCopyIssue, confirmationLocale, renderConfirmation } from "./telegram/confirmation-text.mjs";
|
|
12
12
|
import { chatPostCard } from "./telegram/chat-post-card.mjs";
|
|
@@ -106,11 +106,12 @@ function actionApproval(options) {
|
|
|
106
106
|
}
|
|
107
107
|
if (saved !== void 0) return denied("The original call is waiting for its Confirm / Cancel buttons.");
|
|
108
108
|
if (!posting && !needsConfirmation(labels)) return "approved";
|
|
109
|
-
if (labels.confirmation === true && copy === void 0) return missingCopy();
|
|
109
|
+
if (labels.confirmation === true && labels.preview !== true && copy === void 0) return missingCopy();
|
|
110
110
|
try {
|
|
111
|
-
if (!posting) description = await options.describe?.(member(memberId), ctx.toolName, businessInput, hints);
|
|
111
|
+
if (!posting) description = await options.describe?.(member(memberId), ctx.toolName, businessInput, hints, confirmationLocale(ctx.session.auth.current));
|
|
112
112
|
if (description === void 0) throw new Error("A trusted confirmation description is required.");
|
|
113
113
|
} catch (error) {
|
|
114
|
+
if (error instanceof ConfirmationRefused) return denied(`The action refuses this input, so no card was shown and nothing ran: ${error.reason} Tell the member why in their language, in a short message; do not ask them to confirm it and do not make the same call again.`);
|
|
114
115
|
console.warn("The confirmation description could not be read.", error);
|
|
115
116
|
if (error instanceof UnsafeConfirmationTarget) return denied(`No confirmation card can name the ${error.label}: its title is missing, unreadable, or looks like a file name, link or identifier. Another call will be refused the same way; tell the member, who can rename that record or make the change in the app.`);
|
|
116
117
|
return denied("Trusted confirmation facts are incomplete, unsafe or too long. Resolve every target title and narrow the input before making a new call.");
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { n as contentText, t as CONTENT_CAPS } from "../../_chunks/content-cDtVnr8Y.mjs";
|
|
8
8
|
import { conversationEvent, conversations, sessionFailureEventId, summarizeArguments } from "./conversations.mjs";
|
|
9
9
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
10
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
10
|
+
import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
11
11
|
import { parseAddress } from "./telegram/sessions.mjs";
|
|
12
12
|
import { completionKind } from "./telegram/silent.mjs";
|
|
13
13
|
import { recordModelServiceAlert } from "./model-service-alert.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 { c as compatibleRuntimeEnvelope, u as runtimeEnvelope } from "../../_chunks/principal-
|
|
7
|
+
import { c as compatibleRuntimeEnvelope, u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
8
8
|
import { appOrigin } from "./environment.mjs";
|
|
9
9
|
import { actionApproval, confirmations } from "./confirmations.mjs";
|
|
10
10
|
import { CHAT_POST_ENVELOPE, CHAT_POST_TOOL, chatPostDigest, chatPostOperationId, isChatPost } from "./chat-post-confirmation.mjs";
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { actionApproval, confirmations, inputHash } from "./confirmations.mjs";
|
|
8
8
|
import { isChatPost } from "./chat-post-confirmation.mjs";
|
|
9
9
|
import { ontologyTools } from "./ontology-tools.mjs";
|
|
10
|
-
import { u as runtimeEnvelope } from "../../_chunks/principal-
|
|
10
|
+
import { u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
11
11
|
import { sandboxFile } from "./sandbox-session.mjs";
|
|
12
12
|
import { saveOntologyResult } from "./ontology-result-file.mjs";
|
|
13
13
|
import { actorKey, actorOf } from "./actor.mjs";
|
|
@@ -46,10 +46,10 @@ function ontologyFileCall(texts) {
|
|
|
46
46
|
if (saved.saveResult && labels.readOnlyHint !== true) throw new Error("Saving a result requires a permitted read-only ontology tool.");
|
|
47
47
|
return labels;
|
|
48
48
|
},
|
|
49
|
-
describe: async (actor, _action, input) => {
|
|
49
|
+
describe: async (actor, _action, input, _hints, locale) => {
|
|
50
50
|
const saved = bound(input, ownerOf(actor));
|
|
51
51
|
const business = Object.fromEntries(Object.entries(saved.arguments).filter(([key]) => key !== "_confirmation"));
|
|
52
|
-
return ontologyTools({ principal }).describe(actor, saved.name, business);
|
|
52
|
+
return ontologyTools({ principal }).describe(actor, saved.name, business, void 0, locale);
|
|
53
53
|
},
|
|
54
54
|
copy: (actor, input) => {
|
|
55
55
|
try {
|
|
@@ -2,6 +2,7 @@ import { type RuntimeEnvelope } from "./runtime-envelope.js";
|
|
|
2
2
|
import type { SessionAuthContext } from "eve/context";
|
|
3
3
|
import { type OntologyActor } from "./actor.js";
|
|
4
4
|
import type { ActionAnnotations } from "./confirmations.js";
|
|
5
|
+
import { type ConfirmationDescription } from "./confirmation-description.js";
|
|
5
6
|
import { type Environment } from "./environment.js";
|
|
6
7
|
import { type RuntimeToken } from "./runtime-token.js";
|
|
7
8
|
/** The annotations Eve passes with a call of an MCP connection's tool, from its own listing. */
|
|
@@ -49,7 +50,7 @@ export declare function ontologyTools(options?: {
|
|
|
49
50
|
rpc: (actor: OntologyActor, method: string, params: Record<string, unknown>, signal?: AbortSignal) => Promise<Record<string, unknown>>;
|
|
50
51
|
supportsRuntimeSource(actor: OntologyActor, signal?: AbortSignal): Promise<boolean>;
|
|
51
52
|
labels(actor: OntologyActor, action: string, input?: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: ToolHints): Promise<ActionAnnotations>;
|
|
52
|
-
describe(actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: ToolHints): Promise<
|
|
53
|
+
describe(actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>, hints?: ToolHints, locale?: string): Promise<ConfirmationDescription>;
|
|
53
54
|
};
|
|
54
55
|
export declare function ontologyToolLabels(options?: Parameters<typeof ontologyTools>[0]): (actor: OntologyActor, action: string, input?: Readonly<Record<string, unknown>>, signal?: AbortSignal, hints?: ToolHints) => Promise<ActionAnnotations>;
|
|
55
56
|
/** MCP normalizes an authored camelCase action to snake_case. */
|
|
@@ -4,15 +4,30 @@ 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 { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-
|
|
7
|
+
import { c as compatibleRuntimeEnvelope, s as RUNTIME_SOURCE_PROTOCOL, u as runtimeEnvelope } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
8
8
|
import "./agent-task.mjs";
|
|
9
9
|
import { actorHeaders, actorKey, actorOf } from "./actor.mjs";
|
|
10
|
-
import { CONFIRMATION_FACTS, describeConfirmation, factsConfirmation, object } from "./confirmation-description.mjs";
|
|
10
|
+
import { CONFIRMATION_FACTS, CONFIRMATION_PREVIEW_METHOD, ConfirmationRefused, confirmationCard, describeConfirmation, factsConfirmation, object } from "./confirmation-description.mjs";
|
|
11
11
|
import { appOrigin } from "./environment.mjs";
|
|
12
12
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
13
13
|
import { runtimeToken } from "./runtime-token.mjs";
|
|
14
14
|
import { describeChatPost, isChatPost, supportsChatPost } from "./chat-post-confirmation.mjs";
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
|
16
|
+
function rejection(error) {
|
|
17
|
+
let cause = error.cause;
|
|
18
|
+
for (let depth = 0; depth < 4 && cause !== void 0; depth++) {
|
|
19
|
+
const code = object(object(cause).structuredContent).error;
|
|
20
|
+
if (typeof code === "string") return code;
|
|
21
|
+
cause = object(cause).cause;
|
|
22
|
+
}
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
const REFUSALS = new Set([
|
|
26
|
+
"action_rejected",
|
|
27
|
+
"not_found",
|
|
28
|
+
"conflict",
|
|
29
|
+
"forbidden"
|
|
30
|
+
]);
|
|
16
31
|
var OntologyToolRejected = class extends Error {
|
|
17
32
|
code = "ontology_tool_rejected";
|
|
18
33
|
};
|
|
@@ -224,6 +239,28 @@ function ontologyTools(options = {}) {
|
|
|
224
239
|
input
|
|
225
240
|
};
|
|
226
241
|
}
|
|
242
|
+
async function preview(actor, name, input, locale, signal) {
|
|
243
|
+
let result;
|
|
244
|
+
try {
|
|
245
|
+
result = await rpc(actor, CONFIRMATION_PREVIEW_METHOD, {
|
|
246
|
+
name,
|
|
247
|
+
arguments: input,
|
|
248
|
+
locale
|
|
249
|
+
}, signal);
|
|
250
|
+
} catch (error) {
|
|
251
|
+
if (error instanceof OntologyToolRejected && REFUSALS.has(rejection(error))) throw new ConfirmationRefused(error.message);
|
|
252
|
+
console.warn("The action's confirmation could not be read; showing its fields.", error);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const structured = object(result.structuredContent);
|
|
256
|
+
if (structured.confirmation === null || structured.confirmation === void 0) return;
|
|
257
|
+
try {
|
|
258
|
+
return confirmationCard(structured.confirmation);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
console.warn("The action's confirmation cannot be shown; showing its fields.", error);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
227
264
|
async function catalogEntities(actor, signal) {
|
|
228
265
|
try {
|
|
229
266
|
const catalog = await rpc(actor, "resources/read", { uri: "ontology://catalog" }, signal);
|
|
@@ -245,10 +282,11 @@ function ontologyTools(options = {}) {
|
|
|
245
282
|
const annotations = object(tool.annotations);
|
|
246
283
|
return {
|
|
247
284
|
...Object.fromEntries(Object.entries(annotations).filter(([key]) => key !== CONFIRMATION_FACTS)),
|
|
248
|
-
confirmation: annotations["segmentstream/confirmation"] !== void 0 || object(object(tool.inputSchema).properties)._confirmation !== void 0
|
|
285
|
+
confirmation: annotations["segmentstream/confirmation"] !== void 0 || object(object(tool.inputSchema).properties)._confirmation !== void 0,
|
|
286
|
+
...object(annotations["segmentstream/confirmation"]).preview === true ? { preview: true } : {}
|
|
249
287
|
};
|
|
250
288
|
},
|
|
251
|
-
async describe(actor, action, input, hints) {
|
|
289
|
+
async describe(actor, action, input, hints, locale = "en") {
|
|
252
290
|
const signal = AbortSignal.timeout(15e3);
|
|
253
291
|
const resolved = await resolve(actor, action, input, signal, hints);
|
|
254
292
|
const { tool } = resolved;
|
|
@@ -289,6 +327,12 @@ function ontologyTools(options = {}) {
|
|
|
289
327
|
}
|
|
290
328
|
}
|
|
291
329
|
const facts = object(tool.annotations)[CONFIRMATION_FACTS];
|
|
330
|
+
const card = object(facts).preview === true ? await preview(actor, String(tool.name), input, locale, signal) : void 0;
|
|
331
|
+
if (card !== void 0) return {
|
|
332
|
+
card,
|
|
333
|
+
action: card.title,
|
|
334
|
+
fields: []
|
|
335
|
+
};
|
|
292
336
|
if (facts !== void 0) return describeConfirmation({
|
|
293
337
|
...factsConfirmation(object(facts)),
|
|
294
338
|
values: input,
|
|
@@ -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 RUNTIME_SOURCE_PROTOCOL, c as compatibleRuntimeEnvelope, l as principalRuntimeSource, u as runtimeEnvelope, d as telegramRuntimeSource } from "../../_chunks/principal-
|
|
7
|
+
export { s as RUNTIME_SOURCE_PROTOCOL, c as compatibleRuntimeEnvelope, l as principalRuntimeSource, u as runtimeEnvelope, d as telegramRuntimeSource } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { object } from "./confirmation-description.mjs";
|
|
8
8
|
import { OntologyFileUnavailable, ontologyTools } from "./ontology-tools.mjs";
|
|
9
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
9
|
+
import { i as memberIdOf } from "../../_chunks/principal-VsmaJp1x.mjs";
|
|
10
10
|
import { member } from "./actor.mjs";
|
|
11
11
|
import { redactDiagnostic } from "./diagnostics.mjs";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
@@ -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-
|
|
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";
|
|
@@ -26,8 +26,8 @@ import { runtimeToken } from "../runtime-token.mjs";
|
|
|
26
26
|
import { botIdentityCache } from "./bot.mjs";
|
|
27
27
|
import { handleConfirmationCallback, telegramConfirmationEvents } from "./confirmations.mjs";
|
|
28
28
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
29
|
-
import { d as failureText, h as withDeliveryLocale, i as withReplacedText, m as safeTelegramFetch, n as currentInboundRequest, o as currentLocale, p as reportTelegramError, r as runInboundRequest, t as InboundRequest } from "../../../_chunks/inbound-request-
|
|
30
|
-
import { n as conversationLanguage, o as telegramPrincipal } from "../../../_chunks/principal-
|
|
29
|
+
import { d as failureText, h as withDeliveryLocale, i as withReplacedText, m as safeTelegramFetch, n as currentInboundRequest, o as currentLocale, p as reportTelegramError, r as runInboundRequest, t as InboundRequest } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
|
|
30
|
+
import { n as conversationLanguage, o as telegramPrincipal } from "../../../_chunks/principal-VsmaJp1x.mjs";
|
|
31
31
|
import { gatewayImageDescriber } from "./images.mjs";
|
|
32
32
|
import { gatewayMediaCapabilities, planMedia } from "./media-policy.mjs";
|
|
33
33
|
import { agentChats } from "./chats.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 "./images.mjs";
|
|
8
|
-
import { p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
8
|
+
import { p as reportTelegramError } from "../../../_chunks/inbound-request-BQQWCrWl.mjs";
|
|
9
9
|
import { gateway, generateText } from "ai";
|
|
10
10
|
const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
|
|
11
11
|
const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
|