hoi4-agent-tools 4.6.5 → 4.8.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 +40 -5
- package/README.md +32 -13
- package/dist/hoi4_agent_tools/core/engine-client.js +342 -0
- package/dist/hoi4_agent_tools/core/operation-result.js +33 -5
- package/dist/hoi4_agent_tools/core/resident-engine.js +273 -0
- package/dist/hoi4_agent_tools/core/temporary-directories.js +3 -2
- package/dist/hoi4_agent_tools/decision/service.js +7 -0
- package/dist/hoi4_agent_tools/event/service.js +18 -6
- package/dist/hoi4_agent_tools/event/summary.js +9 -0
- package/dist/hoi4_agent_tools/focus/compact.js +197 -18
- package/dist/hoi4_agent_tools/focus/engine-layout.js +201 -0
- package/dist/hoi4_agent_tools/focus/game-render.js +72 -0
- package/dist/hoi4_agent_tools/focus/game-view-output.js +160 -0
- package/dist/hoi4_agent_tools/focus/job-operations.js +3 -1
- package/dist/hoi4_agent_tools/focus/layout.js +3 -2
- package/dist/hoi4_agent_tools/focus/native-effects.js +4 -4
- package/dist/hoi4_agent_tools/focus/quality/branches.js +32 -0
- package/dist/hoi4_agent_tools/focus/quality/calibration.js +364 -0
- package/dist/hoi4_agent_tools/focus/quality/delta.js +85 -0
- package/dist/hoi4_agent_tools/focus/quality/focus-quality-calibration.json +2265 -0
- package/dist/hoi4_agent_tools/focus/quality/graph.js +170 -0
- package/dist/hoi4_agent_tools/focus/quality/index.js +24 -0
- package/dist/hoi4_agent_tools/focus/quality/inline-images.js +132 -0
- package/dist/hoi4_agent_tools/focus/quality/metrics.js +424 -0
- package/dist/hoi4_agent_tools/focus/quality/orthogonal.js +213 -0
- package/dist/hoi4_agent_tools/focus/quality/positions.js +41 -0
- package/dist/hoi4_agent_tools/focus/quality/schematic.js +243 -0
- package/dist/hoi4_agent_tools/focus/quality/scorecard.js +549 -0
- package/dist/hoi4_agent_tools/focus/quality/stored-calibration.js +7 -0
- package/dist/hoi4_agent_tools/focus/quality/tool-output.js +113 -0
- package/dist/hoi4_agent_tools/focus/quality/types.js +5 -0
- package/dist/hoi4_agent_tools/focus/render.js +21 -9
- package/dist/hoi4_agent_tools/focus/tool-operations.js +364 -25
- package/dist/hoi4_agent_tools/focus/tool-support.js +1 -1
- package/dist/hoi4_agent_tools/gui/assets.js +18 -0
- package/dist/hoi4_agent_tools/gui/dds.js +38 -5
- package/dist/hoi4_agent_tools/gui/engine-textures.js +48 -0
- package/dist/hoi4_agent_tools/gui/source-graph.js +7 -0
- package/dist/hoi4_agent_tools/gui/tool-operations.js +23 -4
- package/dist/hoi4_agent_tools/gui/validators.js +31 -2
- package/dist/hoi4_agent_tools/ideas/inspect.js +43 -0
- package/dist/hoi4_agent_tools/localisation/inspect.js +34 -0
- package/dist/hoi4_agent_tools/mcp/server/argument-errors.js +2 -0
- package/dist/hoi4_agent_tools/mcp/server/instructions.js +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/event.js +2 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +76 -4
- package/dist/hoi4_agent_tools/mcp/tools/reference.js +18 -0
- package/dist/hoi4_agent_tools/probability/operations.js +27 -1
- package/dist/hoi4_agent_tools/probability/service.js +91 -11
- package/dist/hoi4_agent_tools/probability/source-analysis.js +2 -2
- package/dist/hoi4_agent_tools/probability/sweep.js +20 -6
- package/dist/hoi4_agent_tools/reference/command-phrases.json +11065 -0
- package/dist/hoi4_agent_tools/reference/error-log.js +24 -0
- package/dist/hoi4_agent_tools/reference/game-text.js +109 -0
- package/dist/hoi4_agent_tools/reference/known-mistakes.js +8 -5
- package/dist/hoi4_agent_tools/reference/known-mistakes.json +4 -4
- package/dist/hoi4_agent_tools/reference/operations.js +68 -2
- package/dist/hoi4_agent_tools/reference/ranking.js +92 -2
- package/dist/hoi4_agent_tools/reference/script-validation.js +46 -6
- package/dist/hoi4_agent_tools/reference/service.js +125 -21
- package/dist/hoi4_agent_tools/reference/source-lookup.js +8 -0
- package/dist/hoi4_agent_tools/schemas/focus-requests.js +68 -7
- package/dist/hoi4_agent_tools/schemas/focus.js +121 -6
- package/dist/hoi4_agent_tools/schemas/ideas.js +142 -0
- package/dist/hoi4_agent_tools/schemas/localisation.js +94 -0
- package/dist/hoi4_agent_tools/schemas/mod-tools.js +11 -0
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/configuration.md +17 -17
- package/docs/focus.md +104 -4
- package/docs/reference.md +1 -1
- package/docs/research/reference-benchmark.md +152 -1
- package/docs/setup.md +1 -1
- package/docs/tools.md +48 -44
- package/docs/troubleshooting.md +13 -12
- package/engine/README.md +284 -0
- package/engine/bin/darwin-arm64/hoi4-engine +0 -0
- package/engine/bin/linux-arm64/hoi4-engine +0 -0
- package/engine/bin/linux-x64/hoi4-engine +0 -0
- package/engine/bin/manifest.json +26 -0
- package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +5 -1
- package/schemas/configuration.schema.json +1 -1
- 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 +146 -120
- package/schemas/focus-planning-sidecar.schema.json +15 -7
- 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 +1 -1
- 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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { workspaceIdSchema } from './common.js';
|
|
3
|
+
/** `hoi4.idea_inspect`, answered by `hoi4-engine ideas` (ADR 0074). */
|
|
4
|
+
export const ideaInspectRequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
workspaceId: workspaceIdSchema,
|
|
7
|
+
/** idea: a national spirit, law or advisor idea. character: a leader, advisor or commander. */
|
|
8
|
+
kind: z.enum(['idea', 'character']).default('idea'),
|
|
9
|
+
/** The idea or character to inspect. Leave it out with audit. */
|
|
10
|
+
id: z.string().min(1).max(256).optional(),
|
|
11
|
+
/** Check every idea or character the mod defines instead of one. */
|
|
12
|
+
audit: z.boolean().default(false),
|
|
13
|
+
/** One: mentions listed. Audit: examples kept per problem code. */
|
|
14
|
+
limit: z.number().int().min(1).max(50).default(5),
|
|
15
|
+
})
|
|
16
|
+
.strict()
|
|
17
|
+
.refine((input) => input.audit || input.id !== undefined, {
|
|
18
|
+
message: 'pass an id, or audit: true',
|
|
19
|
+
path: ['id'],
|
|
20
|
+
});
|
|
21
|
+
const placeSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
path: z.string().max(1024),
|
|
24
|
+
line: z.number().int().min(0),
|
|
25
|
+
layer: z.string().max(256),
|
|
26
|
+
layerKind: z.enum(['game', 'dlc', 'dependency', 'mod']),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
const fieldSchema = z
|
|
30
|
+
.object({ name: z.string().max(128), text: z.string().max(2400), line: z.number().int() })
|
|
31
|
+
.strict();
|
|
32
|
+
const problemSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
code: z.string().max(64),
|
|
35
|
+
severity: z.enum(['warning', 'info']),
|
|
36
|
+
message: z.string().max(1200),
|
|
37
|
+
line: z.number().int().min(0),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
const textSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
language: z.string().max(64),
|
|
43
|
+
text: z.string().max(2400),
|
|
44
|
+
path: z.string().max(1024),
|
|
45
|
+
line: z.number().int().min(0),
|
|
46
|
+
layer: z.string().max(256),
|
|
47
|
+
layerKind: z.enum(['game', 'dlc', 'dependency', 'mod']),
|
|
48
|
+
replace: z.boolean(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
/** One idea or character, as the engine answers it. */
|
|
52
|
+
export const ideaEngineInspectionSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
kind: z.enum(['idea', 'character']),
|
|
55
|
+
id: z.string().max(256),
|
|
56
|
+
found: z.boolean(),
|
|
57
|
+
definitions: z.array(placeSchema).max(256),
|
|
58
|
+
category: z.string().max(128).optional(),
|
|
59
|
+
picture: z
|
|
60
|
+
.object({
|
|
61
|
+
sprite: z.string().max(512),
|
|
62
|
+
defined: z.boolean(),
|
|
63
|
+
texture: z.string().max(1024).nullable(),
|
|
64
|
+
textureExists: z.boolean().nullable(),
|
|
65
|
+
})
|
|
66
|
+
.strict()
|
|
67
|
+
.optional(),
|
|
68
|
+
modifiers: z
|
|
69
|
+
.array(z
|
|
70
|
+
.object({
|
|
71
|
+
block: z.string().max(64),
|
|
72
|
+
key: z.string().max(256),
|
|
73
|
+
value: z.string().max(256),
|
|
74
|
+
known: z.boolean(),
|
|
75
|
+
line: z.number().int(),
|
|
76
|
+
})
|
|
77
|
+
.strict())
|
|
78
|
+
.max(512)
|
|
79
|
+
.optional(),
|
|
80
|
+
fields: z.array(fieldSchema).max(128).optional(),
|
|
81
|
+
roles: z
|
|
82
|
+
.array(z
|
|
83
|
+
.object({
|
|
84
|
+
role: z.string().max(64),
|
|
85
|
+
instance: z.number().int().min(0).nullable(),
|
|
86
|
+
fields: z.array(fieldSchema).max(64),
|
|
87
|
+
traits: z
|
|
88
|
+
.array(z.object({ name: z.string().max(256), known: z.boolean() }).strict())
|
|
89
|
+
.max(64),
|
|
90
|
+
line: z.number().int(),
|
|
91
|
+
})
|
|
92
|
+
.strict())
|
|
93
|
+
.max(64)
|
|
94
|
+
.optional(),
|
|
95
|
+
portraits: z
|
|
96
|
+
.array(z
|
|
97
|
+
.object({ slot: z.string().max(64), value: z.string().max(1024), exists: z.boolean() })
|
|
98
|
+
.strict())
|
|
99
|
+
.max(128)
|
|
100
|
+
.optional(),
|
|
101
|
+
advisorOf: z.string().max(256).optional(),
|
|
102
|
+
texts: z
|
|
103
|
+
.array(z.object({ key: z.string().max(256), texts: z.array(textSchema).max(64) }).strict())
|
|
104
|
+
.max(4),
|
|
105
|
+
mentions: z
|
|
106
|
+
.array(z
|
|
107
|
+
.object({ path: z.string().max(1024), line: z.number().int(), layer: z.string() })
|
|
108
|
+
.strict())
|
|
109
|
+
.max(100),
|
|
110
|
+
mentionsTruncated: z.boolean(),
|
|
111
|
+
problems: z.array(problemSchema).max(256),
|
|
112
|
+
suggestions: z.array(z.string().max(256)).max(3).optional(),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
115
|
+
/** Every idea or character of the mod, as the engine answers an audit. */
|
|
116
|
+
export const ideaEngineAuditSchema = z
|
|
117
|
+
.object({
|
|
118
|
+
kind: z.enum(['idea', 'character']),
|
|
119
|
+
checked: z.number().int().min(0),
|
|
120
|
+
counts: z.record(z.string(), z.number().int().min(0)),
|
|
121
|
+
problems: z
|
|
122
|
+
.array(z
|
|
123
|
+
.object({
|
|
124
|
+
code: z.string().max(64),
|
|
125
|
+
severity: z.enum(['warning', 'info']),
|
|
126
|
+
id: z.string().max(256),
|
|
127
|
+
path: z.string().max(1024),
|
|
128
|
+
line: z.number().int().min(0),
|
|
129
|
+
message: z.string().max(1200),
|
|
130
|
+
})
|
|
131
|
+
.strict())
|
|
132
|
+
.max(1000),
|
|
133
|
+
truncated: z.boolean(),
|
|
134
|
+
})
|
|
135
|
+
.strict();
|
|
136
|
+
export const ideaInspectDataSchema = z
|
|
137
|
+
.object({
|
|
138
|
+
inspection: ideaEngineInspectionSchema.optional(),
|
|
139
|
+
audit: ideaEngineAuditSchema.optional(),
|
|
140
|
+
durationMs: z.number().int().min(0),
|
|
141
|
+
})
|
|
142
|
+
.strict();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { workspaceIdSchema } from './common.js';
|
|
3
|
+
/** `hoi4.localisation_inspect`, answered by `hoi4-engine localisation` (ADR 0074). */
|
|
4
|
+
export const localisationInspectRequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
workspaceId: workspaceIdSchema,
|
|
7
|
+
/** key: one key in every language. audit: the mod's problems. coverage: keys per language. */
|
|
8
|
+
mode: z.enum(['key', 'audit', 'coverage']).default('audit'),
|
|
9
|
+
key: z.string().min(1).max(256).optional(),
|
|
10
|
+
/** Restricts audit and coverage to one language, for example `german`. */
|
|
11
|
+
language: z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^[a-z_]{2,32}$/u)
|
|
14
|
+
.optional(),
|
|
15
|
+
/** key: mentions listed. audit: examples kept per problem code. */
|
|
16
|
+
limit: z.number().int().min(1).max(50).default(5),
|
|
17
|
+
})
|
|
18
|
+
.strict()
|
|
19
|
+
.refine((input) => input.mode !== 'key' || input.key !== undefined, {
|
|
20
|
+
message: 'mode key needs a key',
|
|
21
|
+
path: ['key'],
|
|
22
|
+
});
|
|
23
|
+
const definitionSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
language: z.string().max(64),
|
|
26
|
+
text: z.string().max(2400),
|
|
27
|
+
path: z.string().max(1024),
|
|
28
|
+
line: z.number().int().min(0),
|
|
29
|
+
layer: z.string().max(256),
|
|
30
|
+
layerKind: z.enum(['game', 'dlc', 'dependency', 'mod']),
|
|
31
|
+
replace: z.boolean(),
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
const problemSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
code: z.string().max(64),
|
|
37
|
+
severity: z.enum(['warning', 'info']),
|
|
38
|
+
key: z.string().max(256).nullable(),
|
|
39
|
+
language: z.string().max(64).nullable(),
|
|
40
|
+
path: z.string().max(1024),
|
|
41
|
+
line: z.number().int().min(0),
|
|
42
|
+
message: z.string().max(1200),
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
/** The engine's answer, checked as it arrives. */
|
|
46
|
+
export const localisationEngineResponseSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
mode: z.enum(['key', 'audit', 'coverage']),
|
|
49
|
+
shippedLanguages: z.array(z.string().max(64)).max(64),
|
|
50
|
+
supportedLanguages: z.array(z.string().max(64)).max(64),
|
|
51
|
+
mainLanguage: z.string().max(64).nullable(),
|
|
52
|
+
filesRead: z.number().int().min(0),
|
|
53
|
+
key: z
|
|
54
|
+
.object({
|
|
55
|
+
key: z.string().max(256),
|
|
56
|
+
found: z.boolean(),
|
|
57
|
+
definitions: z.array(definitionSchema).max(512),
|
|
58
|
+
missingLanguages: z.array(z.string().max(64)).max(64),
|
|
59
|
+
mentions: z
|
|
60
|
+
.array(z
|
|
61
|
+
.object({ path: z.string().max(1024), line: z.number().int(), layer: z.string() })
|
|
62
|
+
.strict())
|
|
63
|
+
.max(200),
|
|
64
|
+
mentionsTruncated: z.boolean(),
|
|
65
|
+
suggestions: z.array(z.string().max(256)).max(3).optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict()
|
|
68
|
+
.optional(),
|
|
69
|
+
audit: z
|
|
70
|
+
.object({
|
|
71
|
+
counts: z.record(z.string(), z.number().int().min(0)),
|
|
72
|
+
problems: z.array(problemSchema).max(4000),
|
|
73
|
+
truncated: z.boolean(),
|
|
74
|
+
})
|
|
75
|
+
.strict()
|
|
76
|
+
.optional(),
|
|
77
|
+
coverage: z
|
|
78
|
+
.array(z
|
|
79
|
+
.object({
|
|
80
|
+
language: z.string().max(64),
|
|
81
|
+
files: z.number().int().min(0),
|
|
82
|
+
keys: z.number().int().min(0),
|
|
83
|
+
missing: z.number().int().min(0),
|
|
84
|
+
supported: z.boolean(),
|
|
85
|
+
})
|
|
86
|
+
.strict())
|
|
87
|
+
.max(64)
|
|
88
|
+
.optional(),
|
|
89
|
+
})
|
|
90
|
+
.strict();
|
|
91
|
+
/** The tool's data: the engine's answer with the problem examples bounded for the inline reply. */
|
|
92
|
+
export const localisationInspectDataSchema = localisationEngineResponseSchema.extend({
|
|
93
|
+
durationMs: z.number().int().min(0),
|
|
94
|
+
});
|
|
@@ -35,6 +35,17 @@ export const errorLogDataSchema = z
|
|
|
35
35
|
entries: z.number().int().min(0),
|
|
36
36
|
})
|
|
37
37
|
.strict(),
|
|
38
|
+
/**
|
|
39
|
+
* The mods the launch that wrote the log ran with, from `logs/system.log` of the same launch.
|
|
40
|
+
* Absent when that log is missing; `modLoaded` is absent when the mod has no descriptor name.
|
|
41
|
+
*/
|
|
42
|
+
launch: z
|
|
43
|
+
.object({
|
|
44
|
+
activeMods: z.array(z.string().max(256)).max(64),
|
|
45
|
+
modLoaded: z.boolean().optional(),
|
|
46
|
+
})
|
|
47
|
+
.strict()
|
|
48
|
+
.optional(),
|
|
38
49
|
scope: z.enum(['all', 'mod', 'unlocated']),
|
|
39
50
|
totalEntries: z.number().int().min(0),
|
|
40
51
|
distinctEntries: z.number().int().min(0),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
export const PACKAGE_NAME = 'hoi4-agent-tools';
|
|
3
|
-
export const PACKAGE_VERSION = '4.
|
|
3
|
+
export const PACKAGE_VERSION = '4.8.0';
|
|
4
4
|
export const MCP_PROTOCOL_VERSION = LATEST_PROTOCOL_VERSION;
|
|
5
5
|
export const CONFIG_VERSION = 1;
|
|
6
6
|
export const TRANSACTION_VERSION = 2;
|
package/docs/configuration.md
CHANGED
|
@@ -105,23 +105,23 @@ Over HTTP, a principal sees only the workspaces granted to it, and any other ID
|
|
|
105
105
|
|
|
106
106
|
Each entry in `workspaces` registers one source folder.
|
|
107
107
|
|
|
108
|
-
| Key | Type | Range | Default
|
|
109
|
-
| ----------------- | --------------------------- | ---------------------------------------------- |
|
|
110
|
-
| `id` | string | lower-case letter, then up to 63 of `a-z0-9_-` | none
|
|
111
|
-
| `name` | string | 1–200 characters | none
|
|
112
|
-
| `root` | path | | none
|
|
113
|
-
| `kind` | `mod`, `game`, `dependency` | | `mod`
|
|
114
|
-
| `gameRoot` | path | | top-level `gameRoot` for `mod`
|
|
115
|
-
| `includeGameDlc` | boolean | | `true`
|
|
116
|
-
| `dependencyRoots` | array of paths | up to 16 | `[]`
|
|
117
|
-
| `dependencies` | array of objects | up to 16 | `[]`
|
|
118
|
-
| `replacePaths` | array of relative paths | up to 1,000 | `[]`
|
|
119
|
-
| `wikiRoot` | absolute path | | `
|
|
120
|
-
| `scriptDocsRoot` | absolute path | | `script_docs/` in the mod
|
|
121
|
-
| `roots` | object | | see below
|
|
122
|
-
| `artifactRoot` | path | | see below
|
|
123
|
-
| `cacheRoot` | path | | see below
|
|
124
|
-
| `fixtureRoot` | path | | unset
|
|
108
|
+
| Key | Type | Range | Default | Purpose |
|
|
109
|
+
| ----------------- | --------------------------- | ---------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `id` | string | lower-case letter, then up to 63 of `a-z0-9_-` | none | Workspace ID used in tool calls and grants; required. `current` is reserved. |
|
|
111
|
+
| `name` | string | 1–200 characters | none | Display name; required. |
|
|
112
|
+
| `root` | path | | none | The workspace folder; required and must exist. |
|
|
113
|
+
| `kind` | `mod`, `game`, `dependency` | | `mod` | `mod` is writable source. `game` registers an installed game as read-only source with its DLC layered after it. `dependency` is read-only source. |
|
|
114
|
+
| `gameRoot` | path | | top-level `gameRoot` for `mod` | The installed game loaded beneath this workspace. |
|
|
115
|
+
| `includeGameDlc` | boolean | | `true` | Layer the game's `dlc/` and `integrated_dlc/` folders between the game and the mod. Set `false` to analyze the base game alone. |
|
|
116
|
+
| `dependencyRoots` | array of paths | up to 16 | `[]` | Read-only mods loaded after the game and DLC and before this workspace, in list order. |
|
|
117
|
+
| `dependencies` | array of objects | up to 16 | `[]` | The same as `dependencyRoots`, with a `replacePaths` list per dependency: `{ "root": "...", "replacePaths": ["..."] }`. Use either this or `dependencyRoots`, not both. |
|
|
118
|
+
| `replacePaths` | array of relative paths | up to 1,000 | `[]` | Folders whose earlier-loaded files this workspace unloads, as `replace_path` does. Entries from the folder's `descriptor.mod` are added automatically. Ignored for `kind: "game"`. |
|
|
119
|
+
| `wikiRoot` | absolute path | | `hoi4_wiki/` in the mod, else `paradox_wiki/` | Folder of the kit's HOI4 wiki used by the reference tools. |
|
|
120
|
+
| `scriptDocsRoot` | absolute path | | `script_docs/` in the mod | Folder of a generated script documentation dump used by the reference tools. |
|
|
121
|
+
| `roots` | object | | see below | Folders, relative to each source layer, that the domain tools scan. |
|
|
122
|
+
| `artifactRoot` | path | | see below | Where rendered images and other generated results are stored. |
|
|
123
|
+
| `cacheRoot` | path | | see below | Where rewrite transactions and locks are stored. |
|
|
124
|
+
| `fixtureRoot` | path | | unset | A read-only folder of extra source files scanned with the workspace at the base game's load position and treated as workspace-owned source. |
|
|
125
125
|
|
|
126
126
|
`artifactRoot` and `cacheRoot` default to `<workspaceStorageRoot>/<id>/artifacts` and `<workspaceStorageRoot>/<id>/cache`, or, without `workspaceStorageRoot`, to `.hoi4-agent/artifacts` and `.hoi4-agent/cache` inside a `mod` workspace.
|
|
127
127
|
A `game` or `dependency` workspace needs both, either explicitly or through `workspaceStorageRoot`.
|
package/docs/focus.md
CHANGED
|
@@ -118,6 +118,66 @@ When `treeId` is also supplied, it must equal `plan.id`.
|
|
|
118
118
|
|
|
119
119
|
For a missing target, call `hoi4.focus_rewrite` with `createIfMissing: true`. Review the proposed and final artifacts returned by the rewrite, then inspect and render the result. `hoi4.focus_render` returns a deterministic PNG with decoded source icons. Do not call a tree complete with placeholder rewards, missing localisation, missing icons, or absent AI choices.
|
|
120
120
|
|
|
121
|
+
## Layout quality
|
|
122
|
+
|
|
123
|
+
A tree can be structurally correct and still look wrong: a main line that steps one column left on every row, one branch floating off in a corner, half the canvas empty. Structure and layout are separate questions, so every `hoi4.focus_inspect` and `hoi4.focus_rewrite` result carries a **layout verdict** next to the structural answer. `validation.passed` stays the structural answer; the check `focus-layout-verdict` carries the layout one. "Structure ok" never means the layout is good.
|
|
124
|
+
|
|
125
|
+
| Verdict | Meaning | What to do |
|
|
126
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
|
127
|
+
| `pass` | Every calibrated metric lies inside the range of the installed game's own trees. | Look at the render anyway: metrics cannot see composition. |
|
|
128
|
+
| `review` | A metric leaves the vanilla range, or a design flag is raised. Advisory. | Look at `hoi4.focus_render` and decide whether it is intended. |
|
|
129
|
+
| `revise` | A metric is far outside the vanilla range, or five or more are outside it. | The tree is not finished. Repair the failing branch, then inspect again. |
|
|
130
|
+
| `blocked` | A hard defect: two focuses on one coordinate, a prerequisite that is not above its dependant, or plaques that overlap in game. | Fix the defect first. Hand-typed coordinates are the usual cause. |
|
|
131
|
+
|
|
132
|
+
The result also carries a **scorecard** (at most 12 rows inline, the full list in the linked artifact), a fix for each failing row (`fix.action`, `fix.targetFocusIds`, `fix.suggested`, `fix.expectedMetricChange`, `fix.preservesGameplay`), `nextActions`, and `notEvaluated`, which always names what the tool cannot judge: gameplay and balance, visual review, and in-game connector geometry. A tree below 8 focuses gets only the hard-defect checks, and a tree below 40 focuses is never asked to `revise` because vanilla has too few small trees to set a limit.
|
|
133
|
+
|
|
134
|
+
### Metrics
|
|
135
|
+
|
|
136
|
+
| Id | What it measures |
|
|
137
|
+
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
138
|
+
| H1 | Focuses on the same coordinate. Branches that are never visible together (`allow_branch`, hidden, or below a conditional focus) may share one. |
|
|
139
|
+
| H2 | A prerequisite that is not on an earlier row than its dependant. |
|
|
140
|
+
| H3 | Plaques closer than their own width (about 1.6 columns) on one row; the game's minimum spacing is 2. |
|
|
141
|
+
| H4 | Connector stems that run through an unrelated plaque, per 100 links. Advisory. |
|
|
142
|
+
| H5 | Stems that cross the bar of an unrelated connector, per 100 links. Advisory. |
|
|
143
|
+
| S1 | Largest empty rectangle as a fraction of the canvas. |
|
|
144
|
+
| S2, S3 | Side balance (focuses left against right of the centre column) and mass skew (mean column against the centre). |
|
|
145
|
+
| S4 | Fill ratio: focuses over the cells of the bounding box. Low is bad. |
|
|
146
|
+
| S5 | Row-centroid wander: how far the centre of each row drifts, as a fraction of the width. |
|
|
147
|
+
| S6 | Single-focus chains that jog sideways, per 100 links. |
|
|
148
|
+
| S7 | Sibling subtrees that share columns on the same rows, as a fraction of sibling pairs. |
|
|
149
|
+
| S8 | Largest distance between a fan-out's centre and its parent, in columns. Shown, never part of the verdict. |
|
|
150
|
+
| S9 | Unrelated connectors that share a bar or stem, per 100 links. Advisory. |
|
|
151
|
+
| S10 | Largest gap in rows between a focus and the row after its lowest prerequisite. |
|
|
152
|
+
| S11 | Sibling groups whose members sit on different rows. |
|
|
153
|
+
| D1, D2 | Longest run of single-successor focuses, and the fraction of leaves. |
|
|
154
|
+
| D3, D4 | Exclusive choices that rejoin six or more rows later, and a canvas taller than 2.5 rows per plaque column. |
|
|
155
|
+
|
|
156
|
+
The limits of S1 to S11, H4, H5, D1 and D2 are computed from the installed game's national focus trees (67 trees of 8 or more focuses, in two size buckets: 40 to 120 and over 120 focuses) and stored as derived numbers in `src/hoi4_agent_tools/focus/quality/focus-quality-calibration.json`. `review` starts at the edge of the vanilla range; `revise` starts a margin beyond it. H4, H5 and S9 can raise a tree to `review` at most (`advisoryMetrics` in the calibration file). Design flags (D1 to D4) are proxies for the question "does the player choose anything?" and always go to a person: the tool never changes prerequisites, rewards or names for them.
|
|
157
|
+
|
|
158
|
+
`npm run focus:calibrate -- --write` recomputes the file from the installed game. The local test `tests/local/focus-quality-calibration.test.ts` recomputes it whenever the game is found and fails when the stored file differs. `npm run focus:calibrate -- --report` prints how often an unseen vanilla-quality tree is flagged: about 80 percent `pass`, 17 percent `review` and 3 percent `revise` with the limits fitted without that tree (game 1.19.4.1).
|
|
159
|
+
|
|
160
|
+
### Connector model
|
|
161
|
+
|
|
162
|
+
The game draws right-angle connectors: a short stem leaves the bottom of the parent's plaque, a horizontal bar runs just under the parent (0.28 rows below its row), and a long vertical drops in the child's column from the bar into the top of the child's icon. A plaque is centred on its focus's coordinates, about 1.61 columns wide and 0.28 rows high, with the icon above it (icon and plaque span about 0.8 rows). A connector across several rows therefore runs down the child's column past the rows in between, and that vertical is what crosses other bars or passes through other plaques. Crossings, connector-through-plaque and shared-bar counts use that model, not the curved connector of the icon render, which over-reported crossings by a factor of nine on vanilla trees. All connectors between the parents and children of an **all-to-all bundle** (two or more parents that are each a prerequisite of the same two or more children) share one bar in the game and are never counted against each other, and neither are the members of an OR group. All-to-all bundles and OR groups share one dotted bar at the same height under the parents, and each child gets one vertical in its own column. The in-game run of 2026-11-02 on 1.19.4.1, at the default UI scale and zoom (1 column = 96 px, 1 row = 130 px), confirmed the plaque width and this bar placement, including multi-row connectors, and showed that an exclusive mark sits midway between the two focuses on the plaque line and fits at a spacing of 2. Other UI scales and zoom levels are unverified. The Rust layout engine uses the same rules (`engine/crates/focus/src/geometry.rs`), and `engine/crates/focus/tests/fixtures/connector-parity.json` holds hand-counted trees that both implementations check.
|
|
163
|
+
|
|
164
|
+
`FOCUS_LAYOUT_CONNECTOR_CROSSING_UNSATISFIED`, `FOCUS_AVOIDABLE_CONNECTOR_CROSSING` and `FOCUS_LAYOUT_CONNECTOR_THROUGH_NODE` come from the curved model and are no longer shown in inspect and render results; the linked artifact keeps them.
|
|
165
|
+
|
|
166
|
+
### Workflow for an agent
|
|
167
|
+
|
|
168
|
+
1. Establish the design: purpose, route families, the choices the player makes.
|
|
169
|
+
2. Write a lane plan: ordered branches (`branchGroups`, `laneGroups`) with their intended width and where they rejoin.
|
|
170
|
+
3. Define prerequisites, exclusive choices and convergence.
|
|
171
|
+
4. Place with `position.mode: "auto"` so the solver centres, spaces and balances the branches. Hand-written `x` and `y` are for exact anchors only; hand-typed coordinates are the usual cause of drift and lopsided branches.
|
|
172
|
+
5. `hoi4.focus_render` and look at the inline overview and crops.
|
|
173
|
+
6. Read the scorecard and answer: can every branch be named from the picture, and is every asymmetry intended?
|
|
174
|
+
7. Revise one failing branch at a time with `layoutMode: "compact"`, `compactFocusIds` and `pinnedFocusIds`; pass the previous layout as `previous` to `hoi4.focus_inspect` to get the `layoutDelta`.
|
|
175
|
+
8. Validate structure and gameplay.
|
|
176
|
+
9. Show the before and after pictures and the scorecard to a person when the project asks for it.
|
|
177
|
+
10. Check the tree in the game.
|
|
178
|
+
|
|
179
|
+
`layoutDelta` reports `verdictBefore` and `verdictAfter`, the scores, the metrics that improved and regressed, the moved focuses, a hash of the focuses that did not move (`unmovedHash`), and hashes of the prerequisites and exclusions with `prerequisitesUnchanged` and `mutualExclusionsUnchanged`, so a layout repair can prove that it changed coordinates only.
|
|
180
|
+
|
|
121
181
|
## Clean an existing tree
|
|
122
182
|
|
|
123
183
|
For a layout-only cleanup of an existing national tree, call `hoi4.focus_rewrite` without a plan:
|
|
@@ -130,14 +190,14 @@ For a layout-only cleanup of an existing national tree, call `hoi4.focus_rewrite
|
|
|
130
190
|
}
|
|
131
191
|
```
|
|
132
192
|
|
|
133
|
-
A plan-free call is accepted only in national mode with `layoutMode: "compact"
|
|
193
|
+
A plan-free call is accepted only in national mode with `layoutMode: "compact"` or `layoutMode: "engine"` (see [Engine layout and placement](#engine-layout-and-placement)).
|
|
134
194
|
It requires `treeId`, works on an existing focus source, and rejects `createIfMissing: true`.
|
|
135
195
|
Every other national rewrite requires a `plan`.
|
|
136
196
|
`compactFocusIds` (1 to 10,000 IDs), `pinnedFocusIds` (up to 10,000 IDs), and `symmetryGroups` (up to 64 groups) are accepted only with `layoutMode: "compact"`.
|
|
137
197
|
|
|
138
198
|
Compact mode imports the tree, resets authored presentation coordinates and lane bounds, and performs a deterministic reflow in the same rewrite call. It keeps prerequisites, mutual exclusions, availability, bypasses, rewards, icons, localisation, AI behavior, and route/lane membership unchanged.
|
|
139
199
|
|
|
140
|
-
The rewrite measures canvas bounds, same-row spacing, the same curved connector paths used by the renderer, connector lengths, connector-node intersections, branch balance, overall centering, and topology-aware fake-complexity patterns. Compact mode evaluates preservation, occupied-row repair, prerequisite-depth reflow, linear-chain repair, sibling balancing, and combined compression strategies, then chooses the cleanest valid result. Equivalent branches are aligned by dependency depth even when their authored rows differ, and connector shape is prioritized before raw canvas dimensions so a shorter canvas cannot win by introducing unnecessary horizontal detours. Sparse direct sibling fan-outs are packed around their parent at the minimum readable spacing, with each exclusive descendant branch moving as a unit and shared convergence focuses staying centered. Dense branches remain wider only when their contents need the room.
|
|
200
|
+
The rewrite measures canvas bounds, same-row spacing, the same curved connector paths used by the renderer, connector lengths, connector-node intersections, branch balance, overall centering, and topology-aware fake-complexity patterns. Compact mode evaluates preservation, occupied-row repair, prerequisite-depth reflow, linear-chain repair, sibling balancing, and combined compression strategies, then chooses the cleanest valid result. Equivalent branches are aligned by dependency depth even when their authored rows differ, and connector shape is prioritized before raw canvas dimensions so a shorter canvas cannot win by introducing unnecessary horizontal detours. Sparse direct sibling fan-outs are packed around their parent at the minimum readable spacing, with each exclusive descendant branch moving as a unit and shared convergence focuses staying centered. Dense branches remain wider only when their contents need the room. A candidate must not be worse than the layout in place: no more hard layout errors, same-row spacing violations, crossings or connector-through-plaque counts in the in-game connector model (see [Layout quality](#layout-quality)), no worse layout verdict, and a centred canvas unless the tree already was not. A new tree starts from zero. When no candidate qualifies, or the layout already has the verdict `pass`, the call changes nothing and says why (`compactOutcome` with `reason` `verdict_pass`, `no_better_candidate` or `candidates_regress` and `blockedBy`, and the info diagnostic `FOCUS_COMPACT_NOTHING_TO_IMPROVE`); the first rewrite of a tree still writes its planning sidecar. A refusal of a new tree (`FOCUS_COMPACT_QUALITY_BLOCKED`) lists each blocking item in `details.blocking` with its before and after value and a remedy. Long connectors, fake detours, staircase or zigzag chains, and avoidable sibling imbalance are optimization priorities instead of independent rejection budgets.
|
|
141
201
|
|
|
142
202
|
Use the default `layoutMode: "authored"` with a complete plan when deliberately designing coordinates or changing gameplay. Set `layoutMode: "compact"` with a complete plan when creating a large automatically arranged tree. Inspect and render calls remain useful before or after either rewrite mode, but a separate plan is not required for compact cleanup.
|
|
143
203
|
|
|
@@ -147,6 +207,42 @@ Pass `symmetryGroups` with a `centerFocusId` and one or more `{ "leftFocusId": "
|
|
|
147
207
|
|
|
148
208
|
A cleanup should not change gameplay relationships to improve the picture. One `prerequisite` block containing several focus IDs is an OR group; several prerequisite blocks are AND requirements.
|
|
149
209
|
|
|
210
|
+
## Engine layout and placement
|
|
211
|
+
|
|
212
|
+
`layoutMode: "engine"` lays out the tree's `auto` focuses with the shared Rust engine (`hoi4-engine focus-layout`, [ADR 0074](https://github.com/klimPaskov/hoi4-agent-tools/blob/main/docs/adr/0074-shared-rust-engine.md)) instead of the TypeScript solver. Fixed and relative focuses keep their coordinates. The engine places each lane as a band, centres parents over their children and children under their parents, keeps mutually exclusive focuses side by side, and never changes prerequisites or exclusions. The result is written through the ordinary source update: the topmost focus of each lane gets `x` and `y`, and every other placed focus of the lane gets `relative_position_id` to it, so moving a lane later means editing one focus. A plan is optional: `{"treeId":"my_tree","layoutMode":"engine"}` lays out the existing tree's automatic focuses.
|
|
213
|
+
|
|
214
|
+
`placement` fits new focuses into a tree whose other focuses keep their exact coordinates (the engine's `insert`). Add the new focuses with position mode `auto` to the plan that `hoi4.focus_inspect` returned, then:
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"relativePath": "common/national_focus/my_tree.txt",
|
|
219
|
+
"plan": { "...": "the inspected plan with two new auto focuses" },
|
|
220
|
+
"placement": {
|
|
221
|
+
"focusIds": ["my_new_focus", "my_new_focus_2"],
|
|
222
|
+
"anchorId": "my_new_focus",
|
|
223
|
+
"preferSide": "right",
|
|
224
|
+
"allowShift": false
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
- `focusIds` (1 to 10,000) are the focuses to place. With the default `layoutMode: "authored"` they must be new to the tree. With `layoutMode: "engine"` they may be existing focuses to move. Pinned focuses cannot be placed.
|
|
230
|
+
- `anchorId` (one of `focusIds`) is the branch root, written relative to its first prerequisite outside the branch. The other new focuses are written relative to it.
|
|
231
|
+
- `preferSide` is `left`, `right` or `either` (default).
|
|
232
|
+
- `allowShift` (default false) lets the engine move existing focuses aside when no place is free within 64 columns.
|
|
233
|
+
- Every focus outside `focusIds` keeps the coordinates the current source gives it. An automatic focus that has none yet is refused with `FOCUS_PLACEMENT_INVALID`: add it to `focusIds` or give it `x` and `y`.
|
|
234
|
+
|
|
235
|
+
The result has the usual `layoutQuality` verdict and `layoutDelta`, plus `data.engine`: the operation, the connector metrics the engine measured, `movedFocusIds`, any `shifted` focuses, and the engine's SHA-256 `hashes`. `hashes.untouched` covers `[{id,x,y}]` of every focus the call did not move (canonical JSON, sorted by id), so a caller can check that those focuses stayed where they were. `hashes.prerequisites` and `hashes.exclusions` show that the graph is unchanged. Engine warnings such as `FOCUS_ENGINE_LANE_BOUNDS_UNSATISFIED` and `FOCUS_ENGINE_EXISTING_CONFLICT` join the result's diagnostics. Calling again plan-free, or with the freshly inspected plan, leaves the source unchanged.
|
|
236
|
+
|
|
237
|
+
Nothing is written when the engine refuses:
|
|
238
|
+
|
|
239
|
+
- `FOCUS_ENGINE_BLOCKED`: the tree cannot be placed without breaking a layout rule. The message names the engine's reasons (`FOCUS_ENGINE_NO_CORRIDOR`, `FOCUS_ENGINE_SPACING_CONFLICT` or `FOCUS_ENGINE_PARENT_NOT_ABOVE`) and, for a placement with no free place, `needsRoom`: the shift that would make room (`fromX`, `columns`, `direction` and the focuses that would move). Retry with `allowShift: true` to apply it.
|
|
240
|
+
- `FOCUS_ENGINE_UNAVAILABLE`: no usable `hoi4-engine` binary. The tool uses `HOI4_ENGINE` (an absolute path) and otherwise the binary the package ships under `engine/bin/<platform>-<arch>/` for Windows x64, macOS arm64 and Linux x64 and arm64 (glibc), which runs only when its SHA-256 matches `engine/bin/manifest.json`. The message gives the reason (`binary_not_found`, `binary_path_invalid`, `binary_checksum_mismatch`, `spawn_failed`, `timeout` after 30 seconds, `output_too_large`, `exit_status` or `invalid_output`). On another platform, or from a source checkout, set `HOI4_ENGINE` to a built binary (`cargo build --release -p hoi4-engine-cli` in `engine/`); after `binary_checksum_mismatch`, reinstall the package. There is no silent fallback to the TypeScript solver. `authored` and `compact` do not need the engine.
|
|
241
|
+
- `FOCUS_ENGINE_REQUEST_INVALID`: the engine refused the tree, for example for a prerequisite or relative-position cycle. The message has the engine's code.
|
|
242
|
+
- `FOCUS_ENGINE_LAYOUT_MISMATCH`: the coordinates prepared for the source differ from the engine's result.
|
|
243
|
+
|
|
244
|
+
The engine's algorithm and limits are in [engine/crates/focus/README.md](https://github.com/klimPaskov/hoi4-agent-tools/blob/main/engine/crates/focus/README.md).
|
|
245
|
+
|
|
150
246
|
## Continuous focus palettes
|
|
151
247
|
|
|
152
248
|
Set `mode: "continuous"` on `hoi4.focus_inspect`, `hoi4.focus_render`, or `hoi4.focus_rewrite` to work with a `continuous_focus_palette` instead of a national tree; the default mode is `national`.
|
|
@@ -176,7 +272,7 @@ Source files are read as UTF-8 (with or without a byte order mark) and, when the
|
|
|
176
272
|
|
|
177
273
|
## What inspection checks
|
|
178
274
|
|
|
179
|
-
Inspection and rendering can report missing references, invalid prerequisite structure, duplicate or overlapping positions, insufficient spacing, long or crossing connectors, branch asymmetry, route conflicts, missing localisation or sprites, weak terminal branches, repeated rewards, and missing AI metadata. National-tree inspection also returns the exact `continuous_focus_position` coordinates and linked palette IDs in its compact result, so an agent can identify and move the continuous-focus area without opening the full artifact. Renders are offline review artifacts, not game screenshots.
|
|
275
|
+
Inspection and rendering can report missing references, invalid prerequisite structure, duplicate or overlapping positions, insufficient spacing, long or crossing connectors, branch asymmetry (and, in the layout verdict, empty space, imbalance, drift and chains with no choice), route conflicts, missing localisation or sprites, weak terminal branches, repeated rewards, and missing AI metadata. National-tree inspection also returns the exact `continuous_focus_position` coordinates and linked palette IDs in its compact result, so an agent can identify and move the continuous-focus area without opening the full artifact. Renders are offline review artifacts, not game screenshots.
|
|
180
276
|
|
|
181
277
|
For a named tree, pass `scenario: { "completedFocusIds": ["my_route_root"] }` to `hoi4.focus_inspect`. The linked inspection artifact records each focus's prerequisite groups, route locks, exclusive choices, and unresolved runtime fields against that completed set. The inline tree summary counts completed, blocked, unresolved, and structural candidate focuses, plus contradictory completed choices. A structural candidate still requires runtime trigger evaluation before an agent can call it playable.
|
|
182
278
|
|
|
@@ -184,6 +280,10 @@ Pass up to 16 `cropFocusIds` to `hoi4.focus_render` for source-linked problem cr
|
|
|
184
280
|
|
|
185
281
|
The layout JSON reports horizontal, vertical, and Manhattan grid spans for every prerequisite connector in `layout.connectorMeasurements`.
|
|
186
282
|
|
|
187
|
-
`hoi4.focus_render`
|
|
283
|
+
`hoi4.focus_render` returns an in-game-style schematic of the layout inline (no second call): an overview of at most 1,500 pixels and up to five close-ups of the places the scorecard blames, or of the branches named in `cropBranchIds` (up to 8; a derived branch is named by its first focus) and the focuses named in `cropFocusIds`. Failing focuses are outlined (red for hard defects, amber otherwise), exclusive choices are joined by red dashes, OR prerequisites are dotted, and a ruler shows the grid coordinates. Pass `inline: false` for linked artifacts only. The inline pictures are tool renders, not game screenshots, and carry no icons; the result lists each image in `data.inlineImages` with its region. It also writes complete HTML, SVG, JSON and source-map artifacts and a PNG.
|
|
284
|
+
|
|
285
|
+
The PNG is the game view when the `hoi4-engine` binary is available (shipped with releases, or `HOI4_ENGINE`): the focus tree drawn from the game's own sprites, textures, bitmap font and `interface/nationalfocusview.gui` in load order, so it shows the tree window background, the plaques, icons, titles, connector tiles and exclusive marks as the game does at the default UI scale. Titles are localised; a title without localisation shows its raw key, like the game, and scripted localisation (`[...]`) is shown as written. Every sprite, texture, font or glyph the view cannot draw is reported as `FOCUS_GAME_VIEW_ASSET_MISSING` with the focuses it affects. Focuses are drawn as at the start of a game: `can start` without prerequisites, `unavailable` otherwise; `available` and `bypass` triggers are not evaluated. Without the engine the PNG is the schematic with decoded icons. The game view is a tool render, never a game screenshot.
|
|
286
|
+
|
|
287
|
+
Pass `view: "game"` for the game view alone: the PNG, a JSON report with each focus's box and every missing asset, an SVG hover map on the same pixels, an HTML viewer with wheel zoom, drag and hover titles, and one inline overview of at most 1,500 pixels. It skips the schematic SVG, the schematic pictures and the presentation pass, so it is fast enough to call after every edit, and the layout verdict is still computed. It needs the engine and answers `FOCUS_GAME_VIEW_UNAVAILABLE` without it. The engine process stays running between calls (ADR 0077) and keeps the parsed `.gfx` files, folder listings, decoded textures and fonts of each workspace, checking them against the disk on every call, so a repeat render costs the drawing alone. Pass `png: false` for the faster structural view without decoding icons. National trees with 200 or more focuses raster at half scale by default; pass `reviewScale` from `0.25` through `1` when a different PNG size is needed.
|
|
188
288
|
|
|
189
289
|
The public workflow is regression-tested with 1,024-focus creation, compact rewrites, deterministic repeat runs, inspection, vector rendering, and raster rendering. A separate 1,024-icon test decodes a distinct texture for every focus. Large source diffs use the same deterministic review-artifact path instead of blocking at the quadratic matrix size.
|
package/docs/reference.md
CHANGED
|
@@ -8,7 +8,7 @@ The server discovers these directories for a workspace:
|
|
|
8
8
|
| Source | Default location | Optional workspace registration |
|
|
9
9
|
| ------------------------------ | --------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
10
10
|
| Installed game documentation | `gameRoot/documentation/**/*.md` and `gameRoot/common/**/*documentation.md` | Configure `gameRoot`. |
|
|
11
|
-
|
|
|
11
|
+
| HOI4 wiki (kit) | `modRoot/hoi4_wiki/**/*.md`, else `modRoot/paradox_wiki/**/*.md` | Set absolute `wikiRoot`. |
|
|
12
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.
|