@chrischall/warapp-mcp 0.23.1 → 0.24.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 (creating, joining, leaving or surrendering a game, accepting game invitations, closing out a finished game, accepting another player's surrender, a team surrender, a vote to end a game, booting a stalled player, Begin on a speed first turn, picks, turn orders, withdrawing them, chat sends, nudging a player, joining or leaving a ladder, answering a clan invite, joining or leaving a clan, changing quickmatch settings, voting on quickmatch templates, joining or declining a tournament, showing a tournament among your favourites, mail (new threads, replies, adding players, deleting threads), forum posts (new threads, replies, votes, watching a thread), chat reactions, marking notifications and chat read, deleting notifications, importing local history and linking a session are confirm-gated).",
10
- "version": "0.23.1"
10
+ "version": "0.24.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.23.1",
18
+ "version": "0.24.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.23.1",
4
+ "version": "0.24.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",
@@ -296,6 +296,60 @@ export function openingFlags(input) {
296
296
  const bt = input.booted?.turn ?? null;
297
297
  return { noOrderTurns, bootedTurn: bt !== null && bt >= 1 && bt <= window ? bt : null };
298
298
  }
299
+ /**
300
+ * #506: the territories `player` held on history board N − 1 and another player (not a neutral, not one of
301
+ * `allies`) held on board N, for N in 1..`window` — land taken from it in the opening. A turn the history lacks
302
+ * is not read. Pure.
303
+ */
304
+ export function openingLosses(input) {
305
+ const window = input.window ?? OPENING_WINDOW;
306
+ const boards = new Map(input.history.map((b) => [b.turn, b.board]));
307
+ const friends = new Set([input.player, ...(input.allies ?? [])]);
308
+ let territories = 0;
309
+ const turns = [];
310
+ for (let n = 1; n <= window; n++) {
311
+ const before = boards.get(n - 1);
312
+ const after = boards.get(n);
313
+ if (!before || !after)
314
+ continue;
315
+ const had = landOf(before, input.player);
316
+ let lost = 0;
317
+ for (const t of after.territories)
318
+ if (had.has(t.territoryId) && t.owner.kind === 'player' && !friends.has(t.owner.playerId))
319
+ lost++;
320
+ if (lost) {
321
+ territories += lost;
322
+ turns.push(n);
323
+ }
324
+ }
325
+ return { territories, turns };
326
+ }
327
+ function lossAggregate(entries) {
328
+ const won = entries.filter((e) => e.winner !== null);
329
+ return {
330
+ games: entries.length,
331
+ withWinner: won.length,
332
+ iWon: entries.filter((e) => e.iWon).length,
333
+ iLost: entries.filter((e) => e.mine.territories > 0).length,
334
+ winnerLost: won.filter((e) => e.winner.territories > 0).length,
335
+ myTerritories: entries.reduce((n, e) => n + e.mine.territories, 0),
336
+ winnerTerritories: won.reduce((n, e) => n + e.winner.territories, 0),
337
+ };
338
+ }
339
+ /** #506: the opening losses by era, then format. Pure. */
340
+ export function earlyLossesByEra(entries) {
341
+ const out = {};
342
+ for (const era of ['pre-tool', 'pre-rule-4f', 'current']) {
343
+ const of = entries.filter((e) => e.era === era);
344
+ if (!of.length)
345
+ continue;
346
+ const byFormat = {};
347
+ for (const f of [...new Set(of.map((e) => e.format))].sort())
348
+ byFormat[f] = lossAggregate(of.filter((e) => e.format === f));
349
+ out[era] = { all: lossAggregate(of), byFormat };
350
+ }
351
+ return out;
352
+ }
299
353
  /** A map this many times the median map's territories or more is counted as large. */
300
354
  export const LARGE_MAP_FACTOR = 5;
301
355
  /** The benchmarks grouped by era, then format; flagged games apart; how many eras were read from which basis. Pure. */
@@ -9,8 +9,8 @@ export const MAX_NO_ATTACK_TURNS = 10;
9
9
  export const MAX_MESSAGE_COMMITMENTS = 10;
10
10
  /**
11
11
  * Why a propose, accept or notice with `partner` cannot go to `audience`: the partner would never read
12
- * it. `undefined` when it reads it (the private recipient, anyone on the public channel, a player on the
13
- * team the message goes to).
12
+ * it. `undefined` when it reads it (the private recipient, a member of the game group, anyone on the public
13
+ * channel, a player on the team the message goes to).
14
14
  */
15
15
  export function audienceRefusal(audience, partner, players) {
16
16
  if (audience.kind === 'public')
@@ -19,6 +19,12 @@ export function audienceRefusal(audience, partner, players) {
19
19
  return audience.to === partner
20
20
  ? undefined
21
21
  : `the message goes privately to player ${audience.to}, so player ${partner}, the truce's partner, would never read it (D3: a truce changes only with the partner told)`;
22
+ if (audience.kind === 'group') {
23
+ const ids = audience.to.length > 1 ? `${audience.to.slice(0, -1).join(', ')} and ${audience.to.at(-1)}` : String(audience.to[0]);
24
+ return audience.to.includes(partner)
25
+ ? undefined
26
+ : `the message goes to a group of players ${ids}, so player ${partner}, the truce's partner, would never read it (D3: a truce changes only with the partner told)`;
27
+ }
22
28
  const p = players.find((x) => x.id === partner);
23
29
  return p?.team === audience.team
24
30
  ? undefined
@@ -16,18 +16,29 @@ const MIN_TRACK_CALIBRATION_SAMPLES = 5;
16
16
  * that the full correction would put half the estimates above the truth.
17
17
  */
18
18
  export const TRACK_CALIBRATION_DAMPING = 0.5;
19
+ /**
20
+ * #568 (owner decision 2026-11-29): a free-for-all damps less. Its 11-game calibration read the plan's estimates
21
+ * at 0.51× the truth (half under 0.5×, none over 1.5×) against 1.06× in 1v1 and 0.83× in team games; leave one
22
+ * game out on its 4 free-for-alls, 0.75 lifted the 25–50% band's tracked figure from 0.48× to 0.57× the truth
23
+ * with no more over 1.5× (15%). Team games keep {@link TRACK_CALIBRATION_DAMPING}.
24
+ */
25
+ export const FFA_TRACK_CALIBRATION_DAMPING = 0.75;
26
+ /** #568: the damping a format's tracked figures are calibrated with ({@link FFA_TRACK_CALIBRATION_DAMPING}). */
27
+ export function trackCalibrationDampingFor(format) {
28
+ return format === 'ffa' ? FFA_TRACK_CALIBRATION_DAMPING : TRACK_CALIBRATION_DAMPING;
29
+ }
19
30
  /**
20
31
  * #568: the factor a tracked figure read from `share` of its frontier is divided by: its coverage band's past
21
- * geometric mean of estimate ÷ truth (`calibration`, from lessons.json) to the {@link TRACK_CALIBRATION_DAMPING}
22
- * power; `undefined` when the band has under {@link MIN_TRACK_CALIBRATION_SAMPLES} samples or read at least the
32
+ * geometric mean of estimate ÷ truth (`calibration`, from lessons.json) to the `damping` power (by default
33
+ * {@link TRACK_CALIBRATION_DAMPING}; {@link trackCalibrationDampingFor}); `undefined` when the band has under {@link MIN_TRACK_CALIBRATION_SAMPLES} samples or read at least the
23
34
  * truth (the correction only ever raises).
24
35
  */
25
- export function trackCalibrationFactor(calibration, share) {
36
+ export function trackCalibrationFactor(calibration, share, damping = TRACK_CALIBRATION_DAMPING) {
26
37
  const band = coverageBucket(share);
27
38
  const c = calibration?.[band];
28
39
  if (!c || c.n < MIN_TRACK_CALIBRATION_SAMPLES || !(c.geoMean > 0) || c.geoMean >= 1)
29
40
  return undefined;
30
- return { band, geoMean: c.geoMean, n: c.n, factor: c.geoMean ** TRACK_CALIBRATION_DAMPING };
41
+ return { band, geoMean: c.geoMean, n: c.n, factor: c.geoMean ** damping, damping };
31
42
  }
32
43
  /**
33
44
  * The army count every visible player territory holds, when they all hold the same one (the
@@ -309,10 +320,10 @@ export function enemyDeployEstimates(g, board, me, settings = {}, previous, trac
309
320
  // lowered). The #123 bound above keeps the tracker's own figure.
310
321
  let trackCalibration = null;
311
322
  if (usable && tracked !== null && tracked > 0) {
312
- const c = trackCalibrationFactor(when.calibration, coverage ? coverage.share : null);
323
+ const c = trackCalibrationFactor(when.calibration, coverage ? coverage.share : null, when.damping);
313
324
  const figure = c ? Math.min(Math.max(couldEarn, tracked), Math.round(tracked / c.factor)) : tracked;
314
325
  if (c && figure > tracked) {
315
- trackCalibration = { raw: tracked, band: c.band, geoMean: c.geoMean, n: c.n, factor: c.factor, figure };
326
+ trackCalibration = { raw: tracked, band: c.band, geoMean: c.geoMean, n: c.n, factor: c.factor, damping: c.damping, figure };
316
327
  tracked = figure;
317
328
  }
318
329
  }
@@ -99,6 +99,7 @@ export function planEnemyEstimates(input) {
99
99
  ...(ctx.reinforcementPlays ? { plays: ctx.reinforcementPlays } : {}),
100
100
  ...(previousBoard && input.previousOrders ? { previousOrders: input.previousOrders } : {}),
101
101
  ...(ctx.trackCalibration ? { calibration: ctx.trackCalibration } : {}),
102
+ ...(ctx.trackCalibrationDamping !== undefined ? { damping: ctx.trackCalibrationDamping } : {}),
102
103
  });
103
104
  const priced = applyKnown(applyArmyPrice(applySanctions(estimates, input.sanctions ?? [], turn), input.settings?.armyCostMultiplier ?? 0), input.known ?? []);
104
105
  return { estimates: priced, prior, ...(skipped ? { priorSkipped: skipped } : {}) };
@@ -1130,7 +1130,7 @@ export function borderThreats(pc, ps, input, src, forces) {
1130
1130
  // #568: the tracked figure raised by past games' calibration in its coverage band.
1131
1131
  if (e.trackCalibration) {
1132
1132
  const c = e.trackCalibration;
1133
- warnings.push(`Player ${p}'s tracked income ~${c.raw} is raised to ~${c.figure} (#568, draft): past games' tracker read ${c.geoMean.toFixed(2)}× the true income at this frontier coverage (${c.band}, ${c.n} samples), divided by its square root (${c.factor.toFixed(2)}).`);
1133
+ warnings.push(`Player ${p}'s tracked income ~${c.raw} is raised to ~${c.figure} (#568, draft): past games' tracker read ${c.geoMean.toFixed(2)}× the true income at this frontier coverage (${c.band}, ${c.n} samples), divided by ${c.damping === 0.5 ? 'its square root' : `it to the ${c.damping} power`} (${c.factor.toFixed(2)}).`);
1134
1134
  }
1135
1135
  // #427: a card play the tracker read as income, taken out of its figure.
1136
1136
  if (e.cardInTrack) {