teleton 0.7.3 → 0.7.4

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 CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  - **Full Telegram access** - Operates as a real user via MTProto (GramJS), not a limited bot
23
23
  - **Agentic loop** - Up to 5 iterations of tool calling per message, the agent thinks, acts, observes, and repeats
24
- - **Multi-Provider LLM** - Anthropic, OpenAI, Google Gemini, xAI Grok, Groq, OpenRouter, Moonshot, Mistral, Cocoon, Local
24
+ - **Multi-Provider LLM** - Anthropic, Claude Code, OpenAI, Google Gemini, xAI Grok, Groq, OpenRouter, Moonshot, Mistral, Cocoon, Local (11 providers)
25
25
  - **TON Blockchain** - Built-in W5R1 wallet, send/receive TON & jettons, swap on STON.fi and DeDust, NFTs, DNS domains
26
26
  - **Persistent memory** - Hybrid RAG (sqlite-vec + FTS5), auto-compaction with AI summarization, daily logs
27
27
  - **100+ built-in tools** - Messaging, media, blockchain, DEX trading, deals, DNS, journaling, and more
@@ -37,7 +37,7 @@
37
37
 
38
38
  | Category | Tools | Description |
39
39
  | ------------- | ----- | ------------------------------------------------------------------------------------------------------------------ |
40
- | Telegram | 66 | Messaging, media, chats, groups, polls, stickers, gifts, stars, stories, contacts, folders, profile, memory, tasks |
40
+ | Telegram | 73 | Messaging, media, chats, groups, polls, stickers, gifts, stars, stories, contacts, folders, profile, memory, tasks, voice transcription, scheduled messages |
41
41
  | TON & Jettons | 15 | W5R1 wallet, send/receive TON & jettons, balances, prices, holders, history, charts, NFTs, smart DEX router |
42
42
  | STON.fi DEX | 5 | Swap, quote, search, trending tokens, liquidity pools |
43
43
  | DeDust DEX | 5 | Swap, quote, pools, prices, token analytics (holders, top traders, buy/sell tax) |
@@ -51,7 +51,7 @@
51
51
 
52
52
  | Capability | Description |
53
53
  | ----------------------- | --------------------------------------------------------------------------------------------------------------------------- |
54
- | **Multi-Provider LLM** | Switch between Anthropic, OpenAI, Google, xAI, Groq, OpenRouter, Moonshot, Mistral, Cocoon, or Local with one config change |
54
+ | **Multi-Provider LLM** | Switch between Anthropic, Claude Code, OpenAI, Google, xAI, Groq, OpenRouter, Moonshot, Mistral, Cocoon, or Local Dashboard validates API key before switching |
55
55
  | **RAG + Hybrid Search** | Local ONNX embeddings (384d) or Voyage AI (512d/1024d) with FTS5 keyword + sqlite-vec cosine similarity, fused via RRF |
56
56
  | **Auto-Compaction** | AI-summarized context management prevents overflow, preserves key information in `memory/*.md` files |
57
57
  | **Observation Masking** | Compresses old tool results to one-line summaries, saving ~90% context window |
@@ -71,7 +71,7 @@
71
71
  ## Prerequisites
72
72
 
73
73
  - **Node.js 20.0.0+** - [Download](https://nodejs.org/)
74
- - **LLM API Key** - One of: [Anthropic](https://console.anthropic.com/) (recommended), [OpenAI](https://platform.openai.com/), [Google](https://aistudio.google.com/), [xAI](https://console.x.ai/), [Groq](https://console.groq.com/), [OpenRouter](https://openrouter.ai/)
74
+ - **LLM API Key** - One of: [Anthropic](https://console.anthropic.com/) (recommended), [OpenAI](https://platform.openai.com/), [Google](https://aistudio.google.com/), [xAI](https://console.x.ai/), [Groq](https://console.groq.com/), [OpenRouter](https://openrouter.ai/), [Moonshot](https://platform.moonshot.ai/), [Mistral](https://console.mistral.ai/) — or keyless: Claude Code (auto-detect), Cocoon (TON), Local (Ollama/vLLM)
75
75
  - **Telegram Account** - Dedicated account recommended for security
76
76
  - **Telegram API Credentials** - From [my.telegram.org/apps](https://my.telegram.org/apps)
77
77
  - **Your Telegram User ID** - Message [@userinfobot](https://t.me/userinfobot)
@@ -109,7 +109,7 @@ teleton setup
109
109
  ```
110
110
 
111
111
  The wizard will configure:
112
- - LLM provider selection (Anthropic, OpenAI, Google, xAI, Groq, OpenRouter)
112
+ - LLM provider selection (11 providers: Anthropic, Claude Code, OpenAI, Google, xAI, Groq, OpenRouter, Moonshot, Mistral, Cocoon, Local)
113
113
  - Telegram authentication (API credentials, phone, login code)
114
114
  - Access policies (DM/group response rules)
115
115
  - Admin user ID
@@ -152,10 +152,10 @@ The `teleton setup` wizard generates a fully configured `~/.teleton/config.yaml`
152
152
 
153
153
  ```yaml
154
154
  agent:
155
- provider: "anthropic" # anthropic | openai | google | xai | groq | openrouter
155
+ provider: "anthropic" # anthropic | claude-code | openai | google | xai | groq | openrouter | moonshot | mistral | cocoon | local
156
156
  api_key: "sk-ant-api03-..."
157
- model: "claude-opus-4-5-20251101"
158
- utility_model: "claude-3-5-haiku-20241022" # for summarization, compaction, vision
157
+ model: "claude-opus-4-6"
158
+ utility_model: "claude-haiku-4-5-20251001" # for summarization, compaction, vision
159
159
  max_agentic_iterations: 5
160
160
 
161
161
  telegram:
@@ -183,6 +183,24 @@ webui: # Optional: Web dashboard
183
183
  # auth_token: "..." # Auto-generated if omitted
184
184
  ```
185
185
 
186
+ ### Supported Models
187
+
188
+ All models are defined in `src/config/model-catalog.ts` and shared across the CLI setup, WebUI setup wizard, and Dashboard. To add a model, add it there — it will appear everywhere automatically.
189
+
190
+ | Provider | Models |
191
+ |----------|--------|
192
+ | **Anthropic** | Claude Opus 4.6, Claude Opus 4.5, Claude Sonnet 4.6, Claude Haiku 4.5 |
193
+ | **Claude Code** | Same as Anthropic (auto-detected credentials) |
194
+ | **OpenAI** | GPT-5, GPT-5 Pro, GPT-5 Mini, GPT-5.1, GPT-4o, GPT-4.1, GPT-4.1 Mini, o4 Mini, o3, Codex Mini |
195
+ | **Google** | Gemini 3 Pro (preview), Gemini 3 Flash (preview), Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash Lite, Gemini 2.0 Flash |
196
+ | **xAI** | Grok 4.1 Fast, Grok 4 Fast, Grok 4, Grok Code, Grok 3 |
197
+ | **Groq** | Llama 4 Maverick, Qwen3 32B, DeepSeek R1 70B, Llama 3.3 70B |
198
+ | **OpenRouter** | Claude Opus/Sonnet, GPT-5, Gemini, DeepSeek R1/V3, Qwen3 Coder/Max/235B, Nemotron, Sonar Pro, MiniMax, Grok 4 |
199
+ | **Moonshot** | Kimi K2.5, Kimi K2 Thinking |
200
+ | **Mistral** | Devstral Small/Medium, Mistral Large, Magistral Small |
201
+ | **Cocoon** | Qwen/Qwen3-32B (decentralized, pays in TON) |
202
+ | **Local** | Auto-detected (Ollama, vLLM, LM Studio) |
203
+
186
204
  ### MCP Servers
187
205
 
188
206
  Connect external tool servers via the [Model Context Protocol](https://modelcontextprotocol.io/). No code needed - tools are auto-discovered and registered at startup.
@@ -283,7 +301,7 @@ Teleton includes an **optional web dashboard** for monitoring and configuration.
283
301
 
284
302
  ### Features
285
303
 
286
- - **Dashboard**: System status, uptime, model info, session count, memory stats
304
+ - **Dashboard**: System status, uptime, model info, session count, memory stats, provider switching with API key validation
287
305
  - **Tools Management**: View all tools grouped by module, toggle enable/disable, change scope per tool
288
306
  - **Plugin Marketplace**: Install, update, and manage plugins from registry with secrets management
289
307
  - **Soul Editor**: Edit SOUL.md, SECURITY.md, STRATEGY.md, MEMORY.md with unsaved changes warning
@@ -386,7 +404,7 @@ All admin commands support `/`, `!`, or `.` prefix:
386
404
 
387
405
  | Layer | Technology |
388
406
  |-------|------------|
389
- | LLM | Multi-provider via [pi-ai](https://github.com/mariozechner/pi-ai) (Anthropic, OpenAI, Google, xAI, Groq, OpenRouter) |
407
+ | LLM | Multi-provider via [pi-ai](https://github.com/mariozechner/pi-ai) (11 providers: Anthropic, Claude Code, OpenAI, Google, xAI, Groq, OpenRouter, Moonshot, Mistral, Cocoon, Local) |
390
408
  | Telegram Userbot | [GramJS](https://gram.js.org/) (MTProto) |
391
409
  | Inline Bot | [Grammy](https://grammy.dev/) (Bot API, for deals) |
392
410
  | Blockchain | [TON SDK](https://github.com/ton-org/ton) (W5R1 wallet) |
@@ -414,7 +432,7 @@ src/
414
432
  │ ├── module-loader.ts # Built-in module loading (deals → +5 tools)
415
433
  │ ├── plugin-loader.ts # External plugin discovery, validation, hot-reload
416
434
  │ ├── mcp-loader.ts # MCP client (stdio/SSE), tool discovery, lifecycle
417
- │ ├── telegram/ # Telegram operations (66 tools)
435
+ │ ├── telegram/ # Telegram operations (73 tools)
418
436
  │ ├── ton/ # TON blockchain + jettons + DEX router (15 tools)
419
437
  │ ├── stonfi/ # STON.fi DEX (5 tools)
420
438
  │ ├── dedust/ # DeDust DEX (5 tools)
@@ -463,7 +481,8 @@ src/
463
481
  │ └── loader.ts # 10 sections: soul + security + strategy + memory + context + ...
464
482
  ├── config/ # Configuration
465
483
  │ ├── schema.ts # Zod schemas + validation
466
- └── providers.ts # Multi-provider LLM registry (10 providers)
484
+ ├── providers.ts # Multi-provider LLM registry (11 providers)
485
+ │ └── model-catalog.ts # Shared model catalog (60+ models across all providers)
467
486
  ├── webui/ # Optional web dashboard
468
487
  │ ├── server.ts # Hono server, auth middleware, static serving
469
488
  │ └── routes/ # 11 API route groups (status, tools, logs, memory, soul, plugins, mcp, tasks, workspace, config, marketplace)
@@ -217,7 +217,7 @@ async function getTonPrice() {
217
217
 
218
218
  // src/config/schema.ts
219
219
  import { z } from "zod";
220
- var DMPolicy = z.enum(["pairing", "allowlist", "open", "disabled"]);
220
+ var DMPolicy = z.enum(["allowlist", "open", "disabled"]);
221
221
  var GroupPolicy = z.enum(["open", "allowlist", "disabled"]);
222
222
  var SessionResetPolicySchema = z.object({
223
223
  daily_reset_enabled: z.boolean().default(true).describe("Enable daily session reset"),
@@ -255,7 +255,7 @@ var TelegramConfigSchema = z.object({
255
255
  phone: z.string(),
256
256
  session_name: z.string().default("teleton_session"),
257
257
  session_path: z.string().default("~/.teleton"),
258
- dm_policy: DMPolicy.default("pairing"),
258
+ dm_policy: DMPolicy.default("allowlist"),
259
259
  allow_from: z.array(z.number()).default([]),
260
260
  group_policy: GroupPolicy.default("open"),
261
261
  group_allow_from: z.array(z.number()).default([]),
@@ -275,7 +275,6 @@ var TelegramConfigSchema = z.object({
275
275
  });
276
276
  var StorageConfigSchema = z.object({
277
277
  sessions_file: z.string().default("~/.teleton/sessions.json"),
278
- pairing_file: z.string().default("~/.teleton/pairing.json"),
279
278
  memory_file: z.string().default("~/.teleton/memory.json"),
280
279
  history_limit: z.number().default(100)
281
280
  });
@@ -288,7 +287,7 @@ var MetaConfigSchema = z.object({
288
287
  var _DealsObject = z.object({
289
288
  enabled: z.boolean().default(true),
290
289
  expiry_seconds: z.number().default(120),
291
- buy_max_floor_percent: z.number().default(100),
290
+ buy_max_floor_percent: z.number().default(95),
292
291
  sell_min_floor_percent: z.number().default(105),
293
292
  poll_interval_ms: z.number().default(5e3),
294
293
  max_verification_retries: z.number().default(12),
@@ -382,13 +381,14 @@ function findPackageRoot() {
382
381
  }
383
382
  var TEMPLATES_DIR = join2(findPackageRoot(), "src", "templates");
384
383
  async function ensureWorkspace(config) {
384
+ const silent = config?.silent ?? false;
385
385
  if (!existsSync2(TELETON_ROOT)) {
386
386
  mkdirSync2(TELETON_ROOT, { recursive: true });
387
- log2.info(`Created Teleton root at ${TELETON_ROOT}`);
387
+ if (!silent) log2.info(`Created Teleton root at ${TELETON_ROOT}`);
388
388
  }
389
389
  if (!existsSync2(WORKSPACE_ROOT)) {
390
390
  mkdirSync2(WORKSPACE_ROOT, { recursive: true });
391
- log2.info(`Created workspace at ${WORKSPACE_ROOT}`);
391
+ if (!silent) log2.info(`Created workspace at ${WORKSPACE_ROOT}`);
392
392
  }
393
393
  const directories = [
394
394
  WORKSPACE_PATHS.MEMORY_DIR,
@@ -424,11 +424,11 @@ async function ensureWorkspace(config) {
424
424
  walletPath: join2(TELETON_ROOT, "wallet.json")
425
425
  };
426
426
  if (config?.ensureTemplates) {
427
- await bootstrapTemplates(workspace);
427
+ await bootstrapTemplates(workspace, silent);
428
428
  }
429
429
  return workspace;
430
430
  }
431
- async function bootstrapTemplates(workspace) {
431
+ async function bootstrapTemplates(workspace, silent = false) {
432
432
  const templates = [
433
433
  { name: "SOUL.md", path: workspace.soulPath },
434
434
  { name: "MEMORY.md", path: workspace.memoryPath },
@@ -442,7 +442,7 @@ async function bootstrapTemplates(workspace) {
442
442
  const templateSource = join2(TEMPLATES_DIR, template.name);
443
443
  if (existsSync2(templateSource)) {
444
444
  copyFileSync(templateSource, template.path);
445
- log2.info(`Created ${template.name}`);
445
+ if (!silent) log2.info(`Created ${template.name}`);
446
446
  }
447
447
  }
448
448
  }
@@ -91,14 +91,22 @@ var AnthropicEmbeddingProvider = class {
91
91
  // src/memory/embeddings/local.ts
92
92
  import { pipeline, env } from "@huggingface/transformers";
93
93
  import { join } from "path";
94
+ import { mkdirSync } from "fs";
94
95
  var log = createLogger("Memory");
95
- env.cacheDir = join(TELETON_ROOT, "models");
96
+ var modelCacheDir = join(TELETON_ROOT, "models");
97
+ try {
98
+ mkdirSync(modelCacheDir, { recursive: true });
99
+ } catch {
100
+ }
101
+ env.cacheDir = modelCacheDir;
96
102
  var extractorPromise = null;
97
103
  function getExtractor(model) {
98
104
  if (!extractorPromise) {
99
- log.info(`Loading local embedding model: ${model} (cache: ${env.cacheDir})`);
105
+ log.info(`Loading local embedding model: ${model} (cache: ${modelCacheDir})`);
100
106
  extractorPromise = pipeline("feature-extraction", model, {
101
- dtype: "fp32"
107
+ dtype: "fp32",
108
+ // Explicit cache_dir to avoid any env race condition
109
+ cache_dir: modelCacheDir
102
110
  }).then((ext) => {
103
111
  log.info(`Local embedding model ready`);
104
112
  return ext;
@@ -121,21 +129,29 @@ var LocalEmbeddingProvider = class {
121
129
  }
122
130
  /**
123
131
  * Pre-download and load the model at startup.
124
- * If loading fails, marks this provider as disabled (returns empty embeddings).
132
+ * If loading fails, retries once then marks provider as disabled (FTS5-only).
125
133
  * Call this once during app init — avoids retry spam on every message.
126
134
  * @returns true if model loaded successfully, false if fallback to noop
127
135
  */
128
136
  async warmup() {
129
- try {
130
- await getExtractor(this.model);
131
- return true;
132
- } catch (err) {
133
- log.warn(
134
- `Local embedding model unavailable \u2014 falling back to FTS5-only search (no vector embeddings)`
135
- );
136
- this._disabled = true;
137
- return false;
137
+ for (let attempt = 1; attempt <= 2; attempt++) {
138
+ try {
139
+ await getExtractor(this.model);
140
+ return true;
141
+ } catch (err) {
142
+ if (attempt === 1) {
143
+ log.warn(`Embedding model load failed (attempt 1), retrying...`);
144
+ await new Promise((r) => setTimeout(r, 1e3));
145
+ } else {
146
+ log.warn(
147
+ `Local embedding model unavailable \u2014 falling back to FTS5-only search (no vector embeddings)`
148
+ );
149
+ this._disabled = true;
150
+ return false;
151
+ }
152
+ }
138
153
  }
154
+ return false;
139
155
  }
140
156
  async embedQuery(text) {
141
157
  if (this._disabled) return [];