teleton 0.2.0 → 0.2.2
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/README.md +8 -0
- package/dist/{chunk-QVTQORZB.js → chunk-ZZHZSPHQ.js} +510 -363
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -397,6 +397,14 @@ Contributions are welcome.
|
|
|
397
397
|
|
|
398
398
|
---
|
|
399
399
|
|
|
400
|
+
## Contributors
|
|
401
|
+
|
|
402
|
+
<a href="https://github.com/TONresistor/teleton-agent/graphs/contributors">
|
|
403
|
+
<img src="https://contrib.rocks/image?repo=TONresistor/teleton-agent" />
|
|
404
|
+
</a>
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
400
408
|
## License
|
|
401
409
|
|
|
402
410
|
MIT License - See [LICENSE](LICENSE) for details.
|
|
@@ -2124,8 +2124,8 @@ function sanitizeSchema(schema) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
return result;
|
|
2126
2126
|
}
|
|
2127
|
-
function sanitizeToolsForGemini(
|
|
2128
|
-
return
|
|
2127
|
+
function sanitizeToolsForGemini(tools23) {
|
|
2128
|
+
return tools23.map(
|
|
2129
2129
|
(tool) => ({
|
|
2130
2130
|
...tool,
|
|
2131
2131
|
parameters: sanitizeSchema({ ...tool.parameters })
|
|
@@ -2170,11 +2170,11 @@ function getUtilityModel(provider, overrideModel) {
|
|
|
2170
2170
|
async function chatWithContext(config, options) {
|
|
2171
2171
|
const provider = config.provider || "anthropic";
|
|
2172
2172
|
const model = getProviderModel(provider, config.model);
|
|
2173
|
-
const
|
|
2173
|
+
const tools23 = provider === "google" && options.tools ? sanitizeToolsForGemini(options.tools) : options.tools;
|
|
2174
2174
|
const context = {
|
|
2175
2175
|
...options.context,
|
|
2176
2176
|
systemPrompt: options.systemPrompt || options.context.systemPrompt,
|
|
2177
|
-
tools
|
|
2177
|
+
tools: tools23
|
|
2178
2178
|
};
|
|
2179
2179
|
const response = await complete(model, context, {
|
|
2180
2180
|
apiKey: config.api_key,
|
|
@@ -3405,7 +3405,7 @@ ${statsContext}`;
|
|
|
3405
3405
|
const providerMeta = getProviderMetadata(
|
|
3406
3406
|
this.config.agent.provider || "anthropic"
|
|
3407
3407
|
);
|
|
3408
|
-
const
|
|
3408
|
+
const tools23 = this.toolRegistry?.getForContext(isGroup ?? false, providerMeta.toolLimit);
|
|
3409
3409
|
const maxIterations = this.config.agent.max_agentic_iterations || 5;
|
|
3410
3410
|
let iteration = 0;
|
|
3411
3411
|
let overflowResets = 0;
|
|
@@ -3428,7 +3428,7 @@ ${statsContext}`;
|
|
|
3428
3428
|
context: maskedContext,
|
|
3429
3429
|
sessionId: session.sessionId,
|
|
3430
3430
|
persistTranscript: true,
|
|
3431
|
-
tools
|
|
3431
|
+
tools: tools23
|
|
3432
3432
|
});
|
|
3433
3433
|
const assistantMsg = response2.message;
|
|
3434
3434
|
if (assistantMsg.stopReason === "error") {
|
|
@@ -4043,6 +4043,7 @@ import { Api as Api2 } from "telegram";
|
|
|
4043
4043
|
var TelegramBridge = class {
|
|
4044
4044
|
client;
|
|
4045
4045
|
ownUserId;
|
|
4046
|
+
ownUsername;
|
|
4046
4047
|
peerCache = /* @__PURE__ */ new Map();
|
|
4047
4048
|
constructor(config) {
|
|
4048
4049
|
this.client = new TelegramUserClient(config);
|
|
@@ -4055,6 +4056,7 @@ var TelegramBridge = class {
|
|
|
4055
4056
|
const me = this.client.getMe();
|
|
4056
4057
|
if (me) {
|
|
4057
4058
|
this.ownUserId = me.id;
|
|
4059
|
+
this.ownUsername = me.username?.toLowerCase();
|
|
4058
4060
|
}
|
|
4059
4061
|
try {
|
|
4060
4062
|
await this.getDialogs();
|
|
@@ -4092,7 +4094,8 @@ var TelegramBridge = class {
|
|
|
4092
4094
|
*/
|
|
4093
4095
|
async getMessages(chatId, limit = 50) {
|
|
4094
4096
|
try {
|
|
4095
|
-
const
|
|
4097
|
+
const peer = this.peerCache.get(chatId) || chatId;
|
|
4098
|
+
const messages = await this.client.getMessages(peer, { limit });
|
|
4096
4099
|
return await Promise.all(messages.map((msg) => this.parseMessage(msg)));
|
|
4097
4100
|
} catch (error) {
|
|
4098
4101
|
console.error("Error getting messages:", error);
|
|
@@ -4251,7 +4254,10 @@ var TelegramBridge = class {
|
|
|
4251
4254
|
const chatId = msg.chatId?.toString() ?? msg.peerId?.toString() ?? "unknown";
|
|
4252
4255
|
const senderIdBig = msg.senderId ? BigInt(msg.senderId.toString()) : BigInt(0);
|
|
4253
4256
|
const senderId = Number(senderIdBig);
|
|
4254
|
-
|
|
4257
|
+
let mentionsMe = msg.mentioned ?? false;
|
|
4258
|
+
if (!mentionsMe && this.ownUsername && msg.message) {
|
|
4259
|
+
mentionsMe = msg.message.toLowerCase().includes(`@${this.ownUsername}`);
|
|
4260
|
+
}
|
|
4255
4261
|
const isChannel = msg.post ?? false;
|
|
4256
4262
|
const isGroup = !isChannel && chatId.startsWith("-");
|
|
4257
4263
|
if (msg.peerId) {
|
|
@@ -4321,6 +4327,12 @@ var TelegramBridge = class {
|
|
|
4321
4327
|
// Store raw message only if has media (for download)
|
|
4322
4328
|
};
|
|
4323
4329
|
}
|
|
4330
|
+
/**
|
|
4331
|
+
* Get cached peer entity for a chat ID (if available)
|
|
4332
|
+
*/
|
|
4333
|
+
getPeer(chatId) {
|
|
4334
|
+
return this.peerCache.get(chatId);
|
|
4335
|
+
}
|
|
4324
4336
|
/**
|
|
4325
4337
|
* Get the underlying client
|
|
4326
4338
|
*/
|
|
@@ -4690,6 +4702,11 @@ var MessageHandler = class {
|
|
|
4690
4702
|
}
|
|
4691
4703
|
const releaseLock = await this.chatLock.acquire(message.chatId);
|
|
4692
4704
|
try {
|
|
4705
|
+
const postLockOffset = readOffset(message.chatId) ?? 0;
|
|
4706
|
+
if (message.id <= postLockOffset) {
|
|
4707
|
+
verbose(`Skipping message ${message.id} (already processed after lock)`);
|
|
4708
|
+
return;
|
|
4709
|
+
}
|
|
4693
4710
|
if (this.config.typing_simulation) {
|
|
4694
4711
|
await this.bridge.setTyping(message.chatId);
|
|
4695
4712
|
}
|
|
@@ -6188,6 +6205,20 @@ var telegramGetRepliesExecutor = async (params, context) => {
|
|
|
6188
6205
|
}
|
|
6189
6206
|
};
|
|
6190
6207
|
|
|
6208
|
+
// src/agent/tools/telegram/messaging/index.ts
|
|
6209
|
+
var tools = [
|
|
6210
|
+
{ tool: telegramSendMessageTool, executor: telegramSendMessageExecutor },
|
|
6211
|
+
{ tool: telegramQuoteReplyTool, executor: telegramQuoteReplyExecutor },
|
|
6212
|
+
{ tool: telegramGetRepliesTool, executor: telegramGetRepliesExecutor },
|
|
6213
|
+
{ tool: telegramEditMessageTool, executor: telegramEditMessageExecutor },
|
|
6214
|
+
{ tool: telegramScheduleMessageTool, executor: telegramScheduleMessageExecutor },
|
|
6215
|
+
{ tool: telegramSearchMessagesTool, executor: telegramSearchMessagesExecutor },
|
|
6216
|
+
{ tool: telegramPinMessageTool, executor: telegramPinMessageExecutor },
|
|
6217
|
+
{ tool: telegramUnpinMessageTool, executor: telegramUnpinMessageExecutor },
|
|
6218
|
+
{ tool: telegramForwardMessageTool, executor: telegramForwardMessageExecutor },
|
|
6219
|
+
{ tool: telegramDeleteMessageTool, executor: telegramDeleteMessageExecutor }
|
|
6220
|
+
];
|
|
6221
|
+
|
|
6191
6222
|
// src/agent/tools/telegram/media/send-photo.ts
|
|
6192
6223
|
import { Type as Type10 } from "@sinclair/typebox";
|
|
6193
6224
|
var telegramSendPhotoTool = {
|
|
@@ -7325,6 +7356,16 @@ var visionAnalyzeExecutor = async (params, context) => {
|
|
|
7325
7356
|
}
|
|
7326
7357
|
};
|
|
7327
7358
|
|
|
7359
|
+
// src/agent/tools/telegram/media/index.ts
|
|
7360
|
+
var tools2 = [
|
|
7361
|
+
{ tool: telegramSendPhotoTool, executor: telegramSendPhotoExecutor },
|
|
7362
|
+
{ tool: telegramSendVoiceTool, executor: telegramSendVoiceExecutor },
|
|
7363
|
+
{ tool: telegramSendStickerTool, executor: telegramSendStickerExecutor },
|
|
7364
|
+
{ tool: telegramSendGifTool, executor: telegramSendGifExecutor },
|
|
7365
|
+
{ tool: telegramDownloadMediaTool, executor: telegramDownloadMediaExecutor },
|
|
7366
|
+
{ tool: visionAnalyzeTool, executor: visionAnalyzeExecutor }
|
|
7367
|
+
];
|
|
7368
|
+
|
|
7328
7369
|
// src/agent/tools/telegram/chats/get-dialogs.ts
|
|
7329
7370
|
import { Type as Type16 } from "@sinclair/typebox";
|
|
7330
7371
|
var telegramGetDialogsTool = {
|
|
@@ -7420,7 +7461,8 @@ var telegramGetHistoryExecutor = async (params, context) => {
|
|
|
7420
7461
|
try {
|
|
7421
7462
|
const { chatId, limit = 50, offsetId } = params;
|
|
7422
7463
|
const gramJsClient = context.bridge.getClient().getClient();
|
|
7423
|
-
const
|
|
7464
|
+
const entity = context.bridge.getPeer(chatId) || chatId;
|
|
7465
|
+
const messages = await gramJsClient.getMessages(entity, {
|
|
7424
7466
|
limit,
|
|
7425
7467
|
offsetId
|
|
7426
7468
|
});
|
|
@@ -8062,6 +8104,27 @@ var telegramInviteToChannelExecutor = async (params, context) => {
|
|
|
8062
8104
|
}
|
|
8063
8105
|
};
|
|
8064
8106
|
|
|
8107
|
+
// src/agent/tools/telegram/chats/index.ts
|
|
8108
|
+
var tools3 = [
|
|
8109
|
+
{ tool: telegramGetDialogsTool, executor: telegramGetDialogsExecutor },
|
|
8110
|
+
{ tool: telegramGetHistoryTool, executor: telegramGetHistoryExecutor },
|
|
8111
|
+
{ tool: telegramGetChatInfoTool, executor: telegramGetChatInfoExecutor },
|
|
8112
|
+
{ tool: telegramMarkAsReadTool, executor: telegramMarkAsReadExecutor },
|
|
8113
|
+
{ tool: telegramJoinChannelTool, executor: telegramJoinChannelExecutor, scope: "dm-only" },
|
|
8114
|
+
{ tool: telegramLeaveChannelTool, executor: telegramLeaveChannelExecutor, scope: "dm-only" },
|
|
8115
|
+
{ tool: telegramCreateChannelTool, executor: telegramCreateChannelExecutor, scope: "dm-only" },
|
|
8116
|
+
{
|
|
8117
|
+
tool: telegramEditChannelInfoTool,
|
|
8118
|
+
executor: telegramEditChannelInfoExecutor,
|
|
8119
|
+
scope: "dm-only"
|
|
8120
|
+
},
|
|
8121
|
+
{
|
|
8122
|
+
tool: telegramInviteToChannelTool,
|
|
8123
|
+
executor: telegramInviteToChannelExecutor,
|
|
8124
|
+
scope: "dm-only"
|
|
8125
|
+
}
|
|
8126
|
+
];
|
|
8127
|
+
|
|
8065
8128
|
// src/agent/tools/telegram/groups/get-me.ts
|
|
8066
8129
|
import { Type as Type25 } from "@sinclair/typebox";
|
|
8067
8130
|
var telegramGetMeTool = {
|
|
@@ -8581,6 +8644,17 @@ var CustomFile = class {
|
|
|
8581
8644
|
}
|
|
8582
8645
|
};
|
|
8583
8646
|
|
|
8647
|
+
// src/agent/tools/telegram/groups/index.ts
|
|
8648
|
+
var tools4 = [
|
|
8649
|
+
{ tool: telegramGetMeTool, executor: telegramGetMeExecutor },
|
|
8650
|
+
{ tool: telegramGetParticipantsTool, executor: telegramGetParticipantsExecutor },
|
|
8651
|
+
{ tool: telegramKickUserTool, executor: telegramKickUserExecutor, scope: "group-only" },
|
|
8652
|
+
{ tool: telegramBanUserTool, executor: telegramBanUserExecutor, scope: "group-only" },
|
|
8653
|
+
{ tool: telegramUnbanUserTool, executor: telegramUnbanUserExecutor, scope: "group-only" },
|
|
8654
|
+
{ tool: telegramCreateGroupTool, executor: telegramCreateGroupExecutor, scope: "dm-only" },
|
|
8655
|
+
{ tool: telegramSetChatPhotoTool, executor: telegramSetChatPhotoExecutor, scope: "group-only" }
|
|
8656
|
+
];
|
|
8657
|
+
|
|
8584
8658
|
// src/agent/tools/telegram/interactive/create-poll.ts
|
|
8585
8659
|
import { Type as Type30 } from "@sinclair/typebox";
|
|
8586
8660
|
import { Api as Api23 } from "telegram";
|
|
@@ -9036,6 +9110,15 @@ var telegramSendDiceExecutor = async (params, context) => {
|
|
|
9036
9110
|
}
|
|
9037
9111
|
};
|
|
9038
9112
|
|
|
9113
|
+
// src/agent/tools/telegram/interactive/index.ts
|
|
9114
|
+
var tools5 = [
|
|
9115
|
+
{ tool: telegramCreatePollTool, executor: telegramCreatePollExecutor },
|
|
9116
|
+
{ tool: telegramCreateQuizTool, executor: telegramCreateQuizExecutor },
|
|
9117
|
+
{ tool: telegramReplyKeyboardTool, executor: telegramReplyKeyboardExecutor },
|
|
9118
|
+
{ tool: telegramReactTool, executor: telegramReactExecutor },
|
|
9119
|
+
{ tool: telegramSendDiceTool, executor: telegramSendDiceExecutor }
|
|
9120
|
+
];
|
|
9121
|
+
|
|
9039
9122
|
// src/agent/tools/telegram/stickers/search-stickers.ts
|
|
9040
9123
|
import { Type as Type35 } from "@sinclair/typebox";
|
|
9041
9124
|
import { Api as Api27 } from "telegram";
|
|
@@ -9262,6 +9345,14 @@ var telegramAddStickerSetExecutor = async (params, context) => {
|
|
|
9262
9345
|
}
|
|
9263
9346
|
};
|
|
9264
9347
|
|
|
9348
|
+
// src/agent/tools/telegram/stickers/index.ts
|
|
9349
|
+
var tools6 = [
|
|
9350
|
+
{ tool: telegramSearchStickersTool, executor: telegramSearchStickersExecutor },
|
|
9351
|
+
{ tool: telegramSearchGifsTool, executor: telegramSearchGifsExecutor },
|
|
9352
|
+
{ tool: telegramGetMyStickersTool, executor: telegramGetMyStickersExecutor },
|
|
9353
|
+
{ tool: telegramAddStickerSetTool, executor: telegramAddStickerSetExecutor }
|
|
9354
|
+
];
|
|
9355
|
+
|
|
9265
9356
|
// src/agent/tools/telegram/folders/get-folders.ts
|
|
9266
9357
|
import { Type as Type39 } from "@sinclair/typebox";
|
|
9267
9358
|
import { Api as Api31 } from "telegram";
|
|
@@ -9466,6 +9557,13 @@ var telegramAddChatToFolderExecutor = async (params, context) => {
|
|
|
9466
9557
|
}
|
|
9467
9558
|
};
|
|
9468
9559
|
|
|
9560
|
+
// src/agent/tools/telegram/folders/index.ts
|
|
9561
|
+
var tools7 = [
|
|
9562
|
+
{ tool: telegramGetFoldersTool, executor: telegramGetFoldersExecutor },
|
|
9563
|
+
{ tool: telegramCreateFolderTool, executor: telegramCreateFolderExecutor },
|
|
9564
|
+
{ tool: telegramAddChatToFolderTool, executor: telegramAddChatToFolderExecutor }
|
|
9565
|
+
];
|
|
9566
|
+
|
|
9469
9567
|
// src/agent/tools/telegram/profile/update-profile.ts
|
|
9470
9568
|
import { Type as Type42 } from "@sinclair/typebox";
|
|
9471
9569
|
import { Api as Api34 } from "telegram";
|
|
@@ -9637,6 +9735,13 @@ var telegramSetUsernameExecutor = async (params, context) => {
|
|
|
9637
9735
|
}
|
|
9638
9736
|
};
|
|
9639
9737
|
|
|
9738
|
+
// src/agent/tools/telegram/profile/index.ts
|
|
9739
|
+
var tools8 = [
|
|
9740
|
+
{ tool: telegramUpdateProfileTool, executor: telegramUpdateProfileExecutor, scope: "dm-only" },
|
|
9741
|
+
{ tool: telegramSetBioTool, executor: telegramSetBioExecutor, scope: "dm-only" },
|
|
9742
|
+
{ tool: telegramSetUsernameTool, executor: telegramSetUsernameExecutor, scope: "dm-only" }
|
|
9743
|
+
];
|
|
9744
|
+
|
|
9640
9745
|
// src/agent/tools/telegram/stars/get-balance.ts
|
|
9641
9746
|
import { Type as Type45 } from "@sinclair/typebox";
|
|
9642
9747
|
import { Api as Api37 } from "telegram";
|
|
@@ -9738,6 +9843,20 @@ var telegramGetStarsTransactionsExecutor = async (params, context) => {
|
|
|
9738
9843
|
}
|
|
9739
9844
|
};
|
|
9740
9845
|
|
|
9846
|
+
// src/agent/tools/telegram/stars/index.ts
|
|
9847
|
+
var tools9 = [
|
|
9848
|
+
{
|
|
9849
|
+
tool: telegramGetStarsBalanceTool,
|
|
9850
|
+
executor: telegramGetStarsBalanceExecutor,
|
|
9851
|
+
scope: "dm-only"
|
|
9852
|
+
},
|
|
9853
|
+
{
|
|
9854
|
+
tool: telegramGetStarsTransactionsTool,
|
|
9855
|
+
executor: telegramGetStarsTransactionsExecutor,
|
|
9856
|
+
scope: "dm-only"
|
|
9857
|
+
}
|
|
9858
|
+
];
|
|
9859
|
+
|
|
9741
9860
|
// src/agent/tools/telegram/gifts/get-available-gifts.ts
|
|
9742
9861
|
import { Type as Type47 } from "@sinclair/typebox";
|
|
9743
9862
|
import { Api as Api39 } from "telegram";
|
|
@@ -13303,6 +13422,26 @@ var telegramSetGiftStatusExecutor = async (params, context) => {
|
|
|
13303
13422
|
}
|
|
13304
13423
|
};
|
|
13305
13424
|
|
|
13425
|
+
// src/agent/tools/telegram/gifts/index.ts
|
|
13426
|
+
var tools10 = [
|
|
13427
|
+
{ tool: telegramGetAvailableGiftsTool, executor: telegramGetAvailableGiftsExecutor },
|
|
13428
|
+
{ tool: telegramSendGiftTool, executor: telegramSendGiftExecutor, scope: "dm-only" },
|
|
13429
|
+
{ tool: telegramGetMyGiftsTool, executor: telegramGetMyGiftsExecutor },
|
|
13430
|
+
{
|
|
13431
|
+
tool: telegramTransferCollectibleTool,
|
|
13432
|
+
executor: telegramTransferCollectibleExecutor,
|
|
13433
|
+
scope: "dm-only"
|
|
13434
|
+
},
|
|
13435
|
+
{
|
|
13436
|
+
tool: telegramSetCollectiblePriceTool,
|
|
13437
|
+
executor: telegramSetCollectiblePriceExecutor,
|
|
13438
|
+
scope: "dm-only"
|
|
13439
|
+
},
|
|
13440
|
+
{ tool: telegramGetResaleGiftsTool, executor: telegramGetResaleGiftsExecutor },
|
|
13441
|
+
{ tool: telegramBuyResaleGiftTool, executor: telegramBuyResaleGiftExecutor, scope: "dm-only" },
|
|
13442
|
+
{ tool: telegramSetGiftStatusTool, executor: telegramSetGiftStatusExecutor, scope: "dm-only" }
|
|
13443
|
+
];
|
|
13444
|
+
|
|
13306
13445
|
// src/agent/tools/telegram/contacts/block-user.ts
|
|
13307
13446
|
import { Type as Type59 } from "@sinclair/typebox";
|
|
13308
13447
|
import { Api as Api50 } from "telegram";
|
|
@@ -13687,6 +13826,15 @@ var telegramCheckUsernameExecutor = async (params, context) => {
|
|
|
13687
13826
|
}
|
|
13688
13827
|
};
|
|
13689
13828
|
|
|
13829
|
+
// src/agent/tools/telegram/contacts/index.ts
|
|
13830
|
+
var tools11 = [
|
|
13831
|
+
{ tool: telegramBlockUserTool, executor: telegramBlockUserExecutor, scope: "dm-only" },
|
|
13832
|
+
{ tool: telegramGetBlockedTool, executor: telegramGetBlockedExecutor, scope: "dm-only" },
|
|
13833
|
+
{ tool: telegramGetCommonChatsTool, executor: telegramGetCommonChatsExecutor },
|
|
13834
|
+
{ tool: telegramGetUserInfoTool, executor: telegramGetUserInfoExecutor },
|
|
13835
|
+
{ tool: telegramCheckUsernameTool, executor: telegramCheckUsernameExecutor }
|
|
13836
|
+
];
|
|
13837
|
+
|
|
13690
13838
|
// src/agent/tools/telegram/stories/send-story.ts
|
|
13691
13839
|
var import_big_integer6 = __toESM(require_BigInteger(), 1);
|
|
13692
13840
|
import { Type as Type64 } from "@sinclair/typebox";
|
|
@@ -13808,6 +13956,11 @@ var telegramSendStoryExecutor = async (params, context) => {
|
|
|
13808
13956
|
}
|
|
13809
13957
|
};
|
|
13810
13958
|
|
|
13959
|
+
// src/agent/tools/telegram/stories/index.ts
|
|
13960
|
+
var tools12 = [
|
|
13961
|
+
{ tool: telegramSendStoryTool, executor: telegramSendStoryExecutor, scope: "dm-only" }
|
|
13962
|
+
];
|
|
13963
|
+
|
|
13811
13964
|
// src/agent/tools/telegram/memory/memory-write.ts
|
|
13812
13965
|
import { Type as Type65 } from "@sinclair/typebox";
|
|
13813
13966
|
import { appendFileSync as appendFileSync2, writeFileSync as writeFileSync8, existsSync as existsSync11, mkdirSync as mkdirSync8 } from "fs";
|
|
@@ -14063,19 +14216,243 @@ var memoryReadExecutor = async (params, _context) => {
|
|
|
14063
14216
|
}
|
|
14064
14217
|
};
|
|
14065
14218
|
|
|
14066
|
-
// src/agent/tools/telegram/
|
|
14219
|
+
// src/agent/tools/telegram/memory/index.ts
|
|
14220
|
+
var tools13 = [
|
|
14221
|
+
{ tool: memoryWriteTool, executor: memoryWriteExecutor, scope: "dm-only" },
|
|
14222
|
+
{ tool: memoryReadTool, executor: memoryReadExecutor }
|
|
14223
|
+
];
|
|
14224
|
+
|
|
14225
|
+
// src/agent/tools/telegram/tasks/create-scheduled-task.ts
|
|
14067
14226
|
import { Type as Type67 } from "@sinclair/typebox";
|
|
14227
|
+
import { Api as Api56 } from "telegram";
|
|
14228
|
+
var telegramCreateScheduledTaskTool = {
|
|
14229
|
+
name: "telegram_create_scheduled_task",
|
|
14230
|
+
description: "Create a scheduled task that will be executed at a specific time. The task will be stored in the database and a reminder message will be scheduled in Saved Messages. When the time comes, you'll receive the task context and can execute it with full agent capabilities. Supports both simple tool calls and complex multi-step tasks.",
|
|
14231
|
+
parameters: Type67.Object({
|
|
14232
|
+
description: Type67.String({
|
|
14233
|
+
description: "What the task is about (e.g., 'Check TON price and alert if > $5')"
|
|
14234
|
+
}),
|
|
14235
|
+
scheduleDate: Type67.Optional(
|
|
14236
|
+
Type67.String({
|
|
14237
|
+
description: "When to execute the task (ISO 8601 format, e.g., '2024-12-25T10:00:00Z' or Unix timestamp). Optional if dependsOn is provided - task will execute when dependencies complete."
|
|
14238
|
+
})
|
|
14239
|
+
),
|
|
14240
|
+
payload: Type67.Optional(
|
|
14241
|
+
Type67.String({
|
|
14242
|
+
description: `JSON payload defining task execution. Two types:
|
|
14243
|
+
|
|
14244
|
+
1. Simple tool call (auto-executed, result fed to you):
|
|
14245
|
+
{"type":"tool_call","tool":"ton_get_price","params":{},"condition":"price > 5"}
|
|
14246
|
+
|
|
14247
|
+
2. Complex agent task (you execute step-by-step):
|
|
14248
|
+
{"type":"agent_task","instructions":"1. Check price\\n2. If > $5, swap 50 TON","context":{"chatId":"123"}}
|
|
14249
|
+
|
|
14250
|
+
3. Skip on parent failure (continues even if parent fails):
|
|
14251
|
+
{"type":"agent_task","instructions":"Send daily report","skipOnParentFailure":false}
|
|
14252
|
+
|
|
14253
|
+
If omitted, task is a simple reminder.`
|
|
14254
|
+
})
|
|
14255
|
+
),
|
|
14256
|
+
reason: Type67.Optional(
|
|
14257
|
+
Type67.String({
|
|
14258
|
+
description: "Why you're scheduling this task (helps with context when executing)"
|
|
14259
|
+
})
|
|
14260
|
+
),
|
|
14261
|
+
priority: Type67.Optional(
|
|
14262
|
+
Type67.Number({
|
|
14263
|
+
description: "Task priority (0-10, higher = more important)",
|
|
14264
|
+
minimum: 0,
|
|
14265
|
+
maximum: 10
|
|
14266
|
+
})
|
|
14267
|
+
),
|
|
14268
|
+
dependsOn: Type67.Optional(
|
|
14269
|
+
Type67.Array(Type67.String(), {
|
|
14270
|
+
description: "Array of parent task IDs that must complete before this task executes. When dependencies are provided, task executes automatically when all parents are done (scheduleDate is ignored)."
|
|
14271
|
+
})
|
|
14272
|
+
)
|
|
14273
|
+
})
|
|
14274
|
+
};
|
|
14275
|
+
var telegramCreateScheduledTaskExecutor = async (params, context) => {
|
|
14276
|
+
try {
|
|
14277
|
+
const { description, scheduleDate, payload, reason, priority, dependsOn } = params;
|
|
14278
|
+
if (!scheduleDate && (!dependsOn || dependsOn.length === 0)) {
|
|
14279
|
+
return {
|
|
14280
|
+
success: false,
|
|
14281
|
+
error: "Either scheduleDate or dependsOn must be provided"
|
|
14282
|
+
};
|
|
14283
|
+
}
|
|
14284
|
+
let scheduleTimestamp;
|
|
14285
|
+
if (scheduleDate) {
|
|
14286
|
+
const parsedDate = new Date(scheduleDate);
|
|
14287
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
14288
|
+
scheduleTimestamp = Math.floor(parsedDate.getTime() / 1e3);
|
|
14289
|
+
} else {
|
|
14290
|
+
scheduleTimestamp = parseInt(scheduleDate, 10);
|
|
14291
|
+
if (isNaN(scheduleTimestamp)) {
|
|
14292
|
+
return {
|
|
14293
|
+
success: false,
|
|
14294
|
+
error: "Invalid scheduleDate format"
|
|
14295
|
+
};
|
|
14296
|
+
}
|
|
14297
|
+
}
|
|
14298
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
14299
|
+
if (scheduleTimestamp <= now) {
|
|
14300
|
+
return {
|
|
14301
|
+
success: false,
|
|
14302
|
+
error: "Schedule date must be in the future"
|
|
14303
|
+
};
|
|
14304
|
+
}
|
|
14305
|
+
}
|
|
14306
|
+
if (payload) {
|
|
14307
|
+
try {
|
|
14308
|
+
const parsed = JSON.parse(payload);
|
|
14309
|
+
if (!parsed.type || !["tool_call", "agent_task"].includes(parsed.type)) {
|
|
14310
|
+
return {
|
|
14311
|
+
success: false,
|
|
14312
|
+
error: 'Payload must have type "tool_call" or "agent_task"'
|
|
14313
|
+
};
|
|
14314
|
+
}
|
|
14315
|
+
if (parsed.type === "tool_call") {
|
|
14316
|
+
if (!parsed.tool || typeof parsed.tool !== "string") {
|
|
14317
|
+
return {
|
|
14318
|
+
success: false,
|
|
14319
|
+
error: 'tool_call payload requires "tool" field (string)'
|
|
14320
|
+
};
|
|
14321
|
+
}
|
|
14322
|
+
if (parsed.params !== void 0 && typeof parsed.params !== "object") {
|
|
14323
|
+
return {
|
|
14324
|
+
success: false,
|
|
14325
|
+
error: 'tool_call payload "params" must be an object'
|
|
14326
|
+
};
|
|
14327
|
+
}
|
|
14328
|
+
}
|
|
14329
|
+
if (parsed.type === "agent_task") {
|
|
14330
|
+
if (!parsed.instructions || typeof parsed.instructions !== "string") {
|
|
14331
|
+
return {
|
|
14332
|
+
success: false,
|
|
14333
|
+
error: 'agent_task payload requires "instructions" field (string)'
|
|
14334
|
+
};
|
|
14335
|
+
}
|
|
14336
|
+
if (parsed.instructions.length < 5) {
|
|
14337
|
+
return {
|
|
14338
|
+
success: false,
|
|
14339
|
+
error: "Instructions too short (min 5 characters)"
|
|
14340
|
+
};
|
|
14341
|
+
}
|
|
14342
|
+
if (parsed.context !== void 0 && typeof parsed.context !== "object") {
|
|
14343
|
+
return {
|
|
14344
|
+
success: false,
|
|
14345
|
+
error: 'agent_task payload "context" must be an object'
|
|
14346
|
+
};
|
|
14347
|
+
}
|
|
14348
|
+
}
|
|
14349
|
+
} catch (e) {
|
|
14350
|
+
return {
|
|
14351
|
+
success: false,
|
|
14352
|
+
error: "Invalid JSON payload"
|
|
14353
|
+
};
|
|
14354
|
+
}
|
|
14355
|
+
}
|
|
14356
|
+
if (!context.db) {
|
|
14357
|
+
return {
|
|
14358
|
+
success: false,
|
|
14359
|
+
error: "Database not available"
|
|
14360
|
+
};
|
|
14361
|
+
}
|
|
14362
|
+
const { getTaskStore } = await import("./tasks-M3QDPTGY.js");
|
|
14363
|
+
const taskStore = getTaskStore(context.db);
|
|
14364
|
+
const MAX_DEPENDENTS_PER_TASK = 10;
|
|
14365
|
+
if (dependsOn && dependsOn.length > 0) {
|
|
14366
|
+
for (const parentId of dependsOn) {
|
|
14367
|
+
const existingDependents = taskStore.getDependents(parentId);
|
|
14368
|
+
if (existingDependents.length >= MAX_DEPENDENTS_PER_TASK) {
|
|
14369
|
+
return {
|
|
14370
|
+
success: false,
|
|
14371
|
+
error: `Parent task ${parentId} already has ${existingDependents.length} dependents (max: ${MAX_DEPENDENTS_PER_TASK})`
|
|
14372
|
+
};
|
|
14373
|
+
}
|
|
14374
|
+
}
|
|
14375
|
+
}
|
|
14376
|
+
const task = taskStore.createTask({
|
|
14377
|
+
description,
|
|
14378
|
+
priority: priority ?? 0,
|
|
14379
|
+
createdBy: "agent",
|
|
14380
|
+
scheduledFor: scheduleTimestamp ? new Date(scheduleTimestamp * 1e3) : void 0,
|
|
14381
|
+
payload,
|
|
14382
|
+
reason,
|
|
14383
|
+
dependsOn
|
|
14384
|
+
});
|
|
14385
|
+
let scheduledMessageId;
|
|
14386
|
+
if (dependsOn && dependsOn.length > 0) {
|
|
14387
|
+
return {
|
|
14388
|
+
success: true,
|
|
14389
|
+
data: {
|
|
14390
|
+
taskId: task.id,
|
|
14391
|
+
dependsOn,
|
|
14392
|
+
message: `Task created: "${description}" (will execute when ${dependsOn.length} parent task(s) complete)`
|
|
14393
|
+
}
|
|
14394
|
+
};
|
|
14395
|
+
} else if (scheduleTimestamp) {
|
|
14396
|
+
const gramJsClient = context.bridge.getClient().getClient();
|
|
14397
|
+
const me = await gramJsClient.getMe();
|
|
14398
|
+
const taskMessage = `[TASK:${task.id}] ${description}`;
|
|
14399
|
+
const result = await gramJsClient.invoke(
|
|
14400
|
+
new Api56.messages.SendMessage({
|
|
14401
|
+
peer: me,
|
|
14402
|
+
message: taskMessage,
|
|
14403
|
+
scheduleDate: scheduleTimestamp,
|
|
14404
|
+
randomId: Date.now()
|
|
14405
|
+
})
|
|
14406
|
+
);
|
|
14407
|
+
if (result instanceof Api56.Updates || result instanceof Api56.UpdatesCombined) {
|
|
14408
|
+
for (const update of result.updates) {
|
|
14409
|
+
if (update instanceof Api56.UpdateMessageID) {
|
|
14410
|
+
scheduledMessageId = update.id;
|
|
14411
|
+
break;
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
}
|
|
14415
|
+
return {
|
|
14416
|
+
success: true,
|
|
14417
|
+
data: {
|
|
14418
|
+
taskId: task.id,
|
|
14419
|
+
scheduledFor: new Date(scheduleTimestamp * 1e3).toISOString(),
|
|
14420
|
+
scheduledMessageId,
|
|
14421
|
+
message: `Task scheduled: "${description}" at ${new Date(scheduleTimestamp * 1e3).toLocaleString()}`
|
|
14422
|
+
}
|
|
14423
|
+
};
|
|
14424
|
+
}
|
|
14425
|
+
return {
|
|
14426
|
+
success: false,
|
|
14427
|
+
error: "Invalid state: no scheduleDate or dependsOn"
|
|
14428
|
+
};
|
|
14429
|
+
} catch (error) {
|
|
14430
|
+
console.error("Error creating scheduled task:", error);
|
|
14431
|
+
return {
|
|
14432
|
+
success: false,
|
|
14433
|
+
error: error instanceof Error ? error.message : String(error)
|
|
14434
|
+
};
|
|
14435
|
+
}
|
|
14436
|
+
};
|
|
14437
|
+
|
|
14438
|
+
// src/agent/tools/telegram/tasks/index.ts
|
|
14439
|
+
var tools14 = [
|
|
14440
|
+
{ tool: telegramCreateScheduledTaskTool, executor: telegramCreateScheduledTaskExecutor }
|
|
14441
|
+
];
|
|
14442
|
+
|
|
14443
|
+
// src/agent/tools/telegram/market/get-floor.ts
|
|
14444
|
+
import { Type as Type68 } from "@sinclair/typebox";
|
|
14068
14445
|
var marketGetFloorTool = {
|
|
14069
14446
|
name: "market_get_floor",
|
|
14070
14447
|
description: "Get floor price for a Telegram gift collection or specific model from MarketApp.ws. Pass collection name only for collection floor, or both collection and model for specific model floor. Returns floor price in TON, USD (if available), rarity percentage, and cache age. Data is cached for 15 minutes and automatically refreshed every 60 minutes.",
|
|
14071
|
-
parameters:
|
|
14072
|
-
collection:
|
|
14073
|
-
|
|
14448
|
+
parameters: Type68.Object({
|
|
14449
|
+
collection: Type68.Optional(
|
|
14450
|
+
Type68.String({
|
|
14074
14451
|
description: "Collection name (e.g., 'Plush Pepes', 'Heart Lockets')"
|
|
14075
14452
|
})
|
|
14076
14453
|
),
|
|
14077
|
-
model:
|
|
14078
|
-
|
|
14454
|
+
model: Type68.Optional(
|
|
14455
|
+
Type68.String({
|
|
14079
14456
|
description: "Model name (e.g., 'Cozy Galaxy', 'Telegram', 'Resistance')"
|
|
14080
14457
|
})
|
|
14081
14458
|
)
|
|
@@ -14156,16 +14533,16 @@ var marketGetFloorExecutor = async (params, context) => {
|
|
|
14156
14533
|
};
|
|
14157
14534
|
|
|
14158
14535
|
// src/agent/tools/telegram/market/search.ts
|
|
14159
|
-
import { Type as
|
|
14536
|
+
import { Type as Type69 } from "@sinclair/typebox";
|
|
14160
14537
|
var marketSearchTool = {
|
|
14161
14538
|
name: "market_search",
|
|
14162
14539
|
description: "Search for gift models by name (fuzzy search). Searches both collection names and model names with case-insensitive partial matches. Returns up to 'limit' results (default: 10). Examples: 'galaxy' finds Cozy Galaxy models, 'plush' finds all Plush Pepes models.",
|
|
14163
|
-
parameters:
|
|
14164
|
-
query:
|
|
14540
|
+
parameters: Type69.Object({
|
|
14541
|
+
query: Type69.String({
|
|
14165
14542
|
description: "Search query (collection or model name)"
|
|
14166
14543
|
}),
|
|
14167
|
-
limit:
|
|
14168
|
-
|
|
14544
|
+
limit: Type69.Optional(
|
|
14545
|
+
Type69.Number({
|
|
14169
14546
|
description: "Maximum number of results (default: 10, max: 50)",
|
|
14170
14547
|
minimum: 1,
|
|
14171
14548
|
maximum: 50
|
|
@@ -14218,17 +14595,17 @@ var marketSearchExecutor = async (params, context) => {
|
|
|
14218
14595
|
};
|
|
14219
14596
|
|
|
14220
14597
|
// src/agent/tools/telegram/market/cheapest.ts
|
|
14221
|
-
import { Type as
|
|
14598
|
+
import { Type as Type70 } from "@sinclair/typebox";
|
|
14222
14599
|
var marketCheapestTool = {
|
|
14223
14600
|
name: "market_cheapest",
|
|
14224
14601
|
description: "Find the cheapest gift models under a certain TON price. Returns models sorted by floor price (cheapest first) with collection name, floor price in TON, and rarity percentage. Useful for finding affordable gifts.",
|
|
14225
|
-
parameters:
|
|
14226
|
-
maxTon:
|
|
14602
|
+
parameters: Type70.Object({
|
|
14603
|
+
maxTon: Type70.Number({
|
|
14227
14604
|
description: "Maximum TON price",
|
|
14228
14605
|
minimum: 0
|
|
14229
14606
|
}),
|
|
14230
|
-
limit:
|
|
14231
|
-
|
|
14607
|
+
limit: Type70.Optional(
|
|
14608
|
+
Type70.Number({
|
|
14232
14609
|
description: "Maximum number of results (default: 20, max: 100)",
|
|
14233
14610
|
minimum: 1,
|
|
14234
14611
|
maximum: 100
|
|
@@ -14283,19 +14660,19 @@ var marketCheapestExecutor = async (params, context) => {
|
|
|
14283
14660
|
};
|
|
14284
14661
|
|
|
14285
14662
|
// src/agent/tools/telegram/market/price-history.ts
|
|
14286
|
-
import { Type as
|
|
14663
|
+
import { Type as Type71 } from "@sinclair/typebox";
|
|
14287
14664
|
var marketPriceHistoryTool = {
|
|
14288
14665
|
name: "market_price_history",
|
|
14289
14666
|
description: "Get price history for a specific gift model. Requires both collection and model name. Returns historical floor prices with timestamps (most recent first), floor TON and USD values, and trend analysis (rising, falling, or stable).",
|
|
14290
|
-
parameters:
|
|
14291
|
-
collection:
|
|
14667
|
+
parameters: Type71.Object({
|
|
14668
|
+
collection: Type71.String({
|
|
14292
14669
|
description: "Collection name (e.g., 'Plush Pepes')"
|
|
14293
14670
|
}),
|
|
14294
|
-
model:
|
|
14671
|
+
model: Type71.String({
|
|
14295
14672
|
description: "Model name (e.g., 'Cozy Galaxy')"
|
|
14296
14673
|
}),
|
|
14297
|
-
limit:
|
|
14298
|
-
|
|
14674
|
+
limit: Type71.Optional(
|
|
14675
|
+
Type71.Number({
|
|
14299
14676
|
description: "Maximum number of history entries (default: 10, max: 100)",
|
|
14300
14677
|
minimum: 1,
|
|
14301
14678
|
maximum: 100
|
|
@@ -14354,218 +14731,23 @@ var marketPriceHistoryExecutor = async (params, context) => {
|
|
|
14354
14731
|
}
|
|
14355
14732
|
};
|
|
14356
14733
|
|
|
14357
|
-
// src/agent/tools/telegram/
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
description: `JSON payload defining task execution. Two types:
|
|
14375
|
-
|
|
14376
|
-
1. Simple tool call (auto-executed, result fed to you):
|
|
14377
|
-
{"type":"tool_call","tool":"ton_get_price","params":{},"condition":"price > 5"}
|
|
14378
|
-
|
|
14379
|
-
2. Complex agent task (you execute step-by-step):
|
|
14380
|
-
{"type":"agent_task","instructions":"1. Check price\\n2. If > $5, swap 50 TON","context":{"chatId":"123"}}
|
|
14381
|
-
|
|
14382
|
-
3. Skip on parent failure (continues even if parent fails):
|
|
14383
|
-
{"type":"agent_task","instructions":"Send daily report","skipOnParentFailure":false}
|
|
14384
|
-
|
|
14385
|
-
If omitted, task is a simple reminder.`
|
|
14386
|
-
})
|
|
14387
|
-
),
|
|
14388
|
-
reason: Type71.Optional(
|
|
14389
|
-
Type71.String({
|
|
14390
|
-
description: "Why you're scheduling this task (helps with context when executing)"
|
|
14391
|
-
})
|
|
14392
|
-
),
|
|
14393
|
-
priority: Type71.Optional(
|
|
14394
|
-
Type71.Number({
|
|
14395
|
-
description: "Task priority (0-10, higher = more important)",
|
|
14396
|
-
minimum: 0,
|
|
14397
|
-
maximum: 10
|
|
14398
|
-
})
|
|
14399
|
-
),
|
|
14400
|
-
dependsOn: Type71.Optional(
|
|
14401
|
-
Type71.Array(Type71.String(), {
|
|
14402
|
-
description: "Array of parent task IDs that must complete before this task executes. When dependencies are provided, task executes automatically when all parents are done (scheduleDate is ignored)."
|
|
14403
|
-
})
|
|
14404
|
-
)
|
|
14405
|
-
})
|
|
14406
|
-
};
|
|
14407
|
-
var telegramCreateScheduledTaskExecutor = async (params, context) => {
|
|
14408
|
-
try {
|
|
14409
|
-
const { description, scheduleDate, payload, reason, priority, dependsOn } = params;
|
|
14410
|
-
if (!scheduleDate && (!dependsOn || dependsOn.length === 0)) {
|
|
14411
|
-
return {
|
|
14412
|
-
success: false,
|
|
14413
|
-
error: "Either scheduleDate or dependsOn must be provided"
|
|
14414
|
-
};
|
|
14415
|
-
}
|
|
14416
|
-
let scheduleTimestamp;
|
|
14417
|
-
if (scheduleDate) {
|
|
14418
|
-
const parsedDate = new Date(scheduleDate);
|
|
14419
|
-
if (!isNaN(parsedDate.getTime())) {
|
|
14420
|
-
scheduleTimestamp = Math.floor(parsedDate.getTime() / 1e3);
|
|
14421
|
-
} else {
|
|
14422
|
-
scheduleTimestamp = parseInt(scheduleDate, 10);
|
|
14423
|
-
if (isNaN(scheduleTimestamp)) {
|
|
14424
|
-
return {
|
|
14425
|
-
success: false,
|
|
14426
|
-
error: "Invalid scheduleDate format"
|
|
14427
|
-
};
|
|
14428
|
-
}
|
|
14429
|
-
}
|
|
14430
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
14431
|
-
if (scheduleTimestamp <= now) {
|
|
14432
|
-
return {
|
|
14433
|
-
success: false,
|
|
14434
|
-
error: "Schedule date must be in the future"
|
|
14435
|
-
};
|
|
14436
|
-
}
|
|
14437
|
-
}
|
|
14438
|
-
if (payload) {
|
|
14439
|
-
try {
|
|
14440
|
-
const parsed = JSON.parse(payload);
|
|
14441
|
-
if (!parsed.type || !["tool_call", "agent_task"].includes(parsed.type)) {
|
|
14442
|
-
return {
|
|
14443
|
-
success: false,
|
|
14444
|
-
error: 'Payload must have type "tool_call" or "agent_task"'
|
|
14445
|
-
};
|
|
14446
|
-
}
|
|
14447
|
-
if (parsed.type === "tool_call") {
|
|
14448
|
-
if (!parsed.tool || typeof parsed.tool !== "string") {
|
|
14449
|
-
return {
|
|
14450
|
-
success: false,
|
|
14451
|
-
error: 'tool_call payload requires "tool" field (string)'
|
|
14452
|
-
};
|
|
14453
|
-
}
|
|
14454
|
-
if (parsed.params !== void 0 && typeof parsed.params !== "object") {
|
|
14455
|
-
return {
|
|
14456
|
-
success: false,
|
|
14457
|
-
error: 'tool_call payload "params" must be an object'
|
|
14458
|
-
};
|
|
14459
|
-
}
|
|
14460
|
-
}
|
|
14461
|
-
if (parsed.type === "agent_task") {
|
|
14462
|
-
if (!parsed.instructions || typeof parsed.instructions !== "string") {
|
|
14463
|
-
return {
|
|
14464
|
-
success: false,
|
|
14465
|
-
error: 'agent_task payload requires "instructions" field (string)'
|
|
14466
|
-
};
|
|
14467
|
-
}
|
|
14468
|
-
if (parsed.instructions.length < 5) {
|
|
14469
|
-
return {
|
|
14470
|
-
success: false,
|
|
14471
|
-
error: "Instructions too short (min 5 characters)"
|
|
14472
|
-
};
|
|
14473
|
-
}
|
|
14474
|
-
if (parsed.context !== void 0 && typeof parsed.context !== "object") {
|
|
14475
|
-
return {
|
|
14476
|
-
success: false,
|
|
14477
|
-
error: 'agent_task payload "context" must be an object'
|
|
14478
|
-
};
|
|
14479
|
-
}
|
|
14480
|
-
}
|
|
14481
|
-
} catch (e) {
|
|
14482
|
-
return {
|
|
14483
|
-
success: false,
|
|
14484
|
-
error: "Invalid JSON payload"
|
|
14485
|
-
};
|
|
14486
|
-
}
|
|
14487
|
-
}
|
|
14488
|
-
if (!context.db) {
|
|
14489
|
-
return {
|
|
14490
|
-
success: false,
|
|
14491
|
-
error: "Database not available"
|
|
14492
|
-
};
|
|
14493
|
-
}
|
|
14494
|
-
const { getTaskStore } = await import("./tasks-M3QDPTGY.js");
|
|
14495
|
-
const taskStore = getTaskStore(context.db);
|
|
14496
|
-
const MAX_DEPENDENTS_PER_TASK = 10;
|
|
14497
|
-
if (dependsOn && dependsOn.length > 0) {
|
|
14498
|
-
for (const parentId of dependsOn) {
|
|
14499
|
-
const existingDependents = taskStore.getDependents(parentId);
|
|
14500
|
-
if (existingDependents.length >= MAX_DEPENDENTS_PER_TASK) {
|
|
14501
|
-
return {
|
|
14502
|
-
success: false,
|
|
14503
|
-
error: `Parent task ${parentId} already has ${existingDependents.length} dependents (max: ${MAX_DEPENDENTS_PER_TASK})`
|
|
14504
|
-
};
|
|
14505
|
-
}
|
|
14506
|
-
}
|
|
14507
|
-
}
|
|
14508
|
-
const task = taskStore.createTask({
|
|
14509
|
-
description,
|
|
14510
|
-
priority: priority ?? 0,
|
|
14511
|
-
createdBy: "agent",
|
|
14512
|
-
scheduledFor: scheduleTimestamp ? new Date(scheduleTimestamp * 1e3) : void 0,
|
|
14513
|
-
payload,
|
|
14514
|
-
reason,
|
|
14515
|
-
dependsOn
|
|
14516
|
-
});
|
|
14517
|
-
let scheduledMessageId;
|
|
14518
|
-
if (dependsOn && dependsOn.length > 0) {
|
|
14519
|
-
return {
|
|
14520
|
-
success: true,
|
|
14521
|
-
data: {
|
|
14522
|
-
taskId: task.id,
|
|
14523
|
-
dependsOn,
|
|
14524
|
-
message: `Task created: "${description}" (will execute when ${dependsOn.length} parent task(s) complete)`
|
|
14525
|
-
}
|
|
14526
|
-
};
|
|
14527
|
-
} else if (scheduleTimestamp) {
|
|
14528
|
-
const gramJsClient = context.bridge.getClient().getClient();
|
|
14529
|
-
const me = await gramJsClient.getMe();
|
|
14530
|
-
const taskMessage = `[TASK:${task.id}] ${description}`;
|
|
14531
|
-
const result = await gramJsClient.invoke(
|
|
14532
|
-
new Api56.messages.SendMessage({
|
|
14533
|
-
peer: me,
|
|
14534
|
-
message: taskMessage,
|
|
14535
|
-
scheduleDate: scheduleTimestamp,
|
|
14536
|
-
randomId: Date.now()
|
|
14537
|
-
})
|
|
14538
|
-
);
|
|
14539
|
-
if (result instanceof Api56.Updates || result instanceof Api56.UpdatesCombined) {
|
|
14540
|
-
for (const update of result.updates) {
|
|
14541
|
-
if (update instanceof Api56.UpdateMessageID) {
|
|
14542
|
-
scheduledMessageId = update.id;
|
|
14543
|
-
break;
|
|
14544
|
-
}
|
|
14545
|
-
}
|
|
14546
|
-
}
|
|
14547
|
-
return {
|
|
14548
|
-
success: true,
|
|
14549
|
-
data: {
|
|
14550
|
-
taskId: task.id,
|
|
14551
|
-
scheduledFor: new Date(scheduleTimestamp * 1e3).toISOString(),
|
|
14552
|
-
scheduledMessageId,
|
|
14553
|
-
message: `Task scheduled: "${description}" at ${new Date(scheduleTimestamp * 1e3).toLocaleString()}`
|
|
14554
|
-
}
|
|
14555
|
-
};
|
|
14556
|
-
}
|
|
14557
|
-
return {
|
|
14558
|
-
success: false,
|
|
14559
|
-
error: "Invalid state: no scheduleDate or dependsOn"
|
|
14560
|
-
};
|
|
14561
|
-
} catch (error) {
|
|
14562
|
-
console.error("Error creating scheduled task:", error);
|
|
14563
|
-
return {
|
|
14564
|
-
success: false,
|
|
14565
|
-
error: error instanceof Error ? error.message : String(error)
|
|
14566
|
-
};
|
|
14567
|
-
}
|
|
14568
|
-
};
|
|
14734
|
+
// src/agent/tools/telegram/index.ts
|
|
14735
|
+
var tools15 = [
|
|
14736
|
+
...tools,
|
|
14737
|
+
...tools2,
|
|
14738
|
+
...tools3,
|
|
14739
|
+
...tools4,
|
|
14740
|
+
...tools5,
|
|
14741
|
+
...tools6,
|
|
14742
|
+
...tools7,
|
|
14743
|
+
...tools8,
|
|
14744
|
+
...tools9,
|
|
14745
|
+
...tools10,
|
|
14746
|
+
...tools11,
|
|
14747
|
+
...tools12,
|
|
14748
|
+
...tools13,
|
|
14749
|
+
...tools14
|
|
14750
|
+
];
|
|
14569
14751
|
|
|
14570
14752
|
// src/agent/tools/ton/get-address.ts
|
|
14571
14753
|
import { Type as Type72 } from "@sinclair/typebox";
|
|
@@ -15196,6 +15378,16 @@ var tonMyTransactionsExecutor = async (params, context) => {
|
|
|
15196
15378
|
}
|
|
15197
15379
|
};
|
|
15198
15380
|
|
|
15381
|
+
// src/agent/tools/ton/index.ts
|
|
15382
|
+
var tools16 = [
|
|
15383
|
+
{ tool: tonSendTool, executor: tonSendExecutor, scope: "dm-only" },
|
|
15384
|
+
{ tool: tonGetAddressTool, executor: tonGetAddressExecutor },
|
|
15385
|
+
{ tool: tonGetBalanceTool, executor: tonGetBalanceExecutor },
|
|
15386
|
+
{ tool: tonPriceTool, executor: tonPriceExecutor },
|
|
15387
|
+
{ tool: tonGetTransactionsTool, executor: tonGetTransactionsExecutor },
|
|
15388
|
+
{ tool: tonMyTransactionsTool, executor: tonMyTransactionsExecutor }
|
|
15389
|
+
];
|
|
15390
|
+
|
|
15199
15391
|
// src/agent/tools/dns/check.ts
|
|
15200
15392
|
import { Type as Type78 } from "@sinclair/typebox";
|
|
15201
15393
|
var dnsCheckTool = {
|
|
@@ -15892,6 +16084,17 @@ var dnsUnlinkExecutor = async (params, context) => {
|
|
|
15892
16084
|
}
|
|
15893
16085
|
};
|
|
15894
16086
|
|
|
16087
|
+
// src/agent/tools/dns/index.ts
|
|
16088
|
+
var tools17 = [
|
|
16089
|
+
{ tool: dnsStartAuctionTool, executor: dnsStartAuctionExecutor, scope: "dm-only" },
|
|
16090
|
+
{ tool: dnsBidTool, executor: dnsBidExecutor, scope: "dm-only" },
|
|
16091
|
+
{ tool: dnsLinkTool, executor: dnsLinkExecutor, scope: "dm-only" },
|
|
16092
|
+
{ tool: dnsUnlinkTool, executor: dnsUnlinkExecutor, scope: "dm-only" },
|
|
16093
|
+
{ tool: dnsCheckTool, executor: dnsCheckExecutor },
|
|
16094
|
+
{ tool: dnsAuctionsTool, executor: dnsAuctionsExecutor },
|
|
16095
|
+
{ tool: dnsResolveTool, executor: dnsResolveExecutor }
|
|
16096
|
+
];
|
|
16097
|
+
|
|
15895
16098
|
// src/agent/tools/jetton/balances.ts
|
|
15896
16099
|
import { Type as Type85 } from "@sinclair/typebox";
|
|
15897
16100
|
var jettonBalancesTool = {
|
|
@@ -20402,6 +20605,21 @@ var jettonPoolsExecutor = async (params, context) => {
|
|
|
20402
20605
|
}
|
|
20403
20606
|
};
|
|
20404
20607
|
|
|
20608
|
+
// src/agent/tools/jetton/index.ts
|
|
20609
|
+
var tools18 = [
|
|
20610
|
+
{ tool: jettonSwapTool, executor: jettonSwapExecutor, scope: "dm-only" },
|
|
20611
|
+
{ tool: jettonSendTool, executor: jettonSendExecutor, scope: "dm-only" },
|
|
20612
|
+
{ tool: jettonBalancesTool, executor: jettonBalancesExecutor },
|
|
20613
|
+
{ tool: jettonInfoTool, executor: jettonInfoExecutor },
|
|
20614
|
+
{ tool: jettonPriceTool, executor: jettonPriceExecutor },
|
|
20615
|
+
{ tool: jettonSearchTool, executor: jettonSearchExecutor },
|
|
20616
|
+
{ tool: jettonQuoteTool, executor: jettonQuoteExecutor },
|
|
20617
|
+
{ tool: jettonHoldersTool, executor: jettonHoldersExecutor },
|
|
20618
|
+
{ tool: jettonHistoryTool, executor: jettonHistoryExecutor },
|
|
20619
|
+
{ tool: jettonTrendingTool, executor: jettonTrendingExecutor },
|
|
20620
|
+
{ tool: jettonPoolsTool, executor: jettonPoolsExecutor }
|
|
20621
|
+
];
|
|
20622
|
+
|
|
20405
20623
|
// src/agent/tools/dedust/quote.ts
|
|
20406
20624
|
import { Type as Type96 } from "@sinclair/typebox";
|
|
20407
20625
|
import { TonClient as TonClient13, toNano as toNano22, fromNano as fromNano5 } from "@ton/ton";
|
|
@@ -20856,6 +21074,13 @@ var dedustPoolsExecutor = async (params, context) => {
|
|
|
20856
21074
|
}
|
|
20857
21075
|
};
|
|
20858
21076
|
|
|
21077
|
+
// src/agent/tools/dedust/index.ts
|
|
21078
|
+
var tools19 = [
|
|
21079
|
+
{ tool: dedustSwapTool, executor: dedustSwapExecutor, scope: "dm-only" },
|
|
21080
|
+
{ tool: dedustQuoteTool, executor: dedustQuoteExecutor },
|
|
21081
|
+
{ tool: dedustPoolsTool, executor: dedustPoolsExecutor }
|
|
21082
|
+
];
|
|
21083
|
+
|
|
20859
21084
|
// src/agent/tools/dex/smart-quote.ts
|
|
20860
21085
|
import { Type as Type99 } from "@sinclair/typebox";
|
|
20861
21086
|
import { TonClient as TonClient15, toNano as toNano24, fromNano as fromNano7 } from "@ton/ton";
|
|
@@ -21453,6 +21678,12 @@ var dexSwapExecutor = async (params, context) => {
|
|
|
21453
21678
|
}
|
|
21454
21679
|
};
|
|
21455
21680
|
|
|
21681
|
+
// src/agent/tools/dex/index.ts
|
|
21682
|
+
var tools20 = [
|
|
21683
|
+
{ tool: dexSwapTool, executor: dexSwapExecutor, scope: "dm-only" },
|
|
21684
|
+
{ tool: dexQuoteTool, executor: dexQuoteExecutor }
|
|
21685
|
+
];
|
|
21686
|
+
|
|
21456
21687
|
// src/agent/tools/journal/log.ts
|
|
21457
21688
|
import { Type as Type101 } from "@sinclair/typebox";
|
|
21458
21689
|
var journalLogTool = {
|
|
@@ -21802,6 +22033,13 @@ var journalUpdateExecutor = async (params) => {
|
|
|
21802
22033
|
};
|
|
21803
22034
|
};
|
|
21804
22035
|
|
|
22036
|
+
// src/agent/tools/journal/index.ts
|
|
22037
|
+
var tools21 = [
|
|
22038
|
+
{ tool: journalLogTool, executor: journalLogExecutor, scope: "dm-only" },
|
|
22039
|
+
{ tool: journalUpdateTool, executor: journalUpdateExecutor, scope: "dm-only" },
|
|
22040
|
+
{ tool: journalQueryTool, executor: journalQueryExecutor }
|
|
22041
|
+
];
|
|
22042
|
+
|
|
21805
22043
|
// src/agent/tools/workspace/list.ts
|
|
21806
22044
|
import { Type as Type104 } from "@sinclair/typebox";
|
|
21807
22045
|
import { readdirSync as readdirSync3, lstatSync as lstatSync2 } from "fs";
|
|
@@ -22371,124 +22609,33 @@ var workspaceRenameExecutor = async (params, _context) => {
|
|
|
22371
22609
|
}
|
|
22372
22610
|
};
|
|
22373
22611
|
|
|
22612
|
+
// src/agent/tools/workspace/index.ts
|
|
22613
|
+
var tools22 = [
|
|
22614
|
+
{ tool: workspaceWriteTool, executor: workspaceWriteExecutor, scope: "dm-only" },
|
|
22615
|
+
{ tool: workspaceDeleteTool, executor: workspaceDeleteExecutor, scope: "dm-only" },
|
|
22616
|
+
{ tool: workspaceRenameTool, executor: workspaceRenameExecutor, scope: "dm-only" },
|
|
22617
|
+
{ tool: workspaceListTool, executor: workspaceListExecutor },
|
|
22618
|
+
{ tool: workspaceReadTool, executor: workspaceReadExecutor },
|
|
22619
|
+
{ tool: workspaceInfoTool, executor: workspaceInfoExecutor }
|
|
22620
|
+
];
|
|
22621
|
+
|
|
22374
22622
|
// src/agent/tools/register-all.ts
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
registry.register(telegramSendGifTool, telegramSendGifExecutor);
|
|
22392
|
-
registry.register(telegramCreatePollTool, telegramCreatePollExecutor);
|
|
22393
|
-
registry.register(telegramCreateQuizTool, telegramCreateQuizExecutor);
|
|
22394
|
-
registry.register(telegramReplyKeyboardTool, telegramReplyKeyboardExecutor);
|
|
22395
|
-
registry.register(telegramSearchStickersTool, telegramSearchStickersExecutor);
|
|
22396
|
-
registry.register(telegramGetMyStickersTool, telegramGetMyStickersExecutor);
|
|
22397
|
-
registry.register(telegramSearchGifsTool, telegramSearchGifsExecutor);
|
|
22398
|
-
registry.register(telegramAddStickerSetTool, telegramAddStickerSetExecutor);
|
|
22399
|
-
registry.register(telegramGetHistoryTool, telegramGetHistoryExecutor);
|
|
22400
|
-
registry.register(telegramGetDialogsTool, telegramGetDialogsExecutor);
|
|
22401
|
-
registry.register(telegramMarkAsReadTool, telegramMarkAsReadExecutor);
|
|
22402
|
-
registry.register(telegramGetChatInfoTool, telegramGetChatInfoExecutor);
|
|
22403
|
-
registry.register(telegramJoinChannelTool, telegramJoinChannelExecutor, "dm-only");
|
|
22404
|
-
registry.register(telegramLeaveChannelTool, telegramLeaveChannelExecutor, "dm-only");
|
|
22405
|
-
registry.register(telegramGetMeTool, telegramGetMeExecutor);
|
|
22406
|
-
registry.register(telegramGetParticipantsTool, telegramGetParticipantsExecutor);
|
|
22407
|
-
registry.register(telegramKickUserTool, telegramKickUserExecutor, "group-only");
|
|
22408
|
-
registry.register(telegramBanUserTool, telegramBanUserExecutor, "group-only");
|
|
22409
|
-
registry.register(telegramUnbanUserTool, telegramUnbanUserExecutor, "group-only");
|
|
22410
|
-
registry.register(telegramCreateGroupTool, telegramCreateGroupExecutor, "dm-only");
|
|
22411
|
-
registry.register(telegramSetChatPhotoTool, telegramSetChatPhotoExecutor, "group-only");
|
|
22412
|
-
registry.register(telegramBlockUserTool, telegramBlockUserExecutor, "dm-only");
|
|
22413
|
-
registry.register(telegramGetBlockedTool, telegramGetBlockedExecutor, "dm-only");
|
|
22414
|
-
registry.register(telegramGetCommonChatsTool, telegramGetCommonChatsExecutor);
|
|
22415
|
-
registry.register(telegramSendStoryTool, telegramSendStoryExecutor, "dm-only");
|
|
22416
|
-
registry.register(telegramGetFoldersTool, telegramGetFoldersExecutor);
|
|
22417
|
-
registry.register(telegramCreateFolderTool, telegramCreateFolderExecutor);
|
|
22418
|
-
registry.register(telegramAddChatToFolderTool, telegramAddChatToFolderExecutor);
|
|
22419
|
-
registry.register(telegramCreateChannelTool, telegramCreateChannelExecutor, "dm-only");
|
|
22420
|
-
registry.register(telegramUpdateProfileTool, telegramUpdateProfileExecutor, "dm-only");
|
|
22421
|
-
registry.register(telegramSetBioTool, telegramSetBioExecutor, "dm-only");
|
|
22422
|
-
registry.register(telegramSetUsernameTool, telegramSetUsernameExecutor, "dm-only");
|
|
22423
|
-
registry.register(telegramDeleteMessageTool, telegramDeleteMessageExecutor);
|
|
22424
|
-
registry.register(telegramDownloadMediaTool, telegramDownloadMediaExecutor);
|
|
22425
|
-
registry.register(visionAnalyzeTool, visionAnalyzeExecutor);
|
|
22426
|
-
registry.register(telegramGetStarsBalanceTool, telegramGetStarsBalanceExecutor, "dm-only");
|
|
22427
|
-
registry.register(
|
|
22428
|
-
telegramGetStarsTransactionsTool,
|
|
22429
|
-
telegramGetStarsTransactionsExecutor,
|
|
22430
|
-
"dm-only"
|
|
22431
|
-
);
|
|
22432
|
-
registry.register(telegramGetAvailableGiftsTool, telegramGetAvailableGiftsExecutor);
|
|
22433
|
-
registry.register(telegramSendGiftTool, telegramSendGiftExecutor, "dm-only");
|
|
22434
|
-
registry.register(telegramGetMyGiftsTool, telegramGetMyGiftsExecutor);
|
|
22435
|
-
registry.register(
|
|
22436
|
-
telegramTransferCollectibleTool,
|
|
22437
|
-
telegramTransferCollectibleExecutor,
|
|
22438
|
-
"dm-only"
|
|
22439
|
-
);
|
|
22440
|
-
registry.register(
|
|
22441
|
-
telegramSetCollectiblePriceTool,
|
|
22442
|
-
telegramSetCollectiblePriceExecutor,
|
|
22443
|
-
"dm-only"
|
|
22444
|
-
);
|
|
22445
|
-
registry.register(telegramGetResaleGiftsTool, telegramGetResaleGiftsExecutor);
|
|
22446
|
-
registry.register(telegramBuyResaleGiftTool, telegramBuyResaleGiftExecutor, "dm-only");
|
|
22447
|
-
registry.register(telegramSetGiftStatusTool, telegramSetGiftStatusExecutor, "dm-only");
|
|
22448
|
-
registry.register(memoryWriteTool, memoryWriteExecutor, "dm-only");
|
|
22449
|
-
registry.register(memoryReadTool, memoryReadExecutor);
|
|
22450
|
-
registry.register(telegramGetUserInfoTool, telegramGetUserInfoExecutor);
|
|
22451
|
-
registry.register(telegramCheckUsernameTool, telegramCheckUsernameExecutor);
|
|
22452
|
-
registry.register(telegramEditChannelInfoTool, telegramEditChannelInfoExecutor, "dm-only");
|
|
22453
|
-
registry.register(telegramInviteToChannelTool, telegramInviteToChannelExecutor, "dm-only");
|
|
22454
|
-
registry.register(tonGetAddressTool, tonGetAddressExecutor);
|
|
22455
|
-
registry.register(tonGetBalanceTool, tonGetBalanceExecutor);
|
|
22456
|
-
registry.register(tonPriceTool, tonPriceExecutor);
|
|
22457
|
-
registry.register(tonSendTool, tonSendExecutor, "dm-only");
|
|
22458
|
-
registry.register(tonGetTransactionsTool, tonGetTransactionsExecutor);
|
|
22459
|
-
registry.register(tonMyTransactionsTool, tonMyTransactionsExecutor);
|
|
22460
|
-
registry.register(jettonBalancesTool, jettonBalancesExecutor);
|
|
22461
|
-
registry.register(jettonSwapTool, jettonSwapExecutor, "dm-only");
|
|
22462
|
-
registry.register(jettonSendTool, jettonSendExecutor, "dm-only");
|
|
22463
|
-
registry.register(jettonInfoTool, jettonInfoExecutor);
|
|
22464
|
-
registry.register(jettonPriceTool, jettonPriceExecutor);
|
|
22465
|
-
registry.register(jettonSearchTool, jettonSearchExecutor);
|
|
22466
|
-
registry.register(jettonQuoteTool, jettonQuoteExecutor);
|
|
22467
|
-
registry.register(jettonHoldersTool, jettonHoldersExecutor);
|
|
22468
|
-
registry.register(jettonHistoryTool, jettonHistoryExecutor);
|
|
22469
|
-
registry.register(jettonTrendingTool, jettonTrendingExecutor);
|
|
22470
|
-
registry.register(jettonPoolsTool, jettonPoolsExecutor);
|
|
22471
|
-
registry.register(dnsCheckTool, dnsCheckExecutor);
|
|
22472
|
-
registry.register(dnsAuctionsTool, dnsAuctionsExecutor);
|
|
22473
|
-
registry.register(dnsResolveTool, dnsResolveExecutor);
|
|
22474
|
-
registry.register(dnsStartAuctionTool, dnsStartAuctionExecutor, "dm-only");
|
|
22475
|
-
registry.register(dnsBidTool, dnsBidExecutor, "dm-only");
|
|
22476
|
-
registry.register(dnsLinkTool, dnsLinkExecutor, "dm-only");
|
|
22477
|
-
registry.register(dnsUnlinkTool, dnsUnlinkExecutor, "dm-only");
|
|
22478
|
-
registry.register(dedustQuoteTool, dedustQuoteExecutor);
|
|
22479
|
-
registry.register(dedustSwapTool, dedustSwapExecutor, "dm-only");
|
|
22480
|
-
registry.register(dedustPoolsTool, dedustPoolsExecutor);
|
|
22481
|
-
registry.register(dexQuoteTool, dexQuoteExecutor);
|
|
22482
|
-
registry.register(dexSwapTool, dexSwapExecutor, "dm-only");
|
|
22483
|
-
registry.register(journalLogTool, journalLogExecutor, "dm-only");
|
|
22484
|
-
registry.register(journalQueryTool, journalQueryExecutor);
|
|
22485
|
-
registry.register(journalUpdateTool, journalUpdateExecutor, "dm-only");
|
|
22486
|
-
registry.register(workspaceListTool, workspaceListExecutor);
|
|
22487
|
-
registry.register(workspaceReadTool, workspaceReadExecutor);
|
|
22488
|
-
registry.register(workspaceWriteTool, workspaceWriteExecutor, "dm-only");
|
|
22489
|
-
registry.register(workspaceDeleteTool, workspaceDeleteExecutor, "dm-only");
|
|
22490
|
-
registry.register(workspaceInfoTool, workspaceInfoExecutor);
|
|
22491
|
-
registry.register(workspaceRenameTool, workspaceRenameExecutor, "dm-only");
|
|
22623
|
+
var ALL_CATEGORIES = [
|
|
22624
|
+
tools15,
|
|
22625
|
+
tools16,
|
|
22626
|
+
tools17,
|
|
22627
|
+
tools18,
|
|
22628
|
+
tools19,
|
|
22629
|
+
tools20,
|
|
22630
|
+
tools21,
|
|
22631
|
+
tools22
|
|
22632
|
+
];
|
|
22633
|
+
function registerAllTools(registry) {
|
|
22634
|
+
for (const category of ALL_CATEGORIES) {
|
|
22635
|
+
for (const { tool, executor, scope } of category) {
|
|
22636
|
+
registry.register(tool, executor, scope);
|
|
22637
|
+
}
|
|
22638
|
+
}
|
|
22492
22639
|
}
|
|
22493
22640
|
|
|
22494
22641
|
// src/agent/tools/plugin-loader.ts
|
|
@@ -23773,8 +23920,8 @@ function loadModules(registry, config, db3) {
|
|
|
23773
23920
|
try {
|
|
23774
23921
|
mod.configure?.(config);
|
|
23775
23922
|
mod.migrate?.(db3);
|
|
23776
|
-
const
|
|
23777
|
-
for (const { tool, executor, scope } of
|
|
23923
|
+
const tools23 = mod.tools(config);
|
|
23924
|
+
for (const { tool, executor, scope } of tools23) {
|
|
23778
23925
|
registry.register(tool, executor, scope);
|
|
23779
23926
|
}
|
|
23780
23927
|
loaded.push(mod);
|
|
@@ -23805,7 +23952,7 @@ var TonnetApp = class {
|
|
|
23805
23952
|
}
|
|
23806
23953
|
const soul = loadSoul();
|
|
23807
23954
|
this.toolRegistry = new ToolRegistry();
|
|
23808
|
-
registerAllTools(this.toolRegistry
|
|
23955
|
+
registerAllTools(this.toolRegistry);
|
|
23809
23956
|
this.agent = new AgentRuntime(this.config, soul, this.toolRegistry);
|
|
23810
23957
|
this.bridge = new TelegramBridge({
|
|
23811
23958
|
apiId: this.config.telegram.api_id,
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED