Repository navigation
Add trainingpeaks.com tools: login, page context, navigation and availability - #149
Merged
Merged
Conversation
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
Adds a
trainingpeaks.comnamespace. It follows the page-context and navigation pattern from amctheatres.com, resy.com and united.com, and adds tools for TrainingPeaks Availability, the calendar's days-off entries ("unable to train" or "limited availability").loginhome.trainingpeaks.com/loginonce, after the page's reCAPTCHA v3 token is issued, and confirms the account through the app's session API. It submits with Enter because the cookie-consent overlay can cover the Login button.get_page_context#route, any open workout/activity/availability item, the signed-in account, the calendar's drawn range and today's date, whether an Availability form is open, a structuredcookie_banner(visible, settings open, overlay blocking clicks, already answered), live tools, unsettled reasons and next steps.navigate_to_page#home,#calendar,#dashboard,#plan,#settings, an Availability entry). It schedules a hash change, a full load or a reload (reload: true, needed because the app shows cached calendar data after switching routes) after returning, and refuses other hosts and leaving an open Availability form unlessdiscard_formis set.answer_cookie_bannerget_calendarnot_drawn.list_availabilityadd_availabilitysaved_with_differenceswith the stored entry if TrainingPeaks stored anything differently.delete_availabilitylib/trainingpeaks-session.jsholds the session and availability model that the four availability/context page tools inline.The
add_availabilityanddelete_availabilityrequest shapes were captured from the site's own form and confirmation dialog with the requests stubbed in the page, so nothing was written while capturing them. tpapi publishes no schema (common OpenAPI/Swagger paths 404), so these shapes are inferred from the app's own traffic. Writing through the API leaves the on-screen calendar stale, so both tools tell the caller to reload it withnavigate_to_page({ url: "#calendar", reload: true }).The login tool can be invoked through a Kernel vault
webmcp_invokebinding, so the password goes from the vault into the tool input without passing through the agent.Testing
node --test tests/trainingpeaks.test.mjsruns 16 tests against a fabricated account and a stubbed availability API.node scripts/validate-registry.mjsand the fullnode --test "tests/*.test.mjs"suite pass (4505 tests).get_calendar.All eight tools stay
draft. They have no independent QA yet, and live deletion has not been exercised.