@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/.antigravity-plugin/plugin.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/cli.js +439 -404
- package/dist/mcp.js +157 -135
- package/dist/opencode.js +196 -148
- package/package.json +1 -1
- package/plugin.yaml +1 -1
package/dist/mcp.js
CHANGED
|
@@ -29341,6 +29341,7 @@ function lockHolder(path) {
|
|
|
29341
29341
|
}
|
|
29342
29342
|
|
|
29343
29343
|
// src/core/time.ts
|
|
29344
|
+
var MS_PER_S = 1e3;
|
|
29344
29345
|
var MS_PER_MINUTE = 6e4;
|
|
29345
29346
|
var MINUTES_PER_HOUR = 60;
|
|
29346
29347
|
var localOffsetMinutes = (ms) => -new Date(ms).getTimezoneOffset();
|
|
@@ -30055,7 +30056,6 @@ async function callService(socketPath, method, params, options) {
|
|
|
30055
30056
|
// src/core/chat/live.ts
|
|
30056
30057
|
var REFRESH_TIMEOUT_MS = 12e4;
|
|
30057
30058
|
var FETCH_TIMEOUT_MS = 18e4;
|
|
30058
|
-
var MS_PER_S = 1e3;
|
|
30059
30059
|
function requestHistory(socket, params, signal) {
|
|
30060
30060
|
return callService(socket, SERVICE_REQUESTS.history, params, { effect: "read", signal });
|
|
30061
30061
|
}
|
|
@@ -30183,113 +30183,6 @@ var messageEntry = external_exports.object({
|
|
|
30183
30183
|
private_note: external_exports.string().optional()
|
|
30184
30184
|
});
|
|
30185
30185
|
|
|
30186
|
-
// src/core/chat/schema.ts
|
|
30187
|
-
var METHODS = ["list", "view", "topics", "search", "around", "fetch"];
|
|
30188
|
-
var GENERAL_TOPIC2 = 1;
|
|
30189
|
-
var LIMITS = {
|
|
30190
|
-
list: { default: 30, max: 200 },
|
|
30191
|
-
view: { default: 50, max: 300 },
|
|
30192
|
-
topics: { default: 30, max: TOPICS_LIMIT },
|
|
30193
|
-
search: { default: 30, max: 200 }
|
|
30194
|
-
};
|
|
30195
|
-
var AROUND_COUNT = { default: 5, max: AROUND_LIMIT };
|
|
30196
|
-
var FETCH_PAGES = { default: 1, max: FETCH_PAGE_LIMIT };
|
|
30197
|
-
var accountArgument = external_exports.string().optional().describe("The account label; may be left out when only one account is logged in.");
|
|
30198
|
-
var input3 = external_exports.object({
|
|
30199
|
-
method: external_exports.enum(METHODS).describe(
|
|
30200
|
-
"`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."
|
|
30201
|
-
),
|
|
30202
|
-
account: accountArgument,
|
|
30203
|
-
query: external_exports.string().optional().describe(
|
|
30204
|
-
"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."
|
|
30205
|
-
),
|
|
30206
|
-
unread: external_exports.boolean().optional().describe("list: only chats with unread messages."),
|
|
30207
|
-
last: external_exports.boolean().optional().describe("list: add each chat's newest mirrored message as `last_message`."),
|
|
30208
|
-
refresh: external_exports.boolean().optional().describe(
|
|
30209
|
-
"list: first take the chat list from Telegram (needs the sync service), then read it, and report when in `refreshed_at`."
|
|
30210
|
-
),
|
|
30211
|
-
chat: external_exports.string().optional().describe(
|
|
30212
|
-
"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."
|
|
30213
|
-
),
|
|
30214
|
-
topic: external_exports.number().int().positive().optional().describe(
|
|
30215
|
-
`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.`
|
|
30216
|
-
),
|
|
30217
|
-
after: external_exports.string().optional().describe(
|
|
30218
|
-
"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."
|
|
30219
|
-
),
|
|
30220
|
-
before: external_exports.string().optional().describe("view, search: only messages before this time (exclusive); the same forms as `after`."),
|
|
30221
|
-
limit: external_exports.number().int().optional().describe(
|
|
30222
|
-
`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.`
|
|
30223
|
-
),
|
|
30224
|
-
cursor: external_exports.string().optional().describe("The `next` of the previous result, to continue where it stopped."),
|
|
30225
|
-
id: external_exports.number().int().positive().optional().describe("around (required): the id of the message to read around."),
|
|
30226
|
-
before_count: external_exports.number().int().optional().describe(
|
|
30227
|
-
`around: how many older messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
|
|
30228
|
-
),
|
|
30229
|
-
after_count: external_exports.number().int().optional().describe(
|
|
30230
|
-
`around: how many newer messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
|
|
30231
|
-
),
|
|
30232
|
-
pages: external_exports.number().int().optional().describe(
|
|
30233
|
-
`fetch: how many pages of ${FETCH_PAGE_SIZE} older messages to add, default ${FETCH_PAGES.default}, at most ${FETCH_PAGES.max}.`
|
|
30234
|
-
)
|
|
30235
|
-
});
|
|
30236
|
-
var nameCut = external_exports.literal(true).optional().describe("Set when the name was longer than the most a result carries and was cut.");
|
|
30237
|
-
var chatEntry2 = external_exports.object({
|
|
30238
|
-
id: external_exports.string().describe("The chat id: Telegram's signed id as text, such as `123456789` or `-1001234567890`."),
|
|
30239
|
-
kind: external_exports.enum(CHAT_KINDS).describe("`self` is Saved Messages."),
|
|
30240
|
-
name: external_exports.string().nullable().describe("The person's or chat's name; null when none is known."),
|
|
30241
|
-
name_cut: nameCut,
|
|
30242
|
-
username: external_exports.string().optional(),
|
|
30243
|
-
mirrored: external_exports.boolean().describe("Whether the mirror keeps this chat's messages."),
|
|
30244
|
-
unread: external_exports.number().int().describe("Incoming messages not read yet."),
|
|
30245
|
-
last_activity_at: localTimeSchema.nullable().describe("The latest message's time, in local time with offset; null when none is known."),
|
|
30246
|
-
forum: external_exports.literal(true).optional().describe("Set for a supergroup with topics."),
|
|
30247
|
-
archived: external_exports.literal(true).optional(),
|
|
30248
|
-
left: external_exports.literal(true).optional().describe("Set for a group or channel the user has left or been removed from."),
|
|
30249
|
-
can_send: external_exports.literal(false).optional().describe("Set when the user is known not to be able to write here."),
|
|
30250
|
-
auto_delete_seconds: external_exports.number().int().optional().describe("The chat's auto-delete period, when on."),
|
|
30251
|
-
last_message: messageEntry.nullable().optional().describe("With `last`: the newest mirrored message of the chat, or null when none is mirrored.")
|
|
30252
|
-
});
|
|
30253
|
-
var topicEntry = external_exports.object({
|
|
30254
|
-
id: external_exports.number().int().describe(`The topic id, to pass as \`topic\` to \`view\`; ${GENERAL_TOPIC2} is the General topic.`),
|
|
30255
|
-
title: external_exports.string().nullable().describe("The topic's title; null when none is known."),
|
|
30256
|
-
closed: external_exports.literal(true).optional().describe("Set for a topic that is closed."),
|
|
30257
|
-
pinned: external_exports.literal(true).optional().describe("Set for a topic that is pinned."),
|
|
30258
|
-
unread: external_exports.number().int().describe("Messages in it not read yet."),
|
|
30259
|
-
last_activity_at: localTimeSchema.nullable().describe("The newest message's time, in local time with offset; null when none is known.")
|
|
30260
|
-
});
|
|
30261
|
-
var output3 = external_exports.object({
|
|
30262
|
-
chats: external_exports.array(chatEntry2).optional().describe("list: the chats, newest activity first."),
|
|
30263
|
-
refreshed_at: localTimeSchema.optional().describe("list with `refresh`: when the chat list was taken from Telegram, in local time with offset."),
|
|
30264
|
-
chat: chatEntry2.optional().describe("view, topics, around, fetch: the chat read."),
|
|
30265
|
-
messages: external_exports.array(messageEntry).optional().describe("view, around: the messages, oldest first. search: the hits, newest first."),
|
|
30266
|
-
live: external_exports.literal(true).optional().describe(
|
|
30267
|
-
"view, around: set when the chat is not mirrored, so the messages were read from Telegram and stored nowhere."
|
|
30268
|
-
),
|
|
30269
|
-
topics: external_exports.array(topicEntry).optional().describe("topics: the topics, most recently active first."),
|
|
30270
|
-
anchor: external_exports.number().int().optional().describe("around: the id of the message read around, among `messages`."),
|
|
30271
|
-
trimmed_before: external_exports.number().int().optional().describe(
|
|
30272
|
-
"around: how many older messages were left out, farthest first, to keep the result a size that can be read."
|
|
30273
|
-
),
|
|
30274
|
-
trimmed_after: external_exports.number().int().optional().describe(
|
|
30275
|
-
"around: how many newer messages were left out, farthest first, to keep the result a size that can be read."
|
|
30276
|
-
),
|
|
30277
|
-
scanned_to: localTimeSchema.optional().describe(
|
|
30278
|
-
"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."
|
|
30279
|
-
),
|
|
30280
|
-
scope: external_exports.string().optional().describe("search: what the search covers and what it does not."),
|
|
30281
|
-
fetched: external_exports.object({
|
|
30282
|
-
added: external_exports.number().int().describe("How many messages the mirror gained."),
|
|
30283
|
-
pages: external_exports.number().int().describe("How many pages were read."),
|
|
30284
|
-
complete: external_exports.boolean().describe("Whether Telegram has nothing older for this chat."),
|
|
30285
|
-
oldest_at: localTimeSchema.nullable().describe(
|
|
30286
|
-
"The time of the oldest message the mirror now holds of this chat, in local time with offset; null when none."
|
|
30287
|
-
)
|
|
30288
|
-
}).optional().describe("fetch: what the history fetch stored."),
|
|
30289
|
-
next: external_exports.string().optional().describe("Pass back as `cursor` to continue; absent when there is no more."),
|
|
30290
|
-
note: external_exports.string().describe("Says that what the result carries is data written by other people.")
|
|
30291
|
-
});
|
|
30292
|
-
|
|
30293
30186
|
// src/core/chat/message-rows.ts
|
|
30294
30187
|
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";
|
|
30295
30188
|
function liveMessages(now) {
|
|
@@ -30297,7 +30190,7 @@ function liveMessages(now) {
|
|
|
30297
30190
|
}
|
|
30298
30191
|
function inTopic(topic) {
|
|
30299
30192
|
return {
|
|
30300
|
-
condition: topic ===
|
|
30193
|
+
condition: topic === GENERAL_TOPIC ? "(topic IS NULL OR topic = ?)" : "topic = ?",
|
|
30301
30194
|
params: [topic]
|
|
30302
30195
|
};
|
|
30303
30196
|
}
|
|
@@ -30522,6 +30415,112 @@ var cuttableMessage = {
|
|
|
30522
30415
|
drop: dropMetadata
|
|
30523
30416
|
};
|
|
30524
30417
|
|
|
30418
|
+
// src/core/chat/schema.ts
|
|
30419
|
+
var METHODS = ["list", "view", "topics", "search", "around", "fetch"];
|
|
30420
|
+
var LIMITS = {
|
|
30421
|
+
list: { default: 30, max: 200 },
|
|
30422
|
+
view: { default: 50, max: 300 },
|
|
30423
|
+
topics: { default: 30, max: TOPICS_LIMIT },
|
|
30424
|
+
search: { default: 30, max: 200 }
|
|
30425
|
+
};
|
|
30426
|
+
var AROUND_COUNT = { default: 5, max: AROUND_LIMIT };
|
|
30427
|
+
var FETCH_PAGES = { default: 1, max: FETCH_PAGE_LIMIT };
|
|
30428
|
+
var accountArgument = external_exports.string().optional().describe("The account label; may be left out when only one account is logged in.");
|
|
30429
|
+
var input3 = external_exports.object({
|
|
30430
|
+
method: external_exports.enum(METHODS).describe(
|
|
30431
|
+
"`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."
|
|
30432
|
+
),
|
|
30433
|
+
account: accountArgument,
|
|
30434
|
+
query: external_exports.string().optional().describe(
|
|
30435
|
+
"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."
|
|
30436
|
+
),
|
|
30437
|
+
unread: external_exports.boolean().optional().describe("list: only chats with unread messages."),
|
|
30438
|
+
last: external_exports.boolean().optional().describe("list: add each chat's newest mirrored message as `last_message`."),
|
|
30439
|
+
refresh: external_exports.boolean().optional().describe(
|
|
30440
|
+
"list: first take the chat list from Telegram (needs the sync service), then read it, and report when in `refreshed_at`."
|
|
30441
|
+
),
|
|
30442
|
+
chat: external_exports.string().optional().describe(
|
|
30443
|
+
"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."
|
|
30444
|
+
),
|
|
30445
|
+
topic: external_exports.number().int().positive().optional().describe(
|
|
30446
|
+
`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.`
|
|
30447
|
+
),
|
|
30448
|
+
after: external_exports.string().optional().describe(
|
|
30449
|
+
"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."
|
|
30450
|
+
),
|
|
30451
|
+
before: external_exports.string().optional().describe("view, search: only messages before this time (exclusive); the same forms as `after`."),
|
|
30452
|
+
limit: external_exports.number().int().optional().describe(
|
|
30453
|
+
`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.`
|
|
30454
|
+
),
|
|
30455
|
+
cursor: external_exports.string().optional().describe("The `next` of the previous result, to continue where it stopped."),
|
|
30456
|
+
id: external_exports.number().int().positive().optional().describe("around (required): the id of the message to read around."),
|
|
30457
|
+
before_count: external_exports.number().int().optional().describe(
|
|
30458
|
+
`around: how many older messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
|
|
30459
|
+
),
|
|
30460
|
+
after_count: external_exports.number().int().optional().describe(
|
|
30461
|
+
`around: how many newer messages to return, default ${AROUND_COUNT.default}, at most ${AROUND_COUNT.max}; 0 asks for none.`
|
|
30462
|
+
),
|
|
30463
|
+
pages: external_exports.number().int().optional().describe(
|
|
30464
|
+
`fetch: how many pages of ${FETCH_PAGE_SIZE} older messages to add, default ${FETCH_PAGES.default}, at most ${FETCH_PAGES.max}.`
|
|
30465
|
+
)
|
|
30466
|
+
});
|
|
30467
|
+
var nameCut = external_exports.literal(true).optional().describe("Set when the name was longer than the most a result carries and was cut.");
|
|
30468
|
+
var chatEntry2 = external_exports.object({
|
|
30469
|
+
id: external_exports.string().describe("The chat id: Telegram's signed id as text, such as `123456789` or `-1001234567890`."),
|
|
30470
|
+
kind: external_exports.enum(CHAT_KINDS).describe("`self` is Saved Messages."),
|
|
30471
|
+
name: external_exports.string().nullable().describe("The person's or chat's name; null when none is known."),
|
|
30472
|
+
name_cut: nameCut,
|
|
30473
|
+
username: external_exports.string().optional(),
|
|
30474
|
+
mirrored: external_exports.boolean().describe("Whether the mirror keeps this chat's messages."),
|
|
30475
|
+
unread: external_exports.number().int().describe("Incoming messages not read yet."),
|
|
30476
|
+
last_activity_at: localTimeSchema.nullable().describe("The latest message's time, in local time with offset; null when none is known."),
|
|
30477
|
+
forum: external_exports.literal(true).optional().describe("Set for a supergroup with topics."),
|
|
30478
|
+
archived: external_exports.literal(true).optional(),
|
|
30479
|
+
left: external_exports.literal(true).optional().describe("Set for a group or channel the user has left or been removed from."),
|
|
30480
|
+
can_send: external_exports.literal(false).optional().describe("Set when the user is known not to be able to write here."),
|
|
30481
|
+
auto_delete_seconds: external_exports.number().int().optional().describe("The chat's auto-delete period, when on."),
|
|
30482
|
+
last_message: messageEntry.nullable().optional().describe("With `last`: the newest mirrored message of the chat, or null when none is mirrored.")
|
|
30483
|
+
});
|
|
30484
|
+
var topicEntry = external_exports.object({
|
|
30485
|
+
id: external_exports.number().int().describe(`The topic id, to pass as \`topic\` to \`view\`; ${GENERAL_TOPIC} is the General topic.`),
|
|
30486
|
+
title: external_exports.string().nullable().describe("The topic's title; null when none is known."),
|
|
30487
|
+
closed: external_exports.literal(true).optional().describe("Set for a topic that is closed."),
|
|
30488
|
+
pinned: external_exports.literal(true).optional().describe("Set for a topic that is pinned."),
|
|
30489
|
+
unread: external_exports.number().int().describe("Messages in it not read yet."),
|
|
30490
|
+
last_activity_at: localTimeSchema.nullable().describe("The newest message's time, in local time with offset; null when none is known.")
|
|
30491
|
+
});
|
|
30492
|
+
var output3 = external_exports.object({
|
|
30493
|
+
chats: external_exports.array(chatEntry2).optional().describe("list: the chats, newest activity first."),
|
|
30494
|
+
refreshed_at: localTimeSchema.optional().describe("list with `refresh`: when the chat list was taken from Telegram, in local time with offset."),
|
|
30495
|
+
chat: chatEntry2.optional().describe("view, topics, around, fetch: the chat read."),
|
|
30496
|
+
messages: external_exports.array(messageEntry).optional().describe("view, around: the messages, oldest first. search: the hits, newest first."),
|
|
30497
|
+
live: external_exports.literal(true).optional().describe(
|
|
30498
|
+
"view, around: set when the chat is not mirrored, so the messages were read from Telegram and stored nowhere."
|
|
30499
|
+
),
|
|
30500
|
+
topics: external_exports.array(topicEntry).optional().describe("topics: the topics, most recently active first."),
|
|
30501
|
+
anchor: external_exports.number().int().optional().describe("around: the id of the message read around, among `messages`."),
|
|
30502
|
+
trimmed_before: external_exports.number().int().optional().describe(
|
|
30503
|
+
"around: how many older messages were left out, farthest first, to keep the result a size that can be read."
|
|
30504
|
+
),
|
|
30505
|
+
trimmed_after: external_exports.number().int().optional().describe(
|
|
30506
|
+
"around: how many newer messages were left out, farthest first, to keep the result a size that can be read."
|
|
30507
|
+
),
|
|
30508
|
+
scanned_to: localTimeSchema.optional().describe(
|
|
30509
|
+
"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."
|
|
30510
|
+
),
|
|
30511
|
+
scope: external_exports.string().optional().describe("search: what the search covers and what it does not."),
|
|
30512
|
+
fetched: external_exports.object({
|
|
30513
|
+
added: external_exports.number().int().describe("How many messages the mirror gained."),
|
|
30514
|
+
pages: external_exports.number().int().describe("How many pages were read."),
|
|
30515
|
+
complete: external_exports.boolean().describe("Whether Telegram has nothing older for this chat."),
|
|
30516
|
+
oldest_at: localTimeSchema.nullable().describe(
|
|
30517
|
+
"The time of the oldest message the mirror now holds of this chat, in local time with offset; null when none."
|
|
30518
|
+
)
|
|
30519
|
+
}).optional().describe("fetch: what the history fetch stored."),
|
|
30520
|
+
next: external_exports.string().optional().describe("Pass back as `cursor` to continue; absent when there is no more."),
|
|
30521
|
+
note: external_exports.string().describe("Says that what the result carries is data written by other people.")
|
|
30522
|
+
});
|
|
30523
|
+
|
|
30525
30524
|
// src/core/chat/around.ts
|
|
30526
30525
|
var TRIMMED_RESERVE = 100;
|
|
30527
30526
|
var NO_MESSAGE = "No message with this id in this chat.";
|
|
@@ -30724,7 +30723,7 @@ function listChats(mirror, args, now) {
|
|
|
30724
30723
|
return result;
|
|
30725
30724
|
}
|
|
30726
30725
|
|
|
30727
|
-
// src/core/
|
|
30726
|
+
// src/core/open.ts
|
|
30728
30727
|
async function pickPaths(ctx, account2) {
|
|
30729
30728
|
if (!ctx.stateDir) throw new ToolError("internal_error", "The entry point did not supply a state directory.");
|
|
30730
30729
|
return pickLabel(ctx.stateDir, account2);
|
|
@@ -31133,6 +31132,32 @@ function chatFact(kind) {
|
|
|
31133
31132
|
return { label: "Chat", value: { text: CHAT_KIND_WORDS[kind] } };
|
|
31134
31133
|
}
|
|
31135
31134
|
|
|
31135
|
+
// src/core/chat/media-facts.ts
|
|
31136
|
+
var MEDIA_KIND_WORDS = {
|
|
31137
|
+
photo: "Photo",
|
|
31138
|
+
document: "Document",
|
|
31139
|
+
audio: "Audio",
|
|
31140
|
+
voice: "Voice message",
|
|
31141
|
+
video: "Video",
|
|
31142
|
+
sticker: "Sticker",
|
|
31143
|
+
dice: "Dice",
|
|
31144
|
+
contact: "Contact",
|
|
31145
|
+
venue: "Venue",
|
|
31146
|
+
geo: "Location",
|
|
31147
|
+
geo_live: "Live location",
|
|
31148
|
+
game: "Game",
|
|
31149
|
+
invoice: "Invoice",
|
|
31150
|
+
webpage: "Link preview",
|
|
31151
|
+
poll: "Poll",
|
|
31152
|
+
todo: "Checklist",
|
|
31153
|
+
story: "Story",
|
|
31154
|
+
paid: "Paid media",
|
|
31155
|
+
unsupported: "Unsupported media"
|
|
31156
|
+
};
|
|
31157
|
+
function mediaKindValue(type) {
|
|
31158
|
+
return Object.hasOwn(MEDIA_KIND_WORDS, type) ? { text: MEDIA_KIND_WORDS[type] } : type;
|
|
31159
|
+
}
|
|
31160
|
+
|
|
31136
31161
|
// src/core/file/constants.ts
|
|
31137
31162
|
var FILE_SAVE_TOOL_ID = "telegram_file_save";
|
|
31138
31163
|
var FILE_SEND_TOOL_ID = "telegram_file_send";
|
|
@@ -33055,14 +33080,6 @@ function namesOf(file2, id) {
|
|
|
33055
33080
|
const name = safeFileName(file2.name, { kind: file2.kind, id, type: file2.type });
|
|
33056
33081
|
return { name, shown: file2.name === null ? file2.kind : name };
|
|
33057
33082
|
}
|
|
33058
|
-
var FILE_KIND_WORDS = {
|
|
33059
|
-
photo: "Photo",
|
|
33060
|
-
document: "Document",
|
|
33061
|
-
audio: "Audio",
|
|
33062
|
-
voice: "Voice message",
|
|
33063
|
-
video: "Video",
|
|
33064
|
-
sticker: "Sticker"
|
|
33065
|
-
};
|
|
33066
33083
|
function saveHeadline(file2, chat) {
|
|
33067
33084
|
if (file2 !== void 0 && chat !== null) return { text: "About to save {file} from {chat}", values: { file: file2, chat } };
|
|
33068
33085
|
if (chat !== null) return { text: "About to save a file from {chat}", values: { chat } };
|
|
@@ -33070,9 +33087,8 @@ function saveHeadline(file2, chat) {
|
|
|
33070
33087
|
return void 0;
|
|
33071
33088
|
}
|
|
33072
33089
|
function fileFacts(media, unpack) {
|
|
33073
|
-
const kind = media && Object.hasOwn(FILE_KIND_WORDS, media.type) ? FILE_KIND_WORDS[media.type] : void 0;
|
|
33074
33090
|
return [
|
|
33075
|
-
...media ? [{ label: "File", value:
|
|
33091
|
+
...media ? [{ label: "File", value: mediaKindValue(media.type) }] : [],
|
|
33076
33092
|
...unpack ? [{ label: "Unpack", value: { text: "Yes" } }] : [],
|
|
33077
33093
|
...media?.size !== void 0 && Number.isSafeInteger(media.size) && media.size > 0 ? [sizeFact(media.size)] : []
|
|
33078
33094
|
];
|
|
@@ -33587,9 +33603,8 @@ async function checkArchive(path, format, limits, signal) {
|
|
|
33587
33603
|
}
|
|
33588
33604
|
|
|
33589
33605
|
// src/core/outgoing/limits.ts
|
|
33590
|
-
var BYTES_PER_MB2 = 1024 * 1024;
|
|
33591
33606
|
var MAX_FILES = 10;
|
|
33592
|
-
var MAX_TOTAL_BYTES = 100 *
|
|
33607
|
+
var MAX_TOTAL_BYTES = 100 * BYTES_PER_MB;
|
|
33593
33608
|
|
|
33594
33609
|
// src/core/file/send/constants.ts
|
|
33595
33610
|
var SEND_FILES_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
@@ -34164,39 +34179,46 @@ var telegramFileSend = createFileSend();
|
|
|
34164
34179
|
// src/core/message/action-describe.ts
|
|
34165
34180
|
var EDIT_HEADLINES = {
|
|
34166
34181
|
named: "About to edit message {id} in {chat}",
|
|
34167
|
-
saved: "About to edit message {id} in Saved Messages"
|
|
34182
|
+
saved: "About to edit message {id} in Saved Messages",
|
|
34183
|
+
bare: "About to edit message {id}"
|
|
34168
34184
|
};
|
|
34169
34185
|
var DELETE_HEADLINES = {
|
|
34170
|
-
named: "About to delete message {id} from {chat}",
|
|
34171
|
-
saved: "About to delete message {id} from Saved Messages"
|
|
34186
|
+
named: "About to delete message {id} from {chat} for everyone",
|
|
34187
|
+
saved: "About to delete message {id} from Saved Messages",
|
|
34188
|
+
bare: "About to delete message {id} for everyone"
|
|
34172
34189
|
};
|
|
34173
34190
|
var REACT_HEADLINES = {
|
|
34174
34191
|
named: "About to react {emoji} to message {id} in {chat}",
|
|
34175
|
-
saved: "About to react {emoji} to message {id} in Saved Messages"
|
|
34192
|
+
saved: "About to react {emoji} to message {id} in Saved Messages",
|
|
34193
|
+
bare: "About to react {emoji} to message {id}"
|
|
34176
34194
|
};
|
|
34177
34195
|
var UNREACT_HEADLINES = {
|
|
34178
34196
|
named: "About to remove your reaction from message {id} in {chat}",
|
|
34179
|
-
saved: "About to remove your reaction from message {id} in Saved Messages"
|
|
34197
|
+
saved: "About to remove your reaction from message {id} in Saved Messages",
|
|
34198
|
+
bare: "About to remove your reaction from message {id}"
|
|
34180
34199
|
};
|
|
34181
34200
|
var PIN_HEADLINES = {
|
|
34182
34201
|
named: "About to pin message {id} in {chat}",
|
|
34183
|
-
saved: "About to pin message {id} in Saved Messages"
|
|
34202
|
+
saved: "About to pin message {id} in Saved Messages",
|
|
34203
|
+
bare: "About to pin message {id}"
|
|
34184
34204
|
};
|
|
34185
34205
|
var UNPIN_HEADLINES = {
|
|
34186
34206
|
named: "About to unpin message {id} in {chat}",
|
|
34187
|
-
saved: "About to unpin message {id} in Saved Messages"
|
|
34207
|
+
saved: "About to unpin message {id} in Saved Messages",
|
|
34208
|
+
bare: "About to unpin message {id}"
|
|
34188
34209
|
};
|
|
34189
34210
|
var MARK_READ_HEADLINES = {
|
|
34190
34211
|
named: "About to mark {chat} read up to message {id}",
|
|
34191
|
-
saved: "About to mark Saved Messages read up to message {id}"
|
|
34212
|
+
saved: "About to mark Saved Messages read up to message {id}",
|
|
34213
|
+
bare: "About to mark messages read up to message {id}"
|
|
34192
34214
|
};
|
|
34193
34215
|
function actionHeadline(headlines, { kind, name }, id, values) {
|
|
34194
34216
|
if (kind === "self") return { text: headlines.saved, values: { id: String(id), ...values } };
|
|
34195
|
-
return name === null ?
|
|
34217
|
+
return name === null ? { text: headlines.bare, values: { id: String(id), ...values } } : { text: headlines.named, values: { id: String(id), chat: name, ...values } };
|
|
34196
34218
|
}
|
|
34197
34219
|
function currentFacts({ body, media }) {
|
|
34198
|
-
|
|
34199
|
-
return
|
|
34220
|
+
if (body) return [{ label: "Current", value: cut(body, MAX_VALUE_LENGTH) }];
|
|
34221
|
+
return media ? [{ label: "Media", value: mediaKindValue(media.type) }] : [];
|
|
34200
34222
|
}
|
|
34201
34223
|
function describeAction(headlines, chat, id, message, extras = {}) {
|
|
34202
34224
|
const headline = actionHeadline(headlines, chat, id, extras.values ?? {});
|
|
@@ -34432,7 +34454,7 @@ var telegramMessageDelete = defineTool({
|
|
|
34432
34454
|
"A result means Telegram deleted the message for everyone. `already` means it was gone before this call.",
|
|
34433
34455
|
"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."
|
|
34434
34456
|
].join(" "),
|
|
34435
|
-
intent: "About to delete a message",
|
|
34457
|
+
intent: "About to delete a message for everyone",
|
|
34436
34458
|
toolset: "actions",
|
|
34437
34459
|
class: "administrative",
|
|
34438
34460
|
input: deleteInput,
|
|
@@ -36853,7 +36875,7 @@ async function main() {
|
|
|
36853
36875
|
const settings = parseSettings(process.argv.slice(2), process.env);
|
|
36854
36876
|
server = createServer(ALL_TOOLS, settings, {
|
|
36855
36877
|
ownDir: packageRoot(import.meta.url),
|
|
36856
|
-
version: true ? "0.
|
|
36878
|
+
version: true ? "0.2.0" : void 0
|
|
36857
36879
|
});
|
|
36858
36880
|
} catch (error62) {
|
|
36859
36881
|
if (!isToolError(error62)) throw error62;
|