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,653 @@
|
|
|
1
|
+
import { setImmediate as yieldToEventLoop } from 'node:timers/promises';
|
|
2
|
+
import { compareCodeUnits, hashCanonical } from '../core/canonical.js';
|
|
3
|
+
import { DiagnosticCollector } from '../core/diagnostic-collector.js';
|
|
4
|
+
import { sortDiagnostics } from '../core/diagnostics.js';
|
|
5
|
+
import { ServiceError } from '../core/result.js';
|
|
6
|
+
import { focusConnectorSegmentsProperlyCross, focusNodesVisiblyOverlap } from './geometry.js';
|
|
7
|
+
import { FOCUS_GRAPH_MAX_DEPTH, FOCUS_DIAGNOSTIC_MAX, FOCUS_GRAPH_MAX_EDGES, FOCUS_GRAPH_MAX_NODES, FOCUS_LAYOUT_WORK_MAX, } from './limits.js';
|
|
8
|
+
import {} from './model.js';
|
|
9
|
+
class LayoutWorkBudget {
|
|
10
|
+
used = 0;
|
|
11
|
+
spend(phase, amount = 1) {
|
|
12
|
+
if (!Number.isSafeInteger(amount) || amount < 0 || amount > FOCUS_LAYOUT_WORK_MAX - this.used) {
|
|
13
|
+
throw new ServiceError('FOCUS_LAYOUT_WORK_BUDGET_BLOCKED', 'Focus layout exceeds the fixed placement and comparison work ceiling', { phase, used: this.used, requested: amount, maximumWork: FOCUS_LAYOUT_WORK_MAX });
|
|
14
|
+
}
|
|
15
|
+
this.used += amount;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function* cancellationCheckpoint(signal, iteration = 0, stride = 1) {
|
|
19
|
+
if (iteration % stride !== 0)
|
|
20
|
+
return;
|
|
21
|
+
signal?.throwIfAborted();
|
|
22
|
+
yield;
|
|
23
|
+
}
|
|
24
|
+
function completeSynchronously(steps) {
|
|
25
|
+
for (;;) {
|
|
26
|
+
const step = steps.next();
|
|
27
|
+
if (step.done)
|
|
28
|
+
return step.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function completeCooperatively(steps, signal) {
|
|
32
|
+
let yieldDeadline = performance.now() + 8;
|
|
33
|
+
for (;;) {
|
|
34
|
+
const step = steps.next();
|
|
35
|
+
if (step.done)
|
|
36
|
+
return step.value;
|
|
37
|
+
signal?.throwIfAborted();
|
|
38
|
+
if (performance.now() < yieldDeadline)
|
|
39
|
+
continue;
|
|
40
|
+
await yieldToEventLoop();
|
|
41
|
+
signal?.throwIfAborted();
|
|
42
|
+
yieldDeadline = performance.now() + 8;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function coordinateKey(x, y) {
|
|
46
|
+
return `${x},${y}`;
|
|
47
|
+
}
|
|
48
|
+
function laneFor(plan, focus) {
|
|
49
|
+
if (focus.laneId !== undefined)
|
|
50
|
+
return focus.laneId;
|
|
51
|
+
if (focus.branchId !== undefined) {
|
|
52
|
+
const branch = plan.branchGroups.find(({ id }) => id === focus.branchId);
|
|
53
|
+
if (branch?.laneId !== undefined)
|
|
54
|
+
return branch.laneId;
|
|
55
|
+
return focus.branchId;
|
|
56
|
+
}
|
|
57
|
+
return 'default';
|
|
58
|
+
}
|
|
59
|
+
function laneBases(plan, discovered, spacing) {
|
|
60
|
+
const configured = [...plan.laneGroups].sort((left, right) => left.order - right.order || compareCodeUnits(left.id, right.id));
|
|
61
|
+
const all = [
|
|
62
|
+
...configured.map(({ id }) => id),
|
|
63
|
+
...discovered.filter((id) => !configured.some((lane) => lane.id === id)),
|
|
64
|
+
];
|
|
65
|
+
return new Map([...new Set(all)].map((id, index) => {
|
|
66
|
+
const lane = configured.find((candidate) => candidate.id === id);
|
|
67
|
+
const defaultX = index * spacing;
|
|
68
|
+
const bounded = Math.max(lane?.minimumX ?? -Infinity, Math.min(lane?.maximumX ?? Infinity, defaultX));
|
|
69
|
+
return [id, bounded];
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
function prerequisiteIds(focus) {
|
|
73
|
+
return focus.prerequisites.groups.flatMap(({ focusIds }) => focusIds);
|
|
74
|
+
}
|
|
75
|
+
function mutualExclusionMap(focuses) {
|
|
76
|
+
const result = new Map();
|
|
77
|
+
for (const focus of focuses.values()) {
|
|
78
|
+
for (const otherId of focus.mutuallyExclusive) {
|
|
79
|
+
const own = result.get(focus.id) ?? new Set();
|
|
80
|
+
own.add(otherId);
|
|
81
|
+
result.set(focus.id, own);
|
|
82
|
+
const reciprocal = result.get(otherId) ?? new Set();
|
|
83
|
+
reciprocal.add(focus.id);
|
|
84
|
+
result.set(otherId, reciprocal);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
function* connectorEdges(context, candidate) {
|
|
90
|
+
const nodeFor = (focusId) => candidate?.id === focusId ? candidate : context.placed.get(focusId);
|
|
91
|
+
const edges = [];
|
|
92
|
+
let focusIndex = 0;
|
|
93
|
+
for (const focus of context.focuses.values()) {
|
|
94
|
+
context.work.spend('connector edge construction');
|
|
95
|
+
yield* cancellationCheckpoint(context.signal, focusIndex, 32);
|
|
96
|
+
focusIndex += 1;
|
|
97
|
+
const child = nodeFor(focus.id);
|
|
98
|
+
if (child === undefined)
|
|
99
|
+
continue;
|
|
100
|
+
for (const parentId of prerequisiteIds(focus)) {
|
|
101
|
+
context.work.spend('connector edge construction');
|
|
102
|
+
const parent = nodeFor(parentId);
|
|
103
|
+
if (parent === undefined)
|
|
104
|
+
continue;
|
|
105
|
+
edges.push({ parentId, childId: focus.id, parent, child });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return edges.sort((left, right) => compareCodeUnits(left.parentId, right.parentId) ||
|
|
109
|
+
compareCodeUnits(left.childId, right.childId));
|
|
110
|
+
}
|
|
111
|
+
function connectorsShareEndpoint(left, right) {
|
|
112
|
+
return (left.parentId === right.parentId ||
|
|
113
|
+
left.parentId === right.childId ||
|
|
114
|
+
left.childId === right.parentId ||
|
|
115
|
+
left.childId === right.childId);
|
|
116
|
+
}
|
|
117
|
+
function* connectorCrossings(edges, context) {
|
|
118
|
+
const crossings = [];
|
|
119
|
+
for (let leftIndex = 0; leftIndex < edges.length; leftIndex += 1) {
|
|
120
|
+
yield* cancellationCheckpoint(context.signal, leftIndex, 16);
|
|
121
|
+
const left = edges[leftIndex];
|
|
122
|
+
if (left === undefined)
|
|
123
|
+
continue;
|
|
124
|
+
for (let rightIndex = leftIndex + 1; rightIndex < edges.length; rightIndex += 1) {
|
|
125
|
+
yield* cancellationCheckpoint(context.signal, rightIndex - leftIndex, 64);
|
|
126
|
+
context.work.spend('connector crossing comparison');
|
|
127
|
+
const right = edges[rightIndex];
|
|
128
|
+
if (right === undefined || connectorsShareEndpoint(left, right))
|
|
129
|
+
continue;
|
|
130
|
+
if (focusConnectorSegmentsProperlyCross(left.parent, left.child, right.parent, right.child))
|
|
131
|
+
if (crossings.length < FOCUS_DIAGNOSTIC_MAX - 1)
|
|
132
|
+
crossings.push([left, right]);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return crossings;
|
|
136
|
+
}
|
|
137
|
+
function* crossingCountForCandidate(context, focusId, x, y) {
|
|
138
|
+
yield* cancellationCheckpoint(context.signal);
|
|
139
|
+
const focus = context.focuses.get(focusId);
|
|
140
|
+
const candidate = {
|
|
141
|
+
id: focusId,
|
|
142
|
+
x,
|
|
143
|
+
y,
|
|
144
|
+
laneId: context.laneIds.get(focusId) ?? 'default',
|
|
145
|
+
preserved: false,
|
|
146
|
+
sourceMode: focus?.position.mode ?? 'auto',
|
|
147
|
+
};
|
|
148
|
+
const edges = yield* connectorEdges(context, candidate);
|
|
149
|
+
const candidateEdges = edges.filter((edge) => edge.parentId === focusId || edge.childId === focusId);
|
|
150
|
+
const existingEdges = edges.filter((edge) => edge.parentId !== focusId && edge.childId !== focusId);
|
|
151
|
+
let crossings = 0;
|
|
152
|
+
for (const [candidateIndex, candidateEdge] of candidateEdges.entries()) {
|
|
153
|
+
yield* cancellationCheckpoint(context.signal, candidateIndex, 16);
|
|
154
|
+
for (const [existingIndex, existingEdge] of existingEdges.entries()) {
|
|
155
|
+
yield* cancellationCheckpoint(context.signal, existingIndex, 64);
|
|
156
|
+
context.work.spend('candidate connector crossing comparison');
|
|
157
|
+
if (connectorsShareEndpoint(candidateEdge, existingEdge))
|
|
158
|
+
continue;
|
|
159
|
+
if (focusConnectorSegmentsProperlyCross(candidateEdge.parent, candidateEdge.child, existingEdge.parent, existingEdge.child))
|
|
160
|
+
crossings += 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return crossings;
|
|
164
|
+
}
|
|
165
|
+
function candidateConflicts(context, focusId, x, y) {
|
|
166
|
+
const candidate = { x, y };
|
|
167
|
+
const visibleOverlaps = [];
|
|
168
|
+
for (const placed of context.placed.values()) {
|
|
169
|
+
context.work.spend('candidate overlap comparison');
|
|
170
|
+
if (focusNodesVisiblyOverlap(candidate, placed))
|
|
171
|
+
visibleOverlaps.push(placed.id);
|
|
172
|
+
}
|
|
173
|
+
visibleOverlaps.sort((left, right) => compareCodeUnits(left, right));
|
|
174
|
+
const mutualExclusions = [];
|
|
175
|
+
for (const otherId of context.mutualExclusions.get(focusId) ?? []) {
|
|
176
|
+
context.work.spend('candidate mutual-exclusion comparison');
|
|
177
|
+
const other = context.placed.get(otherId);
|
|
178
|
+
if (other !== undefined && Math.abs(x - other.x) < context.minimumMutualExclusionSpacing)
|
|
179
|
+
mutualExclusions.push(otherId);
|
|
180
|
+
}
|
|
181
|
+
mutualExclusions.sort((left, right) => compareCodeUnits(left, right));
|
|
182
|
+
return { visibleOverlaps, mutualExclusions };
|
|
183
|
+
}
|
|
184
|
+
function conflictsCandidate({ visibleOverlaps, mutualExclusions }) {
|
|
185
|
+
return visibleOverlaps.length > 0 || mutualExclusions.length > 0;
|
|
186
|
+
}
|
|
187
|
+
function* placedPrerequisites(context, focus, stack) {
|
|
188
|
+
const result = [];
|
|
189
|
+
for (const id of prerequisiteIds(focus)) {
|
|
190
|
+
if (!context.focuses.has(id))
|
|
191
|
+
continue;
|
|
192
|
+
result.push(yield* placeFocus(context, id, stack));
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
function recordOccupied(context, node) {
|
|
197
|
+
const key = coordinateKey(node.x, node.y);
|
|
198
|
+
const existing = context.occupied.get(key);
|
|
199
|
+
const focus = context.focuses.get(node.id);
|
|
200
|
+
if (existing !== undefined && existing !== node.id) {
|
|
201
|
+
context.diagnostics.push({
|
|
202
|
+
code: 'FOCUS_LAYOUT_COORDINATE_CONFLICT',
|
|
203
|
+
severity: 'error',
|
|
204
|
+
category: 'layout',
|
|
205
|
+
message: `Focuses ${existing} and ${node.id} occupy (${node.x}, ${node.y})`,
|
|
206
|
+
...(focus?.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
207
|
+
details: { focusIds: [existing, node.id], x: node.x, y: node.y },
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
context.occupied.set(key, node.id);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function* availableX(context, focusId, preferred, y) {
|
|
215
|
+
const conflictsAtPreferred = candidateConflicts(context, focusId, preferred, y);
|
|
216
|
+
const crossingsAtPreferred = yield* crossingCountForCandidate(context, focusId, preferred, y);
|
|
217
|
+
let best;
|
|
218
|
+
const optimizationSteps = Math.max(32, context.focuses.size * 2);
|
|
219
|
+
for (let distance = 0; distance <= optimizationSteps; distance += 1) {
|
|
220
|
+
yield* cancellationCheckpoint(context.signal, distance, 8);
|
|
221
|
+
const offsets = distance === 0 ? [0] : [distance, -distance];
|
|
222
|
+
for (let directionOrder = 0; directionOrder < offsets.length; directionOrder += 1) {
|
|
223
|
+
const offset = offsets[directionOrder];
|
|
224
|
+
if (offset === undefined)
|
|
225
|
+
continue;
|
|
226
|
+
context.work.spend('automatic placement candidate');
|
|
227
|
+
const x = preferred + offset * context.nodeSpacing;
|
|
228
|
+
const conflicts = candidateConflicts(context, focusId, x, y);
|
|
229
|
+
if (conflictsCandidate(conflicts))
|
|
230
|
+
continue;
|
|
231
|
+
const crossings = yield* crossingCountForCandidate(context, focusId, x, y);
|
|
232
|
+
if (best === undefined ||
|
|
233
|
+
crossings < best.crossings ||
|
|
234
|
+
(crossings === best.crossings && distance < best.distance) ||
|
|
235
|
+
(crossings === best.crossings &&
|
|
236
|
+
distance === best.distance &&
|
|
237
|
+
directionOrder < best.directionOrder)) {
|
|
238
|
+
best = { x, crossings, distance, directionOrder };
|
|
239
|
+
}
|
|
240
|
+
if (crossings === 0) {
|
|
241
|
+
return {
|
|
242
|
+
x,
|
|
243
|
+
moved: x !== preferred,
|
|
244
|
+
conflictsAtPreferred,
|
|
245
|
+
crossingsAtPreferred,
|
|
246
|
+
crossings,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (best !== undefined) {
|
|
252
|
+
return {
|
|
253
|
+
x: best.x,
|
|
254
|
+
moved: best.x !== preferred,
|
|
255
|
+
conflictsAtPreferred,
|
|
256
|
+
crossingsAtPreferred,
|
|
257
|
+
crossings: best.crossings,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
for (let distance = optimizationSteps + 1; distance < 10_000; distance += 1) {
|
|
261
|
+
yield* cancellationCheckpoint(context.signal, distance, 16);
|
|
262
|
+
for (const offset of [distance, -distance]) {
|
|
263
|
+
context.work.spend('automatic placement fallback candidate');
|
|
264
|
+
const x = preferred + offset * context.nodeSpacing;
|
|
265
|
+
if (conflictsCandidate(candidateConflicts(context, focusId, x, y)))
|
|
266
|
+
continue;
|
|
267
|
+
return {
|
|
268
|
+
x,
|
|
269
|
+
moved: true,
|
|
270
|
+
conflictsAtPreferred,
|
|
271
|
+
crossingsAtPreferred,
|
|
272
|
+
crossings: yield* crossingCountForCandidate(context, focusId, x, y),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
throw new Error('Unable to find a free focus coordinate');
|
|
277
|
+
}
|
|
278
|
+
function* placeFocus(context, focusId, inheritedStack = new Set()) {
|
|
279
|
+
yield* cancellationCheckpoint(context.signal);
|
|
280
|
+
context.work.spend('focus placement');
|
|
281
|
+
const existing = context.placed.get(focusId);
|
|
282
|
+
if (existing !== undefined)
|
|
283
|
+
return existing;
|
|
284
|
+
const focus = context.focuses.get(focusId);
|
|
285
|
+
if (focus === undefined) {
|
|
286
|
+
return { id: focusId, x: 0, y: 0, laneId: 'missing', preserved: false, sourceMode: 'auto' };
|
|
287
|
+
}
|
|
288
|
+
if (inheritedStack.has(focusId)) {
|
|
289
|
+
context.diagnostics.push({
|
|
290
|
+
code: 'FOCUS_LAYOUT_DEPENDENCY_CYCLE',
|
|
291
|
+
severity: 'error',
|
|
292
|
+
category: 'layout',
|
|
293
|
+
message: `Layout dependency cycle contains ${focusId}`,
|
|
294
|
+
...(focus.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
295
|
+
});
|
|
296
|
+
const fallback = {
|
|
297
|
+
id: focusId,
|
|
298
|
+
x: context.laneBases.get(context.laneIds.get(focusId) ?? 'default') ?? 0,
|
|
299
|
+
y: 0,
|
|
300
|
+
laneId: context.laneIds.get(focusId) ?? 'default',
|
|
301
|
+
preserved: false,
|
|
302
|
+
sourceMode: focus.position.mode,
|
|
303
|
+
};
|
|
304
|
+
context.placed.set(focusId, fallback);
|
|
305
|
+
recordOccupied(context, fallback);
|
|
306
|
+
return fallback;
|
|
307
|
+
}
|
|
308
|
+
if (inheritedStack.size >= FOCUS_GRAPH_MAX_DEPTH) {
|
|
309
|
+
throw new ServiceError('FOCUS_LAYOUT_DEPTH_BUDGET_BLOCKED', 'Focus layout dependency depth exceeds the fixed recursion ceiling', { focusId, depth: inheritedStack.size + 1, maximumDepth: FOCUS_GRAPH_MAX_DEPTH });
|
|
310
|
+
}
|
|
311
|
+
const stack = new Set(inheritedStack).add(focusId);
|
|
312
|
+
const laneId = context.laneIds.get(focusId) ?? 'default';
|
|
313
|
+
let node;
|
|
314
|
+
if (focus.position.mode === 'fixed') {
|
|
315
|
+
node = {
|
|
316
|
+
id: focusId,
|
|
317
|
+
x: focus.position.x,
|
|
318
|
+
y: focus.position.y,
|
|
319
|
+
laneId,
|
|
320
|
+
preserved: true,
|
|
321
|
+
sourceMode: 'fixed',
|
|
322
|
+
};
|
|
323
|
+
context.decisions.push({
|
|
324
|
+
focusId,
|
|
325
|
+
kind: 'preserved',
|
|
326
|
+
message: `Preserved fixed coordinate (${node.x}, ${node.y})`,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
else if (focus.position.mode === 'relative') {
|
|
330
|
+
const target = context.focuses.get(focus.position.relativeTo);
|
|
331
|
+
if (target === undefined) {
|
|
332
|
+
context.diagnostics.push({
|
|
333
|
+
code: 'FOCUS_LAYOUT_RELATIVE_TARGET_MISSING',
|
|
334
|
+
severity: 'error',
|
|
335
|
+
category: 'layout',
|
|
336
|
+
message: `Relative position target ${focus.position.relativeTo} does not exist`,
|
|
337
|
+
...(focus.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
338
|
+
details: { focusId, target: focus.position.relativeTo },
|
|
339
|
+
});
|
|
340
|
+
node = {
|
|
341
|
+
id: focusId,
|
|
342
|
+
x: focus.position.x,
|
|
343
|
+
y: focus.position.y,
|
|
344
|
+
laneId,
|
|
345
|
+
preserved: true,
|
|
346
|
+
sourceMode: 'relative',
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
const anchor = yield* placeFocus(context, target.id, stack);
|
|
351
|
+
node = {
|
|
352
|
+
id: focusId,
|
|
353
|
+
x: anchor.x + focus.position.x,
|
|
354
|
+
y: anchor.y + focus.position.y,
|
|
355
|
+
laneId,
|
|
356
|
+
preserved: true,
|
|
357
|
+
sourceMode: 'relative',
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
context.decisions.push({
|
|
361
|
+
focusId,
|
|
362
|
+
kind: 'relative',
|
|
363
|
+
message: `Preserved relative offset from ${focus.position.relativeTo}`,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
const parents = yield* placedPrerequisites(context, focus, stack);
|
|
368
|
+
const requiredY = parents.length === 0 ? 0 : Math.max(...parents.map(({ y }) => y + 1));
|
|
369
|
+
const previous = context.previous.get(focusId);
|
|
370
|
+
if (previous !== undefined) {
|
|
371
|
+
node = {
|
|
372
|
+
id: focusId,
|
|
373
|
+
x: previous.x,
|
|
374
|
+
y: previous.y,
|
|
375
|
+
laneId,
|
|
376
|
+
preserved: true,
|
|
377
|
+
sourceMode: 'auto',
|
|
378
|
+
};
|
|
379
|
+
context.decisions.push({
|
|
380
|
+
focusId,
|
|
381
|
+
kind: 'preserved',
|
|
382
|
+
message: `Preserved prior automatic coordinate (${node.x}, ${node.y}); spacing and crossing optimization did not move this stable node`,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const convergenceX = focus.convergence && parents.length > 1
|
|
387
|
+
? Math.floor(parents.reduce((total, parent) => total + parent.x, 0) / parents.length)
|
|
388
|
+
: undefined;
|
|
389
|
+
const preferredX = focus.position.preferredX ?? convergenceX ?? context.laneBases.get(laneId) ?? 0;
|
|
390
|
+
const preferredY = Math.max(requiredY, focus.position.preferredY ?? requiredY);
|
|
391
|
+
const coordinate = yield* availableX(context, focusId, preferredX, preferredY);
|
|
392
|
+
node = {
|
|
393
|
+
id: focusId,
|
|
394
|
+
x: coordinate.x,
|
|
395
|
+
y: preferredY,
|
|
396
|
+
laneId,
|
|
397
|
+
preserved: false,
|
|
398
|
+
sourceMode: 'auto',
|
|
399
|
+
};
|
|
400
|
+
const explanations = [];
|
|
401
|
+
if (coordinate.conflictsAtPreferred.visibleOverlaps.length > 0) {
|
|
402
|
+
explanations.push(`visible overlap with ${coordinate.conflictsAtPreferred.visibleOverlaps.join(', ')}`);
|
|
403
|
+
}
|
|
404
|
+
if (coordinate.conflictsAtPreferred.mutualExclusions.length > 0) {
|
|
405
|
+
explanations.push(`mutual-exclusion spacing from ${coordinate.conflictsAtPreferred.mutualExclusions.join(', ')}`);
|
|
406
|
+
}
|
|
407
|
+
if (coordinate.crossings < coordinate.crossingsAtPreferred) {
|
|
408
|
+
explanations.push(`connector crossings ${coordinate.crossingsAtPreferred} -> ${coordinate.crossings}`);
|
|
409
|
+
}
|
|
410
|
+
const movedKind = coordinate.conflictsAtPreferred.visibleOverlaps.length > 0
|
|
411
|
+
? 'moved_for_collision'
|
|
412
|
+
: coordinate.conflictsAtPreferred.mutualExclusions.length > 0
|
|
413
|
+
? 'moved_for_mutual_exclusion'
|
|
414
|
+
: 'moved_to_reduce_crossings';
|
|
415
|
+
context.decisions.push({
|
|
416
|
+
focusId,
|
|
417
|
+
kind: coordinate.moved ? movedKind : 'placed',
|
|
418
|
+
message: coordinate.moved
|
|
419
|
+
? `Moved from preferred (${preferredX}, ${preferredY}) to (${node.x}, ${node.y}) to resolve ${explanations.join(' and ')}`
|
|
420
|
+
: `Placed in lane ${laneId} at (${node.x}, ${node.y}); connector crossings ${coordinate.crossings}`,
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
const cycleFallback = context.placed.get(focusId);
|
|
425
|
+
if (cycleFallback !== undefined)
|
|
426
|
+
return cycleFallback;
|
|
427
|
+
context.placed.set(focusId, node);
|
|
428
|
+
recordOccupied(context, node);
|
|
429
|
+
return node;
|
|
430
|
+
}
|
|
431
|
+
function* visibleOverlapDiagnostics(context) {
|
|
432
|
+
const nodes = [...context.placed.values()].sort((left, right) => compareCodeUnits(left.id, right.id));
|
|
433
|
+
for (let leftIndex = 0; leftIndex < nodes.length; leftIndex += 1) {
|
|
434
|
+
yield* cancellationCheckpoint(context.signal, leftIndex, 16);
|
|
435
|
+
const left = nodes[leftIndex];
|
|
436
|
+
if (left === undefined)
|
|
437
|
+
continue;
|
|
438
|
+
for (let rightIndex = leftIndex + 1; rightIndex < nodes.length; rightIndex += 1) {
|
|
439
|
+
context.work.spend('final visible-overlap comparison');
|
|
440
|
+
const right = nodes[rightIndex];
|
|
441
|
+
if (right === undefined || !focusNodesVisiblyOverlap(left, right))
|
|
442
|
+
continue;
|
|
443
|
+
const focus = context.focuses.get(right.id);
|
|
444
|
+
context.diagnostics.push({
|
|
445
|
+
code: 'FOCUS_LAYOUT_VISIBLE_OVERLAP',
|
|
446
|
+
severity: 'error',
|
|
447
|
+
category: 'layout',
|
|
448
|
+
message: `Focuses ${left.id} and ${right.id} visibly overlap`,
|
|
449
|
+
...(focus?.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
450
|
+
details: {
|
|
451
|
+
focusIds: [left.id, right.id],
|
|
452
|
+
left: { x: left.x, y: left.y },
|
|
453
|
+
right: { x: right.x, y: right.y },
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function canMoveForSoftConstraint(context, focusId) {
|
|
460
|
+
const focus = context.focuses.get(focusId);
|
|
461
|
+
return focus?.position.mode === 'auto' && !context.previous.has(focusId);
|
|
462
|
+
}
|
|
463
|
+
function* mutualExclusionSpacingDiagnostics(context) {
|
|
464
|
+
const pairs = new Set();
|
|
465
|
+
let focusIndex = 0;
|
|
466
|
+
for (const [focusId, excludedIds] of context.mutualExclusions) {
|
|
467
|
+
context.work.spend('mutual-exclusion diagnostic construction');
|
|
468
|
+
yield* cancellationCheckpoint(context.signal, focusIndex, 16);
|
|
469
|
+
focusIndex += 1;
|
|
470
|
+
for (const excludedId of excludedIds) {
|
|
471
|
+
context.work.spend('mutual-exclusion diagnostic construction');
|
|
472
|
+
if (!context.focuses.has(excludedId))
|
|
473
|
+
continue;
|
|
474
|
+
pairs.add([focusId, excludedId].sort((left, right) => compareCodeUnits(left, right)).join('\0'));
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
for (const pair of [...pairs].sort((left, right) => compareCodeUnits(left, right))) {
|
|
478
|
+
const [leftId, rightId] = pair.split('\0');
|
|
479
|
+
if (leftId === undefined || rightId === undefined)
|
|
480
|
+
continue;
|
|
481
|
+
const left = context.placed.get(leftId);
|
|
482
|
+
const right = context.placed.get(rightId);
|
|
483
|
+
if (left === undefined ||
|
|
484
|
+
right === undefined ||
|
|
485
|
+
Math.abs(left.x - right.x) >= context.minimumMutualExclusionSpacing)
|
|
486
|
+
continue;
|
|
487
|
+
const movableFocusIds = [leftId, rightId].filter((id) => canMoveForSoftConstraint(context, id));
|
|
488
|
+
const preservedFocusIds = [leftId, rightId].filter((id) => !canMoveForSoftConstraint(context, id));
|
|
489
|
+
const focus = context.focuses.get(rightId);
|
|
490
|
+
const reason = movableFocusIds.length === 0
|
|
491
|
+
? 'both endpoints are fixed, relative, pinned, or prior-stable'
|
|
492
|
+
: 'the remaining movable endpoint cannot change the authored relative relationship safely';
|
|
493
|
+
context.diagnostics.push({
|
|
494
|
+
code: 'FOCUS_LAYOUT_MUTUAL_EXCLUSION_SPACING_UNSATISFIED',
|
|
495
|
+
severity: 'warning',
|
|
496
|
+
category: 'layout',
|
|
497
|
+
message: `Mutually exclusive focuses ${leftId} and ${rightId} are ${Math.abs(left.x - right.x)} columns apart; ${context.minimumMutualExclusionSpacing} are required, but ${reason}`,
|
|
498
|
+
...(focus?.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
499
|
+
details: {
|
|
500
|
+
focusIds: [leftId, rightId],
|
|
501
|
+
actualSpacing: Math.abs(left.x - right.x),
|
|
502
|
+
requiredSpacing: context.minimumMutualExclusionSpacing,
|
|
503
|
+
movableFocusIds,
|
|
504
|
+
preservedFocusIds,
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function* connectorCrossingDiagnostics(context) {
|
|
510
|
+
yield* cancellationCheckpoint(context.signal);
|
|
511
|
+
const edges = yield* connectorEdges(context);
|
|
512
|
+
const crossings = yield* connectorCrossings(edges, context);
|
|
513
|
+
for (const [first, second] of crossings) {
|
|
514
|
+
const endpointIds = [first.parentId, first.childId, second.parentId, second.childId].filter((id, index, all) => all.indexOf(id) === index);
|
|
515
|
+
const movableFocusIds = endpointIds.filter((id) => canMoveForSoftConstraint(context, id));
|
|
516
|
+
const preservedFocusIds = endpointIds.filter((id) => !canMoveForSoftConstraint(context, id));
|
|
517
|
+
const focus = context.focuses.get(second.childId);
|
|
518
|
+
const reason = movableFocusIds.length === 0
|
|
519
|
+
? 'all connector endpoints are fixed, relative, pinned, or prior-stable'
|
|
520
|
+
: 'no collision-free deterministic candidate reduced the crossing without moving preserved endpoints';
|
|
521
|
+
context.diagnostics.push({
|
|
522
|
+
code: 'FOCUS_LAYOUT_CONNECTOR_CROSSING_UNSATISFIED',
|
|
523
|
+
severity: 'warning',
|
|
524
|
+
category: 'layout',
|
|
525
|
+
message: `Connectors ${first.parentId} -> ${first.childId} and ${second.parentId} -> ${second.childId} still cross because ${reason}`,
|
|
526
|
+
...(focus?.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
527
|
+
details: {
|
|
528
|
+
first: [first.parentId, first.childId],
|
|
529
|
+
second: [second.parentId, second.childId],
|
|
530
|
+
movableFocusIds,
|
|
531
|
+
preservedFocusIds,
|
|
532
|
+
},
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function* parentOrderDiagnostics(context) {
|
|
537
|
+
let focusIndex = 0;
|
|
538
|
+
for (const focus of context.focuses.values()) {
|
|
539
|
+
yield* cancellationCheckpoint(context.signal, focusIndex, 32);
|
|
540
|
+
focusIndex += 1;
|
|
541
|
+
const child = context.placed.get(focus.id);
|
|
542
|
+
if (child === undefined)
|
|
543
|
+
continue;
|
|
544
|
+
for (const parentId of prerequisiteIds(focus)) {
|
|
545
|
+
context.work.spend('parent-order comparison');
|
|
546
|
+
const parent = context.placed.get(parentId);
|
|
547
|
+
if (parent === undefined || parent.y < child.y)
|
|
548
|
+
continue;
|
|
549
|
+
context.diagnostics.push({
|
|
550
|
+
code: 'FOCUS_LAYOUT_PARENT_NOT_ABOVE',
|
|
551
|
+
severity: 'error',
|
|
552
|
+
category: 'layout',
|
|
553
|
+
message: `Prerequisite ${parentId} is not above ${focus.id}`,
|
|
554
|
+
...(focus.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
555
|
+
details: { parentId, childId: focus.id, parentY: parent.y, childY: child.y },
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function* layoutFocusTreeSteps(plan, options = {}) {
|
|
561
|
+
yield* cancellationCheckpoint(options.signal);
|
|
562
|
+
if (plan.focuses.length > FOCUS_GRAPH_MAX_NODES) {
|
|
563
|
+
throw new ServiceError('FOCUS_LAYOUT_NODE_BUDGET_BLOCKED', 'Focus layout exceeds the fixed node ceiling', { nodes: plan.focuses.length, maximumNodes: FOCUS_GRAPH_MAX_NODES });
|
|
564
|
+
}
|
|
565
|
+
let edgeCount = 0;
|
|
566
|
+
for (const focus of plan.focuses) {
|
|
567
|
+
for (const group of focus.prerequisites.groups) {
|
|
568
|
+
if (group.focusIds.length > FOCUS_GRAPH_MAX_EDGES - edgeCount) {
|
|
569
|
+
throw new ServiceError('FOCUS_LAYOUT_EDGE_BUDGET_BLOCKED', 'Focus layout exceeds the fixed graph edge ceiling', { edges: edgeCount + group.focusIds.length, maximumEdges: FOCUS_GRAPH_MAX_EDGES });
|
|
570
|
+
}
|
|
571
|
+
edgeCount += group.focusIds.length;
|
|
572
|
+
}
|
|
573
|
+
const additionalEdges = focus.mutuallyExclusive.length + (focus.position.mode === 'relative' ? 1 : 0);
|
|
574
|
+
if (additionalEdges > FOCUS_GRAPH_MAX_EDGES - edgeCount) {
|
|
575
|
+
throw new ServiceError('FOCUS_LAYOUT_EDGE_BUDGET_BLOCKED', 'Focus layout exceeds the fixed graph edge ceiling', { edges: edgeCount + additionalEdges, maximumEdges: FOCUS_GRAPH_MAX_EDGES });
|
|
576
|
+
}
|
|
577
|
+
edgeCount += additionalEdges;
|
|
578
|
+
}
|
|
579
|
+
const diagnostics = new DiagnosticCollector(FOCUS_DIAGNOSTIC_MAX, {
|
|
580
|
+
code: 'FOCUS_LAYOUT_DIAGNOSTICS_TRUNCATED',
|
|
581
|
+
category: 'layout',
|
|
582
|
+
message: 'Focus layout diagnostics exceeded the fixed global result ceiling',
|
|
583
|
+
});
|
|
584
|
+
const focuses = new Map();
|
|
585
|
+
for (const [focusIndex, focus] of plan.focuses.entries()) {
|
|
586
|
+
yield* cancellationCheckpoint(options.signal, focusIndex, 32);
|
|
587
|
+
if (focuses.has(focus.id)) {
|
|
588
|
+
diagnostics.push({
|
|
589
|
+
code: 'FOCUS_LAYOUT_DUPLICATE_ID',
|
|
590
|
+
severity: 'error',
|
|
591
|
+
category: 'layout',
|
|
592
|
+
message: `Cannot lay out duplicate focus ID ${focus.id}`,
|
|
593
|
+
...(focus.sourceLocation === undefined ? {} : { location: focus.sourceLocation }),
|
|
594
|
+
});
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
focuses.set(focus.id, focus);
|
|
598
|
+
}
|
|
599
|
+
const laneIds = new Map([...focuses.values()].map((focus) => [focus.id, laneFor(plan, focus)]));
|
|
600
|
+
const discoveredLanes = [...new Set(laneIds.values())].sort((left, right) => compareCodeUnits(left, right));
|
|
601
|
+
const context = {
|
|
602
|
+
plan,
|
|
603
|
+
focuses,
|
|
604
|
+
previous: new Map(options.previous?.nodes.map((node) => [node.id, node]) ?? []),
|
|
605
|
+
placed: new Map(),
|
|
606
|
+
occupied: new Map(),
|
|
607
|
+
mutualExclusions: mutualExclusionMap(focuses),
|
|
608
|
+
laneBases: laneBases(plan, discoveredLanes, options.laneSpacing ?? 8),
|
|
609
|
+
laneIds,
|
|
610
|
+
nodeSpacing: options.nodeSpacing ?? 2,
|
|
611
|
+
minimumMutualExclusionSpacing: options.nodeSpacing ?? 2,
|
|
612
|
+
decisions: [],
|
|
613
|
+
diagnostics,
|
|
614
|
+
work: new LayoutWorkBudget(),
|
|
615
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
616
|
+
};
|
|
617
|
+
const ordered = [...focuses.values()].sort((left, right) => {
|
|
618
|
+
const priority = (focus) => {
|
|
619
|
+
if (focus.position.mode === 'fixed')
|
|
620
|
+
return 0;
|
|
621
|
+
if (focus.position.mode === 'relative')
|
|
622
|
+
return 1;
|
|
623
|
+
return context.previous.has(focus.id) ? 2 : 3;
|
|
624
|
+
};
|
|
625
|
+
return priority(left) - priority(right) || compareCodeUnits(left.id, right.id);
|
|
626
|
+
});
|
|
627
|
+
for (const [focusIndex, focus] of ordered.entries()) {
|
|
628
|
+
yield* cancellationCheckpoint(options.signal, focusIndex, 8);
|
|
629
|
+
yield* placeFocus(context, focus.id);
|
|
630
|
+
}
|
|
631
|
+
yield* parentOrderDiagnostics(context);
|
|
632
|
+
yield* visibleOverlapDiagnostics(context);
|
|
633
|
+
yield* mutualExclusionSpacingDiagnostics(context);
|
|
634
|
+
yield* connectorCrossingDiagnostics(context);
|
|
635
|
+
const nodes = [...context.placed.values()].sort((left, right) => compareCodeUnits(left.id, right.id));
|
|
636
|
+
const decisions = [...context.decisions].sort((left, right) => compareCodeUnits(left.focusId, right.focusId));
|
|
637
|
+
yield* cancellationCheckpoint(options.signal);
|
|
638
|
+
return {
|
|
639
|
+
treeId: plan.id,
|
|
640
|
+
nodes,
|
|
641
|
+
decisions,
|
|
642
|
+
diagnostics: sortDiagnostics(context.diagnostics.values()),
|
|
643
|
+
layoutHash: hashCanonical(nodes.map(({ id, x, y, laneId }) => ({ id, laneId, x, y }))),
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
export function layoutFocusTree(plan, options = {}) {
|
|
647
|
+
return completeSynchronously(layoutFocusTreeSteps(plan, options));
|
|
648
|
+
}
|
|
649
|
+
/** Runs the same deterministic layout while yielding so protocol cancellation can be observed. */
|
|
650
|
+
export async function layoutFocusTreeAsync(plan, options = {}) {
|
|
651
|
+
return completeCooperatively(layoutFocusTreeSteps(plan, options), options.signal);
|
|
652
|
+
}
|
|
653
|
+
//# sourceMappingURL=layout.js.map
|