hoi4-agent-tools 0.1.7 → 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 (424) hide show
  1. package/CHANGELOG.md +12 -94
  2. package/README.md +35 -121
  3. package/SECURITY.md +5 -5
  4. package/dist/bin/http.js +0 -1
  5. package/dist/bin/setup.js +141 -85
  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 -20
  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 +46 -31
  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 +11 -26
  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 -103
  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 +182 -38
  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 -5
  73. package/dist/hoi4_agent_tools/mcp/server/base-tools.js +26 -733
  74. package/dist/hoi4_agent_tools/mcp/server/create.js +3 -6
  75. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +0 -70
  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 +123 -0
  79. package/dist/hoi4_agent_tools/mcp/tools/focus.js +244 -254
  80. package/dist/hoi4_agent_tools/mcp/tools/gui.js +163 -236
  81. package/dist/hoi4_agent_tools/mcp/tools/map.js +269 -323
  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 -9
  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 -137
  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 -56
  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 -162
  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 -3
  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 -50
  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 -35
  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 -133
  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/tools/focus.d.ts +0 -5
  337. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +0 -1
  338. package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +0 -1
  339. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +0 -111
  340. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +0 -1
  341. package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +0 -1
  342. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +0 -5
  343. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +0 -1
  344. package/dist/hoi4_agent_tools/mcp/tools/map.js.map +0 -1
  345. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +0 -58
  346. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +0 -1
  347. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +0 -1
  348. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +0 -26
  349. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +0 -1
  350. package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +0 -1
  351. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +0 -28
  352. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +0 -1
  353. package/dist/hoi4_agent_tools/mcp/transports/http.js.map +0 -1
  354. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +0 -15
  355. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +0 -1
  356. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +0 -1
  357. package/dist/hoi4_agent_tools/runtime.d.ts +0 -4
  358. package/dist/hoi4_agent_tools/runtime.d.ts.map +0 -1
  359. package/dist/hoi4_agent_tools/runtime.js.map +0 -1
  360. package/dist/hoi4_agent_tools/schemas/common.d.ts +0 -74
  361. package/dist/hoi4_agent_tools/schemas/common.d.ts.map +0 -1
  362. package/dist/hoi4_agent_tools/schemas/common.js.map +0 -1
  363. package/dist/hoi4_agent_tools/schemas/focus.d.ts +0 -784
  364. package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +0 -1
  365. package/dist/hoi4_agent_tools/schemas/focus.js.map +0 -1
  366. package/dist/hoi4_agent_tools/schemas/index.d.ts +0 -5
  367. package/dist/hoi4_agent_tools/schemas/index.d.ts.map +0 -1
  368. package/dist/hoi4_agent_tools/schemas/index.js +0 -5
  369. package/dist/hoi4_agent_tools/schemas/index.js.map +0 -1
  370. package/dist/hoi4_agent_tools/schemas/map.d.ts +0 -654
  371. package/dist/hoi4_agent_tools/schemas/map.d.ts.map +0 -1
  372. package/dist/hoi4_agent_tools/schemas/map.js.map +0 -1
  373. package/dist/hoi4_agent_tools/schemas/transaction.d.ts +0 -259
  374. package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +0 -1
  375. package/dist/hoi4_agent_tools/schemas/transaction.js.map +0 -1
  376. package/dist/hoi4_agent_tools/version.d.ts +0 -6
  377. package/dist/hoi4_agent_tools/version.d.ts.map +0 -1
  378. package/dist/hoi4_agent_tools/version.js.map +0 -1
  379. package/dist/index.d.ts +0 -3
  380. package/dist/index.d.ts.map +0 -1
  381. package/dist/index.js +0 -3
  382. package/dist/index.js.map +0 -1
  383. package/docs/adr/0001-runtime-and-language.md +0 -16
  384. package/docs/adr/0002-lossless-source-model.md +0 -18
  385. package/docs/adr/0003-image-and-font-codecs.md +0 -18
  386. package/docs/adr/0004-focus-layout.md +0 -16
  387. package/docs/adr/0005-offline-rendering.md +0 -18
  388. package/docs/adr/0006-mcp-sdk-and-protocol.md +0 -16
  389. package/docs/adr/0007-storage-and-transactions.md +0 -24
  390. package/docs/adr/0008-test-strategy.md +0 -18
  391. package/docs/adr/0009-packaging-and-registry.md +0 -16
  392. package/docs/adr/0010-unsupported-and-refusal-policy.md +0 -18
  393. package/docs/adr/0011-http-security.md +0 -16
  394. package/docs/adr/README.md +0 -13
  395. package/docs/agent-integration.md +0 -136
  396. package/docs/architecture.md +0 -60
  397. package/docs/artifacts.md +0 -133
  398. package/docs/compatibility.md +0 -33
  399. package/docs/completion-report.md +0 -162
  400. package/docs/configuration.md +0 -289
  401. package/docs/focus-workflow.md +0 -195
  402. package/docs/gui-workflow.md +0 -121
  403. package/docs/limitations.md +0 -31
  404. package/docs/map-workflow.md +0 -89
  405. package/docs/performance.md +0 -117
  406. package/docs/release.md +0 -220
  407. package/docs/research/mcp-2026-07-10.md +0 -46
  408. package/docs/research/source-ledger.md +0 -68
  409. package/docs/security.md +0 -139
  410. package/docs/self-hosting.md +0 -168
  411. package/docs/testing.md +0 -43
  412. package/docs/third-party-notices.md +0 -11
  413. package/docs/transactions.md +0 -168
  414. package/docs/troubleshooting.md +0 -46
  415. package/schemas/configuration.schema.json +0 -794
  416. package/schemas/continuous-focus-palette.schema.json +0 -325
  417. package/schemas/focus-plan.schema.json +0 -927
  418. package/schemas/focus-planning-sidecar.schema.json +0 -379
  419. package/schemas/gui-animation-source.schema.json +0 -176
  420. package/schemas/gui-helper.schema.json +0 -301
  421. package/schemas/gui-scenario.schema.json +0 -298
  422. package/schemas/map-operation.schema.json +0 -2284
  423. package/schemas/operation-result.schema.json +0 -344
  424. package/schemas/transaction-manifest.schema.json +0 -685
@@ -1,22 +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';
9
+ import { requireServerScope } from '../server/base-tools.js';
10
+ import { autonomousFailureContext, autonomousResultArtifacts, executePlannedTransaction, } from '../server/transaction-execution.js';
10
11
  import { allocationEvidenceSchema, bitmapRenderHashesSchema, nonNegativeIntegerSchema, operationBlockerDataSchema, sha256Schema, } from '../server/output-schemas.js';
11
12
  import { progressReporter } from '../server/progress.js';
12
13
  import { errorResult, setInlineFilesScanned, strictOperationResultSchema, toolResult, } from '../server/result.js';
13
- const rgbSchema = z
14
- .object({
15
- r: z.number().int().min(0).max(255),
16
- g: z.number().int().min(0).max(255),
17
- b: z.number().int().min(0).max(255),
18
- })
19
- .strict();
20
14
  const changedBoundsSchema = z
21
15
  .object({
22
16
  minX: nonNegativeIntegerSchema,
@@ -69,7 +63,7 @@ const mapSemanticDiffSchema = z
69
63
  normalAdjacenciesChanged: z.boolean(),
70
64
  })
71
65
  .strict();
72
- const mapScanOutputSchema = strictOperationResultSchema(z
66
+ const mapWorkspaceInspectOutputSchema = strictOperationResultSchema(z
73
67
  .object({
74
68
  revision: sha256Schema,
75
69
  sharedRevision: sha256Schema,
@@ -79,22 +73,19 @@ const mapScanOutputSchema = strictOperationResultSchema(z
79
73
  states: nonNegativeIntegerSchema,
80
74
  regions: nonNegativeIntegerSchema,
81
75
  ports: nonNegativeIntegerSchema,
82
- })
83
- .strict());
84
- const mapInspectOutputSchema = strictOperationResultSchema(z
85
- .object({
86
- revision: sha256Schema,
87
- provinceCount: nonNegativeIntegerSchema,
88
- stateCount: nonNegativeIntegerSchema,
89
- regionCount: nonNegativeIntegerSchema,
90
- })
91
- .strict());
92
- const mapAllocationOutputSchema = strictOperationResultSchema(z
93
- .object({
94
- stateId: nonNegativeIntegerSchema.optional(),
95
- provinceId: nonNegativeIntegerSchema.optional(),
96
- color: rgbSchema.optional(),
97
- 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),
98
89
  })
99
90
  .strict());
100
91
  const mapRenderOutputSchema = strictOperationResultSchema(z
@@ -106,9 +97,9 @@ const mapRenderOutputSchema = strictOperationResultSchema(z
106
97
  offlineRepresentation: z.literal(true),
107
98
  })
108
99
  .strict());
109
- const mapValidateOutputSchema = strictOperationResultSchema(z.object({ revision: sha256Schema, diagnosticCount: nonNegativeIntegerSchema }).strict());
110
100
  const mapPlanOutputSchema = strictOperationResultSchema(z
111
101
  .object({
102
+ execution: z.enum(['applied', 'blocked', 'unchanged']),
112
103
  allocations: z.array(allocationEvidenceSchema).max(100),
113
104
  operationBlockers: z.array(operationBlockerDataSchema).max(100),
114
105
  expectedChangedBounds: changedBoundsSchema.nullable(),
@@ -117,9 +108,8 @@ const mapPlanOutputSchema = strictOperationResultSchema(z
117
108
  semanticDiff: mapSemanticDiffSchema,
118
109
  semanticDiffCounts: z.record(z.string().max(256), nonNegativeIntegerSchema),
119
110
  semanticDiffTruncated: z.boolean(),
120
- expiresAt: z.iso.datetime(),
121
- transactionFileCount: nonNegativeIntegerSchema,
122
- transactionArtifactCount: nonNegativeIntegerSchema,
111
+ fileCount: nonNegativeIntegerSchema,
112
+ artifactCount: nonNegativeIntegerSchema,
123
113
  })
124
114
  .strict());
125
115
  const artifactProducing = {
@@ -252,58 +242,230 @@ function mapArtifactSourceEvidence(files) {
252
242
  const complete = Object.fromEntries(files.map(({ displayPath, sha256 }) => [displayPath, sha256]));
253
243
  return { complete, bounded: boundedSourceHashEvidence(complete) };
254
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
+ }
255
345
  export function registerMapTools(server, engine, context) {
256
346
  const nudger = new AgentNudger(engine);
257
- server.registerTool('hoi4.map_scan', {
258
- title: 'Scan HOI4 map sources',
259
- description: 'Index province geometry, definitions, states, regions, ownership, networks, adjacencies, positions, locators, ports, and localisation across active roots.',
260
- inputSchema: z.object({ workspaceId: workspaceIdSchema }).strict(),
261
- 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,
262
364
  annotations: artifactProducing,
263
- }, async ({ workspaceId }, extra) => {
365
+ }, async ({ workspaceId, provinceIds, stateIds, regionIds, allocationRequests }, extra) => {
264
366
  try {
265
367
  const progress = progressReporter(extra);
266
- await progress.report(0, 3, 'Scanning shared and map indexes');
368
+ await progress.report(0, 3, 'Inspecting and validating the map');
267
369
  const [shared, { snapshot, validation }] = await Promise.all([
268
370
  engine.scan(workspaceId, {}, context.principal, progress.signal),
269
371
  nudger.validate(workspaceId, context.principal, progress.signal),
270
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
+ }
271
384
  const workspace = engine.resolver.get(workspaceId, context.principal);
272
385
  const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
273
- const artifact = await engine.artifacts.putChunked(workspace, `map-scan.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
274
- schemaVersion: 1,
275
- revision: snapshot.revision,
276
- sharedRevision: shared.revision,
277
- dimensions: snapshot.index.raster === undefined
278
- ? null
279
- : {
280
- width: snapshot.index.raster.width,
281
- height: snapshot.index.raster.height,
282
- bitsPerPixel: snapshot.index.provinceBitmap?.bitsPerPixel,
283
- dibSize: snapshot.index.provinceBitmap?.dibSize,
284
- },
285
- counts: {
286
- definitions: snapshot.index.definitions.length,
287
- states: snapshot.index.states.length,
288
- regions: snapshot.index.regions.length,
289
- adjacencies: snapshot.index.adjacencies.length,
290
- supplyNodes: snapshot.index.supplyNodes.length,
291
- railways: snapshot.index.railways.length,
292
- ports: snapshot.index.ports.length,
293
- locators: snapshot.index.entityLocators.length,
294
- },
295
- validation,
296
- sourceHashes: sourceEvidence.complete,
297
- })}\n`, {
298
- kind: 'map-scan',
386
+ const inspectionProvenance = {
387
+ kind: 'map-inspect',
299
388
  toolVersion: PACKAGE_VERSION,
300
- schemaVersion: 'map-scan.v1',
389
+ schemaVersion: 'map-inspect.v1',
301
390
  sourceHashes: sourceEvidence.bounded.sourceHashes,
302
391
  metadata: {
303
392
  sharedRevision: shared.revision,
304
393
  sourceHashInventory: sourceEvidence.bounded.inventory,
305
394
  },
306
- }, '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);
307
469
  const result = emptyServiceResult(workspaceId, {
308
470
  revision: snapshot.revision,
309
471
  sharedRevision: shared.revision,
@@ -313,154 +475,21 @@ export function registerMapTools(server, engine, context) {
313
475
  states: snapshot.index.states.length,
314
476
  regions: snapshot.index.regions.length,
315
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 ?? [],
316
487
  });
317
- result.code = 'MAP_SCANNED';
488
+ result.code = 'MAP_INSPECTED';
318
489
  setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
319
490
  result.diagnostics = validation.diagnostics.slice(0, 100);
320
- result.artifacts = [publicArtifactLink(artifact)];
491
+ result.artifacts = artifacts.map(publicArtifactLink);
321
492
  result.validation = validationSummary(validation);
322
- await progress.report(3, 3, 'Map scan complete');
323
- return toolResult(result);
324
- }
325
- catch (error) {
326
- return errorResult(error, workspaceId);
327
- }
328
- });
329
- server.registerTool('hoi4.map_inspect', {
330
- title: 'Inspect indexed map entities',
331
- description: 'Return bounded semantic details for selected province, state, and strategic-region IDs as a resource artifact.',
332
- inputSchema: z
333
- .object({
334
- workspaceId: workspaceIdSchema,
335
- provinceIds: z.array(z.number().int().min(0)).max(1000).default([]),
336
- stateIds: z.array(z.number().int().positive()).max(1000).default([]),
337
- regionIds: z.array(z.number().int().positive()).max(1000).default([]),
338
- })
339
- .strict(),
340
- outputSchema: mapInspectOutputSchema,
341
- annotations: artifactProducing,
342
- }, async ({ workspaceId, provinceIds, stateIds, regionIds }, extra) => {
343
- try {
344
- const progress = progressReporter(extra);
345
- await progress.report(0, 3, 'Scanning map index for selected entities');
346
- const snapshot = await nudger.scan(workspaceId, context.principal, progress.signal);
347
- const provinces = [...new Set(provinceIds)]
348
- .sort((a, b) => a - b)
349
- .map((id) => {
350
- const definition = snapshot.index.definitionsById.get(id);
351
- const geometry = snapshot.index.raster?.geometry.get(id);
352
- return {
353
- id,
354
- definition: definition === undefined
355
- ? null
356
- : {
357
- color: definition.color,
358
- type: definition.type,
359
- coastal: definition.coastal,
360
- terrain: definition.terrain,
361
- continent: definition.continent,
362
- },
363
- geometry: geometry ?? null,
364
- stateIds: snapshot.index.stateForProvince(id).map(({ id: state }) => state),
365
- regionIds: snapshot.index.regionForProvince(id).map(({ id: region }) => region),
366
- victoryPoints: snapshot.index.victoryPointsByProvince
367
- .get(id)
368
- ?.map(({ stateId: state, value }) => ({ stateId: state, value })) ?? [],
369
- provinceBuildings: snapshot.index.provinceBuildingsByProvince
370
- .get(id)
371
- ?.map(({ stateId: state, buildings }) => ({
372
- stateId: state,
373
- buildings: Object.fromEntries(buildings),
374
- })) ?? [],
375
- port: (() => {
376
- const port = snapshot.index.ports.find(({ provinceId }) => provinceId === id);
377
- return port === undefined
378
- ? null
379
- : {
380
- stateId: port.stateId,
381
- provinceId: port.provinceId,
382
- level: port.level,
383
- coastal: port.coastal,
384
- adjacentSeaProvinceIds: port.adjacentSeaProvinceIds,
385
- positions: port.positions.map(({ stateId, building, x, y, z, rotation, adjacentSeaProvince }) => ({
386
- stateId,
387
- building,
388
- x,
389
- y,
390
- z,
391
- rotation,
392
- adjacentSeaProvince,
393
- })),
394
- };
395
- })(),
396
- };
397
- });
398
- const states = [...new Set(stateIds)]
399
- .sort((a, b) => a - b)
400
- .map((id) => {
401
- const state = snapshot.index.statesById.get(id);
402
- return state === undefined
403
- ? { id, value: null }
404
- : {
405
- id,
406
- value: {
407
- name: state.name,
408
- capital: state.capital ?? null,
409
- manpower: state.manpower,
410
- category: state.category,
411
- provinces: state.provinces,
412
- resources: Object.fromEntries(state.resources),
413
- owner: state.owner ?? null,
414
- controller: state.controller ?? null,
415
- cores: state.cores,
416
- claims: state.claims,
417
- victoryPoints: state.victoryPoints.map(({ provinceId, value }) => ({
418
- provinceId,
419
- value,
420
- })),
421
- stateBuildings: Object.fromEntries(state.stateBuildings),
422
- provinceBuildings: Object.fromEntries([...state.provinceBuildings].map(([provinceId, buildings]) => [
423
- String(provinceId),
424
- Object.fromEntries(buildings),
425
- ])),
426
- },
427
- };
428
- });
429
- const regions = [...new Set(regionIds)]
430
- .sort((a, b) => a - b)
431
- .map((id) => {
432
- const region = snapshot.index.regionsById.get(id);
433
- return region === undefined
434
- ? { id, value: null }
435
- : {
436
- id,
437
- value: {
438
- name: region.name,
439
- provinces: region.provinces,
440
- navalTerrain: region.navalTerrain ?? null,
441
- },
442
- };
443
- });
444
- const data = { schemaVersion: 1, revision: snapshot.revision, provinces, states, regions };
445
- await progress.report(2, 3, 'Writing bounded map inspection evidence');
446
- const workspace = engine.resolver.get(workspaceId, context.principal);
447
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
448
- const artifact = await engine.artifacts.putChunked(workspace, `map-inspect.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({ ...data, sourceHashes: sourceEvidence.complete })}\n`, {
449
- kind: 'map-inspect',
450
- toolVersion: PACKAGE_VERSION,
451
- schemaVersion: 'map-inspect.v1',
452
- sourceHashes: sourceEvidence.bounded.sourceHashes,
453
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
454
- }, 'Selected map entity details', progress.signal);
455
- const result = emptyServiceResult(workspaceId, {
456
- revision: snapshot.revision,
457
- provinceCount: provinces.length,
458
- stateCount: states.length,
459
- regionCount: regions.length,
460
- });
461
- result.code = 'MAP_INSPECTED';
462
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
463
- result.artifacts = [publicArtifactLink(artifact)];
464
493
  await progress.report(3, 3, 'Map inspection complete');
465
494
  return toolResult(result);
466
495
  }
@@ -468,54 +497,9 @@ export function registerMapTools(server, engine, context) {
468
497
  return errorResult(error, workspaceId);
469
498
  }
470
499
  });
471
- server.registerTool('hoi4.map_allocate', {
472
- title: 'Preview map ID and color allocation',
473
- description: 'Scan every configured root, then deterministically preview a free state ID or contiguous province ID and collision-free color without writing.',
474
- inputSchema: z
475
- .object({ workspaceId: workspaceIdSchema, request: mapAllocationRequestSchema })
476
- .strict(),
477
- outputSchema: mapAllocationOutputSchema,
478
- annotations: artifactProducing,
479
- }, async ({ workspaceId, request }, extra) => {
480
- try {
481
- const progress = progressReporter(extra);
482
- await progress.report(0, 3, 'Scanning every map source for identifiers and colors');
483
- const snapshot = await nudger.scan(workspaceId, context.principal, progress.signal);
484
- const allocation = await allocateMapIdentifiersAsync(snapshot.index, request, progress.signal);
485
- progress.signal.throwIfAborted();
486
- await progress.report(2, 3, 'Writing allocation evidence');
487
- const workspace = engine.resolver.get(workspaceId, context.principal);
488
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
489
- const artifact = await engine.artifacts.putChunked(workspace, `map-allocation.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
490
- schemaVersion: 1,
491
- revision: snapshot.revision,
492
- request,
493
- allocation,
494
- sourceHashes: sourceEvidence.complete,
495
- })}\n`, {
496
- kind: 'map-allocation',
497
- toolVersion: PACKAGE_VERSION,
498
- schemaVersion: 'map-allocation.v1',
499
- sourceHashes: sourceEvidence.bounded.sourceHashes,
500
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
501
- }, 'Allocation evidence from every active source root', progress.signal);
502
- const result = emptyServiceResult(workspaceId, {
503
- ...allocation,
504
- evidence: allocation.evidence.map(compactAllocationEvidence),
505
- });
506
- result.code = 'MAP_ALLOCATION_PREVIEWED';
507
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
508
- result.artifacts = [publicArtifactLink(artifact)];
509
- await progress.report(3, 3, 'Map allocation preview complete');
510
- return toolResult(result);
511
- }
512
- catch (error) {
513
- return errorResult(error, workspaceId);
514
- }
515
- });
516
500
  server.registerTool('hoi4.map_render', {
517
501
  title: 'Render map inspection artifacts',
518
- 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.',
519
503
  inputSchema: z
520
504
  .object({
521
505
  workspaceId: workspaceIdSchema,
@@ -554,51 +538,9 @@ export function registerMapTools(server, engine, context) {
554
538
  return errorResult(error, workspaceId);
555
539
  }
556
540
  });
557
- server.registerTool('hoi4.map_validate', {
558
- title: 'Validate map workspace',
559
- description: 'Run static map, bitmap, membership, network, coast, port, locator, reference, and localisation validation without launching the game.',
560
- inputSchema: z.object({ workspaceId: workspaceIdSchema }).strict(),
561
- outputSchema: mapValidateOutputSchema,
562
- annotations: artifactProducing,
563
- }, async ({ workspaceId }, extra) => {
564
- try {
565
- const progress = progressReporter(extra);
566
- await progress.report(0, 3, 'Scanning and validating map sources');
567
- const { snapshot, validation } = await nudger.validate(workspaceId, context.principal, progress.signal);
568
- await progress.report(2, 3, 'Writing map validation evidence');
569
- const workspace = engine.resolver.get(workspaceId, context.principal);
570
- const sourceEvidence = mapArtifactSourceEvidence(snapshot.files);
571
- const artifact = await engine.artifacts.putChunked(workspace, `map-validation.${snapshot.revision.slice(0, 16)}.json`, 'application/json', `${canonicalJson({
572
- schemaVersion: 1,
573
- revision: snapshot.revision,
574
- validation,
575
- sourceHashes: sourceEvidence.complete,
576
- })}\n`, {
577
- kind: 'map-validation',
578
- toolVersion: PACKAGE_VERSION,
579
- schemaVersion: 'map-validation.v1',
580
- sourceHashes: sourceEvidence.bounded.sourceHashes,
581
- metadata: { sourceHashInventory: sourceEvidence.bounded.inventory },
582
- }, 'Complete source-linked map validation report', progress.signal);
583
- const result = emptyServiceResult(workspaceId, {
584
- revision: snapshot.revision,
585
- diagnosticCount: validation.diagnostics.length,
586
- });
587
- result.code = 'MAP_VALIDATED';
588
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
589
- result.diagnostics = validation.diagnostics.slice(0, 100);
590
- result.artifacts = [publicArtifactLink(artifact)];
591
- result.validation = validationSummary(validation);
592
- await progress.report(3, 3, 'Map validation complete');
593
- return toolResult(result);
594
- }
595
- catch (error) {
596
- return errorResult(error, workspaceId);
597
- }
598
- });
599
- server.registerTool('hoi4.map_plan', {
600
- title: 'Dry-run declarative map operations',
601
- description: 'Plan exact state/localisation, province, hash-bound mask, bitmap-normal/special adjacency, region, network, position, and locator changes with pixel/semantic diffs; never applies 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.',
602
544
  inputSchema: z
603
545
  .object({
604
546
  workspaceId: workspaceIdSchema,
@@ -609,7 +551,7 @@ export function registerMapTools(server, engine, context) {
609
551
  outputSchema: mapPlanOutputSchema,
610
552
  annotations: {
611
553
  readOnlyHint: false,
612
- destructiveHint: false,
554
+ destructiveHint: true,
613
555
  idempotentHint: false,
614
556
  openWorldHint: false,
615
557
  },
@@ -619,22 +561,21 @@ export function registerMapTools(server, engine, context) {
619
561
  const progress = progressReporter(extra);
620
562
  await progress.report(0, 5, 'Planning map operations and visual diff');
621
563
  const typedOperations = operations;
622
- const diff = await nudger.renderDiffAndStore(workspaceId, typedOperations, {
623
- ...(diffScale === undefined ? {} : { scale: diffScale }),
624
- ...(context.principal === undefined ? {} : { principal: context.principal }),
625
- signal: progress.signal,
626
- });
627
- await progress.report(3, 5, 'Creating hash-bound map transaction');
628
- const planned = await nudger.plan({
564
+ const planned = await nudger.planRewriteWithDiff({
629
565
  workspaceId,
630
566
  operations: typedOperations,
631
- artifacts: diff.artifacts.map(publicArtifactLink),
567
+ ...(diffScale === undefined ? {} : { diffScale }),
632
568
  ...(context.principal === undefined ? {} : { principal: context.principal }),
633
569
  signal: progress.signal,
634
570
  });
635
- const transaction = planned.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');
574
+ const execution = await executePlannedTransaction(engine, planned.transaction, context.principal, progress.signal);
575
+ const transaction = execution.transaction;
636
576
  const compactSemantic = compactMapSemanticDiff(diff.bundle.semantic);
637
577
  const result = emptyServiceResult(workspaceId, {
578
+ execution: execution.outcome,
638
579
  allocations: planned.plan.allocations.slice(0, 100).map(compactAllocationEvidence),
639
580
  operationBlockers: planned.plan.blockers
640
581
  .slice(0, 100)
@@ -645,22 +586,24 @@ export function registerMapTools(server, engine, context) {
645
586
  semanticDiff: compactSemantic.semantic,
646
587
  semanticDiffCounts: compactSemantic.counts,
647
588
  semanticDiffTruncated: compactSemantic.truncated,
648
- expiresAt: transaction.expiresAt,
649
- transactionFileCount: transaction.files.length,
650
- transactionArtifactCount: transaction.artifacts.length,
589
+ fileCount: transaction.files.length,
590
+ artifactCount: transaction.artifacts.length,
651
591
  });
652
592
  result.status = transaction.validation.passed ? 'ok' : 'blocked';
653
- result.code = transaction.validation.passed ? 'MAP_CHANGES_PLANNED' : 'MAP_CHANGES_BLOCKED';
593
+ result.code =
594
+ execution.outcome === 'applied'
595
+ ? 'MAP_CHANGES_APPLIED'
596
+ : execution.outcome === 'unchanged'
597
+ ? 'MAP_CHANGES_UNCHANGED'
598
+ : 'MAP_CHANGES_BLOCKED';
654
599
  setInlineFilesScanned(result, diff.filesScanned);
655
600
  result.proposedFiles = transaction.files
656
601
  .slice(0, 100)
657
602
  .map(({ relativePath }) => relativePath);
603
+ result.changedFiles = transaction.appliedFiles.slice(0, 100);
658
604
  result.diagnostics = transaction.diagnostics.slice(0, 100);
659
- result.transactionId = transaction.transactionId;
660
- result.planHash = transaction.planHash;
661
- result.artifacts = [transactionResourceLink(transaction)];
605
+ result.artifacts = autonomousResultArtifacts(execution);
662
606
  result.validation = transaction.validation;
663
- result.rollbackStatus = transaction.rollbackStatus;
664
607
  result.blockers = [
665
608
  ...planned.plan.blockers.map(({ code, message }) => ({
666
609
  code,
@@ -674,12 +617,15 @@ export function registerMapTools(server, engine, context) {
674
617
  ...(details === undefined ? {} : { details }),
675
618
  })),
676
619
  ].slice(0, 100);
677
- await progress.report(5, 5, 'Map dry run complete');
620
+ await progress.report(5, 5, execution.outcome === 'applied'
621
+ ? 'Map rewrite complete'
622
+ : execution.outcome === 'unchanged'
623
+ ? 'Map content already satisfied the operations'
624
+ : 'Map rewrite blocked');
678
625
  return toolResult(result);
679
626
  }
680
627
  catch (error) {
681
- return errorResult(error, workspaceId);
628
+ return errorResult(error, workspaceId, autonomousFailureContext(error));
682
629
  }
683
630
  });
684
631
  }
685
- //# sourceMappingURL=map.js.map