Skip to content

TB1: the bot on Workers - #2

Merged
ruehowl merged 1 commit into
mainfrom
tb/1-the-bot-on-workers
Oct 28, 2026
Merged

ruehowl merged 1 commit into
mainfrom
tb/1-the-bot-on-workers

Conversation

@ruehowl

@ruehowl ruehowl commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

ChatGPT-Telegram-Workers v1.10.7 (0d152e5, MIT) as one Cloudflare Worker built in this workspace (TB-2).

The libraries keep their code and layout under packages/ — types, i18n, telegram, plugins, ai, config, agent, web, core — renamed to the @bot/* scope, each built by tsc -b as upstream (the admin page by Vite into its HTML string module), their tests beside them in workerd, linted by upstream's oxlint. The Node/Vercel/Docker server and the mock/browser test packages are not ported (Workers only).

apps/bot is upstream's Workers entry plus what the port adds:

  • the product's name and repository on its pages (<title>, heading, source and issue links; the docs link and the credit stay upstream's);
  • GET /health — the KV namespace read through DATABASE, the environment, whether a token is connected;
  • POST /init/bind — upstream's webhook bind, for a caller holding the bot token.

The wrangler template binds DATABASE from the cloudflare-kv wiring document plus the AI binding; the committed wrangler.jsonc is its fixture render. Build: wrangler's dry run plus upstream's bundle guard — 239 KB (55 KB gzipped), dependency-free ESM.

Workers AI is the keyless default: a fresh configuration carries a chat and an image provider on the AI binding, so a new bot answers with no vendor key; English is the default language. Three upstream tests asserted the empty default and now assert this one.

The component (cloudflare-worker-turbo): TELEGRAM_TOKEN, ADMIN_ID, ADMIN_PASSWORD, TELEGRAM_SECRET_TOKEN are optional Orun secrets the composition's secrets-live step pushes to the Worker after a deploy; the smoke first runs scripts/bind-webhook.mjs (the post-deploy binding — a named no-op with no token), then reads /health. tests/bot runs every library's tests plus the port's own; change.inputs re-plans both components when a library changes.

Checked locally: pnpm typecheck, pnpm lint, pnpm test (215 library tests + 14 port tests) and pnpm build green; wrangler dev --local serves /health, the branded page and /rpc, and refuses /init/bind without the token; orun plan and orun catalog validate (0 errors) pass; component docs generated.

🤖 Generated with Claude Code

https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn

ChatGPT-Telegram-Workers v1.10.7 (0d152e5, MIT) as one Cloudflare Worker
built in this workspace.

The upstream libraries keep their code and layout under packages/ —
types, i18n, telegram, plugins, ai, config, agent, web, core — renamed to the
@bot/* scope, each built by tsc -b as upstream (the admin page by Vite into
its HTML string module), their tests beside them in workerd, linted by
upstream's oxlint. The Node/Vercel/Docker server and the mock and browser
test packages are not ported: the product runs on Workers only.

apps/bot is upstream's Workers entry plus what the port adds: the product's
name and repository on its pages (the <title>, the heading, the source and
issue links; the documentation link and the credit stay upstream's),
GET /health (the KV namespace read through DATABASE, the environment,
whether a token is connected), and POST /init/bind, which runs upstream's
webhook bind when the caller holds the bot token. The wrangler template
binds DATABASE from the cloudflare-kv wiring document and the AI binding;
the committed wrangler.jsonc is its fixture render. The build is wrangler's
dry run plus upstream's bundle guard: 239 KB, dependency-free ESM.

Workers AI is the keyless default: a fresh configuration carries one chat
and one image provider on the AI binding, so a new bot answers before its
owner has any vendor key; English is the default language. Three upstream
tests asserted the empty default and now assert this one.

The component runs on cloudflare-worker-turbo: the bot token, the admin id,
the admin password and the webhook secret are optional Orun secrets the
composition's secrets-live step pushes to the Worker after a deploy, and
the smoke first runs scripts/bind-webhook.mjs (the post-deploy binding, a
named no-op with no token), then reads /health. tests/bot runs every
library's tests and the port's own (health, the routes, the bind's
authentication and its Telegram calls, the defaults); change.inputs
re-plans both components when a library changes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
@ruehowl
ruehowl merged commit 5716305 into main Oct 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants