@craftsamo/telegram-tools 0.1.0 → 0.2.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/dist/opencode.js CHANGED
@@ -20008,6 +20008,7 @@ function lockHolder(path) {
20008
20008
  }
20009
20009
 
20010
20010
  // src/core/time.ts
20011
+ var MS_PER_S = 1e3;
20011
20012
  var MS_PER_MINUTE = 6e4;
20012
20013
  var MINUTES_PER_HOUR = 60;
20013
20014
  var localOffsetMinutes = (ms) => -new Date(ms).getTimezoneOffset();
@@ -20934,7 +20935,6 @@ async function callService(socketPath, method, params, options) {
20934
20935
  // src/core/chat/live.ts
20935
20936
  var REFRESH_TIMEOUT_MS = 12e4;
20936
20937
  var FETCH_TIMEOUT_MS = 18e4;
20937
- var MS_PER_S = 1e3;
20938
20938
  function requestHistory(socket, params, signal) {
20939
20939
  return callService(socket, SERVICE_REQUESTS.history, params, { effect: "read", signal });
20940
20940
  }
@@ -21062,113 +21062,6 @@ var messageEntry = external_exports.object({
21062
21062
  private_note: external_exports.string().optional()
21063
21063
  });
21064
21064
 
21065
- // src/core/chat/schema.ts
21066
- var METHODS = ["list", "view", "topics", "search", "around", "fetch"];
21067
- var GENERAL_TOPIC2 = 1;
21068
- var LIMITS = {
21069
- list: { default: 30, max: 200 },
21070
- view: { default: 50, max: 300 },
21071
- topics: { default: 30, max: TOPICS_LIMIT },
21072
- search: { default: 30, max: 200 }
21073
- };
21074
- var AROUND_COUNT = { default: 5, max: AROUND_LIMIT };
21075
- var FETCH_PAGES = { default: 1, max: FETCH_PAGE_LIMIT };
21076
- var accountArgument = external_exports.string().optional().describe("The account label; may be left out when only one account is logged in.");
21077
- var input3 = external_exports.object({
21078
- method: external_exports.enum(METHODS).describe(
21079
- "`list` finds chats; `view` reads the newest messages of one chat between two times, oldest first; `topics` lists the topics of a forum chat; `search` finds messages in the mirror by words; `around` reads the messages around one; `fetch` adds older history of a mirrored chat to the mirror."
21080
- ),
21081
- account: accountArgument,
21082
- query: external_exports.string().optional().describe(
21083
- "list: only chats whose name or username holds this text; a leading @ is ignored. search (required): the words to look for, all of which a message must hold in its text, caption or file name, in any order. Both ignore case and letter width."
21084
- ),
21085
- unread: external_exports.boolean().optional().describe("list: only chats with unread messages."),
21086
- last: external_exports.boolean().optional().describe("list: add each chat's newest mirrored message as `last_message`."),
21087
- refresh: external_exports.boolean().optional().describe(
21088
- "list: first take the chat list from Telegram (needs the sync service), then read it, and report when in `refreshed_at`."
21089
- ),
21090
- chat: external_exports.string().optional().describe(
21091
- "view, topics, around, fetch (required) and search (optional, to search one chat): the chat id, from `list`, such as 123456789 or -1001234567890. A name, username or phone number is not a chat."
21092
- ),
21093
- topic: external_exports.number().int().positive().optional().describe(
21094
- `view, around: only messages of this topic of a forum chat (ids from \`topics\`); the General topic is ${GENERAL_TOPIC2}. Refused for a chat without topics.`
21095
- ),
21096
- after: external_exports.string().optional().describe(
21097
- "view, search: only messages after this time (exclusive): RFC 3339 with an offset, or a date or time without one, read as local time, such as 2026-11-07 or 2026-11-07T14:03."
21098
- ),
21099
- before: external_exports.string().optional().describe("view, search: only messages before this time (exclusive); the same forms as `after`."),
21100
- limit: external_exports.number().int().optional().describe(
21101
- `How many to return. list: default ${LIMITS.list.default}, at most ${LIMITS.list.max}. view: default ${LIMITS.view.default}, at most ${LIMITS.view.max} (${HISTORY_LIMIT} for a chat read live). topics: default ${LIMITS.topics.default}, at most ${LIMITS.topics.max}. search: default ${LIMITS.search.default}, at most ${LIMITS.search.max}. A larger value is lowered to the most; a result may hold fewer to stay a size a model can read.`
21102
- ),
21103
- cursor: external_exports.string().optional().describe("The `next` of the previous result, to continue where it stopped."),
21104
- id: external_exports.number().int().positive().optional().describe("around (required): the id of the message to read around."),
21105
- before_count: external_exports.number().int().optional().describe(
21106
- `around: how many older messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
21107
- ),
21108
- after_count: external_exports.number().int().optional().describe(
21109
- `around: how many newer messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
21110
- ),
21111
- pages: external_exports.number().int().optional().describe(
21112
- `fetch: how many pages of ${FETCH_PAGE_SIZE} older messages to add, default ${FETCH_PAGES.default}, at most ${FETCH_PAGES.max}.`
21113
- )
21114
- });
21115
- var nameCut = external_exports.literal(true).optional().describe("Set when the name was longer than the most a result carries and was cut.");
21116
- var chatEntry2 = external_exports.object({
21117
- id: external_exports.string().describe("The chat id: Telegram's signed id as text, such as `123456789` or `-1001234567890`."),
21118
- kind: external_exports.enum(CHAT_KINDS).describe("`self` is Saved Messages."),
21119
- name: external_exports.string().nullable().describe("The person's or chat's name; null when none is known."),
21120
- name_cut: nameCut,
21121
- username: external_exports.string().optional(),
21122
- mirrored: external_exports.boolean().describe("Whether the mirror keeps this chat's messages."),
21123
- unread: external_exports.number().int().describe("Incoming messages not read yet."),
21124
- last_activity_at: localTimeSchema.nullable().describe("The latest message's time, in local time with offset; null when none is known."),
21125
- forum: external_exports.literal(true).optional().describe("Set for a supergroup with topics."),
21126
- archived: external_exports.literal(true).optional(),
21127
- left: external_exports.literal(true).optional().describe("Set for a group or channel the user has left or been removed from."),
21128
- can_send: external_exports.literal(false).optional().describe("Set when the user is known not to be able to write here."),
21129
- auto_delete_seconds: external_exports.number().int().optional().describe("The chat's auto-delete period, when on."),
21130
- last_message: messageEntry.nullable().optional().describe("With `last`: the newest mirrored message of the chat, or null when none is mirrored.")
21131
- });
21132
- var topicEntry = external_exports.object({
21133
- id: external_exports.number().int().describe(`The topic id, to pass as \`topic\` to \`view\`; ${GENERAL_TOPIC2} is the General topic.`),
21134
- title: external_exports.string().nullable().describe("The topic's title; null when none is known."),
21135
- closed: external_exports.literal(true).optional().describe("Set for a topic that is closed."),
21136
- pinned: external_exports.literal(true).optional().describe("Set for a topic that is pinned."),
21137
- unread: external_exports.number().int().describe("Messages in it not read yet."),
21138
- last_activity_at: localTimeSchema.nullable().describe("The newest message's time, in local time with offset; null when none is known.")
21139
- });
21140
- var output3 = external_exports.object({
21141
- chats: external_exports.array(chatEntry2).optional().describe("list: the chats, newest activity first."),
21142
- refreshed_at: localTimeSchema.optional().describe("list with `refresh`: when the chat list was taken from Telegram, in local time with offset."),
21143
- chat: chatEntry2.optional().describe("view, topics, around, fetch: the chat read."),
21144
- messages: external_exports.array(messageEntry).optional().describe("view, around: the messages, oldest first. search: the hits, newest first."),
21145
- live: external_exports.literal(true).optional().describe(
21146
- "view, around: set when the chat is not mirrored, so the messages were read from Telegram and stored nowhere."
21147
- ),
21148
- topics: external_exports.array(topicEntry).optional().describe("topics: the topics, most recently active first."),
21149
- anchor: external_exports.number().int().optional().describe("around: the id of the message read around, among `messages`."),
21150
- trimmed_before: external_exports.number().int().optional().describe(
21151
- "around: how many older messages were left out, farthest first, to keep the result a size that can be read."
21152
- ),
21153
- trimmed_after: external_exports.number().int().optional().describe(
21154
- "around: how many newer messages were left out, farthest first, to keep the result a size that can be read."
21155
- ),
21156
- scanned_to: localTimeSchema.optional().describe(
21157
- "search: set when the search stopped before the end of the history it covers: the time of the oldest message looked at, in local time with offset. `next` continues from there."
21158
- ),
21159
- scope: external_exports.string().optional().describe("search: what the search covers and what it does not."),
21160
- fetched: external_exports.object({
21161
- added: external_exports.number().int().describe("How many messages the mirror gained."),
21162
- pages: external_exports.number().int().describe("How many pages were read."),
21163
- complete: external_exports.boolean().describe("Whether Telegram has nothing older for this chat."),
21164
- oldest_at: localTimeSchema.nullable().describe(
21165
- "The time of the oldest message the mirror now holds of this chat, in local time with offset; null when none."
21166
- )
21167
- }).optional().describe("fetch: what the history fetch stored."),
21168
- next: external_exports.string().optional().describe("Pass back as `cursor` to continue; absent when there is no more."),
21169
- note: external_exports.string().describe("Says that what the result carries is data written by other people.")
21170
- });
21171
-
21172
21065
  // src/core/chat/message-rows.ts
21173
21066
  var MESSAGE_COLUMNS = "chat, id, topic, ts, from_me, sender, sender_name, kind, body, entities, media, action, reply, forward, grouped, reactions, edited, expires, view_once, self_destruct";
21174
21067
  function liveMessages(now) {
@@ -21176,7 +21069,7 @@ function liveMessages(now) {
21176
21069
  }
21177
21070
  function inTopic(topic) {
21178
21071
  return {
21179
- condition: topic === GENERAL_TOPIC2 ? "(topic IS NULL OR topic = ?)" : "topic = ?",
21072
+ condition: topic === GENERAL_TOPIC ? "(topic IS NULL OR topic = ?)" : "topic = ?",
21180
21073
  params: [topic]
21181
21074
  };
21182
21075
  }
@@ -21401,6 +21294,112 @@ var cuttableMessage = {
21401
21294
  drop: dropMetadata
21402
21295
  };
21403
21296
 
21297
+ // src/core/chat/schema.ts
21298
+ var METHODS = ["list", "view", "topics", "search", "around", "fetch"];
21299
+ var LIMITS = {
21300
+ list: { default: 30, max: 200 },
21301
+ view: { default: 50, max: 300 },
21302
+ topics: { default: 30, max: TOPICS_LIMIT },
21303
+ search: { default: 30, max: 200 }
21304
+ };
21305
+ var AROUND_COUNT = { default: 5, max: AROUND_LIMIT };
21306
+ var FETCH_PAGES = { default: 1, max: FETCH_PAGE_LIMIT };
21307
+ var accountArgument = external_exports.string().optional().describe("The account label; may be left out when only one account is logged in.");
21308
+ var input3 = external_exports.object({
21309
+ method: external_exports.enum(METHODS).describe(
21310
+ "`list` finds chats; `view` reads the newest messages of one chat between two times, oldest first; `topics` lists the topics of a forum chat; `search` finds messages in the mirror by words; `around` reads the messages around one; `fetch` adds older history of a mirrored chat to the mirror."
21311
+ ),
21312
+ account: accountArgument,
21313
+ query: external_exports.string().optional().describe(
21314
+ "list: only chats whose name or username holds this text; a leading @ is ignored. search (required): the words to look for, all of which a message must hold in its text, caption or file name, in any order. Both ignore case and letter width."
21315
+ ),
21316
+ unread: external_exports.boolean().optional().describe("list: only chats with unread messages."),
21317
+ last: external_exports.boolean().optional().describe("list: add each chat's newest mirrored message as `last_message`."),
21318
+ refresh: external_exports.boolean().optional().describe(
21319
+ "list: first take the chat list from Telegram (needs the sync service), then read it, and report when in `refreshed_at`."
21320
+ ),
21321
+ chat: external_exports.string().optional().describe(
21322
+ "view, topics, around, fetch (required) and search (optional, to search one chat): the chat id, from `list`, such as 123456789 or -1001234567890. A name, username or phone number is not a chat."
21323
+ ),
21324
+ topic: external_exports.number().int().positive().optional().describe(
21325
+ `view, around: only messages of this topic of a forum chat (ids from \`topics\`); the General topic is ${GENERAL_TOPIC}. Refused for a chat without topics.`
21326
+ ),
21327
+ after: external_exports.string().optional().describe(
21328
+ "view, search: only messages after this time (exclusive): RFC 3339 with an offset, or a date or time without one, read as local time, such as 2026-11-07 or 2026-11-07T14:03."
21329
+ ),
21330
+ before: external_exports.string().optional().describe("view, search: only messages before this time (exclusive); the same forms as `after`."),
21331
+ limit: external_exports.number().int().optional().describe(
21332
+ `How many to return. list: default ${LIMITS.list.default}, at most ${LIMITS.list.max}. view: default ${LIMITS.view.default}, at most ${LIMITS.view.max} (${HISTORY_LIMIT} for a chat read live). topics: default ${LIMITS.topics.default}, at most ${LIMITS.topics.max}. search: default ${LIMITS.search.default}, at most ${LIMITS.search.max}. A larger value is lowered to the most; a result may hold fewer to stay a size a model can read.`
21333
+ ),
21334
+ cursor: external_exports.string().optional().describe("The `next` of the previous result, to continue where it stopped."),
21335
+ id: external_exports.number().int().positive().optional().describe("around (required): the id of the message to read around."),
21336
+ before_count: external_exports.number().int().optional().describe(
21337
+ `around: how many older messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
21338
+ ),
21339
+ after_count: external_exports.number().int().optional().describe(
21340
+ `around: how many newer messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
21341
+ ),
21342
+ pages: external_exports.number().int().optional().describe(
21343
+ `fetch: how many pages of ${FETCH_PAGE_SIZE} older messages to add, default ${FETCH_PAGES.default}, at most ${FETCH_PAGES.max}.`
21344
+ )
21345
+ });
21346
+ var nameCut = external_exports.literal(true).optional().describe("Set when the name was longer than the most a result carries and was cut.");
21347
+ var chatEntry2 = external_exports.object({
21348
+ id: external_exports.string().describe("The chat id: Telegram's signed id as text, such as `123456789` or `-1001234567890`."),
21349
+ kind: external_exports.enum(CHAT_KINDS).describe("`self` is Saved Messages."),
21350
+ name: external_exports.string().nullable().describe("The person's or chat's name; null when none is known."),
21351
+ name_cut: nameCut,
21352
+ username: external_exports.string().optional(),
21353
+ mirrored: external_exports.boolean().describe("Whether the mirror keeps this chat's messages."),
21354
+ unread: external_exports.number().int().describe("Incoming messages not read yet."),
21355
+ last_activity_at: localTimeSchema.nullable().describe("The latest message's time, in local time with offset; null when none is known."),
21356
+ forum: external_exports.literal(true).optional().describe("Set for a supergroup with topics."),
21357
+ archived: external_exports.literal(true).optional(),
21358
+ left: external_exports.literal(true).optional().describe("Set for a group or channel the user has left or been removed from."),
21359
+ can_send: external_exports.literal(false).optional().describe("Set when the user is known not to be able to write here."),
21360
+ auto_delete_seconds: external_exports.number().int().optional().describe("The chat's auto-delete period, when on."),
21361
+ last_message: messageEntry.nullable().optional().describe("With `last`: the newest mirrored message of the chat, or null when none is mirrored.")
21362
+ });
21363
+ var topicEntry = external_exports.object({
21364
+ id: external_exports.number().int().describe(`The topic id, to pass as \`topic\` to \`view\`; ${GENERAL_TOPIC} is the General topic.`),
21365
+ title: external_exports.string().nullable().describe("The topic's title; null when none is known."),
21366
+ closed: external_exports.literal(true).optional().describe("Set for a topic that is closed."),
21367
+ pinned: external_exports.literal(true).optional().describe("Set for a topic that is pinned."),
21368
+ unread: external_exports.number().int().describe("Messages in it not read yet."),
21369
+ last_activity_at: localTimeSchema.nullable().describe("The newest message's time, in local time with offset; null when none is known.")
21370
+ });
21371
+ var output3 = external_exports.object({
21372
+ chats: external_exports.array(chatEntry2).optional().describe("list: the chats, newest activity first."),
21373
+ refreshed_at: localTimeSchema.optional().describe("list with `refresh`: when the chat list was taken from Telegram, in local time with offset."),
21374
+ chat: chatEntry2.optional().describe("view, topics, around, fetch: the chat read."),
21375
+ messages: external_exports.array(messageEntry).optional().describe("view, around: the messages, oldest first. search: the hits, newest first."),
21376
+ live: external_exports.literal(true).optional().describe(
21377
+ "view, around: set when the chat is not mirrored, so the messages were read from Telegram and stored nowhere."
21378
+ ),
21379
+ topics: external_exports.array(topicEntry).optional().describe("topics: the topics, most recently active first."),
21380
+ anchor: external_exports.number().int().optional().describe("around: the id of the message read around, among `messages`."),
21381
+ trimmed_before: external_exports.number().int().optional().describe(
21382
+ "around: how many older messages were left out, farthest first, to keep the result a size that can be read."
21383
+ ),
21384
+ trimmed_after: external_exports.number().int().optional().describe(
21385
+ "around: how many newer messages were left out, farthest first, to keep the result a size that can be read."
21386
+ ),
21387
+ scanned_to: localTimeSchema.optional().describe(
21388
+ "search: set when the search stopped before the end of the history it covers: the time of the oldest message looked at, in local time with offset. `next` continues from there."
21389
+ ),
21390
+ scope: external_exports.string().optional().describe("search: what the search covers and what it does not."),
21391
+ fetched: external_exports.object({
21392
+ added: external_exports.number().int().describe("How many messages the mirror gained."),
21393
+ pages: external_exports.number().int().describe("How many pages were read."),
21394
+ complete: external_exports.boolean().describe("Whether Telegram has nothing older for this chat."),
21395
+ oldest_at: localTimeSchema.nullable().describe(
21396
+ "The time of the oldest message the mirror now holds of this chat, in local time with offset; null when none."
21397
+ )
21398
+ }).optional().describe("fetch: what the history fetch stored."),
21399
+ next: external_exports.string().optional().describe("Pass back as `cursor` to continue; absent when there is no more."),
21400
+ note: external_exports.string().describe("Says that what the result carries is data written by other people.")
21401
+ });
21402
+
21404
21403
  // src/core/chat/around.ts
21405
21404
  var TRIMMED_RESERVE = 100;
21406
21405
  var NO_MESSAGE = "No message with this id in this chat.";
@@ -21603,7 +21602,7 @@ function listChats(mirror, args, now) {
21603
21602
  return result;
21604
21603
  }
21605
21604
 
21606
- // src/core/chat/open.ts
21605
+ // src/core/open.ts
21607
21606
  async function pickPaths(ctx, account2) {
21608
21607
  if (!ctx.stateDir) throw new ToolError("internal_error", "The entry point did not supply a state directory.");
21609
21608
  return pickLabel(ctx.stateDir, account2);
@@ -22023,6 +22022,56 @@ var CHAT_FACT_TRANSLATIONS = {
22023
22022
  }
22024
22023
  };
22025
22024
 
22025
+ // src/core/chat/media-facts.ts
22026
+ var MEDIA_KIND_WORDS = {
22027
+ photo: "Photo",
22028
+ document: "Document",
22029
+ audio: "Audio",
22030
+ voice: "Voice message",
22031
+ video: "Video",
22032
+ sticker: "Sticker",
22033
+ dice: "Dice",
22034
+ contact: "Contact",
22035
+ venue: "Venue",
22036
+ geo: "Location",
22037
+ geo_live: "Live location",
22038
+ game: "Game",
22039
+ invoice: "Invoice",
22040
+ webpage: "Link preview",
22041
+ poll: "Poll",
22042
+ todo: "Checklist",
22043
+ story: "Story",
22044
+ paid: "Paid media",
22045
+ unsupported: "Unsupported media"
22046
+ };
22047
+ function mediaKindValue(type) {
22048
+ return Object.hasOwn(MEDIA_KIND_WORDS, type) ? { text: MEDIA_KIND_WORDS[type] } : type;
22049
+ }
22050
+ var MEDIA_FACT_TRANSLATIONS = {
22051
+ ja: {
22052
+ Media: "\u30E1\u30C7\u30A3\u30A2",
22053
+ Photo: "\u5199\u771F",
22054
+ Document: "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8",
22055
+ Audio: "\u97F3\u58F0",
22056
+ "Voice message": "\u30DC\u30A4\u30B9\u30E1\u30C3\u30BB\u30FC\u30B8",
22057
+ Video: "\u52D5\u753B",
22058
+ Sticker: "\u30B9\u30BF\u30F3\u30D7",
22059
+ Dice: "\u30B5\u30A4\u30B3\u30ED",
22060
+ Contact: "\u9023\u7D61\u5148",
22061
+ Venue: "\u5834\u6240",
22062
+ Location: "\u4F4D\u7F6E\u60C5\u5831",
22063
+ "Live location": "\u30E9\u30A4\u30D6\u4F4D\u7F6E\u60C5\u5831",
22064
+ Game: "\u30B2\u30FC\u30E0",
22065
+ Invoice: "\u8ACB\u6C42\u66F8",
22066
+ "Link preview": "\u30EA\u30F3\u30AF\u306E\u30D7\u30EC\u30D3\u30E5\u30FC",
22067
+ Poll: "\u6295\u7968",
22068
+ Checklist: "\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",
22069
+ Story: "\u30B9\u30C8\u30FC\u30EA\u30FC",
22070
+ "Paid media": "\u6709\u6599\u30E1\u30C7\u30A3\u30A2",
22071
+ "Unsupported media": "\u672A\u5BFE\u5FDC\u306E\u30E1\u30C7\u30A3\u30A2"
22072
+ }
22073
+ };
22074
+
22026
22075
  // src/core/facts.ts
22027
22076
  function sizeFact(bytes) {
22028
22077
  return { label: "Size", value: { text: bytes === 1 ? "{bytes} byte" : "{bytes} bytes", values: { bytes } } };
@@ -23977,14 +24026,6 @@ function namesOf(file2, id) {
23977
24026
  const name = safeFileName(file2.name, { kind: file2.kind, id, type: file2.type });
23978
24027
  return { name, shown: file2.name === null ? file2.kind : name };
23979
24028
  }
23980
- var FILE_KIND_WORDS = {
23981
- photo: "Photo",
23982
- document: "Document",
23983
- audio: "Audio",
23984
- voice: "Voice message",
23985
- video: "Video",
23986
- sticker: "Sticker"
23987
- };
23988
24029
  function saveHeadline(file2, chat) {
23989
24030
  if (file2 !== void 0 && chat !== null) return { text: "About to save {file} from {chat}", values: { file: file2, chat } };
23990
24031
  if (chat !== null) return { text: "About to save a file from {chat}", values: { chat } };
@@ -23992,9 +24033,8 @@ function saveHeadline(file2, chat) {
23992
24033
  return void 0;
23993
24034
  }
23994
24035
  function fileFacts(media, unpack) {
23995
- const kind = media && Object.hasOwn(FILE_KIND_WORDS, media.type) ? FILE_KIND_WORDS[media.type] : void 0;
23996
24036
  return [
23997
- ...media ? [{ label: "File", value: kind ? { text: kind } : media.type }] : [],
24037
+ ...media ? [{ label: "File", value: mediaKindValue(media.type) }] : [],
23998
24038
  ...unpack ? [{ label: "Unpack", value: { text: "Yes" } }] : [],
23999
24039
  ...media?.size !== void 0 && Number.isSafeInteger(media.size) && media.size > 0 ? [sizeFact(media.size)] : []
24000
24040
  ];
@@ -24509,9 +24549,8 @@ async function checkArchive(path, format, limits, signal) {
24509
24549
  }
24510
24550
 
24511
24551
  // src/core/outgoing/limits.ts
24512
- var BYTES_PER_MB2 = 1024 * 1024;
24513
24552
  var MAX_FILES = 10;
24514
- var MAX_TOTAL_BYTES = 100 * BYTES_PER_MB2;
24553
+ var MAX_TOTAL_BYTES = 100 * BYTES_PER_MB;
24515
24554
 
24516
24555
  // src/core/file/send/constants.ts
24517
24556
  var SEND_FILES_TIMEOUT_MS = 30 * 60 * 1e3;
@@ -25233,39 +25272,46 @@ async function wholeCallDescription(spec, args, ctx) {
25233
25272
  // src/core/message/action-describe.ts
25234
25273
  var EDIT_HEADLINES = {
25235
25274
  named: "About to edit message {id} in {chat}",
25236
- saved: "About to edit message {id} in Saved Messages"
25275
+ saved: "About to edit message {id} in Saved Messages",
25276
+ bare: "About to edit message {id}"
25237
25277
  };
25238
25278
  var DELETE_HEADLINES = {
25239
- named: "About to delete message {id} from {chat}",
25240
- saved: "About to delete message {id} from Saved Messages"
25279
+ named: "About to delete message {id} from {chat} for everyone",
25280
+ saved: "About to delete message {id} from Saved Messages",
25281
+ bare: "About to delete message {id} for everyone"
25241
25282
  };
25242
25283
  var REACT_HEADLINES = {
25243
25284
  named: "About to react {emoji} to message {id} in {chat}",
25244
- saved: "About to react {emoji} to message {id} in Saved Messages"
25285
+ saved: "About to react {emoji} to message {id} in Saved Messages",
25286
+ bare: "About to react {emoji} to message {id}"
25245
25287
  };
25246
25288
  var UNREACT_HEADLINES = {
25247
25289
  named: "About to remove your reaction from message {id} in {chat}",
25248
- saved: "About to remove your reaction from message {id} in Saved Messages"
25290
+ saved: "About to remove your reaction from message {id} in Saved Messages",
25291
+ bare: "About to remove your reaction from message {id}"
25249
25292
  };
25250
25293
  var PIN_HEADLINES = {
25251
25294
  named: "About to pin message {id} in {chat}",
25252
- saved: "About to pin message {id} in Saved Messages"
25295
+ saved: "About to pin message {id} in Saved Messages",
25296
+ bare: "About to pin message {id}"
25253
25297
  };
25254
25298
  var UNPIN_HEADLINES = {
25255
25299
  named: "About to unpin message {id} in {chat}",
25256
- saved: "About to unpin message {id} in Saved Messages"
25300
+ saved: "About to unpin message {id} in Saved Messages",
25301
+ bare: "About to unpin message {id}"
25257
25302
  };
25258
25303
  var MARK_READ_HEADLINES = {
25259
25304
  named: "About to mark {chat} read up to message {id}",
25260
- saved: "About to mark Saved Messages read up to message {id}"
25305
+ saved: "About to mark Saved Messages read up to message {id}",
25306
+ bare: "About to mark messages read up to message {id}"
25261
25307
  };
25262
25308
  function actionHeadline(headlines, { kind, name }, id, values) {
25263
25309
  if (kind === "self") return { text: headlines.saved, values: { id: String(id), ...values } };
25264
- return name === null ? void 0 : { text: headlines.named, values: { id: String(id), chat: name, ...values } };
25310
+ return name === null ? { text: headlines.bare, values: { id: String(id), ...values } } : { text: headlines.named, values: { id: String(id), chat: name, ...values } };
25265
25311
  }
25266
25312
  function currentFacts({ body, media }) {
25267
- const shown = body || media?.type;
25268
- return shown ? [{ label: "Current", value: cut2(shown, MAX_VALUE_LENGTH) }] : [];
25313
+ if (body) return [{ label: "Current", value: cut2(body, MAX_VALUE_LENGTH) }];
25314
+ return media ? [{ label: "Media", value: mediaKindValue(media.type) }] : [];
25269
25315
  }
25270
25316
  function describeAction(headlines, chat, id, message, extras = {}) {
25271
25317
  const headline = actionHeadline(headlines, chat, id, extras.values ?? {});
@@ -25501,7 +25547,7 @@ var telegramMessageDelete = defineTool({
25501
25547
  "A result means Telegram deleted the message for everyone. `already` means it was gone before this call.",
25502
25548
  "A failure `uncertain` means the delete may have gone through: check the chat in Telegram and never ask for it again without the user checking."
25503
25549
  ].join(" "),
25504
- intent: "About to delete a message",
25550
+ intent: "About to delete a message for everyone",
25505
25551
  toolset: "actions",
25506
25552
  class: "administrative",
25507
25553
  input: deleteInput,
@@ -26106,12 +26152,6 @@ var FILE_TRANSLATIONS = {
26106
26152
  "About to save a file from {chat}": "{chat} \u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26107
26153
  "About to save {file}": "{file} \u3092\u4FDD\u5B58\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26108
26154
  File: "\u30D5\u30A1\u30A4\u30EB",
26109
- Photo: "\u5199\u771F",
26110
- Document: "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8",
26111
- Audio: "\u97F3\u58F0",
26112
- "Voice message": "\u30DC\u30A4\u30B9\u30E1\u30C3\u30BB\u30FC\u30B8",
26113
- Video: "\u52D5\u753B",
26114
- Sticker: "\u30B9\u30BF\u30F3\u30D7",
26115
26155
  Unpack: "\u5C55\u958B",
26116
26156
  Yes: "\u3059\u308B"
26117
26157
  }
@@ -26126,24 +26166,31 @@ var ACTION_TRANSLATIONS = {
26126
26166
  "Pin or unpin a message": "\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B\u30FB\u89E3\u9664\u3059\u308B",
26127
26167
  "Mark a chat read": "\u30C1\u30E3\u30C3\u30C8\u3092\u65E2\u8AAD\u306B\u3059\u308B",
26128
26168
  "About to edit a message": "\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u7DE8\u96C6\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26129
- "About to delete a message": "\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26169
+ "About to delete a message for everyone": "\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u5168\u54E1\u5206\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26130
26170
  "About to change a reaction": "\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26131
26171
  "About to pin or unpin a message": "\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30D4\u30F3\u7559\u3081\u3092\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26132
26172
  "About to mark messages read": "\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u65E2\u8AAD\u306B\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26133
26173
  "About to edit message {id} in {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u7DE8\u96C6\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26134
- "About to edit message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u7DE8\u96C6\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26135
- "About to delete message {id} from {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26136
- "About to delete message {id} from Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26174
+ "About to edit message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u7DE8\u96C6\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26175
+ "About to edit message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u7DE8\u96C6\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26176
+ "About to delete message {id} from {chat} for everyone": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u5168\u54E1\u5206\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26177
+ "About to delete message {id} from Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26178
+ "About to delete message {id} for everyone": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u5168\u54E1\u5206\u524A\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26137
26179
  "About to react {emoji} to message {id} in {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306B {emoji} \u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26138
- "About to react {emoji} to message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306B {emoji} \u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26180
+ "About to react {emoji} to message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306B {emoji} \u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26181
+ "About to react {emoji} to message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306B {emoji} \u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26139
26182
  "About to remove your reaction from message {id} in {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u304B\u3089\u81EA\u5206\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5916\u305D\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26140
- "About to remove your reaction from message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u304B\u3089\u81EA\u5206\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5916\u305D\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26183
+ "About to remove your reaction from message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u304B\u3089\u81EA\u5206\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5916\u305D\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26184
+ "About to remove your reaction from message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u304B\u3089\u81EA\u5206\u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u5916\u305D\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26141
26185
  "About to pin message {id} in {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u30D4\u30F3\u7559\u3081\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26142
- "About to pin message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u30D4\u30F3\u7559\u3081\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26186
+ "About to pin message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u30D4\u30F3\u7559\u3081\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26187
+ "About to pin message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u3092\u30D4\u30F3\u7559\u3081\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26143
26188
  "About to unpin message {id} in {chat}": "{chat} \u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306E\u30D4\u30F3\u7559\u3081\u3092\u89E3\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26144
- "About to unpin message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306E\u30D4\u30F3\u7559\u3081\u3092\u89E3\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26189
+ "About to unpin message {id} in Saved Messages": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306E\u30D4\u30F3\u7559\u3081\u3092\u89E3\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26190
+ "About to unpin message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u306E\u30D4\u30F3\u7559\u3081\u3092\u89E3\u9664\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26145
26191
  "About to mark {chat} read up to message {id}": "{chat} \u3092\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u307E\u3067\u65E2\u8AAD\u306B\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26146
26192
  "About to mark Saved Messages read up to message {id}": "\u4FDD\u5B58\u6E08\u307F\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u307E\u3067\u65E2\u8AAD\u306B\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26193
+ "About to mark messages read up to message {id}": "\u30E1\u30C3\u30BB\u30FC\u30B8 {id} \u307E\u3067\u65E2\u8AAD\u306B\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059",
26147
26194
  Message: "\u30E1\u30C3\u30BB\u30FC\u30B8",
26148
26195
  Current: "\u73FE\u5728\u306E\u5185\u5BB9",
26149
26196
  Replaces: "\u7F6E\u304D\u63DB\u3048\u308B\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3",
@@ -26187,6 +26234,7 @@ var SYNC_TRANSLATIONS = {
26187
26234
  var ALL_TRANSLATIONS = mergeTranslations(
26188
26235
  FACT_TRANSLATIONS,
26189
26236
  CHAT_FACT_TRANSLATIONS,
26237
+ MEDIA_FACT_TRANSLATIONS,
26190
26238
  MESSAGE_TRANSLATIONS,
26191
26239
  ACTION_TRANSLATIONS,
26192
26240
  FILE_TRANSLATIONS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftsamo/telegram-tools",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Unofficial Telegram tools for coding agents: chats, messages, received files and sends.",
5
5
  "author": "craftsamo",
6
6
  "license": "LicenseRef-AGPL-3.0-Commons-Clause",
package/plugin.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: telegram-tools
2
- version: 0.1.0
2
+ version: 0.2.0
3
3
  description: "Unofficial Telegram tools for coding agents: chats, messages, received files and sends."
4
4
  manifest_version: 1
5
5
  requires_hermes: ">=0.22"