stitchkit 0.123.2 → 0.123.4

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/agent-runtime/sandbox-broker.d.ts.map +1 -1
  3. package/dist/entrypoints/agent-runtime/sandbox.js +16 -4
  4. package/dist/entrypoints/files.d.ts +1 -0
  5. package/dist/entrypoints/files.d.ts.map +1 -1
  6. package/dist/entrypoints/files.js +4 -0
  7. package/dist/entrypoints/server.js +33 -20
  8. package/dist/entrypoints/telegram/voice.d.ts +2 -0
  9. package/dist/entrypoints/telegram/voice.d.ts.map +1 -0
  10. package/dist/entrypoints/telegram/voice.js +18 -0
  11. package/dist/entrypoints/telegram.d.ts +1 -0
  12. package/dist/entrypoints/telegram.d.ts.map +1 -1
  13. package/dist/entrypoints/telegram.js +43 -0
  14. package/dist/entrypoints/tracking/performance.js +3 -3
  15. package/dist/index-0jdempdr.js +69 -0
  16. package/dist/index-drcjjhy1.js +40 -0
  17. package/dist/internal/unix-socket.d.ts +28 -0
  18. package/dist/internal/unix-socket.d.ts.map +1 -0
  19. package/dist/server/bun.d.ts +5 -4
  20. package/dist/server/bun.d.ts.map +1 -1
  21. package/dist/telegram/voice-waveform-pcm.d.ts +21 -0
  22. package/dist/telegram/voice-waveform-pcm.d.ts.map +1 -0
  23. package/dist/telegram/voice-waveform.d.ts +67 -0
  24. package/dist/telegram/voice-waveform.d.ts.map +1 -0
  25. package/llms/files.txt +1 -0
  26. package/llms/process.2.txt +133 -0
  27. package/llms/process.txt +37 -133
  28. package/llms/server.5.txt +1 -1
  29. package/llms/server.txt +8 -5
  30. package/llms/stitchkit.txt +3 -1
  31. package/llms/telegram-voice.txt +29 -0
  32. package/llms/telegram.2.txt +71 -0
  33. package/llms/telegram.txt +51 -59
  34. package/llms-full.txt +115 -7
  35. package/llms.txt +7 -6
  36. package/package.json +5 -1
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
- Contains: Guide: Telegram bots (docs/guide/telegram.md) · API reference: `stitchkit/telegram` (docs/api/reference.md)
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
- # API reference: `stitchkit/telegram` (docs/api/reference.md)
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
- ## `stitchkit/telegram`
629
-
630
- Peer-free server-only Telegram platform primitives — the Bot API's own
631
- protocols and the jobs every bot rewrote around them. Importing this resolves no
632
- bot library; `stitchkit/application/grammy` remains the lifecycle adapter for an
633
- injected grammY bot. → ADR 0143, ADR 0201, ADR 0274 — [guide](../guide/telegram.md)
634
-
635
- | Export | Kind | Summary |
636
- |--------|------|---------|
637
- | `verifyTelegramInitData` | function | verify a Mini App `initData` signature against the bot token in constant time, before reading anything out of it |
638
- | `VerifyTelegramInitDataOptions` | _type_ | raw `initData`, bot token, optional `maxAgeSeconds` bound and injected clock |
639
- | `TelegramInitDataVerification` | _type_ | `{ valid: true, data }` or a refusal carrying its reason |
640
- | `TelegramInitData` | _type_ | verified `user`/`receiver` as `TelegramUser`, `authDate`, `ageSeconds`, `queryId`, `startParam`, `chatType`, `chatInstance` and every signed pair in `raw` |
641
- | `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 |
642
- | `TelegramInitDataRefusal` | _type_ | `missing-hash` / `signature-mismatch` / `malformed` / `expired` — an expired string is not a forged one |
643
- | `classifyTelegramSendFailure` | function | name a refused Bot API send and separate "retry this send" from "stop addressing this recipient" |
644
- | `TelegramSendFailure` | _type_ | reason, `status`, Telegram-stated `retryAfterSeconds`, `retryable`, `recipientUnreachable` and which evidence produced the answer |
645
- | `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) |
646
- | `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) |
647
- | `TelegramNotDispatchedError` / `TelegramNotDispatchedStage` | class / _type_ | a request that provably never left (`lookup`, `connect` or `request`), so repeating it cannot duplicate a message |
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` |
@@ -1648,11 +1650,14 @@ bind error of the loser). A regular file at the path, another user's socket, or
1648
1650
  a live listener each fail with a specific error instead of being unlinked. A
1649
1651
  clean `server.shutdown()` removes the file.
1650
1652
 
1651
- `mode` tightens the socket file permissions after listen. Bun creates the file
1652
- `0755` under a normal umask — since `connect(2)` requires *write* permission
1653
- that is already owner-only in practice — but when access to the socket **is**
1654
- the credential, set `mode: 0o600` explicitly and let the filesystem be the
1655
- policy. The Socket.IO lifecycle (`socket`) cannot mount on a unix listener
1653
+ `mode` is the socket's permission from birth: the socket is bound under a umask
1654
+ narrowed to exactly that mode, so no other process ever sees it wider — a
1655
+ `chmod` after listen leaves the umask rights on disk until it runs
1656
+ ([`bindUnixSocket`](native-io.md#a-unix-socket-private-from-birth)). Without
1657
+ `mode` Bun creates the file `0755` under a normal umask — since `connect(2)`
1658
+ requires *write* permission that is already owner-only in practice — but when
1659
+ access to the socket **is** the credential, set `mode: 0o600` explicitly and let
1660
+ the filesystem be the policy. The Socket.IO lifecycle (`socket`) cannot mount on a unix listener
1656
1661
  (socket.io clients dial TCP only — construction error); Bun's own WebSocket
1657
1662
  client cannot dial a unix path either. Unix listeners are Bun-only: `srvx`
1658
1663
  resolves a numeric port unconditionally, so `stitchkit/node` does not offer
@@ -9091,6 +9096,43 @@ filesystems or survival of a power loss; the disk state is whatever the filesyst
9091
9096
  `createManagedFileBoundary.write(..., { durable: true })` uses the same publish owner and parent sync;
9092
9097
  its create stays a create, and `replace: true` allows replacement explicitly.
9093
9098
 
9099
+ ## A unix socket private from birth
9100
+
9101
+ When access to a socket is the credential, the socket must never exist with wider rights. `bind(2)`
9102
+ accepts no mode — a socket file takes its rights from the process umask — so `chmod` after `listen`
9103
+ leaves the umask rights (`0755` under `022`) on disk until it runs, and a process watching the path
9104
+ sees them even when `chmodSync` is the very next line. `bindUnixSocket` binds under a umask narrowed
9105
+ to exactly `mode` for one synchronous call and restores it before any other JavaScript runs:
9106
+
9107
+ ```ts
9108
+ import { createServer } from 'node:http'
9109
+ import { bindUnixSocket } from 'stitchkit/files'
9110
+
9111
+ // Bun
9112
+ const server = bindUnixSocket({ path: '/run/app/door.sock', mode: 0o600 }, (path) =>
9113
+ Bun.serve({ unix: path, fetch: () => new Response('ok') }),
9114
+ )
9115
+
9116
+ // Node (and Bun's node:http) — the bind happens inside `listen`; its error arrives on 'error'
9117
+ const door = createServer(handler)
9118
+ bindUnixSocket({ path: '/run/app/door.sock', mode: 0o600 }, (path) => door.listen(path))
9119
+ ```
9120
+
9121
+ `createServer({ unix: { path, mode } })` from `stitchkit/server` binds through the same function.
9122
+
9123
+ - The path must be free: whatever stands there after the call was created by it. Remove a stale
9124
+ socket first (`createServer` probes and reclaims one); an existing file is refused before anything
9125
+ binds.
9126
+ - After the call the path must be a socket with exactly `mode`, or the call throws. A bind that
9127
+ failed (Node and Bun report a `listen` error asynchronously), one that binds later than the call,
9128
+ and a directory whose default ACL — not the umask — decides the rights all end here; a socket born
9129
+ with other rights is removed first, so no client reaches it by path. The listener your `bind`
9130
+ started is yours to stop.
9131
+ - The umask is process-wide. A file another thread creates during the call is born at most as
9132
+ permissive as the socket — narrower, never wider. Work that needs the normal umask, a child
9133
+ process above all, runs before the call, not inside `bind`. A Node worker thread cannot set the
9134
+ umask and gets that error.
9135
+
9094
9136
  ## Strict reads
9095
9137
 
9096
9138
  ```ts
@@ -16521,6 +16563,7 @@ way: [ADR 0201](../decisions/0201-a-telegram-bot-is-assembled-from-primitives.md
16521
16563
  | the operator's chat: product events, apart from the journal | `createTelegramOperatorChannel` |
16522
16564
  | a broadcast that survives crashes, deploys and Ctrl-C | `runTelegramBroadcast` |
16523
16565
  | a file the local Bot API server wrote to disk | `createTelegramLocalFiles` |
16566
+ | the waveform of a voice message: packed for `sendVoice`, drawn in a page | `readTelegramVoiceWaveform`, `stitchkit/telegram/voice` — [below](#voice-waveforms) |
16524
16567
  | why a send was refused | `classifyTelegramSendFailure` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
16525
16568
  | Mini App `initData` | `verifyTelegramInitData` — [auth and errors](auth-and-errors.md#telegram-mini-apps) |
16526
16569
  | one Bot API call without a bot library | `callTelegramBotApi` |
@@ -17112,6 +17155,53 @@ answers whether the directory is there to read and delete from; a resource that
17112
17155
  throws on `{ ready: false }` in `start` keeps the bot from answering before it
17113
17156
  can read its media.
17114
17157
 
17158
+ ## Voice waveforms
17159
+
17160
+ A voice message carries its waveform: the bars under the play button, 100
17161
+ levels of 5 bits. The public Bot API takes no waveform in `sendVoice`, so
17162
+ Telegram draws its own. A local Bot API server that takes one says so in
17163
+ `getMe` with `supports_voice_waveform: true` and `voice_waveform_version: 1`.
17164
+
17165
+ The waveform is computed from a decoded side copy of the recording. The file
17166
+ being sent stays byte for byte what it was:
17167
+
17168
+ ```ts
17169
+ import { readTelegramVoiceWaveform } from 'stitchkit/telegram'
17170
+ import { readTelegramVoiceWaveformSupport } from 'stitchkit/telegram/voice'
17171
+
17172
+ // ffmpeg -nostdin -i voice.ogg -map 0:a:0 -ac 1 -ar 8000 -f s16le wave.pcm
17173
+ const waveform = await readTelegramVoiceWaveform(pcmPath, { signal })
17174
+
17175
+ if (!readTelegramVoiceWaveformSupport(await bot.api.getMe()).supported) {
17176
+ throw new Error('this Bot API server draws its own waveform')
17177
+ }
17178
+ const options = { duration, waveform } satisfies Parameters<typeof bot.api.sendVoice>[2] & {
17179
+ waveform: string
17180
+ }
17181
+ await bot.api.sendVoice(chatId, new InputFile(oggPath), options)
17182
+ ```
17183
+
17184
+ The levels follow Telegram Desktop. Each of the 100 parts keeps its loudest
17185
+ sample, and the scale is 1.8 times the mean of those peaks, never below 2500
17186
+ of 16-bit PCM. A loud passage does not flatten the quiet ones to nothing, and
17187
+ a quiet recording is not stretched to look loud. Silence stays at zero. The
17188
+ PCM is read in chunks, so a long recording is never held in memory; at 8 kHz,
17189
+ six hours of audio is under 350 MB of PCM. A file with no sample or one cut
17190
+ inside a sample is refused with `TelegramVoiceWaveformError` (`empty-pcm`,
17191
+ `truncated-pcm`), and the waveform is never made up.
17192
+
17193
+ Whether a server that does not declare support still gets the voice is the
17194
+ bot's decision. It can refuse to send, or send without the field and let
17195
+ Telegram draw the bars. `readTelegramVoiceWaveformSupport` reads any answer:
17196
+ `supported` means version 1, and `version` is what the server declared, or
17197
+ `null` when it declared nothing.
17198
+
17199
+ `stitchkit/telegram/voice` has no peer and touches no file, so a page drawing
17200
+ the bars reads the same format: `unpackTelegramVoiceWaveform(waveform)` gives
17201
+ the levels `0`–`31`, 100 for a waveform packed here and as many as it holds
17202
+ for one Telegram drew itself. `packTelegramVoiceWaveform(peaks)` packs 100
17203
+ peaks already found by other means.
17204
+
17115
17205
 
17116
17206
  ==============================================================================
17117
17207
  # Guide: Telegram screens (docs/guide/telegram-screens.md)
@@ -23461,7 +23551,7 @@ Also re-exports the error helpers from `stitchkit/contract`.
23461
23551
  | `BunServerConfig` | _type_ | config for `createServer` (Bun); `unix` listens on a unix domain socket (mutually exclusive with `port`/`hostname`) — [details](../guide/server.md#local-daemon-over-a-unix-socket) |
23462
23552
  | `defineRequestIngress` / `RequestIngress` / `RequestIngressSource` | function / _type_ | a typed key the code that builds a `Request` attaches a value to (`attach(request, value)`) and an endpoint, `authorize`, `beforeHandle` or `onError` reads from its `ctx` (`from(ctx)`); a header, `clone()` and `new Request(request)` carry nothing, a second `attach` is refused, and `ctx.req` is the very request the handler received — [guide](../guide/server.md#request-attributes-from-the-ingress) |
23463
23553
  | `ProxyOriginConfig` | _type_ | explicit real-peer trust for Bun `createServer({ proxyOrigin })`; strict external-scheme normalization before composition — [details](../guide/server.md#external-origin-behind-a-trusted-proxy) |
23464
- | `UnixListenConfig` | _type_ | unix listener — a socket path, or `{ path, mode }` to tighten the file mode after listen |
23554
+ | `UnixListenConfig` | _type_ | unix listener — a socket path bound under the process umask, or `{ path, mode }` for a socket born with exactly `mode` (`bindUnixSocket`) |
23465
23555
  | `BunServerHandle` | _type_ | managed Bun handle (`url`, `port`, `runtime`, `status`, `shutdown`) |
23466
23556
  | `ManagedServerHandle` | _type_ | shared lifecycle shape generic over the runtime escape hatch |
23467
23557
  | `ShutdownOptionsSchema` / `ShutdownOptions` | schema / _type_ | HTTP/application grace, a separate WebSocket close-handshake bound, bounded forced-completion timeout, retry hint and optional external abort signal |
@@ -25123,6 +25213,7 @@ available from `stitchkit/contract`.
25123
25213
  | `sweepAtomicStaging` / `SweepAtomicStagingOptions` | function / _type_ | remove abandoned staging files from one `directory`: only regular files matching `isAtomicStagingName` and older than the required `olderThanMs`, never following a symlink or entering a subdirectory; stops on `signal`; returns the removed names, `[]` for a `directory` that does not exist |
25124
25214
  | `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time and nullable kernel process identity); waits up to `timeoutMs` (default 10 s) and stops on `signal`; a dead owner on this machine is taken over, a live, slow or foreign one never is; a lock recorded by this very process is held only while one of its descriptors is open on it, so the lock an earlier image of the same PID left (`bun --watch` restarts in place) is taken over at once; the lock is published with its owner already recorded (temporary file plus hard link), so a stalled holder is never displaced; a legacy empty lock file is taken by age only when `ownerlessGraceMs` is a number (default `null`: never; an abandoned empty reclaim guard is taken after 5 000 ms unless a value is set); exact `mode` is independent of umask; shared readers need a common group and traversable directories |
25125
25215
  | `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
25216
+ | `bindUnixSocket` / `UnixSocketBinding` | function / _type_ | bind a unix socket that exists only with `mode` (`0o000`–`0o777`), never wider first: the umask is narrowed for the one synchronous `bind(path)` (`Bun.serve({ unix })`, `node:http`/`node:net` `listen(path)`) and restored before any other JavaScript; the path must be free beforehand and a socket with exactly `mode` afterwards, else it refuses (a socket born with other rights is removed) — [guide](../guide/native-io.md#a-unix-socket-private-from-birth) |
25126
25217
  | `createChunkSpool` | function | the server half of a chunked upload: parts on disk under `owner` + client-minted `uploadId`, each with a size+sha256 receipt; idempotent `open` and `put`, the first writer of a part wins across processes, `assemble` in order once every part is in, `sweep` of untouched uploads — [guide](../guide/client.md#chunked-uploads) |
25127
25218
  | `ChunkSpool` / `ChunkSpoolConfig` / `ChunkSpoolKey` / `ChunkSpoolOpen` / `ChunkSpoolPart` / `ChunkSpoolAssembly` | _type_ | the spool, its directory, part size, file limit, meta schema and age; an upload's key; its declaration; one part; the assembled parts with a concatenating `stream()` |
25128
25219
  | `ChunkSpoolErrorCode` | _type_ | the `AppError` codes a spool refuses with, each with its 4xx status: `UPLOAD_INVALID`, `UPLOAD_TOO_LARGE`, `UPLOAD_NOT_FOUND`, `UPLOAD_CONFLICT`, `UPLOAD_CHUNK_OUT_OF_RANGE`, `UPLOAD_CHUNK_SIZE`, `UPLOAD_INCOMPLETE` |
@@ -25169,6 +25260,7 @@ injected grammY bot. → ADR 0143, ADR 0201, ADR 0274 — [guide](../guide/teleg
25169
25260
  | `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
25261
  | `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
25262
  | `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 |
25263
+ | `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
25264
  | `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
25265
  | `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
25266
  | `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 +25317,22 @@ parse serves a server send and a browser preview. → ADR 0213 —
25225
25317
 
25226
25318
  ---
25227
25319
 
25320
+ ## `stitchkit/telegram/voice`
25321
+
25322
+ The waveform of a voice message — the bars under its play button — as one format for the server
25323
+ that packs it and the page that draws it. No peer, no file, no network. →
25324
+ [guide](../guide/telegram.md#voice-waveforms)
25325
+
25326
+ | Export | Kind | Summary |
25327
+ |--------|------|---------|
25328
+ | `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 |
25329
+ | `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 |
25330
+ | `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) |
25331
+ | `TelegramVoiceWaveformError` / `TelegramVoiceWaveformRefusal` | class / _type_ | `peak-count` / `peak-value` / `malformed` / `empty-pcm` / `truncated-pcm` |
25332
+ | `TELEGRAM_VOICE_WAVEFORM_SAMPLES` / `TELEGRAM_VOICE_WAVEFORM_MAX_LEVEL` / `TELEGRAM_VOICE_WAVEFORM_VERSION` | constant | 100 parts, levels up to 31, field version 1 |
25333
+
25334
+ ---
25335
+
25228
25336
  ## `stitchkit/telegram/screens`
25229
25337
 
25230
25338
  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) 44.8 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 30.9 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.1 KB
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
@@ -26,7 +26,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
26
26
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
27
27
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 34.1 KB
28
28
  - **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 13.2 KB
29
- - **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.2 KB → [llms/server.2.txt](llms/server.2.txt) 23.1 KB → [llms/server.3.txt](llms/server.3.txt) 47.0 KB → [llms/server.4.txt](llms/server.4.txt) 38.7 KB → [llms/server.5.txt](llms/server.5.txt) 23.7 KB
29
+ - **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.4 KB → [llms/server.2.txt](llms/server.2.txt) 23.1 KB → [llms/server.3.txt](llms/server.3.txt) 47.0 KB → [llms/server.4.txt](llms/server.4.txt) 38.7 KB → [llms/server.5.txt](llms/server.5.txt) 23.8 KB
30
30
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 46.9 KB
31
31
  - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 5.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 44.1 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 42.5 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 45.2 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 11.8 KB
32
32
  - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
@@ -44,10 +44,11 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
44
44
  - **stitchkit/application/schemas**: [llms/application-schemas.txt](llms/application-schemas.txt) 1.8 KB
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
- - **stitchkit/files**: [llms/files.txt](llms/files.txt) 5.7 KB
48
- - **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 44.8 KB
47
+ - **stitchkit/files**: [llms/files.txt](llms/files.txt) 6.2 KB
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
@@ -64,7 +65,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
64
65
  - **stitchkit/node**: [llms/node.txt](llms/node.txt) 3.1 KB
65
66
  - **stitchkit/agent-runtime/react**: [llms/agent-runtime-react.txt](llms/agent-runtime-react.txt) 1.0 KB
66
67
  - **stitchkit/agent-runtime/realtime**: [llms/agent-runtime-realtime.txt](llms/agent-runtime-realtime.txt) 2.6 KB
67
- - **stitchkit/process**: [llms/process.txt](llms/process.txt) 46.8 KB → [llms/process.2.txt](llms/process.2.txt) 9.1 KB
68
+ - **stitchkit/process**: [llms/process.txt](llms/process.txt) 40.7 KB → [llms/process.2.txt](llms/process.2.txt) 17.2 KB
68
69
  - **stitchkit/process/owner-loss**: [llms/process-owner-loss.txt](llms/process-owner-loss.txt) 0.9 KB
69
70
  - **stitchkit/files/packaging**: [llms/files-packaging.txt](llms/files-packaging.txt) 4.3 KB
70
71
  - **stitchkit/http**: [llms/http.txt](llms/http.txt) 0.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.2",
3
+ "version": "0.123.4",
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"