@wrongstack/telegram 0.293.0 → 0.295.1
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 +1 -1
- package/dist/api-client.d.ts +2 -0
- package/dist/api-client.d.ts.map +1 -1
- package/dist/bot-queue.d.ts +16 -1
- package/dist/bot-queue.d.ts.map +1 -1
- package/dist/bot.d.ts +8 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/config-classifier.d.ts +1 -52
- package/dist/config-classifier.d.ts.map +1 -1
- package/dist/config.d.ts +110 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +335 -119
- package/dist/index.js.map +3 -3
- package/dist/manifest.d.ts +35 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/notification-channel.d.ts +2 -2
- package/dist/notification-channel.d.ts.map +1 -1
- package/dist/outbound-queue.d.ts +1 -1
- package/dist/outbound-queue.d.ts.map +1 -1
- package/dist/poll-lock.d.ts +1 -1
- package/dist/poll-lock.d.ts.map +1 -1
- package/dist/rate-limiter.d.ts +36 -0
- package/dist/rate-limiter.d.ts.map +1 -0
- package/dist/security/outbound.d.ts.map +1 -1
- package/dist/slash-commands/index.d.ts +2 -1
- package/dist/slash-commands/index.d.ts.map +1 -1
- package/dist/tools/telegram-approve.d.ts +6 -3
- package/dist/tools/telegram-approve.d.ts.map +1 -1
- package/dist/tools/telegram-read.d.ts +1 -1
- package/dist/tools/telegram-read.d.ts.map +1 -1
- package/dist/tools/telegram-send.d.ts +1 -1
- package/dist/tools/telegram-send.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/inbox-cursor-store.d.ts +0 -54
- package/dist/inbox-cursor-store.d.ts.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram plugin surface manifest — single source of truth for tools,
|
|
3
|
+
* slash commands, and config fields. The parity test in
|
|
4
|
+
* `tests/unit/manifest-parity.test.ts` asserts that the runtime-registered
|
|
5
|
+
* surface matches this manifest exactly, so CI fails on future drift.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TELEGRAM_MANIFEST: {
|
|
8
|
+
readonly pluginName: 'telegram';
|
|
9
|
+
readonly tools: readonly [{
|
|
10
|
+
readonly name: 'telegram_send';
|
|
11
|
+
readonly description: 'Send a scrubbed message to the paired Telegram chat or an explicitly allowed outbound chat.';
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: 'telegram_read';
|
|
14
|
+
readonly description: 'Read recent incoming Telegram messages the bot has received, newest first.';
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: 'telegram_approve';
|
|
17
|
+
readonly description: 'Post a scrubbed yes/no prompt to the paired Telegram chat, then wait for a button press.';
|
|
18
|
+
}];
|
|
19
|
+
readonly slashCommands: readonly [{
|
|
20
|
+
readonly name: 'telegram-health';
|
|
21
|
+
readonly aliases: readonly ['telegram', 'tgstat', 'tgs'];
|
|
22
|
+
readonly description: 'Show Telegram bot connection health and config';
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: 'send';
|
|
25
|
+
readonly aliases: readonly [];
|
|
26
|
+
readonly description: 'Send a message to a Telegram chat';
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: 'chatid';
|
|
29
|
+
readonly aliases: readonly [];
|
|
30
|
+
readonly description: 'Show the configured default chat ID';
|
|
31
|
+
}];
|
|
32
|
+
readonly configFields: readonly ['botToken', 'notifyChatId', 'inboundMode', 'allowedUsers', 'allowedChats', 'allowedOutboundChats', 'pollIntervalSec', 'notifyOnSessionEnd', 'longToolThresholdMs', 'notifyOnDelegate', 'maxMessageLength', 'offsetStoragePath', 'singleInstanceLock', 'outboundQueuePerChat', 'outboundQueueConcurrency', 'allowGroupApprovals', 'rateLimitTokensPerSecond', 'rateLimitBurst', 'parseMode'];
|
|
33
|
+
};
|
|
34
|
+
export type TelegramManifest = typeof TELEGRAM_MANIFEST;
|
|
35
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,iBAAiB;aAC5B,UAAU,EAAE,UAAU;aAEtB,KAAK;iBAED,IAAI,EAAE,eAAe;iBACrB,WAAW,EAAE,6FAA6F;;iBAG1G,IAAI,EAAE,eAAe;iBACrB,WAAW,EAAE,4EAA4E;;iBAGzF,IAAI,EAAE,kBAAkB;iBACxB,WAAW,EAAE,0FAA0F;;aAI3G,aAAa;iBAET,IAAI,EAAE,iBAAiB;iBACvB,OAAO,YAAG,UAAU,EAAE,QAAQ,EAAE,KAAK;iBACrC,WAAW,EAAE,gDAAgD;;iBAG7D,IAAI,EAAE,MAAM;iBACZ,OAAO;iBACP,WAAW,EAAE,mCAAmC;;iBAGhD,IAAI,EAAE,QAAQ;iBACd,OAAO;iBACP,WAAW,EAAE,qCAAqC;;aAItD,YAAY,YACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,WAAW;CAEL,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC"}
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* @module telegram
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
import type { Logger } from '@wrongstack/core';
|
|
24
|
-
import type { NotificationChannel, NotificationMessage, NotificationResult } from '@wrongstack/core';
|
|
23
|
+
import type { Logger } from '@wrongstack/core/types';
|
|
24
|
+
import type { NotificationChannel, NotificationMessage, NotificationResult } from '@wrongstack/core/notifications';
|
|
25
25
|
import type { TelegramBot } from './bot.js';
|
|
26
26
|
export interface TelegramNotificationChannelOptions {
|
|
27
27
|
/** The TelegramBot instance (owned by the main plugin). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-channel.d.ts","sourceRoot":"","sources":["../src/notification-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"notification-channel.d.ts","sourceRoot":"","sources":["../src/notification-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,mBAAmB,EAEnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkB5C,MAAM,WAAW,kCAAkC;IACjD,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,mBAAmB,CAAC,EACzB,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GACjD,SAAS,CAAC;IACd,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;gEAE4D;IAC5D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,qBAAa,2BAA4B,YAAW,mBAAmB;;IACrE,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IACpC,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IAUpC,YAAY,IAAI,EAAE,kCAAkC,EAMnD;IAED;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA8CnE;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAUjE;CACF"}
|
package/dist/outbound-queue.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound-queue.d.ts","sourceRoot":"","sources":["../src/outbound-queue.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"outbound-queue.d.ts","sourceRoot":"","sources":["../src/outbound-queue.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAaD,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,2DAA2D;IAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAWD,qBAAa,aAAa;;IAqBxB,YAAY,IAAI,EAAE,oBAAoB,EASrC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CA6D9C;IAED,0EAA0E;IAC1E,KAAK,IAAI,kBAAkB,CAW1B;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB1B;CAuFF"}
|
package/dist/poll-lock.d.ts
CHANGED
package/dist/poll-lock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll-lock.d.ts","sourceRoot":"","sources":["../src/poll-lock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"poll-lock.d.ts","sourceRoot":"","sources":["../src/poll-lock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAsBrD,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,SAAqB,GAAG,MAAM,CAGvF;AAED,qBAAa,QAAQ;IAYjB,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAX3B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoC;IACvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAqB;IAC1C,OAAO,CAAC,cAAc,CAA+C;IACrE,OAAO,CAAC,KAAK,CAAS;IAEtB,sEAAsE;IACtE,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAElC,YACW,QAAQ,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,eAAe,EAKvB;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;;OAGG;IACH,UAAU,IAAI,OAAO,CA8BpB;IAED,2DAA2D;IAC3D,OAAO,IAAI,IAAI,CASd;IAMD,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,QAAQ;IAgBhB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,UAAU;CAUnB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface RateLimiterOptions {
|
|
2
|
+
/** Tokens per second (refill rate). Default: 0.33 (≈20/min for groups). */
|
|
3
|
+
tokensPerSecond?: number | undefined;
|
|
4
|
+
/** Maximum burst size (bucket capacity). Default: 4. */
|
|
5
|
+
burst?: number | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface TokenBucket {
|
|
8
|
+
/** Wait until a token is available, respecting the optional timeout. */
|
|
9
|
+
waitForToken(timeoutMs?: number | undefined): Promise<void>;
|
|
10
|
+
/** Current fill level (for diagnostics). */
|
|
11
|
+
fill(): number;
|
|
12
|
+
/**
|
|
13
|
+
* True once the bucket has refilled to full capacity. A full, idle bucket
|
|
14
|
+
* holds no pacing state — recreating it yields an identical full bucket — so
|
|
15
|
+
* callers can safely evict it to bound a per-chat bucket map without losing
|
|
16
|
+
* any rate-limit state. A depleted (in-use) bucket is never full.
|
|
17
|
+
*/
|
|
18
|
+
isFull(): boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a token bucket for a single chat.
|
|
22
|
+
*
|
|
23
|
+
* The bucket starts full (`burst` tokens). Every `waitForToken` call
|
|
24
|
+
* consumes one token if available; otherwise it waits until a token
|
|
25
|
+
* is refilled. Refills happen at `tokensPerSecond` rate, capped at
|
|
26
|
+
* `burst`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const bucket = createTokenBucket({ tokensPerSecond: 0.33, burst: 4 });
|
|
31
|
+
* await bucket.waitForToken(5_000); // waits up to 5s for a slot
|
|
32
|
+
* bot.sendMessage(chatId, text);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function createTokenBucket(opts?: RateLimiterOptions): TokenBucket;
|
|
36
|
+
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../src/rate-limiter.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,4CAA4C;IAC5C,IAAI,IAAI,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,IAAI,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAyDxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/security/outbound.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/security/outbound.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAG,gCAAyC,CAAC;AAEtF,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAAC;IAC/C,6EAA6E;IAC7E,yBAAyB,CAAC,IAAI,SAAS,cAAc,EAAE,CAAC;CACzD;AASD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,cAAc,GAAG,SAAS,EAC3C,MAAM,EAAE,4BAA4B,GACnC,cAAc,CA6BhB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PluginAPI
|
|
1
|
+
import type { PluginAPI } from '@wrongstack/core/plugin';
|
|
2
|
+
import type { SlashCommand } from '@wrongstack/core/types';
|
|
2
3
|
import { type TelegramBot } from '../bot.js';
|
|
3
4
|
import type { TelegramPluginConfig } from '../config.js';
|
|
4
5
|
import { type TelegramOutboundTargetPolicy } from '../security/outbound.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slash-commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slash-commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAM3D,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,oBAAoB,GAAG,YAAY,CA0BzF;AAMD,UAAU,uBAAwB,SAAQ,4BAA4B;IACpE,mBAAmB,CAAC,IAAI,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,WAAW,EAChB,eAAe,EAAE,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EACtE,QAAQ,CAAC,EAAE,mBAAmB,GAC7B,YAAY,CAwDd;AAMD,wBAAgB,eAAe,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,CAmB7E;AAMD,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,oBAAoB,GACxB,MAAM,EAAE,CAYV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger, Tool } from '@wrongstack/core';
|
|
1
|
+
import type { Logger, Tool } from '@wrongstack/core/types';
|
|
2
2
|
import type { TelegramBot } from '../bot.js';
|
|
3
3
|
import { type TelegramChatId } from '../security/outbound.js';
|
|
4
4
|
interface TelegramApproveInput {
|
|
@@ -45,8 +45,11 @@ export declare function makeTelegramApproveTool(opts: {
|
|
|
45
45
|
getAllowedOutboundChatIds?(): readonly TelegramChatId[];
|
|
46
46
|
/** Immutable Telegram user IDs permitted to resolve an approval. */
|
|
47
47
|
getAllowedUserIds?(): readonly TelegramChatId[];
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Group approvals stay denied unless both this and explicit user IDs are
|
|
50
|
+
* configured. Resolved on every call for live config updates.
|
|
51
|
+
*/
|
|
52
|
+
getAllowGroupApprovals?(): boolean;
|
|
50
53
|
maxMessageLength: number;
|
|
51
54
|
log: Logger;
|
|
52
55
|
}): Tool<TelegramApproveInput, TelegramApproveOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-approve.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-approve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"telegram-approve.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-approve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAEjC,UAAU,oBAAoB;IAC5B,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,WAAW,CAAC;IACjB,6EAA6E;IAC7E,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAAC;IAC/C,kFAAkF;IAClF,yBAAyB,CAAC,IAAI,SAAS,cAAc,EAAE,CAAC;IACxD,oEAAoE;IACpE,iBAAiB,CAAC,IAAI,SAAS,cAAc,EAAE,CAAC;IAChD;;;OAGG;IACH,sBAAsB,CAAC,IAAI,OAAO,CAAC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,IAAI,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CA8GpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-read.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"telegram-read.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,UAAU,iBAAiB;IACzB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,WAAW,CAAC;CAClB,GAAG,IAAI,CAAC,iBAAiB,CAAC,CA0D1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-send.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-send.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"telegram-send.d.ts","sourceRoot":"","sources":["../../src/tools/telegram-send.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,UAAU,iBAAiB;IACzB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,WAAW,CAAC;IACjB,6EAA6E;IAC7E,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAAC;IAC/C,kFAAkF;IAClF,yBAAyB,CAAC,IAAI,SAAS,cAAc,EAAE,CAAC;IACxD,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAsD1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/telegram",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.295.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack plugin — Telegram bridge: send messages, receive prompts, get notified.",
|
|
6
6
|
"repository": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@wrongstack/core": "0.
|
|
28
|
+
"@wrongstack/core": "0.295.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^26.1.1",
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
|
-
"@wrongstack/core": "0.
|
|
33
|
+
"@wrongstack/core": "0.295.1"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/** Default inbox cursor path. */
|
|
2
|
-
export declare function inboxCursorPath(token: string, chatId: string | number, globalRoot?: string): string;
|
|
3
|
-
export interface InboxCursorStoreOptions {
|
|
4
|
-
/** Bot token — derives a token-scoped default path. Never persisted. */
|
|
5
|
-
token?: string | undefined;
|
|
6
|
-
/** Explicit file path override. An empty string disables persistence. */
|
|
7
|
-
path?: string | undefined;
|
|
8
|
-
/** Base directory for token-scoped derivation. */
|
|
9
|
-
globalRoot?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export declare class InboxCursorStore {
|
|
12
|
-
private readonly path;
|
|
13
|
-
constructor(opts?: InboxCursorStoreOptions);
|
|
14
|
-
get storePath(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Read the persisted offset. Returns null when the file is missing,
|
|
17
|
-
* empty, or contains a value that is not a valid non-negative integer.
|
|
18
|
-
*/
|
|
19
|
-
read(): number | null;
|
|
20
|
-
/**
|
|
21
|
-
* Persist an offset using an atomic write (temp + fsync + rename).
|
|
22
|
-
* Creates the parent directory on first call.
|
|
23
|
-
*
|
|
24
|
-
* P1.6 semantics: commit only on progress. offset = 0 means "never
|
|
25
|
-
* advanced past the initial state", so writing 0 would re-play the
|
|
26
|
-
* entire inbox on the next poll — we no-op it.
|
|
27
|
-
*/
|
|
28
|
-
write(offset: number): void;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Per-inbox cursor map: chatId -> PersistedInboxCursor.
|
|
32
|
-
*
|
|
33
|
-
* The map is built by passing an `inboxId` to each operation, so a single
|
|
34
|
-
* store instance can drive an arbitrary number of inboxes; each one is
|
|
35
|
-
* isolated on disk and on the wire (the Telegram long-poll returns all
|
|
36
|
-
* messages globally, so the bot must also commit per-inbox deltas to
|
|
37
|
-
* maintain the replay boundary).
|
|
38
|
-
*/
|
|
39
|
-
export declare class PerInboxCursorMap {
|
|
40
|
-
private readonly basePath;
|
|
41
|
-
private readonly stores;
|
|
42
|
-
constructor(token: string, globalRoot?: string);
|
|
43
|
-
private readonly token;
|
|
44
|
-
private storeFor;
|
|
45
|
-
/** Read the offset for `inboxId`. Returns null when no offset is persisted. */
|
|
46
|
-
read(inboxId: string): number | null;
|
|
47
|
-
/** Persist the offset for `inboxId`. */
|
|
48
|
-
write(inboxId: string, offset: number): void;
|
|
49
|
-
/** Drop the cached store for `inboxId` (next read/write will reload from disk). */
|
|
50
|
-
invalidate(inboxId: string): void;
|
|
51
|
-
/** Drop all cached stores. */
|
|
52
|
-
clear(): void;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=inbox-cursor-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-cursor-store.d.ts","sourceRoot":"","sources":["../src/inbox-cursor-store.ts"],"names":[],"mappings":"AAiCA,iCAAiC;AACjC,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,SAAqB,GAC9B,MAAM,CAER;AAED,MAAM,WAAW,uBAAuB;IACtC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,YAAY,IAAI,GAAE,uBAA4B,EAQ7C;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;OAGG;IACH,IAAI,IAAI,MAAM,GAAG,IAAI,CAuBpB;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAoB1B;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE,YAAY,KAAK,EAAE,MAAM,EAAE,UAAU,SAAqB,EAOzD;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B,OAAO,CAAC,QAAQ;IAehB,+EAA+E;IAC/E,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnC;IAED,wCAAwC;IACxC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAE3C;IAED,mFAAmF;IACnF,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED,8BAA8B;IAC9B,KAAK,IAAI,IAAI,CAEZ;CACF"}
|