hoi4-agent-tools 0.0.0-bootstrap.1 → 0.1.2

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 (416) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/LICENSE +201 -0
  3. package/README.md +140 -2
  4. package/SECURITY.md +17 -0
  5. package/dist/bin/http.d.ts +3 -0
  6. package/dist/bin/http.d.ts.map +1 -0
  7. package/dist/bin/http.js +27 -0
  8. package/dist/bin/http.js.map +1 -0
  9. package/dist/bin/setup.d.ts +3 -0
  10. package/dist/bin/setup.d.ts.map +1 -0
  11. package/dist/bin/setup.js +188 -0
  12. package/dist/bin/setup.js.map +1 -0
  13. package/dist/bin/stdio.d.ts +3 -0
  14. package/dist/bin/stdio.d.ts.map +1 -0
  15. package/dist/bin/stdio.js +36 -0
  16. package/dist/bin/stdio.js.map +1 -0
  17. package/dist/hoi4_agent_tools/core/artifacts.d.ts +117 -0
  18. package/dist/hoi4_agent_tools/core/artifacts.d.ts.map +1 -0
  19. package/dist/hoi4_agent_tools/core/artifacts.js +1047 -0
  20. package/dist/hoi4_agent_tools/core/artifacts.js.map +1 -0
  21. package/dist/hoi4_agent_tools/core/canonical.d.ts +13 -0
  22. package/dist/hoi4_agent_tools/core/canonical.d.ts.map +1 -0
  23. package/dist/hoi4_agent_tools/core/canonical.js +41 -0
  24. package/dist/hoi4_agent_tools/core/canonical.js.map +1 -0
  25. package/dist/hoi4_agent_tools/core/configuration.d.ts +137 -0
  26. package/dist/hoi4_agent_tools/core/configuration.d.ts.map +1 -0
  27. package/dist/hoi4_agent_tools/core/configuration.js +383 -0
  28. package/dist/hoi4_agent_tools/core/configuration.js.map +1 -0
  29. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts +18 -0
  30. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts.map +1 -0
  31. package/dist/hoi4_agent_tools/core/diagnostic-collector.js +45 -0
  32. package/dist/hoi4_agent_tools/core/diagnostic-collector.js.map +1 -0
  33. package/dist/hoi4_agent_tools/core/diagnostics.d.ts +26 -0
  34. package/dist/hoi4_agent_tools/core/diagnostics.d.ts.map +1 -0
  35. package/dist/hoi4_agent_tools/core/diagnostics.js +25 -0
  36. package/dist/hoi4_agent_tools/core/diagnostics.js.map +1 -0
  37. package/dist/hoi4_agent_tools/core/diff.d.ts +22 -0
  38. package/dist/hoi4_agent_tools/core/diff.d.ts.map +1 -0
  39. package/dist/hoi4_agent_tools/core/diff.js +93 -0
  40. package/dist/hoi4_agent_tools/core/diff.js.map +1 -0
  41. package/dist/hoi4_agent_tools/core/engine.d.ts +56 -0
  42. package/dist/hoi4_agent_tools/core/engine.d.ts.map +1 -0
  43. package/dist/hoi4_agent_tools/core/engine.js +319 -0
  44. package/dist/hoi4_agent_tools/core/engine.js.map +1 -0
  45. package/dist/hoi4_agent_tools/core/image-diff.d.ts +14 -0
  46. package/dist/hoi4_agent_tools/core/image-diff.d.ts.map +1 -0
  47. package/dist/hoi4_agent_tools/core/image-diff.js +121 -0
  48. package/dist/hoi4_agent_tools/core/image-diff.js.map +1 -0
  49. package/dist/hoi4_agent_tools/core/index.d.ts +64 -0
  50. package/dist/hoi4_agent_tools/core/index.d.ts.map +1 -0
  51. package/dist/hoi4_agent_tools/core/index.js +963 -0
  52. package/dist/hoi4_agent_tools/core/index.js.map +1 -0
  53. package/dist/hoi4_agent_tools/core/index.public.d.ts +16 -0
  54. package/dist/hoi4_agent_tools/core/index.public.d.ts.map +1 -0
  55. package/dist/hoi4_agent_tools/core/index.public.js +16 -0
  56. package/dist/hoi4_agent_tools/core/index.public.js.map +1 -0
  57. package/dist/hoi4_agent_tools/core/render-budget.d.ts +51 -0
  58. package/dist/hoi4_agent_tools/core/render-budget.d.ts.map +1 -0
  59. package/dist/hoi4_agent_tools/core/render-budget.js +109 -0
  60. package/dist/hoi4_agent_tools/core/render-budget.js.map +1 -0
  61. package/dist/hoi4_agent_tools/core/result.d.ts +45 -0
  62. package/dist/hoi4_agent_tools/core/result.d.ts.map +1 -0
  63. package/dist/hoi4_agent_tools/core/result.js +26 -0
  64. package/dist/hoi4_agent_tools/core/result.js.map +1 -0
  65. package/dist/hoi4_agent_tools/core/scanner.d.ts +28 -0
  66. package/dist/hoi4_agent_tools/core/scanner.d.ts.map +1 -0
  67. package/dist/hoi4_agent_tools/core/scanner.js +136 -0
  68. package/dist/hoi4_agent_tools/core/scanner.js.map +1 -0
  69. package/dist/hoi4_agent_tools/core/server-state.d.ts +31 -0
  70. package/dist/hoi4_agent_tools/core/server-state.d.ts.map +1 -0
  71. package/dist/hoi4_agent_tools/core/server-state.js +413 -0
  72. package/dist/hoi4_agent_tools/core/server-state.js.map +1 -0
  73. package/dist/hoi4_agent_tools/core/source/encoding.d.ts +10 -0
  74. package/dist/hoi4_agent_tools/core/source/encoding.d.ts.map +1 -0
  75. package/dist/hoi4_agent_tools/core/source/encoding.js +54 -0
  76. package/dist/hoi4_agent_tools/core/source/encoding.js.map +1 -0
  77. package/dist/hoi4_agent_tools/core/source/index.d.ts +7 -0
  78. package/dist/hoi4_agent_tools/core/source/index.d.ts.map +1 -0
  79. package/dist/hoi4_agent_tools/core/source/index.js +7 -0
  80. package/dist/hoi4_agent_tools/core/source/index.js.map +1 -0
  81. package/dist/hoi4_agent_tools/core/source/lexer.d.ts +30 -0
  82. package/dist/hoi4_agent_tools/core/source/lexer.d.ts.map +1 -0
  83. package/dist/hoi4_agent_tools/core/source/lexer.js +266 -0
  84. package/dist/hoi4_agent_tools/core/source/lexer.js.map +1 -0
  85. package/dist/hoi4_agent_tools/core/source/limits.d.ts +21 -0
  86. package/dist/hoi4_agent_tools/core/source/limits.d.ts.map +1 -0
  87. package/dist/hoi4_agent_tools/core/source/limits.js +49 -0
  88. package/dist/hoi4_agent_tools/core/source/limits.js.map +1 -0
  89. package/dist/hoi4_agent_tools/core/source/localisation.d.ts +20 -0
  90. package/dist/hoi4_agent_tools/core/source/localisation.d.ts.map +1 -0
  91. package/dist/hoi4_agent_tools/core/source/localisation.js +163 -0
  92. package/dist/hoi4_agent_tools/core/source/localisation.js.map +1 -0
  93. package/dist/hoi4_agent_tools/core/source/parser.d.ts +44 -0
  94. package/dist/hoi4_agent_tools/core/source/parser.d.ts.map +1 -0
  95. package/dist/hoi4_agent_tools/core/source/parser.js +334 -0
  96. package/dist/hoi4_agent_tools/core/source/parser.js.map +1 -0
  97. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts +10 -0
  98. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts.map +1 -0
  99. package/dist/hoi4_agent_tools/core/source/rewrite.js +28 -0
  100. package/dist/hoi4_agent_tools/core/source/rewrite.js.map +1 -0
  101. package/dist/hoi4_agent_tools/core/svg-text.d.ts +34 -0
  102. package/dist/hoi4_agent_tools/core/svg-text.d.ts.map +1 -0
  103. package/dist/hoi4_agent_tools/core/svg-text.js +127 -0
  104. package/dist/hoi4_agent_tools/core/svg-text.js.map +1 -0
  105. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts +9 -0
  106. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts.map +1 -0
  107. package/dist/hoi4_agent_tools/core/transaction-limits.js +9 -0
  108. package/dist/hoi4_agent_tools/core/transaction-limits.js.map +1 -0
  109. package/dist/hoi4_agent_tools/core/transactions.d.ts +162 -0
  110. package/dist/hoi4_agent_tools/core/transactions.d.ts.map +1 -0
  111. package/dist/hoi4_agent_tools/core/transactions.js +1181 -0
  112. package/dist/hoi4_agent_tools/core/transactions.js.map +1 -0
  113. package/dist/hoi4_agent_tools/core/workspace.d.ts +68 -0
  114. package/dist/hoi4_agent_tools/core/workspace.d.ts.map +1 -0
  115. package/dist/hoi4_agent_tools/core/workspace.js +794 -0
  116. package/dist/hoi4_agent_tools/core/workspace.js.map +1 -0
  117. package/dist/hoi4_agent_tools/focus/compiler.d.ts +9 -0
  118. package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +1 -0
  119. package/dist/hoi4_agent_tools/focus/compiler.js +273 -0
  120. package/dist/hoi4_agent_tools/focus/compiler.js.map +1 -0
  121. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts +32 -0
  122. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts.map +1 -0
  123. package/dist/hoi4_agent_tools/focus/continuous-render.js +179 -0
  124. package/dist/hoi4_agent_tools/focus/continuous-render.js.map +1 -0
  125. package/dist/hoi4_agent_tools/focus/drift.d.ts +22 -0
  126. package/dist/hoi4_agent_tools/focus/drift.d.ts.map +1 -0
  127. package/dist/hoi4_agent_tools/focus/drift.js +124 -0
  128. package/dist/hoi4_agent_tools/focus/drift.js.map +1 -0
  129. package/dist/hoi4_agent_tools/focus/geometry.d.ts +17 -0
  130. package/dist/hoi4_agent_tools/focus/geometry.d.ts.map +1 -0
  131. package/dist/hoi4_agent_tools/focus/geometry.js +35 -0
  132. package/dist/hoi4_agent_tools/focus/geometry.js.map +1 -0
  133. package/dist/hoi4_agent_tools/focus/importer.d.ts +9 -0
  134. package/dist/hoi4_agent_tools/focus/importer.d.ts.map +1 -0
  135. package/dist/hoi4_agent_tools/focus/importer.js +732 -0
  136. package/dist/hoi4_agent_tools/focus/importer.js.map +1 -0
  137. package/dist/hoi4_agent_tools/focus/index.d.ts +14 -0
  138. package/dist/hoi4_agent_tools/focus/index.d.ts.map +1 -0
  139. package/dist/hoi4_agent_tools/focus/index.js +14 -0
  140. package/dist/hoi4_agent_tools/focus/index.js.map +1 -0
  141. package/dist/hoi4_agent_tools/focus/layout.d.ts +5 -0
  142. package/dist/hoi4_agent_tools/focus/layout.d.ts.map +1 -0
  143. package/dist/hoi4_agent_tools/focus/layout.js +653 -0
  144. package/dist/hoi4_agent_tools/focus/layout.js.map +1 -0
  145. package/dist/hoi4_agent_tools/focus/limits.d.ts +9 -0
  146. package/dist/hoi4_agent_tools/focus/limits.d.ts.map +1 -0
  147. package/dist/hoi4_agent_tools/focus/limits.js +9 -0
  148. package/dist/hoi4_agent_tools/focus/limits.js.map +1 -0
  149. package/dist/hoi4_agent_tools/focus/lint.d.ts +14 -0
  150. package/dist/hoi4_agent_tools/focus/lint.d.ts.map +1 -0
  151. package/dist/hoi4_agent_tools/focus/lint.js +839 -0
  152. package/dist/hoi4_agent_tools/focus/lint.js.map +1 -0
  153. package/dist/hoi4_agent_tools/focus/model.d.ts +303 -0
  154. package/dist/hoi4_agent_tools/focus/model.d.ts.map +1 -0
  155. package/dist/hoi4_agent_tools/focus/model.js +20 -0
  156. package/dist/hoi4_agent_tools/focus/model.js.map +1 -0
  157. package/dist/hoi4_agent_tools/focus/native-effects.d.ts +9 -0
  158. package/dist/hoi4_agent_tools/focus/native-effects.d.ts.map +1 -0
  159. package/dist/hoi4_agent_tools/focus/native-effects.js +563 -0
  160. package/dist/hoi4_agent_tools/focus/native-effects.js.map +1 -0
  161. package/dist/hoi4_agent_tools/focus/planning.d.ts +15 -0
  162. package/dist/hoi4_agent_tools/focus/planning.d.ts.map +1 -0
  163. package/dist/hoi4_agent_tools/focus/planning.js +241 -0
  164. package/dist/hoi4_agent_tools/focus/planning.js.map +1 -0
  165. package/dist/hoi4_agent_tools/focus/presentation.d.ts +24 -0
  166. package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +1 -0
  167. package/dist/hoi4_agent_tools/focus/presentation.js +204 -0
  168. package/dist/hoi4_agent_tools/focus/presentation.js.map +1 -0
  169. package/dist/hoi4_agent_tools/focus/render.d.ts +35 -0
  170. package/dist/hoi4_agent_tools/focus/render.d.ts.map +1 -0
  171. package/dist/hoi4_agent_tools/focus/render.js +491 -0
  172. package/dist/hoi4_agent_tools/focus/render.js.map +1 -0
  173. package/dist/hoi4_agent_tools/focus/service.d.ts +82 -0
  174. package/dist/hoi4_agent_tools/focus/service.d.ts.map +1 -0
  175. package/dist/hoi4_agent_tools/focus/service.js +492 -0
  176. package/dist/hoi4_agent_tools/focus/service.js.map +1 -0
  177. package/dist/hoi4_agent_tools/focus/source-update.d.ts +6 -0
  178. package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +1 -0
  179. package/dist/hoi4_agent_tools/focus/source-update.js +328 -0
  180. package/dist/hoi4_agent_tools/focus/source-update.js.map +1 -0
  181. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts +37 -0
  182. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts.map +1 -0
  183. package/dist/hoi4_agent_tools/gui/animation-manifest.js +66 -0
  184. package/dist/hoi4_agent_tools/gui/animation-manifest.js.map +1 -0
  185. package/dist/hoi4_agent_tools/gui/assets.d.ts +71 -0
  186. package/dist/hoi4_agent_tools/gui/assets.d.ts.map +1 -0
  187. package/dist/hoi4_agent_tools/gui/assets.js +629 -0
  188. package/dist/hoi4_agent_tools/gui/assets.js.map +1 -0
  189. package/dist/hoi4_agent_tools/gui/dds.d.ts +17 -0
  190. package/dist/hoi4_agent_tools/gui/dds.d.ts.map +1 -0
  191. package/dist/hoi4_agent_tools/gui/dds.js +245 -0
  192. package/dist/hoi4_agent_tools/gui/dds.js.map +1 -0
  193. package/dist/hoi4_agent_tools/gui/helpers.d.ts +101 -0
  194. package/dist/hoi4_agent_tools/gui/helpers.d.ts.map +1 -0
  195. package/dist/hoi4_agent_tools/gui/helpers.js +1072 -0
  196. package/dist/hoi4_agent_tools/gui/helpers.js.map +1 -0
  197. package/dist/hoi4_agent_tools/gui/index.d.ts +15 -0
  198. package/dist/hoi4_agent_tools/gui/index.d.ts.map +1 -0
  199. package/dist/hoi4_agent_tools/gui/index.js +15 -0
  200. package/dist/hoi4_agent_tools/gui/index.js.map +1 -0
  201. package/dist/hoi4_agent_tools/gui/layout.d.ts +6 -0
  202. package/dist/hoi4_agent_tools/gui/layout.d.ts.map +1 -0
  203. package/dist/hoi4_agent_tools/gui/layout.js +753 -0
  204. package/dist/hoi4_agent_tools/gui/layout.js.map +1 -0
  205. package/dist/hoi4_agent_tools/gui/limits.d.ts +25 -0
  206. package/dist/hoi4_agent_tools/gui/limits.d.ts.map +1 -0
  207. package/dist/hoi4_agent_tools/gui/limits.js +27 -0
  208. package/dist/hoi4_agent_tools/gui/limits.js.map +1 -0
  209. package/dist/hoi4_agent_tools/gui/renderer.d.ts +18 -0
  210. package/dist/hoi4_agent_tools/gui/renderer.d.ts.map +1 -0
  211. package/dist/hoi4_agent_tools/gui/renderer.js +388 -0
  212. package/dist/hoi4_agent_tools/gui/renderer.js.map +1 -0
  213. package/dist/hoi4_agent_tools/gui/scenario.d.ts +66 -0
  214. package/dist/hoi4_agent_tools/gui/scenario.d.ts.map +1 -0
  215. package/dist/hoi4_agent_tools/gui/scenario.js +191 -0
  216. package/dist/hoi4_agent_tools/gui/scenario.js.map +1 -0
  217. package/dist/hoi4_agent_tools/gui/source-graph.d.ts +7 -0
  218. package/dist/hoi4_agent_tools/gui/source-graph.d.ts.map +1 -0
  219. package/dist/hoi4_agent_tools/gui/source-graph.js +1074 -0
  220. package/dist/hoi4_agent_tools/gui/source-graph.js.map +1 -0
  221. package/dist/hoi4_agent_tools/gui/source-patch.d.ts +13 -0
  222. package/dist/hoi4_agent_tools/gui/source-patch.d.ts.map +1 -0
  223. package/dist/hoi4_agent_tools/gui/source-patch.js +90 -0
  224. package/dist/hoi4_agent_tools/gui/source-patch.js.map +1 -0
  225. package/dist/hoi4_agent_tools/gui/studio.d.ts +86 -0
  226. package/dist/hoi4_agent_tools/gui/studio.d.ts.map +1 -0
  227. package/dist/hoi4_agent_tools/gui/studio.js +830 -0
  228. package/dist/hoi4_agent_tools/gui/studio.js.map +1 -0
  229. package/dist/hoi4_agent_tools/gui/tga.d.ts +16 -0
  230. package/dist/hoi4_agent_tools/gui/tga.d.ts.map +1 -0
  231. package/dist/hoi4_agent_tools/gui/tga.js +157 -0
  232. package/dist/hoi4_agent_tools/gui/tga.js.map +1 -0
  233. package/dist/hoi4_agent_tools/gui/types.d.ts +322 -0
  234. package/dist/hoi4_agent_tools/gui/types.d.ts.map +1 -0
  235. package/dist/hoi4_agent_tools/gui/types.js +19 -0
  236. package/dist/hoi4_agent_tools/gui/types.js.map +1 -0
  237. package/dist/hoi4_agent_tools/gui/validators.d.ts +8 -0
  238. package/dist/hoi4_agent_tools/gui/validators.d.ts.map +1 -0
  239. package/dist/hoi4_agent_tools/gui/validators.js +951 -0
  240. package/dist/hoi4_agent_tools/gui/validators.js.map +1 -0
  241. package/dist/hoi4_agent_tools/map/bmp.d.ts +62 -0
  242. package/dist/hoi4_agent_tools/map/bmp.d.ts.map +1 -0
  243. package/dist/hoi4_agent_tools/map/bmp.js +363 -0
  244. package/dist/hoi4_agent_tools/map/bmp.js.map +1 -0
  245. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts +5 -0
  246. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts.map +1 -0
  247. package/dist/hoi4_agent_tools/map/diagnostic-limit.js +21 -0
  248. package/dist/hoi4_agent_tools/map/diagnostic-limit.js.map +1 -0
  249. package/dist/hoi4_agent_tools/map/index.d.ts +8 -0
  250. package/dist/hoi4_agent_tools/map/index.d.ts.map +1 -0
  251. package/dist/hoi4_agent_tools/map/index.js +8 -0
  252. package/dist/hoi4_agent_tools/map/index.js.map +1 -0
  253. package/dist/hoi4_agent_tools/map/limits.d.ts +13 -0
  254. package/dist/hoi4_agent_tools/map/limits.d.ts.map +1 -0
  255. package/dist/hoi4_agent_tools/map/limits.js +13 -0
  256. package/dist/hoi4_agent_tools/map/limits.js.map +1 -0
  257. package/dist/hoi4_agent_tools/map/model.d.ts +269 -0
  258. package/dist/hoi4_agent_tools/map/model.d.ts.map +1 -0
  259. package/dist/hoi4_agent_tools/map/model.js +1114 -0
  260. package/dist/hoi4_agent_tools/map/model.js.map +1 -0
  261. package/dist/hoi4_agent_tools/map/operations.d.ts +401 -0
  262. package/dist/hoi4_agent_tools/map/operations.d.ts.map +1 -0
  263. package/dist/hoi4_agent_tools/map/operations.js +2717 -0
  264. package/dist/hoi4_agent_tools/map/operations.js.map +1 -0
  265. package/dist/hoi4_agent_tools/map/render.d.ts +90 -0
  266. package/dist/hoi4_agent_tools/map/render.d.ts.map +1 -0
  267. package/dist/hoi4_agent_tools/map/render.js +759 -0
  268. package/dist/hoi4_agent_tools/map/render.js.map +1 -0
  269. package/dist/hoi4_agent_tools/map/service.d.ts +81 -0
  270. package/dist/hoi4_agent_tools/map/service.d.ts.map +1 -0
  271. package/dist/hoi4_agent_tools/map/service.js +695 -0
  272. package/dist/hoi4_agent_tools/map/service.js.map +1 -0
  273. package/dist/hoi4_agent_tools/map/validation.d.ts +23 -0
  274. package/dist/hoi4_agent_tools/map/validation.d.ts.map +1 -0
  275. package/dist/hoi4_agent_tools/map/validation.js +1177 -0
  276. package/dist/hoi4_agent_tools/map/validation.js.map +1 -0
  277. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +3 -0
  278. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +1 -0
  279. package/dist/hoi4_agent_tools/mcp/prompts/register.js +50 -0
  280. package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +1 -0
  281. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +9 -0
  282. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts.map +1 -0
  283. package/dist/hoi4_agent_tools/mcp/registry/metadata.js +10 -0
  284. package/dist/hoi4_agent_tools/mcp/registry/metadata.js.map +1 -0
  285. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts +5 -0
  286. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +1 -0
  287. package/dist/hoi4_agent_tools/mcp/resources/register.js +278 -0
  288. package/dist/hoi4_agent_tools/mcp/resources/register.js.map +1 -0
  289. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts +24 -0
  290. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +1 -0
  291. package/dist/hoi4_agent_tools/mcp/security/auth.js +234 -0
  292. package/dist/hoi4_agent_tools/mcp/security/auth.js.map +1 -0
  293. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +35 -0
  294. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +1 -0
  295. package/dist/hoi4_agent_tools/mcp/server/base-tools.js +835 -0
  296. package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +1 -0
  297. package/dist/hoi4_agent_tools/mcp/server/create.d.ts +5 -0
  298. package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +1 -0
  299. package/dist/hoi4_agent_tools/mcp/server/create.js +26 -0
  300. package/dist/hoi4_agent_tools/mcp/server/create.js.map +1 -0
  301. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +133 -0
  302. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +1 -0
  303. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +127 -0
  304. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +1 -0
  305. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts +8 -0
  306. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts.map +1 -0
  307. package/dist/hoi4_agent_tools/mcp/server/progress.js +21 -0
  308. package/dist/hoi4_agent_tools/mcp/server/progress.js.map +1 -0
  309. package/dist/hoi4_agent_tools/mcp/server/result.d.ts +232 -0
  310. package/dist/hoi4_agent_tools/mcp/server/result.d.ts.map +1 -0
  311. package/dist/hoi4_agent_tools/mcp/server/result.js +353 -0
  312. package/dist/hoi4_agent_tools/mcp/server/result.js.map +1 -0
  313. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts +5 -0
  314. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +1 -0
  315. package/dist/hoi4_agent_tools/mcp/tools/focus.js +1059 -0
  316. package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +1 -0
  317. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +111 -0
  318. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +1 -0
  319. package/dist/hoi4_agent_tools/mcp/tools/gui.js +598 -0
  320. package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +1 -0
  321. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +5 -0
  322. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +1 -0
  323. package/dist/hoi4_agent_tools/mcp/tools/map.js +685 -0
  324. package/dist/hoi4_agent_tools/mcp/tools/map.js.map +1 -0
  325. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +58 -0
  326. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +1 -0
  327. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js +181 -0
  328. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +1 -0
  329. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +26 -0
  330. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +1 -0
  331. package/dist/hoi4_agent_tools/mcp/transports/event-store.js +86 -0
  332. package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +1 -0
  333. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +28 -0
  334. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +1 -0
  335. package/dist/hoi4_agent_tools/mcp/transports/http.js +744 -0
  336. package/dist/hoi4_agent_tools/mcp/transports/http.js.map +1 -0
  337. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +15 -0
  338. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +1 -0
  339. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js +51 -0
  340. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +1 -0
  341. package/dist/hoi4_agent_tools/runtime.d.ts +4 -0
  342. package/dist/hoi4_agent_tools/runtime.d.ts.map +1 -0
  343. package/dist/hoi4_agent_tools/runtime.js +27 -0
  344. package/dist/hoi4_agent_tools/runtime.js.map +1 -0
  345. package/dist/hoi4_agent_tools/schemas/common.d.ts +74 -0
  346. package/dist/hoi4_agent_tools/schemas/common.d.ts.map +1 -0
  347. package/dist/hoi4_agent_tools/schemas/common.js +51 -0
  348. package/dist/hoi4_agent_tools/schemas/common.js.map +1 -0
  349. package/dist/hoi4_agent_tools/schemas/focus.d.ts +784 -0
  350. package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +1 -0
  351. package/dist/hoi4_agent_tools/schemas/focus.js +330 -0
  352. package/dist/hoi4_agent_tools/schemas/focus.js.map +1 -0
  353. package/dist/hoi4_agent_tools/schemas/index.d.ts +5 -0
  354. package/dist/hoi4_agent_tools/schemas/index.d.ts.map +1 -0
  355. package/dist/hoi4_agent_tools/schemas/index.js +5 -0
  356. package/dist/hoi4_agent_tools/schemas/index.js.map +1 -0
  357. package/dist/hoi4_agent_tools/schemas/map.d.ts +654 -0
  358. package/dist/hoi4_agent_tools/schemas/map.d.ts.map +1 -0
  359. package/dist/hoi4_agent_tools/schemas/map.js +570 -0
  360. package/dist/hoi4_agent_tools/schemas/map.js.map +1 -0
  361. package/dist/hoi4_agent_tools/schemas/transaction.d.ts +259 -0
  362. package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +1 -0
  363. package/dist/hoi4_agent_tools/schemas/transaction.js +104 -0
  364. package/dist/hoi4_agent_tools/schemas/transaction.js.map +1 -0
  365. package/dist/hoi4_agent_tools/version.d.ts +6 -0
  366. package/dist/hoi4_agent_tools/version.d.ts.map +1 -0
  367. package/dist/hoi4_agent_tools/version.js +7 -0
  368. package/dist/hoi4_agent_tools/version.js.map +1 -0
  369. package/dist/index.d.ts +3 -0
  370. package/dist/index.d.ts.map +1 -0
  371. package/dist/index.js +3 -0
  372. package/dist/index.js.map +1 -0
  373. package/docs/README.md +22 -0
  374. package/docs/adr/0001-runtime-and-language.md +16 -0
  375. package/docs/adr/0002-lossless-source-model.md +18 -0
  376. package/docs/adr/0003-image-and-font-codecs.md +18 -0
  377. package/docs/adr/0004-focus-layout.md +16 -0
  378. package/docs/adr/0005-offline-rendering.md +18 -0
  379. package/docs/adr/0006-mcp-sdk-and-protocol.md +16 -0
  380. package/docs/adr/0007-storage-and-transactions.md +24 -0
  381. package/docs/adr/0008-test-strategy.md +18 -0
  382. package/docs/adr/0009-packaging-and-registry.md +16 -0
  383. package/docs/adr/0010-unsupported-and-refusal-policy.md +18 -0
  384. package/docs/adr/0011-http-security.md +16 -0
  385. package/docs/adr/README.md +13 -0
  386. package/docs/architecture.md +60 -0
  387. package/docs/artifacts.md +133 -0
  388. package/docs/compatibility.md +33 -0
  389. package/docs/completion-report.md +60 -0
  390. package/docs/configuration.md +285 -0
  391. package/docs/focus-workflow.md +68 -0
  392. package/docs/gui-workflow.md +121 -0
  393. package/docs/limitations.md +30 -0
  394. package/docs/map-workflow.md +89 -0
  395. package/docs/performance.md +117 -0
  396. package/docs/release.md +181 -0
  397. package/docs/research/mcp-2026-07-10.md +46 -0
  398. package/docs/research/source-ledger.md +68 -0
  399. package/docs/security.md +139 -0
  400. package/docs/self-hosting.md +168 -0
  401. package/docs/testing.md +43 -0
  402. package/docs/third-party-notices.md +11 -0
  403. package/docs/transactions.md +162 -0
  404. package/docs/troubleshooting.md +46 -0
  405. package/package.json +98 -5
  406. package/schemas/configuration.schema.json +794 -0
  407. package/schemas/continuous-focus-palette.schema.json +325 -0
  408. package/schemas/focus-plan.schema.json +902 -0
  409. package/schemas/focus-planning-sidecar.schema.json +364 -0
  410. package/schemas/gui-animation-source.schema.json +176 -0
  411. package/schemas/gui-helper.schema.json +301 -0
  412. package/schemas/gui-scenario.schema.json +298 -0
  413. package/schemas/map-operation.schema.json +2284 -0
  414. package/schemas/operation-result.schema.json +344 -0
  415. package/schemas/transaction-manifest.schema.json +685 -0
  416. package/server.json +32 -0
@@ -0,0 +1,695 @@
1
+ import path from 'node:path';
2
+ import fg from 'fast-glob';
3
+ import { ArtifactStore, boundedSourceHashEvidence, } from '../core/artifacts.js';
4
+ import { canonicalJson, compareCodeUnits, hashCanonical, sha256Bytes } from '../core/canonical.js';
5
+ import { sortDiagnostics } from '../core/diagnostics.js';
6
+ import { CoreEngine } from '../core/engine.js';
7
+ import { RenderBudget } from '../core/render-budget.js';
8
+ import { WorkspaceScanner } from '../core/scanner.js';
9
+ import { readDependenciesFromScannedFiles, } from '../core/transactions.js';
10
+ import { PACKAGE_VERSION } from '../version.js';
11
+ import { defaultMapSelectorValue, MapWorkspaceIndex } from './model.js';
12
+ import { planMapOperationsAsync } from './operations.js';
13
+ import { renderMap, renderMapDiff, } from './render.js';
14
+ import { validateMapAsync } from './validation.js';
15
+ const provinceOperationKinds = new Set([
16
+ 'split_province',
17
+ 'create_province',
18
+ 'merge_provinces',
19
+ 'remove_province',
20
+ 'update_province_definition',
21
+ 'add_normal_adjacency',
22
+ 'remove_normal_adjacency',
23
+ ]);
24
+ const stateOperationKinds = new Set([
25
+ 'move_state_provinces',
26
+ 'update_state',
27
+ 'split_state',
28
+ 'create_state',
29
+ 'merge_states',
30
+ ...provinceOperationKinds,
31
+ ]);
32
+ function normalizedDiagnosticPath(value) {
33
+ const normalized = value.replaceAll('\\', '/');
34
+ const displayPath = /^(?:mod|dependency|game|fixture):(.*)$/u.exec(normalized)?.[1];
35
+ const candidate = displayPath ?? normalized;
36
+ if (candidate.length === 0 ||
37
+ candidate.includes('://') ||
38
+ !candidate.includes('/') ||
39
+ candidate.startsWith('/')) {
40
+ return undefined;
41
+ }
42
+ return candidate.replace(/^\.\//u, '').toLowerCase();
43
+ }
44
+ function diagnosticPaths(diagnostic) {
45
+ const paths = new Set();
46
+ const add = (value) => {
47
+ const normalized = normalizedDiagnosticPath(value);
48
+ if (normalized !== undefined)
49
+ paths.add(normalized);
50
+ };
51
+ if (diagnostic.location !== undefined)
52
+ add(diagnostic.location.path);
53
+ for (const related of diagnostic.related ?? [])
54
+ add(related.path);
55
+ const visit = (value) => {
56
+ if (typeof value === 'string') {
57
+ add(value);
58
+ return;
59
+ }
60
+ if (Array.isArray(value)) {
61
+ for (const entry of value)
62
+ visit(entry);
63
+ return;
64
+ }
65
+ if (value !== null && typeof value === 'object') {
66
+ for (const entry of Object.values(value))
67
+ visit(entry);
68
+ }
69
+ };
70
+ visit(diagnostic.details);
71
+ return paths;
72
+ }
73
+ function diagnosticFingerprint(diagnostic) {
74
+ return hashCanonical({
75
+ code: diagnostic.code,
76
+ message: diagnostic.message,
77
+ path: diagnostic.location === undefined
78
+ ? null
79
+ : (normalizedDiagnosticPath(diagnostic.location.path) ?? diagnostic.location.path),
80
+ symbol: diagnostic.location?.symbol ?? null,
81
+ });
82
+ }
83
+ function operationKindsForDiagnostic(code) {
84
+ if (code.startsWith('MAP_BMP_') ||
85
+ code.startsWith('MAP_BITMAP_') ||
86
+ code.startsWith('MAP_PROVINCES_') ||
87
+ code.startsWith('MAP_DEFINITION_') ||
88
+ code.startsWith('MAP_PROVINCE_ID_') ||
89
+ code.startsWith('MAP_PROVINCE_COLOR_') ||
90
+ code.startsWith('MAP_PROVINCE_TOO_') ||
91
+ code.startsWith('MAP_PROVINCE_LARGE_') ||
92
+ code.startsWith('MAP_PROVINCE_DISCONNECTED_') ||
93
+ code.startsWith('MAP_PROVINCE_THIN_') ||
94
+ code.startsWith('MAP_COASTAL_') ||
95
+ code.startsWith('MAP_LAND_CONTINENT_') ||
96
+ code.startsWith('MAP_SEA_TERRAIN_') ||
97
+ code.startsWith('MAP_LAKE_TERRAIN_') ||
98
+ code.startsWith('MAP_DIMENSIONS_') ||
99
+ code.startsWith('MAP_AREA_') ||
100
+ code.startsWith('MAP_INVALID_X_') ||
101
+ code.startsWith('MAP_PIXELS_')) {
102
+ return provinceOperationKinds;
103
+ }
104
+ if (code.startsWith('MAP_STATE_') ||
105
+ code.startsWith('MAP_NEW_STATE_') ||
106
+ code.startsWith('MAP_LAND_PROVINCE_STATE_') ||
107
+ code.startsWith('MAP_PROVINCE_STATE_') ||
108
+ code.startsWith('MAP_SEA_PROVINCE_IN_STATE') ||
109
+ code.startsWith('MAP_LAKE_PROVINCE_IN_STATE') ||
110
+ code.startsWith('MAP_VICTORY_POINT_') ||
111
+ code.startsWith('MAP_PROVINCE_BUILDING_')) {
112
+ return stateOperationKinds;
113
+ }
114
+ if (code.startsWith('MAP_STRATEGIC_REGION_') ||
115
+ code.startsWith('MAP_REGION_') ||
116
+ code.startsWith('MAP_PROVINCE_REGION_')) {
117
+ return new Set(['move_region_provinces', ...provinceOperationKinds]);
118
+ }
119
+ if (code.startsWith('MAP_ADJACENCY_') ||
120
+ code.startsWith('MAP_IMPASSABLE_') ||
121
+ code.startsWith('MAP_SEA_ADJACENCY_')) {
122
+ return new Set([
123
+ 'add_adjacency',
124
+ 'remove_adjacency',
125
+ 'add_normal_adjacency',
126
+ 'remove_normal_adjacency',
127
+ ...provinceOperationKinds,
128
+ ]);
129
+ }
130
+ if (code.startsWith('MAP_SUPPLY_NODE_'))
131
+ return new Set(['add_supply_node', 'remove_supply_node', ...provinceOperationKinds]);
132
+ if (code.startsWith('MAP_RAILWAY_'))
133
+ return new Set(['add_railway', 'remove_railway', ...provinceOperationKinds]);
134
+ if (code.startsWith('MAP_BUILDING_') || code.startsWith('MAP_PORT_'))
135
+ return new Set([
136
+ 'upsert_building_position',
137
+ 'remove_building_position',
138
+ ...stateOperationKinds,
139
+ ]);
140
+ if (code.startsWith('MAP_UNIT_POSITION_'))
141
+ return new Set(['upsert_unit_position', 'remove_unit_position', ...provinceOperationKinds]);
142
+ if (code.startsWith('MAP_WEATHER_'))
143
+ return new Set(['upsert_weather_position', 'remove_weather_position', 'move_region_provinces']);
144
+ if (code.startsWith('MAP_ENTITY_LOCATOR_'))
145
+ return new Set(['update_entity_locator']);
146
+ return undefined;
147
+ }
148
+ /**
149
+ * Bind every post-operation validation error to the last manifest operation
150
+ * that owns its changed source. Pre-existing or otherwise unowned errors gain
151
+ * an explicit blocking ownership diagnostic rather than being guessed.
152
+ */
153
+ export function attributeMapValidationDiagnostics(input) {
154
+ const order = new Map(input.operations.map(({ id }, index) => [id, index]));
155
+ const operationKinds = new Map(input.operations.map(({ id, kind }) => [id, kind]));
156
+ const changedOperationIds = new Set(input.changes.flatMap(({ operationIds }) => operationIds));
157
+ const ownersByPath = new Map();
158
+ for (const change of input.changes) {
159
+ const relativePath = change.relativePath.replaceAll('\\', '/').toLowerCase();
160
+ const owners = ownersByPath.get(relativePath) ?? new Set();
161
+ for (const operationId of change.operationIds)
162
+ owners.add(operationId);
163
+ ownersByPath.set(relativePath, owners);
164
+ }
165
+ const baselineErrors = new Set((input.baselineDiagnostics ?? [])
166
+ .filter(({ severity }) => severity === 'error' || severity === 'blocker')
167
+ .map(diagnosticFingerprint));
168
+ const attributed = [];
169
+ for (const diagnostic of input.diagnostics) {
170
+ if (diagnostic.operationId !== undefined ||
171
+ (diagnostic.severity !== 'error' && diagnostic.severity !== 'blocker')) {
172
+ attributed.push(diagnostic);
173
+ continue;
174
+ }
175
+ const fingerprint = diagnosticFingerprint(diagnostic);
176
+ if (baselineErrors.has(fingerprint)) {
177
+ attributed.push({
178
+ ...diagnostic,
179
+ details: { ...diagnostic.details, attributionStatus: 'pre-existing-baseline' },
180
+ });
181
+ attributed.push({
182
+ code: 'MAP_VALIDATION_OPERATION_UNOWNED',
183
+ severity: 'blocker',
184
+ category: 'transaction',
185
+ message: `${diagnostic.code} already existed before the manifest and has no originating operation`,
186
+ ...(diagnostic.location === undefined ? {} : { location: diagnostic.location }),
187
+ ...(diagnostic.related === undefined ? {} : { related: diagnostic.related }),
188
+ details: {
189
+ sourceDiagnosticCode: diagnostic.code,
190
+ sourceDiagnosticFingerprint: fingerprint,
191
+ attributionStatus: 'pre-existing-baseline',
192
+ },
193
+ });
194
+ continue;
195
+ }
196
+ const pathCandidates = new Set();
197
+ for (const diagnosticPath of diagnosticPaths(diagnostic)) {
198
+ for (const owner of ownersByPath.get(diagnosticPath) ?? [])
199
+ pathCandidates.add(owner);
200
+ }
201
+ const allowedKinds = operationKindsForDiagnostic(diagnostic.code);
202
+ const familyCandidates = new Set([...changedOperationIds].filter((operationId) => {
203
+ const kind = operationKinds.get(operationId);
204
+ return kind !== undefined && allowedKinds?.has(kind) === true;
205
+ }));
206
+ let candidates = pathCandidates;
207
+ if (pathCandidates.size > 0 && familyCandidates.size > 0) {
208
+ const intersection = new Set([...pathCandidates].filter((operationId) => familyCandidates.has(operationId)));
209
+ if (intersection.size > 0)
210
+ candidates = intersection;
211
+ }
212
+ else if (pathCandidates.size === 0 && familyCandidates.size > 0) {
213
+ candidates = familyCandidates;
214
+ }
215
+ else if (pathCandidates.size === 0 && changedOperationIds.size === 1) {
216
+ candidates = new Set(changedOperationIds);
217
+ }
218
+ const orderedCandidates = [...candidates].sort((left, right) => (order.get(left) ?? -1) - (order.get(right) ?? -1) || compareCodeUnits(left, right));
219
+ const owner = orderedCandidates.at(-1);
220
+ if (owner !== undefined) {
221
+ attributed.push({
222
+ ...diagnostic,
223
+ operationId: owner,
224
+ details: {
225
+ ...diagnostic.details,
226
+ attributionStrategy: pathCandidates.size > 0
227
+ ? 'last-operation-owning-diagnostic-source'
228
+ : 'last-compatible-map-operation',
229
+ attributionCandidateOperationIds: orderedCandidates,
230
+ },
231
+ });
232
+ continue;
233
+ }
234
+ attributed.push({
235
+ ...diagnostic,
236
+ details: { ...diagnostic.details, attributionStatus: 'no-owning-operation' },
237
+ });
238
+ attributed.push({
239
+ code: 'MAP_VALIDATION_OPERATION_UNOWNED',
240
+ severity: 'blocker',
241
+ category: 'transaction',
242
+ message: `${diagnostic.code} cannot be attributed to any manifest operation`,
243
+ ...(diagnostic.location === undefined ? {} : { location: diagnostic.location }),
244
+ ...(diagnostic.related === undefined ? {} : { related: diagnostic.related }),
245
+ details: {
246
+ sourceDiagnosticCode: diagnostic.code,
247
+ sourceDiagnosticFingerprint: fingerprint,
248
+ attributionStatus: 'no-owning-operation',
249
+ },
250
+ });
251
+ }
252
+ return sortDiagnostics(attributed);
253
+ }
254
+ function normalizeSourceRoot(value) {
255
+ return value.replaceAll('\\', '/').replace(/^\.\//u, '').replace(/\/$/u, '');
256
+ }
257
+ function defaultMapPatterns(roots) {
258
+ return roots.map.map((root) => `${normalizeSourceRoot(root)}/default.map`);
259
+ }
260
+ function sourceTextPatterns(roots) {
261
+ return [
262
+ ...roots.map.flatMap((root) => {
263
+ const normalized = normalizeSourceRoot(root);
264
+ return ['map', 'csv', 'txt'].map((extension) => `${normalized}/**/*.${extension}`);
265
+ }),
266
+ ...roots.states.map((root) => `${normalizeSourceRoot(root)}/**/*.txt`),
267
+ ...roots.localisation.flatMap((root) => {
268
+ const normalized = normalizeSourceRoot(root);
269
+ return [`${normalized}/english/**/*.{yml,yaml}`, `${normalized}/*.{yml,yaml}`];
270
+ }),
271
+ '**/*.asset',
272
+ ];
273
+ }
274
+ function provinceBitmapPatterns(defaultMaps, mapRoots) {
275
+ const activeByPath = new Map(defaultMaps
276
+ .filter(({ shadowedBy }) => shadowedBy === undefined)
277
+ .map((file) => [file.relativePath.replaceAll('\\', '/').toLowerCase(), file]));
278
+ let activeName = 'provinces.bmp';
279
+ for (const root of mapRoots) {
280
+ const relativePath = `${normalizeSourceRoot(root)}/default.map`.toLowerCase();
281
+ const active = activeByPath.get(relativePath);
282
+ if (active === undefined)
283
+ continue;
284
+ activeName = defaultMapSelectorValue(active, 'provinces', activeName);
285
+ break;
286
+ }
287
+ const names = new Set([activeName]);
288
+ for (const file of defaultMaps) {
289
+ names.add(defaultMapSelectorValue(file, 'provinces', activeName));
290
+ }
291
+ const patterns = new Set();
292
+ for (const root of mapRoots) {
293
+ const normalizedRoot = normalizeSourceRoot(root);
294
+ for (const name of names) {
295
+ const candidate = name.replaceAll('\\', '/');
296
+ if (candidate.trim() === '' ||
297
+ candidate.includes('\0') ||
298
+ candidate.includes(':') ||
299
+ path.posix.isAbsolute(candidate) ||
300
+ path.win32.isAbsolute(name) ||
301
+ candidate.split('/').includes('..'))
302
+ continue;
303
+ const normalizedName = path.posix.normalize(candidate).replace(/^\.\//u, '');
304
+ if (normalizedName === '.' || normalizedName === '')
305
+ continue;
306
+ const selectedPath = path.posix.normalize(path.posix.join(normalizedRoot, normalizedName));
307
+ if (selectedPath !== normalizedRoot && !selectedPath.startsWith(`${normalizedRoot}/`))
308
+ continue;
309
+ patterns.add(fg.posix.escapePath(selectedPath));
310
+ }
311
+ }
312
+ return [...patterns].sort((left, right) => compareCodeUnits(left, right));
313
+ }
314
+ function sourceHashes(snapshot) {
315
+ return Object.fromEntries(snapshot.files.map(({ displayPath, sha256 }) => [displayPath, sha256]));
316
+ }
317
+ function mapBundleWithSourceHashes(bundle, completeSourceHashes) {
318
+ const parsed = JSON.parse(bundle.json);
319
+ const json = `${canonicalJson({ ...parsed, sourceHashes: completeSourceHashes })}\n`;
320
+ return {
321
+ ...bundle,
322
+ json,
323
+ hashes: { ...bundle.hashes, json: sha256Bytes(json) },
324
+ };
325
+ }
326
+ function validationWithPlan(validation, plan) {
327
+ const diagnostics = sortDiagnostics([...plan.diagnostics, ...validation.diagnostics]);
328
+ const choicesPassed = plan.blockers.length === 0;
329
+ const checks = [
330
+ {
331
+ id: 'map-operation-choices',
332
+ passed: choicesPassed,
333
+ message: 'Every declarative map operation has complete, resolvable policies',
334
+ },
335
+ ...validation.checks,
336
+ ];
337
+ return {
338
+ passed: choicesPassed &&
339
+ validation.passed &&
340
+ !diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker'),
341
+ diagnostics,
342
+ checks,
343
+ };
344
+ }
345
+ export class AgentNudger {
346
+ engine;
347
+ resolver;
348
+ scanner;
349
+ transactions;
350
+ artifacts;
351
+ constructor(engineOrResolver, transactions, artifacts = new ArtifactStore(), scanner = new WorkspaceScanner()) {
352
+ this.engine =
353
+ engineOrResolver instanceof CoreEngine
354
+ ? engineOrResolver
355
+ : new CoreEngine(engineOrResolver, {
356
+ scanner,
357
+ artifacts,
358
+ ...(transactions === undefined ? {} : { transactions }),
359
+ });
360
+ this.resolver = this.engine.resolver;
361
+ this.artifacts = this.engine.artifacts;
362
+ this.scanner = this.engine.scanner;
363
+ this.transactions = this.engine.transactions;
364
+ }
365
+ async scan(workspaceId, principal, signal) {
366
+ signal?.throwIfAborted();
367
+ const workspace = this.resolver.get(workspaceId, principal);
368
+ const sourceRoots = {
369
+ map: workspace.registration.roots.map,
370
+ states: workspace.registration.roots.states,
371
+ localisation: workspace.registration.roots.localisation,
372
+ };
373
+ const selectorSnapshot = await this.engine.scan(workspaceId, { patterns: defaultMapPatterns(sourceRoots) }, principal, signal);
374
+ const bitmapPatterns = provinceBitmapPatterns(selectorSnapshot.files, sourceRoots.map);
375
+ const contentSnapshot = await this.engine.scan(workspaceId, { patterns: [...sourceTextPatterns(sourceRoots), ...bitmapPatterns] }, principal, signal);
376
+ signal?.throwIfAborted();
377
+ const files = contentSnapshot.files;
378
+ const revision = hashCanonical(files.map(({ displayPath, loadOrder, sha256 }) => ({ displayPath, loadOrder, sha256 })));
379
+ return {
380
+ workspaceId,
381
+ revision,
382
+ files,
383
+ index: MapWorkspaceIndex.build(files, sourceRoots, contentSnapshot.index),
384
+ };
385
+ }
386
+ async validate(workspaceId, principal, signal) {
387
+ const snapshot = await this.scan(workspaceId, principal, signal);
388
+ return {
389
+ snapshot,
390
+ validation: await validateMapAsync(snapshot.index, signal === undefined ? {} : { signal }),
391
+ };
392
+ }
393
+ async plan(input) {
394
+ input.signal?.throwIfAborted();
395
+ const snapshot = await this.scan(input.workspaceId, input.principal, input.signal);
396
+ const plan = await planMapOperationsAsync(snapshot.index, input.operations, input.signal);
397
+ const baselineValidation = await validateMapAsync(snapshot.index, input.signal === undefined ? {} : { signal: input.signal });
398
+ const rawValidation = await validateMapAsync(plan.finalIndex, {
399
+ baseline: snapshot.index,
400
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
401
+ ...(plan.expectedChangedBounds === undefined
402
+ ? {}
403
+ : { expectedChangedBounds: plan.expectedChangedBounds }),
404
+ });
405
+ const attributedValidation = {
406
+ ...rawValidation,
407
+ diagnostics: attributeMapValidationDiagnostics({
408
+ diagnostics: rawValidation.diagnostics,
409
+ operations: plan.operations,
410
+ changes: plan.changes,
411
+ baselineDiagnostics: baselineValidation.diagnostics,
412
+ }),
413
+ };
414
+ const validation = validationWithPlan(attributedValidation, plan);
415
+ const transaction = await this.transactions.plan({
416
+ workspaceId: input.workspaceId,
417
+ ...(input.principal === undefined ? {} : { principal: input.principal }),
418
+ operationKind: 'agent-nudger-map-changes',
419
+ operations: plan.operations,
420
+ changes: plan.changes,
421
+ readDependencies: readDependenciesFromScannedFiles(snapshot.files),
422
+ ...(input.artifacts === undefined ? {} : { artifacts: input.artifacts }),
423
+ diagnostics: plan.diagnostics,
424
+ validate: (proposed, signal) => {
425
+ signal?.throwIfAborted();
426
+ const expected = new Map(plan.changes.map((change) => [change.relativePath, change.content]));
427
+ const exactProposedBytes = proposed.size === expected.size &&
428
+ [...proposed].every(([relativePath, content]) => {
429
+ const planned = expected.get(relativePath);
430
+ if (planned === undefined)
431
+ return false;
432
+ if (content === null || planned === null)
433
+ return content === planned;
434
+ return Buffer.from(content).equals(Buffer.from(planned));
435
+ });
436
+ const diagnostics = exactProposedBytes
437
+ ? validation.diagnostics
438
+ : [
439
+ ...validation.diagnostics,
440
+ {
441
+ code: 'MAP_TRANSACTION_BYTES_MISMATCH',
442
+ severity: 'blocker',
443
+ category: 'transaction',
444
+ message: 'Transaction dry-run bytes differ from the validated map operation plan',
445
+ },
446
+ ];
447
+ return Promise.resolve({
448
+ diagnostics,
449
+ checks: [
450
+ {
451
+ id: 'map-proposed-bytes-match',
452
+ passed: exactProposedBytes,
453
+ message: exactProposedBytes
454
+ ? 'Transaction bytes exactly match the validated in-memory map plan'
455
+ : 'Transaction bytes differ from the validated in-memory map plan',
456
+ },
457
+ ...validation.checks,
458
+ ],
459
+ });
460
+ },
461
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
462
+ });
463
+ return { transaction, plan, validation };
464
+ }
465
+ async renderAndStore(workspaceId, options = {}) {
466
+ const snapshot = await this.scan(workspaceId, options.principal, options.signal);
467
+ const rawBundle = await renderMap(snapshot.index, {
468
+ ...options,
469
+ budget: options.budget ?? new RenderBudget(),
470
+ });
471
+ const completeSourceHashes = sourceHashes(snapshot);
472
+ const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
473
+ const bundle = mapBundleWithSourceHashes(rawBundle, completeSourceHashes);
474
+ const workspace = this.resolver.get(workspaceId, options.principal);
475
+ const layer = options.layer ?? 'province';
476
+ const provenance = {
477
+ kind: 'map-render',
478
+ toolVersion: PACKAGE_VERSION,
479
+ schemaVersion: 'map-render.v1',
480
+ sourceHashes: sourceEvidence.sourceHashes,
481
+ renderProfile: {
482
+ offline: true,
483
+ layer,
484
+ overlays: [...new Set(options.overlays ?? [])].sort(),
485
+ scale: options.scale ?? 1,
486
+ },
487
+ metadata: { sourceHashInventory: sourceEvidence.inventory },
488
+ };
489
+ const writes = [
490
+ {
491
+ name: `map-${layer}.png`,
492
+ mimeType: 'image/png',
493
+ content: bundle.png,
494
+ provenance,
495
+ },
496
+ {
497
+ name: `map-${layer}.json`,
498
+ mimeType: 'application/json',
499
+ content: bundle.json,
500
+ provenance,
501
+ },
502
+ {
503
+ name: `map-${layer}.html`,
504
+ mimeType: 'text/html',
505
+ content: bundle.html,
506
+ provenance,
507
+ },
508
+ ];
509
+ const artifacts = await this.artifacts.withAtomicChunkedWrites(workspace, writes, (stored) => Promise.resolve([...stored]), options.signal);
510
+ return {
511
+ bundle,
512
+ artifacts,
513
+ revision: snapshot.revision,
514
+ filesScanned: snapshot.files.map(({ displayPath }) => displayPath),
515
+ };
516
+ }
517
+ async renderDiffAndStore(workspaceId, operations, options = {}) {
518
+ const budget = new RenderBudget();
519
+ const snapshot = await this.scan(workspaceId, options.principal, options.signal);
520
+ const plan = await planMapOperationsAsync(snapshot.index, operations, options.signal);
521
+ const baselineValidation = await validateMapAsync(snapshot.index, options.signal === undefined ? {} : { signal: options.signal });
522
+ const rawValidation = await validateMapAsync(plan.finalIndex, {
523
+ baseline: snapshot.index,
524
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
525
+ ...(plan.expectedChangedBounds === undefined
526
+ ? {}
527
+ : { expectedChangedBounds: plan.expectedChangedBounds }),
528
+ });
529
+ const validation = validationWithPlan({
530
+ ...rawValidation,
531
+ diagnostics: attributeMapValidationDiagnostics({
532
+ diagnostics: rawValidation.diagnostics,
533
+ operations: plan.operations,
534
+ changes: plan.changes,
535
+ baselineDiagnostics: baselineValidation.diagnostics,
536
+ }),
537
+ }, plan);
538
+ const review = {
539
+ operationIds: plan.operations.map(({ id }) => id),
540
+ affectedFiles: plan.changes.map(({ relativePath, operationIds, mediaType, content }) => ({
541
+ relativePath,
542
+ operationIds: [...operationIds],
543
+ ...(mediaType === undefined ? {} : { mediaType }),
544
+ deletion: content === null,
545
+ })),
546
+ unresolvedChoices: plan.blockers.map(({ code, message, operationId, details }) => ({
547
+ code,
548
+ message,
549
+ operationId,
550
+ ...(details === undefined ? {} : { details }),
551
+ })),
552
+ allocations: plan.allocations,
553
+ validation,
554
+ };
555
+ const comparisonOverlays = [
556
+ 'adjacencies',
557
+ 'building-positions',
558
+ 'coastlines',
559
+ 'ports',
560
+ 'province-buildings',
561
+ 'railways',
562
+ 'resources',
563
+ 'state-buildings',
564
+ 'supply-nodes',
565
+ 'unit-positions',
566
+ 'victory-points',
567
+ 'weather-positions',
568
+ ];
569
+ const [rawBundle, rawBeforeBundle, rawProposedBundle] = await Promise.all([
570
+ renderMapDiff(snapshot.index, plan.finalIndex, {
571
+ ...(options.scale === undefined ? {} : { scale: options.scale }),
572
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
573
+ budget,
574
+ review,
575
+ }),
576
+ renderMap(snapshot.index, {
577
+ layer: 'state',
578
+ overlays: [...comparisonOverlays],
579
+ ...(options.scale === undefined ? {} : { scale: options.scale }),
580
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
581
+ budget,
582
+ }),
583
+ renderMap(plan.finalIndex, {
584
+ layer: 'state',
585
+ overlays: [...comparisonOverlays],
586
+ ...(options.scale === undefined ? {} : { scale: options.scale }),
587
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
588
+ budget,
589
+ }),
590
+ ]);
591
+ const completeSourceHashes = sourceHashes(snapshot);
592
+ const sourceEvidence = boundedSourceHashEvidence(completeSourceHashes);
593
+ const bundle = mapBundleWithSourceHashes(rawBundle, completeSourceHashes);
594
+ const beforeBundle = mapBundleWithSourceHashes(rawBeforeBundle, completeSourceHashes);
595
+ const proposedBundle = mapBundleWithSourceHashes(rawProposedBundle, completeSourceHashes);
596
+ const workspace = this.resolver.get(workspaceId, options.principal);
597
+ const provenance = {
598
+ kind: 'map-diff-render',
599
+ toolVersion: PACKAGE_VERSION,
600
+ schemaVersion: 'map-diff.v1',
601
+ sourceHashes: sourceEvidence.sourceHashes,
602
+ renderProfile: { offline: true, scale: options.scale ?? 1 },
603
+ metadata: {
604
+ sourceHashInventory: sourceEvidence.inventory,
605
+ operationIds: operations.map(({ id }) => id).sort(),
606
+ blockers: plan.blockers.map(({ code, operationId }) => ({ code, operationId })),
607
+ binding: 'artifact links and content hashes are included in the transaction plan hash',
608
+ },
609
+ };
610
+ const comparisonProvenance = (phase) => ({
611
+ ...provenance,
612
+ kind: 'map-comparison-render',
613
+ schemaVersion: 'map-render.v1',
614
+ renderProfile: {
615
+ offline: true,
616
+ phase,
617
+ layer: 'state',
618
+ overlays: comparisonOverlays,
619
+ scale: options.scale ?? 1,
620
+ },
621
+ metadata: {
622
+ ...provenance.metadata,
623
+ phase,
624
+ proposedFiles: plan.changes.map(({ relativePath }) => relativePath).sort(),
625
+ },
626
+ });
627
+ const writes = [
628
+ {
629
+ name: 'map-diff.png',
630
+ mimeType: 'image/png',
631
+ content: bundle.png,
632
+ provenance,
633
+ },
634
+ {
635
+ name: 'map-diff.json',
636
+ mimeType: 'application/json',
637
+ content: bundle.json,
638
+ provenance,
639
+ },
640
+ {
641
+ name: 'map-diff.html',
642
+ mimeType: 'text/html',
643
+ content: bundle.html,
644
+ provenance,
645
+ },
646
+ {
647
+ name: 'map-before.png',
648
+ mimeType: 'image/png',
649
+ content: beforeBundle.png,
650
+ provenance: comparisonProvenance('before'),
651
+ },
652
+ {
653
+ name: 'map-before.json',
654
+ mimeType: 'application/json',
655
+ content: beforeBundle.json,
656
+ provenance: comparisonProvenance('before'),
657
+ },
658
+ {
659
+ name: 'map-before.html',
660
+ mimeType: 'text/html',
661
+ content: beforeBundle.html,
662
+ provenance: comparisonProvenance('before'),
663
+ },
664
+ {
665
+ name: 'map-proposed.png',
666
+ mimeType: 'image/png',
667
+ content: proposedBundle.png,
668
+ provenance: comparisonProvenance('proposed'),
669
+ },
670
+ {
671
+ name: 'map-proposed.json',
672
+ mimeType: 'application/json',
673
+ content: proposedBundle.json,
674
+ provenance: comparisonProvenance('proposed'),
675
+ },
676
+ {
677
+ name: 'map-proposed.html',
678
+ mimeType: 'text/html',
679
+ content: proposedBundle.html,
680
+ provenance: comparisonProvenance('proposed'),
681
+ },
682
+ ];
683
+ const artifacts = await this.artifacts.withAtomicChunkedWrites(workspace, writes, (stored) => Promise.resolve([...stored]), options.signal);
684
+ return {
685
+ bundle,
686
+ beforeBundle,
687
+ proposedBundle,
688
+ plan,
689
+ artifacts,
690
+ revision: snapshot.revision,
691
+ filesScanned: snapshot.files.map(({ displayPath }) => displayPath),
692
+ };
693
+ }
694
+ }
695
+ //# sourceMappingURL=service.js.map