@chrischall/warapp-mcp 0.24.0 → 0.25.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.
@@ -38,7 +38,7 @@ import { FACT_PARTS, FACTS_AVAILABLE, MORE_ON_REQUEST, OWN_PLAN_STEPS, pickFacts
38
38
  import { stressPlan } from '../analysis/stress.js';
39
39
  import { baitAttackWarning } from './bait.js';
40
40
  import { breaksInOrders } from '../mod-alliances.js';
41
- import { allyAttackLine, attacksOnAllies, MOD_ALLIANCES_NOTE, modAllianceWarnings, readModAlliances } from './mod-alliances.js';
41
+ import { allyAttackLine, attacksOnAllies, MOD_ALLIANCES_NOTE, modAllianceWarnings, modPacts, readModAlliances } from './mod-alliances.js';
42
42
  import { adviseCards, cardGame, cardPieceOption, giftInOrders, intelOrders, handOwners, lastTurnPlays, opponentCanHold, opponentReinforcement, reinforcementPlaysShown, seenReinforcementPlays, TEAM_HAND } from './card-advice.js';
43
43
  import { currentTurn, turnsCompleted, gameIdArg, knownIncomeArg, avoidPlayersArg, avoidTerritoriesArg, graphOf, namer, playerNamer, readAnnotations, respond, shownAccount, UNTRUSTED_PREVIEW_NOTE, untrustedDescription, untrustedText, viewArg, } from './common.js';
44
44
  import { lookupMeta, mintMeta } from './hints.js';
@@ -77,12 +77,13 @@ import { readDecisionLog, scrubNames } from '../decision-log.js';
77
77
  import { readPickRecord } from '../pick-list.js';
78
78
  import { commitmentWarnings } from '../analysis/commitments.js';
79
79
  import { MAX_EXCEPTION_NOTE, planRelationsFrom, truceBreaksIn } from '../analysis/relations.js';
80
- import { coordinationView, exceptionNote, recordBrokenByMe, recordPartnerApproved } from './relations.js';
80
+ import { coordinationView, exceptionNote, recordBrokenByMe, recordPartnerApproved, relationPlayers } from './relations.js';
81
81
  import { readPlayerRecord } from '../player-record-store.js';
82
82
  import { withTeammateOrders } from '../team-orders.js';
83
83
  import { claimedCardUses, claimedCardWarning, teamCardClaims, teamCardLimit, teamCardRoles, teamHandLeft, unclaimedFirst, } from '../team-cards.js';
84
84
  import { isTeamGame, teammatesOf } from '../teams.js';
85
- import { readLedger, recordTruceUsage } from '../relations-store.js';
85
+ import { ledgerTruces, readLedger, recordTruceUsage } from '../relations-store.js';
86
+ import { atPeaceWith, pactJointThreats, pactsBasis, pactsWithoutMe, pactThreatWarnings } from '../analysis/pacts.js';
86
87
  import { coordinationDue, coordinationLine } from '../analysis/coordination.js';
87
88
  import { resolveIntel } from '../analysis/intel.js';
88
89
  import { readSiegeMemory, writeSiegeMemory } from '../siege-store.js';
@@ -1293,6 +1294,7 @@ async function promiseWarnings(ctx, a) {
1293
1294
  return commitmentWarnings({
1294
1295
  commitments: ledger.commitments,
1295
1296
  agreements: ledger.agreements,
1297
+ pacts: ledger.pacts,
1296
1298
  graph: a.graph,
1297
1299
  board: a.board,
1298
1300
  me: a.me.id,
@@ -1314,8 +1316,21 @@ export async function truceRelations(ctx, a) {
1314
1316
  const ledger = ctx.dataDir ? await readLedger(ctx.dataDir, game.id, me.id) : undefined;
1315
1317
  // T9: the Diplomacy 2 mod's alliances (no request in a game without the mod).
1316
1318
  const mod = await readModAlliances(ctx, game, me);
1319
+ const players = relationPlayers(game.players);
1320
+ // #680: the pacts between other players (the ledger's, the cards', the mod's): report only, never planned on.
1321
+ // #686: watched over my boards for breaches (report only); a broken one stops counting as a pact.
1322
+ const pacts = pactsWithoutMe({
1323
+ pacts: ledger?.pacts,
1324
+ me: me.id,
1325
+ turn,
1326
+ players,
1327
+ diplomacy: a.diplomacyOthers,
1328
+ mod: modPacts(mod),
1329
+ watch: { graph, boards: [...a.boards, { turn, board: a.board }], ...cardsInPlay(game) },
1330
+ });
1317
1331
  const resolved = planRelationsFrom({
1318
- agreements: ledger?.agreements ?? [],
1332
+ // #680: a pact I am in reads as one pairwise truce per partner, exactly as the same truces recorded apart.
1333
+ agreements: ledgerTruces(ledger),
1319
1334
  graph,
1320
1335
  board: a.board,
1321
1336
  boards: [...a.boards, { turn, board: a.board }],
@@ -1341,7 +1356,18 @@ export async function truceRelations(ctx, a) {
1341
1356
  ...(a.diplomacy?.length ? { diplomacy: a.diplomacy } : {}),
1342
1357
  ...(mod.status === 'read' && mod.allies.length ? { modAllies: mod.allies } : {}),
1343
1358
  });
1344
- return { ...resolved, mod };
1359
+ return { ...resolved, mod, pacts };
1360
+ }
1361
+ /**
1362
+ * #680: the pacts between other players as threats to me: each with my teammates left out of its parties (their
1363
+ * stacks are no threat), and only those still naming two players or more.
1364
+ */
1365
+ export function foePacts(pacts, players, me) {
1366
+ const mates = new Set(teammatesOf(players, me).map((p) => p.id));
1367
+ return pacts.flatMap((k) => {
1368
+ const parties = k.parties.filter((p) => !mates.has(p));
1369
+ return parties.length >= 2 ? [{ ...k, parties }] : [];
1370
+ });
1345
1371
  }
1346
1372
  /**
1347
1373
  * The reads of my opponents in contact on `board` (a territory of theirs next to one of mine) with at
@@ -1534,7 +1560,7 @@ export async function livePlanSetup(ctx, a) {
1534
1560
  // B2: the truces in force, from the agreement ledger (warapp_record_agreement) and my board
1535
1561
  // history, and the tacit truces (reported, never planned on).
1536
1562
  const truces = await truceRelations(ctx, {
1537
- game, me, turn, graph, board: seen, boards: history.boards, myIncome: boardIncome, tracks, diplomacy: effect.diplomacy,
1563
+ game, me, turn, graph, board: seen, boards: history.boards, myIncome: boardIncome, tracks, diplomacy: effect.diplomacy, diplomacyOthers: effect.diplomacyOthers,
1538
1564
  });
1539
1565
  // The per-opponent estimates the plan works from (as planTurn reads them), for the tripwire and the border guess.
1540
1566
  const estimateArgs = {
@@ -2295,6 +2321,9 @@ export function registerTurnTools(server, ctx, opts = {}) {
2295
2321
  'With an army cap, `income` is what the cap leaves, min(income, cap × income − your armies on the board) (verified by ' +
2296
2322
  'six live cases; the line names a cut), and `incomeCapped` gives the arithmetic; Reinforcement card armies come on top. ' +
2297
2323
  'In a free-for-all, `relations` reports each truce recorded with warapp_record_agreement as the plan treated it ' +
2324
+ '(#680: an n-way truce you are in, once per partner, exactly as the same two-party truces; a pact between other ' +
2325
+ 'players is report only — a warning where two of its parties each have a stack beside one territory of yours, the ' +
2326
+ "outlook's basis naming it, and a coalition partner at peace with the leader left out — never a change to the orders) " +
2298
2327
  '(no covered territory of the partner attacked while it is active or in notice; a covered border facing only ' +
2299
2328
  'the partner held against its stacks with no deploy, except your commander\'s, a valuable border, or while trust ' +
2300
2329
  'is watch; a border cap kept; a partner-approved truce exception on this turn makes its territories normal ' +
@@ -2970,6 +2999,11 @@ export function registerTurnTools(server, ctx, opts = {}) {
2970
2999
  // #385: siege_target only means something under goal siege; say so rather than drop it silently.
2971
3000
  if (siege_target !== undefined && goal !== 'siege')
2972
3001
  warnings.push(`siege_target is ignored: it applies only with goal "siege" (this plan's goal is ${goal ?? 'chosen by the game profile'}).`);
3002
+ // #680: pacts I am not in, report only: two parties each with a stack beside one territory of mine may strike
3003
+ // together (no order changes), and the outlook's basis names the pacts.
3004
+ const otherPacts = foePacts(truces?.pacts ?? [], game.players, me);
3005
+ warnings.push(...pactThreatWarnings(pactJointThreats(graph, seen, me.id, otherPacts)));
3006
+ const outlookBasis = outlook.basis + pactsBasis(otherPacts);
2973
3007
  // #317: a surrender waiting on my acceptance is the first thing said, before the commander's line.
2974
3008
  // #436: the surrender line, advice only (the server never acts on it): said up front once crossed.
2975
3009
  // #445 (owner, 2026-11-23): in a free-for-all with three or more still playing, once the line is crossed, a
@@ -2990,7 +3024,10 @@ export function registerTurnTools(server, ctx, opts = {}) {
2990
3024
  breakers.add(p);
2991
3025
  }
2992
3026
  const ledger = ctx.dataDir ? await readLedger(ctx.dataDir, game.id, me.id) : undefined;
2993
- const atWar = atWarWith(ledger, trailing);
3027
+ // #680: a pact I am in counts per partner, as the same truces recorded apart would.
3028
+ const atWar = atWarWith(ledger ? { ...ledger, agreements: ledgerTruces(ledger) } : undefined, trailing);
3029
+ // #680: a player at peace with the leader (a pact I am not in) is no partner against it.
3030
+ const atPeace = new Set(atPeaceWith(truces?.pacts ?? [], leader));
2994
3031
  const leaderLand = new Set();
2995
3032
  for (const t of board.territories)
2996
3033
  if (t.owner.kind === 'player' && t.owner.playerId === leader)
@@ -3010,6 +3047,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3010
3047
  bordersLeader: beside,
3011
3048
  out: new Set(game.players.filter((p) => !holdsSeat(p.state)).map((p) => Number(p.id))),
3012
3049
  atWar,
3050
+ ...(atPeace.size ? { atPeace } : {}),
3013
3051
  breakers,
3014
3052
  bonuses: leaderBonuses(graph, board, leader, new Set([me.id, ...trailing])),
3015
3053
  turnsBelow: Math.max(line.turnsBelow, streak?.turns ?? 0),
@@ -3059,7 +3097,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3059
3097
  meId: me.id,
3060
3098
  board: seen,
3061
3099
  neighbors: graph.neighbors,
3062
- truces: chatTruces(planLedger?.agreements, turn, game.players),
3100
+ truces: chatTruces(planLedger ? ledgerTruces(planLedger) : undefined, turn, game.players),
3063
3101
  surrenders,
3064
3102
  })
3065
3103
  : [];
@@ -3073,7 +3111,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3073
3111
  territories: map.territories.map((t) => ({ id: t.id, name: t.name })),
3074
3112
  bonuses: map.bonuses.map((b) => ({ id: b.id, name: b.name })),
3075
3113
  standing: planStanding({ profile: plan.profile, me: me.id, myIncome, estimates, players: game.players }),
3076
- truces: chatTruces(planLedger?.agreements, turn, game.players),
3114
+ truces: chatTruces(planLedger ? ledgerTruces(planLedger) : undefined, turn, game.players),
3077
3115
  }, view === 'full' ? 'full' : 'compact')
3078
3116
  : undefined;
3079
3117
  // #412: the decision log keeps the chat read this turn, ids and labels only.
@@ -3141,12 +3179,12 @@ export function registerTurnTools(server, ctx, opts = {}) {
3141
3179
  // #178: the outlook and its basis; full adds each turn judged.
3142
3180
  // #304: the compact view keeps what the state rests on beside it (`evidence`).
3143
3181
  outlook: rung === 'full'
3144
- ? outlook
3182
+ ? { ...outlook, basis: outlookBasis }
3145
3183
  : {
3146
3184
  state: outlook.state,
3147
3185
  // #454: the income lean beside an even state (additive; the state keeps its four values).
3148
3186
  ...(outlook.lean ? { lean: outlook.lean } : {}),
3149
- basis: outlook.basis,
3187
+ basis: outlookBasis,
3150
3188
  ...(outlook.evidence ? { evidence: outlook.evidence } : {}),
3151
3189
  // #368: even while bonuses kept falling.
3152
3190
  ...(outlook.leaning ? { leaning: outlook.leaning } : {}),
@@ -3846,7 +3884,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3846
3884
  meId: me.id,
3847
3885
  board,
3848
3886
  neighbors: graphOf(map).neighbors,
3849
- truces: chatTruces(ledger?.agreements, turnNumber, game.players),
3887
+ truces: chatTruces(ledger ? ledgerTruces(ledger) : undefined, turnNumber, game.players),
3850
3888
  })
3851
3889
  : [];
3852
3890
  const blocksGate = chatBlocksTurnFor(ctx, opts.env);
@@ -3861,7 +3899,8 @@ export function registerTurnTools(server, ctx, opts = {}) {
3861
3899
  : `would block with WARAPP_CHAT_BLOCKS_TURN=on: ${chatBlockLine(b)}`);
3862
3900
  const breaks = ctx.dataDir
3863
3901
  ? truceBreaksIn({
3864
- agreements: ledger?.agreements ?? [],
3902
+ // #680: a pact I am in reads per partner, as the same truces recorded apart would.
3903
+ agreements: ledgerTruces(ledger),
3865
3904
  graph: graphOf(map),
3866
3905
  board,
3867
3906
  me: me.id,
@@ -3981,6 +4020,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
3981
4020
  const promises = commitmentWarnings({
3982
4021
  commitments: ledger?.commitments ?? [],
3983
4022
  agreements: ledger?.agreements ?? [],
4023
+ pacts: ledger?.pacts,
3984
4024
  graph: graphOf(map),
3985
4025
  board,
3986
4026
  me: me.id,
@@ -148,12 +148,12 @@ export function registerUncommitTool(server, ctx) {
148
148
  await dropOrdersCache(ctx.dataDir, gameId, me, turn);
149
149
  // B2: warapp_submit_turn's break_agreement recorded a truce broken-by-me when these orders
150
150
  // were committed. They never ran now, but broken-by-me is final: say so, never undo it.
151
- const stillBroken = ctx.dataDir && turn !== null
152
- ? ((await readLedger(ctx.dataDir, gameId, me))?.agreements ?? [])
153
- .filter((a) => a.status === 'broken-by-me' && a.endedTurn === turn)
154
- .map((a) => a.id)
155
- .sort()
156
- : [];
151
+ // #680: a pact broken by these orders too.
152
+ const recorded = ctx.dataDir && turn !== null ? await readLedger(ctx.dataDir, gameId, me) : undefined;
153
+ const stillBroken = [...(recorded?.agreements ?? []), ...(recorded?.pacts ?? [])]
154
+ .filter((a) => a.status === 'broken-by-me' && a.endedTurn === turn)
155
+ .map((a) => a.id)
156
+ .sort();
157
157
  return {
158
158
  status: 'uncommitted',
159
159
  outcome: 'confirmed',
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.24.0'; // x-release-please-version
4
+ export const VERSION = '0.25.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.24.0",
6
+ "version": "0.25.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). 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 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.24.0",
3
+ "version": "0.25.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.24.0",
9
+ "version": "0.25.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.24.0",
14
+ "version": "0.25.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },