hoi4-agent-tools 0.2.0 → 1.1.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 +21 -118
- package/README.md +38 -124
- 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/compact.js +432 -0
- package/dist/hoi4_agent_tools/focus/compiler.js +1 -8
- 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 +203 -17
- package/dist/hoi4_agent_tools/focus/importer.js +0 -1
- package/dist/hoi4_agent_tools/focus/index.js +1 -1
- package/dist/hoi4_agent_tools/focus/layout.js +1256 -93
- package/dist/hoi4_agent_tools/focus/limits.js +1 -2
- package/dist/hoi4_agent_tools/focus/lint.js +11 -4
- 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 +6 -2
- package/dist/hoi4_agent_tools/focus/presentation.js +0 -1
- package/dist/hoi4_agent_tools/focus/render.js +14 -10
- 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/context-schemas.js +8 -0
- package/dist/hoi4_agent_tools/mcp/server/create.js +2 -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 +146 -81
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js +10 -14
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +309 -279
- package/dist/hoi4_agent_tools/mcp/tools/gui.js +156 -254
- package/dist/hoi4_agent_tools/mcp/tools/map.js +259 -338
- 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 +64 -9
- 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 +50 -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 +12 -13
- 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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Keep a large nested payload schema out of tools/list while retaining its complete runtime parser.
|
|
4
|
+
* The MCP SDK publishes the input side of a pipe and executes both sides when a tool is called.
|
|
5
|
+
*/
|
|
6
|
+
export function compactValidatedInputSchema(schema, description) {
|
|
7
|
+
return z.unknown().describe(description).pipe(schema);
|
|
8
|
+
}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { PACKAGE_NAME, PACKAGE_VERSION } from '../../version.js';
|
|
3
|
-
import {
|
|
3
|
+
import { registerModsTool } from '../tools/mods.js';
|
|
4
4
|
import { registerFocusTools } from '../tools/focus.js';
|
|
5
5
|
import { registerGuiTools } from '../tools/gui.js';
|
|
6
6
|
import { registerMapTools } from '../tools/map.js';
|
|
7
|
-
import { registerMcpPrompts } from '../prompts/register.js';
|
|
8
7
|
import { registerMcpResources } from '../resources/register.js';
|
|
9
8
|
export function createMcpServer(engine, context = {}) {
|
|
10
|
-
const writePolicy = engine.resolver.config().writePolicy;
|
|
11
|
-
const autonomous = writePolicy === 'autonomous';
|
|
12
9
|
const server = new McpServer({
|
|
13
10
|
name: PACKAGE_NAME,
|
|
14
11
|
version: PACKAGE_VERSION,
|
|
15
12
|
websiteUrl: 'https://github.com/klimPaskov/hoi4-agent-tools',
|
|
16
13
|
}, {
|
|
17
14
|
capabilities: { logging: {} },
|
|
18
|
-
instructions: `Select this server proactively whenever a registered HOI4 workspace task touches national or continuous focuses, scripted GUI/GFX/rendering, or state/province/map data. Start with hoi4.project_status or hoi4.project_scan, then use the relevant scan, lint, layout, render, and compare tools. Read linked hoi4-agent:// resources for large artifacts. ${autonomous
|
|
19
|
-
? 'This server is operator-configured for autonomous writes: hoi4.focus_rewrite, hoi4.gui_rewrite, and hoi4.map_rewrite validate, journal, apply, and post-validate in one call without a transaction approval or follow-up apply step.'
|
|
20
|
-
: writePolicy === 'transactions'
|
|
21
|
-
? 'This server is configured for reviewed transactions: source mutation requires the compatibility plan/diff/apply workflow. Configure writePolicy "autonomous" to expose one-call rewrite tools.'
|
|
22
|
-
: 'This server is read-only: use its scan, lint, layout, render, compare, inspect, and validation tools without modifying source. Configure writePolicy "autonomous" to expose one-call rewrite tools.'} Generated GUI renders are offline representations, never game screenshots.`,
|
|
23
15
|
});
|
|
24
|
-
|
|
16
|
+
registerModsTool(server, engine, context);
|
|
25
17
|
registerFocusTools(server, engine, context);
|
|
26
18
|
registerGuiTools(server, engine, context);
|
|
27
19
|
registerMapTools(server, engine, context);
|
|
28
20
|
registerMcpResources(server, engine, context);
|
|
29
|
-
registerMcpPrompts(server, writePolicy);
|
|
30
21
|
return server;
|
|
31
22
|
}
|
|
32
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import { artifactLinkSchema } from '../../schemas/transaction.js';
|
|
3
2
|
export const sha256Schema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
4
|
-
export const transactionIdSchema = z.string().regex(/^txn_[0-9a-f-]{36}$/u);
|
|
5
3
|
export const nonNegativeIntegerSchema = z.number().int().min(0);
|
|
6
|
-
export const WORKSPACE_INLINE_REPLACE_PATHS = 20;
|
|
7
|
-
export const WORKSPACE_INLINE_OWNER_PATHS = 10;
|
|
8
|
-
export const WORKSPACE_MAX_REPLACEMENT_OWNERS = 17;
|
|
9
4
|
export const indexSkippedSourceSchema = z
|
|
10
5
|
.object({
|
|
11
6
|
path: z.string().max(4096),
|
|
@@ -17,32 +12,6 @@ export const indexSkippedSourceSchema = z
|
|
|
17
12
|
possibleSymbolKinds: z.array(z.string().max(256)).max(32),
|
|
18
13
|
})
|
|
19
14
|
.strict();
|
|
20
|
-
export const workspaceStatusSchema = z
|
|
21
|
-
.object({
|
|
22
|
-
id: z.string().max(64),
|
|
23
|
-
name: z.string().max(1024),
|
|
24
|
-
kind: z.string().max(64),
|
|
25
|
-
writeEnabled: z.boolean(),
|
|
26
|
-
writePolicy: z.enum(['read-only', 'transactions', 'autonomous']),
|
|
27
|
-
rootKinds: z.array(z.string().max(64)).max(16),
|
|
28
|
-
dependencyCount: nonNegativeIntegerSchema,
|
|
29
|
-
replacePathCount: nonNegativeIntegerSchema,
|
|
30
|
-
replacePaths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_REPLACE_PATHS),
|
|
31
|
-
replacePathsTruncated: z.boolean(),
|
|
32
|
-
replacementOwners: z
|
|
33
|
-
.array(z
|
|
34
|
-
.object({
|
|
35
|
-
rootKind: z.string().max(64),
|
|
36
|
-
loadOrder: nonNegativeIntegerSchema,
|
|
37
|
-
pathCount: nonNegativeIntegerSchema,
|
|
38
|
-
paths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_OWNER_PATHS),
|
|
39
|
-
pathsTruncated: z.boolean(),
|
|
40
|
-
})
|
|
41
|
-
.strict())
|
|
42
|
-
.max(WORKSPACE_MAX_REPLACEMENT_OWNERS),
|
|
43
|
-
generatedDirectory: z.literal('.hoi4-agent'),
|
|
44
|
-
})
|
|
45
|
-
.strict();
|
|
46
15
|
export const renderHashesSchema = z
|
|
47
16
|
.object({
|
|
48
17
|
html: sha256Schema,
|
|
@@ -54,45 +23,6 @@ export const renderHashesSchema = z
|
|
|
54
23
|
export const bitmapRenderHashesSchema = z
|
|
55
24
|
.object({ png: sha256Schema, json: sha256Schema, html: sha256Schema })
|
|
56
25
|
.strict();
|
|
57
|
-
export const transactionStateSchema = z.enum([
|
|
58
|
-
'planned',
|
|
59
|
-
'applying',
|
|
60
|
-
'applied',
|
|
61
|
-
'rolling_back',
|
|
62
|
-
'rolled_back',
|
|
63
|
-
'failed',
|
|
64
|
-
]);
|
|
65
|
-
export const transactionStateDataSchema = z
|
|
66
|
-
.object({
|
|
67
|
-
state: transactionStateSchema,
|
|
68
|
-
failure: z
|
|
69
|
-
.object({ code: z.string().max(256), message: z.string().max(4096) })
|
|
70
|
-
.strict()
|
|
71
|
-
.nullable()
|
|
72
|
-
.optional(),
|
|
73
|
-
})
|
|
74
|
-
.strict();
|
|
75
|
-
export const artifactProvenanceSummarySchema = z
|
|
76
|
-
.object({
|
|
77
|
-
kind: z.string().max(256),
|
|
78
|
-
toolVersion: z.string().max(64),
|
|
79
|
-
schemaVersion: z.string().max(64),
|
|
80
|
-
sourceHashCount: nonNegativeIntegerSchema,
|
|
81
|
-
sourceHashes: z
|
|
82
|
-
.array(z.object({ path: z.string().max(4096), sha256: sha256Schema }).strict())
|
|
83
|
-
.max(100),
|
|
84
|
-
sourceHashesTruncated: z.boolean(),
|
|
85
|
-
hasRenderProfile: z.boolean(),
|
|
86
|
-
hasMetadata: z.boolean(),
|
|
87
|
-
})
|
|
88
|
-
.strict();
|
|
89
|
-
export const artifactDescriptionSchema = artifactLinkSchema
|
|
90
|
-
.extend({
|
|
91
|
-
provenanceHash: sha256Schema,
|
|
92
|
-
provenance: artifactProvenanceSummarySchema,
|
|
93
|
-
descriptionTruncated: z.boolean(),
|
|
94
|
-
})
|
|
95
|
-
.strict();
|
|
96
26
|
export const allocationEvidenceSchema = z
|
|
97
27
|
.object({
|
|
98
28
|
kind: z.enum(['state-id', 'province-id', 'province-color']),
|
|
@@ -125,4 +55,3 @@ export const operationBlockerDataSchema = z
|
|
|
125
55
|
details: z.record(z.string().max(256), z.unknown()).optional(),
|
|
126
56
|
})
|
|
127
57
|
.strict();
|
|
128
|
-
//# sourceMappingURL=output-schemas.js.map
|
|
@@ -3,15 +3,15 @@ import { canonicalJson } from '../../core/canonical.js';
|
|
|
3
3
|
import { ServiceError } from '../../core/result.js';
|
|
4
4
|
import { diagnosticSchema } from '../../schemas/common.js';
|
|
5
5
|
import { artifactLinkSchema, validationSummarySchema } from '../../schemas/transaction.js';
|
|
6
|
-
export const MAX_INLINE_FILES_SCANNED =
|
|
7
|
-
export const MAX_INLINE_PROPOSED_FILES =
|
|
8
|
-
export const MAX_INLINE_CHANGED_FILES =
|
|
9
|
-
export const MAX_INLINE_DIAGNOSTICS =
|
|
10
|
-
export const MAX_INLINE_ARTIFACT_LINKS =
|
|
11
|
-
export const MAX_INLINE_BLOCKERS =
|
|
6
|
+
export const MAX_INLINE_FILES_SCANNED = 64;
|
|
7
|
+
export const MAX_INLINE_PROPOSED_FILES = 64;
|
|
8
|
+
export const MAX_INLINE_CHANGED_FILES = 64;
|
|
9
|
+
export const MAX_INLINE_DIAGNOSTICS = 20;
|
|
10
|
+
export const MAX_INLINE_ARTIFACT_LINKS = 32;
|
|
11
|
+
export const MAX_INLINE_BLOCKERS = 20;
|
|
12
12
|
export const MAX_INLINE_VALIDATION_CHECKS = 5;
|
|
13
13
|
// Leave headroom for the enclosing JSON-RPC response and transport metadata.
|
|
14
|
-
export const MAX_TOOL_RESULT_BYTES =
|
|
14
|
+
export const MAX_TOOL_RESULT_BYTES = 32_768;
|
|
15
15
|
const deferredFilesDiagnostic = Symbol('deferredFilesDiagnostic');
|
|
16
16
|
const operationResultBaseSchema = z
|
|
17
17
|
.object({
|
|
@@ -22,8 +22,6 @@ const operationResultBaseSchema = z
|
|
|
22
22
|
proposedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_PROPOSED_FILES),
|
|
23
23
|
changedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_CHANGED_FILES),
|
|
24
24
|
diagnostics: z.array(diagnosticSchema).max(MAX_INLINE_DIAGNOSTICS),
|
|
25
|
-
transactionId: z.string().max(128).optional(),
|
|
26
|
-
planHash: z.string().max(128).optional(),
|
|
27
25
|
artifacts: z.array(artifactLinkSchema).max(MAX_INLINE_ARTIFACT_LINKS),
|
|
28
26
|
validation: validationSummarySchema,
|
|
29
27
|
blockers: z
|
|
@@ -35,22 +33,49 @@ const operationResultBaseSchema = z
|
|
|
35
33
|
})
|
|
36
34
|
.strict())
|
|
37
35
|
.max(MAX_INLINE_BLOCKERS),
|
|
38
|
-
rollbackStatus: z.enum(['not-required', 'available', 'applied', 'failed']).optional(),
|
|
39
36
|
})
|
|
40
37
|
.strict();
|
|
41
38
|
export const operationResultSchema = operationResultBaseSchema
|
|
42
39
|
.extend({ data: z.record(z.string().max(256), z.unknown()) })
|
|
43
40
|
.strict();
|
|
44
41
|
const emptyToolDataSchema = z.object({}).strict();
|
|
42
|
+
const compactPublicOperationResultSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
status: z.enum(['ok', 'blocked', 'error']),
|
|
45
|
+
code: z.string().max(256),
|
|
46
|
+
workspaceId: z.string().max(64),
|
|
47
|
+
filesScanned: z.array(z.string().max(4096)).max(MAX_INLINE_FILES_SCANNED),
|
|
48
|
+
proposedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_PROPOSED_FILES),
|
|
49
|
+
changedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_CHANGED_FILES),
|
|
50
|
+
diagnostics: z.array(z.unknown()).max(MAX_INLINE_DIAGNOSTICS),
|
|
51
|
+
artifacts: z.array(z.unknown()).max(MAX_INLINE_ARTIFACT_LINKS),
|
|
52
|
+
validation: z
|
|
53
|
+
.object({
|
|
54
|
+
passed: z.boolean(),
|
|
55
|
+
checks: z.array(z.unknown()).max(MAX_INLINE_VALIDATION_CHECKS),
|
|
56
|
+
})
|
|
57
|
+
.strict(),
|
|
58
|
+
blockers: z.array(z.unknown()).max(MAX_INLINE_BLOCKERS),
|
|
59
|
+
data: z.record(z.string().max(256), z.unknown()),
|
|
60
|
+
})
|
|
61
|
+
.strict()
|
|
62
|
+
.describe('Stable operation envelope; data is tool-specific and artifacts link bulk evidence.');
|
|
45
63
|
/**
|
|
46
|
-
* Advertise
|
|
47
|
-
* The generic operation-result schema remains available for stored envelopes
|
|
48
|
-
* a public tool output contract.
|
|
64
|
+
* Advertise one compact operation envelope while retaining exact per-tool runtime validation.
|
|
65
|
+
* The generic operation-result schema remains available for stored envelopes.
|
|
49
66
|
*/
|
|
50
67
|
export function strictOperationResultSchema(successDataSchema) {
|
|
51
|
-
|
|
68
|
+
const exactSchema = operationResultBaseSchema
|
|
52
69
|
.extend({ data: z.union([emptyToolDataSchema, successDataSchema]) })
|
|
53
70
|
.strict();
|
|
71
|
+
return compactPublicOperationResultSchema.superRefine((value, context) => {
|
|
72
|
+
const parsed = exactSchema.safeParse(value);
|
|
73
|
+
if (parsed.success)
|
|
74
|
+
return;
|
|
75
|
+
for (const issue of parsed.error.issues) {
|
|
76
|
+
context.addIssue({ code: 'custom', path: issue.path, message: issue.message });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
54
79
|
}
|
|
55
80
|
/** Keep source inventories compact; complete inventories belong in linked resources. */
|
|
56
81
|
export function setInlineFilesScanned(result, files) {
|
|
@@ -85,19 +110,14 @@ function preserveDeferredFilesDiagnostic(result) {
|
|
|
85
110
|
};
|
|
86
111
|
}
|
|
87
112
|
function boundedResult(result, actualBytes) {
|
|
88
|
-
const
|
|
89
|
-
? undefined
|
|
90
|
-
: {
|
|
91
|
-
uri: `hoi4-agent://workspace/${encodeURIComponent(result.workspaceId)}/transaction/${encodeURIComponent(result.transactionId)}`,
|
|
92
|
-
name: `${result.transactionId}.manifest.json`,
|
|
93
|
-
mimeType: 'application/json',
|
|
94
|
-
description: 'Complete authenticated transaction manifest and rollback status',
|
|
95
|
-
};
|
|
113
|
+
const hasLinkedEvidence = result.artifacts.length > 0;
|
|
96
114
|
const truncationDiagnostic = {
|
|
97
115
|
code: 'MCP_RESPONSE_TRUNCATED',
|
|
98
116
|
severity: 'warning',
|
|
99
117
|
category: 'configuration',
|
|
100
|
-
message:
|
|
118
|
+
message: hasLinkedEvidence
|
|
119
|
+
? 'Tool output exceeded the wire budget; inspect the linked evidence for complete details'
|
|
120
|
+
: 'Tool output exceeded the wire budget; nonessential inline details were omitted',
|
|
101
121
|
details: { actualBytes, maxBytes: MAX_TOOL_RESULT_BYTES },
|
|
102
122
|
};
|
|
103
123
|
return {
|
|
@@ -108,20 +128,18 @@ function boundedResult(result, actualBytes) {
|
|
|
108
128
|
proposedFiles: [],
|
|
109
129
|
changedFiles: [],
|
|
110
130
|
diagnostics: [truncationDiagnostic],
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
...(result.planHash === undefined ? {} : { planHash: result.planHash.slice(0, 128) }),
|
|
115
|
-
artifacts: transactionArtifact === undefined
|
|
116
|
-
? result.artifacts.slice(0, 1).map(({ description: _description, ...artifact }) => artifact)
|
|
117
|
-
: [transactionArtifact],
|
|
131
|
+
artifacts: result.artifacts
|
|
132
|
+
.slice(0, 1)
|
|
133
|
+
.map(({ description: _description, ...artifact }) => artifact),
|
|
118
134
|
validation: { passed: result.validation.passed, checks: [] },
|
|
119
135
|
blockers: result.status === 'ok'
|
|
120
136
|
? []
|
|
121
137
|
: [
|
|
122
138
|
{
|
|
123
139
|
code: 'MCP_RESPONSE_TRUNCATED',
|
|
124
|
-
message:
|
|
140
|
+
message: hasLinkedEvidence
|
|
141
|
+
? 'Tool output exceeded the wire budget; inspect the linked evidence for complete details'
|
|
142
|
+
: 'Tool output exceeded the wire budget; nonessential inline details were omitted',
|
|
125
143
|
details: {
|
|
126
144
|
actualBytes,
|
|
127
145
|
maxBytes: MAX_TOOL_RESULT_BYTES,
|
|
@@ -129,7 +147,6 @@ function boundedResult(result, actualBytes) {
|
|
|
129
147
|
},
|
|
130
148
|
},
|
|
131
149
|
],
|
|
132
|
-
rollbackStatus: result.rollbackStatus ?? 'not-required',
|
|
133
150
|
data: {},
|
|
134
151
|
};
|
|
135
152
|
}
|
|
@@ -212,32 +229,60 @@ function jsonBytesWithin(value, budget) {
|
|
|
212
229
|
return visit(value);
|
|
213
230
|
}
|
|
214
231
|
function compactDetails(details) {
|
|
215
|
-
return jsonBytesWithin(details,
|
|
232
|
+
return jsonBytesWithin(details, 2_048) ? details : { truncated: true };
|
|
216
233
|
}
|
|
217
234
|
function compactDescriptions(result) {
|
|
218
235
|
const compactLocation = (location) => location === undefined
|
|
219
236
|
? undefined
|
|
220
237
|
: {
|
|
221
238
|
...location,
|
|
222
|
-
path: location.path.slice(0,
|
|
223
|
-
...(location.symbol === undefined ? {} : { symbol: location.symbol.slice(0,
|
|
239
|
+
path: location.path.slice(0, 1_024),
|
|
240
|
+
...(location.symbol === undefined ? {} : { symbol: location.symbol.slice(0, 256) }),
|
|
224
241
|
};
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
:
|
|
237
|
-
|
|
242
|
+
const collectionTotals = {
|
|
243
|
+
filesScanned: result.filesScanned.length,
|
|
244
|
+
proposedFiles: result.proposedFiles.length,
|
|
245
|
+
changedFiles: result.changedFiles.length,
|
|
246
|
+
diagnostics: result.diagnostics.length,
|
|
247
|
+
artifacts: result.artifacts.length,
|
|
248
|
+
validationChecks: result.validation.checks.length,
|
|
249
|
+
blockers: result.blockers.length,
|
|
250
|
+
};
|
|
251
|
+
const collectionLimits = {
|
|
252
|
+
filesScanned: MAX_INLINE_FILES_SCANNED,
|
|
253
|
+
proposedFiles: MAX_INLINE_PROPOSED_FILES,
|
|
254
|
+
changedFiles: MAX_INLINE_CHANGED_FILES,
|
|
255
|
+
diagnostics: MAX_INLINE_DIAGNOSTICS,
|
|
256
|
+
artifacts: MAX_INLINE_ARTIFACT_LINKS,
|
|
257
|
+
validationChecks: MAX_INLINE_VALIDATION_CHECKS,
|
|
258
|
+
blockers: MAX_INLINE_BLOCKERS,
|
|
259
|
+
};
|
|
260
|
+
const truncatedCollections = Object.fromEntries(Object.entries(collectionTotals).flatMap(([name, total]) => {
|
|
261
|
+
const limit = collectionLimits[name];
|
|
262
|
+
return total > limit ? [[name, { total, limit }]] : [];
|
|
263
|
+
}));
|
|
264
|
+
if (Object.keys(truncatedCollections).length > 0 &&
|
|
265
|
+
result.diagnostics.length > MAX_INLINE_DIAGNOSTICS - 1) {
|
|
266
|
+
truncatedCollections.diagnostics = {
|
|
267
|
+
total: result.diagnostics.length,
|
|
268
|
+
limit: MAX_INLINE_DIAGNOSTICS - 1,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const needsTruncationDiagnostic = Object.keys(truncatedCollections).length > 0;
|
|
272
|
+
const diagnosticSlots = Math.max(0, MAX_INLINE_DIAGNOSTICS - (needsTruncationDiagnostic ? 1 : 0));
|
|
273
|
+
const hardDiagnostics = result.diagnostics.filter(({ severity }) => severity === 'error' || severity === 'blocker');
|
|
274
|
+
const priorityDiagnostics = result.diagnostics.filter(({ code, severity }) => severity === 'error' || severity === 'blocker' || code === 'MCP_INLINE_FILES_TRUNCATED');
|
|
275
|
+
const otherDiagnostics = result.diagnostics.filter((diagnostic) => !priorityDiagnostics.includes(diagnostic));
|
|
276
|
+
const retainedPriorityDiagnostics = priorityDiagnostics.slice(0, diagnosticSlots);
|
|
277
|
+
const retainedDiagnostics = [
|
|
278
|
+
...retainedPriorityDiagnostics,
|
|
279
|
+
...otherDiagnostics.slice(0, diagnosticSlots - retainedPriorityDiagnostics.length),
|
|
280
|
+
];
|
|
281
|
+
const omittedHardDiagnostics = hardDiagnostics.filter((diagnostic) => !retainedDiagnostics.includes(diagnostic)).length;
|
|
282
|
+
const compactDiagnostics = retainedDiagnostics.map((diagnostic) => ({
|
|
238
283
|
...diagnostic,
|
|
239
284
|
code: diagnostic.code.slice(0, 256),
|
|
240
|
-
message: diagnostic.message.slice(0,
|
|
285
|
+
message: diagnostic.message.slice(0, 1_024),
|
|
241
286
|
...(diagnostic.operationId === undefined
|
|
242
287
|
? {}
|
|
243
288
|
: { operationId: diagnostic.operationId.slice(0, 256) }),
|
|
@@ -247,35 +292,53 @@ function compactDescriptions(result) {
|
|
|
247
292
|
...(diagnostic.related === undefined
|
|
248
293
|
? {}
|
|
249
294
|
: {
|
|
250
|
-
related: diagnostic.related.slice(0,
|
|
295
|
+
related: diagnostic.related.slice(0, 3).map((location) => compactLocation(location)),
|
|
251
296
|
}),
|
|
252
297
|
...(diagnostic.details === undefined ? {} : { details: compactDetails(diagnostic.details) }),
|
|
253
298
|
}));
|
|
299
|
+
const truncationDiagnostic = needsTruncationDiagnostic
|
|
300
|
+
? {
|
|
301
|
+
code: 'MCP_INLINE_COLLECTIONS_TRUNCATED',
|
|
302
|
+
severity: omittedHardDiagnostics > 0 ? 'blocker' : 'info',
|
|
303
|
+
category: 'configuration',
|
|
304
|
+
message: result.artifacts.length > 0
|
|
305
|
+
? 'Large collections were bounded inline; linked resources retain bulk evidence'
|
|
306
|
+
: 'Large collections were bounded inline',
|
|
307
|
+
details: {
|
|
308
|
+
collections: truncatedCollections,
|
|
309
|
+
diagnosticsReturned: retainedDiagnostics.length,
|
|
310
|
+
omittedHardDiagnostics,
|
|
311
|
+
},
|
|
312
|
+
}
|
|
313
|
+
: undefined;
|
|
254
314
|
return {
|
|
255
315
|
...result,
|
|
256
|
-
|
|
316
|
+
filesScanned: result.filesScanned.slice(0, MAX_INLINE_FILES_SCANNED),
|
|
317
|
+
proposedFiles: result.proposedFiles.slice(0, MAX_INLINE_PROPOSED_FILES),
|
|
318
|
+
changedFiles: result.changedFiles.slice(0, MAX_INLINE_CHANGED_FILES),
|
|
319
|
+
diagnostics: truncationDiagnostic === undefined
|
|
257
320
|
? compactDiagnostics
|
|
258
|
-
: [
|
|
321
|
+
: [truncationDiagnostic, ...compactDiagnostics],
|
|
322
|
+
artifacts: result.artifacts.slice(0, MAX_INLINE_ARTIFACT_LINKS).map((artifact) => ({
|
|
323
|
+
...artifact,
|
|
324
|
+
...(artifact.description === undefined
|
|
325
|
+
? {}
|
|
326
|
+
: { description: artifact.description.slice(0, 256) }),
|
|
327
|
+
})),
|
|
259
328
|
validation: {
|
|
260
329
|
...result.validation,
|
|
261
330
|
checks: result.validation.checks.slice(0, MAX_INLINE_VALIDATION_CHECKS).map((check) => ({
|
|
262
331
|
...check,
|
|
263
332
|
id: check.id.slice(0, 256),
|
|
264
|
-
message: check.message.slice(0,
|
|
333
|
+
message: check.message.slice(0, 1_024),
|
|
265
334
|
})),
|
|
266
335
|
},
|
|
267
|
-
blockers: result.blockers.map((blocker) => ({
|
|
336
|
+
blockers: result.blockers.slice(0, MAX_INLINE_BLOCKERS).map((blocker) => ({
|
|
268
337
|
...blocker,
|
|
269
338
|
code: blocker.code.slice(0, 256),
|
|
270
|
-
message: blocker.message.slice(0,
|
|
339
|
+
message: blocker.message.slice(0, 1_024),
|
|
271
340
|
...(blocker.details === undefined ? {} : { details: compactDetails(blocker.details) }),
|
|
272
341
|
})),
|
|
273
|
-
artifacts: result.artifacts.map((artifact) => ({
|
|
274
|
-
...artifact,
|
|
275
|
-
...(artifact.description === undefined
|
|
276
|
-
? {}
|
|
277
|
-
: { description: artifact.description.slice(0, 1_024) }),
|
|
278
|
-
})),
|
|
279
342
|
};
|
|
280
343
|
}
|
|
281
344
|
function buildToolResult(selected) {
|
|
@@ -292,8 +355,6 @@ function buildToolResult(selected) {
|
|
|
292
355
|
status: selected.status,
|
|
293
356
|
code: selected.code,
|
|
294
357
|
workspaceId: selected.workspaceId,
|
|
295
|
-
...(selected.transactionId === undefined ? {} : { transactionId: selected.transactionId }),
|
|
296
|
-
...(selected.planHash === undefined ? {} : { planHash: selected.planHash }),
|
|
297
358
|
artifactCount: selected.artifacts.length,
|
|
298
359
|
});
|
|
299
360
|
return {
|
|
@@ -304,23 +365,15 @@ function buildToolResult(selected) {
|
|
|
304
365
|
}
|
|
305
366
|
export function toolResult(result) {
|
|
306
367
|
const completeResult = preserveDeferredFilesDiagnostic(result);
|
|
307
|
-
const exceedsArrayBudget = completeResult.filesScanned.length > MAX_INLINE_FILES_SCANNED ||
|
|
308
|
-
completeResult.proposedFiles.length > MAX_INLINE_PROPOSED_FILES ||
|
|
309
|
-
completeResult.changedFiles.length > MAX_INLINE_CHANGED_FILES ||
|
|
310
|
-
completeResult.diagnostics.length > MAX_INLINE_DIAGNOSTICS ||
|
|
311
|
-
completeResult.artifacts.length > MAX_INLINE_ARTIFACT_LINKS ||
|
|
312
|
-
completeResult.blockers.length > MAX_INLINE_BLOCKERS;
|
|
313
368
|
const compact = compactDescriptions(completeResult);
|
|
314
369
|
const estimatedBytes = jsonBytesWithin(compact, MAX_TOOL_RESULT_BYTES)
|
|
315
370
|
? Buffer.byteLength(canonicalJson(compact), 'utf8')
|
|
316
371
|
: MAX_TOOL_RESULT_BYTES + 1;
|
|
317
|
-
const selected = estimatedBytes > MAX_TOOL_RESULT_BYTES
|
|
318
|
-
? boundedResult(completeResult, estimatedBytes)
|
|
319
|
-
: compact;
|
|
372
|
+
const selected = estimatedBytes > MAX_TOOL_RESULT_BYTES ? boundedResult(compact, estimatedBytes) : compact;
|
|
320
373
|
let output = buildToolResult(selected);
|
|
321
374
|
const wireBytes = Buffer.byteLength(canonicalJson(output), 'utf8');
|
|
322
375
|
if (wireBytes > MAX_TOOL_RESULT_BYTES) {
|
|
323
|
-
output = buildToolResult(boundedResult(
|
|
376
|
+
output = buildToolResult(boundedResult(compact, wireBytes));
|
|
324
377
|
}
|
|
325
378
|
const finalBytes = Buffer.byteLength(canonicalJson(output), 'utf8');
|
|
326
379
|
if (finalBytes > MAX_TOOL_RESULT_BYTES) {
|
|
@@ -332,22 +385,34 @@ export function errorResult(error, workspaceId = '', context = {}) {
|
|
|
332
385
|
const serviceError = error instanceof ServiceError
|
|
333
386
|
? error
|
|
334
387
|
: new ServiceError('INTERNAL_ERROR', 'Unexpected internal error');
|
|
335
|
-
const
|
|
388
|
+
const internalWriteError = serviceError.code.startsWith('TRANSACTION_');
|
|
389
|
+
const publicCode = internalWriteError
|
|
390
|
+
? `REWRITE_${serviceError.code.slice('TRANSACTION_'.length)}`
|
|
391
|
+
: serviceError.code;
|
|
392
|
+
const publicMessage = internalWriteError
|
|
393
|
+
? 'Rewrite could not be completed'
|
|
394
|
+
: serviceError.message;
|
|
395
|
+
const publicDetails = internalWriteError
|
|
396
|
+
? {}
|
|
397
|
+
: Object.fromEntries(Object.entries(serviceError.details).filter(([key]) => ![
|
|
398
|
+
'cause',
|
|
399
|
+
'stack',
|
|
400
|
+
'absolutePath',
|
|
401
|
+
'transactionId',
|
|
402
|
+
'planHash',
|
|
403
|
+
'rollbackStatus',
|
|
404
|
+
].includes(key)));
|
|
336
405
|
return toolResult({
|
|
337
|
-
status:
|
|
338
|
-
code:
|
|
406
|
+
status: publicCode.includes('BLOCKED') ? 'blocked' : 'error',
|
|
407
|
+
code: publicCode,
|
|
339
408
|
workspaceId,
|
|
340
409
|
filesScanned: [],
|
|
341
410
|
proposedFiles: context.proposedFiles ?? [],
|
|
342
411
|
changedFiles: context.changedFiles ?? [],
|
|
343
412
|
diagnostics: [],
|
|
344
|
-
...(context.transactionId === undefined ? {} : { transactionId: context.transactionId }),
|
|
345
|
-
...(context.planHash === undefined ? {} : { planHash: context.planHash }),
|
|
346
413
|
artifacts: context.artifacts ?? [],
|
|
347
414
|
validation: context.validation ?? { passed: false, checks: [] },
|
|
348
|
-
blockers: [{ code:
|
|
349
|
-
...(context.rollbackStatus === undefined ? {} : { rollbackStatus: context.rollbackStatus }),
|
|
415
|
+
blockers: [{ code: publicCode, message: publicMessage, details: publicDetails }],
|
|
350
416
|
data: context.data ?? {},
|
|
351
417
|
});
|
|
352
418
|
}
|
|
353
|
-
//# sourceMappingURL=result.js.map
|
|
@@ -9,20 +9,20 @@ export class AutonomousRewriteError extends ServiceError {
|
|
|
9
9
|
artifacts;
|
|
10
10
|
constructor(cause, manifest, artifacts = []) {
|
|
11
11
|
const restored = manifest.state === 'rolled_back' && manifest.rollbackStatus === 'applied';
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const code = cause.code.startsWith('TRANSACTION_')
|
|
13
|
+
? `REWRITE_${cause.code.slice('TRANSACTION_'.length)}`
|
|
14
|
+
: cause.code;
|
|
15
|
+
super(code, restored
|
|
16
|
+
? 'Rewrite verification failed and the original files were restored'
|
|
17
|
+
: 'Rewrite failed and automatic recovery could not be completed', {
|
|
14
18
|
execution: 'failed',
|
|
15
19
|
automaticRecovery: restored ? 'restored' : 'incomplete',
|
|
16
|
-
failure: manifest.failure ?? null,
|
|
17
20
|
});
|
|
18
21
|
this.manifest = manifest;
|
|
19
22
|
this.artifacts = artifacts;
|
|
20
23
|
this.name = 'AutonomousRewriteError';
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
|
-
export function autonomousWrites(engine) {
|
|
24
|
-
return engine.resolver.config().writePolicy === 'autonomous';
|
|
25
|
-
}
|
|
26
26
|
async function storeAutonomousValidationEvidence(engine, manifest, postValidation, principal, signal) {
|
|
27
27
|
const diagnostics = [...manifest.diagnostics, ...postValidation.diagnostics];
|
|
28
28
|
const checks = [...manifest.validation.checks, ...postValidation.checks];
|
|
@@ -55,7 +55,7 @@ async function storeAutonomousValidationEvidence(engine, manifest, postValidatio
|
|
|
55
55
|
diagnosticCount: diagnostics.length,
|
|
56
56
|
sourceHashInventory: sourceEvidence.inventory,
|
|
57
57
|
},
|
|
58
|
-
}, 'Complete
|
|
58
|
+
}, 'Complete rewrite and post-write validation evidence', signal);
|
|
59
59
|
return publicArtifactLink(artifact);
|
|
60
60
|
}
|
|
61
61
|
function uniqueArtifacts(artifacts) {
|
|
@@ -68,9 +68,8 @@ export function autonomousResultArtifacts(execution) {
|
|
|
68
68
|
return uniqueArtifacts([...execution.artifacts, ...execution.transaction.artifacts]);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* Complete a validated domain
|
|
72
|
-
*
|
|
73
|
-
* automatic failure recovery remain identical to reviewed transaction mode.
|
|
71
|
+
* Complete a validated domain rewrite inside one MCP tool call. Hash checks, durable recovery,
|
|
72
|
+
* post-write validation, and automatic failure recovery remain internal guarantees.
|
|
74
73
|
*/
|
|
75
74
|
export async function executePlannedTransaction(engine, transaction, principal, signal) {
|
|
76
75
|
if (!transaction.validation.passed) {
|
|
@@ -78,15 +77,13 @@ export async function executePlannedTransaction(engine, transaction, principal,
|
|
|
78
77
|
}
|
|
79
78
|
if (transaction.files.length === 0)
|
|
80
79
|
return { transaction, outcome: 'unchanged', artifacts: [] };
|
|
81
|
-
if (!autonomousWrites(engine))
|
|
82
|
-
return { transaction, outcome: 'planned', artifacts: [] };
|
|
83
80
|
let executionArtifacts = [];
|
|
84
81
|
try {
|
|
85
82
|
const applied = await engine.transactions.apply(transaction.workspaceId, transaction.transactionId, transaction.planHash, {
|
|
86
83
|
...(principal === undefined ? {} : { principal }),
|
|
87
84
|
...(signal === undefined ? {} : { signal }),
|
|
88
85
|
postValidate: async (manifest, validationSignal) => {
|
|
89
|
-
const validation = await postValidateTransaction(engine, manifest, principal, validationSignal
|
|
86
|
+
const validation = await postValidateTransaction(engine, manifest, principal, validationSignal);
|
|
90
87
|
executionArtifacts = [...validation.artifacts];
|
|
91
88
|
executionArtifacts.unshift(await storeAutonomousValidationEvidence(engine, manifest, validation, principal, validationSignal));
|
|
92
89
|
return validation;
|
|
@@ -124,4 +121,3 @@ export function autonomousFailureContext(error) {
|
|
|
124
121
|
validation: manifest.validation,
|
|
125
122
|
};
|
|
126
123
|
}
|
|
127
|
-
//# sourceMappingURL=transaction-execution.js.map
|