@cleocode/cleo 2026.4.9 → 2026.4.11

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 (693) hide show
  1. package/dist/cli/commander-shim.d.ts +112 -0
  2. package/dist/cli/commander-shim.d.ts.map +1 -0
  3. package/dist/cli/commander-shim.js +233 -0
  4. package/dist/cli/commander-shim.js.map +1 -0
  5. package/dist/cli/commands/add.d.ts +12 -0
  6. package/dist/cli/commands/add.d.ts.map +1 -0
  7. package/dist/cli/commands/add.js +98 -0
  8. package/dist/cli/commands/add.js.map +1 -0
  9. package/dist/cli/commands/admin.d.ts +12 -0
  10. package/dist/cli/commands/admin.d.ts.map +1 -0
  11. package/dist/cli/commands/admin.js +59 -0
  12. package/dist/cli/commands/admin.js.map +1 -0
  13. package/dist/cli/commands/adr.d.ts +27 -0
  14. package/dist/cli/commands/adr.d.ts.map +1 -0
  15. package/dist/cli/commands/adr.js +79 -0
  16. package/dist/cli/commands/adr.js.map +1 -0
  17. package/dist/cli/commands/agent-profile-status.d.ts +98 -0
  18. package/dist/cli/commands/agent-profile-status.d.ts.map +1 -0
  19. package/dist/cli/commands/agent-profile-status.js +71 -0
  20. package/dist/cli/commands/agent-profile-status.js.map +1 -0
  21. package/dist/cli/commands/agent.d.ts +38 -0
  22. package/dist/cli/commands/agent.d.ts.map +1 -0
  23. package/dist/cli/commands/agent.js +1125 -0
  24. package/dist/cli/commands/agent.js.map +1 -0
  25. package/dist/cli/commands/agents.d.ts +17 -0
  26. package/dist/cli/commands/agents.d.ts.map +1 -0
  27. package/dist/cli/commands/agents.js +20 -0
  28. package/dist/cli/commands/agents.js.map +1 -0
  29. package/dist/cli/commands/analyze.d.ts +12 -0
  30. package/dist/cli/commands/analyze.d.ts.map +1 -0
  31. package/dist/cli/commands/analyze.js +20 -0
  32. package/dist/cli/commands/analyze.js.map +1 -0
  33. package/dist/cli/commands/archive-stats.d.ts +18 -0
  34. package/dist/cli/commands/archive-stats.d.ts.map +1 -0
  35. package/dist/cli/commands/archive-stats.js +49 -0
  36. package/dist/cli/commands/archive-stats.js.map +1 -0
  37. package/dist/cli/commands/archive.d.ts +12 -0
  38. package/dist/cli/commands/archive.d.ts.map +1 -0
  39. package/dist/cli/commands/archive.js +32 -0
  40. package/dist/cli/commands/archive.js.map +1 -0
  41. package/dist/cli/commands/backfill.d.ts +38 -0
  42. package/dist/cli/commands/backfill.d.ts.map +1 -0
  43. package/dist/cli/commands/backfill.js +147 -0
  44. package/dist/cli/commands/backfill.js.map +1 -0
  45. package/dist/cli/commands/backup.d.ts +8 -0
  46. package/dist/cli/commands/backup.d.ts.map +1 -0
  47. package/dist/cli/commands/backup.js +35 -0
  48. package/dist/cli/commands/backup.js.map +1 -0
  49. package/dist/cli/commands/blockers.d.ts +7 -0
  50. package/dist/cli/commands/blockers.d.ts.map +1 -0
  51. package/dist/cli/commands/blockers.js +16 -0
  52. package/dist/cli/commands/blockers.js.map +1 -0
  53. package/dist/cli/commands/brain.d.ts +29 -0
  54. package/dist/cli/commands/brain.d.ts.map +1 -0
  55. package/dist/cli/commands/brain.js +107 -0
  56. package/dist/cli/commands/brain.js.map +1 -0
  57. package/dist/cli/commands/briefing.d.ts +22 -0
  58. package/dist/cli/commands/briefing.d.ts.map +1 -0
  59. package/dist/cli/commands/briefing.js +45 -0
  60. package/dist/cli/commands/briefing.js.map +1 -0
  61. package/dist/cli/commands/bug.d.ts +12 -0
  62. package/dist/cli/commands/bug.d.ts.map +1 -0
  63. package/dist/cli/commands/bug.js +81 -0
  64. package/dist/cli/commands/bug.js.map +1 -0
  65. package/dist/cli/commands/cant.d.ts +32 -0
  66. package/dist/cli/commands/cant.d.ts.map +1 -0
  67. package/dist/cli/commands/cant.js +281 -0
  68. package/dist/cli/commands/cant.js.map +1 -0
  69. package/dist/cli/commands/check.d.ts +22 -0
  70. package/dist/cli/commands/check.d.ts.map +1 -0
  71. package/dist/cli/commands/check.js +164 -0
  72. package/dist/cli/commands/check.js.map +1 -0
  73. package/dist/cli/commands/checkpoint.d.ts +15 -0
  74. package/dist/cli/commands/checkpoint.d.ts.map +1 -0
  75. package/dist/cli/commands/checkpoint.js +91 -0
  76. package/dist/cli/commands/checkpoint.js.map +1 -0
  77. package/dist/cli/commands/code.d.ts +11 -0
  78. package/dist/cli/commands/code.d.ts.map +1 -0
  79. package/dist/cli/commands/code.js +114 -0
  80. package/dist/cli/commands/code.js.map +1 -0
  81. package/dist/cli/commands/commands.d.ts +13 -0
  82. package/dist/cli/commands/commands.d.ts.map +1 -0
  83. package/dist/cli/commands/commands.js +29 -0
  84. package/dist/cli/commands/commands.js.map +1 -0
  85. package/dist/cli/commands/complete.d.ts +12 -0
  86. package/dist/cli/commands/complete.d.ts.map +1 -0
  87. package/dist/cli/commands/complete.js +43 -0
  88. package/dist/cli/commands/complete.js.map +1 -0
  89. package/dist/cli/commands/compliance.d.ts +8 -0
  90. package/dist/cli/commands/compliance.d.ts.map +1 -0
  91. package/dist/cli/commands/compliance.js +85 -0
  92. package/dist/cli/commands/compliance.js.map +1 -0
  93. package/dist/cli/commands/config.d.ts +10 -0
  94. package/dist/cli/commands/config.d.ts.map +1 -0
  95. package/dist/cli/commands/config.js +69 -0
  96. package/dist/cli/commands/config.js.map +1 -0
  97. package/dist/cli/commands/consensus.d.ts +13 -0
  98. package/dist/cli/commands/consensus.d.ts.map +1 -0
  99. package/dist/cli/commands/consensus.js +45 -0
  100. package/dist/cli/commands/consensus.js.map +1 -0
  101. package/dist/cli/commands/context.d.ts +8 -0
  102. package/dist/cli/commands/context.d.ts.map +1 -0
  103. package/dist/cli/commands/context.js +40 -0
  104. package/dist/cli/commands/context.js.map +1 -0
  105. package/dist/cli/commands/contribution.d.ts +13 -0
  106. package/dist/cli/commands/contribution.d.ts.map +1 -0
  107. package/dist/cli/commands/contribution.js +41 -0
  108. package/dist/cli/commands/contribution.js.map +1 -0
  109. package/dist/cli/commands/current.d.ts +13 -0
  110. package/dist/cli/commands/current.d.ts.map +1 -0
  111. package/dist/cli/commands/current.js +20 -0
  112. package/dist/cli/commands/current.js.map +1 -0
  113. package/dist/cli/commands/dash.d.ts +12 -0
  114. package/dist/cli/commands/dash.d.ts.map +1 -0
  115. package/dist/cli/commands/dash.js +24 -0
  116. package/dist/cli/commands/dash.js.map +1 -0
  117. package/dist/cli/commands/decomposition.d.ts +13 -0
  118. package/dist/cli/commands/decomposition.d.ts.map +1 -0
  119. package/dist/cli/commands/decomposition.js +45 -0
  120. package/dist/cli/commands/decomposition.js.map +1 -0
  121. package/dist/cli/commands/delete.d.ts +12 -0
  122. package/dist/cli/commands/delete.d.ts.map +1 -0
  123. package/dist/cli/commands/delete.js +37 -0
  124. package/dist/cli/commands/delete.js.map +1 -0
  125. package/dist/cli/commands/deps.d.ts +24 -0
  126. package/dist/cli/commands/deps.d.ts.map +1 -0
  127. package/dist/cli/commands/deps.js +98 -0
  128. package/dist/cli/commands/deps.js.map +1 -0
  129. package/dist/cli/commands/detect-drift.d.ts +15 -0
  130. package/dist/cli/commands/detect-drift.d.ts.map +1 -0
  131. package/dist/cli/commands/detect-drift.js +424 -0
  132. package/dist/cli/commands/detect-drift.js.map +1 -0
  133. package/dist/cli/commands/detect.d.ts +10 -0
  134. package/dist/cli/commands/detect.d.ts.map +1 -0
  135. package/dist/cli/commands/detect.js +24 -0
  136. package/dist/cli/commands/detect.js.map +1 -0
  137. package/dist/cli/commands/docs.d.ts +13 -0
  138. package/dist/cli/commands/docs.d.ts.map +1 -0
  139. package/dist/cli/commands/docs.js +169 -0
  140. package/dist/cli/commands/docs.js.map +1 -0
  141. package/dist/cli/commands/doctor.d.ts +15 -0
  142. package/dist/cli/commands/doctor.d.ts.map +1 -0
  143. package/dist/cli/commands/doctor.js +133 -0
  144. package/dist/cli/commands/doctor.js.map +1 -0
  145. package/dist/cli/commands/dynamic.d.ts +24 -0
  146. package/dist/cli/commands/dynamic.d.ts.map +1 -0
  147. package/dist/cli/commands/dynamic.js +27 -0
  148. package/dist/cli/commands/dynamic.js.map +1 -0
  149. package/dist/cli/commands/env.d.ts +12 -0
  150. package/dist/cli/commands/env.d.ts.map +1 -0
  151. package/dist/cli/commands/env.js +44 -0
  152. package/dist/cli/commands/env.js.map +1 -0
  153. package/dist/cli/commands/exists.d.ts +22 -0
  154. package/dist/cli/commands/exists.d.ts.map +1 -0
  155. package/dist/cli/commands/exists.js +51 -0
  156. package/dist/cli/commands/exists.js.map +1 -0
  157. package/dist/cli/commands/export-tasks.d.ts +10 -0
  158. package/dist/cli/commands/export-tasks.d.ts.map +1 -0
  159. package/dist/cli/commands/export-tasks.js +47 -0
  160. package/dist/cli/commands/export-tasks.js.map +1 -0
  161. package/dist/cli/commands/export.d.ts +9 -0
  162. package/dist/cli/commands/export.d.ts.map +1 -0
  163. package/dist/cli/commands/export.js +46 -0
  164. package/dist/cli/commands/export.js.map +1 -0
  165. package/dist/cli/commands/find.d.ts +14 -0
  166. package/dist/cli/commands/find.d.ts.map +1 -0
  167. package/dist/cli/commands/find.js +70 -0
  168. package/dist/cli/commands/find.js.map +1 -0
  169. package/dist/cli/commands/generate-changelog.d.ts +14 -0
  170. package/dist/cli/commands/generate-changelog.d.ts.map +1 -0
  171. package/dist/cli/commands/generate-changelog.js +252 -0
  172. package/dist/cli/commands/generate-changelog.js.map +1 -0
  173. package/dist/cli/commands/grade.d.ts +13 -0
  174. package/dist/cli/commands/grade.d.ts.map +1 -0
  175. package/dist/cli/commands/grade.js +26 -0
  176. package/dist/cli/commands/grade.js.map +1 -0
  177. package/dist/cli/commands/history.d.ts +9 -0
  178. package/dist/cli/commands/history.d.ts.map +1 -0
  179. package/dist/cli/commands/history.js +30 -0
  180. package/dist/cli/commands/history.js.map +1 -0
  181. package/dist/cli/commands/implementation.d.ts +13 -0
  182. package/dist/cli/commands/implementation.d.ts.map +1 -0
  183. package/dist/cli/commands/implementation.js +41 -0
  184. package/dist/cli/commands/implementation.js.map +1 -0
  185. package/dist/cli/commands/import-tasks.d.ts +10 -0
  186. package/dist/cli/commands/import-tasks.d.ts.map +1 -0
  187. package/dist/cli/commands/import-tasks.js +38 -0
  188. package/dist/cli/commands/import-tasks.js.map +1 -0
  189. package/dist/cli/commands/import.d.ts +9 -0
  190. package/dist/cli/commands/import.d.ts.map +1 -0
  191. package/dist/cli/commands/import.js +28 -0
  192. package/dist/cli/commands/import.js.map +1 -0
  193. package/dist/cli/commands/init.d.ts +34 -0
  194. package/dist/cli/commands/init.d.ts.map +1 -0
  195. package/dist/cli/commands/init.js +96 -0
  196. package/dist/cli/commands/init.js.map +1 -0
  197. package/dist/cli/commands/inject.d.ts +8 -0
  198. package/dist/cli/commands/inject.d.ts.map +1 -0
  199. package/dist/cli/commands/inject.js +28 -0
  200. package/dist/cli/commands/inject.js.map +1 -0
  201. package/dist/cli/commands/issue.d.ts +17 -0
  202. package/dist/cli/commands/issue.d.ts.map +1 -0
  203. package/dist/cli/commands/issue.js +107 -0
  204. package/dist/cli/commands/issue.js.map +1 -0
  205. package/dist/cli/commands/labels.d.ts +13 -0
  206. package/dist/cli/commands/labels.d.ts.map +1 -0
  207. package/dist/cli/commands/labels.js +44 -0
  208. package/dist/cli/commands/labels.js.map +1 -0
  209. package/dist/cli/commands/lifecycle.d.ts +8 -0
  210. package/dist/cli/commands/lifecycle.d.ts.map +1 -0
  211. package/dist/cli/commands/lifecycle.js +84 -0
  212. package/dist/cli/commands/lifecycle.js.map +1 -0
  213. package/dist/cli/commands/list.d.ts +14 -0
  214. package/dist/cli/commands/list.d.ts.map +1 -0
  215. package/dist/cli/commands/list.js +71 -0
  216. package/dist/cli/commands/list.js.map +1 -0
  217. package/dist/cli/commands/log.d.ts +12 -0
  218. package/dist/cli/commands/log.d.ts.map +1 -0
  219. package/dist/cli/commands/log.js +30 -0
  220. package/dist/cli/commands/log.js.map +1 -0
  221. package/dist/cli/commands/map.d.ts +10 -0
  222. package/dist/cli/commands/map.d.ts.map +1 -0
  223. package/dist/cli/commands/map.js +23 -0
  224. package/dist/cli/commands/map.js.map +1 -0
  225. package/dist/cli/commands/memory-brain.d.ts +14 -0
  226. package/dist/cli/commands/memory-brain.d.ts.map +1 -0
  227. package/dist/cli/commands/memory-brain.js +157 -0
  228. package/dist/cli/commands/memory-brain.js.map +1 -0
  229. package/dist/cli/commands/migrate-claude-mem.d.ts +18 -0
  230. package/dist/cli/commands/migrate-claude-mem.d.ts.map +1 -0
  231. package/dist/cli/commands/migrate-claude-mem.js +60 -0
  232. package/dist/cli/commands/migrate-claude-mem.js.map +1 -0
  233. package/dist/cli/commands/next.d.ts +9 -0
  234. package/dist/cli/commands/next.d.ts.map +1 -0
  235. package/dist/cli/commands/next.js +20 -0
  236. package/dist/cli/commands/next.js.map +1 -0
  237. package/dist/cli/commands/nexus.d.ts +16 -0
  238. package/dist/cli/commands/nexus.d.ts.map +1 -0
  239. package/dist/cli/commands/nexus.js +155 -0
  240. package/dist/cli/commands/nexus.js.map +1 -0
  241. package/dist/cli/commands/observe.d.ts +9 -0
  242. package/dist/cli/commands/observe.d.ts.map +1 -0
  243. package/dist/cli/commands/observe.js +39 -0
  244. package/dist/cli/commands/observe.js.map +1 -0
  245. package/dist/cli/commands/ops.d.ts +10 -0
  246. package/dist/cli/commands/ops.d.ts.map +1 -0
  247. package/dist/cli/commands/ops.js +19 -0
  248. package/dist/cli/commands/ops.js.map +1 -0
  249. package/dist/cli/commands/orchestrate.d.ts +8 -0
  250. package/dist/cli/commands/orchestrate.d.ts.map +1 -0
  251. package/dist/cli/commands/orchestrate.js +58 -0
  252. package/dist/cli/commands/orchestrate.js.map +1 -0
  253. package/dist/cli/commands/otel.d.ts +12 -0
  254. package/dist/cli/commands/otel.d.ts.map +1 -0
  255. package/dist/cli/commands/otel.js +128 -0
  256. package/dist/cli/commands/otel.js.map +1 -0
  257. package/dist/cli/commands/phase.d.ts +12 -0
  258. package/dist/cli/commands/phase.d.ts.map +1 -0
  259. package/dist/cli/commands/phase.js +91 -0
  260. package/dist/cli/commands/phase.js.map +1 -0
  261. package/dist/cli/commands/phases.d.ts +12 -0
  262. package/dist/cli/commands/phases.d.ts.map +1 -0
  263. package/dist/cli/commands/phases.js +37 -0
  264. package/dist/cli/commands/phases.js.map +1 -0
  265. package/dist/cli/commands/plan.d.ts +8 -0
  266. package/dist/cli/commands/plan.d.ts.map +1 -0
  267. package/dist/cli/commands/plan.js +15 -0
  268. package/dist/cli/commands/plan.js.map +1 -0
  269. package/dist/cli/commands/promote.d.ts +7 -0
  270. package/dist/cli/commands/promote.d.ts.map +1 -0
  271. package/dist/cli/commands/promote.js +15 -0
  272. package/dist/cli/commands/promote.js.map +1 -0
  273. package/dist/cli/commands/reason.d.ts +35 -0
  274. package/dist/cli/commands/reason.d.ts.map +1 -0
  275. package/dist/cli/commands/reason.js +104 -0
  276. package/dist/cli/commands/reason.js.map +1 -0
  277. package/dist/cli/commands/refresh-memory.d.ts +9 -0
  278. package/dist/cli/commands/refresh-memory.d.ts.map +1 -0
  279. package/dist/cli/commands/refresh-memory.js +24 -0
  280. package/dist/cli/commands/refresh-memory.js.map +1 -0
  281. package/dist/cli/commands/relates.d.ts +12 -0
  282. package/dist/cli/commands/relates.d.ts.map +1 -0
  283. package/dist/cli/commands/relates.js +53 -0
  284. package/dist/cli/commands/relates.js.map +1 -0
  285. package/dist/cli/commands/release.d.ts +8 -0
  286. package/dist/cli/commands/release.d.ts.map +1 -0
  287. package/dist/cli/commands/release.js +72 -0
  288. package/dist/cli/commands/release.js.map +1 -0
  289. package/dist/cli/commands/remote.d.ts +12 -0
  290. package/dist/cli/commands/remote.d.ts.map +1 -0
  291. package/dist/cli/commands/remote.js +207 -0
  292. package/dist/cli/commands/remote.js.map +1 -0
  293. package/dist/cli/commands/reorder.d.ts +7 -0
  294. package/dist/cli/commands/reorder.d.ts.map +1 -0
  295. package/dist/cli/commands/reorder.js +20 -0
  296. package/dist/cli/commands/reorder.js.map +1 -0
  297. package/dist/cli/commands/reparent.d.ts +10 -0
  298. package/dist/cli/commands/reparent.d.ts.map +1 -0
  299. package/dist/cli/commands/reparent.js +19 -0
  300. package/dist/cli/commands/reparent.js.map +1 -0
  301. package/dist/cli/commands/research.d.ts +8 -0
  302. package/dist/cli/commands/research.d.ts.map +1 -0
  303. package/dist/cli/commands/research.js +129 -0
  304. package/dist/cli/commands/research.js.map +1 -0
  305. package/dist/cli/commands/restore.d.ts +11 -0
  306. package/dist/cli/commands/restore.d.ts.map +1 -0
  307. package/dist/cli/commands/restore.js +224 -0
  308. package/dist/cli/commands/restore.js.map +1 -0
  309. package/dist/cli/commands/roadmap.d.ts +8 -0
  310. package/dist/cli/commands/roadmap.d.ts.map +1 -0
  311. package/dist/cli/commands/roadmap.js +21 -0
  312. package/dist/cli/commands/roadmap.js.map +1 -0
  313. package/dist/cli/commands/safestop.d.ts +14 -0
  314. package/dist/cli/commands/safestop.d.ts.map +1 -0
  315. package/dist/cli/commands/safestop.js +32 -0
  316. package/dist/cli/commands/safestop.js.map +1 -0
  317. package/dist/cli/commands/self-update.d.ts +15 -0
  318. package/dist/cli/commands/self-update.d.ts.map +1 -0
  319. package/dist/cli/commands/self-update.js +329 -0
  320. package/dist/cli/commands/self-update.js.map +1 -0
  321. package/dist/cli/commands/sequence.d.ts +8 -0
  322. package/dist/cli/commands/sequence.d.ts.map +1 -0
  323. package/dist/cli/commands/sequence.js +30 -0
  324. package/dist/cli/commands/sequence.js.map +1 -0
  325. package/dist/cli/commands/session.d.ts +12 -0
  326. package/dist/cli/commands/session.d.ts.map +1 -0
  327. package/dist/cli/commands/session.js +175 -0
  328. package/dist/cli/commands/session.js.map +1 -0
  329. package/dist/cli/commands/show.d.ts +13 -0
  330. package/dist/cli/commands/show.d.ts.map +1 -0
  331. package/dist/cli/commands/show.js +20 -0
  332. package/dist/cli/commands/show.js.map +1 -0
  333. package/dist/cli/commands/skills.d.ts +13 -0
  334. package/dist/cli/commands/skills.d.ts.map +1 -0
  335. package/dist/cli/commands/skills.js +131 -0
  336. package/dist/cli/commands/skills.js.map +1 -0
  337. package/dist/cli/commands/snapshot.d.ts +9 -0
  338. package/dist/cli/commands/snapshot.d.ts.map +1 -0
  339. package/dist/cli/commands/snapshot.js +50 -0
  340. package/dist/cli/commands/snapshot.js.map +1 -0
  341. package/dist/cli/commands/specification.d.ts +13 -0
  342. package/dist/cli/commands/specification.d.ts.map +1 -0
  343. package/dist/cli/commands/specification.js +45 -0
  344. package/dist/cli/commands/specification.js.map +1 -0
  345. package/dist/cli/commands/start.d.ts +13 -0
  346. package/dist/cli/commands/start.d.ts.map +1 -0
  347. package/dist/cli/commands/start.js +20 -0
  348. package/dist/cli/commands/start.js.map +1 -0
  349. package/dist/cli/commands/stats.d.ts +12 -0
  350. package/dist/cli/commands/stats.d.ts.map +1 -0
  351. package/dist/cli/commands/stats.js +35 -0
  352. package/dist/cli/commands/stats.js.map +1 -0
  353. package/dist/cli/commands/sticky.d.ts +16 -0
  354. package/dist/cli/commands/sticky.d.ts.map +1 -0
  355. package/dist/cli/commands/sticky.js +211 -0
  356. package/dist/cli/commands/sticky.js.map +1 -0
  357. package/dist/cli/commands/stop.d.ts +13 -0
  358. package/dist/cli/commands/stop.d.ts.map +1 -0
  359. package/dist/cli/commands/stop.js +20 -0
  360. package/dist/cli/commands/stop.js.map +1 -0
  361. package/dist/cli/commands/testing.d.ts +13 -0
  362. package/dist/cli/commands/testing.d.ts.map +1 -0
  363. package/dist/cli/commands/testing.js +64 -0
  364. package/dist/cli/commands/testing.js.map +1 -0
  365. package/dist/cli/commands/token.d.ts +10 -0
  366. package/dist/cli/commands/token.d.ts.map +1 -0
  367. package/dist/cli/commands/token.js +135 -0
  368. package/dist/cli/commands/token.js.map +1 -0
  369. package/dist/cli/commands/update.d.ts +12 -0
  370. package/dist/cli/commands/update.d.ts.map +1 -0
  371. package/dist/cli/commands/update.js +83 -0
  372. package/dist/cli/commands/update.js.map +1 -0
  373. package/dist/cli/commands/upgrade.d.ts +18 -0
  374. package/dist/cli/commands/upgrade.d.ts.map +1 -0
  375. package/dist/cli/commands/upgrade.js +103 -0
  376. package/dist/cli/commands/upgrade.js.map +1 -0
  377. package/dist/cli/commands/validate.d.ts +12 -0
  378. package/dist/cli/commands/validate.d.ts.map +1 -0
  379. package/dist/cli/commands/validate.js +23 -0
  380. package/dist/cli/commands/validate.js.map +1 -0
  381. package/dist/cli/commands/verify.d.ts +8 -0
  382. package/dist/cli/commands/verify.d.ts.map +1 -0
  383. package/dist/cli/commands/verify.js +28 -0
  384. package/dist/cli/commands/verify.js.map +1 -0
  385. package/dist/cli/commands/web.d.ts +13 -0
  386. package/dist/cli/commands/web.d.ts.map +1 -0
  387. package/dist/cli/commands/web.js +277 -0
  388. package/dist/cli/commands/web.js.map +1 -0
  389. package/dist/cli/field-context.d.ts +32 -0
  390. package/dist/cli/field-context.d.ts.map +1 -0
  391. package/dist/cli/field-context.js +47 -0
  392. package/dist/cli/field-context.js.map +1 -0
  393. package/dist/cli/format-context.d.ts +32 -0
  394. package/dist/cli/format-context.d.ts.map +1 -0
  395. package/dist/cli/format-context.js +50 -0
  396. package/dist/cli/format-context.js.map +1 -0
  397. package/dist/cli/index.d.ts +9 -0
  398. package/dist/cli/index.d.ts.map +1 -0
  399. package/dist/cli/index.js +3931 -3401
  400. package/dist/cli/index.js.map +4 -4
  401. package/dist/cli/logger-bootstrap.d.ts +6 -0
  402. package/dist/cli/logger-bootstrap.d.ts.map +1 -0
  403. package/dist/cli/logger-bootstrap.js +10 -0
  404. package/dist/cli/logger-bootstrap.js.map +1 -0
  405. package/dist/cli/middleware/output-format.d.ts +30 -0
  406. package/dist/cli/middleware/output-format.d.ts.map +1 -0
  407. package/dist/cli/middleware/output-format.js +35 -0
  408. package/dist/cli/middleware/output-format.js.map +1 -0
  409. package/dist/cli/progress.d.ts +84 -0
  410. package/dist/cli/progress.d.ts.map +1 -0
  411. package/dist/cli/progress.js +169 -0
  412. package/dist/cli/progress.js.map +1 -0
  413. package/dist/cli/renderers/colors.d.ts +32 -0
  414. package/dist/cli/renderers/colors.d.ts.map +1 -0
  415. package/dist/cli/renderers/colors.js +141 -0
  416. package/dist/cli/renderers/colors.js.map +1 -0
  417. package/dist/cli/renderers/error.d.ts +13 -0
  418. package/dist/cli/renderers/error.d.ts.map +1 -0
  419. package/dist/cli/renderers/error.js +42 -0
  420. package/dist/cli/renderers/error.js.map +1 -0
  421. package/dist/cli/renderers/index.d.ts +59 -0
  422. package/dist/cli/renderers/index.d.ts.map +1 -0
  423. package/dist/cli/renderers/index.js +208 -0
  424. package/dist/cli/renderers/index.js.map +1 -0
  425. package/dist/cli/renderers/lafs-validator.d.ts +97 -0
  426. package/dist/cli/renderers/lafs-validator.d.ts.map +1 -0
  427. package/dist/cli/renderers/lafs-validator.js +229 -0
  428. package/dist/cli/renderers/lafs-validator.js.map +1 -0
  429. package/dist/cli/renderers/normalizer.d.ts +21 -0
  430. package/dist/cli/renderers/normalizer.d.ts.map +1 -0
  431. package/dist/cli/renderers/normalizer.js +106 -0
  432. package/dist/cli/renderers/normalizer.js.map +1 -0
  433. package/dist/cli/renderers/system.d.ts +25 -0
  434. package/dist/cli/renderers/system.d.ts.map +1 -0
  435. package/dist/cli/renderers/system.js +416 -0
  436. package/dist/cli/renderers/system.js.map +1 -0
  437. package/dist/cli/renderers/tasks.d.ts +28 -0
  438. package/dist/cli/renderers/tasks.d.ts.map +1 -0
  439. package/dist/cli/renderers/tasks.js +306 -0
  440. package/dist/cli/renderers/tasks.js.map +1 -0
  441. package/dist/dispatch/adapters/cli.d.ts +67 -0
  442. package/dist/dispatch/adapters/cli.d.ts.map +1 -0
  443. package/dist/dispatch/adapters/cli.js +262 -0
  444. package/dist/dispatch/adapters/cli.js.map +1 -0
  445. package/dist/dispatch/context/session-context.d.ts +54 -0
  446. package/dist/dispatch/context/session-context.d.ts.map +1 -0
  447. package/dist/dispatch/context/session-context.js +61 -0
  448. package/dist/dispatch/context/session-context.js.map +1 -0
  449. package/dist/dispatch/dispatcher.d.ts +23 -0
  450. package/dist/dispatch/dispatcher.d.ts.map +1 -0
  451. package/dist/dispatch/dispatcher.js +84 -0
  452. package/dist/dispatch/dispatcher.js.map +1 -0
  453. package/dist/dispatch/domains/_base.d.ts +59 -0
  454. package/dist/dispatch/domains/_base.d.ts.map +1 -0
  455. package/dist/dispatch/domains/_base.js +77 -0
  456. package/dist/dispatch/domains/_base.js.map +1 -0
  457. package/dist/dispatch/domains/_meta.d.ts +23 -0
  458. package/dist/dispatch/domains/_meta.d.ts.map +1 -0
  459. package/dist/dispatch/domains/_meta.js +25 -0
  460. package/dist/dispatch/domains/_meta.js.map +1 -0
  461. package/dist/dispatch/domains/_routing.d.ts +8 -0
  462. package/dist/dispatch/domains/_routing.d.ts.map +1 -0
  463. package/dist/dispatch/domains/_routing.js +20 -0
  464. package/dist/dispatch/domains/_routing.js.map +1 -0
  465. package/dist/dispatch/domains/admin.d.ts +25 -0
  466. package/dist/dispatch/domains/admin.d.ts.map +1 -0
  467. package/dist/dispatch/domains/admin.js +719 -0
  468. package/dist/dispatch/domains/admin.js.map +1 -0
  469. package/dist/dispatch/domains/check.d.ts +22 -0
  470. package/dist/dispatch/domains/check.d.ts.map +1 -0
  471. package/dist/dispatch/domains/check.js +360 -0
  472. package/dist/dispatch/domains/check.js.map +1 -0
  473. package/dist/dispatch/domains/conduit.d.ts +38 -0
  474. package/dist/dispatch/domains/conduit.d.ts.map +1 -0
  475. package/dist/dispatch/domains/conduit.js +247 -0
  476. package/dist/dispatch/domains/conduit.js.map +1 -0
  477. package/dist/dispatch/domains/index.d.ts +27 -0
  478. package/dist/dispatch/domains/index.d.ts.map +1 -0
  479. package/dist/dispatch/domains/index.js +40 -0
  480. package/dist/dispatch/domains/index.js.map +1 -0
  481. package/dist/dispatch/domains/memory.d.ts +22 -0
  482. package/dist/dispatch/domains/memory.d.ts.map +1 -0
  483. package/dist/dispatch/domains/memory.js +303 -0
  484. package/dist/dispatch/domains/memory.js.map +1 -0
  485. package/dist/dispatch/domains/nexus.d.ts +22 -0
  486. package/dist/dispatch/domains/nexus.d.ts.map +1 -0
  487. package/dist/dispatch/domains/nexus.js +286 -0
  488. package/dist/dispatch/domains/nexus.js.map +1 -0
  489. package/dist/dispatch/domains/orchestrate.d.ts +19 -0
  490. package/dist/dispatch/domains/orchestrate.d.ts.map +1 -0
  491. package/dist/dispatch/domains/orchestrate.js +259 -0
  492. package/dist/dispatch/domains/orchestrate.js.map +1 -0
  493. package/dist/dispatch/domains/pipeline.d.ts +35 -0
  494. package/dist/dispatch/domains/pipeline.d.ts.map +1 -0
  495. package/dist/dispatch/domains/pipeline.js +593 -0
  496. package/dist/dispatch/domains/pipeline.js.map +1 -0
  497. package/dist/dispatch/domains/session.d.ts +22 -0
  498. package/dist/dispatch/domains/session.d.ts.map +1 -0
  499. package/dist/dispatch/domains/session.js +257 -0
  500. package/dist/dispatch/domains/session.js.map +1 -0
  501. package/dist/dispatch/domains/sticky.d.ts +20 -0
  502. package/dist/dispatch/domains/sticky.d.ts.map +1 -0
  503. package/dist/dispatch/domains/sticky.js +164 -0
  504. package/dist/dispatch/domains/sticky.js.map +1 -0
  505. package/dist/dispatch/domains/tasks.d.ts +25 -0
  506. package/dist/dispatch/domains/tasks.d.ts.map +1 -0
  507. package/dist/dispatch/domains/tasks.js +361 -0
  508. package/dist/dispatch/domains/tasks.js.map +1 -0
  509. package/dist/dispatch/domains/tools.d.ts +37 -0
  510. package/dist/dispatch/domains/tools.d.ts.map +1 -0
  511. package/dist/dispatch/domains/tools.js +481 -0
  512. package/dist/dispatch/domains/tools.js.map +1 -0
  513. package/dist/dispatch/engines/_error.d.ts +85 -0
  514. package/dist/dispatch/engines/_error.d.ts.map +1 -0
  515. package/dist/dispatch/engines/_error.js +244 -0
  516. package/dist/dispatch/engines/_error.js.map +1 -0
  517. package/dist/dispatch/engines/code-engine.d.ts +18 -0
  518. package/dist/dispatch/engines/code-engine.d.ts.map +1 -0
  519. package/dist/dispatch/engines/code-engine.js +71 -0
  520. package/dist/dispatch/engines/code-engine.js.map +1 -0
  521. package/dist/dispatch/engines/codebase-map-engine.d.ts +31 -0
  522. package/dist/dispatch/engines/codebase-map-engine.d.ts.map +1 -0
  523. package/dist/dispatch/engines/codebase-map-engine.js +43 -0
  524. package/dist/dispatch/engines/codebase-map-engine.js.map +1 -0
  525. package/dist/dispatch/engines/config-engine.d.ts +32 -0
  526. package/dist/dispatch/engines/config-engine.d.ts.map +1 -0
  527. package/dist/dispatch/engines/config-engine.js +70 -0
  528. package/dist/dispatch/engines/config-engine.js.map +1 -0
  529. package/dist/dispatch/engines/hooks-engine.d.ts +96 -0
  530. package/dist/dispatch/engines/hooks-engine.d.ts.map +1 -0
  531. package/dist/dispatch/engines/hooks-engine.js +144 -0
  532. package/dist/dispatch/engines/hooks-engine.js.map +1 -0
  533. package/dist/dispatch/engines/init-engine.d.ts +56 -0
  534. package/dist/dispatch/engines/init-engine.d.ts.map +1 -0
  535. package/dist/dispatch/engines/init-engine.js +78 -0
  536. package/dist/dispatch/engines/init-engine.js.map +1 -0
  537. package/dist/dispatch/engines/lifecycle-engine.d.ts +66 -0
  538. package/dist/dispatch/engines/lifecycle-engine.d.ts.map +1 -0
  539. package/dist/dispatch/engines/lifecycle-engine.js +224 -0
  540. package/dist/dispatch/engines/lifecycle-engine.js.map +1 -0
  541. package/dist/dispatch/engines/memory-engine.d.ts +10 -0
  542. package/dist/dispatch/engines/memory-engine.d.ts.map +1 -0
  543. package/dist/dispatch/engines/memory-engine.js +10 -0
  544. package/dist/dispatch/engines/memory-engine.js.map +1 -0
  545. package/dist/dispatch/engines/nexus-engine.d.ts +167 -0
  546. package/dist/dispatch/engines/nexus-engine.d.ts.map +1 -0
  547. package/dist/dispatch/engines/nexus-engine.js +356 -0
  548. package/dist/dispatch/engines/nexus-engine.js.map +1 -0
  549. package/dist/dispatch/engines/orchestrate-engine.d.ts +133 -0
  550. package/dist/dispatch/engines/orchestrate-engine.d.ts.map +1 -0
  551. package/dist/dispatch/engines/orchestrate-engine.js +769 -0
  552. package/dist/dispatch/engines/orchestrate-engine.js.map +1 -0
  553. package/dist/dispatch/engines/pipeline-engine.d.ts +51 -0
  554. package/dist/dispatch/engines/pipeline-engine.d.ts.map +1 -0
  555. package/dist/dispatch/engines/pipeline-engine.js +191 -0
  556. package/dist/dispatch/engines/pipeline-engine.js.map +1 -0
  557. package/dist/dispatch/engines/release-engine.d.ts +94 -0
  558. package/dist/dispatch/engines/release-engine.d.ts.map +1 -0
  559. package/dist/dispatch/engines/release-engine.js +763 -0
  560. package/dist/dispatch/engines/release-engine.js.map +1 -0
  561. package/dist/dispatch/engines/session-engine.d.ts +383 -0
  562. package/dist/dispatch/engines/session-engine.d.ts.map +1 -0
  563. package/dist/dispatch/engines/session-engine.js +960 -0
  564. package/dist/dispatch/engines/session-engine.js.map +1 -0
  565. package/dist/dispatch/engines/sticky-engine.d.ts +100 -0
  566. package/dist/dispatch/engines/sticky-engine.d.ts.map +1 -0
  567. package/dist/dispatch/engines/sticky-engine.js +181 -0
  568. package/dist/dispatch/engines/sticky-engine.js.map +1 -0
  569. package/dist/dispatch/engines/system-engine.d.ts +539 -0
  570. package/dist/dispatch/engines/system-engine.d.ts.map +1 -0
  571. package/dist/dispatch/engines/system-engine.js +1266 -0
  572. package/dist/dispatch/engines/system-engine.js.map +1 -0
  573. package/dist/dispatch/engines/task-engine.d.ts +1055 -0
  574. package/dist/dispatch/engines/task-engine.d.ts.map +1 -0
  575. package/dist/dispatch/engines/task-engine.js +1387 -0
  576. package/dist/dispatch/engines/task-engine.js.map +1 -0
  577. package/dist/dispatch/engines/template-parser.d.ts +85 -0
  578. package/dist/dispatch/engines/template-parser.d.ts.map +1 -0
  579. package/dist/dispatch/engines/template-parser.js +108 -0
  580. package/dist/dispatch/engines/template-parser.js.map +1 -0
  581. package/dist/dispatch/engines/tools-engine.d.ts +270 -0
  582. package/dist/dispatch/engines/tools-engine.d.ts.map +1 -0
  583. package/dist/dispatch/engines/tools-engine.js +636 -0
  584. package/dist/dispatch/engines/tools-engine.js.map +1 -0
  585. package/dist/dispatch/engines/validate-engine.d.ts +218 -0
  586. package/dist/dispatch/engines/validate-engine.d.ts.map +1 -0
  587. package/dist/dispatch/engines/validate-engine.js +737 -0
  588. package/dist/dispatch/engines/validate-engine.js.map +1 -0
  589. package/dist/dispatch/index.d.ts +20 -0
  590. package/dist/dispatch/index.d.ts.map +1 -0
  591. package/dist/dispatch/index.js +19 -0
  592. package/dist/dispatch/index.js.map +1 -0
  593. package/dist/dispatch/lib/background-jobs.d.ts +86 -0
  594. package/dist/dispatch/lib/background-jobs.d.ts.map +1 -0
  595. package/dist/dispatch/lib/background-jobs.js +183 -0
  596. package/dist/dispatch/lib/background-jobs.js.map +1 -0
  597. package/dist/dispatch/lib/budget.d.ts +35 -0
  598. package/dist/dispatch/lib/budget.d.ts.map +1 -0
  599. package/dist/dispatch/lib/budget.js +102 -0
  600. package/dist/dispatch/lib/budget.js.map +1 -0
  601. package/dist/dispatch/lib/capability-matrix.d.ts +11 -0
  602. package/dist/dispatch/lib/capability-matrix.d.ts.map +1 -0
  603. package/dist/dispatch/lib/capability-matrix.js +10 -0
  604. package/dist/dispatch/lib/capability-matrix.js.map +1 -0
  605. package/dist/dispatch/lib/config-loader.d.ts +42 -0
  606. package/dist/dispatch/lib/config-loader.d.ts.map +1 -0
  607. package/dist/dispatch/lib/config-loader.js +217 -0
  608. package/dist/dispatch/lib/config-loader.js.map +1 -0
  609. package/dist/dispatch/lib/config.d.ts +11 -0
  610. package/dist/dispatch/lib/config.d.ts.map +1 -0
  611. package/dist/dispatch/lib/config.js +10 -0
  612. package/dist/dispatch/lib/config.js.map +1 -0
  613. package/dist/dispatch/lib/defaults.d.ts +117 -0
  614. package/dist/dispatch/lib/defaults.d.ts.map +1 -0
  615. package/dist/dispatch/lib/defaults.js +58 -0
  616. package/dist/dispatch/lib/defaults.js.map +1 -0
  617. package/dist/dispatch/lib/engine.d.ts +26 -0
  618. package/dist/dispatch/lib/engine.d.ts.map +1 -0
  619. package/dist/dispatch/lib/engine.js +46 -0
  620. package/dist/dispatch/lib/engine.js.map +1 -0
  621. package/dist/dispatch/lib/gateway-meta.d.ts +37 -0
  622. package/dist/dispatch/lib/gateway-meta.d.ts.map +1 -0
  623. package/dist/dispatch/lib/gateway-meta.js +50 -0
  624. package/dist/dispatch/lib/gateway-meta.js.map +1 -0
  625. package/dist/dispatch/lib/job-manager-accessor.d.ts +9 -0
  626. package/dist/dispatch/lib/job-manager-accessor.d.ts.map +1 -0
  627. package/dist/dispatch/lib/job-manager-accessor.js +13 -0
  628. package/dist/dispatch/lib/job-manager-accessor.js.map +1 -0
  629. package/dist/dispatch/lib/meta.d.ts +26 -0
  630. package/dist/dispatch/lib/meta.d.ts.map +1 -0
  631. package/dist/dispatch/lib/meta.js +37 -0
  632. package/dist/dispatch/lib/meta.js.map +1 -0
  633. package/dist/dispatch/lib/param-utils.d.ts +11 -0
  634. package/dist/dispatch/lib/param-utils.d.ts.map +1 -0
  635. package/dist/dispatch/lib/param-utils.js +10 -0
  636. package/dist/dispatch/lib/param-utils.js.map +1 -0
  637. package/dist/dispatch/lib/projections.d.ts +56 -0
  638. package/dist/dispatch/lib/projections.d.ts.map +1 -0
  639. package/dist/dispatch/lib/projections.js +65 -0
  640. package/dist/dispatch/lib/projections.js.map +1 -0
  641. package/dist/dispatch/lib/schema-utils.d.ts +39 -0
  642. package/dist/dispatch/lib/schema-utils.d.ts.map +1 -0
  643. package/dist/dispatch/lib/schema-utils.js +88 -0
  644. package/dist/dispatch/lib/schema-utils.js.map +1 -0
  645. package/dist/dispatch/lib/security.d.ts +11 -0
  646. package/dist/dispatch/lib/security.d.ts.map +1 -0
  647. package/dist/dispatch/lib/security.js +10 -0
  648. package/dist/dispatch/lib/security.js.map +1 -0
  649. package/dist/dispatch/middleware/audit.d.ts +23 -0
  650. package/dist/dispatch/middleware/audit.d.ts.map +1 -0
  651. package/dist/dispatch/middleware/audit.js +169 -0
  652. package/dist/dispatch/middleware/audit.js.map +1 -0
  653. package/dist/dispatch/middleware/field-filter.d.ts +24 -0
  654. package/dist/dispatch/middleware/field-filter.d.ts.map +1 -0
  655. package/dist/dispatch/middleware/field-filter.js +65 -0
  656. package/dist/dispatch/middleware/field-filter.js.map +1 -0
  657. package/dist/dispatch/middleware/pipeline.d.ts +33 -0
  658. package/dist/dispatch/middleware/pipeline.d.ts.map +1 -0
  659. package/dist/dispatch/middleware/pipeline.js +60 -0
  660. package/dist/dispatch/middleware/pipeline.js.map +1 -0
  661. package/dist/dispatch/middleware/projection.d.ts +35 -0
  662. package/dist/dispatch/middleware/projection.d.ts.map +1 -0
  663. package/dist/dispatch/middleware/projection.js +146 -0
  664. package/dist/dispatch/middleware/projection.js.map +1 -0
  665. package/dist/dispatch/middleware/protocol-enforcement.d.ts +27 -0
  666. package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +1 -0
  667. package/dist/dispatch/middleware/protocol-enforcement.js +45 -0
  668. package/dist/dispatch/middleware/protocol-enforcement.js.map +1 -0
  669. package/dist/dispatch/middleware/rate-limiter.d.ts +72 -0
  670. package/dist/dispatch/middleware/rate-limiter.d.ts.map +1 -0
  671. package/dist/dispatch/middleware/rate-limiter.js +127 -0
  672. package/dist/dispatch/middleware/rate-limiter.js.map +1 -0
  673. package/dist/dispatch/middleware/sanitizer.d.ts +24 -0
  674. package/dist/dispatch/middleware/sanitizer.d.ts.map +1 -0
  675. package/dist/dispatch/middleware/sanitizer.js +56 -0
  676. package/dist/dispatch/middleware/sanitizer.js.map +1 -0
  677. package/dist/dispatch/middleware/session-resolver.d.ts +26 -0
  678. package/dist/dispatch/middleware/session-resolver.d.ts.map +1 -0
  679. package/dist/dispatch/middleware/session-resolver.js +65 -0
  680. package/dist/dispatch/middleware/session-resolver.js.map +1 -0
  681. package/dist/dispatch/middleware/verification-gates.d.ts +22 -0
  682. package/dist/dispatch/middleware/verification-gates.d.ts.map +1 -0
  683. package/dist/dispatch/middleware/verification-gates.js +59 -0
  684. package/dist/dispatch/middleware/verification-gates.js.map +1 -0
  685. package/dist/dispatch/registry.d.ts +91 -0
  686. package/dist/dispatch/registry.d.ts.map +1 -0
  687. package/dist/dispatch/registry.js +3133 -0
  688. package/dist/dispatch/registry.js.map +1 -0
  689. package/dist/dispatch/types.d.ts +202 -0
  690. package/dist/dispatch/types.d.ts.map +1 -0
  691. package/dist/dispatch/types.js +26 -0
  692. package/dist/dispatch/types.js.map +1 -0
  693. package/package.json +7 -7
@@ -0,0 +1,24 @@
1
+ /**
2
+ * LAFS Field Filter Middleware
3
+ *
4
+ * Implements LAFS _fields parameter (field selection) and _mvi envelope verbosity.
5
+ * Extracts _fields and _mvi from params (for callers that pass them as params),
6
+ * stores them on the request, and post-processes the response via the canonical
7
+ * SDK utilities from @cleocode/lafs v1.5.0.
8
+ *
9
+ * @epic T4820
10
+ * @task T4979
11
+ */
12
+ import type { Middleware } from '../types.js';
13
+ /**
14
+ * Create the LAFS field-filter middleware.
15
+ *
16
+ * Handles:
17
+ * - _fields: filter response data to specified fields (delegates to SDK applyFieldFilter)
18
+ * - _mvi: envelope verbosity — stored on request for downstream use
19
+ *
20
+ * _fields and _mvi are extracted from req.params (for callers that pass
21
+ * them as params) and stored on the DispatchRequest before the domain handler runs.
22
+ */
23
+ export declare function createFieldFilter(): Middleware;
24
+ //# sourceMappingURL=field-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-filter.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/field-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CA+C9C"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * LAFS Field Filter Middleware
3
+ *
4
+ * Implements LAFS _fields parameter (field selection) and _mvi envelope verbosity.
5
+ * Extracts _fields and _mvi from params (for callers that pass them as params),
6
+ * stores them on the request, and post-processes the response via the canonical
7
+ * SDK utilities from @cleocode/lafs v1.5.0.
8
+ *
9
+ * @epic T4820
10
+ * @task T4979
11
+ */
12
+ import { isMVILevel, applyFieldFilter as sdkApplyFieldFilter } from '@cleocode/lafs';
13
+ /**
14
+ * Create the LAFS field-filter middleware.
15
+ *
16
+ * Handles:
17
+ * - _fields: filter response data to specified fields (delegates to SDK applyFieldFilter)
18
+ * - _mvi: envelope verbosity — stored on request for downstream use
19
+ *
20
+ * _fields and _mvi are extracted from req.params (for callers that pass
21
+ * them as params) and stored on the DispatchRequest before the domain handler runs.
22
+ */
23
+ export function createFieldFilter() {
24
+ return async (req, next) => {
25
+ // Extract control params from req.params (callers may pass them here)
26
+ const _fields = req._fields ?? req.params?._fields;
27
+ const rawMvi = req._mvi ?? req.params?._mvi;
28
+ const _mvi = isMVILevel(rawMvi) ? rawMvi : undefined;
29
+ // Remove from params so domain handlers don't see them
30
+ if (req.params) {
31
+ delete req.params['_fields'];
32
+ delete req.params['_mvi'];
33
+ }
34
+ // Store on request for potential downstream use
35
+ if (_fields)
36
+ req._fields = _fields;
37
+ if (_mvi)
38
+ req._mvi = _mvi;
39
+ const response = await next();
40
+ // Apply _fields filter via SDK — handles all four result shapes,
41
+ // preserves envelope structure, sets _meta.mvi = 'custom' per §9.1
42
+ if (_fields?.length && response.success && response.data !== undefined) {
43
+ const stub = {
44
+ $schema: 'https://lafs.dev/schemas/v1/envelope.schema.json',
45
+ _meta: {
46
+ specVersion: '',
47
+ schemaVersion: '',
48
+ timestamp: response._meta.timestamp,
49
+ operation: response._meta.operation,
50
+ requestId: response._meta.requestId,
51
+ transport: 'sdk',
52
+ strict: true,
53
+ mvi: 'minimal',
54
+ contextVersion: 0,
55
+ },
56
+ success: true,
57
+ result: response.data,
58
+ };
59
+ const filtered = sdkApplyFieldFilter(stub, _fields);
60
+ response.data = filtered.result;
61
+ }
62
+ return response;
63
+ };
64
+ }
65
+ //# sourceMappingURL=field-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-filter.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/field-filter.ts"],"names":[],"m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EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;oBACnC,SAAS,EAAE,KAAK;oBAChB,MAAM,EAAE,IAAI;oBACZ,GAAG,EAAE,SAAS;oBACd,cAAc,EAAE,CAAC;iBAClB;gBACD,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,QAAQ,CAAC,IAA8B;aAChD,CAAC;YACF,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;QAClC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Unified CQRS Dispatch Layer -- Middleware Pipeline
3
+ *
4
+ * Provides compose() to chain multiple Middleware functions together
5
+ * into a single executable pipeline.
6
+ *
7
+ * @epic T4820
8
+ * @task T4815
9
+ */
10
+ import type { Middleware } from '../types.js';
11
+ /**
12
+ * Composes an array of Middleware functions into a single Middleware function.
13
+ * Execution flows through the array from first to last, and returns bubble
14
+ * back up from last to first.
15
+ *
16
+ * @remarks
17
+ * Uses an index-tracked dispatch function to prevent `next()` from being
18
+ * called multiple times within a single middleware. If the array is empty,
19
+ * a passthrough middleware that immediately calls `next()` is returned.
20
+ *
21
+ * @param middlewares - Array of middleware functions to chain
22
+ * @returns A single composed Middleware function
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { compose } from './pipeline.js';
27
+ *
28
+ * const pipeline = compose([sanitizer, rateLimiter, protocolEnforcement]);
29
+ * const response = await pipeline(request, handler);
30
+ * ```
31
+ */
32
+ export declare function compose(middlewares: Middleware[]): Middleware;
33
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAmD,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAkC7D"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Unified CQRS Dispatch Layer -- Middleware Pipeline
3
+ *
4
+ * Provides compose() to chain multiple Middleware functions together
5
+ * into a single executable pipeline.
6
+ *
7
+ * @epic T4820
8
+ * @task T4815
9
+ */
10
+ /**
11
+ * Composes an array of Middleware functions into a single Middleware function.
12
+ * Execution flows through the array from first to last, and returns bubble
13
+ * back up from last to first.
14
+ *
15
+ * @remarks
16
+ * Uses an index-tracked dispatch function to prevent `next()` from being
17
+ * called multiple times within a single middleware. If the array is empty,
18
+ * a passthrough middleware that immediately calls `next()` is returned.
19
+ *
20
+ * @param middlewares - Array of middleware functions to chain
21
+ * @returns A single composed Middleware function
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { compose } from './pipeline.js';
26
+ *
27
+ * const pipeline = compose([sanitizer, rateLimiter, protocolEnforcement]);
28
+ * const response = await pipeline(request, handler);
29
+ * ```
30
+ */
31
+ export function compose(middlewares) {
32
+ if (middlewares.length === 0) {
33
+ return async (_req, next) => next();
34
+ }
35
+ return async (request, next) => {
36
+ let index = -1;
37
+ async function dispatch(i) {
38
+ if (i <= index) {
39
+ throw new Error('next() called multiple times in middleware');
40
+ }
41
+ index = i;
42
+ let fn = middlewares[i];
43
+ if (i === middlewares.length) {
44
+ // We've reached the end of the middleware chain; call the final handler
45
+ fn = async (_req, nxt) => nxt();
46
+ }
47
+ if (!fn) {
48
+ return next();
49
+ }
50
+ return fn(request, async () => {
51
+ if (i === middlewares.length) {
52
+ return next();
53
+ }
54
+ return dispatch(i + 1);
55
+ });
56
+ }
57
+ return dispatch(0);
58
+ };
59
+ }
60
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../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ier from request params and filters response fields accordingly.
4
+ * If the domain is not allowed at the resolved tier, short-circuits with an error.
5
+ *
6
+ * @epic T4820
7
+ * @task T5096
8
+ */
9
+ import { type MviTier, type ProjectionConfig } from '../lib/projections.js';
10
+ import type { Middleware } from '../types.js';
11
+ export interface ProjectionContext {
12
+ tier: MviTier;
13
+ config: ProjectionConfig;
14
+ }
15
+ /**
16
+ * Check if a domain is allowed at the given tier.
17
+ */
18
+ export declare function isOperationAllowed(domain: string, tier: MviTier): boolean;
19
+ /**
20
+ * Apply field projection to a result object.
21
+ * Removes fields that are excluded at the given tier and prunes depth.
22
+ */
23
+ export declare function applyProjection<T>(data: T, config: ProjectionConfig): T;
24
+ /**
25
+ * Create projection context from request params.
26
+ */
27
+ export declare function createProjectionContext(params?: Record<string, unknown>): ProjectionContext;
28
+ /**
29
+ * Create the MVI projection middleware.
30
+ *
31
+ * Extracts _mviTier from params, checks domain access, and applies
32
+ * field exclusions to the response.
33
+ */
34
+ export declare function createProjectionMiddleware(): Middleware;
35
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAEzE;AAiCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,CAAC,CAuCvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAG3F;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,UAAU,CAsDvD"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * MVI projection middleware.
3
+ * Reads _mviTier from request params and filters response fields accordingly.
4
+ * If the domain is not allowed at the resolved tier, short-circuits with an error.
5
+ *
6
+ * @epic T4820
7
+ * @task T5096
8
+ */
9
+ import { getBoundSession } from '../context/session-context.js';
10
+ import { PROJECTIONS, resolveTier, } from '../lib/projections.js';
11
+ /**
12
+ * Check if a domain is allowed at the given tier.
13
+ */
14
+ export function isOperationAllowed(domain, tier) {
15
+ return PROJECTIONS[tier].allowedDomains.includes(domain);
16
+ }
17
+ /**
18
+ * Recursively prune data beyond maxDepth.
19
+ * At maxDepth, objects become '[Object]' and arrays become '[Array(N)]'.
20
+ */
21
+ function pruneDepth(data, maxDepth, currentDepth = 0) {
22
+ // Primitives pass through at any depth
23
+ if (data === null || data === undefined || typeof data !== 'object') {
24
+ return data;
25
+ }
26
+ // At max depth, replace with placeholder
27
+ if (currentDepth >= maxDepth) {
28
+ if (Array.isArray(data)) {
29
+ return `[Array(${data.length})]`;
30
+ }
31
+ return '[Object]';
32
+ }
33
+ // Recurse into arrays
34
+ if (Array.isArray(data)) {
35
+ return data.map((item) => pruneDepth(item, maxDepth, currentDepth + 1));
36
+ }
37
+ // Recurse into objects
38
+ const result = {};
39
+ for (const [key, value] of Object.entries(data)) {
40
+ result[key] = pruneDepth(value, maxDepth, currentDepth + 1);
41
+ }
42
+ return result;
43
+ }
44
+ /**
45
+ * Apply field projection to a result object.
46
+ * Removes fields that are excluded at the given tier and prunes depth.
47
+ */
48
+ export function applyProjection(data, config) {
49
+ if (!data || typeof data !== 'object')
50
+ return data;
51
+ let result = data;
52
+ // Apply field exclusions
53
+ if (config.excludeFields?.length) {
54
+ const obj = { ...data };
55
+ for (const field of config.excludeFields) {
56
+ const parts = field.split('.');
57
+ if (parts.length === 1) {
58
+ delete obj[parts[0]];
59
+ }
60
+ else {
61
+ // Handle nested fields like 'metadata._internal'
62
+ let current = obj;
63
+ for (let i = 0; i < parts.length - 1; i++) {
64
+ const val = current?.[parts[i]];
65
+ if (val && typeof val === 'object') {
66
+ current[parts[i]] = { ...val };
67
+ current = current[parts[i]];
68
+ }
69
+ else {
70
+ current = undefined;
71
+ break;
72
+ }
73
+ }
74
+ if (current) {
75
+ delete current[parts[parts.length - 1]];
76
+ }
77
+ }
78
+ }
79
+ result = obj;
80
+ }
81
+ // Apply depth pruning
82
+ if (config.maxDepth !== undefined) {
83
+ result = pruneDepth(result, config.maxDepth);
84
+ }
85
+ return result;
86
+ }
87
+ /**
88
+ * Create projection context from request params.
89
+ */
90
+ export function createProjectionContext(params) {
91
+ const tier = resolveTier(params);
92
+ return { tier, config: PROJECTIONS[tier] };
93
+ }
94
+ /**
95
+ * Create the MVI projection middleware.
96
+ *
97
+ * Extracts _mviTier from params, checks domain access, and applies
98
+ * field exclusions to the response.
99
+ */
100
+ export function createProjectionMiddleware() {
101
+ return async (req, next) => {
102
+ const session = getBoundSession();
103
+ const tier = resolveTier(req.params, session?.scope ?? null);
104
+ const config = PROJECTIONS[tier];
105
+ // Remove control param so domain handlers don't see it
106
+ if (req.params) {
107
+ delete req.params['_mviTier'];
108
+ }
109
+ // Smart defaults: tasks.list defaults to compact mode for non-CLI sources.
110
+ // CLI is the only source — compact injection applies to non-CLI callers.
111
+ if (req.domain === 'tasks' && req.operation === 'list' && req.source !== 'cli') {
112
+ req.params ??= {};
113
+ if (req.params['compact'] === undefined) {
114
+ req.params['compact'] = true;
115
+ }
116
+ }
117
+ // Check domain access at this tier
118
+ if (!config.allowedDomains.includes(req.domain)) {
119
+ return {
120
+ _meta: {
121
+ gateway: req.gateway,
122
+ domain: req.domain,
123
+ operation: req.operation,
124
+ version: '1.0.0',
125
+ timestamp: new Date().toISOString(),
126
+ duration_ms: 0,
127
+ source: req.source,
128
+ requestId: req.requestId,
129
+ },
130
+ success: false,
131
+ error: {
132
+ code: 'E_INVALID_OPERATION',
133
+ exitCode: 2,
134
+ message: `Operation not available at '${tier}' tier. Domain '${req.domain}' requires a higher tier.`,
135
+ },
136
+ };
137
+ }
138
+ const response = await next();
139
+ // Apply field exclusions to successful responses
140
+ if (response.success && response.data !== undefined) {
141
+ response.data = applyProjection(response.data, config);
142
+ }
143
+ return response;
144
+ };
145
+ }
146
+ //# sourceMappingURL=projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAEL,WAAW,EAEX,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAQ/B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,IAAa;IAC9D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAa,EAAE,QAAgB,EAAE,eAAuB,CAAC;IAC3E,uCAAuC;IACvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yCAAyC;IACzC,IAAI,YAAY,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC;QACnC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,sBAAsB;IACtB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAA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I,KAAK,SAAS,EAAE,CAAC;YACpD,QAAQ,CAAC,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Middleware } from '../types.js';
2
+ /**
3
+ * Creates a middleware that enforces protocol compliance.
4
+ *
5
+ * Delegates to ProtocolEnforcer.enforceProtocol() which:
6
+ * - Passes through query operations untouched
7
+ * - Passes through mutate operations that don't require validation
8
+ * - Validates protocol compliance on validated mutate operations after execution
9
+ * - In strict mode, blocks operations with protocol violations (exit codes 60-70)
10
+ *
11
+ * @remarks
12
+ * The middleware ensures that DispatchResponse `_meta` fields (source, requestId)
13
+ * are always populated, even when ProtocolEnforcer returns a DomainResponse that
14
+ * lacks them. This prevents downstream consumers from encountering undefined values.
15
+ *
16
+ * @param strictMode - When true, blocks operations that violate protocol rules
17
+ * @returns Middleware function that enforces protocol compliance
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { createProtocolEnforcement } from './protocol-enforcement.js';
22
+ *
23
+ * const enforcement = createProtocolEnforcement(true);
24
+ * ```
25
+ */
26
+ export declare function createProtocolEnforcement(strictMode?: boolean): Middleware;
27
+ //# sourceMappingURL=protocol-enforcement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-enforcement.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/protocol-enforcement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmD,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,GAAE,OAAc,GAAG,UAAU,CAqBhF"}
@@ -0,0 +1,45 @@
1
+ import { ProtocolEnforcer } from '@cleocode/core/internal';
2
+ /**
3
+ * Creates a middleware that enforces protocol compliance.
4
+ *
5
+ * Delegates to ProtocolEnforcer.enforceProtocol() which:
6
+ * - Passes through query operations untouched
7
+ * - Passes through mutate operations that don't require validation
8
+ * - Validates protocol compliance on validated mutate operations after execution
9
+ * - In strict mode, blocks operations with protocol violations (exit codes 60-70)
10
+ *
11
+ * @remarks
12
+ * The middleware ensures that DispatchResponse `_meta` fields (source, requestId)
13
+ * are always populated, even when ProtocolEnforcer returns a DomainResponse that
14
+ * lacks them. This prevents downstream consumers from encountering undefined values.
15
+ *
16
+ * @param strictMode - When true, blocks operations that violate protocol rules
17
+ * @returns Middleware function that enforces protocol compliance
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { createProtocolEnforcement } from './protocol-enforcement.js';
22
+ *
23
+ * const enforcement = createProtocolEnforcement(true);
24
+ * ```
25
+ */
26
+ export function createProtocolEnforcement(strictMode = true) {
27
+ const enforcer = new ProtocolEnforcer(strictMode);
28
+ return async (req, next) => {
29
+ const result = await enforcer.enforceProtocol(req, next);
30
+ // enforceProtocol may return a DomainResponse (missing source/requestId on _meta)
31
+ // when it constructs an error response. Ensure _meta has required DispatchResponse fields.
32
+ if (!result._meta.source || !result._meta.requestId) {
33
+ return {
34
+ ...result,
35
+ _meta: {
36
+ ...result._meta,
37
+ source: result._meta.source ?? req.source,
38
+ requestId: result._meta.requestId ?? req.requestId,
39
+ },
40
+ };
41
+ }
42
+ return result;
43
+ };
44
+ }
45
+ //# sourceMappingURL=protocol-enforcement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-enforcement.js","sourceRoot":"","sources":["../../../src/dispatch/middleware/protocol-enforcement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,yBAAyB,CAAC,aAAsB,IAAI;IAClE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO,KAAK,EAAE,GAAoB,EAAE,IAAkB,EAA6B,EAAE;QACnF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEzD,kFAAkF;QAClF,2FAA2F;QAC3F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,OAAO;gBACL,GAAG,MAAM;gBACT,KAAK,EAAE;oBACL,GAAG,MAAM,CAAC,KAAK;oBACf,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM;oBACzC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS;iBACnD;aACkB,CAAC;QACxB,CAAC;QAED,OAAO,MAA0B,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type { DispatchRequest, Middleware, RateLimitMeta } from '../types.js';
2
+ /**
3
+ * Per-category rate limit thresholds.
4
+ *
5
+ * @remarks
6
+ * Each category (query, mutate, spawn) uses a sliding window algorithm.
7
+ * Requests older than `windowMs` are pruned before checking the count.
8
+ */
9
+ export interface RateLimitConfig {
10
+ /** Maximum number of requests allowed within the window. */
11
+ maxRequests: number;
12
+ /** Sliding window duration in milliseconds. */
13
+ windowMs: number;
14
+ }
15
+ /**
16
+ * Full rate limiting configuration across all categories.
17
+ *
18
+ * @remarks
19
+ * When `enabled` is false, all requests pass through without limit checks.
20
+ */
21
+ export interface RateLimitingConfig {
22
+ /** Whether rate limiting is active. */
23
+ enabled: boolean;
24
+ /** Limits for read-only query operations. */
25
+ query: RateLimitConfig;
26
+ /** Limits for mutate (write) operations. */
27
+ mutate: RateLimitConfig;
28
+ /** Limits for spawn (subagent launch) operations. */
29
+ spawn: RateLimitConfig;
30
+ }
31
+ export declare const DEFAULT_RATE_LIMITING: RateLimitingConfig;
32
+ /**
33
+ * Sliding-window rate limiter for the dispatch pipeline.
34
+ *
35
+ * @remarks
36
+ * Tracks request timestamps per category (query, mutate, spawn) using
37
+ * in-memory sliding window buckets. The `check` method prunes stale
38
+ * timestamps, evaluates the current count, and returns whether the
39
+ * request is allowed along with limit metadata.
40
+ */
41
+ export declare class RateLimiter {
42
+ /** Per-category sliding window buckets. */
43
+ private buckets;
44
+ /** Merged configuration with defaults. */
45
+ private config;
46
+ constructor(config?: Partial<RateLimitingConfig>);
47
+ check(req: DispatchRequest): RateLimitMeta & {
48
+ allowed: boolean;
49
+ };
50
+ private resolveCategory;
51
+ private getLimitConfig;
52
+ }
53
+ /**
54
+ * Creates a rate limiting middleware for the dispatch pipeline.
55
+ *
56
+ * @remarks
57
+ * Attaches rate limit metadata to every response `_meta.rateLimit` field.
58
+ * When the limit is exceeded, returns an error response with code
59
+ * `E_RATE_LIMIT_EXCEEDED` and HTTP-style exit code 429.
60
+ *
61
+ * @param config - Optional partial config to override defaults
62
+ * @returns Middleware function that enforces rate limits
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * import { createRateLimiter } from './rate-limiter.js';
67
+ *
68
+ * const limiter = createRateLimiter({ query: { maxRequests: 50, windowMs: 30_000 } });
69
+ * ```
70
+ */
71
+ export declare function createRateLimiter(config?: Partial<RateLimitingConfig>): Middleware;
72
+ //# sourceMappingURL=rate-limiter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../src/dispatch/middleware/rate-limiter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEf,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,eAAe,CAAC;IACvB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,qDAAqD;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,EAAE,kBAKnC,CAAC;AASF;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAA+C;IAC9D,0CAA0C;IAC1C,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAUhD,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IA2CjE,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;CAGvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,UAAU,CAqClF"}