telegram-agent-kit 0.1.0

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.
@@ -0,0 +1,81 @@
1
+ type ChatKey = {
2
+ chatId: number;
3
+ agentId: string;
4
+ };
5
+ type Logger = {
6
+ warn(msg: string, data?: unknown): void;
7
+ error(msg: string, data?: unknown): void;
8
+ info?(msg: string, data?: unknown): void;
9
+ };
10
+ /** Raw Bot API transport primitives — one HTTP call each, NO chunking /
11
+ * rendering / fallback (the kit owns those). Each throws TelegramApiError
12
+ * (see ../errors.ts) on a Bot API error. */
13
+ type BotClient = {
14
+ sendMessage(p: {
15
+ chatId: number;
16
+ text: string;
17
+ parseMode?: 'HTML';
18
+ }, signal?: AbortSignal): Promise<void>;
19
+ sendRichMessage(p: {
20
+ chatId: number;
21
+ markdown: string;
22
+ }, signal?: AbortSignal): Promise<void>;
23
+ sendPhoto(p: {
24
+ chatId: number;
25
+ url: string;
26
+ caption?: string;
27
+ parseMode?: 'HTML';
28
+ }, signal?: AbortSignal): Promise<void>;
29
+ sendChatAction(p: {
30
+ chatId: number;
31
+ action?: string;
32
+ }, signal?: AbortSignal): Promise<void>;
33
+ sendMessageDraft(p: {
34
+ chatId: number;
35
+ draftId: number;
36
+ text: string;
37
+ }, signal?: AbortSignal): Promise<void>;
38
+ sendRichMessageDraft(p: {
39
+ chatId: number;
40
+ draftId: number;
41
+ markdown: string;
42
+ }, signal?: AbortSignal): Promise<void>;
43
+ };
44
+ type RenderEvent = {
45
+ type: 'token';
46
+ text: string;
47
+ } | {
48
+ type: 'tool_start';
49
+ id: string;
50
+ name: string;
51
+ args: unknown;
52
+ } | {
53
+ type: 'tool_end';
54
+ id: string;
55
+ durationMs: number;
56
+ error?: string;
57
+ } | {
58
+ type: 'error';
59
+ message: string;
60
+ };
61
+ type StreamInput = {
62
+ messages: {
63
+ role: 'user';
64
+ content: string;
65
+ }[];
66
+ };
67
+ type AgentStreamContext = {
68
+ threadId: string;
69
+ signal?: AbortSignal;
70
+ };
71
+ type AgentStream = (input: StreamInput, context: AgentStreamContext) => AsyncIterable<RenderEvent>;
72
+ type Checkpointer = {
73
+ snapshot(threadId: string): Promise<string | null>;
74
+ rollback(threadId: string, checkpointId: string | null): Promise<void>;
75
+ };
76
+ type ThreadStore = {
77
+ resolve(key: ChatKey, now: number): Promise<string>;
78
+ touch(key: ChatKey, now: number): Promise<void>;
79
+ };
80
+
81
+ export type { AgentStream as A, BotClient as B, ChatKey as C, Logger as L, RenderEvent as R, StreamInput as S, ThreadStore as T, Checkpointer as a, AgentStreamContext as b };
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "telegram-agent-kit",
3
+ "version": "0.1.0",
4
+ "description": "Render markdown to Telegram, stream agent replies into live drafts, and drive a snapshot/rollback turn-loop — runtime-agnostic.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Ivan Kalinichenko",
8
+ "homepage": "https://github.com/kalinichenko88/telegram-agent-kit#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/kalinichenko88/telegram-agent-kit.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/kalinichenko88/telegram-agent-kit/issues"
15
+ },
16
+ "keywords": [
17
+ "telegram",
18
+ "telegram-bot",
19
+ "bot-api",
20
+ "llm",
21
+ "agent",
22
+ "agents",
23
+ "streaming",
24
+ "markdown",
25
+ "html",
26
+ "langgraph",
27
+ "deepagents",
28
+ "esm"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./deepagents": {
42
+ "types": "./dist/deepagents/index.d.ts",
43
+ "import": "./dist/deepagents/index.js"
44
+ }
45
+ },
46
+ "scripts": {
47
+ "build": "tsup",
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "vitest run",
50
+ "lint": "biome check .",
51
+ "format": "biome format --write ."
52
+ },
53
+ "peerDependencies": {
54
+ "@langchain/core": ">=1",
55
+ "deepagents": ">=1"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "@langchain/core": {
59
+ "optional": true
60
+ },
61
+ "deepagents": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@biomejs/biome": "^2.4.0",
67
+ "@langchain/core": "^1.2.0",
68
+ "@types/node": "^22.0.0",
69
+ "deepagents": "^1.10.5",
70
+ "tsup": "^8.3.0",
71
+ "typescript": "^5.6.0",
72
+ "vitest": "^2.1.0"
73
+ }
74
+ }