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,695 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fg from 'fast-glob';
|
|
3
|
+
import { ArtifactStore, boundedSourceHashEvidence, } from '../core/artifacts.js';
|
|
4
|
+
import { canonicalJson, compareCodeUnits, hashCanonical, sha256Bytes } from '../core/canonical.js';
|
|
5
|
+
import { sortDiagnostics } from '../core/diagnostics.js';
|
|
6
|
+
import { CoreEngine } from '../core/engine.js';
|
|
7
|
+
import { RenderBudget } from '../core/render-budget.js';
|
|
8
|
+
import { WorkspaceScanner } from '../core/scanner.js';
|
|
9
|
+
import { readDependenciesFromScannedFiles, } from '../core/transactions.js';
|
|
10
|
+
import { PACKAGE_VERSION } from '../version.js';
|
|
11
|
+
import { defaultMapSelectorValue, MapWorkspaceIndex } from './model.js';
|
|
12
|
+
import { planMapOperationsAsync } from './operations.js';
|
|
13
|
+
import { renderMap, renderMapDiff, } from './render.js';
|
|
14
|
+
import { validateMapAsync } from './validation.js';
|
|
15
|
+
const provinceOperationKinds = new Set([
|
|
16
|
+
'split_province',
|
|
17
|
+
'create_province',
|
|
18
|
+
'merge_provinces',
|
|
19
|
+
'remove_province',
|
|
20
|
+
'update_province_definition',
|
|
21
|
+
'add_normal_adjacency',
|
|
22
|
+
'remove_normal_adjacency',
|
|
23
|
+
]);
|
|
24
|
+
const stateOperationKinds = new Set([
|
|
25
|
+
'move_state_provinces',
|
|
26
|
+
'update_state',
|
|
27
|
+
'split_state',
|
|
28
|
+
'create_state',
|
|
29
|
+
'merge_states',
|
|
30
|
+
...provinceOperationKinds,
|
|
31
|
+
]);
|
|
32
|
+
function normalizedDiagnosticPath(value) {
|
|
33
|
+
const normalized = value.replaceAll('\\', '/');
|
|
34
|
+
const displayPath = /^(?:mod|dependency|game|fixture):(.*)$/u.exec(normalized)?.[1];
|
|
35
|
+
const candidate = displayPath ?? normalized;
|
|
36
|
+
if (candidate.length === 0 ||
|
|
37
|
+
candidate.includes('://') ||
|
|
38
|
+
!candidate.includes('/') ||
|
|
39
|
+
candidate.startsWith('/')) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return candidate.replace(/^\.\//u, '').toLowerCase();
|
|
43
|
+
}
|
|
44
|
+
function diagnosticPaths(diagnostic) {
|
|
45
|
+
const paths = new Set();
|
|
46
|
+
const add = (value) => {
|
|
47
|
+
const normalized = normalizedDiagnosticPath(value);
|
|
48
|
+
if (normalized !== undefined)
|
|
49
|
+
paths.add(normalized);
|
|
50
|
+
};
|
|
51
|
+
if (diagnostic.location !== undefined)
|
|
52
|
+
add(diagnostic.location.path);
|
|
53
|
+
for (const related of diagnostic.related ?? [])
|
|
54
|
+
add(related.path);
|
|
55
|
+
const visit = (value) => {
|
|
56
|
+
if (typeof value === 'string') {
|
|
57
|
+
add(value);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(value)) {
|
|
61
|
+
for (const entry of value)
|
|
62
|
+
visit(entry);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (value !== null && typeof value === 'object') {
|
|
66
|
+
for (const entry of Object.values(value))
|
|
67
|
+
visit(entry);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
visit(diagnostic.details);
|
|
71
|
+
return paths;
|
|
72
|
+
}
|
|
73
|
+
function diagnosticFingerprint(diagnostic) {
|
|
74
|
+
return hashCanonical({
|
|
75
|
+
code: diagnostic.code,
|
|
76
|
+
message: diagnostic.message,
|
|
77
|
+
path: diagnostic.location === undefined
|
|
78
|
+
? null
|
|
79
|
+
: (normalizedDiagnosticPath(diagnostic.location.path) ?? diagnostic.location.path),
|
|
80
|
+
symbol: diagnostic.location?.symbol ?? null,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function operationKindsForDiagnostic(code) {
|
|
84
|
+
if (code.startsWith('MAP_BMP_') ||
|
|
85
|
+
code.startsWith('MAP_BITMAP_') ||
|
|
86
|
+
code.startsWith('MAP_PROVINCES_') ||
|
|
87
|
+
code.startsWith('MAP_DEFINITION_') ||
|
|
88
|
+
code.startsWith('MAP_PROVINCE_ID_') ||
|
|
89
|
+
code.startsWith('MAP_PROVINCE_COLOR_') ||
|
|
90
|
+
code.startsWith('MAP_PROVINCE_TOO_') ||
|
|
91
|
+
code.startsWith('MAP_PROVINCE_LARGE_') ||
|
|
92
|
+
code.startsWith('MAP_PROVINCE_DISCONNECTED_') ||
|
|
93
|
+
code.startsWith('MAP_PROVINCE_THIN_') ||
|
|
94
|
+
code.startsWith('MAP_COASTAL_') ||
|
|
95
|
+
code.startsWith('MAP_LAND_CONTINENT_') ||
|
|
96
|
+
code.startsWith('MAP_SEA_TERRAIN_') ||
|
|
97
|
+
code.startsWith('MAP_LAKE_TERRAIN_') ||
|
|
98
|
+
code.startsWith('MAP_DIMENSIONS_') ||
|
|
99
|
+
code.startsWith('MAP_AREA_') ||
|
|
100
|
+
code.startsWith('MAP_INVALID_X_') ||
|
|
101
|
+
code.startsWith('MAP_PIXELS_')) {
|
|
102
|
+
return provinceOperationKinds;
|
|
103
|
+
}
|
|
104
|
+
if (code.startsWith('MAP_STATE_') ||
|
|
105
|
+
code.startsWith('MAP_NEW_STATE_') ||
|
|
106
|
+
code.startsWith('MAP_LAND_PROVINCE_STATE_') ||
|
|
107
|
+
code.startsWith('MAP_PROVINCE_STATE_') ||
|
|
108
|
+
code.startsWith('MAP_SEA_PROVINCE_IN_STATE') ||
|
|
109
|
+
code.startsWith('MAP_LAKE_PROVINCE_IN_STATE') ||
|
|
110
|
+
code.startsWith('MAP_VICTORY_POINT_') ||
|
|
111
|
+
code.startsWith('MAP_PROVINCE_BUILDING_')) {
|
|
112
|
+
return stateOperationKinds;
|
|
113
|
+
}
|
|
114
|
+
if (code.startsWith('MAP_STRATEGIC_REGION_') ||
|
|
115
|
+
code.startsWith('MAP_REGION_') ||
|
|
116
|
+
code.startsWith('MAP_PROVINCE_REGION_')) {
|
|
117
|
+
return new Set(['move_region_provinces', ...provinceOperationKinds]);
|
|
118
|
+
}
|
|
119
|
+
if (code.startsWith('MAP_ADJACENCY_') ||
|
|
120
|
+
code.startsWith('MAP_IMPASSABLE_') ||
|
|
121
|
+
code.startsWith('MAP_SEA_ADJACENCY_')) {
|
|
122
|
+
return new Set([
|
|
123
|
+
'add_adjacency',
|
|
124
|
+
'remove_adjacency',
|
|
125
|
+
'add_normal_adjacency',
|
|
126
|
+
'remove_normal_adjacency',
|
|
127
|
+
...provinceOperationKinds,
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
if (code.startsWith('MAP_SUPPLY_NODE_'))
|
|
131
|
+
return new Set(['add_supply_node', 'remove_supply_node', ...provinceOperationKinds]);
|
|
132
|
+
if (code.startsWith('MAP_RAILWAY_'))
|
|
133
|
+
return new Set(['add_railway', 'remove_railway', ...provinceOperationKinds]);
|
|
134
|
+
if (code.startsWith('MAP_BUILDING_') || code.startsWith('MAP_PORT_'))
|
|
135
|
+
return new Set([
|
|
136
|
+
'upsert_building_position',
|
|
137
|
+
'remove_building_position',
|
|
138
|
+
...stateOperationKinds,
|
|
139
|
+
]);
|
|
140
|
+
if (code.startsWith('MAP_UNIT_POSITION_'))
|
|
141
|
+
return new Set(['upsert_unit_position', 'remove_unit_position', ...provinceOperationKinds]);
|
|
142
|
+
if (code.startsWith('MAP_WEATHER_'))
|
|
143
|
+
return new Set(['upsert_weather_position', 'remove_weather_position', 'move_region_provinces']);
|
|
144
|
+
if (code.startsWith('MAP_ENTITY_LOCATOR_'))
|
|
145
|
+
return new Set(['update_entity_locator']);
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Bind every post-operation validation error to the last manifest operation
|
|
150
|
+
* that owns its changed source. Pre-existing or otherwise unowned errors gain
|
|
151
|
+
* an explicit blocking ownership diagnostic rather than being guessed.
|
|
152
|
+
*/
|
|
153
|
+
export function attributeMapValidationDiagnostics(input) {
|
|
154
|
+
const order = new Map(input.operations.map(({ id }, index) => [id, index]));
|
|
155
|
+
const operationKinds = new Map(input.operations.map(({ id, kind }) => [id, kind]));
|
|
156
|
+
const changedOperationIds = new Set(input.changes.flatMap(({ operationIds }) => operationIds));
|
|
157
|
+
const ownersByPath = new Map();
|
|
158
|
+
for (const change of input.changes) {
|
|
159
|
+
const relativePath = change.relativePath.replaceAll('\\', '/').toLowerCase();
|
|
160
|
+
const owners = ownersByPath.get(relativePath) ?? new Set();
|
|
161
|
+
for (const operationId of change.operationIds)
|
|
162
|
+
owners.add(operationId);
|
|
163
|
+
ownersByPath.set(relativePath, owners);
|
|
164
|
+
}
|
|
165
|
+
const baselineErrors = new Set((input.baselineDiagnostics ?? [])
|
|
166
|
+
.filter(({ severity }) => severity === 'error' || severity === 'blocker')
|
|
167
|
+
.map(diagnosticFingerprint));
|
|
168
|
+
const attributed = [];
|
|
169
|
+
for (const diagnostic of input.diagnostics) {
|
|
170
|
+
if (diagnostic.operationId !== undefined ||
|
|
171
|
+
(diagnostic.severity !== 'error' && diagnostic.severity !== 'blocker')) {
|
|
172
|
+
attributed.push(diagnostic);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const fingerprint = diagnosticFingerprint(diagnostic);
|
|
176
|
+
if (baselineErrors.has(fingerprint)) {
|
|
177
|
+
attributed.push({
|
|
178
|
+
...diagnostic,
|
|
179
|
+
details: { ...diagnostic.details, attributionStatus: 'pre-existing-baseline' },
|
|
180
|
+
});
|
|
181
|
+
attributed.push({
|
|
182
|
+
code: 'MAP_VALIDATION_OPERATION_UNOWNED',
|
|
183
|
+
severity: 'blocker',
|
|
184
|
+
category: 'transaction',
|
|
185
|
+
message: `${diagnostic.code} already existed before the manifest and has no originating operation`,
|
|
186
|
+
...(diagnostic.location === undefined ? {} : { location: diagnostic.location }),
|
|
187
|
+
...(diagnostic.related === undefined ? {} : { related: diagnostic.related }),
|
|
188
|
+
details: {
|
|
189
|
+
sourceDiagnosticCode: diagnostic.code,
|
|
190
|
+
sourceDiagnosticFingerprint: fingerprint,
|
|
191
|
+
attributionStatus: 'pre-existing-baseline',
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const pathCandidates = new Set();
|
|
197
|
+
for (const diagnosticPath of diagnosticPaths(diagnostic)) {
|
|
198
|
+
for (const owner of ownersByPath.get(diagnosticPath) ?? [])
|
|
199
|
+
pathCandidates.add(owner);
|
|
200
|
+
}
|
|
201
|
+
const allowedKinds = operationKindsForDiagnostic(diagnostic.code);
|
|
202
|
+
const familyCandidates = new Set([...changedOperationIds].filter((operationId) => {
|
|
203
|
+
const kind = operationKinds.get(operationId);
|
|
204
|
+
return kind !== undefined && allowedKinds?.has(kind) === true;
|
|
205
|
+
}));
|
|
206
|
+
let candidates = pathCandidates;
|
|
207
|
+
if (pathCandidates.size > 0 && familyCandidates.size > 0) {
|
|
208
|
+
const intersection = new Set([...pathCandidates].filter((operationId) => familyCandidates.has(operationId)));
|
|
209
|
+
if (intersection.size > 0)
|
|
210
|
+
candidates = intersection;
|
|
211
|
+
}
|
|
212
|
+
else if (pathCandidates.size === 0 && familyCandidates.size > 0) {
|
|
213
|
+
candidates = familyCandidates;
|
|
214
|
+
}
|
|
215
|
+
else if (pathCandidates.size === 0 && changedOperationIds.size === 1) {
|
|
216
|
+
candidates = new Set(changedOperationIds);
|
|
217
|
+
}
|
|
218
|
+
const orderedCandidates = [...candidates].sort((left, right) => (order.get(left) ?? -1) - (order.get(right) ?? -1) || compareCodeUnits(left, right));
|
|
219
|
+
const owner = orderedCandidates.at(-1);
|
|
220
|
+
if (owner !== undefined) {
|
|
221
|
+
attributed.push({
|
|
222
|
+
...diagnostic,
|
|
223
|
+
operationId: owner,
|
|
224
|
+
details: {
|
|
225
|
+
...diagnostic.details,
|
|
226
|
+
attributionStrategy: pathCandidates.size > 0
|
|
227
|
+
? 'last-operation-owning-diagnostic-source'
|
|
228
|
+
: 'last-compatible-map-operation',
|
|
229
|
+
attributionCandidateOperationIds: orderedCandidates,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
attributed.push({
|
|
235
|
+
...diagnostic,
|
|
236
|
+
details: { ...diagnostic.details, attributionStatus: 'no-owning-operation' },
|
|
237
|
+
});
|
|
238
|
+
attributed.push({
|
|
239
|
+
code: 'MAP_VALIDATION_OPERATION_UNOWNED',
|
|
240
|
+
severity: 'blocker',
|
|
241
|
+
category: 'transaction',
|
|
242
|
+
message: `${diagnostic.code} cannot be attributed to any manifest operation`,
|
|
243
|
+
...(diagnostic.location === undefined ? {} : { location: diagnostic.location }),
|
|
244
|
+
...(diagnostic.related === undefined ? {} : { related: diagnostic.related }),
|
|
245
|
+
details: {
|
|
246
|
+
sourceDiagnosticCode: diagnostic.code,
|
|
247
|
+
sourceDiagnosticFingerprint: fingerprint,
|
|
248
|
+
attributionStatus: 'no-owning-operation',
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return sortDiagnostics(attributed);
|
|
253
|
+
}
|
|
254
|
+
function normalizeSourceRoot(value) {
|
|
255
|
+
return value.replaceAll('\\', '/').replace(/^\.\//u, '').replace(/\/$/u, '');
|
|
256
|
+
}
|
|
257
|
+
function defaultMapPatterns(roots) {
|
|
258
|
+
return roots.map.map((root) => `${normalizeSourceRoot(root)}/default.map`);
|
|
259
|
+
}
|
|
260
|
+
function sourceTextPatterns(roots) {
|
|
261
|
+
return [
|
|
262
|
+
...roots.map.flatMap((root) => {
|
|
263
|
+
const normalized = normalizeSourceRoot(root);
|
|
264
|
+
return ['map', 'csv', 'txt'].map((extension) => `${normalized}/**/*.${extension}`);
|
|
265
|
+
}),
|
|
266
|
+
...roots.states.map((root) => `${normalizeSourceRoot(root)}/**/*.txt`),
|
|
267
|
+
...roots.localisation.flatMap((root) => {
|
|
268
|
+
const normalized = normalizeSourceRoot(root);
|
|
269
|
+
return [`${normalized}/english/**/*.{yml,yaml}`, `${normalized}/*.{yml,yaml}`];
|
|
270
|
+
}),
|
|
271
|
+
'**/*.asset',
|
|
272
|
+
];
|
|
273
|
+
}
|
|
274
|
+
function provinceBitmapPatterns(defaultMaps, mapRoots) {
|
|
275
|
+
const activeByPath = new Map(defaultMaps
|
|
276
|
+
.filter(({ shadowedBy }) => shadowedBy === undefined)
|
|
277
|
+
.map((file) => [file.relativePath.replaceAll('\\', '/').toLowerCase(), file]));
|
|
278
|
+
let activeName = 'provinces.bmp';
|
|
279
|
+
for (const root of mapRoots) {
|
|
280
|
+
const relativePath = `${normalizeSourceRoot(root)}/default.map`.toLowerCase();
|
|
281
|
+
const active = activeByPath.get(relativePath);
|
|
282
|
+
if (active === undefined)
|
|
283
|
+
continue;
|
|
284
|
+
activeName = defaultMapSelectorValue(active, 'provinces', activeName);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
const names = new Set([activeName]);
|
|
288
|
+
for (const file of defaultMaps) {
|
|
289
|
+
names.add(defaultMapSelectorValue(file, 'provinces', activeName));
|
|
290
|
+
}
|
|
291
|
+
const patterns = new Set();
|
|
292
|
+
for (const root of mapRoots) {
|
|
293
|
+
const normalizedRoot = normalizeSourceRoot(root);
|
|
294
|
+
for (const name of names) {
|
|
295
|
+
const candidate = name.replaceAll('\\', '/');
|
|
296
|
+
if (candidate.trim() === '' ||
|
|
297
|
+
candidate.includes('\0') ||
|
|
298
|
+
candidate.includes(':') ||
|
|
299
|
+
path.posix.isAbsolute(candidate) ||
|
|
300
|
+
path.win32.isAbsolute(name) ||
|
|
301
|
+
candidate.split('/').includes('..'))
|
|
302
|
+
continue;
|
|
303
|
+
const normalizedName = path.posix.normalize(candidate).replace(/^\.\//u, '');
|
|
304
|
+
if (normalizedName === '.' || normalizedName === '')
|
|
305
|
+
continue;
|
|
306
|
+
const selectedPath = path.posix.normalize(path.posix.join(normalizedRoot, normalizedName));
|
|
307
|
+
if (selectedPath !== normalizedRoot && !selectedPath.startsWith(`${normalizedRoot}/`))
|
|
308
|
+
continue;
|
|
309
|
+
patterns.add(fg.posix.escapePath(selectedPath));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return [...patterns].sort((left, right) => compareCodeUnits(left, right));
|
|
313
|
+
}
|
|
314
|
+
function sourceHashes(snapshot) {
|
|
315
|
+
return Object.fromEntries(snapshot.files.map(({ displayPath, sha256 }) => [displayPath, sha256]));
|
|
316
|
+
}
|
|
317
|
+
function mapBundleWithSourceHashes(bundle, completeSourceHashes) {
|
|
318
|
+
const parsed = JSON.parse(bundle.json);
|
|
319
|
+
const json = `${canonicalJson({ ...parsed, sourceHashes: completeSourceHashes })}\n`;
|
|
320
|
+
return {
|
|
321
|
+
...bundle,
|
|
322
|
+
json,
|
|
323
|
+
hashes: { ...bundle.hashes, json: sha256Bytes(json) },
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function validationWithPlan(validation, plan) {
|
|
327
|
+
const diagnostics = sortDiagnostics([...plan.diagnostics, ...validation.diagnostics]);
|
|
328
|
+
const choicesPassed = plan.blockers.length === 0;
|
|
329
|
+
const checks = [
|
|
330
|
+
{
|
|
331
|
+
id: 'map-operation-choices',
|
|
332
|
+
passed: choicesPassed,
|
|
333
|
+
message: 'Every declarative map operation has complete, resolvable policies',
|
|
334
|
+
},
|
|
335
|
+
...validation.checks,
|
|
336
|
+
];
|
|
337
|
+
return {
|
|
338
|
+
passed: choicesPassed &&
|
|
339
|
+
validation.passed &&
|
|
340
|
+
!diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker'),
|
|
341
|
+
diagnostics,
|
|
342
|
+
checks,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
export class AgentNudger {
|
|
346
|
+
engine;
|
|
347
|
+
resolver;
|
|
348
|
+
scanner;
|
|
349
|
+
transactions;
|
|
350
|
+
artifacts;
|
|
351
|
+
constructor(engineOrResolver, transactions, artifacts = new ArtifactStore(), scanner = new WorkspaceScanner()) {
|
|
352
|
+
this.engine =
|
|
353
|
+
engineOrResolver instanceof CoreEngine
|
|
354
|
+
? engineOrResolver
|
|
355
|
+
: new CoreEngine(engineOrResolver, {
|
|
356
|
+
scanner,
|
|
357
|
+
artifacts,
|
|
358
|
+
...(transactions === undefined ? {} : { transactions }),
|
|
359
|
+
});
|
|
360
|
+
this.resolver = this.engine.resolver;
|
|
361
|
+
this.artifacts = this.engine.artifacts;
|
|
362
|
+
this.scanner = this.engine.scanner;
|
|
363
|
+
this.transactions = this.engine.transactions;
|
|
364
|
+
}
|
|
365
|
+
async scan(workspaceId, principal, signal) {
|
|
366
|
+
signal?.throwIfAborted();
|
|
367
|
+
const workspace = this.resolver.get(workspaceId, principal);
|
|
368
|
+
const sourceRoots = {
|
|
369
|
+
map: workspace.registration.roots.map,
|
|
370
|
+
states: workspace.registration.roots.states,
|
|
371
|
+
localisation: workspace.registration.roots.localisation,
|
|
372
|
+
};
|
|
373
|
+
const selectorSnapshot = await this.engine.scan(workspaceId, { patterns: defaultMapPatterns(sourceRoots) }, principal, signal);
|
|
374
|
+
const bitmapPatterns = provinceBitmapPatterns(selectorSnapshot.files, sourceRoots.map);
|
|
375
|
+
const contentSnapshot = await this.engine.scan(workspaceId, { patterns: [...sourceTextPatterns(sourceRoots), ...bitmapPatterns] }, principal, signal);
|
|
376
|
+
signal?.throwIfAborted();
|
|
377
|
+
const files = contentSnapshot.files;
|
|
378
|
+
const revision = hashCanonical(files.map(({ displayPath, loadOrder, sha256 }) => ({ displayPath, loadOrder, sha256 })));
|
|
379
|
+
return {
|
|
380
|
+
workspaceId,
|
|
381
|
+
revision,
|
|
382
|
+
files,
|
|
383
|
+
index: MapWorkspaceIndex.build(files, sourceRoots, contentSnapshot.index),
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
async validate(workspaceId, principal, signal) {
|
|
387
|
+
const snapshot = await this.scan(workspaceId, principal, signal);
|
|
388
|
+
return {
|
|
389
|
+
snapshot,
|
|
390
|
+
validation: await validateMapAsync(snapshot.index, signal === undefined ? {} : { signal }),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
async plan(input) {
|
|
394
|
+
input.signal?.throwIfAborted();
|
|
395
|
+
const snapshot = await this.scan(input.workspaceId, input.principal, input.signal);
|
|
396
|
+
const plan = await planMapOperationsAsync(snapshot.index, input.operations, input.signal);
|
|
397
|
+
const baselineValidation = await validateMapAsync(snapshot.index, input.signal === undefined ? {} : { signal: input.signal });
|
|
398
|
+
const rawValidation = await validateMapAsync(plan.finalIndex, {
|
|
399
|
+
baseline: snapshot.index,
|
|
400
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
401
|
+
...(plan.expectedChangedBounds === undefined
|
|
402
|
+
? {}
|
|
403
|
+
: { expectedChangedBounds: plan.expectedChangedBounds }),
|
|
404
|
+
});
|
|
405
|
+
const attributedValidation = {
|
|
406
|
+
...rawValidation,
|
|
407
|
+
diagnostics: attributeMapValidationDiagnostics({
|
|
408
|
+
diagnostics: rawValidation.diagnostics,
|
|
409
|
+
operations: plan.operations,
|
|
410
|
+
changes: plan.changes,
|
|
411
|
+
baselineDiagnostics: baselineValidation.diagnostics,
|
|
412
|
+
}),
|
|
413
|
+
};
|
|
414
|
+
const validation = validationWithPlan(attributedValidation, plan);
|
|
415
|
+
const transaction = await this.transactions.plan({
|
|
416
|
+
workspaceId: input.workspaceId,
|
|
417
|
+
...(input.principal === undefined ? {} : { principal: input.principal }),
|
|
418
|
+
operationKind: 'agent-nudger-map-changes',
|
|
419
|
+
operations: plan.operations,
|
|
420
|
+
changes: plan.changes,
|
|
421
|
+
readDependencies: readDependenciesFromScannedFiles(snapshot.files),
|
|
422
|
+
...(input.artifacts === undefined ? {} : { artifacts: input.artifacts }),
|
|
423
|
+
diagnostics: plan.diagnostics,
|
|
424
|
+
validate: (proposed, signal) => {
|
|
425
|
+
signal?.throwIfAborted();
|
|
426
|
+
const expected = new Map(plan.changes.map((change) => [change.relativePath, change.content]));
|
|
427
|
+
const exactProposedBytes = proposed.size === expected.size &&
|
|
428
|
+
[...proposed].every(([relativePath, content]) => {
|
|
429
|
+
const planned = expected.get(relativePath);
|
|
430
|
+
if (planned === undefined)
|
|
431
|
+
return false;
|
|
432
|
+
if (content === null || planned === null)
|
|
433
|
+
return content === planned;
|
|
434
|
+
return Buffer.from(content).equals(Buffer.from(planned));
|
|
435
|
+
});
|
|
436
|
+
const diagnostics = exactProposedBytes
|
|
437
|
+
? validation.diagnostics
|
|
438
|
+
: [
|
|
439
|
+
...validation.diagnostics,
|
|
440
|
+
{
|
|
441
|
+
code: 'MAP_TRANSACTION_BYTES_MISMATCH',
|
|
442
|
+
severity: 'blocker',
|
|
443
|
+
category: 'transaction',
|
|
444
|
+
message: 'Transaction dry-run bytes differ from the validated map operation plan',
|
|
445
|
+
},
|
|
446
|
+
];
|
|
447
|
+
return Promise.resolve({
|
|
448
|
+
diagnostics,
|
|
449
|
+
checks: [
|
|
450
|
+
{
|
|
451
|
+
id: 'map-proposed-bytes-match',
|
|
452
|
+
passed: exactProposedBytes,
|
|
453
|
+
message: exactProposedBytes
|
|
454
|
+
? 'Transaction bytes exactly match the validated in-memory map plan'
|
|
455
|
+
: 'Transaction bytes differ from the validated in-memory map plan',
|
|
456
|
+
},
|
|
457
|
+
...validation.checks,
|
|
458
|
+
],
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
462
|
+
});
|
|
463
|
+
return { transaction, plan, validation };
|
|
464
|
+
}
|
|
465
|
+
async renderAndStore(workspaceId, options = {}) {
|
|
466
|
+
const snapshot = await this.scan(workspaceId, options.principal, options.signal);
|
|
467
|
+
const rawBundle = await renderMap(snapshot.index, {
|
|
468
|
+
...options,
|
|
469
|
+
budget: options.budget ?? new RenderBudget(),
|
|
470
|
+
});
|
|
471
|
+
const completeSourceHashes = sourceHashes(snapshot);
|
|
472
|
+
const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
|
|
473
|
+
const bundle = mapBundleWithSourceHashes(rawBundle, completeSourceHashes);
|
|
474
|
+
const workspace = this.resolver.get(workspaceId, options.principal);
|
|
475
|
+
const layer = options.layer ?? 'province';
|
|
476
|
+
const provenance = {
|
|
477
|
+
kind: 'map-render',
|
|
478
|
+
toolVersion: PACKAGE_VERSION,
|
|
479
|
+
schemaVersion: 'map-render.v1',
|
|
480
|
+
sourceHashes: sourceEvidence.sourceHashes,
|
|
481
|
+
renderProfile: {
|
|
482
|
+
offline: true,
|
|
483
|
+
layer,
|
|
484
|
+
overlays: [...new Set(options.overlays ?? [])].sort(),
|
|
485
|
+
scale: options.scale ?? 1,
|
|
486
|
+
},
|
|
487
|
+
metadata: { sourceHashInventory: sourceEvidence.inventory },
|
|
488
|
+
};
|
|
489
|
+
const writes = [
|
|
490
|
+
{
|
|
491
|
+
name: `map-${layer}.png`,
|
|
492
|
+
mimeType: 'image/png',
|
|
493
|
+
content: bundle.png,
|
|
494
|
+
provenance,
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: `map-${layer}.json`,
|
|
498
|
+
mimeType: 'application/json',
|
|
499
|
+
content: bundle.json,
|
|
500
|
+
provenance,
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: `map-${layer}.html`,
|
|
504
|
+
mimeType: 'text/html',
|
|
505
|
+
content: bundle.html,
|
|
506
|
+
provenance,
|
|
507
|
+
},
|
|
508
|
+
];
|
|
509
|
+
const artifacts = await this.artifacts.withAtomicChunkedWrites(workspace, writes, (stored) => Promise.resolve([...stored]), options.signal);
|
|
510
|
+
return {
|
|
511
|
+
bundle,
|
|
512
|
+
artifacts,
|
|
513
|
+
revision: snapshot.revision,
|
|
514
|
+
filesScanned: snapshot.files.map(({ displayPath }) => displayPath),
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
async renderDiffAndStore(workspaceId, operations, options = {}) {
|
|
518
|
+
const budget = new RenderBudget();
|
|
519
|
+
const snapshot = await this.scan(workspaceId, options.principal, options.signal);
|
|
520
|
+
const plan = await planMapOperationsAsync(snapshot.index, operations, options.signal);
|
|
521
|
+
const baselineValidation = await validateMapAsync(snapshot.index, options.signal === undefined ? {} : { signal: options.signal });
|
|
522
|
+
const rawValidation = await validateMapAsync(plan.finalIndex, {
|
|
523
|
+
baseline: snapshot.index,
|
|
524
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
525
|
+
...(plan.expectedChangedBounds === undefined
|
|
526
|
+
? {}
|
|
527
|
+
: { expectedChangedBounds: plan.expectedChangedBounds }),
|
|
528
|
+
});
|
|
529
|
+
const validation = validationWithPlan({
|
|
530
|
+
...rawValidation,
|
|
531
|
+
diagnostics: attributeMapValidationDiagnostics({
|
|
532
|
+
diagnostics: rawValidation.diagnostics,
|
|
533
|
+
operations: plan.operations,
|
|
534
|
+
changes: plan.changes,
|
|
535
|
+
baselineDiagnostics: baselineValidation.diagnostics,
|
|
536
|
+
}),
|
|
537
|
+
}, plan);
|
|
538
|
+
const review = {
|
|
539
|
+
operationIds: plan.operations.map(({ id }) => id),
|
|
540
|
+
affectedFiles: plan.changes.map(({ relativePath, operationIds, mediaType, content }) => ({
|
|
541
|
+
relativePath,
|
|
542
|
+
operationIds: [...operationIds],
|
|
543
|
+
...(mediaType === undefined ? {} : { mediaType }),
|
|
544
|
+
deletion: content === null,
|
|
545
|
+
})),
|
|
546
|
+
unresolvedChoices: plan.blockers.map(({ code, message, operationId, details }) => ({
|
|
547
|
+
code,
|
|
548
|
+
message,
|
|
549
|
+
operationId,
|
|
550
|
+
...(details === undefined ? {} : { details }),
|
|
551
|
+
})),
|
|
552
|
+
allocations: plan.allocations,
|
|
553
|
+
validation,
|
|
554
|
+
};
|
|
555
|
+
const comparisonOverlays = [
|
|
556
|
+
'adjacencies',
|
|
557
|
+
'building-positions',
|
|
558
|
+
'coastlines',
|
|
559
|
+
'ports',
|
|
560
|
+
'province-buildings',
|
|
561
|
+
'railways',
|
|
562
|
+
'resources',
|
|
563
|
+
'state-buildings',
|
|
564
|
+
'supply-nodes',
|
|
565
|
+
'unit-positions',
|
|
566
|
+
'victory-points',
|
|
567
|
+
'weather-positions',
|
|
568
|
+
];
|
|
569
|
+
const [rawBundle, rawBeforeBundle, rawProposedBundle] = await Promise.all([
|
|
570
|
+
renderMapDiff(snapshot.index, plan.finalIndex, {
|
|
571
|
+
...(options.scale === undefined ? {} : { scale: options.scale }),
|
|
572
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
573
|
+
budget,
|
|
574
|
+
review,
|
|
575
|
+
}),
|
|
576
|
+
renderMap(snapshot.index, {
|
|
577
|
+
layer: 'state',
|
|
578
|
+
overlays: [...comparisonOverlays],
|
|
579
|
+
...(options.scale === undefined ? {} : { scale: options.scale }),
|
|
580
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
581
|
+
budget,
|
|
582
|
+
}),
|
|
583
|
+
renderMap(plan.finalIndex, {
|
|
584
|
+
layer: 'state',
|
|
585
|
+
overlays: [...comparisonOverlays],
|
|
586
|
+
...(options.scale === undefined ? {} : { scale: options.scale }),
|
|
587
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
588
|
+
budget,
|
|
589
|
+
}),
|
|
590
|
+
]);
|
|
591
|
+
const completeSourceHashes = sourceHashes(snapshot);
|
|
592
|
+
const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
|
|
593
|
+
const bundle = mapBundleWithSourceHashes(rawBundle, completeSourceHashes);
|
|
594
|
+
const beforeBundle = mapBundleWithSourceHashes(rawBeforeBundle, completeSourceHashes);
|
|
595
|
+
const proposedBundle = mapBundleWithSourceHashes(rawProposedBundle, completeSourceHashes);
|
|
596
|
+
const workspace = this.resolver.get(workspaceId, options.principal);
|
|
597
|
+
const provenance = {
|
|
598
|
+
kind: 'map-diff-render',
|
|
599
|
+
toolVersion: PACKAGE_VERSION,
|
|
600
|
+
schemaVersion: 'map-diff.v1',
|
|
601
|
+
sourceHashes: sourceEvidence.sourceHashes,
|
|
602
|
+
renderProfile: { offline: true, scale: options.scale ?? 1 },
|
|
603
|
+
metadata: {
|
|
604
|
+
sourceHashInventory: sourceEvidence.inventory,
|
|
605
|
+
operationIds: operations.map(({ id }) => id).sort(),
|
|
606
|
+
blockers: plan.blockers.map(({ code, operationId }) => ({ code, operationId })),
|
|
607
|
+
binding: 'artifact links and content hashes are included in the transaction plan hash',
|
|
608
|
+
},
|
|
609
|
+
};
|
|
610
|
+
const comparisonProvenance = (phase) => ({
|
|
611
|
+
...provenance,
|
|
612
|
+
kind: 'map-comparison-render',
|
|
613
|
+
schemaVersion: 'map-render.v1',
|
|
614
|
+
renderProfile: {
|
|
615
|
+
offline: true,
|
|
616
|
+
phase,
|
|
617
|
+
layer: 'state',
|
|
618
|
+
overlays: comparisonOverlays,
|
|
619
|
+
scale: options.scale ?? 1,
|
|
620
|
+
},
|
|
621
|
+
metadata: {
|
|
622
|
+
...provenance.metadata,
|
|
623
|
+
phase,
|
|
624
|
+
proposedFiles: plan.changes.map(({ relativePath }) => relativePath).sort(),
|
|
625
|
+
},
|
|
626
|
+
});
|
|
627
|
+
const writes = [
|
|
628
|
+
{
|
|
629
|
+
name: 'map-diff.png',
|
|
630
|
+
mimeType: 'image/png',
|
|
631
|
+
content: bundle.png,
|
|
632
|
+
provenance,
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: 'map-diff.json',
|
|
636
|
+
mimeType: 'application/json',
|
|
637
|
+
content: bundle.json,
|
|
638
|
+
provenance,
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: 'map-diff.html',
|
|
642
|
+
mimeType: 'text/html',
|
|
643
|
+
content: bundle.html,
|
|
644
|
+
provenance,
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: 'map-before.png',
|
|
648
|
+
mimeType: 'image/png',
|
|
649
|
+
content: beforeBundle.png,
|
|
650
|
+
provenance: comparisonProvenance('before'),
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
name: 'map-before.json',
|
|
654
|
+
mimeType: 'application/json',
|
|
655
|
+
content: beforeBundle.json,
|
|
656
|
+
provenance: comparisonProvenance('before'),
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
name: 'map-before.html',
|
|
660
|
+
mimeType: 'text/html',
|
|
661
|
+
content: beforeBundle.html,
|
|
662
|
+
provenance: comparisonProvenance('before'),
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: 'map-proposed.png',
|
|
666
|
+
mimeType: 'image/png',
|
|
667
|
+
content: proposedBundle.png,
|
|
668
|
+
provenance: comparisonProvenance('proposed'),
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: 'map-proposed.json',
|
|
672
|
+
mimeType: 'application/json',
|
|
673
|
+
content: proposedBundle.json,
|
|
674
|
+
provenance: comparisonProvenance('proposed'),
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
name: 'map-proposed.html',
|
|
678
|
+
mimeType: 'text/html',
|
|
679
|
+
content: proposedBundle.html,
|
|
680
|
+
provenance: comparisonProvenance('proposed'),
|
|
681
|
+
},
|
|
682
|
+
];
|
|
683
|
+
const artifacts = await this.artifacts.withAtomicChunkedWrites(workspace, writes, (stored) => Promise.resolve([...stored]), options.signal);
|
|
684
|
+
return {
|
|
685
|
+
bundle,
|
|
686
|
+
beforeBundle,
|
|
687
|
+
proposedBundle,
|
|
688
|
+
plan,
|
|
689
|
+
artifacts,
|
|
690
|
+
revision: snapshot.revision,
|
|
691
|
+
filesScanned: snapshot.files.map(({ displayPath }) => displayPath),
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
//# sourceMappingURL=service.js.map
|