hoi4-agent-tools 4.7.0 → 4.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +32 -13
  3. package/dist/hoi4_agent_tools/core/engine-client.js +74 -5
  4. package/dist/hoi4_agent_tools/core/index.js +28 -0
  5. package/dist/hoi4_agent_tools/core/operation-result.js +9 -0
  6. package/dist/hoi4_agent_tools/core/resident-engine.js +273 -0
  7. package/dist/hoi4_agent_tools/core/temporary-directories.js +3 -2
  8. package/dist/hoi4_agent_tools/decision/service.js +46 -2
  9. package/dist/hoi4_agent_tools/event/queries.js +25 -2
  10. package/dist/hoi4_agent_tools/event/service.js +78 -11
  11. package/dist/hoi4_agent_tools/event/summary.js +9 -0
  12. package/dist/hoi4_agent_tools/focus/engine-layout.js +1 -1
  13. package/dist/hoi4_agent_tools/focus/game-render.js +72 -0
  14. package/dist/hoi4_agent_tools/focus/game-view-output.js +160 -0
  15. package/dist/hoi4_agent_tools/focus/native-effects.js +4 -4
  16. package/dist/hoi4_agent_tools/focus/quality/focus-quality-calibration.json +241 -241
  17. package/dist/hoi4_agent_tools/focus/quality/orthogonal.js +30 -19
  18. package/dist/hoi4_agent_tools/focus/quality/schematic.js +5 -3
  19. package/dist/hoi4_agent_tools/focus/quality/scorecard.js +1 -1
  20. package/dist/hoi4_agent_tools/focus/render.js +21 -9
  21. package/dist/hoi4_agent_tools/focus/tool-operations.js +158 -3
  22. package/dist/hoi4_agent_tools/gui/assets.js +18 -0
  23. package/dist/hoi4_agent_tools/gui/dds.js +38 -5
  24. package/dist/hoi4_agent_tools/gui/engine-textures.js +48 -0
  25. package/dist/hoi4_agent_tools/gui/source-graph.js +7 -0
  26. package/dist/hoi4_agent_tools/gui/tool-operations.js +23 -4
  27. package/dist/hoi4_agent_tools/gui/validators.js +31 -2
  28. package/dist/hoi4_agent_tools/ideas/inspect.js +43 -0
  29. package/dist/hoi4_agent_tools/impact/service.js +15 -0
  30. package/dist/hoi4_agent_tools/localisation/inspect.js +34 -0
  31. package/dist/hoi4_agent_tools/map/appearance-validation.js +14 -2
  32. package/dist/hoi4_agent_tools/map/geography/resolve.js +3 -2
  33. package/dist/hoi4_agent_tools/map/tool-operations.js +41 -0
  34. package/dist/hoi4_agent_tools/map/world-edge.js +117 -15
  35. package/dist/hoi4_agent_tools/map/world.js +158 -34
  36. package/dist/hoi4_agent_tools/mcp/server/argument-errors.js +59 -9
  37. package/dist/hoi4_agent_tools/mcp/server/create-modern-operations.js +1 -1
  38. package/dist/hoi4_agent_tools/mcp/server/request-lifecycle.js +1 -1
  39. package/dist/hoi4_agent_tools/mcp/tools/analysis.js +4 -2
  40. package/dist/hoi4_agent_tools/mcp/tools/event.js +15 -0
  41. package/dist/hoi4_agent_tools/mcp/tools/focus.js +1 -1
  42. package/dist/hoi4_agent_tools/mcp/tools/gui.js +1 -1
  43. package/dist/hoi4_agent_tools/mcp/tools/reference.js +43 -0
  44. package/dist/hoi4_agent_tools/probability/operations.js +27 -1
  45. package/dist/hoi4_agent_tools/probability/service.js +91 -11
  46. package/dist/hoi4_agent_tools/probability/source-analysis.js +2 -2
  47. package/dist/hoi4_agent_tools/probability/sweep.js +20 -6
  48. package/dist/hoi4_agent_tools/reference/command-phrases.json +11065 -0
  49. package/dist/hoi4_agent_tools/reference/error-log.js +59 -1
  50. package/dist/hoi4_agent_tools/reference/known-mistakes.js +8 -5
  51. package/dist/hoi4_agent_tools/reference/known-mistakes.json +4 -4
  52. package/dist/hoi4_agent_tools/reference/operations.js +205 -12
  53. package/dist/hoi4_agent_tools/reference/ranking.js +32 -0
  54. package/dist/hoi4_agent_tools/reference/script-validation.js +159 -8
  55. package/dist/hoi4_agent_tools/reference/service.js +33 -0
  56. package/dist/hoi4_agent_tools/reference/source-lookup.js +8 -0
  57. package/dist/hoi4_agent_tools/schemas/focus-requests.js +4 -0
  58. package/dist/hoi4_agent_tools/schemas/ideas.js +142 -0
  59. package/dist/hoi4_agent_tools/schemas/localisation.js +94 -0
  60. package/dist/hoi4_agent_tools/schemas/map.js +32 -4
  61. package/dist/hoi4_agent_tools/schemas/mod-tools.js +11 -0
  62. package/dist/hoi4_agent_tools/schemas/script-validation.js +8 -1
  63. package/dist/hoi4_agent_tools/schemas/system.js +157 -0
  64. package/dist/hoi4_agent_tools/system/inspect.js +55 -0
  65. package/dist/hoi4_agent_tools/version.js +1 -1
  66. package/docs/analysis.md +2 -2
  67. package/docs/events.md +1 -1
  68. package/docs/focus.md +9 -5
  69. package/docs/map.md +19 -8
  70. package/docs/research/reference-benchmark.md +41 -0
  71. package/docs/tools.md +49 -39
  72. package/docs/troubleshooting.md +13 -12
  73. package/engine/README.md +293 -0
  74. package/engine/bin/darwin-arm64/hoi4-engine +0 -0
  75. package/engine/bin/linux-arm64/hoi4-engine +0 -0
  76. package/engine/bin/linux-x64/hoi4-engine +0 -0
  77. package/engine/bin/manifest.json +26 -0
  78. package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
  79. package/npm-shrinkwrap.json +2 -2
  80. package/package.json +4 -1
  81. package/schemas/configuration.schema.json +1 -1
  82. package/schemas/continuous-focus-palette.schema.json +1 -1
  83. package/schemas/custom-weighted-pool.schema.json +1 -1
  84. package/schemas/decision-inspect-input.schema.json +1 -1
  85. package/schemas/error-log-input.schema.json +1 -1
  86. package/schemas/event-feature-manifest.schema.json +1 -1
  87. package/schemas/focus-plan.schema.json +1 -1
  88. package/schemas/focus-planning-sidecar.schema.json +1 -1
  89. package/schemas/geography-model.schema.json +1 -1
  90. package/schemas/gui-animation-source.schema.json +1 -1
  91. package/schemas/gui-helper.schema.json +1 -1
  92. package/schemas/gui-scenario.schema.json +1 -1
  93. package/schemas/helper-expansion-request.schema.json +1 -1
  94. package/schemas/helper-expansion-summary.schema.json +1 -1
  95. package/schemas/impact-inspect-input.schema.json +1 -1
  96. package/schemas/map-operation.schema.json +165 -101
  97. package/schemas/mechanic-test-input.schema.json +1 -1
  98. package/schemas/mod-index-input.schema.json +1 -1
  99. package/schemas/operation-result.schema.json +1 -1
  100. package/schemas/package-check-input.schema.json +1 -1
  101. package/schemas/package-manifest.schema.json +1 -1
  102. package/schemas/probability-analysis-result.schema.json +1 -1
  103. package/schemas/probability-compare-input.schema.json +1 -1
  104. package/schemas/probability-evaluate-input.schema.json +1 -1
  105. package/schemas/probability-inspect-input.schema.json +1 -1
  106. package/schemas/probability-render-input.schema.json +1 -1
  107. package/schemas/probability-scenario-set.schema.json +1 -1
  108. package/schemas/probability-sequence-input.schema.json +1 -1
  109. package/schemas/probability-simulate-input.schema.json +1 -1
  110. package/schemas/probability-sweep-input.schema.json +1 -1
  111. package/schemas/reference-context-input.schema.json +1 -1
  112. package/schemas/reference-read-input.schema.json +1 -1
  113. package/schemas/reference-search-input.schema.json +1 -1
  114. package/schemas/reference-sheets.schema.json +1 -1
  115. package/schemas/scenario-suite.schema.json +1 -1
  116. package/schemas/scenario-test-input.schema.json +1 -1
  117. package/schemas/script-validate-input.schema.json +1 -1
  118. package/schemas/shared-scenario.schema.json +1 -1
  119. package/schemas/source-lookup-input.schema.json +1 -1
  120. package/server.json +2 -2
@@ -21,7 +21,7 @@ import { planEconomy } from './gameplay/economy.js';
21
21
  import { prepareGameplay } from './gameplay/prepare.js';
22
22
  import { fractal, lattice } from './world-noise.js';
23
23
  import { calibratedColourMap, COLOUR_CLASSES, } from './colormap.js';
24
- import { ambientObjectText, applyEdgePolicy, assertFeaturesOutsideBand, edgeWaterDarkness, RIM_COLOUR_FACTOR, rimAdjacencyRows, rimHeight, rimStrength, } from './world-edge.js';
24
+ import { ambientObjectText, applyEdgePolicy, assertFeaturesOutsideBand, edgeWaterDarkness, hasRimRange, RIM_COLOUR_FACTOR, rimAdjacencyRows, rimHeight, rimStrength, WALL_TERRAIN_KINDS, wallRowKinds, } from './world-edge.js';
25
25
  import { landDistanceField, lakeHeight, normalizeLakes, waterColourLevel } from './water.js';
26
26
  import { overlayGeographyLakes, rasterizeGeographyKind } from './relief/land.js';
27
27
  import { checkTerrainRivers, synthesizeTerrain, } from './relief/terrain-synthesis.js';
@@ -465,6 +465,70 @@ function realmPins(realms, width, height, kind) {
465
465
  }
466
466
  return pins.map(({ pixel }) => pixel);
467
467
  }
468
+ /**
469
+ * Make the states of a `wall` edge what the base game's impassable states are: `impassable = yes`,
470
+ * linked by `force_link_ownership_to` to the nearest passable state and owned as it is, `enclave`
471
+ * where the category exists, and without infrastructure, buildings, resources, victory points,
472
+ * ports or forts. Nearest counts province steps over land and water, since a wall often stands
473
+ * in what was sea; ties go to the passable state met through most borders, then the lowest id.
474
+ */
475
+ function finishWallStates(states, neighbors, context) {
476
+ const stateOfProvince = new Map();
477
+ for (const state of states)
478
+ for (const id of state.provinces)
479
+ stateOfProvince.set(id, state);
480
+ const enclave = context.stateCategories === undefined || context.stateCategories.has('enclave');
481
+ const nearestPassable = (start) => {
482
+ const seen = new Set(start);
483
+ let frontier = [...start].sort((a, b) => a - b);
484
+ while (frontier.length > 0) {
485
+ const found = new Map();
486
+ const next = [];
487
+ for (const id of frontier)
488
+ for (const other of [...neighbors[id]].sort((a, b) => a - b)) {
489
+ const state = stateOfProvince.get(other);
490
+ if (state !== undefined && state.impassable !== true)
491
+ found.set(state.id, (found.get(state.id) ?? 0) + 1);
492
+ if (seen.has(other))
493
+ continue;
494
+ seen.add(other);
495
+ next.push(other);
496
+ }
497
+ if (found.size > 0)
498
+ return [...found].sort(([a, left], [b, right]) => right - left || a - b)[0][0];
499
+ frontier = next;
500
+ }
501
+ return undefined;
502
+ };
503
+ for (const state of states) {
504
+ if (state.impassable !== true)
505
+ continue;
506
+ const link = nearestPassable(state.provinces);
507
+ if (link === undefined) {
508
+ delete state.link;
509
+ delete state.owner;
510
+ }
511
+ else {
512
+ state.link = link;
513
+ const owner = states[link - 1].owner;
514
+ if (owner === undefined)
515
+ delete state.owner;
516
+ else
517
+ state.owner = owner;
518
+ }
519
+ if (enclave)
520
+ state.category = 'enclave';
521
+ state.infrastructure = 0;
522
+ state.civilian = 0;
523
+ state.military = 0;
524
+ state.dockyard = 0;
525
+ state.airBase = 0;
526
+ state.resources = new Map();
527
+ state.victoryPoints = new Map();
528
+ state.navalBases = new Map();
529
+ state.forts = new Map();
530
+ }
531
+ }
468
532
  export function generateWorld(spec, context, options = {}) {
469
533
  const { width, height } = spec;
470
534
  if (width % 256 !== 0 || height % 256 !== 0)
@@ -507,10 +571,12 @@ export function generateWorld(spec, context, options = {}) {
507
571
  };
508
572
  const notes = [];
509
573
  const edge = spec.edge ?? { mode: 'none', bandPx: 0, polarPx: 0, rimPx: 0 };
574
+ let wallMask;
510
575
  if (edge.mode !== 'none') {
511
576
  assertFeaturesOutsideBand(edge, width, height, (spec.referenceCities ?? []).map(({ name, x, y }) => ({ name, x, y, kind: 'city' })));
512
577
  const applied = applyEdgePolicy(surface.kind, surface.elevation, width, height, edge, spec.seed, Math.max(40, Math.round(spec.landProvincePixels / 4)));
513
578
  notes.push(...applied.notes.map((note) => note));
579
+ wallMask = applied.wall;
514
580
  }
515
581
  // Lakes need a minimum size and may not touch the open sea (ADR 0053).
516
582
  for (const note of normalizeLakes(surface.kind, surface.elevation, width, height))
@@ -555,7 +621,7 @@ export function generateWorld(spec, context, options = {}) {
555
621
  kind: surface.kind,
556
622
  relief: spec.relief,
557
623
  rivers: { density: spec.riverDensity, count: spec.riverCount },
558
- adjustHeight: edge.mode === 'rim'
624
+ adjustHeight: hasRimRange(edge)
559
625
  ? (x, _y, value) => rimHeight(value, rimStrength(edge, width, x))
560
626
  : undefined,
561
627
  signal: options.signal,
@@ -616,7 +682,7 @@ export function generateWorld(spec, context, options = {}) {
616
682
  kind: surface.kind,
617
683
  relief: spec.relief,
618
684
  rivers: { density: spec.riverDensity, count: spec.riverCount },
619
- adjustHeight: edge.mode === 'rim'
685
+ adjustHeight: hasRimRange(edge)
620
686
  ? (x, _y, value) => rimHeight(value, rimStrength(edge, width, x))
621
687
  : undefined,
622
688
  signal: options.signal,
@@ -773,6 +839,17 @@ export function generateWorld(spec, context, options = {}) {
773
839
  const landIds = [...Array(count).keys()].filter((id) => provinces.kind[id] === LAND);
774
840
  const seaIds = [...Array(count).keys()].filter((id) => provinces.kind[id] === SEA);
775
841
  const lakeIds = [...Array(count).keys()].filter((id) => provinces.kind[id] === LAKE);
842
+ // A land province with most of its pixels in the wall belongs to the wall's impassable states.
843
+ const wallProvinces = new Set();
844
+ if (wallMask !== undefined) {
845
+ const inWall = new Uint32Array(count);
846
+ for (let pixel = 0; pixel < wallMask.length; pixel += 1)
847
+ if (wallMask[pixel] === 1)
848
+ inWall[provinces.pixel[pixel]] += 1;
849
+ for (const id of landIds)
850
+ if (inWall[id] * 2 > provinces.size[id])
851
+ wallProvinces.add(id);
852
+ }
776
853
  if (landIds.length < spec.countries.length)
777
854
  throw new ServiceError('MAP_WORLD_LAND_TOO_SMALL', 'The generated land has fewer provinces than countries; raise landCoverage or lower landProvincePixels', { landProvinces: landIds.length, countries: spec.countries.length });
778
855
  const coastal = (id) => [...provinces.neighbors[id]].some((other) => provinces.kind[id] === SEA
@@ -997,7 +1074,9 @@ export function generateWorld(spec, context, options = {}) {
997
1074
  };
998
1075
  });
999
1076
  const capitals = [];
1000
- const largest = [...landIds].sort((left, right) => provinces.size[right] - provinces.size[left] || left - right);
1077
+ const largest = landIds
1078
+ .filter((id) => !wallProvinces.has(id))
1079
+ .sort((left, right) => provinces.size[right] - provinces.size[left] || left - right);
1001
1080
  const realmRules = spec.realms === undefined
1002
1081
  ? undefined
1003
1082
  : resolveRealmRules(spec.realms, {
@@ -1007,8 +1086,15 @@ export function generateWorld(spec, context, options = {}) {
1007
1086
  provinceSize: provinces.size,
1008
1087
  isLand: (id) => provinces.kind[id] === LAND,
1009
1088
  });
1010
- if (realmRules !== undefined)
1089
+ if (realmRules !== undefined) {
1090
+ const walled = realmRules.capitals.flatMap((id, index) => wallProvinces.has(id) ? [{ tag: spec.countries[index]?.tag, ...center(id) }] : []);
1091
+ if (walled.length > 0)
1092
+ throw new ServiceError('MAP_EDGE_FEATURE_IN_BAND', `${walled.length} capital(s) stand in the impassable wall at the seam: ${walled
1093
+ .slice(0, 5)
1094
+ .map(({ tag, x, y }) => `${tag ?? '?'} (${Math.round(x)}, ${Math.round(y)})`)
1095
+ .join('; ')}. Move them inland or narrow edge.rimPx.`, { mode: edge.mode, rimPx: edge.rimPx, capitals: walled.slice(0, 20) });
1011
1096
  capitals.push(...realmRules.capitals);
1097
+ }
1012
1098
  while (capitals.length < countryCount) {
1013
1099
  const countryIndex = capitals.length;
1014
1100
  const regionCandidates = largest.filter((id) => referenceOwners.get(id) === countryIndex && !capitals.includes(id));
@@ -1031,7 +1117,7 @@ export function generateWorld(spec, context, options = {}) {
1031
1117
  let best = -1;
1032
1118
  let bestDistance = -1;
1033
1119
  for (const id of landIds) {
1034
- if (capitals.includes(id))
1120
+ if (capitals.includes(id) || wallProvinces.has(id))
1035
1121
  continue;
1036
1122
  const c = center(id);
1037
1123
  const distance = Math.min(...capitals.map((other) => Math.hypot(center(other).x - c.x, center(other).y - c.y)));
@@ -1144,7 +1230,7 @@ export function generateWorld(spec, context, options = {}) {
1144
1230
  // States: within each region and country, clusters of about provincesPerState.
1145
1231
  const groups = new Map();
1146
1232
  for (const id of landIds) {
1147
- const key = `${regionOf.get(id)}:${owner.get(id) ?? -1}`;
1233
+ const key = `${regionOf.get(id)}:${owner.get(id) ?? -1}${wallProvinces.has(id) ? ':wall' : ''}`;
1148
1234
  const list = groups.get(key) ?? [];
1149
1235
  list.push(id);
1150
1236
  groups.set(key, list);
@@ -1182,6 +1268,7 @@ export function generateWorld(spec, context, options = {}) {
1182
1268
  victoryPoints: new Map(),
1183
1269
  navalBases: new Map(),
1184
1270
  forts: new Map(),
1271
+ ...(key.endsWith(':wall') ? { impassable: true } : {}),
1185
1272
  };
1186
1273
  states.push(draft);
1187
1274
  for (const id of sorted)
@@ -1370,6 +1457,7 @@ export function generateWorld(spec, context, options = {}) {
1370
1457
  if (stateOf.get(id).navalBases.has(id))
1371
1458
  hasPort = true;
1372
1459
  if (coastal(id) &&
1460
+ !wallProvinces.has(id) &&
1373
1461
  (bestCoast === undefined || provinces.size[id] > provinces.size[bestCoast]))
1374
1462
  bestCoast = id;
1375
1463
  for (const next of provinces.neighbors[id])
@@ -1384,6 +1472,8 @@ export function generateWorld(spec, context, options = {}) {
1384
1472
  stateOf.get(bestCoast).navalBases.set(bestCoast, 1);
1385
1473
  }
1386
1474
  }
1475
+ if (wallProvinces.size > 0)
1476
+ finishWallStates(states, provinces.neighbors, context);
1387
1477
  // Province IDs: 1-based in reading order of the province's first pixel; 0 is the null row.
1388
1478
  const provinceId = (index) => index + 1;
1389
1479
  // Unique colours, never black.
@@ -1435,7 +1525,7 @@ export function generateWorld(spec, context, options = {}) {
1435
1525
  '',
1436
1526
  ].join('\n')));
1437
1527
  add(`${map}/continent.txt`, text(`continents = {\n${[...new Set([...continentNames.map((_, index) => `world_continent_${index + 1}`), ...(context.continentKeys ?? [])])].map((key) => `\t${key}`).join('\n')}\n}\n`));
1438
- const rimRows = edge.mode === 'rim'
1528
+ const rimRows = hasRimRange(edge)
1439
1529
  ? rimAdjacencyRows({
1440
1530
  provincePixels: provinces.pixel,
1441
1531
  provinceKinds: provinces.kind,
@@ -1447,7 +1537,7 @@ export function generateWorld(spec, context, options = {}) {
1447
1537
  notes.push({
1448
1538
  code: 'MAP_EDGE_RIM_ADJACENCIES',
1449
1539
  severity: 'info',
1450
- message: `The rim edge policy wrote ${rimRows.length} impassable adjacency row(s) for provinces that meet across the seam`,
1540
+ message: `The ${edge.mode} edge policy wrote ${rimRows.length} impassable adjacency row(s) for provinces that meet across the seam`,
1451
1541
  details: { rows: rimRows.length },
1452
1542
  });
1453
1543
  const crossingRows = (gameplay?.crossings.rows ?? []).map(adjacencyRowText);
@@ -1531,34 +1621,62 @@ export function generateWorld(spec, context, options = {}) {
1531
1621
  Math.abs(heights[Math.min(height - 1, y + 1) * width + x] -
1532
1622
  heights[Math.max(0, y - 1) * width + x]) <=
1533
1623
  2;
1624
+ const snowAt = (pixel, type) => synthesized !== undefined
1625
+ ? (synthesized.snow[pixel] === 1 || reference?.terrain[pixel] === 4) &&
1626
+ surface.kind[pixel] === LAND
1627
+ : reference === undefined
1628
+ ? type === 'mountain' && latitude(provinces.pixel[pixel]) > 0.7
1629
+ : reference.terrain[pixel] === 4 && surface.kind[pixel] === LAND;
1630
+ // A wall takes the look of the land it meets, row by row on each side.
1631
+ const wallLook = wallMask === undefined
1632
+ ? undefined
1633
+ : wallRowKinds({
1634
+ edge,
1635
+ width,
1636
+ height,
1637
+ wall: wallMask,
1638
+ landKind: (pixel) => {
1639
+ if (surface.kind[pixel] !== LAND)
1640
+ return undefined;
1641
+ const type = visualTerrain(pixel);
1642
+ if (snowAt(pixel, type))
1643
+ return 'snow';
1644
+ return WALL_TERRAIN_KINDS.includes(type)
1645
+ ? type
1646
+ : 'plains';
1647
+ },
1648
+ });
1534
1649
  for (let pixel = 0; pixel < width * height; pixel += 1) {
1535
- const id = provinces.pixel[pixel];
1536
1650
  const type = visualTerrain(pixel);
1537
- const snowy = synthesized !== undefined
1538
- ? (synthesized.snow[pixel] === 1 || reference?.terrain[pixel] === 4) &&
1539
- surface.kind[pixel] === LAND
1540
- : reference === undefined
1541
- ? type === 'mountain' && latitude(id) > 0.7
1542
- : reference.terrain[pixel] === 4 && surface.kind[pixel] === LAND;
1651
+ const snowy = snowAt(pixel, type);
1543
1652
  const x = pixel % width;
1544
- const rimmed = rimStrength(edge, width, x) > 0.35 && surface.kind[pixel] === LAND;
1545
- let index = snowy
1546
- ? reference === undefined
1547
- ? 16
1548
- : 19
1549
- : rimmed
1653
+ const walled = wallLook === undefined || wallMask[pixel] !== 1 || surface.kind[pixel] !== LAND
1654
+ ? undefined
1655
+ : (x < width / 2 ? wallLook.west : wallLook.east)[(pixel - x) / width];
1656
+ const rimmed = walled === undefined &&
1657
+ wallLook === undefined &&
1658
+ rimStrength(edge, width, x) > 0.35 &&
1659
+ surface.kind[pixel] === LAND;
1660
+ let index = walled !== undefined
1661
+ ? walled === 'snow'
1550
1662
  ? 16
1551
- : type === 'lakes'
1552
- ? lakeIndex
1553
- : (terrainIndex.get(type) ?? DEFAULT_TERRAIN_INDEX.get(type) ?? 0);
1554
- let colour = type === 'lakes' || type === 'ocean' || type === 'urban'
1555
- ? type === 'urban'
1556
- ? 'urban'
1557
- : type
1558
- : snowy || rimmed
1559
- ? 'snow'
1560
- : type;
1561
- if (calibrated && !snowy && !rimmed && surface.kind[pixel] === LAND) {
1663
+ : (terrainIndex.get(walled) ?? DEFAULT_TERRAIN_INDEX.get(walled) ?? 0)
1664
+ : snowy
1665
+ ? reference === undefined
1666
+ ? 16
1667
+ : 19
1668
+ : rimmed
1669
+ ? 16
1670
+ : type === 'lakes'
1671
+ ? lakeIndex
1672
+ : (terrainIndex.get(type) ?? DEFAULT_TERRAIN_INDEX.get(type) ?? 0);
1673
+ let colour = walled ??
1674
+ (type === 'lakes' || type === 'ocean' || type === 'urban'
1675
+ ? type
1676
+ : snowy || rimmed
1677
+ ? 'snow'
1678
+ : type);
1679
+ if (calibrated && walled === undefined && !snowy && !rimmed && surface.kind[pixel] === LAND) {
1562
1680
  // Variant graphical terrains by rule, so one class is not one flat texture.
1563
1681
  const y = (pixel - x) / width;
1564
1682
  if (type === 'plains' &&
@@ -1732,7 +1850,7 @@ export function generateWorld(spec, context, options = {}) {
1732
1850
  colormap[offset + 3] = cityPixels[source] === 15 ? 200 : 0;
1733
1851
  }
1734
1852
  }
1735
- if (edge.mode === 'rim')
1853
+ if (hasRimRange(edge))
1736
1854
  for (let y = 0; y < halfHeight; y += 1)
1737
1855
  for (let x = 0; x < halfWidth; x += 1) {
1738
1856
  const strength = rimStrength(edge, width, x * 2);
@@ -1809,6 +1927,12 @@ export function generateWorld(spec, context, options = {}) {
1809
1927
  `\tid = ${state.id}`,
1810
1928
  `\tname = "STATE_${state.id}"`,
1811
1929
  `\tmanpower = ${state.manpower}`,
1930
+ ...(state.impassable === true
1931
+ ? [
1932
+ '\timpassable = yes',
1933
+ ...(state.link === undefined ? [] : [`\tforce_link_ownership_to = ${state.link}`]),
1934
+ ]
1935
+ : []),
1812
1936
  `\tstate_category = ${state.category}`,
1813
1937
  ...(resources.length === 0
1814
1938
  ? []
@@ -13,6 +13,11 @@ export const ARGUMENT_EXAMPLES = {
13
13
  'hoi4.script_validate': '{"path":"events/my_events.txt"} or {"source":"add_political_power = 10","kind":"effect","scope":"country"}',
14
14
  'hoi4.error_log': '{"scope":"mod","category":"effect"}',
15
15
  'hoi4.mod_index': '{"mode":"overview"} or {"mode":"next_id","kind":"event","namespace":"my_mod"}',
16
+ 'hoi4.localisation_inspect': '{"mode":"key","key":"my_event.1.t"} or {"mode":"audit"}',
17
+ 'hoi4.idea_inspect': '{"kind":"idea","id":"my_idea"} or {"kind":"character","audit":true}',
18
+ 'hoi4.system_inspect': '{"kind":"mio","id":"my_organization"} or {"kind":"on_actions","audit":true}',
19
+ 'hoi4.unit_inspect': '{"kind":"oob","id":"GER_1936"} or {"kind":"variant","audit":true}',
20
+ 'hoi4.asset_inspect': '{"kind":"sprite","id":"GFX_my_icon"} or {"kind":"flag","audit":true}',
16
21
  'hoi4.event_inspect': '{"mode":"lint","selector":"chaosx.nr14"} or {"mode":"trace","selector":"chaosx.nr14.1","direction":"downstream"}',
17
22
  'hoi4.event_render': '{"view":"overview","selector":"chaosx.nr14"}',
18
23
  'hoi4.focus_inspect': '{"treeId":"my_focus_tree"}',
@@ -20,7 +25,7 @@ export const ARGUMENT_EXAMPLES = {
20
25
  'hoi4.focus_rewrite': '{"relativePath":"common/national_focus/my_tree.txt","treeId":"my_focus_tree","layoutMode":"compact"}',
21
26
  'hoi4.gui_inspect': '{"windowName":"my_window"}',
22
27
  'hoi4.gui_render': '{"windowName":"my_window","scenario":{"id":"normal"}}',
23
- 'hoi4.gui_rewrite': '{"mode":"patches","relativePath":"interface/my_window.gui","windowName":"my_window","scenario":{"id":"normal"},"expectedSourceHash":"<sha256 of the file>","patches":[{"start":120,"end":130,"expectedText":"x = 10 y","text":"x = 40 y"}]}',
28
+ 'hoi4.gui_rewrite': '{"mode":"patches","relativePath":"interface/my_window.gui","windowName":"my_window","scenario":{"id":"normal"},"expectedSourceHash":"<sha256 of the file>","patches":[{"description":"Move the button right","start":120,"end":130,"expectedText":"x = 10 y","text":"x = 40 y"}]}',
24
29
  'hoi4.map_inspect': '{"query":"Brandenburg","lookupOnly":true} or {"layer":"state","tile":{"x":2600,"y":500,"width":256,"height":256}}',
25
30
  'hoi4.map_rewrite': '{"operations":[{"id":"new-state","kind":"create_state","provinceIds":[120,121],"displayName":"New State"}]}',
26
31
  'hoi4.tech_inspect': '{"mode":"scan"} or {"mode":"explain","technologyId":"my_tech"} or {"mode":"lint"}',
@@ -35,11 +40,56 @@ export const ARGUMENT_EXAMPLES = {
35
40
  'hoi4.job_inspect': '{"jobId":"job_<64 hex characters from a native task id>"}',
36
41
  'hoi4.job_cancel': '{"jobId":"job_<64 hex characters from a native task id>"}',
37
42
  };
38
- function describeIssue(issue) {
43
+ function defOf(schema) {
44
+ return schema?._zod?.def;
45
+ }
46
+ /**
47
+ * The fields the object at a path accepts, so an unknown field names the expected shape (#65).
48
+ * Wrappers are unwrapped and the fields of every union alternative are listed.
49
+ */
50
+ export function acceptedFields(schema, path, depth = 0) {
51
+ const def = defOf(schema);
52
+ if (def === undefined || depth > 32)
53
+ return [];
54
+ switch (def.type) {
55
+ case 'optional':
56
+ case 'nullable':
57
+ case 'default':
58
+ case 'prefault':
59
+ case 'readonly':
60
+ case 'catch':
61
+ case 'nonoptional':
62
+ return acceptedFields(def.innerType, path, depth + 1);
63
+ case 'pipe': {
64
+ // A preprocess step pipes from an unknown or a transform; then out checks the fields.
65
+ const fromInput = acceptedFields(def.in, path, depth + 1);
66
+ return fromInput.length > 0 ? fromInput : acceptedFields(def.out, path, depth + 1);
67
+ }
68
+ case 'union':
69
+ return [
70
+ ...new Set((def.options ?? []).flatMap((option) => acceptedFields(option, path, depth + 1))),
71
+ ];
72
+ case 'array':
73
+ return typeof path[0] === 'number'
74
+ ? acceptedFields(def.element, path.slice(1), depth + 1)
75
+ : [];
76
+ case 'record':
77
+ return path.length === 0 ? [] : acceptedFields(def.valueType, path.slice(1), depth + 1);
78
+ case 'object':
79
+ if (path.length === 0)
80
+ return Object.keys(def.shape ?? {});
81
+ return acceptedFields(def.shape?.[String(path[0])], path.slice(1), depth + 1);
82
+ default:
83
+ return [];
84
+ }
85
+ }
86
+ function describeIssue(issue, schema) {
39
87
  const field = issue.path.length === 0 ? '(arguments)' : issue.path.map(String).join('.');
40
88
  let problem = issue.message;
41
- if (issue.code === 'unrecognized_keys')
42
- problem = `unknown field${issue.keys.length === 1 ? '' : 's'} ${issue.keys.join(', ')}`;
89
+ if (issue.code === 'unrecognized_keys') {
90
+ const accepted = acceptedFields(schema, issue.path);
91
+ problem = `unknown field${issue.keys.length === 1 ? '' : 's'} ${issue.keys.join(', ')}${accepted.length === 0 ? '' : `; accepted fields: ${accepted.join(', ')}`}`;
92
+ }
43
93
  else if (issue.code === 'invalid_value')
44
94
  problem = `expected one of ${issue.values.map((value) => JSON.stringify(value)).join(', ')}`;
45
95
  else if (issue.code === 'invalid_union') {
@@ -47,14 +97,14 @@ function describeIssue(issue) {
47
97
  const closest = [...issue.errors].sort((left, right) => left.length - right.length)[0];
48
98
  const first = closest?.[0];
49
99
  if (first !== undefined) {
50
- const nested = describeIssue(first);
100
+ const nested = describeIssue(first, schema);
51
101
  problem = `${issue.message}; closest form: ${nested.field === '(arguments)' ? '' : `${nested.field}: `}${nested.problem}`;
52
102
  }
53
103
  }
54
104
  return { field, problem: problem.slice(0, 300) };
55
105
  }
56
- export function invalidArgumentsError(toolName, error) {
57
- const issues = error.issues.slice(0, 6).map(describeIssue);
106
+ export function invalidArgumentsError(toolName, error, schema) {
107
+ const issues = error.issues.slice(0, 6).map((issue) => describeIssue(issue, schema));
58
108
  const example = ARGUMENT_EXAMPLES[toolName];
59
109
  const message = [
60
110
  `Invalid arguments for ${toolName}: ${issues.map(({ field, problem }) => `${field}: ${problem}`).join('; ')}.`,
@@ -67,6 +117,6 @@ export function invalidArgumentsError(toolName, error) {
67
117
  ...(example === undefined ? {} : { example }),
68
118
  });
69
119
  }
70
- export function invalidArgumentsResult(toolName, error, workspaceId) {
71
- return errorResult(invalidArgumentsError(toolName, error), typeof workspaceId === 'string' ? workspaceId : 'current');
120
+ export function invalidArgumentsResult(toolName, error, workspaceId, schema) {
121
+ return errorResult(invalidArgumentsError(toolName, error, schema), typeof workspaceId === 'string' ? workspaceId : 'current');
72
122
  }
@@ -101,7 +101,7 @@ export function createModernOperationServer(engine, context = {}, tasks = new Op
101
101
  const workspaceId = request.params.arguments
102
102
  ?.workspaceId;
103
103
  return CallToolResultSchema.parse({
104
- ...invalidArgumentsResult(definition.name, input.error, workspaceId),
104
+ ...invalidArgumentsResult(definition.name, input.error, workspaceId, definition.inputSchema),
105
105
  resultType: 'complete',
106
106
  ttlMs: 0,
107
107
  cacheScope: 'private',
@@ -34,7 +34,7 @@ export function installRequestLifecycle(server, engine) {
34
34
  const schema = params.task === undefined ? inputSchema(params.name) : undefined;
35
35
  const parsed = schema?.safeParse(params.arguments ?? {});
36
36
  if (parsed !== undefined && !parsed.success)
37
- return Promise.resolve(invalidArgumentsResult(params.name, parsed.error, params.arguments?.workspaceId));
37
+ return Promise.resolve(invalidArgumentsResult(params.name, parsed.error, params.arguments?.workspaceId, schema));
38
38
  }
39
39
  const progress = progressReporter(extra);
40
40
  const taskCall = CallToolRequestSchema.safeParse(request);
@@ -37,6 +37,8 @@ const decisionOutputSchema = strictOperationResultSchema(z
37
37
  overrides: nonNegativeIntegerSchema,
38
38
  scenarios: nonNegativeIntegerSchema,
39
39
  unresolvedDefinitions: nonNegativeIntegerSchema,
40
+ decisionIds: z.array(z.string()).max(64).optional(),
41
+ decisionIdsTruncated: z.boolean().optional(),
40
42
  unresolvedSample: z
41
43
  .array(z.object({ id: z.string(), path: z.string(), reason: z.string() }).strict())
42
44
  .max(8)
@@ -141,7 +143,7 @@ export const analysisTaskTools = [
141
143
  {
142
144
  name: 'hoi4.decision_inspect',
143
145
  title: 'Inspect decisions and missions',
144
- description: 'Explain why a decision or mission is hidden, unavailable or unaffordable. Inspect conditions, costs and lifecycle for declared actors and targets, or compare proposed source. Example: {"mode":"inspect","id":"my_decision","scenarios":[{"id":"base","actor":"GER","state":{}}]}. Returns each scenario outcome inline; full evidence is linked.',
146
+ description: 'Explain why a decision or mission is hidden, unavailable or unaffordable. Inspect conditions, costs and lifecycle for declared actors and targets, or compare proposed source. Example: {"mode":"inspect","id":"my_decision","scenarios":[{"id":"base","actor":"GER","state":{}}]}. Inventory mode with an id lists only that category\'s decisions, or that one decision. Returns each scenario outcome inline; full evidence is linked.',
145
147
  inputSchema: decisionInspectRequestSchema,
146
148
  outputSchema: decisionOutputSchema,
147
149
  annotations: readOnlyAnalysisTool,
@@ -149,7 +151,7 @@ export const analysisTaskTools = [
149
151
  {
150
152
  name: 'hoi4.mechanic_test',
151
153
  title: 'Test scripted effects',
152
- description: 'Test what an effect, event option, decision or focus reward does to a declared state. Run steps and check assertions; unsupported effects stay unresolved. See docs/mechanics.md. Example: {"test":{"id":"t","scenario":{"schemaVersion":"1.0","id":"t","state":{"treasury":10}},"steps":[...],"assertions":[...]}}.',
154
+ description: 'Test what an effect, option, decision or focus reward does to a declared state (docs/mechanics.md). Example: {"test":{"id":"t","scenario":{"schemaVersion":"1.0","id":"t","state":{}},"steps":[{"kind":"effect","source":{"kind":"scripted_effect","id":"e"}}],"assertions":[{"id":"a","kind":"conservation","paths":[{"key":"x"},{"key":"y"}]}]}}.',
153
155
  inputSchema: mechanicInputSchema,
154
156
  outputSchema: mechanicOutputSchema,
155
157
  annotations: readOnlyAnalysisTool,
@@ -104,11 +104,26 @@ const eventInspectSummarySchema = z
104
104
  edges: nonNegativeIntegerSchema,
105
105
  events: nonNegativeIntegerSchema,
106
106
  eventIds: inlineIdsSchema,
107
+ entryPoints: inlineIdsSchema,
108
+ helpers: inlineIdsSchema,
107
109
  boundaryNodes: nonNegativeIntegerSchema,
108
110
  truncated: z.boolean(),
109
111
  })
110
112
  .strict()
111
113
  .optional(),
114
+ flow: z
115
+ .object({
116
+ subject: z.string().max(1024),
117
+ producers: nonNegativeIntegerSchema,
118
+ consumers: nonNegativeIntegerSchema,
119
+ clears: nonNegativeIntegerSchema,
120
+ links: nonNegativeIntegerSchema,
121
+ unproducedReads: nonNegativeIntegerSchema,
122
+ producedAt: z.array(z.string().max(1100)).max(8),
123
+ readAt: z.array(z.string().max(1100)).max(8),
124
+ })
125
+ .strict()
126
+ .optional(),
112
127
  entryPoints: nonNegativeIntegerSchema.optional(),
113
128
  entryKinds: countMapSchema.optional(),
114
129
  automaticEvents: nonNegativeIntegerSchema.optional(),
@@ -71,7 +71,7 @@ const focusRenderOutputSchema = strictOperationResultSchema(z.discriminatedUnion
71
71
  inlineImages: z
72
72
  .array(z
73
73
  .object({
74
- kind: z.enum(['overview', 'branch', 'focus', 'problem']),
74
+ kind: z.enum(['overview', 'branch', 'focus', 'problem', 'game']),
75
75
  label: z.string().max(300),
76
76
  focusIds: z.array(z.string().max(256)).max(50),
77
77
  region: z
@@ -88,7 +88,7 @@ export const guiTaskTools = [
88
88
  {
89
89
  name: 'hoi4.gui_rewrite',
90
90
  title: 'Create or edit a window',
91
- description: 'Create or edit a window using complete source, structured helpers or exact patches. Include related text files with additionalFiles; binary art must already be in the mod. Example: {"mode":"helpers","relativePath":"interface/my_window.gui","windowName":"my_window","scenario":{"id":"normal"},"helper":{...}}. Returns the changed files.',
91
+ description: 'Create or edit a window from complete source, structured helpers or exact patches. Add related text files in additionalFiles; binary art must already be in the mod. Example: {"mode":"helpers","relativePath":"interface/my_window.gui","windowName":"my_window","scenario":{"id":"normal"},"helper":{"root":{"id":"w","kind":"column","name":"my_window"}}}.',
92
92
  inputSchema: guiRewriteRequestSchema,
93
93
  outputSchema: guiPlanOutputSchema,
94
94
  annotations: {
@@ -1,6 +1,9 @@
1
1
  import { errorResult, strictOperationResultSchema } from '../../core/operation-result.js';
2
2
  import { ReferenceToolService } from '../../reference/operations.js';
3
3
  import { referenceContextRequestSchema, referenceReadRequestSchema, referenceSearchRequestSchema, sourceLookupRequestSchema, referenceContextDataSchema, referenceReadDataSchema, referenceSearchDataSchema, sourceLookupDataSchema, } from '../../schemas/reference.js';
4
+ import { localisationInspectDataSchema, localisationInspectRequestSchema, } from '../../schemas/localisation.js';
5
+ import { systemInspectDataSchema, systemInspectRequestSchema, unitInspectDataSchema, unitInspectRequestSchema, assetInspectDataSchema, assetInspectRequestSchema, } from '../../schemas/system.js';
6
+ import { ideaInspectDataSchema, ideaInspectRequestSchema } from '../../schemas/ideas.js';
4
7
  import { errorLogDataSchema, errorLogRequestSchema, modIndexDataSchema, modIndexRequestSchema, } from '../../schemas/mod-tools.js';
5
8
  import { scriptValidateDataSchema, scriptValidateRequestSchema, } from '../../schemas/script-validation.js';
6
9
  const readOnly = {
@@ -66,6 +69,46 @@ export const referenceTools = [
66
69
  outputSchema: strictOperationResultSchema(modIndexDataSchema),
67
70
  annotations: readOnly,
68
71
  },
72
+ {
73
+ name: 'hoi4.localisation_inspect',
74
+ title: 'Check localisation in every language',
75
+ description: 'Read localisation in every language the game and mod ship. key: one key per language with file, line and layer, the languages lacking it and the files mentioning it. audit: keys the mod uses that no language defines, keys missing from a supported language, keys defined twice in one language, and file problems. coverage: keys per language. Example: {"mode":"key","key":"my_event.1.t"} or {"mode":"audit"}. Returns counts per problem and a few examples of each.',
76
+ inputSchema: localisationInspectRequestSchema,
77
+ outputSchema: strictOperationResultSchema(localisationInspectDataSchema),
78
+ annotations: readOnly,
79
+ },
80
+ {
81
+ name: 'hoi4.idea_inspect',
82
+ title: 'Inspect ideas and characters',
83
+ description: 'Read an idea or character across the game, DLC and mod. idea: category, picture sprite and texture, modifiers checked against the game docs, conditions, name in every language, the advisor it belongs to, and files mentioning it. character: name, roles with traits checked, portraits checked. audit: true checks every idea or character of the mod. Example: {"kind":"idea","id":"GER_mefo_bills_1"} or {"kind":"character","audit":true}.',
84
+ inputSchema: ideaInspectRequestSchema,
85
+ outputSchema: strictOperationResultSchema(ideaInspectDataSchema),
86
+ annotations: readOnly,
87
+ },
88
+ {
89
+ name: 'hoi4.system_inspect',
90
+ title: 'Check newer game systems',
91
+ description: 'Read one definition of a newer system, or audit every one the mod makes: on_actions hooks, MIOs and policies, balance of power, special projects, operations and raids. Returns its parts, each reference with whether it exists, pictures, names in every language and problems. Example: {"kind":"mio","id":"my_organization"} or {"kind":"on_actions","audit":true}.',
92
+ inputSchema: systemInspectRequestSchema,
93
+ outputSchema: strictOperationResultSchema(systemInspectDataSchema),
94
+ annotations: readOnly,
95
+ },
96
+ {
97
+ name: 'hoi4.unit_inspect',
98
+ title: 'Check units and equipment',
99
+ description: 'Read one order of battle (history/units), sub-unit, equipment or module, or equipment variant, or audit every one the mod makes. Checks template grids, divisions, fleets, air wings, equipment slots and modules, and each name they use. Example: {"kind":"oob","id":"GER_1936"} or {"kind":"variant","audit":true}.',
100
+ inputSchema: unitInspectRequestSchema,
101
+ outputSchema: strictOperationResultSchema(unitInspectDataSchema),
102
+ annotations: readOnly,
103
+ },
104
+ {
105
+ name: 'hoi4.asset_inspect',
106
+ title: 'Check sprites, sounds and flags',
107
+ description: 'Read one sprite (texture size, format and frames), sound, sound effect or music track (audio file, sounds it plays), or flag (all three sizes), or audit every one the mod defines. Flags BC7 textures, missing files and wrong flag sizes. Example: {"kind":"sprite","id":"GFX_my_icon"} or {"kind":"flag","audit":true}.',
108
+ inputSchema: assetInspectRequestSchema,
109
+ outputSchema: strictOperationResultSchema(assetInspectDataSchema),
110
+ annotations: readOnly,
111
+ },
69
112
  ];
70
113
  export function registerReferenceTools(server, engine, context) {
71
114
  const service = new ReferenceToolService(engine);
@@ -185,11 +185,26 @@ export async function inspectProbabilities(analyzer, input, context) {
185
185
  let inspected = await analyzer.inspect(runtime(context, input.refresh), input.adapter, source, candidatePool, customPoolManifest);
186
186
  // A wrong adapter guess, such as a mission named as a decision, should not cost another call.
187
187
  const suggested = inspected.discovery?.suggestedAdapter;
188
+ // Without an adapter, an identifier or pool that names weighted blocks picks its own adapter:
189
+ // an event id evaluates its options rather than returning the whole source inventory.
190
+ const namedBySource = input.adapter === undefined &&
191
+ inspected.discovery?.reason === 'source_inventory' &&
192
+ inspected.discovery.availableAdapters.some(({ adapterId, identifierMatchCount, candidatePoolMatchCount }) => adapterId === suggested && (identifierMatchCount > 0 || candidatePoolMatchCount > 0)) &&
193
+ (source?.identifier !== undefined || candidatePool.length > 0);
194
+ const alternatives = namedBySource
195
+ ? inspected
196
+ .discovery.availableAdapters.filter(({ adapterId, identifierMatchCount, candidatePoolMatchCount }) => adapterId !== suggested &&
197
+ (source?.identifier === undefined
198
+ ? candidatePoolMatchCount > 0
199
+ : identifierMatchCount > 0))
200
+ .map(({ adapterId }) => adapterId)
201
+ : [];
188
202
  if (input.evaluate !== false &&
189
203
  inspected.surface === undefined &&
190
204
  suggested !== undefined &&
191
205
  suggested !== input.adapter &&
192
- (inspected.discovery?.reason === 'candidate_pool_not_found' ||
206
+ (namedBySource ||
207
+ inspected.discovery?.reason === 'candidate_pool_not_found' ||
193
208
  inspected.discovery?.reason === 'requested_adapter_empty' ||
194
209
  inspected.discovery?.reason === 'identifier_not_found'))
195
210
  inspected = await analyzer.inspect(runtime(context), suggested, source, candidatePool, customPoolManifest);
@@ -221,6 +236,17 @@ export async function inspectProbabilities(analyzer, input, context) {
221
236
  });
222
237
  const result = probabilityAnalysisServiceResult(context.workspaceId, analyzed);
223
238
  result.artifacts = [...result.artifacts, ...inspected.artifacts];
239
+ if (namedBySource && alternatives.length > 0)
240
+ result.diagnostics = [
241
+ {
242
+ code: 'PROBABILITY_ADAPTER_SELECTED',
243
+ severity: 'info',
244
+ category: 'configuration',
245
+ message: `No adapter was requested, so ${surface.adapter.id} was used; pass adapter to evaluate ${alternatives.join(', ')} instead`,
246
+ details: { adapterId: surface.adapter.id, alternatives },
247
+ },
248
+ ...result.diagnostics,
249
+ ];
224
250
  if (input.scenarioSet === undefined)
225
251
  result.diagnostics = [
226
252
  {