@segmentstream/agent 0.43.0 → 0.44.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 +1033 -0
- package/README.md +1 -0
- package/dist/_chunks/{build-metadata-CkBdh-TE.mjs → build-metadata-BnufKOxq.mjs} +1 -1
- package/dist/_chunks/{inbound-request-DgQB4g1J.mjs → inbound-request-CK0QqEOP.mjs} +36 -1
- package/dist/_chunks/{principal-nQ_gwLJs.mjs → principal-BXvelsZk.mjs} +1 -1
- package/dist/extension/config.d.ts +13 -3
- package/dist/extension/config.mjs +8 -0
- 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/attachment-tools.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-recorder.mjs +1 -1
- package/dist/extension/lib/confirmations.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/slack/attachments-send.mjs +1 -1
- package/dist/extension/lib/stored-files.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +27 -7
- package/dist/extension/lib/telegram/app-links.d.ts +39 -0
- package/dist/extension/lib/telegram/app-links.mjs +53 -0
- 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/chat-archive.mjs +1 -1
- package/dist/extension/lib/telegram/confirmations.mjs +2 -2
- package/dist/extension/lib/telegram/customer-text.d.ts +2 -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/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.mjs +2 -0
- package/dist/extension/lib/whatsapp/links.d.ts +12 -0
- package/dist/extension/lib/whatsapp/links.mjs +34 -0
- package/dist/extension/model.mjs +1 -1
- package/dist/extension/tools/attachments_promote.mjs +1 -1
- package/dist/extension/tools/questions_ask.mjs +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -114,6 +114,7 @@ See [Sandbox](#sandbox).
|
|
|
114
114
|
| `channels.telegram.policy` | `"smart"` | Classifies unaddressed group messages and captionless uploads; `mention` observes unaddressed messages without decoding or inference |
|
|
115
115
|
| `channels.telegram.linkPreviews` | `external` | Suppress own-workspace previews and preview the first external link; opt into `all` for native previews or `none` to disable them. Caller options take precedence. |
|
|
116
116
|
| `channels.telegram.additionalOwnOrigins` | `[]` | Additional exact HTTP(S) workspace origins, including local ports; no paths or credentials. |
|
|
117
|
+
| `channels.telegram.appLinks` | `"web"` | `"miniApp"` opens links to the app's own pages in the bot's Main Mini App (`t.me/<bot>?startapp=…`) as messages are delivered; see `docs/agent.md` |
|
|
117
118
|
| `channels.telegram.interimMessages` | `false` | `true` delivers the text the model writes before calling tools as its own message, like a reply; see [Telegram answer delivery](#telegram-answer-delivery) |
|
|
118
119
|
| `models.stt` | `"spacexai/grok-stt"` | The AI Gateway transcription model for voice messages; `false` leaves them untranscribed |
|
|
119
120
|
| `models.imageDescription` | `google/gemini-2.5-flash-lite` | Image evidence for group routing even with native vision; `false` disables descriptions |
|
|
@@ -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.44.0";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -12,6 +12,7 @@ import { confirmationEntities } from "../extension/lib/telegram/confirmation-tex
|
|
|
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";
|
|
15
|
+
import { miniAppLinks } from "../extension/lib/telegram/app-links.mjs";
|
|
15
16
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
16
17
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
17
18
|
import { telegramPreviewOptions, telegramTextLinks } from "@segmentstream/ontology/telegram";
|
|
@@ -119,7 +120,28 @@ var TelegramDeliveryError = class extends Error {
|
|
|
119
120
|
this.messageIds = messageIds;
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
|
-
function
|
|
123
|
+
function isFields(value) {
|
|
124
|
+
return typeof value === "object" && value !== null;
|
|
125
|
+
}
|
|
126
|
+
function records(value) {
|
|
127
|
+
return Array.isArray(value) ? value.filter(isFields) : [];
|
|
128
|
+
}
|
|
129
|
+
function linkDestinations(body) {
|
|
130
|
+
const markup = body.reply_markup;
|
|
131
|
+
return [
|
|
132
|
+
...records(body.entities),
|
|
133
|
+
...records(body.caption_entities),
|
|
134
|
+
...records(body.media).flatMap((item) => records(item.caption_entities)),
|
|
135
|
+
...Array.isArray(markup?.inline_keyboard) ? markup.inline_keyboard.flatMap(records) : []
|
|
136
|
+
].flatMap((item) => typeof item.url === "string" ? [item.url] : []);
|
|
137
|
+
}
|
|
138
|
+
function withAppLinks(items, links) {
|
|
139
|
+
return links.size === 0 || !Array.isArray(items) ? items : items.map((item) => isFields(item) && typeof item.url === "string" && links.has(item.url) ? {
|
|
140
|
+
...item,
|
|
141
|
+
url: links.get(item.url)
|
|
142
|
+
} : item);
|
|
143
|
+
}
|
|
144
|
+
function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}, appLinks) {
|
|
123
145
|
const methods = new Set([
|
|
124
146
|
"sendMessage",
|
|
125
147
|
"editMessageText",
|
|
@@ -135,6 +157,10 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}) {
|
|
|
135
157
|
if (!methods.has(url.split("/").at(-1) ?? "") || typeof init?.body !== "string") return fetchImpl(input, init);
|
|
136
158
|
const body = JSON.parse(init.body);
|
|
137
159
|
let textBlocked = false;
|
|
160
|
+
const fixed = ["text", "caption"].some((field) => {
|
|
161
|
+
const value = body[field];
|
|
162
|
+
return typeof value === "string" && (isExactChatPostCard(value) || confirmationEntities(value) !== void 0);
|
|
163
|
+
});
|
|
138
164
|
for (const field of ["text", "caption"]) {
|
|
139
165
|
if (typeof body[field] === "string" && isExactChatPostCard(body[field])) body.parse_mode = "MarkdownV2";
|
|
140
166
|
if (typeof body[field] === "string" && !isExactChatPostCard(body[field])) {
|
|
@@ -179,6 +205,14 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}) {
|
|
|
179
205
|
if (rows.length === 0 && markup.inline_keyboard.length > 0) delete body.reply_markup;
|
|
180
206
|
else markup.inline_keyboard = rows;
|
|
181
207
|
}
|
|
208
|
+
const links = appLinks === void 0 || fixed ? new Map() : await miniAppLinks(appLinks, linkDestinations(body));
|
|
209
|
+
if (links.size > 0) {
|
|
210
|
+
if (Array.isArray(markup?.inline_keyboard) && body.reply_markup !== void 0) markup.inline_keyboard = markup.inline_keyboard.map((row) => withAppLinks(row, links));
|
|
211
|
+
if (Array.isArray(body.media)) body.media = body.media.map((item) => isFields(item) && item.caption_entities !== void 0 ? {
|
|
212
|
+
...item,
|
|
213
|
+
caption_entities: withAppLinks(item.caption_entities, links)
|
|
214
|
+
} : item);
|
|
215
|
+
}
|
|
182
216
|
const send = async () => {
|
|
183
217
|
const parts = url.endsWith("/sendMessage") && typeof body.text === "string" && !isExactChatPostCard(body.text) ? splitTelegramText({
|
|
184
218
|
text: body.text,
|
|
@@ -195,6 +229,7 @@ function safeTelegramFetch(fetchImpl, scope = "telegram", previews = {}) {
|
|
|
195
229
|
delete payload.disable_web_page_preview;
|
|
196
230
|
Object.assign(payload, previewOptions);
|
|
197
231
|
}
|
|
232
|
+
for (const field of ["entities", "caption_entities"]) if (payload[field] !== void 0) payload[field] = withAppLinks(payload[field], links);
|
|
198
233
|
return await fetchImpl(input, {
|
|
199
234
|
...init,
|
|
200
235
|
body: JSON.stringify(payload)
|
|
@@ -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-CK0QqEOP.mjs";
|
|
8
8
|
import "../extension/lib/agent-task.mjs";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
function telegramRuntimeSource(message, files, callbackQueryId) {
|
|
@@ -4,6 +4,7 @@ import { type StructuredInbound } from "./lib/telegram/structured-settings.js";
|
|
|
4
4
|
import type { WorkspaceActionHook } from "./lib/telegram/workspace-action.js";
|
|
5
5
|
import { type TelegramTexts } from "./lib/telegram/texts.js";
|
|
6
6
|
import type { AttachmentLifecycle } from "./lib/telegram/lifecycle.js";
|
|
7
|
+
import { type TelegramAppLinks } from "./lib/telegram/app-links.js";
|
|
7
8
|
import { type PersonaSettings } from "./personas.js";
|
|
8
9
|
import { type ReviewSettings, type ReviewMode } from "./review.js";
|
|
9
10
|
import { type TelegramLinkPreviews } from "@segmentstream/ontology/telegram";
|
|
@@ -79,6 +80,11 @@ export interface SegmentStreamAgentConfigInput {
|
|
|
79
80
|
readonly linkPreviews?: string;
|
|
80
81
|
/** Additional exact HTTP(S) origins belonging to this workspace. */
|
|
81
82
|
readonly additionalOwnOrigins?: readonly string[];
|
|
83
|
+
/**
|
|
84
|
+
* How links to the workspace's own app open: `web` (default) leaves them as written,
|
|
85
|
+
* `miniApp` opens their pages in the bot's Main Mini App.
|
|
86
|
+
*/
|
|
87
|
+
readonly appLinks?: string;
|
|
82
88
|
/**
|
|
83
89
|
* Whether text the model writes before it calls tools reaches the chat as its own message,
|
|
84
90
|
* like a reply. Off when absent: only final replies are delivered.
|
|
@@ -204,6 +210,8 @@ export interface TelegramSettings {
|
|
|
204
210
|
readonly policy: TelegramPolicy;
|
|
205
211
|
readonly linkPreviews?: TelegramLinkPreviews;
|
|
206
212
|
readonly additionalOwnOrigins?: readonly string[];
|
|
213
|
+
/** `miniApp` when links to the app open in the Mini App; validation sets it only then. */
|
|
214
|
+
readonly appLinks?: Exclude<TelegramAppLinks, "web">;
|
|
207
215
|
/** Whether interim messages are on; validation sets it only when they are. */
|
|
208
216
|
readonly interimMessages?: boolean;
|
|
209
217
|
readonly attachmentLifecycle?: AttachmentLifecycle;
|
|
@@ -268,9 +276,11 @@ export interface ConfigIssue {
|
|
|
268
276
|
/** A setting `agent/segmentstream.json` sets that configures nothing: accepted, and ignored. */
|
|
269
277
|
export type ConfigWarning = ConfigIssue;
|
|
270
278
|
/**
|
|
271
|
-
* Every setting the configuration sets that
|
|
272
|
-
* console, so the builder learns of it where they work: retired session and group keys
|
|
273
|
-
* older policies' thresholds where the chat policy applies
|
|
279
|
+
* Every setting the configuration sets that the builder should change, for the deploy output and
|
|
280
|
+
* the console, so the builder learns of it where they work: retired session and group keys and the
|
|
281
|
+
* older policies' thresholds where the chat policy applies, which configure nothing, and
|
|
282
|
+
* deprecated settings, which still apply until replaced. Each message says which and what to do.
|
|
283
|
+
* The agent also logs them.
|
|
274
284
|
*/
|
|
275
285
|
export declare function configWarnings(value: unknown): ReadonlyArray<ConfigWarning>;
|
|
276
286
|
type Validation = {
|
|
@@ -9,6 +9,7 @@ import { localizedText as localizedText$1 } from "./lib/admission.mjs";
|
|
|
9
9
|
import { STRUCTURED_KINDS } from "./lib/telegram/structured-settings.mjs";
|
|
10
10
|
import { TELEGRAM_TEXT_KEYS } from "./lib/telegram/texts.mjs";
|
|
11
11
|
import { isTechnicalText } from "./lib/customer-text-safety.mjs";
|
|
12
|
+
import { TELEGRAM_APP_LINKS } from "./lib/telegram/app-links.mjs";
|
|
12
13
|
import { inlineConventionFiles } from "./conventions.mjs";
|
|
13
14
|
import { personaSettings } from "./personas.mjs";
|
|
14
15
|
import { earlierReviewInput, reviewSettings } from "./review.mjs";
|
|
@@ -187,6 +188,7 @@ function telegramSettings(value, issues) {
|
|
|
187
188
|
"groups",
|
|
188
189
|
"linkPreviews",
|
|
189
190
|
"additionalOwnOrigins",
|
|
191
|
+
"appLinks",
|
|
190
192
|
"interimMessages",
|
|
191
193
|
"attachmentLifecycle",
|
|
192
194
|
"menuButton",
|
|
@@ -234,6 +236,11 @@ function telegramSettings(value, issues) {
|
|
|
234
236
|
message: "must be an array of HTTP(S) origins without paths, credentials, queries or fragments",
|
|
235
237
|
path: [...path, "additionalOwnOrigins"]
|
|
236
238
|
});
|
|
239
|
+
const appLinks = telegram.appLinks === void 0 ? "web" : telegram.appLinks;
|
|
240
|
+
if (!TELEGRAM_APP_LINKS.some((mode) => mode === appLinks)) issues.push({
|
|
241
|
+
message: "must be \"web\" or \"miniApp\"",
|
|
242
|
+
path: [...path, "appLinks"]
|
|
243
|
+
});
|
|
237
244
|
const interimMessages = telegram.interimMessages === void 0 ? false : telegram.interimMessages;
|
|
238
245
|
if (typeof interimMessages !== "boolean") issues.push({
|
|
239
246
|
message: "must be true or false",
|
|
@@ -308,6 +315,7 @@ function telegramSettings(value, issues) {
|
|
|
308
315
|
} },
|
|
309
316
|
linkPreviews,
|
|
310
317
|
additionalOwnOrigins,
|
|
318
|
+
...appLinks === "miniApp" ? { appLinks: "miniApp" } : {},
|
|
311
319
|
...interimMessages === true ? { interimMessages: true } : {},
|
|
312
320
|
...menuText === void 0 ? {} : { menuButton: { text: menuText } },
|
|
313
321
|
...lifecycle === void 0 ? {} : { attachmentLifecycle: {
|
|
@@ -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-BXvelsZk.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;
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import segmentstream from "../extension.mjs";
|
|
8
|
-
import { a as rolesOf } from "../../_chunks/principal-
|
|
8
|
+
import { a as rolesOf } from "../../_chunks/principal-BXvelsZk.mjs";
|
|
9
9
|
import { personaFor } from "../personas.mjs";
|
|
10
10
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
11
11
|
var persona_default = defineDynamic((context) => {
|
|
@@ -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-BXvelsZk.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 { chatAddressOf } from "./chat-address.mjs";
|
|
13
|
-
import { i as memberIdOf } from "../../_chunks/principal-
|
|
13
|
+
import { i as memberIdOf } from "../../_chunks/principal-BXvelsZk.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-BnufKOxq.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 "../../_chunks/principal-
|
|
7
|
+
import "../../_chunks/principal-BXvelsZk.mjs";
|
|
8
8
|
const CHAT_ATTRIBUTE = "segmentstreamChat";
|
|
9
9
|
const EARLIER_CHAT_ATTRIBUTE = "segmentstreamConversation";
|
|
10
10
|
function withChatAddress(principal, chat) {
|
|
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
|
|
|
7
7
|
import { agentTaskIdOf } from "./agent-task.mjs";
|
|
8
8
|
import { chatCoordinates } from "./chat-recorder.mjs";
|
|
9
9
|
import { chatArchive, collapseChatEvents, topicContext } from "./chat-archive.mjs";
|
|
10
|
-
import { p as reportTelegramError } from "../../_chunks/inbound-request-
|
|
10
|
+
import { p as reportTelegramError } from "../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { deliveries, runs, turns } from "eve/events";
|
|
13
13
|
import { defineState } from "eve/context";
|
|
@@ -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 { chatArchive, chatEvent, sessionFailureEventId, summarizeArguments } from "./chat-archive.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-BXvelsZk.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";
|
|
@@ -5,7 +5,7 @@ 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-
|
|
8
|
+
import { i as memberIdOf } from "../../_chunks/principal-BXvelsZk.mjs";
|
|
9
9
|
import { ConfirmationRefused, UnsafeConfirmationTarget } from "./confirmation-description.mjs";
|
|
10
10
|
import { chatPostDigest, isChatPost } from "./chat-post-confirmation.mjs";
|
|
11
11
|
import { promptFits } from "./confirmation-buttons.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-BXvelsZk.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-BXvelsZk.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";
|
|
@@ -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, 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-BXvelsZk.mjs";
|
|
8
8
|
import "./agent-task.mjs";
|
|
9
9
|
import { actorHeaders, actorKey, actorOf } from "./actor.mjs";
|
|
10
10
|
import { CONFIRMATION_FACTS, CONFIRMATION_PREVIEW_METHOD, ConfirmationRefused, confirmationCard, describeConfirmation, factsConfirmation, object } from "./confirmation-description.mjs";
|
|
@@ -6,7 +6,7 @@ __eveDirname(__filename);
|
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { reviewFor } from "../../review.mjs";
|
|
8
8
|
import { chatAddressOf } from "../chat-address.mjs";
|
|
9
|
-
import { a as rolesOf, i as memberIdOf } from "../../../_chunks/principal-
|
|
9
|
+
import { a as rolesOf, i as memberIdOf } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
10
10
|
function reviewOf(settings, principal) {
|
|
11
11
|
return reviewFor(settings, rolesOf(principal));
|
|
12
12
|
}
|
|
@@ -8,7 +8,7 @@ import { chatAddressOf } from "../chat-address.mjs";
|
|
|
8
8
|
import { chatArchive, chatEvent } from "../chat-archive.mjs";
|
|
9
9
|
import { appOrigin } from "../environment.mjs";
|
|
10
10
|
import { agentReviews } from "./client.mjs";
|
|
11
|
-
import { i as memberIdOf } from "../../../_chunks/principal-
|
|
11
|
+
import { i as memberIdOf } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
12
12
|
import { heldReply, repliesReviewed, reviewOf, reviewOutcome } from "./hold.mjs";
|
|
13
13
|
import { judgeReply, readChat } from "./judge.mjs";
|
|
14
14
|
const VERDICTS_REMEMBERED = 512;
|
|
@@ -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-BXvelsZk.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 { 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-BXvelsZk.mjs";
|
|
@@ -14,7 +14,7 @@ import { transientFileStatus } from "../file-grant.mjs";
|
|
|
14
14
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
15
15
|
import { StoredFileError, fetchStoredFile } from "../sent-files.mjs";
|
|
16
16
|
import { confirmationLocale } from "../telegram/confirmation-text.mjs";
|
|
17
|
-
import { d as failureText } from "../../../_chunks/inbound-request-
|
|
17
|
+
import { d as failureText } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
18
18
|
import { proxiedSlackFetch } from "./adapter.mjs";
|
|
19
19
|
import { randomUUID } from "node:crypto";
|
|
20
20
|
const SLACK_API = "https://slack.com/api/";
|
|
@@ -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-BXvelsZk.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-BnufKOxq.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 chatLanguage, 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-CK0QqEOP.mjs";
|
|
30
|
+
import { n as chatLanguage, o as telegramPrincipal } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
31
31
|
import { gatewayImageDescriber } from "./images.mjs";
|
|
32
32
|
import { gatewayMediaCapabilities, planMedia } from "./media-policy.mjs";
|
|
33
33
|
import { agentChats } from "../chats.mjs";
|
|
@@ -122,6 +122,20 @@ function segmentstreamTelegram(options) {
|
|
|
122
122
|
}
|
|
123
123
|
return existing;
|
|
124
124
|
}
|
|
125
|
+
async function botRequest(method, body = {}) {
|
|
126
|
+
const reply = await proxy().request({
|
|
127
|
+
api: "bot",
|
|
128
|
+
method: "POST",
|
|
129
|
+
path: `/${method}`,
|
|
130
|
+
headers: [["content-type", "application/json"]],
|
|
131
|
+
body: new TextEncoder().encode(JSON.stringify(body))
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
ok: reply.status >= 200 && reply.status < 300,
|
|
135
|
+
status: reply.status,
|
|
136
|
+
body: JSON.parse(new TextDecoder().decode(reply.body))
|
|
137
|
+
};
|
|
138
|
+
}
|
|
125
139
|
function pairing() {
|
|
126
140
|
identities ??= agentIdentities({
|
|
127
141
|
origin: appOrigin(environment),
|
|
@@ -187,10 +201,16 @@ function segmentstreamTelegram(options) {
|
|
|
187
201
|
api: {
|
|
188
202
|
apiBaseUrl: TELEGRAM_PROXY_ORIGIN,
|
|
189
203
|
fileBaseUrl: TELEGRAM_PROXY_ORIGIN,
|
|
190
|
-
fetch: (input, init) =>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
fetch: (input, init) => {
|
|
205
|
+
const ownOrigins = telegramPreviewEnvironment(environment).appOrigins;
|
|
206
|
+
return safeTelegramFetch(captureTelegramFetch(telegramProxyFetch(proxy(), telegramSendScope(environment, settings().connection)), archive, pairing), telegramSendScope(environment, settings().connection), {
|
|
207
|
+
settings: settings(),
|
|
208
|
+
ownOrigins
|
|
209
|
+
}, settings().appLinks === "miniApp" ? {
|
|
210
|
+
origins: [...ownOrigins, ...settings().additionalOwnOrigins ?? []],
|
|
211
|
+
botUsername: async () => (await bot({ request: botRequest }))?.username
|
|
212
|
+
} : void 0)(input, init);
|
|
213
|
+
}
|
|
194
214
|
},
|
|
195
215
|
credentials: {
|
|
196
216
|
botToken: TELEGRAM_PLACEHOLDER_TOKEN,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Links to the workspace's own app that open in the bot's Main Mini App instead of a browser,
|
|
3
|
+
* when `channels.telegram.appLinks` is `miniApp`.
|
|
4
|
+
*
|
|
5
|
+
* A page travels as Telegram's `startapp` parameter, which allows only `[A-Za-z0-9_-]` and at most
|
|
6
|
+
* 512 characters: `p_`, then the page's path and query as `encodeURIComponent` writes them, with
|
|
7
|
+
* `_ . ! ~ * ' ( )` escaped as well and every `%` written as `_`. The page's fragment is not
|
|
8
|
+
* carried: a redirect that named one would replace the fragment Telegram signs the launch with.
|
|
9
|
+
* The app SDK's proxy decodes the parameter and opens the page, where the Mini App sign-in signs
|
|
10
|
+
* the reader in. `tests/fixtures/telegram-app-links.json` is the contract both SDKs test against.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TELEGRAM_APP_LINKS: readonly ["web", "miniApp"];
|
|
13
|
+
/** How a link to the workspace's app opens from Telegram: in a browser, or in the Mini App. */
|
|
14
|
+
export type TelegramAppLinks = (typeof TELEGRAM_APP_LINKS)[number];
|
|
15
|
+
/** What the delivery guard needs to open the app's links in the Mini App. */
|
|
16
|
+
export interface TelegramAppLinkContext {
|
|
17
|
+
/** The app's own origins; links to any other origin stay as they are. */
|
|
18
|
+
readonly origins: readonly string[];
|
|
19
|
+
/** The bot's username, from a cached lookup; without one, links stay as they are. */
|
|
20
|
+
readonly botUsername: () => Promise<string | undefined>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether a link may open the app's page at `pathname`: a local path, also once decoded, that is
|
|
24
|
+
* not an API, an asset, or a page where the member decides something.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isAppContentPage(pathname: string): boolean;
|
|
27
|
+
/** The `startapp` value of a page's path and query, or `undefined` when it does not fit. */
|
|
28
|
+
export declare function telegramStartParam(page: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The link that opens `url` in the bot's Main Mini App, or `undefined` when it stays as it is: a
|
|
31
|
+
* link to another origin, to a page that is not content, or whose page does not fit.
|
|
32
|
+
*/
|
|
33
|
+
export declare function miniAppLink(url: string, origins: ReadonlySet<string>, botUsername: string): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The Mini App link of each of `urls` that has one, keyed by the original. The bot's username is
|
|
36
|
+
* looked up only when a link qualifies, and a username Telegram would not accept leaves every
|
|
37
|
+
* link as it is.
|
|
38
|
+
*/
|
|
39
|
+
export declare function miniAppLinks(context: TelegramAppLinkContext, urls: Iterable<string>): Promise<ReadonlyMap<string, string>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
const TELEGRAM_APP_LINKS = ["web", "miniApp"];
|
|
8
|
+
const START_PARAM_PREFIX = "p_";
|
|
9
|
+
const MAXIMUM_START_PARAM_LENGTH = 512;
|
|
10
|
+
const NOT_LINKED_PATHS = [
|
|
11
|
+
"/api",
|
|
12
|
+
"/mcp",
|
|
13
|
+
"/.well-known",
|
|
14
|
+
"/_next",
|
|
15
|
+
"/oauth/consent",
|
|
16
|
+
"/agent/connect",
|
|
17
|
+
"/sign-in"
|
|
18
|
+
];
|
|
19
|
+
const UNSAFE_CHARACTERS = /[\\\u0000-\u001f\u007f]/u;
|
|
20
|
+
function underPath(pathname, prefix) {
|
|
21
|
+
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
|
22
|
+
}
|
|
23
|
+
function isAppContentPage(pathname) {
|
|
24
|
+
let decoded;
|
|
25
|
+
try {
|
|
26
|
+
decoded = decodeURIComponent(pathname);
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return [pathname, decoded].every((path) => path.startsWith("/") && !path.startsWith("//") && !UNSAFE_CHARACTERS.test(path) && !NOT_LINKED_PATHS.some((prefix) => underPath(path, prefix)));
|
|
31
|
+
}
|
|
32
|
+
function telegramStartParam(page) {
|
|
33
|
+
const startParam = START_PARAM_PREFIX + encodeURIComponent(page).replace(/[_.!~*'()]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`).replaceAll("%", "_");
|
|
34
|
+
return startParam.length <= MAXIMUM_START_PARAM_LENGTH ? startParam : void 0;
|
|
35
|
+
}
|
|
36
|
+
function miniAppLink(url, origins, botUsername) {
|
|
37
|
+
const parsed = URL.parse(url);
|
|
38
|
+
if (parsed === null || parsed.protocol !== "https:" && parsed.protocol !== "http:" || parsed.username !== "" || parsed.password !== "" || !origins.has(parsed.origin) || !isAppContentPage(parsed.pathname) || UNSAFE_CHARACTERS.test(parsed.search)) return;
|
|
39
|
+
const startParam = telegramStartParam(`${parsed.pathname}${parsed.search}`);
|
|
40
|
+
return startParam === void 0 ? void 0 : `https://t.me/${botUsername}?startapp=${startParam}`;
|
|
41
|
+
}
|
|
42
|
+
async function miniAppLinks(context, urls) {
|
|
43
|
+
const origins = new Set(context.origins.flatMap((origin) => {
|
|
44
|
+
const parsed = URL.parse(origin);
|
|
45
|
+
return parsed === null ? [] : [parsed.origin];
|
|
46
|
+
}));
|
|
47
|
+
const candidates = [...new Set(urls)].filter((url) => miniAppLink(url, origins, "bot") !== void 0);
|
|
48
|
+
if (candidates.length === 0) return new Map();
|
|
49
|
+
const username = await context.botUsername();
|
|
50
|
+
if (username === void 0 || !/^[A-Za-z0-9_]{1,64}$/u.test(username)) return new Map();
|
|
51
|
+
return new Map(candidates.map((url) => [url, miniAppLink(url, origins, username)]));
|
|
52
|
+
}
|
|
53
|
+
export { TELEGRAM_APP_LINKS, isAppContentPage, miniAppLink, miniAppLinks, telegramStartParam };
|
|
@@ -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-CK0QqEOP.mjs";
|
|
9
9
|
import { gateway, generateText } from "ai";
|
|
10
10
|
const MAXIMUM_ROUTING_ATTACHMENT_BYTES = 5242880;
|
|
11
11
|
const ROUTING_ATTACHMENT_TIMEOUT_MS = 15e3;
|
|
@@ -12,10 +12,10 @@ import { transientFileStatus } from "../file-grant.mjs";
|
|
|
12
12
|
import { StoredFileError, fetchStoredFile } from "../sent-files.mjs";
|
|
13
13
|
import { appOrigin, channelsEnabled, proxyEnvironment } from "../environment.mjs";
|
|
14
14
|
import { runtimeToken } from "../runtime-token.mjs";
|
|
15
|
-
import "../../../_chunks/principal-
|
|
15
|
+
import "../../../_chunks/principal-BXvelsZk.mjs";
|
|
16
16
|
import { confirmationLocale } from "./confirmation-text.mjs";
|
|
17
17
|
import { inTelegramSendQueue, telegramSendScope } from "./send-queue.mjs";
|
|
18
|
-
import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
18
|
+
import { d as failureText, f as formattingRefused, l as customerMessage, p as reportTelegramError } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
19
19
|
import { TELEGRAM_PLACEHOLDER_TOKEN, TELEGRAM_PROXY_ORIGIN, telegramProxyFetch } from "./proxy-fetch.mjs";
|
|
20
20
|
const MAXIMUM_PHOTO_BYTES = 10485760;
|
|
21
21
|
const MAXIMUM_DOCUMENT_BYTES = 52428800;
|
|
@@ -5,8 +5,8 @@ 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 telegramRuntimeSource, i as memberIdOf, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-
|
|
9
|
-
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
8
|
+
import { d as telegramRuntimeSource, i as memberIdOf, o as telegramPrincipal, u as runtimeEnvelope } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
9
|
+
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
10
10
|
import { formatAddress, parseAddress, scopedAddress } from "./sessions.mjs";
|
|
11
11
|
import { telegramText } from "./texts.mjs";
|
|
12
12
|
import { workspaceAction } from "./workspace-action.mjs";
|
|
@@ -9,7 +9,7 @@ import { n as contentText, t as CONTENT_CAPS } from "../../../_chunks/content-cD
|
|
|
9
9
|
import { chatEvent, sessionFailureEventId } from "../chat-archive.mjs";
|
|
10
10
|
import { currentConfirmationPrompt } from "../group-routing/messages.mjs";
|
|
11
11
|
import { messageMetadata } from "./message-metadata.mjs";
|
|
12
|
-
import { n as currentInboundRequest, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-
|
|
12
|
+
import { n as currentInboundRequest, p as reportTelegramError, s as currentThreadId } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
13
13
|
import { reportMembership } from "./membership.mjs";
|
|
14
14
|
import { currentDeliveryScope } from "./delivery-diagnostics.mjs";
|
|
15
15
|
import { contentShape, messageContent } from "./content.mjs";
|
|
@@ -12,9 +12,9 @@ import { chatPostOperationId, isChatPost } from "../chat-post-confirmation.mjs";
|
|
|
12
12
|
import { chatEvent } from "../chat-archive.mjs";
|
|
13
13
|
import { chatPostCard, chatPostCardStatus, chatPostReceipt, withChatPostCard } from "./chat-post-card.mjs";
|
|
14
14
|
import { answerMarker, isPendingQuestion, pendingQuestions, questionKey } from "../questions.mjs";
|
|
15
|
-
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
15
|
+
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
16
16
|
import { confirmationStatus, renderConfirmation, withConfirmationText } from "./confirmation-text.mjs";
|
|
17
|
-
import { i as memberIdOf, o as telegramPrincipal } from "../../../_chunks/principal-
|
|
17
|
+
import { i as memberIdOf, o as telegramPrincipal } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
18
18
|
import { formatAddress, scopedAddress } from "./sessions.mjs";
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
20
20
|
import { telegramTextLinks } from "@segmentstream/ontology/telegram";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TelegramPreviewContext } from "@segmentstream/ontology/telegram";
|
|
2
2
|
import { type TelegramText } from "./format.js";
|
|
3
|
+
import { type TelegramAppLinkContext } from "./app-links.js";
|
|
3
4
|
export { isTechnicalText } from "../customer-text-safety.js";
|
|
4
5
|
export declare function withDeliveryLocale<T>(locale: string, run: () => T, threadId?: string, replyTo?: string, chatId?: string): T;
|
|
5
6
|
export declare function currentLocale(): string;
|
|
@@ -32,4 +33,4 @@ export declare class TelegramDeliveryError extends Error {
|
|
|
32
33
|
constructor(reference: string, delivery: "failed" | "unknown", messageIds: readonly number[]);
|
|
33
34
|
}
|
|
34
35
|
/** Covers framework defaults, edits and callback notices as well as ordinary agent replies. */
|
|
35
|
-
export declare function safeTelegramFetch(fetchImpl: typeof fetch, scope?: string, previews?: TelegramPreviewContext): typeof fetch;
|
|
36
|
+
export declare function safeTelegramFetch(fetchImpl: typeof fetch, scope?: string, previews?: TelegramPreviewContext, appLinks?: TelegramAppLinkContext): typeof fetch;
|
|
@@ -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 { a as TelegramDeliveryError, c as customerCopy, d as failureText, f as formattingRefused, h as withDeliveryLocale, l as customerMessage, m as safeTelegramFetch, o as currentLocale, p as reportTelegramError, s as currentThreadId, u as customerText } from "../../../_chunks/inbound-request-
|
|
8
|
+
import { a as TelegramDeliveryError, c as customerCopy, d as failureText, f as formattingRefused, h as withDeliveryLocale, l as customerMessage, m as safeTelegramFetch, o as currentLocale, p as reportTelegramError, s as currentThreadId, u as customerText } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
9
9
|
export { TelegramDeliveryError, currentLocale, currentThreadId, customerCopy, customerMessage, customerText, failureText, formattingRefused, isTechnicalText, reportTelegramError, safeTelegramFetch, withDeliveryLocale };
|
|
@@ -5,8 +5,8 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { MAXIMUM_ATTACHMENT_BYTES, attachmentUrl } from "../attachments.mjs";
|
|
8
|
-
import { d as failureText, p as reportTelegramError } from "../../../_chunks/inbound-request-
|
|
9
|
-
import { n as chatLanguage } from "../../../_chunks/principal-
|
|
8
|
+
import { d as failureText, p as reportTelegramError } from "../../../_chunks/inbound-request-CK0QqEOP.mjs";
|
|
9
|
+
import { n as chatLanguage } from "../../../_chunks/principal-BXvelsZk.mjs";
|
|
10
10
|
import { describableImage, describeReceivedImage } from "./images.mjs";
|
|
11
11
|
function telegramChat(chatId) {
|
|
12
12
|
return `telegram:${chatId}`;
|