hoi4-agent-tools 4.12.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -3
- package/dist/bin/setup.js +38 -0
- package/dist/bin/stdio.js +5 -1
- package/dist/hoi4_agent_tools/core/configuration.js +16 -0
- package/dist/hoi4_agent_tools/core/domain-tools.js +4 -0
- package/dist/hoi4_agent_tools/core/engine-check.js +87 -0
- package/dist/hoi4_agent_tools/core/engine-client.js +1 -1
- package/dist/hoi4_agent_tools/core/job-operation-registration.js +2 -0
- package/dist/hoi4_agent_tools/localisation/job-operations.js +42 -0
- package/dist/hoi4_agent_tools/localisation/write-diff.js +96 -0
- package/dist/hoi4_agent_tools/localisation/write-format.js +329 -0
- package/dist/hoi4_agent_tools/localisation/write-operations.js +213 -0
- package/dist/hoi4_agent_tools/localisation/write-plan.js +557 -0
- package/dist/hoi4_agent_tools/map/gameplay/crossing-validation.js +17 -0
- package/dist/hoi4_agent_tools/map/model.js +31 -1
- package/dist/hoi4_agent_tools/map/operations.js +2 -1
- package/dist/hoi4_agent_tools/map/world-edge.js +0 -25
- package/dist/hoi4_agent_tools/map/world.js +124 -34
- package/dist/hoi4_agent_tools/mcp/server/argument-errors.js +5 -0
- package/dist/hoi4_agent_tools/mcp/server/create-modern-operations.js +8 -3
- package/dist/hoi4_agent_tools/mcp/server/create.js +5 -1
- package/dist/hoi4_agent_tools/mcp/server/request-lifecycle.js +10 -2
- package/dist/hoi4_agent_tools/mcp/server/task-tool-catalog.js +2 -0
- package/dist/hoi4_agent_tools/mcp/server/tool-profiles.js +83 -0
- package/dist/hoi4_agent_tools/mcp/tools/localisation-write.js +21 -0
- package/dist/hoi4_agent_tools/mcp/tools/reference.js +34 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.js +6 -1
- package/dist/hoi4_agent_tools/reference/compat-patch.js +555 -0
- package/dist/hoi4_agent_tools/reference/compat.js +255 -0
- package/dist/hoi4_agent_tools/reference/docs-pack.js +164 -0
- package/dist/hoi4_agent_tools/reference/docs-pack.json +339 -0
- package/dist/hoi4_agent_tools/reference/documented-commands.js +26 -0
- package/dist/hoi4_agent_tools/reference/error-explain.js +235 -0
- package/dist/hoi4_agent_tools/reference/error-explanations.json +262 -0
- package/dist/hoi4_agent_tools/reference/error-log.js +30 -10
- package/dist/hoi4_agent_tools/reference/mod-health.js +255 -0
- package/dist/hoi4_agent_tools/reference/operations.js +435 -21
- package/dist/hoi4_agent_tools/reference/script-guard.js +109 -0
- package/dist/hoi4_agent_tools/reference/service.js +58 -20
- package/dist/hoi4_agent_tools/runtime.js +11 -0
- package/dist/hoi4_agent_tools/schemas/compat.js +153 -0
- package/dist/hoi4_agent_tools/schemas/localisation-write.js +154 -0
- package/dist/hoi4_agent_tools/schemas/map.js +13 -1
- package/dist/hoi4_agent_tools/schemas/modder-tools.js +191 -0
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/configuration.md +4 -1
- package/docs/jobs.md +2 -1
- package/docs/map.md +4 -2
- package/docs/reference.md +45 -5
- package/docs/setup.md +23 -3
- package/docs/tools.md +16 -1
- package/engine/bin/manifest.json +1 -1
- package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/configuration.schema.json +140 -113
- package/schemas/continuous-focus-palette.schema.json +1 -1
- package/schemas/custom-weighted-pool.schema.json +1 -1
- package/schemas/decision-inspect-input.schema.json +1 -1
- package/schemas/error-log-input.schema.json +1 -1
- package/schemas/event-feature-manifest.schema.json +1 -1
- package/schemas/focus-plan.schema.json +1 -1
- package/schemas/focus-planning-sidecar.schema.json +1 -1
- package/schemas/geography-model.schema.json +1 -1
- package/schemas/gui-animation-source.schema.json +1 -1
- package/schemas/gui-helper.schema.json +1 -1
- package/schemas/gui-scenario.schema.json +1 -1
- package/schemas/helper-expansion-request.schema.json +1 -1
- package/schemas/helper-expansion-summary.schema.json +1 -1
- package/schemas/impact-inspect-input.schema.json +1 -1
- package/schemas/map-operation.schema.json +170 -139
- package/schemas/mechanic-test-input.schema.json +1 -1
- package/schemas/mod-index-input.schema.json +1 -1
- package/schemas/operation-result.schema.json +1 -1
- package/schemas/package-check-input.schema.json +1 -1
- package/schemas/package-manifest.schema.json +1 -1
- package/schemas/probability-analysis-result.schema.json +1 -1
- package/schemas/probability-compare-input.schema.json +1 -1
- package/schemas/probability-evaluate-input.schema.json +1 -1
- package/schemas/probability-inspect-input.schema.json +1 -1
- package/schemas/probability-render-input.schema.json +1 -1
- package/schemas/probability-scenario-set.schema.json +1 -1
- package/schemas/probability-sequence-input.schema.json +1 -1
- package/schemas/probability-simulate-input.schema.json +1 -1
- package/schemas/probability-sweep-input.schema.json +1 -1
- package/schemas/reference-context-input.schema.json +1 -1
- package/schemas/reference-read-input.schema.json +1 -1
- package/schemas/reference-search-input.schema.json +1 -1
- package/schemas/reference-sheets.schema.json +1 -1
- package/schemas/scenario-suite.schema.json +1 -1
- package/schemas/scenario-test-input.schema.json +1 -1
- package/schemas/script-validate-input.schema.json +1 -1
- package/schemas/shared-scenario.schema.json +1 -1
- package/schemas/source-lookup-input.schema.json +1 -1
- package/server.json +2 -2
package/docs/configuration.md
CHANGED
|
@@ -32,9 +32,10 @@ The automatic configuration works like this:
|
|
|
32
32
|
| Storage | Default location |
|
|
33
33
|
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
34
|
| `serverStateRoot` | `$XDG_STATE_HOME/hoi4-agent-tools/state`, else `%LOCALAPPDATA%\hoi4-agent-tools\state`, else `~/.local/state/hoi4-agent-tools/state` |
|
|
35
|
+
| `docsRoot` | `$XDG_DATA_HOME/hoi4-agent-tools/docs`, else `%LOCALAPPDATA%\hoi4-agent-tools\docs`, else `~/.local/share/hoi4-agent-tools/docs` |
|
|
35
36
|
| `workspaceStorageRoot` | `$XDG_DATA_HOME/hoi4-agent-tools/workspaces`, else `%LOCALAPPDATA%\hoi4-agent-tools\workspaces`, else `~/.local/share/hoi4-agent-tools/workspaces` |
|
|
36
37
|
|
|
37
|
-
`hoi4-agent-tools-setup --init` writes
|
|
38
|
+
`hoi4-agent-tools-setup --init` writes the first two locations into the file it creates. The command-line servers use the `docsRoot` default when the file names none, and read the docs pack that `hoi4-agent-tools-setup --fetch-docs` installs there.
|
|
38
39
|
A hand-written file has no storage defaults: set `serverStateRoot` yourself, and leave out `workspaceStorageRoot` only if generated files may live inside each mod.
|
|
39
40
|
|
|
40
41
|
What each location holds:
|
|
@@ -99,6 +100,7 @@ Over HTTP, a principal sees only the workspaces granted to it, and any other ID
|
|
|
99
100
|
| `workspaceStorageRoot` | path | | unset | Base folder for generated files: each workspace stores `artifacts/` and `cache/` in `<workspaceStorageRoot>/<workspace ID>/`. When unset, mods use `.hoi4-agent/` inside the mod. |
|
|
100
101
|
| `storageRoots` | array of paths | up to 16 | `[]` | Additional folders in which an explicit `artifactRoot` or `cacheRoot` may be placed. |
|
|
101
102
|
| `workspaces` | array of objects | up to 1,000 | `[]` | Explicit workspace registrations, described in the next section. |
|
|
103
|
+
| `profiles` | array of strings | 1–4 | unset | The tool profiles each session lists: `core`, `map`, `advanced` or `all` ([tool profiles](setup.md#choose-tool-profiles)). The stdio server lists `core` when this is unset; the HTTP server lists every tool. |
|
|
102
104
|
| `defaultWorkspace` | string | workspace ID | unset | The mod workspace, by ID or short form, used for `"current"` when neither the client roots nor the working directory identify one. It must name a registered mod workspace, and over HTTP it applies only to principals granted that workspace. |
|
|
103
105
|
|
|
104
106
|
## Workspaces
|
|
@@ -270,6 +272,7 @@ HTTP server only:
|
|
|
270
272
|
| `HOI4_AGENT_CONFIG` | `hoi4-agent-tools`, `hoi4-agent-tools-http`, setup `--diagnose` and `--print-client-config` | Configuration file path when `--config` is not given. `--init` writes to `--config` or the default path and ignores this variable. |
|
|
271
273
|
| `HOI4_GAME_ROOT` | automatic configuration, setup `--init` and `--discover` | First game folder to try, before the standard Steam locations. |
|
|
272
274
|
| `HOI4_MOD_ROOTS` | setup `--init` and `--discover` | Extra mod parent folders to discover, separated by `;` on Windows and `:` elsewhere. `--init` uses discovered folders only when no `--mod-root` is given. |
|
|
275
|
+
| `HOI4_AGENT_TOOLS_PROFILES` | `hoi4-agent-tools`, `hoi4-agent-tools-http` | Overrides `profiles` for one client registration: a comma-separated list of `core`, `map`, `advanced` and `all`. An unknown name stops startup. |
|
|
273
276
|
| `HOI4_AGENT_STDIO_IDLE_EXIT_MINUTES` | `hoi4-agent-tools` | Overrides `stdioIdleExitMinutes` for one client registration. It must be a whole number from 0 to 10,080; an empty value keeps the configured setting, and any other value stops startup. |
|
|
274
277
|
| the variable named by `tokenEnv` | `hoi4-agent-tools-http` | Secret for a static bearer token, at least 32 characters. |
|
|
275
278
|
| `APPDATA`, `XDG_CONFIG_HOME` | every command | Location of the default configuration file. |
|
package/docs/jobs.md
CHANGED
|
@@ -15,13 +15,14 @@ A modern native task handoff ends that request's heartbeat without declaring the
|
|
|
15
15
|
|
|
16
16
|
## Supported tools
|
|
17
17
|
|
|
18
|
-
Optional tasks are available for all
|
|
18
|
+
Optional tasks are available for all 20 domain tools; the 7 reference tools and the 2 job tools always answer in the foreground.
|
|
19
19
|
|
|
20
20
|
- `hoi4.event_inspect` and `hoi4.event_render`
|
|
21
21
|
- `hoi4.impact_inspect`, `hoi4.decision_inspect`, `hoi4.mechanic_test`, `hoi4.package_check`, and `hoi4.scenario_test`
|
|
22
22
|
- `hoi4.tech_inspect` and `hoi4.tech_render`
|
|
23
23
|
- `hoi4.probability_inspect` and `hoi4.probability_analyze`
|
|
24
24
|
- `hoi4.map_inspect` and `hoi4.map_rewrite`
|
|
25
|
+
- `hoi4.localisation_write`
|
|
25
26
|
- `hoi4.gui_inspect`, `hoi4.gui_render`, and `hoi4.gui_rewrite`
|
|
26
27
|
- `hoi4.focus_inspect`, `hoi4.focus_render`, and `hoi4.focus_rewrite`
|
|
27
28
|
|
package/docs/map.md
CHANGED
|
@@ -19,7 +19,7 @@ The server generates the complete map and supporting country/state files in one
|
|
|
19
19
|
|
|
20
20
|
Add `"preview": true` at the top level to return offline reference, terrain and political PNGs, a comparison and counts without changing mod files. Repeat the request without `preview` to apply it. Preview uses the same extraction, generation and validation as application, and never launches the game.
|
|
21
21
|
|
|
22
|
-
Use a cleaned, unlabelled raster for production generation. Handwriting, sheet joins and map frames can become false islands or relief. Keep the original unchanged, remove these marks in a separate reference, compare its coastlines with the original, then inspect the terrain preview before writing. Supply reviewed names through `reference.labels` and `reference.cities`; an explicit label list, including an empty list, prevents OCR from adding unreviewed names. The server does not automatically redraw artwork or promise lossless interpretation of every map.
|
|
22
|
+
Use a cleaned, unlabelled raster for production generation. Handwriting, sheet joins and map frames can become false islands or relief. Keep the original unchanged, remove these marks in a separate reference, compare its coastlines with the original, then inspect the terrain preview before writing. Supply reviewed names through `reference.labels` and `reference.cities`; an explicit label list, including an empty list, prevents OCR from adding unreviewed names. The server does not automatically redraw artwork or promise lossless interpretation of every map. Offline validation is separate from [native campaign acceptance](https://github.com/klimPaskov/hoi4-agent-tools/blob/v4.1.0/docs/evaluations/worldgen_acceptance_2026-10-15.md).
|
|
23
23
|
|
|
24
24
|
Reference worlds enable `startingScenario` by default; procedural worlds keep it off unless requested. The starter includes a bookmark, country histories, provisional councils, recruitable infantry templates, two equipped divisions per country, stockpiles, an infantry production line, supply and building positions. `worldName` sets the bookmark title. Demographics, industry and ownership remain provisional. Existing world events, decisions, startup hooks and country-specific AI strategy folders are replaced; shared game systems remain dependencies and can report unused-definition warnings. Generated names use the localisation replacement folder, and explicit country color declarations match the flags. Inherited country tags receive inactive histories. The adjacent launcher `.mod` file must mirror the generated `descriptor.mod` replacement paths. The server cannot enable a launcher playset or test a campaign.
|
|
25
25
|
|
|
@@ -44,6 +44,8 @@ Optional `reference` controls refine the same call:
|
|
|
44
44
|
| `cities` | `{name,x,y,countryTag?}` reviewed city and optional capital anchors. `countryTag` must name a generated country. |
|
|
45
45
|
| `labels` | `{name,x,y,kind}` reviewed names for `state`, `country`, `city`, `sea`, `region`, `mountain` or `geography`; useful for handwritten or ambiguous labels. |
|
|
46
46
|
|
|
47
|
+
Land drawn as `snow` is plains in play and ordinary land in `terrain.bmp`, with seasonal snow, as the base game's northern lands are: a strategic region drawn mostly as snow takes the weather of at least latitude 0.7 (0 at the equator, 1 at the map's top and bottom), so its winters bring snow. Permanent snow, which the game draws as bright ice, is kept to drawn snow in the tenth of rows nearest each pole (ice caps, index 19), drawn snow at height 150 or more (index 16), and the snow lines of ranges and painted mountains (index 16). The operation's `permanentSnow` moves the two thresholds, `{ "iceCapLatitude": 0.97, "peakHeight": 200 }` for a world whose inhabited north reaches the top rows (1 turns ice caps off, 256 high ground), or `"snowlines"` keeps permanent snow only above the snow lines. With `relief.painted`, drawn high ground stands well above the base game's, so a `peakHeight` of 150 to 200 can take whole painted ranges: start near 230 and read the share note. On a 5,120 by 2,560 world with 29% of its land drawn as snow, `0.97` and `230` left 0.9% permanent snow, and the defaults 9.5%. `MAP_PERMANENT_SNOW_SHARE` reports the permanent-snow share of the land against the base game's 0.76%, with the `rim` and `wall` seam ranges counted apart and the thresholds used; it is a warning above four times that share.
|
|
48
|
+
|
|
47
49
|
Reviewed geography labels preserve names for lakes, rivers, forests and other features in localisation and generated-world provenance. They do not invent a native HOI4 map entity or turn a geographic label into a city or victory point.
|
|
48
50
|
|
|
49
51
|
All annotation positions and polygons use normalized 0 to 1 coordinates relative to the original, uncropped reference, with the origin at its top left. Crop uses source pixels instead. Explicit `countries` on the operation supplies reviewed country tags, names, colors and relative shares. If borders or names cannot be inferred reliably, the server generates named defaults and reports the assumptions. Manual controls are optional and never change the original image.
|
|
@@ -638,7 +640,7 @@ The engine wraps the map horizontally, so land that touches the first or last co
|
|
|
638
640
|
| `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. |
|
|
639
641
|
| `bandPx` | `max(192, 4% of the width)`, at most a quarter of the width | East and west sea band. |
|
|
640
642
|
| `polarPx` | 64, at most a quarter of the height | North and south sea band; 0 lets land reach the top and bottom edges. |
|
|
641
|
-
| `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
|
|
643
|
+
| `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 every land province on the first or last column becomes an impassable state. No adjacency row crosses the seam: the game draws one as a line across the whole map (`MAP_ADJACENCY_ACROSS_SEAM`, error). |
|
|
642
644
|
| `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`. |
|
|
643
645
|
|
|
644
646
|
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.
|
package/docs/reference.md
CHANGED
|
@@ -5,14 +5,16 @@ The installed game docs define current syntax; the wiki supplies broader guidanc
|
|
|
5
5
|
|
|
6
6
|
The server discovers these directories for a workspace:
|
|
7
7
|
|
|
8
|
-
| Source | Default location
|
|
9
|
-
| ------------------------------ |
|
|
10
|
-
| Installed game documentation | `gameRoot/documentation/**/*.md` and `gameRoot/common/**/*documentation.md`
|
|
11
|
-
| HOI4 wiki (kit) | `modRoot/hoi4_wiki/**/*.md`, else `modRoot/paradox_wiki/**/*.md
|
|
12
|
-
| Generated script documentation | `modRoot/script_docs/**/*.md` and `**/*.log`
|
|
8
|
+
| Source | Default location | Optional workspace registration |
|
|
9
|
+
| ------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------ |
|
|
10
|
+
| Installed game documentation | `gameRoot/documentation/**/*.md` and `gameRoot/common/**/*documentation.md` | Configure `gameRoot`. |
|
|
11
|
+
| HOI4 wiki (kit) | `modRoot/hoi4_wiki/**/*.md`, else `modRoot/paradox_wiki/**/*.md`, else the docs pack | Set absolute `wikiRoot`. |
|
|
12
|
+
| Generated script documentation | `modRoot/script_docs/**/*.md` and `**/*.log` | Set absolute `scriptDocsRoot` to a user-supplied dump. |
|
|
13
13
|
|
|
14
14
|
Markdown headings and recognizable standalone names in generated `.log` files form sections. A Markdown table row whose first cell is an identifier, such as a wiki effect, trigger, modifier, define, or on action, is also its own one-line section, so a citation can name the exact entry inside a long table. A dump that yields one section should be treated as insufficiently parsed; inspect its source format before relying on it. Source bytes are hashed on each request, while unchanged section indexes are reused. Missing roots are reported as unavailable. The public package contains none of these local source files.
|
|
15
15
|
|
|
16
|
+
With no mod selected, `hoi4.reference_search`, `hoi4.reference_read` and `hoi4.reference_context` still answer, from the installed game documentation and the docs pack that `hoi4-agent-tools-setup --fetch-docs` installs. Such an answer has the workspace ID `docs` and the information `REFERENCE_DOCUMENTATION_ONLY`, and `"workspaceId":"docs"` asks for it explicitly. When no wiki page is available at all, `REFERENCE_WIKI_UNAVAILABLE` names the fetch step.
|
|
17
|
+
|
|
16
18
|
## Tools
|
|
17
19
|
|
|
18
20
|
- `hoi4.reference_context`: request one surface: `general`, `event`, `decision`, `idea`, `focus`, `technology`, `gui`, `map`, `localisation`, or `ai`. The default limit is 16 citations and the maximum is 24. It reserves citations for available installed documentation and offline wiki sources before adding further question matches. Supply `question` to select the best matching section within each required source. At a limit of two or more, both source kinds are represented when available; a one-result limit prioritizes installed documentation. `omittedSources` names required sources excluded by the result limit, while `missing` names sources absent from the configured roots. Increase the limit or search an omitted source directly before treating the bundle as sufficient. Citations are pointers and excerpts; read the pertinent sections before changing code.
|
|
@@ -149,6 +151,44 @@ Filter with `scope` (`all`, `mod` for entries in the mod's own files, or `unloca
|
|
|
149
151
|
The tool reads the log the game wrote at its last launch; it never starts the game.
|
|
150
152
|
Run `hoi4.script_validate` with `path` on the reported file to check the same body before the next launch.
|
|
151
153
|
|
|
154
|
+
## Explain an error.log line
|
|
155
|
+
|
|
156
|
+
`hoi4.explain_error` takes one `line`, or up to 10 `lines`, as the game writes them or as `hoi4.error_log` returns them.
|
|
157
|
+
A parser error that wraps several messages (`Error: "... near line: 11 ... near line: 12" in file: "..."`) gives one explanation per message, each at its own line.
|
|
158
|
+
Each explanation carries:
|
|
159
|
+
|
|
160
|
+
- `rule`: what the game requires, and `fix`: what to change. Both come from a reviewed catalogue (`error-explanations.json`) of the messages the game's own log writes, each with its evidence: the log of a named game build or the game's documentation. `matched` says where they came from: `catalogue`, a reviewed `known_mistake`, or only the message's `category`.
|
|
161
|
+
- `source`: the file, the line and its layer (`mod`, `dependency`, `game`), with up to 5 lines around it. A line from the game's own files says so in `note`: it appears without the mod too.
|
|
162
|
+
- `subject`, the command, key or tag the message names, with `documentedAs` (whether the installed documentation lists it as an effect, trigger or modifier), `definedBy` (a scripted effect or trigger that a loaded file defines) and up to 3 `suggestions`. A value read as a trigger suggests its `has_` trigger first, such as `has_stability` for `stability`.
|
|
163
|
+
- `next`: the call that narrows it down, `hoi4.script_validate` on a mod file.
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{ "line": "Invalid trigger 'stability' in events/my_events.txt line : 12" }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Find invented commands in new script
|
|
170
|
+
|
|
171
|
+
`hoi4.script_guard` checks the files an agent wrote: every effect, trigger and modifier in them that the installed game's documentation does not list and no loaded file defines as a scripted effect, scripted trigger or modifier. Each invented name comes with its kind, file, line, the definition it is in and the closest real name. Pass `paths` (up to 50 mod files), or leave them out to check the mod's script files changed in the last `sinceMinutes` (120 by default). File times choose the files, so no Git command runs in the mod. The engine's whole-mod check (`hoi4-engine check`) judges every `name = value` command, and `hoi4.script_validate` adds the names it cannot resolve, such as a trigger compared with `>`. Without the engine the tool answers `ENGINE_UNAVAILABLE`.
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{ "paths": ["events/my_events.txt"] }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Check a whole mod
|
|
178
|
+
|
|
179
|
+
`hoi4.mod_health` runs the existing audits in one call and returns the 10 problems that matter most (`limit` lowers it):
|
|
180
|
+
|
|
181
|
+
- `error_log`: the mod's own entries of the last launch's `error.log`. A log from a launch without the mod is ignored, and a log older than the mod's files counts for less.
|
|
182
|
+
- `engine_check`: the engine's whole-mod check: unknown effects, triggers and modifiers, duplicate ids, event namespace collisions, broken and dropping overrides and missing localisation keys.
|
|
183
|
+
- `script`: `hoi4.script_validate` on the mod's script files, those the other audits named first and the newest after them, within 30 seconds.
|
|
184
|
+
- `localisation` and `assets`: the localisation audit and the sprite and flag audits.
|
|
185
|
+
|
|
186
|
+
Findings of one kind form one problem with its count, two examples, its fix and the tool to call next. Two audits that report the same kind, such as a missing localisation key, count once. Problems rank by severity, then by how much they hurt a player (the game failing to read a file first), then by count. `checks` says which audits ran, which ran partly and why, and which could not run (the engine audits need `hoi4-engine`). `verdict` is `healthy` only when every audit ran and found nothing, and `incomplete` when nothing was found but an audit could not run. Choose audits with `checks`. A large mod takes up to a minute.
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{ "limit": 5 }
|
|
190
|
+
```
|
|
191
|
+
|
|
152
192
|
## Index the mod and pick free IDs
|
|
153
193
|
|
|
154
194
|
`hoi4.mod_index` with `mode: "overview"` summarizes the mod without reading every file:
|
package/docs/setup.md
CHANGED
|
@@ -36,6 +36,18 @@ The [client examples](../examples/clients) show the same entries without your pa
|
|
|
36
36
|
|
|
37
37
|
Open the mod as your agent's workspace.
|
|
38
38
|
|
|
39
|
+
### Choose tool profiles
|
|
40
|
+
|
|
41
|
+
Every tool the server lists costs the agent context on every turn, so a session lists the `core` profile unless it asks for more:
|
|
42
|
+
|
|
43
|
+
| Profile | Tools |
|
|
44
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `core` | Documentation search and reading, source lookup, script validation and the invented-command guard, the error log and its explanations, the mod health check, the mod index, localisation and kit skills |
|
|
46
|
+
| `map` | The world map builder (`map_inspect`, `map_rewrite`) and the job controls |
|
|
47
|
+
| `advanced` | Focus, GUI, event, technology, decision and probability editors, renders and analyses, the other inspect tools, compatibility checks and the job controls |
|
|
48
|
+
|
|
49
|
+
Set `HOI4_AGENT_TOOLS_PROFILES` in the client's server entry to list more, for example `"env": { "HOI4_AGENT_TOOLS_PROFILES": "core,map" }`, or `all` for every tool. The `profiles` key of the configuration file does the same for every client. A tool outside the listed profiles still answers when a call names it.
|
|
50
|
+
|
|
39
51
|
### How the server picks your mod
|
|
40
52
|
|
|
41
53
|
Every tool takes an optional `workspaceId`; the default, `"current"`, means the mod that contains the client's workspace root or, when the client sends no roots, the server's working directory.
|
|
@@ -83,10 +95,18 @@ Entries that are not plain relative folders, such as `../outside` or wildcard pa
|
|
|
83
95
|
|
|
84
96
|
## Add local reference material
|
|
85
97
|
|
|
86
|
-
|
|
98
|
+
Documentation search works with no mod open once the HOI4 wiki pages are installed. Run this once:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
hoi4-agent-tools-setup --fetch-docs
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
It downloads the docs pack: the modding kit's HOI4 wiki pages at the kit commit this version pins (about 3.6 MB), with their licence and sources, checked against pinned SHA-256 hashes. It installs them in `docsRoot` (the user's data folder by default) and replaces an older pack. Run it again after an update of `hoi4-agent-tools`. With no mod selected, the reference tools then answer from the game documentation (`gameRoot`) and the pack. A mod without its own wiki copy reads the pack too.
|
|
105
|
+
|
|
106
|
+
A mod that has the kit's wiki in `hoi4_wiki/` reads its own copy instead. A mod the kit has not updated yet keeps working with the older `paradox_wiki/` name; when both exist, `hoi4_wiki/` wins.
|
|
87
107
|
An optional generated documentation dump can go in `script_docs/`.
|
|
88
108
|
For a configured workspace, `wikiRoot` and `scriptDocsRoot` can point to other absolute directories.
|
|
89
|
-
The server
|
|
109
|
+
The server itself never downloads anything; only `--fetch-docs` does.
|
|
90
110
|
See [Local references](reference.md) for source selection and missing-source reports.
|
|
91
111
|
|
|
92
112
|
## Common problems
|
|
@@ -109,7 +129,7 @@ hoi4-agent-tools-setup --diagnose
|
|
|
109
129
|
```
|
|
110
130
|
|
|
111
131
|
`--discover` prints the mod and game folders the server can detect, without writing anything.
|
|
112
|
-
`--diagnose` checks the configured paths and their permissions, the Node.js version and the
|
|
132
|
+
`--diagnose` checks the configured paths and their permissions, the Node.js version, the image library and whether the docs pack is installed, and accepts `--config PATH`.
|
|
113
133
|
`--help` lists every option.
|
|
114
134
|
|
|
115
135
|
For remote or shared deployments, use the [HTTP guide](http.md).
|
package/docs/tools.md
CHANGED
|
@@ -28,6 +28,10 @@ A test fails when this page differs from `tools/list`, so edit the tool descript
|
|
|
28
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
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
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. | — |
|
|
31
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. | — |
|
|
32
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. | — |
|
|
33
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. | — |
|
|
@@ -36,6 +40,12 @@ A test fails when this page differs from `tools/list`, so edit the tool descript
|
|
|
36
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. | — |
|
|
37
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. | — |
|
|
38
42
|
|
|
43
|
+
## Localisation
|
|
44
|
+
|
|
45
|
+
| Tool | Purpose | Writes |
|
|
46
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
|
|
47
|
+
| `hoi4.localisation_write` | Add localisation keys (mode add: key and text; language, file, replace) or repair localisation files (mode fix: BOM, broken quotes, keys missing from supported languages). Game keys are overridden from a replace folder. apply false returns the diff and writes nothing; apply true writes it. Returns up to 10 files with diffs. | mod files |
|
|
48
|
+
|
|
39
49
|
## Focus trees
|
|
40
50
|
|
|
41
51
|
| Tool | Purpose | Writes |
|
|
@@ -135,6 +145,10 @@ The CI stdio smoke suite sends each of these shapes to a real server process.
|
|
|
135
145
|
| `hoi4.source_lookup` | `{"symbol":"my_scripted_effect"}` |
|
|
136
146
|
| `hoi4.script_validate` | `{"source":"add_political_power = 10","kind":"effect","scope":"country"}` or `{"path":"events/a.txt"}` |
|
|
137
147
|
| `hoi4.error_log` | `{"scope":"mod","category":"effect"}` |
|
|
148
|
+
| `hoi4.explain_error` | `{"line":"Invalid trigger 'stability' in events/my_events.txt line : 12"}` |
|
|
149
|
+
| `hoi4.mod_health` | `{"limit":5}` or `{"checks":["error_log","engine_check"]}` |
|
|
150
|
+
| `hoi4.script_guard` | `{"paths":["events/my_events.txt"]}` |
|
|
151
|
+
| `hoi4.compat_check` | `{"mode":"mod","other":"my_other_mod"}` or `{"mode":"patch"}` |
|
|
138
152
|
| `hoi4.mod_index` | `{"mode":"next_id","kind":"event","namespace":"my_mod"}` |
|
|
139
153
|
| `hoi4.localisation_inspect` | `{"mode":"key","key":"my_event.1.t"}` or `{"mode":"audit"}` |
|
|
140
154
|
| `hoi4.idea_inspect` | `{"kind":"idea","id":"GER_mefo_bills_1"}` or `{"kind":"character","audit":true}` |
|
|
@@ -142,6 +156,7 @@ The CI stdio smoke suite sends each of these shapes to a real server process.
|
|
|
142
156
|
| `hoi4.unit_inspect` | `{"kind":"oob","id":"GER_1936"}` or `{"kind":"variant","audit":true}` |
|
|
143
157
|
| `hoi4.asset_inspect` | `{"kind":"sprite","id":"GFX_my_icon"}` or `{"kind":"flag","audit":true}` |
|
|
144
158
|
| `hoi4.skill` | `{"name":"hoi4-events"}` |
|
|
159
|
+
| `hoi4.localisation_write` | `{"mode":"add","entries":[{"key":"my_focus","text":"My focus"}]}` |
|
|
145
160
|
| `hoi4.focus_inspect` | `{"treeId":"my_focus_tree"}` |
|
|
146
161
|
| `hoi4.focus_render` | `{"relativePath":"common/national_focus/my_tree.txt","treeId":"my_focus_tree"}` |
|
|
147
162
|
| `hoi4.focus_rewrite` | `{"relativePath":"common/national_focus/my_tree.txt","treeId":"my_focus_tree","layoutMode":"compact"}` |
|
|
@@ -186,7 +201,7 @@ Archive images you need to keep rather than relying on temporary server storage.
|
|
|
186
201
|
|
|
187
202
|
## Longer operations
|
|
188
203
|
|
|
189
|
-
All
|
|
204
|
+
All 20 domain tools accept negotiated MCP tasks, so a client that supports tasks can retrieve a long operation after reconnecting.
|
|
190
205
|
The 7 reference tools and the 2 job tools always answer in the foreground.
|
|
191
206
|
Other clients receive the ordinary synchronous result.
|
|
192
207
|
Use `hoi4.job_inspect` to inspect an authorized job or retrieve its result, and `hoi4.job_cancel` to request cancellation.
|
package/engine/bin/manifest.json
CHANGED
|
Binary file
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hoi4-agent-tools",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "hoi4-agent-tools",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.14.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fontsource-variable/roboto": "5.3.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hoi4-agent-tools",
|
|
3
3
|
"mcpName": "io.github.klimPaskov/hoi4-agent-tools",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.14.0",
|
|
5
5
|
"description": "Build HOI4 mods: focus trees, events, decisions, worlds, GUI previews, docs and AI balance.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "Apache-2.0",
|