hoi4-agent-tools 4.6.4 → 4.7.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 +22 -5
- package/dist/hoi4_agent_tools/core/artifacts.js +9 -2
- package/dist/hoi4_agent_tools/core/changed-summary.js +41 -0
- package/dist/hoi4_agent_tools/core/engine-client.js +273 -0
- package/dist/hoi4_agent_tools/core/job-worker-host.js +5 -1
- package/dist/hoi4_agent_tools/core/operation-result.js +24 -5
- 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/job-operations.js +3 -1
- package/dist/hoi4_agent_tools/focus/layout.js +3 -2
- 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 +202 -0
- package/dist/hoi4_agent_tools/focus/quality/positions.js +41 -0
- package/dist/hoi4_agent_tools/focus/quality/schematic.js +241 -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/tool-operations.js +206 -22
- package/dist/hoi4_agent_tools/focus/tool-support.js +1 -1
- package/dist/hoi4_agent_tools/map/references.js +26 -1
- package/dist/hoi4_agent_tools/map/render.js +29 -3
- package/dist/hoi4_agent_tools/map/service.js +3 -0
- package/dist/hoi4_agent_tools/map/tool-operations.js +5 -0
- package/dist/hoi4_agent_tools/mcp/server/instructions.js +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +76 -4
- package/dist/hoi4_agent_tools/reference/game-text.js +109 -0
- package/dist/hoi4_agent_tools/reference/ranking.js +60 -2
- package/dist/hoi4_agent_tools/reference/service.js +92 -21
- package/dist/hoi4_agent_tools/schemas/focus-requests.js +64 -7
- package/dist/hoi4_agent_tools/schemas/focus.js +121 -6
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/configuration.md +17 -17
- package/docs/focus.md +100 -4
- package/docs/map.md +5 -2
- package/docs/reference.md +1 -1
- package/docs/research/reference-benchmark.md +111 -1
- package/docs/setup.md +1 -1
- package/docs/tools.md +5 -5
- package/docs/troubleshooting.md +12 -11
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -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
|
@@ -74,7 +74,20 @@ export const focusRenderRequestSchema = z
|
|
|
74
74
|
.min(FOCUS_RENDER_MIN_OUTPUT_SCALE)
|
|
75
75
|
.max(FOCUS_RENDER_MAX_OUTPUT_SCALE)
|
|
76
76
|
.optional(),
|
|
77
|
-
cropFocusIds: z
|
|
77
|
+
cropFocusIds: z
|
|
78
|
+
.array(z.string().min(1).max(256))
|
|
79
|
+
.max(16)
|
|
80
|
+
.optional()
|
|
81
|
+
.describe('Close-ups around these focuses: PNG artifacts of the icon render, and inline schematic crops.'),
|
|
82
|
+
cropBranchIds: z
|
|
83
|
+
.array(z.string().min(1).max(256))
|
|
84
|
+
.max(8)
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Inline close-ups of whole branches. Use a declared branch id or the first focus of a derived branch; the scorecard lists them.'),
|
|
87
|
+
inline: z
|
|
88
|
+
.boolean()
|
|
89
|
+
.optional()
|
|
90
|
+
.describe('Default true: return an in-game-style schematic overview and crops of the worst places as inline images, so no second call is needed. False returns only linked artifacts.'),
|
|
78
91
|
columns: z.number().int().min(1).max(12).optional(),
|
|
79
92
|
padding: z.number().int().min(0).max(1000).optional(),
|
|
80
93
|
png: z
|
|
@@ -102,6 +115,8 @@ export const focusRenderRequestSchema = z
|
|
|
102
115
|
['verticalSpacing', value.verticalSpacing],
|
|
103
116
|
['reviewScale', value.reviewScale],
|
|
104
117
|
['cropFocusIds', value.cropFocusIds],
|
|
118
|
+
['cropBranchIds', value.cropBranchIds],
|
|
119
|
+
['inline', value.inline],
|
|
105
120
|
];
|
|
106
121
|
for (const [field, fieldValue] of invalid) {
|
|
107
122
|
if (fieldValue !== undefined)
|
|
@@ -124,7 +139,7 @@ export const focusRewriteRequestSchema = z
|
|
|
124
139
|
workspaceId: workspaceIdSchema,
|
|
125
140
|
relativePath: workspaceRelativePathSchema,
|
|
126
141
|
treeId: z.string().min(1).max(256).optional(),
|
|
127
|
-
layoutMode: z.enum(['authored', 'compact']).default('authored'),
|
|
142
|
+
layoutMode: z.enum(['authored', 'compact', 'engine']).default('authored'),
|
|
128
143
|
compactFocusIds: z.array(z.string().min(1).max(256)).min(1).max(10_000).optional(),
|
|
129
144
|
pinnedFocusIds: z.array(z.string().min(1).max(256)).max(10_000).optional(),
|
|
130
145
|
symmetryGroups: z
|
|
@@ -144,6 +159,15 @@ export const focusRewriteRequestSchema = z
|
|
|
144
159
|
.strict())
|
|
145
160
|
.max(64)
|
|
146
161
|
.optional(),
|
|
162
|
+
placement: z
|
|
163
|
+
.object({
|
|
164
|
+
focusIds: z.array(z.string().min(1).max(256)).min(1).max(10_000),
|
|
165
|
+
anchorId: z.string().min(1).max(256).optional(),
|
|
166
|
+
preferSide: z.enum(['left', 'right', 'either']).optional(),
|
|
167
|
+
allowShift: z.boolean().optional(),
|
|
168
|
+
})
|
|
169
|
+
.strict()
|
|
170
|
+
.optional(),
|
|
147
171
|
plan: compactFocusPlanSchema.optional(),
|
|
148
172
|
createIfMissing: z.boolean().default(false),
|
|
149
173
|
horizontalSpacing: z.number().int().min(80).max(1000).optional(),
|
|
@@ -166,6 +190,33 @@ export const focusRewriteRequestSchema = z
|
|
|
166
190
|
path: [field],
|
|
167
191
|
message: `${field} requires compact layout mode`,
|
|
168
192
|
});
|
|
193
|
+
if (value.placement !== undefined) {
|
|
194
|
+
if (value.layoutMode === 'compact')
|
|
195
|
+
context.addIssue({
|
|
196
|
+
code: 'custom',
|
|
197
|
+
path: ['placement'],
|
|
198
|
+
message: 'placement requires authored or engine layout mode',
|
|
199
|
+
});
|
|
200
|
+
if (value.layoutMode === 'authored' && value.plan === undefined)
|
|
201
|
+
context.addIssue({
|
|
202
|
+
code: 'custom',
|
|
203
|
+
path: ['placement'],
|
|
204
|
+
message: 'placement in authored layout mode requires a plan that adds the focuses',
|
|
205
|
+
});
|
|
206
|
+
if (value.placement.anchorId !== undefined &&
|
|
207
|
+
!value.placement.focusIds.includes(value.placement.anchorId))
|
|
208
|
+
context.addIssue({
|
|
209
|
+
code: 'custom',
|
|
210
|
+
path: ['placement', 'anchorId'],
|
|
211
|
+
message: 'placement.anchorId must be one of placement.focusIds',
|
|
212
|
+
});
|
|
213
|
+
if (new Set(value.placement.focusIds).size !== value.placement.focusIds.length)
|
|
214
|
+
context.addIssue({
|
|
215
|
+
code: 'custom',
|
|
216
|
+
path: ['placement', 'focusIds'],
|
|
217
|
+
message: 'placement.focusIds must not repeat a focus',
|
|
218
|
+
});
|
|
219
|
+
}
|
|
169
220
|
const mode = value.mode ?? 'national';
|
|
170
221
|
const schema = mode === 'continuous' ? continuousFocusPaletteSchema : focusTreePlanSchema;
|
|
171
222
|
if (value.plan !== undefined && !schema.safeParse(value.plan).success)
|
|
@@ -191,7 +242,13 @@ export const focusRewriteRequestSchema = z
|
|
|
191
242
|
context.addIssue({
|
|
192
243
|
code: 'custom',
|
|
193
244
|
path: ['layoutMode'],
|
|
194
|
-
message:
|
|
245
|
+
message: `${value.layoutMode} layout mode is only valid in national mode`,
|
|
246
|
+
});
|
|
247
|
+
if (value.placement !== undefined)
|
|
248
|
+
context.addIssue({
|
|
249
|
+
code: 'custom',
|
|
250
|
+
path: ['placement'],
|
|
251
|
+
message: 'placement is only valid in national mode',
|
|
195
252
|
});
|
|
196
253
|
for (const [field, fieldValue] of [
|
|
197
254
|
['horizontalSpacing', value.horizontalSpacing],
|
|
@@ -207,23 +264,23 @@ export const focusRewriteRequestSchema = z
|
|
|
207
264
|
});
|
|
208
265
|
}
|
|
209
266
|
else {
|
|
210
|
-
if (value.plan === undefined && value.layoutMode
|
|
267
|
+
if (value.plan === undefined && value.layoutMode === 'authored')
|
|
211
268
|
context.addIssue({
|
|
212
269
|
code: 'custom',
|
|
213
270
|
path: ['plan'],
|
|
214
|
-
message: 'plan is required unless layoutMode is compact',
|
|
271
|
+
message: 'plan is required unless layoutMode is compact or engine',
|
|
215
272
|
});
|
|
216
273
|
if (value.plan === undefined && value.treeId === undefined)
|
|
217
274
|
context.addIssue({
|
|
218
275
|
code: 'custom',
|
|
219
276
|
path: ['treeId'],
|
|
220
|
-
message: 'treeId is required for plan-free compact
|
|
277
|
+
message: 'treeId is required for plan-free compact or engine layout',
|
|
221
278
|
});
|
|
222
279
|
if (value.plan === undefined && value.createIfMissing)
|
|
223
280
|
context.addIssue({
|
|
224
281
|
code: 'custom',
|
|
225
282
|
path: ['createIfMissing'],
|
|
226
|
-
message: 'plan-free compact
|
|
283
|
+
message: 'plan-free compact or engine layout requires an existing focus source',
|
|
227
284
|
});
|
|
228
285
|
if (value.plan !== undefined &&
|
|
229
286
|
value.treeId !== undefined &&
|
|
@@ -36,11 +36,24 @@ const automaticPositionSchema = z
|
|
|
36
36
|
.object({
|
|
37
37
|
mode: z.literal('auto'),
|
|
38
38
|
pinned: z.literal(false),
|
|
39
|
-
preferredX: z
|
|
40
|
-
|
|
39
|
+
preferredX: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.min(-100_000)
|
|
43
|
+
.max(100_000)
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Column the solver aims for; it still spaces and balances the branch.'),
|
|
46
|
+
preferredY: z
|
|
47
|
+
.number()
|
|
48
|
+
.int()
|
|
49
|
+
.min(-100_000)
|
|
50
|
+
.max(100_000)
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Row the solver aims for; a focus always sits below its lowest prerequisite.'),
|
|
41
53
|
})
|
|
42
54
|
.strict();
|
|
43
|
-
const positionSchema = z
|
|
55
|
+
const positionSchema = z
|
|
56
|
+
.discriminatedUnion('mode', [
|
|
44
57
|
z
|
|
45
58
|
.object({
|
|
46
59
|
mode: z.literal('fixed'),
|
|
@@ -59,7 +72,8 @@ const positionSchema = z.discriminatedUnion('mode', [
|
|
|
59
72
|
})
|
|
60
73
|
.strict(),
|
|
61
74
|
automaticPositionSchema,
|
|
62
|
-
])
|
|
75
|
+
])
|
|
76
|
+
.describe('fixed = an exact grid coordinate; relative = an offset from another focus, so the branch moves with it; auto = the solver places the focus (prefer it for new trees). One x unit is half a plaque: neighbouring plaques are 2 apart on a row, and a focus directly below its parent has the same x.');
|
|
63
77
|
const routeLockSchema = z
|
|
64
78
|
.object({
|
|
65
79
|
id: z.string().min(1),
|
|
@@ -92,8 +106,14 @@ const focusNodeSchema = z
|
|
|
92
106
|
.object({
|
|
93
107
|
id: z.string().min(1).max(256),
|
|
94
108
|
label: z.string().max(1024),
|
|
95
|
-
branchId: z
|
|
96
|
-
|
|
109
|
+
branchId: z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe('Branch family of this focus; per-branch crops and the layout scorecard use it.'),
|
|
113
|
+
laneId: z
|
|
114
|
+
.string()
|
|
115
|
+
.optional()
|
|
116
|
+
.describe('Lane the solver keeps this focus in: one column band per lane.'),
|
|
97
117
|
prerequisites: prerequisitesSchema,
|
|
98
118
|
mutuallyExclusive: z.array(z.string()).max(10_000),
|
|
99
119
|
routeLocks: z.array(routeLockSchema).max(10_000),
|
|
@@ -397,3 +417,98 @@ export const focusLayoutSchema = z
|
|
|
397
417
|
layoutHash: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
398
418
|
})
|
|
399
419
|
.strict();
|
|
420
|
+
const qualityMetricIdSchema = z.enum([
|
|
421
|
+
'H1',
|
|
422
|
+
'H2',
|
|
423
|
+
'H3',
|
|
424
|
+
'H4',
|
|
425
|
+
'H5',
|
|
426
|
+
'S1',
|
|
427
|
+
'S2',
|
|
428
|
+
'S3',
|
|
429
|
+
'S4',
|
|
430
|
+
'S5',
|
|
431
|
+
'S6',
|
|
432
|
+
'S7',
|
|
433
|
+
'S8',
|
|
434
|
+
'S9',
|
|
435
|
+
'S10',
|
|
436
|
+
'S11',
|
|
437
|
+
'D1',
|
|
438
|
+
'D2',
|
|
439
|
+
'D3',
|
|
440
|
+
'D4',
|
|
441
|
+
]);
|
|
442
|
+
const qualityVerdictSchema = z.enum(['blocked', 'revise', 'review', 'pass']);
|
|
443
|
+
export const focusScorecardRowSchema = z
|
|
444
|
+
.object({
|
|
445
|
+
id: qualityMetricIdSchema,
|
|
446
|
+
name: z.string().max(128),
|
|
447
|
+
group: z.enum(['H', 'S', 'D']),
|
|
448
|
+
value: z.number(),
|
|
449
|
+
unit: z.string().max(64),
|
|
450
|
+
reviewLimit: z.number().nullable(),
|
|
451
|
+
reviseLimit: z.number().nullable(),
|
|
452
|
+
vanillaMedian: z.number().nullable(),
|
|
453
|
+
status: z.enum(['ok', 'review', 'revise', 'blocked', 'flag', 'not_evaluated']),
|
|
454
|
+
inVerdict: z.boolean(),
|
|
455
|
+
where: z.array(z.string().max(256)).max(8),
|
|
456
|
+
message: z.string().max(600),
|
|
457
|
+
fix: z
|
|
458
|
+
.object({
|
|
459
|
+
action: z.string().max(64),
|
|
460
|
+
targetFocusIds: z.array(z.string().max(256)).max(16),
|
|
461
|
+
suggested: z.string().max(500),
|
|
462
|
+
expectedMetricChange: z.string().max(300),
|
|
463
|
+
preservesGameplay: z.boolean(),
|
|
464
|
+
})
|
|
465
|
+
.strict()
|
|
466
|
+
.optional(),
|
|
467
|
+
})
|
|
468
|
+
.strict();
|
|
469
|
+
/** Verdict, scorecard and fix hints for one layout of a national focus tree. */
|
|
470
|
+
export const focusLayoutQualitySchema = z
|
|
471
|
+
.object({
|
|
472
|
+
verdict: qualityVerdictSchema,
|
|
473
|
+
score: z.number().int().min(0).max(100),
|
|
474
|
+
summary: z.string().max(500),
|
|
475
|
+
focusCount: z.number().int().nonnegative(),
|
|
476
|
+
bucket: z.enum(['small', 'medium', 'large']),
|
|
477
|
+
softMetricsEvaluated: z.boolean(),
|
|
478
|
+
scorecard: z.array(focusScorecardRowSchema).max(20),
|
|
479
|
+
failingRowCount: z.number().int().nonnegative(),
|
|
480
|
+
nextActions: z.array(z.string().max(500)).max(6),
|
|
481
|
+
notEvaluated: z.array(z.string().max(400)).max(8),
|
|
482
|
+
branches: z
|
|
483
|
+
.array(z
|
|
484
|
+
.object({
|
|
485
|
+
id: z.string().max(256),
|
|
486
|
+
focusCount: z.number().int().nonnegative(),
|
|
487
|
+
minimumX: z.number().int(),
|
|
488
|
+
maximumX: z.number().int(),
|
|
489
|
+
minimumY: z.number().int(),
|
|
490
|
+
maximumY: z.number().int(),
|
|
491
|
+
})
|
|
492
|
+
.strict())
|
|
493
|
+
.max(12),
|
|
494
|
+
})
|
|
495
|
+
.strict();
|
|
496
|
+
/** What a layout change did: verdicts, moved focuses and proof that gameplay relations are intact. */
|
|
497
|
+
export const focusLayoutDeltaSchema = z
|
|
498
|
+
.object({
|
|
499
|
+
verdictBefore: qualityVerdictSchema.nullable(),
|
|
500
|
+
verdictAfter: qualityVerdictSchema,
|
|
501
|
+
scoreBefore: z.number().int().min(0).max(100).nullable(),
|
|
502
|
+
scoreAfter: z.number().int().min(0).max(100),
|
|
503
|
+
improved: z.array(qualityMetricIdSchema).max(20),
|
|
504
|
+
regressed: z.array(qualityMetricIdSchema).max(20),
|
|
505
|
+
movedFocusCount: z.number().int().nonnegative(),
|
|
506
|
+
movedFocusIds: z.array(z.string().max(256)).max(100),
|
|
507
|
+
unmovedFocusCount: z.number().int().nonnegative(),
|
|
508
|
+
unmovedHash: z.string().max(64),
|
|
509
|
+
prerequisiteHash: z.string().max(64),
|
|
510
|
+
prerequisitesUnchanged: z.boolean().nullable(),
|
|
511
|
+
mutualExclusionHash: z.string().max(64),
|
|
512
|
+
mutualExclusionsUnchanged: z.boolean().nullable(),
|
|
513
|
+
})
|
|
514
|
+
.strict();
|
|
@@ -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.7.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 until the connector model below is confirmed in the game. 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 82 percent `pass`, 15 percent `review` and 3 percent `revise` with the limits fitted without that tree.
|
|
159
|
+
|
|
160
|
+
### Connector model
|
|
161
|
+
|
|
162
|
+
The game draws right-angle connectors: a stem leaves the parent, a horizontal bar runs in the gap above the child's row, and a stem enters the child. 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. The model was read from one in-game screenshot for adjacent rows; multi-row bar placement is unverified, so confirm it with a screenshot of a multi-row connector before treating H4, H5 or S9 as defects.
|
|
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 a release ships under `engine/bin/<platform>-<arch>/`. The message gives the reason (`binary_not_found`, `binary_path_invalid`, `spawn_failed`, `timeout` after 30 seconds, `output_too_large`, `exit_status` or `invalid_output`). Set `HOI4_ENGINE` to a built binary (`cargo build --release -p hoi4-engine-cli` in `engine/`) or install a release that ships the engine. 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,6 @@ 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` writes complete HTML, SVG, JSON and source-map artifacts and a high-fidelity PNG with decoded icons. 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.
|
|
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 high-fidelity PNG with decoded icons. 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
284
|
|
|
189
285
|
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/map.md
CHANGED
|
@@ -426,14 +426,15 @@ Measured on project-owned synthetic fixtures (ADR 0060): country-border enrichme
|
|
|
426
426
|
|
|
427
427
|
`hoi4.map_rewrite` also moves and merges states, moves provinces between strategic regions, merges or removes provinces, changes province definitions and types, adds or removes normal and special adjacency, and updates supply, railway, building, unit, weather, and entity-locator records. Send one ordered operation list when several connected changes belong together.
|
|
428
428
|
|
|
429
|
-
Every rewrite returns changed-area, changed-ID, semantic, affected-file, diagnostic, and rendered comparison evidence. A failed operation does not leave a partial multi-file result.
|
|
429
|
+
Every rewrite returns changed-area, changed-ID, semantic, affected-file, diagnostic, and rendered comparison evidence. A failed operation does not leave a partial multi-file result. The before and proposed renders (`map-before.*`, `map-proposed.*`) draw every overlay but list building, unit and weather positions only as counts (`positionRecords: "counts"`); `hoi4.map_inspect` returns the records. `map-diff.json` lists at most 2,000 changed building, unit and weather positions per kind and gives the full number in `positionChanges`. The review of a replaced world, where every position changes, would otherwise reach hundreds of megabytes.
|
|
430
430
|
|
|
431
431
|
## Check script references
|
|
432
432
|
|
|
433
433
|
Set `references: true` on `hoi4.map_inspect` to also read events, focuses, decisions, scripted effects and triggers, on-actions, ideas, characters, AI strategies and areas, and country and unit history.
|
|
434
434
|
It reports:
|
|
435
435
|
|
|
436
|
-
- `MAP_SCRIPT_REFERENCE_MISSING`: a state, province or strategic region named by number that the map does not define, as `owns_state = 64`, `has_full_control_of_state = 64`, `transfer_state = 64`, `set_state_controller = 64`, `capital = 64`, a state scope `64 = { ... }`, a `prioritize = { 64 65 }` list, a `state`, `to_state` or `start_state` argument, a province argument such as `set_province_controller` or `province = { id = 3314 }`, a strategic region in `region = 12` or `ships_in_area`, a unit `location`, or an AI area's `strategic_regions`; an error in the mod's own files and a warning in game or dependency files;
|
|
436
|
+
- `MAP_SCRIPT_REFERENCE_MISSING`: a state, province or strategic region named by number that the map does not define, as `owns_state = 64`, `has_full_control_of_state = 64`, `transfer_state = 64`, `set_state_controller = 64`, `capital = 64`, a state scope `64 = { ... }`, a `prioritize = { 64 65 }` list, a `state`, `to_state` or `start_state` argument, a province argument such as `set_province_controller` or `province = { id = 3314 }`, a strategic region in `region = 12` or `ships_in_area`, a unit `location`, or an AI area's `strategic_regions`; an error in the mod's own files and a warning in game or dependency files; `state = 0` (as in `NOT = { state = 0 }`, a test for a valid state) is not a reference;
|
|
437
|
+
- `MAP_SCRIPT_PRIORITIZE_PROVINCE`: a number in a `prioritize` list that the map defines as a province, not a state; `prioritize` takes state ids, so the entry is reported on its own (a warning in the mod's files, information in game or dependency files) and not as a missing reference;
|
|
437
438
|
- `MAP_STATE_TAG_UNKNOWN`: a state owner, controller, core or claim whose tag no `common/country_tags` file declares;
|
|
438
439
|
- `MAP_COUNTRY_CAPITAL_NOT_OWNED`: a country that owns states but has its capital in another country's state.
|
|
439
440
|
|
|
@@ -517,6 +518,8 @@ The operation writes `provinces.bmp`, `definition.csv`, `default.map`, `continen
|
|
|
517
518
|
|
|
518
519
|
Each write records its generated files in `.hoi4-agent-world.json`. A later `create_world` deletes the recorded files it no longer writes (retires them) in the same transaction and refuses with `MANAGED_OUTPUT_EDITED` when a recorded file was edited since. `MAP_WORLD_OUTPUTS_RECONCILED` and `data.outputs` give the counts of written, retired and released files with up to 200 paths each; `map-world-outputs.json` lists them all.
|
|
519
520
|
|
|
521
|
+
Every applied map rewrite also returns `data.changedSummary` with the number of changed files (`total`, `created`, `removed`, `modified`) and the same counts for the 40 folders with the most changes (two levels deep, `.` for the mod root, `omittedFolders` for the rest), so the size of a write is visible even when the inline `changedFiles` list is cut.
|
|
522
|
+
|
|
520
523
|
### Countries the mod already owns
|
|
521
524
|
|
|
522
525
|
A mod that writes its own country tags, country files, histories, orders of battle, flags and names gives `countries` as an object instead of an array (ADR 0069):
|
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.
|