stitchkit 0.123.2 → 0.123.3
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/CHANGELOG.md +17 -0
- package/dist/entrypoints/server.js +3 -3
- package/dist/entrypoints/telegram/voice.d.ts +2 -0
- package/dist/entrypoints/telegram/voice.d.ts.map +1 -0
- package/dist/entrypoints/telegram/voice.js +18 -0
- package/dist/entrypoints/telegram.d.ts +1 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +43 -0
- package/dist/entrypoints/tracking/performance.js +3 -3
- package/dist/index-0jdempdr.js +69 -0
- package/dist/telegram/voice-waveform-pcm.d.ts +21 -0
- package/dist/telegram/voice-waveform-pcm.d.ts.map +1 -0
- package/dist/telegram/voice-waveform.d.ts +67 -0
- package/dist/telegram/voice-waveform.d.ts.map +1 -0
- package/llms/stitchkit.txt +3 -1
- package/llms/telegram-voice.txt +29 -0
- package/llms/telegram.2.txt +71 -0
- package/llms/telegram.txt +51 -59
- package/llms-full.txt +68 -1
- package/llms.txt +4 -3
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,23 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.123.3] - 2026-11-12
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `stitchkit/telegram/voice`, `stitchkit/telegram` — **the waveform of a voice message, one format
|
|
23
|
+
for every bot.** `readTelegramVoiceWaveform(pcmPath, { signal })` reads a mono 16-bit PCM side
|
|
24
|
+
copy of a recording in chunks and returns the packed waveform `sendVoice` takes on a local Bot
|
|
25
|
+
API server that accepts one; `readTelegramVoiceWaveformSupport(await bot.api.getMe())` says
|
|
26
|
+
whether the server does (`supports_voice_waveform`, `voice_waveform_version` 1). The levels are
|
|
27
|
+
scaled the way Telegram Desktop scales them — 1.8 × the mean peak, never below a floor — so
|
|
28
|
+
silence stays zero and a quiet recording is not stretched to look loud. The new browser-safe
|
|
29
|
+
entrypoint `stitchkit/telegram/voice` holds the format itself: `packTelegramVoiceWaveform(peaks)`,
|
|
30
|
+
`unpackTelegramVoiceWaveform(waveform)` for a page drawing the bars, and
|
|
31
|
+
`TelegramVoiceWaveformError` with its reasons. Bots that each packed 5-bit levels, read `getMe`
|
|
32
|
+
and scaled the bars their own way now share one implementation; the `stitchkit/telegram`
|
|
33
|
+
budget grows by these two names, and `stitchkit/telegram/voice` starts evolving at nine.
|
|
34
|
+
|
|
18
35
|
## [0.123.2] - 2026-11-12
|
|
19
36
|
|
|
20
37
|
### Added
|
|
@@ -72,6 +72,9 @@ import {
|
|
|
72
72
|
signJwt2,
|
|
73
73
|
verifyPkce2
|
|
74
74
|
} from "../index-hkw233vx.js";
|
|
75
|
+
import {
|
|
76
|
+
deriveCodeChallenge2
|
|
77
|
+
} from "../index-ap3gqe56.js";
|
|
75
78
|
import {
|
|
76
79
|
defineMultipartStream2,
|
|
77
80
|
createMultipartStream2,
|
|
@@ -79,9 +82,6 @@ import {
|
|
|
79
82
|
createImplement2,
|
|
80
83
|
createScopedImplement2
|
|
81
84
|
} from "../index-eabx6qjh.js";
|
|
82
|
-
import {
|
|
83
|
-
deriveCodeChallenge2
|
|
84
|
-
} from "../index-ap3gqe56.js";
|
|
85
85
|
import"../index-9ypczvpj.js";
|
|
86
86
|
import {
|
|
87
87
|
DEFAULT_CORS_ALLOW_HEADERS2,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { packTelegramVoiceWaveform, readTelegramVoiceWaveformSupport, TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL, TELEGRAM_VOICE_WAVEFORM_SAMPLES, TELEGRAM_VOICE_WAVEFORM_VERSION, TelegramVoiceWaveformError, type TelegramVoiceWaveformRefusal, type TelegramVoiceWaveformSupport, unpackTelegramVoiceWaveform, } from '../../telegram/voice-waveform.js';
|
|
2
|
+
//# sourceMappingURL=voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/telegram/voice.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TELEGRAM_VOICE_WAVEFORM_SAMPLES2,
|
|
3
|
+
TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2,
|
|
4
|
+
TELEGRAM_VOICE_WAVEFORM_VERSION2,
|
|
5
|
+
TelegramVoiceWaveformError2,
|
|
6
|
+
packTelegramVoiceWaveform2,
|
|
7
|
+
unpackTelegramVoiceWaveform2,
|
|
8
|
+
readTelegramVoiceWaveformSupport2
|
|
9
|
+
} from "../../index-0jdempdr.js";
|
|
10
|
+
export {
|
|
11
|
+
TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2 as TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL,
|
|
12
|
+
TELEGRAM_VOICE_WAVEFORM_SAMPLES2 as TELEGRAM_VOICE_WAVEFORM_SAMPLES,
|
|
13
|
+
TELEGRAM_VOICE_WAVEFORM_VERSION2 as TELEGRAM_VOICE_WAVEFORM_VERSION,
|
|
14
|
+
TelegramVoiceWaveformError2 as TelegramVoiceWaveformError,
|
|
15
|
+
packTelegramVoiceWaveform2 as packTelegramVoiceWaveform,
|
|
16
|
+
readTelegramVoiceWaveformSupport2 as readTelegramVoiceWaveformSupport,
|
|
17
|
+
unpackTelegramVoiceWaveform2 as unpackTelegramVoiceWaveform
|
|
18
|
+
};
|
|
@@ -15,5 +15,6 @@ export { checkTelegramUpdateStore } from '../telegram/update-store-check.js';
|
|
|
15
15
|
export { type PostgresTelegramUpdateStoreConfig, postgresTelegramUpdateStore, postgresTelegramUpdateStoreSchema, type TelegramPostgresQuery, } from '../telegram/update-store-postgres.js';
|
|
16
16
|
export { type SqliteTelegramUpdateStoreConfig, sqliteTelegramUpdateStore, type TelegramSqliteDatabase, } from '../telegram/update-store-sqlite.js';
|
|
17
17
|
export { parseTelegramUser, type TelegramUser } from '../telegram/user.js';
|
|
18
|
+
export { type ReadTelegramVoiceWaveformOptions, readTelegramVoiceWaveform, } from '../telegram/voice-waveform-pcm.js';
|
|
18
19
|
export { type ClaimTelegramWebhookConfig, checkTelegramWebhook, claimTelegramWebhook, type ReceiveTelegramWebhookOptions, receiveTelegramWebhook, TELEGRAM_WEBHOOK_NONE, type TelegramUpdateAcceptance, type TelegramWebhookClaim, TelegramWebhookClaimError, type TelegramWebhookConfig, type TelegramWebhookRefusal, type TelegramWebhookState, telegramWebhookUrl, } from '../telegram/webhook.js';
|
|
19
20
|
//# sourceMappingURL=telegram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/entrypoints/telegram.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/entrypoints/telegram.ts"],"names":[],"mappings":"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"}
|
|
@@ -6,6 +6,11 @@ import"../index-bqzgaj57.js";
|
|
|
6
6
|
import {
|
|
7
7
|
attemptExclusiveLock
|
|
8
8
|
} from "../index-chz7c830.js";
|
|
9
|
+
import {
|
|
10
|
+
TELEGRAM_VOICE_WAVEFORM_SAMPLES2,
|
|
11
|
+
TelegramVoiceWaveformError2,
|
|
12
|
+
packTelegramVoiceWaveform2
|
|
13
|
+
} from "../index-0jdempdr.js";
|
|
9
14
|
import {
|
|
10
15
|
TELEGRAM_SEND_FAILURE_REASONS2,
|
|
11
16
|
classifyTelegramSendFailure2
|
|
@@ -2947,6 +2952,43 @@ function sqliteTelegramUpdateStore(config) {
|
|
|
2947
2952
|
}
|
|
2948
2953
|
};
|
|
2949
2954
|
}
|
|
2955
|
+
// src/telegram/voice-waveform-pcm.ts
|
|
2956
|
+
import { open as open2 } from "node:fs/promises";
|
|
2957
|
+
var CHUNK_BYTES = 256 * 1024;
|
|
2958
|
+
var SAMPLE_BYTES = 2;
|
|
2959
|
+
async function readTelegramVoiceWaveform(pcmPath, options = {}) {
|
|
2960
|
+
const { signal } = options;
|
|
2961
|
+
signal?.throwIfAborted();
|
|
2962
|
+
const file = await open2(pcmPath, "r");
|
|
2963
|
+
try {
|
|
2964
|
+
const { size } = await file.stat();
|
|
2965
|
+
if (size === 0)
|
|
2966
|
+
throw new TelegramVoiceWaveformError2("empty-pcm");
|
|
2967
|
+
if (size % SAMPLE_BYTES !== 0)
|
|
2968
|
+
throw new TelegramVoiceWaveformError2("truncated-pcm");
|
|
2969
|
+
const samples = size / SAMPLE_BYTES;
|
|
2970
|
+
const peaks = new Uint16Array(TELEGRAM_VOICE_WAVEFORM_SAMPLES2);
|
|
2971
|
+
const buffer = new Uint8Array(Math.min(CHUNK_BYTES, size));
|
|
2972
|
+
const view = new DataView(buffer.buffer);
|
|
2973
|
+
for (let offset = 0;offset < size; ) {
|
|
2974
|
+
signal?.throwIfAborted();
|
|
2975
|
+
const { bytesRead } = await file.read(buffer, 0, Math.min(buffer.length, size - offset), offset);
|
|
2976
|
+
if (bytesRead === 0 || bytesRead % SAMPLE_BYTES !== 0)
|
|
2977
|
+
throw new TelegramVoiceWaveformError2("truncated-pcm");
|
|
2978
|
+
const first = offset / SAMPLE_BYTES;
|
|
2979
|
+
for (let index = 0;index < bytesRead; index += SAMPLE_BYTES) {
|
|
2980
|
+
const part = Math.floor((first + index / SAMPLE_BYTES) * TELEGRAM_VOICE_WAVEFORM_SAMPLES2 / samples);
|
|
2981
|
+
const peak = Math.abs(view.getInt16(index, true));
|
|
2982
|
+
if (peak > (peaks[part] ?? 0))
|
|
2983
|
+
peaks[part] = peak;
|
|
2984
|
+
}
|
|
2985
|
+
offset += bytesRead;
|
|
2986
|
+
}
|
|
2987
|
+
return packTelegramVoiceWaveform2(peaks);
|
|
2988
|
+
} finally {
|
|
2989
|
+
await file.close();
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2950
2992
|
// src/telegram/webhook.ts
|
|
2951
2993
|
var OWNER_PARAMETER = "owner";
|
|
2952
2994
|
var OWNER_CONTEXT = "stitchkit:telegram-webhook-owner";
|
|
@@ -3079,6 +3121,7 @@ export {
|
|
|
3079
3121
|
parseTelegramUser,
|
|
3080
3122
|
postgresTelegramUpdateStore,
|
|
3081
3123
|
postgresTelegramUpdateStoreSchema,
|
|
3124
|
+
readTelegramVoiceWaveform,
|
|
3082
3125
|
receiveTelegramWebhook,
|
|
3083
3126
|
redactTelegramBotToken,
|
|
3084
3127
|
runTelegramBroadcast,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_BOT_USER_AGENT_PATTERN2
|
|
3
|
-
} from "../../index-1f40z584.js";
|
|
4
1
|
import {
|
|
5
2
|
redactTrackingText2,
|
|
6
3
|
sendUnloadBeacon2
|
|
7
4
|
} from "../../index-8vzh5wpv.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_BOT_USER_AGENT_PATTERN2
|
|
7
|
+
} from "../../index-1f40z584.js";
|
|
8
8
|
|
|
9
9
|
// src/tracking/performance/collector.ts
|
|
10
10
|
var DEFAULT_EARLY_DELAY_MS = 5000;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/telegram/voice-waveform.ts
|
|
2
|
+
var TELEGRAM_VOICE_WAVEFORM_SAMPLES2 = 100;
|
|
3
|
+
var TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2 = 31;
|
|
4
|
+
var TELEGRAM_VOICE_WAVEFORM_VERSION2 = 1;
|
|
5
|
+
var BITS_PER_LEVEL = 5;
|
|
6
|
+
var PACKED_BYTES = Math.ceil(TELEGRAM_VOICE_WAVEFORM_SAMPLES2 * BITS_PER_LEVEL / 8);
|
|
7
|
+
var MEAN_PEAK_SCALE = 1.8;
|
|
8
|
+
var PEAK_FLOOR = 2500;
|
|
9
|
+
var PEAK_MAX = 32768;
|
|
10
|
+
|
|
11
|
+
class TelegramVoiceWaveformError2 extends Error {
|
|
12
|
+
reason;
|
|
13
|
+
constructor(reason) {
|
|
14
|
+
super(`Telegram voice waveform refused: ${reason}`);
|
|
15
|
+
this.name = "TelegramVoiceWaveformError";
|
|
16
|
+
this.reason = reason;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function packTelegramVoiceWaveform2(peaks) {
|
|
20
|
+
if (peaks.length !== TELEGRAM_VOICE_WAVEFORM_SAMPLES2)
|
|
21
|
+
throw new TelegramVoiceWaveformError2("peak-count");
|
|
22
|
+
const values = Array.from(peaks);
|
|
23
|
+
let sum = 0;
|
|
24
|
+
for (const peak of values) {
|
|
25
|
+
if (!Number.isInteger(peak) || peak < 0 || peak > PEAK_MAX)
|
|
26
|
+
throw new TelegramVoiceWaveformError2("peak-value");
|
|
27
|
+
sum += peak;
|
|
28
|
+
}
|
|
29
|
+
const ceiling = Math.max(Math.floor(sum * MEAN_PEAK_SCALE / TELEGRAM_VOICE_WAVEFORM_SAMPLES2), PEAK_FLOOR);
|
|
30
|
+
const packed = new Uint8Array(PACKED_BYTES);
|
|
31
|
+
for (const [index, peak] of values.entries()) {
|
|
32
|
+
const level = Math.floor(Math.min(peak, ceiling) * TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2 / ceiling);
|
|
33
|
+
const bit = index * BITS_PER_LEVEL;
|
|
34
|
+
const byte = bit >> 3;
|
|
35
|
+
const shift = bit & 7;
|
|
36
|
+
packed[byte] = (packed[byte] ?? 0) | level << shift & 255;
|
|
37
|
+
if (shift > 8 - BITS_PER_LEVEL)
|
|
38
|
+
packed[byte + 1] = level >> 8 - shift;
|
|
39
|
+
}
|
|
40
|
+
return btoa(String.fromCharCode(...packed));
|
|
41
|
+
}
|
|
42
|
+
function unpackTelegramVoiceWaveform2(waveform) {
|
|
43
|
+
let text;
|
|
44
|
+
try {
|
|
45
|
+
text = atob(waveform);
|
|
46
|
+
} catch {
|
|
47
|
+
throw new TelegramVoiceWaveformError2("malformed");
|
|
48
|
+
}
|
|
49
|
+
const bytes = Uint8Array.from(text, (char) => char.charCodeAt(0));
|
|
50
|
+
const count = Math.floor(bytes.length * 8 / BITS_PER_LEVEL);
|
|
51
|
+
return Array.from({ length: count }, (_, index) => {
|
|
52
|
+
const bit = index * BITS_PER_LEVEL;
|
|
53
|
+
const byte = bit >> 3;
|
|
54
|
+
const pair = (bytes[byte] ?? 0) | (bytes[byte + 1] ?? 0) << 8;
|
|
55
|
+
return pair >> (bit & 7) & TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function readTelegramVoiceWaveformSupport2(me) {
|
|
59
|
+
const declared = typeof me === "object" && me !== null;
|
|
60
|
+
const flag = declared ? Reflect.get(me, "supports_voice_waveform") : undefined;
|
|
61
|
+
const raw = declared ? Reflect.get(me, "voice_waveform_version") : undefined;
|
|
62
|
+
const version = typeof raw === "number" && Number.isInteger(raw) ? raw : null;
|
|
63
|
+
return {
|
|
64
|
+
supported: flag === true && version === TELEGRAM_VOICE_WAVEFORM_VERSION2,
|
|
65
|
+
version
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { TELEGRAM_VOICE_WAVEFORM_SAMPLES2, TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL2, TELEGRAM_VOICE_WAVEFORM_VERSION2, TelegramVoiceWaveformError2, packTelegramVoiceWaveform2, unpackTelegramVoiceWaveform2, readTelegramVoiceWaveformSupport2 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The waveform of a recording from its decoded PCM: mono, 16-bit, little-endian
|
|
3
|
+
* (`ffmpeg -i <audio> -ac 1 -ar 8000 -f s16le <file>`).
|
|
4
|
+
*
|
|
5
|
+
* The file is read in chunks, so an hour of audio never sits in memory; the
|
|
6
|
+
* waveform needs the loudness of each part, not the bandwidth, and 8 kHz keeps
|
|
7
|
+
* six hours under 350 MB of PCM. The recording being sent is never this file:
|
|
8
|
+
* the PCM is a side copy, and what is uploaded stays byte for byte what it was.
|
|
9
|
+
*/
|
|
10
|
+
export interface ReadTelegramVoiceWaveformOptions {
|
|
11
|
+
/** Stops the read between chunks with the signal's reason. */
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The packed waveform `sendVoice` takes, from a PCM file. A file with no
|
|
16
|
+
* sample is refused (`empty-pcm`), and so is one that ends inside a sample or
|
|
17
|
+
* shrinks while it is read (`truncated-pcm`): a waveform is never made up.
|
|
18
|
+
* The refusal names the reason, not the path.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readTelegramVoiceWaveform(pcmPath: string, options?: ReadTelegramVoiceWaveformOptions): Promise<string>;
|
|
21
|
+
//# sourceMappingURL=voice-waveform-pcm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-waveform-pcm.d.ts","sourceRoot":"","sources":["../../src/telegram/voice-waveform-pcm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,MAAM,WAAW,gCAAgC;IAC/C,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The waveform of a Telegram voice message: the bars a client draws under the
|
|
3
|
+
* play button.
|
|
4
|
+
*
|
|
5
|
+
* Telegram stores it as a run of 5-bit levels packed little-endian — a voice
|
|
6
|
+
* note sent by a Telegram client carries 100 of them, 63 bytes. The public Bot
|
|
7
|
+
* API has no field for it, and Telegram then draws its own; a local Bot API
|
|
8
|
+
* server can accept one in `sendVoice`, and such a server says so in `getMe`
|
|
9
|
+
* (`supports_voice_waveform`, `voice_waveform_version`).
|
|
10
|
+
*
|
|
11
|
+
* The levels follow Telegram Desktop: each of the 100 parts of the recording
|
|
12
|
+
* keeps its loudest sample, and the scale is 1.8 times the mean of those
|
|
13
|
+
* peaks, never below a floor — a loud recording does not flatten its quiet
|
|
14
|
+
* parts to nothing, and a quiet one is not stretched into a loud-looking one.
|
|
15
|
+
* Silence stays at zero.
|
|
16
|
+
*
|
|
17
|
+
* Nothing here touches a file or the network, so the server that packs a
|
|
18
|
+
* waveform and the page that draws it read one format.
|
|
19
|
+
*/
|
|
20
|
+
/** Parts of the recording a waveform describes. */
|
|
21
|
+
export declare const TELEGRAM_VOICE_WAVEFORM_SAMPLES = 100;
|
|
22
|
+
/** The highest level of a bar: levels are 5 bits, `0`–`31`. */
|
|
23
|
+
export declare const TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL = 31;
|
|
24
|
+
/** The version of the `sendVoice` waveform field a Bot API server declares in `getMe`. */
|
|
25
|
+
export declare const TELEGRAM_VOICE_WAVEFORM_VERSION = 1;
|
|
26
|
+
/**
|
|
27
|
+
* Why a waveform was not made or not read.
|
|
28
|
+
*
|
|
29
|
+
* - `peak-count` — `packTelegramVoiceWaveform` takes exactly 100 peaks.
|
|
30
|
+
* - `peak-value` — a peak is not an integer from `0` to `32768`.
|
|
31
|
+
* - `malformed` — the waveform text is not base64.
|
|
32
|
+
* - `empty-pcm` — the PCM has no sample: there is nothing to draw.
|
|
33
|
+
* - `truncated-pcm` — the PCM ends inside a sample, or ended before its size.
|
|
34
|
+
*/
|
|
35
|
+
export type TelegramVoiceWaveformRefusal = 'peak-count' | 'peak-value' | 'malformed' | 'empty-pcm' | 'truncated-pcm';
|
|
36
|
+
export declare class TelegramVoiceWaveformError extends Error {
|
|
37
|
+
readonly reason: TelegramVoiceWaveformRefusal;
|
|
38
|
+
constructor(reason: TelegramVoiceWaveformRefusal);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The waveform `sendVoice` takes, from the loudest absolute sample of each of
|
|
42
|
+
* the 100 equal parts of a recording (16-bit PCM: `0`–`32768`): base64 of 63
|
|
43
|
+
* bytes. `readTelegramVoiceWaveform` from `stitchkit/telegram` finds the
|
|
44
|
+
* peaks in a PCM file and calls this.
|
|
45
|
+
*/
|
|
46
|
+
export declare function packTelegramVoiceWaveform(peaks: ArrayLike<number>): string;
|
|
47
|
+
/**
|
|
48
|
+
* The levels of a waveform, each `0`–`31`, for drawing it: one per 5 bits, so
|
|
49
|
+
* the 63 bytes `packTelegramVoiceWaveform` makes give 100, and a waveform
|
|
50
|
+
* Telegram drew itself gives however many it holds. Text that is not base64
|
|
51
|
+
* is refused, never read as silence.
|
|
52
|
+
*/
|
|
53
|
+
export declare function unpackTelegramVoiceWaveform(waveform: string): number[];
|
|
54
|
+
/** What a Bot API server said in `getMe` about the `sendVoice` waveform field. */
|
|
55
|
+
export interface TelegramVoiceWaveformSupport {
|
|
56
|
+
/** The server takes the waveform this module packs: it declares version 1. */
|
|
57
|
+
readonly supported: boolean;
|
|
58
|
+
/** The version it declares; `null` when it declares none (the public Bot API). */
|
|
59
|
+
readonly version: number | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Whether the server behind a `getMe` answer takes the waveform: the `result`
|
|
63
|
+
* of `getMe` as it came, any shape. A server that declares nothing, or another
|
|
64
|
+
* version, does not — and a voice sent there gets whatever Telegram draws.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readTelegramVoiceWaveformSupport(me: unknown): TelegramVoiceWaveformSupport;
|
|
67
|
+
//# sourceMappingURL=voice-waveform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-waveform.d.ts","sourceRoot":"","sources":["../../src/telegram/voice-waveform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mDAAmD;AACnD,eAAO,MAAM,+BAA+B,MAAM,CAAC;AACnD,+DAA+D;AAC/D,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,0FAA0F;AAC1F,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAWjD;;;;;;;;GAQG;AACH,MAAM,MAAM,4BAA4B,GACpC,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,WAAW,GACX,eAAe,CAAC;AAEpB,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAE9C,YAAY,MAAM,EAAE,4BAA4B,EAI/C;CACF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CA0B1E;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAetE;AAED,kFAAkF;AAClF,MAAM,WAAW,4BAA4B;IAC3C,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,EAAE,EAAE,OAAO,GAAG,4BAA4B,CAS1F"}
|
package/llms/stitchkit.txt
CHANGED
|
@@ -78,9 +78,10 @@ own, recorded as an ADR.
|
|
|
78
78
|
| `stitchkit/process/owner-loss` | bundled server entry (Bun, POSIX) | evolving | narrow bootstrap that keeps the process runner lazy while carrying its owner-loss guard in a single-file bundle |
|
|
79
79
|
| `stitchkit/files/packaging` | build time (Bun or Node) | evolving | installed native asset graph, integrity, Bun packaging plugin and the artifact loader check; a client bundled into one self-contained, hashed and verified file; no runtime install policy |
|
|
80
80
|
| `stitchkit/files` | server (Bun or Node) | stable | peer-free managed local-file boundary |
|
|
81
|
-
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and per-chat 429 pauses, resumable broadcasts, the operator channel with dedupe, a Bot API transport that separates a request that never left from an unknown outcome, local Bot API files, webhook ownership and durable webhook update intake |
|
|
81
|
+
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and per-chat 429 pauses, resumable broadcasts, the operator channel with dedupe, a Bot API transport that separates a request that never left from an unknown outcome, local Bot API files, the waveform of a voice message read from its PCM, webhook ownership and durable webhook update intake |
|
|
82
82
|
| `stitchkit/telegram/grammy` | server (Bun or Node) | evolving | the token's outbound budget as one grammY client transformer — a 429 that comes back as a response pauses its chat, and a cancelled wait is a request that never left |
|
|
83
83
|
| `stitchkit/telegram/html` | browser and server | evolving | Telegram's HTML as a tree — clean any markup to what Telegram accepts, cut long text into valid parts by what the reader sees, check markup before it is sent |
|
|
84
|
+
| `stitchkit/telegram/voice` | browser and server | evolving | the waveform of a voice message as one format — packed for `sendVoice` the way Telegram Desktop scales it, unpacked to draw it, a `getMe` read of whether the server takes it |
|
|
84
85
|
| `stitchkit/telegram/screens` | server (Bun or Node) | evolving | a bot's menus as declared screens over grammY — typed paths, actions and input, message reconciliation, state in any `StorageAdapter`, a test chat |
|
|
85
86
|
| `stitchkit/tracking` | browser **and** server | evolving | visitor-tracking mechanics — `createTrackingClient`, the tab-shared outbox, the page-leave beacon, attribution, the contract factory; no event vocabulary, no React |
|
|
86
87
|
| `stitchkit/tracking/contract` | browser **and** server | evolving | the wire shapes — the contract factory, event and visit schemas, the performance sample and its trust threshold; brings `zod` |
|
|
@@ -237,6 +238,7 @@ map — feature → packages:
|
|
|
237
238
|
| grammY lifecycle adapters (`stitchkit/application/grammy`) | `grammy` |
|
|
238
239
|
| Telegram platform primitives (`stitchkit/telegram`) | — (peer-free) |
|
|
239
240
|
| Telegram message markup (`stitchkit/telegram/html`) | — (peer-free) |
|
|
241
|
+
| Telegram voice waveforms (`stitchkit/telegram/voice`) | — (peer-free) |
|
|
240
242
|
| Telegram grammY client transformer (`stitchkit/telegram/grammy`) | `grammy` (types only; the bot brings it) |
|
|
241
243
|
| Telegram screens (`stitchkit/telegram/screens`) | `grammy` (types only; the bot brings it) |
|
|
242
244
|
| OpenTelemetry gauges (`stitchkit/application/opentelemetry`) | `@opentelemetry/api` |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# stitchkit/telegram/voice — stitchkit docs slice
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
|
|
6
|
+
Contains: API reference: `stitchkit/telegram/voice` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
Also read:
|
|
9
|
+
- see `llms/telegram.txt` for the Telegram bots guide
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# API reference: `stitchkit/telegram/voice` (docs/api/reference.md)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
## `stitchkit/telegram/voice`
|
|
16
|
+
|
|
17
|
+
The waveform of a voice message — the bars under its play button — as one format for the server
|
|
18
|
+
that packs it and the page that draws it. No peer, no file, no network. →
|
|
19
|
+
[guide](../guide/telegram.md#voice-waveforms)
|
|
20
|
+
|
|
21
|
+
| Export | Kind | Summary |
|
|
22
|
+
|--------|------|---------|
|
|
23
|
+
| `packTelegramVoiceWaveform` | function | the 100 loudest absolute samples of 100 equal parts (`0`–`32768`) into the base64 of 63 bytes `sendVoice` takes: 5-bit levels packed little-endian, scaled like Telegram Desktop by 1.8 × the mean peak, never below a floor of 2500, so silence stays zero and a quiet recording stays low |
|
|
24
|
+
| `unpackTelegramVoiceWaveform` | function | the levels of a waveform, `0`–`31`, one per 5 bits: 100 from a packed one, as many as it holds from one Telegram drew |
|
|
25
|
+
| `readTelegramVoiceWaveformSupport` / `TelegramVoiceWaveformSupport` | function / _type_ | from a `getMe` result of any shape: `supported` only when the server declares `supports_voice_waveform` and `voice_waveform_version` 1; `version` as declared, `null` when none (the public Bot API) |
|
|
26
|
+
| `TelegramVoiceWaveformError` / `TelegramVoiceWaveformRefusal` | class / _type_ | `peak-count` / `peak-value` / `malformed` / `empty-pcm` / `truncated-pcm` |
|
|
27
|
+
| `TELEGRAM_VOICE_WAVEFORM_SAMPLES` / `TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL` / `TELEGRAM_VOICE_WAVEFORM_VERSION` | constant | 100 parts, levels up to 31, field version 1 |
|
|
28
|
+
|
|
29
|
+
---
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# stitchkit/telegram — stitchkit docs slice, part 2 of 2
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
|
|
6
|
+
Parts of this slice:
|
|
7
|
+
- `llms/telegram.txt`: Guide: Telegram bots (docs/guide/telegram.md)
|
|
8
|
+
- `llms/telegram.2.txt`: API reference: `stitchkit/telegram` (docs/api/reference.md)
|
|
9
|
+
|
|
10
|
+
Also read:
|
|
11
|
+
- see `llms/telegram-screens.txt` for the Telegram screens guide
|
|
12
|
+
|
|
13
|
+
==============================================================================
|
|
14
|
+
# API reference: `stitchkit/telegram` (docs/api/reference.md)
|
|
15
|
+
==============================================================================
|
|
16
|
+
|
|
17
|
+
## `stitchkit/telegram`
|
|
18
|
+
|
|
19
|
+
Peer-free server-only Telegram platform primitives — the Bot API's own
|
|
20
|
+
protocols and the jobs every bot rewrote around them. Importing this resolves no
|
|
21
|
+
bot library; `stitchkit/application/grammy` remains the lifecycle adapter for an
|
|
22
|
+
injected grammY bot. → ADR 0143, ADR 0201, ADR 0274 — [guide](../guide/telegram.md)
|
|
23
|
+
|
|
24
|
+
| Export | Kind | Summary |
|
|
25
|
+
|--------|------|---------|
|
|
26
|
+
| `verifyTelegramInitData` | function | verify a Mini App `initData` signature against the bot token in constant time, before reading anything out of it |
|
|
27
|
+
| `VerifyTelegramInitDataOptions` | _type_ | raw `initData`, bot token, optional `maxAgeSeconds` bound and injected clock |
|
|
28
|
+
| `TelegramInitDataVerification` | _type_ | `{ valid: true, data }` or a refusal carrying its reason |
|
|
29
|
+
| `TelegramInitData` | _type_ | verified `user`/`receiver` as `TelegramUser`, `authDate`, `ageSeconds`, `queryId`, `startParam`, `chatType`, `chatInstance` and every signed pair in `raw` |
|
|
30
|
+
| `parseTelegramUser` / `TelegramUser` | function / _type_ | Telegram's `snake_case` user — grammY's `ctx.from`, a Bot API `User`, a Mini App `user` — as the one camelCase record initData returns too; `undefined` when it is not a user |
|
|
31
|
+
| `TelegramInitDataRefusal` | _type_ | `missing-hash` / `signature-mismatch` / `malformed` / `expired` — an expired string is not a forged one |
|
|
32
|
+
| `classifyTelegramSendFailure` | function | name a refused Bot API send and separate "retry this send" from "stop addressing this recipient" |
|
|
33
|
+
| `TelegramSendFailure` | _type_ | reason, `status`, Telegram-stated `retryAfterSeconds`, `retryable`, `recipientUnreachable` and which evidence produced the answer |
|
|
34
|
+
| `createTelegramBotTransport` / `TelegramBotTransportOptions` | function / _type_ | a `fetch` for the Bot API senders that connects before it writes, so a failure before the first byte is `TelegramNotDispatchedError`; connection attempt and budget, answer timeout and size, injectable resolver and socket factory — [guide](../guide/telegram.md#a-transport-that-knows-whether-a-request-left) |
|
|
35
|
+
| `TelegramFetch` / `TelegramBotTransportOpen` / `TelegramBotTransportResolve` / `TelegramBotTransportSocket` | _types_ | the `(url, init) => Promise<Response>` the senders take; the transport's socket factory, resolver and the structural socket it needs (a Node `net.Socket` or `tls.TLSSocket` fits) |
|
|
36
|
+
| `TelegramNotDispatchedError` / `TelegramNotDispatchedStage` | class / _type_ | a request that provably never left (`lookup`, `connect` or `request`), so repeating it cannot duplicate a message |
|
|
37
|
+
| `TelegramSendFailureReason` / `TELEGRAM_SEND_FAILURE_REASONS` | _type_ / constant | `blocked-by-user` / `user-deactivated` / `chat-not-found` / `not-started` / `bot-to-bot-disabled` / `rate-limited` / `message-invalid` / `server-error` / `not-dispatched` / `unknown`, and the same as a list; a `Record<TelegramSendFailureReason, …>` over them fails to compile when a reason is added |
|
|
38
|
+
| `telegramOutboundBudget` / `TelegramOutboundBudget` / `TelegramOutboundBudgetConfig` / `TelegramOutboundBudgetStats` / `TelegramOutboundCallOptions` / `TelegramOutboundChatOptions` / `TelegramOutboundLane` | function / _type_ | one token-wide outbound budget: one object per token in the process, strict 24 messages/s by default, weighted albums and multi-message copies, an `interactive` lane granted before `bulk`, `run(method, payload, signal, send, { lane, maxWaitMs })` as the transformer adapter (a 429 on a send pauses its `chat_id` whether `send` throws it or resolves with the Bot API's `{ ok: false, … }` body, and refusals from `tokenPauseChats` chats pause the token), `pause`/`pauseAfter` for 429, `waitUntilResumed` for non-send retries and `stats`; it paces and never retries, and no public value carries the token |
|
|
39
|
+
| `runTelegramBroadcast` | function | a resumable broadcast by `name` under a state `directory`: audience and journal durably recorded, pacing at `ratePerSecond` (25), exact retry delays within the finite declared budget, injected classifier, uncertain send outcomes never replayed, `dryRun`, one fenced runner per name |
|
|
40
|
+
| `TelegramBroadcastConfig` / `TelegramBroadcastSend` / `TelegramBroadcastReport` / `TelegramBroadcastRunOutcome` / `TelegramBroadcastOutcome` / `TelegramBroadcastRecipient` | _type_ | `name`, `directory`, `recipients()`, `send({ recipient, attempt })`, `maxAttempts`, `signal`, `onProgress`; counts `delivered` / `unreachable` / `failed` / `uncertain` / `pending` and `finished` / `stopped` / `halted` / `dry-run` |
|
|
41
|
+
| `TelegramBroadcastFailureSchema` / `TelegramBroadcastFailure` | schema / _type_ | injected `classify` answers retry-after/transient/permanent/ambiguous; exact provider delay is bounded by `maxRetryDelayMs` without shortening, unknown outcome remains uncertain and is never replayed |
|
|
42
|
+
| `telegramBroadcastSender` / `TelegramBroadcastSenderConfig` / `TelegramBroadcastMessage` | function / _type_ | the standard `send`: `sendMessage` with a text or `copyMessage` of a prepared message, through the Bot API |
|
|
43
|
+
| `createTelegramOperatorChannel` | function | the operator chat, apart from the journal: `post(text, topic?)` returns at once and never throws; paced sends into forum topics, 429 honoured, oldest dropped on overflow, `drain(signal)` and `close()` for the way down |
|
|
44
|
+
| `TelegramOperatorChannelConfig` / `TelegramOperatorChannel` / `TelegramOperatorMessage` / `TelegramOperatorDrop` / `TelegramChatId` | _type_ | `chatId`, `topics`, `send`, `maxQueued`, `minIntervalMs`, `maxAttempts`, `onDropped`, `sensitivePatterns` and `sensitiveValues` (a bot token is always masked), `dedupe`; a drop is `overflow` / `refused` / `attempts` / `closed` / `repeated` / `over-budget` with its classification |
|
|
45
|
+
| `createTelegramOperatorDedupe` / `TelegramOperatorDedupeVerdict` | function / _type_ | the channel's dedupe window alone, for a sender with its own bot and retry: `(text, topic?)` → `{ send: true, text }` with the held-back counts, or `{ send: false, reason: 'repeated' \| 'over-budget' }` |
|
|
46
|
+
| `TelegramOperatorDedupe` | _type_ | `windowMs` (10 min): one message per `fingerprint` per window, the next one sent carries `repeatedLine(count)`; `maxPerWindow` (20) across fingerprints, the overflow counted onto the next one sent with `overBudgetLine(count)`; `now` |
|
|
47
|
+
| `telegramOperatorSender` / `TelegramOperatorSenderConfig` | function / _type_ | the standard `send`: `sendMessage` into the chat and topic, plain text unless `parseMode`; with `'HTML'` the markup is cleaned and cut by what it shows, so the channel's cut never leaves a tag open |
|
|
48
|
+
| `createTelegramLocalFiles` | function | files the local Bot API server wrote under `<root>/<token>/`: `resolve(file_path)` and `remove(file_path)` only inside the bot's directory, judged on real paths so a link is judged by where it leads; `check()` for readiness. Recommended root variable: `BOT_API_FILES_ROOT` |
|
|
49
|
+
| `TelegramLocalFilesConfig` / `TelegramLocalFiles` / `TelegramLocalFilesCheck` / `TelegramLocalFileError` / `TelegramLocalFileRefusal` | _type_ / class | `root`, `token`; refusals `root-not-absolute` / `bot-directory-unavailable` / `outside-bot-directory` / `missing` / `not-a-file`, never carrying the path or the token |
|
|
50
|
+
| `readTelegramVoiceWaveform` / `ReadTelegramVoiceWaveformOptions` | function / _type_ | the packed waveform `sendVoice` takes, from a mono 16-bit little-endian PCM side copy of the recording, read in chunks; `signal` stops it between chunks; an empty or cut file is refused with `TelegramVoiceWaveformError` (`stitchkit/telegram/voice`), never named in it — [guide](../guide/telegram.md#voice-waveforms) |
|
|
51
|
+
| `callTelegramBotApi` / `TelegramBotApiCall` / `TelegramBotApiError` | function / _type_ / class | one Bot API method over `fetch`; a refusal keeps `error_code`, `description` and `parameters` for the classifier, and no error names the URL |
|
|
52
|
+
| `TELEGRAM_BOT_TOKEN_PATTERN` / `redactTelegramBotToken` | constant / function | the secret half of a bot token — the bot's id before the colon is not matched; `redact` and every logger on it mask it already, `redactTelegramBotToken(text)` masks every token in a string to `123456:[redacted]` |
|
|
53
|
+
| `claimTelegramWebhook` | function | set the webhook only where it already points here, or by naming the host it is taken from; confirm Telegram holds it; pending updates kept unless `dropPendingUpdates` |
|
|
54
|
+
| `ClaimTelegramWebhookConfig` / `TelegramWebhookConfig` / `TelegramWebhookClaim` | _type_ | `token`, `url`, `secret`, `apiRoot`, `fetch`, `signal`; `takeoverFrom` (a host, or `'none'`), `allowedUpdates`, `maxConnections`, `dropPendingUpdates`; the claim's tagged `url`, `takenFrom`, `pendingUpdates` |
|
|
55
|
+
| `TelegramWebhookClaimError` / `TelegramWebhookRefusal` / `TELEGRAM_WEBHOOK_NONE` | class / _type_ / constant | `owned-elsewhere` / `other-secret` / `not-confirmed` with `ownerHost` — a host, never a path; `'none'` names no webhook |
|
|
56
|
+
| `telegramWebhookUrl` | function | the address with an `owner` tag derived from the secret: equal for one secret, different for another, the path untouched |
|
|
57
|
+
| `checkTelegramWebhook` / `TelegramWebhookState` | function / _type_ | whether the webhook still points here: `owned`, `ownerHost`, `pendingUpdates`, Telegram's `lastError` |
|
|
58
|
+
| `receiveTelegramWebhook` / `ReceiveTelegramWebhookOptions` / `TelegramUpdateAcceptance` | function / _type_ | one webhook `Request`: 403 without the secret (compared in constant time), 405 for another method, 400 for no update, 200 once `accept` recorded it |
|
|
59
|
+
| `createTelegramUpdateIntake` | function | webhook updates recorded before Telegram is answered and handled after: chat order kept, other chats alongside up to `maxConcurrent`, a renewed lease and immutable fence per attempt, a sweep that takes over what a restart or a dead process left, retries, `maxAttempts`, optional recoverable exhaustion delivery, finished updates remembered `retainMs` to refuse repeats; at least once |
|
|
60
|
+
| `TelegramUpdateIntakeConfig` / `TelegramUpdateAttemptIntakeConfig` / `TelegramUpdateIntakeOptions` / `TelegramUpdateIntake` / `TelegramUpdateEnvelope` / `TelegramUpdateFailure` / `TelegramUpdateStoreStep` | _type_ | `store`, unchanged `handle(update)` or attempt-aware `handleAttempt(update, context)` (a grammY `BotError` is unwrapped), shared `retry`, `maxAttempts` (5), `leaseMs` (120 000), `pendingGraceMs` (60 000), `sweepEveryMs` (30 000), `retainMs` (24 h), `maxConcurrent` (32), `onFailure`, durable `handleExhaustion`, `onExhaustionFailure`, `onStoreError`, `now`; `accept(body)`, `start()`, `sweep()`, `idle()`, `close()` |
|
|
61
|
+
| `TelegramUpdateAttemptContext` / `TelegramUpdateAttemptIdentity` / `TelegramUpdateOwnershipLostError` | _type_ / class | immutable `{ updateId, attempt, claimId }` fence plus `ownerLost`; the persisted opaque claim token prevents a stale capability from matching after prune/re-add, while a store check in the consumer's DB transaction fences a domain write |
|
|
62
|
+
| `TelegramUpdateExhaustion` / `TelegramUpdateExhaustionFailure` / `StoredTelegramUpdateExhaustion` / `TelegramUpdateExhaustionQuery` | _type_ | a terminal update/attempt/error retained in the update store until `handleExhaustion` resolves; ordered `{ limit, afterUpdateId? }` pages prevent a failing first batch from starving later rows; delivery failures are observational and leave it due |
|
|
63
|
+
| `TelegramUpdateStore` / `StoredTelegramUpdate` / `TelegramUpdateState` / `TelegramUpdateSettlement` / `TelegramUpdateClaimOptions` / `TelegramUpdateDueQuery` | _type_ | the base store an intake runs on: `add`, `claim`, `renew`, `settle`, `due`, `prune`, each atomic on one record — a claim takes `pending`, a due `failed` or a lapsed `processing`; renew and settle only by the attempt holding it; `due` returns one page and continues strictly after `afterUpdateId` |
|
|
64
|
+
| `TelegramUpdateFencedStore` / `TelegramUpdateDurableStore` | _type_ | reference-store capabilities: `claimOwned` creates and returns the persisted identity, `renewOwned`, `owns(identity, at)` and `settleOwned(identity, settlement)` act only on that exact unexpired claim; `exhaust`, `dueExhaustions`, `acknowledgeExhaustion` keep a final consumer obligation in the same row until exact acknowledgement |
|
|
65
|
+
| `memoryTelegramUpdateStore` | function | the store in this process's memory — tests, or a bot that accepts losing unhandled updates to a restart |
|
|
66
|
+
| `sqliteTelegramUpdateStore` / `SqliteTelegramUpdateStoreConfig` / `TelegramSqliteDatabase` | function / _type_ | the store in SQLite over the handle the application opened — `bun:sqlite` `Database` or `node:sqlite` `DatabaseSync`; `table` (default `telegram_updates`) created when missing |
|
|
67
|
+
| `postgresTelegramUpdateStore` / `PostgresTelegramUpdateStoreConfig` / `TelegramPostgresQuery` | function / _type_ | the store in Postgres over the client the application holds, as one `query(text, parameters)` returning rows — Bun `sql.unsafe`, Prisma `$queryRawUnsafe`, `pg` `pool.query`; each rule one conditional statement; `table`, `createTable` (default `true`) |
|
|
68
|
+
| `postgresTelegramUpdateStoreSchema` | function | the table, idempotent `claim_id` upgrade and index as a statement for a migration, safe to run twice; required before fenced methods when `createTable: false`, while legacy base methods remain compatible with the prior table |
|
|
69
|
+
| `checkTelegramUpdateStore` | function | put any store through every rule, each on a fresh store from `make`, concurrent claims included; resolves with the violations, empty when it keeps them |
|
|
70
|
+
|
|
71
|
+
---
|
package/llms/telegram.txt
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
# stitchkit/telegram — stitchkit docs slice
|
|
1
|
+
# stitchkit/telegram — stitchkit docs slice, part 1 of 2
|
|
2
2
|
|
|
3
3
|
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
4
|
> `llms.txt` in this package.
|
|
5
|
+
> Continues in `llms/telegram.2.txt`.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Parts of this slice:
|
|
8
|
+
- `llms/telegram.txt`: Guide: Telegram bots (docs/guide/telegram.md)
|
|
9
|
+
- `llms/telegram.2.txt`: API reference: `stitchkit/telegram` (docs/api/reference.md)
|
|
7
10
|
|
|
8
11
|
Also read:
|
|
9
12
|
- see `llms/telegram-screens.txt` for the Telegram screens guide
|
|
@@ -30,6 +33,7 @@ way: [ADR 0201](../decisions/0201-a-telegram-bot-is-assembled-from-primitives.md
|
|
|
30
33
|
| the operator's chat: product events, apart from the journal | `createTelegramOperatorChannel` |
|
|
31
34
|
| a broadcast that survives crashes, deploys and Ctrl-C | `runTelegramBroadcast` |
|
|
32
35
|
| a file the local Bot API server wrote to disk | `createTelegramLocalFiles` |
|
|
36
|
+
| the waveform of a voice message: packed for `sendVoice`, drawn in a page | `readTelegramVoiceWaveform`, `stitchkit/telegram/voice` — [below](#voice-waveforms) |
|
|
33
37
|
| why a send was refused | `classifyTelegramSendFailure` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
|
|
34
38
|
| Mini App `initData` | `verifyTelegramInitData` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
|
|
35
39
|
| one Bot API call without a bot library | `callTelegramBotApi` |
|
|
@@ -621,61 +625,49 @@ answers whether the directory is there to read and delete from; a resource that
|
|
|
621
625
|
throws on `{ ready: false }` in `start` keeps the bot from answering before it
|
|
622
626
|
can read its media.
|
|
623
627
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
628
|
+
## Voice waveforms
|
|
629
|
+
|
|
630
|
+
A voice message carries its waveform: the bars under the play button, 100
|
|
631
|
+
levels of 5 bits. The public Bot API takes no waveform in `sendVoice`, so
|
|
632
|
+
Telegram draws its own. A local Bot API server that takes one says so in
|
|
633
|
+
`getMe` with `supports_voice_waveform: true` and `voice_waveform_version: 1`.
|
|
634
|
+
|
|
635
|
+
The waveform is computed from a decoded side copy of the recording. The file
|
|
636
|
+
being sent stays byte for byte what it was:
|
|
637
|
+
|
|
638
|
+
```ts
|
|
639
|
+
import { readTelegramVoiceWaveform } from 'stitchkit/telegram'
|
|
640
|
+
import { readTelegramVoiceWaveformSupport } from 'stitchkit/telegram/voice'
|
|
641
|
+
|
|
642
|
+
// ffmpeg -nostdin -i voice.ogg -map 0:a:0 -ac 1 -ar 8000 -f s16le wave.pcm
|
|
643
|
+
const waveform = await readTelegramVoiceWaveform(pcmPath, { signal })
|
|
644
|
+
|
|
645
|
+
if (!readTelegramVoiceWaveformSupport(await bot.api.getMe()).supported) {
|
|
646
|
+
throw new Error('this Bot API server draws its own waveform')
|
|
647
|
+
}
|
|
648
|
+
const options = { duration, waveform } satisfies Parameters<typeof bot.api.sendVoice>[2] & {
|
|
649
|
+
waveform: string
|
|
650
|
+
}
|
|
651
|
+
await bot.api.sendVoice(chatId, new InputFile(oggPath), options)
|
|
652
|
+
```
|
|
627
653
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
| `TelegramSendFailureReason` / `TELEGRAM_SEND_FAILURE_REASONS` | _type_ / constant | `blocked-by-user` / `user-deactivated` / `chat-not-found` / `not-started` / `bot-to-bot-disabled` / `rate-limited` / `message-invalid` / `server-error` / `not-dispatched` / `unknown`, and the same as a list; a `Record<TelegramSendFailureReason, …>` over them fails to compile when a reason is added |
|
|
649
|
-
| `telegramOutboundBudget` / `TelegramOutboundBudget` / `TelegramOutboundBudgetConfig` / `TelegramOutboundBudgetStats` / `TelegramOutboundCallOptions` / `TelegramOutboundChatOptions` / `TelegramOutboundLane` | function / _type_ | one token-wide outbound budget: one object per token in the process, strict 24 messages/s by default, weighted albums and multi-message copies, an `interactive` lane granted before `bulk`, `run(method, payload, signal, send, { lane, maxWaitMs })` as the transformer adapter (a 429 on a send pauses its `chat_id` whether `send` throws it or resolves with the Bot API's `{ ok: false, … }` body, and refusals from `tokenPauseChats` chats pause the token), `pause`/`pauseAfter` for 429, `waitUntilResumed` for non-send retries and `stats`; it paces and never retries, and no public value carries the token |
|
|
650
|
-
| `runTelegramBroadcast` | function | a resumable broadcast by `name` under a state `directory`: audience and journal durably recorded, pacing at `ratePerSecond` (25), exact retry delays within the finite declared budget, injected classifier, uncertain send outcomes never replayed, `dryRun`, one fenced runner per name |
|
|
651
|
-
| `TelegramBroadcastConfig` / `TelegramBroadcastSend` / `TelegramBroadcastReport` / `TelegramBroadcastRunOutcome` / `TelegramBroadcastOutcome` / `TelegramBroadcastRecipient` | _type_ | `name`, `directory`, `recipients()`, `send({ recipient, attempt })`, `maxAttempts`, `signal`, `onProgress`; counts `delivered` / `unreachable` / `failed` / `uncertain` / `pending` and `finished` / `stopped` / `halted` / `dry-run` |
|
|
652
|
-
| `TelegramBroadcastFailureSchema` / `TelegramBroadcastFailure` | schema / _type_ | injected `classify` answers retry-after/transient/permanent/ambiguous; exact provider delay is bounded by `maxRetryDelayMs` without shortening, unknown outcome remains uncertain and is never replayed |
|
|
653
|
-
| `telegramBroadcastSender` / `TelegramBroadcastSenderConfig` / `TelegramBroadcastMessage` | function / _type_ | the standard `send`: `sendMessage` with a text or `copyMessage` of a prepared message, through the Bot API |
|
|
654
|
-
| `createTelegramOperatorChannel` | function | the operator chat, apart from the journal: `post(text, topic?)` returns at once and never throws; paced sends into forum topics, 429 honoured, oldest dropped on overflow, `drain(signal)` and `close()` for the way down |
|
|
655
|
-
| `TelegramOperatorChannelConfig` / `TelegramOperatorChannel` / `TelegramOperatorMessage` / `TelegramOperatorDrop` / `TelegramChatId` | _type_ | `chatId`, `topics`, `send`, `maxQueued`, `minIntervalMs`, `maxAttempts`, `onDropped`, `sensitivePatterns` and `sensitiveValues` (a bot token is always masked), `dedupe`; a drop is `overflow` / `refused` / `attempts` / `closed` / `repeated` / `over-budget` with its classification |
|
|
656
|
-
| `createTelegramOperatorDedupe` / `TelegramOperatorDedupeVerdict` | function / _type_ | the channel's dedupe window alone, for a sender with its own bot and retry: `(text, topic?)` → `{ send: true, text }` with the held-back counts, or `{ send: false, reason: 'repeated' \| 'over-budget' }` |
|
|
657
|
-
| `TelegramOperatorDedupe` | _type_ | `windowMs` (10 min): one message per `fingerprint` per window, the next one sent carries `repeatedLine(count)`; `maxPerWindow` (20) across fingerprints, the overflow counted onto the next one sent with `overBudgetLine(count)`; `now` |
|
|
658
|
-
| `telegramOperatorSender` / `TelegramOperatorSenderConfig` | function / _type_ | the standard `send`: `sendMessage` into the chat and topic, plain text unless `parseMode`; with `'HTML'` the markup is cleaned and cut by what it shows, so the channel's cut never leaves a tag open |
|
|
659
|
-
| `createTelegramLocalFiles` | function | files the local Bot API server wrote under `<root>/<token>/`: `resolve(file_path)` and `remove(file_path)` only inside the bot's directory, judged on real paths so a link is judged by where it leads; `check()` for readiness. Recommended root variable: `BOT_API_FILES_ROOT` |
|
|
660
|
-
| `TelegramLocalFilesConfig` / `TelegramLocalFiles` / `TelegramLocalFilesCheck` / `TelegramLocalFileError` / `TelegramLocalFileRefusal` | _type_ / class | `root`, `token`; refusals `root-not-absolute` / `bot-directory-unavailable` / `outside-bot-directory` / `missing` / `not-a-file`, never carrying the path or the token |
|
|
661
|
-
| `callTelegramBotApi` / `TelegramBotApiCall` / `TelegramBotApiError` | function / _type_ / class | one Bot API method over `fetch`; a refusal keeps `error_code`, `description` and `parameters` for the classifier, and no error names the URL |
|
|
662
|
-
| `TELEGRAM_BOT_TOKEN_PATTERN` / `redactTelegramBotToken` | constant / function | the secret half of a bot token — the bot's id before the colon is not matched; `redact` and every logger on it mask it already, `redactTelegramBotToken(text)` masks every token in a string to `123456:[redacted]` |
|
|
663
|
-
| `claimTelegramWebhook` | function | set the webhook only where it already points here, or by naming the host it is taken from; confirm Telegram holds it; pending updates kept unless `dropPendingUpdates` |
|
|
664
|
-
| `ClaimTelegramWebhookConfig` / `TelegramWebhookConfig` / `TelegramWebhookClaim` | _type_ | `token`, `url`, `secret`, `apiRoot`, `fetch`, `signal`; `takeoverFrom` (a host, or `'none'`), `allowedUpdates`, `maxConnections`, `dropPendingUpdates`; the claim's tagged `url`, `takenFrom`, `pendingUpdates` |
|
|
665
|
-
| `TelegramWebhookClaimError` / `TelegramWebhookRefusal` / `TELEGRAM_WEBHOOK_NONE` | class / _type_ / constant | `owned-elsewhere` / `other-secret` / `not-confirmed` with `ownerHost` — a host, never a path; `'none'` names no webhook |
|
|
666
|
-
| `telegramWebhookUrl` | function | the address with an `owner` tag derived from the secret: equal for one secret, different for another, the path untouched |
|
|
667
|
-
| `checkTelegramWebhook` / `TelegramWebhookState` | function / _type_ | whether the webhook still points here: `owned`, `ownerHost`, `pendingUpdates`, Telegram's `lastError` |
|
|
668
|
-
| `receiveTelegramWebhook` / `ReceiveTelegramWebhookOptions` / `TelegramUpdateAcceptance` | function / _type_ | one webhook `Request`: 403 without the secret (compared in constant time), 405 for another method, 400 for no update, 200 once `accept` recorded it |
|
|
669
|
-
| `createTelegramUpdateIntake` | function | webhook updates recorded before Telegram is answered and handled after: chat order kept, other chats alongside up to `maxConcurrent`, a renewed lease and immutable fence per attempt, a sweep that takes over what a restart or a dead process left, retries, `maxAttempts`, optional recoverable exhaustion delivery, finished updates remembered `retainMs` to refuse repeats; at least once |
|
|
670
|
-
| `TelegramUpdateIntakeConfig` / `TelegramUpdateAttemptIntakeConfig` / `TelegramUpdateIntakeOptions` / `TelegramUpdateIntake` / `TelegramUpdateEnvelope` / `TelegramUpdateFailure` / `TelegramUpdateStoreStep` | _type_ | `store`, unchanged `handle(update)` or attempt-aware `handleAttempt(update, context)` (a grammY `BotError` is unwrapped), shared `retry`, `maxAttempts` (5), `leaseMs` (120 000), `pendingGraceMs` (60 000), `sweepEveryMs` (30 000), `retainMs` (24 h), `maxConcurrent` (32), `onFailure`, durable `handleExhaustion`, `onExhaustionFailure`, `onStoreError`, `now`; `accept(body)`, `start()`, `sweep()`, `idle()`, `close()` |
|
|
671
|
-
| `TelegramUpdateAttemptContext` / `TelegramUpdateAttemptIdentity` / `TelegramUpdateOwnershipLostError` | _type_ / class | immutable `{ updateId, attempt, claimId }` fence plus `ownerLost`; the persisted opaque claim token prevents a stale capability from matching after prune/re-add, while a store check in the consumer's DB transaction fences a domain write |
|
|
672
|
-
| `TelegramUpdateExhaustion` / `TelegramUpdateExhaustionFailure` / `StoredTelegramUpdateExhaustion` / `TelegramUpdateExhaustionQuery` | _type_ | a terminal update/attempt/error retained in the update store until `handleExhaustion` resolves; ordered `{ limit, afterUpdateId? }` pages prevent a failing first batch from starving later rows; delivery failures are observational and leave it due |
|
|
673
|
-
| `TelegramUpdateStore` / `StoredTelegramUpdate` / `TelegramUpdateState` / `TelegramUpdateSettlement` / `TelegramUpdateClaimOptions` / `TelegramUpdateDueQuery` | _type_ | the base store an intake runs on: `add`, `claim`, `renew`, `settle`, `due`, `prune`, each atomic on one record — a claim takes `pending`, a due `failed` or a lapsed `processing`; renew and settle only by the attempt holding it; `due` returns one page and continues strictly after `afterUpdateId` |
|
|
674
|
-
| `TelegramUpdateFencedStore` / `TelegramUpdateDurableStore` | _type_ | reference-store capabilities: `claimOwned` creates and returns the persisted identity, `renewOwned`, `owns(identity, at)` and `settleOwned(identity, settlement)` act only on that exact unexpired claim; `exhaust`, `dueExhaustions`, `acknowledgeExhaustion` keep a final consumer obligation in the same row until exact acknowledgement |
|
|
675
|
-
| `memoryTelegramUpdateStore` | function | the store in this process's memory — tests, or a bot that accepts losing unhandled updates to a restart |
|
|
676
|
-
| `sqliteTelegramUpdateStore` / `SqliteTelegramUpdateStoreConfig` / `TelegramSqliteDatabase` | function / _type_ | the store in SQLite over the handle the application opened — `bun:sqlite` `Database` or `node:sqlite` `DatabaseSync`; `table` (default `telegram_updates`) created when missing |
|
|
677
|
-
| `postgresTelegramUpdateStore` / `PostgresTelegramUpdateStoreConfig` / `TelegramPostgresQuery` | function / _type_ | the store in Postgres over the client the application holds, as one `query(text, parameters)` returning rows — Bun `sql.unsafe`, Prisma `$queryRawUnsafe`, `pg` `pool.query`; each rule one conditional statement; `table`, `createTable` (default `true`) |
|
|
678
|
-
| `postgresTelegramUpdateStoreSchema` | function | the table, idempotent `claim_id` upgrade and index as a statement for a migration, safe to run twice; required before fenced methods when `createTable: false`, while legacy base methods remain compatible with the prior table |
|
|
679
|
-
| `checkTelegramUpdateStore` | function | put any store through every rule, each on a fresh store from `make`, concurrent claims included; resolves with the violations, empty when it keeps them |
|
|
680
|
-
|
|
681
|
-
---
|
|
654
|
+
The levels follow Telegram Desktop. Each of the 100 parts keeps its loudest
|
|
655
|
+
sample, and the scale is 1.8 times the mean of those peaks, never below 2500
|
|
656
|
+
of 16-bit PCM. A loud passage does not flatten the quiet ones to nothing, and
|
|
657
|
+
a quiet recording is not stretched to look loud. Silence stays at zero. The
|
|
658
|
+
PCM is read in chunks, so a long recording is never held in memory; at 8 kHz,
|
|
659
|
+
six hours of audio is under 350 MB of PCM. A file with no sample or one cut
|
|
660
|
+
inside a sample is refused with `TelegramVoiceWaveformError` (`empty-pcm`,
|
|
661
|
+
`truncated-pcm`), and the waveform is never made up.
|
|
662
|
+
|
|
663
|
+
Whether a server that does not declare support still gets the voice is the
|
|
664
|
+
bot's decision. It can refuse to send, or send without the field and let
|
|
665
|
+
Telegram draw the bars. `readTelegramVoiceWaveformSupport` reads any answer:
|
|
666
|
+
`supported` means version 1, and `version` is what the server declared, or
|
|
667
|
+
`null` when it declared nothing.
|
|
668
|
+
|
|
669
|
+
`stitchkit/telegram/voice` has no peer and touches no file, so a page drawing
|
|
670
|
+
the bars reads the same format: `unpackTelegramVoiceWaveform(waveform)` gives
|
|
671
|
+
the levels `0`–`31`, 100 for a waveform packed here and as many as it holds
|
|
672
|
+
for one Telegram drew itself. `packTelegramVoiceWaveform(peaks)` packs 100
|
|
673
|
+
peaks already found by other means.
|
package/llms-full.txt
CHANGED
|
@@ -69,9 +69,10 @@ own, recorded as an ADR.
|
|
|
69
69
|
| `stitchkit/process/owner-loss` | bundled server entry (Bun, POSIX) | evolving | narrow bootstrap that keeps the process runner lazy while carrying its owner-loss guard in a single-file bundle |
|
|
70
70
|
| `stitchkit/files/packaging` | build time (Bun or Node) | evolving | installed native asset graph, integrity, Bun packaging plugin and the artifact loader check; a client bundled into one self-contained, hashed and verified file; no runtime install policy |
|
|
71
71
|
| `stitchkit/files` | server (Bun or Node) | stable | peer-free managed local-file boundary |
|
|
72
|
-
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and per-chat 429 pauses, resumable broadcasts, the operator channel with dedupe, a Bot API transport that separates a request that never left from an unknown outcome, local Bot API files, webhook ownership and durable webhook update intake |
|
|
72
|
+
| `stitchkit/telegram` | server (Bun or Node) | evolving | peer-free Telegram platform primitives — Mini App `initData` verification, send-failure classification, one outbound budget per bot token with weighted albums and per-chat 429 pauses, resumable broadcasts, the operator channel with dedupe, a Bot API transport that separates a request that never left from an unknown outcome, local Bot API files, the waveform of a voice message read from its PCM, webhook ownership and durable webhook update intake |
|
|
73
73
|
| `stitchkit/telegram/grammy` | server (Bun or Node) | evolving | the token's outbound budget as one grammY client transformer — a 429 that comes back as a response pauses its chat, and a cancelled wait is a request that never left |
|
|
74
74
|
| `stitchkit/telegram/html` | browser and server | evolving | Telegram's HTML as a tree — clean any markup to what Telegram accepts, cut long text into valid parts by what the reader sees, check markup before it is sent |
|
|
75
|
+
| `stitchkit/telegram/voice` | browser and server | evolving | the waveform of a voice message as one format — packed for `sendVoice` the way Telegram Desktop scales it, unpacked to draw it, a `getMe` read of whether the server takes it |
|
|
75
76
|
| `stitchkit/telegram/screens` | server (Bun or Node) | evolving | a bot's menus as declared screens over grammY — typed paths, actions and input, message reconciliation, state in any `StorageAdapter`, a test chat |
|
|
76
77
|
| `stitchkit/tracking` | browser **and** server | evolving | visitor-tracking mechanics — `createTrackingClient`, the tab-shared outbox, the page-leave beacon, attribution, the contract factory; no event vocabulary, no React |
|
|
77
78
|
| `stitchkit/tracking/contract` | browser **and** server | evolving | the wire shapes — the contract factory, event and visit schemas, the performance sample and its trust threshold; brings `zod` |
|
|
@@ -228,6 +229,7 @@ map — feature → packages:
|
|
|
228
229
|
| grammY lifecycle adapters (`stitchkit/application/grammy`) | `grammy` |
|
|
229
230
|
| Telegram platform primitives (`stitchkit/telegram`) | — (peer-free) |
|
|
230
231
|
| Telegram message markup (`stitchkit/telegram/html`) | — (peer-free) |
|
|
232
|
+
| Telegram voice waveforms (`stitchkit/telegram/voice`) | — (peer-free) |
|
|
231
233
|
| Telegram grammY client transformer (`stitchkit/telegram/grammy`) | `grammy` (types only; the bot brings it) |
|
|
232
234
|
| Telegram screens (`stitchkit/telegram/screens`) | `grammy` (types only; the bot brings it) |
|
|
233
235
|
| OpenTelemetry gauges (`stitchkit/application/opentelemetry`) | `@opentelemetry/api` |
|
|
@@ -16521,6 +16523,7 @@ way: [ADR 0201](../decisions/0201-a-telegram-bot-is-assembled-from-primitives.md
|
|
|
16521
16523
|
| the operator's chat: product events, apart from the journal | `createTelegramOperatorChannel` |
|
|
16522
16524
|
| a broadcast that survives crashes, deploys and Ctrl-C | `runTelegramBroadcast` |
|
|
16523
16525
|
| a file the local Bot API server wrote to disk | `createTelegramLocalFiles` |
|
|
16526
|
+
| the waveform of a voice message: packed for `sendVoice`, drawn in a page | `readTelegramVoiceWaveform`, `stitchkit/telegram/voice` — [below](#voice-waveforms) |
|
|
16524
16527
|
| why a send was refused | `classifyTelegramSendFailure` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
|
|
16525
16528
|
| Mini App `initData` | `verifyTelegramInitData` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
|
|
16526
16529
|
| one Bot API call without a bot library | `callTelegramBotApi` |
|
|
@@ -17112,6 +17115,53 @@ answers whether the directory is there to read and delete from; a resource that
|
|
|
17112
17115
|
throws on `{ ready: false }` in `start` keeps the bot from answering before it
|
|
17113
17116
|
can read its media.
|
|
17114
17117
|
|
|
17118
|
+
## Voice waveforms
|
|
17119
|
+
|
|
17120
|
+
A voice message carries its waveform: the bars under the play button, 100
|
|
17121
|
+
levels of 5 bits. The public Bot API takes no waveform in `sendVoice`, so
|
|
17122
|
+
Telegram draws its own. A local Bot API server that takes one says so in
|
|
17123
|
+
`getMe` with `supports_voice_waveform: true` and `voice_waveform_version: 1`.
|
|
17124
|
+
|
|
17125
|
+
The waveform is computed from a decoded side copy of the recording. The file
|
|
17126
|
+
being sent stays byte for byte what it was:
|
|
17127
|
+
|
|
17128
|
+
```ts
|
|
17129
|
+
import { readTelegramVoiceWaveform } from 'stitchkit/telegram'
|
|
17130
|
+
import { readTelegramVoiceWaveformSupport } from 'stitchkit/telegram/voice'
|
|
17131
|
+
|
|
17132
|
+
// ffmpeg -nostdin -i voice.ogg -map 0:a:0 -ac 1 -ar 8000 -f s16le wave.pcm
|
|
17133
|
+
const waveform = await readTelegramVoiceWaveform(pcmPath, { signal })
|
|
17134
|
+
|
|
17135
|
+
if (!readTelegramVoiceWaveformSupport(await bot.api.getMe()).supported) {
|
|
17136
|
+
throw new Error('this Bot API server draws its own waveform')
|
|
17137
|
+
}
|
|
17138
|
+
const options = { duration, waveform } satisfies Parameters<typeof bot.api.sendVoice>[2] & {
|
|
17139
|
+
waveform: string
|
|
17140
|
+
}
|
|
17141
|
+
await bot.api.sendVoice(chatId, new InputFile(oggPath), options)
|
|
17142
|
+
```
|
|
17143
|
+
|
|
17144
|
+
The levels follow Telegram Desktop. Each of the 100 parts keeps its loudest
|
|
17145
|
+
sample, and the scale is 1.8 times the mean of those peaks, never below 2500
|
|
17146
|
+
of 16-bit PCM. A loud passage does not flatten the quiet ones to nothing, and
|
|
17147
|
+
a quiet recording is not stretched to look loud. Silence stays at zero. The
|
|
17148
|
+
PCM is read in chunks, so a long recording is never held in memory; at 8 kHz,
|
|
17149
|
+
six hours of audio is under 350 MB of PCM. A file with no sample or one cut
|
|
17150
|
+
inside a sample is refused with `TelegramVoiceWaveformError` (`empty-pcm`,
|
|
17151
|
+
`truncated-pcm`), and the waveform is never made up.
|
|
17152
|
+
|
|
17153
|
+
Whether a server that does not declare support still gets the voice is the
|
|
17154
|
+
bot's decision. It can refuse to send, or send without the field and let
|
|
17155
|
+
Telegram draw the bars. `readTelegramVoiceWaveformSupport` reads any answer:
|
|
17156
|
+
`supported` means version 1, and `version` is what the server declared, or
|
|
17157
|
+
`null` when it declared nothing.
|
|
17158
|
+
|
|
17159
|
+
`stitchkit/telegram/voice` has no peer and touches no file, so a page drawing
|
|
17160
|
+
the bars reads the same format: `unpackTelegramVoiceWaveform(waveform)` gives
|
|
17161
|
+
the levels `0`–`31`, 100 for a waveform packed here and as many as it holds
|
|
17162
|
+
for one Telegram drew itself. `packTelegramVoiceWaveform(peaks)` packs 100
|
|
17163
|
+
peaks already found by other means.
|
|
17164
|
+
|
|
17115
17165
|
|
|
17116
17166
|
==============================================================================
|
|
17117
17167
|
# Guide: Telegram screens (docs/guide/telegram-screens.md)
|
|
@@ -25169,6 +25219,7 @@ injected grammY bot. → ADR 0143, ADR 0201, ADR 0274 — [guide](../guide/teleg
|
|
|
25169
25219
|
| `telegramOperatorSender` / `TelegramOperatorSenderConfig` | function / _type_ | the standard `send`: `sendMessage` into the chat and topic, plain text unless `parseMode`; with `'HTML'` the markup is cleaned and cut by what it shows, so the channel's cut never leaves a tag open |
|
|
25170
25220
|
| `createTelegramLocalFiles` | function | files the local Bot API server wrote under `<root>/<token>/`: `resolve(file_path)` and `remove(file_path)` only inside the bot's directory, judged on real paths so a link is judged by where it leads; `check()` for readiness. Recommended root variable: `BOT_API_FILES_ROOT` |
|
|
25171
25221
|
| `TelegramLocalFilesConfig` / `TelegramLocalFiles` / `TelegramLocalFilesCheck` / `TelegramLocalFileError` / `TelegramLocalFileRefusal` | _type_ / class | `root`, `token`; refusals `root-not-absolute` / `bot-directory-unavailable` / `outside-bot-directory` / `missing` / `not-a-file`, never carrying the path or the token |
|
|
25222
|
+
| `readTelegramVoiceWaveform` / `ReadTelegramVoiceWaveformOptions` | function / _type_ | the packed waveform `sendVoice` takes, from a mono 16-bit little-endian PCM side copy of the recording, read in chunks; `signal` stops it between chunks; an empty or cut file is refused with `TelegramVoiceWaveformError` (`stitchkit/telegram/voice`), never named in it — [guide](../guide/telegram.md#voice-waveforms) |
|
|
25172
25223
|
| `callTelegramBotApi` / `TelegramBotApiCall` / `TelegramBotApiError` | function / _type_ / class | one Bot API method over `fetch`; a refusal keeps `error_code`, `description` and `parameters` for the classifier, and no error names the URL |
|
|
25173
25224
|
| `TELEGRAM_BOT_TOKEN_PATTERN` / `redactTelegramBotToken` | constant / function | the secret half of a bot token — the bot's id before the colon is not matched; `redact` and every logger on it mask it already, `redactTelegramBotToken(text)` masks every token in a string to `123456:[redacted]` |
|
|
25174
25225
|
| `claimTelegramWebhook` | function | set the webhook only where it already points here, or by naming the host it is taken from; confirm Telegram holds it; pending updates kept unless `dropPendingUpdates` |
|
|
@@ -25225,6 +25276,22 @@ parse serves a server send and a browser preview. → ADR 0213 —
|
|
|
25225
25276
|
|
|
25226
25277
|
---
|
|
25227
25278
|
|
|
25279
|
+
## `stitchkit/telegram/voice`
|
|
25280
|
+
|
|
25281
|
+
The waveform of a voice message — the bars under its play button — as one format for the server
|
|
25282
|
+
that packs it and the page that draws it. No peer, no file, no network. →
|
|
25283
|
+
[guide](../guide/telegram.md#voice-waveforms)
|
|
25284
|
+
|
|
25285
|
+
| Export | Kind | Summary |
|
|
25286
|
+
|--------|------|---------|
|
|
25287
|
+
| `packTelegramVoiceWaveform` | function | the 100 loudest absolute samples of 100 equal parts (`0`–`32768`) into the base64 of 63 bytes `sendVoice` takes: 5-bit levels packed little-endian, scaled like Telegram Desktop by 1.8 × the mean peak, never below a floor of 2500, so silence stays zero and a quiet recording stays low |
|
|
25288
|
+
| `unpackTelegramVoiceWaveform` | function | the levels of a waveform, `0`–`31`, one per 5 bits: 100 from a packed one, as many as it holds from one Telegram drew |
|
|
25289
|
+
| `readTelegramVoiceWaveformSupport` / `TelegramVoiceWaveformSupport` | function / _type_ | from a `getMe` result of any shape: `supported` only when the server declares `supports_voice_waveform` and `voice_waveform_version` 1; `version` as declared, `null` when none (the public Bot API) |
|
|
25290
|
+
| `TelegramVoiceWaveformError` / `TelegramVoiceWaveformRefusal` | class / _type_ | `peak-count` / `peak-value` / `malformed` / `empty-pcm` / `truncated-pcm` |
|
|
25291
|
+
| `TELEGRAM_VOICE_WAVEFORM_SAMPLES` / `TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL` / `TELEGRAM_VOICE_WAVEFORM_VERSION` | constant | 100 parts, levels up to 31, field version 1 |
|
|
25292
|
+
|
|
25293
|
+
---
|
|
25294
|
+
|
|
25228
25295
|
## `stitchkit/telegram/screens`
|
|
25229
25296
|
|
|
25230
25297
|
A bot's menus as declared screens over grammY: a screen says what the chat
|
package/llms.txt
CHANGED
|
@@ -9,7 +9,7 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
|
|
|
9
9
|
Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
|
|
10
10
|
|
|
11
11
|
## Entrypoint slices
|
|
12
|
-
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt)
|
|
12
|
+
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 45.1 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 30.9 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.1 KB
|
|
13
13
|
- **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
|
|
14
14
|
- **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
|
|
15
15
|
- **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
|
|
@@ -45,9 +45,10 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
45
45
|
- **stitchkit/testing**: [llms/testing.txt](llms/testing.txt) 33.7 KB
|
|
46
46
|
- **stitchkit/agent-runtime/sandbox**: [llms/agent-runtime-sandbox.txt](llms/agent-runtime-sandbox.txt) 8.3 KB
|
|
47
47
|
- **stitchkit/files**: [llms/files.txt](llms/files.txt) 5.7 KB
|
|
48
|
-
- **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt)
|
|
48
|
+
- **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 34.3 KB → [llms/telegram.2.txt](llms/telegram.2.txt) 13.8 KB
|
|
49
49
|
- **stitchkit/telegram/grammy**: [llms/telegram-grammy.txt](llms/telegram-grammy.txt) 1.2 KB
|
|
50
50
|
- **stitchkit/telegram/html**: [llms/telegram-html.txt](llms/telegram-html.txt) 2.7 KB
|
|
51
|
+
- **stitchkit/telegram/voice**: [llms/telegram-voice.txt](llms/telegram-voice.txt) 1.9 KB
|
|
51
52
|
- **stitchkit/telegram/screens**: [llms/telegram-screens.txt](llms/telegram-screens.txt) 21.2 KB
|
|
52
53
|
- **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt) 22.3 KB
|
|
53
54
|
- **stitchkit/release**: [llms/release.txt](llms/release.txt) 8.9 KB
|
|
@@ -105,7 +106,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
105
106
|
- [React Query policy](https://github.com/max-listov/stitchkit/blob/master/docs/guide/react.md): request-local SSR clients, a browser singleton and ApiError retry rules
|
|
106
107
|
- [Keyboard layers and list zones](https://github.com/max-listov/stitchkit/blob/master/docs/guide/keyboard.md): stitchkit/react/keyboard — which part of a screen gets a key: ordered layers, one Escape per level, list zones that move real focus
|
|
107
108
|
- [Voice](https://github.com/max-listov/stitchkit/blob/master/docs/guide/voice.md): stitchkit/voice — sentences cut while a reply streams, the text a voice reads, a speech queue that synthesises ahead and stops on interruption
|
|
108
|
-
- [Telegram bots](https://github.com/max-listov/stitchkit/blob/master/docs/guide/telegram.md): stitchkit/telegram — the journal, the operator channel, resumable broadcasts, local Bot API files, webhook ownership and durable update intake, message markup (stitchkit/telegram/html); the bot as application resources
|
|
109
|
+
- [Telegram bots](https://github.com/max-listov/stitchkit/blob/master/docs/guide/telegram.md): stitchkit/telegram — the journal, the operator channel, resumable broadcasts, local Bot API files, webhook ownership and durable update intake, message markup (stitchkit/telegram/html), voice waveforms (stitchkit/telegram/voice); the bot as application resources
|
|
109
110
|
- [Telegram screens](https://github.com/max-listov/stitchkit/blob/master/docs/guide/telegram-screens.md): stitchkit/telegram/screens — a bot menu as declared screens: typed paths, actions and input, messages reconciled in place, state in a StorageAdapter, a test chat
|
|
110
111
|
- [GeoIP](https://github.com/max-listov/stitchkit/blob/master/docs/guide/geo.md): stitchkit/geo — a server-only managed reader, three observable states and last-known-good generation reloads
|
|
111
112
|
- [XLSX](https://github.com/max-listov/stitchkit/blob/master/docs/guide/xlsx.md): stitchkit/xlsx — a workbook from rows and typed columns, with no dependency and no formula in the file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.123.
|
|
3
|
+
"version": "0.123.3",
|
|
4
4
|
"description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -213,6 +213,10 @@
|
|
|
213
213
|
"types": "./dist/entrypoints/telegram/html.d.ts",
|
|
214
214
|
"import": "./dist/entrypoints/telegram/html.js"
|
|
215
215
|
},
|
|
216
|
+
"./telegram/voice": {
|
|
217
|
+
"types": "./dist/entrypoints/telegram/voice.d.ts",
|
|
218
|
+
"import": "./dist/entrypoints/telegram/voice.js"
|
|
219
|
+
},
|
|
216
220
|
"./telegram/screens": {
|
|
217
221
|
"types": "./dist/entrypoints/telegram/screens.d.ts",
|
|
218
222
|
"import": "./dist/entrypoints/telegram/screens.js"
|