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,115 +1,12 @@
1
- import { z } from 'zod/v4';
2
- import { compareCodeUnits, canonicalJson, sha256Bytes } from '../../core/canonical.js';
3
1
  import { boundedSourceHashEvidence, publicArtifactLink } from '../../core/artifacts.js';
4
- import { workspaceRegistrationSchema } from '../../core/configuration.js';
5
- import { emptyServiceResult, ServiceError } from '../../core/result.js';
2
+ import { canonicalJson } from '../../core/canonical.js';
3
+ import { ServiceError } from '../../core/result.js';
6
4
  import { parseClausewitz } from '../../core/source/index.js';
7
5
  import { TRANSACTION_MAX_DIAGNOSTICS } from '../../core/transaction-limits.js';
8
6
  import { importContinuousFocusPalettes, importFocusTrees, layoutFocusTreeAsync, lintContinuousFocusPalette, lintFocusTree, } from '../../focus/index.js';
9
7
  import { ScriptedGuiStudio } from '../../gui/index.js';
10
8
  import { AgentNudger, attributeMapValidationDiagnostics } from '../../map/index.js';
11
9
  import { PACKAGE_VERSION } from '../../version.js';
12
- import { artifactDescriptionSchema, indexSkippedSourceSchema, nonNegativeIntegerSchema, sha256Schema, transactionIdSchema, transactionStateDataSchema, transactionStateSchema, WORKSPACE_INLINE_OWNER_PATHS, WORKSPACE_INLINE_REPLACE_PATHS, workspaceStatusSchema, } from './output-schemas.js';
13
- import { errorResult, setInlineFilesScanned, strictOperationResultSchema, toolResult, } from './result.js';
14
- import { progressReporter } from './progress.js';
15
- import { artifactLinkSchema } from '../../schemas/transaction.js';
16
- const projectRegisterOutputSchema = strictOperationResultSchema(z.object({ workspace: workspaceStatusSchema }).strict());
17
- const projectStatusOutputSchema = strictOperationResultSchema(z
18
- .object({
19
- count: nonNegativeIntegerSchema,
20
- returned: nonNegativeIntegerSchema,
21
- workspaces: z.array(workspaceStatusSchema).max(1),
22
- nextCursor: z.string().max(4096).optional(),
23
- })
24
- .strict());
25
- const projectScanOutputSchema = strictOperationResultSchema(z
26
- .object({
27
- revision: sha256Schema,
28
- complete: z.boolean(),
29
- skippedSourceCount: nonNegativeIntegerSchema,
30
- skippedSources: z.array(indexSkippedSourceSchema).max(100),
31
- symbols: nonNegativeIntegerSchema,
32
- references: nonNegativeIntegerSchema,
33
- unresolvedReferences: nonNegativeIntegerSchema,
34
- symbolCounts: z.record(z.string().max(256), nonNegativeIntegerSchema),
35
- })
36
- .strict());
37
- const transactionStatusOutputSchema = strictOperationResultSchema(z
38
- .object({
39
- manifest: z
40
- .object({
41
- version: z.number().int().positive(),
42
- transactionId: transactionIdSchema,
43
- createdAt: z.iso.datetime(),
44
- expiresAt: z.iso.datetime(),
45
- state: transactionStateSchema,
46
- operationKind: z.string().min(1).max(256),
47
- operationCount: nonNegativeIntegerSchema,
48
- readDependencyCount: nonNegativeIntegerSchema,
49
- fileCount: nonNegativeIntegerSchema,
50
- diagnosticCount: nonNegativeIntegerSchema,
51
- artifactCount: nonNegativeIntegerSchema,
52
- appliedFileCount: nonNegativeIntegerSchema,
53
- rollbackStatus: z.enum(['available', 'applied', 'failed']),
54
- failure: z
55
- .object({ code: z.string().max(256), message: z.string().max(4096) })
56
- .strict()
57
- .nullable(),
58
- })
59
- .strict(),
60
- })
61
- .strict());
62
- const transactionDiffOutputSchema = strictOperationResultSchema(z
63
- .object({
64
- files: z
65
- .array(z
66
- .object({
67
- relativePath: z.string().min(1).max(1024),
68
- operationIdCount: nonNegativeIntegerSchema,
69
- operationIds: z.array(z.string().min(1).max(256)).max(20),
70
- beforeSha256: sha256Schema.nullable(),
71
- afterSha256: sha256Schema.nullable(),
72
- beforeSize: nonNegativeIntegerSchema.nullable(),
73
- afterSize: nonNegativeIntegerSchema.nullable(),
74
- mediaType: z.string().min(1).max(255),
75
- diffArtifact: artifactLinkSchema.optional(),
76
- })
77
- .strict())
78
- .max(20),
79
- operations: z
80
- .array(z
81
- .object({
82
- id: z.string().min(1).max(256),
83
- kind: z.string().min(1).max(256),
84
- summary: z.string().max(4096),
85
- })
86
- .strict())
87
- .max(20),
88
- fileCount: nonNegativeIntegerSchema,
89
- operationCount: nonNegativeIntegerSchema,
90
- artifactCount: nonNegativeIntegerSchema,
91
- returnedFiles: nonNegativeIntegerSchema,
92
- returnedOperations: nonNegativeIntegerSchema,
93
- returnedArtifacts: nonNegativeIntegerSchema,
94
- nextCursor: z.string().max(4096).optional(),
95
- expiresAt: z.iso.datetime(),
96
- })
97
- .strict());
98
- const transactionMutationOutputSchema = strictOperationResultSchema(transactionStateDataSchema
99
- .extend({
100
- fileCount: nonNegativeIntegerSchema.optional(),
101
- appliedFileCount: nonNegativeIntegerSchema.optional(),
102
- artifactCount: nonNegativeIntegerSchema.optional(),
103
- })
104
- .strict());
105
- const artifactListOutputSchema = strictOperationResultSchema(z
106
- .object({
107
- count: nonNegativeIntegerSchema,
108
- returned: nonNegativeIntegerSchema,
109
- nextCursor: z.string().max(4096).optional(),
110
- })
111
- .strict());
112
- const artifactDescribeOutputSchema = strictOperationResultSchema(z.object({ artifact: artifactDescriptionSchema }).strict());
113
10
  export function requireServerScope(context, scope) {
114
11
  if (context.scopes !== undefined && !context.scopes.includes(scope)) {
115
12
  throw new ServiceError('AUTH_SCOPE_REQUIRED', `This operation requires the ${scope} scope`, {
@@ -117,135 +14,10 @@ export function requireServerScope(context, scope) {
117
14
  });
118
15
  }
119
16
  }
120
- const workspaceInput = z.object({ workspaceId: z.string().min(1).max(64) }).strict();
121
- const transactionInput = workspaceInput
122
- .extend({ transactionId: transactionIdSchema, expectedPlanHash: sha256Schema })
123
- .strict();
124
17
  function sourcePathComparisonKey(value) {
125
18
  const normalized = value.replaceAll('\\', '/');
126
19
  return process.platform === 'win32' ? normalized.toLocaleLowerCase('en-US') : normalized;
127
20
  }
128
- const readOnly = {
129
- readOnlyHint: true,
130
- destructiveHint: false,
131
- idempotentHint: true,
132
- openWorldHint: false,
133
- };
134
- const artifactProducing = {
135
- readOnlyHint: false,
136
- destructiveHint: false,
137
- idempotentHint: true,
138
- openWorldHint: false,
139
- };
140
- const artifactCursorSchema = z
141
- .object({ version: z.literal(1), revision: sha256Schema, after: z.string().min(1).max(2048) })
142
- .strict();
143
- const workspaceCursorSchema = z
144
- .object({ version: z.literal(1), revision: sha256Schema, after: z.string().min(1).max(64) })
145
- .strict();
146
- const transactionDiffCursorSchema = z
147
- .object({
148
- version: z.literal(1),
149
- planHash: sha256Schema,
150
- fileOffset: nonNegativeIntegerSchema,
151
- operationOffset: nonNegativeIntegerSchema,
152
- artifactOffset: nonNegativeIntegerSchema,
153
- })
154
- .strict();
155
- function encodeArtifactCursor(revision, after) {
156
- return Buffer.from(canonicalJson({ version: 1, revision, after }), 'utf8').toString('base64url');
157
- }
158
- function decodeArtifactCursor(cursor) {
159
- try {
160
- if (!/^[A-Za-z0-9_-]+$/u.test(cursor))
161
- throw new Error('invalid base64url');
162
- const decoded = Buffer.from(cursor, 'base64url');
163
- if (decoded.toString('base64url') !== cursor)
164
- throw new Error('non-canonical base64url');
165
- return artifactCursorSchema.parse(JSON.parse(decoded.toString('utf8')));
166
- }
167
- catch {
168
- throw new ServiceError('ARTIFACT_CURSOR_INVALID', 'Artifact list cursor is invalid');
169
- }
170
- }
171
- function encodeWorkspaceCursor(revision, after) {
172
- return Buffer.from(canonicalJson({ version: 1, revision, after }), 'utf8').toString('base64url');
173
- }
174
- function decodeWorkspaceCursor(cursor) {
175
- try {
176
- if (!/^[A-Za-z0-9_-]+$/u.test(cursor))
177
- throw new Error('invalid base64url');
178
- const decoded = Buffer.from(cursor, 'base64url');
179
- if (decoded.toString('base64url') !== cursor)
180
- throw new Error('non-canonical base64url');
181
- return workspaceCursorSchema.parse(JSON.parse(decoded.toString('utf8')));
182
- }
183
- catch {
184
- throw new ServiceError('WORKSPACE_CURSOR_INVALID', 'Workspace status cursor is invalid');
185
- }
186
- }
187
- function encodeTransactionDiffCursor(planHash, fileOffset, operationOffset, artifactOffset) {
188
- return Buffer.from(canonicalJson({
189
- version: 1,
190
- planHash,
191
- fileOffset,
192
- operationOffset,
193
- artifactOffset,
194
- }), 'utf8').toString('base64url');
195
- }
196
- function decodeTransactionDiffCursor(cursor) {
197
- try {
198
- if (!/^[A-Za-z0-9_-]+$/u.test(cursor))
199
- throw new Error('invalid base64url');
200
- const decoded = Buffer.from(cursor, 'base64url');
201
- if (decoded.toString('base64url') !== cursor)
202
- throw new Error('non-canonical base64url');
203
- return transactionDiffCursorSchema.parse(JSON.parse(decoded.toString('utf8')));
204
- }
205
- catch {
206
- throw new ServiceError('TRANSACTION_CURSOR_INVALID', 'Transaction diff cursor is invalid');
207
- }
208
- }
209
- export function transactionResourceLink(manifest) {
210
- return {
211
- uri: `hoi4-agent://workspace/${encodeURIComponent(manifest.workspaceId)}/transaction/${encodeURIComponent(manifest.transactionId)}`,
212
- name: `${manifest.transactionId}.manifest.json`,
213
- mimeType: 'application/json',
214
- description: 'Complete authenticated transaction manifest and rollback status',
215
- };
216
- }
217
- export function compactWorkspaceStatus(status) {
218
- return {
219
- ...status,
220
- replacePathCount: status.replacePaths.length,
221
- replacePaths: status.replacePaths.slice(0, WORKSPACE_INLINE_REPLACE_PATHS),
222
- replacePathsTruncated: status.replacePaths.length > WORKSPACE_INLINE_REPLACE_PATHS,
223
- replacementOwners: status.replacementOwners.map((owner) => ({
224
- ...owner,
225
- pathCount: owner.paths.length,
226
- paths: owner.paths.slice(0, WORKSPACE_INLINE_OWNER_PATHS),
227
- pathsTruncated: owner.paths.length > WORKSPACE_INLINE_OWNER_PATHS,
228
- })),
229
- };
230
- }
231
- function transactionSummary(manifest) {
232
- return {
233
- version: manifest.version,
234
- transactionId: manifest.transactionId,
235
- createdAt: manifest.createdAt,
236
- expiresAt: manifest.expiresAt,
237
- state: manifest.state,
238
- operationKind: manifest.operationKind,
239
- operationCount: manifest.operations.length,
240
- readDependencyCount: manifest.readDependencies.length,
241
- fileCount: manifest.files.length,
242
- diagnosticCount: manifest.diagnostics.length,
243
- artifactCount: manifest.artifacts.length,
244
- appliedFileCount: manifest.appliedFiles.length,
245
- rollbackStatus: manifest.rollbackStatus,
246
- failure: manifest.failure ?? null,
247
- };
248
- }
249
21
  function focusReferences(engineSnapshot) {
250
22
  const active = (kind) => engineSnapshot.index
251
23
  .findAll(kind)
@@ -261,7 +33,7 @@ function focusReferences(engineSnapshot) {
261
33
  helper: active('scripted_effect'),
262
34
  };
263
35
  }
264
- async function postValidateTransaction(engine, transaction, principal, signal) {
36
+ export async function postValidateTransaction(engine, transaction, principal, signal) {
265
37
  engine.invalidate(transaction.workspaceId);
266
38
  const snapshot = await engine.scan(transaction.workspaceId, {}, principal, signal);
267
39
  const changed = new Set(transaction.files.map(({ relativePath }) => sourcePathComparisonKey(relativePath)));
@@ -294,27 +66,27 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
294
66
  id: 'post-write-focus',
295
67
  passed,
296
68
  message: passed
297
- ? 'Applied focus source re-imported, laid out, and linted successfully'
298
- : 'Applied focus source failed post-write import or lint',
69
+ ? 'The focus result re-imported, laid out, and linted successfully'
70
+ : 'The focus result failed post-write import or lint',
299
71
  });
300
72
  }
301
73
  else if (transaction.operationKind === 'continuous-focus-plan-changes') {
302
74
  for (const file of snapshot.files.filter(({ shadowedBy, relativePath }) => shadowedBy === undefined &&
303
75
  relativePath.toLowerCase().endsWith('.txt') &&
304
76
  changed.has(sourcePathComparisonKey(relativePath)))) {
305
- const document = parseClausewitz(file.bytes, file.displayPath);
306
- const imported = importContinuousFocusPalettes(document);
77
+ const imported = importContinuousFocusPalettes(parseClausewitz(file.bytes, file.displayPath));
307
78
  diagnostics.push(...imported.diagnostics);
308
- for (const plan of imported.continuousFocusPalettes)
79
+ for (const plan of imported.continuousFocusPalettes) {
309
80
  diagnostics.push(...lintContinuousFocusPalette(plan));
81
+ }
310
82
  }
311
83
  const passed = !diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker');
312
84
  checks.push({
313
85
  id: 'post-write-continuous-focus',
314
86
  passed,
315
87
  message: passed
316
- ? 'Applied continuous focus source re-imported and linted successfully'
317
- : 'Applied continuous focus source failed post-write import or lint',
88
+ ? 'The continuous focus result re-imported and linted successfully'
89
+ : 'The continuous focus result failed post-write import or lint',
318
90
  });
319
91
  }
320
92
  else if (transaction.operationKind === 'gui-source-change' ||
@@ -327,8 +99,8 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
327
99
  id: 'post-write-gui-graph',
328
100
  passed,
329
101
  message: passed
330
- ? 'Applied GUI source graph rebuilt successfully'
331
- : 'Applied GUI source graph has blocking diagnostics',
102
+ ? 'The GUI graph rebuilt successfully'
103
+ : 'The GUI graph has blocking diagnostics',
332
104
  });
333
105
  }
334
106
  else if (transaction.operationKind === 'agent-nudger-map-changes') {
@@ -346,8 +118,8 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
346
118
  id: 'post-write-map',
347
119
  passed: validated.validation.passed,
348
120
  message: validated.validation.passed
349
- ? 'Applied map sources rescanned and validated successfully'
350
- : 'Applied map sources failed post-write validation',
121
+ ? 'The map result rescanned and validated successfully'
122
+ : 'The map result failed post-write validation',
351
123
  });
352
124
  }
353
125
  const passed = !diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker');
@@ -355,28 +127,26 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
355
127
  id: 'post-write-shared-index',
356
128
  passed,
357
129
  message: passed
358
- ? 'Changed source reparsed and reindexed successfully'
359
- : 'Changed source has blocking post-write diagnostics',
130
+ ? 'Changed files reparsed and reindexed successfully'
131
+ : 'Changed files have blocking post-write diagnostics',
360
132
  });
361
133
  const availableDiagnostics = Math.max(0, TRANSACTION_MAX_DIAGNOSTICS - transaction.diagnostics.length);
362
134
  if (diagnostics.length > availableDiagnostics) {
363
135
  const workspace = engine.resolver.get(transaction.workspaceId, principal);
364
136
  const sourceEvidence = boundedSourceHashEvidence(Object.fromEntries(transaction.files.flatMap(({ relativePath, afterSha256 }) => afterSha256 === null ? [] : [[relativePath, afterSha256]])));
365
- const artifact = await engine.artifacts.putChunked(workspace, `${transaction.transactionId}.post-validation.json`, 'application/json', `${canonicalJson({
137
+ const artifact = await engine.artifacts.putChunked(workspace, `${transaction.operationKind}.post-validation.json`, 'application/json', `${canonicalJson({
366
138
  schemaVersion: 1,
367
- transactionId: transaction.transactionId,
368
- planHash: transaction.planHash,
369
139
  operationKind: transaction.operationKind,
370
140
  diagnosticCount: diagnostics.length,
371
141
  checks,
372
142
  diagnostics,
373
143
  })}\n`, {
374
- kind: 'transaction-post-validation',
144
+ kind: 'rewrite-post-validation',
375
145
  toolVersion: PACKAGE_VERSION,
376
- schemaVersion: 'transaction-post-validation.v1',
146
+ schemaVersion: 'rewrite-post-validation.v1',
377
147
  sourceHashes: sourceEvidence.sourceHashes,
378
148
  metadata: { sourceHashInventory: sourceEvidence.inventory },
379
- }, 'Complete source-linked diagnostics from post-write transaction validation', signal);
149
+ }, 'Complete diagnostics from post-write validation', signal);
380
150
  const retainedLimit = Math.max(0, availableDiagnostics - 1);
381
151
  const hard = diagnostics.filter(({ severity }) => severity === 'error' || severity === 'blocker');
382
152
  const retainedHard = hard.slice(0, retainedLimit);
@@ -386,7 +156,7 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
386
156
  const omittedHard = hard.length - retainedHard.length;
387
157
  const artifactLink = publicArtifactLink(artifact);
388
158
  checks.push({
389
- id: 'post-write-diagnostics-resource',
159
+ id: 'post-write-diagnostics-artifact',
390
160
  passed: omittedHard === 0,
391
161
  message: `Complete post-write diagnostics are stored at ${artifactLink.uri}`,
392
162
  });
@@ -397,10 +167,10 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
397
167
  ...retainedHard,
398
168
  ...retainedSoft,
399
169
  {
400
- code: 'POST_VALIDATION_DIAGNOSTICS_IN_RESOURCE',
170
+ code: 'POST_VALIDATION_DIAGNOSTICS_IN_ARTIFACT',
401
171
  severity: omittedHard > 0 ? 'blocker' : 'warning',
402
- category: 'transaction',
403
- message: `Complete post-write validation contains ${diagnostics.length} diagnostics and is stored as an MCP resource`,
172
+ category: 'validation',
173
+ message: `Complete post-write validation contains ${diagnostics.length} diagnostics and is stored as an artifact`,
404
174
  details: {
405
175
  total: diagnostics.length,
406
176
  returned: availableDiagnostics,
@@ -411,485 +181,8 @@ async function postValidateTransaction(engine, transaction, principal, signal) {
411
181
  },
412
182
  ],
413
183
  checks,
184
+ artifacts: [artifactLink],
414
185
  };
415
186
  }
416
- return { diagnostics, checks };
417
- }
418
- export function registerBaseTools(server, engine, context) {
419
- server.registerTool('hoi4.project_register', {
420
- title: 'Register HOI4 workspace',
421
- description: 'Register one server-side workspace under a configured registration root; does not edit MCP clients.',
422
- inputSchema: workspaceRegistrationSchema,
423
- outputSchema: projectRegisterOutputSchema,
424
- annotations: {
425
- readOnlyHint: false,
426
- destructiveHint: false,
427
- idempotentHint: false,
428
- openWorldHint: false,
429
- },
430
- }, async (registration, extra) => {
431
- try {
432
- requireServerScope(context, 'hoi4:write');
433
- const progress = progressReporter(extra);
434
- progress.signal.throwIfAborted();
435
- const status = await engine.register(registration, context.principal, progress.signal);
436
- const result = emptyServiceResult(status.id, { workspace: compactWorkspaceStatus(status) });
437
- result.code = 'WORKSPACE_REGISTERED';
438
- return toolResult(result);
439
- }
440
- catch (error) {
441
- return errorResult(error, registration.id);
442
- }
443
- });
444
- server.registerTool('hoi4.project_status', {
445
- title: 'Inspect HOI4 workspace status',
446
- description: 'Return registered workspace capabilities without exposing canonical server paths.',
447
- inputSchema: z
448
- .object({
449
- workspaceId: z.string().min(1).max(64).optional(),
450
- cursor: z.string().min(1).max(4096).optional(),
451
- })
452
- .strict()
453
- .superRefine((value, issue) => {
454
- if (value.workspaceId !== undefined && value.cursor !== undefined) {
455
- issue.addIssue({
456
- code: 'custom',
457
- message: 'cursor is only valid when listing all authorized workspaces',
458
- path: ['cursor'],
459
- });
460
- }
461
- }),
462
- outputSchema: projectStatusOutputSchema,
463
- annotations: readOnly,
464
- }, ({ workspaceId, cursor }) => {
465
- try {
466
- const statuses = workspaceId === undefined
467
- ? engine
468
- .list(context.principal)
469
- .sort((left, right) => compareCodeUnits(left.id, right.id))
470
- : [engine.status(workspaceId, context.principal)];
471
- const revision = sha256Bytes(Buffer.from(canonicalJson(statuses.map(({ id }) => id)), 'utf8'));
472
- let offset = 0;
473
- if (cursor !== undefined) {
474
- const decoded = decodeWorkspaceCursor(cursor);
475
- const afterIndex = statuses.findIndex(({ id }) => id === decoded.after);
476
- if (decoded.revision !== revision || afterIndex < 0) {
477
- throw new ServiceError('WORKSPACE_CURSOR_STALE', 'Workspace inventory changed; restart pagination without a cursor');
478
- }
479
- offset = afterIndex + 1;
480
- }
481
- const page = statuses.slice(offset, offset + 1);
482
- const last = page.at(-1);
483
- const nextCursor = offset + page.length < statuses.length && last !== undefined
484
- ? encodeWorkspaceCursor(revision, last.id)
485
- : undefined;
486
- const result = emptyServiceResult(workspaceId ?? '', {
487
- count: statuses.length,
488
- returned: page.length,
489
- workspaces: page.map(compactWorkspaceStatus),
490
- ...(nextCursor === undefined ? {} : { nextCursor }),
491
- });
492
- result.code = 'WORKSPACE_STATUS';
493
- return toolResult(result);
494
- }
495
- catch (error) {
496
- return errorResult(error, workspaceId ?? '');
497
- }
498
- });
499
- server.registerTool('hoi4.project_scan', {
500
- title: 'Scan HOI4 workspace',
501
- description: 'Build the shared source/index snapshot across game, dependencies, and mod load order.',
502
- inputSchema: workspaceInput
503
- .extend({
504
- maxFiles: z.number().int().min(1).max(1_000_000).optional(),
505
- maxBytes: z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
506
- })
507
- .strict(),
508
- outputSchema: projectScanOutputSchema,
509
- annotations: artifactProducing,
510
- }, async ({ workspaceId, maxFiles, maxBytes }, extra) => {
511
- try {
512
- const progress = progressReporter(extra);
513
- await progress.report(0, 3, 'Resolving workspace');
514
- const snapshot = await engine.scan(workspaceId, {
515
- ...(maxFiles === undefined ? {} : { maxFiles }),
516
- ...(maxBytes === undefined ? {} : { maxBytes }),
517
- }, context.principal, progress.signal);
518
- await progress.report(2, 3, 'Writing diagnostics artifact');
519
- const workspace = engine.resolver.get(workspaceId, context.principal);
520
- const sourceEvidence = boundedSourceHashEvidence(Object.fromEntries(snapshot.files.map(({ displayPath, sha256 }) => [displayPath, sha256])));
521
- const diagnosticsArtifact = await engine.artifacts.putChunked(workspace, 'diagnostics.json', 'application/json', `${canonicalJson({
522
- revision: snapshot.revision,
523
- complete: snapshot.complete,
524
- skippedSourceCount: snapshot.skippedSourceCount,
525
- skippedSources: snapshot.skippedSources,
526
- files: snapshot.files.map(({ displayPath, sha256 }) => ({ displayPath, sha256 })),
527
- diagnostics: snapshot.diagnostics,
528
- })}\n`, {
529
- kind: 'diagnostics',
530
- toolVersion: PACKAGE_VERSION,
531
- schemaVersion: 'diagnostics.v1',
532
- sourceHashes: sourceEvidence.sourceHashes,
533
- metadata: { sourceHashInventory: sourceEvidence.inventory },
534
- }, 'Source-linked diagnostics and bounded shared-index completeness report', progress.signal);
535
- const result = emptyServiceResult(workspaceId, {
536
- revision: snapshot.revision,
537
- complete: snapshot.complete,
538
- skippedSourceCount: snapshot.skippedSourceCount,
539
- skippedSources: snapshot.skippedSources,
540
- symbols: snapshot.index.symbols.length,
541
- references: snapshot.index.references.length,
542
- unresolvedReferences: snapshot.index.unresolvedReferences().length,
543
- symbolCounts: Object.fromEntries([...new Set(snapshot.index.symbols.map(({ kind }) => kind))]
544
- .sort((a, b) => compareCodeUnits(a, b))
545
- .map((kind) => [
546
- kind,
547
- snapshot.index.symbols.filter((symbol) => symbol.kind === kind).length,
548
- ])),
549
- });
550
- result.code = snapshot.complete ? 'WORKSPACE_SCANNED' : 'WORKSPACE_SCANNED_PARTIAL';
551
- setInlineFilesScanned(result, snapshot.files.map(({ displayPath }) => displayPath));
552
- result.diagnostics = snapshot.diagnostics.slice(0, 100);
553
- result.artifacts = [publicArtifactLink(diagnosticsArtifact)];
554
- result.validation = {
555
- passed: !snapshot.diagnostics.some(({ severity }) => severity === 'error' || severity === 'blocker'),
556
- checks: [
557
- {
558
- id: 'shared-index',
559
- passed: true,
560
- message: snapshot.complete
561
- ? `${snapshot.index.symbols.length} symbols indexed from a complete inventory`
562
- : `${snapshot.index.symbols.length} symbols indexed from an incomplete inventory; ${snapshot.skippedSourceCount} over-limit source(s) were recorded and aggregate index ceilings may also apply`,
563
- },
564
- ],
565
- };
566
- await progress.report(3, 3, 'Scan complete');
567
- return toolResult(result);
568
- }
569
- catch (error) {
570
- return errorResult(error, workspaceId);
571
- }
572
- });
573
- server.registerTool('hoi4.transaction_status', {
574
- title: 'Inspect transaction',
575
- description: 'Return compact dry-run/apply/rollback counts and current state with a complete manifest resource.',
576
- inputSchema: workspaceInput.extend({ transactionId: transactionIdSchema }).strict(),
577
- outputSchema: transactionStatusOutputSchema,
578
- annotations: readOnly,
579
- }, async ({ workspaceId, transactionId }, extra) => {
580
- try {
581
- const progress = progressReporter(extra);
582
- progress.signal.throwIfAborted();
583
- const manifest = await engine.transactions.status(workspaceId, transactionId, context.principal, progress.signal);
584
- progress.signal.throwIfAborted();
585
- const result = emptyServiceResult(workspaceId, { manifest: transactionSummary(manifest) });
586
- result.code = 'TRANSACTION_STATUS';
587
- result.transactionId = manifest.transactionId;
588
- result.planHash = manifest.planHash;
589
- result.proposedFiles = manifest.files.slice(0, 100).map(({ relativePath }) => relativePath);
590
- result.changedFiles = manifest.appliedFiles.slice(0, 100);
591
- result.artifacts = [transactionResourceLink(manifest)];
592
- result.validation = manifest.validation;
593
- result.rollbackStatus = manifest.rollbackStatus;
594
- return toolResult(result);
595
- }
596
- catch (error) {
597
- return errorResult(error, workspaceId);
598
- }
599
- });
600
- server.registerTool('hoi4.transaction_diff', {
601
- title: 'Review transaction diff',
602
- description: 'Page through the complete affected-file set, operation summaries, and source/binary artifact links before apply.',
603
- inputSchema: workspaceInput
604
- .extend({
605
- transactionId: transactionIdSchema,
606
- limit: z.number().int().min(1).max(20).default(20),
607
- cursor: z.string().min(1).max(4096).optional(),
608
- })
609
- .strict(),
610
- outputSchema: transactionDiffOutputSchema,
611
- annotations: readOnly,
612
- }, async ({ workspaceId, transactionId, limit, cursor }, extra) => {
613
- try {
614
- const progress = progressReporter(extra);
615
- progress.signal.throwIfAborted();
616
- const manifest = await engine.transactions.status(workspaceId, transactionId, context.principal, progress.signal);
617
- progress.signal.throwIfAborted();
618
- let fileOffset = 0;
619
- let operationOffset = 0;
620
- let artifactOffset = 0;
621
- if (cursor !== undefined) {
622
- const decoded = decodeTransactionDiffCursor(cursor);
623
- if (decoded.planHash !== manifest.planHash ||
624
- decoded.fileOffset > manifest.files.length ||
625
- decoded.operationOffset > manifest.operations.length ||
626
- decoded.artifactOffset > manifest.artifacts.length) {
627
- throw new ServiceError('TRANSACTION_CURSOR_STALE', 'Transaction plan changed or the diff cursor is stale');
628
- }
629
- fileOffset = decoded.fileOffset;
630
- operationOffset = decoded.operationOffset;
631
- artifactOffset = decoded.artifactOffset;
632
- }
633
- const manifestFiles = manifest.files.slice(fileOffset, fileOffset + limit);
634
- const files = manifestFiles.map(({ relativePath, operationIds, beforeSha256, afterSha256, beforeSize, afterSize, mediaType, diffArtifact, }) => ({
635
- relativePath,
636
- operationIdCount: operationIds.length,
637
- operationIds: operationIds.slice(0, 20),
638
- beforeSha256,
639
- afterSha256,
640
- beforeSize,
641
- afterSize,
642
- mediaType,
643
- ...(diffArtifact === undefined ? {} : { diffArtifact }),
644
- }));
645
- const operations = manifest.operations.slice(operationOffset, operationOffset + limit);
646
- const artifacts = manifest.artifacts.slice(artifactOffset, artifactOffset + limit);
647
- const nextFileOffset = fileOffset + manifestFiles.length;
648
- const nextOperationOffset = operationOffset + operations.length;
649
- const nextArtifactOffset = artifactOffset + artifacts.length;
650
- const nextCursor = nextFileOffset < manifest.files.length ||
651
- nextOperationOffset < manifest.operations.length ||
652
- nextArtifactOffset < manifest.artifacts.length
653
- ? encodeTransactionDiffCursor(manifest.planHash, nextFileOffset, nextOperationOffset, nextArtifactOffset)
654
- : undefined;
655
- const result = emptyServiceResult(workspaceId, {
656
- files,
657
- operations: operations.map(({ id, kind, summary }) => ({ id, kind, summary })),
658
- fileCount: manifest.files.length,
659
- operationCount: manifest.operations.length,
660
- artifactCount: manifest.artifacts.length,
661
- returnedFiles: files.length,
662
- returnedOperations: operations.length,
663
- returnedArtifacts: artifacts.length,
664
- ...(nextCursor === undefined ? {} : { nextCursor }),
665
- expiresAt: manifest.expiresAt,
666
- });
667
- result.code = 'TRANSACTION_DIFF';
668
- result.transactionId = manifest.transactionId;
669
- result.planHash = manifest.planHash;
670
- result.proposedFiles = files.map(({ relativePath }) => relativePath);
671
- result.artifacts = [transactionResourceLink(manifest), ...artifacts];
672
- result.validation = manifest.validation;
673
- result.rollbackStatus = manifest.rollbackStatus;
674
- return toolResult(result);
675
- }
676
- catch (error) {
677
- return errorResult(error, workspaceId);
678
- }
679
- });
680
- server.registerTool('hoi4.transaction_apply', {
681
- title: 'Apply reviewed transaction',
682
- description: 'Apply a completed dry run only when transaction ID, workspace, principal, source hashes, and expected plan hash still match.',
683
- inputSchema: transactionInput,
684
- outputSchema: transactionMutationOutputSchema,
685
- annotations: {
686
- readOnlyHint: false,
687
- destructiveHint: true,
688
- idempotentHint: false,
689
- openWorldHint: false,
690
- },
691
- }, async ({ workspaceId, transactionId, expectedPlanHash }, extra) => {
692
- try {
693
- requireServerScope(context, 'hoi4:write');
694
- const progress = progressReporter(extra);
695
- await progress.report(0, 3, 'Checking transaction preconditions');
696
- const manifest = await engine.transactions.apply(workspaceId, transactionId, expectedPlanHash, {
697
- ...(context.principal === undefined ? {} : { principal: context.principal }),
698
- signal: progress.signal,
699
- postValidate: (transaction, signal) => postValidateTransaction(engine, transaction, context.principal, signal),
700
- });
701
- engine.invalidate(workspaceId);
702
- await engine.scan(workspaceId, {}, context.principal, progress.signal);
703
- await progress.report(3, 3, 'Apply and index rebuild complete');
704
- const result = emptyServiceResult(workspaceId, {
705
- state: manifest.state,
706
- fileCount: manifest.files.length,
707
- appliedFileCount: manifest.appliedFiles.length,
708
- artifactCount: manifest.artifacts.length,
709
- });
710
- result.code = 'TRANSACTION_APPLIED';
711
- result.transactionId = manifest.transactionId;
712
- result.planHash = manifest.planHash;
713
- result.proposedFiles = manifest.files.slice(0, 100).map(({ relativePath }) => relativePath);
714
- result.changedFiles = manifest.appliedFiles.slice(0, 100);
715
- result.artifacts = [transactionResourceLink(manifest)];
716
- result.validation = manifest.validation;
717
- result.rollbackStatus = manifest.rollbackStatus;
718
- return toolResult(result);
719
- }
720
- catch (error) {
721
- engine.invalidate(workspaceId);
722
- try {
723
- const failed = await engine.transactions.status(workspaceId, transactionId, context.principal);
724
- return errorResult(error, workspaceId, {
725
- transactionId: failed.transactionId,
726
- planHash: failed.planHash,
727
- proposedFiles: failed.files.slice(0, 100).map(({ relativePath }) => relativePath),
728
- changedFiles: failed.state === 'applied' ? failed.appliedFiles.slice(0, 100) : [],
729
- artifacts: [transactionResourceLink(failed)],
730
- validation: failed.validation,
731
- rollbackStatus: failed.rollbackStatus,
732
- data: { state: failed.state, failure: failed.failure ?? null },
733
- });
734
- }
735
- catch {
736
- // A forged or cross-workspace transaction ID intentionally reveals no manifest details.
737
- }
738
- return errorResult(error, workspaceId);
739
- }
740
- });
741
- server.registerTool('hoi4.transaction_rollback', {
742
- title: 'Roll back applied transaction',
743
- description: 'Restore exact original bytes when the applied result still matches rollback preconditions.',
744
- inputSchema: transactionInput,
745
- outputSchema: transactionMutationOutputSchema,
746
- annotations: {
747
- readOnlyHint: false,
748
- destructiveHint: true,
749
- idempotentHint: false,
750
- openWorldHint: false,
751
- },
752
- }, async ({ workspaceId, transactionId, expectedPlanHash }, extra) => {
753
- try {
754
- requireServerScope(context, 'hoi4:write');
755
- const progress = progressReporter(extra);
756
- await progress.report(0, 2, 'Checking rollback preconditions');
757
- progress.signal.throwIfAborted();
758
- const manifest = await engine.transactions.rollback(workspaceId, transactionId, expectedPlanHash, context.principal, progress.signal);
759
- engine.invalidate(workspaceId);
760
- const result = emptyServiceResult(workspaceId, {
761
- state: manifest.state,
762
- fileCount: manifest.files.length,
763
- appliedFileCount: manifest.appliedFiles.length,
764
- artifactCount: manifest.artifacts.length,
765
- });
766
- result.code = 'TRANSACTION_ROLLED_BACK';
767
- result.transactionId = manifest.transactionId;
768
- result.planHash = manifest.planHash;
769
- result.changedFiles = manifest.files.slice(0, 100).map(({ relativePath }) => relativePath);
770
- result.artifacts = [transactionResourceLink(manifest)];
771
- result.validation = manifest.validation;
772
- result.rollbackStatus = manifest.rollbackStatus;
773
- await progress.report(2, 2, 'Atomic rollback complete');
774
- return toolResult(result);
775
- }
776
- catch (error) {
777
- try {
778
- const failed = await engine.transactions.status(workspaceId, transactionId, context.principal);
779
- return errorResult(error, workspaceId, {
780
- transactionId: failed.transactionId,
781
- planHash: failed.planHash,
782
- proposedFiles: failed.files.slice(0, 100).map(({ relativePath }) => relativePath),
783
- changedFiles: failed.state === 'applied' ? failed.appliedFiles.slice(0, 100) : [],
784
- artifacts: [transactionResourceLink(failed)],
785
- validation: failed.validation,
786
- rollbackStatus: failed.rollbackStatus,
787
- data: { state: failed.state, failure: failed.failure ?? null },
788
- });
789
- }
790
- catch {
791
- // Invalid or inaccessible transaction IDs intentionally reveal no manifest details.
792
- }
793
- return errorResult(error, workspaceId);
794
- }
795
- });
796
- server.registerTool('hoi4.artifact_list', {
797
- title: 'List workspace artifacts',
798
- description: 'List content-addressed artifacts without exposing filesystem paths.',
799
- inputSchema: workspaceInput
800
- .extend({
801
- limit: z.number().int().min(1).max(100).default(100),
802
- cursor: z.string().min(1).max(4096).optional(),
803
- })
804
- .strict(),
805
- outputSchema: artifactListOutputSchema,
806
- annotations: readOnly,
807
- }, async ({ workspaceId, limit, cursor }, extra) => {
808
- try {
809
- const progress = progressReporter(extra);
810
- progress.signal.throwIfAborted();
811
- const workspace = engine.resolver.get(workspaceId, context.principal);
812
- const decoded = cursor === undefined ? undefined : decodeArtifactCursor(cursor);
813
- const listing = await engine.artifacts.listPage(workspace, {
814
- limit,
815
- ...(decoded === undefined ? {} : { afterUri: decoded.after }),
816
- }, progress.signal);
817
- progress.signal.throwIfAborted();
818
- if (decoded !== undefined &&
819
- (decoded.revision !== listing.revision || !listing.afterFound)) {
820
- throw new ServiceError('ARTIFACT_CURSOR_STALE', 'Artifact inventory changed; restart pagination without a cursor');
821
- }
822
- const last = listing.artifacts.at(-1);
823
- const nextCursor = listing.hasMore && last !== undefined
824
- ? encodeArtifactCursor(listing.revision, last.uri)
825
- : undefined;
826
- const result = emptyServiceResult(workspaceId, {
827
- count: listing.total,
828
- returned: listing.artifacts.length,
829
- ...(nextCursor === undefined ? {} : { nextCursor }),
830
- });
831
- result.code = 'ARTIFACT_LIST';
832
- result.artifacts = listing.artifacts;
833
- return toolResult(result);
834
- }
835
- catch (error) {
836
- return errorResult(error, workspaceId);
837
- }
838
- });
839
- server.registerTool('hoi4.artifact_describe', {
840
- title: 'Describe workspace artifact',
841
- description: 'Return artifact integrity and provenance metadata for an authorized workspace.',
842
- inputSchema: workspaceInput.extend({ uri: z.url().max(4096) }).strict(),
843
- outputSchema: artifactDescribeOutputSchema,
844
- annotations: readOnly,
845
- }, async ({ workspaceId, uri }, extra) => {
846
- try {
847
- const progress = progressReporter(extra);
848
- progress.signal.throwIfAborted();
849
- const workspace = engine.resolver.get(workspaceId, context.principal);
850
- const artifact = await engine.artifacts.describe(workspace, uri, progress.signal);
851
- progress.signal.throwIfAborted();
852
- const sourceHashes = Object.entries(artifact.provenance.sourceHashes).sort(([left], [right]) => compareCodeUnits(left, right));
853
- const description = {
854
- uri: artifact.uri,
855
- name: artifact.name,
856
- mimeType: artifact.mimeType,
857
- size: artifact.size,
858
- sha256: artifact.sha256,
859
- provenanceHash: artifact.provenanceHash,
860
- ...(artifact.description === undefined
861
- ? {}
862
- : { description: artifact.description.slice(0, 1_024) }),
863
- descriptionTruncated: (artifact.description?.length ?? 0) > 1_024,
864
- provenance: {
865
- kind: artifact.provenance.kind,
866
- toolVersion: artifact.provenance.toolVersion,
867
- schemaVersion: artifact.provenance.schemaVersion,
868
- sourceHashCount: sourceHashes.length,
869
- sourceHashes: sourceHashes.slice(0, 100).map(([path, sha256]) => ({ path, sha256 })),
870
- sourceHashesTruncated: sourceHashes.length > 100,
871
- hasRenderProfile: artifact.provenance.renderProfile !== undefined,
872
- hasMetadata: artifact.provenance.metadata !== undefined,
873
- },
874
- };
875
- const manifestUri = new URL(artifact.uri);
876
- manifestUri.searchParams.set('metadata', 'manifest');
877
- const result = emptyServiceResult(workspaceId, { artifact: description });
878
- result.code = 'ARTIFACT_DESCRIBE';
879
- result.artifacts = [
880
- publicArtifactLink(artifact),
881
- {
882
- uri: manifestUri.href,
883
- name: `${artifact.name}.manifest.json`,
884
- mimeType: 'application/json',
885
- description: 'Complete public provenance manifest for this artifact',
886
- },
887
- ];
888
- return toolResult(result);
889
- }
890
- catch (error) {
891
- return errorResult(error, workspaceId);
892
- }
893
- });
187
+ return { diagnostics, checks, artifacts: [] };
894
188
  }
895
- //# sourceMappingURL=base-tools.js.map