@chrischall/warapp-mcp 0.24.0 → 0.26.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.
@@ -28,8 +28,9 @@ import { loadLiveGame, standInLine, standInOf } from './live-context.js';
28
28
  import { BRIDGE_NOTE, playerArg, resolveMe } from './live.js';
29
29
  import { mapOf } from './map.js';
30
30
  import { resolvePlayer, resolveTerritory } from './resolve.js';
31
- import { BELOW_PLAN_BASIS, boardHistory, bordersBelowPlan, currentTurn, truceRelations, friendsOf, guardOffWarnings, modsWarning, plannerSettings, requirePlayingSeat, requireTurnPhase, turnOrdersArg, } from './turn.js';
31
+ import { BELOW_PLAN_BASIS, boardHistory, bordersBelowPlan, currentTurn, truceRelations, foePacts, friendsOf, guardOffWarnings, modsWarning, plannerSettings, requirePlayingSeat, requireTurnPhase, turnOrdersArg, } from './turn.js';
32
32
  import { resolveTeamsFor } from './team-source.js';
33
+ import { pactPairs } from '../analysis/pacts.js';
33
34
  import { stressOpponents } from './stress-opponents.js';
34
35
  import { observedLowWarning } from '../analysis/opponents.js';
35
36
  import { statedShiftWarning } from '../analysis/plan/estimates.js';
@@ -92,7 +93,8 @@ export function registerCheckPlanTool(server, ctx) {
92
93
  '`movedIn` names each), or every stack attacking at once; a stack you attack moving out ' +
93
94
  'first (a dodge: into its own territory, or a neutral or one of yours it can take — `dodges` lists each ' +
94
95
  'with the armies that got away and what your strike then hit); two opponents striking one of your ' +
95
- 'territories together (teammates always; any two in a free-for-all when you lead — `jointFalls` gives the ' +
96
+ 'territories together (teammates always; two at peace by a pact you are not in — a reported pact, a Diplomacy ' +
97
+ 'card or a Diplomacy 2 alliance between them, marked `pact`; any two in a free-for-all when you lead — `jointFalls` gives the ' +
96
98
  'armies each such territory needs to hold); and, under Multi-Attack, each stack\'s most damaging chain ' +
97
99
  'of captures. Under Local Deployment each deploy is bounded by where its bonus armies may land. Each ' +
98
100
  'reply is tried with you moving first and with the opponent moving first unless `first_mover` says ' +
@@ -429,7 +431,13 @@ export function registerCheckPlanTool(server, ctx) {
429
431
  // PLAN-TEAMS D3: a Diplomacy card in effect that the decoder is sure of is a truce here in any format
430
432
  // (T9: the game enforces it). Its player stays among the opponents too: the decoder is unverified.
431
433
  // T9 too: a Diplomacy 2 mod alliance (read only in a game that runs the mod) is a truce the game enforces.
432
- const resolvedTruces = await truceRelations(ctx, { game, me, turn, graph, board: seen, boards: history.boards, myIncome: income, tracks, diplomacy: effect.diplomacy });
434
+ const resolvedTruces = await truceRelations(ctx, {
435
+ game, me, turn, graph, board: seen, boards: history.boards, myIncome: income, tracks, diplomacy: effect.diplomacy, diplomacyOthers: effect.diplomacyOthers,
436
+ });
437
+ // #680: two opponents at peace by a pact I am not in (reported, a Diplomacy card, a Diplomacy 2 alliance) are
438
+ // tried striking one territory of mine together, as teammates are (counted in `safe` the same way).
439
+ const opponentIds = new Set(opponents.map((o) => o.id));
440
+ const pacts = pactPairs(foePacts(resolvedTruces?.pacts ?? [], game.players, me)).filter(([x, y]) => opponentIds.has(x) && opponentIds.has(y));
433
441
  const truces = resolvedTruces?.relations ?? [];
434
442
  const modRead = resolvedTruces?.mod;
435
443
  const binding = truces.filter((r) => !friend(r.player) &&
@@ -467,6 +475,7 @@ export function registerCheckPlanTool(server, ctx) {
467
475
  ...(settings.localDeployments && (settings.bonusArmyPer ?? 0) > 0 ? { perTerritoryIncome: true } : {}),
468
476
  leader,
469
477
  ...(binding.length ? { truces: binding.map((r) => ({ player: r.player, covered: r.coveredMine })) } : {}),
478
+ ...(pacts.length ? { pacts } : {}),
470
479
  });
471
480
  // #274: my commander, by the check warapp_submit_turn refuses on (commander-check.ts): the same
472
481
  // opponents, each reply at the larger of its estimate and my income (enemy_deploy only raises it,
@@ -604,7 +613,7 @@ export function registerCheckPlanTool(server, ctx) {
604
613
  harmful: d.harmful,
605
614
  });
606
615
  /** #180: a territory two opponents take together, in a sentence. */
607
- const jointText = (j) => `Players ${j.opponents[0]} and ${j.opponents[1]} together take territory ${j.territory} (${j.armies} there) with ${j.attackers[0]} from ` +
616
+ const jointText = (j) => `Players ${j.opponents[0]} and ${j.opponents[1]}${j.pact ? ' (at peace by a pact, #680)' : ''} together take territory ${j.territory} (${j.armies} there) with ${j.attackers[0]} from ` +
608
617
  `territory ${j.from[0]} and ${j.attackers[1]} from territory ${j.from[1]}: it needs ${j.needs} to hold${j.bonusesLost.length ? `, or bonus${j.bonusesLost.length === 1 ? '' : 'es'} ${j.bonusesLost.map((b) => `${b.id} (${signed(b.value)})`).join(', ')} goes with it` : ''}.`;
609
618
  const jointView = (j) => ({
610
619
  text: jointText(j),
@@ -616,6 +625,7 @@ export function registerCheckPlanTool(server, ctx) {
616
625
  attackers: j.attackers,
617
626
  bonusesLost: j.bonusesLost.map((b) => bonusOf(b.id)),
618
627
  incomeLost: j.incomeLost,
628
+ ...(j.pact ? { pact: true } : {}),
619
629
  });
620
630
  /** One exposure in a sentence, by id. */
621
631
  const exposure = (e) => `Next turn player ${e.opponent} can reach territory ${e.territory} (${e.armies} there) with ${e.attackers} from territory ${e.from} ` +
@@ -12,8 +12,8 @@ import { McpToolError } from '@chrischall/mcp-utils';
12
12
  import { z } from 'zod';
13
13
  import { checkCommitments, MAX_MESSAGE_COMMITMENTS, MAX_NO_ATTACK_TURNS, } from '../analysis/commitments.js';
14
14
  import { planTurn } from '../analysis/index.js';
15
- import { MAX_NOTICE_TURNS } from '../analysis/relations.js';
16
- import { nextAgreementId, readLedger } from '../relations-store.js';
15
+ import { MAX_NOTICE_TURNS, MAX_PARTIES, PACT_RESTS } from '../analysis/relations.js';
16
+ import { nextAgreementId, nextPactId, readLedger } from '../relations-store.js';
17
17
  import { readCachedOrders } from '../trend.js';
18
18
  import { currentTurn } from './common.js';
19
19
  import { loadLiveGame } from './live-context.js';
@@ -29,6 +29,14 @@ const scopeArgs = {
29
29
  territories: z.array(ref).max(MAX_SCOPE_ITEMS).optional().describe("Only these territories (names or ids); omit with `bonuses` for all of the player's."),
30
30
  bonuses: z.array(ref).max(MAX_SCOPE_ITEMS).optional().describe("Only these bonuses' territories (names or ids)."),
31
31
  };
32
+ /** #685: a pact's other parties: two or more players besides you. */
33
+ const playersArg = z
34
+ .array(ref)
35
+ .min(2)
36
+ .max(MAX_PARTIES - 1)
37
+ .optional()
38
+ .describe(`#685: an n-way truce — the other parties (names or GameFeed ids, 2–${MAX_PARTIES - 1}; you make ${MAX_PARTIES} at most), instead of \`player\`. ` +
39
+ 'One pact `p<n>` with you in it. Every party must read the message: a game group holding all of them, or the public channel.');
32
40
  const termsArgs = {
33
41
  ...scopeArgs,
34
42
  notice_turns: z.coerce.number().int().min(0).max(MAX_NOTICE_TURNS).optional().describe('Turns of notice before the truce ends (default 1).'),
@@ -56,7 +64,12 @@ export const commitmentArg = z.discriminatedUnion('kind', [
56
64
  z
57
65
  .object({
58
66
  kind: z.literal('notice').describe('I am ending our truce.'),
59
- agreement: z.string().trim().min(1).max(20).describe('The agreement (e.g. "a1") notice is given on.'),
67
+ agreement: z.string().trim().min(1).max(20).describe('The agreement (e.g. "a1") or pact ("p1") notice is given on.'),
68
+ rest: z
69
+ .enum(PACT_RESTS)
70
+ .optional()
71
+ .describe('A pact only, and required while three or more parties are bound: what becomes of the rest of the truce — ask the owner, it is ' +
72
+ 'never decided automatically. `continue`: you leave once your notice has run, the others stay bound; `end`: the whole pact ends then.'),
60
73
  ends_turn: z.coerce
61
74
  .number()
62
75
  .int()
@@ -68,15 +81,17 @@ export const commitmentArg = z.discriminatedUnion('kind', [
68
81
  z
69
82
  .object({
70
83
  kind: z.literal('propose').describe('I propose a truce on these terms.'),
71
- player: ref.describe('The partner (name or GameFeed id).'),
84
+ player: ref.optional().describe('The partner (name or GameFeed id); or `players` for an n-way truce.'),
85
+ players: playersArg,
72
86
  ...termsArgs,
73
87
  })
74
88
  .describe('A truce proposed (or a counter-offer).'),
75
89
  z
76
90
  .object({
77
91
  kind: z.literal('accept').describe('I accept this truce.'),
78
- agreement: z.string().trim().min(1).max(20).optional().describe('The recorded proposal accepted (e.g. "a1").'),
92
+ agreement: z.string().trim().min(1).max(20).optional().describe('The recorded proposal accepted (e.g. "a1", or a pact "p1").'),
79
93
  player: ref.optional().describe('The partner (name or GameFeed id), when no agreement id is given.'),
94
+ players: playersArg,
80
95
  ...termsArgs,
81
96
  })
82
97
  .describe('A truce accepted: a recorded proposal (any terms given must match it; those left out are not compared), or terms ' +
@@ -134,14 +149,28 @@ export function resolveCommitments(game, map, args) {
134
149
  ...(a.turn !== undefined ? { turn: a.turn } : {}),
135
150
  };
136
151
  case 'notice':
137
- return { kind: 'notice', agreement: a.agreement, ...(a.ends_turn !== undefined ? { endsTurn: a.ends_turn } : {}) };
152
+ return {
153
+ kind: 'notice',
154
+ agreement: a.agreement,
155
+ ...(a.ends_turn !== undefined ? { endsTurn: a.ends_turn } : {}),
156
+ ...(a.rest !== undefined ? { rest: a.rest } : {}),
157
+ };
138
158
  case 'propose':
139
- return { kind: 'propose', with: pid(a.player), terms: termsOf(map, a) };
159
+ if ((a.player === undefined) === (a.players === undefined))
160
+ throw new McpToolError(`A propose names \`player\` (a two-party truce) or \`players\` (an n-way truce), one of them: ${NOTHING_SENT}.`, {
161
+ hint: 'Give `player` for one partner, or `players` for two or more.',
162
+ });
163
+ return a.players !== undefined
164
+ ? { kind: 'propose', players: a.players.map(pid), terms: termsOf(map, a) }
165
+ : { kind: 'propose', with: pid(a.player), terms: termsOf(map, a) };
140
166
  case 'accept':
167
+ if (a.player !== undefined && a.players !== undefined)
168
+ throw new McpToolError(`An accept names \`player\` or \`players\`, not both: ${NOTHING_SENT}.`, { hint: 'Give `players` for an n-way truce.' });
141
169
  return {
142
170
  kind: 'accept',
143
171
  ...(a.agreement !== undefined ? { agreement: a.agreement } : {}),
144
172
  ...(a.player !== undefined ? { with: pid(a.player) } : {}),
173
+ ...(a.players !== undefined ? { players: a.players.map(pid) } : {}),
145
174
  ...(termsGiven(a) ? { terms: givenTermsOf(map, a) } : {}),
146
175
  };
147
176
  }
@@ -197,6 +226,8 @@ teamsKnown = true) {
197
226
  players,
198
227
  agreements: ledger?.agreements ?? [],
199
228
  nextAgreementId: (agreements) => nextAgreementId({ agreements }),
229
+ pacts: ledger?.pacts ?? [],
230
+ nextPactId: (pacts) => nextPactId({ pacts }),
200
231
  commitments,
201
232
  moves,
202
233
  source,
@@ -209,7 +240,8 @@ teamsKnown = true) {
209
240
  hint: 'Promise only what the plan does: change or drop the commitment, and drop the promise from the message (an undeclared ' +
210
241
  'promise is not allowed). To promise an attack the plan does not make, submit those orders first (warapp_submit_turn); ' +
211
242
  'to change a truce, record it with warapp_record_agreement. A proposal, an acceptance or a notice goes to the ' +
212
- 'partner: privately to that player, or to the whole game.',
243
+ 'partner: privately to that player, or to the whole game; on an n-way truce (`players`, a pact "p<n>") to every party — ' +
244
+ 'a game group holding all of them, or the whole game. A notice on a pact of three or more needs `rest`: ask the owner.',
213
245
  });
214
246
  }
215
247
  return { turn, source, commitments, checks, players };
@@ -14,7 +14,8 @@ import { McpToolError } from '@chrischall/mcp-utils';
14
14
  import { z } from 'zod';
15
15
  import { findChokepoints, planTurn } from '../analysis/index.js';
16
16
  import { diplomacyFacts, MAX_NOTICE_TURNS, offerChecks, partyRefusal, priceTruce, scopeRefusal, sharedBorder, agreementState, suggestedTerms, TERMINAL_STATUSES, truceEndgame, truceVerdict, } from '../analysis/relations.js';
17
- import { readLedger } from '../relations-store.js';
17
+ import { ledgerTruces, readLedger } from '../relations-store.js';
18
+ import { atPeaceWith, pactLabel, pactsInForce, peersOf } from '../analysis/pacts.js';
18
19
  import { isTeamGame } from '../teams.js';
19
20
  import { bonusNamer, currentTurn, gameIdArg, graphOf, namer, readAnnotations, respond, untrustedDescription, untrustedText, viewArg } from './common.js';
20
21
  import { lookupMeta } from './hints.js';
@@ -80,7 +81,11 @@ export function registerDiplomacyTool(server, ctx, opts = {}) {
80
81
  'proposed — never parsed from chat), the same price and three checks: do I gain only if they keep it, do I ' +
81
82
  'lose if I comply and they do not, do they gain from my compliance; all three true means run warapp_check_plan ' +
82
83
  'first. `facts`: true statements about third players you may cite to each neighbour, each with whether it can ' +
83
- `see them under the game's fog. Refused outside a free-for-all. ${BRIDGE_NOTE} Sends nothing and records ` +
84
+ "see them under the game's fog. #680: `pactsBetweenOthers` lists the pacts between other players binding this " +
85
+ 'turn (reported, one you left, a Diplomacy card or a Diplomacy 2 alliance between two others), and a neighbour ' +
86
+ 'already at peace with another player carries `atPeaceWith` and a reason saying so — report only, no price reads it. ' +
87
+ '#686: a pact a party broke in view on your boards carries `broken: true` and its `flags`, and no longer counts as peace. ' +
88
+ `Refused outside a free-for-all. ${BRIDGE_NOTE} Sends nothing and records ` +
84
89
  'nothing: record an agreement with warapp_record_agreement, and send a message with warapp_send_chat.'),
85
90
  _meta: lookupMeta(['truce advice', 'should i make a truce', 'diplomacy', 'price a deal', 'they offered a truce', 'alliance']),
86
91
  annotations: readAnnotations('Advise on war.app truces'),
@@ -254,7 +259,8 @@ export function registerDiplomacyTool(server, ctx, opts = {}) {
254
259
  continue;
255
260
  }
256
261
  const border = sharedBorder(graph, board, me.id, partner, chokepoints);
257
- const open = ledger?.agreements.find((a) => a.with === partner && !TERMINAL_STATUSES.has(a.status));
262
+ // #680: a pact I am in counts per partner, as the same truce recorded apart would.
263
+ const open = ledgerTruces(ledger).find((a) => a.with === partner && !TERMINAL_STATUSES.has(a.status));
258
264
  const terms = open ? open.terms : suggestedTerms(border, turn);
259
265
  const { priced, verdict, recordState, related: rel } = await price(partner, terms, open?.id);
260
266
  built.push({ partner, ...(open ? { agreement: open.id } : {}), border, terms, priced, verdict, recordState, related: rel, facts });
@@ -267,11 +273,26 @@ export function registerDiplomacyTool(server, ctx, opts = {}) {
267
273
  : undefined;
268
274
  const description = game.description !== undefined ? untrustedText(game.description, DESCRIPTION_MAX) : null;
269
275
  // The Diplomacy 2 mod's alliances beside the ledger (the read warapp_plan_turn's setup made; none without the mod).
270
- const liveAgreements = (ledger?.agreements ?? []).filter((a) => {
276
+ const liveAgreements = ledgerTruces(ledger).filter((a) => {
271
277
  const st = agreementState(a, turn ?? 0, players);
272
278
  return st.phase === 'active' || st.phase === 'notice';
273
279
  });
274
280
  const modView = setup.truces ? modRelationsView(setup.truces.mod, liveAgreements, playerRef) : undefined;
281
+ // #680: the pacts between other players this turn (report only): who each neighbour is already at peace with.
282
+ const pacts = setup.truces?.pacts ?? [];
283
+ const peaceOf = (partner) => {
284
+ // #686: a broken pact no longer counts as peace.
285
+ // #686 (owner, 2026-12-01): only the parties it has not broken with.
286
+ const with_ = pactsInForce(pacts)
287
+ .filter((k) => k.parties.includes(partner))
288
+ .map((k) => ({ k, peers: peersOf(k, partner) }))
289
+ .filter((x) => x.peers.length > 0);
290
+ if (!with_.length)
291
+ return undefined;
292
+ return `Player ${partner} is already at peace with ${with_
293
+ .map(({ k, peers }) => `player${peers.length > 1 ? 's' : ''} ${peers.join(', ')} (${pactLabel(k)})`)
294
+ .join('; ')}: a truce with it does not free it from them, and they may act together (#680, report only).`;
295
+ };
275
296
  return respond(view, VIEWS, (rung) => {
276
297
  const neighbours = built.map((b) => ({
277
298
  player: playerRef(b.partner),
@@ -291,7 +312,8 @@ export function registerDiplomacyTool(server, ctx, opts = {}) {
291
312
  terms: { ...termsView(b.terms), source: b.agreement ? 'recorded' : 'suggested' },
292
313
  price: priceView(b.priced, rung),
293
314
  verdict: b.verdict.verdict,
294
- reasons: b.verdict.reasons,
315
+ reasons: peaceOf(b.partner) ? [...b.verdict.reasons, peaceOf(b.partner)] : b.verdict.reasons,
316
+ ...(atPeaceWith(pacts, b.partner).length ? { atPeaceWith: atPeaceWith(pacts, b.partner).map(playerRef) } : {}),
295
317
  record: b.recordState,
296
318
  ...(habitsOf(b.partner) ? { habits: habitsOf(b.partner) } : {}),
297
319
  }),
@@ -307,6 +329,21 @@ export function registerDiplomacyTool(server, ctx, opts = {}) {
307
329
  description,
308
330
  },
309
331
  ...(modView ? { modAlliances: modView } : {}),
332
+ ...(pacts.length
333
+ ? {
334
+ pactsBetweenOthers: pacts.map((k) => ({
335
+ parties: k.parties.map(playerRef),
336
+ source: k.source,
337
+ ...(k.agreement ? { agreement: k.agreement } : {}),
338
+ ...(k.untilTurn !== undefined ? { untilTurn: k.untilTurn } : {}),
339
+ ...(k.endsTurn !== undefined ? { endsTurn: k.endsTurn } : {}),
340
+ // #686: a party broke it in view: it no longer counts (report only).
341
+ ...(k.broken ? { broken: true } : {}),
342
+ ...(k.brokenPairs ? { brokenPairs: k.brokenPairs.map((pr) => pr.map(playerRef)) } : {}),
343
+ ...(k.flags?.length ? { flags: k.flags.map((f) => ({ ...f, by: playerRef(f.by), against: playerRef(f.against), territories: f.territories.map(name) })) } : {}),
344
+ })),
345
+ }
346
+ : {}),
310
347
  income: setup.income,
311
348
  neighbours,
312
349
  ...(offerResult
@@ -8,6 +8,8 @@ import { lossReport } from './how-lost.js';
8
8
  import { endOfGame, finishedAccount } from './end-of-game.js';
9
9
  import { foldFinished } from './profile-hook.js';
10
10
  import { NO_BOOT_MINUTES } from './boot-player.js';
11
+ import { readDecisionLog } from '../decision-log.js';
12
+ import { turnOrderFor } from './turn-order.js';
11
13
  const VIEWS = ['compact', 'full', 'raw'];
12
14
  function settingsDigest(s) {
13
15
  if (!s)
@@ -121,7 +123,12 @@ cards) {
121
123
  'pieces toward the next one and `of` how many make one; read by shape, UNVERIFIED live; `null` when unread), and ' +
122
124
  '`settings` (each card in play with a `duration`, and Sanctions\' `percentage` — negative raises the target\'s income — ' +
123
125
  'with its `effect` and `targets`: opponents, or your side when negative) — a ' +
124
- 'failed read is `cardsUnread`, never an error. For the map\'s bonuses and chokepoints use warapp_get_map. Read-only.'),
126
+ 'failed read is `cardsUnread`, never an error. ' +
127
+ 'While the game is played and this server kept turns of it, `turnOrder` (#693) says who moves before me: per ' +
128
+ 'turn (the last turns read, this one and the next five) the order when known, else `beforeMe`/`afterMe`/`unknown` by ' +
129
+ 'player id, each row `known` (read from that turn) or `projected` (Cycle: the order reverses every turn); ' +
130
+ '`perOpponent` for this turn; `firstMover` only when every opponent agrees; Random games project nothing. ' +
131
+ 'For the map\'s bonuses and chokepoints use warapp_get_map. Read-only.'),
125
132
  _meta: lookupMeta(['warzone game', 'war.app game', 'whose turn is it', 'game status']),
126
133
  annotations: readAnnotations('Get a war.app game'),
127
134
  inputSchema: z.object({
@@ -163,8 +170,13 @@ cards) {
163
170
  }
164
171
  }
165
172
  const cardRead = cards ? await cards(game) : {};
173
+ // #693: the move order this turn and the next ones, from the turns this server kept (no request). The account is
174
+ // the decision log's own.
175
+ const log = dir && game.state === 'Playing' ? await readDecisionLog(dir(), game.id).catch(() => undefined) : undefined;
176
+ const turnOrder = log ? await turnOrderFor({ dataDir: dir(), game, me: log.playerId, log }) : undefined;
166
177
  const folded = {
167
178
  ...cardRead,
179
+ ...(turnOrder ? { turnOrder } : {}),
168
180
  ...(fold && fold.status !== 'off' ? { profileFold: fold } : {}),
169
181
  ...(lost ? { howLost: lost } : {}),
170
182
  ...(end && end.status !== 'off' ? { endOfGame: end } : {}),
@@ -9,7 +9,7 @@ import { z } from 'zod';
9
9
  import { inGameOf, playersByInGameId } from '../live.js';
10
10
  import { Method, writeGameRefreshParams } from '../protocol/methods.js';
11
11
  import { readMyOrderList } from '../my-orders.js';
12
- import { allianceMismatches, allyAttacksIn, breakAlerts, breaksInOrders, diplomacy2From, modPairs, myAllies, readModData, runsDiplomacy2, } from '../mod-alliances.js';
12
+ import { allianceMismatches, allyAttacksIn, breakAlerts, breaksInOrders, diplomacy2From, modPairs, myAllies, othersAlliances, readModData, runsDiplomacy2, } from '../mod-alliances.js';
13
13
  import { currentTurn, gameIdArg, readAnnotations, respond, untrustedDescription, untrustedText } from './common.js';
14
14
  import { lookupMeta } from './hints.js';
15
15
  import { readLatestBoard } from './live-context.js';
@@ -50,6 +50,18 @@ export async function readModAlliances(ctx, game, me) {
50
50
  const allies = ids.map(feedOf).filter((x) => x !== null);
51
51
  return { status: 'read', state, me: mine, allies, unmapped: ids.length - allies.length, feedOf };
52
52
  }
53
+ /**
54
+ * #680: the Diplomacy 2 alliances between two other players, by GameFeed id (each pair ascending): pacts between
55
+ * them, report only. Only a read that worked; a player whose in-game id maps to no GameFeed player is left out.
56
+ */
57
+ export function modPacts(read) {
58
+ if (read.status !== 'read')
59
+ return [];
60
+ return othersAlliances(read.state, read.me).flatMap(([x, y]) => {
61
+ const [a, b] = [read.feedOf(x), read.feedOf(y)];
62
+ return a === null || b === null || a === b ? [] : [[a, b].sort((p, q) => p - q)];
63
+ });
64
+ }
53
65
  /** The warnings a turn tool adds for a mod-191 game (none for `no-mod`). */
54
66
  export function modAllianceWarnings(read) {
55
67
  if (read.status === 'no-mod')