@chrischall/warapp-mcp 0.16.0 → 0.17.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.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "metadata": {
9
9
  "description": "MCP server for war.app (Warzone) — your games, players, settings, map bonuses and chokepoints, board analysis and route planning through war.app's per-player GameFeed API, plus the live board, territory picks, cards, turn planning and submission, turn notifications and game chat through your signed-in war.app tab (joining, leaving or surrendering a game, closing out a finished game, accepting another player's surrender, Begin on a speed first turn, picks, turn orders, withdrawing them, chat sends, marking notifications and chat read, deleting notifications, importing local history and linking a session are confirm-gated).",
10
- "version": "0.16.0"
10
+ "version": "0.17.0"
11
11
  },
12
12
  "plugins": [
13
13
  {
@@ -15,7 +15,7 @@
15
15
  "displayName": "war.app (Warzone)",
16
16
  "source": "./",
17
17
  "description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
18
- "version": "0.16.0",
18
+ "version": "0.17.0",
19
19
  "author": {
20
20
  "name": "Chris Hall"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "warapp-mcp",
3
3
  "displayName": "war.app (Warzone)",
4
- "version": "0.16.0",
4
+ "version": "0.17.0",
5
5
  "description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
6
6
  "author": {
7
7
  "name": "Chris Hall",
package/dist/bundle.js CHANGED
@@ -115386,6 +115386,7 @@ async function withPathLock(path, fn) {
115386
115386
  var MAX_STORED_MAPS = 40;
115387
115387
  var MAX_MAP_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
115388
115388
  var MAX_GAME_INDEX = 500;
115389
+ var MAX_PINNED_GAMES = 1e3;
115389
115390
  var VERSION = 1;
115390
115391
  var MAP_FILE = /^\d+\.json$/;
115391
115392
  var isRec2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -115394,6 +115395,7 @@ var isIntArray = (v) => Array.isArray(v) && v.every(isInt);
115394
115395
  var mapsDir = (dir) => join5(dir, "maps");
115395
115396
  var mapStorePath = (dir, mapId) => join5(mapsDir(dir), `${mapId}.json`);
115396
115397
  var indexPath = (dir) => join5(mapsDir(dir), "games.json");
115398
+ var pinsPath = (dir) => join5(mapsDir(dir), "pinned.json");
115397
115399
  async function writeJsonAtomic(path, folder, body) {
115398
115400
  await mkdir(folder, { recursive: true, mode: 448 });
115399
115401
  const tmp = `${path}.${process.pid}.${randomBytes3(4).toString("hex")}.tmp`;
@@ -115470,9 +115472,10 @@ async function readStoredMapEntry(dir, mapId, opts = {}) {
115470
115472
  }
115471
115473
  async function evictMaps(dir, keep) {
115472
115474
  const folder = mapsDir(dir);
115475
+ const pinned = new Set((await readPins(dir)).map(([, m]) => `${m}.json`));
115473
115476
  const files = [];
115474
115477
  for (const name of await readdir(folder)) {
115475
- if (!MAP_FILE.test(name)) continue;
115478
+ if (!MAP_FILE.test(name) || pinned.has(name)) continue;
115476
115479
  try {
115477
115480
  files.push({ name, at: (await stat(join5(folder, name))).mtimeMs });
115478
115481
  } catch {
@@ -115545,6 +115548,44 @@ async function rememberGameMap(dir, gameId, mapId) {
115545
115548
  return false;
115546
115549
  }
115547
115550
  }
115551
+ async function readPins(dir) {
115552
+ try {
115553
+ const raw = JSON.parse(await readFile(pinsPath(dir), "utf8"));
115554
+ if (!isRec2(raw) || raw.version !== VERSION || !Array.isArray(raw.pins)) return [];
115555
+ return raw.pins.filter((e) => Array.isArray(e) && e.length === 2 && isInt(e[0]) && isInt(e[1]));
115556
+ } catch {
115557
+ return [];
115558
+ }
115559
+ }
115560
+ async function pinStoredMap(dir, mapId, gameId) {
115561
+ try {
115562
+ return await withPathLock(pinsPath(dir), async () => {
115563
+ const pins = await readPins(dir);
115564
+ if (pins.some(([g, m]) => g === gameId && m === mapId)) return false;
115565
+ const next = pins.filter(([g]) => g !== gameId);
115566
+ next.push([gameId, mapId]);
115567
+ await writeJsonAtomic(pinsPath(dir), mapsDir(dir), { version: VERSION, pins: next.slice(-MAX_PINNED_GAMES) });
115568
+ return true;
115569
+ });
115570
+ } catch {
115571
+ return false;
115572
+ }
115573
+ }
115574
+ async function unpinGames(dir, gameIds) {
115575
+ if (!gameIds.length) return false;
115576
+ const gone = new Set(gameIds);
115577
+ try {
115578
+ return await withPathLock(pinsPath(dir), async () => {
115579
+ const pins = await readPins(dir);
115580
+ const next = pins.filter(([g]) => !gone.has(g));
115581
+ if (next.length === pins.length) return false;
115582
+ await writeJsonAtomic(pinsPath(dir), mapsDir(dir), { version: VERSION, pins: next });
115583
+ return true;
115584
+ });
115585
+ } catch {
115586
+ return false;
115587
+ }
115588
+ }
115548
115589
 
115549
115590
  // src/build-id.ts
115550
115591
  import { createHash as createHash4 } from "node:crypto";
@@ -115630,7 +115671,7 @@ function serverBuild() {
115630
115671
  }
115631
115672
 
115632
115673
  // src/version.ts
115633
- var VERSION2 = "0.16.0";
115674
+ var VERSION2 = "0.17.0";
115634
115675
 
115635
115676
  // src/decision-log.ts
115636
115677
  var DECISION_LOG_VERSION = 1;
@@ -115746,6 +115787,10 @@ function encodeInput(input2) {
115746
115787
  }
115747
115788
  function loggedEstimates(estimates, tracks) {
115748
115789
  const methods = new Map((tracks ?? []).flatMap((t) => t.incomeMethod ? [[t.playerId, t.incomeMethod]] : []));
115790
+ const internals = new Map((tracks ?? []).flatMap((t) => {
115791
+ const logged2 = loggedTrack(t);
115792
+ return logged2 ? [[t.playerId, logged2]] : [];
115793
+ }));
115749
115794
  return [...estimates].sort((a, b) => a.playerId - b.playerId).map((e) => ({
115750
115795
  player: e.playerId,
115751
115796
  estimate: e.estimate,
@@ -115753,9 +115798,36 @@ function loggedEstimates(estimates, tracks) {
115753
115798
  coverage: e.coverage?.share ?? null,
115754
115799
  thin: !!e.thinEvidence,
115755
115800
  ...methods.has(e.playerId) ? { method: methods.get(e.playerId) } : {},
115756
- stages: estimateStages(e)
115801
+ stages: estimateStages(e),
115802
+ ...internals.has(e.playerId) ? { track: internals.get(e.playerId) } : {}
115757
115803
  }));
115758
115804
  }
115805
+ function loggedTrack(t) {
115806
+ if (t.income === void 0) return void 0;
115807
+ const window = new Set(t.incomeTurns ?? []);
115808
+ const turns = (t.turns ?? []).filter((x) => window.has(x.from));
115809
+ return {
115810
+ income: t.income,
115811
+ window: turns.map((x) => ({
115812
+ turn: x.from,
115813
+ observed: x.observed,
115814
+ raw: x.raw,
115815
+ low: x.low,
115816
+ high: x.high,
115817
+ cap: x.cap,
115818
+ coverage: x.coverage?.share ?? null,
115819
+ ...x.captureFloor !== void 0 ? { captureFloor: x.captureFloor } : {},
115820
+ ...x.accounted ? { accounted: true } : {},
115821
+ ...x.fogCaptures ? { fogCaptures: x.fogCaptures.income } : {}
115822
+ })),
115823
+ ...t.incomeLowered ? { lowered: t.incomeLowered } : {},
115824
+ ...t.incomeRise ? { rise: { ...t.incomeRise } } : {},
115825
+ ...t.observedLow ? { observedLow: { ...t.observedLow } } : {},
115826
+ ...t.incomeTrip ? { trip: { ...t.incomeTrip } } : {},
115827
+ ...t.incomeJump ? { jump: { turn: t.incomeJump.turn, observed: t.incomeJump.observed, before: t.incomeJump.before, verdict: t.incomeJump.verdict } } : {},
115828
+ ...typeof t.topUp === "number" ? { topUp: t.topUp } : {}
115829
+ };
115830
+ }
115759
115831
  function earnedIncome(input2) {
115760
115832
  const { income, cardArmies } = input2 ?? {};
115761
115833
  if (typeof income !== "number") return void 0;
@@ -115817,7 +115889,8 @@ function logOf(c, gameId) {
115817
115889
  ...isRec3(c.seats) ? { seats: c.seats } : {},
115818
115890
  ...isRec3(c.join) ? { join: c.join } : {},
115819
115891
  ...isRec3(c.opponents) ? { opponents: c.opponents } : {},
115820
- ...isRec3(c.picks) ? { picks: c.picks } : {}
115892
+ ...isRec3(c.picks) ? { picks: c.picks } : {},
115893
+ ...isInt2(c.mapId) ? { mapId: c.mapId } : {}
115821
115894
  };
115822
115895
  }
115823
115896
  var hasContent = (log) => Object.keys(log.turns).length > 0 || !!log.events?.length || !!log.join || !!log.seats || !!log.opponents || !!log.picks;
@@ -115906,7 +115979,7 @@ async function recordDecision(dir, gameId, playerId, rec2, opts = {}) {
115906
115979
  [String(rec2.turn)]: { ...entry, ...was?.chat ? { chat: was.chat } : {}, ...was?.checks ? { checks: was.checks } : {} }
115907
115980
  };
115908
115981
  encodeBoards(turns, boards);
115909
- return { ...log, turns };
115982
+ return { ...log, ...rec2.mapId !== void 0 ? { mapId: rec2.mapId } : {}, turns };
115910
115983
  },
115911
115984
  opts
115912
115985
  );
@@ -116441,6 +116514,7 @@ async function pruneDecisionLogs(dir, caps = {}) {
116441
116514
  } catch {
116442
116515
  }
116443
116516
  }
116517
+ await unpinGames(dir, removed);
116444
116518
  return removed;
116445
116519
  }
116446
116520
 
@@ -137565,6 +137639,7 @@ function gameIdsOf(body) {
137565
137639
 
137566
137640
  // src/tools/decision-capture.ts
137567
137641
  import { createHash as createHash7 } from "node:crypto";
137642
+ import { existsSync as existsSync3 } from "node:fs";
137568
137643
 
137569
137644
  // src/join-color.ts
137570
137645
  var GAME_COLOR = "warlight.shared.GameColor";
@@ -138634,12 +138709,14 @@ var bonusesOf = (graph) => new Map([...graph.bonusById.keys()].map((id) => [id,
138634
138709
  async function capturePlan(ctx, a) {
138635
138710
  if (!ctx.dataDir) return;
138636
138711
  const opts = modeOf2(ctx);
138637
- await recordDecision(
138712
+ const mapId = a.graph.map.id;
138713
+ const wrote = await recordDecision(
138638
138714
  ctx.dataDir,
138639
138715
  a.gameId,
138640
138716
  a.me,
138641
138717
  {
138642
138718
  turn: a.turn,
138719
+ mapId,
138643
138720
  board: a.board,
138644
138721
  ...a.plannedBoard ? { plannedBoard: a.plannedBoard } : {},
138645
138722
  input: a.input,
@@ -138654,6 +138731,7 @@ async function capturePlan(ctx, a) {
138654
138731
  },
138655
138732
  opts
138656
138733
  );
138734
+ if (wrote || existsSync3(decisionLogPath(ctx.dataDir, a.gameId))) await pinStoredMap(ctx.dataDir, mapId, a.gameId);
138657
138735
  if (a.turn < 2) return;
138658
138736
  try {
138659
138737
  await fillOutcome(
@@ -57,7 +57,7 @@
57
57
  import { open, readdir, readFile, stat, unlink } from 'node:fs/promises';
58
58
  import { join } from 'node:path';
59
59
  import { estimateOff } from './analysis/decision-truth.js';
60
- import { writeJsonAtomic } from './map-store.js';
60
+ import { unpinGames, writeJsonAtomic } from './map-store.js';
61
61
  import { withPathLock } from './path-lock.js';
62
62
  import { serverBuild } from './build-id.js';
63
63
  import { VERSION } from './version.js';
@@ -241,6 +241,10 @@ export function decodeInput(logged, board, graph) {
241
241
  /** The estimates as logged: ids, figures and flags only. */
242
242
  export function loggedEstimates(estimates, tracks) {
243
243
  const methods = new Map((tracks ?? []).flatMap((t) => (t.incomeMethod ? [[t.playerId, t.incomeMethod]] : [])));
244
+ const internals = new Map((tracks ?? []).flatMap((t) => {
245
+ const logged = loggedTrack(t);
246
+ return logged ? [[t.playerId, logged]] : [];
247
+ }));
244
248
  return [...estimates]
245
249
  .sort((a, b) => a.playerId - b.playerId)
246
250
  .map((e) => ({
@@ -251,8 +255,39 @@ export function loggedEstimates(estimates, tracks) {
251
255
  thin: !!e.thinEvidence,
252
256
  ...(methods.has(e.playerId) ? { method: methods.get(e.playerId) } : {}),
253
257
  stages: estimateStages(e),
258
+ ...(internals.has(e.playerId) ? { track: internals.get(e.playerId) } : {}),
254
259
  }));
255
260
  }
261
+ /** #586: {@link LoggedTrack} of one track; `undefined` for a track with no income field (one built by hand). */
262
+ export function loggedTrack(t) {
263
+ if (t.income === undefined)
264
+ return undefined;
265
+ const window = new Set(t.incomeTurns ?? []);
266
+ const turns = (t.turns ?? []).filter((x) => window.has(x.from));
267
+ return {
268
+ income: t.income,
269
+ window: turns.map((x) => ({
270
+ turn: x.from,
271
+ observed: x.observed,
272
+ raw: x.raw,
273
+ low: x.low,
274
+ high: x.high,
275
+ cap: x.cap,
276
+ coverage: x.coverage?.share ?? null,
277
+ ...(x.captureFloor !== undefined ? { captureFloor: x.captureFloor } : {}),
278
+ ...(x.accounted ? { accounted: true } : {}),
279
+ ...(x.fogCaptures ? { fogCaptures: x.fogCaptures.income } : {}),
280
+ })),
281
+ ...(t.incomeLowered ? { lowered: t.incomeLowered } : {}),
282
+ ...(t.incomeRise ? { rise: { ...t.incomeRise } } : {}),
283
+ ...(t.observedLow ? { observedLow: { ...t.observedLow } } : {}),
284
+ ...(t.incomeTrip ? { trip: { ...t.incomeTrip } } : {}),
285
+ ...(t.incomeJump
286
+ ? { jump: { turn: t.incomeJump.turn, observed: t.incomeJump.observed, before: t.incomeJump.before, verdict: t.incomeJump.verdict } }
287
+ : {}),
288
+ ...(typeof t.topUp === 'number' ? { topUp: t.topUp } : {}),
289
+ };
290
+ }
256
291
  /** My income as `input` gives it, card armies out; `undefined` when it holds none. */
257
292
  function earnedIncome(input) {
258
293
  const { income, cardArmies } = (input ?? {});
@@ -330,6 +365,7 @@ function logOf(c, gameId) {
330
365
  ...(isRec(c.join) ? { join: c.join } : {}),
331
366
  ...(isRec(c.opponents) ? { opponents: c.opponents } : {}),
332
367
  ...(isRec(c.picks) ? { picks: c.picks } : {}),
368
+ ...(isInt(c.mapId) ? { mapId: c.mapId } : {}),
333
369
  };
334
370
  }
335
371
  /** Whether a log holds anything: a turn, or per-game context (#437). */
@@ -442,7 +478,7 @@ export async function recordDecision(dir, gameId, playerId, rec, opts = {}) {
442
478
  [String(rec.turn)]: { ...entry, ...(was?.chat ? { chat: was.chat } : {}), ...(was?.checks ? { checks: was.checks } : {}) },
443
479
  };
444
480
  encodeBoards(turns, boards);
445
- return { ...log, turns };
481
+ return { ...log, ...(rec.mapId !== undefined ? { mapId: rec.mapId } : {}), turns };
446
482
  }, opts);
447
483
  }
448
484
  catch {
@@ -1128,5 +1164,7 @@ export async function pruneDecisionLogs(dir, caps = {}) {
1128
1164
  // Gone already, or not removable: leave it.
1129
1165
  }
1130
1166
  }
1167
+ // #586: a pruned log no longer keeps its map pinned.
1168
+ await unpinGames(dir, removed);
1131
1169
  return removed;
1132
1170
  }
package/dist/map-store.js CHANGED
@@ -20,6 +20,10 @@
20
20
  // - `<dataDir>/maps/games.json`: `{ version: 1, games: [[gameId, mapId], …] }`, newest last, at most
21
21
  // MAX_GAME_INDEX entries — which map a game is on, so a game seen before a restart is still asked
22
22
  // `GetMap=false`.
23
+ // - `<dataDir>/maps/pinned.json` (#586): `{ version: 1, pins: [[gameId, mapId], …] }`, newest last, at most
24
+ // MAX_PINNED_GAMES entries — the maps of games with a decision log (src/decision-log.ts), pinned when a turn
25
+ // is planned and unpinned when the log is pruned. A pinned map is never evicted and does not count toward
26
+ // MAX_STORED_MAPS, so a logged game can still be replayed offline after many other maps were used.
23
27
  //
24
28
  // Files are 0600 in a 0700 folder and written atomically; every read is loose (a bad file is ignored,
25
29
  // and replaced by the next write) and nothing here throws. Another process sharing the data directory
@@ -34,6 +38,8 @@ export const MAX_STORED_MAPS = 40;
34
38
  export const MAX_MAP_AGE_MS = 30 * 24 * 60 * 60 * 1000;
35
39
  /** Game → map entries kept in the index; the oldest goes first. */
36
40
  export const MAX_GAME_INDEX = 500;
41
+ /** #586: games whose map is pinned; the oldest pin goes first. As many as the decision log keeps games (1000). */
42
+ export const MAX_PINNED_GAMES = 1000;
37
43
  const VERSION = 1;
38
44
  const MAP_FILE = /^\d+\.json$/;
39
45
  const isRec = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
@@ -42,6 +48,7 @@ const isIntArray = (v) => Array.isArray(v) && v.every(isInt);
42
48
  export const mapsDir = (dir) => join(dir, 'maps');
43
49
  export const mapStorePath = (dir, mapId) => join(mapsDir(dir), `${mapId}.json`);
44
50
  const indexPath = (dir) => join(mapsDir(dir), 'games.json');
51
+ const pinsPath = (dir) => join(mapsDir(dir), 'pinned.json');
45
52
  /** Write `body` as JSON at `path` atomically (0600; folder 0700). */
46
53
  export async function writeJsonAtomic(path, folder, body) {
47
54
  await mkdir(folder, { recursive: true, mode: 0o700 });
@@ -140,12 +147,16 @@ export async function readStoredMapEntry(dir, mapId, opts = {}) {
140
147
  return undefined;
141
148
  }
142
149
  }
143
- /** Delete the least recently used maps beyond {@link MAX_STORED_MAPS}, keeping `keep`. Best effort. */
150
+ /**
151
+ * Delete the least recently used maps beyond {@link MAX_STORED_MAPS}, keeping `keep` and every pinned map (#586),
152
+ * which do not count toward the cap. Best effort.
153
+ */
144
154
  async function evictMaps(dir, keep) {
145
155
  const folder = mapsDir(dir);
156
+ const pinned = new Set((await readPins(dir)).map(([, m]) => `${m}.json`));
146
157
  const files = [];
147
158
  for (const name of await readdir(folder)) {
148
- if (!MAP_FILE.test(name))
159
+ if (!MAP_FILE.test(name) || pinned.has(name))
149
160
  continue;
150
161
  try {
151
162
  files.push({ name, at: (await stat(join(folder, name))).mtimeMs });
@@ -240,3 +251,59 @@ export async function rememberGameMap(dir, gameId, mapId) {
240
251
  return false;
241
252
  }
242
253
  }
254
+ /** #586: the pins, loosely: unusable entries are dropped. */
255
+ async function readPins(dir) {
256
+ try {
257
+ const raw = JSON.parse(await readFile(pinsPath(dir), 'utf8'));
258
+ if (!isRec(raw) || raw.version !== VERSION || !Array.isArray(raw.pins))
259
+ return [];
260
+ return raw.pins.filter((e) => Array.isArray(e) && e.length === 2 && isInt(e[0]) && isInt(e[1]));
261
+ }
262
+ catch {
263
+ return [];
264
+ }
265
+ }
266
+ /** #586: the map ids pinned by a game's decision log. Never throws. */
267
+ export async function pinnedMapIds(dir) {
268
+ return new Set((await readPins(dir)).map(([, m]) => m));
269
+ }
270
+ /**
271
+ * #586: pin `mapId` for `gameId` (a game with a decision log), so the stored map is never evicted while the log is
272
+ * kept; an existing pin for the game is moved to the newest. `true` when written (`false` when already pinned so,
273
+ * or on failure); never throws.
274
+ */
275
+ export async function pinStoredMap(dir, mapId, gameId) {
276
+ try {
277
+ return await withPathLock(pinsPath(dir), async () => {
278
+ const pins = await readPins(dir);
279
+ if (pins.some(([g, m]) => g === gameId && m === mapId))
280
+ return false;
281
+ const next = pins.filter(([g]) => g !== gameId);
282
+ next.push([gameId, mapId]);
283
+ await writeJsonAtomic(pinsPath(dir), mapsDir(dir), { version: VERSION, pins: next.slice(-MAX_PINNED_GAMES) });
284
+ return true;
285
+ });
286
+ }
287
+ catch {
288
+ return false;
289
+ }
290
+ }
291
+ /** #586: drop the pins of `gameIds` (their decision logs were pruned). `true` when written; never throws. */
292
+ export async function unpinGames(dir, gameIds) {
293
+ if (!gameIds.length)
294
+ return false;
295
+ const gone = new Set(gameIds);
296
+ try {
297
+ return await withPathLock(pinsPath(dir), async () => {
298
+ const pins = await readPins(dir);
299
+ const next = pins.filter(([g]) => !gone.has(g));
300
+ if (next.length === pins.length)
301
+ return false;
302
+ await writeJsonAtomic(pinsPath(dir), mapsDir(dir), { version: VERSION, pins: next });
303
+ return true;
304
+ });
305
+ }
306
+ catch {
307
+ return false;
308
+ }
309
+ }
@@ -97,7 +97,7 @@ export async function reviewGame(dir, gameId, opts = {}) {
97
97
  const found = await findFinished(dir, salt, gameId, cached, game);
98
98
  const me = cached ?? found.me;
99
99
  const finished = typeof found.record === 'object' ? found.record : null;
100
- const mapId = finished?.mapId ?? game?.settings?.mapId;
100
+ const mapId = finished?.mapId ?? game?.settings?.mapId ?? log?.mapId;
101
101
  const stored = mapId !== undefined ? await readStoredMap(dir, mapId, { maxAgeMs: Number.POSITIVE_INFINITY }) : undefined;
102
102
  const key = salt && me !== undefined ? finishedGameKey(salt, me, gameId) : undefined;
103
103
  const mapRecord = mapId !== undefined ? keyedEntry(mapRecordPath(dir, mapId), await readMapRecord(dir, mapId), key) : { state: 'missing', value: null };
@@ -19,9 +19,11 @@
19
19
  // `pickWarningCode`), `capturePicksSent` (warapp_submit_picks after a send) and `capturePicksAward` (the award
20
20
  // `loadAward` reads on turn 1, once).
21
21
  import { createHash } from 'node:crypto';
22
+ import { existsSync } from 'node:fs';
22
23
  import { parseFeedTime } from '../normalize.js';
23
24
  import { bonusTerritories } from '../analysis/bonuses.js';
24
25
  import { policyChecks } from '../open-games.js';
26
+ import { pinStoredMap } from '../map-store.js';
25
27
  import { nameFreeSettings } from '../replay.js';
26
28
  import { readSeenTurn } from '../turn-orders.js';
27
29
  import { recordPicksAdvice, recordPicksAward, recordPicksSent, decisionLogMode, decisionLogOwner, decisionLogPath, decisionOutcome, recordGameEvent, recordJoin, recordOpponentRead, recordSeats, fillOutcome, recordChat, recordCheck, recordDecision, recordObservations, recordSeenTurn, recordSubmission, } from '../decision-log.js';
@@ -36,8 +38,10 @@ export async function capturePlan(ctx, a) {
36
38
  if (!ctx.dataDir)
37
39
  return;
38
40
  const opts = modeOf(ctx);
39
- await recordDecision(ctx.dataDir, a.gameId, a.me, {
41
+ const mapId = a.graph.map.id;
42
+ const wrote = await recordDecision(ctx.dataDir, a.gameId, a.me, {
40
43
  turn: a.turn,
44
+ mapId,
41
45
  board: a.board,
42
46
  ...(a.plannedBoard ? { plannedBoard: a.plannedBoard } : {}),
43
47
  input: a.input,
@@ -50,6 +54,9 @@ export async function capturePlan(ctx, a) {
50
54
  ...(a.cards ? { cards: a.cards } : {}),
51
55
  ...(a.times ? { times: a.times } : {}),
52
56
  }, opts);
57
+ // #586: keep the map of every game with a decision log, so its turns can be replayed offline.
58
+ if (wrote || existsSync(decisionLogPath(ctx.dataDir, a.gameId)))
59
+ await pinStoredMap(ctx.dataDir, mapId, a.gameId);
53
60
  if (a.turn < 2)
54
61
  return;
55
62
  try {
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Single source of truth for the server version. release-please bumps the
2
2
  // literal on the marked line (registered in release-please-config.json
3
3
  // extra-files); every other module imports VERSION from here.
4
- export const VERSION = '0.16.0'; // x-release-please-version
4
+ export const VERSION = '0.17.0'; // x-release-please-version
package/manifest.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifest_version": "0.3",
4
4
  "name": "warapp-mcp",
5
5
  "display_name": "war.app (Warzone)",
6
- "version": "0.16.0",
6
+ "version": "0.17.0",
7
7
  "description": "war.app (Warzone) game advisor for Claude — your games, maps, bonuses, board analysis and routes via the GameFeed API, plus your games list (waiting on you first), opponent scouting with your head-to-head, the live board, territory picks, cards, turn planning and submission, turn notifications, and chat through your signed-in war.app tab (ContextMint Bridge). Joining, leaving or surrendering a game, closing out a finished game, accepting another player's surrender, Begin on a speed first turn, picks, turn orders, withdrawing them, chat sends, marking notifications and chat read, deleting notifications, importing local history into a hosted server and linking a session (local only) are confirm-gated.",
8
8
  "author": {
9
9
  "name": "Chris Hall",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrischall/warapp-mcp",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "mcpName": "io.github.chrischall/warapp-mcp",
5
5
  "description": "war.app (Warzone) game advisor MCP server for Claude — games, maps, bonuses and board analysis via the GameFeed API, plus your games list, opponent scouting, the live board, territory picks, cards, turn planning and submission, turn notifications and chat through your signed-in war.app tab. Developed and maintained by AI (Claude Code).",
6
6
  "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/chrischall/warapp-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.16.0",
9
+ "version": "0.17.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.16.0",
14
+ "version": "0.17.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },