Repository navigation
fix(think): telegramMessenger nativeStreaming option (#2397) - #2414
Conversation
… Think-verified webhooks (#2397) Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: b9badc1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| describe("telegram messenger adapter config (#2397)", () => { | ||
| it("forwards nativeStreaming to the adapter", () => { | ||
| telegramMessenger({ | ||
| nativeStreaming: true, | ||
| secretToken: "secret", | ||
| token: "token", | ||
| userName: "fake_bot" | ||
| }); | ||
| expect(lastAdapterConfig()).toMatchObject({ nativeStreaming: true }); |
There was a problem hiding this comment.
There was a problem hiding this comment.
Intentional. Bumping the lockfile to chat/@chat-adapter/telegram 4.38+ changes the private Chat.prototype.drainQueue signature that Think's recovery drain (#2312) relies on (see #2397), so that belongs in a separate dependency-update PR. What Think controls here is the config it passes the adapter, which these tests cover; draft streaming and webhook validation are the adapter's own behaviour.
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Fixes #2397.
The problem
@chat-adapter/telegram4.38 made native draft streaming opt-in throughTelegramAdapterConfig.nativeStreaming(defaultfalse).telegramMessengerbuilds the adapter itself and didn't forward the option, so with 4.38+ private-chat replies always posted a placeholder and edited it, with no way to turn drafts back on.The same adapter versions throw at construction in webhook mode when there's no
secretToken, unlessallowUnverifiedWebhooksis set. SotelegramMessenger({ verifyWebhook: false })and customverifyWebhookfunctions without a secret threwsecretToken is required in webhook mode.What changed
TelegramMessengerOptions.nativeStreaming?: boolean, forwarded tocreateTelegramAdapter.allowUnverifiedWebhooks: !options.secretTokenis passed to the adapter. Think already refuses a webhook with neither a secret token nor an explicitverifyWebhook, so this only applies when Think verifies the webhook itself or the caller opted out.^4.29.0adapter range. Older adapters ignore the extra fields. There's no dependency bump, so thechat4.41drainQueuesignature change mentioned in the issue doesn't come into play here.docs/think/messengers.mddocuments the option.Based on the reference implementation in harryy2510#1. Thanks @harryy2510.
Tests
telegram-messenger.test.tschecks thatnativeStreamingis forwarded (and left unset by default), and thatallowUnverifiedWebhooksisfalsewith a secret token andtruewithverifyWebhook: false. The full Think suite passes andpnpm run checkis clean.