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,732 @@
|
|
|
1
|
+
import { compareCodeUnits, sha256Bytes } from '../core/canonical.js';
|
|
2
|
+
import { assignments, firstScalar, nodeLocation, } from '../core/source/index.js';
|
|
3
|
+
import { FOCUS_PLAN_SCHEMA_VERSION, focusPlanHash, } from './model.js';
|
|
4
|
+
import { nativeFocusEffectKeys } from './native-effects.js';
|
|
5
|
+
const knownTreeKeys = new Set([
|
|
6
|
+
'id',
|
|
7
|
+
'country',
|
|
8
|
+
'default',
|
|
9
|
+
'focus',
|
|
10
|
+
'shared_focus',
|
|
11
|
+
'continuous_focus_position',
|
|
12
|
+
'initial_show_position',
|
|
13
|
+
]);
|
|
14
|
+
const knownFocusKeys = new Set([
|
|
15
|
+
'id',
|
|
16
|
+
'icon',
|
|
17
|
+
'prerequisite',
|
|
18
|
+
'mutually_exclusive',
|
|
19
|
+
'x',
|
|
20
|
+
'y',
|
|
21
|
+
'relative_position_id',
|
|
22
|
+
'cost',
|
|
23
|
+
'available',
|
|
24
|
+
'bypass',
|
|
25
|
+
'allow_branch',
|
|
26
|
+
'search_filters',
|
|
27
|
+
'ai_will_do',
|
|
28
|
+
'completion_reward',
|
|
29
|
+
// Legacy planner markers are read for migration diagnostics but never re-emitted.
|
|
30
|
+
'hidden',
|
|
31
|
+
'crisis',
|
|
32
|
+
'continuous',
|
|
33
|
+
]);
|
|
34
|
+
const knownContinuousPaletteKeys = new Set([
|
|
35
|
+
'id',
|
|
36
|
+
'country',
|
|
37
|
+
'default',
|
|
38
|
+
'reset_on_civilwar',
|
|
39
|
+
'position',
|
|
40
|
+
'focus',
|
|
41
|
+
]);
|
|
42
|
+
const knownContinuousFocusKeys = new Set(['id', 'icon']);
|
|
43
|
+
const referenceEffects = new Map([
|
|
44
|
+
['activate_decision', { kind: 'decision', fields: ['decision', 'id'] }],
|
|
45
|
+
['activate_mission', { kind: 'decision', fields: ['mission', 'decision', 'id'] }],
|
|
46
|
+
['activate_mission_tooltip', { kind: 'decision', fields: ['mission', 'decision', 'id'] }],
|
|
47
|
+
['activate_targeted_decision', { kind: 'decision', fields: ['decision'] }],
|
|
48
|
+
['add_days_mission_timeout', { kind: 'decision', fields: ['mission'] }],
|
|
49
|
+
['remove_decision', { kind: 'decision', fields: ['decision', 'id'] }],
|
|
50
|
+
['remove_decision_on_cooldown', { kind: 'decision', fields: ['decision', 'id'] }],
|
|
51
|
+
['remove_mission', { kind: 'decision', fields: ['mission', 'decision', 'id'] }],
|
|
52
|
+
['remove_targeted_decision', { kind: 'decision', fields: ['decision'] }],
|
|
53
|
+
['unlock_decision_tooltip', { kind: 'decision', fields: ['decision'] }],
|
|
54
|
+
['unlock_decision_category_tooltip', { kind: 'decision_category', fields: ['category', 'id'] }],
|
|
55
|
+
['country_event', { kind: 'event', fields: ['id'] }],
|
|
56
|
+
['news_event', { kind: 'event', fields: ['id'] }],
|
|
57
|
+
['state_event', { kind: 'event', fields: ['id'] }],
|
|
58
|
+
['unit_leader_event', { kind: 'event', fields: ['id'] }],
|
|
59
|
+
['operative_leader_event', { kind: 'event', fields: ['id'] }],
|
|
60
|
+
['add_ideas', { kind: 'idea', fields: ['id', 'idea'], blockScalars: true }],
|
|
61
|
+
['remove_ideas', { kind: 'idea', fields: ['id', 'idea'], blockScalars: true }],
|
|
62
|
+
['add_timed_idea', { kind: 'idea', fields: ['idea'] }],
|
|
63
|
+
['modify_timed_idea', { kind: 'idea', fields: ['idea'] }],
|
|
64
|
+
['show_ideas_tooltip', { kind: 'idea', fields: ['idea', 'id'] }],
|
|
65
|
+
['swap_ideas', { kind: 'idea', fields: ['add_idea', 'remove_idea'] }],
|
|
66
|
+
['recruit_character', { kind: 'leader', fields: ['character', 'id'] }],
|
|
67
|
+
['promote_character', { kind: 'leader', fields: ['character', 'id'] }],
|
|
68
|
+
['retire_character', { kind: 'leader', fields: ['character', 'id'] }],
|
|
69
|
+
]);
|
|
70
|
+
const effectContainerKeys = new Set([
|
|
71
|
+
'create_dynamic_country',
|
|
72
|
+
'custom_override_tooltip',
|
|
73
|
+
'effect_tooltip',
|
|
74
|
+
'else',
|
|
75
|
+
'else_if',
|
|
76
|
+
'for_each_loop',
|
|
77
|
+
'for_each_scope_loop',
|
|
78
|
+
'for_loop_effect',
|
|
79
|
+
'hidden_effect',
|
|
80
|
+
'if',
|
|
81
|
+
'party_leader',
|
|
82
|
+
'random',
|
|
83
|
+
'random_list',
|
|
84
|
+
'while_loop_effect',
|
|
85
|
+
]);
|
|
86
|
+
const effectContainerControlKeys = new Set([
|
|
87
|
+
'add',
|
|
88
|
+
'array',
|
|
89
|
+
'break',
|
|
90
|
+
'chance',
|
|
91
|
+
'compare',
|
|
92
|
+
'copy_tag',
|
|
93
|
+
'count',
|
|
94
|
+
'display_individual_scopes',
|
|
95
|
+
'end',
|
|
96
|
+
'include_invisible',
|
|
97
|
+
'index',
|
|
98
|
+
'limit',
|
|
99
|
+
'max',
|
|
100
|
+
'min',
|
|
101
|
+
'modifier',
|
|
102
|
+
'order_by',
|
|
103
|
+
'position',
|
|
104
|
+
'prioritize',
|
|
105
|
+
'random_select_amount',
|
|
106
|
+
'seed',
|
|
107
|
+
'start',
|
|
108
|
+
'original_tag',
|
|
109
|
+
'tooltip',
|
|
110
|
+
'trigger',
|
|
111
|
+
'value',
|
|
112
|
+
]);
|
|
113
|
+
const scopeKeys = new Set([
|
|
114
|
+
'capital_scope',
|
|
115
|
+
'controller',
|
|
116
|
+
'faction_leader',
|
|
117
|
+
'host',
|
|
118
|
+
'occupied',
|
|
119
|
+
'occupied_country',
|
|
120
|
+
'original_country',
|
|
121
|
+
'overlord',
|
|
122
|
+
'owner',
|
|
123
|
+
'target',
|
|
124
|
+
]);
|
|
125
|
+
function catalogValues(options, kind) {
|
|
126
|
+
const values = options.references?.[kind];
|
|
127
|
+
if (values === undefined)
|
|
128
|
+
return new Set();
|
|
129
|
+
return values instanceof Set ? values : new Set(values);
|
|
130
|
+
}
|
|
131
|
+
function isFormableDecision(target, options) {
|
|
132
|
+
if (catalogValues(options, 'formable').has(target))
|
|
133
|
+
return true;
|
|
134
|
+
if (catalogValues(options, 'decision').has(target))
|
|
135
|
+
return false;
|
|
136
|
+
return /(?:^form_|formable|form_country)/iu.test(target);
|
|
137
|
+
}
|
|
138
|
+
function isEffectContainer(key) {
|
|
139
|
+
return (effectContainerKeys.has(key) ||
|
|
140
|
+
(nativeFocusEffectKeys.has(key) &&
|
|
141
|
+
/^(?:(?:global_)?every|ordered|random)_[a-z0-9_]+$/u.test(key)));
|
|
142
|
+
}
|
|
143
|
+
function isScopeKey(key, knownLeaders) {
|
|
144
|
+
const normalizedKey = key.toLowerCase();
|
|
145
|
+
return (knownLeaders.has(key) ||
|
|
146
|
+
scopeKeys.has(normalizedKey) ||
|
|
147
|
+
/^\d+$/u.test(key) ||
|
|
148
|
+
/^(?:ROOT|THIS|PREV|FROM(?:FROM)*|[A-Z][A-Z0-9]{2})$/u.test(key) ||
|
|
149
|
+
/^(?:array|character|country|division|event_target|global|global_event_target|mio|operative|province|scope|state|unit_leader|var):[a-z0-9_.-]+$/iu.test(key));
|
|
150
|
+
}
|
|
151
|
+
function sourceLocation(document, node, symbol) {
|
|
152
|
+
return nodeLocation(document, node, symbol);
|
|
153
|
+
}
|
|
154
|
+
function rawText(document, node) {
|
|
155
|
+
return document.text.slice(node.start, node.end);
|
|
156
|
+
}
|
|
157
|
+
function focusReferences(block) {
|
|
158
|
+
const references = [];
|
|
159
|
+
const walk = (current) => {
|
|
160
|
+
for (const assignment of assignments(current)) {
|
|
161
|
+
if ((assignment.key.value === 'has_completed_focus' || assignment.key.value === 'focus') &&
|
|
162
|
+
assignment.value.type === 'scalar') {
|
|
163
|
+
references.push(assignment.value.value);
|
|
164
|
+
}
|
|
165
|
+
if (assignment.value.type === 'block')
|
|
166
|
+
walk(assignment.value);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
walk(block);
|
|
170
|
+
return [...new Set(references)].sort((left, right) => compareCodeUnits(left, right));
|
|
171
|
+
}
|
|
172
|
+
function rawBlock(document, block) {
|
|
173
|
+
return {
|
|
174
|
+
text: rawText(document, block),
|
|
175
|
+
referencedFocusIds: focusReferences(block),
|
|
176
|
+
sourceLocation: sourceLocation(document, block),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function passthroughEntry(document, entry, order) {
|
|
180
|
+
return {
|
|
181
|
+
kind: entry.type,
|
|
182
|
+
...(entry.type === 'assignment' ? { key: entry.key.value } : {}),
|
|
183
|
+
order,
|
|
184
|
+
text: rawText(document, entry),
|
|
185
|
+
sourceLocation: sourceLocation(document, entry),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function scalarNumber(block, key) {
|
|
189
|
+
const value = firstScalar(block, key)?.value;
|
|
190
|
+
if (value === undefined || !/^-?(?:\d+|\d*\.\d+)$/u.test(value))
|
|
191
|
+
return undefined;
|
|
192
|
+
const numeric = Number(value);
|
|
193
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
194
|
+
}
|
|
195
|
+
function scalarBoolean(block, key) {
|
|
196
|
+
const value = firstScalar(block, key)?.value.toLowerCase();
|
|
197
|
+
if (value === 'yes' || value === 'true')
|
|
198
|
+
return true;
|
|
199
|
+
if (value === 'no' || value === 'false')
|
|
200
|
+
return false;
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function blockScalars(block) {
|
|
204
|
+
return block.entries.filter((entry) => entry.type === 'scalar').map(({ value }) => value);
|
|
205
|
+
}
|
|
206
|
+
function assignmentBlocks(block, key) {
|
|
207
|
+
return assignments(block, key).flatMap((assignment) => assignment.value.type === 'block' ? [{ assignment, block: assignment.value }] : []);
|
|
208
|
+
}
|
|
209
|
+
function prerequisiteGroups(document, block) {
|
|
210
|
+
return assignmentBlocks(block, 'prerequisite').map(({ assignment, block: prerequisite }) => ({
|
|
211
|
+
operator: 'or',
|
|
212
|
+
focusIds: assignments(prerequisite, 'focus').flatMap(({ value }) => value.type === 'scalar' ? [value.value] : []),
|
|
213
|
+
rawPassthrough: prerequisite.entries.flatMap((entry, order) => {
|
|
214
|
+
if (entry.type === 'assignment' &&
|
|
215
|
+
entry.key.value === 'focus' &&
|
|
216
|
+
entry.value.type === 'scalar')
|
|
217
|
+
return [];
|
|
218
|
+
return [passthroughEntry(document, entry, order)];
|
|
219
|
+
}),
|
|
220
|
+
sourceLocation: sourceLocation(document, assignment),
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
function mutualExclusions(block) {
|
|
224
|
+
const values = assignmentBlocks(block, 'mutually_exclusive').flatMap(({ block: exclusion }) => assignments(exclusion, 'focus').flatMap(({ value }) => value.type === 'scalar' ? [value.value] : []));
|
|
225
|
+
return [...new Set(values)].sort((left, right) => compareCodeUnits(left, right));
|
|
226
|
+
}
|
|
227
|
+
function iconDefinitions(document, block) {
|
|
228
|
+
return assignments(block, 'icon').flatMap((assignment) => {
|
|
229
|
+
if (assignment.value.type === 'scalar') {
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
kind: 'static',
|
|
233
|
+
sprite: assignment.value.value,
|
|
234
|
+
sourceLocation: sourceLocation(document, assignment, assignment.value.value),
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
const value = firstScalar(assignment.value, 'value');
|
|
239
|
+
if (value === undefined)
|
|
240
|
+
return [];
|
|
241
|
+
const trigger = assignmentBlocks(assignment.value, 'trigger')[0]?.block;
|
|
242
|
+
return [
|
|
243
|
+
{
|
|
244
|
+
kind: 'dynamic',
|
|
245
|
+
sprite: value.value,
|
|
246
|
+
...(trigger === undefined ? {} : { trigger: rawBlock(document, trigger) }),
|
|
247
|
+
sourceLocation: sourceLocation(document, assignment, value.value),
|
|
248
|
+
},
|
|
249
|
+
];
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function routeLockPredicates(block) {
|
|
253
|
+
const required = [];
|
|
254
|
+
const excluded = [];
|
|
255
|
+
let impossible = false;
|
|
256
|
+
for (const entry of block.entries) {
|
|
257
|
+
if (entry.type !== 'assignment')
|
|
258
|
+
return undefined;
|
|
259
|
+
if (entry.key.value === 'has_completed_focus' && entry.value.type === 'scalar') {
|
|
260
|
+
required.push(entry.value.value);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (entry.key.value === 'always' && entry.value.type === 'scalar') {
|
|
264
|
+
if (['no', 'false', '0'].includes(entry.value.value.toLowerCase()))
|
|
265
|
+
impossible = true;
|
|
266
|
+
else if (!['yes', 'true', '1'].includes(entry.value.value.toLowerCase()))
|
|
267
|
+
return undefined;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (entry.key.value === 'NOT' && entry.value.type === 'block') {
|
|
271
|
+
const nested = entry.value.entries;
|
|
272
|
+
if (nested.length === 0 ||
|
|
273
|
+
nested.some((candidate) => candidate.type !== 'assignment' ||
|
|
274
|
+
candidate.key.value !== 'has_completed_focus' ||
|
|
275
|
+
candidate.value.type !== 'scalar')) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
excluded.push(...nested.flatMap((candidate) => candidate.type === 'assignment' && candidate.value.type === 'scalar'
|
|
279
|
+
? [candidate.value.value]
|
|
280
|
+
: []));
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
return undefined;
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
required: [...new Set(required)].sort((left, right) => compareCodeUnits(left, right)),
|
|
287
|
+
excluded: [...new Set(excluded)].sort((left, right) => compareCodeUnits(left, right)),
|
|
288
|
+
impossible,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function structuredRouteLock(document, focusId, field, assignment, block) {
|
|
292
|
+
let mode = 'all';
|
|
293
|
+
let predicateBlock = block;
|
|
294
|
+
if (block.entries.length === 1) {
|
|
295
|
+
const entry = block.entries[0];
|
|
296
|
+
if (entry?.type === 'assignment' &&
|
|
297
|
+
(entry.key.value === 'OR' || entry.key.value === 'AND') &&
|
|
298
|
+
entry.value.type === 'block') {
|
|
299
|
+
mode = entry.key.value === 'OR' ? 'any' : 'all';
|
|
300
|
+
predicateBlock = entry.value;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const predicates = routeLockPredicates(predicateBlock);
|
|
304
|
+
if (predicates === undefined ||
|
|
305
|
+
(predicates.required.length === 0 && predicates.excluded.length === 0 && !predicates.impossible)) {
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
id: `${focusId}:${field}`,
|
|
310
|
+
field,
|
|
311
|
+
mode,
|
|
312
|
+
requiredFocusIds: predicates.required,
|
|
313
|
+
excludedFocusIds: predicates.excluded,
|
|
314
|
+
...(predicates.impossible ? { alwaysImpossible: true } : {}),
|
|
315
|
+
sourceLocation: sourceLocation(document, assignment, focusId),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function referenceTargets(assignment, specification) {
|
|
319
|
+
if (assignment.value.type === 'scalar')
|
|
320
|
+
return [assignment.value.value];
|
|
321
|
+
const targets = specification.blockScalars ? blockScalars(assignment.value) : [];
|
|
322
|
+
for (const field of specification.fields ?? []) {
|
|
323
|
+
for (const candidate of assignments(assignment.value, field)) {
|
|
324
|
+
if (candidate.value.type === 'scalar')
|
|
325
|
+
targets.push(candidate.value.value);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return [...new Set(targets)];
|
|
329
|
+
}
|
|
330
|
+
function referenceLinks(document, block, options) {
|
|
331
|
+
const links = [];
|
|
332
|
+
const knownHelpers = catalogValues(options, 'helper');
|
|
333
|
+
const knownLeaders = catalogValues(options, 'leader');
|
|
334
|
+
function recordReference(assignment, specification) {
|
|
335
|
+
for (const target of referenceTargets(assignment, specification)) {
|
|
336
|
+
const kind = specification.kind === 'decision' && isFormableDecision(target, options)
|
|
337
|
+
? 'formable'
|
|
338
|
+
: specification.kind;
|
|
339
|
+
links.push({
|
|
340
|
+
kind,
|
|
341
|
+
target,
|
|
342
|
+
sourceLocation: sourceLocation(document, assignment, target),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function effectAssignment(assignment, controls) {
|
|
347
|
+
const key = assignment.key.value;
|
|
348
|
+
const normalizedKey = key.toLowerCase();
|
|
349
|
+
if (controls.has(normalizedKey))
|
|
350
|
+
return;
|
|
351
|
+
const reference = referenceEffects.get(normalizedKey);
|
|
352
|
+
if (reference !== undefined) {
|
|
353
|
+
recordReference(assignment, reference);
|
|
354
|
+
if (assignment.value.type === 'block') {
|
|
355
|
+
for (const nested of assignments(assignment.value)) {
|
|
356
|
+
if (nested.value.type === 'block' && isEffectContainer(nested.key.value.toLowerCase())) {
|
|
357
|
+
effectAssignment(nested, new Set());
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (knownHelpers.has(key) &&
|
|
364
|
+
!effectContainerKeys.has(normalizedKey) &&
|
|
365
|
+
!nativeFocusEffectKeys.has(normalizedKey)) {
|
|
366
|
+
links.push({
|
|
367
|
+
kind: 'helper',
|
|
368
|
+
target: key,
|
|
369
|
+
sourceLocation: sourceLocation(document, assignment, key),
|
|
370
|
+
});
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (isEffectContainer(normalizedKey)) {
|
|
374
|
+
if (assignment.value.type !== 'block')
|
|
375
|
+
return;
|
|
376
|
+
if (normalizedKey === 'random_list') {
|
|
377
|
+
for (const weighted of assignments(assignment.value)) {
|
|
378
|
+
if (weighted.value.type === 'block' &&
|
|
379
|
+
!['log', 'seed'].includes(weighted.key.value.toLowerCase())) {
|
|
380
|
+
effectWalk(weighted.value, effectContainerControlKeys);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
effectWalk(assignment.value, effectContainerControlKeys);
|
|
386
|
+
}
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (nativeFocusEffectKeys.has(normalizedKey))
|
|
390
|
+
return;
|
|
391
|
+
if (assignment.value.type === 'block' && isScopeKey(key, knownLeaders)) {
|
|
392
|
+
effectWalk(assignment.value, new Set());
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
links.push({
|
|
396
|
+
kind: 'helper',
|
|
397
|
+
target: key,
|
|
398
|
+
sourceLocation: sourceLocation(document, assignment, key),
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function effectWalk(current, controls) {
|
|
402
|
+
for (const assignment of assignments(current)) {
|
|
403
|
+
effectAssignment(assignment, controls);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
effectWalk(block, new Set());
|
|
407
|
+
return links.filter((link, index, all) => all.findIndex(({ kind, target }) => kind === link.kind && target === link.target) === index);
|
|
408
|
+
}
|
|
409
|
+
function aiMetadata(document, block) {
|
|
410
|
+
const aiBlock = assignmentBlocks(block, 'ai_will_do')[0]?.block;
|
|
411
|
+
return {
|
|
412
|
+
...(aiBlock === undefined ? {} : { raw: rawBlock(document, aiBlock) }),
|
|
413
|
+
majorRoute: false,
|
|
414
|
+
strategyIds: [],
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function importFocus(document, assignment, diagnostics, ordinal, options) {
|
|
418
|
+
if (assignment.value.type !== 'block')
|
|
419
|
+
return undefined;
|
|
420
|
+
const block = assignment.value;
|
|
421
|
+
const idNode = firstScalar(block, 'id');
|
|
422
|
+
const id = idNode?.value ?? `__missing_focus_${ordinal + 1}`;
|
|
423
|
+
if (idNode === undefined) {
|
|
424
|
+
diagnostics.push({
|
|
425
|
+
code: 'FOCUS_ID_MISSING',
|
|
426
|
+
severity: 'error',
|
|
427
|
+
category: 'syntax',
|
|
428
|
+
message: 'Focus block is missing an id',
|
|
429
|
+
location: sourceLocation(document, assignment),
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
const prerequisites = prerequisiteGroups(document, block);
|
|
433
|
+
const relative = firstScalar(block, 'relative_position_id');
|
|
434
|
+
const x = scalarNumber(block, 'x');
|
|
435
|
+
const y = scalarNumber(block, 'y');
|
|
436
|
+
const position = relative !== undefined
|
|
437
|
+
? {
|
|
438
|
+
mode: 'relative',
|
|
439
|
+
x: x ?? 0,
|
|
440
|
+
y: y ?? 0,
|
|
441
|
+
relativeTo: relative.value,
|
|
442
|
+
pinned: false,
|
|
443
|
+
}
|
|
444
|
+
: x !== undefined || y !== undefined
|
|
445
|
+
? { mode: 'fixed', x: x ?? 0, y: y ?? 0, pinned: false }
|
|
446
|
+
: { mode: 'auto', pinned: false };
|
|
447
|
+
const allowBranchEntry = assignmentBlocks(block, 'allow_branch')[0];
|
|
448
|
+
const availabilityEntry = assignmentBlocks(block, 'available')[0];
|
|
449
|
+
const allowBranch = allowBranchEntry?.block;
|
|
450
|
+
const availability = availabilityEntry?.block;
|
|
451
|
+
const bypass = assignmentBlocks(block, 'bypass')[0]?.block;
|
|
452
|
+
const completionReward = assignmentBlocks(block, 'completion_reward')[0]?.block;
|
|
453
|
+
const cost = scalarNumber(block, 'cost');
|
|
454
|
+
const hidden = scalarBoolean(block, 'hidden') === true;
|
|
455
|
+
const crisis = scalarBoolean(block, 'crisis') === true;
|
|
456
|
+
for (const markerName of ['hidden', 'crisis', 'continuous']) {
|
|
457
|
+
const marker = assignments(block, markerName)[0];
|
|
458
|
+
if (marker === undefined)
|
|
459
|
+
continue;
|
|
460
|
+
const isContinuous = markerName === 'continuous';
|
|
461
|
+
diagnostics.push({
|
|
462
|
+
code: isContinuous ? 'FOCUS_INVALID_CONTINUOUS_MARKER' : 'FOCUS_INVALID_VISIBILITY_MARKER',
|
|
463
|
+
severity: 'warning',
|
|
464
|
+
category: 'syntax',
|
|
465
|
+
message: isContinuous
|
|
466
|
+
? 'continuous is not a national-focus field; define the focus inside common/continuous_focus instead'
|
|
467
|
+
: `${markerName} is planner metadata, not a national-focus field; use allow_branch plus a planning sidecar`,
|
|
468
|
+
location: sourceLocation(document, marker, id),
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
const focusIds = prerequisites.flatMap(({ focusIds: targets }) => targets);
|
|
472
|
+
const filters = assignmentBlocks(block, 'search_filters').flatMap(({ block: filterBlock }) => blockScalars(filterBlock));
|
|
473
|
+
const availabilityLock = availabilityEntry === undefined
|
|
474
|
+
? undefined
|
|
475
|
+
: structuredRouteLock(document, id, 'available', availabilityEntry.assignment, availabilityEntry.block);
|
|
476
|
+
const allowBranchLock = allowBranchEntry === undefined
|
|
477
|
+
? undefined
|
|
478
|
+
: structuredRouteLock(document, id, 'allow_branch', allowBranchEntry.assignment, allowBranchEntry.block);
|
|
479
|
+
return {
|
|
480
|
+
id,
|
|
481
|
+
label: id,
|
|
482
|
+
prerequisites: { operator: 'and', groups: prerequisites },
|
|
483
|
+
mutuallyExclusive: mutualExclusions(block),
|
|
484
|
+
routeLocks: [availabilityLock, allowBranchLock].filter((lock) => lock !== undefined),
|
|
485
|
+
...(availability === undefined || availabilityLock !== undefined
|
|
486
|
+
? {}
|
|
487
|
+
: { availability: rawBlock(document, availability) }),
|
|
488
|
+
...(bypass === undefined ? {} : { bypass: rawBlock(document, bypass) }),
|
|
489
|
+
...(allowBranch === undefined || allowBranchLock !== undefined
|
|
490
|
+
? {}
|
|
491
|
+
: { allowBranch: rawBlock(document, allowBranch) }),
|
|
492
|
+
position,
|
|
493
|
+
visibility: hidden
|
|
494
|
+
? 'hidden'
|
|
495
|
+
: crisis
|
|
496
|
+
? 'crisis'
|
|
497
|
+
: allowBranch === undefined
|
|
498
|
+
? 'normal'
|
|
499
|
+
: 'conditional',
|
|
500
|
+
...(allowBranch === undefined
|
|
501
|
+
? {}
|
|
502
|
+
: {
|
|
503
|
+
reveal: {
|
|
504
|
+
kind: 'allow_branch',
|
|
505
|
+
references: focusReferences(allowBranch),
|
|
506
|
+
...(allowBranchLock === undefined ? { trigger: rawBlock(document, allowBranch) } : {}),
|
|
507
|
+
},
|
|
508
|
+
}),
|
|
509
|
+
convergence: prerequisites.length > 1 || focusIds.length > 1,
|
|
510
|
+
sharedSupport: false,
|
|
511
|
+
icons: iconDefinitions(document, block),
|
|
512
|
+
localisation: { titleKey: id, descriptionKey: `${id}_desc` },
|
|
513
|
+
ai: aiMetadata(document, block),
|
|
514
|
+
filters: [...new Set(filters)].sort((left, right) => compareCodeUnits(left, right)),
|
|
515
|
+
links: completionReward === undefined ? [] : referenceLinks(document, completionReward, options),
|
|
516
|
+
...(cost === undefined ? {} : { cost }),
|
|
517
|
+
...(completionReward === undefined
|
|
518
|
+
? {}
|
|
519
|
+
: { completionReward: rawBlock(document, completionReward) }),
|
|
520
|
+
rawPassthrough: block.entries.flatMap((entry, order) => {
|
|
521
|
+
if (entry.type === 'assignment' && knownFocusKeys.has(entry.key.value))
|
|
522
|
+
return [];
|
|
523
|
+
return [passthroughEntry(document, entry, order)];
|
|
524
|
+
}),
|
|
525
|
+
sourceLocation: sourceLocation(document, assignment, id),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function countryAssignment(document, tree) {
|
|
529
|
+
const country = assignmentBlocks(tree, 'country')[0]?.block;
|
|
530
|
+
if (country === undefined)
|
|
531
|
+
return undefined;
|
|
532
|
+
const tags = [];
|
|
533
|
+
const walk = (block) => {
|
|
534
|
+
for (const assignment of assignments(block)) {
|
|
535
|
+
if ((assignment.key.value === 'tag' || assignment.key.value === 'original_tag') &&
|
|
536
|
+
assignment.value.type === 'scalar') {
|
|
537
|
+
tags.push(assignment.value.value);
|
|
538
|
+
}
|
|
539
|
+
if (assignment.value.type === 'block')
|
|
540
|
+
walk(assignment.value);
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
walk(country);
|
|
544
|
+
return {
|
|
545
|
+
raw: rawBlock(document, country),
|
|
546
|
+
countryTags: [...new Set(tags)].sort((left, right) => compareCodeUnits(left, right)),
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function continuousPosition(tree) {
|
|
550
|
+
const block = assignmentBlocks(tree, 'continuous_focus_position')[0]?.block;
|
|
551
|
+
if (block === undefined)
|
|
552
|
+
return undefined;
|
|
553
|
+
return { x: scalarNumber(block, 'x') ?? 0, y: scalarNumber(block, 'y') ?? 0 };
|
|
554
|
+
}
|
|
555
|
+
function importContinuousFocus(document, assignment, diagnostics, ordinal) {
|
|
556
|
+
if (assignment.value.type !== 'block')
|
|
557
|
+
return undefined;
|
|
558
|
+
const block = assignment.value;
|
|
559
|
+
const idNode = firstScalar(block, 'id');
|
|
560
|
+
const id = idNode?.value ?? `__missing_continuous_focus_${ordinal + 1}`;
|
|
561
|
+
if (idNode === undefined) {
|
|
562
|
+
diagnostics.push({
|
|
563
|
+
code: 'CONTINUOUS_FOCUS_ID_MISSING',
|
|
564
|
+
severity: 'error',
|
|
565
|
+
category: 'syntax',
|
|
566
|
+
message: 'Continuous focus block is missing an id',
|
|
567
|
+
location: sourceLocation(document, assignment),
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
id,
|
|
572
|
+
icons: iconDefinitions(document, block),
|
|
573
|
+
localisation: { titleKey: id, descriptionKey: `${id}_desc` },
|
|
574
|
+
rawPassthrough: block.entries.flatMap((entry, order) => entry.type === 'assignment' && knownContinuousFocusKeys.has(entry.key.value)
|
|
575
|
+
? []
|
|
576
|
+
: [passthroughEntry(document, entry, order)]),
|
|
577
|
+
sourceLocation: sourceLocation(document, assignment, id),
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
function palettePosition(block) {
|
|
581
|
+
const position = assignmentBlocks(block, 'position')[0]?.block;
|
|
582
|
+
return position === undefined
|
|
583
|
+
? undefined
|
|
584
|
+
: { x: scalarNumber(position, 'x') ?? 0, y: scalarNumber(position, 'y') ?? 0 };
|
|
585
|
+
}
|
|
586
|
+
function importContinuousPalette(document, assignment, diagnostics, ordinal) {
|
|
587
|
+
if (assignment.value.type !== 'block')
|
|
588
|
+
return undefined;
|
|
589
|
+
const block = assignment.value;
|
|
590
|
+
const idNode = firstScalar(block, 'id');
|
|
591
|
+
const id = idNode?.value ?? `__missing_continuous_palette_${ordinal + 1}`;
|
|
592
|
+
if (idNode === undefined) {
|
|
593
|
+
diagnostics.push({
|
|
594
|
+
code: 'CONTINUOUS_FOCUS_PALETTE_ID_MISSING',
|
|
595
|
+
severity: 'error',
|
|
596
|
+
category: 'syntax',
|
|
597
|
+
message: 'continuous_focus_palette is missing an id',
|
|
598
|
+
location: sourceLocation(document, assignment),
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
const country = countryAssignment(document, block);
|
|
602
|
+
const sourceHash = sha256Bytes(document.bytes);
|
|
603
|
+
const resetOnCivilWar = scalarBoolean(block, 'reset_on_civilwar');
|
|
604
|
+
const position = palettePosition(block);
|
|
605
|
+
const provisional = {
|
|
606
|
+
schemaVersion: FOCUS_PLAN_SCHEMA_VERSION,
|
|
607
|
+
id,
|
|
608
|
+
...(country === undefined ? {} : { countryAssignment: country }),
|
|
609
|
+
default: scalarBoolean(block, 'default') === true,
|
|
610
|
+
...(resetOnCivilWar === undefined ? {} : { resetOnCivilWar }),
|
|
611
|
+
...(position === undefined ? {} : { position }),
|
|
612
|
+
focuses: assignments(block, 'focus').flatMap((focus, focusOrdinal) => {
|
|
613
|
+
const imported = importContinuousFocus(document, focus, diagnostics, focusOrdinal);
|
|
614
|
+
return imported === undefined ? [] : [imported];
|
|
615
|
+
}),
|
|
616
|
+
rawPassthrough: block.entries.flatMap((entry, order) => entry.type === 'assignment' && knownContinuousPaletteKeys.has(entry.key.value)
|
|
617
|
+
? []
|
|
618
|
+
: [passthroughEntry(document, entry, order)]),
|
|
619
|
+
provenance: {
|
|
620
|
+
sourcePath: document.path,
|
|
621
|
+
sourceHash,
|
|
622
|
+
importedPlanHash: '',
|
|
623
|
+
},
|
|
624
|
+
sourceLocation: sourceLocation(document, assignment, id),
|
|
625
|
+
};
|
|
626
|
+
provisional.provenance.importedPlanHash = focusPlanHash(provisional);
|
|
627
|
+
return provisional;
|
|
628
|
+
}
|
|
629
|
+
function importTree(document, assignment, diagnostics, ordinal, options) {
|
|
630
|
+
if (assignment.value.type !== 'block')
|
|
631
|
+
return undefined;
|
|
632
|
+
const tree = assignment.value;
|
|
633
|
+
const idNode = firstScalar(tree, 'id');
|
|
634
|
+
const id = idNode?.value ?? `__missing_focus_tree_${ordinal + 1}`;
|
|
635
|
+
if (idNode === undefined) {
|
|
636
|
+
diagnostics.push({
|
|
637
|
+
code: 'FOCUS_TREE_ID_MISSING',
|
|
638
|
+
severity: 'error',
|
|
639
|
+
category: 'syntax',
|
|
640
|
+
message: 'Focus tree block is missing an id',
|
|
641
|
+
location: sourceLocation(document, assignment),
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
const focuses = assignments(tree, 'focus').flatMap((focus, focusOrdinal) => {
|
|
645
|
+
const imported = importFocus(document, focus, diagnostics, focusOrdinal, options);
|
|
646
|
+
return imported === undefined ? [] : [imported];
|
|
647
|
+
});
|
|
648
|
+
const entries = focuses
|
|
649
|
+
.filter(({ prerequisites }) => prerequisites.groups.length === 0)
|
|
650
|
+
.map(({ id: focusId }) => focusId);
|
|
651
|
+
const initial = assignmentBlocks(tree, 'initial_show_position')[0]?.block;
|
|
652
|
+
const assignmentForCountry = countryAssignment(document, tree);
|
|
653
|
+
const positionForContinuousFocuses = continuousPosition(tree);
|
|
654
|
+
const sourceHash = sha256Bytes(document.bytes);
|
|
655
|
+
const provisional = {
|
|
656
|
+
schemaVersion: FOCUS_PLAN_SCHEMA_VERSION,
|
|
657
|
+
id,
|
|
658
|
+
...(assignmentForCountry === undefined ? {} : { countryAssignment: assignmentForCountry }),
|
|
659
|
+
default: scalarBoolean(tree, 'default') === true,
|
|
660
|
+
branchGroups: [],
|
|
661
|
+
laneGroups: [{ id: 'default', label: 'Default', order: 0 }],
|
|
662
|
+
entryFocusIds: entries.sort((left, right) => compareCodeUnits(left, right)),
|
|
663
|
+
focuses,
|
|
664
|
+
sharedFocusIds: assignments(tree, 'shared_focus').flatMap(({ value }) => value.type === 'scalar' ? [value.value] : []),
|
|
665
|
+
continuousFocusPaletteIds: [],
|
|
666
|
+
continuousFocusIds: [],
|
|
667
|
+
...(positionForContinuousFocuses === undefined
|
|
668
|
+
? {}
|
|
669
|
+
: { continuousFocusPosition: positionForContinuousFocuses }),
|
|
670
|
+
...(initial === undefined ? {} : { initialShowPosition: rawBlock(document, initial) }),
|
|
671
|
+
rawPassthrough: tree.entries.flatMap((entry, order) => {
|
|
672
|
+
if (entry.type === 'assignment' && knownTreeKeys.has(entry.key.value))
|
|
673
|
+
return [];
|
|
674
|
+
return [passthroughEntry(document, entry, order)];
|
|
675
|
+
}),
|
|
676
|
+
provenance: {
|
|
677
|
+
sourcePath: document.path,
|
|
678
|
+
sourceHash,
|
|
679
|
+
importedPlanHash: '',
|
|
680
|
+
},
|
|
681
|
+
sourceLocation: sourceLocation(document, assignment, id),
|
|
682
|
+
};
|
|
683
|
+
provisional.provenance.importedPlanHash = focusPlanHash(provisional);
|
|
684
|
+
return provisional;
|
|
685
|
+
}
|
|
686
|
+
export function importFocusTrees(document, options = {}) {
|
|
687
|
+
const diagnostics = [...document.diagnostics];
|
|
688
|
+
const plans = assignments(document.root, 'focus_tree').flatMap((assignment, ordinal) => {
|
|
689
|
+
const plan = importTree(document, assignment, diagnostics, ordinal, options);
|
|
690
|
+
return plan === undefined ? [] : [plan];
|
|
691
|
+
});
|
|
692
|
+
if (plans.length === 0) {
|
|
693
|
+
diagnostics.push({
|
|
694
|
+
code: 'FOCUS_TREE_NOT_FOUND',
|
|
695
|
+
severity: 'warning',
|
|
696
|
+
category: 'syntax',
|
|
697
|
+
message: 'No focus_tree block was found in the source document',
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
return { plans, continuousFocusPalettes: [], diagnostics };
|
|
701
|
+
}
|
|
702
|
+
export function importContinuousFocusPalettes(document) {
|
|
703
|
+
const diagnostics = [...document.diagnostics];
|
|
704
|
+
const continuousFocusPalettes = assignments(document.root, 'continuous_focus_palette').flatMap((assignment, ordinal) => {
|
|
705
|
+
const palette = importContinuousPalette(document, assignment, diagnostics, ordinal);
|
|
706
|
+
return palette === undefined ? [] : [palette];
|
|
707
|
+
});
|
|
708
|
+
if (continuousFocusPalettes.length === 0) {
|
|
709
|
+
diagnostics.push({
|
|
710
|
+
code: 'CONTINUOUS_FOCUS_PALETTE_NOT_FOUND',
|
|
711
|
+
severity: 'warning',
|
|
712
|
+
category: 'syntax',
|
|
713
|
+
message: 'No continuous_focus_palette block was found in the source document',
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
return { plans: [], continuousFocusPalettes, diagnostics };
|
|
717
|
+
}
|
|
718
|
+
export function linkContinuousFocusPalettes(plan, palettes) {
|
|
719
|
+
const tags = new Set(plan.countryAssignment?.countryTags ?? []);
|
|
720
|
+
const matching = palettes.filter((palette) => palette.countryAssignment?.countryTags.some((tag) => tags.has(tag)) === true);
|
|
721
|
+
const selected = matching.length > 0 ? matching : palettes.filter(({ default: fallback }) => fallback);
|
|
722
|
+
const linked = structuredClone(plan);
|
|
723
|
+
linked.continuousFocusPaletteIds = selected
|
|
724
|
+
.map(({ id }) => id)
|
|
725
|
+
.sort((left, right) => compareCodeUnits(left, right));
|
|
726
|
+
linked.continuousFocusIds = [
|
|
727
|
+
...new Set(selected.flatMap(({ focuses }) => focuses.map(({ id }) => id))),
|
|
728
|
+
].sort((left, right) => compareCodeUnits(left, right));
|
|
729
|
+
linked.provenance.importedPlanHash = focusPlanHash(linked);
|
|
730
|
+
return linked;
|
|
731
|
+
}
|
|
732
|
+
//# sourceMappingURL=importer.js.map
|