@cleocode/core 2026.6.13 → 2026.6.14

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 (392) 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 +179 -0
  8. package/dist/check/pr-gate.d.ts.map +1 -0
  9. package/dist/check/pr-gate.js +366 -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/registry.d.ts +54 -0
  24. package/dist/config/registry.d.ts.map +1 -1
  25. package/dist/config/registry.js +94 -2
  26. package/dist/config/registry.js.map +1 -1
  27. package/dist/deriver/queue-manager.d.ts +30 -2
  28. package/dist/deriver/queue-manager.d.ts.map +1 -1
  29. package/dist/deriver/queue-manager.js +54 -9
  30. package/dist/deriver/queue-manager.js.map +1 -1
  31. package/dist/dispatch/config-domain-handler.d.ts +125 -0
  32. package/dist/dispatch/config-domain-handler.d.ts.map +1 -0
  33. package/dist/dispatch/config-domain-handler.js +160 -0
  34. package/dist/dispatch/config-domain-handler.js.map +1 -0
  35. package/dist/dispatch/contracts/input-contracts.d.ts.map +1 -1
  36. package/dist/dispatch/contracts/input-contracts.js +19 -1
  37. package/dist/dispatch/contracts/input-contracts.js.map +1 -1
  38. package/dist/docs/export-document.js +3704 -680
  39. package/dist/docs/export-document.js.map +3 -3
  40. package/dist/gateway-client/client.d.ts +123 -0
  41. package/dist/gateway-client/client.d.ts.map +1 -0
  42. package/dist/gateway-client/client.js +93 -0
  43. package/dist/gateway-client/client.js.map +1 -0
  44. package/dist/gateway-client/generated/client/client.gen.d.ts +3 -0
  45. package/dist/gateway-client/generated/client/client.gen.d.ts.map +1 -0
  46. package/dist/gateway-client/generated/client/client.gen.js +217 -0
  47. package/dist/gateway-client/generated/client/client.gen.js.map +1 -0
  48. package/dist/gateway-client/generated/client/index.d.ts +11 -0
  49. package/dist/gateway-client/generated/client/index.d.ts.map +1 -0
  50. package/dist/gateway-client/generated/client/index.js +7 -0
  51. package/dist/gateway-client/generated/client/index.js.map +1 -0
  52. package/dist/gateway-client/generated/client/types.gen.d.ts +121 -0
  53. package/dist/gateway-client/generated/client/types.gen.d.ts.map +1 -0
  54. package/dist/gateway-client/generated/client/types.gen.js +3 -0
  55. package/dist/gateway-client/generated/client/types.gen.js.map +1 -0
  56. package/dist/gateway-client/generated/client/utils.gen.d.ts +38 -0
  57. package/dist/gateway-client/generated/client/utils.gen.d.ts.map +1 -0
  58. package/dist/gateway-client/generated/client/utils.gen.js +229 -0
  59. package/dist/gateway-client/generated/client/utils.gen.js.map +1 -0
  60. package/dist/gateway-client/generated/client.gen.d.ts +13 -0
  61. package/dist/gateway-client/generated/client.gen.d.ts.map +1 -0
  62. package/dist/gateway-client/generated/client.gen.js +4 -0
  63. package/dist/gateway-client/generated/client.gen.js.map +1 -0
  64. package/dist/gateway-client/generated/core/auth.gen.d.ts +26 -0
  65. package/dist/gateway-client/generated/core/auth.gen.d.ts.map +1 -0
  66. package/dist/gateway-client/generated/core/auth.gen.js +15 -0
  67. package/dist/gateway-client/generated/core/auth.gen.js.map +1 -0
  68. package/dist/gateway-client/generated/core/bodySerializer.gen.d.ts +26 -0
  69. package/dist/gateway-client/generated/core/bodySerializer.gen.d.ts.map +1 -0
  70. package/dist/gateway-client/generated/core/bodySerializer.gen.js +58 -0
  71. package/dist/gateway-client/generated/core/bodySerializer.gen.js.map +1 -0
  72. package/dist/gateway-client/generated/core/params.gen.d.ts +44 -0
  73. package/dist/gateway-client/generated/core/params.gen.d.ts.map +1 -0
  74. package/dist/gateway-client/generated/core/params.gen.js +101 -0
  75. package/dist/gateway-client/generated/core/params.gen.js.map +1 -0
  76. package/dist/gateway-client/generated/core/pathSerializer.gen.d.ts +34 -0
  77. package/dist/gateway-client/generated/core/pathSerializer.gen.d.ts.map +1 -0
  78. package/dist/gateway-client/generated/core/pathSerializer.gen.js +107 -0
  79. package/dist/gateway-client/generated/core/pathSerializer.gen.js.map +1 -0
  80. package/dist/gateway-client/generated/core/queryKeySerializer.gen.d.ts +19 -0
  81. package/dist/gateway-client/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
  82. package/dist/gateway-client/generated/core/queryKeySerializer.gen.js +93 -0
  83. package/dist/gateway-client/generated/core/queryKeySerializer.gen.js.map +1 -0
  84. package/dist/gateway-client/generated/core/serverSentEvents.gen.d.ts +72 -0
  85. package/dist/gateway-client/generated/core/serverSentEvents.gen.d.ts.map +1 -0
  86. package/dist/gateway-client/generated/core/serverSentEvents.gen.js +133 -0
  87. package/dist/gateway-client/generated/core/serverSentEvents.gen.js.map +1 -0
  88. package/dist/gateway-client/generated/core/types.gen.d.ts +84 -0
  89. package/dist/gateway-client/generated/core/types.gen.d.ts.map +1 -0
  90. package/dist/gateway-client/generated/core/types.gen.js +3 -0
  91. package/dist/gateway-client/generated/core/types.gen.js.map +1 -0
  92. package/dist/gateway-client/generated/core/utils.gen.d.ts +20 -0
  93. package/dist/gateway-client/generated/core/utils.gen.d.ts.map +1 -0
  94. package/dist/gateway-client/generated/core/utils.gen.js +88 -0
  95. package/dist/gateway-client/generated/core/utils.gen.js.map +1 -0
  96. package/dist/gateway-client/generated/index.d.ts +3 -0
  97. package/dist/gateway-client/generated/index.d.ts.map +1 -0
  98. package/dist/gateway-client/generated/index.js +3 -0
  99. package/dist/gateway-client/generated/index.js.map +1 -0
  100. package/dist/gateway-client/generated/namespaces.gen.d.ts +512 -0
  101. package/dist/gateway-client/generated/namespaces.gen.d.ts.map +1 -0
  102. package/dist/gateway-client/generated/namespaces.gen.js +521 -0
  103. package/dist/gateway-client/generated/namespaces.gen.js.map +1 -0
  104. package/dist/gateway-client/generated/sdk.gen.d.ts +1780 -0
  105. package/dist/gateway-client/generated/sdk.gen.d.ts.map +1 -0
  106. package/dist/gateway-client/generated/sdk.gen.js +3811 -0
  107. package/dist/gateway-client/generated/sdk.gen.js.map +1 -0
  108. package/dist/gateway-client/generated/types.gen.d.ts +14681 -0
  109. package/dist/gateway-client/generated/types.gen.d.ts.map +1 -0
  110. package/dist/gateway-client/generated/types.gen.js +3 -0
  111. package/dist/gateway-client/generated/types.gen.js.map +1 -0
  112. package/dist/gateway-client/index.d.ts +27 -0
  113. package/dist/gateway-client/index.d.ts.map +1 -0
  114. package/dist/gateway-client/index.js +25 -0
  115. package/dist/gateway-client/index.js.map +1 -0
  116. package/dist/index.d.ts +10 -0
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +20 -0
  119. package/dist/index.js.map +1 -1
  120. package/dist/init.d.ts.map +1 -1
  121. package/dist/init.js +28 -0
  122. package/dist/init.js.map +1 -1
  123. package/dist/internal.d.ts +10 -1
  124. package/dist/internal.d.ts.map +1 -1
  125. package/dist/internal.js +18 -1
  126. package/dist/internal.js.map +1 -1
  127. package/dist/llm/catalog-model-resolver.d.ts +19 -0
  128. package/dist/llm/catalog-model-resolver.d.ts.map +1 -1
  129. package/dist/llm/catalog-model-resolver.js +36 -0
  130. package/dist/llm/catalog-model-resolver.js.map +1 -1
  131. package/dist/llm/catalog-resolver.d.ts +112 -0
  132. package/dist/llm/catalog-resolver.d.ts.map +1 -0
  133. package/dist/llm/catalog-resolver.js +207 -0
  134. package/dist/llm/catalog-resolver.js.map +1 -0
  135. package/dist/llm/catalog-seeder.d.ts +96 -0
  136. package/dist/llm/catalog-seeder.d.ts.map +1 -0
  137. package/dist/llm/catalog-seeder.js +189 -0
  138. package/dist/llm/catalog-seeder.js.map +1 -0
  139. package/dist/llm/cli-ops.js +5 -5
  140. package/dist/llm/cli-ops.js.map +1 -1
  141. package/dist/llm/complexity-classifier.d.ts +208 -0
  142. package/dist/llm/complexity-classifier.d.ts.map +1 -0
  143. package/dist/llm/complexity-classifier.js +359 -0
  144. package/dist/llm/complexity-classifier.js.map +1 -0
  145. package/dist/llm/credential-pool.d.ts +2 -0
  146. package/dist/llm/credential-pool.d.ts.map +1 -1
  147. package/dist/llm/credential-pool.js +5 -2
  148. package/dist/llm/credential-pool.js.map +1 -1
  149. package/dist/llm/credentials-store.d.ts +10 -14
  150. package/dist/llm/credentials-store.d.ts.map +1 -1
  151. package/dist/llm/credentials-store.js.map +1 -1
  152. package/dist/llm/entity-ops.d.ts +299 -0
  153. package/dist/llm/entity-ops.d.ts.map +1 -0
  154. package/dist/llm/entity-ops.js +441 -0
  155. package/dist/llm/entity-ops.js.map +1 -0
  156. package/dist/llm/index.d.ts +15 -0
  157. package/dist/llm/index.d.ts.map +1 -1
  158. package/dist/llm/index.js +8 -0
  159. package/dist/llm/index.js.map +1 -1
  160. package/dist/llm/llm-queue-admit.d.ts +118 -0
  161. package/dist/llm/llm-queue-admit.d.ts.map +1 -0
  162. package/dist/llm/llm-queue-admit.js +275 -0
  163. package/dist/llm/llm-queue-admit.js.map +1 -0
  164. package/dist/llm/oauth/device-code.d.ts.map +1 -1
  165. package/dist/llm/oauth/device-code.js +2 -8
  166. package/dist/llm/oauth/device-code.js.map +1 -1
  167. package/dist/llm/oauth/google-pkce.d.ts.map +1 -1
  168. package/dist/llm/oauth/google-pkce.js +2 -18
  169. package/dist/llm/oauth/google-pkce.js.map +1 -1
  170. package/dist/llm/oauth/pkce.d.ts +70 -0
  171. package/dist/llm/oauth/pkce.d.ts.map +1 -1
  172. package/dist/llm/oauth/pkce.js +106 -29
  173. package/dist/llm/oauth/pkce.js.map +1 -1
  174. package/dist/llm/onboarding/front-door.d.ts +146 -0
  175. package/dist/llm/onboarding/front-door.d.ts.map +1 -0
  176. package/dist/llm/onboarding/front-door.js +153 -0
  177. package/dist/llm/onboarding/front-door.js.map +1 -0
  178. package/dist/llm/onboarding/login-engine.d.ts +175 -0
  179. package/dist/llm/onboarding/login-engine.d.ts.map +1 -0
  180. package/dist/llm/onboarding/login-engine.js +286 -0
  181. package/dist/llm/onboarding/login-engine.js.map +1 -0
  182. package/dist/llm/pi/pi-gondolin-env.d.ts +23 -0
  183. package/dist/llm/pi/pi-gondolin-env.d.ts.map +1 -1
  184. package/dist/llm/pi/pi-gondolin-env.js +2 -2
  185. package/dist/llm/pi/pi-gondolin-env.js.map +1 -1
  186. package/dist/llm/plugin-facade.js +3853 -814
  187. package/dist/llm/plugin-facade.js.map +3 -3
  188. package/dist/llm/provider-registry/builtin/anthropic.d.ts.map +1 -1
  189. package/dist/llm/provider-registry/builtin/anthropic.js +23 -10
  190. package/dist/llm/provider-registry/builtin/anthropic.js.map +1 -1
  191. package/dist/llm/provider-registry/provider-alias.d.ts +62 -0
  192. package/dist/llm/provider-registry/provider-alias.d.ts.map +1 -0
  193. package/dist/llm/provider-registry/provider-alias.js +85 -0
  194. package/dist/llm/provider-registry/provider-alias.js.map +1 -0
  195. package/dist/llm/provider-registry/provider-defs.d.ts +45 -0
  196. package/dist/llm/provider-registry/provider-defs.d.ts.map +1 -0
  197. package/dist/llm/provider-registry/provider-defs.js +145 -0
  198. package/dist/llm/provider-registry/provider-defs.js.map +1 -0
  199. package/dist/llm/provider-registry/provider-seed.d.ts +78 -0
  200. package/dist/llm/provider-registry/provider-seed.d.ts.map +1 -0
  201. package/dist/llm/provider-registry/provider-seed.js +113 -0
  202. package/dist/llm/provider-registry/provider-seed.js.map +1 -0
  203. package/dist/llm/role-executor.d.ts.map +1 -1
  204. package/dist/llm/role-executor.js +36 -0
  205. package/dist/llm/role-executor.js.map +1 -1
  206. package/dist/llm/role-resolver.d.ts.map +1 -1
  207. package/dist/llm/role-resolver.js +9 -2
  208. package/dist/llm/role-resolver.js.map +1 -1
  209. package/dist/llm/system-resolver.d.ts.map +1 -1
  210. package/dist/llm/system-resolver.js +73 -22
  211. package/dist/llm/system-resolver.js.map +1 -1
  212. package/dist/memory/learnings.d.ts +4 -0
  213. package/dist/memory/learnings.d.ts.map +1 -1
  214. package/dist/memory/patterns.d.ts +4 -0
  215. package/dist/memory/patterns.d.ts.map +1 -1
  216. package/dist/metrics/index.d.ts +2 -0
  217. package/dist/metrics/index.d.ts.map +1 -1
  218. package/dist/metrics/index.js +1 -0
  219. package/dist/metrics/index.js.map +1 -1
  220. package/dist/orchestration/spawn.d.ts +89 -0
  221. package/dist/orchestration/spawn.d.ts.map +1 -1
  222. package/dist/orchestration/spawn.js +68 -0
  223. package/dist/orchestration/spawn.js.map +1 -1
  224. package/dist/playbooks/cantbook-profile.d.ts +96 -0
  225. package/dist/playbooks/cantbook-profile.d.ts.map +1 -0
  226. package/dist/playbooks/cantbook-profile.js +97 -0
  227. package/dist/playbooks/cantbook-profile.js.map +1 -0
  228. package/dist/playbooks/guarded-deterministic-runner.d.ts +153 -0
  229. package/dist/playbooks/guarded-deterministic-runner.d.ts.map +1 -0
  230. package/dist/playbooks/guarded-deterministic-runner.js +155 -0
  231. package/dist/playbooks/guarded-deterministic-runner.js.map +1 -0
  232. package/dist/playbooks/index.d.ts +2 -0
  233. package/dist/playbooks/index.d.ts.map +1 -1
  234. package/dist/playbooks/index.js +10 -0
  235. package/dist/playbooks/index.js.map +1 -1
  236. package/dist/playbooks/pi-runner-wiring.d.ts +75 -0
  237. package/dist/playbooks/pi-runner-wiring.d.ts.map +1 -0
  238. package/dist/playbooks/pi-runner-wiring.js +82 -0
  239. package/dist/playbooks/pi-runner-wiring.js.map +1 -0
  240. package/dist/runtime/openapi/generate-openapi.d.ts +211 -0
  241. package/dist/runtime/openapi/generate-openapi.d.ts.map +1 -0
  242. package/dist/runtime/openapi/generate-openapi.js +300 -0
  243. package/dist/runtime/openapi/generate-openapi.js.map +1 -0
  244. package/dist/runtime/openapi/index.d.ts +16 -0
  245. package/dist/runtime/openapi/index.d.ts.map +1 -0
  246. package/dist/runtime/openapi/index.js +16 -0
  247. package/dist/runtime/openapi/index.js.map +1 -0
  248. package/dist/selfimprove/scenarios/dhq-replay-find/golden.json +32 -0
  249. package/dist/selfimprove/scenarios/dhq-replay-find/scenario.json +18 -0
  250. package/dist/setup/config-json-merge.d.ts.map +1 -1
  251. package/dist/setup/config-json-merge.js +14 -0
  252. package/dist/setup/config-json-merge.js.map +1 -1
  253. package/dist/setup/index.d.ts +23 -11
  254. package/dist/setup/index.d.ts.map +1 -1
  255. package/dist/setup/index.js +25 -12
  256. package/dist/setup/index.js.map +1 -1
  257. package/dist/setup/sections/llm.d.ts +28 -1
  258. package/dist/setup/sections/llm.d.ts.map +1 -1
  259. package/dist/setup/sections/llm.js +27 -6
  260. package/dist/setup/sections/llm.js.map +1 -1
  261. package/dist/setup/sections/models-roles.d.ts +40 -0
  262. package/dist/setup/sections/models-roles.d.ts.map +1 -0
  263. package/dist/setup/sections/models-roles.js +219 -0
  264. package/dist/setup/sections/models-roles.js.map +1 -0
  265. package/dist/setup/wizard.d.ts +19 -1
  266. package/dist/setup/wizard.d.ts.map +1 -1
  267. package/dist/setup/wizard.js.map +1 -1
  268. package/dist/store/schedule-schema.d.ts +195 -0
  269. package/dist/store/schedule-schema.d.ts.map +1 -0
  270. package/dist/store/schedule-schema.js +84 -0
  271. package/dist/store/schedule-schema.js.map +1 -0
  272. package/dist/store/schedule-store.d.ts +144 -0
  273. package/dist/store/schedule-store.d.ts.map +1 -0
  274. package/dist/store/schedule-store.js +162 -0
  275. package/dist/store/schedule-store.js.map +1 -0
  276. package/dist/store/schema/attachments.d.ts +1 -1
  277. package/dist/store/schema/cleo-global/index.d.ts +3 -0
  278. package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
  279. package/dist/store/schema/cleo-global/index.js +5 -0
  280. package/dist/store/schema/cleo-global/index.js.map +1 -1
  281. package/dist/store/schema/cleo-global/models-catalog.d.ts +359 -0
  282. package/dist/store/schema/cleo-global/models-catalog.d.ts.map +1 -0
  283. package/dist/store/schema/cleo-global/models-catalog.js +114 -0
  284. package/dist/store/schema/cleo-global/models-catalog.js.map +1 -0
  285. package/dist/store/schema/cleo-global/providers.d.ts +279 -0
  286. package/dist/store/schema/cleo-global/providers.d.ts.map +1 -0
  287. package/dist/store/schema/cleo-global/providers.js +94 -0
  288. package/dist/store/schema/cleo-global/providers.js.map +1 -0
  289. package/dist/store/schema/cleo-global/services.d.ts +493 -0
  290. package/dist/store/schema/cleo-global/services.d.ts.map +1 -0
  291. package/dist/store/schema/cleo-global/services.js +200 -0
  292. package/dist/store/schema/cleo-global/services.js.map +1 -0
  293. package/dist/store/schema/cleo-project/docs.d.ts +1 -1
  294. package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
  295. package/dist/store/schema/cleo-shared/brain.d.ts +2 -2
  296. package/dist/store/schema/memory-schema.d.ts +182 -2
  297. package/dist/store/schema/memory-schema.d.ts.map +1 -1
  298. package/dist/store/schema/memory-schema.js +111 -2
  299. package/dist/store/schema/memory-schema.js.map +1 -1
  300. package/dist/store/schema/provenance/releases.d.ts +1 -1
  301. package/dist/store/service-connections-accessor.d.ts +313 -0
  302. package/dist/store/service-connections-accessor.d.ts.map +1 -0
  303. package/dist/store/service-connections-accessor.js +464 -0
  304. package/dist/store/service-connections-accessor.js.map +1 -0
  305. package/dist/store/service-host-matcher.d.ts +70 -0
  306. package/dist/store/service-host-matcher.d.ts.map +1 -0
  307. package/dist/store/service-host-matcher.js +127 -0
  308. package/dist/store/service-host-matcher.js.map +1 -0
  309. package/dist/store/service-injection.d.ts +152 -0
  310. package/dist/store/service-injection.d.ts.map +1 -0
  311. package/dist/store/service-injection.js +225 -0
  312. package/dist/store/service-injection.js.map +1 -0
  313. package/dist/store/service-oauth.d.ts +287 -0
  314. package/dist/store/service-oauth.d.ts.map +1 -0
  315. package/dist/store/service-oauth.js +524 -0
  316. package/dist/store/service-oauth.js.map +1 -0
  317. package/dist/store/service-trust-gate.d.ts +164 -0
  318. package/dist/store/service-trust-gate.d.ts.map +1 -0
  319. package/dist/store/service-trust-gate.js +122 -0
  320. package/dist/store/service-trust-gate.js.map +1 -0
  321. package/dist/store/validation-schemas.d.ts +4 -4
  322. package/dist/tasks/agent-lifecycle-lane.d.ts +175 -0
  323. package/dist/tasks/agent-lifecycle-lane.d.ts.map +1 -0
  324. package/dist/tasks/agent-lifecycle-lane.js +176 -0
  325. package/dist/tasks/agent-lifecycle-lane.js.map +1 -0
  326. package/dist/tasks/complete.d.ts +17 -0
  327. package/dist/tasks/complete.d.ts.map +1 -1
  328. package/dist/tasks/complete.js +53 -10
  329. package/dist/tasks/complete.js.map +1 -1
  330. package/dist/tasks/depends-waiver-audit.d.ts +52 -0
  331. package/dist/tasks/depends-waiver-audit.d.ts.map +1 -0
  332. package/dist/tasks/depends-waiver-audit.js +36 -0
  333. package/dist/tasks/depends-waiver-audit.js.map +1 -0
  334. package/dist/tasks/engine-wrap.d.ts +36 -2
  335. package/dist/tasks/engine-wrap.d.ts.map +1 -1
  336. package/dist/tasks/engine-wrap.js +44 -2
  337. package/dist/tasks/engine-wrap.js.map +1 -1
  338. package/dist/tasks/index.d.ts +1 -0
  339. package/dist/tasks/index.d.ts.map +1 -1
  340. package/dist/tasks/index.js +1 -0
  341. package/dist/tasks/index.js.map +1 -1
  342. package/dist/tasks/ops.d.ts +3 -0
  343. package/dist/tasks/ops.d.ts.map +1 -1
  344. package/dist/tasks/task-ops.d.ts +1 -1
  345. package/dist/tasks/task-ops.d.ts.map +1 -1
  346. package/dist/tasks/task-ops.js +3 -1
  347. package/dist/tasks/task-ops.js.map +1 -1
  348. package/dist/tasks/task-reparent.d.ts +90 -0
  349. package/dist/tasks/task-reparent.d.ts.map +1 -1
  350. package/dist/tasks/task-reparent.js +171 -0
  351. package/dist/tasks/task-reparent.js.map +1 -1
  352. package/dist/tools/builtin-agent-tools.d.ts.map +1 -1
  353. package/dist/tools/builtin-agent-tools.js +41 -0
  354. package/dist/tools/builtin-agent-tools.js.map +1 -1
  355. package/dist/tools/exec-code-agent-tool.d.ts +179 -0
  356. package/dist/tools/exec-code-agent-tool.d.ts.map +1 -0
  357. package/dist/tools/exec-code-agent-tool.js +239 -0
  358. package/dist/tools/exec-code-agent-tool.js.map +1 -0
  359. package/dist/tools/index.d.ts +6 -0
  360. package/dist/tools/index.d.ts.map +1 -1
  361. package/dist/tools/index.js +15 -0
  362. package/dist/tools/index.js.map +1 -1
  363. package/dist/tools/mcp-agent-tool.d.ts +189 -0
  364. package/dist/tools/mcp-agent-tool.d.ts.map +1 -0
  365. package/dist/tools/mcp-agent-tool.js +243 -0
  366. package/dist/tools/mcp-agent-tool.js.map +1 -0
  367. package/dist/tools/media-agent-tools.d.ts +105 -0
  368. package/dist/tools/media-agent-tools.d.ts.map +1 -0
  369. package/dist/tools/media-agent-tools.js +255 -0
  370. package/dist/tools/media-agent-tools.js.map +1 -0
  371. package/dist/tools/memory-agent-tools.d.ts +99 -0
  372. package/dist/tools/memory-agent-tools.d.ts.map +1 -0
  373. package/dist/tools/memory-agent-tools.js +190 -0
  374. package/dist/tools/memory-agent-tools.js.map +1 -0
  375. package/dist/tools/schedule-agent-tools.d.ts +151 -0
  376. package/dist/tools/schedule-agent-tools.d.ts.map +1 -0
  377. package/dist/tools/schedule-agent-tools.js +238 -0
  378. package/dist/tools/schedule-agent-tools.js.map +1 -0
  379. package/dist/tools/skill-agent-tool.d.ts +108 -0
  380. package/dist/tools/skill-agent-tool.d.ts.map +1 -0
  381. package/dist/tools/skill-agent-tool.js +135 -0
  382. package/dist/tools/skill-agent-tool.js.map +1 -0
  383. package/dist/validation/engine-ops.d.ts.map +1 -1
  384. package/dist/validation/engine-ops.js +17 -1
  385. package/dist/validation/engine-ops.js.map +1 -1
  386. package/migrations/drizzle-brain/20260610000001_t10405-bitemporal-network-columns/migration.sql +71 -0
  387. package/migrations/drizzle-cleo-global/20260609000000_t11937-service-vault/migration.sql +93 -0
  388. package/migrations/drizzle-cleo-global/20260609010000_t11733-models-catalog/migration.sql +65 -0
  389. package/migrations/drizzle-cleo-global/20260609020000_t11703-providers/migration.sql +52 -0
  390. package/migrations/drizzle-cleo-global/20260610000000_t11962-schedules/migration.sql +48 -0
  391. package/migrations/drizzle-cleo-project/20260610000000_t11962-schedules/migration.sql +48 -0
  392. package/package.json +23 -13
@@ -47,6 +47,42 @@ import { enforceThinAgent, } from './thin-agent.js';
47
47
  // ============================================================================
48
48
  // Internal helpers
49
49
  // ============================================================================
50
+ /**
51
+ * Restrict a `baseline` list to only the entries also present in `allowlist`
52
+ * (set intersection, baseline order preserved, deduped). This is the core
53
+ * T1947 enforcement primitive: the allowlist can only REMOVE entries from the
54
+ * baseline, never add — an allowlist entry absent from the baseline is ignored.
55
+ *
56
+ * When `allowlist` is `undefined`, the baseline passes through unchanged (a
57
+ * node that declares no allowlist is unaffected — additive).
58
+ *
59
+ * @param baseline - The Tier-0/1/2 baseline list (skills or tools).
60
+ * @param allowlist - The node's per-step allowlist, or `undefined` for no restriction.
61
+ * @returns `{ effective, removed }` — the intersected list plus the baseline
62
+ * entries that were dropped (empty when no allowlist was applied).
63
+ * @task T1947
64
+ */
65
+ function applyAllowlist(baseline, allowlist) {
66
+ if (allowlist === undefined) {
67
+ return { effective: baseline, removed: [], applied: false };
68
+ }
69
+ const allow = new Set(allowlist);
70
+ const effective = [];
71
+ const removed = [];
72
+ const seen = new Set();
73
+ for (const entry of baseline) {
74
+ if (seen.has(entry))
75
+ continue;
76
+ seen.add(entry);
77
+ if (allow.has(entry)) {
78
+ effective.push(entry);
79
+ }
80
+ else {
81
+ removed.push(entry);
82
+ }
83
+ }
84
+ return { effective, removed, applied: true };
85
+ }
50
86
  /**
51
87
  * Map an `orchLevel` (0/1/2) to the canonical {@link AgentSpawnCapability}.
52
88
  *
@@ -192,6 +228,9 @@ export async function composeSpawnPayload(db, task, options = {}) {
192
228
  // does not (yet) emit one, so legacy call sites remain unchanged.
193
229
  const thinAgentMode = options.thinAgentEnforcement ?? 'strict';
194
230
  let thinAgentMeta;
231
+ // Tool baseline after the thin-agent guard (post-strip in `'strip'` mode).
232
+ // `undefined` when the caller supplied no tool list at all.
233
+ let toolBaseline;
195
234
  if (options.tools !== undefined) {
196
235
  const thinAgentResult = enforceThinAgent(role, options.tools, thinAgentMode);
197
236
  if (!thinAgentResult.ok) {
@@ -202,6 +241,30 @@ export async function composeSpawnPayload(db, task, options = {}) {
202
241
  stripped: thinAgentResult.stripped,
203
242
  bypassed: thinAgentResult.bypassed,
204
243
  };
244
+ toolBaseline = thinAgentResult.tools;
245
+ }
246
+ // 6b-bis. Per-step skill/tool allowlist enforcement (T1947 · M4).
247
+ //
248
+ // The Tier-0/1/2 selection above (role → tier) determines the BASELINE skill
249
+ // set (`resolvedAgent.skills`) and — when the caller supplied one — the tool
250
+ // baseline (post thin-agent guard). A cantbook node's `allowed_skills` /
251
+ // `allowed_tools` then FURTHER RESTRICTS that baseline via set intersection:
252
+ // the allowlist can only REMOVE entries, never add one (AC2/AC3/AC4). When a
253
+ // node declares no allowlist the baseline passes through unchanged (additive).
254
+ const skillResult = applyAllowlist(resolvedAgent.skills, options.allowedSkills);
255
+ const effectiveSkills = skillResult.effective;
256
+ const toolResult = toolBaseline !== undefined
257
+ ? applyAllowlist(toolBaseline, options.allowedTools)
258
+ : { effective: undefined, removed: [], applied: false };
259
+ const effectiveTools = toolResult.effective;
260
+ let allowlistMeta;
261
+ if (skillResult.applied || toolResult.applied) {
262
+ allowlistMeta = {
263
+ removedSkills: skillResult.removed,
264
+ removedTools: toolResult.removed,
265
+ skillsEmptiedByAllowlist: skillResult.applied && effectiveSkills.length === 0,
266
+ toolsEmptiedByAllowlist: toolResult.applied && (effectiveTools?.length ?? 0) === 0,
267
+ };
205
268
  }
206
269
  // 6c. PSYCHE-MEMORY wiring (T1260 E3 — M4 injection primitive).
207
270
  // Build the retrieval bundle for tier-1/2 prompts when a sessionId is
@@ -347,6 +410,9 @@ export async function composeSpawnPayload(db, task, options = {}) {
347
410
  if (thinAgentMeta !== undefined) {
348
411
  meta.thinAgent = thinAgentMeta;
349
412
  }
413
+ if (allowlistMeta !== undefined) {
414
+ meta.allowlist = allowlistMeta;
415
+ }
350
416
  return {
351
417
  taskId: task.id,
352
418
  agentId: resolvedAgent.agentId,
@@ -357,6 +423,8 @@ export async function composeSpawnPayload(db, task, options = {}) {
357
423
  atomicity,
358
424
  prompt: promptResult.prompt,
359
425
  ...(retrievalBundle !== undefined ? { retrievalBundle } : {}),
426
+ effectiveSkills,
427
+ ...(effectiveTools !== undefined ? { effectiveTools } : {}),
360
428
  meta,
361
429
  };
362
430
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../src/orchestration/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAwB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAE1B,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAoB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAEhB,4BAA4B,GAI7B,MAAM,mBAAmB,CAAC;AA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gate).
3
+ *
4
+ * A `.cantbook` agentic stage can pin its LLM via `profile:` (a named
5
+ * `llm.profiles` entry), or the inline `model:` / `provider:` escape hatch
6
+ * ({@link PlaybookAgenticNode}). This module is the single seam the two
7
+ * production cantbook dispatchers (`buildDefaultDispatcher` in `playbook.ts` and
8
+ * `buildGoDispatcher` in `go-ivtr-runner.ts`) call to turn that declaration into
9
+ * a RESOLUTION through the E9 chokepoint.
10
+ *
11
+ * ## Gate-13 compliance (no transport construction here)
12
+ *
13
+ * This helper ONLY calls {@link resolveLLMForSystem} — the single E9 resolution
14
+ * chokepoint. It NEVER constructs a transport, an AI-SDK client, or reads a
15
+ * credential off the wire; the returned {@link ResolvedLLMForSystem} carries the
16
+ * provider/model/sealed-credential METADATA only. The Pi runner / model-runner
17
+ * downstream is the sole place a client is built. Passing a resolution hint (the
18
+ * profile + the cantbook system key) is exactly the Gate-13-allowed seam.
19
+ *
20
+ * ## How the cantbook node keys the resolver
21
+ *
22
+ * The node identity is encoded as the OPEN-axis system-of-use key
23
+ * `cantbook:<playbook>#<nodeId>` (via {@link formatSystemKey}), and threaded as
24
+ * `resolveLLMForSystem`'s `systemKey` option so it drives the
25
+ * `llm.systems[key]` granular-override tier + audit identity. The flat `system`
26
+ * argument stays the resolvable `'task-executor'` background label (the same one
27
+ * the Pi runner uses), and the node's `profile:` flows through `opts.profile` as
28
+ * the highest-priority pin. When the node declares neither `profile` nor
29
+ * `model`/`provider`, callers should skip this helper — the resolution is
30
+ * unchanged.
31
+ *
32
+ * @module playbooks/cantbook-profile
33
+ * @task T11759
34
+ * @epic T10403
35
+ */
36
+ import { type ResolvedLLMForSystem } from '../llm/system-resolver.js';
37
+ /** The per-stage LLM pin a `.cantbook` agentic node may declare (T11759). */
38
+ export interface CantbookProfilePin {
39
+ /** Named `llm.profiles` profile to pin (highest priority when resolvable). */
40
+ readonly profile?: string;
41
+ /** Inline model id escape hatch (resolution hint only — no transport built). */
42
+ readonly model?: string;
43
+ /** Inline provider transport escape hatch (resolution hint only). */
44
+ readonly provider?: string;
45
+ }
46
+ /** Inputs to {@link resolveCantbookNodeProfile}. */
47
+ export interface ResolveCantbookNodeProfileInput {
48
+ /** The playbook (`.cantbook`) name — the first segment of the node identity. */
49
+ readonly playbookName: string;
50
+ /** The agentic node id — the second segment of the node identity. */
51
+ readonly nodeId: string;
52
+ /** The node's declared LLM pin (`profile` / `model` / `provider`). */
53
+ readonly pin: CantbookProfilePin;
54
+ /** Project root for config + credential resolution (defaults to cwd inside E9). */
55
+ readonly projectRoot?: string;
56
+ }
57
+ /**
58
+ * Build the canonical OPEN-axis system-of-use key for a cantbook node
59
+ * (`cantbook:<playbook>#<nodeId>`).
60
+ *
61
+ * Exported so the dispatchers + tests assert the exact key the resolver is
62
+ * threaded with WITHOUT re-implementing the encoding.
63
+ *
64
+ * @param playbookName - The `.cantbook` name.
65
+ * @param nodeId - The agentic node id.
66
+ * @returns The encoded `cantbook:<playbook>#<nodeId>` key.
67
+ * @task T11759
68
+ */
69
+ export declare function cantbookNodeSystemKey(playbookName: string, nodeId: string): string;
70
+ /**
71
+ * `true` when a node's pin actually declares an LLM override (so the dispatcher
72
+ * should resolve via {@link resolveCantbookNodeProfile}); `false` when it is the
73
+ * empty/unset pin and the default resolution path applies unchanged.
74
+ *
75
+ * @param pin - The node's declared pin (may be all-undefined).
76
+ * @returns Whether any of `profile` / `model` / `provider` is set.
77
+ * @task T11759
78
+ */
79
+ export declare function hasCantbookProfilePin(pin: CantbookProfilePin): boolean;
80
+ /**
81
+ * Resolve a cantbook stage's pinned LLM through the E9 chokepoint
82
+ * ({@link resolveLLMForSystem}).
83
+ *
84
+ * Threads the node identity as the `cantbook:<playbook>#<nodeId>` system key and
85
+ * the node's `profile:` as the highest-priority pin. Inline `model:` / `provider:`
86
+ * are NOT consumed by the resolver tiers directly (those are not config keys) —
87
+ * they ride back on the returned envelope as the caller-supplied hint so the
88
+ * dispatcher can surface them to the spawn / model-runner boundary. This function
89
+ * NEVER constructs a transport (Gate-13): it only resolves metadata.
90
+ *
91
+ * @param input - Playbook name + node id + the declared pin + project root.
92
+ * @returns The {@link ResolvedLLMForSystem} envelope (metadata only; never throws).
93
+ * @task T11759
94
+ */
95
+ export declare function resolveCantbookNodeProfile(input: ResolveCantbookNodeProfileInput): Promise<ResolvedLLMForSystem>;
96
+ //# sourceMappingURL=cantbook-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cantbook-profile.d.ts","sourceRoot":"","sources":["../../src/playbooks/cantbook-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,2BAA2B,CAAC;AAS3F,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC9C,gFAAgF;IAChF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAEtE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAQ/B"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Cantbook stage LLM-profile resolution (T11759 · M4 cantbook done-gate).
3
+ *
4
+ * A `.cantbook` agentic stage can pin its LLM via `profile:` (a named
5
+ * `llm.profiles` entry), or the inline `model:` / `provider:` escape hatch
6
+ * ({@link PlaybookAgenticNode}). This module is the single seam the two
7
+ * production cantbook dispatchers (`buildDefaultDispatcher` in `playbook.ts` and
8
+ * `buildGoDispatcher` in `go-ivtr-runner.ts`) call to turn that declaration into
9
+ * a RESOLUTION through the E9 chokepoint.
10
+ *
11
+ * ## Gate-13 compliance (no transport construction here)
12
+ *
13
+ * This helper ONLY calls {@link resolveLLMForSystem} — the single E9 resolution
14
+ * chokepoint. It NEVER constructs a transport, an AI-SDK client, or reads a
15
+ * credential off the wire; the returned {@link ResolvedLLMForSystem} carries the
16
+ * provider/model/sealed-credential METADATA only. The Pi runner / model-runner
17
+ * downstream is the sole place a client is built. Passing a resolution hint (the
18
+ * profile + the cantbook system key) is exactly the Gate-13-allowed seam.
19
+ *
20
+ * ## How the cantbook node keys the resolver
21
+ *
22
+ * The node identity is encoded as the OPEN-axis system-of-use key
23
+ * `cantbook:<playbook>#<nodeId>` (via {@link formatSystemKey}), and threaded as
24
+ * `resolveLLMForSystem`'s `systemKey` option so it drives the
25
+ * `llm.systems[key]` granular-override tier + audit identity. The flat `system`
26
+ * argument stays the resolvable `'task-executor'` background label (the same one
27
+ * the Pi runner uses), and the node's `profile:` flows through `opts.profile` as
28
+ * the highest-priority pin. When the node declares neither `profile` nor
29
+ * `model`/`provider`, callers should skip this helper — the resolution is
30
+ * unchanged.
31
+ *
32
+ * @module playbooks/cantbook-profile
33
+ * @task T11759
34
+ * @epic T10403
35
+ */
36
+ import { formatSystemKey } from '../llm/system-key.js';
37
+ import { resolveLLMForSystem } from '../llm/system-resolver.js';
38
+ /**
39
+ * The flat background {@link SystemOfUseLabel} a cantbook stage resolves its LLM
40
+ * through. Mirrors the Pi runner's default (`'task-executor'`) so a stage with
41
+ * NO profile pin resolves to the same background lane the runner already uses.
42
+ */
43
+ const CANTBOOK_BASE_SYSTEM = 'task-executor';
44
+ /**
45
+ * Build the canonical OPEN-axis system-of-use key for a cantbook node
46
+ * (`cantbook:<playbook>#<nodeId>`).
47
+ *
48
+ * Exported so the dispatchers + tests assert the exact key the resolver is
49
+ * threaded with WITHOUT re-implementing the encoding.
50
+ *
51
+ * @param playbookName - The `.cantbook` name.
52
+ * @param nodeId - The agentic node id.
53
+ * @returns The encoded `cantbook:<playbook>#<nodeId>` key.
54
+ * @task T11759
55
+ */
56
+ export function cantbookNodeSystemKey(playbookName, nodeId) {
57
+ return formatSystemKey({ kind: 'cantbook-node', id: `${playbookName}#${nodeId}` });
58
+ }
59
+ /**
60
+ * `true` when a node's pin actually declares an LLM override (so the dispatcher
61
+ * should resolve via {@link resolveCantbookNodeProfile}); `false` when it is the
62
+ * empty/unset pin and the default resolution path applies unchanged.
63
+ *
64
+ * @param pin - The node's declared pin (may be all-undefined).
65
+ * @returns Whether any of `profile` / `model` / `provider` is set.
66
+ * @task T11759
67
+ */
68
+ export function hasCantbookProfilePin(pin) {
69
+ return pin.profile !== undefined || pin.model !== undefined || pin.provider !== undefined;
70
+ }
71
+ /**
72
+ * Resolve a cantbook stage's pinned LLM through the E9 chokepoint
73
+ * ({@link resolveLLMForSystem}).
74
+ *
75
+ * Threads the node identity as the `cantbook:<playbook>#<nodeId>` system key and
76
+ * the node's `profile:` as the highest-priority pin. Inline `model:` / `provider:`
77
+ * are NOT consumed by the resolver tiers directly (those are not config keys) —
78
+ * they ride back on the returned envelope as the caller-supplied hint so the
79
+ * dispatcher can surface them to the spawn / model-runner boundary. This function
80
+ * NEVER constructs a transport (Gate-13): it only resolves metadata.
81
+ *
82
+ * @param input - Playbook name + node id + the declared pin + project root.
83
+ * @returns The {@link ResolvedLLMForSystem} envelope (metadata only; never throws).
84
+ * @task T11759
85
+ */
86
+ export async function resolveCantbookNodeProfile(input) {
87
+ const systemKey = cantbookNodeSystemKey(input.playbookName, input.nodeId);
88
+ const opts = { systemKey };
89
+ if (input.projectRoot !== undefined)
90
+ opts.projectRoot = input.projectRoot;
91
+ if (input.pin.profile !== undefined)
92
+ opts.profile = input.pin.profile;
93
+ // `resolveLLMForSystem` is the single E9 chokepoint — it owns config tiers,
94
+ // CredentialPool binding, and the sealed-handle. No client is built here.
95
+ return resolveLLMForSystem(CANTBOOK_BASE_SYSTEM, opts);
96
+ }
97
+ //# sourceMappingURL=cantbook-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cantbook-profile.js","sourceRoot":"","sources":["../../src/playbooks/cantbook-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAA6B,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAE3F;;;;GAIG;AACH,MAAM,oBAAoB,GAAqB,eAAe,CAAC;AAwB/D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAoB,EAAE,MAAc;IACxE,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,GAAG,YAAY,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACrF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAuB;IAC3D,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC5F,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAAsC;IAEtC,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1E,MAAM,IAAI,GAA+B,EAAE,SAAS,EAAE,CAAC;IACvD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAC1E,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACtE,4EAA4E;IAC5E,0EAA0E;IAC1E,OAAO,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Guarded deterministic-node runner — routes EVERY `deterministic` (shell/tool)
3
+ * dispatch in `executePlaybook` through the `guard.ts` deny-first chokepoint
4
+ * (T11802 · M4 cantbook done-gate).
5
+ *
6
+ * ## The gap this closes (AC1)
7
+ *
8
+ * The playbook runtime (`@cleocode/playbooks/runtime`) executes `deterministic`
9
+ * nodes through an INJECTED `DeterministicRunner`. When no runner is injected it
10
+ * degrades to `AgentDispatcher.dispatch` with a synthetic `deterministic:<cmd>`
11
+ * agent id — a path that NEVER touches the `guard.ts` shell denylist. So a
12
+ * `.cantbook` shell step could spawn a subprocess that bypasses the single
13
+ * policy point.
14
+ *
15
+ * This factory builds the CANONICAL production `DeterministicRunner`: every
16
+ * command is funnelled through the injected {@link GuardedToolSurface}'s
17
+ * `executeShell` — the SAME deny-first command policy + env-scrub chokepoint
18
+ * (`createToolGuard`) that in-process skill nodes already use (T11477). There is
19
+ * NO second subprocess code path: shell steps and skill→tool calls share ONE
20
+ * guard. The runtime stays a pure state machine (it imports no `child_process`);
21
+ * the guard owns the spawn (AC1).
22
+ *
23
+ * ## Deny semantics (AC3)
24
+ *
25
+ * The guard's `executeShell` checks the command basename against the policy
26
+ * denylist BEFORE any process is spawned. In `mode: 'enforce'` a denied command
27
+ * rejects with {@link GuardDeniedError} (`E_TOOL_GUARD_DENIED`); this runner
28
+ * catches that rejection and maps it to a contract-clean
29
+ * `{ status: 'failure', error }` envelope so the runtime's retry / escalation
30
+ * semantics stay intact (the runtime contract is non-throwing). In `mode: 'warn'`
31
+ * the guard logs-and-proceeds — the denylist is advisory — so a guarded runner
32
+ * built for enforcement MUST be constructed from an `enforce`-mode guard.
33
+ *
34
+ * ## Why a factory over a guard (DIP)
35
+ *
36
+ * The runner depends on the abstract {@link GuardedToolSurface} (the contract
37
+ * shape of `createToolGuard()`), NOT on the concrete guard — so the policy point
38
+ * is injected, exactly mirroring {@link createSkillNodeExecutor}. `core` builds
39
+ * the guard once (`createToolGuard({ allowedRoots, deniedCommands, mode })`) and
40
+ * hands the same surface to BOTH the skill executor and this deterministic
41
+ * runner.
42
+ *
43
+ * @epic T11391
44
+ * @task T11802
45
+ * @saga T11387
46
+ * @see ../tools/guard.ts — the deny-first chokepoint
47
+ * @see ./skill-node-executor.ts — the sibling in-process skill path
48
+ */
49
+ import type { GuardedToolSurface } from '@cleocode/contracts/tools/skill-executor';
50
+ /**
51
+ * Canonical deny-list of destructive command basenames a `.cantbook`
52
+ * `deterministic` node may NOT run (T11802 · AC3). This is the SSoT the
53
+ * production dispatcher hands to `createToolGuard({ deniedCommands })` so the
54
+ * SAME chokepoint that guards in-process skill→tool calls also rejects a
55
+ * dangerous shell step. Matched against the command's last path segment by the
56
+ * guard, so `/bin/rm` and `rm` are both denied.
57
+ *
58
+ * Intentionally conservative — destructive disk / process / system operations a
59
+ * planning playbook should never invoke. Extend deliberately; every addition is
60
+ * a policy decision.
61
+ */
62
+ export declare const DEFAULT_DETERMINISTIC_DENIED_COMMANDS: readonly string[];
63
+ /**
64
+ * Minimal projection of the playbook runtime's `DeterministicRunInput` that the
65
+ * guarded runner consumes. Declared structurally so `@cleocode/core` does NOT
66
+ * import `@cleocode/playbooks` (preserves the directed layering
67
+ * `contracts → core → playbooks`). The runtime's input is structurally
68
+ * assignable to this shape.
69
+ */
70
+ export interface GuardedDeterministicInput {
71
+ /** Playbook run identifier (FK into `playbook_runs.run_id`). */
72
+ readonly runId: string;
73
+ /** Node identifier within the run graph. */
74
+ readonly nodeId: string;
75
+ /** Executable to run (NOT a shell string — args are passed separately). */
76
+ readonly command: string;
77
+ /** Arguments passed to {@link GuardedDeterministicInput.command}. */
78
+ readonly args: readonly string[];
79
+ /** Working directory. Defaults to `process.cwd()` in the shell primitive. */
80
+ readonly cwd?: string;
81
+ /** Extra environment variables merged (and scrubbed) over the child env. */
82
+ readonly env?: Readonly<Record<string, string>>;
83
+ /** Hard timeout in milliseconds; the process is killed when exceeded. */
84
+ readonly timeout_ms?: number;
85
+ }
86
+ /**
87
+ * Terminal output of a guarded deterministic execution. Structurally identical
88
+ * to the runtime's `DeterministicRunResult` so this runner is assignable to the
89
+ * runtime's `DeterministicRunner` interface without a wrapper.
90
+ */
91
+ export interface GuardedDeterministicResult {
92
+ status: 'success' | 'failure';
93
+ /** Key-value pairs merged into the run context on success. */
94
+ output: Record<string, unknown>;
95
+ /** Human-readable failure reason on `status === 'failure'`. */
96
+ error?: string;
97
+ }
98
+ /**
99
+ * Structural match for the playbook runtime's `DeterministicRunner` interface.
100
+ * Re-declared here (not imported) for the same directed-layering reason as
101
+ * {@link GuardedDeterministicInput}.
102
+ */
103
+ export interface GuardedDeterministicRunner {
104
+ run(input: GuardedDeterministicInput): Promise<GuardedDeterministicResult>;
105
+ }
106
+ /**
107
+ * Options accepted by {@link createGuardedDeterministicRunner}.
108
+ *
109
+ * @task T11802
110
+ */
111
+ export interface GuardedDeterministicRunnerOptions {
112
+ /**
113
+ * The deny-first guarded tool surface every deterministic command is routed
114
+ * through. Typically the SAME `createToolGuard({ allowedRoots, deniedCommands,
115
+ * mode })` result handed to the in-process skill executor — so shell steps and
116
+ * skill→tool calls share ONE policy point. Injected (DIP) — the runner never
117
+ * constructs its own guard.
118
+ */
119
+ readonly tools: GuardedToolSurface;
120
+ }
121
+ /**
122
+ * Build a {@link GuardedDeterministicRunner} that routes EVERY `deterministic`
123
+ * node command through the injected guard's `executeShell` (T11802 · AC1).
124
+ *
125
+ * Inject the result as `deterministicRunner` when calling `executePlaybook`:
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * import { createToolGuard } from '@cleocode/core/internal';
130
+ *
131
+ * const tools = createToolGuard({
132
+ * allowedRoots: [projectRoot],
133
+ * deniedCommands: ['rm', 'shutdown', 'mkfs'],
134
+ * mode: 'enforce',
135
+ * });
136
+ * await executePlaybook({
137
+ * db, playbook, playbookHash, initialContext, dispatcher,
138
+ * deterministicRunner: createGuardedDeterministicRunner({ tools }),
139
+ * });
140
+ * // A `deterministic` node running `rm` → guard rejects → { status: 'failure' }
141
+ * ```
142
+ *
143
+ * The returned runner NEVER throws — a guard `enforce`-mode rejection
144
+ * ({@link import('../tools/guard.js').GuardDeniedError}) is caught and mapped to
145
+ * a `{ status: 'failure', error }` envelope so the runtime's retry / escalation
146
+ * stays intact (the runtime's `DeterministicRunner` contract is non-throwing).
147
+ *
148
+ * @param opts - The injected guarded tool surface.
149
+ * @returns A runner assignable to the runtime's `DeterministicRunner`.
150
+ * @task T11802
151
+ */
152
+ export declare function createGuardedDeterministicRunner(opts: GuardedDeterministicRunnerOptions): GuardedDeterministicRunner;
153
+ //# sourceMappingURL=guarded-deterministic-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarded-deterministic-runner.d.ts","sourceRoot":"","sources":["../../src/playbooks/guarded-deterministic-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAEnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qCAAqC,EAAE,SAAS,MAAM,EAYjE,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAC5E;AAED;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,iCAAiC,GACtC,0BAA0B,CAiD5B"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Guarded deterministic-node runner — routes EVERY `deterministic` (shell/tool)
3
+ * dispatch in `executePlaybook` through the `guard.ts` deny-first chokepoint
4
+ * (T11802 · M4 cantbook done-gate).
5
+ *
6
+ * ## The gap this closes (AC1)
7
+ *
8
+ * The playbook runtime (`@cleocode/playbooks/runtime`) executes `deterministic`
9
+ * nodes through an INJECTED `DeterministicRunner`. When no runner is injected it
10
+ * degrades to `AgentDispatcher.dispatch` with a synthetic `deterministic:<cmd>`
11
+ * agent id — a path that NEVER touches the `guard.ts` shell denylist. So a
12
+ * `.cantbook` shell step could spawn a subprocess that bypasses the single
13
+ * policy point.
14
+ *
15
+ * This factory builds the CANONICAL production `DeterministicRunner`: every
16
+ * command is funnelled through the injected {@link GuardedToolSurface}'s
17
+ * `executeShell` — the SAME deny-first command policy + env-scrub chokepoint
18
+ * (`createToolGuard`) that in-process skill nodes already use (T11477). There is
19
+ * NO second subprocess code path: shell steps and skill→tool calls share ONE
20
+ * guard. The runtime stays a pure state machine (it imports no `child_process`);
21
+ * the guard owns the spawn (AC1).
22
+ *
23
+ * ## Deny semantics (AC3)
24
+ *
25
+ * The guard's `executeShell` checks the command basename against the policy
26
+ * denylist BEFORE any process is spawned. In `mode: 'enforce'` a denied command
27
+ * rejects with {@link GuardDeniedError} (`E_TOOL_GUARD_DENIED`); this runner
28
+ * catches that rejection and maps it to a contract-clean
29
+ * `{ status: 'failure', error }` envelope so the runtime's retry / escalation
30
+ * semantics stay intact (the runtime contract is non-throwing). In `mode: 'warn'`
31
+ * the guard logs-and-proceeds — the denylist is advisory — so a guarded runner
32
+ * built for enforcement MUST be constructed from an `enforce`-mode guard.
33
+ *
34
+ * ## Why a factory over a guard (DIP)
35
+ *
36
+ * The runner depends on the abstract {@link GuardedToolSurface} (the contract
37
+ * shape of `createToolGuard()`), NOT on the concrete guard — so the policy point
38
+ * is injected, exactly mirroring {@link createSkillNodeExecutor}. `core` builds
39
+ * the guard once (`createToolGuard({ allowedRoots, deniedCommands, mode })`) and
40
+ * hands the same surface to BOTH the skill executor and this deterministic
41
+ * runner.
42
+ *
43
+ * @epic T11391
44
+ * @task T11802
45
+ * @saga T11387
46
+ * @see ../tools/guard.ts — the deny-first chokepoint
47
+ * @see ./skill-node-executor.ts — the sibling in-process skill path
48
+ */
49
+ /**
50
+ * Canonical deny-list of destructive command basenames a `.cantbook`
51
+ * `deterministic` node may NOT run (T11802 · AC3). This is the SSoT the
52
+ * production dispatcher hands to `createToolGuard({ deniedCommands })` so the
53
+ * SAME chokepoint that guards in-process skill→tool calls also rejects a
54
+ * dangerous shell step. Matched against the command's last path segment by the
55
+ * guard, so `/bin/rm` and `rm` are both denied.
56
+ *
57
+ * Intentionally conservative — destructive disk / process / system operations a
58
+ * planning playbook should never invoke. Extend deliberately; every addition is
59
+ * a policy decision.
60
+ */
61
+ export const DEFAULT_DETERMINISTIC_DENIED_COMMANDS = Object.freeze([
62
+ 'rm',
63
+ 'rmdir',
64
+ 'shutdown',
65
+ 'reboot',
66
+ 'mkfs',
67
+ 'dd',
68
+ 'shred',
69
+ 'fdisk',
70
+ 'mkswap',
71
+ 'kill',
72
+ 'killall',
73
+ ]);
74
+ /**
75
+ * Build a {@link GuardedDeterministicRunner} that routes EVERY `deterministic`
76
+ * node command through the injected guard's `executeShell` (T11802 · AC1).
77
+ *
78
+ * Inject the result as `deterministicRunner` when calling `executePlaybook`:
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { createToolGuard } from '@cleocode/core/internal';
83
+ *
84
+ * const tools = createToolGuard({
85
+ * allowedRoots: [projectRoot],
86
+ * deniedCommands: ['rm', 'shutdown', 'mkfs'],
87
+ * mode: 'enforce',
88
+ * });
89
+ * await executePlaybook({
90
+ * db, playbook, playbookHash, initialContext, dispatcher,
91
+ * deterministicRunner: createGuardedDeterministicRunner({ tools }),
92
+ * });
93
+ * // A `deterministic` node running `rm` → guard rejects → { status: 'failure' }
94
+ * ```
95
+ *
96
+ * The returned runner NEVER throws — a guard `enforce`-mode rejection
97
+ * ({@link import('../tools/guard.js').GuardDeniedError}) is caught and mapped to
98
+ * a `{ status: 'failure', error }` envelope so the runtime's retry / escalation
99
+ * stays intact (the runtime's `DeterministicRunner` contract is non-throwing).
100
+ *
101
+ * @param opts - The injected guarded tool surface.
102
+ * @returns A runner assignable to the runtime's `DeterministicRunner`.
103
+ * @task T11802
104
+ */
105
+ export function createGuardedDeterministicRunner(opts) {
106
+ const { tools } = opts;
107
+ return {
108
+ async run(input) {
109
+ try {
110
+ // The guard checks the command basename against the denylist BEFORE
111
+ // spawning (deny → reject in enforce mode), then scrubs the child env at
112
+ // the chokepoint. This is the ONLY shell-spawn path for deterministic
113
+ // nodes — there is no bypass.
114
+ const result = await tools.executeShell({
115
+ command: input.command,
116
+ args: [...input.args],
117
+ ...(input.cwd !== undefined ? { cwd: input.cwd } : {}),
118
+ ...(input.env !== undefined ? { env: input.env } : {}),
119
+ ...(input.timeout_ms !== undefined ? { timeoutMs: input.timeout_ms } : {}),
120
+ });
121
+ // A non-zero exit is a node failure, not a thrown error — mirror the
122
+ // shell primitive's "exit code is the result" contract.
123
+ if (result.code === 0) {
124
+ return {
125
+ status: 'success',
126
+ output: {
127
+ [`${input.nodeId}_stdout`]: result.stdout,
128
+ [`${input.nodeId}_exitCode`]: result.code,
129
+ },
130
+ };
131
+ }
132
+ return {
133
+ status: 'failure',
134
+ output: {
135
+ [`${input.nodeId}_stdout`]: result.stdout,
136
+ [`${input.nodeId}_stderr`]: result.stderr,
137
+ [`${input.nodeId}_exitCode`]: result.code,
138
+ },
139
+ error: `deterministic node "${input.nodeId}" command "${input.command}" exited ` +
140
+ `${result.code === null ? 'on signal/timeout' : `with code ${result.code}`}`,
141
+ };
142
+ }
143
+ catch (err) {
144
+ // Guard-denied (enforce mode) or an unexpected spawn error — never let it
145
+ // escape; the runtime contract is non-throwing.
146
+ return {
147
+ status: 'failure',
148
+ output: {},
149
+ error: err instanceof Error ? err.message : String(err),
150
+ };
151
+ }
152
+ },
153
+ };
154
+ }
155
+ //# sourceMappingURL=guarded-deterministic-runner.js.map