@chrischall/warapp-mcp 0.23.0 → 0.23.2
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/deploy-estimates.js +17 -6
- package/dist/analysis/plan/estimates.js +1 -0
- package/dist/analysis/plan/relations.js +1 -1
- package/dist/analysis/plan/targets.js +33 -7
- package/dist/analysis/plan/threats.js +1 -1
- package/dist/analysis/relations.js +40 -7
- package/dist/bundle.js +223 -49
- package/dist/tools/calibration-harness.js +8 -1
- package/dist/tools/calibration-job.js +133 -0
- package/dist/tools/calibration-worker.js +10 -0
- package/dist/tools/calibration.js +52 -9
- package/dist/tools/check-plan.js +2 -1
- package/dist/tools/relations.js +3 -2
- package/dist/tools/turn.js +6 -2
- 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.2"
|
|
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.2",
|
|
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.2",
|
|
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).
|
|
@@ -16,18 +16,29 @@ const MIN_TRACK_CALIBRATION_SAMPLES = 5;
|
|
|
16
16
|
* that the full correction would put half the estimates above the truth.
|
|
17
17
|
*/
|
|
18
18
|
export const TRACK_CALIBRATION_DAMPING = 0.5;
|
|
19
|
+
/**
|
|
20
|
+
* #568 (owner decision 2026-11-29): a free-for-all damps less. Its 11-game calibration read the plan's estimates
|
|
21
|
+
* at 0.51× the truth (half under 0.5×, none over 1.5×) against 1.06× in 1v1 and 0.83× in team games; leave one
|
|
22
|
+
* game out on its 4 free-for-alls, 0.75 lifted the 25–50% band's tracked figure from 0.48× to 0.57× the truth
|
|
23
|
+
* with no more over 1.5× (15%). Team games keep {@link TRACK_CALIBRATION_DAMPING}.
|
|
24
|
+
*/
|
|
25
|
+
export const FFA_TRACK_CALIBRATION_DAMPING = 0.75;
|
|
26
|
+
/** #568: the damping a format's tracked figures are calibrated with ({@link FFA_TRACK_CALIBRATION_DAMPING}). */
|
|
27
|
+
export function trackCalibrationDampingFor(format) {
|
|
28
|
+
return format === 'ffa' ? FFA_TRACK_CALIBRATION_DAMPING : TRACK_CALIBRATION_DAMPING;
|
|
29
|
+
}
|
|
19
30
|
/**
|
|
20
31
|
* #568: the factor a tracked figure read from `share` of its frontier is divided by: its coverage band's past
|
|
21
|
-
* geometric mean of estimate ÷ truth (`calibration`, from lessons.json) to the
|
|
22
|
-
*
|
|
32
|
+
* geometric mean of estimate ÷ truth (`calibration`, from lessons.json) to the `damping` power (by default
|
|
33
|
+
* {@link TRACK_CALIBRATION_DAMPING}; {@link trackCalibrationDampingFor}); `undefined` when the band has under {@link MIN_TRACK_CALIBRATION_SAMPLES} samples or read at least the
|
|
23
34
|
* truth (the correction only ever raises).
|
|
24
35
|
*/
|
|
25
|
-
export function trackCalibrationFactor(calibration, share) {
|
|
36
|
+
export function trackCalibrationFactor(calibration, share, damping = TRACK_CALIBRATION_DAMPING) {
|
|
26
37
|
const band = coverageBucket(share);
|
|
27
38
|
const c = calibration?.[band];
|
|
28
39
|
if (!c || c.n < MIN_TRACK_CALIBRATION_SAMPLES || !(c.geoMean > 0) || c.geoMean >= 1)
|
|
29
40
|
return undefined;
|
|
30
|
-
return { band, geoMean: c.geoMean, n: c.n, factor: c.geoMean **
|
|
41
|
+
return { band, geoMean: c.geoMean, n: c.n, factor: c.geoMean ** damping, damping };
|
|
31
42
|
}
|
|
32
43
|
/**
|
|
33
44
|
* The army count every visible player territory holds, when they all hold the same one (the
|
|
@@ -309,10 +320,10 @@ export function enemyDeployEstimates(g, board, me, settings = {}, previous, trac
|
|
|
309
320
|
// lowered). The #123 bound above keeps the tracker's own figure.
|
|
310
321
|
let trackCalibration = null;
|
|
311
322
|
if (usable && tracked !== null && tracked > 0) {
|
|
312
|
-
const c = trackCalibrationFactor(when.calibration, coverage ? coverage.share : null);
|
|
323
|
+
const c = trackCalibrationFactor(when.calibration, coverage ? coverage.share : null, when.damping);
|
|
313
324
|
const figure = c ? Math.min(Math.max(couldEarn, tracked), Math.round(tracked / c.factor)) : tracked;
|
|
314
325
|
if (c && figure > tracked) {
|
|
315
|
-
trackCalibration = { raw: tracked, band: c.band, geoMean: c.geoMean, n: c.n, factor: c.factor, figure };
|
|
326
|
+
trackCalibration = { raw: tracked, band: c.band, geoMean: c.geoMean, n: c.n, factor: c.factor, damping: c.damping, figure };
|
|
316
327
|
tracked = figure;
|
|
317
328
|
}
|
|
318
329
|
}
|
|
@@ -99,6 +99,7 @@ export function planEnemyEstimates(input) {
|
|
|
99
99
|
...(ctx.reinforcementPlays ? { plays: ctx.reinforcementPlays } : {}),
|
|
100
100
|
...(previousBoard && input.previousOrders ? { previousOrders: input.previousOrders } : {}),
|
|
101
101
|
...(ctx.trackCalibration ? { calibration: ctx.trackCalibration } : {}),
|
|
102
|
+
...(ctx.trackCalibrationDamping !== undefined ? { damping: ctx.trackCalibrationDamping } : {}),
|
|
102
103
|
});
|
|
103
104
|
const priced = applyKnown(applyArmyPrice(applySanctions(estimates, input.sanctions ?? [], turn), input.settings?.armyCostMultiplier ?? 0), input.known ?? []);
|
|
104
105
|
return { estimates: priced, prior, ...(skipped ? { priorSkipped: skipped } : {}) };
|
|
@@ -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);
|
|
@@ -1130,7 +1130,7 @@ export function borderThreats(pc, ps, input, src, forces) {
|
|
|
1130
1130
|
// #568: the tracked figure raised by past games' calibration in its coverage band.
|
|
1131
1131
|
if (e.trackCalibration) {
|
|
1132
1132
|
const c = e.trackCalibration;
|
|
1133
|
-
warnings.push(`Player ${p}'s tracked income ~${c.raw} is raised to ~${c.figure} (#568, draft): past games' tracker read ${c.geoMean.toFixed(2)}× the true income at this frontier coverage (${c.band}, ${c.n} samples), divided by its square root (${c.factor.toFixed(2)}).`);
|
|
1133
|
+
warnings.push(`Player ${p}'s tracked income ~${c.raw} is raised to ~${c.figure} (#568, draft): past games' tracker read ${c.geoMean.toFixed(2)}× the true income at this frontier coverage (${c.band}, ${c.n} samples), divided by ${c.damping === 0.5 ? 'its square root' : `it to the ${c.damping} power`} (${c.factor.toFixed(2)}).`);
|
|
1134
1134
|
}
|
|
1135
1135
|
// #427: a card play the tracker read as income, taken out of its figure.
|
|
1136
1136
|
if (e.cardInTrack) {
|
|
@@ -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
|
}
|