Repository navigation
Telegram as a second chat network; image generation with GPT Image 2; prompt and Signal fixes - #37
Merged
Merged
Conversation
When the account's owner deletes one of the bot's messages for everyone from a phone or desktop linked to the account, or edits it, the message now leaves the bot's history, as the app on that device would drop it. - Network.Send returns the timestamps of the messages it sent: each signal-cli send now waits for its result (up to a minute), which also logs a recipient it wasn't delivered to as the send returns. - A reply's history entry, and a delivered post's, keep those timestamps as refs under a sender no network ID can be, so the core needn't know the account's ID. The reply is added once sent. - signal-cli's sync message for the account's own delete or edit (syncMessage.sentMessage remoteDelete / editMessage) reaches the core as bot.Deleted with Bot set, and Forget drops the entry. An edit drops it too, so history never holds what the chat no longer shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A value chart of a price showed the price only; change mode shows % but loses the price. An axis's new show_change (value mode only) labels each line's last value with its % change from its first point, so a price chart carries both: beside the end dot on a single series (on a line of its own, as beside the value it would run off the image), after the value in each label on a chart of several. The bot computes it, and shows none from a start of 0 or less. The model decides, as only it knows whether a % change of the numbers means anything: the option's description says to set it for prices, indexes, revenue and populations, always for a stock or fund price, and never for temperatures, rates or values already in %. The summary the model reads carries the same number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Off by default, show_change never appeared: asked "chart NVDA 1m", the model drew a value chart and left the option unset, as models do with optional settings. It is now on unless the model sets it false, which its description says to do where a % change means nothing (temperatures, rates, values already in %); a series starting at 0 or below still shows none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Models read a tool's description more reliably than a nested property's, so the line that value charts show the period's % change, and to set show_change false for temperatures, rates or values already in %, is now in make_chart's description too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
CHARTS (default on) set to no registers no chart tools, for anyone who doesn't want charts or wishes to use their own charts MCP server; it logs "charts: off (CHARTS)" at startup. The nocharts build tag still leaves them out of the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
- A single series' subtitle is drawn in the line's colour (red or
green), led by its change over the chart with an arrow, "▼ 15.2%",
when there is one to show (change mode included); the caption becomes
the title with that change in place of the subtitle.
- An axis sent as a string holding its JSON ("y_axis": "{\"mode\": …}")
was taken for an axis title and drawn under the subtitle as raw JSON;
only a plain string is a title now, and the JSON is decoded as the
axis.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Web search runs on the provider's side, so it never gets a tool line, and a chart drawn from searched pages looked the same in the journal as one drawn from an MCP data tool. Each request's debug line now ends "websearch used: yes" when the reply cites a page (a url_citation annotation) or its usage counts a web search request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
…test - The core may not name a feature (TestNoFeatureWordsInTheCore), and never names a server tool, so the request line now reads "server tools used: yes" (web search being the server tool that runs today): a url_citation annotation, or any use counted in server_tool_use. - TestDisappearingHistory checked history the moment the reply was seen, but history is added once Send returns, since the linked-device delete change; it now waits for it, as it was flaky under -race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
- A reply over 2,000 characters was split into several messages, as if 2,000 were Signal's limit. signal-cli 0.14.10 already sends what is past 2,000 bytes as a long-text attachment, as Signal's apps do, shown as one message with Read more (ManagerImpl.applyMessage). So a reply is now always one message, still capped at 8,000 characters; the system prompt's Signal line now says to put the answer first, as a long message shows only its start until Read more. Goldens re-pinned. - Since history was added only after Send returned, and Send now waits for signal-cli, a group message arriving meanwhile landed before the turn in history. History is added before the send again, with a placeholder ref that chats.Store.Retag swaps for the sent timestamps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
network.go holds a registry each network_<name>.go fills in from init, behind its build tag, and newNetwork picks the network whose setting is set (TELEGRAM_BOT_TOKEN or SIGNALCLI_SOCKET), else Signal. Both set, or one the build leaves out, is a startup error saying what to do. Signal is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
The Markdown converter, styled text, @name finding and UTF-16 offsets move from internal/signal to kit, as Telegram will use them too. New: a Link a network can show under its own text (Signal keeps writing "text (url)"), style runs in UTF-16 units, and Split, which cuts at the last line break or space past halfway (Telegram has no long-text attachment). Signal behaves as before; its tests pass unchanged apart from names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
internal/telegram talks to the Bot API with the standard library: getUpdates long polling, entities for Markdown, photos and albums, reactions, typing, file downloads, Delivered, Groups and events. The token is scrubbed from every error. TELEGRAM_BOT_TOKEN chooses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
scenario_telegram_test.go runs the real bot against a fake Bot API and model: a group mention with context and entities, DMs and an edit, a photo, a chart, a reaction and /intro. README, PRIVACY, TECHNICAL, CONTRIBUTING and the architecture diagram cover the second network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Leave a group added by someone not in TELEGRAM_DM_USER_IDS; send the text when pictures fail and captions without refused entities; confirm handled updates on shutdown; forum topics as chats of their own; follow a group to its supergroup ID; retry a rate-limited send once; react's text fallback only for REACTION_INVALID; cap the client's maps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Leaving on the add event alone failed open: one failed leaveChat, a restricted re-add, or a lost update let a stranger's group in. The bot now checks membership of a TELEGRAM_DM_USER_IDS user before answering (cached; checked in the background when a group is first seen) and leaves, retrying, where there is none. Also: is_member for restricted statuses; group changes reach each forum topic; membership checks follow a migrated group; sent messages are noted at the new ID; a failed last poll is confirmed on shutdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
…te no A cached yes outlived a listed user leaving; with no one listed the check was skipped, so the bot neither left nor dropped chatter; and events in a quiet group were dropped once the cached yes expired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A make_image tool, offered when a message asks for a drawing, art, a diagram, a logo or the like (imagegen). The core keeps the key: a new Host.GenerateImage port posts to OpenRouter's /images, with data_collection deny, and adds the cost to the reply whose tool asked, so DAILY_BUDGET counts it. IMAGE_MODEL (default openai/gpt-image-2, or off) and IMAGE_QUALITY (default medium). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Keep pictures a tool made when the model's next request fails; more picture and diagram words (photo, meme, avatar, banner, flowchart, org chart, mind map, visualise); report a 403 moderation refusal as one; the chart tools say diagrams aren't theirs; make_image says one picture a call, at most 4, and that it can't edit a sent picture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
signal-cli gives a quote only a small thumbnail, and keeps no copy of what the bot sent, so the model saw its own charts and pictures too small to read. The adapter now keeps the pictures it sent, in memory, up to a day and 32 MB, and serves them for a quote; a delete from a linked device drops them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
…ctures Two chats' sends can share a timestamp, so a kept picture is looked up in the quoting chat alone. Over 32 MB, the oldest of the bot's pictures go, not other people's attachment records, which hold no bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
make_image takes a kind. For a technical one (diagram, cutaway, schematic, infographic, labelled or educational picture) the model lists the facts it must get right before writing the prompt, and the image model gets a brief that puts accuracy first, those facts as must-haves, and rules for exact, legible labels. An artistic prompt is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
Offer the image tool on cutaway, cross-section, schematic, exploded view and blueprint; the technical brief keeps a style the user asked for; the text rules keep a requested title or caption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A message that opened with news and asked for a diagram got a lone emoji, sent as a reaction. A lone emoji, with no tool used, for a message whose words matched a tool group's keywords is asked again once, told the message asks for something; the prompt also says a request never gets an emoji alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
History kept only 400 characters of a picture's prompt, so "add the other planets" redrew a to-scale diagram without its scale. A technical picture's note now keeps its kind, up to 1,200 characters of prompt and its requirements, and the tool tells the model to start a change from that note, keeping every requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
It "corrected" a user about Voyager 1 from what it learned in training. The system prompt now ends, before the intro, with today's date in the bot's time zone (late, so the prefix stays cached all day), and the built-in prompt says its knowledge ends with its training. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A to-scale diagram drew Earth and the Sun twice: as separate points and again as one "Earth / Sun". The brief now says to draw each thing once, with things too close to tell apart sharing one mark and label, and the text rules that each label appears once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Telegram
A native Telegram Bot API adapter (
internal/telegram), standard library only, long polling (no webhook or public address needed).TELEGRAM_BOT_TOKENset → Telegram, else Signal; both set is a startup error.-tags nosignal/-tags notelegramleave one out; both tags fail to build (network_none.go). CI tests each tag set.TELEGRAM_DM_USER_IDS. In groups: @mentions, text mentions, replies to the bot,/commandand/command@bot, and only while a listed user is a member of the group. Anyone can add a bot to their own group, so the bot checks withgetChatMember(cached), checks again when someone leaves, and leaves groups where no listed user is.text_linkwith custom link text, andtext_mention), with offsets in UTF-16. Replies split at 4096. Charts go as photos or albums with a caption. If Telegram refuses the entities, the text goes plain, and a failed photo send still sends the text. A 429 is retried after itsretry_after. A group upgraded to a supergroup is followed to its new ID.group/topic). Handled updates are confirmed on shutdown.internal/kit/mdstyle(UTF-16 runs, links,Split,FindAt). Signal's behaviour is unchanged./setjoingroups), PRIVACY (not end-to-end encrypted, deletes never reported, group rules), TECHNICAL (Bot API usage), CONFIGURATION, CONTRIBUTING build tags, and an updateddocs/architecture.svg.Images
A
make_imagetool (internal/features/imagegen) makes pictures with GPT Image 2 (openai/gpt-image-2) through OpenRouter's/api/v1/imagesendpoint, the only place OpenRouter serves that model.kind. Fortechnical(diagram, cutaway, schematic, infographic, labelled or educational) it lists the facts the picture must get right. The image model then gets a brief that puts accuracy first and keeps any requested style, the facts as must-haves, and rules for text: exact labels, each once, nothing invented. Anartisticprompt is unchanged.Host.GenerateImage, keeps the API key in the core and sendsdata_collection: deny. The picture's cost is added to the reply's, soDAILY_BUDGETcounts it. If the model's next request fails, the picture is sent alone rather than lost.IMAGE_MODEL(defaultopenai/gpt-image-2, oroff) andIMAGE_QUALITY(mediumby default). Only on OpenRouter. It makes new pictures only; editing a sent picture would be a follow-up.Prompt and Signal fixes
Also on this branch (earlier work in the same session)
CHARTS=noturns the built-in charts off; an axis sent as JSON text is handled.Testing
go vetandgo test -race ./...with no tags,-tags nosignal,-tags notelegramand-tags nocharts; the no-network build fails as intended.🤖 Generated with Claude Code
https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN