teleton 0.7.4 → 0.7.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.
Files changed (35) hide show
  1. package/README.md +36 -26
  2. package/dist/{chunk-XDYDA2KV.js → chunk-2GLHOJ5C.js} +268 -59
  3. package/dist/chunk-5UVXJMOX.js +292 -0
  4. package/dist/{chunk-BGC2IUM5.js → chunk-AVDWXYQ7.js} +65 -20
  5. package/dist/{chunk-RMLQS3X6.js → chunk-CB2Y45HA.js} +106 -1
  6. package/dist/{chunk-5PLZ3KSO.js → chunk-DMXTIRUW.js} +5 -6
  7. package/dist/{chunk-YFG2QHLA.js → chunk-G2LLMJXJ.js} +1578 -115
  8. package/dist/{chunk-EK7M5K26.js → chunk-LCCVZ4D2.js} +3 -3
  9. package/dist/{chunk-LAQOUFOJ.js → chunk-OGMVWDVU.js} +3517 -3620
  10. package/dist/{chunk-4DU3C27M.js → chunk-R4YSJ4EY.js} +5 -1
  11. package/dist/{chunk-XBKSS6DM.js → chunk-VFA7QMCZ.js} +5 -3
  12. package/dist/{chunk-VAUJSSD3.js → chunk-XQUHC3JZ.js} +1 -1
  13. package/dist/{chunk-RO62LO6Z.js → chunk-YP25WTQK.js} +2 -0
  14. package/dist/cli/index.js +92 -28
  15. package/dist/{client-RTNALK7W.js → client-O37XDCJB.js} +4 -5
  16. package/dist/index.js +12 -13
  17. package/dist/{memory-JQZ6MTRU.js → memory-KQALFUV3.js} +6 -7
  18. package/dist/{migrate-GS5ACQDA.js → migrate-UV3WEL5D.js} +6 -7
  19. package/dist/{server-TCJOBV3D.js → server-BHHJGUDF.js} +35 -9
  20. package/dist/{setup-server-YHYJLAMA.js → setup-server-G7UG2DI3.js} +21 -9
  21. package/dist/store-H4XPNGC2.js +34 -0
  22. package/dist/{task-dependency-resolver-WKZWJLLM.js → task-dependency-resolver-VMEVJRPO.js} +2 -2
  23. package/dist/{task-executor-PD3H4MLO.js → task-executor-WWSPBJ4V.js} +1 -1
  24. package/dist/{tool-index-6HBRVXVG.js → tool-index-2KH3OB6X.js} +5 -5
  25. package/dist/web/assets/index-BrVqauzj.css +1 -0
  26. package/dist/web/assets/index-Bx8JW3gV.js +72 -0
  27. package/dist/web/assets/{index.es-CqZHj0tz.js → index.es-Pet5-M13.js} +1 -1
  28. package/dist/web/index.html +2 -2
  29. package/package.json +2 -2
  30. package/dist/chunk-JQDLW7IE.js +0 -107
  31. package/dist/chunk-UCN6TI25.js +0 -143
  32. package/dist/web/assets/index-B6M9knfJ.css +0 -1
  33. package/dist/web/assets/index-DAGeQfVZ.js +0 -72
  34. package/scripts/patch-gramjs.sh +0 -46
  35. package/scripts/postinstall.mjs +0 -16
@@ -10,8 +10,10 @@ var RETRY_BLOCKCHAIN_BASE_DELAY_MS = 2e3;
10
10
  var RETRY_BLOCKCHAIN_MAX_DELAY_MS = 15e3;
11
11
  var RETRY_BLOCKCHAIN_TIMEOUT_MS = 3e4;
12
12
  var GRAMJS_RETRY_DELAY_MS = 1e3;
13
+ var GRAMJS_CONNECT_RETRY_DELAY_MS = 3e3;
13
14
  var TOOL_EXECUTION_TIMEOUT_MS = 9e4;
14
15
  var SHUTDOWN_TIMEOUT_MS = 1e4;
16
+ var TYPING_REFRESH_MS = 4e3;
15
17
 
16
18
  export {
17
19
  TTS_TIMEOUT_MS,
@@ -25,6 +27,8 @@ export {
25
27
  RETRY_BLOCKCHAIN_MAX_DELAY_MS,
26
28
  RETRY_BLOCKCHAIN_TIMEOUT_MS,
27
29
  GRAMJS_RETRY_DELAY_MS,
30
+ GRAMJS_CONNECT_RETRY_DELAY_MS,
28
31
  TOOL_EXECUTION_TIMEOUT_MS,
29
- SHUTDOWN_TIMEOUT_MS
32
+ SHUTDOWN_TIMEOUT_MS,
33
+ TYPING_REFRESH_MS
30
34
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fetchWithTimeout
3
- } from "./chunk-VAUJSSD3.js";
3
+ } from "./chunk-XQUHC3JZ.js";
4
4
 
5
5
  // src/constants/api-endpoints.ts
6
6
  var TONAPI_BASE_URL = "https://tonapi.io/v2";
@@ -15,9 +15,11 @@ function tonapiHeaders() {
15
15
  }
16
16
  return headers;
17
17
  }
18
- var TONAPI_MAX_RPS = 5;
18
+ var TONAPI_RPS_WITH_KEY = 5;
19
+ var TONAPI_RPS_WITHOUT_KEY = 1;
19
20
  var _tonapiTimestamps = [];
20
21
  async function waitForTonapiSlot() {
22
+ const maxRps = _tonapiKey ? TONAPI_RPS_WITH_KEY : TONAPI_RPS_WITHOUT_KEY;
21
23
  const clean = () => {
22
24
  const cutoff = Date.now() - 1e3;
23
25
  while (_tonapiTimestamps.length > 0 && _tonapiTimestamps[0] <= cutoff) {
@@ -25,7 +27,7 @@ async function waitForTonapiSlot() {
25
27
  }
26
28
  };
27
29
  clean();
28
- if (_tonapiTimestamps.length >= TONAPI_MAX_RPS) {
30
+ if (_tonapiTimestamps.length >= maxRps) {
29
31
  const waitMs = _tonapiTimestamps[0] + 1e3 - Date.now() + 50;
30
32
  if (waitMs > 0) await new Promise((r) => setTimeout(r, waitMs));
31
33
  clean();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_FETCH_TIMEOUT_MS
3
- } from "./chunk-4DU3C27M.js";
3
+ } from "./chunk-R4YSJ4EY.js";
4
4
 
5
5
  // src/utils/fetch.ts
6
6
  var DEFAULT_TIMEOUT_MS = DEFAULT_FETCH_TIMEOUT_MS;
@@ -24,6 +24,7 @@ var CONTEXT_MAX_RELEVANT_CHUNKS = 5;
24
24
  var HYBRID_SEARCH_MIN_SCORE = 0.15;
25
25
  var CONTEXT_OVERFLOW_SUMMARY_MESSAGES = 15;
26
26
  var RATE_LIMIT_MAX_RETRIES = 3;
27
+ var SERVER_ERROR_MAX_RETRIES = 3;
27
28
  var KNOWLEDGE_CHUNK_SIZE = 500;
28
29
  var PAYMENT_TOLERANCE_RATIO = 0.99;
29
30
  var TELEGRAM_CONNECTION_RETRIES = 5;
@@ -82,6 +83,7 @@ export {
82
83
  HYBRID_SEARCH_MIN_SCORE,
83
84
  CONTEXT_OVERFLOW_SUMMARY_MESSAGES,
84
85
  RATE_LIMIT_MAX_RETRIES,
86
+ SERVER_ERROR_MAX_RETRIES,
85
87
  KNOWLEDGE_CHUNK_SIZE,
86
88
  PAYMENT_TOLERANCE_RATIO,
87
89
  TELEGRAM_CONNECTION_RETRIES,
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  TelegramUserClient,
6
6
  main
7
- } from "../chunk-LAQOUFOJ.js";
7
+ } from "../chunk-OGMVWDVU.js";
8
8
  import "../chunk-WIKM24GZ.js";
9
9
  import "../chunk-U7FQYCBQ.js";
10
10
  import {
@@ -16,7 +16,7 @@ import {
16
16
  readRawConfig,
17
17
  setNestedValue,
18
18
  writeRawConfig
19
- } from "../chunk-YFG2QHLA.js";
19
+ } from "../chunk-G2LLMJXJ.js";
20
20
  import {
21
21
  ConfigSchema,
22
22
  DealsConfigSchema,
@@ -27,33 +27,31 @@ import {
27
27
  loadWallet,
28
28
  saveWallet,
29
29
  walletExists
30
- } from "../chunk-BGC2IUM5.js";
30
+ } from "../chunk-AVDWXYQ7.js";
31
+ import "../chunk-5UVXJMOX.js";
31
32
  import "../chunk-TSKJCWQQ.js";
32
33
  import {
33
34
  getErrorMessage
34
35
  } from "../chunk-XBE4JB7C.js";
35
- import "../chunk-5PLZ3KSO.js";
36
+ import "../chunk-DMXTIRUW.js";
36
37
  import {
37
38
  getClaudeCodeApiKey,
38
- isClaudeCodeTokenValid
39
- } from "../chunk-JQDLW7IE.js";
40
- import {
41
39
  getProviderMetadata,
42
40
  getSupportedProviders,
41
+ isClaudeCodeTokenValid,
43
42
  validateApiKeyFormat
44
- } from "../chunk-RMLQS3X6.js";
43
+ } from "../chunk-CB2Y45HA.js";
45
44
  import "../chunk-OCLG5GKI.js";
46
- import "../chunk-XDYDA2KV.js";
47
- import "../chunk-UCN6TI25.js";
48
- import "../chunk-EK7M5K26.js";
49
- import "../chunk-XBKSS6DM.js";
45
+ import "../chunk-2GLHOJ5C.js";
46
+ import "../chunk-LCCVZ4D2.js";
47
+ import "../chunk-VFA7QMCZ.js";
50
48
  import {
51
49
  TELEGRAM_MAX_MESSAGE_LENGTH
52
- } from "../chunk-RO62LO6Z.js";
50
+ } from "../chunk-YP25WTQK.js";
53
51
  import {
54
52
  fetchWithTimeout
55
- } from "../chunk-VAUJSSD3.js";
56
- import "../chunk-4DU3C27M.js";
53
+ } from "../chunk-XQUHC3JZ.js";
54
+ import "../chunk-R4YSJ4EY.js";
57
55
  import {
58
56
  TELETON_ROOT
59
57
  } from "../chunk-EYWNOHMJ.js";
@@ -382,7 +380,7 @@ function sleep(ms) {
382
380
  }
383
381
  async function onboardCommand(options = {}) {
384
382
  if (options.ui) {
385
- const { SetupServer } = await import("../setup-server-YHYJLAMA.js");
383
+ const { SetupServer } = await import("../setup-server-G7UG2DI3.js");
386
384
  const port = parseInt(options.uiPort || "7777") || 7777;
387
385
  const url = `http://localhost:${port}/setup`;
388
386
  const blue2 = "\x1B[34m";
@@ -445,13 +443,15 @@ async function runInteractiveOnboarding(options, prompter) {
445
443
  let phone = "";
446
444
  let userId = 0;
447
445
  let tonapiKey;
446
+ let toncenterApiKey;
448
447
  let tavilyApiKey;
449
448
  let botToken;
450
449
  let botUsername;
451
- let dmPolicy = "open";
452
- let groupPolicy = "open";
450
+ let dmPolicy = "admin-only";
451
+ let groupPolicy = "admin-only";
453
452
  let requireMention = true;
454
453
  let maxAgenticIterations = "5";
454
+ let execMode = "off";
455
455
  let cocoonInstance = 1e4;
456
456
  console.clear();
457
457
  console.log();
@@ -701,22 +701,32 @@ Get it at: ${providerMeta.consoleUrl}`,
701
701
  userId = parseInt(userIdStr);
702
702
  dmPolicy = await select({
703
703
  message: "DM policy (private messages)",
704
- default: "open",
704
+ default: "admin-only",
705
705
  theme: inquirerTheme,
706
706
  choices: [
707
- { value: "open", name: "Open", description: "Reply to everyone" },
707
+ {
708
+ value: "admin-only",
709
+ name: "Admin Only",
710
+ description: "Only admins can DM the agent"
711
+ },
708
712
  { value: "allowlist", name: "Allowlist", description: "Only specific users" },
709
- { value: "disabled", name: "Disabled", description: "No DM replies" }
713
+ { value: "open", name: "Open", description: "Reply to everyone" },
714
+ { value: "disabled", name: "Disabled", description: "Ignore all DMs" }
710
715
  ]
711
716
  });
712
717
  groupPolicy = await select({
713
718
  message: "Group policy",
714
- default: "open",
719
+ default: "admin-only",
715
720
  theme: inquirerTheme,
716
721
  choices: [
717
- { value: "open", name: "Open", description: "Reply in all groups" },
722
+ {
723
+ value: "admin-only",
724
+ name: "Admin Only",
725
+ description: "Only admins can trigger the agent"
726
+ },
718
727
  { value: "allowlist", name: "Allowlist", description: "Only specific groups" },
719
- { value: "disabled", name: "Disabled", description: "No group replies" }
728
+ { value: "open", name: "Open", description: "Reply in all groups" },
729
+ { value: "disabled", name: "Disabled", description: "Ignore all group messages" }
720
730
  ]
721
731
  });
722
732
  requireMention = await confirm({
@@ -733,6 +743,19 @@ Get it at: ${providerMeta.consoleUrl}`,
733
743
  return !isNaN(n) && n >= 1 && n <= 50 ? true : "Must be 1\u201350";
734
744
  }
735
745
  });
746
+ execMode = await select({
747
+ message: "Coding Agent (system execution)",
748
+ choices: [
749
+ { value: "off", name: "Disabled", description: "No system execution capability" },
750
+ {
751
+ value: "yolo",
752
+ name: "YOLO Mode",
753
+ description: "Full system access \u2014 STRONGLY RECOMMENDED to use a dedicated VPS"
754
+ }
755
+ ],
756
+ default: "off",
757
+ theme: inquirerTheme
758
+ });
736
759
  STEPS[2].value = `${dmPolicy}/${groupPolicy}`;
737
760
  redraw(3);
738
761
  const extras = [];
@@ -783,13 +806,13 @@ Get it at: ${providerMeta.consoleUrl}`,
783
806
  }
784
807
  }
785
808
  const setupTonapi = await confirm({
786
- message: `Add a TonAPI key? ${DIM("(optional, recommended for 10x rate limits)")}`,
809
+ message: `Add a TonAPI key? ${DIM("(strongly recommended for TON features)")}`,
787
810
  default: false,
788
811
  theme: inquirerTheme
789
812
  });
790
813
  if (setupTonapi) {
791
814
  noteBox(
792
- "Without key: 1 req/s (you will hit rate limits)\nWith free key: 10 req/s (recommended)\n\nOpen @tonapibot on Telegram \u2192 tap the mini app \u2192 generate a server key",
815
+ "Blockchain data \u2014 jettons, NFTs, prices, transaction history.\nWithout key: 1 req/s (you WILL hit rate limits)\nWith free key: 5 req/s\n\nOpen @tonapibot on Telegram \u2192 mini app \u2192 generate a server key",
793
816
  "TonAPI",
794
817
  TON
795
818
  );
@@ -804,6 +827,28 @@ Get it at: ${providerMeta.consoleUrl}`,
804
827
  tonapiKey = keyInput;
805
828
  extras.push("TonAPI");
806
829
  }
830
+ const setupToncenter = await confirm({
831
+ message: `Add a TonCenter API key? ${DIM("(optional, dedicated RPC endpoint)")}`,
832
+ default: false,
833
+ theme: inquirerTheme
834
+ });
835
+ if (setupToncenter) {
836
+ noteBox(
837
+ "Blockchain RPC \u2014 send transactions, check balances.\nWithout key: falls back to ORBS network (decentralized, slower)\nWith free key: dedicated RPC endpoint\n\nGo to https://toncenter.com \u2192 get a free API key (instant, no signup)",
838
+ "TonCenter",
839
+ TON
840
+ );
841
+ const keyInput = await input({
842
+ message: "TonCenter API key",
843
+ theme: inquirerTheme,
844
+ validate: (v) => {
845
+ if (!v || v.length < 10) return "Key too short";
846
+ return true;
847
+ }
848
+ });
849
+ toncenterApiKey = keyInput;
850
+ extras.push("TonCenter");
851
+ }
807
852
  const setupTavily = await confirm({
808
853
  message: `Enable web search? ${DIM("(free Tavily key \u2014 1,000 req/month)")}`,
809
854
  default: false,
@@ -1057,9 +1102,19 @@ Get it at: ${providerMeta.consoleUrl}`,
1057
1102
  },
1058
1103
  logging: { level: "info", pretty: true },
1059
1104
  mcp: { servers: {} },
1105
+ capabilities: {
1106
+ exec: {
1107
+ mode: execMode,
1108
+ scope: "admin-only",
1109
+ allowlist: [],
1110
+ limits: { timeout: 120, max_output: 5e4 },
1111
+ audit: { log_commands: true }
1112
+ }
1113
+ },
1060
1114
  plugins: {},
1061
1115
  ...selectedProvider === "cocoon" ? { cocoon: { port: cocoonInstance } } : {},
1062
1116
  tonapi_key: tonapiKey,
1117
+ toncenter_api_key: toncenterApiKey,
1063
1118
  tavily_api_key: tavilyApiKey
1064
1119
  };
1065
1120
  spinner.start(DIM("Saving configuration..."));
@@ -1166,9 +1221,9 @@ async function runNonInteractiveOnboarding(options, prompter) {
1166
1221
  phone: options.phone,
1167
1222
  session_name: "teleton_session",
1168
1223
  session_path: workspace.sessionPath,
1169
- dm_policy: "open",
1224
+ dm_policy: "admin-only",
1170
1225
  allow_from: [],
1171
- group_policy: "open",
1226
+ group_policy: "admin-only",
1172
1227
  group_allow_from: [],
1173
1228
  require_mention: true,
1174
1229
  max_message_length: TELEGRAM_MAX_MESSAGE_LENGTH,
@@ -1212,6 +1267,15 @@ async function runNonInteractiveOnboarding(options, prompter) {
1212
1267
  skip_unlimited_providers: false
1213
1268
  },
1214
1269
  logging: { level: "info", pretty: true },
1270
+ capabilities: {
1271
+ exec: {
1272
+ mode: "off",
1273
+ scope: "admin-only",
1274
+ allowlist: [],
1275
+ limits: { timeout: 120, max_output: 5e4 },
1276
+ audit: { log_commands: true }
1277
+ }
1278
+ },
1215
1279
  mcp: { servers: {} },
1216
1280
  plugins: {},
1217
1281
  tavily_api_key: options.tavilyApiKey
@@ -8,12 +8,11 @@ import {
8
8
  loadContextFromTranscript,
9
9
  registerCocoonModels,
10
10
  registerLocalModels
11
- } from "./chunk-5PLZ3KSO.js";
12
- import "./chunk-JQDLW7IE.js";
13
- import "./chunk-RMLQS3X6.js";
11
+ } from "./chunk-DMXTIRUW.js";
12
+ import "./chunk-CB2Y45HA.js";
14
13
  import "./chunk-OCLG5GKI.js";
15
- import "./chunk-VAUJSSD3.js";
16
- import "./chunk-4DU3C27M.js";
14
+ import "./chunk-XQUHC3JZ.js";
15
+ import "./chunk-R4YSJ4EY.js";
17
16
  import "./chunk-EYWNOHMJ.js";
18
17
  import "./chunk-RCMD3U65.js";
19
18
  import "./chunk-QGM4M3NI.js";
package/dist/index.js CHANGED
@@ -1,24 +1,23 @@
1
1
  import {
2
2
  TeletonApp,
3
3
  main
4
- } from "./chunk-LAQOUFOJ.js";
4
+ } from "./chunk-OGMVWDVU.js";
5
5
  import "./chunk-WIKM24GZ.js";
6
6
  import "./chunk-U7FQYCBQ.js";
7
- import "./chunk-YFG2QHLA.js";
8
- import "./chunk-BGC2IUM5.js";
7
+ import "./chunk-G2LLMJXJ.js";
8
+ import "./chunk-AVDWXYQ7.js";
9
+ import "./chunk-5UVXJMOX.js";
9
10
  import "./chunk-TSKJCWQQ.js";
10
11
  import "./chunk-XBE4JB7C.js";
11
- import "./chunk-5PLZ3KSO.js";
12
- import "./chunk-JQDLW7IE.js";
13
- import "./chunk-RMLQS3X6.js";
12
+ import "./chunk-DMXTIRUW.js";
13
+ import "./chunk-CB2Y45HA.js";
14
14
  import "./chunk-OCLG5GKI.js";
15
- import "./chunk-XDYDA2KV.js";
16
- import "./chunk-UCN6TI25.js";
17
- import "./chunk-EK7M5K26.js";
18
- import "./chunk-XBKSS6DM.js";
19
- import "./chunk-RO62LO6Z.js";
20
- import "./chunk-VAUJSSD3.js";
21
- import "./chunk-4DU3C27M.js";
15
+ import "./chunk-2GLHOJ5C.js";
16
+ import "./chunk-LCCVZ4D2.js";
17
+ import "./chunk-VFA7QMCZ.js";
18
+ import "./chunk-YP25WTQK.js";
19
+ import "./chunk-XQUHC3JZ.js";
20
+ import "./chunk-R4YSJ4EY.js";
22
21
  import "./chunk-EYWNOHMJ.js";
23
22
  import "./chunk-RCMD3U65.js";
24
23
  import "./chunk-NUGDTPE4.js";
@@ -16,8 +16,7 @@ import {
16
16
  initializeMemory,
17
17
  runMigrations,
18
18
  setSchemaVersion
19
- } from "./chunk-XDYDA2KV.js";
20
- import "./chunk-UCN6TI25.js";
19
+ } from "./chunk-2GLHOJ5C.js";
21
20
  import {
22
21
  AnthropicEmbeddingProvider,
23
22
  CachedEmbeddingProvider,
@@ -27,11 +26,11 @@ import {
27
26
  deserializeEmbedding,
28
27
  hashText,
29
28
  serializeEmbedding
30
- } from "./chunk-EK7M5K26.js";
31
- import "./chunk-XBKSS6DM.js";
32
- import "./chunk-RO62LO6Z.js";
33
- import "./chunk-VAUJSSD3.js";
34
- import "./chunk-4DU3C27M.js";
29
+ } from "./chunk-LCCVZ4D2.js";
30
+ import "./chunk-VFA7QMCZ.js";
31
+ import "./chunk-YP25WTQK.js";
32
+ import "./chunk-XQUHC3JZ.js";
33
+ import "./chunk-R4YSJ4EY.js";
35
34
  import "./chunk-EYWNOHMJ.js";
36
35
  import "./chunk-RCMD3U65.js";
37
36
  import {
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  getDatabase
3
- } from "./chunk-XDYDA2KV.js";
4
- import "./chunk-UCN6TI25.js";
5
- import "./chunk-EK7M5K26.js";
6
- import "./chunk-XBKSS6DM.js";
7
- import "./chunk-RO62LO6Z.js";
8
- import "./chunk-VAUJSSD3.js";
9
- import "./chunk-4DU3C27M.js";
3
+ } from "./chunk-2GLHOJ5C.js";
4
+ import "./chunk-LCCVZ4D2.js";
5
+ import "./chunk-VFA7QMCZ.js";
6
+ import "./chunk-YP25WTQK.js";
7
+ import "./chunk-XQUHC3JZ.js";
8
+ import "./chunk-R4YSJ4EY.js";
10
9
  import {
11
10
  TELETON_ROOT
12
11
  } from "./chunk-EYWNOHMJ.js";
@@ -10,6 +10,7 @@ import {
10
10
  deletePluginSecret,
11
11
  ensurePluginDeps,
12
12
  getNestedValue,
13
+ getTokenUsage,
13
14
  listPluginSecretKeys,
14
15
  readRawConfig,
15
16
  setNestedValue,
@@ -19,21 +20,31 @@ import {
19
20
  validateWritePath,
20
21
  writePluginSecret,
21
22
  writeRawConfig
22
- } from "./chunk-YFG2QHLA.js";
23
- import "./chunk-BGC2IUM5.js";
23
+ } from "./chunk-G2LLMJXJ.js";
24
+ import {
25
+ invalidateEndpointCache,
26
+ invalidateTonClientCache,
27
+ setToncenterApiKey
28
+ } from "./chunk-AVDWXYQ7.js";
29
+ import "./chunk-5UVXJMOX.js";
24
30
  import "./chunk-TSKJCWQQ.js";
25
31
  import {
26
32
  getErrorMessage
27
33
  } from "./chunk-XBE4JB7C.js";
34
+ import "./chunk-DMXTIRUW.js";
28
35
  import {
29
36
  getProviderMetadata,
30
37
  validateApiKeyFormat
31
- } from "./chunk-RMLQS3X6.js";
32
- import "./chunk-UCN6TI25.js";
33
- import "./chunk-XBKSS6DM.js";
34
- import "./chunk-RO62LO6Z.js";
35
- import "./chunk-VAUJSSD3.js";
36
- import "./chunk-4DU3C27M.js";
38
+ } from "./chunk-CB2Y45HA.js";
39
+ import "./chunk-OCLG5GKI.js";
40
+ import "./chunk-2GLHOJ5C.js";
41
+ import "./chunk-LCCVZ4D2.js";
42
+ import {
43
+ setTonapiKey
44
+ } from "./chunk-VFA7QMCZ.js";
45
+ import "./chunk-YP25WTQK.js";
46
+ import "./chunk-XQUHC3JZ.js";
47
+ import "./chunk-R4YSJ4EY.js";
37
48
  import {
38
49
  WORKSPACE_PATHS,
39
50
  WORKSPACE_ROOT
@@ -134,7 +145,8 @@ function createStatusRoutes(deps) {
134
145
  model: config.agent.model,
135
146
  provider: config.agent.provider,
136
147
  sessionCount: sessionCountRow?.count ?? 0,
137
- toolCount: deps.toolRegistry.getAll().length
148
+ toolCount: deps.toolRegistry.getAll().length,
149
+ tokenUsage: getTokenUsage()
138
150
  };
139
151
  const response = {
140
152
  success: true,
@@ -1240,6 +1252,14 @@ function createTasksRoutes(deps) {
1240
1252
 
1241
1253
  // src/webui/routes/config.ts
1242
1254
  import { Hono as Hono10 } from "hono";
1255
+ var CONFIG_SIDE_EFFECTS = {
1256
+ tonapi_key: (v) => setTonapiKey(v),
1257
+ toncenter_api_key: (v) => {
1258
+ setToncenterApiKey(v);
1259
+ invalidateEndpointCache();
1260
+ invalidateTonClientCache();
1261
+ }
1262
+ };
1243
1263
  function createConfigRoutes(deps) {
1244
1264
  const app = new Hono10();
1245
1265
  app.get("/", (c) => {
@@ -1258,6 +1278,7 @@ function createConfigRoutes(deps) {
1258
1278
  type: meta.type,
1259
1279
  category: meta.category,
1260
1280
  description: meta.description,
1281
+ hotReload: meta.hotReload,
1261
1282
  ...meta.options ? { options: meta.options } : {},
1262
1283
  ...meta.optionLabels ? { optionLabels: meta.optionLabels } : {},
1263
1284
  ...meta.itemType ? { itemType: meta.itemType } : {}
@@ -1328,6 +1349,7 @@ function createConfigRoutes(deps) {
1328
1349
  type: meta.type,
1329
1350
  category: meta.category,
1330
1351
  description: meta.description,
1352
+ hotReload: meta.hotReload,
1331
1353
  ...meta.itemType ? { itemType: meta.itemType } : {}
1332
1354
  };
1333
1355
  return c.json({ success: true, data: result });
@@ -1367,6 +1389,7 @@ function createConfigRoutes(deps) {
1367
1389
  writeRawConfig(raw, deps.configPath);
1368
1390
  const runtimeConfig = deps.agent.getConfig();
1369
1391
  setNestedValue(runtimeConfig, key, parsed);
1392
+ CONFIG_SIDE_EFFECTS[key]?.(parsed);
1370
1393
  if (key === "telegram.owner_id" && typeof parsed === "number") {
1371
1394
  const rtAdminIds = getNestedValue(runtimeConfig, "telegram.admin_ids") ?? [];
1372
1395
  if (!rtAdminIds.includes(parsed)) {
@@ -1382,6 +1405,7 @@ function createConfigRoutes(deps) {
1382
1405
  type: meta.type,
1383
1406
  category: meta.category,
1384
1407
  description: meta.description,
1408
+ hotReload: meta.hotReload,
1385
1409
  ...meta.options ? { options: meta.options } : {}
1386
1410
  };
1387
1411
  return c.json({ success: true, data: result });
@@ -1411,6 +1435,7 @@ function createConfigRoutes(deps) {
1411
1435
  writeRawConfig(raw, deps.configPath);
1412
1436
  const runtimeConfig = deps.agent.getConfig();
1413
1437
  deleteNestedValue(runtimeConfig, key);
1438
+ CONFIG_SIDE_EFFECTS[key]?.(void 0);
1414
1439
  const result = {
1415
1440
  key,
1416
1441
  label: meta.label,
@@ -1420,6 +1445,7 @@ function createConfigRoutes(deps) {
1420
1445
  type: meta.type,
1421
1446
  category: meta.category,
1422
1447
  description: meta.description,
1448
+ hotReload: meta.hotReload,
1423
1449
  ...meta.options ? { options: meta.options } : {},
1424
1450
  ...meta.itemType ? { itemType: meta.itemType } : {}
1425
1451
  };
@@ -11,24 +11,22 @@ import {
11
11
  isNewWorkspace,
12
12
  saveWallet,
13
13
  walletExists
14
- } from "./chunk-BGC2IUM5.js";
14
+ } from "./chunk-AVDWXYQ7.js";
15
15
  import {
16
16
  getClaudeCodeApiKey,
17
- isClaudeCodeTokenValid
18
- } from "./chunk-JQDLW7IE.js";
19
- import {
20
17
  getProviderMetadata,
21
18
  getSupportedProviders,
19
+ isClaudeCodeTokenValid,
22
20
  validateApiKeyFormat
23
- } from "./chunk-RMLQS3X6.js";
24
- import "./chunk-XBKSS6DM.js";
21
+ } from "./chunk-CB2Y45HA.js";
22
+ import "./chunk-VFA7QMCZ.js";
25
23
  import {
26
24
  TELEGRAM_MAX_MESSAGE_LENGTH
27
- } from "./chunk-RO62LO6Z.js";
25
+ } from "./chunk-YP25WTQK.js";
28
26
  import {
29
27
  fetchWithTimeout
30
- } from "./chunk-VAUJSSD3.js";
31
- import "./chunk-4DU3C27M.js";
28
+ } from "./chunk-XQUHC3JZ.js";
29
+ import "./chunk-R4YSJ4EY.js";
32
30
  import {
33
31
  TELETON_ROOT
34
32
  } from "./chunk-EYWNOHMJ.js";
@@ -92,6 +90,10 @@ var TelegramAuthManager = class {
92
90
  await client.disconnect();
93
91
  throw new Error("Account already authenticated (SentCodeSuccess)");
94
92
  }
93
+ if (!(result instanceof Api.auth.SentCode)) {
94
+ await client.disconnect();
95
+ throw new Error("Unexpected auth response (payment required or unknown)");
96
+ }
95
97
  let codeDelivery = "sms";
96
98
  let fragmentUrl;
97
99
  let codeLength;
@@ -688,10 +690,20 @@ function createSetupRoutes() {
688
690
  ],
689
691
  skip_unlimited_providers: false
690
692
  },
693
+ capabilities: {
694
+ exec: {
695
+ mode: input.capabilities?.exec?.mode ?? "off",
696
+ scope: "admin-only",
697
+ allowlist: [],
698
+ limits: { timeout: 120, max_output: 5e4 },
699
+ audit: { log_commands: true }
700
+ }
701
+ },
691
702
  mcp: { servers: {} },
692
703
  plugins: {},
693
704
  ...input.cocoon ? { cocoon: input.cocoon } : {},
694
705
  ...input.tonapi_key ? { tonapi_key: input.tonapi_key } : {},
706
+ ...input.toncenter_api_key ? { toncenter_api_key: input.toncenter_api_key } : {},
695
707
  ...input.tavily_api_key ? { tavily_api_key: input.tavily_api_key } : {}
696
708
  };
697
709
  ConfigSchema.parse(config);
@@ -0,0 +1,34 @@
1
+ import {
2
+ getOrCreateSession,
3
+ getSession,
4
+ incrementMessageCount,
5
+ loadSessionStore,
6
+ pruneOldSessions,
7
+ resetSession,
8
+ resetSessionWithPolicy,
9
+ saveSessionStore,
10
+ shouldResetSession,
11
+ updateSession
12
+ } from "./chunk-5UVXJMOX.js";
13
+ import "./chunk-2GLHOJ5C.js";
14
+ import "./chunk-LCCVZ4D2.js";
15
+ import "./chunk-VFA7QMCZ.js";
16
+ import "./chunk-YP25WTQK.js";
17
+ import "./chunk-XQUHC3JZ.js";
18
+ import "./chunk-R4YSJ4EY.js";
19
+ import "./chunk-EYWNOHMJ.js";
20
+ import "./chunk-RCMD3U65.js";
21
+ import "./chunk-NUGDTPE4.js";
22
+ import "./chunk-QGM4M3NI.js";
23
+ export {
24
+ getOrCreateSession,
25
+ getSession,
26
+ incrementMessageCount,
27
+ loadSessionStore,
28
+ pruneOldSessions,
29
+ resetSession,
30
+ resetSessionWithPolicy,
31
+ saveSessionStore,
32
+ shouldResetSession,
33
+ updateSession
34
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  MAX_DEPENDENTS_PER_TASK
3
- } from "./chunk-RO62LO6Z.js";
3
+ } from "./chunk-YP25WTQK.js";
4
4
  import {
5
5
  BATCH_TRIGGER_DELAY_MS
6
- } from "./chunk-4DU3C27M.js";
6
+ } from "./chunk-R4YSJ4EY.js";
7
7
  import {
8
8
  createLogger
9
9
  } from "./chunk-RCMD3U65.js";
@@ -6,7 +6,7 @@ import {
6
6
  MAX_TOTAL_PROMPT_CHARS,
7
7
  SECONDS_PER_DAY,
8
8
  SECONDS_PER_HOUR
9
- } from "./chunk-RO62LO6Z.js";
9
+ } from "./chunk-YP25WTQK.js";
10
10
  import "./chunk-QGM4M3NI.js";
11
11
 
12
12
  // src/telegram/task-executor.ts
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  serializeEmbedding
3
- } from "./chunk-EK7M5K26.js";
4
- import "./chunk-XBKSS6DM.js";
3
+ } from "./chunk-LCCVZ4D2.js";
4
+ import "./chunk-VFA7QMCZ.js";
5
5
  import {
6
6
  TOOL_RAG_KEYWORD_WEIGHT,
7
7
  TOOL_RAG_MIN_SCORE,
8
8
  TOOL_RAG_VECTOR_WEIGHT
9
- } from "./chunk-RO62LO6Z.js";
10
- import "./chunk-VAUJSSD3.js";
11
- import "./chunk-4DU3C27M.js";
9
+ } from "./chunk-YP25WTQK.js";
10
+ import "./chunk-XQUHC3JZ.js";
11
+ import "./chunk-R4YSJ4EY.js";
12
12
  import "./chunk-EYWNOHMJ.js";
13
13
  import {
14
14
  createLogger