@chrischall/warapp-mcp 0.20.0 → 0.21.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.
@@ -32,6 +32,9 @@ const READ_BACK_TARGETED = new Set(['Bomb', 'Blockade', 'EmergencyBlockade']);
32
32
  import { compareScores, planAirlift, STAGING_DISCOUNT } from '../analysis/airlift-plan.js';
33
33
  import { planBomb } from '../analysis/bomb-plan.js';
34
34
  import { planBlockade, planWall } from '../analysis/blockade-plan.js';
35
+ import { alternativePlans, STRATEGY_NOTE, stressSummary, turnOptions } from '../analysis/options.js';
36
+ import { FACT_PARTS, FACTS_AVAILABLE, MORE_ON_REQUEST, OWN_PLAN_STEPS, pickFacts, situation } from '../analysis/situation.js';
37
+ import { stressPlan } from '../analysis/stress.js';
35
38
  import { breaksInOrders } from '../mod-alliances.js';
36
39
  import { allyAttackLine, attacksOnAllies, MOD_ALLIANCES_NOTE, modAllianceWarnings, readModAlliances } from './mod-alliances.js';
37
40
  import { adviseCards, cardGame, cardPieceOption, giftInOrders, intelOrders, handOwners, lastTurnPlays, opponentCanHold, opponentReinforcement, reinforcementPlaysShown, seenReinforcementPlays, TEAM_HAND } from './card-advice.js';
@@ -1663,6 +1666,8 @@ export async function livePlanSetup(ctx, a) {
1663
1666
  effect, sanction, incomeCap, capUnknown: incomeOnBoard.capUnknown === true, estimates, trip, teams, commerce, statedShifts: shifts,
1664
1667
  // #427: the last turn's Reinforcement plays, for warapp_plan_turn to keep (only when plays show).
1665
1668
  seenPlays: playsShown ? lastPlays : undefined,
1669
+ // #606: the earlier boards (and my orders on them) for the strategy view's summary of past turns.
1670
+ pastBoards: history.boards,
1666
1671
  };
1667
1672
  }
1668
1673
  /** The Airlift card's type id. */
@@ -2424,10 +2429,30 @@ export function registerTurnTools(server, ctx, opts = {}) {
2424
2429
  .optional()
2425
2430
  .describe('Airlift cards to keep in reserve: `airliftPlan` plays only those held beyond this many (default 0). ' +
2426
2431
  'Changes nothing when you hold no Airlift.'),
2432
+ strategy: z
2433
+ .boolean()
2434
+ .optional()
2435
+ .describe('true adds `strategy` (#606), a menu for choosing a turn yourself: `options.captures` — each territory in view beside ' +
2436
+ 'yours that is not yours, ranked by income gained per army: its defenders, the attackers that take it (and, a ' +
2437
+ "player's, after its owner's whole deploy), the spare armies beside it, the bonuses it completes or advances and the new " +
2438
+ 'borders facing a player it opens; `options.holds` — each border facing a player: the armies to add to hold against ' +
2439
+ 'the stacks beside it alone and against them plus one whole deploy, and the held bonuses it protects; `alternatives` — ' +
2440
+ "this plan and the planner under the goals expand and defend, each with its orders, what it expects and its stress test " +
2441
+ "against the opponents' replies (safe, harmful replies, the worst one); `available` — the raw facts you can ask for " +
2442
+ 'with `facts`; and `steps`. Choose, combine or build your own, then check with warapp_check_plan; ' +
2443
+ 'warapp_submit_turn keeps an override reason in the decision log. Default false.'),
2444
+ facts: z
2445
+ .array(z.enum(FACT_PARTS))
2446
+ .min(1)
2447
+ .optional()
2448
+ .describe('The raw game state behind the plan, only the parts you name (#606), as `facts`: `me` (' + FACTS_AVAILABLE.me + '), ' +
2449
+ '`territories` (' + FACTS_AVAILABLE.territories + '), `bonuses` (' + FACTS_AVAILABLE.bonuses + '), `opponents` (' +
2450
+ FACTS_AVAILABLE.opponents + '), `changes` (' + FACTS_AVAILABLE.changes + '), `past` (' + FACTS_AVAILABLE.past + '). ' +
2451
+ 'Ask for what your decision needs; whole past boards are in warapp_turn_history. Default none.'),
2427
2452
  view: viewArg(VIEWS, 'compact (default) gives the plan and orders (the profile as format, phase and standing); "full" adds each ' +
2428
2453
  'move\'s reason, the whole profile and the settings the plan assumed.'),
2429
2454
  }),
2430
- }, async ({ game_id, player, goal, siege_target, jabs, focus, reserve, enemy_deploy, known_income, fogged_attackers, avoid_territories, avoid_players, min_win_chance, first_mover, keep_cards, view }) => {
2455
+ }, async ({ game_id, player, goal, siege_target, jabs, focus, reserve, enemy_deploy, known_income, fogged_attackers, avoid_territories, avoid_players, min_win_chance, first_mover, keep_cards, strategy, facts, view }) => {
2431
2456
  // The chat comes in the same GameFeed read: the fallback for the unread counts (part A1).
2432
2457
  const feed = await ctx.client.getGame(game_id, { settings: true, chat: true });
2433
2458
  requireTurnPhase(feed);
@@ -2805,6 +2830,77 @@ export function registerTurnTools(server, ctx, opts = {}) {
2805
2830
  guessSkip = { reason: 'commander', message };
2806
2831
  }
2807
2832
  }
2833
+ // #606: the raw game state behind the plan, only the parts asked for (report only).
2834
+ const factsView = facts
2835
+ ? pickFacts(situation({
2836
+ graph,
2837
+ board,
2838
+ ...(setup.input.previousBoard ? { previousBoard: setup.input.previousBoard } : {}),
2839
+ me: me.id,
2840
+ ...(setup.teams ? { friends: new Set([...setup.teams].filter(([id, t]) => id !== me.id && t === setup.teams.get(me.id)).map(([id]) => id)) } : {}),
2841
+ rates: { offensiveKillRate: settings.offensiveKillRate, defensiveKillRate: settings.defensiveKillRate },
2842
+ guard: settings.oneArmyStandsGuard !== false,
2843
+ myIncome: income,
2844
+ ...(setup.input.incomeHistory ? { incomeHistory: setup.input.incomeHistory } : {}),
2845
+ pastBoards: setup.pastBoards,
2846
+ opponents: estimates.map((e) => {
2847
+ const t = tracks?.find((x) => x.playerId === e.playerId);
2848
+ return {
2849
+ playerId: e.playerId,
2850
+ estimate: e.estimate,
2851
+ source: e.source,
2852
+ visibleIncome: e.base + e.bonusIncome,
2853
+ tracked: t?.income ?? null,
2854
+ range: e.thinEvidence ? { low: e.thinEvidence.lower, high: e.thinEvidence.upper } : null,
2855
+ coverage: t?.coverage?.share ?? null,
2856
+ ...(t ? { history: t.turns.map((x) => ({ turn: x.to, observed: x.observed })) } : {}),
2857
+ };
2858
+ }),
2859
+ }), facts)
2860
+ : undefined;
2861
+ // #606: ranked options and alternative plans, each stress-tested (opt-in; never changes the plan above).
2862
+ const strategyView = strategy
2863
+ ? (() => {
2864
+ const deployOf = (p) => estimates.find((e) => e.playerId === p)?.estimate ?? 0;
2865
+ const stressOpp = estimates.map((e) => ({ id: e.playerId, deploy: e.estimate }));
2866
+ const stress = (p) => {
2867
+ if (!stressOpp.length)
2868
+ return undefined;
2869
+ try {
2870
+ return stressSummary(stressPlan({
2871
+ graph,
2872
+ board,
2873
+ me: me.id,
2874
+ deploys: p.deploys,
2875
+ moves: p.moves.map((m) => ({ from: m.from, to: m.to, armies: m.armies })),
2876
+ opponents: stressOpp,
2877
+ settings,
2878
+ ...(setup.teams ? { teams: setup.teams } : {}),
2879
+ lookAhead: false,
2880
+ maxReplies: 1,
2881
+ }));
2882
+ }
2883
+ catch {
2884
+ return undefined;
2885
+ }
2886
+ };
2887
+ return {
2888
+ options: turnOptions({
2889
+ graph,
2890
+ board,
2891
+ me: me.id,
2892
+ deployOf,
2893
+ rates: { offensiveKillRate: settings.offensiveKillRate, defensiveKillRate: settings.defensiveKillRate },
2894
+ guard: settings.oneArmyStandsGuard !== false,
2895
+ ...(setup.teams ? { friends: new Set([...setup.teams].filter(([id, t]) => id !== me.id && t === setup.teams.get(me.id)).map(([id]) => id)) } : {}),
2896
+ }),
2897
+ alternatives: alternativePlans(setup.input, plan, stress),
2898
+ available: FACTS_AVAILABLE,
2899
+ steps: OWN_PLAN_STEPS,
2900
+ note: STRATEGY_NOTE,
2901
+ };
2902
+ })()
2903
+ : undefined;
2808
2904
  // #275 (a): the smallest single deploy that takes each border of mine after the plan's orders.
2809
2905
  const headroom = safeHeadroom({
2810
2906
  graph,
@@ -3171,6 +3267,11 @@ export function registerTurnTools(server, ctx, opts = {}) {
3171
3267
  : `${plan.incomeTrend.turns.map((t) => t.income).join(' → ')} over turns ${plan.incomeTrend.turns[0].turn}–${plan.incomeTrend.turns[plan.incomeTrend.turns.length - 1].turn}: ${plan.incomeTrend.slope >= 0 ? '+' : ''}${plan.incomeTrend.slope}/turn${plan.incomeTrend.flat ? ', flat' : ''}`,
3172
3268
  }
3173
3269
  : {}),
3270
+ // #606: the mechanics for the calling model's own choice (opt-in).
3271
+ ...(strategyView ? { strategy: strategyView } : {}),
3272
+ ...(factsView ? { facts: factsView } : {}),
3273
+ // #606: every plan says what more can be asked for (the menu itself names the facts).
3274
+ ...(strategyView ? {} : { more: MORE_ON_REQUEST }),
3174
3275
  // #275 (a): each border's headroom, the weakest first (compact: the first few).
3175
3276
  headroom: headroomView(headroom, map, myIncome, rung === 'full', !teamsKnown, (p) => estimates.find((e) => e.playerId === p)?.estimate),
3176
3277
  ...(rung !== 'full' && headroom.length > HEADROOM_COMPACT ? { headroomMore: headroom.length - HEADROOM_COMPACT } : {}),
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.20.0'; // x-release-please-version
4
+ export const VERSION = '0.21.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.20.0",
6
+ "version": "0.21.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.20.0",
3
+ "version": "0.21.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.20.0",
9
+ "version": "0.21.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.20.0",
14
+ "version": "0.21.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },