@chrischall/warapp-mcp 0.23.0 → 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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/analysis/plan/captures.js +1 -1
- package/dist/analysis/plan/relations.js +1 -1
- package/dist/analysis/plan/targets.js +33 -7
- package/dist/analysis/relations.js +40 -7
- package/dist/bundle.js +65 -18
- package/dist/tools/calibration-harness.js +8 -1
- package/dist/tools/calibration.js +14 -2
- package/dist/tools/relations.js +3 -2
- package/dist/tools/turn.js +3 -0
- package/dist/trend.js +1 -0
- package/dist/version.js +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "MCP server for war.app (Warzone) — your games, players, settings, map bonuses and chokepoints, board analysis and route planning through war.app's per-player GameFeed API, plus the live board, territory picks, cards, turn planning and submission, turn notifications and game chat through your signed-in war.app tab (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 and linking a session are confirm-gated).",
|
|
10
|
-
"version": "0.23.
|
|
10
|
+
"version": "0.23.1"
|
|
11
11
|
},
|
|
12
12
|
"plugins": [
|
|
13
13
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"displayName": "war.app (Warzone)",
|
|
16
16
|
"source": "./",
|
|
17
17
|
"description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
|
|
18
|
-
"version": "0.23.
|
|
18
|
+
"version": "0.23.1",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Chris Hall"
|
|
21
21
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warapp-mcp",
|
|
3
3
|
"displayName": "war.app (Warzone)",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.1",
|
|
5
5
|
"description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Chris Hall",
|
|
@@ -1050,7 +1050,7 @@ export function bonusPasses(pc, ps, book, hd, tgt, prev) {
|
|
|
1050
1050
|
const st = state.get(x);
|
|
1051
1051
|
restCost += !st || st.owner.kind === 'unknown' || st.armies === null ? Infinity : (captureCost(defenceAt(x), s) ?? Infinity);
|
|
1052
1052
|
}
|
|
1053
|
-
const penalty = p.
|
|
1053
|
+
const penalty = p.interimPenalty;
|
|
1054
1054
|
const step = gainWith([t]);
|
|
1055
1055
|
// The income left once this step (and this turn's other captures) lands: the staging
|
|
1056
1056
|
// capture itself lowers it, so the turns to finish are counted at that income (#70).
|
|
@@ -631,7 +631,7 @@ export function armiesFreed(pc, ps, threats, relaxed, hold) {
|
|
|
631
631
|
* and says nothing. `freedOn` is {@link armiesFreed} for one relation's relaxed borders.
|
|
632
632
|
*/
|
|
633
633
|
/** T8: `warapp_submit_turn` reads only the ledger, so a break the plan acts on must be recorded first. */
|
|
634
|
-
const RECORD_BROKEN = (r) => `Record it with warapp_record_agreement (${r.agreement ? `agreement_id ${r.agreement}, ` : ''}status broken-by-them) before submitting: until then warapp_submit_turn refuses an order on its covered territories.`;
|
|
634
|
+
const RECORD_BROKEN = (r) => `Record it with warapp_record_agreement (${r.agreement ? `agreement_id ${r.agreement}, ` : ''}status broken-by-them) before submitting: until then warapp_submit_turn refuses an order on its covered territories. If the partner had agreed to that move (a capture allowed in chat, the usual reason), record a \`theirs\` exception with warapp_record_agreement's \`exceptions\` instead: that is no break (#665).`;
|
|
635
635
|
export function reportTruce(pc, ps, tp, freedOn) {
|
|
636
636
|
const { truce, label, turnNow } = pc;
|
|
637
637
|
if (!truce.given.length)
|
|
@@ -609,15 +609,30 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
609
609
|
continue;
|
|
610
610
|
}
|
|
611
611
|
// Cluster as a unit (#70): the negative bonuses its missing members complete come off its
|
|
612
|
-
// worth (on a map without negative bonuses, net = value).
|
|
612
|
+
// worth (on a map without negative bonuses, net = value). #664: so do the positive bonuses they
|
|
613
|
+
// complete add to it — on a count-based map a district pays through its pairs and triples, a
|
|
614
|
+
// negative "full" bonus and the district's own: valued by the negatives alone, every whole
|
|
615
|
+
// district read as a loss.
|
|
613
616
|
const rest = new Set(remaining);
|
|
614
|
-
const
|
|
615
|
-
const
|
|
617
|
+
const others = completedOver((x) => mineSet.has(x) || rest.has(x), remaining).filter((id) => id !== b.id);
|
|
618
|
+
const valueOf = (id) => g.bonusById.get(id).value;
|
|
619
|
+
const penalties = others.filter((id) => valueOf(id) < 0);
|
|
620
|
+
const penalty = penalties.reduce((n, id) => n + valueOf(id), 0);
|
|
621
|
+
// Only beside a penalty: where no negative bonus is triggered, the overlapping positives are
|
|
622
|
+
// regions planned in their own right, and crediting them made a region hundreds of armies from
|
|
623
|
+
// done read as worth advancing into (a Westeros board: The North +6 read as +99).
|
|
624
|
+
const extras = penalty < 0 ? others.filter((id) => valueOf(id) > 0) : [];
|
|
625
|
+
const extra = extras.reduce((n, id) => n + valueOf(id), 0);
|
|
616
626
|
// #125: its missing members' per-territory income (Extra Armies for Territories) is income too.
|
|
617
627
|
const perGain = territoryShare(remaining.length);
|
|
618
|
-
const net = b.value + penalty + perGain;
|
|
619
|
-
if (penalty < 0 && remaining.some(bonusTarget))
|
|
620
|
-
|
|
628
|
+
const net = b.value + penalty + extra + perGain;
|
|
629
|
+
if (penalty < 0 && remaining.some(bonusTarget)) {
|
|
630
|
+
const also = [
|
|
631
|
+
...(extras.length ? [`${extras.length} other positive bonus${extras.length === 1 ? '' : 'es'} (+${extra})`] : []),
|
|
632
|
+
`${penalties.length} negative bonus${penalties.length === 1 ? '' : 'es'} (${penalty})`,
|
|
633
|
+
].join(' and ');
|
|
634
|
+
rationale.push(`Bonus ${b.name} (#${b.id}) (+${b.value}) is worth ${net >= 0 ? '+' : ''}${net} net once complete: its missing members also complete ${also}${extras.length ? '' : ', and each step short of completion only adds penalties'}.`);
|
|
635
|
+
}
|
|
621
636
|
if (net <= 0 && !isFocus) {
|
|
622
637
|
for (const t of remaining)
|
|
623
638
|
uneconomicMember.add(t);
|
|
@@ -780,6 +795,8 @@ export function bonusScoring(pc, ps, threats, prev) {
|
|
|
780
795
|
borders: analyzeBonus(g, b.id).borderTerritoryIds.length,
|
|
781
796
|
defenseCost,
|
|
782
797
|
net,
|
|
798
|
+
// #664: the income the steps short of completion cost (its penalties less per-territory income), as before.
|
|
799
|
+
interimPenalty: -penalty - perGain,
|
|
783
800
|
frontier,
|
|
784
801
|
fogged,
|
|
785
802
|
fogEach,
|
|
@@ -901,7 +918,16 @@ export function closestBonus(pc, ps, input, prev, hd) {
|
|
|
901
918
|
* its own (a pair bonus beside a single-territory one) — with their net income added up.
|
|
902
919
|
*/
|
|
903
920
|
const completesWith = (p) => plans.filter((q) => q.remaining.every((t) => p.remaining.includes(t)));
|
|
904
|
-
|
|
921
|
+
/**
|
|
922
|
+
* #664: the income the capture adds — every bonus its missing members complete, each once (summing
|
|
923
|
+
* the plans' nets counted a penalty, a pair or a per-territory share once per plan that shares it),
|
|
924
|
+
* plus their per-territory income.
|
|
925
|
+
*/
|
|
926
|
+
const incomeOf = (p) => {
|
|
927
|
+
const rest = new Set(p.remaining);
|
|
928
|
+
const bonuses = pc.completedOver((x) => pc.mineSet.has(x) || rest.has(x), p.remaining);
|
|
929
|
+
return bonuses.reduce((n, id) => n + pc.g.bonusById.get(id).value, 0) + pc.territoryShare(p.remaining.length);
|
|
930
|
+
};
|
|
905
931
|
/** #438: that income per army, on the score's cost (`ratio`, scaled from this bonus's net to the sum). */
|
|
906
932
|
const perArmy = (p) => {
|
|
907
933
|
const r = prev.ratio(p);
|
|
@@ -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
|
-
/**
|
|
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
|
|
296
|
-
*
|
|
297
|
-
*
|
|
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
|
|
366
|
-
|
|
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
|
}
|
package/dist/bundle.js
CHANGED
|
@@ -101559,7 +101559,7 @@ function armiesFreed(pc, ps, threats, relaxed, hold) {
|
|
|
101559
101559
|
}
|
|
101560
101560
|
return Math.min(freed, income);
|
|
101561
101561
|
}
|
|
101562
|
-
var RECORD_BROKEN = (r) => `Record it with warapp_record_agreement (${r.agreement ? `agreement_id ${r.agreement}, ` : ""}status broken-by-them) before submitting: until then warapp_submit_turn refuses an order on its covered territories.`;
|
|
101562
|
+
var RECORD_BROKEN = (r) => `Record it with warapp_record_agreement (${r.agreement ? `agreement_id ${r.agreement}, ` : ""}status broken-by-them) before submitting: until then warapp_submit_turn refuses an order on its covered territories. If the partner had agreed to that move (a capture allowed in chat, the usual reason), record a \`theirs\` exception with warapp_record_agreement's \`exceptions\` instead: that is no break (#665).`;
|
|
101563
101563
|
function reportTruce(pc, ps, tp, freedOn) {
|
|
101564
101564
|
const { truce, label: label3, turnNow } = pc;
|
|
101565
101565
|
if (!truce.given.length) return void 0;
|
|
@@ -106571,14 +106571,23 @@ function bonusScoring(pc, ps, threats, prev) {
|
|
|
106571
106571
|
if (!remaining.length) continue;
|
|
106572
106572
|
}
|
|
106573
106573
|
const rest = new Set(remaining);
|
|
106574
|
-
const
|
|
106575
|
-
const
|
|
106574
|
+
const others = completedOver((x) => mineSet.has(x) || rest.has(x), remaining).filter((id) => id !== b.id);
|
|
106575
|
+
const valueOf = (id) => g.bonusById.get(id).value;
|
|
106576
|
+
const penalties = others.filter((id) => valueOf(id) < 0);
|
|
106577
|
+
const penalty = penalties.reduce((n, id) => n + valueOf(id), 0);
|
|
106578
|
+
const extras2 = penalty < 0 ? others.filter((id) => valueOf(id) > 0) : [];
|
|
106579
|
+
const extra = extras2.reduce((n, id) => n + valueOf(id), 0);
|
|
106576
106580
|
const perGain = territoryShare(remaining.length);
|
|
106577
|
-
const net = b.value + penalty + perGain;
|
|
106578
|
-
if (penalty < 0 && remaining.some(bonusTarget))
|
|
106581
|
+
const net = b.value + penalty + extra + perGain;
|
|
106582
|
+
if (penalty < 0 && remaining.some(bonusTarget)) {
|
|
106583
|
+
const also = [
|
|
106584
|
+
...extras2.length ? [`${extras2.length} other positive bonus${extras2.length === 1 ? "" : "es"} (+${extra})`] : [],
|
|
106585
|
+
`${penalties.length} negative bonus${penalties.length === 1 ? "" : "es"} (${penalty})`
|
|
106586
|
+
].join(" and ");
|
|
106579
106587
|
rationale.push(
|
|
106580
|
-
`Bonus ${b.name} (#${b.id}) (+${b.value}) is worth
|
|
106588
|
+
`Bonus ${b.name} (#${b.id}) (+${b.value}) is worth ${net >= 0 ? "+" : ""}${net} net once complete: its missing members also complete ${also}${extras2.length ? "" : ", and each step short of completion only adds penalties"}.`
|
|
106581
106589
|
);
|
|
106590
|
+
}
|
|
106582
106591
|
if (net <= 0 && !isFocus) {
|
|
106583
106592
|
for (const t of remaining) uneconomicMember.add(t);
|
|
106584
106593
|
if (remaining.some(bonusTarget))
|
|
@@ -106654,8 +106663,8 @@ function bonusScoring(pc, ps, threats, prev) {
|
|
|
106654
106663
|
let neutralEachLoss = foggedNeutral ? neutralLoss : 0;
|
|
106655
106664
|
if (wasteShare > 0 && (fogged || foggedNeutral)) {
|
|
106656
106665
|
const surcharge = (each, eachLoss) => {
|
|
106657
|
-
const
|
|
106658
|
-
return { extra, extraLoss:
|
|
106666
|
+
const extra2 = Number.isFinite(each) ? Math.ceil(wasteShare * Math.max(0, wasteCost - each)) : 0;
|
|
106667
|
+
return { extra: extra2, extraLoss: extra2 > 0 ? Math.ceil(wasteShare * Math.max(0, wasteLoss - eachLoss)) : 0 };
|
|
106659
106668
|
};
|
|
106660
106669
|
const a = fogged ? surcharge(fogEach, fogLoss) : { extra: 0, extraLoss: 0 };
|
|
106661
106670
|
const n = foggedNeutral ? surcharge(neutralEach, neutralEachLoss) : { extra: 0, extraLoss: 0 };
|
|
@@ -106728,6 +106737,8 @@ function bonusScoring(pc, ps, threats, prev) {
|
|
|
106728
106737
|
borders: analyzeBonus(g, b.id).borderTerritoryIds.length,
|
|
106729
106738
|
defenseCost,
|
|
106730
106739
|
net,
|
|
106740
|
+
// #664: the income the steps short of completion cost (its penalties less per-territory income), as before.
|
|
106741
|
+
interimPenalty: -penalty - perGain,
|
|
106731
106742
|
frontier,
|
|
106732
106743
|
fogged,
|
|
106733
106744
|
fogEach,
|
|
@@ -106804,7 +106815,11 @@ function closestBonus(pc, ps, input2, prev, hd) {
|
|
|
106804
106815
|
};
|
|
106805
106816
|
const scoreRank = new Map(plans.map((p, i2) => [p.bonusId, i2]));
|
|
106806
106817
|
const completesWith = (p) => plans.filter((q) => q.remaining.every((t) => p.remaining.includes(t)));
|
|
106807
|
-
const incomeOf = (p) =>
|
|
106818
|
+
const incomeOf = (p) => {
|
|
106819
|
+
const rest = new Set(p.remaining);
|
|
106820
|
+
const bonuses = pc.completedOver((x) => pc.mineSet.has(x) || rest.has(x), p.remaining);
|
|
106821
|
+
return bonuses.reduce((n, id) => n + pc.g.bonusById.get(id).value, 0) + pc.territoryShare(p.remaining.length);
|
|
106822
|
+
};
|
|
106808
106823
|
const perArmy = (p) => {
|
|
106809
106824
|
const r = prev.ratio(p);
|
|
106810
106825
|
return Number.isFinite(r) && p.net > 0 ? r * incomeOf(p) / p.net : r;
|
|
@@ -107761,7 +107776,7 @@ function bonusPasses(pc, ps, book, hd, tgt, prev) {
|
|
|
107761
107776
|
const st = state.get(x);
|
|
107762
107777
|
restCost += !st || st.owner.kind === "unknown" || st.armies === null ? Infinity : captureCost(defenceAt(x), s) ?? Infinity;
|
|
107763
107778
|
}
|
|
107764
|
-
const penalty = p.
|
|
107779
|
+
const penalty = p.interimPenalty;
|
|
107765
107780
|
const step = gainWith([t]);
|
|
107766
107781
|
const after = incomeAfter2(/* @__PURE__ */ new Set([...heldNow(), t]));
|
|
107767
107782
|
const turns = after > 0 ? Math.max(1, Math.ceil(restCost / after)) : Infinity;
|
|
@@ -116214,7 +116229,7 @@ function serverBuild() {
|
|
|
116214
116229
|
}
|
|
116215
116230
|
|
|
116216
116231
|
// src/version.ts
|
|
116217
|
-
var VERSION2 = "0.23.
|
|
116232
|
+
var VERSION2 = "0.23.1";
|
|
116218
116233
|
|
|
116219
116234
|
// src/decision-log.ts
|
|
116220
116235
|
var DECISION_LOG_VERSION = 1;
|
|
@@ -117221,8 +117236,21 @@ function expectedArmies(t, before, orders, mine3) {
|
|
|
117221
117236
|
if (m.from === t) n -= m.armies;
|
|
117222
117237
|
if (m.to === t && mine3.has(m.from)) n += m.armies;
|
|
117223
117238
|
}
|
|
117239
|
+
for (const c of orders.cards ?? []) {
|
|
117240
|
+
if (c.card !== "Airlift" || c.armies === void 0) continue;
|
|
117241
|
+
if (c.from === t) n -= c.armies;
|
|
117242
|
+
if (c.to === t && c.from !== void 0 && mine3.has(c.from)) n += c.armies;
|
|
117243
|
+
}
|
|
117224
117244
|
return n;
|
|
117225
117245
|
}
|
|
117246
|
+
var GIVES_AWAY = /* @__PURE__ */ new Set(["Gift", "Blockade", "EmergencyBlockade"]);
|
|
117247
|
+
function gaveAway(t, orders) {
|
|
117248
|
+
return (orders?.cards ?? []).some((c) => GIVES_AWAY.has(c.card) && c.target === t);
|
|
117249
|
+
}
|
|
117250
|
+
function airliftUncounted(t, orders, cards2) {
|
|
117251
|
+
if (orders.cards === void 0) return cards2 === void 0 || cards2.includes("Airlift");
|
|
117252
|
+
return orders.cards.some((c) => c.card === "Airlift" && c.armies === void 0 && (c.from === t || c.to === t));
|
|
117253
|
+
}
|
|
117226
117254
|
function fedByHitSource(t, orders, mine3, was, now, me) {
|
|
117227
117255
|
return orders.moves.some((m) => {
|
|
117228
117256
|
if (m.to !== t || !mine3.has(m.from)) return false;
|
|
@@ -117283,6 +117311,7 @@ function breachWatch(input2) {
|
|
|
117283
117311
|
const shown2 = ownerShown(after);
|
|
117284
117312
|
const neighbours = neighborsOf(graph, c);
|
|
117285
117313
|
const partnerNext = neighbours.some((n) => ownerOn(ownerShown(was.get(n))) === partner || ownerOn(ownerShown(now.get(n))) === partner);
|
|
117314
|
+
if (gaveAway(c, from.orders)) continue;
|
|
117286
117315
|
if (shown2 && ownerOn(shown2) === partner) {
|
|
117287
117316
|
taken.push(c);
|
|
117288
117317
|
continue;
|
|
@@ -117297,7 +117326,7 @@ function breachWatch(input2) {
|
|
|
117297
117326
|
if (before == null || nowArmies == null) continue;
|
|
117298
117327
|
if (expectedArmies(c, before, from.orders, mine3) - nowArmies <= 0) continue;
|
|
117299
117328
|
if (!partnerNext) continue;
|
|
117300
|
-
if (fedByHitSource(c, from.orders, mine3, was, now, me)) {
|
|
117329
|
+
if (fedByHitSource(c, from.orders, mine3, was, now, me) || airliftUncounted(c, from.orders, input2.cards)) {
|
|
117301
117330
|
ambiguous2.push(c);
|
|
117302
117331
|
continue;
|
|
117303
117332
|
}
|
|
@@ -117504,7 +117533,8 @@ function planRelationsFrom(input2) {
|
|
|
117504
117533
|
graph,
|
|
117505
117534
|
boards: input2.boards,
|
|
117506
117535
|
me,
|
|
117507
|
-
...incomes.mine !== null ? { incomes: { mine: incomes.mine, partner: partnerIncome ?? null } } : {}
|
|
117536
|
+
...incomes.mine !== null ? { incomes: { mine: incomes.mine, partner: partnerIncome ?? null } } : {},
|
|
117537
|
+
...input2.cards ? { cards: input2.cards } : {}
|
|
117508
117538
|
});
|
|
117509
117539
|
const others = [...incomes.opponents].filter(([id]) => id !== a.with);
|
|
117510
117540
|
const endgame = incomes.mine !== null && partnerIncome !== null && partnerIncome !== void 0 && others.every(([, v]) => v !== null) ? truceEndgame({ mine: incomes.mine, partner: partnerIncome, others: others.map(([, v]) => v) }) : false;
|
|
@@ -117718,7 +117748,7 @@ function truceVerdict(price, income) {
|
|
|
117718
117748
|
return {
|
|
117719
117749
|
verdict: "no",
|
|
117720
117750
|
reasons: [
|
|
117721
|
-
`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)`
|
|
117751
|
+
`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)`
|
|
117722
117752
|
]
|
|
117723
117753
|
};
|
|
117724
117754
|
}
|
|
@@ -138095,7 +138125,8 @@ function ordersOf(o) {
|
|
|
138095
138125
|
card: c.card,
|
|
138096
138126
|
...isNum(c.from) ? { from: c.from } : {},
|
|
138097
138127
|
...isNum(c.to) ? { to: c.to } : {},
|
|
138098
|
-
...isNum(c.target) ? { target: c.target } : {}
|
|
138128
|
+
...isNum(c.target) ? { target: c.target } : {},
|
|
138129
|
+
...isNum(c.armies) ? { armies: c.armies } : {}
|
|
138099
138130
|
}))
|
|
138100
138131
|
} : {}
|
|
138101
138132
|
};
|
|
@@ -155727,7 +155758,9 @@ function myOrdersOf2(orders) {
|
|
|
155727
155758
|
card: o.card,
|
|
155728
155759
|
...o.from !== void 0 ? { from: o.from } : {},
|
|
155729
155760
|
...o.to !== void 0 ? { to: o.to } : {},
|
|
155730
|
-
...o.target !== void 0 ? { target: o.target } : {}
|
|
155761
|
+
...o.target !== void 0 ? { target: o.target } : {},
|
|
155762
|
+
// #665: the truce watch counts what an Airlift took out of or landed on a territory.
|
|
155763
|
+
...o.card === "Airlift" && o.armies !== void 0 ? { armies: o.armies } : {}
|
|
155731
155764
|
}
|
|
155732
155765
|
] : []
|
|
155733
155766
|
)
|
|
@@ -155898,6 +155931,7 @@ async function truceRelations(ctx, a) {
|
|
|
155898
155931
|
boards: [...a.boards, { turn, board: a.board }],
|
|
155899
155932
|
me: me.id,
|
|
155900
155933
|
turn,
|
|
155934
|
+
...cardsInPlay(game),
|
|
155901
155935
|
players: game.players.map((p) => ({
|
|
155902
155936
|
id: p.id,
|
|
155903
155937
|
...p.isAI ? { isAI: true } : {},
|
|
@@ -159890,7 +159924,7 @@ async function updateAgreementRecord(o) {
|
|
|
159890
159924
|
let context;
|
|
159891
159925
|
if (agreement.status !== before?.status && (agreement.status === "broken-by-them" || agreement.status === "broken-by-me")) {
|
|
159892
159926
|
const boards = await cachedBoards(dir, game, me);
|
|
159893
|
-
breachFlag = strongestFlag(breachWatch({ agreement, graph, boards, me: me.id }));
|
|
159927
|
+
breachFlag = strongestFlag(breachWatch({ agreement, graph, boards, me: me.id, ...cardsInPlay(game) }));
|
|
159894
159928
|
const incomes = incomesOf(graph, boards, game, me, map2);
|
|
159895
159929
|
const partnerIncome = incomes.opponents.get(agreement.with) ?? null;
|
|
159896
159930
|
context = {
|
|
@@ -160101,6 +160135,7 @@ function registerRelationsTools(server, ctx, opts = {}) {
|
|
|
160101
160135
|
graph,
|
|
160102
160136
|
boards,
|
|
160103
160137
|
me: me.id,
|
|
160138
|
+
...cardsInPlay(game),
|
|
160104
160139
|
...live_ && incomes.mine !== null ? { incomes: { mine: incomes.mine, partner: incomes.opponents.get(a.with) ?? null } } : {}
|
|
160105
160140
|
}) : [];
|
|
160106
160141
|
const endgame = live_ ? endgameOf(incomes, a.with) : null;
|
|
@@ -173432,13 +173467,16 @@ var HARNESS_APPROXIMATIONS = [
|
|
|
173432
173467
|
"the history boards: no capture, no failed attack, no orders cached; army growth alone is not orders) or a boot of my seat in turns",
|
|
173433
173468
|
"1-4 is reported apart, never averaged in."
|
|
173434
173469
|
];
|
|
173470
|
+
var yieldToLoop = () => new Promise((resolve6) => setImmediate(resolve6));
|
|
173435
173471
|
async function calibrationHarness(dir, opts = {}) {
|
|
173436
173472
|
const src = await calibrationSources(dir);
|
|
173437
173473
|
const counts = { histories: src.statuses, skipped: src.skipped, scored: 0, recordOnly: 0, benchmarked: 0, samples: 0 };
|
|
173438
173474
|
const byFormat = {};
|
|
173439
173475
|
const benchByFormat = {};
|
|
173440
173476
|
const eraEntries = [];
|
|
173477
|
+
let done = 0;
|
|
173441
173478
|
for (const input2 of src.inputs) {
|
|
173479
|
+
opts.signal?.throwIfAborted();
|
|
173442
173480
|
const { history: h, settings, map: map2, cached: cached4 } = input2;
|
|
173443
173481
|
if (input2.source === "record-only") counts.recordOnly++;
|
|
173444
173482
|
const me = h.me;
|
|
@@ -173491,7 +173529,10 @@ async function calibrationHarness(dir, opts = {}) {
|
|
|
173491
173529
|
});
|
|
173492
173530
|
eraEntries.push({ era, basis, format, territories: graph.territoryById.size, flags, bench });
|
|
173493
173531
|
}
|
|
173532
|
+
opts.progress?.(++done, src.inputs.length);
|
|
173533
|
+
await yieldToLoop();
|
|
173494
173534
|
}
|
|
173535
|
+
opts.signal?.throwIfAborted();
|
|
173495
173536
|
const calibration = {};
|
|
173496
173537
|
for (const [format, ests] of Object.entries(byFormat))
|
|
173497
173538
|
for (const [k, c] of Object.entries(ests))
|
|
@@ -173556,7 +173597,13 @@ function registerCalibrationTool(server, dataDir2) {
|
|
|
173556
173597
|
const games = format ? src.games.filter((g) => g.format === format) : src.games;
|
|
173557
173598
|
const report2 = incomeCalibration(games);
|
|
173558
173599
|
const rows = samples ? incomeSamples(games) : [];
|
|
173559
|
-
const
|
|
173600
|
+
const signal = currentCallSignal();
|
|
173601
|
+
const extra = harness ? await calibrationHarness(dir, {
|
|
173602
|
+
...callerWantsProgress() ? {
|
|
173603
|
+
progress: (done, total) => void reportProgress(done, total, `calibration harness: ${done} of ${total} games`).catch(() => void 0)
|
|
173604
|
+
} : {},
|
|
173605
|
+
...signal ? { signal } : {}
|
|
173606
|
+
}) : void 0;
|
|
173560
173607
|
return respond(void 0, ["compact"], () => ({
|
|
173561
173608
|
readAs: CALIBRATION_NOTE,
|
|
173562
173609
|
sources: {
|
|
@@ -23,14 +23,18 @@ export const HARNESS_APPROXIMATIONS = [
|
|
|
23
23
|
'the history boards: no capture, no failed attack, no orders cached; army growth alone is not orders) or a boot of my seat in turns',
|
|
24
24
|
'1-4 is reported apart, never averaged in.',
|
|
25
25
|
];
|
|
26
|
-
/**
|
|
26
|
+
/** Lets the event loop run between games, so a progress notification or a cancellation gets through. */
|
|
27
|
+
const yieldToLoop = () => new Promise((resolve) => setImmediate(resolve));
|
|
28
|
+
/** Run the harness over `dir`. Never requests. */
|
|
27
29
|
export async function calibrationHarness(dir, opts = {}) {
|
|
28
30
|
const src = await calibrationSources(dir);
|
|
29
31
|
const counts = { histories: src.statuses, skipped: src.skipped, scored: 0, recordOnly: 0, benchmarked: 0, samples: 0 };
|
|
30
32
|
const byFormat = {};
|
|
31
33
|
const benchByFormat = {};
|
|
32
34
|
const eraEntries = [];
|
|
35
|
+
let done = 0;
|
|
33
36
|
for (const input of src.inputs) {
|
|
37
|
+
opts.signal?.throwIfAborted();
|
|
34
38
|
const { history: h, settings, map, cached } = input;
|
|
35
39
|
if (input.source === 'record-only')
|
|
36
40
|
counts.recordOnly++;
|
|
@@ -88,7 +92,10 @@ export async function calibrationHarness(dir, opts = {}) {
|
|
|
88
92
|
});
|
|
89
93
|
eraEntries.push({ era, basis, format, territories: graph.territoryById.size, flags, bench });
|
|
90
94
|
}
|
|
95
|
+
opts.progress?.(++done, src.inputs.length);
|
|
96
|
+
await yieldToLoop();
|
|
91
97
|
}
|
|
98
|
+
opts.signal?.throwIfAborted();
|
|
92
99
|
const calibration = {};
|
|
93
100
|
for (const [format, ests] of Object.entries(byFormat))
|
|
94
101
|
for (const [k, c] of Object.entries(ests))
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// can run the calibration on a hosted server whose data directory no local script can reach. The pure part is
|
|
4
4
|
// src/analysis/income-calibration.ts; `harness: true` adds the #318 harness (src/tools/calibration-harness.ts).
|
|
5
5
|
// Name-free: games are numbered by their place in the report, never by id; no player is named or numbered.
|
|
6
|
-
import { toolAnnotations } from '@chrischall/mcp-utils';
|
|
6
|
+
import { callerWantsProgress, currentCallSignal, reportProgress, toolAnnotations } from '@chrischall/mcp-utils';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { incomeCalibration, incomeSamples } from '../analysis/income-calibration.js';
|
|
9
9
|
import { profileFormatOf } from '../analysis/opponent-profile.js';
|
|
@@ -89,7 +89,19 @@ export function registerCalibrationTool(server, dataDir) {
|
|
|
89
89
|
const games = format ? src.games.filter((g) => g.format === format) : src.games;
|
|
90
90
|
const report = incomeCalibration(games);
|
|
91
91
|
const rows = samples ? incomeSamples(games) : [];
|
|
92
|
-
|
|
92
|
+
// The harness replays every finished game, which can outlast the 300 s a call may stay silent:
|
|
93
|
+
// progress after each game keeps the call alive, and a cancelled call stops between games.
|
|
94
|
+
const signal = currentCallSignal();
|
|
95
|
+
const extra = harness
|
|
96
|
+
? await calibrationHarness(dir, {
|
|
97
|
+
...(callerWantsProgress()
|
|
98
|
+
? {
|
|
99
|
+
progress: (done, total) => void reportProgress(done, total, `calibration harness: ${done} of ${total} games`).catch(() => undefined),
|
|
100
|
+
}
|
|
101
|
+
: {}),
|
|
102
|
+
...(signal ? { signal } : {}),
|
|
103
|
+
})
|
|
104
|
+
: undefined;
|
|
93
105
|
return respond(undefined, ['compact'], () => ({
|
|
94
106
|
readAs: CALIBRATION_NOTE,
|
|
95
107
|
sources: {
|
package/dist/tools/relations.js
CHANGED
|
@@ -24,7 +24,7 @@ import { lookupMeta, mintMeta } from './hints.js';
|
|
|
24
24
|
import { loadLiveGame } from './live-context.js';
|
|
25
25
|
import { BRIDGE_NOTE, playerArg, resolveMe } from './live.js';
|
|
26
26
|
import { mapOf } from './map.js';
|
|
27
|
-
import { recordProfile } from './profile-hook.js';
|
|
27
|
+
import { cardsInPlay, recordProfile } from './profile-hook.js';
|
|
28
28
|
import { resolveBonus, resolvePlayer, resolveTerritory } from './resolve.js';
|
|
29
29
|
import { boardHistory, plannerSettings } from './turn.js';
|
|
30
30
|
import { captureObservation } from './decision-capture.js';
|
|
@@ -248,7 +248,7 @@ export async function updateAgreementRecord(o) {
|
|
|
248
248
|
let context;
|
|
249
249
|
if (agreement.status !== before?.status && (agreement.status === 'broken-by-them' || agreement.status === 'broken-by-me')) {
|
|
250
250
|
const boards = await cachedBoards(dir, game, me);
|
|
251
|
-
breachFlag = strongestFlag(breachWatch({ agreement, graph, boards, me: me.id }));
|
|
251
|
+
breachFlag = strongestFlag(breachWatch({ agreement, graph, boards, me: me.id, ...cardsInPlay(game) }));
|
|
252
252
|
const incomes = incomesOf(graph, boards, game, me, map);
|
|
253
253
|
const partnerIncome = incomes.opponents.get(agreement.with) ?? null;
|
|
254
254
|
context = {
|
|
@@ -495,6 +495,7 @@ export function registerRelationsTools(server, ctx, opts = {}) {
|
|
|
495
495
|
graph,
|
|
496
496
|
boards,
|
|
497
497
|
me: me.id,
|
|
498
|
+
...cardsInPlay(game),
|
|
498
499
|
...(live_ && incomes.mine !== null ? { incomes: { mine: incomes.mine, partner: incomes.opponents.get(a.with) ?? null } } : {}),
|
|
499
500
|
})
|
|
500
501
|
: [];
|
package/dist/tools/turn.js
CHANGED
|
@@ -1074,6 +1074,8 @@ export function myOrdersOf(orders) {
|
|
|
1074
1074
|
...(o.from !== undefined ? { from: o.from } : {}),
|
|
1075
1075
|
...(o.to !== undefined ? { to: o.to } : {}),
|
|
1076
1076
|
...(o.target !== undefined ? { target: o.target } : {}),
|
|
1077
|
+
// #665: the truce watch counts what an Airlift took out of or landed on a territory.
|
|
1078
|
+
...(o.card === 'Airlift' && o.armies !== undefined ? { armies: o.armies } : {}),
|
|
1077
1079
|
},
|
|
1078
1080
|
]
|
|
1079
1081
|
: []),
|
|
@@ -1318,6 +1320,7 @@ export async function truceRelations(ctx, a) {
|
|
|
1318
1320
|
boards: [...a.boards, { turn, board: a.board }],
|
|
1319
1321
|
me: me.id,
|
|
1320
1322
|
turn,
|
|
1323
|
+
...cardsInPlay(game),
|
|
1321
1324
|
players: game.players.map((p) => ({
|
|
1322
1325
|
id: p.id,
|
|
1323
1326
|
...(p.isAI ? { isAI: true } : {}),
|
package/dist/trend.js
CHANGED
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.23.
|
|
4
|
+
export const VERSION = '0.23.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.23.
|
|
6
|
+
"version": "0.23.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). 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.23.
|
|
3
|
+
"version": "0.23.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.23.
|
|
9
|
+
"version": "0.23.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@chrischall/warapp-mcp",
|
|
14
|
-
"version": "0.23.
|
|
14
|
+
"version": "0.23.1",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|