@agentick/connector-telegram 0.5.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.
- package/README.md +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/telegram-format.d.ts +7 -0
- package/dist/telegram-format.d.ts.map +1 -0
- package/dist/telegram-format.js +14 -0
- package/dist/telegram-format.js.map +1 -0
- package/dist/telegram-platform.d.ts +37 -0
- package/dist/telegram-platform.d.ts.map +1 -0
- package/dist/telegram-platform.js +156 -0
- package/dist/telegram-platform.js.map +1 -0
- package/package.json +64 -0
- package/src/index.ts +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @agentick/connector-telegram
|
|
2
|
+
|
|
3
|
+
Telegram platform adapter for the Agentick connector system. Bridge a Telegram
|
|
4
|
+
bot to an agent session.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add @agentick/connector-telegram grammy
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`grammy` is a peer dependency.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { createConnector } from "@agentick/connector";
|
|
18
|
+
import { TelegramPlatform } from "@agentick/connector-telegram";
|
|
19
|
+
|
|
20
|
+
const connector = createConnector(
|
|
21
|
+
client,
|
|
22
|
+
new TelegramPlatform({
|
|
23
|
+
token: process.env.TELEGRAM_BOT_TOKEN!,
|
|
24
|
+
allowedUsers: [parseInt(process.env.TELEGRAM_USER_ID!)],
|
|
25
|
+
}),
|
|
26
|
+
{
|
|
27
|
+
sessionId: "main",
|
|
28
|
+
contentPolicy: "summarized",
|
|
29
|
+
deliveryStrategy: "debounced",
|
|
30
|
+
debounceMs: 2000,
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
await connector.start();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface TelegramConnectorOptions {
|
|
41
|
+
token: string;
|
|
42
|
+
allowedUsers?: number[];
|
|
43
|
+
chatId?: number;
|
|
44
|
+
confirmationStyle?: "inline-keyboard" | "text";
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**`token`** — Telegram bot token from [@BotFather](https://t.me/BotFather).
|
|
49
|
+
|
|
50
|
+
**`allowedUsers`** — Whitelist of Telegram user IDs. Empty array allows all
|
|
51
|
+
users. Get your ID from [@userinfobot](https://t.me/userinfobot).
|
|
52
|
+
|
|
53
|
+
**`chatId`** — Specific chat to use. If omitted, auto-detects from the first
|
|
54
|
+
incoming message.
|
|
55
|
+
|
|
56
|
+
**`confirmationStyle`** — How tool confirmations are presented. Default:
|
|
57
|
+
`"inline-keyboard"`.
|
|
58
|
+
|
|
59
|
+
## Tool Confirmations
|
|
60
|
+
|
|
61
|
+
### Inline Keyboard (default)
|
|
62
|
+
|
|
63
|
+
Sends a message with Approve/Deny buttons. The user taps a button, the
|
|
64
|
+
confirmation resolves.
|
|
65
|
+
|
|
66
|
+
### Text-based
|
|
67
|
+
|
|
68
|
+
Sends a text prompt. The next message from the user is parsed as the
|
|
69
|
+
confirmation response. Supports natural language — "yes but skip tests" is
|
|
70
|
+
approved with the full text as reason.
|
|
71
|
+
|
|
72
|
+
## Recommended Config
|
|
73
|
+
|
|
74
|
+
For a conversational bot experience:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
{
|
|
78
|
+
contentPolicy: "summarized", // collapse tool calls into brief summaries
|
|
79
|
+
deliveryStrategy: "debounced", // wait for a pause before sending
|
|
80
|
+
debounceMs: 2000,
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For a long-running agent that reports results:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
{
|
|
88
|
+
contentPolicy: "text-only", // only deliver text, no tool noise
|
|
89
|
+
deliveryStrategy: "on-idle", // deliver only when execution completes
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Exports
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
export { TelegramPlatform, type TelegramConnectorOptions } from "./telegram-platform.js";
|
|
97
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiC,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-format.d.ts","sourceRoot":"","sources":["../src/telegram-format.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Characters that must be escaped in Telegram MarkdownV2.
|
|
3
|
+
* @see https://core.telegram.org/bots/api#markdownv2-style
|
|
4
|
+
*/
|
|
5
|
+
const MARKDOWN_V2_SPECIAL = /[_*[\]()~`>#+\-=|{}.!]/g;
|
|
6
|
+
/**
|
|
7
|
+
* Escape text for Telegram MarkdownV2 parse mode.
|
|
8
|
+
*
|
|
9
|
+
* All special characters are prefixed with a backslash.
|
|
10
|
+
*/
|
|
11
|
+
export function escapeMarkdownV2(text) {
|
|
12
|
+
return text.replace(MARKDOWN_V2_SPECIAL, "\\$&");
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=telegram-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-format.js","sourceRoot":"","sources":["../src/telegram-format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ConnectorPlatform, ConnectorBridge, ConnectorStatus } from "@agentick/connector";
|
|
2
|
+
export interface TelegramConnectorOptions {
|
|
3
|
+
/** Telegram bot token. */
|
|
4
|
+
token: string;
|
|
5
|
+
/** Whitelist of allowed Telegram user IDs. Empty = allow all. */
|
|
6
|
+
allowedUsers?: number[];
|
|
7
|
+
/** Specific chat ID to use. If omitted, auto-detects from first message. */
|
|
8
|
+
chatId?: number;
|
|
9
|
+
/** How to present tool confirmations. Default: "inline-keyboard". */
|
|
10
|
+
confirmationStyle?: "inline-keyboard" | "text";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Telegram platform adapter for the Agentick connector system.
|
|
14
|
+
*
|
|
15
|
+
* Receives messages from a Telegram bot and delivers agent responses
|
|
16
|
+
* back as Telegram messages. Tool confirmations can use inline keyboards
|
|
17
|
+
* or text-based confirmation.
|
|
18
|
+
*/
|
|
19
|
+
export declare class TelegramPlatform implements ConnectorPlatform {
|
|
20
|
+
private readonly _bot;
|
|
21
|
+
private readonly _allowedUsers;
|
|
22
|
+
private readonly _confirmationStyle;
|
|
23
|
+
private _chatId;
|
|
24
|
+
private _bridge;
|
|
25
|
+
private _status;
|
|
26
|
+
/** Pending inline-keyboard confirmations keyed by toolUseId. */
|
|
27
|
+
private _pendingKeyboardConfirmations;
|
|
28
|
+
/** Pending text-based confirmation (only one at a time). */
|
|
29
|
+
private _pendingTextConfirmation;
|
|
30
|
+
constructor(options: TelegramConnectorOptions);
|
|
31
|
+
get status(): ConnectorStatus;
|
|
32
|
+
start(bridge: ConnectorBridge): Promise<void>;
|
|
33
|
+
stop(): Promise<void>;
|
|
34
|
+
private _handleDelivery;
|
|
35
|
+
private _handleConfirmation;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=telegram-platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-platform.d.ts","sourceRoot":"","sources":["../src/telegram-platform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAEf,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAW7B,MAAM,WAAW,wBAAwB;IACvC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;CAChD;AAED;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAM;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;IAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAChE,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,OAAO,CAAmC;IAElD,gEAAgE;IAChE,OAAO,CAAC,6BAA6B,CAGjC;IAEJ,4DAA4D;IAC5D,OAAO,CAAC,wBAAwB,CAEhB;gBAEJ,OAAO,EAAE,wBAAwB;IAO7C,IAAI,MAAM,IAAI,eAAe,CAE5B;IAEK,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAkG7C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAUb,eAAe;YAcf,mBAAmB;CA6BlC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Bot, InlineKeyboard } from "grammy";
|
|
2
|
+
import { extractText, splitMessage, parseTextConfirmation, formatConfirmationMessage, } from "@agentick/connector";
|
|
3
|
+
const TELEGRAM_MAX_LENGTH = 4096;
|
|
4
|
+
/**
|
|
5
|
+
* Telegram platform adapter for the Agentick connector system.
|
|
6
|
+
*
|
|
7
|
+
* Receives messages from a Telegram bot and delivers agent responses
|
|
8
|
+
* back as Telegram messages. Tool confirmations can use inline keyboards
|
|
9
|
+
* or text-based confirmation.
|
|
10
|
+
*/
|
|
11
|
+
export class TelegramPlatform {
|
|
12
|
+
_bot;
|
|
13
|
+
_allowedUsers;
|
|
14
|
+
_confirmationStyle;
|
|
15
|
+
_chatId;
|
|
16
|
+
_bridge = null;
|
|
17
|
+
_status = "disconnected";
|
|
18
|
+
/** Pending inline-keyboard confirmations keyed by toolUseId. */
|
|
19
|
+
_pendingKeyboardConfirmations = new Map();
|
|
20
|
+
/** Pending text-based confirmation (only one at a time). */
|
|
21
|
+
_pendingTextConfirmation = null;
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this._bot = new Bot(options.token);
|
|
24
|
+
this._allowedUsers = new Set(options.allowedUsers ?? []);
|
|
25
|
+
this._chatId = options.chatId ?? null;
|
|
26
|
+
this._confirmationStyle = options.confirmationStyle ?? "inline-keyboard";
|
|
27
|
+
}
|
|
28
|
+
get status() {
|
|
29
|
+
return this._status;
|
|
30
|
+
}
|
|
31
|
+
async start(bridge) {
|
|
32
|
+
this._bridge = bridge;
|
|
33
|
+
this._status = "connecting";
|
|
34
|
+
bridge.reportStatus("connecting");
|
|
35
|
+
// Handle text messages
|
|
36
|
+
this._bot.on("message:text", async (ctx) => {
|
|
37
|
+
const userId = ctx.from.id;
|
|
38
|
+
const chatId = ctx.chat.id;
|
|
39
|
+
if (this._allowedUsers.size > 0 && !this._allowedUsers.has(userId)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (this._chatId === null) {
|
|
43
|
+
this._chatId = chatId;
|
|
44
|
+
}
|
|
45
|
+
if (chatId !== this._chatId)
|
|
46
|
+
return;
|
|
47
|
+
const text = ctx.message.text;
|
|
48
|
+
// Text-based confirmation response
|
|
49
|
+
if (this._pendingTextConfirmation) {
|
|
50
|
+
const { respond } = this._pendingTextConfirmation;
|
|
51
|
+
this._pendingTextConfirmation = null;
|
|
52
|
+
respond(parseTextConfirmation(text));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
bridge.send(text);
|
|
56
|
+
});
|
|
57
|
+
// Single callback query handler — routes to pending confirmations by toolUseId
|
|
58
|
+
this._bot.on("callback_query:data", async (ctx) => {
|
|
59
|
+
const data = ctx.callbackQuery.data;
|
|
60
|
+
if (!data.startsWith("confirm:"))
|
|
61
|
+
return;
|
|
62
|
+
// Always answer the callback query to dismiss the loading spinner,
|
|
63
|
+
// even if the confirmation is already resolved (double-click race)
|
|
64
|
+
await ctx.answerCallbackQuery();
|
|
65
|
+
// Parse confirm:<toolUseId>:<action> — toolUseId may contain colons
|
|
66
|
+
const lastColon = data.lastIndexOf(":");
|
|
67
|
+
const toolUseId = data.slice(8, lastColon); // 8 = "confirm:".length
|
|
68
|
+
const action = data.slice(lastColon + 1);
|
|
69
|
+
const pending = this._pendingKeyboardConfirmations.get(toolUseId);
|
|
70
|
+
if (!pending)
|
|
71
|
+
return;
|
|
72
|
+
this._pendingKeyboardConfirmations.delete(toolUseId);
|
|
73
|
+
const confirmed = action === "approve";
|
|
74
|
+
pending.respond({ approved: confirmed });
|
|
75
|
+
try {
|
|
76
|
+
await ctx.editMessageText(`${pending.messageText}\n\n${confirmed ? "Approved" : "Denied"}`);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Message may have been deleted
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// Subscribe to delivery events
|
|
83
|
+
bridge.onDeliver((output) => {
|
|
84
|
+
return this._handleDelivery(output);
|
|
85
|
+
});
|
|
86
|
+
// Subscribe to confirmation requests
|
|
87
|
+
bridge.onConfirmation((request, respond) => {
|
|
88
|
+
this._handleConfirmation(request, respond).catch((err) => {
|
|
89
|
+
console.error("Telegram confirmation error:", err);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
// Typing indicator on execution start
|
|
93
|
+
bridge.onExecutionStart(() => {
|
|
94
|
+
if (this._chatId) {
|
|
95
|
+
this._bot.api.sendChatAction(this._chatId, "typing").catch(() => { });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
// Validate token before starting (fails fast on 401)
|
|
99
|
+
await this._bot.api.getMe();
|
|
100
|
+
// Start long polling (fire-and-forget — errors reported via status)
|
|
101
|
+
this._bot
|
|
102
|
+
.start({
|
|
103
|
+
onStart: () => {
|
|
104
|
+
this._status = "connected";
|
|
105
|
+
bridge.reportStatus("connected");
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
.catch((err) => {
|
|
109
|
+
this._status = "error";
|
|
110
|
+
bridge.reportStatus("error", err);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async stop() {
|
|
114
|
+
await this._bot.stop();
|
|
115
|
+
this._status = "disconnected";
|
|
116
|
+
this._bridge = null;
|
|
117
|
+
this._pendingTextConfirmation = null;
|
|
118
|
+
this._pendingKeyboardConfirmations.clear();
|
|
119
|
+
}
|
|
120
|
+
// --- Private ---
|
|
121
|
+
async _handleDelivery(output) {
|
|
122
|
+
if (!this._chatId)
|
|
123
|
+
return;
|
|
124
|
+
for (const message of output.messages) {
|
|
125
|
+
const text = extractText(message.content, "\n\n");
|
|
126
|
+
if (!text)
|
|
127
|
+
continue;
|
|
128
|
+
const chunks = splitMessage(text, { maxLength: TELEGRAM_MAX_LENGTH });
|
|
129
|
+
for (const chunk of chunks) {
|
|
130
|
+
await this._bot.api.sendMessage(this._chatId, chunk);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async _handleConfirmation(request, respond) {
|
|
135
|
+
if (!this._chatId)
|
|
136
|
+
return;
|
|
137
|
+
const text = formatConfirmationMessage(request);
|
|
138
|
+
if (this._confirmationStyle === "inline-keyboard") {
|
|
139
|
+
this._pendingKeyboardConfirmations.set(request.toolUseId, {
|
|
140
|
+
respond,
|
|
141
|
+
messageText: text,
|
|
142
|
+
});
|
|
143
|
+
const keyboard = new InlineKeyboard()
|
|
144
|
+
.text("Approve", `confirm:${request.toolUseId}:approve`)
|
|
145
|
+
.text("Deny", `confirm:${request.toolUseId}:deny`);
|
|
146
|
+
await this._bot.api.sendMessage(this._chatId, text, {
|
|
147
|
+
reply_markup: keyboard,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this._pendingTextConfirmation = { respond };
|
|
152
|
+
await this._bot.api.sendMessage(this._chatId, `${text}\n\nReply yes/no (or explain what you'd like instead)`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=telegram-platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram-platform.js","sourceRoot":"","sources":["../src/telegram-platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAO7C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAajC;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IACV,IAAI,CAAM;IACV,aAAa,CAAc;IAC3B,kBAAkB,CAA6B;IACxD,OAAO,CAAgB;IACvB,OAAO,GAA2B,IAAI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AI,CAAC,kBAAkB,KAAK,iBAAiB,EAAE,CAAC;YAClD,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE;gBACxD,OAAO;gBACP,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE;iBAClC,IAAI,CAAC,SAAS,EAAE,WAAW,OAAO,CAAC,SAAS,UAAU,CAAC;iBACvD,IAAI,CAAC,MAAM,EAAE,WAAW,OAAO,CAAC,SAAS,OAAO,CAAC,CAAC;YAErD,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE;gBAClD,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,wBAAwB,GAAG,EAAE,OAAO,EAAE,CAAC;YAC5C,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAC7B,IAAI,CAAC,OAAO,EACZ,GAAG,IAAI,uDAAuD,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentick/connector-telegram",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Telegram connector for Agentick — bridge Telegram bots to agent sessions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"ai",
|
|
8
|
+
"bot",
|
|
9
|
+
"connector",
|
|
10
|
+
"telegram"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Ryan Lindgren",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/agenticklabs/agentick.git",
|
|
17
|
+
"directory": "packages/connector-telegram"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "src/index.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./src/index.ts"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.build.json",
|
|
40
|
+
"test": "echo \"Tests run from workspace root\"",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
42
|
+
"lint": "oxlint src/",
|
|
43
|
+
"format:check": "oxfmt --check src/",
|
|
44
|
+
"clean": "rm -rf dist tsconfig.build.tsbuildinfo",
|
|
45
|
+
"prepublishOnly": "pnpm build",
|
|
46
|
+
"dev": "tsc --watch"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@agentick/connector": "workspace:*",
|
|
50
|
+
"@agentick/shared": "workspace:*"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"grammy": "^1.35.0",
|
|
54
|
+
"typescript": "^5.8.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"grammy": "^1.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"grammy": {
|
|
61
|
+
"optional": false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/index.ts
ADDED