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.
Files changed (428) hide show
  1. package/CHANGELOG.md +12 -118
  2. package/README.md +35 -127
  3. package/SECURITY.md +5 -7
  4. package/dist/bin/http.js +0 -1
  5. package/dist/bin/setup.js +141 -92
  6. package/dist/bin/stdio.js +0 -1
  7. package/dist/hoi4_agent_tools/core/artifacts.js +0 -1
  8. package/dist/hoi4_agent_tools/core/canonical.js +0 -1
  9. package/dist/hoi4_agent_tools/core/configuration.js +28 -28
  10. package/dist/hoi4_agent_tools/core/diagnostic-collector.js +0 -1
  11. package/dist/hoi4_agent_tools/core/diagnostics.js +0 -1
  12. package/dist/hoi4_agent_tools/core/diff.js +0 -1
  13. package/dist/hoi4_agent_tools/core/engine.js +6 -21
  14. package/dist/hoi4_agent_tools/core/image-diff.js +0 -1
  15. package/dist/hoi4_agent_tools/core/index.js +0 -1
  16. package/dist/hoi4_agent_tools/core/render-budget.js +0 -1
  17. package/dist/hoi4_agent_tools/core/result.js +0 -1
  18. package/dist/hoi4_agent_tools/core/scanner.js +0 -1
  19. package/dist/hoi4_agent_tools/core/server-state.js +0 -1
  20. package/dist/hoi4_agent_tools/core/source/encoding.js +0 -1
  21. package/dist/hoi4_agent_tools/core/source/index.js +0 -1
  22. package/dist/hoi4_agent_tools/core/source/lexer.js +0 -1
  23. package/dist/hoi4_agent_tools/core/source/limits.js +0 -1
  24. package/dist/hoi4_agent_tools/core/source/localisation.js +0 -1
  25. package/dist/hoi4_agent_tools/core/source/parser.js +0 -1
  26. package/dist/hoi4_agent_tools/core/source/rewrite.js +0 -1
  27. package/dist/hoi4_agent_tools/core/svg-text.js +0 -1
  28. package/dist/hoi4_agent_tools/core/transaction-limits.js +0 -1
  29. package/dist/hoi4_agent_tools/core/transactions.js +2 -30
  30. package/dist/hoi4_agent_tools/core/workspace.js +112 -396
  31. package/dist/hoi4_agent_tools/focus/compiler.js +0 -1
  32. package/dist/hoi4_agent_tools/focus/continuous-render.js +0 -1
  33. package/dist/hoi4_agent_tools/focus/drift.js +0 -1
  34. package/dist/hoi4_agent_tools/focus/geometry.js +0 -1
  35. package/dist/hoi4_agent_tools/focus/importer.js +0 -1
  36. package/dist/hoi4_agent_tools/focus/index.js +0 -1
  37. package/dist/hoi4_agent_tools/focus/layout.js +0 -1
  38. package/dist/hoi4_agent_tools/focus/limits.js +0 -1
  39. package/dist/hoi4_agent_tools/focus/lint.js +0 -1
  40. package/dist/hoi4_agent_tools/focus/model.js +0 -1
  41. package/dist/hoi4_agent_tools/focus/native-effects.js +0 -1
  42. package/dist/hoi4_agent_tools/focus/planning.js +0 -1
  43. package/dist/hoi4_agent_tools/focus/presentation.js +0 -1
  44. package/dist/hoi4_agent_tools/focus/render.js +0 -1
  45. package/dist/hoi4_agent_tools/focus/service.js +7 -8
  46. package/dist/hoi4_agent_tools/focus/source-update.js +1 -2
  47. package/dist/hoi4_agent_tools/gui/animation-manifest.js +0 -1
  48. package/dist/hoi4_agent_tools/gui/assets.js +0 -1
  49. package/dist/hoi4_agent_tools/gui/dds.js +0 -1
  50. package/dist/hoi4_agent_tools/gui/helpers.js +1 -2
  51. package/dist/hoi4_agent_tools/gui/index.js +0 -1
  52. package/dist/hoi4_agent_tools/gui/layout.js +0 -1
  53. package/dist/hoi4_agent_tools/gui/limits.js +0 -1
  54. package/dist/hoi4_agent_tools/gui/renderer.js +0 -1
  55. package/dist/hoi4_agent_tools/gui/scenario.js +0 -1
  56. package/dist/hoi4_agent_tools/gui/source-graph.js +0 -1
  57. package/dist/hoi4_agent_tools/gui/source-patch.js +1 -2
  58. package/dist/hoi4_agent_tools/gui/studio.js +247 -104
  59. package/dist/hoi4_agent_tools/gui/tga.js +0 -1
  60. package/dist/hoi4_agent_tools/gui/types.js +0 -1
  61. package/dist/hoi4_agent_tools/gui/validators.js +0 -1
  62. package/dist/hoi4_agent_tools/map/bmp.js +0 -1
  63. package/dist/hoi4_agent_tools/map/diagnostic-limit.js +0 -1
  64. package/dist/hoi4_agent_tools/map/index.js +0 -1
  65. package/dist/hoi4_agent_tools/map/limits.js +2 -1
  66. package/dist/hoi4_agent_tools/map/model.js +0 -1
  67. package/dist/hoi4_agent_tools/map/operations.js +0 -1
  68. package/dist/hoi4_agent_tools/map/render.js +0 -1
  69. package/dist/hoi4_agent_tools/map/service.js +171 -33
  70. package/dist/hoi4_agent_tools/map/validation.js +0 -1
  71. package/dist/hoi4_agent_tools/mcp/resources/register.js +61 -187
  72. package/dist/hoi4_agent_tools/mcp/security/auth.js +1 -2
  73. package/dist/hoi4_agent_tools/mcp/server/base-tools.js +24 -750
  74. package/dist/hoi4_agent_tools/mcp/server/create.js +3 -12
  75. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +0 -71
  76. package/dist/hoi4_agent_tools/mcp/server/progress.js +0 -1
  77. package/dist/hoi4_agent_tools/mcp/server/result.js +24 -30
  78. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js +10 -14
  79. package/dist/hoi4_agent_tools/mcp/tools/focus.js +219 -275
  80. package/dist/hoi4_agent_tools/mcp/tools/gui.js +149 -250
  81. package/dist/hoi4_agent_tools/mcp/tools/map.js +256 -337
  82. package/dist/hoi4_agent_tools/mcp/tools/mods.js +54 -0
  83. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js +0 -1
  84. package/dist/hoi4_agent_tools/mcp/transports/event-store.js +0 -1
  85. package/dist/hoi4_agent_tools/mcp/transports/http.js +1 -12
  86. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js +0 -1
  87. package/dist/hoi4_agent_tools/runtime.js +5 -2
  88. package/dist/hoi4_agent_tools/schemas/common.js +1 -2
  89. package/dist/hoi4_agent_tools/schemas/focus.js +0 -1
  90. package/dist/hoi4_agent_tools/schemas/map.js +0 -1
  91. package/dist/hoi4_agent_tools/schemas/transaction.js +0 -1
  92. package/dist/hoi4_agent_tools/version.js +1 -2
  93. package/docs/README.md +8 -21
  94. package/docs/development.md +22 -0
  95. package/docs/focus.md +40 -0
  96. package/docs/gui.md +37 -0
  97. package/docs/http.md +53 -0
  98. package/docs/map.md +39 -0
  99. package/docs/setup.md +39 -0
  100. package/package.json +10 -11
  101. package/server.json +3 -12
  102. package/dist/bin/http.d.ts +0 -3
  103. package/dist/bin/http.d.ts.map +0 -1
  104. package/dist/bin/http.js.map +0 -1
  105. package/dist/bin/setup.d.ts +0 -3
  106. package/dist/bin/setup.d.ts.map +0 -1
  107. package/dist/bin/setup.js.map +0 -1
  108. package/dist/bin/stdio.d.ts +0 -3
  109. package/dist/bin/stdio.d.ts.map +0 -1
  110. package/dist/bin/stdio.js.map +0 -1
  111. package/dist/hoi4_agent_tools/core/artifacts.d.ts +0 -117
  112. package/dist/hoi4_agent_tools/core/artifacts.d.ts.map +0 -1
  113. package/dist/hoi4_agent_tools/core/artifacts.js.map +0 -1
  114. package/dist/hoi4_agent_tools/core/canonical.d.ts +0 -13
  115. package/dist/hoi4_agent_tools/core/canonical.d.ts.map +0 -1
  116. package/dist/hoi4_agent_tools/core/canonical.js.map +0 -1
  117. package/dist/hoi4_agent_tools/core/configuration.d.ts +0 -138
  118. package/dist/hoi4_agent_tools/core/configuration.d.ts.map +0 -1
  119. package/dist/hoi4_agent_tools/core/configuration.js.map +0 -1
  120. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts +0 -18
  121. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts.map +0 -1
  122. package/dist/hoi4_agent_tools/core/diagnostic-collector.js.map +0 -1
  123. package/dist/hoi4_agent_tools/core/diagnostics.d.ts +0 -26
  124. package/dist/hoi4_agent_tools/core/diagnostics.d.ts.map +0 -1
  125. package/dist/hoi4_agent_tools/core/diagnostics.js.map +0 -1
  126. package/dist/hoi4_agent_tools/core/diff.d.ts +0 -22
  127. package/dist/hoi4_agent_tools/core/diff.d.ts.map +0 -1
  128. package/dist/hoi4_agent_tools/core/diff.js.map +0 -1
  129. package/dist/hoi4_agent_tools/core/engine.d.ts +0 -57
  130. package/dist/hoi4_agent_tools/core/engine.d.ts.map +0 -1
  131. package/dist/hoi4_agent_tools/core/engine.js.map +0 -1
  132. package/dist/hoi4_agent_tools/core/image-diff.d.ts +0 -14
  133. package/dist/hoi4_agent_tools/core/image-diff.d.ts.map +0 -1
  134. package/dist/hoi4_agent_tools/core/image-diff.js.map +0 -1
  135. package/dist/hoi4_agent_tools/core/index.d.ts +0 -64
  136. package/dist/hoi4_agent_tools/core/index.d.ts.map +0 -1
  137. package/dist/hoi4_agent_tools/core/index.js.map +0 -1
  138. package/dist/hoi4_agent_tools/core/index.public.d.ts +0 -16
  139. package/dist/hoi4_agent_tools/core/index.public.d.ts.map +0 -1
  140. package/dist/hoi4_agent_tools/core/index.public.js +0 -16
  141. package/dist/hoi4_agent_tools/core/index.public.js.map +0 -1
  142. package/dist/hoi4_agent_tools/core/render-budget.d.ts +0 -51
  143. package/dist/hoi4_agent_tools/core/render-budget.d.ts.map +0 -1
  144. package/dist/hoi4_agent_tools/core/render-budget.js.map +0 -1
  145. package/dist/hoi4_agent_tools/core/result.d.ts +0 -45
  146. package/dist/hoi4_agent_tools/core/result.d.ts.map +0 -1
  147. package/dist/hoi4_agent_tools/core/result.js.map +0 -1
  148. package/dist/hoi4_agent_tools/core/scanner.d.ts +0 -28
  149. package/dist/hoi4_agent_tools/core/scanner.d.ts.map +0 -1
  150. package/dist/hoi4_agent_tools/core/scanner.js.map +0 -1
  151. package/dist/hoi4_agent_tools/core/server-state.d.ts +0 -31
  152. package/dist/hoi4_agent_tools/core/server-state.d.ts.map +0 -1
  153. package/dist/hoi4_agent_tools/core/server-state.js.map +0 -1
  154. package/dist/hoi4_agent_tools/core/source/encoding.d.ts +0 -10
  155. package/dist/hoi4_agent_tools/core/source/encoding.d.ts.map +0 -1
  156. package/dist/hoi4_agent_tools/core/source/encoding.js.map +0 -1
  157. package/dist/hoi4_agent_tools/core/source/index.d.ts +0 -7
  158. package/dist/hoi4_agent_tools/core/source/index.d.ts.map +0 -1
  159. package/dist/hoi4_agent_tools/core/source/index.js.map +0 -1
  160. package/dist/hoi4_agent_tools/core/source/lexer.d.ts +0 -30
  161. package/dist/hoi4_agent_tools/core/source/lexer.d.ts.map +0 -1
  162. package/dist/hoi4_agent_tools/core/source/lexer.js.map +0 -1
  163. package/dist/hoi4_agent_tools/core/source/limits.d.ts +0 -21
  164. package/dist/hoi4_agent_tools/core/source/limits.d.ts.map +0 -1
  165. package/dist/hoi4_agent_tools/core/source/limits.js.map +0 -1
  166. package/dist/hoi4_agent_tools/core/source/localisation.d.ts +0 -20
  167. package/dist/hoi4_agent_tools/core/source/localisation.d.ts.map +0 -1
  168. package/dist/hoi4_agent_tools/core/source/localisation.js.map +0 -1
  169. package/dist/hoi4_agent_tools/core/source/parser.d.ts +0 -44
  170. package/dist/hoi4_agent_tools/core/source/parser.d.ts.map +0 -1
  171. package/dist/hoi4_agent_tools/core/source/parser.js.map +0 -1
  172. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts +0 -10
  173. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts.map +0 -1
  174. package/dist/hoi4_agent_tools/core/source/rewrite.js.map +0 -1
  175. package/dist/hoi4_agent_tools/core/svg-text.d.ts +0 -34
  176. package/dist/hoi4_agent_tools/core/svg-text.d.ts.map +0 -1
  177. package/dist/hoi4_agent_tools/core/svg-text.js.map +0 -1
  178. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts +0 -9
  179. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts.map +0 -1
  180. package/dist/hoi4_agent_tools/core/transaction-limits.js.map +0 -1
  181. package/dist/hoi4_agent_tools/core/transactions.d.ts +0 -164
  182. package/dist/hoi4_agent_tools/core/transactions.d.ts.map +0 -1
  183. package/dist/hoi4_agent_tools/core/transactions.js.map +0 -1
  184. package/dist/hoi4_agent_tools/core/workspace.d.ts +0 -68
  185. package/dist/hoi4_agent_tools/core/workspace.d.ts.map +0 -1
  186. package/dist/hoi4_agent_tools/core/workspace.js.map +0 -1
  187. package/dist/hoi4_agent_tools/focus/compiler.d.ts +0 -10
  188. package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +0 -1
  189. package/dist/hoi4_agent_tools/focus/compiler.js.map +0 -1
  190. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts +0 -32
  191. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts.map +0 -1
  192. package/dist/hoi4_agent_tools/focus/continuous-render.js.map +0 -1
  193. package/dist/hoi4_agent_tools/focus/drift.d.ts +0 -22
  194. package/dist/hoi4_agent_tools/focus/drift.d.ts.map +0 -1
  195. package/dist/hoi4_agent_tools/focus/drift.js.map +0 -1
  196. package/dist/hoi4_agent_tools/focus/geometry.d.ts +0 -17
  197. package/dist/hoi4_agent_tools/focus/geometry.d.ts.map +0 -1
  198. package/dist/hoi4_agent_tools/focus/geometry.js.map +0 -1
  199. package/dist/hoi4_agent_tools/focus/importer.d.ts +0 -9
  200. package/dist/hoi4_agent_tools/focus/importer.d.ts.map +0 -1
  201. package/dist/hoi4_agent_tools/focus/importer.js.map +0 -1
  202. package/dist/hoi4_agent_tools/focus/index.d.ts +0 -14
  203. package/dist/hoi4_agent_tools/focus/index.d.ts.map +0 -1
  204. package/dist/hoi4_agent_tools/focus/index.js.map +0 -1
  205. package/dist/hoi4_agent_tools/focus/layout.d.ts +0 -5
  206. package/dist/hoi4_agent_tools/focus/layout.d.ts.map +0 -1
  207. package/dist/hoi4_agent_tools/focus/layout.js.map +0 -1
  208. package/dist/hoi4_agent_tools/focus/limits.d.ts +0 -9
  209. package/dist/hoi4_agent_tools/focus/limits.d.ts.map +0 -1
  210. package/dist/hoi4_agent_tools/focus/limits.js.map +0 -1
  211. package/dist/hoi4_agent_tools/focus/lint.d.ts +0 -14
  212. package/dist/hoi4_agent_tools/focus/lint.d.ts.map +0 -1
  213. package/dist/hoi4_agent_tools/focus/lint.js.map +0 -1
  214. package/dist/hoi4_agent_tools/focus/model.d.ts +0 -307
  215. package/dist/hoi4_agent_tools/focus/model.d.ts.map +0 -1
  216. package/dist/hoi4_agent_tools/focus/model.js.map +0 -1
  217. package/dist/hoi4_agent_tools/focus/native-effects.d.ts +0 -9
  218. package/dist/hoi4_agent_tools/focus/native-effects.d.ts.map +0 -1
  219. package/dist/hoi4_agent_tools/focus/native-effects.js.map +0 -1
  220. package/dist/hoi4_agent_tools/focus/planning.d.ts +0 -15
  221. package/dist/hoi4_agent_tools/focus/planning.d.ts.map +0 -1
  222. package/dist/hoi4_agent_tools/focus/planning.js.map +0 -1
  223. package/dist/hoi4_agent_tools/focus/presentation.d.ts +0 -24
  224. package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +0 -1
  225. package/dist/hoi4_agent_tools/focus/presentation.js.map +0 -1
  226. package/dist/hoi4_agent_tools/focus/render.d.ts +0 -39
  227. package/dist/hoi4_agent_tools/focus/render.d.ts.map +0 -1
  228. package/dist/hoi4_agent_tools/focus/render.js.map +0 -1
  229. package/dist/hoi4_agent_tools/focus/service.d.ts +0 -82
  230. package/dist/hoi4_agent_tools/focus/service.d.ts.map +0 -1
  231. package/dist/hoi4_agent_tools/focus/service.js.map +0 -1
  232. package/dist/hoi4_agent_tools/focus/source-update.d.ts +0 -6
  233. package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +0 -1
  234. package/dist/hoi4_agent_tools/focus/source-update.js.map +0 -1
  235. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts +0 -37
  236. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts.map +0 -1
  237. package/dist/hoi4_agent_tools/gui/animation-manifest.js.map +0 -1
  238. package/dist/hoi4_agent_tools/gui/assets.d.ts +0 -71
  239. package/dist/hoi4_agent_tools/gui/assets.d.ts.map +0 -1
  240. package/dist/hoi4_agent_tools/gui/assets.js.map +0 -1
  241. package/dist/hoi4_agent_tools/gui/dds.d.ts +0 -17
  242. package/dist/hoi4_agent_tools/gui/dds.d.ts.map +0 -1
  243. package/dist/hoi4_agent_tools/gui/dds.js.map +0 -1
  244. package/dist/hoi4_agent_tools/gui/helpers.d.ts +0 -101
  245. package/dist/hoi4_agent_tools/gui/helpers.d.ts.map +0 -1
  246. package/dist/hoi4_agent_tools/gui/helpers.js.map +0 -1
  247. package/dist/hoi4_agent_tools/gui/index.d.ts +0 -15
  248. package/dist/hoi4_agent_tools/gui/index.d.ts.map +0 -1
  249. package/dist/hoi4_agent_tools/gui/index.js.map +0 -1
  250. package/dist/hoi4_agent_tools/gui/layout.d.ts +0 -6
  251. package/dist/hoi4_agent_tools/gui/layout.d.ts.map +0 -1
  252. package/dist/hoi4_agent_tools/gui/layout.js.map +0 -1
  253. package/dist/hoi4_agent_tools/gui/limits.d.ts +0 -25
  254. package/dist/hoi4_agent_tools/gui/limits.d.ts.map +0 -1
  255. package/dist/hoi4_agent_tools/gui/limits.js.map +0 -1
  256. package/dist/hoi4_agent_tools/gui/renderer.d.ts +0 -18
  257. package/dist/hoi4_agent_tools/gui/renderer.d.ts.map +0 -1
  258. package/dist/hoi4_agent_tools/gui/renderer.js.map +0 -1
  259. package/dist/hoi4_agent_tools/gui/scenario.d.ts +0 -66
  260. package/dist/hoi4_agent_tools/gui/scenario.d.ts.map +0 -1
  261. package/dist/hoi4_agent_tools/gui/scenario.js.map +0 -1
  262. package/dist/hoi4_agent_tools/gui/source-graph.d.ts +0 -7
  263. package/dist/hoi4_agent_tools/gui/source-graph.d.ts.map +0 -1
  264. package/dist/hoi4_agent_tools/gui/source-graph.js.map +0 -1
  265. package/dist/hoi4_agent_tools/gui/source-patch.d.ts +0 -13
  266. package/dist/hoi4_agent_tools/gui/source-patch.d.ts.map +0 -1
  267. package/dist/hoi4_agent_tools/gui/source-patch.js.map +0 -1
  268. package/dist/hoi4_agent_tools/gui/studio.d.ts +0 -86
  269. package/dist/hoi4_agent_tools/gui/studio.d.ts.map +0 -1
  270. package/dist/hoi4_agent_tools/gui/studio.js.map +0 -1
  271. package/dist/hoi4_agent_tools/gui/tga.d.ts +0 -16
  272. package/dist/hoi4_agent_tools/gui/tga.d.ts.map +0 -1
  273. package/dist/hoi4_agent_tools/gui/tga.js.map +0 -1
  274. package/dist/hoi4_agent_tools/gui/types.d.ts +0 -322
  275. package/dist/hoi4_agent_tools/gui/types.d.ts.map +0 -1
  276. package/dist/hoi4_agent_tools/gui/types.js.map +0 -1
  277. package/dist/hoi4_agent_tools/gui/validators.d.ts +0 -8
  278. package/dist/hoi4_agent_tools/gui/validators.d.ts.map +0 -1
  279. package/dist/hoi4_agent_tools/gui/validators.js.map +0 -1
  280. package/dist/hoi4_agent_tools/map/bmp.d.ts +0 -62
  281. package/dist/hoi4_agent_tools/map/bmp.d.ts.map +0 -1
  282. package/dist/hoi4_agent_tools/map/bmp.js.map +0 -1
  283. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts +0 -5
  284. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts.map +0 -1
  285. package/dist/hoi4_agent_tools/map/diagnostic-limit.js.map +0 -1
  286. package/dist/hoi4_agent_tools/map/index.d.ts +0 -8
  287. package/dist/hoi4_agent_tools/map/index.d.ts.map +0 -1
  288. package/dist/hoi4_agent_tools/map/index.js.map +0 -1
  289. package/dist/hoi4_agent_tools/map/limits.d.ts +0 -13
  290. package/dist/hoi4_agent_tools/map/limits.d.ts.map +0 -1
  291. package/dist/hoi4_agent_tools/map/limits.js.map +0 -1
  292. package/dist/hoi4_agent_tools/map/model.d.ts +0 -269
  293. package/dist/hoi4_agent_tools/map/model.d.ts.map +0 -1
  294. package/dist/hoi4_agent_tools/map/model.js.map +0 -1
  295. package/dist/hoi4_agent_tools/map/operations.d.ts +0 -401
  296. package/dist/hoi4_agent_tools/map/operations.d.ts.map +0 -1
  297. package/dist/hoi4_agent_tools/map/operations.js.map +0 -1
  298. package/dist/hoi4_agent_tools/map/render.d.ts +0 -90
  299. package/dist/hoi4_agent_tools/map/render.d.ts.map +0 -1
  300. package/dist/hoi4_agent_tools/map/render.js.map +0 -1
  301. package/dist/hoi4_agent_tools/map/service.d.ts +0 -81
  302. package/dist/hoi4_agent_tools/map/service.d.ts.map +0 -1
  303. package/dist/hoi4_agent_tools/map/service.js.map +0 -1
  304. package/dist/hoi4_agent_tools/map/validation.d.ts +0 -23
  305. package/dist/hoi4_agent_tools/map/validation.d.ts.map +0 -1
  306. package/dist/hoi4_agent_tools/map/validation.js.map +0 -1
  307. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +0 -4
  308. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +0 -1
  309. package/dist/hoi4_agent_tools/mcp/prompts/register.js +0 -72
  310. package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +0 -1
  311. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +0 -9
  312. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts.map +0 -1
  313. package/dist/hoi4_agent_tools/mcp/registry/metadata.js +0 -10
  314. package/dist/hoi4_agent_tools/mcp/registry/metadata.js.map +0 -1
  315. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts +0 -5
  316. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +0 -1
  317. package/dist/hoi4_agent_tools/mcp/resources/register.js.map +0 -1
  318. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts +0 -24
  319. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +0 -1
  320. package/dist/hoi4_agent_tools/mcp/security/auth.js.map +0 -1
  321. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +0 -47
  322. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +0 -1
  323. package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +0 -1
  324. package/dist/hoi4_agent_tools/mcp/server/create.d.ts +0 -5
  325. package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +0 -1
  326. package/dist/hoi4_agent_tools/mcp/server/create.js.map +0 -1
  327. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +0 -138
  328. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +0 -1
  329. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +0 -1
  330. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts +0 -8
  331. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts.map +0 -1
  332. package/dist/hoi4_agent_tools/mcp/server/progress.js.map +0 -1
  333. package/dist/hoi4_agent_tools/mcp/server/result.d.ts +0 -232
  334. package/dist/hoi4_agent_tools/mcp/server/result.d.ts.map +0 -1
  335. package/dist/hoi4_agent_tools/mcp/server/result.js.map +0 -1
  336. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts +0 -31
  337. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts.map +0 -1
  338. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js.map +0 -1
  339. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts +0 -5
  340. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +0 -1
  341. package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +0 -1
  342. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +0 -117
  343. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +0 -1
  344. package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +0 -1
  345. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +0 -5
  346. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +0 -1
  347. package/dist/hoi4_agent_tools/mcp/tools/map.js.map +0 -1
  348. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +0 -58
  349. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +0 -1
  350. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +0 -1
  351. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +0 -26
  352. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +0 -1
  353. package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +0 -1
  354. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +0 -28
  355. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +0 -1
  356. package/dist/hoi4_agent_tools/mcp/transports/http.js.map +0 -1
  357. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +0 -15
  358. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +0 -1
  359. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +0 -1
  360. package/dist/hoi4_agent_tools/runtime.d.ts +0 -4
  361. package/dist/hoi4_agent_tools/runtime.d.ts.map +0 -1
  362. package/dist/hoi4_agent_tools/runtime.js.map +0 -1
  363. package/dist/hoi4_agent_tools/schemas/common.d.ts +0 -74
  364. package/dist/hoi4_agent_tools/schemas/common.d.ts.map +0 -1
  365. package/dist/hoi4_agent_tools/schemas/common.js.map +0 -1
  366. package/dist/hoi4_agent_tools/schemas/focus.d.ts +0 -784
  367. package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +0 -1
  368. package/dist/hoi4_agent_tools/schemas/focus.js.map +0 -1
  369. package/dist/hoi4_agent_tools/schemas/index.d.ts +0 -5
  370. package/dist/hoi4_agent_tools/schemas/index.d.ts.map +0 -1
  371. package/dist/hoi4_agent_tools/schemas/index.js +0 -5
  372. package/dist/hoi4_agent_tools/schemas/index.js.map +0 -1
  373. package/dist/hoi4_agent_tools/schemas/map.d.ts +0 -654
  374. package/dist/hoi4_agent_tools/schemas/map.d.ts.map +0 -1
  375. package/dist/hoi4_agent_tools/schemas/map.js.map +0 -1
  376. package/dist/hoi4_agent_tools/schemas/transaction.d.ts +0 -259
  377. package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +0 -1
  378. package/dist/hoi4_agent_tools/schemas/transaction.js.map +0 -1
  379. package/dist/hoi4_agent_tools/version.d.ts +0 -6
  380. package/dist/hoi4_agent_tools/version.d.ts.map +0 -1
  381. package/dist/hoi4_agent_tools/version.js.map +0 -1
  382. package/dist/index.d.ts +0 -3
  383. package/dist/index.d.ts.map +0 -1
  384. package/dist/index.js +0 -3
  385. package/dist/index.js.map +0 -1
  386. package/docs/adr/0001-runtime-and-language.md +0 -16
  387. package/docs/adr/0002-lossless-source-model.md +0 -18
  388. package/docs/adr/0003-image-and-font-codecs.md +0 -18
  389. package/docs/adr/0004-focus-layout.md +0 -16
  390. package/docs/adr/0005-offline-rendering.md +0 -18
  391. package/docs/adr/0006-mcp-sdk-and-protocol.md +0 -16
  392. package/docs/adr/0007-storage-and-transactions.md +0 -24
  393. package/docs/adr/0008-test-strategy.md +0 -18
  394. package/docs/adr/0009-packaging-and-registry.md +0 -16
  395. package/docs/adr/0010-unsupported-and-refusal-policy.md +0 -18
  396. package/docs/adr/0011-http-security.md +0 -16
  397. package/docs/adr/0012-autonomous-rewrites.md +0 -55
  398. package/docs/adr/README.md +0 -14
  399. package/docs/agent-integration.md +0 -146
  400. package/docs/architecture.md +0 -76
  401. package/docs/artifacts.md +0 -136
  402. package/docs/compatibility.md +0 -33
  403. package/docs/completion-report.md +0 -122
  404. package/docs/configuration.md +0 -305
  405. package/docs/focus-workflow.md +0 -197
  406. package/docs/gui-workflow.md +0 -125
  407. package/docs/limitations.md +0 -32
  408. package/docs/map-workflow.md +0 -95
  409. package/docs/performance.md +0 -117
  410. package/docs/release.md +0 -222
  411. package/docs/research/mcp-2026-07-10.md +0 -52
  412. package/docs/research/source-ledger.md +0 -68
  413. package/docs/security.md +0 -145
  414. package/docs/self-hosting.md +0 -170
  415. package/docs/testing.md +0 -43
  416. package/docs/third-party-notices.md +0 -11
  417. package/docs/transactions.md +0 -180
  418. package/docs/troubleshooting.md +0 -54
  419. package/schemas/configuration.schema.json +0 -795
  420. package/schemas/continuous-focus-palette.schema.json +0 -325
  421. package/schemas/focus-plan.schema.json +0 -927
  422. package/schemas/focus-planning-sidecar.schema.json +0 -379
  423. package/schemas/gui-animation-source.schema.json +0 -176
  424. package/schemas/gui-helper.schema.json +0 -301
  425. package/schemas/gui-scenario.schema.json +0 -298
  426. package/schemas/map-operation.schema.json +0 -2284
  427. package/schemas/operation-result.schema.json +0 -344
  428. package/schemas/transaction-manifest.schema.json +0 -685
@@ -1,23 +1,16 @@
1
1
  import { z } from 'zod/v4';
2
- import { boundedSourceHashEvidence, publicArtifactLink } from '../../core/artifacts.js';
3
- import { canonicalJson } from '../../core/canonical.js';
2
+ import { boundedSourceHashEvidence, publicArtifactLink, } from '../../core/artifacts.js';
3
+ import { canonicalJson, hashCanonical } from '../../core/canonical.js';
4
4
  import { emptyServiceResult } from '../../core/result.js';
5
- import { AgentNudger, allocateMapIdentifiersAsync, } from '../../map/index.js';
5
+ import { AgentNudger, allocateMapIdentifiersAsync, exportProvinceGeometryRowRuns, MAP_PROVINCE_GEOMETRY_SELECTOR_LIMIT, } from '../../map/index.js';
6
6
  import { workspaceIdSchema } from '../../schemas/common.js';
7
7
  import { mapAllocationRequestSchema, mapOperationSchema } from '../../schemas/map.js';
8
8
  import { PACKAGE_VERSION } from '../../version.js';
9
- import { requireServerScope, transactionResourceLink, } from '../server/base-tools.js';
10
- import { autonomousFailureContext, autonomousResultArtifacts, autonomousWrites, executePlannedTransaction, } from '../server/transaction-execution.js';
9
+ import { requireServerScope } from '../server/base-tools.js';
10
+ import { autonomousFailureContext, autonomousResultArtifacts, executePlannedTransaction, } from '../server/transaction-execution.js';
11
11
  import { allocationEvidenceSchema, bitmapRenderHashesSchema, nonNegativeIntegerSchema, operationBlockerDataSchema, sha256Schema, } from '../server/output-schemas.js';
12
12
  import { progressReporter } from '../server/progress.js';
13
13
  import { errorResult, setInlineFilesScanned, strictOperationResultSchema, toolResult, } from '../server/result.js';
14
- const rgbSchema = z
15
- .object({
16
- r: z.number().int().min(0).max(255),
17
- g: z.number().int().min(0).max(255),
18
- b: z.number().int().min(0).max(255),
19
- })
20
- .strict();
21
14
  const changedBoundsSchema = z
22
15
  .object({
23
16
  minX: nonNegativeIntegerSchema,
@@ -70,7 +63,7 @@ const mapSemanticDiffSchema = z
70
63
  normalAdjacenciesChanged: z.boolean(),
71
64
  })
72
65
  .strict();
73
- const mapScanOutputSchema = strictOperationResultSchema(z
66
+ const mapWorkspaceInspectOutputSchema = strictOperationResultSchema(z
74
67
  .object({
75
68
  revision: sha256Schema,
76
69
  sharedRevision: sha256Schema,
@@ -80,22 +73,19 @@ const mapScanOutputSchema = strictOperationResultSchema(z
80
73
  states: nonNegativeIntegerSchema,
81
74
  regions: nonNegativeIntegerSchema,
82
75
  ports: nonNegativeIntegerSchema,
83
- })
84
- .strict());
85
- const mapInspectOutputSchema = strictOperationResultSchema(z
86
- .object({
87
- revision: sha256Schema,
88
- provinceCount: nonNegativeIntegerSchema,
89
- stateCount: nonNegativeIntegerSchema,
90
- regionCount: nonNegativeIntegerSchema,
91
- })
92
- .strict());
93
- const mapAllocationOutputSchema = strictOperationResultSchema(z
94
- .object({
95
- stateId: nonNegativeIntegerSchema.optional(),
96
- provinceId: nonNegativeIntegerSchema.optional(),
97
- color: rgbSchema.optional(),
98
- evidence: z.array(allocationEvidenceSchema).max(16),
76
+ inspectedProvinceCount: nonNegativeIntegerSchema,
77
+ inspectedStateCount: nonNegativeIntegerSchema,
78
+ inspectedRegionCount: nonNegativeIntegerSchema,
79
+ allocationCount: nonNegativeIntegerSchema,
80
+ provinceGeometryCount: nonNegativeIntegerSchema,
81
+ provinceGeometryPixelCount: nonNegativeIntegerSchema,
82
+ provinceGeometryRowRunCount: nonNegativeIntegerSchema,
83
+ unknownProvinceIds: z
84
+ .array(nonNegativeIntegerSchema)
85
+ .max(MAP_PROVINCE_GEOMETRY_SELECTOR_LIMIT),
86
+ missingGeometryProvinceIds: z
87
+ .array(nonNegativeIntegerSchema)
88
+ .max(MAP_PROVINCE_GEOMETRY_SELECTOR_LIMIT),
99
89
  })
100
90
  .strict());
101
91
  const mapRenderOutputSchema = strictOperationResultSchema(z
@@ -107,10 +97,9 @@ const mapRenderOutputSchema = strictOperationResultSchema(z
107
97
  offlineRepresentation: z.literal(true),
108
98
  })
109
99
  .strict());
110
- const mapValidateOutputSchema = strictOperationResultSchema(z.object({ revision: sha256Schema, diagnosticCount: nonNegativeIntegerSchema }).strict());
111
100
  const mapPlanOutputSchema = strictOperationResultSchema(z
112
101
  .object({
113
- execution: z.enum(['planned', 'applied', 'blocked', 'unchanged']),
102
+ execution: z.enum(['applied', 'blocked', 'unchanged']),
114
103
  allocations: z.array(allocationEvidenceSchema).max(100),
115
104
  operationBlockers: z.array(operationBlockerDataSchema).max(100),
116
105
  expectedChangedBounds: changedBoundsSchema.nullable(),
@@ -119,9 +108,8 @@ const mapPlanOutputSchema = strictOperationResultSchema(z
119
108
  semanticDiff: mapSemanticDiffSchema,
120
109
  semanticDiffCounts: z.record(z.string().max(256), nonNegativeIntegerSchema),
121
110
  semanticDiffTruncated: z.boolean(),
122
- expiresAt: z.iso.datetime(),
123
- transactionFileCount: nonNegativeIntegerSchema,
124
- transactionArtifactCount: nonNegativeIntegerSchema,
111
+ fileCount: nonNegativeIntegerSchema,
112
+ artifactCount: nonNegativeIntegerSchema,
125
113
  })
126
114
  .strict());
127
115
  const artifactProducing = {
@@ -254,59 +242,230 @@ function mapArtifactSourceEvidence(files) {
254
242
  const complete = Object.fromEntries(files.map(({ displayPath, sha256 }) => [displayPath, sha256]));
255
243
  return { complete, bounded: boundedSourceHashEvidence(complete) };
256
244
  }
245
+ function selectedMapEntities(snapshot, provinceIds, stateIds, regionIds) {
246
+ const provinces = [...new Set(provinceIds)]
247
+ .sort((a, b) => a - b)
248
+ .map((id) => {
249
+ const definition = snapshot.index.definitionsById.get(id);
250
+ const geometry = snapshot.index.raster?.geometry.get(id);
251
+ return {
252
+ id,
253
+ definition: definition === undefined
254
+ ? null
255
+ : {
256
+ color: definition.color,
257
+ type: definition.type,
258
+ coastal: definition.coastal,
259
+ terrain: definition.terrain,
260
+ continent: definition.continent,
261
+ },
262
+ geometry: geometry ?? null,
263
+ stateIds: snapshot.index.stateForProvince(id).map(({ id: state }) => state),
264
+ regionIds: snapshot.index.regionForProvince(id).map(({ id: region }) => region),
265
+ victoryPoints: snapshot.index.victoryPointsByProvince
266
+ .get(id)
267
+ ?.map(({ stateId: state, value }) => ({ stateId: state, value })) ?? [],
268
+ provinceBuildings: snapshot.index.provinceBuildingsByProvince
269
+ .get(id)
270
+ ?.map(({ stateId: state, buildings }) => ({
271
+ stateId: state,
272
+ buildings: Object.fromEntries(buildings),
273
+ })) ?? [],
274
+ port: (() => {
275
+ const port = snapshot.index.ports.find(({ provinceId }) => provinceId === id);
276
+ return port === undefined
277
+ ? null
278
+ : {
279
+ stateId: port.stateId,
280
+ provinceId: port.provinceId,
281
+ level: port.level,
282
+ coastal: port.coastal,
283
+ adjacentSeaProvinceIds: port.adjacentSeaProvinceIds,
284
+ positions: port.positions.map(({ stateId, building, x, y, z, rotation, adjacentSeaProvince }) => ({
285
+ stateId,
286
+ building,
287
+ x,
288
+ y,
289
+ z,
290
+ rotation,
291
+ adjacentSeaProvince,
292
+ })),
293
+ };
294
+ })(),
295
+ };
296
+ });
297
+ const states = [...new Set(stateIds)]
298
+ .sort((a, b) => a - b)
299
+ .map((id) => {
300
+ const state = snapshot.index.statesById.get(id);
301
+ return state === undefined
302
+ ? { id, value: null }
303
+ : {
304
+ id,
305
+ value: {
306
+ name: state.name,
307
+ capital: state.capital ?? null,
308
+ manpower: state.manpower,
309
+ category: state.category,
310
+ provinces: state.provinces,
311
+ resources: Object.fromEntries(state.resources),
312
+ owner: state.owner ?? null,
313
+ controller: state.controller ?? null,
314
+ cores: state.cores,
315
+ claims: state.claims,
316
+ victoryPoints: state.victoryPoints.map(({ provinceId, value }) => ({
317
+ provinceId,
318
+ value,
319
+ })),
320
+ stateBuildings: Object.fromEntries(state.stateBuildings),
321
+ provinceBuildings: Object.fromEntries([...state.provinceBuildings].map(([provinceId, buildings]) => [
322
+ String(provinceId),
323
+ Object.fromEntries(buildings),
324
+ ])),
325
+ },
326
+ };
327
+ });
328
+ const regions = [...new Set(regionIds)]
329
+ .sort((a, b) => a - b)
330
+ .map((id) => {
331
+ const region = snapshot.index.regionsById.get(id);
332
+ return region === undefined
333
+ ? { id, value: null }
334
+ : {
335
+ id,
336
+ value: {
337
+ name: region.name,
338
+ provinces: region.provinces,
339
+ navalTerrain: region.navalTerrain ?? null,
340
+ },
341
+ };
342
+ });
343
+ return { provinces, states, regions };
344
+ }
257
345
  export function registerMapTools(server, engine, context) {
258
- const autonomous = autonomousWrites(engine);
259
346
  const nudger = new AgentNudger(engine);
260
- server.registerTool('hoi4.map_scan', {
261
- title: 'Scan HOI4 map sources',
262
- description: 'Index province geometry, definitions, states, regions, ownership, networks, adjacencies, positions, locators, ports, and localisation across active roots.',
263
- inputSchema: z.object({ workspaceId: workspaceIdSchema }).strict(),
264
- outputSchema: mapScanOutputSchema,
347
+ server.registerTool('hoi4.map_inspect', {
348
+ title: 'Inspect HOI4 map',
349
+ description: 'Inspect map geometry and records for creation and cleanup, validate the complete map, return selected province/state/region details, preview requested free IDs and province colors, and export exact canonical province row runs when provinceIds are supplied.',
350
+ inputSchema: z
351
+ .object({
352
+ workspaceId: workspaceIdSchema,
353
+ provinceIds: z
354
+ .array(z.number().int().min(0))
355
+ .max(MAP_PROVINCE_GEOMETRY_SELECTOR_LIMIT)
356
+ .default([])
357
+ .describe(`Optional exact-geometry selector; exports row runs for at most ${MAP_PROVINCE_GEOMETRY_SELECTOR_LIMIT} province IDs`),
358
+ stateIds: z.array(z.number().int().positive()).max(1_000).default([]),
359
+ regionIds: z.array(z.number().int().positive()).max(1_000).default([]),
360
+ allocationRequests: z.array(mapAllocationRequestSchema).max(100).default([]),
361
+ })
362
+ .strict(),
363
+ outputSchema: mapWorkspaceInspectOutputSchema,
265
364
  annotations: artifactProducing,
266
- }, async ({ workspaceId }, extra) => {
365
+ }, async ({ workspaceId, provinceIds, stateIds, regionIds, allocationRequests }, extra) => {
267
366
  try {
268
367
  const progress = progressReporter(extra);
269
- await progress.report(0, 3, 'Scanning shared and map indexes');
368
+ await progress.report(0, 3, 'Inspecting and validating the map');
270
369
  const [shared, { snapshot, validation }] = await Promise.all([
271
370
  engine.scan(workspaceId, {}, context.principal, progress.signal),
272
371
  nudger.validate(workspaceId, context.principal, progress.signal),
273
372
  ]);
373
+ const selected = selectedMapEntities(snapshot, provinceIds, stateIds, regionIds);
374
+ const provinceGeometry = provinceIds.length === 0
375
+ ? undefined
376
+ : await exportProvinceGeometryRowRuns(snapshot.index, provinceIds, progress.signal);
377
+ const allocationPreviews = [];
378
+ for (const request of allocationRequests) {
379
+ allocationPreviews.push({
380
+ request,
381
+ allocation: await allocateMapIdentifiersAsync(snapshot.index, request, progress.signal),
382
+ });
383
+ }
274
384
  const workspace = engine.resolver.get(workspaceId, context.principal);
275
385
  const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
276
- const artifact = await engine.artifacts.putChunked(workspace, `map-scan.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
277
- schemaVersion: 1,
278
- revision: snapshot.revision,
279
- sharedRevision: shared.revision,
280
- dimensions: snapshot.index.raster === undefined
281
- ? null
282
- : {
283
- width: snapshot.index.raster.width,
284
- height: snapshot.index.raster.height,
285
- bitsPerPixel: snapshot.index.provinceBitmap?.bitsPerPixel,
286
- dibSize: snapshot.index.provinceBitmap?.dibSize,
287
- },
288
- counts: {
289
- definitions: snapshot.index.definitions.length,
290
- states: snapshot.index.states.length,
291
- regions: snapshot.index.regions.length,
292
- adjacencies: snapshot.index.adjacencies.length,
293
- supplyNodes: snapshot.index.supplyNodes.length,
294
- railways: snapshot.index.railways.length,
295
- ports: snapshot.index.ports.length,
296
- locators: snapshot.index.entityLocators.length,
297
- },
298
- validation,
299
- sourceHashes: sourceEvidence.complete,
300
- })}\n`, {
301
- kind: 'map-scan',
386
+ const inspectionProvenance = {
387
+ kind: 'map-inspect',
302
388
  toolVersion: PACKAGE_VERSION,
303
- schemaVersion: 'map-scan.v1',
389
+ schemaVersion: 'map-inspect.v1',
304
390
  sourceHashes: sourceEvidence.bounded.sourceHashes,
305
391
  metadata: {
306
392
  sharedRevision: shared.revision,
307
393
  sourceHashInventory: sourceEvidence.bounded.inventory,
308
394
  },
309
- }, 'Complete map scan and validation summary', progress.signal);
395
+ };
396
+ const artifactWrites = [
397
+ {
398
+ name: `map-inspect.${snapshot.revision.slice(0, 16)}.json`,
399
+ mimeType: 'application/json',
400
+ content: `${canonicalJson({
401
+ schemaVersion: 1,
402
+ revision: snapshot.revision,
403
+ sharedRevision: shared.revision,
404
+ dimensions: snapshot.index.raster === undefined
405
+ ? null
406
+ : {
407
+ width: snapshot.index.raster.width,
408
+ height: snapshot.index.raster.height,
409
+ bitsPerPixel: snapshot.index.provinceBitmap?.bitsPerPixel,
410
+ dibSize: snapshot.index.provinceBitmap?.dibSize,
411
+ },
412
+ counts: {
413
+ definitions: snapshot.index.definitions.length,
414
+ states: snapshot.index.states.length,
415
+ regions: snapshot.index.regions.length,
416
+ adjacencies: snapshot.index.adjacencies.length,
417
+ supplyNodes: snapshot.index.supplyNodes.length,
418
+ railways: snapshot.index.railways.length,
419
+ ports: snapshot.index.ports.length,
420
+ locators: snapshot.index.entityLocators.length,
421
+ },
422
+ selected,
423
+ allocationPreviews,
424
+ validation,
425
+ sourceHashes: sourceEvidence.complete,
426
+ })}\n`,
427
+ provenance: inspectionProvenance,
428
+ description: 'Complete map inspection, validation, selected records, and allocation previews',
429
+ },
430
+ ];
431
+ if (provinceGeometry !== undefined) {
432
+ const { width, height, requestedProvinceIds, unknownProvinceIds, missingGeometryProvinceIds, pixelCount, rowRunCount, provinces, } = provinceGeometry;
433
+ const selectorHash = hashCanonical(requestedProvinceIds).slice(0, 16);
434
+ artifactWrites.push({
435
+ name: `map-province-geometry.${snapshot.revision.slice(0, 16)}.${selectorHash}.json`,
436
+ mimeType: 'application/json',
437
+ content: `${canonicalJson({
438
+ schemaVersion: 1,
439
+ revision: snapshot.revision,
440
+ dimensions: { width, height },
441
+ coordinateSystem: {
442
+ origin: 'top-left',
443
+ xDirection: 'right',
444
+ yDirection: 'down',
445
+ },
446
+ rowRunFormat: ['y', 'startX', 'endXExclusive'],
447
+ requestedProvinceIds,
448
+ unknownProvinceIds,
449
+ missingGeometryProvinceIds,
450
+ pixelCount,
451
+ rowRunCount,
452
+ provinces,
453
+ sourceHashes: sourceEvidence.complete,
454
+ })}\n`,
455
+ provenance: {
456
+ kind: 'map-province-geometry',
457
+ toolVersion: PACKAGE_VERSION,
458
+ schemaVersion: 'map-province-geometry.v1',
459
+ sourceHashes: sourceEvidence.bounded.sourceHashes,
460
+ metadata: {
461
+ requestedProvinceIds,
462
+ sourceHashInventory: sourceEvidence.bounded.inventory,
463
+ },
464
+ },
465
+ description: 'Exact canonical province row runs for deriving bounded split or create geometry',
466
+ });
467
+ }
468
+ const artifacts = await engine.artifacts.withAtomicChunkedWrites(workspace, artifactWrites, (stored) => Promise.resolve([...stored]), progress.signal);
310
469
  const result = emptyServiceResult(workspaceId, {
311
470
  revision: snapshot.revision,
312
471
  sharedRevision: shared.revision,
@@ -316,154 +475,21 @@ export function registerMapTools(server, engine, context) {
316
475
  states: snapshot.index.states.length,
317
476
  regions: snapshot.index.regions.length,
318
477
  ports: snapshot.index.ports.length,
478
+ inspectedProvinceCount: selected.provinces.length,
479
+ inspectedStateCount: selected.states.length,
480
+ inspectedRegionCount: selected.regions.length,
481
+ allocationCount: allocationPreviews.length,
482
+ provinceGeometryCount: provinceGeometry?.provinces.length ?? 0,
483
+ provinceGeometryPixelCount: provinceGeometry?.pixelCount ?? 0,
484
+ provinceGeometryRowRunCount: provinceGeometry?.rowRunCount ?? 0,
485
+ unknownProvinceIds: provinceGeometry?.unknownProvinceIds ?? [],
486
+ missingGeometryProvinceIds: provinceGeometry?.missingGeometryProvinceIds ?? [],
319
487
  });
320
- result.code = 'MAP_SCANNED';
488
+ result.code = 'MAP_INSPECTED';
321
489
  setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
322
490
  result.diagnostics = validation.diagnostics.slice(0, 100);
323
- result.artifacts = [publicArtifactLink(artifact)];
491
+ result.artifacts = artifacts.map(publicArtifactLink);
324
492
  result.validation = validationSummary(validation);
325
- await progress.report(3, 3, 'Map scan complete');
326
- return toolResult(result);
327
- }
328
- catch (error) {
329
- return errorResult(error, workspaceId);
330
- }
331
- });
332
- server.registerTool('hoi4.map_inspect', {
333
- title: 'Inspect indexed map entities',
334
- description: 'Return bounded semantic details for selected province, state, and strategic-region IDs as a resource artifact.',
335
- inputSchema: z
336
- .object({
337
- workspaceId: workspaceIdSchema,
338
- provinceIds: z.array(z.number().int().min(0)).max(1000).default([]),
339
- stateIds: z.array(z.number().int().positive()).max(1000).default([]),
340
- regionIds: z.array(z.number().int().positive()).max(1000).default([]),
341
- })
342
- .strict(),
343
- outputSchema: mapInspectOutputSchema,
344
- annotations: artifactProducing,
345
- }, async ({ workspaceId, provinceIds, stateIds, regionIds }, extra) => {
346
- try {
347
- const progress = progressReporter(extra);
348
- await progress.report(0, 3, 'Scanning map index for selected entities');
349
- const snapshot = await nudger.scan(workspaceId, context.principal, progress.signal);
350
- const provinces = [...new Set(provinceIds)]
351
- .sort((a, b) => a - b)
352
- .map((id) => {
353
- const definition = snapshot.index.definitionsById.get(id);
354
- const geometry = snapshot.index.raster?.geometry.get(id);
355
- return {
356
- id,
357
- definition: definition === undefined
358
- ? null
359
- : {
360
- color: definition.color,
361
- type: definition.type,
362
- coastal: definition.coastal,
363
- terrain: definition.terrain,
364
- continent: definition.continent,
365
- },
366
- geometry: geometry ?? null,
367
- stateIds: snapshot.index.stateForProvince(id).map(({ id: state }) => state),
368
- regionIds: snapshot.index.regionForProvince(id).map(({ id: region }) => region),
369
- victoryPoints: snapshot.index.victoryPointsByProvince
370
- .get(id)
371
- ?.map(({ stateId: state, value }) => ({ stateId: state, value })) ?? [],
372
- provinceBuildings: snapshot.index.provinceBuildingsByProvince
373
- .get(id)
374
- ?.map(({ stateId: state, buildings }) => ({
375
- stateId: state,
376
- buildings: Object.fromEntries(buildings),
377
- })) ?? [],
378
- port: (() => {
379
- const port = snapshot.index.ports.find(({ provinceId }) => provinceId === id);
380
- return port === undefined
381
- ? null
382
- : {
383
- stateId: port.stateId,
384
- provinceId: port.provinceId,
385
- level: port.level,
386
- coastal: port.coastal,
387
- adjacentSeaProvinceIds: port.adjacentSeaProvinceIds,
388
- positions: port.positions.map(({ stateId, building, x, y, z, rotation, adjacentSeaProvince }) => ({
389
- stateId,
390
- building,
391
- x,
392
- y,
393
- z,
394
- rotation,
395
- adjacentSeaProvince,
396
- })),
397
- };
398
- })(),
399
- };
400
- });
401
- const states = [...new Set(stateIds)]
402
- .sort((a, b) => a - b)
403
- .map((id) => {
404
- const state = snapshot.index.statesById.get(id);
405
- return state === undefined
406
- ? { id, value: null }
407
- : {
408
- id,
409
- value: {
410
- name: state.name,
411
- capital: state.capital ?? null,
412
- manpower: state.manpower,
413
- category: state.category,
414
- provinces: state.provinces,
415
- resources: Object.fromEntries(state.resources),
416
- owner: state.owner ?? null,
417
- controller: state.controller ?? null,
418
- cores: state.cores,
419
- claims: state.claims,
420
- victoryPoints: state.victoryPoints.map(({ provinceId, value }) => ({
421
- provinceId,
422
- value,
423
- })),
424
- stateBuildings: Object.fromEntries(state.stateBuildings),
425
- provinceBuildings: Object.fromEntries([...state.provinceBuildings].map(([provinceId, buildings]) => [
426
- String(provinceId),
427
- Object.fromEntries(buildings),
428
- ])),
429
- },
430
- };
431
- });
432
- const regions = [...new Set(regionIds)]
433
- .sort((a, b) => a - b)
434
- .map((id) => {
435
- const region = snapshot.index.regionsById.get(id);
436
- return region === undefined
437
- ? { id, value: null }
438
- : {
439
- id,
440
- value: {
441
- name: region.name,
442
- provinces: region.provinces,
443
- navalTerrain: region.navalTerrain ?? null,
444
- },
445
- };
446
- });
447
- const data = { schemaVersion: 1, revision: snapshot.revision, provinces, states, regions };
448
- await progress.report(2, 3, 'Writing bounded map inspection evidence');
449
- const workspace = engine.resolver.get(workspaceId, context.principal);
450
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
451
- const artifact = await engine.artifacts.putChunked(workspace, `map-inspect.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({ ...data, sourceHashes: sourceEvidence.complete })}\n`, {
452
- kind: 'map-inspect',
453
- toolVersion: PACKAGE_VERSION,
454
- schemaVersion: 'map-inspect.v1',
455
- sourceHashes: sourceEvidence.bounded.sourceHashes,
456
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
457
- }, 'Selected map entity details', progress.signal);
458
- const result = emptyServiceResult(workspaceId, {
459
- revision: snapshot.revision,
460
- provinceCount: provinces.length,
461
- stateCount: states.length,
462
- regionCount: regions.length,
463
- });
464
- result.code = 'MAP_INSPECTED';
465
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
466
- result.artifacts = [publicArtifactLink(artifact)];
467
493
  await progress.report(3, 3, 'Map inspection complete');
468
494
  return toolResult(result);
469
495
  }
@@ -471,54 +497,9 @@ export function registerMapTools(server, engine, context) {
471
497
  return errorResult(error, workspaceId);
472
498
  }
473
499
  });
474
- server.registerTool('hoi4.map_allocate', {
475
- title: 'Preview map ID and color allocation',
476
- description: 'Scan every configured root, then deterministically preview a free state ID or contiguous province ID and collision-free color without writing.',
477
- inputSchema: z
478
- .object({ workspaceId: workspaceIdSchema, request: mapAllocationRequestSchema })
479
- .strict(),
480
- outputSchema: mapAllocationOutputSchema,
481
- annotations: artifactProducing,
482
- }, async ({ workspaceId, request }, extra) => {
483
- try {
484
- const progress = progressReporter(extra);
485
- await progress.report(0, 3, 'Scanning every map source for identifiers and colors');
486
- const snapshot = await nudger.scan(workspaceId, context.principal, progress.signal);
487
- const allocation = await allocateMapIdentifiersAsync(snapshot.index, request, progress.signal);
488
- progress.signal.throwIfAborted();
489
- await progress.report(2, 3, 'Writing allocation evidence');
490
- const workspace = engine.resolver.get(workspaceId, context.principal);
491
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
492
- const artifact = await engine.artifacts.putChunked(workspace, `map-allocation.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
493
- schemaVersion: 1,
494
- revision: snapshot.revision,
495
- request,
496
- allocation,
497
- sourceHashes: sourceEvidence.complete,
498
- })}\n`, {
499
- kind: 'map-allocation',
500
- toolVersion: PACKAGE_VERSION,
501
- schemaVersion: 'map-allocation.v1',
502
- sourceHashes: sourceEvidence.bounded.sourceHashes,
503
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
504
- }, 'Allocation evidence from every active source root', progress.signal);
505
- const result = emptyServiceResult(workspaceId, {
506
- ...allocation,
507
- evidence: allocation.evidence.map(compactAllocationEvidence),
508
- });
509
- result.code = 'MAP_ALLOCATION_PREVIEWED';
510
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
511
- result.artifacts = [publicArtifactLink(artifact)];
512
- await progress.report(3, 3, 'Map allocation preview complete');
513
- return toolResult(result);
514
- }
515
- catch (error) {
516
- return errorResult(error, workspaceId);
517
- }
518
- });
519
500
  server.registerTool('hoi4.map_render', {
520
501
  title: 'Render map inspection artifacts',
521
- description: 'Generate deterministic offline PNG, JSON, and pan-and-zoom HTML for one semantic layer and bounded overlays.',
502
+ description: 'Render deterministic PNG, JSON, and pan-and-zoom HTML artifacts for map creation and cleanup review, with one semantic layer and bounded overlays.',
522
503
  inputSchema: z
523
504
  .object({
524
505
  workspaceId: workspaceIdSchema,
@@ -557,53 +538,9 @@ export function registerMapTools(server, engine, context) {
557
538
  return errorResult(error, workspaceId);
558
539
  }
559
540
  });
560
- server.registerTool('hoi4.map_validate', {
561
- title: 'Validate map workspace',
562
- description: 'Run static map, bitmap, membership, network, coast, port, locator, reference, and localisation validation without launching the game.',
563
- inputSchema: z.object({ workspaceId: workspaceIdSchema }).strict(),
564
- outputSchema: mapValidateOutputSchema,
565
- annotations: artifactProducing,
566
- }, async ({ workspaceId }, extra) => {
567
- try {
568
- const progress = progressReporter(extra);
569
- await progress.report(0, 3, 'Scanning and validating map sources');
570
- const { snapshot, validation } = await nudger.validate(workspaceId, context.principal, progress.signal);
571
- await progress.report(2, 3, 'Writing map validation evidence');
572
- const workspace = engine.resolver.get(workspaceId, context.principal);
573
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
574
- const artifact = await engine.artifacts.putChunked(workspace, `map-validation.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
575
- schemaVersion: 1,
576
- revision: snapshot.revision,
577
- validation,
578
- sourceHashes: sourceEvidence.complete,
579
- })}\n`, {
580
- kind: 'map-validation',
581
- toolVersion: PACKAGE_VERSION,
582
- schemaVersion: 'map-validation.v1',
583
- sourceHashes: sourceEvidence.bounded.sourceHashes,
584
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
585
- }, 'Complete source-linked map validation report', progress.signal);
586
- const result = emptyServiceResult(workspaceId, {
587
- revision: snapshot.revision,
588
- diagnosticCount: validation.diagnostics.length,
589
- });
590
- result.code = 'MAP_VALIDATED';
591
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
592
- result.diagnostics = validation.diagnostics.slice(0, 100);
593
- result.artifacts = [publicArtifactLink(artifact)];
594
- result.validation = validationSummary(validation);
595
- await progress.report(3, 3, 'Map validation complete');
596
- return toolResult(result);
597
- }
598
- catch (error) {
599
- return errorResult(error, workspaceId);
600
- }
601
- });
602
- server.registerTool(autonomous ? 'hoi4.map_rewrite' : 'hoi4.map_plan', {
603
- title: autonomous ? 'Apply declarative map operations' : 'Dry-run declarative map operations',
604
- description: autonomous
605
- ? 'Validate, journal, and immediately apply exact state/localisation, province, hash-bound mask, bitmap-normal/special adjacency, region, network, position, and locator changes with pixel/semantic evidence in one call.'
606
- : 'Plan exact state/localisation, province, hash-bound mask, bitmap-normal/special adjacency, region, network, position, and locator changes with pixel/semantic diffs; it does not apply them.',
541
+ server.registerTool('hoi4.map_rewrite', {
542
+ title: 'Create or clean up map content',
543
+ description: 'Create or clean up states, provinces, regions, adjacencies, networks, positions, locators, and localisation with exact declarative operations, apply them in one call, and return pixel and semantic review artifacts.',
607
544
  inputSchema: z
608
545
  .object({
609
546
  workspaceId: workspaceIdSchema,
@@ -614,7 +551,7 @@ export function registerMapTools(server, engine, context) {
614
551
  outputSchema: mapPlanOutputSchema,
615
552
  annotations: {
616
553
  readOnlyHint: false,
617
- destructiveHint: autonomous,
554
+ destructiveHint: true,
618
555
  idempotentHint: false,
619
556
  openWorldHint: false,
620
557
  },
@@ -624,22 +561,16 @@ export function registerMapTools(server, engine, context) {
624
561
  const progress = progressReporter(extra);
625
562
  await progress.report(0, 5, 'Planning map operations and visual diff');
626
563
  const typedOperations = operations;
627
- const diff = await nudger.renderDiffAndStore(workspaceId, typedOperations, {
628
- ...(diffScale === undefined ? {} : { scale: diffScale }),
629
- ...(context.principal === undefined ? {} : { principal: context.principal }),
630
- signal: progress.signal,
631
- });
632
- await progress.report(3, 5, 'Creating hash-bound map transaction');
633
- const planned = await nudger.plan({
564
+ const planned = await nudger.planRewriteWithDiff({
634
565
  workspaceId,
635
566
  operations: typedOperations,
636
- artifacts: diff.artifacts.map(publicArtifactLink),
567
+ ...(diffScale === undefined ? {} : { diffScale }),
637
568
  ...(context.principal === undefined ? {} : { principal: context.principal }),
638
569
  signal: progress.signal,
639
570
  });
640
- await progress.report(4, 5, autonomous
641
- ? 'Applying and post-validating map rewrite'
642
- : 'Finalizing reviewed transaction');
571
+ const diff = planned;
572
+ await progress.report(3, 5, 'Preparing the map rewrite');
573
+ await progress.report(4, 5, 'Applying and validating the map rewrite');
643
574
  const execution = await executePlannedTransaction(engine, planned.transaction, context.principal, progress.signal);
644
575
  const transaction = execution.transaction;
645
576
  const compactSemantic = compactMapSemanticDiff(diff.bundle.semantic);
@@ -655,9 +586,8 @@ export function registerMapTools(server, engine, context) {
655
586
  semanticDiff: compactSemantic.semantic,
656
587
  semanticDiffCounts: compactSemantic.counts,
657
588
  semanticDiffTruncated: compactSemantic.truncated,
658
- expiresAt: transaction.expiresAt,
659
- transactionFileCount: transaction.files.length,
660
- transactionArtifactCount: transaction.artifacts.length,
589
+ fileCount: transaction.files.length,
590
+ artifactCount: transaction.artifacts.length,
661
591
  });
662
592
  result.status = transaction.validation.passed ? 'ok' : 'blocked';
663
593
  result.code =
@@ -665,24 +595,14 @@ export function registerMapTools(server, engine, context) {
665
595
  ? 'MAP_CHANGES_APPLIED'
666
596
  : execution.outcome === 'unchanged'
667
597
  ? 'MAP_CHANGES_UNCHANGED'
668
- : transaction.validation.passed
669
- ? 'MAP_CHANGES_PLANNED'
670
- : 'MAP_CHANGES_BLOCKED';
598
+ : 'MAP_CHANGES_BLOCKED';
671
599
  setInlineFilesScanned(result, diff.filesScanned);
672
600
  result.proposedFiles = transaction.files
673
601
  .slice(0, 100)
674
602
  .map(({ relativePath }) => relativePath);
675
603
  result.changedFiles = transaction.appliedFiles.slice(0, 100);
676
604
  result.diagnostics = transaction.diagnostics.slice(0, 100);
677
- if (autonomous) {
678
- result.artifacts = autonomousResultArtifacts(execution);
679
- }
680
- else {
681
- result.transactionId = transaction.transactionId;
682
- result.planHash = transaction.planHash;
683
- result.artifacts = [transactionResourceLink(transaction)];
684
- result.rollbackStatus = transaction.rollbackStatus;
685
- }
605
+ result.artifacts = autonomousResultArtifacts(execution);
686
606
  result.validation = transaction.validation;
687
607
  result.blockers = [
688
608
  ...planned.plan.blockers.map(({ code, message }) => ({
@@ -700,8 +620,8 @@ export function registerMapTools(server, engine, context) {
700
620
  await progress.report(5, 5, execution.outcome === 'applied'
701
621
  ? 'Map rewrite complete'
702
622
  : execution.outcome === 'unchanged'
703
- ? 'Map sources already satisfied the operations'
704
- : 'Map transaction planned');
623
+ ? 'Map content already satisfied the operations'
624
+ : 'Map rewrite blocked');
705
625
  return toolResult(result);
706
626
  }
707
627
  catch (error) {
@@ -709,4 +629,3 @@ export function registerMapTools(server, engine, context) {
709
629
  }
710
630
  });
711
631
  }
712
- //# sourceMappingURL=map.js.map