wingfoil 0.2.2 → 0.3.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 (454) hide show
  1. package/README.md +83 -43
  2. package/dist/agent/discovery.d.ts +72 -0
  3. package/dist/agent/discovery.d.ts.map +1 -0
  4. package/dist/agent/discovery.js +210 -0
  5. package/dist/agent/discovery.js.map +1 -0
  6. package/dist/agent/execute.d.ts +206 -0
  7. package/dist/agent/execute.d.ts.map +1 -0
  8. package/dist/agent/execute.js +581 -0
  9. package/dist/agent/execute.js.map +1 -0
  10. package/dist/agent/index.d.ts +23 -0
  11. package/dist/agent/index.d.ts.map +1 -0
  12. package/dist/agent/index.js +85 -0
  13. package/dist/agent/index.js.map +1 -0
  14. package/dist/agent/launch.d.ts +133 -0
  15. package/dist/agent/launch.d.ts.map +1 -0
  16. package/dist/agent/launch.js +380 -0
  17. package/dist/agent/launch.js.map +1 -0
  18. package/dist/agent/manifest.d.ts +30 -0
  19. package/dist/agent/manifest.d.ts.map +1 -0
  20. package/dist/agent/manifest.js +93 -0
  21. package/dist/agent/manifest.js.map +1 -0
  22. package/dist/agent/placeholders.d.ts +49 -0
  23. package/dist/agent/placeholders.d.ts.map +1 -0
  24. package/dist/agent/placeholders.js +177 -0
  25. package/dist/agent/placeholders.js.map +1 -0
  26. package/dist/agent/run-log.d.ts +254 -0
  27. package/dist/agent/run-log.d.ts.map +1 -0
  28. package/dist/agent/run-log.js +612 -0
  29. package/dist/agent/run-log.js.map +1 -0
  30. package/dist/agent/schema.d.ts +100 -0
  31. package/dist/agent/schema.d.ts.map +1 -0
  32. package/dist/agent/schema.js +89 -0
  33. package/dist/agent/schema.js.map +1 -0
  34. package/dist/agent/step.d.ts +41 -0
  35. package/dist/agent/step.d.ts.map +1 -0
  36. package/dist/agent/step.js +95 -0
  37. package/dist/agent/step.js.map +1 -0
  38. package/dist/build-info.json +4 -0
  39. package/dist/cli/error.d.ts +11 -2
  40. package/dist/cli/error.d.ts.map +1 -1
  41. package/dist/cli/error.js +27 -6
  42. package/dist/cli/error.js.map +1 -1
  43. package/dist/cli/exit.d.ts +33 -3
  44. package/dist/cli/exit.d.ts.map +1 -1
  45. package/dist/cli/exit.js +54 -3
  46. package/dist/cli/exit.js.map +1 -1
  47. package/dist/cli/index.d.ts +1 -1
  48. package/dist/cli/index.d.ts.map +1 -1
  49. package/dist/cli/index.js +2 -1
  50. package/dist/cli/index.js.map +1 -1
  51. package/dist/cli/init-command.d.ts.map +1 -1
  52. package/dist/cli/init-command.js +4 -2
  53. package/dist/cli/init-command.js.map +1 -1
  54. package/dist/cli/mcp-command.d.ts +13 -4
  55. package/dist/cli/mcp-command.d.ts.map +1 -1
  56. package/dist/cli/mcp-command.js +25 -8
  57. package/dist/cli/mcp-command.js.map +1 -1
  58. package/dist/cli/output.d.ts +12 -4
  59. package/dist/cli/output.d.ts.map +1 -1
  60. package/dist/cli/output.js +15 -4
  61. package/dist/cli/output.js.map +1 -1
  62. package/dist/cli/program.d.ts +1 -1
  63. package/dist/cli/program.d.ts.map +1 -1
  64. package/dist/cli/program.js +162 -40
  65. package/dist/cli/program.js.map +1 -1
  66. package/dist/cli/registrar.d.ts +1 -1
  67. package/dist/cli/registrar.d.ts.map +1 -1
  68. package/dist/cli/registrar.js +67 -6
  69. package/dist/cli/registrar.js.map +1 -1
  70. package/dist/cli/suggest.d.ts +20 -0
  71. package/dist/cli/suggest.d.ts.map +1 -0
  72. package/dist/cli/suggest.js +49 -0
  73. package/dist/cli/suggest.js.map +1 -0
  74. package/dist/cli/warning.d.ts +26 -0
  75. package/dist/cli/warning.d.ts.map +1 -0
  76. package/dist/cli/warning.js +66 -0
  77. package/dist/cli/warning.js.map +1 -0
  78. package/dist/cli.js +11 -2
  79. package/dist/cli.js.map +1 -1
  80. package/dist/core/agent-execute.d.ts +44 -0
  81. package/dist/core/agent-execute.d.ts.map +1 -0
  82. package/dist/core/agent-execute.js +71 -0
  83. package/dist/core/agent-execute.js.map +1 -0
  84. package/dist/core/agent-list.d.ts +95 -0
  85. package/dist/core/agent-list.d.ts.map +1 -0
  86. package/dist/core/agent-list.js +207 -0
  87. package/dist/core/agent-list.js.map +1 -0
  88. package/dist/core/agent-show.d.ts +44 -0
  89. package/dist/core/agent-show.d.ts.map +1 -0
  90. package/dist/core/agent-show.js +188 -0
  91. package/dist/core/agent-show.js.map +1 -0
  92. package/dist/core/approval-authority.d.ts +17 -14
  93. package/dist/core/approval-authority.d.ts.map +1 -1
  94. package/dist/core/approval-authority.js +9 -9
  95. package/dist/core/approval-authority.js.map +1 -1
  96. package/dist/core/builtin-asset.d.ts +18 -15
  97. package/dist/core/builtin-asset.d.ts.map +1 -1
  98. package/dist/core/builtin-asset.js +17 -14
  99. package/dist/core/builtin-asset.js.map +1 -1
  100. package/dist/core/builtin-integrity.d.ts +12 -2
  101. package/dist/core/builtin-integrity.d.ts.map +1 -1
  102. package/dist/core/builtin-integrity.js +85 -9
  103. package/dist/core/builtin-integrity.js.map +1 -1
  104. package/dist/core/confinement.d.ts +3 -1
  105. package/dist/core/confinement.d.ts.map +1 -1
  106. package/dist/core/confinement.js +7 -4
  107. package/dist/core/confinement.js.map +1 -1
  108. package/dist/core/context.d.ts +150 -98
  109. package/dist/core/context.d.ts.map +1 -1
  110. package/dist/core/context.js +602 -66
  111. package/dist/core/context.js.map +1 -1
  112. package/dist/core/directive-assign.d.ts +33 -7
  113. package/dist/core/directive-assign.d.ts.map +1 -1
  114. package/dist/core/directive-assign.js +67 -27
  115. package/dist/core/directive-assign.js.map +1 -1
  116. package/dist/core/directive-scope.d.ts +36 -0
  117. package/dist/core/directive-scope.d.ts.map +1 -0
  118. package/dist/core/directive-scope.js +34 -0
  119. package/dist/core/directive-scope.js.map +1 -0
  120. package/dist/core/directives-list.d.ts +13 -3
  121. package/dist/core/directives-list.d.ts.map +1 -1
  122. package/dist/core/directives-list.js +18 -6
  123. package/dist/core/directives-list.js.map +1 -1
  124. package/dist/core/dry-run.d.ts +33 -0
  125. package/dist/core/dry-run.d.ts.map +1 -0
  126. package/dist/core/dry-run.js +45 -0
  127. package/dist/core/dry-run.js.map +1 -0
  128. package/dist/core/element-ref.d.ts +23 -0
  129. package/dist/core/element-ref.d.ts.map +1 -0
  130. package/dist/core/element-ref.js +24 -0
  131. package/dist/core/element-ref.js.map +1 -0
  132. package/dist/core/error-details.d.ts +20 -0
  133. package/dist/core/error-details.d.ts.map +1 -0
  134. package/dist/core/error-details.js +65 -0
  135. package/dist/core/error-details.js.map +1 -0
  136. package/dist/core/exit-code.d.ts.map +1 -1
  137. package/dist/core/exit-code.js +6 -7
  138. package/dist/core/exit-code.js.map +1 -1
  139. package/dist/core/git-identity.d.ts +46 -11
  140. package/dist/core/git-identity.d.ts.map +1 -1
  141. package/dist/core/git-identity.js +140 -27
  142. package/dist/core/git-identity.js.map +1 -1
  143. package/dist/core/index.d.ts +184 -10
  144. package/dist/core/index.d.ts.map +1 -1
  145. package/dist/core/index.js +1045 -185
  146. package/dist/core/index.js.map +1 -1
  147. package/dist/core/init.d.ts +45 -5
  148. package/dist/core/init.d.ts.map +1 -1
  149. package/dist/core/init.js +134 -24
  150. package/dist/core/init.js.map +1 -1
  151. package/dist/core/loaders.d.ts +170 -14
  152. package/dist/core/loaders.d.ts.map +1 -1
  153. package/dist/core/loaders.js +570 -89
  154. package/dist/core/loaders.js.map +1 -1
  155. package/dist/core/memory-add-link.d.ts +28 -0
  156. package/dist/core/memory-add-link.d.ts.map +1 -0
  157. package/dist/core/memory-add-link.js +67 -0
  158. package/dist/core/memory-add-link.js.map +1 -0
  159. package/dist/core/memory-add-type.d.ts +25 -1
  160. package/dist/core/memory-add-type.d.ts.map +1 -1
  161. package/dist/core/memory-add-type.js +59 -1
  162. package/dist/core/memory-add-type.js.map +1 -1
  163. package/dist/core/memory-amend.d.ts +80 -0
  164. package/dist/core/memory-amend.d.ts.map +1 -0
  165. package/dist/core/memory-amend.js +160 -0
  166. package/dist/core/memory-amend.js.map +1 -0
  167. package/dist/core/memory-supersede.d.ts +28 -0
  168. package/dist/core/memory-supersede.d.ts.map +1 -0
  169. package/dist/core/memory-supersede.js +79 -0
  170. package/dist/core/memory-supersede.js.map +1 -0
  171. package/dist/core/memory-transition.d.ts +190 -30
  172. package/dist/core/memory-transition.d.ts.map +1 -1
  173. package/dist/core/memory-transition.js +480 -59
  174. package/dist/core/memory-transition.js.map +1 -1
  175. package/dist/core/registry.d.ts +82 -10
  176. package/dist/core/registry.d.ts.map +1 -1
  177. package/dist/core/registry.js +50 -0
  178. package/dist/core/registry.js.map +1 -1
  179. package/dist/core/relevance.d.ts +74 -12
  180. package/dist/core/relevance.d.ts.map +1 -1
  181. package/dist/core/relevance.js +45 -27
  182. package/dist/core/relevance.js.map +1 -1
  183. package/dist/core/require-reason.d.ts.map +1 -1
  184. package/dist/core/require-reason.js +6 -5
  185. package/dist/core/require-reason.js.map +1 -1
  186. package/dist/core/required-fields.d.ts +28 -0
  187. package/dist/core/required-fields.d.ts.map +1 -0
  188. package/dist/core/required-fields.js +60 -0
  189. package/dist/core/required-fields.js.map +1 -0
  190. package/dist/core/revision.d.ts +82 -0
  191. package/dist/core/revision.d.ts.map +1 -0
  192. package/dist/core/revision.js +144 -0
  193. package/dist/core/revision.js.map +1 -0
  194. package/dist/core/types.d.ts +28 -2
  195. package/dist/core/types.d.ts.map +1 -1
  196. package/dist/core/types.js +12 -3
  197. package/dist/core/types.js.map +1 -1
  198. package/dist/core/workflow-core-checks.d.ts +34 -0
  199. package/dist/core/workflow-core-checks.d.ts.map +1 -0
  200. package/dist/core/workflow-core-checks.js +403 -0
  201. package/dist/core/workflow-core-checks.js.map +1 -0
  202. package/dist/core/workflow-create-remove.d.ts +65 -0
  203. package/dist/core/workflow-create-remove.d.ts.map +1 -0
  204. package/dist/core/workflow-create-remove.js +277 -0
  205. package/dist/core/workflow-create-remove.js.map +1 -0
  206. package/dist/core/workflow-deduction.d.ts +48 -0
  207. package/dist/core/workflow-deduction.d.ts.map +1 -0
  208. package/dist/core/workflow-deduction.js +523 -0
  209. package/dist/core/workflow-deduction.js.map +1 -0
  210. package/dist/core/workflow-diagnostics.d.ts +83 -0
  211. package/dist/core/workflow-diagnostics.d.ts.map +1 -0
  212. package/dist/core/workflow-diagnostics.js +375 -0
  213. package/dist/core/workflow-diagnostics.js.map +1 -0
  214. package/dist/core/workflow-exit-state.d.ts +125 -0
  215. package/dist/core/workflow-exit-state.d.ts.map +1 -0
  216. package/dist/core/workflow-exit-state.js +243 -0
  217. package/dist/core/workflow-exit-state.js.map +1 -0
  218. package/dist/core/workflow-finalize.d.ts +37 -0
  219. package/dist/core/workflow-finalize.d.ts.map +1 -0
  220. package/dist/core/workflow-finalize.js +153 -0
  221. package/dist/core/workflow-finalize.js.map +1 -0
  222. package/dist/core/workflow-list-show.d.ts +176 -0
  223. package/dist/core/workflow-list-show.d.ts.map +1 -0
  224. package/dist/core/workflow-list-show.js +268 -0
  225. package/dist/core/workflow-list-show.js.map +1 -0
  226. package/dist/core/workflow-next.d.ts +268 -0
  227. package/dist/core/workflow-next.d.ts.map +1 -0
  228. package/dist/core/workflow-next.js +503 -0
  229. package/dist/core/workflow-next.js.map +1 -0
  230. package/dist/core/workflow-registry.d.ts +52 -0
  231. package/dist/core/workflow-registry.d.ts.map +1 -0
  232. package/dist/core/workflow-registry.js +158 -0
  233. package/dist/core/workflow-registry.js.map +1 -0
  234. package/dist/core/workflow-start-end.d.ts +71 -0
  235. package/dist/core/workflow-start-end.d.ts.map +1 -0
  236. package/dist/core/workflow-start-end.js +298 -0
  237. package/dist/core/workflow-start-end.js.map +1 -0
  238. package/dist/core/workflow-status.d.ts +83 -0
  239. package/dist/core/workflow-status.d.ts.map +1 -0
  240. package/dist/core/workflow-status.js +125 -0
  241. package/dist/core/workflow-status.js.map +1 -0
  242. package/dist/core/write-guard.d.ts +51 -8
  243. package/dist/core/write-guard.d.ts.map +1 -1
  244. package/dist/core/write-guard.js +139 -9
  245. package/dist/core/write-guard.js.map +1 -1
  246. package/dist/directives/index.d.ts +3 -2
  247. package/dist/directives/index.d.ts.map +1 -1
  248. package/dist/directives/index.js +5 -3
  249. package/dist/directives/index.js.map +1 -1
  250. package/dist/directives/schema.d.ts +34 -29
  251. package/dist/directives/schema.d.ts.map +1 -1
  252. package/dist/directives/schema.js +35 -29
  253. package/dist/directives/schema.js.map +1 -1
  254. package/dist/directives/version.d.ts +28 -0
  255. package/dist/directives/version.d.ts.map +1 -0
  256. package/dist/directives/version.js +51 -0
  257. package/dist/directives/version.js.map +1 -0
  258. package/dist/dna/edit.d.ts +7 -6
  259. package/dist/dna/edit.d.ts.map +1 -1
  260. package/dist/dna/edit.js +96 -41
  261. package/dist/dna/edit.js.map +1 -1
  262. package/dist/dna/mutate.js +18 -3
  263. package/dist/dna/mutate.js.map +1 -1
  264. package/dist/dna/path.d.ts +2 -2
  265. package/dist/dna/roles.d.ts +1 -1
  266. package/dist/dna/schema.d.ts +61 -3
  267. package/dist/dna/schema.d.ts.map +1 -1
  268. package/dist/dna/schema.js +121 -6
  269. package/dist/dna/schema.js.map +1 -1
  270. package/dist/mcp/dna-resource.d.ts.map +1 -1
  271. package/dist/mcp/dna-resource.js +4 -4
  272. package/dist/mcp/dna-resource.js.map +1 -1
  273. package/dist/mcp/index.d.ts +8 -4
  274. package/dist/mcp/index.d.ts.map +1 -1
  275. package/dist/mcp/index.js +13 -2
  276. package/dist/mcp/index.js.map +1 -1
  277. package/dist/mcp/memory-resource.d.ts.map +1 -1
  278. package/dist/mcp/memory-resource.js +30 -19
  279. package/dist/mcp/memory-resource.js.map +1 -1
  280. package/dist/mcp/prompt.d.ts +61 -24
  281. package/dist/mcp/prompt.d.ts.map +1 -1
  282. package/dist/mcp/prompt.js +176 -47
  283. package/dist/mcp/prompt.js.map +1 -1
  284. package/dist/mcp/read-only.d.ts +39 -0
  285. package/dist/mcp/read-only.d.ts.map +1 -1
  286. package/dist/mcp/read-only.js +61 -0
  287. package/dist/mcp/read-only.js.map +1 -1
  288. package/dist/mcp/registrar.d.ts +10 -0
  289. package/dist/mcp/registrar.d.ts.map +1 -1
  290. package/dist/mcp/registrar.js +48 -12
  291. package/dist/mcp/registrar.js.map +1 -1
  292. package/dist/mcp/server.d.ts +21 -14
  293. package/dist/mcp/server.d.ts.map +1 -1
  294. package/dist/mcp/server.js +41 -15
  295. package/dist/mcp/server.js.map +1 -1
  296. package/dist/mcp/session-resource.d.ts +13 -0
  297. package/dist/mcp/session-resource.d.ts.map +1 -0
  298. package/dist/mcp/session-resource.js +65 -0
  299. package/dist/mcp/session-resource.js.map +1 -0
  300. package/dist/mcp/workflow-resource.d.ts +18 -0
  301. package/dist/mcp/workflow-resource.d.ts.map +1 -1
  302. package/dist/mcp/workflow-resource.js +37 -8
  303. package/dist/mcp/workflow-resource.js.map +1 -1
  304. package/dist/memory/add.d.ts +110 -24
  305. package/dist/memory/add.d.ts.map +1 -1
  306. package/dist/memory/add.js +251 -64
  307. package/dist/memory/add.js.map +1 -1
  308. package/dist/memory/audit.d.ts +152 -39
  309. package/dist/memory/audit.d.ts.map +1 -1
  310. package/dist/memory/audit.js +257 -103
  311. package/dist/memory/audit.js.map +1 -1
  312. package/dist/memory/commit-message.d.ts +60 -38
  313. package/dist/memory/commit-message.d.ts.map +1 -1
  314. package/dist/memory/commit-message.js +167 -21
  315. package/dist/memory/commit-message.js.map +1 -1
  316. package/dist/memory/entry.d.ts.map +1 -1
  317. package/dist/memory/entry.js +1 -2
  318. package/dist/memory/entry.js.map +1 -1
  319. package/dist/memory/frontmatter-edit.d.ts +16 -4
  320. package/dist/memory/frontmatter-edit.d.ts.map +1 -1
  321. package/dist/memory/frontmatter-edit.js +13 -1
  322. package/dist/memory/frontmatter-edit.js.map +1 -1
  323. package/dist/memory/git-log.d.ts +18 -6
  324. package/dist/memory/git-log.d.ts.map +1 -1
  325. package/dist/memory/git-log.js +40 -13
  326. package/dist/memory/git-log.js.map +1 -1
  327. package/dist/memory/history.d.ts +73 -12
  328. package/dist/memory/history.d.ts.map +1 -1
  329. package/dist/memory/history.js +128 -44
  330. package/dist/memory/history.js.map +1 -1
  331. package/dist/memory/index.d.ts +13 -11
  332. package/dist/memory/index.d.ts.map +1 -1
  333. package/dist/memory/index.js +34 -3
  334. package/dist/memory/index.js.map +1 -1
  335. package/dist/memory/query.d.ts +161 -19
  336. package/dist/memory/query.d.ts.map +1 -1
  337. package/dist/memory/query.js +435 -55
  338. package/dist/memory/query.js.map +1 -1
  339. package/dist/memory/schema.d.ts +52 -3
  340. package/dist/memory/schema.d.ts.map +1 -1
  341. package/dist/memory/schema.js +132 -8
  342. package/dist/memory/schema.js.map +1 -1
  343. package/dist/memory/state-machine.d.ts +65 -10
  344. package/dist/memory/state-machine.d.ts.map +1 -1
  345. package/dist/memory/state-machine.js +134 -46
  346. package/dist/memory/state-machine.js.map +1 -1
  347. package/dist/memory/submit.d.ts +52 -3
  348. package/dist/memory/submit.d.ts.map +1 -1
  349. package/dist/memory/submit.js +118 -11
  350. package/dist/memory/submit.js.map +1 -1
  351. package/dist/storage/build-stamp.d.ts +18 -0
  352. package/dist/storage/build-stamp.d.ts.map +1 -0
  353. package/dist/storage/build-stamp.js +68 -0
  354. package/dist/storage/build-stamp.js.map +1 -0
  355. package/dist/storage/builtin-adapters.d.ts +32 -0
  356. package/dist/storage/builtin-adapters.d.ts.map +1 -0
  357. package/dist/storage/builtin-adapters.js +100 -0
  358. package/dist/storage/builtin-adapters.js.map +1 -0
  359. package/dist/storage/builtin-directives.d.ts +0 -29
  360. package/dist/storage/builtin-directives.d.ts.map +1 -1
  361. package/dist/storage/builtin-directives.js +9 -4
  362. package/dist/storage/builtin-directives.js.map +1 -1
  363. package/dist/storage/commit.d.ts +310 -3
  364. package/dist/storage/commit.d.ts.map +1 -1
  365. package/dist/storage/commit.js +807 -33
  366. package/dist/storage/commit.js.map +1 -1
  367. package/dist/storage/document.d.ts +6 -0
  368. package/dist/storage/document.d.ts.map +1 -1
  369. package/dist/storage/document.js +10 -1
  370. package/dist/storage/document.js.map +1 -1
  371. package/dist/storage/dry-run.d.ts +65 -0
  372. package/dist/storage/dry-run.d.ts.map +1 -0
  373. package/dist/storage/dry-run.js +150 -0
  374. package/dist/storage/dry-run.js.map +1 -0
  375. package/dist/storage/errors.d.ts +26 -0
  376. package/dist/storage/errors.d.ts.map +1 -1
  377. package/dist/storage/errors.js +27 -1
  378. package/dist/storage/errors.js.map +1 -1
  379. package/dist/storage/frontmatter.d.ts +1 -1
  380. package/dist/storage/frontmatter.js +1 -1
  381. package/dist/storage/git-read.d.ts +64 -0
  382. package/dist/storage/git-read.d.ts.map +1 -0
  383. package/dist/storage/git-read.js +107 -0
  384. package/dist/storage/git-read.js.map +1 -0
  385. package/dist/storage/index.d.ts +13 -5
  386. package/dist/storage/index.d.ts.map +1 -1
  387. package/dist/storage/index.js +39 -2
  388. package/dist/storage/index.js.map +1 -1
  389. package/dist/storage/layout.d.ts +2 -2
  390. package/dist/storage/layout.d.ts.map +1 -1
  391. package/dist/storage/layout.js +2 -7
  392. package/dist/storage/layout.js.map +1 -1
  393. package/dist/storage/memory-path.d.ts +18 -5
  394. package/dist/storage/memory-path.d.ts.map +1 -1
  395. package/dist/storage/memory-path.js +41 -5
  396. package/dist/storage/memory-path.js.map +1 -1
  397. package/dist/storage/snapshot.js +1 -1
  398. package/dist/storage/templates.d.ts +33 -6
  399. package/dist/storage/templates.d.ts.map +1 -1
  400. package/dist/storage/templates.js +170 -16
  401. package/dist/storage/templates.js.map +1 -1
  402. package/dist/validation/config-version.d.ts +19 -0
  403. package/dist/validation/config-version.d.ts.map +1 -0
  404. package/dist/validation/config-version.js +53 -0
  405. package/dist/validation/config-version.js.map +1 -0
  406. package/dist/validation/diagnostic.d.ts +40 -0
  407. package/dist/validation/diagnostic.d.ts.map +1 -0
  408. package/dist/validation/diagnostic.js +41 -0
  409. package/dist/validation/diagnostic.js.map +1 -0
  410. package/dist/validation/format.d.ts +74 -0
  411. package/dist/validation/format.d.ts.map +1 -0
  412. package/dist/validation/format.js +104 -0
  413. package/dist/validation/format.js.map +1 -0
  414. package/dist/validation/id.d.ts +14 -0
  415. package/dist/validation/id.d.ts.map +1 -1
  416. package/dist/validation/id.js +35 -11
  417. package/dist/validation/id.js.map +1 -1
  418. package/dist/validation/identity.d.ts +40 -0
  419. package/dist/validation/identity.d.ts.map +1 -0
  420. package/dist/validation/identity.js +78 -0
  421. package/dist/validation/identity.js.map +1 -0
  422. package/dist/validation/index.d.ts +9 -3
  423. package/dist/validation/index.d.ts.map +1 -1
  424. package/dist/validation/index.js +30 -1
  425. package/dist/validation/index.js.map +1 -1
  426. package/dist/validation/secret-scan.d.ts +3 -2
  427. package/dist/validation/secret-scan.d.ts.map +1 -1
  428. package/dist/validation/secret-scan.js +32 -11
  429. package/dist/validation/secret-scan.js.map +1 -1
  430. package/dist/validation/warning.d.ts +30 -16
  431. package/dist/validation/warning.d.ts.map +1 -1
  432. package/dist/validation/warning.js +74 -7
  433. package/dist/validation/warning.js.map +1 -1
  434. package/dist/workflow/bindings.d.ts +152 -0
  435. package/dist/workflow/bindings.d.ts.map +1 -0
  436. package/dist/workflow/bindings.js +249 -0
  437. package/dist/workflow/bindings.js.map +1 -0
  438. package/dist/workflow/create.d.ts +13 -0
  439. package/dist/workflow/create.d.ts.map +1 -0
  440. package/dist/workflow/create.js +41 -0
  441. package/dist/workflow/create.js.map +1 -0
  442. package/dist/workflow/deduce.d.ts +400 -0
  443. package/dist/workflow/deduce.d.ts.map +1 -0
  444. package/dist/workflow/deduce.js +1109 -0
  445. package/dist/workflow/deduce.js.map +1 -0
  446. package/dist/workflow/manifest-edit.d.ts +19 -0
  447. package/dist/workflow/manifest-edit.d.ts.map +1 -0
  448. package/dist/workflow/manifest-edit.js +124 -0
  449. package/dist/workflow/manifest-edit.js.map +1 -0
  450. package/dist/workflow/schema.d.ts +158 -19
  451. package/dist/workflow/schema.d.ts.map +1 -1
  452. package/dist/workflow/schema.js +163 -15
  453. package/dist/workflow/schema.js.map +1 -1
  454. package/package.json +18 -8
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deriveMcpToolName = deriveMcpToolName;
4
4
  exports.deriveMcpResourceUri = deriveMcpResourceUri;
5
5
  exports.registerCoreModules = registerCoreModules;
6
+ const error_details_1 = require("../core/error-details");
6
7
  const registry_1 = require("../core/registry");
8
+ const read_only_1 = require("./read-only");
7
9
  /**
8
10
  * `{module}.{verb}` — spec-004 §4.1's Tool naming convention (mechanical transform of the CLI verb).
9
11
  * An empty `verb` (`deriveVerb`'s flat/no-verb form, task-028-implement-paths-category) collapses to
@@ -27,14 +29,27 @@ function deriveMcpResourceUri(moduleName, verb) {
27
29
  * response (spec-004 §4.3's "rejected identically to the CLI path") or, for a Resource read (which
28
30
  * has no `isError` flag in the MCP protocol), a thrown error surfaced as a protocol-level read
29
31
  * failure (spec-004 §2.2's "resource not found"-style refusal, generalized to any read failure).
32
+ * Either way the error's operator-facing details (`../core/error-details.ts`) travel with it — as the
33
+ * read error's JSON-RPC `error.data.details`, or as the tool result's `structuredContent` (task-130).
34
+ * A successful Tool result carries the operation's `CoreResult.warnings`, when it has any, as
35
+ * `structuredContent: {value, warnings}` (task-169). A successful Resource read carries them as a
36
+ * top-level `warnings` array beside `contents` (task-195, `bug-231`: since task-171 a read-only scan does
37
+ * report the documents it left out). Note that the shipped
38
+ * `wingfoil mcp` server (`./server.ts`) does not call this function and registers no Tools (P5.2.3,
39
+ * v0.4), so the Tool warning field is reachable only where this registrar is used; when Tools ship,
40
+ * `directive.assign` and the four `dna` write Tools (task-193) also need `force` as a Tool input
41
+ * (`spec-004` §4.3).
30
42
  */
31
43
  function registerCoreModules(server, modules, options) {
32
- // Always advertise both channels (spec-004 §1: Resources and Tools are fixed channel types of
33
- // the MCP surface), even when `modules` currently has zero operations of one kind — as is the
34
- // case for the real production registry today (0 mutating ops; see task-006 Execution Notes).
35
- // Without this, a client's `tools/list` call on a server with zero registered Tools fails at the
36
- // protocol level ("Method not found") because the SDK only auto-declares a capability the first
37
- // time something is registered under it.
44
+ // Declare both channels (spec-004 §1: Resources and Tools are fixed channel types of the MCP
45
+ // surface), even when `modules` has zero operations of one kind. Declaring a capability installs no
46
+ // request handler, though: the SDK installs `tools/list` / `tools/call` on the first `registerTool`
47
+ // (and the Resources handlers on the first `registerResource`). So with zero `mutates: true`
48
+ // operations in the `modules` passed (as in the parity test's read-only fixtures), `initialize`
49
+ // advertises `tools` while `tools/list` still answers JSON-RPC -32601 "Method not found" (task-174
50
+ // corrected this comment, which claimed the opposite; `test/core/parity.test.ts` documents the same
51
+ // and skips the call). The production server does not use this registrar; it answers `tools/list`
52
+ // with an empty list itself (`./server.ts`, `bug-151`).
38
53
  server.server.registerCapabilities({ tools: {}, resources: {} });
39
54
  for (const { module, operation } of (0, registry_1.enumerateOperations)(modules)) {
40
55
  const verb = (0, registry_1.deriveVerb)(module.name, operation.name);
@@ -45,15 +60,32 @@ function registerCoreModules(server, modules, options) {
45
60
  root: options.resolveRoot(),
46
61
  });
47
62
  const result = await operation.fn(params);
48
- return result.ok ? { ok: true, text: JSON.stringify(result.value) } : { ok: false, message: result.error.message };
63
+ return result.ok
64
+ ? { ok: true, value: result.value, text: JSON.stringify(result.value), warnings: result.warnings ?? [] }
65
+ : { ok: false, message: result.error.message, details: (0, error_details_1.errorDetails)(result.error) };
49
66
  };
50
67
  if (operation.mutates) {
51
68
  const toolName = deriveMcpToolName(module.name, verb);
52
69
  server.registerTool(toolName, { description: `${module.name} ${verb} (mutating)` }, async () => {
53
70
  const outcome = await callCore();
54
- return outcome.ok
55
- ? { content: [{ type: 'text', text: outcome.text }] }
56
- : { content: [{ type: 'text', text: outcome.message }], isError: true };
71
+ if (outcome.ok) {
72
+ // The success-warning channel (task-169, `dl-062`): a Tool has no stderr, so the warnings ride
73
+ // as `structuredContent: {value, warnings}` — the success twin of the refusal's `{error,
74
+ // details}` below. The text stays the payload's JSON, so a client reading only `content` sees
75
+ // what it always saw. No warnings, no `structuredContent`.
76
+ return {
77
+ content: [{ type: 'text', text: outcome.text }],
78
+ ...(outcome.warnings.length > 0 ? { structuredContent: { value: outcome.value, warnings: outcome.warnings } } : {}),
79
+ };
80
+ }
81
+ // A tool error is a RESULT, not a JSON-RPC error, so it has no `error.data`: the details ride as
82
+ // `structuredContent`, in the CLI's `--format json` error shape (task-130, `dl-055` option 1).
83
+ // The text stays the bare reason, identical to the CLI's (spec-004 §4.3).
84
+ return {
85
+ content: [{ type: 'text', text: outcome.message }],
86
+ isError: true,
87
+ ...(outcome.details.length > 0 ? { structuredContent: { error: outcome.message, details: outcome.details } } : {}),
88
+ };
57
89
  });
58
90
  }
59
91
  else {
@@ -62,9 +94,13 @@ function registerCoreModules(server, modules, options) {
62
94
  server.registerResource(resourceName, uri, { description: `${module.name} ${verb} (read-only)` }, async (readUri) => {
63
95
  const outcome = await callCore();
64
96
  if (outcome.ok) {
65
- return { contents: [{ uri: readUri.toString(), mimeType: 'application/json', text: outcome.text }] };
97
+ // Its warnings ride beside `contents` (task-195, same class as `bug-231`): `memorySearch`
98
+ // reports the documents its scan left out (task-171), which a client must not lose.
99
+ return (0, read_only_1.withWarnings)({ contents: [{ uri: readUri.toString(), mimeType: 'application/json', text: outcome.text }] }, outcome.warnings);
66
100
  }
67
- throw new Error(outcome.message);
101
+ // A failed read IS a JSON-RPC error; the SDK forwards an `Error`'s `data` as `error.data`
102
+ // (task-130, `dl-055` option 1). No details, no `data` — the shape it always had.
103
+ throw (0, read_only_1.readRefusalError)(outcome.message, outcome.details);
68
104
  });
69
105
  }
70
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/mcp/registrar.ts"],"names":[],"mappings":";;AAyCA,8CAEC;AAOD,oDAEC;AAUD,kDAmDC;AAvFD,+CAAmE;AAUnE;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,IAAY;IAChE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC,CAA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AE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACvI,CAAC;gBACD,0FAA0F;gBAC1F,kFAAkF;gBAClF,MAAM,IAAA,4BAAgB,EAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -9,8 +9,8 @@
9
9
  * pattern `src/cli/program.ts`'s `commander` wiring and `src/cli/init-command.ts`'s `createReadlinePrompt`
10
10
  * already use, and for the same reason:
11
11
  *
12
- * - {@link createMcpServer} does all the wiring (construct the `McpServer`, register the v0.1 channel
13
- * set) and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
12
+ * - {@link createMcpServer} does all the wiring (construct the `McpServer`, register its channel set)
13
+ * and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
14
14
  * in-memory transport + a real `Client` in `test/mcp/server.test.ts` (the three P5.2.1 acceptance
15
15
  * criteria + the read-only-only scope assertion).
16
16
  * - {@link startMcpServer} adds the single line that cannot be unit-tested without opening a real
@@ -18,12 +18,13 @@
18
18
  * never by an automated test (a test must never open a real stdio server against a repo).
19
19
  *
20
20
  * Channel scope (spec-014 §3): `createMcpServer` registers the read-only Resources channel
21
- * (`registerReadOnlyResources` — spec-004 §2, P5.2.1) and, since task-058-mcp-prompts-role-based
22
- * (P5.2.2, v0.2), the read-only role Prompts channel (`registerRolePrompts` — spec-004 §3). It
23
- * deliberately does NOT call `registerCoreModules`, which would advertise a mutating Tool for every
24
- * `mutates: true` CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3
25
- * (v0.4) scope and will extend the channel set here later; the entry point (`wingfoil mcp` + this
26
- * transport wiring) is unchanged by those additions.
21
+ * (`registerReadOnlyResources` — spec-004 §2, P5.2.1), the read-only role Prompts channel
22
+ * (`registerRolePrompts` — spec-004 §3, P5.2.2, since task-058-mcp-prompts-role-based), and an **empty
23
+ * Tools channel** ({@link registerEmptyToolsChannel}, task-174, `bug-151`). It deliberately does NOT
24
+ * call `registerCoreModules`, which would advertise a mutating Tool for every `mutates: true`
25
+ * CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3 (v0.4) scope and
26
+ * will replace the empty channel here later; the entry point (`wingfoil mcp` + this transport wiring)
27
+ * is unchanged by those additions.
27
28
  */
28
29
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
29
30
  /** Construction/connection options for the production MCP server. */
@@ -34,18 +35,24 @@ export interface McpServerOptions {
34
35
  * resolves the root once up front and passes a closure returning that value (spec-014 §1).
35
36
  */
36
37
  readonly resolveRoot: () => string;
38
+ /**
39
+ * The DNA role set the Prompts channel serves, one `{role}-session` Prompt each, fixed for the
40
+ * server's life (spec-004 §3.1, `dl-049` (b)). `wingfoil mcp` reads it in its pre-flight
41
+ * (`loadDnaRoleSet`), so construction itself reads nothing (spec-014 §2).
42
+ */
43
+ readonly roles: readonly string[];
37
44
  /** Server identity `name`; defaults to `wingfoil`. */
38
45
  readonly name?: string;
39
46
  /** Server identity `version`; defaults to `0.0.0` (the `wingfoil mcp` command passes the real package version). */
40
47
  readonly version?: string;
41
48
  }
42
49
  /**
43
- * Construct the production `McpServer` and register the read-only Resources and role Prompts channels
44
- * on it (spec-014 §3). Pure and synchronous — no transport, no stdio, no filesystem read, no process
45
- * side effects (spec-014 §2: "no I/O at construction time beyond wiring handlers"); every handler
46
- * resolves the root and reads the project per request. So a test can connect it over the SDK's
47
- * in-memory transport and drive it with a real `Client`, and `wingfoil mcp` never fails to start
48
- * because of the project's content.
50
+ * Construct the production `McpServer` and register its channel set on it (spec-014 §3): the read-only
51
+ * Resources, the role Prompts over the given role set, and the empty Tools channel. Pure and
52
+ * synchronous — no transport, no stdio, no filesystem read, no process side effects (spec-014 §2: "no
53
+ * I/O at construction time beyond wiring handlers"); the role set arrives already read, and every
54
+ * handler resolves the root and reads the project per request. So a test can connect it over the SDK's
55
+ * in-memory transport and drive it with a real `Client`.
49
56
  */
50
57
  export declare function createMcpServer(options: McpServerOptions): McpServer;
51
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mHAAmH;IACnH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAQpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAKlF"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mHAAmH;IACnH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA4BD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAUpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAKlF"}
@@ -13,8 +13,8 @@ exports.startMcpServer = startMcpServer;
13
13
  * pattern `src/cli/program.ts`'s `commander` wiring and `src/cli/init-command.ts`'s `createReadlinePrompt`
14
14
  * already use, and for the same reason:
15
15
  *
16
- * - {@link createMcpServer} does all the wiring (construct the `McpServer`, register the v0.1 channel
17
- * set) and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
16
+ * - {@link createMcpServer} does all the wiring (construct the `McpServer`, register its channel set)
17
+ * and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
18
18
  * in-memory transport + a real `Client` in `test/mcp/server.test.ts` (the three P5.2.1 acceptance
19
19
  * criteria + the read-only-only scope assertion).
20
20
  * - {@link startMcpServer} adds the single line that cannot be unit-tested without opening a real
@@ -22,23 +22,47 @@ exports.startMcpServer = startMcpServer;
22
22
  * never by an automated test (a test must never open a real stdio server against a repo).
23
23
  *
24
24
  * Channel scope (spec-014 §3): `createMcpServer` registers the read-only Resources channel
25
- * (`registerReadOnlyResources` — spec-004 §2, P5.2.1) and, since task-058-mcp-prompts-role-based
26
- * (P5.2.2, v0.2), the read-only role Prompts channel (`registerRolePrompts` — spec-004 §3). It
27
- * deliberately does NOT call `registerCoreModules`, which would advertise a mutating Tool for every
28
- * `mutates: true` CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3
29
- * (v0.4) scope and will extend the channel set here later; the entry point (`wingfoil mcp` + this
30
- * transport wiring) is unchanged by those additions.
25
+ * (`registerReadOnlyResources` — spec-004 §2, P5.2.1), the read-only role Prompts channel
26
+ * (`registerRolePrompts` — spec-004 §3, P5.2.2, since task-058-mcp-prompts-role-based), and an **empty
27
+ * Tools channel** ({@link registerEmptyToolsChannel}, task-174, `bug-151`). It deliberately does NOT
28
+ * call `registerCoreModules`, which would advertise a mutating Tool for every `mutates: true`
29
+ * CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3 (v0.4) scope and
30
+ * will replace the empty channel here later; the entry point (`wingfoil mcp` + this transport wiring)
31
+ * is unchanged by those additions.
31
32
  */
32
33
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
33
34
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
35
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
34
36
  const index_1 = require("./index");
35
37
  /**
36
- * Construct the production `McpServer` and register the read-only Resources and role Prompts channels
37
- * on it (spec-014 §3). Pure and synchronous — no transport, no stdio, no filesystem read, no process
38
- * side effects (spec-014 §2: "no I/O at construction time beyond wiring handlers"); every handler
39
- * resolves the root and reads the project per request. So a test can connect it over the SDK's
40
- * in-memory transport and drive it with a real `Client`, and `wingfoil mcp` never fails to start
41
- * because of the project's content.
38
+ * Declare the Tools channel and answer it with no Tools (task-174, `bug-151`), until P5.2.3 (v0.4)
39
+ * registers real ones. A client that probes `tools/list` gets `{tools: []}` rather than the JSON-RPC
40
+ * `-32601` it got while the channel was undeclared, and `initialize` advertises `tools: {}` — without
41
+ * `listChanged`, since the list cannot change during a session.
42
+ *
43
+ * A `tools/call` necessarily names a Tool that does not exist. It is answered the way spec-004 §4.3
44
+ * item 4 answers every Tool refusal — an `isError: true` result, not a JSON-RPC error — with the SDK's
45
+ * own wording for an unknown Tool, `Tool <name> not found`.
46
+ *
47
+ * Owned on the low-level server, like the Prompts handlers (`./prompt.ts`): the SDK installs its own
48
+ * Tools handlers only on the first `registerTool`, and a later `registerTool` on this server fails
49
+ * loudly ("A request handler for tools/list already exists") instead of being silently shadowed.
50
+ */
51
+ function registerEmptyToolsChannel(server) {
52
+ server.server.registerCapabilities({ tools: {} });
53
+ server.server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => ({ tools: [] }));
54
+ server.server.setRequestHandler(types_js_1.CallToolRequestSchema, (request) => ({
55
+ content: [{ type: 'text', text: `Tool ${request.params.name} not found` }],
56
+ isError: true,
57
+ }));
58
+ }
59
+ /**
60
+ * Construct the production `McpServer` and register its channel set on it (spec-014 §3): the read-only
61
+ * Resources, the role Prompts over the given role set, and the empty Tools channel. Pure and
62
+ * synchronous — no transport, no stdio, no filesystem read, no process side effects (spec-014 §2: "no
63
+ * I/O at construction time beyond wiring handlers"); the role set arrives already read, and every
64
+ * handler resolves the root and reads the project per request. So a test can connect it over the SDK's
65
+ * in-memory transport and drive it with a real `Client`.
42
66
  */
43
67
  function createMcpServer(options) {
44
68
  const server = new mcp_js_1.McpServer({
@@ -46,7 +70,9 @@ function createMcpServer(options) {
46
70
  version: options.version ?? '0.0.0',
47
71
  });
48
72
  (0, index_1.registerReadOnlyResources)(server, { resolveRoot: options.resolveRoot });
49
- (0, index_1.registerRolePrompts)(server, { resolveRoot: options.resolveRoot });
73
+ (0, index_1.registerRolePrompts)(server, { resolveRoot: options.resolveRoot, roles: options.roles });
74
+ (0, index_1.registerSessionContextResource)(server, { resolveRoot: options.resolveRoot, roles: options.roles });
75
+ registerEmptyToolsChannel(server);
50
76
  return server;
51
77
  }
52
78
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AAsDA,0CAQC;AAQD,wCAKC;AA3ED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oEAAoE;AACpE,wEAAiF;AAEjF,mCAAyE;AAgBzE;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,OAAyB;IACvD,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,UAAU;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;KACpC,CAAC,CAAC;IACH,IAAA,iCAAy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AACH,SAAgB,eAAe,CAAC,OAAyB;IACvD,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,UAAU;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;KACpC,CAAC,CAAC;IACH,IAAA,iCAAyB,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxE,IAAA,2BAAmB,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACxF,IAAA,sCAA8B,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /** `spec-004` §2.1 — the execution context of `role` on `element` at the commit `state` (task-236). */
3
+ export declare const SESSION_CONTEXT_URI_TEMPLATE = "wingfoil://session/{role}/{element}/{state}";
4
+ /** Options for {@link registerSessionContextResource}. */
5
+ export interface RegisterSessionContextResourceOptions {
6
+ /** Resolves the project root each read is served from. */
7
+ readonly resolveRoot: () => string;
8
+ /** The DNA role set, fixed at server start (`spec-004` §3.1), the same set the Prompts are registered for. */
9
+ readonly roles: readonly string[];
10
+ }
11
+ /** Register the session Resource template on `server` (task-236). */
12
+ export declare function registerSessionContextResource(server: McpServer, options: RegisterSessionContextResourceOptions): void;
13
+ //# sourceMappingURL=session-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/session-resource.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,uGAAuG;AACvG,eAAO,MAAM,4BAA4B,gDAAgD,CAAC;AAE1F,0DAA0D;AAC1D,MAAM,WAAW,qCAAqC;IACpD,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAgBD,qEAAqE;AACrE,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,qCAAqC,GAAG,IAAI,CAoBtH"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SESSION_CONTEXT_URI_TEMPLATE = void 0;
4
+ exports.registerSessionContextResource = registerSessionContextResource;
5
+ /**
6
+ * The session Resource `wingfoil://session/{role}/{element}/{state}` (task-236; approver ruling (a) of
7
+ * 2026-10-13 and D-E…D-G of 2026-10-14; `spec-016` §2.4, `spec-004` §2.1/§3.4): the execution context of the
8
+ * `{role}-session` Prompt for `(role, element, state)`, served also as a read-only Resource, byte for byte.
9
+ *
10
+ * **Why both.** An agent CLI may let its model read MCP Resources but not get MCP Prompts: the by-hand pass of
11
+ * the `claude-code` built-in found Claude Code 2.1.296's model has `ListMcpResourcesTool` and
12
+ * `ReadMcpResourceTool` and no way to get a Prompt, which Claude Code offers only as a command the user types.
13
+ * `agent execute`'s bootstrap therefore names this Resource; the Prompt stays served, unchanged.
14
+ *
15
+ * **Never listed.** `state` is any commit, so the template has no `list` callback: `resources/list` names no
16
+ * `wingfoil://session/` URI and `resources/templates/list` declares the template. A client reads it by the full
17
+ * URI the bootstrap gives; the SDK matches a read against every registered template.
18
+ *
19
+ * **The variables.** `{element}` is the Prompt's `element` argument, `<type>:<id>` (`spec-008` §7), in one
20
+ * segment (`:` is a legal path character; no id holds `/` or `,`). Each variable is percent-decoded before it
21
+ * is checked, so `task%3Atask-042-foo` reads as `task:task-042-foo`.
22
+ *
23
+ * **Refusals**, in order: a write intent (`spec-004` §2.3), before anything is read; a role outside the role set
24
+ * fixed at server start (`spec-004` §3.1) → `no session context for undefined role '<role>'`; then the
25
+ * Prompt's own (§3.4): a malformed element-ref, a malformed revision, a revision naming no commit and an element
26
+ * the commit does not hold are `-32602`; a context the repository refuses is a failed read.
27
+ */
28
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
29
+ const core_1 = require("../core");
30
+ const prompt_1 = require("./prompt");
31
+ const read_only_1 = require("./read-only");
32
+ /** `spec-004` §2.1 — the execution context of `role` on `element` at the commit `state` (task-236). */
33
+ exports.SESSION_CONTEXT_URI_TEMPLATE = 'wingfoil://session/{role}/{element}/{state}';
34
+ /**
35
+ * A URI variable, percent-decoded; left as sent when it is not valid percent-encoding (the check then refuses
36
+ * it). The SDK types a variable `string | string[]`; none of this template's variables has the explode
37
+ * modifier, so it is always one string (as `memory-resource.ts` notes for its own).
38
+ */
39
+ function decoded(value) {
40
+ const text = value;
41
+ try {
42
+ return decodeURIComponent(text);
43
+ }
44
+ catch {
45
+ return text;
46
+ }
47
+ }
48
+ /** Register the session Resource template on `server` (task-236). */
49
+ function registerSessionContextResource(server, options) {
50
+ server.registerResource('session.context', new mcp_js_1.ResourceTemplate(exports.SESSION_CONTEXT_URI_TEMPLATE, { list: undefined }), {
51
+ description: "the execution context of a role on a Memory element at a commit, as the '{role}-session' prompt returns it with element and state (read-only)",
52
+ mimeType: 'text/markdown',
53
+ }, (uri, variables, extra) => (0, read_only_1.withRefusalDetails)(() => {
54
+ (0, read_only_1.refuseIfWriteIntent)(extra._meta);
55
+ const role = decoded(variables.role);
56
+ if (!options.roles.includes(role))
57
+ throw (0, prompt_1.promptRequestError)(`no session context for undefined role '${role}'`);
58
+ const element = (0, core_1.parseElementRef)(decoded(variables.element));
59
+ if (!element.ok)
60
+ throw (0, prompt_1.promptRequestError)(element.error.message);
61
+ const { text, warnings } = (0, prompt_1.buildSessionContext)(options.resolveRoot(), role, element.value, decoded(variables.state));
62
+ return (0, read_only_1.withWarnings)({ contents: [{ uri: uri.toString(), mimeType: 'text/markdown', text }] }, warnings);
63
+ }));
64
+ }
65
+ //# sourceMappingURL=session-resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-resource.js","sourceRoot":"","sources":["../../src/mcp/session-resource.ts"],"names":[],"mappings":";;;AAyDA,wEAoBC;AA7ED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oEAA2E;AAG3E,kCAA0C;AAE1C,qCAAmE;AACnE,2CAAoF;AAEpF,uGAAuG;AAC1F,QAAA,4BAA4B,GAAG,6CAA6C,CAAC;AAU1F;;;;GAIG;AACH,SAAS,OAAO,CAAC,KAAoC;IACnD,MAAM,IAAI,GAAG,KAAe,CAAC;IAC7B,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,SAAgB,8BAA8B,CAAC,MAAiB,EAAE,OAA8C;IAC9G,MAAM,CAAC,gBAAgB,CACrB,iBAAiB,EACjB,IAAI,yBAAgB,CAAC,oCAA4B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACvE;QACE,WAAW,EACT,+IAA+I;QACjJ,QAAQ,EAAE,eAAe;KAC1B,EACD,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CACxB,IAAA,8BAAkB,EAAC,GAAG,EAAE;QACtB,IAAA,+BAAmB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,MAAM,IAAA,2BAAkB,EAAC,0CAA0C,IAAI,GAAG,CAAC,CAAC;QAC/G,MAAM,OAAO,GAAG,IAAA,sBAAe,EAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,MAAM,IAAA,2BAAkB,EAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACrH,OAAO,IAAA,wBAAY,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC1G,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
@@ -14,4 +14,22 @@ export declare const WORKFLOW_DOCUMENT_URI_TEMPLATE = "wingfoil://workflows/{nam
14
14
  * task registers.
15
15
  */
16
16
  export declare function registerWorkflowResources(server: McpServer, options: RegisterWorkflowResourcesOptions): void;
17
+ /** spec-017 §9 — the active instance's next step: `wingfoil workflow next --format json`'s `NextResult`, at `HEAD`. */
18
+ export declare const WORKFLOW_NEXT_URI = "wingfoil://workflows/-/next";
19
+ /** spec-017 §9 — every open instance: `wingfoil workflow status --format json`'s `StatusResult`, at `HEAD`. */
20
+ export declare const WORKFLOW_STATUS_URI = "wingfoil://workflows/-/status";
21
+ /**
22
+ * Register the two workflow-state Resources on `server` (task-239; `spec-017` §9, ruling R12; `spec-004` §2.1).
23
+ * They cannot collide with `wingfoil://workflows/{name}`: their second segment is `-`, which no workflow name
24
+ * can be (`spec-003` names start with a letter), and they have a third segment, which the single-segment
25
+ * `{name}` template never matches — so a workflow named `next` stays `wingfoil://workflows/next`. Each read runs the core
26
+ * function the CLI command runs with no operand — `workflowNextAtHead` / `workflowStatusAtHead`, the
27
+ * deduction at `HEAD` — and returns its value serialized as the CLI's `--format json` prints it (without the
28
+ * final newline). Nothing is cached: every read deduces again. A refusal is a failed read carrying the CLI's
29
+ * message and details (spec-004 §4.3 item 4), whether core returns it (`CoreResult.error`, through
30
+ * `coreResultResource`) or a loader throws it (`withRefusalDetails`); a read carrying a write intent is refused
31
+ * first (spec-004 §2.3). With no operand neither function returns a `CoreResult.error` today (only an
32
+ * unresolvable `<ref>` does, `spec-017` §10), so the first path is the shared helper's, tested on its own.
33
+ */
34
+ export declare function registerWorkflowStateResources(server: McpServer, options: RegisterWorkflowResourcesOptions): void;
17
35
  //# sourceMappingURL=workflow-resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,qDAAqD;AACrD,MAAM,WAAW,gCAAgC;IAC/C,0HAA0H;IAC1H,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;CACpC;AAED,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAqC5G"}
1
+ {"version":3,"file":"workflow-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,qDAAqD;AACrD,MAAM,WAAW,gCAAgC;IAC/C,0HAA0H;IAC1H,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;CACpC;AAED,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAuC5G;AAED,uHAAuH;AACvH,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAC/D,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAejH"}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = exports.WORKFLOWS_COLLECTION_URI = void 0;
3
+ exports.WORKFLOW_STATUS_URI = exports.WORKFLOW_NEXT_URI = exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = exports.WORKFLOWS_COLLECTION_URI = void 0;
4
4
  exports.registerWorkflowResources = registerWorkflowResources;
5
+ exports.registerWorkflowStateResources = registerWorkflowStateResources;
5
6
  /**
6
- * `wingfoil://workflows` (collection) and `wingfoil://workflows/{name}` (a single workflow
7
- * definition) Resources — task-011-mcp-resources-read-only, REQ-INT-01,
7
+ * `wingfoil://workflows` (collection), `wingfoil://workflows/{name}` (one workflow definition) and,
8
+ * since task-239, `wingfoil://workflows/-/next` and `-/status` Resources — task-011, REQ-INT-01,
8
9
  * spec-004-mcp-surface-contract §2.1. Distinct from `registerCoreModules`'s existing
9
10
  * `wingfoil://workflow/list` Resource (task-006-dual-interface-shared-core, the generic
10
11
  * `wingfoil://{module}/{verb}` transform of the `workflowList` `CoreOperation`) — both coexist; this
@@ -18,7 +19,8 @@ exports.registerWorkflowResources = registerWorkflowResources;
18
19
  * here distinguishes them beyond what each workflow's own `kind` field already reports.
19
20
  *
20
21
  * Registered directly via `McpServer.registerResource`, not through `registerCoreModules`'s
21
- * `CoreModule[]` registry — no `workflowShow` `CoreOperation` exists yet; same
22
+ * `CoreModule[]` registry — `workflowList` / `workflowShow` answer from `HEAD` with another payload, while
23
+ * the first two keep theirs and the working tree in v0.3, the state Resources answer at `HEAD` (spec-017 §9); same
22
24
  * spec-006-core-domain-api §4 parity deviation `memory-resource.ts`/`dna-resource.ts` document for
23
25
  * their own Resources, for the same reason (task-030-implement-mcp-resources' scope).
24
26
  */
@@ -35,7 +37,7 @@ exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = 'wingfoil://workflows/{name}';
35
37
  * task registers.
36
38
  */
37
39
  function registerWorkflowResources(server, options) {
38
- server.registerResource('workflows.list', exports.WORKFLOWS_COLLECTION_URI, { description: 'every loaded workflow definition, summary only (read-only)' }, async (uri, extra) => {
40
+ server.registerResource('workflows.list', exports.WORKFLOWS_COLLECTION_URI, { description: 'every loaded workflow definition, summary only (read-only)' }, (uri, extra) => (0, read_only_1.withRefusalDetails)(() => {
39
41
  (0, read_only_1.refuseIfWriteIntent)(extra._meta);
40
42
  const root = options.resolveRoot();
41
43
  const { workflows } = (0, core_1.loadWorkflowsYaml)(root);
@@ -44,9 +46,9 @@ function registerWorkflowResources(server, options) {
44
46
  .map(({ name, kind, description }) => ({ name, kind, description }))
45
47
  .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
46
48
  return (0, read_only_1.jsonResourceResult)(uri, summaries);
47
- });
49
+ }));
48
50
  const documentTemplate = new mcp_js_1.ResourceTemplate(exports.WORKFLOW_DOCUMENT_URI_TEMPLATE, { list: undefined });
49
- server.registerResource('workflows.show', documentTemplate, { description: 'one workflow definition, full content (read-only)' }, async (uri, variables, extra) => {
51
+ server.registerResource('workflows.show', documentTemplate, { description: 'one workflow definition, full content (read-only)' }, (uri, variables, extra) => (0, read_only_1.withRefusalDetails)(() => {
50
52
  (0, read_only_1.refuseIfWriteIntent)(extra._meta);
51
53
  const root = options.resolveRoot();
52
54
  const { workflows } = (0, core_1.loadWorkflowsYaml)(root);
@@ -58,6 +60,33 @@ function registerWorkflowResources(server, options) {
58
60
  if (!workflow)
59
61
  throw (0, read_only_1.resourceNotFoundError)(`workflows/${name}`);
60
62
  return (0, read_only_1.jsonResourceResult)(uri, workflow);
61
- });
63
+ }));
64
+ }
65
+ /** spec-017 §9 — the active instance's next step: `wingfoil workflow next --format json`'s `NextResult`, at `HEAD`. */
66
+ exports.WORKFLOW_NEXT_URI = 'wingfoil://workflows/-/next';
67
+ /** spec-017 §9 — every open instance: `wingfoil workflow status --format json`'s `StatusResult`, at `HEAD`. */
68
+ exports.WORKFLOW_STATUS_URI = 'wingfoil://workflows/-/status';
69
+ /**
70
+ * Register the two workflow-state Resources on `server` (task-239; `spec-017` §9, ruling R12; `spec-004` §2.1).
71
+ * They cannot collide with `wingfoil://workflows/{name}`: their second segment is `-`, which no workflow name
72
+ * can be (`spec-003` names start with a letter), and they have a third segment, which the single-segment
73
+ * `{name}` template never matches — so a workflow named `next` stays `wingfoil://workflows/next`. Each read runs the core
74
+ * function the CLI command runs with no operand — `workflowNextAtHead` / `workflowStatusAtHead`, the
75
+ * deduction at `HEAD` — and returns its value serialized as the CLI's `--format json` prints it (without the
76
+ * final newline). Nothing is cached: every read deduces again. A refusal is a failed read carrying the CLI's
77
+ * message and details (spec-004 §4.3 item 4), whether core returns it (`CoreResult.error`, through
78
+ * `coreResultResource`) or a loader throws it (`withRefusalDetails`); a read carrying a write intent is refused
79
+ * first (spec-004 §2.3). With no operand neither function returns a `CoreResult.error` today (only an
80
+ * unresolvable `<ref>` does, `spec-017` §10), so the first path is the shared helper's, tested on its own.
81
+ */
82
+ function registerWorkflowStateResources(server, options) {
83
+ const register = (name, uri, description, read) => {
84
+ server.registerResource(name, uri, { description }, (readUri, extra) => (0, read_only_1.withRefusalDetails)(() => {
85
+ (0, read_only_1.refuseIfWriteIntent)(extra._meta);
86
+ return (0, read_only_1.coreResultResource)(readUri, read(options.resolveRoot()));
87
+ }));
88
+ };
89
+ register('workflows.next', exports.WORKFLOW_NEXT_URI, 'the next step of the active workflow instance, as committed at HEAD (read-only)', (root) => (0, core_1.workflowNextAtHead)(root));
90
+ register('workflows.status', exports.WORKFLOW_STATUS_URI, 'every open workflow instance, its pending approvals and the elements waiting at a gate, as committed at HEAD (read-only)', (root) => (0, core_1.workflowStatusAtHead)(root));
62
91
  }
63
92
  //# sourceMappingURL=workflow-resource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-resource.js","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":";;;AA2CA,8DAqCC;AAhFD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oEAA2E;AAG3E,kCAA4C;AAE5C,2CAA6F;AAQ7F,wEAAwE;AAC3D,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,oFAAoF;AACvE,QAAA,8BAA8B,GAAG,6BAA6B,CAAC;AAE5E;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,MAAiB,EAAE,OAAyC;IACpG,MAAM,CAAC,gBAAgB,CACrB,gBAAgB,EAChB,gCAAwB,EACxB,EAAE,WAAW,EAAE,4DAA4D,EAAE,EAC7E,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QACnB,IAAA,+BAAmB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,wBAAiB,EAAC,IAA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