@trainheroic-unofficial/coach-mcp 2.1.1 → 3.0.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.
Files changed (2) hide show
  1. package/dist/server.mjs +18 -15
  2. package/package.json +3 -3
package/dist/server.mjs CHANGED
@@ -2129,7 +2129,7 @@ function unitAdvisory(blockTitle, ex, defaults) {
2129
2129
  /**
2130
2130
  * Run unit advisories across a whole block list against an exercise index. Shared by the
2131
2131
  * MCP workout_build tool and the CLI so both surface the same notes/warnings. Ensures the
2132
- * index is loaded first, otherwise `defaults` returns null on a cold index and every
2132
+ * index is loaded first, otherwise the defaults map is empty on a cold index and every
2133
2133
  * advisory is silently dropped.
2134
2134
  */
2135
2135
  async function collectAdvisories(blocks, index) {
@@ -2138,14 +2138,12 @@ async function collectAdvisories(blocks, index) {
2138
2138
  block: b,
2139
2139
  ex
2140
2140
  })));
2141
- const defaults = await Promise.all(pairs.map((p) => {
2142
- const id = Number(p.ex.id);
2143
- return Number.isFinite(id) ? index.defaults(id) : Promise.resolve(null);
2144
- }));
2141
+ const ids = [...new Set(pairs.map((p) => Number(p.ex.id)).filter((id) => Number.isFinite(id)))];
2142
+ const defaultsById = await index.defaultsMany(ids);
2145
2143
  const notes = [];
2146
2144
  const warnings = [];
2147
- pairs.forEach((p, i) => {
2148
- const def = defaults[i];
2145
+ pairs.forEach((p) => {
2146
+ const def = defaultsById.get(Number(p.ex.id));
2149
2147
  if (!def) return;
2150
2148
  const advisory = unitAdvisory(p.block.title, p.ex, def);
2151
2149
  notes.push(...advisory.notes);
@@ -2402,7 +2400,8 @@ async function copySession(client, args) {
2402
2400
  year,
2403
2401
  dayOfWeek,
2404
2402
  isToday: false
2405
- }
2403
+ },
2404
+ toTimelineDate: null
2406
2405
  } });
2407
2406
  if (!res.ok) {
2408
2407
  const detail = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
@@ -2991,12 +2990,16 @@ var ExerciseLibrary = class {
2991
2990
  if (!s) return null;
2992
2991
  return presentExercise(s.raw);
2993
2992
  }
2994
- async defaults(id) {
2995
- const s = this.#byId.get(id);
2996
- return s ? {
2997
- param1: s.param_1_type,
2998
- param2: s.param_2_type
2999
- } : null;
2993
+ async defaultsMany(ids) {
2994
+ const result = /* @__PURE__ */ new Map();
2995
+ for (const id of ids) {
2996
+ const s = this.#byId.get(id);
2997
+ if (s) result.set(id, {
2998
+ param1: s.param_1_type,
2999
+ param2: s.param_2_type
3000
+ });
3001
+ }
3002
+ return result;
3000
3003
  }
3001
3004
  async search(query, limit = 20) {
3002
3005
  await this.ensureFresh();
@@ -3970,7 +3973,7 @@ var JsonFileLibraryCache = class {
3970
3973
  };
3971
3974
  //#endregion
3972
3975
  //#region package.json
3973
- var version = "2.1.1";
3976
+ var version = "3.0.0";
3974
3977
  //#endregion
3975
3978
  //#region src/server.ts
3976
3979
  function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/coach-mcp",
3
- "version": "2.1.1",
3
+ "version": "3.0.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "@modelcontextprotocol/server": "2.0.0",
23
23
  "zod": "^4.4.3",
24
- "@trainheroic-unofficial/core": "2.1.1",
25
- "@trainheroic-unofficial/js": "2.1.1"
24
+ "@trainheroic-unofficial/js": "3.0.0",
25
+ "@trainheroic-unofficial/core": "3.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.2.0",