hoi4-agent-tools 4.16.0 → 4.17.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 (101) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -0
  3. package/dist/hoi4_agent_tools/core/analysis-checkpoints.js +11 -4
  4. package/dist/hoi4_agent_tools/core/engine-client.js +30 -1
  5. package/dist/hoi4_agent_tools/core/engine.js +56 -27
  6. package/dist/hoi4_agent_tools/core/managed-outputs.js +54 -3
  7. package/dist/hoi4_agent_tools/core/scanner.js +148 -7
  8. package/dist/hoi4_agent_tools/core/server-state.js +50 -2
  9. package/dist/hoi4_agent_tools/core/source/localisation.js +7 -1
  10. package/dist/hoi4_agent_tools/event/compare.js +47 -13
  11. package/dist/hoi4_agent_tools/focus/importer.js +2 -5
  12. package/dist/hoi4_agent_tools/focus/lint.js +2 -5
  13. package/dist/hoi4_agent_tools/focus/model.js +19 -0
  14. package/dist/hoi4_agent_tools/focus/tool-operations.js +16 -1
  15. package/dist/hoi4_agent_tools/focus/tool-support.js +14 -0
  16. package/dist/hoi4_agent_tools/map/appearance-validation.js +6 -1
  17. package/dist/hoi4_agent_tools/map/engine-raster.js +160 -0
  18. package/dist/hoi4_agent_tools/map/model.js +9 -8
  19. package/dist/hoi4_agent_tools/map/operations.js +20 -5
  20. package/dist/hoi4_agent_tools/map/partition-provinces.js +6 -2
  21. package/dist/hoi4_agent_tools/map/partition-tuning.js +37 -0
  22. package/dist/hoi4_agent_tools/map/service.js +25 -12
  23. package/dist/hoi4_agent_tools/map/territory-operations.js +114 -3
  24. package/dist/hoi4_agent_tools/map/territory-quality.js +39 -0
  25. package/dist/hoi4_agent_tools/map/territory.js +63 -2
  26. package/dist/hoi4_agent_tools/map/tool-operations.js +27 -1
  27. package/dist/hoi4_agent_tools/map/validation.js +23 -3
  28. package/dist/hoi4_agent_tools/map/water.js +13 -10
  29. package/dist/hoi4_agent_tools/map/world-outputs.js +41 -26
  30. package/dist/hoi4_agent_tools/map/world.js +51 -1
  31. package/dist/hoi4_agent_tools/mcp/tools/map.js +23 -0
  32. package/dist/hoi4_agent_tools/mcp/tools/reference.js +2 -2
  33. package/dist/hoi4_agent_tools/mcp/tools/technology.js +25 -1
  34. package/dist/hoi4_agent_tools/reference/closure.js +65 -0
  35. package/dist/hoi4_agent_tools/reference/command-phrases.json +7899 -1127
  36. package/dist/hoi4_agent_tools/reference/operations.js +38 -21
  37. package/dist/hoi4_agent_tools/reference/ranking.js +77 -2
  38. package/dist/hoi4_agent_tools/reference/script-validation.js +4 -2
  39. package/dist/hoi4_agent_tools/reference/service.js +45 -2
  40. package/dist/hoi4_agent_tools/reference/source-lookup.js +43 -121
  41. package/dist/hoi4_agent_tools/runtime.js +27 -11
  42. package/dist/hoi4_agent_tools/schemas/lenient-arguments.js +7 -1
  43. package/dist/hoi4_agent_tools/schemas/map.js +33 -0
  44. package/dist/hoi4_agent_tools/schemas/mod-tools.js +49 -0
  45. package/dist/hoi4_agent_tools/schemas/reference.js +1 -1
  46. package/dist/hoi4_agent_tools/schemas/script-validation.js +57 -3
  47. package/dist/hoi4_agent_tools/technology/operations.js +5 -0
  48. package/dist/hoi4_agent_tools/technology/queries.js +54 -0
  49. package/dist/hoi4_agent_tools/version.js +1 -1
  50. package/docs/configuration.md +1 -1
  51. package/docs/map.md +13 -11
  52. package/docs/research/reference-benchmark.md +64 -0
  53. package/docs/tools.md +20 -20
  54. package/docs/troubleshooting.md +4 -0
  55. package/engine/bin/darwin-arm64/hoi4-engine +0 -0
  56. package/engine/bin/linux-arm64/hoi4-engine +0 -0
  57. package/engine/bin/linux-x64/hoi4-engine +0 -0
  58. package/engine/bin/manifest.json +8 -8
  59. package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
  60. package/npm-shrinkwrap.json +2 -2
  61. package/package.json +5 -3
  62. package/schemas/configuration.schema.json +1 -1
  63. package/schemas/continuous-focus-palette.schema.json +1 -1
  64. package/schemas/custom-weighted-pool.schema.json +1 -1
  65. package/schemas/decision-inspect-input.schema.json +1 -1
  66. package/schemas/error-log-input.schema.json +1 -1
  67. package/schemas/event-feature-manifest.schema.json +1 -1
  68. package/schemas/focus-plan.schema.json +1 -1
  69. package/schemas/focus-planning-sidecar.schema.json +1 -1
  70. package/schemas/geography-model.schema.json +1 -1
  71. package/schemas/gui-animation-source.schema.json +1 -1
  72. package/schemas/gui-helper.schema.json +1 -1
  73. package/schemas/gui-scenario.schema.json +1 -1
  74. package/schemas/helper-expansion-request.schema.json +1 -1
  75. package/schemas/helper-expansion-summary.schema.json +1 -1
  76. package/schemas/impact-inspect-input.schema.json +1 -1
  77. package/schemas/map-operation.schema.json +817 -728
  78. package/schemas/mechanic-test-input.schema.json +1 -1
  79. package/schemas/mod-index-input.schema.json +1 -1
  80. package/schemas/operation-result.schema.json +1 -1
  81. package/schemas/package-check-input.schema.json +1 -1
  82. package/schemas/package-manifest.schema.json +1 -1
  83. package/schemas/probability-analysis-result.schema.json +1 -1
  84. package/schemas/probability-compare-input.schema.json +1 -1
  85. package/schemas/probability-evaluate-input.schema.json +1 -1
  86. package/schemas/probability-inspect-input.schema.json +1 -1
  87. package/schemas/probability-render-input.schema.json +1 -1
  88. package/schemas/probability-scenario-set.schema.json +1 -1
  89. package/schemas/probability-sequence-input.schema.json +1 -1
  90. package/schemas/probability-simulate-input.schema.json +1 -1
  91. package/schemas/probability-sweep-input.schema.json +1 -1
  92. package/schemas/reference-context-input.schema.json +1 -1
  93. package/schemas/reference-read-input.schema.json +1 -1
  94. package/schemas/reference-search-input.schema.json +2 -2
  95. package/schemas/reference-sheets.schema.json +1 -1
  96. package/schemas/scenario-suite.schema.json +1 -1
  97. package/schemas/scenario-test-input.schema.json +1 -1
  98. package/schemas/script-validate-input.schema.json +7 -1
  99. package/schemas/shared-scenario.schema.json +1 -1
  100. package/schemas/source-lookup-input.schema.json +1 -1
  101. package/server.json +2 -2
@@ -410,6 +410,12 @@ export const worldPartitionTuningSchema = z
410
410
  .max(64)
411
411
  .optional()
412
412
  .describe('A sea channel at most this wide gets two sea provinces across it; default 24.'),
413
+ areaByRow: z
414
+ .array(z.tuple([z.number().min(0).max(1), z.number().min(0.25).max(8)]))
415
+ .min(1)
416
+ .max(32)
417
+ .optional()
418
+ .describe('[row, factor] points, row 0 the top edge and 1 the bottom, in increasing row order: the land province area at a row is multiplied by the factor, linearly between points and held beyond the ends, after the plan is scaled to the base area. States keep their province counts, so they grow by the same factor. MAP_PARTITION_AREA_BY_ROW reports the mean province area per band.'),
413
419
  })
414
420
  .strict();
415
421
  const moveStateDistributionSchema = z
@@ -786,6 +792,10 @@ const territoryCountrySchema = z
786
792
  .optional()
787
793
  .describe('Strategic regions this country prefers to grow in.'),
788
794
  overlord: tagSchema.optional().describe('Grow this country inside its overlord.'),
795
+ fixed: z
796
+ .boolean()
797
+ .optional()
798
+ .describe('The country owns exactly its seeds and forced land and never grows, for a realm whose land is already settled.'),
789
799
  mergeInto: tagSchema
790
800
  .optional()
791
801
  .describe('Relabel the finished territory to another listed country (this tag stays a core).'),
@@ -852,6 +862,25 @@ const territoryOperation = z
852
862
  remapReferences: z.enum(['refuse', 'override']).optional(),
853
863
  borderQuality: borderQualityModeSchema.default('report'),
854
864
  borderTargets: borderTargetsSchema.optional(),
865
+ groups: z
866
+ .record(z.string().regex(/^\d{1,6}$/u), z.string().min(1).max(64))
867
+ .refine((value) => Object.keys(value).length <= 65_000, 'At most 65,000 provinces')
868
+ .optional()
869
+ .describe('Culture or people group of provinces, { provinceId: group }. Growth across a group boundary costs like a ridge (groupPenalty), or never happens with groupHard. A state atom takes the group of most of its provinces.'),
870
+ groupPenalty: z
871
+ .number()
872
+ .min(0)
873
+ .max(100)
874
+ .optional()
875
+ .describe('A step across a group boundary costs 1 + groupPenalty times more; default 2.'),
876
+ groupHard: z
877
+ .boolean()
878
+ .optional()
879
+ .describe('Growth never crosses a group boundary, so a people keeps its own countries.'),
880
+ strictTags: z
881
+ .boolean()
882
+ .optional()
883
+ .describe('Refuse the operation when a country or overlord tag is not declared in common/country_tags; by default that is a warning (MAP_TERRITORY_TAG_UNDEFINED).'),
855
884
  })
856
885
  .strict();
857
886
  const repartitionOperation = z
@@ -1181,6 +1210,10 @@ export const mapOperationSchema = z.discriminatedUnion('kind', [
1181
1210
  kind: z
1182
1211
  .literal('record_world_outputs')
1183
1212
  .describe('Adopt the current bytes of every output the world inventory (.hoi4-agent-world.json) records, so the next create_world overwrites them instead of refusing them as edited (MANAGED_OUTPUT_EDITED). Recorded files that are gone are dropped. Reports MAP_WORLD_OUTPUTS_RECORDED.'),
1213
+ adoptUnrecorded: z
1214
+ .boolean()
1215
+ .optional()
1216
+ .describe('Add the files of the mod at world output paths (state files, strategic regions, map files, world localisation) that the record lacks, for example ones earlier operations created. Default true; false only re-hashes the listed entries.'),
1184
1217
  })
1185
1218
  .strict(),
1186
1219
  z
@@ -221,6 +221,55 @@ export const sourceLookupEngineResponseSchema = z
221
221
  suggestionCandidates: z
222
222
  .array(z.object({ id: z.string(), distance: z.number().int().min(0).max(3) }).strict())
223
223
  .max(2_000),
224
+ /** With `includeReferences`: the first `maxReferences` references, in the TypeScript order. */
225
+ references: z
226
+ .array(z
227
+ .object({
228
+ kind: z.string(),
229
+ from: z.string(),
230
+ toKind: z.string(),
231
+ path: z.string(),
232
+ line: z.number().int().min(1),
233
+ })
234
+ .strict())
235
+ .max(20)
236
+ .default([]),
237
+ /** Distinct references to the symbol (of the requested kind), all of them. */
238
+ referenceCount: z.number().int().min(0).default(0),
239
+ /** False when the semantic scan skipped a source or reached a ceiling. */
240
+ semanticComplete: z.boolean().default(true),
241
+ /** Dynamic targets the semantic scan could not resolve, in the whole scan. */
242
+ unresolvedReferenceCount: z.number().int().min(0).default(0),
243
+ })
244
+ .strict();
245
+ /** `hoi4-engine closure` (`hoi4-closure/1`): what the shared Rust engine answers. */
246
+ export const closureEngineResponseSchema = z
247
+ .object({
248
+ schema: z.literal('hoi4-closure/1'),
249
+ status: z.literal('ok'),
250
+ revision: z.string().regex(/^[0-9a-f]{64}$/u),
251
+ complete: z.boolean(),
252
+ skippedSourceCount: z.number().int().min(0),
253
+ semanticComplete: z.boolean(),
254
+ verdict: z.enum(['closed', 'unresolved', 'incomplete']),
255
+ sources: z.number().int().min(0),
256
+ totals: z
257
+ .object({
258
+ resolved: z.number().int().min(0),
259
+ unresolved: z.number().int().min(0),
260
+ unknown: z.number().int().min(0),
261
+ })
262
+ .strict(),
263
+ kinds: z
264
+ .array(z
265
+ .object({
266
+ kind: z.string(),
267
+ resolved: z.number().int().min(0),
268
+ unresolved: z.number().int().min(0),
269
+ unknown: z.number().int().min(0),
270
+ })
271
+ .strict())
272
+ .max(64),
224
273
  })
225
274
  .strict();
226
275
  /** `hoi4-engine mod-index` (`hoi4-mod-index/1`): what the shared Rust engine answers. */
@@ -18,7 +18,7 @@ export const referenceSearchRequestSchema = z
18
18
  workspaceId: workspaceIdSchema,
19
19
  query: z.string().trim().min(2).max(160),
20
20
  sources: z.array(referenceSourceSchema).min(1).max(3).optional(),
21
- limit: z.number().int().min(1).max(12).default(6),
21
+ limit: z.number().int().min(1).max(12).default(10),
22
22
  })
23
23
  .strict();
24
24
  export const referenceReadRequestSchema = z
@@ -30,14 +30,32 @@ export const scriptValidateRequestSchema = z
30
30
  .max(16)
31
31
  .default([]),
32
32
  limit: z.number().int().min(1).max(32).default(12),
33
+ /**
34
+ * Whole-mod closure: count the references of the mod's own sources that resolve, do not
35
+ * resolve, or cannot be decided, per target kind, and give a verdict (`incomplete` whenever
36
+ * anything is unknown). Replaces `source` and `path`.
37
+ */
38
+ closure: z.boolean().optional(),
33
39
  })
34
40
  .strict()
35
41
  .superRefine((value, context) => {
36
- if ((value.source === undefined) === (value.path === undefined))
42
+ const modes = [
43
+ value.source !== undefined,
44
+ value.path !== undefined,
45
+ value.closure === true,
46
+ ].filter(Boolean).length;
47
+ if (modes !== 1)
37
48
  context.addIssue({
38
49
  code: 'custom',
39
50
  path: ['source'],
40
- message: 'Provide either source with kind and scope, or a mod file path',
51
+ message: 'Provide either source with kind and scope, a mod file path, or closure: true for the whole mod',
52
+ });
53
+ if (value.closure === true &&
54
+ (value.kind !== undefined || value.scope !== undefined || value.bindings.length > 0))
55
+ context.addIssue({
56
+ code: 'custom',
57
+ path: ['closure'],
58
+ message: 'A closure check covers the whole mod and takes no kind, scope or bindings',
41
59
  });
42
60
  if (value.source !== undefined && value.scope === undefined)
43
61
  context.addIssue({
@@ -64,12 +82,14 @@ export const scriptValidateDataSchema = z
64
82
  'event_popups',
65
83
  'known_mistakes',
66
84
  'identifier_arguments',
85
+ 'closure',
67
86
  ])),
68
87
  /**
69
88
  * Identifier arguments (ideas, events, decisions, focuses, technologies) were checked against
70
89
  * the workspace's definitions. Other argument values are not checked.
71
90
  */
72
91
  parametersChecked: z.boolean(),
92
+ /** Absent for a closure check, which reads no documentation. */
73
93
  documentation: z
74
94
  .object({
75
95
  source: z.enum(['game_doc', 'script_doc']),
@@ -78,7 +98,8 @@ export const scriptValidateDataSchema = z
78
98
  triggerCount: z.number().int().min(0),
79
99
  skippedSources: z.number().int().min(0),
80
100
  })
81
- .strict(),
101
+ .strict()
102
+ .optional(),
82
103
  findings: z
83
104
  .array(z
84
105
  .object({
@@ -103,6 +124,39 @@ export const scriptValidateDataSchema = z
103
124
  argumentBlocksUnchecked: z.number().int().min(0),
104
125
  /** What made the result partial when `valid` is null, one plain sentence each. */
105
126
  partialReasons: z.array(z.string().max(600)).max(5).optional(),
127
+ /** The whole-mod closure (`closure: true`). */
128
+ closure: z
129
+ .object({
130
+ verdict: z.enum(['closed', 'unresolved', 'incomplete']),
131
+ /** The scan revision, as `hoi4.source_lookup` reports it. */
132
+ revision: z.string().regex(/^[a-f0-9]{64}$/u),
133
+ /** False when a source was skipped, so a definition may be missing. */
134
+ complete: z.boolean(),
135
+ /** False when the semantic scan skipped a source or reached a ceiling. */
136
+ semanticComplete: z.boolean(),
137
+ skippedSourceCount: z.number().int().min(0),
138
+ /** Mod-owned sources whose references were counted. */
139
+ sources: z.number().int().min(0),
140
+ totals: z
141
+ .object({
142
+ resolved: z.number().int().min(0),
143
+ unresolved: z.number().int().min(0),
144
+ unknown: z.number().int().min(0),
145
+ })
146
+ .strict(),
147
+ kinds: z
148
+ .array(z
149
+ .object({
150
+ kind: z.string().max(64),
151
+ resolved: z.number().int().min(0),
152
+ unresolved: z.number().int().min(0),
153
+ unknown: z.number().int().min(0),
154
+ })
155
+ .strict())
156
+ .max(64),
157
+ })
158
+ .strict()
159
+ .optional(),
106
160
  file: z
107
161
  .object({
108
162
  path: z.string().max(4096),
@@ -4,6 +4,7 @@ import { compareCodeUnits, hashCanonical } from '../core/canonical.js';
4
4
  import { emptyServiceResult } from '../core/result.js';
5
5
  import { setInlineFilesScanned } from '../core/operation-result.js';
6
6
  import { technologyCompareRequestSchema, technologyInspectRequestSchema, splitTechnologyInspectRequest, technologyRenderRequestSchema, } from '../schemas/technology.js';
7
+ import { technologyExplainSummary } from './queries.js';
7
8
  import { technologyDiagnostics } from './service.js';
8
9
  export function normalizeTechnologyInspectionRequest(input) {
9
10
  return JSON.parse(JSON.stringify(technologyInspectRequestSchema.parse(input)));
@@ -107,6 +108,10 @@ export async function inspectTechnologies(viewer, input) {
107
108
  graphHash: technologyGraphHash(output.graph),
108
109
  counts: technologyCounts(output.graph, output.artifacts.length),
109
110
  ...(output.helperExpansion === undefined ? {} : { helperExpansion: output.helperExpansion }),
111
+ ...(() => {
112
+ const technology = input.mode === 'explain' ? technologyExplainSummary(output.report) : undefined;
113
+ return technology === undefined ? {} : { technology };
114
+ })(),
110
115
  });
111
116
  result.code =
112
117
  (output.helperExpansion?.complete ?? output.graph.complete)
@@ -213,6 +213,9 @@ export function traceTechnology(graph, input) {
213
213
  };
214
214
  }
215
215
  export function explainTechnology(graph, technologyId, signal) {
216
+ return explainTechnologyReport(graph, technologyId, signal);
217
+ }
218
+ function explainTechnologyReport(graph, technologyId, signal) {
216
219
  requireTechnology(graph, technologyId);
217
220
  const technology = graph.technologies.find(({ id }) => id === technologyId);
218
221
  const prerequisites = traceTechnology(graph, {
@@ -369,3 +372,54 @@ export function analyzeTechnologyImpact(graph, input) {
369
372
  limitations: graph.analysisBoundary.unsupportedConstructs,
370
373
  };
371
374
  }
375
+ /** Names listed inline per relation; the full lists are in the linked report. */
376
+ const EXPLAIN_SUMMARY_LIST_LIMIT = 20;
377
+ function limited(values) {
378
+ const sorted = [...new Set(values)].sort(compareCodeUnits);
379
+ return {
380
+ values: sorted.slice(0, EXPLAIN_SUMMARY_LIST_LIMIT),
381
+ cut: sorted.length > EXPLAIN_SUMMARY_LIST_LIMIT,
382
+ };
383
+ }
384
+ /**
385
+ * The inline part of an explanation, so the answer names what the agent asked for without the
386
+ * linked report: the direct prerequisites, what the technology leads to, its exclusive choices and
387
+ * unlocks (each at most 20 names), and the totals of the full report.
388
+ */
389
+ export function technologyExplainSummary(report) {
390
+ if (typeof report !== 'object' || report === null || !('technology' in report))
391
+ return undefined;
392
+ const explained = report;
393
+ const { technology } = explained;
394
+ const prerequisites = limited(explained.directPrerequisites.map(({ from }) => from));
395
+ const leadsTo = limited(explained.directDescendants.map(({ to }) => to));
396
+ const exclusiveWith = limited(explained.exclusiveChoices.map(({ from, to }) => (from === technology.id ? to : from)));
397
+ const unlocks = [...explained.unlocks]
398
+ .sort((left, right) => compareCodeUnits(left.kind, right.kind) || compareCodeUnits(left.targetId, right.targetId))
399
+ .map(({ kind, targetId }) => ({ kind, targetId }));
400
+ return {
401
+ id: technology.id,
402
+ path: technology.source.path,
403
+ line: technology.source.location.start.line,
404
+ ...(technology.localisation.name === undefined ? {} : { name: technology.localisation.name }),
405
+ ...(technology.startYear === undefined ? {} : { startYear: technology.startYear }),
406
+ ...(technology.researchCost === undefined ? {} : { researchCost: technology.researchCost }),
407
+ folders: [...technology.folders].sort(compareCodeUnits),
408
+ categories: [...technology.categories].sort(compareCodeUnits),
409
+ prerequisites: prerequisites.values,
410
+ leadsTo: leadsTo.values,
411
+ exclusiveWith: exclusiveWith.values,
412
+ unlocks: unlocks.slice(0, EXPLAIN_SUMMARY_LIST_LIMIT),
413
+ allPrerequisites: explained.transitivePrerequisites.nodes.length - 1,
414
+ allDescendants: explained.descendants.nodes.length - 1,
415
+ unlockCount: unlocks.length,
416
+ grantedBy: explained.externalGrants.length,
417
+ issues: explained.issues.length,
418
+ truncated: prerequisites.cut ||
419
+ leadsTo.cut ||
420
+ exclusiveWith.cut ||
421
+ unlocks.length > EXPLAIN_SUMMARY_LIST_LIMIT ||
422
+ explained.transitivePrerequisites.truncated ||
423
+ explained.descendants.truncated,
424
+ };
425
+ }
@@ -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.16.0';
3
+ export const PACKAGE_VERSION = '4.17.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;
@@ -24,7 +24,7 @@ In every other case a missing or unreadable file stops startup with `CONFIG_READ
24
24
  The automatic configuration works like this:
25
25
 
26
26
  - Starting from the server's working directory and moving up through its parents, the server takes the first folder that looks like a mod: it has `descriptor.mod`, a standard `common/` subfolder such as `common/national_focus`, or a standard content folder such as `events/` or `localisation/` with matching files.
27
- The search stops at a game installation (a folder with `hoi4.exe`, `run_hoi4` or `steam_appid.txt`), and startup fails with `AUTO_MOD_ROOT_NOT_FOUND` when nothing is found.
27
+ The search stops at a game installation (a folder with `hoi4.exe`, `run_hoi4` or `steam_appid.txt`), and, when nothing is found, the server still starts with no workspace: the documentation tools (`hoi4.reference_search`, `hoi4.reference_read`, `hoi4.reference_context`) answer from the game and the fetched docs pack, and every mod tool answers `WORKSPACE_CONTEXT_NOT_FOUND`.
28
28
  - That folder becomes the only workspace, with the ID `auto_<folder name>`.
29
29
  - The game folder is the first existing folder among `HOI4_GAME_ROOT` and the standard Steam locations on Windows, Linux and macOS.
30
30
  - Server state and generated files use the default storage locations below.
package/docs/map.md CHANGED
@@ -398,16 +398,17 @@ Nothing is lost or duplicated: for any split, merge or move, the sums of manpowe
398
398
  }
399
399
  ```
400
400
 
401
- | Field of a country | Meaning |
402
- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
403
- | `tag`, `weight` | Three capital letters or digits, and the relative target size (default 1). |
404
- | `seeds` | `{ state }`, `{ province }` or a pixel `{ x, y }` of the province map; the first is the capital. A seed in the sea is refused. |
405
- | `forced`, `blocked` | `{ stateIds, provinceIds, regionIds }`: land the country always or never owns. `regionIds` are strategic regions. |
406
- | `regions` | Strategic regions the country prefers to grow in (a step into another country's preferred region costs more). |
407
- | `overlord`, `mergeInto` | A subject is grown inside its overlord's territory. `mergeInto` relabels the finished territory to another listed country and keeps its tag as a core. |
408
- | `cores`, `claims` | Extra states the country holds a core on or claims. |
409
-
410
- Top-level fields: `unit` (`state`, the default, assigns whole states; `province` assigns provinces and regroups the states a border cuts), `scope` (`stateIds`, `regionIds`, `owners`: only these states take part), `unowned` (land nobody owns), `barriers` (`natural` or `none`, which grows on distance alone), `rules.connectedMainland` (default true) and `rules.islandPolicy` (`one-owner`, `nearest` or `unowned` for landmasses without a seed), `smoothing` (`passes` 0 to 20, `maxShareChange`), `shareTolerance` (default 0.15), `seed` (the same seed gives the same borders), `ownership` (`controller`: `owner` or `keep`; `cores`: `keep`, `owner` or `add-owner`; `claims`: `keep` or `clear`; `unowned`: `clear` or `keep`), `stateSize` (province unit: fragments below `min` provinces join a neighbour of the same owner and strategic region), `remapReferences` (`refuse` or `override`, as for `merge_states`), `borderQuality` and `borderTargets`.
401
+ | Field of a country | Meaning |
402
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
403
+ | `tag`, `weight` | Three capital letters or digits, and the relative target size (default 1). A tag no `common/country_tags` file declares is assigned with a warning (`MAP_TERRITORY_TAG_UNDEFINED`), or refused with top-level `strictTags: true`. |
404
+ | `seeds` | `{ state }`, `{ province }` or a pixel `{ x, y }` of the province map; the first is the capital. A seed in the sea is refused. |
405
+ | `forced`, `blocked` | `{ stateIds, provinceIds, regionIds }`: land the country always or never owns. `regionIds` are strategic regions. |
406
+ | `regions` | Strategic regions the country prefers to grow in (a step into another country's preferred region costs more). |
407
+ | `overlord`, `mergeInto` | A subject is grown inside its overlord's territory. `mergeInto` relabels the finished territory to another listed country and keeps its tag as a core. |
408
+ | `cores`, `claims` | Extra states the country holds a core on or claims. |
409
+ | `fixed` | The country owns exactly its seeds and `forced` land and never grows, for a realm whose land is settled. Smoothing and corridors leave it alone. |
410
+
411
+ Top-level fields: `unit` (`state`, the default, assigns whole states; `province` assigns provinces and regroups the states a border cuts), `scope` (`stateIds`, `regionIds`, `owners`: only these states take part), `unowned` (land nobody owns), `barriers` (`natural` or `none`, which grows on distance alone), `rules.connectedMainland` (default true) and `rules.islandPolicy` (`one-owner`, `nearest` or `unowned` for landmasses without a seed), `smoothing` (`passes` 0 to 20, `maxShareChange`), `shareTolerance` (default 0.15), `seed` (the same seed gives the same borders), `ownership` (`controller`: `owner` or `keep`; `cores`: `keep`, `owner` or `add-owner`; `claims`: `keep` or `clear`; `unowned`: `clear` or `keep`), `stateSize` (province unit: fragments below `min` provinces join a neighbour of the same owner and strategic region), `remapReferences` (`refuse` or `override`, as for `merge_states`), `borderQuality` and `borderTargets`. `groups` (`{ provinceId: group }`) draws culture or people lines: a growth step across one costs `1 + groupPenalty` times more (default 2), like a ridge, so borders move to the lines but balancing can still cross them; with `groupHard: true` growth never crosses a line, so a people's pocket is never entered from outside. A state takes the group of most of its provinces. Besides `map-territory-report.json`, the result has `map-territory-assignment.json`: the provinces of each owner and of each new or changed state, compact enough to read after a preview. A seed in water is refused with the nearest land province in the message and `details.nearestLandProvince`.
411
412
 
412
413
  How it works: a multi-source shortest-path growth from the seeds over the province or state graph, where a step costs the distance between centres times `1 + 6 * barrier` (the barrier is the strength of the rivers, slopes, lake shores and terrain changes along the shared border, measured by the metric of [Border naturalness](#border-naturalness)); country multipliers are corrected until sizes are within the tolerance of their targets; a country cut apart on its capital's landmass is joined by a corridor; and a local search moves boundary atoms when that shortens the artificial border without disconnecting the donor or leaving the size tolerance. Targets follow the weights, corrected for what the land allows (a country alone on an island owns the island).
413
414
 
@@ -527,7 +528,7 @@ Continents are the largest landmasses, numbered `world_continent_1` and up and n
527
528
 
528
529
  Each write records its generated files in `.hoi4-agent-world.json`. A later `create_world` deletes the recorded files it no longer writes (retires them) in the same transaction and refuses with `MANAGED_OUTPUT_EDITED` when a recorded file was edited since. `MAP_WORLD_OUTPUTS_RECONCILED` and `data.outputs` give the counts of written, retired and released files with up to 200 paths each; `map-world-outputs.json` lists them all.
529
530
 
530
- Every map rewrite keeps that record current with its own edits. When `update_states`, `move_state_provinces` or any other operation writes a recorded file, in a later call or later in the `create_world` call, the same transaction records the file's new hash (`MAP_WORLD_OUTPUTS_REFRESHED`), and a recorded file it deletes leaves the record. A recorded file that was edited by hand before the call keeps its old hash, and the note is then a warning that names it, so the next `create_world` still refuses it. To take the current bytes of every recorded file as the world's own, for example in a mod whose record a version before 4.16.0 left stale, run `{ "kind": "record_world_outputs" }`. It changes only `.hoi4-agent-world.json`, drops recorded files that are gone, and reports the counts in `MAP_WORLD_OUTPUTS_RECORDED`. Afterwards the next `create_world` overwrites those files without refusing them. Without a record it is refused with `MAP_WORLD_OUTPUTS_MISSING`. Edits made through other tools (localisation, GUI, focus) are not recorded.
531
+ Every map rewrite keeps that record current with its own edits. When `update_states`, `move_state_provinces` or any other operation writes a recorded file, in a later call or later in the `create_world` call, the same transaction records the file's new hash (`MAP_WORLD_OUTPUTS_REFRESHED`), a recorded file it deletes leaves the record, and a file it creates where the world keeps its outputs (state files, strategic regions, map files, world localisation; not country files) joins the record. A recorded file that was edited by hand before the call keeps its old hash, and the note is then a warning that names it, so the next `create_world` still refuses it. To take the current bytes of every recorded file as the world's own, for example in a mod whose record a version before 4.16.0 left stale, run `{ "kind": "record_world_outputs" }`. It changes only `.hoi4-agent-world.json`, drops recorded state and strategic-region files that are gone, keeps other recorded files it did not read (`unscannedPaths`) with their recorded hash, and reports the counts in `MAP_WORLD_OUTPUTS_RECORDED`. It reads the bitmaps, colour maps and world scripts as `create_world` does. It also adds the mod's files at those paths that the record lacks, such as state files created before this fix, and lists them in `addedPaths`; `"adoptUnrecorded": false` re-hashes the listed entries only. Afterwards the next `create_world` overwrites those files without refusing them. Without a record it is refused with `MAP_WORLD_OUTPUTS_MISSING`. Edits made through other tools (localisation, GUI, focus) are not recorded.
531
532
 
532
533
  Every applied map rewrite also returns `data.changedSummary` with the number of changed files (`total`, `created`, `removed`, `modified`) and the same counts for the 40 folders with the most changes (two levels deep, `.` for the mod root, `omittedFolders` for the rest), so the size of a write is visible even when the inline `changedFiles` list is cut.
533
534
 
@@ -583,6 +584,7 @@ By default provinces grow evenly from spread seeds and states and regions grow b
583
584
 
584
585
  - 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.
585
586
  - 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.
587
+ - `areaByRow` scales the land province area by position: `[row, factor]` points, row 0 at the top edge and 1 at the bottom, in increasing row order, with factors from 0.25 to 8, linear between the points and held beyond the ends. The factor multiplies the area after the plan is scaled to `landProvincePixels`, so rows with factor 1 keep their sizes. States keep their province counts, so they grow by the same factor. `[[0, 3], [0.3, 1.6], [0.45, 1], [1, 1]]` gives provinces about three times larger at the top edge and the usual size from the middle south. On a 512 by 256 test world the northern band (rows 0 to 0.3) had a mean of 246 pixels against 116 in the south, and 138 states instead of 171. `MAP_PARTITION_AREA_BY_ROW` reports, for each band between two points, the land provinces whose centre lies there, their mean area and its ratio to the band with the smallest factor; out-of-order rows or factors outside the range are refused with `MAP_PARTITION_AREA_BY_ROW_INVALID`. The area cap of an eighth of the map still applies.
586
588
  - 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`.
587
589
  - `barrierStrength` (0 to 60, default 20) sets how hard borders are pulled onto natural lines; `minProvincePixels` (default 40) is the smallest planned province.
588
590
 
@@ -217,6 +217,70 @@ Run the fresh set with:
217
217
  npx tsx scripts/evaluate-reference-discovery.ts MOD_ROOT GAME_ROOT --fresh
218
218
  ```
219
219
 
220
+ ## Plain-word questions, connector words and player vocabulary (issue 64)
221
+
222
+ Measured on 2026-11-13 on HOI4 1.19.4.1 with the kit's `hoi4_wiki` pack (66 pages).
223
+ A fresh author wrote 48 questions the way a new modder asks them, from the documentation alone, without seeing the ranking code or any result, and checked each answer line by hand.
224
+ The cases are in `scripts/reference-common-cases.ts`: 23 for tuning (`--common-dev`: 20 answerable questions and exact names, 3 negatives) and 24 kept untouched until the change was final (`--common-blind`: 22 answerable, 2 negatives).
225
+ The author's own list missed one acceptable answer for "temporary bonus" (the `add_timed_idea` example on the idea page), which was added to the tuning half only.
226
+
227
+ Three changes were kept, each because it helped without losing an answer on any earlier set:
228
+
229
+ - **Connector words.** `has_war_with`, `is_owned_by` and `num_of_factories` carry a relation in a little word that the content-word model drops. A question that says that word and names every other word of the command name earns a bonus, so "at war with" prefers `has_war_with` over `has_annex_war_goal`.
230
+ - **Exact names.** A console command, a define or a variable with the same name as a trigger or an effect no longer ties it at the top score. The trigger or effect stays first unless the question asks for the other kind.
231
+ - **Player vocabulary.** A small table maps words players use to words scripts use: sea to coastal, temporary to timed, vassal to puppet, spirit to idea, owner to owned, fighting to war, and about twenty more. They add terms at 0.7 of the weight of a word the question itself uses.
232
+
233
+ | Set (HOI4 1.19.4.1) | First before | First after | Within three before | Within three after |
234
+ | ---------------------------------------------- | -----------: | ----------: | ------------------: | -----------------: |
235
+ | Common questions, tuning half (20) | 9 | 12 | 15 | 15 |
236
+ | Common questions, blind half (22, scored once) | 12 | 13 | 16 | 16 |
237
+ | Fresh blind set of ADR 0078 (38) | 17 | 19 | 23 | 22 |
238
+ | Held-out (24) | 9 | 11 | 15 | 15 |
239
+ | Validation (24) | 18 | 19 | 20 | 20 |
240
+ | Test (40) and discovery (37) | 25 | 25 | 31 and 28 | 31 and 28 |
241
+
242
+ Exact names went from 3 of 4 to 4 of 4 first on the fresh set and from 1 of 2 to 2 of 2 on the tuning half. The blind half's three exact names stayed first.
243
+
244
+ Tried and not kept:
245
+
246
+ - Making "another" a stop word. It moved "give a state to another country" and a diplomatic opinion question out of the top five.
247
+ - British spellings as synonyms (`neighbour`, `colour`), which pushed a correct answer from second to fifth.
248
+ - A minimum share of the question's rare-word weight that an answer must match, to silence negatives such as "roast a turkey". It dropped a correct "access to the sea" answer on the held-out set and left the negatives alone.
249
+ - A table of multi-word phrasings ("access to the sea", "share a border", "free a puppet"). It changed no rank on any set.
250
+
251
+ Still missing: "check that my country is currently fighting a war" ranks `has_war` outside the top twelve, because commands that repeat several words of a long question outscore the short, exact one. Two unrelated queries ("how to adjust the gears on a bicycle", "how long should I roast a turkey per kilo") still return results, as the nonsense queries of the earlier rounds do. The target of issue 64 (22 of 24 first, all in the top three) is not met: about 60 percent of the blind half is first and 73 percent is in the top three.
252
+
253
+ Run the new sets with `npx tsx scripts/evaluate-reference-discovery.ts MOD_ROOT GAME_ROOT --common-dev` and `--common-blind`. The blind half has now been scored once, so the next round needs a new one.
254
+
255
+ ## Ten phrasings per command, a second blind set, and ten candidates (issue 64, round four)
256
+
257
+ Measured on 2026-11-14 on HOI4 1.19.4.1 with the kit's `hoi4_wiki` pack.
258
+ The direction, recorded on the issue: no runtime embeddings (a model download and a runtime dependency for a tool hobbyists install), a deterministic runtime, more phrasing data written at build time, and a fresh blind set that never saw that data.
259
+
260
+ **Data.** Twelve writers, one batch of about 100 each, wrote six new plain-word phrasings for every one of the 1,127 documented effects and triggers (6,747 added, none dropped by the checks: three to ten words, no command name, no underscore). Each writer saw only its batch with the documentation text and the existing phrasings. Modifiers were not part of this round and keep four. A sample reads like real questions ("fill the army chief slot with a character" for `activate_advisor`, "give a subject flat freedom points" for `add_autonomy_score`), and the output was checked by script, not item by item. With ten phrasings instead of four the per-term weight was too high, so `PHRASE_WEIGHT` went from 4 to 2. The weight was chosen on the older sets before the new blind set was looked at (3 and 2 tied on total first-place answers, 99 each across five sets).
261
+
262
+ **Blind set.** `scripts/reference-common-blind2-cases.ts` (`--common-blind2`) holds 48 questions written by a fresh author who saw no ranking code, no phrasing data and no results. It leans on the long tail (17 effects, 11 triggers, 5 modifiers, 7 wiki concepts, 3 exact names, 5 negatives). It was scored once before and once after the data change.
263
+
264
+ **How a hit is counted.** The first version of this evaluation matched a hit to the answer's documentation file, so a question whose author listed only `effects_documentation.md` counted `effects.md#add_timed_idea` (the same command, from the wiki table) as a miss. That under-counted every set whose author listed one file, and it made this round look weaker than it is (first place on the new set read 12 to 14 of 43). With `EVAL_BY_COMMAND=1` a result answers a question when it is the same command under any documentation file. The tables below use that.
265
+
266
+ | Set (HOI4 1.19.4.1, answerable questions) | First before / after | Within three | Within five | Within ten |
267
+ | ----------------------------------------- | -------------------: | -----------: | ----------: | ---------: |
268
+ | New blind set (43) | 23 / 31 | 30 / 36 | 33 / 37 | 36 / 39 |
269
+ | Common questions, first blind half (22) | 14 / 15 | 17 / 19 | 18 / 19 | 19 / 21 |
270
+ | Common questions, tuning half (20) | 14 / 16 | 16 / 18 | 17 / 18 | 19 / 19 |
271
+ | ADR 0078 fresh set (38) | 19 / 23 | 23 / 27 | 27 / 30 | 30 / 31 |
272
+ | Held-out (24) | 11 / 11 | 15 / 16 | 20 / 19 | 23 / 22 |
273
+ | Test (40) | 25 / 25 | 31 / 30 | 32 / 32 | 36 / 34 |
274
+ | Discovery (37) | 27 / 28 | 30 / 30 | 32 / 33 | 33 / 34 |
275
+ | Validation (24) | 21 / 21 | 22 / 22 | 22 / 22 | 24 / 24 |
276
+
277
+ On the two blind sets the right answer is among the first ten hits 21 of 22 times (95 percent) and 39 of 43 times (91 percent), and first on 15 of 22 and 31 of 43 (72 percent). The older sets, written for the earlier rounds, put it in the top ten between 82 and 100 percent of the time. Exact names stay first and the negatives return what they returned before.
278
+
279
+ **Ten short candidates.** The caller is an agent, which reads ten short lines as easily as one. `hoi4.reference_search` now returns up to ten hits by default (twelve at most), and a hit for an installed-documentation command carries a one-line meaning with the scopes it works in as its excerpt ("COUNTRY: Add a time-limited idea to country in scope"), a wiki table row carries its description cell, and the tool description tells the agent to read the candidates and pick the one that fits. A reply of ten hits is about 6 KB. Where the description is only script, the excerpt stays the plain best-matching lines.
280
+
281
+ Tried and not kept this round: doubling the weight of the per-command phrasing cards (mixed on every set).
282
+ Still missing: "check that my country is currently fighting a war" ranks `has_war` outside the first twelve, and nonsense questions still return a few weak hits.
283
+
220
284
  ## Compact context budgets
221
285
 
222
286
  A 2026-09-27 check of the installed 3.5.0 server found that eight GUI results could contain only wiki sections even though the installed GUI documentation was available. The 3.5.1 source qualifies limits of one, two, and eight citations across the same six work surfaces. All eighteen cases retained installed documentation; limits of two or more also retained wiki citations. Required sources excluded by the limit appeared in `omittedSources`, separately from files absent under `missing`. The nine search queries still found all expected answer-bearing sections.
package/docs/tools.md CHANGED
@@ -20,25 +20,25 @@ A test fails when this page differs from `tools/list`, so edit the tool descript
20
20
 
21
21
  ## References and source
22
22
 
23
- | Tool | Purpose | Writes |
24
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
25
- | `hoi4.reference_context` | Find documentation for the content you are building: events, decisions, ideas, focuses, technology, GUI, maps, localisation or AI. | — |
26
- | `hoi4.reference_search` | Find the right modding rule in the offline wiki and installed game docs using ordinary words or script names. Each hit includes its file, lines, revision and answering line. | — |
27
- | `hoi4.reference_read` | Read a documentation section returned by reference_search or reference_context. Pass its id and revision. | — |
28
- | `hoi4.source_lookup` | Find where a script symbol is defined and used across the game, DLC and mod. Pass a symbol, or a file path and line. | — |
29
- | `hoi4.script_validate` | Find broken syntax, commands and scopes in an effect, trigger or mod file using the installed docs. Unknown helpers and native argument blocks stay unresolved. | — |
30
- | `hoi4.error_log` | Find errors from the last game launch and group them by category, with source files, lines and fix hints. Show which files changed since the log and which errors appeared after a relaunch; mod entries come first. | — |
31
- | `hoi4.explain_error` | Explain error.log lines: the rule each one breaks, its file and line with the lines around it, and the fix, from a reviewed catalogue of the game's messages. Says whether the game documents the command a line names, and the closest documented names. | — |
32
- | `hoi4.mod_health` | Check a whole mod in one call: the last error.log, the engine check (unknown effects, triggers and modifiers, duplicate ids, broken overrides), script validation, and the localisation and asset audits. Returns the 10 problems that matter most, each counted with 2 examples, its fix and the tool to use next, and which audits ran. | — |
33
- | `hoi4.script_guard` | Check the files you wrote for invented commands: every effect, trigger and modifier that the installed game documentation does not list and no loaded file defines, with its file, line and the closest real name. Checks the named paths, or the mod script files changed in the last 120 minutes. Needs hoi4-engine. | — |
34
- | `hoi4.compat_check` | mod: compare this mod with another in both load orders: files at the same path and who wins, duplicate ids, definitions and hooks dropped, replace_path losses, and which order loses less. patch: store the vanilla files the mod overrides and list those a game update changed. | — |
35
- | `hoi4.mod_index` | Summarize the content in a mod or find a free event ID across the mod, game and dependencies. Use overview for descriptors, folders and definitions, or next_id with a namespace or prefix. | — |
36
- | `hoi4.localisation_inspect` | 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. | — |
37
- | `hoi4.idea_inspect` | 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. | — |
38
- | `hoi4.system_inspect` | 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. | — |
39
- | `hoi4.unit_inspect` | 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. | — |
40
- | `hoi4.asset_inspect` | 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. | — |
41
- | `hoi4.skill` | List the modding skills installed in the mod, or load one by name, at the kit version HOI4 Mod Setup pinned, with its hash. A file edited since Setup installed it is refused unless acceptLocalEdits. | — |
23
+ | Tool | Purpose | Writes |
24
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
25
+ | `hoi4.reference_context` | Find documentation for the content you are building: events, decisions, ideas, focuses, technology, GUI, maps, localisation or AI. | — |
26
+ | `hoi4.reference_search` | Find a modding rule in the offline wiki and installed game docs by plain words or script name. Returns up to 10 short candidates (limit up to 12) with file, lines, revision and, for a command, a one-line meaning and its scopes. Pick the one that fits, since several commands sound alike, then read it with hoi4.reference_read using its id and revision. | — |
27
+ | `hoi4.reference_read` | Read a documentation section returned by reference_search or reference_context. Pass its id and revision. | — |
28
+ | `hoi4.source_lookup` | Find where a script symbol is defined and used across the game, DLC and mod. Pass a symbol, or a file path and line. | — |
29
+ | `hoi4.script_validate` | Find broken syntax, commands and scopes in an effect, trigger or mod file using the installed docs. Unknown helpers and native argument blocks stay unresolved. | — |
30
+ | `hoi4.error_log` | Find errors from the last game launch and group them by category, with source files, lines and fix hints. Show which files changed since the log and which errors appeared after a relaunch; mod entries come first. | — |
31
+ | `hoi4.explain_error` | Explain error.log lines: the rule each one breaks, its file and line with the lines around it, and the fix, from a reviewed catalogue of the game's messages. Says whether the game documents the command a line names, and the closest documented names. | — |
32
+ | `hoi4.mod_health` | Check a whole mod in one call: the last error.log, the engine check (unknown effects, triggers and modifiers, duplicate ids, broken overrides), script validation, and the localisation and asset audits. Returns the 10 problems that matter most, each counted with 2 examples, its fix and the tool to use next, and which audits ran. | — |
33
+ | `hoi4.script_guard` | Check the files you wrote for invented commands: every effect, trigger and modifier that the installed game documentation does not list and no loaded file defines, with its file, line and the closest real name. Checks the named paths, or the mod script files changed in the last 120 minutes. Needs hoi4-engine. | — |
34
+ | `hoi4.compat_check` | mod: compare this mod with another in both load orders: files at the same path and who wins, duplicate ids, definitions and hooks dropped, replace_path losses, and which order loses less. patch: store the vanilla files the mod overrides and list those a game update changed. | — |
35
+ | `hoi4.mod_index` | Summarize the content in a mod or find a free event ID across the mod, game and dependencies. Use overview for descriptors, folders and definitions, or next_id with a namespace or prefix. | — |
36
+ | `hoi4.localisation_inspect` | 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. | — |
37
+ | `hoi4.idea_inspect` | 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. | — |
38
+ | `hoi4.system_inspect` | 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. | — |
39
+ | `hoi4.unit_inspect` | 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. | — |
40
+ | `hoi4.asset_inspect` | 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. | — |
41
+ | `hoi4.skill` | List the modding skills installed in the mod, or load one by name, at the kit version HOI4 Mod Setup pinned, with its hash. A file edited since Setup installed it is refused unless acceptLocalEdits. | — |
42
42
 
43
43
  ## Localisation
44
44
 
@@ -140,7 +140,7 @@ The CI stdio smoke suite sends each of these shapes to a real server process.
140
140
  | Tool | Example arguments |
141
141
  | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
142
142
  | `hoi4.reference_context` | `{"surface":"event","question":"fire an event after a delay"}` |
143
- | `hoi4.reference_search` | `{"query":"add_timed_idea"}` |
143
+ | `hoi4.reference_search` | `{"query":"add_timed_idea"}` or `{"query":"make a country hold elections now"}` |
144
144
  | `hoi4.reference_read` | `{"id":"<hit id>","revision":"<hit revision>"}` |
145
145
  | `hoi4.source_lookup` | `{"symbol":"my_scripted_effect"}` |
146
146
  | `hoi4.script_validate` | `{"source":"add_political_power = 10","kind":"effect","scope":"country"}` or `{"path":"events/a.txt"}` |
@@ -57,6 +57,10 @@ This server reads source and never starts the game.
57
57
  To reproduce a problem in game, read what the game logged with `hoi4.error_log` (the last launch only, with the file and line where the message names one), then fix the file and ask `hoi4.script_validate` with `path` to check it before relaunching.
58
58
  For launching, loading a save and watching a campaign, pair it with the separate HOI4 Live Tools server (see [A running game](setup.md#a-running-game)).
59
59
 
60
+ ## A game file I edited does not show up
61
+
62
+ The server reads the installed game once and then trusts that read for as long as the game's own version files (`hoi4_rev.txt`, `hoi4_branch.txt`, `clausewitz_rev.txt`, `checksum_manifest.txt`) and the game's top-level folders look the same. That keeps a focus call under a second. A game update changes those files, and the server reads the game again at once. A game file you edit in place without an update is not seen until the server restarts. Set the environment variable `HOI4_AGENT_FULL_GAME_SCAN` to any value to read the game on every call instead. A mod, a dependency and a game folder that has no `hoi4_rev.txt` are always read in full.
63
+
60
64
  ## Still stuck
61
65
 
62
66
  Run `hoi4-agent-tools-setup --diagnose`, then open an issue at <https://github.com/klimPaskov/hoi4-agent-tools/issues> with the tool name, the arguments (without private paths), the error code and message, and the output of `hoi4-agent-tools-setup --diagnose`, which includes the server and Node.js versions.
Binary file
Binary file
Binary file
@@ -4,23 +4,23 @@
4
4
  "binaries": {
5
5
  "darwin-arm64": {
6
6
  "file": "darwin-arm64/hoi4-engine",
7
- "sha256": "0e9337f9fc3db3d24f1b2a1ceceefeb1e971ae26be7aae5307bf4aa1c16c87b2",
8
- "size": 4626736
7
+ "sha256": "cfbe0d82f154c04696822c53e22717ea71a18f597d48156c7e5d037f7ba4e842",
8
+ "size": 4844304
9
9
  },
10
10
  "linux-arm64": {
11
11
  "file": "linux-arm64/hoi4-engine",
12
- "sha256": "1bafcd4c8f966fa4bdfe6c879ddd58aaca010e30762f8a0bbcc76cd13fa644b7",
13
- "size": 4948256
12
+ "sha256": "5167bc989a6432d4f6197e9173e27ea2129f838bbbeeb3f68424159ab393f7c4",
13
+ "size": 5186672
14
14
  },
15
15
  "linux-x64": {
16
16
  "file": "linux-x64/hoi4-engine",
17
- "sha256": "f8cad660e7d2940f03f045693f91c6bf75c729062a0414bb8c94346a07ce37b5",
18
- "size": 5357024
17
+ "sha256": "650eced9e1ff698255aca3ca0bff182deb0acf86e64925e3c0cf474e45c1a0a9",
18
+ "size": 5594064
19
19
  },
20
20
  "win32-x64": {
21
21
  "file": "win32-x64/hoi4-engine.exe",
22
- "sha256": "206a193d504767313d421d39bfe70d2e076329449d183ec26c6cda9a73ce924f",
23
- "size": 4474880
22
+ "sha256": "e3f56c66d74960b37296f16ff70d37146855dbf1bcd0e414831ebe8733aed088",
23
+ "size": 4691968
24
24
  }
25
25
  }
26
26
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "hoi4-agent-tools",
3
- "version": "4.16.0",
3
+ "version": "4.17.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "hoi4-agent-tools",
9
- "version": "4.16.0",
9
+ "version": "4.17.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@fontsource-variable/roboto": "5.3.0",