hoi4-agent-tools 0.2.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. package/CHANGELOG.md +21 -118
  2. package/README.md +38 -124
  3. package/SECURITY.md +5 -7
  4. package/dist/bin/http.js +0 -1
  5. package/dist/bin/setup.js +141 -92
  6. package/dist/bin/stdio.js +0 -1
  7. package/dist/hoi4_agent_tools/core/artifacts.js +0 -1
  8. package/dist/hoi4_agent_tools/core/canonical.js +0 -1
  9. package/dist/hoi4_agent_tools/core/configuration.js +28 -28
  10. package/dist/hoi4_agent_tools/core/diagnostic-collector.js +0 -1
  11. package/dist/hoi4_agent_tools/core/diagnostics.js +0 -1
  12. package/dist/hoi4_agent_tools/core/diff.js +0 -1
  13. package/dist/hoi4_agent_tools/core/engine.js +6 -21
  14. package/dist/hoi4_agent_tools/core/image-diff.js +0 -1
  15. package/dist/hoi4_agent_tools/core/index.js +0 -1
  16. package/dist/hoi4_agent_tools/core/render-budget.js +0 -1
  17. package/dist/hoi4_agent_tools/core/result.js +0 -1
  18. package/dist/hoi4_agent_tools/core/scanner.js +0 -1
  19. package/dist/hoi4_agent_tools/core/server-state.js +0 -1
  20. package/dist/hoi4_agent_tools/core/source/encoding.js +0 -1
  21. package/dist/hoi4_agent_tools/core/source/index.js +0 -1
  22. package/dist/hoi4_agent_tools/core/source/lexer.js +0 -1
  23. package/dist/hoi4_agent_tools/core/source/limits.js +0 -1
  24. package/dist/hoi4_agent_tools/core/source/localisation.js +0 -1
  25. package/dist/hoi4_agent_tools/core/source/parser.js +0 -1
  26. package/dist/hoi4_agent_tools/core/source/rewrite.js +0 -1
  27. package/dist/hoi4_agent_tools/core/svg-text.js +0 -1
  28. package/dist/hoi4_agent_tools/core/transaction-limits.js +0 -1
  29. package/dist/hoi4_agent_tools/core/transactions.js +2 -30
  30. package/dist/hoi4_agent_tools/core/workspace.js +112 -396
  31. package/dist/hoi4_agent_tools/focus/compact.js +432 -0
  32. package/dist/hoi4_agent_tools/focus/compiler.js +1 -8
  33. package/dist/hoi4_agent_tools/focus/continuous-render.js +0 -1
  34. package/dist/hoi4_agent_tools/focus/drift.js +0 -1
  35. package/dist/hoi4_agent_tools/focus/geometry.js +203 -17
  36. package/dist/hoi4_agent_tools/focus/importer.js +0 -1
  37. package/dist/hoi4_agent_tools/focus/index.js +1 -1
  38. package/dist/hoi4_agent_tools/focus/layout.js +1256 -93
  39. package/dist/hoi4_agent_tools/focus/limits.js +1 -2
  40. package/dist/hoi4_agent_tools/focus/lint.js +11 -4
  41. package/dist/hoi4_agent_tools/focus/model.js +0 -1
  42. package/dist/hoi4_agent_tools/focus/native-effects.js +0 -1
  43. package/dist/hoi4_agent_tools/focus/planning.js +6 -2
  44. package/dist/hoi4_agent_tools/focus/presentation.js +0 -1
  45. package/dist/hoi4_agent_tools/focus/render.js +14 -10
  46. package/dist/hoi4_agent_tools/focus/service.js +7 -8
  47. package/dist/hoi4_agent_tools/focus/source-update.js +1 -2
  48. package/dist/hoi4_agent_tools/gui/animation-manifest.js +0 -1
  49. package/dist/hoi4_agent_tools/gui/assets.js +0 -1
  50. package/dist/hoi4_agent_tools/gui/dds.js +0 -1
  51. package/dist/hoi4_agent_tools/gui/helpers.js +1 -2
  52. package/dist/hoi4_agent_tools/gui/index.js +0 -1
  53. package/dist/hoi4_agent_tools/gui/layout.js +0 -1
  54. package/dist/hoi4_agent_tools/gui/limits.js +0 -1
  55. package/dist/hoi4_agent_tools/gui/renderer.js +0 -1
  56. package/dist/hoi4_agent_tools/gui/scenario.js +0 -1
  57. package/dist/hoi4_agent_tools/gui/source-graph.js +0 -1
  58. package/dist/hoi4_agent_tools/gui/source-patch.js +1 -2
  59. package/dist/hoi4_agent_tools/gui/studio.js +247 -104
  60. package/dist/hoi4_agent_tools/gui/tga.js +0 -1
  61. package/dist/hoi4_agent_tools/gui/types.js +0 -1
  62. package/dist/hoi4_agent_tools/gui/validators.js +0 -1
  63. package/dist/hoi4_agent_tools/map/bmp.js +0 -1
  64. package/dist/hoi4_agent_tools/map/diagnostic-limit.js +0 -1
  65. package/dist/hoi4_agent_tools/map/index.js +0 -1
  66. package/dist/hoi4_agent_tools/map/limits.js +2 -1
  67. package/dist/hoi4_agent_tools/map/model.js +0 -1
  68. package/dist/hoi4_agent_tools/map/operations.js +0 -1
  69. package/dist/hoi4_agent_tools/map/render.js +0 -1
  70. package/dist/hoi4_agent_tools/map/service.js +171 -33
  71. package/dist/hoi4_agent_tools/map/validation.js +0 -1
  72. package/dist/hoi4_agent_tools/mcp/resources/register.js +61 -187
  73. package/dist/hoi4_agent_tools/mcp/security/auth.js +1 -2
  74. package/dist/hoi4_agent_tools/mcp/server/base-tools.js +24 -750
  75. package/dist/hoi4_agent_tools/mcp/server/context-schemas.js +8 -0
  76. package/dist/hoi4_agent_tools/mcp/server/create.js +2 -12
  77. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +0 -71
  78. package/dist/hoi4_agent_tools/mcp/server/progress.js +0 -1
  79. package/dist/hoi4_agent_tools/mcp/server/result.js +146 -81
  80. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js +10 -14
  81. package/dist/hoi4_agent_tools/mcp/tools/focus.js +309 -279
  82. package/dist/hoi4_agent_tools/mcp/tools/gui.js +156 -254
  83. package/dist/hoi4_agent_tools/mcp/tools/map.js +259 -338
  84. package/dist/hoi4_agent_tools/mcp/tools/mods.js +54 -0
  85. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js +0 -1
  86. package/dist/hoi4_agent_tools/mcp/transports/event-store.js +0 -1
  87. package/dist/hoi4_agent_tools/mcp/transports/http.js +1 -12
  88. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js +0 -1
  89. package/dist/hoi4_agent_tools/runtime.js +5 -2
  90. package/dist/hoi4_agent_tools/schemas/common.js +1 -2
  91. package/dist/hoi4_agent_tools/schemas/focus.js +64 -9
  92. package/dist/hoi4_agent_tools/schemas/map.js +0 -1
  93. package/dist/hoi4_agent_tools/schemas/transaction.js +0 -1
  94. package/dist/hoi4_agent_tools/version.js +1 -2
  95. package/docs/README.md +8 -21
  96. package/docs/development.md +22 -0
  97. package/docs/focus.md +50 -0
  98. package/docs/gui.md +37 -0
  99. package/docs/http.md +53 -0
  100. package/docs/map.md +39 -0
  101. package/docs/setup.md +39 -0
  102. package/package.json +12 -13
  103. package/server.json +3 -12
  104. package/dist/bin/http.d.ts +0 -3
  105. package/dist/bin/http.d.ts.map +0 -1
  106. package/dist/bin/http.js.map +0 -1
  107. package/dist/bin/setup.d.ts +0 -3
  108. package/dist/bin/setup.d.ts.map +0 -1
  109. package/dist/bin/setup.js.map +0 -1
  110. package/dist/bin/stdio.d.ts +0 -3
  111. package/dist/bin/stdio.d.ts.map +0 -1
  112. package/dist/bin/stdio.js.map +0 -1
  113. package/dist/hoi4_agent_tools/core/artifacts.d.ts +0 -117
  114. package/dist/hoi4_agent_tools/core/artifacts.d.ts.map +0 -1
  115. package/dist/hoi4_agent_tools/core/artifacts.js.map +0 -1
  116. package/dist/hoi4_agent_tools/core/canonical.d.ts +0 -13
  117. package/dist/hoi4_agent_tools/core/canonical.d.ts.map +0 -1
  118. package/dist/hoi4_agent_tools/core/canonical.js.map +0 -1
  119. package/dist/hoi4_agent_tools/core/configuration.d.ts +0 -138
  120. package/dist/hoi4_agent_tools/core/configuration.d.ts.map +0 -1
  121. package/dist/hoi4_agent_tools/core/configuration.js.map +0 -1
  122. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts +0 -18
  123. package/dist/hoi4_agent_tools/core/diagnostic-collector.d.ts.map +0 -1
  124. package/dist/hoi4_agent_tools/core/diagnostic-collector.js.map +0 -1
  125. package/dist/hoi4_agent_tools/core/diagnostics.d.ts +0 -26
  126. package/dist/hoi4_agent_tools/core/diagnostics.d.ts.map +0 -1
  127. package/dist/hoi4_agent_tools/core/diagnostics.js.map +0 -1
  128. package/dist/hoi4_agent_tools/core/diff.d.ts +0 -22
  129. package/dist/hoi4_agent_tools/core/diff.d.ts.map +0 -1
  130. package/dist/hoi4_agent_tools/core/diff.js.map +0 -1
  131. package/dist/hoi4_agent_tools/core/engine.d.ts +0 -57
  132. package/dist/hoi4_agent_tools/core/engine.d.ts.map +0 -1
  133. package/dist/hoi4_agent_tools/core/engine.js.map +0 -1
  134. package/dist/hoi4_agent_tools/core/image-diff.d.ts +0 -14
  135. package/dist/hoi4_agent_tools/core/image-diff.d.ts.map +0 -1
  136. package/dist/hoi4_agent_tools/core/image-diff.js.map +0 -1
  137. package/dist/hoi4_agent_tools/core/index.d.ts +0 -64
  138. package/dist/hoi4_agent_tools/core/index.d.ts.map +0 -1
  139. package/dist/hoi4_agent_tools/core/index.js.map +0 -1
  140. package/dist/hoi4_agent_tools/core/index.public.d.ts +0 -16
  141. package/dist/hoi4_agent_tools/core/index.public.d.ts.map +0 -1
  142. package/dist/hoi4_agent_tools/core/index.public.js +0 -16
  143. package/dist/hoi4_agent_tools/core/index.public.js.map +0 -1
  144. package/dist/hoi4_agent_tools/core/render-budget.d.ts +0 -51
  145. package/dist/hoi4_agent_tools/core/render-budget.d.ts.map +0 -1
  146. package/dist/hoi4_agent_tools/core/render-budget.js.map +0 -1
  147. package/dist/hoi4_agent_tools/core/result.d.ts +0 -45
  148. package/dist/hoi4_agent_tools/core/result.d.ts.map +0 -1
  149. package/dist/hoi4_agent_tools/core/result.js.map +0 -1
  150. package/dist/hoi4_agent_tools/core/scanner.d.ts +0 -28
  151. package/dist/hoi4_agent_tools/core/scanner.d.ts.map +0 -1
  152. package/dist/hoi4_agent_tools/core/scanner.js.map +0 -1
  153. package/dist/hoi4_agent_tools/core/server-state.d.ts +0 -31
  154. package/dist/hoi4_agent_tools/core/server-state.d.ts.map +0 -1
  155. package/dist/hoi4_agent_tools/core/server-state.js.map +0 -1
  156. package/dist/hoi4_agent_tools/core/source/encoding.d.ts +0 -10
  157. package/dist/hoi4_agent_tools/core/source/encoding.d.ts.map +0 -1
  158. package/dist/hoi4_agent_tools/core/source/encoding.js.map +0 -1
  159. package/dist/hoi4_agent_tools/core/source/index.d.ts +0 -7
  160. package/dist/hoi4_agent_tools/core/source/index.d.ts.map +0 -1
  161. package/dist/hoi4_agent_tools/core/source/index.js.map +0 -1
  162. package/dist/hoi4_agent_tools/core/source/lexer.d.ts +0 -30
  163. package/dist/hoi4_agent_tools/core/source/lexer.d.ts.map +0 -1
  164. package/dist/hoi4_agent_tools/core/source/lexer.js.map +0 -1
  165. package/dist/hoi4_agent_tools/core/source/limits.d.ts +0 -21
  166. package/dist/hoi4_agent_tools/core/source/limits.d.ts.map +0 -1
  167. package/dist/hoi4_agent_tools/core/source/limits.js.map +0 -1
  168. package/dist/hoi4_agent_tools/core/source/localisation.d.ts +0 -20
  169. package/dist/hoi4_agent_tools/core/source/localisation.d.ts.map +0 -1
  170. package/dist/hoi4_agent_tools/core/source/localisation.js.map +0 -1
  171. package/dist/hoi4_agent_tools/core/source/parser.d.ts +0 -44
  172. package/dist/hoi4_agent_tools/core/source/parser.d.ts.map +0 -1
  173. package/dist/hoi4_agent_tools/core/source/parser.js.map +0 -1
  174. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts +0 -10
  175. package/dist/hoi4_agent_tools/core/source/rewrite.d.ts.map +0 -1
  176. package/dist/hoi4_agent_tools/core/source/rewrite.js.map +0 -1
  177. package/dist/hoi4_agent_tools/core/svg-text.d.ts +0 -34
  178. package/dist/hoi4_agent_tools/core/svg-text.d.ts.map +0 -1
  179. package/dist/hoi4_agent_tools/core/svg-text.js.map +0 -1
  180. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts +0 -9
  181. package/dist/hoi4_agent_tools/core/transaction-limits.d.ts.map +0 -1
  182. package/dist/hoi4_agent_tools/core/transaction-limits.js.map +0 -1
  183. package/dist/hoi4_agent_tools/core/transactions.d.ts +0 -164
  184. package/dist/hoi4_agent_tools/core/transactions.d.ts.map +0 -1
  185. package/dist/hoi4_agent_tools/core/transactions.js.map +0 -1
  186. package/dist/hoi4_agent_tools/core/workspace.d.ts +0 -68
  187. package/dist/hoi4_agent_tools/core/workspace.d.ts.map +0 -1
  188. package/dist/hoi4_agent_tools/core/workspace.js.map +0 -1
  189. package/dist/hoi4_agent_tools/focus/compiler.d.ts +0 -10
  190. package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +0 -1
  191. package/dist/hoi4_agent_tools/focus/compiler.js.map +0 -1
  192. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts +0 -32
  193. package/dist/hoi4_agent_tools/focus/continuous-render.d.ts.map +0 -1
  194. package/dist/hoi4_agent_tools/focus/continuous-render.js.map +0 -1
  195. package/dist/hoi4_agent_tools/focus/drift.d.ts +0 -22
  196. package/dist/hoi4_agent_tools/focus/drift.d.ts.map +0 -1
  197. package/dist/hoi4_agent_tools/focus/drift.js.map +0 -1
  198. package/dist/hoi4_agent_tools/focus/geometry.d.ts +0 -17
  199. package/dist/hoi4_agent_tools/focus/geometry.d.ts.map +0 -1
  200. package/dist/hoi4_agent_tools/focus/geometry.js.map +0 -1
  201. package/dist/hoi4_agent_tools/focus/importer.d.ts +0 -9
  202. package/dist/hoi4_agent_tools/focus/importer.d.ts.map +0 -1
  203. package/dist/hoi4_agent_tools/focus/importer.js.map +0 -1
  204. package/dist/hoi4_agent_tools/focus/index.d.ts +0 -14
  205. package/dist/hoi4_agent_tools/focus/index.d.ts.map +0 -1
  206. package/dist/hoi4_agent_tools/focus/index.js.map +0 -1
  207. package/dist/hoi4_agent_tools/focus/layout.d.ts +0 -5
  208. package/dist/hoi4_agent_tools/focus/layout.d.ts.map +0 -1
  209. package/dist/hoi4_agent_tools/focus/layout.js.map +0 -1
  210. package/dist/hoi4_agent_tools/focus/limits.d.ts +0 -9
  211. package/dist/hoi4_agent_tools/focus/limits.d.ts.map +0 -1
  212. package/dist/hoi4_agent_tools/focus/limits.js.map +0 -1
  213. package/dist/hoi4_agent_tools/focus/lint.d.ts +0 -14
  214. package/dist/hoi4_agent_tools/focus/lint.d.ts.map +0 -1
  215. package/dist/hoi4_agent_tools/focus/lint.js.map +0 -1
  216. package/dist/hoi4_agent_tools/focus/model.d.ts +0 -307
  217. package/dist/hoi4_agent_tools/focus/model.d.ts.map +0 -1
  218. package/dist/hoi4_agent_tools/focus/model.js.map +0 -1
  219. package/dist/hoi4_agent_tools/focus/native-effects.d.ts +0 -9
  220. package/dist/hoi4_agent_tools/focus/native-effects.d.ts.map +0 -1
  221. package/dist/hoi4_agent_tools/focus/native-effects.js.map +0 -1
  222. package/dist/hoi4_agent_tools/focus/planning.d.ts +0 -15
  223. package/dist/hoi4_agent_tools/focus/planning.d.ts.map +0 -1
  224. package/dist/hoi4_agent_tools/focus/planning.js.map +0 -1
  225. package/dist/hoi4_agent_tools/focus/presentation.d.ts +0 -24
  226. package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +0 -1
  227. package/dist/hoi4_agent_tools/focus/presentation.js.map +0 -1
  228. package/dist/hoi4_agent_tools/focus/render.d.ts +0 -39
  229. package/dist/hoi4_agent_tools/focus/render.d.ts.map +0 -1
  230. package/dist/hoi4_agent_tools/focus/render.js.map +0 -1
  231. package/dist/hoi4_agent_tools/focus/service.d.ts +0 -82
  232. package/dist/hoi4_agent_tools/focus/service.d.ts.map +0 -1
  233. package/dist/hoi4_agent_tools/focus/service.js.map +0 -1
  234. package/dist/hoi4_agent_tools/focus/source-update.d.ts +0 -6
  235. package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +0 -1
  236. package/dist/hoi4_agent_tools/focus/source-update.js.map +0 -1
  237. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts +0 -37
  238. package/dist/hoi4_agent_tools/gui/animation-manifest.d.ts.map +0 -1
  239. package/dist/hoi4_agent_tools/gui/animation-manifest.js.map +0 -1
  240. package/dist/hoi4_agent_tools/gui/assets.d.ts +0 -71
  241. package/dist/hoi4_agent_tools/gui/assets.d.ts.map +0 -1
  242. package/dist/hoi4_agent_tools/gui/assets.js.map +0 -1
  243. package/dist/hoi4_agent_tools/gui/dds.d.ts +0 -17
  244. package/dist/hoi4_agent_tools/gui/dds.d.ts.map +0 -1
  245. package/dist/hoi4_agent_tools/gui/dds.js.map +0 -1
  246. package/dist/hoi4_agent_tools/gui/helpers.d.ts +0 -101
  247. package/dist/hoi4_agent_tools/gui/helpers.d.ts.map +0 -1
  248. package/dist/hoi4_agent_tools/gui/helpers.js.map +0 -1
  249. package/dist/hoi4_agent_tools/gui/index.d.ts +0 -15
  250. package/dist/hoi4_agent_tools/gui/index.d.ts.map +0 -1
  251. package/dist/hoi4_agent_tools/gui/index.js.map +0 -1
  252. package/dist/hoi4_agent_tools/gui/layout.d.ts +0 -6
  253. package/dist/hoi4_agent_tools/gui/layout.d.ts.map +0 -1
  254. package/dist/hoi4_agent_tools/gui/layout.js.map +0 -1
  255. package/dist/hoi4_agent_tools/gui/limits.d.ts +0 -25
  256. package/dist/hoi4_agent_tools/gui/limits.d.ts.map +0 -1
  257. package/dist/hoi4_agent_tools/gui/limits.js.map +0 -1
  258. package/dist/hoi4_agent_tools/gui/renderer.d.ts +0 -18
  259. package/dist/hoi4_agent_tools/gui/renderer.d.ts.map +0 -1
  260. package/dist/hoi4_agent_tools/gui/renderer.js.map +0 -1
  261. package/dist/hoi4_agent_tools/gui/scenario.d.ts +0 -66
  262. package/dist/hoi4_agent_tools/gui/scenario.d.ts.map +0 -1
  263. package/dist/hoi4_agent_tools/gui/scenario.js.map +0 -1
  264. package/dist/hoi4_agent_tools/gui/source-graph.d.ts +0 -7
  265. package/dist/hoi4_agent_tools/gui/source-graph.d.ts.map +0 -1
  266. package/dist/hoi4_agent_tools/gui/source-graph.js.map +0 -1
  267. package/dist/hoi4_agent_tools/gui/source-patch.d.ts +0 -13
  268. package/dist/hoi4_agent_tools/gui/source-patch.d.ts.map +0 -1
  269. package/dist/hoi4_agent_tools/gui/source-patch.js.map +0 -1
  270. package/dist/hoi4_agent_tools/gui/studio.d.ts +0 -86
  271. package/dist/hoi4_agent_tools/gui/studio.d.ts.map +0 -1
  272. package/dist/hoi4_agent_tools/gui/studio.js.map +0 -1
  273. package/dist/hoi4_agent_tools/gui/tga.d.ts +0 -16
  274. package/dist/hoi4_agent_tools/gui/tga.d.ts.map +0 -1
  275. package/dist/hoi4_agent_tools/gui/tga.js.map +0 -1
  276. package/dist/hoi4_agent_tools/gui/types.d.ts +0 -322
  277. package/dist/hoi4_agent_tools/gui/types.d.ts.map +0 -1
  278. package/dist/hoi4_agent_tools/gui/types.js.map +0 -1
  279. package/dist/hoi4_agent_tools/gui/validators.d.ts +0 -8
  280. package/dist/hoi4_agent_tools/gui/validators.d.ts.map +0 -1
  281. package/dist/hoi4_agent_tools/gui/validators.js.map +0 -1
  282. package/dist/hoi4_agent_tools/map/bmp.d.ts +0 -62
  283. package/dist/hoi4_agent_tools/map/bmp.d.ts.map +0 -1
  284. package/dist/hoi4_agent_tools/map/bmp.js.map +0 -1
  285. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts +0 -5
  286. package/dist/hoi4_agent_tools/map/diagnostic-limit.d.ts.map +0 -1
  287. package/dist/hoi4_agent_tools/map/diagnostic-limit.js.map +0 -1
  288. package/dist/hoi4_agent_tools/map/index.d.ts +0 -8
  289. package/dist/hoi4_agent_tools/map/index.d.ts.map +0 -1
  290. package/dist/hoi4_agent_tools/map/index.js.map +0 -1
  291. package/dist/hoi4_agent_tools/map/limits.d.ts +0 -13
  292. package/dist/hoi4_agent_tools/map/limits.d.ts.map +0 -1
  293. package/dist/hoi4_agent_tools/map/limits.js.map +0 -1
  294. package/dist/hoi4_agent_tools/map/model.d.ts +0 -269
  295. package/dist/hoi4_agent_tools/map/model.d.ts.map +0 -1
  296. package/dist/hoi4_agent_tools/map/model.js.map +0 -1
  297. package/dist/hoi4_agent_tools/map/operations.d.ts +0 -401
  298. package/dist/hoi4_agent_tools/map/operations.d.ts.map +0 -1
  299. package/dist/hoi4_agent_tools/map/operations.js.map +0 -1
  300. package/dist/hoi4_agent_tools/map/render.d.ts +0 -90
  301. package/dist/hoi4_agent_tools/map/render.d.ts.map +0 -1
  302. package/dist/hoi4_agent_tools/map/render.js.map +0 -1
  303. package/dist/hoi4_agent_tools/map/service.d.ts +0 -81
  304. package/dist/hoi4_agent_tools/map/service.d.ts.map +0 -1
  305. package/dist/hoi4_agent_tools/map/service.js.map +0 -1
  306. package/dist/hoi4_agent_tools/map/validation.d.ts +0 -23
  307. package/dist/hoi4_agent_tools/map/validation.d.ts.map +0 -1
  308. package/dist/hoi4_agent_tools/map/validation.js.map +0 -1
  309. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +0 -4
  310. package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +0 -1
  311. package/dist/hoi4_agent_tools/mcp/prompts/register.js +0 -72
  312. package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +0 -1
  313. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +0 -9
  314. package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts.map +0 -1
  315. package/dist/hoi4_agent_tools/mcp/registry/metadata.js +0 -10
  316. package/dist/hoi4_agent_tools/mcp/registry/metadata.js.map +0 -1
  317. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts +0 -5
  318. package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +0 -1
  319. package/dist/hoi4_agent_tools/mcp/resources/register.js.map +0 -1
  320. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts +0 -24
  321. package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +0 -1
  322. package/dist/hoi4_agent_tools/mcp/security/auth.js.map +0 -1
  323. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +0 -47
  324. package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +0 -1
  325. package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +0 -1
  326. package/dist/hoi4_agent_tools/mcp/server/create.d.ts +0 -5
  327. package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +0 -1
  328. package/dist/hoi4_agent_tools/mcp/server/create.js.map +0 -1
  329. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +0 -138
  330. package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +0 -1
  331. package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +0 -1
  332. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts +0 -8
  333. package/dist/hoi4_agent_tools/mcp/server/progress.d.ts.map +0 -1
  334. package/dist/hoi4_agent_tools/mcp/server/progress.js.map +0 -1
  335. package/dist/hoi4_agent_tools/mcp/server/result.d.ts +0 -232
  336. package/dist/hoi4_agent_tools/mcp/server/result.d.ts.map +0 -1
  337. package/dist/hoi4_agent_tools/mcp/server/result.js.map +0 -1
  338. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts +0 -31
  339. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts.map +0 -1
  340. package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js.map +0 -1
  341. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts +0 -5
  342. package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +0 -1
  343. package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +0 -1
  344. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +0 -117
  345. package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +0 -1
  346. package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +0 -1
  347. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts +0 -5
  348. package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +0 -1
  349. package/dist/hoi4_agent_tools/mcp/tools/map.js.map +0 -1
  350. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts +0 -58
  351. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.d.ts.map +0 -1
  352. package/dist/hoi4_agent_tools/mcp/transports/bounded-stdio.js.map +0 -1
  353. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts +0 -26
  354. package/dist/hoi4_agent_tools/mcp/transports/event-store.d.ts.map +0 -1
  355. package/dist/hoi4_agent_tools/mcp/transports/event-store.js.map +0 -1
  356. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts +0 -28
  357. package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +0 -1
  358. package/dist/hoi4_agent_tools/mcp/transports/http.js.map +0 -1
  359. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts +0 -15
  360. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.d.ts.map +0 -1
  361. package/dist/hoi4_agent_tools/mcp/transports/protocol-gate.js.map +0 -1
  362. package/dist/hoi4_agent_tools/runtime.d.ts +0 -4
  363. package/dist/hoi4_agent_tools/runtime.d.ts.map +0 -1
  364. package/dist/hoi4_agent_tools/runtime.js.map +0 -1
  365. package/dist/hoi4_agent_tools/schemas/common.d.ts +0 -74
  366. package/dist/hoi4_agent_tools/schemas/common.d.ts.map +0 -1
  367. package/dist/hoi4_agent_tools/schemas/common.js.map +0 -1
  368. package/dist/hoi4_agent_tools/schemas/focus.d.ts +0 -784
  369. package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +0 -1
  370. package/dist/hoi4_agent_tools/schemas/focus.js.map +0 -1
  371. package/dist/hoi4_agent_tools/schemas/index.d.ts +0 -5
  372. package/dist/hoi4_agent_tools/schemas/index.d.ts.map +0 -1
  373. package/dist/hoi4_agent_tools/schemas/index.js +0 -5
  374. package/dist/hoi4_agent_tools/schemas/index.js.map +0 -1
  375. package/dist/hoi4_agent_tools/schemas/map.d.ts +0 -654
  376. package/dist/hoi4_agent_tools/schemas/map.d.ts.map +0 -1
  377. package/dist/hoi4_agent_tools/schemas/map.js.map +0 -1
  378. package/dist/hoi4_agent_tools/schemas/transaction.d.ts +0 -259
  379. package/dist/hoi4_agent_tools/schemas/transaction.d.ts.map +0 -1
  380. package/dist/hoi4_agent_tools/schemas/transaction.js.map +0 -1
  381. package/dist/hoi4_agent_tools/version.d.ts +0 -6
  382. package/dist/hoi4_agent_tools/version.d.ts.map +0 -1
  383. package/dist/hoi4_agent_tools/version.js.map +0 -1
  384. package/dist/index.d.ts +0 -3
  385. package/dist/index.d.ts.map +0 -1
  386. package/dist/index.js +0 -3
  387. package/dist/index.js.map +0 -1
  388. package/docs/adr/0001-runtime-and-language.md +0 -16
  389. package/docs/adr/0002-lossless-source-model.md +0 -18
  390. package/docs/adr/0003-image-and-font-codecs.md +0 -18
  391. package/docs/adr/0004-focus-layout.md +0 -16
  392. package/docs/adr/0005-offline-rendering.md +0 -18
  393. package/docs/adr/0006-mcp-sdk-and-protocol.md +0 -16
  394. package/docs/adr/0007-storage-and-transactions.md +0 -24
  395. package/docs/adr/0008-test-strategy.md +0 -18
  396. package/docs/adr/0009-packaging-and-registry.md +0 -16
  397. package/docs/adr/0010-unsupported-and-refusal-policy.md +0 -18
  398. package/docs/adr/0011-http-security.md +0 -16
  399. package/docs/adr/0012-autonomous-rewrites.md +0 -55
  400. package/docs/adr/README.md +0 -14
  401. package/docs/agent-integration.md +0 -146
  402. package/docs/architecture.md +0 -76
  403. package/docs/artifacts.md +0 -136
  404. package/docs/compatibility.md +0 -33
  405. package/docs/completion-report.md +0 -122
  406. package/docs/configuration.md +0 -305
  407. package/docs/focus-workflow.md +0 -197
  408. package/docs/gui-workflow.md +0 -125
  409. package/docs/limitations.md +0 -32
  410. package/docs/map-workflow.md +0 -95
  411. package/docs/performance.md +0 -117
  412. package/docs/release.md +0 -222
  413. package/docs/research/mcp-2026-07-10.md +0 -52
  414. package/docs/research/source-ledger.md +0 -68
  415. package/docs/security.md +0 -145
  416. package/docs/self-hosting.md +0 -170
  417. package/docs/testing.md +0 -43
  418. package/docs/third-party-notices.md +0 -11
  419. package/docs/transactions.md +0 -180
  420. package/docs/troubleshooting.md +0 -54
  421. package/schemas/configuration.schema.json +0 -795
  422. package/schemas/continuous-focus-palette.schema.json +0 -325
  423. package/schemas/focus-plan.schema.json +0 -927
  424. package/schemas/focus-planning-sidecar.schema.json +0 -379
  425. package/schemas/gui-animation-source.schema.json +0 -176
  426. package/schemas/gui-helper.schema.json +0 -301
  427. package/schemas/gui-scenario.schema.json +0 -298
  428. package/schemas/map-operation.schema.json +0 -2284
  429. package/schemas/operation-result.schema.json +0 -344
  430. package/schemas/transaction-manifest.schema.json +0 -685
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod/v4';
2
+ /**
3
+ * Keep a large nested payload schema out of tools/list while retaining its complete runtime parser.
4
+ * The MCP SDK publishes the input side of a pipe and executes both sides when a tool is called.
5
+ */
6
+ export function compactValidatedInputSchema(schema, description) {
7
+ return z.unknown().describe(description).pipe(schema);
8
+ }
@@ -1,32 +1,22 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { PACKAGE_NAME, PACKAGE_VERSION } from '../../version.js';
3
- import { 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
- const writePolicy = engine.resolver.config().writePolicy;
11
- const autonomous = writePolicy === 'autonomous';
12
9
  const server = new McpServer({
13
10
  name: PACKAGE_NAME,
14
11
  version: PACKAGE_VERSION,
15
12
  websiteUrl: 'https://github.com/klimPaskov/hoi4-agent-tools',
16
13
  }, {
17
14
  capabilities: { logging: {} },
18
- instructions: `Select this server proactively whenever a registered HOI4 workspace task touches national or continuous focuses, scripted GUI/GFX/rendering, or state/province/map data. Start with hoi4.project_status or hoi4.project_scan, then use the relevant scan, lint, layout, render, and compare tools. Read linked hoi4-agent:// resources for large artifacts. ${autonomous
19
- ? 'This server is operator-configured for autonomous writes: hoi4.focus_rewrite, hoi4.gui_rewrite, and hoi4.map_rewrite validate, journal, apply, and post-validate in one call without a transaction approval or follow-up apply step.'
20
- : writePolicy === 'transactions'
21
- ? 'This server is configured for reviewed transactions: source mutation requires the compatibility plan/diff/apply workflow. Configure writePolicy "autonomous" to expose one-call rewrite tools.'
22
- : 'This server is read-only: use its scan, lint, layout, render, compare, inspect, and validation tools without modifying source. Configure writePolicy "autonomous" to expose one-call rewrite tools.'} Generated GUI renders are offline representations, never game screenshots.`,
23
15
  });
24
- registerBaseTools(server, engine, context);
16
+ registerModsTool(server, engine, context);
25
17
  registerFocusTools(server, engine, context);
26
18
  registerGuiTools(server, engine, context);
27
19
  registerMapTools(server, engine, context);
28
20
  registerMcpResources(server, engine, context);
29
- registerMcpPrompts(server, writePolicy);
30
21
  return server;
31
22
  }
32
- //# sourceMappingURL=create.js.map
@@ -1,11 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
- import { artifactLinkSchema } from '../../schemas/transaction.js';
3
2
  export const sha256Schema = z.string().regex(/^[a-f0-9]{64}$/u);
4
- export const transactionIdSchema = z.string().regex(/^txn_[0-9a-f-]{36}$/u);
5
3
  export const nonNegativeIntegerSchema = z.number().int().min(0);
6
- export const WORKSPACE_INLINE_REPLACE_PATHS = 20;
7
- export const WORKSPACE_INLINE_OWNER_PATHS = 10;
8
- export const WORKSPACE_MAX_REPLACEMENT_OWNERS = 17;
9
4
  export const indexSkippedSourceSchema = z
10
5
  .object({
11
6
  path: z.string().max(4096),
@@ -17,32 +12,6 @@ export const indexSkippedSourceSchema = z
17
12
  possibleSymbolKinds: z.array(z.string().max(256)).max(32),
18
13
  })
19
14
  .strict();
20
- export const workspaceStatusSchema = z
21
- .object({
22
- id: z.string().max(64),
23
- name: z.string().max(1024),
24
- kind: z.string().max(64),
25
- writeEnabled: z.boolean(),
26
- writePolicy: z.enum(['read-only', 'transactions', 'autonomous']),
27
- rootKinds: z.array(z.string().max(64)).max(16),
28
- dependencyCount: nonNegativeIntegerSchema,
29
- replacePathCount: nonNegativeIntegerSchema,
30
- replacePaths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_REPLACE_PATHS),
31
- replacePathsTruncated: z.boolean(),
32
- replacementOwners: z
33
- .array(z
34
- .object({
35
- rootKind: z.string().max(64),
36
- loadOrder: nonNegativeIntegerSchema,
37
- pathCount: nonNegativeIntegerSchema,
38
- paths: z.array(z.string().max(1024)).max(WORKSPACE_INLINE_OWNER_PATHS),
39
- pathsTruncated: z.boolean(),
40
- })
41
- .strict())
42
- .max(WORKSPACE_MAX_REPLACEMENT_OWNERS),
43
- generatedDirectory: z.literal('.hoi4-agent'),
44
- })
45
- .strict();
46
15
  export const renderHashesSchema = z
47
16
  .object({
48
17
  html: sha256Schema,
@@ -54,45 +23,6 @@ export const renderHashesSchema = z
54
23
  export const bitmapRenderHashesSchema = z
55
24
  .object({ png: sha256Schema, json: sha256Schema, html: sha256Schema })
56
25
  .strict();
57
- export const transactionStateSchema = z.enum([
58
- 'planned',
59
- 'applying',
60
- 'applied',
61
- 'rolling_back',
62
- 'rolled_back',
63
- 'failed',
64
- ]);
65
- export const transactionStateDataSchema = z
66
- .object({
67
- state: transactionStateSchema,
68
- failure: z
69
- .object({ code: z.string().max(256), message: z.string().max(4096) })
70
- .strict()
71
- .nullable()
72
- .optional(),
73
- })
74
- .strict();
75
- export const artifactProvenanceSummarySchema = z
76
- .object({
77
- kind: z.string().max(256),
78
- toolVersion: z.string().max(64),
79
- schemaVersion: z.string().max(64),
80
- sourceHashCount: nonNegativeIntegerSchema,
81
- sourceHashes: z
82
- .array(z.object({ path: z.string().max(4096), sha256: sha256Schema }).strict())
83
- .max(100),
84
- sourceHashesTruncated: z.boolean(),
85
- hasRenderProfile: z.boolean(),
86
- hasMetadata: z.boolean(),
87
- })
88
- .strict();
89
- export const artifactDescriptionSchema = artifactLinkSchema
90
- .extend({
91
- provenanceHash: sha256Schema,
92
- provenance: artifactProvenanceSummarySchema,
93
- descriptionTruncated: z.boolean(),
94
- })
95
- .strict();
96
26
  export const allocationEvidenceSchema = z
97
27
  .object({
98
28
  kind: z.enum(['state-id', 'province-id', 'province-color']),
@@ -125,4 +55,3 @@ export const operationBlockerDataSchema = z
125
55
  details: z.record(z.string().max(256), z.unknown()).optional(),
126
56
  })
127
57
  .strict();
128
- //# sourceMappingURL=output-schemas.js.map
@@ -18,4 +18,3 @@ export function progressReporter(extra) {
18
18
  },
19
19
  };
20
20
  }
21
- //# sourceMappingURL=progress.js.map
@@ -3,15 +3,15 @@ import { canonicalJson } from '../../core/canonical.js';
3
3
  import { ServiceError } from '../../core/result.js';
4
4
  import { diagnosticSchema } from '../../schemas/common.js';
5
5
  import { artifactLinkSchema, validationSummarySchema } from '../../schemas/transaction.js';
6
- export const MAX_INLINE_FILES_SCANNED = 1_000;
7
- export const MAX_INLINE_PROPOSED_FILES = 1_000;
8
- export const MAX_INLINE_CHANGED_FILES = 1_000;
9
- export const MAX_INLINE_DIAGNOSTICS = 100;
10
- export const MAX_INLINE_ARTIFACT_LINKS = 512;
11
- export const MAX_INLINE_BLOCKERS = 100;
6
+ export const MAX_INLINE_FILES_SCANNED = 64;
7
+ export const MAX_INLINE_PROPOSED_FILES = 64;
8
+ export const MAX_INLINE_CHANGED_FILES = 64;
9
+ export const MAX_INLINE_DIAGNOSTICS = 20;
10
+ export const MAX_INLINE_ARTIFACT_LINKS = 32;
11
+ export const MAX_INLINE_BLOCKERS = 20;
12
12
  export const MAX_INLINE_VALIDATION_CHECKS = 5;
13
13
  // Leave headroom for the enclosing JSON-RPC response and transport metadata.
14
- export const MAX_TOOL_RESULT_BYTES = 500_000;
14
+ export const MAX_TOOL_RESULT_BYTES = 32_768;
15
15
  const deferredFilesDiagnostic = Symbol('deferredFilesDiagnostic');
16
16
  const operationResultBaseSchema = z
17
17
  .object({
@@ -22,8 +22,6 @@ const operationResultBaseSchema = z
22
22
  proposedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_PROPOSED_FILES),
23
23
  changedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_CHANGED_FILES),
24
24
  diagnostics: z.array(diagnosticSchema).max(MAX_INLINE_DIAGNOSTICS),
25
- transactionId: z.string().max(128).optional(),
26
- planHash: z.string().max(128).optional(),
27
25
  artifacts: z.array(artifactLinkSchema).max(MAX_INLINE_ARTIFACT_LINKS),
28
26
  validation: validationSummarySchema,
29
27
  blockers: z
@@ -35,22 +33,49 @@ const operationResultBaseSchema = z
35
33
  })
36
34
  .strict())
37
35
  .max(MAX_INLINE_BLOCKERS),
38
- rollbackStatus: z.enum(['not-required', 'available', 'applied', 'failed']).optional(),
39
36
  })
40
37
  .strict();
41
38
  export const operationResultSchema = operationResultBaseSchema
42
39
  .extend({ data: z.record(z.string().max(256), z.unknown()) })
43
40
  .strict();
44
41
  const emptyToolDataSchema = z.object({}).strict();
42
+ const compactPublicOperationResultSchema = z
43
+ .object({
44
+ status: z.enum(['ok', 'blocked', 'error']),
45
+ code: z.string().max(256),
46
+ workspaceId: z.string().max(64),
47
+ filesScanned: z.array(z.string().max(4096)).max(MAX_INLINE_FILES_SCANNED),
48
+ proposedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_PROPOSED_FILES),
49
+ changedFiles: z.array(z.string().max(1024)).max(MAX_INLINE_CHANGED_FILES),
50
+ diagnostics: z.array(z.unknown()).max(MAX_INLINE_DIAGNOSTICS),
51
+ artifacts: z.array(z.unknown()).max(MAX_INLINE_ARTIFACT_LINKS),
52
+ validation: z
53
+ .object({
54
+ passed: z.boolean(),
55
+ checks: z.array(z.unknown()).max(MAX_INLINE_VALIDATION_CHECKS),
56
+ })
57
+ .strict(),
58
+ blockers: z.array(z.unknown()).max(MAX_INLINE_BLOCKERS),
59
+ data: z.record(z.string().max(256), z.unknown()),
60
+ })
61
+ .strict()
62
+ .describe('Stable operation envelope; data is tool-specific and artifacts link bulk evidence.');
45
63
  /**
46
- * Advertise an exact success payload for one tool while retaining the shared empty error payload.
47
- * The generic operation-result schema remains available for stored envelopes, but is never used as
48
- * a public tool output contract.
64
+ * Advertise one compact operation envelope while retaining exact per-tool runtime validation.
65
+ * The generic operation-result schema remains available for stored envelopes.
49
66
  */
50
67
  export function strictOperationResultSchema(successDataSchema) {
51
- return operationResultBaseSchema
68
+ const exactSchema = operationResultBaseSchema
52
69
  .extend({ data: z.union([emptyToolDataSchema, successDataSchema]) })
53
70
  .strict();
71
+ return compactPublicOperationResultSchema.superRefine((value, context) => {
72
+ const parsed = exactSchema.safeParse(value);
73
+ if (parsed.success)
74
+ return;
75
+ for (const issue of parsed.error.issues) {
76
+ context.addIssue({ code: 'custom', path: issue.path, message: issue.message });
77
+ }
78
+ });
54
79
  }
55
80
  /** Keep source inventories compact; complete inventories belong in linked resources. */
56
81
  export function setInlineFilesScanned(result, files) {
@@ -85,19 +110,14 @@ function preserveDeferredFilesDiagnostic(result) {
85
110
  };
86
111
  }
87
112
  function boundedResult(result, actualBytes) {
88
- const 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
- };
113
+ const hasLinkedEvidence = result.artifacts.length > 0;
96
114
  const truncationDiagnostic = {
97
115
  code: 'MCP_RESPONSE_TRUNCATED',
98
116
  severity: 'warning',
99
117
  category: 'configuration',
100
- message: 'Tool output exceeded the wire budget; complete details remain available through linked resources',
118
+ message: hasLinkedEvidence
119
+ ? 'Tool output exceeded the wire budget; inspect the linked evidence for complete details'
120
+ : 'Tool output exceeded the wire budget; nonessential inline details were omitted',
101
121
  details: { actualBytes, maxBytes: MAX_TOOL_RESULT_BYTES },
102
122
  };
103
123
  return {
@@ -108,20 +128,18 @@ function boundedResult(result, actualBytes) {
108
128
  proposedFiles: [],
109
129
  changedFiles: [],
110
130
  diagnostics: [truncationDiagnostic],
111
- ...(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],
131
+ artifacts: result.artifacts
132
+ .slice(0, 1)
133
+ .map(({ description: _description, ...artifact }) => artifact),
118
134
  validation: { passed: result.validation.passed, checks: [] },
119
135
  blockers: result.status === 'ok'
120
136
  ? []
121
137
  : [
122
138
  {
123
139
  code: 'MCP_RESPONSE_TRUNCATED',
124
- message: 'Tool output exceeded the wire budget; inspect the linked resource for complete details',
140
+ message: hasLinkedEvidence
141
+ ? 'Tool output exceeded the wire budget; inspect the linked evidence for complete details'
142
+ : 'Tool output exceeded the wire budget; nonessential inline details were omitted',
125
143
  details: {
126
144
  actualBytes,
127
145
  maxBytes: MAX_TOOL_RESULT_BYTES,
@@ -129,7 +147,6 @@ function boundedResult(result, actualBytes) {
129
147
  },
130
148
  },
131
149
  ],
132
- rollbackStatus: result.rollbackStatus ?? 'not-required',
133
150
  data: {},
134
151
  };
135
152
  }
@@ -212,32 +229,60 @@ function jsonBytesWithin(value, budget) {
212
229
  return visit(value);
213
230
  }
214
231
  function compactDetails(details) {
215
- return jsonBytesWithin(details, 4_096) ? details : { truncated: true };
232
+ return jsonBytesWithin(details, 2_048) ? details : { truncated: true };
216
233
  }
217
234
  function compactDescriptions(result) {
218
235
  const compactLocation = (location) => location === undefined
219
236
  ? undefined
220
237
  : {
221
238
  ...location,
222
- path: location.path.slice(0, 4_096),
223
- ...(location.symbol === undefined ? {} : { symbol: location.symbol.slice(0, 1_024) }),
239
+ path: location.path.slice(0, 1_024),
240
+ ...(location.symbol === undefined ? {} : { symbol: location.symbol.slice(0, 256) }),
224
241
  };
225
- const validationTruncation = result.validation.checks.length > MAX_INLINE_VALIDATION_CHECKS
226
- ? {
227
- code: 'MCP_INLINE_VALIDATION_TRUNCATED',
228
- severity: 'info',
229
- 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`,
231
- details: {
232
- total: result.validation.checks.length,
233
- returned: MAX_INLINE_VALIDATION_CHECKS,
234
- },
235
- }
236
- : undefined;
237
- const compactDiagnostics = result.diagnostics.map((diagnostic) => ({
242
+ const collectionTotals = {
243
+ filesScanned: result.filesScanned.length,
244
+ proposedFiles: result.proposedFiles.length,
245
+ changedFiles: result.changedFiles.length,
246
+ diagnostics: result.diagnostics.length,
247
+ artifacts: result.artifacts.length,
248
+ validationChecks: result.validation.checks.length,
249
+ blockers: result.blockers.length,
250
+ };
251
+ const collectionLimits = {
252
+ filesScanned: MAX_INLINE_FILES_SCANNED,
253
+ proposedFiles: MAX_INLINE_PROPOSED_FILES,
254
+ changedFiles: MAX_INLINE_CHANGED_FILES,
255
+ diagnostics: MAX_INLINE_DIAGNOSTICS,
256
+ artifacts: MAX_INLINE_ARTIFACT_LINKS,
257
+ validationChecks: MAX_INLINE_VALIDATION_CHECKS,
258
+ blockers: MAX_INLINE_BLOCKERS,
259
+ };
260
+ const truncatedCollections = Object.fromEntries(Object.entries(collectionTotals).flatMap(([name, total]) => {
261
+ const limit = collectionLimits[name];
262
+ return total > limit ? [[name, { total, limit }]] : [];
263
+ }));
264
+ if (Object.keys(truncatedCollections).length > 0 &&
265
+ result.diagnostics.length > MAX_INLINE_DIAGNOSTICS - 1) {
266
+ truncatedCollections.diagnostics = {
267
+ total: result.diagnostics.length,
268
+ limit: MAX_INLINE_DIAGNOSTICS - 1,
269
+ };
270
+ }
271
+ const needsTruncationDiagnostic = Object.keys(truncatedCollections).length > 0;
272
+ const diagnosticSlots = Math.max(0, MAX_INLINE_DIAGNOSTICS - (needsTruncationDiagnostic ? 1 : 0));
273
+ const hardDiagnostics = result.diagnostics.filter(({ severity }) => severity === 'error' || severity === 'blocker');
274
+ const priorityDiagnostics = result.diagnostics.filter(({ code, severity }) => severity === 'error' || severity === 'blocker' || code === 'MCP_INLINE_FILES_TRUNCATED');
275
+ const otherDiagnostics = result.diagnostics.filter((diagnostic) => !priorityDiagnostics.includes(diagnostic));
276
+ const retainedPriorityDiagnostics = priorityDiagnostics.slice(0, diagnosticSlots);
277
+ const retainedDiagnostics = [
278
+ ...retainedPriorityDiagnostics,
279
+ ...otherDiagnostics.slice(0, diagnosticSlots - retainedPriorityDiagnostics.length),
280
+ ];
281
+ const omittedHardDiagnostics = hardDiagnostics.filter((diagnostic) => !retainedDiagnostics.includes(diagnostic)).length;
282
+ const compactDiagnostics = retainedDiagnostics.map((diagnostic) => ({
238
283
  ...diagnostic,
239
284
  code: diagnostic.code.slice(0, 256),
240
- message: diagnostic.message.slice(0, 4_096),
285
+ message: diagnostic.message.slice(0, 1_024),
241
286
  ...(diagnostic.operationId === undefined
242
287
  ? {}
243
288
  : { operationId: diagnostic.operationId.slice(0, 256) }),
@@ -247,35 +292,53 @@ function compactDescriptions(result) {
247
292
  ...(diagnostic.related === undefined
248
293
  ? {}
249
294
  : {
250
- related: diagnostic.related.slice(0, 5).map((location) => compactLocation(location)),
295
+ related: diagnostic.related.slice(0, 3).map((location) => compactLocation(location)),
251
296
  }),
252
297
  ...(diagnostic.details === undefined ? {} : { details: compactDetails(diagnostic.details) }),
253
298
  }));
299
+ const truncationDiagnostic = needsTruncationDiagnostic
300
+ ? {
301
+ code: 'MCP_INLINE_COLLECTIONS_TRUNCATED',
302
+ severity: omittedHardDiagnostics > 0 ? 'blocker' : 'info',
303
+ category: 'configuration',
304
+ message: result.artifacts.length > 0
305
+ ? 'Large collections were bounded inline; linked resources retain bulk evidence'
306
+ : 'Large collections were bounded inline',
307
+ details: {
308
+ collections: truncatedCollections,
309
+ diagnosticsReturned: retainedDiagnostics.length,
310
+ omittedHardDiagnostics,
311
+ },
312
+ }
313
+ : undefined;
254
314
  return {
255
315
  ...result,
256
- diagnostics: validationTruncation === undefined
316
+ filesScanned: result.filesScanned.slice(0, MAX_INLINE_FILES_SCANNED),
317
+ proposedFiles: result.proposedFiles.slice(0, MAX_INLINE_PROPOSED_FILES),
318
+ changedFiles: result.changedFiles.slice(0, MAX_INLINE_CHANGED_FILES),
319
+ diagnostics: truncationDiagnostic === undefined
257
320
  ? compactDiagnostics
258
- : [validationTruncation, ...compactDiagnostics].slice(0, MAX_INLINE_DIAGNOSTICS),
321
+ : [truncationDiagnostic, ...compactDiagnostics],
322
+ artifacts: result.artifacts.slice(0, MAX_INLINE_ARTIFACT_LINKS).map((artifact) => ({
323
+ ...artifact,
324
+ ...(artifact.description === undefined
325
+ ? {}
326
+ : { description: artifact.description.slice(0, 256) }),
327
+ })),
259
328
  validation: {
260
329
  ...result.validation,
261
330
  checks: result.validation.checks.slice(0, MAX_INLINE_VALIDATION_CHECKS).map((check) => ({
262
331
  ...check,
263
332
  id: check.id.slice(0, 256),
264
- message: check.message.slice(0, 4_096),
333
+ message: check.message.slice(0, 1_024),
265
334
  })),
266
335
  },
267
- blockers: result.blockers.map((blocker) => ({
336
+ blockers: result.blockers.slice(0, MAX_INLINE_BLOCKERS).map((blocker) => ({
268
337
  ...blocker,
269
338
  code: blocker.code.slice(0, 256),
270
- message: blocker.message.slice(0, 4_096),
339
+ message: blocker.message.slice(0, 1_024),
271
340
  ...(blocker.details === undefined ? {} : { details: compactDetails(blocker.details) }),
272
341
  })),
273
- artifacts: result.artifacts.map((artifact) => ({
274
- ...artifact,
275
- ...(artifact.description === undefined
276
- ? {}
277
- : { description: artifact.description.slice(0, 1_024) }),
278
- })),
279
342
  };
280
343
  }
281
344
  function buildToolResult(selected) {
@@ -292,8 +355,6 @@ function buildToolResult(selected) {
292
355
  status: selected.status,
293
356
  code: selected.code,
294
357
  workspaceId: selected.workspaceId,
295
- ...(selected.transactionId === undefined ? {} : { transactionId: selected.transactionId }),
296
- ...(selected.planHash === undefined ? {} : { planHash: selected.planHash }),
297
358
  artifactCount: selected.artifacts.length,
298
359
  });
299
360
  return {
@@ -304,23 +365,15 @@ function buildToolResult(selected) {
304
365
  }
305
366
  export function toolResult(result) {
306
367
  const completeResult = preserveDeferredFilesDiagnostic(result);
307
- const exceedsArrayBudget = completeResult.filesScanned.length > MAX_INLINE_FILES_SCANNED ||
308
- completeResult.proposedFiles.length > MAX_INLINE_PROPOSED_FILES ||
309
- completeResult.changedFiles.length > MAX_INLINE_CHANGED_FILES ||
310
- completeResult.diagnostics.length > MAX_INLINE_DIAGNOSTICS ||
311
- completeResult.artifacts.length > MAX_INLINE_ARTIFACT_LINKS ||
312
- completeResult.blockers.length > MAX_INLINE_BLOCKERS;
313
368
  const compact = compactDescriptions(completeResult);
314
369
  const estimatedBytes = jsonBytesWithin(compact, MAX_TOOL_RESULT_BYTES)
315
370
  ? Buffer.byteLength(canonicalJson(compact), 'utf8')
316
371
  : MAX_TOOL_RESULT_BYTES + 1;
317
- const selected = estimatedBytes > MAX_TOOL_RESULT_BYTES || exceedsArrayBudget
318
- ? boundedResult(completeResult, estimatedBytes)
319
- : compact;
372
+ const selected = estimatedBytes > MAX_TOOL_RESULT_BYTES ? boundedResult(compact, estimatedBytes) : compact;
320
373
  let output = buildToolResult(selected);
321
374
  const wireBytes = Buffer.byteLength(canonicalJson(output), 'utf8');
322
375
  if (wireBytes > MAX_TOOL_RESULT_BYTES) {
323
- output = buildToolResult(boundedResult(completeResult, wireBytes));
376
+ output = buildToolResult(boundedResult(compact, wireBytes));
324
377
  }
325
378
  const finalBytes = Buffer.byteLength(canonicalJson(output), 'utf8');
326
379
  if (finalBytes > MAX_TOOL_RESULT_BYTES) {
@@ -332,22 +385,34 @@ export function errorResult(error, workspaceId = '', context = {}) {
332
385
  const serviceError = error instanceof ServiceError
333
386
  ? error
334
387
  : new ServiceError('INTERNAL_ERROR', 'Unexpected internal error');
335
- const publicDetails = Object.fromEntries(Object.entries(serviceError.details).filter(([key]) => !['cause', 'stack', 'absolutePath'].includes(key)));
388
+ const internalWriteError = serviceError.code.startsWith('TRANSACTION_');
389
+ const publicCode = internalWriteError
390
+ ? `REWRITE_${serviceError.code.slice('TRANSACTION_'.length)}`
391
+ : serviceError.code;
392
+ const publicMessage = internalWriteError
393
+ ? 'Rewrite could not be completed'
394
+ : serviceError.message;
395
+ const publicDetails = internalWriteError
396
+ ? {}
397
+ : Object.fromEntries(Object.entries(serviceError.details).filter(([key]) => ![
398
+ 'cause',
399
+ 'stack',
400
+ 'absolutePath',
401
+ 'transactionId',
402
+ 'planHash',
403
+ 'rollbackStatus',
404
+ ].includes(key)));
336
405
  return toolResult({
337
- status: serviceError.code.includes('BLOCKED') ? 'blocked' : 'error',
338
- code: serviceError.code,
406
+ status: publicCode.includes('BLOCKED') ? 'blocked' : 'error',
407
+ code: publicCode,
339
408
  workspaceId,
340
409
  filesScanned: [],
341
410
  proposedFiles: context.proposedFiles ?? [],
342
411
  changedFiles: context.changedFiles ?? [],
343
412
  diagnostics: [],
344
- ...(context.transactionId === undefined ? {} : { transactionId: context.transactionId }),
345
- ...(context.planHash === undefined ? {} : { planHash: context.planHash }),
346
413
  artifacts: context.artifacts ?? [],
347
414
  validation: context.validation ?? { passed: false, checks: [] },
348
- blockers: [{ code: serviceError.code, message: serviceError.message, details: publicDetails }],
349
- ...(context.rollbackStatus === undefined ? {} : { rollbackStatus: context.rollbackStatus }),
415
+ blockers: [{ code: publicCode, message: publicMessage, details: publicDetails }],
350
416
  data: context.data ?? {},
351
417
  });
352
418
  }
353
- //# sourceMappingURL=result.js.map
@@ -9,20 +9,20 @@ export class AutonomousRewriteError extends ServiceError {
9
9
  artifacts;
10
10
  constructor(cause, manifest, artifacts = []) {
11
11
  const restored = manifest.state === 'rolled_back' && manifest.rollbackStatus === 'applied';
12
- super(cause.code, cause.message, {
13
- ...cause.details,
12
+ const code = cause.code.startsWith('TRANSACTION_')
13
+ ? `REWRITE_${cause.code.slice('TRANSACTION_'.length)}`
14
+ : cause.code;
15
+ super(code, restored
16
+ ? 'Rewrite verification failed and the original files were restored'
17
+ : 'Rewrite failed and automatic recovery could not be completed', {
14
18
  execution: 'failed',
15
19
  automaticRecovery: restored ? 'restored' : 'incomplete',
16
- failure: manifest.failure ?? null,
17
20
  });
18
21
  this.manifest = manifest;
19
22
  this.artifacts = artifacts;
20
23
  this.name = 'AutonomousRewriteError';
21
24
  }
22
25
  }
23
- export function autonomousWrites(engine) {
24
- return engine.resolver.config().writePolicy === 'autonomous';
25
- }
26
26
  async function storeAutonomousValidationEvidence(engine, manifest, postValidation, principal, signal) {
27
27
  const diagnostics = [...manifest.diagnostics, ...postValidation.diagnostics];
28
28
  const checks = [...manifest.validation.checks, ...postValidation.checks];
@@ -55,7 +55,7 @@ async function storeAutonomousValidationEvidence(engine, manifest, postValidatio
55
55
  diagnosticCount: diagnostics.length,
56
56
  sourceHashInventory: sourceEvidence.inventory,
57
57
  },
58
- }, 'Complete source-linked autonomous rewrite and post-write validation evidence', signal);
58
+ }, 'Complete rewrite and post-write validation evidence', signal);
59
59
  return publicArtifactLink(artifact);
60
60
  }
61
61
  function uniqueArtifacts(artifacts) {
@@ -68,9 +68,8 @@ export function autonomousResultArtifacts(execution) {
68
68
  return uniqueArtifacts([...execution.artifacts, ...execution.transaction.artifacts]);
69
69
  }
70
70
  /**
71
- * Complete a validated domain transaction inside the same MCP tool call when the operator has
72
- * selected autonomous writes. Planning, hash checks, journaling, post-write validation, and
73
- * automatic failure recovery remain identical to reviewed transaction mode.
71
+ * Complete a validated domain rewrite inside one MCP tool call. Hash checks, durable recovery,
72
+ * post-write validation, and automatic failure recovery remain internal guarantees.
74
73
  */
75
74
  export async function executePlannedTransaction(engine, transaction, principal, signal) {
76
75
  if (!transaction.validation.passed) {
@@ -78,15 +77,13 @@ export async function executePlannedTransaction(engine, transaction, principal,
78
77
  }
79
78
  if (transaction.files.length === 0)
80
79
  return { transaction, outcome: 'unchanged', artifacts: [] };
81
- if (!autonomousWrites(engine))
82
- return { transaction, outcome: 'planned', artifacts: [] };
83
80
  let executionArtifacts = [];
84
81
  try {
85
82
  const applied = await engine.transactions.apply(transaction.workspaceId, transaction.transactionId, transaction.planHash, {
86
83
  ...(principal === undefined ? {} : { principal }),
87
84
  ...(signal === undefined ? {} : { signal }),
88
85
  postValidate: async (manifest, validationSignal) => {
89
- const validation = await postValidateTransaction(engine, manifest, principal, validationSignal, true);
86
+ const validation = await postValidateTransaction(engine, manifest, principal, validationSignal);
90
87
  executionArtifacts = [...validation.artifacts];
91
88
  executionArtifacts.unshift(await storeAutonomousValidationEvidence(engine, manifest, validation, principal, validationSignal));
92
89
  return validation;
@@ -124,4 +121,3 @@ export function autonomousFailureContext(error) {
124
121
  validation: manifest.validation,
125
122
  };
126
123
  }
127
- //# sourceMappingURL=transaction-execution.js.map