hoi4-agent-tools 3.5.0 → 3.6.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 (53) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +43 -116
  3. package/dist/hoi4_agent_tools/gui/layout.js +237 -11
  4. package/dist/hoi4_agent_tools/gui/renderer.js +36 -3
  5. package/dist/hoi4_agent_tools/gui/scenario.js +18 -0
  6. package/dist/hoi4_agent_tools/gui/studio.js +73 -21
  7. package/dist/hoi4_agent_tools/mcp/server/instructions.js +1 -1
  8. package/dist/hoi4_agent_tools/reference/service.js +31 -14
  9. package/dist/hoi4_agent_tools/schemas/reference.js +1 -0
  10. package/dist/hoi4_agent_tools/version.js +1 -1
  11. package/docs/README.md +33 -18
  12. package/docs/examples.md +85 -0
  13. package/docs/gui.md +37 -0
  14. package/docs/reference.md +1 -1
  15. package/docs/research/reference-benchmark.md +14 -0
  16. package/docs/setup.md +50 -26
  17. package/docs/tools.md +64 -0
  18. package/package.json +4 -2
  19. package/schemas/configuration.schema.json +1 -1
  20. package/schemas/continuous-focus-palette.schema.json +1 -1
  21. package/schemas/custom-weighted-pool.schema.json +1 -1
  22. package/schemas/decision-inspect-input.schema.json +1 -1
  23. package/schemas/event-feature-manifest.schema.json +1 -1
  24. package/schemas/focus-plan.schema.json +1 -1
  25. package/schemas/focus-planning-sidecar.schema.json +1 -1
  26. package/schemas/gui-animation-source.schema.json +1 -1
  27. package/schemas/gui-helper.schema.json +1 -1
  28. package/schemas/gui-scenario.schema.json +139 -89
  29. package/schemas/helper-expansion-request.schema.json +1 -1
  30. package/schemas/helper-expansion-summary.schema.json +1 -1
  31. package/schemas/impact-inspect-input.schema.json +1 -1
  32. package/schemas/map-operation.schema.json +1 -1
  33. package/schemas/mechanic-test-input.schema.json +1 -1
  34. package/schemas/operation-result.schema.json +1 -1
  35. package/schemas/package-check-input.schema.json +1 -1
  36. package/schemas/package-manifest.schema.json +1 -1
  37. package/schemas/probability-analysis-result.schema.json +1 -1
  38. package/schemas/probability-compare-input.schema.json +1 -1
  39. package/schemas/probability-evaluate-input.schema.json +1 -1
  40. package/schemas/probability-inspect-input.schema.json +1 -1
  41. package/schemas/probability-render-input.schema.json +1 -1
  42. package/schemas/probability-scenario-set.schema.json +1 -1
  43. package/schemas/probability-sequence-input.schema.json +1 -1
  44. package/schemas/probability-simulate-input.schema.json +1 -1
  45. package/schemas/probability-sweep-input.schema.json +1 -1
  46. package/schemas/reference-context-input.schema.json +1 -1
  47. package/schemas/reference-read-input.schema.json +1 -1
  48. package/schemas/reference-search-input.schema.json +1 -1
  49. package/schemas/scenario-suite.schema.json +1 -1
  50. package/schemas/scenario-test-input.schema.json +1 -1
  51. package/schemas/shared-scenario.schema.json +1 -1
  52. package/schemas/source-lookup-input.schema.json +1 -1
  53. package/server.json +3 -3
package/docs/setup.md CHANGED
@@ -1,50 +1,74 @@
1
1
  # Setup
2
2
 
3
- For Codex, the supplied registration allows 120 seconds for startup and 600 seconds per tool call.
4
- Large source scans and GUI renders can take several minutes; keep selectors and scenario matrices bounded and use negotiated task support when available.
5
- `tool_timeout_sec` is the per-server tool deadline described in the [official configuration reference](https://developers.openai.com/ja-JP/docs/config-file/config-reference).
3
+ You need a coding agent that supports MCP and Node.js 22.19+ in the Node 22 line, or Node.js 24.
4
+ Keep an installed copy of Hearts of Iron IV available for vanilla references, artwork and fonts.
6
5
 
7
- HOI4 Agent Tools requires Node.js 22.19 or later in the Node 22 line, or Node.js 24.
8
-
9
- ## Install
6
+ ## 1. Install
10
7
 
11
8
  ```bash
12
9
  npm install --global hoi4-agent-tools
13
10
  ```
14
11
 
15
- Set the MCP process working directory to the mod being edited. The server creates its local workspace in memory, keeps generated artifacts in the per-user data directory, and starts without a config file. The installed game is detected when available for vanilla references; it is not required for source inspection or offline rendering.
12
+ Source inspection can work without an installed game.
13
+ Previews need the assets and fonts referenced by the mod; missing files are reported in the result.
14
+
15
+ ## 2. Connect your agent
16
+
17
+ ```bash
18
+ hoi4-agent-tools-setup --print-client-config
19
+ ```
20
+
21
+ Copy the printed `globalInstall` configuration into your MCP client, or use `codexTomlGlobal` for a TOML-based Codex configuration.
22
+ The printed command is correct for your platform.
23
+
24
+ Open the mod as your agent's workspace.
25
+ If your client does not supply workspace roots, set the MCP process working directory to that mod folder.
26
+ The server can then select the active mod without a separate configuration file.
27
+ It keeps indexes and generated images in your user data directory.
16
28
 
17
- When the MCP server starts with its working directory inside a mod, every focus, GUI, map, event, and technology call uses that mod automatically. Configured multi-mod or remote deployments can use explicit workspace selection.
29
+ ## 3. Try a small task
18
30
 
19
- Local startup accepts normal descriptor-based mods and sparse descriptor-less mods that contain standard HOI4 content folders. Empty roots need a `descriptor.mod` or an explicit configuration so the server does not guess an unrelated directory.
31
+ > Find the focus trees in this mod and render one of them.
20
32
 
21
- ## Optional persistent configuration
33
+ > Find the installed documentation for `save_event_target_as` and read only the relevant section.
22
34
 
23
- Use `--init` only when you need several mod roots, a fixed game path, or a shared/remote process:
35
+ Continue with the [examples guide](examples.md).
36
+ A mod normally has `descriptor.mod` or standard HOI4 content folders; an empty folder needs a descriptor or explicit configuration.
24
37
 
25
- ### Configure explicit paths
38
+ ## Choose game and mod paths
26
39
 
27
- Use explicit paths when discovery is incomplete or when you want to expose more than one mod root:
40
+ Use explicit paths if automatic discovery cannot find the game, or if you want to configure several mods:
28
41
 
29
42
  ```bash
30
- hoi4-agent-tools-setup --init --mod-root /projects/hoi4-mods --mod-root /workshop/hoi4-mods --game-root "/games/Hearts of Iron IV" --workspace-storage-root /var/lib/hoi4-agent-tools
43
+ hoi4-agent-tools-setup --init --mod-root "/projects/hoi4-mods" --game-root "/games/Hearts of Iron IV"
44
+ hoi4-agent-tools-setup --print-client-config
31
45
  ```
32
46
 
33
- - `--mod-root PATH` adds a parent folder containing mods. Repeat it for additional locations.
34
- - `--game-root PATH` selects the installed game folder used for vanilla references.
35
- - `--workspace-storage-root PATH` selects where indexes, renders, and other generated workspace files are stored.
36
- - `--config PATH` writes or reads a config at a custom path instead of the default per-user location.
47
+ `--mod-root` is a parent folder containing mod directories, not the game installation.
48
+ It can be repeated for several locations.
49
+ `--game-root` points to the installed game.
50
+ Use quoted Windows paths on Windows, for example `"C:/Program Files (x86)/Steam/steamapps/common/Hearts of Iron IV"`.
37
51
 
38
- The corresponding config fields are `modRoots`, `gameRoot`, and `workspaceStorageRoot`.
52
+ For a custom configuration location, add `--config PATH` to both setup commands.
53
+ `--workspace-storage-root PATH` chooses where generated indexes and images are saved.
54
+ Linked mod directories are not followed; configure their real parent directory instead.
39
55
 
40
- For a configured workspace, `wikiRoot` can select an absolute path to an offline Paradox Wiki snapshot and `scriptDocsRoot` can select an absolute path to a user-supplied generated documentation dump. Without these fields, the reference tools look for `paradox_wiki/` and `script_docs/` inside the mod. See [Local references](reference.md).
56
+ ## Add local reference material
41
57
 
42
- Linked directory entries are not followed. If a mod folder is a symlink or junction, configure the real parent directory as another `--mod-root`.
58
+ Place an offline wiki snapshot in `paradox_wiki/` inside the mod.
59
+ An optional generated documentation dump can go in `script_docs/`.
60
+ For a configured workspace, `wikiRoot` and `scriptDocsRoot` can point to other absolute directories.
61
+ The server reads these local files; it does not download the wiki.
62
+ See [Local references](reference.md) for source selection and missing-source reports.
43
63
 
44
- ## MCP client registration
64
+ ## Common problems
45
65
 
46
- ```bash
47
- hoi4-agent-tools-setup --print-client-config
48
- ```
66
+ | Problem | Check |
67
+ | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
68
+ | The agent cannot find a mod | Open the mod workspace, set the server working directory, or configure its real parent with `--mod-root`. |
69
+ | A render lacks icons or fonts | Confirm `--game-root` and the mod's asset paths. Read the missing-file findings. |
70
+ | A control's state is unresolved | Supply the scenario's required country, state, controller or variable inputs; do not assume a visible control is available. |
71
+ | A large query takes several minutes | Start with the specific tree, window or source area you need. Use [background jobs](jobs.md) when supported by your client. |
49
72
 
50
- Use the printed `globalInstall` or `codexTomlGlobal` entry. It is platform-correct and uses the default config without an environment variable. For a custom config, add `--config PATH` when printing the registration.
73
+ The supplied Codex registration allows 120 seconds for startup and 600 seconds per tool call.
74
+ For remote or shared deployments, use the [HTTP guide](http.md).
package/docs/tools.md ADDED
@@ -0,0 +1,64 @@
1
+ # Tool reference
2
+
3
+ Most users can ask their agent in ordinary language; the [examples guide](examples.md) is the best starting point.
4
+ This page lists exact tool names for agents and integrations.
5
+ Use the connected server's live schema for the fields accepted by each call.
6
+
7
+ | Tool | Purpose |
8
+ | --------------------------- | ----------------------------------------------------------------------------------------- |
9
+ | `hoi4.focus_inspect` | Read focus trees, continuous-focus placement, and structural or reference problems. |
10
+ | `hoi4.focus_render` | Produce fast HTML, SVG, JSON, and source-linked layout artifacts. |
11
+ | `hoi4.focus_raster` | Produce a PNG preview with decoded source icons. |
12
+ | `hoi4.focus_rewrite` | Create or update a focus tree. |
13
+ | `hoi4.gui_inspect` | Read a scripted GUI and its linked assets and logic. |
14
+ | `hoi4.gui_render` | Render generated and explicit GUI scenarios, states, resolutions, and layout diagnostics. |
15
+ | `hoi4.gui_rewrite` | Create or update a GUI source package. |
16
+ | `hoi4.map_inspect` | Search, click, navigate, and inspect the complete rendered map and its linked data. |
17
+ | `hoi4.map_render` | Render full-map layers, overlays, names, IDs, coordinates, and source-linked catalogs. |
18
+ | `hoi4.map_rewrite` | Create or update states, provinces, IDs, networks, positions, and connected map data. |
19
+ | `hoi4.reference_context` | Get compact, cited wiki and installed documentation pointers for a modding surface. |
20
+ | `hoi4.reference_search` | Search bounded local documentation sections. |
21
+ | `hoi4.reference_read` | Read one revision-bound section, with line continuation. |
22
+ | `hoi4.source_lookup` | Find exact definitions, overrides, usages, and narrow source blocks. |
23
+ | `hoi4.event_inspect` | Scan, trace, explain, lint, or assess event chains and their state flow. |
24
+ | `hoi4.event_render` | Render source-linked event routes, options, timing, state, scope, and unresolved edges. |
25
+ | `hoi4.event_compare` | Compare event-chain topology and diagnostics between revisions. |
26
+ | `hoi4.impact_inspect` | Trace symbol and changed-file consumers across source systems and compare proposals. |
27
+ | `hoi4.decision_inspect` | Inventory and evaluate decisions or missions under declared scenarios and source changes. |
28
+ | `hoi4.mechanic_test` | Execute bounded source effects on a copied declared scenario and check assertions. |
29
+ | `hoi4.package_check` | Check declarative package definitions, calls, registrations, assets, and case links. |
30
+ | `hoi4.scenario_test` | Run named source and domain cases in resumable, revision-bound batches. |
31
+ | `hoi4.job_inspect` | Inspect durable background work or retrieve its completed tool result. |
32
+ | `hoi4.job_cancel` | Durably request cancellation of authorized background work. |
33
+ | `hoi4.tech_inspect` | Scan, trace, explain, lint, and assess technology and doctrine systems. |
34
+ | `hoi4.tech_render` | Render source layouts with real item sizes and year guides, plus dependencies and assets. |
35
+ | `hoi4.tech_compare` | Compare technology graphs, placements, references, diagnostics, and source overlays. |
36
+ | `hoi4.probability_inspect` | Locate weighted logic and discover compatible adapters, candidates, and required inputs. |
37
+ | `hoi4.probability_evaluate` | Evaluate supported weights, probability and timing models, and missing inputs. |
38
+ | `hoi4.probability_sweep` | Find sensitivity, breakpoints, cliffs, and rank reversals across declared ranges. |
39
+ | `hoi4.probability_simulate` | Run deterministic sampled analysis with confidence and convergence data. |
40
+ | `hoi4.probability_sequence` | Analyze declared recovery, caps, cooldowns, resets, timers, and terminal states. |
41
+ | `hoi4.probability_compare` | Attribute AI-weight and MTTH changes between real or proposed source. |
42
+ | `hoi4.probability_render` | Render cached rankings, matrices, timing, sensitivity, sequence, and comparisons. |
43
+
44
+ ## Reading results
45
+
46
+ Inspect findings and missing inputs along with the image or result.
47
+ A rendered control does not by itself prove native availability, and a source simulation is not a game-engine receipt.
48
+ For reference searches, retain the cited file, lines and revision so you can reopen the same section.
49
+
50
+ Large results are returned as linked `hoi4-agent://` resources.
51
+ Follow `continuationUri` until it is `null`; clients can also request byte ranges with `?offset=<bytes>&length=<bytes>`.
52
+ Archive images you need to keep rather than relying on temporary server storage.
53
+
54
+ ## Longer operations
55
+
56
+ Clients that negotiate MCP tasks can retrieve a long operation after reconnecting.
57
+ Other clients receive the ordinary synchronous result.
58
+ Use `hoi4.job_inspect` to inspect an authorized job or retrieve its result, and `hoi4.job_cancel` to request cancellation.
59
+ See [Background jobs](jobs.md) for request keys, cancellation and recovery.
60
+
61
+ ## Optional ChaosX tools
62
+
63
+ Setting `HOI4_AGENT_TOOLS_CHAOSX=1` on the server process exposes `chaosx.focus_country_assets` and `chaosx.visual_revision`.
64
+ These workflow-specific tools are absent from the default public list.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "hoi4-agent-tools",
3
3
  "mcpName": "io.github.klimPaskov/hoi4-agent-tools",
4
- "version": "3.5.0",
5
- "description": "Analyze HOI4 events, decisions, impact, tech, AI, and MTTH; build focus trees, GUIs, and maps.",
4
+ "version": "3.6.0",
5
+ "description": "HOI4 modding tools for agents: local references, visual previews, focus trees, interfaces and maps.",
6
6
  "type": "module",
7
7
  "license": "Apache-2.0",
8
8
  "author": "HOI4 Agent Tools contributors",
@@ -40,6 +40,8 @@
40
40
  "dist/",
41
41
  "docs/README.md",
42
42
  "docs/setup.md",
43
+ "docs/examples.md",
44
+ "docs/tools.md",
43
45
  "docs/events.md",
44
46
  "docs/analysis.md",
45
47
  "docs/mechanics.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/configuration.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/configuration.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/continuous-focus-palette.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/continuous-focus-palette.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/custom-weighted-pool.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/custom-weighted-pool.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/decision-inspect-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/decision-inspect-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/event-feature-manifest.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/event-feature-manifest.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/focus-plan.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/focus-plan.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/focus-planning-sidecar.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/focus-planning-sidecar.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/gui-animation-source.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/gui-animation-source.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.5.0/schemas/gui-helper.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.6.0/schemas/gui-helper.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {