@battlegrid/mcp-server 32.0.91 → 32.0.94

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/README.md CHANGED
@@ -38,6 +38,55 @@ Seeing package `31.x` alongside handshake `battlegrid@33.x` — the package **be
38
38
 
39
39
  **What this changes for you:** nothing about how you call anything. Upgrading the package no longer waits on a server deploy, and a server deploy no longer strands you on a package that names the wrong contract — reconnect and the announcement follows. **Contract breaking-change notes are no longer keyed to package versions**, since a contract move is no longer a release here; the v11-and-earlier notes below are kept as history, and the live vocabulary is always discovery.
40
40
 
41
+ ## Contract history — v169.2 to v169.4 (one win-rate rounding; every realized figure exact)
42
+
43
+ **All three are MINOR: the same schemas serve different values.** No input moves, no output narrows, and nothing
44
+ v169.1 accepted is refused. Round money to the cent, and a percent to the decimals you want, when you display it.
45
+
46
+ ### Changed values — the same schemas serve a different value
47
+
48
+ **v169.2 — every closed-trade win rate rounds once.** Wins × 1000 ÷ closed trades, to whole thousandths, served as a
49
+ one-decimal percent or the equal three-decimal fraction.
50
+
51
+ - **`get_agent_explorer`'s `winRatePercent`** on `entries[]`, `stats` and `aggregations.modelVendors[]` is a
52
+ one-decimal percent: 2 of 3 serves `66.7`, where it served `67`.
53
+ - **`get_agent_profile`'s `tradeWinRatePct`** is a one-decimal percent: 2 of 3 serves `66.7`, where it served
54
+ `66.66666666666666`.
55
+ - **`get_public_agent_signal_performance`'s `winRatePercent`** multiplies before it divides: 201 of 400 serves `50.3`,
56
+ where it served `50.2`.
57
+ - **`get_signal_log`'s `log.trackRecord` READY rows' `winRate`**, for a thesis written after the deploy: 201 of 400
58
+ serves `0.503`, where it served `0.502`. A stored record keeps the value its model read.
59
+
60
+ **v169.3 — the remaining realized figures are exact.** Each serves the exact 8-decimal realized sum where it served
61
+ whole cents: trades of `12.345` and `-4.10` serve `8.245`, where they served `8.25`.
62
+
63
+ - **`get_agent_llm_spend` and `get_llm_spend_breakdown`**: `realizedNetUsd` and `netAfterLlmUsd`, pooled and per
64
+ member. Net after LLM is the exact net less the platform spend rounded once to cents. The
65
+ `LLM_SPEND_FLIPS_NET_AFTER_LLM` highlight is decided on, and valued at, that served figure.
66
+ - **`get_account_review_analytics`**: `agents[]` and `totals` `realizedNetUsd` and `netAfterLlmUsd`.
67
+ - **`get_agent_review_analytics`, `get_agent_review_slices` and `get_review_slices_breakdown`**: every row's
68
+ `realizedNetUsd`, and the coin rows' `feesUsd`.
69
+ - **`list_agent_trades`'s `summary.netPnlUsd`**, **`list_strategies`' `viewerPerformance.realizedPnlUsd`** and
70
+ **`get_public_strategy_library`'s `rows[].performance.realizedPnlUsd`**. The library's `TOP` order now separates
71
+ cohorts less than a cent apart.
72
+
73
+ **v169.4 — one closed-trade rollup.** Averages are the exact mean of the total, and best and worst are the persisted
74
+ amounts.
75
+
76
+ - **`get_agents_hub`'s `roster[].closedTrades` and `get_agents_portfolio_pnl`'s `agentTrades[].closedTrades`**:
77
+ `avgNetPnlUsd` is the exact mean of `totalNetPnl` over `closedTradeCount`, and `bestNetPnlUsd` / `worstNetPnlUsd`
78
+ are the persisted amounts. Trades of `5.678, -2.5, 0, 1.004` serve `1.0455`, `5.678` and `-2.5`, where they served
79
+ `1.05`, `5.68` and `-2.5`.
80
+ - **`performance.avgPnl`** on `list_intelligence_agents`, `get_intelligence_agent` and the receipts that carry the
81
+ agent record (`activate_intelligence_agent`, `archive_intelligence_agent`, `commit_agent_draft`): 8 decimals, no
82
+ longer the database's binary-float average (`0.6666666666666666` serves `0.66666667`).
83
+ - **`get_agent_profile`'s `avgNetPnl`**: the same mean.
84
+
85
+ ### Changed text
86
+
87
+ - **`get_agent_llm_spend` and `get_llm_spend_breakdown`** (v169.3) say each spend figure is rounded once to cents,
88
+ and the realized net and net after LLM are exact.
89
+
41
90
  ## Contract history — v169 (one exact rule for realized net; the hub's per-agent average is gone)
42
91
 
43
92
  **v169 is MAJOR: one published output loses a field.** No input moves, and nothing v168 accepted is refused.
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/cli
47
47
  * being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
48
48
  * correction. Never move it to track the server.
49
49
  */
50
- export declare const PACKAGE_VERSION = "32.0.91";
50
+ export declare const PACKAGE_VERSION = "32.0.94";
51
51
  export declare const DEFAULT_URL = "https://mcp.battlegrid.trade/mcp";
52
52
  export interface EnvConfig {
53
53
  apiKeys: string[];
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import { Client, SdkHttpError, StreamableHTTPClientTransport } from '@modelconte
49
49
  * being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
50
50
  * correction. Never move it to track the server.
51
51
  */
52
- export const PACKAGE_VERSION = '32.0.91';
52
+ export const PACKAGE_VERSION = '32.0.94';
53
53
  export const DEFAULT_URL = 'https://mcp.battlegrid.trade/mcp';
54
54
  const MAX_RETRIES = 3;
55
55
  const RETRY_DELAYS_MS = [2000, 4000, 8000];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battlegrid/mcp-server",
3
- "version": "32.0.91",
3
+ "version": "32.0.94",
4
4
  "description": "BattleGrid MCP server — play crypto prediction games from AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "generator": "battlegrid-app/server/scripts/export-mcp-skills.mjs",
3
- "contractVersion": "168.3.0",
3
+ "contractVersion": "170.0.0",
4
4
  "files": {
5
5
  "battlegrid-agent-management/SKILL.md": "324ef8181bfcfc99b955d9644ed543c6ab91071153d43f77ccf0a4979b896b09",
6
6
  "battlegrid-agent-management/references/agent-stage-examples.md": "dffcc353d61dfc7b5bb6a2b3077fc6bf8c760a34c287cafb3b59b99306f24195",
@@ -13,10 +13,10 @@
13
13
  "battlegrid-radar-deployment/SKILL.md": "bffe54bb209ccaf1f6df3bf86a811e6768db0d11c52ae0c460cbe1494a459e43",
14
14
  "battlegrid-radar-deployment/references/arena-stage-examples.md": "65af54b67c3248c53fb8911df769ad32824e1f1f1d83ffc007b42a888d5e3076",
15
15
  "battlegrid-radar-deployment/references/radar-stage-examples.md": "6d898a49c42861d6efb5d1b136996e6fb64beca7cac8b8c5dba7fed17a1c3bf5",
16
- "battlegrid-strategy-authoring/SKILL.md": "a1e8166445ea2632ed0d60b08f879a3a4f5336e3b472342e759b191a30bacf23",
17
- "battlegrid-strategy-authoring/references/strategy-stage-examples.md": "f9da084ed057b20f7554184445b1bdc6410e1c612a79392182823982f63513a7",
16
+ "battlegrid-strategy-authoring/SKILL.md": "f1375d1de10433161291c6c0f1c58f1abfe42bec8ecc6af6967c7086f0e77a79",
17
+ "battlegrid-strategy-authoring/references/strategy-stage-examples.md": "0eb41edd013f95092f5822a922c7cdd731584892ed90da575dbb65c93a1a00b6",
18
18
  "battlegrid-strategy-doctor/SKILL.md": "133fe2ff3e8ca634822e02c7e30032c59c8b37b0b685023bfb98d280a678b5ae",
19
- "battlegrid-strategy-examples/SKILL.md": "50c7e6121e792f4ddeb6babf5679af2e2bdefc6247d86d0d88853a68c21f6636",
19
+ "battlegrid-strategy-examples/SKILL.md": "906a64e881f8bad0fd5fc8ec9bdb5f090c94c9b85cd80933183311ef49cc98d5",
20
20
  "battlegrid-strategy-examples/references/playbooks.md": "3134fde92a6ce6fecc6d610629d02450f92e47f3a1a1f33d456658267b5ce123",
21
21
  "battlegrid-strategy-examples/references/recipes.md": "e24483ec52cbcedba08ed6fa7f2a28b0fde170b2d4b1876162d180538cd789f2",
22
22
  "battlegrid-strategy-examples/references/tradingview-ports.md": "5d65b5299ddfddd80f413a0301de25861607aeb0840b89416c3f0603a4b7cb37",
@@ -344,9 +344,18 @@ changing; send no other axis.
344
344
  stage carrying all four of its dials — `minStopLossAtrMultiple`, `maxStopLossAtrMultiple`,
345
345
  `minRiskRewardRatio` and `minAtrPct` — and its `tradeLevelMenu`, everything you are not changing exactly as it stands
346
346
  now: read them from the draft's TRADE_LEVEL_POLICY when the draft holds it, otherwise from
347
- `get_strategy`. Raising `minRiskRewardRatio` above an R target in the menu is refused until that option leaves the
348
- menu, so a raise restates the menu without it. The `strategy-examples` skill's *Trade levels* section carries the
349
- menu's options, how pairs are built and what the save refuses. The same holds for a condition: CONDITIONS carries every condition, each with its
347
+ `get_strategy`. The menu lists stops and **exit plans**: a plan is 1–4 targets, each closing a whole-number share of the
348
+ position, and what it does not close is the **runner**, which only Trailing exits — a plan that leaves one is refused
349
+ while `trailingEnabled` is false, and switching Trailing off under one is refused too. A plan's risk-reward is
350
+ share-weighted: each share at its target, the runner at the last target that closes a share; a last target closing 0%
351
+ is the **trail objective**, which sets how far the runner's trail measures and earns no reward. Raising
352
+ `minRiskRewardRatio` above an all-R plan's risk-reward is refused until that plan changes or leaves the menu, so a
353
+ raise restates the menu without it. The `strategy-examples` skill's *Trade levels* section carries the menu's
354
+ options, how pairs are built and what the save refuses. Before committing a TRADE_LEVEL_POLICY change, show the
355
+ player `preview_strategy_trade_levels({ coinTicker, source: { kind: "DRAFT", strategyId, draftVersion } })`: every
356
+ stop with its verdict and its distance in ATR, the pairs that survive with each target's price and close %, each
357
+ runner's trail distance in ATR and R, the pairs refused and why, and the reachable stop band, per direction. An R
358
+ target there is measured from its own pair's stop; `minRiskRewardRatio` judges each pair's plan risk-reward. The same holds for a condition: CONDITIONS carries every condition, each with its
350
359
  `required` flag and verdict as they stand. Never set `required` or a verdict from memory, and never
351
360
  change either unless the player asked: a wrong value there is how a building block silently becomes
352
361
  a mandatory trade gate, or a gate silently disappears.
@@ -36,9 +36,14 @@ and TIMEFRAME_PROFILE before it can be created.
36
36
 
37
37
  TRADE_LEVEL_POLICY is sent whole: all four dials and the menu, even when only one changes. `minAtrPct` is the ATR%
38
38
  volatility floor a coin must clear before any condition is read; the next three are the stop-loss band and the
39
- reward-to-risk floor; `tradeLevelMenu` lists, per trade direction, the stop and target options the agent picks a pair
40
- from. A level option names a level the strategy's report yields — here the platform support/resistance section's
41
- Donchian edges.
39
+ reward-to-risk floor; `tradeLevelMenu` lists, per trade direction, the stop options and the exit plans the agent picks
40
+ a stop × plan pair from. An exit plan is 1–4 targets, nearest first, each closing a whole-number `closePct` of the
41
+ position; whatever the plan does not close is the runner, which only Trailing exits, so a plan that leaves one needs
42
+ `trailingEnabled`. A last target closing `0` is the trail objective: it places no order and only sets how far the
43
+ runner's trail measures. A level option names a level the strategy's report yields — here the platform
44
+ support/resistance section's Donchian edges. The LONG list below offers a scale-out (half at 1R, half at 3R — it pays
45
+ 2R), the channel edge closing everything, and a runner plan (half at 2R, the rest trailed towards 6R — it pays 2R:
46
+ the trail objective earns nothing).
42
47
 
43
48
  ```json stage_strategy_draft
44
49
  {
@@ -60,14 +65,29 @@ Donchian edges.
60
65
  "bufferAtrMultiple": 0.25
61
66
  }
62
67
  ],
63
- "targets": [
64
- { "kind": "R_MULTIPLE", "multiple": 2 },
65
- { "kind": "LEVEL", "level": { "metric": "DONCHIAN_UPPER", "timeframe": { "rel": "anchor" }, "bars": null, "offset": 0, "knobs": {}, "windowExtreme": null } }
68
+ "exitPlans": [
69
+ {
70
+ "targets": [
71
+ { "method": { "kind": "R_MULTIPLE", "multiple": 1 }, "closePct": 50 },
72
+ { "method": { "kind": "R_MULTIPLE", "multiple": 3 }, "closePct": 50 }
73
+ ]
74
+ },
75
+ {
76
+ "targets": [
77
+ { "method": { "kind": "LEVEL", "level": { "metric": "DONCHIAN_UPPER", "timeframe": { "rel": "anchor" }, "bars": null, "offset": 0, "knobs": {}, "windowExtreme": null } }, "closePct": 100 }
78
+ ]
79
+ },
80
+ {
81
+ "targets": [
82
+ { "method": { "kind": "R_MULTIPLE", "multiple": 2 }, "closePct": 50 },
83
+ { "method": { "kind": "R_MULTIPLE", "multiple": 6 }, "closePct": 0 }
84
+ ]
85
+ }
66
86
  ]
67
87
  },
68
88
  "SHORT": {
69
89
  "stops": [{ "kind": "PERCENT", "percent": 2 }],
70
- "targets": [{ "kind": "R_MULTIPLE", "multiple": 2 }]
90
+ "exitPlans": [{ "targets": [{ "method": { "kind": "R_MULTIPLE", "multiple": 2 }, "closePct": 100 }] }]
71
91
  }
72
92
  }
73
93
  }
@@ -888,7 +888,7 @@ header is. Worked sections and conditions: `references/recipes.md`, *Market and
888
888
  ## Trade levels
889
889
 
890
890
  `{ minStopLossAtrMultiple, maxStopLossAtrMultiple, minRiskRewardRatio, minAtrPct, tradeLevelMenu }` — where stops
891
- and targets may sit, which stops and targets the agent may choose from, and how much a coin must move before it is
891
+ and targets may sit, which stops and exit plans the agent may choose from, and how much a coin must move before it is
892
892
  worth trading at all. `minStopLossAtrMultiple < maxStopLossAtrMultiple` (≤ the 5×ATR structural cap),
893
893
  `minRiskRewardRatio` within the served range. `minAtrPct` is the ATR floor: a coin whose ATR% sits below it is refused
894
894
  (`ATR_VOLATILITY_BELOW_MIN`) before any condition is read, with bounds from
@@ -896,34 +896,52 @@ worth trading at all. `minStopLossAtrMultiple < maxStopLossAtrMultiple` (≤ the
896
896
  a high floor with a wide stop needs more capital per trade. The axis is staged whole — all five keys.
897
897
  Sizing is risk-budget based — a wider stop means a smaller position, never more risk.
898
898
 
899
- **The menu: the author lists the options, the agent picks a pair.** `tradeLevelMenu` is `{ "LONG": { stops, targets },
900
- "SHORT": { stops, targets } }` — each direction authored on its own, never mirrored, each list 1–8 options. Every ATR
899
+ **The menu: the author lists the options, the agent picks a pair.** `tradeLevelMenu` is `{ "LONG": { stops, exitPlans },
900
+ "SHORT": { stops, exitPlans } }` — each direction authored on its own, never mirrored, each list 1–8 entries. Every ATR
901
901
  below is the strategy timeframe's.
902
902
 
903
903
  - A **stop** option is one of `{ "kind": "ATR", "atrMultiple": m }` (0 < m ≤ 5), `{ "kind": "LEVEL", "level": <level
904
904
  reference>, "bufferAtrMultiple": b }` (0 ≤ b ≤ 5: the stop sits b × ATR beyond the level on the loss side), or
905
905
  `{ "kind": "PERCENT", "percent": p }` (0 < p < 100, a fixed percent from entry).
906
- - A **target** option is `{ "kind": "R_MULTIPLE", "multiple": r }` (0 < r ≤ 10) or `{ "kind": "LEVEL", "level": <level
907
- reference> }`.
906
+ - An **exit plan** is `{ "targets": [ { "method": <target option>, "closePct": c }, … ] }` — 1–4 targets, nearest
907
+ first, each closing a whole-number `closePct` of the position. A **target** option is
908
+ `{ "kind": "R_MULTIPLE", "multiple": r }` (0 < r ≤ 10) or `{ "kind": "LEVEL", "level": <level reference> }`.
909
+
910
+ **Shares, the runner and the trail objective.** The shares sum to at most 100; the first target closes a share; every
911
+ closing target closes at least 5%. What the plan does not close is the **runner**, 0% or at least 5%: no take-profit
912
+ order rests for it, and only Trailing exits it, so a plan that leaves a runner is refused while `trailingEnabled` is
913
+ false. A `closePct` of 0 is allowed only on the last target of a plan that leaves a runner and closes a share before it:
914
+ that target is the **trail objective** — it places no order and only sets how far the runner's trail measures.
915
+ `[2R closing 50%, 6R closing 0%]` banks half at 2R and trails the rest with a trail sized to 6R. One target closing
916
+ 100% is today's single take-profit.
908
917
 
909
918
  A level reference is the same shape the entry axis names, and must be a level the report yields. At each decision the
910
- platform pairs every stop with every target, prices them on the decided bar, and drops a pair whose stop is not on
911
- the loss side of entry or whose target is not on the profit side, a stop tighter than `minStopLossAtrMultiple` or wider
912
- than `maxStopLossAtrMultiple` (or the 5×ATR cap), and a level target whose reward is under `minRiskRewardRatio`. A
913
- level with no reading on the bar drops its options; nothing is stretched or substituted. Pairs that land on the same
914
- two prices are one setup naming every option that made it. The agent chooses one setup; a one-option list is a fixed
915
- choice.
916
-
917
- **R is the pair's own risk.** An `R_MULTIPLE` target sits `r × |entry − stop|` from entry for the stop it is paired
918
- with, so 2R beside a 2×ATR stop is twice as far as 2R beside a 1×ATR stop. Its reward is exactly r, so the save refuses
919
- an R option below `minRiskRewardRatio` (it could never trade) rather than dropping it per trade.
920
-
921
- **What the save refuses, per direction** (each naming its field): a list outside 1–8 options; an option outside its
922
- bounds; a level the report does not yield; an R target below `minRiskRewardRatio`; a target level that is the
923
- direction's entry level (no reward); and one level in both the stop and the target list. The entry level may also be a
924
- stop. A CREATE that stages no menu opens with the seed — stops ATR 1× / 1.5× / 2× plus the Donchian edge and Bollinger
925
- band on the loss side, targets 1.5R / 2R / 3R (those at or above the minimum) plus the Donchian edge and Bollinger band
926
- on the profit side, never a target at its own entry level — keeping only the levels its report yields.
919
+ platform pairs every stop with every exit plan and prices each target on the decided bar beside that stop. It drops a
920
+ pair whose stop is not on the loss side of entry, a stop tighter than `minStopLossAtrMultiple` or wider than
921
+ `maxStopLossAtrMultiple` (or the 5×ATR cap), a plan whose targets do not run away from entry in plan order beside that
922
+ stop, a pair whose plan risk-reward is under `minRiskRewardRatio`, and — for an agent — a plan one of whose target
923
+ legs would fall under the exchange's minimum order value at the smallest order the agent can place. A level with no
924
+ reading on the bar drops the plans that name it; nothing is stretched, merged or substituted. Pairs that land on the
925
+ same stop, target prices and shares are one setup naming every option and plan that made it. The agent chooses one
926
+ setup; a one-entry list is a fixed choice.
927
+
928
+ **R is the pair's own risk; the plan's risk-reward is share-weighted.** An `R_MULTIPLE` target sits `r × |entry −
929
+ stop|` from entry for the stop it is paired with, so 2R beside a 2×ATR stop is twice as far as 2R beside a 1×ATR stop.
930
+ A plan's risk-reward is each share at its target's distance plus the runner at the distance of the last target that
931
+ closes a share, over the stop's risk; a trail objective adds nothing. `[1R closing 50%, 3R closing 50%]` pays 2.0 and
932
+ `[1R closing 50%]` pays 1.0. An all-R plan has the same risk-reward beside every stop, so the save refuses one below
933
+ `minRiskRewardRatio` (it could never trade) rather than dropping it per trade; a plan's early target may sit below
934
+ the minimum when the plan as a whole clears it.
935
+
936
+ **What the save refuses, per direction** (each naming its field): a list outside 1–8 entries; an option outside its
937
+ bounds; a plan that breaks a share rule above; consecutive R targets whose multiples do not increase, or one level
938
+ named twice in a plan; a level the report does not yield; an all-R plan below `minRiskRewardRatio`; a plan that leaves
939
+ a runner while Trailing is off (an update that only switches Trailing off is refused the same way); a target level that
940
+ is the direction's entry level (no reward); and one level in both the stop list and an exit plan. The entry level may
941
+ also be a stop. A CREATE that stages no menu opens with the seed — stops ATR 1× / 1.5× / 2× plus the Donchian edge and
942
+ Bollinger band on the loss side, one-target plans closing 100% at 1.5R / 2R / 3R (those at or above the minimum) plus
943
+ the Donchian edge and Bollinger band on the profit side, never a target at its own entry level — keeping only the
944
+ levels its report yields.
927
945
 
928
946
  ## Position management
929
947