@intentius/chant 0.49.0 → 0.51.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 (294) 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 +9 -0
  4. package/dist/audit/core.d.ts.map +1 -1
  5. package/dist/audit/discover.d.ts +6 -0
  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.map +1 -1
  18. package/dist/cli/commands/audit.d.ts +7 -0
  19. package/dist/cli/commands/audit.d.ts.map +1 -1
  20. package/dist/cli/commands/build.d.ts +23 -0
  21. package/dist/cli/commands/build.d.ts.map +1 -1
  22. package/dist/cli/handlers/build.d.ts.map +1 -1
  23. package/dist/cli/handlers/components.d.ts +31 -0
  24. package/dist/cli/handlers/components.d.ts.map +1 -1
  25. package/dist/cli/handlers/lifecycle.d.ts +11 -0
  26. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  27. package/dist/cli/handlers/op-progress.d.ts +57 -0
  28. package/dist/cli/handlers/op-progress.d.ts.map +1 -0
  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/run-client.d.ts +21 -1
  32. package/dist/cli/handlers/run-client.d.ts.map +1 -1
  33. package/dist/cli/handlers/run-report.d.ts.map +1 -1
  34. package/dist/cli/handlers/run.d.ts.map +1 -1
  35. package/dist/cli/handlers/scenario.d.ts +39 -0
  36. package/dist/cli/handlers/scenario.d.ts.map +1 -0
  37. package/dist/cli/handlers/search.d.ts +22 -0
  38. package/dist/cli/handlers/search.d.ts.map +1 -1
  39. package/dist/cli/main.d.ts.map +1 -1
  40. package/dist/cli/mcp/op-tools.d.ts.map +1 -1
  41. package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
  42. package/dist/cli/mcp/server.d.ts +35 -2
  43. package/dist/cli/mcp/server.d.ts.map +1 -1
  44. package/dist/cli/mcp/types.d.ts +29 -1
  45. package/dist/cli/mcp/types.d.ts.map +1 -1
  46. package/dist/cli/registry.d.ts +47 -3
  47. package/dist/cli/registry.d.ts.map +1 -1
  48. package/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
  49. package/dist/components/capability.d.ts +17 -2
  50. package/dist/components/capability.d.ts.map +1 -1
  51. package/dist/components/cli-support.d.ts +7 -0
  52. package/dist/components/cli-support.d.ts.map +1 -1
  53. package/dist/components/component.d.ts +15 -0
  54. package/dist/components/component.d.ts.map +1 -1
  55. package/dist/components/driver.d.ts.map +1 -1
  56. package/dist/components/run-progress.d.ts +7 -5
  57. package/dist/components/run-progress.d.ts.map +1 -1
  58. package/dist/components/verbs/index.d.ts +6 -1
  59. package/dist/components/verbs/index.d.ts.map +1 -1
  60. package/dist/components/verbs/run-agent.d.ts +499 -0
  61. package/dist/components/verbs/run-agent.d.ts.map +1 -0
  62. package/dist/components/verbs/sign.d.ts +30 -0
  63. package/dist/components/verbs/sign.d.ts.map +1 -1
  64. package/dist/composite.d.ts +6 -1
  65. package/dist/composite.d.ts.map +1 -1
  66. package/dist/discovery/collect.d.ts.map +1 -1
  67. package/dist/discovery/fold-import.d.ts +15 -1
  68. package/dist/discovery/fold-import.d.ts.map +1 -1
  69. package/dist/discovery/fold-rank.d.ts +66 -0
  70. package/dist/discovery/fold-rank.d.ts.map +1 -0
  71. package/dist/discovery/index.d.ts +15 -0
  72. package/dist/discovery/index.d.ts.map +1 -1
  73. package/dist/discovery/param-deps.d.ts +17 -0
  74. package/dist/discovery/param-deps.d.ts.map +1 -0
  75. package/dist/fold/fold.d.ts +55 -2
  76. package/dist/fold/fold.d.ts.map +1 -1
  77. package/dist/fold/subset.d.ts +21 -14
  78. package/dist/fold/subset.d.ts.map +1 -1
  79. package/dist/lexicon-schema.d.ts +2 -0
  80. package/dist/lexicon-schema.d.ts.map +1 -1
  81. package/dist/lexicon.d.ts +134 -0
  82. package/dist/lexicon.d.ts.map +1 -1
  83. package/dist/lifecycle/assert-live.d.ts +77 -0
  84. package/dist/lifecycle/assert-live.d.ts.map +1 -0
  85. package/dist/lifecycle/change-set.d.ts +17 -0
  86. package/dist/lifecycle/change-set.d.ts.map +1 -1
  87. package/dist/lifecycle/converge-ledger.d.ts +90 -0
  88. package/dist/lifecycle/converge-ledger.d.ts.map +1 -0
  89. package/dist/lifecycle/deep-diff.d.ts +18 -0
  90. package/dist/lifecycle/deep-diff.d.ts.map +1 -1
  91. package/dist/lifecycle/deep-observe.d.ts +9 -1
  92. package/dist/lifecycle/deep-observe.d.ts.map +1 -1
  93. package/dist/lifecycle/disruption.d.ts +96 -0
  94. package/dist/lifecycle/disruption.d.ts.map +1 -0
  95. package/dist/lifecycle/gate-ledger.d.ts +33 -0
  96. package/dist/lifecycle/gate-ledger.d.ts.map +1 -0
  97. package/dist/lifecycle/git.d.ts +145 -21
  98. package/dist/lifecycle/git.d.ts.map +1 -1
  99. package/dist/lifecycle/index.d.ts +6 -0
  100. package/dist/lifecycle/index.d.ts.map +1 -1
  101. package/dist/lifecycle/lease.d.ts +113 -0
  102. package/dist/lifecycle/lease.d.ts.map +1 -0
  103. package/dist/lifecycle/replay.d.ts +2 -0
  104. package/dist/lifecycle/replay.d.ts.map +1 -1
  105. package/dist/lifecycle/scenario-eval.d.ts +42 -0
  106. package/dist/lifecycle/scenario-eval.d.ts.map +1 -0
  107. package/dist/lifecycle/scenario.d.ts +163 -0
  108. package/dist/lifecycle/scenario.d.ts.map +1 -0
  109. package/dist/lifecycle/symptoms.d.ts +63 -0
  110. package/dist/lifecycle/symptoms.d.ts.map +1 -0
  111. package/dist/lint/output-docs.d.ts +94 -0
  112. package/dist/lint/output-docs.d.ts.map +1 -0
  113. package/dist/lint/post-synth.d.ts +29 -0
  114. package/dist/lint/post-synth.d.ts.map +1 -1
  115. package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts +11 -0
  116. package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts.map +1 -0
  117. package/dist/lsp/lexicon-providers.d.ts +7 -0
  118. package/dist/lsp/lexicon-providers.d.ts.map +1 -1
  119. package/dist/op/activity-contract.d.ts +139 -0
  120. package/dist/op/activity-contract.d.ts.map +1 -0
  121. package/dist/op/builders.d.ts +42 -2
  122. package/dist/op/builders.d.ts.map +1 -1
  123. package/dist/op/converge-rule.d.ts +161 -0
  124. package/dist/op/converge-rule.d.ts.map +1 -0
  125. package/dist/op/generate-pipeline.d.ts +39 -0
  126. package/dist/op/generate-pipeline.d.ts.map +1 -0
  127. package/dist/op/index.d.ts +14 -0
  128. package/dist/op/index.d.ts.map +1 -1
  129. package/dist/op/local-executor.d.ts +7 -1
  130. package/dist/op/local-executor.d.ts.map +1 -1
  131. package/dist/op/op-verb-class.d.ts +42 -0
  132. package/dist/op/op-verb-class.d.ts.map +1 -0
  133. package/dist/op/operator.d.ts +128 -0
  134. package/dist/op/operator.d.ts.map +1 -0
  135. package/dist/op/step-output-ref.d.ts +187 -0
  136. package/dist/op/step-output-ref.d.ts.map +1 -0
  137. package/dist/op/types.d.ts +18 -1
  138. package/dist/op/types.d.ts.map +1 -1
  139. package/dist/provenance.d.ts +73 -3
  140. package/dist/provenance.d.ts.map +1 -1
  141. package/dist/runtime-adapter.d.ts +7 -1
  142. package/dist/runtime-adapter.d.ts.map +1 -1
  143. package/dist/serializer.d.ts +18 -0
  144. package/dist/serializer.d.ts.map +1 -1
  145. package/dist/testing.d.ts +23 -2
  146. package/dist/testing.d.ts.map +1 -1
  147. package/dist/toml.d.ts +40 -5
  148. package/dist/toml.d.ts.map +1 -1
  149. package/package.json +1 -1
  150. package/src/audit/catalog.test.ts +1 -1
  151. package/src/audit/catalog.ts +75 -3
  152. package/src/audit/core.ts +9 -0
  153. package/src/audit/discover.ts +29 -2
  154. package/src/audit/fetch.test.ts +216 -3
  155. package/src/audit/fetch.ts +270 -59
  156. package/src/audit/report-html.ts +5 -2
  157. package/src/audit/report-model.ts +9 -0
  158. package/src/audit/report.test.ts +22 -0
  159. package/src/audit/report.ts +3 -2
  160. package/src/audit/rules-doc.ts +2 -0
  161. package/src/audit/secrets.test.ts +303 -0
  162. package/src/audit/secrets.ts +406 -0
  163. package/src/audit/wrangler.test.ts +230 -0
  164. package/src/audit/wrangler.ts +290 -0
  165. package/src/build.ts +8 -3
  166. package/src/cli/command-group.ts +1 -1
  167. package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
  168. package/src/cli/commands/audit.test.ts +215 -1
  169. package/src/cli/commands/audit.ts +86 -17
  170. package/src/cli/commands/build.test.ts +167 -2
  171. package/src/cli/commands/build.ts +114 -23
  172. package/src/cli/handlers/build.ts +2 -0
  173. package/src/cli/handlers/components.test.ts +199 -1
  174. package/src/cli/handlers/components.ts +160 -3
  175. package/src/cli/handlers/graph.test.ts +20 -0
  176. package/src/cli/handlers/graph.ts +10 -1
  177. package/src/cli/handlers/lifecycle.test.ts +90 -0
  178. package/src/cli/handlers/lifecycle.ts +30 -5
  179. package/src/cli/handlers/op-progress.test.ts +202 -0
  180. package/src/cli/handlers/op-progress.ts +192 -0
  181. package/src/cli/handlers/operator.test.ts +255 -0
  182. package/src/cli/handlers/operator.ts +240 -0
  183. package/src/cli/handlers/run-client.test.ts +82 -0
  184. package/src/cli/handlers/run-client.ts +85 -2
  185. package/src/cli/handlers/run-report.test.ts +62 -0
  186. package/src/cli/handlers/run-report.ts +20 -58
  187. package/src/cli/handlers/run.test.ts +144 -0
  188. package/src/cli/handlers/run.ts +40 -18
  189. package/src/cli/handlers/scenario.test.ts +456 -0
  190. package/src/cli/handlers/scenario.ts +330 -0
  191. package/src/cli/handlers/search-drift.test.ts +263 -0
  192. package/src/cli/handlers/search.ts +150 -1
  193. package/src/cli/main.test.ts +23 -0
  194. package/src/cli/main.ts +81 -1
  195. package/src/cli/mcp/op-tools.ts +17 -6
  196. package/src/cli/mcp/resource-handlers.ts +13 -5
  197. package/src/cli/mcp/server.test.ts +265 -2
  198. package/src/cli/mcp/server.ts +84 -7
  199. package/src/cli/mcp/types.ts +27 -1
  200. package/src/cli/registry.ts +47 -3
  201. package/src/codegen/docs-rule-scanning.test.ts +42 -0
  202. package/src/codegen/docs-rule-scanning.ts +25 -2
  203. package/src/components/README.md +7 -0
  204. package/src/components/capability.ts +17 -2
  205. package/src/components/cli-support.test.ts +17 -0
  206. package/src/components/cli-support.ts +13 -1
  207. package/src/components/component-schema.test.ts +32 -0
  208. package/src/components/component.schema.json +6 -0
  209. package/src/components/component.test.ts +21 -0
  210. package/src/components/component.ts +15 -0
  211. package/src/components/driver.ts +12 -4
  212. package/src/components/run-progress.ts +9 -5
  213. package/src/components/verbs/index.ts +6 -1
  214. package/src/components/verbs/run-agent.test.ts +683 -0
  215. package/src/components/verbs/run-agent.ts +786 -0
  216. package/src/components/verbs/sign.test.ts +19 -0
  217. package/src/components/verbs/sign.ts +34 -2
  218. package/src/composite.ts +31 -2
  219. package/src/discovery/collect.ts +11 -2
  220. package/src/discovery/fold-import.test.ts +54 -0
  221. package/src/discovery/fold-import.ts +178 -38
  222. package/src/discovery/fold-rank.test.ts +197 -0
  223. package/src/discovery/fold-rank.ts +346 -0
  224. package/src/discovery/index.ts +16 -1
  225. package/src/discovery/param-deps.test.ts +118 -0
  226. package/src/discovery/param-deps.ts +170 -0
  227. package/src/fold/fold.test.ts +6 -2
  228. package/src/fold/fold.ts +184 -3
  229. package/src/fold/subset.test.ts +82 -19
  230. package/src/fold/subset.ts +79 -41
  231. package/src/lexicon-schema.ts +3 -0
  232. package/src/lexicon.ts +154 -2
  233. package/src/lifecycle/assert-live.test.ts +125 -0
  234. package/src/lifecycle/assert-live.ts +154 -0
  235. package/src/lifecycle/change-set.ts +35 -3
  236. package/src/lifecycle/converge-ledger.test.ts +199 -0
  237. package/src/lifecycle/converge-ledger.ts +179 -0
  238. package/src/lifecycle/deep-diff.test.ts +79 -1
  239. package/src/lifecycle/deep-diff.ts +23 -0
  240. package/src/lifecycle/deep-observe.ts +13 -2
  241. package/src/lifecycle/disruption.test.ts +186 -0
  242. package/src/lifecycle/disruption.ts +224 -0
  243. package/src/lifecycle/gate-ledger.test.ts +103 -0
  244. package/src/lifecycle/gate-ledger.ts +140 -0
  245. package/src/lifecycle/git.test.ts +430 -0
  246. package/src/lifecycle/git.ts +446 -84
  247. package/src/lifecycle/index.ts +6 -0
  248. package/src/lifecycle/lease.test.ts +343 -0
  249. package/src/lifecycle/lease.ts +270 -0
  250. package/src/lifecycle/replay.test.ts +25 -0
  251. package/src/lifecycle/replay.ts +11 -3
  252. package/src/lifecycle/scenario-eval.test.ts +199 -0
  253. package/src/lifecycle/scenario-eval.ts +158 -0
  254. package/src/lifecycle/scenario.test.ts +195 -0
  255. package/src/lifecycle/scenario.ts +321 -0
  256. package/src/lifecycle/symptoms.test.ts +116 -0
  257. package/src/lifecycle/symptoms.ts +126 -0
  258. package/src/lint/output-docs.test.ts +220 -0
  259. package/src/lint/output-docs.ts +204 -0
  260. package/src/lint/post-synth.test.ts +97 -0
  261. package/src/lint/post-synth.ts +45 -0
  262. package/src/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.ts +26 -0
  263. package/src/lint/rules/comp/comp.test.ts +49 -1
  264. package/src/lint/rules/evl001-non-literal-expression.test.ts +8 -3
  265. package/src/lint/rules/evl001-non-literal-expression.ts +6 -6
  266. package/src/lsp/lexicon-providers.test.ts +44 -0
  267. package/src/lsp/lexicon-providers.ts +11 -1
  268. package/src/op/activity-contract.test.ts +180 -0
  269. package/src/op/activity-contract.ts +278 -0
  270. package/src/op/builders-exports.test.ts +17 -1
  271. package/src/op/builders.ts +59 -5
  272. package/src/op/converge-rule.test.ts +179 -0
  273. package/src/op/converge-rule.ts +311 -0
  274. package/src/op/generate-pipeline.test.ts +53 -0
  275. package/src/op/generate-pipeline.ts +99 -0
  276. package/src/op/index.ts +30 -0
  277. package/src/op/local-executor.test.ts +92 -0
  278. package/src/op/local-executor.ts +52 -10
  279. package/src/op/local-output.ts +1 -1
  280. package/src/op/op-verb-class.test.ts +126 -0
  281. package/src/op/op-verb-class.ts +115 -0
  282. package/src/op/operator.test.ts +346 -0
  283. package/src/op/operator.ts +213 -0
  284. package/src/op/step-output-ref.test.ts +334 -0
  285. package/src/op/step-output-ref.ts +453 -0
  286. package/src/op/types.ts +18 -1
  287. package/src/provenance.test.ts +151 -4
  288. package/src/provenance.ts +118 -4
  289. package/src/runtime-adapter.ts +31 -10
  290. package/src/serializer.ts +18 -0
  291. package/src/testing.test.ts +89 -2
  292. package/src/testing.ts +63 -3
  293. package/src/toml.test.ts +157 -384
  294. package/src/toml.ts +371 -5
@@ -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,CA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AG,CAAC,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yVAAyV;IACzV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wKAAwK;IACxK,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAkD/F;AAkBD,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wKAAwK;IACxK,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjF;AAED,wiBAAwiB;AACxiB,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAahE"}
@@ -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,qBAAqB,CAAC;AAE3I,QAAA,MAAM,qBAAqB,eAAuC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa;CAAE,CAAC;AAEvE,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAqBD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAQhG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAU1E;AAED,8GAA8G;AAC9G,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,EAAE,CAKrE;AAmED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC,GACtD,qBAAqB,EAAE,CAqEzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC,EACvD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC/C,qBAAqB,EAAE,CA4EzB"}
@@ -34,9 +34,26 @@ export interface PhaseDefinition {
34
34
  export type StepDefinition = ActivityStep | GateStep | EffectStep;
35
35
  export interface ActivityStep {
36
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;
37
44
  /** Name of the exported activity function in the pre-built activity library. */
38
45
  fn: string;
39
- /** 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
+ */
40
57
  args?: Record<string, unknown>;
41
58
  /**
42
59
  * Key from TEMPORAL_ACTIVITY_PROFILES controlling timeout + retry.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/op/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,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,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,IAAI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AC,YAAY,GAAG,QAAQ,CAAC,CAAC;IACtC,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -5,9 +5,11 @@
5
5
  * entity object, so it never serializes into the emitted YAML/JSON — it is build
6
6
  * metadata, not declared configuration. Read it back with {@link getProvenance}.
7
7
  *
8
- * This is entity-level provenance (which file declared it, and which composite
9
- * expanded it), not a YAML-line source map. It answers "where did this resource
10
- * come from?", which is the question an agent asks before changing it.
8
+ * Entity-level provenance (which file declared it, and which composite expanded
9
+ * it) answers "where did this resource come from?", which is the question an
10
+ * agent asks before changing it. {@link PathOrigin} (chant #1443) answers the
11
+ * follow-up — "what set THIS field" — for the paths a build can attribute
12
+ * without guessing. Neither is a YAML-line source map.
11
13
  *
12
14
  * {@link BuildParamProvenance} (chant #1064) is the other half: not "where did
13
15
  * this ENTITY come from" but "what INPUTS was this whole BUILD invoked with" —
@@ -27,7 +29,55 @@ export interface EntityProvenance {
27
29
  * collapse a composite to a single node at coarse diagram detail levels (#494).
28
30
  */
29
31
  compositeInstance?: string;
32
+ /**
33
+ * Per-path origins within the entity's `props` (chant #1443). Read with
34
+ * {@link originOfPath}, which does the prefix resolution these keys are
35
+ * written for.
36
+ *
37
+ * Keys are dotted property paths only — `spec.template.spec.containers` —
38
+ * with `""` for the whole entity. They never carry an array segment, because
39
+ * a producing mechanism attributes a whole array at once: the coarsest path
40
+ * it actually determines is the honest one to record, and a positional key
41
+ * would go stale the moment an element moved.
42
+ *
43
+ * Query paths come from #1441's diff addressing and may carry `[#key]` for an
44
+ * element of an associative list or `[n]` for a positional one. Resolution is
45
+ * longest segment-boundary prefix, so `spec.containers[#app].image` finds a
46
+ * key recorded at `spec.containers`, and a key recorded at
47
+ * `spec.containers.image` never matches it. The two grammars agree without
48
+ * the recorder needing the lexicon's ordering hook, which it has no access to.
49
+ *
50
+ * Absent means this build could not record path origins, not that nothing
51
+ * governs the entity's fields — the run path executes modules and has no
52
+ * expression to inspect, and a sandboxed child's provenance does not survive
53
+ * the wire (`discovery/entity-wire-codec.ts` drops build metadata).
54
+ */
55
+ paths?: Record<string, PathOrigin>;
30
56
  }
57
+ /**
58
+ * What produced one path inside an entity's props.
59
+ *
60
+ * - `authored` — written in the source file that declared the entity.
61
+ * - `composite` — the entity was expanded by a composite, or the path was
62
+ * supplied by `propagate()`'s shared props at the instance.
63
+ * - `build-param` — the build parameters the authored expression for this path
64
+ * *reads*, which is a syntactic dependency, not a value taint. For
65
+ * `replicas: params.tier === "prod" ? 5 : 1` a taint says the value came from
66
+ * the literal `5`, which is true and useless; the dependency says the field
67
+ * is governed by `tier`, which is what an editor needs to know. Under-reports
68
+ * (a shape the collector does not follow drops a dependency) and never
69
+ * over-reports a parameter the expression does not mention.
70
+ */
71
+ export type PathOrigin = {
72
+ kind: "authored";
73
+ } | {
74
+ kind: "composite";
75
+ composite: string;
76
+ instance: string;
77
+ } | {
78
+ kind: "build-param";
79
+ params: string[];
80
+ };
31
81
  /**
32
82
  * Merge provenance onto an entity. Non-enumerable so it is invisible to
33
83
  * serializers and spreads. Existing fields win (`??=`), so the first/most
@@ -36,6 +86,26 @@ export interface EntityProvenance {
36
86
  export declare function setProvenance(entity: object, prov: EntityProvenance): void;
37
87
  /** Read an entity's build provenance, if any was stamped. */
38
88
  export declare function getProvenance(entity: object): EntityProvenance | undefined;
89
+ /**
90
+ * Record one path's origin, first writer wins — the same rule
91
+ * {@link setProvenance} applies to entity-level fields, and for the same
92
+ * reason: expansion runs innermost-composite-first, so the earliest writer is
93
+ * the most specific one.
94
+ */
95
+ export declare function setPathProvenance(entity: object, path: string, origin: PathOrigin): void;
96
+ /**
97
+ * An entity's recorded path origins in sorted key order, or `undefined` when
98
+ * none were recorded. Sorted because a build's outputs are compared byte for
99
+ * byte and object key order is not something insertion should decide.
100
+ */
101
+ export declare function getPathProvenance(entity: object): Record<string, PathOrigin> | undefined;
102
+ /**
103
+ * The origin governing `path` — the longest recorded key that addresses it or
104
+ * one of its ancestors. See {@link PROVENANCE_PATH_GRAMMAR}.
105
+ */
106
+ export declare function originOfPath(paths: Readonly<Record<string, PathOrigin>> | undefined, path: string): PathOrigin | undefined;
107
+ /** One-line rendering of an origin, for diff output. */
108
+ export declare function describePathOrigin(origin: PathOrigin): string;
39
109
  /**
40
110
  * One resolved build-time parameter (chant #1064, see ../build-params.ts): its
41
111
  * final value and which source won it, so a build's parameter inputs are
@@ -1 +1 @@
1
- {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAe1E;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE1E;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,sCAAsC;IACtC,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC;CACnD"}
1
+ {"version":3,"file":"provenance.d.ts","sourceRoot":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M,GACX,UAAU,GAAG,SAAS,CAQxB;AAED,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAS7D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,sCAAsC;IACtC,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC;CACnD"}
@@ -19,9 +19,15 @@ export interface RuntimeAdapter {
19
19
  readonly hashAlgorithm: string;
20
20
  /** Test whether filePath matches a glob pattern */
21
21
  globMatch(pattern: string, filePath: string): boolean;
22
- /** Spawn a child process and collect output */
22
+ /**
23
+ * Spawn a child process and collect output. When `opts.stdin` is set, it is
24
+ * written to the child's stdin and the stream is closed — the caller never
25
+ * needs to round-trip content through a shell (`sh -c "echo … | cmd"`) just
26
+ * to feed a command that reads from stdin (e.g. `git hash-object --stdin`).
27
+ */
23
28
  spawn(cmd: string[], opts?: {
24
29
  cwd?: string;
30
+ stdin?: string;
25
31
  }): Promise<SpawnResult>;
26
32
  /** Commands to use when spawning package manager / executor */
27
33
  readonly commands: RuntimeCommands;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-adapter.d.ts","sourceRoot":"","sources":["../src/runtime-adapter.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IA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ACnD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpF,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAuDD;;GAEG;AACH,wBAAgB,WAAW,IAAI,cAAc,CAG5C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAK3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -38,6 +38,24 @@ export interface SerializerResult {
38
38
  primary: string;
39
39
  /** Additional files keyed by filename (e.g. "network.template.json" → content) */
40
40
  files?: Record<string, string>;
41
+ /**
42
+ * Basenames from `files` that must reach disk byte-for-byte — never
43
+ * `JSON.parse`d, key-sorted, or reformatted to YAML by the build's
44
+ * additional-file writer (chant#1937).
45
+ *
46
+ * A separate field rather than a per-file flag on `files` (e.g. widening
47
+ * its value to `string | { content: string; verbatim: boolean }`) so every
48
+ * existing lexicon serializer that returns `files: Record<string, string>`
49
+ * keeps compiling and behaving unchanged: this list defaults to empty, and
50
+ * only a serializer that actually carries opaque/pre-formatted bytes
51
+ * (committed ciphertext, a vendored file) needs to populate it.
52
+ *
53
+ * Before this field existed, "JSON.parse fails on this content" was the
54
+ * only way to opt out of round-tripping — true for YAML that happens not to
55
+ * parse as JSON, but never a structural guarantee (YAML is a JSON
56
+ * superset).
57
+ */
58
+ verbatimFiles?: string[];
41
59
  /**
42
60
  * Non-fatal diagnostics produced during serialization (e.g. a dialect
43
61
  * dropping keys the target platform ignores). The build pipeline collects
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtC;;;;;OAKG;IACH,SAAS,CACP,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACjC,OAAO,CAAC,EAAE,aAAa,EAAE,EACzB,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,gBAAgB,CAAC;IAE7B;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;CACpD"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],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ts CHANGED
@@ -15,6 +15,12 @@
15
15
  * in-process for exactly this suite's environment. Stateless by design:
16
16
  * a crashed suite's environment is recovered by calling destroy again (or
17
17
  * `chant lifecycle teardown <env> --yes`).
18
+ * - **assertLive** (#1857) — `describeResources()` against exactly one
19
+ * declared entity, turned into a pass or a thrown failure. Preserves
20
+ * #1089's tri-state rather than collapsing it: NOT-OBSERVED throws {@link
21
+ * UnobservedAssertionError}, never a silent pass and never an ordinary
22
+ * failure, because chant could not read the entity is not the same claim
23
+ * as chant read it and it is gone.
18
24
  *
19
25
  * ## Isolation
20
26
  *
@@ -39,12 +45,14 @@
39
45
  * exported, and a CI job pointing the identical suite at a real account just
40
46
  * leaves both unset.
41
47
  */
42
- import type { Declarable } from "./declarable.js";
48
+ import { type Declarable } from "./declarable.js";
43
49
  import type { SerializerResult } from "./serializer.js";
44
50
  import { type BuildParamValue } from "./build-params.js";
45
- import type { LexiconPlugin } from "./lexicon.js";
51
+ import type { LexiconPlugin, ResourceMetadata } from "./lexicon.js";
46
52
  import { type ActivityFn, type ActivityProfile } from "./op/activity-registry.js";
47
53
  import { type TeardownReport } from "./lifecycle/teardown.js";
54
+ import { LiveAssertionError, UnobservedAssertionError, type AssertLiveOptions } from "./lifecycle/assert-live.js";
55
+ export { LiveAssertionError, UnobservedAssertionError, type AssertLiveOptions };
48
56
  export interface DeployStackOptions {
49
57
  /** The chant project directory (where the infra source lives). */
50
58
  dir: string;
@@ -86,6 +94,19 @@ export interface DeployedStack {
86
94
  entities: Map<string, Declarable>;
87
95
  /** The environment this deploy targeted — the teardown key. */
88
96
  env: string;
97
+ /**
98
+ * Assert that a declared entity is live: observed present in this
99
+ * deploy's environment, not confirmed as another stack/env's resource,
100
+ * and — when `status` is given — reporting that status.
101
+ *
102
+ * Rides the observation contract (#1089): an entity `describeResources`
103
+ * could not cover throws {@link UnobservedAssertionError}, never a pass
104
+ * and never a plain failure — NOT-OBSERVED is not the same claim as
105
+ * absent. Observed-absent, a confirmed-foreign identity, or a status
106
+ * mismatch throws {@link LiveAssertionError}. Resolves to the entity's
107
+ * `ResourceMetadata` on success.
108
+ */
109
+ assertLive(name: string, options?: AssertLiveOptions): Promise<ResourceMetadata>;
89
110
  /**
90
111
  * Tear down everything carrying this suite's marker `{ stack, env }`.
91
112
  * Throws {@link TeardownIncompleteError} when any candidate failed to
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMrD,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAgC,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE7G,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgB5E,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC3C;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,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