teleton 0.1.4 → 0.1.5
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 +2 -2
- package/dist/{chunk-PMX75DTX.js → chunk-SRD47SJG.js} +6 -2
- package/dist/{chunk-E2NXSWOS.js → chunk-UR2LQEKR.js} +1 -3
- package/dist/{chunk-TQBJNXWV.js → chunk-VMX3ZDFW.js} +72 -101
- package/dist/cli/index.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{memory-S5CXFPBT.js → memory-FRH62ICY.js} +2 -2
- package/dist/{migrate-ML4GQEHR.js → migrate-EQUZY7QH.js} +2 -2
- package/dist/{tasks-XBYFDGAA.js → tasks-NUFMZNV5.js} +1 -1
- package/package.json +4 -3
- package/scripts/patch-gramjs.sh +46 -0
- package/scripts/postinstall.mjs +16 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">Teleton Agent</h1>
|
|
2
2
|
|
|
3
|
-
<p align="center"><b>
|
|
3
|
+
<p align="center"><b>Autonomous AI agent for Telegram with native TON blockchain integration</b></p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
@@ -233,7 +233,7 @@ The agent's personality and rules are configured via markdown files in `~/.telet
|
|
|
233
233
|
### Project Structure
|
|
234
234
|
|
|
235
235
|
```
|
|
236
|
-
|
|
236
|
+
teleton-agent/
|
|
237
237
|
├── src/
|
|
238
238
|
│ ├── index.ts # Main app, tool registry
|
|
239
239
|
│ ├── agent/ # Core agent runtime
|
|
@@ -1354,7 +1354,9 @@ var MessageStore = class {
|
|
|
1354
1354
|
ensureChat(chatId, isGroup = false) {
|
|
1355
1355
|
const existing = this.db.prepare(`SELECT id FROM tg_chats WHERE id = ?`).get(chatId);
|
|
1356
1356
|
if (!existing) {
|
|
1357
|
-
this.db.prepare(
|
|
1357
|
+
this.db.prepare(
|
|
1358
|
+
`INSERT INTO tg_chats (id, type, is_monitored) VALUES (?, ?, 1)`
|
|
1359
|
+
).run(chatId, isGroup ? "group" : "dm");
|
|
1358
1360
|
}
|
|
1359
1361
|
}
|
|
1360
1362
|
/**
|
|
@@ -1364,7 +1366,9 @@ var MessageStore = class {
|
|
|
1364
1366
|
if (!userId) return;
|
|
1365
1367
|
const existing = this.db.prepare(`SELECT id FROM tg_users WHERE id = ?`).get(userId);
|
|
1366
1368
|
if (!existing) {
|
|
1367
|
-
this.db.prepare(
|
|
1369
|
+
this.db.prepare(
|
|
1370
|
+
`INSERT INTO tg_users (id) VALUES (?)`
|
|
1371
|
+
).run(userId);
|
|
1368
1372
|
}
|
|
1369
1373
|
}
|
|
1370
1374
|
/**
|
|
@@ -241,9 +241,7 @@ var TaskStore = class {
|
|
|
241
241
|
`Cannot add dependency: would create circular dependency (${taskId} \u2192 ${parentTaskId})`
|
|
242
242
|
);
|
|
243
243
|
}
|
|
244
|
-
this.db.prepare(
|
|
245
|
-
`INSERT OR IGNORE INTO task_dependencies (task_id, depends_on_task_id) VALUES (?, ?)`
|
|
246
|
-
).run(taskId, parentTaskId);
|
|
244
|
+
this.db.prepare(`INSERT OR IGNORE INTO task_dependencies (task_id, depends_on_task_id) VALUES (?, ?)`).run(taskId, parentTaskId);
|
|
247
245
|
}
|
|
248
246
|
/**
|
|
249
247
|
* Get all tasks that this task depends on
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
fetchWithTimeout,
|
|
11
11
|
getDatabase,
|
|
12
12
|
initializeMemory
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SRD47SJG.js";
|
|
14
14
|
import {
|
|
15
15
|
ALLOWED_EXTENSIONS,
|
|
16
16
|
MAX_FILE_SIZES,
|
|
@@ -1076,13 +1076,11 @@ function getOrCreateSession(chatId) {
|
|
|
1076
1076
|
lastChannel: "telegram",
|
|
1077
1077
|
lastTo: chatId
|
|
1078
1078
|
};
|
|
1079
|
-
db.prepare(
|
|
1080
|
-
`
|
|
1079
|
+
db.prepare(`
|
|
1081
1080
|
INSERT INTO sessions (
|
|
1082
1081
|
id, chat_id, started_at, updated_at, message_count, last_channel, last_to
|
|
1083
1082
|
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
1084
|
-
`
|
|
1085
|
-
).run(
|
|
1083
|
+
`).run(
|
|
1086
1084
|
newSession.sessionId,
|
|
1087
1085
|
sessionKey,
|
|
1088
1086
|
newSession.createdAt,
|
|
@@ -1142,13 +1140,11 @@ function updateSession(chatId, update) {
|
|
|
1142
1140
|
updates.push("updated_at = ?");
|
|
1143
1141
|
values.push(Date.now());
|
|
1144
1142
|
values.push(sessionKey);
|
|
1145
|
-
db.prepare(
|
|
1146
|
-
`
|
|
1143
|
+
db.prepare(`
|
|
1147
1144
|
UPDATE sessions
|
|
1148
1145
|
SET ${updates.join(", ")}
|
|
1149
1146
|
WHERE chat_id = ?
|
|
1150
|
-
`
|
|
1151
|
-
).run(...values);
|
|
1147
|
+
`).run(...values);
|
|
1152
1148
|
const updated = db.prepare("SELECT * FROM sessions WHERE chat_id = ?").get(sessionKey);
|
|
1153
1149
|
return rowToSession(updated);
|
|
1154
1150
|
}
|
|
@@ -1175,13 +1171,11 @@ function resetSession(chatId) {
|
|
|
1175
1171
|
};
|
|
1176
1172
|
const db = getDb();
|
|
1177
1173
|
const sessionKey = `telegram:${chatId}`;
|
|
1178
|
-
db.prepare(
|
|
1179
|
-
`
|
|
1174
|
+
db.prepare(`
|
|
1180
1175
|
UPDATE sessions
|
|
1181
1176
|
SET id = ?, started_at = ?, updated_at = ?, message_count = 0
|
|
1182
1177
|
WHERE chat_id = ?
|
|
1183
|
-
`
|
|
1184
|
-
).run(newSession.sessionId, newSession.createdAt, newSession.updatedAt, sessionKey);
|
|
1178
|
+
`).run(newSession.sessionId, newSession.createdAt, newSession.updatedAt, sessionKey);
|
|
1185
1179
|
console.log(`\u{1F504} Session reset: ${oldSession?.sessionId} \u2192 ${newSession.sessionId}`);
|
|
1186
1180
|
return newSession;
|
|
1187
1181
|
}
|
|
@@ -1194,9 +1188,7 @@ function shouldResetSession(session, policy) {
|
|
|
1194
1188
|
const currentHour = (/* @__PURE__ */ new Date()).getHours();
|
|
1195
1189
|
const resetHour = policy.daily_reset_hour;
|
|
1196
1190
|
if (lastReset < today && currentHour >= resetHour) {
|
|
1197
|
-
console.log(
|
|
1198
|
-
`\u{1F4C5} Daily reset triggered for session ${session.sessionId} (last reset: ${lastReset})`
|
|
1199
|
-
);
|
|
1191
|
+
console.log(`\u{1F4C5} Daily reset triggered for session ${session.sessionId} (last reset: ${lastReset})`);
|
|
1200
1192
|
return true;
|
|
1201
1193
|
}
|
|
1202
1194
|
}
|
|
@@ -1206,9 +1198,7 @@ function shouldResetSession(session, policy) {
|
|
|
1206
1198
|
const idleMinutes = idleMs / (1e3 * 60);
|
|
1207
1199
|
const expiryMinutes = policy.idle_expiry_minutes;
|
|
1208
1200
|
if (idleMinutes >= expiryMinutes) {
|
|
1209
|
-
console.log(
|
|
1210
|
-
`\u23F1\uFE0F Idle expiry triggered for session ${session.sessionId} (idle: ${Math.floor(idleMinutes)}m)`
|
|
1211
|
-
);
|
|
1201
|
+
console.log(`\u23F1\uFE0F Idle expiry triggered for session ${session.sessionId} (idle: ${Math.floor(idleMinutes)}m)`);
|
|
1212
1202
|
return true;
|
|
1213
1203
|
}
|
|
1214
1204
|
}
|
|
@@ -2459,7 +2449,7 @@ function markdownToTelegramHtml(markdown) {
|
|
|
2459
2449
|
html = html.replace(listPattern, (match) => {
|
|
2460
2450
|
const index = blockquotes.length;
|
|
2461
2451
|
const lineCount = match.split("\n").length;
|
|
2462
|
-
|
|
2452
|
+
let content = match.replace(/\|\|([^|]+)\|\|/g, "<tg-spoiler>$1</tg-spoiler>").replace(/\*\*([^*]+)\*\*/g, "<b>$1</b>").replace(/__([^_]+)__/g, "<b>$1</b>").replace(/~~([^~]+)~~/g, "<s>$1</s>").replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, "<i>$1</i>").replace(/(?<!_)_([^_]+)_(?!_)/g, "<i>$1</i>").replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
2463
2453
|
const tag = lineCount >= 15 ? "<blockquote expandable>" : "<blockquote>";
|
|
2464
2454
|
blockquotes.push(`${tag}${content}</blockquote>`);
|
|
2465
2455
|
return `\0BLOCKQUOTE${index}\0`;
|
|
@@ -7500,12 +7490,7 @@ var telegramSetChatPhotoExecutor = async (params, context) => {
|
|
|
7500
7490
|
}
|
|
7501
7491
|
const fileBuffer = readFileSync10(validatedPath.absolutePath);
|
|
7502
7492
|
const file = await client.uploadFile({
|
|
7503
|
-
file: new CustomFile(
|
|
7504
|
-
validatedPath.filename,
|
|
7505
|
-
fileBuffer.length,
|
|
7506
|
-
validatedPath.absolutePath,
|
|
7507
|
-
fileBuffer
|
|
7508
|
-
),
|
|
7493
|
+
file: new CustomFile(validatedPath.filename, fileBuffer.length, validatedPath.absolutePath, fileBuffer),
|
|
7509
7494
|
workers: 1
|
|
7510
7495
|
});
|
|
7511
7496
|
if (isChannel) {
|
|
@@ -7825,15 +7810,7 @@ var telegramReplyKeyboardTool = {
|
|
|
7825
7810
|
};
|
|
7826
7811
|
var telegramReplyKeyboardExecutor = async (params, context) => {
|
|
7827
7812
|
try {
|
|
7828
|
-
const {
|
|
7829
|
-
chatId,
|
|
7830
|
-
text,
|
|
7831
|
-
buttons,
|
|
7832
|
-
oneTime = false,
|
|
7833
|
-
resize = true,
|
|
7834
|
-
selective = false,
|
|
7835
|
-
replyToId
|
|
7836
|
-
} = params;
|
|
7813
|
+
const { chatId, text, buttons, oneTime = false, resize = true, selective = false, replyToId } = params;
|
|
7837
7814
|
if (buttons.length === 0 || buttons.some((row) => row.length === 0)) {
|
|
7838
7815
|
return {
|
|
7839
7816
|
success: false,
|
|
@@ -8734,7 +8711,11 @@ var telegramGetAvailableGiftsTool = {
|
|
|
8734
8711
|
description: "Get all Star Gifts available for purchase. There are two types: LIMITED gifts (rare, can become collectibles, may sell out) and UNLIMITED gifts (always available). Use filter to see specific types. Returns gift ID, name, stars cost, and availability. Use the gift ID with telegram_send_gift to send one.",
|
|
8735
8712
|
parameters: Type47.Object({
|
|
8736
8713
|
filter: Type47.Optional(
|
|
8737
|
-
Type47.Union([
|
|
8714
|
+
Type47.Union([
|
|
8715
|
+
Type47.Literal("all"),
|
|
8716
|
+
Type47.Literal("limited"),
|
|
8717
|
+
Type47.Literal("unlimited")
|
|
8718
|
+
], {
|
|
8738
8719
|
description: "Filter gifts: 'all' (default), 'limited' (rare/collectible), 'unlimited' (always available)"
|
|
8739
8720
|
})
|
|
8740
8721
|
),
|
|
@@ -9278,9 +9259,7 @@ var telegramSetGiftStatusExecutor = async (params, context) => {
|
|
|
9278
9259
|
})
|
|
9279
9260
|
);
|
|
9280
9261
|
const action = clear ? "cleared" : "set";
|
|
9281
|
-
console.log(
|
|
9282
|
-
`\u2728 Emoji status ${action}${collectibleId ? ` (collectible: ${collectibleId})` : ""}`
|
|
9283
|
-
);
|
|
9262
|
+
console.log(`\u2728 Emoji status ${action}${collectibleId ? ` (collectible: ${collectibleId})` : ""}`);
|
|
9284
9263
|
return {
|
|
9285
9264
|
success: true,
|
|
9286
9265
|
data: {
|
|
@@ -10486,7 +10465,7 @@ var telegramCreateScheduledTaskExecutor = async (params, context) => {
|
|
|
10486
10465
|
error: "Database not available"
|
|
10487
10466
|
};
|
|
10488
10467
|
}
|
|
10489
|
-
const { getTaskStore } = await import("./tasks-
|
|
10468
|
+
const { getTaskStore } = await import("./tasks-NUFMZNV5.js");
|
|
10490
10469
|
const taskStore = getTaskStore(context.db);
|
|
10491
10470
|
const MAX_DEPENDENTS_PER_TASK = 10;
|
|
10492
10471
|
if (dependsOn && dependsOn.length > 0) {
|
|
@@ -12662,8 +12641,8 @@ var jettonQuoteExecutor = async (params, context) => {
|
|
|
12662
12641
|
const feeAmount = Number(feeUnits) / 10 ** askDecimals;
|
|
12663
12642
|
const rate = expectedOutput / amount;
|
|
12664
12643
|
const priceImpact = simulationResult.priceImpact || "0";
|
|
12665
|
-
|
|
12666
|
-
|
|
12644
|
+
let fromSymbol = isTonInput ? "TON" : "Token";
|
|
12645
|
+
let toSymbol = "Token";
|
|
12667
12646
|
const quote = {
|
|
12668
12647
|
from: fromAddress,
|
|
12669
12648
|
fromSymbol,
|
|
@@ -13285,7 +13264,14 @@ import { mnemonicToPrivateKey as mnemonicToPrivateKey9 } from "@ton/crypto";
|
|
|
13285
13264
|
import { WalletContractV5R1 as WalletContractV5R19, TonClient as TonClient12, toNano as toNano10, fromNano as fromNano5 } from "@ton/ton";
|
|
13286
13265
|
import { Address as Address10 } from "@ton/core";
|
|
13287
13266
|
import { getHttpEndpoint as getHttpEndpoint12 } from "@orbs-network/ton-access";
|
|
13288
|
-
import {
|
|
13267
|
+
import {
|
|
13268
|
+
Factory as Factory2,
|
|
13269
|
+
Asset as Asset2,
|
|
13270
|
+
PoolType as PoolType2,
|
|
13271
|
+
ReadinessStatus as ReadinessStatus2,
|
|
13272
|
+
JettonRoot,
|
|
13273
|
+
VaultJetton
|
|
13274
|
+
} from "@dedust/sdk";
|
|
13289
13275
|
var dedustSwapTool = {
|
|
13290
13276
|
name: "dedust_swap",
|
|
13291
13277
|
description: "Execute a token swap on DeDust DEX. Supports TON->Jetton and Jetton->TON/Jetton swaps. Use 'ton' as from_asset or to_asset for TON. Pool types: 'volatile' (default) or 'stable' (for stablecoins like USDT/USDC). Use dedust_quote first to preview the swap.",
|
|
@@ -13843,7 +13829,14 @@ import { Address as Address12, SendMode as SendMode8, internal as internal8 } fr
|
|
|
13843
13829
|
import { getHttpEndpoint as getHttpEndpoint14 } from "@orbs-network/ton-access";
|
|
13844
13830
|
import { StonApiClient as StonApiClient4 } from "@ston-fi/api";
|
|
13845
13831
|
import { DEX as DEX2, pTON as pTON2 } from "@ston-fi/sdk";
|
|
13846
|
-
import {
|
|
13832
|
+
import {
|
|
13833
|
+
Factory as Factory4,
|
|
13834
|
+
Asset as Asset4,
|
|
13835
|
+
PoolType as PoolType4,
|
|
13836
|
+
ReadinessStatus as ReadinessStatus4,
|
|
13837
|
+
JettonRoot as JettonRoot2,
|
|
13838
|
+
VaultJetton as VaultJetton2
|
|
13839
|
+
} from "@dedust/sdk";
|
|
13847
13840
|
var dexSwapTool = {
|
|
13848
13841
|
name: "dex_swap",
|
|
13849
13842
|
description: "Smart router that executes swap on the best DEX (STON.fi or DeDust). Automatically compares prices and routes to the DEX with better output. Use preferred_dex to force a specific DEX. Use 'ton' for TON or jetton master address.",
|
|
@@ -13866,9 +13859,12 @@ var dexSwapTool = {
|
|
|
13866
13859
|
})
|
|
13867
13860
|
),
|
|
13868
13861
|
preferred_dex: Type95.Optional(
|
|
13869
|
-
Type95.Union(
|
|
13870
|
-
|
|
13871
|
-
|
|
13862
|
+
Type95.Union(
|
|
13863
|
+
[Type95.Literal("stonfi"), Type95.Literal("dedust"), Type95.Literal("auto")],
|
|
13864
|
+
{
|
|
13865
|
+
description: "Preferred DEX: 'auto' (default, best price), 'stonfi', or 'dedust'"
|
|
13866
|
+
}
|
|
13867
|
+
)
|
|
13872
13868
|
)
|
|
13873
13869
|
})
|
|
13874
13870
|
};
|
|
@@ -14013,7 +14009,9 @@ async function executeDedustSwap(fromAsset, toAsset, amount, pool, minAmountOut,
|
|
|
14013
14009
|
});
|
|
14014
14010
|
const walletContract = tonClient.open(wallet);
|
|
14015
14011
|
const sender = walletContract.sender(keyPair.secretKey);
|
|
14016
|
-
const factory = tonClient.open(
|
|
14012
|
+
const factory = tonClient.open(
|
|
14013
|
+
Factory4.createFromAddress(Address12.parse(DEDUST_FACTORY_MAINNET))
|
|
14014
|
+
);
|
|
14017
14015
|
const amountIn = toNano12(amount);
|
|
14018
14016
|
if (isTonInput) {
|
|
14019
14017
|
const tonVault = tonClient.open(await factory.getNativeVault());
|
|
@@ -14413,9 +14411,7 @@ Examples:
|
|
|
14413
14411
|
[Type96.Literal("trade"), Type96.Literal("gift"), Type96.Literal("middleman"), Type96.Literal("kol")],
|
|
14414
14412
|
{ description: "Type of operation" }
|
|
14415
14413
|
),
|
|
14416
|
-
action: Type96.String({
|
|
14417
|
-
description: "Brief action description (e.g., 'buy', 'sell', 'swap', 'escrow', 'post')"
|
|
14418
|
-
}),
|
|
14414
|
+
action: Type96.String({ description: "Brief action description (e.g., 'buy', 'sell', 'swap', 'escrow', 'post')" }),
|
|
14419
14415
|
asset_from: Type96.Optional(
|
|
14420
14416
|
Type96.String({ description: "Asset sent/sold (e.g., 'TON', 'USDT', 'Deluxe Heart')" })
|
|
14421
14417
|
),
|
|
@@ -14426,9 +14422,7 @@ Examples:
|
|
|
14426
14422
|
counterparty: Type96.Optional(
|
|
14427
14423
|
Type96.String({ description: "Username or ID of the other party (if applicable)" })
|
|
14428
14424
|
),
|
|
14429
|
-
platform: Type96.Optional(
|
|
14430
|
-
Type96.String({ description: "Platform used (e.g., 'STON.fi', 'Telegram', 'DeDust')" })
|
|
14431
|
-
),
|
|
14425
|
+
platform: Type96.Optional(Type96.String({ description: "Platform used (e.g., 'STON.fi', 'Telegram', 'DeDust')" })),
|
|
14432
14426
|
reasoning: Type96.String({
|
|
14433
14427
|
description: "WHY you took this action - explain your decision-making (this is CRITICAL for learning and auditing)"
|
|
14434
14428
|
}),
|
|
@@ -14444,9 +14438,7 @@ Examples:
|
|
|
14444
14438
|
{ description: "Outcome status (default: 'pending')" }
|
|
14445
14439
|
)
|
|
14446
14440
|
),
|
|
14447
|
-
tx_hash: Type96.Optional(
|
|
14448
|
-
Type96.String({ description: "Blockchain transaction hash (if applicable)" })
|
|
14449
|
-
)
|
|
14441
|
+
tx_hash: Type96.Optional(Type96.String({ description: "Blockchain transaction hash (if applicable)" }))
|
|
14450
14442
|
})
|
|
14451
14443
|
};
|
|
14452
14444
|
var journalLogExecutor = async (params, context) => {
|
|
@@ -14524,18 +14516,11 @@ Examples:
|
|
|
14524
14516
|
parameters: Type97.Object({
|
|
14525
14517
|
type: Type97.Optional(
|
|
14526
14518
|
Type97.Union(
|
|
14527
|
-
[
|
|
14528
|
-
Type97.Literal("trade"),
|
|
14529
|
-
Type97.Literal("gift"),
|
|
14530
|
-
Type97.Literal("middleman"),
|
|
14531
|
-
Type97.Literal("kol")
|
|
14532
|
-
],
|
|
14519
|
+
[Type97.Literal("trade"), Type97.Literal("gift"), Type97.Literal("middleman"), Type97.Literal("kol")],
|
|
14533
14520
|
{ description: "Filter by operation type" }
|
|
14534
14521
|
)
|
|
14535
14522
|
),
|
|
14536
|
-
asset: Type97.Optional(
|
|
14537
|
-
Type97.String({ description: "Filter by asset (e.g., 'TON', 'USDT', 'Deluxe Heart')" })
|
|
14538
|
-
),
|
|
14523
|
+
asset: Type97.Optional(Type97.String({ description: "Filter by asset (e.g., 'TON', 'USDT', 'Deluxe Heart')" })),
|
|
14539
14524
|
outcome: Type97.Optional(
|
|
14540
14525
|
Type97.Union(
|
|
14541
14526
|
[
|
|
@@ -14551,9 +14536,7 @@ Examples:
|
|
|
14551
14536
|
days: Type97.Optional(
|
|
14552
14537
|
Type97.Number({ description: "Limit to last N days (e.g., 7 for last week)", minimum: 1 })
|
|
14553
14538
|
),
|
|
14554
|
-
limit: Type97.Optional(
|
|
14555
|
-
Type97.Number({ description: "Max number of results (default: 20)", minimum: 1 })
|
|
14556
|
-
)
|
|
14539
|
+
limit: Type97.Optional(Type97.Number({ description: "Max number of results (default: 20)", minimum: 1 }))
|
|
14557
14540
|
})
|
|
14558
14541
|
};
|
|
14559
14542
|
var journalQueryExecutor = async (params) => {
|
|
@@ -14594,7 +14577,10 @@ var journalQueryExecutor = async (params) => {
|
|
|
14594
14577
|
].join("\n");
|
|
14595
14578
|
}
|
|
14596
14579
|
}
|
|
14597
|
-
const lines = [
|
|
14580
|
+
const lines = [
|
|
14581
|
+
`\u{1F4D6} Journal Entries (${entries.length} results)`,
|
|
14582
|
+
``
|
|
14583
|
+
];
|
|
14598
14584
|
if (summary) {
|
|
14599
14585
|
lines.push(summary);
|
|
14600
14586
|
}
|
|
@@ -14618,9 +14604,7 @@ var journalQueryExecutor = async (params) => {
|
|
|
14618
14604
|
}
|
|
14619
14605
|
if (entry.pnl_ton !== null && entry.pnl_ton !== void 0) {
|
|
14620
14606
|
const sign = entry.pnl_ton >= 0 ? "+" : "";
|
|
14621
|
-
lines.push(
|
|
14622
|
-
` P&L: ${sign}${entry.pnl_ton.toFixed(2)} TON (${sign}${entry.pnl_pct?.toFixed(1) ?? "?"}%)`
|
|
14623
|
-
);
|
|
14607
|
+
lines.push(` P&L: ${sign}${entry.pnl_ton.toFixed(2)} TON (${sign}${entry.pnl_pct?.toFixed(1) ?? "?"}%)`);
|
|
14624
14608
|
}
|
|
14625
14609
|
if (entry.reasoning) {
|
|
14626
14610
|
lines.push(` _"${entry.reasoning}"_`);
|
|
@@ -14673,9 +14657,7 @@ Examples:
|
|
|
14673
14657
|
{ description: "Update outcome status" }
|
|
14674
14658
|
)
|
|
14675
14659
|
),
|
|
14676
|
-
pnl_ton: Type98.Optional(
|
|
14677
|
-
Type98.Number({ description: "Profit/loss in TON (positive = profit, negative = loss)" })
|
|
14678
|
-
),
|
|
14660
|
+
pnl_ton: Type98.Optional(Type98.Number({ description: "Profit/loss in TON (positive = profit, negative = loss)" })),
|
|
14679
14661
|
pnl_pct: Type98.Optional(Type98.Number({ description: "Profit/loss percentage" })),
|
|
14680
14662
|
tx_hash: Type98.Optional(Type98.String({ description: "Add or update transaction hash" }))
|
|
14681
14663
|
})
|
|
@@ -14882,21 +14864,7 @@ var workspaceReadExecutor = async (params, _context) => {
|
|
|
14882
14864
|
error: `File too large: ${stats.size} bytes exceeds limit of ${maxSize} bytes`
|
|
14883
14865
|
};
|
|
14884
14866
|
}
|
|
14885
|
-
const textExtensions = [
|
|
14886
|
-
".md",
|
|
14887
|
-
".txt",
|
|
14888
|
-
".json",
|
|
14889
|
-
".csv",
|
|
14890
|
-
".yaml",
|
|
14891
|
-
".yml",
|
|
14892
|
-
".xml",
|
|
14893
|
-
".html",
|
|
14894
|
-
".css",
|
|
14895
|
-
".js",
|
|
14896
|
-
".ts",
|
|
14897
|
-
".py",
|
|
14898
|
-
".sh"
|
|
14899
|
-
];
|
|
14867
|
+
const textExtensions = [".md", ".txt", ".json", ".csv", ".yaml", ".yml", ".xml", ".html", ".css", ".js", ".ts", ".py", ".sh"];
|
|
14900
14868
|
const isTextFile = textExtensions.includes(validated.extension);
|
|
14901
14869
|
if (!isTextFile && encoding === "utf-8") {
|
|
14902
14870
|
return {
|
|
@@ -14911,10 +14879,7 @@ var workspaceReadExecutor = async (params, _context) => {
|
|
|
14911
14879
|
}
|
|
14912
14880
|
};
|
|
14913
14881
|
}
|
|
14914
|
-
const content = readFileSync14(
|
|
14915
|
-
validated.absolutePath,
|
|
14916
|
-
encoding === "base64" ? "base64" : "utf-8"
|
|
14917
|
-
);
|
|
14882
|
+
const content = readFileSync14(validated.absolutePath, encoding === "base64" ? "base64" : "utf-8");
|
|
14918
14883
|
return {
|
|
14919
14884
|
success: true,
|
|
14920
14885
|
data: {
|
|
@@ -14984,7 +14949,13 @@ Examples:
|
|
|
14984
14949
|
};
|
|
14985
14950
|
var workspaceWriteExecutor = async (params, _context) => {
|
|
14986
14951
|
try {
|
|
14987
|
-
const {
|
|
14952
|
+
const {
|
|
14953
|
+
path,
|
|
14954
|
+
content,
|
|
14955
|
+
encoding = "utf-8",
|
|
14956
|
+
append = false,
|
|
14957
|
+
createDirs = true
|
|
14958
|
+
} = params;
|
|
14988
14959
|
const validated = validateWritePath(path);
|
|
14989
14960
|
const parentDir = dirname7(validated.absolutePath);
|
|
14990
14961
|
if (createDirs && !existsSync14(parentDir)) {
|
|
@@ -19340,7 +19311,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
19340
19311
|
`\u26A0\uFE0F Tool count (${this.toolCount}) exceeds ${providerMeta.displayName} limit (${providerMeta.toolLimit})`
|
|
19341
19312
|
);
|
|
19342
19313
|
}
|
|
19343
|
-
const { migrateSessionsToDb } = await import("./migrate-
|
|
19314
|
+
const { migrateSessionsToDb } = await import("./migrate-EQUZY7QH.js");
|
|
19344
19315
|
migrateSessionsToDb();
|
|
19345
19316
|
const memory = initializeMemory({
|
|
19346
19317
|
database: {
|
|
@@ -19505,9 +19476,9 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
19505
19476
|
return;
|
|
19506
19477
|
}
|
|
19507
19478
|
const taskId = match[1];
|
|
19508
|
-
const { getTaskStore } = await import("./tasks-
|
|
19479
|
+
const { getTaskStore } = await import("./tasks-NUFMZNV5.js");
|
|
19509
19480
|
const { executeScheduledTask } = await import("./task-executor-YJWMBCEM.js");
|
|
19510
|
-
const { getDatabase: getDatabase2 } = await import("./memory-
|
|
19481
|
+
const { getDatabase: getDatabase2 } = await import("./memory-FRH62ICY.js");
|
|
19511
19482
|
const db = getDatabase2().getDb();
|
|
19512
19483
|
const taskStore = getTaskStore(db);
|
|
19513
19484
|
const task = taskStore.getTask(taskId);
|
|
@@ -19580,9 +19551,9 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
19580
19551
|
} catch (error) {
|
|
19581
19552
|
console.error("Error handling scheduled task:", error);
|
|
19582
19553
|
try {
|
|
19583
|
-
const { getTaskStore } = await import("./tasks-
|
|
19554
|
+
const { getTaskStore } = await import("./tasks-NUFMZNV5.js");
|
|
19584
19555
|
const { TaskDependencyResolver } = await import("./task-dependency-resolver-ZOPHT3CU.js");
|
|
19585
|
-
const { getDatabase: getDatabase2 } = await import("./memory-
|
|
19556
|
+
const { getDatabase: getDatabase2 } = await import("./memory-FRH62ICY.js");
|
|
19586
19557
|
const db = getDatabase2().getDb();
|
|
19587
19558
|
const taskStore = getTaskStore(db);
|
|
19588
19559
|
const match = message.text.match(/^\[TASK:([^\]]+)\]/);
|
package/dist/cli/index.js
CHANGED
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
saveWallet,
|
|
18
18
|
validateApiKeyFormat,
|
|
19
19
|
walletExists
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-VMX3ZDFW.js";
|
|
21
21
|
import "../chunk-B2PRMXOH.js";
|
|
22
22
|
import {
|
|
23
23
|
fetchWithTimeout
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
} from "../chunk-SRD47SJG.js";
|
|
25
|
+
import "../chunk-UR2LQEKR.js";
|
|
26
26
|
import {
|
|
27
27
|
TELETON_ROOT
|
|
28
28
|
} from "../chunk-WQ5TFRTG.js";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TonnetApp,
|
|
3
3
|
main
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VMX3ZDFW.js";
|
|
5
5
|
import "./chunk-B2PRMXOH.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-SRD47SJG.js";
|
|
7
|
+
import "./chunk-UR2LQEKR.js";
|
|
8
8
|
import "./chunk-WQ5TFRTG.js";
|
|
9
9
|
import "./chunk-ST5CO7TV.js";
|
|
10
10
|
import "./chunk-QMN6ZOA5.js";
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
runMigrations,
|
|
25
25
|
serializeEmbedding,
|
|
26
26
|
setSchemaVersion
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SRD47SJG.js";
|
|
28
28
|
import {
|
|
29
29
|
TaskStore,
|
|
30
30
|
getTaskStore
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-UR2LQEKR.js";
|
|
32
32
|
import "./chunk-ST5CO7TV.js";
|
|
33
33
|
import "./chunk-QMN6ZOA5.js";
|
|
34
34
|
import "./chunk-LJXYESJJ.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teleton",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Personal AI Agent for Telegram",
|
|
5
5
|
"author": "ZKProof (https://t.me/zkproof)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/",
|
|
31
31
|
"bin/",
|
|
32
|
+
"scripts/",
|
|
32
33
|
"src/templates/"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
45
46
|
"typecheck": "tsc --noEmit",
|
|
46
47
|
"prepublishOnly": "npm run build",
|
|
47
|
-
"postinstall": "
|
|
48
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
48
49
|
"prepare": "husky"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"@mariozechner/pi-ai": "^0.50.9",
|
|
54
55
|
"@orbs-network/ton-access": "^2.3.3",
|
|
55
56
|
"@sinclair/typebox": "^0.34.48",
|
|
56
|
-
"@ston-fi/api": "^0.30.0",
|
|
57
57
|
"@ston-fi/sdk": "^2.7.0",
|
|
58
58
|
"@ton/core": "^0.63.0",
|
|
59
59
|
"@ton/crypto": "^3.3.0",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"typescript": "^5.7.0"
|
|
83
83
|
},
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
+
"@ston-fi/api": "^0.30.0",
|
|
85
86
|
"edge-tts": "^1.0.1"
|
|
86
87
|
},
|
|
87
88
|
"engines": {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Patch GramJS TL schema to support KeyboardButtonStyle (Telegram layer 222)
|
|
3
|
+
# This adds colored button support for inline keyboards via MTProto.
|
|
4
|
+
#
|
|
5
|
+
# New constructors:
|
|
6
|
+
# keyboardButtonStyle#4fdd3430 - button color/style (bg_success, bg_danger, bg_primary)
|
|
7
|
+
# keyboardButtonCallback#e62bc960 - updated callback button with optional style field
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
# Resolve path: works for both local dev and global npm install
|
|
12
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
13
|
+
PKG_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
14
|
+
APITL="$PKG_ROOT/node_modules/telegram/tl/apiTl.js"
|
|
15
|
+
|
|
16
|
+
# Check if already patched
|
|
17
|
+
if grep -q "keyboardButtonStyle#4fdd3430" "$APITL" 2>/dev/null; then
|
|
18
|
+
echo "✅ GramJS TL schema already patched"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Check if file exists
|
|
23
|
+
if [ ! -f "$APITL" ]; then
|
|
24
|
+
echo "⚠️ GramJS not found at $APITL, skipping patch"
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Verify the old constructor exists (guards against GramJS version changes)
|
|
29
|
+
if ! grep -q "keyboardButtonCallback#35bbdb6b" "$APITL"; then
|
|
30
|
+
echo "⚠️ Old keyboardButtonCallback#35bbdb6b not found, GramJS version may have changed"
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Patch: replace old keyboardButtonCallback with:
|
|
35
|
+
# 1. keyboardButtonStyle type (new)
|
|
36
|
+
# 2. keyboardButtonCallbackLegacy (old constructor kept for deserialization)
|
|
37
|
+
# 3. keyboardButtonCallback (new constructor with style field)
|
|
38
|
+
sed -i 's|keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;|keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle;\nkeyboardButtonCallbackLegacy#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;\nkeyboardButtonCallback#e62bc960 flags:# requires_password:flags.0?true style:flags.10?KeyboardButtonStyle text:string data:bytes = KeyboardButton;|' "$APITL"
|
|
39
|
+
|
|
40
|
+
# Verify patch was applied
|
|
41
|
+
if grep -q "keyboardButtonStyle#4fdd3430" "$APITL"; then
|
|
42
|
+
echo "✅ GramJS TL schema patched (KeyboardButtonStyle + styled KeyboardButtonCallback)"
|
|
43
|
+
else
|
|
44
|
+
echo "❌ Failed to patch GramJS TL schema"
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Postinstall: patch GramJS TL schema + skip problematic dep scripts
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const root = dirname(__dirname);
|
|
9
|
+
const patchScript = join(root, "scripts", "patch-gramjs.sh");
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
execSync(`bash "${patchScript}"`, { stdio: "inherit", cwd: root });
|
|
13
|
+
} catch {
|
|
14
|
+
// Non-fatal: styled buttons won't work but everything else will
|
|
15
|
+
console.log("⚠️ GramJS patch skipped (styled buttons disabled)");
|
|
16
|
+
}
|