teleton 0.8.5 → 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 (80) hide show
  1. package/README.md +24 -5
  2. package/dist/{bootstrap-SPDT3XBQ.js → bootstrap-PFBH6ALD.js} +10 -7
  3. package/dist/bridge-guards-HZTNH7IB.js +9 -0
  4. package/dist/{chunk-FSL2MOYK.js → chunk-2UUGRY5B.js} +144 -163
  5. package/dist/{chunk-LM6AL6LN.js → chunk-4MFN75ZK.js} +4449 -2776
  6. package/dist/{chunk-GUX6ZFVF.js → chunk-4MG2AROG.js} +4 -6
  7. package/dist/{chunk-6U6VA2OT.js → chunk-6IFNQWIM.js} +7276 -7300
  8. package/dist/chunk-7KI25UJU.js +215 -0
  9. package/dist/chunk-AX5NBEHX.js +12 -0
  10. package/dist/{chunk-7ZXUUDQQ.js → chunk-BLUES3FJ.js} +79 -100
  11. package/dist/{chunk-KYSAHDYE.js → chunk-BT2I3ETV.js} +1 -1
  12. package/dist/chunk-CXTZPOTA.js +107 -0
  13. package/dist/{chunk-4KURCUWD.js → chunk-D3GT6YIY.js} +59 -7
  14. package/dist/chunk-EKCXKL5M.js +53 -0
  15. package/dist/{chunk-5K4YDCVU.js → chunk-F6S3L3OV.js} +3 -3
  16. package/dist/{chunk-L3LPVF4Z.js → chunk-J4WDJ7XS.js} +2 -2
  17. package/dist/{chunk-Z63KUQX4.js → chunk-JYF2MM5I.js} +120 -110
  18. package/dist/{chunk-NVKBBTI6.js → chunk-K3QSIIMZ.js} +9 -6
  19. package/dist/chunk-OMQIAWEU.js +273 -0
  20. package/dist/chunk-PCT7GYBP.js +274 -0
  21. package/dist/{chunk-35X3V6OW.js → chunk-QYZBWU2D.js} +5 -5
  22. package/dist/{chunk-WTDAICGT.js → chunk-R6W4DJRK.js} +7 -7
  23. package/dist/{chunk-5SEMA47R.js → chunk-RILOEIK6.js} +1 -1
  24. package/dist/{chunk-6OOHHJ4N.js → chunk-TFTNZZDH.js} +20 -20
  25. package/dist/chunk-TTOZCZWE.js +96 -0
  26. package/dist/chunk-UJ54YT2T.js +12 -0
  27. package/dist/{chunk-2MZP75SH.js → chunk-ULVL2W3D.js} +152 -256
  28. package/dist/{chunk-NQ6FZKCE.js → chunk-V3S3NXBQ.js} +3 -1
  29. package/dist/{chunk-H7MFXJZK.js → chunk-WSL4KIOI.js} +31 -26
  30. package/dist/{chunk-PK3TVFBT.js → chunk-Z5WY7BSB.js} +5 -5
  31. package/dist/{chunk-LD24DWWE.js → chunk-ZGKE3OTA.js} +110 -47
  32. package/dist/{chunk-M6M4DCDU.js → chunk-ZHRDETCX.js} +3 -3
  33. package/dist/cli/index.d.ts +2 -0
  34. package/dist/cli/index.js +263 -163
  35. package/dist/{client-G62EZT6U.js → client-S5UIK6OG.js} +9 -7
  36. package/dist/daily-logs-3WXGYAQF.js +25 -0
  37. package/dist/{get-my-gifts-Y7EN7RK4.js → get-my-gifts-3YSYM3LI.js} +3 -2
  38. package/dist/{harden-permissions-6BLHRCQJ.js → harden-permissions-PV5SGV5D.js} +1 -1
  39. package/dist/index.d.ts +923 -0
  40. package/dist/index.js +28 -20
  41. package/dist/knowledge-RRWUIO3G.js +19 -0
  42. package/dist/{local-HQ3UJ7KR.js → local-MSZAXWUL.js} +2 -2
  43. package/dist/mcp-loader-OELDFR63.js +15 -0
  44. package/dist/{memory-BJH724PQ.js → memory-6U6HGRK2.js} +22 -12
  45. package/dist/{memory-hook-LUAKTXU5.js → memory-hook-T7Y235KY.js} +7 -7
  46. package/dist/messages-KV5ADNJB.js +17 -0
  47. package/dist/{migrate-C4LBLOZH.js → migrate-AX3HOKOO.js} +9 -7
  48. package/dist/{server-4J56HS62.js → server-MFRYOGHR.js} +20 -16
  49. package/dist/{server-I6TYJ36S.js → server-SFLCAZFR.js} +220 -19
  50. package/dist/{setup-server-VJ3MGUSM.js → setup-server-YWAPKZVE.js} +14 -13
  51. package/dist/{store-2IGAMTES.js → store-PGHQASBC.js} +10 -8
  52. package/dist/{task-dependency-resolver-CQ432Z7J.js → task-dependency-resolver-YQKADDEU.js} +24 -10
  53. package/dist/{task-executor-JELRREUV.js → task-executor-LWAWD225.js} +4 -4
  54. package/dist/{tool-adapter-IVX2XQJE.js → tool-adapter-VKLUZSQS.js} +1 -1
  55. package/dist/{tool-index-XPCMWBYY.js → tool-index-YEWDF5CK.js} +4 -4
  56. package/dist/{transcript-OEO3HA4Z.js → transcript-4Y3Z2BJ3.js} +2 -2
  57. package/dist/web/assets/Config-MNxA69ib.js +1 -0
  58. package/dist/web/assets/Conversations-Dk958paA.js +1 -0
  59. package/dist/web/assets/Dashboard-dM18fGOm.js +1 -0
  60. package/dist/web/assets/Hooks-D2griQnI.js +1 -0
  61. package/dist/web/assets/Mcp-CtWNzwsz.js +1 -0
  62. package/dist/web/assets/Memory-CfLwH45G.js +1 -0
  63. package/dist/web/assets/Plugins-3hoJprFo.js +1 -0
  64. package/dist/web/assets/SearchInput-CpcETdpE.js +1 -0
  65. package/dist/web/assets/Soul-BSxE73aK.js +1 -0
  66. package/dist/web/assets/Tasks-DkCkfu3A.js +1 -0
  67. package/dist/web/assets/TelegramSettingsPanel-BRzc5G6e.js +1 -0
  68. package/dist/web/assets/Tools-Du8B8Mb4.js +1 -0
  69. package/dist/web/assets/Wallet-BLILP2Gn.js +1 -0
  70. package/dist/web/assets/Workspace-qklcXpXV.js +1 -0
  71. package/dist/web/assets/index-BwEPTTKp.js +90 -0
  72. package/dist/web/assets/index-noejUsK7.css +1 -0
  73. package/dist/web/assets/{index.es-eSR4Qv6s.js → index.es-DdpKlnGb.js} +1 -1
  74. package/dist/web/assets/useToolManager-tdxkKn3H.js +1 -0
  75. package/dist/web/assets/utils-CnsbSMo4.js +1 -0
  76. package/dist/web/index.html +2 -2
  77. package/package.json +7 -8
  78. package/dist/web/assets/index-DmlyQVhR.css +0 -1
  79. package/dist/web/assets/index-Dn5ZH1Y6.js +0 -80
  80. package/dist/{chunk-WFTC3JJW.js → chunk-3NO7QU7W.js} +1 -1
package/dist/cli/index.js CHANGED
@@ -1,19 +1,16 @@
1
1
  import {
2
2
  ensureTlsCert
3
- } from "../chunk-5SEMA47R.js";
3
+ } from "../chunk-RILOEIK6.js";
4
4
  import {
5
5
  getModelsForProvider
6
- } from "../chunk-WFTC3JJW.js";
6
+ } from "../chunk-3NO7QU7W.js";
7
7
  import {
8
8
  TelegramUserClient,
9
9
  main
10
- } from "../chunk-LM6AL6LN.js";
11
- import "../chunk-NVKBBTI6.js";
12
- import "../chunk-5K4YDCVU.js";
13
- import "../chunk-2MZP75SH.js";
14
- import "../chunk-LD24DWWE.js";
15
- import "../chunk-H7MFXJZK.js";
16
- import "../chunk-6U6VA2OT.js";
10
+ } from "../chunk-4MFN75ZK.js";
11
+ import "../chunk-K3QSIIMZ.js";
12
+ import "../chunk-7KI25UJU.js";
13
+ import "../chunk-6IFNQWIM.js";
17
14
  import {
18
15
  CONFIGURABLE_KEYS,
19
16
  deleteNestedValue,
@@ -26,46 +23,58 @@ import {
26
23
  setNestedValue,
27
24
  walletExists,
28
25
  writeRawConfig
29
- } from "../chunk-M6M4DCDU.js";
26
+ } from "../chunk-ZHRDETCX.js";
30
27
  import {
31
28
  ConfigSchema,
32
29
  DealsConfigSchema,
33
30
  configExists,
34
- ensureWorkspace,
35
- getDefaultConfigPath,
36
- isNewWorkspace
37
- } from "../chunk-FSL2MOYK.js";
38
- import "../chunk-35X3V6OW.js";
31
+ getDefaultConfigPath
32
+ } from "../chunk-2UUGRY5B.js";
33
+ import "../chunk-7TECSLJ4.js";
34
+ import "../chunk-AX5NBEHX.js";
35
+ import "../chunk-F6S3L3OV.js";
36
+ import "../chunk-ULVL2W3D.js";
37
+ import "../chunk-QYZBWU2D.js";
38
+ import "../chunk-OMQIAWEU.js";
39
+ import "../chunk-4L66JHQE.js";
40
+ import "../chunk-TTOZCZWE.js";
41
+ import "../chunk-Z5WY7BSB.js";
42
+ import "../chunk-VFA7QMCZ.js";
43
+ import "../chunk-ZGKE3OTA.js";
44
+ import "../chunk-UJ54YT2T.js";
45
+ import "../chunk-WSL4KIOI.js";
46
+ import "../chunk-EKCXKL5M.js";
39
47
  import {
40
48
  getErrorMessage
41
49
  } from "../chunk-3UFPFWYP.js";
42
- import "../chunk-7TECSLJ4.js";
43
- import "../chunk-PK3TVFBT.js";
44
- import "../chunk-VFA7QMCZ.js";
50
+ import "../chunk-PCT7GYBP.js";
51
+ import {
52
+ ensureWorkspace,
53
+ isNewWorkspace
54
+ } from "../chunk-CXTZPOTA.js";
45
55
  import {
46
56
  TELEGRAM_MAX_MESSAGE_LENGTH
47
- } from "../chunk-L3LPVF4Z.js";
48
- import "../chunk-4KURCUWD.js";
57
+ } from "../chunk-J4WDJ7XS.js";
58
+ import "../chunk-D3GT6YIY.js";
49
59
  import {
50
60
  getClaudeCodeApiKey,
51
61
  isClaudeCodeTokenValid
52
- } from "../chunk-WTDAICGT.js";
62
+ } from "../chunk-R6W4DJRK.js";
53
63
  import {
54
64
  getProviderMetadata,
55
65
  getSupportedProviders,
56
66
  validateApiKeyFormat
57
- } from "../chunk-6OOHHJ4N.js";
67
+ } from "../chunk-TFTNZZDH.js";
58
68
  import {
59
69
  fetchWithTimeout
60
70
  } from "../chunk-XQUHC3JZ.js";
61
71
  import "../chunk-R4YSJ4EY.js";
62
- import "../chunk-GUX6ZFVF.js";
63
- import "../chunk-KYSAHDYE.js";
72
+ import "../chunk-4MG2AROG.js";
73
+ import "../chunk-BT2I3ETV.js";
64
74
  import {
65
75
  TELETON_ROOT
66
76
  } from "../chunk-L653KKCR.js";
67
- import "../chunk-NQ6FZKCE.js";
68
- import "../chunk-4L66JHQE.js";
77
+ import "../chunk-V3S3NXBQ.js";
69
78
  import "../chunk-3RG5ZIWI.js";
70
79
 
71
80
  // src/cli/index.ts
@@ -389,7 +398,7 @@ function sleep(ms) {
389
398
  }
390
399
  async function onboardCommand(options = {}) {
391
400
  if (options.ui) {
392
- const { SetupServer } = await import("../setup-server-VJ3MGUSM.js");
401
+ const { SetupServer } = await import("../setup-server-YWAPKZVE.js");
393
402
  const port = parseInt(options.uiPort || "7777") || 7777;
394
403
  const url = `http://localhost:${port}/setup`;
395
404
  const blue2 = "\x1B[34m";
@@ -432,14 +441,14 @@ ${blue2} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25
432
441
  } else {
433
442
  await runInteractiveOnboarding(options, prompter);
434
443
  }
435
- } catch (err) {
436
- if (err instanceof CancelledError) {
444
+ } catch (error) {
445
+ if (error instanceof CancelledError) {
437
446
  console.log(`
438
447
  ${DIM("Setup cancelled. No changes were made.")}
439
448
  `);
440
449
  process.exit(0);
441
450
  }
442
- throw err;
451
+ throw error;
443
452
  }
444
453
  }
445
454
  async function runInteractiveOnboarding(options, prompter) {
@@ -453,6 +462,7 @@ async function runInteractiveOnboarding(options, prompter) {
453
462
  let tonapiKey;
454
463
  let toncenterApiKey;
455
464
  let tavilyApiKey;
465
+ let telegramMode = "user";
456
466
  let botToken;
457
467
  let botUsername;
458
468
  let dmPolicy = "admin-only";
@@ -516,6 +526,23 @@ async function runInteractiveOnboarding(options, prompter) {
516
526
  const updated = identity.replace("[Your name - pick one or ask your human]", agentName.trim());
517
527
  writeFileSync(workspace.identityPath, updated, "utf-8");
518
528
  }
529
+ telegramMode = await select({
530
+ message: "Telegram mode",
531
+ default: "user",
532
+ theme: inquirerTheme,
533
+ choices: [
534
+ {
535
+ value: "user",
536
+ name: "User Account (full power)",
537
+ description: "Log in with your personal Telegram account"
538
+ },
539
+ {
540
+ value: "bot",
541
+ name: "Bot Telegram (simpler setup)",
542
+ description: "Use a Telegram bot token \u2014 no phone number needed"
543
+ }
544
+ ]
545
+ });
519
546
  STEPS[0].value = agentName;
520
547
  redraw(1);
521
548
  const providers = getSupportedProviders();
@@ -604,8 +631,8 @@ Token will auto-refresh when it expires.`,
604
631
  default: true,
605
632
  theme: inquirerTheme
606
633
  });
607
- } catch (err) {
608
- if (err instanceof CancelledError) throw err;
634
+ } catch (error) {
635
+ if (error instanceof CancelledError) throw error;
609
636
  prompter.warn(
610
637
  "Claude Code credentials not found. Make sure Claude Code is installed and authenticated (claude login)."
611
638
  );
@@ -707,41 +734,47 @@ Get it at: ${providerMeta.consoleUrl}`,
707
734
  }
708
735
  });
709
736
  userId = parseInt(userIdStr);
710
- dmPolicy = await select({
711
- message: "DM policy (private messages)",
712
- default: "admin-only",
713
- theme: inquirerTheme,
714
- choices: [
715
- {
716
- value: "admin-only",
717
- name: "Admin Only",
718
- description: "Only admins can DM the agent"
719
- },
720
- { value: "allowlist", name: "Allowlist", description: "Only specific users" },
721
- { value: "open", name: "Open", description: "Reply to everyone" },
722
- { value: "disabled", name: "Disabled", description: "Ignore all DMs" }
723
- ]
724
- });
725
- groupPolicy = await select({
726
- message: "Group policy",
727
- default: "admin-only",
728
- theme: inquirerTheme,
729
- choices: [
730
- {
731
- value: "admin-only",
732
- name: "Admin Only",
733
- description: "Only admins can trigger the agent"
734
- },
735
- { value: "allowlist", name: "Allowlist", description: "Only specific groups" },
736
- { value: "open", name: "Open", description: "Reply in all groups" },
737
- { value: "disabled", name: "Disabled", description: "Ignore all group messages" }
738
- ]
739
- });
740
- requireMention = await confirm({
741
- message: "Require @mention in groups?",
742
- default: true,
743
- theme: inquirerTheme
744
- });
737
+ if (telegramMode === "bot") {
738
+ dmPolicy = "admin-only";
739
+ groupPolicy = "admin-only";
740
+ requireMention = true;
741
+ } else {
742
+ dmPolicy = await select({
743
+ message: "DM policy (private messages)",
744
+ default: "admin-only",
745
+ theme: inquirerTheme,
746
+ choices: [
747
+ {
748
+ value: "admin-only",
749
+ name: "Admin Only",
750
+ description: "Only admins can DM the agent"
751
+ },
752
+ { value: "allowlist", name: "Allowlist", description: "Only specific users" },
753
+ { value: "open", name: "Open", description: "Reply to everyone" },
754
+ { value: "disabled", name: "Disabled", description: "Ignore all DMs" }
755
+ ]
756
+ });
757
+ groupPolicy = await select({
758
+ message: "Group policy",
759
+ default: "admin-only",
760
+ theme: inquirerTheme,
761
+ choices: [
762
+ {
763
+ value: "admin-only",
764
+ name: "Admin Only",
765
+ description: "Only admins can trigger the agent"
766
+ },
767
+ { value: "allowlist", name: "Allowlist", description: "Only specific groups" },
768
+ { value: "open", name: "Open", description: "Reply in all groups" },
769
+ { value: "disabled", name: "Disabled", description: "Ignore all group messages" }
770
+ ]
771
+ });
772
+ requireMention = await confirm({
773
+ message: "Require @mention in groups?",
774
+ default: true,
775
+ theme: inquirerTheme
776
+ });
777
+ }
745
778
  maxAgenticIterations = await input({
746
779
  message: "Max agentic iterations (tool call loops per message)",
747
780
  default: "5",
@@ -767,11 +800,11 @@ Get it at: ${providerMeta.consoleUrl}`,
767
800
  STEPS[2].value = `${dmPolicy}/${groupPolicy}`;
768
801
  redraw(3);
769
802
  const extras = [];
770
- const setupBot = await confirm({
803
+ const setupBot = telegramMode === "user" ? await confirm({
771
804
  message: `Add a Telegram bot token? ${DIM("(recommended \u2014 enables deals & inline buttons)")}`,
772
805
  default: true,
773
806
  theme: inquirerTheme
774
- });
807
+ }) : false;
775
808
  if (setupBot) {
776
809
  noteBox(
777
810
  "Create a bot with @BotFather on Telegram:\n1. Send /newbot and follow the instructions\n2. Copy the bot token\n3. Enable inline mode: /setinline on the bot",
@@ -997,43 +1030,76 @@ Get it at: ${providerMeta.consoleUrl}`,
997
1030
  }
998
1031
  STEPS[4].value = `${wallet.address.slice(0, 8)}...${wallet.address.slice(-4)}`;
999
1032
  redraw(5);
1000
- noteBox(
1001
- 'To get your API credentials:\n\n 1. Go to https://my.telegram.org/apps\n 2. Log in with your phone number\n 3. Click "API development tools"\n 4. Create an application (any name/short name works)\n 5. Copy the API ID (number) and API Hash (hex string)\n\n\u26A0 Do NOT use a VPN \u2014 Telegram will block the login page.',
1002
- "Telegram",
1003
- TON
1004
- );
1005
- const envApiId = process.env.TELETON_TG_API_ID;
1006
- const envApiHash = process.env.TELETON_TG_API_HASH;
1007
- const envPhone = process.env.TELETON_TG_PHONE;
1008
- const apiIdStr = options.apiId ? options.apiId.toString() : await input({
1009
- message: envApiId ? "API ID (from env)" : "API ID (from my.telegram.org)",
1010
- default: envApiId,
1011
- theme: inquirerTheme,
1012
- validate: (value) => {
1013
- if (!value || isNaN(parseInt(value))) return "Invalid API ID (must be a number)";
1014
- return true;
1015
- }
1016
- });
1017
- apiId = parseInt(apiIdStr);
1018
- apiHash = options.apiHash ? options.apiHash : await input({
1019
- message: envApiHash ? "API Hash (from env)" : "API Hash (from my.telegram.org)",
1020
- default: envApiHash,
1021
- theme: inquirerTheme,
1022
- validate: (value) => {
1023
- if (!value || value.length < 10) return "Invalid API Hash";
1024
- return true;
1025
- }
1026
- });
1027
- phone = options.phone ? options.phone : await input({
1028
- message: envPhone ? "Phone number (from env)" : "Phone number (international format)",
1029
- default: envPhone,
1030
- theme: inquirerTheme,
1031
- validate: (value) => {
1032
- if (!value || !value.startsWith("+")) return "Must start with +";
1033
- return true;
1033
+ if (telegramMode === "bot") {
1034
+ noteBox(
1035
+ "Create or use an existing bot with @BotFather on Telegram:\n1. Send /newbot and follow the instructions\n2. Copy the bot token (format: 123456:ABC-DEF...)\n3. Start the bot by sending /start to it",
1036
+ "Bot Token",
1037
+ TON
1038
+ );
1039
+ const tokenInput = await password({
1040
+ message: "Bot token (from @BotFather)",
1041
+ theme: inquirerTheme,
1042
+ validate: (value = "") => {
1043
+ if (!value) return "Bot token is required";
1044
+ if (!/^[0-9]+:[A-Za-z0-9_-]+$/.test(value))
1045
+ return "Invalid format (expected 123456:ABC...)";
1046
+ return true;
1047
+ }
1048
+ });
1049
+ botToken = tokenInput;
1050
+ spinner.start(DIM("Validating bot token..."));
1051
+ try {
1052
+ const res = await fetchWithTimeout(`https://api.telegram.org/bot${botToken}/getMe`);
1053
+ const data = await res.json();
1054
+ if (!data.ok) {
1055
+ spinner.warn(DIM("Bot token validation failed \u2014 saving anyway"));
1056
+ } else {
1057
+ botUsername = data.result.username;
1058
+ spinner.succeed(DIM(`Bot verified: @${botUsername}`));
1059
+ }
1060
+ } catch {
1061
+ spinner.warn(DIM("Could not validate bot token (network error) \u2014 saving anyway"));
1034
1062
  }
1035
- });
1036
- STEPS[5].value = phone;
1063
+ STEPS[5].value = botUsername ? `@${botUsername}` : "bot token set";
1064
+ } else {
1065
+ noteBox(
1066
+ 'To get your API credentials:\n\n 1. Go to https://my.telegram.org/apps\n 2. Log in with your phone number\n 3. Click "API development tools"\n 4. Create an application (any name/short name works)\n 5. Copy the API ID (number) and API Hash (hex string)\n\n\u26A0 Do NOT use a VPN \u2014 Telegram will block the login page.',
1067
+ "Telegram",
1068
+ TON
1069
+ );
1070
+ const envApiId = process.env.TELETON_TG_API_ID;
1071
+ const envApiHash = process.env.TELETON_TG_API_HASH;
1072
+ const envPhone = process.env.TELETON_TG_PHONE;
1073
+ const apiIdStr = options.apiId ? options.apiId.toString() : await input({
1074
+ message: envApiId ? "API ID (from env)" : "API ID (from my.telegram.org)",
1075
+ default: envApiId,
1076
+ theme: inquirerTheme,
1077
+ validate: (value) => {
1078
+ if (!value || isNaN(parseInt(value))) return "Invalid API ID (must be a number)";
1079
+ return true;
1080
+ }
1081
+ });
1082
+ apiId = parseInt(apiIdStr);
1083
+ apiHash = options.apiHash ? options.apiHash : await input({
1084
+ message: envApiHash ? "API Hash (from env)" : "API Hash (from my.telegram.org)",
1085
+ default: envApiHash,
1086
+ theme: inquirerTheme,
1087
+ validate: (value) => {
1088
+ if (!value || value.length < 10) return "Invalid API Hash";
1089
+ return true;
1090
+ }
1091
+ });
1092
+ phone = options.phone ? options.phone : await input({
1093
+ message: envPhone ? "Phone number (from env)" : "Phone number (international format)",
1094
+ default: envPhone,
1095
+ theme: inquirerTheme,
1096
+ validate: (value) => {
1097
+ if (!value || !value.startsWith("+")) return "Must start with +";
1098
+ return true;
1099
+ }
1100
+ });
1101
+ STEPS[5].value = phone;
1102
+ }
1037
1103
  redraw(6);
1038
1104
  const config = {
1039
1105
  meta: {
@@ -1050,6 +1116,7 @@ Get it at: ${providerMeta.consoleUrl}`,
1050
1116
  temperature: 0.7,
1051
1117
  system_prompt: null,
1052
1118
  max_agentic_iterations: parseInt(maxAgenticIterations, 10),
1119
+ toolset: "full",
1053
1120
  session_reset_policy: {
1054
1121
  daily_reset_enabled: true,
1055
1122
  daily_reset_hour: 4,
@@ -1058,9 +1125,10 @@ Get it at: ${providerMeta.consoleUrl}`,
1058
1125
  }
1059
1126
  },
1060
1127
  telegram: {
1061
- api_id: apiId,
1062
- api_hash: apiHash,
1063
- phone,
1128
+ mode: telegramMode,
1129
+ api_id: telegramMode === "user" ? apiId : 0,
1130
+ api_hash: telegramMode === "user" ? apiHash : "",
1131
+ phone: telegramMode === "user" ? phone : "",
1064
1132
  session_name: "teleton_session",
1065
1133
  session_path: workspace.sessionPath,
1066
1134
  dm_policy: dmPolicy,
@@ -1077,7 +1145,8 @@ Get it at: ${providerMeta.consoleUrl}`,
1077
1145
  agent_channel: null,
1078
1146
  debounce_ms: 1500,
1079
1147
  bot_token: botToken,
1080
- bot_username: botUsername
1148
+ bot_username: botUsername,
1149
+ stream_mode: "all"
1081
1150
  },
1082
1151
  storage: {
1083
1152
  sessions_file: `${workspace.root}/sessions.json`,
@@ -1122,8 +1191,8 @@ Get it at: ${providerMeta.consoleUrl}`,
1122
1191
  ton_proxy: { enabled: false, port: 8080 },
1123
1192
  heartbeat: {
1124
1193
  enabled: true,
1125
- interval_ms: 18e5,
1126
- prompt: "Read HEARTBEAT.md if it exists. Follow it strictly. If nothing needs attention, reply NO_ACTION.",
1194
+ interval_ms: 36e5,
1195
+ prompt: "Execute your HEARTBEAT.md checklist now. Work through each item using tool calls.",
1127
1196
  self_configurable: false
1128
1197
  },
1129
1198
  plugins: {},
@@ -1137,44 +1206,52 @@ Get it at: ${providerMeta.consoleUrl}`,
1137
1206
  writeFileSync(workspace.configPath, configYaml, { encoding: "utf-8", mode: 384 });
1138
1207
  spinner.succeed(DIM(`Configuration saved: ${workspace.configPath}`));
1139
1208
  let telegramConnected = false;
1140
- const connectNow = await confirm({
1141
- message: `Connect to Telegram now? ${DIM("(verification code will be sent to your phone)")}`,
1142
- default: true,
1143
- theme: inquirerTheme
1144
- });
1145
- if (connectNow) {
1146
- console.log(
1147
- `
1209
+ if (telegramMode === "bot") {
1210
+ console.log(`
1211
+ ${DIM("Bot mode \u2014 no Telegram auth required. Ready to start.")}
1212
+ `);
1213
+ STEPS[6].value = "Bot mode \u2713";
1214
+ telegramConnected = true;
1215
+ } else {
1216
+ const connectNow = await confirm({
1217
+ message: `Connect to Telegram now? ${DIM("(verification code will be sent to your phone)")}`,
1218
+ default: true,
1219
+ theme: inquirerTheme
1220
+ });
1221
+ if (connectNow) {
1222
+ console.log(
1223
+ `
1148
1224
  ${DIM("Connecting to Telegram... Check your phone for the verification code.")}`
1149
- );
1150
- try {
1151
- const sessionPath = join(TELETON_ROOT, "telegram_session.txt");
1152
- const client = new TelegramUserClient({
1153
- apiId,
1154
- apiHash,
1155
- phone,
1156
- sessionPath
1157
- });
1158
- await client.connect();
1159
- const me = client.getMe();
1160
- await client.disconnect();
1161
- telegramConnected = true;
1162
- const displayName = `${me?.firstName || ""}${me?.username ? ` (@${me.username})` : ""}`;
1163
- console.log(` ${GREEN("\u2713")} ${DIM("Telegram connected as")} ${CYAN(displayName)}
1225
+ );
1226
+ try {
1227
+ const sessionPath = join(TELETON_ROOT, "telegram_session.txt");
1228
+ const client = new TelegramUserClient({
1229
+ apiId,
1230
+ apiHash,
1231
+ phone,
1232
+ sessionPath
1233
+ });
1234
+ await client.connect();
1235
+ const me = client.getMe();
1236
+ await client.disconnect();
1237
+ telegramConnected = true;
1238
+ const displayName = `${me?.firstName || ""}${me?.username ? ` (@${me.username})` : ""}`;
1239
+ console.log(` ${GREEN("\u2713")} ${DIM("Telegram connected as")} ${CYAN(displayName)}
1164
1240
  `);
1165
- STEPS[6].value = `Connected${me?.username ? ` (@${me.username})` : ""}`;
1166
- } catch (err) {
1167
- prompter.warn(
1168
- `Telegram connection failed: ${err instanceof Error ? err.message : String(err)}
1241
+ STEPS[6].value = `Connected${me?.username ? ` (@${me.username})` : ""}`;
1242
+ } catch (error) {
1243
+ prompter.warn(
1244
+ `Telegram connection failed: ${getErrorMessage(error)}
1169
1245
  You can authenticate later when running: teleton start`
1170
- );
1171
- STEPS[6].value = "Auth on first start";
1172
- }
1173
- } else {
1174
- console.log(`
1246
+ );
1247
+ STEPS[6].value = "Auth on first start";
1248
+ }
1249
+ } else {
1250
+ console.log(`
1175
1251
  ${DIM("You can authenticate later when running: teleton start")}
1176
1252
  `);
1177
- STEPS[6].value = "Auth on first start";
1253
+ STEPS[6].value = "Auth on first start";
1254
+ }
1178
1255
  }
1179
1256
  console.clear();
1180
1257
  console.log();
@@ -1190,10 +1267,26 @@ You can authenticate later when running: teleton start`
1190
1267
  }
1191
1268
  async function runNonInteractiveOnboarding(options, prompter) {
1192
1269
  const selectedProvider = options.provider || "anthropic";
1270
+ const nonInteractiveMode = options.mode || "user";
1193
1271
  const needsApiKey = selectedProvider !== "cocoon" && selectedProvider !== "local";
1194
- if (!options.apiId || !options.apiHash || !options.phone || !options.userId) {
1195
- prompter.error("Non-interactive mode requires: --api-id, --api-hash, --phone, --user-id");
1196
- process.exit(1);
1272
+ if (nonInteractiveMode === "bot") {
1273
+ if (!options.botToken) {
1274
+ prompter.error("Non-interactive bot mode requires: --bot-token");
1275
+ process.exit(1);
1276
+ }
1277
+ if (!/^[0-9]+:[A-Za-z0-9_-]+$/.test(options.botToken)) {
1278
+ prompter.error("--bot-token format invalid (expected 123456:ABC...)");
1279
+ process.exit(1);
1280
+ }
1281
+ if (!options.userId) {
1282
+ prompter.error("Non-interactive bot mode requires: --user-id");
1283
+ process.exit(1);
1284
+ }
1285
+ } else {
1286
+ if (!options.apiId || !options.apiHash || !options.phone || !options.userId) {
1287
+ prompter.error("Non-interactive mode requires: --api-id, --api-hash, --phone, --user-id");
1288
+ process.exit(1);
1289
+ }
1197
1290
  }
1198
1291
  if (needsApiKey && !options.apiKey) {
1199
1292
  prompter.error(`Non-interactive mode requires --api-key for provider "${selectedProvider}"`);
@@ -1223,6 +1316,7 @@ async function runNonInteractiveOnboarding(options, prompter) {
1223
1316
  temperature: 0.7,
1224
1317
  system_prompt: null,
1225
1318
  max_agentic_iterations: 5,
1319
+ toolset: "full",
1226
1320
  session_reset_policy: {
1227
1321
  daily_reset_enabled: true,
1228
1322
  daily_reset_hour: 4,
@@ -1231,9 +1325,10 @@ async function runNonInteractiveOnboarding(options, prompter) {
1231
1325
  }
1232
1326
  },
1233
1327
  telegram: {
1234
- api_id: options.apiId,
1235
- api_hash: options.apiHash,
1236
- phone: options.phone,
1328
+ mode: nonInteractiveMode,
1329
+ api_id: nonInteractiveMode === "user" ? options.apiId ?? 0 : 0,
1330
+ api_hash: nonInteractiveMode === "user" ? options.apiHash ?? "" : "",
1331
+ phone: nonInteractiveMode === "user" ? options.phone ?? "" : "",
1237
1332
  session_name: "teleton_session",
1238
1333
  session_path: workspace.sessionPath,
1239
1334
  dm_policy: "admin-only",
@@ -1245,12 +1340,13 @@ async function runNonInteractiveOnboarding(options, prompter) {
1245
1340
  typing_simulation: true,
1246
1341
  rate_limit_messages_per_second: 1,
1247
1342
  rate_limit_groups_per_minute: 20,
1248
- admin_ids: [options.userId],
1249
- owner_id: options.userId,
1343
+ admin_ids: [options.userId ?? 0],
1344
+ owner_id: options.userId ?? 0,
1250
1345
  agent_channel: null,
1251
1346
  debounce_ms: 1500,
1252
- bot_token: void 0,
1253
- bot_username: void 0
1347
+ bot_token: nonInteractiveMode === "bot" ? options.botToken : void 0,
1348
+ bot_username: void 0,
1349
+ stream_mode: "all"
1254
1350
  },
1255
1351
  storage: {
1256
1352
  sessions_file: `${workspace.root}/sessions.json`,
@@ -1294,8 +1390,8 @@ async function runNonInteractiveOnboarding(options, prompter) {
1294
1390
  ton_proxy: { enabled: false, port: 8080 },
1295
1391
  heartbeat: {
1296
1392
  enabled: true,
1297
- interval_ms: 18e5,
1298
- prompt: "Read HEARTBEAT.md if it exists. Follow it strictly. If nothing needs attention, reply NO_ACTION.",
1393
+ interval_ms: 36e5,
1394
+ prompt: "Execute your HEARTBEAT.md checklist now. Work through each item using tool calls.",
1299
1395
  self_configurable: false
1300
1396
  },
1301
1397
  mcp: { servers: {} },
@@ -1345,11 +1441,11 @@ async function checkConfig(workspaceDir) {
1345
1441
  status: "ok",
1346
1442
  message: "Valid"
1347
1443
  };
1348
- } catch (err) {
1444
+ } catch (error) {
1349
1445
  return {
1350
1446
  name: "Config file",
1351
1447
  status: "error",
1352
- message: `Parse error: ${err instanceof Error ? err.message : String(err)}`
1448
+ message: `Parse error: ${getErrorMessage(error)}`
1353
1449
  };
1354
1450
  }
1355
1451
  }
@@ -1828,12 +1924,12 @@ async function actionSet(key, value, configPath) {
1828
1924
  }
1829
1925
  });
1830
1926
  }
1831
- } catch (e) {
1832
- if (e instanceof CancelledError) {
1927
+ } catch (error) {
1928
+ if (error instanceof CancelledError) {
1833
1929
  console.log("Cancelled.");
1834
1930
  return;
1835
1931
  }
1836
- throw e;
1932
+ throw error;
1837
1933
  }
1838
1934
  }
1839
1935
  const err = meta.validate(value);
@@ -1974,7 +2070,7 @@ program.command("start").description("Start the Teleton agent").option("-c, --co
1974
2070
  if (options.jsonCredentials) {
1975
2071
  process.env.TELETON_JSON_CREDENTIALS = "true";
1976
2072
  }
1977
- const { startApiOnly } = await import("../bootstrap-SPDT3XBQ.js");
2073
+ const { startApiOnly } = await import("../bootstrap-PFBH6ALD.js");
1978
2074
  await startApiOnly({ config: options.config, apiPort: options.apiPort });
1979
2075
  return;
1980
2076
  }
@@ -2017,7 +2113,11 @@ program.command("doctor").description("Run system health checks").action(async (
2017
2113
  var mcp = program.command("mcp").description("Manage MCP (Model Context Protocol) servers");
2018
2114
  mcp.command("add <package> [args...]").description(
2019
2115
  "Add an MCP server (e.g. teleton mcp add @modelcontextprotocol/server-filesystem /tmp)"
2020
- ).option("-n, --name <name>", "Server name (auto-derived from package if omitted)").option("-s, --scope <scope>", "Tool scope: always | dm-only | group-only | admin-only", "always").option(
2116
+ ).option("-n, --name <name>", "Server name (auto-derived from package if omitted)").option(
2117
+ "-s, --scope <scope>",
2118
+ "Tool scope: always | open | dm-only | group-only | admin-only | allowlist | disabled",
2119
+ "always"
2120
+ ).option(
2021
2121
  "-e, --env <KEY=VALUE...>",
2022
2122
  "Environment variables (repeatable)",
2023
2123
  (v, prev) => [...prev, v],
@@ -7,15 +7,16 @@ import {
7
7
  isOAuthToken,
8
8
  loadContextFromTranscript,
9
9
  registerCocoonModels,
10
- registerLocalModels
11
- } from "./chunk-4KURCUWD.js";
12
- import "./chunk-WTDAICGT.js";
13
- import "./chunk-6OOHHJ4N.js";
10
+ registerLocalModels,
11
+ streamWithContext
12
+ } from "./chunk-D3GT6YIY.js";
13
+ import "./chunk-R6W4DJRK.js";
14
+ import "./chunk-TFTNZZDH.js";
14
15
  import "./chunk-XQUHC3JZ.js";
15
16
  import "./chunk-R4YSJ4EY.js";
16
- import "./chunk-GUX6ZFVF.js";
17
+ import "./chunk-4MG2AROG.js";
17
18
  import "./chunk-L653KKCR.js";
18
- import "./chunk-NQ6FZKCE.js";
19
+ import "./chunk-V3S3NXBQ.js";
19
20
  import "./chunk-3RG5ZIWI.js";
20
21
  export {
21
22
  chatWithContext,
@@ -26,5 +27,6 @@ export {
26
27
  isOAuthToken,
27
28
  loadContextFromTranscript,
28
29
  registerCocoonModels,
29
- registerLocalModels
30
+ registerLocalModels,
31
+ streamWithContext
30
32
  };