@trainheroic-unofficial/core 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +26 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -701,6 +701,31 @@ function registerLogTool(server, ctx) {
|
|
|
701
701
|
}));
|
|
702
702
|
}
|
|
703
703
|
/**
|
|
704
|
+
* The athlete's own per-exercise swap, in its own function so registerLogTool/registerSessionTools
|
|
705
|
+
* stay under the oxlint max-lines-per-function cap. Lets an athlete substitute a prescribed
|
|
706
|
+
* exercise in a coach-scheduled workout for a different one — the self-service equivalent of the
|
|
707
|
+
* app's "swap exercise", overriding only the athlete's own copy of that slot.
|
|
708
|
+
*/
|
|
709
|
+
function registerSwapTool(server, ctx) {
|
|
710
|
+
server.registerTool("athlete_swap_exercise", {
|
|
711
|
+
title: "Swap one exercise in your scheduled workout",
|
|
712
|
+
description: "Athlete-facing write: substitute one prescribed exercise in your scheduled workout for a different one — the API equivalent of the app's \"swap exercise\". This is the way to change which movement a slot is BEFORE logging: session_add/remove only touch personal sessions, and athlete_log_set records results into a slot without changing its exercise, so use this when a COACH-SCHEDULED slot should be a different lift. It overrides only your copy of the slot; the team/program prescription is untouched. Give savedWorkoutSetExerciseId (the slot to change, from athlete_log_targets — each row lists it per exercise) and exerciseId (the replacement, from athlete_exercises). After swapping, log against the slot as usual with athlete_log_set. Requires confirmation (elicitation or confirm:true).",
|
|
713
|
+
inputSchema: {
|
|
714
|
+
...swapAthleteExerciseArgsSchema.shape,
|
|
715
|
+
confirm: z.boolean().optional()
|
|
716
|
+
},
|
|
717
|
+
annotations: DESTRUCTIVE
|
|
718
|
+
}, ({ savedWorkoutSetExerciseId, exerciseId, confirm }, extra) => attempt(async () => {
|
|
719
|
+
const sweId = toId(savedWorkoutSetExerciseId);
|
|
720
|
+
const exId = toId(exerciseId);
|
|
721
|
+
if (!await confirmGate(server, extra.requestId, `Swap the exercise in your saved workout slot ${sweId} to exercise ${exId}? This changes what that slot is prescribed (your copy only).`, confirm)) return errorResult(NOT_CONFIRMED);
|
|
722
|
+
return jsonResult(await swapAthleteExercise(ctx.client, {
|
|
723
|
+
savedWorkoutSetExerciseId: sweId,
|
|
724
|
+
exerciseId: exId
|
|
725
|
+
}));
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
704
729
|
* Live tools over the logged-in user's own training (history, scheduled/completed workouts,
|
|
705
730
|
* PRs, working maxes), plus a gated set-logging write. The athlete user id is
|
|
706
731
|
* resolved once from /user/simple and reused across tools.
|
|
@@ -725,6 +750,7 @@ function registerAthleteTrainingTools(server, ctx) {
|
|
|
725
750
|
registerLogTargetsTool(server, ctx);
|
|
726
751
|
registerSessionTools(server, ctx);
|
|
727
752
|
registerLogTool(server, ctx);
|
|
753
|
+
registerSwapTool(server, ctx);
|
|
728
754
|
}
|
|
729
755
|
//#endregion
|
|
730
756
|
//#region src/tools/athletes.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@cfworker/json-schema": "^4.1.1",
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
27
27
|
"zod": "^4.4.3",
|
|
28
|
-
"@trainheroic-unofficial/dto": "1.
|
|
29
|
-
"@trainheroic-unofficial/js": "1.
|
|
28
|
+
"@trainheroic-unofficial/dto": "1.7.0",
|
|
29
|
+
"@trainheroic-unofficial/js": "1.7.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^26.0.1",
|