@chrischall/warapp-mcp 0.23.1 → 0.24.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/dist/analysis/calibrate.js +54 -0
- package/dist/analysis/commitments.js +8 -2
- package/dist/analysis/plan/deploy-estimates.js +17 -6
- package/dist/analysis/plan/estimates.js +1 -0
- package/dist/analysis/plan/threats.js +1 -1
- package/dist/bundle.js +445 -57
- package/dist/chat.js +73 -0
- package/dist/protocol/methods.js +29 -3
- package/dist/tools/calibration-harness.js +22 -6
- package/dist/tools/calibration-job.js +133 -0
- package/dist/tools/calibration-worker.js +10 -0
- package/dist/tools/calibration.js +53 -22
- package/dist/tools/chat.js +204 -30
- package/dist/tools/check-plan.js +2 -1
- package/dist/tools/turn.js +3 -2
- package/dist/version.js +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/tools/chat.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
// confirmation — a message reaches other players and cannot be unsent.
|
|
5
5
|
import { CONFIRM_INJECTION_RULE, McpToolError, toolAnnotations } from '@chrischall/mcp-utils';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { CHAT_CHANNELS, feedChatLines, fillFromFeed, mergeChatLines, oldestId, readGameRefreshChat, readMessageHistoryReply, readSendChatReply, } from '../chat.js';
|
|
7
|
+
import { CHAT_CHANNELS, feedChatLines, fillFromFeed, mergeChatLines, oldestId, readCreateGameGroupReply, readGameGroups, readGameRefreshChat, readMessageHistoryReply, readSendChatReply, } from '../chat.js';
|
|
8
8
|
import { advanceCursor, markedChannels, markNew, readChatCursor, unreadCounts, writeChatCursor, } from '../chat-cursor.js';
|
|
9
9
|
import { parseGameId } from '../client.js';
|
|
10
10
|
import { inGameId, inGameOf, playersByInGameId } from '../live.js';
|
|
11
11
|
import { decodeChatLinks, encodeChatLinks, hasChatLinkMarkers } from '../chat-links.js';
|
|
12
|
-
import { CHAT_CHANNEL_PUBLIC, Method, writeGameRefreshParams, writeRetrieveChatParams, writeRetrievePrivateMessageHistoryParams, writeSendChatParams, } from '../protocol/methods.js';
|
|
12
|
+
import { CHAT_CHANNEL_PUBLIC, Method, writeGameRefreshParams, writeRetrieveChatParams, writeCreateGameGroupParams, writeRetrievePrivateMessageHistoryParams, writeSendChatParams, } from '../protocol/methods.js';
|
|
13
13
|
import { carriesTeam } from '../teams.js';
|
|
14
14
|
import { gameIdArg, readAnnotations, respond, UNTRUSTED_PREVIEW_NOTE, untrustedBody, untrustedDescription, untrustedText, } from './common.js';
|
|
15
15
|
import { checkMessageCommitments, commitmentsArg, COMMITMENTS_NOTE, DEFAULT_PLAN_CHECKED } from './commitments.js';
|
|
@@ -24,6 +24,40 @@ import { AUTOMATED_CHAT_OFF, chatAutomationMode } from '../chat-automation.js';
|
|
|
24
24
|
import { resolveTeams } from './team-source.js';
|
|
25
25
|
const DEFAULT_LIMIT = 50;
|
|
26
26
|
const MAX_CHAT_LENGTH = 2000;
|
|
27
|
+
/** The most players one game-group message names (`to` as a list). */
|
|
28
|
+
export const MAX_GROUP_RECIPIENTS = 10;
|
|
29
|
+
/** The most characters of a new game group's name. */
|
|
30
|
+
const MAX_GROUP_NAME = 50;
|
|
31
|
+
/** A new game group's name when none is given: it is shown to the members. */
|
|
32
|
+
export const DEFAULT_GROUP_NAME = 'Group chat';
|
|
33
|
+
/** CreateGameGroup's refusals as the client words them. */
|
|
34
|
+
const GROUP_REFUSALS = {
|
|
35
|
+
227: 'a player in it has blocked you',
|
|
36
|
+
751: 'this game does not allow game groups',
|
|
37
|
+
};
|
|
38
|
+
/** Ids as "1, 2 and 3". */
|
|
39
|
+
const listIds = (ids) => (ids.length > 1 ? `${ids.slice(0, -1).join(', ')} and ${ids.at(-1)}` : String(ids[0]));
|
|
40
|
+
/**
|
|
41
|
+
* The game's newest group holding exactly me and `members` (in-game ids), from one GameRefresh with the game details.
|
|
42
|
+
* `read: false` when the groups could not be read (a failed request, or a reply without them). Never throws.
|
|
43
|
+
*/
|
|
44
|
+
async function existingGroup(ctx, game, meInGame, members) {
|
|
45
|
+
try {
|
|
46
|
+
const env = await ctx.rpc.call('GameRefresh', Method.GameRefresh, (w) => writeGameRefreshParams(w, { gameId: game.id, chat: false, nonChat: true, lobby: game.state === 'WaitingForPlayers' }));
|
|
47
|
+
const groups = readGameGroups(await ctx.bundle(), env.body);
|
|
48
|
+
if (!groups)
|
|
49
|
+
return { read: false };
|
|
50
|
+
const want = new Set([meInGame, ...members]);
|
|
51
|
+
const same = groups
|
|
52
|
+
.filter((g) => g.gameId === game.id && g.members !== null && new Set(g.members).size === want.size && g.members.every((m) => want.has(m)))
|
|
53
|
+
.sort((a, b) => b.id - a.id);
|
|
54
|
+
return same[0] ? { read: true, group: same[0] } : { read: true };
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return { read: false };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const GROUP_UNVERIFIED = 'Game groups (creating one, and a message to one) are read from the client bundle and UNVERIFIED live.';
|
|
27
61
|
/** The send preview's note on links: what goes out, and what is verified. */
|
|
28
62
|
const LINKS_NOTE = 'Each link goes out as the client\'s token (`<a t=ID>` territory, `<a b=ID>` bonus) and players see the name from ' +
|
|
29
63
|
'the map. Territory and bonus links are verified live (2026-11-23).';
|
|
@@ -436,8 +470,9 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
436
470
|
}, {
|
|
437
471
|
name: 'warapp_send_chat',
|
|
438
472
|
description: 'Post a chat message in a war.app (Warzone) game — to the whole game, to your team (`channel: "team"`, in ' +
|
|
439
|
-
'a team game), or privately to one named player (`to
|
|
440
|
-
'
|
|
473
|
+
'a team game), or privately to one named player (`to`), or to several together (`to` as a list: a war.app game ' +
|
|
474
|
+
'group, reused when one of exactly you and them exists, else created first, named by `group_name`; UNVERIFIED live); ' +
|
|
475
|
+
'private sends are refused when the game turns private messages off. The message reaches other players and cannot be unsent. Sent through your signed-in war.app tab ' +
|
|
441
476
|
'(ContextMint Bridge); the game is read from GameFeed first, so the GameFeed credentials are needed too. ' +
|
|
442
477
|
"The result's `outcome` is `confirmed` when war.app's reply lists it as your newest message on that " +
|
|
443
478
|
'channel, `accepted` when the reply cannot be read, `unconfirmed` when it does not show it. ' +
|
|
@@ -478,9 +513,19 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
478
513
|
.optional()
|
|
479
514
|
.describe('"public" (default): the whole game. "team": your team only (a team game). Not with `to`.'),
|
|
480
515
|
to: z
|
|
481
|
-
.union([z.string(), z.number()])
|
|
516
|
+
.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()])).min(1).max(MAX_GROUP_RECIPIENTS)])
|
|
517
|
+
.optional()
|
|
518
|
+
.describe('A player (name or GameFeed id) to message privately, or a list of 2 to ' +
|
|
519
|
+
`${MAX_GROUP_RECIPIENTS} players to message together in a game group (one private conversation they all read). ` +
|
|
520
|
+
'Omit to post to a channel.'),
|
|
521
|
+
group_name: z
|
|
522
|
+
.string()
|
|
523
|
+
.trim()
|
|
524
|
+
.min(1)
|
|
525
|
+
.max(MAX_GROUP_NAME)
|
|
482
526
|
.optional()
|
|
483
|
-
.describe(
|
|
527
|
+
.describe(`A list \`to\` only: the name of the game group if one has to be created (default "${DEFAULT_GROUP_NAME}"; the members see it). ` +
|
|
528
|
+
'An existing group of exactly these players is reused, keeping its name.'),
|
|
484
529
|
commitments: commitmentsArg,
|
|
485
530
|
automated: z
|
|
486
531
|
.boolean()
|
|
@@ -488,7 +533,7 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
488
533
|
.describe('true when you send a reply the owner did not tell you to send (an automated reply). Refused unless ' +
|
|
489
534
|
'WARAPP_CHAT_AUTOMATION is on; default false (a send the owner asked for).'),
|
|
490
535
|
}),
|
|
491
|
-
async plan({ game_id, message, channel, to, commitments, automated, link_territories }) {
|
|
536
|
+
async plan({ game_id, message, channel, to, group_name, commitments, automated, link_territories }) {
|
|
492
537
|
// #415: an automated reply is refused with the gate off, before any request.
|
|
493
538
|
const auto = automated === true;
|
|
494
539
|
if (auto && (ctx.chatAutomation ?? chatAutomationMode(opts.env ?? process.env)) !== 'on') {
|
|
@@ -497,7 +542,19 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
497
542
|
});
|
|
498
543
|
}
|
|
499
544
|
const gameId = parseGameId(game_id);
|
|
500
|
-
|
|
545
|
+
// A list `to` of two or more players is a game group; a list of one is a private message to that player.
|
|
546
|
+
const toList = Array.isArray(to) ? to.filter((x) => String(x).trim() !== '') : undefined;
|
|
547
|
+
const grouped = toList !== undefined && toList.length >= 2;
|
|
548
|
+
const single = toList ? (toList.length === 1 ? toList[0] : undefined) : Array.isArray(to) ? undefined : to;
|
|
549
|
+
const privately = grouped || (single !== undefined && String(single).trim() !== '');
|
|
550
|
+
if (toList !== undefined && toList.length === 0) {
|
|
551
|
+
throw new McpToolError('`to` lists no player: nothing was sent.', { hint: 'Name the players to message, or omit `to` to post to the whole game.' });
|
|
552
|
+
}
|
|
553
|
+
if (group_name !== undefined && !grouped) {
|
|
554
|
+
throw new McpToolError('`group_name` names a game group, which only a list of two or more players in `to` uses: nothing was sent.', {
|
|
555
|
+
hint: 'Pass `to` as a list of the players to message together, or drop `group_name`.',
|
|
556
|
+
});
|
|
557
|
+
}
|
|
501
558
|
if (privately && channel === 'team') {
|
|
502
559
|
throw new McpToolError('A private message (`to`) cannot also go to the team channel: nothing was sent.', {
|
|
503
560
|
hint: 'Omit `to` to message your team, or omit `channel` to message one player privately.',
|
|
@@ -538,11 +595,42 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
538
595
|
let chatChannel = CHAT_CHANNEL_PUBLIC;
|
|
539
596
|
let recipient;
|
|
540
597
|
let shownRecipient;
|
|
598
|
+
let group;
|
|
599
|
+
let groupsRead = true;
|
|
541
600
|
if (privately) {
|
|
542
601
|
if (game.settings?.privateMessaging === false) {
|
|
543
602
|
throw new McpToolError(`Game ${gameId} turns private messaging off (its PrivateMessaging setting), so nothing was sent.`, { hint: 'Post to the whole game instead: the host turned private messages off.' });
|
|
544
603
|
}
|
|
545
|
-
|
|
604
|
+
}
|
|
605
|
+
if (grouped) {
|
|
606
|
+
const people = toList.map((x) => resolvePlayer(game.players, x));
|
|
607
|
+
const mine = people.find((p) => p.id === me);
|
|
608
|
+
if (mine) {
|
|
609
|
+
throw new McpToolError(`${untrustedText(mine.name)} (${mine.id}) is you: list only the other players in \`to\`. Nothing was sent.`, {
|
|
610
|
+
hint: 'The group includes you anyway: name the players to message with you.',
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
const twice = people.find((p, i) => people.findIndex((q) => q.id === p.id) !== i);
|
|
614
|
+
if (twice) {
|
|
615
|
+
throw new McpToolError(`Player ${twice.id} is named twice in \`to\`: nothing was sent.`, { hint: 'Name each player once.' });
|
|
616
|
+
}
|
|
617
|
+
if (meInGame === undefined) {
|
|
618
|
+
throw new McpToolError(`Your seat in game ${gameId} has no in-game id, so a game group cannot be made: nothing was sent.`, {
|
|
619
|
+
hint: 'Message each player privately instead.',
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
kind = 'group';
|
|
623
|
+
const members = people.map((p) => inGameId(p));
|
|
624
|
+
const found = await existingGroup(ctx, game, meInGame, members);
|
|
625
|
+
groupsRead = found.read;
|
|
626
|
+
group = {
|
|
627
|
+
...(found.group ? { id: found.group.id, name: untrustedText(found.group.name) } : { name: group_name ?? DEFAULT_GROUP_NAME }),
|
|
628
|
+
members,
|
|
629
|
+
recipients: people.map((p) => ({ id: p.id, name: untrustedText(p.name) })),
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
else if (privately) {
|
|
633
|
+
const p = resolvePlayer(game.players, single);
|
|
546
634
|
if (p.id === me) {
|
|
547
635
|
throw new McpToolError(`${untrustedText(p.name)} (${p.id}) is you: a private message to yourself was not sent.`, {
|
|
548
636
|
hint: 'Name another player in `to`, or omit it to post to the whole game.',
|
|
@@ -571,23 +659,34 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
571
659
|
});
|
|
572
660
|
}
|
|
573
661
|
// A truce changes only with its partner told (D3): the check knows who reads the message.
|
|
574
|
-
const audience = kind === 'private'
|
|
662
|
+
const audience = kind === 'private'
|
|
663
|
+
? { kind: 'private', to: shownRecipient.id }
|
|
664
|
+
: kind === 'group'
|
|
665
|
+
? { kind: 'group', to: group.recipients.map((r) => r.id) }
|
|
666
|
+
: kind === 'team'
|
|
667
|
+
? { kind: 'team', team: chatChannel }
|
|
668
|
+
: { kind: 'public' };
|
|
575
669
|
promised = await checkMessageCommitments(ctx, game, seat, promises, audience, teamsKnown);
|
|
576
670
|
}
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
671
|
+
const groupIds = group ? listIds(group.recipients.map((r) => r.id)) : '';
|
|
672
|
+
const words = kind === 'group'
|
|
673
|
+
? `privately to players ${groupIds} only, in a game group (${group.id !== undefined ? `group ${group.id}, which exists` : 'created first'})`
|
|
674
|
+
: kind === 'private'
|
|
675
|
+
? `privately to player ${shownRecipient.id} only`
|
|
676
|
+
: kind === 'team'
|
|
677
|
+
? `to your team (team ${chatChannel}) only`
|
|
678
|
+
: 'to everyone in the game';
|
|
582
679
|
const teamName = `your team (team ${chatChannel})`;
|
|
583
680
|
return {
|
|
584
681
|
gate: {
|
|
585
682
|
action: 'warapp.send_chat',
|
|
586
|
-
summary: kind === '
|
|
587
|
-
? `Send a
|
|
588
|
-
: kind === '
|
|
589
|
-
? `Send a chat message to ${
|
|
590
|
-
:
|
|
683
|
+
summary: kind === 'group'
|
|
684
|
+
? `Send a group chat message to players ${groupIds} in game ${gameId}`
|
|
685
|
+
: kind === 'private'
|
|
686
|
+
? `Send a private chat message to player ${shownRecipient.id} in game ${gameId}`
|
|
687
|
+
: kind === 'team'
|
|
688
|
+
? `Send a chat message to ${teamName} in game ${gameId}`
|
|
689
|
+
: `Post a chat message to everyone in game ${gameId}`,
|
|
591
690
|
account,
|
|
592
691
|
target: gameId,
|
|
593
692
|
payload: {
|
|
@@ -596,11 +695,16 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
596
695
|
text,
|
|
597
696
|
channel: chatChannel,
|
|
598
697
|
recipient: recipient?.id ?? null,
|
|
698
|
+
...(group
|
|
699
|
+
? { group: group.id ?? null, createGroup: group.id === undefined ? { name: group.name, members: group.members } : null }
|
|
700
|
+
: {}),
|
|
599
701
|
...(promised ? { commitments: promised.commitments } : {}),
|
|
600
702
|
},
|
|
601
703
|
willSend: {
|
|
602
704
|
game: gameId,
|
|
603
|
-
to:
|
|
705
|
+
to: group
|
|
706
|
+
? group.recipients.map((r) => r.name).join(', ')
|
|
707
|
+
: (shownRecipient?.name ?? (kind === 'team' ? teamName : 'everyone in the game')),
|
|
604
708
|
message,
|
|
605
709
|
},
|
|
606
710
|
preview: {
|
|
@@ -612,6 +716,20 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
612
716
|
: 'Other players will see this message; it cannot be unsent.',
|
|
613
717
|
game: { id: game.id, name: game.name === undefined ? null : untrustedText(game.name), state: game.state },
|
|
614
718
|
...(shownRecipient ? { recipient: shownRecipient } : {}),
|
|
719
|
+
...(group
|
|
720
|
+
? {
|
|
721
|
+
recipients: group.recipients,
|
|
722
|
+
group: group.id !== undefined
|
|
723
|
+
? { id: group.id, name: group.name, reused: true }
|
|
724
|
+
: { create: true, name: untrustedText(group.name) },
|
|
725
|
+
groupNote: (group.id !== undefined
|
|
726
|
+
? `The game's group ${group.id} holds exactly you and these players: the message goes there.`
|
|
727
|
+
: groupsRead
|
|
728
|
+
? 'No game group of exactly you and these players exists: one is created first, named as shown (the members see the name).'
|
|
729
|
+
: "The game's groups could not be read, so a new group is created first, named as shown (the members see the name), even if one of exactly these players exists.") +
|
|
730
|
+
` ${GROUP_UNVERIFIED}`,
|
|
731
|
+
}
|
|
732
|
+
: {}),
|
|
615
733
|
...(links
|
|
616
734
|
? {
|
|
617
735
|
rendered: untrustedBody(links.rendered),
|
|
@@ -639,6 +757,7 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
639
757
|
kind,
|
|
640
758
|
channel: chatChannel,
|
|
641
759
|
...(recipient ? { recipient } : {}),
|
|
760
|
+
...(group ? { group } : {}),
|
|
642
761
|
...(meInGame !== undefined ? { meInGame } : {}),
|
|
643
762
|
...(auto ? { automated: true } : {}),
|
|
644
763
|
account,
|
|
@@ -655,15 +774,67 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
655
774
|
},
|
|
656
775
|
};
|
|
657
776
|
},
|
|
658
|
-
async execute({ gameId, text, kind, channel, recipient, meInGame, account, commitments, automated }) {
|
|
777
|
+
async execute({ gameId, text, kind, channel, recipient, group, meInGame, account, commitments, automated }) {
|
|
659
778
|
await requireApprovedAccount(ctx, account);
|
|
660
|
-
const to = recipient?.name ?? (kind === 'team' ? `your team (team ${channel})` : 'everyone in the game');
|
|
779
|
+
const to = group?.recipients ?? recipient?.name ?? (kind === 'team' ? `your team (team ${channel})` : 'everyone in the game');
|
|
661
780
|
const marked = automated ? { automated: true } : {};
|
|
662
|
-
|
|
781
|
+
// A group message: the group first (created when none of exactly these players exists), then the message to it.
|
|
782
|
+
let groupId = group?.id;
|
|
783
|
+
if (group && groupId === undefined) {
|
|
784
|
+
let createReply;
|
|
785
|
+
const notSent = (warning) => ({
|
|
786
|
+
status: 'unknown',
|
|
787
|
+
outcome: 'unknown',
|
|
788
|
+
game: gameId,
|
|
789
|
+
channel: kind,
|
|
790
|
+
to,
|
|
791
|
+
...marked,
|
|
792
|
+
group: { id: null, created: 'unknown' },
|
|
793
|
+
warning,
|
|
794
|
+
});
|
|
795
|
+
const made = await sendAndVerify({
|
|
796
|
+
send: async () => {
|
|
797
|
+
createReply = await ctx.rpc.call('CreateGameGroup', Method.CreateGameGroup, (w) => writeCreateGameGroupParams(w, { gameId, name: group.name, members: group.members }));
|
|
798
|
+
},
|
|
799
|
+
refused: (e) => new McpToolError(`war.app refused to create the game group (${GROUP_REFUSALS[e.code] ?? e.message}; war.app error ${e.code}): nothing was sent.`, { hint: 'Message each player privately instead, or post to the whole game.' }),
|
|
800
|
+
unanswered: (failure) => notSent(`war.app did not answer the game group's creation (${failure}), so a group may now exist, but the message was NOT sent. ` +
|
|
801
|
+
"Look at the game's groups in the web client before sending again."),
|
|
802
|
+
readBack: async () => {
|
|
803
|
+
const id = createReply ? readCreateGameGroupReply(await ctx.bundle(), createReply.body) : undefined;
|
|
804
|
+
if (id === undefined)
|
|
805
|
+
throw new Error('its reply named no group');
|
|
806
|
+
return id;
|
|
807
|
+
},
|
|
808
|
+
unreadable: (failure) => notSent(`war.app accepted the game group's creation, but ${failure}, so the message was NOT sent. ` +
|
|
809
|
+
"Look at the game's groups in the web client, then send it again (an existing group of exactly these players is reused)."),
|
|
810
|
+
classify: (id) => id,
|
|
811
|
+
});
|
|
812
|
+
if (typeof made !== 'number') {
|
|
813
|
+
// Like an unconfirmed send, the result says what became of the commitments: the message never left.
|
|
814
|
+
return commitments
|
|
815
|
+
? {
|
|
816
|
+
...made,
|
|
817
|
+
commitments: {
|
|
818
|
+
recorded: [],
|
|
819
|
+
why: 'The message was NOT sent (the game group could not be confirmed), so its commitments were not made: nothing to record.',
|
|
820
|
+
},
|
|
821
|
+
}
|
|
822
|
+
: made;
|
|
823
|
+
}
|
|
824
|
+
groupId = made;
|
|
825
|
+
}
|
|
826
|
+
const groupOut = group ? { group: { id: groupId, created: group.id === undefined } } : {};
|
|
827
|
+
const base = { status: 'sent', game: gameId, channel: kind, to, ...groupOut, ...marked };
|
|
663
828
|
let reply;
|
|
664
829
|
const result = await sendAndVerify({
|
|
665
830
|
send: async () => {
|
|
666
|
-
reply = await ctx.rpc.call('SendChat', Method.SendChat, (w) => writeSendChatParams(w, {
|
|
831
|
+
reply = await ctx.rpc.call('SendChat', Method.SendChat, (w) => writeSendChatParams(w, {
|
|
832
|
+
gameId,
|
|
833
|
+
text,
|
|
834
|
+
channel,
|
|
835
|
+
...(recipient ? { recipient: recipient.id } : {}),
|
|
836
|
+
...(groupId !== undefined ? { group: groupId } : {}),
|
|
837
|
+
}));
|
|
667
838
|
},
|
|
668
839
|
// A refusal is rethrown (nothing was posted; 36, too many messages, is never retried).
|
|
669
840
|
unanswered: (failure) => ({
|
|
@@ -672,6 +843,7 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
672
843
|
game: gameId,
|
|
673
844
|
channel: kind,
|
|
674
845
|
to,
|
|
846
|
+
...groupOut,
|
|
675
847
|
...marked,
|
|
676
848
|
warning: `war.app did not confirm this message (${failure}), so it may ` +
|
|
677
849
|
'already have been posted. Check warapp_get_chat before sending it again.',
|
|
@@ -686,11 +858,13 @@ export function registerChatTools(server, ctx, opts = {}) {
|
|
|
686
858
|
// A reply this server cannot read: war.app's acceptance is all there is.
|
|
687
859
|
unreadable: () => ({ ...base, outcome: 'accepted' }),
|
|
688
860
|
classify: (lines) => {
|
|
689
|
-
const onChannel = (l) => kind === '
|
|
690
|
-
? l.
|
|
691
|
-
: kind === '
|
|
692
|
-
? l.channel === '
|
|
693
|
-
:
|
|
861
|
+
const onChannel = (l) => kind === 'group'
|
|
862
|
+
? l.group === groupId
|
|
863
|
+
: kind === 'private'
|
|
864
|
+
? l.channel === 'private' && l.to === recipient?.id
|
|
865
|
+
: kind === 'team'
|
|
866
|
+
? l.channel === 'team' && l.team === channel
|
|
867
|
+
: l.channel === 'public';
|
|
694
868
|
const newest = lines.filter((l) => meInGame !== undefined && l.sender === meInGame && onChannel(l)).at(-1);
|
|
695
869
|
const same = (a) => a.replace(/\s+/g, ' ').trim() === text.replace(/\s+/g, ' ').trim();
|
|
696
870
|
if (newest && same(newest.text))
|
package/dist/tools/check-plan.js
CHANGED
|
@@ -33,6 +33,7 @@ import { resolveTeamsFor } from './team-source.js';
|
|
|
33
33
|
import { stressOpponents } from './stress-opponents.js';
|
|
34
34
|
import { observedLowWarning } from '../analysis/opponents.js';
|
|
35
35
|
import { statedShiftWarning } from '../analysis/plan/estimates.js';
|
|
36
|
+
import { trackCalibrationDampingFor } from '../analysis/plan/deploy-estimates.js';
|
|
36
37
|
import { sanctionPercentage } from '../analysis/cards-in-effect.js';
|
|
37
38
|
import { CARD_SANCTIONS, sanctionsPlayed } from './sanctions-played.js';
|
|
38
39
|
import { COMMANDER_SIZING, commanderCheckOn, defaultFoggedCount, foggedAttackersArg, foggedCommanderOn, foggedCommanderText, myLargestStack } from './commander-check.js';
|
|
@@ -381,7 +382,7 @@ export function registerCheckPlanTool(server, ctx) {
|
|
|
381
382
|
info,
|
|
382
383
|
...(opening ? { opening } : {}),
|
|
383
384
|
...(mapPace ? { mapPace } : {}),
|
|
384
|
-
...(trackCalibration ? { trackCalibration } : {}),
|
|
385
|
+
...(trackCalibration ? { trackCalibration, trackCalibrationDamping: trackCalibrationDampingFor(profileFormatOf(game.players)) } : {}),
|
|
385
386
|
...(enemy_deploy !== undefined ? { enemyDeploy: enemy_deploy } : {}),
|
|
386
387
|
assumeCards,
|
|
387
388
|
// #444: the stated incomes scale the other opponents' prior, as warapp_plan_turn has them.
|
package/dist/tools/turn.js
CHANGED
|
@@ -6,6 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { CARD_BLOCKADE, CARD_ORDER_DELAY, CARD_ORDER_PRIORITY, holdsOrderPriority, playsOrderPriority, advisedOrderPriority, CARD_REINFORCEMENT, cardRules, cardTypeByName, cardTypeName, chooseCardPlays, normalizeGuid, cardsToShed, handReadable, isMyCard, readHand, reinforcementArmies, } from '../cards.js';
|
|
7
7
|
import { chargeDeploys, DEFAULT_OFFENSIVE_KILL_RATE, deployPools, expectedKills, specialUnitStrength, winChance, incomeDetail, armyCapPoolsUncertainty, deployCheckUncertainties, unreadSanctionsUncertainty, overrideUncertainties, neighborsOf, PAYBACK_TURNS, planTurn, planEnemyEstimates, repulsedAttacks, borderGuess, guessSeed, AHEAD_PRESSURE_FACTOR, PRESSURE_FACTOR, symmetricStart, unevenStart, trackGame, trackOpponents, } from '../analysis/index.js';
|
|
8
8
|
import { statedShifts, statedShiftWarning } from '../analysis/plan/estimates.js';
|
|
9
|
+
import { trackCalibrationDampingFor } from '../analysis/plan/deploy-estimates.js';
|
|
9
10
|
import { parseGameId } from '../client.js';
|
|
10
11
|
import { COMMANDER_STRENGTH, luckFraction, straightKills } from '../analysis/combat.js';
|
|
11
12
|
import { guardOffExposure } from '../analysis/guard-off.js';
|
|
@@ -1524,7 +1525,7 @@ export async function livePlanSetup(ctx, a) {
|
|
|
1524
1525
|
...(mapPace ? { mapPace } : {}),
|
|
1525
1526
|
// #568: this format's own calibration raises each tracked figure by its coverage band's damped factor
|
|
1526
1527
|
// (none in a 1v1, where the fog prior already lifts the tracker: trackCalibrationFor).
|
|
1527
|
-
...(trackCalibration ? { trackCalibration } : {}),
|
|
1528
|
+
...(trackCalibration ? { trackCalibration, trackCalibrationDamping: trackCalibrationDampingFor(profileFormatOf(game.players)) } : {}),
|
|
1528
1529
|
// #164: an opponent's Reinforcement card, from the turn the card clock says one can be in hand.
|
|
1529
1530
|
...(opponentReinforcement(game.settings, hand) ? { reinforcement: opponentReinforcement(game.settings, hand) } : {}),
|
|
1530
1531
|
// #427: the Reinforcement plays seen in the turns' orders (card plays not fogged): a play restarts the clock.
|
|
@@ -2019,7 +2020,7 @@ async function commanderCheck(ctx, a) {
|
|
|
2019
2020
|
info: a.info,
|
|
2020
2021
|
...(opening ? { opening } : {}),
|
|
2021
2022
|
...(mapPace ? { mapPace } : {}),
|
|
2022
|
-
...(trackCalibration ? { trackCalibration } : {}),
|
|
2023
|
+
...(trackCalibration ? { trackCalibration, trackCalibrationDamping: trackCalibrationDampingFor(profileFormatOf(a.game.players)) } : {}),
|
|
2023
2024
|
});
|
|
2024
2025
|
// #275: an untrusted opponent's reply is sized at least at the figure its tripwire gave it, as
|
|
2025
2026
|
// warapp_check_plan's stress test tries it (read only: warapp_plan_turn keeps the marks).
|
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.
|
|
4
|
+
export const VERSION = '0.24.0'; // 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.
|
|
6
|
+
"version": "0.24.0",
|
|
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.
|
|
3
|
+
"version": "0.24.0",
|
|
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.
|
|
9
|
+
"version": "0.24.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@chrischall/warapp-mcp",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.24.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|