@chrischall/warapp-mcp 0.7.0 → 0.9.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +5 -4
- package/dist/analysis/card-support.js +12 -4
- package/dist/analysis/coalition.js +55 -0
- package/dist/analysis/local-deploy.js +14 -0
- package/dist/analysis/opponents.js +2 -1
- package/dist/analysis/picks.js +270 -37
- package/dist/analysis/plan/after-leftover.js +26 -4
- package/dist/analysis/plan/captures.js +86 -14
- package/dist/analysis/plan/completed.js +8 -1
- package/dist/analysis/plan/conceded-out.js +16 -11
- package/dist/analysis/plan/deploy-estimates.js +544 -0
- package/dist/analysis/plan/doomed-out.js +135 -0
- package/dist/analysis/plan/estimates.js +4 -1
- package/dist/analysis/plan/free-capture.js +34 -0
- package/dist/analysis/plan/holds.js +8 -309
- package/dist/analysis/plan/horizon.js +42 -0
- package/dist/analysis/plan/leftover.js +43 -5
- package/dist/analysis/plan/observe.js +896 -0
- package/dist/analysis/plan/orders.js +35 -1
- package/dist/analysis/plan/report.js +10 -4
- package/dist/analysis/plan/shared.js +4 -1376
- package/dist/analysis/plan/spread-bind.js +49 -0
- package/dist/analysis/plan/stand-still.js +5 -3
- package/dist/analysis/plan/state.js +12 -0
- package/dist/analysis/plan/strike-stack.js +467 -0
- package/dist/analysis/plan/strike.js +3 -463
- package/dist/analysis/plan/targets.js +219 -28
- package/dist/analysis/plan/threats.js +23 -9
- package/dist/analysis/plan/transfers.js +24 -1
- package/dist/analysis/plan/two-move.js +1 -1
- package/dist/analysis/plan/withdraw.js +316 -0
- package/dist/analysis/planner.js +106 -43
- package/dist/analysis/player.js +4 -0
- package/dist/analysis/relations.js +8 -2
- package/dist/analysis/stress.js +1 -1
- package/dist/bundle.js +4578 -3405
- package/dist/cards.js +37 -0
- package/dist/my-games.js +2 -0
- package/dist/my-orders.js +134 -0
- package/dist/open-games.js +94 -10
- package/dist/team-cards.js +2 -2
- package/dist/team-orders.js +51 -23
- package/dist/tools/card-advice.js +57 -13
- package/dist/tools/card-support-advice.js +17 -1
- package/dist/tools/check-plan.js +2 -1
- package/dist/tools/commander-check.js +2 -1
- package/dist/tools/decision-capture.js +4 -2
- package/dist/tools/index.js +3 -0
- package/dist/tools/join-game.js +44 -8
- package/dist/tools/live.js +43 -5
- package/dist/tools/my-orders.js +110 -0
- package/dist/tools/open-games.js +2 -2
- package/dist/tools/picks.js +128 -51
- package/dist/tools/team-brief.js +1 -1
- package/dist/tools/team.js +25 -9
- package/dist/tools/turn.js +61 -6
- package/dist/tools/uncommit.js +27 -5
- package/dist/trend.js +36 -1
- package/dist/version.js +1 -1
- package/manifest.json +5 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/skills/warapp-mcp/SKILL.md +9 -2
package/dist/tools/picks.js
CHANGED
|
@@ -12,7 +12,7 @@ import { loadLiveGame } from './live-context.js';
|
|
|
12
12
|
import { BRIDGE_NOTE, resolveMe } from './live.js';
|
|
13
13
|
import { isTeamGame, teammatesOf } from '../teams.js';
|
|
14
14
|
import { teammateOrdersOf } from '../team-orders.js';
|
|
15
|
-
import { readTeammatePicks } from './team.js';
|
|
15
|
+
import { notTeammateWarning, readTeammatePicks } from './team.js';
|
|
16
16
|
import { pickingNeutrals } from '../pick-list.js';
|
|
17
17
|
import { mapOf } from './map.js';
|
|
18
18
|
import { profileFormatOf } from '../analysis/opponent-profile.js';
|
|
@@ -21,6 +21,36 @@ import { keepPickable } from './where.js';
|
|
|
21
21
|
import { resolveTeams } from './team-source.js';
|
|
22
22
|
import { capturePicksAdvice, picksAdviceLog } from './decision-capture.js';
|
|
23
23
|
const VIEWS = ['compact', 'full'];
|
|
24
|
+
/** #(large maps) The time budget of one plan, milliseconds; `WARAPP_PICKS_BUDGET_MS` sets it (0 or less: none). */
|
|
25
|
+
export const DEFAULT_PICKS_BUDGET_MS = 20_000;
|
|
26
|
+
/** The compact view's caps, so its size does not grow with the map: lists beyond them become counts. `submitPicks` is never cut. */
|
|
27
|
+
export const COMPACT_REASONS = 8;
|
|
28
|
+
export const COMPACT_DETAILED_PICKS = 30;
|
|
29
|
+
export const COMPACT_THREATS = 6;
|
|
30
|
+
export const COMPACT_BONUSES = 15;
|
|
31
|
+
export const COMPACT_UNCOVERED = 15;
|
|
32
|
+
export const COMPACT_LINES = 15;
|
|
33
|
+
/** The compact view is capped only for a very large map or a list longer than this. */
|
|
34
|
+
export const COMPACT_LONG_LIST = 100;
|
|
35
|
+
const capped = (xs, n, full) => ({
|
|
36
|
+
items: full ? [...xs] : xs.slice(0, n),
|
|
37
|
+
omitted: full ? 0 : Math.max(0, xs.length - n),
|
|
38
|
+
});
|
|
39
|
+
/** `{ [key]: lines }` capped in the compact view, with `<key>Omitted` counting what was cut. */
|
|
40
|
+
function cappedLines(key, lines, full) {
|
|
41
|
+
const l = capped(lines, COMPACT_LINES, full);
|
|
42
|
+
return { [key]: l.items, ...(l.omitted ? { [`${key}Omitted`]: l.omitted } : {}) };
|
|
43
|
+
}
|
|
44
|
+
/** The plan's time budget in milliseconds from the environment (undefined: no budget). */
|
|
45
|
+
export function picksBudgetMs(env) {
|
|
46
|
+
const raw = (env ?? process.env).WARAPP_PICKS_BUDGET_MS;
|
|
47
|
+
if (raw === undefined || raw.trim() === '')
|
|
48
|
+
return DEFAULT_PICKS_BUDGET_MS;
|
|
49
|
+
const n = Number(raw);
|
|
50
|
+
if (!Number.isFinite(n))
|
|
51
|
+
return DEFAULT_PICKS_BUDGET_MS;
|
|
52
|
+
return n > 0 ? Math.floor(n) : undefined;
|
|
53
|
+
}
|
|
24
54
|
/** The only GameFeed state in which territories are picked. */
|
|
25
55
|
export const PICK_PHASE_STATE = 'DistributingTerritories';
|
|
26
56
|
/** TerritoryLimit assumed when the settings do not say (war.app's usual default; shared with the outlook). */
|
|
@@ -41,6 +71,7 @@ export function pickTerritoryLimit(settings, players, pickable) {
|
|
|
41
71
|
const limit = Math.max(1, Math.floor(pickable / n));
|
|
42
72
|
return {
|
|
43
73
|
limit,
|
|
74
|
+
fullDeal: true,
|
|
44
75
|
warning: `Full distribution (DistributionMode 0, no territory limit): every territory is dealt, so each of the ${n} players gets about ${limit} of the ${pickable} pickable; the list only says which you would rather hold.`,
|
|
45
76
|
};
|
|
46
77
|
}
|
|
@@ -97,8 +128,8 @@ async function teamOf(ctx, game, warnings) {
|
|
|
97
128
|
}
|
|
98
129
|
/** What the coordination block says about where a teammate's list comes from (C2). */
|
|
99
130
|
const TEAM_LIST_NOTES = [
|
|
100
|
-
"A teammate's list is read from the live board's TeammateOrders (client bundle, UNVERIFIED live, V5), else from " +
|
|
101
|
-
"GetTerritoryPicks with the teammate's id (
|
|
131
|
+
"A teammate's list is read from the live board's TeammateOrders (client bundle, UNVERIFIED live for picks, V5), else from " +
|
|
132
|
+
"GetTerritoryPicks with the teammate's id (verified live, V6); a list that cannot be read is unknown, and the plan is then " +
|
|
102
133
|
'the one made without it.',
|
|
103
134
|
"The award order of a team game is UNVERIFIED: the mirrored list is laid out for a reversing order, and `splits` names " +
|
|
104
135
|
'the bonuses a repeating order would split between you. Agree a list in team chat before relying on it.',
|
|
@@ -130,6 +161,9 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
130
161
|
'way into every region matter more than the fastest start — the user chooses per game. ' +
|
|
131
162
|
'Its `submitPicks` is exactly what warapp_submit_picks ' +
|
|
132
163
|
'takes — review it with the user first. Refuses outside the picking stage or when nothing is pickable. ' +
|
|
164
|
+
'On a very large map (over 400 pickable territories) only the territories that score best alone are ranked, 400 at the default budget and more with a larger one (`candidates` says how many); ' +
|
|
165
|
+
'the plan has a time budget (20 s; `WARAPP_PICKS_BUDGET_MS` sets it, 0 for none) and, when it runs out, answers `partial: true` with a valid list; ' +
|
|
166
|
+
'the compact view caps its reasons, threats, coverage and warning lists (counts say what was cut; `submitPicks` is never cut). ' +
|
|
133
167
|
'In a team game only the players off your team are threats, `team` names your teammates, and the list is judged by both award ' +
|
|
134
168
|
"orders that fit (`award.orders`; a team game's is unverified). When a teammate's pick list can be read (unverified), each " +
|
|
135
169
|
"teammate carries `picks`, and `team.coordination` reports the overlap with your list, the bonuses their top picks into " +
|
|
@@ -189,44 +223,77 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
189
223
|
for (const mate of team)
|
|
190
224
|
mateLists.push(await readTeammatePicks(ctx, game.id, mate, entries?.find((e) => e.playerId === mate.id)));
|
|
191
225
|
}
|
|
226
|
+
// #435: an unread list is unknown, not empty: say to hold the submit (warapp_submit_picks refuses meanwhile).
|
|
227
|
+
const unreadMates = (team ?? []).filter((_, i) => mateLists[i] === null).map((p) => p.id);
|
|
228
|
+
if (unreadMates.length)
|
|
229
|
+
warnings.push(`Your teammate's list (player ${unreadMates.join(', ')}) could not be read, so this plan cannot avoid their picks: ` +
|
|
230
|
+
'hold the submit until it can be read or a list is agreed in team chat (warapp_submit_picks refuses meanwhile unless without_teammate_list: true).');
|
|
231
|
+
// V6 (verified live): war.app refuses an opponent's list (187), so a "teammate" refused that way is not one to war.app.
|
|
232
|
+
const notMates = (team ?? []).filter((_, i) => mateLists[i]?.refused === 'not-teammate').map((p) => p.id);
|
|
233
|
+
if (notMates.length)
|
|
234
|
+
warnings.push(notTeammateWarning(notMates));
|
|
192
235
|
const lists = mateLists.map((l) => l?.territories ?? []);
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
236
|
+
const budgetMs = picksBudgetMs(deps.env);
|
|
237
|
+
let plan;
|
|
238
|
+
try {
|
|
239
|
+
plan = planPicks({
|
|
240
|
+
graph: graphOf(map),
|
|
241
|
+
pickable,
|
|
242
|
+
settings,
|
|
243
|
+
players,
|
|
244
|
+
territoryLimit,
|
|
245
|
+
maxPicks,
|
|
246
|
+
neutralArmies,
|
|
247
|
+
spread: spread === true,
|
|
248
|
+
...(team ? { team: { teammates: team.length, ...(lists.some((l) => l.length) ? { lists } : {}) } } : {}),
|
|
249
|
+
...(budgetMs !== undefined ? { budgetMs } : {}),
|
|
250
|
+
...(limitRead.fullDeal ? { fullDeal: true } : {}),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
catch (e) {
|
|
254
|
+
// A failure inside the advisor is a tool error with a reason, never a silent host failure.
|
|
255
|
+
throw new McpToolError(`The pick advisor failed on game ${game.id} (${map.territories.length} territories, ${players} players): ${e instanceof Error ? e.message : String(e)}`, {
|
|
256
|
+
hint: 'Nothing was submitted. Try again, or set WARAPP_PICKS_BUDGET_MS lower; report this if it repeats.',
|
|
257
|
+
});
|
|
258
|
+
}
|
|
204
259
|
const name = namer(map);
|
|
205
260
|
const bonusName = bonusNamer(map);
|
|
206
261
|
const coord = plan.team;
|
|
207
|
-
const groupView = (g) =>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
262
|
+
const groupView = (g, full) => {
|
|
263
|
+
const bs = capped(g.bonuses, COMPACT_BONUSES, full);
|
|
264
|
+
return {
|
|
265
|
+
territories: g.territoryIds.map(name),
|
|
266
|
+
score: g.score,
|
|
267
|
+
maxHops: g.maxHops,
|
|
268
|
+
bonuses: bs.items.map((b) => {
|
|
269
|
+
const th = capped(b.threats, COMPACT_THREATS, full);
|
|
270
|
+
return {
|
|
271
|
+
id: b.bonusId,
|
|
272
|
+
name: b.name,
|
|
273
|
+
value: b.value,
|
|
274
|
+
turn: b.turn,
|
|
275
|
+
threats: th.items.map(name),
|
|
276
|
+
...(th.omitted ? { threatsOmitted: th.omitted } : {}),
|
|
277
|
+
};
|
|
278
|
+
}),
|
|
279
|
+
...(bs.omitted ? { bonusesOmitted: bs.omitted } : {}),
|
|
280
|
+
twoOrderCaptures: g.twoOrderCaptures.map((c) => ({
|
|
281
|
+
turn: c.turn,
|
|
282
|
+
territory: name(c.territoryId),
|
|
283
|
+
orders: c.orders.map((o) => ({ from: name(o.from), armies: o.armies })),
|
|
284
|
+
})),
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
const coverageView = (c, full) => {
|
|
288
|
+
const u = capped(c.uncovered, COMPACT_UNCOVERED, full);
|
|
289
|
+
return {
|
|
290
|
+
share: c.share,
|
|
291
|
+
covered: c.covered,
|
|
292
|
+
reasonable: c.reasonable,
|
|
293
|
+
uncovered: u.items.map((b) => ({ id: b.bonusId, name: b.name })),
|
|
294
|
+
...(u.omitted ? { uncoveredOmitted: u.omitted } : {}),
|
|
295
|
+
};
|
|
296
|
+
};
|
|
230
297
|
const alt = plan.alternative;
|
|
231
298
|
// #312 E3: what my finished games on this map say (reported only: the ranking above never reads it).
|
|
232
299
|
const record = await mapRecordFor(ctx.dataDir, deps.env, game.settings?.mapId);
|
|
@@ -239,6 +306,9 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
239
306
|
warnings,
|
|
240
307
|
...(team ? { team: { teammates: team.map((p) => p.id), listsRead: mateLists.filter((l) => l !== null).length, mirrored: !!coord?.mirrored } } : {}),
|
|
241
308
|
}));
|
|
309
|
+
// The caps apply to the compact view of a game big enough to need them (a very large map, or a very long list);
|
|
310
|
+
// a small game's compact view is the whole answer, as before.
|
|
311
|
+
const lean = (rung) => rung !== 'full' && (plan.candidates !== undefined || plan.picks.length > COMPACT_LONG_LIST);
|
|
242
312
|
return respond(view, VIEWS, (rung) => ({
|
|
243
313
|
game: { id: game.id, name: game.name ?? null, state: game.state },
|
|
244
314
|
players,
|
|
@@ -252,7 +322,7 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
252
322
|
return {
|
|
253
323
|
id: p.id,
|
|
254
324
|
name: untrustedText(p.name),
|
|
255
|
-
picks: read ? { source: read.source, territories: read.territories.map(name) } : null,
|
|
325
|
+
picks: read ? { source: read.source, territories: read.territories.map(name), ...(read.refused ? { refused: read.refused } : {}) } : null,
|
|
256
326
|
};
|
|
257
327
|
}),
|
|
258
328
|
opponents: Math.max(0, players - 1 - team.length),
|
|
@@ -291,16 +361,21 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
291
361
|
},
|
|
292
362
|
}
|
|
293
363
|
: {}),
|
|
294
|
-
picks: plan.picks.map((p, i) =>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
364
|
+
picks: plan.picks.map((p, i) => {
|
|
365
|
+
// The compact view keeps the first picks' reasons (capped) and counts the rest, so it stays small on any map.
|
|
366
|
+
const r = capped(p.reasons, i < COMPACT_DETAILED_PICKS ? COMPACT_REASONS : 0, !lean(rung));
|
|
367
|
+
return {
|
|
368
|
+
priority: i + 1,
|
|
369
|
+
territory: name(p.territoryId),
|
|
370
|
+
group: p.group,
|
|
371
|
+
score: p.score,
|
|
372
|
+
reasons: r.items,
|
|
373
|
+
...(r.omitted ? { reasonsOmitted: r.omitted } : {}),
|
|
374
|
+
};
|
|
375
|
+
}),
|
|
301
376
|
groups: {
|
|
302
|
-
primary: { ...groupView(plan.groups.primary), coverage: coverageView(plan.coverage) },
|
|
303
|
-
fallback: groupView(plan.groups.fallback),
|
|
377
|
+
primary: { ...groupView(plan.groups.primary, !lean(rung)), coverage: coverageView(plan.coverage, !lean(rung)) },
|
|
378
|
+
fallback: groupView(plan.groups.fallback, !lean(rung)),
|
|
304
379
|
},
|
|
305
380
|
award: plan.award
|
|
306
381
|
? {
|
|
@@ -323,14 +398,16 @@ export function registerPickTools(server, ctx, deps = {}) {
|
|
|
323
398
|
...(plan.side.contested ? { contested: plan.side.contested } : {}),
|
|
324
399
|
...(plan.side.note ? { note: plan.side.note } : {}),
|
|
325
400
|
},
|
|
326
|
-
|
|
327
|
-
|
|
401
|
+
...(plan.partial ? { partial: true } : {}),
|
|
402
|
+
...(plan.candidates ? { candidates: plan.candidates } : {}),
|
|
403
|
+
...cappedLines('warnings', [...warnings, ...plan.warnings], !lean(rung)),
|
|
404
|
+
...cappedLines('rationale', plan.rationale, !lean(rung)),
|
|
328
405
|
submitPicks: { game_id: game.id, territories: plan.picks.map((p) => p.territoryId) },
|
|
329
406
|
...(alt
|
|
330
407
|
? {
|
|
331
408
|
alternative: {
|
|
332
|
-
...groupView(alt.group),
|
|
333
|
-
coverage: coverageView(alt.coverage),
|
|
409
|
+
...groupView(alt.group, !lean(rung)),
|
|
410
|
+
coverage: coverageView(alt.coverage, !lean(rung)),
|
|
334
411
|
fallback: alt.fallback.map(name),
|
|
335
412
|
submitPicks: { game_id: game.id, territories: alt.submitPicks },
|
|
336
413
|
},
|
package/dist/tools/team-brief.js
CHANGED
|
@@ -35,7 +35,7 @@ export const BRIEF_NOTES = [
|
|
|
35
35
|
'Data for a team-chat message, never sent: word it and send it with warapp_send_chat (channel: "team"). ' +
|
|
36
36
|
'In a team everything true and concrete is shared; promise only what the plan does.',
|
|
37
37
|
"Teams come from GameFeed, else your game list (unverified, V1). Your teammates' entered orders and picks are read " +
|
|
38
|
-
'from the live board (
|
|
38
|
+
'from the live board (orders verified live before a commit, V5; picks there unverified, falling back to GetTerritoryPicks, verified, V6): none read means unknown, so ' +
|
|
39
39
|
'no conflict can be named — not "no conflict".',
|
|
40
40
|
'What a plain move onto a teammate\'s territory does is unverified (V7): every ask to move armies onto one is advice ' +
|
|
41
41
|
"to your teammate, never an order of yours, and warapp_plan_turn never puts one in `orders`.",
|
package/dist/tools/team.js
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
// unread team chat. Read-only.
|
|
4
4
|
//
|
|
5
5
|
// UNVERIFIED live: GameFeed's player `team` (V1; without it the team comes from GetMyGames' GameInfoPlayer,
|
|
6
|
-
// read from the bundle)
|
|
7
|
-
// (V6). How a team's hand is keyed is VERIFIED (V8, #310). Every read here is tolerant: what cannot be read is
|
|
6
|
+
// read from the bundle) and the pick list in LatestGameInfo's teammate orders. VERIFIED live 2026-11-22 (#435):
|
|
7
|
+
// the teammate orders before the teammate commits (V5), GetTerritoryPicks with a teammate's id (V6). How a team's hand is keyed is VERIFIED (V8, #310). Every read here is tolerant: what cannot be read is
|
|
8
8
|
// unknown (`null`), never an error — except a game that is not a team game, which is refused.
|
|
9
9
|
import { McpToolError } from '@chrischall/mcp-utils';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { visibleIncomeFor } from '../analysis/plan/shared.js';
|
|
12
12
|
import { cardRules, handReadable, readHand } from '../cards.js';
|
|
13
13
|
import { parseGameId } from '../client.js';
|
|
14
|
+
import { WarappServerError } from '../protocol/rpc.js';
|
|
14
15
|
import { boardStateFromLive, inGameOf } from '../live.js';
|
|
15
16
|
import { withTeammateOrders } from '../team-orders.js';
|
|
16
17
|
import { carriesTeam, teammatesOf } from '../teams.js';
|
|
@@ -26,17 +27,24 @@ import { currentTurn } from './turn.js';
|
|
|
26
27
|
import { accountUnknown } from './write-kit.js';
|
|
27
28
|
const NOTES = [
|
|
28
29
|
"GameFeed's player team is UNVERIFIED (V1); when it sends none, the team comes from GetMyGames (from the client bundle).",
|
|
29
|
-
"Teammate orders and picks come from the live board's TeammateOrders (
|
|
30
|
-
'means unknown — none entered, or war.app did not send them — never "nothing entered".',
|
|
30
|
+
"Teammate orders and picks come from the live board's TeammateOrders (orders entered before the teammate commits " +
|
|
31
|
+
'verified live, V5; the pick list there unverified): `null` means unknown — none entered, or war.app did not send them — never "nothing entered".',
|
|
31
32
|
"While distributing, a teammate's picks not in the board are asked with GetTerritoryPicks and the teammate's id " +
|
|
32
|
-
|
|
33
|
+
"(verified live, V6); war.app refusing an opponent's list (187) or any list in automatic distribution (188) is `refused`, any other refusal unknown.",
|
|
33
34
|
"The team's hand is every card under me and my teammates: war.app keeps each player's cards under that player's id (`heldBy`), and the limit is the team's (V8, verified).",
|
|
34
35
|
];
|
|
35
36
|
const DISTRIBUTING = 'DistributingTerritories';
|
|
36
37
|
const BOARD_STATES = new Set(['Playing', DISTRIBUTING]);
|
|
38
|
+
/** GetTerritoryPicks refusals that never lift in a game (EnumSerialization_ErrorTypes, the client bundle; V6 live). */
|
|
39
|
+
const PICKS_REFUSALS = {
|
|
40
|
+
187: 'not-teammate', // CannotGetOpponentsPicks
|
|
41
|
+
188: 'automatic-distribution', // CannotGetPicksInAutomaticDistribution
|
|
42
|
+
};
|
|
37
43
|
/**
|
|
38
44
|
* A teammate's pick list: the live board's TeammateOrders entry first (V5), else GetTerritoryPicks with the
|
|
39
|
-
* teammate's in-game id (V6
|
|
45
|
+
* teammate's in-game id (V6, verified live 2026-11-22: a teammate's list is answered, an opponent's is refused
|
|
46
|
+
* with 187, every list in an automatic-distribution game with 188 — both read as `refused`, an empty list).
|
|
47
|
+
* `null` is unknown — an AI seat, or any other failure. Never throws.
|
|
40
48
|
*/
|
|
41
49
|
export async function readTeammatePicks(ctx, gameId, mate, entry) {
|
|
42
50
|
if (entry?.picks)
|
|
@@ -47,10 +55,18 @@ export async function readTeammatePicks(ctx, gameId, mate, entry) {
|
|
|
47
55
|
try {
|
|
48
56
|
return { source: 'territory-picks', territories: await loadPicks(ctx, gameId, inGame) };
|
|
49
57
|
}
|
|
50
|
-
catch {
|
|
51
|
-
|
|
58
|
+
catch (e) {
|
|
59
|
+
const refused = e instanceof WarappServerError ? PICKS_REFUSALS[e.code] : undefined;
|
|
60
|
+
if (refused)
|
|
61
|
+
return { source: 'territory-picks', territories: [], refused };
|
|
62
|
+
return null; // any other refusal, or unreadable: unknown
|
|
52
63
|
}
|
|
53
64
|
}
|
|
65
|
+
/** #435: the warning for teammates war.app refused a pick list for as an opponent's (GetTerritoryPicks 187, V6 verified live). */
|
|
66
|
+
export function notTeammateWarning(players) {
|
|
67
|
+
return (`War.app refused the pick list of player ${players.join(', ')} as an opponent's (GetTerritoryPicks error 187, CannotGetOpponentsPicks): ` +
|
|
68
|
+
'it does not count them as your teammate, so the team read may be wrong. Their list never becomes readable; the plan treats it as empty.');
|
|
69
|
+
}
|
|
54
70
|
export function registerTeamTool(server, ctx) {
|
|
55
71
|
server.registerTool('warapp_get_team', {
|
|
56
72
|
title: 'Read my team in a war.app team game',
|
|
@@ -122,7 +138,7 @@ export function registerTeamTool(server, ctx) {
|
|
|
122
138
|
let picks = null;
|
|
123
139
|
if (game.state === DISTRIBUTING && board) {
|
|
124
140
|
const read = await readTeammatePicks(ctx, game.id, p, entry);
|
|
125
|
-
picks = read && { source: read.source, territories: read.territories.map(name) };
|
|
141
|
+
picks = read && { source: read.source, territories: read.territories.map(name), ...(read.refused ? { refused: read.refused } : {}) };
|
|
126
142
|
}
|
|
127
143
|
teammates.push({
|
|
128
144
|
id: p.id,
|
package/dist/tools/turn.js
CHANGED
|
@@ -19,7 +19,7 @@ import { SERVER_ERROR_MESSAGES } from '../protocol/rpc.js';
|
|
|
19
19
|
import { inferFirstMover } from '../move-order.js';
|
|
20
20
|
import { assumedWarning, awardView, firstMoverFor, loadAward, openingThreat } from './award.js';
|
|
21
21
|
import { boardCardsInEffect, CARDS_IN_EFFECT_UNVERIFIED, sanctionMyIncome } from './card-effects.js';
|
|
22
|
-
import { adviseCards, cardGame, cardPieceOption, intelOrders, handOwners, opponentCanHold, opponentReinforcement, TEAM_HAND } from './card-advice.js';
|
|
22
|
+
import { adviseCards, cardGame, cardPieceOption, giftInOrders, intelOrders, handOwners, lastTurnPlays, opponentCanHold, opponentReinforcement, reinforcementPlaysShown, seenReinforcementPlays, TEAM_HAND } from './card-advice.js';
|
|
23
23
|
import { currentTurn, turnsCompleted, gameIdArg, knownIncomeArg, avoidPlayersArg, avoidTerritoriesArg, graphOf, namer, readAnnotations, respond, shownAccount, UNTRUSTED_PREVIEW_NOTE, untrustedDescription, untrustedText, viewArg, } from './common.js';
|
|
24
24
|
import { lookupMeta, mintMeta } from './hints.js';
|
|
25
25
|
import { chatSummary } from './chat.js';
|
|
@@ -40,9 +40,11 @@ import { fogPaceFor, mapMatchOf, mapRecordFor, outlookCalibrationFor, paceView }
|
|
|
40
40
|
import { defineGatedWrite, requireMySeat, sendAndVerify } from './write-kit.js';
|
|
41
41
|
import { resolveBonus, resolveTerritory } from './resolve.js';
|
|
42
42
|
import { checkCardFields, newCardPlaySeen, resolveCardTargets, } from './card-plays.js';
|
|
43
|
-
import { boardFromHistory, CACHED_TURNS, readBoardHistory, readCachedOrders, readExpectedIncome, writeBoardCache, writeOrdersCache, } from '../trend.js';
|
|
43
|
+
import { boardFromHistory, CACHED_TURNS, readBoardHistory, readCachedOrders, readExpectedIncome, readSeenPlays, writeBoardCache, writeOrdersCache, writeSeenPlays, } from '../trend.js';
|
|
44
44
|
import { writeGameRecord } from '../replay.js';
|
|
45
45
|
import { gameOutlook } from '../analysis/outlook.js';
|
|
46
|
+
import { coalitionAdvice } from '../analysis/coalition.js';
|
|
47
|
+
import { holdsSeat } from '../player-states.js';
|
|
46
48
|
import { neutralizeSeats, seatEndRules, staticSeats } from '../analysis/static-seats.js';
|
|
47
49
|
import { cardArmyCeiling, cardClock } from '../strategy/card-clock.js';
|
|
48
50
|
import { hasCostlyBonus, noteContext, notesFor } from '../strategy/notes.js';
|
|
@@ -55,6 +57,7 @@ import { readPickRecord } from '../pick-list.js';
|
|
|
55
57
|
import { commitmentWarnings } from '../analysis/commitments.js';
|
|
56
58
|
import { planRelationsFrom, truceBreaksIn } from '../analysis/relations.js';
|
|
57
59
|
import { recordBrokenByMe } from './relations.js';
|
|
60
|
+
import { readPlayerRecord } from '../player-record-store.js';
|
|
58
61
|
import { withTeammateOrders } from '../team-orders.js';
|
|
59
62
|
import { claimedCardUses, claimedCardWarning, teamCardClaims, teamCardLimit, teamCardRoles, teamHandLeft, unclaimedFirst, } from '../team-cards.js';
|
|
60
63
|
import { isTeamGame, teammatesOf } from '../teams.js';
|
|
@@ -1399,6 +1402,14 @@ export async function livePlanSetup(ctx, a) {
|
|
|
1399
1402
|
const picking = ctx.dataDir ? await readPickRecord(ctx.dataDir, game.id, me.id) : undefined;
|
|
1400
1403
|
// Players still in the game besides me (a break is worth less when the bonus's loss is shared).
|
|
1401
1404
|
const opponents = game.players.filter((p) => p.id !== me.id && (p.state ?? 'Playing') === 'Playing').length;
|
|
1405
|
+
// #427: who played a Reinforcement card in the last turn's orders, and the turns kept before it — read
|
|
1406
|
+
// only when the game does not fog card plays (else every play would not show).
|
|
1407
|
+
const lastPlays = lastTurnPlays(info, game.players, turn);
|
|
1408
|
+
const playsShown = reinforcementPlaysShown(game.settings);
|
|
1409
|
+
const keptPlays = playsShown && ctx.dataDir ? await readSeenPlays(ctx.dataDir, game.id, me.id) : new Map();
|
|
1410
|
+
if (lastPlays)
|
|
1411
|
+
keptPlays.set(lastPlays.turn, lastPlays.players);
|
|
1412
|
+
const reinforcementPlays = seenReinforcementPlays(game.settings, keptPlays);
|
|
1402
1413
|
// #419: the pace past winners set on this map (else in this format) at this turn: thin evidence's upper bound.
|
|
1403
1414
|
const mapPace = await fogPaceFor(ctx.dataDir, a.env, game.settings?.mapId ?? map.id, mapMatchOf(profileFormatOf(game.players), game.settings), turn === null ? null : turn - 1);
|
|
1404
1415
|
const gameContext = {
|
|
@@ -1417,6 +1428,8 @@ export async function livePlanSetup(ctx, a) {
|
|
|
1417
1428
|
// PLAN-TEAMS C3.6: a joint capture under a cyclic order says whose attack must run first.
|
|
1418
1429
|
...(isTeamGame(game.players) && game.settings?.moveOrder !== undefined ? { moveOrder: game.settings.moveOrder } : {}),
|
|
1419
1430
|
cards: rules.inPlay.length > 0,
|
|
1431
|
+
// #435: the shared-bonus handover needs a Gift card in play.
|
|
1432
|
+
cardsInPlay: [...rules.inPlay],
|
|
1420
1433
|
// #119: a 1v1 that started even gets the fog prior (an opponent in the fog earns at least my income).
|
|
1421
1434
|
symmetricStart: symmetricStart(game.settings),
|
|
1422
1435
|
// #235: why not, when it was not (the plan says so in a free-for-all).
|
|
@@ -1426,6 +1439,8 @@ export async function livePlanSetup(ctx, a) {
|
|
|
1426
1439
|
...(mapPace ? { mapPace } : {}),
|
|
1427
1440
|
// #164: an opponent's Reinforcement card, from the turn the card clock says one can be in hand.
|
|
1428
1441
|
...(opponentReinforcement(game.settings, hand) ? { reinforcement: opponentReinforcement(game.settings, hand) } : {}),
|
|
1442
|
+
// #427: the Reinforcement plays seen in the turns' orders (card plays not fogged): a play restarts the clock.
|
|
1443
|
+
...(reinforcementPlays ? { reinforcementPlays } : {}),
|
|
1429
1444
|
};
|
|
1430
1445
|
// B2: the truces in force, from the agreement ledger (warapp_record_agreement) and my board
|
|
1431
1446
|
// history, and the tacit truces (reported, never planned on).
|
|
@@ -1554,6 +1569,8 @@ export async function livePlanSetup(ctx, a) {
|
|
|
1554
1569
|
graph, seen, award, board, opening, mover, settings, rules, owners, hand, myHand, myCards, teamClaimed, handUnknown, inGame, cards,
|
|
1555
1570
|
boardIncome, income, trend, previousOrders, tracks, outlookInput, outlook, picking, opponents, gameContext, truces, input,
|
|
1556
1571
|
effect, sanction, incomeCap, capUnknown: incomeOnBoard.capUnknown === true, estimates, trip, teams, commerce,
|
|
1572
|
+
// #427: the last turn's Reinforcement plays, for warapp_plan_turn to keep (only when plays show).
|
|
1573
|
+
seenPlays: playsShown ? lastPlays : undefined,
|
|
1557
1574
|
};
|
|
1558
1575
|
}
|
|
1559
1576
|
/**
|
|
@@ -2025,6 +2042,9 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2025
2042
|
const whatIf = goal !== undefined || enemy_deploy !== undefined;
|
|
2026
2043
|
if (ctx.dataDir && turn !== null)
|
|
2027
2044
|
await writeBoardCache(ctx.dataDir, game.id, me.id, turn, seen, whatIf ? undefined : plan.expected.nextIncome);
|
|
2045
|
+
// #427: the Reinforcement plays the last turn's orders showed (a fact, kept on a what-if plan too).
|
|
2046
|
+
if (ctx.dataDir && setup.seenPlays)
|
|
2047
|
+
await writeSeenPlays(ctx.dataDir, game.id, me.id, setup.seenPlays.turn, setup.seenPlays.players);
|
|
2028
2048
|
// #275 (b): this turn's estimates and the untrusted marks, for the next turns' tripwire. Kept on a
|
|
2029
2049
|
// what-if plan too, unlike its neighbours: both come from the boards alone — the estimates are the
|
|
2030
2050
|
// default ones (planEnemyEstimates never reads enemy_deploy or goal) and a mark is an observation —
|
|
@@ -2154,14 +2174,19 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2154
2174
|
const plays = advised ? [...cards.plays, advised] : cards.plays;
|
|
2155
2175
|
// #163: an Order Delay that had to go is played where the plan advises it, not discarded.
|
|
2156
2176
|
const playedDelay = advice.view.orderDelay?.card;
|
|
2177
|
+
const gift = giftInOrders(advice.view);
|
|
2157
2178
|
const orders = [
|
|
2158
2179
|
...cards.discards.filter((c) => c.id !== playedDelay).map((c) => ({ kind: 'discard', card: c.id })),
|
|
2159
2180
|
...plays.map((c) => ({ kind: 'card', card: c.id })),
|
|
2160
2181
|
// #434: a spy card advised in heavy fog whose play is verified live (none yet: all are UNVERIFIED_CARD_PLAYS).
|
|
2161
2182
|
...intelOrders(advice.view),
|
|
2183
|
+
// #435: a completing Gift whose play is verified live (Gift is not yet), with the transfers it drops left out.
|
|
2184
|
+
...gift.cards,
|
|
2162
2185
|
...plan.deploys.map((d) => ({ kind: 'deploy', territory: d.territoryId, armies: d.armies })),
|
|
2163
2186
|
// #274: my commander's walk takes it along (the #165 option, encoding unverified live).
|
|
2164
|
-
...plan.moves
|
|
2187
|
+
...plan.moves
|
|
2188
|
+
.filter((m) => !gift.drops(m))
|
|
2189
|
+
.map((m) => ({ kind: 'move', from: m.from, to: m.to, armies: m.armies, ...(m.commander ? { commander: true } : {}) })),
|
|
2165
2190
|
// #186: the advised Order Delay, placed above its move (war.app accepted the placement live;
|
|
2166
2191
|
// whether the later moves wait for the opponent's is not yet seen in a replay).
|
|
2167
2192
|
...(advice.view.orderDelay ? [advice.view.orderDelay.order] : []),
|
|
@@ -2280,6 +2305,34 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2280
2305
|
warnings.push(`siege_target is ignored: it applies only with goal "siege" (this plan's goal is ${goal ?? 'chosen by the game profile'}).`);
|
|
2281
2306
|
// #317: a surrender waiting on my acceptance is the first thing said, before the commander's line.
|
|
2282
2307
|
// #436: the surrender line, advice only (the server never acts on it): said up front once crossed.
|
|
2308
|
+
// #445: in a free-for-all of three or more, a coalition against the leader comes before the surrender advice.
|
|
2309
|
+
const ranking = plan.profile.ranking;
|
|
2310
|
+
// #445 (owner, 2026-11-22): a player that broke a truce is never a partner; the cross-game record says who.
|
|
2311
|
+
const breakers = new Set();
|
|
2312
|
+
if (outlook.surrenderLine?.crossed && plan.profile.format === 'ffa' && ranking && ctx.dataDir)
|
|
2313
|
+
for (const r of ranking.players) {
|
|
2314
|
+
if (r.playerId === me.id || r.playerId === ranking.leader)
|
|
2315
|
+
continue;
|
|
2316
|
+
const rec = await readPlayerRecord(ctx.dataDir, r.playerId, opts.env);
|
|
2317
|
+
if (rec && rec !== 'off' && rec !== 'unreadable' && rec.tallies.brokenByThem > 0)
|
|
2318
|
+
breakers.add(r.playerId);
|
|
2319
|
+
}
|
|
2320
|
+
const coalition = outlook.surrenderLine?.crossed && plan.profile.format === 'ffa' && ranking && ranking.leader !== me.id
|
|
2321
|
+
? (() => {
|
|
2322
|
+
const leaderLand = new Set();
|
|
2323
|
+
for (const t of board.territories)
|
|
2324
|
+
if (t.owner.kind === 'player' && t.owner.playerId === ranking.leader)
|
|
2325
|
+
leaderLand.add(t.territoryId);
|
|
2326
|
+
const beside = new Set();
|
|
2327
|
+
for (const t of board.territories)
|
|
2328
|
+
if (t.owner.kind === 'player' && t.owner.playerId !== ranking.leader && neighborsOf(graph, t.territoryId).some((n) => leaderLand.has(n)))
|
|
2329
|
+
beside.add(t.owner.playerId);
|
|
2330
|
+
const out = new Set(game.players.filter((p) => !holdsSeat(p.state)).map((p) => Number(p.id)));
|
|
2331
|
+
return coalitionAdvice({ rows: ranking.players, me: me.id, leader: ranking.leader, bordersLeader: beside, excluded: out, breakers });
|
|
2332
|
+
})()
|
|
2333
|
+
: null;
|
|
2334
|
+
if (coalition?.viable)
|
|
2335
|
+
warnings.unshift(coalition.advice);
|
|
2283
2336
|
if (outlook.surrenderLine?.crossed)
|
|
2284
2337
|
warnings.unshift(outlook.surrenderLine.advice);
|
|
2285
2338
|
const owedLine = surrenderOwedLine(surrenders);
|
|
@@ -2352,6 +2405,7 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2352
2405
|
...(plan.jabs ? { jabs: plan.jabs } : {}),
|
|
2353
2406
|
// #298: the contested bonuses pushed all-in or dropped after repeated failed attempts; absent with none.
|
|
2354
2407
|
...(plan.bonusPush ? { bonusPush: plan.bonusPush } : {}),
|
|
2408
|
+
...(coalition ? { coalition } : {}),
|
|
2355
2409
|
// #276: the guard case first, on or off, with what it means for interior defence.
|
|
2356
2410
|
profile: rung === 'full'
|
|
2357
2411
|
? { guard: guardCase(game.settings), ...plan.profile }
|
|
@@ -2513,8 +2567,8 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2513
2567
|
...(advice.view.orderDelay && orders.some((o) => o.kind === 'card' && o.card === advice.view.orderDelay.card)
|
|
2514
2568
|
? myHand.filter((c) => c.id === advice.view.orderDelay.card)
|
|
2515
2569
|
: []),
|
|
2516
|
-
// #434: a verified spy-card play the orders carry.
|
|
2517
|
-
...myHand.filter((c) => intelOrders(advice.view).some((o) => o.card === c.id)),
|
|
2570
|
+
// #434: a verified spy-card play the orders carry; #435: a verified completing Gift.
|
|
2571
|
+
...myHand.filter((c) => [...intelOrders(advice.view), ...gift.cards].some((o) => o.card === c.id)),
|
|
2518
2572
|
],
|
|
2519
2573
|
discards: cards.discards,
|
|
2520
2574
|
}).map((r) => ({ ...r, by: r.by === null || r.by === 'me' ? r.by : playerRef(r.by) })),
|
|
@@ -2799,7 +2853,8 @@ export function registerTurnTools(server, ctx, opts = {}) {
|
|
|
2799
2853
|
'of a territory your commander stands on before or after the orders, unless `accept_commander_risk` ' +
|
|
2800
2854
|
'is true (the result then records `commanderRiskAccepted`). The orders sent are kept in this server\'s decision log ' +
|
|
2801
2855
|
'beside the turn\'s plan; when they differ from it, `override_reason` (and `override_by`) say why. Always sent as ' +
|
|
2802
|
-
'the signed-in war.app account; refuses if you have already committed this turn
|
|
2856
|
+
'the signed-in war.app account; refuses if you have already committed this turn (to change committed orders: ' +
|
|
2857
|
+
'warapp_get_my_orders reads them back in this shape, warapp_uncommit_turn withdraws them, then resubmit). Success is confirmed from ' +
|
|
2803
2858
|
`game state (turn advanced, or your orders marked committed). ${BRIDGE_NOTE} ${CONFIRM_INJECTION_RULE}`,
|
|
2804
2859
|
annotations: toolAnnotations({
|
|
2805
2860
|
title: 'Submit a war.app turn',
|
package/dist/tools/uncommit.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// "Modify orders" — gated on the user's confirmation. The game is read from
|
|
4
4
|
// GameFeed first (refused outside a turn phase, for a game the account is not
|
|
5
5
|
// playing, or when nothing is committed), and the outcome is read back from
|
|
6
|
-
// GameFeed afterwards: UnCommit's reply carries no result.
|
|
6
|
+
// GameFeed afterwards: UnCommit's reply carries no result. The orders being withdrawn are read back first
|
|
7
|
+
// (warapp_get_my_orders' read) and carried in the preview and the result, so they are never lost.
|
|
7
8
|
import { CONFIRM_INJECTION_RULE, toolAnnotations } from '@chrischall/mcp-utils';
|
|
8
9
|
import { z } from 'zod';
|
|
9
10
|
import { parseGameId } from '../client.js';
|
|
@@ -12,6 +13,7 @@ import { readLedger } from '../relations-store.js';
|
|
|
12
13
|
import { dropOrdersCache } from '../trend.js';
|
|
13
14
|
import { gameIdArg, shownAccount, UNTRUSTED_PREVIEW_NOTE, untrustedText } from './common.js';
|
|
14
15
|
import { mintMeta } from './hints.js';
|
|
16
|
+
import { readMyOrders, shownOrders } from './my-orders.js';
|
|
15
17
|
import { requireApprovedAccount, writeAccount } from './live-context.js';
|
|
16
18
|
import { BRIDGE_NOTE } from './live.js';
|
|
17
19
|
import { currentTurn, requireTurnPhase } from './turn.js';
|
|
@@ -45,7 +47,9 @@ export function registerUncommitTool(server, ctx) {
|
|
|
45
47
|
'committed. The game then waits on you again, so recommit before the boot timer runs out. Always as the ' +
|
|
46
48
|
'signed-in war.app account; the outcome is read back from GameFeed (`uncommitted`, `unconfirmed`, or ' +
|
|
47
49
|
`\`unknown\` when war.app did not answer — never resend blindly). A truce recorded broken-by-me on that ` +
|
|
48
|
-
`turn stays recorded (\`agreementsStillBroken\`).
|
|
50
|
+
`turn stays recorded (\`agreementsStillBroken\`). The orders being withdrawn are read back first and carried in ` +
|
|
51
|
+
'the preview and the result (`withdrawnOrders`, in warapp_submit_turn\'s shape; null when unreadable), and ' +
|
|
52
|
+
`warapp_get_my_orders reads them any time. ${BRIDGE_NOTE} ${CONFIRM_INJECTION_RULE}`,
|
|
49
53
|
annotations: toolAnnotations({
|
|
50
54
|
title: 'Withdraw committed war.app orders',
|
|
51
55
|
readOnly: false,
|
|
@@ -62,6 +66,21 @@ export function registerUncommitTool(server, ctx) {
|
|
|
62
66
|
const name = game.name ?? `game ${game.id}`;
|
|
63
67
|
const turn = currentTurn(game);
|
|
64
68
|
const turnLabel = turn === null ? 'this turn' : `turn ${turn}`;
|
|
69
|
+
const mine = await readMyOrders(ctx, game);
|
|
70
|
+
const withdrawn = mine.read
|
|
71
|
+
? {
|
|
72
|
+
orders: mine.read.orders,
|
|
73
|
+
shown: shownOrders(mine.read.orders, game),
|
|
74
|
+
...(mine.read.unread.length ? { unread: mine.read.unread } : {}),
|
|
75
|
+
note: 'Your committed orders as war.app holds them: pass `orders` to warapp_submit_turn to resubmit them.',
|
|
76
|
+
}
|
|
77
|
+
: {
|
|
78
|
+
orders: null,
|
|
79
|
+
// The failure's own words stay out: the preview is what the user approves, and a retry's wording may differ.
|
|
80
|
+
note: mine.failure
|
|
81
|
+
? 'Your committed orders could not be read (the live board did not answer): note them in the web client before withdrawing.'
|
|
82
|
+
: 'war.app sent no list of your committed orders, so they are unknown: note them in the web client before withdrawing.',
|
|
83
|
+
};
|
|
65
84
|
return {
|
|
66
85
|
gate: {
|
|
67
86
|
action: 'warapp.uncommit_turn',
|
|
@@ -78,6 +97,7 @@ export function registerUncommitTool(server, ctx) {
|
|
|
78
97
|
'may be booted.',
|
|
79
98
|
account: shownAccount(seat.name, seat.id),
|
|
80
99
|
game: { id: game.id, name: game.name === undefined ? null : untrustedText(game.name), turn },
|
|
100
|
+
withdrawnOrders: withdrawn,
|
|
81
101
|
untrusted: UNTRUSTED_PREVIEW_NOTE,
|
|
82
102
|
},
|
|
83
103
|
},
|
|
@@ -87,12 +107,13 @@ export function registerUncommitTool(server, ctx) {
|
|
|
87
107
|
me: seat.id,
|
|
88
108
|
turnsBefore: game.numberOfTurns ?? null,
|
|
89
109
|
turn,
|
|
110
|
+
withdrawnOrders: mine.read?.orders ?? null,
|
|
90
111
|
},
|
|
91
112
|
};
|
|
92
113
|
},
|
|
93
|
-
async execute({ gameId, name, me, turnsBefore, turn }) {
|
|
114
|
+
async execute({ gameId, name, me, turnsBefore, turn, withdrawnOrders }) {
|
|
94
115
|
await requireApprovedAccount(ctx, writeAccount(me));
|
|
95
|
-
const base = { game: { id: gameId, name }, turn };
|
|
116
|
+
const base = { game: { id: gameId, name }, turn, withdrawnOrders };
|
|
96
117
|
const check = 'Check warapp_get_game (your committed flag, the turn count) before doing anything else.';
|
|
97
118
|
const unconfirmed = (warning) => ({ status: 'unconfirmed', outcome: 'unconfirmed', ...base, warning });
|
|
98
119
|
return sendAndVerify({
|
|
@@ -138,7 +159,8 @@ export function registerUncommitTool(server, ctx) {
|
|
|
138
159
|
outcome: 'confirmed',
|
|
139
160
|
...base,
|
|
140
161
|
detail: 'Your orders are withdrawn and the game is waiting on you again: submit corrected orders with ' +
|
|
141
|
-
'warapp_submit_turn
|
|
162
|
+
'warapp_submit_turn before the boot timer runs out — `withdrawnOrders` as they were (or edited), or a ' +
|
|
163
|
+
'new plan from warapp_plan_turn.',
|
|
142
164
|
...(stillBroken.length
|
|
143
165
|
? {
|
|
144
166
|
agreementsStillBroken: stillBroken,
|