Repository navigation
Add M-Team bonus catalog, review, and exchange - #31
Merged
Merged
Conversation
M-Team now reads its bonus shop and exchanges goods through the same at-most-once state machine TJUPT uses. - bonus-catalog reads the balance (member/profile) and the shop (mall/list) on one client; review re-reads mall/list for one goods ID. - exchange submit sends one mall/exchange POST with goodsId and num=1, only for goods that are plainly available and take no input. It goes through the new httpguard PostEffectOnce, whose User-Agent names an explicit-effect client. The API key is the only credential. - bonus review and exchange submit accept --api-key-stdin or the saved key; submit adds the public stop reasons server_refused, server_rate_limited, and server_authentication_rejected. - The M-Team descriptor grows from 5 to 8 capabilities, which changes site list and site capabilities output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
M-Team gets the three bonus commands TJUPT already has, so a saved API key now covers every M-Team command except RSS, seeding lists, and messages.
site bonus-catalog mteamreads the balance (member/profile) and the shop (mall/list) on one client, three seconds apart.site bonus review mteam GOODS_IDre-readsmall/listand reviews one goods item in one read-only POST.site bonus exchange submiton M-Team sends at most onePOST /api/mall/exchangewith onlygoodsIdandnum=1. It only does this for goods that are plainly available and take no input. The API key is the only credential; M-Team asks for no password.Goods status mapping and the exchange outcome table are in
docs/MTEAM_ADAPTER.md→ "Bonus shop".Deliberate public changes
bonus.catalog.read,bonus.offer.review,bonus.exchange.submit_effectful). This changessite list(count 5 → 8) and thesite capabilities mteamoutput, both text and JSON. The goldens insite_contract_test.goare updated.--api-key-stdinonsite bonus reviewandsite bonus exchange submit. Without a stdin flag, both commands use the saved key.site bonus exchange submitcan now reportserver_refused,server_rate_limited, andserver_authentication_rejected(all with outcomerejected).Transport
httpguard.Client.PostEffectOnceis new. It shares the bounded single-POST path withPostReadOnce, but sends aUser-Agentnaming an explicit-effect client so the request is never mistaken for a read.Testing
gofmt,go vet ./...,go test -race ./..., andgo build -trimpath ./cmd/ptctlall pass locally.bonus-catalogreturned exit 0 and listed 6 goods, andbonus reviewreturned exit 0 with 1 request. The API key did not appear in any output.🤖 Generated with Claude Code