@intentius/chant 0.46.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/dist/audit/catalog.d.ts +13 -3
  2. package/dist/audit/catalog.d.ts.map +1 -1
  3. package/dist/audit/core.d.ts +30 -3
  4. package/dist/audit/core.d.ts.map +1 -1
  5. package/dist/audit/discover.d.ts +9 -2
  6. package/dist/audit/discover.d.ts.map +1 -1
  7. package/dist/audit/fetch.d.ts.map +1 -1
  8. package/dist/audit/report-html.d.ts.map +1 -1
  9. package/dist/audit/report-model.d.ts +6 -0
  10. package/dist/audit/report-model.d.ts.map +1 -1
  11. package/dist/audit/report.d.ts.map +1 -1
  12. package/dist/audit/rules-doc.d.ts.map +1 -1
  13. package/dist/audit/secrets.d.ts +95 -0
  14. package/dist/audit/secrets.d.ts.map +1 -0
  15. package/dist/audit/wrangler.d.ts +33 -0
  16. package/dist/audit/wrangler.d.ts.map +1 -0
  17. package/dist/build.d.ts +3 -3
  18. package/dist/build.d.ts.map +1 -1
  19. package/dist/cli/commands/audit.d.ts +7 -0
  20. package/dist/cli/commands/audit.d.ts.map +1 -1
  21. package/dist/cli/commands/build.d.ts +23 -0
  22. package/dist/cli/commands/build.d.ts.map +1 -1
  23. package/dist/cli/commands/lint.d.ts.map +1 -1
  24. package/dist/cli/handlers/build.d.ts.map +1 -1
  25. package/dist/cli/handlers/components.d.ts +31 -0
  26. package/dist/cli/handlers/components.d.ts.map +1 -1
  27. package/dist/cli/handlers/lifecycle.d.ts +12 -1
  28. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  29. package/dist/cli/handlers/operator.d.ts +32 -0
  30. package/dist/cli/handlers/operator.d.ts.map +1 -0
  31. package/dist/cli/handlers/scenario.d.ts +39 -0
  32. package/dist/cli/handlers/scenario.d.ts.map +1 -0
  33. package/dist/cli/main.d.ts.map +1 -1
  34. package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
  35. package/dist/cli/mcp/server.d.ts +35 -2
  36. package/dist/cli/mcp/server.d.ts.map +1 -1
  37. package/dist/cli/mcp/tools/explain.d.ts +6 -0
  38. package/dist/cli/mcp/tools/explain.d.ts.map +1 -1
  39. package/dist/cli/mcp/types.d.ts +29 -1
  40. package/dist/cli/mcp/types.d.ts.map +1 -1
  41. package/dist/cli/plugins.d.ts +1 -1
  42. package/dist/cli/plugins.d.ts.map +1 -1
  43. package/dist/cli/registry.d.ts +14 -2
  44. package/dist/cli/registry.d.ts.map +1 -1
  45. package/dist/cli/reporters/stylish.d.ts +15 -1
  46. package/dist/cli/reporters/stylish.d.ts.map +1 -1
  47. package/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
  48. package/dist/components/auto-release.d.ts +4 -0
  49. package/dist/components/auto-release.d.ts.map +1 -1
  50. package/dist/components/capability.d.ts +17 -2
  51. package/dist/components/capability.d.ts.map +1 -1
  52. package/dist/components/cli-support.d.ts +7 -0
  53. package/dist/components/cli-support.d.ts.map +1 -1
  54. package/dist/components/component.d.ts +15 -0
  55. package/dist/components/component.d.ts.map +1 -1
  56. package/dist/components/driver.d.ts.map +1 -1
  57. package/dist/components/starter-plugin.d.ts +2 -0
  58. package/dist/components/starter-plugin.d.ts.map +1 -1
  59. package/dist/components/verbs/ensure-secret.d.ts +50 -0
  60. package/dist/components/verbs/ensure-secret.d.ts.map +1 -0
  61. package/dist/components/verbs/index.d.ts +13 -0
  62. package/dist/components/verbs/index.d.ts.map +1 -1
  63. package/dist/components/verbs/r2-sync.d.ts +76 -0
  64. package/dist/components/verbs/r2-sync.d.ts.map +1 -0
  65. package/dist/components/verbs/run-agent.d.ts +499 -0
  66. package/dist/components/verbs/run-agent.d.ts.map +1 -0
  67. package/dist/components/verbs/sign.d.ts +30 -0
  68. package/dist/components/verbs/sign.d.ts.map +1 -1
  69. package/dist/components/verbs/wrangler.d.ts +108 -0
  70. package/dist/components/verbs/wrangler.d.ts.map +1 -0
  71. package/dist/composite.d.ts +6 -1
  72. package/dist/composite.d.ts.map +1 -1
  73. package/dist/config.d.ts +26 -0
  74. package/dist/config.d.ts.map +1 -1
  75. package/dist/deep-observation.d.ts +14 -0
  76. package/dist/deep-observation.d.ts.map +1 -1
  77. package/dist/discovery/collect.d.ts.map +1 -1
  78. package/dist/discovery/fold-import.d.ts +15 -1
  79. package/dist/discovery/fold-import.d.ts.map +1 -1
  80. package/dist/discovery/fold-rank.d.ts +66 -0
  81. package/dist/discovery/fold-rank.d.ts.map +1 -0
  82. package/dist/discovery/index.d.ts +15 -0
  83. package/dist/discovery/index.d.ts.map +1 -1
  84. package/dist/discovery/param-deps.d.ts +17 -0
  85. package/dist/discovery/param-deps.d.ts.map +1 -0
  86. package/dist/effect-receipt.d.ts +177 -0
  87. package/dist/effect-receipt.d.ts.map +1 -0
  88. package/dist/fold/fold.d.ts +55 -2
  89. package/dist/fold/fold.d.ts.map +1 -1
  90. package/dist/fold/subset.d.ts +20 -0
  91. package/dist/fold/subset.d.ts.map +1 -1
  92. package/dist/index.d.ts +4 -0
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/lexicon-schema.d.ts +2 -0
  95. package/dist/lexicon-schema.d.ts.map +1 -1
  96. package/dist/lexicon.d.ts +137 -3
  97. package/dist/lexicon.d.ts.map +1 -1
  98. package/dist/lifecycle/change-set.d.ts +33 -5
  99. package/dist/lifecycle/change-set.d.ts.map +1 -1
  100. package/dist/lifecycle/converge-ledger.d.ts +90 -0
  101. package/dist/lifecycle/converge-ledger.d.ts.map +1 -0
  102. package/dist/lifecycle/deep-diff.d.ts +18 -0
  103. package/dist/lifecycle/deep-diff.d.ts.map +1 -1
  104. package/dist/lifecycle/deep-observe.d.ts +9 -1
  105. package/dist/lifecycle/deep-observe.d.ts.map +1 -1
  106. package/dist/lifecycle/gate-ledger.d.ts +33 -0
  107. package/dist/lifecycle/gate-ledger.d.ts.map +1 -0
  108. package/dist/lifecycle/git.d.ts +145 -21
  109. package/dist/lifecycle/git.d.ts.map +1 -1
  110. package/dist/lifecycle/index.d.ts +6 -0
  111. package/dist/lifecycle/index.d.ts.map +1 -1
  112. package/dist/lifecycle/lease.d.ts +113 -0
  113. package/dist/lifecycle/lease.d.ts.map +1 -0
  114. package/dist/lifecycle/observation-baseline.d.ts +21 -3
  115. package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
  116. package/dist/lifecycle/receipt-plan.d.ts +62 -0
  117. package/dist/lifecycle/receipt-plan.d.ts.map +1 -0
  118. package/dist/lifecycle/release-ledger.d.ts +20 -0
  119. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  120. package/dist/lifecycle/scenario-eval.d.ts +42 -0
  121. package/dist/lifecycle/scenario-eval.d.ts.map +1 -0
  122. package/dist/lifecycle/scenario.d.ts +163 -0
  123. package/dist/lifecycle/scenario.d.ts.map +1 -0
  124. package/dist/lifecycle/symptoms.d.ts +63 -0
  125. package/dist/lifecycle/symptoms.d.ts.map +1 -0
  126. package/dist/lifecycle/teardown.d.ts +6 -4
  127. package/dist/lifecycle/teardown.d.ts.map +1 -1
  128. package/dist/lifecycle/unobserved-gate.d.ts +67 -0
  129. package/dist/lifecycle/unobserved-gate.d.ts.map +1 -0
  130. package/dist/lint/knowledge-checks.d.ts +48 -0
  131. package/dist/lint/knowledge-checks.d.ts.map +1 -0
  132. package/dist/lint/output-checks.d.ts +5 -0
  133. package/dist/lint/output-checks.d.ts.map +1 -0
  134. package/dist/lint/output-docs.d.ts +94 -0
  135. package/dist/lint/output-docs.d.ts.map +1 -0
  136. package/dist/lint/pipeline-change-gate.d.ts +101 -0
  137. package/dist/lint/pipeline-change-gate.d.ts.map +1 -0
  138. package/dist/lint/post-synth.d.ts +41 -0
  139. package/dist/lint/post-synth.d.ts.map +1 -1
  140. package/dist/lint/receipt-checks.d.ts +9 -0
  141. package/dist/lint/receipt-checks.d.ts.map +1 -0
  142. package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts +11 -0
  143. package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts.map +1 -0
  144. package/dist/lint/rules/cor022-receipt-leaf.d.ts +13 -0
  145. package/dist/lint/rules/cor022-receipt-leaf.d.ts.map +1 -0
  146. package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts +3 -0
  147. package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts.map +1 -0
  148. package/dist/lint/rules/evl001-non-literal-expression.d.ts.map +1 -1
  149. package/dist/lint/rules/index.d.ts +3 -1
  150. package/dist/lint/rules/index.d.ts.map +1 -1
  151. package/dist/lsp/lexicon-providers.d.ts +7 -0
  152. package/dist/lsp/lexicon-providers.d.ts.map +1 -1
  153. package/dist/okf-read.d.ts +78 -0
  154. package/dist/okf-read.d.ts.map +1 -0
  155. package/dist/op/activity-contract.d.ts +139 -0
  156. package/dist/op/activity-contract.d.ts.map +1 -0
  157. package/dist/op/builders.d.ts +140 -3
  158. package/dist/op/builders.d.ts.map +1 -1
  159. package/dist/op/converge-rule.d.ts +161 -0
  160. package/dist/op/converge-rule.d.ts.map +1 -0
  161. package/dist/op/generate-pipeline.d.ts +39 -0
  162. package/dist/op/generate-pipeline.d.ts.map +1 -0
  163. package/dist/op/index.d.ts +18 -2
  164. package/dist/op/index.d.ts.map +1 -1
  165. package/dist/op/local-executor.d.ts +2 -1
  166. package/dist/op/local-executor.d.ts.map +1 -1
  167. package/dist/op/op-verb-class.d.ts +42 -0
  168. package/dist/op/op-verb-class.d.ts.map +1 -0
  169. package/dist/op/operator.d.ts +128 -0
  170. package/dist/op/operator.d.ts.map +1 -0
  171. package/dist/op/receipt-store.d.ts +138 -0
  172. package/dist/op/receipt-store.d.ts.map +1 -0
  173. package/dist/op/step-output-ref.d.ts +187 -0
  174. package/dist/op/step-output-ref.d.ts.map +1 -0
  175. package/dist/op/types.d.ts +49 -2
  176. package/dist/op/types.d.ts.map +1 -1
  177. package/dist/provenance.d.ts +73 -3
  178. package/dist/provenance.d.ts.map +1 -1
  179. package/dist/runtime-adapter.d.ts +7 -1
  180. package/dist/runtime-adapter.d.ts.map +1 -1
  181. package/dist/secret-materialization.d.ts +138 -0
  182. package/dist/secret-materialization.d.ts.map +1 -0
  183. package/dist/secret-provenance.d.ts +218 -0
  184. package/dist/secret-provenance.d.ts.map +1 -0
  185. package/dist/serializer.d.ts +29 -0
  186. package/dist/serializer.d.ts.map +1 -1
  187. package/dist/toml.d.ts +40 -5
  188. package/dist/toml.d.ts.map +1 -1
  189. package/dist/yaml.d.ts.map +1 -1
  190. package/package.json +4 -1
  191. package/src/audit/catalog.test.ts +1 -1
  192. package/src/audit/catalog.ts +75 -3
  193. package/src/audit/core.test.ts +57 -0
  194. package/src/audit/core.ts +0 -0
  195. package/src/audit/detect-bundle.test.ts +1 -1
  196. package/src/audit/discover.test.ts +24 -0
  197. package/src/audit/discover.ts +40 -4
  198. package/src/audit/fetch.test.ts +216 -3
  199. package/src/audit/fetch.ts +270 -59
  200. package/src/audit/report-html.ts +5 -2
  201. package/src/audit/report-model.ts +9 -0
  202. package/src/audit/report.test.ts +22 -0
  203. package/src/audit/report.ts +3 -2
  204. package/src/audit/rules-doc.ts +13 -1
  205. package/src/audit/secrets.test.ts +303 -0
  206. package/src/audit/secrets.ts +406 -0
  207. package/src/audit/wrangler.test.ts +230 -0
  208. package/src/audit/wrangler.ts +290 -0
  209. package/src/build.test.ts +41 -0
  210. package/src/build.ts +39 -6
  211. package/src/cli/command-group.ts +1 -1
  212. package/src/cli/commands/__fixtures__/audit-fountain/agents/fleet.yaml +27 -0
  213. package/src/cli/commands/__fixtures__/audit-fountain/k8s/deploy.yaml +16 -0
  214. package/src/cli/commands/__fixtures__/audit-fountain-clean/fleet.yaml +20 -0
  215. package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
  216. package/src/cli/commands/audit.test.ts +268 -1
  217. package/src/cli/commands/audit.ts +87 -18
  218. package/src/cli/commands/build.test.ts +245 -0
  219. package/src/cli/commands/build.ts +210 -21
  220. package/src/cli/commands/lint.ts +15 -3
  221. package/src/cli/handlers/build.ts +2 -0
  222. package/src/cli/handlers/components.test.ts +199 -1
  223. package/src/cli/handlers/components.ts +160 -3
  224. package/src/cli/handlers/explain.test.ts +70 -1
  225. package/src/cli/handlers/graph.test.ts +20 -0
  226. package/src/cli/handlers/graph.ts +12 -3
  227. package/src/cli/handlers/lifecycle.test.ts +115 -1
  228. package/src/cli/handlers/lifecycle.ts +96 -15
  229. package/src/cli/handlers/operator.test.ts +255 -0
  230. package/src/cli/handlers/operator.ts +240 -0
  231. package/src/cli/handlers/scenario.test.ts +456 -0
  232. package/src/cli/handlers/scenario.ts +330 -0
  233. package/src/cli/main.test.ts +23 -0
  234. package/src/cli/main.ts +72 -1
  235. package/src/cli/mcp/resource-handlers.ts +38 -1
  236. package/src/cli/mcp/server.test.ts +323 -3
  237. package/src/cli/mcp/server.ts +84 -7
  238. package/src/cli/mcp/tools/explain.ts +51 -2
  239. package/src/cli/mcp/types.ts +27 -1
  240. package/src/cli/plugins.ts +4 -2
  241. package/src/cli/registry.ts +14 -2
  242. package/src/cli/reporters/stylish.test.ts +154 -0
  243. package/src/cli/reporters/stylish.ts +154 -33
  244. package/src/codegen/docs-rule-scanning.test.ts +42 -0
  245. package/src/codegen/docs-rule-scanning.ts +25 -2
  246. package/src/components/README.md +7 -0
  247. package/src/components/auto-release.ts +6 -0
  248. package/src/components/capability.ts +17 -2
  249. package/src/components/cli-support.test.ts +17 -0
  250. package/src/components/cli-support.ts +13 -1
  251. package/src/components/component-schema.test.ts +32 -0
  252. package/src/components/component.schema.json +6 -0
  253. package/src/components/component.test.ts +21 -0
  254. package/src/components/component.ts +15 -0
  255. package/src/components/driver.ts +12 -4
  256. package/src/components/registry.test.ts +7 -2
  257. package/src/components/starter-plugin.ts +17 -0
  258. package/src/components/verbs/ensure-secret.test.ts +130 -0
  259. package/src/components/verbs/ensure-secret.ts +79 -0
  260. package/src/components/verbs/index.ts +13 -0
  261. package/src/components/verbs/r2-sync.test.ts +107 -0
  262. package/src/components/verbs/r2-sync.ts +124 -0
  263. package/src/components/verbs/run-agent.test.ts +683 -0
  264. package/src/components/verbs/run-agent.ts +786 -0
  265. package/src/components/verbs/sign.test.ts +19 -0
  266. package/src/components/verbs/sign.ts +34 -2
  267. package/src/components/verbs/wrangler.test.ts +170 -0
  268. package/src/components/verbs/wrangler.ts +241 -0
  269. package/src/composite.ts +31 -2
  270. package/src/config.test.ts +15 -0
  271. package/src/config.ts +30 -0
  272. package/src/deep-observation.test.ts +19 -0
  273. package/src/deep-observation.ts +17 -0
  274. package/src/discovery/collect.ts +11 -2
  275. package/src/discovery/fold-import.test.ts +54 -0
  276. package/src/discovery/fold-import.ts +178 -38
  277. package/src/discovery/fold-rank.test.ts +197 -0
  278. package/src/discovery/fold-rank.ts +346 -0
  279. package/src/discovery/index.ts +16 -1
  280. package/src/discovery/param-deps.test.ts +118 -0
  281. package/src/discovery/param-deps.ts +170 -0
  282. package/src/effect-receipt-exclusion.test.ts +190 -0
  283. package/src/effect-receipt.test.ts +419 -0
  284. package/src/effect-receipt.ts +412 -0
  285. package/src/fold/fold.test.ts +6 -2
  286. package/src/fold/fold.ts +184 -3
  287. package/src/fold/subset.test.ts +95 -6
  288. package/src/fold/subset.ts +66 -2
  289. package/src/index.ts +4 -0
  290. package/src/lexicon-schema.ts +3 -0
  291. package/src/lexicon.ts +151 -5
  292. package/src/lifecycle/change-set.ts +46 -7
  293. package/src/lifecycle/converge-ledger.test.ts +199 -0
  294. package/src/lifecycle/converge-ledger.ts +179 -0
  295. package/src/lifecycle/deep-diff.test.ts +79 -1
  296. package/src/lifecycle/deep-diff.ts +23 -0
  297. package/src/lifecycle/deep-observe.ts +13 -2
  298. package/src/lifecycle/gate-ledger.test.ts +103 -0
  299. package/src/lifecycle/gate-ledger.ts +140 -0
  300. package/src/lifecycle/git.test.ts +430 -0
  301. package/src/lifecycle/git.ts +446 -84
  302. package/src/lifecycle/index.ts +6 -0
  303. package/src/lifecycle/lease.test.ts +343 -0
  304. package/src/lifecycle/lease.ts +270 -0
  305. package/src/lifecycle/observation-baseline.test.ts +46 -0
  306. package/src/lifecycle/observation-baseline.ts +33 -1
  307. package/src/lifecycle/receipt-plan.test.ts +250 -0
  308. package/src/lifecycle/receipt-plan.ts +249 -0
  309. package/src/lifecycle/release-ledger.ts +20 -0
  310. package/src/lifecycle/scenario-eval.test.ts +199 -0
  311. package/src/lifecycle/scenario-eval.ts +158 -0
  312. package/src/lifecycle/scenario.test.ts +195 -0
  313. package/src/lifecycle/scenario.ts +321 -0
  314. package/src/lifecycle/symptoms.test.ts +116 -0
  315. package/src/lifecycle/symptoms.ts +126 -0
  316. package/src/lifecycle/teardown.test.ts +31 -0
  317. package/src/lifecycle/teardown.ts +6 -4
  318. package/src/lifecycle/unobserved-gate.test.ts +109 -0
  319. package/src/lifecycle/unobserved-gate.ts +102 -0
  320. package/src/lint/knowledge-checks.test.ts +80 -0
  321. package/src/lint/knowledge-checks.ts +74 -0
  322. package/src/lint/output-checks.test.ts +85 -0
  323. package/src/lint/output-checks.ts +99 -0
  324. package/src/lint/output-docs.test.ts +220 -0
  325. package/src/lint/output-docs.ts +204 -0
  326. package/src/lint/pipeline-change-gate.test.ts +144 -0
  327. package/src/lint/pipeline-change-gate.ts +153 -0
  328. package/src/lint/post-synth.test.ts +97 -0
  329. package/src/lint/post-synth.ts +60 -0
  330. package/src/lint/receipt-checks.test.ts +101 -0
  331. package/src/lint/receipt-checks.ts +93 -0
  332. package/src/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.ts +26 -0
  333. package/src/lint/rules/comp/comp.test.ts +49 -1
  334. package/src/lint/rules/cor022-receipt-leaf.test.ts +116 -0
  335. package/src/lint/rules/cor022-receipt-leaf.ts +130 -0
  336. package/src/lint/rules/cor024-receipt-secret-pointer.test.ts +121 -0
  337. package/src/lint/rules/cor024-receipt-secret-pointer.ts +218 -0
  338. package/src/lint/rules/evl001-non-literal-expression.test.ts +35 -3
  339. package/src/lint/rules/evl001-non-literal-expression.ts +7 -0
  340. package/src/lint/rules/index.ts +7 -1
  341. package/src/lsp/lexicon-providers.test.ts +44 -0
  342. package/src/lsp/lexicon-providers.ts +11 -1
  343. package/src/okf-read.test.ts +149 -0
  344. package/src/okf-read.ts +197 -0
  345. package/src/op/activity-contract.test.ts +180 -0
  346. package/src/op/activity-contract.ts +278 -0
  347. package/src/op/builders-exports.test.ts +17 -1
  348. package/src/op/builders.ts +198 -6
  349. package/src/op/converge-rule.test.ts +179 -0
  350. package/src/op/converge-rule.ts +311 -0
  351. package/src/op/effect-step.test.ts +311 -0
  352. package/src/op/generate-pipeline.test.ts +53 -0
  353. package/src/op/generate-pipeline.ts +99 -0
  354. package/src/op/index.ts +40 -3
  355. package/src/op/local-executor.test.ts +92 -0
  356. package/src/op/local-executor.ts +212 -29
  357. package/src/op/op-verb-class.test.ts +126 -0
  358. package/src/op/op-verb-class.ts +115 -0
  359. package/src/op/op.test.ts +25 -2
  360. package/src/op/operator.test.ts +346 -0
  361. package/src/op/operator.ts +213 -0
  362. package/src/op/receipt-store.ts +211 -0
  363. package/src/op/step-output-ref.test.ts +334 -0
  364. package/src/op/step-output-ref.ts +453 -0
  365. package/src/op/types.ts +51 -2
  366. package/src/provenance.test.ts +151 -4
  367. package/src/provenance.ts +118 -4
  368. package/src/runtime-adapter.ts +31 -10
  369. package/src/secret-materialization.test.ts +199 -0
  370. package/src/secret-materialization.ts +235 -0
  371. package/src/secret-provenance.test.ts +388 -0
  372. package/src/secret-provenance.ts +475 -0
  373. package/src/serializer.ts +30 -0
  374. package/src/toml.test.ts +157 -384
  375. package/src/toml.ts +371 -5
  376. package/src/yaml.test.ts +88 -0
  377. package/src/yaml.ts +76 -6
@@ -42,7 +42,8 @@ export declare class OpRunFailure extends Error {
42
42
  }
43
43
  /** Parse a Temporal duration string ("5m", "30s", "1h30m", "100ms") to ms. */
44
44
  export declare function parseDuration(s: string): number;
45
- /** Find the first gate step anywhere in the Op (phases + onFailure), if any. */
45
+ /** Find the first gate step anywhere in the Op (phases + onFailure, including
46
+ * gates nested inside effect steps), if any. */
46
47
  export declare function findGate(config: OpConfig): GateStep | undefined;
47
48
  /**
48
49
  * Execute an Op locally. Resolves with the run result on success; rejects with
@@ -1 +1 @@
1
- {"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAiC,QAAQ,EAAkB,MAAM,SAAS,CAAC;AACjG,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI7F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;CACb;AAID,kFAAkF;AAClF,qBAAa,yBAA0B,SAAQ,KAAK;aACtB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAO/C;AAED,mFAAmF;AACnF,qBAAa,YAAa,SAAQ,KAAK;aACT,MAAM,EAAE,WAAW;gBAAnB,MAAM,EAAE,WAAW;CAIhD;AAkBD,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAU/C;AAWD,gFAAgF;AAChF,wBAAgB,QAAQ,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,EAAE,WAAW;gBAAnB,MAAM,EAAE,WAAW;CAIhD;AAmBD,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAU/C;AA8BD;gDACgD;AAChD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAY/D;AAiSD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,WAAW,CAAC,CAgDtB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Op verb classification (#1484) — generalizes `delete: "never" | "owned-only"
3
+ * | "gated"` (`../lifecycle` teardown/apply's `DeleteMode`) up one level, to
4
+ * the whole Op: read-only, mutating, or destructive. `ConvergeOp`'s
5
+ * dial × verb-class matrix (the issue's "Autonomy" table) needs to answer
6
+ * "what kind of thing is this dispatched Op, from the outside" for an
7
+ * arbitrary declared Op — including one this project's authors wrote, not
8
+ * just the pre-built composites — so classification walks `OpConfig`'s
9
+ * steps rather than trusting a self-reported tag.
10
+ *
11
+ * There is no existing per-Op verb-class field (`searchAttributes` is a free
12
+ * `Record<string,string>` an author may or may not set — `ApplyOp` tags
13
+ * `{ Apply: "true" }` but nothing requires it, and it carries no verb-class
14
+ * semantics on its own) and no existing "which activity names are
15
+ * destructive" registry (`../lint/pipeline-change-gate.ts`'s classifier is
16
+ * shaped for a `Component` composition's capability-verb steps, not an
17
+ * `OpConfig`'s activity steps — a genuinely different graph). This module is
18
+ * that registry's Op-shaped sibling: a small, explicit set of known
19
+ * mutating/destructive activity function names, plus the one piece of
20
+ * structured signal that already exists (`nativeApply`'s `deleteMode` arg).
21
+ *
22
+ * Fail-closed by construction: an activity `fn` this module doesn't
23
+ * recognize is classified `mutating`, never `read-only` — an unknown step
24
+ * might do anything, and "unknown never remediates" (the issue's own honesty
25
+ * requirement for symptoms) applies here too: this module never silently
26
+ * clears an Op to free-run just because its steps aren't in the known-safe
27
+ * list.
28
+ */
29
+ import type { OpConfig } from "./types.js";
30
+ export type OpVerbClass = "read-only" | "mutating" | "destructive";
31
+ /**
32
+ * Classify an Op's own composition. Pure — reads only the passed config, no
33
+ * I/O. `nativeApply`'s `deleteMode` (`"never" | "owned-only" | "gated"`) is
34
+ * read straight off the step's `args` — `"owned-only"`/`"gated"` are
35
+ * destructive (both can delete a live resource), `"never"`/absent is merely
36
+ * mutating (creates/updates only). A step whose `fn` matches neither the
37
+ * read-only nor the destructive set is `mutating` by default (fail-closed).
38
+ */
39
+ export declare function classifyOpVerbClass(config: Pick<OpConfig, "phases" | "onFailure">): OpVerbClass;
40
+ /** Does this Op have its own approval gate anywhere in its phases (main or `onFailure`)? Thin re-export of `findGate` under the name this module's callers reach for. */
41
+ export declare function isGated(config: Pick<OpConfig, "phases" | "onFailure">): boolean;
42
+ //# sourceMappingURL=op-verb-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op-verb-class.d.ts","sourceRoot":"","sources":["../../src/op/op-verb-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAA4B,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAElF,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC;AA0CnE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,WAAW,CA2B/F;AAED,yKAAyK;AACzK,wBAAgB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,OAAO,CAE/E"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * `chant operator` (#1485, epic #1487) — native durable ticks without
3
+ * Temporal. A deliberately small daemon: a timer, a lease
4
+ * (../lifecycle/lease.ts), and the existing local executor
5
+ * (./local-executor.ts) in a loop. No new service, no new state store — the
6
+ * lease lives on a git ref, tick state lives on the `chant/lifecycle`
7
+ * orphan branch via the same `convergeTick` activity `chant run <op>`
8
+ * already calls for a single one-shot tick.
9
+ *
10
+ * One round: discover every `ConvergeOp` (searchAttributes `Converge:
11
+ * "true"`, optionally filtered to one env), and for each one, try to
12
+ * acquire (or renew) its lease. Win it — run one tick via `runOpLocally` on
13
+ * the Op's own Observe → Converge phases, the identical path `chant run
14
+ * <name>` takes for a single tick (issue: "chant run fountain-converge —
15
+ * one tick, by hand — unchanged, and also the test story"). Lose it — skip
16
+ * and report, never queue (issue: "a tick that finds the lease held skips
17
+ * and reports ... never queues").
18
+ *
19
+ * Crash recovery needs no special code: a killed operator simply stops
20
+ * renewing its lease, which expires on its own TTL; the next round (from
21
+ * this process restarted, a different machine's operator, or a bare `chant
22
+ * run <name>` invoked by cron) re-acquires and re-ticks. A converge tick
23
+ * re-observes and re-derives everything every time (ConvergeOp's own
24
+ * design, #1484) — re-ticking after a crash and ticking on a normal
25
+ * schedule are the same act, not two different code paths.
26
+ *
27
+ * One crash *does* need a distinct report, though (#1959 finding 2): if the
28
+ * killed operator's own `git update-ref` was interrupted mid-write, it can
29
+ * leave a stale `.lock` file behind that blocks every future acquire
30
+ * attempt for that op's lease until someone removes it — TTL expiry doesn't
31
+ * help, since the ref update itself can't land. `acquireLease` surfaces
32
+ * that case as a `StaleLockError` rather than ordinary "lease held by
33
+ * someone else" contention, and a round reports it per-op as
34
+ * `{ kind: "lease-error" }` (never aborting the whole round) so `chant
35
+ * operator`'s log names the fix instead of quietly skipping that op
36
+ * forever.
37
+ */
38
+ import type { ActivityFn, ActivityProfile } from "./activity-registry.js";
39
+ import { type DiscoveredOp } from "./discover.js";
40
+ import { type OpRunResult } from "./local-executor.js";
41
+ /** Poll interval between rounds — the operator's own cadence, distinct from a `ConvergeOp`'s Temporal `schedule` cron (that field drives the durable path's `TemporalSchedule`, not anything the local executor can read back at discovery time; see this module's doc). Chosen short enough to converge promptly, long enough not to hammer `chant lifecycle plan --live` every few seconds. */
42
+ export declare const DEFAULT_OPERATOR_INTERVAL_MS = 60000;
43
+ /** Discover every `ConvergeOp` in the project (`searchAttributes.Converge === "true"`), optionally filtered to one environment. Ops that don't declare an `Env` search attribute are excluded from an `--env`-filtered discovery (there's nothing to match), but included when no `env` filter is given. */
44
+ export declare function discoverConvergeOps(opts?: {
45
+ cwd?: string;
46
+ env?: string;
47
+ }): Promise<{
48
+ ops: DiscoveredOp[];
49
+ errors: string[];
50
+ }>;
51
+ /** One discovered ConvergeOp's outcome for one round — what `chant operator`'s one-line-per-tick log (and its tests) key off of. */
52
+ export type OperatorTickEvent = {
53
+ kind: "ticked";
54
+ op: string;
55
+ env: string;
56
+ result: OpRunResult;
57
+ } | {
58
+ kind: "skipped-lease-held";
59
+ op: string;
60
+ env: string;
61
+ heldBy?: string;
62
+ } | {
63
+ kind: "tick-failed";
64
+ op: string;
65
+ env: string;
66
+ error: string;
67
+ }
68
+ /** The lease was lost between acquiring it and the tick finishing (e.g. this process stalled past its TTL and another operator reclaimed it) — the tick's own ledger record (written inside `convergeTick`) still landed, since a converge tick is idempotent by design; this event exists purely so `chant operator`'s log and the ledger-independent test surface can see the fencing violation happened. Never a hard failure. */
69
+ | {
70
+ kind: "fenced";
71
+ op: string;
72
+ env: string;
73
+ }
74
+ /**
75
+ * `acquireLease` itself threw — a `StaleLockError` (#1959 finding 2: a
76
+ * previous `chant operator` was killed mid-write and left a `.lock` file
77
+ * behind, so this op's lease can no longer be acquired or renewed by
78
+ * anyone until the file is removed) or any other unexpected failure. A
79
+ * distinct outcome from `skipped-lease-held` on purpose — this is not
80
+ * ordinary contention with a live holder, it's wreckage that needs a
81
+ * human, and reading it as "someone else has it" would make the operator
82
+ * back off silently forever instead of surfacing the fix. One op's lease
83
+ * error never aborts the round for every other op.
84
+ */
85
+ | {
86
+ kind: "lease-error";
87
+ op: string;
88
+ env: string;
89
+ error: string;
90
+ };
91
+ export interface OperatorRoundOptions {
92
+ cwd?: string;
93
+ /** Restrict ticking to ConvergeOps for this environment. Omit to tick every discovered ConvergeOp. */
94
+ env?: string;
95
+ /** @default DEFAULT_LEASE_TTL_MS */
96
+ leaseTtlMs?: number;
97
+ /** This process's lease identity. @default currentHolderId() — a fresh identity per process, deliberately: two ticks from what could plausibly be two different processes should behave like two different holders even in a test that reuses one process, unless the caller wants to simulate "same process, later round" by passing a stable value. */
98
+ holder?: string;
99
+ /** Injected activity implementations — the CLI loads the real ones the same way `chant run` does (`loadActivities`); tests inject fakes so a round never shells out. */
100
+ activities: Map<string, ActivityFn>;
101
+ profiles: Record<string, ActivityProfile>;
102
+ now?: () => Date;
103
+ signal?: AbortSignal;
104
+ }
105
+ /**
106
+ * Run exactly one round: for every discovered ConvergeOp (filtered per
107
+ * `opts.env`), try its lease; tick the ones this holder wins. Returns one
108
+ * event per discovered op, in discovery order — deterministic, so tests can
109
+ * assert on it directly without depending on log output.
110
+ */
111
+ export declare function runOperatorRound(opts: OperatorRoundOptions): Promise<OperatorTickEvent[]>;
112
+ export interface OperatorLoopOptions extends OperatorRoundOptions {
113
+ /** @default DEFAULT_OPERATOR_INTERVAL_MS */
114
+ intervalMs?: number;
115
+ /** Called after every round completes — the CLI's one-line-per-tick log lives here, not inside the loop itself, so a test can drive rounds without capturing stdout. */
116
+ onRound?: (events: OperatorTickEvent[]) => void;
117
+ }
118
+ /**
119
+ * Run rounds forever, sleeping `intervalMs` between them, until
120
+ * `opts.signal` aborts. The daemon is a convenience, never a requirement
121
+ * (issue: "if it dies, nothing breaks and nothing is lost") — this function
122
+ * is exactly `while (!aborted) { round(); sleep(); }`, nothing durable lives
123
+ * in its own memory that a restart would need to recover.
124
+ */
125
+ export declare function runOperatorForever(opts: OperatorLoopOptions): Promise<void>;
126
+ /** Render one round's events as `chant operator`'s log line shape — one line per ticked/skipped/failed op, reusing each ticked op's own `convergeTick` log line (`OpRunResult`'s outcome attribute doesn't carry it, so this reads the tick's step record's `Remediated`... actually the human-readable summary comes from the ledger, not the run result — see `../cli/handlers/operator.ts` for where `chant operator status` reads it back). This formats what's available from the round itself: which op, which env, and whether it ticked, skipped, or failed. */
127
+ export declare function formatRoundLine(event: OperatorTickEvent): string;
128
+ //# sourceMappingURL=operator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../src/op/operator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAyD,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI3G,iYAAiY;AACjY,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAWnD,4SAA4S;AAC5S,wBAAsB,mBAAmB,CACvC,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC;IAAE,GAAG,EAAE,YAAY,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAKpD;AAED,oIAAoI;AACpI,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACx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CAAC,CAQjF;AAED,wiBAAwiB;AACxiB,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAahE"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Receipt store seam (#1834, epic #1703) — how the `effect()` step and the
3
+ * receipt-reading Ops reach a materialized receipt without knowing which
4
+ * lexicon materializes it.
5
+ *
6
+ * The store is injectable: core defines the {@link ReceiptStore} interface and
7
+ * the activity contracts; the receipt row's lexicon implements the store over
8
+ * its own resource (#1835's aws row over `AWS::SSM::Parameter`) and exports
9
+ * the bound activities (`receiptRead`, `receiptWrite`, `receiptStaleness`)
10
+ * from its `op/activities` module via {@link receiptActivities}. The activity
11
+ * registry then resolves them by name, exactly like `ensureSecret`
12
+ * (#1829/#1830, provided by the k8s lexicon). Tests bind a mock store the
13
+ * same way.
14
+ *
15
+ * Write discipline (epic #1703 decision log, item 3): the `effect()` step is
16
+ * the SOLE writer of a receipt — on success of its nested steps, last. The
17
+ * store interface carries a `write`, but only the effect step's emitted
18
+ * read-compare-run-write (and its local-executor twin) reaches it.
19
+ * `receiptStaleness` — the WatchOp phase (#1834) — is read-only by
20
+ * construction: it never touches `write` and runs nothing.
21
+ *
22
+ * Expectation resolution follows the resolution split (decision 5): a fully
23
+ * static receipt's expectation is stamped at synthesis and rides the step
24
+ * data ({@link receiptCheckInput}); a hash-flavor receipt with reference
25
+ * inputs resolves at run, through the store lexicon's
26
+ * {@link ReceiptActivityOptions.resolveExpectation} hook — never by hashing
27
+ * placeholders.
28
+ */
29
+ import { type EffectReceiptDeclaration, type EffectReceiptFlavor } from "../effect-receipt.js";
30
+ /**
31
+ * The serializable identity + declaration data of an effect receipt — what an
32
+ * `effect()` step and a `receiptStaleness` check carry through codegen. Built
33
+ * from the typed {@link EffectReceiptDeclaration} only ({@link receiptCheckInput});
34
+ * there is no string form. Reference inputs stay in placeholder form.
35
+ */
36
+ export interface EffectReceiptRef {
37
+ /** The receipt's own name (the export-level identity of the witness). */
38
+ name: string;
39
+ /** The effect this receipt witnesses. */
40
+ effect: string;
41
+ /** How the receipt is compared: mere presence, or a digest of the inputs. */
42
+ flavor: EffectReceiptFlavor;
43
+ /** The effect's inputs as recorded at synthesis (references as placeholders). */
44
+ inputs: Record<string, unknown>;
45
+ }
46
+ /**
47
+ * The injectable seam over the materialized receipt (#1835 implements it for
48
+ * SSM; tests implement it with a map). `read` returns the receipt's current
49
+ * stored value, or `undefined` when the receipt is absent. `write` stores the
50
+ * expectation as the new value — called only by the effect step, on success,
51
+ * last.
52
+ */
53
+ export interface ReceiptStore {
54
+ read(receipt: EffectReceiptRef): Promise<string | undefined>;
55
+ write(receipt: EffectReceiptRef, expectation: string): Promise<void>;
56
+ }
57
+ /** One receipt to check: its identity plus, when the receipt is fully static,
58
+ * the expectation stamped at synthesis. */
59
+ export interface ReceiptCheckInput {
60
+ receipt: EffectReceiptRef;
61
+ /** Present when the expectation was computable at synthesis; absent when
62
+ * reference inputs resolve at run (decision 5). */
63
+ expectation?: string;
64
+ }
65
+ /**
66
+ * Snapshot a typed receipt declaration into check-input data: the
67
+ * {@link EffectReceiptRef} plus the synthesis-time expectation when the
68
+ * receipt is fully static. Used by the `effect()` builder and by WatchOp's
69
+ * staleness phase — the single place "static enough to hash now" is decided.
70
+ */
71
+ export declare function receiptCheckInput(receipt: EffectReceiptDeclaration): ReceiptCheckInput;
72
+ /** Args of the `receiptRead` activity, as the effect step's codegen emits them. */
73
+ export interface ReceiptReadArgs extends ReceiptCheckInput {
74
+ }
75
+ /** Result of the `receiptRead` activity. `current` is `null` (not `undefined`)
76
+ * for an absent receipt so the value survives JSON transport. */
77
+ export interface ReceiptReadResult {
78
+ /** The receipt's live stored value, or null when absent. */
79
+ current: string | null;
80
+ /** The resolved expectation the workflow compares and later writes. */
81
+ expectation: string;
82
+ /** Convenience: `current === expectation`. */
83
+ applied: boolean;
84
+ }
85
+ /** Args of the `receiptWrite` activity — the receipt and the resolved
86
+ * expectation returned by the preceding `receiptRead`. */
87
+ export interface ReceiptWriteArgs {
88
+ receipt: EffectReceiptRef;
89
+ expectation: string;
90
+ }
91
+ /** Args of the read-only `receiptStaleness` activity (WatchOp). */
92
+ export interface ReceiptStalenessArgs {
93
+ receipts: ReceiptCheckInput[];
94
+ }
95
+ /** One stale receipt, reported as a finding — never acted on. */
96
+ export interface ReceiptStaleFinding {
97
+ /** The receipt's name. */
98
+ receipt: string;
99
+ /** The effect the receipt witnesses. */
100
+ effect: string;
101
+ /** `absent` — no receipt stored; `differs` — stored value is not the expectation. */
102
+ kind: "absent" | "differs";
103
+ /** The resolved expectation. */
104
+ expected: string;
105
+ /** The live stored value (present only for `differs`). */
106
+ current?: string;
107
+ }
108
+ /** Result of the `receiptStaleness` activity. */
109
+ export interface ReceiptStalenessResult {
110
+ stale: boolean;
111
+ findings: ReceiptStaleFinding[];
112
+ }
113
+ /** Options for {@link receiptActivities}. */
114
+ export interface ReceiptActivityOptions {
115
+ /**
116
+ * Resolve a reference-carrying receipt's expectation at run (decision 5) —
117
+ * the store lexicon's hook to deploy-time values, typically wrapping core's
118
+ * `resolveReceiptExpectation`. Without it, a check input that carries no
119
+ * synthesis-time expectation fails loudly rather than hashing placeholders.
120
+ */
121
+ resolveExpectation?: (receipt: EffectReceiptRef) => Promise<string> | string;
122
+ }
123
+ /** The three receipt activities, bound to one store. */
124
+ export interface ReceiptActivities {
125
+ receiptRead: (args: ReceiptReadArgs, signal?: AbortSignal) => Promise<ReceiptReadResult>;
126
+ receiptWrite: (args: ReceiptWriteArgs, signal?: AbortSignal) => Promise<{
127
+ written: true;
128
+ receipt: string;
129
+ }>;
130
+ receiptStaleness: (args: ReceiptStalenessArgs, signal?: AbortSignal) => Promise<ReceiptStalenessResult>;
131
+ }
132
+ /**
133
+ * Bind the receipt activities to a store. The store's lexicon calls this once
134
+ * and re-exports the result from its `op/activities` module; the activity
135
+ * registry picks the functions up by name for both executors.
136
+ */
137
+ export declare function receiptActivities(store: ReceiptStore, opts?: ReceiptActivityOptions): ReceiptActivities;
138
+ //# sourceMappingURL=receipt-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt-store.d.ts","sourceRoot":"","sources":["../../src/op/receipt-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7D,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AAED;2CAC2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B;uDACmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAgBtF;AAID,mFAAmF;AACnF,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;CAAG;AAE7D;iEACiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;0D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,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,sBAAsB,GAAG,iBAAiB,CAuCvG"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Step-output references — chant #1290 ("A step cannot reference a prior
3
+ * step's output, so values leave an Op only as search attributes").
4
+ *
5
+ * An Op's steps run in a fixed sequence chant already knows: phases in
6
+ * order, and (within a non-parallel phase) steps in order. Today the only
7
+ * way a value escapes a step is `outcomeAttribute`, which stringifies it
8
+ * into a Temporal search attribute — a UI filter, not something a later
9
+ * step can consume. `StepOutputRef` is the mechanism that lets a later
10
+ * step's `args` hold a *reference* to an earlier step's declared return
11
+ * value instead.
12
+ *
13
+ * Deliberately a reference, not an expression: `diff.out.driftedStacks` is
14
+ * a value placeholder the build resolves and the serializer compiles into a
15
+ * real local variable in the generated workflow — never `diff.out.count >
16
+ * 0` or a `.map()` over a reference. That property (an Op is data you can
17
+ * read and know what it does, not a program) is exactly what makes it safe
18
+ * to add this without Ops becoming programs; see the issue's "line not to
19
+ * cross".
20
+ *
21
+ * Scope, kept deliberately tight (see the issue's "Open questions"):
22
+ * - same-Op only — no cross-Op plumbing (that needs a durable place to put
23
+ * the value, which #1290 explicitly defers).
24
+ * - main `phases` only — a step inside `onFailure` or nested inside an
25
+ * `EffectStep` can neither produce nor consume a step-output reference.
26
+ * `onFailure` compensation runs only when something upstream already
27
+ * failed, so a main-phase step's captured result isn't reliably
28
+ * available there; an effect step's nested steps run only when the
29
+ * receipt comparison mismatches, so a value it produces isn't reliably
30
+ * available to anything outside it either. Both are conditional
31
+ * execution paths, which is exactly the class of thing #1290 keeps out
32
+ * of an Op's inert-data model.
33
+ * - producer must run to completion before the consumer starts: an earlier
34
+ * phase, or an earlier step within the same non-parallel phase. Two
35
+ * steps in the same parallel phase run concurrently (`Promise.all`) with
36
+ * no ordering guarantee, so neither may reference the other.
37
+ * - the producer needs a registered `ActivityContract` with a `returns`
38
+ * schema — without one there is nothing to validate the reference
39
+ * against, and it degrades into the same stringly path `outcomeAttribute`
40
+ * already had (chant #1288 comment on this issue).
41
+ *
42
+ * Cross-contract type compatibility (chant #1950 pre-merge review, finding
43
+ * 3): `validateStepOutputRefs` checks the producer side (a registered
44
+ * contract with a `returns` schema, and — when `path` is set — that the path
45
+ * resolves on it) and, separately, `validateActivitySteps`/TMP012 checks a
46
+ * step's `args` against its own contract's `args` schema — but a
47
+ * {@link StepOutputRef} sitting in `args` is a placeholder object at build
48
+ * time, not the value it resolves to, so TMP012 skips it (see
49
+ * `activity-contract.ts`'s `isStepOutputRefValue` guard) rather than
50
+ * false-positive on it. Nothing before this compared the *consumer's*
51
+ * declared type at that position against the *producer's* declared type at
52
+ * `path` — a string-returning path could feed a number-typed arg and both
53
+ * checks would pass. `validateStepOutputRefs` now adds one more check for
54
+ * exactly this: when `path` is set, and both the producer's and the
55
+ * consumer's contracts are registered, it compares the zod schema at the
56
+ * producer's `path` against the zod schema at the consumer's arg position by
57
+ * primitive shape (`string`/`number`/`boolean`/`object`/`array` — see
58
+ * `activity-contract.ts`'s `primitiveKindOf`) and flags a mismatch. This is
59
+ * deliberately shallow, the same "hard stop rather than guess" posture
60
+ * `pathExistsInSchema`'s doc above takes for a record/array root: a union, an
61
+ * enum, a literal, `z.any()`/`z.unknown()`, a transform, or a ref sitting
62
+ * inside an array in `args` (no stable position to look up an arg schema
63
+ * against) all bail silently — no issue raised, not a false negative
64
+ * reported as clean, just genuinely out of this check's reach. A more
65
+ * complete version (real zod-schema subtyping/union-aware comparison) is
66
+ * exactly the kind of thing #1288 Stage 2 (typed step builders, deriving
67
+ * from contracts instead of restating them) would need anyway; deferred
68
+ * there rather than grown ad hoc here. A whole-value reference (no `path`)
69
+ * is skipped by this check for the same reason it's skipped by the
70
+ * path-existence check: there's no single field to compare.
71
+ *
72
+ * References only, no expressions: the issue asks for this to be "enforced
73
+ * by a lint rule rather than left as a convention." What's here instead is
74
+ * a runtime-on-load guard — `diff.out.count > 0` or a template literal over
75
+ * a reference coerces it to a primitive, and the reference throws when that
76
+ * happens, at the moment chant loads the `.op.ts` module to build the
77
+ * entity graph (i.e. still before anything runs). A real static lint rule
78
+ * would need to parse-inspect the author's TypeScript for expression syntax
79
+ * around a reference — a genuine ESLint-rule-shaped feature, and a bigger
80
+ * one than this issue's scope. The coercion guard catches the same misuse
81
+ * (arithmetic, comparisons, template literals, `String(...)`) without it;
82
+ * a `.map()`-style structural misuse already throws on its own (`StepOutputRef`
83
+ * has no array methods).
84
+ */
85
+ import type { ActivityStep, OpConfig } from "./types.js";
86
+ import { type ActivityContract, type ActivityContractIssue } from "./activity-contract.js";
87
+ declare const STEP_OUTPUT_REF_BRAND: unique symbol;
88
+ /**
89
+ * A typed reference to a prior step's declared return value. Inert by
90
+ * construction — it carries a producer step id and an optional dot-path
91
+ * into that producer's return schema, resolved by `chant build`
92
+ * (`validateStepOutputRefs`) and compiled by the temporal serializer into a
93
+ * local variable holding the awaited activity result.
94
+ */
95
+ export interface StepOutputRef {
96
+ readonly [STEP_OUTPUT_REF_BRAND]: true;
97
+ readonly kind: "step-output-ref";
98
+ /** `ActivityStep.id` of the producing step. */
99
+ readonly step: string;
100
+ /**
101
+ * Dot-path into the producer's declared return value (e.g.
102
+ * `"driftedStacks"`, `"result.healthy"`). Omitted references the whole
103
+ * return value.
104
+ */
105
+ readonly path?: string;
106
+ }
107
+ /**
108
+ * `T` with every own property additionally accepting a {@link StepOutputRef}
109
+ * in its place (chant #1288 Stage 2) — the authoring-time counterpart of
110
+ * `args` accepting a reference anywhere in the structure (#1290): a typed
111
+ * step-builder wrapper whose opts type is `WithStepRefs<SomeActivityArgs>`
112
+ * lets an author pass `diff.out.driftedStacks` for any field without an
113
+ * `as` cast, while runtime validation of the reference itself is still
114
+ * `validateStepOutputRefs`' job, not this type's.
115
+ */
116
+ export type WithStepRefs<T> = {
117
+ [K in keyof T]: T[K] | StepOutputRef;
118
+ };
119
+ /** Structural guard for a value produced by {@link stepOutput} (or `activity()`'s `.out`). */
120
+ export declare function isStepOutputRef(value: unknown): value is StepOutputRef;
121
+ /**
122
+ * Reference a named step's output from a later step's `args`. Works with
123
+ * any step that has an `id` — an `activity()` builder result (which also
124
+ * gets the `.out` proxy sugar below) or a plain `{ kind: "activity", ...,
125
+ * id: "..." }` object literal, the shape composites author directly.
126
+ *
127
+ * `stepOutput(diff, "driftedStacks")` and `diff.out.driftedStacks` produce
128
+ * an identical reference; `stepOutput` is the explicit form for authors who
129
+ * build steps as object literals, or whose return schema has a top-level
130
+ * field literally named `step`, `path`, or `kind` (the `.out` proxy
131
+ * reserves those three property names for its own introspection).
132
+ */
133
+ export declare function stepOutput(step: string | Pick<ActivityStep, "id">, path?: string): StepOutputRef;
134
+ /**
135
+ * `.out` proxy attached to `activity()`'s result: `diff.out.driftedStacks`
136
+ * builds a {@link StepOutputRef} without the explicit `stepOutput()` call.
137
+ *
138
+ * A single property-access level, matching `outcomeAttribute.from`'s
139
+ * existing convention — the property name IS the dot-path, so a nested
140
+ * field is `diff.out["result.healthy"]`, not `diff.out.result.healthy`.
141
+ * `kind`, `step`, and `path` are reserved (the ref's own introspection
142
+ * fields); a return schema with a top-level field by one of those names
143
+ * needs `stepOutput(diff, "step")` instead.
144
+ */
145
+ export declare function makeOutProxy(stepId: string): Record<string, StepOutputRef>;
146
+ /** Every {@link StepOutputRef} found anywhere inside `value` (recursing through plain objects and arrays). */
147
+ export declare function collectStepOutputRefs(value: unknown): StepOutputRef[];
148
+ /**
149
+ * Validate every step-output reference in an Op against scope and ordering
150
+ * alone — no contract needed. This is the subset of {@link
151
+ * validateStepOutputRefs}'s checks that don't depend on a contract map, kept
152
+ * as its own export so a caller with no contracts on hand (or that wants to
153
+ * defend against exactly this class of bug regardless of what contracts are
154
+ * registered) can still refuse a scope-invalid reference. The temporal
155
+ * lexicon's serializer (`serializeOps`) is exactly this caller: TMP013 (which
156
+ * calls the fuller {@link validateStepOutputRefs}) protects `chant build`,
157
+ * but `serializeOps` is a public export a caller can invoke directly,
158
+ * bypassing that lint pass — this is its own defense-in-depth.
159
+ *
160
+ * Flags:
161
+ * - a reference authored inside `onFailure`, or inside an `EffectStep`'s
162
+ * nested steps — out of scope by design (see the module doc); flagged
163
+ * explicitly here rather than left to fall through as "unknown producer",
164
+ * - a reference to an unregistered step id (no step in scope declares it),
165
+ * - a duplicate step id (ambiguous producer),
166
+ * - a reference to a step that does not precede the referencing step
167
+ * (a later phase, a later step in the same phase, itself, or a step in
168
+ * the same parallel phase).
169
+ */
170
+ export declare function validateStepOutputRefScope(config: Pick<OpConfig, "name" | "phases" | "onFailure">): ActivityContractIssue[];
171
+ /**
172
+ * Validate every step-output reference in an Op's main phases against a
173
+ * contract map and the Op's own step ordering. Scope: `config.phases` only
174
+ * (never `onFailure`, never a step nested inside an `EffectStep` — see the
175
+ * module doc). Layers contract-based checks on top of {@link
176
+ * validateStepOutputRefScope}'s scope/ordering checks.
177
+ *
178
+ * Flags everything {@link validateStepOutputRefScope} does, plus:
179
+ * - a reference into a step whose `fn` has no registered
180
+ * {@link ActivityContract}, or whose contract declares no `returns`
181
+ * schema — nothing to validate the reference against,
182
+ * - a `path` that does not resolve on the producer's declared return
183
+ * schema (an empty `path` — the whole return value — is always valid).
184
+ */
185
+ export declare function validateStepOutputRefs(config: Pick<OpConfig, "name" | "phases" | "onFailure">, contracts: ReadonlyMap<string, ActivityContract>): ActivityContractIssue[];
186
+ export {};
187
+ //# sourceMappingURL=step-output-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-output-ref.d.ts","sourceRoot":"","sources":["../../src/op/step-output-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,SAAS,CAAC;AACvE,OAAO,EAAqD,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,qB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S,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC/C,qBAAqB,EAAE,CA4EzB"}
@@ -4,6 +4,7 @@
4
4
  * These types are intentionally free of Temporal SDK imports so they can live
5
5
  * in core without pulling in @temporalio/* as a dependency.
6
6
  */
7
+ import type { EffectReceiptRef } from "./receipt-store.js";
7
8
  export interface OpConfig {
8
9
  /** Kebab-case identifier. Used as the workflow function name (camelCase) and output directory name. */
9
10
  name: string;
@@ -30,12 +31,29 @@ export interface PhaseDefinition {
30
31
  /** Run all steps concurrently via Promise.all. Default: false. */
31
32
  parallel?: boolean;
32
33
  }
33
- export type StepDefinition = ActivityStep | GateStep;
34
+ export type StepDefinition = ActivityStep | GateStep | EffectStep;
34
35
  export interface ActivityStep {
35
36
  kind: "activity";
37
+ /**
38
+ * Identifies this step so a later step can reference its output (#1290)
39
+ * via `stepOutput(id, path?)` or, when built with `activity()`, the
40
+ * `.out` proxy sugar. Only steps in an Op's main `phases` — not
41
+ * `onFailure`, not one nested inside an `EffectStep` — can be referenced.
42
+ */
43
+ id?: string;
36
44
  /** Name of the exported activity function in the pre-built activity library. */
37
45
  fn: string;
38
- /** Arguments passed to the activity function. */
46
+ /**
47
+ * Arguments passed to the activity function. A value may be a
48
+ * {@link StepOutputRef} (anywhere in the structure, including nested
49
+ * inside a plain object or array) — a reference to an earlier step's
50
+ * declared return value, resolved at build time and compiled by the
51
+ * serializer into a local variable holding that step's result. Never an
52
+ * expression over one: `diff.out.count > 0` or a template literal
53
+ * coerces the reference to a primitive, which throws (see
54
+ * `step-output-ref.ts`'s module doc for why this is a runtime-on-load
55
+ * guard, not a static lint rule).
56
+ */
39
57
  args?: Record<string, unknown>;
40
58
  /**
41
59
  * Key from TEMPORAL_ACTIVITY_PROFILES controlling timeout + retry.
@@ -59,6 +77,35 @@ export interface ActivityStep {
59
77
  from?: string;
60
78
  };
61
79
  }
80
+ /**
81
+ * Read-compare-run-write over an effect receipt (#1834, epic #1703). The
82
+ * runtime reads the live receipt through the receipt store, compares it
83
+ * against the resolved expectation, skips the nested steps on a match, and
84
+ * otherwise runs them — writing the receipt only when every nested step
85
+ * succeeded, last. A nested-step failure leaves the receipt untouched
86
+ * (stale), so the next run re-proposes the effect.
87
+ *
88
+ * Authored via the `effect()` builder, which takes the typed EffectReceipt
89
+ * declaration only — there is no string form.
90
+ */
91
+ export interface EffectStep {
92
+ kind: "effect";
93
+ /** Receipt identity + declaration data (references in placeholder form). */
94
+ receipt: EffectReceiptRef;
95
+ /**
96
+ * The expectation stamped at synthesis when the receipt is fully static;
97
+ * absent when reference inputs resolve at run (#1703 decision 5).
98
+ */
99
+ expectation?: string;
100
+ /**
101
+ * Steps run when the live receipt does not match, in authored order. A gate
102
+ * authored here pauses only when the effect will fire. Effect steps do not
103
+ * nest.
104
+ */
105
+ steps: Array<ActivityStep | GateStep>;
106
+ /** Annotation carried into the generated workflow as a comment. */
107
+ description?: string;
108
+ }
62
109
  export interface GateStep {
63
110
  kind: "gate";
64
111
  /** Signal name. The generated workflow waits for this signal before continuing. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/op/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,QAAQ;IACvB,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,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