hoi4-agent-tools 2.2.0 → 2.3.3
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 +28 -0
- package/README.md +30 -21
- package/dist/hoi4_agent_tools/core/clausewitz-evaluation.js +90 -0
- package/dist/hoi4_agent_tools/core/engine.js +5 -0
- package/dist/hoi4_agent_tools/core/index.js +57 -1
- package/dist/hoi4_agent_tools/core/source/ast-path.js +41 -0
- package/dist/hoi4_agent_tools/core/source/index.js +1 -0
- package/dist/hoi4_agent_tools/event/algorithms.js +178 -1
- package/dist/hoi4_agent_tools/event/graph.js +24 -9
- package/dist/hoi4_agent_tools/event/limits.js +5 -2
- package/dist/hoi4_agent_tools/event/service.js +182 -45
- package/dist/hoi4_agent_tools/mcp/server/create.js +3 -1
- package/dist/hoi4_agent_tools/mcp/tools/chaosx.js +13 -63
- package/dist/hoi4_agent_tools/mcp/tools/probability.js +413 -0
- package/dist/hoi4_agent_tools/mcp/tools/technology.js +4 -1
- package/dist/hoi4_agent_tools/probability/adapters.js +344 -0
- package/dist/hoi4_agent_tools/probability/compare.js +178 -0
- package/dist/hoi4_agent_tools/probability/evaluation.js +649 -0
- package/dist/hoi4_agent_tools/probability/index.js +13 -0
- package/dist/hoi4_agent_tools/probability/model.js +5 -0
- package/dist/hoi4_agent_tools/probability/rational.js +145 -0
- package/dist/hoi4_agent_tools/probability/render.js +307 -0
- package/dist/hoi4_agent_tools/probability/sequence.js +858 -0
- package/dist/hoi4_agent_tools/probability/service.js +1168 -0
- package/dist/hoi4_agent_tools/probability/simulation.js +545 -0
- package/dist/hoi4_agent_tools/probability/source-analysis.js +458 -0
- package/dist/hoi4_agent_tools/probability/sweep.js +265 -0
- package/dist/hoi4_agent_tools/probability/trigger-evaluator.js +280 -0
- package/dist/hoi4_agent_tools/probability/value-evaluator.js +357 -0
- package/dist/hoi4_agent_tools/runtime.js +109 -7
- package/dist/hoi4_agent_tools/schemas/probability.js +930 -0
- package/dist/hoi4_agent_tools/technology/graph.js +30 -3
- package/dist/hoi4_agent_tools/technology/queries.js +70 -3
- package/dist/hoi4_agent_tools/technology/service.js +38 -2
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/README.md +1 -0
- package/docs/development.md +2 -0
- package/docs/events.md +2 -2
- package/docs/probability.md +80 -0
- package/docs/research/probability-adapter-evidence.md +64 -0
- package/docs/setup.md +2 -0
- package/docs/technology.md +4 -2
- package/examples/clients/codex-config.toml +3 -0
- package/examples/clients/generic.json +8 -0
- package/examples/probability/adaptive-event-pool.json +92 -0
- package/examples/probability/adaptive-event-sequence-input.json +57 -0
- package/examples/probability/event-mtth-scenarios.json +57 -0
- package/examples/probability/event-mtth-simulate-input.json +37 -0
- package/examples/probability/focus-route-scenarios.json +61 -0
- package/examples/probability/focus-route-sweep-input.json +36 -0
- package/package.json +19 -8
- package/schemas/configuration.schema.json +747 -0
- package/schemas/continuous-focus-palette.schema.json +325 -0
- package/schemas/custom-weighted-pool.schema.json +298 -0
- package/schemas/event-feature-manifest.schema.json +63 -0
- package/schemas/focus-plan.schema.json +927 -0
- package/schemas/focus-planning-sidecar.schema.json +407 -0
- package/schemas/gui-animation-source.schema.json +176 -0
- package/schemas/gui-helper.schema.json +301 -0
- package/schemas/gui-scenario.schema.json +298 -0
- package/schemas/map-operation.schema.json +2284 -0
- package/schemas/operation-result.schema.json +327 -0
- package/schemas/probability-analysis-result.schema.json +2211 -0
- package/schemas/probability-compare-input.schema.json +664 -0
- package/schemas/probability-evaluate-input.schema.json +665 -0
- package/schemas/probability-inspect-input.schema.json +97 -0
- package/schemas/probability-render-input.schema.json +141 -0
- package/schemas/probability-scenario-set.schema.json +430 -0
- package/schemas/probability-sequence-input.schema.json +886 -0
- package/schemas/probability-simulate-input.schema.json +691 -0
- package/schemas/probability-sweep-input.schema.json +702 -0
- package/server.json +3 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scenarioSet": {
|
|
3
|
+
"schemaVersion": "1.0",
|
|
4
|
+
"id": "pool_baseline",
|
|
5
|
+
"scenarios": [{ "id": "baseline", "state": {} }]
|
|
6
|
+
},
|
|
7
|
+
"customPoolManifest": {
|
|
8
|
+
"schemaVersion": "1.0",
|
|
9
|
+
"id": "adaptive_event_pool_example",
|
|
10
|
+
"selection": {
|
|
11
|
+
"mode": "categorical_weighted",
|
|
12
|
+
"cadence": "timer",
|
|
13
|
+
"timerMinDays": 45,
|
|
14
|
+
"timerMaxDays": 60,
|
|
15
|
+
"rounding": "nearest"
|
|
16
|
+
},
|
|
17
|
+
"state": { "minor_events_since_major": 0, "major_gain": 150 },
|
|
18
|
+
"candidates": [
|
|
19
|
+
{ "id": "minor_repeatable", "category": "minor", "weight": 1000, "cap": 1000 },
|
|
20
|
+
{ "id": "major_crisis", "category": "major", "weight": 0, "cap": 1000, "oneTime": true }
|
|
21
|
+
],
|
|
22
|
+
"recovery": [
|
|
23
|
+
{
|
|
24
|
+
"cadence": "monthly",
|
|
25
|
+
"target": "candidate.minor_repeatable.weight",
|
|
26
|
+
"amount": 20,
|
|
27
|
+
"cap": "candidate.minor_repeatable.cap"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"transitions": [
|
|
31
|
+
{
|
|
32
|
+
"when": "selected.category != major",
|
|
33
|
+
"actions": [
|
|
34
|
+
{
|
|
35
|
+
"operation": "add",
|
|
36
|
+
"target": "candidate.major_crisis.weight",
|
|
37
|
+
"value": "state.major_gain"
|
|
38
|
+
},
|
|
39
|
+
{ "operation": "compress_timer", "target": "selection.timer_max_days", "value": 1 }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"when": "selected.category == major",
|
|
44
|
+
"actions": [
|
|
45
|
+
{ "operation": "reset_category", "target": "category.major", "value": 0 },
|
|
46
|
+
{ "operation": "reset_timer", "target": "selection", "value": null }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"horizonDays": 720,
|
|
52
|
+
"maxSteps": 1000,
|
|
53
|
+
"samples": 250000,
|
|
54
|
+
"seed": 3601,
|
|
55
|
+
"confidenceLevel": 0.95,
|
|
56
|
+
"outputs": ["json", "ranking", "timing", "sequence", "unresolved"]
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0",
|
|
3
|
+
"id": "event_mtth_timeline_examples",
|
|
4
|
+
"surfaceHint": "event_mean_time_to_happen",
|
|
5
|
+
"scenarios": [
|
|
6
|
+
{
|
|
7
|
+
"id": "contained_outbreak",
|
|
8
|
+
"label": "Contained outbreak with later containment failure",
|
|
9
|
+
"actor": "EXM",
|
|
10
|
+
"date": "1940.1.1",
|
|
11
|
+
"state": {
|
|
12
|
+
"variable.outbreak_pressure": 25,
|
|
13
|
+
"variable.chaos": 350,
|
|
14
|
+
"has_war": false
|
|
15
|
+
},
|
|
16
|
+
"flags": ["outbreak_active", "containment_program_active"],
|
|
17
|
+
"schedule": [
|
|
18
|
+
{
|
|
19
|
+
"atDay": 60,
|
|
20
|
+
"set": { "variable.outbreak_pressure": 45 }
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"atDay": 120,
|
|
24
|
+
"set": { "variable.chaos": 650 },
|
|
25
|
+
"clearFlags": ["containment_program_active"]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "uncertain_pressure",
|
|
31
|
+
"label": "Pressure and war state sampled",
|
|
32
|
+
"actor": "EXM",
|
|
33
|
+
"date": "1940.1.1",
|
|
34
|
+
"state": { "variable.chaos": 500 },
|
|
35
|
+
"flags": ["outbreak_active"],
|
|
36
|
+
"uncertainInputs": [
|
|
37
|
+
{
|
|
38
|
+
"path": "variable.outbreak_pressure",
|
|
39
|
+
"distribution": {
|
|
40
|
+
"kind": "triangular",
|
|
41
|
+
"min": 20,
|
|
42
|
+
"mode": 50,
|
|
43
|
+
"max": 90
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"path": "has_war",
|
|
48
|
+
"distribution": {
|
|
49
|
+
"kind": "categorical",
|
|
50
|
+
"values": [true, false],
|
|
51
|
+
"probabilities": [0.35, 0.65]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"adapter": "event_mean_time_to_happen",
|
|
3
|
+
"source": { "identifier": "example_outbreak.42" },
|
|
4
|
+
"scenarioSet": {
|
|
5
|
+
"schemaVersion": "1.0",
|
|
6
|
+
"id": "outbreak_simulation",
|
|
7
|
+
"surfaceHint": "event_mean_time_to_happen",
|
|
8
|
+
"scenarios": [
|
|
9
|
+
{
|
|
10
|
+
"id": "uncertain_pressure",
|
|
11
|
+
"actor": "EXM",
|
|
12
|
+
"date": "1940.1.1",
|
|
13
|
+
"state": { "variable.chaos": 500 },
|
|
14
|
+
"flags": ["outbreak_active"],
|
|
15
|
+
"uncertainInputs": [
|
|
16
|
+
{
|
|
17
|
+
"path": "variable.outbreak_pressure",
|
|
18
|
+
"distribution": { "kind": "triangular", "min": 20, "mode": 50, "max": 90 }
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "has_war",
|
|
22
|
+
"distribution": {
|
|
23
|
+
"kind": "categorical",
|
|
24
|
+
"values": [true, false],
|
|
25
|
+
"probabilities": [0.35, 0.65]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"horizonDays": 365,
|
|
33
|
+
"samples": 100000,
|
|
34
|
+
"seed": 19400101,
|
|
35
|
+
"confidenceLevel": 0.95,
|
|
36
|
+
"outputs": ["json", "timing", "waterfall", "unresolved"]
|
|
37
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0",
|
|
3
|
+
"id": "focus_route_choice_examples",
|
|
4
|
+
"surfaceHint": "national_focus_ai_will_do",
|
|
5
|
+
"description": "Representative country states for evaluating the next focus choice.",
|
|
6
|
+
"scenarios": [
|
|
7
|
+
{
|
|
8
|
+
"id": "peace_low_industry",
|
|
9
|
+
"label": "Peace with weak industry",
|
|
10
|
+
"actor": "EXM",
|
|
11
|
+
"date": "1938.1.1",
|
|
12
|
+
"state": {
|
|
13
|
+
"has_war": false,
|
|
14
|
+
"num_of_military_factories": 8,
|
|
15
|
+
"stability": 0.62,
|
|
16
|
+
"world_tension": 0.28,
|
|
17
|
+
"focus.external_factors_complete": true
|
|
18
|
+
},
|
|
19
|
+
"flags": ["route_independent"]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "defensive_war",
|
|
23
|
+
"label": "Defensive war under pressure",
|
|
24
|
+
"actor": "EXM",
|
|
25
|
+
"date": "1939.9.1",
|
|
26
|
+
"state": {
|
|
27
|
+
"has_war": true,
|
|
28
|
+
"is_in_defensive_war": true,
|
|
29
|
+
"num_of_military_factories": 12,
|
|
30
|
+
"stability": 0.45,
|
|
31
|
+
"world_tension": 0.74,
|
|
32
|
+
"focus.external_factors_complete": true
|
|
33
|
+
},
|
|
34
|
+
"flags": ["route_independent", "border_crisis_active"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "uncertain_foreign_support",
|
|
38
|
+
"label": "Foreign support uncertain",
|
|
39
|
+
"actor": "EXM",
|
|
40
|
+
"date": "1939.3.1",
|
|
41
|
+
"state": {
|
|
42
|
+
"has_war": false,
|
|
43
|
+
"num_of_military_factories": 10,
|
|
44
|
+
"stability": 0.55,
|
|
45
|
+
"world_tension": 0.52,
|
|
46
|
+
"focus.external_factors_complete": true
|
|
47
|
+
},
|
|
48
|
+
"flags": ["route_independent"],
|
|
49
|
+
"uncertainInputs": [
|
|
50
|
+
{
|
|
51
|
+
"path": "has_flag.foreign_support_secured",
|
|
52
|
+
"alternatives": [true, false]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"path": "variable.foreign_influence",
|
|
56
|
+
"range": { "min": 20, "max": 80 }
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"adapter": "national_focus_ai_will_do",
|
|
3
|
+
"source": { "identifier": "EXM_prepare_the_border" },
|
|
4
|
+
"scenarioSet": {
|
|
5
|
+
"schemaVersion": "1.0",
|
|
6
|
+
"id": "focus_route_sweep",
|
|
7
|
+
"surfaceHint": "national_focus_ai_will_do",
|
|
8
|
+
"scenarios": [
|
|
9
|
+
{
|
|
10
|
+
"id": "uncertain_foreign_support",
|
|
11
|
+
"actor": "EXM",
|
|
12
|
+
"date": "1939.3.1",
|
|
13
|
+
"state": {
|
|
14
|
+
"has_war": false,
|
|
15
|
+
"stability": 0.55,
|
|
16
|
+
"world_tension": 0.52,
|
|
17
|
+
"focus.external_factors_complete": true
|
|
18
|
+
},
|
|
19
|
+
"uncertainInputs": [
|
|
20
|
+
{
|
|
21
|
+
"path": "variable.foreign_influence",
|
|
22
|
+
"range": { "min": 20, "max": 80 }
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"candidatePool": ["EXM_expand_industry", "EXM_prepare_the_border", "EXM_seek_foreign_support"],
|
|
29
|
+
"sweep": {
|
|
30
|
+
"paths": ["variable.foreign_influence"],
|
|
31
|
+
"steps": 25,
|
|
32
|
+
"pairwise": false,
|
|
33
|
+
"findRankReversals": true
|
|
34
|
+
},
|
|
35
|
+
"outputs": ["json", "ranking", "matrix", "waterfall", "sensitivity", "unresolved"]
|
|
36
|
+
}
|
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": "2.
|
|
5
|
-
"description": "Analyze HOI4 events
|
|
4
|
+
"version": "2.3.3",
|
|
5
|
+
"description": "Analyze HOI4 events, tech trees, AI weights, and MTTH; build focus trees, GUIs, and maps.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"author": "HOI4 Agent Tools contributors",
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
"event-chains",
|
|
25
25
|
"technology-trees",
|
|
26
26
|
"doctrines",
|
|
27
|
+
"ai-weights",
|
|
28
|
+
"mtth",
|
|
29
|
+
"probability-analysis",
|
|
27
30
|
"hoi4-events",
|
|
28
31
|
"scripted-gui",
|
|
29
32
|
"hoi4-map"
|
|
@@ -37,11 +40,16 @@
|
|
|
37
40
|
"docs/setup.md",
|
|
38
41
|
"docs/events.md",
|
|
39
42
|
"docs/technology.md",
|
|
43
|
+
"docs/probability.md",
|
|
44
|
+
"docs/research/probability-adapter-evidence.md",
|
|
40
45
|
"docs/focus.md",
|
|
41
46
|
"docs/gui.md",
|
|
42
47
|
"docs/map.md",
|
|
43
48
|
"docs/http.md",
|
|
44
49
|
"docs/development.md",
|
|
50
|
+
"examples/clients/",
|
|
51
|
+
"examples/probability/",
|
|
52
|
+
"schemas/",
|
|
45
53
|
"server.json",
|
|
46
54
|
"README.md",
|
|
47
55
|
"CHANGELOG.md",
|
|
@@ -66,12 +74,13 @@
|
|
|
66
74
|
"test:local": "tsx scripts/run-local-tests.ts",
|
|
67
75
|
"test:coverage": "vitest run --coverage",
|
|
68
76
|
"benchmark": "node --expose-gc --import tsx scripts/benchmark.ts",
|
|
69
|
-
"fixtures:generate": "npm run fixtures:generate:focus && npm run fixtures:generate:gui && npm run fixtures:generate:map && npm run fixtures:generate:event && npm run fixtures:generate:technology",
|
|
77
|
+
"fixtures:generate": "npm run fixtures:generate:focus && npm run fixtures:generate:gui && npm run fixtures:generate:map && npm run fixtures:generate:event && npm run fixtures:generate:technology && npm run fixtures:generate:probability",
|
|
70
78
|
"fixtures:generate:focus": "tsx scripts/generate-fixtures.ts",
|
|
71
79
|
"fixtures:generate:gui": "tsx scripts/generate-gui-fixture.ts",
|
|
72
80
|
"fixtures:generate:map": "tsx scripts/generate-map-fixture.ts",
|
|
73
81
|
"fixtures:generate:event": "tsx scripts/generate-event-fixture.ts",
|
|
74
82
|
"fixtures:generate:technology": "tsx scripts/generate-technology-fixture.ts",
|
|
83
|
+
"fixtures:generate:probability": "tsx scripts/generate-probability-fixture.ts",
|
|
75
84
|
"fixtures:check": "npm run fixtures:generate && tsx scripts/check-generated.ts fixtures",
|
|
76
85
|
"schemas:generate": "tsx scripts/generate-schemas.ts",
|
|
77
86
|
"schemas:check": "tsx scripts/generate-schemas.ts && tsx scripts/check-generated.ts schemas",
|
|
@@ -92,13 +101,13 @@
|
|
|
92
101
|
"fast-glob": "3.3.3",
|
|
93
102
|
"fontkit": "2.0.4",
|
|
94
103
|
"iconv-lite": "0.7.3",
|
|
95
|
-
"jose": "6.2.
|
|
104
|
+
"jose": "6.2.4",
|
|
96
105
|
"sharp": "0.35.3",
|
|
97
106
|
"zod": "4.4.3"
|
|
98
107
|
},
|
|
99
108
|
"devDependencies": {
|
|
100
109
|
"@eslint/js": "10.0.1",
|
|
101
|
-
"@modelcontextprotocol/inspector": "0.
|
|
110
|
+
"@modelcontextprotocol/inspector": "1.0.0",
|
|
102
111
|
"@types/express": "5.0.6",
|
|
103
112
|
"@types/fontkit": "2.0.9",
|
|
104
113
|
"@types/node": "22.20.1",
|
|
@@ -109,15 +118,17 @@
|
|
|
109
118
|
"eslint": "10.7.0",
|
|
110
119
|
"fast-check": "4.9.0",
|
|
111
120
|
"pixelmatch": "7.2.0",
|
|
112
|
-
"prettier": "3.9.
|
|
113
|
-
"tsx": "4.23.
|
|
121
|
+
"prettier": "3.9.6",
|
|
122
|
+
"tsx": "4.23.1",
|
|
114
123
|
"typescript": "6.0.3",
|
|
115
|
-
"typescript-eslint": "8.
|
|
124
|
+
"typescript-eslint": "8.65.0",
|
|
116
125
|
"vitest": "4.1.10"
|
|
117
126
|
},
|
|
118
127
|
"overrides": {
|
|
119
128
|
"@hono/node-server": "2.0.11",
|
|
129
|
+
"brace-expansion": "5.0.8",
|
|
120
130
|
"fast-uri": "3.1.4",
|
|
131
|
+
"postcss": "8.5.23",
|
|
121
132
|
"shell-quote": "1.10.0"
|
|
122
133
|
},
|
|
123
134
|
"publishConfig": {
|