cortico-world-telegram 0.44.0 → 0.45.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 +42 -0
- package/README.md +18 -14
- package/SECURITY.md +4 -4
- package/describe.json +48 -20
- package/dist/webui.js +2 -2
- package/dist/webui.meta.json +3 -3
- package/package.json +2 -2
- package/src/config.ts +1 -1
- package/src/definition.ts +17 -13
- package/src/mtproto/client.ts +407 -98
- package/src/mtproto/credentials.ts +11 -2
- package/src/mtproto/port.ts +37 -5
- package/src/mtproto/session-store.ts +52 -3
- package/src/mtproto/text.ts +187 -0
- package/src/prompt/ENV_PROMPT.md +12 -2
- package/src/resources.ts +31 -12
- package/src/settings.ts +2 -2
- package/src/tools.ts +63 -22
- package/src/webui/client.ts +41 -29
- package/src/world.ts +196 -83
package/src/definition.ts
CHANGED
|
@@ -38,7 +38,11 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
38
38
|
|
|
39
39
|
/** 激活前就把凭据问题挡住,别等 start() 才炸。 */
|
|
40
40
|
preflight: (ctx) => {
|
|
41
|
-
const resolved = resolveCredentials({
|
|
41
|
+
const resolved = resolveCredentials({
|
|
42
|
+
apiId: ctx.cfg.apiId,
|
|
43
|
+
apiHash: ctx.cfg.apiHash,
|
|
44
|
+
env: (name) => ctx.secret(name) || process.env[name],
|
|
45
|
+
});
|
|
42
46
|
if (!resolved.ok) {
|
|
43
47
|
throw new Error(`${resolved.error}${resolved.detail ? `:${resolved.detail}` : ''}`);
|
|
44
48
|
}
|
|
@@ -113,8 +117,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
113
117
|
en: 'Lists members with paging, admins-only and name search.',
|
|
114
118
|
},
|
|
115
119
|
telegram_send_message: {
|
|
116
|
-
zh: '
|
|
117
|
-
en: 'Sends a text message as this account,
|
|
120
|
+
zh: '以本账号发文字(支持引用、话题、原生 @提及 与超 4096 字自动分段)。',
|
|
121
|
+
en: 'Sends a text message as this account (supports replies, topics, native @mentions and auto-chunking >4096 chars).',
|
|
118
122
|
},
|
|
119
123
|
telegram_read_messages: {
|
|
120
124
|
zh: '读某个会话最近的消息(发信人、时间、正文、媒体类型)。',
|
|
@@ -161,8 +165,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
161
165
|
en: "Searches GIFs through the @gif inline bot (Chinese works).",
|
|
162
166
|
},
|
|
163
167
|
telegram_send_gif: {
|
|
164
|
-
zh: '发送搜到的某个 GIF
|
|
165
|
-
en: 'Sends one GIF by index.',
|
|
168
|
+
zh: '发送搜到的某个 GIF(按序号,支持引用与话题)。',
|
|
169
|
+
en: 'Sends one GIF by index, optionally quoting a message or targeting a topic.',
|
|
166
170
|
},
|
|
167
171
|
telegram_tag_local_stickers: {
|
|
168
172
|
zh: '给本地表情打语义标签(看图 → 写关键词和适用场景),之后能按意思挑。',
|
|
@@ -173,8 +177,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
173
177
|
en: 'Lists sticker sources: the local folder plus installed Telegram packs.',
|
|
174
178
|
},
|
|
175
179
|
telegram_send_sticker: {
|
|
176
|
-
zh: '发一个表情:来自 Telegram 包(序号/emoji
|
|
177
|
-
en: 'Sends one sticker from a pack or
|
|
180
|
+
zh: '发一个表情:来自 Telegram 包(序号/emoji)或本地目录,支持引用与话题。',
|
|
181
|
+
en: 'Sends one sticker from a pack or local file, with optional reply/topic.',
|
|
178
182
|
},
|
|
179
183
|
telegram_fave_sticker: {
|
|
180
184
|
zh: '收藏 / 取消收藏单个贴纸。',
|
|
@@ -193,8 +197,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
193
197
|
en: 'Lists installed sticker packs.',
|
|
194
198
|
},
|
|
195
199
|
telegram_download_media: {
|
|
196
|
-
zh: '
|
|
197
|
-
en: "Downloads one message's media; images
|
|
200
|
+
zh: '把某条消息里的图片/视频/语音/文件下载到本地;图片和(支持音频模型时的)语音会直接附带。',
|
|
201
|
+
en: "Downloads one message's media; images (and audio when the active model accepts audio) are attached directly.",
|
|
198
202
|
},
|
|
199
203
|
telegram_find_local_media: {
|
|
200
204
|
zh: '在配置的资源目录里找最近生成的语音/图片/视频/文件。',
|
|
@@ -229,12 +233,12 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
|
|
|
229
233
|
en: 'Cleans the downloaded-media cache (by age, or everything).',
|
|
230
234
|
},
|
|
231
235
|
telegram_send_album: {
|
|
232
|
-
zh: '一次发 2–10
|
|
233
|
-
en: 'Sends 2–10 photos as one album.',
|
|
236
|
+
zh: '一次发 2–10 张图/视频(相册,支持引用与话题)。',
|
|
237
|
+
en: 'Sends 2–10 photos/videos as one album, with optional reply/topic.',
|
|
234
238
|
},
|
|
235
239
|
telegram_send_media: {
|
|
236
|
-
zh: '
|
|
237
|
-
en: 'Sends a local file
|
|
240
|
+
zh: '发本地文件(语音条/歌/图/视频/文件统一走它;as_voice 自动转 ogg/opus,支持引用与话题)。',
|
|
241
|
+
en: 'Sends a local file (voice note, song, photo, video or document; as_voice auto-converts via ffmpeg; supports reply/topic).',
|
|
238
242
|
},
|
|
239
243
|
}),
|
|
240
244
|
events: [
|