@chrischall/warapp-mcp 0.7.0 → 0.8.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.
Files changed (53) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +2 -2
  4. package/dist/analysis/card-support.js +12 -4
  5. package/dist/analysis/coalition.js +55 -0
  6. package/dist/analysis/local-deploy.js +14 -0
  7. package/dist/analysis/opponents.js +2 -1
  8. package/dist/analysis/picks.js +270 -37
  9. package/dist/analysis/plan/after-leftover.js +26 -4
  10. package/dist/analysis/plan/captures.js +76 -13
  11. package/dist/analysis/plan/completed.js +8 -1
  12. package/dist/analysis/plan/conceded-out.js +16 -11
  13. package/dist/analysis/plan/deploy-estimates.js +513 -0
  14. package/dist/analysis/plan/doomed-out.js +135 -0
  15. package/dist/analysis/plan/estimates.js +3 -1
  16. package/dist/analysis/plan/free-capture.js +34 -0
  17. package/dist/analysis/plan/holds.js +8 -309
  18. package/dist/analysis/plan/horizon.js +42 -0
  19. package/dist/analysis/plan/leftover.js +43 -5
  20. package/dist/analysis/plan/observe.js +896 -0
  21. package/dist/analysis/plan/orders.js +35 -1
  22. package/dist/analysis/plan/report.js +10 -4
  23. package/dist/analysis/plan/shared.js +4 -1376
  24. package/dist/analysis/plan/stand-still.js +5 -3
  25. package/dist/analysis/plan/state.js +12 -0
  26. package/dist/analysis/plan/strike-stack.js +467 -0
  27. package/dist/analysis/plan/strike.js +3 -463
  28. package/dist/analysis/plan/targets.js +213 -26
  29. package/dist/analysis/plan/threats.js +12 -4
  30. package/dist/analysis/plan/transfers.js +24 -1
  31. package/dist/analysis/plan/two-move.js +1 -1
  32. package/dist/analysis/plan/withdraw.js +316 -0
  33. package/dist/analysis/planner.js +54 -11
  34. package/dist/analysis/player.js +4 -0
  35. package/dist/analysis/relations.js +8 -2
  36. package/dist/analysis/stress.js +1 -1
  37. package/dist/bundle.js +8008 -7184
  38. package/dist/my-games.js +2 -0
  39. package/dist/open-games.js +94 -10
  40. package/dist/tools/card-advice.js +26 -11
  41. package/dist/tools/card-support-advice.js +17 -1
  42. package/dist/tools/check-plan.js +2 -1
  43. package/dist/tools/commander-check.js +2 -1
  44. package/dist/tools/decision-capture.js +4 -2
  45. package/dist/tools/join-game.js +44 -8
  46. package/dist/tools/live.js +33 -5
  47. package/dist/tools/open-games.js +2 -2
  48. package/dist/tools/picks.js +120 -47
  49. package/dist/tools/turn.js +43 -4
  50. package/dist/version.js +1 -1
  51. package/manifest.json +1 -1
  52. package/package.json +1 -1
  53. package/server.json +2 -2
@@ -140,6 +140,31 @@ export function deployBook(ctx, ps, previousBoard) {
140
140
  }
141
141
  return cost <= paybackTurns * value && worst <= WASTELAND_FACTOR * value;
142
142
  };
143
+ /**
144
+ * #425 (owner decision of 2026-11-22): the bonus `ts` a lone foothold is my only way into still earns
145
+ * its share unless an enemy holds a missing member (which an enemy stack roaming inside it, #298, does
146
+ * too). Unlike {@link building} a member the fog hides keeps the share: it is passed over, not refused,
147
+ * and only the members in view are priced on #122's economy tests. A member a teammate holds is no
148
+ * bonus of mine to build, as in `building`.
149
+ */
150
+ const footholdBuilding = (ts, value) => {
151
+ let cost = 0;
152
+ let worst = 0;
153
+ for (const x of ts) {
154
+ if (ps.holdings.has(x))
155
+ continue;
156
+ const st = state.get(x);
157
+ const o = st?.owner;
158
+ if (o?.kind === 'player')
159
+ return false;
160
+ if (st === undefined || o?.kind !== 'neutral' || st.armies === null)
161
+ continue;
162
+ const c = econCostAt(x);
163
+ cost += c;
164
+ worst = Math.max(worst, c);
165
+ }
166
+ return cost <= paybackTurns * value && worst <= WASTELAND_FACTOR * value;
167
+ };
143
168
  /**
144
169
  * #298: a foe's stack arrived on `x` since `previousBoard`: it took `x` from me, or its armies there
145
170
  * grew, both read only where that board showed `x` (owner and armies). No previous board: none.
@@ -325,9 +350,18 @@ export function deployBook(ctx, ps, previousBoard) {
325
350
  continue;
326
351
  }
327
352
  // An incomplete bonus I am working on (T is in it): lost access if T is my only way in.
353
+ // #425: the only way in carries the share #122 gives a member of a bonus being built (value ×
354
+ // members held ÷ size: T alone here), and nothing when an enemy holds or roams a member
355
+ // (`footholdBuilding`; a fogged member keeps the share, owner decision of 2026-11-22). It used to
356
+ // carry the whole bonus whatever stood on the rest, so a lone foothold in a bonus an enemy holds
357
+ // part of drew a full bonus's hold (on the finished games' truth boards 276 of 285 such borders
358
+ // were in a bonus an enemy held part of; 7 of the 285 bonuses were ever completed).
328
359
  const access = (has) => ts.some((x) => has(x) || neighborsOf(g, x).some(has));
329
360
  if (!access(mineWithout)) {
330
- v += b.value;
361
+ if (footholdBuilding(ts, b.value)) {
362
+ const held = ts.filter((x) => ps.holdings.has(x) || x === t).length;
363
+ v += Math.round(((b.value * held) / ts.length) * 10) / 10;
364
+ }
331
365
  continue;
332
366
  }
333
367
  // #122: a member of a bonus I am building carries its share of the bonus — value × the
@@ -12,6 +12,7 @@ import { bonusTerritories } from '../bonuses.js';
12
12
  import { DEFAULT_DEFENSIVE_KILL_RATE, DEFAULT_OFFENSIVE_KILL_RATE, straightKills } from '../combat.js';
13
13
  import { classifyExchange } from '../exchange.js';
14
14
  import { neighborsOf } from '../graph.js';
15
+ import { poolShortfall } from '../local-deploy.js';
15
16
  import { bonusesAtRisk, captureCost, CITE_OPEN, CITE_RE, ETA_HORIZON, NOT_ATTACKING_REASONS, SECOND_FRONT_LEAD, SLOT_NAMES, } from './shared.js';
16
17
  import { knownFirst, lateArrivals, lateNet, withdrawnInto } from './holds.js';
17
18
  import { relaxedFor } from './relations.js';
@@ -28,7 +29,7 @@ export function reportExpected(pc, ps, book, threats, hd, tgt, caps) {
28
29
  const { warnings, rationale, absorbLines, captured, moves, survivorsAt } = ps;
29
30
  const { heldNow } = book;
30
31
  const { borders } = threats;
31
- const { conceded, heldAgainst, keptIncome, stayAt, twoStepBound, twoStepCited, twoStepHold, twoStepNote } = hd;
32
+ const { conceded, heldAgainst, keptIncome, keptHeld, stayAt, twoStepBound, twoStepCited, twoStepHold, twoStepNote } = hd;
32
33
  const { frontierOf, startHold } = tgt;
33
34
  const { notCompleted, stopped, stoppedLine, denied } = caps;
34
35
  // ---- expected ----
@@ -88,12 +89,17 @@ export function reportExpected(pc, ps, book, threats, hd, tgt, caps) {
88
89
  const need = list.reduce((n, g) => n + g.needs, 0);
89
90
  const onGates = list.reduce((n, g) => n + g.armies, 0);
90
91
  const deficit = list.reduce((n, g) => n + Math.max(0, g.needs - g.armies), 0);
91
- return { player, gates: list, need, onGates, deficit, income: frontier.income, short: Math.max(0, deficit - frontier.income) };
92
+ if (!pc.s.localDeployments)
93
+ return { player, gates: list, need, onGates, deficit, income: frontier.income, short: Math.max(0, deficit - frontier.income) };
94
+ // #433: under Local Deployment a bonus's pool pays only for the gates in it; the rest falls on the free income.
95
+ const lacks = new Map(list.map((x) => [x.id, Math.max(0, x.needs - x.armies)]));
96
+ const { short, deployable } = poolShortfall(g, keptHeld(after), frontier.income, lacks);
97
+ return { player, gates: list, need, onGates, deficit, income: frontier.income, short, deployable };
92
98
  })();
93
99
  // Warned only when this plan's own captures open a gate the budget cannot pay for (the shortfall alone is in the report).
94
100
  const opened = gates ? gates.gates.filter((x) => captured.has(x.id)).map((x) => x.id) : [];
95
101
  if (gates && gates.short > 0 && opened.length)
96
- warnings.push(`Gate budget (#297): this plan's capture of ${opened.map(label).join(', ')} opens ${opened.length === 1 ? 'a gate' : 'gates'} the income cannot hold — ${gates.gates.length} gates facing player ${gates.player}${gates.gates.some((x) => x.conceded) ? ` (${gates.gates.filter((x) => x.conceded).length} conceded)` : ''} need ${gates.need} against its one floating deploy; ${gates.onGates} stand on them, ${gates.deficit} short across them, and the next income is ${gates.income}: ${gates.short} short.`);
102
+ warnings.push(`Gate budget (#297): this plan's capture of ${opened.map(label).join(', ')} opens ${opened.length === 1 ? 'a gate' : 'gates'} the income cannot hold — ${gates.gates.length} gates facing player ${gates.player}${gates.gates.some((x) => x.conceded) ? ` (${gates.gates.filter((x) => x.conceded).length} conceded)` : ''} need ${gates.need} against its one floating deploy; ${gates.onGates} stand on them, ${gates.deficit} short across them, and the next income is ${gates.income}${gates.deployable !== undefined ? ` (${gates.deployable} of it deployable on them under Local Deployment)` : ''}: ${gates.short} short.`);
97
103
  const startCost = startHold();
98
104
  const outgrown = frontier.holdCost > frontier.income && frontier.holdCost > startCost;
99
105
  // A capture stopped by one pass but taken by a later one (the next income grew in between) is
@@ -110,7 +116,7 @@ export function reportExpected(pc, ps, book, threats, hd, tgt, caps) {
110
116
  rationale.push(denied.get(t));
111
117
  if (outgrown || notTaken.length) {
112
118
  const stop = notTaken.length
113
- ? ` Expansion that adds enemy borders without completing a bonus is stopped: ${notTaken.map((x) => `${label(x.t)} (the frontier would need ${x.holdCost}, next income ${x.income})`).join(', ')} not taken.`
119
+ ? ` Expansion that adds enemy borders without completing a bonus is stopped: ${notTaken.map((x) => `${label(x.t)} (the frontier would need ${x.holdCost}, next income ${x.income}${x.deployable !== undefined ? `, ${x.deployable} of it deployable on the gates under Local Deployment` : ''})`).join(', ')} not taken.`
114
120
  : '';
115
121
  warnings.push(outgrown
116
122
  ? `Frontier grows faster than income: holding its ${frontier.enemyBorders} enemy-facing borders next turn needs ${frontier.holdCost} at the expected deploy, more than ${frontier.income < nextIncome