hoi4-agent-tools 0.0.0-bootstrap.1 → 0.1.3
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 +50 -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 +69 -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 +200 -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,629 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { create as createFont } from 'fontkit';
|
|
3
|
+
import sharp from 'sharp';
|
|
4
|
+
import { compareCodeUnits, hashCanonical } from '../core/canonical.js';
|
|
5
|
+
import { RenderBudget, RENDER_MAX_DECODED_PIXELS } from '../core/render-budget.js';
|
|
6
|
+
import { ServiceError } from '../core/result.js';
|
|
7
|
+
import { DETERMINISTIC_TOOL_FONT_HASH, shapeFontkitOutline } from '../core/svg-text.js';
|
|
8
|
+
import { decodeDds } from './dds.js';
|
|
9
|
+
import { GUI_BMFONT_MAX_CHARACTERS, GUI_BINARY_FONT_MAX_BYTES, GUI_BMFONT_MAX_BYTES, GUI_BMFONT_MAX_FIELDS_PER_RECORD, GUI_BMFONT_MAX_KERNING_PAIRS, GUI_BMFONT_MAX_PAGES, GUI_BMFONT_MAX_RECORDS, GUI_TEXT_MAX_CHARACTERS, GUI_TEXT_MAX_MISSING_GLYPH_SAMPLES, } from './limits.js';
|
|
10
|
+
import { decodeTga } from './tga.js';
|
|
11
|
+
function normalizeAssetPath(value) {
|
|
12
|
+
return value
|
|
13
|
+
.replaceAll('\\', '/')
|
|
14
|
+
.replace(/^\/+|^\.\//u, '')
|
|
15
|
+
.toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
function parseFields(line) {
|
|
18
|
+
const result = {};
|
|
19
|
+
let fields = 0;
|
|
20
|
+
for (const match of line.matchAll(/([A-Za-z][A-Za-z0-9]*)=(?:"([^"]*)"|(-?\d+))/gu)) {
|
|
21
|
+
fields += 1;
|
|
22
|
+
if (fields > GUI_BMFONT_MAX_FIELDS_PER_RECORD) {
|
|
23
|
+
throw new ServiceError('GUI_FONT_FIELD_BUDGET_BLOCKED', 'BMFont record exceeds the fixed field ceiling', { fields, maximumFieldsPerRecord: GUI_BMFONT_MAX_FIELDS_PER_RECORD });
|
|
24
|
+
}
|
|
25
|
+
const key = match[1];
|
|
26
|
+
const quoted = match[2];
|
|
27
|
+
const numeric = match[3];
|
|
28
|
+
if (key !== undefined) {
|
|
29
|
+
const value = quoted ?? Number(numeric);
|
|
30
|
+
if (typeof value === 'number' && !Number.isSafeInteger(value)) {
|
|
31
|
+
throw new ServiceError('GUI_FONT_FIELD_INVALID', 'BMFont numeric fields must be safe integers', { field: key });
|
|
32
|
+
}
|
|
33
|
+
result[key] = value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export function parseBmFont(text) {
|
|
39
|
+
if (Buffer.byteLength(text, 'utf8') > GUI_BMFONT_MAX_BYTES) {
|
|
40
|
+
throw new ServiceError('GUI_FONT_BYTES_BLOCKED', 'BMFont source exceeds the fixed 2 MiB admission ceiling', { maximumBytes: GUI_BMFONT_MAX_BYTES });
|
|
41
|
+
}
|
|
42
|
+
let size = 16;
|
|
43
|
+
let lineHeight = 16;
|
|
44
|
+
let base;
|
|
45
|
+
const pages = new Map();
|
|
46
|
+
const characters = new Map();
|
|
47
|
+
const kerning = new Map();
|
|
48
|
+
let recognised = false;
|
|
49
|
+
let cursor = 0;
|
|
50
|
+
let records = 0;
|
|
51
|
+
while (cursor <= text.length) {
|
|
52
|
+
records += 1;
|
|
53
|
+
if (records > GUI_BMFONT_MAX_RECORDS) {
|
|
54
|
+
throw new ServiceError('GUI_FONT_RECORD_BUDGET_BLOCKED', 'BMFont source exceeds the fixed record ceiling', { records, maximumRecords: GUI_BMFONT_MAX_RECORDS });
|
|
55
|
+
}
|
|
56
|
+
const next = text.indexOf('\n', cursor);
|
|
57
|
+
const rawLine = text.slice(cursor, next < 0 ? text.length : next).replace(/\r$/u, '');
|
|
58
|
+
const line = rawLine.trim();
|
|
59
|
+
if (line.startsWith('info ')) {
|
|
60
|
+
const fields = parseFields(line);
|
|
61
|
+
size = Math.abs(typeof fields.size === 'number' ? fields.size : size);
|
|
62
|
+
recognised = true;
|
|
63
|
+
}
|
|
64
|
+
else if (line.startsWith('common ')) {
|
|
65
|
+
const fields = parseFields(line);
|
|
66
|
+
lineHeight = typeof fields.lineHeight === 'number' ? fields.lineHeight : lineHeight;
|
|
67
|
+
base = typeof fields.base === 'number' ? fields.base : base;
|
|
68
|
+
recognised = true;
|
|
69
|
+
}
|
|
70
|
+
else if (line.startsWith('page ')) {
|
|
71
|
+
const fields = parseFields(line);
|
|
72
|
+
const id = typeof fields.id === 'number' ? fields.id : pages.size;
|
|
73
|
+
if (!Number.isSafeInteger(id) || id < 0 || id >= GUI_BMFONT_MAX_PAGES) {
|
|
74
|
+
throw new ServiceError('GUI_FONT_PAGE_BUDGET_BLOCKED', 'BMFont page id exceeds the fixed page-map ceiling', { pageId: id, maximumPages: GUI_BMFONT_MAX_PAGES });
|
|
75
|
+
}
|
|
76
|
+
if (typeof fields.file === 'string') {
|
|
77
|
+
if (!pages.has(id) && pages.size >= GUI_BMFONT_MAX_PAGES) {
|
|
78
|
+
throw new ServiceError('GUI_FONT_PAGE_BUDGET_BLOCKED', 'BMFont source exceeds the fixed page-map ceiling', { pages: pages.size + 1, maximumPages: GUI_BMFONT_MAX_PAGES });
|
|
79
|
+
}
|
|
80
|
+
pages.set(id, fields.file);
|
|
81
|
+
}
|
|
82
|
+
recognised = true;
|
|
83
|
+
}
|
|
84
|
+
else if (line.startsWith('char ')) {
|
|
85
|
+
const fields = parseFields(line);
|
|
86
|
+
const id = fields.id;
|
|
87
|
+
if (typeof id === 'number' && Number.isSafeInteger(id) && id >= 0 && id <= 0x10ffff) {
|
|
88
|
+
if (!characters.has(id) && characters.size >= GUI_BMFONT_MAX_CHARACTERS) {
|
|
89
|
+
throw new ServiceError('GUI_FONT_CHARACTER_BUDGET_BLOCKED', 'BMFont source exceeds the fixed character-map ceiling', {
|
|
90
|
+
characters: characters.size + 1,
|
|
91
|
+
maximumCharacters: GUI_BMFONT_MAX_CHARACTERS,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
characters.set(id, {
|
|
95
|
+
id,
|
|
96
|
+
x: typeof fields.x === 'number' ? fields.x : 0,
|
|
97
|
+
y: typeof fields.y === 'number' ? fields.y : 0,
|
|
98
|
+
width: typeof fields.width === 'number' ? fields.width : 0,
|
|
99
|
+
height: typeof fields.height === 'number' ? fields.height : 0,
|
|
100
|
+
xOffset: typeof fields.xoffset === 'number' ? fields.xoffset : 0,
|
|
101
|
+
yOffset: typeof fields.yoffset === 'number' ? fields.yoffset : 0,
|
|
102
|
+
xAdvance: typeof fields.xadvance === 'number'
|
|
103
|
+
? fields.xadvance
|
|
104
|
+
: typeof fields.width === 'number'
|
|
105
|
+
? fields.width
|
|
106
|
+
: 0,
|
|
107
|
+
page: typeof fields.page === 'number' ? fields.page : 0,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
recognised = true;
|
|
111
|
+
}
|
|
112
|
+
else if (line.startsWith('kerning ')) {
|
|
113
|
+
const fields = parseFields(line);
|
|
114
|
+
if (typeof fields.first === 'number' && typeof fields.second === 'number') {
|
|
115
|
+
const key = `${fields.first}:${fields.second}`;
|
|
116
|
+
if (!kerning.has(key) && kerning.size >= GUI_BMFONT_MAX_KERNING_PAIRS) {
|
|
117
|
+
throw new ServiceError('GUI_FONT_KERNING_BUDGET_BLOCKED', 'BMFont source exceeds the fixed kerning-map ceiling', {
|
|
118
|
+
kerningPairs: kerning.size + 1,
|
|
119
|
+
maximumKerningPairs: GUI_BMFONT_MAX_KERNING_PAIRS,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
kerning.set(key, typeof fields.amount === 'number' ? fields.amount : 0);
|
|
123
|
+
}
|
|
124
|
+
recognised = true;
|
|
125
|
+
}
|
|
126
|
+
if (next < 0)
|
|
127
|
+
break;
|
|
128
|
+
cursor = next + 1;
|
|
129
|
+
}
|
|
130
|
+
return recognised
|
|
131
|
+
? {
|
|
132
|
+
size: Math.max(1, size),
|
|
133
|
+
lineHeight: Math.max(1, lineHeight),
|
|
134
|
+
base: Math.max(0, base ?? Math.min(size, lineHeight)),
|
|
135
|
+
baseDeclared: base !== undefined,
|
|
136
|
+
pages: [...pages.entries()].sort(([left], [right]) => left - right).map(([, page]) => page),
|
|
137
|
+
characters,
|
|
138
|
+
kerning,
|
|
139
|
+
}
|
|
140
|
+
: undefined;
|
|
141
|
+
}
|
|
142
|
+
function selectFont(value) {
|
|
143
|
+
return 'fonts' in value ? value.fonts[0] : value;
|
|
144
|
+
}
|
|
145
|
+
export class GuiAssetCatalog {
|
|
146
|
+
graph;
|
|
147
|
+
budget;
|
|
148
|
+
files = new Map();
|
|
149
|
+
basenames = new Map();
|
|
150
|
+
rasters = new Map();
|
|
151
|
+
frames = new Map();
|
|
152
|
+
glyphRasters = new Map();
|
|
153
|
+
metrics = new Map();
|
|
154
|
+
fontDefinitions = new Map();
|
|
155
|
+
constructor(graph, scannedFiles, budget = new RenderBudget()) {
|
|
156
|
+
this.graph = graph;
|
|
157
|
+
this.budget = budget;
|
|
158
|
+
for (const file of scannedFiles
|
|
159
|
+
.filter((candidate) => candidate.shadowedBy === undefined)
|
|
160
|
+
.sort((left, right) => compareCodeUnits(left.relativePath, right.relativePath))) {
|
|
161
|
+
const normalized = normalizeAssetPath(file.relativePath);
|
|
162
|
+
this.files.set(normalized, file);
|
|
163
|
+
const basename = path.posix.basename(normalized);
|
|
164
|
+
const candidates = this.basenames.get(basename) ?? [];
|
|
165
|
+
candidates.push(file);
|
|
166
|
+
this.basenames.set(basename, candidates);
|
|
167
|
+
}
|
|
168
|
+
for (const definition of graph.fonts)
|
|
169
|
+
this.fontDefinitions.set(definition.name.toLowerCase(), definition);
|
|
170
|
+
}
|
|
171
|
+
resolveFile(assetPath, relativeTo) {
|
|
172
|
+
const normalized = normalizeAssetPath(assetPath);
|
|
173
|
+
const normalizedCandidates = path.posix.extname(normalized).length === 0
|
|
174
|
+
? [normalized, `${normalized}.fnt`, `${normalized}.ttf`, `${normalized}.otf`]
|
|
175
|
+
: [normalized];
|
|
176
|
+
for (const candidatePath of normalizedCandidates) {
|
|
177
|
+
const direct = this.files.get(candidatePath);
|
|
178
|
+
if (direct !== undefined)
|
|
179
|
+
return direct;
|
|
180
|
+
}
|
|
181
|
+
if (relativeTo !== undefined) {
|
|
182
|
+
for (const candidatePath of normalizedCandidates) {
|
|
183
|
+
const relative = normalizeAssetPath(path.posix.join(path.posix.dirname(normalizeAssetPath(relativeTo)), candidatePath));
|
|
184
|
+
const candidate = this.files.get(relative);
|
|
185
|
+
if (candidate !== undefined)
|
|
186
|
+
return candidate;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
for (const candidatePath of normalizedCandidates) {
|
|
190
|
+
const candidates = this.basenames.get(path.posix.basename(candidatePath));
|
|
191
|
+
if (candidates?.length === 1)
|
|
192
|
+
return candidates[0];
|
|
193
|
+
}
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
async loadRaster(assetPath, relativeTo) {
|
|
197
|
+
const file = this.resolveFile(assetPath, relativeTo);
|
|
198
|
+
if (file === undefined)
|
|
199
|
+
return {
|
|
200
|
+
width: 0,
|
|
201
|
+
height: 0,
|
|
202
|
+
data: Buffer.alloc(0),
|
|
203
|
+
format: path.extname(assetPath).slice(1).toLowerCase() || 'unknown',
|
|
204
|
+
supported: false,
|
|
205
|
+
reason: `Texture not found: ${assetPath}`,
|
|
206
|
+
};
|
|
207
|
+
const key = `${file.displayPath}:${file.sha256}`;
|
|
208
|
+
let promise = this.rasters.get(key);
|
|
209
|
+
if (promise === undefined) {
|
|
210
|
+
this.budget.reserveRasterOperation(`gui-raster:${key}`, `GUI asset decode ${file.displayPath}`);
|
|
211
|
+
promise = this.decodeRaster(file);
|
|
212
|
+
this.rasters.set(key, promise);
|
|
213
|
+
}
|
|
214
|
+
return promise;
|
|
215
|
+
}
|
|
216
|
+
loadSpriteFrame(sprite, requestedFrame) {
|
|
217
|
+
const texturePath = sprite.texturePath;
|
|
218
|
+
if (texturePath === undefined)
|
|
219
|
+
return Promise.resolve(undefined);
|
|
220
|
+
const frameCount = Math.max(1, sprite.frameCount);
|
|
221
|
+
const frame = Math.max(0, Math.min(frameCount - 1, Math.trunc(requestedFrame)));
|
|
222
|
+
const key = `${sprite.id}:${texturePath}:${frameCount}:${frame}`;
|
|
223
|
+
let promise = this.frames.get(key);
|
|
224
|
+
if (promise === undefined) {
|
|
225
|
+
promise = this.decodeSpriteFrame(sprite, texturePath, frameCount, frame, key);
|
|
226
|
+
this.frames.set(key, promise);
|
|
227
|
+
}
|
|
228
|
+
return promise;
|
|
229
|
+
}
|
|
230
|
+
async decodeSpriteFrame(sprite, texturePath, frameCount, frame, operationKey) {
|
|
231
|
+
const raster = await this.loadRaster(texturePath, sprite.sourcePath);
|
|
232
|
+
if (!raster.supported || raster.width === 0 || raster.height === 0) {
|
|
233
|
+
return {
|
|
234
|
+
spriteName: sprite.name,
|
|
235
|
+
texturePath,
|
|
236
|
+
frame,
|
|
237
|
+
frameCount,
|
|
238
|
+
width: raster.width,
|
|
239
|
+
height: raster.height,
|
|
240
|
+
format: raster.format,
|
|
241
|
+
supported: false,
|
|
242
|
+
...(raster.reason === undefined ? {} : { reason: raster.reason }),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (raster.width % frameCount !== 0) {
|
|
246
|
+
return {
|
|
247
|
+
spriteName: sprite.name,
|
|
248
|
+
texturePath,
|
|
249
|
+
frame,
|
|
250
|
+
frameCount,
|
|
251
|
+
width: raster.width,
|
|
252
|
+
height: raster.height,
|
|
253
|
+
format: raster.format,
|
|
254
|
+
supported: false,
|
|
255
|
+
reason: `Horizontal frame strip width ${raster.width} is not divisible by noOfFrames ${frameCount}.`,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const frameWidth = raster.width / frameCount;
|
|
259
|
+
this.budget.reserveRasterOperation(`gui-sprite-frame:${operationKey}`, `GUI sprite frame rasterization ${sprite.name}`);
|
|
260
|
+
this.budget.reserve(raster.width, raster.height, `GUI texture Sharp plane ${texturePath}`, {
|
|
261
|
+
maximumPixels: RENDER_MAX_DECODED_PIXELS,
|
|
262
|
+
});
|
|
263
|
+
this.budget.reserve(frameWidth, raster.height, `GUI sprite frame ${sprite.name}`, {
|
|
264
|
+
maximumPixels: RENDER_MAX_DECODED_PIXELS,
|
|
265
|
+
});
|
|
266
|
+
const png = await sharp(raster.data, {
|
|
267
|
+
raw: { width: raster.width, height: raster.height, channels: 4 },
|
|
268
|
+
limitInputPixels: RENDER_MAX_DECODED_PIXELS,
|
|
269
|
+
})
|
|
270
|
+
.extract({ left: frame * frameWidth, top: 0, width: frameWidth, height: raster.height })
|
|
271
|
+
.png({ compressionLevel: 9, adaptiveFiltering: false, palette: false })
|
|
272
|
+
.toBuffer();
|
|
273
|
+
return {
|
|
274
|
+
spriteName: sprite.name,
|
|
275
|
+
texturePath,
|
|
276
|
+
frame,
|
|
277
|
+
frameCount,
|
|
278
|
+
width: frameWidth,
|
|
279
|
+
height: raster.height,
|
|
280
|
+
dataUri: `data:image/png;base64,${png.toString('base64')}`,
|
|
281
|
+
format: raster.format,
|
|
282
|
+
supported: true,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
measureText(fontName, text, fontSize) {
|
|
286
|
+
if (text.length > GUI_TEXT_MAX_CHARACTERS) {
|
|
287
|
+
throw new ServiceError('GUI_TEXT_BUDGET_BLOCKED', 'GUI text measurement exceeds the fixed character ceiling', { characters: text.length, maximumCharacters: GUI_TEXT_MAX_CHARACTERS });
|
|
288
|
+
}
|
|
289
|
+
const safeSize = Math.max(1, fontSize);
|
|
290
|
+
const entry = fontName === undefined ? undefined : this.loadFontMetrics(fontName);
|
|
291
|
+
if (entry?.kind === 'fontkit' && entry.font !== undefined) {
|
|
292
|
+
const run = entry.font.layout(text);
|
|
293
|
+
const missingGlyphs = this.missingFontkitCodePoints(entry.font, text);
|
|
294
|
+
const scale = safeSize / entry.font.unitsPerEm;
|
|
295
|
+
return {
|
|
296
|
+
width: run.advanceWidth * scale,
|
|
297
|
+
lineHeight: (entry.font.ascent - entry.font.descent + entry.font.lineGap) * scale,
|
|
298
|
+
source: 'fontkit',
|
|
299
|
+
missingGlyphs,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
if (entry?.kind === 'bmfont' && entry.bmfont !== undefined) {
|
|
303
|
+
const scale = safeSize / entry.bmfont.size;
|
|
304
|
+
let width = 0;
|
|
305
|
+
let previous;
|
|
306
|
+
const missingGlyphs = [];
|
|
307
|
+
for (const character of text) {
|
|
308
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
309
|
+
const metric = entry.bmfont.characters.get(codePoint);
|
|
310
|
+
if (metric === undefined) {
|
|
311
|
+
if (missingGlyphs.length < GUI_TEXT_MAX_MISSING_GLYPH_SAMPLES &&
|
|
312
|
+
!missingGlyphs.includes(codePoint))
|
|
313
|
+
missingGlyphs.push(codePoint);
|
|
314
|
+
width += safeSize * 0.6;
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
if (previous !== undefined)
|
|
318
|
+
width += (entry.bmfont.kerning.get(`${previous}:${codePoint}`) ?? 0) * scale;
|
|
319
|
+
width += metric.xAdvance * scale;
|
|
320
|
+
}
|
|
321
|
+
previous = codePoint;
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
width,
|
|
325
|
+
lineHeight: entry.bmfont.lineHeight * scale,
|
|
326
|
+
source: 'bmfont',
|
|
327
|
+
missingGlyphs,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const graphemes = Array.from(new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(text)).length;
|
|
331
|
+
return {
|
|
332
|
+
width: graphemes * safeSize * 0.58,
|
|
333
|
+
lineHeight: safeSize * 1.2,
|
|
334
|
+
source: 'approximation',
|
|
335
|
+
missingGlyphs: [],
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
async shapeText(fontName, text, fontSize) {
|
|
339
|
+
const entry = fontName === undefined ? undefined : this.loadFontMetrics(fontName);
|
|
340
|
+
if (entry?.kind === 'fontkit' && entry.font !== undefined) {
|
|
341
|
+
const shaped = shapeFontkitOutline(entry.font, entry.sourceFile.sha256, text, fontSize);
|
|
342
|
+
return {
|
|
343
|
+
source: 'fontkit-path',
|
|
344
|
+
sourceHash: entry.sourceFile.sha256,
|
|
345
|
+
width: shaped.width,
|
|
346
|
+
baseline: entry.font.ascent * (Math.max(1, fontSize) / entry.font.unitsPerEm),
|
|
347
|
+
baselineModelled: true,
|
|
348
|
+
glyphs: shaped.glyphs.map(({ key, path: glyphPath, x, y, scale }) => ({
|
|
349
|
+
kind: 'outline',
|
|
350
|
+
key,
|
|
351
|
+
path: glyphPath,
|
|
352
|
+
x,
|
|
353
|
+
y,
|
|
354
|
+
scale,
|
|
355
|
+
})),
|
|
356
|
+
missingGlyphs: this.missingFontkitCodePoints(entry.font, text),
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
if (entry?.kind === 'bmfont' && entry.bmfont !== undefined) {
|
|
360
|
+
const scale = Math.max(1, fontSize) / entry.bmfont.size;
|
|
361
|
+
const glyphs = [];
|
|
362
|
+
const missingGlyphs = [];
|
|
363
|
+
const pageHashes = new Set();
|
|
364
|
+
let visibleCharacters = 0;
|
|
365
|
+
let penX = 0;
|
|
366
|
+
let previous;
|
|
367
|
+
for (const character of text) {
|
|
368
|
+
if (!/^\s$/u.test(character))
|
|
369
|
+
visibleCharacters += 1;
|
|
370
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
371
|
+
const metric = entry.bmfont.characters.get(codePoint);
|
|
372
|
+
if (metric === undefined) {
|
|
373
|
+
if (missingGlyphs.length < GUI_TEXT_MAX_MISSING_GLYPH_SAMPLES &&
|
|
374
|
+
!missingGlyphs.includes(codePoint))
|
|
375
|
+
missingGlyphs.push(codePoint);
|
|
376
|
+
penX += Math.max(1, fontSize) * 0.6;
|
|
377
|
+
previous = codePoint;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
if (previous !== undefined)
|
|
381
|
+
penX += (entry.bmfont.kerning.get(`${previous}:${codePoint}`) ?? 0) * scale;
|
|
382
|
+
const pagePath = entry.bmfont.pages[metric.page];
|
|
383
|
+
const raster = pagePath === undefined
|
|
384
|
+
? undefined
|
|
385
|
+
: await this.loadBmFontGlyph(entry, pagePath, metric, codePoint);
|
|
386
|
+
if (raster !== undefined && pagePath !== undefined) {
|
|
387
|
+
const page = this.resolveFile(pagePath, entry.sourceFile.relativePath);
|
|
388
|
+
if (page !== undefined)
|
|
389
|
+
pageHashes.add(page.sha256);
|
|
390
|
+
glyphs.push({
|
|
391
|
+
kind: 'bitmap',
|
|
392
|
+
key: `${entry.sourceFile.sha256}:${codePoint}:${Math.max(1, fontSize)}`,
|
|
393
|
+
dataUri: raster.dataUri,
|
|
394
|
+
x: penX + metric.xOffset * scale,
|
|
395
|
+
y: metric.yOffset * scale,
|
|
396
|
+
width: raster.width * scale,
|
|
397
|
+
height: raster.height * scale,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
else if (metric.width > 0 &&
|
|
401
|
+
metric.height > 0 &&
|
|
402
|
+
missingGlyphs.length < GUI_TEXT_MAX_MISSING_GLYPH_SAMPLES &&
|
|
403
|
+
!missingGlyphs.includes(codePoint)) {
|
|
404
|
+
missingGlyphs.push(codePoint);
|
|
405
|
+
}
|
|
406
|
+
penX += metric.xAdvance * scale;
|
|
407
|
+
previous = codePoint;
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
source: visibleCharacters > 0 && glyphs.length === 0 ? 'deterministic-fallback' : 'bmfont-atlas',
|
|
411
|
+
sourceHash: hashCanonical([entry.sourceFile.sha256, ...[...pageHashes].sort()]),
|
|
412
|
+
width: penX,
|
|
413
|
+
baseline: entry.bmfont.base * scale,
|
|
414
|
+
baselineModelled: entry.bmfont.baseDeclared,
|
|
415
|
+
glyphs,
|
|
416
|
+
missingGlyphs,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
source: 'deterministic-fallback',
|
|
421
|
+
sourceHash: DETERMINISTIC_TOOL_FONT_HASH,
|
|
422
|
+
width: this.measureText(undefined, text, fontSize).width,
|
|
423
|
+
baseline: Math.max(1, fontSize) * 0.8,
|
|
424
|
+
baselineModelled: false,
|
|
425
|
+
glyphs: [],
|
|
426
|
+
missingGlyphs: [],
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
fontDefinition(fontName) {
|
|
430
|
+
return this.fontDefinitions.get(fontName.toLowerCase());
|
|
431
|
+
}
|
|
432
|
+
resolvedFontMetrics(fontName) {
|
|
433
|
+
const entry = fontName === undefined ? undefined : this.loadFontMetrics(fontName);
|
|
434
|
+
if (entry?.kind === 'bmfont' && entry.bmfont !== undefined)
|
|
435
|
+
return {
|
|
436
|
+
source: 'bmfont',
|
|
437
|
+
nativeSize: entry.bmfont.size,
|
|
438
|
+
nativeLineHeight: entry.bmfont.lineHeight,
|
|
439
|
+
nativeBaseline: entry.bmfont.base,
|
|
440
|
+
baselineModelled: entry.bmfont.baseDeclared,
|
|
441
|
+
};
|
|
442
|
+
if (entry?.kind === 'fontkit' && entry.font !== undefined)
|
|
443
|
+
return { source: 'fontkit', baselineModelled: true };
|
|
444
|
+
return { source: 'approximation', baselineModelled: false };
|
|
445
|
+
}
|
|
446
|
+
missingFontkitCodePoints(font, text) {
|
|
447
|
+
const missingGlyphs = [];
|
|
448
|
+
for (const character of text) {
|
|
449
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
450
|
+
if (font.glyphForCodePoint(codePoint).id === 0 &&
|
|
451
|
+
missingGlyphs.length < GUI_TEXT_MAX_MISSING_GLYPH_SAMPLES &&
|
|
452
|
+
!missingGlyphs.includes(codePoint))
|
|
453
|
+
missingGlyphs.push(codePoint);
|
|
454
|
+
}
|
|
455
|
+
return missingGlyphs;
|
|
456
|
+
}
|
|
457
|
+
loadFontMetrics(fontName) {
|
|
458
|
+
const key = fontName.toLowerCase();
|
|
459
|
+
if (this.metrics.has(key))
|
|
460
|
+
return this.metrics.get(key) ?? undefined;
|
|
461
|
+
const definition = this.fontDefinitions.get(key);
|
|
462
|
+
if (definition === undefined) {
|
|
463
|
+
this.metrics.set(key, null);
|
|
464
|
+
return undefined;
|
|
465
|
+
}
|
|
466
|
+
for (const assetPath of definition.assetPaths) {
|
|
467
|
+
const file = this.resolveFile(assetPath, definition.sourcePath);
|
|
468
|
+
if (file === undefined)
|
|
469
|
+
continue;
|
|
470
|
+
const extension = path.extname(file.relativePath).toLowerCase();
|
|
471
|
+
try {
|
|
472
|
+
if (extension === '.fnt') {
|
|
473
|
+
if (file.bytes.length > GUI_BMFONT_MAX_BYTES) {
|
|
474
|
+
throw new ServiceError('GUI_FONT_BYTES_BLOCKED', `BMFont ${file.displayPath} exceeds the fixed source-byte ceiling`, { bytes: file.bytes.length, maximumBytes: GUI_BMFONT_MAX_BYTES });
|
|
475
|
+
}
|
|
476
|
+
const bmfont = parseBmFont(file.bytes.toString('utf8'));
|
|
477
|
+
if (bmfont !== undefined) {
|
|
478
|
+
const result = { kind: 'bmfont', bmfont, sourceFile: file };
|
|
479
|
+
this.metrics.set(key, result);
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
else if (['.ttf', '.otf', '.woff', '.woff2'].includes(extension)) {
|
|
484
|
+
if (file.bytes.length > GUI_BINARY_FONT_MAX_BYTES) {
|
|
485
|
+
throw new ServiceError('GUI_FONT_BYTES_BLOCKED', `Font ${file.displayPath} exceeds the fixed binary-font byte ceiling`, { bytes: file.bytes.length, maximumBytes: GUI_BINARY_FONT_MAX_BYTES });
|
|
486
|
+
}
|
|
487
|
+
const font = selectFont(createFont(file.bytes));
|
|
488
|
+
if (font !== undefined) {
|
|
489
|
+
const result = { kind: 'fontkit', font, sourceFile: file };
|
|
490
|
+
this.metrics.set(key, result);
|
|
491
|
+
return result;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
if (error instanceof ServiceError)
|
|
497
|
+
throw error;
|
|
498
|
+
// Invalid font assets are surfaced as missing metrics by the renderer fidelity report.
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
this.metrics.set(key, null);
|
|
502
|
+
return undefined;
|
|
503
|
+
}
|
|
504
|
+
loadBmFontGlyph(entry, pagePath, metric, codePoint) {
|
|
505
|
+
if (metric.width <= 0 || metric.height <= 0)
|
|
506
|
+
return Promise.resolve(undefined);
|
|
507
|
+
const key = `${entry.sourceFile.sha256}:${pagePath}:${codePoint}:${metric.x}:${metric.y}:${metric.width}:${metric.height}`;
|
|
508
|
+
let promise = this.glyphRasters.get(key);
|
|
509
|
+
if (promise === undefined) {
|
|
510
|
+
promise = (async () => {
|
|
511
|
+
const raster = await this.loadRaster(pagePath, entry.sourceFile.relativePath);
|
|
512
|
+
if (!raster.supported ||
|
|
513
|
+
metric.x < 0 ||
|
|
514
|
+
metric.y < 0 ||
|
|
515
|
+
metric.width <= 0 ||
|
|
516
|
+
metric.height <= 0 ||
|
|
517
|
+
metric.x + metric.width > raster.width ||
|
|
518
|
+
metric.y + metric.height > raster.height)
|
|
519
|
+
return undefined;
|
|
520
|
+
this.budget.reserveRasterOperation(`gui-bmfont-glyph:${key}`, `GUI BMFont glyph rasterization U+${codePoint.toString(16).toUpperCase()}`);
|
|
521
|
+
this.budget.reserve(metric.width, metric.height, `GUI BMFont glyph U+${codePoint.toString(16).toUpperCase()}`, { maximumPixels: RENDER_MAX_DECODED_PIXELS });
|
|
522
|
+
const png = await sharp(raster.data, {
|
|
523
|
+
raw: { width: raster.width, height: raster.height, channels: 4 },
|
|
524
|
+
limitInputPixels: RENDER_MAX_DECODED_PIXELS,
|
|
525
|
+
})
|
|
526
|
+
.extract({ left: metric.x, top: metric.y, width: metric.width, height: metric.height })
|
|
527
|
+
.png({ compressionLevel: 9, adaptiveFiltering: false, palette: false })
|
|
528
|
+
.toBuffer();
|
|
529
|
+
return {
|
|
530
|
+
dataUri: `data:image/png;base64,${png.toString('base64')}`,
|
|
531
|
+
width: metric.width,
|
|
532
|
+
height: metric.height,
|
|
533
|
+
};
|
|
534
|
+
})();
|
|
535
|
+
this.glyphRasters.set(key, promise);
|
|
536
|
+
}
|
|
537
|
+
return promise;
|
|
538
|
+
}
|
|
539
|
+
async decodeRaster(file) {
|
|
540
|
+
const extension = path.extname(file.relativePath).toLowerCase();
|
|
541
|
+
const operationKey = `gui-raster:${file.displayPath}:${file.sha256}`;
|
|
542
|
+
if (extension === '.dds') {
|
|
543
|
+
const decoded = decodeDds(file.bytes, this.budget, operationKey);
|
|
544
|
+
return 'unsupported' in decoded
|
|
545
|
+
? {
|
|
546
|
+
width: 0,
|
|
547
|
+
height: 0,
|
|
548
|
+
data: Buffer.alloc(0),
|
|
549
|
+
format: decoded.format,
|
|
550
|
+
supported: false,
|
|
551
|
+
reason: decoded.reason,
|
|
552
|
+
}
|
|
553
|
+
: {
|
|
554
|
+
width: decoded.width,
|
|
555
|
+
height: decoded.height,
|
|
556
|
+
data: decoded.data,
|
|
557
|
+
format: decoded.format,
|
|
558
|
+
supported: true,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
if (extension === '.tga') {
|
|
562
|
+
const decoded = decodeTga(file.bytes, this.budget, operationKey);
|
|
563
|
+
return 'unsupported' in decoded
|
|
564
|
+
? {
|
|
565
|
+
width: 0,
|
|
566
|
+
height: 0,
|
|
567
|
+
data: Buffer.alloc(0),
|
|
568
|
+
format: decoded.format,
|
|
569
|
+
supported: false,
|
|
570
|
+
reason: decoded.reason,
|
|
571
|
+
}
|
|
572
|
+
: {
|
|
573
|
+
width: decoded.width,
|
|
574
|
+
height: decoded.height,
|
|
575
|
+
data: decoded.data,
|
|
576
|
+
format: decoded.format,
|
|
577
|
+
supported: true,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
if (extension === '.svg') {
|
|
581
|
+
throw new ServiceError('RENDER_ASSET_SVG_BLOCKED', 'Workspace SVG raster inputs are not accepted; use a bounded PNG source asset', { path: file.displayPath });
|
|
582
|
+
}
|
|
583
|
+
if (extension !== '.png' && extension !== '.bmp') {
|
|
584
|
+
return {
|
|
585
|
+
width: 0,
|
|
586
|
+
height: 0,
|
|
587
|
+
data: Buffer.alloc(0),
|
|
588
|
+
format: extension.slice(1) || 'unknown',
|
|
589
|
+
supported: false,
|
|
590
|
+
reason: `Raster format ${extension || '<none>'} is unsupported.`,
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
try {
|
|
594
|
+
const metadata = await sharp(file.bytes, {
|
|
595
|
+
limitInputPixels: RENDER_MAX_DECODED_PIXELS,
|
|
596
|
+
}).metadata();
|
|
597
|
+
this.budget.reserve(metadata.width, metadata.height, `GUI asset ${file.displayPath}`, {
|
|
598
|
+
maximumPixels: RENDER_MAX_DECODED_PIXELS,
|
|
599
|
+
});
|
|
600
|
+
const decoded = await sharp(file.bytes, { limitInputPixels: RENDER_MAX_DECODED_PIXELS })
|
|
601
|
+
.ensureAlpha()
|
|
602
|
+
.raw()
|
|
603
|
+
.toBuffer({ resolveWithObject: true });
|
|
604
|
+
return {
|
|
605
|
+
width: decoded.info.width,
|
|
606
|
+
height: decoded.info.height,
|
|
607
|
+
data: decoded.data,
|
|
608
|
+
format: extension.slice(1),
|
|
609
|
+
supported: true,
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
if (error instanceof ServiceError)
|
|
614
|
+
throw error;
|
|
615
|
+
if (error instanceof Error && /pixel limit/iu.test(error.message)) {
|
|
616
|
+
throw new ServiceError('RENDER_PIXELS_BLOCKED', `GUI asset ${file.displayPath} exceeds the fixed per-artifact pixel ceiling`, { label: `GUI asset ${file.displayPath}`, maximumPixels: RENDER_MAX_DECODED_PIXELS });
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
width: 0,
|
|
620
|
+
height: 0,
|
|
621
|
+
data: Buffer.alloc(0),
|
|
622
|
+
format: extension.slice(1),
|
|
623
|
+
supported: false,
|
|
624
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
//# sourceMappingURL=assets.js.map
|