@segmentstream/ontology 0.182.0 → 0.184.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 +62 -0
- package/README.md +23 -15
- package/dist/action.d.ts +11 -4
- package/dist/agent-chat.d.ts +6 -0
- package/dist/agent-chat.js +43 -28
- package/dist/analyze.d.ts +6 -1
- package/dist/analyze.js +51 -19
- package/dist/authoring.js +7 -1
- package/dist/channel-files.d.ts +17 -0
- package/dist/chat.d.ts +32 -3
- package/dist/chat.js +33 -12
- package/dist/email.d.ts +3 -7
- package/dist/manifest.d.ts +64 -0
- package/dist/manifest.js +9 -0
- package/dist/migrate/model.d.ts +16 -0
- package/dist/permissions.d.ts +17 -0
- package/dist/permissions.js +17 -0
- package/dist/render.d.ts +6 -0
- package/dist/render.js +25 -10
- package/dist/runtime/pipeline.d.ts +3 -3
- package/dist/runtime/pipeline.js +11 -4
- package/dist/service/catalog.js +3 -3
- package/dist/service/chat/chat-draft.d.ts +1 -1
- package/dist/service/chat/delivery.js +43 -22
- package/dist/service/chat/providers/email.js +13 -37
- package/dist/service/chat/providers/files-send.d.ts +2 -0
- package/dist/service/chat/providers/files-send.js +2 -0
- package/dist/service/chat/providers/provider.d.ts +15 -1
- package/dist/service/chat/providers/provider.js +53 -0
- package/dist/service/chat/providers/telegram.d.ts +21 -8
- package/dist/service/chat/providers/telegram.js +220 -48
- package/dist/service/chat/routes.js +2 -0
- package/dist/service/chat/schemas.d.ts +40 -0
- package/dist/service/chat/schemas.js +3 -1
- package/dist/service/mcp/server.js +2 -0
- package/dist/service/mcp/tools.d.ts +10 -2
- package/dist/service/mcp/tools.js +11 -4
- package/dist/service/operations.js +8 -4
- package/dist/service/plan.d.ts +3 -1
- package/dist/service/plan.js +4 -2
- package/dist/service/schemas.d.ts +4 -0
- package/dist/service/service.js +2 -2
- package/dist/telegram.d.ts +84 -1
- package/dist/telegram.js +14 -0
- package/package.json +1 -1
package/dist/telegram.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TelegramFormatConverter } from "@chat-adapter/telegram";
|
|
2
|
+
import type { ChannelDeliverFile, ChannelDeliveredFile } from "./channel-files.js";
|
|
2
3
|
/**
|
|
3
4
|
* Private chats and basic groups number messages per account. Supergroup and channel
|
|
4
5
|
* message numbers are shared. Their Bot API peer IDs start below -1000000000000.
|
|
@@ -66,6 +67,88 @@ export declare function telegramStartParam(page: string): string | undefined;
|
|
|
66
67
|
export declare function miniAppLink(url: string, origins: ReadonlySet<string>, botUsername: string): string | undefined;
|
|
67
68
|
/** A username Telegram accepts in a `t.me` link; any other leaves every link as it is. */
|
|
68
69
|
export declare function isTelegramBotUsername(username: string): boolean;
|
|
69
|
-
|
|
70
|
+
/** The most characters Telegram takes in one message's text. */
|
|
71
|
+
export declare const TELEGRAM_MESSAGE_LIMIT = 4096;
|
|
72
|
+
/**
|
|
73
|
+
* Where the agent's Telegram channel `name` delivers a message the ontology sends: a draft a member
|
|
74
|
+
* approved, a reply its review let go, a member's or a service's post. The ontology decides and
|
|
75
|
+
* renders it, its exact text with its attribution, links and previews; the channel sends it
|
|
76
|
+
* through its bot, its parts in order in one operation. Only the deployment's own functions may
|
|
77
|
+
* call it.
|
|
78
|
+
*/
|
|
79
|
+
export declare function telegramDeliverRoute(name: string): string;
|
|
80
|
+
/** One text as `sendMessage` takes it: the text, its format, and its link preview. */
|
|
81
|
+
export interface TelegramDeliverText {
|
|
82
|
+
readonly text: string;
|
|
83
|
+
readonly parse_mode?: "MarkdownV2";
|
|
84
|
+
readonly link_preview_options?: Readonly<Record<string, unknown>>;
|
|
85
|
+
readonly disable_web_page_preview?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* One text message of a delivery: as Telegram formats it, and the same text without formatting,
|
|
89
|
+
* which is sent once in its place only when Telegram refuses the formatting.
|
|
90
|
+
*/
|
|
91
|
+
export interface TelegramDeliverPart {
|
|
92
|
+
readonly formatted: TelegramDeliverText;
|
|
93
|
+
readonly plain: TelegramDeliverText;
|
|
94
|
+
}
|
|
95
|
+
/** The most text messages one delivery carries. */
|
|
96
|
+
export declare const TELEGRAM_DELIVER_PARTS = 20;
|
|
97
|
+
/** One message for the agent's Telegram channel to send (`POST` {@link telegramDeliverRoute}). */
|
|
98
|
+
export interface TelegramDeliver {
|
|
99
|
+
/** The ontology's delivery, which the agent's diagnostics name. */
|
|
100
|
+
readonly operation_id: string;
|
|
101
|
+
/**
|
|
102
|
+
* The connection the ontology's `chat` names for the channel: the channel sends only through
|
|
103
|
+
* the same bot, and answers `channel_unknown` otherwise.
|
|
104
|
+
*/
|
|
105
|
+
readonly connection: string;
|
|
106
|
+
/** The chat, by its Bot API id. */
|
|
107
|
+
readonly chat_id: string;
|
|
108
|
+
/** The forum topic to send in (`message_thread_id`); null outside one. */
|
|
109
|
+
readonly thread_id: string | null;
|
|
110
|
+
/** The message each text message answers, which Telegram must quote; null for none. */
|
|
111
|
+
readonly reply_to: string | null;
|
|
112
|
+
/**
|
|
113
|
+
* The text messages, in order, each rendered from a text of at most
|
|
114
|
+
* {@link TELEGRAM_MESSAGE_LIMIT} characters; none for files alone. A single text that fits a
|
|
115
|
+
* caption goes as the caption of files sent as one message.
|
|
116
|
+
*/
|
|
117
|
+
readonly parts: ReadonlyArray<TelegramDeliverPart>;
|
|
118
|
+
/** The buttons under the last text message: Telegram's inline keyboard. */
|
|
119
|
+
readonly reply_markup?: Readonly<Record<string, unknown>>;
|
|
120
|
+
/** The files after the text, in order, each by its link. */
|
|
121
|
+
readonly files?: ReadonlyArray<ChannelDeliverFile>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The agent's answer once it sent something: `sent` when Telegram's answers prove every message,
|
|
125
|
+
* `uncertain` when some may not have reached the person, with what became of each file. A `4xx`
|
|
126
|
+
* with {@link TelegramDeliverRefused} sent nothing (`404` alone: an agent without the route);
|
|
127
|
+
* anything else may have sent it.
|
|
128
|
+
*/
|
|
129
|
+
export interface TelegramDelivered {
|
|
130
|
+
readonly status: "sent" | "uncertain";
|
|
131
|
+
/** The first message that reached the person. */
|
|
132
|
+
readonly message_id: string | null;
|
|
133
|
+
/** That message's link, for a group Telegram links to; null otherwise and with files. */
|
|
134
|
+
readonly url: string | null;
|
|
135
|
+
readonly files?: ReadonlyArray<ChannelDeliveredFile>;
|
|
136
|
+
/** The agent's diagnostic of what did not go, when something did not. */
|
|
137
|
+
readonly reference?: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Why the agent sent nothing (`4xx`): `channel_unknown` when it has no Telegram channel of the
|
|
141
|
+
* name on the connection, so the ontology sends the message itself; `provider_refused` when
|
|
142
|
+
* Telegram refused it; `thread_unavailable` when Telegram no longer has the topic;
|
|
143
|
+
* `connection_refused` when SegmentStream's connection refused the call; or the request's own
|
|
144
|
+
* fault, such as `invalid_request` or `file_unavailable`.
|
|
145
|
+
*/
|
|
146
|
+
export interface TelegramDeliverRefused {
|
|
147
|
+
readonly error: string;
|
|
148
|
+
/** Telegram's refusal for code to act on: a person who blocked the bot or never started it. */
|
|
149
|
+
readonly refusal?: "recipient_unreachable";
|
|
150
|
+
readonly reference?: string;
|
|
151
|
+
}
|
|
152
|
+
export type { ChannelCall, ChannelCallFile, ChannelDeliverFile, ChannelDeliveredFile, ChannelFile, ChannelFileRead, ChannelPart, ChannelReply, ChannelRequest, ChannelStoredFile, DefiniteFailure, } from "./channel-files.js";
|
|
70
153
|
export { CHANNEL_FILE_FRAME_BYTES, ChannelAnswerError } from "./channel-files.js";
|
|
71
154
|
export { sendTelegramFiles, telegramFileBytes, telegramFileRefusal, telegramFileType, telegramFormattingRefused, withCrlfLineBreaks, TELEGRAM_CAPTION_LIMIT, TELEGRAM_DOCUMENT_BYTES, TELEGRAM_FILES_PER_MESSAGE, TELEGRAM_INLINE_FILE_BYTES, TELEGRAM_PHOTO_BYTES, type TelegramEntity, type TelegramFilesTarget, type TelegramFormattedText, } from "./telegram-files.js";
|
package/dist/telegram.js
CHANGED
|
@@ -314,5 +314,19 @@ export function miniAppLink(url, origins, botUsername) {
|
|
|
314
314
|
export function isTelegramBotUsername(username) {
|
|
315
315
|
return /^[A-Za-z0-9_]{1,64}$/u.test(username);
|
|
316
316
|
}
|
|
317
|
+
/** The most characters Telegram takes in one message's text. */
|
|
318
|
+
export const TELEGRAM_MESSAGE_LIMIT = 4096;
|
|
319
|
+
/**
|
|
320
|
+
* Where the agent's Telegram channel `name` delivers a message the ontology sends: a draft a member
|
|
321
|
+
* approved, a reply its review let go, a member's or a service's post. The ontology decides and
|
|
322
|
+
* renders it, its exact text with its attribution, links and previews; the channel sends it
|
|
323
|
+
* through its bot, its parts in order in one operation. Only the deployment's own functions may
|
|
324
|
+
* call it.
|
|
325
|
+
*/
|
|
326
|
+
export function telegramDeliverRoute(name) {
|
|
327
|
+
return `/eve/segmentstream/v1/telegram/${name}/deliver`;
|
|
328
|
+
}
|
|
329
|
+
/** The most text messages one delivery carries. */
|
|
330
|
+
export const TELEGRAM_DELIVER_PARTS = 20;
|
|
317
331
|
export { CHANNEL_FILE_FRAME_BYTES, ChannelAnswerError } from "./channel-files.js";
|
|
318
332
|
export { sendTelegramFiles, telegramFileBytes, telegramFileRefusal, telegramFileType, telegramFormattingRefused, withCrlfLineBreaks, TELEGRAM_CAPTION_LIMIT, TELEGRAM_DOCUMENT_BYTES, TELEGRAM_FILES_PER_MESSAGE, TELEGRAM_INLINE_FILE_BYTES, TELEGRAM_PHOTO_BYTES, } from "./telegram-files.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.184.0",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|