@chrischall/warapp-mcp 0.22.1 → 0.23.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.
Files changed (72) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +49 -3
  4. package/dist/analysis/coalition.js +3 -2
  5. package/dist/analysis/outlook.js +42 -2
  6. package/dist/analysis/plan/captures.js +3 -1
  7. package/dist/analysis/plan/relations.js +1 -1
  8. package/dist/analysis/plan/report.js +2 -2
  9. package/dist/analysis/plan/targets.js +48 -12
  10. package/dist/analysis/plan/threats.js +55 -2
  11. package/dist/analysis/planner.js +2 -1
  12. package/dist/analysis/relations.js +40 -7
  13. package/dist/bundle.js +10250 -3744
  14. package/dist/chat.js +93 -3
  15. package/dist/clans.js +308 -0
  16. package/dist/forums.js +70 -0
  17. package/dist/friends.js +83 -0
  18. package/dist/index.js +1 -1
  19. package/dist/invite-code.js +46 -0
  20. package/dist/join-color.js +23 -13
  21. package/dist/ladders.js +360 -0
  22. package/dist/mail.js +295 -0
  23. package/dist/my-games.js +18 -1
  24. package/dist/notifications.js +22 -4
  25. package/dist/open-games.js +29 -2
  26. package/dist/outlook-log.js +1 -0
  27. package/dist/protocol/bundle.js +4 -4
  28. package/dist/protocol/codec.js +1 -1
  29. package/dist/protocol/methods.js +690 -8
  30. package/dist/protocol/rpc.js +28 -3
  31. package/dist/push/socketio.js +2 -2
  32. package/dist/quickmatch.js +264 -0
  33. package/dist/surrender-pending.js +62 -2
  34. package/dist/templates.js +451 -0
  35. package/dist/tools/boot-player.js +165 -0
  36. package/dist/tools/calibration-harness.js +8 -1
  37. package/dist/tools/calibration.js +14 -2
  38. package/dist/tools/chat.js +19 -0
  39. package/dist/tools/clan-writes.js +208 -0
  40. package/dist/tools/clans.js +181 -0
  41. package/dist/tools/end-game-common.js +49 -0
  42. package/dist/tools/forums.js +535 -0
  43. package/dist/tools/friends.js +50 -0
  44. package/dist/tools/game.js +21 -3
  45. package/dist/tools/index.js +39 -0
  46. package/dist/tools/invites.js +347 -0
  47. package/dist/tools/join-game.js +4 -4
  48. package/dist/tools/ladders.js +418 -0
  49. package/dist/tools/leave-game.js +85 -27
  50. package/dist/tools/live-context.js +2 -2
  51. package/dist/tools/mail.js +600 -0
  52. package/dist/tools/my-games.js +50 -6
  53. package/dist/tools/notifications.js +12 -3
  54. package/dist/tools/nudge.js +178 -0
  55. package/dist/tools/quickmatch.js +481 -0
  56. package/dist/tools/react.js +177 -0
  57. package/dist/tools/relations.js +3 -2
  58. package/dist/tools/session.js +6 -2
  59. package/dist/tools/team-surrender.js +206 -0
  60. package/dist/tools/templates.js +342 -0
  61. package/dist/tools/tournaments.js +495 -0
  62. package/dist/tools/turn.js +4 -1
  63. package/dist/tools/vote-to-end.js +142 -0
  64. package/dist/tools/write-kit.js +22 -1
  65. package/dist/tournaments.js +321 -0
  66. package/dist/trend.js +1 -0
  67. package/dist/version.js +1 -1
  68. package/manifest.json +190 -2
  69. package/mint.yaml +3 -4
  70. package/package.json +1 -1
  71. package/server.json +2 -2
  72. package/skills/warapp-mcp/SKILL.md +39 -6
@@ -226,7 +226,10 @@ function territoryMap(board) {
226
226
  function mineOn(board, me) {
227
227
  return new Set(board.territories.filter((t) => ownerShown(t) && ownerOn(t) === me).map((t) => t.territoryId));
228
228
  }
229
- /** What my orders say should stand on `t` after the turn (deploys, moves out, moves in from mine). */
229
+ /**
230
+ * What my orders say should stand on `t` after the turn (deploys, moves out, moves in from mine, and
231
+ * #665: my Airlifts out and in, when the cache kept their count).
232
+ */
230
233
  function expectedArmies(t, before, orders, mine) {
231
234
  let n = before;
232
235
  for (const d of orders.deploys)
@@ -238,8 +241,32 @@ function expectedArmies(t, before, orders, mine) {
238
241
  if (m.to === t && mine.has(m.from))
239
242
  n += m.armies;
240
243
  }
244
+ for (const c of orders.cards ?? []) {
245
+ if (c.card !== 'Airlift' || c.armies === undefined)
246
+ continue;
247
+ if (c.from === t)
248
+ n -= c.armies;
249
+ if (c.to === t && c.from !== undefined && mine.has(c.from))
250
+ n += c.armies;
251
+ }
241
252
  return n;
242
253
  }
254
+ /** #665: my card plays that hand a territory over (to a player, or to the neutral). */
255
+ const GIVES_AWAY = new Set(['Gift', 'Blockade', 'EmergencyBlockade']);
256
+ /** #665: whether my own card play gave `t` away this turn (its new owner is no evidence against anyone). */
257
+ function gaveAway(t, orders) {
258
+ return (orders?.cards ?? []).some((c) => GIVES_AWAY.has(c.card) && c.target === t);
259
+ }
260
+ /**
261
+ * #665: whether an Airlift of mine may have moved armies on `t` that my orders do not count: one touching
262
+ * it cached without its count, or card plays not recorded at all (an older cache) in a game that may have
263
+ * Airlift (`cards` absent: the settings were not read, any card may be).
264
+ */
265
+ function airliftUncounted(t, orders, cards) {
266
+ if (orders.cards === undefined)
267
+ return cards === undefined || cards.includes('Airlift');
268
+ return orders.cards.some((c) => c.card === 'Airlift' && c.armies === undefined && (c.from === t || c.to === t));
269
+ }
243
270
  /**
244
271
  * Whether a transfer of mine into `t` may not have arrived in full: its source is no longer shown
245
272
  * as mine, or holds fewer armies than my orders leave there (it was hit, so the move may never have
@@ -292,9 +319,10 @@ export function capSelfCheck(a, boards, me) {
292
319
  /**
293
320
  * What my boards say about the partner keeping `agreement`, over the consecutive turns from the
294
321
  * one it was agreed (and before it ended), as flags with their turn and evidence:
295
- * - `broken`: the partner took a covered territory of mine, or attacked one (my orders known,
296
- * armies lost there, only the partner — visibly — borders it, and no transfer of mine in came
297
- * from a source taken or hit, which may never have arrived);
322
+ * - `broken`: the partner took a covered territory of mine (not one my own Gift or Blockade handed
323
+ * over, #665), or attacked one (my orders known, armies lost there beyond my deploys, moves and
324
+ * Airlifts, only the partner — visibly — borders it, no transfer of mine in came from a source taken
325
+ * or hit, which may never have arrived, and no Airlift of mine there went uncounted, #665);
298
326
  * - `cap-exceeded` (newest board): a visible partner territory beside a covered one holds more
299
327
  * than the cap;
300
328
  * - `massing`: the partner's visible armies within {@link TRUCE_MASSING_REACH} steps of the
@@ -340,6 +368,9 @@ export function breachWatch(input) {
340
368
  const shown = ownerShown(after);
341
369
  const neighbours = neighborsOf(graph, c);
342
370
  const partnerNext = neighbours.some((n) => ownerOn(ownerShown(was.get(n))) === partner || ownerOn(ownerShown(now.get(n))) === partner);
371
+ // #665: my own Gift or Blockade handed it over.
372
+ if (gaveAway(c, from.orders))
373
+ continue;
343
374
  if (shown && ownerOn(shown) === partner) {
344
375
  taken.push(c);
345
376
  continue;
@@ -362,8 +393,9 @@ export function breachWatch(input) {
362
393
  // cannot; a fogged neighbour or another player could.
363
394
  if (!partnerNext)
364
395
  continue;
365
- // A transfer of mine in whose source was taken or hit may never have arrived: open, not a break.
366
- if (fedByHitSource(c, from.orders, mine, was, now, me)) {
396
+ // A transfer of mine in whose source was taken or hit may never have arrived, and (#665) an Airlift of
397
+ // mine my orders cannot count may have moved them: open, not a break.
398
+ if (fedByHitSource(c, from.orders, mine, was, now, me) || airliftUncounted(c, from.orders, input.cards)) {
367
399
  ambiguous.push(c);
368
400
  continue;
369
401
  }
@@ -631,6 +663,7 @@ export function planRelationsFrom(input) {
631
663
  boards: input.boards,
632
664
  me,
633
665
  ...(incomes.mine !== null ? { incomes: { mine: incomes.mine, partner: partnerIncome ?? null } } : {}),
666
+ ...(input.cards ? { cards: input.cards } : {}),
634
667
  });
635
668
  const others = [...incomes.opponents].filter(([id]) => id !== a.with);
636
669
  const endgame = incomes.mine !== null && partnerIncome !== null && partnerIncome !== undefined && others.every(([, v]) => v !== null)
@@ -920,7 +953,7 @@ export function truceVerdict(price, income) {
920
953
  return {
921
954
  verdict: 'no',
922
955
  reasons: [
923
- `player ${p} broke the truce${b ? `: ${b.term} on turn ${b.turn} (${b.evidence})` : ''}; it is an ordinary opponent now, and no truce is priced as trusted (T8)`,
956
+ `player ${p} broke the truce${b ? `: ${b.term} on turn ${b.turn} (${b.evidence})` : ''}; it is an ordinary opponent now, and no truce is priced as trusted (T8). If the partner had agreed to that move, record a \`theirs\` exception with warapp_record_agreement instead (#665)`,
924
957
  ],
925
958
  };
926
959
  }