@intentius/chant 0.124.108 → 0.124.110

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 (342) hide show
  1. package/dist/__golden__/wave-loop/fan-out-applied.json +12 -6
  2. package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
  3. package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
  4. package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
  5. package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
  6. package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
  7. package/dist/agent-facts.d.ts +130 -0
  8. package/dist/agent-facts.js +196 -0
  9. package/dist/change-risk.d.ts +216 -0
  10. package/dist/change-risk.js +304 -0
  11. package/dist/change-set.d.ts +8 -0
  12. package/dist/ci-agent-alert.d.ts +139 -0
  13. package/dist/ci-agent-alert.js +342 -0
  14. package/dist/ci-agent-triggers.d.ts +152 -0
  15. package/dist/ci-agent-triggers.js +232 -0
  16. package/dist/ci-agent-verify-failed.d.ts +149 -0
  17. package/dist/ci-agent-verify-failed.js +191 -0
  18. package/dist/ci-agent.d.ts +136 -8
  19. package/dist/ci-agent.js +353 -26
  20. package/dist/ci-comment-commands.d.ts +8 -0
  21. package/dist/ci-comment-commands.js +17 -1
  22. package/dist/ci-comment-reject.d.ts +70 -0
  23. package/dist/ci-comment-reject.js +135 -0
  24. package/dist/ci-comment-replies.d.ts +3 -1
  25. package/dist/ci-comment-replies.js +6 -0
  26. package/dist/ci-estate/delivery.d.ts +25 -3
  27. package/dist/ci-estate/delivery.js +28 -9
  28. package/dist/ci-estate/page.d.ts +7 -3
  29. package/dist/ci-estate/page.js +19 -4
  30. package/dist/ci-estate/rows.d.ts +14 -2
  31. package/dist/ci-estate/rows.js +9 -1
  32. package/dist/ci-estate.d.ts +5 -2
  33. package/dist/ci-estate.js +3 -2
  34. package/dist/ci-handover.d.ts +2 -7
  35. package/dist/ci-handover.js +3 -20
  36. package/dist/ci-jobs.d.ts +6 -0
  37. package/dist/ci-jobs.js +17 -0
  38. package/dist/ci-note-commands.d.ts +2 -0
  39. package/dist/ci-note-commands.js +12 -1
  40. package/dist/ci-product-words.d.ts +151 -1
  41. package/dist/ci-product-words.js +1390 -3
  42. package/dist/ci-product.d.ts +100 -4
  43. package/dist/ci-product.js +99 -3
  44. package/dist/ci-respond-run.d.ts +9 -0
  45. package/dist/ci-respond-run.js +35 -4
  46. package/dist/ci-respond-summary-env.d.ts +56 -0
  47. package/dist/ci-respond-summary-env.js +81 -0
  48. package/dist/ci-respond-summary.d.ts +103 -0
  49. package/dist/ci-respond-summary.js +243 -0
  50. package/dist/ci-respond.d.ts +4 -2
  51. package/dist/ci-respond.js +4 -2
  52. package/dist/cli/command-group.js +1 -1
  53. package/dist/cli/commands/lint.js +21 -3
  54. package/dist/cli/handlers/agent.js +49 -4
  55. package/dist/cli/handlers/approve.js +3 -1
  56. package/dist/cli/handlers/build.d.ts +97 -1
  57. package/dist/cli/handlers/build.js +251 -3
  58. package/dist/cli/handlers/fan-out.js +55 -0
  59. package/dist/cli/handlers/graph.d.ts +14 -0
  60. package/dist/cli/handlers/graph.js +58 -3
  61. package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
  62. package/dist/cli/handlers/lifecycle-health.js +47 -9
  63. package/dist/cli/handlers/lifecycle.js +4 -1
  64. package/dist/cli/handlers/notify-relay.d.ts +2 -2
  65. package/dist/cli/handlers/notify-relay.js +67 -7
  66. package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
  67. package/dist/cli/handlers/pipeline-agent.js +255 -0
  68. package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
  69. package/dist/cli/handlers/pipeline-artifacts.js +203 -0
  70. package/dist/cli/handlers/pipeline.d.ts +16 -0
  71. package/dist/cli/handlers/pipeline.js +112 -0
  72. package/dist/cli/handlers/pr-comment.js +4 -0
  73. package/dist/cli/handlers/pr-notes.js +4 -1
  74. package/dist/cli/handlers/pr.d.ts +20 -0
  75. package/dist/cli/handlers/pr.js +114 -11
  76. package/dist/cli/handlers/promote.js +792 -47
  77. package/dist/cli/handlers/reject.d.ts +84 -0
  78. package/dist/cli/handlers/reject.js +216 -0
  79. package/dist/cli/handlers/release.js +4 -2
  80. package/dist/cli/handlers/replan.d.ts +54 -0
  81. package/dist/cli/handlers/replan.js +177 -0
  82. package/dist/cli/handlers/run-generate.d.ts +5 -0
  83. package/dist/cli/handlers/run-generate.js +31 -4
  84. package/dist/cli/handlers/run-wave.js +15 -2
  85. package/dist/cli/handlers/run.js +4 -2
  86. package/dist/cli/handlers/stage.d.ts +35 -0
  87. package/dist/cli/handlers/stage.js +90 -0
  88. package/dist/cli/lsp/server.js +4 -0
  89. package/dist/cli/main.js +88 -8
  90. package/dist/cli/parse-args.js +35 -2
  91. package/dist/cli/registry.d.ts +12 -0
  92. package/dist/components/auto-release.d.ts +2 -0
  93. package/dist/components/auto-release.js +1 -0
  94. package/dist/components/capability.d.ts +40 -0
  95. package/dist/components/cli-support.d.ts +21 -1
  96. package/dist/components/cli-support.js +28 -6
  97. package/dist/components/component.d.ts +23 -4
  98. package/dist/components/component.schema.json +28 -0
  99. package/dist/components/declared-reads.d.ts +44 -4
  100. package/dist/components/declared-reads.js +80 -3
  101. package/dist/components/discover.d.ts +8 -0
  102. package/dist/components/discover.js +1 -1
  103. package/dist/components/driver.d.ts +13 -0
  104. package/dist/components/driver.js +23 -2
  105. package/dist/components/environment-sets.d.ts +229 -0
  106. package/dist/components/environment-sets.js +338 -0
  107. package/dist/components/fan-out-canary.d.ts +47 -0
  108. package/dist/components/fan-out-canary.js +58 -0
  109. package/dist/components/fan-out-run.d.ts +17 -0
  110. package/dist/components/fan-out-run.js +14 -1
  111. package/dist/components/fan-out-support.d.ts +7 -0
  112. package/dist/components/fan-out-support.js +1 -1
  113. package/dist/components/groups.d.ts +8 -1
  114. package/dist/components/groups.js +19 -1
  115. package/dist/components/index.d.ts +5 -2
  116. package/dist/components/index.js +4 -1
  117. package/dist/components/pr-cost.d.ts +28 -0
  118. package/dist/components/pr-cost.js +53 -0
  119. package/dist/components/pr-pipeline.d.ts +33 -0
  120. package/dist/components/pr-pipeline.js +32 -5
  121. package/dist/components/pr-policy.d.ts +33 -2
  122. package/dist/components/pr-policy.js +5 -2
  123. package/dist/components/pr-risk.d.ts +42 -0
  124. package/dist/components/pr-risk.js +74 -0
  125. package/dist/components/product-pipeline.d.ts +43 -0
  126. package/dist/components/product-pipeline.js +67 -1
  127. package/dist/components/promote.d.ts +6 -0
  128. package/dist/components/promote.js +13 -0
  129. package/dist/components/release-compile.js +3 -1
  130. package/dist/components/release-gate.d.ts +6 -1
  131. package/dist/components/release-gate.js +10 -2
  132. package/dist/components/step-environments.d.ts +236 -0
  133. package/dist/components/step-environments.js +392 -0
  134. package/dist/components/upstream-replan.d.ts +201 -0
  135. package/dist/components/upstream-replan.js +249 -0
  136. package/dist/components/verify-step.d.ts +30 -0
  137. package/dist/components/verify-step.js +27 -0
  138. package/dist/components/wave-plan.js +6 -2
  139. package/dist/config-environments.d.ts +4 -2
  140. package/dist/control/dispatch.d.ts +15 -0
  141. package/dist/control/dispatch.js +28 -4
  142. package/dist/cost-estimate.d.ts +188 -0
  143. package/dist/cost-estimate.js +363 -0
  144. package/dist/drift-record.d.ts +36 -0
  145. package/dist/drift-record.js +44 -0
  146. package/dist/engine-facts.d.ts +105 -0
  147. package/dist/engine-facts.js +111 -0
  148. package/dist/exit-codes.d.ts +4 -3
  149. package/dist/exit-codes.js +4 -3
  150. package/dist/flag-params.d.ts +2 -2
  151. package/dist/flag-params.js +9 -4
  152. package/dist/floor-table.data.js +53 -0
  153. package/dist/forge-token-vars.d.ts +12 -0
  154. package/dist/forge-token-vars.js +25 -0
  155. package/dist/gate-decision.d.ts +3 -1
  156. package/dist/gate-decision.js +3 -1
  157. package/dist/gated-waves.d.ts +2 -0
  158. package/dist/gated-waves.js +1 -0
  159. package/dist/graph-ir.d.ts +30 -0
  160. package/dist/graph-ir.js +33 -1
  161. package/dist/graph-refs.d.ts +26 -0
  162. package/dist/graph-refs.js +34 -3
  163. package/dist/graph-schema/graph.schema.json +136 -0
  164. package/dist/health.d.ts +65 -0
  165. package/dist/health.js +62 -0
  166. package/dist/lexicon.d.ts +188 -1
  167. package/dist/lifecycle/disruption.d.ts +14 -1
  168. package/dist/lifecycle/disruption.js +5 -1
  169. package/dist/lifecycle/gate-change-set.d.ts +8 -0
  170. package/dist/lifecycle/gate-change-set.js +2 -1
  171. package/dist/lifecycle/gate-ledger.d.ts +26 -0
  172. package/dist/lifecycle/gate-rejection.d.ts +82 -0
  173. package/dist/lifecycle/gate-rejection.js +93 -0
  174. package/dist/lifecycle/gate-seal.d.ts +3 -3
  175. package/dist/lifecycle/gate-seal.js +5 -5
  176. package/dist/lifecycle/observe.d.ts +17 -0
  177. package/dist/lifecycle/observe.js +10 -1
  178. package/dist/lifecycle/release-cut.js +4 -0
  179. package/dist/lifecycle/release-ledger.d.ts +8 -0
  180. package/dist/lifecycle/release-risk.d.ts +137 -0
  181. package/dist/lifecycle/release-risk.js +214 -0
  182. package/dist/lifecycle/release-store.d.ts +9 -0
  183. package/dist/lifecycle/release-store.js +4 -0
  184. package/dist/lifecycle/stage-log.d.ts +85 -0
  185. package/dist/lifecycle/stage-log.js +141 -0
  186. package/dist/lint/canary-checks.d.ts +31 -0
  187. package/dist/lint/canary-checks.js +45 -0
  188. package/dist/lint/rule.d.ts +1 -0
  189. package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
  190. package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
  191. package/dist/lint/rules/index.d.ts +1 -0
  192. package/dist/lint/rules/index.js +3 -0
  193. package/dist/notify-relay-repo.d.ts +54 -0
  194. package/dist/notify-relay-repo.js +84 -0
  195. package/dist/notify-relay.d.ts +53 -3
  196. package/dist/notify-relay.js +96 -3
  197. package/dist/notify.d.ts +57 -1
  198. package/dist/notify.js +7 -1
  199. package/dist/notify.schema.json +61 -3
  200. package/dist/observation.d.ts +34 -0
  201. package/dist/observation.js +14 -1
  202. package/dist/op/activities/review-agent.d.ts +39 -2
  203. package/dist/op/activities/review-agent.js +88 -5
  204. package/dist/op/agent-permit.d.ts +88 -0
  205. package/dist/op/agent-permit.js +97 -0
  206. package/dist/op/gate-approval-base.d.ts +8 -0
  207. package/dist/op/gate-approval-base.js +9 -0
  208. package/dist/op/gate-approval.d.ts +30 -1
  209. package/dist/op/gate-approval.js +23 -2
  210. package/dist/op/gate-quorum.d.ts +114 -8
  211. package/dist/op/gate-quorum.js +198 -21
  212. package/dist/op/gate-reject.d.ts +79 -0
  213. package/dist/op/gate-reject.js +96 -0
  214. package/dist/op/gate-summary.js +1 -1
  215. package/dist/op/gate.d.ts +28 -3
  216. package/dist/op/gate.js +55 -13
  217. package/dist/op/generate-pipeline.d.ts +15 -1
  218. package/dist/op/generate-pipeline.js +32 -5
  219. package/dist/op/index.d.ts +11 -6
  220. package/dist/op/index.js +10 -5
  221. package/dist/op/local-executor.d.ts +2 -0
  222. package/dist/op/local-executor.js +23 -4
  223. package/dist/op/op-waves-after-plan.d.ts +23 -0
  224. package/dist/op/op-waves-after-plan.js +12 -1
  225. package/dist/op/op-waves-capability-spec.d.ts +14 -0
  226. package/dist/op/op-waves-capability-spec.js +46 -6
  227. package/dist/op/op-waves-capability.d.ts +21 -13
  228. package/dist/op/op-waves-capability.js +22 -59
  229. package/dist/op/op-waves-environment-sets.d.ts +41 -0
  230. package/dist/op/op-waves-environment-sets.js +82 -0
  231. package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
  232. package/dist/op/op-waves-quorum-warnings.js +90 -0
  233. package/dist/op/op-waves-release-port.d.ts +7 -0
  234. package/dist/op/op-waves-release-port.js +15 -3
  235. package/dist/op/op-waves-release.d.ts +15 -0
  236. package/dist/op/op-waves-release.js +15 -0
  237. package/dist/op/op-waves-run.d.ts +37 -3
  238. package/dist/op/op-waves-run.js +141 -18
  239. package/dist/op/op-waves-soak.d.ts +57 -0
  240. package/dist/op/op-waves-soak.js +111 -0
  241. package/dist/op/op-waves-split.d.ts +4 -0
  242. package/dist/op/op-waves-split.js +4 -0
  243. package/dist/op/op-waves.d.ts +67 -4
  244. package/dist/op/op-waves.js +71 -3
  245. package/dist/pipeline/agent-ajv.d.ts +4 -0
  246. package/dist/pipeline/agent-ajv.js +14 -0
  247. package/dist/pipeline/agent-steps.d.ts +329 -0
  248. package/dist/pipeline/agent-steps.js +602 -0
  249. package/dist/pipeline/artifacts.d.ts +264 -0
  250. package/dist/pipeline/artifacts.js +425 -0
  251. package/dist/pipeline/diff.d.ts +45 -0
  252. package/dist/pipeline/diff.js +177 -0
  253. package/dist/pipeline/fold.d.ts +43 -0
  254. package/dist/pipeline/fold.js +140 -0
  255. package/dist/pipeline/generate.d.ts +52 -0
  256. package/dist/pipeline/generate.js +120 -0
  257. package/dist/pipeline/product.d.ts +225 -0
  258. package/dist/pipeline/product.js +257 -0
  259. package/dist/pipeline/promote.d.ts +404 -0
  260. package/dist/pipeline/promote.js +694 -0
  261. package/dist/pipeline/read.d.ts +37 -0
  262. package/dist/pipeline/read.js +58 -0
  263. package/dist/pipeline/rendered.d.ts +25 -0
  264. package/dist/pipeline/rendered.js +53 -0
  265. package/dist/pipeline/soak-checks.d.ts +80 -0
  266. package/dist/pipeline/soak-checks.js +254 -0
  267. package/dist/pipeline/soak-gate.d.ts +97 -0
  268. package/dist/pipeline/soak-gate.js +176 -0
  269. package/dist/pipeline/soak-sources.d.ts +17 -0
  270. package/dist/pipeline/soak-sources.js +42 -0
  271. package/dist/pipeline/soak.d.ts +260 -0
  272. package/dist/pipeline/soak.js +378 -0
  273. package/dist/pipeline/spec.d.ts +724 -0
  274. package/dist/pipeline/spec.js +567 -0
  275. package/dist/pipeline/stage-ledger.d.ts +187 -0
  276. package/dist/pipeline/stage-ledger.js +185 -0
  277. package/dist/pipeline/stage-waves.d.ts +114 -0
  278. package/dist/pipeline/stage-waves.js +161 -0
  279. package/dist/pipeline/stages.d.ts +64 -0
  280. package/dist/pipeline/stages.js +174 -0
  281. package/dist/pipeline/verify-rollback.d.ts +277 -0
  282. package/dist/pipeline/verify-rollback.js +393 -0
  283. package/dist/pipeline.d.ts +142 -0
  284. package/dist/pipeline.js +143 -0
  285. package/dist/pr-loop.d.ts +22 -0
  286. package/dist/pr-loop.js +8 -0
  287. package/dist/pr-plan-note.d.ts +15 -1
  288. package/dist/pr-plan-note.js +8 -0
  289. package/dist/pr-post.d.ts +31 -0
  290. package/dist/pr-post.js +89 -0
  291. package/dist/release-floors.d.ts +1 -1
  292. package/dist/release-floors.js +1 -1
  293. package/dist/report-store/audit.schema.json +50 -0
  294. package/dist/report-store/dora.schema.json +331 -0
  295. package/dist/report-store/estate.schema.json +96 -0
  296. package/dist/report-store/run.schema.json +14 -0
  297. package/dist/report-store.d.ts +151 -0
  298. package/dist/report-store.js +344 -0
  299. package/dist/run-event.d.ts +7 -2
  300. package/dist/wave-runtime.mjs +458 -404
  301. package/dist/workspace/catalog-edges.js +3 -3
  302. package/dist/workspace/change-set.schema.json +4 -0
  303. package/dist/workspace/ci-cloud-identity.d.ts +4 -0
  304. package/dist/workspace/ci-cloud-identity.js +30 -0
  305. package/dist/workspace/ci-run.js +17 -2
  306. package/dist/workspace/ci-secrets.d.ts +3 -1
  307. package/dist/workspace/ci-secrets.js +7 -1
  308. package/dist/workspace/compose-graph.d.ts +1 -1
  309. package/dist/workspace/compose-graph.js +3 -1
  310. package/dist/workspace/declaration.d.ts +27 -0
  311. package/dist/workspace/declaration.js +35 -0
  312. package/dist/workspace/declaration.schema.json +56 -0
  313. package/dist/workspace/graph-cli.js +26 -0
  314. package/dist/workspace/graph.schema.json +5 -1
  315. package/dist/workspace/identity-gate-rule.d.ts +4 -0
  316. package/dist/workspace/identity-gate-rule.js +2 -2
  317. package/dist/workspace/identity-reject-rule.d.ts +14 -0
  318. package/dist/workspace/identity-reject-rule.js +24 -0
  319. package/dist/workspace/identity.d.ts +3 -0
  320. package/dist/workspace/identity.js +2 -1
  321. package/dist/workspace/nested-graph.js +2 -0
  322. package/dist/workspace/pr-report.schema.json +65 -0
  323. package/dist/workspace/promotion-order.d.ts +19 -4
  324. package/dist/workspace/promotion-order.js +26 -4
  325. package/dist/workspace/release-train.d.ts +14 -0
  326. package/dist/workspace/release-train.js +32 -0
  327. package/dist/workspace/run-event.schema.json +2 -2
  328. package/dist/workspace/stack-read-edges.d.ts +19 -0
  329. package/dist/workspace/stack-read-edges.js +54 -0
  330. package/dist/workspace/status-gates.d.ts +51 -1
  331. package/dist/workspace/status-gates.js +60 -0
  332. package/dist/workspace/status-stages.d.ts +223 -0
  333. package/dist/workspace/status-stages.js +279 -0
  334. package/dist/workspace/status.d.ts +45 -1
  335. package/dist/workspace/status.js +109 -5
  336. package/dist/workspace/status.schema.json +283 -2
  337. package/dist/workspace/train-cut.js +5 -2
  338. package/dist/workspace/train-shell.d.ts +18 -0
  339. package/dist/workspace/train-shell.js +43 -0
  340. package/dist/workspace/trust/seal.d.ts +7 -0
  341. package/dist/workspace/trust/seal.js +9 -0
  342. package/package.json +5 -1
@@ -62,7 +62,7 @@ export { GATE_SEAL_NAMESPACE, gateSealPayload, gateSealRefusal, gateSealVersion,
62
62
  export { DEFAULT_SIGNERS_PATH, TRUST_CONFIG_PATH, parseAllowedSigners, trustConfigProblems, } from "./workspace/trust/trust-files.js";
63
63
  export { CORE_CLASSES, admitApprover, grantedClasses, } from "./workspace/identity-gate-rule.js";
64
64
  export { appliedGateApplies, appliedGatePath, isApprovalSpent, parseAppliedGateLines, } from "./lifecycle/gate-applied.js";
65
- export { quorumNeed, quorumProblems, quorumRuleLine, quorumRuleProgress, quorumRules, quorumRulesFor, quorumWaiting, rolesOf, ruleNeedsProof, samePrincipal, targetGlobMatch, trustQuorumJudge, UNPROVEN_JUDGE, changeInvolvement, involvedWhy, principalNames, recordedReviewApprovals, recordedReviewOf, requestedByTrailers, } from "./op/gate-quorum.js";
65
+ export { quorumNeed, quorumProblems, quorumRuleLine, quorumRuleProgress, quorumRules, quorumRulesFor, quorumWaiting, quorumNodes, quorumTreeProgress, quorumGroupLines, rolesOf, ruleNeedsProof, samePrincipal, targetGlobMatch, trustQuorumJudge, UNPROVEN_JUDGE, changeInvolvement, involvedWhy, principalNames, recordedReviewApprovals, recordedReviewOf, requestedByTrailers, } from "./op/gate-quorum.js";
66
66
  // ── reading at base ──────────────────────────────────────────────────────
67
67
  function git(repo, args) {
68
68
  return spawnSync("git", args, { cwd: repo, encoding: "utf-8" });
@@ -176,6 +176,8 @@ function identityGatesOf(declaration) {
176
176
  out.mode = entry.mode;
177
177
  if (entry.context !== undefined)
178
178
  out.context = structuredClone(entry.context);
179
+ if (typeof entry.agentPassesAlone === "boolean")
180
+ out.agentPassesAlone = entry.agentPassesAlone;
179
181
  return out;
180
182
  });
181
183
  }
@@ -150,6 +150,8 @@ export interface WaveRecord {
150
150
  component: string;
151
151
  error?: string;
152
152
  }>;
153
+ /** When the wave's applies ended, ISO 8601 (#5327): the clock of a canary wave's soak. Absent on a wave that applied nothing, and on a record written before it. */
154
+ settledAt?: string;
153
155
  }
154
156
  /**
155
157
  * Read the `waves` array of an attempt record, dropping anything malformed.
@@ -158,6 +158,7 @@ export function readWaveRecords(value) {
158
158
  ...(typeof raw.approvedBy === "string" ? { approvedBy: raw.approvedBy } : {}),
159
159
  ...(typeof raw.approved === "string" ? { approved: raw.approved } : {}),
160
160
  ...(failed.length > 0 ? { failed } : {}),
161
+ ...(typeof raw.settledAt === "string" ? { settledAt: raw.settledAt } : {}),
161
162
  });
162
163
  }
163
164
  return out;
@@ -85,6 +85,18 @@ export interface IRNode {
85
85
  * unaffected.
86
86
  */
87
87
  runtimeOwner?: string;
88
+ /**
89
+ * The node of the component resource that registered this one (#5403): a
90
+ * Pulumi resource whose `parent` is another resource of the stack. Terraform
91
+ * puts a block under its module in the id, `estate/module.app/aws_eip.pool`;
92
+ * a Pulumi id is the URN rule's and never changes with the parent, so the
93
+ * parent is named here instead. A component's own `component` is the
94
+ * component above it, so nested components nest, and following the field
95
+ * upward ends at a node that has none. Absent on a node whose parent is the
96
+ * stack, and on every node of a lexicon with no such parent. Always the id
97
+ * of another node of the same graph. Detail tiers keep it.
98
+ */
99
+ component?: string;
88
100
  /**
89
101
  * On an instance node of a `count` or `for_each` block (#4454): the block
90
102
  * node's id. The node's own id is that id followed by {@link instanceKey},
@@ -390,6 +402,12 @@ export declare function entityStack(entity: Declarable): string | undefined;
390
402
  * nothing in chant decides from it (see `IRNode.facts`).
391
403
  */
392
404
  export declare function entityFacts(entity: Declarable): EngineFacts | undefined;
405
+ /**
406
+ * The id of the node whose component registered this entity (#5403), or
407
+ * undefined. Duck-typed like {@link entityStack}: the pulumi lexicon sets
408
+ * `component` on an entity whose export `parent` is another resource.
409
+ */
410
+ export declare function entityComponent(entity: Declarable): string | undefined;
393
411
  /**
394
412
  * The instance keys an entity says its source expands to (#4454), as the
395
413
  * engine prints them (`[0]`, `["a"]`), or an empty list. Duck-typed like
@@ -721,6 +739,18 @@ export declare function collectUnobserved(observations: LiveObservation[]): Reco
721
739
  * no live edges). Sorted; the live groups pass through unchanged.
722
740
  */
723
741
  export declare function overlayGraphs(live: GraphIR, declared: GraphIR, opts?: OverlayOptions): GraphIR;
742
+ /**
743
+ * Put an ownership engine's facts about what a live read did not return as
744
+ * present (#5333, `ObservationResult.engineFacts`) on the overlay's nodes, by
745
+ * id. A node that already carries `facts` keeps them: those came with a live
746
+ * node. Nothing else changes, so a pending node stays `accent` and a filtered
747
+ * one `neutral`; the facts say what the engine saw, for people and for
748
+ * readers that show the graph, and nothing in chant decides from them.
749
+ */
750
+ export declare function carryEngineFacts<N extends {
751
+ id: string;
752
+ facts?: EngineFacts;
753
+ }>(nodes: N[], facts: Record<string, EngineFacts> | undefined): N[];
724
754
  /**
725
755
  * Source-anchored overlay (#821) — the inverse of {@link overlayGraphs}. The
726
756
  * **declared** graph is the canvas, so its edges are kept: cross-substrate edges
package/dist/graph-ir.js CHANGED
@@ -56,6 +56,15 @@ export function entityFacts(entity) {
56
56
  const facts = entity.facts;
57
57
  return typeof facts === "object" && facts !== null && !Array.isArray(facts) ? facts : undefined;
58
58
  }
59
+ /**
60
+ * The id of the node whose component registered this entity (#5403), or
61
+ * undefined. Duck-typed like {@link entityStack}: the pulumi lexicon sets
62
+ * `component` on an entity whose export `parent` is another resource.
63
+ */
64
+ export function entityComponent(entity) {
65
+ const component = entity.component;
66
+ return typeof component === "string" && component.length > 0 ? component : undefined;
67
+ }
59
68
  /**
60
69
  * The instance keys an entity says its source expands to (#4454), as the
61
70
  * engine prints them (`[0]`, `["a"]`), or an empty list. Duck-typed like
@@ -307,7 +316,7 @@ function subEnvelope(sub, seen, reverse, nodeIds) {
307
316
  // directly, so projecting them into `attrs` would only restate an edge and a
308
317
  // group key the IR already carries.
309
318
  // `facts` (#4529) is an engine's observation, carried onto `IRNode.facts`, not configuration.
310
- const SKIP_KEYS = new Set(["lexicon", "entityType", "kind", "attributes", "Ref", "references", "stack", "facts"]);
319
+ const SKIP_KEYS = new Set(["lexicon", "entityType", "kind", "attributes", "Ref", "references", "stack", "facts", "component"]);
311
320
  /** The config bag of a node, paired with each key. Lexicon entities keep their
312
321
  * declared props in a (usually non-enumerable) `props` object; simpler entities
313
322
  * carry config as enumerable own properties. We surface both, flattening `props`
@@ -491,6 +500,9 @@ export function buildGraphIr(entities, projectPath) {
491
500
  const facts = entityFacts(entity);
492
501
  if (facts)
493
502
  node.facts = facts;
503
+ const component = entityComponent(entity);
504
+ if (component && component !== name && nodeIds.has(component))
505
+ node.component = component;
494
506
  nodes.push(node);
495
507
  (byLexicon[_a = entity.lexicon] ?? (byLexicon[_a] = [])).push(name);
496
508
  // An entity that names its own deployable unit is taken at its word
@@ -788,6 +800,8 @@ export function buildLiveGraphIr(observations) {
788
800
  // An engine's facts (#4527) ride beside `physicalId`, as the engine gave them.
789
801
  if (meta.facts)
790
802
  node.facts = meta.facts;
803
+ if (meta.component && meta.component !== name)
804
+ node.component = meta.component;
791
805
  nodes.push(node);
792
806
  (byLexicon[lexicon] ?? (byLexicon[lexicon] = [])).push(name);
793
807
  // A live lexicon maps to one deployable stack, same as the source IR.
@@ -969,6 +983,22 @@ export function overlayGraphs(live, declared, opts) {
969
983
  nodes.sort((a, b) => a.id.localeCompare(b.id));
970
984
  return { ...live, nodes };
971
985
  }
986
+ /**
987
+ * Put an ownership engine's facts about what a live read did not return as
988
+ * present (#5333, `ObservationResult.engineFacts`) on the overlay's nodes, by
989
+ * id. A node that already carries `facts` keeps them: those came with a live
990
+ * node. Nothing else changes, so a pending node stays `accent` and a filtered
991
+ * one `neutral`; the facts say what the engine saw, for people and for
992
+ * readers that show the graph, and nothing in chant decides from them.
993
+ */
994
+ export function carryEngineFacts(nodes, facts) {
995
+ if (!facts || Object.keys(facts).length === 0)
996
+ return nodes;
997
+ return nodes.map((n) => {
998
+ const f = n.facts ? undefined : facts[n.id];
999
+ return f ? { ...n, facts: f } : n;
1000
+ });
1001
+ }
972
1002
  /**
973
1003
  * Source-anchored overlay (#821) — the inverse of {@link overlayGraphs}. The
974
1004
  * **declared** graph is the canvas, so its edges are kept: cross-substrate edges
@@ -1019,6 +1049,8 @@ export function sourceOverlayGraphs(declared, live, opts) {
1019
1049
  merged.ownership = obs.ownership;
1020
1050
  if (obs.facts)
1021
1051
  merged.facts = obs.facts;
1052
+ if (obs.component && !merged.component)
1053
+ merged.component = obs.component;
1022
1054
  // ...and what was observed ABOUT it (#1279). The declared canvas holds what
1023
1055
  // the source says; the observation holds what the account says, and a fact
1024
1056
  // like `VpcId` exists only on the second. Dropping it here made every
@@ -401,7 +401,31 @@ export declare function containmentGroups(pairs: ContainmentPair[]): Record<stri
401
401
  export interface NamedCatalog {
402
402
  lexicon: string;
403
403
  catalog: ReferenceCatalog;
404
+ /**
405
+ * Other lexicon names whose nodes this catalog also reads (#5340). A
406
+ * choudoufu roster node carries `lexicon: "choudoufu"` and the provider
407
+ * type as its `kind`, so `{ lexicon: "terraform", catalog, aliases: ["choudoufu"] }`
408
+ * applies the terraform catalog to it. A derived edge keeps the catalog's
409
+ * own lexicon in its `rule` (`terraform:aws_db_instance:db_subnet_group_name`).
410
+ */
411
+ aliases?: readonly string[];
404
412
  }
413
+ /**
414
+ * The first chant whose reference passes take a lexicon alias (#5340):
415
+ * `NamedCatalog.aliases` and `IdentityOwners.aliases` read nodes of another
416
+ * lexicon name with one lexicon's catalog, so `runCatalogPass`
417
+ * (`@intentius/chant/workspace/catalog-edges`), `reconstructIndexedEdges` and
418
+ * `reconstructIdentityEdges` apply the terraform catalog to choudoufu roster
419
+ * nodes.
420
+ */
421
+ export declare const GRAPH_REFS_LEXICON_ALIAS_FLOOR = "0.124.110";
422
+ /** True when a catalog (or identity owner) reads nodes of `lexicon`: its own name or an alias. */
423
+ export declare function readsLexicon(c: {
424
+ lexicon: string;
425
+ aliases?: readonly string[];
426
+ }, lexicon: string): boolean;
427
+ /** Catalogs by every lexicon name they read; an own name wins over another catalog's alias. */
428
+ export declare function catalogsByLexicon(catalogs: readonly NamedCatalog[]): Map<string, ReferenceCatalog>;
405
429
  /**
406
430
  * Where an indexed node's identifiers are unique (INTENTIUS/behold#1023 Q2):
407
431
  * its substrate and account, subscription, project or cluster, plus its
@@ -483,6 +507,8 @@ export interface NodeIdentityValue {
483
507
  /** The lexicon whose nodes can be identity-matched, and the values that name each one. */
484
508
  export interface IdentityOwners {
485
509
  lexicon: string;
510
+ /** Other lexicon names whose nodes this owner also names (#5340). */
511
+ aliases?: readonly string[];
486
512
  /** The values that name a node of this lexicon. Absent: its native id and its ARN cloud ids. */
487
513
  identities?(node: IRNode): NodeIdentityValue[];
488
514
  }
@@ -225,6 +225,30 @@ export function containmentGroups(pairs) {
225
225
  out[parent] = [...byParent.get(parent)].sort();
226
226
  return out;
227
227
  }
228
+ /**
229
+ * The first chant whose reference passes take a lexicon alias (#5340):
230
+ * `NamedCatalog.aliases` and `IdentityOwners.aliases` read nodes of another
231
+ * lexicon name with one lexicon's catalog, so `runCatalogPass`
232
+ * (`@intentius/chant/workspace/catalog-edges`), `reconstructIndexedEdges` and
233
+ * `reconstructIdentityEdges` apply the terraform catalog to choudoufu roster
234
+ * nodes.
235
+ */
236
+ export const GRAPH_REFS_LEXICON_ALIAS_FLOOR = "0.124.110";
237
+ /** True when a catalog (or identity owner) reads nodes of `lexicon`: its own name or an alias. */
238
+ export function readsLexicon(c, lexicon) {
239
+ return c.lexicon === lexicon || (c.aliases?.includes(lexicon) ?? false);
240
+ }
241
+ /** Catalogs by every lexicon name they read; an own name wins over another catalog's alias. */
242
+ export function catalogsByLexicon(catalogs) {
243
+ const out = new Map();
244
+ for (const c of catalogs)
245
+ for (const a of c.aliases ?? [])
246
+ if (!out.has(a))
247
+ out.set(a, c.catalog);
248
+ for (const c of catalogs)
249
+ out.set(c.lexicon, c.catalog);
250
+ return out;
251
+ }
228
252
  /** The region of a node held by one member (a `ScopeRule` with no `path`). */
229
253
  export const memberRegion = (member) => `member:${member}`;
230
254
  /** Values a masking or normalization pass wrote: never an identifier. */
@@ -362,8 +386,9 @@ export function reconstructIndexedEdges(nodes, catalogs, scopeOf) {
362
386
  }
363
387
  };
364
388
  for (const node of sorted) {
365
- for (const { lexicon, catalog } of catalogs) {
366
- if (node.lexicon !== lexicon)
389
+ for (const nc of catalogs) {
390
+ const { lexicon, catalog } = nc;
391
+ if (!readsLexicon(nc, node.lexicon))
367
392
  continue;
368
393
  for (const rule of catalog.refs) {
369
394
  // `from: "*"` is a rule that reads every node of the lexicon (#5286); its `join` picks the nodes.
@@ -496,7 +521,13 @@ function stringLeaves(attrs) {
496
521
  */
497
522
  export function reconstructIdentityEdges(nodes, owners, scopeOf, existing = []) {
498
523
  const sorted = [...nodes].sort((a, b) => byString(a.id, b.id));
499
- const ownerBy = new Map(owners.map((o) => [o.lexicon, o]));
524
+ const ownerBy = new Map();
525
+ for (const o of owners)
526
+ for (const a of o.aliases ?? [])
527
+ if (!ownerBy.has(a))
528
+ ownerBy.set(a, o);
529
+ for (const o of owners)
530
+ ownerBy.set(o.lexicon, o);
500
531
  const keyOf = (scope, value) => `${scope.account}\u0000${scope.region ?? ""}\u0000${scope.foldCase ? value.toLowerCase() : value}`;
501
532
  // key -> node id -> the rule that names it, and the paths it names the node at
502
533
  const index = new Map();
@@ -228,6 +228,32 @@
228
228
  "property"
229
229
  ]
230
230
  },
231
+ "EngineAdoption": {
232
+ "description": "How to adopt a live object that sits at a declared identity (#5402): the marker values that claim it for this member, choudoufu's `adopt_tofu_estate` and `adopt_tofu_address`.",
233
+ "type": "object",
234
+ "properties": {
235
+ "owner": {
236
+ "description": "The owner marker value to write: the estate, or plunge's `<project>/<stack>`.",
237
+ "type": "string"
238
+ },
239
+ "address": {
240
+ "description": "The address marker value to write, in the encoding the engine writes it.",
241
+ "type": "string"
242
+ },
243
+ "command": {
244
+ "description": "The one-line command the engine composed for the write, when it printed one.",
245
+ "type": "string"
246
+ },
247
+ "matched": {
248
+ "description": "On a content match (choudoufu `adoptable[]`): the arguments the sweep compared, in its order.",
249
+ "type": "array",
250
+ "items": {
251
+ "$ref": "#/$defs/EngineMatchedArgument"
252
+ }
253
+ }
254
+ },
255
+ "additionalProperties": false
256
+ },
231
257
  "EngineCloudId": {
232
258
  "description": "One cloud identifier of a node.",
233
259
  "type": "object",
@@ -291,10 +317,43 @@
291
317
  "observedAt": {
292
318
  "description": "ISO 8601 UTC, when this node's live facts were read.",
293
319
  "type": "string"
320
+ },
321
+ "ownershipRows": {
322
+ "description": "The rows behind `ownership` for this one node (#5402). Absent when the engine's documents hold none for it.",
323
+ "$ref": "#/$defs/EngineOwnershipRows"
324
+ }
325
+ },
326
+ "additionalProperties": false
327
+ },
328
+ "EngineGap": {
329
+ "description": "One thing a read could not see about a node (#5402). `listing` is choudoufu `live-ls`'s `gaps[]`: the tag listing can never list this instance, and `reason` is the rung that says why (`record`, `declaration-carried`). `graph` is the engine graph document's own `meta.engineGraph.gaps` entry for the node, from choudoufu or plunge.",
330
+ "type": "object",
331
+ "properties": {
332
+ "read": {
333
+ "$ref": "#/$defs/EngineGapRead"
334
+ },
335
+ "reason": {
336
+ "type": "string"
337
+ },
338
+ "detail": {
339
+ "type": "string"
294
340
  }
295
341
  },
342
+ "required": [
343
+ "read",
344
+ "reason",
345
+ "detail"
346
+ ],
296
347
  "additionalProperties": false
297
348
  },
349
+ "EngineGapRead": {
350
+ "description": "Which of an engine's reads could not see a node.",
351
+ "type": "string",
352
+ "enum": [
353
+ "graph",
354
+ "listing"
355
+ ]
356
+ },
298
357
  "EngineGraphDocument": {
299
358
  "description": "The one JSON document `choudoufu live-graph -json` and `plunge graph --json` print. A `GraphIR` at version 1: node ids are the engine's own addresses (choudoufu's instance address, plunge's URN), and readers map them with `entityKeyFor`, `observedInstanceNodeId` and `pulumiNodeKey`.",
300
359
  "type": "object",
@@ -619,6 +678,79 @@
619
678
  ],
620
679
  "additionalProperties": false
621
680
  },
681
+ "EngineMatchedArgument": {
682
+ "description": "One argument a content match compared, and the value both sides hold.",
683
+ "type": "object",
684
+ "properties": {
685
+ "attribute": {
686
+ "type": "string"
687
+ },
688
+ "value": {
689
+ "type": "string"
690
+ }
691
+ },
692
+ "required": [
693
+ "attribute",
694
+ "value"
695
+ ],
696
+ "additionalProperties": false
697
+ },
698
+ "EngineOmission": {
699
+ "description": "Why a plan left a node out (#5402): choudoufu `live-plan`'s `omissions[]` row for the address, as printed.",
700
+ "type": "object",
701
+ "properties": {
702
+ "reason": {
703
+ "description": "The engine's own code: `ABSENT`, `UNOWNED`, `NEEDS_DISCOVERY`, `FAILED` and the rest.",
704
+ "type": "string"
705
+ },
706
+ "detail": {
707
+ "description": "The engine's sentence for this node.",
708
+ "type": "string"
709
+ }
710
+ },
711
+ "required": [
712
+ "reason",
713
+ "detail"
714
+ ],
715
+ "additionalProperties": false
716
+ },
717
+ "EngineOwnershipRows": {
718
+ "description": "The per-node rows an ownership engine prints beside its verdict (#5402), each with the engine's own words. chant fills them from the documents the engine prints: choudoufu's `live-plan -json` and, when asked, `live-ls -json`, and either engine's `meta.engineGraph.gaps`. An engine may also print them on a node's `facts`. Every field is optional, and a node with none carries no `ownershipRows`.",
719
+ "type": "object",
720
+ "properties": {
721
+ "boundBy": {
722
+ "description": "How the plan bound the node, in the engine's word (choudoufu `bound[].source`: `marker`, `record`, `derived`, `cache`).",
723
+ "type": "string"
724
+ },
725
+ "identityValues": {
726
+ "description": "The values that identify the bound object, by argument (choudoufu `bound[].identity_values`).",
727
+ "type": "object",
728
+ "additionalProperties": {
729
+ "type": "string"
730
+ }
731
+ },
732
+ "omission": {
733
+ "description": "Why the plan left the node out.",
734
+ "$ref": "#/$defs/EngineOmission"
735
+ },
736
+ "adopt": {
737
+ "description": "How to adopt the live object at the node's identity.",
738
+ "$ref": "#/$defs/EngineAdoption"
739
+ },
740
+ "gaps": {
741
+ "description": "What a read could not see.",
742
+ "type": "array",
743
+ "items": {
744
+ "$ref": "#/$defs/EngineGap"
745
+ }
746
+ },
747
+ "listed": {
748
+ "description": "Whether the engine's marker listing holds the object under this member's marker. Set on a bound node when the listing ran.",
749
+ "type": "boolean"
750
+ }
751
+ },
752
+ "additionalProperties": false
753
+ },
622
754
  "EngineRecordVersion": {
623
755
  "description": "One version of a node's record. No record values.",
624
756
  "type": "object",
@@ -1019,6 +1151,10 @@
1019
1151
  "description": "Live-only, undeclared nodes: the declared entity this node's owner-reference chain resolves to (#1077) — a Pod a declared Deployment's controller created, for instance. Presence of this field is what an overlay reads to paint the node `runtime` instead of `warn`/foreign; a node without it (including every declared, source-derived node) is unaffected.",
1020
1152
  "type": "string"
1021
1153
  },
1154
+ "component": {
1155
+ "description": "The node of the component resource that registered this one (#5403): a Pulumi resource whose `parent` is another resource of the stack. Terraform puts a block under its module in the id, `estate/module.app/aws_eip.pool`; a Pulumi id is the URN rule's and never changes with the parent, so the parent is named here instead. A component's own `component` is the component above it, so nested components nest, and following the field upward ends at a node that has none. Absent on a node whose parent is the stack, and on every node of a lexicon with no such parent. Always the id of another node of the same graph. Detail tiers keep it.",
1156
+ "type": "string"
1157
+ },
1022
1158
  "instanceOf": {
1023
1159
  "description": "On an instance node of a `count` or `for_each` block (#4454): the block node's id. The node's own id is that id followed by instanceKey, `aws_eip.pool[0]` under `aws_eip.pool`, and the block node stays in the graph as the rollup. Absent on every other node. See `./instance-nodes.ts`.",
1024
1160
  "type": "string"
package/dist/health.d.ts CHANGED
@@ -61,6 +61,15 @@ export interface HealthReadOptions {
61
61
  }>;
62
62
  stack?: string;
63
63
  region?: string;
64
+ /**
65
+ * Each entity's id as an engine recorded it (#5338): a terraform root's
66
+ * state, a pulumi stack's export. Set when core reads health for an
67
+ * engine's resources through the provider lexicon that knows the type. A
68
+ * reader then takes the id from here in place of its own deploy records
69
+ * (aws's CloudFormation stack, azure's resource group), and an entity with
70
+ * no id here is absent.
71
+ */
72
+ physicalIds?: Readonly<Record<string, string>>;
64
73
  }
65
74
  /** The two plugin members a lexicon implements to answer a health read. */
66
75
  export interface HealthLexicon {
@@ -107,3 +116,59 @@ export declare function summarizeHealth(results: Iterable<HealthReadResult>): He
107
116
  export declare function healthEntry(type: string, state: HealthState, detail: string, observedAt: string, checkedAt?: string): HealthEntry;
108
117
  /** A hole, for a reader building its result. */
109
118
  export declare function healthHole(type: string, reason: UnobservedReason, detail: string): UnobservedEntity;
119
+ /**
120
+ * One engine resource a provider lexicon reads health for (#5338): a
121
+ * terraform `aws_ecs_service` is the aws lexicon's `AWS::ECS::Service`.
122
+ */
123
+ export interface HealthTarget {
124
+ /** The provider lexicon whose `observeHealth` reads it, e.g. `aws`. */
125
+ lexicon: string;
126
+ /** That lexicon's health type, one of its `healthTypes`. */
127
+ type: string;
128
+ /** The engine's own resource type, e.g. `aws_ecs_service` or `aws:ecs/service:Service`. */
129
+ engineType: string;
130
+ /** The id the engine recorded for it. */
131
+ physicalId: string;
132
+ }
133
+ /**
134
+ * What an engine lexicon's {@link EngineHealthLexicon.healthTargets} returns:
135
+ * each resource of a covered type in exactly one of `targets`, `unobserved`
136
+ * or `absent`, and each resource of any other type in `uncovered`, keyed by
137
+ * entity name with its engine type.
138
+ */
139
+ export interface HealthTargetsResult {
140
+ targets: Record<string, HealthTarget>;
141
+ unobserved: Record<string, UnobservedEntity>;
142
+ absent: string[];
143
+ /**
144
+ * The root's or stack's resources no provider lexicon reads health for.
145
+ * Core reports each one `unknown`: nothing says whether it is up, and a
146
+ * soak that counts `unknown` as failing must not pass on a root nobody can
147
+ * observe.
148
+ */
149
+ uncovered?: Record<string, string>;
150
+ }
151
+ /**
152
+ * An engine lexicon (terraform, pulumi) answers health through the provider
153
+ * lexicons (#5338). It maps its resource types onto their health types and
154
+ * reads each resource's id from its own records; core hands the ids to the
155
+ * provider's `observeHealth`.
156
+ */
157
+ export interface EngineHealthLexicon {
158
+ name: string;
159
+ healthTargets?(options: HealthReadOptions): Promise<HealthTargetsResult>;
160
+ }
161
+ /** The first chant whose `lifecycle health` reads a terraform root's or pulumi stack's resources through the provider lexicons, with `healthTargets` and `HealthReadOptions.physicalIds`, and reports each resource no provider reads as `unknown` (#5338). */
162
+ export declare const ENGINE_HEALTH_FLOOR = "0.124.110";
163
+ /**
164
+ * Health for an engine lexicon's entities (#5338): its `healthTargets`, then
165
+ * each target read by its provider lexicon with the engine's id. Never
166
+ * throws. A provider that is not installed, or whose health read does not
167
+ * cover the type, leaves the target `unsupported-kind`. Each `uncovered`
168
+ * resource is `unknown`, with its engine type. A thrown `healthTargets`
169
+ * comes back as `error`, with no entries.
170
+ */
171
+ export declare function observeEngineHealth(engine: EngineHealthLexicon, options: HealthReadOptions, provider: (lexicon: string) => Promise<HealthLexicon | undefined>, now?: () => Date): Promise<{
172
+ result: HealthReadResult;
173
+ error?: string;
174
+ }>;
package/dist/health.js CHANGED
@@ -103,3 +103,65 @@ export function healthEntry(type, state, detail, observedAt, checkedAt) {
103
103
  export function healthHole(type, reason, detail) {
104
104
  return { type, reason, detail };
105
105
  }
106
+ /** The first chant whose `lifecycle health` reads a terraform root's or pulumi stack's resources through the provider lexicons, with `healthTargets` and `HealthReadOptions.physicalIds`, and reports each resource no provider reads as `unknown` (#5338). */
107
+ export const ENGINE_HEALTH_FLOOR = "0.124.110";
108
+ /**
109
+ * Health for an engine lexicon's entities (#5338): its `healthTargets`, then
110
+ * each target read by its provider lexicon with the engine's id. Never
111
+ * throws. A provider that is not installed, or whose health read does not
112
+ * cover the type, leaves the target `unsupported-kind`. Each `uncovered`
113
+ * resource is `unknown`, with its engine type. A thrown `healthTargets`
114
+ * comes back as `error`, with no entries.
115
+ */
116
+ export async function observeEngineHealth(engine, options, provider, now) {
117
+ const empty = { entities: {}, unobserved: {}, absent: [] };
118
+ if (!engine.healthTargets || options.entities.size === 0)
119
+ return { result: empty };
120
+ let found;
121
+ try {
122
+ found = await engine.healthTargets(options);
123
+ }
124
+ catch (err) {
125
+ return { result: empty, error: err instanceof Error ? err.message : String(err) };
126
+ }
127
+ const entities = {};
128
+ const observedAt = (now?.() ?? new Date()).toISOString();
129
+ for (const [name, engineType] of Object.entries(found.uncovered ?? {})) {
130
+ entities[name] = healthEntry(engineType, "unknown", `no health read for ${engineType}`, observedAt);
131
+ }
132
+ const unobserved = { ...(found.unobserved ?? {}) };
133
+ const absent = [...(found.absent ?? [])];
134
+ const byLexicon = new Map();
135
+ for (const [name, target] of Object.entries(found.targets ?? {})) {
136
+ const list = byLexicon.get(target.lexicon) ?? [];
137
+ list.push([name, target]);
138
+ byLexicon.set(target.lexicon, list);
139
+ }
140
+ for (const [lexicon, list] of byLexicon) {
141
+ const reader = await provider(lexicon).catch(() => undefined);
142
+ const covered = new Set(reader?.healthTypes ?? []);
143
+ const read = new Map();
144
+ const physicalIds = {};
145
+ for (const [name, target] of list) {
146
+ if (!reader?.observeHealth || !covered.has(target.type)) {
147
+ unobserved[name] = {
148
+ type: target.type,
149
+ reason: "unsupported-kind",
150
+ detail: reader
151
+ ? `the ${lexicon} lexicon has no health read for ${target.type}`
152
+ : `${target.engineType} is read by the ${lexicon} lexicon, which is not installed`,
153
+ };
154
+ continue;
155
+ }
156
+ read.set(name, { entityType: target.type, props: {} });
157
+ physicalIds[name] = target.physicalId;
158
+ }
159
+ if (read.size === 0 || !reader)
160
+ continue;
161
+ const r = await observeHealthFor(reader, { ...options, buildOutput: "", entities: read, physicalIds });
162
+ Object.assign(entities, r.entities);
163
+ Object.assign(unobserved, r.unobserved);
164
+ absent.push(...r.absent);
165
+ }
166
+ return { result: { entities, unobserved, absent } };
167
+ }