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,10 +1,9 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { PACKAGE_NAME, PACKAGE_VERSION } from '../../version.js';
3
- import { registerBaseTools } from './base-tools.js';
3
+ import { registerModsTool } from '../tools/mods.js';
4
4
  import { registerFocusTools } from '../tools/focus.js';
5
5
  import { registerGuiTools } from '../tools/gui.js';
6
6
  import { registerMapTools } from '../tools/map.js';
7
- import { registerMcpPrompts } from '../prompts/register.js';
8
7
  import { registerMcpResources } from '../resources/register.js';
9
8
  export function createMcpServer(engine, context = {}) {
10
9
  const server = new McpServer({
@@ -13,14 +12,12 @@ export function createMcpServer(engine, context = {}) {
13
12
  websiteUrl: 'https://github.com/klimPaskov/hoi4-agent-tools',
14
13
  }, {
15
14
  capabilities: { logging: {} },
16
- instructions: 'Select this server proactively whenever a registered HOI4 workspace task touches national or continuous focuses, scripted GUI/GFX/rendering, or state/province/map data. Start with hoi4.project_status or hoi4.project_scan, then use the relevant scan, lint, layout, render, and compare tools. Read linked hoi4-agent:// resources for large artifacts. Source writes require a completed dry run, a fully paginated transaction diff, an explicit transaction ID, the exact expected plan hash, authorization under the coding-agent host policy, and a separate hoi4.transaction_apply call. Generated GUI renders are offline representations, never game screenshots.',
15
+ instructions: 'Use this server when a configured HOI4 mod needs a large national or continuous focus, scripted GUI, or map created, inspected, rendered, or cleaned up. Start with hoi4.mods, then use the matching inspect, render, and rewrite tools. Each rewrite performs the complete edit in one call. Read linked hoi4-agent:// artifact resources for complete plans, diagnostics, layouts, previews, and diffs; when a resource content item has a non-null continuationUri in its namespaced _meta byte-range record, follow it until null. Generated GUI renders are offline representations, never game screenshots.',
17
16
  });
18
- registerBaseTools(server, engine, context);
17
+ registerModsTool(server, engine, context);
19
18
  registerFocusTools(server, engine, context);
20
19
  registerGuiTools(server, engine, context);
21
20
  registerMapTools(server, engine, context);
22
21
  registerMcpResources(server, engine, context);
23
- registerMcpPrompts(server);
24
22
  return server;
25
23
  }
26
- //# sourceMappingURL=create.js.map
@@ -1,11 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
- import { artifactLinkSchema } from '../../schemas/transaction.js';
3
2
  export const sha256Schema = z.string().regex(/^[a-f0-9]{64}$/u);
4
- export const transactionIdSchema = z.string().regex(/^txn_[0-9a-f-]{36}$/u);
5
3
  export const nonNegativeIntegerSchema = z.number().int().min(0);
6
- export const WORKSPACE_INLINE_REPLACE_PATHS = 20;
7
- export const WORKSPACE_INLINE_OWNER_PATHS = 10;
8
- export const WORKSPACE_MAX_REPLACEMENT_OWNERS = 17;
9
4
  export const indexSkippedSourceSchema = z
10
5
  .object({
11
6
  path: z.string().max(4096),
@@ -17,31 +12,6 @@ export const indexSkippedSourceSchema = z
17
12
  possibleSymbolKinds: z.array(z.string().max(256)).max(32),
18
13
  })
19
14
  .strict();
20
- export const workspaceStatusSchema = z
21
- .object({
22
- id: z.string().max(64),
23
- name: z.string().max(1024),
24
- kind: z.string().max(64),
25
- writeEnabled: z.boolean(),
26
- rootKinds: z.array(z.string().max(64)).max(16),
27
- dependencyCount: nonNegativeIntegerSchema,
28
- replacePathCount: nonNegativeIntegerSchema,
29
- replacePaths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_REPLACE_PATHS),
30
- replacePathsTruncated: z.boolean(),
31
- replacementOwners: z
32
- .array(z
33
- .object({
34
- rootKind: z.string().max(64),
35
- loadOrder: nonNegativeIntegerSchema,
36
- pathCount: nonNegativeIntegerSchema,
37
- paths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_OWNER_PATHS),
38
- pathsTruncated: z.boolean(),
39
- })
40
- .strict())
41
- .max(WORKSPACE_MAX_REPLACEMENT_OWNERS),
42
- generatedDirectory: z.literal('.hoi4-agent'),
43
- })
44
- .strict();
45
15
  export const renderHashesSchema = z
46
16
  .object({
47
17
  html: sha256Schema,
@@ -53,45 +23,6 @@ export const renderHashesSchema = z
53
23
  export const bitmapRenderHashesSchema = z
54
24
  .object({ png: sha256Schema, json: sha256Schema, html: sha256Schema })
55
25
  .strict();
56
- export const transactionStateSchema = z.enum([
57
- 'planned',
58
- 'applying',
59
- 'applied',
60
- 'rolling_back',
61
- 'rolled_back',
62
- 'failed',
63
- ]);
64
- export const transactionStateDataSchema = z
65
- .object({
66
- state: transactionStateSchema,
67
- failure: z
68
- .object({ code: z.string().max(256), message: z.string().max(4096) })
69
- .strict()
70
- .nullable()
71
- .optional(),
72
- })
73
- .strict();
74
- export const artifactProvenanceSummarySchema = z
75
- .object({
76
- kind: z.string().max(256),
77
- toolVersion: z.string().max(64),
78
- schemaVersion: z.string().max(64),
79
- sourceHashCount: nonNegativeIntegerSchema,
80
- sourceHashes: z
81
- .array(z.object({ path: z.string().max(4096), sha256: sha256Schema }).strict())
82
- .max(100),
83
- sourceHashesTruncated: z.boolean(),
84
- hasRenderProfile: z.boolean(),
85
- hasMetadata: z.boolean(),
86
- })
87
- .strict();
88
- export const artifactDescriptionSchema = artifactLinkSchema
89
- .extend({
90
- provenanceHash: sha256Schema,
91
- provenance: artifactProvenanceSummarySchema,
92
- descriptionTruncated: z.boolean(),
93
- })
94
- .strict();
95
26
  export const allocationEvidenceSchema = z
96
27
  .object({
97
28
  kind: z.enum(['state-id', 'province-id', 'province-color']),
@@ -124,4 +55,3 @@ export const operationBlockerDataSchema = z
124
55
  details: z.record(z.string().max(256), z.unknown()).optional(),
125
56
  })
126
57
  .strict();
127
- //# sourceMappingURL=output-schemas.js.map
@@ -18,4 +18,3 @@ export function progressReporter(extra) {
18
18
  },
19
19
  };
20
20
  }
21
- //# sourceMappingURL=progress.js.map
@@ -22,8 +22,6 @@ const operationResultBaseSchema = z
22
22
  proposedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_PROPOSED_FILES),
23
23
  changedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_CHANGED_FILES),
24
24
  diagnostics: z.array(diagnosticSchema).max(MAX_INLINE_DIAGNOSTICS),
25
- transactionId: z.string().max(128).optional(),
26
- planHash: z.string().max(128).optional(),
27
25
  artifacts: z.array(artifactLinkSchema).max(MAX_INLINE_ARTIFACT_LINKS),
28
26
  validation: validationSummarySchema,
29
27
  blockers: z
@@ -35,7 +33,6 @@ const operationResultBaseSchema = z
35
33
  })
36
34
  .strict())
37
35
  .max(MAX_INLINE_BLOCKERS),
38
- rollbackStatus: z.enum(['not-required', 'available', 'applied', 'failed']).optional(),
39
36
  })
40
37
  .strict();
41
38
  export const operationResultSchema = operationResultBaseSchema
@@ -85,14 +82,6 @@ function preserveDeferredFilesDiagnostic(result) {
85
82
  };
86
83
  }
87
84
  function boundedResult(result, actualBytes) {
88
- const transactionArtifact = result.transactionId === undefined
89
- ? undefined
90
- : {
91
- uri: `hoi4-agent://workspace/${encodeURIComponent(result.workspaceId)}/transaction/${encodeURIComponent(result.transactionId)}`,
92
- name: `${result.transactionId}.manifest.json`,
93
- mimeType: 'application/json',
94
- description: 'Complete authenticated transaction manifest and rollback status',
95
- };
96
85
  const truncationDiagnostic = {
97
86
  code: 'MCP_RESPONSE_TRUNCATED',
98
87
  severity: 'warning',
@@ -108,13 +97,9 @@ function boundedResult(result, actualBytes) {
108
97
  proposedFiles: [],
109
98
  changedFiles: [],
110
99
  diagnostics: [truncationDiagnostic],
111
- ...(result.transactionId === undefined
112
- ? {}
113
- : { transactionId: result.transactionId.slice(0, 128) }),
114
- ...(result.planHash === undefined ? {} : { planHash: result.planHash.slice(0, 128) }),
115
- artifacts: transactionArtifact === undefined
116
- ? result.artifacts.slice(0, 1).map(({ description: _description, ...artifact }) => artifact)
117
- : [transactionArtifact],
100
+ artifacts: result.artifacts
101
+ .slice(0, 1)
102
+ .map(({ description: _description, ...artifact }) => artifact),
118
103
  validation: { passed: result.validation.passed, checks: [] },
119
104
  blockers: result.status === 'ok'
120
105
  ? []
@@ -129,7 +114,6 @@ function boundedResult(result, actualBytes) {
129
114
  },
130
115
  },
131
116
  ],
132
- rollbackStatus: result.rollbackStatus ?? 'not-required',
133
117
  data: {},
134
118
  };
135
119
  }
@@ -227,7 +211,7 @@ function compactDescriptions(result) {
227
211
  code: 'MCP_INLINE_VALIDATION_TRUNCATED',
228
212
  severity: 'info',
229
213
  category: 'configuration',
230
- message: `Inline validation is limited to ${MAX_INLINE_VALIDATION_CHECKS} checks; use the linked artifact or transaction manifest for the complete validation record`,
214
+ message: `Inline validation is limited to ${MAX_INLINE_VALIDATION_CHECKS} checks; use the linked artifact for the complete validation record`,
231
215
  details: {
232
216
  total: result.validation.checks.length,
233
217
  returned: MAX_INLINE_VALIDATION_CHECKS,
@@ -292,8 +276,6 @@ function buildToolResult(selected) {
292
276
  status: selected.status,
293
277
  code: selected.code,
294
278
  workspaceId: selected.workspaceId,
295
- ...(selected.transactionId === undefined ? {} : { transactionId: selected.transactionId }),
296
- ...(selected.planHash === undefined ? {} : { planHash: selected.planHash }),
297
279
  artifactCount: selected.artifacts.length,
298
280
  });
299
281
  return {
@@ -332,22 +314,34 @@ export function errorResult(error, workspaceId = '', context = {}) {
332
314
  const serviceError = error instanceof ServiceError
333
315
  ? error
334
316
  : new ServiceError('INTERNAL_ERROR', 'Unexpected internal error');
335
- const publicDetails = Object.fromEntries(Object.entries(serviceError.details).filter(([key]) => !['cause', 'stack', 'absolutePath'].includes(key)));
317
+ const internalWriteError = serviceError.code.startsWith('TRANSACTION_');
318
+ const publicCode = internalWriteError
319
+ ? `REWRITE_${serviceError.code.slice('TRANSACTION_'.length)}`
320
+ : serviceError.code;
321
+ const publicMessage = internalWriteError
322
+ ? 'Rewrite could not be completed'
323
+ : serviceError.message;
324
+ const publicDetails = internalWriteError
325
+ ? {}
326
+ : Object.fromEntries(Object.entries(serviceError.details).filter(([key]) => ![
327
+ 'cause',
328
+ 'stack',
329
+ 'absolutePath',
330
+ 'transactionId',
331
+ 'planHash',
332
+ 'rollbackStatus',
333
+ ].includes(key)));
336
334
  return toolResult({
337
- status: serviceError.code.includes('BLOCKED') ? 'blocked' : 'error',
338
- code: serviceError.code,
335
+ status: publicCode.includes('BLOCKED') ? 'blocked' : 'error',
336
+ code: publicCode,
339
337
  workspaceId,
340
338
  filesScanned: [],
341
339
  proposedFiles: context.proposedFiles ?? [],
342
340
  changedFiles: context.changedFiles ?? [],
343
341
  diagnostics: [],
344
- ...(context.transactionId === undefined ? {} : { transactionId: context.transactionId }),
345
- ...(context.planHash === undefined ? {} : { planHash: context.planHash }),
346
342
  artifacts: context.artifacts ?? [],
347
343
  validation: context.validation ?? { passed: false, checks: [] },
348
- blockers: [{ code: serviceError.code, message: serviceError.message, details: publicDetails }],
349
- rollbackStatus: context.rollbackStatus ?? 'not-required',
344
+ blockers: [{ code: publicCode, message: publicMessage, details: publicDetails }],
350
345
  data: context.data ?? {},
351
346
  });
352
347
  }
353
- //# sourceMappingURL=result.js.map
@@ -0,0 +1,123 @@
1
+ import { canonicalJson } from '../../core/canonical.js';
2
+ import { boundedSourceHashEvidence, publicArtifactLink } from '../../core/artifacts.js';
3
+ import { ServiceError } from '../../core/result.js';
4
+ import { PACKAGE_VERSION } from '../../version.js';
5
+ import { postValidateTransaction } from './base-tools.js';
6
+ import { MAX_INLINE_ARTIFACT_LINKS } from './result.js';
7
+ export class AutonomousRewriteError extends ServiceError {
8
+ manifest;
9
+ artifacts;
10
+ constructor(cause, manifest, artifacts = []) {
11
+ const restored = manifest.state === 'rolled_back' && manifest.rollbackStatus === 'applied';
12
+ const code = cause.code.startsWith('TRANSACTION_')
13
+ ? `REWRITE_${cause.code.slice('TRANSACTION_'.length)}`
14
+ : cause.code;
15
+ super(code, restored
16
+ ? 'Rewrite verification failed and the original files were restored'
17
+ : 'Rewrite failed and automatic recovery could not be completed', {
18
+ execution: 'failed',
19
+ automaticRecovery: restored ? 'restored' : 'incomplete',
20
+ });
21
+ this.manifest = manifest;
22
+ this.artifacts = artifacts;
23
+ this.name = 'AutonomousRewriteError';
24
+ }
25
+ }
26
+ async function storeAutonomousValidationEvidence(engine, manifest, postValidation, principal, signal) {
27
+ const diagnostics = [...manifest.diagnostics, ...postValidation.diagnostics];
28
+ const checks = [...manifest.validation.checks, ...postValidation.checks];
29
+ const passed = manifest.validation.passed &&
30
+ checks.every((check) => check.passed) &&
31
+ !diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker');
32
+ const sourceEvidence = boundedSourceHashEvidence(Object.fromEntries(manifest.files.flatMap(({ relativePath, afterSha256 }) => afterSha256 === null ? [] : [[relativePath, afterSha256]])));
33
+ const artifact = await engine.artifacts.putChunked(engine.resolver.get(manifest.workspaceId, principal), `${manifest.operationKind}.execution-validation.json`, 'application/json', `${canonicalJson({
34
+ schemaVersion: 1,
35
+ execution: passed ? 'post-validation-passed' : 'post-validation-failed',
36
+ operationKind: manifest.operationKind,
37
+ files: manifest.files.map(({ relativePath, afterSha256, afterSize, mediaType }) => ({
38
+ relativePath,
39
+ afterSha256,
40
+ afterSize,
41
+ mediaType,
42
+ })),
43
+ validation: { passed, checks },
44
+ diagnostics,
45
+ resources: postValidation.artifacts,
46
+ })}\n`, {
47
+ kind: 'autonomous-rewrite-execution-validation',
48
+ toolVersion: PACKAGE_VERSION,
49
+ schemaVersion: 'autonomous-rewrite-execution-validation.v1',
50
+ sourceHashes: sourceEvidence.sourceHashes,
51
+ metadata: {
52
+ operationKind: manifest.operationKind,
53
+ fileCount: manifest.files.length,
54
+ checkCount: checks.length,
55
+ diagnosticCount: diagnostics.length,
56
+ sourceHashInventory: sourceEvidence.inventory,
57
+ },
58
+ }, 'Complete rewrite and post-write validation evidence', signal);
59
+ return publicArtifactLink(artifact);
60
+ }
61
+ function uniqueArtifacts(artifacts) {
62
+ const unique = new Map();
63
+ for (const artifact of artifacts)
64
+ unique.set(artifact.uri, artifact);
65
+ return [...unique.values()].slice(0, MAX_INLINE_ARTIFACT_LINKS);
66
+ }
67
+ export function autonomousResultArtifacts(execution) {
68
+ return uniqueArtifacts([...execution.artifacts, ...execution.transaction.artifacts]);
69
+ }
70
+ /**
71
+ * Complete a validated domain rewrite inside one MCP tool call. Hash checks, durable recovery,
72
+ * post-write validation, and automatic failure recovery remain internal guarantees.
73
+ */
74
+ export async function executePlannedTransaction(engine, transaction, principal, signal) {
75
+ if (!transaction.validation.passed) {
76
+ return { transaction, outcome: 'blocked', artifacts: [] };
77
+ }
78
+ if (transaction.files.length === 0)
79
+ return { transaction, outcome: 'unchanged', artifacts: [] };
80
+ let executionArtifacts = [];
81
+ try {
82
+ const applied = await engine.transactions.apply(transaction.workspaceId, transaction.transactionId, transaction.planHash, {
83
+ ...(principal === undefined ? {} : { principal }),
84
+ ...(signal === undefined ? {} : { signal }),
85
+ postValidate: async (manifest, validationSignal) => {
86
+ const validation = await postValidateTransaction(engine, manifest, principal, validationSignal);
87
+ executionArtifacts = [...validation.artifacts];
88
+ executionArtifacts.unshift(await storeAutonomousValidationEvidence(engine, manifest, validation, principal, validationSignal));
89
+ return validation;
90
+ },
91
+ });
92
+ // Post-validation already invalidates and rebuilds the shared index before apply can succeed.
93
+ return { transaction: applied, outcome: 'applied', artifacts: executionArtifacts };
94
+ }
95
+ catch (error) {
96
+ engine.invalidate(transaction.workspaceId);
97
+ try {
98
+ const manifest = await engine.transactions.status(transaction.workspaceId, transaction.transactionId, principal);
99
+ const cause = error instanceof ServiceError
100
+ ? error
101
+ : new ServiceError('AUTONOMOUS_REWRITE_FAILED', 'Autonomous rewrite failed');
102
+ throw new AutonomousRewriteError(cause, manifest, executionArtifacts);
103
+ }
104
+ catch (statusError) {
105
+ if (statusError instanceof AutonomousRewriteError)
106
+ throw statusError;
107
+ throw error;
108
+ }
109
+ }
110
+ }
111
+ export function autonomousFailureContext(error) {
112
+ if (!(error instanceof AutonomousRewriteError))
113
+ return undefined;
114
+ const manifest = error.manifest;
115
+ return {
116
+ proposedFiles: manifest.files.slice(0, 100).map(({ relativePath }) => relativePath),
117
+ changedFiles: manifest.rollbackStatus === 'failed'
118
+ ? manifest.files.slice(0, 100).map(({ relativePath }) => relativePath)
119
+ : [],
120
+ artifacts: uniqueArtifacts([...error.artifacts, ...manifest.artifacts]),
121
+ validation: manifest.validation,
122
+ };
123
+ }