teleton 0.8.4 → 0.8.6

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 (84) hide show
  1. package/README.md +40 -17
  2. package/dist/{bootstrap-NNEI3Z5H.js → bootstrap-PFBH6ALD.js} +11 -8
  3. package/dist/bridge-guards-HZTNH7IB.js +9 -0
  4. package/dist/{chunk-NH2CNRKJ.js → chunk-2UUGRY5B.js} +151 -159
  5. package/dist/{chunk-UMUONAD6.js → chunk-4MFN75ZK.js} +5941 -2716
  6. package/dist/{chunk-LC4TV3KL.js → chunk-4MG2AROG.js} +5 -7
  7. package/dist/{chunk-LZQOX6YY.js → chunk-6IFNQWIM.js} +7714 -8748
  8. package/dist/chunk-7KI25UJU.js +215 -0
  9. package/dist/chunk-AX5NBEHX.js +12 -0
  10. package/dist/{chunk-5LOHRZYY.js → chunk-BLUES3FJ.js} +80 -101
  11. package/dist/{chunk-CUE4UZXR.js → chunk-BT2I3ETV.js} +3 -3
  12. package/dist/chunk-CXTZPOTA.js +107 -0
  13. package/dist/{chunk-LVTKJQ7O.js → chunk-D3GT6YIY.js} +59 -7
  14. package/dist/chunk-EKCXKL5M.js +53 -0
  15. package/dist/{chunk-XDZDOKIF.js → chunk-F6S3L3OV.js} +3 -3
  16. package/dist/{chunk-C4NKJT2Z.js → chunk-J4WDJ7XS.js} +1 -1
  17. package/dist/{chunk-G7PCW63M.js → chunk-JYF2MM5I.js} +147 -113
  18. package/dist/{chunk-NVKBBTI6.js → chunk-K3QSIIMZ.js} +9 -6
  19. package/dist/{chunk-EYWNOHMJ.js → chunk-L653KKCR.js} +1 -0
  20. package/dist/chunk-OMQIAWEU.js +273 -0
  21. package/dist/chunk-PCT7GYBP.js +274 -0
  22. package/dist/chunk-QYZBWU2D.js +139 -0
  23. package/dist/{chunk-WTDAICGT.js → chunk-R6W4DJRK.js} +7 -7
  24. package/dist/{chunk-5SEMA47R.js → chunk-RILOEIK6.js} +1 -1
  25. package/dist/{chunk-6OOHHJ4N.js → chunk-TFTNZZDH.js} +20 -20
  26. package/dist/chunk-TTOZCZWE.js +96 -0
  27. package/dist/chunk-UJ54YT2T.js +12 -0
  28. package/dist/{chunk-GHMXWAXI.js → chunk-ULVL2W3D.js} +211 -445
  29. package/dist/{chunk-NQ6FZKCE.js → chunk-V3S3NXBQ.js} +3 -1
  30. package/dist/{chunk-H7MFXJZK.js → chunk-WSL4KIOI.js} +31 -26
  31. package/dist/{chunk-35MX4ZUI.js → chunk-Z5WY7BSB.js} +5 -5
  32. package/dist/{chunk-ALKAAG4O.js → chunk-ZGKE3OTA.js} +112 -49
  33. package/dist/{chunk-JROBTXWY.js → chunk-ZHRDETCX.js} +38 -4
  34. package/dist/cli/index.d.ts +2 -0
  35. package/dist/cli/index.js +272 -159
  36. package/dist/{client-5KD25NOP.js → client-S5UIK6OG.js} +10 -8
  37. package/dist/daily-logs-3WXGYAQF.js +25 -0
  38. package/dist/{get-my-gifts-Y7EN7RK4.js → get-my-gifts-3YSYM3LI.js} +3 -2
  39. package/dist/harden-permissions-PV5SGV5D.js +100 -0
  40. package/dist/index.d.ts +923 -0
  41. package/dist/index.js +29 -20
  42. package/dist/knowledge-RRWUIO3G.js +19 -0
  43. package/dist/{local-IHKJFQJS.js → local-MSZAXWUL.js} +3 -3
  44. package/dist/mcp-loader-OELDFR63.js +15 -0
  45. package/dist/{memory-QMJRM3XJ.js → memory-6U6HGRK2.js} +23 -12
  46. package/dist/memory-hook-T7Y235KY.js +19 -0
  47. package/dist/messages-KV5ADNJB.js +17 -0
  48. package/dist/{migrate-5VBAP52B.js → migrate-AX3HOKOO.js} +10 -7
  49. package/dist/{paths-XA2RJH4S.js → paths-WMVV7ZAJ.js} +1 -1
  50. package/dist/{server-WWGVDFPW.js → server-MFRYOGHR.js} +21 -23
  51. package/dist/{server-AJCOURH7.js → server-SFLCAZFR.js} +221 -27
  52. package/dist/{setup-server-VDY64CWW.js → setup-server-YWAPKZVE.js} +26 -26
  53. package/dist/{store-BY7S6IFN.js → store-PGHQASBC.js} +11 -8
  54. package/dist/{task-dependency-resolver-L6UUMTHK.js → task-dependency-resolver-YQKADDEU.js} +24 -10
  55. package/dist/{task-executor-XBNJLUCS.js → task-executor-LWAWD225.js} +4 -4
  56. package/dist/{tool-adapter-IVX2XQJE.js → tool-adapter-VKLUZSQS.js} +1 -1
  57. package/dist/{tool-index-FTERJSZK.js → tool-index-YEWDF5CK.js} +5 -5
  58. package/dist/{transcript-IM7G25OS.js → transcript-4Y3Z2BJ3.js} +3 -3
  59. package/dist/web/assets/Config-MNxA69ib.js +1 -0
  60. package/dist/web/assets/Conversations-Dk958paA.js +1 -0
  61. package/dist/web/assets/Dashboard-dM18fGOm.js +1 -0
  62. package/dist/web/assets/Hooks-D2griQnI.js +1 -0
  63. package/dist/web/assets/Mcp-CtWNzwsz.js +1 -0
  64. package/dist/web/assets/Memory-CfLwH45G.js +1 -0
  65. package/dist/web/assets/Plugins-3hoJprFo.js +1 -0
  66. package/dist/web/assets/SearchInput-CpcETdpE.js +1 -0
  67. package/dist/web/assets/Soul-BSxE73aK.js +1 -0
  68. package/dist/web/assets/Tasks-DkCkfu3A.js +1 -0
  69. package/dist/web/assets/TelegramSettingsPanel-BRzc5G6e.js +1 -0
  70. package/dist/web/assets/Tools-Du8B8Mb4.js +1 -0
  71. package/dist/web/assets/Wallet-BLILP2Gn.js +1 -0
  72. package/dist/web/assets/Workspace-qklcXpXV.js +1 -0
  73. package/dist/web/assets/index-BwEPTTKp.js +90 -0
  74. package/dist/web/assets/index-noejUsK7.css +1 -0
  75. package/dist/web/assets/{index.es-DitvF-9H.js → index.es-DdpKlnGb.js} +1 -1
  76. package/dist/web/assets/useToolManager-tdxkKn3H.js +1 -0
  77. package/dist/web/assets/utils-CnsbSMo4.js +1 -0
  78. package/dist/web/index.html +2 -2
  79. package/package.json +7 -12
  80. package/src/templates/HEARTBEAT.md +5 -0
  81. package/dist/memory-hook-VUNWZ3NY.js +0 -19
  82. package/dist/web/assets/index-BfYCdwLI.js +0 -80
  83. package/dist/web/assets/index-DmlyQVhR.css +0 -1
  84. package/dist/{chunk-WFTC3JJW.js → chunk-3NO7QU7W.js} +1 -1
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  getModelsForProvider
3
- } from "./chunk-WFTC3JJW.js";
3
+ } from "./chunk-3NO7QU7W.js";
4
4
  import {
5
5
  TonProxyManager,
6
- WorkspaceSecurityError,
7
6
  adaptPlugin,
8
7
  clearPromptCache,
9
8
  deletePluginSecret,
@@ -19,12 +18,8 @@ import {
19
18
  setPluginPriority,
20
19
  setTonProxyManager,
21
20
  setTriggersConfig,
22
- validateDirectory,
23
- validatePath,
24
- validateReadPath,
25
- validateWritePath,
26
21
  writePluginSecret
27
- } from "./chunk-LZQOX6YY.js";
22
+ } from "./chunk-6IFNQWIM.js";
28
23
  import {
29
24
  CONFIGURABLE_KEYS,
30
25
  deleteNestedValue,
@@ -35,29 +30,36 @@ import {
35
30
  setNestedValue,
36
31
  setToncenterApiKey,
37
32
  writeRawConfig
38
- } from "./chunk-JROBTXWY.js";
33
+ } from "./chunk-ZHRDETCX.js";
39
34
  import {
40
- getErrorMessage
41
- } from "./chunk-3UFPFWYP.js";
35
+ getTaskStore
36
+ } from "./chunk-4L66JHQE.js";
42
37
  import {
43
38
  setTonapiKey
44
39
  } from "./chunk-VFA7QMCZ.js";
40
+ import {
41
+ getErrorMessage
42
+ } from "./chunk-3UFPFWYP.js";
43
+ import {
44
+ WorkspaceSecurityError,
45
+ validateDirectory,
46
+ validatePath,
47
+ validateReadPath,
48
+ validateWritePath
49
+ } from "./chunk-PCT7GYBP.js";
45
50
  import {
46
51
  getProviderMetadata,
47
52
  validateApiKeyFormat
48
- } from "./chunk-6OOHHJ4N.js";
53
+ } from "./chunk-TFTNZZDH.js";
49
54
  import {
50
55
  WORKSPACE_PATHS,
51
56
  WORKSPACE_ROOT
52
- } from "./chunk-EYWNOHMJ.js";
57
+ } from "./chunk-L653KKCR.js";
53
58
  import {
54
59
  addLogListener,
55
60
  clearLogListeners,
56
61
  createLogger
57
- } from "./chunk-NQ6FZKCE.js";
58
- import {
59
- getTaskStore
60
- } from "./chunk-4L66JHQE.js";
62
+ } from "./chunk-V3S3NXBQ.js";
61
63
 
62
64
  // src/webui/log-interceptor.ts
63
65
  var LogInterceptor = class {
@@ -264,7 +266,15 @@ function createToolsRoutes(deps) {
264
266
  return c.json(response2, 404);
265
267
  }
266
268
  const { enabled, scope } = body;
267
- const VALID_SCOPES = ["always", "dm-only", "group-only", "admin-only"];
269
+ const VALID_SCOPES = [
270
+ "always",
271
+ "dm-only",
272
+ "group-only",
273
+ "admin-only",
274
+ "open",
275
+ "allowlist",
276
+ "disabled"
277
+ ];
268
278
  if (scope !== void 0 && !VALID_SCOPES.includes(scope)) {
269
279
  const response2 = {
270
280
  success: false,
@@ -283,10 +293,7 @@ function createToolsRoutes(deps) {
283
293
  }
284
294
  }
285
295
  if (scope !== void 0) {
286
- const success = deps.toolRegistry.updateToolScope(
287
- toolName,
288
- scope
289
- );
296
+ const success = deps.toolRegistry.updateToolScope(toolName, scope);
290
297
  if (!success) {
291
298
  const response2 = {
292
299
  success: false,
@@ -591,7 +598,7 @@ function createMemoryRoutes(deps) {
591
598
  import { Hono as Hono5 } from "hono";
592
599
  import { readFileSync, writeFileSync } from "fs";
593
600
  import { join } from "path";
594
- var SOUL_FILES = ["SOUL.md", "SECURITY.md", "STRATEGY.md", "MEMORY.md"];
601
+ var SOUL_FILES = ["SOUL.md", "SECURITY.md", "STRATEGY.md", "MEMORY.md", "HEARTBEAT.md"];
595
602
  function isSoulFile(filename) {
596
603
  return SOUL_FILES.includes(filename);
597
604
  }
@@ -694,8 +701,8 @@ function createPluginsRoutes(deps) {
694
701
  data[name] = priority;
695
702
  }
696
703
  return c.json({ success: true, data });
697
- } catch (err) {
698
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
704
+ } catch (error) {
705
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
699
706
  }
700
707
  });
701
708
  app.post("/priorities", async (c) => {
@@ -719,8 +726,8 @@ function createPluginsRoutes(deps) {
719
726
  success: true,
720
727
  data: { pluginName, priority }
721
728
  });
722
- } catch (err) {
723
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
729
+ } catch (error) {
730
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
724
731
  }
725
732
  });
726
733
  app.delete("/priorities/:name", (c) => {
@@ -728,8 +735,8 @@ function createPluginsRoutes(deps) {
728
735
  const name = c.req.param("name");
729
736
  resetPluginPriority(deps.memory.db, name);
730
737
  return c.json({ success: true, data: null });
731
- } catch (err) {
732
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
738
+ } catch (error) {
739
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
733
740
  }
734
741
  });
735
742
  return app;
@@ -855,7 +862,6 @@ function deriveServerName(pkg) {
855
862
  // src/webui/routes/workspace.ts
856
863
  import { Hono as Hono8 } from "hono";
857
864
  import {
858
- readFileSync as readFileSync2,
859
865
  writeFileSync as writeFileSync2,
860
866
  mkdirSync,
861
867
  rmSync,
@@ -864,6 +870,7 @@ import {
864
870
  statSync,
865
871
  existsSync
866
872
  } from "fs";
873
+ import { readFile } from "fs/promises";
867
874
  import { join as join2, relative } from "path";
868
875
  var MAX_SCAN_DEPTH = 10;
869
876
  var MAX_SCAN_ENTRIES = 5e3;
@@ -972,7 +979,7 @@ function createWorkspaceRoutes(_deps) {
972
979
  return errorResponse(c, error);
973
980
  }
974
981
  });
975
- app.get("/raw", (c) => {
982
+ app.get("/raw", async (c) => {
976
983
  try {
977
984
  const path = c.req.query("path");
978
985
  if (!path) {
@@ -996,7 +1003,7 @@ function createWorkspaceRoutes(_deps) {
996
1003
  };
997
1004
  return c.json(response, 413);
998
1005
  }
999
- const buffer = readFileSync2(validated.absolutePath);
1006
+ const buffer = await readFile(validated.absolutePath);
1000
1007
  const headers = {
1001
1008
  "Content-Type": mime,
1002
1009
  "Content-Length": String(buffer.byteLength),
@@ -1011,7 +1018,7 @@ function createWorkspaceRoutes(_deps) {
1011
1018
  return errorResponse(c, error);
1012
1019
  }
1013
1020
  });
1014
- app.get("/read", (c) => {
1021
+ app.get("/read", async (c) => {
1015
1022
  try {
1016
1023
  const path = c.req.query("path");
1017
1024
  if (!path) {
@@ -1024,7 +1031,7 @@ function createWorkspaceRoutes(_deps) {
1024
1031
  const response2 = { success: false, error: "File too large to read (max 1MB)" };
1025
1032
  return c.json(response2, 413);
1026
1033
  }
1027
- const content = readFileSync2(validated.absolutePath, "utf-8");
1034
+ const content = await readFile(validated.absolutePath, "utf-8");
1028
1035
  const response = {
1029
1036
  success: true,
1030
1037
  data: { content, size: stats.size }
@@ -1322,9 +1329,12 @@ function createConfigRoutes(deps) {
1322
1329
  });
1323
1330
  const response = { success: true, data };
1324
1331
  return c.json(response);
1325
- } catch (err) {
1332
+ } catch (error) {
1326
1333
  return c.json(
1327
- { success: false, error: err instanceof Error ? err.message : String(err) },
1334
+ {
1335
+ success: false,
1336
+ error: getErrorMessage(error)
1337
+ },
1328
1338
  500
1329
1339
  );
1330
1340
  }
@@ -1342,6 +1352,18 @@ function createConfigRoutes(deps) {
1342
1352
  400
1343
1353
  );
1344
1354
  }
1355
+ if (key.startsWith("heartbeat.") && key !== "heartbeat.self_configurable") {
1356
+ const config = deps.agent.getConfig();
1357
+ if (config.heartbeat?.self_configurable !== true) {
1358
+ return c.json(
1359
+ {
1360
+ success: false,
1361
+ error: `Heartbeat config is locked (self_configurable: false). Set heartbeat.self_configurable to true first.`
1362
+ },
1363
+ 403
1364
+ );
1365
+ }
1366
+ }
1345
1367
  let body;
1346
1368
  try {
1347
1369
  body = await c.req.json();
@@ -1389,11 +1411,11 @@ function createConfigRoutes(deps) {
1389
1411
  ...meta.itemType ? { itemType: meta.itemType } : {}
1390
1412
  };
1391
1413
  return c.json({ success: true, data: result });
1392
- } catch (err) {
1414
+ } catch (error) {
1393
1415
  return c.json(
1394
1416
  {
1395
1417
  success: false,
1396
- error: err instanceof Error ? err.message : String(err)
1418
+ error: getErrorMessage(error)
1397
1419
  },
1398
1420
  500
1399
1421
  );
@@ -1445,9 +1467,12 @@ function createConfigRoutes(deps) {
1445
1467
  ...meta.options ? { options: meta.options } : {}
1446
1468
  };
1447
1469
  return c.json({ success: true, data: result });
1448
- } catch (err) {
1470
+ } catch (error) {
1449
1471
  return c.json(
1450
- { success: false, error: err instanceof Error ? err.message : String(err) },
1472
+ {
1473
+ success: false,
1474
+ error: getErrorMessage(error)
1475
+ },
1451
1476
  500
1452
1477
  );
1453
1478
  }
@@ -1465,6 +1490,18 @@ function createConfigRoutes(deps) {
1465
1490
  400
1466
1491
  );
1467
1492
  }
1493
+ if (key.startsWith("heartbeat.") && key !== "heartbeat.self_configurable") {
1494
+ const config = deps.agent.getConfig();
1495
+ if (config.heartbeat?.self_configurable !== true) {
1496
+ return c.json(
1497
+ {
1498
+ success: false,
1499
+ error: `Heartbeat config is locked (self_configurable: false). Set heartbeat.self_configurable to true first.`
1500
+ },
1501
+ 403
1502
+ );
1503
+ }
1504
+ }
1468
1505
  try {
1469
1506
  const raw = readRawConfig(deps.configPath);
1470
1507
  deleteNestedValue(raw, key);
@@ -1486,9 +1523,12 @@ function createConfigRoutes(deps) {
1486
1523
  ...meta.itemType ? { itemType: meta.itemType } : {}
1487
1524
  };
1488
1525
  return c.json({ success: true, data: result });
1489
- } catch (err) {
1526
+ } catch (error) {
1490
1527
  return c.json(
1491
- { success: false, error: err instanceof Error ? err.message : String(err) },
1528
+ {
1529
+ success: false,
1530
+ error: getErrorMessage(error)
1531
+ },
1492
1532
  500
1493
1533
  );
1494
1534
  }
@@ -1513,9 +1553,12 @@ function createConfigRoutes(deps) {
1513
1553
  displayName: meta.displayName
1514
1554
  }
1515
1555
  });
1516
- } catch (err) {
1556
+ } catch (error) {
1517
1557
  return c.json(
1518
- { success: false, error: err instanceof Error ? err.message : String(err) },
1558
+ {
1559
+ success: false,
1560
+ error: getErrorMessage(error)
1561
+ },
1519
1562
  400
1520
1563
  );
1521
1564
  }
@@ -1531,9 +1574,12 @@ function createConfigRoutes(deps) {
1531
1574
  success: true,
1532
1575
  data: { valid: !error, error: error ?? null }
1533
1576
  });
1534
- } catch (err) {
1577
+ } catch (error) {
1535
1578
  return c.json(
1536
- { success: false, error: err instanceof Error ? err.message : String(err) },
1579
+ {
1580
+ success: false,
1581
+ error: getErrorMessage(error)
1582
+ },
1537
1583
  400
1538
1584
  );
1539
1585
  }
@@ -1575,12 +1621,12 @@ var MarketplaceService = class {
1575
1621
  const entries = await this.fetchPromise;
1576
1622
  this.cache = { entries, fetchedAt: Date.now() };
1577
1623
  return entries;
1578
- } catch (err) {
1624
+ } catch (error) {
1579
1625
  if (this.cache) {
1580
- log.warn({ err }, "Registry fetch failed, using stale cache");
1626
+ log.warn({ error }, "Registry fetch failed, using stale cache");
1581
1627
  return this.cache.entries;
1582
1628
  }
1583
- throw err;
1629
+ throw error;
1584
1630
  } finally {
1585
1631
  this.fetchPromise = null;
1586
1632
  }
@@ -1718,15 +1764,15 @@ var MarketplaceService = class {
1718
1764
  version: adapted.version,
1719
1765
  toolCount
1720
1766
  };
1721
- } catch (err) {
1767
+ } catch (error) {
1722
1768
  if (existsSync2(pluginDir)) {
1723
1769
  try {
1724
1770
  rmSync2(pluginDir, { recursive: true, force: true });
1725
1771
  } catch (cleanupErr) {
1726
- log.error({ err: cleanupErr }, `Failed to cleanup ${pluginDir}`);
1772
+ log.error({ error: cleanupErr }, `Failed to cleanup ${pluginDir}`);
1727
1773
  }
1728
1774
  }
1729
- throw err;
1775
+ throw error;
1730
1776
  } finally {
1731
1777
  this.installing.delete(pluginId);
1732
1778
  }
@@ -1805,7 +1851,7 @@ var MarketplaceService = class {
1805
1851
  const fileRes = await fetch(item.download_url);
1806
1852
  if (!fileRes.ok) throw new Error(`Failed to download ${item.name}: ${fileRes.status}`);
1807
1853
  const content = await fileRes.text();
1808
- writeFileSync3(target, content, "utf-8");
1854
+ writeFileSync3(target, content, { encoding: "utf-8", mode: 384 });
1809
1855
  }
1810
1856
  }
1811
1857
  }
@@ -1849,11 +1895,8 @@ function createMarketplaceRoutes(deps) {
1849
1895
  const refresh = c.req.query("refresh") === "true";
1850
1896
  const plugins = await svc.listPlugins(refresh);
1851
1897
  return c.json({ success: true, data: plugins });
1852
- } catch (err) {
1853
- return c.json(
1854
- { success: false, error: err instanceof Error ? err.message : String(err) },
1855
- 500
1856
- );
1898
+ } catch (error) {
1899
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
1857
1900
  }
1858
1901
  });
1859
1902
  app.post("/install", async (c) => {
@@ -1872,12 +1915,9 @@ function createMarketplaceRoutes(deps) {
1872
1915
  ...(deps.marketplace?.modules ?? []).filter((m) => deps.toolRegistry.isPluginModule(m.name)).map((m) => ({ name: m.name, version: m.version ?? "0.0.0" }))
1873
1916
  );
1874
1917
  return c.json({ success: true, data: result });
1875
- } catch (err) {
1876
- const status = err instanceof ConflictError ? 409 : 500;
1877
- return c.json(
1878
- { success: false, error: err instanceof Error ? err.message : String(err) },
1879
- status
1880
- );
1918
+ } catch (error) {
1919
+ const status = error instanceof ConflictError ? 409 : 500;
1920
+ return c.json({ success: false, error: getErrorMessage(error) }, status);
1881
1921
  }
1882
1922
  });
1883
1923
  app.post("/uninstall", async (c) => {
@@ -1896,12 +1936,9 @@ function createMarketplaceRoutes(deps) {
1896
1936
  ...(deps.marketplace?.modules ?? []).filter((m) => deps.toolRegistry.isPluginModule(m.name)).map((m) => ({ name: m.name, version: m.version ?? "0.0.0" }))
1897
1937
  );
1898
1938
  return c.json({ success: true, data: result });
1899
- } catch (err) {
1900
- const status = err instanceof ConflictError ? 409 : 500;
1901
- return c.json(
1902
- { success: false, error: err instanceof Error ? err.message : String(err) },
1903
- status
1904
- );
1939
+ } catch (error) {
1940
+ const status = error instanceof ConflictError ? 409 : 500;
1941
+ return c.json({ success: false, error: getErrorMessage(error) }, status);
1905
1942
  }
1906
1943
  });
1907
1944
  app.post("/update", async (c) => {
@@ -1920,12 +1957,9 @@ function createMarketplaceRoutes(deps) {
1920
1957
  ...(deps.marketplace?.modules ?? []).filter((m) => deps.toolRegistry.isPluginModule(m.name)).map((m) => ({ name: m.name, version: m.version ?? "0.0.0" }))
1921
1958
  );
1922
1959
  return c.json({ success: true, data: result });
1923
- } catch (err) {
1924
- const status = err instanceof ConflictError ? 409 : 500;
1925
- return c.json(
1926
- { success: false, error: err instanceof Error ? err.message : String(err) },
1927
- status
1928
- );
1960
+ } catch (error) {
1961
+ const status = error instanceof ConflictError ? 409 : 500;
1962
+ return c.json({ success: false, error: getErrorMessage(error) }, status);
1929
1963
  }
1930
1964
  });
1931
1965
  app.get("/secrets/:pluginId", async (c) => {
@@ -1943,11 +1977,8 @@ function createMarketplaceRoutes(deps) {
1943
1977
  const declared = plugin?.secrets ?? {};
1944
1978
  const configured = listPluginSecretKeys(pluginId);
1945
1979
  return c.json({ success: true, data: { declared, configured } });
1946
- } catch (err) {
1947
- return c.json(
1948
- { success: false, error: err instanceof Error ? err.message : String(err) },
1949
- 500
1950
- );
1980
+ } catch (error) {
1981
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
1951
1982
  }
1952
1983
  });
1953
1984
  app.put("/secrets/:pluginId/:key", async (c) => {
@@ -1972,11 +2003,8 @@ function createMarketplaceRoutes(deps) {
1972
2003
  success: true,
1973
2004
  data: { key, set: true }
1974
2005
  });
1975
- } catch (err) {
1976
- return c.json(
1977
- { success: false, error: err instanceof Error ? err.message : String(err) },
1978
- 500
1979
- );
2006
+ } catch (error) {
2007
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
1980
2008
  }
1981
2009
  });
1982
2010
  app.delete("/secrets/:pluginId/:key", async (c) => {
@@ -1997,11 +2025,8 @@ function createMarketplaceRoutes(deps) {
1997
2025
  success: true,
1998
2026
  data: { key, set: false }
1999
2027
  });
2000
- } catch (err) {
2001
- return c.json(
2002
- { success: false, error: err instanceof Error ? err.message : String(err) },
2003
- 500
2004
- );
2028
+ } catch (error) {
2029
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2005
2030
  }
2006
2031
  });
2007
2032
  return app;
@@ -2016,8 +2041,8 @@ function createHooksRoutes(deps) {
2016
2041
  try {
2017
2042
  const data = getBlocklistConfig(deps.memory.db);
2018
2043
  return c.json({ success: true, data });
2019
- } catch (err) {
2020
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2044
+ } catch (error) {
2045
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2021
2046
  }
2022
2047
  });
2023
2048
  app.put("/blocklist", async (c) => {
@@ -2042,16 +2067,16 @@ function createHooksRoutes(deps) {
2042
2067
  setBlocklistConfig(deps.memory.db, config);
2043
2068
  deps.userHookEvaluator?.reload();
2044
2069
  return c.json({ success: true, data: config });
2045
- } catch (err) {
2046
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2070
+ } catch (error) {
2071
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2047
2072
  }
2048
2073
  });
2049
2074
  app.get("/triggers", (c) => {
2050
2075
  try {
2051
2076
  const data = getTriggersConfig(deps.memory.db);
2052
2077
  return c.json({ success: true, data });
2053
- } catch (err) {
2054
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2078
+ } catch (error) {
2079
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2055
2080
  }
2056
2081
  });
2057
2082
  app.post("/triggers", async (c) => {
@@ -2085,8 +2110,8 @@ function createHooksRoutes(deps) {
2085
2110
  setTriggersConfig(deps.memory.db, triggers);
2086
2111
  deps.userHookEvaluator?.reload();
2087
2112
  return c.json({ success: true, data: entry });
2088
- } catch (err) {
2089
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2113
+ } catch (error) {
2114
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2090
2115
  }
2091
2116
  });
2092
2117
  app.put("/triggers/:id", async (c) => {
@@ -2124,8 +2149,8 @@ function createHooksRoutes(deps) {
2124
2149
  setTriggersConfig(deps.memory.db, triggers);
2125
2150
  deps.userHookEvaluator?.reload();
2126
2151
  return c.json({ success: true, data: triggers[idx] });
2127
- } catch (err) {
2128
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2152
+ } catch (error) {
2153
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2129
2154
  }
2130
2155
  });
2131
2156
  app.delete("/triggers/:id", (c) => {
@@ -2136,8 +2161,8 @@ function createHooksRoutes(deps) {
2136
2161
  setTriggersConfig(deps.memory.db, filtered);
2137
2162
  deps.userHookEvaluator?.reload();
2138
2163
  return c.json({ success: true, data: null });
2139
- } catch (err) {
2140
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2164
+ } catch (error) {
2165
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2141
2166
  }
2142
2167
  });
2143
2168
  app.patch("/triggers/:id/toggle", async (c) => {
@@ -2159,8 +2184,8 @@ function createHooksRoutes(deps) {
2159
2184
  success: true,
2160
2185
  data: { id, enabled: body.enabled }
2161
2186
  });
2162
- } catch (err) {
2163
- return c.json({ success: false, error: getErrorMessage(err) }, 500);
2187
+ } catch (error) {
2188
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
2164
2189
  }
2165
2190
  });
2166
2191
  return app;
@@ -2203,10 +2228,13 @@ function createTonProxyRoutes(deps) {
2203
2228
  success: true,
2204
2229
  data: { ...mgr.getStatus(), enabled: true }
2205
2230
  });
2206
- } catch (err) {
2207
- log2.error({ err }, "Failed to start TON Proxy");
2231
+ } catch (error) {
2232
+ log2.error({ error }, "Failed to start TON Proxy");
2208
2233
  return c.json(
2209
- { success: false, error: err instanceof Error ? err.message : String(err) },
2234
+ {
2235
+ success: false,
2236
+ error: getErrorMessage(error)
2237
+ },
2210
2238
  500
2211
2239
  );
2212
2240
  }
@@ -2228,10 +2256,13 @@ function createTonProxyRoutes(deps) {
2228
2256
  success: true,
2229
2257
  data: { running: false, installed: true, port: 8080, enabled: false }
2230
2258
  });
2231
- } catch (err) {
2232
- log2.error({ err }, "Failed to stop TON Proxy");
2259
+ } catch (error) {
2260
+ log2.error({ error }, "Failed to stop TON Proxy");
2233
2261
  return c.json(
2234
- { success: false, error: err instanceof Error ? err.message : String(err) },
2262
+ {
2263
+ success: false,
2264
+ error: getErrorMessage(error)
2265
+ },
2235
2266
  500
2236
2267
  );
2237
2268
  }
@@ -2259,10 +2290,13 @@ function createTonProxyRoutes(deps) {
2259
2290
  success: true,
2260
2291
  data: { running: false, installed: false, port: 8080, enabled: false }
2261
2292
  });
2262
- } catch (err) {
2263
- log2.error({ err }, "Failed to uninstall TON Proxy");
2293
+ } catch (error) {
2294
+ log2.error({ error }, "Failed to uninstall TON Proxy");
2264
2295
  return c.json(
2265
- { success: false, error: err instanceof Error ? err.message : String(err) },
2296
+ {
2297
+ success: false,
2298
+ error: getErrorMessage(error)
2299
+ },
2266
2300
  500
2267
2301
  );
2268
2302
  }
@@ -1,6 +1,9 @@
1
+ import {
2
+ getErrorMessage
3
+ } from "./chunk-3UFPFWYP.js";
1
4
  import {
2
5
  createLogger
3
- } from "./chunk-NQ6FZKCE.js";
6
+ } from "./chunk-V3S3NXBQ.js";
4
7
 
5
8
  // src/agent/lifecycle.ts
6
9
  import { EventEmitter } from "events";
@@ -59,12 +62,12 @@ var AgentLifecycle = class extends EventEmitter {
59
62
  this.error = void 0;
60
63
  this.runningSince = Date.now();
61
64
  this.transition("running");
62
- } catch (err) {
63
- const message = err instanceof Error ? err.message : String(err);
65
+ } catch (error) {
66
+ const message = getErrorMessage(error);
64
67
  this.error = message;
65
68
  this.runningSince = null;
66
69
  this.transition("stopped", message);
67
- throw err;
70
+ throw error;
68
71
  } finally {
69
72
  this.startPromise = null;
70
73
  }
@@ -99,8 +102,8 @@ var AgentLifecycle = class extends EventEmitter {
99
102
  this.stopPromise = (async () => {
100
103
  try {
101
104
  await fn();
102
- } catch (err) {
103
- log.error({ err }, "Error during agent stop");
105
+ } catch (error) {
106
+ log.error({ err: error }, "Error during agent stop");
104
107
  } finally {
105
108
  this.runningSince = null;
106
109
  this.transition("stopped");
@@ -11,6 +11,7 @@ var WORKSPACE_PATHS = {
11
11
  USER: join(WORKSPACE_ROOT, "USER.md"),
12
12
  STRATEGY: join(WORKSPACE_ROOT, "STRATEGY.md"),
13
13
  SECURITY: join(WORKSPACE_ROOT, "SECURITY.md"),
14
+ HEARTBEAT: join(WORKSPACE_ROOT, "HEARTBEAT.md"),
14
15
  // Directories
15
16
  MEMORY_DIR: join(WORKSPACE_ROOT, "memory"),
16
17
  DOWNLOADS_DIR: join(WORKSPACE_ROOT, "downloads"),