@trainheroic-unofficial/core 1.2.0 → 1.3.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.d.mts CHANGED
@@ -73,6 +73,10 @@ declare const SERVER_INSTRUCTIONS: string;
73
73
  //#region src/tools/reads.d.ts
74
74
  declare function registerReadTools(server: McpServer, ctx: ToolContext): void;
75
75
  //#endregion
76
+ //#region src/tools/main-lifts.d.ts
77
+ /** Coach main-lift PR reads: one athlete, or the whole roster at once. */
78
+ declare function registerMainLiftTools(server: McpServer, ctx: ToolContext): void;
79
+ //#endregion
76
80
  //#region src/tools/athlete-training.d.ts
77
81
  /**
78
82
  * Athlete tools need only the client (no exercise-library index), so they take a narrower
@@ -135,4 +139,4 @@ declare function registerWorkoutTools(server: McpServer, ctx: ToolContext): void
135
139
  /** Live messaging: list/read conversations, draft a message, and the gated send/delete. */
136
140
  declare function registerMessagingTools(server: McpServer, ctx: ToolContext): void;
137
141
  //#endregion
138
- export { AthleteContext, BudgetHint, DEFAULT_RESULT_BUDGET, DESTRUCTIVE, NOT_CONFIRMED, READ, SERVER_INSTRUCTIONS, SYNC, ToolContext, apiCall, attempt, boundedSerialize, confirmGate, errorResult, idParam, jsonResult, mapSessionExercises, registerAnalyticsTools, registerAthleteTools, registerAthleteTrainingTools, registerExerciseTools, registerMessagingTools, registerReadTools, registerTeamTools, registerWorkoutTools, resultBudget, toId };
142
+ export { AthleteContext, BudgetHint, DEFAULT_RESULT_BUDGET, DESTRUCTIVE, NOT_CONFIRMED, READ, SERVER_INSTRUCTIONS, SYNC, ToolContext, apiCall, attempt, boundedSerialize, confirmGate, errorResult, idParam, jsonResult, mapSessionExercises, registerAnalyticsTools, registerAthleteTools, registerAthleteTrainingTools, registerExerciseTools, registerMainLiftTools, registerMessagingTools, registerReadTools, registerTeamTools, registerWorkoutTools, resultBudget, toId };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { blockSpecSchema, coachLogSessionArgsSchema, coachLogSetArgsSchema, coachPrescribeSetArgsSchema, commentDraftSchema, dateString, exerciseCreateSchema, idArgSchema, logSessionArgsSchema, logSetArgsSchema, parseWorkoutDate, swapAthleteExerciseArgsSchema } from "@trainheroic-unofficial/dto";
2
2
  import { z } from "zod";
3
- import { ANALYTICS_METRIC_KEYS, addExercisesToWorkout, buildCommentPayload, buildSession, coerceInt, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseUnits, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, inviteAthletes, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, prescribeForAthlete, presentAthleteWorkouts, presentCoachAthleteTraining, presentExerciseHistory, publishSession, queryAnalytics, readLive, readSession, removeSession, searchExerciseHistory, selectWorkouts, sendComment, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults } from "@trainheroic-unofficial/js";
3
+ import { ANALYTICS_METRIC_KEYS, addExercisesToWorkout, buildCommentPayload, buildSession, coerceInt, collectAdvisories, copySession, createPersonalWorkout, definedProps, deleteComment, exerciseUnits, fetchAthleteMainLiftPRs, fetchAthletePrefs, fetchAthleteProfileSummary, fetchAthleteUser, fetchAthleteWorkouts, fetchCoachAthleteCalendarSummary, fetchCoachAthleteWorkouts, fetchExerciseHistoryDetail, fetchExerciseHistoryList, fetchExerciseStats, fetchLeaderboard, fetchPersonalRecords, fetchRosterActivity, fetchRosterMainLiftPRs, fetchStreams, fetchTeamAthleteIds, fetchWorkingMaxes, inviteAthletes, isRecord, logAdHocSession, logAthleteSet, logForAthlete, logSessionForAthlete, prescribeForAthlete, presentAthleteWorkouts, presentCoachAthleteTraining, presentExerciseHistory, publishSession, queryAnalytics, readLive, readSession, removeSession, searchExerciseHistory, selectWorkouts, sendComment, summarizeAthleteWorkouts, swapAthleteExercise, teamVolume, toSetResults } from "@trainheroic-unofficial/js";
4
4
  //#region src/context.ts
5
5
  /** A tool argument that accepts a numeric id as a number or a string of digits. */
6
6
  const idParam = idArgSchema;
@@ -405,6 +405,37 @@ function registerReadTools(server, ctx) {
405
405
  registerTeamVolume(server, ctx);
406
406
  }
407
407
  //#endregion
408
+ //#region src/tools/main-lifts.ts
409
+ const monthsParam = z.number().int().positive().max(36).optional();
410
+ const ATHLETE_DESC = "A roster athlete's personal records for the main barbell lifts (squat, bench press, deadlift, overhead press, clean & jerk, snatch). Pass athleteId from list_athletes — nothing else. It auto-discovers which exercise VARIANT the athlete actually logs for each lift (e.g. 'Back Squat', not the empty 'Squat' library entry) by scanning their recent training, so you do NOT resolve exercise ids yourself. Returns one row per lift family in a fixed order; a lift the athlete has not logged comes back with null fields (no PR yet). `months` (default 12) is how far back to look for the logged variants.";
411
+ const ROSTER_DESC = "Every roster athlete's main-lift PRs in one call — the squad board for squat/bench/deadlift/overhead press/clean & jerk/snatch. Same per-athlete discovery as athlete_main_lift_prs, fanned out across the roster (bounded), so it makes many upstream calls; expect a few seconds on a big roster. Optional athleteIds restricts it to a subset (else the whole roster from /v5/athletes); `months` (default 12) sets the look-back for logged variants.";
412
+ /** Coach main-lift PR reads: one athlete, or the whole roster at once. */
413
+ function registerMainLiftTools(server, ctx) {
414
+ server.registerTool("athlete_main_lift_prs", {
415
+ title: "Athlete main-lift PRs (roster)",
416
+ description: ATHLETE_DESC,
417
+ inputSchema: {
418
+ athleteId: idParam,
419
+ months: monthsParam
420
+ },
421
+ annotations: READ
422
+ }, ({ athleteId, months }) => attempt(async () => jsonResult(await fetchAthleteMainLiftPRs(ctx.client, toId(athleteId), months !== void 0 ? { months } : {}))));
423
+ server.registerTool("roster_main_lift_prs", {
424
+ title: "Roster main-lift PRs",
425
+ description: ROSTER_DESC,
426
+ inputSchema: {
427
+ months: monthsParam,
428
+ athleteIds: z.array(idParam).optional()
429
+ },
430
+ annotations: READ
431
+ }, ({ months, athleteIds }) => attempt(async () => {
432
+ return jsonResult(await fetchRosterMainLiftPRs(ctx.client, {
433
+ ...athleteIds ? { athleteIds: athleteIds.map(toId) } : {},
434
+ ...months !== void 0 ? { months } : {}
435
+ }), { hint: "Pass athleteIds to scope to a few athletes, or lower months, to shrink this." });
436
+ }));
437
+ }
438
+ //#endregion
408
439
  //#region src/tools/athlete-training.ts
409
440
  /** Identity, profile, prefs, working maxes, leaderboard. */
410
441
  function registerProfileTools(server, ctx, whoami, userId) {
@@ -1222,4 +1253,4 @@ function registerMessagingTools(server, ctx) {
1222
1253
  registerWrites(server, ctx);
1223
1254
  }
1224
1255
  //#endregion
1225
- export { DEFAULT_RESULT_BUDGET, DESTRUCTIVE, NOT_CONFIRMED, READ, SERVER_INSTRUCTIONS, SYNC, apiCall, attempt, boundedSerialize, confirmGate, errorResult, idParam, jsonResult, mapSessionExercises, registerAnalyticsTools, registerAthleteTools, registerAthleteTrainingTools, registerExerciseTools, registerMessagingTools, registerReadTools, registerTeamTools, registerWorkoutTools, resultBudget, toId };
1256
+ export { DEFAULT_RESULT_BUDGET, DESTRUCTIVE, NOT_CONFIRMED, READ, SERVER_INSTRUCTIONS, SYNC, apiCall, attempt, boundedSerialize, confirmGate, errorResult, idParam, jsonResult, mapSessionExercises, registerAnalyticsTools, registerAthleteTools, registerAthleteTrainingTools, registerExerciseTools, registerMainLiftTools, registerMessagingTools, registerReadTools, registerTeamTools, registerWorkoutTools, resultBudget, toId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/core",
3
- "version": "1.2.0",
3
+ "version": "1.3.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.2.0",
29
- "@trainheroic-unofficial/js": "1.2.0"
28
+ "@trainheroic-unofficial/dto": "1.3.0",
29
+ "@trainheroic-unofficial/js": "1.3.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^26.0.0",