cortico-world-telegram 0.44.1 → 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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.45.0 — 模型自适应直听语音 + 群聊与发送体验全面升级
4
+
5
+ ### 模型自适应能力(零新增硬开关)
6
+ - **原生语音/音频自适应直听**:入站语音条(`voice`)与音频(`audio`)实时探测当前活跃模型的 `host.modelFacts.accepts(mime)` 能力,不新增硬性开关:
7
+ - 当前模型支持音频输入(如 Gemini)且未超出 `maxMediaBytes` 时,自动通过 `MtprotoClient.fetchAudio()` 附带音频字节给模型直接听懂;
8
+ - 切换到不支持音频的模型(如 DeepSeek / GLM)时自动跳过下载(零浪费流量),且 `{{telegram.media}}` 立即失效缓存并如实告知模型当前无法听清语音;
9
+ - `telegram_download_media` 同样兼容 `audio/opus` → `audio/ogg` 归一化,音频模型手动下载也能直接附带。
10
+ - **动态输入状态(复用现有 `typingIndicator` 隐私开关)**:`sendTyping(chat, action, topicId)` 按实际发送动作自动上报对应状态——文字用「正在输入」、语音条用「正在录音」、图片/相册用「正在发送图片」、视频/GIF 用「正在发送视频」、文件用「正在发送文件」、贴纸用「正在挑选贴纸」,并支持论坛话题 `topMsgId`。
11
+ - **原生可点击 `@提及` 与超长消息自动分段**:新增 [src/mtproto/text.ts](src/mtproto/text.ts),`telegram_send_message` 自动将 `[显示名](tg://user?id=数字ID)` 解析为 MTProto 原生 `Api.InputMessageEntityMentionName`(解析不到实体时平滑降级为纯显示名),并按 Telegram 4096 字符上限自动分段(优先段落/句末断句、不劈开 emoji 代理对、不切断提及区间、后续分段保留 `topic` 归属)。
12
+
13
+ ### 核心 Bug 修复与体验优化
14
+ - **消除语音/文件发送工具幻觉**:修正 `telegram_send_media` 参数描述中误导性的 `requires .ogg/.opus`(明确说明 `.wav/.mp3` 等会自动由 ffmpeg 转码,并明示不存在 `telegram_send_voice` / `telegram_send_file`);修正 `{{telegram.media}}` 仅检查配置字符串而忽略系统 `PATH` 上 `ffmpeg` 的问题(改为调用真实 `ffmpegAvailable()` 探测);在 `src/prompt/ENV_PROMPT.md` 顶部补充发送速查表并改写语音规则随 `{{telegram.media}}` 实时联动。
15
+ - **修复白名单群未命中触发条件的消息被静默丢弃**:`gate()` 拆分 `archiveOnly` 标志,白名单群里未 `@` / 未回复机器人的消息改为以 `{ deliver: false }` 静默归档入库(不下载媒体、不唤醒模型、不花 token),保留连贯群聊上下文;同步让 `handleEdit()` 遵循 `groupTrigger`,避免群里无关消息编辑频繁唤醒模型。
16
+ - **补全发送者昵称与表情反应人名**:在 `MtprotoClient` 新增有界 `userNameCache`(从 `me` / `dialogs` / `contacts` / `participants` / `userInfo` / `history` / `search` / `NewMessage` 实体与异步预热填充),群消息、引用正文与表情反应不再退回裸数字 ID。
17
+ - **持久化自身消息 ID(重启不失忆)**:`StateStore`(`state.json`)向后兼容新增每会话 `ownIds` 列表(默认保留最近 100 条,`bump()` 保留不覆盖);重启后别人回复机器人旧消息或给旧消息点表情仍能准确唤醒。对超出窗口的更早消息,群内 `mention_or_reply` 触发还会自动回查被引用消息的 `out === true` 兜底。
18
+ - **补齐私聊/基础群撤回监听**:MTProto 的 `UpdateDeleteMessages` 在私聊与基础群中不含 `peer`,新增有界 `msgChatMap` 反查所属会话,撤回通知不再漏报。
19
+ - **媒体 / 相册 / 贴纸 / GIF 全系支持引用与论坛话题**:保持 47 个工具名完全向后兼容,为 `telegram_send_media`、`telegram_send_album`、`telegram_send_gif` 补齐可选 `reply_to` 与 `topic` 参数,为 `telegram_send_sticker` 补齐可选 `topic` 参数。
20
+ - **修复多处细节问题**:
21
+ - `resolveChat()` 与 `runCatchUp()` 对 `-100…` 超级群 ID 优先查询 `client.knownChatKind(id)`,不再一律硬判为 `channel`。
22
+ - 修复 `sendMedia()` / `sendLocalSticker()` 审批同步放行路径返回假 `messageId: 0` 的问题。
23
+ - 修复 `mediaBlobs()` 中 `autoImages=false` 误连带关闭缩略图与语音附件的问题。
24
+ - 修复 `src/config.ts` 注释中的控制字符错字。
25
+
26
+ ### 测试与文档
27
+ - 新增 [tests/unit/text.test.ts](tests/unit/text.test.ts)(25 项单测覆盖 `@提及` UTF-16 偏移、emoji 代理对与跨段重算),扩充 `tests/unit/state-store.test.ts` 与 `tests/lifecycle.ts` 覆盖跨重启 `ownIds`、模型自适应听语音、群静默归档、动态输入状态与超级群判定(43 组单测 + 契约 + 市场自检 + 生命周期全通过)。
28
+ - 同步更新 `README.md`、`SECURITY.md`、`src/prompt/ENV_PROMPT.md` 及 `docs/` 全部开发文档。
29
+
3
30
  ## 0.44.1 — 凭据保存与重启修复 + 路径归属校验加固
4
31
 
5
32
  ### 凭据与重启修复
package/README.md CHANGED
@@ -38,7 +38,7 @@ Coopanion Core:人格 / 记忆 / 模型(原样复用,不改一行)
38
38
 
39
39
  | 工具 | 说明 |
40
40
  |---|---|
41
- | `telegram_send_message` | 发文字,可引用、可发到话题 |
41
+ | `telegram_send_message` | 发文字,支持 `reply_to` / `topic`、>4096 字自动分段、`[名字](tg://user?id=ID)` 原生 `@提及` |
42
42
  | `telegram_read_messages` | 读最近消息,可按话题 |
43
43
  | `telegram_search_messages` | 会话内按关键词搜 |
44
44
  | `telegram_get_message` | 按 id 取单条 |
@@ -51,9 +51,9 @@ Coopanion Core:人格 / 记忆 / 模型(原样复用,不改一行)
51
51
 
52
52
  | 工具 | 说明 |
53
53
  |---|---|
54
- | `telegram_download_media` | 下载图片 / 视频 / 语音 / 文件;图片附给模型 |
55
- | `telegram_send_media` | 发本地文件;`as_voice` 用 ffmpeg 转语音条(ogg/opus) |
56
- | `telegram_send_album` | 2–10 张图一次发(相册) |
54
+ | `telegram_download_media` | 下载图片 / 视频 / 语音 / 文件;图片及(模型支持时的)音频直接附给模型 |
55
+ | `telegram_send_media` | 发本地文件(语音条 / 歌 / 图 / 视频 / 文件统一用它);`as_voice` 自动用 ffmpeg 转 ogg/opus,支持 `reply_to` / `topic` |
56
+ | `telegram_send_album` | 2–10 张图一次发(相册),支持 `reply_to` / `topic` |
57
57
  | `telegram_find_local_media` | 在配置的资源目录里找最近生成的文件 |
58
58
  | `telegram_register_local_media` | 登记别的 World 产出(必须落在授权目录内) |
59
59
  | `telegram_cleanup_media` | 清下载缓存(按小时 / 全清) |
@@ -63,12 +63,12 @@ Coopanion Core:人格 / 记忆 / 模型(原样复用,不改一行)
63
63
  | 工具 | 说明 |
64
64
  |---|---|
65
65
  | `telegram_search_stickers` / `telegram_get_sticker_set` | 搜包(文字或单个 emoji)/ 看包内清单 |
66
- | `telegram_send_sticker` | 发表情:来自 Telegram 包(序号或 emoji)**或**本地文件 |
66
+ | `telegram_send_sticker` | 发表情:来自 Telegram 包(序号或 emoji)**或**本地文件,支持 `reply_to` / `topic` |
67
67
  | `telegram_list_stickers` | 列出两个来源:本地目录 / 已装包 |
68
68
  | `telegram_tag_local_stickers` | 给本地表情打语义标签(看图 → 写关键词和适用场景) |
69
69
  | `telegram_install_sticker_set` / `telegram_get_installed_stickers` | 装卸包 / 已装列表 |
70
70
  | `telegram_fave_sticker` / `telegram_get_favorite_stickers` | 收藏 / 收藏列表 |
71
- | `telegram_search_gifs` / `telegram_send_gif` | 走 @gif 内联机器人,**中文能搜** |
71
+ | `telegram_search_gifs` / `telegram_send_gif` | 走 @gif 内联机器人,**中文能搜**,支持 `reply_to` / `topic` |
72
72
 
73
73
  ### 日常整理
74
74
 
@@ -78,7 +78,11 @@ Coopanion Core:人格 / 记忆 / 模型(原样复用,不改一行)
78
78
  ### 自动做的事(不需要工具)
79
79
 
80
80
  - **自动跟随系统代理**:Clash / v2rayN 等打开「系统代理」即可登录与长期收发,**无需开启虚拟网卡 / TUN**;同时支持 `ALL_PROXY` / `HTTPS_PROXY` / `HTTP_PROXY` 环境变量,中途开关代理重连时自动感知
81
+ - **模型自适应直听语音/音频(无需硬开关)**:实时探测当前活跃模型是否支持音频输入——支持音频的模型(如 Gemini)收到未超限语音/音频会自动附带直听;不支持音频的模型自动跳过下载并实时更新 `{{telegram.media}}` 提示,中途切换模型立刻生效
81
82
  - **收到图片自动附给模型看**;视频 / 动态 GIF / 动态贴纸 / 文件附**缩略图**(不下载整段)
83
+ - **原生 `@提及` 与超长消息自动分段**:`[显示名](tg://user?id=ID)` 自动转为可点击的 Telegram 原生提及实体;超过 4096 字自动按段落/句末切分发送(不劈开 emoji、不丢话题归属)
84
+ - **群聊静默归档 + 人名补全 + 重启不失忆**:白名单群未触发唤醒的消息静默入库(`deliver: false`,保留上下文不花 token);自动缓存联系人/群成员昵称;自身消息 ID 持久化进 `state.json`,重启后回复旧消息或点表情依然能准确唤醒
85
+ - **动态输入状态**:开启「回复前显示正在输入」后,发送前自动按内容类型上报「正在输入 / 正在录音 / 正在发图 / 发视频 / 发文件 / 挑贴纸」
82
86
  - **消息合并窗口**:同一会话连发时按窗口合并成一条事件
83
87
  - **发送限流**:每会话 1 秒 / 全局 20 条每分钟(并发自动排队)
84
88
  - **FloodWait**:≤60 秒等一次重试,>60 秒如实报错
@@ -173,8 +177,8 @@ npm run describe # 生成 describe.json
173
177
 
174
178
  - **主人**:主人 Telegram ID(用于接收告警通知与敏感操作审批确认)
175
179
  - **监听范围**:你在手机版/电脑版上发的消息(忽略 / 只记录 / 照常处理)、群里什么时候理人(`@ 或回复` / `只认 @` / `只认白名单那个人` / `每条都理`)、断线补课
176
- - **媒体**:图片自动附给模型、视频/文件缩略图、附件体积上限(**MB**)
177
- - **隐私**:在线状态(保持沉默 / 显示在线)、自动标已读、发送「正在输入」、审计日志(`audit.jsonl`,默认关)
180
+ - **媒体**:图片自动附给模型、视频/文件缩略图、附件体积上限(**MB**,同时约束直看图片与模型自适应直听音频)
181
+ - **隐私**:在线状态(保持沉默 / 显示在线)、自动标已读、发送动态输入状态(正在输入 / 录音 / 发图等)、审计日志(`audit.jsonl`,默认关)
178
182
  - **合并窗口**、**会话页默认历史条数**
179
183
  - **4 个确认策略**:删除消息、增删联系人、拉黑、白名单私聊发文件
180
184
  —— 每个可选 `允许(不询问)` / `先问我`(主人私聊自然语言回复「可以 / 不行 / 随便你」或 `!ok`)/ `不允许`
@@ -188,7 +192,7 @@ npm run describe # 生成 describe.json
188
192
  ```
189
193
  <Coopanion>/data/home/companion/data/telegram/
190
194
  ├─ session.txt StringSession(0600,等于账号控制权,别外传)
191
- ├─ state.json 每个会话的 lastSeenId
195
+ ├─ state.json 每个会话的 lastSeenId 与最近自身消息 id(补课与跨重启识别用)
192
196
  ├─ instance.lock 双开保护
193
197
  ├─ resources.json 本地资源登记索引
194
198
  ├─ sticker-tags.json 本地表情的语义标签
package/SECURITY.md CHANGED
@@ -70,8 +70,8 @@
70
70
  [TG 私聊 123456789] 某人: 正文 [photo 1280×720] (回复 #327 「被引用的话」) [反应 👍3] (转发自 某频道) (已编辑)
71
71
  ```
72
72
 
73
- - 图片会作为附件直接给模型(可关:`autoImages`);视频/文件只给缩略图。
74
- - **语音不转写**:模型只能看到 `[voice 0:07]`,听不到内容(ASR 不包含在本扩展内)。
73
+ - 图片会作为附件直接给模型(可关:`autoImages`);视频/文件只给缩略图(可关:`autoThumbnails`)。
74
+ - **语音/音频模型自适应直听(无内置 ASR)**:扩展会实时检查当前活跃模型是否原生支持音频输入(`modelFacts.accepts(mime)`)。若当前模型支持音频(如 Gemini)且文件未超过 `maxMediaBytes`,会自动把语音/音频字节附给模型直接听懂;若当前模型不支持音频,则直接跳过下载,模型只看到 `[voice 0:07]`,不做第三方语音转写。
75
75
  - 这些内容会发到你配置的模型端点。市场标签里的 `sensitive-data` 指的就是这件事。
76
76
 
77
77
  ---
@@ -95,7 +95,7 @@
95
95
  | 路径 | 内容 | 敏感性 |
96
96
  |---|---|---|
97
97
  | `data/telegram/session.txt` | 登录态 | **最高**(等于账号) |
98
- | `data/telegram/state.json` | 每个会话处理到第几条(补课用书签) | 低 |
98
+ | `data/telegram/state.json` | 每个会话处理到第几条的补课书签,以及最近本账号发出的消息 id 列表(重启后识别回复与反应) | 低 |
99
99
  | `data/telegram/instance.lock` | 双开锁(pid + 心跳) | 无 |
100
100
  | `data/telegram/media/` | 下载的媒体缓存(按 `mediaKeepHours` 自动清) | **中高**(聊天里的图片/文件) |
101
101
  | `data/telegram/resources.json` | 本地资源索引 | 中(暴露文件路径) |
@@ -108,7 +108,7 @@
108
108
  ## 8. 已知限制(明确做不到的)
109
109
 
110
110
  - **不加密本地数据**:`session.txt` 是明文(方便恢复),靠文件权限保护。
111
- - **语音不转写**:没有 ASR。
111
+ - **不内置语音转写(ASR)**:支持原生音频输入的模型(如 Gemini)会自动收到未超限的语音条并直接听懂;不支持音频输入的模型仍无法听清语音内容。
112
112
  - **不能删别人的消息**(管理员场景):现在只能删自己的,或靠 Telegram 报错。
113
113
  - **拿不到被限制的东西**:群成员列表、论坛话题、GIF 搜索等在权限不足时会如实失败,不会伪造。
114
114
  - **群/频道里发不了文件与个人资料**:只放行文字、语音、表情包、GIF 与翻唱,这是刻意的分级,不是 bug。
package/describe.json CHANGED
@@ -417,17 +417,17 @@
417
417
  },
418
418
  {
419
419
  "name": "telegram_send_message",
420
- "description": "Send a text message as this Telegram account. `to` is a numeric chat id (negative for groups and channels). Use `reply_to` to quote a specific message in the same chat.",
420
+ "description": "Send a text message as this Telegram account. `to` accepts a numeric chat id (negative for groups/channels), @username, or name. Long messages (>4096 chars) are split automatically. Use `[DisplayName](tg://user?id=123456)` to produce a native clickable Telegram @mention.",
421
421
  "parameters": {
422
422
  "type": "object",
423
423
  "properties": {
424
424
  "to": {
425
425
  "type": "string",
426
- "description": "Numeric chat id, e.g. 123456789 or -1001234567890."
426
+ "description": "Chat id (e.g. 123456789 or -1001234567890), @username, or name."
427
427
  },
428
428
  "text": {
429
429
  "type": "string",
430
- "description": "Message body. Plain text unless it looks like markup."
430
+ "description": "Plain text body (other Markdown is NOT parsed, except `[name](tg://user?id=123456)` for native @mentions)."
431
431
  },
432
432
  "reply_to": {
433
433
  "type": "integer",
@@ -448,8 +448,8 @@
448
448
  "speak"
449
449
  ],
450
450
  "summary": {
451
- "zh": "以本账号向指定会话发一条文字消息(可引用回复)。",
452
- "en": "Sends a text message as this account, optionally quoting a message."
451
+ "zh": "以本账号发文字(支持引用、话题、原生 @提及 与超 4096 字自动分段)。",
452
+ "en": "Sends a text message as this account (supports replies, topics, native @mentions and auto-chunking >4096 chars)."
453
453
  }
454
454
  },
455
455
  {
@@ -720,13 +720,13 @@
720
720
  },
721
721
  {
722
722
  "name": "telegram_download_media",
723
- "description": "Download the media attached to one Telegram message (photo, video, audio, voice, document) to local disk. Images are also attached to the result so you can look at them directly.",
723
+ "description": "Download the media attached to one Telegram message (photo, video, audio, voice, document) to local disk. Images (and audio/voice notes when the active model accepts audio) are attached to the result directly.",
724
724
  "parameters": {
725
725
  "type": "object",
726
726
  "properties": {
727
727
  "chat": {
728
728
  "type": "string",
729
- "description": "Numeric chat id the message belongs to."
729
+ "description": "Chat id, @username, or name the message belongs to."
730
730
  },
731
731
  "message_id": {
732
732
  "type": "integer",
@@ -743,19 +743,19 @@
743
743
  "read"
744
744
  ],
745
745
  "summary": {
746
- "zh": "把某条消息里的图片/视频/语音/文件下载到本地;图片会顺便附给你看。",
747
- "en": "Downloads one message's media; images are attached so the model can see them."
746
+ "zh": "把某条消息里的图片/视频/语音/文件下载到本地;图片和(支持音频模型时的)语音会直接附带。",
747
+ "en": "Downloads one message's media; images (and audio when the active model accepts audio) are attached directly."
748
748
  }
749
749
  },
750
750
  {
751
751
  "name": "telegram_send_media",
752
- "description": "Send a local file as this Telegram account: photo, video, audio or document. Set as_voice=true for an audio file to be sent as a voice message (requires .ogg/.opus).",
752
+ "description": "Send a local file as this Telegram account: voice message, song/audio, photo, video, or document. Use THIS tool for voice notes and files (there is no telegram_send_voice or telegram_send_file tool). Set as_voice=true to send as a Telegram voice note — .wav/.mp3/etc. are automatically converted to .ogg/.opus via ffmpeg.",
753
753
  "parameters": {
754
754
  "type": "object",
755
755
  "properties": {
756
756
  "to": {
757
757
  "type": "string",
758
- "description": "Numeric chat id."
758
+ "description": "Chat id, @username, or name."
759
759
  },
760
760
  "file_path": {
761
761
  "type": "string",
@@ -767,7 +767,15 @@
767
767
  },
768
768
  "as_voice": {
769
769
  "type": "boolean",
770
- "description": "Send as a voice message (ogg/opus only)."
770
+ "description": "Send as a Telegram voice note (auto-converts .wav/.mp3/etc. to ogg/opus via ffmpeg)."
771
+ },
772
+ "reply_to": {
773
+ "type": "integer",
774
+ "description": "Quote this message id in the same chat."
775
+ },
776
+ "topic": {
777
+ "type": "integer",
778
+ "description": "Forum topic id (top message id of the topic)."
771
779
  }
772
780
  },
773
781
  "required": [
@@ -780,8 +788,8 @@
780
788
  "speak"
781
789
  ],
782
790
  "summary": {
783
- "zh": "把本地文件以本账号发出去(图片/视频/音频/文件,可当语音条)。",
784
- "en": "Sends a local file as this account, optionally as a voice message."
791
+ "zh": "发本地文件(语音条/歌/图/视频/文件统一走它;as_voice 自动转 ogg/opus,支持引用与话题)。",
792
+ "en": "Sends a local file (voice note, song, photo, video or document; as_voice auto-converts via ffmpeg; supports reply/topic)."
785
793
  }
786
794
  },
787
795
  {
@@ -801,6 +809,14 @@
801
809
  "caption": {
802
810
  "type": "string",
803
811
  "description": "Caption for the album."
812
+ },
813
+ "reply_to": {
814
+ "type": "integer",
815
+ "description": "Quote this message id."
816
+ },
817
+ "topic": {
818
+ "type": "integer",
819
+ "description": "Forum topic id (top message id of the topic)."
804
820
  }
805
821
  },
806
822
  "required": [
@@ -813,8 +829,8 @@
813
829
  "speak"
814
830
  ],
815
831
  "summary": {
816
- "zh": "一次发 2–10 张图(相册)。",
817
- "en": "Sends 2–10 photos as one album."
832
+ "zh": "一次发 2–10 张图/视频(相册,支持引用与话题)。",
833
+ "en": "Sends 2–10 photos/videos as one album, with optional reply/topic."
818
834
  }
819
835
  },
820
836
  {
@@ -1069,6 +1085,10 @@
1069
1085
  "reply_to": {
1070
1086
  "type": "integer",
1071
1087
  "description": "Quote this message id."
1088
+ },
1089
+ "topic": {
1090
+ "type": "integer",
1091
+ "description": "Forum topic id (top message id of the topic)."
1072
1092
  }
1073
1093
  },
1074
1094
  "required": [
@@ -1080,8 +1100,8 @@
1080
1100
  "speak"
1081
1101
  ],
1082
1102
  "summary": {
1083
- "zh": "发一个表情:来自 Telegram 包(序号/emoji)或本地表情包目录的文件。",
1084
- "en": "Sends one sticker from a pack or from a local file."
1103
+ "zh": "发一个表情:来自 Telegram 包(序号/emoji)或本地目录,支持引用与话题。",
1104
+ "en": "Sends one sticker from a pack or local file, with optional reply/topic."
1085
1105
  }
1086
1106
  },
1087
1107
  {
@@ -1200,6 +1220,14 @@
1200
1220
  "type": "integer",
1201
1221
  "minimum": 0,
1202
1222
  "description": "Result index (0-based, default 0)."
1223
+ },
1224
+ "reply_to": {
1225
+ "type": "integer",
1226
+ "description": "Quote this message id."
1227
+ },
1228
+ "topic": {
1229
+ "type": "integer",
1230
+ "description": "Forum topic id (top message id of the topic)."
1203
1231
  }
1204
1232
  },
1205
1233
  "required": [
@@ -1212,8 +1240,8 @@
1212
1240
  "speak"
1213
1241
  ],
1214
1242
  "summary": {
1215
- "zh": "发送搜到的某个 GIF(按序号)。",
1216
- "en": "Sends one GIF by index."
1243
+ "zh": "发送搜到的某个 GIF(按序号,支持引用与话题)。",
1244
+ "en": "Sends one GIF by index, optionally quoting a message or targeting a topic."
1217
1245
  }
1218
1246
  },
1219
1247
  {
@@ -1,6 +1,6 @@
1
1
  {
2
- "sourceHash": "a64ed5707487ce525c38fc286c89c677",
3
- "builtAt": "2026-11-26T18:12:22.728Z",
2
+ "sourceHash": "a7098abc7045310e2a5b05a3f7002ce4",
3
+ "builtAt": "2026-12-05T11:50:02.689Z",
4
4
  "inputs": 3,
5
5
  "out": "dist/webui.js",
6
6
  "outSize": 28696
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-telegram",
3
- "version": "0.44.1",
3
+ "version": "0.45.0",
4
4
  "type": "module",
5
5
  "description": "Coopanion(Cortico)World:用真实的 Telegram 个人账号收发消息、媒体与表情,和桌面版/手机同时在线。A real Telegram personal account over MTProto, side by side with Desktop and mobile.",
6
6
  "license": "MIT",
@@ -67,7 +67,7 @@
67
67
  "probe": "tsx scripts/probe.mts",
68
68
  "describe": "tsx scripts/describe.mts",
69
69
  "test": "npm run test:unit && npm run test:contract && npm run test:lifecycle",
70
- "test:unit": "tsx tests/unit/auth.test.ts && tsx tests/unit/credentials.test.ts && tsx tests/unit/own-message.test.ts && tsx tests/unit/entity.test.ts && tsx tests/unit/media.test.ts && tsx tests/unit/voice.test.ts && tsx tests/unit/source.test.ts && tsx tests/unit/resolve.test.ts && tsx tests/unit/approval.test.ts && tsx tests/unit/config.test.ts && tsx tests/unit/resources.test.ts && tsx tests/unit/ratelimit.test.ts && tsx tests/unit/sticker.test.ts && tsx tests/unit/image.test.ts && tsx tests/unit/member.test.ts && tsx tests/unit/cache.test.ts && tsx tests/unit/retry.test.ts && tsx tests/unit/settings.test.ts && tsx tests/unit/redact.test.ts && tsx tests/unit/sticker-tags.test.ts && tsx tests/unit/merge.test.ts && tsx tests/unit/deps.test.ts && tsx tests/unit/send-path.test.ts && tsx tests/unit/owner-trust.test.ts && tsx tests/unit/errors.test.ts && tsx tests/unit/policy.test.ts && tsx tests/unit/state-store.test.ts && tsx tests/unit/trigger.test.ts && tsx tests/unit/freshness.test.ts && tsx tests/unit/acl.test.ts && tsx tests/unit/resources-guard.test.ts && tsx tests/unit/deps-manager.test.ts && tsx tests/unit/reactions.test.ts && tsx tests/unit/quote.test.ts && tsx tests/unit/render.test.ts && tsx tests/unit/instance-lock.test.ts && tsx tests/unit/settings-wired.test.ts && tsx tests/unit/audit.test.ts && tsx tests/unit/config-wired.test.ts && tsx tests/unit/lib-lazy.test.ts && tsx tests/unit/deps-args.test.ts && tsx tests/unit/proxy.test.ts",
70
+ "test:unit": "tsx tests/unit/auth.test.ts && tsx tests/unit/credentials.test.ts && tsx tests/unit/own-message.test.ts && tsx tests/unit/entity.test.ts && tsx tests/unit/media.test.ts && tsx tests/unit/voice.test.ts && tsx tests/unit/source.test.ts && tsx tests/unit/resolve.test.ts && tsx tests/unit/approval.test.ts && tsx tests/unit/config.test.ts && tsx tests/unit/resources.test.ts && tsx tests/unit/ratelimit.test.ts && tsx tests/unit/sticker.test.ts && tsx tests/unit/image.test.ts && tsx tests/unit/member.test.ts && tsx tests/unit/cache.test.ts && tsx tests/unit/retry.test.ts && tsx tests/unit/settings.test.ts && tsx tests/unit/redact.test.ts && tsx tests/unit/sticker-tags.test.ts && tsx tests/unit/merge.test.ts && tsx tests/unit/deps.test.ts && tsx tests/unit/send-path.test.ts && tsx tests/unit/owner-trust.test.ts && tsx tests/unit/errors.test.ts && tsx tests/unit/policy.test.ts && tsx tests/unit/state-store.test.ts && tsx tests/unit/trigger.test.ts && tsx tests/unit/freshness.test.ts && tsx tests/unit/acl.test.ts && tsx tests/unit/resources-guard.test.ts && tsx tests/unit/deps-manager.test.ts && tsx tests/unit/reactions.test.ts && tsx tests/unit/quote.test.ts && tsx tests/unit/render.test.ts && tsx tests/unit/instance-lock.test.ts && tsx tests/unit/settings-wired.test.ts && tsx tests/unit/audit.test.ts && tsx tests/unit/config-wired.test.ts && tsx tests/unit/lib-lazy.test.ts && tsx tests/unit/deps-args.test.ts && tsx tests/unit/proxy.test.ts && tsx tests/unit/text.test.ts",
71
71
  "test:contract": "tsx tests/contract.ts && tsx tests/market.ts",
72
72
  "test:lifecycle": "tsx tests/lifecycle.ts"
73
73
  },
package/src/config.ts CHANGED
@@ -79,7 +79,7 @@ export interface TelegramConfigSection {
79
79
  ownerUserId: number;
80
80
  /**
81
81
  * 白名单**私聊真人**要求发送「文件 / 图片 / 个人材料」时的策略。
82
- * uto 直接发、sk 先问主人、deny 一律拒绝。
82
+ * auto 直接发、ask 先问主人、deny 一律拒绝。
83
83
  * 群 / 频道 / TG bot 账号不受此项影响——那些会话只能交流、发表情、发语音与翻唱。
84
84
  */
85
85
  fileByWhitelisted: GuardPolicy;
package/src/definition.ts CHANGED
@@ -117,8 +117,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
117
117
  en: 'Lists members with paging, admins-only and name search.',
118
118
  },
119
119
  telegram_send_message: {
120
- zh: '以本账号向指定会话发一条文字消息(可引用回复)。',
121
- en: 'Sends a text message as this account, optionally quoting a message.',
120
+ zh: '以本账号发文字(支持引用、话题、原生 @提及 与超 4096 字自动分段)。',
121
+ en: 'Sends a text message as this account (supports replies, topics, native @mentions and auto-chunking >4096 chars).',
122
122
  },
123
123
  telegram_read_messages: {
124
124
  zh: '读某个会话最近的消息(发信人、时间、正文、媒体类型)。',
@@ -165,8 +165,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
165
165
  en: "Searches GIFs through the @gif inline bot (Chinese works).",
166
166
  },
167
167
  telegram_send_gif: {
168
- zh: '发送搜到的某个 GIF(按序号)。',
169
- en: 'Sends one GIF by index.',
168
+ zh: '发送搜到的某个 GIF(按序号,支持引用与话题)。',
169
+ en: 'Sends one GIF by index, optionally quoting a message or targeting a topic.',
170
170
  },
171
171
  telegram_tag_local_stickers: {
172
172
  zh: '给本地表情打语义标签(看图 → 写关键词和适用场景),之后能按意思挑。',
@@ -177,8 +177,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
177
177
  en: 'Lists sticker sources: the local folder plus installed Telegram packs.',
178
178
  },
179
179
  telegram_send_sticker: {
180
- zh: '发一个表情:来自 Telegram 包(序号/emoji)或本地表情包目录的文件。',
181
- en: 'Sends one sticker from a pack or from a local file.',
180
+ zh: '发一个表情:来自 Telegram 包(序号/emoji)或本地目录,支持引用与话题。',
181
+ en: 'Sends one sticker from a pack or local file, with optional reply/topic.',
182
182
  },
183
183
  telegram_fave_sticker: {
184
184
  zh: '收藏 / 取消收藏单个贴纸。',
@@ -197,8 +197,8 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
197
197
  en: 'Lists installed sticker packs.',
198
198
  },
199
199
  telegram_download_media: {
200
- zh: '把某条消息里的图片/视频/语音/文件下载到本地;图片会顺便附给你看。',
201
- en: "Downloads one message's media; images are attached so the model can see them.",
200
+ zh: '把某条消息里的图片/视频/语音/文件下载到本地;图片和(支持音频模型时的)语音会直接附带。',
201
+ en: "Downloads one message's media; images (and audio when the active model accepts audio) are attached directly.",
202
202
  },
203
203
  telegram_find_local_media: {
204
204
  zh: '在配置的资源目录里找最近生成的语音/图片/视频/文件。',
@@ -233,12 +233,12 @@ export const TELEGRAM: WorldDefinition<TelegramConfigSection> = {
233
233
  en: 'Cleans the downloaded-media cache (by age, or everything).',
234
234
  },
235
235
  telegram_send_album: {
236
- zh: '一次发 2–10 张图(相册)。',
237
- 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.',
238
238
  },
239
239
  telegram_send_media: {
240
- zh: '把本地文件以本账号发出去(图片/视频/音频/文件,可当语音条)。',
241
- en: 'Sends a local file as this account, optionally as a voice message.',
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).',
242
242
  },
243
243
  }),
244
244
  events: [