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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V3S3NXBQ.js";
|
|
4
4
|
|
|
5
5
|
// src/providers/claude-code-credentials.ts
|
|
6
6
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
@@ -26,8 +26,8 @@ function readCredentialsFile() {
|
|
|
26
26
|
try {
|
|
27
27
|
const raw = readFileSync(filePath, "utf-8");
|
|
28
28
|
return JSON.parse(raw);
|
|
29
|
-
} catch (
|
|
30
|
-
log.warn({ err:
|
|
29
|
+
} catch (error) {
|
|
30
|
+
log.warn({ err: error, path: filePath }, "Failed to parse Claude Code credentials file");
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -122,16 +122,16 @@ async function performOAuthRefresh(refreshToken) {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
writeFileSync(filePath, JSON.stringify(updated, null, 2), { mode: 384 });
|
|
125
|
-
} catch (
|
|
126
|
-
log.warn({ err:
|
|
125
|
+
} catch (innerError) {
|
|
126
|
+
log.warn({ err: innerError }, "Failed to persist refreshed OAuth credentials to disk");
|
|
127
127
|
}
|
|
128
128
|
cachedToken = data.access_token;
|
|
129
129
|
cachedExpiresAt = newExpiresAt;
|
|
130
130
|
cachedRefreshToken = newRefreshToken;
|
|
131
131
|
log.info("Claude Code OAuth token refreshed successfully");
|
|
132
132
|
return cachedToken;
|
|
133
|
-
} catch (
|
|
134
|
-
log.warn({ err:
|
|
133
|
+
} catch (error) {
|
|
134
|
+
log.warn({ err: error }, "OAuth token refresh request failed");
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
// src/config/providers.ts
|
|
2
2
|
var PROVIDER_REGISTRY = {
|
|
3
|
-
|
|
4
|
-
id: "
|
|
5
|
-
displayName: "
|
|
3
|
+
"claude-code": {
|
|
4
|
+
id: "claude-code",
|
|
5
|
+
displayName: "Claude Code (Auto)",
|
|
6
6
|
envVar: "ANTHROPIC_API_KEY",
|
|
7
7
|
keyPrefix: "sk-ant-",
|
|
8
|
-
keyHint: "
|
|
8
|
+
keyHint: "Auto-detected from Claude Code",
|
|
9
9
|
consoleUrl: "https://console.anthropic.com/",
|
|
10
10
|
defaultModel: "claude-opus-4-6",
|
|
11
11
|
utilityModel: "claude-haiku-4-5-20251001",
|
|
12
12
|
toolLimit: null,
|
|
13
13
|
piAiProvider: "anthropic"
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
id: "
|
|
17
|
-
displayName: "
|
|
15
|
+
zai: {
|
|
16
|
+
id: "zai",
|
|
17
|
+
displayName: "ZAI (Zhipu)",
|
|
18
|
+
envVar: "ZAI_API_KEY",
|
|
19
|
+
keyPrefix: null,
|
|
20
|
+
keyHint: "...",
|
|
21
|
+
consoleUrl: "https://z.ai/manage-apikey/apikey-list",
|
|
22
|
+
defaultModel: "glm-4.7-flash",
|
|
23
|
+
utilityModel: "glm-4.5-flash",
|
|
24
|
+
toolLimit: 128,
|
|
25
|
+
piAiProvider: "zai"
|
|
26
|
+
},
|
|
27
|
+
anthropic: {
|
|
28
|
+
id: "anthropic",
|
|
29
|
+
displayName: "Anthropic (Claude)",
|
|
18
30
|
envVar: "ANTHROPIC_API_KEY",
|
|
19
31
|
keyPrefix: "sk-ant-",
|
|
20
|
-
keyHint: "
|
|
32
|
+
keyHint: "sk-ant-api03-...",
|
|
21
33
|
consoleUrl: "https://console.anthropic.com/",
|
|
22
34
|
defaultModel: "claude-opus-4-6",
|
|
23
35
|
utilityModel: "claude-haiku-4-5-20251001",
|
|
@@ -120,18 +132,6 @@ var PROVIDER_REGISTRY = {
|
|
|
120
132
|
toolLimit: 128,
|
|
121
133
|
piAiProvider: "cerebras"
|
|
122
134
|
},
|
|
123
|
-
zai: {
|
|
124
|
-
id: "zai",
|
|
125
|
-
displayName: "ZAI (Zhipu)",
|
|
126
|
-
envVar: "ZAI_API_KEY",
|
|
127
|
-
keyPrefix: null,
|
|
128
|
-
keyHint: "...",
|
|
129
|
-
consoleUrl: "https://z.ai/manage-apikey/apikey-list",
|
|
130
|
-
defaultModel: "glm-4.7",
|
|
131
|
-
utilityModel: "glm-4.7-flash",
|
|
132
|
-
toolLimit: 128,
|
|
133
|
-
piAiProvider: "zai"
|
|
134
|
-
},
|
|
135
135
|
minimax: {
|
|
136
136
|
id: "minimax",
|
|
137
137
|
displayName: "MiniMax",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serializeEmbedding
|
|
3
|
+
} from "./chunk-Z5WY7BSB.js";
|
|
4
|
+
|
|
5
|
+
// src/memory/feed/messages.ts
|
|
6
|
+
function pruneOldMessages(db, maxAgeDays = 90) {
|
|
7
|
+
const cutoffSec = Math.floor(Date.now() / 1e3) - maxAgeDays * 86400;
|
|
8
|
+
const result = db.prepare("DELETE FROM tg_messages WHERE timestamp < ?").run(cutoffSec);
|
|
9
|
+
return result.changes;
|
|
10
|
+
}
|
|
11
|
+
var MessageStore = class {
|
|
12
|
+
constructor(db, embedder, vectorEnabled) {
|
|
13
|
+
this.db = db;
|
|
14
|
+
this.embedder = embedder;
|
|
15
|
+
this.vectorEnabled = vectorEnabled;
|
|
16
|
+
}
|
|
17
|
+
ensureChat(chatId, isGroup = false) {
|
|
18
|
+
const existing = this.db.prepare(`SELECT id FROM tg_chats WHERE id = ?`).get(chatId);
|
|
19
|
+
if (!existing) {
|
|
20
|
+
this.db.prepare(`INSERT INTO tg_chats (id, type, is_monitored) VALUES (?, ?, 1)`).run(chatId, isGroup ? "group" : "dm");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
ensureUser(userId) {
|
|
24
|
+
if (!userId) return;
|
|
25
|
+
const existing = this.db.prepare(`SELECT id FROM tg_users WHERE id = ?`).get(userId);
|
|
26
|
+
if (!existing) {
|
|
27
|
+
this.db.prepare(`INSERT INTO tg_users (id) VALUES (?)`).run(userId);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async storeMessage(message) {
|
|
31
|
+
this.ensureChat(message.chatId);
|
|
32
|
+
if (message.senderId) {
|
|
33
|
+
this.ensureUser(message.senderId);
|
|
34
|
+
}
|
|
35
|
+
const embedding = this.vectorEnabled && message.text ? await this.embedder.embedQuery(message.text) : [];
|
|
36
|
+
const embeddingBuffer = serializeEmbedding(embedding);
|
|
37
|
+
this.db.transaction(() => {
|
|
38
|
+
this.db.prepare(
|
|
39
|
+
`
|
|
40
|
+
INSERT OR REPLACE INTO tg_messages (
|
|
41
|
+
id, chat_id, sender_id, text, embedding, reply_to_id,
|
|
42
|
+
is_from_agent, has_media, media_type, timestamp
|
|
43
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
44
|
+
`
|
|
45
|
+
).run(
|
|
46
|
+
message.id,
|
|
47
|
+
message.chatId,
|
|
48
|
+
message.senderId,
|
|
49
|
+
message.text,
|
|
50
|
+
embeddingBuffer,
|
|
51
|
+
message.replyToId,
|
|
52
|
+
message.isFromAgent ? 1 : 0,
|
|
53
|
+
message.hasMedia ? 1 : 0,
|
|
54
|
+
message.mediaType,
|
|
55
|
+
message.timestamp
|
|
56
|
+
);
|
|
57
|
+
if (this.vectorEnabled && embedding.length > 0 && message.text) {
|
|
58
|
+
this.db.prepare(`DELETE FROM tg_messages_vec WHERE id = ?`).run(message.id);
|
|
59
|
+
this.db.prepare(`INSERT INTO tg_messages_vec (id, embedding) VALUES (?, ?)`).run(message.id, embeddingBuffer);
|
|
60
|
+
}
|
|
61
|
+
this.db.prepare(`UPDATE tg_chats SET last_message_at = ?, last_message_id = ? WHERE id = ?`).run(message.timestamp, message.id, message.chatId);
|
|
62
|
+
})();
|
|
63
|
+
}
|
|
64
|
+
pruneOldMessages(maxAgeDays = 90) {
|
|
65
|
+
const cutoffSec = Math.floor(Date.now() / 1e3) - maxAgeDays * 86400;
|
|
66
|
+
const result = this.db.prepare("DELETE FROM tg_messages WHERE timestamp < ?").run(cutoffSec);
|
|
67
|
+
return result.changes;
|
|
68
|
+
}
|
|
69
|
+
getRecentMessages(chatId, limit = 20) {
|
|
70
|
+
const rows = this.db.prepare(
|
|
71
|
+
`
|
|
72
|
+
SELECT id, chat_id, sender_id, text, reply_to_id, is_from_agent, has_media, media_type, timestamp
|
|
73
|
+
FROM tg_messages
|
|
74
|
+
WHERE chat_id = ?
|
|
75
|
+
ORDER BY timestamp DESC
|
|
76
|
+
LIMIT ?
|
|
77
|
+
`
|
|
78
|
+
).all(chatId, limit);
|
|
79
|
+
return rows.reverse().map((row) => ({
|
|
80
|
+
id: row.id,
|
|
81
|
+
chatId: row.chat_id,
|
|
82
|
+
senderId: row.sender_id,
|
|
83
|
+
text: row.text,
|
|
84
|
+
replyToId: row.reply_to_id ?? void 0,
|
|
85
|
+
isFromAgent: Boolean(row.is_from_agent),
|
|
86
|
+
hasMedia: Boolean(row.has_media),
|
|
87
|
+
mediaType: row.media_type ?? void 0,
|
|
88
|
+
timestamp: row.timestamp
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
pruneOldMessages,
|
|
95
|
+
MessageStore
|
|
96
|
+
};
|