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.
- package/README.md +40 -17
- package/dist/{bootstrap-NNEI3Z5H.js → bootstrap-PFBH6ALD.js} +11 -8
- package/dist/bridge-guards-HZTNH7IB.js +9 -0
- package/dist/{chunk-NH2CNRKJ.js → chunk-2UUGRY5B.js} +151 -159
- package/dist/{chunk-UMUONAD6.js → chunk-4MFN75ZK.js} +5941 -2716
- package/dist/{chunk-LC4TV3KL.js → chunk-4MG2AROG.js} +5 -7
- package/dist/{chunk-LZQOX6YY.js → chunk-6IFNQWIM.js} +7714 -8748
- package/dist/chunk-7KI25UJU.js +215 -0
- package/dist/chunk-AX5NBEHX.js +12 -0
- package/dist/{chunk-5LOHRZYY.js → chunk-BLUES3FJ.js} +80 -101
- package/dist/{chunk-CUE4UZXR.js → chunk-BT2I3ETV.js} +3 -3
- package/dist/chunk-CXTZPOTA.js +107 -0
- package/dist/{chunk-LVTKJQ7O.js → chunk-D3GT6YIY.js} +59 -7
- package/dist/chunk-EKCXKL5M.js +53 -0
- package/dist/{chunk-XDZDOKIF.js → chunk-F6S3L3OV.js} +3 -3
- package/dist/{chunk-C4NKJT2Z.js → chunk-J4WDJ7XS.js} +1 -1
- package/dist/{chunk-G7PCW63M.js → chunk-JYF2MM5I.js} +147 -113
- package/dist/{chunk-NVKBBTI6.js → chunk-K3QSIIMZ.js} +9 -6
- package/dist/{chunk-EYWNOHMJ.js → chunk-L653KKCR.js} +1 -0
- package/dist/chunk-OMQIAWEU.js +273 -0
- package/dist/chunk-PCT7GYBP.js +274 -0
- package/dist/chunk-QYZBWU2D.js +139 -0
- package/dist/{chunk-WTDAICGT.js → chunk-R6W4DJRK.js} +7 -7
- package/dist/{chunk-5SEMA47R.js → chunk-RILOEIK6.js} +1 -1
- package/dist/{chunk-6OOHHJ4N.js → chunk-TFTNZZDH.js} +20 -20
- package/dist/chunk-TTOZCZWE.js +96 -0
- package/dist/chunk-UJ54YT2T.js +12 -0
- package/dist/{chunk-GHMXWAXI.js → chunk-ULVL2W3D.js} +211 -445
- package/dist/{chunk-NQ6FZKCE.js → chunk-V3S3NXBQ.js} +3 -1
- package/dist/{chunk-H7MFXJZK.js → chunk-WSL4KIOI.js} +31 -26
- package/dist/{chunk-35MX4ZUI.js → chunk-Z5WY7BSB.js} +5 -5
- package/dist/{chunk-ALKAAG4O.js → chunk-ZGKE3OTA.js} +112 -49
- package/dist/{chunk-JROBTXWY.js → chunk-ZHRDETCX.js} +38 -4
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +272 -159
- package/dist/{client-5KD25NOP.js → client-S5UIK6OG.js} +10 -8
- package/dist/daily-logs-3WXGYAQF.js +25 -0
- package/dist/{get-my-gifts-Y7EN7RK4.js → get-my-gifts-3YSYM3LI.js} +3 -2
- package/dist/harden-permissions-PV5SGV5D.js +100 -0
- package/dist/index.d.ts +923 -0
- package/dist/index.js +29 -20
- package/dist/knowledge-RRWUIO3G.js +19 -0
- package/dist/{local-IHKJFQJS.js → local-MSZAXWUL.js} +3 -3
- package/dist/mcp-loader-OELDFR63.js +15 -0
- package/dist/{memory-QMJRM3XJ.js → memory-6U6HGRK2.js} +23 -12
- package/dist/memory-hook-T7Y235KY.js +19 -0
- package/dist/messages-KV5ADNJB.js +17 -0
- package/dist/{migrate-5VBAP52B.js → migrate-AX3HOKOO.js} +10 -7
- package/dist/{paths-XA2RJH4S.js → paths-WMVV7ZAJ.js} +1 -1
- package/dist/{server-WWGVDFPW.js → server-MFRYOGHR.js} +21 -23
- package/dist/{server-AJCOURH7.js → server-SFLCAZFR.js} +221 -27
- package/dist/{setup-server-VDY64CWW.js → setup-server-YWAPKZVE.js} +26 -26
- package/dist/{store-BY7S6IFN.js → store-PGHQASBC.js} +11 -8
- package/dist/{task-dependency-resolver-L6UUMTHK.js → task-dependency-resolver-YQKADDEU.js} +24 -10
- package/dist/{task-executor-XBNJLUCS.js → task-executor-LWAWD225.js} +4 -4
- package/dist/{tool-adapter-IVX2XQJE.js → tool-adapter-VKLUZSQS.js} +1 -1
- package/dist/{tool-index-FTERJSZK.js → tool-index-YEWDF5CK.js} +5 -5
- package/dist/{transcript-IM7G25OS.js → transcript-4Y3Z2BJ3.js} +3 -3
- package/dist/web/assets/Config-MNxA69ib.js +1 -0
- package/dist/web/assets/Conversations-Dk958paA.js +1 -0
- package/dist/web/assets/Dashboard-dM18fGOm.js +1 -0
- package/dist/web/assets/Hooks-D2griQnI.js +1 -0
- package/dist/web/assets/Mcp-CtWNzwsz.js +1 -0
- package/dist/web/assets/Memory-CfLwH45G.js +1 -0
- package/dist/web/assets/Plugins-3hoJprFo.js +1 -0
- package/dist/web/assets/SearchInput-CpcETdpE.js +1 -0
- package/dist/web/assets/Soul-BSxE73aK.js +1 -0
- package/dist/web/assets/Tasks-DkCkfu3A.js +1 -0
- package/dist/web/assets/TelegramSettingsPanel-BRzc5G6e.js +1 -0
- package/dist/web/assets/Tools-Du8B8Mb4.js +1 -0
- package/dist/web/assets/Wallet-BLILP2Gn.js +1 -0
- package/dist/web/assets/Workspace-qklcXpXV.js +1 -0
- package/dist/web/assets/index-BwEPTTKp.js +90 -0
- package/dist/web/assets/index-noejUsK7.css +1 -0
- package/dist/web/assets/{index.es-DitvF-9H.js → index.es-DdpKlnGb.js} +1 -1
- package/dist/web/assets/useToolManager-tdxkKn3H.js +1 -0
- package/dist/web/assets/utils-CnsbSMo4.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +7 -12
- package/src/templates/HEARTBEAT.md +5 -0
- package/dist/memory-hook-VUNWZ3NY.js +0 -19
- package/dist/web/assets/index-BfYCdwLI.js +0 -80
- package/dist/web/assets/index-DmlyQVhR.css +0 -1
- package/dist/{chunk-WFTC3JJW.js → chunk-3NO7QU7W.js} +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureTlsCert
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-RILOEIK6.js";
|
|
4
4
|
import {
|
|
5
5
|
getModelsForProvider
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3NO7QU7W.js";
|
|
7
7
|
import {
|
|
8
8
|
TelegramUserClient,
|
|
9
9
|
main
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-4MFN75ZK.js";
|
|
11
|
+
import "../chunk-K3QSIIMZ.js";
|
|
12
|
+
import "../chunk-7KI25UJU.js";
|
|
13
|
+
import "../chunk-6IFNQWIM.js";
|
|
14
14
|
import {
|
|
15
15
|
CONFIGURABLE_KEYS,
|
|
16
16
|
deleteNestedValue,
|
|
@@ -23,48 +23,58 @@ import {
|
|
|
23
23
|
setNestedValue,
|
|
24
24
|
walletExists,
|
|
25
25
|
writeRawConfig
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-ZHRDETCX.js";
|
|
27
27
|
import {
|
|
28
28
|
ConfigSchema,
|
|
29
29
|
DealsConfigSchema,
|
|
30
30
|
configExists,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-
|
|
37
|
-
import "../chunk-
|
|
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";
|
|
38
47
|
import {
|
|
39
48
|
getErrorMessage
|
|
40
49
|
} from "../chunk-3UFPFWYP.js";
|
|
41
|
-
import "../chunk-
|
|
42
|
-
import
|
|
43
|
-
|
|
50
|
+
import "../chunk-PCT7GYBP.js";
|
|
51
|
+
import {
|
|
52
|
+
ensureWorkspace,
|
|
53
|
+
isNewWorkspace
|
|
54
|
+
} from "../chunk-CXTZPOTA.js";
|
|
44
55
|
import {
|
|
45
56
|
TELEGRAM_MAX_MESSAGE_LENGTH
|
|
46
|
-
} from "../chunk-
|
|
47
|
-
import "../chunk-
|
|
57
|
+
} from "../chunk-J4WDJ7XS.js";
|
|
58
|
+
import "../chunk-D3GT6YIY.js";
|
|
48
59
|
import {
|
|
49
60
|
getClaudeCodeApiKey,
|
|
50
61
|
isClaudeCodeTokenValid
|
|
51
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-R6W4DJRK.js";
|
|
52
63
|
import {
|
|
53
64
|
getProviderMetadata,
|
|
54
65
|
getSupportedProviders,
|
|
55
66
|
validateApiKeyFormat
|
|
56
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-TFTNZZDH.js";
|
|
57
68
|
import {
|
|
58
69
|
fetchWithTimeout
|
|
59
70
|
} from "../chunk-XQUHC3JZ.js";
|
|
60
71
|
import "../chunk-R4YSJ4EY.js";
|
|
61
|
-
import "../chunk-
|
|
62
|
-
import "../chunk-
|
|
72
|
+
import "../chunk-4MG2AROG.js";
|
|
73
|
+
import "../chunk-BT2I3ETV.js";
|
|
63
74
|
import {
|
|
64
75
|
TELETON_ROOT
|
|
65
|
-
} from "../chunk-
|
|
66
|
-
import "../chunk-
|
|
67
|
-
import "../chunk-4L66JHQE.js";
|
|
76
|
+
} from "../chunk-L653KKCR.js";
|
|
77
|
+
import "../chunk-V3S3NXBQ.js";
|
|
68
78
|
import "../chunk-3RG5ZIWI.js";
|
|
69
79
|
|
|
70
80
|
// src/cli/index.ts
|
|
@@ -388,7 +398,7 @@ function sleep(ms) {
|
|
|
388
398
|
}
|
|
389
399
|
async function onboardCommand(options = {}) {
|
|
390
400
|
if (options.ui) {
|
|
391
|
-
const { SetupServer } = await import("../setup-server-
|
|
401
|
+
const { SetupServer } = await import("../setup-server-YWAPKZVE.js");
|
|
392
402
|
const port = parseInt(options.uiPort || "7777") || 7777;
|
|
393
403
|
const url = `http://localhost:${port}/setup`;
|
|
394
404
|
const blue2 = "\x1B[34m";
|
|
@@ -431,14 +441,14 @@ ${blue2} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25
|
|
|
431
441
|
} else {
|
|
432
442
|
await runInteractiveOnboarding(options, prompter);
|
|
433
443
|
}
|
|
434
|
-
} catch (
|
|
435
|
-
if (
|
|
444
|
+
} catch (error) {
|
|
445
|
+
if (error instanceof CancelledError) {
|
|
436
446
|
console.log(`
|
|
437
447
|
${DIM("Setup cancelled. No changes were made.")}
|
|
438
448
|
`);
|
|
439
449
|
process.exit(0);
|
|
440
450
|
}
|
|
441
|
-
throw
|
|
451
|
+
throw error;
|
|
442
452
|
}
|
|
443
453
|
}
|
|
444
454
|
async function runInteractiveOnboarding(options, prompter) {
|
|
@@ -452,6 +462,7 @@ async function runInteractiveOnboarding(options, prompter) {
|
|
|
452
462
|
let tonapiKey;
|
|
453
463
|
let toncenterApiKey;
|
|
454
464
|
let tavilyApiKey;
|
|
465
|
+
let telegramMode = "user";
|
|
455
466
|
let botToken;
|
|
456
467
|
let botUsername;
|
|
457
468
|
let dmPolicy = "admin-only";
|
|
@@ -515,6 +526,23 @@ async function runInteractiveOnboarding(options, prompter) {
|
|
|
515
526
|
const updated = identity.replace("[Your name - pick one or ask your human]", agentName.trim());
|
|
516
527
|
writeFileSync(workspace.identityPath, updated, "utf-8");
|
|
517
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
|
+
});
|
|
518
546
|
STEPS[0].value = agentName;
|
|
519
547
|
redraw(1);
|
|
520
548
|
const providers = getSupportedProviders();
|
|
@@ -603,8 +631,8 @@ Token will auto-refresh when it expires.`,
|
|
|
603
631
|
default: true,
|
|
604
632
|
theme: inquirerTheme
|
|
605
633
|
});
|
|
606
|
-
} catch (
|
|
607
|
-
if (
|
|
634
|
+
} catch (error) {
|
|
635
|
+
if (error instanceof CancelledError) throw error;
|
|
608
636
|
prompter.warn(
|
|
609
637
|
"Claude Code credentials not found. Make sure Claude Code is installed and authenticated (claude login)."
|
|
610
638
|
);
|
|
@@ -706,41 +734,47 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
706
734
|
}
|
|
707
735
|
});
|
|
708
736
|
userId = parseInt(userIdStr);
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
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
|
+
}
|
|
744
778
|
maxAgenticIterations = await input({
|
|
745
779
|
message: "Max agentic iterations (tool call loops per message)",
|
|
746
780
|
default: "5",
|
|
@@ -766,11 +800,11 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
766
800
|
STEPS[2].value = `${dmPolicy}/${groupPolicy}`;
|
|
767
801
|
redraw(3);
|
|
768
802
|
const extras = [];
|
|
769
|
-
const setupBot = await confirm({
|
|
803
|
+
const setupBot = telegramMode === "user" ? await confirm({
|
|
770
804
|
message: `Add a Telegram bot token? ${DIM("(recommended \u2014 enables deals & inline buttons)")}`,
|
|
771
805
|
default: true,
|
|
772
806
|
theme: inquirerTheme
|
|
773
|
-
});
|
|
807
|
+
}) : false;
|
|
774
808
|
if (setupBot) {
|
|
775
809
|
noteBox(
|
|
776
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",
|
|
@@ -996,43 +1030,76 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
996
1030
|
}
|
|
997
1031
|
STEPS[4].value = `${wallet.address.slice(0, 8)}...${wallet.address.slice(-4)}`;
|
|
998
1032
|
redraw(5);
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
default: envPhone,
|
|
1029
|
-
theme: inquirerTheme,
|
|
1030
|
-
validate: (value) => {
|
|
1031
|
-
if (!value || !value.startsWith("+")) return "Must start with +";
|
|
1032
|
-
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"));
|
|
1033
1062
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
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
|
+
}
|
|
1036
1103
|
redraw(6);
|
|
1037
1104
|
const config = {
|
|
1038
1105
|
meta: {
|
|
@@ -1049,6 +1116,7 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
1049
1116
|
temperature: 0.7,
|
|
1050
1117
|
system_prompt: null,
|
|
1051
1118
|
max_agentic_iterations: parseInt(maxAgenticIterations, 10),
|
|
1119
|
+
toolset: "full",
|
|
1052
1120
|
session_reset_policy: {
|
|
1053
1121
|
daily_reset_enabled: true,
|
|
1054
1122
|
daily_reset_hour: 4,
|
|
@@ -1057,9 +1125,10 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
1057
1125
|
}
|
|
1058
1126
|
},
|
|
1059
1127
|
telegram: {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1128
|
+
mode: telegramMode,
|
|
1129
|
+
api_id: telegramMode === "user" ? apiId : 0,
|
|
1130
|
+
api_hash: telegramMode === "user" ? apiHash : "",
|
|
1131
|
+
phone: telegramMode === "user" ? phone : "",
|
|
1063
1132
|
session_name: "teleton_session",
|
|
1064
1133
|
session_path: workspace.sessionPath,
|
|
1065
1134
|
dm_policy: dmPolicy,
|
|
@@ -1076,7 +1145,8 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
1076
1145
|
agent_channel: null,
|
|
1077
1146
|
debounce_ms: 1500,
|
|
1078
1147
|
bot_token: botToken,
|
|
1079
|
-
bot_username: botUsername
|
|
1148
|
+
bot_username: botUsername,
|
|
1149
|
+
stream_mode: "all"
|
|
1080
1150
|
},
|
|
1081
1151
|
storage: {
|
|
1082
1152
|
sessions_file: `${workspace.root}/sessions.json`,
|
|
@@ -1119,6 +1189,12 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
1119
1189
|
}
|
|
1120
1190
|
},
|
|
1121
1191
|
ton_proxy: { enabled: false, port: 8080 },
|
|
1192
|
+
heartbeat: {
|
|
1193
|
+
enabled: true,
|
|
1194
|
+
interval_ms: 36e5,
|
|
1195
|
+
prompt: "Execute your HEARTBEAT.md checklist now. Work through each item using tool calls.",
|
|
1196
|
+
self_configurable: false
|
|
1197
|
+
},
|
|
1122
1198
|
plugins: {},
|
|
1123
1199
|
...selectedProvider === "cocoon" ? { cocoon: { port: cocoonInstance } } : {},
|
|
1124
1200
|
tonapi_key: tonapiKey,
|
|
@@ -1130,44 +1206,52 @@ Get it at: ${providerMeta.consoleUrl}`,
|
|
|
1130
1206
|
writeFileSync(workspace.configPath, configYaml, { encoding: "utf-8", mode: 384 });
|
|
1131
1207
|
spinner.succeed(DIM(`Configuration saved: ${workspace.configPath}`));
|
|
1132
1208
|
let telegramConnected = false;
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
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
|
+
`
|
|
1141
1224
|
${DIM("Connecting to Telegram... Check your phone for the verification code.")}`
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
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)}
|
|
1157
1240
|
`);
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1241
|
+
STEPS[6].value = `Connected${me?.username ? ` (@${me.username})` : ""}`;
|
|
1242
|
+
} catch (error) {
|
|
1243
|
+
prompter.warn(
|
|
1244
|
+
`Telegram connection failed: ${getErrorMessage(error)}
|
|
1162
1245
|
You can authenticate later when running: teleton start`
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1246
|
+
);
|
|
1247
|
+
STEPS[6].value = "Auth on first start";
|
|
1248
|
+
}
|
|
1249
|
+
} else {
|
|
1250
|
+
console.log(`
|
|
1168
1251
|
${DIM("You can authenticate later when running: teleton start")}
|
|
1169
1252
|
`);
|
|
1170
|
-
|
|
1253
|
+
STEPS[6].value = "Auth on first start";
|
|
1254
|
+
}
|
|
1171
1255
|
}
|
|
1172
1256
|
console.clear();
|
|
1173
1257
|
console.log();
|
|
@@ -1183,10 +1267,26 @@ You can authenticate later when running: teleton start`
|
|
|
1183
1267
|
}
|
|
1184
1268
|
async function runNonInteractiveOnboarding(options, prompter) {
|
|
1185
1269
|
const selectedProvider = options.provider || "anthropic";
|
|
1270
|
+
const nonInteractiveMode = options.mode || "user";
|
|
1186
1271
|
const needsApiKey = selectedProvider !== "cocoon" && selectedProvider !== "local";
|
|
1187
|
-
if (
|
|
1188
|
-
|
|
1189
|
-
|
|
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
|
+
}
|
|
1190
1290
|
}
|
|
1191
1291
|
if (needsApiKey && !options.apiKey) {
|
|
1192
1292
|
prompter.error(`Non-interactive mode requires --api-key for provider "${selectedProvider}"`);
|
|
@@ -1216,6 +1316,7 @@ async function runNonInteractiveOnboarding(options, prompter) {
|
|
|
1216
1316
|
temperature: 0.7,
|
|
1217
1317
|
system_prompt: null,
|
|
1218
1318
|
max_agentic_iterations: 5,
|
|
1319
|
+
toolset: "full",
|
|
1219
1320
|
session_reset_policy: {
|
|
1220
1321
|
daily_reset_enabled: true,
|
|
1221
1322
|
daily_reset_hour: 4,
|
|
@@ -1224,9 +1325,10 @@ async function runNonInteractiveOnboarding(options, prompter) {
|
|
|
1224
1325
|
}
|
|
1225
1326
|
},
|
|
1226
1327
|
telegram: {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
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 ?? "" : "",
|
|
1230
1332
|
session_name: "teleton_session",
|
|
1231
1333
|
session_path: workspace.sessionPath,
|
|
1232
1334
|
dm_policy: "admin-only",
|
|
@@ -1238,12 +1340,13 @@ async function runNonInteractiveOnboarding(options, prompter) {
|
|
|
1238
1340
|
typing_simulation: true,
|
|
1239
1341
|
rate_limit_messages_per_second: 1,
|
|
1240
1342
|
rate_limit_groups_per_minute: 20,
|
|
1241
|
-
admin_ids: [options.userId],
|
|
1242
|
-
owner_id: options.userId,
|
|
1343
|
+
admin_ids: [options.userId ?? 0],
|
|
1344
|
+
owner_id: options.userId ?? 0,
|
|
1243
1345
|
agent_channel: null,
|
|
1244
1346
|
debounce_ms: 1500,
|
|
1245
|
-
bot_token: void 0,
|
|
1246
|
-
bot_username: void 0
|
|
1347
|
+
bot_token: nonInteractiveMode === "bot" ? options.botToken : void 0,
|
|
1348
|
+
bot_username: void 0,
|
|
1349
|
+
stream_mode: "all"
|
|
1247
1350
|
},
|
|
1248
1351
|
storage: {
|
|
1249
1352
|
sessions_file: `${workspace.root}/sessions.json`,
|
|
@@ -1285,6 +1388,12 @@ async function runNonInteractiveOnboarding(options, prompter) {
|
|
|
1285
1388
|
}
|
|
1286
1389
|
},
|
|
1287
1390
|
ton_proxy: { enabled: false, port: 8080 },
|
|
1391
|
+
heartbeat: {
|
|
1392
|
+
enabled: true,
|
|
1393
|
+
interval_ms: 36e5,
|
|
1394
|
+
prompt: "Execute your HEARTBEAT.md checklist now. Work through each item using tool calls.",
|
|
1395
|
+
self_configurable: false
|
|
1396
|
+
},
|
|
1288
1397
|
mcp: { servers: {} },
|
|
1289
1398
|
plugins: {},
|
|
1290
1399
|
tavily_api_key: options.tavilyApiKey
|
|
@@ -1332,11 +1441,11 @@ async function checkConfig(workspaceDir) {
|
|
|
1332
1441
|
status: "ok",
|
|
1333
1442
|
message: "Valid"
|
|
1334
1443
|
};
|
|
1335
|
-
} catch (
|
|
1444
|
+
} catch (error) {
|
|
1336
1445
|
return {
|
|
1337
1446
|
name: "Config file",
|
|
1338
1447
|
status: "error",
|
|
1339
|
-
message: `Parse error: ${
|
|
1448
|
+
message: `Parse error: ${getErrorMessage(error)}`
|
|
1340
1449
|
};
|
|
1341
1450
|
}
|
|
1342
1451
|
}
|
|
@@ -1815,12 +1924,12 @@ async function actionSet(key, value, configPath) {
|
|
|
1815
1924
|
}
|
|
1816
1925
|
});
|
|
1817
1926
|
}
|
|
1818
|
-
} catch (
|
|
1819
|
-
if (
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
if (error instanceof CancelledError) {
|
|
1820
1929
|
console.log("Cancelled.");
|
|
1821
1930
|
return;
|
|
1822
1931
|
}
|
|
1823
|
-
throw
|
|
1932
|
+
throw error;
|
|
1824
1933
|
}
|
|
1825
1934
|
}
|
|
1826
1935
|
const err = meta.validate(value);
|
|
@@ -1961,7 +2070,7 @@ program.command("start").description("Start the Teleton agent").option("-c, --co
|
|
|
1961
2070
|
if (options.jsonCredentials) {
|
|
1962
2071
|
process.env.TELETON_JSON_CREDENTIALS = "true";
|
|
1963
2072
|
}
|
|
1964
|
-
const { startApiOnly } = await import("../bootstrap-
|
|
2073
|
+
const { startApiOnly } = await import("../bootstrap-PFBH6ALD.js");
|
|
1965
2074
|
await startApiOnly({ config: options.config, apiPort: options.apiPort });
|
|
1966
2075
|
return;
|
|
1967
2076
|
}
|
|
@@ -2004,7 +2113,11 @@ program.command("doctor").description("Run system health checks").action(async (
|
|
|
2004
2113
|
var mcp = program.command("mcp").description("Manage MCP (Model Context Protocol) servers");
|
|
2005
2114
|
mcp.command("add <package> [args...]").description(
|
|
2006
2115
|
"Add an MCP server (e.g. teleton mcp add @modelcontextprotocol/server-filesystem /tmp)"
|
|
2007
|
-
).option("-n, --name <name>", "Server name (auto-derived from package if omitted)").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(
|
|
2008
2121
|
"-e, --env <KEY=VALUE...>",
|
|
2009
2122
|
"Environment variables (repeatable)",
|
|
2010
2123
|
(v, prev) => [...prev, v],
|
|
@@ -7,15 +7,16 @@ import {
|
|
|
7
7
|
isOAuthToken,
|
|
8
8
|
loadContextFromTranscript,
|
|
9
9
|
registerCocoonModels,
|
|
10
|
-
registerLocalModels
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-4MG2AROG.js";
|
|
18
|
+
import "./chunk-L653KKCR.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
|
};
|