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

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