hoi4-agent-tools 0.0.0-bootstrap.1 → 0.1.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.
- package/CHANGELOG.md +42 -0
- package/LICENSE +201 -0
- package/README.md +140 -2
- package/SECURITY.md +17 -0
- package/dist/bin/http.d.ts +3 -0
- package/dist/bin/http.d.ts.map +1 -0
- package/dist/bin/http.js +27 -0
- package/dist/bin/http.js.map +1 -0
- package/dist/bin/setup.d.ts +3 -0
- package/dist/bin/setup.d.ts.map +1 -0
- package/dist/bin/setup.js +188 -0
- package/dist/bin/setup.js.map +1 -0
- package/dist/bin/stdio.d.ts +3 -0
- package/dist/bin/stdio.d.ts.map +1 -0
- package/dist/bin/stdio.js +36 -0
- package/dist/bin/stdio.js.map +1 -0
- package/dist/hoi4_agent_tools/core/artifacts.d.ts +117 -0
- package/dist/hoi4_agent_tools/core/artifacts.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/artifacts.js +1047 -0
- package/dist/hoi4_agent_tools/core/artifacts.js.map +1 -0
- package/dist/hoi4_agent_tools/core/canonical.d.ts +13 -0
- package/dist/hoi4_agent_tools/core/canonical.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/canonical.js +41 -0
- package/dist/hoi4_agent_tools/core/canonical.js.map +1 -0
- package/dist/hoi4_agent_tools/core/configuration.d.ts +137 -0
- package/dist/hoi4_agent_tools/core/configuration.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/configuration.js +383 -0
- package/dist/hoi4_agent_tools/core/configuration.js.map +1 -0
- package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts +18 -0
- package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/diagnostic-collector.js +45 -0
- package/dist/hoi4_agent_tools/core/diagnostic-collector.js.map +1 -0
- package/dist/hoi4_agent_tools/core/diagnostics.d.ts +26 -0
- package/dist/hoi4_agent_tools/core/diagnostics.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/diagnostics.js +25 -0
- package/dist/hoi4_agent_tools/core/diagnostics.js.map +1 -0
- package/dist/hoi4_agent_tools/core/diff.d.ts +22 -0
- package/dist/hoi4_agent_tools/core/diff.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/diff.js +93 -0
- package/dist/hoi4_agent_tools/core/diff.js.map +1 -0
- package/dist/hoi4_agent_tools/core/engine.d.ts +56 -0
- package/dist/hoi4_agent_tools/core/engine.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/engine.js +319 -0
- package/dist/hoi4_agent_tools/core/engine.js.map +1 -0
- package/dist/hoi4_agent_tools/core/image-diff.d.ts +14 -0
- package/dist/hoi4_agent_tools/core/image-diff.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/image-diff.js +121 -0
- package/dist/hoi4_agent_tools/core/image-diff.js.map +1 -0
- package/dist/hoi4_agent_tools/core/index.d.ts +64 -0
- package/dist/hoi4_agent_tools/core/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/index.js +963 -0
- package/dist/hoi4_agent_tools/core/index.js.map +1 -0
- package/dist/hoi4_agent_tools/core/index.public.d.ts +16 -0
- package/dist/hoi4_agent_tools/core/index.public.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/index.public.js +16 -0
- package/dist/hoi4_agent_tools/core/index.public.js.map +1 -0
- package/dist/hoi4_agent_tools/core/render-budget.d.ts +51 -0
- package/dist/hoi4_agent_tools/core/render-budget.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/render-budget.js +109 -0
- package/dist/hoi4_agent_tools/core/render-budget.js.map +1 -0
- package/dist/hoi4_agent_tools/core/result.d.ts +45 -0
- package/dist/hoi4_agent_tools/core/result.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/result.js +26 -0
- package/dist/hoi4_agent_tools/core/result.js.map +1 -0
- package/dist/hoi4_agent_tools/core/scanner.d.ts +28 -0
- package/dist/hoi4_agent_tools/core/scanner.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/scanner.js +136 -0
- package/dist/hoi4_agent_tools/core/scanner.js.map +1 -0
- package/dist/hoi4_agent_tools/core/server-state.d.ts +31 -0
- package/dist/hoi4_agent_tools/core/server-state.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/server-state.js +413 -0
- package/dist/hoi4_agent_tools/core/server-state.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/encoding.d.ts +10 -0
- package/dist/hoi4_agent_tools/core/source/encoding.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/encoding.js +54 -0
- package/dist/hoi4_agent_tools/core/source/encoding.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/index.d.ts +7 -0
- package/dist/hoi4_agent_tools/core/source/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/index.js +7 -0
- package/dist/hoi4_agent_tools/core/source/index.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/lexer.d.ts +30 -0
- package/dist/hoi4_agent_tools/core/source/lexer.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/lexer.js +266 -0
- package/dist/hoi4_agent_tools/core/source/lexer.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/limits.d.ts +21 -0
- package/dist/hoi4_agent_tools/core/source/limits.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/limits.js +49 -0
- package/dist/hoi4_agent_tools/core/source/limits.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/localisation.d.ts +20 -0
- package/dist/hoi4_agent_tools/core/source/localisation.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/localisation.js +163 -0
- package/dist/hoi4_agent_tools/core/source/localisation.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/parser.d.ts +44 -0
- package/dist/hoi4_agent_tools/core/source/parser.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/parser.js +334 -0
- package/dist/hoi4_agent_tools/core/source/parser.js.map +1 -0
- package/dist/hoi4_agent_tools/core/source/rewrite.d.ts +10 -0
- package/dist/hoi4_agent_tools/core/source/rewrite.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/source/rewrite.js +28 -0
- package/dist/hoi4_agent_tools/core/source/rewrite.js.map +1 -0
- package/dist/hoi4_agent_tools/core/svg-text.d.ts +34 -0
- package/dist/hoi4_agent_tools/core/svg-text.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/svg-text.js +127 -0
- package/dist/hoi4_agent_tools/core/svg-text.js.map +1 -0
- package/dist/hoi4_agent_tools/core/transaction-limits.d.ts +9 -0
- package/dist/hoi4_agent_tools/core/transaction-limits.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/transaction-limits.js +9 -0
- package/dist/hoi4_agent_tools/core/transaction-limits.js.map +1 -0
- package/dist/hoi4_agent_tools/core/transactions.d.ts +162 -0
- package/dist/hoi4_agent_tools/core/transactions.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/transactions.js +1181 -0
- package/dist/hoi4_agent_tools/core/transactions.js.map +1 -0
- package/dist/hoi4_agent_tools/core/workspace.d.ts +68 -0
- package/dist/hoi4_agent_tools/core/workspace.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/core/workspace.js +794 -0
- package/dist/hoi4_agent_tools/core/workspace.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/compiler.d.ts +9 -0
- package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/compiler.js +273 -0
- package/dist/hoi4_agent_tools/focus/compiler.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/continuous-render.d.ts +32 -0
- package/dist/hoi4_agent_tools/focus/continuous-render.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/continuous-render.js +179 -0
- package/dist/hoi4_agent_tools/focus/continuous-render.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/drift.d.ts +22 -0
- package/dist/hoi4_agent_tools/focus/drift.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/drift.js +124 -0
- package/dist/hoi4_agent_tools/focus/drift.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/geometry.d.ts +17 -0
- package/dist/hoi4_agent_tools/focus/geometry.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/geometry.js +35 -0
- package/dist/hoi4_agent_tools/focus/geometry.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/importer.d.ts +9 -0
- package/dist/hoi4_agent_tools/focus/importer.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/importer.js +732 -0
- package/dist/hoi4_agent_tools/focus/importer.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/index.d.ts +14 -0
- package/dist/hoi4_agent_tools/focus/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/index.js +14 -0
- package/dist/hoi4_agent_tools/focus/index.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/layout.d.ts +5 -0
- package/dist/hoi4_agent_tools/focus/layout.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/layout.js +653 -0
- package/dist/hoi4_agent_tools/focus/layout.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/limits.d.ts +9 -0
- package/dist/hoi4_agent_tools/focus/limits.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/limits.js +9 -0
- package/dist/hoi4_agent_tools/focus/limits.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/lint.d.ts +14 -0
- package/dist/hoi4_agent_tools/focus/lint.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/lint.js +839 -0
- package/dist/hoi4_agent_tools/focus/lint.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/model.d.ts +303 -0
- package/dist/hoi4_agent_tools/focus/model.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/model.js +20 -0
- package/dist/hoi4_agent_tools/focus/model.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/native-effects.d.ts +9 -0
- package/dist/hoi4_agent_tools/focus/native-effects.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/native-effects.js +563 -0
- package/dist/hoi4_agent_tools/focus/native-effects.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/planning.d.ts +15 -0
- package/dist/hoi4_agent_tools/focus/planning.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/planning.js +241 -0
- package/dist/hoi4_agent_tools/focus/planning.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/presentation.d.ts +24 -0
- package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/presentation.js +204 -0
- package/dist/hoi4_agent_tools/focus/presentation.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/render.d.ts +35 -0
- package/dist/hoi4_agent_tools/focus/render.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/render.js +491 -0
- package/dist/hoi4_agent_tools/focus/render.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/service.d.ts +82 -0
- package/dist/hoi4_agent_tools/focus/service.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/service.js +492 -0
- package/dist/hoi4_agent_tools/focus/service.js.map +1 -0
- package/dist/hoi4_agent_tools/focus/source-update.d.ts +6 -0
- package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/focus/source-update.js +328 -0
- package/dist/hoi4_agent_tools/focus/source-update.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts +37 -0
- package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/animation-manifest.js +66 -0
- package/dist/hoi4_agent_tools/gui/animation-manifest.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/assets.d.ts +71 -0
- package/dist/hoi4_agent_tools/gui/assets.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/assets.js +629 -0
- package/dist/hoi4_agent_tools/gui/assets.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/dds.d.ts +17 -0
- package/dist/hoi4_agent_tools/gui/dds.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/dds.js +245 -0
- package/dist/hoi4_agent_tools/gui/dds.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/helpers.d.ts +101 -0
- package/dist/hoi4_agent_tools/gui/helpers.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/helpers.js +1072 -0
- package/dist/hoi4_agent_tools/gui/helpers.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/index.d.ts +15 -0
- package/dist/hoi4_agent_tools/gui/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/index.js +15 -0
- package/dist/hoi4_agent_tools/gui/index.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/layout.d.ts +6 -0
- package/dist/hoi4_agent_tools/gui/layout.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/layout.js +753 -0
- package/dist/hoi4_agent_tools/gui/layout.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/limits.d.ts +25 -0
- package/dist/hoi4_agent_tools/gui/limits.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/limits.js +27 -0
- package/dist/hoi4_agent_tools/gui/limits.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/renderer.d.ts +18 -0
- package/dist/hoi4_agent_tools/gui/renderer.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/renderer.js +388 -0
- package/dist/hoi4_agent_tools/gui/renderer.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/scenario.d.ts +66 -0
- package/dist/hoi4_agent_tools/gui/scenario.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/scenario.js +191 -0
- package/dist/hoi4_agent_tools/gui/scenario.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/source-graph.d.ts +7 -0
- package/dist/hoi4_agent_tools/gui/source-graph.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/source-graph.js +1074 -0
- package/dist/hoi4_agent_tools/gui/source-graph.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/source-patch.d.ts +13 -0
- package/dist/hoi4_agent_tools/gui/source-patch.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/source-patch.js +90 -0
- package/dist/hoi4_agent_tools/gui/source-patch.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/studio.d.ts +86 -0
- package/dist/hoi4_agent_tools/gui/studio.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/studio.js +830 -0
- package/dist/hoi4_agent_tools/gui/studio.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/tga.d.ts +16 -0
- package/dist/hoi4_agent_tools/gui/tga.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/tga.js +157 -0
- package/dist/hoi4_agent_tools/gui/tga.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/types.d.ts +322 -0
- package/dist/hoi4_agent_tools/gui/types.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/types.js +19 -0
- package/dist/hoi4_agent_tools/gui/types.js.map +1 -0
- package/dist/hoi4_agent_tools/gui/validators.d.ts +8 -0
- package/dist/hoi4_agent_tools/gui/validators.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/gui/validators.js +951 -0
- package/dist/hoi4_agent_tools/gui/validators.js.map +1 -0
- package/dist/hoi4_agent_tools/map/bmp.d.ts +62 -0
- package/dist/hoi4_agent_tools/map/bmp.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/bmp.js +363 -0
- package/dist/hoi4_agent_tools/map/bmp.js.map +1 -0
- package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts +5 -0
- package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/diagnostic-limit.js +21 -0
- package/dist/hoi4_agent_tools/map/diagnostic-limit.js.map +1 -0
- package/dist/hoi4_agent_tools/map/index.d.ts +8 -0
- package/dist/hoi4_agent_tools/map/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/index.js +8 -0
- package/dist/hoi4_agent_tools/map/index.js.map +1 -0
- package/dist/hoi4_agent_tools/map/limits.d.ts +13 -0
- package/dist/hoi4_agent_tools/map/limits.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/limits.js +13 -0
- package/dist/hoi4_agent_tools/map/limits.js.map +1 -0
- package/dist/hoi4_agent_tools/map/model.d.ts +269 -0
- package/dist/hoi4_agent_tools/map/model.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/model.js +1114 -0
- package/dist/hoi4_agent_tools/map/model.js.map +1 -0
- package/dist/hoi4_agent_tools/map/operations.d.ts +401 -0
- package/dist/hoi4_agent_tools/map/operations.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/operations.js +2717 -0
- package/dist/hoi4_agent_tools/map/operations.js.map +1 -0
- package/dist/hoi4_agent_tools/map/render.d.ts +90 -0
- package/dist/hoi4_agent_tools/map/render.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/render.js +759 -0
- package/dist/hoi4_agent_tools/map/render.js.map +1 -0
- package/dist/hoi4_agent_tools/map/service.d.ts +81 -0
- package/dist/hoi4_agent_tools/map/service.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/service.js +695 -0
- package/dist/hoi4_agent_tools/map/service.js.map +1 -0
- package/dist/hoi4_agent_tools/map/validation.d.ts +23 -0
- package/dist/hoi4_agent_tools/map/validation.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/map/validation.js +1177 -0
- package/dist/hoi4_agent_tools/map/validation.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +3 -0
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/prompts/register.js +50 -0
- package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +9 -0
- package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/registry/metadata.js +10 -0
- package/dist/hoi4_agent_tools/mcp/registry/metadata.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/resources/register.d.ts +5 -0
- package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/resources/register.js +278 -0
- package/dist/hoi4_agent_tools/mcp/resources/register.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/security/auth.d.ts +24 -0
- package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/security/auth.js +234 -0
- package/dist/hoi4_agent_tools/mcp/security/auth.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +35 -0
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js +835 -0
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/create.d.ts +5 -0
- package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/create.js +26 -0
- package/dist/hoi4_agent_tools/mcp/server/create.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +133 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +127 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/progress.d.ts +8 -0
- package/dist/hoi4_agent_tools/mcp/server/progress.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/progress.js +21 -0
- package/dist/hoi4_agent_tools/mcp/server/progress.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/result.d.ts +232 -0
- package/dist/hoi4_agent_tools/mcp/server/result.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/result.js +353 -0
- package/dist/hoi4_agent_tools/mcp/server/result.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts +5 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +1059 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +111 -0
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/gui.js +598 -0
- package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +5 -0
- package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/map.js +685 -0
- package/dist/hoi4_agent_tools/mcp/tools/map.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +58 -0
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js +181 -0
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +26 -0
- package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/event-store.js +86 -0
- package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +28 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.js +744 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +15 -0
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js +51 -0
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +1 -0
- package/dist/hoi4_agent_tools/runtime.d.ts +4 -0
- package/dist/hoi4_agent_tools/runtime.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/runtime.js +27 -0
- package/dist/hoi4_agent_tools/runtime.js.map +1 -0
- package/dist/hoi4_agent_tools/schemas/common.d.ts +74 -0
- package/dist/hoi4_agent_tools/schemas/common.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/schemas/common.js +51 -0
- package/dist/hoi4_agent_tools/schemas/common.js.map +1 -0
- package/dist/hoi4_agent_tools/schemas/focus.d.ts +784 -0
- package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/schemas/focus.js +330 -0
- package/dist/hoi4_agent_tools/schemas/focus.js.map +1 -0
- package/dist/hoi4_agent_tools/schemas/index.d.ts +5 -0
- package/dist/hoi4_agent_tools/schemas/index.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/schemas/index.js +5 -0
- package/dist/hoi4_agent_tools/schemas/index.js.map +1 -0
- package/dist/hoi4_agent_tools/schemas/map.d.ts +654 -0
- package/dist/hoi4_agent_tools/schemas/map.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/schemas/map.js +570 -0
- package/dist/hoi4_agent_tools/schemas/map.js.map +1 -0
- package/dist/hoi4_agent_tools/schemas/transaction.d.ts +259 -0
- package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/schemas/transaction.js +104 -0
- package/dist/hoi4_agent_tools/schemas/transaction.js.map +1 -0
- package/dist/hoi4_agent_tools/version.d.ts +6 -0
- package/dist/hoi4_agent_tools/version.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/version.js +7 -0
- package/dist/hoi4_agent_tools/version.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/docs/README.md +22 -0
- package/docs/adr/0001-runtime-and-language.md +16 -0
- package/docs/adr/0002-lossless-source-model.md +18 -0
- package/docs/adr/0003-image-and-font-codecs.md +18 -0
- package/docs/adr/0004-focus-layout.md +16 -0
- package/docs/adr/0005-offline-rendering.md +18 -0
- package/docs/adr/0006-mcp-sdk-and-protocol.md +16 -0
- package/docs/adr/0007-storage-and-transactions.md +24 -0
- package/docs/adr/0008-test-strategy.md +18 -0
- package/docs/adr/0009-packaging-and-registry.md +16 -0
- package/docs/adr/0010-unsupported-and-refusal-policy.md +18 -0
- package/docs/adr/0011-http-security.md +16 -0
- package/docs/adr/README.md +13 -0
- package/docs/architecture.md +60 -0
- package/docs/artifacts.md +133 -0
- package/docs/compatibility.md +33 -0
- package/docs/completion-report.md +60 -0
- package/docs/configuration.md +285 -0
- package/docs/focus-workflow.md +68 -0
- package/docs/gui-workflow.md +121 -0
- package/docs/limitations.md +30 -0
- package/docs/map-workflow.md +89 -0
- package/docs/performance.md +117 -0
- package/docs/release.md +181 -0
- package/docs/research/mcp-2026-07-10.md +46 -0
- package/docs/research/source-ledger.md +68 -0
- package/docs/security.md +139 -0
- package/docs/self-hosting.md +168 -0
- package/docs/testing.md +43 -0
- package/docs/third-party-notices.md +11 -0
- package/docs/transactions.md +162 -0
- package/docs/troubleshooting.md +46 -0
- package/package.json +98 -5
- package/schemas/configuration.schema.json +794 -0
- package/schemas/continuous-focus-palette.schema.json +325 -0
- package/schemas/focus-plan.schema.json +902 -0
- package/schemas/focus-planning-sidecar.schema.json +364 -0
- package/schemas/gui-animation-source.schema.json +176 -0
- package/schemas/gui-helper.schema.json +301 -0
- package/schemas/gui-scenario.schema.json +298 -0
- package/schemas/map-operation.schema.json +2284 -0
- package/schemas/operation-result.schema.json +344 -0
- package/schemas/transaction-manifest.schema.json +685 -0
- package/server.json +32 -0
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
import { compareCodeUnits } from './canonical.js';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { sortDiagnostics } from './diagnostics.js';
|
|
4
|
+
import { parseClausewitz, parseLocalisation, assignments, childBlocks, firstScalar, locationFor, sourcePartialLimitDiagnostics, SOURCE_MAX_BYTES, SOURCE_MAX_NESTING, nodeLocation, } from './source/index.js';
|
|
5
|
+
const guiElementKeys = new Set([
|
|
6
|
+
'containerWindowType',
|
|
7
|
+
'windowType',
|
|
8
|
+
'iconType',
|
|
9
|
+
'buttonType',
|
|
10
|
+
'instantTextBoxType',
|
|
11
|
+
'textBoxType',
|
|
12
|
+
'gridBoxType',
|
|
13
|
+
'listboxType',
|
|
14
|
+
'smoothListboxType',
|
|
15
|
+
'scrollbarType',
|
|
16
|
+
'checkboxType',
|
|
17
|
+
'editBoxType',
|
|
18
|
+
'OverlappingElementsBoxType',
|
|
19
|
+
]);
|
|
20
|
+
const eventBlockKeys = new Set([
|
|
21
|
+
'country_event',
|
|
22
|
+
'news_event',
|
|
23
|
+
'state_event',
|
|
24
|
+
'unit_leader_event',
|
|
25
|
+
'operative_leader_event',
|
|
26
|
+
]);
|
|
27
|
+
const decisionCategoryFields = new Set([
|
|
28
|
+
'allowed',
|
|
29
|
+
'available',
|
|
30
|
+
'icon',
|
|
31
|
+
'picture',
|
|
32
|
+
'priority',
|
|
33
|
+
'scripted_gui',
|
|
34
|
+
'target_root_trigger',
|
|
35
|
+
'visible',
|
|
36
|
+
'visible_when_empty',
|
|
37
|
+
]);
|
|
38
|
+
const INDEX_RECORD_LIMIT = 250_000;
|
|
39
|
+
const INDEX_DIAGNOSTIC_LIMIT = 10_000;
|
|
40
|
+
const INDEX_RELATED_LOCATION_LIMIT = 100;
|
|
41
|
+
const INDEX_TABLE_RECORD_LIMIT = 100_000;
|
|
42
|
+
const INDEX_TABLE_FIELD_LIMIT = 10_000;
|
|
43
|
+
export const INDEX_SKIPPED_SOURCE_SAMPLE_LIMIT = 100;
|
|
44
|
+
function possibleSymbolKinds(file, definitionFiles) {
|
|
45
|
+
const sourcePath = file.relativePath.replaceAll('\\', '/').toLowerCase();
|
|
46
|
+
const kinds = new Set();
|
|
47
|
+
if (sourcePath.endsWith('.yml') || sourcePath.endsWith('.yaml'))
|
|
48
|
+
kinds.add('localisation');
|
|
49
|
+
if (definitionFiles.has(file.displayPath) || path.posix.basename(sourcePath) === 'default.map') {
|
|
50
|
+
kinds.add('province');
|
|
51
|
+
kinds.add('province_color');
|
|
52
|
+
}
|
|
53
|
+
if (sourcePath.endsWith('adjacencies.csv'))
|
|
54
|
+
kinds.add('adjacency');
|
|
55
|
+
if (sourcePath.endsWith('supply_nodes.txt'))
|
|
56
|
+
kinds.add('supply_node');
|
|
57
|
+
if (sourcePath.endsWith('railways.txt'))
|
|
58
|
+
kinds.add('railway');
|
|
59
|
+
if (sourcePath.endsWith('.gfx')) {
|
|
60
|
+
kinds.add('sprite');
|
|
61
|
+
kinds.add('texture');
|
|
62
|
+
}
|
|
63
|
+
if (sourcePath.endsWith('.gui'))
|
|
64
|
+
kinds.add('gui_element');
|
|
65
|
+
if (sourcePath.endsWith('.txt')) {
|
|
66
|
+
if (/(?:^|\/)focus(?:es)?(?:\/|$)|national_focus|continuous_focus/u.test(sourcePath)) {
|
|
67
|
+
kinds.add('focus_tree');
|
|
68
|
+
kinds.add('focus');
|
|
69
|
+
kinds.add('continuous_focus_palette');
|
|
70
|
+
kinds.add('continuous_focus');
|
|
71
|
+
}
|
|
72
|
+
if (sourcePath.startsWith('events/'))
|
|
73
|
+
kinds.add('event');
|
|
74
|
+
if (sourcePath.startsWith('common/scripted_effects/'))
|
|
75
|
+
kinds.add('scripted_effect');
|
|
76
|
+
if (sourcePath.startsWith('common/scripted_triggers/'))
|
|
77
|
+
kinds.add('scripted_trigger');
|
|
78
|
+
if (sourcePath.startsWith('common/decisions/')) {
|
|
79
|
+
kinds.add('decision');
|
|
80
|
+
kinds.add('decision_category');
|
|
81
|
+
kinds.add('formable');
|
|
82
|
+
}
|
|
83
|
+
if (sourcePath.startsWith('common/ideas/'))
|
|
84
|
+
kinds.add('idea');
|
|
85
|
+
if (sourcePath.startsWith('common/characters/'))
|
|
86
|
+
kinds.add('leader');
|
|
87
|
+
if (sourcePath.startsWith('common/scripted_guis/'))
|
|
88
|
+
kinds.add('scripted_gui');
|
|
89
|
+
if (/(?:^|\/)history\/states\//u.test(sourcePath))
|
|
90
|
+
kinds.add('state');
|
|
91
|
+
if (/(?:^|\/)strategicregions\//u.test(sourcePath))
|
|
92
|
+
kinds.add('strategic_region');
|
|
93
|
+
}
|
|
94
|
+
return [...kinds].sort((left, right) => compareCodeUnits(left, right));
|
|
95
|
+
}
|
|
96
|
+
function splitDelimitedBounded(value, delimiter, maximumFields) {
|
|
97
|
+
const result = [];
|
|
98
|
+
let start = 0;
|
|
99
|
+
while (result.length + 1 < maximumFields) {
|
|
100
|
+
const next = value.indexOf(delimiter, start);
|
|
101
|
+
if (next < 0)
|
|
102
|
+
break;
|
|
103
|
+
result.push(value.slice(start, next));
|
|
104
|
+
start = next + delimiter.length;
|
|
105
|
+
}
|
|
106
|
+
result.push(value.slice(start));
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
function numeric(value) {
|
|
110
|
+
if (value === undefined || !/^-?\d+$/u.test(value))
|
|
111
|
+
return undefined;
|
|
112
|
+
const parsed = Number(value);
|
|
113
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
114
|
+
}
|
|
115
|
+
function scalars(block) {
|
|
116
|
+
return block.entries.filter((entry) => entry.type === 'scalar').map((entry) => entry.value);
|
|
117
|
+
}
|
|
118
|
+
function normalizedRelative(value) {
|
|
119
|
+
return value.replaceAll('\\', '/').replace(/^\.\//u, '').toLowerCase();
|
|
120
|
+
}
|
|
121
|
+
function sourceIdentity(file) {
|
|
122
|
+
return `${file.rootKind}:${file.loadOrder}`;
|
|
123
|
+
}
|
|
124
|
+
function selectedDefinitionFiles(files) {
|
|
125
|
+
const defaults = files.filter(({ relativePath }) => path.posix.basename(normalizedRelative(relativePath)) === 'default.map');
|
|
126
|
+
const directories = [
|
|
127
|
+
...new Set(defaults.map(({ relativePath }) => path.posix.dirname(normalizedRelative(relativePath)))),
|
|
128
|
+
];
|
|
129
|
+
const parsedDefaults = new Map();
|
|
130
|
+
const skippedDefaults = new Map();
|
|
131
|
+
const parseDefault = (file) => {
|
|
132
|
+
if (skippedDefaults.has(file.displayPath))
|
|
133
|
+
return undefined;
|
|
134
|
+
const cached = parsedDefaults.get(file.displayPath);
|
|
135
|
+
if (cached !== undefined)
|
|
136
|
+
return cached;
|
|
137
|
+
const document = parseClausewitz(file.bytes, file.displayPath);
|
|
138
|
+
const limitDiagnostics = sourcePartialLimitDiagnostics(document.diagnostics);
|
|
139
|
+
if (limitDiagnostics.length > 0) {
|
|
140
|
+
skippedDefaults.set(file.displayPath, { file, diagnostics: limitDiagnostics });
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
parsedDefaults.set(file.displayPath, document);
|
|
144
|
+
return document;
|
|
145
|
+
};
|
|
146
|
+
const activeSelector = new Map();
|
|
147
|
+
const activeSelectorDecided = new Set();
|
|
148
|
+
const blockedActiveSelector = new Set();
|
|
149
|
+
for (const file of [...defaults].sort((left, right) => right.loadOrder - left.loadOrder || compareCodeUnits(left.displayPath, right.displayPath))) {
|
|
150
|
+
const directory = path.posix.dirname(normalizedRelative(file.relativePath));
|
|
151
|
+
if (activeSelectorDecided.has(directory))
|
|
152
|
+
continue;
|
|
153
|
+
activeSelectorDecided.add(directory);
|
|
154
|
+
const document = parseDefault(file);
|
|
155
|
+
if (document === undefined) {
|
|
156
|
+
blockedActiveSelector.add(directory);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
activeSelector.set(directory, firstScalar(document.root, 'definitions')?.value ?? 'definition.csv');
|
|
160
|
+
}
|
|
161
|
+
const groups = new Map();
|
|
162
|
+
for (const file of files) {
|
|
163
|
+
const group = groups.get(sourceIdentity(file)) ?? [];
|
|
164
|
+
group.push(file);
|
|
165
|
+
groups.set(sourceIdentity(file), group);
|
|
166
|
+
}
|
|
167
|
+
const selected = new Set();
|
|
168
|
+
for (const group of groups.values()) {
|
|
169
|
+
const byRelative = new Map(group.map((file) => [normalizedRelative(file.relativePath), file]));
|
|
170
|
+
for (const directory of directories) {
|
|
171
|
+
if (blockedActiveSelector.has(directory))
|
|
172
|
+
continue;
|
|
173
|
+
const defaultMap = byRelative.get(path.posix.join(directory, 'default.map'));
|
|
174
|
+
const document = defaultMap === undefined ? undefined : parseDefault(defaultMap);
|
|
175
|
+
if (defaultMap !== undefined && document === undefined)
|
|
176
|
+
continue;
|
|
177
|
+
const selector = (document === undefined ? undefined : firstScalar(document.root, 'definitions')?.value) ??
|
|
178
|
+
activeSelector.get(directory) ??
|
|
179
|
+
'definition.csv';
|
|
180
|
+
const definition = byRelative.get(normalizedRelative(path.posix.join(directory, selector).replaceAll('\\', '/')));
|
|
181
|
+
if (definition !== undefined)
|
|
182
|
+
selected.add(definition.displayPath);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
for (const file of files) {
|
|
186
|
+
const relativePath = normalizedRelative(file.relativePath);
|
|
187
|
+
if (path.posix.basename(relativePath) === 'definition.csv' &&
|
|
188
|
+
!directories.includes(path.posix.dirname(relativePath))) {
|
|
189
|
+
selected.add(file.displayPath);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return { selected, skipped: [...skippedDefaults.values()] };
|
|
193
|
+
}
|
|
194
|
+
export class SymbolIndex {
|
|
195
|
+
symbols = [];
|
|
196
|
+
references = [];
|
|
197
|
+
diagnostics = [];
|
|
198
|
+
skippedSources = [];
|
|
199
|
+
files = new Map();
|
|
200
|
+
#active = new Map();
|
|
201
|
+
#definitionFiles = new Set();
|
|
202
|
+
#indexNestingBlocked = new Set();
|
|
203
|
+
#skippedSourcePaths = new Set();
|
|
204
|
+
#skippedPossibleSymbolKinds = new Set();
|
|
205
|
+
#currentFileShadowed = false;
|
|
206
|
+
#complete = true;
|
|
207
|
+
#skippedSourceCount = 0;
|
|
208
|
+
#symbolLimitReported = false;
|
|
209
|
+
#referenceLimitReported = false;
|
|
210
|
+
#diagnosticsTruncated = false;
|
|
211
|
+
static build(files) {
|
|
212
|
+
const index = new SymbolIndex();
|
|
213
|
+
const definitionSelection = selectedDefinitionFiles(files);
|
|
214
|
+
for (const displayPath of definitionSelection.selected)
|
|
215
|
+
index.#definitionFiles.add(displayPath);
|
|
216
|
+
for (const skipped of definitionSelection.skipped) {
|
|
217
|
+
index.recordSkippedSource(skipped.file, skipped.diagnostics);
|
|
218
|
+
}
|
|
219
|
+
for (const file of [...files].sort((a, b) => a.loadOrder - b.loadOrder || compareCodeUnits(a.displayPath, b.displayPath))) {
|
|
220
|
+
index.files.set(file.displayPath, file);
|
|
221
|
+
index.indexFile(file);
|
|
222
|
+
}
|
|
223
|
+
index.finalize();
|
|
224
|
+
return index;
|
|
225
|
+
}
|
|
226
|
+
get complete() {
|
|
227
|
+
return this.#complete;
|
|
228
|
+
}
|
|
229
|
+
get skippedSourceCount() {
|
|
230
|
+
return this.#skippedSourceCount;
|
|
231
|
+
}
|
|
232
|
+
get skippedPossibleSymbolKinds() {
|
|
233
|
+
return [...this.#skippedPossibleSymbolKinds].sort((left, right) => compareCodeUnits(left, right));
|
|
234
|
+
}
|
|
235
|
+
isSourceSkipped(path) {
|
|
236
|
+
return this.#skippedSourcePaths.has(path);
|
|
237
|
+
}
|
|
238
|
+
hasSkippedSourceForKind(kind) {
|
|
239
|
+
return this.#skippedPossibleSymbolKinds.has(kind);
|
|
240
|
+
}
|
|
241
|
+
find(kind, id) {
|
|
242
|
+
return this.#active.get(`${kind}:${id}`);
|
|
243
|
+
}
|
|
244
|
+
findAll(kind, id) {
|
|
245
|
+
return this.symbols.filter((symbol) => symbol.kind === kind && (id === undefined || symbol.id === id));
|
|
246
|
+
}
|
|
247
|
+
rebuild(files) {
|
|
248
|
+
return SymbolIndex.build(files);
|
|
249
|
+
}
|
|
250
|
+
unresolvedReferences() {
|
|
251
|
+
return this.references.filter((reference) => this.find(reference.toKind, reference.to) === undefined);
|
|
252
|
+
}
|
|
253
|
+
recordSkippedSource(file, diagnostics) {
|
|
254
|
+
if (file.shadowedBy !== undefined || this.#skippedSourcePaths.has(file.displayPath))
|
|
255
|
+
return;
|
|
256
|
+
this.#skippedSourcePaths.add(file.displayPath);
|
|
257
|
+
this.#complete = false;
|
|
258
|
+
this.#skippedSourceCount += 1;
|
|
259
|
+
const reasonCodes = [...new Set(diagnostics.map(({ code }) => code))].sort((left, right) => compareCodeUnits(left, right));
|
|
260
|
+
const candidates = possibleSymbolKinds(file, this.#definitionFiles);
|
|
261
|
+
for (const kind of candidates)
|
|
262
|
+
this.#skippedPossibleSymbolKinds.add(kind);
|
|
263
|
+
if (this.skippedSources.length >= INDEX_SKIPPED_SOURCE_SAMPLE_LIMIT)
|
|
264
|
+
return;
|
|
265
|
+
const skipped = {
|
|
266
|
+
path: file.displayPath,
|
|
267
|
+
relativePath: file.relativePath,
|
|
268
|
+
rootKind: file.rootKind,
|
|
269
|
+
loadOrder: file.loadOrder,
|
|
270
|
+
sha256: file.sha256,
|
|
271
|
+
reasonCodes,
|
|
272
|
+
possibleSymbolKinds: candidates,
|
|
273
|
+
};
|
|
274
|
+
this.skippedSources.push(skipped);
|
|
275
|
+
const location = diagnostics.find(({ location }) => location !== undefined)?.location;
|
|
276
|
+
this.addDiagnostic({
|
|
277
|
+
code: 'INDEX_SOURCE_SKIPPED_LIMIT',
|
|
278
|
+
severity: 'warning',
|
|
279
|
+
category: 'reference',
|
|
280
|
+
message: `Shared inventory skipped ${file.displayPath} because it exceeds a source parsing limit`,
|
|
281
|
+
...(location === undefined ? {} : { location }),
|
|
282
|
+
details: {
|
|
283
|
+
path: file.displayPath,
|
|
284
|
+
reasonCodes,
|
|
285
|
+
possibleSymbolKinds: candidates,
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
addSymbol(record) {
|
|
290
|
+
if (this.symbols.length >= INDEX_RECORD_LIMIT) {
|
|
291
|
+
this.#complete = false;
|
|
292
|
+
if (!this.#symbolLimitReported) {
|
|
293
|
+
this.#symbolLimitReported = true;
|
|
294
|
+
this.addDiagnostic({
|
|
295
|
+
code: 'INDEX_SYMBOL_LIMIT',
|
|
296
|
+
severity: 'blocker',
|
|
297
|
+
category: 'reference',
|
|
298
|
+
message: 'Shared symbol index exceeds the configured record limit',
|
|
299
|
+
details: { limit: INDEX_RECORD_LIMIT },
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
this.symbols.push({
|
|
305
|
+
...record,
|
|
306
|
+
overridden: this.#currentFileShadowed,
|
|
307
|
+
sourceShadowed: this.#currentFileShadowed,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
addReference(record) {
|
|
311
|
+
if (this.references.length >= INDEX_RECORD_LIMIT) {
|
|
312
|
+
this.#complete = false;
|
|
313
|
+
if (!this.#referenceLimitReported) {
|
|
314
|
+
this.#referenceLimitReported = true;
|
|
315
|
+
this.addDiagnostic({
|
|
316
|
+
code: 'INDEX_REFERENCE_LIMIT',
|
|
317
|
+
severity: 'blocker',
|
|
318
|
+
category: 'reference',
|
|
319
|
+
message: 'Shared reference index exceeds the configured record limit',
|
|
320
|
+
details: { limit: INDEX_RECORD_LIMIT },
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
this.references.push(record);
|
|
326
|
+
}
|
|
327
|
+
addDiagnostic(diagnostic) {
|
|
328
|
+
if (this.#diagnosticsTruncated)
|
|
329
|
+
return;
|
|
330
|
+
if (this.diagnostics.length < INDEX_DIAGNOSTIC_LIMIT) {
|
|
331
|
+
this.diagnostics.push(diagnostic);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.diagnostics[INDEX_DIAGNOSTIC_LIMIT - 1] = {
|
|
335
|
+
code: 'INDEX_DIAGNOSTICS_TRUNCATED',
|
|
336
|
+
severity: 'blocker',
|
|
337
|
+
category: 'reference',
|
|
338
|
+
message: 'Shared index diagnostics exceeded the configured output limit',
|
|
339
|
+
details: { limit: INDEX_DIAGNOSTIC_LIMIT },
|
|
340
|
+
};
|
|
341
|
+
this.#diagnosticsTruncated = true;
|
|
342
|
+
}
|
|
343
|
+
addDiagnostics(diagnostics) {
|
|
344
|
+
for (const diagnostic of diagnostics)
|
|
345
|
+
this.addDiagnostic(diagnostic);
|
|
346
|
+
}
|
|
347
|
+
indexFile(file) {
|
|
348
|
+
this.#currentFileShadowed = file.shadowedBy !== undefined;
|
|
349
|
+
const diagnosticStart = this.diagnostics.length;
|
|
350
|
+
const referenceStart = this.references.length;
|
|
351
|
+
const lower = file.relativePath.toLowerCase();
|
|
352
|
+
if (lower.endsWith('.yml')) {
|
|
353
|
+
const document = parseLocalisation(file.bytes, file.displayPath);
|
|
354
|
+
const limitDiagnostics = sourcePartialLimitDiagnostics(document.diagnostics);
|
|
355
|
+
if (limitDiagnostics.length > 0) {
|
|
356
|
+
this.recordSkippedSource(file, limitDiagnostics);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.addDiagnostics(document.diagnostics);
|
|
360
|
+
for (const entry of document.entries) {
|
|
361
|
+
this.addSymbol({
|
|
362
|
+
kind: 'localisation',
|
|
363
|
+
id: `${entry.language}:${entry.key}`,
|
|
364
|
+
path: file.displayPath,
|
|
365
|
+
rootKind: file.rootKind,
|
|
366
|
+
loadOrder: file.loadOrder,
|
|
367
|
+
location: locationFor(file.displayPath, document.lineIndex, entry.start, entry.end),
|
|
368
|
+
metadata: { language: entry.language, key: entry.key, value: entry.value },
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
if (this.#currentFileShadowed)
|
|
372
|
+
this.diagnostics.splice(diagnosticStart);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (this.#definitionFiles.has(file.displayPath)) {
|
|
376
|
+
this.indexDefinitions(file);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (lower.endsWith('adjacencies.csv')) {
|
|
380
|
+
this.indexAdjacencies(file);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (lower.endsWith('supply_nodes.txt') || lower.endsWith('railways.txt')) {
|
|
384
|
+
this.indexNetwork(file, lower.endsWith('supply_nodes.txt') ? 'supply_node' : 'railway');
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (!/\.(?:txt|gui|gfx)$/u.test(lower))
|
|
388
|
+
return;
|
|
389
|
+
// Map position/network tables can be very large but are not Clausewitz
|
|
390
|
+
// assignment sources. Their domain model is built by Agent Nudger.
|
|
391
|
+
if (!file.bytes.includes(0x3d))
|
|
392
|
+
return;
|
|
393
|
+
const document = parseClausewitz(file.bytes, file.displayPath);
|
|
394
|
+
const limitDiagnostics = sourcePartialLimitDiagnostics(document.diagnostics);
|
|
395
|
+
if (limitDiagnostics.length > 0) {
|
|
396
|
+
this.recordSkippedSource(file, limitDiagnostics);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
this.addDiagnostics(document.diagnostics);
|
|
400
|
+
this.walkBlock(document, document.root, file, []);
|
|
401
|
+
if (this.#currentFileShadowed) {
|
|
402
|
+
this.diagnostics.splice(diagnosticStart);
|
|
403
|
+
this.references.splice(referenceStart);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
walkBlock(document, block, file, ancestors) {
|
|
407
|
+
if (ancestors.length > SOURCE_MAX_NESTING) {
|
|
408
|
+
this.#complete = false;
|
|
409
|
+
const sourceAlreadyBlocked = document.diagnostics.some(({ code }) => code === 'SOURCE_NESTING_LIMIT' || code === 'SOURCE_DIAGNOSTICS_TRUNCATED');
|
|
410
|
+
if (!sourceAlreadyBlocked && !this.#indexNestingBlocked.has(file.displayPath)) {
|
|
411
|
+
this.#indexNestingBlocked.add(file.displayPath);
|
|
412
|
+
this.addDiagnostic({
|
|
413
|
+
code: 'SOURCE_INDEX_NESTING_LIMIT',
|
|
414
|
+
severity: 'blocker',
|
|
415
|
+
category: 'syntax',
|
|
416
|
+
message: `Source index traversal exceeds the supported nesting limit of ${SOURCE_MAX_NESTING}`,
|
|
417
|
+
location: nodeLocation(document, block),
|
|
418
|
+
details: { limit: SOURCE_MAX_NESTING },
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const sourcePath = file.relativePath.replaceAll('\\', '/').toLowerCase();
|
|
424
|
+
for (const assignment of assignments(block)) {
|
|
425
|
+
const key = assignment.key.value;
|
|
426
|
+
if (assignment.value.type !== 'block')
|
|
427
|
+
continue;
|
|
428
|
+
const child = assignment.value;
|
|
429
|
+
const id = firstScalar(child, 'id')?.value;
|
|
430
|
+
if (key === 'focus_tree' && id !== undefined) {
|
|
431
|
+
this.addSymbol({
|
|
432
|
+
kind: 'focus_tree',
|
|
433
|
+
id,
|
|
434
|
+
path: file.displayPath,
|
|
435
|
+
rootKind: file.rootKind,
|
|
436
|
+
loadOrder: file.loadOrder,
|
|
437
|
+
location: nodeLocation(document, assignment, id),
|
|
438
|
+
metadata: {},
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
else if (key === 'continuous_focus_palette' && id !== undefined) {
|
|
442
|
+
this.addSymbol({
|
|
443
|
+
kind: 'continuous_focus_palette',
|
|
444
|
+
id,
|
|
445
|
+
path: file.displayPath,
|
|
446
|
+
rootKind: file.rootKind,
|
|
447
|
+
loadOrder: file.loadOrder,
|
|
448
|
+
location: nodeLocation(document, assignment, id),
|
|
449
|
+
metadata: {},
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
else if (key === 'focus' &&
|
|
453
|
+
id !== undefined &&
|
|
454
|
+
ancestors.at(-1) === 'continuous_focus_palette') {
|
|
455
|
+
this.addSymbol({
|
|
456
|
+
kind: 'continuous_focus',
|
|
457
|
+
id,
|
|
458
|
+
path: file.displayPath,
|
|
459
|
+
rootKind: file.rootKind,
|
|
460
|
+
loadOrder: file.loadOrder,
|
|
461
|
+
location: nodeLocation(document, assignment, id),
|
|
462
|
+
metadata: {},
|
|
463
|
+
});
|
|
464
|
+
const icon = firstScalar(child, 'icon');
|
|
465
|
+
if (icon !== undefined)
|
|
466
|
+
this.addReference({
|
|
467
|
+
kind: 'continuous_focus_icon',
|
|
468
|
+
from: id,
|
|
469
|
+
toKind: 'sprite',
|
|
470
|
+
to: icon.value,
|
|
471
|
+
path: file.displayPath,
|
|
472
|
+
location: nodeLocation(document, icon, id),
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
else if (key === 'focus' && id !== undefined && ancestors.at(-1) === 'focus_tree') {
|
|
476
|
+
this.addSymbol({
|
|
477
|
+
kind: 'focus',
|
|
478
|
+
id,
|
|
479
|
+
path: file.displayPath,
|
|
480
|
+
rootKind: file.rootKind,
|
|
481
|
+
loadOrder: file.loadOrder,
|
|
482
|
+
location: nodeLocation(document, assignment, id),
|
|
483
|
+
metadata: {
|
|
484
|
+
x: numeric(firstScalar(child, 'x')?.value),
|
|
485
|
+
y: numeric(firstScalar(child, 'y')?.value),
|
|
486
|
+
},
|
|
487
|
+
});
|
|
488
|
+
for (const prerequisite of childBlocks(child, 'prerequisite')) {
|
|
489
|
+
for (const target of assignments(prerequisite, 'focus')) {
|
|
490
|
+
if (target.value.type === 'scalar')
|
|
491
|
+
this.addReference({
|
|
492
|
+
kind: 'focus_prerequisite',
|
|
493
|
+
from: id,
|
|
494
|
+
toKind: 'focus',
|
|
495
|
+
to: target.value.value,
|
|
496
|
+
path: file.displayPath,
|
|
497
|
+
location: nodeLocation(document, target, id),
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
for (const exclusion of childBlocks(child, 'mutually_exclusive')) {
|
|
502
|
+
for (const target of assignments(exclusion, 'focus')) {
|
|
503
|
+
if (target.value.type === 'scalar')
|
|
504
|
+
this.addReference({
|
|
505
|
+
kind: 'focus_exclusion',
|
|
506
|
+
from: id,
|
|
507
|
+
toKind: 'focus',
|
|
508
|
+
to: target.value.value,
|
|
509
|
+
path: file.displayPath,
|
|
510
|
+
location: nodeLocation(document, target, id),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const relative = firstScalar(child, 'relative_position_id');
|
|
515
|
+
if (relative !== undefined)
|
|
516
|
+
this.addReference({
|
|
517
|
+
kind: 'focus_relative_position',
|
|
518
|
+
from: id,
|
|
519
|
+
toKind: 'focus',
|
|
520
|
+
to: relative.value,
|
|
521
|
+
path: file.displayPath,
|
|
522
|
+
location: nodeLocation(document, relative, id),
|
|
523
|
+
});
|
|
524
|
+
const icon = firstScalar(child, 'icon');
|
|
525
|
+
if (icon !== undefined)
|
|
526
|
+
this.addReference({
|
|
527
|
+
kind: 'focus_icon',
|
|
528
|
+
from: id,
|
|
529
|
+
toKind: 'sprite',
|
|
530
|
+
to: icon.value,
|
|
531
|
+
path: file.displayPath,
|
|
532
|
+
location: nodeLocation(document, icon, id),
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
else if (sourcePath.startsWith('events/') && eventBlockKeys.has(key) && id !== undefined) {
|
|
536
|
+
this.addSymbol({
|
|
537
|
+
kind: 'event',
|
|
538
|
+
id,
|
|
539
|
+
path: file.displayPath,
|
|
540
|
+
rootKind: file.rootKind,
|
|
541
|
+
loadOrder: file.loadOrder,
|
|
542
|
+
location: nodeLocation(document, assignment, id),
|
|
543
|
+
metadata: { eventType: key },
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
else if (sourcePath.startsWith('common/scripted_effects/') && ancestors.length === 0) {
|
|
547
|
+
this.addSymbol({
|
|
548
|
+
kind: 'scripted_effect',
|
|
549
|
+
id: key,
|
|
550
|
+
path: file.displayPath,
|
|
551
|
+
rootKind: file.rootKind,
|
|
552
|
+
loadOrder: file.loadOrder,
|
|
553
|
+
location: nodeLocation(document, assignment, key),
|
|
554
|
+
metadata: {},
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
else if (sourcePath.startsWith('common/scripted_triggers/') && ancestors.length === 0) {
|
|
558
|
+
this.addSymbol({
|
|
559
|
+
kind: 'scripted_trigger',
|
|
560
|
+
id: key,
|
|
561
|
+
path: file.displayPath,
|
|
562
|
+
rootKind: file.rootKind,
|
|
563
|
+
loadOrder: file.loadOrder,
|
|
564
|
+
location: nodeLocation(document, assignment, key),
|
|
565
|
+
metadata: {},
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
else if (sourcePath.startsWith('common/decisions/') && ancestors.length === 0) {
|
|
569
|
+
this.addSymbol({
|
|
570
|
+
kind: 'decision_category',
|
|
571
|
+
id: key,
|
|
572
|
+
path: file.displayPath,
|
|
573
|
+
rootKind: file.rootKind,
|
|
574
|
+
loadOrder: file.loadOrder,
|
|
575
|
+
location: nodeLocation(document, assignment, key),
|
|
576
|
+
metadata: {},
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
else if (sourcePath.startsWith('common/decisions/') &&
|
|
580
|
+
!sourcePath.startsWith('common/decisions/categories/') &&
|
|
581
|
+
ancestors.length === 1 &&
|
|
582
|
+
!decisionCategoryFields.has(key)) {
|
|
583
|
+
this.addSymbol({
|
|
584
|
+
kind: 'decision',
|
|
585
|
+
id: key,
|
|
586
|
+
path: file.displayPath,
|
|
587
|
+
rootKind: file.rootKind,
|
|
588
|
+
loadOrder: file.loadOrder,
|
|
589
|
+
location: nodeLocation(document, assignment, key),
|
|
590
|
+
metadata: { category: ancestors[0] },
|
|
591
|
+
});
|
|
592
|
+
if (/formable|form_country/iu.test(`${sourcePath}:${ancestors[0] ?? ''}`) ||
|
|
593
|
+
/^form_/iu.test(key)) {
|
|
594
|
+
this.addSymbol({
|
|
595
|
+
kind: 'formable',
|
|
596
|
+
id: key,
|
|
597
|
+
path: file.displayPath,
|
|
598
|
+
rootKind: file.rootKind,
|
|
599
|
+
loadOrder: file.loadOrder,
|
|
600
|
+
location: nodeLocation(document, assignment, key),
|
|
601
|
+
metadata: { decision: key },
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
else if (sourcePath.startsWith('common/ideas/') &&
|
|
606
|
+
ancestors.length === 2 &&
|
|
607
|
+
ancestors[0] === 'ideas') {
|
|
608
|
+
this.addSymbol({
|
|
609
|
+
kind: 'idea',
|
|
610
|
+
id: key,
|
|
611
|
+
path: file.displayPath,
|
|
612
|
+
rootKind: file.rootKind,
|
|
613
|
+
loadOrder: file.loadOrder,
|
|
614
|
+
location: nodeLocation(document, assignment, key),
|
|
615
|
+
metadata: { category: ancestors[1] },
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
else if (sourcePath.startsWith('common/characters/') &&
|
|
619
|
+
ancestors.length === 1 &&
|
|
620
|
+
ancestors[0] === 'characters') {
|
|
621
|
+
this.addSymbol({
|
|
622
|
+
kind: 'leader',
|
|
623
|
+
id: key,
|
|
624
|
+
path: file.displayPath,
|
|
625
|
+
rootKind: file.rootKind,
|
|
626
|
+
loadOrder: file.loadOrder,
|
|
627
|
+
location: nodeLocation(document, assignment, key),
|
|
628
|
+
metadata: {},
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
else if ((key === 'spriteType' || key === 'frameAnimatedSpriteType') &&
|
|
632
|
+
firstScalar(child, 'name') !== undefined) {
|
|
633
|
+
const name = firstScalar(child, 'name');
|
|
634
|
+
const texture = firstScalar(child, 'texturefile');
|
|
635
|
+
this.addSymbol({
|
|
636
|
+
kind: 'sprite',
|
|
637
|
+
id: name.value,
|
|
638
|
+
path: file.displayPath,
|
|
639
|
+
rootKind: file.rootKind,
|
|
640
|
+
loadOrder: file.loadOrder,
|
|
641
|
+
location: nodeLocation(document, assignment, name.value),
|
|
642
|
+
metadata: {
|
|
643
|
+
spriteType: key,
|
|
644
|
+
texture: texture?.value,
|
|
645
|
+
frames: numeric(firstScalar(child, 'noOfFrames')?.value) ??
|
|
646
|
+
numeric(firstScalar(child, 'noofframes')?.value),
|
|
647
|
+
},
|
|
648
|
+
});
|
|
649
|
+
if (texture !== undefined)
|
|
650
|
+
this.addSymbol({
|
|
651
|
+
kind: 'texture',
|
|
652
|
+
id: texture.value,
|
|
653
|
+
path: file.displayPath,
|
|
654
|
+
rootKind: file.rootKind,
|
|
655
|
+
loadOrder: file.loadOrder,
|
|
656
|
+
location: nodeLocation(document, texture, texture.value),
|
|
657
|
+
metadata: { sprite: name.value },
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
else if (guiElementKeys.has(key) && firstScalar(child, 'name') !== undefined) {
|
|
661
|
+
const name = firstScalar(child, 'name');
|
|
662
|
+
this.addSymbol({
|
|
663
|
+
kind: 'gui_element',
|
|
664
|
+
id: name.value,
|
|
665
|
+
path: file.displayPath,
|
|
666
|
+
rootKind: file.rootKind,
|
|
667
|
+
loadOrder: file.loadOrder,
|
|
668
|
+
location: nodeLocation(document, assignment, name.value),
|
|
669
|
+
metadata: { elementType: key, ancestors },
|
|
670
|
+
});
|
|
671
|
+
const sprite = firstScalar(child, 'spriteType');
|
|
672
|
+
if (sprite !== undefined)
|
|
673
|
+
this.addReference({
|
|
674
|
+
kind: 'gui_sprite',
|
|
675
|
+
from: name.value,
|
|
676
|
+
toKind: 'sprite',
|
|
677
|
+
to: sprite.value,
|
|
678
|
+
path: file.displayPath,
|
|
679
|
+
location: nodeLocation(document, sprite, name.value),
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
else if (ancestors.at(-1) === 'scripted_gui') {
|
|
683
|
+
this.addSymbol({
|
|
684
|
+
kind: 'scripted_gui',
|
|
685
|
+
id: key,
|
|
686
|
+
path: file.displayPath,
|
|
687
|
+
rootKind: file.rootKind,
|
|
688
|
+
loadOrder: file.loadOrder,
|
|
689
|
+
location: nodeLocation(document, assignment, key),
|
|
690
|
+
metadata: {
|
|
691
|
+
context: firstScalar(child, 'context_type')?.value,
|
|
692
|
+
window: firstScalar(child, 'window_name')?.value,
|
|
693
|
+
},
|
|
694
|
+
});
|
|
695
|
+
const window = firstScalar(child, 'window_name');
|
|
696
|
+
if (window !== undefined)
|
|
697
|
+
this.addReference({
|
|
698
|
+
kind: 'scripted_gui_window',
|
|
699
|
+
from: key,
|
|
700
|
+
toKind: 'gui_element',
|
|
701
|
+
to: window.value,
|
|
702
|
+
path: file.displayPath,
|
|
703
|
+
location: nodeLocation(document, window, key),
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
else if (key === 'state' && id !== undefined) {
|
|
707
|
+
const provinces = childBlocks(child, 'provinces').flatMap(scalars);
|
|
708
|
+
this.addSymbol({
|
|
709
|
+
kind: 'state',
|
|
710
|
+
id,
|
|
711
|
+
path: file.displayPath,
|
|
712
|
+
rootKind: file.rootKind,
|
|
713
|
+
loadOrder: file.loadOrder,
|
|
714
|
+
location: nodeLocation(document, assignment, id),
|
|
715
|
+
metadata: { provinces, name: firstScalar(child, 'name')?.value },
|
|
716
|
+
});
|
|
717
|
+
for (const province of provinces)
|
|
718
|
+
this.addReference({
|
|
719
|
+
kind: 'state_province',
|
|
720
|
+
from: id,
|
|
721
|
+
toKind: 'province',
|
|
722
|
+
to: province,
|
|
723
|
+
path: file.displayPath,
|
|
724
|
+
location: nodeLocation(document, assignment, id),
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
else if ((key === 'strategic_region' || key === 'strategic_region_template') &&
|
|
728
|
+
id !== undefined) {
|
|
729
|
+
const provinces = childBlocks(child, 'provinces').flatMap(scalars);
|
|
730
|
+
this.addSymbol({
|
|
731
|
+
kind: 'strategic_region',
|
|
732
|
+
id,
|
|
733
|
+
path: file.displayPath,
|
|
734
|
+
rootKind: file.rootKind,
|
|
735
|
+
loadOrder: file.loadOrder,
|
|
736
|
+
location: nodeLocation(document, assignment, id),
|
|
737
|
+
metadata: { provinces, name: firstScalar(child, 'name')?.value },
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
this.walkBlock(document, child, file, [...ancestors, key]);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
*tableLines(file) {
|
|
744
|
+
if (file.bytes.length > SOURCE_MAX_BYTES) {
|
|
745
|
+
this.recordSkippedSource(file, [
|
|
746
|
+
{
|
|
747
|
+
code: 'INDEX_TABLE_FILE_LIMIT',
|
|
748
|
+
severity: 'blocker',
|
|
749
|
+
category: 'reference',
|
|
750
|
+
message: 'Shared-index map table exceeds the fixed parsing-byte limit',
|
|
751
|
+
details: { path: file.displayPath, limit: SOURCE_MAX_BYTES },
|
|
752
|
+
},
|
|
753
|
+
]);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const text = file.bytes.toString('utf8');
|
|
757
|
+
let start = 0;
|
|
758
|
+
let line = 1;
|
|
759
|
+
while (start <= text.length) {
|
|
760
|
+
if (line > INDEX_TABLE_RECORD_LIMIT) {
|
|
761
|
+
this.#complete = false;
|
|
762
|
+
this.addDiagnostic({
|
|
763
|
+
code: 'INDEX_TABLE_RECORD_LIMIT',
|
|
764
|
+
severity: 'blocker',
|
|
765
|
+
category: 'reference',
|
|
766
|
+
message: 'Shared-index map table exceeds the fixed record limit',
|
|
767
|
+
details: { path: file.displayPath, limit: INDEX_TABLE_RECORD_LIMIT },
|
|
768
|
+
});
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
let end = start;
|
|
772
|
+
while (end < text.length && text[end] !== '\r' && text[end] !== '\n')
|
|
773
|
+
end += 1;
|
|
774
|
+
yield { text: text.slice(start, end), line };
|
|
775
|
+
if (end >= text.length)
|
|
776
|
+
return;
|
|
777
|
+
start = end + (text[end] === '\r' && text[end + 1] === '\n' ? 2 : 1);
|
|
778
|
+
line += 1;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
whitespaceFields(file, value, line) {
|
|
782
|
+
const fields = [];
|
|
783
|
+
const matcher = /\S+/gu;
|
|
784
|
+
let match;
|
|
785
|
+
while ((match = matcher.exec(value)) !== null) {
|
|
786
|
+
if (fields.length >= INDEX_TABLE_FIELD_LIMIT) {
|
|
787
|
+
this.#complete = false;
|
|
788
|
+
this.addDiagnostic({
|
|
789
|
+
code: 'INDEX_TABLE_FIELD_LIMIT',
|
|
790
|
+
severity: 'blocker',
|
|
791
|
+
category: 'reference',
|
|
792
|
+
message: 'Shared-index map-table row exceeds the fixed field limit',
|
|
793
|
+
details: { path: file.displayPath, line, limit: INDEX_TABLE_FIELD_LIMIT },
|
|
794
|
+
});
|
|
795
|
+
return undefined;
|
|
796
|
+
}
|
|
797
|
+
fields.push(match[0]);
|
|
798
|
+
}
|
|
799
|
+
return fields;
|
|
800
|
+
}
|
|
801
|
+
indexDefinitions(file) {
|
|
802
|
+
for (const { text, line } of this.tableLines(file)) {
|
|
803
|
+
const parts = splitDelimitedBounded(text, ';', 8);
|
|
804
|
+
if (parts.length < 4 || !/^\d+$/u.test(parts[0]))
|
|
805
|
+
continue;
|
|
806
|
+
const id = parts[0];
|
|
807
|
+
const color = `${parts[1]},${parts[2]},${parts[3]}`;
|
|
808
|
+
this.addSymbol({
|
|
809
|
+
kind: 'province',
|
|
810
|
+
id,
|
|
811
|
+
path: file.displayPath,
|
|
812
|
+
rootKind: file.rootKind,
|
|
813
|
+
loadOrder: file.loadOrder,
|
|
814
|
+
metadata: {
|
|
815
|
+
color,
|
|
816
|
+
type: parts[4],
|
|
817
|
+
coastal: parts[5],
|
|
818
|
+
terrain: parts[6],
|
|
819
|
+
continent: parts[7],
|
|
820
|
+
line,
|
|
821
|
+
},
|
|
822
|
+
});
|
|
823
|
+
this.addSymbol({
|
|
824
|
+
kind: 'province_color',
|
|
825
|
+
id: color,
|
|
826
|
+
path: file.displayPath,
|
|
827
|
+
rootKind: file.rootKind,
|
|
828
|
+
loadOrder: file.loadOrder,
|
|
829
|
+
metadata: { provinceId: id, line },
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
indexAdjacencies(file) {
|
|
834
|
+
for (const { text, line } of this.tableLines(file)) {
|
|
835
|
+
if (line === 1)
|
|
836
|
+
continue;
|
|
837
|
+
const parts = splitDelimitedBounded(text, ';', 4);
|
|
838
|
+
if (parts.length < 3 || !/^\d+$/u.test(parts[0]) || !/^\d+$/u.test(parts[1]))
|
|
839
|
+
continue;
|
|
840
|
+
const id = `${parts[0]}:${parts[1]}:${parts[2]}:${line}`;
|
|
841
|
+
this.addSymbol({
|
|
842
|
+
kind: 'adjacency',
|
|
843
|
+
id,
|
|
844
|
+
path: file.displayPath,
|
|
845
|
+
rootKind: file.rootKind,
|
|
846
|
+
loadOrder: file.loadOrder,
|
|
847
|
+
metadata: {
|
|
848
|
+
from: parts[0],
|
|
849
|
+
to: parts[1],
|
|
850
|
+
type: parts[2],
|
|
851
|
+
through: parts[3],
|
|
852
|
+
line,
|
|
853
|
+
},
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
indexNetwork(file, kind) {
|
|
858
|
+
for (const { text, line } of this.tableLines(file)) {
|
|
859
|
+
const values = this.whitespaceFields(file, text, line);
|
|
860
|
+
if (values === undefined)
|
|
861
|
+
continue;
|
|
862
|
+
if (values.length < 2 || values.some((value) => !/^\d+$/u.test(value)))
|
|
863
|
+
continue;
|
|
864
|
+
this.addSymbol({
|
|
865
|
+
kind,
|
|
866
|
+
id: `${line}:${values.join(':')}`,
|
|
867
|
+
path: file.displayPath,
|
|
868
|
+
rootKind: file.rootKind,
|
|
869
|
+
loadOrder: file.loadOrder,
|
|
870
|
+
metadata: { values, line },
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
finalize() {
|
|
875
|
+
if (this.#skippedSourceCount > this.skippedSources.length) {
|
|
876
|
+
this.addDiagnostic({
|
|
877
|
+
code: 'INDEX_SKIPPED_SOURCE_LIST_TRUNCATED',
|
|
878
|
+
severity: 'warning',
|
|
879
|
+
category: 'reference',
|
|
880
|
+
message: 'Shared inventory skipped more sources than the bounded source list can retain',
|
|
881
|
+
details: {
|
|
882
|
+
skippedSourceCount: this.#skippedSourceCount,
|
|
883
|
+
retained: this.skippedSources.length,
|
|
884
|
+
limit: INDEX_SKIPPED_SOURCE_SAMPLE_LIMIT,
|
|
885
|
+
},
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
if (this.#symbolLimitReported &&
|
|
889
|
+
!this.diagnostics.some(({ code }) => code === 'INDEX_SYMBOL_LIMIT')) {
|
|
890
|
+
this.addDiagnostic({
|
|
891
|
+
code: 'INDEX_SYMBOL_LIMIT',
|
|
892
|
+
severity: 'blocker',
|
|
893
|
+
category: 'reference',
|
|
894
|
+
message: 'Shared symbol index exceeds the configured record limit',
|
|
895
|
+
details: { limit: INDEX_RECORD_LIMIT },
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
if (this.#referenceLimitReported &&
|
|
899
|
+
!this.diagnostics.some(({ code }) => code === 'INDEX_REFERENCE_LIMIT')) {
|
|
900
|
+
this.addDiagnostic({
|
|
901
|
+
code: 'INDEX_REFERENCE_LIMIT',
|
|
902
|
+
severity: 'blocker',
|
|
903
|
+
category: 'reference',
|
|
904
|
+
message: 'Shared reference index exceeds the configured record limit',
|
|
905
|
+
details: { limit: INDEX_RECORD_LIMIT },
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
const groups = new Map();
|
|
909
|
+
for (const symbol of this.symbols) {
|
|
910
|
+
const key = `${symbol.kind}:${symbol.id}`;
|
|
911
|
+
const group = groups.get(key) ?? [];
|
|
912
|
+
group.push(symbol);
|
|
913
|
+
groups.set(key, group);
|
|
914
|
+
}
|
|
915
|
+
for (const [key, group] of groups) {
|
|
916
|
+
group.sort((a, b) => b.loadOrder - a.loadOrder || compareCodeUnits(a.path, b.path));
|
|
917
|
+
const candidates = group.filter(({ sourceShadowed }) => !sourceShadowed);
|
|
918
|
+
if (candidates.length === 0)
|
|
919
|
+
continue;
|
|
920
|
+
const active = candidates[0];
|
|
921
|
+
this.#active.set(key, active);
|
|
922
|
+
const additiveCategory = active.kind === 'decision_category';
|
|
923
|
+
for (const candidate of group) {
|
|
924
|
+
candidate.overridden = additiveCategory ? candidate.sourceShadowed : candidate !== active;
|
|
925
|
+
}
|
|
926
|
+
const sameLevel = candidates.filter(({ loadOrder }) => loadOrder === active.loadOrder);
|
|
927
|
+
if (!additiveCategory && sameLevel.length > 1) {
|
|
928
|
+
this.addDiagnostic({
|
|
929
|
+
code: 'INDEX_SYMBOL_COLLISION',
|
|
930
|
+
severity: 'error',
|
|
931
|
+
category: 'reference',
|
|
932
|
+
message: `Multiple active definitions for ${key}`,
|
|
933
|
+
...(active.location === undefined ? {} : { location: active.location }),
|
|
934
|
+
related: sameLevel
|
|
935
|
+
.slice(1, INDEX_RELATED_LOCATION_LIMIT + 1)
|
|
936
|
+
.flatMap(({ location }) => (location === undefined ? [] : [location])),
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
for (const reference of this.unresolvedReferences()) {
|
|
941
|
+
const mayResolveFromSkippedSource = this.#skippedPossibleSymbolKinds.has(reference.toKind);
|
|
942
|
+
this.addDiagnostic({
|
|
943
|
+
code: mayResolveFromSkippedSource
|
|
944
|
+
? 'INDEX_UNRESOLVED_REFERENCE_PARTIAL'
|
|
945
|
+
: 'INDEX_UNRESOLVED_REFERENCE',
|
|
946
|
+
severity: mayResolveFromSkippedSource ? 'warning' : 'error',
|
|
947
|
+
category: 'reference',
|
|
948
|
+
message: mayResolveFromSkippedSource
|
|
949
|
+
? `The partial shared inventory cannot resolve ${reference.toKind} reference ${reference.to}; a skipped source could define it`
|
|
950
|
+
: `Unresolved ${reference.toKind} reference: ${reference.to}`,
|
|
951
|
+
...(reference.location === undefined ? {} : { location: reference.location }),
|
|
952
|
+
details: {
|
|
953
|
+
referenceKind: reference.kind,
|
|
954
|
+
from: reference.from,
|
|
955
|
+
...(mayResolveFromSkippedSource ? { skippedSourceCount: this.#skippedSourceCount } : {}),
|
|
956
|
+
},
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
const sorted = sortDiagnostics(this.diagnostics);
|
|
960
|
+
this.diagnostics.splice(0, this.diagnostics.length, ...sorted);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
//# sourceMappingURL=index.js.map
|