hoi4-agent-tools 0.2.0 → 1.0.0
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 +12 -118
- package/README.md +35 -127
- package/SECURITY.md +5 -7
- package/dist/bin/http.js +0 -1
- package/dist/bin/setup.js +141 -92
- package/dist/bin/stdio.js +0 -1
- package/dist/hoi4_agent_tools/core/artifacts.js +0 -1
- package/dist/hoi4_agent_tools/core/canonical.js +0 -1
- package/dist/hoi4_agent_tools/core/configuration.js +28 -28
- package/dist/hoi4_agent_tools/core/diagnostic-collector.js +0 -1
- package/dist/hoi4_agent_tools/core/diagnostics.js +0 -1
- package/dist/hoi4_agent_tools/core/diff.js +0 -1
- package/dist/hoi4_agent_tools/core/engine.js +6 -21
- package/dist/hoi4_agent_tools/core/image-diff.js +0 -1
- package/dist/hoi4_agent_tools/core/index.js +0 -1
- package/dist/hoi4_agent_tools/core/render-budget.js +0 -1
- package/dist/hoi4_agent_tools/core/result.js +0 -1
- package/dist/hoi4_agent_tools/core/scanner.js +0 -1
- package/dist/hoi4_agent_tools/core/server-state.js +0 -1
- package/dist/hoi4_agent_tools/core/source/encoding.js +0 -1
- package/dist/hoi4_agent_tools/core/source/index.js +0 -1
- package/dist/hoi4_agent_tools/core/source/lexer.js +0 -1
- package/dist/hoi4_agent_tools/core/source/limits.js +0 -1
- package/dist/hoi4_agent_tools/core/source/localisation.js +0 -1
- package/dist/hoi4_agent_tools/core/source/parser.js +0 -1
- package/dist/hoi4_agent_tools/core/source/rewrite.js +0 -1
- package/dist/hoi4_agent_tools/core/svg-text.js +0 -1
- package/dist/hoi4_agent_tools/core/transaction-limits.js +0 -1
- package/dist/hoi4_agent_tools/core/transactions.js +2 -30
- package/dist/hoi4_agent_tools/core/workspace.js +112 -396
- package/dist/hoi4_agent_tools/focus/compiler.js +0 -1
- package/dist/hoi4_agent_tools/focus/continuous-render.js +0 -1
- package/dist/hoi4_agent_tools/focus/drift.js +0 -1
- package/dist/hoi4_agent_tools/focus/geometry.js +0 -1
- package/dist/hoi4_agent_tools/focus/importer.js +0 -1
- package/dist/hoi4_agent_tools/focus/index.js +0 -1
- package/dist/hoi4_agent_tools/focus/layout.js +0 -1
- package/dist/hoi4_agent_tools/focus/limits.js +0 -1
- package/dist/hoi4_agent_tools/focus/lint.js +0 -1
- package/dist/hoi4_agent_tools/focus/model.js +0 -1
- package/dist/hoi4_agent_tools/focus/native-effects.js +0 -1
- package/dist/hoi4_agent_tools/focus/planning.js +0 -1
- package/dist/hoi4_agent_tools/focus/presentation.js +0 -1
- package/dist/hoi4_agent_tools/focus/render.js +0 -1
- package/dist/hoi4_agent_tools/focus/service.js +7 -8
- package/dist/hoi4_agent_tools/focus/source-update.js +1 -2
- package/dist/hoi4_agent_tools/gui/animation-manifest.js +0 -1
- package/dist/hoi4_agent_tools/gui/assets.js +0 -1
- package/dist/hoi4_agent_tools/gui/dds.js +0 -1
- package/dist/hoi4_agent_tools/gui/helpers.js +1 -2
- package/dist/hoi4_agent_tools/gui/index.js +0 -1
- package/dist/hoi4_agent_tools/gui/layout.js +0 -1
- package/dist/hoi4_agent_tools/gui/limits.js +0 -1
- package/dist/hoi4_agent_tools/gui/renderer.js +0 -1
- package/dist/hoi4_agent_tools/gui/scenario.js +0 -1
- package/dist/hoi4_agent_tools/gui/source-graph.js +0 -1
- package/dist/hoi4_agent_tools/gui/source-patch.js +1 -2
- package/dist/hoi4_agent_tools/gui/studio.js +247 -104
- package/dist/hoi4_agent_tools/gui/tga.js +0 -1
- package/dist/hoi4_agent_tools/gui/types.js +0 -1
- package/dist/hoi4_agent_tools/gui/validators.js +0 -1
- package/dist/hoi4_agent_tools/map/bmp.js +0 -1
- package/dist/hoi4_agent_tools/map/diagnostic-limit.js +0 -1
- package/dist/hoi4_agent_tools/map/index.js +0 -1
- package/dist/hoi4_agent_tools/map/limits.js +2 -1
- package/dist/hoi4_agent_tools/map/model.js +0 -1
- package/dist/hoi4_agent_tools/map/operations.js +0 -1
- package/dist/hoi4_agent_tools/map/render.js +0 -1
- package/dist/hoi4_agent_tools/map/service.js +171 -33
- package/dist/hoi4_agent_tools/map/validation.js +0 -1
- package/dist/hoi4_agent_tools/mcp/resources/register.js +61 -187
- package/dist/hoi4_agent_tools/mcp/security/auth.js +1 -2
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js +24 -750
- package/dist/hoi4_agent_tools/mcp/server/create.js +3 -12
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +0 -71
- package/dist/hoi4_agent_tools/mcp/server/progress.js +0 -1
- package/dist/hoi4_agent_tools/mcp/server/result.js +24 -30
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js +10 -14
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +219 -275
- package/dist/hoi4_agent_tools/mcp/tools/gui.js +149 -250
- package/dist/hoi4_agent_tools/mcp/tools/map.js +256 -337
- package/dist/hoi4_agent_tools/mcp/tools/mods.js +54 -0
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/event-store.js +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/http.js +1 -12
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js +0 -1
- package/dist/hoi4_agent_tools/runtime.js +5 -2
- package/dist/hoi4_agent_tools/schemas/common.js +1 -2
- package/dist/hoi4_agent_tools/schemas/focus.js +0 -1
- package/dist/hoi4_agent_tools/schemas/map.js +0 -1
- package/dist/hoi4_agent_tools/schemas/transaction.js +0 -1
- package/dist/hoi4_agent_tools/version.js +1 -2
- package/docs/README.md +8 -21
- package/docs/development.md +22 -0
- package/docs/focus.md +40 -0
- package/docs/gui.md +37 -0
- package/docs/http.md +53 -0
- package/docs/map.md +39 -0
- package/docs/setup.md +39 -0
- package/package.json +10 -11
- package/server.json +3 -12
- package/dist/bin/http.d.ts +0 -3
- package/dist/bin/http.d.ts.map +0 -1
- package/dist/bin/http.js.map +0 -1
- package/dist/bin/setup.d.ts +0 -3
- package/dist/bin/setup.d.ts.map +0 -1
- package/dist/bin/setup.js.map +0 -1
- package/dist/bin/stdio.d.ts +0 -3
- package/dist/bin/stdio.d.ts.map +0 -1
- package/dist/bin/stdio.js.map +0 -1
- package/dist/hoi4_agent_tools/core/artifacts.d.ts +0 -117
- package/dist/hoi4_agent_tools/core/artifacts.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/artifacts.js.map +0 -1
- package/dist/hoi4_agent_tools/core/canonical.d.ts +0 -13
- package/dist/hoi4_agent_tools/core/canonical.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/canonical.js.map +0 -1
- package/dist/hoi4_agent_tools/core/configuration.d.ts +0 -138
- package/dist/hoi4_agent_tools/core/configuration.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/configuration.js.map +0 -1
- package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts +0 -18
- package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/diagnostic-collector.js.map +0 -1
- package/dist/hoi4_agent_tools/core/diagnostics.d.ts +0 -26
- package/dist/hoi4_agent_tools/core/diagnostics.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/diagnostics.js.map +0 -1
- package/dist/hoi4_agent_tools/core/diff.d.ts +0 -22
- package/dist/hoi4_agent_tools/core/diff.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/diff.js.map +0 -1
- package/dist/hoi4_agent_tools/core/engine.d.ts +0 -57
- package/dist/hoi4_agent_tools/core/engine.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/engine.js.map +0 -1
- package/dist/hoi4_agent_tools/core/image-diff.d.ts +0 -14
- package/dist/hoi4_agent_tools/core/image-diff.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/image-diff.js.map +0 -1
- package/dist/hoi4_agent_tools/core/index.d.ts +0 -64
- package/dist/hoi4_agent_tools/core/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/index.js.map +0 -1
- package/dist/hoi4_agent_tools/core/index.public.d.ts +0 -16
- package/dist/hoi4_agent_tools/core/index.public.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/index.public.js +0 -16
- package/dist/hoi4_agent_tools/core/index.public.js.map +0 -1
- package/dist/hoi4_agent_tools/core/render-budget.d.ts +0 -51
- package/dist/hoi4_agent_tools/core/render-budget.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/render-budget.js.map +0 -1
- package/dist/hoi4_agent_tools/core/result.d.ts +0 -45
- package/dist/hoi4_agent_tools/core/result.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/result.js.map +0 -1
- package/dist/hoi4_agent_tools/core/scanner.d.ts +0 -28
- package/dist/hoi4_agent_tools/core/scanner.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/scanner.js.map +0 -1
- package/dist/hoi4_agent_tools/core/server-state.d.ts +0 -31
- package/dist/hoi4_agent_tools/core/server-state.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/server-state.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/encoding.d.ts +0 -10
- package/dist/hoi4_agent_tools/core/source/encoding.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/encoding.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/index.d.ts +0 -7
- package/dist/hoi4_agent_tools/core/source/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/index.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/lexer.d.ts +0 -30
- package/dist/hoi4_agent_tools/core/source/lexer.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/lexer.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/limits.d.ts +0 -21
- package/dist/hoi4_agent_tools/core/source/limits.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/limits.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/localisation.d.ts +0 -20
- package/dist/hoi4_agent_tools/core/source/localisation.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/localisation.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/parser.d.ts +0 -44
- package/dist/hoi4_agent_tools/core/source/parser.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/parser.js.map +0 -1
- package/dist/hoi4_agent_tools/core/source/rewrite.d.ts +0 -10
- package/dist/hoi4_agent_tools/core/source/rewrite.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/source/rewrite.js.map +0 -1
- package/dist/hoi4_agent_tools/core/svg-text.d.ts +0 -34
- package/dist/hoi4_agent_tools/core/svg-text.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/svg-text.js.map +0 -1
- package/dist/hoi4_agent_tools/core/transaction-limits.d.ts +0 -9
- package/dist/hoi4_agent_tools/core/transaction-limits.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/transaction-limits.js.map +0 -1
- package/dist/hoi4_agent_tools/core/transactions.d.ts +0 -164
- package/dist/hoi4_agent_tools/core/transactions.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/transactions.js.map +0 -1
- package/dist/hoi4_agent_tools/core/workspace.d.ts +0 -68
- package/dist/hoi4_agent_tools/core/workspace.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/core/workspace.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/compiler.d.ts +0 -10
- package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/compiler.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/continuous-render.d.ts +0 -32
- package/dist/hoi4_agent_tools/focus/continuous-render.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/continuous-render.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/drift.d.ts +0 -22
- package/dist/hoi4_agent_tools/focus/drift.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/drift.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/geometry.d.ts +0 -17
- package/dist/hoi4_agent_tools/focus/geometry.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/geometry.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/importer.d.ts +0 -9
- package/dist/hoi4_agent_tools/focus/importer.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/importer.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/index.d.ts +0 -14
- package/dist/hoi4_agent_tools/focus/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/index.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/layout.d.ts +0 -5
- package/dist/hoi4_agent_tools/focus/layout.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/layout.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/limits.d.ts +0 -9
- package/dist/hoi4_agent_tools/focus/limits.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/limits.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/lint.d.ts +0 -14
- package/dist/hoi4_agent_tools/focus/lint.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/lint.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/model.d.ts +0 -307
- package/dist/hoi4_agent_tools/focus/model.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/model.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/native-effects.d.ts +0 -9
- package/dist/hoi4_agent_tools/focus/native-effects.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/native-effects.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/planning.d.ts +0 -15
- package/dist/hoi4_agent_tools/focus/planning.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/planning.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/presentation.d.ts +0 -24
- package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/presentation.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/render.d.ts +0 -39
- package/dist/hoi4_agent_tools/focus/render.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/render.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/service.d.ts +0 -82
- package/dist/hoi4_agent_tools/focus/service.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/service.js.map +0 -1
- package/dist/hoi4_agent_tools/focus/source-update.d.ts +0 -6
- package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/focus/source-update.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts +0 -37
- package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/animation-manifest.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/assets.d.ts +0 -71
- package/dist/hoi4_agent_tools/gui/assets.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/assets.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/dds.d.ts +0 -17
- package/dist/hoi4_agent_tools/gui/dds.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/dds.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/helpers.d.ts +0 -101
- package/dist/hoi4_agent_tools/gui/helpers.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/helpers.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/index.d.ts +0 -15
- package/dist/hoi4_agent_tools/gui/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/index.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/layout.d.ts +0 -6
- package/dist/hoi4_agent_tools/gui/layout.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/layout.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/limits.d.ts +0 -25
- package/dist/hoi4_agent_tools/gui/limits.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/limits.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/renderer.d.ts +0 -18
- package/dist/hoi4_agent_tools/gui/renderer.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/renderer.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/scenario.d.ts +0 -66
- package/dist/hoi4_agent_tools/gui/scenario.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/scenario.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/source-graph.d.ts +0 -7
- package/dist/hoi4_agent_tools/gui/source-graph.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/source-graph.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/source-patch.d.ts +0 -13
- package/dist/hoi4_agent_tools/gui/source-patch.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/source-patch.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/studio.d.ts +0 -86
- package/dist/hoi4_agent_tools/gui/studio.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/studio.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/tga.d.ts +0 -16
- package/dist/hoi4_agent_tools/gui/tga.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/tga.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/types.d.ts +0 -322
- package/dist/hoi4_agent_tools/gui/types.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/types.js.map +0 -1
- package/dist/hoi4_agent_tools/gui/validators.d.ts +0 -8
- package/dist/hoi4_agent_tools/gui/validators.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/gui/validators.js.map +0 -1
- package/dist/hoi4_agent_tools/map/bmp.d.ts +0 -62
- package/dist/hoi4_agent_tools/map/bmp.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/bmp.js.map +0 -1
- package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts +0 -5
- package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/diagnostic-limit.js.map +0 -1
- package/dist/hoi4_agent_tools/map/index.d.ts +0 -8
- package/dist/hoi4_agent_tools/map/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/index.js.map +0 -1
- package/dist/hoi4_agent_tools/map/limits.d.ts +0 -13
- package/dist/hoi4_agent_tools/map/limits.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/limits.js.map +0 -1
- package/dist/hoi4_agent_tools/map/model.d.ts +0 -269
- package/dist/hoi4_agent_tools/map/model.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/model.js.map +0 -1
- package/dist/hoi4_agent_tools/map/operations.d.ts +0 -401
- package/dist/hoi4_agent_tools/map/operations.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/operations.js.map +0 -1
- package/dist/hoi4_agent_tools/map/render.d.ts +0 -90
- package/dist/hoi4_agent_tools/map/render.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/render.js.map +0 -1
- package/dist/hoi4_agent_tools/map/service.d.ts +0 -81
- package/dist/hoi4_agent_tools/map/service.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/service.js.map +0 -1
- package/dist/hoi4_agent_tools/map/validation.d.ts +0 -23
- package/dist/hoi4_agent_tools/map/validation.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/map/validation.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +0 -4
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/prompts/register.js +0 -72
- package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +0 -9
- package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/registry/metadata.js +0 -10
- package/dist/hoi4_agent_tools/mcp/registry/metadata.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/resources/register.d.ts +0 -5
- package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/resources/register.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/security/auth.d.ts +0 -24
- package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/security/auth.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +0 -47
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/create.d.ts +0 -5
- package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/create.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +0 -138
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/progress.d.ts +0 -8
- package/dist/hoi4_agent_tools/mcp/server/progress.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/progress.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/result.d.ts +0 -232
- package/dist/hoi4_agent_tools/mcp/server/result.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/result.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts +0 -31
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts +0 -5
- package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +0 -117
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +0 -5
- package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/tools/map.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +0 -58
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +0 -26
- package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +0 -28
- package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/http.js.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +0 -15
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +0 -1
- package/dist/hoi4_agent_tools/runtime.d.ts +0 -4
- package/dist/hoi4_agent_tools/runtime.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/runtime.js.map +0 -1
- package/dist/hoi4_agent_tools/schemas/common.d.ts +0 -74
- package/dist/hoi4_agent_tools/schemas/common.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/schemas/common.js.map +0 -1
- package/dist/hoi4_agent_tools/schemas/focus.d.ts +0 -784
- package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/schemas/focus.js.map +0 -1
- package/dist/hoi4_agent_tools/schemas/index.d.ts +0 -5
- package/dist/hoi4_agent_tools/schemas/index.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/schemas/index.js +0 -5
- package/dist/hoi4_agent_tools/schemas/index.js.map +0 -1
- package/dist/hoi4_agent_tools/schemas/map.d.ts +0 -654
- package/dist/hoi4_agent_tools/schemas/map.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/schemas/map.js.map +0 -1
- package/dist/hoi4_agent_tools/schemas/transaction.d.ts +0 -259
- package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/schemas/transaction.js.map +0 -1
- package/dist/hoi4_agent_tools/version.d.ts +0 -6
- package/dist/hoi4_agent_tools/version.d.ts.map +0 -1
- package/dist/hoi4_agent_tools/version.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/docs/adr/0001-runtime-and-language.md +0 -16
- package/docs/adr/0002-lossless-source-model.md +0 -18
- package/docs/adr/0003-image-and-font-codecs.md +0 -18
- package/docs/adr/0004-focus-layout.md +0 -16
- package/docs/adr/0005-offline-rendering.md +0 -18
- package/docs/adr/0006-mcp-sdk-and-protocol.md +0 -16
- package/docs/adr/0007-storage-and-transactions.md +0 -24
- package/docs/adr/0008-test-strategy.md +0 -18
- package/docs/adr/0009-packaging-and-registry.md +0 -16
- package/docs/adr/0010-unsupported-and-refusal-policy.md +0 -18
- package/docs/adr/0011-http-security.md +0 -16
- package/docs/adr/0012-autonomous-rewrites.md +0 -55
- package/docs/adr/README.md +0 -14
- package/docs/agent-integration.md +0 -146
- package/docs/architecture.md +0 -76
- package/docs/artifacts.md +0 -136
- package/docs/compatibility.md +0 -33
- package/docs/completion-report.md +0 -122
- package/docs/configuration.md +0 -305
- package/docs/focus-workflow.md +0 -197
- package/docs/gui-workflow.md +0 -125
- package/docs/limitations.md +0 -32
- package/docs/map-workflow.md +0 -95
- package/docs/performance.md +0 -117
- package/docs/release.md +0 -222
- package/docs/research/mcp-2026-07-10.md +0 -52
- package/docs/research/source-ledger.md +0 -68
- package/docs/security.md +0 -145
- package/docs/self-hosting.md +0 -170
- package/docs/testing.md +0 -43
- package/docs/third-party-notices.md +0 -11
- package/docs/transactions.md +0 -180
- package/docs/troubleshooting.md +0 -54
- package/schemas/configuration.schema.json +0 -795
- package/schemas/continuous-focus-palette.schema.json +0 -325
- package/schemas/focus-plan.schema.json +0 -927
- package/schemas/focus-planning-sidecar.schema.json +0 -379
- package/schemas/gui-animation-source.schema.json +0 -176
- package/schemas/gui-helper.schema.json +0 -301
- package/schemas/gui-scenario.schema.json +0 -298
- package/schemas/map-operation.schema.json +0 -2284
- package/schemas/operation-result.schema.json +0 -344
- package/schemas/transaction-manifest.schema.json +0 -685
|
@@ -6,19 +6,21 @@ import { RenderBudget } from '../../core/render-budget.js';
|
|
|
6
6
|
import { emptyServiceResult, ServiceError } from '../../core/result.js';
|
|
7
7
|
import { parseClausewitz } from '../../core/source/index.js';
|
|
8
8
|
import { readDependenciesFromScannedFiles } from '../../core/transactions.js';
|
|
9
|
-
import { FocusWorkbench, FOCUS_RENDER_MAX_OUTPUT_SCALE, FOCUS_RENDER_MIN_OUTPUT_SCALE,
|
|
10
|
-
import { continuousFocusPaletteSchema,
|
|
9
|
+
import { FocusWorkbench, FOCUS_RENDER_MAX_OUTPUT_SCALE, FOCUS_RENDER_MIN_OUTPUT_SCALE, focusPlanHash, focusPresentationEvidence, focusPlanningSidecarPath, importContinuousFocusPalettes, importFocusTrees, linkContinuousFocusPalettes, parseFocusPlanningSidecar, renderContinuousFocusPalette, renderFocusTree, resolveFocusPresentation, enrichFocusPlanFromSidecar, } from '../../focus/index.js';
|
|
10
|
+
import { continuousFocusPaletteSchema, focusLayoutSchema, focusTreePlanSchema, } from '../../schemas/focus.js';
|
|
11
11
|
import { workspaceIdSchema, workspaceRelativePathSchema } from '../../schemas/common.js';
|
|
12
12
|
import { PACKAGE_VERSION } from '../../version.js';
|
|
13
13
|
import { nonNegativeIntegerSchema, renderHashesSchema, sha256Schema, } from '../server/output-schemas.js';
|
|
14
14
|
import { progressReporter } from '../server/progress.js';
|
|
15
15
|
import { errorResult, setInlineFilesScanned, strictOperationResultSchema, toolResult, } from '../server/result.js';
|
|
16
|
-
import { requireServerScope
|
|
17
|
-
import { autonomousFailureContext, autonomousResultArtifacts,
|
|
18
|
-
const
|
|
16
|
+
import { requireServerScope } from '../server/base-tools.js';
|
|
17
|
+
import { autonomousFailureContext, autonomousResultArtifacts, executePlannedTransaction, } from '../server/transaction-execution.js';
|
|
18
|
+
const focusInspectOutputSchema = strictOperationResultSchema(z
|
|
19
19
|
.object({
|
|
20
|
+
mode: z.enum(['national', 'continuous']),
|
|
20
21
|
revision: sha256Schema,
|
|
21
22
|
treeCount: nonNegativeIntegerSchema,
|
|
23
|
+
paletteCount: nonNegativeIntegerSchema,
|
|
22
24
|
trees: z
|
|
23
25
|
.array(z
|
|
24
26
|
.object({
|
|
@@ -29,36 +31,22 @@ const focusScanOutputSchema = strictOperationResultSchema(z
|
|
|
29
31
|
continuousPaletteCount: nonNegativeIntegerSchema,
|
|
30
32
|
continuousFocusCount: nonNegativeIntegerSchema,
|
|
31
33
|
resolvedTitleCount: nonNegativeIntegerSchema,
|
|
32
|
-
})
|
|
33
|
-
.strict())
|
|
34
|
-
.max(100),
|
|
35
|
-
})
|
|
36
|
-
.strict());
|
|
37
|
-
const focusLintOutputSchema = strictOperationResultSchema(z.discriminatedUnion('mode', [
|
|
38
|
-
z
|
|
39
|
-
.object({
|
|
40
|
-
mode: z.literal('national'),
|
|
41
|
-
treeId: z.string().max(256),
|
|
42
|
-
focusCount: nonNegativeIntegerSchema,
|
|
43
34
|
layoutHash: sha256Schema,
|
|
35
|
+
layoutDecisionCount: nonNegativeIntegerSchema,
|
|
44
36
|
diagnosticCount: nonNegativeIntegerSchema,
|
|
45
37
|
})
|
|
46
|
-
.strict()
|
|
47
|
-
|
|
38
|
+
.strict())
|
|
39
|
+
.max(100),
|
|
40
|
+
palettes: z
|
|
41
|
+
.array(z
|
|
48
42
|
.object({
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
id: z.string().max(256),
|
|
44
|
+
sourcePath: z.string().max(4096),
|
|
51
45
|
focusCount: nonNegativeIntegerSchema,
|
|
52
46
|
diagnosticCount: nonNegativeIntegerSchema,
|
|
53
47
|
})
|
|
54
|
-
.strict()
|
|
55
|
-
|
|
56
|
-
const focusLayoutOutputSchema = strictOperationResultSchema(z
|
|
57
|
-
.object({
|
|
58
|
-
treeId: z.string().max(256),
|
|
59
|
-
layoutHash: sha256Schema,
|
|
60
|
-
nodeCount: nonNegativeIntegerSchema,
|
|
61
|
-
decisions: z.array(focusLayoutDecisionSchema).max(100),
|
|
48
|
+
.strict())
|
|
49
|
+
.max(100),
|
|
62
50
|
})
|
|
63
51
|
.strict());
|
|
64
52
|
const focusRenderOutputSchema = strictOperationResultSchema(z.discriminatedUnion('mode', [
|
|
@@ -97,12 +85,6 @@ const focusDriftBaseOutputSchema = z
|
|
|
97
85
|
]),
|
|
98
86
|
sourceChanged: z.boolean(),
|
|
99
87
|
planChanged: z.boolean(),
|
|
100
|
-
requiresAuthority: z.boolean(),
|
|
101
|
-
savedPlanHash: sha256Schema,
|
|
102
|
-
currentPlanHash: z.string().max(256),
|
|
103
|
-
importedPlanHash: sha256Schema,
|
|
104
|
-
savedSourceHash: sha256Schema,
|
|
105
|
-
currentSourceHash: sha256Schema,
|
|
106
88
|
})
|
|
107
89
|
.strict();
|
|
108
90
|
const focusDriftOutputSchema = focusDriftBaseOutputSchema;
|
|
@@ -114,11 +96,10 @@ const focusPlanOutputSchema = strictOperationResultSchema(z.discriminatedUnion('
|
|
|
114
96
|
treeId: z.string().max(256),
|
|
115
97
|
drift: focusDriftOutputSchema,
|
|
116
98
|
created: z.boolean(),
|
|
117
|
-
execution: z.enum(['
|
|
99
|
+
execution: z.enum(['applied', 'blocked', 'unchanged']),
|
|
118
100
|
layoutHash: sha256Schema,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
transactionArtifactCount: nonNegativeIntegerSchema,
|
|
101
|
+
fileCount: nonNegativeIntegerSchema,
|
|
102
|
+
artifactCount: nonNegativeIntegerSchema,
|
|
122
103
|
})
|
|
123
104
|
.strict(),
|
|
124
105
|
z
|
|
@@ -127,27 +108,22 @@ const focusPlanOutputSchema = strictOperationResultSchema(z.discriminatedUnion('
|
|
|
127
108
|
paletteId: z.string().max(256),
|
|
128
109
|
drift: continuousFocusDriftOutputSchema,
|
|
129
110
|
created: z.boolean(),
|
|
130
|
-
execution: z.enum(['
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
transactionArtifactCount: nonNegativeIntegerSchema,
|
|
111
|
+
execution: z.enum(['applied', 'blocked', 'unchanged']),
|
|
112
|
+
fileCount: nonNegativeIntegerSchema,
|
|
113
|
+
artifactCount: nonNegativeIntegerSchema,
|
|
134
114
|
})
|
|
135
115
|
.strict(),
|
|
136
116
|
]));
|
|
137
|
-
const
|
|
138
|
-
.object({
|
|
139
|
-
workspaceId: workspaceIdSchema,
|
|
140
|
-
relativePath: workspaceRelativePathSchema,
|
|
141
|
-
treeId: z.string().min(1).max(256).optional(),
|
|
142
|
-
})
|
|
143
|
-
.strict();
|
|
144
|
-
const focusLintInput = z
|
|
117
|
+
const focusInspectInput = z
|
|
145
118
|
.object({
|
|
146
119
|
mode: z.enum(['national', 'continuous']).optional(),
|
|
147
120
|
workspaceId: workspaceIdSchema,
|
|
148
|
-
relativePath: workspaceRelativePathSchema,
|
|
121
|
+
relativePath: workspaceRelativePathSchema.optional(),
|
|
149
122
|
treeId: z.string().min(1).max(256).optional(),
|
|
150
123
|
paletteId: z.string().min(1).max(256).optional(),
|
|
124
|
+
previous: focusLayoutSchema.optional(),
|
|
125
|
+
laneSpacing: z.number().int().min(1).max(100).optional(),
|
|
126
|
+
nodeSpacing: z.number().int().min(1).max(100).optional(),
|
|
151
127
|
})
|
|
152
128
|
.strict()
|
|
153
129
|
.superRefine((value, context) => {
|
|
@@ -164,6 +140,22 @@ const focusLintInput = z
|
|
|
164
140
|
path: ['treeId'],
|
|
165
141
|
message: 'treeId is only valid in national mode',
|
|
166
142
|
});
|
|
143
|
+
if (mode === 'continuous') {
|
|
144
|
+
for (const field of ['previous', 'laneSpacing', 'nodeSpacing']) {
|
|
145
|
+
if (value[field] !== undefined)
|
|
146
|
+
context.addIssue({
|
|
147
|
+
code: 'custom',
|
|
148
|
+
path: [field],
|
|
149
|
+
message: `${field} is only valid in national mode`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (value.previous !== undefined && value.treeId === undefined)
|
|
154
|
+
context.addIssue({
|
|
155
|
+
code: 'custom',
|
|
156
|
+
path: ['previous'],
|
|
157
|
+
message: 'previous requires treeId so it applies to exactly one tree',
|
|
158
|
+
});
|
|
167
159
|
});
|
|
168
160
|
const focusRenderInput = z
|
|
169
161
|
.object({
|
|
@@ -217,7 +209,6 @@ const focusPlanInput = z
|
|
|
217
209
|
workspaceId: workspaceIdSchema,
|
|
218
210
|
relativePath: workspaceRelativePathSchema,
|
|
219
211
|
plan: z.union([focusTreePlanSchema, continuousFocusPaletteSchema]),
|
|
220
|
-
authority: z.enum(['plan', 'source']).optional(),
|
|
221
212
|
createIfMissing: z.boolean().default(false),
|
|
222
213
|
horizontalSpacing: z.number().int().min(80).max(1000).optional(),
|
|
223
214
|
verticalSpacing: z.number().int().min(60).max(1000).optional(),
|
|
@@ -249,7 +240,7 @@ const focusPlanInput = z
|
|
|
249
240
|
context.addIssue({
|
|
250
241
|
code: 'custom',
|
|
251
242
|
path: [field],
|
|
252
|
-
message: `${field} is only valid for national focus
|
|
243
|
+
message: `${field} is only valid for national focus review renders`,
|
|
253
244
|
});
|
|
254
245
|
}
|
|
255
246
|
}
|
|
@@ -260,9 +251,17 @@ const artifactProducing = {
|
|
|
260
251
|
idempotentHint: true,
|
|
261
252
|
openWorldHint: false,
|
|
262
253
|
};
|
|
254
|
+
const LARGE_FOCUS_RENDER_NODE_THRESHOLD = 200;
|
|
255
|
+
const LARGE_FOCUS_RENDER_SCALE = 0.5;
|
|
256
|
+
function automaticFocusRenderScale(focusCount) {
|
|
257
|
+
return focusCount >= LARGE_FOCUS_RENDER_NODE_THRESHOLD ? LARGE_FOCUS_RENDER_SCALE : 1;
|
|
258
|
+
}
|
|
263
259
|
function compactDrift(drift) {
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
return {
|
|
261
|
+
status: drift.status,
|
|
262
|
+
sourceChanged: drift.sourceChanged,
|
|
263
|
+
planChanged: drift.planChanged,
|
|
264
|
+
};
|
|
266
265
|
}
|
|
267
266
|
function normalizedRoot(value) {
|
|
268
267
|
return value.replaceAll('\\', '/').replace(/^\.\//u, '').replace(/\/+$/u, '').toLowerCase();
|
|
@@ -392,25 +391,102 @@ function validationFromDiagnostics(diagnostics) {
|
|
|
392
391
|
};
|
|
393
392
|
}
|
|
394
393
|
export function registerFocusTools(server, engine, context) {
|
|
395
|
-
const autonomous = autonomousWrites(engine);
|
|
396
394
|
const workbench = new FocusWorkbench(engine.resolver, engine.transactions, engine.artifacts);
|
|
397
|
-
server.registerTool('hoi4.
|
|
398
|
-
title: '
|
|
399
|
-
description: '
|
|
400
|
-
inputSchema:
|
|
401
|
-
|
|
402
|
-
workspaceId: workspaceIdSchema,
|
|
403
|
-
relativePath: workspaceRelativePathSchema.optional(),
|
|
404
|
-
})
|
|
405
|
-
.strict(),
|
|
406
|
-
outputSchema: focusScanOutputSchema,
|
|
395
|
+
server.registerTool('hoi4.focus_inspect', {
|
|
396
|
+
title: 'Inspect focus trees',
|
|
397
|
+
description: 'Inspect national trees or continuous palettes for creation and cleanup, including complete plans, references, diagnostics, and stable layout decisions.',
|
|
398
|
+
inputSchema: focusInspectInput,
|
|
399
|
+
outputSchema: focusInspectOutputSchema,
|
|
407
400
|
annotations: artifactProducing,
|
|
408
|
-
}, async (
|
|
401
|
+
}, async (input, extra) => {
|
|
402
|
+
const { workspaceId, relativePath } = input;
|
|
409
403
|
try {
|
|
410
404
|
const progress = progressReporter(extra);
|
|
411
405
|
await progress.report(0, 3, 'Building shared workspace index');
|
|
412
406
|
const snapshot = await engine.scan(workspaceId, {}, context.principal, progress.signal);
|
|
413
407
|
const workspace = engine.resolver.get(workspaceId, context.principal);
|
|
408
|
+
if (input.mode === 'continuous') {
|
|
409
|
+
const selectedFiles = activeContinuousFocusFiles(snapshot).filter((file) => relativePath === undefined || file.relativePath === relativePath);
|
|
410
|
+
if (selectedFiles.length === 0) {
|
|
411
|
+
throw new ServiceError('CONTINUOUS_FOCUS_SOURCE_NOT_FOUND', 'No active continuous focus source matched the request');
|
|
412
|
+
}
|
|
413
|
+
const diagnostics = [];
|
|
414
|
+
const importedPalettes = [];
|
|
415
|
+
for (const file of selectedFiles) {
|
|
416
|
+
progress.signal.throwIfAborted();
|
|
417
|
+
const imported = importContinuousFocusPalettes(parseClausewitz(file.bytes, file.displayPath));
|
|
418
|
+
importedPalettes.push(...imported.continuousFocusPalettes);
|
|
419
|
+
diagnostics.push(...imported.diagnostics);
|
|
420
|
+
}
|
|
421
|
+
const palettes = importedPalettes.filter(({ id }) => input.paletteId === undefined || id === input.paletteId);
|
|
422
|
+
if (palettes.length === 0) {
|
|
423
|
+
throw new ServiceError('CONTINUOUS_FOCUS_PALETTE_NOT_FOUND', input.paletteId === undefined
|
|
424
|
+
? 'The selected source contains no continuous focus palette'
|
|
425
|
+
: `Continuous focus palette was not found: ${input.paletteId}`);
|
|
426
|
+
}
|
|
427
|
+
const paletteDiagnosticCounts = new Map();
|
|
428
|
+
for (const palette of palettes) {
|
|
429
|
+
const lintDiagnostics = workbench.lintContinuous(palette);
|
|
430
|
+
paletteDiagnosticCounts.set(palette.id, lintDiagnostics.length);
|
|
431
|
+
diagnostics.push(...lintDiagnostics);
|
|
432
|
+
}
|
|
433
|
+
const presentation = await resolveFocusPresentation({
|
|
434
|
+
plans: [],
|
|
435
|
+
palettes,
|
|
436
|
+
files: snapshot.files,
|
|
437
|
+
index: snapshot.index,
|
|
438
|
+
scanner: engine.scanner,
|
|
439
|
+
workspace,
|
|
440
|
+
signal: progress.signal,
|
|
441
|
+
});
|
|
442
|
+
diagnostics.push(...presentation.diagnostics);
|
|
443
|
+
await progress.report(2, 3, 'Writing continuous focus inspection');
|
|
444
|
+
const completeSourceHashes = Object.fromEntries(Object.entries({
|
|
445
|
+
...Object.fromEntries(selectedFiles.map(({ displayPath, sha256 }) => [displayPath, sha256])),
|
|
446
|
+
...presentation.sourceHashes,
|
|
447
|
+
}).sort(([left], [right]) => compareCodeUnits(left, right)));
|
|
448
|
+
const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
|
|
449
|
+
const artifact = await engine.artifacts.putChunked(workspace, `focus-inspect.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
|
|
450
|
+
schemaVersion: 1,
|
|
451
|
+
mode: 'continuous',
|
|
452
|
+
revision: snapshot.revision,
|
|
453
|
+
continuousFocusPalettes: palettes,
|
|
454
|
+
presentation: focusPresentationEvidence(presentation),
|
|
455
|
+
sourceHashes: completeSourceHashes,
|
|
456
|
+
diagnostics,
|
|
457
|
+
})}\n`, {
|
|
458
|
+
kind: 'focus-inspect',
|
|
459
|
+
toolVersion: PACKAGE_VERSION,
|
|
460
|
+
schemaVersion: 'focus-inspect.v1',
|
|
461
|
+
sourceHashes: sourceEvidence.sourceHashes,
|
|
462
|
+
metadata: { sourceHashInventory: sourceEvidence.inventory },
|
|
463
|
+
}, 'Continuous focus plans and diagnostics', progress.signal);
|
|
464
|
+
const result = emptyServiceResult(workspaceId, {
|
|
465
|
+
mode: 'continuous',
|
|
466
|
+
revision: snapshot.revision,
|
|
467
|
+
treeCount: 0,
|
|
468
|
+
paletteCount: palettes.length,
|
|
469
|
+
trees: [],
|
|
470
|
+
palettes: palettes.slice(0, 100).map((palette) => ({
|
|
471
|
+
id: palette.id,
|
|
472
|
+
sourcePath: palette.provenance.sourcePath,
|
|
473
|
+
focusCount: palette.focuses.length,
|
|
474
|
+
diagnosticCount: paletteDiagnosticCounts.get(palette.id) ?? 0,
|
|
475
|
+
})),
|
|
476
|
+
});
|
|
477
|
+
result.code = 'FOCUS_INSPECTED';
|
|
478
|
+
setInlineFilesScanned(result, [
|
|
479
|
+
...new Set([
|
|
480
|
+
...selectedFiles.map(({ displayPath }) => displayPath),
|
|
481
|
+
...presentation.filesScanned,
|
|
482
|
+
]),
|
|
483
|
+
].sort((left, right) => compareCodeUnits(left, right)));
|
|
484
|
+
result.diagnostics = diagnostics.slice(0, 100);
|
|
485
|
+
result.artifacts = [publicArtifactLink(artifact)];
|
|
486
|
+
result.validation = validationFromDiagnostics(diagnostics);
|
|
487
|
+
await progress.report(3, 3, 'Continuous focus inspection complete');
|
|
488
|
+
return toolResult(result);
|
|
489
|
+
}
|
|
414
490
|
const selectedFiles = activeFocusFiles(snapshot, workspace.registration.roots.focus).filter((file) => relativePath === undefined || file.relativePath === relativePath);
|
|
415
491
|
if (selectedFiles.length === 0) {
|
|
416
492
|
throw new ServiceError('FOCUS_SOURCE_NOT_FOUND', 'No active focus source matched the request');
|
|
@@ -419,16 +495,40 @@ export function registerFocusTools(server, engine, context) {
|
|
|
419
495
|
const resolved = activeSidecar(snapshot, file);
|
|
420
496
|
return resolved === undefined ? [] : [resolved.file];
|
|
421
497
|
});
|
|
422
|
-
const
|
|
498
|
+
const importedPlans = [];
|
|
423
499
|
const diagnostics = [];
|
|
424
500
|
const paletteImport = continuousPalettes(snapshot);
|
|
425
501
|
diagnostics.push(...paletteImport.diagnostics);
|
|
426
502
|
for (const file of selectedFiles) {
|
|
427
503
|
progress.signal.throwIfAborted();
|
|
428
504
|
const imported = importFocusFile(snapshot, file, paletteImport.palettes);
|
|
429
|
-
|
|
505
|
+
importedPlans.push(...imported.plans);
|
|
430
506
|
diagnostics.push(...imported.diagnostics);
|
|
431
507
|
}
|
|
508
|
+
const plans = importedPlans.filter(({ id }) => input.treeId === undefined || id === input.treeId);
|
|
509
|
+
if (plans.length === 0) {
|
|
510
|
+
throw new ServiceError('FOCUS_TREE_NOT_FOUND', input.treeId === undefined
|
|
511
|
+
? 'The selected source contains no national focus tree'
|
|
512
|
+
: `Focus tree was not found: ${input.treeId}`);
|
|
513
|
+
}
|
|
514
|
+
const inspectedPlans = [];
|
|
515
|
+
for (const plan of plans) {
|
|
516
|
+
const layout = await workbench.layoutAsync(plan, {
|
|
517
|
+
...(input.previous === undefined
|
|
518
|
+
? {}
|
|
519
|
+
: { previous: input.previous }),
|
|
520
|
+
...(input.laneSpacing === undefined ? {} : { laneSpacing: input.laneSpacing }),
|
|
521
|
+
...(input.nodeSpacing === undefined ? {} : { nodeSpacing: input.nodeSpacing }),
|
|
522
|
+
signal: progress.signal,
|
|
523
|
+
});
|
|
524
|
+
const lintDiagnostics = workbench.lint(plan, {
|
|
525
|
+
index: snapshot.index,
|
|
526
|
+
references: referenceCatalog(snapshot),
|
|
527
|
+
layout,
|
|
528
|
+
});
|
|
529
|
+
diagnostics.push(...lintDiagnostics);
|
|
530
|
+
inspectedPlans.push({ plan, layout, diagnosticCount: lintDiagnostics.length });
|
|
531
|
+
}
|
|
432
532
|
const presentation = await resolveFocusPresentation({
|
|
433
533
|
plans,
|
|
434
534
|
palettes: paletteImport.palettes,
|
|
@@ -439,7 +539,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
439
539
|
signal: progress.signal,
|
|
440
540
|
});
|
|
441
541
|
diagnostics.push(...presentation.diagnostics);
|
|
442
|
-
await progress.report(2, 3, 'Writing
|
|
542
|
+
await progress.report(2, 3, 'Writing focus plans, diagnostics, and layouts');
|
|
443
543
|
const completeSourceHashes = Object.fromEntries(Object.entries({
|
|
444
544
|
...Object.fromEntries([
|
|
445
545
|
...selectedFiles,
|
|
@@ -449,25 +549,32 @@ export function registerFocusTools(server, engine, context) {
|
|
|
449
549
|
...presentation.sourceHashes,
|
|
450
550
|
}).sort(([left], [right]) => compareCodeUnits(left, right)));
|
|
451
551
|
const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
|
|
452
|
-
const artifact = await engine.artifacts.putChunked(workspace, `focus-
|
|
552
|
+
const artifact = await engine.artifacts.putChunked(workspace, `focus-inspect.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
|
|
453
553
|
schemaVersion: 1,
|
|
454
554
|
revision: snapshot.revision,
|
|
455
555
|
plans,
|
|
556
|
+
layouts: inspectedPlans.map(({ plan, layout, diagnosticCount }) => ({
|
|
557
|
+
treeId: plan.id,
|
|
558
|
+
layout,
|
|
559
|
+
diagnosticCount,
|
|
560
|
+
})),
|
|
456
561
|
continuousFocusPalettes: paletteImport.palettes,
|
|
457
562
|
presentation: focusPresentationEvidence(presentation),
|
|
458
563
|
sourceHashes: completeSourceHashes,
|
|
459
564
|
diagnostics,
|
|
460
565
|
})}\n`, {
|
|
461
|
-
kind: 'focus-
|
|
566
|
+
kind: 'focus-inspect',
|
|
462
567
|
toolVersion: PACKAGE_VERSION,
|
|
463
|
-
schemaVersion: 'focus-
|
|
568
|
+
schemaVersion: 'focus-inspect.v1',
|
|
464
569
|
sourceHashes: sourceEvidence.sourceHashes,
|
|
465
570
|
metadata: { sourceHashInventory: sourceEvidence.inventory },
|
|
466
|
-
}, '
|
|
571
|
+
}, 'Focus plans, diagnostics, and stable layout decisions', progress.signal);
|
|
467
572
|
const result = emptyServiceResult(workspaceId, {
|
|
573
|
+
mode: 'national',
|
|
468
574
|
revision: snapshot.revision,
|
|
469
575
|
treeCount: plans.length,
|
|
470
|
-
|
|
576
|
+
paletteCount: paletteImport.palettes.length,
|
|
577
|
+
trees: inspectedPlans.slice(0, 100).map(({ plan, layout, diagnosticCount }) => ({
|
|
471
578
|
id: plan.id,
|
|
472
579
|
sourcePath: plan.provenance.sourcePath,
|
|
473
580
|
focusCount: plan.focuses.length,
|
|
@@ -475,9 +582,13 @@ export function registerFocusTools(server, engine, context) {
|
|
|
475
582
|
continuousPaletteCount: plan.continuousFocusPaletteIds.length,
|
|
476
583
|
continuousFocusCount: plan.continuousFocusIds.length,
|
|
477
584
|
resolvedTitleCount: plan.focuses.filter(({ id }) => presentation.entries[id]?.titleSourceLocation !== undefined).length,
|
|
585
|
+
layoutHash: layout.layoutHash,
|
|
586
|
+
layoutDecisionCount: layout.decisions.length,
|
|
587
|
+
diagnosticCount,
|
|
478
588
|
})),
|
|
589
|
+
palettes: [],
|
|
479
590
|
});
|
|
480
|
-
result.code = '
|
|
591
|
+
result.code = 'FOCUS_INSPECTED';
|
|
481
592
|
setInlineFilesScanned(result, [
|
|
482
593
|
...new Set([
|
|
483
594
|
...selectedFiles.map(({ displayPath }) => displayPath),
|
|
@@ -489,143 +600,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
489
600
|
result.diagnostics = diagnostics.slice(0, 100);
|
|
490
601
|
result.artifacts = [publicArtifactLink(artifact)];
|
|
491
602
|
result.validation = validationFromDiagnostics(diagnostics);
|
|
492
|
-
await progress.report(3, 3, 'Focus
|
|
493
|
-
return toolResult(result);
|
|
494
|
-
}
|
|
495
|
-
catch (error) {
|
|
496
|
-
return errorResult(error, workspaceId);
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
server.registerTool('hoi4.focus_lint', {
|
|
500
|
-
title: 'Lint focus source',
|
|
501
|
-
description: 'Lint one national focus tree or continuous focus palette. Omit mode for backward-compatible national behavior.',
|
|
502
|
-
inputSchema: focusLintInput,
|
|
503
|
-
outputSchema: focusLintOutputSchema,
|
|
504
|
-
annotations: artifactProducing,
|
|
505
|
-
}, async (input, extra) => {
|
|
506
|
-
const { workspaceId, relativePath } = input;
|
|
507
|
-
try {
|
|
508
|
-
const progress = progressReporter(extra);
|
|
509
|
-
await progress.report(0, 3, 'Importing and indexing focus source');
|
|
510
|
-
const snapshot = await engine.scan(workspaceId, {}, context.principal, progress.signal);
|
|
511
|
-
const workspace = engine.resolver.get(workspaceId, context.principal);
|
|
512
|
-
if (input.mode === 'continuous') {
|
|
513
|
-
selectedContinuousFocusFile(snapshot, relativePath);
|
|
514
|
-
const imported = await workbench.importContinuousPath(workspaceId, relativePath, context.principal);
|
|
515
|
-
const plan = selectContinuousPlan(imported.result, input.paletteId);
|
|
516
|
-
const diagnostics = [...imported.result.diagnostics, ...workbench.lintContinuous(plan)];
|
|
517
|
-
await progress.report(2, 3, 'Writing continuous focus lint evidence');
|
|
518
|
-
const artifact = await engine.artifacts.put(workspace, `${plan.id.replace(/[^A-Za-z0-9._-]/gu, '_')}.continuous-focus-lint.json`, 'application/json', `${canonicalJson({ schemaVersion: 1, mode: 'continuous', paletteId: plan.id, diagnostics })}\n`, {
|
|
519
|
-
kind: 'continuous-focus-lint',
|
|
520
|
-
toolVersion: PACKAGE_VERSION,
|
|
521
|
-
schemaVersion: 'continuous-focus-lint.v1',
|
|
522
|
-
sourceHashes: { [plan.provenance.sourcePath]: plan.provenance.sourceHash },
|
|
523
|
-
}, 'Complete continuous focus lint report', progress.signal);
|
|
524
|
-
const result = emptyServiceResult(workspaceId, {
|
|
525
|
-
mode: 'continuous',
|
|
526
|
-
paletteId: plan.id,
|
|
527
|
-
focusCount: plan.focuses.length,
|
|
528
|
-
diagnosticCount: diagnostics.length,
|
|
529
|
-
});
|
|
530
|
-
result.code = 'CONTINUOUS_FOCUS_LINTED';
|
|
531
|
-
setInlineFilesScanned(result, [plan.provenance.sourcePath]);
|
|
532
|
-
result.diagnostics = diagnostics.slice(0, 100);
|
|
533
|
-
result.artifacts = [publicArtifactLink(artifact)];
|
|
534
|
-
result.validation = validationFromDiagnostics(diagnostics);
|
|
535
|
-
await progress.report(3, 3, 'Continuous focus lint complete');
|
|
536
|
-
return toolResult(result);
|
|
537
|
-
}
|
|
538
|
-
const paletteImport = continuousPalettes(snapshot);
|
|
539
|
-
const imported = importFocusFile(snapshot, selectedFocusFile(snapshot, workspace.registration.roots.focus, relativePath), paletteImport.palettes);
|
|
540
|
-
const plan = selectPlan(imported, input.treeId);
|
|
541
|
-
const layout = await workbench.layoutAsync(plan, { signal: progress.signal });
|
|
542
|
-
const diagnostics = [
|
|
543
|
-
...paletteImport.diagnostics,
|
|
544
|
-
...imported.diagnostics,
|
|
545
|
-
...workbench.lint(plan, {
|
|
546
|
-
index: snapshot.index,
|
|
547
|
-
references: referenceCatalog(snapshot),
|
|
548
|
-
layout,
|
|
549
|
-
}),
|
|
550
|
-
];
|
|
551
|
-
await progress.report(2, 3, 'Writing focus lint evidence');
|
|
552
|
-
const artifact = await engine.artifacts.put(workspace, `${plan.id.replace(/[^A-Za-z0-9._-]/gu, '_')}.focus-lint.json`, 'application/json', `${canonicalJson({ schemaVersion: 1, treeId: plan.id, layoutHash: layout.layoutHash, diagnostics })}\n`, {
|
|
553
|
-
kind: 'focus-lint',
|
|
554
|
-
toolVersion: PACKAGE_VERSION,
|
|
555
|
-
schemaVersion: 'focus-lint.v1',
|
|
556
|
-
sourceHashes: { [plan.provenance.sourcePath]: plan.provenance.sourceHash },
|
|
557
|
-
}, 'Complete focus lint report', progress.signal);
|
|
558
|
-
const result = emptyServiceResult(workspaceId, {
|
|
559
|
-
mode: 'national',
|
|
560
|
-
treeId: plan.id,
|
|
561
|
-
focusCount: plan.focuses.length,
|
|
562
|
-
layoutHash: layout.layoutHash,
|
|
563
|
-
diagnosticCount: diagnostics.length,
|
|
564
|
-
});
|
|
565
|
-
result.code = 'FOCUS_LINTED';
|
|
566
|
-
setInlineFilesScanned(result, [plan.provenance.sourcePath]);
|
|
567
|
-
result.diagnostics = diagnostics.slice(0, 100);
|
|
568
|
-
result.artifacts = [publicArtifactLink(artifact)];
|
|
569
|
-
result.validation = validationFromDiagnostics(diagnostics);
|
|
570
|
-
await progress.report(3, 3, 'Focus lint complete');
|
|
571
|
-
return toolResult(result);
|
|
572
|
-
}
|
|
573
|
-
catch (error) {
|
|
574
|
-
return errorResult(error, workspaceId);
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
server.registerTool('hoi4.focus_layout', {
|
|
578
|
-
title: 'Plan stable focus layout',
|
|
579
|
-
description: 'Create a deterministic constraint layout while preserving pinned, relative, and previous automatic positions. Imported authored coordinates remain fixed; a full existing-tree repair must submit a complete plan whose movable nodes use position.mode "auto".',
|
|
580
|
-
inputSchema: focusPathInput
|
|
581
|
-
.extend({
|
|
582
|
-
previous: focusLayoutSchema.optional(),
|
|
583
|
-
laneSpacing: z.number().int().min(1).max(100).optional(),
|
|
584
|
-
nodeSpacing: z.number().int().min(1).max(100).optional(),
|
|
585
|
-
})
|
|
586
|
-
.strict(),
|
|
587
|
-
outputSchema: focusLayoutOutputSchema,
|
|
588
|
-
annotations: artifactProducing,
|
|
589
|
-
}, async ({ workspaceId, relativePath, treeId, previous, laneSpacing, nodeSpacing }, extra) => {
|
|
590
|
-
try {
|
|
591
|
-
const progress = progressReporter(extra);
|
|
592
|
-
await progress.report(0, 3, 'Importing and indexing focus source');
|
|
593
|
-
const snapshot = await engine.scan(workspaceId, {}, context.principal, progress.signal);
|
|
594
|
-
const workspace = engine.resolver.get(workspaceId, context.principal);
|
|
595
|
-
const paletteImport = continuousPalettes(snapshot);
|
|
596
|
-
const imported = importFocusFile(snapshot, selectedFocusFile(snapshot, workspace.registration.roots.focus, relativePath), paletteImport.palettes);
|
|
597
|
-
const plan = selectPlan(imported, treeId);
|
|
598
|
-
const layout = await workbench.layoutAsync(plan, {
|
|
599
|
-
...(previous === undefined ? {} : { previous: previous }),
|
|
600
|
-
...(laneSpacing === undefined ? {} : { laneSpacing }),
|
|
601
|
-
...(nodeSpacing === undefined ? {} : { nodeSpacing }),
|
|
602
|
-
signal: progress.signal,
|
|
603
|
-
});
|
|
604
|
-
progress.signal.throwIfAborted();
|
|
605
|
-
await progress.report(2, 3, 'Writing stable focus layout evidence');
|
|
606
|
-
const artifact = await engine.artifacts.put(workspace, `${plan.id.replace(/[^A-Za-z0-9._-]/gu, '_')}.focus-layout.json`, 'application/json', `${canonicalJson(layout)}\n`, {
|
|
607
|
-
kind: 'focus-layout',
|
|
608
|
-
toolVersion: PACKAGE_VERSION,
|
|
609
|
-
schemaVersion: 'focus-layout.v1',
|
|
610
|
-
sourceHashes: { [plan.provenance.sourcePath]: plan.provenance.sourceHash },
|
|
611
|
-
}, 'Stable focus layout decisions and diagnostics', progress.signal);
|
|
612
|
-
const diagnostics = [
|
|
613
|
-
...paletteImport.diagnostics,
|
|
614
|
-
...imported.diagnostics,
|
|
615
|
-
...layout.diagnostics,
|
|
616
|
-
];
|
|
617
|
-
const result = emptyServiceResult(workspaceId, {
|
|
618
|
-
treeId: plan.id,
|
|
619
|
-
layoutHash: layout.layoutHash,
|
|
620
|
-
nodeCount: layout.nodes.length,
|
|
621
|
-
decisions: layout.decisions.slice(0, 100),
|
|
622
|
-
});
|
|
623
|
-
result.code = 'FOCUS_LAYOUT_PLANNED';
|
|
624
|
-
setInlineFilesScanned(result, [plan.provenance.sourcePath]);
|
|
625
|
-
result.diagnostics = diagnostics.slice(0, 100);
|
|
626
|
-
result.artifacts = [publicArtifactLink(artifact)];
|
|
627
|
-
result.validation = validationFromDiagnostics(diagnostics);
|
|
628
|
-
await progress.report(3, 3, 'Focus layout complete');
|
|
603
|
+
await progress.report(3, 3, 'Focus inspection complete');
|
|
629
604
|
return toolResult(result);
|
|
630
605
|
}
|
|
631
606
|
catch (error) {
|
|
@@ -634,7 +609,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
634
609
|
});
|
|
635
610
|
server.registerTool('hoi4.focus_render', {
|
|
636
611
|
title: 'Render focus review artifacts',
|
|
637
|
-
description: '
|
|
612
|
+
description: 'Render a national tree or continuous palette for creation and cleanup review as deterministic HTML, SVG, PNG, JSON, and source-map artifacts. Omit mode for national behavior. National trees with at least 200 focuses use reviewScale 0.5 by default; set 0.25 through 1.0 explicitly when needed.',
|
|
638
613
|
inputSchema: focusRenderInput,
|
|
639
614
|
outputSchema: focusRenderOutputSchema,
|
|
640
615
|
annotations: artifactProducing,
|
|
@@ -703,6 +678,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
703
678
|
signal: progress.signal,
|
|
704
679
|
});
|
|
705
680
|
await progress.report(1, 3, 'Rendering focus artifacts');
|
|
681
|
+
const effectiveReviewScale = input.reviewScale ?? automaticFocusRenderScale(plan.focuses.length);
|
|
706
682
|
const rendered = await workbench.renderAndStore(workspaceId, plan, {
|
|
707
683
|
...(context.principal === undefined ? {} : { principal: context.principal }),
|
|
708
684
|
index: snapshot.index,
|
|
@@ -716,10 +692,10 @@ export function registerFocusTools(server, engine, context) {
|
|
|
716
692
|
? {}
|
|
717
693
|
: { verticalSpacing: input.verticalSpacing }),
|
|
718
694
|
...(input.padding === undefined ? {} : { padding: input.padding }),
|
|
719
|
-
|
|
695
|
+
outputScale: effectiveReviewScale,
|
|
720
696
|
renderProfile: {
|
|
721
697
|
sourceRevision: snapshot.revision,
|
|
722
|
-
|
|
698
|
+
reviewScale: effectiveReviewScale,
|
|
723
699
|
},
|
|
724
700
|
budget: renderBudget,
|
|
725
701
|
signal: progress.signal,
|
|
@@ -749,25 +725,23 @@ export function registerFocusTools(server, engine, context) {
|
|
|
749
725
|
return errorResult(error, workspaceId);
|
|
750
726
|
}
|
|
751
727
|
});
|
|
752
|
-
server.registerTool(
|
|
753
|
-
title:
|
|
754
|
-
description:
|
|
755
|
-
? 'Compile, validate, journal, and immediately apply a national tree or continuous palette plan in one call. No transaction approval or follow-up apply call is required.'
|
|
756
|
-
: 'Compile a validated national tree or continuous palette plan into source and create a hash-bound reviewed transaction; it does not apply the transaction.'} Omit mode for national behavior. National plans accept the same bounded horizontalSpacing, verticalSpacing, and padding controls as focus_render plus a uniform reviewScale that preserves logical SVG geometry while reducing both before/proposed raster outputs. For an unoccupied new source, pass createIfMissing: true with plan:<id> and zero-hash creation provenance.`,
|
|
728
|
+
server.registerTool('hoi4.focus_rewrite', {
|
|
729
|
+
title: 'Create or clean up focus content',
|
|
730
|
+
description: 'Create or clean up a national tree or continuous palette from a complete plan, validate the result, apply it in one call, and return before-and-after review artifacts. Omit mode for national behavior. National plans accept bounded horizontalSpacing, verticalSpacing, padding, and reviewScale controls. Set createIfMissing for a new file.',
|
|
757
731
|
inputSchema: focusPlanInput,
|
|
758
732
|
outputSchema: focusPlanOutputSchema,
|
|
759
733
|
annotations: {
|
|
760
734
|
readOnlyHint: false,
|
|
761
|
-
destructiveHint:
|
|
735
|
+
destructiveHint: true,
|
|
762
736
|
idempotentHint: false,
|
|
763
737
|
openWorldHint: false,
|
|
764
738
|
},
|
|
765
739
|
}, async (input, extra) => {
|
|
766
|
-
const { workspaceId, relativePath,
|
|
740
|
+
const { workspaceId, relativePath, createIfMissing, horizontalSpacing, verticalSpacing, padding, reviewScale, } = input;
|
|
767
741
|
try {
|
|
768
742
|
requireServerScope(context, 'hoi4:write');
|
|
769
743
|
const progress = progressReporter(extra);
|
|
770
|
-
await progress.report(0, 5, 'Validating shared index and source
|
|
744
|
+
await progress.report(0, 5, 'Validating shared index and current source');
|
|
771
745
|
const snapshot = await engine.scan(workspaceId, {}, context.principal, progress.signal);
|
|
772
746
|
const workspace = engine.resolver.get(workspaceId, context.principal);
|
|
773
747
|
if (input.mode === 'continuous') {
|
|
@@ -793,8 +767,6 @@ export function registerFocusTools(server, engine, context) {
|
|
|
793
767
|
}
|
|
794
768
|
if (currentPlan === undefined && createIfMissing && sourceFile !== undefined)
|
|
795
769
|
throw new ServiceError('CONTINUOUS_FOCUS_CREATE_REQUIRES_NEW_SOURCE', 'Creating a continuous-focus palette requires a new mod source file so unrelated existing source is never repurposed', { relativePath, paletteId: plan.id });
|
|
796
|
-
if (currentPlan !== undefined && imported !== undefined)
|
|
797
|
-
assertFocusPlanAuthority(detectContinuousFocusDrift(plan, imported.document), authority);
|
|
798
770
|
const renderBudget = new RenderBudget();
|
|
799
771
|
const presentation = await resolveFocusPresentation({
|
|
800
772
|
plans: [],
|
|
@@ -871,21 +843,19 @@ export function registerFocusTools(server, engine, context) {
|
|
|
871
843
|
...proposed.artifacts.map(publicArtifactLink),
|
|
872
844
|
...comparisonArtifacts.map(publicArtifactLink),
|
|
873
845
|
];
|
|
874
|
-
await progress.report(3, 5, '
|
|
846
|
+
await progress.report(3, 5, 'Preparing the continuous focus rewrite');
|
|
875
847
|
const planned = await workbench.planContinuousChanges({
|
|
876
848
|
workspaceId,
|
|
877
849
|
relativePath,
|
|
878
850
|
plan,
|
|
879
851
|
createIfMissing,
|
|
880
|
-
|
|
852
|
+
authority: 'plan',
|
|
881
853
|
...(context.principal === undefined ? {} : { principal: context.principal }),
|
|
882
854
|
artifacts: reviewArtifacts,
|
|
883
855
|
readDependencies: readDependenciesFromScannedFiles(snapshot.files),
|
|
884
856
|
signal: progress.signal,
|
|
885
857
|
});
|
|
886
|
-
await progress.report(4, 5,
|
|
887
|
-
? 'Applying and post-validating continuous focus rewrite'
|
|
888
|
-
: 'Finalizing reviewed transaction');
|
|
858
|
+
await progress.report(4, 5, 'Applying and validating the continuous focus rewrite');
|
|
889
859
|
const execution = await executePlannedTransaction(engine, planned.transaction, context.principal, progress.signal);
|
|
890
860
|
const transaction = execution.transaction;
|
|
891
861
|
const result = emptyServiceResult(workspaceId, {
|
|
@@ -894,9 +864,8 @@ export function registerFocusTools(server, engine, context) {
|
|
|
894
864
|
drift: compactDrift(planned.drift),
|
|
895
865
|
created: planned.drift.status === 'target_missing',
|
|
896
866
|
execution: execution.outcome,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
transactionArtifactCount: transaction.artifacts.length,
|
|
867
|
+
fileCount: transaction.files.length,
|
|
868
|
+
artifactCount: transaction.artifacts.length,
|
|
900
869
|
});
|
|
901
870
|
result.status = transaction.validation.passed ? 'ok' : 'blocked';
|
|
902
871
|
result.code =
|
|
@@ -904,9 +873,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
904
873
|
? 'CONTINUOUS_FOCUS_CHANGES_APPLIED'
|
|
905
874
|
: execution.outcome === 'unchanged'
|
|
906
875
|
? 'CONTINUOUS_FOCUS_CHANGES_UNCHANGED'
|
|
907
|
-
:
|
|
908
|
-
? 'CONTINUOUS_FOCUS_CHANGES_PLANNED'
|
|
909
|
-
: 'CONTINUOUS_FOCUS_CHANGES_BLOCKED';
|
|
876
|
+
: 'CONTINUOUS_FOCUS_CHANGES_BLOCKED';
|
|
910
877
|
setInlineFilesScanned(result, [
|
|
911
878
|
...new Set([
|
|
912
879
|
...(sourceFile === undefined ? [] : [sourceFile.displayPath]),
|
|
@@ -918,15 +885,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
918
885
|
.map(({ relativePath: file }) => file);
|
|
919
886
|
result.changedFiles = transaction.appliedFiles.slice(0, 100);
|
|
920
887
|
result.diagnostics = transaction.diagnostics.slice(0, 100);
|
|
921
|
-
|
|
922
|
-
result.artifacts = transaction.artifacts;
|
|
923
|
-
}
|
|
924
|
-
else {
|
|
925
|
-
result.transactionId = transaction.transactionId;
|
|
926
|
-
result.planHash = transaction.planHash;
|
|
927
|
-
result.artifacts = [transactionResourceLink(transaction)];
|
|
928
|
-
result.rollbackStatus = transaction.rollbackStatus;
|
|
929
|
-
}
|
|
888
|
+
result.artifacts = autonomousResultArtifacts(execution);
|
|
930
889
|
result.validation = transaction.validation;
|
|
931
890
|
result.blockers = transaction.diagnostics
|
|
932
891
|
.filter(({ severity }) => severity === 'error' || severity === 'blocker')
|
|
@@ -938,8 +897,8 @@ export function registerFocusTools(server, engine, context) {
|
|
|
938
897
|
await progress.report(5, 5, execution.outcome === 'applied'
|
|
939
898
|
? 'Continuous focus rewrite complete'
|
|
940
899
|
: execution.outcome === 'unchanged'
|
|
941
|
-
? 'Continuous focus
|
|
942
|
-
: 'Continuous focus
|
|
900
|
+
? 'Continuous focus content already satisfied the plan'
|
|
901
|
+
: 'Continuous focus rewrite blocked');
|
|
943
902
|
return toolResult(result);
|
|
944
903
|
}
|
|
945
904
|
const plan = input.plan;
|
|
@@ -969,20 +928,19 @@ export function registerFocusTools(server, engine, context) {
|
|
|
969
928
|
}
|
|
970
929
|
if (currentPlan === undefined && createIfMissing && focusFile !== undefined)
|
|
971
930
|
throw new ServiceError('FOCUS_CREATE_REQUIRES_NEW_SOURCE', 'Creating a national focus tree requires a new mod source file so an existing source and its planning sidecar cannot be repurposed', { relativePath, treeId: plan.id });
|
|
972
|
-
if (currentPlan !== undefined && imported !== undefined)
|
|
973
|
-
assertFocusPlanAuthority(detectFocusDrift(plan, imported.document, catalog), authority);
|
|
974
931
|
const renderBudget = new RenderBudget();
|
|
932
|
+
const effectiveReviewScale = reviewScale ?? automaticFocusRenderScale(plan.focuses.length);
|
|
975
933
|
const reviewRenderOptions = {
|
|
976
934
|
...(horizontalSpacing === undefined ? {} : { horizontalSpacing }),
|
|
977
935
|
...(verticalSpacing === undefined ? {} : { verticalSpacing }),
|
|
978
936
|
...(padding === undefined ? {} : { padding }),
|
|
979
|
-
|
|
937
|
+
outputScale: effectiveReviewScale,
|
|
980
938
|
};
|
|
981
939
|
const reviewRenderProfile = {
|
|
982
940
|
...(horizontalSpacing === undefined ? {} : { horizontalSpacing }),
|
|
983
941
|
...(verticalSpacing === undefined ? {} : { verticalSpacing }),
|
|
984
942
|
...(padding === undefined ? {} : { padding }),
|
|
985
|
-
|
|
943
|
+
reviewScale: effectiveReviewScale,
|
|
986
944
|
};
|
|
987
945
|
const presentation = await resolveFocusPresentation({
|
|
988
946
|
plans: [...(currentPlan === undefined ? [] : [currentPlan]), plan],
|
|
@@ -1078,13 +1036,13 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1078
1036
|
...proposed.artifacts.map(publicArtifactLink),
|
|
1079
1037
|
...comparisonArtifacts.map(publicArtifactLink),
|
|
1080
1038
|
];
|
|
1081
|
-
await progress.report(3, 5, '
|
|
1039
|
+
await progress.report(3, 5, 'Preparing the focus-tree rewrite');
|
|
1082
1040
|
const planned = await workbench.planChanges({
|
|
1083
1041
|
workspaceId,
|
|
1084
1042
|
relativePath,
|
|
1085
1043
|
plan,
|
|
1086
1044
|
createIfMissing,
|
|
1087
|
-
|
|
1045
|
+
authority: 'plan',
|
|
1088
1046
|
...(context.principal === undefined ? {} : { principal: context.principal }),
|
|
1089
1047
|
index: snapshot.index,
|
|
1090
1048
|
references: catalog,
|
|
@@ -1092,9 +1050,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1092
1050
|
readDependencies: readDependenciesFromScannedFiles(snapshot.files),
|
|
1093
1051
|
signal: progress.signal,
|
|
1094
1052
|
});
|
|
1095
|
-
await progress.report(4, 5,
|
|
1096
|
-
? 'Applying and post-validating focus rewrite'
|
|
1097
|
-
: 'Finalizing reviewed transaction');
|
|
1053
|
+
await progress.report(4, 5, 'Applying and validating the focus-tree rewrite');
|
|
1098
1054
|
const execution = await executePlannedTransaction(engine, planned.transaction, context.principal, progress.signal);
|
|
1099
1055
|
const transaction = execution.transaction;
|
|
1100
1056
|
const result = emptyServiceResult(workspaceId, {
|
|
@@ -1104,9 +1060,8 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1104
1060
|
created: planned.drift.status === 'target_missing',
|
|
1105
1061
|
execution: execution.outcome,
|
|
1106
1062
|
layoutHash: planned.layout.layoutHash,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
transactionArtifactCount: transaction.artifacts.length,
|
|
1063
|
+
fileCount: transaction.files.length,
|
|
1064
|
+
artifactCount: transaction.artifacts.length,
|
|
1110
1065
|
});
|
|
1111
1066
|
result.status = transaction.validation.passed ? 'ok' : 'blocked';
|
|
1112
1067
|
result.code =
|
|
@@ -1114,9 +1069,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1114
1069
|
? 'FOCUS_CHANGES_APPLIED'
|
|
1115
1070
|
: execution.outcome === 'unchanged'
|
|
1116
1071
|
? 'FOCUS_CHANGES_UNCHANGED'
|
|
1117
|
-
:
|
|
1118
|
-
? 'FOCUS_CHANGES_PLANNED'
|
|
1119
|
-
: 'FOCUS_CHANGES_BLOCKED';
|
|
1072
|
+
: 'FOCUS_CHANGES_BLOCKED';
|
|
1120
1073
|
setInlineFilesScanned(result, [
|
|
1121
1074
|
...new Set([
|
|
1122
1075
|
...(focusFile === undefined ? [] : [focusFile.displayPath]),
|
|
@@ -1128,15 +1081,7 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1128
1081
|
.map(({ relativePath: file }) => file);
|
|
1129
1082
|
result.changedFiles = transaction.appliedFiles.slice(0, 100);
|
|
1130
1083
|
result.diagnostics = transaction.diagnostics.slice(0, 100);
|
|
1131
|
-
|
|
1132
|
-
result.artifacts = autonomousResultArtifacts(execution);
|
|
1133
|
-
}
|
|
1134
|
-
else {
|
|
1135
|
-
result.transactionId = transaction.transactionId;
|
|
1136
|
-
result.planHash = transaction.planHash;
|
|
1137
|
-
result.artifacts = [transactionResourceLink(transaction)];
|
|
1138
|
-
result.rollbackStatus = transaction.rollbackStatus;
|
|
1139
|
-
}
|
|
1084
|
+
result.artifacts = autonomousResultArtifacts(execution);
|
|
1140
1085
|
result.validation = transaction.validation;
|
|
1141
1086
|
result.blockers = transaction.diagnostics
|
|
1142
1087
|
.filter(({ severity }) => severity === 'error' || severity === 'blocker')
|
|
@@ -1148,8 +1093,8 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1148
1093
|
await progress.report(5, 5, execution.outcome === 'applied'
|
|
1149
1094
|
? 'Focus rewrite complete'
|
|
1150
1095
|
: execution.outcome === 'unchanged'
|
|
1151
|
-
? 'Focus
|
|
1152
|
-
: 'Focus
|
|
1096
|
+
? 'Focus content already satisfied the plan'
|
|
1097
|
+
: 'Focus rewrite blocked');
|
|
1153
1098
|
return toolResult(result);
|
|
1154
1099
|
}
|
|
1155
1100
|
catch (error) {
|
|
@@ -1157,4 +1102,3 @@ export function registerFocusTools(server, engine, context) {
|
|
|
1157
1102
|
}
|
|
1158
1103
|
});
|
|
1159
1104
|
}
|
|
1160
|
-
//# sourceMappingURL=focus.js.map
|