@zhin.js/adapter-telegram 1.1.14 → 1.1.16

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/agents/telegram/messages.js +52 -0
  3. package/agents/telegram/messages.ts +52 -0
  4. package/agents/telegram/skills/telegram-chat-admin/SKILL.md +16 -16
  5. package/agents/telegram/skills/telegram-chat-admin/tools/create_invite/index.js +3 -1
  6. package/agents/telegram/skills/telegram-chat-admin/tools/create_invite/index.ts +3 -1
  7. package/agents/telegram/skills/telegram-chat-admin/tools/list_admins/index.js +1 -0
  8. package/agents/telegram/skills/telegram-chat-admin/tools/list_admins/index.ts +1 -0
  9. package/agents/telegram/skills/telegram-chat-admin/tools/member_count/index.js +3 -1
  10. package/agents/telegram/skills/telegram-chat-admin/tools/member_count/index.ts +3 -1
  11. package/agents/telegram/skills/telegram-chat-admin/tools/pin_message/index.js +3 -1
  12. package/agents/telegram/skills/telegram-chat-admin/tools/pin_message/index.ts +3 -1
  13. package/agents/telegram/skills/telegram-chat-admin/tools/set_description/index.js +3 -1
  14. package/agents/telegram/skills/telegram-chat-admin/tools/set_description/index.ts +3 -1
  15. package/agents/telegram/skills/telegram-chat-admin/tools/unpin_message/index.js +3 -1
  16. package/agents/telegram/skills/telegram-chat-admin/tools/unpin_message/index.ts +3 -1
  17. package/agents/telegram/skills/telegram-group-permissions/SKILL.md +16 -0
  18. package/agents/telegram/skills/{telegram-chat-admin → telegram-group-permissions}/tools/set_permissions/index.js +3 -1
  19. package/agents/telegram/skills/{telegram-chat-admin → telegram-group-permissions}/tools/set_permissions/index.ts +3 -1
  20. package/agents/telegram/skills/telegram-messages/tools/react/index.js +2 -1
  21. package/agents/telegram/skills/telegram-messages/tools/react/index.ts +2 -1
  22. package/agents/telegram/skills/telegram-messages/tools/send_poll/index.js +4 -3
  23. package/agents/telegram/skills/telegram-messages/tools/send_poll/index.ts +4 -3
  24. package/agents/telegram/skills/telegram-messages/tools/send_sticker/index.js +2 -1
  25. package/agents/telegram/skills/telegram-messages/tools/send_sticker/index.ts +2 -1
  26. package/package.json +16 -16
  27. package/schema.json +35 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 53bc6a0: 适配器配置标签、端点命令和工具反馈支持中英文;复用当前操作语言,保持协议值、用户内容、身份、权限与发送链路不变。Sandbox 展示使用项目语言,QQ 绑定与交互状态保留完整会话身份。
8
+ - Updated dependencies [334e92d]
9
+ - Updated dependencies [f3b7c9f]
10
+ - Updated dependencies [658a5fb]
11
+ - Updated dependencies [144a17b]
12
+ - Updated dependencies [18296cf]
13
+ - Updated dependencies [08e64de]
14
+ - Updated dependencies [9cade30]
15
+ - Updated dependencies [53bc6a0]
16
+ - Updated dependencies [7595136]
17
+ - Updated dependencies [66b6404]
18
+ - Updated dependencies [adb4af2]
19
+ - Updated dependencies [69f9ef6]
20
+ - Updated dependencies [17d1301]
21
+ - @zhin.js/adapter@1.1.23
22
+ - @zhin.js/host-http@1.1.10
23
+ - @zhin.js/core@1.1.51
24
+ - @zhin.js/tool@1.1.10
25
+ - @zhin.js/skill@1.1.10
26
+ - @zhin.js/im-contract@1.1.7
27
+ - @zhin.js/agent-feature@1.1.10
28
+ - @zhin.js/feature-kit@1.1.9
29
+
30
+ ## 1.1.15
31
+
32
+ ### Patch Changes
33
+
34
+ - 7d68df6: 精简 Agent 内置固定提示词与消息说明,保留工具、审批和结构化回复能力。适配器 Skill 按会话场景拆分,群/频道管理仅向对应场景披露;提示段与模型消息段支持场景声明,沿用当前回合权限和 generation 投影。
35
+ - Updated dependencies [f98025b]
36
+ - Updated dependencies [66ec1a5]
37
+ - Updated dependencies [7d68df6]
38
+ - Updated dependencies [bf0fa9f]
39
+ - Updated dependencies [3326db3]
40
+ - Updated dependencies [e91235e]
41
+ - Updated dependencies [6da2bad]
42
+ - Updated dependencies [3781f1c]
43
+ - @zhin.js/core@1.1.50
44
+ - @zhin.js/adapter@1.1.22
45
+ - @zhin.js/im-contract@1.1.6
46
+ - @zhin.js/tool@1.1.9
47
+ - @zhin.js/host-http@1.1.9
48
+ - @zhin.js/agent-feature@1.1.9
49
+ - @zhin.js/feature-kit@1.1.8
50
+ - @zhin.js/skill@1.1.9
51
+
3
52
  ## 1.1.14
4
53
 
5
54
  ### Patch Changes
@@ -0,0 +1,52 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { createMessages } from 'zhin.js/i18n';
3
+ export const messages = createMessages({
4
+ "inviteLink": {
5
+ "zh-CN": "邀请链接: {p0}",
6
+ "en": "Invite link: {p0}"
7
+ },
8
+ "memberCount": {
9
+ "zh-CN": "群组共有 {p0} 名成员",
10
+ "en": "The group has {p0} members"
11
+ },
12
+ "operationFailed": {
13
+ "zh-CN": "操作失败",
14
+ "en": "Operation failed"
15
+ },
16
+ "pinDone": {
17
+ "zh-CN": "消息已置顶",
18
+ "en": "Message pinned"
19
+ },
20
+ "descriptionUpdated": {
21
+ "zh-CN": "群描述已更新",
22
+ "en": "Group description updated"
23
+ },
24
+ "messageUnpinned": {
25
+ "zh-CN": "已取消置顶",
26
+ "en": "Message unpinned"
27
+ },
28
+ "permissionsUpdated": {
29
+ "zh-CN": "群权限已更新",
30
+ "en": "Group permissions updated"
31
+ },
32
+ "reactionAdded": {
33
+ "zh-CN": "已添加反应 {p0}",
34
+ "en": "Reaction added: {p0}"
35
+ },
36
+ "pollSent": {
37
+ "zh-CN": "投票已发送",
38
+ "en": "Poll sent"
39
+ },
40
+ "pollOptionCount": {
41
+ "zh-CN": "至少需要 2 个选项",
42
+ "en": "At least two options are required"
43
+ },
44
+ "invalidPollOptions": {
45
+ "zh-CN": "options 格式错误,应为 JSON 数组",
46
+ "en": "options must be a JSON array"
47
+ },
48
+ "stickerSent": {
49
+ "zh-CN": "贴纸已发送",
50
+ "en": "Sticker sent"
51
+ }
52
+ });
@@ -0,0 +1,52 @@
1
+ import { createMessages } from 'zhin.js/i18n';
2
+
3
+ export const messages = createMessages({
4
+ "inviteLink": {
5
+ "zh-CN": "邀请链接: {p0}",
6
+ "en": "Invite link: {p0}"
7
+ },
8
+ "memberCount": {
9
+ "zh-CN": "群组共有 {p0} 名成员",
10
+ "en": "The group has {p0} members"
11
+ },
12
+ "operationFailed": {
13
+ "zh-CN": "操作失败",
14
+ "en": "Operation failed"
15
+ },
16
+ "pinDone": {
17
+ "zh-CN": "消息已置顶",
18
+ "en": "Message pinned"
19
+ },
20
+ "descriptionUpdated": {
21
+ "zh-CN": "群描述已更新",
22
+ "en": "Group description updated"
23
+ },
24
+ "messageUnpinned": {
25
+ "zh-CN": "已取消置顶",
26
+ "en": "Message unpinned"
27
+ },
28
+ "permissionsUpdated": {
29
+ "zh-CN": "群权限已更新",
30
+ "en": "Group permissions updated"
31
+ },
32
+ "reactionAdded": {
33
+ "zh-CN": "已添加反应 {p0}",
34
+ "en": "Reaction added: {p0}"
35
+ },
36
+ "pollSent": {
37
+ "zh-CN": "投票已发送",
38
+ "en": "Poll sent"
39
+ },
40
+ "pollOptionCount": {
41
+ "zh-CN": "至少需要 2 个选项",
42
+ "en": "At least two options are required"
43
+ },
44
+ "invalidPollOptions": {
45
+ "zh-CN": "options 格式错误,应为 JSON 数组",
46
+ "en": "options must be a JSON array"
47
+ },
48
+ "stickerSent": {
49
+ "zh-CN": "贴纸已发送",
50
+ "en": "Sticker sent"
51
+ }
52
+ });
@@ -2,23 +2,23 @@
2
2
  name: telegram-chat-admin
3
3
  platforms:
4
4
  - telegram
5
- description: Telegram 管理员查询、成员数、邀请、置顶和群权限设置能力。
5
+ description: Telegram 群组或频道管理员查询、成员数、邀请、置顶和描述管理。
6
6
  keywords:
7
- - "telegram"
8
- - "admin"
9
- - "invite"
10
- - "pin"
11
- - "permissions"
7
+ - telegram
8
+ - admin
9
+ - invite
10
+ - pin
12
11
  tools:
13
- - "pin_message"
14
- - "unpin_message"
15
- - "list_admins"
16
- - "member_count"
17
- - "create_invite"
18
- - "set_permissions"
19
- - "set_description"
12
+ - pin_message
13
+ - unpin_message
14
+ - list_admins
15
+ - member_count
16
+ - create_invite
17
+ - set_description
18
+ scopes:
19
+ - group
20
+ - channel
20
21
  ---
22
+ # Telegram 群组与频道
21
23
 
22
- # telegram-chat-admin
23
-
24
- 先读取管理员与成员状态,再执行邀请、置顶或权限变更。群设置写操作遵守审批策略。
24
+ 先读取管理员与成员状态,再执行邀请、置顶或描述变更;遵守各 Tool 的审批。群默认成员权限使用 telegram-group-permissions。
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  import { platformPermission } from '@zhin.js/permission';
@@ -8,11 +9,12 @@ export default defineAgentTool({
8
9
  chat_id: z.string().describe('聊天 ID'),
9
10
  }),
10
11
  adapter: 'telegram',
12
+ scopes: ["group", "channel"],
11
13
  tags: ['telegram'],
12
14
  permissions: [platformPermission('telegram', 'chat_administrator')],
13
15
  async execute({ chat_id }, context) {
14
16
  const endpoint = context.$client;
15
17
  const link = await endpoint.createInviteLink(Number(chat_id));
16
- return { invite_link: link, message: `邀请链接: ${link}` };
18
+ return { invite_link: link, message: t(context.locale, 'inviteLink', { p0: link }) };
17
19
  },
18
20
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
  import { platformPermission } from '@zhin.js/permission';
@@ -8,11 +9,12 @@ export default defineAgentTool<{ chat_id: string }>({
8
9
  chat_id: z.string().describe('聊天 ID'),
9
10
  }),
10
11
  adapter: 'telegram',
12
+ scopes: ["group","channel"],
11
13
  tags: ['telegram'],
12
14
  permissions: [platformPermission('telegram', 'chat_administrator')],
13
15
  async execute({ chat_id }: { chat_id: string }, context) {
14
16
  const endpoint = context.$client;
15
17
  const link = await endpoint.createInviteLink(Number(chat_id));
16
- return { invite_link: link, message: `邀请链接: ${link}` };
18
+ return { invite_link: link, message: t(context.locale, 'inviteLink', { p0: link }) };
17
19
  },
18
20
  });
@@ -7,6 +7,7 @@ export default defineAgentTool({
7
7
  chat_id: z.string().describe('聊天 ID'),
8
8
  }),
9
9
  adapter: 'telegram',
10
+ scopes: ["group", "channel"],
10
11
  tags: ['telegram'],
11
12
  async execute({ chat_id }, context) {
12
13
  const endpoint = context.$client;
@@ -7,6 +7,7 @@ export default defineAgentTool<{ chat_id: string }>({
7
7
  chat_id: z.string().describe('聊天 ID'),
8
8
  }),
9
9
  adapter: 'telegram',
10
+ scopes: ["group","channel"],
10
11
  tags: ['telegram'],
11
12
  async execute({ chat_id }: { chat_id: string }, context) {
12
13
  const endpoint = context.$client;
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  export default defineAgentTool({
@@ -7,10 +8,11 @@ export default defineAgentTool({
7
8
  chat_id: z.string().describe('聊天 ID'),
8
9
  }),
9
10
  adapter: 'telegram',
11
+ scopes: ["group", "channel"],
10
12
  tags: ['telegram'],
11
13
  async execute({ chat_id }, context) {
12
14
  const endpoint = context.$client;
13
15
  const count = await endpoint.getChatMemberCount(Number(chat_id));
14
- return { count, message: `群组共有 ${count} 名成员` };
16
+ return { count, message: t(context.locale, 'memberCount', { p0: count }) };
15
17
  },
16
18
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
 
@@ -7,10 +8,11 @@ export default defineAgentTool<{ chat_id: string }>({
7
8
  chat_id: z.string().describe('聊天 ID'),
8
9
  }),
9
10
  adapter: 'telegram',
11
+ scopes: ["group","channel"],
10
12
  tags: ['telegram'],
11
13
  async execute({ chat_id }: { chat_id: string }, context) {
12
14
  const endpoint = context.$client;
13
15
  const count = await endpoint.getChatMemberCount(Number(chat_id));
14
- return { count, message: `群组共有 ${count} 名成员` };
16
+ return { count, message: t(context.locale, 'memberCount', { p0: count }) };
15
17
  },
16
18
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  import { platformPermission } from '@zhin.js/permission';
@@ -9,11 +10,12 @@ export default defineAgentTool({
9
10
  message_id: z.string().describe('消息 ID'),
10
11
  }),
11
12
  adapter: 'telegram',
13
+ scopes: ["group", "channel"],
12
14
  tags: ['telegram'],
13
15
  permissions: [platformPermission('telegram', 'pin_messages')],
14
16
  async execute({ chat_id, message_id }, context) {
15
17
  const endpoint = context.$client;
16
18
  const success = await endpoint.pinMessage(Number(chat_id), Number(message_id));
17
- return { success, message: success ? '消息已置顶' : '操作失败' };
19
+ return { success, message: success ? t(context.locale, 'pinDone') : t(context.locale, 'operationFailed') };
18
20
  },
19
21
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
  import { platformPermission } from '@zhin.js/permission';
@@ -9,11 +10,12 @@ export default defineAgentTool<{ chat_id: string; message_id: string }>({
9
10
  message_id: z.string().describe('消息 ID'),
10
11
  }),
11
12
  adapter: 'telegram',
13
+ scopes: ["group","channel"],
12
14
  tags: ['telegram'],
13
15
  permissions: [platformPermission('telegram', 'pin_messages')],
14
16
  async execute({ chat_id, message_id }: { chat_id: string; message_id: string }, context) {
15
17
  const endpoint = context.$client;
16
18
  const success = await endpoint.pinMessage(Number(chat_id), Number(message_id));
17
- return { success, message: success ? '消息已置顶' : '操作失败' };
19
+ return { success, message: success ? t(context.locale, 'pinDone') : t(context.locale, 'operationFailed') };
18
20
  },
19
21
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  export default defineAgentTool({
@@ -8,10 +9,11 @@ export default defineAgentTool({
8
9
  description: z.string().describe('群描述文字'),
9
10
  }),
10
11
  adapter: 'telegram',
12
+ scopes: ["group", "channel"],
11
13
  tags: ['telegram'],
12
14
  async execute({ chat_id, description }, context) {
13
15
  const endpoint = context.$client;
14
16
  const success = await endpoint.setChatDescription(Number(chat_id), description);
15
- return { success, message: success ? '群描述已更新' : '操作失败' };
17
+ return { success, message: success ? t(context.locale, 'descriptionUpdated') : t(context.locale, 'operationFailed') };
16
18
  },
17
19
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
 
@@ -8,10 +9,11 @@ export default defineAgentTool<{ chat_id: string; description: string }>({
8
9
  description: z.string().describe('群描述文字'),
9
10
  }),
10
11
  adapter: 'telegram',
12
+ scopes: ["group","channel"],
11
13
  tags: ['telegram'],
12
14
  async execute({ chat_id, description }: { chat_id: string; description: string }, context) {
13
15
  const endpoint = context.$client;
14
16
  const success = await endpoint.setChatDescription(Number(chat_id), description);
15
- return { success, message: success ? '群描述已更新' : '操作失败' };
17
+ return { success, message: success ? t(context.locale, 'descriptionUpdated') : t(context.locale, 'operationFailed') };
16
18
  },
17
19
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  import { platformPermission } from '@zhin.js/permission';
@@ -9,11 +10,12 @@ export default defineAgentTool({
9
10
  message_id: z.string().optional().describe('消息 ID(可选,不提供则取消所有置顶)'),
10
11
  }),
11
12
  adapter: 'telegram',
13
+ scopes: ["group", "channel"],
12
14
  tags: ['telegram'],
13
15
  permissions: [platformPermission('telegram', 'pin_messages')],
14
16
  async execute({ chat_id, message_id }, context) {
15
17
  const endpoint = context.$client;
16
18
  const success = await endpoint.unpinMessage(Number(chat_id), message_id ? Number(message_id) : undefined);
17
- return { success, message: success ? '已取消置顶' : '操作失败' };
19
+ return { success, message: success ? t(context.locale, 'messageUnpinned') : t(context.locale, 'operationFailed') };
18
20
  },
19
21
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
  import { platformPermission } from '@zhin.js/permission';
@@ -9,11 +10,12 @@ export default defineAgentTool<{ chat_id: string; message_id?: string }>({
9
10
  message_id: z.string().optional().describe('消息 ID(可选,不提供则取消所有置顶)'),
10
11
  }),
11
12
  adapter: 'telegram',
13
+ scopes: ["group","channel"],
12
14
  tags: ['telegram'],
13
15
  permissions: [platformPermission('telegram', 'pin_messages')],
14
16
  async execute({ chat_id, message_id }: { chat_id: string; message_id?: string }, context) {
15
17
  const endpoint = context.$client;
16
18
  const success = await endpoint.unpinMessage(Number(chat_id), message_id ? Number(message_id) : undefined);
17
- return { success, message: success ? '已取消置顶' : '操作失败' };
19
+ return { success, message: success ? t(context.locale, 'messageUnpinned') : t(context.locale, 'operationFailed') };
18
20
  },
19
21
  });
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: telegram-group-permissions
3
+ platforms:
4
+ - telegram
5
+ scopes:
6
+ - group
7
+ description: Telegram 群默认成员权限设置。
8
+ keywords:
9
+ - telegram
10
+ - permissions
11
+ tools:
12
+ - set_permissions
13
+ ---
14
+ # telegram-group-permissions
15
+
16
+ 先确认群和当前管理员权限,再修改默认成员权限;遵守审批。
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  import { platformPermission } from '@zhin.js/permission';
@@ -17,6 +18,7 @@ export default defineAgentTool({
17
18
  can_pin_messages: z.boolean().optional().describe('是否可以置顶消息'),
18
19
  }),
19
20
  adapter: 'telegram',
21
+ scopes: ["group"],
20
22
  tags: ['telegram'],
21
23
  permissions: [platformPermission('telegram', 'manage_chat')],
22
24
  async execute({ chat_id, ...perms }, context) {
@@ -27,6 +29,6 @@ export default defineAgentTool({
27
29
  permissions[k] = v;
28
30
  }
29
31
  const success = await endpoint.setChatPermissionsAll(Number(chat_id), permissions);
30
- return { success, message: success ? '群权限已更新' : '操作失败' };
32
+ return { success, message: success ? t(context.locale, 'permissionsUpdated') : t(context.locale, 'operationFailed') };
31
33
  },
32
34
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
  import { platformPermission } from '@zhin.js/permission';
@@ -17,6 +18,7 @@ export default defineAgentTool<{ chat_id: string; can_send_messages?: boolean; c
17
18
  can_pin_messages: z.boolean().optional().describe('是否可以置顶消息'),
18
19
  }),
19
20
  adapter: 'telegram',
21
+ scopes: ["group"],
20
22
  tags: ['telegram'],
21
23
  permissions: [platformPermission('telegram', 'manage_chat')],
22
24
  async execute({ chat_id, ...perms }: { chat_id: string; can_send_messages?: boolean; can_send_photos?: boolean; can_send_videos?: boolean; can_send_polls?: boolean; can_send_other_messages?: boolean; can_add_web_page_previews?: boolean; can_change_info?: boolean; can_invite_users?: boolean; can_pin_messages?: boolean }, context) {
@@ -26,6 +28,6 @@ export default defineAgentTool<{ chat_id: string; can_send_messages?: boolean; c
26
28
  if (typeof v === 'boolean') permissions[k] = v;
27
29
  }
28
30
  const success = await endpoint.setChatPermissionsAll(Number(chat_id), permissions);
29
- return { success, message: success ? '群权限已更新' : '操作失败' };
31
+ return { success, message: success ? t(context.locale, 'permissionsUpdated') : t(context.locale, 'operationFailed') };
30
32
  },
31
33
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  export default defineAgentTool({
@@ -13,6 +14,6 @@ export default defineAgentTool({
13
14
  async execute({ chat_id, message_id, reaction }, context) {
14
15
  const endpoint = context.$client;
15
16
  const success = await endpoint.setMessageReaction(Number(chat_id), Number(message_id), reaction);
16
- return { success, message: success ? `已添加反应 ${reaction}` : '操作失败' };
17
+ return { success, message: success ? t(context.locale, 'reactionAdded', { p0: reaction }) : t(context.locale, 'operationFailed') };
17
18
  },
18
19
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
 
@@ -13,6 +14,6 @@ export default defineAgentTool<{ chat_id: string; message_id: string; reaction:
13
14
  async execute({ chat_id, message_id, reaction }: { chat_id: string; message_id: string; reaction: string }, context) {
14
15
  const endpoint = context.$client;
15
16
  const success = await endpoint.setMessageReaction(Number(chat_id), Number(message_id), reaction);
16
- return { success, message: success ? `已添加反应 ${reaction}` : '操作失败' };
17
+ return { success, message: success ? t(context.locale, 'reactionAdded', { p0: reaction }) : t(context.locale, 'operationFailed') };
17
18
  },
18
19
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  export default defineAgentTool({
@@ -19,12 +20,12 @@ export default defineAgentTool({
19
20
  optList = JSON.parse(options);
20
21
  }
21
22
  catch {
22
- return { success: false, message: 'options 格式错误,应为 JSON 数组' };
23
+ return { success: false, message: t(context.locale, 'invalidPollOptions') };
23
24
  }
24
25
  if (!Array.isArray(optList) || optList.length < 2) {
25
- return { success: false, message: '至少需要 2 个选项' };
26
+ return { success: false, message: t(context.locale, 'pollOptionCount') };
26
27
  }
27
28
  const result = await endpoint.sendPoll(Number(chat_id), question, optList, is_anonymous ?? true, allows_multiple ?? false);
28
- return { success: true, message_id: result.message_id, message: '投票已发送' };
29
+ return { success: true, message_id: result.message_id, message: t(context.locale, 'pollSent') };
29
30
  },
30
31
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
 
@@ -18,15 +19,15 @@ export default defineAgentTool<{ chat_id: string; question: string; options: str
18
19
  try {
19
20
  optList = JSON.parse(options);
20
21
  } catch {
21
- return { success: false, message: 'options 格式错误,应为 JSON 数组' };
22
+ return { success: false, message: t(context.locale, 'invalidPollOptions') };
22
23
  }
23
24
  if (!Array.isArray(optList) || optList.length < 2) {
24
- return { success: false, message: '至少需要 2 个选项' };
25
+ return { success: false, message: t(context.locale, 'pollOptionCount') };
25
26
  }
26
27
  const result = await endpoint.sendPoll(
27
28
  Number(chat_id), question, optList,
28
29
  is_anonymous ?? true, allows_multiple ?? false,
29
30
  );
30
- return { success: true, message_id: result.message_id, message: '投票已发送' };
31
+ return { success: true, message_id: result.message_id, message: t(context.locale, 'pollSent') };
31
32
  },
32
33
  });
@@ -1,4 +1,5 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { messages as t } from "../../../../messages.js";
2
3
  import { defineAgentTool } from '@zhin.js/tool';
3
4
  import { z } from 'zod';
4
5
  export default defineAgentTool({
@@ -12,6 +13,6 @@ export default defineAgentTool({
12
13
  async execute({ chat_id, sticker }, context) {
13
14
  const endpoint = context.$client;
14
15
  const result = await endpoint.sendStickerMessage(Number(chat_id), sticker);
15
- return { success: true, message_id: result.message_id, message: '贴纸已发送' };
16
+ return { success: true, message_id: result.message_id, message: t(context.locale, 'stickerSent') };
16
17
  },
17
18
  });
@@ -1,3 +1,4 @@
1
+ import { messages as t } from "../../../../messages.js";
1
2
  import { defineAgentTool } from '@zhin.js/tool';
2
3
  import { z } from 'zod';
3
4
 
@@ -12,6 +13,6 @@ export default defineAgentTool<{ chat_id: string; sticker: string }>({
12
13
  async execute({ chat_id, sticker }: { chat_id: string; sticker: string }, context) {
13
14
  const endpoint = context.$client;
14
15
  const result = await endpoint.sendStickerMessage(Number(chat_id), sticker);
15
- return { success: true, message_id: result.message_id, message: '贴纸已发送' };
16
+ return { success: true, message_id: result.message_id, message: t(context.locale, 'stickerSent') };
16
17
  },
17
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-telegram",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Zhin.js Telegram Bot API adapter for Plugin Runtime (long-poll getUpdates)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -31,23 +31,23 @@
31
31
  "directory": "plugins/adapters/telegram"
32
32
  },
33
33
  "dependencies": {
34
- "@zhin.js/adapter": "1.1.21",
35
- "@zhin.js/agent-feature": "1.1.8",
36
- "@zhin.js/core": "1.1.49",
37
- "@zhin.js/feature-kit": "1.1.7",
38
- "@zhin.js/host-http": "1.1.8",
39
- "@zhin.js/im-contract": "1.1.5",
34
+ "@zhin.js/adapter": "1.1.23",
35
+ "@zhin.js/agent-feature": "1.1.10",
36
+ "@zhin.js/core": "1.1.51",
37
+ "@zhin.js/feature-kit": "1.1.9",
38
+ "@zhin.js/host-http": "1.1.10",
39
+ "@zhin.js/im-contract": "1.1.7",
40
40
  "@zhin.js/logger": "1.1.2",
41
- "@zhin.js/skill": "1.1.8",
42
- "@zhin.js/tool": "1.1.8"
41
+ "@zhin.js/skill": "1.1.10",
42
+ "@zhin.js/tool": "1.1.10"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "zod": "^4.0.0",
46
- "@zhin.js/adapter": "^1.1.21",
47
- "@zhin.js/command": "^1.1.9",
48
- "@zhin.js/core": "^1.1.49",
49
- "@zhin.js/permission": "^1.1.7",
50
- "zhin.js": "^1.1.14"
46
+ "@zhin.js/adapter": "^1.1.23",
47
+ "@zhin.js/command": "^1.1.11",
48
+ "@zhin.js/core": "^1.1.51",
49
+ "@zhin.js/permission": "^1.1.9",
50
+ "zhin.js": "^1.1.16"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "@zhin.js/command": {
@@ -65,8 +65,8 @@
65
65
  "typescript": "^6.0.3",
66
66
  "vitest": "^4.1.10",
67
67
  "zod": "^4.4.3",
68
- "@zhin.js/host-http": "1.1.8",
69
- "zhin.js": "1.1.14"
68
+ "@zhin.js/host-http": "1.1.10",
69
+ "zhin.js": "1.1.16"
70
70
  },
71
71
  "files": [
72
72
  "adapters",
package/schema.json CHANGED
@@ -45,7 +45,12 @@
45
45
  "string",
46
46
  "number"
47
47
  ],
48
- "description": "框架 master(Telegram user id;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖"
48
+ "description": "框架 master(Telegram user id;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖",
49
+ "x-i18n": {
50
+ "en": {
51
+ "description": "Framework masters (Telegram user id; AI/tool permissions and endpoint management). endpoints[i].master can override this value."
52
+ }
53
+ }
49
54
  },
50
55
  "trusted": {
51
56
  "type": "array",
@@ -56,7 +61,12 @@
56
61
  ],
57
62
  "description": "Trusted Telegram user id"
58
63
  },
59
- "description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加"
64
+ "description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加",
65
+ "x-i18n": {
66
+ "en": {
67
+ "description": "Framework trusted users, below master authority. endpoints[i].trusted can add users."
68
+ }
69
+ }
60
70
  },
61
71
  "endpoints": {
62
72
  "type": "array",
@@ -71,7 +81,12 @@
71
81
  "string",
72
82
  "number"
73
83
  ],
74
- "description": "本 endpoint 的框架 master(Telegram user id);覆盖顶层 master"
84
+ "description": "本 endpoint 的框架 master(Telegram user id);覆盖顶层 master",
85
+ "x-i18n": {
86
+ "en": {
87
+ "description": "Framework masters for this endpoint (Telegram user id), overriding the top-level master list."
88
+ }
89
+ }
75
90
  },
76
91
  "trusted": {
77
92
  "type": "array",
@@ -82,7 +97,12 @@
82
97
  ],
83
98
  "description": "Trusted Telegram user id"
84
99
  },
85
- "description": "本 endpoint 的 trusted 列表"
100
+ "description": "本 endpoint 的 trusted 列表",
101
+ "x-i18n": {
102
+ "en": {
103
+ "description": "Trusted users for this endpoint."
104
+ }
105
+ }
86
106
  },
87
107
  "token": {
88
108
  "type": "string",
@@ -127,12 +147,22 @@
127
147
  "id",
128
148
  "token"
129
149
  ]
150
+ },
151
+ "x-i18n": {
152
+ "en": {
153
+ "description": "Multiple accounts: mount multiple endpoints in one plugin instance. Each entry uses the top-level fields; id is required and other fields override defaults."
154
+ }
130
155
  }
131
156
  },
132
157
  "commandPrefix": {
133
158
  "type": "string",
134
159
  "default": "",
135
- "description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
160
+ "description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖",
161
+ "x-i18n": {
162
+ "en": {
163
+ "description": "Command prefix. The default empty string allows unprefixed commands; '/' requires a leading slash. Each endpoints[i] can override it."
164
+ }
165
+ }
136
166
  }
137
167
  },
138
168
  "required": [