teleton 0.6.0 → 0.7.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.
Files changed (39) hide show
  1. package/README.md +26 -26
  2. package/dist/{chunk-D5I7GBV7.js → chunk-FNV5FF35.js} +22 -13
  3. package/dist/chunk-LRCPA7SC.js +149 -0
  4. package/dist/{chunk-ADCMUNYU.js → chunk-N3F7E7DR.js} +58 -53
  5. package/dist/chunk-ND2X5FWB.js +368 -0
  6. package/dist/chunk-NERLQY2H.js +421 -0
  7. package/dist/{chunk-YBA6IBGT.js → chunk-OCLG5GKI.js} +24 -24
  8. package/dist/{chunk-6L6KGATM.js → chunk-OGIG552S.js} +1397 -1688
  9. package/dist/chunk-RCMD3U65.js +141 -0
  10. package/dist/{chunk-4IPJ25HE.js → chunk-TCD4NZDA.js} +1045 -658
  11. package/dist/{chunk-ECSCVEQQ.js → chunk-UCN6TI25.js} +7 -3
  12. package/dist/{chunk-WL2Q3VRD.js → chunk-UDD7FYOU.js} +12 -4
  13. package/dist/chunk-VAUJSSD3.js +20 -0
  14. package/dist/chunk-XBE4JB7C.js +8 -0
  15. package/dist/{chunk-GDCODBNO.js → chunk-XBKSS6DM.js} +2 -16
  16. package/dist/cli/index.js +878 -433
  17. package/dist/client-3VWE7NC4.js +29 -0
  18. package/dist/{get-my-gifts-KVULMBJ3.js → get-my-gifts-RI7FAXAL.js} +3 -1
  19. package/dist/index.js +17 -11
  20. package/dist/{memory-TVDOGQXS.js → memory-RD7ZSTRV.js} +7 -5
  21. package/dist/{migrate-QIEMPOMT.js → migrate-GO4NOBT7.js} +14 -9
  22. package/dist/{server-RSWVCVY3.js → server-OWVEZTR3.js} +81 -84
  23. package/dist/setup-server-C7ZTPHD5.js +934 -0
  24. package/dist/{task-dependency-resolver-72DLY2HV.js → task-dependency-resolver-WKZWJLLM.js} +19 -15
  25. package/dist/{task-executor-VXB6DAV2.js → task-executor-PD3H4MLO.js} +4 -1
  26. package/dist/tool-adapter-Y3TCEQOC.js +145 -0
  27. package/dist/{tool-index-DKI2ZNOU.js → tool-index-MIVK3D7H.js} +14 -9
  28. package/dist/{transcript-7V4UNID4.js → transcript-UDJZP6NK.js} +2 -1
  29. package/dist/web/assets/complete-fZLnb5Ot.js +1 -0
  30. package/dist/web/assets/index-B_FcaX5D.css +1 -0
  31. package/dist/web/assets/index-CbeAP4_n.js +67 -0
  32. package/dist/web/assets/index.es-oXiZF7Hc.js +11 -0
  33. package/dist/web/assets/login-telegram-BP7CJDmx.js +1 -0
  34. package/dist/web/assets/run-DOrDowjK.js +1 -0
  35. package/dist/web/index.html +2 -2
  36. package/package.json +7 -3
  37. package/dist/chunk-2QUJLHCZ.js +0 -362
  38. package/dist/web/assets/index-BNhrx9S1.js +0 -67
  39. package/dist/web/assets/index-CqrrRLOh.css +0 -1
@@ -1,11 +1,15 @@
1
1
  import {
2
2
  TELETON_ROOT
3
3
  } from "./chunk-EYWNOHMJ.js";
4
+ import {
5
+ createLogger
6
+ } from "./chunk-RCMD3U65.js";
4
7
 
5
8
  // src/utils/module-db.ts
6
9
  import Database from "better-sqlite3";
7
10
  import { existsSync, mkdirSync, chmodSync } from "fs";
8
11
  import { dirname, join } from "path";
12
+ var log = createLogger("Utils");
9
13
  var JOURNAL_SCHEMA = `
10
14
  CREATE TABLE IF NOT EXISTS journal (
11
15
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -114,14 +118,14 @@ function migrateFromMainDb(moduleDb, tables) {
114
118
  moduleDb.exec(`DROP TABLE main_db.${table}`);
115
119
  } catch {
116
120
  }
117
- console.log(` \u{1F4E6} Migrated ${src.c} rows from memory.db \u2192 ${table} (source dropped)`);
121
+ log.info(`Migrated ${src.c} rows from memory.db \u2192 ${table} (source dropped)`);
118
122
  } catch (e) {
119
- console.warn(` \u26A0\uFE0F Could not migrate table ${table}:`, e);
123
+ log.warn({ err: e }, `Could not migrate table ${table}`);
120
124
  }
121
125
  }
122
126
  moduleDb.exec(`DETACH DATABASE main_db`);
123
127
  } catch (e) {
124
- console.warn(`\u26A0\uFE0F Migration from memory.db failed:`, e);
128
+ log.warn({ err: e }, `Migration from memory.db failed`);
125
129
  try {
126
130
  moduleDb.exec(`DETACH DATABASE main_db`);
127
131
  } catch {
@@ -1,6 +1,14 @@
1
+ import {
2
+ getErrorMessage
3
+ } from "./chunk-XBE4JB7C.js";
4
+ import {
5
+ createLogger
6
+ } from "./chunk-RCMD3U65.js";
7
+
1
8
  // src/agent/tools/telegram/gifts/get-my-gifts.ts
2
9
  import { Type } from "@sinclair/typebox";
3
10
  import { Api } from "telegram";
11
+ var log = createLogger("Tools");
4
12
  var giftCatalogCache = null;
5
13
  var CATALOG_CACHE_TTL_MS = 5 * 60 * 1e3;
6
14
  function extractEmoji(sticker) {
@@ -179,8 +187,8 @@ var telegramGetMyGiftsExecutor = async (params, context) => {
179
187
  const unlimited = gifts.filter((g) => !g.isLimited);
180
188
  const collectibles = gifts.filter((g) => g.isCollectible);
181
189
  const viewingLabel = viewSender ? `sender (${context.senderId})` : userId || "self";
182
- console.log(
183
- `\u{1F4E6} get_my_gifts: viewing ${viewingLabel}, found ${gifts.length} gifts (${collectibles.length} collectibles)`
190
+ log.info(
191
+ `get_my_gifts: viewing ${viewingLabel}, found ${gifts.length} gifts (${collectibles.length} collectibles)`
184
192
  );
185
193
  return {
186
194
  success: true,
@@ -198,10 +206,10 @@ var telegramGetMyGiftsExecutor = async (params, context) => {
198
206
  }
199
207
  };
200
208
  } catch (error) {
201
- console.error("Error getting gifts:", error);
209
+ log.error({ err: error }, "Error getting gifts");
202
210
  return {
203
211
  success: false,
204
- error: error instanceof Error ? error.message : String(error)
212
+ error: getErrorMessage(error)
205
213
  };
206
214
  }
207
215
  };
@@ -0,0 +1,20 @@
1
+ import {
2
+ DEFAULT_FETCH_TIMEOUT_MS
3
+ } from "./chunk-4DU3C27M.js";
4
+
5
+ // src/utils/fetch.ts
6
+ var DEFAULT_TIMEOUT_MS = DEFAULT_FETCH_TIMEOUT_MS;
7
+ function fetchWithTimeout(url, init) {
8
+ const { timeoutMs = DEFAULT_TIMEOUT_MS, ...fetchInit } = init ?? {};
9
+ if (fetchInit.signal) {
10
+ return fetch(url, fetchInit);
11
+ }
12
+ return fetch(url, {
13
+ ...fetchInit,
14
+ signal: AbortSignal.timeout(timeoutMs)
15
+ });
16
+ }
17
+
18
+ export {
19
+ fetchWithTimeout
20
+ };
@@ -0,0 +1,8 @@
1
+ // src/utils/errors.ts
2
+ function getErrorMessage(error) {
3
+ return error instanceof Error ? error.message : String(error);
4
+ }
5
+
6
+ export {
7
+ getErrorMessage
8
+ };
@@ -1,19 +1,6 @@
1
1
  import {
2
- DEFAULT_FETCH_TIMEOUT_MS
3
- } from "./chunk-4DU3C27M.js";
4
-
5
- // src/utils/fetch.ts
6
- var DEFAULT_TIMEOUT_MS = DEFAULT_FETCH_TIMEOUT_MS;
7
- function fetchWithTimeout(url, init) {
8
- const { timeoutMs = DEFAULT_TIMEOUT_MS, ...fetchInit } = init ?? {};
9
- if (fetchInit.signal) {
10
- return fetch(url, fetchInit);
11
- }
12
- return fetch(url, {
13
- ...fetchInit,
14
- signal: AbortSignal.timeout(timeoutMs)
15
- });
16
- }
2
+ fetchWithTimeout
3
+ } from "./chunk-VAUJSSD3.js";
17
4
 
18
5
  // src/constants/api-endpoints.ts
19
6
  var TONAPI_BASE_URL = "https://tonapi.io/v2";
@@ -60,7 +47,6 @@ var ELEVENLABS_TTS_URL = "https://api.elevenlabs.io/v1/text-to-speech";
60
47
  var VOYAGE_API_URL = "https://api.voyageai.com/v1";
61
48
 
62
49
  export {
63
- fetchWithTimeout,
64
50
  setTonapiKey,
65
51
  tonapiFetch,
66
52
  STONFI_API_BASE_URL,