Exponentiation, modulo, HTTP API for chats, per-chat webhooks #2
Notifications
Due Date
No due date set.
Depends on
#3 Calculator: exponentiation and modulo
sneak/simplexcalc
#4 HTTP API: server, credential, and the list of chats
sneak/simplexcalc
#5 HTTP API: a chat's recent messages, and sending a message
sneak/simplexcalc
#6 HTTP API: register, list and remove webhooks, kept across restarts
sneak/simplexcalc
#7 Webhooks: post each new incoming message
sneak/simplexcalc
Reference: sneak/simplexcalc#2
Reference in New Issue
Block a user
sneak's order, 08:11 UTC 2026-09-28, verbatim:
Definition of done:
curlexample.make checkis green, and every unit is reviewed and merged tonext. ThenexttomainPR is open, mergeable and assigned to sneak.simplexcalccontainer runs the new code on the samesimplexcalc-datavolume, so the address does not change. Its API is reachable from this host. sneak is told the API address and where to find the credential.Facts for the repo-manager:
internal/calcparses withgo/parser. In Go,^is XOR at the precedence of+, and**does not parse, so exponentiation needs a different parser. Check~/.claude/GO_PACKAGE_DEFAULTS.mdbefore adding any dependency. Keep results exact where the answer is exact. Bound the exponent so one message cannot make the bot do unbounded work, asMaxInputLengthdoes now.simplex-chatWebSocket at127.0.0.1:5225inside the container has no authentication, and it stays unexposed. The new HTTP API is the only way in.simplexcalc-datavolume: it holds the bot's address.dont-block-on-reversible-decisions).next, nevermain.Model: opus-5-5
Plan. Five units, each one PR to
nextwith an independent review. The API units start after #8 lands: it moves the command setup out ofcmd/simplexcalc/intointernal/cli, and they build on that layout. Unit 1 touches only the calculator and starts at once.Units 2 to 5 share the API package and the README's API section, so they run one after another.
Decisions (reversible; details in each unit):
^and**are exponentiation, grouping to the right and binding tighter than a sign on the left (-2^2is-4);%takes the sign of the divisor (-7 % 3is2). A small parser of our own replacesgo/parser;go/constantstill computes.PORT(default8080) and takes its credential, a bearer token, from the file named byAPI_TOKEN_FILE. Without one it refuses every request. No path is exempt.Deploy, after the last merge: rebuild the image from
next; write a random credential to/var/lib/simplexcalc/api-tokenon thesimplexcalc-datavolume; recreatesimplexcalcon the same volume with-p 127.0.0.1:8080:8080, so the API is reachable on this host only and the chat client's WebSocket stays inside the container; check end to end with a throwaway second client.Model: opus-5-5
sneak asked at 09:19 UTC for this repo to move to his account. The transfer to
sneakis requested and waits for him to accept it. Once he does, the repo issneak/simplexcalc. clawbot can then write to it only after he adds clawbot as a collaborator with write access.For the repo-manager: once
https://git.eeqj.de/sneak/simplexcalcexists, point your remotes, briefs and links there. If a push or merge is refused after the move, stop starting new workers and wait for the top manager: do not work around it. The runningsimplexcalccontainer and its volume are not affected.Model: opus-5-5
The running bot on sandcastle now runs
nextatac72139, with exponentiation and modulo (#3). The containersimplexcalcwas recreated on the samesimplexcalc-datavolume, and its address is unchanged:https://smp5.simplex.im/a#MAO56qlZNoeCVWMvDXK4qsnRhduwVCVDkbw8r24zx0Q, so existing chats keep working.Checked from a throwaway second client:
2^10answers1024and-7 % 3answers2.The HTTP API is not deployed yet; it follows once its units are merged.
Model: opus-5-5
The running bot on sandcastle now runs
nextat0b9121a, which adds the fix for #16. It was recreated on the samesimplexcalc-datavolume, and its address is unchanged.Checked from a throwaway second client:
2^1200answers1.7218479456385751e+361and-7 % 3answers2.The HTTP API is in this build but not yet published or given a credential, so it refuses every request; that follows once webhook delivery (#7) lands.
Model: opus-5-5
All parts are on
next, and the running bot on sandcastle runsnextatfa2aa09. The containersimplexcalcwas recreated on the samesimplexcalc-datavolume, and its address is unchanged:https://smp5.simplex.im/a#MAO56qlZNoeCVWMvDXK4qsnRhduwVCVDkbw8r24zx0Q.API address:
http://127.0.0.1:8080on sandcastle, published on loopback only. The chat client's WebSocket stays inside the container.Credential: a bearer credential in
/var/lib/simplexcalc/api-tokeninside the container, which is/var/lib/docker/volumes/simplexcalc-data/_data/api-tokenon the host. Read it withdocker exec simplexcalc cat /var/lib/simplexcalc/api-tokenand send it asAuthorization: Bearer .... It is on the volume, so it survives recreating the container; the README's Backup paragraph names it.Checked end to end with a throwaway second client:
401;2^1200answers1.7218479456385751e+361and6 * 7answers42.The chats list includes throwaway test contacts from these checks (ids 3, 5, 6, 7 and 8); there is no API endpoint to delete a chat.
Model: opus-5-5
Direction from sneak (chat, 2026-10-05 ~23:14 UTC), recorded here for whoever works on this repo next: simplexcalc is a proof of concept for an agent integration with SimpleX Chat. The calculator bot is the basis for a send/receive API that can be made into a plugin for an LLM code-agent harness. No manager is assigned to it for now.
Model: opus-5-5