hoi4-agent-tools 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +1 -1
  3. package/dist/bin/setup.js +5 -2
  4. package/dist/bin/stdio.js +27 -1
  5. package/dist/hoi4_agent_tools/core/configuration.js +8 -0
  6. package/dist/hoi4_agent_tools/core/job-worker-host.js +40 -2
  7. package/dist/hoi4_agent_tools/core/job-worker.js +14 -0
  8. package/dist/hoi4_agent_tools/core/scenario-model.js +1 -1
  9. package/dist/hoi4_agent_tools/gui/renderer.js +8 -2
  10. package/dist/hoi4_agent_tools/gui/scenario-generator.js +48 -0
  11. package/dist/hoi4_agent_tools/gui/scenario.js +2 -0
  12. package/dist/hoi4_agent_tools/gui/studio.js +15 -9
  13. package/dist/hoi4_agent_tools/gui/validators.js +22 -0
  14. package/dist/hoi4_agent_tools/mcp/tools/reference.js +1 -1
  15. package/dist/hoi4_agent_tools/mcp/transports/negotiated-stdio.js +9 -0
  16. package/dist/hoi4_agent_tools/mcp/transports/stdio-lifetime.js +83 -0
  17. package/dist/hoi4_agent_tools/reference/event-popups.js +87 -0
  18. package/dist/hoi4_agent_tools/reference/operations.js +151 -1
  19. package/dist/hoi4_agent_tools/reference/player-text.js +158 -0
  20. package/dist/hoi4_agent_tools/reference/script-validation.js +315 -33
  21. package/dist/hoi4_agent_tools/reference/source-locate.js +1 -1
  22. package/dist/hoi4_agent_tools/schemas/gui-requests.js +18 -4
  23. package/dist/hoi4_agent_tools/schemas/script-validation.js +40 -7
  24. package/dist/hoi4_agent_tools/version.js +1 -1
  25. package/docs/gui.md +25 -0
  26. package/docs/jobs.md +8 -0
  27. package/docs/reference.md +38 -0
  28. package/docs/setup.md +10 -0
  29. package/docs/tools.md +1 -1
  30. package/npm-shrinkwrap.json +2 -2
  31. package/package.json +1 -1
  32. package/schemas/configuration.schema.json +163 -128
  33. package/schemas/continuous-focus-palette.schema.json +1 -1
  34. package/schemas/custom-weighted-pool.schema.json +1 -1
  35. package/schemas/decision-inspect-input.schema.json +1 -1
  36. package/schemas/event-feature-manifest.schema.json +1 -1
  37. package/schemas/focus-plan.schema.json +1 -1
  38. package/schemas/focus-planning-sidecar.schema.json +1 -1
  39. package/schemas/gui-animation-source.schema.json +1 -1
  40. package/schemas/gui-helper.schema.json +1 -1
  41. package/schemas/gui-scenario.schema.json +38 -22
  42. package/schemas/helper-expansion-request.schema.json +1 -1
  43. package/schemas/helper-expansion-summary.schema.json +1 -1
  44. package/schemas/impact-inspect-input.schema.json +1 -1
  45. package/schemas/map-operation.schema.json +1 -1
  46. package/schemas/mechanic-test-input.schema.json +1 -1
  47. package/schemas/operation-result.schema.json +1 -1
  48. package/schemas/package-check-input.schema.json +1 -1
  49. package/schemas/package-manifest.schema.json +1 -1
  50. package/schemas/probability-analysis-result.schema.json +1 -1
  51. package/schemas/probability-compare-input.schema.json +1 -1
  52. package/schemas/probability-evaluate-input.schema.json +1 -1
  53. package/schemas/probability-inspect-input.schema.json +1 -1
  54. package/schemas/probability-render-input.schema.json +1 -1
  55. package/schemas/probability-scenario-set.schema.json +1 -1
  56. package/schemas/probability-sequence-input.schema.json +1 -1
  57. package/schemas/probability-simulate-input.schema.json +1 -1
  58. package/schemas/probability-sweep-input.schema.json +1 -1
  59. package/schemas/reference-context-input.schema.json +1 -1
  60. package/schemas/reference-read-input.schema.json +1 -1
  61. package/schemas/reference-search-input.schema.json +1 -1
  62. package/schemas/scenario-suite.schema.json +1 -1
  63. package/schemas/scenario-test-input.schema.json +1 -1
  64. package/schemas/script-validate-input.schema.json +60 -36
  65. package/schemas/shared-scenario.schema.json +1 -1
  66. package/schemas/source-lookup-input.schema.json +1 -1
  67. package/server.json +2 -2
package/docs/reference.md CHANGED
@@ -21,6 +21,7 @@ Markdown headings and recognizable standalone names in generated `.log` files fo
21
21
  - When `hoi4.source_lookup` finds no definition, `suggestions` lists up to five indexed identifiers within three edits of the requested symbol, nearest first, which catches typos and near-miss names.
22
22
  - `hoi4.source_lookup` with `path` and `line` instead of `symbol` locates a source position, such as a diagnostic or a changed line in a diff. `path` may be a result path such as `mod:events/example.txt`, a path relative to a source root, or an absolute path inside one. The result names the file's layer and whether a later layer shadows it, the indexed definitions that contain the line, innermost first, and the chain of enclosing assignments with zero-based occurrences for repeated keys. Its `keyPath` starts inside the innermost definition: pass that definition's `id` as `symbol`, its `kind`, and the `keyPath` to read or list that exact block. Without `column`, the first non-blank character of the line is used. A file with parse errors returns its definitions but no structural chain. Only the requested file's folder is scanned, in every layer.
23
23
  - `hoi4.script_validate`: check a bounded effect or trigger body against installed native-command documentation. Supply the body in `source`, its `kind`, and its current `scope`. Results cover syntax, command kind, and declared scope, with exact documentation citations. They do not validate command parameters or prove game execution.
24
+ - `hoi4.script_validate` with `path` instead of `source` checks a whole mod file: every effect and trigger body of an event, decision, national focus, scripted effect, scripted trigger, or on-action file, with the scope the file's structure fixes. It is meant to catch the game's own load errors before launch.
24
25
 
25
26
  ## Navigate a definition
26
27
 
@@ -58,6 +59,43 @@ It reads supported scopes from `effects_documentation.md`, `triggers_documentati
58
59
  `valid: true` applies only to `checksPerformed`; `parametersChecked` remains false.
59
60
  Inspect the cited parameter syntax and use the relevant domain tools for broader validation.
60
61
  Replies prioritize problems, bound `findings`, and report `omittedFindings`; execution is bounded to 256 visited entries and 64,000 UTF-8 source bytes.
62
+
63
+ ### Check a whole file
64
+
65
+ Pass `path` (a result path, a path relative to a source root, or an absolute path inside one) without `source`, `kind`, `scope`, or `bindings`.
66
+ The file's folder decides its family and root scopes: event `trigger`, `immediate`, `after`, and option bodies use the event type's scope; decision and focus triggers and effects use country scope; scripted effects, scripted triggers, on actions, and decision `target_trigger` bodies have no fixed scope, so their command kinds are checked and scope rules are skipped.
67
+ `file` reports the family, the number of checked bodies, and how many had no fixed scope; a body without a fixed scope keeps `valid` at `null`.
68
+ File mode lists only problems: matching commands are counted in `checkedCommands`, and unchecked native argument blocks are counted in `argumentBlocksUnchecked`.
69
+ It is bounded to 50,000 visited entries.
70
+
71
+ The mod's scripted effects and triggers count as known commands of their kind.
72
+ Building, ideology, and resource names count as the documented generic triggers that take them as keys (`arms_factory > 2`, `communism > 0.4`), from the documentation's supported lists and from the `common/buildings`, `common/ideologies`, and `common/resources` databases of every source layer.
73
+ `FROM`, chained keywords, `event_target:`, `var:`, `mio:`, and `sp:` blocks are checked for command kinds without scope rules.
74
+
75
+ Two checks predict load errors the game reports:
76
+
77
+ - `SCRIPT_DYNAMIC_VARIABLE_AS_TRIGGER`: a dynamic variable from `dynamic_variables_documentation.md` compared directly as a trigger, such as `num_owned_states > 1`; compare it with `check_variable` instead.
78
+ - `SCRIPT_SCOPE_LINK_WRONG_SCOPE`: a scope link used outside the scopes the wiki's Scopes page allows, such as `controller` in country scope.
79
+
80
+ The scope links `owner`, `controller`, `capital_scope`, `overlord`, and `faction_leader` are recognized in any letter case in both modes.
81
+
82
+ ### Player-facing text
83
+
84
+ For event, decision, and national focus files, file mode also checks English text as the game resolves it, from the last loaded definition of each key, and adds `player_text` to `checksPerformed`.
85
+ These findings have `status: "warning"` and never change `valid`:
86
+
87
+ - `SCRIPT_NEWS_TEXT_COLOUR_CODE`: a news event, or an event with a `GFX_report_event` picture, whose title, description, or option text contains a `§` or `£` code, directly or through a `defined_text` branch it shows.
88
+ - `SCRIPT_TEXT_IMPLEMENTATION_WORDING`: event text, or a decision's or focus's name or description, containing development wording such as TODO, placeholder, hardcoded, newly added, or reworked.
89
+ - `SCRIPT_FLAG_TOOLTIP_UNLOCALISED`: a `has_country_flag`, `has_global_flag`, or `has_state_flag` check in a decision's `available` block or a focus's `available` or `bypass` block whose flag has no localisation key, so the requirement tooltip prints the raw flag name. Checks inside `hidden_trigger` and `custom_trigger_tooltip` are skipped, and scripted triggers called from those blocks are not expanded.
90
+
91
+ Each message names the localisation file and line that carries the text.
92
+
93
+ ### Repeated event windows
94
+
95
+ File mode reports `SCRIPT_EVENT_POPUP_REPEATED` warnings for any family and adds `event_popups` to `checksPerformed`.
96
+ A visible event fired inside an `every_*` loop reaches one player once per loop member when it is sent to a fixed recipient (`ROOT`, `FROM`, `PREV`, `global`, a tag, an `event_target:` or a `var:` scope), or when it is `major = yes` without `fire_only_once`, because a major event is shown to every country.
97
+ An event sent to each loop member in turn, a hidden event, and an event the scanned sources do not define are not reported.
98
+ Scripted effects called inside a loop are checked in their own file, not followed from the caller.
61
99
  Search and context replies also report `limitedByBytes` when metadata exceeds their reply budget.
62
100
  Read omitted required sources with targeted calls rather than repeatedly requesting the same oversized bundle.
63
101
  Reference text supports UTF-8, Windows-1252, and explicitly BOM-marked UTF-16; native engine source encoding rules remain separate.
package/docs/setup.md CHANGED
@@ -84,6 +84,16 @@ See [Local references](reference.md) for source selection and missing-source rep
84
84
  | A render lacks icons or fonts | Confirm `--game-root` and the mod's asset paths. Read the missing-file findings. |
85
85
  | 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. |
86
86
  | 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. |
87
+ | Idle server processes accumulate | Set an idle limit as described in [Server lifetime](#server-lifetime). |
87
88
 
88
89
  The supplied Codex registration allows 120 seconds for startup and 600 seconds per tool call.
90
+
89
91
  For remote or shared deployments, use the [HTTP guide](http.md).
92
+
93
+ ### Server lifetime
94
+
95
+ A stdio server exits when its client closes stdin, and when the process that launched it, such as a `cmd.exe` shim, has exited.
96
+ Some clients start a server for every subagent and keep each connection open after the subagent finishes, so idle servers accumulate and each holds its own index in memory.
97
+ A server with no client traffic and no open request for `stdioIdleExitMinutes` minutes exits.
98
+ That setting applies to every client sharing the server configuration, so prefer the `HOI4_AGENT_STDIO_IDLE_EXIT_MINUTES` environment variable in the affected client's registration; the Codex registrations printed by `hoi4-agent-tools-setup --print-client-config` set it to 30.
99
+ A client that later calls an exited server reports it as disconnected, so leave the limit at `0` (never) for a single long-lived session.
package/docs/tools.md CHANGED
@@ -20,7 +20,7 @@ Use the connected server's live schema for the fields accepted by each call.
20
20
  | `hoi4.reference_search` | Search local documentation in plain words or script names; each result names its answering line. |
21
21
  | `hoi4.reference_read` | Read one revision-bound section, with line continuation. |
22
22
  | `hoi4.source_lookup` | Find exact definitions, overrides and usages across game, DLC and mod, or the definition containing a file line. |
23
- | `hoi4.script_validate` | Check snippet syntax, native command kinds, and declared scopes against local documentation. |
23
+ | `hoi4.script_validate` | Check a snippet or a whole mod file for syntax, command kinds, and scopes against local documentation. |
24
24
  | `hoi4.event_inspect` | Scan, trace, explain, lint, or assess event chains and their state flow. |
25
25
  | `hoi4.event_render` | Render source-linked event routes, options, timing, state, scope, and unresolved edges. |
26
26
  | `hoi4.event_compare` | Compare event-chain topology and diagnostics between revisions. |
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "hoi4-agent-tools",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "hoi4-agent-tools",
9
- "version": "3.8.1",
9
+ "version": "3.9.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": "3.8.1",
4
+ "version": "3.9.0",
5
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",