@cleocode/core 2026.6.13 → 2026.6.15

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 (485) hide show
  1. package/dist/admin/ops.d.ts +4 -0
  2. package/dist/admin/ops.d.ts.map +1 -1
  3. package/dist/check/index.d.ts +12 -0
  4. package/dist/check/index.d.ts.map +1 -0
  5. package/dist/check/index.js +12 -0
  6. package/dist/check/index.js.map +1 -0
  7. package/dist/check/pr-gate.d.ts +183 -0
  8. package/dist/check/pr-gate.d.ts.map +1 -0
  9. package/dist/check/pr-gate.js +348 -0
  10. package/dist/check/pr-gate.js.map +1 -0
  11. package/dist/conduit/delivery-router.d.ts +134 -0
  12. package/dist/conduit/delivery-router.d.ts.map +1 -0
  13. package/dist/conduit/delivery-router.js +0 -0
  14. package/dist/conduit/delivery-router.js.map +1 -0
  15. package/dist/conduit/index.d.ts +5 -2
  16. package/dist/conduit/index.d.ts.map +1 -1
  17. package/dist/conduit/index.js +5 -2
  18. package/dist/conduit/index.js.map +1 -1
  19. package/dist/conduit/local-tui-adapter.d.ts +89 -0
  20. package/dist/conduit/local-tui-adapter.d.ts.map +1 -0
  21. package/dist/conduit/local-tui-adapter.js +225 -0
  22. package/dist/conduit/local-tui-adapter.js.map +1 -0
  23. package/dist/config/config-repair.d.ts +70 -0
  24. package/dist/config/config-repair.d.ts.map +1 -0
  25. package/dist/config/config-repair.js +248 -0
  26. package/dist/config/config-repair.js.map +1 -0
  27. package/dist/config/registry.d.ts +54 -0
  28. package/dist/config/registry.d.ts.map +1 -1
  29. package/dist/config/registry.js +92 -0
  30. package/dist/config/registry.js.map +1 -1
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +11 -10
  33. package/dist/config.js.map +1 -1
  34. package/dist/deriver/queue-manager.d.ts +30 -2
  35. package/dist/deriver/queue-manager.d.ts.map +1 -1
  36. package/dist/deriver/queue-manager.js +54 -9
  37. package/dist/deriver/queue-manager.js.map +1 -1
  38. package/dist/dispatch/config-domain-handler.d.ts +125 -0
  39. package/dist/dispatch/config-domain-handler.d.ts.map +1 -0
  40. package/dist/dispatch/config-domain-handler.js +160 -0
  41. package/dist/dispatch/config-domain-handler.js.map +1 -0
  42. package/dist/dispatch/contracts/input-contracts.d.ts.map +1 -1
  43. package/dist/dispatch/contracts/input-contracts.js +19 -1
  44. package/dist/dispatch/contracts/input-contracts.js.map +1 -1
  45. package/dist/docs/export-document.js +3721 -696
  46. package/dist/docs/export-document.js.map +3 -3
  47. package/dist/gateway-client/client.d.ts +123 -0
  48. package/dist/gateway-client/client.d.ts.map +1 -0
  49. package/dist/gateway-client/client.js +93 -0
  50. package/dist/gateway-client/client.js.map +1 -0
  51. package/dist/gateway-client/generated/client/client.gen.d.ts +3 -0
  52. package/dist/gateway-client/generated/client/client.gen.d.ts.map +1 -0
  53. package/dist/gateway-client/generated/client/client.gen.js +217 -0
  54. package/dist/gateway-client/generated/client/client.gen.js.map +1 -0
  55. package/dist/gateway-client/generated/client/index.d.ts +11 -0
  56. package/dist/gateway-client/generated/client/index.d.ts.map +1 -0
  57. package/dist/gateway-client/generated/client/index.js +7 -0
  58. package/dist/gateway-client/generated/client/index.js.map +1 -0
  59. package/dist/gateway-client/generated/client/types.gen.d.ts +121 -0
  60. package/dist/gateway-client/generated/client/types.gen.d.ts.map +1 -0
  61. package/dist/gateway-client/generated/client/types.gen.js +3 -0
  62. package/dist/gateway-client/generated/client/types.gen.js.map +1 -0
  63. package/dist/gateway-client/generated/client/utils.gen.d.ts +38 -0
  64. package/dist/gateway-client/generated/client/utils.gen.d.ts.map +1 -0
  65. package/dist/gateway-client/generated/client/utils.gen.js +229 -0
  66. package/dist/gateway-client/generated/client/utils.gen.js.map +1 -0
  67. package/dist/gateway-client/generated/client.gen.d.ts +13 -0
  68. package/dist/gateway-client/generated/client.gen.d.ts.map +1 -0
  69. package/dist/gateway-client/generated/client.gen.js +4 -0
  70. package/dist/gateway-client/generated/client.gen.js.map +1 -0
  71. package/dist/gateway-client/generated/core/auth.gen.d.ts +26 -0
  72. package/dist/gateway-client/generated/core/auth.gen.d.ts.map +1 -0
  73. package/dist/gateway-client/generated/core/auth.gen.js +15 -0
  74. package/dist/gateway-client/generated/core/auth.gen.js.map +1 -0
  75. package/dist/gateway-client/generated/core/bodySerializer.gen.d.ts +26 -0
  76. package/dist/gateway-client/generated/core/bodySerializer.gen.d.ts.map +1 -0
  77. package/dist/gateway-client/generated/core/bodySerializer.gen.js +58 -0
  78. package/dist/gateway-client/generated/core/bodySerializer.gen.js.map +1 -0
  79. package/dist/gateway-client/generated/core/params.gen.d.ts +44 -0
  80. package/dist/gateway-client/generated/core/params.gen.d.ts.map +1 -0
  81. package/dist/gateway-client/generated/core/params.gen.js +101 -0
  82. package/dist/gateway-client/generated/core/params.gen.js.map +1 -0
  83. package/dist/gateway-client/generated/core/pathSerializer.gen.d.ts +34 -0
  84. package/dist/gateway-client/generated/core/pathSerializer.gen.d.ts.map +1 -0
  85. package/dist/gateway-client/generated/core/pathSerializer.gen.js +107 -0
  86. package/dist/gateway-client/generated/core/pathSerializer.gen.js.map +1 -0
  87. package/dist/gateway-client/generated/core/queryKeySerializer.gen.d.ts +19 -0
  88. package/dist/gateway-client/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
  89. package/dist/gateway-client/generated/core/queryKeySerializer.gen.js +93 -0
  90. package/dist/gateway-client/generated/core/queryKeySerializer.gen.js.map +1 -0
  91. package/dist/gateway-client/generated/core/serverSentEvents.gen.d.ts +72 -0
  92. package/dist/gateway-client/generated/core/serverSentEvents.gen.d.ts.map +1 -0
  93. package/dist/gateway-client/generated/core/serverSentEvents.gen.js +133 -0
  94. package/dist/gateway-client/generated/core/serverSentEvents.gen.js.map +1 -0
  95. package/dist/gateway-client/generated/core/types.gen.d.ts +84 -0
  96. package/dist/gateway-client/generated/core/types.gen.d.ts.map +1 -0
  97. package/dist/gateway-client/generated/core/types.gen.js +3 -0
  98. package/dist/gateway-client/generated/core/types.gen.js.map +1 -0
  99. package/dist/gateway-client/generated/core/utils.gen.d.ts +20 -0
  100. package/dist/gateway-client/generated/core/utils.gen.d.ts.map +1 -0
  101. package/dist/gateway-client/generated/core/utils.gen.js +88 -0
  102. package/dist/gateway-client/generated/core/utils.gen.js.map +1 -0
  103. package/dist/gateway-client/generated/index.d.ts +3 -0
  104. package/dist/gateway-client/generated/index.d.ts.map +1 -0
  105. package/dist/gateway-client/generated/index.js +3 -0
  106. package/dist/gateway-client/generated/index.js.map +1 -0
  107. package/dist/gateway-client/generated/namespaces.gen.d.ts +512 -0
  108. package/dist/gateway-client/generated/namespaces.gen.d.ts.map +1 -0
  109. package/dist/gateway-client/generated/namespaces.gen.js +521 -0
  110. package/dist/gateway-client/generated/namespaces.gen.js.map +1 -0
  111. package/dist/gateway-client/generated/sdk.gen.d.ts +1780 -0
  112. package/dist/gateway-client/generated/sdk.gen.d.ts.map +1 -0
  113. package/dist/gateway-client/generated/sdk.gen.js +3811 -0
  114. package/dist/gateway-client/generated/sdk.gen.js.map +1 -0
  115. package/dist/gateway-client/generated/types.gen.d.ts +14681 -0
  116. package/dist/gateway-client/generated/types.gen.d.ts.map +1 -0
  117. package/dist/gateway-client/generated/types.gen.js +3 -0
  118. package/dist/gateway-client/generated/types.gen.js.map +1 -0
  119. package/dist/gateway-client/index.d.ts +27 -0
  120. package/dist/gateway-client/index.d.ts.map +1 -0
  121. package/dist/gateway-client/index.js +25 -0
  122. package/dist/gateway-client/index.js.map +1 -0
  123. package/dist/gc/cleanup.d.ts +23 -8
  124. package/dist/gc/cleanup.d.ts.map +1 -1
  125. package/dist/gc/cleanup.js +287 -22
  126. package/dist/gc/cleanup.js.map +1 -1
  127. package/dist/index.d.ts +10 -0
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +20 -0
  130. package/dist/index.js.map +1 -1
  131. package/dist/init.d.ts.map +1 -1
  132. package/dist/init.js +28 -0
  133. package/dist/init.js.map +1 -1
  134. package/dist/internal.d.ts +10 -1
  135. package/dist/internal.d.ts.map +1 -1
  136. package/dist/internal.js +18 -1
  137. package/dist/internal.js.map +1 -1
  138. package/dist/llm/catalog-model-resolver.d.ts +19 -0
  139. package/dist/llm/catalog-model-resolver.d.ts.map +1 -1
  140. package/dist/llm/catalog-model-resolver.js +36 -0
  141. package/dist/llm/catalog-model-resolver.js.map +1 -1
  142. package/dist/llm/catalog-resolver.d.ts +112 -0
  143. package/dist/llm/catalog-resolver.d.ts.map +1 -0
  144. package/dist/llm/catalog-resolver.js +207 -0
  145. package/dist/llm/catalog-resolver.js.map +1 -0
  146. package/dist/llm/catalog-seeder.d.ts +96 -0
  147. package/dist/llm/catalog-seeder.d.ts.map +1 -0
  148. package/dist/llm/catalog-seeder.js +189 -0
  149. package/dist/llm/catalog-seeder.js.map +1 -0
  150. package/dist/llm/cli-ops.d.ts +16 -0
  151. package/dist/llm/cli-ops.d.ts.map +1 -1
  152. package/dist/llm/cli-ops.js +37 -10
  153. package/dist/llm/cli-ops.js.map +1 -1
  154. package/dist/llm/complexity-classifier.d.ts +208 -0
  155. package/dist/llm/complexity-classifier.d.ts.map +1 -0
  156. package/dist/llm/complexity-classifier.js +359 -0
  157. package/dist/llm/complexity-classifier.js.map +1 -0
  158. package/dist/llm/credential-pool.d.ts +2 -0
  159. package/dist/llm/credential-pool.d.ts.map +1 -1
  160. package/dist/llm/credential-pool.js +5 -2
  161. package/dist/llm/credential-pool.js.map +1 -1
  162. package/dist/llm/credentials-store.d.ts +10 -14
  163. package/dist/llm/credentials-store.d.ts.map +1 -1
  164. package/dist/llm/credentials-store.js.map +1 -1
  165. package/dist/llm/cross-provider-selector.d.ts +249 -0
  166. package/dist/llm/cross-provider-selector.d.ts.map +1 -0
  167. package/dist/llm/cross-provider-selector.js +572 -0
  168. package/dist/llm/cross-provider-selector.js.map +1 -0
  169. package/dist/llm/entity-ops.d.ts +299 -0
  170. package/dist/llm/entity-ops.d.ts.map +1 -0
  171. package/dist/llm/entity-ops.js +441 -0
  172. package/dist/llm/entity-ops.js.map +1 -0
  173. package/dist/llm/index.d.ts +17 -0
  174. package/dist/llm/index.d.ts.map +1 -1
  175. package/dist/llm/index.js +9 -0
  176. package/dist/llm/index.js.map +1 -1
  177. package/dist/llm/llm-queue-admit.d.ts +118 -0
  178. package/dist/llm/llm-queue-admit.d.ts.map +1 -0
  179. package/dist/llm/llm-queue-admit.js +275 -0
  180. package/dist/llm/llm-queue-admit.js.map +1 -0
  181. package/dist/llm/local-model-fit.d.ts +260 -0
  182. package/dist/llm/local-model-fit.d.ts.map +1 -0
  183. package/dist/llm/local-model-fit.js +563 -0
  184. package/dist/llm/local-model-fit.js.map +1 -0
  185. package/dist/llm/oauth/device-code.d.ts.map +1 -1
  186. package/dist/llm/oauth/device-code.js +2 -8
  187. package/dist/llm/oauth/device-code.js.map +1 -1
  188. package/dist/llm/oauth/google-pkce.d.ts.map +1 -1
  189. package/dist/llm/oauth/google-pkce.js +2 -18
  190. package/dist/llm/oauth/google-pkce.js.map +1 -1
  191. package/dist/llm/oauth/pkce.d.ts +70 -0
  192. package/dist/llm/oauth/pkce.d.ts.map +1 -1
  193. package/dist/llm/oauth/pkce.js +106 -29
  194. package/dist/llm/oauth/pkce.js.map +1 -1
  195. package/dist/llm/onboarding/front-door.d.ts +146 -0
  196. package/dist/llm/onboarding/front-door.d.ts.map +1 -0
  197. package/dist/llm/onboarding/front-door.js +153 -0
  198. package/dist/llm/onboarding/front-door.js.map +1 -0
  199. package/dist/llm/onboarding/login-engine.d.ts +175 -0
  200. package/dist/llm/onboarding/login-engine.d.ts.map +1 -0
  201. package/dist/llm/onboarding/login-engine.js +286 -0
  202. package/dist/llm/onboarding/login-engine.js.map +1 -0
  203. package/dist/llm/pi/pi-gondolin-env.d.ts +23 -0
  204. package/dist/llm/pi/pi-gondolin-env.d.ts.map +1 -1
  205. package/dist/llm/pi/pi-gondolin-env.js +2 -2
  206. package/dist/llm/pi/pi-gondolin-env.js.map +1 -1
  207. package/dist/llm/plugin-facade.js +4612 -1042
  208. package/dist/llm/plugin-facade.js.map +3 -3
  209. package/dist/llm/provider-registry/builtin/anthropic.d.ts.map +1 -1
  210. package/dist/llm/provider-registry/builtin/anthropic.js +23 -10
  211. package/dist/llm/provider-registry/builtin/anthropic.js.map +1 -1
  212. package/dist/llm/provider-registry/builtin/ollama.d.ts +18 -0
  213. package/dist/llm/provider-registry/builtin/ollama.d.ts.map +1 -1
  214. package/dist/llm/provider-registry/builtin/ollama.js +20 -2
  215. package/dist/llm/provider-registry/builtin/ollama.js.map +1 -1
  216. package/dist/llm/provider-registry/provider-alias.d.ts +62 -0
  217. package/dist/llm/provider-registry/provider-alias.d.ts.map +1 -0
  218. package/dist/llm/provider-registry/provider-alias.js +85 -0
  219. package/dist/llm/provider-registry/provider-alias.js.map +1 -0
  220. package/dist/llm/provider-registry/provider-defs.d.ts +45 -0
  221. package/dist/llm/provider-registry/provider-defs.d.ts.map +1 -0
  222. package/dist/llm/provider-registry/provider-defs.js +145 -0
  223. package/dist/llm/provider-registry/provider-defs.js.map +1 -0
  224. package/dist/llm/provider-registry/provider-seed.d.ts +78 -0
  225. package/dist/llm/provider-registry/provider-seed.d.ts.map +1 -0
  226. package/dist/llm/provider-registry/provider-seed.js +113 -0
  227. package/dist/llm/provider-registry/provider-seed.js.map +1 -0
  228. package/dist/llm/role-executor.d.ts.map +1 -1
  229. package/dist/llm/role-executor.js +36 -0
  230. package/dist/llm/role-executor.js.map +1 -1
  231. package/dist/llm/role-resolver.d.ts.map +1 -1
  232. package/dist/llm/role-resolver.js +52 -10
  233. package/dist/llm/role-resolver.js.map +1 -1
  234. package/dist/llm/system-resolver.d.ts.map +1 -1
  235. package/dist/llm/system-resolver.js +73 -22
  236. package/dist/llm/system-resolver.js.map +1 -1
  237. package/dist/llm/transports/codex-responses.d.ts +111 -88
  238. package/dist/llm/transports/codex-responses.d.ts.map +1 -1
  239. package/dist/llm/transports/codex-responses.js +456 -258
  240. package/dist/llm/transports/codex-responses.js.map +1 -1
  241. package/dist/memory/learnings.d.ts +4 -0
  242. package/dist/memory/learnings.d.ts.map +1 -1
  243. package/dist/memory/patterns.d.ts +4 -0
  244. package/dist/memory/patterns.d.ts.map +1 -1
  245. package/dist/metrics/index.d.ts +2 -0
  246. package/dist/metrics/index.d.ts.map +1 -1
  247. package/dist/metrics/index.js +1 -0
  248. package/dist/metrics/index.js.map +1 -1
  249. package/dist/orchestration/spawn.d.ts +89 -0
  250. package/dist/orchestration/spawn.d.ts.map +1 -1
  251. package/dist/orchestration/spawn.js +68 -0
  252. package/dist/orchestration/spawn.js.map +1 -1
  253. package/dist/playbooks/cantbook-profile.d.ts +96 -0
  254. package/dist/playbooks/cantbook-profile.d.ts.map +1 -0
  255. package/dist/playbooks/cantbook-profile.js +97 -0
  256. package/dist/playbooks/cantbook-profile.js.map +1 -0
  257. package/dist/playbooks/guarded-deterministic-runner.d.ts +153 -0
  258. package/dist/playbooks/guarded-deterministic-runner.d.ts.map +1 -0
  259. package/dist/playbooks/guarded-deterministic-runner.js +155 -0
  260. package/dist/playbooks/guarded-deterministic-runner.js.map +1 -0
  261. package/dist/playbooks/index.d.ts +2 -0
  262. package/dist/playbooks/index.d.ts.map +1 -1
  263. package/dist/playbooks/index.js +10 -0
  264. package/dist/playbooks/index.js.map +1 -1
  265. package/dist/playbooks/pi-runner-wiring.d.ts +75 -0
  266. package/dist/playbooks/pi-runner-wiring.d.ts.map +1 -0
  267. package/dist/playbooks/pi-runner-wiring.js +82 -0
  268. package/dist/playbooks/pi-runner-wiring.js.map +1 -0
  269. package/dist/release/index.d.ts +2 -2
  270. package/dist/release/index.d.ts.map +1 -1
  271. package/dist/release/index.js +1 -1
  272. package/dist/release/index.js.map +1 -1
  273. package/dist/release/reconcile.d.ts +97 -0
  274. package/dist/release/reconcile.d.ts.map +1 -1
  275. package/dist/release/reconcile.js +412 -5
  276. package/dist/release/reconcile.js.map +1 -1
  277. package/dist/resources/backend.d.ts +155 -0
  278. package/dist/resources/backend.d.ts.map +1 -0
  279. package/dist/resources/backend.js +23 -0
  280. package/dist/resources/backend.js.map +1 -0
  281. package/dist/resources/linux-backend.d.ts +167 -0
  282. package/dist/resources/linux-backend.d.ts.map +1 -0
  283. package/dist/resources/linux-backend.js +259 -0
  284. package/dist/resources/linux-backend.js.map +1 -0
  285. package/dist/resources/monitor.d.ts +230 -0
  286. package/dist/resources/monitor.d.ts.map +1 -0
  287. package/dist/resources/monitor.js +255 -0
  288. package/dist/resources/monitor.js.map +1 -0
  289. package/dist/resources/spawn-wrapper.d.ts +265 -0
  290. package/dist/resources/spawn-wrapper.d.ts.map +1 -0
  291. package/dist/resources/spawn-wrapper.js +304 -0
  292. package/dist/resources/spawn-wrapper.js.map +1 -0
  293. package/dist/runtime/openapi/generate-openapi.d.ts +211 -0
  294. package/dist/runtime/openapi/generate-openapi.d.ts.map +1 -0
  295. package/dist/runtime/openapi/generate-openapi.js +300 -0
  296. package/dist/runtime/openapi/generate-openapi.js.map +1 -0
  297. package/dist/runtime/openapi/index.d.ts +16 -0
  298. package/dist/runtime/openapi/index.d.ts.map +1 -0
  299. package/dist/runtime/openapi/index.js +16 -0
  300. package/dist/runtime/openapi/index.js.map +1 -0
  301. package/dist/selfimprove/budget.d.ts +11 -2
  302. package/dist/selfimprove/budget.d.ts.map +1 -1
  303. package/dist/selfimprove/budget.js +11 -2
  304. package/dist/selfimprove/budget.js.map +1 -1
  305. package/dist/selfimprove/fix-gen.d.ts +229 -0
  306. package/dist/selfimprove/fix-gen.d.ts.map +1 -0
  307. package/dist/selfimprove/fix-gen.js +266 -0
  308. package/dist/selfimprove/fix-gen.js.map +1 -0
  309. package/dist/selfimprove/run-loop.d.ts +44 -4
  310. package/dist/selfimprove/run-loop.d.ts.map +1 -1
  311. package/dist/selfimprove/run-loop.js +73 -6
  312. package/dist/selfimprove/run-loop.js.map +1 -1
  313. package/dist/selfimprove/scenarios/dhq-replay-find/golden.json +32 -0
  314. package/dist/selfimprove/scenarios/dhq-replay-find/scenario.json +18 -0
  315. package/dist/sentient/cross-project-hygiene.d.ts +11 -2
  316. package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
  317. package/dist/sentient/cross-project-hygiene.js +73 -10
  318. package/dist/sentient/cross-project-hygiene.js.map +1 -1
  319. package/dist/sentient/daemon.d.ts.map +1 -1
  320. package/dist/sentient/daemon.js +7 -2
  321. package/dist/sentient/daemon.js.map +1 -1
  322. package/dist/sentient/worktree-dispatch.d.ts.map +1 -1
  323. package/dist/sentient/worktree-dispatch.js +8 -1
  324. package/dist/sentient/worktree-dispatch.js.map +1 -1
  325. package/dist/setup/config-json-merge.d.ts.map +1 -1
  326. package/dist/setup/config-json-merge.js +14 -0
  327. package/dist/setup/config-json-merge.js.map +1 -1
  328. package/dist/setup/index.d.ts +23 -11
  329. package/dist/setup/index.d.ts.map +1 -1
  330. package/dist/setup/index.js +25 -12
  331. package/dist/setup/index.js.map +1 -1
  332. package/dist/setup/sections/llm.d.ts +28 -1
  333. package/dist/setup/sections/llm.d.ts.map +1 -1
  334. package/dist/setup/sections/llm.js +27 -6
  335. package/dist/setup/sections/llm.js.map +1 -1
  336. package/dist/setup/sections/models-roles.d.ts +40 -0
  337. package/dist/setup/sections/models-roles.d.ts.map +1 -0
  338. package/dist/setup/sections/models-roles.js +219 -0
  339. package/dist/setup/sections/models-roles.js.map +1 -0
  340. package/dist/setup/wizard.d.ts +19 -1
  341. package/dist/setup/wizard.d.ts.map +1 -1
  342. package/dist/setup/wizard.js.map +1 -1
  343. package/dist/spawn/branch-lock.d.ts.map +1 -1
  344. package/dist/spawn/branch-lock.js +7 -1
  345. package/dist/spawn/branch-lock.js.map +1 -1
  346. package/dist/store/attachment-repair.d.ts +110 -0
  347. package/dist/store/attachment-repair.d.ts.map +1 -0
  348. package/dist/store/attachment-repair.js +326 -0
  349. package/dist/store/attachment-repair.js.map +1 -0
  350. package/dist/store/attachment-store.d.ts.map +1 -1
  351. package/dist/store/attachment-store.js +24 -7
  352. package/dist/store/attachment-store.js.map +1 -1
  353. package/dist/store/schedule-schema.d.ts +195 -0
  354. package/dist/store/schedule-schema.d.ts.map +1 -0
  355. package/dist/store/schedule-schema.js +84 -0
  356. package/dist/store/schedule-schema.js.map +1 -0
  357. package/dist/store/schedule-store.d.ts +144 -0
  358. package/dist/store/schedule-store.d.ts.map +1 -0
  359. package/dist/store/schedule-store.js +162 -0
  360. package/dist/store/schedule-store.js.map +1 -0
  361. package/dist/store/schema/attachments.d.ts +1 -1
  362. package/dist/store/schema/cleo-global/index.d.ts +3 -0
  363. package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
  364. package/dist/store/schema/cleo-global/index.js +5 -0
  365. package/dist/store/schema/cleo-global/index.js.map +1 -1
  366. package/dist/store/schema/cleo-global/models-catalog.d.ts +359 -0
  367. package/dist/store/schema/cleo-global/models-catalog.d.ts.map +1 -0
  368. package/dist/store/schema/cleo-global/models-catalog.js +114 -0
  369. package/dist/store/schema/cleo-global/models-catalog.js.map +1 -0
  370. package/dist/store/schema/cleo-global/providers.d.ts +279 -0
  371. package/dist/store/schema/cleo-global/providers.d.ts.map +1 -0
  372. package/dist/store/schema/cleo-global/providers.js +94 -0
  373. package/dist/store/schema/cleo-global/providers.js.map +1 -0
  374. package/dist/store/schema/cleo-global/services.d.ts +493 -0
  375. package/dist/store/schema/cleo-global/services.d.ts.map +1 -0
  376. package/dist/store/schema/cleo-global/services.js +200 -0
  377. package/dist/store/schema/cleo-global/services.js.map +1 -0
  378. package/dist/store/schema/cleo-project/docs.d.ts +1 -1
  379. package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
  380. package/dist/store/schema/cleo-shared/brain.d.ts +2 -2
  381. package/dist/store/schema/memory-schema.d.ts +182 -2
  382. package/dist/store/schema/memory-schema.d.ts.map +1 -1
  383. package/dist/store/schema/memory-schema.js +111 -2
  384. package/dist/store/schema/memory-schema.js.map +1 -1
  385. package/dist/store/schema/provenance/releases.d.ts +1 -1
  386. package/dist/store/service-connections-accessor.d.ts +313 -0
  387. package/dist/store/service-connections-accessor.d.ts.map +1 -0
  388. package/dist/store/service-connections-accessor.js +464 -0
  389. package/dist/store/service-connections-accessor.js.map +1 -0
  390. package/dist/store/service-host-matcher.d.ts +70 -0
  391. package/dist/store/service-host-matcher.d.ts.map +1 -0
  392. package/dist/store/service-host-matcher.js +127 -0
  393. package/dist/store/service-host-matcher.js.map +1 -0
  394. package/dist/store/service-injection.d.ts +152 -0
  395. package/dist/store/service-injection.d.ts.map +1 -0
  396. package/dist/store/service-injection.js +225 -0
  397. package/dist/store/service-injection.js.map +1 -0
  398. package/dist/store/service-oauth.d.ts +287 -0
  399. package/dist/store/service-oauth.d.ts.map +1 -0
  400. package/dist/store/service-oauth.js +524 -0
  401. package/dist/store/service-oauth.js.map +1 -0
  402. package/dist/store/service-trust-gate.d.ts +164 -0
  403. package/dist/store/service-trust-gate.d.ts.map +1 -0
  404. package/dist/store/service-trust-gate.js +122 -0
  405. package/dist/store/service-trust-gate.js.map +1 -0
  406. package/dist/store/validation-schemas.d.ts +4 -4
  407. package/dist/tasks/agent-lifecycle-lane.d.ts +175 -0
  408. package/dist/tasks/agent-lifecycle-lane.d.ts.map +1 -0
  409. package/dist/tasks/agent-lifecycle-lane.js +176 -0
  410. package/dist/tasks/agent-lifecycle-lane.js.map +1 -0
  411. package/dist/tasks/complete.d.ts +17 -0
  412. package/dist/tasks/complete.d.ts.map +1 -1
  413. package/dist/tasks/complete.js +53 -10
  414. package/dist/tasks/complete.js.map +1 -1
  415. package/dist/tasks/depends-waiver-audit.d.ts +52 -0
  416. package/dist/tasks/depends-waiver-audit.d.ts.map +1 -0
  417. package/dist/tasks/depends-waiver-audit.js +36 -0
  418. package/dist/tasks/depends-waiver-audit.js.map +1 -0
  419. package/dist/tasks/engine-wrap.d.ts +36 -2
  420. package/dist/tasks/engine-wrap.d.ts.map +1 -1
  421. package/dist/tasks/engine-wrap.js +44 -2
  422. package/dist/tasks/engine-wrap.js.map +1 -1
  423. package/dist/tasks/evidence.d.ts +34 -2
  424. package/dist/tasks/evidence.d.ts.map +1 -1
  425. package/dist/tasks/evidence.js +293 -35
  426. package/dist/tasks/evidence.js.map +1 -1
  427. package/dist/tasks/index.d.ts +1 -0
  428. package/dist/tasks/index.d.ts.map +1 -1
  429. package/dist/tasks/index.js +1 -0
  430. package/dist/tasks/index.js.map +1 -1
  431. package/dist/tasks/ops.d.ts +3 -0
  432. package/dist/tasks/ops.d.ts.map +1 -1
  433. package/dist/tasks/task-ops.d.ts +1 -1
  434. package/dist/tasks/task-ops.d.ts.map +1 -1
  435. package/dist/tasks/task-ops.js +3 -1
  436. package/dist/tasks/task-ops.js.map +1 -1
  437. package/dist/tasks/task-reparent.d.ts +90 -0
  438. package/dist/tasks/task-reparent.d.ts.map +1 -1
  439. package/dist/tasks/task-reparent.js +171 -0
  440. package/dist/tasks/task-reparent.js.map +1 -1
  441. package/dist/tools/builtin-agent-tools.d.ts.map +1 -1
  442. package/dist/tools/builtin-agent-tools.js +41 -0
  443. package/dist/tools/builtin-agent-tools.js.map +1 -1
  444. package/dist/tools/exec-code-agent-tool.d.ts +179 -0
  445. package/dist/tools/exec-code-agent-tool.d.ts.map +1 -0
  446. package/dist/tools/exec-code-agent-tool.js +239 -0
  447. package/dist/tools/exec-code-agent-tool.js.map +1 -0
  448. package/dist/tools/index.d.ts +6 -0
  449. package/dist/tools/index.d.ts.map +1 -1
  450. package/dist/tools/index.js +15 -0
  451. package/dist/tools/index.js.map +1 -1
  452. package/dist/tools/mcp-agent-tool.d.ts +189 -0
  453. package/dist/tools/mcp-agent-tool.d.ts.map +1 -0
  454. package/dist/tools/mcp-agent-tool.js +243 -0
  455. package/dist/tools/mcp-agent-tool.js.map +1 -0
  456. package/dist/tools/media-agent-tools.d.ts +105 -0
  457. package/dist/tools/media-agent-tools.d.ts.map +1 -0
  458. package/dist/tools/media-agent-tools.js +255 -0
  459. package/dist/tools/media-agent-tools.js.map +1 -0
  460. package/dist/tools/memory-agent-tools.d.ts +99 -0
  461. package/dist/tools/memory-agent-tools.d.ts.map +1 -0
  462. package/dist/tools/memory-agent-tools.js +190 -0
  463. package/dist/tools/memory-agent-tools.js.map +1 -0
  464. package/dist/tools/schedule-agent-tools.d.ts +151 -0
  465. package/dist/tools/schedule-agent-tools.d.ts.map +1 -0
  466. package/dist/tools/schedule-agent-tools.js +238 -0
  467. package/dist/tools/schedule-agent-tools.js.map +1 -0
  468. package/dist/tools/skill-agent-tool.d.ts +108 -0
  469. package/dist/tools/skill-agent-tool.d.ts.map +1 -0
  470. package/dist/tools/skill-agent-tool.js +135 -0
  471. package/dist/tools/skill-agent-tool.js.map +1 -0
  472. package/dist/validation/engine-ops.d.ts.map +1 -1
  473. package/dist/validation/engine-ops.js +17 -1
  474. package/dist/validation/engine-ops.js.map +1 -1
  475. package/dist/verification/verify-tools.d.ts.map +1 -1
  476. package/dist/verification/verify-tools.js +5 -6
  477. package/dist/verification/verify-tools.js.map +1 -1
  478. package/migrations/drizzle-brain/20260610000001_t10405-bitemporal-network-columns/migration.sql +71 -0
  479. package/migrations/drizzle-cleo-global/20260609000000_t11937-service-vault/migration.sql +93 -0
  480. package/migrations/drizzle-cleo-global/20260609010000_t11733-models-catalog/migration.sql +65 -0
  481. package/migrations/drizzle-cleo-global/20260609020000_t11703-providers/migration.sql +52 -0
  482. package/migrations/drizzle-cleo-global/20260610000000_t11962-schedules/migration.sql +48 -0
  483. package/migrations/drizzle-cleo-project/20260610000000_t11962-schedules/migration.sql +48 -0
  484. package/package.json +33 -13
  485. package/templates/workflows/release-prepare.yml.tmpl +48 -2
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Cron / todo agent-tool family — `todo_add` / `todo_list` / `cron_schedule`
3
+ * (T11950 · M7 · epic T11456 · SG-TOOLS).
4
+ *
5
+ * Surfaces the EXISTING task store to the agent loop as `agent`-toolset tools that
6
+ * work daemon-OFF:
7
+ *
8
+ * - **`todo_add`** — create a task, DELEGATING to the existing
9
+ * {@link import('../tasks/ops.js')}'s `tasksAddOp` (the same path `cleo add`
10
+ * uses). No new table, no new schema.
11
+ * - **`todo_list`** — list tasks, DELEGATING to `tasksListOp` (the same path
12
+ * `cleo list` uses).
13
+ * - **`cron_schedule`** — register a recurring schedule. The schedule store now
14
+ * exists (the `schedules` table + leased Gate-3 accessor `store/schedule-store.ts`,
15
+ * T11962 under T11679), so this tool DELEGATES to {@link ScheduleStore.add} and
16
+ * persists a row daemon-OFF (a future daemon scheduler consumes the SAME table
17
+ * as a separate reader). It stays REGISTERED-but-capability-gated: its
18
+ * {@link AvailabilityCheck} hides it until a host advertises a schedule store
19
+ * (`capabilities.scheduleStore === true`) so a host that has opted out of the
20
+ * schedule domain does not surface it; invoking it without the store still
21
+ * returns a typed `E_SCHEDULE_STORE_UNAVAILABLE` failure. `todo_*` are always
22
+ * available daemon-OFF.
23
+ *
24
+ * ## Why a seam, not a hardcoded import (testing + Gate-11)
25
+ *
26
+ * The task ops are injected through the {@link TaskOps} seam, defaulting to the
27
+ * real `ops` functions. The unit test injects a FAKE store and asserts delegation
28
+ * + schema validation WITHOUT opening a real `tasks.db`. The tools are DEFINED
29
+ * here under `packages/core/src/tools` and CONSUME the task subsystem — they
30
+ * construct no new atomic primitive (Gate-11).
31
+ *
32
+ * ## Gate-13
33
+ *
34
+ * No model/transport/provider client is constructed here — task CRUD is a local
35
+ * SQLite operation. There is no chokepoint concern.
36
+ *
37
+ * @epic T11456
38
+ * @task T11950
39
+ * @see ../tasks/ops.js — `tasksAddOp` / `tasksListOp` (the ops this family delegates to)
40
+ * @see ./exec-code-agent-tool.js — the injectable-seam + capability-gated availability pattern mirrored here
41
+ */
42
+ import type { TaskPriority, TaskStatus, TaskType } from '@cleocode/contracts';
43
+ import type { AddTaskResult } from '../tasks/add.js';
44
+ import type { ListTasksResult } from '../tasks/list.js';
45
+ import { type AgentToolRegistry, type AvailabilityCheck } from './agent-registry.js';
46
+ /**
47
+ * The task store operations the `todo_*` tools delegate to. Each member has the
48
+ * SAME signature as the corresponding `ops` function. Injectable so the unit test
49
+ * can supply a fake store; defaults to the real ops in production.
50
+ */
51
+ export interface TaskOps {
52
+ /** Create a task (→ `tasksAddOp`). */
53
+ readonly add: (projectRoot: string, params: {
54
+ title: string;
55
+ description?: string;
56
+ parent?: string;
57
+ priority?: TaskPriority;
58
+ type?: TaskType;
59
+ acceptance?: string[];
60
+ }) => Promise<AddTaskResult>;
61
+ /** List tasks (→ `tasksListOp`). */
62
+ readonly list: (projectRoot: string, params: {
63
+ parent?: string;
64
+ status?: TaskStatus;
65
+ priority?: TaskPriority;
66
+ type?: TaskType;
67
+ limit?: number;
68
+ }) => Promise<ListTasksResult>;
69
+ }
70
+ /**
71
+ * The result `cron_schedule` returns: on success the minted `scheduleId` of the
72
+ * persisted row; on failure a typed, non-throwing error (e.g. when no schedule
73
+ * store backs the host). The tool is registered (catalog-stable) and gated on the
74
+ * `scheduleStore` host capability.
75
+ */
76
+ export interface CronScheduleResult {
77
+ /** Whether a schedule row was registered. */
78
+ readonly ok: boolean;
79
+ /** The registered schedule's ID (present on success). */
80
+ readonly scheduleId?: string;
81
+ /** A stable code + message for why scheduling failed (present on failure). */
82
+ readonly error?: {
83
+ readonly code: string;
84
+ readonly message: string;
85
+ };
86
+ }
87
+ /**
88
+ * The schedule-store operation the `cron_schedule` tool delegates to. Injectable
89
+ * so the unit test can supply a fake store; defaults to the real Gate-3 accessor
90
+ * (`store/schedule-store.ts`) opened through the {@link openDualScopeDb} chokepoint.
91
+ */
92
+ export interface ScheduleStore {
93
+ /**
94
+ * Register a recurring schedule and return its minted opaque handle.
95
+ *
96
+ * @param projectRoot - The project root whose `cleo.db` the schedule persists in.
97
+ * @param params - The cron expression + task template (title / description).
98
+ * @returns The minted `sched-<token>` handle.
99
+ */
100
+ readonly add: (projectRoot: string, params: {
101
+ cron: string;
102
+ title: string;
103
+ description?: string;
104
+ }) => Promise<string>;
105
+ }
106
+ /**
107
+ * Available only when the host advertises a schedule store
108
+ * (`capabilities.scheduleStore === true`). The schedule store now EXISTS (the
109
+ * `schedules` table + leased Gate-3 accessor, T11962 under T11679), so the gate is
110
+ * a host POLICY/capability switch — a host that has opted out of the schedule
111
+ * domain does not surface `cron_schedule`. Registration of a schedule row persists
112
+ * WITHOUT a live daemon (the chokepoint serializes the single in-process writer);
113
+ * a future daemon scheduler consumes the same table as a separate reader.
114
+ */
115
+ export declare const scheduleStoreAvailable: AvailabilityCheck;
116
+ /** Options for {@link registerScheduleAgentTools} — all injectable for testing. */
117
+ export interface ScheduleAgentToolOptions {
118
+ /** The task ops seam. Defaults to the real `tasksAddOp` / `tasksListOp`. */
119
+ readonly tasks?: TaskOps;
120
+ /**
121
+ * The schedule-store seam `cron_schedule` delegates to. Defaults to the real
122
+ * Gate-3 accessor (`store/schedule-store.ts`). Injected in tests with a fake
123
+ * store so registration is asserted WITHOUT opening a real `cleo.db`.
124
+ */
125
+ readonly schedule?: ScheduleStore;
126
+ /**
127
+ * The project root threaded into every op (defaults to the resolved project
128
+ * root via {@link resolveOrCwd} — never a bare `process.cwd()` in core, T9584).
129
+ */
130
+ readonly projectRoot?: string;
131
+ }
132
+ /**
133
+ * Register the cron / todo agent-tool family into `registry`. Pure registration —
134
+ * no `tasks.db` is opened, no row is written here; all of that happens later
135
+ * inside each tool's `execute` through the injected (or lazily-resolved real)
136
+ * ops. Import-time side-effect-free.
137
+ *
138
+ * @param registry - The registry to populate.
139
+ * @param options - Injectable task ops / project root (for testing).
140
+ */
141
+ export declare function registerScheduleAgentTools(registry: AgentToolRegistry, options?: ScheduleAgentToolOptions): void;
142
+ /**
143
+ * Self-registration marker (AC1) — the identifier the
144
+ * {@link AgentToolRegistry.discover} bounded source scan greps for. Aliases
145
+ * {@link registerScheduleAgentTools} so a future scan-dir discovery (or the
146
+ * built-in aggregator) can call it uniformly with the other agent-tool modules.
147
+ *
148
+ * @param registry - The registry to populate.
149
+ */
150
+ export declare function registerAgentTools(registry: AgentToolRegistry): void;
151
+ //# sourceMappingURL=schedule-agent-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,CACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,KAC1D,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,iBACK,CAAC;AAE3C,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,wBAA6B,GACrC,IAAI,CAwIN;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAEpE"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Cron / todo agent-tool family — `todo_add` / `todo_list` / `cron_schedule`
3
+ * (T11950 · M7 · epic T11456 · SG-TOOLS).
4
+ *
5
+ * Surfaces the EXISTING task store to the agent loop as `agent`-toolset tools that
6
+ * work daemon-OFF:
7
+ *
8
+ * - **`todo_add`** — create a task, DELEGATING to the existing
9
+ * {@link import('../tasks/ops.js')}'s `tasksAddOp` (the same path `cleo add`
10
+ * uses). No new table, no new schema.
11
+ * - **`todo_list`** — list tasks, DELEGATING to `tasksListOp` (the same path
12
+ * `cleo list` uses).
13
+ * - **`cron_schedule`** — register a recurring schedule. The schedule store now
14
+ * exists (the `schedules` table + leased Gate-3 accessor `store/schedule-store.ts`,
15
+ * T11962 under T11679), so this tool DELEGATES to {@link ScheduleStore.add} and
16
+ * persists a row daemon-OFF (a future daemon scheduler consumes the SAME table
17
+ * as a separate reader). It stays REGISTERED-but-capability-gated: its
18
+ * {@link AvailabilityCheck} hides it until a host advertises a schedule store
19
+ * (`capabilities.scheduleStore === true`) so a host that has opted out of the
20
+ * schedule domain does not surface it; invoking it without the store still
21
+ * returns a typed `E_SCHEDULE_STORE_UNAVAILABLE` failure. `todo_*` are always
22
+ * available daemon-OFF.
23
+ *
24
+ * ## Why a seam, not a hardcoded import (testing + Gate-11)
25
+ *
26
+ * The task ops are injected through the {@link TaskOps} seam, defaulting to the
27
+ * real `ops` functions. The unit test injects a FAKE store and asserts delegation
28
+ * + schema validation WITHOUT opening a real `tasks.db`. The tools are DEFINED
29
+ * here under `packages/core/src/tools` and CONSUME the task subsystem — they
30
+ * construct no new atomic primitive (Gate-11).
31
+ *
32
+ * ## Gate-13
33
+ *
34
+ * No model/transport/provider client is constructed here — task CRUD is a local
35
+ * SQLite operation. There is no chokepoint concern.
36
+ *
37
+ * @epic T11456
38
+ * @task T11950
39
+ * @see ../tasks/ops.js — `tasksAddOp` / `tasksListOp` (the ops this family delegates to)
40
+ * @see ./exec-code-agent-tool.js — the injectable-seam + capability-gated availability pattern mirrored here
41
+ */
42
+ import { z } from 'zod';
43
+ import { resolveOrCwd } from '../paths.js';
44
+ import { ALWAYS_AVAILABLE, } from './agent-registry.js';
45
+ /**
46
+ * Available only when the host advertises a schedule store
47
+ * (`capabilities.scheduleStore === true`). The schedule store now EXISTS (the
48
+ * `schedules` table + leased Gate-3 accessor, T11962 under T11679), so the gate is
49
+ * a host POLICY/capability switch — a host that has opted out of the schedule
50
+ * domain does not surface `cron_schedule`. Registration of a schedule row persists
51
+ * WITHOUT a live daemon (the chokepoint serializes the single in-process writer);
52
+ * a future daemon scheduler consumes the same table as a separate reader.
53
+ */
54
+ export const scheduleStoreAvailable = (ctx) => ctx.capabilities?.scheduleStore === true;
55
+ /**
56
+ * Build the real task-ops seam by lazily importing the existing `ops` module.
57
+ * Lazy so this tool module stays import-time side-effect-free; the import happens
58
+ * only when the real ops are first needed.
59
+ *
60
+ * @returns The production {@link TaskOps}.
61
+ */
62
+ async function realTaskOps() {
63
+ const { tasksAddOp, tasksListOp } = await import('../tasks/ops.js');
64
+ return {
65
+ add: (root, params) => tasksAddOp(root, params),
66
+ list: (root, params) => tasksListOp(root, params),
67
+ };
68
+ }
69
+ /**
70
+ * Build the real schedule-store seam by lazily importing the Gate-3 accessor.
71
+ * Lazy so this tool module stays import-time side-effect-free; the import (and the
72
+ * `cleo.db` open) happens only when `cron_schedule` first fires. The accessor
73
+ * routes through {@link openDualScopeDb} (the dual-scope chokepoint) — it NEVER
74
+ * opens a raw handle.
75
+ *
76
+ * @returns The production {@link ScheduleStore}.
77
+ */
78
+ async function realScheduleStore() {
79
+ const { getScheduleNativeDb, addSchedule } = await import('../store/schedule-store.js');
80
+ return {
81
+ add: async (root, params) => {
82
+ const native = await getScheduleNativeDb(root);
83
+ return addSchedule(native, {
84
+ cronExpr: params.cron,
85
+ title: params.title,
86
+ description: params.description,
87
+ });
88
+ },
89
+ };
90
+ }
91
+ /**
92
+ * Register the cron / todo agent-tool family into `registry`. Pure registration —
93
+ * no `tasks.db` is opened, no row is written here; all of that happens later
94
+ * inside each tool's `execute` through the injected (or lazily-resolved real)
95
+ * ops. Import-time side-effect-free.
96
+ *
97
+ * @param registry - The registry to populate.
98
+ * @param options - Injectable task ops / project root (for testing).
99
+ */
100
+ export function registerScheduleAgentTools(registry, options = {}) {
101
+ const projectRoot = resolveOrCwd(options.projectRoot);
102
+ // --- todo_add (→ tasksAddOp) ---------------------------------------------
103
+ registry.register({
104
+ name: 'todo_add',
105
+ // 'fs' — persists a row to the local tasks store (its strongest side-effect surface).
106
+ class: 'fs',
107
+ description: 'Add a task (todo) to the project task store. Delegates to the same path as `cleo add`. ' +
108
+ 'Returns the created task. Always available daemon-OFF.',
109
+ toolset: 'agent',
110
+ stateless: false,
111
+ available: ALWAYS_AVAILABLE,
112
+ parameters: z.object({
113
+ title: z.string().describe('The task title.'),
114
+ description: z.string().optional().describe('A longer task description.'),
115
+ parent: z.string().optional().describe('Parent task/epic ID to nest this task under.'),
116
+ priority: z
117
+ .enum(['critical', 'high', 'medium', 'low'])
118
+ .optional()
119
+ .describe('Task priority (default medium).'),
120
+ acceptance: z
121
+ .array(z.string())
122
+ .optional()
123
+ .describe('Acceptance criteria — one entry per criterion.'),
124
+ }),
125
+ execute: async (rawArgs) => {
126
+ const tasks = options.tasks ?? (await realTaskOps());
127
+ const title = String(rawArgs.title);
128
+ const description = rawArgs.description === undefined ? undefined : String(rawArgs.description);
129
+ const parent = rawArgs.parent === undefined ? undefined : String(rawArgs.parent);
130
+ const priority = rawArgs.priority === 'critical' ||
131
+ rawArgs.priority === 'high' ||
132
+ rawArgs.priority === 'medium' ||
133
+ rawArgs.priority === 'low'
134
+ ? rawArgs.priority
135
+ : undefined;
136
+ const acceptance = Array.isArray(rawArgs.acceptance)
137
+ ? rawArgs.acceptance.map(String)
138
+ : undefined;
139
+ return tasks.add(projectRoot, {
140
+ title,
141
+ description,
142
+ parent,
143
+ priority,
144
+ type: 'task',
145
+ acceptance,
146
+ });
147
+ },
148
+ });
149
+ // --- todo_list (→ tasksListOp) -------------------------------------------
150
+ registry.register({
151
+ name: 'todo_list',
152
+ // 'search' — a local read-query of the tasks store.
153
+ class: 'search',
154
+ description: 'List tasks (todos) from the project task store, optionally filtered by parent / status / ' +
155
+ 'priority. Delegates to the same path as `cleo list`. Always available daemon-OFF.',
156
+ toolset: 'agent',
157
+ stateless: true,
158
+ available: ALWAYS_AVAILABLE,
159
+ parameters: z.object({
160
+ parent: z.string().optional().describe('Only list direct children of this task/epic ID.'),
161
+ status: z.string().optional().describe('Filter by status (e.g. pending, in_progress, done).'),
162
+ priority: z
163
+ .enum(['critical', 'high', 'medium', 'low'])
164
+ .optional()
165
+ .describe('Filter by priority.'),
166
+ limit: z.number().int().positive().optional().describe('Maximum number of tasks to return.'),
167
+ }),
168
+ execute: async (rawArgs) => {
169
+ const tasks = options.tasks ?? (await realTaskOps());
170
+ const parent = rawArgs.parent === undefined ? undefined : String(rawArgs.parent);
171
+ const status = rawArgs.status === undefined ? undefined : String(rawArgs.status);
172
+ const priority = rawArgs.priority === 'critical' ||
173
+ rawArgs.priority === 'high' ||
174
+ rawArgs.priority === 'medium' ||
175
+ rawArgs.priority === 'low'
176
+ ? rawArgs.priority
177
+ : undefined;
178
+ const limit = typeof rawArgs.limit === 'number' ? rawArgs.limit : undefined;
179
+ return tasks.list(projectRoot, { parent, status, priority, limit });
180
+ },
181
+ });
182
+ // --- cron_schedule (persists a row through the leased Gate-3 store) -------
183
+ registry.register({
184
+ name: 'cron_schedule',
185
+ // 'fs' — registering a schedule persists a store row.
186
+ class: 'fs',
187
+ description: 'Register a recurring schedule (cron expression → task template). Persists a row to the ' +
188
+ 'project schedule store and returns its schedule ID. Gated on the host advertising a ' +
189
+ 'schedule store; persists daemon-OFF (a daemon scheduler consumes the table separately).',
190
+ toolset: 'agent',
191
+ stateless: false,
192
+ available: scheduleStoreAvailable,
193
+ parameters: z.object({
194
+ cron: z.string().describe('A cron expression for the recurrence (e.g. "0 9 * * 1").'),
195
+ title: z.string().describe('The title of the task to create on each fire.'),
196
+ description: z
197
+ .string()
198
+ .optional()
199
+ .describe('A description for the task created on each fire.'),
200
+ }),
201
+ execute: async (rawArgs) => {
202
+ // Delegate to the schedule-store seam (the real Gate-3 accessor, or an
203
+ // injected fake in tests). The accessor routes through openDualScopeDb — no
204
+ // raw db open here. A store/IO failure is returned as a typed, non-throwing
205
+ // result so the agent loop sees a structured failure rather than an
206
+ // exception.
207
+ const cron = String(rawArgs.cron);
208
+ const title = String(rawArgs.title);
209
+ const description = rawArgs.description === undefined ? undefined : String(rawArgs.description);
210
+ try {
211
+ const schedule = options.schedule ?? (await realScheduleStore());
212
+ const scheduleId = await schedule.add(projectRoot, { cron, title, description });
213
+ return { ok: true, scheduleId };
214
+ }
215
+ catch (err) {
216
+ return {
217
+ ok: false,
218
+ error: {
219
+ code: 'E_SCHEDULE_STORE_UNAVAILABLE',
220
+ message: `failed to register schedule: ${err instanceof Error ? err.message : String(err)}`,
221
+ },
222
+ };
223
+ }
224
+ },
225
+ });
226
+ }
227
+ /**
228
+ * Self-registration marker (AC1) — the identifier the
229
+ * {@link AgentToolRegistry.discover} bounded source scan greps for. Aliases
230
+ * {@link registerScheduleAgentTools} so a future scan-dir discovery (or the
231
+ * built-in aggregator) can call it uniformly with the other agent-tool modules.
232
+ *
233
+ * @param registry - The registry to populate.
234
+ */
235
+ export function registerAgentTools(registry) {
236
+ registerScheduleAgentTools(registry);
237
+ }
238
+ //# sourceMappingURL=schedule-agent-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-agent-tools.js","sourceRoot":"","sources":["../../src/tools/schedule-agent-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAEL,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAmE7B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,CAAC,GAAG,EAAE,EAAE,CAC/D,GAAG,CAAC,YAAY,EAAE,aAAa,KAAK,IAAI,CAAC;AAmB3C;;;;;;GAMG;AACH,KAAK,UAAU,WAAW;IACxB,MAAM,EAAE,UAAU,EAAE,WAAW,E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@@ -0,0 +1,108 @@
1
+ /**
2
+ * `run_skill` agent tool — bridge the EXISTING SKILL.md loader to the agent loop
3
+ * (T11949 · M7 · epic T11456 · SG-TOOLS; replaces the cancelled T11869).
4
+ *
5
+ * T11869 ("adopt Pi's SKILL.md loader") is CANCELLED: CLEO ALREADY owns a native
6
+ * skill loader + dispatch path ({@link import('../skills/discovery.js')}'s
7
+ * `parseFrontmatter` / `discoverSkill` / `findSkill`, plus
8
+ * {@link import('../skills/dispatch.js')}'s `dispatchExplicit`). This tool does
9
+ * NOT rebuild any of that. It surfaces the SUBSET of skills the model may invoke —
10
+ * those whose frontmatter marks `invocable: true` — to the loop as a single
11
+ * `run_skill` tool. `run_skill`:
12
+ *
13
+ * - resolves a skill BY NAME via the EXISTING {@link findSkill} (the same
14
+ * filesystem scan + name-mapping the CLI uses);
15
+ * - REJECTS a skill whose frontmatter is not `invocable: true` (a typed, non-
16
+ * throwing failure result) — only explicitly-invocable skills are runnable;
17
+ * - dispatches the resolved skill through the EXISTING
18
+ * {@link dispatchExplicit} path and returns the skill's instructions
19
+ * (`SKILL.md` body) + dispatch metadata for the loop to act on.
20
+ *
21
+ * No new loader, no new parser, no new dispatch mechanism — pure consumption of
22
+ * the skills subsystem (Gate-11: DEFINED here under `packages/core/src/tools`,
23
+ * CONSUMES the skills path). The tier-0 skill-drift gate + skill-coverage map are
24
+ * untouched — this is a consumer of the loader, not a change to it.
25
+ *
26
+ * ## Availability (always-true, daemon-OFF)
27
+ *
28
+ * Skill discovery is a LOCAL filesystem scan — no credential, no network, no
29
+ * daemon. `run_skill` is therefore {@link ALWAYS_AVAILABLE}.
30
+ *
31
+ * ## Gate-13
32
+ *
33
+ * No model/transport/provider client is constructed here — resolving + reading a
34
+ * SKILL.md is local I/O. There is no chokepoint concern.
35
+ *
36
+ * @epic T11456
37
+ * @task T11949
38
+ * @see ../skills/discovery.js — `findSkill` (the existing loader this tool reuses)
39
+ * @see ../skills/dispatch.js — `dispatchExplicit` (the existing dispatch path)
40
+ */
41
+ import type { Skill } from '../skills/types.js';
42
+ import { type AgentToolRegistry } from './agent-registry.js';
43
+ /**
44
+ * The skills-subsystem seam {@link registerSkillAgentTool} resolves + dispatches a
45
+ * skill through. Each member has the SAME signature as the corresponding existing
46
+ * function. Injectable so the unit test can supply a fake skill surface (no real
47
+ * SKILL.md on disk); defaults to the real `discovery` / `dispatch` functions.
48
+ */
49
+ export interface SkillResolver {
50
+ /** Resolve a skill by name (→ `findSkill`). Returns `null` when unknown. */
51
+ readonly findSkill: (name: string, cwd?: string) => Skill | null;
52
+ /**
53
+ * Dispatch an explicit skill (→ `dispatchExplicit`). Returns the dispatch
54
+ * metadata, or `null` when the skill does not resolve.
55
+ */
56
+ readonly dispatchExplicit: (skillName: string, cwd?: string) => {
57
+ skill: string;
58
+ strategy: string;
59
+ confidence: number;
60
+ protocol?: string;
61
+ } | null;
62
+ }
63
+ /** The shape `run_skill` returns to the loop — resolution outcome + payload. */
64
+ export interface RunSkillResult {
65
+ /** Whether an invocable skill resolved and dispatched. */
66
+ readonly ok: boolean;
67
+ /** The resolved skill's canonical directory name (present on success). */
68
+ readonly skill?: string;
69
+ /** The dispatched protocol, when the skill declares one. */
70
+ readonly protocol?: string;
71
+ /** The `SKILL.md` body the loop acts on (present on success). */
72
+ readonly instructions?: string;
73
+ /** A stable code + message for why resolution failed (present on failure). */
74
+ readonly error?: {
75
+ readonly code: string;
76
+ readonly message: string;
77
+ };
78
+ }
79
+ /** Options for {@link registerSkillAgentTool} — all injectable for testing. */
80
+ export interface SkillAgentToolOptions {
81
+ /** The skills-subsystem seam. Defaults to the real discovery + dispatch functions. */
82
+ readonly resolver?: SkillResolver;
83
+ /**
84
+ * The cwd skill discovery scans from (defaults to the resolved project root via
85
+ * {@link resolveOrCwd} — never a bare `process.cwd()` in core, T9584).
86
+ */
87
+ readonly cwd?: string;
88
+ }
89
+ /**
90
+ * Register the `run_skill` tool into `registry`. Pure registration — no skill is
91
+ * resolved, no SKILL.md is read here; all of that happens later inside the tool's
92
+ * `execute` through the injected (or lazily-resolved real) seam. Import-time
93
+ * side-effect-free.
94
+ *
95
+ * @param registry - The registry to populate.
96
+ * @param options - Injectable resolver / cwd (for testing).
97
+ */
98
+ export declare function registerSkillAgentTool(registry: AgentToolRegistry, options?: SkillAgentToolOptions): void;
99
+ /**
100
+ * Self-registration marker (AC1) — the identifier the
101
+ * {@link AgentToolRegistry.discover} bounded source scan greps for. Aliases
102
+ * {@link registerSkillAgentTool} so a future scan-dir discovery (or the built-in
103
+ * aggregator) can call it uniformly with the other agent-tool modules.
104
+ *
105
+ * @param registry - The registry to populate.
106
+ */
107
+ export declare function registerAgentTools(registry: AgentToolRegistry): void;
108
+ //# sourceMappingURL=skill-agent-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-agent-tool.d.ts","sourceRoot":"","sources":["../../src/tools/skill-agent-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,KAAK,GAAG,IAAI,CAAC;IACjE;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,CACzB,SAAS,EAAE,MAAM,EACjB,GAAG,CAAC,EAAE,MAAM,KACT;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxF;AAED,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE;AAED,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;IACpC,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAgDN;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAEpE"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * `run_skill` agent tool — bridge the EXISTING SKILL.md loader to the agent loop
3
+ * (T11949 · M7 · epic T11456 · SG-TOOLS; replaces the cancelled T11869).
4
+ *
5
+ * T11869 ("adopt Pi's SKILL.md loader") is CANCELLED: CLEO ALREADY owns a native
6
+ * skill loader + dispatch path ({@link import('../skills/discovery.js')}'s
7
+ * `parseFrontmatter` / `discoverSkill` / `findSkill`, plus
8
+ * {@link import('../skills/dispatch.js')}'s `dispatchExplicit`). This tool does
9
+ * NOT rebuild any of that. It surfaces the SUBSET of skills the model may invoke —
10
+ * those whose frontmatter marks `invocable: true` — to the loop as a single
11
+ * `run_skill` tool. `run_skill`:
12
+ *
13
+ * - resolves a skill BY NAME via the EXISTING {@link findSkill} (the same
14
+ * filesystem scan + name-mapping the CLI uses);
15
+ * - REJECTS a skill whose frontmatter is not `invocable: true` (a typed, non-
16
+ * throwing failure result) — only explicitly-invocable skills are runnable;
17
+ * - dispatches the resolved skill through the EXISTING
18
+ * {@link dispatchExplicit} path and returns the skill's instructions
19
+ * (`SKILL.md` body) + dispatch metadata for the loop to act on.
20
+ *
21
+ * No new loader, no new parser, no new dispatch mechanism — pure consumption of
22
+ * the skills subsystem (Gate-11: DEFINED here under `packages/core/src/tools`,
23
+ * CONSUMES the skills path). The tier-0 skill-drift gate + skill-coverage map are
24
+ * untouched — this is a consumer of the loader, not a change to it.
25
+ *
26
+ * ## Availability (always-true, daemon-OFF)
27
+ *
28
+ * Skill discovery is a LOCAL filesystem scan — no credential, no network, no
29
+ * daemon. `run_skill` is therefore {@link ALWAYS_AVAILABLE}.
30
+ *
31
+ * ## Gate-13
32
+ *
33
+ * No model/transport/provider client is constructed here — resolving + reading a
34
+ * SKILL.md is local I/O. There is no chokepoint concern.
35
+ *
36
+ * @epic T11456
37
+ * @task T11949
38
+ * @see ../skills/discovery.js — `findSkill` (the existing loader this tool reuses)
39
+ * @see ../skills/dispatch.js — `dispatchExplicit` (the existing dispatch path)
40
+ */
41
+ import { z } from 'zod';
42
+ import { resolveOrCwd } from '../paths.js';
43
+ import { ALWAYS_AVAILABLE } from './agent-registry.js';
44
+ /**
45
+ * Build the real skills-subsystem seam by lazily importing the existing
46
+ * `discovery` + `dispatch` modules. Lazy so this tool module is import-time
47
+ * side-effect-free (the skills modules run filesystem-touching telemetry on
48
+ * load); the import happens only when the real resolver is first needed.
49
+ *
50
+ * @returns The production {@link SkillResolver}.
51
+ */
52
+ async function realResolver() {
53
+ const { findSkill } = await import('../skills/discovery.js');
54
+ const { dispatchExplicit } = await import('../skills/dispatch.js');
55
+ return {
56
+ findSkill,
57
+ dispatchExplicit: (skillName, cwd) => {
58
+ const result = dispatchExplicit(skillName, cwd);
59
+ if (result === null)
60
+ return null;
61
+ return {
62
+ skill: result.skill,
63
+ strategy: result.strategy,
64
+ confidence: result.confidence,
65
+ ...(result.protocol !== undefined ? { protocol: result.protocol } : {}),
66
+ };
67
+ },
68
+ };
69
+ }
70
+ /**
71
+ * Register the `run_skill` tool into `registry`. Pure registration — no skill is
72
+ * resolved, no SKILL.md is read here; all of that happens later inside the tool's
73
+ * `execute` through the injected (or lazily-resolved real) seam. Import-time
74
+ * side-effect-free.
75
+ *
76
+ * @param registry - The registry to populate.
77
+ * @param options - Injectable resolver / cwd (for testing).
78
+ */
79
+ export function registerSkillAgentTool(registry, options = {}) {
80
+ const cwd = resolveOrCwd(options.cwd);
81
+ registry.register({
82
+ name: 'run_skill',
83
+ // 'shell' — invoking a skill is a procedure run (its strongest side-effect surface).
84
+ class: 'shell',
85
+ description: 'Resolve and run an invocable CLEO skill by name. Returns the skill instructions ' +
86
+ '(SKILL.md body) and dispatch metadata for the loop to act on. Only skills whose ' +
87
+ 'frontmatter marks them invocable can be run.',
88
+ toolset: 'agent',
89
+ stateless: false,
90
+ available: ALWAYS_AVAILABLE,
91
+ parameters: z.object({
92
+ name: z.string().describe('The skill name to resolve and run (e.g. "ct-research-agent").'),
93
+ }),
94
+ execute: async (rawArgs) => {
95
+ const name = String(rawArgs.name);
96
+ const resolver = options.resolver ?? (await realResolver());
97
+ const skill = resolver.findSkill(name, cwd);
98
+ if (skill === null) {
99
+ return {
100
+ ok: false,
101
+ error: { code: 'E_SKILL_NOT_FOUND', message: `no skill named "${name}"` },
102
+ };
103
+ }
104
+ if (skill.frontmatter.invocable !== true) {
105
+ return {
106
+ ok: false,
107
+ error: {
108
+ code: 'E_SKILL_NOT_INVOCABLE',
109
+ message: `skill "${skill.dirName}" is not invocable (frontmatter.invocable !== true)`,
110
+ },
111
+ };
112
+ }
113
+ // Dispatch through the EXISTING explicit-dispatch path (no new mechanism).
114
+ const dispatch = resolver.dispatchExplicit(name, cwd);
115
+ return {
116
+ ok: true,
117
+ skill: skill.dirName,
118
+ ...(dispatch?.protocol !== undefined ? { protocol: dispatch.protocol } : {}),
119
+ ...(skill.content !== undefined ? { instructions: skill.content } : {}),
120
+ };
121
+ },
122
+ });
123
+ }
124
+ /**
125
+ * Self-registration marker (AC1) — the identifier the
126
+ * {@link AgentToolRegistry.discover} bounded source scan greps for. Aliases
127
+ * {@link registerSkillAgentTool} so a future scan-dir discovery (or the built-in
128
+ * aggregator) can call it uniformly with the other agent-tool modules.
129
+ *
130
+ * @param registry - The registry to populate.
131
+ */
132
+ export function registerAgentTools(registry) {
133
+ registerSkillAgentTool(registry);
134
+ }
135
+ //# sourceMappingURL=skill-agent-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-agent-tool.js","sourceRoot":"","sources":["../../src/tools/skill-agent-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAA0B,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA8C/E;;;;;;;GAOG;AACH,KAAK,UAAU,YAAY;IACzB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACnE,OAAO;QACL,SAAS;QACT,gBAAgB,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAChD,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YACjC,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,UAAU,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