hoi4-agent-tools 4.8.0 → 4.10.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 (93) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/hoi4_agent_tools/core/index.js +28 -0
  3. package/dist/hoi4_agent_tools/decision/service.js +39 -2
  4. package/dist/hoi4_agent_tools/event/graph.js +16 -2
  5. package/dist/hoi4_agent_tools/event/queries.js +25 -2
  6. package/dist/hoi4_agent_tools/event/service.js +66 -11
  7. package/dist/hoi4_agent_tools/event/source-analysis.js +35 -16
  8. package/dist/hoi4_agent_tools/impact/service.js +15 -0
  9. package/dist/hoi4_agent_tools/map/appearance-validation.js +14 -2
  10. package/dist/hoi4_agent_tools/map/gameplay/reachability.js +81 -0
  11. package/dist/hoi4_agent_tools/map/geography/resolve.js +6 -2
  12. package/dist/hoi4_agent_tools/map/operations.js +8 -0
  13. package/dist/hoi4_agent_tools/map/partition-tuning.js +2 -1
  14. package/dist/hoi4_agent_tools/map/reference-world.js +17 -3
  15. package/dist/hoi4_agent_tools/map/relief/painted-relief.js +143 -0
  16. package/dist/hoi4_agent_tools/map/relief/terrain-synthesis.js +13 -0
  17. package/dist/hoi4_agent_tools/map/tool-operations.js +41 -0
  18. package/dist/hoi4_agent_tools/map/world-edge.js +117 -15
  19. package/dist/hoi4_agent_tools/map/world.js +243 -34
  20. package/dist/hoi4_agent_tools/mcp/server/argument-errors.js +57 -9
  21. package/dist/hoi4_agent_tools/mcp/server/create-modern-operations.js +1 -1
  22. package/dist/hoi4_agent_tools/mcp/server/request-lifecycle.js +1 -1
  23. package/dist/hoi4_agent_tools/mcp/tools/analysis.js +4 -2
  24. package/dist/hoi4_agent_tools/mcp/tools/event.js +13 -0
  25. package/dist/hoi4_agent_tools/mcp/tools/gui.js +1 -1
  26. package/dist/hoi4_agent_tools/mcp/tools/reference.js +25 -0
  27. package/dist/hoi4_agent_tools/probability/model.js +4 -4
  28. package/dist/hoi4_agent_tools/probability/operations.js +6 -0
  29. package/dist/hoi4_agent_tools/probability/service.js +23 -0
  30. package/dist/hoi4_agent_tools/reference/error-log.js +35 -1
  31. package/dist/hoi4_agent_tools/reference/operations.js +141 -14
  32. package/dist/hoi4_agent_tools/reference/script-validation.js +113 -2
  33. package/dist/hoi4_agent_tools/schemas/geography.js +5 -0
  34. package/dist/hoi4_agent_tools/schemas/ideas.js +4 -4
  35. package/dist/hoi4_agent_tools/schemas/map.js +61 -4
  36. package/dist/hoi4_agent_tools/schemas/script-validation.js +8 -1
  37. package/dist/hoi4_agent_tools/schemas/system.js +157 -0
  38. package/dist/hoi4_agent_tools/system/inspect.js +55 -0
  39. package/dist/hoi4_agent_tools/version.js +1 -1
  40. package/docs/analysis.md +2 -2
  41. package/docs/events.md +1 -1
  42. package/docs/map.md +31 -17
  43. package/docs/probability.md +1 -1
  44. package/docs/research/probability-adapter-evidence.md +15 -2
  45. package/docs/tools.md +49 -43
  46. package/engine/README.md +9 -0
  47. package/engine/bin/darwin-arm64/hoi4-engine +0 -0
  48. package/engine/bin/linux-arm64/hoi4-engine +0 -0
  49. package/engine/bin/linux-x64/hoi4-engine +0 -0
  50. package/engine/bin/manifest.json +8 -8
  51. package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
  52. package/npm-shrinkwrap.json +2 -2
  53. package/package.json +1 -1
  54. package/schemas/configuration.schema.json +1 -1
  55. package/schemas/continuous-focus-palette.schema.json +1 -1
  56. package/schemas/custom-weighted-pool.schema.json +1 -1
  57. package/schemas/decision-inspect-input.schema.json +1 -1
  58. package/schemas/error-log-input.schema.json +1 -1
  59. package/schemas/event-feature-manifest.schema.json +1 -1
  60. package/schemas/focus-plan.schema.json +1 -1
  61. package/schemas/focus-planning-sidecar.schema.json +1 -1
  62. package/schemas/geography-model.schema.json +4 -1
  63. package/schemas/gui-animation-source.schema.json +1 -1
  64. package/schemas/gui-helper.schema.json +1 -1
  65. package/schemas/gui-scenario.schema.json +1 -1
  66. package/schemas/helper-expansion-request.schema.json +1 -1
  67. package/schemas/helper-expansion-summary.schema.json +1 -1
  68. package/schemas/impact-inspect-input.schema.json +1 -1
  69. package/schemas/map-operation.schema.json +234 -111
  70. package/schemas/mechanic-test-input.schema.json +1 -1
  71. package/schemas/mod-index-input.schema.json +1 -1
  72. package/schemas/operation-result.schema.json +1 -1
  73. package/schemas/package-check-input.schema.json +1 -1
  74. package/schemas/package-manifest.schema.json +1 -1
  75. package/schemas/probability-analysis-result.schema.json +1 -1
  76. package/schemas/probability-compare-input.schema.json +1 -1
  77. package/schemas/probability-evaluate-input.schema.json +1 -1
  78. package/schemas/probability-inspect-input.schema.json +1 -1
  79. package/schemas/probability-render-input.schema.json +1 -1
  80. package/schemas/probability-scenario-set.schema.json +1 -1
  81. package/schemas/probability-sequence-input.schema.json +1 -1
  82. package/schemas/probability-simulate-input.schema.json +1 -1
  83. package/schemas/probability-sweep-input.schema.json +1 -1
  84. package/schemas/reference-context-input.schema.json +1 -1
  85. package/schemas/reference-read-input.schema.json +1 -1
  86. package/schemas/reference-search-input.schema.json +1 -1
  87. package/schemas/reference-sheets.schema.json +1 -1
  88. package/schemas/scenario-suite.schema.json +1 -1
  89. package/schemas/scenario-test-input.schema.json +1 -1
  90. package/schemas/script-validate-input.schema.json +1 -1
  91. package/schemas/shared-scenario.schema.json +1 -1
  92. package/schemas/source-lookup-input.schema.json +1 -1
  93. package/server.json +2 -2
@@ -87,6 +87,7 @@ const referencePointSchema = z
87
87
  const referenceKindSchema = z.enum([
88
88
  'sea',
89
89
  'land',
90
+ 'impassable_mountain',
90
91
  'plains',
91
92
  'forest',
92
93
  'desert',
@@ -193,9 +194,9 @@ export const worldReferenceSchema = z
193
194
  export const worldEdgeSchema = z
194
195
  .object({
195
196
  mode: z
196
- .enum(['sea-band', 'rim', 'none'])
197
+ .enum(['sea-band', 'rim', 'wall', 'none'])
197
198
  .optional()
198
- .describe('sea-band (default when edge is given) clears land from the east and west edges and the poles to open sea; rim ends land at the seam in an impassable snow range with impassable adjacencies across the seam; none keeps the picture and warns about land cut by the wrapping seam.'),
199
+ .describe('sea-band (default when edge is given) clears land from the east and west edges and the poles to open sea; rim ends land at the seam in an impassable snow range with impassable adjacencies across the seam, but sea at the seam stays sailable; wall fills rimPx at the east and west edges with land over the full height, in impassable states, so nothing crosses the seam by land or sea; none keeps the picture and warns about land cut by the wrapping seam.'),
199
200
  bandPx: z
200
201
  .number()
201
202
  .int()
@@ -209,14 +210,42 @@ export const worldEdgeSchema = z
209
210
  .min(0)
210
211
  .max(1_024)
211
212
  .optional()
212
- .describe('North and south sea band in pixels; default 64, at most a quarter of the height.'),
213
+ .describe('North and south sea band in pixels; default 64, at most a quarter of the height. 0 lets land reach the top and bottom edges.'),
213
214
  rimPx: z
214
215
  .number()
215
216
  .int()
216
217
  .min(16)
217
218
  .max(2_048)
218
219
  .optional()
219
- .describe('Rim range width in pixels for mode rim; default 160, at most a quarter of the width.'),
220
+ .describe('Rim range or wall width in pixels for mode rim or wall; default 160 for rim and 48 for wall, at most a quarter of the width. The inner edge of the wall is ragged between 60% and 100% of it.'),
221
+ wallTerrain: z
222
+ .union([
223
+ z.literal('auto'),
224
+ z
225
+ .array(z
226
+ .object({
227
+ y0: z.number().int().min(0).max(16_384),
228
+ y1: z.number().int().min(0).max(16_384),
229
+ kind: z.enum([
230
+ 'snow',
231
+ 'mountain',
232
+ 'hills',
233
+ 'desert',
234
+ 'forest',
235
+ 'plains',
236
+ 'marsh',
237
+ 'jungle',
238
+ ]),
239
+ })
240
+ .strict()
241
+ .refine((segment) => segment.y1 >= segment.y0, {
242
+ message: 'y1 must not be above y0',
243
+ }))
244
+ .min(1)
245
+ .max(256),
246
+ ])
247
+ .optional()
248
+ .describe('Mode wall only: the look of the wall. auto (default) takes, for each row, the terrain of the nearest land the wall meets on that side, or snow toward the poles and mountain elsewhere where it meets only water, smoothed along the edge. A list of {y0, y1, kind} segments (rows counted from the top, inclusive) sets it by rows; uncovered rows fall back to auto.'),
220
249
  })
221
250
  .strict();
222
251
  /** Relief synthesis from a geography model (ADR 0056). */
@@ -232,6 +261,27 @@ export const worldReliefSchema = z
232
261
  .max(1)
233
262
  .optional()
234
263
  .describe('Full-resolution roughness of the terrain, 0 to 1; default 0.5.'),
264
+ painted: z
265
+ .union([
266
+ z.boolean(),
267
+ z
268
+ .object({
269
+ falloffPx: z
270
+ .number()
271
+ .int()
272
+ .min(2)
273
+ .max(256)
274
+ .optional()
275
+ .describe('Blur radius of class edges in pixels; default 24.'),
276
+ mountainPeak: z.number().min(0).max(1).optional(),
277
+ hillsPeak: z.number().min(0).max(1).optional(),
278
+ volcanoPeak: z.number().min(0).max(1).optional(),
279
+ impassablePeak: z.number().min(0).max(1).optional(),
280
+ })
281
+ .strict(),
282
+ ])
283
+ .optional()
284
+ .describe('With a reference picture and a geography model: raise the relief toward the painted mountain, hills and volcano classes before the rivers are routed, blurred over falloffPx so slopes stay natural. Peaks are 0 to 1 on the range relief scale (defaults mountain 0.82, hills 0.27, volcano 0.9, near the base game; impassable land 0.95, which is raised even when this is off). Off by default.'),
235
285
  })
236
286
  .strict();
237
287
  /** River network target for a geography world: a share of the land pixels. */
@@ -325,6 +375,13 @@ export const worldPartitionTuningSchema = z
325
375
  .strict()
326
376
  .optional()
327
377
  .describe('Sea province area in pixels near a coast and on the open sea. Defaults follow seaProvincePixels (0.5 and 2.4 times, scaled so the mean stays seaProvincePixels).'),
378
+ lakeArea: z
379
+ .number()
380
+ .int()
381
+ .min(20)
382
+ .max(200_000)
383
+ .optional()
384
+ .describe('Lake province area in pixels; default 6000. A lake no larger than this stays one province.'),
328
385
  provincesPerState: z
329
386
  .tuple([z.number().int().min(1).max(64), z.number().int().min(1).max(64)])
330
387
  .optional()
@@ -63,8 +63,13 @@ export const scriptValidateDataSchema = z
63
63
  'player_text',
64
64
  'event_popups',
65
65
  'known_mistakes',
66
+ 'identifier_arguments',
66
67
  ])),
67
- parametersChecked: z.literal(false),
68
+ /**
69
+ * Identifier arguments (ideas, events, decisions, focuses, technologies) were checked against
70
+ * the workspace's definitions. Other argument values are not checked.
71
+ */
72
+ parametersChecked: z.boolean(),
68
73
  documentation: z
69
74
  .object({
70
75
  source: z.enum(['game_doc', 'script_doc']),
@@ -96,6 +101,8 @@ export const scriptValidateDataSchema = z
96
101
  unresolvedCount: z.number().int().min(0),
97
102
  truncated: z.boolean(),
98
103
  argumentBlocksUnchecked: z.number().int().min(0),
104
+ /** What made the result partial when `valid` is null, one plain sentence each. */
105
+ partialReasons: z.array(z.string().max(600)).max(5).optional(),
99
106
  file: z
100
107
  .object({
101
108
  path: z.string().max(4096),
@@ -0,0 +1,157 @@
1
+ import { z } from 'zod/v4';
2
+ import { workspaceIdSchema } from './common.js';
3
+ import { fieldSchema, placeSchema, problemSchema, textSchema } from './ideas.js';
4
+ /** The systems `hoi4.system_inspect` reads, one engine kind each. */
5
+ export const systemKinds = [
6
+ 'on_actions',
7
+ 'mio',
8
+ 'balance_of_power',
9
+ 'special_project',
10
+ 'operation',
11
+ 'raid',
12
+ ];
13
+ /** `hoi4.system_inspect`, answered by `hoi4-engine system`. */
14
+ export const systemInspectRequestSchema = z
15
+ .object({
16
+ workspaceId: workspaceIdSchema,
17
+ /** on_actions: a hook. mio: an organization or policy. special_project: a project, prototype reward, specialization or tag. operation: an operation, phase or token. raid: a raid or raid category. */
18
+ kind: z.enum(systemKinds),
19
+ /** The definition (or on_actions hook) to inspect. Leave it out with audit. */
20
+ id: z.string().min(1).max(256).optional(),
21
+ /** Check every definition of this system the mod makes instead of one. */
22
+ audit: z.boolean().default(false),
23
+ /** One: mentions listed. Audit: examples kept per problem code. */
24
+ limit: z.number().int().min(1).max(50).default(5),
25
+ })
26
+ .strict()
27
+ .refine((input) => input.audit || input.id !== undefined, {
28
+ message: 'pass an id, or audit: true',
29
+ path: ['id'],
30
+ });
31
+ /** The kinds `hoi4.unit_inspect` reads, answered by `hoi4-engine units`. */
32
+ export const unitKinds = ['oob', 'sub_unit', 'equipment', 'variant'];
33
+ /** One definition, as the engine answers it. */
34
+ const engineInspectionShape = (kinds) => z
35
+ .object({
36
+ kind: z.enum(kinds),
37
+ id: z.string().max(256),
38
+ found: z.boolean(),
39
+ definitions: z.array(placeSchema.extend({ what: z.string().max(64) })).max(512),
40
+ fields: z.array(fieldSchema).max(32),
41
+ parts: z
42
+ .array(z
43
+ .object({ what: z.string().max(64), id: z.string().max(256), line: z.number().int() })
44
+ .strict())
45
+ .max(100),
46
+ partsTruncated: z.boolean(),
47
+ references: z
48
+ .array(z
49
+ .object({
50
+ field: z.string().max(128),
51
+ target: z.string().max(64),
52
+ value: z.string().max(512),
53
+ known: z.boolean(),
54
+ line: z.number().int(),
55
+ })
56
+ .strict())
57
+ .max(100),
58
+ referencesTruncated: z.boolean(),
59
+ texts: z
60
+ .array(z.object({ key: z.string().max(512), texts: z.array(textSchema).max(64) }).strict())
61
+ .max(8),
62
+ mentions: z
63
+ .array(z
64
+ .object({ path: z.string().max(1024), line: z.number().int(), layer: z.string() })
65
+ .strict())
66
+ .max(100),
67
+ mentionsTruncated: z.boolean(),
68
+ problems: z.array(problemSchema).max(1000),
69
+ suggestions: z.array(z.string().max(256)).max(3).optional(),
70
+ })
71
+ .strict();
72
+ export const systemEngineInspectionSchema = engineInspectionShape(systemKinds);
73
+ /** Every definition of the system the mod makes, as the engine answers an audit. */
74
+ const engineAuditShape = (kinds) => z
75
+ .object({
76
+ kind: z.enum(kinds),
77
+ checked: z.number().int().min(0),
78
+ counts: z.record(z.string(), z.number().int().min(0)),
79
+ problems: z
80
+ .array(z
81
+ .object({
82
+ code: z.string().max(64),
83
+ severity: z.enum(['warning', 'info']),
84
+ id: z.string().max(256),
85
+ path: z.string().max(1024),
86
+ line: z.number().int().min(0),
87
+ message: z.string().max(1200),
88
+ })
89
+ .strict())
90
+ .max(5000),
91
+ truncated: z.boolean(),
92
+ })
93
+ .strict();
94
+ export const systemEngineAuditSchema = engineAuditShape(systemKinds);
95
+ export const systemInspectDataSchema = z
96
+ .object({
97
+ inspection: systemEngineInspectionSchema.optional(),
98
+ audit: systemEngineAuditSchema.optional(),
99
+ durationMs: z.number().int().min(0),
100
+ })
101
+ .strict();
102
+ /** `hoi4.unit_inspect`, answered by `hoi4-engine units`. */
103
+ export const unitInspectRequestSchema = z
104
+ .object({
105
+ workspaceId: workspaceIdSchema,
106
+ /** oob: a history/units file name without .txt. sub_unit, equipment (or module): its id. variant: its name. */
107
+ kind: z.enum(unitKinds),
108
+ /** The definition to inspect. Leave it out with audit. */
109
+ id: z.string().min(1).max(256).optional(),
110
+ /** Check every definition of this kind the mod makes instead of one. */
111
+ audit: z.boolean().default(false),
112
+ /** One: mentions listed. Audit: examples kept per problem code. */
113
+ limit: z.number().int().min(1).max(50).default(5),
114
+ })
115
+ .strict()
116
+ .refine((input) => input.audit || input.id !== undefined, {
117
+ message: 'pass an id, or audit: true',
118
+ path: ['id'],
119
+ });
120
+ export const unitEngineInspectionSchema = engineInspectionShape(unitKinds);
121
+ export const unitEngineAuditSchema = engineAuditShape(unitKinds);
122
+ export const unitInspectDataSchema = z
123
+ .object({
124
+ inspection: unitEngineInspectionSchema.optional(),
125
+ audit: unitEngineAuditSchema.optional(),
126
+ durationMs: z.number().int().min(0),
127
+ })
128
+ .strict();
129
+ /** The kinds `hoi4.asset_inspect` reads, answered by `hoi4-engine assets`. */
130
+ export const assetKinds = ['sprite', 'sound', 'flag'];
131
+ /** `hoi4.asset_inspect`, answered by `hoi4-engine assets`. */
132
+ export const assetInspectRequestSchema = z
133
+ .object({
134
+ workspaceId: workspaceIdSchema,
135
+ /** sprite: a sprite name. sound: a sound, sound effect, category or music name. flag: TAG or TAG_ideology. */
136
+ kind: z.enum(assetKinds),
137
+ /** The asset to inspect. Leave it out with audit. */
138
+ id: z.string().min(1).max(256).optional(),
139
+ /** Check every asset of this kind the mod defines instead of one. */
140
+ audit: z.boolean().default(false),
141
+ /** One: mentions listed. Audit: examples kept per problem code. */
142
+ limit: z.number().int().min(1).max(50).default(5),
143
+ })
144
+ .strict()
145
+ .refine((input) => input.audit || input.id !== undefined, {
146
+ message: 'pass an id, or audit: true',
147
+ path: ['id'],
148
+ });
149
+ export const assetEngineInspectionSchema = engineInspectionShape(assetKinds);
150
+ export const assetEngineAuditSchema = engineAuditShape(assetKinds);
151
+ export const assetInspectDataSchema = z
152
+ .object({
153
+ inspection: assetEngineInspectionSchema.optional(),
154
+ audit: assetEngineAuditSchema.optional(),
155
+ durationMs: z.number().int().min(0),
156
+ })
157
+ .strict();
@@ -0,0 +1,55 @@
1
+ import { runEngineCommand } from '../core/engine-client.js';
2
+ import { ServiceError } from '../core/result.js';
3
+ import { assetEngineAuditSchema, assetEngineInspectionSchema, systemEngineAuditSchema, systemEngineInspectionSchema, unitEngineAuditSchema, unitEngineInspectionSchema, } from '../schemas/system.js';
4
+ /** An audit reads the system's files, the sprites and every localisation file. */
5
+ const SYSTEM_TIMEOUT_MS = 180_000;
6
+ /**
7
+ * Runs one engine command that answers a definition or an audit. This side passes the workspace's
8
+ * roots and turns the engine's answer into the tool's data. A missing engine is
9
+ * `ENGINE_UNAVAILABLE`, with no TypeScript fallback.
10
+ */
11
+ async function inspectDefinitions(command, schemas, notFound, workspace, input, signal) {
12
+ const started = Date.now();
13
+ const request = {
14
+ ...(workspace.gameRoot === undefined ? {} : { game: workspace.gameRoot }),
15
+ ...(workspace.registration.kind === 'game' ? {} : { mod: workspace.modRoot }),
16
+ dependencies: workspace.dependencyRoots,
17
+ includeDlc: workspace.dlcLayers.length > 0,
18
+ kind: input.kind,
19
+ ...(input.id === undefined ? {} : { id: input.id }),
20
+ audit: input.audit,
21
+ limit: input.limit,
22
+ };
23
+ const options = { timeoutMs: SYSTEM_TIMEOUT_MS, ...(signal === undefined ? {} : { signal }) };
24
+ if (input.audit) {
25
+ const result = await runEngineCommand(command, request, schemas.audit, options);
26
+ if (!result.available)
27
+ throw new ServiceError('ENGINE_UNAVAILABLE', result.message, { reason: result.reason });
28
+ if (result.outcome === 'invalid_request')
29
+ throw new ServiceError(result.error.code, result.error.message);
30
+ return { audit: result.response, durationMs: Date.now() - started };
31
+ }
32
+ const result = await runEngineCommand(command, request, schemas.inspection, options);
33
+ if (!result.available)
34
+ throw new ServiceError('ENGINE_UNAVAILABLE', result.message, { reason: result.reason });
35
+ if (result.outcome === 'invalid_request')
36
+ throw new ServiceError(result.error.code, result.error.message);
37
+ const inspection = result.response;
38
+ if (!inspection.found) {
39
+ const suggestions = inspection.suggestions ?? [];
40
+ throw new ServiceError(notFound, `No loaded ${input.kind} file defines ${input.id ?? ''}${suggestions.length === 0 ? '' : `; did you mean ${suggestions.join(', ')}?`}`, { kind: input.kind, id: input.id ?? '', suggestions });
41
+ }
42
+ return { inspection: result.response, durationMs: Date.now() - started };
43
+ }
44
+ /** `hoi4.system_inspect` on the shared Rust engine (`hoi4-engine system`). */
45
+ export async function inspectSystem(workspace, input, signal) {
46
+ return inspectDefinitions('system', { inspection: systemEngineInspectionSchema, audit: systemEngineAuditSchema }, 'SYSTEM_DEFINITION_NOT_FOUND', workspace, input, signal);
47
+ }
48
+ /** `hoi4.unit_inspect` on the shared Rust engine (`hoi4-engine units`). */
49
+ export async function inspectUnits(workspace, input, signal) {
50
+ return inspectDefinitions('units', { inspection: unitEngineInspectionSchema, audit: unitEngineAuditSchema }, 'UNIT_DEFINITION_NOT_FOUND', workspace, input, signal);
51
+ }
52
+ /** `hoi4.asset_inspect` on the shared Rust engine (`hoi4-engine assets`). */
53
+ export async function inspectAssets(workspace, input, signal) {
54
+ return inspectDefinitions('assets', { inspection: assetEngineInspectionSchema, audit: assetEngineAuditSchema }, 'ASSET_NOT_FOUND', workspace, input, signal);
55
+ }
@@ -1,6 +1,6 @@
1
1
  import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/sdk/types.js';
2
2
  export const PACKAGE_NAME = 'hoi4-agent-tools';
3
- export const PACKAGE_VERSION = '4.8.0';
3
+ export const PACKAGE_VERSION = '4.10.0';
4
4
  export const MCP_PROTOCOL_VERSION = LATEST_PROTOCOL_VERSION;
5
5
  export const CONFIG_VERSION = 1;
6
6
  export const TRANSACTION_VERSION = 2;
package/docs/analysis.md CHANGED
@@ -31,7 +31,7 @@ Each entry is an object with `relativePath` and `content`, and a request takes b
31
31
 
32
32
  Impact and decision proposals name the text field `content`.
33
33
  Event and technology proposals for `hoi4.event_inspect` and `hoi4.tech_inspect` with `mode: compare` name the same field `source` and also accept an optional `expectedSourceHash`.
34
- When `changedFiles` is omitted, each proposed file seeds all its active definitions alongside any selected symbols.
34
+ When `changedFiles` is omitted, each proposed file seeds all its active definitions alongside any selected symbols. A symbol that nothing defines or uses, in the source or the proposal, answers `IMPACT_SYMBOL_NOT_FOUND` with close names.
35
35
  The report compares the original and proposed consumer graph, including added and removed consumers and affected files.
36
36
  Moving a source location within one file does not count an unchanged reference as a new or removed consumer.
37
37
  `expectedRevision` prevents analysis against a source revision different from the one the caller reviewed.
@@ -97,7 +97,7 @@ Inspect one decision under declared actor and target state:
97
97
  ```
98
98
 
99
99
  `ROOT` is the actor country and `FROM` is the declared target country or state.
100
- The inventory lists active decisions, category fragments, overridden source definitions, and each decision's explicit targets, target arrays, state filters, and target trigger declarations.
100
+ The inventory lists active decisions, category fragments, overridden source definitions, and each decision's explicit targets, target arrays, state filters, and target trigger declarations. With an `id`, it lists only that category's decisions, or that one decision, and returns their ids inline in `data.decisionIds`. Any other id answers `DECISION_NOT_FOUND` with close names.
101
101
  Category and decision `allowed`, `visible`, and `available` results remain separate; mission visibility is reported as ignored where documented.
102
102
  Target selection covers explicit lists and arrays plus supported state ownership, control, and continent filters.
103
103
  When a target, flag, variable, or helper input is unknown, the corresponding gate remains unresolved.
package/docs/events.md CHANGED
@@ -49,7 +49,7 @@ Selectors use one of these forms:
49
49
  { "kind": "manifest", "manifest": { "eventIds": ["namespace.1", "namespace.2"] } }
50
50
  ```
51
51
 
52
- `trace` uses `selector`; `explain_path` uses `from` and `to`; and `state_flow` may add a `stateSubject` object with `kind` and `name`. Allowed state kinds are `country_flag`, `global_flag`, `state_flag`, `variable`, `global_variable`, `array`, `event_target`, `global_event_target`, and `saved_scope`.
52
+ `trace` uses `selector`; `explain_path` uses `from` and `to`; and `state_flow` may add a `stateSubject` object with `kind` and `name`. Allowed state kinds are `country_flag`, `global_flag`, `state_flag`, `variable`, `global_variable`, `array`, `event_target`, `global_event_target`, and `saved_scope`. A subject narrows the findings as well as the flow, and `data.summary.flow` gives its producers and readers inline. `scan`, `roots`, `lint` and `state_flow` apply a `selector` too. A selector that matches nothing answers `EVENT_NOT_FOUND`, `EVENT_NAMESPACE_NOT_FOUND`, `EVENT_NODE_NOT_FOUND` or `EVENT_SOURCE_NOT_FOUND` with close names, and a subject nothing uses answers `EVENT_STATE_NOT_FOUND`.
53
53
 
54
54
  `impact` requires an `impactSubject` object with `kind` and `name`. Allowed impact kinds are `event`, `helper`, `flag`, `variable`, `array`, `event_target`, and `saved_scope`. Set `refresh: true` after source changes when a prior graph may be cached.
55
55
 
package/docs/map.md CHANGED
@@ -37,7 +37,7 @@ Optional `reference` controls refine the same call:
37
37
  | `ignoreMasks` | Polygons that exclude legends, frames or decorative areas. |
38
38
  | `annotations` | `{kind,polygon}` semantic polygons: sea, land, plains, lake, forest, desert, mountain, snow, volcano, hills, marsh or jungle. |
39
39
  | `riverAnnotations` | Paths for known rivers. |
40
- | `palette` | `{kind,color:{r,g,b}}` color cues for the same semantic kinds. |
40
+ | `palette` | `{kind,color:{r,g,b}}` color cues for the same semantic kinds, plus `impassable_mountain`: mountain land no army may enter (ADR 0079), which reads as mountain for terrain, colour, snow and relief and becomes impassable states. |
41
41
  | `coastDetail` | Detail preservation from 0 to 1. |
42
42
  | `paletteMatch` | `nearest` (default) snaps each pixel to the closest `palette` colour. `exact` requires every pixel to equal a palette colour and trusts the classes as painted (no text masking, cleanup, smoothing or political inference; thin painted water stays water); any other colour fails with `MAP_REFERENCE_PALETTE_UNKNOWN_COLOR`, listing up to 16 colours with counts and five source pixels each. |
43
43
  | `fit` | `contain` (default) centres the picture with sea padding. `frame` maps the picture, or its `crop`, onto exactly `width` x `height` (both required, same shape within 1%, else `MAP_REFERENCE_FRAME_ASPECT`) and reads it at the frame resolution instead of the 3,072-pixel working copy. |
@@ -115,7 +115,7 @@ A model is one object with `"version": 1` and any of these arrays. Unknown keys
115
115
  | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
116
  | `seas` | `polygons` (outer rings), optional `holes`, `depthClass` (`shelf`, `open`, `abyss`), `ice` 0 to 1, `kind` (`ocean`, `sea`, `gulf`, `bay`, `fjord`) |
117
117
  | `lands` | `polygons`, `holes`, `kind` (`continent`, `island`, `archipelago`, `peninsula`), `region`, default `biome` and `fertility`, `elevationBase`, `coastDetail` |
118
- | `regions` | `polygons` (optional), `terrain` target shares, `density` (`provincesPerState` as `[smallest, usual, largest]`, `provinceAreaPx`) |
118
+ | `regions` | `polygons` (optional), `terrain` target shares, `density` (`provincesPerState` as `[smallest, usual, largest]`, `provinceAreaPx`), `impassable` (the land inside its `polygons` becomes impassable states and the highest ground) |
119
119
  | `ranges` | `path` (points, each optionally with `halfWidth` and `peak`), `closed`, `halfWidth`, `peak`, `profile` (`ridge`, `massif`, `escarpment`, `wall`), `asymmetry`, `snowline`, `spurs`, `barrier` (`none`, `impassable`, `fort-line`) |
120
120
  | `passes` | `range` with `at` (0 to 1 along the range), or a `position` point (the range is found for you), `width`, `depth`, `fort` 0 to 5 |
121
121
  | `volcanoes` | `at`, `radius`, `peak`, `crater`, `active` |
@@ -133,7 +133,7 @@ Every feature also takes `id` (letters, digits, `_`, `.`, `-`; unique across the
133
133
 
134
134
  A model that needs an edit is reported by `MAP_GEOGRAPHY_*` diagnostics that name the feature. Errors: `ID_DUPLICATE`, `RING_DEGENERATE`, `RING_SELF_INTERSECTION`, `POLYGONS_OVERLAP`, `HOLE_OUTSIDE`, `HOLES_WITHOUT_POLYGONS`, `REF_UNKNOWN`, `REF_KIND`, `PASS_SHAPE`, `PASS_OFF_RANGE`, `RIVER_SOURCE_NOT_LAND`, `RIVER_MOUTH_NOT_WATER`, `RIVER_CYCLE`, `LAKE_SHAPE`, `LAKE_NOT_IN_LAND`, `LAKE_OUT_OF_FRAME`, `VOLCANO_NOT_ON_LAND`, `VOLCANO_CRATER_RADIUS`, `STRAIT_SHAPE`, `STRAIT_ENDPOINT`, `STRAIT_SAME_LAND`, `SITE_IN_WATER`, `BIOME_CONFLICT` (different kinds overlap at the same `z`), `BIOME_OVER_WATER`, `PATH_DEGENERATE`, `CLIMATE_TEMPERATURE_ORDER`, `REGION_DENSITY_ORDER`, `NO_LAND` (no lands and no reference picture), `LIMIT_FEATURES` and `LIMIT_POINTS`. Warnings: `LAND_OVERLAP`, `SEA_OVER_LAND`, `LAKE_TOO_SMALL`, `LAKE_OUTFLOW_MISMATCH`, `PASS_OVERLAP`, `VOLCANO_OVERLAP`, `RANGE_ON_WATER`, `PATH_SELF_INTERSECTION`, `RIVER_VIA_NOT_LAND`, `STRAIT_PATH_ON_LAND`, `STRAIT_NO_WATER`, `SITE_DUPLICATE_POSITION`, `REGION_EMPTY`, `REGION_TERRAIN_SUM`, `NAME_DUPLICATE`, `RING_DUPLICATE_VERTEX`, `PATH_DUPLICATE_VERTEX`, `FEATURE_IN_EDGE_BAND` and `DIAGNOSTICS_TRUNCATED` (more than 1,000 findings; the worst severity is kept). A file that cannot be used at all fails the call instead, with `MAP_GEOGRAPHY_PATH_INVALID`, `SOURCE_TOO_LARGE`, `JSON_INVALID`, `SCHEMA_INVALID` or `SOURCE_AMBIGUOUS`. A point within 0.003 map widths of a coast counts as land, so a river mouth or a port drawn on the shore does not fail on a simplified coastline; the error for an inland mouth reports its `inlandDistance` so it can be snapped.
135
135
 
136
- `FEATURE_IN_EDGE_BAND` marks land, plateaus, ranges, volcanoes, sites, passes and river points inside `max(192 pixels, 4% of the width)` east and west or 64 pixels north and south of the frame, because the game wraps the map horizontally. It is a warning, and an error when the request sets `edge.mode` to `sea-band` (`rim` and `none` skip it).
136
+ `FEATURE_IN_EDGE_BAND` marks land, plateaus, ranges, volcanoes, sites, passes and river points inside `max(192 pixels, 4% of the width)` east and west or 64 pixels north and south of the frame, because the game wraps the map horizontally. It is a warning, and an error when the request sets `edge.mode` to `sea-band` (`rim`, `wall` and `none` skip it).
137
137
 
138
138
  `geographyPath` follows the rules of `reference.imagePath`: relative paths inside the authorized mod workspace only; URLs, absolute paths, traversal, symlink and junction escapes are refused; the file is read once, its SHA-256 is taken from the bytes that are parsed, and a change after preparation blocks the write as stale. A file that is not JSON or does not match the schema is an error, not a partial preview. CI models are synthetic and project-owned.
139
139
 
@@ -141,11 +141,12 @@ A model that needs an edit is reported by `MAP_GEOGRAPHY_*` diagnostics that nam
141
141
 
142
142
  `create_world` with a geography writes `heightmap.bmp`, `world_normal.bmp`, `rivers.bmp`, the land and lake mask, and the permanent-snow terrain from the model; every other output follows the usual generator. Without a geography nothing changes. [ADR 0056](adr/0056-terrain-relief-and-hydrology-synthesis.md) records the design.
143
143
 
144
- | Input | Meaning |
145
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
- | `relief.scale` | `vanilla` (default), `low` (everything above the lowland 25% lower) or `dramatic` (15% higher). |
147
- | `relief.detail` | 0 to 1, default 0.5: full-resolution roughness. |
148
- | `rivers` | `{ "density": 0.02 }`: the share of land pixels the unnamed network covers (0 to 0.04, default 0.02; never more than 2.5% of the land or 130,000 pixels in all). An integer instead limits the number of unnamed river systems. |
144
+ | Input | Meaning |
145
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
146
+ | `relief.scale` | `vanilla` (default), `low` (everything above the lowland 25% lower) or `dramatic` (15% higher). |
147
+ | `relief.detail` | 0 to 1, default 0.5: full-resolution roughness. |
148
+ | `relief.painted` | With a reference picture: `true` or `{falloffPx, mountainPeak, hillsPeak, volcanoPeak, impassablePeak}`. Raises the macro relief toward the picture's painted mountain, hills and volcano classes before the rivers are routed, so the drawn ranges stand out and the model's rivers flow around them. Each class is blurred over `falloffPx` (default 24; below 16 the slopes steepen fast), mountains follow ridged noise, a cell keeps the model's height where that is higher, and painted mountains get permanent snow above a height that falls from 232 at the equator to 140 at the poles. Peaks are 0 to 1 on the range scale (defaults 0.82, 0.27, 0.9, 0.95). Impassable land is raised even when this is off. `MAP_RELIEF_PAINTED` reports the cells raised. |
149
+ | `rivers` | `{ "density": 0.02 }`: the share of land pixels the unnamed network covers (0 to 0.04, default 0.02; never more than 2.5% of the land or 130,000 pixels in all). An integer instead limits the number of unnamed river systems. |
149
150
 
150
151
  What each feature becomes. Heights are heightmap values: land from 96, sea 89 (ADR 0053), a crest of `peak` stands at `100 + 148 * peak`, a plateau of `height` at `96 + 148 * height`, and the base game reaches 239 (the synthesis stops at 252).
151
152
 
@@ -169,7 +170,7 @@ Not synthesised yet: biomes, climate, fertility, tree and colour-map classes fro
169
170
 
170
171
  The linked JSON catalog contains every active province definition, state, and strategic region with resolved names, alternate localisation values, source paths and lines, raster bounds and centers, memberships, neighbors, victory points, resources, buildings, ports, supply nodes, railways, normal and special adjacencies, building positions, unit positions, weather positions, and entity locators. Large catalog and render data remain in MCP resources instead of filling the agent prompt.
171
172
 
172
- Use `query` for a compact name or ID result list and `coordinates` for exact pixel or map-coordinate lookup. Use `provinceIds`, `stateIds`, and `regionIds` for focused records. Up to 32 selected provinces can also produce exact geometry as maximal `[y, startX, endXExclusive]` row runs.
173
+ Use `query` for a compact name or ID result list and `coordinates` for exact pixel or map-coordinate lookup. Use `provinceIds`, `stateIds`, and `regionIds` for focused records. Up to 32 selected provinces can also produce exact geometry as maximal `[y, startX, endXExclusive]` row runs. When none of the requested ids exists, the call answers `MAP_ENTITY_ID_NOT_FOUND` with the highest id of each kind, before any validation or render. A selection with some known ids reports the unknown ones.
173
174
 
174
175
  Set `lookupOnly: true` for coordinate, query, and selected-ID lookups without full validation, the complete catalog artifact, overview rendering, or province geometry export. The lookup artifact contains only the requested matches and source revision. Use full inspection for allocation previews or province row runs.
175
176
 
@@ -476,13 +477,15 @@ A world built from a geography also gets its gameplay facts from the model (ADR
476
477
  | fertility, rivers, coast, passes | Population, state category, infrastructure, factories and the harbour score of each coastal province, with no random rolls. |
477
478
  | names | State, strategic region, victory-point and lake-province names from sites, lake shores, river valleys, ranges, regions, lands and seas by containment; shared names get a compass adjective. |
478
479
 
480
+ Impassable land (ADR 0079) comes from painted `impassable_mountain` pixels and from model `regions` with `impassable: true`. A land province with most of its pixels in it becomes part of an impassable state, written as the base game writes its impassable states: `impassable = yes`, `force_link_ownership_to` the nearest passable state and its owner, category `enclave` where the mod defines it, infrastructure 0 and nothing built. Generated capitals and ports avoid it; a city on it, or a workspace capital in one of its provinces, is the error `MAP_FEATURE_IN_IMPASSABLE`. The relief raises it toward `relief.painted.impassablePeak`. Range lines with `barrier: "impassable"` and their gated passes are unchanged and work beside it. Whenever impassable land or rows exist, `MAP_REALM_CUT_OFF` (warning) lists land of a realm that impassable land or borders separate from its capital, and `MAP_REALM_ENCLOSED` (warning) a realm whose land reaches no other realm except through them; islands are never reported.
481
+
479
482
  Options of `create_world`: `development: { model }` (`geography`, the default for a geography world, or `legacy` for the random economy) and `autoStraits` (`true` or `{ maxGapPx }`, default 24 pixels, about 170 km) to also write a rule-less crossing for every narrow channel the model did not declare. Both need a geography (`MAP_DEVELOPMENT_REQUIRES_GEOGRAPHY`, `MAP_AUTO_STRAITS_REQUIRES_GEOGRAPHY`).
480
483
 
481
484
  Railways of a geography world follow a terrain-aware cost (ground, climb across the border, rivers, gates, model roads) and never cross a wall except at a gate; trunk lines of level 2 reach the cities of 8 or more victory points. The supply-node rule is unchanged.
482
485
 
483
486
  Diagnostics raised when a world is created (they need the model): `MAP_CROSSINGS_PLANNED`, `MAP_DEVELOPMENT_PLANNED` and `MAP_INLAND_SEA_CREATED` (info), `MAP_STRAIT_UNRESOLVED`, `MAP_STRAIT_DUPLICATE`, `MAP_STRAIT_NOT_NARROW`, `MAP_PASS_BLOCKED`, `MAP_RANGE_NOT_CLOSED`, `MAP_INLAND_SEA_SEALED`, `MAP_PORT_LAKE_UNSUPPORTED`, `MAP_PORT_SITE_NOT_COASTAL`, `MAP_SITE_UNPLACED` and `MAP_NAME_PLACEHOLDER` (warnings; the last counts the states, strategic regions and victory points still called "District N", "Region N" or "Settlement N"), and `MAP_IMPASSABLE_ROW_LIMIT` (refusal above 2,000 wall rows). Raised on any map by `hoi4.map_inspect`: `MAP_ADJACENCY_RULE_MISSING`, `_DUPLICATE` and `_INVALID` (errors), `MAP_ADJACENCY_RULE_UNUSED`, `MAP_IMPASSABLE_NOT_ADJACENT` and `MAP_UNIT_POSITION_MISSING` (information, or warnings when they are a pattern), `MAP_IMPASSABLE_NOT_LAND`, `MAP_ADJACENCY_ROW_LIMIT`, `MAP_STRAIT_NOT_NARROW` and `MAP_RAILWAY_CROSSES_IMPASSABLE` (warnings). The installed game raises nothing above information.
484
487
 
485
- Not done: whole provinces inside a massif are not made impassable states, the engine's handling of impassable rows by supply and the AI and of a naval base on an inland sea is not verified, and `positions.txt` stays empty as in the base game. Measured on the project's 5,120 x 2,560 synthetic model with about 6,000 provinces, the gameplay layer adds about 6 seconds to a 30 second `create_world` and the whole run peaks near 0.8 GiB.
488
+ Not done: passes cut as corridors through impassable land (a pass still opens a range line only), the engine's handling of impassable rows by supply and the AI and of a naval base on an inland sea is not verified, and `positions.txt` stays empty as in the base game. Measured on the project's 5,120 x 2,560 synthetic model with about 6,000 provinces, the gameplay layer adds about 6 seconds to a 30 second `create_world` and the whole run peaks near 0.8 GiB.
486
489
 
487
490
  ## Positions and supply
488
491
 
@@ -571,7 +574,7 @@ To check all of this without a write, call `hoi4.map_rewrite` with `preview: tru
571
574
  By default provinces grow evenly from spread seeds and states and regions grow by breadth-first clusters, which ignore rivers, ridges and shores. Set `partition: "feature-aware"` (default `legacy`; a world given a `geography` defaults to it) to cut along natural lines instead (ADR 0058):
572
575
 
573
576
  - Province borders are pulled onto rivers, steep slopes and ridges, wall ranges and lake shores (a watershed whose step cost rises on them). A province that still straddles a river or wall is cut along it.
574
- - Province size follows the land: small in fertile valleys, on coasts and beside rivers, large on mountains and wasteland (`landArea.fertile`, `hills`, `mountain`, `waste`, in pixels), and per geography region through its `density.provinceAreaPx`. Without bands they follow `landProvincePixels` (0.35, 1, 2.2 and 3.4 times, scaled so the mean stays `landProvincePixels`). Sea provinces are small near a coast and large on the open sea (`seaArea.coastal` and `open`, from `seaProvincePixels`), and a channel no wider than `narrowStraitPx` (24) gets two sea provinces across it.
577
+ - Province size follows the land: small in fertile valleys, on coasts and beside rivers, large on mountains and wasteland (`landArea.fertile`, `hills`, `mountain`, `waste`, in pixels), and per geography region through its `density.provinceAreaPx`. Without bands they follow `landProvincePixels` (0.35, 1, 2.2 and 3.4 times, scaled so the mean stays `landProvincePixels`). Sea provinces are small near a coast and large on the open sea (`seaArea.coastal` and `open`, from `seaProvincePixels`), and a channel no wider than `narrowStraitPx` (24) gets two sea provinces across it. A lake province covers about `lakeArea` pixels (default 6,000, at most an eighth of the map), so a lake no larger than that stays one province.
575
578
  - States and strategic regions are clusters over the province graph that avoid joining across rivers and ranges, prefer like ground, never mix geography regions or named seas, and respect `provincesPerState` (`[smallest, largest]`, or a region's own `density.provincesPerState`) and `regionSize`.
576
579
  - `barrierStrength` (0 to 60, default 20) sets how hard borders are pulled onto natural lines; `minProvincePixels` (default 40) is the smallest planned province.
577
580
 
@@ -626,15 +629,25 @@ Water that does not read as a lake is not written as one. Enclosed water below 6
626
629
 
627
630
  The engine wraps the map horizontally, so land that touches the first or last column is cut by a straight line where the world repeats. Without `edge` nothing changes and validation reports `MAP_EDGE_LAND_CUT` for such rows. With `edge`:
628
631
 
629
- | `edge` field | Default | Meaning |
630
- | ------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
631
- | `mode` | `sea-band` when `edge` is given | `sea-band` clears land from the east and west edges and the poles to open sea with a ragged outline; `rim` ends land at the seam in an impassable snow range; `none` opts out. |
632
- | `bandPx` | `max(192, 4% of the width)`, at most a quarter of the width | East and west sea band. |
633
- | `polarPx` | 64, at most a quarter of the height | North and south sea band. |
634
- | `rimPx` | 160, at most a quarter of the width | Width of the rim range for `rim`. Heights rise from 150 to 230, the colour map darkens and `adjacencies.csv` gets one `impassable` row per pair of land provinces across the seam. |
632
+ | `edge` field | Default | Meaning |
633
+ | ------------- | ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
634
+ | `mode` | `sea-band` when `edge` is given | `sea-band` clears land from the east and west edges and the poles to open sea with a ragged outline; `rim` ends land at the seam in an impassable snow range; `wall` closes the seam with impassable land over the full height; `none` opts out. |
635
+ | `bandPx` | `max(192, 4% of the width)`, at most a quarter of the width | East and west sea band. |
636
+ | `polarPx` | 64, at most a quarter of the height | North and south sea band; 0 lets land reach the top and bottom edges. |
637
+ | `rimPx` | 160 for `rim`, 48 for `wall`, at most a quarter of the width | Width of the rim range for `rim` or of the wall for `wall`. Heights rise from 150 to 230, the colour map darkens and `adjacencies.csv` gets one `impassable` row per pair of land provinces across the seam. |
638
+ | `wallTerrain` | `auto` | `wall` only: the look of the wall. `auto` takes, for each row and side, the terrain of the nearest land beyond the wall within four wall widths (snow where the land is snowy), or snow in the outer fifths of the map and mountain elsewhere where it meets only water, smoothed over about half a wall width of rows. A list of `{y0, y1, kind}` segments (rows from the top, inclusive; kind one of `snow`, `mountain`, `hills`, `desert`, `forest`, `plains`, `marsh`, `jungle`) sets it by rows; uncovered rows stay `auto`. |
635
639
 
636
640
  A band wider than a quarter of the world is refused (`MAP_EDGE_BAND_TOO_WIDE`). A city inside a band that would be cleared is an error (`MAP_EDGE_FEATURE_IN_BAND`) naming it; land that is cleared is reported with its pixel count (`MAP_EDGE_LAND_CLEARED`). `ambientFrame: true` writes the north and south frame borders and the logo frame into `ambient_object.txt` at the base map's positions scaled to the world height (the north frame at `z = height + 142`, the south frame at `z = -140`); by default the file is a comment, which drops the frame. The wrap cannot be removed with data; the band makes it invisible and the rim makes it a wall. Which looks better in the game is for you to judge with a probe map. Rivers are routed before the rim is raised, so keep them out of a rim.
637
641
 
642
+ A `rim` leaves sea at the seam as sea, and ships sail across it, because the sea at both edges is one connected sea and an `impassable` adjacency is only known to separate land provinces (the base game's 93 all do). `wall` closes the seam for armies and fleets alike:
643
+
644
+ - A band between 60% and 100% of `rimPx` wide at the east and west edges, over the full height, becomes land; sea and lakes in it are filled (`MAP_EDGE_WALL_FILLED`, information). Its inner edge follows fractal noise, so it reads as a coast or cliff line rather than a ruled line. It gets the rim's heights and darker colours, the look `wallTerrain` sets, and the impassable rows across the seam.
645
+ - The seam is closed at any width, because the seam columns themselves are land. The default of 48 pixels keeps the wall at least one default land province (400 pixels, about 20 across) wide even where it is narrowest; for other province sizes, about 1.7 times the square root of `landProvincePixels` does the same.
646
+ - A land province with most of its pixels in the band belongs to the wall. The wall's provinces form their own states with `impassable = yes`, `force_link_ownership_to` the nearest passable state (counted in province steps over land and water) and that state's owner, as the base game's 21 impassable states do; the category is `enclave` where the mod defines it, with infrastructure 0 and no buildings, resources, victory points, ports or forts. A province that straddles the inner edge of the band goes wholly to the side holding most of its pixels.
647
+ - A city in the band (`MAP_EDGE_FEATURE_IN_BAND`) or a workspace capital in a wall province is an error. Capitals are never placed in the wall.
648
+ - Validation of a `wall` world reports water on the first or last column as `MAP_EDGE_WALL_OPEN` (error) instead of `MAP_EDGE_LAND_CUT`.
649
+ - With `polarPx: 0` land runs off the top and bottom edges, which validation reports as `MAP_POLAR_LAND` (information); the frame borders are drawn over those rows.
650
+
638
651
  ### Appearance validation
639
652
 
640
653
  `hoi4.map_inspect` and every `create_world` check the files that decide the look, for the files the mod ships: `heightmap.bmp`, `terrain.bmp`, `rivers.bmp`, `trees.bmp`, `cities.bmp`, `world_normal.bmp` and the colour maps. Format and size defects are errors; statistical deviations are warnings. Severities are set so the installed base game raises no error.
@@ -653,6 +666,7 @@ A band wider than a quarter of the world is refused (`MAP_EDGE_BAND_TOO_WIDE`).
653
666
  | `MAP_COLORMAP_RANGE`, `MAP_WATER_COLORMAP_FLAT` | warning | Land mean value outside 50 to 100, fewer than 400 distinct 5-bit colours or a deviation under 15; a flat water map. |
654
667
  | `MAP_NORMAL_SIZE`, `_NOT_UNIT`, `_RESPONSE`, `MAP_CITIES_SIZE`, `_INDEX_UNDEFINED` | error or warning | Normal map size and unit length, its response to the height step (the base game's is about 2.6) and the city map. |
655
668
  | `MAP_EDGE_LAND_CUT` | warning or error | Land on the first or last column; an error when the world was created with `sea-band`. |
669
+ | `MAP_EDGE_WALL_OPEN` | error | Water on the first or last column of a world created with `wall`. |
656
670
  | `MAP_SEAM_LAND_ADJACENCY`, `MAP_POLAR_LAND`, `MAP_COLORMAP_ALPHA_CITY` | info | Land provinces that meet across the seam (and how many are blocked), land in the top and bottom rows, city lights over water. |
657
671
 
658
672
  Not implemented: a check that river widths never narrow downstream (it needs a flow direction the file does not hold), and a mesh check for `trees.bmp` beyond the declared palette. Bitmaps are read in row strips and validation yields between strips, so a 13-million-pixel map stays cancellable and within memory.
@@ -12,7 +12,7 @@ Use them for event timing and option weights, decision and mission scores, focus
12
12
 
13
13
  ## Game version
14
14
 
15
- The adapters apply the documented weighting rules of `ai_will_do`, `ai_chance`, mean time to happen, `random_list` and AI strategies, which are the same in every game version, so evaluation runs on whatever HOI4 version is installed. When `gameRoot` is configured, `metadata.gameVersionVerification` records the build read from `launcher-settings.json`: `workspace_verified` for the build the adapters were last reviewed against, `workspace_observed` for any other build, and `version_unknown` with a `reason` when the file cannot be read. Without a game root, results identify the adapter version (`adapter_target_only`). Proposed source is evaluated in memory.
15
+ The adapters apply the documented weighting rules of `ai_will_do`, `ai_chance`, mean time to happen, `random_list` and AI strategies, which are the same in every game version, so evaluation runs on whatever HOI4 version is installed. When `gameRoot` is configured, `metadata.gameVersionVerification` records the build read from `launcher-settings.json`: `workspace_verified` for the build the adapters were last reviewed against, `workspace_observed` for any other build (reported with the warning `PROBABILITY_GAME_BUILD_UNVERIFIED`), and `version_unknown` with a `reason` when the file cannot be read. Without a game root, results identify the adapter version (`adapter_target_only`). Proposed source is evaluated in memory.
16
16
 
17
17
  ## One call for current weights
18
18
 
@@ -1,6 +1,19 @@
1
1
  # Probability adapter evidence
2
2
 
3
- The AI and MTTH Scenario Analyzer targets Hearts of Iron IV **Operation Postern 1.19.2.0 (checksum d245)**. Adapter behavior is versioned as `hoi4-1.19.2.v1`; results always include that adapter version and game build.
3
+ The AI and MTTH Scenario Analyzer targets Hearts of Iron IV **Operation Postern 1.19.4.1 (checksum f584)**. Adapter behavior is versioned as `hoi4-1.19.4.1.v1`. Results always include that adapter version and game build. When the installed build differs, results carry the warning `PROBABILITY_GAME_BUILD_UNVERIFIED`, and the nightly game-update watcher lists the adapters under "Checked against another build" on every run until the pin moves.
4
+
5
+ ## Re-check for 1.19.4.1 (2026-11-06)
6
+
7
+ The adapters were first reviewed on 1.19.2.0 (`hoi4-1.19.2.v1`, sections below). For 1.19.4.1 every reviewed file was hashed again on the installed game:
8
+
9
+ - **Unchanged:** `common/decisions/_documentation.md`, `common/doctrines/_documentation.md`, `common/script_constants/documentation.md`, `documentation/script_concept_documentation.md` and `documentation/effects_documentation.md` are byte-identical to the hashes below.
10
+ - **Changed:** `common/ai_strategy/_documentation.md` is now `cd19fa144b47345a01632f38c5fb4a5cff7beece962f6640ca74fb83de3dc715`. Its `research_tech` section still forces research for any positive value. Its `research_weight_factor` section still describes a percentage factor on the technology's `ai_will_do`. Both are what `ai_strategy_factor` implements.
11
+ - **Examples:** `events/Yugoslavia.txt:49`, `common/national_focus/austria.txt:122` and `common/doctrines/grand_doctrines/land_grand_doctrines.txt:14` changed but keep their construct at the same line. `events/BBA_Switzerland.txt` has its `random` at line 1205 (was 1197). `common/ai_strategy/ENG.txt` has its `research_weight_factor` strategy at line 3202 (was 3206). The other examples are byte-identical.
12
+ - **Installed build:** `launcher-settings.json` reads `Operation Postern v1.19.4.1.99a5 (f584)`, raw version `1.19.4.1`.
13
+
14
+ No adapter rule changed, so only the version pin moved.
15
+
16
+ ## Review on 1.19.2.0
4
17
 
5
18
  This review used the installed game's documentation, vanilla source examples, and an offline Paradox wiki snapshot. Paths below are relative to a Hearts of Iron IV installation or to the offline snapshot. SHA-256 values identify the exact files reviewed on 2026-07-22.
6
19
 
@@ -50,7 +63,7 @@ The installed vanilla inventory contained 71 event files with MTTH, 101 with `ai
50
63
 
51
64
  ## Unsupported constructs
52
65
 
53
- When a game root is configured, adapter execution verifies `launcher-settings.json` against the supported raw version and checksum and fails closed on a missing, unreadable, or different build. Without a configured game root, results identify the adapter target without claiming that an installed build was verified.
66
+ When a game root is configured, adapter execution reads `launcher-settings.json` and compares it with the supported raw version and checksum. A matching build is `workspace_verified`. A different build is still analyzed with the documented rules, recorded as `workspace_observed` and reported with the warning `PROBABILITY_GAME_BUILD_UNVERIFIED`. A missing or unreadable file is `version_unknown`. Without a configured game root, results identify the adapter target without claiming that an installed build was verified.
54
67
 
55
68
  The analyzer reports, but does not guess or execute:
56
69