hoi4-agent-tools 3.2.0 → 3.3.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 (54) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +4 -0
  3. package/dist/hoi4_agent_tools/core/analysis-job-operations.js +11 -1
  4. package/dist/hoi4_agent_tools/core/condition-evaluator.js +5 -1
  5. package/dist/hoi4_agent_tools/core/job-worker-host.js +3 -0
  6. package/dist/hoi4_agent_tools/core/operation-tasks.js +7 -0
  7. package/dist/hoi4_agent_tools/core/scenario-model.js +85 -0
  8. package/dist/hoi4_agent_tools/gui/scenario-conditions.js +2 -23
  9. package/dist/hoi4_agent_tools/mcp/server/instructions.js +1 -1
  10. package/dist/hoi4_agent_tools/mcp/server/request-lifecycle.js +3 -0
  11. package/dist/hoi4_agent_tools/mcp/tools/analysis.js +90 -0
  12. package/dist/hoi4_agent_tools/mechanic/assertions.js +112 -0
  13. package/dist/hoi4_agent_tools/mechanic/interpreter.js +619 -0
  14. package/dist/hoi4_agent_tools/mechanic/service.js +145 -0
  15. package/dist/hoi4_agent_tools/mechanic/source.js +89 -0
  16. package/dist/hoi4_agent_tools/package-check/service.js +231 -0
  17. package/dist/hoi4_agent_tools/probability/evaluation.js +3 -1
  18. package/dist/hoi4_agent_tools/scenario-suite/service.js +341 -0
  19. package/dist/hoi4_agent_tools/schemas/scenarios.js +264 -0
  20. package/dist/hoi4_agent_tools/version.js +1 -1
  21. package/docs/README.md +1 -0
  22. package/docs/mechanics.md +70 -0
  23. package/package.json +2 -1
  24. package/schemas/configuration.schema.json +1 -1
  25. package/schemas/continuous-focus-palette.schema.json +1 -1
  26. package/schemas/custom-weighted-pool.schema.json +1 -1
  27. package/schemas/decision-inspect-input.schema.json +1 -1
  28. package/schemas/event-feature-manifest.schema.json +1 -1
  29. package/schemas/focus-plan.schema.json +1 -1
  30. package/schemas/focus-planning-sidecar.schema.json +1 -1
  31. package/schemas/gui-animation-source.schema.json +1 -1
  32. package/schemas/gui-helper.schema.json +1 -1
  33. package/schemas/gui-scenario.schema.json +1 -1
  34. package/schemas/helper-expansion-request.schema.json +1 -1
  35. package/schemas/helper-expansion-summary.schema.json +1 -1
  36. package/schemas/impact-inspect-input.schema.json +1 -1
  37. package/schemas/map-operation.schema.json +1 -1
  38. package/schemas/mechanic-test-input.schema.json +650 -0
  39. package/schemas/operation-result.schema.json +1 -1
  40. package/schemas/package-check-input.schema.json +164 -0
  41. package/schemas/package-manifest.schema.json +142 -0
  42. package/schemas/probability-analysis-result.schema.json +1 -1
  43. package/schemas/probability-compare-input.schema.json +1 -1
  44. package/schemas/probability-evaluate-input.schema.json +1 -1
  45. package/schemas/probability-inspect-input.schema.json +1 -1
  46. package/schemas/probability-render-input.schema.json +1 -1
  47. package/schemas/probability-scenario-set.schema.json +1 -1
  48. package/schemas/probability-sequence-input.schema.json +1 -1
  49. package/schemas/probability-simulate-input.schema.json +1 -1
  50. package/schemas/probability-sweep-input.schema.json +1 -1
  51. package/schemas/scenario-suite.schema.json +1004 -0
  52. package/schemas/scenario-test-input.schema.json +1057 -0
  53. package/schemas/shared-scenario.schema.json +237 -0
  54. package/server.json +2 -2
@@ -0,0 +1,70 @@
1
+ # Mechanic tests, package checks, and scenario suites
2
+
3
+ `hoi4.mechanic_test`, `hoi4.package_check`, and `hoi4.scenario_test` read authorized HOI4 source and return linked, revision-bound evidence.
4
+ They do not launch the game or change source files.
5
+ Supply `expectedRevision` when continuing analysis against a reviewed scan.
6
+
7
+ ## Test an effect
8
+
9
+ `hoi4.mechanic_test` copies a versioned scenario, selects each active source effect, applies explicit steps, and evaluates typed assertions.
10
+ Source selectors support `scripted_effect`, `event_option`, `decision`, and `focus_reward`; event options also need `option`.
11
+ An `advance_days` step only expires modeled timed flags; it never runs on actions.
12
+
13
+ ```json
14
+ {
15
+ "workspaceId": "current",
16
+ "test": {
17
+ "id": "treasury_transfer",
18
+ "scenario": {
19
+ "schemaVersion": "1.0",
20
+ "id": "treasury_transfer",
21
+ "state": { "treasury": 10, "savings": 2 },
22
+ "closedFlags": true
23
+ },
24
+ "steps": [{ "kind": "effect", "source": { "kind": "scripted_effect", "id": "transfer" } }],
25
+ "assertions": [
26
+ {
27
+ "id": "total_conserved",
28
+ "kind": "conservation",
29
+ "paths": [{ "key": "treasury" }, { "key": "savings" }]
30
+ },
31
+ {
32
+ "id": "single_charge",
33
+ "kind": "single_payment",
34
+ "balance": { "key": "treasury" },
35
+ "cost": 3
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ ```
41
+
42
+ The linked trace records applied, skipped, and unresolved source operations with before and after values.
43
+ The `single_payment` assertion checks the named balance's final change and the number and size of its traced deductions, so a compensating grant cannot hide a second charge.
44
+ Supported operations include documented variable arithmetic, flags, event targets, arrays, conditionals, finite declared scope iteration, scripted helpers, safe meta substitutions, and selected balance effects.
45
+ Decision engine political-power costs are applied once before `complete_effect`; custom cost triggers check affordability and their payment remains in `complete_effect`.
46
+ Unresolved eligibility, unsupported effects, dynamic names that cannot be resolved, missing finite scope catalogs, and bounded-work limits remain unresolved rather than guessed.
47
+ An effect with an unknown write set conservatively makes state assertions unresolved.
48
+ This is source interpretation of declared steps, not campaign simulation.
49
+
50
+ ## Check a package
51
+
52
+ `hoi4.package_check` accepts a declarative manifest with `schemaVersion: "1.0"` and an `id`.
53
+ Add expected `definitions` and `calls` as `{ "kind": "scripted_effect", "id": "transfer" }` selectors, `registrations` as workspace-relative path and token pairs, `localisation` keys, `assets` as workspace-relative paths, and `requiredCases` as suite path and case id pairs.
54
+ The report separates present, absent, shadowed, and unresolved links and includes source hashes and locations.
55
+ Required cases are checked for declaration; run `hoi4.scenario_test` to evaluate them.
56
+ The manifest accepts no source patches or executable commands.
57
+
58
+ ## Run a suite
59
+
60
+ `hoi4.scenario_test` accepts either an inline `suite` or an authorized workspace-relative `suitePath`.
61
+ The suite has `schemaVersion: "1.0"`, an `id`, and named `cases` in the `mechanic`, `package`, or fixed read-only `tool` domain.
62
+ A mechanic case supplies the same `test` as `hoi4.mechanic_test`; a package case supplies a `manifest`.
63
+ A tool case names one allowed inspect, render, or evaluate operation and supplies its typed `arguments`.
64
+ Cases may declare `sourceSelectors`, output path assertions, and `views` (`summary`, `artifacts`, `diagnostics`).
65
+
66
+ Set `maxCases` to bound a batch.
67
+ Each case receives a content-addressed result artifact; the batch returns its counts and, while cases remain, a `continuation`.
68
+ Pass that continuation with the same suite to resume.
69
+ The token is authenticated and bound to the workspace, caller, suite content, and source revision; changed inputs or source require a fresh run.
70
+ Every requested case is reported as completed, failed, unresolved, or pending.
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.2.0",
4
+ "version": "3.3.0",
5
5
  "description": "Analyze HOI4 events, decisions, impact, tech, AI, and MTTH; build focus trees, GUIs, and maps.",
6
6
  "type": "module",
7
7
  "license": "Apache-2.0",
@@ -42,6 +42,7 @@
42
42
  "docs/setup.md",
43
43
  "docs/events.md",
44
44
  "docs/analysis.md",
45
+ "docs/mechanics.md",
45
46
  "docs/technology.md",
46
47
  "docs/probability.md",
47
48
  "docs/research/probability-adapter-evidence.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.2.0/schemas/configuration.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/continuous-focus-palette.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/custom-weighted-pool.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/decision-inspect-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/event-feature-manifest.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/focus-plan.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/focus-planning-sidecar.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/gui-animation-source.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.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.2.0/schemas/gui-helper.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/gui-helper.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.2.0/schemas/gui-scenario.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/gui-scenario.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.2.0/schemas/helper-expansion-request.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/helper-expansion-request.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.2.0/schemas/helper-expansion-summary.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/helper-expansion-summary.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.2.0/schemas/impact-inspect-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/impact-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.2.0/schemas/map-operation.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v3.3.0/schemas/map-operation.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "oneOf": [
5
5
  {