@chrischall/warapp-mcp 0.22.0 → 0.22.1

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.22.0"
10
+ "version": "0.22.1"
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.22.0",
18
+ "version": "0.22.1",
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.22.0",
4
+ "version": "0.22.1",
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",
@@ -23,6 +23,13 @@ export function guardOffExposure(args) {
23
23
  for (const d of args.deploys)
24
24
  if (left.has(d.territoryId))
25
25
  left.set(d.territoryId, left.get(d.territoryId) + d.armies);
26
+ for (const a of args.airlifts ?? []) {
27
+ if (!left.has(a.from) || !left.has(a.to))
28
+ continue;
29
+ const sent = Math.min(a.armies, left.get(a.from));
30
+ left.set(a.from, left.get(a.from) - sent);
31
+ left.set(a.to, left.get(a.to) + sent);
32
+ }
26
33
  for (const m of args.moves) {
27
34
  if (left.has(m.from))
28
35
  left.set(m.from, Math.max(0, left.get(m.from) - m.armies));
@@ -87,6 +87,7 @@ export function headroomTable(input) {
87
87
  ...(input.settings ? { settings: input.settings } : {}),
88
88
  ...(teams ? { teams } : {}),
89
89
  ...(input.orderPriority ? { orderPriority: [me] } : {}),
90
+ ...(input.airlifts?.length ? { airlifts: input.airlifts.map((a) => ({ player: me, ...a })) } : {}),
90
91
  });
91
92
  /**
92
93
  * The filler counts worth trying for an attack from `s` on `b`: the attack, as the opponent's order
@@ -1179,14 +1179,21 @@ export function floorTier(pc, ps, book, threats, hb, prev) {
1179
1179
  * `'untrusted'` (#275 b): the same, before any capture, for each contested unit a border of which faces
1180
1180
  * an opponent whose estimate a tripwire broke (sized for its untrusted figure), whether or not it pays
1181
1181
  * back: while the estimate is untrusted the gate is held before expansion, never left to what it leaves.
1182
+ * `'floored'` (rule 0p.1, a 1v1 in contact, after the whole holds and before the first advance): the
1183
+ * floored units only, whole where what is left covers them, else the rest spread over their borders —
1184
+ * an advance that completes nothing this turn never takes the armies a floored home bonus could use.
1185
+ * The other contested units, and the warnings, wait for the call after the captures.
1182
1186
  */
1183
1187
  const settleContested = (mode = false) => {
1184
- const wholeOnly = mode !== false;
1188
+ const wholeOnly = mode === true || mode === 'untrusted';
1189
+ const flooredOnly = mode === 'floored';
1185
1190
  const facesUntrusted = (u) => u.members.some((m) => {
1186
1191
  const b = borders.get(m.id);
1187
1192
  return !heldBorders.has(m.id) && b !== undefined && pc.untrustedAt(b.player, m.id) > 0;
1188
1193
  });
1189
- const open = units.filter((u) => u.contested && !u.conceded && (mode === 'untrusted' ? facesUntrusted(u) : !wholeOnly || u.loss !== 'payback'));
1194
+ const open = units.filter((u) => u.contested &&
1195
+ !u.conceded &&
1196
+ (flooredOnly ? u.floored : mode === 'untrusted' ? facesUntrusted(u) : !wholeOnly || u.loss !== 'payback'));
1190
1197
  if (!open.length) {
1191
1198
  if (mode === 'untrusted')
1192
1199
  fillUntrustedGates([]);
@@ -1252,11 +1259,13 @@ export function floorTier(pc, ps, book, threats, hb, prev) {
1252
1259
  ? `more than ${CONCEDE_FACTOR} × its worth`
1253
1260
  : null;
1254
1261
  if (more <= ps.budget &&
1255
- fundUnit(u, undefined, `Hold bonus ${bonusName(u.bonusId)} (+${u.value}) whole: ${floored ? 'past its floor ' : ''}its ${unitBorders(u)} need${u.members.length === 1 ? 's' : ''} ${more}${floored ? ' more' : ''}${why ? ` (${why})` : ''}, ${mode === 'untrusted'
1256
- ? `before any capture: player ${[...new Set(u.members.flatMap((m) => { const b = borders.get(m.id); return b && pc.untrustedAt(b.player, m.id) > 0 ? [b.player] : []; }))].sort((a, b) => a - b).join(', ')}'s estimate is untrusted (#275), so the border is held ahead of expansion.`
1257
- : wholeOnly
1258
- ? 'before any expansion that completes no bonus (1v1 in contact: an advance ranks below every hold).'
1259
- : 'and nothing else this turn uses those armies.'}`)) {
1262
+ fundUnit(u, undefined, `Hold bonus ${bonusName(u.bonusId)} (+${u.value}) whole: ${floored ? 'past its floor ' : ''}its ${unitBorders(u)} need${u.members.length === 1 ? 's' : ''} ${more}${floored ? ' more' : ''}${why ? ` (${why})` : ''}, ${flooredOnly
1263
+ ? 'before any expansion that completes no bonus (1v1 in contact: a home bonus under attack comes before a far advance).'
1264
+ : mode === 'untrusted'
1265
+ ? `before any capture: player ${[...new Set(u.members.flatMap((m) => { const b = borders.get(m.id); return b && pc.untrustedAt(b.player, m.id) > 0 ? [b.player] : []; }))].sort((a, b) => a - b).join(', ')}'s estimate is untrusted (#275), so the border is held ahead of expansion.`
1266
+ : wholeOnly
1267
+ ? 'before any expansion that completes no bonus (1v1 in contact: an advance ranks below every hold).'
1268
+ : 'and nothing else this turn uses those armies.'}`)) {
1260
1269
  u.contested = false;
1261
1270
  continue;
1262
1271
  }
@@ -1277,7 +1286,7 @@ export function floorTier(pc, ps, book, threats, hb, prev) {
1277
1286
  if (wholeOnly)
1278
1287
  return;
1279
1288
  const short = units
1280
- .filter((u) => u.contested && !u.conceded)
1289
+ .filter((u) => u.contested && !u.conceded && (!flooredOnly || u.floored))
1281
1290
  .flatMap((u) => u.members.filter((m) => !heldBorders.has(m.id)).map((m) => ({ m, u })));
1282
1291
  const value = (m) => Math.max(...short.filter((x) => x.m === m).map((x) => x.u.value));
1283
1292
  const members = [...new Set(short.map((x) => x.m))];
@@ -1301,6 +1310,14 @@ export function floorTier(pc, ps, book, threats, hb, prev) {
1301
1310
  for (const m of members)
1302
1311
  if (m.holdCost <= 0)
1303
1312
  heldBorders.add(m.id);
1313
+ if (flooredOnly && given.size)
1314
+ rationale.push(`1v1 in contact: what is left goes to the borders of ${[...new Set(short.map((x) => x.u))].map((u) => `${bonusName(u.bonusId)} (+${u.value})`).join(', ')} before any advance that completes nothing this turn — a home bonus the opponent's one stack can break is worth more than a far step toward another.`);
1315
+ if (flooredOnly) {
1316
+ for (const u of open)
1317
+ if (u.members.every((m) => heldBorders.has(m.id)))
1318
+ u.contested = false;
1319
+ return;
1320
+ }
1304
1321
  const stillShort = [];
1305
1322
  for (const u of units) {
1306
1323
  if (!u.contested || u.conceded)
@@ -2844,6 +2844,8 @@ function planPass(input, pass) {
2844
2844
  };
2845
2845
  /** #215, rule 0p.1: the contested units were held whole (where they fit) before the first advance. */
2846
2846
  let contestedDue = false;
2847
+ /** Lost 1v1 (2026-11-27): the floored units took what was left before the first advance. */
2848
+ let flooredDue = false;
2847
2849
  /** #275 (b): the contested units facing an untrusted opponent were held whole (where they fit) before the first capture. */
2848
2850
  let untrustedDue = false;
2849
2851
  candidates.forEach((c, i) => {
@@ -2862,6 +2864,14 @@ function planPass(input, pass) {
2862
2864
  contestedDue = true;
2863
2865
  settleContested(true);
2864
2866
  }
2867
+ // Lost 1v1 (2026-11-27): a home bonus that cannot be held whole was floored and the rest went to a
2868
+ // bonus 21 armies from done; the opponent broke it with one stack. In a 1v1 in contact the floored
2869
+ // units' borders take what is left before any advance that completes nothing (a #417 race still
2870
+ // goes first: it ranks ahead of the holds by the owner's decision).
2871
+ if (oneVsOne && (c.kind === 'advance' || c.kind === 'stage') && !c.focus && !flooredDue) {
2872
+ flooredDue = true;
2873
+ settleContested('floored');
2874
+ }
2865
2875
  if (completesNothing(c) && !c.focus && !unitsDue) {
2866
2876
  unitsDue = true;
2867
2877
  // Those waiting for the expansion share outscore everything still to run.
package/dist/bundle.js CHANGED
@@ -104861,13 +104861,14 @@ function floorTier(pc, ps, book, threats, hb, prev) {
104861
104861
  }
104862
104862
  };
104863
104863
  const settleContested = (mode = false) => {
104864
- const wholeOnly = mode !== false;
104864
+ const wholeOnly = mode === true || mode === "untrusted";
104865
+ const flooredOnly = mode === "floored";
104865
104866
  const facesUntrusted = (u) => u.members.some((m) => {
104866
104867
  const b = borders.get(m.id);
104867
104868
  return !heldBorders.has(m.id) && b !== void 0 && pc.untrustedAt(b.player, m.id) > 0;
104868
104869
  });
104869
104870
  const open5 = units.filter(
104870
- (u) => u.contested && !u.conceded && (mode === "untrusted" ? facesUntrusted(u) : !wholeOnly || u.loss !== "payback")
104871
+ (u) => u.contested && !u.conceded && (flooredOnly ? u.floored : mode === "untrusted" ? facesUntrusted(u) : !wholeOnly || u.loss !== "payback")
104871
104872
  );
104872
104873
  if (!open5.length) {
104873
104874
  if (mode === "untrusted") fillUntrustedGates([]);
@@ -104920,7 +104921,7 @@ function floorTier(pc, ps, book, threats, hb, prev) {
104920
104921
  if (more <= ps.budget && fundUnit(
104921
104922
  u,
104922
104923
  void 0,
104923
- `Hold bonus ${bonusName(u.bonusId)} (+${u.value}) whole: ${floored ? "past its floor " : ""}its ${unitBorders(u)} need${u.members.length === 1 ? "s" : ""} ${more}${floored ? " more" : ""}${why ? ` (${why})` : ""}, ${mode === "untrusted" ? `before any capture: player ${[...new Set(u.members.flatMap((m) => {
104924
+ `Hold bonus ${bonusName(u.bonusId)} (+${u.value}) whole: ${floored ? "past its floor " : ""}its ${unitBorders(u)} need${u.members.length === 1 ? "s" : ""} ${more}${floored ? " more" : ""}${why ? ` (${why})` : ""}, ${flooredOnly ? "before any expansion that completes no bonus (1v1 in contact: a home bonus under attack comes before a far advance)." : mode === "untrusted" ? `before any capture: player ${[...new Set(u.members.flatMap((m) => {
104924
104925
  const b = borders.get(m.id);
104925
104926
  return b && pc.untrustedAt(b.player, m.id) > 0 ? [b.player] : [];
104926
104927
  }))].sort((a, b) => a - b).join(", ")}'s estimate is untrusted (#275), so the border is held ahead of expansion.` : wholeOnly ? "before any expansion that completes no bonus (1v1 in contact: an advance ranks below every hold)." : "and nothing else this turn uses those armies."}`
@@ -104937,7 +104938,7 @@ function floorTier(pc, ps, book, threats, hb, prev) {
104937
104938
  }
104938
104939
  if (mode === "untrusted") fillUntrustedGates(open5.filter((u) => u.contested));
104939
104940
  if (wholeOnly) return;
104940
- const short = units.filter((u) => u.contested && !u.conceded).flatMap((u) => u.members.filter((m) => !heldBorders.has(m.id)).map((m) => ({ m, u })));
104941
+ const short = units.filter((u) => u.contested && !u.conceded && (!flooredOnly || u.floored)).flatMap((u) => u.members.filter((m) => !heldBorders.has(m.id)).map((m) => ({ m, u })));
104941
104942
  const value = (m) => Math.max(...short.filter((x) => x.m === m).map((x) => x.u.value));
104942
104943
  const members2 = [...new Set(short.map((x) => x.m))];
104943
104944
  const given2 = /* @__PURE__ */ new Map();
@@ -104957,6 +104958,14 @@ function floorTier(pc, ps, book, threats, hb, prev) {
104957
104958
  m.holdCost <= 0 ? `Deploy ${n} more to ${label3(m.id)} so it holds (${m.have} armies, ${toTake(m.have + m.units)} to take, above the ~${m.threat} threat).` : `Deploy ${n} more to ${label3(m.id)} against the one shared deploy: ${m.have} armies, so player ${borders.get(m.id)?.player}'s deploy needs ${breakCost(m)} of its ~${deployShare(m)} there to take it.`
104958
104959
  );
104959
104960
  for (const m of members2) if (m.holdCost <= 0) heldBorders.add(m.id);
104961
+ if (flooredOnly && given2.size)
104962
+ rationale.push(
104963
+ `1v1 in contact: what is left goes to the borders of ${[...new Set(short.map((x) => x.u))].map((u) => `${bonusName(u.bonusId)} (+${u.value})`).join(", ")} before any advance that completes nothing this turn \u2014 a home bonus the opponent's one stack can break is worth more than a far step toward another.`
104964
+ );
104965
+ if (flooredOnly) {
104966
+ for (const u of open5) if (u.members.every((m) => heldBorders.has(m.id))) u.contested = false;
104967
+ return;
104968
+ }
104960
104969
  const stillShort = [];
104961
104970
  for (const u of units) {
104962
104971
  if (!u.contested || u.conceded) continue;
@@ -107920,6 +107929,12 @@ function guardOffExposure(args) {
107920
107929
  const left = /* @__PURE__ */ new Map();
107921
107930
  for (const t of board.territories) if (isMine3(t.territoryId)) left.set(t.territoryId, t.armies ?? 0);
107922
107931
  for (const d of args.deploys) if (left.has(d.territoryId)) left.set(d.territoryId, left.get(d.territoryId) + d.armies);
107932
+ for (const a of args.airlifts ?? []) {
107933
+ if (!left.has(a.from) || !left.has(a.to)) continue;
107934
+ const sent = Math.min(a.armies, left.get(a.from));
107935
+ left.set(a.from, left.get(a.from) - sent);
107936
+ left.set(a.to, left.get(a.to) + sent);
107937
+ }
107923
107938
  for (const m of args.moves) {
107924
107939
  if (left.has(m.from)) left.set(m.from, Math.max(0, left.get(m.from) - m.armies));
107925
107940
  if (left.has(m.to)) left.set(m.to, left.get(m.to) + m.armies);
@@ -113103,6 +113118,7 @@ function planPass(input2, pass) {
113103
113118
  for (const c of postponed.splice(0)) c.run();
113104
113119
  };
113105
113120
  let contestedDue = false;
113121
+ let flooredDue = false;
113106
113122
  let untrustedDue = false;
113107
113123
  candidates2.forEach((c, i2) => {
113108
113124
  if (done.has(c)) return;
@@ -113114,6 +113130,10 @@ function planPass(input2, pass) {
113114
113130
  contestedDue = true;
113115
113131
  settleContested(true);
113116
113132
  }
113133
+ if (oneVsOne && (c.kind === "advance" || c.kind === "stage") && !c.focus && !flooredDue) {
113134
+ flooredDue = true;
113135
+ settleContested("floored");
113136
+ }
113117
113137
  if (completesNothing(c) && !c.focus && !unitsDue) {
113118
113138
  unitsDue = true;
113119
113139
  for (const u of waiting.splice(0)) fundOrConcede(u);
@@ -116144,7 +116164,7 @@ function serverBuild() {
116144
116164
  }
116145
116165
 
116146
116166
  // src/version.ts
116147
- var VERSION2 = "0.22.0";
116167
+ var VERSION2 = "0.22.1";
116148
116168
 
116149
116169
  // src/decision-log.ts
116150
116170
  var DECISION_LOG_VERSION = 1;
@@ -144908,7 +144928,7 @@ function lessonsSummary(file2) {
144908
144928
  }
144909
144929
  return { games, byFormat, calibration: calibrationSummary(all2), ...excludedCounts(file2.excluded) };
144910
144930
  }
144911
- function outlookCalibration(file2, format, min) {
144931
+ function outlookCalibration(file2, format, min, opts = {}) {
144912
144932
  let all2 = {};
144913
144933
  for (const f of PROFILE_FORMATS) {
144914
144934
  const t = file2.byFormat[f];
@@ -144917,7 +144937,7 @@ function outlookCalibration(file2, format, min) {
144917
144937
  const own2 = file2.byFormat[format]?.calibration ?? {};
144918
144938
  const out = {};
144919
144939
  for (const k of COVERAGE_BUCKETS) {
144920
- const x = (own2[k]?.n ?? 0) >= min ? own2[k] : all2[k];
144940
+ const x = (own2[k]?.n ?? 0) >= min ? own2[k] : opts.ownOnly ? void 0 : all2[k];
144921
144941
  if (!x || x.n < min) continue;
144922
144942
  out[k] = { geoMean: r2(Math.exp(x.logSum / x.n)), n: x.n };
144923
144943
  }
@@ -146653,6 +146673,17 @@ async function outlookCalibrationFor(dataDir2, env, format) {
146653
146673
  return void 0;
146654
146674
  }
146655
146675
  }
146676
+ async function trackCalibrationFor(dataDir2, env, format) {
146677
+ if (format === "1v1" || !dataDir2 || !profileEnabled(env ?? process.env)) return void 0;
146678
+ try {
146679
+ const file2 = await readLessons(dataDir2);
146680
+ if (file2 === "unreadable") return void 0;
146681
+ const c = outlookCalibration(file2, format, MIN_CALIBRATION_SAMPLES, { ownOnly: true });
146682
+ return Object.keys(c).length ? c : void 0;
146683
+ } catch {
146684
+ return void 0;
146685
+ }
146686
+ }
146656
146687
 
146657
146688
  // src/analysis/whereabouts.ts
146658
146689
  var REACH_HORIZON = 12;
@@ -149530,7 +149561,7 @@ function baitAttackWarning(input2) {
149530
149561
  const byTarget = /* @__PURE__ */ new Map();
149531
149562
  for (const m of input2.moves) {
149532
149563
  const t = standing.get(m.to.id);
149533
- if (m.mode === "transfer-only" || !t || t.fogged || t.owner === me || t.owner < 0) continue;
149564
+ if (m.mode === "transfer-only" || !t || t.fogged || t.owner === me || t.owner <= OWNER_NEUTRAL) continue;
149534
149565
  if (teammates.has(t.owner) && m.attackTeammates !== true) continue;
149535
149566
  const power = m.armies + (m.commander ? COMMANDER_STRENGTH : 0);
149536
149567
  const g = byTarget.get(m.to.id);
@@ -153594,7 +153625,8 @@ function headroomTable(input2) {
153594
153625
  moveOrder: attack ? first === "me" ? [me, attack.player] : [attack.player, me] : [me],
153595
153626
  ...input2.settings ? { settings: input2.settings } : {},
153596
153627
  ...teams ? { teams } : {},
153597
- ...input2.orderPriority ? { orderPriority: [me] } : {}
153628
+ ...input2.orderPriority ? { orderPriority: [me] } : {},
153629
+ ...input2.airlifts?.length ? { airlifts: input2.airlifts.map((a) => ({ player: me, ...a })) } : {}
153598
153630
  });
153599
153631
  const fillerCounts = (b, s, first) => {
153600
153632
  const n = myOrders.length;
@@ -154398,9 +154430,9 @@ function cityPurchaseOf(game, asked, map2, board, myInGameId2, gold) {
154398
154430
  const note = `Commerce: ${count4} cit${count4 === 1 ? "y" : "ies"} for ${cost} gold (each pays ${rules.cityIncome} gold a turn), ` + (gold.source === "standing" ? `leaving ${left} gold for the deploys. ` : `against the income model's ${gold.gold} gold (your gold could not be read from the board, and saved gold is not in it${left < 0 ? ", so war.app may refuse the purchase: error 597" : ""}). `) + "The purchase order's encoding is read from the client and UNVERIFIED live: check the cities on the board once the turn resolves.";
154399
154431
  return { cities, cost, note };
154400
154432
  }
154401
- function guardOffWarnings(graph, map2, board, me, friends, settings, deploys, moves) {
154433
+ function guardOffWarnings(graph, map2, board, me, friends, settings, deploys, moves, airlifts = []) {
154402
154434
  if (settings?.oneArmyStandsGuard !== false) return [];
154403
- const r = guardOffExposure({ graph, board, me, friends, deploys, moves });
154435
+ const r = guardOffExposure({ graph, board, me, friends, deploys, moves, airlifts });
154404
154436
  const name = namer(map2);
154405
154437
  const out = [];
154406
154438
  if (r.emptied.length) {
@@ -155109,6 +155141,7 @@ async function livePlanSetup(ctx, a) {
155109
155141
  const bonusAttempts = turn !== null && ctx.dataDir ? await readBonusAttempts(ctx.dataDir, game.id, me.id) : void 0;
155110
155142
  const cardArmies = cardArmyCeiling(game.settings);
155111
155143
  const calibration = await outlookCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
155144
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
155112
155145
  const outlookInput = {
155113
155146
  graph,
155114
155147
  me: me.id,
@@ -155160,8 +155193,9 @@ async function livePlanSetup(ctx, a) {
155160
155193
  // #166: the opponent's opening simulated from the starts the award proved, as the prior.
155161
155194
  ...opening ? { opening } : {},
155162
155195
  ...mapPace ? { mapPace } : {},
155163
- // #568: the same calibration raises each tracked figure by its coverage band's damped factor.
155164
- ...calibration ? { trackCalibration: calibration } : {},
155196
+ // #568: this format's own calibration raises each tracked figure by its coverage band's damped factor
155197
+ // (none in a 1v1, where the fog prior already lifts the tracker: trackCalibrationFor).
155198
+ ...trackCalibration ? { trackCalibration } : {},
155165
155199
  // #164: an opponent's Reinforcement card, from the turn the card clock says one can be in hand.
155166
155200
  ...opponentReinforcement(game.settings, hand) ? { reinforcement: opponentReinforcement(game.settings, hand) } : {},
155167
155201
  // #427: the Reinforcement plays seen in the turns' orders (card plays not fogged): a play restarts the clock.
@@ -155605,7 +155639,7 @@ async function commanderCheck(ctx, a) {
155605
155639
  ]);
155606
155640
  const opening = openingThreat(award, a.game, graph, a.seen, a.turn);
155607
155641
  const mapPace = await fogPaceFor(ctx.dataDir, void 0, a.game.settings?.mapId ?? a.map.id, mapMatchOf(profileFormatOf(a.game.players), a.game.settings), a.turn === null ? null : a.turn - 1);
155608
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, void 0, profileFormatOf(a.game.players));
155642
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, void 0, profileFormatOf(a.game.players));
155609
155643
  const so = stressOpponents({
155610
155644
  graph,
155611
155645
  map: a.map,
@@ -156840,6 +156874,9 @@ function registerTurnTools(server, ctx, opts = {}) {
156840
156874
  const { claimed } = teamHandLeft(hand, teamCardClaims(board.teammateOrders, new Set(teammatesOf(game.players, me).map((p) => p.id))));
156841
156875
  const pickFrom = unclaimedFirst(hand, claimed);
156842
156876
  const plays = resolveCardPlays(map2, pickFrom, rules, cardInputs);
156877
+ const submitAirlifts = plays.flatMap(
156878
+ (p) => p.kind === "Airlift" && p.targets?.from && p.targets.to ? [{ from: p.targets.from.id, to: p.targets.to.id, armies: p.targets.armies ?? 0, ...p.targets.commander ? { commander: true } : {} }] : []
156879
+ );
156843
156880
  for (const p of plays) {
156844
156881
  if (p.before !== void 0 && p.before > moves.length + 1) {
156845
156882
  throw new McpToolError(
@@ -157077,7 +157114,8 @@ function registerTurnTools(server, ctx, opts = {}) {
157077
157114
  friendsOf(game.players, me),
157078
157115
  game.settings,
157079
157116
  deploys.map((d) => ({ territoryId: d.territory.id, armies: d.armies })),
157080
- moves.map((m, i2) => ({ from: m.from.id, to: m.to.id, armies: m.percent ? options.estimates.get(i2) ?? 0 : m.armies }))
157117
+ moves.map((m, i2) => ({ from: m.from.id, to: m.to.id, armies: m.percent ? options.estimates.get(i2) ?? 0 : m.armies })),
157118
+ submitAirlifts
157081
157119
  )
157082
157120
  );
157083
157121
  if (handUnknown) warnings.push(UNREADABLE_HAND);
@@ -157183,7 +157221,9 @@ function registerTurnTools(server, ctx, opts = {}) {
157183
157221
  moves: givenMoves,
157184
157222
  settings: plannerSettings(game.settings),
157185
157223
  ...subTeams ? { teams: subTeams } : {},
157186
- ...plays.some((p) => p.kind === "OrderPriority") ? { orderPriority: true } : {}
157224
+ ...plays.some((p) => p.kind === "OrderPriority") ? { orderPriority: true } : {},
157225
+ // #618: the Airlifts land before the moves, as the stress test carries them out.
157226
+ ...submitAirlifts.length ? { airlifts: submitAirlifts } : {}
157187
157227
  });
157188
157228
  warnings.push(...headroomWarnings(headroomRows, modelled, !teamsKnown));
157189
157229
  const belowRows = await bordersBelowPlan(ctx, {
@@ -160857,7 +160897,7 @@ function registerCheckPlanTool(server, ctx) {
160857
160897
  const opening = openingThreat(award, game, graph, seen2, turn);
160858
160898
  const settings = plannerSettings(game.settings);
160859
160899
  const mapPace = await fogPaceFor(ctx.dataDir, void 0, game.settings?.mapId ?? map2.id, mapMatchOf(profileFormatOf(game.players), game.settings), turn === null ? null : turn - 1);
160860
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, void 0, profileFormatOf(game.players));
160900
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, void 0, profileFormatOf(game.players));
160861
160901
  const deploys = [];
160862
160902
  const moves = [];
160863
160903
  const refused = /* @__PURE__ */ new Set();
@@ -161218,7 +161258,9 @@ function registerCheckPlanTool(server, ctx) {
161218
161258
  settings,
161219
161259
  ...teams.size ? { teams } : {},
161220
161260
  ...first_mover !== void 0 ? { firstMover: first_mover } : {},
161221
- orderPriority
161261
+ orderPriority,
161262
+ // #618: the Airlifts land before the moves, as the stress test above carries them out.
161263
+ ...airlifts.length ? { airlifts } : {}
161222
161264
  });
161223
161265
  const belowPlan = await bordersBelowPlan(ctx, { game, map: map2, me, turn, territories, info, history, teamsKnown, given: { deploys, moves } });
161224
161266
  const avoidT = new Set((intel.avoidTerritories ?? []).map((t) => resolveTerritory(map2, t).id));
@@ -161274,7 +161316,8 @@ function registerCheckPlanTool(server, ctx) {
161274
161316
  from: m.from,
161275
161317
  to: m.to,
161276
161318
  armies: m.byPercent ? report2.baseline.log.find((e) => e.index === i2)?.sent ?? 0 : m.armies
161277
- }))
161319
+ })),
161320
+ airlifts
161278
161321
  ),
161279
161322
  ...refused.size ? [`These orders use ${[...refused].join(", ")}: war.app would refuse them in this game, and warapp_submit_turn does; the test ran them anyway.`] : [],
161280
161323
  ...sanction.warnings,
@@ -638,7 +638,7 @@ export function lessonsSummary(file) {
638
638
  * (geometric mean and samples): this format's band when it has `min` samples or more, else every format's
639
639
  * band together; a band with fewer than `min` either way is left out. Pure.
640
640
  */
641
- export function outlookCalibration(file, format, min) {
641
+ export function outlookCalibration(file, format, min, opts = {}) {
642
642
  let all = {};
643
643
  for (const f of PROFILE_FORMATS) {
644
644
  const t = file.byFormat[f];
@@ -648,7 +648,7 @@ export function outlookCalibration(file, format, min) {
648
648
  const own = file.byFormat[format]?.calibration ?? {};
649
649
  const out = {};
650
650
  for (const k of COVERAGE_BUCKETS) {
651
- const x = (own[k]?.n ?? 0) >= min ? own[k] : all[k];
651
+ const x = (own[k]?.n ?? 0) >= min ? own[k] : opts.ownOnly ? undefined : all[k];
652
652
  if (!x || x.n < min)
653
653
  continue;
654
654
  out[k] = { geoMean: r2(Math.exp(x.logSum / x.n)), n: x.n };
@@ -7,6 +7,7 @@
7
7
  // names is short before a single army is deployed.
8
8
  import { armiesToTake, COMMANDER_STRENGTH, specialUnitStrength } from '../analysis/combat.js';
9
9
  import { neighborsOf } from '../analysis/graph.js';
10
+ import { OWNER_NEUTRAL } from '../live.js';
10
11
  /** The preview's warning, or `undefined` when no attack can be met that way. */
11
12
  export function baitAttackWarning(input) {
12
13
  const { graph, board, me, settings, label, name } = input;
@@ -17,11 +18,14 @@ export function baitAttackWarning(input) {
17
18
  ...(settings.offensiveKillRate !== undefined ? { offensiveKillRate: settings.offensiveKillRate } : {}),
18
19
  ...(settings.defensiveKillRate !== undefined ? { defensiveKillRate: settings.defensiveKillRate } : {}),
19
20
  };
20
- /** My attacks by target, in the order first listed: a player's visible territory, not a teammate's unless asked. */
21
+ /**
22
+ * My attacks by target, in the order first listed: a player's visible territory, not a teammate's unless asked.
23
+ * Never a neutral's (#617: the live board's owner 0, whose stacks never move) or a hidden or pickable one (below 0).
24
+ */
21
25
  const byTarget = new Map();
22
26
  for (const m of input.moves) {
23
27
  const t = standing.get(m.to.id);
24
- if (m.mode === 'transfer-only' || !t || t.fogged || t.owner === me || t.owner < 0)
28
+ if (m.mode === 'transfer-only' || !t || t.fogged || t.owner === me || t.owner <= OWNER_NEUTRAL)
25
29
  continue;
26
30
  if (teammates.has(t.owner) && m.attackTeammates !== true)
27
31
  continue;
@@ -11,7 +11,7 @@ import { stressPlan } from '../analysis/stress.js';
11
11
  import { neutralizeSeats, seatTerritories, staticSeats } from '../analysis/static-seats.js';
12
12
  import { profileFormatOf } from '../analysis/opponent-profile.js';
13
13
  import { handOwners } from './card-advice.js';
14
- import { fogPaceFor, mapMatchOf, outlookCalibrationFor } from './past-games.js';
14
+ import { fogPaceFor, mapMatchOf, trackCalibrationFor } from './past-games.js';
15
15
  import { sanctionMyIncome } from './card-effects.js';
16
16
  import { cardTypeByName, cardTypeName, normalizeGuid, readHand } from '../cards.js';
17
17
  import { claimedCardUses, claimedCardWarning, teamCardClaims, teamHandLeft, unclaimedFirst } from '../team-cards.js';
@@ -218,7 +218,7 @@ export function registerCheckPlanTool(server, ctx) {
218
218
  // #419: the past winners' pace, as warapp_plan_turn reads it (thin evidence's upper bound).
219
219
  const mapPace = await fogPaceFor(ctx.dataDir, undefined, game.settings?.mapId ?? map.id, mapMatchOf(profileFormatOf(game.players), game.settings), turn === null ? null : turn - 1);
220
220
  // #568: past games' calibration of the tracked figures, as warapp_plan_turn reads it.
221
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, undefined, profileFormatOf(game.players));
221
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, undefined, profileFormatOf(game.players));
222
222
  const deploys = [];
223
223
  const moves = [];
224
224
  /** Options the game would refuse (#165): the orders are still tried, and the warning says so. */
@@ -707,6 +707,8 @@ export function registerCheckPlanTool(server, ctx) {
707
707
  ...(teams.size ? { teams } : {}),
708
708
  ...(first_mover !== undefined ? { firstMover: first_mover } : {}),
709
709
  orderPriority,
710
+ // #618: the Airlifts land before the moves, as the stress test above carries them out.
711
+ ...(airlifts.length ? { airlifts } : {}),
710
712
  });
711
713
  // #275 pattern 3: each border these orders leave below what the default plan leaves there (one plan per call).
712
714
  const belowPlan = await bordersBelowPlan(ctx, { game, map, me, turn, territories, info, history, teamsKnown, given: { deploys, moves } });
@@ -763,7 +765,7 @@ export function registerCheckPlanTool(server, ctx) {
763
765
  from: m.from,
764
766
  to: m.to,
765
767
  armies: m.byPercent ? (report.baseline.log.find((e) => e.index === i)?.sent ?? 0) : m.armies,
766
- }))),
768
+ })), airlifts),
767
769
  ...(refused.size
768
770
  ? [`These orders use ${[...refused].join(', ')}: war.app would refuse them in this game, and warapp_submit_turn does; the test ran them anyway.`]
769
771
  : []),
@@ -158,3 +158,26 @@ export async function outlookCalibrationFor(dataDir, env, format) {
158
158
  return undefined;
159
159
  }
160
160
  }
161
+ /**
162
+ * #568's track calibration, narrowed after a lost 1v1 (2026-11-27): this format's own bands only (a band with
163
+ * fewer than `MIN_CALIBRATION_SAMPLES` of this format is left out, never filled from every format's), and none
164
+ * in a 1v1. In a 1v1 the fog prior already lifts a thin tracker toward my income, so the plan's estimates ran
165
+ * above the truth there (1.13× over 52 logged samples) while free-for-alls and team games ran at about half; the
166
+ * factor stacked on the prior read one opponent at 26 against a true 17. The outlook keeps
167
+ * {@link outlookCalibrationFor}. `undefined` when off, in a 1v1, without a data dir, unreadable or with no band.
168
+ * Never throws.
169
+ */
170
+ export async function trackCalibrationFor(dataDir, env, format) {
171
+ if (format === '1v1' || !dataDir || !profileEnabled(env ?? process.env))
172
+ return undefined;
173
+ try {
174
+ const file = await readLessons(dataDir);
175
+ if (file === 'unreadable')
176
+ return undefined;
177
+ const c = outlookCalibration(file, format, MIN_CALIBRATION_SAMPLES, { ownOnly: true });
178
+ return Object.keys(c).length ? c : undefined;
179
+ }
180
+ catch {
181
+ return undefined;
182
+ }
183
+ }
@@ -55,7 +55,7 @@ import { confidentHabits, counterOf, neighboursOf, readOpponents } from './profi
55
55
  import { mapOf } from './map.js';
56
56
  import { PACE_TURNS } from '../analysis/game-lessons.js';
57
57
  import { profileFormatOf } from '../analysis/opponent-profile.js';
58
- import { fogPaceFor, mapMatchOf, mapRecordFor, outlookCalibrationFor, paceView } from './past-games.js';
58
+ import { fogPaceFor, mapMatchOf, mapRecordFor, outlookCalibrationFor, paceView, trackCalibrationFor } from './past-games.js';
59
59
  import { defineGatedWrite, requireMySeat, sendAndVerify } from './write-kit.js';
60
60
  import { resolveBonus, resolveTerritory } from './resolve.js';
61
61
  import { checkCardFields, newCardPlaySeen, resolveCardTargets, } from './card-plays.js';
@@ -516,10 +516,12 @@ export function cityPurchaseOf(game, asked, map, board, myInGameId, gold) {
516
516
  * fog fall to any single army; an enemy territory at 0 beside me breaks its owner's bonus to a
517
517
  * one-army attack. Empty unless the guard is off.
518
518
  */
519
- export function guardOffWarnings(graph, map, board, me, friends, settings, deploys, moves) {
519
+ export function guardOffWarnings(graph, map, board, me, friends, settings, deploys, moves,
520
+ /** #618: my Airlift plays, after the deploys and before the moves. */
521
+ airlifts = []) {
520
522
  if (settings?.oneArmyStandsGuard !== false)
521
523
  return [];
522
- const r = guardOffExposure({ graph, board, me, friends, deploys, moves });
524
+ const r = guardOffExposure({ graph, board, me, friends, deploys, moves, airlifts });
523
525
  const name = namer(map);
524
526
  const out = [];
525
527
  if (r.emptied.length) {
@@ -1464,6 +1466,7 @@ export async function livePlanSetup(ctx, a) {
1464
1466
  // #436: past games' estimate ÷ truth per coverage band calibrates the outlook's income estimates (its income
1465
1467
  // lean and the surrender line only; the planner acts on winning and losing, which never read it).
1466
1468
  const calibration = await outlookCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
1469
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
1467
1470
  const outlookInput = {
1468
1471
  graph,
1469
1472
  me: me.id,
@@ -1516,8 +1519,9 @@ export async function livePlanSetup(ctx, a) {
1516
1519
  // #166: the opponent's opening simulated from the starts the award proved, as the prior.
1517
1520
  ...(opening ? { opening } : {}),
1518
1521
  ...(mapPace ? { mapPace } : {}),
1519
- // #568: the same calibration raises each tracked figure by its coverage band's damped factor.
1520
- ...(calibration ? { trackCalibration: calibration } : {}),
1522
+ // #568: this format's own calibration raises each tracked figure by its coverage band's damped factor
1523
+ // (none in a 1v1, where the fog prior already lifts the tracker: trackCalibrationFor).
1524
+ ...(trackCalibration ? { trackCalibration } : {}),
1521
1525
  // #164: an opponent's Reinforcement card, from the turn the card clock says one can be in hand.
1522
1526
  ...(opponentReinforcement(game.settings, hand) ? { reinforcement: opponentReinforcement(game.settings, hand) } : {}),
1523
1527
  // #427: the Reinforcement plays seen in the turns' orders (card plays not fogged): a play restarts the clock.
@@ -1995,7 +1999,7 @@ async function commanderCheck(ctx, a) {
1995
1999
  // #419: the past winners' pace, as the plan reads it.
1996
2000
  const mapPace = await fogPaceFor(ctx.dataDir, undefined, a.game.settings?.mapId ?? a.map.id, mapMatchOf(profileFormatOf(a.game.players), a.game.settings), a.turn === null ? null : a.turn - 1);
1997
2001
  // #568: past games' calibration of the tracked figures, as the plan reads it.
1998
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, undefined, profileFormatOf(a.game.players));
2002
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, undefined, profileFormatOf(a.game.players));
1999
2003
  // stressOpponents reads a static seat's territories as neutrals (#270), on its own `board` too.
2000
2004
  const so = stressOpponents({
2001
2005
  graph,
@@ -3725,6 +3729,10 @@ export function registerTurnTools(server, ctx, opts = {}) {
3725
3729
  const { claimed } = teamHandLeft(hand, teamCardClaims(board.teammateOrders, new Set(teammatesOf(game.players, me).map((p) => p.id))));
3726
3730
  const pickFrom = unclaimedFirst(hand, claimed);
3727
3731
  const plays = resolveCardPlays(map, pickFrom, rules, cardInputs);
3732
+ /** #618: my Airlift plays, as the headroom table and the empty-border warning carry them out (before the moves). */
3733
+ const submitAirlifts = plays.flatMap((p) => p.kind === 'Airlift' && p.targets?.from && p.targets.to
3734
+ ? [{ from: p.targets.from.id, to: p.targets.to.id, armies: p.targets.armies ?? 0, ...(p.targets.commander ? { commander: true } : {}) }]
3735
+ : []);
3728
3736
  // #186: an Order Delay's `before` names a move of this list (1-based); one past the last is the default.
3729
3737
  for (const p of plays) {
3730
3738
  if (p.before !== undefined && p.before > moves.length + 1) {
@@ -3985,7 +3993,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3985
3993
  // The Sanctions on me the deploys were checked against (or, under Local Deployment, why not).
3986
3994
  if (givenIncome === undefined)
3987
3995
  warnings.push(...sanction.warnings);
3988
- warnings.push(...modsWarning(game.settings), ...guardOffWarnings(graphOf(map), map, board, me.id, friendsOf(game.players, me), game.settings, deploys.map((d) => ({ territoryId: d.territory.id, armies: d.armies })), moves.map((m, i) => ({ from: m.from.id, to: m.to.id, armies: m.percent ? (options.estimates.get(i) ?? 0) : m.armies }))));
3996
+ warnings.push(...modsWarning(game.settings), ...guardOffWarnings(graphOf(map), map, board, me.id, friendsOf(game.players, me), game.settings, deploys.map((d) => ({ territoryId: d.territory.id, armies: d.armies })), moves.map((m, i) => ({ from: m.from.id, to: m.to.id, armies: m.percent ? (options.estimates.get(i) ?? 0) : m.armies })), submitAirlifts));
3989
3997
  if (handUnknown)
3990
3998
  warnings.push(UNREADABLE_HAND);
3991
3999
  for (const p of plays)
@@ -4108,6 +4116,8 @@ export function registerTurnTools(server, ctx, opts = {}) {
4108
4116
  settings: plannerSettings(game.settings),
4109
4117
  ...(subTeams ? { teams: subTeams } : {}),
4110
4118
  ...(plays.some((p) => p.kind === 'OrderPriority') ? { orderPriority: true } : {}),
4119
+ // #618: the Airlifts land before the moves, as the stress test carries them out.
4120
+ ...(submitAirlifts.length ? { airlifts: submitAirlifts } : {}),
4111
4121
  });
4112
4122
  warnings.push(...headroomWarnings(headroomRows, modelled, !teamsKnown));
4113
4123
  // #275 pattern 3: a border these orders leave below what the default plan leaves there (one plan, a warning).
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.22.0'; // x-release-please-version
4
+ export const VERSION = '0.22.1'; // 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.22.0",
6
+ "version": "0.22.1",
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.22.0",
3
+ "version": "0.22.1",
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.22.0",
9
+ "version": "0.22.1",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.22.0",
14
+ "version": "0.22.1",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },