@chrischall/warapp-mcp 0.21.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.
@@ -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';
@@ -87,7 +87,8 @@ export function registerCheckPlanTool(server, ctx) {
87
87
  'order; each order an attack or a transfer by who holds its target when it runs; kill rates, the guard ' +
88
88
  'army, each army moving once, commanders), against the replies each opponent could make with ONE deploy: ' +
89
89
  'its whole estimated deploy on one stack and an attack on a territory you hold or are about to take, its ' +
90
- 'whole deploy on a territory you attack, or every stack attacking at once; a stack you attack moving out ' +
90
+ 'whole deploy on a territory you attack, or that plus its stacks beside it moving in first (`gather`, the bait: ' +
91
+ '`movedIn` names each), or every stack attacking at once; a stack you attack moving out ' +
91
92
  'first (a dodge: into its own territory, or a neutral or one of yours it can take — `dodges` lists each ' +
92
93
  'with the armies that got away and what your strike then hit); two opponents striking one of your ' +
93
94
  'territories together (teammates always; any two in a free-for-all when you lead — `jointFalls` gives the ' +
@@ -217,7 +218,7 @@ export function registerCheckPlanTool(server, ctx) {
217
218
  // #419: the past winners' pace, as warapp_plan_turn reads it (thin evidence's upper bound).
218
219
  const mapPace = await fogPaceFor(ctx.dataDir, undefined, game.settings?.mapId ?? map.id, mapMatchOf(profileFormatOf(game.players), game.settings), turn === null ? null : turn - 1);
219
220
  // #568: past games' calibration of the tracked figures, as warapp_plan_turn reads it.
220
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, undefined, profileFormatOf(game.players));
221
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, undefined, profileFormatOf(game.players));
221
222
  const deploys = [];
222
223
  const moves = [];
223
224
  /** Options the game would refuse (#165): the orders are still tried, and the warning says so. */
@@ -509,15 +510,19 @@ export function registerCheckPlanTool(server, ctx) {
509
510
  const sentence = (r) => {
510
511
  const act = r.kind === 'reinforce'
511
512
  ? `deploys ${r.deploy} on territory ${r.deployTo} and holds`
512
- : r.kind === 'attack'
513
- ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}`
514
- : r.kind === 'dodge'
515
- ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}`
516
- : r.kind === 'chain'
517
- ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(' → ')}`
518
- : r.kind === 'joint'
519
- ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})`
520
- : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
513
+ : r.kind === 'gather'
514
+ ? `${r.deploy > 0 ? `deploys ${r.deploy} on territory ${r.deployTo} and ` : ''}moves ${(r.movedIn ?? [])
515
+ .map((m) => `${m.armies} in from territory ${m.from}`)
516
+ .join(' and ')} onto territory ${r.deployTo}`
517
+ : r.kind === 'attack'
518
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}`
519
+ : r.kind === 'dodge'
520
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}`
521
+ : r.kind === 'chain'
522
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(' → ')}`
523
+ : r.kind === 'joint'
524
+ ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})`
525
+ : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
521
526
  const when = (needs(r) === 'you' ? ', and you move first' : needs(r) === 'opponent' ? `, and ${r.kind === 'joint' ? 'they move' : 'it moves'} first` : '') +
522
527
  (r.firstOpponent !== undefined ? `, player ${r.firstOpponent} before the other` : '');
523
528
  // With my commander gone everything is: the rest is not listed.
@@ -541,6 +546,8 @@ export function registerCheckPlanTool(server, ctx) {
541
546
  deploy: r.deploy,
542
547
  deployTo: name(r.deployTo),
543
548
  ...(r.kind === 'attack' || r.kind === 'dodge' || r.kind === 'chain' ? { attack: { from: name(r.from), to: name(r.to), armies: r.armies } } : {}),
549
+ // #593 5c: the stacks a gather moved into the target, and what arrived from each.
550
+ ...(r.movedIn ? { movedIn: r.movedIn.map((m) => ({ from: name(m.from), armies: m.armies })) } : {}),
544
551
  // #180: a chain's every territory, and a joint strike's second opponent.
545
552
  ...(r.path ? { path: r.path.map(name) } : {}),
546
553
  ...(r.partner !== undefined
@@ -700,6 +707,8 @@ export function registerCheckPlanTool(server, ctx) {
700
707
  ...(teams.size ? { teams } : {}),
701
708
  ...(first_mover !== undefined ? { firstMover: first_mover } : {}),
702
709
  orderPriority,
710
+ // #618: the Airlifts land before the moves, as the stress test above carries them out.
711
+ ...(airlifts.length ? { airlifts } : {}),
703
712
  });
704
713
  // #275 pattern 3: each border these orders leave below what the default plan leaves there (one plan per call).
705
714
  const belowPlan = await bordersBelowPlan(ctx, { game, map, me, turn, territories, info, history, teamsKnown, given: { deploys, moves } });
@@ -756,7 +765,7 @@ export function registerCheckPlanTool(server, ctx) {
756
765
  from: m.from,
757
766
  to: m.to,
758
767
  armies: m.byPercent ? (report.baseline.log.find((e) => e.index === i)?.sent ?? 0) : m.armies,
759
- }))),
768
+ })), airlifts),
760
769
  ...(refused.size
761
770
  ? [`These orders use ${[...refused].join(', ')}: war.app would refuse them in this game, and warapp_submit_turn does; the test ran them anyway.`]
762
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
+ }
@@ -35,6 +35,7 @@ import { planBlockade, planWall } from '../analysis/blockade-plan.js';
35
35
  import { alternativePlans, STRATEGY_NOTE, stressSummary, turnOptions } from '../analysis/options.js';
36
36
  import { FACT_PARTS, FACTS_AVAILABLE, MORE_ON_REQUEST, OWN_PLAN_STEPS, pickFacts, situation } from '../analysis/situation.js';
37
37
  import { stressPlan } from '../analysis/stress.js';
38
+ import { baitAttackWarning } from './bait.js';
38
39
  import { breaksInOrders } from '../mod-alliances.js';
39
40
  import { allyAttackLine, attacksOnAllies, MOD_ALLIANCES_NOTE, modAllianceWarnings, readModAlliances } from './mod-alliances.js';
40
41
  import { adviseCards, cardGame, cardPieceOption, giftInOrders, intelOrders, handOwners, lastTurnPlays, opponentCanHold, opponentReinforcement, reinforcementPlaysShown, seenReinforcementPlays, TEAM_HAND } from './card-advice.js';
@@ -54,7 +55,7 @@ import { confidentHabits, counterOf, neighboursOf, readOpponents } from './profi
54
55
  import { mapOf } from './map.js';
55
56
  import { PACE_TURNS } from '../analysis/game-lessons.js';
56
57
  import { profileFormatOf } from '../analysis/opponent-profile.js';
57
- import { fogPaceFor, mapMatchOf, mapRecordFor, outlookCalibrationFor, paceView } from './past-games.js';
58
+ import { fogPaceFor, mapMatchOf, mapRecordFor, outlookCalibrationFor, paceView, trackCalibrationFor } from './past-games.js';
58
59
  import { defineGatedWrite, requireMySeat, sendAndVerify } from './write-kit.js';
59
60
  import { resolveBonus, resolveTerritory } from './resolve.js';
60
61
  import { checkCardFields, newCardPlaySeen, resolveCardTargets, } from './card-plays.js';
@@ -515,10 +516,12 @@ export function cityPurchaseOf(game, asked, map, board, myInGameId, gold) {
515
516
  * fog fall to any single army; an enemy territory at 0 beside me breaks its owner's bonus to a
516
517
  * one-army attack. Empty unless the guard is off.
517
518
  */
518
- 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 = []) {
519
522
  if (settings?.oneArmyStandsGuard !== false)
520
523
  return [];
521
- const r = guardOffExposure({ graph, board, me, friends, deploys, moves });
524
+ const r = guardOffExposure({ graph, board, me, friends, deploys, moves, airlifts });
522
525
  const name = namer(map);
523
526
  const out = [];
524
527
  if (r.emptied.length) {
@@ -1463,6 +1466,7 @@ export async function livePlanSetup(ctx, a) {
1463
1466
  // #436: past games' estimate ÷ truth per coverage band calibrates the outlook's income estimates (its income
1464
1467
  // lean and the surrender line only; the planner acts on winning and losing, which never read it).
1465
1468
  const calibration = await outlookCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
1469
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, a.env, profileFormatOf(game.players));
1466
1470
  const outlookInput = {
1467
1471
  graph,
1468
1472
  me: me.id,
@@ -1515,8 +1519,9 @@ export async function livePlanSetup(ctx, a) {
1515
1519
  // #166: the opponent's opening simulated from the starts the award proved, as the prior.
1516
1520
  ...(opening ? { opening } : {}),
1517
1521
  ...(mapPace ? { mapPace } : {}),
1518
- // #568: the same calibration raises each tracked figure by its coverage band's damped factor.
1519
- ...(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 } : {}),
1520
1525
  // #164: an opponent's Reinforcement card, from the turn the card clock says one can be in hand.
1521
1526
  ...(opponentReinforcement(game.settings, hand) ? { reinforcement: opponentReinforcement(game.settings, hand) } : {}),
1522
1527
  // #427: the Reinforcement plays seen in the turns' orders (card plays not fogged): a play restarts the clock.
@@ -1994,7 +1999,7 @@ async function commanderCheck(ctx, a) {
1994
1999
  // #419: the past winners' pace, as the plan reads it.
1995
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);
1996
2001
  // #568: past games' calibration of the tracked figures, as the plan reads it.
1997
- const trackCalibration = await outlookCalibrationFor(ctx.dataDir, undefined, profileFormatOf(a.game.players));
2002
+ const trackCalibration = await trackCalibrationFor(ctx.dataDir, undefined, profileFormatOf(a.game.players));
1998
2003
  // stressOpponents reads a static seat's territories as neutrals (#270), on its own `board` too.
1999
2004
  const so = stressOpponents({
2000
2005
  graph,
@@ -3724,6 +3729,10 @@ export function registerTurnTools(server, ctx, opts = {}) {
3724
3729
  const { claimed } = teamHandLeft(hand, teamCardClaims(board.teammateOrders, new Set(teammatesOf(game.players, me).map((p) => p.id))));
3725
3730
  const pickFrom = unclaimedFirst(hand, claimed);
3726
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
+ : []);
3727
3736
  // #186: an Order Delay's `before` names a move of this list (1-based); one past the last is the default.
3728
3737
  for (const p of plays) {
3729
3738
  if (p.before !== undefined && p.before > moves.length + 1) {
@@ -3984,7 +3993,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3984
3993
  // The Sanctions on me the deploys were checked against (or, under Local Deployment, why not).
3985
3994
  if (givenIncome === undefined)
3986
3995
  warnings.push(...sanction.warnings);
3987
- 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));
3988
3997
  if (handUnknown)
3989
3998
  warnings.push(UNREADABLE_HAND);
3990
3999
  for (const p of plays)
@@ -4071,6 +4080,19 @@ export function registerTurnTools(server, ctx, opts = {}) {
4071
4080
  const hopeless = hopelessAttackWarning(attacks, label);
4072
4081
  if (hopeless)
4073
4082
  warnings.push(hopeless);
4083
+ // #593 5c: an attack its stacks beside the target can reinforce before it lands.
4084
+ const bait = baitAttackWarning({
4085
+ graph: graphOf(map),
4086
+ board: territories,
4087
+ me: playerId,
4088
+ moves: moves.map((m, i) => ({ ...m, armies: m.percent ? (options.estimates.get(i) ?? 0) : m.armies })),
4089
+ settings: plannerSettings(game.settings),
4090
+ label,
4091
+ name: (id) => ({ id, name: map.territories.find((t) => t.id === id)?.name ?? String(id) }),
4092
+ teammates,
4093
+ });
4094
+ if (bait)
4095
+ warnings.push(bait);
4074
4096
  // #275 (c): a border of a held bonus these orders leave falling to a deploy below my own income.
4075
4097
  // A warning, never a refusal; the stress test (warapp_check_plan) tries the replies in full.
4076
4098
  const subTeams = teamsOf(game.players);
@@ -4094,6 +4116,8 @@ export function registerTurnTools(server, ctx, opts = {}) {
4094
4116
  settings: plannerSettings(game.settings),
4095
4117
  ...(subTeams ? { teams: subTeams } : {}),
4096
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 } : {}),
4097
4121
  });
4098
4122
  warnings.push(...headroomWarnings(headroomRows, modelled, !teamsKnown));
4099
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.21.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.21.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.21.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.21.0",
9
+ "version": "0.22.1",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.21.0",
14
+ "version": "0.22.1",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },