hoi4-agent-tools 2.8.0 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/hoi4_agent_tools/core/artifacts.js +126 -4
  3. package/dist/hoi4_agent_tools/core/index.js +3 -1
  4. package/dist/hoi4_agent_tools/core/scanner.js +43 -2
  5. package/dist/hoi4_agent_tools/gui/assets.js +63 -14
  6. package/dist/hoi4_agent_tools/gui/inspection-artifact.js +85 -14
  7. package/dist/hoi4_agent_tools/gui/layout.js +175 -24
  8. package/dist/hoi4_agent_tools/gui/source-graph.js +105 -6
  9. package/dist/hoi4_agent_tools/gui/studio.js +166 -34
  10. package/dist/hoi4_agent_tools/gui/validators.js +47 -27
  11. package/dist/hoi4_agent_tools/mcp/server/create.js +1 -1
  12. package/dist/hoi4_agent_tools/mcp/server/progress.js +60 -0
  13. package/dist/hoi4_agent_tools/mcp/tools/gui.js +15 -15
  14. package/dist/hoi4_agent_tools/version.js +1 -1
  15. package/docs/gui.md +6 -0
  16. package/package.json +1 -1
  17. package/schemas/configuration.schema.json +1 -1
  18. package/schemas/continuous-focus-palette.schema.json +1 -1
  19. package/schemas/custom-weighted-pool.schema.json +1 -1
  20. package/schemas/event-feature-manifest.schema.json +1 -1
  21. package/schemas/focus-plan.schema.json +1 -1
  22. package/schemas/focus-planning-sidecar.schema.json +1 -1
  23. package/schemas/gui-animation-source.schema.json +1 -1
  24. package/schemas/gui-helper.schema.json +1 -1
  25. package/schemas/gui-scenario.schema.json +1 -1
  26. package/schemas/map-operation.schema.json +1 -1
  27. package/schemas/operation-result.schema.json +1 -1
  28. package/schemas/probability-analysis-result.schema.json +1 -1
  29. package/schemas/probability-compare-input.schema.json +1 -1
  30. package/schemas/probability-evaluate-input.schema.json +1 -1
  31. package/schemas/probability-inspect-input.schema.json +1 -1
  32. package/schemas/probability-render-input.schema.json +1 -1
  33. package/schemas/probability-scenario-set.schema.json +1 -1
  34. package/schemas/probability-sequence-input.schema.json +1 -1
  35. package/schemas/probability-simulate-input.schema.json +1 -1
  36. package/schemas/probability-sweep-input.schema.json +1 -1
  37. package/server.json +2 -2
@@ -12,7 +12,7 @@ import { requireServerScope, resolveServerWorkspaceId, } from '../server/base-to
12
12
  import { compactValidatedInputSchema } from '../server/context-schemas.js';
13
13
  import { autonomousFailureContext, autonomousResultArtifacts, executePlannedTransaction, } from '../server/transaction-execution.js';
14
14
  import { indexSkippedSourceSchema, nonNegativeIntegerSchema, sha256Schema, } from '../server/output-schemas.js';
15
- import { progressReporter } from '../server/progress.js';
15
+ import { progressReporter, withProgressHeartbeat } from '../server/progress.js';
16
16
  import { errorResult, setInlineFilesScanned, strictOperationResultSchema, toolResult, } from '../server/result.js';
17
17
  const countRecordSchema = z.record(z.string().max(256), nonNegativeIntegerSchema);
18
18
  const guiScanOutputSchema = strictOperationResultSchema(z
@@ -156,21 +156,21 @@ export function registerGuiTools(server, engine, context) {
156
156
  try {
157
157
  const progress = progressReporter(extra);
158
158
  await progress.report(0, 3, 'Building GUI source graph');
159
- const inspection = windowName === undefined || scenario === undefined
160
- ? studio
161
- .scan(workspaceId, context.principal, progress.signal)
162
- .then(({ graph }) => ({ graph, linted: undefined }))
163
- : studio
164
- .lint({
159
+ const inspected = await withProgressHeartbeat(async () => {
160
+ if (windowName === undefined || scenario === undefined) {
161
+ const { graph } = await studio.scan(workspaceId, context.principal, progress.signal);
162
+ return { graph, linted: undefined };
163
+ }
164
+ const linted = await studio.lint({
165
165
  workspaceId,
166
166
  windowName,
167
167
  scenario,
168
168
  ...(relatedScenarios === undefined ? {} : { relatedScenarios }),
169
169
  ...(context.principal === undefined ? {} : { principal: context.principal }),
170
170
  signal: progress.signal,
171
- })
172
- .then((linted) => ({ graph: linted.graph, linted }));
173
- const inspected = await inspection;
171
+ });
172
+ return { graph: linted.graph, linted };
173
+ }, progress, 'Inspecting GUI sources and linked assets');
174
174
  const { graph, linted } = inspected;
175
175
  const sharedRevision = hashCanonical(graph.sourceHashes);
176
176
  const workspace = engine.resolver.get(workspaceId, context.principal);
@@ -268,7 +268,7 @@ export function registerGuiTools(server, engine, context) {
268
268
  try {
269
269
  const progress = progressReporter(extra);
270
270
  await progress.report(0, 4, 'Building GUI source graph');
271
- const rendered = await studio.renderAndStore({
271
+ const rendered = await withProgressHeartbeat(() => studio.renderAndStore({
272
272
  workspaceId,
273
273
  windowName,
274
274
  scenario: input.scenario,
@@ -290,7 +290,7 @@ export function registerGuiTools(server, engine, context) {
290
290
  : { comparisonScenario: input.comparisonScenario }),
291
291
  ...(context.principal === undefined ? {} : { principal: context.principal }),
292
292
  signal: progress.signal,
293
- });
293
+ }), progress, 'Rendering GUI variants and visual diagnostics');
294
294
  await progress.report(3, 4, 'Preparing GUI result');
295
295
  const diagnostics = rendered.validation.diagnostics;
296
296
  const result = emptyServiceResult(workspaceId, {
@@ -471,7 +471,7 @@ export function registerGuiTools(server, engine, context) {
471
471
  const progress = progressReporter(extra);
472
472
  await progress.report(0, 3, 'Validating the requested GUI result');
473
473
  const compilation = input.mode === 'helpers' ? compileGuiHelpers(input.helper) : undefined;
474
- const plannedTransaction = await studio.planSource({
474
+ const plannedTransaction = await withProgressHeartbeat(() => studio.planSource({
475
475
  workspaceId,
476
476
  relativePath,
477
477
  ...(input.mode === 'patches'
@@ -489,9 +489,9 @@ export function registerGuiTools(server, engine, context) {
489
489
  scenario,
490
490
  ...(context.principal === undefined ? {} : { principal: context.principal }),
491
491
  signal: progress.signal,
492
- });
492
+ }), progress, 'Preparing GUI rewrite');
493
493
  await progress.report(2, 3, 'Applying and validating the GUI rewrite');
494
- const execution = await executePlannedTransaction(engine, plannedTransaction, context.principal, progress.signal);
494
+ const execution = await withProgressHeartbeat(() => executePlannedTransaction(engine, plannedTransaction, context.principal, progress.signal), progress, 'Applying GUI rewrite');
495
495
  const transaction = execution.transaction;
496
496
  const planned = {
497
497
  transaction,
@@ -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 = '2.8.0';
3
+ export const PACKAGE_VERSION = '2.8.2';
4
4
  export const MCP_PROTOCOL_VERSION = LATEST_PROTOCOL_VERSION;
5
5
  export const CONFIG_VERSION = 1;
6
6
  export const TRANSACTION_VERSION = 1;
package/docs/gui.md CHANGED
@@ -33,8 +33,12 @@ Inspection checks missing assets and localisation, invalid sizes, overlap, clipp
33
33
 
34
34
  The renderer resolves sprites and fonts through the complete mod, dependency, and installed-game load order. Mod windows therefore render ordinary vanilla sprites, tiled vanilla panels, progress bars, masked shields, button frames, and localisation icons such as `£command_power` without copying game assets into the mod. Case differences in GFX and font identifiers do not prevent a valid asset from resolving.
35
35
 
36
+ Bitmap text uses the language-appropriate HOI4 font definition and its real glyph atlas. The default language uses the base font rather than an unrelated language override, and the renderer recognizes installed-game atlases whose filename omits a page suffix declared by the matching `.fnt` file.
37
+
36
38
  Layout follows Clausewitz orientation and element-origin anchors, including `CENTER_LEFT`, `CENTER_RIGHT`, `CENTER_UP`, `CENTER_DOWN`, `origo`, `centerposition`, inherited container coordinate origins, local scale, and both `%` and `%%` relative dimensions. Text boxes use native font metrics together with `maxWidth`, `maxHeight`, alignment, wrapping, and `fixedsize` clipping. Cornered tile sprites use fixed nine-slice borders and optional center tiling; progress bars composite their filled and background textures; masked shields composite their background and mask textures.
37
39
 
40
+ Scripted-GUI composition follows `parent_scripted_gui` chains even when the linked child window is a top-level sibling in the `.gui` file. Literal `always = yes` and `always = no` visibility and click-enabled blocks are applied automatically. Scenario properties can select an element image or frame, move it with `.x` and `.y`, and control `.visible` or `.enabled` values. Dynamic lists instantiate their declared `entry_container` or `country_scope_entry_container`; each scenario row can select the country template with `countryScope`, choose an explicit `entryContainer`, and provide row-scoped text, image, frame, position, visibility, and enabled values.
41
+
38
42
  Preview scenarios can include exact layout expectations:
39
43
 
40
44
  ```json
@@ -58,6 +62,8 @@ Broad inspection indexes localisation actually referenced by GUI source and retu
58
62
 
59
63
  GUI rewrites keep complete validation evidence in a linked JSON resource and retain the highest-priority findings in the transaction result. Large surrounding interface inventories therefore do not turn a small scalar patch into a transaction structure-limit error.
60
64
 
65
+ Large inspections, renders, and rewrites send periodic MCP progress heartbeats while a service stage is still running. Clients that request progress can reset their idle request timer from these notifications; there is no 180-second GUI operation limit in the server, and cancellation still follows the request signal.
66
+
61
67
  ## Offline preview limits
62
68
 
63
69
  The renderer does not run the game engine. Each render includes a fidelity report that separates fields it models from fields it approximates, ignores, cannot resolve, or does not support. Treat that report as part of the review.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hoi4-agent-tools",
3
3
  "mcpName": "io.github.klimPaskov/hoi4-agent-tools",
4
- "version": "2.8.0",
4
+ "version": "2.8.2",
5
5
  "description": "Analyze HOI4 events, tech trees, AI weights, and MTTH; build focus trees, GUIs, and maps.",
6
6
  "type": "module",
7
7
  "license": "Apache-2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/configuration.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/configuration.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/continuous-focus-palette.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/continuous-focus-palette.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/custom-weighted-pool.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/custom-weighted-pool.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/event-feature-manifest.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/event-feature-manifest.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/focus-plan.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/focus-plan.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/focus-planning-sidecar.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/focus-planning-sidecar.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/gui-animation-source.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/gui-animation-source.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/gui-helper.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/gui-helper.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/gui-scenario.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/gui-scenario.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/map-operation.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/map-operation.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "oneOf": [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/operation-result.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/operation-result.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-analysis-result.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-analysis-result.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-compare-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-compare-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-evaluate-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-evaluate-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-inspect-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-inspect-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-render-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-render-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-scenario-set.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-scenario-set.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-sequence-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-sequence-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-simulate-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-simulate-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.0/schemas/probability-sweep-input.schema.json",
2
+ "$id": "https://github.com/klimPaskov/hoi4-agent-tools/blob/v2.8.2/schemas/probability-sweep-input.schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.klimPaskov/hoi4-agent-tools",
4
4
  "title": "HOI4 Agent Tools",
5
5
  "description": "Analyze HOI4 events, tech trees, AI weights, and MTTH; build focus trees, GUIs, and maps.",
6
- "version": "2.8.0",
6
+ "version": "2.8.2",
7
7
  "repository": {
8
8
  "url": "https://github.com/klimPaskov/hoi4-agent-tools",
9
9
  "source": "github"
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "hoi4-agent-tools",
16
- "version": "2.8.0",
16
+ "version": "2.8.2",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  }